From bba7bfd280e64bb4d34d601f5fab99d40fed664f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tina=20M=C3=BCller?= Date: Mon, 5 Dec 2016 23:44:36 +0100 Subject: [PATCH] Add tasks for all the new languages --- Lang/68000-Assembly/00DESCRIPTION | 4 + Lang/68000-Assembly/100-doors | 1 + Lang/68000-Assembly/Ackermann-function | 1 + Lang/68000-Assembly/README | 1 + Lang/68000-Assembly/Sieve-of-Eratosthenes | 1 + .../Walk-a-directory-Non-recursively | 1 + Lang/8051-Assembly/00DESCRIPTION | 25 + Lang/8051-Assembly/Arrays | 1 + Lang/8051-Assembly/Bitwise-operations | 1 + Lang/8051-Assembly/Boolean-values | 1 + Lang/8051-Assembly/Empty-program | 1 + Lang/8051-Assembly/Function-definition | 1 + Lang/8051-Assembly/Integer-comparison | 1 + Lang/8051-Assembly/README | 1 + Lang/8051-Assembly/Sleep | 1 + Lang/8051-Assembly/Time-a-function | 1 + Lang/8th/00DESCRIPTION | 26 + Lang/8th/100-doors | 1 + Lang/8th/24-game | 1 + Lang/8th/99-Bottles-of-Beer | 1 + Lang/8th/A+B | 1 + Lang/8th/Ackermann-function | 1 + Lang/8th/Align-columns | 1 + Lang/8th/Apply-a-callback-to-an-array | 1 + .../Arbitrary-precision-integers--included- | 1 + Lang/8th/Arrays | 1 + Lang/8th/Averages-Arithmetic-mean | 1 + Lang/8th/Binary-digits | 1 + Lang/8th/Call-a-foreign-language-function | 1 + Lang/8th/Date-format | 1 + Lang/8th/Delete-a-file | 1 + Lang/8th/Detect-division-by-zero | 1 + Lang/8th/Determine-if-a-string-is-numeric | 1 + Lang/8th/Dot-product | 1 + Lang/8th/Empty-string | 1 + Lang/8th/Enforced-immutability | 1 + Lang/8th/Even-or-odd | 1 + Lang/8th/Evolutionary-algorithm | 1 + Lang/8th/Fibonacci-sequence | 1 + Lang/8th/FizzBuzz | 1 + Lang/8th/Flatten-a-list | 1 + Lang/8th/Formatted-numeric-output | 1 + Lang/8th/Generate-lower-case-ASCII-alphabet | 1 + Lang/8th/Generic-swap | 1 + Lang/8th/Greatest-common-divisor | 1 + Lang/8th/Greatest-element-of-a-list | 1 + Lang/8th/HTTP | 1 + Lang/8th/Hello-world-Text | 1 + Lang/8th/Here-document | 1 + Lang/8th/Higher-order-functions | 1 + Lang/8th/Integer-comparison | 1 + .../Keyboard-input-Obtain-a-Y-or-N-response | 1 + Lang/8th/Least-common-multiple | 1 + Lang/8th/Loops-For | 1 + Lang/8th/Loops-Infinite | 1 + Lang/8th/MD5 | 1 + Lang/8th/Modular-inverse | 1 + Lang/8th/Null-object | 1 + Lang/8th/One-dimensional-cellular-automata | 1 + Lang/8th/Parametrized-SQL-statement | 1 + Lang/8th/Pascals-triangle | 1 + Lang/8th/Queue-Usage | 1 + Lang/8th/README | 1 + Lang/8th/Range-expansion | 1 + Lang/8th/Read-a-file-line-by-line | 1 + Lang/8th/Read-entire-file | 1 + Lang/8th/Regular-expressions | 1 + Lang/8th/Repeat-a-string | 1 + Lang/8th/Reverse-a-string | 1 + Lang/8th/Semordnilap | 1 + Lang/8th/Sleep | 1 + Lang/8th/Sort-an-integer-array | 1 + Lang/8th/Temperature-conversion | 1 + Lang/8th/Towers-of-Hanoi | 1 + Lang/8th/Unicode-variable-names | 1 + Lang/8th/Unix-ls | 1 + Lang/8th/Variables | 1 + Lang/8th/Walk-a-directory-Non-recursively | 1 + Lang/8th/Walk-a-directory-Recursively | 1 + Lang/8th/Web-scraping | 1 + Lang/8th/XML-Input | 1 + Lang/8th/Zero-to-the-zero-power | 1 + Lang/AngelScript/00DESCRIPTION | 6 + Lang/AngelScript/README | 1 + Lang/AntLang/00DESCRIPTION | 56 ++ Lang/AntLang/Array-concatenation | 1 + Lang/AntLang/Arrays | 1 + Lang/AntLang/Averages-Arithmetic-mean | 1 + Lang/AntLang/Averages-Median | 1 + Lang/AntLang/Call-a-function | 1 + Lang/AntLang/Closures-Value-capture | 1 + Lang/AntLang/Comments | 1 + Lang/AntLang/Even-or-odd | 1 + Lang/AntLang/Factorial | 1 + Lang/AntLang/Fibonacci-sequence | 1 + Lang/AntLang/Filter | 1 + Lang/AntLang/FizzBuzz | 1 + Lang/AntLang/Function-composition | 1 + Lang/AntLang/Function-definition | 1 + Lang/AntLang/Greatest-common-divisor | 1 + Lang/AntLang/Greatest-element-of-a-list | 1 + Lang/AntLang/Hello-world-Text | 1 + Lang/AntLang/Hello-world-Web-server | 1 + Lang/AntLang/Higher-order-functions | 1 + Lang/AntLang/Include-a-file | 1 + Lang/AntLang/JSON | 1 + Lang/AntLang/README | 1 + Lang/AntLang/Sleep | 1 + Lang/Apex/00DESCRIPTION | 38 + Lang/Apex/99-Bottles-of-Beer | 1 + Lang/Apex/A+B | 1 + Lang/Apex/ABC-Problem | 1 + Lang/Apex/Abstract-type | 1 + Lang/Apex/Array-concatenation | 1 + Lang/Apex/Arrays | 1 + Lang/Apex/Assertions | 1 + Lang/Apex/Associative-array-Creation | 1 + Lang/Apex/Call-an-object-method | 1 + Lang/Apex/Collections | 1 + Lang/Apex/Comments | 1 + Lang/Apex/Conditional-structures | 1 + Lang/Apex/Copy-a-string | 1 + Lang/Apex/Count-occurrences-of-a-substring | 1 + Lang/Apex/Date-format | 1 + Lang/Apex/Determine-if-a-string-is-numeric | 1 + Lang/Apex/Empty-string | 1 + Lang/Apex/Factorial | 1 + Lang/Apex/Fibonacci-sequence | 1 + Lang/Apex/Filter | 1 + Lang/Apex/Increment-a-numerical-string | 1 + Lang/Apex/JSON | 1 + Lang/Apex/Logical-operations | 1 + Lang/Apex/Loops-For | 1 + Lang/Apex/Loops-Foreach | 1 + Lang/Apex/README | 1 + Lang/Apex/Reverse-a-string | 1 + Lang/Apex/Set | 1 + Lang/Apex/String-comparison | 1 + Lang/Apex/String-concatenation | 1 + Lang/Apex/String-length | 1 + Lang/Apex/Substring | 1 + Lang/Apex/Substring-Top-and-tail | 1 + Lang/Apex/Symmetric-difference | 1 + Lang/Apex/URL-decoding | 1 + Lang/Apex/URL-encoding | 1 + Lang/Apex/Variables | 1 + Lang/App-Inventor/00DESCRIPTION | 5 + Lang/App-Inventor/README | 1 + Lang/App-Inventor/Web-scraping | 1 + Lang/Apricot/00DESCRIPTION | 5 + Lang/Apricot/Hello-world-Text | 1 + Lang/Apricot/README | 1 + Lang/Arc/00DESCRIPTION | 4 + Lang/Arc/A+B | 1 + Lang/Arc/FizzBuzz | 1 + Lang/Arc/Generic-swap | 1 + Lang/Arc/Hostname | 1 + Lang/Arc/Levenshtein-distance | 1 + Lang/Arc/N-queens-problem | 1 + Lang/Arc/README | 1 + Lang/Arendelle/00DESCRIPTION | 14 + Lang/Arendelle/README | 1 + Lang/AutoLISP/00DESCRIPTION | 7 + Lang/AutoLISP/Hello-world-Text | 1 + Lang/AutoLISP/README | 1 + Lang/Axe/00DESCRIPTION | 16 + Lang/Axe/99-Bottles-of-Beer | 1 + Lang/Axe/Address-of-a-variable | 1 + Lang/Axe/Arrays | 1 + Lang/Axe/Assertions | 1 + Lang/Axe/Binary-digits | 1 + Lang/Axe/Binary-search | 1 + Lang/Axe/Bitmap | 1 + Lang/Axe/Bitwise-operations | 1 + Lang/Axe/Call-a-function | 1 + Lang/Axe/Character-codes | 1 + Lang/Axe/Check-that-file-exists | 1 + Lang/Axe/Collections | 1 + Lang/Axe/Color-of-a-screen-pixel | 1 + Lang/Axe/Comments | 1 + Lang/Axe/Compound-data-type | 1 + Lang/Axe/Conditional-structures | 1 + Lang/Axe/Conways-Game-of-Life | 1 + Lang/Axe/Copy-a-string | 1 + Lang/Axe/Create-a-file | 1 + Lang/Axe/Delete-a-file | 1 + .../Axe/Doubly-linked-list-Element-definition | 1 + Lang/Axe/Doubly-linked-list-Element-insertion | 1 + Lang/Axe/Doubly-linked-list-Traversal | 1 + Lang/Axe/Empty-program | 1 + Lang/Axe/Empty-string | 1 + Lang/Axe/Execute-Brain---- | 1 + Lang/Axe/Factorial | 1 + Lang/Axe/Fibonacci-sequence | 1 + Lang/Axe/File-size | 1 + Lang/Axe/Find-limit-of-recursion | 1 + Lang/Axe/FizzBuzz | 1 + Lang/Axe/Function-definition | 1 + Lang/Axe/Generic-swap | 1 + Lang/Axe/Greatest-common-divisor | 1 + Lang/Axe/Greatest-element-of-a-list | 1 + Lang/Axe/Hello-world-Graphical | 1 + Lang/Axe/Hello-world-Newbie | 1 + Lang/Axe/Hello-world-Newline-omission | 1 + Lang/Axe/Hello-world-Text | 1 + Lang/Axe/Image-noise | 1 + Lang/Axe/Include-a-file | 1 + Lang/Axe/Integer-comparison | 1 + Lang/Axe/Integer-overflow | 1 + Lang/Axe/Integer-sequence | 1 + .../Keyboard-input-Flush-the-keyboard-buffer | 1 + Lang/Axe/Keyboard-input-Keypress-check | 1 + .../Keyboard-input-Obtain-a-Y-or-N-response | 1 + Lang/Axe/Literals-Floating-point | 1 + Lang/Axe/Literals-Integer | 1 + Lang/Axe/Literals-String | 1 + Lang/Axe/Logical-operations | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/Axe/Loops-Break | 1 + Lang/Axe/Loops-Do-while | 1 + Lang/Axe/Loops-Downward-for | 1 + Lang/Axe/Loops-For | 1 + Lang/Axe/Loops-For-with-a-specified-step | 1 + Lang/Axe/Loops-Infinite | 1 + Lang/Axe/Loops-N-plus-one-half | 1 + Lang/Axe/Loops-While | 1 + Lang/Axe/Memory-allocation | 1 + Lang/Axe/Menu | 1 + Lang/Axe/Multiplication-tables | 1 + Lang/Axe/Null-object | 1 + Lang/Axe/Program-termination | 1 + Lang/Axe/README | 1 + Lang/Axe/Real-constants-and-functions | 1 + Lang/Axe/Short-circuit-evaluation | 1 + .../Axe/Singly-linked-list-Element-definition | 1 + Lang/Axe/Singly-linked-list-Element-insertion | 1 + Lang/Axe/Singly-linked-list-Traversal | 1 + Lang/Axe/Sleep | 1 + Lang/Axe/Sort-an-integer-array | 1 + Lang/Axe/Stack | 1 + Lang/Axe/String-append | 1 + Lang/Axe/String-concatenation | 1 + Lang/Axe/String-length | 1 + Lang/Axe/Substring | 1 + Lang/Axe/Terminal-control-Clear-the-screen | 1 + Lang/Axe/Terminal-control-Cursor-movement | 1 + Lang/Axe/Terminal-control-Cursor-positioning | 1 + Lang/Axe/Terminal-control-Inverse-video | 1 + Lang/Axe/Topic-variable | 1 + Lang/Axe/Trigonometric-functions | 1 + Lang/Axe/User-input-Text | 1 + Lang/Axe/Variables | 1 + Lang/B4J/00DESCRIPTION | 16 + Lang/B4J/README | 1 + Lang/B4J/Simple-windowed-application | 1 + Lang/BML/00DESCRIPTION | 13 + Lang/BML/Arrays | 1 + Lang/BML/Hello-world-Graphical | 1 + Lang/BML/Hello-world-Text | 1 + Lang/BML/README | 1 + Lang/Battlestar/00DESCRIPTION | 30 + Lang/Battlestar/99-Bottles-of-Beer | 1 + Lang/Battlestar/Fibonacci-sequence | 1 + Lang/Battlestar/Hello-world-Text | 1 + Lang/Battlestar/README | 1 + Lang/Beeswax/00DESCRIPTION | 35 + Lang/Beeswax/README | 1 + Lang/Binary-Lambda-Calculus/00DESCRIPTION | 10 + Lang/Binary-Lambda-Calculus/README | 1 + Lang/CHR/00DESCRIPTION | 8 + Lang/CHR/README | 1 + Lang/CafeOBJ/00DESCRIPTION | 66 ++ Lang/CafeOBJ/README | 1 + Lang/CafeOBJ/Remove-duplicate-elements | 1 + Lang/Ceylon/00DESCRIPTION | 21 + Lang/Ceylon/100-doors | 1 + Lang/Ceylon/24-game | 1 + Lang/Ceylon/99-Bottles-of-Beer | 1 + Lang/Ceylon/A+B | 1 + Lang/Ceylon/ABC-Problem | 1 + ...ficient-and-perfect-number-classifications | 1 + Lang/Ceylon/Accumulator-factory | 1 + Lang/Ceylon/Animation | 1 + Lang/Ceylon/Array-concatenation | 1 + Lang/Ceylon/Arrays | 1 + Lang/Ceylon/Associative-array-Creation | 1 + Lang/Ceylon/Associative-array-Iteration | 1 + Lang/Ceylon/Balanced-brackets | 1 + Lang/Ceylon/Bulls-and-cows | 1 + Lang/Ceylon/Closures-Value-capture | 1 + Lang/Ceylon/Deal-cards-for-FreeCell | 1 + Lang/Ceylon/Detect-division-by-zero | 1 + Lang/Ceylon/Evolutionary-algorithm | 1 + Lang/Ceylon/Execute-HQ9+ | 1 + Lang/Ceylon/Factorial | 1 + Lang/Ceylon/Factors-of-an-integer | 1 + Lang/Ceylon/First-class-functions | 1 + Lang/Ceylon/Five-weekends | 1 + Lang/Ceylon/FizzBuzz | 1 + Lang/Ceylon/Flatten-a-list | 1 + Lang/Ceylon/Forest-fire | 1 + Lang/Ceylon/Guess-the-number-With-feedback | 1 + .../Guess-the-number-With-feedback--player- | 1 + Lang/Ceylon/Hailstone-sequence | 1 + Lang/Ceylon/Hash-from-two-arrays | 1 + Lang/Ceylon/Increment-a-numerical-string | 1 + Lang/Ceylon/Iterated-digits-squaring | 1 + Lang/Ceylon/Knapsack-problem-0-1 | 1 + .../Ceylon/Largest-int-from-concatenated-ints | 1 + Lang/Ceylon/Loops-Downward-for | 1 + Lang/Ceylon/Loops-For | 1 + Lang/Ceylon/Loops-For-with-a-specified-step | 1 + Lang/Ceylon/Luhn-test-of-credit-card-numbers | 1 + Lang/Ceylon/Menu | 1 + Lang/Ceylon/Mutual-recursion | 1 + Lang/Ceylon/One-dimensional-cellular-automata | 1 + Lang/Ceylon/Pangram-checker | 1 + Lang/Ceylon/Parametric-polymorphism | 1 + Lang/Ceylon/Parsing-RPN-calculator-algorithm | 1 + Lang/Ceylon/Parsing-Shunting-yard-algorithm | 1 + Lang/Ceylon/Partial-function-application | 1 + Lang/Ceylon/Pick-random-element | 1 + Lang/Ceylon/Playing-cards | 1 + Lang/Ceylon/Quine | 1 + Lang/Ceylon/README | 1 + Lang/Ceylon/Range-extraction | 1 + Lang/Ceylon/Remove-duplicate-elements | 1 + Lang/Ceylon/Repeat-a-string | 1 + Lang/Ceylon/Roman-numerals-Decode | 1 + Lang/Ceylon/Roman-numerals-Encode | 1 + Lang/Ceylon/S-Expressions | 1 + Lang/Ceylon/Search-a-list | 1 + Lang/Ceylon/Sort-using-a-custom-comparator | 1 + Lang/Ceylon/Stem-and-leaf-plot | 1 + Lang/Ceylon/Temperature-conversion | 1 + Lang/Ceylon/Tokenize-a-string | 1 + Lang/Ceylon/Tree-traversal | 1 + Lang/Ceylon/User-input-Text | 1 + Lang/Ceylon/Y-combinator | 1 + Lang/ChucK/00DESCRIPTION | 7 + Lang/ChucK/Arrays | 1 + Lang/ChucK/Call-an-object-method | 1 + Lang/ChucK/Comments | 1 + Lang/ChucK/Create-a-file | 1 + Lang/ChucK/Factorial | 1 + Lang/ChucK/Function-definition | 1 + Lang/ChucK/Hello-world-Text | 1 + Lang/ChucK/Include-a-file | 1 + Lang/ChucK/Inheritance-Single | 1 + Lang/ChucK/Integer-comparison | 1 + Lang/ChucK/Integer-sequence | 1 + Lang/ChucK/Loops-Do-while | 1 + Lang/ChucK/Loops-For-with-a-specified-step | 1 + Lang/ChucK/Loops-Infinite | 1 + Lang/ChucK/Loops-While | 1 + Lang/ChucK/README | 1 + Lang/ChucK/Record-sound | 1 + Lang/ChucK/String-concatenation | 1 + Lang/ChucK/Variables | 1 + Lang/Clarion/00DESCRIPTION | 3 + Lang/Clarion/100-doors | 1 + Lang/Clarion/README | 1 + Lang/Coco/00DESCRIPTION | 10 + Lang/Coco/100-doors | 1 + Lang/Coco/Bulls-and-cows | 1 + Lang/Coco/Classes | 1 + Lang/Coco/Count-the-coins | 1 + Lang/Coco/FizzBuzz | 1 + Lang/Coco/Function-definition | 1 + Lang/Coco/Hash-from-two-arrays | 1 + Lang/Coco/I-before-E-except-after-C | 1 + Lang/Coco/Inheritance-Single | 1 + Lang/Coco/Loops-Do-while | 1 + Lang/Coco/README | 1 + Lang/Coco/String-interpolation--included- | 1 + Lang/Comal/00DESCRIPTION | 8 + Lang/Comal/Conditional-structures | 1 + Lang/Comal/Factorial | 1 + Lang/Comal/Flow-control-structures | 1 + Lang/Comal/Hello-world-Text | 1 + Lang/Comal/Inheritance-Single | 1 + Lang/Comal/Literals-Integer | 1 + Lang/Comal/Loops-Infinite | 1 + Lang/Comal/README | 1 + Lang/Comal/Terminal-control-Clear-the-screen | 1 + Lang/Commodore-BASIC/00DESCRIPTION | 10 + Lang/Commodore-BASIC/100-doors | 1 + Lang/Commodore-BASIC/Prime-decomposition | 1 + Lang/Commodore-BASIC/Quine | 1 + Lang/Commodore-BASIC/README | 1 + .../Sorting-algorithms-Insertion-sort | 1 + Lang/Commodore-BASIC/Yin-and-yang | 1 + Lang/Computer-zero-Assembly/00DESCRIPTION | 2 + Lang/Computer-zero-Assembly/A+B | 1 + Lang/Computer-zero-Assembly/Arrays | 1 + Lang/Computer-zero-Assembly/Copy-a-string | 1 + Lang/Computer-zero-Assembly/Empty-program | 1 + Lang/Computer-zero-Assembly/Factorial | 1 + .../Computer-zero-Assembly/Fibonacci-sequence | 1 + .../Computer-zero-Assembly/Integer-comparison | 1 + Lang/Computer-zero-Assembly/Integer-overflow | 1 + Lang/Computer-zero-Assembly/Integer-sequence | 1 + Lang/Computer-zero-Assembly/Jump-anywhere | 1 + Lang/Computer-zero-Assembly/README | 1 + .../Singly-linked-list-Traversal | 1 + Lang/Crystal/00DESCRIPTION | 17 + Lang/Crystal/100-doors | 1 + Lang/Crystal/A+B | 1 + Lang/Crystal/Amicable-pairs | 1 + Lang/Crystal/Bernoulli-numbers | 1 + Lang/Crystal/Even-or-odd | 1 + Lang/Crystal/Fast-Fourier-transform | 1 + Lang/Crystal/FizzBuzz | 1 + Lang/Crystal/Hello-world-Text | 1 + Lang/Crystal/Man-or-boy-test | 1 + Lang/Crystal/README | 1 + Lang/Crystal/Sorting-algorithms-Merge-sort | 1 + Lang/Crystal/Sorting-algorithms-Quicksort | 1 + Lang/DDNC/00DESCRIPTION | 4 + Lang/DDNC/Hello-world-Text | 1 + Lang/DDNC/README | 1 + Lang/DIV-Games-Studio/00DESCRIPTION | 2 + Lang/DIV-Games-Studio/Hello-world-Text | 1 + Lang/DIV-Games-Studio/README | 1 + Lang/ECL/00DESCRIPTION | 12 + Lang/ECL/100-doors | 1 + Lang/ECL/99-Bottles-of-Beer | 1 + Lang/ECL/Arithmetic-Integer | 1 + Lang/ECL/Array-concatenation | 1 + Lang/ECL/Assertions | 1 + Lang/ECL/Averages-Arithmetic-mean | 1 + Lang/ECL/Bitwise-operations | 1 + Lang/ECL/CSV-data-manipulation | 1 + Lang/ECL/Comments | 1 + Lang/ECL/Day-of-the-week | 1 + Lang/ECL/Detect-division-by-zero | 1 + Lang/ECL/Fibonacci-sequence | 1 + Lang/ECL/FizzBuzz | 1 + Lang/ECL/Greatest-element-of-a-list | 1 + Lang/ECL/Hash-join | 1 + Lang/ECL/Hello-world-Text | 1 + Lang/ECL/Higher-order-functions | 1 + Lang/ECL/Integer-comparison | 1 + Lang/ECL/Logical-operations | 1 + Lang/ECL/README | 1 + Lang/ECL/Remove-duplicate-elements | 1 + Lang/ECL/Remove-lines-from-a-file | 1 + Lang/ECL/Repeat-a-string | 1 + Lang/ECL/Return-multiple-values | 1 + Lang/ECL/Roman-numerals-Decode | 1 + Lang/ECL/Roman-numerals-Encode | 1 + Lang/ECL/String-case | 1 + Lang/ECL/String-interpolation--included- | 1 + Lang/ECL/Substring | 1 + Lang/EDSAC-order-code/00DESCRIPTION | 6 + Lang/EDSAC-order-code/A+B | 1 + Lang/EDSAC-order-code/Comments | 1 + Lang/EDSAC-order-code/Empty-program | 1 + Lang/EDSAC-order-code/Fibonacci-sequence | 1 + Lang/EDSAC-order-code/Hello-world-Text | 1 + Lang/EDSAC-order-code/Integer-comparison | 1 + Lang/EDSAC-order-code/Integer-sequence | 1 + Lang/EDSAC-order-code/Loops-For | 1 + Lang/EDSAC-order-code/README | 1 + Lang/ERRE/00DESCRIPTION | 23 + Lang/ERRE/100-doors | 1 + Lang/ERRE/24-game-Solve | 1 + Lang/ERRE/A+B | 1 + Lang/ERRE/ABC-Problem | 1 + Lang/ERRE/Accumulator-factory | 1 + Lang/ERRE/Ackermann-function | 1 + Lang/ERRE/Address-of-a-variable | 1 + Lang/ERRE/Almost-prime | 1 + Lang/ERRE/Amb | 1 + Lang/ERRE/Amicable-pairs | 1 + Lang/ERRE/Animate-a-pendulum | 1 + Lang/ERRE/Apply-a-callback-to-an-array | 1 + Lang/ERRE/Arithmetic-Complex | 1 + Lang/ERRE/Arithmetic-Integer | 1 + Lang/ERRE/Arithmetic-Rational | 1 + Lang/ERRE/Arithmetic-evaluation | 1 + Lang/ERRE/Arithmetic-geometric-mean | 1 + Lang/ERRE/Array-concatenation | 1 + Lang/ERRE/Averages-Median | 1 + Lang/ERRE/Averages-Mode | 1 + Lang/ERRE/Averages-Pythagorean-means | 1 + Lang/ERRE/Averages-Root-mean-square | 1 + Lang/ERRE/Bitmap-Bresenhams-line-algorithm | 1 + Lang/ERRE/Bitmap-Flood-fill | 1 + Lang/ERRE/Bitmap-Midpoint-circle-algorithm | 1 + Lang/ERRE/Caesar-cipher | 1 + Lang/ERRE/Catalan-numbers | 1 + Lang/ERRE/Catalan-numbers-Pascals-triangle | 1 + ...Circles-of-given-radius-through-two-points | 1 + Lang/ERRE/Classes | 1 + Lang/ERRE/Combinations | 1 + Lang/ERRE/Comments | 1 + Lang/ERRE/Create-a-file | 1 + .../Create-a-two-dimensional-array-at-runtime | 1 + Lang/ERRE/Day-of-the-week | 1 + Lang/ERRE/Deal-cards-for-FreeCell | 1 + Lang/ERRE/Detect-division-by-zero | 1 + Lang/ERRE/Dinesmans-multiple-dwelling-problem | 1 + Lang/ERRE/Dragon-curve | 1 + Lang/ERRE/Draw-a-sphere | 1 + Lang/ERRE/Empty-program | 1 + Lang/ERRE/Equilibrium-index | 1 + Lang/ERRE/Ethiopian-multiplication | 1 + Lang/ERRE/Evaluate-binomial-coefficients | 1 + Lang/ERRE/Even-or-odd | 1 + Lang/ERRE/Execute-a-system-command | 1 + Lang/ERRE/Exponentiation-operator | 1 + Lang/ERRE/Factorial | 1 + Lang/ERRE/Factors-of-an-integer | 1 + Lang/ERRE/Fast-Fourier-transform | 1 + Lang/ERRE/Fibonacci-n-step-number-sequences | 1 + Lang/ERRE/Fibonacci-sequence | 1 + Lang/ERRE/Find-the-missing-permutation | 1 + Lang/ERRE/Five-weekends | 1 + Lang/ERRE/FizzBuzz | 1 + Lang/ERRE/Floyds-triangle | 1 + Lang/ERRE/Formatted-numeric-output | 1 + Lang/ERRE/Greatest-common-divisor | 1 + Lang/ERRE/Greatest-element-of-a-list | 1 + Lang/ERRE/Greatest-subsequential-sum | 1 + Lang/ERRE/Guess-the-number | 1 + Lang/ERRE/Hailstone-sequence | 1 + Lang/ERRE/Hamming-numbers | 1 + Lang/ERRE/Haversine-formula | 1 + Lang/ERRE/Hello-world-Line-printer | 1 + Lang/ERRE/Hello-world-Newline-omission | 1 + Lang/ERRE/Hello-world-Text | 1 + Lang/ERRE/Heronian-triangles | 1 + Lang/ERRE/Higher-order-functions | 1 + Lang/ERRE/Hofstadter-Q-sequence | 1 + Lang/ERRE/Horizontal-sundial-calculations | 1 + .../Horners-rule-for-polynomial-evaluation | 1 + Lang/ERRE/Identity-matrix | 1 + Lang/ERRE/Increment-a-numerical-string | 1 + Lang/ERRE/Infinity | 1 + Lang/ERRE/Integer-sequence | 1 + Lang/ERRE/Iterated-digits-squaring | 1 + Lang/ERRE/Josephus-problem | 1 + Lang/ERRE/Jump-anywhere | 1 + .../Keyboard-input-Flush-the-keyboard-buffer | 1 + Lang/ERRE/Keyboard-input-Keypress-check | 1 + .../Keyboard-input-Obtain-a-Y-or-N-response | 1 + Lang/ERRE/Knights-tour | 1 + Lang/ERRE/Knuth-shuffle | 1 + Lang/ERRE/Leap-year | 1 + Lang/ERRE/Least-common-multiple | 1 + Lang/ERRE/Letter-frequency | 1 + Lang/ERRE/Levenshtein-distance | 1 + Lang/ERRE/Linear-congruential-generator | 1 + Lang/ERRE/Literals-Integer | 1 + Lang/ERRE/Look-and-say-sequence | 1 + Lang/ERRE/Loops-Break | 1 + Lang/ERRE/Loops-Continue | 1 + Lang/ERRE/Loops-Do-while | 1 + Lang/ERRE/Loops-Downward-for | 1 + Lang/ERRE/Loops-For | 1 + Lang/ERRE/Loops-For-with-a-specified-step | 1 + Lang/ERRE/Loops-Foreach | 1 + Lang/ERRE/Loops-Infinite | 1 + Lang/ERRE/Loops-N-plus-one-half | 1 + Lang/ERRE/Loops-Nested | 1 + Lang/ERRE/Loops-While | 1 + Lang/ERRE/Lucas-Lehmer-test | 1 + Lang/ERRE/Magic-squares-of-odd-order | 1 + Lang/ERRE/Make-directory-path | 1 + Lang/ERRE/Mandelbrot-set | 1 + Lang/ERRE/Map-range | 1 + Lang/ERRE/Matrix-exponentiation-operator | 1 + Lang/ERRE/Matrix-multiplication | 1 + Lang/ERRE/Maximum-triangle-path-sum | 1 + Lang/ERRE/Menu | 1 + Lang/ERRE/Middle-three-digits | 1 + Lang/ERRE/Modular-inverse | 1 + Lang/ERRE/Monte-Carlo-methods | 1 + Lang/ERRE/Mouse-position | 1 + Lang/ERRE/Multifactorial | 1 + Lang/ERRE/Multiple-regression | 1 + Lang/ERRE/N-queens-problem | 1 + Lang/ERRE/Narcissistic-decimal-number | 1 + Lang/ERRE/Nth | 1 + Lang/ERRE/One-dimensional-cellular-automata | 1 + Lang/ERRE/One-of-n-lines-in-a-file | 1 + Lang/ERRE/Pascals-triangle | 1 + Lang/ERRE/Perfect-numbers | 1 + Lang/ERRE/Primality-by-trial-division | 1 + Lang/ERRE/Prime-decomposition | 1 + Lang/ERRE/Probabilistic-choice | 1 + Lang/ERRE/Pythagorean-triples | 1 + Lang/ERRE/Quaternion-type | 1 + Lang/ERRE/Queue-Definition | 1 + Lang/ERRE/Quine | 1 + Lang/ERRE/README | 1 + Lang/ERRE/Random-numbers | 1 + Lang/ERRE/Rate-counter | 1 + Lang/ERRE/Read-a-file-line-by-line | 1 + Lang/ERRE/Real-constants-and-functions | 1 + Lang/ERRE/Repeat-a-string | 1 + Lang/ERRE/Resistor-mesh | 1 + Lang/ERRE/Return-multiple-values | 1 + Lang/ERRE/Reverse-a-string | 1 + Lang/ERRE/Roman-numerals-Decode | 1 + Lang/ERRE/Roman-numerals-Encode | 1 + Lang/ERRE/Roots-of-a-function | 1 + Lang/ERRE/Roots-of-a-quadratic-function | 1 + Lang/ERRE/Roots-of-unity | 1 + Lang/ERRE/Rot-13 | 1 + Lang/ERRE/Runge-Kutta-method | 1 + Lang/ERRE/Semiprime | 1 + .../ERRE/Sequence-of-primes-by-Trial-Division | 1 + Lang/ERRE/Sierpinski-carpet | 1 + Lang/ERRE/Sierpinski-triangle-Graphical | 1 + Lang/ERRE/Sieve-of-Eratosthenes | 1 + Lang/ERRE/Sleep | 1 + Lang/ERRE/Sort-disjoint-sublist | 1 + Lang/ERRE/Sorting-algorithms-Bubble-sort | 1 + Lang/ERRE/Sorting-algorithms-Insertion-sort | 1 + Lang/ERRE/Sorting-algorithms-Merge-sort | 1 + Lang/ERRE/Sorting-algorithms-Quicksort | 1 + Lang/ERRE/String-concatenation | 1 + Lang/ERRE/String-prepend | 1 + Lang/ERRE/Sudoku | 1 + Lang/ERRE/Towers-of-Hanoi | 1 + Lang/ERRE/Trabb-Pardo-Knuth-algorithm | 1 + Lang/ERRE/Twelve-statements | 1 + Lang/ERRE/Ulam-spiral--for-primes- | 1 + Lang/ERRE/Unbias-a-random-generator | 1 + Lang/ERRE/Van-der-Corput-sequence | 1 + Lang/ERRE/Vector-products | 1 + Lang/ERRE/Write-language-name-in-3D-ASCII | 1 + Lang/ERRE/Zebra-puzzle | 1 + Lang/ERRE/Zero-to-the-zero-power | 1 + Lang/ERRE/Zig-zag-matrix | 1 + Lang/EchoLisp/00DESCRIPTION | 15 + Lang/EchoLisp/100-doors | 1 + Lang/EchoLisp/24-game | 1 + Lang/EchoLisp/24-game-Solve | 1 + Lang/EchoLisp/A+B | 1 + Lang/EchoLisp/ABC-Problem | 1 + Lang/EchoLisp/AKS-test-for-primes | 1 + ...ficient-and-perfect-number-classifications | 1 + Lang/EchoLisp/Accumulator-factory | 1 + Lang/EchoLisp/Active-object | 1 + .../EchoLisp/Aliquot-sequence-classifications | 1 + Lang/EchoLisp/Almost-prime | 1 + Lang/EchoLisp/Amicable-pairs | 1 + Lang/EchoLisp/Anagrams | 1 + Lang/EchoLisp/Anagrams-Deranged-anagrams | 1 + Lang/EchoLisp/Anonymous-recursion | 1 + Lang/EchoLisp/Apply-a-callback-to-an-array | 1 + .../Arbitrary-precision-integers--included- | 1 + Lang/EchoLisp/Arithmetic-Complex | 1 + Lang/EchoLisp/Arithmetic-Rational | 1 + Lang/EchoLisp/Arithmetic-geometric-mean | 1 + Lang/EchoLisp/Array-concatenation | 1 + Lang/EchoLisp/Assertions | 1 + Lang/EchoLisp/Associative-array-Creation | 1 + Lang/EchoLisp/Associative-array-Iteration | 1 + Lang/EchoLisp/Average-loop-length | 1 + Lang/EchoLisp/Averages-Arithmetic-mean | 1 + Lang/EchoLisp/Averages-Mean-angle | 1 + Lang/EchoLisp/Averages-Mean-time-of-day | 1 + Lang/EchoLisp/Averages-Median | 1 + Lang/EchoLisp/Averages-Mode | 1 + Lang/EchoLisp/Averages-Pythagorean-means | 1 + Lang/EchoLisp/Averages-Root-mean-square | 1 + Lang/EchoLisp/Averages-Simple-moving-average | 1 + Lang/EchoLisp/Balanced-brackets | 1 + Lang/EchoLisp/Bernoulli-numbers | 1 + Lang/EchoLisp/Binary-digits | 1 + Lang/EchoLisp/Bitmap | 1 + Lang/EchoLisp/Boolean-values | 1 + Lang/EchoLisp/CSV-data-manipulation | 1 + Lang/EchoLisp/CSV-to-HTML-translation | 1 + .../EchoLisp/Carmichael-3-strong-pseudoprimes | 1 + Lang/EchoLisp/Case-sensitivity-of-identifiers | 1 + Lang/EchoLisp/Catalan-numbers | 1 + .../EchoLisp/Catalan-numbers-Pascals-triangle | 1 + Lang/EchoLisp/Catamorphism | 1 + Lang/EchoLisp/Check-Machin-like-formulas | 1 + Lang/EchoLisp/Chinese-remainder-theorem | 1 + Lang/EchoLisp/Classes | 1 + Lang/EchoLisp/Closures-Value-capture | 1 + Lang/EchoLisp/Collections | 1 + Lang/EchoLisp/Combinations | 1 + Lang/EchoLisp/Combinations-and-permutations | 1 + Lang/EchoLisp/Combinations-with-repetitions | 1 + Lang/EchoLisp/Comma-quibbling | 1 + Lang/EchoLisp/Comments | 1 + Lang/EchoLisp/Compile-time-calculation | 1 + Lang/EchoLisp/Compound-data-type | 1 + Lang/EchoLisp/Concurrent-computing | 1 + .../Constrained-random-points-on-a-circle | 1 + .../Convert-decimal-number-to-rational | 1 + Lang/EchoLisp/Copy-a-string | 1 + Lang/EchoLisp/Count-in-factors | 1 + .../EchoLisp/Count-occurrences-of-a-substring | 1 + Lang/EchoLisp/Count-the-coins | 1 + Lang/EchoLisp/Create-a-file | 1 + Lang/EchoLisp/Create-an-HTML-table | 1 + Lang/EchoLisp/Currying | 1 + Lang/EchoLisp/Date-manipulation | 1 + Lang/EchoLisp/Define-a-primitive-data-type | 1 + .../EchoLisp/Determine-if-a-string-is-numeric | 1 + .../Dinesmans-multiple-dwelling-problem | 1 + Lang/EchoLisp/Dining-philosophers | 1 + Lang/EchoLisp/Dot-product | 1 + Lang/EchoLisp/Empty-program | 1 + Lang/EchoLisp/Entropy | 1 + Lang/EchoLisp/Evolutionary-algorithm | 1 + ...Catch-an-exception-thrown-in-a-nested-call | 1 + Lang/EchoLisp/Execute-a-Markov-algorithm | 1 + Lang/EchoLisp/Exponentiation-operator | 1 + Lang/EchoLisp/Extend-your-language | 1 + Lang/EchoLisp/Extensible-prime-generator | 1 + Lang/EchoLisp/Factorial | 1 + Lang/EchoLisp/Factors-of-a-Mersenne-number | 1 + Lang/EchoLisp/Factors-of-an-integer | 1 + Lang/EchoLisp/Fast-Fourier-transform | 1 + .../Fibonacci-n-step-number-sequences | 1 + Lang/EchoLisp/Fibonacci-sequence | 1 + Lang/EchoLisp/Fibonacci-word | 1 + Lang/EchoLisp/Filter | 1 + Lang/EchoLisp/Find-the-missing-permutation | 1 + Lang/EchoLisp/First-class-environments | 1 + Lang/EchoLisp/First-class-functions | 1 + Lang/EchoLisp/Flatten-a-list | 1 + Lang/EchoLisp/Formal-power-series | 1 + Lang/EchoLisp/Forward-difference | 1 + Lang/EchoLisp/Function-composition | 1 + Lang/EchoLisp/Function-definition | 1 + .../Generate-Chess960-starting-position | 1 + .../Generate-lower-case-ASCII-alphabet | 1 + Lang/EchoLisp/Generator-Exponential | 1 + Lang/EchoLisp/Generic-swap | 1 + Lang/EchoLisp/Greatest-element-of-a-list | 1 + Lang/EchoLisp/Greatest-subsequential-sum | 1 + Lang/EchoLisp/Guess-the-number-With-feedback | 1 + Lang/EchoLisp/HTTP | 1 + Lang/EchoLisp/HTTPS | 1 + Lang/EchoLisp/Hailstone-sequence | 1 + Lang/EchoLisp/Harshad-or-Niven-series | 1 + Lang/EchoLisp/Hash-from-two-arrays | 1 + Lang/EchoLisp/Hash-join | 1 + Lang/EchoLisp/Hello-world-Graphical | 1 + Lang/EchoLisp/Hello-world-Line-printer | 1 + Lang/EchoLisp/Hello-world-Newbie | 1 + Lang/EchoLisp/Hello-world-Newline-omission | 1 + Lang/EchoLisp/Hello-world-Text | 1 + Lang/EchoLisp/Heronian-triangles | 1 + Lang/EchoLisp/History-variables | 1 + .../Hofstadter-Conway-$10,000-sequence | 1 + .../Hofstadter-Figure-Figure-sequences | 1 + Lang/EchoLisp/Hofstadter-Q-sequence | 1 + .../Horners-rule-for-polynomial-evaluation | 1 + Lang/EchoLisp/Increment-a-numerical-string | 1 + Lang/EchoLisp/Integer-sequence | 1 + Lang/EchoLisp/Interactive-programming | 1 + Lang/EchoLisp/Introspection | 1 + Lang/EchoLisp/Inverted-index | 1 + Lang/EchoLisp/Inverted-syntax | 1 + Lang/EchoLisp/JSON | 1 + Lang/EchoLisp/Josephus-problem | 1 + Lang/EchoLisp/Keyboard-macros | 1 + Lang/EchoLisp/Knapsack-problem-0-1 | 1 + Lang/EchoLisp/Knapsack-problem-Bounded | 1 + Lang/EchoLisp/Knapsack-problem-Continuous | 1 + Lang/EchoLisp/Knapsack-problem-Unbounded | 1 + Lang/EchoLisp/Knights-tour | 1 + Lang/EchoLisp/Knuth-shuffle | 1 + Lang/EchoLisp/LU-decomposition | 1 + Lang/EchoLisp/Langtons-ant | 1 + Lang/EchoLisp/Least-common-multiple | 1 + Lang/EchoLisp/Left-factorials | 1 + Lang/EchoLisp/Letter-frequency | 1 + Lang/EchoLisp/Levenshtein-distance | 1 + Lang/EchoLisp/List-comprehensions | 1 + Lang/EchoLisp/Long-multiplication | 1 + Lang/EchoLisp/Look-and-say-sequence | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/EchoLisp/Loops-Downward-for | 1 + Lang/EchoLisp/Loops-For-with-a-specified-step | 1 + Lang/EchoLisp/Loops-Foreach | 1 + Lang/EchoLisp/Loops-N-plus-one-half | 1 + Lang/EchoLisp/Loops-Nested | 1 + Lang/EchoLisp/Loops-While | 1 + Lang/EchoLisp/Lucas-Lehmer-test | 1 + .../EchoLisp/Luhn-test-of-credit-card-numbers | 1 + Lang/EchoLisp/Magic-squares-of-odd-order | 1 + Lang/EchoLisp/Man-or-boy-test | 1 + Lang/EchoLisp/Mandelbrot-set | 1 + Lang/EchoLisp/Map-range | 1 + Lang/EchoLisp/Matrix-arithmetic | 1 + Lang/EchoLisp/Matrix-transposition | 1 + Lang/EchoLisp/Metered-concurrency | 1 + Lang/EchoLisp/Metronome | 1 + Lang/EchoLisp/Modular-exponentiation | 1 + Lang/EchoLisp/Modular-inverse | 1 + Lang/EchoLisp/Morse-code | 1 + Lang/EchoLisp/Mouse-position | 1 + Lang/EchoLisp/Multiple-distinct-objects | 1 + Lang/EchoLisp/Multiplication-tables | 1 + Lang/EchoLisp/Multiplicative-order | 1 + Lang/EchoLisp/Munching-squares | 1 + Lang/EchoLisp/N-queens-problem | 1 + Lang/EchoLisp/Null-object | 1 + Lang/EchoLisp/Object-serialization | 1 + Lang/EchoLisp/Odd-word-problem | 1 + Lang/EchoLisp/Order-disjoint-list-items | 1 + Lang/EchoLisp/Ordered-Partitions | 1 + Lang/EchoLisp/Ordered-words | 1 + Lang/EchoLisp/Palindrome-detection | 1 + .../EchoLisp/Parsing-RPN-calculator-algorithm | 1 + Lang/EchoLisp/Parsing-RPN-to-infix-conversion | 1 + Lang/EchoLisp/Parsing-Shunting-yard-algorithm | 1 + Lang/EchoLisp/Pattern-matching | 1 + .../EchoLisp/Percolation-Mean-cluster-density | 1 + Lang/EchoLisp/Percolation-Mean-run-density | 1 + Lang/EchoLisp/Permutations-Derangements | 1 + Lang/EchoLisp/Permutations-by-swapping | 1 + Lang/EchoLisp/Pernicious-numbers | 1 + Lang/EchoLisp/Phrase-reversals | 1 + Lang/EchoLisp/Pick-random-element | 1 + Lang/EchoLisp/Plot-coordinate-pairs | 1 + Lang/EchoLisp/Pointers-and-references | 1 + Lang/EchoLisp/Polymorphic-copy | 1 + Lang/EchoLisp/Polymorphism | 1 + Lang/EchoLisp/Power-set | 1 + Lang/EchoLisp/Primality-by-trial-division | 1 + Lang/EchoLisp/Prime-decomposition | 1 + Lang/EchoLisp/Priority-queue | 1 + Lang/EchoLisp/Program-name | 1 + Lang/EchoLisp/Queue-Definition | 1 + Lang/EchoLisp/README | 1 + .../EchoLisp/Random-number-generator--device- | 1 + .../Random-number-generator--included- | 1 + Lang/EchoLisp/Range-expansion | 1 + Lang/EchoLisp/Range-extraction | 1 + Lang/EchoLisp/Read-a-configuration-file | 1 + Lang/EchoLisp/Rep-string | 1 + Lang/EchoLisp/Return-multiple-values | 1 + Lang/EchoLisp/Reverse-a-string | 1 + Lang/EchoLisp/Reverse-words-in-a-string | 1 + Lang/EchoLisp/Roots-of-a-function | 1 + Lang/EchoLisp/Roots-of-unity | 1 + Lang/EchoLisp/Runtime-evaluation | 1 + .../Runtime-evaluation-In-an-environment | 1 + Lang/EchoLisp/S-Expressions | 1 + Lang/EchoLisp/Self-referential-sequence | 1 + Lang/EchoLisp/Semiprime | 1 + Lang/EchoLisp/Semordnilap | 1 + Lang/EchoLisp/Sequence-of-non-squares | 1 + .../Sequence-of-primes-by-Trial-Division | 1 + Lang/EchoLisp/Set | 1 + Lang/EchoLisp/Set-consolidation | 1 + Lang/EchoLisp/Set-of-real-numbers | 1 + Lang/EchoLisp/Set-puzzle | 1 + Lang/EchoLisp/Sieve-of-Eratosthenes | 1 + Lang/EchoLisp/Simple-windowed-application | 1 + .../Singly-linked-list-Element-insertion | 1 + Lang/EchoLisp/Singly-linked-list-Traversal | 1 + .../Sort-an-array-of-composite-structures | 1 + Lang/EchoLisp/Sort-disjoint-sublist | 1 + Lang/EchoLisp/Sorting-algorithms-Bubble-sort | 1 + Lang/EchoLisp/Sorting-algorithms-Heapsort | 1 + .../Sorting-algorithms-Permutation-sort | 1 + Lang/EchoLisp/Sorting-algorithms-Quicksort | 1 + .../Sorting-algorithms-Selection-sort | 1 + Lang/EchoLisp/Stable-marriage-problem | 1 + Lang/EchoLisp/Stack | 1 + Lang/EchoLisp/Stair-climbing-puzzle | 1 + Lang/EchoLisp/Stern-Brocot-sequence | 1 + Lang/EchoLisp/String-append | 1 + Lang/EchoLisp/String-case | 1 + Lang/EchoLisp/String-interpolation--included- | 1 + Lang/EchoLisp/String-matching | 1 + Lang/EchoLisp/String-prepend | 1 + .../Strip-a-set-of-characters-from-a-string | 1 + ...trip-whitespace-from-a-string-Top-and-tail | 1 + Lang/EchoLisp/Sum-multiples-of-3-and-5 | 1 + Lang/EchoLisp/Sum-of-a-series | 1 + Lang/EchoLisp/Synchronous-concurrency | 1 + Lang/EchoLisp/Table-creation-Postal-addresses | 1 + ...inal-control-Display-an-extended-character | 1 + Lang/EchoLisp/Test-a-function | 1 + Lang/EchoLisp/Top-rank-per-group | 1 + Lang/EchoLisp/Topological-sort | 1 + Lang/EchoLisp/Total-circles-area | 1 + Lang/EchoLisp/Trabb-Pardo-Knuth-algorithm | 1 + Lang/EchoLisp/Truncatable-primes | 1 + Lang/EchoLisp/Ulam-spiral--for-primes- | 1 + Lang/EchoLisp/Unicode-variable-names | 1 + Lang/EchoLisp/Universal-Turing-machine | 1 + Lang/EchoLisp/Unix-ls | 1 + Lang/EchoLisp/Vector-products | 1 + Lang/EchoLisp/Y-combinator | 1 + Lang/EchoLisp/Zebra-puzzle | 1 + .../EchoLisp/Zeckendorf-number-representation | 1 + Lang/EchoLisp/Zero-to-the-zero-power | 1 + Lang/Eero/00DESCRIPTION | 16 + Lang/Eero/100-doors | 1 + Lang/Eero/Currying | 1 + Lang/Eero/FizzBuzz | 1 + Lang/Eero/Increment-a-numerical-string | 1 + Lang/Eero/Quaternion-type | 1 + Lang/Eero/README | 1 + Lang/Eero/Sorting-algorithms-Quicksort | 1 + Lang/Eero/Substring | 1 + Lang/Eero/Substring-Top-and-tail | 1 + Lang/Eero/Y-combinator | 1 + Lang/Egison/00DESCRIPTION | 141 ++++ Lang/Egison/Amb | 1 + Lang/Egison/Combinations | 1 + Lang/Egison/Combinations-with-repetitions | 1 + Lang/Egison/Hello-world-Text | 1 + Lang/Egison/Longest-common-subsequence | 1 + Lang/Egison/Partial-function-application | 1 + Lang/Egison/README | 1 + Lang/Egison/Repeat-a-string | 1 + Lang/Egison/Set-consolidation | 1 + Lang/EhBASIC/00DESCRIPTION | 6 + Lang/EhBASIC/README | 1 + Lang/Elm/00DESCRIPTION | 17 + Lang/Elm/Animate-a-pendulum | 1 + Lang/Elm/Array-concatenation | 1 + Lang/Elm/Comments | 1 + Lang/Elm/Dragon-curve | 1 + Lang/Elm/Factorial | 1 + Lang/Elm/Fibonacci-sequence | 1 + Lang/Elm/FizzBuzz | 1 + Lang/Elm/Flatten-a-list | 1 + Lang/Elm/Galton-box-animation | 1 + Lang/Elm/Hello-world-Text | 1 + .../Keyboard-input-Obtain-a-Y-or-N-response | 1 + Lang/Elm/Knights-tour | 1 + Lang/Elm/Langtons-ant | 1 + Lang/Elm/Last-Friday-of-each-month | 1 + Lang/Elm/Maze-generation | 1 + Lang/Elm/Mouse-position | 1 + Lang/Elm/One-dimensional-cellular-automata | 1 + Lang/Elm/Palindrome-detection | 1 + Lang/Elm/README | 1 + Lang/Elm/Real-constants-and-functions | 1 + Lang/Elm/Reverse-a-string | 1 + Lang/Elm/Reverse-words-in-a-string | 1 + Lang/Elm/Sierpinski-triangle | 1 + Lang/Elm/String-case | 1 + Lang/Ezhil/00DESCRIPTION | 10 + Lang/Ezhil/Ackermann-function | 1 + Lang/Ezhil/Factorial | 1 + Lang/Ezhil/Greatest-common-divisor | 1 + Lang/Ezhil/Hailstone-sequence | 1 + Lang/Ezhil/Least-common-multiple | 1 + Lang/Ezhil/Prime-decomposition | 1 + Lang/Ezhil/README | 1 + Lang/Ezhil/Reverse-a-string | 1 + Lang/Ezhil/Sorting-algorithms-Bubble-sort | 1 + Lang/Ezhil/Sum-digits-of-an-integer | 1 + Lang/Ezhil/Sum-of-a-series | 1 + Lang/Ezhil/Temperature-conversion | 1 + Lang/Ezhil/Towers-of-Hanoi | 1 + Lang/FOCAL/00DESCRIPTION | 3 + Lang/FOCAL/Fibonacci-sequence | 1 + Lang/FOCAL/FizzBuzz | 1 + Lang/FOCAL/Hello-world-Newline-omission | 1 + Lang/FOCAL/Hello-world-Text | 1 + Lang/FOCAL/Loops-For | 1 + Lang/FOCAL/Loops-For-with-a-specified-step | 1 + Lang/FOCAL/README | 1 + Lang/FOCAL/Temperature-conversion | 1 + Lang/FRISC-Assembly/00DESCRIPTION | 3 + Lang/FRISC-Assembly/Fibonacci-sequence | 1 + Lang/FRISC-Assembly/README | 1 + Lang/FUZE-BASIC/00DESCRIPTION | 24 + Lang/FUZE-BASIC/100-doors | 1 + Lang/FUZE-BASIC/A+B | 1 + Lang/FUZE-BASIC/Comments | 1 + Lang/FUZE-BASIC/Hello-world-Text | 1 + Lang/FUZE-BASIC/README | 1 + Lang/FormulaOne/00DESCRIPTION | 30 + Lang/FormulaOne/README | 1 + Lang/FormulaOne/Zebra-puzzle | 1 + Lang/Free-Pascal/00DESCRIPTION | 7 + Lang/Free-Pascal/Quine | 1 + Lang/Free-Pascal/README | 1 + Lang/Free-Pascal/Random-numbers | 1 + Lang/FreeBASIC/00DESCRIPTION | 17 + Lang/FreeBASIC/100-doors | 1 + .../9-billion-names-of-God-the-integer | 1 + Lang/FreeBASIC/A+B | 1 + Lang/FreeBASIC/AKS-test-for-primes | 1 + Lang/FreeBASIC/Abstract-type | 1 + ...ficient-and-perfect-number-classifications | 1 + Lang/FreeBASIC/Accumulator-factory | 1 + Lang/FreeBASIC/Ackermann-function | 1 + Lang/FreeBASIC/Address-of-a-variable | 1 + Lang/FreeBASIC/Align-columns | 1 + Lang/FreeBASIC/Almost-prime | 1 + Lang/FreeBASIC/Amicable-pairs | 1 + Lang/FreeBASIC/Anagrams | 1 + Lang/FreeBASIC/Anagrams-Deranged-anagrams | 1 + Lang/FreeBASIC/Animation | 1 + Lang/FreeBASIC/Anonymous-recursion | 1 + .../Append-a-record-to-the-end-of-a-text-file | 1 + Lang/FreeBASIC/Apply-a-callback-to-an-array | 1 + .../Arbitrary-precision-integers--included- | 1 + Lang/FreeBASIC/Arithmetic-Complex | 1 + Lang/FreeBASIC/Arithmetic-Integer | 1 + Lang/FreeBASIC/Arithmetic-evaluation | 1 + Lang/FreeBASIC/Arithmetic-geometric-mean | 1 + Lang/FreeBASIC/Array-concatenation | 1 + Lang/FreeBASIC/Arrays | 1 + Lang/FreeBASIC/Assertions | 1 + Lang/FreeBASIC/Averages-Arithmetic-mean | 1 + Lang/FreeBASIC/Averages-Mean-angle | 1 + Lang/FreeBASIC/Averages-Mean-time-of-day | 1 + Lang/FreeBASIC/Averages-Median | 1 + Lang/FreeBASIC/Averages-Mode | 1 + Lang/FreeBASIC/Averages-Pythagorean-means | 1 + Lang/FreeBASIC/Averages-Root-mean-square | 1 + Lang/FreeBASIC/Averages-Simple-moving-average | 1 + Lang/FreeBASIC/Balanced-brackets | 1 + Lang/FreeBASIC/Benfords-law | 1 + Lang/FreeBASIC/Bernoulli-numbers | 1 + Lang/FreeBASIC/Binary-digits | 1 + Lang/FreeBASIC/Bitmap-B-zier-curves-Cubic | 1 + Lang/FreeBASIC/Bitmap-B-zier-curves-Quadratic | 1 + .../Bitmap-Bresenhams-line-algorithm | 1 + Lang/FreeBASIC/Bitmap-Flood-fill | 1 + .../Bitmap-Midpoint-circle-algorithm | 1 + Lang/FreeBASIC/Bitwise-operations | 1 + Lang/FreeBASIC/Boolean-values | 1 + Lang/FreeBASIC/Box-the-compass | 1 + Lang/FreeBASIC/CSV-data-manipulation | 1 + Lang/FreeBASIC/Caesar-cipher | 1 + Lang/FreeBASIC/Calendar | 1 + .../FreeBASIC/Calendar---for-REAL-programmers | 1 + .../Call-a-foreign-language-function | 1 + .../Call-a-function-in-a-shared-library | 1 + Lang/FreeBASIC/Call-an-object-method | 1 + .../Carmichael-3-strong-pseudoprimes | 1 + .../FreeBASIC/Case-sensitivity-of-identifiers | 1 + Lang/FreeBASIC/Catalan-numbers | 1 + .../Catalan-numbers-Pascals-triangle | 1 + Lang/FreeBASIC/Catamorphism | 1 + Lang/FreeBASIC/Character-codes | 1 + Lang/FreeBASIC/Check-that-file-exists | 1 + Lang/FreeBASIC/Classes | 1 + Lang/FreeBASIC/Closures-Value-capture | 1 + Lang/FreeBASIC/Collections | 1 + Lang/FreeBASIC/Color-of-a-screen-pixel | 1 + Lang/FreeBASIC/Colour-bars-Display | 1 + Lang/FreeBASIC/Comma-quibbling | 1 + Lang/FreeBASIC/Command-line-arguments | 1 + Lang/FreeBASIC/Comments | 1 + Lang/FreeBASIC/Compile-time-calculation | 1 + Lang/FreeBASIC/Compound-data-type | 1 + Lang/FreeBASIC/Concurrent-computing | 1 + Lang/FreeBASIC/Conditional-structures | 1 + .../Convert-decimal-number-to-rational | 1 + Lang/FreeBASIC/Copy-a-string | 1 + Lang/FreeBASIC/Count-in-factors | 1 + Lang/FreeBASIC/Count-in-octal | 1 + .../Count-occurrences-of-a-substring | 1 + Lang/FreeBASIC/Count-the-coins | 1 + Lang/FreeBASIC/Create-a-file | 1 + .../Create-a-two-dimensional-array-at-runtime | 1 + .../Create-an-object-at-a-given-address | 1 + Lang/FreeBASIC/Currying | 1 + Lang/FreeBASIC/Date-format | 1 + Lang/FreeBASIC/Date-manipulation | 1 + Lang/FreeBASIC/Deal-cards-for-FreeCell | 1 + Lang/FreeBASIC/Define-a-primitive-data-type | 1 + Lang/FreeBASIC/Delete-a-file | 1 + Lang/FreeBASIC/Detect-division-by-zero | 1 + .../Determine-if-a-string-is-numeric | 1 + Lang/FreeBASIC/Digital-root | 1 + Lang/FreeBASIC/Dynamic-variable-names | 1 + Lang/FreeBASIC/Empty-directory | 1 + Lang/FreeBASIC/Empty-program | 1 + Lang/FreeBASIC/Empty-string | 1 + Lang/FreeBASIC/Entropy | 1 + Lang/FreeBASIC/Enumerations | 1 + Lang/FreeBASIC/Environment-variables | 1 + Lang/FreeBASIC/Equilibrium-index | 1 + Lang/FreeBASIC/Evaluate-binomial-coefficients | 1 + Lang/FreeBASIC/Even-or-odd | 1 + Lang/FreeBASIC/Exceptions | 1 + ...Catch-an-exception-thrown-in-a-nested-call | 1 + Lang/FreeBASIC/Execute-a-system-command | 1 + Lang/FreeBASIC/Exponentiation-operator | 1 + Lang/FreeBASIC/Extend-your-language | 1 + Lang/FreeBASIC/Extensible-prime-generator | 1 + Lang/FreeBASIC/Extreme-floating-point-values | 1 + Lang/FreeBASIC/Factorial | 1 + Lang/FreeBASIC/Factors-of-a-Mersenne-number | 1 + Lang/FreeBASIC/Factors-of-an-integer | 1 + .../Fibonacci-n-step-number-sequences | 1 + Lang/FreeBASIC/Fibonacci-sequence | 1 + Lang/FreeBASIC/Fibonacci-word | 1 + Lang/FreeBASIC/Fibonacci-word-fractal | 1 + Lang/FreeBASIC/File-input-output | 1 + Lang/FreeBASIC/File-modification-time | 1 + Lang/FreeBASIC/File-size | 1 + Lang/FreeBASIC/Filter | 1 + .../Find-the-last-Sunday-of-each-month | 1 + Lang/FreeBASIC/Five-weekends | 1 + Lang/FreeBASIC/Floyds-triangle | 1 + Lang/FreeBASIC/Formatted-numeric-output | 1 + Lang/FreeBASIC/Fractran | 1 + Lang/FreeBASIC/Function-definition | 1 + Lang/FreeBASIC/Function-prototype | 1 + Lang/FreeBASIC/GUI-Maximum-window-dimensions | 1 + Lang/FreeBASIC/GUI-component-interaction | 1 + Lang/FreeBASIC/Gamma-function | 1 + .../Generate-lower-case-ASCII-alphabet | 1 + Lang/FreeBASIC/Generic-swap | 1 + Lang/FreeBASIC/Greatest-common-divisor | 1 + Lang/FreeBASIC/Greatest-element-of-a-list | 1 + Lang/FreeBASIC/Greatest-subsequential-sum | 1 + Lang/FreeBASIC/Guess-the-number | 1 + Lang/FreeBASIC/Guess-the-number-With-feedback | 1 + .../Guess-the-number-With-feedback--player- | 1 + Lang/FreeBASIC/Hamming-numbers | 1 + Lang/FreeBASIC/Happy-numbers | 1 + Lang/FreeBASIC/Harshad-or-Niven-series | 1 + Lang/FreeBASIC/Haversine-formula | 1 + Lang/FreeBASIC/Hello-world-Graphical | 1 + Lang/FreeBASIC/Hello-world-Line-printer | 1 + Lang/FreeBASIC/Hello-world-Newline-omission | 1 + Lang/FreeBASIC/Hello-world-Standard-error | 1 + Lang/FreeBASIC/Hello-world-Text | 1 + Lang/FreeBASIC/Heronian-triangles | 1 + .../Hickerson-series-of-almost-integers | 1 + Lang/FreeBASIC/Higher-order-functions | 1 + Lang/FreeBASIC/Host-introspection | 1 + Lang/FreeBASIC/Hostname | 1 + Lang/FreeBASIC/I-before-E-except-after-C | 1 + Lang/FreeBASIC/IBAN | 1 + Lang/FreeBASIC/Identity-matrix | 1 + Lang/FreeBASIC/Include-a-file | 1 + Lang/FreeBASIC/Increment-a-numerical-string | 1 + Lang/FreeBASIC/Infinity | 1 + Lang/FreeBASIC/Inheritance-Multiple | 1 + Lang/FreeBASIC/Inheritance-Single | 1 + Lang/FreeBASIC/Input-loop | 1 + Lang/FreeBASIC/Integer-comparison | 1 + Lang/FreeBASIC/Integer-overflow | 1 + Lang/FreeBASIC/Integer-sequence | 1 + Lang/FreeBASIC/Interactive-programming | 1 + Lang/FreeBASIC/Inverted-syntax | 1 + Lang/FreeBASIC/Iterated-digits-squaring | 1 + Lang/FreeBASIC/Jump-anywhere | 1 + Lang/FreeBASIC/Kaprekar-numbers | 1 + .../Keyboard-input-Flush-the-keyboard-buffer | 1 + Lang/FreeBASIC/Keyboard-input-Keypress-check | 1 + .../Keyboard-input-Obtain-a-Y-or-N-response | 1 + Lang/FreeBASIC/Knuth-shuffle | 1 + Lang/FreeBASIC/Langtons-ant | 1 + Lang/FreeBASIC/Last-Friday-of-each-month | 1 + Lang/FreeBASIC/Leap-year | 1 + Lang/FreeBASIC/Least-common-multiple | 1 + Lang/FreeBASIC/Letter-frequency | 1 + Lang/FreeBASIC/Levenshtein-distance | 1 + Lang/FreeBASIC/Linear-congruential-generator | 1 + Lang/FreeBASIC/Literals-Floating-point | 1 + Lang/FreeBASIC/Literals-Integer | 1 + Lang/FreeBASIC/Logical-operations | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/FreeBASIC/Loops-Break | 1 + Lang/FreeBASIC/Loops-Continue | 1 + Lang/FreeBASIC/Loops-Do-while | 1 + Lang/FreeBASIC/Loops-Downward-for | 1 + Lang/FreeBASIC/Loops-For | 1 + .../FreeBASIC/Loops-For-with-a-specified-step | 1 + Lang/FreeBASIC/Loops-Foreach | 1 + Lang/FreeBASIC/Loops-Infinite | 1 + Lang/FreeBASIC/Loops-N-plus-one-half | 1 + Lang/FreeBASIC/Loops-Nested | 1 + Lang/FreeBASIC/Loops-While | 1 + Lang/FreeBASIC/Lucas-Lehmer-test | 1 + Lang/FreeBASIC/Ludic-numbers | 1 + .../Luhn-test-of-credit-card-numbers | 1 + Lang/FreeBASIC/MD4 | 1 + Lang/FreeBASIC/MD5-Implementation | 1 + Lang/FreeBASIC/Magic-squares-of-odd-order | 1 + Lang/FreeBASIC/Maximum-triangle-path-sum | 1 + Lang/FreeBASIC/Maze-generation | 1 + .../Memory-layout-of-a-data-structure | 1 + Lang/FreeBASIC/Metaprogramming | 1 + Lang/FreeBASIC/Middle-three-digits | 1 + Lang/FreeBASIC/Monte-Carlo-methods | 1 + Lang/FreeBASIC/Morse-code | 1 + Lang/FreeBASIC/Multifactorial | 1 + Lang/FreeBASIC/Multiplication-tables | 1 + Lang/FreeBASIC/Multisplit | 1 + Lang/FreeBASIC/Munching-squares | 1 + Lang/FreeBASIC/Mutual-recursion | 1 + Lang/FreeBASIC/Narcissistic-decimal-number | 1 + Lang/FreeBASIC/Non-decimal-radices-Convert | 1 + Lang/FreeBASIC/Non-decimal-radices-Input | 1 + Lang/FreeBASIC/Non-decimal-radices-Output | 1 + Lang/FreeBASIC/Nth | 1 + Lang/FreeBASIC/Null-object | 1 + Lang/FreeBASIC/Numerical-integration | 1 + Lang/FreeBASIC/Ordered-words | 1 + Lang/FreeBASIC/Palindrome-detection | 1 + Lang/FreeBASIC/Pangram-checker | 1 + Lang/FreeBASIC/Pascals-triangle | 1 + Lang/FreeBASIC/Perfect-numbers | 1 + Lang/FreeBASIC/Pernicious-numbers | 1 + Lang/FreeBASIC/Phrase-reversals | 1 + Lang/FreeBASIC/Pick-random-element | 1 + Lang/FreeBASIC/Pointers-and-references | 1 + Lang/FreeBASIC/Polynomial-regression | 1 + Lang/FreeBASIC/Price-fraction | 1 + Lang/FreeBASIC/Primality-by-trial-division | 1 + Lang/FreeBASIC/Prime-decomposition | 1 + Lang/FreeBASIC/Probabilistic-choice | 1 + Lang/FreeBASIC/Program-name | 1 + Lang/FreeBASIC/Program-termination | 1 + Lang/FreeBASIC/Pythagorean-triples | 1 + Lang/FreeBASIC/README | 1 + Lang/FreeBASIC/RIPEMD-160 | 1 + .../Random-number-generator--device- | 1 + Lang/FreeBASIC/Random-numbers | 1 + Lang/FreeBASIC/Range-expansion | 1 + Lang/FreeBASIC/Range-extraction | 1 + Lang/FreeBASIC/Ray-casting-algorithm | 1 + Lang/FreeBASIC/Read-a-configuration-file | 1 + Lang/FreeBASIC/Read-a-file-line-by-line | 1 + .../Read-a-specific-line-from-a-file | 1 + Lang/FreeBASIC/Read-entire-file | 1 + Lang/FreeBASIC/Real-constants-and-functions | 1 + Lang/FreeBASIC/Remove-duplicate-elements | 1 + Lang/FreeBASIC/Remove-lines-from-a-file | 1 + Lang/FreeBASIC/Rename-a-file | 1 + Lang/FreeBASIC/Repeat-a-string | 1 + Lang/FreeBASIC/Return-multiple-values | 1 + Lang/FreeBASIC/Reverse-a-string | 1 + Lang/FreeBASIC/Reverse-words-in-a-string | 1 + Lang/FreeBASIC/Roman-numerals-Decode | 1 + Lang/FreeBASIC/Roman-numerals-Encode | 1 + Lang/FreeBASIC/Rot-13 | 1 + Lang/FreeBASIC/Runge-Kutta-method | 1 + Lang/FreeBASIC/SEDOLs | 1 + Lang/FreeBASIC/SHA-1 | 1 + Lang/FreeBASIC/SHA-256 | 1 + Lang/FreeBASIC/Self-describing-numbers | 1 + Lang/FreeBASIC/Semordnilap | 1 + Lang/FreeBASIC/Sequence-of-non-squares | 1 + .../Sequence-of-primes-by-Trial-Division | 1 + Lang/FreeBASIC/Shell-one-liner | 1 + Lang/FreeBASIC/Short-circuit-evaluation | 1 + Lang/FreeBASIC/Show-the-epoch | 1 + Lang/FreeBASIC/Sierpinski-triangle-Graphical | 1 + Lang/FreeBASIC/Sieve-of-Eratosthenes | 1 + Lang/FreeBASIC/Simple-windowed-application | 1 + Lang/FreeBASIC/Sleep | 1 + Lang/FreeBASIC/Sort-an-integer-array | 1 + Lang/FreeBASIC/Sort-using-a-custom-comparator | 1 + Lang/FreeBASIC/Sorting-algorithms-Bubble-sort | 1 + .../Sorting-algorithms-Cocktail-sort | 1 + Lang/FreeBASIC/Sorting-algorithms-Comb-sort | 1 + .../Sorting-algorithms-Counting-sort | 1 + Lang/FreeBASIC/Sorting-algorithms-Gnome-sort | 1 + Lang/FreeBASIC/Sorting-algorithms-Heapsort | 1 + .../Sorting-algorithms-Insertion-sort | 1 + Lang/FreeBASIC/Sorting-algorithms-Quicksort | 1 + .../Sorting-algorithms-Selection-sort | 1 + Lang/FreeBASIC/Sorting-algorithms-Shell-sort | 1 + Lang/FreeBASIC/Sorting-algorithms-Sleep-sort | 1 + Lang/FreeBASIC/Sorting-algorithms-Stooge-sort | 1 + Lang/FreeBASIC/Spiral-matrix | 1 + Lang/FreeBASIC/Start-from-a-main-routine | 1 + Lang/FreeBASIC/Statistics-Basic | 1 + Lang/FreeBASIC/Stem-and-leaf-plot | 1 + Lang/FreeBASIC/String-append | 1 + Lang/FreeBASIC/String-case | 1 + Lang/FreeBASIC/String-comparison | 1 + Lang/FreeBASIC/String-concatenation | 1 + .../FreeBASIC/String-interpolation--included- | 1 + Lang/FreeBASIC/String-length | 1 + Lang/FreeBASIC/String-matching | 1 + Lang/FreeBASIC/String-prepend | 1 + .../Strip-a-set-of-characters-from-a-string | 1 + Lang/FreeBASIC/Strip-comments-from-a-string | 1 + ...odes-and-extended-characters-from-a-string | 1 + ...trip-whitespace-from-a-string-Top-and-tail | 1 + Lang/FreeBASIC/Substring | 1 + Lang/FreeBASIC/Substring-Top-and-tail | 1 + Lang/FreeBASIC/Sum-and-product-of-an-array | 1 + Lang/FreeBASIC/Sum-digits-of-an-integer | 1 + Lang/FreeBASIC/Sum-multiples-of-3-and-5 | 1 + Lang/FreeBASIC/Sum-of-a-series | 1 + Lang/FreeBASIC/Sum-of-squares | 1 + Lang/FreeBASIC/System-time | 1 + Lang/FreeBASIC/Temperature-conversion | 1 + .../Terminal-control-Clear-the-screen | 1 + ...Terminal-control-Ringing-the-terminal-bell | 1 + Lang/FreeBASIC/The-ISAAC-Cipher | 1 + Lang/FreeBASIC/The-Twelve-Days-of-Christmas | 1 + Lang/FreeBASIC/Time-a-function | 1 + Lang/FreeBASIC/Topic-variable | 1 + Lang/FreeBASIC/Towers-of-Hanoi | 1 + Lang/FreeBASIC/Trabb-Pardo-Knuth-algorithm | 1 + Lang/FreeBASIC/Trigonometric-functions | 1 + Lang/FreeBASIC/Undefined-values | 1 + Lang/FreeBASIC/Unicode-variable-names | 1 + Lang/FreeBASIC/Update-a-configuration-file | 1 + Lang/FreeBASIC/User-input-Text | 1 + Lang/FreeBASIC/Vampire-number | 1 + Lang/FreeBASIC/Van-der-Corput-sequence | 1 + Lang/FreeBASIC/Variable-size-Get | 1 + Lang/FreeBASIC/Vector-products | 1 + Lang/FreeBASIC/Window-creation | 1 + .../Write-float-arrays-to-a-text-file | 1 + Lang/FreeBASIC/Xiaolin-Wus-line-algorithm | 1 + .../Zeckendorf-number-representation | 1 + Lang/FreeBASIC/Zero-to-the-zero-power | 1 + Lang/FreeBASIC/Zhang-Suen-thinning-algorithm | 1 + Lang/FreeBASIC/Zig-zag-matrix | 1 + Lang/FunL/00DESCRIPTION | 5 + Lang/FunL/100-doors | 1 + Lang/FunL/99-Bottles-of-Beer | 1 + Lang/FunL/A+B | 1 + Lang/FunL/Ackermann-function | 1 + Lang/FunL/Apply-a-callback-to-an-array | 1 + Lang/FunL/Array-concatenation | 1 + Lang/FunL/Averages-Pythagorean-means | 1 + Lang/FunL/Bernoulli-numbers | 1 + Lang/FunL/Binary-digits | 1 + Lang/FunL/CSV-data-manipulation | 1 + Lang/FunL/Catalan-numbers | 1 + Lang/FunL/Chinese-remainder-theorem | 1 + Lang/FunL/Command-line-arguments | 1 + Lang/FunL/Conways-Game-of-Life | 1 + Lang/FunL/Count-occurrences-of-a-substring | 1 + Lang/FunL/Create-a-file | 1 + Lang/FunL/Date-format | 1 + Lang/FunL/Date-manipulation | 1 + Lang/FunL/Dot-product | 1 + Lang/FunL/Draw-a-clock | 1 + Lang/FunL/Empty-program | 1 + Lang/FunL/Environment-variables | 1 + Lang/FunL/Evaluate-binomial-coefficients | 1 + Lang/FunL/Execute-a-system-command | 1 + Lang/FunL/Factorial | 1 + Lang/FunL/Factors-of-an-integer | 1 + Lang/FunL/Fibonacci-n-step-number-sequences | 1 + Lang/FunL/Fibonacci-sequence | 1 + Lang/FunL/Function-composition | 1 + Lang/FunL/Generator-Exponential | 1 + Lang/FunL/Greatest-common-divisor | 1 + Lang/FunL/Greatest-element-of-a-list | 1 + Lang/FunL/Hailstone-sequence | 1 + Lang/FunL/Hamming-numbers | 1 + Lang/FunL/Haversine-formula | 1 + Lang/FunL/Hello-world-Graphical | 1 + Lang/FunL/Hello-world-Text | 1 + Lang/FunL/Hello-world-Web-server | 1 + .../Horners-rule-for-polynomial-evaluation | 1 + Lang/FunL/Identity-matrix | 1 + Lang/FunL/Integer-comparison | 1 + Lang/FunL/Integer-sequence | 1 + Lang/FunL/JSON | 1 + Lang/FunL/Knuth-shuffle | 1 + Lang/FunL/Least-common-multiple | 1 + Lang/FunL/List-comprehensions | 1 + Lang/FunL/Logical-operations | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/FunL/Lucas-Lehmer-test | 1 + Lang/FunL/Luhn-test-of-credit-card-numbers | 1 + Lang/FunL/Matrix-arithmetic | 1 + Lang/FunL/Modular-inverse | 1 + Lang/FunL/Multifactorial | 1 + Lang/FunL/Narcissistic-decimal-number | 1 + Lang/FunL/Non-decimal-radices-Convert | 1 + Lang/FunL/Parsing-RPN-calculator-algorithm | 1 + Lang/FunL/Partial-function-application | 1 + Lang/FunL/Pascals-triangle | 1 + Lang/FunL/Perfect-numbers | 1 + Lang/FunL/Pi | 1 + Lang/FunL/Power-set | 1 + Lang/FunL/Primality-by-trial-division | 1 + Lang/FunL/Priority-queue | 1 + Lang/FunL/README | 1 + Lang/FunL/Return-multiple-values | 1 + Lang/FunL/Roots-of-unity | 1 + Lang/FunL/Rot-13 | 1 + Lang/FunL/SHA-256 | 1 + Lang/FunL/Set | 1 + Lang/FunL/Sort-an-integer-array | 1 + Lang/FunL/Sort-using-a-custom-comparator | 1 + Lang/FunL/Sorting-algorithms-Heapsort | 1 + Lang/FunL/Sorting-algorithms-Merge-sort | 1 + Lang/FunL/Sorting-algorithms-Quicksort | 1 + Lang/FunL/String-interpolation--included- | 1 + Lang/FunL/Table-creation-Postal-addresses | 1 + Lang/FunL/Terminal-control-Coloured-text | 1 + Lang/FunL/Terminal-control-Hiding-the-cursor | 1 + Lang/FunL/Terminal-control-Inverse-video | 1 + Lang/FunL/Terminal-control-Unicode-output | 1 + Lang/FunL/Top-rank-per-group | 1 + Lang/FunL/Topological-sort | 1 + Lang/FunL/Tree-traversal | 1 + Lang/FunL/Unix-ls | 1 + Lang/FunL/Vector-products | 1 + Lang/FunL/Web-scraping | 1 + Lang/Futhark/00DESCRIPTION | 12 + Lang/Futhark/100-doors | 1 + Lang/Futhark/Ackermann-function | 1 + Lang/Futhark/Almost-prime | 1 + Lang/Futhark/Amicable-pairs | 1 + Lang/Futhark/Arithmetic-Complex | 1 + Lang/Futhark/Arithmetic-geometric-mean | 1 + Lang/Futhark/Array-concatenation | 1 + Lang/Futhark/Arrays | 1 + Lang/Futhark/Averages-Pythagorean-means | 1 + Lang/Futhark/Averages-Root-mean-square | 1 + Lang/Futhark/Binary-digits | 1 + Lang/Futhark/Binary-search | 1 + Lang/Futhark/Comments | 1 + Lang/Futhark/Conditional-structures | 1 + Lang/Futhark/Conways-Game-of-Life | 1 + Lang/Futhark/Count-in-octal | 1 + Lang/Futhark/Empty-program | 1 + Lang/Futhark/Euler-method | 1 + Lang/Futhark/Even-or-odd | 1 + Lang/Futhark/Factorial | 1 + Lang/Futhark/Fibonacci-sequence | 1 + Lang/Futhark/Filter | 1 + Lang/Futhark/Function-definition | 1 + Lang/Futhark/Hailstone-sequence | 1 + Lang/Futhark/Integer-sequence | 1 + Lang/Futhark/Loops-For | 1 + Lang/Futhark/MD5 | 1 + Lang/Futhark/Mandelbrot-set | 1 + Lang/Futhark/Matrix-multiplication | 1 + Lang/Futhark/Monte-Carlo-methods | 1 + Lang/Futhark/README | 1 + Lang/FutureBasic/00DESCRIPTION | 69 ++ Lang/FutureBasic/100-doors | 1 + Lang/FutureBasic/99-Bottles-of-Beer | 1 + Lang/FutureBasic/Ackermann-function | 1 + Lang/FutureBasic/Address-of-a-variable | 1 + Lang/FutureBasic/Anagrams | 1 + Lang/FutureBasic/Arithmetic-Integer | 1 + Lang/FutureBasic/Bitwise-operations | 1 + Lang/FutureBasic/Calendar | 1 + Lang/FutureBasic/Copy-a-string | 1 + Lang/FutureBasic/Count-in-octal | 1 + Lang/FutureBasic/Count-the-coins | 1 + Lang/FutureBasic/Detect-division-by-zero | 1 + Lang/FutureBasic/Draw-a-sphere | 1 + Lang/FutureBasic/Empty-program | 1 + Lang/FutureBasic/Empty-string | 1 + Lang/FutureBasic/Enumerations | 1 + Lang/FutureBasic/Execute-a-system-command | 1 + Lang/FutureBasic/Factorial | 1 + Lang/FutureBasic/Factors-of-an-integer | 1 + Lang/FutureBasic/Fibonacci-sequence | 1 + Lang/FutureBasic/FizzBuzz | 1 + Lang/FutureBasic/Formatted-numeric-output | 1 + Lang/FutureBasic/Function-definition | 1 + Lang/FutureBasic/Generic-swap | 1 + Lang/FutureBasic/Haversine-formula | 1 + Lang/FutureBasic/Hello-world-Newbie | 1 + Lang/FutureBasic/Heronian-triangles | 1 + Lang/FutureBasic/Higher-order-functions | 1 + .../Hofstadter-Conway-$10,000-sequence | 1 + .../Horizontal-sundial-calculations | 1 + Lang/FutureBasic/Include-a-file | 1 + Lang/FutureBasic/Increment-a-numerical-string | 1 + Lang/FutureBasic/Input-loop | 1 + Lang/FutureBasic/Integer-comparison | 1 + Lang/FutureBasic/Jump-anywhere | 1 + .../Keyboard-input-Obtain-a-Y-or-N-response | 1 + Lang/FutureBasic/Knapsack-problem-0-1 | 1 + Lang/FutureBasic/Leap-year | 1 + Lang/FutureBasic/Levenshtein-distance | 1 + Lang/FutureBasic/Literals-Integer | 1 + Lang/FutureBasic/Logical-operations | 1 + Lang/FutureBasic/Loops-Break | 1 + Lang/FutureBasic/Loops-Do-while | 1 + Lang/FutureBasic/Loops-Downward-for | 1 + .../Loops-For-with-a-specified-step | 1 + Lang/FutureBasic/Loops-Infinite | 1 + Lang/FutureBasic/Loops-N-plus-one-half | 1 + Lang/FutureBasic/Loops-While | 1 + Lang/FutureBasic/Nth-root | 1 + Lang/FutureBasic/Pi | 1 + Lang/FutureBasic/Primality-by-trial-division | 1 + Lang/FutureBasic/README | 1 + Lang/FutureBasic/Random-numbers | 1 + .../Read-a-specific-line-from-a-file | 1 + Lang/FutureBasic/Read-entire-file | 1 + Lang/FutureBasic/Real-constants-and-functions | 1 + Lang/FutureBasic/Return-multiple-values | 1 + Lang/FutureBasic/Reverse-a-string | 1 + Lang/FutureBasic/Roman-numerals-Decode | 1 + Lang/FutureBasic/Roman-numerals-Encode | 1 + Lang/FutureBasic/Roots-of-unity | 1 + Lang/FutureBasic/Runge-Kutta-method | 1 + Lang/FutureBasic/Shell-one-liner | 1 + Lang/FutureBasic/Show-the-epoch | 1 + Lang/FutureBasic/Sieve-of-Eratosthenes | 1 + Lang/FutureBasic/Soundex | 1 + Lang/FutureBasic/String-case | 1 + Lang/FutureBasic/Sudoku | 1 + Lang/FutureBasic/Towers-of-Hanoi | 1 + Lang/FutureBasic/Zero-to-the-zero-power | 1 + Lang/GEORGE/00DESCRIPTION | 12 + Lang/GEORGE/Arithmetic-Integer | 1 + Lang/GEORGE/Averages-Arithmetic-mean | 1 + Lang/GEORGE/Averages-Root-mean-square | 1 + Lang/GEORGE/README | 1 + Lang/GEORGE/Sum-of-a-series | 1 + Lang/GEORGE/Sum-of-squares | 1 + Lang/GFA-Basic/00DESCRIPTION | 11 + Lang/GFA-Basic/100-doors | 1 + ...ficient-and-perfect-number-classifications | 1 + Lang/GFA-Basic/Amicable-pairs | 1 + Lang/GFA-Basic/Averages-Arithmetic-mean | 1 + Lang/GFA-Basic/Caesar-cipher | 1 + Lang/GFA-Basic/Fibonacci-sequence | 1 + Lang/GFA-Basic/FizzBuzz | 1 + Lang/GFA-Basic/Greatest-common-divisor | 1 + Lang/GFA-Basic/Hello-world-Text | 1 + Lang/GFA-Basic/Langtons-ant | 1 + .../One-dimensional-cellular-automata | 1 + Lang/GFA-Basic/README | 1 + Lang/GFA-Basic/Reverse-a-string | 1 + Lang/GFA-Basic/Sum-and-product-of-an-array | 1 + Lang/GFA-Basic/Tree-traversal | 1 + Lang/GLSL/00DESCRIPTION | 2 + Lang/GLSL/Mandelbrot-set | 1 + Lang/GLSL/Munching-squares | 1 + Lang/GLSL/README | 1 + Lang/Glagol/00DESCRIPTION | 6 + Lang/Glagol/Balanced-ternary | 1 + Lang/Glagol/README | 1 + Lang/Golo/00DESCRIPTION | 16 + Lang/Golo/README | 1 + Lang/Gri/00DESCRIPTION | 31 + Lang/Gri/Comments | 1 + Lang/Gri/Documentation | 1 + Lang/Gri/Dragon-curve | 1 + Lang/Gri/Environment-variables | 1 + Lang/Gri/Find-limit-of-recursion | 1 + Lang/Gri/Generic-swap | 1 + Lang/Gri/README | 1 + Lang/HPPPL/00DESCRIPTION | 20 + Lang/HPPPL/Bitwise-operations | 1 + Lang/HPPPL/Conditional-structures | 1 + Lang/HPPPL/Hello-world-Graphical | 1 + Lang/HPPPL/Hello-world-Text | 1 + Lang/HPPPL/README | 1 + Lang/Hack/00DESCRIPTION | 5 + Lang/Hack/Hello-world-Text | 1 + Lang/Hack/Loops-For | 1 + Lang/Hack/README | 1 + Lang/Harbour/00DESCRIPTION | 17 + Lang/Harbour/100-doors | 1 + Lang/Harbour/ABC-Problem | 1 + Lang/Harbour/Arithmetic-Integer | 1 + Lang/Harbour/Arrays | 1 + Lang/Harbour/Associative-array-Creation | 1 + Lang/Harbour/Associative-array-Iteration | 1 + Lang/Harbour/Catalan-numbers | 1 + Lang/Harbour/Command-line-arguments | 1 + Lang/Harbour/Conditional-structures | 1 + Lang/Harbour/Fibonacci-sequence | 1 + Lang/Harbour/Five-weekends | 1 + Lang/Harbour/Happy-numbers | 1 + Lang/Harbour/Hash-from-two-arrays | 1 + Lang/Harbour/Hello-world-Graphical | 1 + Lang/Harbour/Hello-world-Line-printer | 1 + Lang/Harbour/Hello-world-Newline-omission | 1 + Lang/Harbour/Hello-world-Text | 1 + Lang/Harbour/Hostname | 1 + Lang/Harbour/Include-a-file | 1 + Lang/Harbour/Integer-comparison | 1 + Lang/Harbour/JSON | 1 + Lang/Harbour/Leap-year | 1 + Lang/Harbour/Letter-frequency | 1 + Lang/Harbour/Literals-Integer | 1 + Lang/Harbour/Logical-operations | 1 + Lang/Harbour/Loops-Break | 1 + Lang/Harbour/Loops-Do-while | 1 + Lang/Harbour/Loops-Downward-for | 1 + Lang/Harbour/README | 1 + Lang/Harbour/Rename-a-file | 1 + Lang/Harbour/Repeat-a-string | 1 + Lang/Harbour/Return-multiple-values | 1 + Lang/Harbour/Reverse-a-string | 1 + Lang/Harbour/Runtime-evaluation | 1 + Lang/Harbour/String-comparison | 1 + Lang/HolyC/00DESCRIPTION | 5 + Lang/HolyC/README | 1 + Lang/Hoon/00DESCRIPTION | 3 + .../Arbitrary-precision-integers--included- | 1 + Lang/Hoon/FizzBuzz | 1 + Lang/Hoon/Greatest-element-of-a-list | 1 + Lang/Hoon/Hello-world-Text | 1 + Lang/Hoon/JSON | 1 + Lang/Hoon/Quine | 1 + Lang/Hoon/README | 1 + Lang/Hoon/System-time | 1 + Lang/Hy/00DESCRIPTION | 6 + Lang/Hy/100-doors | 1 + Lang/Hy/Averages-Arithmetic-mean | 1 + Lang/Hy/Bulls-and-cows | 1 + Lang/Hy/Constrained-random-points-on-a-circle | 1 + Lang/Hy/Fibonacci-sequence | 1 + Lang/Hy/FizzBuzz | 1 + Lang/Hy/Hello-world-Text | 1 + Lang/Hy/Leap-year | 1 + Lang/Hy/Multiple-regression | 1 + Lang/Hy/Polynomial-regression | 1 + Lang/Hy/README | 1 + Lang/Hy/Statistics-Basic | 1 + ...y-distribution-uniformity-Chi-squared-test | 1 + Lang/Hy/Verify-distribution-uniformity-Naive | 1 + Lang/I/00DESCRIPTION | 1 + Lang/I/100-doors | 1 + Lang/I/A+B | 1 + Lang/I/Arithmetic-Integer | 1 + Lang/I/Array-concatenation | 1 + Lang/I/Arrays | 1 + Lang/I/Boolean-values | 1 + Lang/I/Call-a-function | 1 + Lang/I/Character-codes | 1 + Lang/I/Check-that-file-exists | 1 + Lang/I/Conditional-structures | 1 + Lang/I/Copy-a-string | 1 + Lang/I/Create-a-file | 1 + Lang/I/Detect-division-by-zero | 1 + Lang/I/Determine-if-a-string-is-numeric | 1 + Lang/I/Empty-program | 1 + Lang/I/Empty-string | 1 + Lang/I/Environment-variables | 1 + Lang/I/Factorial | 1 + Lang/I/File-input-output | 1 + Lang/I/Find-limit-of-recursion | 1 + Lang/I/FizzBuzz | 1 + Lang/I/Hello-world-Graphical | 1 + Lang/I/Hello-world-Text | 1 + Lang/I/README | 1 + Lang/Idris/00DESCRIPTION | 1 + Lang/Idris/100-doors | 1 + Lang/Idris/99-Bottles-of-Beer | 1 + Lang/Idris/A+B | 1 + Lang/Idris/AKS-test-for-primes | 1 + Lang/Idris/Ackermann-function | 1 + Lang/Idris/Binary-digits | 1 + Lang/Idris/Boolean-values | 1 + Lang/Idris/Cholesky-decomposition | 1 + Lang/Idris/Dot-product | 1 + Lang/Idris/Fast-Fourier-transform | 1 + Lang/Idris/Fibonacci-sequence | 1 + Lang/Idris/FizzBuzz | 1 + Lang/Idris/Haversine-formula | 1 + Lang/Idris/LU-decomposition | 1 + Lang/Idris/Matrix-multiplication | 1 + Lang/Idris/Matrix-transposition | 1 + Lang/Idris/Mutual-recursion | 1 + Lang/Idris/README | 1 + Lang/Idris/Repeat-a-string | 1 + Lang/JOVIAL/00DESCRIPTION | 5 + Lang/JOVIAL/Factorial | 1 + Lang/JOVIAL/README | 1 + Lang/JOVIAL/Sieve-of-Eratosthenes | 1 + Lang/Jack/00DESCRIPTION | 6 + Lang/Jack/Hello-world-Newline-omission | 1 + Lang/Jack/Hello-world-Text | 1 + Lang/Jack/README | 1 + Lang/Kamailio-Script/00DESCRIPTION | 6 + Lang/Kamailio-Script/FizzBuzz | 1 + Lang/Kamailio-Script/README | 1 + Lang/Kitten/00DESCRIPTION | 11 + Lang/Kitten/Hello-world-Text | 1 + Lang/Kitten/README | 1 + Lang/Klong/00DESCRIPTION | 8 + Lang/Klong/99-Bottles-of-Beer | 1 + Lang/Klong/Factorial | 1 + Lang/Klong/FizzBuzz | 1 + Lang/Klong/Greatest-element-of-a-list | 1 + Lang/Klong/Middle-three-digits | 1 + Lang/Klong/README | 1 + Lang/L++/00DESCRIPTION | 7 + Lang/L++/A+B | 1 + Lang/L++/Balanced-brackets | 1 + Lang/L++/Even-or-odd | 1 + Lang/L++/Fibonacci-sequence | 1 + Lang/L++/README | 1 + Lang/L++/Reverse-a-string | 1 + Lang/LC2200-Assembly/00DESCRIPTION | 6 + Lang/LC2200-Assembly/README | 1 + Lang/LC3-Assembly/00DESCRIPTION | 8 + Lang/LC3-Assembly/Conditional-structures | 1 + Lang/LC3-Assembly/Copy-a-string | 1 + Lang/LC3-Assembly/Empty-program | 1 + Lang/LC3-Assembly/Even-or-odd | 1 + .../Generate-lower-case-ASCII-alphabet | 1 + Lang/LC3-Assembly/Hello-world-Text | 1 + Lang/LC3-Assembly/Loops-For | 1 + Lang/LC3-Assembly/README | 1 + Lang/LC3-Assembly/Reverse-a-string | 1 + Lang/LFE/00DESCRIPTION | 18 + Lang/LFE/Accumulator-factory | 1 + Lang/LFE/Ackermann-function | 1 + Lang/LFE/Arithmetic-Complex | 1 + Lang/LFE/Arithmetic-Integer | 1 + Lang/LFE/Arithmetic-geometric-mean | 1 + Lang/LFE/Array-concatenation | 1 + Lang/LFE/Arrays | 1 + Lang/LFE/Associative-array-Creation | 1 + Lang/LFE/Associative-array-Iteration | 1 + Lang/LFE/Averages-Arithmetic-mean | 1 + Lang/LFE/Binary-digits | 1 + Lang/LFE/Bitwise-operations | 1 + Lang/LFE/Boolean-values | 1 + Lang/LFE/Call-a-function | 1 + Lang/LFE/Call-an-object-method | 1 + Lang/LFE/Character-codes | 1 + Lang/LFE/Check-that-file-exists | 1 + Lang/LFE/Classes | 1 + Lang/LFE/Closures-Value-capture | 1 + Lang/LFE/Combinations-with-repetitions | 1 + Lang/LFE/Command-line-arguments | 1 + Lang/LFE/Compound-data-type | 1 + Lang/LFE/Concurrent-computing | 1 + Lang/LFE/Copy-a-string | 1 + Lang/LFE/Count-in-octal | 1 + Lang/LFE/Create-a-file | 1 + Lang/LFE/Currying | 1 + Lang/LFE/Distributed-programming | 1 + Lang/LFE/Dot-product | 1 + Lang/LFE/Echo-server | 1 + Lang/LFE/Empty-string | 1 + Lang/LFE/Events | 1 + Lang/LFE/Execute-a-system-command | 1 + Lang/LFE/Factorial | 1 + Lang/LFE/Factors-of-an-integer | 1 + Lang/LFE/Fibonacci-sequence | 1 + Lang/LFE/Flatten-a-list | 1 + Lang/LFE/Fork | 1 + Lang/LFE/Function-composition | 1 + Lang/LFE/Function-definition | 1 + Lang/LFE/Greatest-common-divisor | 1 + Lang/LFE/Greatest-element-of-a-list | 1 + Lang/LFE/Guess-the-number | 1 + Lang/LFE/Guess-the-number-With-feedback | 1 + Lang/LFE/HTTP | 1 + Lang/LFE/Hash-from-two-arrays | 1 + Lang/LFE/Hash-join | 1 + Lang/LFE/Hello-world-Newline-omission | 1 + Lang/LFE/Hello-world-Text | 1 + Lang/LFE/Hostname | 1 + Lang/LFE/Identity-matrix | 1 + Lang/LFE/JSON | 1 + Lang/LFE/Levenshtein-distance | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/LFE/Loops-Foreach | 1 + Lang/LFE/Matrix-multiplication | 1 + Lang/LFE/Matrix-transposition | 1 + Lang/LFE/Non-decimal-radices-Convert | 1 + Lang/LFE/Partial-function-application | 1 + Lang/LFE/Permutations | 1 + Lang/LFE/Prime-decomposition | 1 + Lang/LFE/README | 1 + Lang/LFE/Read-entire-file | 1 + Lang/LFE/Rename-a-file | 1 + Lang/LFE/Rep-string | 1 + Lang/LFE/Repeat-a-string | 1 + Lang/LFE/Reverse-a-string | 1 + Lang/LFE/Set | 1 + Lang/LFE/String-length | 1 + Lang/LFE/String-prepend | 1 + Lang/LFE/Substring | 1 + Lang/LFE/Sum-of-a-series | 1 + Lang/LFE/Sum-of-squares | 1 + Lang/LFE/System-time | 1 + Lang/LFE/Tokenize-a-string | 1 + Lang/LFE/Unicode-strings | 1 + Lang/LFE/Word-wrap | 1 + Lang/Lambda-Prolog/00DESCRIPTION | 29 + Lang/Lambda-Prolog/99-Bottles-of-Beer | 1 + Lang/Lambda-Prolog/README | 1 + Lang/Lasso/00DESCRIPTION | 8 + Lang/Lasso/100-doors | 1 + Lang/Lasso/24-game | 1 + Lang/Lasso/9-billion-names-of-God-the-integer | 1 + Lang/Lasso/99-Bottles-of-Beer | 1 + Lang/Lasso/A+B | 1 + Lang/Lasso/Abstract-type | 1 + Lang/Lasso/Ackermann-function | 1 + Lang/Lasso/Align-columns | 1 + Lang/Lasso/Anagrams | 1 + Lang/Lasso/Anagrams-Deranged-anagrams | 1 + Lang/Lasso/Apply-a-callback-to-an-array | 1 + .../Arbitrary-precision-integers--included- | 1 + Lang/Lasso/Arithmetic-Integer | 1 + Lang/Lasso/Array-concatenation | 1 + Lang/Lasso/Arrays | 1 + Lang/Lasso/Assertions | 1 + Lang/Lasso/Associative-array-Creation | 1 + Lang/Lasso/Associative-array-Iteration | 1 + Lang/Lasso/Atomic-updates | 1 + Lang/Lasso/Averages-Arithmetic-mean | 1 + Lang/Lasso/Averages-Median | 1 + Lang/Lasso/Averages-Mode | 1 + Lang/Lasso/Averages-Pythagorean-means | 1 + Lang/Lasso/Averages-Root-mean-square | 1 + Lang/Lasso/Averages-Simple-moving-average | 1 + Lang/Lasso/Balanced-brackets | 1 + Lang/Lasso/Boolean-values | 1 + Lang/Lasso/Box-the-compass | 1 + Lang/Lasso/Bulls-and-cows | 1 + Lang/Lasso/Case-sensitivity-of-identifiers | 1 + Lang/Lasso/Character-codes | 1 + Lang/Lasso/Check-that-file-exists | 1 + Lang/Lasso/Classes | 1 + Lang/Lasso/Comma-quibbling | 1 + Lang/Lasso/Command-line-arguments | 1 + Lang/Lasso/Comments | 1 + Lang/Lasso/Compound-data-type | 1 + Lang/Lasso/Copy-a-string | 1 + Lang/Lasso/Count-occurrences-of-a-substring | 1 + Lang/Lasso/Count-the-coins | 1 + Lang/Lasso/Create-a-file | 1 + Lang/Lasso/Create-an-HTML-table | 1 + Lang/Lasso/DNS-query | 1 + Lang/Lasso/Date-format | 1 + Lang/Lasso/Date-manipulation | 1 + Lang/Lasso/Day-of-the-week | 1 + Lang/Lasso/Deepcopy | 1 + Lang/Lasso/Define-a-primitive-data-type | 1 + Lang/Lasso/Delete-a-file | 1 + Lang/Lasso/Detect-division-by-zero | 1 + Lang/Lasso/Determine-if-a-string-is-numeric | 1 + .../Determine-if-only-one-instance-is-running | 1 + Lang/Lasso/Dutch-national-flag-problem | 1 + Lang/Lasso/Dynamic-variable-names | 1 + Lang/Lasso/Empty-directory | 1 + Lang/Lasso/Empty-program | 1 + Lang/Lasso/Empty-string | 1 + Lang/Lasso/Environment-variables | 1 + Lang/Lasso/Evaluate-binomial-coefficients | 1 + Lang/Lasso/Even-or-odd | 1 + Lang/Lasso/Exceptions | 1 + ...Catch-an-exception-thrown-in-a-nested-call | 1 + Lang/Lasso/Execute-a-system-command | 1 + Lang/Lasso/Extend-your-language | 1 + Lang/Lasso/Factorial | 1 + Lang/Lasso/Fibonacci-sequence | 1 + Lang/Lasso/File-modification-time | 1 + Lang/Lasso/File-size | 1 + Lang/Lasso/Filter | 1 + Lang/Lasso/Find-common-directory-path | 1 + Lang/Lasso/Find-the-last-Sunday-of-each-month | 1 + Lang/Lasso/First-class-functions | 1 + Lang/Lasso/Five-weekends | 1 + Lang/Lasso/FizzBuzz | 1 + Lang/Lasso/Flatten-a-list | 1 + Lang/Lasso/Floyds-triangle | 1 + Lang/Lasso/Fork | 1 + Lang/Lasso/Formatted-numeric-output | 1 + Lang/Lasso/Forward-difference | 1 + Lang/Lasso/Function-definition | 1 + Lang/Lasso/Generic-swap | 1 + .../Globally-replace-text-in-several-files | 1 + Lang/Lasso/Greatest-element-of-a-list | 1 + Lang/Lasso/Guess-the-number | 1 + Lang/Lasso/Guess-the-number-With-feedback | 1 + .../Guess-the-number-With-feedback--player- | 1 + Lang/Lasso/HTTP | 1 + Lang/Lasso/HTTPS | 1 + Lang/Lasso/HTTPS-Authenticated | 1 + Lang/Lasso/HTTPS-Client-authenticated | 1 + Lang/Lasso/Hailstone-sequence | 1 + Lang/Lasso/Happy-numbers | 1 + Lang/Lasso/Hash-from-two-arrays | 1 + Lang/Lasso/Hello-world-Graphical | 1 + Lang/Lasso/Hello-world-Line-printer | 1 + Lang/Lasso/Hello-world-Newline-omission | 1 + Lang/Lasso/Hello-world-Standard-error | 1 + Lang/Lasso/Hello-world-Text | 1 + Lang/Lasso/Hello-world-Web-server | 1 + Lang/Lasso/Hostname | 1 + Lang/Lasso/I-before-E-except-after-C | 1 + Lang/Lasso/Include-a-file | 1 + Lang/Lasso/Increment-a-numerical-string | 1 + Lang/Lasso/Infinity | 1 + Lang/Lasso/Inheritance-Multiple | 1 + Lang/Lasso/Inheritance-Single | 1 + Lang/Lasso/Input-loop | 1 + Lang/Lasso/Integer-comparison | 1 + Lang/Lasso/Integer-sequence | 1 + Lang/Lasso/Interactive-programming | 1 + Lang/Lasso/Introspection | 1 + Lang/Lasso/JSON | 1 + Lang/Lasso/Knuth-shuffle | 1 + Lang/Lasso/Last-Friday-of-each-month | 1 + Lang/Lasso/Leap-year | 1 + Lang/Lasso/Least-common-multiple | 1 + Lang/Lasso/Letter-frequency | 1 + Lang/Lasso/List-comprehensions | 1 + Lang/Lasso/Literals-Floating-point | 1 + Lang/Lasso/Literals-Integer | 1 + Lang/Lasso/Literals-String | 1 + Lang/Lasso/Logical-operations | 1 + Lang/Lasso/Look-and-say-sequence | 1 + Lang/Lasso/Loops-Break | 1 + Lang/Lasso/Loops-Continue | 1 + Lang/Lasso/Loops-Do-while | 1 + Lang/Lasso/Loops-Downward-for | 1 + Lang/Lasso/Loops-For | 1 + Lang/Lasso/Loops-For-with-a-specified-step | 1 + Lang/Lasso/Loops-Foreach | 1 + Lang/Lasso/Loops-Infinite | 1 + Lang/Lasso/Loops-N-plus-one-half | 1 + Lang/Lasso/Loops-Nested | 1 + Lang/Lasso/Loops-While | 1 + Lang/Lasso/Luhn-test-of-credit-card-numbers | 1 + Lang/Lasso/MD4 | 1 + Lang/Lasso/MD5 | 1 + Lang/Lasso/Mandelbrot-set | 1 + Lang/Lasso/Map-range | 1 + Lang/Lasso/Middle-three-digits | 1 + Lang/Lasso/Multiplication-tables | 1 + Lang/Lasso/Named-parameters | 1 + Lang/Lasso/Null-object | 1 + Lang/Lasso/Odd-word-problem | 1 + Lang/Lasso/Optional-parameters | 1 + Lang/Lasso/Order-two-numerical-lists | 1 + Lang/Lasso/Ordered-words | 1 + Lang/Lasso/Palindrome-detection | 1 + Lang/Lasso/Perfect-numbers | 1 + Lang/Lasso/Pi | 1 + Lang/Lasso/Pick-random-element | 1 + Lang/Lasso/Priority-queue | 1 + Lang/Lasso/Problem-of-Apollonius | 1 + Lang/Lasso/Program-name | 1 + Lang/Lasso/Program-termination | 1 + Lang/Lasso/Pythagorean-triples | 1 + Lang/Lasso/Queue-Definition | 1 + Lang/Lasso/Queue-Usage | 1 + Lang/Lasso/Quine | 1 + Lang/Lasso/README | 1 + Lang/Lasso/RIPEMD-160 | 1 + Lang/Lasso/Random-number-generator--device- | 1 + Lang/Lasso/Range-expansion | 1 + Lang/Lasso/Read-a-configuration-file | 1 + Lang/Lasso/Read-a-file-line-by-line | 1 + Lang/Lasso/Read-a-specific-line-from-a-file | 1 + Lang/Lasso/Read-entire-file | 1 + Lang/Lasso/Real-constants-and-functions | 1 + Lang/Lasso/Regular-expressions | 1 + Lang/Lasso/Remove-duplicate-elements | 1 + Lang/Lasso/Remove-lines-from-a-file | 1 + Lang/Lasso/Rename-a-file | 1 + Lang/Lasso/Repeat-a-string | 1 + Lang/Lasso/Respond-to-an-unknown-method-call | 1 + Lang/Lasso/Return-multiple-values | 1 + Lang/Lasso/Reverse-a-string | 1 + Lang/Lasso/Rock-paper-scissors | 1 + Lang/Lasso/Roman-numerals-Decode | 1 + Lang/Lasso/Roman-numerals-Encode | 1 + Lang/Lasso/Rot-13 | 1 + Lang/Lasso/Run-length-encoding | 1 + Lang/Lasso/Runtime-evaluation | 1 + Lang/Lasso/SHA-1 | 1 + Lang/Lasso/SHA-256 | 1 + Lang/Lasso/Search-a-list | 1 + Lang/Lasso/Semordnilap | 1 + Lang/Lasso/Send-an-unknown-method-call | 1 + Lang/Lasso/Send-email | 1 + Lang/Lasso/Set | 1 + Lang/Lasso/Shell-one-liner | 1 + Lang/Lasso/Show-the-epoch | 1 + Lang/Lasso/Singleton | 1 + Lang/Lasso/Sleep | 1 + Lang/Lasso/Sockets | 1 + Lang/Lasso/Sort-an-integer-array | 1 + Lang/Lasso/Sort-stability | 1 + Lang/Lasso/Special-characters | 1 + Lang/Lasso/Special-variables | 1 + Lang/Lasso/Stack | 1 + Lang/Lasso/Stack-traces | 1 + Lang/Lasso/Statistics-Basic | 1 + Lang/Lasso/String-append | 1 + Lang/Lasso/String-case | 1 + Lang/Lasso/String-comparison | 1 + Lang/Lasso/String-concatenation | 1 + Lang/Lasso/String-interpolation--included- | 1 + Lang/Lasso/String-length | 1 + Lang/Lasso/String-matching | 1 + Lang/Lasso/String-prepend | 1 + .../Strip-a-set-of-characters-from-a-string | 1 + ...trip-whitespace-from-a-string-Top-and-tail | 1 + Lang/Lasso/Substring | 1 + Lang/Lasso/Substring-Top-and-tail | 1 + Lang/Lasso/Sum-and-product-of-an-array | 1 + Lang/Lasso/Sum-digits-of-an-integer | 1 + Lang/Lasso/Sum-multiples-of-3-and-5 | 1 + Lang/Lasso/Sum-of-a-series | 1 + Lang/Lasso/Sum-of-squares | 1 + Lang/Lasso/Symmetric-difference | 1 + Lang/Lasso/System-time | 1 + Lang/Lasso/Table-creation-Postal-addresses | 1 + Lang/Lasso/Take-notes-on-the-command-line | 1 + Lang/Lasso/Temperature-conversion | 1 + Lang/Lasso/Terminal-control-Clear-the-screen | 1 + Lang/Lasso/Terminal-control-Coloured-text | 1 + Lang/Lasso/Terminal-control-Cursor-movement | 1 + .../Lasso/Terminal-control-Cursor-positioning | 1 + ...inal-control-Display-an-extended-character | 1 + Lang/Lasso/Terminal-control-Hiding-the-cursor | 1 + Lang/Lasso/Terminal-control-Inverse-video | 1 + ...Terminal-control-Ringing-the-terminal-bell | 1 + Lang/Lasso/Terminal-control-Unicode-output | 1 + Lang/Lasso/Test-a-function | 1 + Lang/Lasso/Tic-tac-toe | 1 + Lang/Lasso/Time-a-function | 1 + Lang/Lasso/Towers-of-Hanoi | 1 + Lang/Lasso/Truncate-a-file | 1 + Lang/Lasso/URL-decoding | 1 + Lang/Lasso/URL-encoding | 1 + Lang/Lasso/Unicode-strings | 1 + Lang/Lasso/Update-a-configuration-file | 1 + Lang/Lasso/User-input-Text | 1 + Lang/Lasso/Variable-size-Get | 1 + Lang/Lasso/Variables | 1 + Lang/Lasso/Variadic-function | 1 + Lang/Lasso/Walk-a-directory-Non-recursively | 1 + Lang/Lasso/Walk-a-directory-Recursively | 1 + Lang/Lasso/Web-scraping | 1 + Lang/Lasso/Word-wrap | 1 + Lang/Lasso/Write-language-name-in-3D-ASCII | 1 + Lang/Lasso/XML-DOM-serialization | 1 + Lang/Lasso/XML-Input | 1 + Lang/Lasso/XML-Output | 1 + Lang/Lasso/XML-XPath | 1 + Lang/Lasso/Zig-zag-matrix | 1 + Lang/Leon/00DESCRIPTION | 17 + Lang/Leon/README | 1 + Lang/LibreOffice-Basic/00DESCRIPTION | 6 + Lang/LibreOffice-Basic/Mutual-recursion | 1 + Lang/LibreOffice-Basic/README | 1 + Lang/Lily/00DESCRIPTION | 4 + Lang/Lily/100-doors | 1 + Lang/Lily/Comments | 1 + Lang/Lily/Function-definition | 1 + Lang/Lily/Hello-world-Text | 1 + Lang/Lily/Higher-order-functions | 1 + Lang/Lily/Loops-Infinite | 1 + Lang/Lily/Null-object | 1 + Lang/Lily/README | 1 + Lang/Lily/Return-multiple-values | 1 + Lang/Lily/Unicode-variable-names | 1 + Lang/Lingo/00DESCRIPTION | 3 + Lang/Lingo/Abstract-type | 1 + Lang/Lingo/Anonymous-recursion | 1 + Lang/Lingo/Arithmetic-Rational | 1 + Lang/Lingo/Array-concatenation | 1 + Lang/Lingo/Arrays | 1 + Lang/Lingo/Assertions | 1 + Lang/Lingo/Associative-array-Creation | 1 + Lang/Lingo/Associative-array-Iteration | 1 + Lang/Lingo/Bitmap | 1 + Lang/Lingo/Bitmap-Flood-fill | 1 + Lang/Lingo/Bitwise-IO | 1 + Lang/Lingo/Bitwise-operations | 1 + Lang/Lingo/Boolean-values | 1 + Lang/Lingo/CRC-32 | 1 + Lang/Lingo/CSV-data-manipulation | 1 + Lang/Lingo/Calendar | 1 + Lang/Lingo/Call-a-function | 1 + .../Lingo/Call-a-function-in-a-shared-library | 1 + Lang/Lingo/Call-an-object-method | 1 + Lang/Lingo/Character-codes | 1 + Lang/Lingo/Classes | 1 + Lang/Lingo/Closures-Value-capture | 1 + Lang/Lingo/Collections | 1 + Lang/Lingo/Color-of-a-screen-pixel | 1 + Lang/Lingo/Command-line-arguments | 1 + Lang/Lingo/Comments | 1 + Lang/Lingo/Compile-time-calculation | 1 + Lang/Lingo/Compound-data-type | 1 + Lang/Lingo/Copy-a-string | 1 + Lang/Lingo/Create-a-file | 1 + Lang/Lingo/Create-an-HTML-table | 1 + Lang/Lingo/Date-manipulation | 1 + Lang/Lingo/Day-of-the-week | 1 + Lang/Lingo/Deepcopy | 1 + Lang/Lingo/Delete-a-file | 1 + Lang/Lingo/Detect-division-by-zero | 1 + Lang/Lingo/Draw-a-sphere | 1 + Lang/Lingo/Dynamic-variable-names | 1 + Lang/Lingo/Empty-directory | 1 + Lang/Lingo/Empty-program | 1 + Lang/Lingo/Empty-string | 1 + Lang/Lingo/Enumerations | 1 + Lang/Lingo/Environment-variables | 1 + Lang/Lingo/Even-or-odd | 1 + Lang/Lingo/Events | 1 + Lang/Lingo/Exceptions | 1 + Lang/Lingo/Execute-a-system-command | 1 + Lang/Lingo/Exponentiation-operator | 1 + Lang/Lingo/Factorial | 1 + Lang/Lingo/Factors-of-an-integer | 1 + Lang/Lingo/Fibonacci-sequence | 1 + Lang/Lingo/File-input-output | 1 + Lang/Lingo/File-size | 1 + Lang/Lingo/Find-common-directory-path | 1 + Lang/Lingo/First-class-functions | 1 + Lang/Lingo/Fractal-tree | 1 + Lang/Lingo/Function-composition | 1 + Lang/Lingo/Function-definition | 1 + Lang/Lingo/GUI-Maximum-window-dimensions | 1 + Lang/Lingo/Generate-lower-case-ASCII-alphabet | 1 + Lang/Lingo/Generic-swap | 1 + Lang/Lingo/Grayscale-image | 1 + Lang/Lingo/Greatest-element-of-a-list | 1 + Lang/Lingo/HTTP | 1 + Lang/Lingo/HTTPS | 1 + Lang/Lingo/Hailstone-sequence | 1 + Lang/Lingo/Hash-from-two-arrays | 1 + Lang/Lingo/Hello-world-Graphical | 1 + Lang/Lingo/Hello-world-Standard-error | 1 + Lang/Lingo/Hello-world-Text | 1 + Lang/Lingo/Here-document | 1 + Lang/Lingo/Higher-order-functions | 1 + Lang/Lingo/Hostname | 1 + Lang/Lingo/Include-a-file | 1 + Lang/Lingo/Increment-a-numerical-string | 1 + Lang/Lingo/Infinity | 1 + Lang/Lingo/Inheritance-Multiple | 1 + Lang/Lingo/Inheritance-Single | 1 + Lang/Lingo/Integer-comparison | 1 + Lang/Lingo/Integer-overflow | 1 + Lang/Lingo/Integer-sequence | 1 + Lang/Lingo/Interactive-programming | 1 + Lang/Lingo/Introspection | 1 + Lang/Lingo/JSON | 1 + Lang/Lingo/Jump-anywhere | 1 + Lang/Lingo/Keyboard-input-Keypress-check | 1 + Lang/Lingo/Leap-year | 1 + Lang/Lingo/Literals-Floating-point | 1 + Lang/Lingo/Literals-String | 1 + Lang/Lingo/Loops-Break | 1 + Lang/Lingo/Loops-Continue | 1 + Lang/Lingo/Loops-Do-while | 1 + Lang/Lingo/Loops-Downward-for | 1 + Lang/Lingo/Loops-For | 1 + Lang/Lingo/Loops-For-with-a-specified-step | 1 + Lang/Lingo/Loops-Foreach | 1 + Lang/Lingo/Loops-Infinite | 1 + Lang/Lingo/Loops-Nested | 1 + Lang/Lingo/Loops-While | 1 + Lang/Lingo/MD5 | 1 + Lang/Lingo/Memory-allocation | 1 + Lang/Lingo/Metaprogramming | 1 + Lang/Lingo/Mouse-position | 1 + Lang/Lingo/Named-parameters | 1 + Lang/Lingo/Nth-root | 1 + Lang/Lingo/Null-object | 1 + Lang/Lingo/Ordered-words | 1 + Lang/Lingo/Perfect-numbers | 1 + Lang/Lingo/Prime-decomposition | 1 + Lang/Lingo/Program-name | 1 + Lang/Lingo/README | 1 + Lang/Lingo/Range-expansion | 1 + Lang/Lingo/Read-a-file-line-by-line | 1 + Lang/Lingo/Read-entire-file | 1 + Lang/Lingo/Real-constants-and-functions | 1 + Lang/Lingo/Repeat-a-string | 1 + Lang/Lingo/Reverse-a-string | 1 + Lang/Lingo/Search-a-list | 1 + Lang/Lingo/Send-an-unknown-method-call | 1 + Lang/Lingo/Send-email | 1 + Lang/Lingo/Simple-windowed-application | 1 + Lang/Lingo/Singleton | 1 + Lang/Lingo/Sleep | 1 + Lang/Lingo/Sort-an-integer-array | 1 + Lang/Lingo/Special-characters | 1 + Lang/Lingo/Stack | 1 + Lang/Lingo/String-append | 1 + Lang/Lingo/String-case | 1 + Lang/Lingo/String-comparison | 1 + Lang/Lingo/String-concatenation | 1 + Lang/Lingo/String-length | 1 + Lang/Lingo/String-matching | 1 + Lang/Lingo/String-prepend | 1 + Lang/Lingo/Substring | 1 + Lang/Lingo/Sum-and-product-of-an-array | 1 + Lang/Lingo/Sum-digits-of-an-integer | 1 + Lang/Lingo/Sum-multiples-of-3-and-5 | 1 + Lang/Lingo/Sum-of-a-series | 1 + Lang/Lingo/System-time | 1 + Lang/Lingo/Time-a-function | 1 + Lang/Lingo/Tokenize-a-string | 1 + Lang/Lingo/Towers-of-Hanoi | 1 + Lang/Lingo/Tree-traversal | 1 + Lang/Lingo/Truncate-a-file | 1 + Lang/Lingo/URL-encoding | 1 + Lang/Lingo/Undefined-values | 1 + Lang/Lingo/Unicode-strings | 1 + Lang/Lingo/Unicode-variable-names | 1 + Lang/Lingo/Variables | 1 + Lang/Lingo/Vector-products | 1 + Lang/Lingo/Visualize-a-tree | 1 + Lang/Lingo/Walk-a-directory-Non-recursively | 1 + Lang/Lingo/Window-creation | 1 + Lang/Lingo/Word-wrap | 1 + Lang/Lingo/Write-float-arrays-to-a-text-file | 1 + Lang/Lingo/XML-DOM-serialization | 1 + Lang/Lingo/XML-Input | 1 + Lang/LiveCode/00DESCRIPTION | 23 + Lang/LiveCode/100-doors | 1 + Lang/LiveCode/24-game | 1 + Lang/LiveCode/99-Bottles-of-Beer | 1 + Lang/LiveCode/A+B | 1 + Lang/LiveCode/Ackermann-function | 1 + Lang/LiveCode/Anagrams | 1 + Lang/LiveCode/Arithmetic-Integer | 1 + Lang/LiveCode/Arithmetic-geometric-mean | 1 + Lang/LiveCode/Associative-array-Creation | 1 + Lang/LiveCode/Associative-array-Iteration | 1 + Lang/LiveCode/Averages-Arithmetic-mean | 1 + Lang/LiveCode/Averages-Median | 1 + Lang/LiveCode/Bitwise-operations | 1 + Lang/LiveCode/Caesar-cipher | 1 + Lang/LiveCode/Character-codes | 1 + Lang/LiveCode/Check-that-file-exists | 1 + Lang/LiveCode/Comments | 1 + Lang/LiveCode/Copy-a-string | 1 + Lang/LiveCode/Day-of-the-week | 1 + Lang/LiveCode/Even-or-odd | 1 + Lang/LiveCode/Factorial | 1 + Lang/LiveCode/Fibonacci-sequence | 1 + Lang/LiveCode/File-size | 1 + .../Find-the-last-Sunday-of-each-month | 1 + Lang/LiveCode/FizzBuzz | 1 + Lang/LiveCode/Function-definition | 1 + Lang/LiveCode/Function-frequency | 1 + .../GUI-enabling-disabling-of-controls | 1 + Lang/LiveCode/Generic-swap | 1 + Lang/LiveCode/Greatest-common-divisor | 1 + Lang/LiveCode/Greatest-element-of-a-list | 1 + Lang/LiveCode/Guess-the-number | 1 + Lang/LiveCode/Guess-the-number-With-feedback | 1 + Lang/LiveCode/HTTP | 1 + Lang/LiveCode/HTTPS | 1 + Lang/LiveCode/HTTPS-Authenticated | 1 + Lang/LiveCode/Hash-from-two-arrays | 1 + Lang/LiveCode/Haversine-formula | 1 + Lang/LiveCode/Hello-world-Graphical | 1 + Lang/LiveCode/Hello-world-Text | 1 + Lang/LiveCode/Horizontal-sundial-calculations | 1 + Lang/LiveCode/Hostname | 1 + Lang/LiveCode/Increment-a-numerical-string | 1 + Lang/LiveCode/Integer-comparison | 1 + Lang/LiveCode/Keyboard-input-Keypress-check | 1 + .../Keyboard-input-Obtain-a-Y-or-N-response | 1 + Lang/LiveCode/Last-Friday-of-each-month | 1 + Lang/LiveCode/Leap-year | 1 + Lang/LiveCode/Literals-Integer | 1 + Lang/LiveCode/Literals-String | 1 + Lang/LiveCode/Logical-operations | 1 + Lang/LiveCode/Look-and-say-sequence | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/LiveCode/Loops-Break | 1 + Lang/LiveCode/Loops-Continue | 1 + Lang/LiveCode/Loops-Do-while | 1 + Lang/LiveCode/Loops-Downward-for | 1 + Lang/LiveCode/Loops-For | 1 + Lang/LiveCode/Loops-For-with-a-specified-step | 1 + Lang/LiveCode/Loops-Foreach | 1 + Lang/LiveCode/Loops-Infinite | 1 + Lang/LiveCode/Loops-N-plus-one-half | 1 + Lang/LiveCode/Loops-Nested | 1 + Lang/LiveCode/Loops-While | 1 + .../LiveCode/Luhn-test-of-credit-card-numbers | 1 + Lang/LiveCode/MD5 | 1 + Lang/LiveCode/Palindrome-detection | 1 + Lang/LiveCode/Pick-random-element | 1 + Lang/LiveCode/README | 1 + Lang/LiveCode/Range-expansion | 1 + Lang/LiveCode/Range-extraction | 1 + Lang/LiveCode/Read-a-file-line-by-line | 1 + Lang/LiveCode/Read-entire-file | 1 + Lang/LiveCode/Real-constants-and-functions | 1 + Lang/LiveCode/Record-sound | 1 + Lang/LiveCode/Rename-a-file | 1 + Lang/LiveCode/Repeat-a-string | 1 + Lang/LiveCode/Reverse-a-string | 1 + Lang/LiveCode/Reverse-words-in-a-string | 1 + Lang/LiveCode/Roman-numerals-Encode | 1 + Lang/LiveCode/Rot-13 | 1 + Lang/LiveCode/Run-length-encoding | 1 + Lang/LiveCode/SHA-1 | 1 + Lang/LiveCode/Self-describing-numbers | 1 + Lang/LiveCode/Send-email | 1 + Lang/LiveCode/Short-circuit-evaluation | 1 + Lang/LiveCode/Show-the-epoch | 1 + Lang/LiveCode/Sieve-of-Eratosthenes | 1 + Lang/LiveCode/Sort-an-integer-array | 1 + Lang/LiveCode/Sparkline-in-unicode | 1 + Lang/LiveCode/Special-variables | 1 + Lang/LiveCode/State-name-puzzle | 1 + Lang/LiveCode/String-append | 1 + Lang/LiveCode/String-case | 1 + Lang/LiveCode/String-concatenation | 1 + Lang/LiveCode/String-interpolation--included- | 1 + Lang/LiveCode/String-prepend | 1 + .../Strip-a-set-of-characters-from-a-string | 1 + Lang/LiveCode/Substring | 1 + Lang/LiveCode/Substring-Top-and-tail | 1 + Lang/LiveCode/Sum-and-product-of-an-array | 1 + Lang/LiveCode/Sum-digits-of-an-integer | 1 + Lang/LiveCode/Sum-multiples-of-3-and-5 | 1 + Lang/LiveCode/Sum-of-a-series | 1 + Lang/LiveCode/Sum-of-squares | 1 + Lang/LiveCode/System-time | 1 + Lang/LiveCode/Temperature-conversion | 1 + Lang/LiveCode/URL-decoding | 1 + Lang/LiveCode/URL-encoding | 1 + Lang/LiveCode/Unicode-variable-names | 1 + Lang/LiveCode/Unix-ls | 1 + Lang/LiveCode/Variable-length-quantity | 1 + .../LiveCode/Walk-a-directory-Non-recursively | 1 + Lang/LiveCode/Walk-a-directory-Recursively | 1 + Lang/LiveCode/XML-Input | 1 + Lang/LiveCode/XML-XPath | 1 + Lang/LiveScript/00DESCRIPTION | 3 + Lang/LiveScript/FizzBuzz | 1 + Lang/LiveScript/README | 1 + Lang/LiveScript/Reverse-words-in-a-string | 1 + Lang/LiveScript/Roman-numerals-Decode | 1 + Lang/Lobster/00DESCRIPTION | 5 + Lang/Lobster/FizzBuzz | 1 + Lang/Lobster/Hello-world-Graphical | 1 + Lang/Lobster/Hello-world-Text | 1 + Lang/Lobster/README | 1 + Lang/Lobster/Sorting-algorithms-Quicksort | 1 + Lang/Loglan82/00DESCRIPTION | 22 + Lang/Loglan82/README | 1 + Lang/Luck/00DESCRIPTION | 13 + Lang/Luck/Ackermann-function | 1 + Lang/Luck/Call-a-foreign-language-function | 1 + Lang/Luck/Call-a-function | 1 + Lang/Luck/Fibonacci-sequence | 1 + Lang/Luck/FizzBuzz | 1 + Lang/Luck/Function-prototype | 1 + Lang/Luck/Greatest-common-divisor | 1 + Lang/Luck/Higher-order-functions | 1 + Lang/Luck/README | 1 + Lang/MINIL/00DESCRIPTION | 3 + Lang/MINIL/Evaluate-binomial-coefficients | 1 + Lang/MINIL/Greatest-common-divisor | 1 + Lang/MINIL/README | 1 + Lang/MLite/00DESCRIPTION | 15 + Lang/MLite/Harshad-or-Niven-series | 1 + Lang/MLite/README | 1 + Lang/MSX-BASIC/00DESCRIPTION | 0 Lang/MSX-BASIC/README | 1 + Lang/Malbolge/00DESCRIPTION | 5 + Lang/Malbolge/99-Bottles-of-Beer | 1 + Lang/Malbolge/Hello-world-Text | 1 + Lang/Malbolge/README | 1 + Lang/Maude/00DESCRIPTION | 3 + Lang/Maude/A+B | 1 + Lang/Maude/Factorial | 1 + Lang/Maude/Hello-world-Text | 1 + Lang/Maude/README | 1 + Lang/Mond/00DESCRIPTION | 1 + Lang/Mond/README | 1 + Lang/Mond/Sorting-algorithms-Quicksort | 1 + Lang/Monicelli/00DESCRIPTION | 6 + Lang/Monicelli/Conditional-structures | 1 + Lang/Monicelli/Fibonacci-sequence | 1 + Lang/Monicelli/Loops-Do-while | 1 + Lang/Monicelli/README | 1 + Lang/Monte/00DESCRIPTION | 5 + Lang/Monte/Arrays | 1 + Lang/Monte/Boolean-values | 1 + Lang/Monte/Comments | 1 + Lang/Monte/FizzBuzz | 1 + Lang/Monte/Hello-world-Newbie | 1 + Lang/Monte/Loops-Infinite | 1 + Lang/Monte/Loops-While | 1 + Lang/Monte/README | 1 + Lang/Monte/Repeat-a-string | 1 + Lang/Monte/Towers-of-Hanoi | 1 + Lang/MoonScript/00DESCRIPTION | 12 + Lang/MoonScript/100-doors | 1 + Lang/MoonScript/99-Bottles-of-Beer | 1 + Lang/MoonScript/A+B | 1 + Lang/MoonScript/FizzBuzz | 1 + Lang/MoonScript/README | 1 + .../Read-a-specific-line-from-a-file | 1 + Lang/Morfa/00DESCRIPTION | 25 + ...-a-variable-to-a-class-instance-at-runtime | 1 + Lang/Morfa/Averages-Root-mean-square | 1 + Lang/Morfa/Conditional-structures | 1 + Lang/Morfa/Constrained-genericity | 1 + Lang/Morfa/Extend-your-language | 1 + Lang/Morfa/Hello-world-Text | 1 + Lang/Morfa/Higher-order-functions | 1 + Lang/Morfa/Loops-For | 1 + Lang/Morfa/Loops-While | 1 + Lang/Morfa/README | 1 + Lang/MyrtleScript/00DESCRIPTION | 14 + Lang/MyrtleScript/Factorial | 1 + Lang/MyrtleScript/Hello-world-Text | 1 + Lang/MyrtleScript/README | 1 + Lang/NESL/00DESCRIPTION | 4 + Lang/NESL/Case-sensitivity-of-identifiers | 1 + Lang/NESL/Character-codes | 1 + Lang/NESL/Comments | 1 + Lang/NESL/Empty-string | 1 + Lang/NESL/Even-or-odd | 1 + Lang/NESL/Fibonacci-sequence | 1 + Lang/NESL/Function-definition | 1 + Lang/NESL/Generate-lower-case-ASCII-alphabet | 1 + Lang/NESL/README | 1 + Lang/NGS/00DESCRIPTION | 11 + Lang/NGS/Accumulator-factory | 1 + Lang/NGS/Apply-a-callback-to-an-array | 1 + Lang/NGS/Delegates | 1 + Lang/NGS/Fibonacci-sequence | 1 + Lang/NGS/Flatten-a-list | 1 + Lang/NGS/Multiple-distinct-objects | 1 + Lang/NGS/README | 1 + Lang/NGS/Rep-string | 1 + Lang/NewtonScript/00DESCRIPTION | 15 + Lang/NewtonScript/FizzBuzz | 1 + Lang/NewtonScript/README | 1 + Lang/Nim/00DESCRIPTION | 13 + Lang/Nim/100-doors | 1 + Lang/Nim/24-game | 1 + Lang/Nim/9-billion-names-of-God-the-integer | 1 + Lang/Nim/99-Bottles-of-Beer | 1 + Lang/Nim/A+B | 1 + Lang/Nim/ABC-Problem | 1 + Lang/Nim/Abstract-type | 1 + ...ficient-and-perfect-number-classifications | 1 + Lang/Nim/Accumulator-factory | 1 + Lang/Nim/Ackermann-function | 1 + Lang/Nim/Address-of-a-variable | 1 + Lang/Nim/Align-columns | 1 + Lang/Nim/Amb | 1 + Lang/Nim/Amicable-pairs | 1 + Lang/Nim/Anagrams | 1 + Lang/Nim/Anonymous-recursion | 1 + Lang/Nim/Apply-a-callback-to-an-array | 1 + .../Arbitrary-precision-integers--included- | 1 + Lang/Nim/Arithmetic-Complex | 1 + Lang/Nim/Arithmetic-Integer | 1 + Lang/Nim/Arithmetic-Rational | 1 + Lang/Nim/Arithmetic-geometric-mean | 1 + Lang/Nim/Array-concatenation | 1 + Lang/Nim/Arrays | 1 + Lang/Nim/Assertions | 1 + Lang/Nim/Associative-array-Creation | 1 + Lang/Nim/Associative-array-Iteration | 1 + Lang/Nim/Average-loop-length | 1 + Lang/Nim/Averages-Arithmetic-mean | 1 + Lang/Nim/Averages-Mean-angle | 1 + Lang/Nim/Averages-Mean-time-of-day | 1 + Lang/Nim/Averages-Median | 1 + Lang/Nim/Averages-Mode | 1 + Lang/Nim/Averages-Pythagorean-means | 1 + Lang/Nim/Averages-Root-mean-square | 1 + Lang/Nim/Averages-Simple-moving-average | 1 + Lang/Nim/Balanced-brackets | 1 + Lang/Nim/Binary-digits | 1 + Lang/Nim/Binary-search | 1 + Lang/Nim/Binary-strings | 1 + Lang/Nim/Bitmap | 1 + Lang/Nim/Bitmap-Bresenhams-line-algorithm | 1 + Lang/Nim/Bitmap-Read-a-PPM-file | 1 + Lang/Nim/Bitwise-operations | 1 + Lang/Nim/Boolean-values | 1 + Lang/Nim/Box-the-compass | 1 + Lang/Nim/Break-OO-privacy | 1 + Lang/Nim/Bulls-and-cows | 1 + Lang/Nim/CRC-32 | 1 + Lang/Nim/CSV-data-manipulation | 1 + Lang/Nim/CSV-to-HTML-translation | 1 + Lang/Nim/Caesar-cipher | 1 + Lang/Nim/Call-a-foreign-language-function | 1 + Lang/Nim/Call-a-function | 1 + Lang/Nim/Call-a-function-in-a-shared-library | 1 + Lang/Nim/Call-an-object-method | 1 + Lang/Nim/Case-sensitivity-of-identifiers | 1 + Lang/Nim/Casting-out-nines | 1 + Lang/Nim/Catalan-numbers | 1 + Lang/Nim/Catalan-numbers-Pascals-triangle | 1 + Lang/Nim/Catamorphism | 1 + Lang/Nim/Character-codes | 1 + Lang/Nim/Chat-server | 1 + Lang/Nim/Check-that-file-exists | 1 + Lang/Nim/Chinese-remainder-theorem | 1 + Lang/Nim/Cholesky-decomposition | 1 + ...Circles-of-given-radius-through-two-points | 1 + Lang/Nim/Classes | 1 + Lang/Nim/Closures-Value-capture | 1 + Lang/Nim/Collections | 1 + Lang/Nim/Color-of-a-screen-pixel | 1 + Lang/Nim/Combinations | 1 + Lang/Nim/Combinations-and-permutations | 1 + Lang/Nim/Combinations-with-repetitions | 1 + Lang/Nim/Comma-quibbling | 1 + Lang/Nim/Command-line-arguments | 1 + Lang/Nim/Comments | 1 + Lang/Nim/Compile-time-calculation | 1 + Lang/Nim/Compound-data-type | 1 + Lang/Nim/Concurrent-computing | 1 + Lang/Nim/Conditional-structures | 1 + Lang/Nim/Constrained-genericity | 1 + .../Nim/Constrained-random-points-on-a-circle | 1 + Lang/Nim/Conways-Game-of-Life | 1 + Lang/Nim/Copy-a-string | 1 + Lang/Nim/Count-in-factors | 1 + Lang/Nim/Count-in-octal | 1 + Lang/Nim/Count-occurrences-of-a-substring | 1 + Lang/Nim/Count-the-coins | 1 + Lang/Nim/Create-a-file | 1 + Lang/Nim/Create-a-file-on-magnetic-tape | 1 + .../Create-a-two-dimensional-array-at-runtime | 1 + Lang/Nim/Create-an-HTML-table | 1 + Lang/Nim/Currying | 1 + Lang/Nim/Date-format | 1 + Lang/Nim/Date-manipulation | 1 + Lang/Nim/Day-of-the-week | 1 + Lang/Nim/Deal-cards-for-FreeCell | 1 + Lang/Nim/Deepcopy | 1 + Lang/Nim/Define-a-primitive-data-type | 1 + Lang/Nim/Delete-a-file | 1 + Lang/Nim/Detect-division-by-zero | 1 + Lang/Nim/Determine-if-a-string-is-numeric | 1 + .../Determine-if-only-one-instance-is-running | 1 + Lang/Nim/Digital-root | 1 + .../Digital-root-Multiplicative-digital-root | 1 + Lang/Nim/Dining-philosophers | 1 + Lang/Nim/Distributed-programming | 1 + Lang/Nim/Documentation | 1 + Lang/Nim/Dot-product | 1 + Lang/Nim/Doubly-linked-list-Definition | 1 + .../Nim/Doubly-linked-list-Element-definition | 1 + Lang/Nim/Doubly-linked-list-Element-insertion | 1 + Lang/Nim/Doubly-linked-list-Traversal | 1 + Lang/Nim/Draw-a-clock | 1 + Lang/Nim/Draw-a-cuboid | 1 + Lang/Nim/Draw-a-sphere | 1 + Lang/Nim/Echo-server | 1 + Lang/Nim/Empty-directory | 1 + Lang/Nim/Empty-string | 1 + Lang/Nim/Enforced-immutability | 1 + Lang/Nim/Entropy | 1 + Lang/Nim/Enumerations | 1 + Lang/Nim/Environment-variables | 1 + Lang/Nim/Equilibrium-index | 1 + Lang/Nim/Ethiopian-multiplication | 1 + Lang/Nim/Euler-method | 1 + Lang/Nim/Evaluate-binomial-coefficients | 1 + Lang/Nim/Even-or-odd | 1 + Lang/Nim/Events | 1 + Lang/Nim/Evolutionary-algorithm | 1 + Lang/Nim/Exceptions | 1 + ...Catch-an-exception-thrown-in-a-nested-call | 1 + Lang/Nim/Executable-library | 1 + Lang/Nim/Execute-Brain---- | 1 + Lang/Nim/Execute-HQ9+ | 1 + Lang/Nim/Execute-a-system-command | 1 + Lang/Nim/Exponentiation-operator | 1 + Lang/Nim/Extend-your-language | 1 + Lang/Nim/Extreme-floating-point-values | 1 + Lang/Nim/Factorial | 1 + Lang/Nim/Factors-of-a-Mersenne-number | 1 + Lang/Nim/Factors-of-an-integer | 1 + Lang/Nim/Fast-Fourier-transform | 1 + Lang/Nim/Fibonacci-n-step-number-sequences | 1 + Lang/Nim/Fibonacci-sequence | 1 + Lang/Nim/File-input-output | 1 + Lang/Nim/File-modification-time | 1 + Lang/Nim/File-size | 1 + Lang/Nim/Filter | 1 + Lang/Nim/Find-common-directory-path | 1 + Lang/Nim/Find-limit-of-recursion | 1 + Lang/Nim/Find-the-last-Sunday-of-each-month | 1 + Lang/Nim/Find-the-missing-permutation | 1 + Lang/Nim/First-class-functions | 1 + Lang/Nim/Five-weekends | 1 + Lang/Nim/FizzBuzz | 1 + Lang/Nim/Flatten-a-list | 1 + Lang/Nim/Flow-control-structures | 1 + Lang/Nim/Floyds-triangle | 1 + Lang/Nim/Forest-fire | 1 + Lang/Nim/Fork | 1 + Lang/Nim/Formatted-numeric-output | 1 + Lang/Nim/Forward-difference | 1 + Lang/Nim/Four-bit-adder | 1 + Lang/Nim/Function-composition | 1 + Lang/Nim/Function-definition | 1 + Lang/Nim/Function-prototype | 1 + Lang/Nim/GUI-Maximum-window-dimensions | 1 + Lang/Nim/GUI-component-interaction | 1 + Lang/Nim/GUI-enabling-disabling-of-controls | 1 + Lang/Nim/Gamma-function | 1 + Lang/Nim/Generate-lower-case-ASCII-alphabet | 1 + Lang/Nim/Generator-Exponential | 1 + Lang/Nim/Generic-swap | 1 + .../Globally-replace-text-in-several-files | 1 + Lang/Nim/Gray-code | 1 + Lang/Nim/Greatest-common-divisor | 1 + Lang/Nim/Greatest-element-of-a-list | 1 + Lang/Nim/Greatest-subsequential-sum | 1 + Lang/Nim/Guess-the-number | 1 + Lang/Nim/Guess-the-number-With-feedback | 1 + .../Guess-the-number-With-feedback--player- | 1 + Lang/Nim/HTTP | 1 + Lang/Nim/HTTPS | 1 + Lang/Nim/Hailstone-sequence | 1 + Lang/Nim/Hamming-numbers | 1 + Lang/Nim/Handle-a-signal | 1 + Lang/Nim/Happy-numbers | 1 + Lang/Nim/Harshad-or-Niven-series | 1 + Lang/Nim/Hash-from-two-arrays | 1 + Lang/Nim/Haversine-formula | 1 + Lang/Nim/Hello-world-Graphical | 1 + Lang/Nim/Hello-world-Line-printer | 1 + Lang/Nim/Hello-world-Newline-omission | 1 + Lang/Nim/Hello-world-Standard-error | 1 + Lang/Nim/Hello-world-Text | 1 + Lang/Nim/Hello-world-Web-server | 1 + Lang/Nim/Here-document | 1 + Lang/Nim/Heronian-triangles | 1 + Lang/Nim/Higher-order-functions | 1 + Lang/Nim/Hofstadter-Conway-$10,000-sequence | 1 + Lang/Nim/Hofstadter-Figure-Figure-sequences | 1 + Lang/Nim/Hofstadter-Q-sequence | 1 + Lang/Nim/Horizontal-sundial-calculations | 1 + .../Horners-rule-for-polynomial-evaluation | 1 + Lang/Nim/Host-introspection | 1 + Lang/Nim/Hostname | 1 + Lang/Nim/Huffman-coding | 1 + Lang/Nim/IBAN | 1 + Lang/Nim/Identity-matrix | 1 + Lang/Nim/Include-a-file | 1 + Lang/Nim/Increment-a-numerical-string | 1 + Lang/Nim/Infinity | 1 + Lang/Nim/Inheritance-Single | 1 + Lang/Nim/Input-loop | 1 + Lang/Nim/Integer-comparison | 1 + Lang/Nim/Integer-sequence | 1 + Lang/Nim/Introspection | 1 + Lang/Nim/JSON | 1 + Lang/Nim/Jensens-Device | 1 + Lang/Nim/Josephus-problem | 1 + Lang/Nim/Jump-anywhere | 1 + Lang/Nim/Kaprekar-numbers | 1 + .../Keyboard-input-Flush-the-keyboard-buffer | 1 + Lang/Nim/Knuth-shuffle | 1 + Lang/Nim/LZW-compression | 1 + Lang/Nim/Langtons-ant | 1 + Lang/Nim/Largest-int-from-concatenated-ints | 1 + Lang/Nim/Last-Friday-of-each-month | 1 + Lang/Nim/Leap-year | 1 + Lang/Nim/Least-common-multiple | 1 + Lang/Nim/Left-factorials | 1 + Lang/Nim/Letter-frequency | 1 + Lang/Nim/Levenshtein-distance | 1 + Lang/Nim/Linear-congruential-generator | 1 + Lang/Nim/List-comprehensions | 1 + Lang/Nim/Literals-Floating-point | 1 + Lang/Nim/Literals-Integer | 1 + Lang/Nim/Literals-String | 1 + Lang/Nim/Logical-operations | 1 + Lang/Nim/Long-multiplication | 1 + Lang/Nim/Longest-common-subsequence | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/Nim/Loops-Break | 1 + Lang/Nim/Loops-Continue | 1 + Lang/Nim/Loops-Do-while | 1 + Lang/Nim/Loops-Downward-for | 1 + Lang/Nim/Loops-For | 1 + Lang/Nim/Loops-For-with-a-specified-step | 1 + Lang/Nim/Loops-Foreach | 1 + Lang/Nim/Loops-Infinite | 1 + Lang/Nim/Loops-N-plus-one-half | 1 + Lang/Nim/Loops-Nested | 1 + Lang/Nim/Loops-While | 1 + Lang/Nim/Lucas-Lehmer-test | 1 + Lang/Nim/Luhn-test-of-credit-card-numbers | 1 + Lang/Nim/MD4 | 1 + Lang/Nim/MD5 | 1 + Lang/Nim/Machine-code | 1 + Lang/Nim/Mad-Libs | 1 + Lang/Nim/Magic-squares-of-odd-order | 1 + Lang/Nim/Main-step-of-GOST-28147-89 | 1 + Lang/Nim/Man-or-boy-test | 1 + Lang/Nim/Mandelbrot-set | 1 + Lang/Nim/Map-range | 1 + Lang/Nim/Matrix-arithmetic | 1 + Lang/Nim/Matrix-multiplication | 1 + Lang/Nim/Matrix-transposition | 1 + Lang/Nim/Maximum-triangle-path-sum | 1 + Lang/Nim/Maze-generation | 1 + Lang/Nim/Memory-allocation | 1 + Lang/Nim/Memory-layout-of-a-data-structure | 1 + Lang/Nim/Menu | 1 + Lang/Nim/Metaprogramming | 1 + Lang/Nim/Middle-three-digits | 1 + Lang/Nim/Modular-exponentiation | 1 + Lang/Nim/Modular-inverse | 1 + Lang/Nim/Monte-Carlo-methods | 1 + Lang/Nim/Monty-Hall-problem | 1 + Lang/Nim/Multifactorial | 1 + Lang/Nim/Multiple-distinct-objects | 1 + Lang/Nim/Multiplication-tables | 1 + Lang/Nim/Multisplit | 1 + Lang/Nim/Mutual-recursion | 1 + Lang/Nim/N-queens-problem | 1 + Lang/Nim/Named-parameters | 1 + Lang/Nim/Non-continuous-subsequences | 1 + Lang/Nim/Non-decimal-radices-Convert | 1 + Lang/Nim/Non-decimal-radices-Input | 1 + Lang/Nim/Non-decimal-radices-Output | 1 + Lang/Nim/Nth | 1 + Lang/Nim/Nth-root | 1 + Lang/Nim/Null-object | 1 + Lang/Nim/Number-names | 1 + Lang/Nim/Number-reversal-game | 1 + Lang/Nim/Numerical-integration | 1 + Lang/Nim/Odd-word-problem | 1 + Lang/Nim/Old-lady-swallowed-a-fly | 1 + Lang/Nim/One-dimensional-cellular-automata | 1 + Lang/Nim/One-of-n-lines-in-a-file | 1 + Lang/Nim/OpenGL | 1 + Lang/Nim/Optional-parameters | 1 + Lang/Nim/Order-two-numerical-lists | 1 + Lang/Nim/Ordered-words | 1 + Lang/Nim/Palindrome-detection | 1 + Lang/Nim/Pangram-checker | 1 + Lang/Nim/Paraffins | 1 + Lang/Nim/Parametric-polymorphism | 1 + Lang/Nim/Parsing-RPN-calculator-algorithm | 1 + Lang/Nim/Parsing-RPN-to-infix-conversion | 1 + Lang/Nim/Pascals-triangle | 1 + Lang/Nim/Pascals-triangle-Puzzle | 1 + Lang/Nim/Perfect-numbers | 1 + Lang/Nim/Permutations | 1 + Lang/Nim/Permutations-by-swapping | 1 + Lang/Nim/Pernicious-numbers | 1 + Lang/Nim/Pi | 1 + Lang/Nim/Pick-random-element | 1 + Lang/Nim/Playing-cards | 1 + Lang/Nim/Pointers-and-references | 1 + Lang/Nim/Polymorphic-copy | 1 + Lang/Nim/Polymorphism | 1 + Lang/Nim/Power-set | 1 + Lang/Nim/Price-fraction | 1 + Lang/Nim/Primality-by-trial-division | 1 + Lang/Nim/Prime-decomposition | 1 + Lang/Nim/Priority-queue | 1 + Lang/Nim/Probabilistic-choice | 1 + Lang/Nim/Problem-of-Apollonius | 1 + Lang/Nim/Program-name | 1 + Lang/Nim/Program-termination | 1 + Lang/Nim/Pythagorean-triples | 1 + Lang/Nim/Queue-Definition | 1 + Lang/Nim/Queue-Usage | 1 + Lang/Nim/Quickselect-algorithm | 1 + Lang/Nim/Quine | 1 + Lang/Nim/README | 1 + Lang/Nim/Random-number-generator--device- | 1 + Lang/Nim/Random-numbers | 1 + Lang/Nim/Range-expansion | 1 + Lang/Nim/Range-extraction | 1 + Lang/Nim/Read-a-file-line-by-line | 1 + Lang/Nim/Read-a-specific-line-from-a-file | 1 + Lang/Nim/Read-entire-file | 1 + Lang/Nim/Real-constants-and-functions | 1 + Lang/Nim/Record-sound | 1 + Lang/Nim/Regular-expressions | 1 + Lang/Nim/Remove-duplicate-elements | 1 + Lang/Nim/Rename-a-file | 1 + Lang/Nim/Rep-string | 1 + Lang/Nim/Repeat-a-string | 1 + Lang/Nim/Return-multiple-values | 1 + Lang/Nim/Reverse-a-string | 1 + Lang/Nim/Reverse-words-in-a-string | 1 + Lang/Nim/Roman-numerals-Decode | 1 + Lang/Nim/Roman-numerals-Encode | 1 + Lang/Nim/Roots-of-unity | 1 + Lang/Nim/Rot-13 | 1 + Lang/Nim/Run-length-encoding | 1 + Lang/Nim/SEDOLs | 1 + Lang/Nim/SHA-1 | 1 + Lang/Nim/SHA-256 | 1 + Lang/Nim/Safe-addition | 1 + Lang/Nim/Scope-modifiers | 1 + Lang/Nim/Search-a-list | 1 + Lang/Nim/Self-describing-numbers | 1 + Lang/Nim/Semordnilap | 1 + Lang/Nim/Send-email | 1 + Lang/Nim/Sequence-of-non-squares | 1 + Lang/Nim/Set | 1 + Lang/Nim/Short-circuit-evaluation | 1 + Lang/Nim/Show-the-epoch | 1 + Lang/Nim/Sierpinski-carpet | 1 + Lang/Nim/Sierpinski-triangle | 1 + Lang/Nim/Sieve-of-Eratosthenes | 1 + Lang/Nim/Simple-windowed-application | 1 + Lang/Nim/Singleton | 1 + .../Nim/Singly-linked-list-Element-definition | 1 + Lang/Nim/Singly-linked-list-Element-insertion | 1 + Lang/Nim/Singly-linked-list-Traversal | 1 + Lang/Nim/Sleep | 1 + Lang/Nim/Sockets | 1 + Lang/Nim/Solve-a-Hidato-puzzle | 1 + .../Nim/Sort-an-array-of-composite-structures | 1 + Lang/Nim/Sort-an-integer-array | 1 + Lang/Nim/Sort-disjoint-sublist | 1 + Lang/Nim/Sort-using-a-custom-comparator | 1 + Lang/Nim/Sorting-algorithms-Bead-sort | 1 + Lang/Nim/Sorting-algorithms-Bogosort | 1 + Lang/Nim/Sorting-algorithms-Bubble-sort | 1 + Lang/Nim/Sorting-algorithms-Cocktail-sort | 1 + Lang/Nim/Sorting-algorithms-Comb-sort | 1 + Lang/Nim/Sorting-algorithms-Counting-sort | 1 + Lang/Nim/Sorting-algorithms-Gnome-sort | 1 + Lang/Nim/Sorting-algorithms-Heapsort | 1 + Lang/Nim/Sorting-algorithms-Insertion-sort | 1 + Lang/Nim/Sorting-algorithms-Merge-sort | 1 + Lang/Nim/Sorting-algorithms-Pancake-sort | 1 + Lang/Nim/Sorting-algorithms-Permutation-sort | 1 + Lang/Nim/Sorting-algorithms-Quicksort | 1 + Lang/Nim/Sorting-algorithms-Selection-sort | 1 + Lang/Nim/Sorting-algorithms-Shell-sort | 1 + Lang/Nim/Sorting-algorithms-Sleep-sort | 1 + Lang/Nim/Sorting-algorithms-Stooge-sort | 1 + Lang/Nim/Sorting-algorithms-Strand-sort | 1 + Lang/Nim/Sparkline-in-unicode | 1 + Lang/Nim/Special-characters | 1 + Lang/Nim/Spiral-matrix | 1 + Lang/Nim/Stack | 1 + Lang/Nim/Stack-traces | 1 + Lang/Nim/Stair-climbing-puzzle | 1 + Lang/Nim/Statistics-Basic | 1 + Lang/Nim/String-append | 1 + Lang/Nim/String-case | 1 + Lang/Nim/String-comparison | 1 + Lang/Nim/String-concatenation | 1 + Lang/Nim/String-interpolation--included- | 1 + Lang/Nim/String-length | 1 + Lang/Nim/String-matching | 1 + Lang/Nim/String-prepend | 1 + .../Strip-a-set-of-characters-from-a-string | 1 + Lang/Nim/Strip-block-comments | 1 + Lang/Nim/Strip-comments-from-a-string | 1 + ...odes-and-extended-characters-from-a-string | 1 + ...trip-whitespace-from-a-string-Top-and-tail | 1 + Lang/Nim/Substring | 1 + Lang/Nim/Substring-Top-and-tail | 1 + Lang/Nim/Sum-and-product-of-an-array | 1 + Lang/Nim/Sum-digits-of-an-integer | 1 + Lang/Nim/Sum-multiples-of-3-and-5 | 1 + Lang/Nim/Sum-of-a-series | 1 + Lang/Nim/Sum-of-squares | 1 + Lang/Nim/Symmetric-difference | 1 + Lang/Nim/System-time | 1 + Lang/Nim/Table-creation-Postal-addresses | 1 + Lang/Nim/Take-notes-on-the-command-line | 1 + Lang/Nim/Temperature-conversion | 1 + Lang/Nim/Terminal-control-Clear-the-screen | 1 + Lang/Nim/Terminal-control-Coloured-text | 1 + Lang/Nim/Terminal-control-Cursor-positioning | 1 + ...inal-control-Display-an-extended-character | 1 + Lang/Nim/Terminal-control-Inverse-video | 1 + Lang/Nim/Terminal-control-Preserve-screen | 1 + ...Terminal-control-Ringing-the-terminal-bell | 1 + Lang/Nim/Terminal-control-Unicode-output | 1 + Lang/Nim/Ternary-logic | 1 + Lang/Nim/Test-a-function | 1 + Lang/Nim/Text-processing-1 | 1 + Lang/Nim/Text-processing-2 | 1 + Lang/Nim/Text-processing-Max-licenses-in-use | 1 + Lang/Nim/The-Twelve-Days-of-Christmas | 1 + Lang/Nim/Time-a-function | 1 + Lang/Nim/Tokenize-a-string | 1 + Lang/Nim/Top-rank-per-group | 1 + Lang/Nim/Total-circles-area | 1 + Lang/Nim/Towers-of-Hanoi | 1 + Lang/Nim/Trabb-Pardo-Knuth-algorithm | 1 + Lang/Nim/Tree-traversal | 1 + Lang/Nim/Trigonometric-functions | 1 + Lang/Nim/Truncatable-primes | 1 + Lang/Nim/Truncate-a-file | 1 + Lang/Nim/URL-decoding | 1 + Lang/Nim/URL-encoding | 1 + Lang/Nim/Unbias-a-random-generator | 1 + Lang/Nim/Unicode-strings | 1 + Lang/Nim/Unicode-variable-names | 1 + Lang/Nim/Universal-Turing-machine | 1 + Lang/Nim/Unix-ls | 1 + .../Use-another-language-to-call-a-function | 1 + Lang/Nim/User-input-Text | 1 + Lang/Nim/Variable-length-quantity | 1 + Lang/Nim/Variable-size-Get | 1 + Lang/Nim/Variable-size-Set | 1 + Lang/Nim/Variables | 1 + Lang/Nim/Variadic-function | 1 + Lang/Nim/Vector-products | 1 + Lang/Nim/Vigen-re-cipher | 1 + Lang/Nim/Visualize-a-tree | 1 + Lang/Nim/Walk-a-directory-Non-recursively | 1 + Lang/Nim/Walk-a-directory-Recursively | 1 + Lang/Nim/Web-scraping | 1 + Lang/Nim/Window-creation | 1 + Lang/Nim/Window-management | 1 + Lang/Nim/Wireworld | 1 + Lang/Nim/Word-wrap | 1 + Lang/Nim/Write-float-arrays-to-a-text-file | 1 + Lang/Nim/Write-language-name-in-3D-ASCII | 1 + Lang/Nim/XML-DOM-serialization | 1 + Lang/Nim/XML-Input | 1 + Lang/Nim/XML-Output | 1 + Lang/Nim/XML-XPath | 1 + Lang/Nim/Zeckendorf-number-representation | 1 + Lang/Nim/Zero-to-the-zero-power | 1 + Lang/Nim/Zig-zag-matrix | 1 + Lang/Nit/00DESCRIPTION | 12 + Lang/Nit/A+B | 1 + Lang/Nit/Abstract-type | 1 + Lang/Nit/Hello-world-Text | 1 + Lang/Nit/README | 1 + Lang/Nix/00DESCRIPTION | 1 + Lang/Nix/README | 1 + Lang/Nix/Sorting-algorithms-Quicksort | 1 + Lang/Oforth/00DESCRIPTION | 19 + Lang/Oforth/100-doors | 1 + Lang/Oforth/24-game | 1 + Lang/Oforth/99-Bottles-of-Beer | 1 + Lang/Oforth/A+B | 1 + Lang/Oforth/ABC-Problem | 1 + Lang/Oforth/AKS-test-for-primes | 1 + Lang/Oforth/Abstract-type | 1 + ...ficient-and-perfect-number-classifications | 1 + Lang/Oforth/Accumulator-factory | 1 + Lang/Oforth/Ackermann-function | 1 + Lang/Oforth/Align-columns | 1 + Lang/Oforth/Aliquot-sequence-classifications | 1 + Lang/Oforth/Almost-prime | 1 + Lang/Oforth/Amicable-pairs | 1 + Lang/Oforth/Anagrams | 1 + Lang/Oforth/Apply-a-callback-to-an-array | 1 + .../Arbitrary-precision-integers--included- | 1 + Lang/Oforth/Arena-storage-pool | 1 + Lang/Oforth/Arithmetic-Complex | 1 + Lang/Oforth/Arithmetic-Integer | 1 + Lang/Oforth/Arithmetic-geometric-mean | 1 + Lang/Oforth/Array-concatenation | 1 + Lang/Oforth/Arrays | 1 + Lang/Oforth/Assertions | 1 + Lang/Oforth/Averages-Arithmetic-mean | 1 + Lang/Oforth/Averages-Pythagorean-means | 1 + Lang/Oforth/Averages-Root-mean-square | 1 + Lang/Oforth/Averages-Simple-moving-average | 1 + Lang/Oforth/Balanced-brackets | 1 + Lang/Oforth/Bitwise-operations | 1 + Lang/Oforth/Bulls-and-cows | 1 + Lang/Oforth/Caesar-cipher | 1 + Lang/Oforth/Call-a-function | 1 + Lang/Oforth/Call-an-object-method | 1 + Lang/Oforth/Case-sensitivity-of-identifiers | 1 + Lang/Oforth/Catalan-numbers | 1 + Lang/Oforth/Catalan-numbers-Pascals-triangle | 1 + Lang/Oforth/Catamorphism | 1 + Lang/Oforth/Character-codes | 1 + Lang/Oforth/Checkpoint-synchronization | 1 + ...Circles-of-given-radius-through-two-points | 1 + Lang/Oforth/Classes | 1 + Lang/Oforth/Closures-Value-capture | 1 + Lang/Oforth/Collections | 1 + Lang/Oforth/Comma-quibbling | 1 + Lang/Oforth/Command-line-arguments | 1 + Lang/Oforth/Comments | 1 + Lang/Oforth/Compile-time-calculation | 1 + Lang/Oforth/Compound-data-type | 1 + Lang/Oforth/Concurrent-computing | 1 + Lang/Oforth/Conditional-structures | 1 + Lang/Oforth/Copy-a-string | 1 + Lang/Oforth/Count-occurrences-of-a-substring | 1 + Lang/Oforth/Currying | 1 + Lang/Oforth/Day-of-the-week | 1 + Lang/Oforth/Delegates | 1 + Lang/Oforth/Detect-division-by-zero | 1 + Lang/Oforth/Digital-root | 1 + Lang/Oforth/Dot-product | 1 + Lang/Oforth/Doubly-linked-list-Definition | 1 + .../Doubly-linked-list-Element-definition | 1 + .../Doubly-linked-list-Element-insertion | 1 + Lang/Oforth/Doubly-linked-list-Traversal | 1 + Lang/Oforth/Dynamic-variable-names | 1 + Lang/Oforth/Empty-program | 1 + Lang/Oforth/Empty-string | 1 + Lang/Oforth/Enforced-immutability | 1 + Lang/Oforth/Entropy | 1 + Lang/Oforth/Enumerations | 1 + Lang/Oforth/Environment-variables | 1 + Lang/Oforth/Equilibrium-index | 1 + Lang/Oforth/Ethiopian-multiplication | 1 + Lang/Oforth/Euler-method | 1 + Lang/Oforth/Evaluate-binomial-coefficients | 1 + Lang/Oforth/Even-or-odd | 1 + Lang/Oforth/Events | 1 + Lang/Oforth/Evolutionary-algorithm | 1 + Lang/Oforth/Exceptions | 1 + ...Catch-an-exception-thrown-in-a-nested-call | 1 + Lang/Oforth/Execute-a-system-command | 1 + Lang/Oforth/Exponentiation-operator | 1 + Lang/Oforth/Factorial | 1 + Lang/Oforth/Factors-of-an-integer | 1 + Lang/Oforth/Fibonacci-sequence | 1 + Lang/Oforth/Fibonacci-word | 1 + Lang/Oforth/File-input-output | 1 + Lang/Oforth/File-modification-time | 1 + Lang/Oforth/File-size | 1 + Lang/Oforth/Filter | 1 + Lang/Oforth/Find-limit-of-recursion | 1 + .../Oforth/Find-the-last-Sunday-of-each-month | 1 + Lang/Oforth/First-class-functions | 1 + ...st-class-functions-Use-numbers-analogously | 1 + Lang/Oforth/Five-weekends | 1 + Lang/Oforth/FizzBuzz | 1 + Lang/Oforth/Flatten-a-list | 1 + Lang/Oforth/Flow-control-structures | 1 + Lang/Oforth/Forward-difference | 1 + Lang/Oforth/Function-composition | 1 + Lang/Oforth/Function-definition | 1 + Lang/Oforth/Function-prototype | 1 + Lang/Oforth/Gamma-function | 1 + .../Oforth/Generate-lower-case-ASCII-alphabet | 1 + Lang/Oforth/Generic-swap | 1 + Lang/Oforth/Greatest-common-divisor | 1 + Lang/Oforth/Greatest-element-of-a-list | 1 + Lang/Oforth/Guess-the-number | 1 + Lang/Oforth/Guess-the-number-With-feedback | 1 + Lang/Oforth/Hailstone-sequence | 1 + Lang/Oforth/Happy-numbers | 1 + Lang/Oforth/Harshad-or-Niven-series | 1 + Lang/Oforth/Haversine-formula | 1 + Lang/Oforth/Hello-world-Line-printer | 1 + Lang/Oforth/Hello-world-Newbie | 1 + Lang/Oforth/Hello-world-Newline-omission | 1 + Lang/Oforth/Hello-world-Standard-error | 1 + Lang/Oforth/Hello-world-Text | 1 + Lang/Oforth/Higher-order-functions | 1 + .../Oforth/Hofstadter-Conway-$10,000-sequence | 1 + .../Oforth/Hofstadter-Figure-Figure-sequences | 1 + Lang/Oforth/Hofstadter-Q-sequence | 1 + Lang/Oforth/Include-a-file | 1 + Lang/Oforth/Increment-a-numerical-string | 1 + Lang/Oforth/Infinity | 1 + Lang/Oforth/Inheritance-Multiple | 1 + Lang/Oforth/Inheritance-Single | 1 + Lang/Oforth/Input-loop | 1 + Lang/Oforth/Integer-comparison | 1 + Lang/Oforth/Integer-sequence | 1 + Lang/Oforth/Interactive-programming | 1 + Lang/Oforth/Introspection | 1 + Lang/Oforth/Iterated-digits-squaring | 1 + Lang/Oforth/JSON | 1 + Lang/Oforth/Jensens-Device | 1 + Lang/Oforth/Josephus-problem | 1 + .../Keyboard-input-Flush-the-keyboard-buffer | 1 + Lang/Oforth/Keyboard-input-Keypress-check | 1 + .../Keyboard-input-Obtain-a-Y-or-N-response | 1 + Lang/Oforth/Knapsack-problem-Continuous | 1 + Lang/Oforth/Knuth-shuffle | 1 + .../Oforth/Largest-int-from-concatenated-ints | 1 + Lang/Oforth/Last-Friday-of-each-month | 1 + Lang/Oforth/Leap-year | 1 + Lang/Oforth/Least-common-multiple | 1 + Lang/Oforth/Left-factorials | 1 + Lang/Oforth/Linear-congruential-generator | 1 + Lang/Oforth/Literals-Floating-point | 1 + Lang/Oforth/Literals-String | 1 + Lang/Oforth/Logical-operations | 1 + Lang/Oforth/Long-multiplication | 1 + Lang/Oforth/Look-and-say-sequence | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/Oforth/Loops-Break | 1 + Lang/Oforth/Loops-Continue | 1 + Lang/Oforth/Loops-Do-while | 1 + Lang/Oforth/Loops-Downward-for | 1 + Lang/Oforth/Loops-For | 1 + Lang/Oforth/Loops-For-with-a-specified-step | 1 + Lang/Oforth/Loops-Foreach | 1 + Lang/Oforth/Loops-Infinite | 1 + Lang/Oforth/Loops-N-plus-one-half | 1 + Lang/Oforth/Loops-While | 1 + Lang/Oforth/Ludic-numbers | 1 + Lang/Oforth/Luhn-test-of-credit-card-numbers | 1 + Lang/Oforth/Mad-Libs | 1 + Lang/Oforth/Magic-squares-of-odd-order | 1 + Lang/Oforth/Map-range | 1 + Lang/Oforth/Metered-concurrency | 1 + Lang/Oforth/Middle-three-digits | 1 + Lang/Oforth/Modular-exponentiation | 1 + Lang/Oforth/Modular-inverse | 1 + Lang/Oforth/Multifactorial | 1 + Lang/Oforth/Multiple-distinct-objects | 1 + Lang/Oforth/Mutual-recursion | 1 + Lang/Oforth/Narcissistic-decimal-number | 1 + Lang/Oforth/Nth | 1 + Lang/Oforth/Nth-root | 1 + Lang/Oforth/Null-object | 1 + Lang/Oforth/Number-reversal-game | 1 + Lang/Oforth/One-dimensional-cellular-automata | 1 + Lang/Oforth/Ordered-words | 1 + Lang/Oforth/Palindrome-detection | 1 + Lang/Oforth/Parallel-calculations | 1 + Lang/Oforth/Parsing-RPN-calculator-algorithm | 1 + Lang/Oforth/Partial-function-application | 1 + Lang/Oforth/Pascals-triangle | 1 + Lang/Oforth/Perfect-numbers | 1 + Lang/Oforth/Phrase-reversals | 1 + Lang/Oforth/Pi | 1 + Lang/Oforth/Pick-random-element | 1 + Lang/Oforth/Polymorphism | 1 + Lang/Oforth/Price-fraction | 1 + Lang/Oforth/Primality-by-trial-division | 1 + Lang/Oforth/Prime-decomposition | 1 + Lang/Oforth/Program-termination | 1 + Lang/Oforth/Quaternion-type | 1 + Lang/Oforth/Queue-Definition | 1 + Lang/Oforth/Queue-Usage | 1 + Lang/Oforth/Quine | 1 + Lang/Oforth/README | 1 + Lang/Oforth/Range-expansion | 1 + Lang/Oforth/Read-a-file-line-by-line | 1 + Lang/Oforth/Real-constants-and-functions | 1 + Lang/Oforth/Remove-lines-from-a-file | 1 + Lang/Oforth/Rep-string | 1 + Lang/Oforth/Repeat-a-string | 1 + Lang/Oforth/Respond-to-an-unknown-method-call | 1 + Lang/Oforth/Return-multiple-values | 1 + Lang/Oforth/Reverse-a-string | 1 + Lang/Oforth/Reverse-words-in-a-string | 1 + Lang/Oforth/Roman-numerals-Encode | 1 + Lang/Oforth/Roots-of-a-function | 1 + Lang/Oforth/Rot-13 | 1 + Lang/Oforth/Run-length-encoding | 1 + Lang/Oforth/Runtime-evaluation | 1 + Lang/Oforth/SEDOLs | 1 + Lang/Oforth/Search-a-list | 1 + Lang/Oforth/Semiprime | 1 + Lang/Oforth/Semordnilap | 1 + Lang/Oforth/Send-an-unknown-method-call | 1 + Lang/Oforth/Sequence-of-non-squares | 1 + .../Sequence-of-primes-by-Trial-Division | 1 + Lang/Oforth/Shell-one-liner | 1 + Lang/Oforth/Show-the-epoch | 1 + Lang/Oforth/Sierpinski-carpet | 1 + Lang/Oforth/Sierpinski-triangle | 1 + Lang/Oforth/Sieve-of-Eratosthenes | 1 + Lang/Oforth/Singleton | 1 + .../Singly-linked-list-Element-definition | 1 + .../Singly-linked-list-Element-insertion | 1 + Lang/Oforth/Singly-linked-list-Traversal | 1 + Lang/Oforth/Sleep | 1 + .../Sort-an-array-of-composite-structures | 1 + Lang/Oforth/Sort-an-integer-array | 1 + Lang/Oforth/Sort-using-a-custom-comparator | 1 + Lang/Oforth/Sorting-algorithms-Insertion-sort | 1 + Lang/Oforth/Sorting-algorithms-Quicksort | 1 + Lang/Oforth/Sorting-algorithms-Selection-sort | 1 + Lang/Oforth/Sorting-algorithms-Sleep-sort | 1 + Lang/Oforth/Stack | 1 + Lang/Oforth/Stack-traces | 1 + Lang/Oforth/Start-from-a-main-routine | 1 + Lang/Oforth/Statistics-Basic | 1 + Lang/Oforth/Stern-Brocot-sequence | 1 + Lang/Oforth/String-append | 1 + Lang/Oforth/String-case | 1 + Lang/Oforth/String-comparison | 1 + Lang/Oforth/String-concatenation | 1 + Lang/Oforth/String-matching | 1 + Lang/Oforth/String-prepend | 1 + .../Strip-a-set-of-characters-from-a-string | 1 + Lang/Oforth/Strip-comments-from-a-string | 1 + Lang/Oforth/Substring | 1 + Lang/Oforth/Substring-Top-and-tail | 1 + Lang/Oforth/Sum-and-product-of-an-array | 1 + Lang/Oforth/Sum-digits-of-an-integer | 1 + Lang/Oforth/Sum-multiples-of-3-and-5 | 1 + Lang/Oforth/Sum-of-a-series | 1 + Lang/Oforth/Sum-of-squares | 1 + Lang/Oforth/Synchronous-concurrency | 1 + Lang/Oforth/System-time | 1 + Lang/Oforth/Temperature-conversion | 1 + Lang/Oforth/Test-a-function | 1 + Lang/Oforth/Tokenize-a-string | 1 + Lang/Oforth/Top-rank-per-group | 1 + Lang/Oforth/Topic-variable | 1 + Lang/Oforth/Towers-of-Hanoi | 1 + Lang/Oforth/Tree-traversal | 1 + Lang/Oforth/Trigonometric-functions | 1 + Lang/Oforth/User-input-Text | 1 + Lang/Oforth/Variables | 1 + Lang/Oforth/Variadic-function | 1 + Lang/Oforth/Y-combinator | 1 + Lang/Oforth/Zero-to-the-zero-power | 1 + Lang/Ol/00DESCRIPTION | 14 + Lang/Ol/README | 1 + Lang/OpenLisp/00DESCRIPTION | 7 + Lang/OpenLisp/Empty-program | 1 + Lang/OpenLisp/Hello-world-Text | 1 + Lang/OpenLisp/README | 1 + Lang/PHL/00DESCRIPTION | 18 + Lang/PHL/100-doors | 1 + Lang/PHL/99-Bottles-of-Beer | 1 + Lang/PHL/Arithmetic-Integer | 1 + Lang/PHL/Classes | 1 + Lang/PHL/Conditional-structures | 1 + Lang/PHL/Exceptions | 1 + Lang/PHL/Extend-your-language | 1 + Lang/PHL/Filter | 1 + Lang/PHL/FizzBuzz | 1 + Lang/PHL/Function-definition | 1 + Lang/PHL/Hello-world-Newline-omission | 1 + Lang/PHL/Hello-world-Text | 1 + Lang/PHL/Integer-comparison | 1 + Lang/PHL/Loops-Do-while | 1 + Lang/PHL/Loops-Foreach | 1 + Lang/PHL/Loops-While | 1 + Lang/PHL/Null-object | 1 + Lang/PHL/README | 1 + Lang/PHL/String-concatenation | 1 + Lang/PHL/Towers-of-Hanoi | 1 + Lang/PHL/Universal-Turing-machine | 1 + Lang/PHL/Yin-and-yang | 1 + Lang/Panda/00DESCRIPTION | 5 + Lang/Panda/Arithmetic-Integer | 1 + Lang/Panda/Binary-digits | 1 + Lang/Panda/Factorial | 1 + Lang/Panda/Factors-of-an-integer | 1 + Lang/Panda/Hello-world-Web-server | 1 + Lang/Panda/Loops-For-with-a-specified-step | 1 + Lang/Panda/Loops-N-plus-one-half | 1 + Lang/Panda/Loops-While | 1 + Lang/Panda/Pernicious-numbers | 1 + Lang/Panda/Primality-by-trial-division | 1 + Lang/Panda/README | 1 + Lang/Panda/Read-entire-file | 1 + Lang/Panda/Sum-of-a-series | 1 + Lang/Pare/00DESCRIPTION | 7 + Lang/Pare/Hello-world-Newbie | 1 + Lang/Pare/README | 1 + Lang/Peloton/00DESCRIPTION | 7 + Lang/Peloton/Binary-digits | 1 + Lang/Peloton/Comments | 1 + Lang/Peloton/Create-an-HTML-table | 1 + Lang/Peloton/Day-of-the-week | 1 + Lang/Peloton/Factorial | 1 + Lang/Peloton/Filter | 1 + Lang/Peloton/FizzBuzz | 1 + Lang/Peloton/HTTP | 1 + Lang/Peloton/History-variables | 1 + Lang/Peloton/Loops-Downward-for | 1 + Lang/Peloton/Loops-N-plus-one-half | 1 + Lang/Peloton/README | 1 + Lang/Peloton/Read-a-configuration-file | 1 + Lang/Peloton/Reverse-a-string | 1 + Lang/Peloton/Roman-numerals-Encode | 1 + Lang/Peloton/Singly-linked-list-Traversal | 1 + Lang/Peloton/Sleep | 1 + Lang/Peloton/Sort-an-integer-array | 1 + Lang/Peloton/String-case | 1 + ...odes-and-extended-characters-from-a-string | 1 + Lang/Peloton/Unicode-variable-names | 1 + Lang/Peloton/Web-scraping | 1 + Lang/PeopleCode/00DESCRIPTION | 2 + .../Determine-if-a-string-is-numeric | 1 + Lang/PeopleCode/Loops-While | 1 + Lang/PeopleCode/README | 1 + Lang/Perl5i/00DESCRIPTION | 7 + Lang/Perl5i/100-doors | 1 + Lang/Perl5i/Combinations | 1 + Lang/Perl5i/README | 1 + Lang/Phix/00DESCRIPTION | 26 + Lang/Phix/100-doors | 1 + Lang/Phix/24-game | 1 + Lang/Phix/24-game-Solve | 1 + Lang/Phix/9-billion-names-of-God-the-integer | 1 + Lang/Phix/99-Bottles-of-Beer | 1 + Lang/Phix/A+B | 1 + Lang/Phix/ABC-Problem | 1 + Lang/Phix/AKS-test-for-primes | 1 + ...ficient-and-perfect-number-classifications | 1 + Lang/Phix/Ackermann-function | 1 + Lang/Phix/Address-of-a-variable | 1 + Lang/Phix/Align-columns | 1 + Lang/Phix/Aliquot-sequence-classifications | 1 + Lang/Phix/Almost-prime | 1 + Lang/Phix/Amb | 1 + Lang/Phix/Amicable-pairs | 1 + Lang/Phix/Anagrams | 1 + Lang/Phix/Anagrams-Deranged-anagrams | 1 + Lang/Phix/Animate-a-pendulum | 1 + Lang/Phix/Animation | 1 + Lang/Phix/Apply-a-callback-to-an-array | 1 + .../Arbitrary-precision-integers--included- | 1 + Lang/Phix/Arithmetic-Complex | 1 + Lang/Phix/Arithmetic-Integer | 1 + Lang/Phix/Arithmetic-Rational | 1 + Lang/Phix/Arithmetic-evaluation | 1 + Lang/Phix/Arithmetic-geometric-mean | 1 + .../Arithmetic-geometric-mean-Calculate-Pi | 1 + Lang/Phix/Array-concatenation | 1 + Lang/Phix/Arrays | 1 + Lang/Phix/Assertions | 1 + Lang/Phix/Associative-array-Creation | 1 + Lang/Phix/Associative-array-Iteration | 1 + Lang/Phix/Atomic-updates | 1 + Lang/Phix/Average-loop-length | 1 + Lang/Phix/Averages-Arithmetic-mean | 1 + Lang/Phix/Averages-Mean-angle | 1 + Lang/Phix/Averages-Mean-time-of-day | 1 + Lang/Phix/Averages-Median | 1 + Lang/Phix/Averages-Mode | 1 + Lang/Phix/Averages-Pythagorean-means | 1 + Lang/Phix/Averages-Root-mean-square | 1 + Lang/Phix/Averages-Simple-moving-average | 1 + Lang/Phix/Balanced-brackets | 1 + Lang/Phix/Balanced-ternary | 1 + Lang/Phix/Benfords-law | 1 + Lang/Phix/Bernoulli-numbers | 1 + Lang/Phix/Best-shuffle | 1 + Lang/Phix/Binary-digits | 1 + Lang/Phix/Binary-search | 1 + Lang/Phix/Binary-strings | 1 + Lang/Phix/Bitmap | 1 + Lang/Phix/Bitmap-B-zier-curves-Cubic | 1 + Lang/Phix/Bitmap-B-zier-curves-Quadratic | 1 + Lang/Phix/Bitmap-Bresenhams-line-algorithm | 1 + Lang/Phix/Bitmap-Flood-fill | 1 + Lang/Phix/Bitmap-Histogram | 1 + Lang/Phix/Bitmap-Midpoint-circle-algorithm | 1 + Lang/Phix/Bitmap-Read-a-PPM-file | 1 + Lang/Phix/Bitmap-Write-a-PPM-file | 1 + Lang/Phix/Bitwise-operations | 1 + Lang/Phix/Box-the-compass | 1 + Lang/Phix/Brownian-tree | 1 + Lang/Phix/Bulls-and-cows | 1 + Lang/Phix/Bulls-and-cows-Player | 1 + Lang/Phix/CRC-32 | 1 + Lang/Phix/CSV-to-HTML-translation | 1 + Lang/Phix/Caesar-cipher | 1 + Lang/Phix/Calendar | 1 + Lang/Phix/Calendar---for-REAL-programmers | 1 + Lang/Phix/Call-a-foreign-language-function | 1 + Lang/Phix/Call-a-function | 1 + Lang/Phix/Case-sensitivity-of-identifiers | 1 + Lang/Phix/Catalan-numbers | 1 + Lang/Phix/Catalan-numbers-Pascals-triangle | 1 + Lang/Phix/Character-codes | 1 + Lang/Phix/Check-that-file-exists | 1 + Lang/Phix/Closest-pair-problem | 1 + Lang/Phix/Collections | 1 + Lang/Phix/Combinations | 1 + Lang/Phix/Combinations-and-permutations | 1 + Lang/Phix/Combinations-with-repetitions | 1 + Lang/Phix/Command-line-arguments | 1 + Lang/Phix/Comments | 1 + Lang/Phix/Compile-time-calculation | 1 + Lang/Phix/Compound-data-type | 1 + Lang/Phix/Concurrent-computing | 1 + .../Constrained-random-points-on-a-circle | 1 + Lang/Phix/Convert-decimal-number-to-rational | 1 + Lang/Phix/Copy-a-string | 1 + Lang/Phix/Count-in-factors | 1 + Lang/Phix/Count-in-octal | 1 + Lang/Phix/Count-occurrences-of-a-substring | 1 + Lang/Phix/Create-a-file | 1 + .../Create-a-two-dimensional-array-at-runtime | 1 + Lang/Phix/Create-an-HTML-table | 1 + Lang/Phix/Create-an-object-at-a-given-address | 1 + Lang/Phix/Date-format | 1 + Lang/Phix/Date-manipulation | 1 + Lang/Phix/Day-of-the-week | 1 + Lang/Phix/Define-a-primitive-data-type | 1 + Lang/Phix/Determine-if-a-string-is-numeric | 1 + .../Determine-if-only-one-instance-is-running | 1 + Lang/Phix/Dining-philosophers | 1 + Lang/Phix/Discordian-date | 1 + Lang/Phix/Dot-product | 1 + Lang/Phix/Draw-a-cuboid | 1 + Lang/Phix/Element-wise-operations | 1 + Lang/Phix/Empty-string | 1 + Lang/Phix/Enforced-immutability | 1 + Lang/Phix/Enumerations | 1 + Lang/Phix/Environment-variables | 1 + Lang/Phix/Equilibrium-index | 1 + Lang/Phix/Ethiopian-multiplication | 1 + Lang/Phix/Euler-method | 1 + Lang/Phix/Even-or-odd | 1 + Lang/Phix/Evolutionary-algorithm | 1 + Lang/Phix/Execute-Brain---- | 1 + Lang/Phix/Execute-HQ9+ | 1 + Lang/Phix/Execute-a-system-command | 1 + Lang/Phix/Exponentiation-operator | 1 + Lang/Phix/Extreme-floating-point-values | 1 + Lang/Phix/Factorial | 1 + Lang/Phix/Fibonacci-sequence | 1 + Lang/Phix/File-input-output | 1 + Lang/Phix/File-size | 1 + Lang/Phix/Filter | 1 + Lang/Phix/Find-limit-of-recursion | 1 + Lang/Phix/Find-the-last-Sunday-of-each-month | 1 + Lang/Phix/Find-the-missing-permutation | 1 + Lang/Phix/First-class-functions | 1 + ...st-class-functions-Use-numbers-analogously | 1 + Lang/Phix/Five-weekends | 1 + Lang/Phix/FizzBuzz | 1 + Lang/Phix/Flatten-a-list | 1 + Lang/Phix/Flow-control-structures | 1 + Lang/Phix/Fork | 1 + Lang/Phix/Formatted-numeric-output | 1 + Lang/Phix/Fractal-tree | 1 + Lang/Phix/Function-composition | 1 + Lang/Phix/Function-definition | 1 + Lang/Phix/GUI-component-interaction | 1 + Lang/Phix/GUI-enabling-disabling-of-controls | 1 + Lang/Phix/Generate-lower-case-ASCII-alphabet | 1 + Lang/Phix/Generic-swap | 1 + Lang/Phix/Gray-code | 1 + Lang/Phix/Grayscale-image | 1 + Lang/Phix/Greatest-common-divisor | 1 + Lang/Phix/Greatest-element-of-a-list | 1 + Lang/Phix/Greatest-subsequential-sum | 1 + Lang/Phix/Guess-the-number | 1 + Lang/Phix/Guess-the-number-With-feedback | 1 + .../Guess-the-number-With-feedback--player- | 1 + Lang/Phix/Hailstone-sequence | 1 + Lang/Phix/Happy-numbers | 1 + Lang/Phix/Hello-world-Graphical | 1 + Lang/Phix/Hello-world-Line-printer | 1 + Lang/Phix/Hello-world-Newline-omission | 1 + Lang/Phix/Hello-world-Standard-error | 1 + Lang/Phix/Hello-world-Text | 1 + Lang/Phix/Here-document | 1 + Lang/Phix/Heronian-triangles | 1 + Lang/Phix/Higher-order-functions | 1 + Lang/Phix/Honeycombs | 1 + Lang/Phix/Horizontal-sundial-calculations | 1 + Lang/Phix/Include-a-file | 1 + Lang/Phix/Increment-a-numerical-string | 1 + Lang/Phix/Infinity | 1 + Lang/Phix/Integer-comparison | 1 + Lang/Phix/Integer-overflow | 1 + Lang/Phix/Integer-sequence | 1 + Lang/Phix/Inverted-index | 1 + Lang/Phix/Jump-anywhere | 1 + .../Keyboard-input-Flush-the-keyboard-buffer | 1 + Lang/Phix/Keyboard-input-Keypress-check | 1 + .../Keyboard-input-Obtain-a-Y-or-N-response | 1 + Lang/Phix/Knights-tour | 1 + Lang/Phix/Knuth-shuffle | 1 + Lang/Phix/Langtons-ant | 1 + Lang/Phix/Largest-int-from-concatenated-ints | 1 + Lang/Phix/Last-Friday-of-each-month | 1 + Lang/Phix/Last-letter-first-letter | 1 + Lang/Phix/Leap-year | 1 + Lang/Phix/Least-common-multiple | 1 + Lang/Phix/Letter-frequency | 1 + Lang/Phix/Levenshtein-distance | 1 + Lang/Phix/Literals-Floating-point | 1 + Lang/Phix/Literals-Integer | 1 + Lang/Phix/Literals-String | 1 + Lang/Phix/Logical-operations | 1 + Lang/Phix/Long-multiplication | 1 + Lang/Phix/Longest-string-challenge | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/Phix/Loops-Break | 1 + Lang/Phix/Loops-Continue | 1 + Lang/Phix/Loops-Do-while | 1 + Lang/Phix/Loops-Downward-for | 1 + Lang/Phix/Loops-For | 1 + Lang/Phix/Loops-For-with-a-specified-step | 1 + Lang/Phix/Loops-Foreach | 1 + Lang/Phix/Loops-Infinite | 1 + Lang/Phix/Loops-N-plus-one-half | 1 + Lang/Phix/Loops-Nested | 1 + Lang/Phix/Loops-While | 1 + Lang/Phix/Luhn-test-of-credit-card-numbers | 1 + Lang/Phix/MD5-Implementation | 1 + Lang/Phix/Machine-code | 1 + Lang/Phix/Mandelbrot-set | 1 + Lang/Phix/Map-range | 1 + Lang/Phix/Matrix-multiplication | 1 + Lang/Phix/Matrix-transposition | 1 + Lang/Phix/Memory-allocation | 1 + Lang/Phix/Menu | 1 + Lang/Phix/Monty-Hall-problem | 1 + Lang/Phix/Morse-code | 1 + Lang/Phix/Multiplication-tables | 1 + Lang/Phix/Mutual-recursion | 1 + Lang/Phix/Named-parameters | 1 + Lang/Phix/Non-decimal-radices-Convert | 1 + Lang/Phix/Non-decimal-radices-Input | 1 + Lang/Phix/Non-decimal-radices-Output | 1 + Lang/Phix/Null-object | 1 + Lang/Phix/Number-names | 1 + Lang/Phix/Number-reversal-game | 1 + Lang/Phix/Numerical-integration | 1 + Lang/Phix/Old-lady-swallowed-a-fly | 1 + Lang/Phix/One-dimensional-cellular-automata | 1 + Lang/Phix/One-of-n-lines-in-a-file | 1 + Lang/Phix/OpenGL | 1 + Lang/Phix/Optional-parameters | 1 + Lang/Phix/Order-disjoint-list-items | 1 + Lang/Phix/Ordered-words | 1 + Lang/Phix/Palindrome-detection | 1 + Lang/Phix/Parsing-RPN-calculator-algorithm | 1 + Lang/Phix/Parsing-RPN-to-infix-conversion | 1 + Lang/Phix/Parsing-Shunting-yard-algorithm | 1 + Lang/Phix/Pascals-triangle | 1 + Lang/Phix/Perfect-numbers | 1 + Lang/Phix/Permutations | 1 + Lang/Phix/Phrase-reversals | 1 + Lang/Phix/Pi | 1 + Lang/Phix/Pick-random-element | 1 + Lang/Phix/Polymorphism | 1 + Lang/Phix/Price-fraction | 1 + Lang/Phix/Primality-by-trial-division | 1 + Lang/Phix/Probabilistic-choice | 1 + Lang/Phix/Program-name | 1 + Lang/Phix/Program-termination | 1 + Lang/Phix/Pythagorean-triples | 1 + Lang/Phix/Quaternion-type | 1 + Lang/Phix/Queue-Definition | 1 + Lang/Phix/Queue-Usage | 1 + Lang/Phix/Quickselect-algorithm | 1 + Lang/Phix/Quine | 1 + Lang/Phix/README | 1 + Lang/Phix/Random-numbers | 1 + Lang/Phix/Range-extraction | 1 + Lang/Phix/Ray-casting-algorithm | 1 + Lang/Phix/Read-a-file-line-by-line | 1 + Lang/Phix/Read-entire-file | 1 + Lang/Phix/Real-constants-and-functions | 1 + Lang/Phix/Reduced-row-echelon-form | 1 + Lang/Phix/Remove-duplicate-elements | 1 + Lang/Phix/Repeat-a-string | 1 + Lang/Phix/Return-multiple-values | 1 + Lang/Phix/Reverse-a-string | 1 + Lang/Phix/Reverse-words-in-a-string | 1 + Lang/Phix/Rock-paper-scissors | 1 + Lang/Phix/Roman-numerals-Decode | 1 + Lang/Phix/Roman-numerals-Encode | 1 + Lang/Phix/Rot-13 | 1 + Lang/Phix/Run-length-encoding | 1 + Lang/Phix/S-Expressions | 1 + Lang/Phix/SEDOLs | 1 + Lang/Phix/SHA-256 | 1 + Lang/Phix/Safe-addition | 1 + Lang/Phix/Search-a-list | 1 + Lang/Phix/Self-describing-numbers | 1 + Lang/Phix/Semordnilap | 1 + Lang/Phix/Sequence-of-non-squares | 1 + Lang/Phix/Short-circuit-evaluation | 1 + Lang/Phix/Sierpinski-carpet | 1 + Lang/Phix/Sierpinski-triangle | 1 + Lang/Phix/Sieve-of-Eratosthenes | 1 + Lang/Phix/Simple-database | 1 + Lang/Phix/Simple-windowed-application | 1 + Lang/Phix/Sleep | 1 + Lang/Phix/Solve-a-Hidato-puzzle | 1 + Lang/Phix/Solve-a-Holy-Knights-tour | 1 + Lang/Phix/Solve-a-Hopido-puzzle | 1 + Lang/Phix/Solve-a-Numbrix-puzzle | 1 + Lang/Phix/Solve-the-no-connection-puzzle | 1 + .../Sort-an-array-of-composite-structures | 1 + Lang/Phix/Sort-an-integer-array | 1 + Lang/Phix/Sort-disjoint-sublist | 1 + Lang/Phix/Sort-using-a-custom-comparator | 1 + Lang/Phix/Sorting-algorithms-Bead-sort | 1 + Lang/Phix/Sorting-algorithms-Bogosort | 1 + Lang/Phix/Sorting-algorithms-Bubble-sort | 1 + Lang/Phix/Sorting-algorithms-Cocktail-sort | 1 + Lang/Phix/Sorting-algorithms-Comb-sort | 1 + Lang/Phix/Sorting-algorithms-Counting-sort | 1 + Lang/Phix/Sorting-algorithms-Gnome-sort | 1 + Lang/Phix/Sorting-algorithms-Heapsort | 1 + Lang/Phix/Sorting-algorithms-Insertion-sort | 1 + Lang/Phix/Sorting-algorithms-Merge-sort | 1 + Lang/Phix/Sorting-algorithms-Pancake-sort | 1 + Lang/Phix/Sorting-algorithms-Permutation-sort | 1 + Lang/Phix/Sorting-algorithms-Quicksort | 1 + Lang/Phix/Sorting-algorithms-Radix-sort | 1 + Lang/Phix/Sorting-algorithms-Selection-sort | 1 + Lang/Phix/Sorting-algorithms-Shell-sort | 1 + Lang/Phix/Sorting-algorithms-Sleep-sort | 1 + Lang/Phix/Sorting-algorithms-Stooge-sort | 1 + Lang/Phix/Sorting-algorithms-Strand-sort | 1 + Lang/Phix/Spiral-matrix | 1 + Lang/Phix/Stack | 1 + Lang/Phix/Stair-climbing-puzzle | 1 + Lang/Phix/Start-from-a-main-routine | 1 + Lang/Phix/Stem-and-leaf-plot | 1 + Lang/Phix/String-append | 1 + Lang/Phix/String-case | 1 + Lang/Phix/String-comparison | 1 + Lang/Phix/String-concatenation | 1 + Lang/Phix/String-interpolation--included- | 1 + Lang/Phix/String-length | 1 + Lang/Phix/String-matching | 1 + Lang/Phix/String-prepend | 1 + .../Strip-a-set-of-characters-from-a-string | 1 + Lang/Phix/Strip-block-comments | 1 + Lang/Phix/Strip-comments-from-a-string | 1 + ...trip-whitespace-from-a-string-Top-and-tail | 1 + Lang/Phix/Substring | 1 + Lang/Phix/Substring-Top-and-tail | 1 + Lang/Phix/Sudoku | 1 + Lang/Phix/Sum-and-product-of-an-array | 1 + Lang/Phix/Sum-digits-of-an-integer | 1 + Lang/Phix/Sum-of-a-series | 1 + Lang/Phix/Sum-of-squares | 1 + Lang/Phix/Synchronous-concurrency | 1 + Lang/Phix/System-time | 1 + Lang/Phix/Take-notes-on-the-command-line | 1 + Lang/Phix/Temperature-conversion | 1 + Lang/Phix/Terminal-control-Clear-the-screen | 1 + Lang/Phix/Terminal-control-Cursor-positioning | 1 + Lang/Phix/Terminal-control-Dimensions | 1 + ...inal-control-Display-an-extended-character | 1 + Lang/Phix/Terminal-control-Hiding-the-cursor | 1 + Lang/Phix/Ternary-logic | 1 + Lang/Phix/Text-processing-Max-licenses-in-use | 1 + Lang/Phix/Tic-tac-toe | 1 + Lang/Phix/Time-a-function | 1 + Lang/Phix/Tokenize-a-string | 1 + Lang/Phix/Topswops | 1 + Lang/Phix/Tree-traversal | 1 + Lang/Phix/Trigonometric-functions | 1 + Lang/Phix/Twelve-statements | 1 + Lang/Phix/Unbias-a-random-generator | 1 + Lang/Phix/Undefined-values | 1 + Lang/Phix/Unicode-variable-names | 1 + .../Use-another-language-to-call-a-function | 1 + Lang/Phix/User-input-Graphical | 1 + Lang/Phix/User-input-Text | 1 + Lang/Phix/Van-der-Corput-sequence | 1 + Lang/Phix/Variable-length-quantity | 1 + Lang/Phix/Variables | 1 + Lang/Phix/Variadic-function | 1 + Lang/Phix/Vector-products | 1 + Lang/Phix/Visualize-a-tree | 1 + Lang/Phix/Walk-a-directory-Non-recursively | 1 + Lang/Phix/Walk-a-directory-Recursively | 1 + Lang/Phix/Window-creation | 1 + Lang/Phix/Window-management | 1 + Lang/Phix/Write-float-arrays-to-a-text-file | 1 + Lang/Phix/Write-language-name-in-3D-ASCII | 1 + Lang/Phix/XML-Output | 1 + Lang/Phix/Zebra-puzzle | 1 + Lang/Phix/Zero-to-the-zero-power | 1 + Lang/Phix/Zhang-Suen-thinning-algorithm | 1 + Lang/Phix/Zig-zag-matrix | 1 + Lang/Picat/00DESCRIPTION | 1 + Lang/Picat/Function-definition | 1 + Lang/Picat/README | 1 + Lang/Pict/00DESCRIPTION | 1 + Lang/Pict/Hello-world-Newline-omission | 1 + Lang/Pict/Hello-world-Text | 1 + Lang/Pict/README | 1 + Lang/Pony/00DESCRIPTION | 13 + Lang/Pony/Arrays | 1 + Lang/Pony/Evolutionary-algorithm | 1 + Lang/Pony/FizzBuzz | 1 + Lang/Pony/Hello-world-Text | 1 + Lang/Pony/README | 1 + Lang/Pony/Variables | 1 + Lang/Potion/00DESCRIPTION | 21 + Lang/Potion/100-doors | 1 + Lang/Potion/24-game | 1 + Lang/Potion/A+B | 1 + Lang/Potion/Ackermann-function | 1 + Lang/Potion/Almost-prime | 1 + Lang/Potion/Arithmetic-geometric-mean | 1 + Lang/Potion/Associative-array-Creation | 1 + Lang/Potion/Associative-array-Iteration | 1 + Lang/Potion/Digital-root | 1 + Lang/Potion/Execute-Brain---- | 1 + Lang/Potion/Fibonacci-sequence | 1 + Lang/Potion/FizzBuzz | 1 + Lang/Potion/Greatest-subsequential-sum | 1 + Lang/Potion/Happy-numbers | 1 + Lang/Potion/Hello-world-Text | 1 + .../Horners-rule-for-polynomial-evaluation | 1 + Lang/Potion/Palindrome-detection | 1 + Lang/Potion/Pascals-triangle | 1 + Lang/Potion/README | 1 + Lang/Potion/S-Expressions | 1 + Lang/Potion/SEDOLs | 1 + Lang/Potion/Sort-an-integer-array | 1 + Lang/Potion/String-case | 1 + Lang/Potion/String-length | 1 + Lang/Potion/Sum-of-a-series | 1 + Lang/Potion/Topswops | 1 + Lang/Powerbuilder/00DESCRIPTION | 3 + Lang/Powerbuilder/Averages-Root-mean-square | 1 + Lang/Powerbuilder/Ethiopian-multiplication | 1 + Lang/Powerbuilder/README | 1 + Lang/Powerbuilder/String-case | 1 + Lang/Pyret/00DESCRIPTION | 10 + Lang/Pyret/100-doors | 1 + Lang/Pyret/Combinations | 1 + Lang/Pyret/FizzBuzz | 1 + Lang/Pyret/README | 1 + Lang/RPGIV/00DESCRIPTION | 1 + Lang/RPGIV/Detect-division-by-zero | 1 + Lang/RPGIV/README | 1 + Lang/RPL/00DESCRIPTION | 19 + Lang/RPL/Guess-the-number | 1 + Lang/RPL/Lucas-Lehmer-test | 1 + Lang/RPL/README | 1 + Lang/Ra/00DESCRIPTION | 19 + Lang/Ra/99-Bottles-of-Beer | 1 + Lang/Ra/A+B | 1 + Lang/Ra/Fibonacci-sequence | 1 + Lang/Ra/Hello-world-Newbie | 1 + Lang/Ra/Hello-world-Newline-omission | 1 + Lang/Ra/Hello-world-Standard-error | 1 + Lang/Ra/Hello-world-Text | 1 + Lang/Ra/README | 1 + Lang/Ra/Sorting-algorithms-Bubble-sort | 1 + Lang/Ra/Sorting-algorithms-Selection-sort | 1 + Lang/Rapira/00DESCRIPTION | 3 + Lang/Rapira/Factorial | 1 + Lang/Rapira/README | 1 + Lang/Red/00DESCRIPTION | 12 + Lang/Red/100-doors | 1 + Lang/Red/99-Bottles-of-Beer | 1 + Lang/Red/A+B | 1 + Lang/Red/Abstract-type | 1 + ...-a-variable-to-a-class-instance-at-runtime | 1 + Lang/Red/Align-columns | 1 + Lang/Red/Flatten-a-list | 1 + Lang/Red/Hello-world-Newline-omission | 1 + Lang/Red/README | 1 + Lang/Red/Roman-numerals-Decode | 1 + Lang/Red/Roman-numerals-Encode | 1 + Lang/Reduce/00DESCRIPTION | 8 + Lang/Reduce/README | 1 + Lang/Ring/00DESCRIPTION | 17 + Lang/Ring/100-doors | 1 + Lang/Ring/99-Bottles-of-Beer | 1 + Lang/Ring/A+B | 1 + Lang/Ring/ABC-Problem | 1 + ...ficient-and-perfect-number-classifications | 1 + Lang/Ring/Accumulator-factory | 1 + Lang/Ring/Ackermann-function | 1 + Lang/Ring/Active-Directory-Connect | 1 + ...-a-variable-to-a-class-instance-at-runtime | 1 + Lang/Ring/Almost-prime | 1 + Lang/Ring/Amicable-pairs | 1 + Lang/Ring/Apply-a-callback-to-an-array | 1 + Lang/Ring/Arithmetic-Integer | 1 + Lang/Ring/Arithmetic-geometric-mean | 1 + Lang/Ring/Array-concatenation | 1 + Lang/Ring/Arrays | 1 + Lang/Ring/Assertions | 1 + Lang/Ring/Averages-Arithmetic-mean | 1 + Lang/Ring/Averages-Median | 1 + Lang/Ring/Averages-Pythagorean-means | 1 + Lang/Ring/Averages-Root-mean-square | 1 + Lang/Ring/Averages-Simple-moving-average | 1 + Lang/Ring/Balanced-brackets | 1 + Lang/Ring/Binary-digits | 1 + Lang/Ring/Binary-search | 1 + Lang/Ring/Binary-strings | 1 + Lang/Ring/Bitmap-Bresenhams-line-algorithm | 1 + Lang/Ring/Bitwise-operations | 1 + Lang/Ring/Boolean-values | 1 + Lang/Ring/Call-a-function | 1 + Lang/Ring/Call-an-object-method | 1 + Lang/Ring/Case-sensitivity-of-identifiers | 1 + Lang/Ring/Catalan-numbers | 1 + Lang/Ring/Catalan-numbers-Pascals-triangle | 1 + Lang/Ring/Catamorphism | 1 + Lang/Ring/Character-codes | 1 + Lang/Ring/Check-that-file-exists | 1 + Lang/Ring/Classes | 1 + Lang/Ring/Closest-pair-problem | 1 + Lang/Ring/Closures-Value-capture | 1 + Lang/Ring/Color-of-a-screen-pixel | 1 + Lang/Ring/Colour-bars-Display | 1 + Lang/Ring/Command-line-arguments | 1 + Lang/Ring/Comments | 1 + Lang/Ring/Compile-time-calculation | 1 + Lang/Ring/Compound-data-type | 1 + Lang/Ring/Conditional-structures | 1 + .../Constrained-random-points-on-a-circle | 1 + Lang/Ring/Copy-a-string | 1 + Lang/Ring/Count-in-factors | 1 + Lang/Ring/Count-in-octal | 1 + Lang/Ring/Count-occurrences-of-a-substring | 1 + Lang/Ring/Create-a-file | 1 + .../Create-a-two-dimensional-array-at-runtime | 1 + Lang/Ring/Date-format | 1 + Lang/Ring/Day-of-the-week | 1 + Lang/Ring/Delete-a-file | 1 + Lang/Ring/Detect-division-by-zero | 1 + Lang/Ring/Determine-if-a-string-is-numeric | 1 + Lang/Ring/Digital-root | 1 + Lang/Ring/Dinesmans-multiple-dwelling-problem | 1 + Lang/Ring/Documentation | 1 + Lang/Ring/Dot-product | 1 + Lang/Ring/Dynamic-variable-names | 1 + Lang/Ring/Empty-directory | 1 + Lang/Ring/Empty-program | 1 + Lang/Ring/Empty-string | 1 + Lang/Ring/Enumerations | 1 + Lang/Ring/Environment-variables | 1 + Lang/Ring/Equilibrium-index | 1 + Lang/Ring/Ethiopian-multiplication | 1 + Lang/Ring/Euler-method | 1 + Lang/Ring/Evaluate-binomial-coefficients | 1 + Lang/Ring/Even-or-odd | 1 + Lang/Ring/Exceptions | 1 + Lang/Ring/Execute-a-system-command | 1 + Lang/Ring/Exponentiation-operator | 1 + Lang/Ring/Extensible-prime-generator | 1 + Lang/Ring/Factorial | 1 + Lang/Ring/Factors-of-an-integer | 1 + Lang/Ring/Fibonacci-sequence | 1 + Lang/Ring/File-input-output | 1 + Lang/Ring/File-size | 1 + Lang/Ring/Filter | 1 + Lang/Ring/Find-limit-of-recursion | 1 + Lang/Ring/Find-the-last-Sunday-of-each-month | 1 + Lang/Ring/Find-the-missing-permutation | 1 + Lang/Ring/Five-weekends | 1 + Lang/Ring/FizzBuzz | 1 + Lang/Ring/Flatten-a-list | 1 + Lang/Ring/Flow-control-structures | 1 + Lang/Ring/Floyds-triangle | 1 + Lang/Ring/Formatted-numeric-output | 1 + Lang/Ring/Fractal-tree | 1 + Lang/Ring/Function-definition | 1 + Lang/Ring/GUI-Maximum-window-dimensions | 1 + Lang/Ring/GUI-component-interaction | 1 + Lang/Ring/GUI-enabling-disabling-of-controls | 1 + Lang/Ring/Gamma-function | 1 + Lang/Ring/Generate-lower-case-ASCII-alphabet | 1 + Lang/Ring/Generic-swap | 1 + .../Globally-replace-text-in-several-files | 1 + Lang/Ring/Greatest-common-divisor | 1 + Lang/Ring/Greatest-element-of-a-list | 1 + Lang/Ring/Guess-the-number | 1 + Lang/Ring/Guess-the-number-With-feedback | 1 + .../Guess-the-number-With-feedback--player- | 1 + Lang/Ring/HTTP | 1 + Lang/Ring/HTTPS | 1 + Lang/Ring/Hailstone-sequence | 1 + Lang/Ring/Hamming-numbers | 1 + Lang/Ring/Happy-numbers | 1 + Lang/Ring/Harshad-or-Niven-series | 1 + Lang/Ring/Hash-join | 1 + Lang/Ring/Haversine-formula | 1 + Lang/Ring/Hello-world-Graphical | 1 + Lang/Ring/Hello-world-Line-printer | 1 + Lang/Ring/Hello-world-Newbie | 1 + Lang/Ring/Hello-world-Newline-omission | 1 + Lang/Ring/Hello-world-Standard-error | 1 + Lang/Ring/Hello-world-Text | 1 + Lang/Ring/Hello-world-Web-server | 1 + Lang/Ring/Here-document | 1 + Lang/Ring/Heronian-triangles | 1 + Lang/Ring/Hickerson-series-of-almost-integers | 1 + Lang/Ring/Hofstadter-Conway-$10,000-sequence | 1 + Lang/Ring/Hofstadter-Q-sequence | 1 + .../Horners-rule-for-polynomial-evaluation | 1 + Lang/Ring/Identity-matrix | 1 + Lang/Ring/Include-a-file | 1 + Lang/Ring/Increment-a-numerical-string | 1 + Lang/Ring/Inheritance-Single | 1 + Lang/Ring/Input-loop | 1 + Lang/Ring/Integer-comparison | 1 + Lang/Ring/Integer-sequence | 1 + Lang/Ring/Interactive-programming | 1 + Lang/Ring/Iterated-digits-squaring | 1 + Lang/Ring/Kaprekar-numbers | 1 + Lang/Ring/Keyboard-input-Keypress-check | 1 + .../Keyboard-input-Obtain-a-Y-or-N-response | 1 + Lang/Ring/Knuth-shuffle | 1 + Lang/Ring/Langtons-ant | 1 + Lang/Ring/Largest-int-from-concatenated-ints | 1 + Lang/Ring/Last-Friday-of-each-month | 1 + Lang/Ring/Leap-year | 1 + Lang/Ring/Least-common-multiple | 1 + Lang/Ring/Left-factorials | 1 + Lang/Ring/Letter-frequency | 1 + Lang/Ring/List-comprehensions | 1 + Lang/Ring/Literals-String | 1 + Lang/Ring/Logical-operations | 1 + Lang/Ring/Longest-common-subsequence | 1 + Lang/Ring/Look-and-say-sequence | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/Ring/Loops-Break | 1 + Lang/Ring/Loops-Continue | 1 + Lang/Ring/Loops-Do-while | 1 + Lang/Ring/Loops-Downward-for | 1 + Lang/Ring/Loops-For | 1 + Lang/Ring/Loops-For-with-a-specified-step | 1 + Lang/Ring/Loops-Foreach | 1 + Lang/Ring/Loops-Infinite | 1 + Lang/Ring/Loops-N-plus-one-half | 1 + Lang/Ring/Loops-Nested | 1 + Lang/Ring/Loops-While | 1 + Lang/Ring/Lucas-Lehmer-test | 1 + Lang/Ring/Luhn-test-of-credit-card-numbers | 1 + Lang/Ring/MD5 | 1 + Lang/Ring/Mad-Libs | 1 + Lang/Ring/Magic-squares-of-odd-order | 1 + Lang/Ring/Make-directory-path | 1 + Lang/Ring/Mandelbrot-set | 1 + Lang/Ring/Matrix-multiplication | 1 + Lang/Ring/Matrix-transposition | 1 + Lang/Ring/Memory-allocation | 1 + Lang/Ring/Menu | 1 + Lang/Ring/Metaprogramming | 1 + Lang/Ring/Middle-three-digits | 1 + Lang/Ring/Modular-inverse | 1 + Lang/Ring/Monte-Carlo-methods | 1 + Lang/Ring/Mouse-position | 1 + Lang/Ring/Multifactorial | 1 + Lang/Ring/Multiplication-tables | 1 + Lang/Ring/Mutual-recursion | 1 + Lang/Ring/Narcissistic-decimal-number | 1 + Lang/Ring/Non-decimal-radices-Input | 1 + Lang/Ring/Nth | 1 + Lang/Ring/Nth-root | 1 + Lang/Ring/Null-object | 1 + Lang/Ring/Number-names | 1 + Lang/Ring/One-of-n-lines-in-a-file | 1 + Lang/Ring/Operator-precedence | 1 + Lang/Ring/Order-two-numerical-lists | 1 + Lang/Ring/Ordered-words | 1 + Lang/Ring/Palindrome-detection | 1 + Lang/Ring/Pangram-checker | 1 + Lang/Ring/Pascals-triangle | 1 + Lang/Ring/Perfect-numbers | 1 + Lang/Ring/Permutations | 1 + Lang/Ring/Phrase-reversals | 1 + Lang/Ring/Pick-random-element | 1 + Lang/Ring/Play-recorded-sounds | 1 + Lang/Ring/Playing-cards | 1 + Lang/Ring/Price-fraction | 1 + Lang/Ring/Primality-by-trial-division | 1 + Lang/Ring/Prime-decomposition | 1 + Lang/Ring/Program-name | 1 + Lang/Ring/Program-termination | 1 + Lang/Ring/Pythagorean-triples | 1 + Lang/Ring/Quickselect-algorithm | 1 + Lang/Ring/Quine | 1 + Lang/Ring/README | 1 + Lang/Ring/Random-number-generator--device- | 1 + Lang/Ring/Random-number-generator--included- | 1 + Lang/Ring/Random-numbers | 1 + Lang/Ring/Read-a-file-line-by-line | 1 + Lang/Ring/Read-a-specific-line-from-a-file | 1 + Lang/Ring/Read-entire-file | 1 + Lang/Ring/Real-constants-and-functions | 1 + Lang/Ring/Remove-duplicate-elements | 1 + Lang/Ring/Remove-lines-from-a-file | 1 + Lang/Ring/Rename-a-file | 1 + Lang/Ring/Repeat-a-string | 1 + Lang/Ring/Return-multiple-values | 1 + Lang/Ring/Reverse-a-string | 1 + Lang/Ring/Reverse-words-in-a-string | 1 + Lang/Ring/Roman-numerals-Decode | 1 + Lang/Ring/Roman-numerals-Encode | 1 + Lang/Ring/Roots-of-a-function | 1 + Lang/Ring/Roots-of-a-quadratic-function | 1 + Lang/Ring/Roots-of-unity | 1 + Lang/Ring/Rot-13 | 1 + Lang/Ring/Runge-Kutta-method | 1 + Lang/Ring/Runtime-evaluation | 1 + .../Ring/Runtime-evaluation-In-an-environment | 1 + Lang/Ring/SEDOLs | 1 + Lang/Ring/Search-a-list | 1 + Lang/Ring/Semiprime | 1 + Lang/Ring/Semordnilap | 1 + Lang/Ring/Send-email | 1 + Lang/Ring/Sequence-of-non-squares | 1 + .../Ring/Sequence-of-primes-by-Trial-Division | 1 + Lang/Ring/Shell-one-liner | 1 + Lang/Ring/Show-the-epoch | 1 + Lang/Ring/Sierpinski-carpet | 1 + Lang/Ring/Sierpinski-triangle-Graphical | 1 + Lang/Ring/Sieve-of-Eratosthenes | 1 + Lang/Ring/Simple-windowed-application | 1 + Lang/Ring/Sleep | 1 + Lang/Ring/Sockets | 1 + Lang/Ring/Sort-an-integer-array | 1 + Lang/Ring/Sort-stability | 1 + Lang/Ring/Sorting-algorithms-Bubble-sort | 1 + Lang/Ring/Sorting-algorithms-Cocktail-sort | 1 + Lang/Ring/Sorting-algorithms-Comb-sort | 1 + Lang/Ring/Sorting-algorithms-Counting-sort | 1 + Lang/Ring/Sorting-algorithms-Gnome-sort | 1 + Lang/Ring/Sorting-algorithms-Insertion-sort | 1 + Lang/Ring/Sorting-algorithms-Pancake-sort | 1 + Lang/Ring/Sorting-algorithms-Selection-sort | 1 + Lang/Ring/Sorting-algorithms-Shell-sort | 1 + Lang/Ring/Sorting-algorithms-Stooge-sort | 1 + Lang/Ring/Stair-climbing-puzzle | 1 + Lang/Ring/String-append | 1 + Lang/Ring/String-case | 1 + Lang/Ring/String-comparison | 1 + Lang/Ring/String-concatenation | 1 + Lang/Ring/String-interpolation--included- | 1 + Lang/Ring/String-length | 1 + Lang/Ring/String-matching | 1 + Lang/Ring/String-prepend | 1 + .../Strip-a-set-of-characters-from-a-string | 1 + Lang/Ring/Strip-block-comments | 1 + Lang/Ring/Strip-comments-from-a-string | 1 + ...odes-and-extended-characters-from-a-string | 1 + ...trip-whitespace-from-a-string-Top-and-tail | 1 + Lang/Ring/Substring | 1 + Lang/Ring/Substring-Top-and-tail | 1 + Lang/Ring/Sum-and-product-of-an-array | 1 + Lang/Ring/Sum-digits-of-an-integer | 1 + Lang/Ring/Sum-multiples-of-3-and-5 | 1 + Lang/Ring/Sum-of-a-series | 1 + Lang/Ring/Sum-of-squares | 1 + Lang/Ring/Symmetric-difference | 1 + Lang/Ring/System-time | 1 + Lang/Ring/Temperature-conversion | 1 + Lang/Ring/Terminal-control-Clear-the-screen | 1 + Lang/Ring/Terminal-control-Dimensions | 1 + Lang/Ring/Terminal-control-Inverse-video | 1 + ...Terminal-control-Ringing-the-terminal-bell | 1 + Lang/Ring/Test-a-function | 1 + Lang/Ring/Tic-tac-toe | 1 + Lang/Ring/Time-a-function | 1 + Lang/Ring/Tokenize-a-string | 1 + Lang/Ring/Towers-of-Hanoi | 1 + Lang/Ring/Trabb-Pardo-Knuth-algorithm | 1 + Lang/Ring/Trigonometric-functions | 1 + Lang/Ring/Truncate-a-file | 1 + Lang/Ring/Unbias-a-random-generator | 1 + Lang/Ring/User-input-Graphical | 1 + Lang/Ring/User-input-Text | 1 + Lang/Ring/Van-der-Corput-sequence | 1 + Lang/Ring/Variable-size-Get | 1 + Lang/Ring/Variables | 1 + Lang/Ring/Walk-a-directory-Recursively | 1 + Lang/Ring/Window-creation | 1 + Lang/Ring/Window-management | 1 + Lang/Ring/Zero-to-the-zero-power | 1 + Lang/Robotic/00DESCRIPTION | 6 + Lang/Robotic/Hello-world-Newbie | 1 + Lang/Robotic/README | 1 + Lang/Rubylog/00DESCRIPTION | 4 + Lang/Rubylog/README | 1 + Lang/SPAD/00DESCRIPTION | 11 + Lang/SPAD/A+B | 1 + Lang/SPAD/ABC-Problem | 1 + Lang/SPAD/Ackermann-function | 1 + Lang/SPAD/Bernoulli-numbers | 1 + Lang/SPAD/Combinations | 1 + Lang/SPAD/Matrix-arithmetic | 1 + Lang/SPAD/Matrix-exponentiation-operator | 1 + Lang/SPAD/Matrix-multiplication | 1 + Lang/SPAD/Matrix-transposition | 1 + Lang/SPAD/Monty-Hall-problem | 1 + Lang/SPAD/Prime-decomposition | 1 + Lang/SPAD/README | 1 + Lang/SSEM/00DESCRIPTION | 35 + Lang/SSEM/A+B | 1 + Lang/SSEM/Arithmetic-Integer | 1 + Lang/SSEM/Arrays | 1 + Lang/SSEM/Caesar-cipher | 1 + Lang/SSEM/Call-a-function | 1 + Lang/SSEM/Comments | 1 + Lang/SSEM/Conditional-structures | 1 + Lang/SSEM/Empty-program | 1 + Lang/SSEM/Even-or-odd | 1 + Lang/SSEM/Factorial | 1 + Lang/SSEM/Fibonacci-sequence | 1 + Lang/SSEM/Flow-control-structures | 1 + Lang/SSEM/Function-definition | 1 + Lang/SSEM/Hello-world-Graphical | 1 + Lang/SSEM/Integer-comparison | 1 + Lang/SSEM/Integer-sequence | 1 + Lang/SSEM/Jump-anywhere | 1 + Lang/SSEM/Loops-Downward-for | 1 + Lang/SSEM/Loops-For-with-a-specified-step | 1 + Lang/SSEM/Program-termination | 1 + Lang/SSEM/README | 1 + .../Singly-linked-list-Element-definition | 1 + Lang/SSEM/Singly-linked-list-Traversal | 1 + Lang/SequenceL/00DESCRIPTION | 16 + Lang/SequenceL/100-doors | 1 + Lang/SequenceL/99-Bottles-of-Beer | 1 + Lang/SequenceL/A+B | 1 + Lang/SequenceL/ABC-Problem | 1 + Lang/SequenceL/Almost-prime | 1 + Lang/SequenceL/Animate-a-pendulum | 1 + Lang/SequenceL/Binary-digits | 1 + Lang/SequenceL/Binary-search | 1 + Lang/SequenceL/Bitmap | 1 + Lang/SequenceL/Caesar-cipher | 1 + Lang/SequenceL/Character-codes | 1 + Lang/SequenceL/Conways-Game-of-Life | 1 + Lang/SequenceL/Dragon-curve | 1 + Lang/SequenceL/Euler-method | 1 + Lang/SequenceL/Even-or-odd | 1 + Lang/SequenceL/Evolutionary-algorithm | 1 + Lang/SequenceL/Factorial | 1 + Lang/SequenceL/Factors-of-an-integer | 1 + Lang/SequenceL/Fast-Fourier-transform | 1 + Lang/SequenceL/Fibonacci-sequence | 1 + Lang/SequenceL/Filter | 1 + Lang/SequenceL/FizzBuzz | 1 + Lang/SequenceL/Greatest-common-divisor | 1 + Lang/SequenceL/Happy-numbers | 1 + Lang/SequenceL/Here-document | 1 + Lang/SequenceL/Hough-transform | 1 + Lang/SequenceL/Mandelbrot-set | 1 + Lang/SequenceL/Matrix-multiplication | 1 + Lang/SequenceL/Number-names | 1 + Lang/SequenceL/Numerical-integration | 1 + Lang/SequenceL/Palindrome-detection | 1 + Lang/SequenceL/Parallel-calculations | 1 + Lang/SequenceL/Prime-decomposition | 1 + Lang/SequenceL/README | 1 + Lang/SequenceL/Reverse-a-string | 1 + Lang/SequenceL/Universal-Turing-machine | 1 + Lang/Set-lang/00DESCRIPTION | 10 + Lang/Set-lang/99-Bottles-of-Beer | 1 + Lang/Set-lang/Comments | 1 + Lang/Set-lang/Death-Star | 1 + Lang/Set-lang/Empty-program | 1 + Lang/Set-lang/Hello-world-Text | 1 + Lang/Set-lang/Nth | 1 + Lang/Set-lang/README | 1 + Lang/Set-lang/Variables | 1 + Lang/Shen/00DESCRIPTION | 4 + Lang/Shen/Ackermann-function | 1 + Lang/Shen/Compound-data-type | 1 + Lang/Shen/Conways-Game-of-Life | 1 + Lang/Shen/Extend-your-language | 1 + Lang/Shen/Factorial | 1 + Lang/Shen/Fibonacci-sequence | 1 + Lang/Shen/FizzBuzz | 1 + Lang/Shen/Hello-world-Text | 1 + Lang/Shen/Metaprogramming | 1 + Lang/Shen/README | 1 + Lang/Sidef/00DESCRIPTION | 25 + Lang/Sidef/100-doors | 1 + Lang/Sidef/24-game | 1 + Lang/Sidef/24-game-Solve | 1 + Lang/Sidef/9-billion-names-of-God-the-integer | 1 + Lang/Sidef/99-Bottles-of-Beer | 1 + Lang/Sidef/A+B | 1 + Lang/Sidef/ABC-Problem | 1 + Lang/Sidef/AKS-test-for-primes | 1 + Lang/Sidef/Abstract-type | 1 + ...ficient-and-perfect-number-classifications | 1 + Lang/Sidef/Accumulator-factory | 1 + Lang/Sidef/Ackermann-function | 1 + ...-a-variable-to-a-class-instance-at-runtime | 1 + Lang/Sidef/Address-of-a-variable | 1 + Lang/Sidef/Align-columns | 1 + Lang/Sidef/Almost-prime | 1 + Lang/Sidef/Amicable-pairs | 1 + Lang/Sidef/Anagrams | 1 + Lang/Sidef/Anagrams-Deranged-anagrams | 1 + Lang/Sidef/Animate-a-pendulum | 1 + Lang/Sidef/Anonymous-recursion | 1 + .../Append-a-record-to-the-end-of-a-text-file | 1 + Lang/Sidef/Apply-a-callback-to-an-array | 1 + .../Arbitrary-precision-integers--included- | 1 + Lang/Sidef/Arithmetic-Complex | 1 + Lang/Sidef/Arithmetic-Integer | 1 + Lang/Sidef/Arithmetic-evaluation | 1 + Lang/Sidef/Arithmetic-geometric-mean | 1 + .../Arithmetic-geometric-mean-Calculate-Pi | 1 + Lang/Sidef/Array-concatenation | 1 + Lang/Sidef/Arrays | 1 + Lang/Sidef/Assertions | 1 + Lang/Sidef/Associative-array-Creation | 1 + Lang/Sidef/Associative-array-Iteration | 1 + Lang/Sidef/Averages-Arithmetic-mean | 1 + Lang/Sidef/Averages-Mean-angle | 1 + Lang/Sidef/Averages-Mean-time-of-day | 1 + Lang/Sidef/Averages-Median | 1 + Lang/Sidef/Averages-Mode | 1 + Lang/Sidef/Averages-Pythagorean-means | 1 + Lang/Sidef/Averages-Root-mean-square | 1 + Lang/Sidef/Averages-Simple-moving-average | 1 + Lang/Sidef/Balanced-brackets | 1 + Lang/Sidef/Benfords-law | 1 + Lang/Sidef/Bernoulli-numbers | 1 + Lang/Sidef/Best-shuffle | 1 + Lang/Sidef/Binary-digits | 1 + Lang/Sidef/Binary-search | 1 + Lang/Sidef/Bitmap-Bresenhams-line-algorithm | 1 + Lang/Sidef/Bitmap-Write-a-PPM-file | 1 + Lang/Sidef/Bitwise-operations | 1 + Lang/Sidef/Boolean-values | 1 + Lang/Sidef/Box-the-compass | 1 + Lang/Sidef/Break-OO-privacy | 1 + Lang/Sidef/Bulls-and-cows | 1 + Lang/Sidef/Bulls-and-cows-Player | 1 + Lang/Sidef/CSV-data-manipulation | 1 + Lang/Sidef/CSV-to-HTML-translation | 1 + Lang/Sidef/Caesar-cipher | 1 + Lang/Sidef/Calendar | 1 + Lang/Sidef/Calendar---for-REAL-programmers | 1 + Lang/Sidef/Call-a-function | 1 + Lang/Sidef/Call-an-object-method | 1 + Lang/Sidef/Carmichael-3-strong-pseudoprimes | 1 + Lang/Sidef/Case-sensitivity-of-identifiers | 1 + Lang/Sidef/Catalan-numbers | 1 + Lang/Sidef/Catalan-numbers-Pascals-triangle | 1 + Lang/Sidef/Catamorphism | 1 + Lang/Sidef/Character-codes | 1 + Lang/Sidef/Check-Machin-like-formulas | 1 + Lang/Sidef/Check-that-file-exists | 1 + Lang/Sidef/Chinese-remainder-theorem | 1 + Lang/Sidef/Cholesky-decomposition | 1 + Lang/Sidef/Classes | 1 + Lang/Sidef/Closest-pair-problem | 1 + Lang/Sidef/Closures-Value-capture | 1 + Lang/Sidef/Collections | 1 + Lang/Sidef/Colour-bars-Display | 1 + Lang/Sidef/Combinations | 1 + Lang/Sidef/Combinations-and-permutations | 1 + Lang/Sidef/Combinations-with-repetitions | 1 + Lang/Sidef/Comma-quibbling | 1 + Lang/Sidef/Command-line-arguments | 1 + Lang/Sidef/Comments | 1 + Lang/Sidef/Compile-time-calculation | 1 + Lang/Sidef/Compound-data-type | 1 + Lang/Sidef/Concurrent-computing | 1 + Lang/Sidef/Constrained-genericity | 1 + .../Constrained-random-points-on-a-circle | 1 + Lang/Sidef/Continued-fraction | 1 + ...-Arithmetic-Construct-from-rational-number | 1 + Lang/Sidef/Convert-decimal-number-to-rational | 1 + Lang/Sidef/Conways-Game-of-Life | 1 + Lang/Sidef/Copy-a-string | 1 + Lang/Sidef/Count-in-factors | 1 + Lang/Sidef/Count-in-octal | 1 + Lang/Sidef/Count-occurrences-of-a-substring | 1 + Lang/Sidef/Count-the-coins | 1 + Lang/Sidef/Create-a-file | 1 + .../Create-a-two-dimensional-array-at-runtime | 1 + Lang/Sidef/Create-an-HTML-table | 1 + Lang/Sidef/Currying | 1 + Lang/Sidef/DNS-query | 1 + Lang/Sidef/Date-format | 1 + Lang/Sidef/Date-manipulation | 1 + Lang/Sidef/Day-of-the-week | 1 + Lang/Sidef/Death-Star | 1 + Lang/Sidef/Deepcopy | 1 + Lang/Sidef/Define-a-primitive-data-type | 1 + Lang/Sidef/Delete-a-file | 1 + Lang/Sidef/Detect-division-by-zero | 1 + Lang/Sidef/Determine-if-a-string-is-numeric | 1 + .../Determine-if-only-one-instance-is-running | 1 + Lang/Sidef/Digital-root | 1 + .../Digital-root-Multiplicative-digital-root | 1 + .../Sidef/Dinesmans-multiple-dwelling-problem | 1 + Lang/Sidef/Discordian-date | 1 + Lang/Sidef/Dot-product | 1 + .../Doubly-linked-list-Element-definition | 1 + Lang/Sidef/Dragon-curve | 1 + Lang/Sidef/Draw-a-clock | 1 + Lang/Sidef/Draw-a-cuboid | 1 + Lang/Sidef/Draw-a-sphere | 1 + Lang/Sidef/Dynamic-variable-names | 1 + Lang/Sidef/Empty-directory | 1 + Lang/Sidef/Empty-program | 1 + Lang/Sidef/Empty-string | 1 + Lang/Sidef/Enforced-immutability | 1 + Lang/Sidef/Entropy | 1 + Lang/Sidef/Enumerations | 1 + Lang/Sidef/Environment-variables | 1 + Lang/Sidef/Equilibrium-index | 1 + Lang/Sidef/Ethiopian-multiplication | 1 + Lang/Sidef/Euler-method | 1 + Lang/Sidef/Evaluate-binomial-coefficients | 1 + Lang/Sidef/Even-or-odd | 1 + Lang/Sidef/Evolutionary-algorithm | 1 + Lang/Sidef/Exceptions | 1 + ...Catch-an-exception-thrown-in-a-nested-call | 1 + Lang/Sidef/Executable-library | 1 + Lang/Sidef/Execute-Brain---- | 1 + Lang/Sidef/Execute-HQ9+ | 1 + Lang/Sidef/Execute-a-system-command | 1 + Lang/Sidef/Exponentiation-operator | 1 + Lang/Sidef/Extend-your-language | 1 + Lang/Sidef/Extensible-prime-generator | 1 + Lang/Sidef/Extreme-floating-point-values | 1 + Lang/Sidef/Factorial | 1 + Lang/Sidef/Factors-of-a-Mersenne-number | 1 + Lang/Sidef/Factors-of-an-integer | 1 + Lang/Sidef/Fast-Fourier-transform | 1 + Lang/Sidef/Fibonacci-n-step-number-sequences | 1 + Lang/Sidef/Fibonacci-sequence | 1 + Lang/Sidef/Fibonacci-word | 1 + Lang/Sidef/Fibonacci-word-fractal | 1 + Lang/Sidef/File-input-output | 1 + Lang/Sidef/File-modification-time | 1 + Lang/Sidef/File-size | 1 + Lang/Sidef/Filter | 1 + Lang/Sidef/Find-common-directory-path | 1 + ...est-left-truncatable-prime-in-a-given-base | 1 + Lang/Sidef/Find-limit-of-recursion | 1 + Lang/Sidef/Find-the-last-Sunday-of-each-month | 1 + Lang/Sidef/Find-the-missing-permutation | 1 + Lang/Sidef/First-class-environments | 1 + Lang/Sidef/First-class-functions | 1 + ...st-class-functions-Use-numbers-analogously | 1 + Lang/Sidef/Five-weekends | 1 + Lang/Sidef/FizzBuzz | 1 + Lang/Sidef/Flatten-a-list | 1 + Lang/Sidef/Floyds-triangle | 1 + Lang/Sidef/Forest-fire | 1 + Lang/Sidef/Fork | 1 + Lang/Sidef/Formatted-numeric-output | 1 + Lang/Sidef/Forward-difference | 1 + Lang/Sidef/Four-bit-adder | 1 + Lang/Sidef/Fractal-tree | 1 + Lang/Sidef/Fractran | 1 + Lang/Sidef/Function-composition | 1 + Lang/Sidef/Function-definition | 1 + Lang/Sidef/Function-frequency | 1 + Lang/Sidef/GUI-Maximum-window-dimensions | 1 + Lang/Sidef/Gamma-function | 1 + Lang/Sidef/Gaussian-elimination | 1 + Lang/Sidef/Generate-lower-case-ASCII-alphabet | 1 + Lang/Sidef/Generator-Exponential | 1 + Lang/Sidef/Generic-swap | 1 + .../Globally-replace-text-in-several-files | 1 + Lang/Sidef/Gray-code | 1 + Lang/Sidef/Grayscale-image | 1 + Lang/Sidef/Greatest-common-divisor | 1 + Lang/Sidef/Greatest-element-of-a-list | 1 + Lang/Sidef/Greatest-subsequential-sum | 1 + Lang/Sidef/Guess-the-number | 1 + Lang/Sidef/Guess-the-number-With-feedback | 1 + .../Guess-the-number-With-feedback--player- | 1 + Lang/Sidef/HTTP | 1 + Lang/Sidef/HTTPS | 1 + Lang/Sidef/HTTPS-Authenticated | 1 + Lang/Sidef/Hailstone-sequence | 1 + Lang/Sidef/Hamming-numbers | 1 + Lang/Sidef/Handle-a-signal | 1 + Lang/Sidef/Happy-numbers | 1 + Lang/Sidef/Harshad-or-Niven-series | 1 + Lang/Sidef/Hash-from-two-arrays | 1 + Lang/Sidef/Hash-join | 1 + Lang/Sidef/Haversine-formula | 1 + Lang/Sidef/Hello-world-Graphical | 1 + Lang/Sidef/Hello-world-Line-printer | 1 + Lang/Sidef/Hello-world-Newline-omission | 1 + Lang/Sidef/Hello-world-Standard-error | 1 + Lang/Sidef/Hello-world-Text | 1 + Lang/Sidef/Hello-world-Web-server | 1 + Lang/Sidef/Here-document | 1 + Lang/Sidef/Heronian-triangles | 1 + .../Sidef/Hickerson-series-of-almost-integers | 1 + Lang/Sidef/Higher-order-functions | 1 + Lang/Sidef/History-variables | 1 + Lang/Sidef/Hofstadter-Conway-$10,000-sequence | 1 + Lang/Sidef/Hofstadter-Figure-Figure-sequences | 1 + Lang/Sidef/Hofstadter-Q-sequence | 1 + Lang/Sidef/Holidays-related-to-Easter | 1 + Lang/Sidef/Honeycombs | 1 + Lang/Sidef/Horizontal-sundial-calculations | 1 + .../Horners-rule-for-polynomial-evaluation | 1 + Lang/Sidef/Hostname | 1 + Lang/Sidef/Hough-transform | 1 + Lang/Sidef/Huffman-coding | 1 + Lang/Sidef/IBAN | 1 + Lang/Sidef/Identity-matrix | 1 + Lang/Sidef/Include-a-file | 1 + Lang/Sidef/Increment-a-numerical-string | 1 + Lang/Sidef/Infinity | 1 + Lang/Sidef/Inheritance-Multiple | 1 + Lang/Sidef/Inheritance-Single | 1 + Lang/Sidef/Input-loop | 1 + Lang/Sidef/Integer-comparison | 1 + Lang/Sidef/Integer-overflow | 1 + Lang/Sidef/Integer-sequence | 1 + Lang/Sidef/Interactive-programming | 1 + Lang/Sidef/Inverted-syntax | 1 + Lang/Sidef/JSON | 1 + Lang/Sidef/Jensens-Device | 1 + Lang/Sidef/Josephus-problem | 1 + Lang/Sidef/K-d-tree | 1 + Lang/Sidef/Kaprekar-numbers | 1 + .../Keyboard-input-Flush-the-keyboard-buffer | 1 + .../Keyboard-input-Obtain-a-Y-or-N-response | 1 + Lang/Sidef/Knapsack-problem-0-1 | 1 + Lang/Sidef/Knapsack-problem-Bounded | 1 + Lang/Sidef/Knapsack-problem-Continuous | 1 + Lang/Sidef/Knapsack-problem-Unbounded | 1 + Lang/Sidef/Knights-tour | 1 + Lang/Sidef/Knuth-shuffle | 1 + Lang/Sidef/Knuths-algorithm-S | 1 + Lang/Sidef/LU-decomposition | 1 + Lang/Sidef/LZW-compression | 1 + Lang/Sidef/Langtons-ant | 1 + Lang/Sidef/Largest-int-from-concatenated-ints | 1 + Lang/Sidef/Last-Friday-of-each-month | 1 + Lang/Sidef/Leap-year | 1 + Lang/Sidef/Least-common-multiple | 1 + Lang/Sidef/Left-factorials | 1 + Lang/Sidef/Letter-frequency | 1 + Lang/Sidef/Levenshtein-distance | 1 + Lang/Sidef/Linear-congruential-generator | 1 + Lang/Sidef/List-comprehensions | 1 + Lang/Sidef/Literals-Floating-point | 1 + Lang/Sidef/Literals-Integer | 1 + Lang/Sidef/Literals-String | 1 + Lang/Sidef/Logical-operations | 1 + Lang/Sidef/Long-multiplication | 1 + Lang/Sidef/Longest-common-subsequence | 1 + Lang/Sidef/Longest-increasing-subsequence | 1 + Lang/Sidef/Longest-string-challenge | 1 + Lang/Sidef/Look-and-say-sequence | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/Sidef/Loops-Break | 1 + Lang/Sidef/Loops-Continue | 1 + Lang/Sidef/Loops-Do-while | 1 + Lang/Sidef/Loops-Downward-for | 1 + Lang/Sidef/Loops-For | 1 + Lang/Sidef/Loops-For-with-a-specified-step | 1 + Lang/Sidef/Loops-Foreach | 1 + Lang/Sidef/Loops-Infinite | 1 + Lang/Sidef/Loops-N-plus-one-half | 1 + Lang/Sidef/Loops-Nested | 1 + Lang/Sidef/Loops-While | 1 + Lang/Sidef/Lucas-Lehmer-test | 1 + Lang/Sidef/Ludic-numbers | 1 + Lang/Sidef/Luhn-test-of-credit-card-numbers | 1 + Lang/Sidef/MD4 | 1 + Lang/Sidef/MD5 | 1 + Lang/Sidef/MD5-Implementation | 1 + Lang/Sidef/Mad-Libs | 1 + Lang/Sidef/Magic-squares-of-odd-order | 1 + Lang/Sidef/Make-directory-path | 1 + Lang/Sidef/Man-or-boy-test | 1 + Lang/Sidef/Mandelbrot-set | 1 + Lang/Sidef/Map-range | 1 + Lang/Sidef/Matrix-multiplication | 1 + Lang/Sidef/Matrix-transposition | 1 + Lang/Sidef/Maximum-triangle-path-sum | 1 + Lang/Sidef/Maze-generation | 1 + Lang/Sidef/Menu | 1 + Lang/Sidef/Metaprogramming | 1 + Lang/Sidef/Middle-three-digits | 1 + Lang/Sidef/Modular-exponentiation | 1 + Lang/Sidef/Modular-inverse | 1 + Lang/Sidef/Monty-Hall-problem | 1 + Lang/Sidef/Move-to-front-algorithm | 1 + Lang/Sidef/Multifactorial | 1 + Lang/Sidef/Multiple-distinct-objects | 1 + Lang/Sidef/Multiplication-tables | 1 + Lang/Sidef/Multisplit | 1 + Lang/Sidef/Munching-squares | 1 + Lang/Sidef/Mutual-recursion | 1 + Lang/Sidef/Named-parameters | 1 + Lang/Sidef/Narcissist | 1 + Lang/Sidef/Narcissistic-decimal-number | 1 + Lang/Sidef/Natural-sorting | 1 + Lang/Sidef/Non-continuous-subsequences | 1 + Lang/Sidef/Non-decimal-radices-Convert | 1 + Lang/Sidef/Non-decimal-radices-Input | 1 + Lang/Sidef/Non-decimal-radices-Output | 1 + Lang/Sidef/Nth | 1 + Lang/Sidef/Nth-root | 1 + Lang/Sidef/Null-object | 1 + Lang/Sidef/Number-names | 1 + Lang/Sidef/Number-reversal-game | 1 + Lang/Sidef/Numerical-integration | 1 + ...ical-integration-Gauss-Legendre-Quadrature | 1 + Lang/Sidef/Odd-word-problem | 1 + Lang/Sidef/Old-lady-swallowed-a-fly | 1 + Lang/Sidef/One-dimensional-cellular-automata | 1 + Lang/Sidef/One-of-n-lines-in-a-file | 1 + Lang/Sidef/Operator-precedence | 1 + Lang/Sidef/Optional-parameters | 1 + Lang/Sidef/Order-disjoint-list-items | 1 + Lang/Sidef/Order-two-numerical-lists | 1 + Lang/Sidef/Ordered-Partitions | 1 + Lang/Sidef/Ordered-words | 1 + Lang/Sidef/Palindrome-detection | 1 + Lang/Sidef/Pangram-checker | 1 + Lang/Sidef/Parallel-calculations | 1 + Lang/Sidef/Parsing-RPN-calculator-algorithm | 1 + Lang/Sidef/Parsing-RPN-to-infix-conversion | 1 + Lang/Sidef/Parsing-Shunting-yard-algorithm | 1 + Lang/Sidef/Partial-function-application | 1 + Lang/Sidef/Pascals-triangle | 1 + Lang/Sidef/Pascals-triangle-Puzzle | 1 + .../Percentage-difference-between-images | 1 + Lang/Sidef/Percolation-Mean-run-density | 1 + Lang/Sidef/Perfect-numbers | 1 + Lang/Sidef/Permutation-test | 1 + Lang/Sidef/Permutations | 1 + Lang/Sidef/Permutations-by-swapping | 1 + Lang/Sidef/Pernicious-numbers | 1 + Lang/Sidef/Phrase-reversals | 1 + Lang/Sidef/Pi | 1 + Lang/Sidef/Pick-random-element | 1 + Lang/Sidef/Pig-the-dice-game-Player | 1 + Lang/Sidef/Playing-cards | 1 + Lang/Sidef/Plot-coordinate-pairs | 1 + Lang/Sidef/Pointers-and-references | 1 + Lang/Sidef/Polymorphic-copy | 1 + Lang/Sidef/Polymorphism | 1 + Lang/Sidef/Polynomial-long-division | 1 + Lang/Sidef/Polynomial-regression | 1 + Lang/Sidef/Power-set | 1 + Lang/Sidef/Price-fraction | 1 + Lang/Sidef/Primality-by-trial-division | 1 + Lang/Sidef/Prime-decomposition | 1 + Lang/Sidef/Priority-queue | 1 + Lang/Sidef/Probabilistic-choice | 1 + Lang/Sidef/Problem-of-Apollonius | 1 + Lang/Sidef/Program-name | 1 + Lang/Sidef/Program-termination | 1 + Lang/Sidef/Pythagorean-triples | 1 + Lang/Sidef/Quaternion-type | 1 + Lang/Sidef/Queue-Definition | 1 + Lang/Sidef/Queue-Usage | 1 + Lang/Sidef/Quickselect-algorithm | 1 + Lang/Sidef/Quine | 1 + Lang/Sidef/README | 1 + Lang/Sidef/RSA-code | 1 + Lang/Sidef/Random-number-generator--device- | 1 + Lang/Sidef/Random-number-generator--included- | 1 + Lang/Sidef/Random-numbers | 1 + Lang/Sidef/Range-expansion | 1 + Lang/Sidef/Ranking-methods | 1 + Lang/Sidef/Rate-counter | 1 + Lang/Sidef/Read-a-configuration-file | 1 + Lang/Sidef/Read-a-file-line-by-line | 1 + Lang/Sidef/Read-a-specific-line-from-a-file | 1 + Lang/Sidef/Read-entire-file | 1 + Lang/Sidef/Real-constants-and-functions | 1 + Lang/Sidef/Reduced-row-echelon-form | 1 + Lang/Sidef/Regular-expressions | 1 + Lang/Sidef/Remove-duplicate-elements | 1 + Lang/Sidef/Remove-lines-from-a-file | 1 + Lang/Sidef/Rename-a-file | 1 + Lang/Sidef/Rep-string | 1 + Lang/Sidef/Repeat-a-string | 1 + Lang/Sidef/Resistor-mesh | 1 + Lang/Sidef/Respond-to-an-unknown-method-call | 1 + Lang/Sidef/Return-multiple-values | 1 + Lang/Sidef/Reverse-a-string | 1 + Lang/Sidef/Reverse-words-in-a-string | 1 + Lang/Sidef/Rock-paper-scissors | 1 + Lang/Sidef/Roman-numerals-Decode | 1 + Lang/Sidef/Roman-numerals-Encode | 1 + Lang/Sidef/Roots-of-a-function | 1 + Lang/Sidef/Roots-of-a-quadratic-function | 1 + Lang/Sidef/Roots-of-unity | 1 + Lang/Sidef/Rot-13 | 1 + Lang/Sidef/Run-length-encoding | 1 + Lang/Sidef/Runge-Kutta-method | 1 + Lang/Sidef/Runtime-evaluation | 1 + .../Runtime-evaluation-In-an-environment | 1 + Lang/Sidef/S-Expressions | 1 + Lang/Sidef/SEDOLs | 1 + Lang/Sidef/SHA-1 | 1 + Lang/Sidef/SHA-256 | 1 + Lang/Sidef/SQL-based-authentication | 1 + Lang/Sidef/Same-Fringe | 1 + Lang/Sidef/Scope-Function-names-and-labels | 1 + Lang/Sidef/Search-a-list | 1 + Lang/Sidef/Secure-temporary-file | 1 + Lang/Sidef/Self-describing-numbers | 1 + Lang/Sidef/Semiprime | 1 + Lang/Sidef/Semordnilap | 1 + Lang/Sidef/Send-an-unknown-method-call | 1 + Lang/Sidef/Sequence-of-non-squares | 1 + .../Sequence-of-primes-by-Trial-Division | 1 + Lang/Sidef/Set | 1 + Lang/Sidef/Set-consolidation | 1 + .../Seven-sided-dice-from-five-sided-dice | 1 + Lang/Sidef/Shell-one-liner | 1 + Lang/Sidef/Short-circuit-evaluation | 1 + Lang/Sidef/Show-the-epoch | 1 + Lang/Sidef/Sierpinski-carpet | 1 + Lang/Sidef/Sierpinski-triangle | 1 + Lang/Sidef/Sierpinski-triangle-Graphical | 1 + Lang/Sidef/Sieve-of-Eratosthenes | 1 + Lang/Sidef/Simple-windowed-application | 1 + Lang/Sidef/Singleton | 1 + .../Singly-linked-list-Element-definition | 1 + .../Singly-linked-list-Element-insertion | 1 + Lang/Sidef/Singly-linked-list-Traversal | 1 + Lang/Sidef/Sleep | 1 + Lang/Sidef/Sockets | 1 + .../Sort-an-array-of-composite-structures | 1 + Lang/Sidef/Sort-an-integer-array | 1 + Lang/Sidef/Sort-disjoint-sublist | 1 + Lang/Sidef/Sort-stability | 1 + Lang/Sidef/Sort-using-a-custom-comparator | 1 + Lang/Sidef/Sorting-algorithms-Bead-sort | 1 + Lang/Sidef/Sorting-algorithms-Bogosort | 1 + Lang/Sidef/Sorting-algorithms-Bubble-sort | 1 + Lang/Sidef/Sorting-algorithms-Cocktail-sort | 1 + Lang/Sidef/Sorting-algorithms-Comb-sort | 1 + Lang/Sidef/Sorting-algorithms-Counting-sort | 1 + Lang/Sidef/Sorting-algorithms-Gnome-sort | 1 + Lang/Sidef/Sorting-algorithms-Heapsort | 1 + Lang/Sidef/Sorting-algorithms-Insertion-sort | 1 + Lang/Sidef/Sorting-algorithms-Merge-sort | 1 + Lang/Sidef/Sorting-algorithms-Pancake-sort | 1 + .../Sidef/Sorting-algorithms-Permutation-sort | 1 + Lang/Sidef/Sorting-algorithms-Quicksort | 1 + Lang/Sidef/Sorting-algorithms-Radix-sort | 1 + Lang/Sidef/Sorting-algorithms-Selection-sort | 1 + Lang/Sidef/Sorting-algorithms-Shell-sort | 1 + Lang/Sidef/Sorting-algorithms-Sleep-sort | 1 + Lang/Sidef/Sorting-algorithms-Stooge-sort | 1 + Lang/Sidef/Sorting-algorithms-Strand-sort | 1 + Lang/Sidef/Soundex | 1 + Lang/Sidef/Sparkline-in-unicode | 1 + Lang/Sidef/Speech-synthesis | 1 + Lang/Sidef/Spiral-matrix | 1 + Lang/Sidef/Stable-marriage-problem | 1 + Lang/Sidef/Stack | 1 + Lang/Sidef/Stair-climbing-puzzle | 1 + Lang/Sidef/Statistics-Basic | 1 + Lang/Sidef/Stem-and-leaf-plot | 1 + Lang/Sidef/Stern-Brocot-sequence | 1 + Lang/Sidef/String-append | 1 + Lang/Sidef/String-case | 1 + Lang/Sidef/String-comparison | 1 + Lang/Sidef/String-concatenation | 1 + Lang/Sidef/String-interpolation--included- | 1 + Lang/Sidef/String-length | 1 + Lang/Sidef/String-matching | 1 + Lang/Sidef/String-prepend | 1 + .../Strip-a-set-of-characters-from-a-string | 1 + Lang/Sidef/Strip-block-comments | 1 + Lang/Sidef/Strip-comments-from-a-string | 1 + ...odes-and-extended-characters-from-a-string | 1 + ...trip-whitespace-from-a-string-Top-and-tail | 1 + Lang/Sidef/Substring | 1 + Lang/Sidef/Substring-Top-and-tail | 1 + Lang/Sidef/Subtractive-generator | 1 + Lang/Sidef/Sudoku | 1 + Lang/Sidef/Sum-and-product-of-an-array | 1 + Lang/Sidef/Sum-digits-of-an-integer | 1 + Lang/Sidef/Sum-multiples-of-3-and-5 | 1 + Lang/Sidef/Sum-of-a-series | 1 + Lang/Sidef/Sum-of-squares | 1 + .../Sidef/Sutherland-Hodgman-polygon-clipping | 1 + Lang/Sidef/Symmetric-difference | 1 + Lang/Sidef/System-time | 1 + Lang/Sidef/Table-creation-Postal-addresses | 1 + Lang/Sidef/Take-notes-on-the-command-line | 1 + Lang/Sidef/Temperature-conversion | 1 + Lang/Sidef/Terminal-control-Clear-the-screen | 1 + Lang/Sidef/Terminal-control-Coloured-text | 1 + Lang/Sidef/Terminal-control-Dimensions | 1 + ...inal-control-Display-an-extended-character | 1 + Lang/Sidef/Terminal-control-Preserve-screen | 1 + ...Terminal-control-Ringing-the-terminal-bell | 1 + Lang/Sidef/Terminal-control-Unicode-output | 1 + Lang/Sidef/Text-processing-1 | 1 + Lang/Sidef/Text-processing-2 | 1 + .../Sidef/Text-processing-Max-licenses-in-use | 1 + Lang/Sidef/Textonyms | 1 + Lang/Sidef/The-ISAAC-Cipher | 1 + Lang/Sidef/The-Twelve-Days-of-Christmas | 1 + Lang/Sidef/Thieles-interpolation-formula | 1 + Lang/Sidef/Time-a-function | 1 + Lang/Sidef/Tokenize-a-string | 1 + Lang/Sidef/Top-rank-per-group | 1 + Lang/Sidef/Topic-variable | 1 + Lang/Sidef/Topological-sort | 1 + Lang/Sidef/Towers-of-Hanoi | 1 + Lang/Sidef/Trabb-Pardo-Knuth-algorithm | 1 + Lang/Sidef/Tree-traversal | 1 + Lang/Sidef/Trigonometric-functions | 1 + Lang/Sidef/Truncatable-primes | 1 + Lang/Sidef/Truncate-a-file | 1 + Lang/Sidef/URL-decoding | 1 + Lang/Sidef/URL-encoding | 1 + Lang/Sidef/Ulam-spiral--for-primes- | 1 + Lang/Sidef/Unbias-a-random-generator | 1 + Lang/Sidef/Undefined-values | 1 + Lang/Sidef/Unicode-strings | 1 + Lang/Sidef/Unicode-variable-names | 1 + Lang/Sidef/Universal-Turing-machine | 1 + Lang/Sidef/Unix-ls | 1 + Lang/Sidef/User-input-Graphical | 1 + Lang/Sidef/User-input-Text | 1 + Lang/Sidef/Van-der-Corput-sequence | 1 + Lang/Sidef/Variadic-function | 1 + Lang/Sidef/Vector-products | 1 + Lang/Sidef/Vigen-re-cipher | 1 + Lang/Sidef/Visualize-a-tree | 1 + Lang/Sidef/Voronoi-diagram | 1 + Lang/Sidef/Walk-a-directory-Non-recursively | 1 + Lang/Sidef/Walk-a-directory-Recursively | 1 + Lang/Sidef/Web-scraping | 1 + Lang/Sidef/Window-creation | 1 + Lang/Sidef/Wireworld | 1 + Lang/Sidef/Word-wrap | 1 + Lang/Sidef/Write-float-arrays-to-a-text-file | 1 + Lang/Sidef/Write-language-name-in-3D-ASCII | 1 + Lang/Sidef/XML-DOM-serialization | 1 + Lang/Sidef/XML-Input | 1 + Lang/Sidef/XML-Output | 1 + Lang/Sidef/XML-XPath | 1 + Lang/Sidef/Xiaolin-Wus-line-algorithm | 1 + Lang/Sidef/Y-combinator | 1 + Lang/Sidef/Yin-and-yang | 1 + Lang/Sidef/Zebra-puzzle | 1 + Lang/Sidef/Zeckendorf-number-representation | 1 + Lang/Sidef/Zero-to-the-zero-power | 1 + Lang/Sidef/Zhang-Suen-thinning-algorithm | 1 + Lang/Sidef/Zig-zag-matrix | 1 + Lang/SkookumScript/00DESCRIPTION | 21 + Lang/SkookumScript/99-Bottles-of-Beer | 1 + Lang/SkookumScript/Binary-digits | 1 + Lang/SkookumScript/Fibonacci-sequence | 1 + Lang/SkookumScript/FizzBuzz | 1 + Lang/SkookumScript/Hello-world-Text | 1 + Lang/SkookumScript/Logical-operations | 1 + Lang/SkookumScript/README | 1 + Lang/SmileBASIC/00DESCRIPTION | 1 + Lang/SmileBASIC/A+B | 1 + Lang/SmileBASIC/Hello-world-Text | 1 + Lang/SmileBASIC/README | 1 + Lang/SoneKing-Assembly/00DESCRIPTION | 9 + Lang/SoneKing-Assembly/Hello-world-Text | 1 + Lang/SoneKing-Assembly/README | 1 + Lang/Sparkling/00DESCRIPTION | 113 +++ Lang/Sparkling/100-doors | 1 + Lang/Sparkling/99-Bottles-of-Beer | 1 + Lang/Sparkling/Anonymous-recursion | 1 + Lang/Sparkling/Apply-a-callback-to-an-array | 1 + Lang/Sparkling/Closures-Value-capture | 1 + Lang/Sparkling/Conjugate-transpose | 1 + Lang/Sparkling/Count-in-octal | 1 + Lang/Sparkling/Empty-program | 1 + Lang/Sparkling/Greatest-common-divisor | 1 + Lang/Sparkling/Guess-the-number-With-feedback | 1 + Lang/Sparkling/Hash-from-two-arrays | 1 + Lang/Sparkling/Hello-world-Text | 1 + Lang/Sparkling/Higher-order-functions | 1 + Lang/Sparkling/Identity-matrix | 1 + Lang/Sparkling/Increment-a-numerical-string | 1 + Lang/Sparkling/Input-loop | 1 + Lang/Sparkling/Integer-comparison | 1 + Lang/Sparkling/Least-common-multiple | 1 + Lang/Sparkling/Linear-congruential-generator | 1 + Lang/Sparkling/Loops-Do-while | 1 + Lang/Sparkling/Loops-Downward-for | 1 + Lang/Sparkling/Loops-For | 1 + Lang/Sparkling/Loops-Foreach | 1 + Lang/Sparkling/Loops-Infinite | 1 + Lang/Sparkling/Loops-While | 1 + Lang/Sparkling/Man-or-boy-test | 1 + Lang/Sparkling/Matrix-transposition | 1 + Lang/Sparkling/N-queens-problem | 1 + Lang/Sparkling/README | 1 + Lang/Sparkling/Read-a-file-line-by-line | 1 + Lang/Sparkling/Read-entire-file | 1 + Lang/Sparkling/Real-constants-and-functions | 1 + Lang/Sparkling/Remove-duplicate-elements | 1 + Lang/Sparkling/Repeat-a-string | 1 + Lang/Sparkling/Reverse-words-in-a-string | 1 + Lang/Sparkling/Roots-of-unity | 1 + Lang/Sparkling/Runtime-evaluation | 1 + Lang/Sparkling/Sort-an-integer-array | 1 + Lang/Sparkling/String-concatenation | 1 + Lang/Sparkling/String-length | 1 + Lang/Sparkling/Sum-and-product-of-an-array | 1 + Lang/Spin/00DESCRIPTION | 25 + Lang/Spin/README | 1 + Lang/Star/00DESCRIPTION | 1 + Lang/Star/README | 1 + Lang/Swift/00DESCRIPTION | 11 + Lang/Swift/100-doors | 1 + Lang/Swift/24-game | 1 + Lang/Swift/24-game-Solve | 1 + Lang/Swift/9-billion-names-of-God-the-integer | 1 + Lang/Swift/99-Bottles-of-Beer | 1 + Lang/Swift/A+B | 1 + Lang/Swift/ABC-Problem | 1 + Lang/Swift/AKS-test-for-primes | 1 + ...ficient-and-perfect-number-classifications | 1 + Lang/Swift/Accumulator-factory | 1 + Lang/Swift/Ackermann-function | 1 + Lang/Swift/Active-object | 1 + ...-a-variable-to-a-class-instance-at-runtime | 1 + Lang/Swift/Address-of-a-variable | 1 + Lang/Swift/Amicable-pairs | 1 + Lang/Swift/Anagrams | 1 + Lang/Swift/Anonymous-recursion | 1 + Lang/Swift/Apply-a-callback-to-an-array | 1 + Lang/Swift/Arithmetic-Complex | 1 + Lang/Swift/Array-concatenation | 1 + Lang/Swift/Arrays | 1 + Lang/Swift/Assertions | 1 + Lang/Swift/Associative-array-Creation | 1 + Lang/Swift/Associative-array-Iteration | 1 + Lang/Swift/Averages-Arithmetic-mean | 1 + Lang/Swift/Balanced-brackets | 1 + Lang/Swift/Binary-digits | 1 + Lang/Swift/Binary-search | 1 + Lang/Swift/Bitwise-operations | 1 + Lang/Swift/CRC-32 | 1 + Lang/Swift/Call-a-foreign-language-function | 1 + Lang/Swift/Call-a-function | 1 + Lang/Swift/Call-an-object-method | 1 + Lang/Swift/Case-sensitivity-of-identifiers | 1 + Lang/Swift/Character-codes | 1 + Lang/Swift/Classes | 1 + Lang/Swift/Closures-Value-capture | 1 + Lang/Swift/Combinations | 1 + Lang/Swift/Combinations-with-repetitions | 1 + Lang/Swift/Comma-quibbling | 1 + Lang/Swift/Command-line-arguments | 1 + Lang/Swift/Comments | 1 + Lang/Swift/Compound-data-type | 1 + Lang/Swift/Concurrent-computing | 1 + Lang/Swift/Constrained-genericity | 1 + Lang/Swift/Copy-a-string | 1 + Lang/Swift/Count-in-octal | 1 + .../Create-a-two-dimensional-array-at-runtime | 1 + Lang/Swift/Currying | 1 + Lang/Swift/Date-format | 1 + Lang/Swift/Day-of-the-week | 1 + Lang/Swift/Delegates | 1 + Lang/Swift/Determine-if-a-string-is-numeric | 1 + .../Determine-if-only-one-instance-is-running | 1 + Lang/Swift/Documentation | 1 + Lang/Swift/Dot-product | 1 + Lang/Swift/Draw-a-sphere | 1 + Lang/Swift/Empty-program | 1 + Lang/Swift/Empty-string | 1 + Lang/Swift/Enumerations | 1 + Lang/Swift/Ethiopian-multiplication | 1 + Lang/Swift/Even-or-odd | 1 + Lang/Swift/Exceptions | 1 + ...Catch-an-exception-thrown-in-a-nested-call | 1 + Lang/Swift/Execute-Brain---- | 1 + Lang/Swift/Execute-a-Markov-algorithm | 1 + Lang/Swift/Extreme-floating-point-values | 1 + Lang/Swift/Factorial | 1 + Lang/Swift/Factors-of-an-integer | 1 + Lang/Swift/Fibonacci-sequence | 1 + Lang/Swift/Filter | 1 + Lang/Swift/First-class-functions | 1 + Lang/Swift/FizzBuzz | 1 + Lang/Swift/Flatten-a-list | 1 + Lang/Swift/Flipping-bits-game | 1 + Lang/Swift/Fractal-tree | 1 + Lang/Swift/Function-composition | 1 + Lang/Swift/Function-definition | 1 + Lang/Swift/Generate-lower-case-ASCII-alphabet | 1 + Lang/Swift/Generator-Exponential | 1 + Lang/Swift/Generic-swap | 1 + Lang/Swift/Greatest-common-divisor | 1 + Lang/Swift/Greatest-element-of-a-list | 1 + Lang/Swift/Guess-the-number | 1 + Lang/Swift/Guess-the-number-With-feedback | 1 + .../Guess-the-number-With-feedback--player- | 1 + Lang/Swift/HTTP | 1 + Lang/Swift/HTTPS | 1 + Lang/Swift/Hailstone-sequence | 1 + Lang/Swift/Handle-a-signal | 1 + Lang/Swift/Happy-numbers | 1 + Lang/Swift/Hash-from-two-arrays | 1 + Lang/Swift/Haversine-formula | 1 + Lang/Swift/Hello-world-Graphical | 1 + Lang/Swift/Hello-world-Line-printer | 1 + Lang/Swift/Hello-world-Newline-omission | 1 + Lang/Swift/Hello-world-Standard-error | 1 + Lang/Swift/Hello-world-Text | 1 + Lang/Swift/Heronian-triangles | 1 + Lang/Swift/Higher-order-functions | 1 + Lang/Swift/History-variables | 1 + Lang/Swift/Hofstadter-Conway-$10,000-sequence | 1 + .../Horners-rule-for-polynomial-evaluation | 1 + Lang/Swift/Hostname | 1 + Lang/Swift/Huffman-coding | 1 + Lang/Swift/I-before-E-except-after-C | 1 + Lang/Swift/Increment-a-numerical-string | 1 + Lang/Swift/Infinity | 1 + Lang/Swift/Inheritance-Multiple | 1 + Lang/Swift/Inheritance-Single | 1 + Lang/Swift/Integer-comparison | 1 + Lang/Swift/Integer-overflow | 1 + Lang/Swift/Integer-sequence | 1 + Lang/Swift/Inverted-syntax | 1 + Lang/Swift/JSON | 1 + Lang/Swift/Jensens-Device | 1 + Lang/Swift/Josephus-problem | 1 + Lang/Swift/Knuth-shuffle | 1 + Lang/Swift/Knuths-algorithm-S | 1 + Lang/Swift/LZW-compression | 1 + Lang/Swift/Langtons-ant | 1 + Lang/Swift/Leap-year | 1 + Lang/Swift/Least-common-multiple | 1 + Lang/Swift/Levenshtein-distance | 1 + Lang/Swift/Linear-congruential-generator | 1 + Lang/Swift/Literals-Floating-point | 1 + Lang/Swift/Literals-Integer | 1 + Lang/Swift/Literals-String | 1 + Lang/Swift/Logical-operations | 1 + Lang/Swift/Longest-common-subsequence | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/Swift/Loops-Break | 1 + Lang/Swift/Loops-Continue | 1 + Lang/Swift/Loops-Do-while | 1 + Lang/Swift/Loops-Downward-for | 1 + Lang/Swift/Loops-For | 1 + Lang/Swift/Loops-For-with-a-specified-step | 1 + Lang/Swift/Loops-Foreach | 1 + Lang/Swift/Loops-Infinite | 1 + Lang/Swift/Loops-N-plus-one-half | 1 + Lang/Swift/Loops-Nested | 1 + Lang/Swift/Loops-While | 1 + Lang/Swift/Luhn-test-of-credit-card-numbers | 1 + Lang/Swift/MD5-Implementation | 1 + Lang/Swift/Man-or-boy-test | 1 + Lang/Swift/Maze-generation | 1 + Lang/Swift/Monte-Carlo-methods | 1 + Lang/Swift/Multiple-distinct-objects | 1 + Lang/Swift/Mutual-recursion | 1 + Lang/Swift/Named-parameters | 1 + Lang/Swift/Non-decimal-radices-Convert | 1 + Lang/Swift/Nth | 1 + Lang/Swift/Null-object | 1 + Lang/Swift/One-of-n-lines-in-a-file | 1 + Lang/Swift/Optional-parameters | 1 + Lang/Swift/Order-two-numerical-lists | 1 + Lang/Swift/Ordered-words | 1 + Lang/Swift/Palindrome-detection | 1 + Lang/Swift/Pangram-checker | 1 + Lang/Swift/Parametric-polymorphism | 1 + Lang/Swift/Parsing-RPN-calculator-algorithm | 1 + Lang/Swift/Parsing-Shunting-yard-algorithm | 1 + Lang/Swift/Pattern-matching | 1 + Lang/Swift/Perfect-numbers | 1 + Lang/Swift/Permutations | 1 + Lang/Swift/Pick-random-element | 1 + Lang/Swift/Play-recorded-sounds | 1 + Lang/Swift/Playing-cards | 1 + Lang/Swift/Polymorphic-copy | 1 + Lang/Swift/Polymorphism | 1 + Lang/Swift/Primality-by-trial-division | 1 + Lang/Swift/Priority-queue | 1 + Lang/Swift/Problem-of-Apollonius | 1 + Lang/Swift/Pythagorean-triples | 1 + Lang/Swift/Quickselect-algorithm | 1 + Lang/Swift/Quine | 1 + Lang/Swift/README | 1 + Lang/Swift/RIPEMD-160 | 1 + Lang/Swift/Range-extraction | 1 + Lang/Swift/Read-entire-file | 1 + Lang/Swift/Real-constants-and-functions | 1 + Lang/Swift/Reduced-row-echelon-form | 1 + Lang/Swift/Regular-expressions | 1 + Lang/Swift/Remove-duplicate-elements | 1 + Lang/Swift/Repeat-a-string | 1 + Lang/Swift/Return-multiple-values | 1 + Lang/Swift/Reverse-a-string | 1 + Lang/Swift/Reverse-words-in-a-string | 1 + Lang/Swift/Roman-numerals-Decode | 1 + Lang/Swift/Roman-numerals-Encode | 1 + Lang/Swift/Rot-13 | 1 + Lang/Swift/Run-length-encoding | 1 + Lang/Swift/Runge-Kutta-method | 1 + Lang/Swift/Search-a-list | 1 + Lang/Swift/Semiprime | 1 + .../Sequence-of-primes-by-Trial-Division | 1 + Lang/Swift/Set | 1 + Lang/Swift/Short-circuit-evaluation | 1 + Lang/Swift/Sierpinski-carpet | 1 + Lang/Swift/Sierpinski-triangle | 1 + Lang/Swift/Sieve-of-Eratosthenes | 1 + Lang/Swift/Sleep | 1 + Lang/Swift/Sort-an-integer-array | 1 + Lang/Swift/Sort-disjoint-sublist | 1 + Lang/Swift/Sort-using-a-custom-comparator | 1 + Lang/Swift/Sorting-algorithms-Bogosort | 1 + Lang/Swift/Sorting-algorithms-Bubble-sort | 1 + Lang/Swift/Sorting-algorithms-Comb-sort | 1 + Lang/Swift/Sorting-algorithms-Heapsort | 1 + Lang/Swift/Sorting-algorithms-Insertion-sort | 1 + Lang/Swift/Sorting-algorithms-Merge-sort | 1 + Lang/Swift/Sorting-algorithms-Pancake-sort | 1 + Lang/Swift/Sorting-algorithms-Quicksort | 1 + Lang/Swift/Sorting-algorithms-Selection-sort | 1 + Lang/Swift/Sorting-algorithms-Shell-sort | 1 + Lang/Swift/Sorting-algorithms-Sleep-sort | 1 + Lang/Swift/Sorting-algorithms-Stooge-sort | 1 + Lang/Swift/Speech-synthesis | 1 + Lang/Swift/Stable-marriage-problem | 1 + Lang/Swift/Stack | 1 + Lang/Swift/Stair-climbing-puzzle | 1 + Lang/Swift/String-append | 1 + Lang/Swift/String-case | 1 + Lang/Swift/String-comparison | 1 + Lang/Swift/String-concatenation | 1 + Lang/Swift/String-interpolation--included- | 1 + Lang/Swift/String-length | 1 + Lang/Swift/String-matching | 1 + Lang/Swift/String-prepend | 1 + .../Strip-a-set-of-characters-from-a-string | 1 + Lang/Swift/Substring | 1 + Lang/Swift/Substring-Top-and-tail | 1 + Lang/Swift/Sudoku | 1 + Lang/Swift/Sum-and-product-of-an-array | 1 + Lang/Swift/Sum-digits-of-an-integer | 1 + Lang/Swift/Sum-of-a-series | 1 + Lang/Swift/Sum-of-squares | 1 + Lang/Swift/Symmetric-difference | 1 + Lang/Swift/Synchronous-concurrency | 1 + Lang/Swift/System-time | 1 + Lang/Swift/Take-notes-on-the-command-line | 1 + Lang/Swift/Test-a-function | 1 + Lang/Swift/The-Twelve-Days-of-Christmas | 1 + Lang/Swift/Tokenize-a-string | 1 + Lang/Swift/Towers-of-Hanoi | 1 + Lang/Swift/Trabb-Pardo-Knuth-algorithm | 1 + Lang/Swift/Twelve-statements | 1 + Lang/Swift/URL-decoding | 1 + Lang/Swift/Unicode-variable-names | 1 + Lang/Swift/User-input-Text | 1 + Lang/Swift/Variable-size-Get | 1 + Lang/Swift/Variables | 1 + Lang/Swift/Variadic-function | 1 + Lang/Swift/Walk-a-directory-Recursively | 1 + Lang/Swift/Y-combinator | 1 + Lang/Swift/Zero-to-the-zero-power | 1 + Lang/Symsyn/00DESCRIPTION | 15 + Lang/Symsyn/99-Bottles-of-Beer | 1 + Lang/Symsyn/Empty-program | 1 + Lang/Symsyn/Even-or-odd | 1 + Lang/Symsyn/FizzBuzz | 1 + Lang/Symsyn/Hello-world-Text | 1 + Lang/Symsyn/Pernicious-numbers | 1 + Lang/Symsyn/README | 1 + Lang/Symsyn/Sockets | 1 + Lang/Symsyn/Trabb-Pardo-Knuth-algorithm | 1 + Lang/TI-83-Hex-Assembly/00DESCRIPTION | 1 + Lang/TI-83-Hex-Assembly/A+B | 1 + Lang/TI-83-Hex-Assembly/Empty-program | 1 + Lang/TI-83-Hex-Assembly/Hello-world-Newbie | 1 + Lang/TI-83-Hex-Assembly/README | 1 + Lang/Terra/00DESCRIPTION | 1 + Lang/Terra/Hello-world-Text | 1 + Lang/Terra/README | 1 + Lang/TestML/00DESCRIPTION | 9 + Lang/TestML/Hello-world-Text | 1 + Lang/TestML/README | 1 + Lang/ToffeeScript/00DESCRIPTION | 1 + Lang/ToffeeScript/README | 1 + Lang/ToffeeScript/Simple-database | 1 + Lang/ToffeeScript/Web-scraping | 1 + Lang/TypeScript/00DESCRIPTION | 17 + Lang/TypeScript/Caesar-cipher | 1 + Lang/TypeScript/Fractal-tree | 1 + Lang/TypeScript/Greatest-common-divisor | 1 + Lang/TypeScript/Loops-For | 1 + Lang/TypeScript/README | 1 + Lang/TypeScript/Vigen-re-cipher | 1 + Lang/Uniface/00DESCRIPTION | 156 +++++ Lang/Uniface/100-doors | 1 + Lang/Uniface/Hello-world-Text | 1 + Lang/Uniface/Loops-While | 1 + Lang/Uniface/README | 1 + Lang/Uniface/SOAP | 1 + Lang/Ursa/00DESCRIPTION | 56 ++ Lang/Ursa/100-doors | 1 + Lang/Ursa/99-Bottles-of-Beer | 1 + Lang/Ursa/A+B | 1 + .../Append-a-record-to-the-end-of-a-text-file | 1 + .../Arbitrary-precision-integers--included- | 1 + Lang/Ursa/Arithmetic-Integer | 1 + Lang/Ursa/Array-concatenation | 1 + Lang/Ursa/Averages-Arithmetic-mean | 1 + Lang/Ursa/Boolean-values | 1 + Lang/Ursa/CSV-data-manipulation | 1 + Lang/Ursa/Caesar-cipher | 1 + Lang/Ursa/Call-an-object-method | 1 + Lang/Ursa/Case-sensitivity-of-identifiers | 1 + Lang/Ursa/Character-codes | 1 + Lang/Ursa/Check-that-file-exists | 1 + Lang/Ursa/Command-line-arguments | 1 + Lang/Ursa/Comments | 1 + Lang/Ursa/Copy-a-string | 1 + Lang/Ursa/Create-a-file | 1 + .../Create-a-two-dimensional-array-at-runtime | 1 + Lang/Ursa/Create-an-HTML-table | 1 + Lang/Ursa/Date-format | 1 + Lang/Ursa/Delete-a-file | 1 + Lang/Ursa/Detect-division-by-zero | 1 + Lang/Ursa/Determine-if-a-string-is-numeric | 1 + Lang/Ursa/Empty-program | 1 + Lang/Ursa/Empty-string | 1 + Lang/Ursa/Environment-variables | 1 + Lang/Ursa/Even-or-odd | 1 + Lang/Ursa/Exceptions | 1 + Lang/Ursa/Execute-a-system-command | 1 + Lang/Ursa/Exponentiation-operator | 1 + Lang/Ursa/Factorial | 1 + Lang/Ursa/Factors-of-an-integer | 1 + Lang/Ursa/Fibonacci-sequence | 1 + Lang/Ursa/File-input-output | 1 + Lang/Ursa/File-modification-time | 1 + Lang/Ursa/File-size | 1 + Lang/Ursa/Find-limit-of-recursion | 1 + Lang/Ursa/FizzBuzz | 1 + Lang/Ursa/Function-definition | 1 + Lang/Ursa/Generate-lower-case-ASCII-alphabet | 1 + Lang/Ursa/Greatest-common-divisor | 1 + Lang/Ursa/Greatest-element-of-a-list | 1 + Lang/Ursa/Guess-the-number | 1 + Lang/Ursa/Guess-the-number-With-feedback | 1 + Lang/Ursa/Hailstone-sequence | 1 + Lang/Ursa/Hello-world-Newline-omission | 1 + Lang/Ursa/Hello-world-Standard-error | 1 + Lang/Ursa/Hello-world-Text | 1 + Lang/Ursa/Higher-order-functions | 1 + Lang/Ursa/Hostname | 1 + Lang/Ursa/Include-a-file | 1 + Lang/Ursa/Increment-a-numerical-string | 1 + Lang/Ursa/Infinity | 1 + Lang/Ursa/Input-loop | 1 + Lang/Ursa/Integer-comparison | 1 + Lang/Ursa/Integer-sequence | 1 + Lang/Ursa/Interactive-programming | 1 + Lang/Ursa/Leap-year | 1 + Lang/Ursa/Least-common-multiple | 1 + Lang/Ursa/Literals-Floating-point | 1 + Lang/Ursa/Literals-Integer | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/Ursa/Loops-Break | 1 + Lang/Ursa/Loops-Continue | 1 + Lang/Ursa/Loops-Downward-for | 1 + Lang/Ursa/Loops-For | 1 + Lang/Ursa/Loops-For-with-a-specified-step | 1 + Lang/Ursa/Loops-Infinite | 1 + Lang/Ursa/Loops-N-plus-one-half | 1 + Lang/Ursa/Loops-While | 1 + Lang/Ursa/Menu | 1 + Lang/Ursa/Morse-code | 1 + Lang/Ursa/Null-object | 1 + Lang/Ursa/Old-lady-swallowed-a-fly | 1 + Lang/Ursa/Pick-random-element | 1 + Lang/Ursa/Program-termination | 1 + Lang/Ursa/README | 1 + Lang/Ursa/Read-a-file-line-by-line | 1 + Lang/Ursa/Read-a-specific-line-from-a-file | 1 + Lang/Ursa/Read-entire-file | 1 + Lang/Ursa/Return-multiple-values | 1 + Lang/Ursa/Runtime-evaluation | 1 + Lang/Ursa/Sleep | 1 + Lang/Ursa/Sort-an-integer-array | 1 + Lang/Ursa/Special-variables | 1 + Lang/Ursa/String-append | 1 + Lang/Ursa/String-case | 1 + Lang/Ursa/String-concatenation | 1 + Lang/Ursa/String-prepend | 1 + Lang/Ursa/Sum-and-product-of-an-array | 1 + Lang/Ursa/Sum-digits-of-an-integer | 1 + Lang/Ursa/System-time | 1 + Lang/Ursa/Temperature-conversion | 1 + Lang/Ursa/Tokenize-a-string | 1 + Lang/Ursa/Unix-ls | 1 + Lang/Ursa/User-input-Text | 1 + Lang/Ursa/Variables | 1 + Lang/Ursa/Zero-to-the-zero-power | 1 + Lang/VAX-Assembly/00DESCRIPTION | 1 + Lang/VAX-Assembly/README | 1 + Lang/Visual-FoxPro/00DESCRIPTION | 8 + Lang/Visual-FoxPro/Associative-array-Creation | 1 + Lang/Visual-FoxPro/Benfords-law | 1 + Lang/Visual-FoxPro/Binary-digits | 1 + Lang/Visual-FoxPro/CSV-data-manipulation | 1 + ...Circles-of-given-radius-through-two-points | 1 + Lang/Visual-FoxPro/Classes | 1 + Lang/Visual-FoxPro/Closest-pair-problem | 1 + Lang/Visual-FoxPro/Collections | 1 + .../Define-a-primitive-data-type | 1 + .../Visual-FoxPro/Dutch-national-flag-problem | 1 + Lang/Visual-FoxPro/Forward-difference | 1 + Lang/Visual-FoxPro/Gamma-function | 1 + Lang/Visual-FoxPro/Generic-swap | 1 + Lang/Visual-FoxPro/Handle-a-signal | 1 + Lang/Visual-FoxPro/Harshad-or-Niven-series | 1 + Lang/Visual-FoxPro/Hash-join | 1 + Lang/Visual-FoxPro/Hello-world-Graphical | 1 + Lang/Visual-FoxPro/Hofstadter-Q-sequence | 1 + .../Horners-rule-for-polynomial-evaluation | 1 + Lang/Visual-FoxPro/Last-Friday-of-each-month | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/Visual-FoxPro/Matrix-multiplication | 1 + Lang/Visual-FoxPro/README | 1 + Lang/Visual-FoxPro/Random-numbers | 1 + Lang/Visual-FoxPro/Ranking-methods | 1 + Lang/Visual-FoxPro/Reduced-row-echelon-form | 1 + Lang/Visual-FoxPro/Remove-duplicate-elements | 1 + Lang/Visual-FoxPro/Repeat-a-string | 1 + Lang/Visual-FoxPro/Return-multiple-values | 1 + Lang/Visual-FoxPro/SEDOLs | 1 + Lang/Visual-FoxPro/Short-circuit-evaluation | 1 + .../Table-creation-Postal-addresses | 1 + Lang/Visual-FoxPro/Temperature-conversion | 1 + Lang/Wart/00DESCRIPTION | 34 + Lang/Wart/100-doors | 1 + Lang/Wart/Accumulator-factory | 1 + Lang/Wart/Ackermann-function | 1 + Lang/Wart/Address-of-a-variable | 1 + Lang/Wart/Anonymous-recursion | 1 + Lang/Wart/Apply-a-callback-to-an-array | 1 + Lang/Wart/Arithmetic-Integer | 1 + Lang/Wart/Array-concatenation | 1 + Lang/Wart/Associative-array-Creation | 1 + Lang/Wart/Associative-array-Iteration | 1 + Lang/Wart/Averages-Arithmetic-mean | 1 + Lang/Wart/Bitmap-Bresenhams-line-algorithm | 1 + Lang/Wart/Comments | 1 + Lang/Wart/Dot-product | 1 + Lang/Wart/Execute-a-system-command | 1 + Lang/Wart/Factorial | 1 + Lang/Wart/Fibonacci-sequence | 1 + Lang/Wart/File-input-output | 1 + Lang/Wart/FizzBuzz | 1 + Lang/Wart/Flatten-a-list | 1 + Lang/Wart/Fork | 1 + Lang/Wart/Function-definition | 1 + Lang/Wart/Generic-swap | 1 + Lang/Wart/Greatest-element-of-a-list | 1 + Lang/Wart/Hello-world-Text | 1 + Lang/Wart/Hello-world-Web-server | 1 + Lang/Wart/Integer-comparison | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/Wart/Loops-Downward-for | 1 + Lang/Wart/Loops-For | 1 + Lang/Wart/Loops-For-with-a-specified-step | 1 + Lang/Wart/Loops-Foreach | 1 + Lang/Wart/Loops-Infinite | 1 + Lang/Wart/Loops-N-plus-one-half | 1 + Lang/Wart/Loops-While | 1 + Lang/Wart/Middle-three-digits | 1 + Lang/Wart/Null-object | 1 + Lang/Wart/One-dimensional-cellular-automata | 1 + Lang/Wart/Order-two-numerical-lists | 1 + Lang/Wart/Queue-Definition | 1 + Lang/Wart/README | 1 + Lang/Wart/Read-a-file-line-by-line | 1 + Lang/Wart/Read-entire-file | 1 + Lang/Wart/Remove-duplicate-elements | 1 + Lang/Wart/Repeat-a-string | 1 + Lang/Wart/Reverse-a-string | 1 + Lang/Wart/Rot-13 | 1 + Lang/Wart/Search-a-list | 1 + Lang/Wart/Shell-one-liner | 1 + Lang/Wart/Singly-linked-list-Traversal | 1 + Lang/Wart/Sorting-algorithms-Quicksort | 1 + Lang/Wart/Stack | 1 + Lang/Wart/String-append | 1 + Lang/Wart/String-prepend | 1 + Lang/Wart/Substring | 1 + Lang/Wart/Sum-and-product-of-an-array | 1 + Lang/Wart/Time-a-function | 1 + Lang/Wart/Y-combinator | 1 + Lang/Wolfram-Language/00DESCRIPTION | 9 + Lang/Wolfram-Language/Hello-world-Text | 1 + Lang/Wolfram-Language/README | 1 + Lang/Wollok/00DESCRIPTION | 12 + Lang/Wollok/Polymorphism | 1 + Lang/Wollok/README | 1 + Lang/Wortel/00DESCRIPTION | 6 + Lang/Wortel/100-doors | 1 + Lang/Wortel/99-Bottles-of-Beer | 1 + Lang/Wortel/Arithmetic-Complex | 1 + Lang/Wortel/Averages-Arithmetic-mean | 1 + Lang/Wortel/Averages-Median | 1 + Lang/Wortel/Averages-Root-mean-square | 1 + Lang/Wortel/Binary-digits | 1 + Lang/Wortel/Binary-search | 1 + Lang/Wortel/Caesar-cipher | 1 + Lang/Wortel/Catalan-numbers | 1 + Lang/Wortel/Catamorphism | 1 + Lang/Wortel/Conways-Game-of-Life | 1 + Lang/Wortel/Count-occurrences-of-a-substring | 1 + Lang/Wortel/Currying | 1 + Lang/Wortel/Day-of-the-week | 1 + Lang/Wortel/Digital-root | 1 + Lang/Wortel/Factorial | 1 + Lang/Wortel/Factors-of-an-integer | 1 + Lang/Wortel/FizzBuzz | 1 + Lang/Wortel/Function-composition | 1 + Lang/Wortel/Greatest-common-divisor | 1 + Lang/Wortel/Greatest-element-of-a-list | 1 + Lang/Wortel/Guess-the-number | 1 + Lang/Wortel/Hash-from-two-arrays | 1 + Lang/Wortel/Identity-matrix | 1 + Lang/Wortel/Inverted-syntax | 1 + Lang/Wortel/Kaprekar-numbers | 1 + Lang/Wortel/Leap-year | 1 + Lang/Wortel/Least-common-multiple | 1 + Lang/Wortel/Matrix-transposition | 1 + Lang/Wortel/Multifactorial | 1 + Lang/Wortel/Palindrome-detection | 1 + Lang/Wortel/Pernicious-numbers | 1 + Lang/Wortel/README | 1 + Lang/Wortel/Remove-duplicate-elements | 1 + Lang/Wortel/Repeat-a-string | 1 + Lang/Wortel/Reverse-a-string | 1 + Lang/Wortel/Sort-an-integer-array | 1 + Lang/Wortel/Sum-and-product-of-an-array | 1 + Lang/Wortel/Sum-multiples-of-3-and-5 | 1 + Lang/Wortel/Sum-of-a-series | 1 + Lang/Wortel/Sum-of-squares | 1 + Lang/Wortel/Tokenize-a-string | 1 + Lang/Wortel/Vector-products | 1 + Lang/Wren/00DESCRIPTION | 11 + Lang/Wren/100-doors | 1 + Lang/Wren/99-Bottles-of-Beer | 1 + Lang/Wren/A+B | 1 + Lang/Wren/Ackermann-function | 1 + Lang/Wren/Anonymous-recursion | 1 + Lang/Wren/Apply-a-callback-to-an-array | 1 + Lang/Wren/Arithmetic-Integer | 1 + Lang/Wren/Array-concatenation | 1 + Lang/Wren/Arrays | 1 + Lang/Wren/Averages-Arithmetic-mean | 1 + Lang/Wren/Averages-Mode | 1 + Lang/Wren/Collections | 1 + Lang/Wren/Hello-world-Newline-omission | 1 + Lang/Wren/Hello-world-Text | 1 + Lang/Wren/README | 1 + Lang/Wren/String-length | 1 + Lang/XEec/00DESCRIPTION | 9 + Lang/XEec/README | 1 + Lang/XLISP/00DESCRIPTION | 2 + Lang/XLISP/A+B | 1 + Lang/XLISP/Ackermann-function | 1 + Lang/XLISP/Arithmetic-Integer | 1 + Lang/XLISP/Arrays | 1 + Lang/XLISP/Associative-array-Creation | 1 + Lang/XLISP/Averages-Arithmetic-mean | 1 + Lang/XLISP/Averages-Root-mean-square | 1 + Lang/XLISP/Caesar-cipher | 1 + Lang/XLISP/Calendar | 1 + Lang/XLISP/Calendar---for-REAL-programmers | 1 + Lang/XLISP/Call-a-function | 1 + Lang/XLISP/Call-an-object-method | 1 + Lang/XLISP/Case-sensitivity-of-identifiers | 1 + Lang/XLISP/Character-codes | 1 + Lang/XLISP/Classes | 1 + Lang/XLISP/Comma-quibbling | 1 + Lang/XLISP/Comments | 1 + Lang/XLISP/Compile-time-calculation | 1 + Lang/XLISP/Determine-if-a-string-is-numeric | 1 + Lang/XLISP/Fibonacci-sequence | 1 + Lang/XLISP/FizzBuzz | 1 + Lang/XLISP/Function-definition | 1 + Lang/XLISP/Generate-lower-case-ASCII-alphabet | 1 + Lang/XLISP/Guess-the-number | 1 + Lang/XLISP/Guess-the-number-With-feedback | 1 + Lang/XLISP/Hello-world-Newline-omission | 1 + Lang/XLISP/Hello-world-Standard-error | 1 + Lang/XLISP/Hello-world-Text | 1 + Lang/XLISP/Increment-a-numerical-string | 1 + Lang/XLISP/Inheritance-Single | 1 + Lang/XLISP/Integer-comparison | 1 + Lang/XLISP/Interactive-programming | 1 + Lang/XLISP/Leap-year | 1 + Lang/XLISP/Logical-operations | 1 + Lang/XLISP/Loops-For | 1 + Lang/XLISP/Loops-Foreach | 1 + Lang/XLISP/Loops-While | 1 + Lang/XLISP/Nth | 1 + Lang/XLISP/Queue-Definition | 1 + Lang/XLISP/README | 1 + Lang/XLISP/Roman-numerals-Decode | 1 + Lang/XLISP/Roman-numerals-Encode | 1 + Lang/XLISP/Sequence-of-non-squares | 1 + Lang/XLISP/Special-variables | 1 + Lang/XLISP/Stack | 1 + Lang/XLISP/Sum-of-squares | 1 + Lang/XLISP/Temperature-conversion | 1 + Lang/XLISP/Variadic-function | 1 + Lang/XLISP/Zero-to-the-zero-power | 1 + Lang/XPath-2.0/00DESCRIPTION | 9 + Lang/XPath-2.0/FizzBuzz | 1 + Lang/XPath-2.0/README | 1 + Lang/Xojo/00DESCRIPTION | 10 + Lang/Xojo/99-Bottles-of-Beer | 1 + Lang/Xojo/Luhn-test-of-credit-card-numbers | 1 + Lang/Xojo/README | 1 + Lang/Ya/00DESCRIPTION | 105 +++ Lang/Ya/Balanced-brackets | 1 + Lang/Ya/README | 1 + Lang/Zkl/00DESCRIPTION | 24 + Lang/Zkl/README | 1 + Lang/jq/00DESCRIPTION | 6 + Lang/jq/100-doors | 1 + Lang/jq/24-game-Solve | 1 + Lang/jq/99-Bottles-of-Beer | 1 + Lang/jq/A+B | 1 + Lang/jq/ABC-Problem | 1 + Lang/jq/AKS-test-for-primes | 1 + ...ficient-and-perfect-number-classifications | 1 + Lang/jq/Ackermann-function | 1 + ...-a-variable-to-a-class-instance-at-runtime | 1 + Lang/jq/Align-columns | 1 + Lang/jq/Aliquot-sequence-classifications | 1 + Lang/jq/Almost-prime | 1 + Lang/jq/Amb | 1 + Lang/jq/Amicable-pairs | 1 + Lang/jq/Anagrams | 1 + Lang/jq/Anonymous-recursion | 1 + Lang/jq/Apply-a-callback-to-an-array | 1 + Lang/jq/Arithmetic-Complex | 1 + Lang/jq/Arithmetic-Integer | 1 + Lang/jq/Arithmetic-geometric-mean | 1 + Lang/jq/Array-concatenation | 1 + Lang/jq/Arrays | 1 + Lang/jq/Associative-array-Creation | 1 + Lang/jq/Averages-Arithmetic-mean | 1 + Lang/jq/Averages-Mean-angle | 1 + Lang/jq/Averages-Mean-time-of-day | 1 + Lang/jq/Averages-Median | 1 + Lang/jq/Averages-Mode | 1 + Lang/jq/Averages-Pythagorean-means | 1 + Lang/jq/Averages-Root-mean-square | 1 + Lang/jq/Benfords-law | 1 + Lang/jq/Bernoulli-numbers | 1 + Lang/jq/Binary-digits | 1 + Lang/jq/Binary-search | 1 + Lang/jq/Binary-strings | 1 + Lang/jq/CSV-data-manipulation | 1 + Lang/jq/CSV-to-HTML-translation | 1 + Lang/jq/Case-sensitivity-of-identifiers | 1 + Lang/jq/Casting-out-nines | 1 + Lang/jq/Catalan-numbers | 1 + Lang/jq/Catalan-numbers-Pascals-triangle | 1 + Lang/jq/Character-codes | 1 + Lang/jq/Chinese-remainder-theorem | 1 + Lang/jq/Cholesky-decomposition | 1 + ...Circles-of-given-radius-through-two-points | 1 + Lang/jq/Closest-pair-problem | 1 + Lang/jq/Collections | 1 + Lang/jq/Combinations | 1 + Lang/jq/Combinations-and-permutations | 1 + Lang/jq/Combinations-with-repetitions | 1 + Lang/jq/Comma-quibbling | 1 + Lang/jq/Comments | 1 + Lang/jq/Compound-data-type | 1 + Lang/jq/Conditional-structures | 1 + Lang/jq/Conjugate-transpose | 1 + Lang/jq/Continued-fraction | 1 + Lang/jq/Conways-Game-of-Life | 1 + Lang/jq/Copy-a-string | 1 + Lang/jq/Count-occurrences-of-a-substring | 1 + Lang/jq/Count-the-coins | 1 + .../Create-a-two-dimensional-array-at-runtime | 1 + Lang/jq/Create-an-HTML-table | 1 + Lang/jq/Currying | 1 + Lang/jq/Date-format | 1 + Lang/jq/Date-manipulation | 1 + Lang/jq/Day-of-the-week | 1 + Lang/jq/Define-a-primitive-data-type | 1 + Lang/jq/Detect-division-by-zero | 1 + Lang/jq/Determine-if-a-string-is-numeric | 1 + Lang/jq/Digital-root | 1 + .../Digital-root-Multiplicative-digital-root | 1 + Lang/jq/Dinesmans-multiple-dwelling-problem | 1 + Lang/jq/Dot-product | 1 + Lang/jq/Dragon-curve | 1 + Lang/jq/Draw-a-sphere | 1 + Lang/jq/Element-wise-operations | 1 + Lang/jq/Empty-string | 1 + Lang/jq/Enforced-immutability | 1 + Lang/jq/Entropy | 1 + Lang/jq/Enumerations | 1 + Lang/jq/Environment-variables | 1 + Lang/jq/Equilibrium-index | 1 + Lang/jq/Euler-method | 1 + Lang/jq/Evaluate-binomial-coefficients | 1 + Lang/jq/Even-or-odd | 1 + Lang/jq/Exceptions | 1 + ...Catch-an-exception-thrown-in-a-nested-call | 1 + Lang/jq/Exponentiation-operator | 1 + Lang/jq/Extensible-prime-generator | 1 + Lang/jq/Extreme-floating-point-values | 1 + Lang/jq/Factorial | 1 + Lang/jq/Factors-of-an-integer | 1 + Lang/jq/Fast-Fourier-transform | 1 + Lang/jq/Fibonacci-n-step-number-sequences | 1 + Lang/jq/Fibonacci-sequence | 1 + Lang/jq/Fibonacci-word | 1 + Lang/jq/File-input-output | 1 + Lang/jq/File-size | 1 + Lang/jq/Filter | 1 + Lang/jq/Find-common-directory-path | 1 + Lang/jq/Find-limit-of-recursion | 1 + Lang/jq/Find-the-last-Sunday-of-each-month | 1 + Lang/jq/Find-the-missing-permutation | 1 + ...st-class-functions-Use-numbers-analogously | 1 + Lang/jq/Five-weekends | 1 + Lang/jq/FizzBuzz | 1 + Lang/jq/Flatten-a-list | 1 + Lang/jq/Floyds-triangle | 1 + Lang/jq/Formal-power-series | 1 + Lang/jq/Formatted-numeric-output | 1 + Lang/jq/Forward-difference | 1 + Lang/jq/Four-bit-adder | 1 + Lang/jq/Fractal-tree | 1 + Lang/jq/Function-composition | 1 + Lang/jq/Function-definition | 1 + Lang/jq/Gamma-function | 1 + Lang/jq/Generate-lower-case-ASCII-alphabet | 1 + Lang/jq/Generator-Exponential | 1 + Lang/jq/Generic-swap | 1 + Lang/jq/Greatest-common-divisor | 1 + Lang/jq/Greatest-element-of-a-list | 1 + Lang/jq/Greatest-subsequential-sum | 1 + Lang/jq/Hailstone-sequence | 1 + Lang/jq/Hamming-numbers | 1 + Lang/jq/Happy-numbers | 1 + Lang/jq/Harshad-or-Niven-series | 1 + Lang/jq/Hash-from-two-arrays | 1 + Lang/jq/Hash-join | 1 + Lang/jq/Haversine-formula | 1 + Lang/jq/Hello-world-Graphical | 1 + Lang/jq/Hello-world-Newbie | 1 + Lang/jq/Hello-world-Newline-omission | 1 + Lang/jq/Hello-world-Standard-error | 1 + Lang/jq/Hello-world-Text | 1 + Lang/jq/Here-document | 1 + Lang/jq/Heronian-triangles | 1 + Lang/jq/Hickerson-series-of-almost-integers | 1 + Lang/jq/Higher-order-functions | 1 + Lang/jq/Hofstadter-Q-sequence | 1 + Lang/jq/I-before-E-except-after-C | 1 + Lang/jq/IBAN | 1 + Lang/jq/Identity-matrix | 1 + Lang/jq/Include-a-file | 1 + Lang/jq/Increment-a-numerical-string | 1 + Lang/jq/Infinity | 1 + Lang/jq/Input-loop | 1 + Lang/jq/Integer-comparison | 1 + Lang/jq/Integer-sequence | 1 + Lang/jq/Inverted-index | 1 + Lang/jq/Inverted-syntax | 1 + Lang/jq/Iterated-digits-squaring | 1 + Lang/jq/JSON | 1 + Lang/jq/Jensens-Device | 1 + Lang/jq/Josephus-problem | 1 + Lang/jq/Jump-anywhere | 1 + Lang/jq/Kaprekar-numbers | 1 + Lang/jq/Knapsack-problem-0-1 | 1 + Lang/jq/Knapsack-problem-Continuous | 1 + Lang/jq/LU-decomposition | 1 + Lang/jq/LZW-compression | 1 + Lang/jq/Langtons-ant | 1 + Lang/jq/Largest-int-from-concatenated-ints | 1 + Lang/jq/Last-Friday-of-each-month | 1 + Lang/jq/Last-letter-first-letter | 1 + Lang/jq/Leap-year | 1 + Lang/jq/Least-common-multiple | 1 + Lang/jq/Left-factorials | 1 + Lang/jq/Letter-frequency | 1 + Lang/jq/Levenshtein-distance | 1 + Lang/jq/Linear-congruential-generator | 1 + Lang/jq/List-comprehensions | 1 + Lang/jq/Literals-Floating-point | 1 + Lang/jq/Logical-operations | 1 + Lang/jq/Long-multiplication | 1 + Lang/jq/Longest-common-subsequence | 1 + Lang/jq/Longest-increasing-subsequence | 1 + Lang/jq/Look-and-say-sequence | 1 + .../Loop-over-multiple-arrays-simultaneously | 1 + Lang/jq/Loops-Continue | 1 + Lang/jq/Loops-Do-while | 1 + Lang/jq/Loops-Downward-for | 1 + Lang/jq/Loops-For | 1 + Lang/jq/Loops-For-with-a-specified-step | 1 + Lang/jq/Loops-Foreach | 1 + Lang/jq/Loops-Infinite | 1 + Lang/jq/Loops-N-plus-one-half | 1 + Lang/jq/Loops-While | 1 + Lang/jq/Luhn-test-of-credit-card-numbers | 1 + Lang/jq/Magic-squares-of-odd-order | 1 + Lang/jq/Mandelbrot-set | 1 + Lang/jq/Map-range | 1 + Lang/jq/Matrix-arithmetic | 1 + Lang/jq/Matrix-exponentiation-operator | 1 + Lang/jq/Matrix-multiplication | 1 + Lang/jq/Matrix-transposition | 1 + Lang/jq/Maximum-triangle-path-sum | 1 + Lang/jq/Menu | 1 + Lang/jq/Middle-three-digits | 1 + Lang/jq/Move-to-front-algorithm | 1 + Lang/jq/Multifactorial | 1 + Lang/jq/Multiple-distinct-objects | 1 + Lang/jq/Multisplit | 1 + Lang/jq/Munching-squares | 1 + Lang/jq/Mutual-recursion | 1 + Lang/jq/N-queens-problem | 1 + Lang/jq/Named-parameters | 1 + Lang/jq/Narcissistic-decimal-number | 1 + Lang/jq/Natural-sorting | 1 + Lang/jq/Non-continuous-subsequences | 1 + Lang/jq/Non-decimal-radices-Convert | 1 + Lang/jq/Nth | 1 + Lang/jq/Nth-root | 1 + Lang/jq/Null-object | 1 + Lang/jq/Number-names | 1 + Lang/jq/One-dimensional-cellular-automata | 1 + Lang/jq/Optional-parameters | 1 + Lang/jq/Order-disjoint-list-items | 1 + Lang/jq/Order-two-numerical-lists | 1 + Lang/jq/Ordered-Partitions | 1 + Lang/jq/Ordered-words | 1 + Lang/jq/Palindrome-detection | 1 + Lang/jq/Pangram-checker | 1 + Lang/jq/Paraffins | 1 + Lang/jq/Pascals-triangle | 1 + Lang/jq/Perfect-numbers | 1 + Lang/jq/Permutation-test | 1 + Lang/jq/Permutations | 1 + Lang/jq/Permutations-Derangements | 1 + Lang/jq/Permutations-by-swapping | 1 + Lang/jq/Pernicious-numbers | 1 + Lang/jq/Phrase-reversals | 1 + Lang/jq/Pi | 1 + Lang/jq/Plot-coordinate-pairs | 1 + Lang/jq/Power-set | 1 + Lang/jq/Price-fraction | 1 + Lang/jq/Prime-decomposition | 1 + Lang/jq/Priority-queue | 1 + Lang/jq/Problem-of-Apollonius | 1 + Lang/jq/Program-termination | 1 + Lang/jq/Pythagorean-triples | 1 + Lang/jq/Quaternion-type | 1 + Lang/jq/Queue-Definition | 1 + Lang/jq/Quickselect-algorithm | 1 + Lang/jq/README | 1 + Lang/jq/Random-numbers | 1 + Lang/jq/Range-expansion | 1 + Lang/jq/Range-extraction | 1 + Lang/jq/Ranking-methods | 1 + Lang/jq/Read-a-file-line-by-line | 1 + Lang/jq/Read-a-specific-line-from-a-file | 1 + Lang/jq/Read-entire-file | 1 + Lang/jq/Real-constants-and-functions | 1 + Lang/jq/Regular-expressions | 1 + Lang/jq/Remove-duplicate-elements | 1 + Lang/jq/Remove-lines-from-a-file | 1 + Lang/jq/Rep-string | 1 + Lang/jq/Repeat-a-string | 1 + Lang/jq/Return-multiple-values | 1 + Lang/jq/Reverse-a-string | 1 + Lang/jq/Reverse-words-in-a-string | 1 + Lang/jq/Roman-numerals-Decode | 1 + Lang/jq/Roots-of-a-function | 1 + Lang/jq/Roots-of-a-quadratic-function | 1 + Lang/jq/Roots-of-unity | 1 + Lang/jq/Rot-13 | 1 + Lang/jq/Run-length-encoding | 1 + Lang/jq/Runge-Kutta-method | 1 + Lang/jq/SEDOLs | 1 + Lang/jq/Same-Fringe | 1 + Lang/jq/Scope-Function-names-and-labels | 1 + Lang/jq/Search-a-list | 1 + Lang/jq/Self-describing-numbers | 1 + Lang/jq/Self-referential-sequence | 1 + Lang/jq/Semordnilap | 1 + Lang/jq/Sequence-of-non-squares | 1 + Lang/jq/Sequence-of-primes-by-Trial-Division | 1 + Lang/jq/Set | 1 + Lang/jq/Set-consolidation | 1 + Lang/jq/Shell-one-liner | 1 + Lang/jq/Short-circuit-evaluation | 1 + Lang/jq/Show-the-epoch | 1 + Lang/jq/Sierpinski-carpet | 1 + Lang/jq/Sieve-of-Eratosthenes | 1 + Lang/jq/Singly-linked-list-Traversal | 1 + Lang/jq/Solve-the-no-connection-puzzle | 1 + Lang/jq/Sort-an-array-of-composite-structures | 1 + Lang/jq/Sort-an-integer-array | 1 + Lang/jq/Sort-disjoint-sublist | 1 + Lang/jq/Sort-using-a-custom-comparator | 1 + Lang/jq/Sorting-algorithms-Bead-sort | 1 + Lang/jq/Sorting-algorithms-Bubble-sort | 1 + Lang/jq/Sorting-algorithms-Cocktail-sort | 1 + Lang/jq/Sorting-algorithms-Comb-sort | 1 + Lang/jq/Sorting-algorithms-Counting-sort | 1 + Lang/jq/Sorting-algorithms-Gnome-sort | 1 + Lang/jq/Sorting-algorithms-Insertion-sort | 1 + Lang/jq/Sorting-algorithms-Merge-sort | 1 + Lang/jq/Sorting-algorithms-Pancake-sort | 1 + Lang/jq/Sorting-algorithms-Permutation-sort | 1 + Lang/jq/Sorting-algorithms-Quicksort | 1 + Lang/jq/Sorting-algorithms-Radix-sort | 1 + Lang/jq/Sorting-algorithms-Selection-sort | 1 + Lang/jq/Sorting-algorithms-Shell-sort | 1 + Lang/jq/Sorting-algorithms-Sleep-sort | 1 + Lang/jq/Sorting-algorithms-Stooge-sort | 1 + Lang/jq/Sorting-algorithms-Strand-sort | 1 + Lang/jq/Sparkline-in-unicode | 1 + Lang/jq/Special-characters | 1 + Lang/jq/Special-variables | 1 + Lang/jq/Spiral-matrix | 1 + Lang/jq/Stair-climbing-puzzle | 1 + Lang/jq/State-name-puzzle | 1 + Lang/jq/Stem-and-leaf-plot | 1 + Lang/jq/Stern-Brocot-sequence | 1 + Lang/jq/String-append | 1 + Lang/jq/String-case | 1 + Lang/jq/String-comparison | 1 + Lang/jq/String-concatenation | 1 + Lang/jq/String-interpolation--included- | 1 + Lang/jq/String-length | 1 + Lang/jq/String-matching | 1 + Lang/jq/String-prepend | 1 + .../Strip-a-set-of-characters-from-a-string | 1 + Lang/jq/Strip-block-comments | 1 + Lang/jq/Strip-comments-from-a-string | 1 + ...odes-and-extended-characters-from-a-string | 1 + ...trip-whitespace-from-a-string-Top-and-tail | 1 + Lang/jq/Substring | 1 + Lang/jq/Substring-Top-and-tail | 1 + Lang/jq/Sum-and-product-of-an-array | 1 + Lang/jq/Sum-digits-of-an-integer | 1 + Lang/jq/Sum-multiples-of-3-and-5 | 1 + Lang/jq/Sum-of-a-series | 1 + Lang/jq/Sum-of-squares | 1 + Lang/jq/Symmetric-difference | 1 + Lang/jq/System-time | 1 + Lang/jq/Temperature-conversion | 1 + Lang/jq/Terminal-control-Clear-the-screen | 1 + Lang/jq/Terminal-control-Unicode-output | 1 + Lang/jq/Ternary-logic | 1 + Lang/jq/Test-a-function | 1 + Lang/jq/Text-processing-1 | 1 + Lang/jq/Text-processing-2 | 1 + Lang/jq/Text-processing-Max-licenses-in-use | 1 + Lang/jq/Textonyms | 1 + Lang/jq/Tokenize-a-string | 1 + Lang/jq/Top-rank-per-group | 1 + Lang/jq/Topological-sort | 1 + Lang/jq/Topswops | 1 + Lang/jq/Towers-of-Hanoi | 1 + Lang/jq/Trabb-Pardo-Knuth-algorithm | 1 + Lang/jq/Tree-traversal | 1 + Lang/jq/Trigonometric-functions | 1 + Lang/jq/Twelve-statements | 1 + Lang/jq/URL-decoding | 1 + Lang/jq/URL-encoding | 1 + Lang/jq/Undefined-values | 1 + Lang/jq/User-input-Text | 1 + Lang/jq/Van-der-Corput-sequence | 1 + Lang/jq/Variables | 1 + Lang/jq/Variadic-function | 1 + Lang/jq/Vector-products | 1 + Lang/jq/Web-scraping | 1 + Lang/jq/Wireworld | 1 + Lang/jq/Word-wrap | 1 + Lang/jq/Write-float-arrays-to-a-text-file | 1 + Lang/jq/Yin-and-yang | 1 + Lang/jq/Zebra-puzzle | 1 + Lang/jq/Zeckendorf-number-representation | 1 + Lang/jq/Zero-to-the-zero-power | 1 + Lang/jq/Zig-zag-matrix | 1 + Task/100-doors/68000-Assembly/100-doors.68000 | 110 +++ Task/100-doors/8th/100-doors.8th | 31 + Task/100-doors/Ceylon/100-doors.ceylon | 23 + Task/100-doors/Clarion/100-doors.clarion | 37 + Task/100-doors/Coco/100-doors.coco | 8 + .../Commodore-BASIC/100-doors.commodore | 8 + Task/100-doors/Crystal/100-doors.crystal | 11 + Task/100-doors/ECL/100-doors-1.ecl | 15 + Task/100-doors/ECL/100-doors-2.ecl | 30 + Task/100-doors/ECL/100-doors-3.ecl | 23 + Task/100-doors/ERRE/100-doors.erre | 29 + Task/100-doors/EchoLisp/100-doors.echolisp | 21 + Task/100-doors/Eero/100-doors.eero | 16 + Task/100-doors/FUZE-BASIC/100-doors.fuze | 10 + .../100-doors/FreeBASIC/100-doors-1.freebasic | 32 + .../100-doors/FreeBASIC/100-doors-2.freebasic | 33 + .../100-doors/FreeBASIC/100-doors-3.freebasic | 21 + Task/100-doors/FunL/100-doors-1.funl | 3 + Task/100-doors/FunL/100-doors-2.funl | 4 + Task/100-doors/Futhark/100-doors.futhark | 11 + .../FutureBasic/100-doors.futurebasic | 14 + Task/100-doors/GFA-Basic/100-doors.gfa | 34 + Task/100-doors/Harbour/100-doors-1.harbour | 13 + Task/100-doors/Harbour/100-doors-2.harbour | 8 + Task/100-doors/Hy/100-doors.hy | 10 + Task/100-doors/I/100-doors.i | 18 + Task/100-doors/Idris/100-doors.idris | 35 + Task/100-doors/Lasso/100-doors.lasso | 5 + Task/100-doors/Lily/100-doors.lily | 15 + Task/100-doors/LiveCode/100-doors.livecode | 9 + Task/100-doors/MoonScript/100-doors.moon | 8 + Task/100-doors/Nim/100-doors-1.nim | 16 + Task/100-doors/Nim/100-doors-2.nim | 9 + Task/100-doors/Oforth/100-doors.oforth | 7 + Task/100-doors/PHL/100-doors-1.phl | 22 + Task/100-doors/PHL/100-doors-2.phl | 26 + Task/100-doors/Perl5i/100-doors.perl5i | 79 +++ Task/100-doors/Phix/100-doors-1.phix | 13 + Task/100-doors/Phix/100-doors-2.phix | 13 + Task/100-doors/Potion/100-doors.potion | 7 + Task/100-doors/Pyret/100-doors.pyret | 69 ++ Task/100-doors/Red/100-doors.red | 20 + Task/100-doors/Ring/100-doors-1.ring | 17 + Task/100-doors/Ring/100-doors-2.ring | 14 + .../100-doors/SequenceL/100-doors-1.sequencel | 14 + .../100-doors/SequenceL/100-doors-2.sequencel | 4 + Task/100-doors/Sidef/100-doors-1.sidef | 13 + Task/100-doors/Sidef/100-doors-2.sidef | 3 + .../100-doors/Sparkling/100-doors-1.sparkling | 21 + .../100-doors/Sparkling/100-doors-2.sparkling | 13 + Task/100-doors/Swift/100-doors-1.swift | 21 + Task/100-doors/Swift/100-doors-2.swift | 20 + Task/100-doors/Uniface/100-doors.uniface | 53 ++ Task/100-doors/Ursa/100-doors.ursa | 30 + Task/100-doors/Wart/100-doors.wart | 10 + Task/100-doors/Wortel/100-doors.wortel | 14 + Task/100-doors/Wren/100-doors-1.wren | 12 + Task/100-doors/Wren/100-doors-2.wren | 7 + Task/100-doors/jq/100-doors-1.jq | 13 + Task/100-doors/jq/100-doors-2.jq | 3 + Task/24-game-Solve/ERRE/24-game-solve.erre | 311 +++++++++ .../EchoLisp/24-game-solve.echolisp | 111 +++ Task/24-game-Solve/Phix/24-game-solve.phix | 121 ++++ .../24-game-Solve/Sidef/24-game-solve-1.sidef | 32 + .../24-game-Solve/Sidef/24-game-solve-2.sidef | 57 ++ Task/24-game-Solve/Swift/24-game-solve.swift | 172 +++++ Task/24-game-Solve/jq/24-game-solve-1.jq | 40 ++ Task/24-game-Solve/jq/24-game-solve-2.jq | 23 + Task/24-game-Solve/jq/24-game-solve-3.jq | 21 + Task/24-game-Solve/jq/24-game-solve-4.jq | 16 + Task/24-game/8th/24-game.8th | 109 +++ Task/24-game/Ceylon/24-game.ceylon | 221 ++++++ Task/24-game/EchoLisp/24-game.echolisp | 31 + Task/24-game/Lasso/24-game.lasso | 70 ++ Task/24-game/LiveCode/24-game-1.livecode | 5 + Task/24-game/LiveCode/24-game-2.livecode | 30 + Task/24-game/Nim/24-game.nim | 40 ++ Task/24-game/Oforth/24-game.oforth | 19 + Task/24-game/Phix/24-game.phix | 177 +++++ Task/24-game/Potion/24-game.potion | 40 ++ Task/24-game/Sidef/24-game.sidef | 36 + Task/24-game/Swift/24-game.swift | 74 ++ ...billion-names-of-god-the-integer.freebasic | 89 +++ .../9-billion-names-of-god-the-integer.lasso | 31 + .../9-billion-names-of-god-the-integer-1.nim | 26 + .../9-billion-names-of-god-the-integer-2.nim | 33 + .../9-billion-names-of-god-the-integer.phix | 52 ++ .../9-billion-names-of-god-the-integer.sidef | 28 + .../9-billion-names-of-god-the-integer.swift | 34 + .../8th/99-bottles-of-beer.8th | 20 + .../Apex/99-bottles-of-beer.apex | 7 + .../Axe/99-bottles-of-beer.axe | 10 + .../Battlestar/99-bottles-of-beer.battlestar | 139 ++++ .../Ceylon/99-bottles-of-beer.ceylon | 13 + .../ECL/99-bottles-of-beer.ecl | 22 + .../FunL/99-bottles-of-beer.funl | 30 + .../99-bottles-of-beer.futurebasic | 12 + .../Idris/99-bottles-of-beer.idris | 19 + .../Klong/99-bottles-of-beer.klong | 19 + .../Lambda-Prolog/99-bottles-of-beer-1.lambda | 5 + .../Lambda-Prolog/99-bottles-of-beer-2.lambda | 22 + .../Lambda-Prolog/99-bottles-of-beer-3.lambda | 1 + .../Lasso/99-bottles-of-beer-1.lasso | 15 + .../Lasso/99-bottles-of-beer-2.lasso | 6 + .../Lasso/99-bottles-of-beer-3.lasso | 11 + .../LiveCode/99-bottles-of-beer.livecode | 10 + .../Malbolge/99-bottles-of-beer-1.malbolge | 246 +++++++ .../Malbolge/99-bottles-of-beer-2.malbolge | 98 +++ .../MoonScript/99-bottles-of-beer.moon | 13 + .../Nim/99-bottles-of-beer-1.nim | 17 + .../Nim/99-bottles-of-beer-2.nim | 21 + .../Nim/99-bottles-of-beer-3.nim | 11 + .../Nim/99-bottles-of-beer-4.nim | 13 + .../Oforth/99-bottles-of-beer.oforth | 4 + .../PHL/99-bottles-of-beer.phl | 15 + .../Phix/99-bottles-of-beer.phix | 30 + .../Ra/99-bottles-of-beer.ra | 49 ++ .../Red/99-bottles-of-beer.red | 21 + .../Ring/99-bottles-of-beer.ring | 22 + .../SequenceL/99-bottles-of-beer.sequencel | 30 + .../Set-lang/99-bottles-of-beer.set | 97 +++ .../Sidef/99-bottles-of-beer-1.sidef | 8 + .../Sidef/99-bottles-of-beer-2.sidef | 7 + .../SkookumScript/99-bottles-of-beer.skookum | 9 + .../Sparkling/99-bottles-of-beer.sparkling | 10 + .../Swift/99-bottles-of-beer.swift | 6 + .../Symsyn/99-bottles-of-beer.symsyn | 19 + .../Ursa/99-bottles-of-beer.ursa | 24 + .../Wortel/99-bottles-of-beer.wortel | 4 + .../Wren/99-bottles-of-beer.wren | 6 + .../Xojo/99-bottles-of-beer.xojo | 9 + .../jq/99-bottles-of-beer-1.jq | 7 + .../jq/99-bottles-of-beer-2.jq | 17 + .../jq/99-bottles-of-beer-3.jq | 15 + .../jq/99-bottles-of-beer-4.jq | 16 + Task/A+B/8th/a+b.8th | 1 + Task/A+B/Apex/a+b.apex | 14 + Task/A+B/Arc/a+b.arc | 2 + Task/A+B/Ceylon/a+b.ceylon | 23 + Task/A+B/Computer-zero-Assembly/a+b.computer | 6 + Task/A+B/Crystal/a+b-1.crystal | 1 + Task/A+B/Crystal/a+b-2.crystal | 5 + Task/A+B/EDSAC-order-code/a+b.edsac | 33 + Task/A+B/ERRE/a+b.erre | 12 + Task/A+B/EchoLisp/a+b.echolisp | 1 + Task/A+B/FUZE-BASIC/a+b.fuze | 3 + Task/A+B/FreeBASIC/a+b.freebasic | 17 + Task/A+B/FunL/a+b.funl | 1 + Task/A+B/I/a+b.i | 6 + Task/A+B/Idris/a+b.idris | 4 + Task/A+B/L++/a+b.lpp | 5 + Task/A+B/Lasso/a+b.lasso | 1 + Task/A+B/LiveCode/a+b-1.livecode | 7 + Task/A+B/LiveCode/a+b-2.livecode | 10 + Task/A+B/Maude/a+b-1.maude | 1 + Task/A+B/Maude/a+b-2.maude | 12 + Task/A+B/MoonScript/a+b.moon | 2 + Task/A+B/Nim/a+b-1.nim | 3 + Task/A+B/Nim/a+b-2.nim | 5 + Task/A+B/Nim/a+b-3.nim | 19 + Task/A+B/Nit/a+b.nit | 4 + Task/A+B/Oforth/a+b.oforth | 1 + Task/A+B/Phix/a+b.phix | 65 ++ Task/A+B/Potion/a+b.potion | 13 + Task/A+B/Ra/a+b.ra | 25 + Task/A+B/Red/a+b.red | 1 + Task/A+B/Ring/a+b.ring | 9 + Task/A+B/SPAD/a+b.spad | 5 + Task/A+B/SSEM/a+b.ssem | 8 + Task/A+B/SequenceL/a+b.sequencel | 3 + Task/A+B/Sidef/a+b-1.sidef | 1 + Task/A+B/Sidef/a+b-2.sidef | 1 + Task/A+B/Sidef/a+b-3.sidef | 2 + Task/A+B/SmileBASIC/a+b.smilebasic | 3 + Task/A+B/Swift/a+b.swift | 12 + Task/A+B/TI-83-Hex-Assembly/a+b.ti-83 | 17 + Task/A+B/Ursa/a+b.ursa | 15 + Task/A+B/Wren/a+b.wren | 4 + Task/A+B/XLISP/a+b.xlisp | 7 + Task/A+B/jq/a+b-1.jq | 3 + Task/A+B/jq/a+b-2.jq | 6 + Task/A+B/jq/a+b-3.jq | 5 + Task/ABC-Problem/Apex/abc-problem.apex | 45 ++ Task/ABC-Problem/Ceylon/abc-problem-1.ceylon | 1 + Task/ABC-Problem/Ceylon/abc-problem-2.ceylon | 74 ++ Task/ABC-Problem/ERRE/abc-problem.erre | 28 + .../ABC-Problem/EchoLisp/abc-problem.echolisp | 16 + Task/ABC-Problem/Harbour/abc-problem.harbour | 32 + Task/ABC-Problem/Nim/abc-problem.nim | 33 + Task/ABC-Problem/Oforth/abc-problem.oforth | 10 + Task/ABC-Problem/Phix/abc-problem.phix | 44 ++ Task/ABC-Problem/Ring/abc-problem.ring | 24 + Task/ABC-Problem/SPAD/abc-problem.spad | 23 + .../SequenceL/abc-problem-1.sequencel | 29 + .../SequenceL/abc-problem-2.sequencel | 31 + Task/ABC-Problem/Sidef/abc-problem-1.sidef | 17 + Task/ABC-Problem/Sidef/abc-problem-2.sidef | 19 + Task/ABC-Problem/Swift/abc-problem.swift | 33 + Task/ABC-Problem/jq/abc-problem-1.jq | 29 + Task/ABC-Problem/jq/abc-problem-2.jq | 5 + .../EchoLisp/aks-test-for-primes-1.echolisp | 19 + .../EchoLisp/aks-test-for-primes-2.echolisp | 21 + .../FreeBASIC/aks-test-for-primes.freebasic | 75 ++ .../Idris/aks-test-for-primes.idris | 70 ++ .../Oforth/aks-test-for-primes.oforth | 13 + .../Phix/aks-test-for-primes.phix | 80 +++ .../Sidef/aks-test-for-primes.sidef | 23 + .../Swift/aks-test-for-primes.swift | 80 +++ .../jq/aks-test-for-primes-1.jq | 35 + .../jq/aks-test-for-primes-2.jq | 4 + .../jq/aks-test-for-primes-3.jq | 1 + .../jq/aks-test-for-primes-4.jq | 8 + .../jq/aks-test-for-primes-5.jq | 6 + .../jq/aks-test-for-primes-6.jq | 1 + .../jq/aks-test-for-primes-7.jq | 11 + .../jq/aks-test-for-primes-8.jq | 1 + .../jq/aks-test-for-primes-9.jq | 1 + Task/Abstract-type/Apex/abstract-type.apex | 23 + .../FreeBASIC/abstract-type.freebasic | 43 ++ Task/Abstract-type/Lasso/abstract-type.lasso | 21 + .../Abstract-type/Lingo/abstract-type-1.lingo | 5 + .../Abstract-type/Lingo/abstract-type-2.lingo | 12 + .../Abstract-type/Lingo/abstract-type-3.lingo | 11 + .../Abstract-type/Lingo/abstract-type-4.lingo | 10 + .../Abstract-type/Lingo/abstract-type-5.lingo | 12 + .../Abstract-type/Lingo/abstract-type-6.lingo | 3 + .../Abstract-type/Lingo/abstract-type-7.lingo | 20 + .../Abstract-type/Lingo/abstract-type-8.lingo | 3 + Task/Abstract-type/Nim/abstract-type.nim | 9 + Task/Abstract-type/Nit/abstract-type.nit | 18 + .../Oforth/abstract-type-1.oforth | 13 + .../Oforth/abstract-type-2.oforth | 11 + Task/Abstract-type/Red/abstract-type.red | 45 ++ Task/Abstract-type/Sidef/abstract-type.sidef | 17 + ...-and-perfect-number-classifications.ceylon | 13 + ...nd-perfect-number-classifications.echolisp | 25 + ...d-perfect-number-classifications.freebasic | 33 + ...ent-and-perfect-number-classifications.gfa | 45 ++ ...ent-and-perfect-number-classifications.nim | 24 + ...-and-perfect-number-classifications.oforth | 14 + ...nt-and-perfect-number-classifications.phix | 12 + ...nt-and-perfect-number-classifications.ring | 14 + ...t-and-perfect-number-classifications.sidef | 11 + ...t-and-perfect-number-classifications.swift | 41 ++ ...nt-and-perfect-number-classifications-1.jq | 11 + ...nt-and-perfect-number-classifications-2.jq | 8 + ...nt-and-perfect-number-classifications-3.jq | 2 + .../Ceylon/accumulator-factory.ceylon | 17 + .../ERRE/accumulator-factory.erre | 17 + .../EchoLisp/accumulator-factory.echolisp | 10 + .../FreeBASIC/accumulator-factory.freebasic | 49 ++ .../LFE/accumulator-factory-1.lfe | 5 + .../LFE/accumulator-factory-2.lfe | 13 + .../NGS/accumulator-factory.ngs | 13 + .../Nim/accumulator-factory.nim | 19 + .../Oforth/accumulator-factory-1.oforth | 4 + .../Oforth/accumulator-factory-2.oforth | 9 + .../Ring/accumulator-factory.ring | 22 + .../Sidef/accumulator-factory-1.sidef | 10 + .../Sidef/accumulator-factory-2.sidef | 8 + .../Swift/accumulator-factory.swift | 11 + .../Wart/accumulator-factory.wart | 2 + .../68000-Assembly/ackermann-function.68000 | 112 +++ .../8th/ackermann-function.8th | 75 ++ .../ERRE/ackermann-function.erre | 54 ++ .../Ezhil/ackermann-function.ezhil | 38 + .../FreeBASIC/ackermann-function.freebasic | 41 ++ .../FunL/ackermann-function.funl | 7 + .../Futhark/ackermann-function.futhark | 4 + .../ackermann-function.futurebasic | 36 + .../Idris/ackermann-function.idris | 4 + .../LFE/ackermann-function.lfe | 4 + .../Lasso/ackermann-function.lasso | 15 + .../LiveCode/ackermann-function.livecode | 10 + .../Luck/ackermann-function.luck | 5 + .../Nim/ackermann-function-1.nim | 7 + .../Nim/ackermann-function-2.nim | 32 + .../Oforth/ackermann-function.oforth | 4 + .../Phix/ackermann-function.phix | 37 + .../Potion/ackermann-function.potion | 11 + .../Ring/ackermann-function.ring | 19 + .../SPAD/ackermann-function.spad | 11 + .../Shen/ackermann-function.shen | 5 + .../Sidef/ackermann-function-1.sidef | 5 + .../Sidef/ackermann-function-2.sidef | 3 + .../Sidef/ackermann-function-3.sidef | 1 + .../Swift/ackermann-function.swift | 9 + .../Wart/ackermann-function.wart | 7 + .../Wren/ackermann-function.wren | 7 + .../XLISP/ackermann-function-1.xlisp | 5 + .../XLISP/ackermann-function-2.xlisp | 1 + .../XLISP/ackermann-function-3.xlisp | 1 + .../jq/ackermann-function-1.jq | 7 + .../jq/ackermann-function-2.jq | 3 + .../jq/ackermann-function-3.jq | 26 + .../jq/ackermann-function-4.jq | 29 + .../jq/ackermann-function-5.jq | 1 + .../jq/ackermann-function-6.jq | 1 + .../Ring/active-directory-connect.ring | 1 + .../EchoLisp/active-object-1.echolisp | 30 + .../EchoLisp/active-object-2.echolisp | 19 + Task/Active-object/Swift/active-object.swift | 65 ++ ...iable-to-a-class-instance-at-runtime.morfa | 62 ++ ...ariable-to-a-class-instance-at-runtime.red | 11 + ...riable-to-a-class-instance-at-runtime.ring | 6 + ...iable-to-a-class-instance-at-runtime.sidef | 4 + ...iable-to-a-class-instance-at-runtime.swift | 16 + ...riable-to-a-class-instance-at-runtime-1.jq | 1 + ...riable-to-a-class-instance-at-runtime-2.jq | 3 + .../Axe/address-of-a-variable-1.axe | 2 + .../Axe/address-of-a-variable-2.axe | 2 + .../ERRE/address-of-a-variable-1.erre | 4 + .../ERRE/address-of-a-variable-2.erre | 8 + .../address-of-a-variable-1.freebasic | 4 + .../address-of-a-variable-2.freebasic | 3 + .../address-of-a-variable.futurebasic | 9 + .../Nim/address-of-a-variable.nim | 4 + .../Phix/address-of-a-variable.phix | 24 + .../Sidef/address-of-a-variable.sidef | 3 + .../Swift/address-of-a-variable.swift | 31 + .../Wart/address-of-a-variable-1.wart | 2 + .../Wart/address-of-a-variable-2.wart | 2 + Task/Align-columns/8th/align-columns.8th | 44 ++ .../FreeBASIC/align-columns.freebasic | 98 +++ Task/Align-columns/Lasso/align-columns.lasso | 67 ++ Task/Align-columns/Nim/align-columns.nim | 22 + .../Align-columns/Oforth/align-columns.oforth | 15 + Task/Align-columns/Phix/align-columns.phix | 67 ++ Task/Align-columns/Red/align-columns.red | 59 ++ Task/Align-columns/Sidef/align-columns.sidef | 47 ++ Task/Align-columns/jq/align-columns-1.jq | 43 ++ Task/Align-columns/jq/align-columns-2.jq | 3 + Task/Align-columns/jq/align-columns-3.jq | 24 + ...liquot-sequence-classifications-1.echolisp | 54 ++ ...liquot-sequence-classifications-2.echolisp | 39 ++ .../aliquot-sequence-classifications.oforth | 27 + .../aliquot-sequence-classifications.phix | 33 + .../jq/aliquot-sequence-classifications-1.jq | 59 ++ .../jq/aliquot-sequence-classifications-2.jq | 26 + Task/Almost-prime/ERRE/almost-prime.erre | 36 + .../EchoLisp/almost-prime-1.echolisp | 11 + .../EchoLisp/almost-prime-2.echolisp | 7 + .../EchoLisp/almost-prime-3.echolisp | 50 ++ .../EchoLisp/almost-prime-4.echolisp | 8 + .../FreeBASIC/almost-prime.freebasic | 32 + .../Almost-prime/Futhark/almost-prime.futhark | 18 + Task/Almost-prime/Oforth/almost-prime.oforth | 9 + Task/Almost-prime/Phix/almost-prime-1.phix | 117 ++++ Task/Almost-prime/Phix/almost-prime-2.phix | 44 ++ Task/Almost-prime/Potion/almost-prime.potion | 20 + Task/Almost-prime/Ring/almost-prime.ring | 33 + .../SequenceL/almost-prime.sequencel | 22 + Task/Almost-prime/Sidef/almost-prime.sidef | 17 + Task/Almost-prime/jq/almost-prime-1.jq | 84 +++ Task/Almost-prime/jq/almost-prime-2.jq | 14 + Task/Almost-prime/jq/almost-prime-3.jq | 1 + Task/Almost-prime/jq/almost-prime-4.jq | 6 + Task/Amb/ERRE/amb.erre | 50 ++ Task/Amb/Egison/amb-1.egison | 7 + Task/Amb/Egison/amb-2.egison | 1 + Task/Amb/Nim/amb.nim | 31 + Task/Amb/Phix/amb-1.phix | 38 + Task/Amb/Phix/amb-2.phix | 82 +++ Task/Amb/jq/amb-1.jq | 6 + Task/Amb/jq/amb-2.jq | 8 + Task/Amb/jq/amb-3.jq | 7 + Task/Amb/jq/amb-4.jq | 6 + Task/Amb/jq/amb-5.jq | 5 + .../Crystal/amicable-pairs.crystal | 20 + Task/Amicable-pairs/ERRE/amicable-pairs.erre | 28 + .../EchoLisp/amicable-pairs.echolisp | 17 + .../FreeBASIC/amicable-pairs-1.freebasic | 35 + .../FreeBASIC/amicable-pairs-2.freebasic | 38 + .../Futhark/amicable-pairs.futhark | 16 + .../GFA-Basic/amicable-pairs.gfa | 41 ++ Task/Amicable-pairs/Nim/amicable-pairs-1.nim | 18 + Task/Amicable-pairs/Nim/amicable-pairs-2.nim | 17 + .../Oforth/amicable-pairs.oforth | 10 + Task/Amicable-pairs/Phix/amicable-pairs.phix | 5 + Task/Amicable-pairs/Ring/amicable-pairs.ring | 16 + .../Amicable-pairs/Sidef/amicable-pairs.sidef | 15 + .../Swift/amicable-pairs-1.swift | 54 ++ .../Swift/amicable-pairs-2.swift | 44 ++ Task/Amicable-pairs/jq/amicable-pairs-1.jq | 26 + Task/Amicable-pairs/jq/amicable-pairs-2.jq | 9 + .../anagrams-deranged-anagrams-1.echolisp | 31 + .../anagrams-deranged-anagrams-2.echolisp | 22 + .../anagrams-deranged-anagrams.freebasic | 135 ++++ .../Lasso/anagrams-deranged-anagrams.lasso | 53 ++ .../Phix/anagrams-deranged-anagrams.phix | 49 ++ .../Sidef/anagrams-deranged-anagrams.sidef | 35 + Task/Anagrams/EchoLisp/anagrams-1.echolisp | 35 + Task/Anagrams/EchoLisp/anagrams-2.echolisp | 8 + Task/Anagrams/FreeBASIC/anagrams.freebasic | 136 ++++ .../Anagrams/FutureBasic/anagrams.futurebasic | 97 +++ Task/Anagrams/Lasso/anagrams.lasso | 27 + Task/Anagrams/LiveCode/anagrams.livecode | 39 ++ Task/Anagrams/Nim/anagrams.nim | 18 + Task/Anagrams/Oforth/anagrams.oforth | 5 + Task/Anagrams/Phix/anagrams.phix | 40 ++ Task/Anagrams/Sidef/anagrams.sidef | 10 + Task/Anagrams/Swift/anagrams.swift | 41 ++ Task/Anagrams/jq/anagrams-1.jq | 11 + Task/Anagrams/jq/anagrams-2.jq | 7 + .../ERRE/animate-a-pendulum.erre | 35 + .../Elm/animate-a-pendulum.elm | 73 ++ .../Phix/animate-a-pendulum.phix | 68 ++ .../SequenceL/animate-a-pendulum.sequencel | 68 ++ .../Sidef/animate-a-pendulum.sidef | 61 ++ Task/Animation/Ceylon/animation-1.ceylon | 4 + Task/Animation/Ceylon/animation-2.ceylon | 43 ++ Task/Animation/FreeBASIC/animation.freebasic | 34 + Task/Animation/Phix/animation.phix | 33 + .../EchoLisp/anonymous-recursion.echolisp | 5 + .../FreeBASIC/anonymous-recursion.freebasic | 42 ++ .../Lingo/anonymous-recursion-1.lingo | 12 + .../Lingo/anonymous-recursion-2.lingo | 2 + .../Nim/anonymous-recursion.nim | 12 + .../Sidef/anonymous-recursion-1.sidef | 7 + .../Sidef/anonymous-recursion-2.sidef | 7 + .../Sparkling/anonymous-recursion-1.sparkling | 5 + .../Sparkling/anonymous-recursion-2.sparkling | 2 + .../Swift/anonymous-recursion-1.swift | 9 + .../Swift/anonymous-recursion-2.swift | 10 + .../Swift/anonymous-recursion-3.swift | 15 + .../Wart/anonymous-recursion.wart | 7 + .../Wren/anonymous-recursion.wren | 12 + .../jq/anonymous-recursion-1.jq | 1 + .../jq/anonymous-recursion-2.jq | 8 + ...record-to-the-end-of-a-text-file.freebasic | 86 +++ ...d-a-record-to-the-end-of-a-text-file.sidef | 98 +++ ...nd-a-record-to-the-end-of-a-text-file.ursa | 28 + .../8th/apply-a-callback-to-an-array.8th | 3 + .../ERRE/apply-a-callback-to-an-array.erre | 24 + .../apply-a-callback-to-an-array.echolisp | 11 + .../apply-a-callback-to-an-array.freebasic | 19 + .../FunL/apply-a-callback-to-an-array.funl | 3 + .../Lasso/apply-a-callback-to-an-array.lasso | 12 + .../NGS/apply-a-callback-to-an-array.ngs | 3 + .../Nim/apply-a-callback-to-an-array.nim | 2 + .../apply-a-callback-to-an-array-1.oforth | 1 + .../apply-a-callback-to-an-array-2.oforth | 1 + .../Phix/apply-a-callback-to-an-array.phix | 13 + .../Ring/apply-a-callback-to-an-array.ring | 3 + .../apply-a-callback-to-an-array-1.sidef | 1 + .../apply-a-callback-to-an-array-2.sidef | 1 + .../apply-a-callback-to-an-array-3.sidef | 1 + .../apply-a-callback-to-an-array-4.sidef | 1 + .../apply-a-callback-to-an-array-1.sparkling | 4 + .../apply-a-callback-to-an-array-2.sparkling | 4 + .../Swift/apply-a-callback-to-an-array.swift | 13 + .../Wart/apply-a-callback-to-an-array.wart | 1 + .../Wren/apply-a-callback-to-an-array.wren | 4 + .../jq/apply-a-callback-to-an-array-1.jq | 14 + .../jq/apply-a-callback-to-an-array-2.jq | 3 + ...rbitrary-precision-integers--included-.8th | 5 + ...ary-precision-integers--included-.echolisp | 30 + ...ry-precision-integers--included-.freebasic | 26 + ...bitrary-precision-integers--included-.hoon | 3 + ...itrary-precision-integers--included-.lasso | 15 + ...rbitrary-precision-integers--included-.nim | 8 + ...trary-precision-integers--included-.oforth | 1 + ...bitrary-precision-integers--included-.phix | 11 + ...itrary-precision-integers--included-.sidef | 3 + ...bitrary-precision-integers--included-.ursa | 26 + .../Oforth/arena-storage-pool.oforth | 2 + .../ERRE/arithmetic-complex.erre | 48 ++ .../EchoLisp/arithmetic-complex.echolisp | 10 + .../FreeBASIC/arithmetic-complex.freebasic | 65 ++ .../Futhark/arithmetic-complex.futhark | 27 + .../LFE/arithmetic-complex-1.lfe | 3 + .../LFE/arithmetic-complex-2.lfe | 17 + .../LFE/arithmetic-complex-3.lfe | 3 + .../LFE/arithmetic-complex-4.lfe | 11 + .../LFE/arithmetic-complex-5.lfe | 11 + .../Nim/arithmetic-complex.nim | 10 + .../Oforth/arithmetic-complex-1.oforth | 26 + .../Oforth/arithmetic-complex-2.oforth | 4 + .../Phix/arithmetic-complex.phix | 59 ++ .../Sidef/arithmetic-complex.sidef | 13 + .../Swift/arithmetic-complex-1.swift | 45 ++ .../Swift/arithmetic-complex-2.swift | 24 + .../Swift/arithmetic-complex-3.swift | 10 + .../Wortel/arithmetic-complex.wortel | 30 + .../jq/arithmetic-complex-1.jq | 62 ++ .../jq/arithmetic-complex-2.jq | 10 + .../ECL/arithmetic-integer.ecl | 31 + .../ERRE/arithmetic-integer.erre | 19 + .../FreeBASIC/arithmetic-integer.freebasic | 16 + .../arithmetic-integer.futurebasic | 26 + .../GEORGE/arithmetic-integer.george | 7 + .../Harbour/arithmetic-integer.harbour | 11 + .../Arithmetic-Integer/I/arithmetic-integer.i | 11 + .../LFE/arithmetic-integer-1.lfe | 14 + .../LFE/arithmetic-integer-2.lfe | 11 + .../Lasso/arithmetic-integer.lasso | 8 + .../LiveCode/arithmetic-integer-1.livecode | 12 + .../LiveCode/arithmetic-integer-2.livecode | 5 + .../Nim/arithmetic-integer.nim | 22 + .../Oforth/arithmetic-integer.oforth | 7 + .../PHL/arithmetic-integer.phl | 19 + .../Panda/arithmetic-integer.panda | 1 + .../Phix/arithmetic-integer.phix | 9 + .../Ring/arithmetic-integer.ring | 9 + .../SSEM/arithmetic-integer-1.ssem | 6 + .../SSEM/arithmetic-integer-2.ssem | 6 + .../Sidef/arithmetic-integer.sidef | 6 + .../Ursa/arithmetic-integer.ursa | 17 + .../Wart/arithmetic-integer.wart | 9 + .../Wren/arithmetic-integer.wren | 8 + .../XLISP/arithmetic-integer.xlisp | 17 + .../jq/arithmetic-integer.jq | 17 + .../ERRE/arithmetic-rational.erre | 96 +++ .../EchoLisp/arithmetic-rational-1.echolisp | 6 + .../EchoLisp/arithmetic-rational-2.echolisp | 17 + .../Lingo/arithmetic-rational-1.lingo | 46 ++ .../Lingo/arithmetic-rational-2.lingo | 83 +++ .../Lingo/arithmetic-rational-3.lingo | 13 + .../Lingo/arithmetic-rational-4.lingo | 15 + .../Lingo/arithmetic-rational-5.lingo | 5 + .../Nim/arithmetic-rational.nim | 98 +++ .../Phix/arithmetic-rational.phix | 106 +++ .../ERRE/arithmetic-evaluation.erre | 233 +++++++ .../FreeBASIC/arithmetic-evaluation.freebasic | 195 ++++++ .../Phix/arithmetic-evaluation.phix | 218 ++++++ .../Sidef/arithmetic-evaluation-1.sidef | 56 ++ .../Sidef/arithmetic-evaluation-2.sidef | 13 + ...rithmetic-geometric-mean-calculate-pi.phix | 20 + ...ithmetic-geometric-mean-calculate-pi.sidef | 23 + .../ERRE/arithmetic-geometric-mean.erre | 21 + .../arithmetic-geometric-mean.echolisp | 14 + .../arithmetic-geometric-mean.freebasic | 26 + .../Futhark/arithmetic-geometric-mean.futhark | 6 + .../LFE/arithmetic-geometric-mean.lfe | 15 + .../arithmetic-geometric-mean-1.livecode | 13 + .../arithmetic-geometric-mean-2.livecode | 3 + .../Nim/arithmetic-geometric-mean-1.nim | 14 + .../Nim/arithmetic-geometric-mean-2.nim | 20 + .../Oforth/arithmetic-geometric-mean-1.oforth | 1 + .../Oforth/arithmetic-geometric-mean-2.oforth | 1 + .../Phix/arithmetic-geometric-mean.phix | 8 + .../Potion/arithmetic-geometric-mean.potion | 17 + .../Ring/arithmetic-geometric-mean.ring | 13 + .../Sidef/arithmetic-geometric-mean.sidef | 9 + .../jq/arithmetic-geometric-mean-1.jq | 9 + .../jq/arithmetic-geometric-mean-2.jq | 16 + .../AntLang/array-concatenation.antlang | 3 + .../Apex/array-concatenation.apex | 4 + .../Ceylon/array-concatenation.ceylon | 6 + .../ECL/array-concatenation.ecl | 4 + .../ERRE/array-concatenation.erre | 31 + .../EchoLisp/array-concatenation.echolisp | 12 + .../Elm/array-concatenation.elm | 19 + .../FreeBASIC/array-concatenation.freebasic | 26 + .../FunL/array-concatenation.funl | 5 + .../Futhark/array-concatenation.futhark | 1 + .../I/array-concatenation.i | 6 + .../LFE/array-concatenation.lfe | 4 + .../Lasso/array-concatenation.lasso | 12 + .../Lingo/array-concatenation.lingo | 9 + .../Nim/array-concatenation-1.nim | 4 + .../Nim/array-concatenation-2.nim | 7 + .../Oforth/array-concatenation.oforth | 1 + .../Phix/array-concatenation.phix | 2 + .../Ring/array-concatenation.ring | 8 + .../Sidef/array-concatenation.sidef | 3 + .../Swift/array-concatenation.swift | 3 + .../Ursa/array-concatenation.ursa | 16 + .../Wart/array-concatenation.wart | 4 + .../Wren/array-concatenation.wren | 6 + .../jq/array-concatenation.jq | 3 + Task/Arrays/8051-Assembly/arrays.8051 | 90 +++ Task/Arrays/8th/arrays.8th | 14 + Task/Arrays/AntLang/arrays.antlang | 13 + Task/Arrays/Apex/arrays-1.apex | 3 + Task/Arrays/Apex/arrays-2.apex | 4 + Task/Arrays/Axe/arrays.axe | 8 + Task/Arrays/BML/arrays.bml | 11 + Task/Arrays/Ceylon/arrays.ceylon | 20 + Task/Arrays/ChucK/arrays.chuck | 9 + .../Computer-zero-Assembly/arrays-1.computer | 31 + .../Computer-zero-Assembly/arrays-2.computer | 30 + Task/Arrays/FreeBASIC/arrays.freebasic | 82 +++ Task/Arrays/Futhark/arrays-1.futhark | 1 + Task/Arrays/Futhark/arrays-2.futhark | 2 + Task/Arrays/Futhark/arrays-3.futhark | 3 + Task/Arrays/Harbour/arrays-1.harbour | 11 + Task/Arrays/Harbour/arrays-2.harbour | 6 + Task/Arrays/Harbour/arrays-3.harbour | 2 + Task/Arrays/Harbour/arrays-4.harbour | 7 + Task/Arrays/I/arrays-1.i | 9 + Task/Arrays/I/arrays-2.i | 98 +++ Task/Arrays/I/arrays-3.i | 3 + Task/Arrays/LFE/arrays.lfe | 51 ++ Task/Arrays/Lasso/arrays-1.lasso | 33 + Task/Arrays/Lasso/arrays-2.lasso | 11 + Task/Arrays/Lingo/arrays-1.lingo | 15 + Task/Arrays/Lingo/arrays-2.lingo | 11 + Task/Arrays/Monte/arrays-1.monte | 1 + Task/Arrays/Monte/arrays-2.monte | 1 + Task/Arrays/Monte/arrays-3.monte | 1 + Task/Arrays/Nim/arrays.nim | 22 + Task/Arrays/Oforth/arrays.oforth | 3 + Task/Arrays/Phix/arrays.phix | 74 ++ Task/Arrays/Pony/arrays.pony | 13 + Task/Arrays/Ring/arrays.ring | 11 + Task/Arrays/SSEM/arrays.ssem | 27 + Task/Arrays/Sidef/arrays.sidef | 29 + Task/Arrays/Swift/arrays.swift | 6 + Task/Arrays/Wren/arrays.wren | 14 + Task/Arrays/XLISP/arrays.xlisp | 24 + Task/Arrays/jq/arrays.jq | 36 + Task/Assertions/Apex/assertions-1.apex | 2 + Task/Assertions/Apex/assertions-2.apex | 2 + Task/Assertions/Apex/assertions-3.apex | 2 + Task/Assertions/Axe/assertions.axe | 1 + Task/Assertions/ECL/assertions.ecl | 1 + Task/Assertions/EchoLisp/assertions.echolisp | 9 + .../Assertions/FreeBASIC/assertions.freebasic | 8 + Task/Assertions/Lasso/assertions.lasso | 6 + Task/Assertions/Lingo/assertions.lingo | 17 + Task/Assertions/Nim/assertions.nim | 2 + Task/Assertions/Oforth/assertions.oforth | 5 + Task/Assertions/Phix/assertions-1.phix | 7 + Task/Assertions/Phix/assertions-2.phix | 13 + Task/Assertions/Phix/assertions-3.phix | 2 + Task/Assertions/Ring/assertions.ring | 3 + Task/Assertions/Sidef/assertions.sidef | 2 + Task/Assertions/Swift/assertions.swift | 6 + .../Apex/associative-array-creation-1.apex | 9 + .../Apex/associative-array-creation-2.apex | 7 + .../Ceylon/associative-array-creation.ceylon | 36 + .../associative-array-creation.echolisp | 18 + .../associative-array-creation-1.harbour | 3 + .../associative-array-creation-2.harbour | 3 + .../LFE/associative-array-creation.lfe | 5 + .../Lasso/associative-array-creation.lasso | 38 + .../Lingo/associative-array-creation.lingo | 10 + .../associative-array-creation-1.livecode | 10 + .../associative-array-creation-2.livecode | 5 + .../Nim/associative-array-creation.nim | 28 + .../Phix/associative-array-creation.phix | 8 + .../Potion/associative-array-creation.potion | 8 + .../Sidef/associative-array-creation.sidef | 7 + .../Swift/associative-array-creation.swift | 13 + .../associative-array-creation.visual | 39 ++ .../Wart/associative-array-creation.wart | 3 + .../XLISP/associative-array-creation-1.xlisp | 1 + .../XLISP/associative-array-creation-2.xlisp | 3 + .../XLISP/associative-array-creation-3.xlisp | 1 + .../XLISP/associative-array-creation-4.xlisp | 1 + .../jq/associative-array-creation-1.jq | 22 + .../jq/associative-array-creation-2.jq | 15 + .../jq/associative-array-creation-3.jq | 1 + .../jq/associative-array-creation-4.jq | 1 + .../Ceylon/associative-array-iteration.ceylon | 21 + .../associative-array-iteration.echolisp | 24 + .../associative-array-iteration.harbour | 11 + .../LFE/associative-array-iteration-1.lfe | 7 + .../LFE/associative-array-iteration-2.lfe | 6 + .../Lasso/associative-array-iteration.lasso | 29 + .../Lingo/associative-array-iteration.lingo | 11 + .../associative-array-iteration-1.livecode | 24 + .../associative-array-iteration-2.livecode | 12 + .../Nim/associative-array-iteration.nim | 23 + .../Phix/associative-array-iteration-1.phix | 9 + .../Phix/associative-array-iteration-2.phix | 4 + .../Potion/associative-array-iteration.potion | 4 + .../Sidef/associative-array-iteration.sidef | 19 + .../Swift/associative-array-iteration.swift | 9 + .../Wart/associative-array-iteration.wart | 3 + .../Atomic-updates/Lasso/atomic-updates.lasso | 76 ++ Task/Atomic-updates/Phix/atomic-updates.phix | 48 ++ .../EchoLisp/average-loop-length.echolisp | 29 + .../Nim/average-loop-length.nim | 34 + .../Phix/average-loop-length.phix | 33 + .../8th/averages-arithmetic-mean.8th | 9 + .../AntLang/averages-arithmetic-mean.antlang | 1 + .../ECL/averages-arithmetic-mean.ecl | 6 + .../averages-arithmetic-mean.echolisp | 21 + .../averages-arithmetic-mean.freebasic | 42 ++ .../GEORGE/averages-arithmetic-mean.george | 7 + .../GFA-Basic/averages-arithmetic-mean.gfa | 23 + .../Hy/averages-arithmetic-mean.hy | 3 + .../LFE/averages-arithmetic-mean-1.lfe | 3 + .../LFE/averages-arithmetic-mean-2.lfe | 8 + .../LFE/averages-arithmetic-mean-3.lfe | 3 + .../LFE/averages-arithmetic-mean-4.lfe | 6 + .../Lasso/averages-arithmetic-mean.lasso | 8 + .../averages-arithmetic-mean.livecode | 2 + .../Nim/averages-arithmetic-mean.nim | 11 + .../Oforth/averages-arithmetic-mean.oforth | 2 + .../Phix/averages-arithmetic-mean.phix | 6 + .../Ring/averages-arithmetic-mean.ring | 9 + .../Sidef/averages-arithmetic-mean.sidef | 10 + .../Swift/averages-arithmetic-mean.swift | 6 + .../Ursa/averages-arithmetic-mean.ursa | 11 + .../Wart/averages-arithmetic-mean.wart | 2 + .../Wortel/averages-arithmetic-mean.wortel | 12 + .../Wren/averages-arithmetic-mean.wren | 7 + .../XLISP/averages-arithmetic-mean.xlisp | 5 + .../jq/averages-arithmetic-mean-1.jq | 1 + .../jq/averages-arithmetic-mean-2.jq | 3 + .../EchoLisp/averages-mean-angle.echolisp | 14 + .../FreeBASIC/averages-mean-angle.freebasic | 25 + .../Nim/averages-mean-angle.nim | 17 + .../Phix/averages-mean-angle.phix | 24 + .../Sidef/averages-mean-angle.sidef | 10 + .../jq/averages-mean-angle-1.jq | 19 + .../jq/averages-mean-angle-2.jq | 15 + .../jq/averages-mean-angle-3.jq | 2 + .../jq/averages-mean-angle-4.jq | 4 + .../averages-mean-time-of-day.echolisp | 21 + .../averages-mean-time-of-day.freebasic | 54 ++ .../Nim/averages-mean-time-of-day.nim | 26 + .../Phix/averages-mean-time-of-day.phix | 37 + .../Sidef/averages-mean-time-of-day.sidef | 17 + .../jq/averages-mean-time-of-day-1.jq | 31 + .../jq/averages-mean-time-of-day-2.jq | 8 + .../jq/averages-mean-time-of-day-3.jq | 8 + .../AntLang/averages-median.antlang | 1 + .../Averages-Median/ERRE/averages-median.erre | 36 + .../EchoLisp/averages-median.echolisp | 15 + .../FreeBASIC/averages-median.freebasic | 46 ++ .../Lasso/averages-median.lasso | 15 + .../LiveCode/averages-median-1.livecode | 2 + .../LiveCode/averages-median-2.livecode | 24 + Task/Averages-Median/Nim/averages-median.nim | 11 + .../Phix/averages-median-1.phix | 12 + .../Phix/averages-median-2.phix | 12 + .../Averages-Median/Ring/averages-median.ring | 9 + .../Sidef/averages-median.sidef | 5 + .../Wortel/averages-median.wortel | 14 + Task/Averages-Median/jq/averages-median-1.jq | 10 + Task/Averages-Median/jq/averages-median-2.jq | 2 + Task/Averages-Median/jq/averages-median-3.jq | 3 + Task/Averages-Mode/ERRE/averages-mode.erre | 61 ++ .../EchoLisp/averages-mode.echolisp | 16 + .../FreeBASIC/averages-mode.freebasic | 66 ++ Task/Averages-Mode/Lasso/averages-mode.lasso | 12 + Task/Averages-Mode/Nim/averages-mode.nim | 10 + Task/Averages-Mode/Phix/averages-mode.phix | 40 ++ .../Averages-Mode/Sidef/averages-mode-1.sidef | 6 + .../Averages-Mode/Sidef/averages-mode-2.sidef | 2 + .../Averages-Mode/Sidef/averages-mode-3.sidef | 3 + Task/Averages-Mode/Wren/averages-mode.wren | 13 + Task/Averages-Mode/jq/averages-mode-1.jq | 19 + Task/Averages-Mode/jq/averages-mode-2.jq | 3 + .../ERRE/averages-pythagorean-means.erre | 43 ++ .../averages-pythagorean-means.echolisp | 9 + .../averages-pythagorean-means.freebasic | 40 ++ .../FunL/averages-pythagorean-means.funl | 16 + .../averages-pythagorean-means.futhark | 13 + .../Lasso/averages-pythagorean-means.lasso | 18 + .../Nim/averages-pythagorean-means.nim | 25 + .../Oforth/averages-pythagorean-means.oforth | 9 + .../Phix/averages-pythagorean-means.phix | 32 + .../Ring/averages-pythagorean-means.ring | 29 + .../Sidef/averages-pythagorean-means-1.sidef | 3 + .../Sidef/averages-pythagorean-means-2.sidef | 3 + .../Sidef/averages-pythagorean-means-3.sidef | 3 + .../jq/averages-pythagorean-means.jq | 12 + .../ERRE/averages-root-mean-square.erre | 9 + .../averages-root-mean-square.echolisp | 5 + .../averages-root-mean-square.freebasic | 20 + .../Futhark/averages-root-mean-square.futhark | 2 + .../GEORGE/averages-root-mean-square.george | 9 + .../Lasso/averages-root-mean-square.lasso | 4 + .../Morfa/averages-root-mean-square.morfa | 14 + .../Nim/averages-root-mean-square.nim | 8 + .../Oforth/averages-root-mean-square.oforth | 1 + .../Phix/averages-root-mean-square.phix | 9 + .../averages-root-mean-square.powerbuilder | 12 + .../Ring/averages-root-mean-square.ring | 11 + .../Sidef/averages-root-mean-square.sidef | 5 + .../Wortel/averages-root-mean-square.wortel | 12 + .../XLISP/averages-root-mean-square.xlisp | 16 + .../jq/averages-root-mean-square-1.jq | 4 + .../jq/averages-root-mean-square-2.jq | 1 + .../averages-simple-moving-average.echolisp | 10 + .../averages-simple-moving-average.freebasic | 46 ++ .../averages-simple-moving-average.lasso | 32 + .../Nim/averages-simple-moving-average.nim | 28 + .../averages-simple-moving-average-1.oforth | 6 + .../averages-simple-moving-average-2.oforth | 7 + .../averages-simple-moving-average-1.phix | 50 ++ .../averages-simple-moving-average-2.phix | 11 + .../averages-simple-moving-average-1.ring | 31 + .../averages-simple-moving-average-2.ring | 31 + .../averages-simple-moving-average-3.ring | 69 ++ .../averages-simple-moving-average-1.sidef | 22 + .../averages-simple-moving-average-2.sidef | 19 + .../Ceylon/balanced-brackets.ceylon | 27 + .../EchoLisp/balanced-brackets.echolisp | 28 + .../FreeBASIC/balanced-brackets.freebasic | 45 ++ .../L++/balanced-brackets.lpp | 15 + .../Lasso/balanced-brackets.lasso | 22 + .../Nim/balanced-brackets.nim | 30 + .../Oforth/balanced-brackets.oforth | 11 + .../Phix/balanced-brackets.phix | 21 + .../Ring/balanced-brackets.ring | 26 + .../Sidef/balanced-brackets.sidef | 14 + .../Swift/balanced-brackets-1.swift | 9 + .../Swift/balanced-brackets-2.swift | 3 + .../Swift/balanced-brackets-3.swift | 13 + .../Swift/balanced-brackets-4.swift | 1 + .../Swift/balanced-brackets-5.swift | 12 + .../Swift/balanced-brackets-6.swift | 7 + .../Balanced-brackets/Ya/balanced-brackets.ya | 37 + .../Glagol/balanced-ternary.glagol | 113 +++ .../Phix/balanced-ternary-1.phix | 91 +++ .../Phix/balanced-ternary-2.phix | 16 + .../FreeBASIC/benfords-law.freebasic | 90 +++ Task/Benfords-law/Phix/benfords-law-1.phix | 14 + Task/Benfords-law/Phix/benfords-law-2.phix | 39 ++ Task/Benfords-law/Sidef/benfords-law.sidef | 21 + .../Visual-FoxPro/benfords-law.visual | 40 ++ Task/Benfords-law/jq/benfords-law.jq | 107 +++ .../Crystal/bernoulli-numbers.crystal | 62 ++ .../EchoLisp/bernoulli-numbers-1.echolisp | 24 + .../EchoLisp/bernoulli-numbers-2.echolisp | 47 ++ .../FreeBASIC/bernoulli-numbers.freebasic | 54 ++ .../FunL/bernoulli-numbers.funl | 6 + .../Phix/bernoulli-numbers-1.phix | 41 ++ .../Phix/bernoulli-numbers-2.phix | 10 + .../SPAD/bernoulli-numbers.spad | 1 + .../Sidef/bernoulli-numbers-1.sidef | 22 + .../Sidef/bernoulli-numbers-2.sidef | 13 + .../jq/bernoulli-numbers-1.jq | 39 ++ .../jq/bernoulli-numbers-2.jq | 54 ++ .../jq/bernoulli-numbers-3.jq | 10 + .../jq/bernoulli-numbers-4.jq | 2 + .../jq/bernoulli-numbers-5.jq | 33 + Task/Best-shuffle/Phix/best-shuffle.phix | 15 + Task/Best-shuffle/Sidef/best-shuffle.sidef | 22 + Task/Binary-digits/8th/binary-digits.8th | 2 + Task/Binary-digits/Axe/binary-digits.axe | 11 + .../EchoLisp/binary-digits.echolisp | 9 + .../FreeBASIC/binary-digits.freebasic | 9 + Task/Binary-digits/FunL/binary-digits.funl | 2 + .../Futhark/binary-digits.futhark | 6 + Task/Binary-digits/Idris/binary-digits.idris | 18 + Task/Binary-digits/LFE/binary-digits-1.lfe | 1 + Task/Binary-digits/LFE/binary-digits-2.lfe | 6 + Task/Binary-digits/Nim/binary-digits.nim | 24 + Task/Binary-digits/Panda/binary-digits.panda | 1 + .../Peloton/binary-digits.peloton | 6 + Task/Binary-digits/Phix/binary-digits.phix | 3 + Task/Binary-digits/Ring/binary-digits.ring | 12 + .../SequenceL/binary-digits.sequencel | 9 + Task/Binary-digits/Sidef/binary-digits.sidef | 3 + .../SkookumScript/binary-digits.skookum | 3 + Task/Binary-digits/Swift/binary-digits.swift | 3 + .../Visual-FoxPro/binary-digits.visual | 25 + .../Wortel/binary-digits-1.wortel | 3 + .../Wortel/binary-digits-2.wortel | 1 + Task/Binary-digits/jq/binary-digits.jq | 10 + Task/Binary-search/Axe/binary-search.axe | 16 + .../Futhark/binary-search.futhark | 13 + Task/Binary-search/Nim/binary-search-1.nim | 4 + Task/Binary-search/Nim/binary-search-2.nim | 7 + Task/Binary-search/Phix/binary-search-1.phix | 16 + Task/Binary-search/Phix/binary-search-2.phix | 17 + Task/Binary-search/Ring/binary-search.ring | 20 + .../SequenceL/binary-search.sequencel | 11 + .../Binary-search/Sidef/binary-search-1.sidef | 14 + .../Binary-search/Sidef/binary-search-2.sidef | 13 + .../Binary-search/Sidef/binary-search-3.sidef | 1 + .../Binary-search/Swift/binary-search-1.swift | 10 + .../Binary-search/Swift/binary-search-2.swift | 11 + .../Binary-search/Swift/binary-search-3.swift | 15 + .../Binary-search/Wortel/binary-search.wortel | 24 + Task/Binary-search/jq/binary-search-1.jq | 11 + Task/Binary-search/jq/binary-search-2.jq | 1 + Task/Binary-strings/Nim/binary-strings.nim | 23 + Task/Binary-strings/Phix/binary-strings.phix | 24 + Task/Binary-strings/Ring/binary-strings.ring | 43 ++ Task/Binary-strings/jq/binary-strings-1.jq | 10 + Task/Binary-strings/jq/binary-strings-2.jq | 70 ++ .../bitmap-b-zier-curves-cubic.freebasic | 65 ++ .../Phix/bitmap-b-zier-curves-cubic.phix | 30 + .../bitmap-b-zier-curves-quadratic.freebasic | 63 ++ .../Phix/bitmap-b-zier-curves-quadratic.phix | 27 + .../bitmap-bresenhams-line-algorithm.erre | 30 + ...bitmap-bresenhams-line-algorithm.freebasic | 39 ++ .../Nim/bitmap-bresenhams-line-algorithm.nim | 26 + .../bitmap-bresenhams-line-algorithm.phix | 35 + .../bitmap-bresenhams-line-algorithm.ring | 56 ++ .../bitmap-bresenhams-line-algorithm.sidef | 53 ++ .../bitmap-bresenhams-line-algorithm.wart | 22 + .../ERRE/bitmap-flood-fill.erre | 87 +++ .../FreeBASIC/bitmap-flood-fill.freebasic | 55 ++ .../Lingo/bitmap-flood-fill.lingo | 1 + .../Phix/bitmap-flood-fill.phix | 23 + .../Phix/bitmap-histogram.phix | 38 + .../bitmap-midpoint-circle-algorithm.erre | 37 + ...bitmap-midpoint-circle-algorithm.freebasic | 54 ++ .../bitmap-midpoint-circle-algorithm.phix | 40 ++ .../Nim/bitmap-read-a-ppm-file.nim | 33 + .../Phix/bitmap-read-a-ppm-file.phix | 28 + .../Phix/bitmap-write-a-ppm-file-1.phix | 13 + .../Phix/bitmap-write-a-ppm-file-2.phix | 16 + .../Sidef/bitmap-write-a-ppm-file.sidef | 43 ++ Task/Bitmap/Axe/bitmap.axe | 10 + Task/Bitmap/EchoLisp/bitmap.echolisp | 32 + Task/Bitmap/Lingo/bitmap.lingo | 11 + Task/Bitmap/Nim/bitmap.nim | 61 ++ Task/Bitmap/Phix/bitmap.phix | 20 + Task/Bitmap/SequenceL/bitmap.sequencel | 38 + Task/Bitwise-IO/Lingo/bitwise-io-1.lingo | 63 ++ Task/Bitwise-IO/Lingo/bitwise-io-2.lingo | 37 + Task/Bitwise-IO/Lingo/bitwise-io-3.lingo | 11 + .../8051-Assembly/bitwise-operations.8051 | 52 ++ .../Axe/bitwise-operations.axe | 9 + .../ECL/bitwise-operations.ecl | 29 + .../FreeBASIC/bitwise-operations.freebasic | 70 ++ .../bitwise-operations.futurebasic | 29 + .../HPPPL/bitwise-operations.hpppl | 10 + .../LFE/bitwise-operations-1.lfe | 25 + .../LFE/bitwise-operations-2.lfe | 17 + .../Lingo/bitwise-operations.lingo | 4 + .../LiveCode/bitwise-operations.livecode | 8 + .../Nim/bitwise-operations.nim | 7 + .../Oforth/bitwise-operations.oforth | 6 + .../Phix/bitwise-operations.phix | 88 +++ .../Ring/bitwise-operations.ring | 9 + .../Sidef/bitwise-operations.sidef | 15 + .../Swift/bitwise-operations.swift | 15 + .../8051-Assembly/boolean-values.8051 | 2 + .../EchoLisp/boolean-values.echolisp | 4 + .../FreeBASIC/boolean-values.freebasic | 14 + Task/Boolean-values/I/boolean-values.i | 14 + .../Boolean-values/Idris/boolean-values.idris | 9 + Task/Boolean-values/LFE/boolean-values.lfe | 8 + .../Lasso/boolean-values-1.lasso | 11 + .../Lasso/boolean-values-2.lasso | 7 + .../Boolean-values/Lingo/boolean-values.lingo | 6 + .../Boolean-values/Monte/boolean-values.monte | 4 + Task/Boolean-values/Nim/boolean-values.nim | 5 + Task/Boolean-values/Ring/boolean-values.ring | 5 + .../Sidef/boolean-values-1.sidef | 2 + .../Sidef/boolean-values-2.sidef | 5 + .../Boolean-values/Ursa/boolean-values-1.ursa | 1 + .../Boolean-values/Ursa/boolean-values-2.ursa | 3 + .../Boolean-values/Ursa/boolean-values-3.ursa | 3 + .../FreeBASIC/box-the-compass.freebasic | 32 + .../Lasso/box-the-compass.lasso | 52 ++ Task/Box-the-compass/Nim/box-the-compass.nim | 18 + .../Box-the-compass/Phix/box-the-compass.phix | 48 ++ .../Sidef/box-the-compass.sidef | 15 + .../Nim/break-oo-privacy-1.nim | 7 + .../Nim/break-oo-privacy-2.nim | 3 + .../Nim/break-oo-privacy-3.nim | 1 + .../Nim/break-oo-privacy-4.nim | 11 + .../Sidef/break-oo-privacy.sidef | 15 + Task/Brownian-tree/Phix/brownian-tree.phix | 70 ++ .../Phix/bulls-and-cows-player.phix | 70 ++ .../Sidef/bulls-and-cows-player.sidef | 45 ++ .../Ceylon/bulls-and-cows.ceylon | 70 ++ .../Bulls-and-cows/Coco/bulls-and-cows-1.coco | 4 + .../Bulls-and-cows/Coco/bulls-and-cows-2.coco | 22 + Task/Bulls-and-cows/Hy/bulls-and-cows.hy | 26 + .../Bulls-and-cows/Lasso/bulls-and-cows.lasso | 70 ++ Task/Bulls-and-cows/Nim/bulls-and-cows.nim | 35 + .../Oforth/bulls-and-cows.oforth | 18 + Task/Bulls-and-cows/Phix/bulls-and-cows.phix | 50 ++ .../Bulls-and-cows/Sidef/bulls-and-cows.sidef | 35 + Task/CRC-32/Lingo/crc-32-1.lingo | 9 + Task/CRC-32/Lingo/crc-32-2.lingo | 67 ++ Task/CRC-32/Lingo/crc-32-3.lingo | 3 + Task/CRC-32/Nim/crc-32.nim | 23 + Task/CRC-32/Phix/crc-32-1.phix | 37 + Task/CRC-32/Phix/crc-32-2.phix | 2 + Task/CRC-32/Swift/crc-32.swift | 7 + .../ECL/csv-data-manipulation.ecl | 21 + .../EchoLisp/csv-data-manipulation-1.echolisp | 21 + .../EchoLisp/csv-data-manipulation-2.echolisp | 15 + .../FreeBASIC/csv-data-manipulation.freebasic | 20 + .../FunL/csv-data-manipulation.funl | 45 ++ .../Lingo/csv-data-manipulation-1.lingo | 99 +++ .../Lingo/csv-data-manipulation-2.lingo | 44 ++ .../Nim/csv-data-manipulation.nim | 25 + .../Sidef/csv-data-manipulation-1.sidef | 12 + .../Sidef/csv-data-manipulation-2.sidef | 24 + .../Ursa/csv-data-manipulation.ursa | 42 ++ .../csv-data-manipulation.visual | 11 + .../jq/csv-data-manipulation.jq | 15 + .../csv-to-html-translation-1.echolisp | 30 + .../csv-to-html-translation-2.echolisp | 17 + .../Nim/csv-to-html-translation.nim | 23 + .../Phix/csv-to-html-translation-1.phix | 20 + .../Phix/csv-to-html-translation-2.phix | 8 + .../Sidef/csv-to-html-translation-1.sidef | 30 + .../Sidef/csv-to-html-translation-2.sidef | 11 + .../jq/csv-to-html-translation-1.jq | 1 + .../jq/csv-to-html-translation-2.jq | 22 + .../jq/csv-to-html-translation-3.jq | 26 + Task/Caesar-cipher/ERRE/caesar-cipher.erre | 29 + .../FreeBASIC/caesar-cipher.freebasic | 41 ++ .../Caesar-cipher/GFA-Basic/caesar-cipher.gfa | 36 + .../LiveCode/caesar-cipher.livecode | 16 + Task/Caesar-cipher/Nim/caesar-cipher.nim | 14 + .../Caesar-cipher/Oforth/caesar-cipher.oforth | 6 + Task/Caesar-cipher/Phix/caesar-cipher.phix | 19 + Task/Caesar-cipher/SSEM/caesar-cipher.ssem | 19 + .../SequenceL/caesar-cipher.sequencel | 32 + Task/Caesar-cipher/Sidef/caesar-cipher.sidef | 13 + .../TypeScript/caesar-cipher.type | 14 + Task/Caesar-cipher/Ursa/caesar-cipher.ursa | 28 + .../Caesar-cipher/Wortel/caesar-cipher.wortel | 18 + .../Caesar-cipher/XLISP/caesar-cipher-1.xlisp | 16 + .../Caesar-cipher/XLISP/caesar-cipher-2.xlisp | 9 + .../calendar---for-real-programmers.freebasic | 97 +++ .../calendar---for-real-programmers-1.phix | 1 + .../calendar---for-real-programmers-2.phix | 1 + .../calendar---for-real-programmers-3.phix | 1 + .../calendar---for-real-programmers-4.phix | 1 + .../calendar---for-real-programmers-5.phix | 4 + .../calendar---for-real-programmers-6.phix | 1 + .../calendar---for-real-programmers-7.phix | 1 + .../calendar---for-real-programmers-8.phix | 1 + .../calendar---for-real-programmers-9.phix | 1 + .../calendar---for-real-programmers.sidef | 59 ++ .../calendar---for-real-programmers.xlisp | 36 + Task/Calendar/FreeBASIC/calendar.freebasic | 125 ++++ .../Calendar/FutureBasic/calendar.futurebasic | 10 + Task/Calendar/Lingo/calendar-1.lingo | 57 ++ Task/Calendar/Lingo/calendar-2.lingo | 3 + Task/Calendar/Phix/calendar.phix | 66 ++ Task/Calendar/Sidef/calendar.sidef | 52 ++ Task/Calendar/XLISP/calendar.xlisp | 58 ++ .../8th/call-a-foreign-language-function.8th | 8 + ...call-a-foreign-language-function.freebasic | 20 + .../call-a-foreign-language-function.luck | 7 + .../Nim/call-a-foreign-language-function.nim | 8 + .../call-a-foreign-language-function.phix | 9 + .../call-a-foreign-language-function.swift | 5 + ...l-a-function-in-a-shared-library.freebasic | 23 + .../call-a-function-in-a-shared-library.lingo | 18 + .../call-a-function-in-a-shared-library-1.nim | 5 + .../call-a-function-in-a-shared-library-2.nim | 8 + .../call-a-function-in-a-shared-library-3.nim | 5 + .../call-a-function-in-a-shared-library-4.nim | 7 + .../AntLang/call-a-function-1.antlang | 1 + .../AntLang/call-a-function-2.antlang | 3 + .../Call-a-function/Axe/call-a-function-1.axe | 2 + .../Call-a-function/Axe/call-a-function-2.axe | 3 + .../Call-a-function/Axe/call-a-function-3.axe | 2 + .../Call-a-function/Axe/call-a-function-4.axe | 2 + Task/Call-a-function/I/call-a-function.i | 5 + .../Call-a-function/LFE/call-a-function-1.lfe | 2 + .../Call-a-function/LFE/call-a-function-2.lfe | 3 + .../Call-a-function/LFE/call-a-function-3.lfe | 2 + .../Call-a-function/LFE/call-a-function-4.lfe | 3 + .../Call-a-function/LFE/call-a-function-5.lfe | 14 + .../Call-a-function/LFE/call-a-function-6.lfe | 16 + .../Call-a-function/LFE/call-a-function-7.lfe | 4 + .../Call-a-function/LFE/call-a-function-8.lfe | 2 + .../Call-a-function/LFE/call-a-function-9.lfe | 2 + .../Lingo/call-a-function-1.lingo | 3 + .../Lingo/call-a-function-10.lingo | 17 + .../Lingo/call-a-function-11.lingo | 2 + .../Lingo/call-a-function-12.lingo | 6 + .../Lingo/call-a-function-13.lingo | 9 + .../Lingo/call-a-function-2.lingo | 3 + .../Lingo/call-a-function-3.lingo | 4 + .../Lingo/call-a-function-4.lingo | 4 + .../Lingo/call-a-function-5.lingo | 7 + .../Lingo/call-a-function-6.lingo | 2 + .../Lingo/call-a-function-7.lingo | 20 + .../Lingo/call-a-function-8.lingo | 3 + .../Lingo/call-a-function-9.lingo | 1 + .../Call-a-function/Luck/call-a-function.luck | 43 ++ Task/Call-a-function/Nim/call-a-function.nim | 43 ++ .../Oforth/call-a-function-1.oforth | 1 + .../Oforth/call-a-function-2.oforth | 1 + .../Oforth/call-a-function-3.oforth | 4 + .../Oforth/call-a-function-4.oforth | 1 + .../Oforth/call-a-function-5.oforth | 1 + .../Phix/call-a-function-1.phix | 1 + .../Phix/call-a-function-2.phix | 4 + .../Phix/call-a-function-3.phix | 6 + .../Phix/call-a-function-4.phix | 2 + .../Phix/call-a-function-5.phix | 2 + .../Phix/call-a-function-6.phix | 1 + .../Ring/call-a-function-1.ring | 3 + .../Ring/call-a-function-2.ring | 3 + .../Ring/call-a-function-3.ring | 2 + .../Ring/call-a-function-4.ring | 4 + .../Call-a-function/SSEM/call-a-function.ssem | 4 + .../Sidef/call-a-function-1.sidef | 10 + .../Sidef/call-a-function-2.sidef | 12 + .../Swift/call-a-function.swift | 35 + .../XLISP/call-a-function.xlisp | 19 + .../Apex/call-an-object-method.apex | 5 + .../ChucK/call-an-object-method.chuck | 2 + .../FreeBASIC/call-an-object-method.freebasic | 24 + .../LFE/call-an-object-method-1.lfe | 93 +++ .../LFE/call-an-object-method-2.lfe | 45 ++ .../LFE/call-an-object-method-3.lfe | 101 +++ .../LFE/call-an-object-method-4.lfe | 45 ++ .../Lingo/call-an-object-method.lingo | 6 + .../Nim/call-an-object-method.nim | 3 + .../Oforth/call-an-object-method-1.oforth | 1 + .../Oforth/call-an-object-method-2.oforth | 1 + .../Ring/call-an-object-method-1.ring | 4 + .../Ring/call-an-object-method-2.ring | 7 + .../Sidef/call-an-object-method.sidef | 23 + .../Swift/call-an-object-method.swift | 11 + .../Ursa/call-an-object-method.ursa | 5 + .../XLISP/call-an-object-method.xlisp | 23 + ...armichael-3-strong-pseudoprimes-1.echolisp | 14 + ...armichael-3-strong-pseudoprimes-2.echolisp | 22 + ...carmichael-3-strong-pseudoprimes.freebasic | 59 ++ .../carmichael-3-strong-pseudoprimes.sidef | 21 + .../case-sensitivity-of-identifiers.echolisp | 6 + .../case-sensitivity-of-identifiers.freebasic | 9 + .../case-sensitivity-of-identifiers-1.lasso | 5 + .../case-sensitivity-of-identifiers-2.lasso | 6 + .../case-sensitivity-of-identifiers-3.lasso | 9 + .../NESL/case-sensitivity-of-identifiers.nesl | 4 + .../Nim/case-sensitivity-of-identifiers.nim | 4 + .../case-sensitivity-of-identifiers.oforth | 8 + .../Phix/case-sensitivity-of-identifiers.phix | 4 + .../Ring/case-sensitivity-of-identifiers.ring | 5 + .../case-sensitivity-of-identifiers.sidef | 4 + .../case-sensitivity-of-identifiers.swift | 4 + .../Ursa/case-sensitivity-of-identifiers.ursa | 7 + .../case-sensitivity-of-identifiers.xlisp | 4 + .../jq/case-sensitivity-of-identifiers-1.jq | 4 + .../jq/case-sensitivity-of-identifiers-2.jq | 2 + .../Nim/casting-out-nines.nim | 23 + .../jq/casting-out-nines-1.jq | 6 + .../jq/casting-out-nines-2.jq | 1 + .../jq/casting-out-nines-3.jq | 1 + .../jq/casting-out-nines-4.jq | 1 + .../jq/casting-out-nines-5.jq | 3 + .../jq/casting-out-nines-6.jq | 5 + .../jq/casting-out-nines-7.jq | 5 + .../catalan-numbers-pascals-triangle.erre | 38 + ...atalan-numbers-pascals-triangle-1.echolisp | 15 + ...atalan-numbers-pascals-triangle-2.echolisp | 4 + ...catalan-numbers-pascals-triangle.freebasic | 56 ++ .../Nim/catalan-numbers-pascals-triangle.nim | 9 + .../catalan-numbers-pascals-triangle.oforth | 2 + .../catalan-numbers-pascals-triangle-1.phix | 14 + .../catalan-numbers-pascals-triangle-2.phix | 33 + .../catalan-numbers-pascals-triangle-3.phix | 24 + .../catalan-numbers-pascals-triangle.ring | 13 + .../catalan-numbers-pascals-triangle.sidef | 11 + .../jq/catalan-numbers-pascals-triangle-1.jq | 7 + .../jq/catalan-numbers-pascals-triangle-2.jq | 21 + .../Catalan-numbers/ERRE/catalan-numbers.erre | 15 + .../EchoLisp/catalan-numbers.echolisp | 37 + .../FreeBASIC/catalan-numbers.freebasic | 38 + .../Catalan-numbers/FunL/catalan-numbers.funl | 22 + .../Harbour/catalan-numbers.harbour | 17 + Task/Catalan-numbers/Nim/catalan-numbers.nim | 33 + .../Oforth/catalan-numbers.oforth | 1 + .../Catalan-numbers/Phix/catalan-numbers.phix | 53 ++ .../Catalan-numbers/Ring/catalan-numbers.ring | 8 + .../Sidef/catalan-numbers-1.sidef | 2 + .../Sidef/catalan-numbers-2.sidef | 3 + .../Sidef/catalan-numbers-3.sidef | 3 + .../Wortel/catalan-numbers.wortel | 6 + Task/Catalan-numbers/jq/catalan-numbers-1.jq | 5 + Task/Catalan-numbers/jq/catalan-numbers-2.jq | 1 + Task/Catalan-numbers/jq/catalan-numbers-3.jq | 18 + Task/Catalan-numbers/jq/catalan-numbers-4.jq | 8 + Task/Catalan-numbers/jq/catalan-numbers-5.jq | 1 + Task/Catalan-numbers/jq/catalan-numbers-6.jq | 4 + .../EchoLisp/catamorphism.echolisp | 19 + .../FreeBASIC/catamorphism.freebasic | 44 ++ Task/Catamorphism/Nim/catamorphism.nim | 19 + Task/Catamorphism/Oforth/catamorphism.oforth | 2 + Task/Catamorphism/Ring/catamorphism.ring | 34 + Task/Catamorphism/Sidef/catamorphism.sidef | 2 + .../Catamorphism/Wortel/catamorphism-1.wortel | 1 + .../Catamorphism/Wortel/catamorphism-2.wortel | 1 + Task/Character-codes/Axe/character-codes.axe | 2 + .../FreeBASIC/character-codes.freebasic | 7 + Task/Character-codes/I/character-codes.i | 4 + .../Character-codes/LFE/character-codes-1.lfe | 2 + .../Character-codes/LFE/character-codes-2.lfe | 6 + .../Lasso/character-codes.lasso | 4 + .../Lingo/character-codes.lingo | 7 + .../LiveCode/character-codes.livecode | 2 + .../NESL/character-codes-1.nesl | 3 + .../NESL/character-codes-2.nesl | 3 + Task/Character-codes/Nim/character-codes.nim | 7 + .../Oforth/character-codes.oforth | 1 + .../Character-codes/Phix/character-codes.phix | 2 + .../Character-codes/Ring/character-codes.ring | 2 + .../SequenceL/character-codes.sequencel | 4 + .../Sidef/character-codes.sidef | 2 + .../Swift/character-codes-1.swift | 4 + .../Swift/character-codes-2.swift | 8 + .../Swift/character-codes-3.swift | 4 + .../Character-codes/Ursa/character-codes.ursa | 4 + .../XLISP/character-codes.xlisp | 6 + Task/Character-codes/jq/character-codes-1.jq | 2 + Task/Character-codes/jq/character-codes-2.jq | 1 + Task/Chat-server/Nim/chat-server.nim | 40 ++ .../check-machin-like-formulas-1.echolisp | 58 ++ .../check-machin-like-formulas-2.echolisp | 42 ++ .../Sidef/check-machin-like-formulas.sidef | 68 ++ .../Axe/check-that-file-exists.axe | 5 + .../check-that-file-exists.freebasic | 38 + .../I/check-that-file-exists.i | 16 + .../LFE/check-that-file-exists.lfe | 8 + .../Lasso/check-that-file-exists.lasso | 11 + .../check-that-file-exists-1.livecode | 4 + .../check-that-file-exists-2.livecode | 2 + .../Nim/check-that-file-exists.nim | 6 + .../Phix/check-that-file-exists.phix | 18 + .../Ring/check-that-file-exists.ring | 4 + .../Sidef/check-that-file-exists.sidef | 7 + .../Ursa/check-that-file-exists.ursa | 9 + .../Oforth/checkpoint-synchronization.oforth | 23 + .../chinese-remainder-theorem.echolisp | 8 + .../FunL/chinese-remainder-theorem.funl | 7 + .../Nim/chinese-remainder-theorem.nim | 24 + .../Sidef/chinese-remainder-theorem.sidef | 20 + .../jq/chinese-remainder-theorem.jq | 31 + .../Idris/cholesky-decomposition.idris | 67 ++ .../Nim/cholesky-decomposition.nim | 28 + .../Sidef/cholesky-decomposition-1.sidef | 13 + .../Sidef/cholesky-decomposition-2.sidef | 18 + .../jq/cholesky-decomposition-1.jq | 38 + .../jq/cholesky-decomposition-2.jq | 22 + .../jq/cholesky-decomposition-3.jq | 4 + ...es-of-given-radius-through-two-points.erre | 51 ++ ...les-of-given-radius-through-two-points.nim | 48 ++ ...-of-given-radius-through-two-points.oforth | 16 + ...-of-given-radius-through-two-points.visual | 84 +++ ...es-of-given-radius-through-two-points-1.jq | 27 + ...es-of-given-radius-through-two-points-2.jq | 8 + ...es-of-given-radius-through-two-points-3.jq | 7 + Task/Classes/Coco/classes.coco | 15 + Task/Classes/ERRE/classes.erre | 30 + Task/Classes/EchoLisp/classes-1.echolisp | 11 + Task/Classes/EchoLisp/classes-2.echolisp | 16 + Task/Classes/FreeBASIC/classes.freebasic | 27 + Task/Classes/LFE/classes-1.lfe | 31 + Task/Classes/LFE/classes-2.lfe | 8 + Task/Classes/Lasso/classes.lasso | 19 + Task/Classes/Lingo/classes-1.lingo | 19 + Task/Classes/Lingo/classes-2.lingo | 3 + Task/Classes/Nim/classes.nim | 27 + Task/Classes/Oforth/classes-1.oforth | 2 + Task/Classes/Oforth/classes-2.oforth | 1 + Task/Classes/PHL/classes.phl | 23 + Task/Classes/Ring/classes-1.ring | 2 + Task/Classes/Ring/classes-2.ring | 15 + Task/Classes/Sidef/classes.sidef | 9 + Task/Classes/Swift/classes-1.swift | 19 + Task/Classes/Swift/classes-2.swift | 1 + Task/Classes/Visual-FoxPro/classes.visual | 28 + Task/Classes/XLISP/classes.xlisp | 19 + .../Phix/closest-pair-problem.phix | 104 +++ .../Ring/closest-pair-problem.ring | 32 + .../Sidef/closest-pair-problem.sidef | 71 ++ .../Visual-FoxPro/closest-pair-problem.visual | 20 + .../jq/closest-pair-problem-1.jq | 10 + .../jq/closest-pair-problem-2.jq | 53 ++ .../jq/closest-pair-problem-3.jq | 13 + .../AntLang/closures-value-capture.antlang | 2 + .../Ceylon/closures-value-capture.ceylon | 9 + .../EchoLisp/closures-value-capture.echolisp | 4 + .../closures-value-capture.freebasic | 33 + .../LFE/closures-value-capture-1.lfe | 2 + .../LFE/closures-value-capture-2.lfe | 5 + .../LFE/closures-value-capture-3.lfe | 8 + .../Lingo/closures-value-capture-1.lingo | 24 + .../Lingo/closures-value-capture-2.lingo | 8 + .../Lingo/closures-value-capture-3.lingo | 15 + .../Nim/closures-value-capture.nim | 9 + .../Oforth/closures-value-capture.oforth | 2 + .../Ring/closures-value-capture.ring | 9 + .../Sidef/closures-value-capture-1.sidef | 7 + .../Sidef/closures-value-capture-2.sidef | 7 + .../closures-value-capture-1.sparkling | 9 + .../closures-value-capture-2.sparkling | 8 + .../Swift/closures-value-capture-1.swift | 5 + .../Swift/closures-value-capture-2.swift | 5 + .../Swift/closures-value-capture-3.swift | 5 + .../Swift/closures-value-capture-4.swift | 2 + Task/Collections/Apex/collections-1.apex | 4 + Task/Collections/Apex/collections-2.apex | 6 + Task/Collections/Apex/collections-3.apex | 3 + Task/Collections/Apex/collections-4.apex | 3 + Task/Collections/Apex/collections-5.apex | 4 + Task/Collections/Apex/collections-6.apex | 3 + Task/Collections/Apex/collections-7.apex | 7 + Task/Collections/Axe/collections.axe | 8 + .../Collections/EchoLisp/collections.echolisp | 9 + .../FreeBASIC/collections.freebasic | 17 + Task/Collections/Lingo/collections.lingo | 13 + Task/Collections/Nim/collections-1.nim | 6 + Task/Collections/Nim/collections-2.nim | 11 + Task/Collections/Nim/collections-3.nim | 7 + Task/Collections/Nim/collections-4.nim | 6 + Task/Collections/Nim/collections-5.nim | 7 + Task/Collections/Nim/collections-6.nim | 6 + Task/Collections/Nim/collections-7.nim | 4 + Task/Collections/Oforth/collections-1.oforth | 1 + Task/Collections/Oforth/collections-2.oforth | 1 + Task/Collections/Phix/collections-1.phix | 4 + Task/Collections/Phix/collections-2.phix | 7 + Task/Collections/Sidef/collections-1.sidef | 5 + Task/Collections/Sidef/collections-2.sidef | 5 + Task/Collections/Sidef/collections-3.sidef | 14 + Task/Collections/Sidef/collections-4.sidef | 15 + .../Visual-FoxPro/collections.visual | 22 + Task/Collections/Wren/collections.wren | 16 + Task/Collections/jq/collections-1.jq | 1 + Task/Collections/jq/collections-2.jq | 1 + Task/Collections/jq/collections-3.jq | 1 + .../Axe/color-of-a-screen-pixel.axe | 1 + .../color-of-a-screen-pixel.freebasic | 13 + .../Lingo/color-of-a-screen-pixel.lingo | 5 + .../Nim/color-of-a-screen-pixel.nim | 10 + .../Ring/color-of-a-screen-pixel.ring | 35 + .../FreeBASIC/colour-bars-display.freebasic | 21 + .../Ring/colour-bars-display.ring | 59 ++ .../Sidef/colour-bars-display.sidef | 24 + .../combinations-and-permutations.echolisp | 20 + .../Nim/combinations-and-permutations.nim | 20 + .../Phix/combinations-and-permutations-1.phix | 27 + .../Phix/combinations-and-permutations-2.phix | 22 + .../Sidef/combinations-and-permutations.sidef | 46 ++ .../jq/combinations-and-permutations.jq | 20 + .../combinations-with-repetitions.echolisp | 41 ++ .../combinations-with-repetitions.egison | 6 + .../LFE/combinations-with-repetitions-1.lfe | 9 + .../LFE/combinations-with-repetitions-2.lfe | 9 + .../LFE/combinations-with-repetitions-3.lfe | 2 + .../Nim/combinations-with-repetitions.nim | 13 + .../Phix/combinations-with-repetitions-1.phix | 11 + .../Phix/combinations-with-repetitions-2.phix | 11 + .../Sidef/combinations-with-repetitions.sidef | 9 + .../Swift/combinations-with-repetitions.swift | 11 + .../jq/combinations-with-repetitions-1.jq | 8 + .../jq/combinations-with-repetitions-2.jq | 4 + Task/Combinations/ERRE/combinations.erre | 36 + .../EchoLisp/combinations.echolisp | 25 + Task/Combinations/Egison/combinations.egison | 6 + Task/Combinations/Nim/combinations.nim | 21 + Task/Combinations/Perl5i/combinations.perl5i | 22 + Task/Combinations/Phix/combinations.phix | 13 + Task/Combinations/Pyret/combinations.pyret | 101 +++ Task/Combinations/SPAD/combinations.spad | 5 + Task/Combinations/Sidef/combinations-1.sidef | 1 + Task/Combinations/Sidef/combinations-2.sidef | 17 + Task/Combinations/Sidef/combinations-3.sidef | 31 + Task/Combinations/Swift/combinations.swift | 20 + Task/Combinations/jq/combinations.jq | 9 + .../EchoLisp/comma-quibbling.echolisp | 20 + .../FreeBASIC/comma-quibbling.freebasic | 58 ++ .../Lasso/comma-quibbling.lasso | 23 + Task/Comma-quibbling/Nim/comma-quibbling.nim | 10 + .../Oforth/comma-quibbling.oforth | 9 + .../Sidef/comma-quibbling.sidef | 7 + .../Swift/comma-quibbling.swift | 23 + .../XLISP/comma-quibbling.xlisp | 29 + Task/Comma-quibbling/jq/comma-quibbling-1.jq | 6 + Task/Comma-quibbling/jq/comma-quibbling-2.jq | 1 + Task/Comma-quibbling/jq/comma-quibbling-3.jq | 5 + .../command-line-arguments.freebasic | 9 + .../FunL/command-line-arguments.funl | 1 + .../Harbour/command-line-arguments.harbour | 9 + .../LFE/command-line-arguments-1.lfe | 1 + .../LFE/command-line-arguments-2.lfe | 8 + .../LFE/command-line-arguments-3.lfe | 4 + .../Lasso/command-line-arguments-1.lasso | 5 + .../Lasso/command-line-arguments-2.lasso | 6 + .../Lingo/command-line-arguments-1.lingo | 2 + .../Lingo/command-line-arguments-2.lingo | 2 + .../Nim/command-line-arguments.nim | 3 + .../Oforth/command-line-arguments.oforth | 1 + .../Phix/command-line-arguments.phix | 13 + .../Ring/command-line-arguments.ring | 8 + .../Sidef/command-line-arguments.sidef | 1 + .../Swift/command-line-arguments-1.swift | 6 + .../Swift/command-line-arguments-2.swift | 5 + .../Swift/command-line-arguments-3.swift | 5 + .../Ursa/command-line-arguments.ursa | 8 + Task/Comments/AntLang/comments.antlang | 1 + Task/Comments/Apex/comments.apex | 4 + Task/Comments/Axe/comments-1.axe | 1 + Task/Comments/Axe/comments-2.axe | 3 + Task/Comments/Axe/comments-3.axe | 3 + Task/Comments/Axe/comments-4.axe | 3 + Task/Comments/Axe/comments-5.axe | 3 + Task/Comments/ChucK/comments.chuck | 2 + Task/Comments/ECL/comments-1.ecl | 1 + Task/Comments/ECL/comments-2.ecl | 2 + Task/Comments/EDSAC-order-code/comments.edsac | 7 + Task/Comments/ERRE/comments.erre | 3 + Task/Comments/EchoLisp/comments.echolisp | 14 + Task/Comments/Elm/comments.elm | 5 + Task/Comments/FUZE-BASIC/comments.fuze | 5 + Task/Comments/FreeBASIC/comments.freebasic | 19 + Task/Comments/Futhark/comments.futhark | 4 + Task/Comments/Gri/comments-1.gri | 2 + Task/Comments/Gri/comments-2.gri | 2 + Task/Comments/Lasso/comments.lasso | 11 + Task/Comments/Lily/comments-1.lily | 1 + Task/Comments/Lily/comments-2.lily | 5 + Task/Comments/Lingo/comments.lingo | 2 + Task/Comments/LiveCode/comments.livecode | 6 + Task/Comments/Monte/comments.monte | 5 + Task/Comments/NESL/comments.nesl | 1 + Task/Comments/Nim/comments.nim | 14 + Task/Comments/Oforth/comments.oforth | 1 + Task/Comments/Peloton/comments.peloton | 3 + Task/Comments/Phix/comments-1.phix | 1 + Task/Comments/Phix/comments-2.phix | 10 + Task/Comments/Ring/comments-1.ring | 2 + Task/Comments/Ring/comments-2.ring | 4 + Task/Comments/SSEM/comments.ssem | 1 + Task/Comments/Set-lang/comments.set | 2 + Task/Comments/Sidef/comments-1.sidef | 1 + Task/Comments/Sidef/comments-2.sidef | 1 + Task/Comments/Sidef/comments-3.sidef | 2 + Task/Comments/Sidef/comments-4.sidef | 3 + Task/Comments/Swift/comments.swift | 10 + Task/Comments/Ursa/comments.ursa | 2 + Task/Comments/Wart/comments.wart | 1 + Task/Comments/XLISP/comments.xlisp | 1 + Task/Comments/jq/comments.jq | 2 + .../compile-time-calculation.echolisp | 5 + .../compile-time-calculation.freebasic | 8 + .../Lingo/compile-time-calculation.lingo | 8 + .../Nim/compile-time-calculation-1.nim | 7 + .../Nim/compile-time-calculation-2.nim | 3 + .../Oforth/compile-time-calculation-1.oforth | 2 + .../Oforth/compile-time-calculation-2.oforth | 4 + .../Phix/compile-time-calculation.phix | 4 + .../Ring/compile-time-calculation.ring | 6 + .../Sidef/compile-time-calculation-1.sidef | 2 + .../Sidef/compile-time-calculation-2.sidef | 2 + .../XLISP/compile-time-calculation-1.xlisp | 1 + .../XLISP/compile-time-calculation-2.xlisp | 1 + .../XLISP/compile-time-calculation-3.xlisp | 6 + .../Axe/compound-data-type-1.axe | 5 + .../Axe/compound-data-type-2.axe | 1 + .../EchoLisp/compound-data-type.echolisp | 12 + .../FreeBASIC/compound-data-type.freebasic | 11 + .../LFE/compound-data-type.lfe | 3 + .../Lasso/compound-data-type.lasso | 14 + .../Lingo/compound-data-type-1.lingo | 8 + .../Lingo/compound-data-type-2.lingo | 3 + .../Lingo/compound-data-type-3.lingo | 4 + .../Lingo/compound-data-type-4.lingo | 3 + .../Nim/compound-data-type.nim | 4 + .../Oforth/compound-data-type.oforth | 1 + .../Phix/compound-data-type.phix | 15 + .../Ring/compound-data-type-1.ring | 1 + .../Ring/compound-data-type-2.ring | 2 + .../Shen/compound-data-type-1.shen | 4 + .../Shen/compound-data-type-2.shen | 2 + .../Sidef/compound-data-type.sidef | 3 + .../Swift/compound-data-type.swift | 19 + .../jq/compound-data-type-1.jq | 1 + .../jq/compound-data-type-2.jq | 1 + .../EchoLisp/concurrent-computing.echolisp | 13 + .../FreeBASIC/concurrent-computing.freebasic | 29 + .../LFE/concurrent-computing.lfe | 26 + .../Nim/concurrent-computing-1.nim | 10 + .../Nim/concurrent-computing-2.nim | 4 + .../Nim/concurrent-computing-3.nim | 9 + .../Oforth/concurrent-computing-1.oforth | 3 + .../Oforth/concurrent-computing-2.oforth | 1 + .../Phix/concurrent-computing.phix | 15 + .../Sidef/concurrent-computing.sidef | 7 + .../Swift/concurrent-computing.swift | 11 + .../Apex/conditional-structures-1.apex | 7 + .../Apex/conditional-structures-2.apex | 3 + .../Apex/conditional-structures-3.apex | 3 + .../Apex/conditional-structures-4.apex | 1 + .../Axe/conditional-structures-1.axe | 3 + .../Axe/conditional-structures-2.axe | 3 + .../Axe/conditional-structures-3.axe | 5 + .../Axe/conditional-structures-4.axe | 7 + .../Axe/conditional-structures-5.axe | 7 + .../Comal/conditional-structures-1.comal | 1 + .../Comal/conditional-structures-2.comal | 5 + .../Comal/conditional-structures-3.comal | 6 + .../Comal/conditional-structures-4.comal | 8 + .../conditional-structures-1.freebasic | 8 + .../conditional-structures-2.freebasic | 9 + .../conditional-structures-3.freebasic | 2 + .../conditional-structures-4.freebasic | 2 + .../conditional-structures-5.freebasic | 2 + .../conditional-structures-6.freebasic | 2 + .../conditional-structures-7.freebasic | 8 + .../conditional-structures-8.freebasic | 4 + .../conditional-structures-9.freebasic | 3 + .../Futhark/conditional-structures.futhark | 1 + .../HPPPL/conditional-structures-1.hpppl | 5 + .../HPPPL/conditional-structures-2.hpppl | 13 + .../Harbour/conditional-structures-1.harbour | 7 + .../Harbour/conditional-structures-2.harbour | 8 + .../Harbour/conditional-structures-3.harbour | 10 + .../I/conditional-structures.i | 20 + .../LC3-Assembly/conditional-structures-1.lc3 | 10 + .../LC3-Assembly/conditional-structures-2.lc3 | 19 + .../conditional-structures.monicelli | 8 + .../Morfa/conditional-structures-1.morfa | 10 + .../Morfa/conditional-structures-2.morfa | 2 + .../Morfa/conditional-structures-3.morfa | 1 + .../Morfa/conditional-structures-4.morfa | 11 + .../Nim/conditional-structures-1.nim | 8 + .../Nim/conditional-structures-2.nim | 9 + .../Oforth/conditional-structures-1.oforth | 5 + .../Oforth/conditional-structures-2.oforth | 1 + .../Oforth/conditional-structures-3.oforth | 4 + .../PHL/conditional-structures.phl | 8 + .../Ring/conditional-structures-1.ring | 7 + .../Ring/conditional-structures-2.ring | 8 + .../SSEM/conditional-structures.ssem | 3 + .../jq/conditional-structures-1.jq | 1 + .../jq/conditional-structures-2.jq | 1 + .../jq/conditional-structures-3.jq | 4 + .../jq/conditional-structures-4.jq | 7 + .../Sparkling/conjugate-transpose.sparkling | 101 +++ .../jq/conjugate-transpose-1.jq | 6 + .../jq/conjugate-transpose-2.jq | 27 + .../jq/conjugate-transpose-3.jq | 5 + .../jq/conjugate-transpose-4.jq | 38 + .../jq/conjugate-transpose-5.jq | 23 + .../jq/conjugate-transpose-6.jq | 29 + .../jq/conjugate-transpose-7.jq | 16 + .../Morfa/constrained-genericity-1.morfa | 27 + .../Morfa/constrained-genericity-2.morfa | 26 + .../Nim/constrained-genericity.nim | 21 + .../Sidef/constrained-genericity.sidef | 7 + .../Swift/constrained-genericity-1.swift | 3 + .../Swift/constrained-genericity-2.swift | 3 + .../Swift/constrained-genericity-3.swift | 2 + ...trained-random-points-on-a-circle.echolisp | 16 + .../constrained-random-points-on-a-circle.hy | 13 + .../constrained-random-points-on-a-circle.nim | 25 + ...constrained-random-points-on-a-circle.phix | 14 + ...constrained-random-points-on-a-circle.ring | 44 ++ ...onstrained-random-points-on-a-circle.sidef | 23 + ...metic-construct-from-rational-number.sidef | 25 + .../Sidef/continued-fraction.sidef | 29 + .../jq/continued-fraction-1.jq | 25 + .../jq/continued-fraction-2.jq | 4 + .../jq/continued-fraction-3.jq | 5 + ...onvert-decimal-number-to-rational.echolisp | 27 + ...nvert-decimal-number-to-rational.freebasic | 62 ++ .../convert-decimal-number-to-rational.phix | 16 + ...convert-decimal-number-to-rational-1.sidef | 3 + ...convert-decimal-number-to-rational-2.sidef | 3 + .../Axe/conways-game-of-life.axe | 44 ++ .../FunL/conways-game-of-life.funl | 89 +++ .../Futhark/conways-game-of-life.futhark | 43 ++ .../Nim/conways-game-of-life.nim | 42 ++ .../conways-game-of-life-1.sequencel | 21 + .../conways-game-of-life-2.sequencel | 180 +++++ .../Shen/conways-game-of-life.shen | 133 ++++ .../Sidef/conways-game-of-life.sidef | 36 + .../Wortel/conways-game-of-life-1.wortel | 24 + .../Wortel/conways-game-of-life-2.wortel | 53 ++ .../jq/conways-game-of-life-1.jq | 44 ++ .../jq/conways-game-of-life-2.jq | 26 + .../jq/conways-game-of-life-3.jq | 15 + .../jq/conways-game-of-life-4.jq | 1 + .../jq/conways-game-of-life-5.jq | 31 + .../jq/conways-game-of-life-6.jq | 2 + Task/Copy-a-string/Apex/copy-a-string.apex | 6 + Task/Copy-a-string/Axe/copy-a-string.axe | 10 + .../copy-a-string.computer | 28 + .../EchoLisp/copy-a-string.echolisp | 6 + .../FreeBASIC/copy-a-string.freebasic | 12 + .../FutureBasic/copy-a-string.futurebasic | 6 + Task/Copy-a-string/I/copy-a-string.i | 6 + .../LC3-Assembly/copy-a-string.lc3 | 22 + Task/Copy-a-string/LFE/copy-a-string-1.lfe | 3 + Task/Copy-a-string/LFE/copy-a-string-2.lfe | 8 + Task/Copy-a-string/Lasso/copy-a-string.lasso | 18 + .../Copy-a-string/Lingo/copy-a-string-1.lingo | 2 + .../Copy-a-string/Lingo/copy-a-string-2.lingo | 5 + .../LiveCode/copy-a-string.livecode | 3 + Task/Copy-a-string/Nim/copy-a-string.nim | 3 + .../Oforth/copy-a-string-1.oforth | 1 + .../Oforth/copy-a-string-2.oforth | 1 + Task/Copy-a-string/Phix/copy-a-string.phix | 5 + Task/Copy-a-string/Ring/copy-a-string.ring | 2 + Task/Copy-a-string/Sidef/copy-a-string.sidef | 4 + Task/Copy-a-string/Swift/copy-a-string.swift | 2 + Task/Copy-a-string/Ursa/copy-a-string.ursa | 3 + Task/Copy-a-string/jq/copy-a-string.jq | 8 + .../EchoLisp/count-in-factors.echolisp | 3 + .../FreeBASIC/count-in-factors.freebasic | 38 + .../Count-in-factors/Nim/count-in-factors.nim | 39 ++ .../Phix/count-in-factors.phix | 24 + .../Ring/count-in-factors.ring | 15 + .../Sidef/count-in-factors.sidef | 29 + .../FreeBASIC/count-in-octal.freebasic | 10 + .../Futhark/count-in-octal.futhark | 9 + .../FutureBasic/count-in-octal.futurebasic | 8 + Task/Count-in-octal/LFE/count-in-octal.lfe | 4 + Task/Count-in-octal/Nim/count-in-octal.nim | 3 + Task/Count-in-octal/Phix/count-in-octal.phix | 6 + Task/Count-in-octal/Ring/count-in-octal.ring | 14 + .../Count-in-octal/Sidef/count-in-octal.sidef | 2 + .../Sparkling/count-in-octal.sparkling | 3 + .../Count-in-octal/Swift/count-in-octal.swift | 28 + .../count-occurrences-of-a-substring.apex | 11 + .../count-occurrences-of-a-substring.echolisp | 8 + ...count-occurrences-of-a-substring.freebasic | 20 + .../count-occurrences-of-a-substring.funl | 6 + .../count-occurrences-of-a-substring.lasso | 26 + .../Nim/count-occurrences-of-a-substring.nim | 14 + .../count-occurrences-of-a-substring.oforth | 3 + .../count-occurrences-of-a-substring.phix | 20 + .../count-occurrences-of-a-substring.ring | 11 + .../count-occurrences-of-a-substring-1.sidef | 2 + .../count-occurrences-of-a-substring-2.sidef | 9 + .../count-occurrences-of-a-substring.wortel | 8 + .../jq/count-occurrences-of-a-substring-1.jq | 2 + .../jq/count-occurrences-of-a-substring-2.jq | 1 + .../Count-the-coins/Coco/count-the-coins.coco | 8 + .../EchoLisp/count-the-coins-1.echolisp | 20 + .../EchoLisp/count-the-coins-2.echolisp | 31 + .../FreeBASIC/count-the-coins.freebasic | 66 ++ .../FutureBasic/count-the-coins.futurebasic | 20 + .../Lasso/count-the-coins.lasso | 30 + Task/Count-the-coins/Nim/count-the-coins.nim | 10 + .../Sidef/count-the-coins.sidef | 17 + Task/Count-the-coins/jq/count-the-coins.jq | 16 + .../Nim/create-a-file-on-magnetic-tape.nim | 3 + Task/Create-a-file/Axe/create-a-file.axe | 1 + Task/Create-a-file/ChucK/create-a-file.chuck | 2 + Task/Create-a-file/ERRE/create-a-file.erre | 14 + .../EchoLisp/create-a-file.echolisp | 15 + .../FreeBASIC/create-a-file.freebasic | 15 + Task/Create-a-file/FunL/create-a-file.funl | 6 + Task/Create-a-file/I/create-a-file.i | 17 + Task/Create-a-file/LFE/create-a-file.lfe | 4 + Task/Create-a-file/Lasso/create-a-file.lasso | 17 + .../Create-a-file/Lingo/create-a-file-1.lingo | 3 + .../Create-a-file/Lingo/create-a-file-2.lingo | 6 + .../Create-a-file/Lingo/create-a-file-3.lingo | 3 + Task/Create-a-file/Nim/create-a-file-1.nim | 7 + Task/Create-a-file/Nim/create-a-file-2.nim | 5 + Task/Create-a-file/Phix/create-a-file.phix | 15 + Task/Create-a-file/Ring/create-a-file.ring | 4 + Task/Create-a-file/Sidef/create-a-file.sidef | 7 + Task/Create-a-file/Ursa/create-a-file.ursa | 7 + ...te-a-two-dimensional-array-at-runtime.erre | 12 + ...two-dimensional-array-at-runtime.freebasic | 11 + ...ate-a-two-dimensional-array-at-runtime.nim | 9 + ...te-a-two-dimensional-array-at-runtime.phix | 13 + ...te-a-two-dimensional-array-at-runtime.ring | 5 + ...e-a-two-dimensional-array-at-runtime.sidef | 10 + ...e-a-two-dimensional-array-at-runtime.swift | 19 + ...te-a-two-dimensional-array-at-runtime.ursa | 19 + ...te-a-two-dimensional-array-at-runtime-1.jq | 11 + ...te-a-two-dimensional-array-at-runtime-2.jq | 1 + .../EchoLisp/create-an-html-table-1.echolisp | 26 + .../EchoLisp/create-an-html-table-2.echolisp | 5 + .../Lasso/create-an-html-table.lasso | 21 + .../Lingo/create-an-html-table-1.lingo | 25 + .../Lingo/create-an-html-table-2.lingo | 12 + .../Nim/create-an-html-table.nim | 14 + .../Peloton/create-an-html-table.peloton | 17 + .../Phix/create-an-html-table-1.phix | 14 + .../Phix/create-an-html-table-2.phix | 7 + .../Sidef/create-an-html-table.sidef | 50 ++ .../Ursa/create-an-html-table.ursa | 18 + .../jq/create-an-html-table-1.jq | 23 + .../jq/create-an-html-table-2.jq | 7 + .../jq/create-an-html-table-3.jq | 31 + ...ate-an-object-at-a-given-address.freebasic | 34 + .../create-an-object-at-a-given-address.phix | 4 + Task/Currying/EchoLisp/currying.echolisp | 19 + Task/Currying/Eero/currying-1.eero | 14 + Task/Currying/Eero/currying-2.eero | 12 + Task/Currying/FreeBASIC/currying.freebasic | 18 + Task/Currying/LFE/currying-1.lfe | 4 + Task/Currying/LFE/currying-2.lfe | 1 + Task/Currying/Nim/currying-1.nim | 4 + Task/Currying/Nim/currying-2.nim | 6 + Task/Currying/Oforth/currying.oforth | 3 + Task/Currying/Sidef/currying-1.sidef | 2 + Task/Currying/Sidef/currying-2.sidef | 12 + Task/Currying/Swift/currying-1.swift | 5 + Task/Currying/Swift/currying-2.swift | 5 + Task/Currying/Swift/currying-3.swift | 5 + Task/Currying/Wortel/currying.wortel | 20 + Task/Currying/jq/currying-1.jq | 3 + Task/Currying/jq/currying-2.jq | 1 + Task/DNS-query/Lasso/dns-query-1.lasso | 1 + Task/DNS-query/Lasso/dns-query-2.lasso | 13 + Task/DNS-query/Lasso/dns-query-3.lasso | 11 + Task/DNS-query/Sidef/dns-query.sidef | 8 + Task/Date-format/8th/date-format.8th | 4 + Task/Date-format/Apex/date-format.apex | 5 + .../FreeBASIC/date-format.freebasic | 10 + Task/Date-format/FunL/date-format.funl | 2 + Task/Date-format/Lasso/date-format.lasso | 2 + Task/Date-format/Nim/date-format.nim | 5 + Task/Date-format/Phix/date-format.phix | 3 + Task/Date-format/Ring/date-format.ring | 26 + Task/Date-format/Sidef/date-format.sidef | 4 + Task/Date-format/Swift/date-format.swift | 11 + Task/Date-format/Ursa/date-format.ursa | 13 + Task/Date-format/jq/date-format.jq | 3 + .../EchoLisp/date-manipulation.echolisp | 9 + .../FreeBASIC/date-manipulation.freebasic | 86 +++ .../FunL/date-manipulation.funl | 8 + .../Lasso/date-manipulation.lasso | 3 + .../Lingo/date-manipulation-1.lingo | 35 + .../Lingo/date-manipulation-2.lingo | 27 + .../Nim/date-manipulation.nim | 6 + .../Phix/date-manipulation.phix | 10 + .../Sidef/date-manipulation.sidef | 9 + .../jq/date-manipulation-1.jq | 4 + .../jq/date-manipulation-2.jq | 1 + Task/Day-of-the-week/ECL/day-of-the-week.ecl | 39 ++ .../Day-of-the-week/ERRE/day-of-the-week.erre | 29 + .../Lasso/day-of-the-week.lasso | 4 + .../Lingo/day-of-the-week.lingo | 7 + .../LiveCode/day-of-the-week-1.livecode | 13 + .../LiveCode/day-of-the-week-2.livecode | 1 + Task/Day-of-the-week/Nim/day-of-the-week.nim | 9 + .../Oforth/day-of-the-week.oforth | 2 + .../Peloton/day-of-the-week-1.peloton | 9 + .../Peloton/day-of-the-week-2.peloton | 10 + .../Day-of-the-week/Phix/day-of-the-week.phix | 7 + .../Day-of-the-week/Ring/day-of-the-week.ring | 5 + .../Sidef/day-of-the-week.sidef | 9 + .../Swift/day-of-the-week.swift | 16 + .../Wortel/day-of-the-week.wortel | 1 + Task/Day-of-the-week/jq/day-of-the-week-1.jq | 18 + Task/Day-of-the-week/jq/day-of-the-week-2.jq | 3 + .../Ceylon/deal-cards-for-freecell.ceylon | 33 + .../ERRE/deal-cards-for-freecell.erre | 50 ++ .../deal-cards-for-freecell.freebasic | 62 ++ .../Nim/deal-cards-for-freecell.nim | 29 + Task/Death-Star/Set-lang/death-star.set | 60 ++ Task/Death-Star/Sidef/death-star.sidef | 65 ++ Task/Deepcopy/Lasso/deepcopy.lasso | 1 + Task/Deepcopy/Lingo/deepcopy-1.lingo | 19 + Task/Deepcopy/Lingo/deepcopy-2.lingo | 8 + Task/Deepcopy/Nim/deepcopy-1.nim | 1 + Task/Deepcopy/Nim/deepcopy-2.nim | 36 + Task/Deepcopy/Sidef/deepcopy.sidef | 15 + .../define-a-primitive-data-type.echolisp | 30 + .../define-a-primitive-data-type.freebasic | 40 ++ .../Lasso/define-a-primitive-data-type.lasso | 28 + .../Nim/define-a-primitive-data-type.nim | 7 + .../Phix/define-a-primitive-data-type-1.phix | 3 + .../Phix/define-a-primitive-data-type-2.phix | 2 + .../Phix/define-a-primitive-data-type-3.phix | 2 + .../Sidef/define-a-primitive-data-type.sidef | 37 + .../define-a-primitive-data-type.visual | 31 + .../jq/define-a-primitive-data-type-1.jq | 2 + .../jq/define-a-primitive-data-type-2.jq | 4 + .../jq/define-a-primitive-data-type-3.jq | 14 + .../jq/define-a-primitive-data-type-4.jq | 5 + .../jq/define-a-primitive-data-type-5.jq | 3 + Task/Delegates/NGS/delegates.ngs | 40 ++ Task/Delegates/Oforth/delegates-1.oforth | 11 + Task/Delegates/Oforth/delegates-2.oforth | 8 + Task/Delegates/Swift/delegates-1.swift | 33 + Task/Delegates/Swift/delegates-2.swift | 27 + Task/Delete-a-file/8th/delete-a-file.8th | 4 + Task/Delete-a-file/Axe/delete-a-file.axe | 1 + .../FreeBASIC/delete-a-file.freebasic | 15 + Task/Delete-a-file/Lasso/delete-a-file.lasso | 17 + .../Delete-a-file/Lingo/delete-a-file-1.lingo | 4 + .../Delete-a-file/Lingo/delete-a-file-2.lingo | 7 + .../Delete-a-file/Lingo/delete-a-file-3.lingo | 8 + Task/Delete-a-file/Nim/delete-a-file.nim | 5 + Task/Delete-a-file/Ring/delete-a-file.ring | 2 + Task/Delete-a-file/Sidef/delete-a-file.sidef | 7 + Task/Delete-a-file/Ursa/delete-a-file.ursa | 5 + .../8th/detect-division-by-zero.8th | 1 + .../Ceylon/detect-division-by-zero.ceylon | 12 + .../ECL/detect-division-by-zero-1.ecl | 4 + .../ECL/detect-division-by-zero-2.ecl | 3 + .../ECL/detect-division-by-zero-3.ecl | 9 + .../ERRE/detect-division-by-zero.erre | 10 + .../detect-division-by-zero.freebasic | 25 + .../detect-division-by-zero.futurebasic | 5 + .../I/detect-division-by-zero.i | 14 + .../Lasso/detect-division-by-zero.lasso | 13 + .../Lingo/detect-division-by-zero.lingo | 9 + .../Nim/detect-division-by-zero.nim | 12 + .../Oforth/detect-division-by-zero.oforth | 4 + .../RPGIV/detect-division-by-zero.rpgiv | 17 + .../Ring/detect-division-by-zero.ring | 5 + .../Sidef/detect-division-by-zero.sidef | 13 + .../Ursa/detect-division-by-zero.ursa | 8 + .../jq/detect-division-by-zero-1.jq | 1 + .../jq/detect-division-by-zero-2.jq | 1 + .../8th/determine-if-a-string-is-numeric.8th | 1 + .../determine-if-a-string-is-numeric.apex | 8 + .../determine-if-a-string-is-numeric.echolisp | 6 + ...determine-if-a-string-is-numeric.freebasic | 95 +++ .../I/determine-if-a-string-is-numeric.i | 15 + .../determine-if-a-string-is-numeric-1.lasso | 2 + .../determine-if-a-string-is-numeric-2.lasso | 2 + .../Nim/determine-if-a-string-is-numeric.nim | 10 + ...etermine-if-a-string-is-numeric.peoplecode | 25 + .../determine-if-a-string-is-numeric-1.phix | 3 + .../determine-if-a-string-is-numeric-2.phix | 10 + .../determine-if-a-string-is-numeric.ring | 2 + .../determine-if-a-string-is-numeric-1.sidef | 1 + .../determine-if-a-string-is-numeric-2.sidef | 4 + .../determine-if-a-string-is-numeric-3.sidef | 4 + .../determine-if-a-string-is-numeric-1.swift | 3 + .../determine-if-a-string-is-numeric-2.swift | 3 + .../determine-if-a-string-is-numeric.ursa | 8 + .../determine-if-a-string-is-numeric.xlisp | 2 + .../jq/determine-if-a-string-is-numeric-1.jq | 1 + .../jq/determine-if-a-string-is-numeric-2.jq | 1 + ...mine-if-only-one-instance-is-running.lasso | 22 + ...ermine-if-only-one-instance-is-running.nim | 19 + ...rmine-if-only-one-instance-is-running.phix | 23 + ...mine-if-only-one-instance-is-running.sidef | 12 + ...mine-if-only-one-instance-is-running.swift | 26 + ...gital-root-multiplicative-digital-root.nim | 28 + ...tal-root-multiplicative-digital-root.sidef | 23 + ...ital-root-multiplicative-digital-root-1.jq | 32 + ...ital-root-multiplicative-digital-root-2.jq | 15 + ...ital-root-multiplicative-digital-root-3.jq | 20 + .../FreeBASIC/digital-root.freebasic | 27 + Task/Digital-root/Nim/digital-root.nim | 14 + Task/Digital-root/Oforth/digital-root.oforth | 4 + Task/Digital-root/Potion/digital-root.potion | 17 + Task/Digital-root/Ring/digital-root.ring | 22 + Task/Digital-root/Sidef/digital-root.sidef | 25 + Task/Digital-root/Wortel/digital-root.wortel | 13 + Task/Digital-root/jq/digital-root-1.jq | 20 + Task/Digital-root/jq/digital-root-2.jq | 8 + Task/Digital-root/jq/digital-root-3.jq | 9 + .../dinesmans-multiple-dwelling-problem.erre | 48 ++ ...smans-multiple-dwelling-problem-1.echolisp | 27 + ...smans-multiple-dwelling-problem-2.echolisp | 21 + ...smans-multiple-dwelling-problem-3.echolisp | 2 + ...smans-multiple-dwelling-problem-4.echolisp | 13 + ...smans-multiple-dwelling-problem-5.echolisp | 2 + .../dinesmans-multiple-dwelling-problem.ring | 28 + ...inesmans-multiple-dwelling-problem-1.sidef | 34 + ...inesmans-multiple-dwelling-problem-2.sidef | 22 + ...inesmans-multiple-dwelling-problem-3.sidef | 17 + .../dinesmans-multiple-dwelling-problem-1.jq | 16 + .../dinesmans-multiple-dwelling-problem-2.jq | 9 + .../dinesmans-multiple-dwelling-problem-3.jq | 8 + .../EchoLisp/dining-philosophers-1.echolisp | 39 ++ .../EchoLisp/dining-philosophers-2.echolisp | 10 + .../Nim/dining-philosophers.nim | 41 ++ .../Phix/dining-philosophers.phix | 49 ++ .../Phix/discordian-date-1.phix | 33 + .../Phix/discordian-date-2.phix | 10 + .../Sidef/discordian-date.sidef | 31 + .../LFE/distributed-programming-1.lfe | 5 + .../LFE/distributed-programming-2.lfe | 19 + .../LFE/distributed-programming-3.lfe | 14 + .../LFE/distributed-programming-4.lfe | 4 + .../LFE/distributed-programming-5.lfe | 13 + .../LFE/distributed-programming-6.lfe | 3 + .../Nim/distributed-programming.nim | 42 ++ Task/Documentation/Gri/documentation-1.gri | 6 + Task/Documentation/Gri/documentation-2.gri | 1 + Task/Documentation/Nim/documentation.nim | 31 + Task/Documentation/Ring/documentation.ring | 9 + Task/Documentation/Swift/documentation.swift | 9 + Task/Dot-product/8th/dot-product.8th | 1 + .../Dot-product/EchoLisp/dot-product.echolisp | 10 + Task/Dot-product/FunL/dot-product.funl | 7 + Task/Dot-product/Idris/dot-product.idris | 9 + Task/Dot-product/LFE/dot-product.lfe | 3 + Task/Dot-product/Nim/dot-product.nim | 9 + Task/Dot-product/Oforth/dot-product.oforth | 1 + Task/Dot-product/Phix/dot-product.phix | 1 + Task/Dot-product/Ring/dot-product.ring | 10 + Task/Dot-product/Sidef/dot-product.sidef | 4 + Task/Dot-product/Swift/dot-product.swift | 5 + Task/Dot-product/Wart/dot-product.wart | 2 + Task/Dot-product/jq/dot-product-1.jq | 2 + Task/Dot-product/jq/dot-product-2.jq | 1 + Task/Dot-product/jq/dot-product-3.jq | 4 + .../Nim/doubly-linked-list-definition.nim | 68 ++ .../doubly-linked-list-definition.oforth | 50 ++ .../doubly-linked-list-element-definition.axe | 18 + .../doubly-linked-list-element-definition.nim | 6 + ...ubly-linked-list-element-definition.oforth | 1 + ...oubly-linked-list-element-definition.sidef | 7 + .../doubly-linked-list-element-insertion.axe | 7 + .../doubly-linked-list-element-insertion.nim | 6 + ...oubly-linked-list-element-insertion.oforth | 7 + .../Axe/doubly-linked-list-traversal.axe | 20 + .../Nim/doubly-linked-list-traversal.nim | 80 +++ .../doubly-linked-list-traversal.oforth | 20 + Task/Dragon-curve/ERRE/dragon-curve.erre | 47 ++ Task/Dragon-curve/Elm/dragon-curve.elm | 94 +++ Task/Dragon-curve/Gri/dragon-curve.gri | 63 ++ .../SequenceL/dragon-curve-1.sequencel | 38 + .../SequenceL/dragon-curve-2.sequencel | 74 ++ Task/Dragon-curve/Sidef/dragon-curve.sidef | 37 + Task/Dragon-curve/jq/dragon-curve-1.jq | 56 ++ Task/Dragon-curve/jq/dragon-curve-2.jq | 2 + Task/Dragon-curve/jq/dragon-curve-3.jq | 11 + Task/Draw-a-clock/FunL/draw-a-clock.funl | 67 ++ Task/Draw-a-clock/Nim/draw-a-clock.nim | 14 + Task/Draw-a-clock/Sidef/draw-a-clock.sidef | 31 + Task/Draw-a-cuboid/Nim/draw-a-cuboid.nim | 19 + Task/Draw-a-cuboid/Phix/draw-a-cuboid.phix | 76 ++ .../Draw-a-cuboid/Sidef/draw-a-cuboid-1.sidef | 31 + .../Draw-a-cuboid/Sidef/draw-a-cuboid-2.sidef | 30 + Task/Draw-a-sphere/ERRE/draw-a-sphere.erre | 54 ++ .../FutureBasic/draw-a-sphere.futurebasic | 74 ++ Task/Draw-a-sphere/Lingo/draw-a-sphere.lingo | 16 + Task/Draw-a-sphere/Nim/draw-a-sphere.nim | 31 + Task/Draw-a-sphere/Sidef/draw-a-sphere.sidef | 33 + Task/Draw-a-sphere/Swift/draw-a-sphere.swift | 31 + Task/Draw-a-sphere/jq/draw-a-sphere-1.jq | 19 + Task/Draw-a-sphere/jq/draw-a-sphere-2.jq | 9 + Task/Draw-a-sphere/jq/draw-a-sphere-3.jq | 1 + .../Lasso/dutch-national-flag-problem.lasso | 16 + .../dutch-national-flag-problem-1.visual | 34 + .../dutch-national-flag-problem-2.visual | 35 + .../dynamic-variable-names.freebasic | 58 ++ .../Lasso/dynamic-variable-names.lasso | 7 + .../Lingo/dynamic-variable-names.lingo | 7 + .../Oforth/dynamic-variable-names.oforth | 7 + .../Ring/dynamic-variable-names-1.ring | 2 + .../Ring/dynamic-variable-names-2.ring | 2 + .../Sidef/dynamic-variable-names.sidef | 10 + Task/Echo-server/LFE/echo-server.lfe | 18 + Task/Echo-server/Nim/echo-server.nim | 18 + .../Phix/element-wise-operations.phix | 12 + .../jq/element-wise-operations-1.jq | 12 + .../jq/element-wise-operations-2.jq | 4 + .../jq/element-wise-operations-3.jq | 3 + .../jq/element-wise-operations-4.jq | 23 + .../jq/element-wise-operations-5.jq | 4 + .../jq/element-wise-operations-6.jq | 3 + .../FreeBASIC/empty-directory.freebasic | 43 ++ .../Lasso/empty-directory.lasso | 3 + .../Lingo/empty-directory.lingo | 3 + Task/Empty-directory/Nim/empty-directory.nim | 7 + .../Empty-directory/Ring/empty-directory.ring | 3 + .../Sidef/empty-directory-1.sidef | 1 + .../Sidef/empty-directory-2.sidef | 8 + .../8051-Assembly/empty-program.8051 | 2 + Task/Empty-program/Axe/empty-program.axe | 2 + .../empty-program.computer | 1 + .../EDSAC-order-code/empty-program.edsac | 4 + Task/Empty-program/ERRE/empty-program.erre | 3 + .../EchoLisp/empty-program.echolisp | 0 .../FreeBASIC/empty-program.freebasic | 0 Task/Empty-program/FunL/empty-program.funl | 0 .../Futhark/empty-program.futhark | 1 + .../FutureBasic/empty-program.futurebasic | 1 + Task/Empty-program/I/empty-program.i | 1 + .../LC3-Assembly/empty-program.lc3 | 1 + .../Empty-program/Lasso/empty-program-1.lasso | 1 + .../Empty-program/Lasso/empty-program-2.lasso | 1 + .../Empty-program/Lasso/empty-program-3.lasso | 1 + Task/Empty-program/Lingo/empty-program.lingo | 0 .../Oforth/empty-program-1.oforth | 1 + .../Oforth/empty-program-2.oforth | 1 + .../OpenLisp/empty-program.openlisp | 2 + Task/Empty-program/Ring/empty-program.ring | 0 Task/Empty-program/SSEM/empty-program-1.ssem | 2 + Task/Empty-program/SSEM/empty-program-2.ssem | 1 + Task/Empty-program/Set-lang/empty-program.set | 0 Task/Empty-program/Sidef/empty-program.sidef | 0 .../Sparkling/empty-program.sparkling | 0 Task/Empty-program/Swift/empty-program.swift | 0 .../Empty-program/Symsyn/empty-program.symsyn | 0 .../TI-83-Hex-Assembly/empty-program.ti-83 | 2 + Task/Empty-program/Ursa/empty-program.ursa | 0 Task/Empty-string/8th/empty-string-1.8th | 1 + Task/Empty-string/8th/empty-string-2.8th | 1 + Task/Empty-string/Apex/empty-string.apex | 2 + Task/Empty-string/Axe/empty-string.axe | 6 + .../FreeBASIC/empty-string.freebasic | 17 + .../FutureBasic/empty-string.futurebasic | 13 + Task/Empty-string/I/empty-string.i | 11 + Task/Empty-string/LFE/empty-string.lfe | 24 + Task/Empty-string/Lasso/empty-string.lasso | 12 + Task/Empty-string/Lingo/empty-string.lingo | 5 + Task/Empty-string/NESL/empty-string.nesl | 5 + Task/Empty-string/Nim/empty-string.nim | 12 + Task/Empty-string/Oforth/empty-string.oforth | 2 + Task/Empty-string/Phix/empty-string.phix | 9 + Task/Empty-string/Ring/empty-string.ring | 6 + Task/Empty-string/Sidef/empty-string-1.sidef | 2 + Task/Empty-string/Sidef/empty-string-2.sidef | 5 + Task/Empty-string/Sidef/empty-string-3.sidef | 4 + Task/Empty-string/Swift/empty-string.swift | 6 + Task/Empty-string/Ursa/empty-string.ursa | 8 + Task/Empty-string/jq/empty-string-1.jq | 1 + Task/Empty-string/jq/empty-string-2.jq | 3 + Task/Empty-string/jq/empty-string-3.jq | 3 + .../8th/enforced-immutability.8th | 1 + .../Nim/enforced-immutability.nim | 7 + .../Oforth/enforced-immutability.oforth | 12 + .../Phix/enforced-immutability.phix | 3 + .../Sidef/enforced-immutability.sidef | 2 + .../jq/enforced-immutability.jq | 1 + Task/Entropy/EchoLisp/entropy-1.echolisp | 18 + Task/Entropy/EchoLisp/entropy-2.echolisp | 12 + Task/Entropy/FreeBASIC/entropy.freebasic | 34 + Task/Entropy/Nim/entropy.nim | 8 + Task/Entropy/Oforth/entropy.oforth | 8 + Task/Entropy/Sidef/entropy.sidef | 10 + Task/Entropy/jq/entropy-1.jq | 10 + Task/Entropy/jq/entropy-2.jq | 1 + .../FreeBASIC/enumerations.freebasic | 17 + .../FutureBasic/enumerations.futurebasic | 21 + Task/Enumerations/Lingo/enumerations-1.lingo | 32 + Task/Enumerations/Lingo/enumerations-2.lingo | 34 + Task/Enumerations/Nim/enumerations.nim | 8 + Task/Enumerations/Oforth/enumerations.oforth | 1 + Task/Enumerations/Phix/enumerations.phix | 2 + Task/Enumerations/Ring/enumerations.ring | 6 + Task/Enumerations/Sidef/enumerations-1.sidef | 1 + Task/Enumerations/Sidef/enumerations-2.sidef | 6 + Task/Enumerations/Swift/enumerations.swift | 16 + Task/Enumerations/jq/enumerations.jq | 2 + .../FreeBASIC/environment-variables.freebasic | 5 + .../FunL/environment-variables.funl | 3 + .../Gri/environment-variables-1.gri | 2 + .../Gri/environment-variables-2.gri | 1 + .../I/environment-variables.i | 5 + .../Lasso/environment-variables.lasso | 15 + .../Lingo/environment-variables.lingo | 6 + .../Nim/environment-variables.nim | 2 + .../Oforth/environment-variables.oforth | 1 + .../Phix/environment-variables.phix | 1 + .../Ring/environment-variables.ring | 1 + .../Sidef/environment-variables.sidef | 1 + .../Ursa/environment-variables.ursa | 2 + .../jq/environment-variables.jq | 1 + .../ERRE/equilibrium-index.erre | 21 + .../FreeBASIC/equilibrium-index.freebasic | 36 + .../Nim/equilibrium-index.nim | 20 + .../Oforth/equilibrium-index.oforth | 9 + .../Phix/equilibrium-index.phix | 15 + .../Ring/equilibrium-index.ring | 14 + .../Sidef/equilibrium-index-1.sidef | 8 + .../Sidef/equilibrium-index-2.sidef | 10 + .../jq/equilibrium-index-1.jq | 13 + .../jq/equilibrium-index-2.jq | 1 + .../jq/equilibrium-index-3.jq | 6 + .../ERRE/ethiopian-multiplication.erre | 23 + .../Nim/ethiopian-multiplication.nim | 15 + .../Oforth/ethiopian-multiplication.oforth | 7 + .../Phix/ethiopian-multiplication.phix | 23 + .../ethiopian-multiplication.powerbuilder | 28 + .../Ring/ethiopian-multiplication.ring | 18 + .../Sidef/ethiopian-multiplication.sidef | 14 + .../Swift/ethiopian-multiplication.swift | 26 + .../Euler-method/Futhark/euler-method.futhark | 15 + Task/Euler-method/Nim/euler-method.nim | 13 + .../Euler-method/Oforth/euler-method-1.oforth | 6 + .../Euler-method/Oforth/euler-method-2.oforth | 7 + Task/Euler-method/Phix/euler-method.phix | 33 + Task/Euler-method/Ring/euler-method.ring | 13 + .../SequenceL/euler-method.sequencel | 25 + Task/Euler-method/Sidef/euler-method.sidef | 30 + Task/Euler-method/jq/euler-method-1.jq | 24 + Task/Euler-method/jq/euler-method-2.jq | 10 + Task/Euler-method/jq/euler-method-3.jq | 1 + Task/Euler-method/jq/euler-method-4.jq | 6 + .../ERRE/evaluate-binomial-coefficients.erre | 27 + .../evaluate-binomial-coefficients.freebasic | 31 + .../evaluate-binomial-coefficients-1.funl | 8 + .../evaluate-binomial-coefficients-2.funl | 5 + .../evaluate-binomial-coefficients.lasso | 12 + .../evaluate-binomial-coefficients.minil | 33 + .../Nim/evaluate-binomial-coefficients.nim | 6 + .../evaluate-binomial-coefficients.oforth | 1 + .../Ring/evaluate-binomial-coefficients.ring | 12 + .../evaluate-binomial-coefficients-1.sidef | 5 + .../evaluate-binomial-coefficients-2.sidef | 1 + .../jq/evaluate-binomial-coefficients.jq | 12 + Task/Even-or-odd/8th/even-or-odd-1.8th | 4 + Task/Even-or-odd/8th/even-or-odd-2.8th | 4 + Task/Even-or-odd/AntLang/even-or-odd.antlang | 2 + Task/Even-or-odd/Crystal/even-or-odd.crystal | 30 + Task/Even-or-odd/ERRE/even-or-odd.erre | 19 + .../FreeBASIC/even-or-odd.freebasic | 19 + Task/Even-or-odd/Futhark/even-or-odd.futhark | 1 + Task/Even-or-odd/L++/even-or-odd.lpp | 1 + Task/Even-or-odd/LC3-Assembly/even-or-odd.lc3 | 21 + Task/Even-or-odd/Lasso/even-or-odd.lasso | 5 + Task/Even-or-odd/Lingo/even-or-odd.lingo | 7 + .../Even-or-odd/LiveCode/even-or-odd.livecode | 7 + Task/Even-or-odd/NESL/even-or-odd.nesl | 4 + Task/Even-or-odd/Nim/even-or-odd.nim | 14 + Task/Even-or-odd/Oforth/even-or-odd.oforth | 2 + Task/Even-or-odd/Phix/even-or-odd.phix | 3 + Task/Even-or-odd/Ring/even-or-odd.ring | 5 + Task/Even-or-odd/SSEM/even-or-odd.ssem | 15 + .../SequenceL/even-or-odd.sequencel | 2 + Task/Even-or-odd/Sidef/even-or-odd-1.sidef | 3 + Task/Even-or-odd/Sidef/even-or-odd-2.sidef | 2 + Task/Even-or-odd/Sidef/even-or-odd-3.sidef | 2 + Task/Even-or-odd/Swift/even-or-odd.swift | 13 + Task/Even-or-odd/Symsyn/even-or-odd.symsyn | 6 + Task/Even-or-odd/Ursa/even-or-odd.ursa | 7 + Task/Even-or-odd/jq/even-or-odd-1.jq | 1 + Task/Even-or-odd/jq/even-or-odd-2.jq | 1 + Task/Events/LFE/events.lfe | 19 + Task/Events/Lingo/events-1.lingo | 9 + Task/Events/Lingo/events-2.lingo | 8 + Task/Events/Lingo/events-3.lingo | 15 + Task/Events/Nim/events.nim | 14 + Task/Events/Oforth/events-1.oforth | 6 + Task/Events/Oforth/events-2.oforth | 11 + .../8th/evolutionary-algorithm.8th | 94 +++ .../Ceylon/evolutionary-algorithm.ceylon | 49 ++ .../EchoLisp/evolutionary-algorithm.echolisp | 38 + .../Nim/evolutionary-algorithm.nim | 34 + .../Oforth/evolutionary-algorithm.oforth | 20 + .../Phix/evolutionary-algorithm.phix | 36 + .../Pony/evolutionary-algorithm-1.pony | 73 ++ .../Pony/evolutionary-algorithm-2.pony | 115 +++ .../evolutionary-algorithm-1.sequencel | 23 + .../evolutionary-algorithm-2.sequencel | 50 ++ .../Sidef/evolutionary-algorithm.sidef | 13 + ...exception-thrown-in-a-nested-call.echolisp | 21 + ...xception-thrown-in-a-nested-call.freebasic | 48 ++ ...an-exception-thrown-in-a-nested-call.lasso | 40 ++ ...h-an-exception-thrown-in-a-nested-call.nim | 18 + ...n-exception-thrown-in-a-nested-call.oforth | 11 + ...an-exception-thrown-in-a-nested-call.sidef | 14 + ...an-exception-thrown-in-a-nested-call.swift | 28 + ...ch-an-exception-thrown-in-a-nested-call.jq | 14 + .../Exceptions/FreeBASIC/exceptions.freebasic | 30 + Task/Exceptions/Lasso/exceptions.lasso | 6 + Task/Exceptions/Lingo/exceptions-1.lingo | 19 + Task/Exceptions/Lingo/exceptions-2.lingo | 4 + Task/Exceptions/Lingo/exceptions-3.lingo | 6 + Task/Exceptions/Nim/exceptions-1.nim | 1 + Task/Exceptions/Nim/exceptions-2.nim | 2 + Task/Exceptions/Nim/exceptions-3.nim | 8 + Task/Exceptions/Oforth/exceptions.oforth | 7 + Task/Exceptions/PHL/exceptions.phl | 23 + Task/Exceptions/Ring/exceptions.ring | 5 + Task/Exceptions/Sidef/exceptions.sidef | 11 + Task/Exceptions/Swift/exceptions-1.swift | 3 + Task/Exceptions/Swift/exceptions-2.swift | 3 + Task/Exceptions/Swift/exceptions-3.swift | 7 + Task/Exceptions/Ursa/exceptions-1.ursa | 6 + Task/Exceptions/Ursa/exceptions-2.ursa | 1 + Task/Exceptions/jq/exceptions-1.jq | 1 + Task/Exceptions/jq/exceptions-2.jq | 14 + .../Nim/executable-library-1.nim | 20 + .../Nim/executable-library-2.nim | 10 + .../Sidef/executable-library-1.sidef | 26 + .../Sidef/executable-library-2.sidef | 1 + .../Sidef/executable-library-3.sidef | 7 + .../Sidef/executable-library-4.sidef | 1 + .../Axe/execute-brain-----1.axe | 57 ++ .../Axe/execute-brain-----2.axe | 2 + .../Nim/execute-brain----.nim | 32 + .../Phix/execute-brain----.phix | 52 ++ .../Potion/execute-brain-----1.potion | 2 + .../Potion/execute-brain-----2.potion | 20 + .../Sidef/execute-brain----.sidef | 48 ++ .../Swift/execute-brain----.swift | 129 ++++ Task/Execute-HQ9+/Ceylon/execute-hq9+.ceylon | 38 + Task/Execute-HQ9+/Nim/execute-hq9+.nim | 31 + Task/Execute-HQ9+/Phix/execute-hq9+-1.phix | 32 + Task/Execute-HQ9+/Phix/execute-hq9+-2.phix | 13 + Task/Execute-HQ9+/Sidef/execute-hq9+-1.sidef | 31 + Task/Execute-HQ9+/Sidef/execute-hq9+-2.sidef | 2 + Task/Execute-HQ9+/Sidef/execute-hq9+-3.sidef | 5 + .../execute-a-markov-algorithm.echolisp | 33 + .../Swift/execute-a-markov-algorithm.swift | 44 ++ .../ERRE/execute-a-system-command-1.erre | 1 + .../ERRE/execute-a-system-command-2.erre | 2 + .../execute-a-system-command.freebasic | 4 + .../FunL/execute-a-system-command.funl | 3 + .../execute-a-system-command.futurebasic | 14 + .../LFE/execute-a-system-command-1.lfe | 1 + .../LFE/execute-a-system-command-2.lfe | 1 + .../Lasso/execute-a-system-command.lasso | 8 + .../Lingo/execute-a-system-command.lingo | 6 + .../Nim/execute-a-system-command.nim | 4 + .../Oforth/execute-a-system-command.oforth | 1 + .../Phix/execute-a-system-command.phix | 3 + .../Ring/execute-a-system-command.ring | 1 + .../Sidef/execute-a-system-command.sidef | 10 + .../Ursa/execute-a-system-command.ursa | 11 + .../Wart/execute-a-system-command.wart | 1 + .../ERRE/exponentiation-operator.erre | 16 + .../EchoLisp/exponentiation-operator.echolisp | 25 + .../exponentiation-operator.freebasic | 32 + .../Lingo/exponentiation-operator.lingo | 14 + .../Nim/exponentiation-operator.nim | 23 + .../Oforth/exponentiation-operator.oforth | 9 + .../Phix/exponentiation-operator.phix | 13 + .../Ring/exponentiation-operator.ring | 20 + .../Sidef/exponentiation-operator-1.sidef | 20 + .../Sidef/exponentiation-operator-2.sidef | 8 + .../Ursa/exponentiation-operator.ursa | 24 + .../jq/exponentiation-operator-1.jq | 15 + .../jq/exponentiation-operator-2.jq | 13 + .../EchoLisp/extend-your-language.echolisp | 23 + .../FreeBASIC/extend-your-language.freebasic | 32 + .../Lasso/extend-your-language-1.lasso | 23 + .../Lasso/extend-your-language-2.lasso | 14 + .../Morfa/extend-your-language.morfa | 77 ++ .../Nim/extend-your-language.nim | 62 ++ .../PHL/extend-your-language.phl | 53 ++ .../Shen/extend-your-language-1.shen | 5 + .../Shen/extend-your-language-2.shen | 7 + .../Sidef/extend-your-language.sidef | 36 + .../extensible-prime-generator.echolisp | 35 + .../extensible-prime-generator.freebasic | 100 +++ .../Ring/extensible-prime-generator.ring | 38 + .../Sidef/extensible-prime-generator.sidef | 6 + .../jq/extensible-prime-generator-1.jq | 9 + .../jq/extensible-prime-generator-2.jq | 33 + .../jq/extensible-prime-generator-3.jq | 9 + .../jq/extensible-prime-generator-4.jq | 10 + .../extreme-floating-point-values.freebasic | 14 + .../Nim/extreme-floating-point-values.nim | 12 + .../Phix/extreme-floating-point-values.phix | 20 + .../Sidef/extreme-floating-point-values.sidef | 30 + .../Swift/extreme-floating-point-values.swift | 12 + .../jq/extreme-floating-point-values-1.jq | 2 + .../jq/extreme-floating-point-values-2.jq | 2 + .../jq/extreme-floating-point-values-3.jq | 8 + .../jq/extreme-floating-point-values-4.jq | 2 + .../jq/extreme-floating-point-values-5.jq | 2 + Task/Factorial/AntLang/factorial.antlang | 1 + Task/Factorial/Apex/factorial-1.apex | 11 + Task/Factorial/Apex/factorial-2.apex | 7 + Task/Factorial/Axe/factorial-1.axe | 7 + Task/Factorial/Axe/factorial-2.axe | 3 + Task/Factorial/Ceylon/factorial.ceylon | 20 + Task/Factorial/ChucK/factorial-1.chuck | 10 + Task/Factorial/ChucK/factorial-2.chuck | 10 + Task/Factorial/Comal/factorial.comal | 7 + .../factorial-1.computer | 43 ++ .../factorial-2.computer | 15 + Task/Factorial/ERRE/factorial-1.erre | 8 + Task/Factorial/ERRE/factorial-2.erre | 4 + Task/Factorial/EchoLisp/factorial-1.echolisp | 4 + Task/Factorial/EchoLisp/factorial-2.echolisp | 6 + Task/Factorial/EchoLisp/factorial-3.echolisp | 5 + Task/Factorial/EchoLisp/factorial-4.echolisp | 2 + Task/Factorial/EchoLisp/factorial-5.echolisp | 4 + Task/Factorial/Elm/factorial.elm | 3 + Task/Factorial/Ezhil/factorial.ezhil | 9 + Task/Factorial/FreeBASIC/factorial.freebasic | 27 + Task/Factorial/FunL/factorial-1.funl | 10 + Task/Factorial/FunL/factorial-2.funl | 5 + Task/Factorial/FunL/factorial-3.funl | 8 + Task/Factorial/FunL/factorial-4.funl | 3 + Task/Factorial/Futhark/factorial-1.futhark | 3 + Task/Factorial/Futhark/factorial-2.futhark | 4 + .../FutureBasic/factorial.futurebasic | 33 + Task/Factorial/I/factorial.i | 18 + Task/Factorial/JOVIAL/factorial.jovial | 9 + Task/Factorial/Klong/factorial.klong | 2 + Task/Factorial/LFE/factorial-1.lfe | 4 + Task/Factorial/LFE/factorial-2.lfe | 4 + Task/Factorial/LFE/factorial-3.lfe | 4 + Task/Factorial/LFE/factorial-4.lfe | 7 + Task/Factorial/LFE/factorial-5.lfe | 12 + Task/Factorial/LFE/factorial-6.lfe | 16 + Task/Factorial/Lasso/factorial-1.lasso | 8 + Task/Factorial/Lasso/factorial-2.lasso | 1 + Task/Factorial/Lingo/factorial-1.lingo | 4 + Task/Factorial/Lingo/factorial-2.lingo | 7 + Task/Factorial/LiveCode/factorial.livecode | 32 + Task/Factorial/Maude/factorial.maude | 15 + Task/Factorial/MyrtleScript/factorial.myrtle | 7 + Task/Factorial/Nim/factorial-1.nim | 3 + Task/Factorial/Nim/factorial-2.nim | 4 + Task/Factorial/Oforth/factorial-1.oforth | 1 + Task/Factorial/Oforth/factorial-2.oforth | 1 + Task/Factorial/Panda/factorial.panda | 4 + Task/Factorial/Peloton/factorial-1.peloton | 1 + Task/Factorial/Peloton/factorial-2.peloton | 2 + Task/Factorial/Phix/factorial.phix | 8 + Task/Factorial/Rapira/factorial-1.rapira | 7 + Task/Factorial/Rapira/factorial-2.rapira | 13 + Task/Factorial/Ring/factorial.ring | 5 + Task/Factorial/SSEM/factorial.ssem | 22 + .../Factorial/SequenceL/factorial-1.sequencel | 1 + .../Factorial/SequenceL/factorial-2.sequencel | 1 + .../Factorial/SequenceL/factorial-3.sequencel | 5 + .../Factorial/SequenceL/factorial-4.sequencel | 7 + Task/Factorial/Shen/factorial.shen | 3 + Task/Factorial/Sidef/factorial.sidef | 19 + Task/Factorial/Swift/factorial-1.swift | 4 + Task/Factorial/Swift/factorial-2.swift | 4 + Task/Factorial/Ursa/factorial-1.ursa | 9 + Task/Factorial/Ursa/factorial-2.ursa | 8 + Task/Factorial/Wart/factorial-1.wart | 4 + Task/Factorial/Wart/factorial-2.wart | 5 + Task/Factorial/Wart/factorial-3.wart | 4 + Task/Factorial/Wart/factorial-4.wart | 7 + Task/Factorial/Wortel/factorial-1.wortel | 1 + Task/Factorial/Wortel/factorial-2.wortel | 1 + Task/Factorial/Wortel/factorial-3.wortel | 3 + Task/Factorial/Wortel/factorial-4.wortel | 6 + Task/Factorial/Wortel/factorial-5.wortel | 14 + Task/Factorial/jq/factorial-1.jq | 2 + Task/Factorial/jq/factorial-2.jq | 4 + Task/Factorial/jq/factorial-3.jq | 8 + .../factors-of-a-mersenne-number.echolisp | 22 + .../factors-of-a-mersenne-number.freebasic | 45 ++ .../Nim/factors-of-a-mersenne-number.nim | 26 + .../Sidef/factors-of-a-mersenne-number.sidef | 21 + .../Ceylon/factors-of-an-integer.ceylon | 8 + .../ERRE/factors-of-an-integer.erre | 43 ++ .../EchoLisp/factors-of-an-integer-1.echolisp | 18 + .../EchoLisp/factors-of-an-integer-2.echolisp | 10 + .../FreeBASIC/factors-of-an-integer.freebasic | 20 + .../FunL/factors-of-an-integer-1.funl | 1 + .../FunL/factors-of-an-integer-2.funl | 2 + .../factors-of-an-integer.futurebasic | 46 ++ .../LFE/factors-of-an-integer-1.lfe | 4 + .../LFE/factors-of-an-integer-2.lfe | 12 + .../Lingo/factors-of-an-integer-1.lingo | 8 + .../Lingo/factors-of-an-integer-2.lingo | 6 + .../Nim/factors-of-an-integer.nim | 15 + .../Oforth/factors-of-an-integer.oforth | 3 + .../Panda/factors-of-an-integer.panda | 4 + .../Ring/factors-of-an-integer.ring | 11 + .../factors-of-an-integer-1.sequencel | 1 + .../factors-of-an-integer-2.sequencel | 9 + .../Sidef/factors-of-an-integer.sidef | 11 + .../Swift/factors-of-an-integer-1.swift | 4 + .../Swift/factors-of-an-integer-2.swift | 18 + .../Swift/factors-of-an-integer-3.swift | 6 + .../Ursa/factors-of-an-integer.ursa | 10 + .../Wortel/factors-of-an-integer.wortel | 9 + .../jq/factors-of-an-integer.jq | 16 + .../Crystal/fast-fourier-transform.crystal | 8 + .../ERRE/fast-fourier-transform.erre | 99 +++ .../EchoLisp/fast-fourier-transform.echolisp | 17 + .../Idris/fast-fourier-transform.idris | 31 + .../Nim/fast-fourier-transform.nim | 26 + .../fast-fourier-transform.sequencel | 18 + .../Sidef/fast-fourier-transform.sidef | 16 + .../jq/fast-fourier-transform-1.jq | 23 + .../jq/fast-fourier-transform-2.jq | 9 + .../jq/fast-fourier-transform-3.jq | 1 + .../fibonacci-n-step-number-sequences.erre | 43 ++ ...fibonacci-n-step-number-sequences.echolisp | 23 + ...ibonacci-n-step-number-sequences.freebasic | 51 ++ .../fibonacci-n-step-number-sequences.funl | 31 + .../Nim/fibonacci-n-step-number-sequences.nim | 28 + .../fibonacci-n-step-number-sequences.sidef | 13 + .../jq/fibonacci-n-step-number-sequences-1.jq | 15 + .../jq/fibonacci-n-step-number-sequences-2.jq | 6 + .../8th/fibonacci-sequence.8th | 8 + .../AntLang/fibonacci-sequence.antlang | 4 + .../Apex/fibonacci-sequence.apex | 43 ++ .../Axe/fibonacci-sequence.axe | 11 + .../Battlestar/fibonacci-sequence.battlestar | 43 ++ .../fibonacci-sequence.computer | 22 + .../ECL/fibonacci-sequence.ecl | 29 + .../EDSAC-order-code/fibonacci-sequence.edsac | 52 ++ .../ERRE/fibonacci-sequence.erre | 27 + .../EchoLisp/fibonacci-sequence.echolisp | 8 + .../Elm/fibonacci-sequence.elm | 5 + .../FOCAL/fibonacci-sequence.focal | 11 + .../FRISC-Assembly/fibonacci-sequence.frisc | 23 + .../FreeBASIC/fibonacci-sequence.freebasic | 83 +++ .../FunL/fibonacci-sequence-1.funl | 4 + .../FunL/fibonacci-sequence-2.funl | 7 + .../FunL/fibonacci-sequence-3.funl | 6 + .../FunL/fibonacci-sequence-4.funl | 7 + .../FunL/fibonacci-sequence-5.funl | 5 + .../FunL/fibonacci-sequence-6.funl | 19 + .../Futhark/fibonacci-sequence.futhark | 4 + .../fibonacci-sequence.futurebasic | 30 + .../GFA-Basic/fibonacci-sequence.gfa | 37 + .../Harbour/fibonacci-sequence-1.harbour | 3 + .../Harbour/fibonacci-sequence-2.harbour | 9 + .../Hy/fibonacci-sequence.hy | 4 + .../Idris/fibonacci-sequence-1.idris | 5 + .../Idris/fibonacci-sequence-2.idris | 4 + .../Idris/fibonacci-sequence-3.idris | 5 + .../Idris/fibonacci-sequence-4.idris | 5 + .../L++/fibonacci-sequence.lpp | 2 + .../LFE/fibonacci-sequence-1.lfe | 6 + .../LFE/fibonacci-sequence-2.lfe | 9 + .../Lasso/fibonacci-sequence.lasso | 23 + .../Lingo/fibonacci-sequence-1.lingo | 4 + .../Lingo/fibonacci-sequence-2.lingo | 11 + .../Lingo/fibonacci-sequence-3.lingo | 6 + .../LiveCode/fibonacci-sequence.livecode | 20 + .../Luck/fibonacci-sequence.luck | 9 + .../Monicelli/fibonacci-sequence.monicelli | 12 + .../NESL/fibonacci-sequence.nesl | 1 + .../NGS/fibonacci-sequence.ngs | 11 + .../Nim/fibonacci-sequence-1.nim | 5 + .../Nim/fibonacci-sequence-2.nim | 10 + .../Nim/fibonacci-sequence-3.nim | 5 + .../Nim/fibonacci-sequence-4.nim | 7 + .../Nim/fibonacci-sequence-5.nim | 11 + .../Oforth/fibonacci-sequence.oforth | 1 + .../Phix/fibonacci-sequence-1.phix | 18 + .../Phix/fibonacci-sequence-2.phix | 22 + .../Potion/fibonacci-sequence-1.potion | 5 + .../Potion/fibonacci-sequence-2.potion | 11 + .../Potion/fibonacci-sequence-3.potion | 20 + .../Potion/fibonacci-sequence-4.potion | 13 + .../Ra/fibonacci-sequence.ra | 45 ++ .../Ring/fibonacci-sequence.ring | 7 + .../SSEM/fibonacci-sequence.ssem | 26 + .../SequenceL/fibonacci-sequence-1.sequencel | 4 + .../SequenceL/fibonacci-sequence-2.sequencel | 8 + .../SequenceL/fibonacci-sequence-3.sequencel | 11 + .../Shen/fibonacci-sequence.shen | 6 + .../Sidef/fibonacci-sequence-1.sidef | 7 + .../Sidef/fibonacci-sequence-2.sidef | 3 + .../Sidef/fibonacci-sequence-3.sidef | 3 + .../Sidef/fibonacci-sequence-4.sidef | 5 + .../fibonacci-sequence-1.skookum | 1 + .../fibonacci-sequence-2.skookum | 5 + .../fibonacci-sequence-3.skookum | 5 + .../fibonacci-sequence-4.skookum | 19 + .../fibonacci-sequence-5.skookum | 24 + .../Swift/fibonacci-sequence-1.swift | 12 + .../Swift/fibonacci-sequence-2.swift | 11 + .../Swift/fibonacci-sequence-3.swift | 9 + .../Swift/fibonacci-sequence-4.swift | 9 + .../Ursa/fibonacci-sequence.ursa | 12 + .../Wart/fibonacci-sequence-1.wart | 4 + .../Wart/fibonacci-sequence-2.wart | 5 + .../Wart/fibonacci-sequence-3.wart | 6 + .../XLISP/fibonacci-sequence-1.xlisp | 2 + .../XLISP/fibonacci-sequence-2.xlisp | 5 + .../jq/fibonacci-sequence-1.jq | 4 + .../jq/fibonacci-sequence-2.jq | 8 + .../jq/fibonacci-sequence-3.jq | 1 + .../jq/fibonacci-sequence-4.jq | 6 + .../jq/fibonacci-sequence-5.jq | 7 + .../jq/fibonacci-sequence-6.jq | 8 + .../fibonacci-word-fractal.freebasic | 109 +++ .../Sidef/fibonacci-word-fractal.sidef | 62 ++ .../EchoLisp/fibonacci-word.echolisp | 26 + .../FreeBASIC/fibonacci-word.freebasic | 61 ++ .../Oforth/fibonacci-word.oforth | 13 + .../Fibonacci-word/Sidef/fibonacci-word.sidef | 22 + Task/Fibonacci-word/jq/fibonacci-word-1.jq | 10 + Task/Fibonacci-word/jq/fibonacci-word-2.jq | 18 + Task/Fibonacci-word/jq/fibonacci-word-3.jq | 23 + .../FreeBASIC/file-input-output.freebasic | 22 + Task/File-input-output/I/file-input-output.i | 13 + .../Lingo/file-input-output-1.lingo | 34 + .../Lingo/file-input-output-2.lingo | 2 + .../Nim/file-input-output-1.nim | 2 + .../Nim/file-input-output-2.nim | 2 + .../Nim/file-input-output-3.nim | 9 + .../Nim/file-input-output-4.nim | 12 + .../Nim/file-input-output-5.nim | 11 + .../Oforth/file-input-output-1.oforth | 7 + .../Oforth/file-input-output-2.oforth | 1 + .../Phix/file-input-output-1.phix | 6 + .../Phix/file-input-output-2.phix | 10 + .../Phix/file-input-output-3.phix | 10 + .../Ring/file-input-output.ring | 19 + .../Sidef/file-input-output.sidef | 6 + .../Ursa/file-input-output.ursa | 7 + .../Wart/file-input-output.wart | 4 + .../jq/file-input-output-1.jq | 1 + .../jq/file-input-output-2.jq | 1 + .../file-modification-time.freebasic | 20 + .../Lasso/file-modification-time.lasso | 4 + .../Nim/file-modification-time.nim | 16 + .../Oforth/file-modification-time.oforth | 1 + .../Sidef/file-modification-time.sidef | 6 + .../Ursa/file-modification-time.ursa | 8 + Task/File-size/Axe/file-size.axe | 5 + Task/File-size/FreeBASIC/file-size.freebasic | 6 + Task/File-size/Lasso/file-size.lasso | 9 + Task/File-size/Lingo/file-size.lingo | 13 + Task/File-size/LiveCode/file-size.livecode | 20 + Task/File-size/Nim/file-size.nim | 3 + Task/File-size/Oforth/file-size.oforth | 2 + Task/File-size/Phix/file-size.phix | 17 + Task/File-size/Ring/file-size.ring | 2 + Task/File-size/Sidef/file-size.sidef | 2 + Task/File-size/Ursa/file-size.ursa | 9 + Task/File-size/jq/file-size.jq | 3 + Task/Filter/AntLang/filter.antlang | 2 + Task/Filter/Apex/filter.apex | 15 + Task/Filter/EchoLisp/filter.echolisp | 16 + Task/Filter/FreeBASIC/filter.freebasic | 63 ++ Task/Filter/Futhark/filter.futhark | 2 + Task/Filter/Lasso/filter-1.lasso | 3 + Task/Filter/Lasso/filter-2.lasso | 3 + Task/Filter/Nim/filter.nim | 7 + Task/Filter/Oforth/filter.oforth | 1 + Task/Filter/PHL/filter.phl | 11 + Task/Filter/Peloton/filter.peloton | 8 + Task/Filter/Phix/filter-1.phix | 9 + Task/Filter/Phix/filter-2.phix | 26 + Task/Filter/Ring/filter.ring | 12 + Task/Filter/SequenceL/filter.sequencel | 1 + Task/Filter/Sidef/filter.sidef | 9 + Task/Filter/Swift/filter.swift | 3 + Task/Filter/jq/filter-1.jq | 1 + Task/Filter/jq/filter-2.jq | 1 + .../Lasso/find-common-directory-path.lasso | 17 + .../Lingo/find-common-directory-path-1.lingo | 19 + .../Lingo/find-common-directory-path-2.lingo | 7 + .../Nim/find-common-directory-path.nim | 13 + .../Sidef/find-common-directory-path.sidef | 9 + .../jq/find-common-directory-path-1.jq | 14 + .../jq/find-common-directory-path-2.jq | 2 + ...ft-truncatable-prime-in-a-given-base.sidef | 33 + .../Axe/find-limit-of-recursion.axe | 5 + .../Gri/find-limit-of-recursion.gri | 8 + .../I/find-limit-of-recursion.i | 8 + .../Nim/find-limit-of-recursion.nim | 4 + .../Oforth/find-limit-of-recursion.oforth | 3 + .../Phix/find-limit-of-recursion.phix | 17 + .../Ring/find-limit-of-recursion.ring | 5 + .../Sidef/find-limit-of-recursion.sidef | 6 + .../Ursa/find-limit-of-recursion.ursa | 9 + .../jq/find-limit-of-recursion-1.jq | 4 + .../jq/find-limit-of-recursion-2.jq | 4 + .../jq/find-limit-of-recursion-3.jq | 17 + .../jq/find-limit-of-recursion-4.jq | 8 + .../jq/find-limit-of-recursion-5.jq | 14 + ...nd-the-last-sunday-of-each-month.freebasic | 85 +++ .../find-the-last-sunday-of-each-month.lasso | 21 + ...d-the-last-sunday-of-each-month-1.livecode | 23 + ...d-the-last-sunday-of-each-month-2.livecode | 1 + .../find-the-last-sunday-of-each-month.nim | 12 + .../find-the-last-sunday-of-each-month.oforth | 8 + .../find-the-last-sunday-of-each-month.phix | 24 + .../find-the-last-sunday-of-each-month.ring | 18 + .../find-the-last-sunday-of-each-month.sidef | 15 + .../find-the-last-sunday-of-each-month-1.jq | 26 + .../find-the-last-sunday-of-each-month-2.jq | 22 + .../find-the-last-sunday-of-each-month-3.jq | 14 + .../ERRE/find-the-missing-permutation.erre | 33 + .../find-the-missing-permutation.echolisp | 14 + .../Nim/find-the-missing-permutation.nim | 19 + .../Phix/find-the-missing-permutation.phix | 46 ++ .../Ring/find-the-missing-permutation.ring | 13 + .../Sidef/find-the-missing-permutation.sidef | 14 + .../jq/find-the-missing-permutation-1.jq | 22 + .../jq/find-the-missing-permutation-2.jq | 1 + .../jq/find-the-missing-permutation-3.jq | 2 + .../first-class-environments.echolisp | 18 + .../Sidef/first-class-environments.sidef | 25 + ...s-functions-use-numbers-analogously.oforth | 11 + ...s-functions-use-numbers-analogously-1.phix | 22 + ...s-functions-use-numbers-analogously-2.phix | 25 + ...ss-functions-use-numbers-analogously.sidef | 19 + ...class-functions-use-numbers-analogously.jq | 21 + .../Ceylon/first-class-functions-1.ceylon | 3 + .../Ceylon/first-class-functions-2.ceylon | 17 + .../EchoLisp/first-class-functions.echolisp | 15 + .../Lasso/first-class-functions.lasso | 30 + .../Lingo/first-class-functions-1.lingo | 12 + .../Lingo/first-class-functions-2.lingo | 13 + .../Nim/first-class-functions.nim | 27 + .../Oforth/first-class-functions.oforth | 4 + .../Phix/first-class-functions.phix | 25 + .../Sidef/first-class-functions.sidef | 15 + .../Swift/first-class-functions.swift | 7 + .../Ceylon/five-weekends-1.ceylon | 3 + .../Ceylon/five-weekends-2.ceylon | 55 ++ Task/Five-weekends/ERRE/five-weekends.erre | 36 + .../FreeBASIC/five-weekends.freebasic | 61 ++ .../Harbour/five-weekends.harbour | 34 + Task/Five-weekends/Lasso/five-weekends.lasso | 52 ++ Task/Five-weekends/Nim/five-weekends.nim | 18 + .../Five-weekends/Oforth/five-weekends.oforth | 12 + Task/Five-weekends/Phix/five-weekends.phix | 30 + Task/Five-weekends/Ring/five-weekends.ring | 18 + Task/Five-weekends/Sidef/five-weekends.sidef | 34 + Task/Five-weekends/jq/five-weekends-1.jq | 15 + Task/Five-weekends/jq/five-weekends-2.jq | 25 + Task/Five-weekends/jq/five-weekends-3.jq | 7 + Task/Five-weekends/jq/five-weekends-4.jq | 15 + Task/FizzBuzz/8th/fizzbuzz.8th | 25 + Task/FizzBuzz/AntLang/fizzbuzz.antlang | 3 + Task/FizzBuzz/Arc/fizzbuzz-1.arc | 6 + Task/FizzBuzz/Arc/fizzbuzz-2.arc | 4 + Task/FizzBuzz/Arc/fizzbuzz-3.arc | 6 + Task/FizzBuzz/Axe/fizzbuzz.axe | 13 + Task/FizzBuzz/Ceylon/fizzbuzz.ceylon | 1 + Task/FizzBuzz/Coco/fizzbuzz-1.coco | 6 + Task/FizzBuzz/Coco/fizzbuzz-2.coco | 2 + Task/FizzBuzz/Crystal/fizzbuzz.crystal | 11 + Task/FizzBuzz/ECL/fizzbuzz.ecl | 17 + Task/FizzBuzz/ERRE/fizzbuzz.erre | 17 + Task/FizzBuzz/Eero/fizzbuzz.eero | 14 + Task/FizzBuzz/Elm/fizzbuzz-1.elm | 15 + Task/FizzBuzz/Elm/fizzbuzz-2.elm | 18 + Task/FizzBuzz/FOCAL/fizzbuzz.focal | 16 + .../FizzBuzz/FutureBasic/fizzbuzz.futurebasic | 15 + Task/FizzBuzz/GFA-Basic/fizzbuzz.gfa | 13 + Task/FizzBuzz/Hoon/fizzbuzz.hoon | 11 + Task/FizzBuzz/Hy/fizzbuzz.hy | 5 + Task/FizzBuzz/I/fizzbuzz.i | 13 + Task/FizzBuzz/Idris/fizzbuzz.idris | 8 + .../Kamailio-Script/fizzbuzz.kamailio | 20 + Task/FizzBuzz/Klong/fizzbuzz.klong | 11 + Task/FizzBuzz/Lasso/fizzbuzz.lasso | 2 + Task/FizzBuzz/LiveCode/fizzbuzz.livecode | 16 + Task/FizzBuzz/LiveScript/fizzbuzz.live | 1 + Task/FizzBuzz/Lobster/fizzbuzz.lobster | 6 + Task/FizzBuzz/Luck/fizzbuzz.luck | 6 + Task/FizzBuzz/Monte/fizzbuzz.monte | 13 + Task/FizzBuzz/MoonScript/fizzbuzz.moon | 4 + Task/FizzBuzz/NewtonScript/fizzbuzz.newton | 12 + Task/FizzBuzz/Nim/fizzbuzz-1.nim | 9 + Task/FizzBuzz/Nim/fizzbuzz-2.nim | 6 + Task/FizzBuzz/Nim/fizzbuzz-3.nim | 17 + Task/FizzBuzz/Oforth/fizzbuzz.oforth | 8 + Task/FizzBuzz/PHL/fizzbuzz.phl | 22 + Task/FizzBuzz/Peloton/fizzbuzz-1.peloton | 9 + Task/FizzBuzz/Peloton/fizzbuzz-2.peloton | 9 + Task/FizzBuzz/Phix/fizzbuzz.phix | 4 + Task/FizzBuzz/Pony/fizzbuzz.pony | 18 + Task/FizzBuzz/Potion/fizzbuzz.potion | 9 + Task/FizzBuzz/Pyret/fizzbuzz.pyret | 20 + Task/FizzBuzz/Ring/fizzbuzz.ring | 6 + Task/FizzBuzz/SequenceL/fizzbuzz.sequencel | 16 + Task/FizzBuzz/Shen/fizzbuzz.shen | 14 + Task/FizzBuzz/Sidef/fizzbuzz-1.sidef | 9 + Task/FizzBuzz/Sidef/fizzbuzz-2.sidef | 6 + Task/FizzBuzz/Sidef/fizzbuzz-3.sidef | 1 + .../FizzBuzz/SkookumScript/fizzbuzz-1.skookum | 8 + .../FizzBuzz/SkookumScript/fizzbuzz-2.skookum | 7 + .../FizzBuzz/SkookumScript/fizzbuzz-3.skookum | 6 + Task/FizzBuzz/Swift/fizzbuzz.swift | 12 + Task/FizzBuzz/Symsyn/fizzbuzz.symsyn | 22 + Task/FizzBuzz/Ursa/fizzbuzz.ursa | 16 + Task/FizzBuzz/Wart/fizzbuzz.wart | 9 + Task/FizzBuzz/Wortel/fizzbuzz.wortel | 1 + Task/FizzBuzz/XLISP/fizzbuzz.xlisp | 13 + Task/FizzBuzz/XPath-2.0/fizzbuzz-1.xpath | 2 + Task/FizzBuzz/XPath-2.0/fizzbuzz-2.xpath | 2 + Task/FizzBuzz/jq/fizzbuzz-1.jq | 6 + Task/FizzBuzz/jq/fizzbuzz-2.jq | 4 + Task/Flatten-a-list/8th/flatten-a-list.8th | 23 + .../Ceylon/flatten-a-list.ceylon | 13 + .../EchoLisp/flatten-a-list.echolisp | 26 + Task/Flatten-a-list/Elm/flatten-a-list.elm | 27 + Task/Flatten-a-list/LFE/flatten-a-list.lfe | 2 + .../Flatten-a-list/Lasso/flatten-a-list.lasso | 6 + Task/Flatten-a-list/NGS/flatten-a-list.ngs | 9 + Task/Flatten-a-list/Nim/flatten-a-list.nim | 34 + .../Oforth/flatten-a-list.oforth | 1 + Task/Flatten-a-list/Phix/flatten-a-list.phix | 1 + Task/Flatten-a-list/Red/flatten-a-list.red | 6 + Task/Flatten-a-list/Ring/flatten-a-list.ring | 10 + .../Flatten-a-list/Sidef/flatten-a-list.sidef | 11 + .../Swift/flatten-a-list-1.swift | 31 + .../Swift/flatten-a-list-2.swift | 29 + .../Swift/flatten-a-list-3.swift | 47 ++ Task/Flatten-a-list/Wart/flatten-a-list.wart | 7 + Task/Flatten-a-list/jq/flatten-a-list-1.jq | 6 + Task/Flatten-a-list/jq/flatten-a-list-2.jq | 2 + .../Swift/flipping-bits-game.swift | 134 ++++ .../Comal/flow-control-structures-1.comal | 5 + .../Comal/flow-control-structures-2.comal | 5 + .../Comal/flow-control-structures-3.comal | 6 + .../Comal/flow-control-structures-4.comal | 6 + .../Nim/flow-control-structures-1.nim | 5 + .../Nim/flow-control-structures-2.nim | 7 + .../Oforth/flow-control-structures-1.oforth | 1 + .../Oforth/flow-control-structures-2.oforth | 1 + .../Oforth/flow-control-structures-3.oforth | 1 + .../Phix/flow-control-structures-1.phix | 3 + .../Phix/flow-control-structures-2.phix | 6 + .../Phix/flow-control-structures-3.phix | 6 + .../Phix/flow-control-structures-4.phix | 4 + .../Ring/flow-control-structures.ring | 6 + .../SSEM/flow-control-structures-1.ssem | 3 + .../SSEM/flow-control-structures-2.ssem | 3 + .../Floyds-triangle/ERRE/floyds-triangle.erre | 20 + .../FreeBASIC/floyds-triangle.freebasic | 53 ++ .../Lasso/floyds-triangle.lasso | 24 + Task/Floyds-triangle/Nim/floyds-triangle.nim | 24 + .../Floyds-triangle/Ring/floyds-triangle.ring | 9 + .../Sidef/floyds-triangle.sidef | 10 + Task/Floyds-triangle/jq/floyds-triangle-1.jq | 23 + Task/Floyds-triangle/jq/floyds-triangle-2.jq | 1 + Task/Floyds-triangle/jq/floyds-triangle-3.jq | 23 + Task/Forest-fire/Ceylon/forest-fire.ceylon | 135 ++++ Task/Forest-fire/Nim/forest-fire.nim | 56 ++ Task/Forest-fire/Sidef/forest-fire-1.sidef | 61 ++ Task/Forest-fire/Sidef/forest-fire-2.sidef | 72 ++ Task/Fork/LFE/fork.lfe | 5 + Task/Fork/Lasso/fork.lasso | 15 + Task/Fork/Nim/fork.nim | 11 + Task/Fork/Phix/fork-1.phix | 8 + Task/Fork/Phix/fork-2.phix | 1 + Task/Fork/Sidef/fork.sidef | 3 + Task/Fork/Wart/fork.wart | 3 + .../EchoLisp/formal-power-series-1.echolisp | 47 ++ .../EchoLisp/formal-power-series-2.echolisp | 21 + .../jq/formal-power-series-1.jq | 1 + .../jq/formal-power-series-10.jq | 1 + .../jq/formal-power-series-11.jq | 1 + .../jq/formal-power-series-12.jq | 13 + .../jq/formal-power-series-13.jq | 7 + .../jq/formal-power-series-14.jq | 44 ++ .../jq/formal-power-series-15.jq | 11 + .../jq/formal-power-series-16.jq | 9 + .../jq/formal-power-series-17.jq | 9 + .../jq/formal-power-series-2.jq | 1 + .../jq/formal-power-series-3.jq | 3 + .../jq/formal-power-series-4.jq | 1 + .../jq/formal-power-series-5.jq | 1 + .../jq/formal-power-series-6.jq | 1 + .../jq/formal-power-series-7.jq | 3 + .../jq/formal-power-series-8.jq | 1 + .../jq/formal-power-series-9.jq | 4 + .../8th/formatted-numeric-output.8th | 2 + .../ERRE/formatted-numeric-output.erre | 41 ++ .../formatted-numeric-output.freebasic | 7 + .../formatted-numeric-output.futurebasic | 3 + .../Lasso/formatted-numeric-output.lasso | 1 + .../Nim/formatted-numeric-output.nim | 7 + .../Phix/formatted-numeric-output.phix | 1 + .../Ring/formatted-numeric-output.ring | 8 + .../Sidef/formatted-numeric-output-1.sidef | 1 + .../Sidef/formatted-numeric-output-2.sidef | 1 + .../jq/formatted-numeric-output-1.jq | 15 + .../jq/formatted-numeric-output-2.jq | 1 + .../jq/formatted-numeric-output-3.jq | 4 + .../jq/formatted-numeric-output-4.jq | 1 + .../jq/formatted-numeric-output-5.jq | 4 + .../EchoLisp/forward-difference.echolisp | 7 + .../Lasso/forward-difference.lasso | 16 + .../Nim/forward-difference.nim | 13 + .../Oforth/forward-difference.oforth | 2 + .../Sidef/forward-difference.sidef | 15 + .../Visual-FoxPro/forward-difference.visual | 37 + .../jq/forward-difference-1.jq | 8 + .../jq/forward-difference-2.jq | 3 + .../jq/forward-difference-3.jq | 13 + Task/Four-bit-adder/Nim/four-bit-adder.nim | 29 + .../Four-bit-adder/Sidef/four-bit-adder.sidef | 31 + Task/Four-bit-adder/jq/four-bit-adder-1.jq | 42 ++ Task/Four-bit-adder/jq/four-bit-adder-2.jq | 1 + Task/Fractal-tree/Lingo/fractal-tree-1.lingo | 27 + Task/Fractal-tree/Lingo/fractal-tree-2.lingo | 5 + Task/Fractal-tree/Phix/fractal-tree.phix | 57 ++ Task/Fractal-tree/Ring/fractal-tree.ring | 50 ++ Task/Fractal-tree/Sidef/fractal-tree.sidef | 23 + Task/Fractal-tree/Swift/fractal-tree.swift | 57 ++ .../Fractal-tree/TypeScript/fractal-tree.type | 35 + Task/Fractal-tree/jq/fractal-tree.jq | 38 + Task/Fractran/FreeBASIC/fractran.freebasic | 90 +++ Task/Fractran/Sidef/fractran.sidef | 28 + .../AntLang/function-composition.antlang | 4 + .../EchoLisp/function-composition-1.echolisp | 16 + .../EchoLisp/function-composition-2.echolisp | 3 + .../FunL/function-composition.funl | 7 + .../LFE/function-composition-1.lfe | 16 + .../LFE/function-composition-2.lfe | 13 + .../Lingo/function-composition-1.lingo | 10 + .../Lingo/function-composition-2.lingo | 34 + .../Lingo/function-composition-3.lingo | 16 + .../Lingo/function-composition-4.lingo | 14 + .../Nim/function-composition.nim | 9 + .../Oforth/function-composition-1.oforth | 1 + .../Oforth/function-composition-2.oforth | 1 + .../Oforth/function-composition-3.oforth | 2 + .../Phix/function-composition.phix | 25 + .../Sidef/function-composition.sidef | 5 + .../Swift/function-composition.swift | 6 + .../Wortel/function-composition-1.wortel | 1 + .../Wortel/function-composition-2.wortel | 1 + .../Wortel/function-composition-3.wortel | 1 + .../jq/function-composition.jq | 2 + .../8051-Assembly/function-definition.8051 | 12 + .../AntLang/function-definition-1.antlang | 2 + .../AntLang/function-definition-2.antlang | 1 + .../Axe/function-definition.axe | 3 + .../ChucK/function-definition.chuck | 6 + .../Coco/function-definition-1.coco | 1 + .../Coco/function-definition-2.coco | 1 + .../EchoLisp/function-definition.echolisp | 25 + .../FreeBASIC/function-definition-1.freebasic | 5 + .../FreeBASIC/function-definition-2.freebasic | 1 + .../Futhark/function-definition.futhark | 1 + .../function-definition.futurebasic | 6 + .../LFE/function-definition.lfe | 2 + .../Lasso/function-definition-1.lasso | 3 + .../Lasso/function-definition-2.lasso | 1 + .../Lasso/function-definition-3.lasso | 6 + .../Lily/function-definition.lily | 4 + .../Lingo/function-definition.lingo | 3 + .../LiveCode/function-definition.livecode | 5 + .../NESL/function-definition.nesl | 1 + .../Nim/function-definition-1.nim | 2 + .../Nim/function-definition-2.nim | 2 + .../Nim/function-definition-3.nim | 1 + .../Oforth/function-definition-1.oforth | 1 + .../Oforth/function-definition-2.oforth | 1 + .../PHL/function-definition.phl | 3 + .../Phix/function-definition.phix | 3 + .../Picat/function-definition.picat | 1 + .../Ring/function-definition.ring | 1 + .../SSEM/function-definition-1.ssem | 5 + .../SSEM/function-definition-2.ssem | 26 + .../Sidef/function-definition.sidef | 3 + .../Swift/function-definition.swift | 3 + .../Ursa/function-definition.ursa | 4 + .../Wart/function-definition-1.wart | 2 + .../Wart/function-definition-2.wart | 2 + .../Wart/function-definition-3.wart | 2 + .../Wart/function-definition-4.wart | 2 + .../Wart/function-definition-5.wart | 2 + .../XLISP/function-definition-1.xlisp | 2 + .../XLISP/function-definition-2.xlisp | 2 + .../XLISP/function-definition-3.xlisp | 2 + .../jq/function-definition-1.jq | 1 + .../jq/function-definition-2.jq | 2 + .../jq/function-definition-3.jq | 1 + .../jq/function-definition-4.jq | 1 + .../LiveCode/function-frequency-1.livecode | 29 + .../LiveCode/function-frequency-2.livecode | 1 + .../LiveCode/function-frequency-3.livecode | 10 + .../Sidef/function-frequency.sidef | 19 + .../FreeBASIC/function-prototype.freebasic | 37 + .../Luck/function-prototype.luck | 8 + .../Nim/function-prototype.nim | 17 + .../Oforth/function-prototype.oforth | 1 + .../gui-maximum-window-dimensions-1.freebasic | 19 + .../gui-maximum-window-dimensions-2.freebasic | 2 + .../gui-maximum-window-dimensions-3.freebasic | 7 + .../gui-maximum-window-dimensions-4.freebasic | 3 + .../Lingo/gui-maximum-window-dimensions.lingo | 2 + .../Nim/gui-maximum-window-dimensions-1.nim | 7 + .../Nim/gui-maximum-window-dimensions-2.nim | 22 + .../Ring/gui-maximum-window-dimensions.ring | 11 + .../Sidef/gui-maximum-window-dimensions.sidef | 8 + .../gui-component-interaction.freebasic | 41 ++ .../Nim/gui-component-interaction-1.nim | 71 ++ .../Nim/gui-component-interaction-2.nim | 63 ++ .../Phix/gui-component-interaction.phix | 37 + .../Ring/gui-component-interaction.ring | 31 + ...-enabling-disabling-of-controls-1.livecode | 18 + ...-enabling-disabling-of-controls-2.livecode | 5 + ...-enabling-disabling-of-controls-3.livecode | 5 + ...-enabling-disabling-of-controls-4.livecode | 9 + .../gui-enabling-disabling-of-controls-1.nim | 68 ++ .../gui-enabling-disabling-of-controls-2.nim | 93 +++ .../gui-enabling-disabling-of-controls.phix | 39 ++ .../gui-enabling-disabling-of-controls.ring | 35 + .../Elm/galton-box-animation.elm | 210 ++++++ .../FreeBASIC/gamma-function.freebasic | 47 ++ Task/Gamma-function/Nim/gamma-function.nim | 21 + .../Oforth/gamma-function.oforth | 17 + Task/Gamma-function/Ring/gamma-function.ring | 18 + .../Sidef/gamma-function-1.sidef | 19 + .../Sidef/gamma-function-2.sidef | 38 + .../Sidef/gamma-function-3.sidef | 11 + .../Visual-FoxPro/gamma-function.visual | 60 ++ Task/Gamma-function/jq/gamma-function-1.jq | 16 + Task/Gamma-function/jq/gamma-function-2.jq | 16 + Task/Gamma-function/jq/gamma-function-3.jq | 5 + Task/Gamma-function/jq/gamma-function-4.jq | 6 + Task/Gamma-function/jq/gamma-function-5.jq | 12 + .../Sidef/gaussian-elimination.sidef | 11 + ...nerate-chess960-starting-position.echolisp | 15 + .../generate-lower-case-ascii-alphabet.8th | 2 + ...enerate-lower-case-ascii-alphabet.echolisp | 14 + ...nerate-lower-case-ascii-alphabet.freebasic | 14 + .../generate-lower-case-ascii-alphabet.lc3 | 15 + .../generate-lower-case-ascii-alphabet.lingo | 6 + .../generate-lower-case-ascii-alphabet.nesl | 1 + .../generate-lower-case-ascii-alphabet.nim | 20 + ...enerate-lower-case-ascii-alphabet-1.oforth | 1 + ...enerate-lower-case-ascii-alphabet-2.oforth | 1 + .../generate-lower-case-ascii-alphabet-1.phix | 5 + .../generate-lower-case-ascii-alphabet-2.phix | 1 + .../generate-lower-case-ascii-alphabet.ring | 3 + .../generate-lower-case-ascii-alphabet.sidef | 2 + .../generate-lower-case-ascii-alphabet.swift | 6 + .../generate-lower-case-ascii-alphabet.ursa | 6 + .../generate-lower-case-ascii-alphabet.xlisp | 6 + .../jq/generate-lower-case-ascii-alphabet.jq | 1 + .../EchoLisp/generator-exponential.echolisp | 36 + .../FunL/generator-exponential.funl | 8 + .../Nim/generator-exponential.nim | 40 ++ .../Sidef/generator-exponential.sidef | 28 + .../Swift/generator-exponential.swift | 47 ++ .../jq/generator-exponential-1.jq | 5 + .../jq/generator-exponential-2.jq | 7 + .../jq/generator-exponential-3.jq | 5 + .../jq/generator-exponential-4.jq | 27 + .../jq/generator-exponential-5.jq | 11 + Task/Generic-swap/8th/generic-swap-1.8th | 1 + Task/Generic-swap/8th/generic-swap-2.8th | 1 + Task/Generic-swap/Arc/generic-swap.arc | 10 + Task/Generic-swap/Axe/generic-swap.axe | 1 + .../EchoLisp/generic-swap.echolisp | 20 + .../FreeBASIC/generic-swap.freebasic | 26 + .../FutureBasic/generic-swap.futurebasic | 22 + Task/Generic-swap/Gri/generic-swap-1.gri | 15 + Task/Generic-swap/Gri/generic-swap-2.gri | 15 + Task/Generic-swap/Lasso/generic-swap-1.lasso | 8 + Task/Generic-swap/Lasso/generic-swap-2.lasso | 5 + Task/Generic-swap/Lingo/generic-swap-1.lingo | 3 + Task/Generic-swap/Lingo/generic-swap-2.lingo | 5 + .../LiveCode/generic-swap.livecode | 10 + Task/Generic-swap/Nim/generic-swap.nim | 1 + Task/Generic-swap/Oforth/generic-swap.oforth | 1 + Task/Generic-swap/Phix/generic-swap.phix | 1 + Task/Generic-swap/Ring/generic-swap.ring | 7 + Task/Generic-swap/Sidef/generic-swap-1.sidef | 5 + Task/Generic-swap/Sidef/generic-swap-2.sidef | 3 + Task/Generic-swap/Sidef/generic-swap-3.sidef | 3 + Task/Generic-swap/Sidef/generic-swap-4.sidef | 2 + Task/Generic-swap/Swift/generic-swap.swift | 3 + .../Visual-FoxPro/generic-swap.visual | 15 + Task/Generic-swap/Wart/generic-swap-1.wart | 1 + Task/Generic-swap/Wart/generic-swap-2.wart | 2 + Task/Generic-swap/jq/generic-swap-1.jq | 1 + Task/Generic-swap/jq/generic-swap-2.jq | 1 + Task/Generic-swap/jq/generic-swap-3.jq | 1 + ...obally-replace-text-in-several-files.lasso | 14 + ...globally-replace-text-in-several-files.nim | 7 + ...lobally-replace-text-in-several-files.ring | 20 + ...obally-replace-text-in-several-files.sidef | 11 + Task/Gray-code/Nim/gray-code-1.nim | 9 + Task/Gray-code/Nim/gray-code-2.nim | 4 + Task/Gray-code/Phix/gray-code.phix | 21 + Task/Gray-code/Sidef/gray-code.sidef | 14 + .../Lingo/grayscale-image.lingo | 19 + .../Grayscale-image/Phix/grayscale-image.phix | 15 + .../Sidef/grayscale-image.sidef | 19 + .../8th/greatest-common-divisor.8th | 14 + .../AntLang/greatest-common-divisor-1.antlang | 1 + .../AntLang/greatest-common-divisor-2.antlang | 2 + .../AntLang/greatest-common-divisor-3.antlang | 12 + .../AntLang/greatest-common-divisor-4.antlang | 8 + .../Axe/greatest-common-divisor.axe | 8 + .../ERRE/greatest-common-divisor.erre | 21 + .../Ezhil/greatest-common-divisor.ezhil | 60 ++ .../greatest-common-divisor.freebasic | 30 + .../FunL/greatest-common-divisor-1.funl | 8 + .../FunL/greatest-common-divisor-2.funl | 9 + .../FunL/greatest-common-divisor-3.funl | 19 + .../GFA-Basic/greatest-common-divisor.gfa | 20 + .../LFE/greatest-common-divisor.lfe | 4 + .../LiveCode/greatest-common-divisor.livecode | 8 + .../Luck/greatest-common-divisor.luck | 6 + .../MINIL/greatest-common-divisor.minil | 14 + .../Nim/greatest-common-divisor-1.nim | 5 + .../Nim/greatest-common-divisor-2.nim | 9 + .../Nim/greatest-common-divisor-3.nim | 35 + .../Oforth/greatest-common-divisor-1.oforth | 1 + .../Oforth/greatest-common-divisor-2.oforth | 1 + .../Phix/greatest-common-divisor.phix | 20 + .../Ring/greatest-common-divisor.ring | 8 + .../greatest-common-divisor.sequencel | 4 + .../Sidef/greatest-common-divisor-1.sidef | 2 + .../Sidef/greatest-common-divisor-2.sidef | 3 + .../greatest-common-divisor.sparkling | 33 + .../Swift/greatest-common-divisor.swift | 36 + .../TypeScript/greatest-common-divisor-1.type | 17 + .../TypeScript/greatest-common-divisor-2.type | 3 + .../Ursa/greatest-common-divisor.ursa | 2 + .../Wortel/greatest-common-divisor-1.wortel | 1 + .../Wortel/greatest-common-divisor-2.wortel | 1 + .../Wortel/greatest-common-divisor-3.wortel | 1 + .../Wortel/greatest-common-divisor-4.wortel | 1 + .../jq/greatest-common-divisor-1.jq | 4 + .../jq/greatest-common-divisor-2.jq | 7 + .../8th/greatest-element-of-a-list.8th | 1 + .../greatest-element-of-a-list.antlang | 1 + .../Axe/greatest-element-of-a-list.axe | 7 + .../ECL/greatest-element-of-a-list.ecl | 6 + .../ERRE/greatest-element-of-a-list.erre | 24 + .../greatest-element-of-a-list.echolisp | 6 + .../greatest-element-of-a-list.freebasic | 24 + .../FunL/greatest-element-of-a-list-1.funl | 1 + .../FunL/greatest-element-of-a-list-2.funl | 12 + .../Hoon/greatest-element-of-a-list.hoon | 4 + .../Klong/greatest-element-of-a-list.klong | 4 + .../LFE/greatest-element-of-a-list.lfe | 2 + .../Lasso/greatest-element-of-a-list.lasso | 6 + .../Lingo/greatest-element-of-a-list.lingo | 3 + .../greatest-element-of-a-list-1.livecode | 1 + .../greatest-element-of-a-list-2.livecode | 13 + .../Nim/greatest-element-of-a-list.nim | 1 + .../Oforth/greatest-element-of-a-list.oforth | 1 + .../Phix/greatest-element-of-a-list.phix | 2 + .../Ring/greatest-element-of-a-list.ring | 2 + .../Sidef/greatest-element-of-a-list.sidef | 1 + .../Swift/greatest-element-of-a-list-1.swift | 3 + .../Swift/greatest-element-of-a-list-2.swift | 2 + .../Ursa/greatest-element-of-a-list.ursa | 12 + .../Wart/greatest-element-of-a-list.wart | 9 + .../Wortel/greatest-element-of-a-list.wortel | 1 + .../jq/greatest-element-of-a-list-1.jq | 3 + .../jq/greatest-element-of-a-list-2.jq | 1 + .../ERRE/greatest-subsequential-sum.erre | 67 ++ .../greatest-subsequential-sum.echolisp | 35 + .../greatest-subsequential-sum.freebasic | 36 + .../Nim/greatest-subsequential-sum.nim | 7 + .../Phix/greatest-subsequential-sum.phix | 16 + .../Potion/greatest-subsequential-sum.potion | 30 + .../Sidef/greatest-subsequential-sum.sidef | 19 + .../jq/greatest-subsequential-sum-1.jq | 11 + .../jq/greatest-subsequential-sum-2.jq | 1 + .../jq/greatest-subsequential-sum-3.jq | 2 + ...s-the-number-with-feedback--player-.ceylon | 39 ++ ...he-number-with-feedback--player-.freebasic | 32 + ...ss-the-number-with-feedback--player-.lasso | 50 ++ ...uess-the-number-with-feedback--player-.nim | 29 + ...ess-the-number-with-feedback--player-.phix | 22 + ...ess-the-number-with-feedback--player-.ring | 17 + ...ss-the-number-with-feedback--player-.sidef | 42 ++ ...ss-the-number-with-feedback--player-.swift | 48 ++ .../guess-the-number-with-feedback.ceylon | 37 + .../guess-the-number-with-feedback.echolisp | 17 + .../guess-the-number-with-feedback.freebasic | 22 + .../LFE/guess-the-number-with-feedback-1.lfe | 21 + .../LFE/guess-the-number-with-feedback-2.lfe | 14 + .../guess-the-number-with-feedback.lasso | 33 + .../guess-the-number-with-feedback-1.livecode | 29 + .../guess-the-number-with-feedback-2.livecode | 4 + .../Nim/guess-the-number-with-feedback.nim | 22 + .../guess-the-number-with-feedback.oforth | 11 + .../Phix/guess-the-number-with-feedback.phix | 9 + .../Ring/guess-the-number-with-feedback.ring | 31 + .../guess-the-number-with-feedback.sidef | 10 + .../guess-the-number-with-feedback.sparkling | 27 + .../guess-the-number-with-feedback.swift | 23 + .../Ursa/guess-the-number-with-feedback.ursa | 30 + .../guess-the-number-with-feedback.xlisp | 26 + .../ERRE/guess-the-number.erre | 29 + .../FreeBASIC/guess-the-number.freebasic | 14 + .../LFE/guess-the-number-1.lfe | 19 + .../LFE/guess-the-number-2.lfe | 8 + .../Lasso/guess-the-number-1.lasso | 28 + .../Lasso/guess-the-number-2.lasso | 41 ++ .../LiveCode/guess-the-number.livecode | 15 + .../Guess-the-number/Nim/guess-the-number.nim | 13 + .../Oforth/guess-the-number.oforth | 5 + .../Phix/guess-the-number.phix | 7 + .../Guess-the-number/RPL/guess-the-number.rpl | 31 + .../Ring/guess-the-number.ring | 17 + .../Sidef/guess-the-number.sidef | 6 + .../Swift/guess-the-number.swift | 17 + .../Ursa/guess-the-number.ursa | 12 + .../Wortel/guess-the-number.wortel | 9 + .../XLISP/guess-the-number.xlisp | 14 + Task/HTTP/8th/http.8th | 1 + Task/HTTP/EchoLisp/http.echolisp | 4 + Task/HTTP/LFE/http-1.lfe | 6 + Task/HTTP/LFE/http-2.lfe | 13 + Task/HTTP/Lasso/http.lasso | 10 + Task/HTTP/Lingo/http-1.lingo | 30 + Task/HTTP/Lingo/http-2.lingo | 17 + Task/HTTP/Lingo/http-3.lingo | 3 + Task/HTTP/LiveCode/http-1.livecode | 3 + Task/HTTP/LiveCode/http-2.livecode | 7 + Task/HTTP/Nim/http.nim | 3 + Task/HTTP/Peloton/http-1.peloton | 1 + Task/HTTP/Peloton/http-2.peloton | 1 + Task/HTTP/Ring/http.ring | 1 + Task/HTTP/Sidef/http.sidef | 13 + Task/HTTP/Swift/http.swift | 15 + .../Lasso/https-authenticated.lasso | 5 + .../LiveCode/https-authenticated-1.livecode | 6 + .../LiveCode/https-authenticated-2.livecode | 7 + .../Sidef/https-authenticated.sidef | 14 + .../Lasso/https-client-authenticated.lasso | 5 + Task/HTTPS/EchoLisp/https.echolisp | 4 + Task/HTTPS/Lasso/https.lasso | 3 + Task/HTTPS/Lingo/https-1.lingo | 10 + Task/HTTPS/Lingo/https-2.lingo | 2 + Task/HTTPS/LiveCode/https-1.livecode | 2 + Task/HTTPS/LiveCode/https-2.livecode | 10 + Task/HTTPS/Nim/https.nim | 3 + Task/HTTPS/Ring/https.ring | 2 + Task/HTTPS/Sidef/https.sidef | 11 + Task/HTTPS/Swift/https.swift | 15 + .../Ceylon/hailstone-sequence.ceylon | 23 + .../ERRE/hailstone-sequence.erre | 30 + .../EchoLisp/hailstone-sequence-1.echolisp | 28 + .../EchoLisp/hailstone-sequence-2.echolisp | 32 + .../Ezhil/hailstone-sequence.ezhil | 20 + .../FunL/hailstone-sequence.funl | 11 + .../Futhark/hailstone-sequence.futhark | 32 + .../Lasso/hailstone-sequence.lasso | 32 + .../Lingo/hailstone-sequence-1.lingo | 14 + .../Lingo/hailstone-sequence-2.lingo | 16 + .../Nim/hailstone-sequence.nim | 19 + .../Oforth/hailstone-sequence.oforth | 8 + .../Phix/hailstone-sequence.phix | 43 ++ .../Ring/hailstone-sequence.ring | 20 + .../Sidef/hailstone-sequence.sidef | 24 + .../Swift/hailstone-sequence.swift | 34 + .../Ursa/hailstone-sequence.ursa | 15 + .../jq/hailstone-sequence-1.jq | 16 + .../jq/hailstone-sequence-2.jq | 7 + .../jq/hailstone-sequence-3.jq | 6 + .../Hamming-numbers/ERRE/hamming-numbers.erre | 30 + .../FreeBASIC/hamming-numbers.freebasic | 45 ++ .../FunL/hamming-numbers-1.funl | 25 + .../FunL/hamming-numbers-2.funl | 11 + .../Hamming-numbers/Nim/hamming-numbers-1.nim | 30 + .../Hamming-numbers/Nim/hamming-numbers-2.nim | 39 ++ .../Hamming-numbers/Nim/hamming-numbers-3.nim | 64 ++ .../Hamming-numbers/Nim/hamming-numbers-4.nim | 39 ++ .../Hamming-numbers/Nim/hamming-numbers-5.nim | 94 +++ .../Hamming-numbers/Nim/hamming-numbers-6.nim | 72 ++ .../Hamming-numbers/Ring/hamming-numbers.ring | 20 + .../Sidef/hamming-numbers.sidef | 21 + Task/Hamming-numbers/jq/hamming-numbers-1.jq | 46 ++ Task/Hamming-numbers/jq/hamming-numbers-2.jq | 11 + Task/Hamming-numbers/jq/hamming-numbers-3.jq | 61 ++ Task/Hamming-numbers/jq/hamming-numbers-4.jq | 11 + .../Handle-a-signal/Nim/handle-a-signal-1.nim | 13 + .../Handle-a-signal/Nim/handle-a-signal-2.nim | 17 + .../Sidef/handle-a-signal.sidef | 11 + .../Swift/handle-a-signal.swift | 16 + .../Visual-FoxPro/handle-a-signal.visual | 23 + .../FreeBASIC/happy-numbers.freebasic | 44 ++ .../Harbour/happy-numbers.harbour | 33 + .../Happy-numbers/Lasso/happy-numbers-1.lasso | 15 + .../Happy-numbers/Lasso/happy-numbers-2.lasso | 1 + Task/Happy-numbers/Nim/happy-numbers.nim | 20 + .../Happy-numbers/Oforth/happy-numbers.oforth | 16 + Task/Happy-numbers/Phix/happy-numbers.phix | 27 + .../Happy-numbers/Potion/happy-numbers.potion | 20 + Task/Happy-numbers/Ring/happy-numbers.ring | 24 + .../SequenceL/happy-numbers.sequencel | 27 + Task/Happy-numbers/Sidef/happy-numbers.sidef | 15 + Task/Happy-numbers/Swift/happy-numbers.swift | 25 + Task/Happy-numbers/jq/happy-numbers-1.jq | 15 + Task/Happy-numbers/jq/happy-numbers-2.jq | 12 + Task/Happy-numbers/jq/happy-numbers-3.jq | 9 + .../EchoLisp/harshad-or-niven-series.echolisp | 14 + .../harshad-or-niven-series.freebasic | 44 ++ .../MLite/harshad-or-niven-series.mlite | 27 + .../Nim/harshad-or-niven-series.nim | 27 + .../Oforth/harshad-or-niven-series.oforth | 4 + .../Ring/harshad-or-niven-series.ring | 17 + .../Sidef/harshad-or-niven-series.sidef | 17 + .../harshad-or-niven-series.visual | 29 + .../jq/harshad-or-niven-series.jq | 27 + .../Ceylon/hash-from-two-arrays.ceylon | 5 + .../Coco/hash-from-two-arrays.coco | 5 + .../EchoLisp/hash-from-two-arrays.echolisp | 10 + .../Harbour/hash-from-two-arrays.harbour | 7 + .../LFE/hash-from-two-arrays.lfe | 6 + .../Lasso/hash-from-two-arrays.lasso | 11 + .../Lingo/hash-from-two-arrays.lingo | 11 + .../LiveCode/hash-from-two-arrays.livecode | 12 + .../Nim/hash-from-two-arrays.nim | 6 + .../Sidef/hash-from-two-arrays.sidef | 6 + .../Sparkling/hash-from-two-arrays.sparkling | 6 + .../Swift/hash-from-two-arrays.swift | 6 + .../Wortel/hash-from-two-arrays-1.wortel | 1 + .../Wortel/hash-from-two-arrays-2.wortel | 1 + .../Wortel/hash-from-two-arrays-3.wortel | 4 + .../jq/hash-from-two-arrays-1.jq | 12 + .../jq/hash-from-two-arrays-2.jq | 6 + .../jq/hash-from-two-arrays-3.jq | 5 + Task/Hash-join/ECL/hash-join.ecl | 33 + Task/Hash-join/EchoLisp/hash-join-1.echolisp | 27 + Task/Hash-join/EchoLisp/hash-join-2.echolisp | 7 + Task/Hash-join/LFE/hash-join-1.lfe | 23 + Task/Hash-join/LFE/hash-join-2.lfe | 11 + Task/Hash-join/LFE/hash-join-3.lfe | 8 + Task/Hash-join/Ring/hash-join.ring | 42 ++ Task/Hash-join/Sidef/hash-join.sidef | 30 + Task/Hash-join/Visual-FoxPro/hash-join.visual | 54 ++ Task/Hash-join/jq/hash-join-1.jq | 35 + Task/Hash-join/jq/hash-join-2.jq | 39 ++ Task/Hash-join/jq/hash-join-3.jq | 13 + Task/Hash-join/jq/hash-join-4.jq | 27 + Task/Hash-join/jq/hash-join-5.jq | 1 + Task/Hash-join/jq/hash-join-6.jq | 7 + .../ERRE/haversine-formula.erre | 31 + .../FreeBASIC/haversine-formula.freebasic | 36 + .../FunL/haversine-formula.funl | 12 + .../FutureBasic/haversine-formula.futurebasic | 23 + .../Idris/haversine-formula.idris | 40 ++ .../LiveCode/haversine-formula-1.livecode | 27 + .../LiveCode/haversine-formula-2.livecode | 2 + .../Nim/haversine-formula.nim | 18 + .../Oforth/haversine-formula.oforth | 12 + .../Ring/haversine-formula.ring | 15 + .../Sidef/haversine-formula.sidef | 29 + .../Swift/haversine-formula.swift | 18 + .../Haversine-formula/jq/haversine-formula.jq | 9 + .../Axe/hello-world-graphical.axe | 3 + .../BML/hello-world-graphical.bml | 1 + .../EchoLisp/hello-world-graphical.echolisp | 1 + .../FreeBASIC/hello-world-graphical.freebasic | 16 + .../FunL/hello-world-graphical.funl | 17 + .../HPPPL/hello-world-graphical-1.hpppl | 1 + .../HPPPL/hello-world-graphical-2.hpppl | 3 + .../Harbour/hello-world-graphical.harbour | 2 + .../I/hello-world-graphical-1.i | 3 + .../I/hello-world-graphical-2.i | 6 + .../I/hello-world-graphical-3.i | 21 + .../Lasso/hello-world-graphical.lasso | 1 + .../Lingo/hello-world-graphical-1.lingo | 1 + .../Lingo/hello-world-graphical-2.lingo | 15 + .../LiveCode/hello-world-graphical-1.livecode | 1 + .../LiveCode/hello-world-graphical-2.livecode | 1 + .../Lobster/hello-world-graphical.lobster | 7 + .../Nim/hello-world-graphical-1.nim | 4 + .../Nim/hello-world-graphical-2.nim | 5 + .../Phix/hello-world-graphical.phix | 4 + .../Ring/hello-world-graphical.ring | 8 + .../SSEM/hello-world-graphical.ssem | 18 + .../Sidef/hello-world-graphical-1.sidef | 7 + .../Sidef/hello-world-graphical-2.sidef | 12 + .../Swift/hello-world-graphical.swift | 5 + .../hello-world-graphical.visual | 5 + .../jq/hello-world-graphical-1.jq | 35 + .../jq/hello-world-graphical-2.jq | 7 + .../ERRE/hello-world-line-printer.erre | 7 + .../hello-world-line-printer.echolisp | 3 + .../hello-world-line-printer.freebasic | 5 + .../Harbour/hello-world-line-printer.harbour | 5 + .../Lasso/hello-world-line-printer.lasso | 1 + .../Nim/hello-world-line-printer.nim | 3 + .../Oforth/hello-world-line-printer.oforth | 1 + .../Phix/hello-world-line-printer.phix | 9 + .../Ring/hello-world-line-printer.ring | 1 + .../Sidef/hello-world-line-printer.sidef | 3 + .../Swift/hello-world-line-printer.swift | 7 + .../Axe/hello-world-newbie.axe | 3 + .../EchoLisp/hello-world-newbie-1.echolisp | 7 + .../EchoLisp/hello-world-newbie-2.echolisp | 21 + .../hello-world-newbie.futurebasic | 3 + .../Monte/hello-world-newbie.monte | 3 + .../Oforth/hello-world-newbie-1.oforth | 1 + .../Oforth/hello-world-newbie-2.oforth | 1 + .../Oforth/hello-world-newbie-3.oforth | 1 + .../Pare/hello-world-newbie-1.pare | 1 + .../Pare/hello-world-newbie-2.pare | 1 + .../Ra/hello-world-newbie.ra | 6 + .../Ring/hello-world-newbie.ring | 4 + .../Robotic/hello-world-newbie.robotic | 2 + .../hello-world-newbie.ti-83 | 7 + .../jq/hello-world-newbie-1.jq | 3 + .../jq/hello-world-newbie-2.jq | 1 + .../jq/hello-world-newbie-3.jq | 5 + .../jq/hello-world-newbie-4.jq | 3 + .../jq/hello-world-newbie-5.jq | 1 + .../jq/hello-world-newbie-6.jq | 7 + .../Axe/hello-world-newline-omission.axe | 1 + .../ERRE/hello-world-newline-omission.erre | 3 + .../hello-world-newline-omission.echolisp | 3 + .../FOCAL/hello-world-newline-omission.focal | 1 + .../hello-world-newline-omission.freebasic | 4 + .../hello-world-newline-omission.harbour | 3 + .../Jack/hello-world-newline-omission.jack | 6 + .../LFE/hello-world-newline-omission.lfe | 1 + .../Lasso/hello-world-newline-omission.lasso | 1 + .../Nim/hello-world-newline-omission.nim | 1 + .../hello-world-newline-omission.oforth | 1 + .../PHL/hello-world-newline-omission.phl | 7 + .../Phix/hello-world-newline-omission.phix | 1 + .../Pict/hello-world-newline-omission.pict | 1 + .../Ra/hello-world-newline-omission.ra | 6 + .../Red/hello-world-newline-omission.red | 1 + .../Ring/hello-world-newline-omission.ring | 1 + .../hello-world-newline-omission-1.sidef | 1 + .../hello-world-newline-omission-2.sidef | 1 + .../hello-world-newline-omission-1.swift | 1 + .../hello-world-newline-omission-2.swift | 1 + .../Ursa/hello-world-newline-omission.ursa | 1 + .../Wren/hello-world-newline-omission.wren | 1 + .../hello-world-newline-omission-1.xlisp | 1 + .../hello-world-newline-omission-2.xlisp | 1 + .../jq/hello-world-newline-omission-1.jq | 2 + .../jq/hello-world-newline-omission-2.jq | 2 + .../hello-world-standard-error.freebasic | 6 + .../Lasso/hello-world-standard-error.lasso | 5 + .../Lingo/hello-world-standard-error-1.lingo | 5 + .../Lingo/hello-world-standard-error-2.lingo | 7 + .../Nim/hello-world-standard-error.nim | 1 + .../Oforth/hello-world-standard-error.oforth | 1 + .../Phix/hello-world-standard-error.phix | 1 + .../Ra/hello-world-standard-error.ra | 6 + .../Ring/hello-world-standard-error.ring | 1 + .../Sidef/hello-world-standard-error.sidef | 1 + .../Swift/hello-world-standard-error.swift | 11 + .../Ursa/hello-world-standard-error.ursa | 1 + .../XLISP/hello-world-standard-error.xlisp | 1 + .../jq/hello-world-standard-error.jq | 1 + .../Hello-world-Text/8th/hello-world-text.8th | 1 + .../AntLang/hello-world-text.antlang | 1 + .../Apricot/hello-world-text.apricot | 1 + .../AutoLISP/hello-world-text.autolisp | 1 + .../Hello-world-Text/Axe/hello-world-text.axe | 1 + .../Hello-world-Text/BML/hello-world-text.bml | 1 + .../Battlestar/hello-world-text.battlestar | 3 + .../ChucK/hello-world-text.chuck | 1 + .../Comal/hello-world-text.comal | 1 + .../Crystal/hello-world-text.crystal | 1 + .../DDNC/hello-world-text.ddnc | 29 + .../DIV-Games-Studio/hello-world-text.div | 9 + .../Hello-world-Text/ECL/hello-world-text.ecl | 1 + .../EDSAC-order-code/hello-world-text.edsac | 33 + .../ERRE/hello-world-text.erre | 5 + .../EchoLisp/hello-world-text.echolisp | 1 + .../Egison/hello-world-text.egison | 3 + .../Hello-world-Text/Elm/hello-world-text.elm | 1 + .../FOCAL/hello-world-text.focal | 1 + .../FUZE-BASIC/hello-world-text.fuze | 1 + .../FreeBASIC/hello-world-text.freebasic | 16 + .../FunL/hello-world-text.funl | 1 + .../GFA-Basic/hello-world-text.gfa | 1 + .../HPPPL/hello-world-text.hpppl | 1 + .../Hack/hello-world-text.hack | 1 + .../Harbour/hello-world-text.harbour | 1 + .../Hoon/hello-world-text.hoon | 1 + Task/Hello-world-Text/Hy/hello-world-text.hy | 1 + Task/Hello-world-Text/I/hello-world-text.i | 3 + .../Jack/hello-world-text.jack | 7 + .../Kitten/hello-world-text.kitten | 1 + .../LC3-Assembly/hello-world-text-1.lc3 | 6 + .../LC3-Assembly/hello-world-text-2.lc3 | 10 + .../Hello-world-Text/LFE/hello-world-text.lfe | 1 + .../Lasso/hello-world-text.lasso | 1 + .../Lily/hello-world-text-1.lily | 1 + .../Lily/hello-world-text-2.lily | 1 + .../Lingo/hello-world-text-1.lingo | 1 + .../Lingo/hello-world-text-2.lingo | 1 + .../LiveCode/hello-world-text-1.livecode | 3 + .../LiveCode/hello-world-text-2.livecode | 1 + .../Lobster/hello-world-text.lobster | 1 + .../Malbolge/hello-world-text-1.malbolge | 2 + .../Malbolge/hello-world-text-2.malbolge | 1 + .../Maude/hello-world-text.maude | 11 + .../Morfa/hello-world-text.morfa | 5 + .../MyrtleScript/hello-world-text.myrtle | 5 + .../Hello-world-Text/Nim/hello-world-text.nim | 1 + .../Hello-world-Text/Nit/hello-world-text.nit | 1 + .../Oforth/hello-world-text.oforth | 1 + .../OpenLisp/hello-world-text.openlisp | 3 + .../Hello-world-Text/PHL/hello-world-text.phl | 7 + .../Phix/hello-world-text.phix | 1 + .../Pict/hello-world-text-1.pict | 1 + .../Pict/hello-world-text-2.pict | 3 + .../Pony/hello-world-text.pony | 3 + .../Potion/hello-world-text.potion | 1 + Task/Hello-world-Text/Ra/hello-world-text.ra | 6 + .../Ring/hello-world-text.ring | 1 + .../Set-lang/hello-world-text.set | 12 + .../Shen/hello-world-text.shen | 1 + .../Sidef/hello-world-text.sidef | 1 + .../SkookumScript/hello-world-text-1.skookum | 1 + .../SkookumScript/hello-world-text-2.skookum | 1 + .../SmileBASIC/hello-world-text.smilebasic | 1 + .../hello-world-text.soneking | 8 + .../Sparkling/hello-world-text.sparkling | 1 + .../Swift/hello-world-text-1.swift | 1 + .../Swift/hello-world-text-2.swift | 1 + .../Symsyn/hello-world-text.symsyn | 1 + .../Terra/hello-world-text.terra | 6 + .../TestML/hello-world-text.testml | 2 + .../Uniface/hello-world-text.uniface | 1 + .../Ursa/hello-world-text.ursa | 1 + .../Wart/hello-world-text.wart | 1 + .../Wolfram-Language/hello-world-text.wolfram | 1 + .../Wren/hello-world-text.wren | 1 + .../XLISP/hello-world-text.xlisp | 2 + Task/Hello-world-Text/jq/hello-world-text.jq | 1 + .../AntLang/hello-world-web-server-1.antlang | 1 + .../AntLang/hello-world-web-server-2.antlang | 2 + .../AntLang/hello-world-web-server-3.antlang | 1 + .../FunL/hello-world-web-server.funl | 13 + .../Lasso/hello-world-web-server.lasso | 20 + .../Nim/hello-world-web-server.nim | 7 + .../Panda/hello-world-web-server.panda | 1 + .../Ring/hello-world-web-server.ring | 57 ++ .../Sidef/hello-world-web-server-1.sidef | 24 + .../Sidef/hello-world-web-server-2.sidef | 14 + .../Wart/hello-world-web-server.wart | 7 + Task/Here-document/8th/here-document.8th | 4 + .../Here-document/Lingo/here-document-1.lingo | 5 + .../Here-document/Lingo/here-document-2.lingo | 2 + Task/Here-document/Nim/here-document.nim | 4 + Task/Here-document/Phix/here-document.phix | 38 + Task/Here-document/Ring/here-document.ring | 11 + .../SequenceL/here-document.sequencel | 9 + .../Here-document/Sidef/here-document-1.sidef | 4 + .../Here-document/Sidef/here-document-2.sidef | 5 + .../Here-document/Sidef/here-document-3.sidef | 4 + .../Here-document/Sidef/here-document-4.sidef | 5 + Task/Here-document/jq/here-document-1.jq | 6 + Task/Here-document/jq/here-document-2.jq | 2 + Task/Here-document/jq/here-document-3.jq | 6 + Task/Here-document/jq/here-document-4.jq | 7 + Task/Here-document/jq/here-document-5.jq | 1 + .../ERRE/heronian-triangles.erre | 67 ++ .../EchoLisp/heronian-triangles.echolisp | 25 + .../FreeBASIC/heronian-triangles.freebasic | 147 ++++ .../heronian-triangles.futurebasic | 86 +++ .../Nim/heronian-triangles.nim | 60 ++ .../Phix/heronian-triangles.phix | 38 + .../Ring/heronian-triangles.ring | 29 + .../Sidef/heronian-triangles.sidef | 48 ++ .../Swift/heronian-triangles.swift | 54 ++ .../jq/heronian-triangles-1.jq | 40 ++ .../jq/heronian-triangles-2.jq | 22 + ...kerson-series-of-almost-integers.freebasic | 86 +++ .../hickerson-series-of-almost-integers.ring | 24 + .../hickerson-series-of-almost-integers.sidef | 8 + .../hickerson-series-of-almost-integers-1.jq | 25 + .../hickerson-series-of-almost-integers-2.jq | 18 + .../8th/higher-order-functions.8th | 6 + .../AntLang/higher-order-functions.antlang | 2 + .../ECL/higher-order-functions.ecl | 51 ++ .../ERRE/higher-order-functions.erre | 13 + .../higher-order-functions.freebasic | 23 + .../higher-order-functions.futurebasic | 10 + .../Lily/higher-order-functions.lily | 26 + .../Lingo/higher-order-functions-1.lingo | 17 + .../Lingo/higher-order-functions-2.lingo | 7 + .../Luck/higher-order-functions.luck | 5 + .../Morfa/higher-order-functions.morfa | 12 + .../Nim/higher-order-functions.nim | 7 + .../Oforth/higher-order-functions.oforth | 1 + .../Phix/higher-order-functions.phix | 9 + .../Sidef/higher-order-functions.sidef | 10 + .../higher-order-functions.sparkling | 6 + .../Swift/higher-order-functions-1.swift | 3 + .../Swift/higher-order-functions-2.swift | 2 + .../Ursa/higher-order-functions.ursa | 10 + .../jq/higher-order-functions-1.jq | 8 + .../jq/higher-order-functions-2.jq | 3 + .../jq/higher-order-functions-3.jq | 4 + .../jq/higher-order-functions-4.jq | 26 + .../EchoLisp/history-variables.echolisp | 22 + .../Peloton/history-variables-1.peloton | 11 + .../Peloton/history-variables-2.peloton | 11 + .../Sidef/history-variables.sidef | 28 + .../Swift/history-variables-1.swift | 11 + .../Swift/history-variables-2.swift | 38 + ...ofstadter-conway-$10,000-sequence.echolisp | 28 + ...tadter-conway-$10,000-sequence.futurebasic | 46 ++ .../hofstadter-conway-$10,000-sequence.nim | 21 + .../hofstadter-conway-$10,000-sequence.oforth | 18 + .../hofstadter-conway-$10,000-sequence.ring | 21 + .../hofstadter-conway-$10,000-sequence.sidef | 25 + .../hofstadter-conway-$10,000-sequence.swift | 29 + ...stadter-figure-figure-sequences-1.echolisp | 11 + ...stadter-figure-figure-sequences-2.echolisp | 8 + .../hofstadter-figure-figure-sequences.nim | 33 + .../hofstadter-figure-figure-sequences.oforth | 21 + .../hofstadter-figure-figure-sequences.sidef | 35 + .../ERRE/hofstadter-q-sequence.erre | 35 + .../EchoLisp/hofstadter-q-sequence.echolisp | 23 + .../Nim/hofstadter-q-sequence.nim | 14 + .../Oforth/hofstadter-q-sequence.oforth | 8 + .../Ring/hofstadter-q-sequence.ring | 8 + .../Sidef/hofstadter-q-sequence-1.sidef | 8 + .../Sidef/hofstadter-q-sequence-2.sidef | 8 + .../hofstadter-q-sequence.visual | 28 + .../jq/hofstadter-q-sequence-1.jq | 28 + .../jq/hofstadter-q-sequence-2.jq | 20 + .../Sidef/holidays-related-to-easter.sidef | 44 ++ Task/Honeycombs/Phix/honeycombs.phix | 191 +++++ Task/Honeycombs/Sidef/honeycombs.sidef | 84 +++ .../ERRE/horizontal-sundial-calculations.erre | 28 + ...orizontal-sundial-calculations.futurebasic | 26 + .../horizontal-sundial-calculations.livecode | 28 + .../Nim/horizontal-sundial-calculations.nim | 20 + .../Phix/horizontal-sundial-calculations.phix | 32 + .../horizontal-sundial-calculations.sidef | 23 + ...orners-rule-for-polynomial-evaluation.erre | 21 + ...-rule-for-polynomial-evaluation-1.echolisp | 4 + ...-rule-for-polynomial-evaluation-2.echolisp | 6 + ...orners-rule-for-polynomial-evaluation.funl | 5 + ...horners-rule-for-polynomial-evaluation.nim | 9 + ...ners-rule-for-polynomial-evaluation.potion | 9 + ...orners-rule-for-polynomial-evaluation.ring | 12 + ...ers-rule-for-polynomial-evaluation-1.sidef | 5 + ...ers-rule-for-polynomial-evaluation-2.sidef | 6 + ...rners-rule-for-polynomial-evaluation.swift | 5 + ...rs-rule-for-polynomial-evaluation-1.visual | 19 + ...rs-rule-for-polynomial-evaluation-2.visual | 18 + .../FreeBASIC/host-introspection.freebasic | 17 + .../Nim/host-introspection.nim | 3 + Task/Hostname/Arc/hostname.arc | 1 + Task/Hostname/FreeBASIC/hostname.freebasic | 13 + Task/Hostname/Harbour/hostname.harbour | 1 + Task/Hostname/LFE/hostname.lfe | 1 + Task/Hostname/Lasso/hostname-1.lasso | 1 + Task/Hostname/Lasso/hostname-2.lasso | 35 + Task/Hostname/Lingo/hostname.lingo | 6 + Task/Hostname/LiveCode/hostname.livecode | 1 + Task/Hostname/Nim/hostname.nim | 5 + Task/Hostname/Sidef/hostname-1.sidef | 2 + Task/Hostname/Sidef/hostname-2.sidef | 1 + Task/Hostname/Swift/hostname.swift | 1 + Task/Hostname/Ursa/hostname.ursa | 1 + .../SequenceL/hough-transform-1.sequencel | 45 ++ .../SequenceL/hough-transform-2.sequencel | 39 ++ .../Sidef/hough-transform.sidef | 36 + Task/Huffman-coding/Nim/huffman-coding.nim | 75 ++ .../Huffman-coding/Sidef/huffman-coding.sidef | 54 ++ .../Huffman-coding/Swift/huffman-coding.swift | 66 ++ .../Coco/i-before-e-except-after-c.coco | 13 + .../i-before-e-except-after-c.freebasic | 50 ++ .../Lasso/i-before-e-except-after-c.lasso | 33 + .../Swift/i-before-e-except-after-c.swift | 55 ++ .../jq/i-before-e-except-after-c-1.jq | 35 + .../jq/i-before-e-except-after-c-2.jq | 6 + Task/IBAN/FreeBASIC/iban.freebasic | 72 ++ Task/IBAN/Nim/iban.nim | 34 + Task/IBAN/Sidef/iban.sidef | 31 + Task/IBAN/jq/iban-1.jq | 8 + Task/IBAN/jq/iban-2.jq | 38 + Task/IBAN/jq/iban-3.jq | 2 + .../Identity-matrix/ERRE/identity-matrix.erre | 20 + .../FreeBASIC/identity-matrix.freebasic | 32 + .../Identity-matrix/FunL/identity-matrix.funl | 3 + .../Identity-matrix/LFE/identity-matrix-1.lfe | 8 + .../Identity-matrix/LFE/identity-matrix-2.lfe | 6 + Task/Identity-matrix/Nim/identity-matrix.nim | 5 + .../Identity-matrix/Ring/identity-matrix.ring | 25 + .../Sidef/identity-matrix.sidef | 12 + .../Sparkling/identity-matrix.sparkling | 7 + .../Wortel/identity-matrix.wortel | 5 + Task/Identity-matrix/jq/identity-matrix-1.jq | 3 + Task/Identity-matrix/jq/identity-matrix-2.jq | 1 + Task/Identity-matrix/jq/identity-matrix-3.jq | 3 + Task/Image-noise/Axe/image-noise.axe | 43 ++ .../AntLang/include-a-file.antlang | 1 + Task/Include-a-file/Axe/include-a-file.axe | 1 + .../Include-a-file/ChucK/include-a-file.chuck | 1 + .../FreeBASIC/include-a-file-1.freebasic | 10 + .../FreeBASIC/include-a-file-2.freebasic | 12 + .../FutureBasic/include-a-file.futurebasic | 5 + .../Harbour/include-a-file.harbour | 1 + .../Include-a-file/Lasso/include-a-file.lasso | 1 + .../Include-a-file/Lingo/include-a-file.lingo | 13 + Task/Include-a-file/Nim/include-a-file.nim | 4 + .../Oforth/include-a-file-1.oforth | 1 + .../Oforth/include-a-file-2.oforth | 1 + Task/Include-a-file/Phix/include-a-file.phix | 1 + Task/Include-a-file/Ring/include-a-file.ring | 1 + .../Sidef/include-a-file-1.sidef | 1 + .../Sidef/include-a-file-2.sidef | 2 + Task/Include-a-file/Ursa/include-a-file.ursa | 1 + Task/Include-a-file/jq/include-a-file-1.jq | 3 + Task/Include-a-file/jq/include-a-file-2.jq | 1 + Task/Include-a-file/jq/include-a-file-3.jq | 2 + .../Apex/increment-a-numerical-string.apex | 3 + .../increment-a-numerical-string.ceylon | 18 + .../ERRE/increment-a-numerical-string.erre | 4 + .../increment-a-numerical-string.echolisp | 2 + .../Eero/increment-a-numerical-string.eero | 9 + .../increment-a-numerical-string.freebasic | 15 + .../increment-a-numerical-string.futurebasic | 18 + .../Lasso/increment-a-numerical-string.lasso | 1 + .../Lingo/increment-a-numerical-string.lingo | 2 + .../increment-a-numerical-string.livecode | 4 + .../Nim/increment-a-numerical-string.nim | 2 + .../increment-a-numerical-string.oforth | 2 + .../Phix/increment-a-numerical-string.phix | 2 + .../Ring/increment-a-numerical-string.ring | 1 + .../Sidef/increment-a-numerical-string.sidef | 2 + .../increment-a-numerical-string.sparkling | 6 + .../increment-a-numerical-string-1.swift | 4 + .../increment-a-numerical-string-2.swift | 4 + .../Ursa/increment-a-numerical-string.ursa | 3 + .../XLISP/increment-a-numerical-string.xlisp | 2 + .../jq/increment-a-numerical-string-1.jq | 1 + .../jq/increment-a-numerical-string-2.jq | 18 + .../jq/increment-a-numerical-string-3.jq | 1 + Task/Infinity/ERRE/infinity.erre | 15 + Task/Infinity/FreeBASIC/infinity.freebasic | 8 + Task/Infinity/Lasso/infinity.lasso | 3 + Task/Infinity/Lingo/infinity.lingo | 7 + Task/Infinity/Nim/infinity-1.nim | 1 + Task/Infinity/Nim/infinity-2.nim | 2 + Task/Infinity/Oforth/infinity.oforth | 1 + Task/Infinity/Phix/infinity.phix | 2 + Task/Infinity/Sidef/infinity.sidef | 11 + Task/Infinity/Swift/infinity-1.swift | 2 + Task/Infinity/Swift/infinity-2.swift | 3 + Task/Infinity/Ursa/infinity.ursa | 2 + Task/Infinity/jq/infinity-1.jq | 1 + Task/Infinity/jq/infinity-2.jq | 1 + .../FreeBASIC/inheritance-multiple.freebasic | 18 + .../Lasso/inheritance-multiple.lasso | 37 + .../Lingo/inheritance-multiple-1.lingo | 11 + .../Lingo/inheritance-multiple-2.lingo | 13 + .../Lingo/inheritance-multiple-3.lingo | 15 + .../Lingo/inheritance-multiple-4.lingo | 15 + .../Oforth/inheritance-multiple.oforth | 6 + .../Sidef/inheritance-multiple.sidef | 3 + .../Swift/inheritance-multiple.swift | 11 + .../ChucK/inheritance-single-1.chuck | 3 + .../ChucK/inheritance-single-2.chuck | 3 + .../ChucK/inheritance-single-3.chuck | 3 + .../ChucK/inheritance-single-4.chuck | 3 + .../ChucK/inheritance-single-5.chuck | 3 + .../Coco/inheritance-single-1.coco | 5 + .../Coco/inheritance-single-2.coco | 28 + .../Comal/inheritance-single-1.comal | 33 + .../Comal/inheritance-single-2.comal | 5 + .../Comal/inheritance-single-3.comal | 5 + .../Comal/inheritance-single-4.comal | 9 + .../Comal/inheritance-single-5.comal | 6 + .../FreeBASIC/inheritance-single.freebasic | 21 + .../Lasso/inheritance-single.lasso | 24 + .../Lingo/inheritance-single-1.lingo | 2 + .../Lingo/inheritance-single-2.lingo | 7 + .../Lingo/inheritance-single-3.lingo | 7 + .../Lingo/inheritance-single-4.lingo | 7 + .../Lingo/inheritance-single-5.lingo | 7 + .../Nim/inheritance-single.nim | 6 + .../Oforth/inheritance-single.oforth | 5 + .../Ring/inheritance-single.ring | 5 + .../Sidef/inheritance-single.sidef | 5 + .../Swift/inheritance-single.swift | 19 + .../XLISP/inheritance-single-1.xlisp | 13 + .../XLISP/inheritance-single-2.xlisp | 21 + .../Input-loop/FreeBASIC/input-loop.freebasic | 14 + .../FutureBasic/input-loop.futurebasic | 27 + Task/Input-loop/Lasso/input-loop.lasso | 10 + Task/Input-loop/Nim/input-loop.nim | 4 + Task/Input-loop/Oforth/input-loop.oforth | 1 + Task/Input-loop/Ring/input-loop.ring | 9 + Task/Input-loop/Sidef/input-loop.sidef | 8 + .../Input-loop/Sparkling/input-loop.sparkling | 4 + Task/Input-loop/Ursa/input-loop.ursa | 5 + Task/Input-loop/jq/input-loop-1.jq | 1 + Task/Input-loop/jq/input-loop-2.jq | 1 + .../8051-Assembly/integer-comparison.8051 | 17 + .../8th/integer-comparison.8th | 4 + .../Axe/integer-comparison.axe | 11 + .../ChucK/integer-comparison.chuck | 8 + .../integer-comparison.computer | 28 + .../ECL/integer-comparison.ecl | 9 + .../EDSAC-order-code/integer-comparison.edsac | 55 ++ .../FreeBASIC/integer-comparison.freebasic | 20 + .../FunL/integer-comparison.funl | 8 + .../integer-comparison.futurebasic | 9 + .../Harbour/integer-comparison.harbour | 11 + .../Lasso/integer-comparison.lasso | 10 + .../Lingo/integer-comparison.lingo | 5 + .../LiveCode/integer-comparison.livecode | 20 + .../Nim/integer-comparison.nim | 10 + .../Oforth/integer-comparison.oforth | 10 + .../PHL/integer-comparison.phl | 21 + .../Phix/integer-comparison.phix | 12 + .../Ring/integer-comparison.ring | 8 + .../SSEM/integer-comparison.ssem | 21 + .../Sidef/integer-comparison.sidef | 12 + .../Sparkling/integer-comparison.sparkling | 10 + .../Swift/integer-comparison.swift | 17 + .../Ursa/integer-comparison.ursa | 15 + .../Wart/integer-comparison.wart | 8 + .../XLISP/integer-comparison.xlisp | 10 + .../jq/integer-comparison-1.jq | 16 + .../jq/integer-comparison-2.jq | 7 + .../Integer-overflow/Axe/integer-overflow.axe | 4 + .../integer-overflow.computer | 7 + .../FreeBASIC/integer-overflow.freebasic | 48 ++ .../Lingo/integer-overflow.lingo | 14 + .../Phix/integer-overflow.phix | 1 + .../Sidef/integer-overflow.sidef | 2 + .../Swift/integer-overflow.swift | 52 ++ .../Integer-sequence/Axe/integer-sequence.axe | 7 + .../ChucK/integer-sequence.chuck | 4 + .../integer-sequence.computer | 3 + .../EDSAC-order-code/integer-sequence.edsac | 22 + .../ERRE/integer-sequence.erre | 7 + .../EchoLisp/integer-sequence.echolisp | 2 + .../FreeBASIC/integer-sequence.freebasic | 14 + .../FunL/integer-sequence.funl | 1 + .../Futhark/integer-sequence.futhark | 1 + .../Lasso/integer-sequence.lasso | 6 + .../Lingo/integer-sequence-1.lingo | 5 + .../Lingo/integer-sequence-2.lingo | 2 + .../Lingo/integer-sequence-3.lingo | 4 + .../Lingo/integer-sequence-4.lingo | 17 + .../Nim/integer-sequence-1.nim | 4 + .../Nim/integer-sequence-2.nim | 6 + .../Oforth/integer-sequence.oforth | 1 + .../Phix/integer-sequence-1.phix | 5 + .../Phix/integer-sequence-2.phix | 5 + .../Phix/integer-sequence-3.phix | 6 + .../Ring/integer-sequence.ring | 17 + .../SSEM/integer-sequence.ssem | 3 + .../Sidef/integer-sequence.sidef | 1 + .../Swift/integer-sequence.swift | 4 + .../Ursa/integer-sequence.ursa | 11 + .../Integer-sequence/jq/integer-sequence-1.jq | 2 + .../Integer-sequence/jq/integer-sequence-2.jq | 1 + .../Integer-sequence/jq/integer-sequence-3.jq | 1 + .../EchoLisp/interactive-programming.echolisp | 19 + .../interactive-programming.freebasic | 8 + .../Lasso/interactive-programming.lasso | 43 ++ .../Lingo/interactive-programming.lingo | 4 + .../Oforth/interactive-programming-1.oforth | 1 + .../Oforth/interactive-programming-2.oforth | 8 + .../Oforth/interactive-programming-3.oforth | 6 + .../Ring/interactive-programming.ring | 4 + .../Sidef/interactive-programming.sidef | 6 + .../Ursa/interactive-programming.ursa | 9 + .../XLISP/interactive-programming.xlisp | 9 + .../EchoLisp/introspection.echolisp | 26 + .../Introspection/Lasso/introspection-1.lasso | 5 + .../Introspection/Lasso/introspection-2.lasso | 15 + .../Introspection/Lingo/introspection-1.lingo | 5 + .../Introspection/Lingo/introspection-2.lingo | 6 + .../Introspection/Lingo/introspection-3.lingo | 10 + Task/Introspection/Nim/introspection.nim | 6 + .../Introspection/Oforth/introspection.oforth | 12 + .../EchoLisp/inverted-index-1.echolisp | 23 + .../EchoLisp/inverted-index-2.echolisp | 11 + .../EchoLisp/inverted-index-3.echolisp | 9 + Task/Inverted-index/Phix/inverted-index.phix | 81 +++ Task/Inverted-index/jq/inverted-index-1.jq | 18 + Task/Inverted-index/jq/inverted-index-2.jq | 8 + Task/Inverted-index/jq/inverted-index-3.jq | 10 + .../EchoLisp/inverted-syntax.echolisp | 23 + .../FreeBASIC/inverted-syntax.freebasic | 13 + .../Sidef/inverted-syntax.sidef | 8 + .../Swift/inverted-syntax.swift | 29 + .../Wortel/inverted-syntax.wortel | 8 + Task/Inverted-syntax/jq/inverted-syntax-1.jq | 1 + Task/Inverted-syntax/jq/inverted-syntax-2.jq | 2 + .../Ceylon/iterated-digits-squaring.ceylon | 28 + .../ERRE/iterated-digits-squaring.erre | 18 + .../iterated-digits-squaring.freebasic | 47 ++ .../Oforth/iterated-digits-squaring.oforth | 7 + .../Ring/iterated-digits-squaring.ring | 10 + .../jq/iterated-digits-squaring-1.jq | 23 + .../jq/iterated-digits-squaring-2.jq | 28 + .../jq/iterated-digits-squaring-3.jq | 1 + .../jq/iterated-digits-squaring-4.jq | 10 + Task/JSON/AntLang/json.antlang | 1 + Task/JSON/Apex/json.apex | 14 + Task/JSON/EchoLisp/json.echolisp | 34 + Task/JSON/FunL/json-1.funl | 1 + Task/JSON/FunL/json-2.funl | 3 + Task/JSON/Harbour/json-1.harbour | 2 + Task/JSON/Harbour/json-2.harbour | 4 + Task/JSON/Hoon/json.hoon | 15 + Task/JSON/LFE/json-1.lfe | 1 + Task/JSON/LFE/json-2.lfe | 2 + Task/JSON/LFE/json-3.lfe | 1 + Task/JSON/LFE/json-4.lfe | 1 + Task/JSON/LFE/json-5.lfe | 3 + Task/JSON/Lasso/json.lasso | 35 + Task/JSON/Lingo/json-1.lingo | 45 ++ Task/JSON/Lingo/json-2.lingo | 50 ++ Task/JSON/Lingo/json-3.lingo | 16 + Task/JSON/Nim/json.nim | 8 + Task/JSON/Oforth/json.oforth | 10 + Task/JSON/Sidef/json.sidef | 5 + Task/JSON/Swift/json.swift | 19 + Task/JSON/jq/json-1.jq | 1 + Task/JSON/jq/json-2.jq | 1 + Task/JSON/jq/json-3.jq | 1 + Task/Jensens-Device/Nim/jensens-device.nim | 9 + .../Oforth/jensens-device.oforth | 1 + .../Jensens-Device/Sidef/jensens-device.sidef | 9 + .../Jensens-Device/Swift/jensens-device.swift | 11 + Task/Jensens-Device/jq/jensens-device.jq | 5 + .../ERRE/josephus-problem.erre | 53 ++ .../EchoLisp/josephus-problem-1.echolisp | 13 + .../EchoLisp/josephus-problem-2.echolisp | 22 + .../Josephus-problem/Nim/josephus-problem.nim | 20 + .../Oforth/josephus-problem.oforth | 12 + .../Sidef/josephus-problem-1.sidef | 7 + .../Sidef/josephus-problem-2.sidef | 3 + .../Sidef/josephus-problem-3.sidef | 2 + .../Swift/josephus-problem.swift | 45 ++ .../Josephus-problem/jq/josephus-problem-1.jq | 12 + .../Josephus-problem/jq/josephus-problem-2.jq | 5 + .../jump-anywhere.computer | 5 + Task/Jump-anywhere/ERRE/jump-anywhere.erre | 19 + .../FreeBASIC/jump-anywhere.freebasic | 50 ++ .../FutureBasic/jump-anywhere.futurebasic | 20 + .../Jump-anywhere/Lingo/jump-anywhere-1.lingo | 8 + .../Jump-anywhere/Lingo/jump-anywhere-2.lingo | 12 + Task/Jump-anywhere/Nim/jump-anywhere.nim | 5 + Task/Jump-anywhere/Phix/jump-anywhere-1.phix | 3 + Task/Jump-anywhere/Phix/jump-anywhere-2.phix | 3 + Task/Jump-anywhere/Phix/jump-anywhere-3.phix | 5 + Task/Jump-anywhere/Phix/jump-anywhere-4.phix | 14 + Task/Jump-anywhere/Phix/jump-anywhere-5.phix | 1 + Task/Jump-anywhere/SSEM/jump-anywhere-1.ssem | 2 + Task/Jump-anywhere/SSEM/jump-anywhere-2.ssem | 2 + Task/Jump-anywhere/jq/jump-anywhere-1.jq | 1 + Task/Jump-anywhere/jq/jump-anywhere-2.jq | 1 + Task/Jump-anywhere/jq/jump-anywhere-3.jq | 1 + Task/K-d-tree/Sidef/k-d-tree.sidef | 126 ++++ .../FreeBASIC/kaprekar-numbers.freebasic | 65 ++ .../Kaprekar-numbers/Nim/kaprekar-numbers.nim | 12 + .../Ring/kaprekar-numbers.ring | 18 + .../Sidef/kaprekar-numbers.sidef | 19 + .../Wortel/kaprekar-numbers.wortel | 19 + .../Kaprekar-numbers/jq/kaprekar-numbers-1.jq | 32 + .../Kaprekar-numbers/jq/kaprekar-numbers-2.jq | 3 + ...yboard-input-flush-the-keyboard-buffer.axe | 2 + ...board-input-flush-the-keyboard-buffer.erre | 6 + ...-input-flush-the-keyboard-buffer.freebasic | 6 + ...yboard-input-flush-the-keyboard-buffer.nim | 4 + ...ard-input-flush-the-keyboard-buffer.oforth | 3 + ...board-input-flush-the-keyboard-buffer.phix | 1 + ...oard-input-flush-the-keyboard-buffer.sidef | 17 + .../Axe/keyboard-input-keypress-check.axe | 1 + .../ERRE/keyboard-input-keypress-check.erre | 4 + .../keyboard-input-keypress-check.freebasic | 14 + .../Lingo/keyboard-input-keypress-check.lingo | 7 + .../keyboard-input-keypress-check-1.livecode | 10 + .../keyboard-input-keypress-check-2.livecode | 4 + .../keyboard-input-keypress-check-1.oforth | 7 + .../keyboard-input-keypress-check-2.oforth | 3 + .../Phix/keyboard-input-keypress-check.phix | 1 + .../Ring/keyboard-input-keypress-check.ring | 2 + ...eyboard-input-obtain-a-y-or-n-response.8th | 10 + ...eyboard-input-obtain-a-y-or-n-response.axe | 12 + ...yboard-input-obtain-a-y-or-n-response.erre | 22 + ...eyboard-input-obtain-a-y-or-n-response.elm | 28 + ...d-input-obtain-a-y-or-n-response.freebasic | 18 + ...input-obtain-a-y-or-n-response.futurebasic | 23 + ...rd-input-obtain-a-y-or-n-response.livecode | 8 + ...oard-input-obtain-a-y-or-n-response.oforth | 10 + ...yboard-input-obtain-a-y-or-n-response.phix | 12 + ...yboard-input-obtain-a-y-or-n-response.ring | 6 + ...board-input-obtain-a-y-or-n-response.sidef | 17 + .../EchoLisp/keyboard-macros.echolisp | 16 + .../Ceylon/knapsack-problem-0-1-1.ceylon | 2 + .../Ceylon/knapsack-problem-0-1-2.ceylon | 82 +++ .../EchoLisp/knapsack-problem-0-1-1.echolisp | 34 + .../EchoLisp/knapsack-problem-0-1-2.echolisp | 20 + .../knapsack-problem-0-1.futurebasic | 153 ++++ .../Sidef/knapsack-problem-0-1.sidef | 70 ++ .../jq/knapsack-problem-0-1-1.jq | 25 + .../jq/knapsack-problem-0-1-2.jq | 26 + .../jq/knapsack-problem-0-1-3.jq | 3 + .../knapsack-problem-bounded-1.echolisp | 54 ++ .../knapsack-problem-bounded-2.echolisp | 19 + .../Sidef/knapsack-problem-bounded.sidef | 67 ++ .../knapsack-problem-continuous.echolisp | 36 + .../Oforth/knapsack-problem-continuous.oforth | 18 + .../Sidef/knapsack-problem-continuous.sidef | 30 + .../jq/knapsack-problem-continuous-1.jq | 22 + .../jq/knapsack-problem-continuous-2.jq | 12 + .../jq/knapsack-problem-continuous-3.jq | 8 + .../knapsack-problem-unbounded.echolisp | 70 ++ .../Sidef/knapsack-problem-unbounded.sidef | 65 ++ Task/Knights-tour/ERRE/knights-tour.erre | 209 ++++++ .../EchoLisp/knights-tour-1.echolisp | 68 ++ .../EchoLisp/knights-tour-2.echolisp | 33 + .../EchoLisp/knights-tour-3.echolisp | 9 + Task/Knights-tour/Elm/knights-tour.elm | 133 ++++ Task/Knights-tour/Phix/knights-tour.phix | 86 +++ Task/Knights-tour/Sidef/knights-tour.sidef | 61 ++ Task/Knuth-shuffle/ERRE/knuth-shuffle.erre | 19 + .../EchoLisp/knuth-shuffle.echolisp | 29 + .../FreeBASIC/knuth-shuffle.freebasic | 77 ++ Task/Knuth-shuffle/FunL/knuth-shuffle.funl | 9 + Task/Knuth-shuffle/Lasso/knuth-shuffle.lasso | 20 + Task/Knuth-shuffle/Nim/knuth-shuffle.nim | 11 + .../Knuth-shuffle/Oforth/knuth-shuffle.oforth | 5 + Task/Knuth-shuffle/Phix/knuth-shuffle.phix | 8 + Task/Knuth-shuffle/Ring/knuth-shuffle.ring | 16 + Task/Knuth-shuffle/Sidef/knuth-shuffle.sidef | 11 + .../Knuth-shuffle/Swift/knuth-shuffle-1.swift | 20 + .../Knuth-shuffle/Swift/knuth-shuffle-2.swift | 31 + .../Knuth-shuffle/Swift/knuth-shuffle-3.swift | 50 ++ .../Sidef/knuths-algorithm-s.sidef | 29 + .../Swift/knuths-algorithm-s.swift | 28 + .../EchoLisp/lu-decomposition.echolisp | 38 + .../Idris/lu-decomposition.idris | 155 +++++ .../Sidef/lu-decomposition.sidef | 74 ++ .../LU-decomposition/jq/lu-decomposition-1.jq | 45 ++ .../LU-decomposition/jq/lu-decomposition-2.jq | 42 ++ .../LU-decomposition/jq/lu-decomposition-3.jq | 2 + .../LU-decomposition/jq/lu-decomposition-4.jq | 12 + .../LU-decomposition/jq/lu-decomposition-5.jq | 2 + .../LU-decomposition/jq/lu-decomposition-6.jq | 15 + .../LU-decomposition/jq/lu-decomposition-7.jq | 12 + Task/LZW-compression/Nim/lzw-compression.nim | 63 ++ .../Sidef/lzw-compression.sidef | 72 ++ .../Swift/lzw-compression.swift | 62 ++ Task/LZW-compression/jq/lzw-compression-1.jq | 46 ++ Task/LZW-compression/jq/lzw-compression-2.jq | 1 + .../EchoLisp/langtons-ant.echolisp | 59 ++ Task/Langtons-ant/Elm/langtons-ant.elm | 132 ++++ .../FreeBASIC/langtons-ant.freebasic | 65 ++ Task/Langtons-ant/GFA-Basic/langtons-ant.gfa | 93 +++ Task/Langtons-ant/Nim/langtons-ant.nim | 34 + Task/Langtons-ant/Phix/langtons-ant.phix | 15 + Task/Langtons-ant/Ring/langtons-ant.ring | 55 ++ Task/Langtons-ant/Sidef/langtons-ant.sidef | 24 + Task/Langtons-ant/Swift/langtons-ant.swift | 73 ++ Task/Langtons-ant/jq/langtons-ant.jq | 58 ++ .../largest-int-from-concatenated-ints.ceylon | 15 + .../largest-int-from-concatenated-ints.nim | 9 + .../largest-int-from-concatenated-ints.oforth | 1 + .../largest-int-from-concatenated-ints.phix | 14 + .../largest-int-from-concatenated-ints.ring | 24 + .../largest-int-from-concatenated-ints.sidef | 7 + .../largest-int-from-concatenated-ints-1.jq | 13 + .../largest-int-from-concatenated-ints-2.jq | 4 + .../Elm/last-friday-of-each-month.elm | 67 ++ .../last-friday-of-each-month.freebasic | 85 +++ .../Lasso/last-friday-of-each-month.lasso | 24 + .../last-friday-of-each-month-1.livecode | 23 + .../last-friday-of-each-month-2.livecode | 1 + .../last-friday-of-each-month-3.livecode | 12 + .../Nim/last-friday-of-each-month.nim | 12 + .../Oforth/last-friday-of-each-month.oforth | 9 + .../Phix/last-friday-of-each-month.phix | 24 + .../Ring/last-friday-of-each-month.ring | 20 + .../Sidef/last-friday-of-each-month.sidef | 10 + .../last-friday-of-each-month.visual | 34 + .../jq/last-friday-of-each-month-1.jq | 27 + .../jq/last-friday-of-each-month-2.jq | 22 + .../jq/last-friday-of-each-month-3.jq | 14 + .../Phix/last-letter-first-letter.phix | 77 ++ .../jq/last-letter-first-letter-1.jq | 7 + .../jq/last-letter-first-letter-2.jq | 41 ++ .../jq/last-letter-first-letter-3.jq | 17 + .../jq/last-letter-first-letter-4.jq | 99 +++ Task/Leap-year/ERRE/leap-year.erre | 17 + Task/Leap-year/FreeBASIC/leap-year.freebasic | 42 ++ .../FutureBasic/leap-year.futurebasic | 50 ++ Task/Leap-year/Harbour/leap-year.harbour | 2 + Task/Leap-year/Hy/leap-year.hy | 6 + Task/Leap-year/Lasso/leap-year.lasso | 11 + Task/Leap-year/Lingo/leap-year.lingo | 3 + Task/Leap-year/LiveCode/leap-year.livecode | 18 + Task/Leap-year/Nim/leap-year.nim | 12 + Task/Leap-year/Oforth/leap-year.oforth | 1 + Task/Leap-year/Phix/leap-year.phix | 3 + Task/Leap-year/Ring/leap-year.ring | 10 + Task/Leap-year/Sidef/leap-year-1.sidef | 6 + Task/Leap-year/Sidef/leap-year-2.sidef | 1 + Task/Leap-year/Swift/leap-year.swift | 6 + Task/Leap-year/Ursa/leap-year.ursa | 11 + Task/Leap-year/Wortel/leap-year.wortel | 4 + Task/Leap-year/XLISP/leap-year.xlisp | 5 + Task/Leap-year/jq/leap-year-1.jq | 2 + Task/Leap-year/jq/leap-year-2.jq | 7 + .../8th/least-common-multiple.8th | 25 + .../ERRE/least-common-multiple.erre | 30 + .../EchoLisp/least-common-multiple.echolisp | 6 + .../Ezhil/least-common-multiple.ezhil | 56 ++ .../FreeBASIC/least-common-multiple.freebasic | 18 + .../FunL/least-common-multiple.funl | 4 + .../Lasso/least-common-multiple.lasso | 19 + .../Nim/least-common-multiple.nim | 15 + .../Oforth/least-common-multiple.oforth | 1 + .../Phix/least-common-multiple.phix | 3 + .../Ring/least-common-multiple.ring | 13 + .../Sidef/least-common-multiple-1.sidef | 1 + .../Sidef/least-common-multiple-2.sidef | 10 + .../Sparkling/least-common-multiple.sparkling | 33 + .../Swift/least-common-multiple.swift | 3 + .../Ursa/least-common-multiple.ursa | 2 + .../Wortel/least-common-multiple-1.wortel | 1 + .../Wortel/least-common-multiple-2.wortel | 1 + .../Wortel/least-common-multiple-3.wortel | 1 + .../jq/least-common-multiple.jq | 6 + .../EchoLisp/left-factorials-1.echolisp | 5 + .../EchoLisp/left-factorials-2.echolisp | 38 + Task/Left-factorials/Nim/left-factorials.nim | 26 + .../Oforth/left-factorials.oforth | 1 + .../Left-factorials/Ring/left-factorials.ring | 15 + .../Sidef/left-factorials-1.sidef | 3 + .../Sidef/left-factorials-2.sidef | 3 + .../Sidef/left-factorials-3.sidef | 18 + .../Sidef/left-factorials-4.sidef | 9 + Task/Left-factorials/jq/left-factorials-1.jq | 5 + Task/Left-factorials/jq/left-factorials-2.jq | 21 + Task/Left-factorials/jq/left-factorials-3.jq | 3 + Task/Left-factorials/jq/left-factorials-4.jq | 32 + .../ERRE/letter-frequency.erre | 25 + .../EchoLisp/letter-frequency-1.echolisp | 11 + .../EchoLisp/letter-frequency-2.echolisp | 24 + .../FreeBASIC/letter-frequency.freebasic | 28 + .../Harbour/letter-frequency.harbour | 24 + .../Lasso/letter-frequency.lasso | 24 + .../Letter-frequency/Nim/letter-frequency.nim | 8 + .../Phix/letter-frequency.phix | 17 + .../Ring/letter-frequency.ring | 14 + .../Sidef/letter-frequency.sidef | 9 + .../Letter-frequency/jq/letter-frequency-1.jq | 9 + .../Letter-frequency/jq/letter-frequency-2.jq | 1 + .../Arc/levenshtein-distance.arc | 16 + .../ERRE/levenshtein-distance.erre | 43 ++ .../EchoLisp/levenshtein-distance.echolisp | 28 + .../FreeBASIC/levenshtein-distance.freebasic | 49 ++ .../levenshtein-distance.futurebasic | 49 ++ .../LFE/levenshtein-distance-1.lfe | 13 + .../LFE/levenshtein-distance-2.lfe | 8 + .../LFE/levenshtein-distance-3.lfe | 26 + .../LFE/levenshtein-distance-4.lfe | 10 + .../Nim/levenshtein-distance.nim | 24 + .../Phix/levenshtein-distance.phix | 35 + .../Sidef/levenshtein-distance-1.sidef | 15 + .../Sidef/levenshtein-distance-2.sidef | 11 + .../Sidef/levenshtein-distance-3.sidef | 2 + .../Swift/levenshtein-distance-1.swift | 15 + .../Swift/levenshtein-distance-2.swift | 16 + .../jq/levenshtein-distance-1.jq | 51 ++ .../jq/levenshtein-distance-2.jq | 8 + .../ERRE/linear-congruential-generator.erre | 34 + .../linear-congruential-generator.freebasic | 57 ++ .../Nim/linear-congruential-generator.nim | 13 + .../linear-congruential-generator.oforth | 4 + .../Sidef/linear-congruential-generator.sidef | 30 + .../linear-congruential-generator-1.sparkling | 20 + .../linear-congruential-generator-2.sparkling | 22 + .../Swift/linear-congruential-generator.swift | 47 ++ .../jq/linear-congruential-generator-1.jq | 14 + .../jq/linear-congruential-generator-2.jq | 5 + .../jq/linear-congruential-generator-3.jq | 14 + .../jq/linear-congruential-generator-4.jq | 5 + .../EchoLisp/list-comprehensions.echolisp | 8 + .../FunL/list-comprehensions.funl | 3 + .../Lasso/list-comprehensions-1.lasso | 11 + .../Lasso/list-comprehensions-2.lasso | 6 + .../Nim/list-comprehensions.nim | 50 ++ .../Ring/list-comprehensions.ring | 8 + .../Sidef/list-comprehensions.sidef | 10 + .../jq/list-comprehensions-1.jq | 4 + .../jq/list-comprehensions-2.jq | 10 + .../Axe/literals-floating-point-1.axe | 2 + .../Axe/literals-floating-point-2.axe | 1 + .../literals-floating-point.freebasic | 14 + .../Lasso/literals-floating-point.lasso | 6 + .../Lingo/literals-floating-point.lingo | 23 + .../Nim/literals-floating-point.nim | 12 + .../Oforth/literals-floating-point.oforth | 5 + .../Phix/literals-floating-point.phix | 7 + .../Sidef/literals-floating-point.sidef | 4 + .../Swift/literals-floating-point.swift | 9 + .../Ursa/literals-floating-point.ursa | 11 + .../jq/literals-floating-point.jq | 7 + .../Literals-Integer/Axe/literals-integer.axe | 3 + .../Comal/literals-integer.comal | 2 + .../ERRE/literals-integer.erre | 4 + .../FreeBASIC/literals-integer.freebasic | 20 + .../FutureBasic/literals-integer.futurebasic | 9 + .../Harbour/literals-integer.harbour | 1 + .../Lasso/literals-integer.lasso | 2 + .../LiveCode/literals-integer.livecode | 1 + .../Literals-Integer/Nim/literals-integer.nim | 20 + .../Phix/literals-integer.phix | 1 + .../Sidef/literals-integer.sidef | 4 + .../Swift/literals-integer.swift | 3 + .../Ursa/literals-integer.ursa | 3 + .../Literals-String/Axe/literals-string-1.axe | 1 + .../Literals-String/Axe/literals-string-2.axe | 1 + .../Lasso/literals-string-1.lasso | 2 + .../Lasso/literals-string-2.lasso | 1 + .../Lingo/literals-string-1.lingo | 3 + .../Lingo/literals-string-2.lingo | 3 + .../Lingo/literals-string-3.lingo | 6 + .../LiveCode/literals-string.livecode | 5 + Task/Literals-String/Nim/literals-string.nim | 7 + .../Oforth/literals-string.oforth | 5 + .../Phix/literals-string-1.phix | 1 + .../Phix/literals-string-2.phix | 2 + .../Phix/literals-string-3.phix | 1 + .../Phix/literals-string-4.phix | 4 + .../Phix/literals-string-5.phix | 12 + .../Phix/literals-string-6.phix | 1 + .../Literals-String/Ring/literals-string.ring | 1 + .../Sidef/literals-string-1.sidef | 4 + .../Sidef/literals-string-2.sidef | 4 + .../Sidef/literals-string-3.sidef | 13 + .../Swift/literals-string.swift | 7 + .../Apex/logical-operations.apex | 6 + .../Axe/logical-operations.axe | 7 + .../ECL/logical-operations.ecl | 18 + .../FreeBASIC/logical-operations.freebasic | 27 + .../FunL/logical-operations.funl | 8 + .../logical-operations.futurebasic | 23 + .../Harbour/logical-operations.harbour | 6 + .../Lasso/logical-operations.lasso | 15 + .../LiveCode/logical-operations-1.livecode | 7 + .../LiveCode/logical-operations-2.livecode | 22 + .../Nim/logical-operations.nim | 5 + .../Oforth/logical-operations.oforth | 5 + .../Phix/logical-operations-1.phix | 25 + .../Phix/logical-operations-2.phix | 10 + .../Ring/logical-operations.ring | 6 + .../Sidef/logical-operations.sidef | 8 + .../logical-operations-1.skookum | 11 + .../logical-operations-2.skookum | 1 + .../Swift/logical-operations.swift | 5 + .../XLISP/logical-operations.xlisp | 4 + .../jq/logical-operations-1.jq | 5 + .../jq/logical-operations-2.jq | 3 + .../jq/logical-operations-3.jq | 37 + .../EchoLisp/long-multiplication.echolisp | 39 ++ .../Nim/long-multiplication.nim | 41 ++ .../Oforth/long-multiplication.oforth | 28 + .../Phix/long-multiplication.phix | 54 ++ .../Sidef/long-multiplication-1.sidef | 1 + .../Sidef/long-multiplication-2.sidef | 37 + .../Sidef/long-multiplication-3.sidef | 50 ++ .../jq/long-multiplication-1.jq | 46 ++ .../jq/long-multiplication-2.jq | 18 + .../jq/long-multiplication-3.jq | 1 + .../longest-common-subsequence-1.egison | 8 + .../longest-common-subsequence-2.egison | 2 + .../Nim/longest-common-subsequence-1.nim | 13 + .../Nim/longest-common-subsequence-2.nim | 28 + .../Ring/longest-common-subsequence.ring | 16 + .../Sidef/longest-common-subsequence.sidef | 16 + .../Swift/longest-common-subsequence-1.swift | 16 + .../Swift/longest-common-subsequence-2.swift | 31 + .../jq/longest-common-subsequence-1.jq | 13 + .../jq/longest-common-subsequence-2.jq | 2 + .../jq/longest-common-subsequence-3.jq | 3 + .../longest-increasing-subsequence-1.sidef | 16 + .../longest-increasing-subsequence-2.sidef | 27 + .../jq/longest-increasing-subsequence-1.jq | 17 + .../jq/longest-increasing-subsequence-2.jq | 18 + .../jq/longest-increasing-subsequence-3.jq | 3 + .../jq/longest-increasing-subsequence-4.jq | 3 + .../Phix/longest-string-challenge-1.phix | 23 + .../Phix/longest-string-challenge-2.phix | 12 + .../Sidef/longest-string-challenge.sidef | 9 + .../ERRE/look-and-say-sequence.erre | 24 + .../EchoLisp/look-and-say-sequence-1.echolisp | 12 + .../EchoLisp/look-and-say-sequence-2.echolisp | 11 + .../Lasso/look-and-say-sequence.lasso | 28 + .../LiveCode/look-and-say-sequence.livecode | 21 + .../Oforth/look-and-say-sequence.oforth | 1 + .../Ring/look-and-say-sequence.ring | 19 + .../Sidef/look-and-say-sequence.sidef | 9 + .../jq/look-and-say-sequence.jq | 15 + ...op-over-multiple-arrays-simultaneously.axe | 12 + ...er-multiple-arrays-simultaneously.echolisp | 14 + ...r-multiple-arrays-simultaneously.freebasic | 29 + ...p-over-multiple-arrays-simultaneously.funl | 4 + ...op-over-multiple-arrays-simultaneously.lfe | 6 + ...-multiple-arrays-simultaneously-1.livecode | 16 + ...-multiple-arrays-simultaneously-2.livecode | 13 + ...op-over-multiple-arrays-simultaneously.nim | 7 + ...over-multiple-arrays-simultaneously.oforth | 2 + ...p-over-multiple-arrays-simultaneously.phix | 7 + ...p-over-multiple-arrays-simultaneously.ring | 7 + ...-over-multiple-arrays-simultaneously.sidef | 3 + ...-over-multiple-arrays-simultaneously.swift | 7 + ...p-over-multiple-arrays-simultaneously.ursa | 11 + ...over-multiple-arrays-simultaneously.visual | 36 + ...p-over-multiple-arrays-simultaneously.wart | 2 + ...p-over-multiple-arrays-simultaneously-1.jq | 5 + ...p-over-multiple-arrays-simultaneously-2.jq | 8 + Task/Loops-Break/Axe/loops-break.axe | 7 + Task/Loops-Break/ERRE/loops-break.erre | 6 + .../FreeBASIC/loops-break.freebasic | 16 + .../FutureBasic/loops-break.futurebasic | 8 + Task/Loops-Break/Harbour/loops-break.harbour | 13 + Task/Loops-Break/Lasso/loops-break.lasso | 7 + Task/Loops-Break/Lingo/loops-break.lingo | 6 + .../Loops-Break/LiveCode/loops-break.livecode | 8 + Task/Loops-Break/Nim/loops-break.nim | 9 + Task/Loops-Break/Oforth/loops-break.oforth | 5 + Task/Loops-Break/Phix/loops-break.phix | 7 + Task/Loops-Break/Ring/loops-break.ring | 5 + Task/Loops-Break/Sidef/loops-break.sidef | 6 + Task/Loops-Break/Swift/loops-break.swift | 11 + Task/Loops-Break/Ursa/loops-break.ursa | 11 + Task/Loops-Continue/ERRE/loops-continue.erre | 10 + .../FreeBASIC/loops-continue.freebasic | 12 + .../Loops-Continue/Lasso/loops-continue.lasso | 6 + .../Loops-Continue/Lingo/loops-continue.lingo | 10 + .../LiveCode/loops-continue.livecode | 5 + Task/Loops-Continue/Nim/loops-continue.nim | 5 + .../Oforth/loops-continue.oforth | 6 + Task/Loops-Continue/Phix/loops-continue.phix | 9 + Task/Loops-Continue/Ring/loops-continue.ring | 8 + .../Loops-Continue/Sidef/loops-continue.sidef | 8 + .../Loops-Continue/Swift/loops-continue.swift | 8 + Task/Loops-Continue/Ursa/loops-continue.ursa | 8 + Task/Loops-Continue/jq/loops-continue.jq | 2 + Task/Loops-Do-while/Axe/loops-do-while.axe | 5 + .../Loops-Do-while/ChucK/loops-do-while.chuck | 7 + Task/Loops-Do-while/Coco/loops-do-while.coco | 4 + Task/Loops-Do-while/ERRE/loops-do-while.erre | 5 + .../FreeBASIC/loops-do-while.freebasic | 9 + .../FutureBasic/loops-do-while.futurebasic | 8 + .../Harbour/loops-do-while.harbour | 8 + .../Loops-Do-while/Lasso/loops-do-while.lasso | 5 + .../Loops-Do-while/Lingo/loops-do-while.lingo | 6 + .../LiveCode/loops-do-while.livecode | 4 + .../Monicelli/loops-do-while.monicelli | 3 + Task/Loops-Do-while/Nim/loops-do-while.nim | 9 + .../Oforth/loops-do-while.oforth | 1 + Task/Loops-Do-while/PHL/loops-do-while.phl | 5 + Task/Loops-Do-while/Phix/loops-do-while.phix | 6 + Task/Loops-Do-while/Ring/loops-do-while.ring | 5 + .../Loops-Do-while/Sidef/loops-do-while.sidef | 4 + .../Sparkling/loops-do-while.sparkling | 4 + .../Swift/loops-do-while-1.swift | 5 + .../Swift/loops-do-while-2.swift | 5 + Task/Loops-Do-while/jq/loops-do-while-1.jq | 4 + Task/Loops-Do-while/jq/loops-do-while-2.jq | 1 + .../Axe/loops-downward-for.axe | 3 + .../Ceylon/loops-downward-for.ceylon | 3 + .../ERRE/loops-downward-for.erre | 3 + .../EchoLisp/loops-downward-for.echolisp | 3 + .../FreeBASIC/loops-downward-for.freebasic | 7 + .../loops-downward-for.futurebasic | 7 + .../Harbour/loops-downward-for.harbour | 3 + .../Lasso/loops-downward-for.lasso | 1 + .../Lingo/loops-downward-for.lingo | 3 + .../LiveCode/loops-downward-for-1.livecode | 5 + .../LiveCode/loops-downward-for-2.livecode | 3 + .../Nim/loops-downward-for.nim | 1 + .../Oforth/loops-downward-for.oforth | 1 + .../Peloton/loops-downward-for-1.peloton | 1 + .../Peloton/loops-downward-for-2.peloton | 1 + .../Phix/loops-downward-for.phix | 3 + .../Ring/loops-downward-for.ring | 1 + .../SSEM/loops-downward-for.ssem | 19 + .../Sidef/loops-downward-for-1.sidef | 3 + .../Sidef/loops-downward-for-2.sidef | 3 + .../Sidef/loops-downward-for-3.sidef | 3 + .../Sparkling/loops-downward-for.sparkling | 3 + .../Swift/loops-downward-for-1.swift | 3 + .../Swift/loops-downward-for-2.swift | 3 + .../Swift/loops-downward-for-3.swift | 3 + .../Swift/loops-downward-for-4.swift | 3 + .../Swift/loops-downward-for-5.swift | 3 + .../Ursa/loops-downward-for.ursa | 4 + .../Wart/loops-downward-for.wart | 2 + .../jq/loops-downward-for.jq | 1 + .../Axe/loops-for-with-a-specified-step.axe | 4 + .../loops-for-with-a-specified-step.ceylon | 7 + .../loops-for-with-a-specified-step-1.chuck | 7 + .../loops-for-with-a-specified-step-2.chuck | 4 + .../ERRE/loops-for-with-a-specified-step.erre | 3 + .../loops-for-with-a-specified-step.echolisp | 8 + .../loops-for-with-a-specified-step.focal | 1 + .../loops-for-with-a-specified-step.freebasic | 7 + ...oops-for-with-a-specified-step.futurebasic | 15 + .../loops-for-with-a-specified-step.lasso | 4 + .../loops-for-with-a-specified-step.lingo | 5 + ...loops-for-with-a-specified-step-1.livecode | 5 + ...loops-for-with-a-specified-step-2.livecode | 1 + .../Nim/loops-for-with-a-specified-step.nim | 1 + .../loops-for-with-a-specified-step.oforth | 1 + .../loops-for-with-a-specified-step.panda | 6 + .../Phix/loops-for-with-a-specified-step.phix | 4 + .../loops-for-with-a-specified-step-1.ring | 1 + .../loops-for-with-a-specified-step-2.ring | 1 + .../SSEM/loops-for-with-a-specified-step.ssem | 25 + .../loops-for-with-a-specified-step-1.sidef | 3 + .../loops-for-with-a-specified-step-2.sidef | 3 + .../loops-for-with-a-specified-step-3.sidef | 3 + .../loops-for-with-a-specified-step-1.swift | 3 + .../loops-for-with-a-specified-step-2.swift | 3 + .../Ursa/loops-for-with-a-specified-step.ursa | 5 + .../Wart/loops-for-with-a-specified-step.wart | 2 + .../jq/loops-for-with-a-specified-step-1.jq | 4 + .../jq/loops-for-with-a-specified-step-2.jq | 3 + Task/Loops-For/8th/loops-for.8th | 1 + Task/Loops-For/Apex/loops-for.apex | 21 + Task/Loops-For/Axe/loops-for.axe | 6 + Task/Loops-For/Ceylon/loops-for.ceylon | 9 + .../EDSAC-order-code/loops-for.edsac | 50 ++ Task/Loops-For/ERRE/loops-for.erre | 6 + Task/Loops-For/FOCAL/loops-for.focal | 4 + Task/Loops-For/FreeBASIC/loops-for.freebasic | 10 + Task/Loops-For/Futhark/loops-for.futhark | 7 + Task/Loops-For/Hack/loops-for.hack | 7 + Task/Loops-For/LC3-Assembly/loops-for.lc3 | 31 + Task/Loops-For/Lasso/loops-for.lasso | 4 + Task/Loops-For/Lingo/loops-for.lingo | 7 + Task/Loops-For/LiveCode/loops-for.livecode | 8 + Task/Loops-For/Morfa/loops-for.morfa | 10 + Task/Loops-For/Nim/loops-for.nim | 4 + Task/Loops-For/Oforth/loops-for.oforth | 5 + Task/Loops-For/Phix/loops-for.phix | 6 + Task/Loops-For/Ring/loops-for-1.ring | 1 + Task/Loops-For/Ring/loops-for-2.ring | 6 + Task/Loops-For/Sidef/loops-for-1.sidef | 6 + Task/Loops-For/Sidef/loops-for-2.sidef | 4 + Task/Loops-For/Sidef/loops-for-3.sidef | 4 + Task/Loops-For/Sidef/loops-for-4.sidef | 4 + Task/Loops-For/Sparkling/loops-for.sparkling | 7 + Task/Loops-For/Swift/loops-for-1.swift | 6 + Task/Loops-For/Swift/loops-for-2.swift | 6 + Task/Loops-For/Swift/loops-for-3.swift | 6 + Task/Loops-For/TypeScript/loops-for.type | 7 + Task/Loops-For/Ursa/loops-for.ursa | 11 + Task/Loops-For/Wart/loops-for.wart | 4 + Task/Loops-For/XLISP/loops-for.xlisp | 4 + Task/Loops-For/jq/loops-for.jq | 13 + Task/Loops-Foreach/Apex/loops-foreach.apex | 5 + Task/Loops-Foreach/ERRE/loops-foreach.erre | 4 + .../EchoLisp/loops-foreach.echolisp | 13 + .../FreeBASIC/loops-foreach.freebasic | 18 + Task/Loops-Foreach/LFE/loops-foreach.lfe | 4 + .../Loops-Foreach/Lasso/loops-foreach-1.lasso | 1 + .../Loops-Foreach/Lasso/loops-foreach-2.lasso | 1 + .../Loops-Foreach/Lingo/loops-foreach-1.lingo | 4 + .../Loops-Foreach/Lingo/loops-foreach-2.lingo | 13 + .../Loops-Foreach/Lingo/loops-foreach-3.lingo | 2 + .../LiveCode/loops-foreach.livecode | 4 + Task/Loops-Foreach/Nim/loops-foreach.nim | 6 + .../Oforth/loops-foreach-1.oforth | 1 + .../Oforth/loops-foreach-2.oforth | 1 + Task/Loops-Foreach/PHL/loops-foreach.phl | 5 + Task/Loops-Foreach/Phix/loops-foreach.phix | 4 + Task/Loops-Foreach/Ring/loops-foreach.ring | 4 + .../Loops-Foreach/Sidef/loops-foreach-1.sidef | 3 + .../Loops-Foreach/Sidef/loops-foreach-2.sidef | 3 + .../Loops-Foreach/Sidef/loops-foreach-3.sidef | 3 + .../Sparkling/loops-foreach.sparkling | 4 + .../Loops-Foreach/Swift/loops-foreach-1.swift | 3 + .../Loops-Foreach/Swift/loops-foreach-2.swift | 3 + Task/Loops-Foreach/Wart/loops-foreach.wart | 2 + Task/Loops-Foreach/XLISP/loops-foreach.xlisp | 1 + Task/Loops-Foreach/jq/loops-foreach-1.jq | 1 + Task/Loops-Foreach/jq/loops-foreach-2.jq | 2 + Task/Loops-Foreach/jq/loops-foreach-3.jq | 2 + Task/Loops-Foreach/jq/loops-foreach-4.jq | 1 + Task/Loops-Foreach/jq/loops-foreach-5.jq | 1 + Task/Loops-Foreach/jq/loops-foreach-6.jq | 3 + Task/Loops-Infinite/8th/loops-infinite-1.8th | 1 + Task/Loops-Infinite/8th/loops-infinite-2.8th | 1 + Task/Loops-Infinite/Axe/loops-infinite.axe | 3 + .../Loops-Infinite/ChucK/loops-infinite.chuck | 1 + .../Loops-Infinite/Comal/loops-infinite.comal | 3 + Task/Loops-Infinite/ERRE/loops-infinite.erre | 3 + .../FreeBASIC/loops-infinite.freebasic | 5 + .../FutureBasic/loops-infinite.futurebasic | 5 + .../Loops-Infinite/Lasso/loops-infinite.lasso | 4 + Task/Loops-Infinite/Lily/loops-infinite.lily | 1 + .../Loops-Infinite/Lingo/loops-infinite.lingo | 3 + .../LiveCode/loops-infinite.livecode | 3 + .../Loops-Infinite/Monte/loops-infinite.monte | 2 + Task/Loops-Infinite/Nim/loops-infinite.nim | 2 + .../Oforth/loops-infinite.oforth | 1 + Task/Loops-Infinite/Phix/loops-infinite.phix | 3 + Task/Loops-Infinite/Ring/loops-infinite.ring | 3 + .../Loops-Infinite/Sidef/loops-infinite.sidef | 1 + .../Sparkling/loops-infinite-1.sparkling | 3 + .../Sparkling/loops-infinite-2.sparkling | 3 + .../Sparkling/loops-infinite-3.sparkling | 3 + .../Loops-Infinite/Swift/loops-infinite.swift | 3 + Task/Loops-Infinite/Ursa/loops-infinite.ursa | 3 + Task/Loops-Infinite/Wart/loops-infinite.wart | 2 + Task/Loops-Infinite/jq/loops-infinite.jq | 1 + .../Axe/loops-n-plus-one-half.axe | 8 + .../ERRE/loops-n-plus-one-half.erre | 5 + .../EchoLisp/loops-n-plus-one-half.echolisp | 9 + .../FreeBASIC/loops-n-plus-one-half.freebasic | 9 + .../loops-n-plus-one-half.futurebasic | 9 + .../Lasso/loops-n-plus-one-half.lasso | 7 + .../LiveCode/loops-n-plus-one-half.livecode | 5 + .../Nim/loops-n-plus-one-half.nim | 7 + .../Oforth/loops-n-plus-one-half.oforth | 3 + .../Panda/loops-n-plus-one-half.panda | 1 + .../Peloton/loops-n-plus-one-half.peloton | 1 + .../Phix/loops-n-plus-one-half.phix | 5 + .../Ring/loops-n-plus-one-half.ring | 1 + .../Sidef/loops-n-plus-one-half.sidef | 7 + .../Swift/loops-n-plus-one-half-1.swift | 8 + .../Swift/loops-n-plus-one-half-2.swift | 4 + .../Swift/loops-n-plus-one-half-3.swift | 8 + .../Ursa/loops-n-plus-one-half.ursa | 9 + .../Wart/loops-n-plus-one-half.wart | 5 + .../jq/loops-n-plus-one-half.jq | 9 + Task/Loops-Nested/ERRE/loops-nested.erre | 18 + .../EchoLisp/loops-nested.echolisp | 8 + .../FreeBASIC/loops-nested.freebasic | 22 + Task/Loops-Nested/Lasso/loops-nested.lasso | 21 + Task/Loops-Nested/Lingo/loops-nested.lingo | 18 + .../LiveCode/loops-nested.livecode | 21 + Task/Loops-Nested/Nim/loops-nested.nim | 24 + Task/Loops-Nested/Phix/loops-nested-1.phix | 14 + Task/Loops-Nested/Phix/loops-nested-2.phix | 12 + Task/Loops-Nested/Phix/loops-nested-3.phix | 10 + Task/Loops-Nested/Ring/loops-nested.ring | 23 + Task/Loops-Nested/Sidef/loops-nested.sidef | 11 + Task/Loops-Nested/Swift/loops-nested.swift | 9 + Task/Loops-While/Axe/loops-while.axe | 5 + Task/Loops-While/ChucK/loops-while.chuck | 7 + Task/Loops-While/ERRE/loops-while.erre | 5 + .../Loops-While/EchoLisp/loops-while.echolisp | 3 + .../FreeBASIC/loops-while.freebasic | 10 + .../FutureBasic/loops-while.futurebasic | 8 + Task/Loops-While/Lasso/loops-while.lasso | 5 + Task/Loops-While/Lingo/loops-while.lingo | 5 + .../Loops-While/LiveCode/loops-while.livecode | 5 + Task/Loops-While/Monte/loops-while.monte | 4 + Task/Loops-While/Morfa/loops-while.morfa | 8 + Task/Loops-While/Nim/loops-while.nim | 4 + Task/Loops-While/Oforth/loops-while.oforth | 1 + Task/Loops-While/PHL/loops-while.phl | 5 + Task/Loops-While/Panda/loops-while.panda | 2 + .../PeopleCode/loops-while.peoplecode | 9 + Task/Loops-While/Phix/loops-while.phix | 5 + Task/Loops-While/Ring/loops-while.ring | 5 + Task/Loops-While/Sidef/loops-while.sidef | 5 + .../Sparkling/loops-while.sparkling | 5 + Task/Loops-While/Swift/loops-while.swift | 5 + Task/Loops-While/Uniface/loops-while.uniface | 9 + Task/Loops-While/Ursa/loops-while.ursa | 7 + Task/Loops-While/Wart/loops-while.wart | 4 + Task/Loops-While/XLISP/loops-while.xlisp | 5 + Task/Loops-While/jq/loops-while-1.jq | 2 + Task/Loops-While/jq/loops-while-2.jq | 1 + Task/Loops-While/jq/loops-while-3.jq | 2 + Task/Loops-While/jq/loops-while-4.jq | 3 + Task/Loops-While/jq/loops-while-5.jq | 1 + .../ERRE/lucas-lehmer-test.erre | 24 + .../EchoLisp/lucas-lehmer-test.echolisp | 19 + .../FreeBASIC/lucas-lehmer-test-1.freebasic | 53 ++ .../FreeBASIC/lucas-lehmer-test-2.freebasic | 82 +++ .../FunL/lucas-lehmer-test.funl | 15 + .../Nim/lucas-lehmer-test.nim | 24 + .../RPL/lucas-lehmer-test.rpl | 7 + .../Ring/lucas-lehmer-test.ring | 16 + .../Sidef/lucas-lehmer-test.sidef | 16 + .../FreeBASIC/ludic-numbers.freebasic | 106 +++ .../Ludic-numbers/Oforth/ludic-numbers.oforth | 23 + Task/Ludic-numbers/Sidef/ludic-numbers.sidef | 24 + .../luhn-test-of-credit-card-numbers.ceylon | 27 + .../luhn-test-of-credit-card-numbers.echolisp | 16 + ...luhn-test-of-credit-card-numbers.freebasic | 58 ++ .../luhn-test-of-credit-card-numbers.funl | 12 + .../luhn-test-of-credit-card-numbers.lasso | 24 + .../luhn-test-of-credit-card-numbers.livecode | 24 + .../Nim/luhn-test-of-credit-card-numbers.nim | 12 + .../luhn-test-of-credit-card-numbers.oforth | 8 + .../luhn-test-of-credit-card-numbers.phix | 17 + .../luhn-test-of-credit-card-numbers.ring | 19 + .../luhn-test-of-credit-card-numbers.sidef | 14 + .../luhn-test-of-credit-card-numbers.swift | 12 + .../luhn-test-of-credit-card-numbers.xojo | 35 + .../jq/luhn-test-of-credit-card-numbers-1.jq | 12 + .../jq/luhn-test-of-credit-card-numbers-2.jq | 5 + Task/MD4/FreeBASIC/md4.freebasic | 152 ++++ Task/MD4/Lasso/md4.lasso | 1 + Task/MD4/Nim/md4.nim | 13 + Task/MD4/Sidef/md4.sidef | 2 + .../FreeBASIC/md5-implementation.freebasic | 150 ++++ .../Phix/md5-implementation.phix | 143 ++++ .../Sidef/md5-implementation.sidef | 109 +++ .../Swift/md5-implementation-1.swift | 126 ++++ .../Swift/md5-implementation-2.swift | 83 +++ Task/MD5/8th/md5.8th | 2 + Task/MD5/Futhark/md5.futhark | 75 ++ Task/MD5/Lasso/md5-1.lasso | 2 + Task/MD5/Lasso/md5-2.lasso | 12 + Task/MD5/Lingo/md5-1.lingo | 1 + Task/MD5/Lingo/md5-2.lingo | 282 ++++++++ Task/MD5/LiveCode/md5-1.livecode | 6 + Task/MD5/LiveCode/md5-2.livecode | 24 + Task/MD5/Nim/md5.nim | 3 + Task/MD5/Ring/md5.ring | 2 + Task/MD5/Sidef/md5-1.sidef | 2 + Task/MD5/Sidef/md5-2.sidef | 3 + Task/Machine-code/Nim/machine-code.nim | 29 + Task/Machine-code/Phix/machine-code-1.phix | 5 + Task/Machine-code/Phix/machine-code-2.phix | 12 + Task/Mad-Libs/Nim/mad-libs.nim | 16 + Task/Mad-Libs/Oforth/mad-libs.oforth | 11 + Task/Mad-Libs/Ring/mad-libs.ring | 13 + Task/Mad-Libs/Sidef/mad-libs.sidef | 13 + .../ERRE/magic-squares-of-odd-order.erre | 93 +++ .../magic-squares-of-odd-order.echolisp | 31 + .../magic-squares-of-odd-order.freebasic | 94 +++ .../Nim/magic-squares-of-odd-order.nim | 24 + .../Oforth/magic-squares-of-odd-order.oforth | 12 + .../Ring/magic-squares-of-odd-order.ring | 10 + .../Sidef/magic-squares-of-odd-order.sidef | 32 + .../jq/magic-squares-of-odd-order-1.jq | 15 + .../jq/magic-squares-of-odd-order-2.jq | 9 + .../jq/magic-squares-of-odd-order-3.jq | 21 + .../Nim/main-step-of-gost-28147-89.nim | 23 + .../ERRE/make-directory-path.erre | 1 + .../Ring/make-directory-path.ring | 11 + .../Sidef/make-directory-path.sidef | 1 + .../Crystal/man-or-boy-test.crystal | 7 + .../EchoLisp/man-or-boy-test.echolisp | 16 + Task/Man-or-boy-test/Nim/man-or-boy-test.nim | 11 + .../Sidef/man-or-boy-test-1.sidef | 5 + .../Sidef/man-or-boy-test-2.sidef | 5 + .../Sidef/man-or-boy-test-3.sidef | 9 + .../Sparkling/man-or-boy-test.sparkling | 16 + .../Swift/man-or-boy-test-1.swift | 14 + .../Swift/man-or-boy-test-2.swift | 14 + Task/Mandelbrot-set/ERRE/mandelbrot-set.erre | 36 + .../EchoLisp/mandelbrot-set.echolisp | 11 + .../Futhark/mandelbrot-set.futhark | 40 ++ Task/Mandelbrot-set/GLSL/mandelbrot-set.glsl | 32 + .../Mandelbrot-set/Lasso/mandelbrot-set.lasso | 51 ++ Task/Mandelbrot-set/Nim/mandelbrot-set.nim | 20 + .../Mandelbrot-set/Phix/mandelbrot-set-1.phix | 25 + .../Mandelbrot-set/Phix/mandelbrot-set-2.phix | 241 +++++++ Task/Mandelbrot-set/Ring/mandelbrot-set.ring | 53 ++ .../SequenceL/mandelbrot-set-1.sequencel | 88 +++ .../SequenceL/mandelbrot-set-2.sequencel | 103 +++ .../Mandelbrot-set/Sidef/mandelbrot-set.sidef | 14 + Task/Mandelbrot-set/jq/mandelbrot-set-1.jq | 14 + Task/Mandelbrot-set/jq/mandelbrot-set-2.jq | 40 ++ Task/Mandelbrot-set/jq/mandelbrot-set-3.jq | 1 + Task/Map-range/ERRE/map-range.erre | 11 + Task/Map-range/EchoLisp/map-range.echolisp | 30 + Task/Map-range/Lasso/map-range.lasso | 15 + Task/Map-range/Nim/map-range.nim | 10 + Task/Map-range/Oforth/map-range.oforth | 3 + Task/Map-range/Phix/map-range.phix | 7 + Task/Map-range/Sidef/map-range.sidef | 11 + Task/Map-range/jq/map-range-1.jq | 5 + Task/Map-range/jq/map-range-2.jq | 1 + Task/Map-range/jq/map-range-3.jq | 5 + .../EchoLisp/matrix-arithmetic.echolisp | 27 + .../FunL/matrix-arithmetic-1.funl | 5 + .../FunL/matrix-arithmetic-2.funl | 7 + .../FunL/matrix-arithmetic-3.funl | 18 + .../Nim/matrix-arithmetic.nim | 37 + .../SPAD/matrix-arithmetic.spad | 16 + .../jq/matrix-arithmetic-1.jq | 18 + .../jq/matrix-arithmetic-2.jq | 22 + .../jq/matrix-arithmetic-3.jq | 11 + .../jq/matrix-arithmetic-4.jq | 8 + .../jq/matrix-arithmetic-5.jq | 1 + .../ERRE/matrix-exponentiation-operator.erre | 53 ++ .../SPAD/matrix-exponentiation-operator.spad | 24 + .../jq/matrix-exponentiation-operator-1.jq | 24 + .../jq/matrix-exponentiation-operator-2.jq | 10 + .../jq/matrix-exponentiation-operator-3.jq | 5 + .../jq/matrix-exponentiation-operator-4.jq | 5 + .../ERRE/matrix-multiplication.erre | 37 + .../Futhark/matrix-multiplication.futhark | 4 + .../Idris/matrix-multiplication.idris | 14 + .../LFE/matrix-multiplication-1.lfe | 7 + .../LFE/matrix-multiplication-2.lfe | 9 + .../Nim/matrix-multiplication.nim | 31 + .../Phix/matrix-multiplication.phix | 16 + .../Ring/matrix-multiplication.ring | 18 + .../SPAD/matrix-multiplication.spad | 26 + .../matrix-multiplication-1.sequencel | 12 + .../matrix-multiplication-2.sequencel | 1 + .../Sidef/matrix-multiplication.sidef | 27 + .../matrix-multiplication.visual | 42 ++ .../jq/matrix-multiplication.jq | 18 + .../EchoLisp/matrix-transposition.echolisp | 10 + .../Idris/matrix-transposition.idris | 2 + .../LFE/matrix-transposition-1.lfe | 13 + .../LFE/matrix-transposition-2.lfe | 8 + .../Nim/matrix-transposition-1.nim | 13 + .../Nim/matrix-transposition-2.nim | 11 + .../Phix/matrix-transposition.phix | 9 + .../Ring/matrix-transposition.ring | 10 + .../SPAD/matrix-transposition.spad | 24 + .../Sidef/matrix-transposition.sidef | 15 + .../Sparkling/matrix-transposition.sparkling | 7 + .../Wortel/matrix-transposition.wortel | 1 + .../jq/matrix-transposition.jq | 4 + .../ERRE/maximum-triangle-path-sum.erre | 56 ++ .../maximum-triangle-path-sum.freebasic | 61 ++ .../Nim/maximum-triangle-path-sum.nim | 30 + .../Sidef/maximum-triangle-path-sum-1.sidef | 12 + .../Sidef/maximum-triangle-path-sum-2.sidef | 8 + .../jq/maximum-triangle-path-sum.jq | 12 + Task/Maze-generation/Elm/maze-generation.elm | 249 +++++++ .../FreeBASIC/maze-generation.freebasic | 130 ++++ Task/Maze-generation/Nim/maze-generation.nim | 37 + .../Sidef/maze-generation.sidef | 33 + .../Swift/maze-generation.swift | 109 +++ .../Axe/memory-allocation.axe | 2 + .../Lingo/memory-allocation.lingo | 6 + .../Nim/memory-allocation.nim | 7 + .../Phix/memory-allocation.phix | 5 + .../Ring/memory-allocation.ring | 2 + ...emory-layout-of-a-data-structure.freebasic | 17 + .../Nim/memory-layout-of-a-data-structure.nim | 19 + Task/Menu/Axe/menu.axe | 15 + Task/Menu/Ceylon/menu.ceylon | 22 + Task/Menu/ERRE/menu.erre | 16 + Task/Menu/Nim/menu.nim | 22 + Task/Menu/Phix/menu.phix | 23 + Task/Menu/Ring/menu.ring | 19 + Task/Menu/Sidef/menu.sidef | 17 + Task/Menu/Ursa/menu.ursa | 37 + Task/Menu/jq/menu-1.jq | 19 + Task/Menu/jq/menu-2.jq | 1 + Task/Menu/jq/menu-3.jq | 16 + .../FreeBASIC/metaprogramming.freebasic | 16 + .../Lingo/metaprogramming.lingo | 3 + .../Metaprogramming/Nim/metaprogramming-1.nim | 11 + .../Metaprogramming/Nim/metaprogramming-2.nim | 6 + .../Metaprogramming/Nim/metaprogramming-3.nim | 2 + .../Metaprogramming/Nim/metaprogramming-4.nim | 1 + .../Metaprogramming/Nim/metaprogramming-5.nim | 14 + .../Metaprogramming/Nim/metaprogramming-6.nim | 6 + .../Metaprogramming/Nim/metaprogramming-7.nim | 7 + .../Metaprogramming/Nim/metaprogramming-8.nim | 15 + .../Metaprogramming/Nim/metaprogramming-9.nim | 13 + .../Ring/metaprogramming-1.ring | 5 + .../Ring/metaprogramming-2.ring | 44 ++ .../Shen/metaprogramming-1.shen | 8 + .../Shen/metaprogramming-2.shen | 7 + .../Shen/metaprogramming-3.shen | 14 + .../Sidef/metaprogramming-1.sidef | 7 + .../Sidef/metaprogramming-2.sidef | 20 + .../EchoLisp/metered-concurrency.echolisp | 13 + .../Oforth/metered-concurrency-1.oforth | 10 + .../Oforth/metered-concurrency-2.oforth | 11 + Task/Metronome/EchoLisp/metronome.echolisp | 6 + .../ERRE/middle-three-digits.erre | 44 ++ .../FreeBASIC/middle-three-digits.freebasic | 32 + .../Klong/middle-three-digits.klong | 4 + .../Lasso/middle-three-digits.lasso | 22 + .../Nim/middle-three-digits.nim | 16 + .../Oforth/middle-three-digits.oforth | 6 + .../Ring/middle-three-digits.ring | 10 + .../Sidef/middle-three-digits.sidef | 16 + .../Wart/middle-three-digits.wart | 7 + .../jq/middle-three-digits-1.jq | 10 + .../jq/middle-three-digits-2.jq | 18 + .../EchoLisp/modular-exponentiation.echolisp | 22 + .../Nim/modular-exponentiation.nim | 18 + .../Oforth/modular-exponentiation.oforth | 6 + .../Sidef/modular-exponentiation-1.sidef | 4 + .../Sidef/modular-exponentiation-2.sidef | 8 + Task/Modular-inverse/8th/modular-inverse.8th | 24 + .../Modular-inverse/ERRE/modular-inverse.erre | 26 + .../EchoLisp/modular-inverse.echolisp | 10 + .../Modular-inverse/FunL/modular-inverse.funl | 12 + Task/Modular-inverse/Nim/modular-inverse.nim | 13 + .../Oforth/modular-inverse.oforth | 22 + .../Modular-inverse/Ring/modular-inverse.ring | 18 + .../Sidef/modular-inverse-1.sidef | 1 + .../Sidef/modular-inverse-2.sidef | 13 + .../ERRE/monte-carlo-methods.erre | 24 + .../FreeBASIC/monte-carlo-methods.freebasic | 33 + .../Futhark/monte-carlo-methods.futhark | 46 ++ .../Nim/monte-carlo-methods.nim | 12 + .../Ring/monte-carlo-methods.ring | 12 + .../Swift/monte-carlo-methods.swift | 26 + .../Nim/monty-hall-problem.nim | 37 + .../Phix/monty-hall-problem.phix | 15 + .../SPAD/monty-hall-problem.spad | 6 + .../Sidef/monty-hall-problem.sidef | 21 + Task/Morse-code/EchoLisp/morse-code.echolisp | 25 + .../Morse-code/FreeBASIC/morse-code.freebasic | 76 ++ Task/Morse-code/Phix/morse-code.phix | 97 +++ Task/Morse-code/Ursa/morse-code.ursa | 97 +++ Task/Mouse-position/ERRE/mouse-position.erre | 79 +++ .../EchoLisp/mouse-position.echolisp | 7 + Task/Mouse-position/Elm/mouse-position.elm | 7 + .../Mouse-position/Lingo/mouse-position.lingo | 2 + Task/Mouse-position/Ring/mouse-position.ring | 62 ++ .../Sidef/move-to-front-algorithm-1.sidef | 25 + .../Sidef/move-to-front-algorithm-2.sidef | 36 + .../jq/move-to-front-algorithm-1.jq | 19 + .../jq/move-to-front-algorithm-2.jq | 9 + .../jq/move-to-front-algorithm-3.jq | 4 + Task/Multifactorial/ERRE/multifactorial.erre | 28 + .../FreeBASIC/multifactorial.freebasic | 22 + Task/Multifactorial/FunL/multifactorial.funl | 4 + Task/Multifactorial/Nim/multifactorial.nim | 16 + .../Oforth/multifactorial.oforth | 5 + Task/Multifactorial/Ring/multifactorial.ring | 16 + .../Multifactorial/Sidef/multifactorial.sidef | 7 + .../Wortel/multifactorial.wortel | 10 + Task/Multifactorial/jq/multifactorial-1.jq | 6 + Task/Multifactorial/jq/multifactorial-2.jq | 6 + Task/Multifactorial/jq/multifactorial-3.jq | 1 + Task/Multifactorial/jq/multifactorial-4.jq | 6 + .../multiple-distinct-objects.echolisp | 15 + .../NGS/multiple-distinct-objects-1.ngs | 1 + .../NGS/multiple-distinct-objects-2.ngs | 1 + .../Nim/multiple-distinct-objects-1.nim | 7 + .../Nim/multiple-distinct-objects-2.nim | 6 + .../Nim/multiple-distinct-objects-3.nim | 7 + .../Oforth/multiple-distinct-objects-1.oforth | 1 + .../Oforth/multiple-distinct-objects-2.oforth | 1 + .../Sidef/multiple-distinct-objects-1.sidef | 1 + .../Sidef/multiple-distinct-objects-2.sidef | 1 + .../Swift/multiple-distinct-objects.swift | 9 + .../jq/multiple-distinct-objects.jq | 19 + .../ERRE/multiple-regression.erre | 82 +++ .../Hy/multiple-regression.hy | 13 + .../Axe/multiplication-tables.axe | 18 + .../EchoLisp/multiplication-tables.echolisp | 11 + .../FreeBASIC/multiplication-tables.freebasic | 22 + .../Lasso/multiplication-tables.lasso | 29 + .../Nim/multiplication-tables.nim | 12 + .../Phix/multiplication-tables.phix | 11 + .../Ring/multiplication-tables-1.ring | 11 + .../Ring/multiplication-tables-2.ring | 14 + .../Sidef/multiplication-tables.sidef | 13 + .../EchoLisp/multiplicative-order.echolisp | 32 + .../Multisplit/FreeBASIC/multisplit.freebasic | 74 ++ Task/Multisplit/Nim/multisplit.nim | 19 + Task/Multisplit/Sidef/multisplit.sidef | 9 + Task/Multisplit/jq/multisplit.jq | 47 ++ .../EchoLisp/munching-squares.echolisp | 16 + .../FreeBASIC/munching-squares.freebasic | 21 + .../GLSL/munching-squares.glsl | 43 ++ .../Sidef/munching-squares.sidef | 10 + .../Munching-squares/jq/munching-squares-1.jq | 1 + .../Munching-squares/jq/munching-squares-2.jq | 23 + .../Munching-squares/jq/munching-squares-3.jq | 11 + .../Munching-squares/jq/munching-squares-4.jq | 17 + .../Munching-squares/jq/munching-squares-5.jq | 5 + .../Ceylon/mutual-recursion.ceylon | 14 + .../FreeBASIC/mutual-recursion.freebasic | 33 + .../Idris/mutual-recursion.idris | 9 + .../mutual-recursion.libreoffice | 94 +++ .../Mutual-recursion/Nim/mutual-recursion.nim | 13 + .../Oforth/mutual-recursion.oforth | 12 + .../Phix/mutual-recursion-1.phix | 15 + .../Phix/mutual-recursion-2.phix | 2 + .../Ring/mutual-recursion.ring | 19 + .../Sidef/mutual-recursion.sidef | 9 + .../Swift/mutual-recursion.swift | 16 + .../Mutual-recursion/jq/mutual-recursion-1.jq | 4 + .../Mutual-recursion/jq/mutual-recursion-2.jq | 2 + .../Mutual-recursion/jq/mutual-recursion-3.jq | 4 + .../N-queens-problem/Arc/n-queens-problem.arc | 20 + .../ERRE/n-queens-problem.erre | 84 +++ .../EchoLisp/n-queens-problem.echolisp | 57 ++ .../N-queens-problem/Nim/n-queens-problem.nim | 25 + .../Sparkling/n-queens-problem.sparkling | 54 ++ .../N-queens-problem/jq/n-queens-problem-1.jq | 25 + .../N-queens-problem/jq/n-queens-problem-2.jq | 8 + .../N-queens-problem/jq/n-queens-problem-3.jq | 13 + .../N-queens-problem/jq/n-queens-problem-4.jq | 16 + .../N-queens-problem/jq/n-queens-problem-5.jq | 1 + .../Lasso/named-parameters.lasso | 16 + .../Lingo/named-parameters.lingo | 22 + .../Named-parameters/Nim/named-parameters.nim | 4 + .../Phix/named-parameters.phix | 9 + .../Sidef/named-parameters.sidef | 6 + .../Swift/named-parameters-1.swift | 4 + .../Swift/named-parameters-2.swift | 4 + .../Named-parameters/jq/named-parameters-1.jq | 7 + .../Named-parameters/jq/named-parameters-2.jq | 9 + Task/Narcissist/Sidef/narcissist.sidef | 1 + .../ERRE/narcissistic-decimal-number.erre | 22 + .../narcissistic-decimal-number-1.freebasic | 61 ++ .../narcissistic-decimal-number-2.freebasic | 103 +++ .../FunL/narcissistic-decimal-number.funl | 20 + .../Oforth/narcissistic-decimal-number.oforth | 9 + .../Ring/narcissistic-decimal-number.ring | 20 + .../Sidef/narcissistic-decimal-number.sidef | 11 + .../jq/narcissistic-decimal-number-1.jq | 7 + .../jq/narcissistic-decimal-number-2.jq | 8 + .../jq/narcissistic-decimal-number-3.jq | 8 + .../jq/narcissistic-decimal-number-4.jq | 23 + .../jq/narcissistic-decimal-number-5.jq | 26 + .../Sidef/natural-sorting-1.sidef | 26 + .../Sidef/natural-sorting-2.sidef | 74 ++ Task/Natural-sorting/jq/natural-sorting-1.jq | 58 ++ Task/Natural-sorting/jq/natural-sorting-2.jq | 1 + Task/Natural-sorting/jq/natural-sorting-3.jq | 51 ++ .../Nim/non-continuous-subsequences.nim | 19 + .../Sidef/non-continuous-subsequences.sidef | 18 + .../jq/non-continuous-subsequences-1.jq | 16 + .../jq/non-continuous-subsequences-2.jq | 3 + .../non-decimal-radices-convert.freebasic | 56 ++ .../FunL/non-decimal-radices-convert-1.funl | 1 + .../FunL/non-decimal-radices-convert-2.funl | 1 + .../LFE/non-decimal-radices-convert.lfe | 12 + .../Nim/non-decimal-radices-convert.nim | 33 + .../Phix/non-decimal-radices-convert.phix | 37 + .../Sidef/non-decimal-radices-convert-1.sidef | 2 + .../Sidef/non-decimal-radices-convert-2.sidef | 20 + .../Swift/non-decimal-radices-convert-1.swift | 1 + .../Swift/non-decimal-radices-convert-2.swift | 6 + .../jq/non-decimal-radices-convert-1.jq | 22 + .../jq/non-decimal-radices-convert-2.jq | 3 + .../non-decimal-radices-input.freebasic | 8 + .../Nim/non-decimal-radices-input.nim | 9 + .../Phix/non-decimal-radices-input.phix | 6 + .../Ring/non-decimal-radices-input.ring | 3 + .../Sidef/non-decimal-radices-input.sidef | 15 + .../non-decimal-radices-output.freebasic | 10 + .../Nim/non-decimal-radices-output.nim | 4 + .../Phix/non-decimal-radices-output.phix | 3 + .../Sidef/non-decimal-radices-output.sidef | 3 + .../Nth-root/FutureBasic/nth-root.futurebasic | 22 + Task/Nth-root/Lingo/nth-root-1.lingo | 3 + Task/Nth-root/Lingo/nth-root-2.lingo | 3 + Task/Nth-root/Nim/nth-root.nim | 13 + Task/Nth-root/Oforth/nth-root.oforth | 2 + Task/Nth-root/Ring/nth-root.ring | 12 + Task/Nth-root/Sidef/nth-root-1.sidef | 11 + Task/Nth-root/Sidef/nth-root-2.sidef | 6 + Task/Nth-root/jq/nth-root-1.jq | 31 + Task/Nth-root/jq/nth-root-2.jq | 10 + Task/Nth-root/jq/nth-root-3.jq | 11 + Task/Nth/ERRE/nth.erre | 23 + Task/Nth/FreeBASIC/nth.freebasic | 39 ++ Task/Nth/Nim/nth.nim | 9 + Task/Nth/Oforth/nth.oforth | 7 + Task/Nth/Ring/nth.ring | 15 + Task/Nth/Set-lang/nth.set | 21 + Task/Nth/Sidef/nth.sidef | 8 + Task/Nth/Swift/nth.swift | 29 + Task/Nth/XLISP/nth.xlisp | 20 + Task/Nth/jq/nth.jq | 17 + Task/Null-object/8th/null-object.8th | 1 + Task/Null-object/Axe/null-object.axe | 3 + .../Null-object/EchoLisp/null-object.echolisp | 15 + .../FreeBASIC/null-object.freebasic | 20 + Task/Null-object/Lasso/null-object.lasso | 18 + Task/Null-object/Lily/null-object.lily | 21 + Task/Null-object/Lingo/null-object.lingo | 12 + Task/Null-object/Nim/null-object.nim | 3 + Task/Null-object/Oforth/null-object.oforth | 3 + Task/Null-object/PHL/null-object.phl | 1 + Task/Null-object/Phix/null-object.phix | 17 + Task/Null-object/Ring/null-object.ring | 5 + Task/Null-object/Sidef/null-object-1.sidef | 3 + Task/Null-object/Sidef/null-object-2.sidef | 3 + Task/Null-object/Swift/null-object-1.swift | 2 + Task/Null-object/Swift/null-object-2.swift | 5 + Task/Null-object/Ursa/null-object.ursa | 9 + Task/Null-object/Wart/null-object.wart | 1 + Task/Null-object/jq/null-object.jq | 11 + Task/Number-names/Nim/number-names.nim | 74 ++ Task/Number-names/Phix/number-names.phix | 104 +++ Task/Number-names/Ring/number-names.ring | 75 ++ .../SequenceL/number-names.sequencel | 61 ++ Task/Number-names/Sidef/number-names.sidef | 2 + Task/Number-names/jq/number-names-1.jq | 61 ++ Task/Number-names/jq/number-names-2.jq | 16 + .../Nim/number-reversal-game.nim | 41 ++ .../Oforth/number-reversal-game.oforth | 16 + .../Phix/number-reversal-game.phix | 22 + .../Sidef/number-reversal-game.sidef | 11 + ...ntegration-gauss-legendre-quadrature.sidef | 58 ++ .../FreeBASIC/numerical-integration.freebasic | 125 ++++ .../Nim/numerical-integration.nim | 45 ++ .../Phix/numerical-integration.phix | 74 ++ .../SequenceL/numerical-integration.sequencel | 60 ++ .../Sidef/numerical-integration.sidef | 54 ++ .../EchoLisp/object-serialization-1.echolisp | 31 + .../EchoLisp/object-serialization-2.echolisp | 28 + .../EchoLisp/odd-word-problem-1.echolisp | 30 + .../EchoLisp/odd-word-problem-2.echolisp | 5 + .../Lasso/odd-word-problem.lasso | 54 ++ .../Odd-word-problem/Nim/odd-word-problem.nim | 28 + .../Sidef/odd-word-problem.sidef | 24 + .../Nim/old-lady-swallowed-a-fly.nim | 17 + .../Phix/old-lady-swallowed-a-fly.phix | 27 + .../Sidef/old-lady-swallowed-a-fly.sidef | 28 + .../Ursa/old-lady-swallowed-a-fly.ursa | 26 + .../8th/one-dimensional-cellular-automata.8th | 31 + .../one-dimensional-cellular-automata.ceylon | 45 ++ .../one-dimensional-cellular-automata.erre | 33 + .../Elm/one-dimensional-cellular-automata.elm | 90 +++ .../one-dimensional-cellular-automata.gfa | 113 +++ .../one-dimensional-cellular-automata-1.nim | 68 ++ .../one-dimensional-cellular-automata-2.nim | 26 + .../one-dimensional-cellular-automata.oforth | 11 + .../one-dimensional-cellular-automata-1.phix | 17 + .../one-dimensional-cellular-automata-2.phix | 13 + .../one-dimensional-cellular-automata-1.sidef | 10 + .../one-dimensional-cellular-automata-2.sidef | 33 + .../one-dimensional-cellular-automata-1.wart | 17 + .../one-dimensional-cellular-automata-2.wart | 32 + .../jq/one-dimensional-cellular-automata-1.jq | 22 + .../jq/one-dimensional-cellular-automata-2.jq | 10 + .../ERRE/one-of-n-lines-in-a-file.erre | 23 + .../Nim/one-of-n-lines-in-a-file.nim | 16 + .../Phix/one-of-n-lines-in-a-file.phix | 15 + .../Ring/one-of-n-lines-in-a-file.ring | 14 + .../Sidef/one-of-n-lines-in-a-file.sidef | 17 + .../Swift/one-of-n-lines-in-a-file.swift | 16 + Task/OpenGL/Nim/opengl.nim | 39 ++ Task/OpenGL/Phix/opengl-1.phix | 35 + Task/OpenGL/Phix/opengl-2.phix | 57 ++ .../Ring/operator-precedence.ring | 21 + .../Sidef/operator-precedence.sidef | 1 + .../Lasso/optional-parameters.lasso | 33 + .../Nim/optional-parameters.nim | 22 + .../Phix/optional-parameters-1.phix | 6 + .../Phix/optional-parameters-2.phix | 1 + .../Phix/optional-parameters-3.phix | 22 + .../Sidef/optional-parameters-1.sidef | 16 + .../Sidef/optional-parameters-2.sidef | 9 + .../Swift/optional-parameters.swift | 5 + .../jq/optional-parameters-1.jq | 3 + .../jq/optional-parameters-2.jq | 1 + .../jq/optional-parameters-3.jq | 9 + .../jq/optional-parameters-4.jq | 6 + .../order-disjoint-list-items.echolisp | 30 + .../Phix/order-disjoint-list-items.phix | 45 ++ .../Sidef/order-disjoint-list-items.sidef | 18 + .../jq/order-disjoint-list-items-1.jq | 15 + .../jq/order-disjoint-list-items-2.jq | 2 + .../jq/order-disjoint-list-items-3.jq | 2 + .../jq/order-disjoint-list-items-4.jq | 2 + .../jq/order-disjoint-list-items-5.jq | 2 + .../jq/order-disjoint-list-items-6.jq | 2 + .../jq/order-disjoint-list-items-7.jq | 2 + .../jq/order-disjoint-list-items-8.jq | 2 + .../jq/order-disjoint-list-items-9.jq | 2 + .../Lasso/order-two-numerical-lists.lasso | 11 + .../Nim/order-two-numerical-lists.nim | 7 + .../Ring/order-two-numerical-lists.ring | 19 + .../Sidef/order-two-numerical-lists.sidef | 14 + .../Swift/order-two-numerical-lists.swift | 3 + .../Wart/order-two-numerical-lists.wart | 9 + .../jq/order-two-numerical-lists.jq | 3 + .../EchoLisp/ordered-partitions.echolisp | 25 + .../Sidef/ordered-partitions.sidef | 20 + .../jq/ordered-partitions-1.jq | 20 + .../jq/ordered-partitions-2.jq | 3 + .../jq/ordered-partitions-3.jq | 23 + .../EchoLisp/ordered-words.echolisp | 26 + .../FreeBASIC/ordered-words.freebasic | 42 ++ Task/Ordered-words/Lasso/ordered-words.lasso | 18 + Task/Ordered-words/Lingo/ordered-words.lingo | 27 + Task/Ordered-words/Nim/ordered-words.nim | 21 + .../Ordered-words/Oforth/ordered-words.oforth | 9 + Task/Ordered-words/Phix/ordered-words.phix | 34 + Task/Ordered-words/Ring/ordered-words.ring | 37 + Task/Ordered-words/Sidef/ordered-words.sidef | 14 + Task/Ordered-words/Swift/ordered-words.swift | 28 + Task/Ordered-words/jq/ordered-words.jq | 14 + .../EchoLisp/palindrome-detection.echolisp | 8 + .../Elm/palindrome-detection.elm | 45 ++ .../FreeBASIC/palindrome-detection.freebasic | 76 ++ .../Lasso/palindrome-detection.lasso | 16 + .../LiveCode/palindrome-detection.livecode | 16 + .../Nim/palindrome-detection.nim | 9 + .../Oforth/palindrome-detection.oforth | 1 + .../Phix/palindrome-detection.phix | 5 + .../Potion/palindrome-detection.potion | 11 + .../Ring/palindrome-detection.ring | 8 + .../palindrome-detection-1.sequencel | 3 + .../palindrome-detection-2.sequencel | 5 + .../Sidef/palindrome-detection-1.sidef | 1 + .../Sidef/palindrome-detection-2.sidef | 3 + .../Sidef/palindrome-detection-3.sidef | 11 + .../Swift/palindrome-detection-1.swift | 19 + .../Swift/palindrome-detection-2.swift | 5 + .../Wortel/palindrome-detection.wortel | 13 + .../jq/palindrome-detection.jq | 1 + .../Ceylon/pangram-checker.ceylon | 17 + .../FreeBASIC/pangram-checker.freebasic | 27 + Task/Pangram-checker/Nim/pangram-checker.nim | 8 + .../Pangram-checker/Ring/pangram-checker.ring | 15 + .../Sidef/pangram-checker.sidef | 14 + .../Swift/pangram-checker-1.swift | 16 + .../Swift/pangram-checker-2.swift | 4 + Task/Pangram-checker/jq/pangram-checker.jq | 11 + Task/Paraffins/Nim/paraffins.nim | 41 ++ Task/Paraffins/jq/paraffins-1.jq | 65 ++ Task/Paraffins/jq/paraffins-2.jq | 7 + .../Oforth/parallel-calculations.oforth | 3 + .../parallel-calculations-1.sequencel | 13 + .../parallel-calculations-2.sequencel | 1 + .../Sidef/parallel-calculations.sidef | 5 + .../Ceylon/parametric-polymorphism.ceylon | 31 + .../Nim/parametric-polymorphism.nim | 3 + .../Swift/parametric-polymorphism-1.swift | 11 + .../Swift/parametric-polymorphism-2.swift | 11 + .../8th/parametrized-sql-statement.8th | 13 + .../parsing-rpn-calculator-algorithm.ceylon | 44 ++ .../parsing-rpn-calculator-algorithm.echolisp | 28 + .../parsing-rpn-calculator-algorithm.funl | 19 + .../Nim/parsing-rpn-calculator-algorithm.nim | 72 ++ .../parsing-rpn-calculator-algorithm-1.oforth | 1 + .../parsing-rpn-calculator-algorithm-2.oforth | 3 + .../parsing-rpn-calculator-algorithm.phix | 17 + .../parsing-rpn-calculator-algorithm.sidef | 33 + .../parsing-rpn-calculator-algorithm.swift | 58 ++ .../parsing-rpn-to-infix-conversion.echolisp | 60 ++ .../Nim/parsing-rpn-to-infix-conversion.nim | 45 ++ .../Phix/parsing-rpn-to-infix-conversion.phix | 71 ++ .../parsing-rpn-to-infix-conversion.sidef | 32 + .../parsing-shunting-yard-algorithm.ceylon | 106 +++ .../parsing-shunting-yard-algorithm.echolisp | 52 ++ .../Phix/parsing-shunting-yard-algorithm.phix | 82 +++ .../parsing-shunting-yard-algorithm.sidef | 50 ++ .../parsing-shunting-yard-algorithm.swift | 175 +++++ .../partial-function-application.ceylon | 17 + .../partial-function-application-1.egison | 12 + .../partial-function-application-2.egison | 4 + .../FunL/partial-function-application.funl | 11 + .../LFE/partial-function-application-1.lfe | 20 + .../LFE/partial-function-application-2.lfe | 17 + .../partial-function-application.oforth | 6 + .../Sidef/partial-function-application.sidef | 19 + .../Nim/pascals-triangle-puzzle.nim | 66 ++ .../Sidef/pascals-triangle-puzzle.sidef | 47 ++ .../8th/pascals-triangle-1.8th | 15 + .../8th/pascals-triangle-2.8th | 21 + .../ERRE/pascals-triangle.erre | 17 + .../FreeBASIC/pascals-triangle.freebasic | 37 + .../FunL/pascals-triangle-1.funl | 5 + .../FunL/pascals-triangle-2.funl | 3 + .../FunL/pascals-triangle-3.funl | 11 + .../Pascals-triangle/Nim/pascals-triangle.nim | 9 + .../Oforth/pascals-triangle.oforth | 1 + .../Phix/pascals-triangle.phix | 12 + .../Potion/pascals-triangle.potion | 18 + .../Ring/pascals-triangle.ring | 10 + .../Sidef/pascals-triangle.sidef | 9 + .../Pascals-triangle/jq/pascals-triangle-1.jq | 11 + .../Pascals-triangle/jq/pascals-triangle-2.jq | 6 + .../Pascals-triangle/jq/pascals-triangle-3.jq | 9 + .../EchoLisp/pattern-matching-1.echolisp | 27 + .../EchoLisp/pattern-matching-2.echolisp | 8 + .../Swift/pattern-matching.swift | 37 + ...percentage-difference-between-images.sidef | 38 + .../percolation-mean-cluster-density.echolisp | 37 + .../percolation-mean-run-density.echolisp | 22 + .../Sidef/percolation-mean-run-density.sidef | 13 + .../Perfect-numbers/ERRE/perfect-numbers.erre | 19 + .../FreeBASIC/perfect-numbers.freebasic | 24 + .../Perfect-numbers/FunL/perfect-numbers.funl | 3 + .../Lasso/perfect-numbers-1.lasso | 15 + .../Lasso/perfect-numbers-2.lasso | 1 + .../Lingo/perfect-numbers.lingo | 8 + Task/Perfect-numbers/Nim/perfect-numbers.nim | 12 + .../Oforth/perfect-numbers.oforth | 1 + .../Perfect-numbers/Phix/perfect-numbers.phix | 7 + .../Perfect-numbers/Ring/perfect-numbers.ring | 11 + .../Sidef/perfect-numbers-1.sidef | 11 + .../Sidef/perfect-numbers-2.sidef | 14 + .../Swift/perfect-numbers.swift | 15 + Task/Perfect-numbers/jq/perfect-numbers.jq | 7 + .../Sidef/permutation-test.sidef | 20 + .../Permutation-test/jq/permutation-test-1.jq | 7 + .../Permutation-test/jq/permutation-test-2.jq | 26 + .../Permutation-test/jq/permutation-test-3.jq | 5 + .../permutations-derangements-1.echolisp | 19 + .../permutations-derangements-2.echolisp | 20 + .../jq/permutations-derangements-1.jq | 24 + .../jq/permutations-derangements-2.jq | 7 + .../jq/permutations-derangements-3.jq | 26 + .../permutations-by-swapping.echolisp | 29 + .../Nim/permutations-by-swapping.nim | 34 + .../Sidef/permutations-by-swapping.sidef | 22 + .../jq/permutations-by-swapping-1.jq | 45 ++ .../jq/permutations-by-swapping-2.jq | 2 + .../jq/permutations-by-swapping-3.jq | 9 + Task/Permutations/LFE/permutations-1.lfe | 7 + Task/Permutations/LFE/permutations-2.lfe | 2 + Task/Permutations/Nim/permutations.nim | 28 + Task/Permutations/Phix/permutations-1.phix | 17 + Task/Permutations/Phix/permutations-2.phix | 8 + Task/Permutations/Ring/permutations.ring | 35 + Task/Permutations/Sidef/permutations-1.sidef | 3 + Task/Permutations/Sidef/permutations-2.sidef | 21 + Task/Permutations/Sidef/permutations-3.sidef | 11 + Task/Permutations/Swift/permutations.swift | 15 + Task/Permutations/jq/permutations.jq | 6 + .../EchoLisp/pernicious-numbers.echolisp | 10 + .../FreeBASIC/pernicious-numbers.freebasic | 57 ++ .../Nim/pernicious-numbers.nim | 30 + .../Panda/pernicious-numbers.panda | 7 + .../Sidef/pernicious-numbers.sidef | 21 + .../Symsyn/pernicious-numbers.symsyn | 74 ++ .../Wortel/pernicious-numbers-1.wortel | 1 + .../Wortel/pernicious-numbers-2.wortel | 2 + .../jq/pernicious-numbers.jq | 37 + .../EchoLisp/phrase-reversals.echolisp | 14 + .../FreeBASIC/phrase-reversals.freebasic | 64 ++ .../Oforth/phrase-reversals.oforth | 3 + .../Phix/phrase-reversals.phix | 8 + .../Ring/phrase-reversals.ring | 9 + .../Sidef/phrase-reversals.sidef | 5 + Task/Phrase-reversals/jq/phrase-reversals.jq | 8 + Task/Pi/FunL/pi.funl | 20 + Task/Pi/FutureBasic/pi.futurebasic | 169 +++++ Task/Pi/Lasso/pi.lasso | 31 + Task/Pi/Nim/pi.nim | 50 ++ Task/Pi/Oforth/pi.oforth | 20 + Task/Pi/Phix/pi.phix | 5 + Task/Pi/Sidef/pi.sidef | 26 + Task/Pi/jq/pi-1.jq | 59 ++ Task/Pi/jq/pi-2.jq | 305 ++++++++ .../Ceylon/pick-random-element.ceylon | 10 + .../EchoLisp/pick-random-element.echolisp | 4 + .../FreeBASIC/pick-random-element.freebasic | 12 + .../Lasso/pick-random-element.lasso | 5 + .../LiveCode/pick-random-element.livecode | 2 + .../Nim/pick-random-element.nim | 14 + .../Oforth/pick-random-element.oforth | 1 + .../Phix/pick-random-element.phix | 2 + .../Ring/pick-random-element.ring | 7 + .../Sidef/pick-random-element.sidef | 3 + .../Swift/pick-random-element.swift | 4 + .../Ursa/pick-random-element.ursa | 6 + .../Sidef/pig-the-dice-game-player.sidef | 60 ++ .../Ring/play-recorded-sounds.ring | 117 ++++ .../Swift/play-recorded-sounds.swift | 78 +++ .../Playing-cards/Ceylon/playing-cards.ceylon | 81 +++ Task/Playing-cards/Nim/playing-cards.nim | 43 ++ Task/Playing-cards/Ring/playing-cards.ring | 245 +++++++ Task/Playing-cards/Sidef/playing-cards.sidef | 31 + Task/Playing-cards/Swift/playing-cards.swift | 182 +++++ .../EchoLisp/plot-coordinate-pairs.echolisp | 9 + .../Sidef/plot-coordinate-pairs.sidef | 12 + .../jq/plot-coordinate-pairs-1.jq | 1 + .../jq/plot-coordinate-pairs-2.jq | 20 + .../jq/plot-coordinate-pairs-3.jq | 8 + .../EchoLisp/pointers-and-references.echolisp | 13 + .../pointers-and-references.freebasic | 47 ++ .../Nim/pointers-and-references-1.nim | 5 + .../Nim/pointers-and-references-2.nim | 1 + .../Nim/pointers-and-references-3.nim | 4 + .../Nim/pointers-and-references-4.nim | 2 + .../Nim/pointers-and-references-5.nim | 2 + .../Nim/pointers-and-references-6.nim | 2 + .../Nim/pointers-and-references-7.nim | 1 + .../Sidef/pointers-and-references.sidef | 7 + .../EchoLisp/polymorphic-copy.echolisp | 24 + .../Polymorphic-copy/Nim/polymorphic-copy.nim | 37 + .../Sidef/polymorphic-copy.sidef | 22 + .../Swift/polymorphic-copy.swift | 24 + .../EchoLisp/polymorphism.echolisp | 42 ++ Task/Polymorphism/Nim/polymorphism.nim | 35 + .../Polymorphism/Oforth/polymorphism-1.oforth | 14 + .../Polymorphism/Oforth/polymorphism-2.oforth | 9 + Task/Polymorphism/Phix/polymorphism.phix | 24 + Task/Polymorphism/Sidef/polymorphism-1.sidef | 15 + Task/Polymorphism/Sidef/polymorphism-2.sidef | 12 + Task/Polymorphism/Swift/polymorphism.swift | 46 ++ Task/Polymorphism/Wollok/polymorphism.wollok | 43 ++ .../Sidef/polynomial-long-division-1.sidef | 20 + .../Sidef/polynomial-long-division-2.sidef | 22 + .../FreeBASIC/polynomial-regression.freebasic | 78 +++ .../Hy/polynomial-regression.hy | 6 + .../Sidef/polynomial-regression.sidef | 18 + Task/Power-set/EchoLisp/power-set.echolisp | 29 + Task/Power-set/FunL/power-set-1.funl | 1 + Task/Power-set/FunL/power-set-2.funl | 5 + Task/Power-set/FunL/power-set-3.funl | 5 + Task/Power-set/Nim/power-set.nim | 19 + Task/Power-set/Sidef/power-set.sidef | 4 + Task/Power-set/jq/power-set-1.jq | 3 + Task/Power-set/jq/power-set-2.jq | 7 + Task/Power-set/jq/power-set-3.jq | 6 + .../FreeBASIC/price-fraction.freebasic | 40 ++ Task/Price-fraction/Nim/price-fraction.nim | 32 + .../Oforth/price-fraction.oforth | 7 + Task/Price-fraction/Phix/price-fraction.phix | 43 ++ Task/Price-fraction/Ring/price-fraction.ring | 23 + .../Price-fraction/Sidef/price-fraction.sidef | 35 + Task/Price-fraction/jq/price-fraction-1.jq | 5 + Task/Price-fraction/jq/price-fraction-2.jq | 5 + .../ERRE/primality-by-trial-division.erre | 21 + .../primality-by-trial-division.echolisp | 28 + .../primality-by-trial-division.freebasic | 23 + .../FunL/primality-by-trial-division.funl | 9 + .../primality-by-trial-division.futurebasic | 26 + .../Nim/primality-by-trial-division.nim | 29 + .../Oforth/primality-by-trial-division.oforth | 7 + .../Panda/primality-by-trial-division.panda | 4 + .../Phix/primality-by-trial-division.phix | 11 + .../Ring/primality-by-trial-division.ring | 12 + .../Sidef/primality-by-trial-division.sidef | 7 + .../Swift/primality-by-trial-division.swift | 17 + .../prime-decomposition.commodore | 17 + .../ERRE/prime-decomposition.erre | 49 ++ .../EchoLisp/prime-decomposition.echolisp | 10 + .../Ezhil/prime-decomposition.ezhil | 143 ++++ .../FreeBASIC/prime-decomposition.freebasic | 53 ++ .../LFE/prime-decomposition.lfe | 10 + .../Lingo/prime-decomposition-1.lingo | 23 + .../Lingo/prime-decomposition-2.lingo | 11 + .../Nim/prime-decomposition.nim | 47 ++ .../Oforth/prime-decomposition.oforth | 14 + .../Ring/prime-decomposition.ring | 20 + .../SPAD/prime-decomposition.spad | 9 + .../SequenceL/prime-decomposition-1.sequencel | 11 + .../SequenceL/prime-decomposition-2.sequencel | 8 + .../Sidef/prime-decomposition-1.sidef | 4 + .../Sidef/prime-decomposition-2.sidef | 18 + .../Sidef/prime-decomposition-3.sidef | 1 + .../jq/prime-decomposition-1.jq | 14 + .../jq/prime-decomposition-2.jq | 7 + .../EchoLisp/priority-queue.echolisp | 18 + Task/Priority-queue/FunL/priority-queue.funl | 22 + .../Priority-queue/Lasso/priority-queue.lasso | 59 ++ Task/Priority-queue/Nim/priority-queue-1.nim | 60 ++ Task/Priority-queue/Nim/priority-queue-2.nim | 18 + .../Priority-queue/Sidef/priority-queue.sidef | 30 + .../Priority-queue/Swift/priority-queue.swift | 56 ++ Task/Priority-queue/jq/priority-queue-1.jq | 49 ++ Task/Priority-queue/jq/priority-queue-2.jq | 6 + .../ERRE/probabilistic-choice.erre | 35 + .../FreeBASIC/probabilistic-choice.freebasic | 59 ++ .../Nim/probabilistic-choice.nim | 47 ++ .../Phix/probabilistic-choice.phix | 28 + .../Sidef/probabilistic-choice.sidef | 41 ++ .../Lasso/problem-of-apollonius.lasso | 59 ++ .../Nim/problem-of-apollonius.nim | 48 ++ .../Sidef/problem-of-apollonius.sidef | 48 ++ .../Swift/problem-of-apollonius.swift | 72 ++ .../jq/problem-of-apollonius-1.jq | 51 ++ .../jq/problem-of-apollonius-2.jq | 7 + .../jq/problem-of-apollonius-3.jq | 3 + .../EchoLisp/program-name.echolisp | 2 + .../FreeBASIC/program-name.freebasic | 5 + Task/Program-name/Lasso/program-name-1.lasso | 3 + Task/Program-name/Lasso/program-name-2.lasso | 2 + Task/Program-name/Lingo/program-name.lingo | 4 + Task/Program-name/Nim/program-name.nim | 3 + Task/Program-name/Phix/program-name.phix | 1 + Task/Program-name/Ring/program-name-1.ring | 1 + Task/Program-name/Ring/program-name-2.ring | 1 + Task/Program-name/Ring/program-name-3.ring | 6 + Task/Program-name/Sidef/program-name.sidef | 4 + .../Axe/program-termination.axe | 1 + .../FreeBASIC/program-termination.freebasic | 11 + .../Lasso/program-termination-1.lasso | 12 + .../Lasso/program-termination-2.lasso | 12 + .../Nim/program-termination.nim | 2 + .../Oforth/program-termination.oforth | 3 + .../Phix/program-termination-1.phix | 3 + .../Phix/program-termination-2.phix | 3 + .../Ring/program-termination.ring | 4 + .../SSEM/program-termination.ssem | 2 + .../Sidef/program-termination.sidef | 3 + .../Ursa/program-termination.ursa | 1 + .../jq/program-termination-1.jq | 2 + .../jq/program-termination-2.jq | 2 + .../ERRE/pythagorean-triples.erre | 59 ++ .../FreeBASIC/pythagorean-triples-1.freebasic | 90 +++ .../FreeBASIC/pythagorean-triples-2.freebasic | 82 +++ .../Lasso/pythagorean-triples.lasso | 18 + .../Nim/pythagorean-triples.nim | 25 + .../Phix/pythagorean-triples.phix | 20 + .../Ring/pythagorean-triples.ring | 23 + .../Sidef/pythagorean-triples.sidef | 21 + .../Swift/pythagorean-triples.swift | 23 + .../jq/pythagorean-triples-1.jq | 37 + .../jq/pythagorean-triples-2.jq | 9 + .../Quaternion-type/ERRE/quaternion-type.erre | 104 +++ .../Quaternion-type/Eero/quaternion-type.eero | 102 +++ .../Oforth/quaternion-type-1.oforth | 24 + .../Oforth/quaternion-type-2.oforth | 20 + .../Quaternion-type/Phix/quaternion-type.phix | 54 ++ .../Sidef/quaternion-type.sidef | 39 ++ Task/Quaternion-type/jq/quaternion-type-1.jq | 92 +++ Task/Quaternion-type/jq/quaternion-type-2.jq | 17 + .../ERRE/queue-definition.erre | 45 ++ .../EchoLisp/queue-definition.echolisp | 35 + .../Lasso/queue-definition-1.lasso | 21 + .../Lasso/queue-definition-2.lasso | 14 + .../Queue-Definition/Nim/queue-definition.nim | 18 + .../Oforth/queue-definition.oforth | 6 + .../Phix/queue-definition.phix | 15 + .../Sidef/queue-definition.sidef | 13 + .../Wart/queue-definition.wart | 20 + .../XLISP/queue-definition-1.xlisp | 17 + .../XLISP/queue-definition-2.xlisp | 24 + .../Queue-Definition/jq/queue-definition-1.jq | 10 + .../Queue-Definition/jq/queue-definition-2.jq | 13 + Task/Queue-Usage/8th/queue-usage.8th | 7 + Task/Queue-Usage/Lasso/queue-usage.lasso | 20 + Task/Queue-Usage/Nim/queue-usage.nim | 12 + Task/Queue-Usage/Oforth/queue-usage.oforth | 5 + Task/Queue-Usage/Phix/queue-usage.phix | 7 + Task/Queue-Usage/Sidef/queue-usage.sidef | 10 + .../Nim/quickselect-algorithm.nim | 19 + .../Phix/quickselect-algorithm.phix | 41 ++ .../Ring/quickselect-algorithm.ring | 20 + .../Sidef/quickselect-algorithm.sidef | 14 + .../Swift/quickselect-algorithm.swift | 20 + .../jq/quickselect-algorithm-1.jq | 30 + .../jq/quickselect-algorithm-2.jq | 3 + .../jq/quickselect-algorithm-3.jq | 12 + Task/Quine/Ceylon/quine.ceylon | 1 + Task/Quine/Commodore-BASIC/quine.commodore | 31 + Task/Quine/ERRE/quine.erre | 36 + Task/Quine/Free-Pascal/quine.free | 1 + Task/Quine/Hoon/quine-1.hoon | 1 + Task/Quine/Hoon/quine-2.hoon | 1 + Task/Quine/Hoon/quine-3.hoon | 1 + Task/Quine/Lasso/quine.lasso | 7 + Task/Quine/Nim/quine-1.nim | 0 Task/Quine/Nim/quine-2.nim | 2 + Task/Quine/Nim/quine-3.nim | 4 + Task/Quine/Oforth/quine.oforth | 1 + Task/Quine/Phix/quine.phix | 1 + Task/Quine/Ring/quine.ring | 2 + Task/Quine/Sidef/quine-1.sidef | 2 + Task/Quine/Sidef/quine-2.sidef | 3 + Task/Quine/Swift/quine-1.swift | 1 + Task/Quine/Swift/quine-2.swift | 1 + .../RIPEMD-160/FreeBASIC/ripemd-160.freebasic | 180 +++++ Task/RIPEMD-160/Lasso/ripemd-160.lasso | 1 + Task/RIPEMD-160/Swift/ripemd-160-1.swift | 197 ++++++ Task/RIPEMD-160/Swift/ripemd-160-2.swift | 5 + Task/RSA-code/Sidef/rsa-code.sidef | 45 ++ .../random-number-generator--device-.echolisp | 10 + ...random-number-generator--device-.freebasic | 10 + .../random-number-generator--device-.lasso | 1 + .../Nim/random-number-generator--device-.nim | 5 + .../random-number-generator--device-.ring | 4 + .../random-number-generator--device-.sidef | 11 + ...andom-number-generator--included-.echolisp | 7 + .../random-number-generator--included-.ring | 4 + .../random-number-generator--included-.sidef | 2 + Task/Random-numbers/ERRE/random-numbers.erre | 35 + .../Free-Pascal/random-numbers.free | 1 + .../FreeBASIC/random-numbers.freebasic | 36 + .../FutureBasic/random-numbers.futurebasic | 31 + Task/Random-numbers/Nim/random-numbers.nim | 14 + Task/Random-numbers/Phix/random-numbers.phix | 8 + Task/Random-numbers/Ring/random-numbers.ring | 3 + .../Random-numbers/Sidef/random-numbers.sidef | 2 + .../Visual-FoxPro/random-numbers.visual | 26 + Task/Random-numbers/jq/random-numbers-1.jq | 8 + Task/Random-numbers/jq/random-numbers-2.jq | 20 + Task/Random-numbers/jq/random-numbers-3.jq | 6 + Task/Range-expansion/8th/range-expansion.8th | 61 ++ .../EchoLisp/range-expansion.echolisp | 25 + .../FreeBASIC/range-expansion.freebasic | 75 ++ .../Lasso/range-expansion.lasso | 13 + .../Lingo/range-expansion-1.lingo | 21 + .../Lingo/range-expansion-2.lingo | 2 + .../LiveCode/range-expansion-1.livecode | 38 + .../LiveCode/range-expansion-2.livecode | 2 + Task/Range-expansion/Nim/range-expansion.nim | 24 + .../Oforth/range-expansion.oforth | 10 + .../Sidef/range-expansion.sidef | 12 + Task/Range-expansion/jq/range-expansion-1.jq | 11 + Task/Range-expansion/jq/range-expansion-2.jq | 1 + .../Ceylon/range-extraction.ceylon | 44 ++ .../EchoLisp/range-extraction.echolisp | 24 + .../FreeBASIC/range-extraction.freebasic | 46 ++ .../LiveCode/range-extraction-1.livecode | 29 + .../LiveCode/range-extraction-2.livecode | 8 + .../LiveCode/range-extraction-3.livecode | 1 + .../Range-extraction/Nim/range-extraction.nim | 30 + .../Phix/range-extraction.phix | 26 + .../Swift/range-extraction-1.swift | 47 ++ .../Swift/range-extraction-2.swift | 35 + Task/Range-extraction/jq/range-extraction.jq | 20 + .../Sidef/ranking-methods.sidef | 62 ++ .../Visual-FoxPro/ranking-methods.visual | 102 +++ Task/Ranking-methods/jq/ranking-methods-1.jq | 57 ++ Task/Ranking-methods/jq/ranking-methods-2.jq | 19 + Task/Rate-counter/ERRE/rate-counter.erre | 35 + Task/Rate-counter/Sidef/rate-counter.sidef | 11 + .../FreeBASIC/ray-casting-algorithm.freebasic | 114 +++ .../Phix/ray-casting-algorithm.phix | 103 +++ .../read-a-configuration-file-1.echolisp | 15 + .../read-a-configuration-file-2.echolisp | 9 + .../read-a-configuration-file.freebasic | 96 +++ .../Lasso/read-a-configuration-file.lasso | 70 ++ .../Peloton/read-a-configuration-file.peloton | 27 + .../Sidef/read-a-configuration-file.sidef | 27 + .../8th/read-a-file-line-by-line.8th | 1 + .../ERRE/read-a-file-line-by-line.erre | 21 + .../read-a-file-line-by-line.freebasic | 12 + .../Lasso/read-a-file-line-by-line.lasso | 6 + .../Lingo/read-a-file-line-by-line.lingo | 11 + .../read-a-file-line-by-line.livecode | 13 + .../Nim/read-a-file-line-by-line.nim | 2 + .../Oforth/read-a-file-line-by-line.oforth | 2 + .../Phix/read-a-file-line-by-line.phix | 11 + .../Ring/read-a-file-line-by-line.ring | 8 + .../Sidef/read-a-file-line-by-line-1.sidef | 3 + .../Sidef/read-a-file-line-by-line-2.sidef | 4 + .../read-a-file-line-by-line.sparkling | 9 + .../Ursa/read-a-file-line-by-line.ursa | 5 + .../Wart/read-a-file-line-by-line.wart | 2 + .../jq/read-a-file-line-by-line-1.jq | 7 + .../jq/read-a-file-line-by-line-2.jq | 2 + ...read-a-specific-line-from-a-file.freebasic | 25 + ...ad-a-specific-line-from-a-file.futurebasic | 23 + .../read-a-specific-line-from-a-file.lasso | 9 + .../read-a-specific-line-from-a-file.moon | 5 + .../Nim/read-a-specific-line-from-a-file.nim | 9 + .../read-a-specific-line-from-a-file.ring | 12 + .../read-a-specific-line-from-a-file.sidef | 11 + .../read-a-specific-line-from-a-file.ursa | 13 + .../jq/read-a-specific-line-from-a-file-1.jq | 7 + .../jq/read-a-specific-line-from-a-file-2.jq | 4 + .../jq/read-a-specific-line-from-a-file-3.jq | 2 + .../Read-entire-file/8th/read-entire-file.8th | 1 + .../FreeBASIC/read-entire-file.freebasic | 10 + .../FutureBasic/read-entire-file.futurebasic | 27 + .../Read-entire-file/LFE/read-entire-file.lfe | 1 + .../Lasso/read-entire-file.lasso | 2 + .../Lingo/read-entire-file.lingo | 13 + .../LiveCode/read-entire-file-1.livecode | 2 + .../LiveCode/read-entire-file-2.livecode | 6 + .../Read-entire-file/Nim/read-entire-file.nim | 1 + .../Panda/read-entire-file.panda | 1 + .../Phix/read-entire-file.phix | 4 + .../Ring/read-entire-file-1.ring | 4 + .../Ring/read-entire-file-2.ring | 1 + .../Ring/read-entire-file-3.ring | 1 + .../Sidef/read-entire-file-1.sidef | 3 + .../Sidef/read-entire-file-2.sidef | 3 + .../Sparkling/read-entire-file.sparkling | 1 + .../Swift/read-entire-file.swift | 6 + .../Ursa/read-entire-file.ursa | 4 + .../Wart/read-entire-file.wart | 4 + .../Read-entire-file/jq/read-entire-file-1.jq | 1 + .../Read-entire-file/jq/read-entire-file-2.jq | 1 + .../Read-entire-file/jq/read-entire-file-3.jq | 1 + .../Axe/real-constants-and-functions-1.axe | 1 + .../Axe/real-constants-and-functions-2.axe | 1 + .../Axe/real-constants-and-functions-3.axe | 1 + .../Axe/real-constants-and-functions-4.axe | 1 + .../Axe/real-constants-and-functions-5.axe | 1 + .../ERRE/real-constants-and-functions.erre | 28 + .../Elm/real-constants-and-functions.elm | 9 + .../real-constants-and-functions.freebasic | 15 + .../real-constants-and-functions.futurebasic | 15 + .../Lasso/real-constants-and-functions.lasso | 16 + .../Lingo/real-constants-and-functions.lingo | 47 ++ .../real-constants-and-functions.livecode | 9 + .../Nim/real-constants-and-functions.nim | 14 + .../real-constants-and-functions.oforth | 24 + .../Phix/real-constants-and-functions.phix | 15 + .../Ring/real-constants-and-functions.ring | 45 ++ .../Sidef/real-constants-and-functions.sidef | 10 + .../real-constants-and-functions.sparkling | 31 + .../Swift/real-constants-and-functions.swift | 11 + .../jq/real-constants-and-functions.jq | 9 + Task/Record-sound/ChucK/record-sound.chuck | 23 + .../LiveCode/record-sound.livecode | 13 + Task/Record-sound/Nim/record-sound.nim | 12 + .../Phix/reduced-row-echelon-form.phix | 32 + .../Sidef/reduced-row-echelon-form.sidef | 59 ++ .../Swift/reduced-row-echelon-form.swift | 40 ++ .../reduced-row-echelon-form.visual | 90 +++ .../8th/regular-expressions.8th | 2 + .../Lasso/regular-expressions.lasso | 22 + .../Nim/regular-expressions.nim | 9 + .../Sidef/regular-expressions-1.sidef | 4 + .../Sidef/regular-expressions-2.sidef | 8 + .../Sidef/regular-expressions-3.sidef | 12 + .../Swift/regular-expressions-1.swift | 6 + .../Swift/regular-expressions-2.swift | 5 + .../Swift/regular-expressions-3.swift | 8 + .../Swift/regular-expressions-4.swift | 5 + .../Swift/regular-expressions-5.swift | 7 + .../jq/regular-expressions-1.jq | 1 + .../jq/regular-expressions-2.jq | 1 + .../jq/regular-expressions-3.jq | 1 + .../CafeOBJ/remove-duplicate-elements.cafeobj | 21 + .../Ceylon/remove-duplicate-elements.ceylon | 2 + .../ECL/remove-duplicate-elements.ecl | 2 + .../remove-duplicate-elements.freebasic | 39 ++ .../Lasso/remove-duplicate-elements.lasso | 6 + .../Nim/remove-duplicate-elements.nim | 24 + .../Phix/remove-duplicate-elements.phix | 44 ++ .../Ring/remove-duplicate-elements.ring | 11 + .../Sidef/remove-duplicate-elements.sidef | 3 + .../remove-duplicate-elements.sparkling | 13 + .../Swift/remove-duplicate-elements-1.swift | 1 + .../Swift/remove-duplicate-elements-2.swift | 10 + .../Swift/remove-duplicate-elements-3.swift | 12 + .../remove-duplicate-elements.visual | 24 + .../Wart/remove-duplicate-elements.wart | 6 + .../Wortel/remove-duplicate-elements.wortel | 1 + .../jq/remove-duplicate-elements-1.jq | 1 + .../jq/remove-duplicate-elements-2.jq | 24 + .../ECL/remove-lines-from-a-file-1.ecl | 8 + .../ECL/remove-lines-from-a-file-2.ecl | 2 + .../remove-lines-from-a-file.freebasic | 51 ++ .../Lasso/remove-lines-from-a-file-1.lasso | 22 + .../Lasso/remove-lines-from-a-file-2.lasso | 1 + .../Oforth/remove-lines-from-a-file.oforth | 12 + .../Ring/remove-lines-from-a-file.ring | 13 + .../Sidef/remove-lines-from-a-file.sidef | 7 + .../jq/remove-lines-from-a-file-1.jq | 1 + .../jq/remove-lines-from-a-file-2.jq | 15 + .../jq/remove-lines-from-a-file-3.jq | 1 + .../jq/remove-lines-from-a-file-4.jq | 15 + .../FreeBASIC/rename-a-file.freebasic | 14 + .../Harbour/rename-a-file.harbour | 5 + Task/Rename-a-file/LFE/rename-a-file.lfe | 4 + Task/Rename-a-file/Lasso/rename-a-file.lasso | 17 + .../LiveCode/rename-a-file.livecode | 4 + Task/Rename-a-file/Nim/rename-a-file.nim | 7 + Task/Rename-a-file/Ring/rename-a-file.ring | 4 + Task/Rename-a-file/Sidef/rename-a-file.sidef | 7 + .../Rep-string/EchoLisp/rep-string-1.echolisp | 17 + .../Rep-string/EchoLisp/rep-string-2.echolisp | 20 + Task/Rep-string/LFE/rep-string-1.lfe | 13 + Task/Rep-string/LFE/rep-string-2.lfe | 10 + Task/Rep-string/NGS/rep-string.ngs | 22 + Task/Rep-string/Nim/rep-string.nim | 22 + Task/Rep-string/Oforth/rep-string.oforth | 6 + Task/Rep-string/Sidef/rep-string.sidef | 15 + Task/Rep-string/jq/rep-string-1.jq | 20 + Task/Rep-string/jq/rep-string-2.jq | 17 + Task/Rep-string/jq/rep-string-3.jq | 12 + Task/Repeat-a-string/8th/repeat-a-string.8th | 2 + .../Ceylon/repeat-a-string.ceylon | 3 + .../Repeat-a-string/ECL/repeat-a-string-1.ecl | 5 + .../Repeat-a-string/ECL/repeat-a-string-2.ecl | 9 + .../Repeat-a-string/ERRE/repeat-a-string.erre | 7 + .../Egison/repeat-a-string.egison | 1 + .../FreeBASIC/repeat-a-string.freebasic | 29 + .../Harbour/repeat-a-string.harbour | 1 + .../Idris/repeat-a-string.idris | 7 + Task/Repeat-a-string/LFE/repeat-a-string.lfe | 1 + .../Lasso/repeat-a-string-1.lasso | 1 + .../Lasso/repeat-a-string-2.lasso | 1 + .../Lingo/repeat-a-string-1.lingo | 7 + .../Lingo/repeat-a-string-2.lingo | 2 + .../Lingo/repeat-a-string-3.lingo | 2 + .../LiveCode/repeat-a-string.livecode | 10 + .../Monte/repeat-a-string.monte | 2 + Task/Repeat-a-string/Nim/repeat-a-string.nim | 2 + .../Oforth/repeat-a-string.oforth | 1 + .../Repeat-a-string/Phix/repeat-a-string.phix | 2 + .../Repeat-a-string/Ring/repeat-a-string.ring | 1 + .../Sidef/repeat-a-string.sidef | 1 + .../Sparkling/repeat-a-string.sparkling | 2 + .../Swift/repeat-a-string-1.swift | 19 + .../Swift/repeat-a-string-2.swift | 1 + .../Swift/repeat-a-string-3.swift | 19 + .../Visual-FoxPro/repeat-a-string.visual | 1 + .../Repeat-a-string/Wart/repeat-a-string.wart | 7 + .../Wortel/repeat-a-string-1.wortel | 1 + .../Wortel/repeat-a-string-2.wortel | 1 + Task/Repeat-a-string/jq/repeat-a-string.jq | 1 + Task/Resistor-mesh/ERRE/resistor-mesh.erre | 76 ++ Task/Resistor-mesh/Sidef/resistor-mesh.sidef | 52 ++ .../respond-to-an-unknown-method-call.lasso | 27 + ...respond-to-an-unknown-method-call-1.oforth | 2 + ...respond-to-an-unknown-method-call-2.oforth | 2 + ...respond-to-an-unknown-method-call-3.oforth | 2 + ...respond-to-an-unknown-method-call-4.oforth | 6 + .../respond-to-an-unknown-method-call.sidef | 22 + .../ECL/return-multiple-values.ecl | 11 + .../ERRE/return-multiple-values.erre | 12 + .../EchoLisp/return-multiple-values.echolisp | 10 + .../return-multiple-values.freebasic | 53 ++ .../FunL/return-multiple-values.funl | 5 + .../return-multiple-values-1.futurebasic | 22 + .../return-multiple-values-2.futurebasic | 39 ++ .../return-multiple-values-3.futurebasic | 34 + .../return-multiple-values-4.futurebasic | 46 ++ .../Harbour/return-multiple-values.harbour | 2 + .../Lasso/return-multiple-values.lasso | 9 + .../Lily/return-multiple-values.lily | 4 + .../Nim/return-multiple-values-1.nim | 4 + .../Nim/return-multiple-values-2.nim | 6 + .../Oforth/return-multiple-values.oforth | 10 + .../Phix/return-multiple-values.phix | 7 + .../Ring/return-multiple-values.ring | 2 + .../Sidef/return-multiple-values-1.sidef | 3 + .../Sidef/return-multiple-values-2.sidef | 3 + .../Swift/return-multiple-values-1.swift | 3 + .../Swift/return-multiple-values-2.swift | 3 + .../Ursa/return-multiple-values.ursa | 20 + .../return-multiple-values.visual | 17 + .../jq/return-multiple-values-1.jq | 5 + .../jq/return-multiple-values-2.jq | 2 + .../Reverse-a-string/8th/reverse-a-string.8th | 1 + .../Apex/reverse-a-string-1.apex | 3 + .../Apex/reverse-a-string-2.apex | 2 + .../ERRE/reverse-a-string.erre | 15 + .../EchoLisp/reverse-a-string.echolisp | 7 + .../Reverse-a-string/Elm/reverse-a-string.elm | 39 ++ .../Ezhil/reverse-a-string.ezhil | 44 ++ .../FreeBASIC/reverse-a-string.freebasic | 14 + .../FutureBasic/reverse-a-string.futurebasic | 13 + .../GFA-Basic/reverse-a-string.gfa | 10 + .../Harbour/reverse-a-string.harbour | 9 + .../Reverse-a-string/L++/reverse-a-string.lpp | 6 + .../LC3-Assembly/reverse-a-string.lc3 | 35 + .../LFE/reverse-a-string-1.lfe | 2 + .../LFE/reverse-a-string-2.lfe | 2 + .../LFE/reverse-a-string-3.lfe | 2 + .../LFE/reverse-a-string-4.lfe | 2 + .../Lasso/reverse-a-string-1.lasso | 2 + .../Lasso/reverse-a-string-2.lasso | 4 + .../Lingo/reverse-a-string-1.lingo | 7 + .../Lingo/reverse-a-string-2.lingo | 8 + .../LiveCode/reverse-a-string.livecode | 6 + .../Reverse-a-string/Nim/reverse-a-string.nim | 39 ++ .../Oforth/reverse-a-string.oforth | 1 + .../Peloton/reverse-a-string-1.peloton | 1 + .../Peloton/reverse-a-string-2.peloton | 1 + .../Peloton/reverse-a-string-3.peloton | 1 + .../Phix/reverse-a-string-1.phix | 1 + .../Phix/reverse-a-string-2.phix | 19 + .../Ring/reverse-a-string.ring | 3 + .../SequenceL/reverse-a-string-1.sequencel | 3 + .../SequenceL/reverse-a-string-2.sequencel | 6 + .../Sidef/reverse-a-string.sidef | 2 + .../Swift/reverse-a-string-1.swift | 5 + .../Swift/reverse-a-string-2.swift | 5 + .../Wart/reverse-a-string.wart | 1 + .../Wortel/reverse-a-string.wortel | 4 + Task/Reverse-a-string/jq/reverse-a-string.jq | 1 + .../reverse-words-in-a-string.echolisp | 16 + .../Elm/reverse-words-in-a-string.elm | 22 + .../reverse-words-in-a-string.freebasic | 52 ++ .../reverse-words-in-a-string.livecode | 7 + .../LiveScript/reverse-words-in-a-string.live | 17 + .../Nim/reverse-words-in-a-string.nim | 27 + .../Oforth/reverse-words-in-a-string.oforth | 14 + .../Phix/reverse-words-in-a-string.phix | 17 + .../Ring/reverse-words-in-a-string-1.ring | 17 + .../Ring/reverse-words-in-a-string-2.ring | 9 + .../Sidef/reverse-words-in-a-string.sidef | 13 + .../reverse-words-in-a-string.sparkling | 20 + .../Swift/reverse-words-in-a-string.swift | 21 + .../jq/reverse-words-in-a-string-1.jq | 1 + .../jq/reverse-words-in-a-string-2.jq | 11 + .../Lasso/rock-paper-scissors.lasso | 69 ++ .../Phix/rock-paper-scissors.phix | 102 +++ .../Sidef/rock-paper-scissors.sidef | 54 ++ .../Ceylon/roman-numerals-decode.ceylon | 37 + .../ECL/roman-numerals-decode-1.ecl | 18 + .../ECL/roman-numerals-decode-2.ecl | 41 ++ .../ERRE/roman-numerals-decode.erre | 29 + .../FreeBASIC/roman-numerals-decode.freebasic | 62 ++ .../roman-numerals-decode.futurebasic | 28 + .../Lasso/roman-numerals-decode.lasso | 23 + .../LiveScript/roman-numerals-decode.live | 13 + .../Nim/roman-numerals-decode.nim | 12 + .../Phix/roman-numerals-decode.phix | 13 + .../Red/roman-numerals-decode.red | 18 + .../Ring/roman-numerals-decode.ring | 21 + .../Sidef/roman-numerals-decode-1.sidef | 28 + .../Sidef/roman-numerals-decode-2.sidef | 21 + .../Swift/roman-numerals-decode-1.swift | 28 + .../Swift/roman-numerals-decode-2.swift | 33 + .../XLISP/roman-numerals-decode-1.xlisp | 10 + .../XLISP/roman-numerals-decode-2.xlisp | 3 + .../jq/roman-numerals-decode-1.jq | 20 + .../jq/roman-numerals-decode-2.jq | 1 + .../jq/roman-numerals-decode-3.jq | 4 + .../Ceylon/roman-numerals-encode.ceylon | 31 + .../ECL/roman-numerals-encode.ecl | 25 + .../ERRE/roman-numerals-encode.erre | 25 + .../FreeBASIC/roman-numerals-encode.freebasic | 31 + .../roman-numerals-encode.futurebasic | 34 + .../Lasso/roman-numerals-encode.lasso | 19 + .../LiveCode/roman-numerals-encode.livecode | 22 + .../Nim/roman-numerals-encode.nim | 17 + .../Oforth/roman-numerals-encode.oforth | 6 + .../Peloton/roman-numerals-encode-1.peloton | 5 + .../Peloton/roman-numerals-encode-2.peloton | 5 + .../Phix/roman-numerals-encode.phix | 13 + .../Red/roman-numerals-encode-1.red | 9 + .../Red/roman-numerals-encode-2.red | 11 + .../Red/roman-numerals-encode-3.red | 9 + .../Ring/roman-numerals-encode.ring | 16 + .../Sidef/roman-numerals-encode.sidef | 19 + .../Swift/roman-numerals-encode-1.swift | 26 + .../Swift/roman-numerals-encode-2.swift | 1 + .../Swift/roman-numerals-encode-3.swift | 1 + .../XLISP/roman-numerals-encode.xlisp | 12 + .../ERRE/roots-of-a-function.erre | 56 ++ .../EchoLisp/roots-of-a-function.echolisp | 11 + .../Oforth/roots-of-a-function.oforth | 12 + .../Ring/roots-of-a-function.ring | 21 + .../Sidef/roots-of-a-function.sidef | 20 + .../jq/roots-of-a-function-1.jq | 22 + .../jq/roots-of-a-function-2.jq | 14 + .../ERRE/roots-of-a-quadratic-function.erre | 34 + .../Ring/roots-of-a-quadratic-function.ring | 16 + .../Sidef/roots-of-a-quadratic-function.sidef | 19 + .../jq/roots-of-a-quadratic-function-1.jq | 66 ++ .../jq/roots-of-a-quadratic-function-2.jq | 17 + .../jq/roots-of-a-quadratic-function-3.jq | 19 + .../jq/roots-of-a-quadratic-function-4.jq | 27 + Task/Roots-of-unity/ERRE/roots-of-unity.erre | 20 + .../EchoLisp/roots-of-unity.echolisp | 11 + Task/Roots-of-unity/FunL/roots-of-unity.funl | 5 + .../FutureBasic/roots-of-unity.futurebasic | 15 + Task/Roots-of-unity/Nim/roots-of-unity.nim | 12 + Task/Roots-of-unity/Ring/roots-of-unity.ring | 11 + .../Sidef/roots-of-unity-1.sidef | 9 + .../Sidef/roots-of-unity-2.sidef | 5 + .../Sparkling/roots-of-unity.sparkling | 14 + Task/Roots-of-unity/jq/roots-of-unity-1.jq | 5 + Task/Roots-of-unity/jq/roots-of-unity-2.jq | 18 + Task/Rot-13/ERRE/rot-13.erre | 17 + Task/Rot-13/FreeBASIC/rot-13.freebasic | 29 + Task/Rot-13/FunL/rot-13.funl | 25 + Task/Rot-13/Lasso/rot-13-1.lasso | 26 + Task/Rot-13/Lasso/rot-13-2.lasso | 18 + Task/Rot-13/LiveCode/rot-13.livecode | 8 + Task/Rot-13/Nim/rot-13.nim | 12 + Task/Rot-13/Oforth/rot-13.oforth | 5 + Task/Rot-13/Phix/rot-13.phix | 11 + Task/Rot-13/Ring/rot-13.ring | 14 + Task/Rot-13/Sidef/rot-13.sidef | 7 + Task/Rot-13/Swift/rot-13.swift | 16 + Task/Rot-13/Wart/rot-13-1.wart | 14 + Task/Rot-13/Wart/rot-13-2.wart | 2 + Task/Rot-13/jq/rot-13-1.jq | 19 + Task/Rot-13/jq/rot-13-2.jq | 13 + .../Lasso/run-length-encoding.lasso | 47 ++ .../LiveCode/run-length-encoding.livecode | 43 ++ .../Nim/run-length-encoding.nim | 26 + .../Oforth/run-length-encoding.oforth | 12 + .../Phix/run-length-encoding.phix | 30 + .../Sidef/run-length-encoding-1.sidef | 7 + .../Sidef/run-length-encoding-2.sidef | 12 + .../Swift/run-length-encoding-1.swift | 14 + .../Swift/run-length-encoding-2.swift | 3 + .../Swift/run-length-encoding-3.swift | 15 + .../Swift/run-length-encoding-4.swift | 4 + .../jq/run-length-encoding-1.jq | 9 + .../jq/run-length-encoding-2.jq | 9 + .../jq/run-length-encoding-3.jq | 1 + .../jq/run-length-encoding-4.jq | 2 + .../ERRE/runge-kutta-method.erre | 25 + .../FreeBASIC/runge-kutta-method.freebasic | 31 + .../runge-kutta-method.futurebasic | 29 + .../Ring/runge-kutta-method.ring | 13 + .../Sidef/runge-kutta-method.sidef | 21 + .../Swift/runge-kutta-method.swift | 38 + .../jq/runge-kutta-method-1.jq | 7 + .../jq/runge-kutta-method-2.jq | 8 + .../jq/runge-kutta-method-3.jq | 9 + .../jq/runge-kutta-method-4.jq | 14 + .../jq/runge-kutta-method-5.jq | 10 + .../jq/runge-kutta-method-6.jq | 16 + .../jq/runge-kutta-method-7.jq | 43 ++ .../jq/runge-kutta-method-8.jq | 16 + ...time-evaluation-in-an-environment.echolisp | 12 + .../runtime-evaluation-in-an-environment.ring | 7 + ...runtime-evaluation-in-an-environment.sidef | 7 + .../EchoLisp/runtime-evaluation.echolisp | 6 + .../Harbour/runtime-evaluation.harbour | 9 + .../Lasso/runtime-evaluation.lasso | 30 + .../Oforth/runtime-evaluation-1.oforth | 5 + .../Oforth/runtime-evaluation-2.oforth | 4 + .../Ring/runtime-evaluation-1.ring | 5 + .../Ring/runtime-evaluation-2.ring | 12 + .../Ring/runtime-evaluation-3.ring | 9 + .../Ring/runtime-evaluation-4.ring | 20 + .../Sidef/runtime-evaluation.sidef | 3 + .../Sparkling/runtime-evaluation-1.sparkling | 2 + .../Sparkling/runtime-evaluation-2.sparkling | 2 + .../Sparkling/runtime-evaluation-3.sparkling | 2 + .../Ursa/runtime-evaluation.ursa | 2 + .../Ceylon/s-expressions-1.ceylon | 3 + .../Ceylon/s-expressions-2.ceylon | 156 +++++ .../EchoLisp/s-expressions.echolisp | 16 + Task/S-Expressions/Phix/s-expressions.phix | 84 +++ .../S-Expressions/Potion/s-expressions.potion | 72 ++ Task/S-Expressions/Sidef/s-expressions.sidef | 47 ++ Task/SEDOLs/FreeBASIC/sedols.freebasic | 93 +++ Task/SEDOLs/Nim/sedols.nim | 28 + Task/SEDOLs/Oforth/sedols.oforth | 5 + Task/SEDOLs/Phix/sedols.phix | 32 + Task/SEDOLs/Potion/sedols.potion | 13 + Task/SEDOLs/Ring/sedols.ring | 24 + Task/SEDOLs/Sidef/sedols.sidef | 29 + Task/SEDOLs/Visual-FoxPro/sedols.visual | 73 ++ Task/SEDOLs/jq/sedols.jq | 43 ++ Task/SHA-1/FreeBASIC/sha-1.freebasic | 106 +++ Task/SHA-1/Lasso/sha-1.lasso | 1 + Task/SHA-1/LiveCode/sha-1.livecode | 6 + Task/SHA-1/Nim/sha-1.nim | 13 + Task/SHA-1/Sidef/sha-1.sidef | 2 + Task/SHA-256/FreeBASIC/sha-256.freebasic | 133 ++++ Task/SHA-256/FunL/sha-256-1.funl | 3 + Task/SHA-256/FunL/sha-256-2.funl | 83 +++ Task/SHA-256/FunL/sha-256-3.funl | 9 + Task/SHA-256/Lasso/sha-256.lasso | 10 + Task/SHA-256/Nim/sha-256.nim | 13 + Task/SHA-256/Phix/sha-256-1.phix | 16 + Task/SHA-256/Phix/sha-256-2.phix | 126 ++++ Task/SHA-256/Sidef/sha-256.sidef | 2 + Task/SOAP/Uniface/soap.uniface | 6 + .../Sidef/sql-based-authentication.sidef | 27 + Task/Safe-addition/Nim/safe-addition.nim | 20 + Task/Safe-addition/Phix/safe-addition.phix | 53 ++ Task/Same-Fringe/Sidef/same-fringe.sidef | 36 + Task/Same-Fringe/jq/same-fringe-1.jq | 1 + Task/Same-Fringe/jq/same-fringe-2.jq | 33 + Task/Same-Fringe/jq/same-fringe-3.jq | 10 + Task/Same-Fringe/jq/same-fringe-4.jq | 11 + .../scope-function-names-and-labels.sidef | 9 + .../jq/scope-function-names-and-labels-1.jq | 5 + .../jq/scope-function-names-and-labels-2.jq | 2 + .../jq/scope-function-names-and-labels-3.jq | 5 + Task/Scope-modifiers/Nim/scope-modifiers.nim | 6 + .../Search-a-list/Ceylon/search-a-list.ceylon | 11 + Task/Search-a-list/Lasso/search-a-list.lasso | 9 + Task/Search-a-list/Lingo/search-a-list.lingo | 11 + Task/Search-a-list/Nim/search-a-list.nim | 8 + .../Search-a-list/Oforth/search-a-list.oforth | 8 + Task/Search-a-list/Phix/search-a-list.phix | 7 + Task/Search-a-list/Ring/search-a-list.ring | 18 + .../Search-a-list/Sidef/search-a-list-1.sidef | 10 + .../Search-a-list/Sidef/search-a-list-2.sidef | 2 + .../Search-a-list/Swift/search-a-list-1.swift | 8 + .../Search-a-list/Swift/search-a-list-2.swift | 8 + .../Search-a-list/Swift/search-a-list-3.swift | 20 + Task/Search-a-list/Wart/search-a-list.wart | 6 + Task/Search-a-list/jq/search-a-list.jq | 15 + .../Sidef/secure-temporary-file.sidef | 5 + .../self-describing-numbers.freebasic | 23 + .../self-describing-numbers-1.livecode | 11 + .../self-describing-numbers-2.livecode | 9 + .../self-describing-numbers-3.livecode | 1 + .../Nim/self-describing-numbers.nim | 20 + .../Phix/self-describing-numbers.phix | 19 + .../Sidef/self-describing-numbers-1.sidef | 16 + .../Sidef/self-describing-numbers-2.sidef | 4 + .../jq/self-describing-numbers-1.jq | 4 + .../jq/self-describing-numbers-2.jq | 9 + .../jq/self-describing-numbers-3.jq | 1 + .../jq/self-describing-numbers-4.jq | 6 + .../self-referential-sequence-1.echolisp | 112 +++ .../self-referential-sequence-2.echolisp | 32 + .../jq/self-referential-sequence-1.jq | 61 ++ .../jq/self-referential-sequence-2.jq | 30 + Task/Semiprime/ERRE/semiprime.erre | 26 + Task/Semiprime/EchoLisp/semiprime.echolisp | 20 + Task/Semiprime/Oforth/semiprime.oforth | 4 + Task/Semiprime/Ring/semiprime.ring | 24 + Task/Semiprime/Sidef/semiprime.sidef | 12 + Task/Semiprime/Swift/semiprime.swift | 37 + Task/Semordnilap/8th/semordnilap.8th | 17 + .../Semordnilap/EchoLisp/semordnilap.echolisp | 30 + .../FreeBASIC/semordnilap.freebasic | 80 +++ Task/Semordnilap/Lasso/semordnilap.lasso | 29 + Task/Semordnilap/Nim/semordnilap.nim | 16 + Task/Semordnilap/Oforth/semordnilap.oforth | 8 + Task/Semordnilap/Phix/semordnilap.phix | 20 + Task/Semordnilap/Ring/semordnilap.ring | 17 + Task/Semordnilap/Sidef/semordnilap.sidef | 11 + Task/Semordnilap/jq/semordnilap.jq | 11 + .../Lasso/send-an-unknown-method-call.lasso | 11 + .../Lingo/send-an-unknown-method-call.lingo | 5 + .../send-an-unknown-method-call-1.oforth | 1 + .../send-an-unknown-method-call-2.oforth | 1 + .../Sidef/send-an-unknown-method-call.sidef | 11 + Task/Send-email/Lasso/send-email.lasso | 33 + Task/Send-email/Lingo/send-email.lingo | 53 ++ Task/Send-email/LiveCode/send-email.livecode | 1 + Task/Send-email/Nim/send-email.nim | 17 + Task/Send-email/Ring/send-email.ring | 15 + .../EchoLisp/sequence-of-non-squares.echolisp | 9 + .../sequence-of-non-squares.freebasic | 33 + .../Nim/sequence-of-non-squares.nim | 15 + .../Oforth/sequence-of-non-squares.oforth | 3 + .../Phix/sequence-of-non-squares.phix | 19 + .../Ring/sequence-of-non-squares.ring | 5 + .../Sidef/sequence-of-non-squares.sidef | 8 + .../XLISP/sequence-of-non-squares.xlisp | 21 + .../jq/sequence-of-non-squares-1.jq | 8 + .../jq/sequence-of-non-squares-2.jq | 26 + .../sequence-of-primes-by-trial-division.erre | 15 + ...nce-of-primes-by-trial-division-1.echolisp | 9 + ...nce-of-primes-by-trial-division-2.echolisp | 2 + ...nce-of-primes-by-trial-division-3.echolisp | 5 + ...nce-of-primes-by-trial-division-4.echolisp | 9 + ...nce-of-primes-by-trial-division-5.echolisp | 10 + ...nce-of-primes-by-trial-division-6.echolisp | 22 + ...ence-of-primes-by-trial-division.freebasic | 23 + ...equence-of-primes-by-trial-division.oforth | 1 + .../sequence-of-primes-by-trial-division.ring | 13 + ...sequence-of-primes-by-trial-division.sidef | 12 + ...quence-of-primes-by-trial-division-1.swift | 23 + ...quence-of-primes-by-trial-division-2.swift | 21 + .../sequence-of-primes-by-trial-division-1.jq | 7 + .../sequence-of-primes-by-trial-division-2.jq | 1 + .../sequence-of-primes-by-trial-division-3.jq | 4 + .../sequence-of-primes-by-trial-division-4.jq | 1 + .../EchoLisp/set-consolidation.echolisp | 24 + .../Egison/set-consolidation-1.egison | 10 + .../Egison/set-consolidation-2.egison | 1 + .../Sidef/set-consolidation.sidef | 25 + .../jq/set-consolidation-1.jq | 7 + .../jq/set-consolidation-2.jq | 30 + .../jq/set-consolidation-3.jq | 11 + .../jq/set-consolidation-4.jq | 5 + .../EchoLisp/set-of-real-numbers-1.echolisp | 24 + .../EchoLisp/set-of-real-numbers-2.echolisp | 39 ++ Task/Set-puzzle/EchoLisp/set-puzzle.echolisp | 49 ++ Task/Set/Apex/set.apex | 29 + Task/Set/EchoLisp/set.echolisp | 33 + Task/Set/FunL/set.funl | 23 + Task/Set/LFE/set.lfe | 28 + Task/Set/Lasso/set.lasso | 25 + Task/Set/Nim/set.nim | 19 + Task/Set/Sidef/set-1.sidef | 65 ++ Task/Set/Sidef/set-2.sidef | 22 + Task/Set/Swift/set.swift | 27 + Task/Set/jq/set-1.jq | 2 + Task/Set/jq/set-10.jq | 19 + Task/Set/jq/set-11.jq | 22 + Task/Set/jq/set-12.jq | 10 + Task/Set/jq/set-13.jq | 11 + Task/Set/jq/set-2.jq | 2 + Task/Set/jq/set-3.jq | 1 + Task/Set/jq/set-4.jq | 4 + Task/Set/jq/set-5.jq | 4 + Task/Set/jq/set-6.jq | 4 + Task/Set/jq/set-7.jq | 5 + Task/Set/jq/set-8.jq | 1 + Task/Set/jq/set-9.jq | 18 + ...even-sided-dice-from-five-sided-dice.sidef | 16 + .../FreeBASIC/shell-one-liner.freebasic | 4 + .../FutureBasic/shell-one-liner.futurebasic | 1 + .../Lasso/shell-one-liner-1.lasso | 1 + .../Lasso/shell-one-liner-2.lasso | 1 + .../Oforth/shell-one-liner.oforth | 1 + .../Shell-one-liner/Ring/shell-one-liner.ring | 1 + .../Sidef/shell-one-liner.sidef | 1 + .../Shell-one-liner/Wart/shell-one-liner.wart | 1 + Task/Shell-one-liner/jq/shell-one-liner.jq | 2 + .../Axe/short-circuit-evaluation.axe | 22 + .../short-circuit-evaluation.freebasic | 29 + .../short-circuit-evaluation.livecode | 23 + .../Nim/short-circuit-evaluation.nim | 10 + .../Phix/short-circuit-evaluation.phix | 23 + .../Sidef/short-circuit-evaluation.sidef | 16 + .../Swift/short-circuit-evaluation.swift | 26 + .../short-circuit-evaluation.visual | 34 + .../jq/short-circuit-evaluation-1.jq | 8 + .../jq/short-circuit-evaluation-2.jq | 15 + .../FreeBASIC/show-the-epoch.freebasic | 16 + .../FutureBasic/show-the-epoch.futurebasic | 15 + .../Show-the-epoch/Lasso/show-the-epoch.lasso | 2 + .../LiveCode/show-the-epoch.livecode | 6 + Task/Show-the-epoch/Nim/show-the-epoch.nim | 3 + .../Oforth/show-the-epoch.oforth | 3 + Task/Show-the-epoch/Ring/show-the-epoch.ring | 14 + .../Show-the-epoch/Sidef/show-the-epoch.sidef | 1 + Task/Show-the-epoch/jq/show-the-epoch-1.jq | 1 + Task/Show-the-epoch/jq/show-the-epoch-2.jq | 1 + .../ERRE/sierpinski-carpet.erre | 30 + .../Nim/sierpinski-carpet.nim | 32 + .../Oforth/sierpinski-carpet.oforth | 15 + .../Phix/sierpinski-carpet.phix | 19 + .../Ring/sierpinski-carpet.ring | 56 ++ .../Sidef/sierpinski-carpet.sidef | 7 + .../Swift/sierpinski-carpet.swift | 17 + .../jq/sierpinski-carpet-1.jq | 18 + .../jq/sierpinski-carpet-2.jq | 1 + .../ERRE/sierpinski-triangle-graphical.erre | 16 + .../sierpinski-triangle-graphical.freebasic | 24 + .../Ring/sierpinski-triangle-graphical.ring | 44 ++ .../Sidef/sierpinski-triangle-graphical.sidef | 35 + .../Elm/sierpinski-triangle.elm | 52 ++ .../Nim/sierpinski-triangle.nim | 11 + .../Oforth/sierpinski-triangle.oforth | 16 + .../Phix/sierpinski-triangle.phix | 14 + .../Sidef/sierpinski-triangle.sidef | 11 + .../Swift/sierpinski-triangle.swift | 44 ++ .../sieve-of-eratosthenes.68000 | 255 +++++++ .../ERRE/sieve-of-eratosthenes.erre | 29 + .../EchoLisp/sieve-of-eratosthenes-1.echolisp | 30 + .../EchoLisp/sieve-of-eratosthenes-2.echolisp | 34 + .../EchoLisp/sieve-of-eratosthenes-3.echolisp | 17 + .../FreeBASIC/sieve-of-eratosthenes.freebasic | 39 ++ .../sieve-of-eratosthenes.futurebasic | 19 + .../JOVIAL/sieve-of-eratosthenes.jovial | 53 ++ .../LiveCode/sieve-of-eratosthenes-1.livecode | 22 + .../LiveCode/sieve-of-eratosthenes-2.livecode | 2 + .../Nim/sieve-of-eratosthenes-1.nim | 23 + .../Nim/sieve-of-eratosthenes-2.nim | 13 + .../Oforth/sieve-of-eratosthenes.oforth | 7 + .../Phix/sieve-of-eratosthenes.phix | 16 + .../Ring/sieve-of-eratosthenes.ring | 8 + .../Sidef/sieve-of-eratosthenes.sidef | 15 + .../Swift/sieve-of-eratosthenes.swift | 21 + .../jq/sieve-of-eratosthenes-1.jq | 15 + .../jq/sieve-of-eratosthenes-2.jq | 1 + .../jq/sieve-of-eratosthenes-3.jq | 1 + .../Simple-database/Phix/simple-database.phix | 99 +++ .../ToffeeScript/simple-database.toffee | 85 +++ .../B4J/simple-windowed-application-1.b4j | 33 + .../B4J/simple-windowed-application-2.b4j | 27 + .../simple-windowed-application.echolisp | 22 + .../simple-windowed-application.freebasic | 34 + .../Lingo/simple-windowed-application.lingo | 47 ++ .../Nim/simple-windowed-application.nim | 22 + .../Phix/simple-windowed-application.phix | 18 + .../Ring/simple-windowed-application.ring | 21 + .../Sidef/simple-windowed-application.sidef | 27 + Task/Singleton/Lasso/singleton-1.lasso | 17 + Task/Singleton/Lasso/singleton-2.lasso | 16 + Task/Singleton/Lingo/singleton.lingo | 22 + Task/Singleton/Nim/singleton-1.nim | 4 + Task/Singleton/Nim/singleton-2.nim | 4 + Task/Singleton/Oforth/singleton-1.oforth | 6 + Task/Singleton/Oforth/singleton-2.oforth | 6 + Task/Singleton/Sidef/singleton.sidef | 21 + .../singly-linked-list-element-definition.axe | 13 + .../singly-linked-list-element-definition.nim | 10 + ...ngly-linked-list-element-definition.oforth | 1 + ...singly-linked-list-element-definition.ssem | 6 + ...ingly-linked-list-element-definition.sidef | 6 + .../singly-linked-list-element-insertion.axe | 5 + ...gly-linked-list-element-insertion.echolisp | 11 + .../singly-linked-list-element-insertion.nim | 17 + ...ingly-linked-list-element-insertion.oforth | 16 + ...singly-linked-list-element-insertion.sidef | 18 + .../Axe/singly-linked-list-traversal.axe | 12 + .../singly-linked-list-traversal.computer | 30 + .../singly-linked-list-traversal.echolisp | 24 + .../Nim/singly-linked-list-traversal.nim | 26 + .../singly-linked-list-traversal.oforth | 2 + .../singly-linked-list-traversal-1.peloton | 9 + .../singly-linked-list-traversal-2.peloton | 9 + .../SSEM/singly-linked-list-traversal.ssem | 32 + .../Sidef/singly-linked-list-traversal.sidef | 7 + .../Wart/singly-linked-list-traversal.wart | 2 + .../jq/singly-linked-list-traversal.jq | 2 + Task/Sleep/8051-Assembly/sleep.8051 | 23 + Task/Sleep/8th/sleep.8th | 4 + Task/Sleep/AntLang/sleep.antlang | 4 + Task/Sleep/Axe/sleep.axe | 15 + Task/Sleep/ERRE/sleep.erre | 6 + Task/Sleep/FreeBASIC/sleep.freebasic | 8 + Task/Sleep/Lasso/sleep.lasso | 3 + Task/Sleep/Lingo/sleep.lingo | 5 + Task/Sleep/Nim/sleep.nim | 7 + Task/Sleep/Oforth/sleep.oforth | 1 + Task/Sleep/Peloton/sleep-1.peloton | 4 + Task/Sleep/Peloton/sleep-2.peloton | 4 + Task/Sleep/Peloton/sleep-3.peloton | 4 + Task/Sleep/Phix/sleep.phix | 4 + Task/Sleep/Ring/sleep.ring | 12 + Task/Sleep/Sidef/sleep.sidef | 6 + Task/Sleep/Swift/sleep.swift | 10 + Task/Sleep/Ursa/sleep.ursa | 4 + Task/Sockets/Lasso/sockets.lasso | 5 + Task/Sockets/Nim/sockets.nim | 6 + Task/Sockets/Ring/sockets.ring | 40 ++ Task/Sockets/Sidef/sockets.sidef | 8 + Task/Sockets/Symsyn/sockets.symsyn | 4 + .../Nim/solve-a-hidato-puzzle.nim | 80 +++ .../Phix/solve-a-hidato-puzzle.phix | 174 +++++ .../Phix/solve-a-holy-knights-tour.phix | 147 ++++ .../Phix/solve-a-hopido-puzzle.phix | 61 ++ .../Phix/solve-a-numbrix-puzzle.phix | 102 +++ .../Phix/solve-the-no-connection-puzzle.phix | 32 + .../jq/solve-the-no-connection-puzzle-1.jq | 24 + .../jq/solve-the-no-connection-puzzle-2.jq | 13 + .../jq/solve-the-no-connection-puzzle-3.jq | 33 + .../jq/solve-the-no-connection-puzzle-4.jq | 12 + .../jq/solve-the-no-connection-puzzle-5.jq | 11 + ...-an-array-of-composite-structures.echolisp | 10 + .../sort-an-array-of-composite-structures.nim | 5 + ...rt-an-array-of-composite-structures.oforth | 1 + ...sort-an-array-of-composite-structures.phix | 16 + ...ort-an-array-of-composite-structures.sidef | 11 + ...sort-an-array-of-composite-structures-1.jq | 7 + ...sort-an-array-of-composite-structures-2.jq | 6 + ...sort-an-array-of-composite-structures-3.jq | 1 + ...sort-an-array-of-composite-structures-4.jq | 1 + .../8th/sort-an-integer-array.8th | 1 + .../Axe/sort-an-integer-array.axe | 7 + .../FreeBASIC/sort-an-integer-array.freebasic | 58 ++ .../FunL/sort-an-integer-array.funl | 3 + .../Lasso/sort-an-integer-array.lasso | 7 + .../Lingo/sort-an-integer-array.lingo | 4 + .../LiveCode/sort-an-integer-array.livecode | 4 + .../Nim/sort-an-integer-array.nim | 6 + .../Oforth/sort-an-integer-array.oforth | 1 + .../Peloton/sort-an-integer-array-1.peloton | 15 + .../Peloton/sort-an-integer-array-2.peloton | 15 + .../Phix/sort-an-integer-array.phix | 1 + .../Potion/sort-an-integer-array.potion | 1 + .../Ring/sort-an-integer-array.ring | 2 + .../Sidef/sort-an-integer-array.sidef | 3 + .../Sparkling/sort-an-integer-array.sparkling | 2 + .../Swift/sort-an-integer-array-1.swift | 3 + .../Swift/sort-an-integer-array-2.swift | 3 + .../Swift/sort-an-integer-array-3.swift | 3 + .../Swift/sort-an-integer-array-4.swift | 3 + .../Swift/sort-an-integer-array-5.swift | 3 + .../Swift/sort-an-integer-array-6.swift | 2 + .../Swift/sort-an-integer-array-7.swift | 2 + .../Swift/sort-an-integer-array-8.swift | 2 + .../Swift/sort-an-integer-array-9.swift | 2 + .../Ursa/sort-an-integer-array.ursa | 3 + .../Wortel/sort-an-integer-array.wortel | 1 + .../jq/sort-an-integer-array.jq | 1 + .../ERRE/sort-disjoint-sublist.erre | 48 ++ .../EchoLisp/sort-disjoint-sublist.echolisp | 16 + .../Nim/sort-disjoint-sublist.nim | 15 + .../Phix/sort-disjoint-sublist.phix | 33 + .../Sidef/sort-disjoint-sublist.sidef | 9 + .../Swift/sort-disjoint-sublist.swift | 26 + .../jq/sort-disjoint-sublist-1.jq | 9 + .../jq/sort-disjoint-sublist-2.jq | 1 + .../Lasso/sort-stability-1.lasso | 8 + .../Lasso/sort-stability-2.lasso | 2 + .../Lasso/sort-stability-3.lasso | 2 + Task/Sort-stability/Ring/sort-stability.ring | 5 + .../Sort-stability/Sidef/sort-stability.sidef | 10 + .../sort-using-a-custom-comparator.ceylon | 14 + .../sort-using-a-custom-comparator.freebasic | 48 ++ .../FunL/sort-using-a-custom-comparator.funl | 3 + .../Nim/sort-using-a-custom-comparator.nim | 8 + .../sort-using-a-custom-comparator.oforth | 7 + .../Phix/sort-using-a-custom-comparator.phix | 8 + .../sort-using-a-custom-comparator.sidef | 3 + .../sort-using-a-custom-comparator-1.swift | 30 + .../sort-using-a-custom-comparator-2.swift | 30 + .../jq/sort-using-a-custom-comparator-1.jq | 22 + .../jq/sort-using-a-custom-comparator-2.jq | 3 + .../jq/sort-using-a-custom-comparator-3.jq | 6 + .../Nim/sorting-algorithms-bead-sort.nim | 30 + .../Phix/sorting-algorithms-bead-sort.phix | 13 + .../Sidef/sorting-algorithms-bead-sort.sidef | 16 + .../jq/sorting-algorithms-bead-sort-1.jq | 7 + .../jq/sorting-algorithms-bead-sort-2.jq | 8 + .../jq/sorting-algorithms-bead-sort-3.jq | 1 + .../jq/sorting-algorithms-bead-sort-4.jq | 1 + .../jq/sorting-algorithms-bead-sort-5.jq | 2 + .../Nim/sorting-algorithms-bogosort.nim | 22 + .../Phix/sorting-algorithms-bogosort.phix | 13 + .../Sidef/sorting-algorithms-bogosort.sidef | 14 + .../Swift/sorting-algorithms-bogosort.swift | 23 + .../ERRE/sorting-algorithms-bubble-sort.erre | 31 + .../sorting-algorithms-bubble-sort.echolisp | 16 + .../sorting-algorithms-bubble-sort.ezhil | 65 ++ .../sorting-algorithms-bubble-sort.freebasic | 47 ++ .../Nim/sorting-algorithms-bubble-sort.nim | 13 + .../Phix/sorting-algorithms-bubble-sort.phix | 21 + .../Ra/sorting-algorithms-bubble-sort.ra | 31 + .../Ring/sorting-algorithms-bubble-sort.ring | 18 + .../sorting-algorithms-bubble-sort.sidef | 13 + .../sorting-algorithms-bubble-sort.swift | 12 + .../jq/sorting-algorithms-bubble-sort-1.jq | 14 + .../jq/sorting-algorithms-bubble-sort-2.jq | 5 + .../jq/sorting-algorithms-bubble-sort-3.jq | 4 + ...sorting-algorithms-cocktail-sort.freebasic | 58 ++ .../Nim/sorting-algorithms-cocktail-sort.nim | 17 + .../sorting-algorithms-cocktail-sort.phix | 20 + .../sorting-algorithms-cocktail-sort.ring | 20 + .../sorting-algorithms-cocktail-sort-1.sidef | 16 + .../sorting-algorithms-cocktail-sort-2.sidef | 5 + .../jq/sorting-algorithms-cocktail-sort-1.jq | 5 + .../jq/sorting-algorithms-cocktail-sort-2.jq | 23 + .../jq/sorting-algorithms-cocktail-sort-3.jq | 13 + .../jq/sorting-algorithms-cocktail-sort-4.jq | 2 + .../sorting-algorithms-comb-sort.freebasic | 87 +++ .../Nim/sorting-algorithms-comb-sort.nim | 18 + .../Phix/sorting-algorithms-comb-sort.phix | 17 + .../Ring/sorting-algorithms-comb-sort.ring | 20 + .../Sidef/sorting-algorithms-comb-sort.sidef | 15 + .../Swift/sorting-algorithms-comb-sort.swift | 23 + .../jq/sorting-algorithms-comb-sort.jq | 34 + ...sorting-algorithms-counting-sort.freebasic | 59 ++ .../Nim/sorting-algorithms-counting-sort.nim | 15 + .../sorting-algorithms-counting-sort.phix | 17 + .../sorting-algorithms-counting-sort.ring | 22 + .../sorting-algorithms-counting-sort.sidef | 8 + .../jq/sorting-algorithms-counting-sort-1.jq | 15 + .../jq/sorting-algorithms-counting-sort-2.jq | 1 + .../jq/sorting-algorithms-counting-sort-3.jq | 2 + .../sorting-algorithms-gnome-sort.freebasic | 51 ++ .../Nim/sorting-algorithms-gnome-sort.nim | 16 + .../Phix/sorting-algorithms-gnome-sort.phix | 19 + .../Ring/sorting-algorithms-gnome-sort.ring | 21 + .../Sidef/sorting-algorithms-gnome-sort.sidef | 21 + .../jq/sorting-algorithms-gnome-sort-1.jq | 24 + .../jq/sorting-algorithms-gnome-sort-2.jq | 1 + .../jq/sorting-algorithms-gnome-sort-3.jq | 16 + .../sorting-algorithms-heapsort.echolisp | 13 + .../sorting-algorithms-heapsort.freebasic | 75 ++ .../FunL/sorting-algorithms-heapsort.funl | 30 + .../Nim/sorting-algorithms-heapsort.nim | 23 + .../Phix/sorting-algorithms-heapsort.phix | 39 ++ .../Sidef/sorting-algorithms-heapsort.sidef | 39 ++ .../Swift/sorting-algorithms-heapsort.swift | 49 ++ ...orting-algorithms-insertion-sort.commodore | 8 + .../sorting-algorithms-insertion-sort.erre | 33 + ...orting-algorithms-insertion-sort.freebasic | 50 ++ .../Nim/sorting-algorithms-insertion-sort.nim | 12 + .../sorting-algorithms-insertion-sort.oforth | 14 + .../sorting-algorithms-insertion-sort.phix | 19 + .../sorting-algorithms-insertion-sort.ring | 14 + .../sorting-algorithms-insertion-sort.sidef | 17 + .../sorting-algorithms-insertion-sort.swift | 10 + .../jq/sorting-algorithms-insertion-sort-1.jq | 2 + .../jq/sorting-algorithms-insertion-sort-2.jq | 4 + .../jq/sorting-algorithms-insertion-sort-3.jq | 38 + .../jq/sorting-algorithms-insertion-sort-4.jq | 1 + .../sorting-algorithms-merge-sort.crystal | 18 + .../ERRE/sorting-algorithms-merge-sort.erre | 92 +++ .../FunL/sorting-algorithms-merge-sort.funl | 15 + .../Nim/sorting-algorithms-merge-sort.nim | 52 ++ .../Phix/sorting-algorithms-merge-sort.phix | 34 + .../Sidef/sorting-algorithms-merge-sort.sidef | 29 + .../Swift/sorting-algorithms-merge-sort.swift | 45 ++ .../jq/sorting-algorithms-merge-sort-1.jq | 22 + .../jq/sorting-algorithms-merge-sort-2.jq | 4 + .../Nim/sorting-algorithms-pancake-sort.nim | 26 + .../Phix/sorting-algorithms-pancake-sort.phix | 29 + .../Ring/sorting-algorithms-pancake-sort.ring | 29 + .../sorting-algorithms-pancake-sort.sidef | 14 + .../sorting-algorithms-pancake-sort.swift | 66 ++ .../jq/sorting-algorithms-pancake-sort-1.jq | 22 + .../jq/sorting-algorithms-pancake-sort-2.jq | 2 + .../jq/sorting-algorithms-pancake-sort-3.jq | 2 + ...rting-algorithms-permutation-sort.echolisp | 17 + .../sorting-algorithms-permutation-sort.nim | 38 + .../sorting-algorithms-permutation-sort.phix | 16 + .../sorting-algorithms-permutation-sort.sidef | 22 + .../sorting-algorithms-permutation-sort-1.jq | 7 + .../sorting-algorithms-permutation-sort-2.jq | 10 + .../sorting-algorithms-permutation-sort-3.jq | 2 + .../sorting-algorithms-permutation-sort-4.jq | 9 + .../sorting-algorithms-permutation-sort-5.jq | 1 + .../sorting-algorithms-permutation-sort-6.jq | 2 + .../sorting-algorithms-quicksort.crystal | 9 + .../ERRE/sorting-algorithms-quicksort.erre | 79 +++ .../sorting-algorithms-quicksort-1.echolisp | 14 + .../sorting-algorithms-quicksort-2.echolisp | 18 + .../Eero/sorting-algorithms-quicksort-1.eero | 36 + .../Eero/sorting-algorithms-quicksort-2.eero | 33 + .../sorting-algorithms-quicksort.freebasic | 57 ++ .../FunL/sorting-algorithms-quicksort-1.funl | 3 + .../FunL/sorting-algorithms-quicksort-2.funl | 8 + .../sorting-algorithms-quicksort.lobster | 15 + .../Mond/sorting-algorithms-quicksort-1.mond | 32 + .../Mond/sorting-algorithms-quicksort-2.mond | 4 + .../Nim/sorting-algorithms-quicksort.nim | 23 + .../Nix/sorting-algorithms-quicksort.nix | 12 + .../sorting-algorithms-quicksort.oforth | 1 + .../Phix/sorting-algorithms-quicksort.phix | 30 + .../Sidef/sorting-algorithms-quicksort.sidef | 5 + .../Swift/sorting-algorithms-quicksort.swift | 11 + .../Wart/sorting-algorithms-quicksort.wart | 7 + .../jq/sorting-algorithms-quicksort-1.jq | 1 + .../jq/sorting-algorithms-quicksort-2.jq | 1 + .../jq/sorting-algorithms-quicksort-3.jq | 13 + .../Phix/sorting-algorithms-radix-sort.phix | 52 ++ .../Sidef/sorting-algorithms-radix-sort.sidef | 26 + .../jq/sorting-algorithms-radix-sort-1.jq | 23 + .../jq/sorting-algorithms-radix-sort-2.jq | 5 + ...rting-algorithms-selection-sort-1.echolisp | 18 + ...rting-algorithms-selection-sort-2.echolisp | 13 + ...orting-algorithms-selection-sort.freebasic | 47 ++ .../Nim/sorting-algorithms-selection-sort.nim | 12 + .../sorting-algorithms-selection-sort.oforth | 11 + .../sorting-algorithms-selection-sort.phix | 13 + .../Ra/sorting-algorithms-selection-sort.ra | 33 + .../sorting-algorithms-selection-sort.ring | 19 + .../sorting-algorithms-selection-sort.sidef | 20 + .../sorting-algorithms-selection-sort.swift | 19 + .../jq/sorting-algorithms-selection-sort-1.jq | 18 + .../jq/sorting-algorithms-selection-sort-2.jq | 1 + .../sorting-algorithms-shell-sort.freebasic | 53 ++ .../Nim/sorting-algorithms-shell-sort.nim | 15 + .../Phix/sorting-algorithms-shell-sort.phix | 17 + .../Ring/sorting-algorithms-shell-sort.ring | 21 + .../Sidef/sorting-algorithms-shell-sort.sidef | 18 + .../Swift/sorting-algorithms-shell-sort.swift | 17 + .../jq/sorting-algorithms-shell-sort-1.jq | 24 + .../jq/sorting-algorithms-shell-sort-2.jq | 3 + .../jq/sorting-algorithms-shell-sort-3.jq | 3 + .../sorting-algorithms-sleep-sort.freebasic | 58 ++ .../Nim/sorting-algorithms-sleep-sort.nim | 13 + .../sorting-algorithms-sleep-sort.oforth | 7 + .../Phix/sorting-algorithms-sleep-sort.phix | 29 + .../Sidef/sorting-algorithms-sleep-sort.sidef | 3 + .../Swift/sorting-algorithms-sleep-sort.swift | 12 + .../jq/sorting-algorithms-sleep-sort.jq | 11 + .../sorting-algorithms-stooge-sort.freebasic | 41 ++ .../Nim/sorting-algorithms-stooge-sort.nim | 11 + .../Phix/sorting-algorithms-stooge-sort.phix | 13 + .../Ring/sorting-algorithms-stooge-sort.ring | 18 + .../sorting-algorithms-stooge-sort.sidef | 18 + .../sorting-algorithms-stooge-sort.swift | 22 + .../jq/sorting-algorithms-stooge-sort-1.jq | 17 + .../jq/sorting-algorithms-stooge-sort-2.jq | 6 + .../jq/sorting-algorithms-stooge-sort-3.jq | 6 + .../Nim/sorting-algorithms-strand-sort.nim | 32 + .../Phix/sorting-algorithms-strand-sort.phix | 34 + .../sorting-algorithms-strand-sort.sidef | 36 + .../jq/sorting-algorithms-strand-sort.jq | 38 + Task/Soundex/FutureBasic/soundex.futurebasic | 171 +++++ Task/Soundex/Sidef/soundex.sidef | 55 ++ .../LiveCode/sparkline-in-unicode.livecode | 22 + .../Nim/sparkline-in-unicode.nim | 18 + .../Sidef/sparkline-in-unicode.sidef | 9 + .../jq/sparkline-in-unicode.jq | 9 + .../Lasso/special-characters.lasso | 21 + .../Lingo/special-characters.lingo | 3 + .../Nim/special-characters-1.nim | 1 + .../Nim/special-characters-2.nim | 1 + .../Nim/special-characters-3.nim | 1 + .../jq/special-characters.jq | 1 + .../Lasso/special-variables-1.lasso | 1 + .../Lasso/special-variables-2.lasso | 2 + .../LiveCode/special-variables-1.livecode | 1 + .../LiveCode/special-variables-2.livecode | 1 + .../Ursa/special-variables.ursa | 15 + .../XLISP/special-variables-1.xlisp | 1 + .../XLISP/special-variables-2.xlisp | 3 + .../Special-variables/jq/special-variables.jq | 2 + .../Sidef/speech-synthesis.sidef | 4 + .../Swift/speech-synthesis.swift | 6 + .../FreeBASIC/spiral-matrix.freebasic | 76 ++ Task/Spiral-matrix/Nim/spiral-matrix.nim | 43 ++ Task/Spiral-matrix/Phix/spiral-matrix.phix | 19 + Task/Spiral-matrix/Sidef/spiral-matrix.sidef | 20 + Task/Spiral-matrix/jq/spiral-matrix-1.jq | 26 + Task/Spiral-matrix/jq/spiral-matrix-2.jq | 14 + .../EchoLisp/stable-marriage-problem.echolisp | 74 ++ .../Sidef/stable-marriage-problem.sidef | 89 +++ .../Swift/stable-marriage-problem.swift | 138 ++++ Task/Stack-traces/Lasso/stack-traces-1.lasso | 24 + Task/Stack-traces/Lasso/stack-traces-2.lasso | 8 + Task/Stack-traces/Nim/stack-traces.nim | 6 + Task/Stack-traces/Oforth/stack-traces.oforth | 6 + Task/Stack/Axe/stack.axe | 14 + Task/Stack/EchoLisp/stack.echolisp | 20 + Task/Stack/Lasso/stack.lasso | 10 + Task/Stack/Lingo/stack.lingo | 23 + Task/Stack/Nim/stack.nim | 73 ++ Task/Stack/Oforth/stack-1.oforth | 4 + Task/Stack/Oforth/stack-2.oforth | 11 + Task/Stack/Phix/stack-1.phix | 23 + Task/Stack/Phix/stack-2.phix | 26 + Task/Stack/Phix/stack-3.phix | 43 ++ Task/Stack/Sidef/stack-1.sidef | 4 + Task/Stack/Sidef/stack-2.sidef | 10 + Task/Stack/Swift/stack.swift | 26 + Task/Stack/Wart/stack.wart | 11 + Task/Stack/XLISP/stack-1.xlisp | 17 + Task/Stack/XLISP/stack-2.xlisp | 23 + .../EchoLisp/stair-climbing-puzzle.echolisp | 21 + .../Nim/stair-climbing-puzzle.nim | 11 + .../Phix/stair-climbing-puzzle.phix | 3 + .../Ring/stair-climbing-puzzle.ring | 11 + .../Sidef/stair-climbing-puzzle.sidef | 5 + .../Swift/stair-climbing-puzzle-1.swift | 5 + .../Swift/stair-climbing-puzzle-2.swift | 3 + .../jq/stair-climbing-puzzle-1.jq | 1 + .../jq/stair-climbing-puzzle-2.jq | 1 + .../jq/stair-climbing-puzzle-3.jq | 3 + .../jq/stair-climbing-puzzle-4.jq | 4 + .../jq/stair-climbing-puzzle-5.jq | 1 + .../jq/stair-climbing-puzzle-6.jq | 2 + .../jq/stair-climbing-puzzle-7.jq | 7 + .../jq/stair-climbing-puzzle-8.jq | 1 + .../start-from-a-main-routine.freebasic | 8 + .../Oforth/start-from-a-main-routine-1.oforth | 4 + .../Oforth/start-from-a-main-routine-2.oforth | 6 + .../Phix/start-from-a-main-routine.phix | 4 + .../LiveCode/state-name-puzzle.livecode | 45 ++ .../jq/state-name-puzzle-1.jq | 40 ++ .../jq/state-name-puzzle-2.jq | 20 + .../jq/state-name-puzzle-3.jq | 21 + .../FreeBASIC/statistics-basic.freebasic | 69 ++ Task/Statistics-Basic/Hy/statistics-basic.hy | 11 + .../Lasso/statistics-basic.lasso | 51 ++ .../Statistics-Basic/Nim/statistics-basic.nim | 32 + .../Oforth/statistics-basic.oforth | 15 + .../Sidef/statistics-basic.sidef | 26 + .../Ceylon/stem-and-leaf-plot.ceylon | 24 + .../FreeBASIC/stem-and-leaf-plot.freebasic | 79 +++ .../Phix/stem-and-leaf-plot.phix | 26 + .../Sidef/stem-and-leaf-plot.sidef | 24 + .../jq/stem-and-leaf-plot-1.jq | 18 + .../jq/stem-and-leaf-plot-2.jq | 11 + .../jq/stem-and-leaf-plot-3.jq | 16 + .../EchoLisp/stern-brocot-sequence-1.echolisp | 9 + .../EchoLisp/stern-brocot-sequence-2.echolisp | 20 + .../EchoLisp/stern-brocot-sequence-3.echolisp | 13 + .../Oforth/stern-brocot-sequence.oforth | 7 + .../Sidef/stern-brocot-sequence.sidef | 34 + .../jq/stern-brocot-sequence-1.jq | 12 + .../jq/stern-brocot-sequence-2.jq | 18 + .../jq/stern-brocot-sequence-3.jq | 31 + .../jq/stern-brocot-sequence-4.jq | 33 + Task/String-append/Axe/string-append.axe | 4 + .../EchoLisp/string-append.echolisp | 9 + .../FreeBASIC/string-append.freebasic | 6 + Task/String-append/Lasso/string-append.lasso | 3 + Task/String-append/Lingo/string-append.lingo | 4 + .../LiveCode/string-append.livecode | 2 + Task/String-append/Nim/string-append.nim | 3 + .../String-append/Oforth/string-append.oforth | 1 + Task/String-append/Phix/string-append.phix | 2 + Task/String-append/Ring/string-append.ring | 4 + Task/String-append/Sidef/string-append.sidef | 3 + Task/String-append/Swift/string-append.swift | 5 + Task/String-append/Ursa/string-append.ursa | 8 + Task/String-append/Wart/string-append.wart | 2 + Task/String-append/jq/string-append-1.jq | 5 + Task/String-append/jq/string-append-2.jq | 1 + Task/String-case/ECL/string-case.ecl | 11 + .../String-case/EchoLisp/string-case.echolisp | 10 + Task/String-case/Elm/string-case.elm | 6 + .../FreeBASIC/string-case.freebasic | 6 + .../FutureBasic/string-case.futurebasic | 10 + Task/String-case/Lasso/string-case.lasso | 12 + Task/String-case/Lingo/string-case-1.lingo | 29 + Task/String-case/Lingo/string-case-2.lingo | 5 + .../String-case/LiveCode/string-case.livecode | 2 + Task/String-case/Nim/string-case.nim | 7 + Task/String-case/Oforth/string-case.oforth | 2 + .../String-case/Peloton/string-case-1.peloton | 5 + .../String-case/Peloton/string-case-2.peloton | 5 + Task/String-case/Phix/string-case.phix | 3 + Task/String-case/Potion/string-case.potion | 25 + .../Powerbuilder/string-case.powerbuilder | 4 + Task/String-case/Ring/string-case.ring | 3 + Task/String-case/Sidef/string-case.sidef | 6 + Task/String-case/Swift/string-case.swift | 5 + Task/String-case/Ursa/string-case.ursa | 2 + Task/String-case/jq/string-case-1.jq | 7 + Task/String-case/jq/string-case-2.jq | 5 + .../Apex/string-comparison.apex | 35 + .../FreeBASIC/string-comparison.freebasic | 40 ++ .../Harbour/string-comparison-1.harbour | 12 + .../Harbour/string-comparison-2.harbour | 3 + .../Lasso/string-comparison.lasso | 35 + .../Lingo/string-comparison-1.lingo | 11 + .../Lingo/string-comparison-2.lingo | 10 + .../Nim/string-comparison.nim | 10 + .../Oforth/string-comparison.oforth | 5 + .../Phix/string-comparison.phix | 6 + .../Ring/string-comparison.ring | 18 + .../Sidef/string-comparison.sidef | 5 + .../Swift/string-comparison.swift | 23 + .../jq/string-comparison-1.jq | 11 + .../jq/string-comparison-2.jq | 7 + .../jq/string-comparison-3.jq | 1 + .../Apex/string-concatenation.apex | 7 + .../Axe/string-concatenation.axe | 5 + .../ChucK/string-concatenation.chuck | 3 + .../ERRE/string-concatenation.erre | 6 + .../FreeBASIC/string-concatenation.freebasic | 7 + .../Lasso/string-concatenation.lasso | 4 + .../Lingo/string-concatenation.lingo | 4 + .../LiveCode/string-concatenation.livecode | 3 + .../Nim/string-concatenation-1.nim | 6 + .../Nim/string-concatenation-2.nim | 4 + .../Nim/string-concatenation-3.nim | 4 + .../Oforth/string-concatenation.oforth | 1 + .../PHL/string-concatenation.phl | 11 + .../Phix/string-concatenation.phix | 5 + .../Ring/string-concatenation.ring | 4 + .../Sidef/string-concatenation-1.sidef | 4 + .../Sidef/string-concatenation-2.sidef | 2 + .../Sparkling/string-concatenation.sparkling | 3 + .../Swift/string-concatenation.swift | 4 + .../Ursa/string-concatenation.ursa | 9 + .../jq/string-concatenation.jq | 1 + .../Coco/string-interpolation--included-.coco | 2 + .../ECL/string-interpolation--included-.ecl | 2 + .../string-interpolation--included-.echolisp | 5 + .../string-interpolation--included-.freebasic | 9 + .../FunL/string-interpolation--included-.funl | 2 + .../string-interpolation--included-.lasso | 1 + .../string-interpolation--included-.livecode | 4 + .../Nim/string-interpolation--included-.nim | 5 + .../Phix/string-interpolation--included-.phix | 3 + .../Ring/string-interpolation--included-.ring | 2 + .../string-interpolation--included--1.sidef | 2 + .../string-interpolation--included--2.sidef | 1 + .../string-interpolation--included-.swift | 2 + .../jq/string-interpolation--included--1.jq | 2 + .../jq/string-interpolation--included--2.jq | 2 + Task/String-length/Apex/string-length.apex | 2 + Task/String-length/Axe/string-length.axe | 2 + .../FreeBASIC/string-length.freebasic | 23 + Task/String-length/LFE/string-length-1.lfe | 8 + Task/String-length/LFE/string-length-2.lfe | 12 + .../String-length/Lasso/string-length-1.lasso | 3 + .../String-length/Lasso/string-length-2.lasso | 3 + .../String-length/Lingo/string-length-1.lingo | 3 + .../String-length/Lingo/string-length-2.lingo | 3 + Task/String-length/Nim/string-length-1.nim | 4 + Task/String-length/Nim/string-length-2.nim | 6 + Task/String-length/Phix/string-length.phix | 2 + .../String-length/Potion/string-length.potion | 3 + Task/String-length/Ring/string-length.ring | 3 + .../String-length/Sidef/string-length-1.sidef | 1 + .../String-length/Sidef/string-length-2.sidef | 1 + .../String-length/Sidef/string-length-3.sidef | 1 + .../String-length/Sidef/string-length-4.sidef | 1 + .../String-length/Sidef/string-length-5.sidef | 1 + .../Sparkling/string-length.sparkling | 2 + .../String-length/Swift/string-length-1.swift | 1 + .../Swift/string-length-10.swift | 1 + .../Swift/string-length-11.swift | 1 + .../Swift/string-length-12.swift | 1 + .../String-length/Swift/string-length-2.swift | 1 + .../String-length/Swift/string-length-3.swift | 1 + .../String-length/Swift/string-length-4.swift | 1 + .../String-length/Swift/string-length-5.swift | 1 + .../String-length/Swift/string-length-6.swift | 1 + .../String-length/Swift/string-length-7.swift | 1 + .../String-length/Swift/string-length-8.swift | 1 + .../String-length/Swift/string-length-9.swift | 1 + Task/String-length/Wren/string-length-1.wren | 3 + Task/String-length/Wren/string-length-2.wren | 3 + Task/String-length/jq/string-length-1.jq | 5 + Task/String-length/jq/string-length-2.jq | 3 + .../EchoLisp/string-matching.echolisp | 5 + .../FreeBASIC/string-matching.freebasic | 26 + .../Lasso/string-matching.lasso | 14 + .../Lingo/string-matching.lingo | 22 + Task/String-matching/Nim/string-matching.nim | 10 + .../Oforth/string-matching.oforth | 14 + .../String-matching/Phix/string-matching.phix | 29 + .../String-matching/Ring/string-matching.ring | 4 + .../Sidef/string-matching.sidef | 15 + .../Swift/string-matching.swift | 9 + Task/String-matching/jq/string-matching-1.jq | 3 + Task/String-matching/jq/string-matching-2.jq | 6 + Task/String-matching/jq/string-matching-3.jq | 3 + Task/String-matching/jq/string-matching-4.jq | 5 + Task/String-matching/jq/string-matching-5.jq | 6 + Task/String-matching/jq/string-matching-6.jq | 3 + Task/String-prepend/ERRE/string-prepend.erre | 5 + .../EchoLisp/string-prepend.echolisp | 10 + .../FreeBASIC/string-prepend.freebasic | 6 + Task/String-prepend/LFE/string-prepend-1.lfe | 4 + Task/String-prepend/LFE/string-prepend-2.lfe | 4 + .../String-prepend/Lasso/string-prepend.lasso | 3 + .../String-prepend/Lingo/string-prepend.lingo | 4 + .../LiveCode/string-prepend.livecode | 3 + Task/String-prepend/Nim/string-prepend.nim | 3 + .../Oforth/string-prepend.oforth | 1 + Task/String-prepend/Phix/string-prepend.phix | 2 + Task/String-prepend/Ring/string-prepend.ring | 3 + .../Sidef/string-prepend-1.sidef | 3 + .../Sidef/string-prepend-2.sidef | 3 + .../String-prepend/Swift/string-prepend.swift | 3 + Task/String-prepend/Ursa/string-prepend.ursa | 10 + Task/String-prepend/Wart/string-prepend.wart | 2 + Task/String-prepend/jq/string-prepend.jq | 2 + ...a-set-of-characters-from-a-string.echolisp | 7 + ...-set-of-characters-from-a-string.freebasic | 33 + ...ip-a-set-of-characters-from-a-string.lasso | 7 + ...set-of-characters-from-a-string-1.livecode | 8 + ...set-of-characters-from-a-string-2.livecode | 3 + ...trip-a-set-of-characters-from-a-string.nim | 9 + ...p-a-set-of-characters-from-a-string.oforth | 3 + ...rip-a-set-of-characters-from-a-string.phix | 8 + ...rip-a-set-of-characters-from-a-string.ring | 10 + ...-a-set-of-characters-from-a-string-1.sidef | 3 + ...-a-set-of-characters-from-a-string-2.sidef | 3 + ...-a-set-of-characters-from-a-string-3.sidef | 1 + ...ip-a-set-of-characters-from-a-string.swift | 10 + ...rip-a-set-of-characters-from-a-string-1.jq | 2 + ...rip-a-set-of-characters-from-a-string-2.jq | 2 + .../Nim/strip-block-comments.nim | 48 ++ .../Phix/strip-block-comments.phix | 34 + .../Ring/strip-block-comments.ring | 13 + .../Sidef/strip-block-comments.sidef | 6 + .../jq/strip-block-comments.jq | 9 + .../strip-comments-from-a-string.freebasic | 27 + .../Nim/strip-comments-from-a-string.nim | 7 + .../strip-comments-from-a-string.oforth | 4 + .../Phix/strip-comments-from-a-string.phix | 17 + .../Ring/strip-comments-from-a-string.ring | 13 + .../Sidef/strip-comments-from-a-string.sidef | 9 + .../jq/strip-comments-from-a-string-1.jq | 1 + .../jq/strip-comments-from-a-string-2.jq | 20 + .../jq/strip-comments-from-a-string-3.jq | 1 + .../jq/strip-comments-from-a-string-4.jq | 1 + ...xtended-characters-from-a-string.freebasic | 78 +++ ...-and-extended-characters-from-a-string.nim | 7 + ...xtended-characters-from-a-string-1.peloton | 8 + ...xtended-characters-from-a-string-2.peloton | 5 + ...and-extended-characters-from-a-string.ring | 12 + ...nd-extended-characters-from-a-string.sidef | 10 + ...and-extended-characters-from-a-string-1.jq | 5 + ...and-extended-characters-from-a-string-2.jq | 4 + ...and-extended-characters-from-a-string-3.jq | 5 + ...espace-from-a-string-top-and-tail.echolisp | 8 + ...space-from-a-string-top-and-tail.freebasic | 24 + ...hitespace-from-a-string-top-and-tail.lasso | 8 + ...-whitespace-from-a-string-top-and-tail.nim | 7 + ...whitespace-from-a-string-top-and-tail.phix | 5 + ...whitespace-from-a-string-top-and-tail.ring | 3 + ...hitespace-from-a-string-top-and-tail.sidef | 4 + ...whitespace-from-a-string-top-and-tail-1.jq | 5 + ...whitespace-from-a-string-top-and-tail-2.jq | 9 + ...whitespace-from-a-string-top-and-tail-3.jq | 9 + .../Apex/substring-top-and-tail.apex | 16 + .../Eero/substring-top-and-tail.eero | 18 + .../substring-top-and-tail.freebasic | 11 + .../Lasso/substring-top-and-tail-1.lasso | 10 + .../Lasso/substring-top-and-tail-2.lasso | 10 + .../Lasso/substring-top-and-tail.lasso | 13 + .../LiveCode/substring-top-and-tail.livecode | 4 + .../Nim/substring-top-and-tail.nim | 6 + .../Oforth/substring-top-and-tail.oforth | 4 + .../Phix/substring-top-and-tail.phix | 4 + .../Ring/substring-top-and-tail.ring | 4 + .../Sidef/substring-top-and-tail-1.sidef | 4 + .../Sidef/substring-top-and-tail-2.sidef | 4 + .../Swift/substring-top-and-tail-1.swift | 4 + .../Swift/substring-top-and-tail-2.swift | 4 + .../Swift/substring-top-and-tail-3.swift | 3 + .../Swift/substring-top-and-tail-4.swift | 55 ++ .../jq/substring-top-and-tail-1.jq | 7 + .../jq/substring-top-and-tail-2.jq | 1 + Task/Substring/Apex/substring.apex | 15 + Task/Substring/Axe/substring.axe | 19 + Task/Substring/ECL/substring.ecl | 32 + Task/Substring/Eero/substring.eero | 13 + Task/Substring/FreeBASIC/substring.freebasic | 12 + Task/Substring/LFE/substring.lfe | 18 + Task/Substring/Lasso/substring.lasso | 16 + Task/Substring/Lingo/substring.lingo | 30 + Task/Substring/LiveCode/substring.livecode | 6 + Task/Substring/Nim/substring.nim | 26 + Task/Substring/Oforth/substring.oforth | 6 + Task/Substring/Phix/substring-1.phix | 29 + Task/Substring/Phix/substring-2.phix | 5 + Task/Substring/Ring/substring.ring | 12 + Task/Substring/Sidef/substring.sidef | 8 + Task/Substring/Swift/substring.swift | 57 ++ Task/Substring/Wart/substring.wart | 22 + Task/Substring/jq/substring-1.jq | 1 + Task/Substring/jq/substring-2.jq | 1 + Task/Substring/jq/substring-3.jq | 20 + Task/Substring/jq/substring-4.jq | 6 + .../Sidef/subtractive-generator.sidef | 22 + Task/Sudoku/ERRE/sudoku.erre | 404 +++++++++++ Task/Sudoku/FutureBasic/sudoku.futurebasic | 108 +++ Task/Sudoku/Phix/sudoku-1.phix | 50 ++ Task/Sudoku/Phix/sudoku-2.phix | 658 ++++++++++++++++++ Task/Sudoku/Sidef/sudoku.sidef | 53 ++ Task/Sudoku/Swift/sudoku.swift | 125 ++++ .../sum-and-product-of-an-array.freebasic | 13 + .../GFA-Basic/sum-and-product-of-an-array.gfa | 15 + .../Lasso/sum-and-product-of-an-array.lasso | 11 + .../Lingo/sum-and-product-of-an-array.lingo | 15 + .../sum-and-product-of-an-array.livecode | 15 + .../Nim/sum-and-product-of-an-array-1.nim | 9 + .../Nim/sum-and-product-of-an-array-2.nim | 6 + .../Oforth/sum-and-product-of-an-array.oforth | 2 + .../Phix/sum-and-product-of-an-array.phix | 8 + .../Ring/sum-and-product-of-an-array.ring | 4 + .../Sidef/sum-and-product-of-an-array-1.sidef | 3 + .../Sidef/sum-and-product-of-an-array-2.sidef | 3 + .../sum-and-product-of-an-array.sparkling | 4 + .../Swift/sum-and-product-of-an-array.swift | 6 + .../Ursa/sum-and-product-of-an-array.ursa | 8 + .../Wart/sum-and-product-of-an-array.wart | 2 + .../Wortel/sum-and-product-of-an-array.wortel | 2 + .../jq/sum-and-product-of-an-array-1.jq | 2 + .../jq/sum-and-product-of-an-array-2.jq | 2 + .../jq/sum-and-product-of-an-array-3.jq | 1 + .../jq/sum-and-product-of-an-array-4.jq | 2 + .../jq/sum-and-product-of-an-array-5.jq | 2 + .../Ezhil/sum-digits-of-an-integer.ezhil | 19 + .../sum-digits-of-an-integer.freebasic | 22 + .../Lasso/sum-digits-of-an-integer.lasso | 25 + .../Lingo/sum-digits-of-an-integer-1.lingo | 9 + .../Lingo/sum-digits-of-an-integer-2.lingo | 8 + .../sum-digits-of-an-integer-1.livecode | 8 + .../sum-digits-of-an-integer-2.livecode | 4 + .../sum-digits-of-an-integer-3.livecode | 1 + .../Nim/sum-digits-of-an-integer.nim | 11 + .../Oforth/sum-digits-of-an-integer-1.oforth | 1 + .../Oforth/sum-digits-of-an-integer-2.oforth | 4 + .../Phix/sum-digits-of-an-integer.phix | 13 + .../Ring/sum-digits-of-an-integer.ring | 12 + .../Sidef/sum-digits-of-an-integer.sidef | 7 + .../Swift/sum-digits-of-an-integer-1.swift | 6 + .../Swift/sum-digits-of-an-integer-2.swift | 8 + .../Ursa/sum-digits-of-an-integer-1.ursa | 7 + .../Ursa/sum-digits-of-an-integer-2.ursa | 4 + .../jq/sum-digits-of-an-integer-1.jq | 1 + .../jq/sum-digits-of-an-integer-2.jq | 5 + .../sum-multiples-of-3-and-5.echolisp | 33 + .../sum-multiples-of-3-and-5.freebasic | 15 + .../Lasso/sum-multiples-of-3-and-5.lasso | 9 + .../Lingo/sum-multiples-of-3-and-5-1.lingo | 9 + .../Lingo/sum-multiples-of-3-and-5-2.lingo | 2 + .../sum-multiples-of-3-and-5.livecode | 10 + .../Nim/sum-multiples-of-3-and-5-1.nim | 6 + .../Nim/sum-multiples-of-3-and-5-2.nim | 16 + .../Oforth/sum-multiples-of-3-and-5.oforth | 1 + .../Ring/sum-multiples-of-3-and-5.ring | 10 + .../Sidef/sum-multiples-of-3-and-5.sidef | 12 + .../Wortel/sum-multiples-of-3-and-5.wortel | 5 + .../jq/sum-multiples-of-3-and-5-1.jq | 7 + .../jq/sum-multiples-of-3-and-5-2.jq | 3 + .../EchoLisp/sum-of-a-series.echolisp | 8 + .../Ezhil/sum-of-a-series.ezhil | 24 + .../FreeBASIC/sum-of-a-series.freebasic | 18 + .../GEORGE/sum-of-a-series.george | 5 + .../Sum-of-a-series/LFE/sum-of-a-series-1.lfe | 7 + .../Sum-of-a-series/LFE/sum-of-a-series-2.lfe | 5 + .../Sum-of-a-series/LFE/sum-of-a-series-3.lfe | 2 + .../Lasso/sum-of-a-series.lasso | 8 + .../Lingo/sum-of-a-series.lingo | 7 + .../LiveCode/sum-of-a-series.livecode | 4 + Task/Sum-of-a-series/Nim/sum-of-a-series.nim | 6 + .../Oforth/sum-of-a-series-1.oforth | 1 + .../Oforth/sum-of-a-series-2.oforth | 1 + .../Panda/sum-of-a-series.panda | 1 + .../Sum-of-a-series/Phix/sum-of-a-series.phix | 8 + .../Potion/sum-of-a-series.potion | 3 + .../Sum-of-a-series/Ring/sum-of-a-series.ring | 6 + .../Sidef/sum-of-a-series-1.sidef | 1 + .../Sidef/sum-of-a-series-2.sidef | 1 + .../Swift/sum-of-a-series-1.swift | 11 + .../Swift/sum-of-a-series-2.swift | 22 + .../Wortel/sum-of-a-series-1.wortel | 1 + .../Wortel/sum-of-a-series-2.wortel | 4 + Task/Sum-of-a-series/jq/sum-of-a-series-1.jq | 3 + Task/Sum-of-a-series/jq/sum-of-a-series-2.jq | 3 + .../FreeBASIC/sum-of-squares.freebasic | 18 + .../GEORGE/sum-of-squares.george | 6 + Task/Sum-of-squares/LFE/sum-of-squares-1.lfe | 5 + Task/Sum-of-squares/LFE/sum-of-squares-2.lfe | 2 + .../Sum-of-squares/Lasso/sum-of-squares.lasso | 12 + .../LiveCode/sum-of-squares.livecode | 5 + Task/Sum-of-squares/Nim/sum-of-squares.nim | 3 + .../Oforth/sum-of-squares.oforth | 1 + Task/Sum-of-squares/Phix/sum-of-squares.phix | 1 + Task/Sum-of-squares/Ring/sum-of-squares.ring | 9 + .../Sum-of-squares/Sidef/sum-of-squares.sidef | 8 + .../Sum-of-squares/Swift/sum-of-squares.swift | 3 + .../Wortel/sum-of-squares-1.wortel | 1 + .../Wortel/sum-of-squares-2.wortel | 1 + .../Wortel/sum-of-squares-3.wortel | 1 + .../Wortel/sum-of-squares-4.wortel | 1 + .../Sum-of-squares/XLISP/sum-of-squares.xlisp | 14 + Task/Sum-of-squares/jq/sum-of-squares-1.jq | 5 + Task/Sum-of-squares/jq/sum-of-squares-2.jq | 6 + Task/Sum-of-squares/jq/sum-of-squares-3.jq | 4 + Task/Sum-of-squares/jq/sum-of-squares-4.jq | 9 + Task/Sum-of-squares/jq/sum-of-squares-5.jq | 5 + .../sutherland-hodgman-polygon-clipping.sidef | 53 ++ .../Apex/symmetric-difference.apex | 28 + .../Lasso/symmetric-difference.lasso | 24 + .../Nim/symmetric-difference.nim | 7 + .../Ring/symmetric-difference.ring | 29 + .../Sidef/symmetric-difference.sidef | 3 + .../Swift/symmetric-difference.swift | 4 + .../jq/symmetric-difference-1.jq | 10 + .../jq/symmetric-difference-2.jq | 2 + .../EchoLisp/synchronous-concurrency.echolisp | 34 + .../Oforth/synchronous-concurrency.oforth | 16 + .../Phix/synchronous-concurrency.phix | 51 ++ .../Swift/synchronous-concurrency-1.swift | 44 ++ .../Swift/synchronous-concurrency-2.swift | 38 + .../Swift/synchronous-concurrency-3.swift | 17 + .../FreeBASIC/system-time.freebasic | 4 + Task/System-time/Hoon/system-time.hoon | 1 + Task/System-time/LFE/system-time-1.lfe | 2 + Task/System-time/LFE/system-time-2.lfe | 2 + Task/System-time/LFE/system-time-3.lfe | 4 + Task/System-time/Lasso/system-time.lasso | 2 + Task/System-time/Lingo/system-time.lingo | 15 + .../System-time/LiveCode/system-time.livecode | 1 + Task/System-time/Nim/system-time.nim | 5 + Task/System-time/Oforth/system-time-1.oforth | 2 + Task/System-time/Oforth/system-time-2.oforth | 3 + Task/System-time/Phix/system-time.phix | 6 + Task/System-time/Ring/system-time.ring | 25 + Task/System-time/Sidef/system-time.sidef | 8 + Task/System-time/Swift/system-time.swift | 4 + Task/System-time/Ursa/system-time.ursa | 3 + Task/System-time/jq/system-time.jq | 5 + .../table-creation-postal-addresses.echolisp | 16 + .../FunL/table-creation-postal-addresses.funl | 37 + .../table-creation-postal-addresses.lasso | 12 + .../Nim/table-creation-postal-addresses.nim | 18 + .../table-creation-postal-addresses.sidef | 17 + .../table-creation-postal-addresses.visual | 11 + .../take-notes-on-the-command-line.lasso | 27 + .../Nim/take-notes-on-the-command-line.nim | 10 + .../Phix/take-notes-on-the-command-line.phix | 20 + .../take-notes-on-the-command-line.sidef | 9 + .../take-notes-on-the-command-line.swift | 41 ++ .../8th/temperature-conversion.8th | 32 + .../Ceylon/temperature-conversion.ceylon | 16 + .../Ezhil/temperature-conversion.ezhil | 8 + .../FOCAL/temperature-conversion.focal | 5 + .../temperature-conversion.freebasic | 20 + .../Lasso/temperature-conversion.lasso | 51 ++ .../temperature-conversion-1.livecode | 6 + .../temperature-conversion-2.livecode | 9 + .../Nim/temperature-conversion.nim | 6 + .../Oforth/temperature-conversion.oforth | 8 + .../Phix/temperature-conversion.phix | 3 + .../Ring/temperature-conversion.ring | 11 + .../Sidef/temperature-conversion.sidef | 12 + .../Ursa/temperature-conversion.ursa | 7 + .../temperature-conversion.visual | 25 + .../XLISP/temperature-conversion.xlisp | 13 + .../jq/temperature-conversion-1.jq | 37 + .../jq/temperature-conversion-2.jq | 9 + .../Axe/terminal-control-clear-the-screen.axe | 1 + .../terminal-control-clear-the-screen.comal | 1 + ...erminal-control-clear-the-screen.freebasic | 8 + .../terminal-control-clear-the-screen.lasso | 5 + .../Nim/terminal-control-clear-the-screen.nim | 2 + .../terminal-control-clear-the-screen.phix | 1 + .../terminal-control-clear-the-screen.ring | 1 + .../terminal-control-clear-the-screen-1.sidef | 2 + .../terminal-control-clear-the-screen-2.sidef | 1 + .../terminal-control-clear-the-screen-3.sidef | 1 + .../jq/terminal-control-clear-the-screen-1.jq | 1 + .../jq/terminal-control-clear-the-screen-2.jq | 1 + .../FunL/terminal-control-coloured-text.funl | 13 + .../terminal-control-coloured-text.lasso | 31 + .../Nim/terminal-control-coloured-text.nim | 23 + .../terminal-control-coloured-text.sidef | 8 + .../Axe/terminal-control-cursor-movement.axe | 8 + .../terminal-control-cursor-movement.lasso | 46 ++ .../terminal-control-cursor-positioning.axe | 1 + .../terminal-control-cursor-positioning.lasso | 3 + .../terminal-control-cursor-positioning.nim | 3 + .../terminal-control-cursor-positioning.phix | 2 + .../Phix/terminal-control-dimensions.phix | 5 + .../Ring/terminal-control-dimensions.ring | 1 + .../Sidef/terminal-control-dimensions.sidef | 4 + ...rol-display-an-extended-character.echolisp | 8 + ...ontrol-display-an-extended-character.lasso | 1 + ...-control-display-an-extended-character.nim | 5 + ...control-display-an-extended-character.phix | 1 + ...ontrol-display-an-extended-character.sidef | 4 + .../terminal-control-hiding-the-cursor.funl | 6 + .../terminal-control-hiding-the-cursor.lasso | 17 + .../terminal-control-hiding-the-cursor.phix | 3 + .../Axe/terminal-control-inverse-video.axe | 5 + .../FunL/terminal-control-inverse-video.funl | 3 + .../terminal-control-inverse-video.lasso | 3 + .../Nim/terminal-control-inverse-video.nim | 1 + .../Ring/terminal-control-inverse-video.ring | 3 + .../Nim/terminal-control-preserve-screen.nim | 10 + .../terminal-control-preserve-screen.sidef | 9 + ...ontrol-ringing-the-terminal-bell.freebasic | 4 + ...al-control-ringing-the-terminal-bell.lasso | 1 + ...inal-control-ringing-the-terminal-bell.nim | 1 + ...nal-control-ringing-the-terminal-bell.ring | 1 + ...al-control-ringing-the-terminal-bell.sidef | 1 + .../FunL/terminal-control-unicode-output.funl | 4 + .../terminal-control-unicode-output.lasso | 6 + .../Nim/terminal-control-unicode-output.nim | 6 + .../terminal-control-unicode-output.sidef | 5 + .../jq/terminal-control-unicode-output.jq | 15 + Task/Ternary-logic/Nim/ternary-logic.nim | 57 ++ Task/Ternary-logic/Phix/ternary-logic.phix | 53 ++ Task/Ternary-logic/jq/ternary-logic.jq | 32 + .../EchoLisp/test-a-function.echolisp | 9 + .../Lasso/test-a-function.lasso | 37 + .../Test-a-function/Nim/test-a-function-1.nim | 18 + .../Test-a-function/Nim/test-a-function-2.nim | 26 + .../Oforth/test-a-function.oforth | 3 + .../Test-a-function/Ring/test-a-function.ring | 2 + .../Swift/test-a-function.swift | 32 + Task/Test-a-function/jq/test-a-function-1.jq | 19 + Task/Test-a-function/jq/test-a-function-2.jq | 8 + Task/Test-a-function/jq/test-a-function-3.jq | 3 + Task/Test-a-function/jq/test-a-function-4.jq | 7 + Task/Test-a-function/jq/test-a-function-5.jq | 1 + .../Nim/text-processing-1.nim | 53 ++ .../Sidef/text-processing-1.sidef | 33 + .../jq/text-processing-1-1.jq | 1 + .../jq/text-processing-1-2.jq | 1 + .../jq/text-processing-1-3.jq | 1 + .../jq/text-processing-1-4.jq | 71 ++ .../jq/text-processing-1-5.jq | 7 + .../Nim/text-processing-2.nim | 66 ++ .../Sidef/text-processing-2.sidef | 14 + .../jq/text-processing-2-1.jq | 1 + .../jq/text-processing-2-2.jq | 16 + .../jq/text-processing-2-3.jq | 19 + .../jq/text-processing-2-4.jq | 2 + .../jq/text-processing-2-5.jq | 11 + .../jq/text-processing-2-6.jq | 4 + .../jq/text-processing-2-7.jq | 16 + .../jq/text-processing-2-8.jq | 26 + .../text-processing-max-licenses-in-use.nim | 17 + .../text-processing-max-licenses-in-use.phix | 34 + .../text-processing-max-licenses-in-use.sidef | 17 + .../jq/text-processing-max-licenses-in-use.jq | 22 + Task/Textonyms/Sidef/textonyms.sidef | 20 + Task/Textonyms/jq/textonyms-1.jq | 40 ++ Task/Textonyms/jq/textonyms-2.jq | 9 + .../FreeBASIC/the-isaac-cipher.freebasic | 239 +++++++ .../Sidef/the-isaac-cipher.sidef | 20 + .../the-twelve-days-of-christmas.freebasic | 32 + .../Nim/the-twelve-days-of-christmas.nim | 24 + .../Sidef/the-twelve-days-of-christmas.sidef | 29 + .../Swift/the-twelve-days-of-christmas.swift | 29 + .../Sidef/thieles-interpolation-formula.sidef | 39 ++ Task/Tic-tac-toe/Lasso/tic-tac-toe.lasso | 95 +++ Task/Tic-tac-toe/Phix/tic-tac-toe.phix | 85 +++ Task/Tic-tac-toe/Ring/tic-tac-toe.ring | 129 ++++ .../8051-Assembly/time-a-function.8051 | 105 +++ .../FreeBASIC/time-a-function.freebasic | 19 + .../Lasso/time-a-function.lasso | 5 + .../Lingo/time-a-function-1.lingo | 5 + .../Lingo/time-a-function-2.lingo | 5 + Task/Time-a-function/Nim/time-a-function.nim | 14 + .../Time-a-function/Phix/time-a-function.phix | 3 + .../Time-a-function/Ring/time-a-function.ring | 7 + .../Sidef/time-a-function.sidef | 20 + .../Time-a-function/Wart/time-a-function.wart | 3 + .../Ceylon/tokenize-a-string.ceylon | 5 + .../LFE/tokenize-a-string.lfe | 4 + .../Lingo/tokenize-a-string.lingo | 9 + .../Nim/tokenize-a-string.nim | 5 + .../Oforth/tokenize-a-string.oforth | 1 + .../Phix/tokenize-a-string.phix | 1 + .../Ring/tokenize-a-string.ring | 1 + .../Sidef/tokenize-a-string.sidef | 1 + .../Swift/tokenize-a-string-1.swift | 5 + .../Swift/tokenize-a-string-2.swift | 5 + .../Swift/tokenize-a-string-3.swift | 5 + .../Ursa/tokenize-a-string.ursa | 8 + .../Wortel/tokenize-a-string.wortel | 1 + .../jq/tokenize-a-string-1.jq | 1 + .../jq/tokenize-a-string-2.jq | 3 + .../EchoLisp/top-rank-per-group-1.echolisp | 14 + .../EchoLisp/top-rank-per-group-2.echolisp | 39 ++ .../FunL/top-rank-per-group.funl | 27 + .../Nim/top-rank-per-group.nim | 39 ++ .../Oforth/top-rank-per-group.oforth | 27 + .../Sidef/top-rank-per-group.sidef | 28 + .../jq/top-rank-per-group-1.jq | 6 + .../jq/top-rank-per-group-2.jq | 10 + .../jq/top-rank-per-group-3.jq | 31 + Task/Topic-variable/Axe/topic-variable.axe | 2 + .../FreeBASIC/topic-variable.freebasic | 20 + .../Oforth/topic-variable.oforth | 1 + .../Topic-variable/Sidef/topic-variable.sidef | 1 + .../EchoLisp/topological-sort-1.echolisp | 26 + .../EchoLisp/topological-sort-2.echolisp | 31 + .../EchoLisp/topological-sort-3.echolisp | 13 + .../FunL/topological-sort.funl | 61 ++ .../Sidef/topological-sort.sidef | 42 ++ .../Topological-sort/jq/topological-sort-1.jq | 51 ++ .../Topological-sort/jq/topological-sort-2.jq | 14 + .../Topological-sort/jq/topological-sort-3.jq | 2 + Task/Topswops/Phix/topswops.phix | 44 ++ Task/Topswops/Potion/topswops.potion | 54 ++ Task/Topswops/jq/topswops-1.jq | 20 + Task/Topswops/jq/topswops-2.jq | 13 + Task/Topswops/jq/topswops-3.jq | 1 + Task/Topswops/jq/topswops-4.jq | 11 + .../EchoLisp/total-circles-area.echolisp | 120 ++++ .../Nim/total-circles-area.nim | 53 ++ Task/Towers-of-Hanoi/8th/towers-of-hanoi.8th | 19 + .../Towers-of-Hanoi/ERRE/towers-of-hanoi.erre | 55 ++ .../Ezhil/towers-of-hanoi.ezhil | 27 + .../FreeBASIC/towers-of-hanoi.freebasic | 17 + .../FutureBasic/towers-of-hanoi.futurebasic | 14 + .../Lasso/towers-of-hanoi-1.lasso | 14 + .../Lasso/towers-of-hanoi-2.lasso | 1 + .../Lasso/towers-of-hanoi-3.lasso | 1 + .../Lingo/towers-of-hanoi-1.lingo | 7 + .../Lingo/towers-of-hanoi-2.lingo | 8 + .../Monte/towers-of-hanoi.monte | 7 + Task/Towers-of-Hanoi/Nim/towers-of-hanoi.nim | 7 + .../Oforth/towers-of-hanoi.oforth | 8 + Task/Towers-of-Hanoi/PHL/towers-of-hanoi.phl | 16 + .../Towers-of-Hanoi/Ring/towers-of-hanoi.ring | 6 + .../Sidef/towers-of-hanoi.sidef | 11 + .../Swift/towers-of-hanoi-1.swift | 9 + .../Swift/towers-of-hanoi-2.swift | 9 + Task/Towers-of-Hanoi/jq/towers-of-hanoi.jq | 11 + .../ERRE/trabb-pardo-knuth-algorithm.erre | 22 + .../trabb-pardo-knuth-algorithm-1.echolisp | 18 + .../trabb-pardo-knuth-algorithm-2.echolisp | 20 + .../trabb-pardo-knuth-algorithm.freebasic | 35 + .../Nim/trabb-pardo-knuth-algorithm.nim | 13 + .../Ring/trabb-pardo-knuth-algorithm.ring | 12 + .../Sidef/trabb-pardo-knuth-algorithm.sidef | 8 + .../Swift/trabb-pardo-knuth-algorithm.swift | 18 + .../Symsyn/trabb-pardo-knuth-algorithm.symsyn | 37 + .../jq/trabb-pardo-knuth-algorithm-1.jq | 11 + .../jq/trabb-pardo-knuth-algorithm-2.jq | 15 + .../Ceylon/tree-traversal.ceylon | 97 +++ Task/Tree-traversal/FunL/tree-traversal.funl | 36 + .../GFA-Basic/tree-traversal.gfa | 116 +++ .../Lingo/tree-traversal-1.lingo | 28 + .../Lingo/tree-traversal-2.lingo | 51 ++ .../Lingo/tree-traversal-3.lingo | 20 + Task/Tree-traversal/Nim/tree-traversal.nim | 47 ++ .../Oforth/tree-traversal.oforth | 31 + Task/Tree-traversal/Phix/tree-traversal.phix | 46 ++ .../Tree-traversal/Sidef/tree-traversal.sidef | 28 + Task/Tree-traversal/jq/tree-traversal-1.jq | 26 + Task/Tree-traversal/jq/tree-traversal-2.jq | 17 + .../Axe/trigonometric-functions.axe | 3 + .../trigonometric-functions.freebasic | 21 + .../Nim/trigonometric-functions.nim | 14 + .../Oforth/trigonometric-functions.oforth | 28 + .../Phix/trigonometric-functions.phix | 12 + .../Ring/trigonometric-functions.ring | 9 + .../Sidef/trigonometric-functions.sidef | 20 + .../jq/trigonometric-functions-1.jq | 25 + .../jq/trigonometric-functions-2.jq | 14 + .../EchoLisp/truncatable-primes-1.echolisp | 16 + .../EchoLisp/truncatable-primes-2.echolisp | 4 + .../Nim/truncatable-primes.nim | 34 + .../Sidef/truncatable-primes.sidef | 14 + .../Lasso/truncate-a-file.lasso | 19 + .../Lingo/truncate-a-file-1.lingo | 28 + .../Lingo/truncate-a-file-2.lingo | 2 + Task/Truncate-a-file/Nim/truncate-a-file.nim | 3 + .../Truncate-a-file/Ring/truncate-a-file.ring | 5 + .../Sidef/truncate-a-file.sidef | 9 + .../ERRE/twelve-statements.erre | 59 ++ .../Phix/twelve-statements.phix | 27 + .../Swift/twelve-statements-1.swift | 113 +++ .../Swift/twelve-statements-2.swift | 98 +++ .../Twelve-statements/jq/twelve-statements.jq | 51 ++ Task/URL-decoding/Apex/url-decoding.apex | 2 + Task/URL-decoding/Lasso/url-decoding.lasso | 1 + .../LiveCode/url-decoding-1.livecode | 2 + .../LiveCode/url-decoding-2.livecode | 2 + Task/URL-decoding/Nim/url-decoding.nim | 3 + Task/URL-decoding/Sidef/url-decoding.sidef | 7 + Task/URL-decoding/Swift/url-decoding.swift | 6 + Task/URL-decoding/jq/url-decoding-1.jq | 27 + Task/URL-decoding/jq/url-decoding-2.jq | 1 + Task/URL-decoding/jq/url-decoding-3.jq | 1 + Task/URL-encoding/Apex/url-encoding.apex | 1 + Task/URL-encoding/Lasso/url-encoding.lasso | 1 + Task/URL-encoding/Lingo/url-encoding.lingo | 2 + .../LiveCode/url-encoding.livecode | 2 + Task/URL-encoding/Nim/url-encoding.nim | 3 + Task/URL-encoding/Sidef/url-encoding.sidef | 7 + Task/URL-encoding/jq/url-encoding-1.jq | 1 + Task/URL-encoding/jq/url-encoding-2.jq | 9 + Task/URL-encoding/jq/url-encoding-3.jq | 1 + Task/URL-encoding/jq/url-encoding-4.jq | 1 + Task/URL-encoding/jq/url-encoding-5.jq | 1 + Task/URL-encoding/jq/url-encoding-6.jq | 1 + .../ERRE/ulam-spiral--for-primes-.erre | 78 +++ .../ulam-spiral--for-primes-.echolisp | 5 + .../Sidef/ulam-spiral--for-primes-.sidef | 27 + .../ERRE/unbias-a-random-generator.erre | 30 + .../Nim/unbias-a-random-generator.nim | 38 + .../Phix/unbias-a-random-generator.phix | 25 + .../Ring/unbias-a-random-generator.ring | 19 + .../Sidef/unbias-a-random-generator.sidef | 22 + .../FreeBASIC/undefined-values.freebasic | 8 + .../Lingo/undefined-values.lingo | 9 + .../Phix/undefined-values.phix | 13 + .../Sidef/undefined-values.sidef | 13 + .../Undefined-values/jq/undefined-values-1.jq | 1 + .../Undefined-values/jq/undefined-values-2.jq | 1 + .../Undefined-values/jq/undefined-values-3.jq | 1 + .../Unicode-strings/LFE/unicode-strings-1.lfe | 2 + .../Unicode-strings/LFE/unicode-strings-2.lfe | 2 + .../Unicode-strings/LFE/unicode-strings-3.lfe | 2 + .../Lasso/unicode-strings.lasso | 7 + .../Lingo/unicode-strings.lingo | 10 + Task/Unicode-strings/Nim/unicode-strings.nim | 4 + .../Sidef/unicode-strings.sidef | 19 + .../8th/unicode-variable-names.8th | 19 + .../EchoLisp/unicode-variable-names.echolisp | 4 + .../unicode-variable-names.freebasic | 6 + .../Lily/unicode-variable-names.lily | 3 + .../Lingo/unicode-variable-names.lingo | 4 + .../LiveCode/unicode-variable-names.livecode | 4 + .../Nim/unicode-variable-names.nim | 3 + .../Peloton/unicode-variable-names-1.peloton | 3 + .../Peloton/unicode-variable-names-2.peloton | 3 + .../Phix/unicode-variable-names.phix | 3 + .../Sidef/unicode-variable-names.sidef | 3 + .../Swift/unicode-variable-names.swift | 5 + .../universal-turing-machine-1.echolisp | 101 +++ .../universal-turing-machine-2.echolisp | 8 + .../Nim/universal-turing-machine.nim | 76 ++ .../PHL/universal-turing-machine.phl | 152 ++++ .../universal-turing-machine-1.sequencel | 218 ++++++ .../universal-turing-machine-2.sequencel | 67 ++ .../Sidef/universal-turing-machine.sidef | 98 +++ Task/Unix-ls/8th/unix-ls.8th | 3 + Task/Unix-ls/EchoLisp/unix-ls.echolisp | 16 + Task/Unix-ls/FunL/unix-ls.funl | 4 + Task/Unix-ls/LiveCode/unix-ls.livecode | 4 + Task/Unix-ls/Nim/unix-ls.nim | 4 + Task/Unix-ls/Sidef/unix-ls-1.sidef | 9 + Task/Unix-ls/Sidef/unix-ls-2.sidef | 3 + Task/Unix-ls/Ursa/unix-ls.ursa | 7 + .../update-a-configuration-file.freebasic | 105 +++ .../Lasso/update-a-configuration-file-1.lasso | 99 +++ .../Lasso/update-a-configuration-file-2.lasso | 15 + ...-another-language-to-call-a-function-1.nim | 9 + ...-another-language-to-call-a-function-2.nim | 20 + ...e-another-language-to-call-a-function.phix | 10 + .../Phix/user-input-graphical.phix | 37 + .../Ring/user-input-graphical.ring | 43 ++ .../Sidef/user-input-graphical.sidef | 182 +++++ Task/User-input-Text/Axe/user-input-text.axe | 35 + .../Ceylon/user-input-text.ceylon | 8 + .../FreeBASIC/user-input-text.freebasic | 11 + .../Lasso/user-input-text.lasso | 31 + Task/User-input-Text/Nim/user-input-text.nim | 4 + .../Oforth/user-input-text.oforth | 8 + .../User-input-Text/Phix/user-input-text.phix | 2 + .../User-input-Text/Ring/user-input-text.ring | 4 + .../Sidef/user-input-text-1.sidef | 2 + .../Sidef/user-input-text-2.sidef | 2 + .../Swift/user-input-text.swift | 4 + .../User-input-Text/Ursa/user-input-text.ursa | 14 + Task/User-input-Text/jq/user-input-text-1.jq | 8 + Task/User-input-Text/jq/user-input-text-2.jq | 13 + .../FreeBASIC/vampire-number.freebasic | 106 +++ .../ERRE/van-der-corput-sequence.erre | 27 + .../van-der-corput-sequence.freebasic | 42 ++ .../Phix/van-der-corput-sequence.phix | 44 ++ .../Ring/van-der-corput-sequence.ring | 19 + .../Sidef/van-der-corput-sequence.sidef | 15 + .../jq/van-der-corput-sequence-1.jq | 16 + .../jq/van-der-corput-sequence-2.jq | 5 + .../jq/van-der-corput-sequence-3.jq | 5 + .../variable-length-quantity-1.livecode | 86 +++ .../variable-length-quantity-2.livecode | 67 ++ .../Nim/variable-length-quantity.nim | 24 + .../Phix/variable-length-quantity.phix | 44 ++ .../FreeBASIC/variable-size-get.freebasic | 20 + .../Lasso/variable-size-get.lasso | 22 + .../Nim/variable-size-get.nim | 1 + .../Ring/variable-size-get.ring | 11 + .../Swift/variable-size-get-1.swift | 1 + .../Swift/variable-size-get-2.swift | 9 + .../Nim/variable-size-set.nim | 4 + Task/Variables/8th/variables.8th | 11 + Task/Variables/Apex/variables.apex | 15 + Task/Variables/Axe/variables-1.axe | 1 + Task/Variables/Axe/variables-2.axe | 1 + Task/Variables/ChucK/variables-1.chuck | 1 + Task/Variables/ChucK/variables-2.chuck | 1 + Task/Variables/ChucK/variables-3.chuck | 1 + Task/Variables/Lasso/variables.lasso | 41 ++ Task/Variables/Lingo/variables-1.lingo | 3 + Task/Variables/Lingo/variables-2.lingo | 3 + Task/Variables/Lingo/variables-3.lingo | 2 + Task/Variables/Lingo/variables-4.lingo | 4 + Task/Variables/Lingo/variables-5.lingo | 4 + Task/Variables/Lingo/variables-6.lingo | 4 + Task/Variables/Lingo/variables-7.lingo | 1 + Task/Variables/Lingo/variables-8.lingo | 1 + Task/Variables/Nim/variables.nim | 11 + Task/Variables/Oforth/variables.oforth | 6 + Task/Variables/Phix/variables-1.phix | 2 + Task/Variables/Phix/variables-2.phix | 6 + Task/Variables/Pony/variables-1.pony | 8 + Task/Variables/Pony/variables-2.pony | 6 + Task/Variables/Ring/variables-1.ring | 1 + Task/Variables/Ring/variables-2.ring | 16 + Task/Variables/Ring/variables-3.ring | 6 + Task/Variables/Ring/variables-4.ring | 2 + Task/Variables/Ring/variables-5.ring | 5 + Task/Variables/Set-lang/variables.set | 11 + Task/Variables/Swift/variables.swift | 71 ++ Task/Variables/Ursa/variables.ursa | 43 ++ Task/Variables/jq/variables-1.jq | 1 + Task/Variables/jq/variables-2.jq | 1 + Task/Variables/jq/variables-3.jq | 2 + Task/Variables/jq/variables-4.jq | 1 + .../Lasso/variadic-function-1.lasso | 5 + .../Lasso/variadic-function-2.lasso | 2 + .../Lasso/variadic-function-3.lasso | 8 + .../Nim/variadic-function-1.nim | 3 + .../Nim/variadic-function-2.nim | 6 + .../Oforth/variadic-function.oforth | 1 + .../Phix/variadic-function.phix | 6 + .../Sidef/variadic-function-1.sidef | 3 + .../Sidef/variadic-function-2.sidef | 3 + .../Sidef/variadic-function-3.sidef | 2 + .../Swift/variadic-function-1.swift | 6 + .../Swift/variadic-function-2.swift | 3 + .../XLISP/variadic-function.xlisp | 14 + .../jq/variadic-function-1.jq | 1 + .../jq/variadic-function-2.jq | 1 + .../jq/variadic-function-3.jq | 1 + .../jq/variadic-function-4.jq | 3 + .../jq/variadic-function-5.jq | 13 + .../jq/variadic-function-6.jq | 6 + .../Vector-products/ERRE/vector-products.erre | 57 ++ .../EchoLisp/vector-products.echolisp | 20 + .../FreeBASIC/vector-products.freebasic | 32 + .../Vector-products/FunL/vector-products.funl | 13 + .../Lingo/vector-products.lingo | 11 + Task/Vector-products/Nim/vector-products.nim | 33 + .../Vector-products/Phix/vector-products.phix | 23 + .../Sidef/vector-products.sidef | 25 + .../Wortel/vector-products.wortel | 21 + Task/Vector-products/jq/vector-products-1.jq | 21 + Task/Vector-products/jq/vector-products-2.jq | 4 + ...tribution-uniformity-chi-squared-test-1.hy | 11 + ...tribution-uniformity-chi-squared-test-2.hy | 6 + .../verify-distribution-uniformity-naive-1.hy | 12 + .../verify-distribution-uniformity-naive-2.hy | 4 + Task/Vigen-re-cipher/Nim/vigen-re-cipher.nim | 28 + .../Sidef/vigen-re-cipher.sidef | 12 + .../TypeScript/vigen-re-cipher.type | 47 ++ .../Lingo/visualize-a-tree-1.lingo | 25 + .../Lingo/visualize-a-tree-2.lingo | 17 + .../Visualize-a-tree/Nim/visualize-a-tree.nim | 25 + .../Phix/visualize-a-tree-1.phix | 40 ++ .../Phix/visualize-a-tree-2.phix | 1 + .../Sidef/visualize-a-tree.sidef | 21 + .../Sidef/voronoi-diagram.sidef | 30 + .../walk-a-directory-non-recursively.68000 | 179 +++++ .../8th/walk-a-directory-non-recursively.8th | 1 + .../walk-a-directory-non-recursively.lasso | 5 + .../walk-a-directory-non-recursively.lingo | 12 + .../walk-a-directory-non-recursively.livecode | 4 + .../Nim/walk-a-directory-non-recursively.nim | 4 + .../walk-a-directory-non-recursively.phix | 1 + .../walk-a-directory-non-recursively-1.sidef | 1 + .../walk-a-directory-non-recursively-2.sidef | 16 + .../8th/walk-a-directory-recursively.8th | 1 + .../Lasso/walk-a-directory-recursively.lasso | 30 + .../walk-a-directory-recursively-1.livecode | 20 + .../walk-a-directory-recursively-2.livecode | 1 + .../Nim/walk-a-directory-recursively.nim | 5 + .../Phix/walk-a-directory-recursively.phix | 9 + .../Ring/walk-a-directory-recursively.ring | 10 + .../Sidef/walk-a-directory-recursively.sidef | 22 + .../Swift/walk-a-directory-recursively.swift | 21 + Task/Web-scraping/8th/web-scraping.8th | 14 + .../App-Inventor/web-scraping.app | 9 + Task/Web-scraping/FunL/web-scraping.funl | 5 + Task/Web-scraping/Lasso/web-scraping.lasso | 27 + Task/Web-scraping/Nim/web-scraping.nim | 5 + .../Peloton/web-scraping-1.peloton | 5 + .../Peloton/web-scraping-2.peloton | 5 + .../Peloton/web-scraping-3.peloton | 1 + Task/Web-scraping/Sidef/web-scraping.sidef | 4 + .../ToffeeScript/web-scraping.toffee | 3 + Task/Web-scraping/jq/web-scraping-1.jq | 3 + Task/Web-scraping/jq/web-scraping-2.jq | 2 + .../FreeBASIC/window-creation.freebasic | 16 + .../Lingo/window-creation.lingo | 12 + .../Window-creation/Nim/window-creation-1.nim | 52 ++ .../Window-creation/Nim/window-creation-2.nim | 48 ++ .../Window-creation/Nim/window-creation-3.nim | 73 ++ .../Window-creation/Nim/window-creation-4.nim | 13 + .../Window-creation/Nim/window-creation-5.nim | 9 + .../Window-creation/Nim/window-creation-6.nim | 24 + .../Window-creation/Phix/window-creation.phix | 13 + .../Window-creation/Ring/window-creation.ring | 8 + .../Sidef/window-creation-1.sidef | 3 + .../Sidef/window-creation-2.sidef | 5 + .../Nim/window-management-1.nim | 79 +++ .../Nim/window-management-2.nim | 68 ++ .../Phix/window-management.phix | 69 ++ .../Ring/window-management.ring | 152 ++++ Task/Wireworld/Nim/wireworld.nim | 36 + Task/Wireworld/Sidef/wireworld.sidef | 31 + Task/Wireworld/jq/wireworld-1.jq | 37 + Task/Wireworld/jq/wireworld-2.jq | 26 + Task/Wireworld/jq/wireworld-3.jq | 15 + Task/Wireworld/jq/wireworld-4.jq | 2 + Task/Wireworld/jq/wireworld-5.jq | 2 + Task/Word-wrap/LFE/word-wrap-1.lfe | 25 + Task/Word-wrap/LFE/word-wrap-2.lfe | 9 + Task/Word-wrap/LFE/word-wrap-3.lfe | 4 + Task/Word-wrap/LFE/word-wrap-4.lfe | 1 + Task/Word-wrap/Lasso/word-wrap.lasso | 14 + Task/Word-wrap/Lingo/word-wrap-1.lingo | 42 ++ Task/Word-wrap/Lingo/word-wrap-2.lingo | 12 + Task/Word-wrap/Nim/word-wrap.nim | 6 + Task/Word-wrap/Sidef/word-wrap-1.sidef | 18 + Task/Word-wrap/Sidef/word-wrap-2.sidef | 90 +++ Task/Word-wrap/jq/word-wrap-1.jq | 14 + Task/Word-wrap/jq/word-wrap-2.jq | 1 + Task/Word-wrap/jq/word-wrap-3.jq | 1 + Task/Word-wrap/jq/word-wrap-4.jq | 3 + Task/Word-wrap/jq/word-wrap-5.jq | 8 + ...rite-float-arrays-to-a-text-file.freebasic | 13 + .../write-float-arrays-to-a-text-file-1.lingo | 15 + .../write-float-arrays-to-a-text-file-2.lingo | 3 + .../Nim/write-float-arrays-to-a-text-file.nim | 21 + .../write-float-arrays-to-a-text-file.phix | 8 + .../write-float-arrays-to-a-text-file.sidef | 14 + .../jq/write-float-arrays-to-a-text-file-1.jq | 4 + .../jq/write-float-arrays-to-a-text-file-2.jq | 1 + .../ERRE/write-language-name-in-3d-ascii.erre | 36 + .../write-language-name-in-3d-ascii.lasso | 20 + .../Nim/write-language-name-in-3d-ascii.nim | 13 + .../Phix/write-language-name-in-3d-ascii.phix | 9 + .../write-language-name-in-3d-ascii.sidef | 21 + .../Lasso/xml-dom-serialization.lasso | 3 + .../Lingo/xml-dom-serialization.lingo | 14 + .../Nim/xml-dom-serialization.nim | 13 + .../Sidef/xml-dom-serialization.sidef | 5 + Task/XML-Input/8th/xml-input.8th | 22 + Task/XML-Input/Lasso/xml-input-1.lasso | 30 + Task/XML-Input/Lasso/xml-input-2.lasso | 11 + Task/XML-Input/Lingo/xml-input.lingo | 18 + Task/XML-Input/LiveCode/xml-input.livecode | 2 + Task/XML-Input/Nim/xml-input.nim | 14 + Task/XML-Input/Sidef/xml-input.sidef | 13 + Task/XML-Output/Lasso/xml-output-1.lasso | 36 + Task/XML-Output/Lasso/xml-output-2.lasso | 8 + Task/XML-Output/Nim/xml-output.nim | 11 + Task/XML-Output/Phix/xml-output.phix | 33 + Task/XML-Output/Sidef/xml-output.sidef | 19 + Task/XML-XPath/Lasso/xml-xpath.lasso | 70 ++ Task/XML-XPath/LiveCode/xml-xpath.livecode | 14 + Task/XML-XPath/Nim/xml-xpath.nim | 13 + Task/XML-XPath/Sidef/xml-xpath.sidef | 7 + .../xiaolin-wus-line-algorithm.freebasic | 127 ++++ .../Sidef/xiaolin-wus-line-algorithm.sidef | 58 ++ .../Y-combinator/Ceylon/y-combinator-1.ceylon | 22 + .../Y-combinator/Ceylon/y-combinator-2.ceylon | 11 + .../Y-combinator/Ceylon/y-combinator-3.ceylon | 4 + .../EchoLisp/y-combinator.echolisp | 23 + Task/Y-combinator/Eero/y-combinator.eero | 29 + .../Y-combinator/Oforth/y-combinator-1.oforth | 1 + .../Y-combinator/Oforth/y-combinator-2.oforth | 2 + .../Y-combinator/Oforth/y-combinator-3.oforth | 11 + Task/Y-combinator/Sidef/y-combinator.sidef | 7 + Task/Y-combinator/Swift/y-combinator-1.swift | 17 + Task/Y-combinator/Swift/y-combinator-2.swift | 5 + Task/Y-combinator/Swift/y-combinator-3.swift | 3 + Task/Y-combinator/Wart/y-combinator.wart | 13 + .../Commodore-BASIC/yin-and-yang.commodore | 9 + Task/Yin-and-yang/PHL/yin-and-yang.phl | 66 ++ Task/Yin-and-yang/Sidef/yin-and-yang.sidef | 24 + Task/Yin-and-yang/jq/yin-and-yang-1.jq | 29 + Task/Yin-and-yang/jq/yin-and-yang-2.jq | 1 + Task/Zebra-puzzle/ERRE/zebra-puzzle.erre | 106 +++ .../EchoLisp/zebra-puzzle-1.echolisp | 72 ++ .../EchoLisp/zebra-puzzle-2.echolisp | 12 + .../FormulaOne/zebra-puzzle.formulaone | 175 +++++ Task/Zebra-puzzle/Phix/zebra-puzzle.phix | 81 +++ Task/Zebra-puzzle/Sidef/zebra-puzzle.sidef | 52 ++ Task/Zebra-puzzle/jq/zebra-puzzle-1.jq | 22 + Task/Zebra-puzzle/jq/zebra-puzzle-2.jq | 60 ++ Task/Zebra-puzzle/jq/zebra-puzzle-3.jq | 48 ++ .../zeckendorf-number-representation.echolisp | 27 + ...zeckendorf-number-representation.freebasic | 68 ++ .../Nim/zeckendorf-number-representation.nim | 19 + .../zeckendorf-number-representation.sidef | 21 + .../jq/zeckendorf-number-representation-1.jq | 23 + .../jq/zeckendorf-number-representation-2.jq | 1 + .../jq/zeckendorf-number-representation-3.jq | 22 + .../8th/zero-to-the-zero-power.8th | 1 + .../ERRE/zero-to-the-zero-power.erre | 3 + .../EchoLisp/zero-to-the-zero-power.echolisp | 7 + .../zero-to-the-zero-power.freebasic | 4 + .../zero-to-the-zero-power.futurebasic | 3 + .../Nim/zero-to-the-zero-power.nim | 3 + .../Oforth/zero-to-the-zero-power.oforth | 1 + .../Phix/zero-to-the-zero-power.phix | 1 + .../Ring/zero-to-the-zero-power.ring | 4 + .../Sidef/zero-to-the-zero-power-1.sidef | 6 + .../Sidef/zero-to-the-zero-power-2.sidef | 2 + .../Swift/zero-to-the-zero-power.swift | 2 + .../Ursa/zero-to-the-zero-power.ursa | 2 + .../XLISP/zero-to-the-zero-power.xlisp | 5 + .../jq/zero-to-the-zero-power.jq | 1 + .../zhang-suen-thinning-algorithm.freebasic | 135 ++++ .../Phix/zhang-suen-thinning-algorithm.phix | 65 ++ .../Sidef/zhang-suen-thinning-algorithm.sidef | 57 ++ Task/Zig-zag-matrix/ERRE/zig-zag-matrix.erre | 29 + .../FreeBASIC/zig-zag-matrix.freebasic | 74 ++ .../Zig-zag-matrix/Lasso/zig-zag-matrix.lasso | 75 ++ Task/Zig-zag-matrix/Nim/zig-zag-matrix.nim | 36 + .../Zig-zag-matrix/Phix/zig-zag-matrix-1.phix | 27 + .../Zig-zag-matrix/Phix/zig-zag-matrix-2.phix | 17 + .../Zig-zag-matrix/Sidef/zig-zag-matrix.sidef | 24 + Task/Zig-zag-matrix/jq/zig-zag-matrix-1.jq | 18 + Task/Zig-zag-matrix/jq/zig-zag-matrix-2.jq | 19 + 13208 files changed, 134745 insertions(+) create mode 100644 Lang/68000-Assembly/00DESCRIPTION create mode 120000 Lang/68000-Assembly/100-doors create mode 120000 Lang/68000-Assembly/Ackermann-function create mode 100644 Lang/68000-Assembly/README create mode 120000 Lang/68000-Assembly/Sieve-of-Eratosthenes create mode 120000 Lang/68000-Assembly/Walk-a-directory-Non-recursively create mode 100644 Lang/8051-Assembly/00DESCRIPTION create mode 120000 Lang/8051-Assembly/Arrays create mode 120000 Lang/8051-Assembly/Bitwise-operations create mode 120000 Lang/8051-Assembly/Boolean-values create mode 120000 Lang/8051-Assembly/Empty-program create mode 120000 Lang/8051-Assembly/Function-definition create mode 120000 Lang/8051-Assembly/Integer-comparison create mode 100644 Lang/8051-Assembly/README create mode 120000 Lang/8051-Assembly/Sleep create mode 120000 Lang/8051-Assembly/Time-a-function create mode 100644 Lang/8th/00DESCRIPTION create mode 120000 Lang/8th/100-doors create mode 120000 Lang/8th/24-game create mode 120000 Lang/8th/99-Bottles-of-Beer create mode 120000 Lang/8th/A+B create mode 120000 Lang/8th/Ackermann-function create mode 120000 Lang/8th/Align-columns create mode 120000 Lang/8th/Apply-a-callback-to-an-array create mode 120000 Lang/8th/Arbitrary-precision-integers--included- create mode 120000 Lang/8th/Arrays create mode 120000 Lang/8th/Averages-Arithmetic-mean create mode 120000 Lang/8th/Binary-digits create mode 120000 Lang/8th/Call-a-foreign-language-function create mode 120000 Lang/8th/Date-format create mode 120000 Lang/8th/Delete-a-file create mode 120000 Lang/8th/Detect-division-by-zero create mode 120000 Lang/8th/Determine-if-a-string-is-numeric create mode 120000 Lang/8th/Dot-product create mode 120000 Lang/8th/Empty-string create mode 120000 Lang/8th/Enforced-immutability create mode 120000 Lang/8th/Even-or-odd create mode 120000 Lang/8th/Evolutionary-algorithm create mode 120000 Lang/8th/Fibonacci-sequence create mode 120000 Lang/8th/FizzBuzz create mode 120000 Lang/8th/Flatten-a-list create mode 120000 Lang/8th/Formatted-numeric-output create mode 120000 Lang/8th/Generate-lower-case-ASCII-alphabet create mode 120000 Lang/8th/Generic-swap create mode 120000 Lang/8th/Greatest-common-divisor create mode 120000 Lang/8th/Greatest-element-of-a-list create mode 120000 Lang/8th/HTTP create mode 120000 Lang/8th/Hello-world-Text create mode 120000 Lang/8th/Here-document create mode 120000 Lang/8th/Higher-order-functions create mode 120000 Lang/8th/Integer-comparison create mode 120000 Lang/8th/Keyboard-input-Obtain-a-Y-or-N-response create mode 120000 Lang/8th/Least-common-multiple create mode 120000 Lang/8th/Loops-For create mode 120000 Lang/8th/Loops-Infinite create mode 120000 Lang/8th/MD5 create mode 120000 Lang/8th/Modular-inverse create mode 120000 Lang/8th/Null-object create mode 120000 Lang/8th/One-dimensional-cellular-automata create mode 120000 Lang/8th/Parametrized-SQL-statement create mode 120000 Lang/8th/Pascals-triangle create mode 120000 Lang/8th/Queue-Usage create mode 100644 Lang/8th/README create mode 120000 Lang/8th/Range-expansion create mode 120000 Lang/8th/Read-a-file-line-by-line create mode 120000 Lang/8th/Read-entire-file create mode 120000 Lang/8th/Regular-expressions create mode 120000 Lang/8th/Repeat-a-string create mode 120000 Lang/8th/Reverse-a-string create mode 120000 Lang/8th/Semordnilap create mode 120000 Lang/8th/Sleep create mode 120000 Lang/8th/Sort-an-integer-array create mode 120000 Lang/8th/Temperature-conversion create mode 120000 Lang/8th/Towers-of-Hanoi create mode 120000 Lang/8th/Unicode-variable-names create mode 120000 Lang/8th/Unix-ls create mode 120000 Lang/8th/Variables create mode 120000 Lang/8th/Walk-a-directory-Non-recursively create mode 120000 Lang/8th/Walk-a-directory-Recursively create mode 120000 Lang/8th/Web-scraping create mode 120000 Lang/8th/XML-Input create mode 120000 Lang/8th/Zero-to-the-zero-power create mode 100644 Lang/AngelScript/00DESCRIPTION create mode 100644 Lang/AngelScript/README create mode 100644 Lang/AntLang/00DESCRIPTION create mode 120000 Lang/AntLang/Array-concatenation create mode 120000 Lang/AntLang/Arrays create mode 120000 Lang/AntLang/Averages-Arithmetic-mean create mode 120000 Lang/AntLang/Averages-Median create mode 120000 Lang/AntLang/Call-a-function create mode 120000 Lang/AntLang/Closures-Value-capture create mode 120000 Lang/AntLang/Comments create mode 120000 Lang/AntLang/Even-or-odd create mode 120000 Lang/AntLang/Factorial create mode 120000 Lang/AntLang/Fibonacci-sequence create mode 120000 Lang/AntLang/Filter create mode 120000 Lang/AntLang/FizzBuzz create mode 120000 Lang/AntLang/Function-composition create mode 120000 Lang/AntLang/Function-definition create mode 120000 Lang/AntLang/Greatest-common-divisor create mode 120000 Lang/AntLang/Greatest-element-of-a-list create mode 120000 Lang/AntLang/Hello-world-Text create mode 120000 Lang/AntLang/Hello-world-Web-server create mode 120000 Lang/AntLang/Higher-order-functions create mode 120000 Lang/AntLang/Include-a-file create mode 120000 Lang/AntLang/JSON create mode 100644 Lang/AntLang/README create mode 120000 Lang/AntLang/Sleep create mode 100644 Lang/Apex/00DESCRIPTION create mode 120000 Lang/Apex/99-Bottles-of-Beer create mode 120000 Lang/Apex/A+B create mode 120000 Lang/Apex/ABC-Problem create mode 120000 Lang/Apex/Abstract-type create mode 120000 Lang/Apex/Array-concatenation create mode 120000 Lang/Apex/Arrays create mode 120000 Lang/Apex/Assertions create mode 120000 Lang/Apex/Associative-array-Creation create mode 120000 Lang/Apex/Call-an-object-method create mode 120000 Lang/Apex/Collections create mode 120000 Lang/Apex/Comments create mode 120000 Lang/Apex/Conditional-structures create mode 120000 Lang/Apex/Copy-a-string create mode 120000 Lang/Apex/Count-occurrences-of-a-substring create mode 120000 Lang/Apex/Date-format create mode 120000 Lang/Apex/Determine-if-a-string-is-numeric create mode 120000 Lang/Apex/Empty-string create mode 120000 Lang/Apex/Factorial create mode 120000 Lang/Apex/Fibonacci-sequence create mode 120000 Lang/Apex/Filter create mode 120000 Lang/Apex/Increment-a-numerical-string create mode 120000 Lang/Apex/JSON create mode 120000 Lang/Apex/Logical-operations create mode 120000 Lang/Apex/Loops-For create mode 120000 Lang/Apex/Loops-Foreach create mode 100644 Lang/Apex/README create mode 120000 Lang/Apex/Reverse-a-string create mode 120000 Lang/Apex/Set create mode 120000 Lang/Apex/String-comparison create mode 120000 Lang/Apex/String-concatenation create mode 120000 Lang/Apex/String-length create mode 120000 Lang/Apex/Substring create mode 120000 Lang/Apex/Substring-Top-and-tail create mode 120000 Lang/Apex/Symmetric-difference create mode 120000 Lang/Apex/URL-decoding create mode 120000 Lang/Apex/URL-encoding create mode 120000 Lang/Apex/Variables create mode 100644 Lang/App-Inventor/00DESCRIPTION create mode 100644 Lang/App-Inventor/README create mode 120000 Lang/App-Inventor/Web-scraping create mode 100644 Lang/Apricot/00DESCRIPTION create mode 120000 Lang/Apricot/Hello-world-Text create mode 100644 Lang/Apricot/README create mode 100644 Lang/Arc/00DESCRIPTION create mode 120000 Lang/Arc/A+B create mode 120000 Lang/Arc/FizzBuzz create mode 120000 Lang/Arc/Generic-swap create mode 120000 Lang/Arc/Hostname create mode 120000 Lang/Arc/Levenshtein-distance create mode 120000 Lang/Arc/N-queens-problem create mode 100644 Lang/Arc/README create mode 100644 Lang/Arendelle/00DESCRIPTION create mode 100644 Lang/Arendelle/README create mode 100644 Lang/AutoLISP/00DESCRIPTION create mode 120000 Lang/AutoLISP/Hello-world-Text create mode 100644 Lang/AutoLISP/README create mode 100644 Lang/Axe/00DESCRIPTION create mode 120000 Lang/Axe/99-Bottles-of-Beer create mode 120000 Lang/Axe/Address-of-a-variable create mode 120000 Lang/Axe/Arrays create mode 120000 Lang/Axe/Assertions create mode 120000 Lang/Axe/Binary-digits create mode 120000 Lang/Axe/Binary-search create mode 120000 Lang/Axe/Bitmap create mode 120000 Lang/Axe/Bitwise-operations create mode 120000 Lang/Axe/Call-a-function create mode 120000 Lang/Axe/Character-codes create mode 120000 Lang/Axe/Check-that-file-exists create mode 120000 Lang/Axe/Collections create mode 120000 Lang/Axe/Color-of-a-screen-pixel create mode 120000 Lang/Axe/Comments create mode 120000 Lang/Axe/Compound-data-type create mode 120000 Lang/Axe/Conditional-structures create mode 120000 Lang/Axe/Conways-Game-of-Life create mode 120000 Lang/Axe/Copy-a-string create mode 120000 Lang/Axe/Create-a-file create mode 120000 Lang/Axe/Delete-a-file create mode 120000 Lang/Axe/Doubly-linked-list-Element-definition create mode 120000 Lang/Axe/Doubly-linked-list-Element-insertion create mode 120000 Lang/Axe/Doubly-linked-list-Traversal create mode 120000 Lang/Axe/Empty-program create mode 120000 Lang/Axe/Empty-string create mode 120000 Lang/Axe/Execute-Brain---- create mode 120000 Lang/Axe/Factorial create mode 120000 Lang/Axe/Fibonacci-sequence create mode 120000 Lang/Axe/File-size create mode 120000 Lang/Axe/Find-limit-of-recursion create mode 120000 Lang/Axe/FizzBuzz create mode 120000 Lang/Axe/Function-definition create mode 120000 Lang/Axe/Generic-swap create mode 120000 Lang/Axe/Greatest-common-divisor create mode 120000 Lang/Axe/Greatest-element-of-a-list create mode 120000 Lang/Axe/Hello-world-Graphical create mode 120000 Lang/Axe/Hello-world-Newbie create mode 120000 Lang/Axe/Hello-world-Newline-omission create mode 120000 Lang/Axe/Hello-world-Text create mode 120000 Lang/Axe/Image-noise create mode 120000 Lang/Axe/Include-a-file create mode 120000 Lang/Axe/Integer-comparison create mode 120000 Lang/Axe/Integer-overflow create mode 120000 Lang/Axe/Integer-sequence create mode 120000 Lang/Axe/Keyboard-input-Flush-the-keyboard-buffer create mode 120000 Lang/Axe/Keyboard-input-Keypress-check create mode 120000 Lang/Axe/Keyboard-input-Obtain-a-Y-or-N-response create mode 120000 Lang/Axe/Literals-Floating-point create mode 120000 Lang/Axe/Literals-Integer create mode 120000 Lang/Axe/Literals-String create mode 120000 Lang/Axe/Logical-operations create mode 120000 Lang/Axe/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/Axe/Loops-Break create mode 120000 Lang/Axe/Loops-Do-while create mode 120000 Lang/Axe/Loops-Downward-for create mode 120000 Lang/Axe/Loops-For create mode 120000 Lang/Axe/Loops-For-with-a-specified-step create mode 120000 Lang/Axe/Loops-Infinite create mode 120000 Lang/Axe/Loops-N-plus-one-half create mode 120000 Lang/Axe/Loops-While create mode 120000 Lang/Axe/Memory-allocation create mode 120000 Lang/Axe/Menu create mode 120000 Lang/Axe/Multiplication-tables create mode 120000 Lang/Axe/Null-object create mode 120000 Lang/Axe/Program-termination create mode 100644 Lang/Axe/README create mode 120000 Lang/Axe/Real-constants-and-functions create mode 120000 Lang/Axe/Short-circuit-evaluation create mode 120000 Lang/Axe/Singly-linked-list-Element-definition create mode 120000 Lang/Axe/Singly-linked-list-Element-insertion create mode 120000 Lang/Axe/Singly-linked-list-Traversal create mode 120000 Lang/Axe/Sleep create mode 120000 Lang/Axe/Sort-an-integer-array create mode 120000 Lang/Axe/Stack create mode 120000 Lang/Axe/String-append create mode 120000 Lang/Axe/String-concatenation create mode 120000 Lang/Axe/String-length create mode 120000 Lang/Axe/Substring create mode 120000 Lang/Axe/Terminal-control-Clear-the-screen create mode 120000 Lang/Axe/Terminal-control-Cursor-movement create mode 120000 Lang/Axe/Terminal-control-Cursor-positioning create mode 120000 Lang/Axe/Terminal-control-Inverse-video create mode 120000 Lang/Axe/Topic-variable create mode 120000 Lang/Axe/Trigonometric-functions create mode 120000 Lang/Axe/User-input-Text create mode 120000 Lang/Axe/Variables create mode 100644 Lang/B4J/00DESCRIPTION create mode 100644 Lang/B4J/README create mode 120000 Lang/B4J/Simple-windowed-application create mode 100644 Lang/BML/00DESCRIPTION create mode 120000 Lang/BML/Arrays create mode 120000 Lang/BML/Hello-world-Graphical create mode 120000 Lang/BML/Hello-world-Text create mode 100644 Lang/BML/README create mode 100644 Lang/Battlestar/00DESCRIPTION create mode 120000 Lang/Battlestar/99-Bottles-of-Beer create mode 120000 Lang/Battlestar/Fibonacci-sequence create mode 120000 Lang/Battlestar/Hello-world-Text create mode 100644 Lang/Battlestar/README create mode 100644 Lang/Beeswax/00DESCRIPTION create mode 100644 Lang/Beeswax/README create mode 100644 Lang/Binary-Lambda-Calculus/00DESCRIPTION create mode 100644 Lang/Binary-Lambda-Calculus/README create mode 100644 Lang/CHR/00DESCRIPTION create mode 100644 Lang/CHR/README create mode 100644 Lang/CafeOBJ/00DESCRIPTION create mode 100644 Lang/CafeOBJ/README create mode 120000 Lang/CafeOBJ/Remove-duplicate-elements create mode 100644 Lang/Ceylon/00DESCRIPTION create mode 120000 Lang/Ceylon/100-doors create mode 120000 Lang/Ceylon/24-game create mode 120000 Lang/Ceylon/99-Bottles-of-Beer create mode 120000 Lang/Ceylon/A+B create mode 120000 Lang/Ceylon/ABC-Problem create mode 120000 Lang/Ceylon/Abundant,-deficient-and-perfect-number-classifications create mode 120000 Lang/Ceylon/Accumulator-factory create mode 120000 Lang/Ceylon/Animation create mode 120000 Lang/Ceylon/Array-concatenation create mode 120000 Lang/Ceylon/Arrays create mode 120000 Lang/Ceylon/Associative-array-Creation create mode 120000 Lang/Ceylon/Associative-array-Iteration create mode 120000 Lang/Ceylon/Balanced-brackets create mode 120000 Lang/Ceylon/Bulls-and-cows create mode 120000 Lang/Ceylon/Closures-Value-capture create mode 120000 Lang/Ceylon/Deal-cards-for-FreeCell create mode 120000 Lang/Ceylon/Detect-division-by-zero create mode 120000 Lang/Ceylon/Evolutionary-algorithm create mode 120000 Lang/Ceylon/Execute-HQ9+ create mode 120000 Lang/Ceylon/Factorial create mode 120000 Lang/Ceylon/Factors-of-an-integer create mode 120000 Lang/Ceylon/First-class-functions create mode 120000 Lang/Ceylon/Five-weekends create mode 120000 Lang/Ceylon/FizzBuzz create mode 120000 Lang/Ceylon/Flatten-a-list create mode 120000 Lang/Ceylon/Forest-fire create mode 120000 Lang/Ceylon/Guess-the-number-With-feedback create mode 120000 Lang/Ceylon/Guess-the-number-With-feedback--player- create mode 120000 Lang/Ceylon/Hailstone-sequence create mode 120000 Lang/Ceylon/Hash-from-two-arrays create mode 120000 Lang/Ceylon/Increment-a-numerical-string create mode 120000 Lang/Ceylon/Iterated-digits-squaring create mode 120000 Lang/Ceylon/Knapsack-problem-0-1 create mode 120000 Lang/Ceylon/Largest-int-from-concatenated-ints create mode 120000 Lang/Ceylon/Loops-Downward-for create mode 120000 Lang/Ceylon/Loops-For create mode 120000 Lang/Ceylon/Loops-For-with-a-specified-step create mode 120000 Lang/Ceylon/Luhn-test-of-credit-card-numbers create mode 120000 Lang/Ceylon/Menu create mode 120000 Lang/Ceylon/Mutual-recursion create mode 120000 Lang/Ceylon/One-dimensional-cellular-automata create mode 120000 Lang/Ceylon/Pangram-checker create mode 120000 Lang/Ceylon/Parametric-polymorphism create mode 120000 Lang/Ceylon/Parsing-RPN-calculator-algorithm create mode 120000 Lang/Ceylon/Parsing-Shunting-yard-algorithm create mode 120000 Lang/Ceylon/Partial-function-application create mode 120000 Lang/Ceylon/Pick-random-element create mode 120000 Lang/Ceylon/Playing-cards create mode 120000 Lang/Ceylon/Quine create mode 100644 Lang/Ceylon/README create mode 120000 Lang/Ceylon/Range-extraction create mode 120000 Lang/Ceylon/Remove-duplicate-elements create mode 120000 Lang/Ceylon/Repeat-a-string create mode 120000 Lang/Ceylon/Roman-numerals-Decode create mode 120000 Lang/Ceylon/Roman-numerals-Encode create mode 120000 Lang/Ceylon/S-Expressions create mode 120000 Lang/Ceylon/Search-a-list create mode 120000 Lang/Ceylon/Sort-using-a-custom-comparator create mode 120000 Lang/Ceylon/Stem-and-leaf-plot create mode 120000 Lang/Ceylon/Temperature-conversion create mode 120000 Lang/Ceylon/Tokenize-a-string create mode 120000 Lang/Ceylon/Tree-traversal create mode 120000 Lang/Ceylon/User-input-Text create mode 120000 Lang/Ceylon/Y-combinator create mode 100644 Lang/ChucK/00DESCRIPTION create mode 120000 Lang/ChucK/Arrays create mode 120000 Lang/ChucK/Call-an-object-method create mode 120000 Lang/ChucK/Comments create mode 120000 Lang/ChucK/Create-a-file create mode 120000 Lang/ChucK/Factorial create mode 120000 Lang/ChucK/Function-definition create mode 120000 Lang/ChucK/Hello-world-Text create mode 120000 Lang/ChucK/Include-a-file create mode 120000 Lang/ChucK/Inheritance-Single create mode 120000 Lang/ChucK/Integer-comparison create mode 120000 Lang/ChucK/Integer-sequence create mode 120000 Lang/ChucK/Loops-Do-while create mode 120000 Lang/ChucK/Loops-For-with-a-specified-step create mode 120000 Lang/ChucK/Loops-Infinite create mode 120000 Lang/ChucK/Loops-While create mode 100644 Lang/ChucK/README create mode 120000 Lang/ChucK/Record-sound create mode 120000 Lang/ChucK/String-concatenation create mode 120000 Lang/ChucK/Variables create mode 100644 Lang/Clarion/00DESCRIPTION create mode 120000 Lang/Clarion/100-doors create mode 100644 Lang/Clarion/README create mode 100644 Lang/Coco/00DESCRIPTION create mode 120000 Lang/Coco/100-doors create mode 120000 Lang/Coco/Bulls-and-cows create mode 120000 Lang/Coco/Classes create mode 120000 Lang/Coco/Count-the-coins create mode 120000 Lang/Coco/FizzBuzz create mode 120000 Lang/Coco/Function-definition create mode 120000 Lang/Coco/Hash-from-two-arrays create mode 120000 Lang/Coco/I-before-E-except-after-C create mode 120000 Lang/Coco/Inheritance-Single create mode 120000 Lang/Coco/Loops-Do-while create mode 100644 Lang/Coco/README create mode 120000 Lang/Coco/String-interpolation--included- create mode 100644 Lang/Comal/00DESCRIPTION create mode 120000 Lang/Comal/Conditional-structures create mode 120000 Lang/Comal/Factorial create mode 120000 Lang/Comal/Flow-control-structures create mode 120000 Lang/Comal/Hello-world-Text create mode 120000 Lang/Comal/Inheritance-Single create mode 120000 Lang/Comal/Literals-Integer create mode 120000 Lang/Comal/Loops-Infinite create mode 100644 Lang/Comal/README create mode 120000 Lang/Comal/Terminal-control-Clear-the-screen create mode 100644 Lang/Commodore-BASIC/00DESCRIPTION create mode 120000 Lang/Commodore-BASIC/100-doors create mode 120000 Lang/Commodore-BASIC/Prime-decomposition create mode 120000 Lang/Commodore-BASIC/Quine create mode 100644 Lang/Commodore-BASIC/README create mode 120000 Lang/Commodore-BASIC/Sorting-algorithms-Insertion-sort create mode 120000 Lang/Commodore-BASIC/Yin-and-yang create mode 100644 Lang/Computer-zero-Assembly/00DESCRIPTION create mode 120000 Lang/Computer-zero-Assembly/A+B create mode 120000 Lang/Computer-zero-Assembly/Arrays create mode 120000 Lang/Computer-zero-Assembly/Copy-a-string create mode 120000 Lang/Computer-zero-Assembly/Empty-program create mode 120000 Lang/Computer-zero-Assembly/Factorial create mode 120000 Lang/Computer-zero-Assembly/Fibonacci-sequence create mode 120000 Lang/Computer-zero-Assembly/Integer-comparison create mode 120000 Lang/Computer-zero-Assembly/Integer-overflow create mode 120000 Lang/Computer-zero-Assembly/Integer-sequence create mode 120000 Lang/Computer-zero-Assembly/Jump-anywhere create mode 100644 Lang/Computer-zero-Assembly/README create mode 120000 Lang/Computer-zero-Assembly/Singly-linked-list-Traversal create mode 100644 Lang/Crystal/00DESCRIPTION create mode 120000 Lang/Crystal/100-doors create mode 120000 Lang/Crystal/A+B create mode 120000 Lang/Crystal/Amicable-pairs create mode 120000 Lang/Crystal/Bernoulli-numbers create mode 120000 Lang/Crystal/Even-or-odd create mode 120000 Lang/Crystal/Fast-Fourier-transform create mode 120000 Lang/Crystal/FizzBuzz create mode 120000 Lang/Crystal/Hello-world-Text create mode 120000 Lang/Crystal/Man-or-boy-test create mode 100644 Lang/Crystal/README create mode 120000 Lang/Crystal/Sorting-algorithms-Merge-sort create mode 120000 Lang/Crystal/Sorting-algorithms-Quicksort create mode 100644 Lang/DDNC/00DESCRIPTION create mode 120000 Lang/DDNC/Hello-world-Text create mode 100644 Lang/DDNC/README create mode 100644 Lang/DIV-Games-Studio/00DESCRIPTION create mode 120000 Lang/DIV-Games-Studio/Hello-world-Text create mode 100644 Lang/DIV-Games-Studio/README create mode 100644 Lang/ECL/00DESCRIPTION create mode 120000 Lang/ECL/100-doors create mode 120000 Lang/ECL/99-Bottles-of-Beer create mode 120000 Lang/ECL/Arithmetic-Integer create mode 120000 Lang/ECL/Array-concatenation create mode 120000 Lang/ECL/Assertions create mode 120000 Lang/ECL/Averages-Arithmetic-mean create mode 120000 Lang/ECL/Bitwise-operations create mode 120000 Lang/ECL/CSV-data-manipulation create mode 120000 Lang/ECL/Comments create mode 120000 Lang/ECL/Day-of-the-week create mode 120000 Lang/ECL/Detect-division-by-zero create mode 120000 Lang/ECL/Fibonacci-sequence create mode 120000 Lang/ECL/FizzBuzz create mode 120000 Lang/ECL/Greatest-element-of-a-list create mode 120000 Lang/ECL/Hash-join create mode 120000 Lang/ECL/Hello-world-Text create mode 120000 Lang/ECL/Higher-order-functions create mode 120000 Lang/ECL/Integer-comparison create mode 120000 Lang/ECL/Logical-operations create mode 100644 Lang/ECL/README create mode 120000 Lang/ECL/Remove-duplicate-elements create mode 120000 Lang/ECL/Remove-lines-from-a-file create mode 120000 Lang/ECL/Repeat-a-string create mode 120000 Lang/ECL/Return-multiple-values create mode 120000 Lang/ECL/Roman-numerals-Decode create mode 120000 Lang/ECL/Roman-numerals-Encode create mode 120000 Lang/ECL/String-case create mode 120000 Lang/ECL/String-interpolation--included- create mode 120000 Lang/ECL/Substring create mode 100644 Lang/EDSAC-order-code/00DESCRIPTION create mode 120000 Lang/EDSAC-order-code/A+B create mode 120000 Lang/EDSAC-order-code/Comments create mode 120000 Lang/EDSAC-order-code/Empty-program create mode 120000 Lang/EDSAC-order-code/Fibonacci-sequence create mode 120000 Lang/EDSAC-order-code/Hello-world-Text create mode 120000 Lang/EDSAC-order-code/Integer-comparison create mode 120000 Lang/EDSAC-order-code/Integer-sequence create mode 120000 Lang/EDSAC-order-code/Loops-For create mode 100644 Lang/EDSAC-order-code/README create mode 100644 Lang/ERRE/00DESCRIPTION create mode 120000 Lang/ERRE/100-doors create mode 120000 Lang/ERRE/24-game-Solve create mode 120000 Lang/ERRE/A+B create mode 120000 Lang/ERRE/ABC-Problem create mode 120000 Lang/ERRE/Accumulator-factory create mode 120000 Lang/ERRE/Ackermann-function create mode 120000 Lang/ERRE/Address-of-a-variable create mode 120000 Lang/ERRE/Almost-prime create mode 120000 Lang/ERRE/Amb create mode 120000 Lang/ERRE/Amicable-pairs create mode 120000 Lang/ERRE/Animate-a-pendulum create mode 120000 Lang/ERRE/Apply-a-callback-to-an-array create mode 120000 Lang/ERRE/Arithmetic-Complex create mode 120000 Lang/ERRE/Arithmetic-Integer create mode 120000 Lang/ERRE/Arithmetic-Rational create mode 120000 Lang/ERRE/Arithmetic-evaluation create mode 120000 Lang/ERRE/Arithmetic-geometric-mean create mode 120000 Lang/ERRE/Array-concatenation create mode 120000 Lang/ERRE/Averages-Median create mode 120000 Lang/ERRE/Averages-Mode create mode 120000 Lang/ERRE/Averages-Pythagorean-means create mode 120000 Lang/ERRE/Averages-Root-mean-square create mode 120000 Lang/ERRE/Bitmap-Bresenhams-line-algorithm create mode 120000 Lang/ERRE/Bitmap-Flood-fill create mode 120000 Lang/ERRE/Bitmap-Midpoint-circle-algorithm create mode 120000 Lang/ERRE/Caesar-cipher create mode 120000 Lang/ERRE/Catalan-numbers create mode 120000 Lang/ERRE/Catalan-numbers-Pascals-triangle create mode 120000 Lang/ERRE/Circles-of-given-radius-through-two-points create mode 120000 Lang/ERRE/Classes create mode 120000 Lang/ERRE/Combinations create mode 120000 Lang/ERRE/Comments create mode 120000 Lang/ERRE/Create-a-file create mode 120000 Lang/ERRE/Create-a-two-dimensional-array-at-runtime create mode 120000 Lang/ERRE/Day-of-the-week create mode 120000 Lang/ERRE/Deal-cards-for-FreeCell create mode 120000 Lang/ERRE/Detect-division-by-zero create mode 120000 Lang/ERRE/Dinesmans-multiple-dwelling-problem create mode 120000 Lang/ERRE/Dragon-curve create mode 120000 Lang/ERRE/Draw-a-sphere create mode 120000 Lang/ERRE/Empty-program create mode 120000 Lang/ERRE/Equilibrium-index create mode 120000 Lang/ERRE/Ethiopian-multiplication create mode 120000 Lang/ERRE/Evaluate-binomial-coefficients create mode 120000 Lang/ERRE/Even-or-odd create mode 120000 Lang/ERRE/Execute-a-system-command create mode 120000 Lang/ERRE/Exponentiation-operator create mode 120000 Lang/ERRE/Factorial create mode 120000 Lang/ERRE/Factors-of-an-integer create mode 120000 Lang/ERRE/Fast-Fourier-transform create mode 120000 Lang/ERRE/Fibonacci-n-step-number-sequences create mode 120000 Lang/ERRE/Fibonacci-sequence create mode 120000 Lang/ERRE/Find-the-missing-permutation create mode 120000 Lang/ERRE/Five-weekends create mode 120000 Lang/ERRE/FizzBuzz create mode 120000 Lang/ERRE/Floyds-triangle create mode 120000 Lang/ERRE/Formatted-numeric-output create mode 120000 Lang/ERRE/Greatest-common-divisor create mode 120000 Lang/ERRE/Greatest-element-of-a-list create mode 120000 Lang/ERRE/Greatest-subsequential-sum create mode 120000 Lang/ERRE/Guess-the-number create mode 120000 Lang/ERRE/Hailstone-sequence create mode 120000 Lang/ERRE/Hamming-numbers create mode 120000 Lang/ERRE/Haversine-formula create mode 120000 Lang/ERRE/Hello-world-Line-printer create mode 120000 Lang/ERRE/Hello-world-Newline-omission create mode 120000 Lang/ERRE/Hello-world-Text create mode 120000 Lang/ERRE/Heronian-triangles create mode 120000 Lang/ERRE/Higher-order-functions create mode 120000 Lang/ERRE/Hofstadter-Q-sequence create mode 120000 Lang/ERRE/Horizontal-sundial-calculations create mode 120000 Lang/ERRE/Horners-rule-for-polynomial-evaluation create mode 120000 Lang/ERRE/Identity-matrix create mode 120000 Lang/ERRE/Increment-a-numerical-string create mode 120000 Lang/ERRE/Infinity create mode 120000 Lang/ERRE/Integer-sequence create mode 120000 Lang/ERRE/Iterated-digits-squaring create mode 120000 Lang/ERRE/Josephus-problem create mode 120000 Lang/ERRE/Jump-anywhere create mode 120000 Lang/ERRE/Keyboard-input-Flush-the-keyboard-buffer create mode 120000 Lang/ERRE/Keyboard-input-Keypress-check create mode 120000 Lang/ERRE/Keyboard-input-Obtain-a-Y-or-N-response create mode 120000 Lang/ERRE/Knights-tour create mode 120000 Lang/ERRE/Knuth-shuffle create mode 120000 Lang/ERRE/Leap-year create mode 120000 Lang/ERRE/Least-common-multiple create mode 120000 Lang/ERRE/Letter-frequency create mode 120000 Lang/ERRE/Levenshtein-distance create mode 120000 Lang/ERRE/Linear-congruential-generator create mode 120000 Lang/ERRE/Literals-Integer create mode 120000 Lang/ERRE/Look-and-say-sequence create mode 120000 Lang/ERRE/Loops-Break create mode 120000 Lang/ERRE/Loops-Continue create mode 120000 Lang/ERRE/Loops-Do-while create mode 120000 Lang/ERRE/Loops-Downward-for create mode 120000 Lang/ERRE/Loops-For create mode 120000 Lang/ERRE/Loops-For-with-a-specified-step create mode 120000 Lang/ERRE/Loops-Foreach create mode 120000 Lang/ERRE/Loops-Infinite create mode 120000 Lang/ERRE/Loops-N-plus-one-half create mode 120000 Lang/ERRE/Loops-Nested create mode 120000 Lang/ERRE/Loops-While create mode 120000 Lang/ERRE/Lucas-Lehmer-test create mode 120000 Lang/ERRE/Magic-squares-of-odd-order create mode 120000 Lang/ERRE/Make-directory-path create mode 120000 Lang/ERRE/Mandelbrot-set create mode 120000 Lang/ERRE/Map-range create mode 120000 Lang/ERRE/Matrix-exponentiation-operator create mode 120000 Lang/ERRE/Matrix-multiplication create mode 120000 Lang/ERRE/Maximum-triangle-path-sum create mode 120000 Lang/ERRE/Menu create mode 120000 Lang/ERRE/Middle-three-digits create mode 120000 Lang/ERRE/Modular-inverse create mode 120000 Lang/ERRE/Monte-Carlo-methods create mode 120000 Lang/ERRE/Mouse-position create mode 120000 Lang/ERRE/Multifactorial create mode 120000 Lang/ERRE/Multiple-regression create mode 120000 Lang/ERRE/N-queens-problem create mode 120000 Lang/ERRE/Narcissistic-decimal-number create mode 120000 Lang/ERRE/Nth create mode 120000 Lang/ERRE/One-dimensional-cellular-automata create mode 120000 Lang/ERRE/One-of-n-lines-in-a-file create mode 120000 Lang/ERRE/Pascals-triangle create mode 120000 Lang/ERRE/Perfect-numbers create mode 120000 Lang/ERRE/Primality-by-trial-division create mode 120000 Lang/ERRE/Prime-decomposition create mode 120000 Lang/ERRE/Probabilistic-choice create mode 120000 Lang/ERRE/Pythagorean-triples create mode 120000 Lang/ERRE/Quaternion-type create mode 120000 Lang/ERRE/Queue-Definition create mode 120000 Lang/ERRE/Quine create mode 100644 Lang/ERRE/README create mode 120000 Lang/ERRE/Random-numbers create mode 120000 Lang/ERRE/Rate-counter create mode 120000 Lang/ERRE/Read-a-file-line-by-line create mode 120000 Lang/ERRE/Real-constants-and-functions create mode 120000 Lang/ERRE/Repeat-a-string create mode 120000 Lang/ERRE/Resistor-mesh create mode 120000 Lang/ERRE/Return-multiple-values create mode 120000 Lang/ERRE/Reverse-a-string create mode 120000 Lang/ERRE/Roman-numerals-Decode create mode 120000 Lang/ERRE/Roman-numerals-Encode create mode 120000 Lang/ERRE/Roots-of-a-function create mode 120000 Lang/ERRE/Roots-of-a-quadratic-function create mode 120000 Lang/ERRE/Roots-of-unity create mode 120000 Lang/ERRE/Rot-13 create mode 120000 Lang/ERRE/Runge-Kutta-method create mode 120000 Lang/ERRE/Semiprime create mode 120000 Lang/ERRE/Sequence-of-primes-by-Trial-Division create mode 120000 Lang/ERRE/Sierpinski-carpet create mode 120000 Lang/ERRE/Sierpinski-triangle-Graphical create mode 120000 Lang/ERRE/Sieve-of-Eratosthenes create mode 120000 Lang/ERRE/Sleep create mode 120000 Lang/ERRE/Sort-disjoint-sublist create mode 120000 Lang/ERRE/Sorting-algorithms-Bubble-sort create mode 120000 Lang/ERRE/Sorting-algorithms-Insertion-sort create mode 120000 Lang/ERRE/Sorting-algorithms-Merge-sort create mode 120000 Lang/ERRE/Sorting-algorithms-Quicksort create mode 120000 Lang/ERRE/String-concatenation create mode 120000 Lang/ERRE/String-prepend create mode 120000 Lang/ERRE/Sudoku create mode 120000 Lang/ERRE/Towers-of-Hanoi create mode 120000 Lang/ERRE/Trabb-Pardo-Knuth-algorithm create mode 120000 Lang/ERRE/Twelve-statements create mode 120000 Lang/ERRE/Ulam-spiral--for-primes- create mode 120000 Lang/ERRE/Unbias-a-random-generator create mode 120000 Lang/ERRE/Van-der-Corput-sequence create mode 120000 Lang/ERRE/Vector-products create mode 120000 Lang/ERRE/Write-language-name-in-3D-ASCII create mode 120000 Lang/ERRE/Zebra-puzzle create mode 120000 Lang/ERRE/Zero-to-the-zero-power create mode 120000 Lang/ERRE/Zig-zag-matrix create mode 100644 Lang/EchoLisp/00DESCRIPTION create mode 120000 Lang/EchoLisp/100-doors create mode 120000 Lang/EchoLisp/24-game create mode 120000 Lang/EchoLisp/24-game-Solve create mode 120000 Lang/EchoLisp/A+B create mode 120000 Lang/EchoLisp/ABC-Problem create mode 120000 Lang/EchoLisp/AKS-test-for-primes create mode 120000 Lang/EchoLisp/Abundant,-deficient-and-perfect-number-classifications create mode 120000 Lang/EchoLisp/Accumulator-factory create mode 120000 Lang/EchoLisp/Active-object create mode 120000 Lang/EchoLisp/Aliquot-sequence-classifications create mode 120000 Lang/EchoLisp/Almost-prime create mode 120000 Lang/EchoLisp/Amicable-pairs create mode 120000 Lang/EchoLisp/Anagrams create mode 120000 Lang/EchoLisp/Anagrams-Deranged-anagrams create mode 120000 Lang/EchoLisp/Anonymous-recursion create mode 120000 Lang/EchoLisp/Apply-a-callback-to-an-array create mode 120000 Lang/EchoLisp/Arbitrary-precision-integers--included- create mode 120000 Lang/EchoLisp/Arithmetic-Complex create mode 120000 Lang/EchoLisp/Arithmetic-Rational create mode 120000 Lang/EchoLisp/Arithmetic-geometric-mean create mode 120000 Lang/EchoLisp/Array-concatenation create mode 120000 Lang/EchoLisp/Assertions create mode 120000 Lang/EchoLisp/Associative-array-Creation create mode 120000 Lang/EchoLisp/Associative-array-Iteration create mode 120000 Lang/EchoLisp/Average-loop-length create mode 120000 Lang/EchoLisp/Averages-Arithmetic-mean create mode 120000 Lang/EchoLisp/Averages-Mean-angle create mode 120000 Lang/EchoLisp/Averages-Mean-time-of-day create mode 120000 Lang/EchoLisp/Averages-Median create mode 120000 Lang/EchoLisp/Averages-Mode create mode 120000 Lang/EchoLisp/Averages-Pythagorean-means create mode 120000 Lang/EchoLisp/Averages-Root-mean-square create mode 120000 Lang/EchoLisp/Averages-Simple-moving-average create mode 120000 Lang/EchoLisp/Balanced-brackets create mode 120000 Lang/EchoLisp/Bernoulli-numbers create mode 120000 Lang/EchoLisp/Binary-digits create mode 120000 Lang/EchoLisp/Bitmap create mode 120000 Lang/EchoLisp/Boolean-values create mode 120000 Lang/EchoLisp/CSV-data-manipulation create mode 120000 Lang/EchoLisp/CSV-to-HTML-translation create mode 120000 Lang/EchoLisp/Carmichael-3-strong-pseudoprimes create mode 120000 Lang/EchoLisp/Case-sensitivity-of-identifiers create mode 120000 Lang/EchoLisp/Catalan-numbers create mode 120000 Lang/EchoLisp/Catalan-numbers-Pascals-triangle create mode 120000 Lang/EchoLisp/Catamorphism create mode 120000 Lang/EchoLisp/Check-Machin-like-formulas create mode 120000 Lang/EchoLisp/Chinese-remainder-theorem create mode 120000 Lang/EchoLisp/Classes create mode 120000 Lang/EchoLisp/Closures-Value-capture create mode 120000 Lang/EchoLisp/Collections create mode 120000 Lang/EchoLisp/Combinations create mode 120000 Lang/EchoLisp/Combinations-and-permutations create mode 120000 Lang/EchoLisp/Combinations-with-repetitions create mode 120000 Lang/EchoLisp/Comma-quibbling create mode 120000 Lang/EchoLisp/Comments create mode 120000 Lang/EchoLisp/Compile-time-calculation create mode 120000 Lang/EchoLisp/Compound-data-type create mode 120000 Lang/EchoLisp/Concurrent-computing create mode 120000 Lang/EchoLisp/Constrained-random-points-on-a-circle create mode 120000 Lang/EchoLisp/Convert-decimal-number-to-rational create mode 120000 Lang/EchoLisp/Copy-a-string create mode 120000 Lang/EchoLisp/Count-in-factors create mode 120000 Lang/EchoLisp/Count-occurrences-of-a-substring create mode 120000 Lang/EchoLisp/Count-the-coins create mode 120000 Lang/EchoLisp/Create-a-file create mode 120000 Lang/EchoLisp/Create-an-HTML-table create mode 120000 Lang/EchoLisp/Currying create mode 120000 Lang/EchoLisp/Date-manipulation create mode 120000 Lang/EchoLisp/Define-a-primitive-data-type create mode 120000 Lang/EchoLisp/Determine-if-a-string-is-numeric create mode 120000 Lang/EchoLisp/Dinesmans-multiple-dwelling-problem create mode 120000 Lang/EchoLisp/Dining-philosophers create mode 120000 Lang/EchoLisp/Dot-product create mode 120000 Lang/EchoLisp/Empty-program create mode 120000 Lang/EchoLisp/Entropy create mode 120000 Lang/EchoLisp/Evolutionary-algorithm create mode 120000 Lang/EchoLisp/Exceptions-Catch-an-exception-thrown-in-a-nested-call create mode 120000 Lang/EchoLisp/Execute-a-Markov-algorithm create mode 120000 Lang/EchoLisp/Exponentiation-operator create mode 120000 Lang/EchoLisp/Extend-your-language create mode 120000 Lang/EchoLisp/Extensible-prime-generator create mode 120000 Lang/EchoLisp/Factorial create mode 120000 Lang/EchoLisp/Factors-of-a-Mersenne-number create mode 120000 Lang/EchoLisp/Factors-of-an-integer create mode 120000 Lang/EchoLisp/Fast-Fourier-transform create mode 120000 Lang/EchoLisp/Fibonacci-n-step-number-sequences create mode 120000 Lang/EchoLisp/Fibonacci-sequence create mode 120000 Lang/EchoLisp/Fibonacci-word create mode 120000 Lang/EchoLisp/Filter create mode 120000 Lang/EchoLisp/Find-the-missing-permutation create mode 120000 Lang/EchoLisp/First-class-environments create mode 120000 Lang/EchoLisp/First-class-functions create mode 120000 Lang/EchoLisp/Flatten-a-list create mode 120000 Lang/EchoLisp/Formal-power-series create mode 120000 Lang/EchoLisp/Forward-difference create mode 120000 Lang/EchoLisp/Function-composition create mode 120000 Lang/EchoLisp/Function-definition create mode 120000 Lang/EchoLisp/Generate-Chess960-starting-position create mode 120000 Lang/EchoLisp/Generate-lower-case-ASCII-alphabet create mode 120000 Lang/EchoLisp/Generator-Exponential create mode 120000 Lang/EchoLisp/Generic-swap create mode 120000 Lang/EchoLisp/Greatest-element-of-a-list create mode 120000 Lang/EchoLisp/Greatest-subsequential-sum create mode 120000 Lang/EchoLisp/Guess-the-number-With-feedback create mode 120000 Lang/EchoLisp/HTTP create mode 120000 Lang/EchoLisp/HTTPS create mode 120000 Lang/EchoLisp/Hailstone-sequence create mode 120000 Lang/EchoLisp/Harshad-or-Niven-series create mode 120000 Lang/EchoLisp/Hash-from-two-arrays create mode 120000 Lang/EchoLisp/Hash-join create mode 120000 Lang/EchoLisp/Hello-world-Graphical create mode 120000 Lang/EchoLisp/Hello-world-Line-printer create mode 120000 Lang/EchoLisp/Hello-world-Newbie create mode 120000 Lang/EchoLisp/Hello-world-Newline-omission create mode 120000 Lang/EchoLisp/Hello-world-Text create mode 120000 Lang/EchoLisp/Heronian-triangles create mode 120000 Lang/EchoLisp/History-variables create mode 120000 Lang/EchoLisp/Hofstadter-Conway-$10,000-sequence create mode 120000 Lang/EchoLisp/Hofstadter-Figure-Figure-sequences create mode 120000 Lang/EchoLisp/Hofstadter-Q-sequence create mode 120000 Lang/EchoLisp/Horners-rule-for-polynomial-evaluation create mode 120000 Lang/EchoLisp/Increment-a-numerical-string create mode 120000 Lang/EchoLisp/Integer-sequence create mode 120000 Lang/EchoLisp/Interactive-programming create mode 120000 Lang/EchoLisp/Introspection create mode 120000 Lang/EchoLisp/Inverted-index create mode 120000 Lang/EchoLisp/Inverted-syntax create mode 120000 Lang/EchoLisp/JSON create mode 120000 Lang/EchoLisp/Josephus-problem create mode 120000 Lang/EchoLisp/Keyboard-macros create mode 120000 Lang/EchoLisp/Knapsack-problem-0-1 create mode 120000 Lang/EchoLisp/Knapsack-problem-Bounded create mode 120000 Lang/EchoLisp/Knapsack-problem-Continuous create mode 120000 Lang/EchoLisp/Knapsack-problem-Unbounded create mode 120000 Lang/EchoLisp/Knights-tour create mode 120000 Lang/EchoLisp/Knuth-shuffle create mode 120000 Lang/EchoLisp/LU-decomposition create mode 120000 Lang/EchoLisp/Langtons-ant create mode 120000 Lang/EchoLisp/Least-common-multiple create mode 120000 Lang/EchoLisp/Left-factorials create mode 120000 Lang/EchoLisp/Letter-frequency create mode 120000 Lang/EchoLisp/Levenshtein-distance create mode 120000 Lang/EchoLisp/List-comprehensions create mode 120000 Lang/EchoLisp/Long-multiplication create mode 120000 Lang/EchoLisp/Look-and-say-sequence create mode 120000 Lang/EchoLisp/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/EchoLisp/Loops-Downward-for create mode 120000 Lang/EchoLisp/Loops-For-with-a-specified-step create mode 120000 Lang/EchoLisp/Loops-Foreach create mode 120000 Lang/EchoLisp/Loops-N-plus-one-half create mode 120000 Lang/EchoLisp/Loops-Nested create mode 120000 Lang/EchoLisp/Loops-While create mode 120000 Lang/EchoLisp/Lucas-Lehmer-test create mode 120000 Lang/EchoLisp/Luhn-test-of-credit-card-numbers create mode 120000 Lang/EchoLisp/Magic-squares-of-odd-order create mode 120000 Lang/EchoLisp/Man-or-boy-test create mode 120000 Lang/EchoLisp/Mandelbrot-set create mode 120000 Lang/EchoLisp/Map-range create mode 120000 Lang/EchoLisp/Matrix-arithmetic create mode 120000 Lang/EchoLisp/Matrix-transposition create mode 120000 Lang/EchoLisp/Metered-concurrency create mode 120000 Lang/EchoLisp/Metronome create mode 120000 Lang/EchoLisp/Modular-exponentiation create mode 120000 Lang/EchoLisp/Modular-inverse create mode 120000 Lang/EchoLisp/Morse-code create mode 120000 Lang/EchoLisp/Mouse-position create mode 120000 Lang/EchoLisp/Multiple-distinct-objects create mode 120000 Lang/EchoLisp/Multiplication-tables create mode 120000 Lang/EchoLisp/Multiplicative-order create mode 120000 Lang/EchoLisp/Munching-squares create mode 120000 Lang/EchoLisp/N-queens-problem create mode 120000 Lang/EchoLisp/Null-object create mode 120000 Lang/EchoLisp/Object-serialization create mode 120000 Lang/EchoLisp/Odd-word-problem create mode 120000 Lang/EchoLisp/Order-disjoint-list-items create mode 120000 Lang/EchoLisp/Ordered-Partitions create mode 120000 Lang/EchoLisp/Ordered-words create mode 120000 Lang/EchoLisp/Palindrome-detection create mode 120000 Lang/EchoLisp/Parsing-RPN-calculator-algorithm create mode 120000 Lang/EchoLisp/Parsing-RPN-to-infix-conversion create mode 120000 Lang/EchoLisp/Parsing-Shunting-yard-algorithm create mode 120000 Lang/EchoLisp/Pattern-matching create mode 120000 Lang/EchoLisp/Percolation-Mean-cluster-density create mode 120000 Lang/EchoLisp/Percolation-Mean-run-density create mode 120000 Lang/EchoLisp/Permutations-Derangements create mode 120000 Lang/EchoLisp/Permutations-by-swapping create mode 120000 Lang/EchoLisp/Pernicious-numbers create mode 120000 Lang/EchoLisp/Phrase-reversals create mode 120000 Lang/EchoLisp/Pick-random-element create mode 120000 Lang/EchoLisp/Plot-coordinate-pairs create mode 120000 Lang/EchoLisp/Pointers-and-references create mode 120000 Lang/EchoLisp/Polymorphic-copy create mode 120000 Lang/EchoLisp/Polymorphism create mode 120000 Lang/EchoLisp/Power-set create mode 120000 Lang/EchoLisp/Primality-by-trial-division create mode 120000 Lang/EchoLisp/Prime-decomposition create mode 120000 Lang/EchoLisp/Priority-queue create mode 120000 Lang/EchoLisp/Program-name create mode 120000 Lang/EchoLisp/Queue-Definition create mode 100644 Lang/EchoLisp/README create mode 120000 Lang/EchoLisp/Random-number-generator--device- create mode 120000 Lang/EchoLisp/Random-number-generator--included- create mode 120000 Lang/EchoLisp/Range-expansion create mode 120000 Lang/EchoLisp/Range-extraction create mode 120000 Lang/EchoLisp/Read-a-configuration-file create mode 120000 Lang/EchoLisp/Rep-string create mode 120000 Lang/EchoLisp/Return-multiple-values create mode 120000 Lang/EchoLisp/Reverse-a-string create mode 120000 Lang/EchoLisp/Reverse-words-in-a-string create mode 120000 Lang/EchoLisp/Roots-of-a-function create mode 120000 Lang/EchoLisp/Roots-of-unity create mode 120000 Lang/EchoLisp/Runtime-evaluation create mode 120000 Lang/EchoLisp/Runtime-evaluation-In-an-environment create mode 120000 Lang/EchoLisp/S-Expressions create mode 120000 Lang/EchoLisp/Self-referential-sequence create mode 120000 Lang/EchoLisp/Semiprime create mode 120000 Lang/EchoLisp/Semordnilap create mode 120000 Lang/EchoLisp/Sequence-of-non-squares create mode 120000 Lang/EchoLisp/Sequence-of-primes-by-Trial-Division create mode 120000 Lang/EchoLisp/Set create mode 120000 Lang/EchoLisp/Set-consolidation create mode 120000 Lang/EchoLisp/Set-of-real-numbers create mode 120000 Lang/EchoLisp/Set-puzzle create mode 120000 Lang/EchoLisp/Sieve-of-Eratosthenes create mode 120000 Lang/EchoLisp/Simple-windowed-application create mode 120000 Lang/EchoLisp/Singly-linked-list-Element-insertion create mode 120000 Lang/EchoLisp/Singly-linked-list-Traversal create mode 120000 Lang/EchoLisp/Sort-an-array-of-composite-structures create mode 120000 Lang/EchoLisp/Sort-disjoint-sublist create mode 120000 Lang/EchoLisp/Sorting-algorithms-Bubble-sort create mode 120000 Lang/EchoLisp/Sorting-algorithms-Heapsort create mode 120000 Lang/EchoLisp/Sorting-algorithms-Permutation-sort create mode 120000 Lang/EchoLisp/Sorting-algorithms-Quicksort create mode 120000 Lang/EchoLisp/Sorting-algorithms-Selection-sort create mode 120000 Lang/EchoLisp/Stable-marriage-problem create mode 120000 Lang/EchoLisp/Stack create mode 120000 Lang/EchoLisp/Stair-climbing-puzzle create mode 120000 Lang/EchoLisp/Stern-Brocot-sequence create mode 120000 Lang/EchoLisp/String-append create mode 120000 Lang/EchoLisp/String-case create mode 120000 Lang/EchoLisp/String-interpolation--included- create mode 120000 Lang/EchoLisp/String-matching create mode 120000 Lang/EchoLisp/String-prepend create mode 120000 Lang/EchoLisp/Strip-a-set-of-characters-from-a-string create mode 120000 Lang/EchoLisp/Strip-whitespace-from-a-string-Top-and-tail create mode 120000 Lang/EchoLisp/Sum-multiples-of-3-and-5 create mode 120000 Lang/EchoLisp/Sum-of-a-series create mode 120000 Lang/EchoLisp/Synchronous-concurrency create mode 120000 Lang/EchoLisp/Table-creation-Postal-addresses create mode 120000 Lang/EchoLisp/Terminal-control-Display-an-extended-character create mode 120000 Lang/EchoLisp/Test-a-function create mode 120000 Lang/EchoLisp/Top-rank-per-group create mode 120000 Lang/EchoLisp/Topological-sort create mode 120000 Lang/EchoLisp/Total-circles-area create mode 120000 Lang/EchoLisp/Trabb-Pardo-Knuth-algorithm create mode 120000 Lang/EchoLisp/Truncatable-primes create mode 120000 Lang/EchoLisp/Ulam-spiral--for-primes- create mode 120000 Lang/EchoLisp/Unicode-variable-names create mode 120000 Lang/EchoLisp/Universal-Turing-machine create mode 120000 Lang/EchoLisp/Unix-ls create mode 120000 Lang/EchoLisp/Vector-products create mode 120000 Lang/EchoLisp/Y-combinator create mode 120000 Lang/EchoLisp/Zebra-puzzle create mode 120000 Lang/EchoLisp/Zeckendorf-number-representation create mode 120000 Lang/EchoLisp/Zero-to-the-zero-power create mode 100644 Lang/Eero/00DESCRIPTION create mode 120000 Lang/Eero/100-doors create mode 120000 Lang/Eero/Currying create mode 120000 Lang/Eero/FizzBuzz create mode 120000 Lang/Eero/Increment-a-numerical-string create mode 120000 Lang/Eero/Quaternion-type create mode 100644 Lang/Eero/README create mode 120000 Lang/Eero/Sorting-algorithms-Quicksort create mode 120000 Lang/Eero/Substring create mode 120000 Lang/Eero/Substring-Top-and-tail create mode 120000 Lang/Eero/Y-combinator create mode 100644 Lang/Egison/00DESCRIPTION create mode 120000 Lang/Egison/Amb create mode 120000 Lang/Egison/Combinations create mode 120000 Lang/Egison/Combinations-with-repetitions create mode 120000 Lang/Egison/Hello-world-Text create mode 120000 Lang/Egison/Longest-common-subsequence create mode 120000 Lang/Egison/Partial-function-application create mode 100644 Lang/Egison/README create mode 120000 Lang/Egison/Repeat-a-string create mode 120000 Lang/Egison/Set-consolidation create mode 100644 Lang/EhBASIC/00DESCRIPTION create mode 100644 Lang/EhBASIC/README create mode 100644 Lang/Elm/00DESCRIPTION create mode 120000 Lang/Elm/Animate-a-pendulum create mode 120000 Lang/Elm/Array-concatenation create mode 120000 Lang/Elm/Comments create mode 120000 Lang/Elm/Dragon-curve create mode 120000 Lang/Elm/Factorial create mode 120000 Lang/Elm/Fibonacci-sequence create mode 120000 Lang/Elm/FizzBuzz create mode 120000 Lang/Elm/Flatten-a-list create mode 120000 Lang/Elm/Galton-box-animation create mode 120000 Lang/Elm/Hello-world-Text create mode 120000 Lang/Elm/Keyboard-input-Obtain-a-Y-or-N-response create mode 120000 Lang/Elm/Knights-tour create mode 120000 Lang/Elm/Langtons-ant create mode 120000 Lang/Elm/Last-Friday-of-each-month create mode 120000 Lang/Elm/Maze-generation create mode 120000 Lang/Elm/Mouse-position create mode 120000 Lang/Elm/One-dimensional-cellular-automata create mode 120000 Lang/Elm/Palindrome-detection create mode 100644 Lang/Elm/README create mode 120000 Lang/Elm/Real-constants-and-functions create mode 120000 Lang/Elm/Reverse-a-string create mode 120000 Lang/Elm/Reverse-words-in-a-string create mode 120000 Lang/Elm/Sierpinski-triangle create mode 120000 Lang/Elm/String-case create mode 100644 Lang/Ezhil/00DESCRIPTION create mode 120000 Lang/Ezhil/Ackermann-function create mode 120000 Lang/Ezhil/Factorial create mode 120000 Lang/Ezhil/Greatest-common-divisor create mode 120000 Lang/Ezhil/Hailstone-sequence create mode 120000 Lang/Ezhil/Least-common-multiple create mode 120000 Lang/Ezhil/Prime-decomposition create mode 100644 Lang/Ezhil/README create mode 120000 Lang/Ezhil/Reverse-a-string create mode 120000 Lang/Ezhil/Sorting-algorithms-Bubble-sort create mode 120000 Lang/Ezhil/Sum-digits-of-an-integer create mode 120000 Lang/Ezhil/Sum-of-a-series create mode 120000 Lang/Ezhil/Temperature-conversion create mode 120000 Lang/Ezhil/Towers-of-Hanoi create mode 100644 Lang/FOCAL/00DESCRIPTION create mode 120000 Lang/FOCAL/Fibonacci-sequence create mode 120000 Lang/FOCAL/FizzBuzz create mode 120000 Lang/FOCAL/Hello-world-Newline-omission create mode 120000 Lang/FOCAL/Hello-world-Text create mode 120000 Lang/FOCAL/Loops-For create mode 120000 Lang/FOCAL/Loops-For-with-a-specified-step create mode 100644 Lang/FOCAL/README create mode 120000 Lang/FOCAL/Temperature-conversion create mode 100644 Lang/FRISC-Assembly/00DESCRIPTION create mode 120000 Lang/FRISC-Assembly/Fibonacci-sequence create mode 100644 Lang/FRISC-Assembly/README create mode 100644 Lang/FUZE-BASIC/00DESCRIPTION create mode 120000 Lang/FUZE-BASIC/100-doors create mode 120000 Lang/FUZE-BASIC/A+B create mode 120000 Lang/FUZE-BASIC/Comments create mode 120000 Lang/FUZE-BASIC/Hello-world-Text create mode 100644 Lang/FUZE-BASIC/README create mode 100644 Lang/FormulaOne/00DESCRIPTION create mode 100644 Lang/FormulaOne/README create mode 120000 Lang/FormulaOne/Zebra-puzzle create mode 100644 Lang/Free-Pascal/00DESCRIPTION create mode 120000 Lang/Free-Pascal/Quine create mode 100644 Lang/Free-Pascal/README create mode 120000 Lang/Free-Pascal/Random-numbers create mode 100644 Lang/FreeBASIC/00DESCRIPTION create mode 120000 Lang/FreeBASIC/100-doors create mode 120000 Lang/FreeBASIC/9-billion-names-of-God-the-integer create mode 120000 Lang/FreeBASIC/A+B create mode 120000 Lang/FreeBASIC/AKS-test-for-primes create mode 120000 Lang/FreeBASIC/Abstract-type create mode 120000 Lang/FreeBASIC/Abundant,-deficient-and-perfect-number-classifications create mode 120000 Lang/FreeBASIC/Accumulator-factory create mode 120000 Lang/FreeBASIC/Ackermann-function create mode 120000 Lang/FreeBASIC/Address-of-a-variable create mode 120000 Lang/FreeBASIC/Align-columns create mode 120000 Lang/FreeBASIC/Almost-prime create mode 120000 Lang/FreeBASIC/Amicable-pairs create mode 120000 Lang/FreeBASIC/Anagrams create mode 120000 Lang/FreeBASIC/Anagrams-Deranged-anagrams create mode 120000 Lang/FreeBASIC/Animation create mode 120000 Lang/FreeBASIC/Anonymous-recursion create mode 120000 Lang/FreeBASIC/Append-a-record-to-the-end-of-a-text-file create mode 120000 Lang/FreeBASIC/Apply-a-callback-to-an-array create mode 120000 Lang/FreeBASIC/Arbitrary-precision-integers--included- create mode 120000 Lang/FreeBASIC/Arithmetic-Complex create mode 120000 Lang/FreeBASIC/Arithmetic-Integer create mode 120000 Lang/FreeBASIC/Arithmetic-evaluation create mode 120000 Lang/FreeBASIC/Arithmetic-geometric-mean create mode 120000 Lang/FreeBASIC/Array-concatenation create mode 120000 Lang/FreeBASIC/Arrays create mode 120000 Lang/FreeBASIC/Assertions create mode 120000 Lang/FreeBASIC/Averages-Arithmetic-mean create mode 120000 Lang/FreeBASIC/Averages-Mean-angle create mode 120000 Lang/FreeBASIC/Averages-Mean-time-of-day create mode 120000 Lang/FreeBASIC/Averages-Median create mode 120000 Lang/FreeBASIC/Averages-Mode create mode 120000 Lang/FreeBASIC/Averages-Pythagorean-means create mode 120000 Lang/FreeBASIC/Averages-Root-mean-square create mode 120000 Lang/FreeBASIC/Averages-Simple-moving-average create mode 120000 Lang/FreeBASIC/Balanced-brackets create mode 120000 Lang/FreeBASIC/Benfords-law create mode 120000 Lang/FreeBASIC/Bernoulli-numbers create mode 120000 Lang/FreeBASIC/Binary-digits create mode 120000 Lang/FreeBASIC/Bitmap-B-zier-curves-Cubic create mode 120000 Lang/FreeBASIC/Bitmap-B-zier-curves-Quadratic create mode 120000 Lang/FreeBASIC/Bitmap-Bresenhams-line-algorithm create mode 120000 Lang/FreeBASIC/Bitmap-Flood-fill create mode 120000 Lang/FreeBASIC/Bitmap-Midpoint-circle-algorithm create mode 120000 Lang/FreeBASIC/Bitwise-operations create mode 120000 Lang/FreeBASIC/Boolean-values create mode 120000 Lang/FreeBASIC/Box-the-compass create mode 120000 Lang/FreeBASIC/CSV-data-manipulation create mode 120000 Lang/FreeBASIC/Caesar-cipher create mode 120000 Lang/FreeBASIC/Calendar create mode 120000 Lang/FreeBASIC/Calendar---for-REAL-programmers create mode 120000 Lang/FreeBASIC/Call-a-foreign-language-function create mode 120000 Lang/FreeBASIC/Call-a-function-in-a-shared-library create mode 120000 Lang/FreeBASIC/Call-an-object-method create mode 120000 Lang/FreeBASIC/Carmichael-3-strong-pseudoprimes create mode 120000 Lang/FreeBASIC/Case-sensitivity-of-identifiers create mode 120000 Lang/FreeBASIC/Catalan-numbers create mode 120000 Lang/FreeBASIC/Catalan-numbers-Pascals-triangle create mode 120000 Lang/FreeBASIC/Catamorphism create mode 120000 Lang/FreeBASIC/Character-codes create mode 120000 Lang/FreeBASIC/Check-that-file-exists create mode 120000 Lang/FreeBASIC/Classes create mode 120000 Lang/FreeBASIC/Closures-Value-capture create mode 120000 Lang/FreeBASIC/Collections create mode 120000 Lang/FreeBASIC/Color-of-a-screen-pixel create mode 120000 Lang/FreeBASIC/Colour-bars-Display create mode 120000 Lang/FreeBASIC/Comma-quibbling create mode 120000 Lang/FreeBASIC/Command-line-arguments create mode 120000 Lang/FreeBASIC/Comments create mode 120000 Lang/FreeBASIC/Compile-time-calculation create mode 120000 Lang/FreeBASIC/Compound-data-type create mode 120000 Lang/FreeBASIC/Concurrent-computing create mode 120000 Lang/FreeBASIC/Conditional-structures create mode 120000 Lang/FreeBASIC/Convert-decimal-number-to-rational create mode 120000 Lang/FreeBASIC/Copy-a-string create mode 120000 Lang/FreeBASIC/Count-in-factors create mode 120000 Lang/FreeBASIC/Count-in-octal create mode 120000 Lang/FreeBASIC/Count-occurrences-of-a-substring create mode 120000 Lang/FreeBASIC/Count-the-coins create mode 120000 Lang/FreeBASIC/Create-a-file create mode 120000 Lang/FreeBASIC/Create-a-two-dimensional-array-at-runtime create mode 120000 Lang/FreeBASIC/Create-an-object-at-a-given-address create mode 120000 Lang/FreeBASIC/Currying create mode 120000 Lang/FreeBASIC/Date-format create mode 120000 Lang/FreeBASIC/Date-manipulation create mode 120000 Lang/FreeBASIC/Deal-cards-for-FreeCell create mode 120000 Lang/FreeBASIC/Define-a-primitive-data-type create mode 120000 Lang/FreeBASIC/Delete-a-file create mode 120000 Lang/FreeBASIC/Detect-division-by-zero create mode 120000 Lang/FreeBASIC/Determine-if-a-string-is-numeric create mode 120000 Lang/FreeBASIC/Digital-root create mode 120000 Lang/FreeBASIC/Dynamic-variable-names create mode 120000 Lang/FreeBASIC/Empty-directory create mode 120000 Lang/FreeBASIC/Empty-program create mode 120000 Lang/FreeBASIC/Empty-string create mode 120000 Lang/FreeBASIC/Entropy create mode 120000 Lang/FreeBASIC/Enumerations create mode 120000 Lang/FreeBASIC/Environment-variables create mode 120000 Lang/FreeBASIC/Equilibrium-index create mode 120000 Lang/FreeBASIC/Evaluate-binomial-coefficients create mode 120000 Lang/FreeBASIC/Even-or-odd create mode 120000 Lang/FreeBASIC/Exceptions create mode 120000 Lang/FreeBASIC/Exceptions-Catch-an-exception-thrown-in-a-nested-call create mode 120000 Lang/FreeBASIC/Execute-a-system-command create mode 120000 Lang/FreeBASIC/Exponentiation-operator create mode 120000 Lang/FreeBASIC/Extend-your-language create mode 120000 Lang/FreeBASIC/Extensible-prime-generator create mode 120000 Lang/FreeBASIC/Extreme-floating-point-values create mode 120000 Lang/FreeBASIC/Factorial create mode 120000 Lang/FreeBASIC/Factors-of-a-Mersenne-number create mode 120000 Lang/FreeBASIC/Factors-of-an-integer create mode 120000 Lang/FreeBASIC/Fibonacci-n-step-number-sequences create mode 120000 Lang/FreeBASIC/Fibonacci-sequence create mode 120000 Lang/FreeBASIC/Fibonacci-word create mode 120000 Lang/FreeBASIC/Fibonacci-word-fractal create mode 120000 Lang/FreeBASIC/File-input-output create mode 120000 Lang/FreeBASIC/File-modification-time create mode 120000 Lang/FreeBASIC/File-size create mode 120000 Lang/FreeBASIC/Filter create mode 120000 Lang/FreeBASIC/Find-the-last-Sunday-of-each-month create mode 120000 Lang/FreeBASIC/Five-weekends create mode 120000 Lang/FreeBASIC/Floyds-triangle create mode 120000 Lang/FreeBASIC/Formatted-numeric-output create mode 120000 Lang/FreeBASIC/Fractran create mode 120000 Lang/FreeBASIC/Function-definition create mode 120000 Lang/FreeBASIC/Function-prototype create mode 120000 Lang/FreeBASIC/GUI-Maximum-window-dimensions create mode 120000 Lang/FreeBASIC/GUI-component-interaction create mode 120000 Lang/FreeBASIC/Gamma-function create mode 120000 Lang/FreeBASIC/Generate-lower-case-ASCII-alphabet create mode 120000 Lang/FreeBASIC/Generic-swap create mode 120000 Lang/FreeBASIC/Greatest-common-divisor create mode 120000 Lang/FreeBASIC/Greatest-element-of-a-list create mode 120000 Lang/FreeBASIC/Greatest-subsequential-sum create mode 120000 Lang/FreeBASIC/Guess-the-number create mode 120000 Lang/FreeBASIC/Guess-the-number-With-feedback create mode 120000 Lang/FreeBASIC/Guess-the-number-With-feedback--player- create mode 120000 Lang/FreeBASIC/Hamming-numbers create mode 120000 Lang/FreeBASIC/Happy-numbers create mode 120000 Lang/FreeBASIC/Harshad-or-Niven-series create mode 120000 Lang/FreeBASIC/Haversine-formula create mode 120000 Lang/FreeBASIC/Hello-world-Graphical create mode 120000 Lang/FreeBASIC/Hello-world-Line-printer create mode 120000 Lang/FreeBASIC/Hello-world-Newline-omission create mode 120000 Lang/FreeBASIC/Hello-world-Standard-error create mode 120000 Lang/FreeBASIC/Hello-world-Text create mode 120000 Lang/FreeBASIC/Heronian-triangles create mode 120000 Lang/FreeBASIC/Hickerson-series-of-almost-integers create mode 120000 Lang/FreeBASIC/Higher-order-functions create mode 120000 Lang/FreeBASIC/Host-introspection create mode 120000 Lang/FreeBASIC/Hostname create mode 120000 Lang/FreeBASIC/I-before-E-except-after-C create mode 120000 Lang/FreeBASIC/IBAN create mode 120000 Lang/FreeBASIC/Identity-matrix create mode 120000 Lang/FreeBASIC/Include-a-file create mode 120000 Lang/FreeBASIC/Increment-a-numerical-string create mode 120000 Lang/FreeBASIC/Infinity create mode 120000 Lang/FreeBASIC/Inheritance-Multiple create mode 120000 Lang/FreeBASIC/Inheritance-Single create mode 120000 Lang/FreeBASIC/Input-loop create mode 120000 Lang/FreeBASIC/Integer-comparison create mode 120000 Lang/FreeBASIC/Integer-overflow create mode 120000 Lang/FreeBASIC/Integer-sequence create mode 120000 Lang/FreeBASIC/Interactive-programming create mode 120000 Lang/FreeBASIC/Inverted-syntax create mode 120000 Lang/FreeBASIC/Iterated-digits-squaring create mode 120000 Lang/FreeBASIC/Jump-anywhere create mode 120000 Lang/FreeBASIC/Kaprekar-numbers create mode 120000 Lang/FreeBASIC/Keyboard-input-Flush-the-keyboard-buffer create mode 120000 Lang/FreeBASIC/Keyboard-input-Keypress-check create mode 120000 Lang/FreeBASIC/Keyboard-input-Obtain-a-Y-or-N-response create mode 120000 Lang/FreeBASIC/Knuth-shuffle create mode 120000 Lang/FreeBASIC/Langtons-ant create mode 120000 Lang/FreeBASIC/Last-Friday-of-each-month create mode 120000 Lang/FreeBASIC/Leap-year create mode 120000 Lang/FreeBASIC/Least-common-multiple create mode 120000 Lang/FreeBASIC/Letter-frequency create mode 120000 Lang/FreeBASIC/Levenshtein-distance create mode 120000 Lang/FreeBASIC/Linear-congruential-generator create mode 120000 Lang/FreeBASIC/Literals-Floating-point create mode 120000 Lang/FreeBASIC/Literals-Integer create mode 120000 Lang/FreeBASIC/Logical-operations create mode 120000 Lang/FreeBASIC/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/FreeBASIC/Loops-Break create mode 120000 Lang/FreeBASIC/Loops-Continue create mode 120000 Lang/FreeBASIC/Loops-Do-while create mode 120000 Lang/FreeBASIC/Loops-Downward-for create mode 120000 Lang/FreeBASIC/Loops-For create mode 120000 Lang/FreeBASIC/Loops-For-with-a-specified-step create mode 120000 Lang/FreeBASIC/Loops-Foreach create mode 120000 Lang/FreeBASIC/Loops-Infinite create mode 120000 Lang/FreeBASIC/Loops-N-plus-one-half create mode 120000 Lang/FreeBASIC/Loops-Nested create mode 120000 Lang/FreeBASIC/Loops-While create mode 120000 Lang/FreeBASIC/Lucas-Lehmer-test create mode 120000 Lang/FreeBASIC/Ludic-numbers create mode 120000 Lang/FreeBASIC/Luhn-test-of-credit-card-numbers create mode 120000 Lang/FreeBASIC/MD4 create mode 120000 Lang/FreeBASIC/MD5-Implementation create mode 120000 Lang/FreeBASIC/Magic-squares-of-odd-order create mode 120000 Lang/FreeBASIC/Maximum-triangle-path-sum create mode 120000 Lang/FreeBASIC/Maze-generation create mode 120000 Lang/FreeBASIC/Memory-layout-of-a-data-structure create mode 120000 Lang/FreeBASIC/Metaprogramming create mode 120000 Lang/FreeBASIC/Middle-three-digits create mode 120000 Lang/FreeBASIC/Monte-Carlo-methods create mode 120000 Lang/FreeBASIC/Morse-code create mode 120000 Lang/FreeBASIC/Multifactorial create mode 120000 Lang/FreeBASIC/Multiplication-tables create mode 120000 Lang/FreeBASIC/Multisplit create mode 120000 Lang/FreeBASIC/Munching-squares create mode 120000 Lang/FreeBASIC/Mutual-recursion create mode 120000 Lang/FreeBASIC/Narcissistic-decimal-number create mode 120000 Lang/FreeBASIC/Non-decimal-radices-Convert create mode 120000 Lang/FreeBASIC/Non-decimal-radices-Input create mode 120000 Lang/FreeBASIC/Non-decimal-radices-Output create mode 120000 Lang/FreeBASIC/Nth create mode 120000 Lang/FreeBASIC/Null-object create mode 120000 Lang/FreeBASIC/Numerical-integration create mode 120000 Lang/FreeBASIC/Ordered-words create mode 120000 Lang/FreeBASIC/Palindrome-detection create mode 120000 Lang/FreeBASIC/Pangram-checker create mode 120000 Lang/FreeBASIC/Pascals-triangle create mode 120000 Lang/FreeBASIC/Perfect-numbers create mode 120000 Lang/FreeBASIC/Pernicious-numbers create mode 120000 Lang/FreeBASIC/Phrase-reversals create mode 120000 Lang/FreeBASIC/Pick-random-element create mode 120000 Lang/FreeBASIC/Pointers-and-references create mode 120000 Lang/FreeBASIC/Polynomial-regression create mode 120000 Lang/FreeBASIC/Price-fraction create mode 120000 Lang/FreeBASIC/Primality-by-trial-division create mode 120000 Lang/FreeBASIC/Prime-decomposition create mode 120000 Lang/FreeBASIC/Probabilistic-choice create mode 120000 Lang/FreeBASIC/Program-name create mode 120000 Lang/FreeBASIC/Program-termination create mode 120000 Lang/FreeBASIC/Pythagorean-triples create mode 100644 Lang/FreeBASIC/README create mode 120000 Lang/FreeBASIC/RIPEMD-160 create mode 120000 Lang/FreeBASIC/Random-number-generator--device- create mode 120000 Lang/FreeBASIC/Random-numbers create mode 120000 Lang/FreeBASIC/Range-expansion create mode 120000 Lang/FreeBASIC/Range-extraction create mode 120000 Lang/FreeBASIC/Ray-casting-algorithm create mode 120000 Lang/FreeBASIC/Read-a-configuration-file create mode 120000 Lang/FreeBASIC/Read-a-file-line-by-line create mode 120000 Lang/FreeBASIC/Read-a-specific-line-from-a-file create mode 120000 Lang/FreeBASIC/Read-entire-file create mode 120000 Lang/FreeBASIC/Real-constants-and-functions create mode 120000 Lang/FreeBASIC/Remove-duplicate-elements create mode 120000 Lang/FreeBASIC/Remove-lines-from-a-file create mode 120000 Lang/FreeBASIC/Rename-a-file create mode 120000 Lang/FreeBASIC/Repeat-a-string create mode 120000 Lang/FreeBASIC/Return-multiple-values create mode 120000 Lang/FreeBASIC/Reverse-a-string create mode 120000 Lang/FreeBASIC/Reverse-words-in-a-string create mode 120000 Lang/FreeBASIC/Roman-numerals-Decode create mode 120000 Lang/FreeBASIC/Roman-numerals-Encode create mode 120000 Lang/FreeBASIC/Rot-13 create mode 120000 Lang/FreeBASIC/Runge-Kutta-method create mode 120000 Lang/FreeBASIC/SEDOLs create mode 120000 Lang/FreeBASIC/SHA-1 create mode 120000 Lang/FreeBASIC/SHA-256 create mode 120000 Lang/FreeBASIC/Self-describing-numbers create mode 120000 Lang/FreeBASIC/Semordnilap create mode 120000 Lang/FreeBASIC/Sequence-of-non-squares create mode 120000 Lang/FreeBASIC/Sequence-of-primes-by-Trial-Division create mode 120000 Lang/FreeBASIC/Shell-one-liner create mode 120000 Lang/FreeBASIC/Short-circuit-evaluation create mode 120000 Lang/FreeBASIC/Show-the-epoch create mode 120000 Lang/FreeBASIC/Sierpinski-triangle-Graphical create mode 120000 Lang/FreeBASIC/Sieve-of-Eratosthenes create mode 120000 Lang/FreeBASIC/Simple-windowed-application create mode 120000 Lang/FreeBASIC/Sleep create mode 120000 Lang/FreeBASIC/Sort-an-integer-array create mode 120000 Lang/FreeBASIC/Sort-using-a-custom-comparator create mode 120000 Lang/FreeBASIC/Sorting-algorithms-Bubble-sort create mode 120000 Lang/FreeBASIC/Sorting-algorithms-Cocktail-sort create mode 120000 Lang/FreeBASIC/Sorting-algorithms-Comb-sort create mode 120000 Lang/FreeBASIC/Sorting-algorithms-Counting-sort create mode 120000 Lang/FreeBASIC/Sorting-algorithms-Gnome-sort create mode 120000 Lang/FreeBASIC/Sorting-algorithms-Heapsort create mode 120000 Lang/FreeBASIC/Sorting-algorithms-Insertion-sort create mode 120000 Lang/FreeBASIC/Sorting-algorithms-Quicksort create mode 120000 Lang/FreeBASIC/Sorting-algorithms-Selection-sort create mode 120000 Lang/FreeBASIC/Sorting-algorithms-Shell-sort create mode 120000 Lang/FreeBASIC/Sorting-algorithms-Sleep-sort create mode 120000 Lang/FreeBASIC/Sorting-algorithms-Stooge-sort create mode 120000 Lang/FreeBASIC/Spiral-matrix create mode 120000 Lang/FreeBASIC/Start-from-a-main-routine create mode 120000 Lang/FreeBASIC/Statistics-Basic create mode 120000 Lang/FreeBASIC/Stem-and-leaf-plot create mode 120000 Lang/FreeBASIC/String-append create mode 120000 Lang/FreeBASIC/String-case create mode 120000 Lang/FreeBASIC/String-comparison create mode 120000 Lang/FreeBASIC/String-concatenation create mode 120000 Lang/FreeBASIC/String-interpolation--included- create mode 120000 Lang/FreeBASIC/String-length create mode 120000 Lang/FreeBASIC/String-matching create mode 120000 Lang/FreeBASIC/String-prepend create mode 120000 Lang/FreeBASIC/Strip-a-set-of-characters-from-a-string create mode 120000 Lang/FreeBASIC/Strip-comments-from-a-string create mode 120000 Lang/FreeBASIC/Strip-control-codes-and-extended-characters-from-a-string create mode 120000 Lang/FreeBASIC/Strip-whitespace-from-a-string-Top-and-tail create mode 120000 Lang/FreeBASIC/Substring create mode 120000 Lang/FreeBASIC/Substring-Top-and-tail create mode 120000 Lang/FreeBASIC/Sum-and-product-of-an-array create mode 120000 Lang/FreeBASIC/Sum-digits-of-an-integer create mode 120000 Lang/FreeBASIC/Sum-multiples-of-3-and-5 create mode 120000 Lang/FreeBASIC/Sum-of-a-series create mode 120000 Lang/FreeBASIC/Sum-of-squares create mode 120000 Lang/FreeBASIC/System-time create mode 120000 Lang/FreeBASIC/Temperature-conversion create mode 120000 Lang/FreeBASIC/Terminal-control-Clear-the-screen create mode 120000 Lang/FreeBASIC/Terminal-control-Ringing-the-terminal-bell create mode 120000 Lang/FreeBASIC/The-ISAAC-Cipher create mode 120000 Lang/FreeBASIC/The-Twelve-Days-of-Christmas create mode 120000 Lang/FreeBASIC/Time-a-function create mode 120000 Lang/FreeBASIC/Topic-variable create mode 120000 Lang/FreeBASIC/Towers-of-Hanoi create mode 120000 Lang/FreeBASIC/Trabb-Pardo-Knuth-algorithm create mode 120000 Lang/FreeBASIC/Trigonometric-functions create mode 120000 Lang/FreeBASIC/Undefined-values create mode 120000 Lang/FreeBASIC/Unicode-variable-names create mode 120000 Lang/FreeBASIC/Update-a-configuration-file create mode 120000 Lang/FreeBASIC/User-input-Text create mode 120000 Lang/FreeBASIC/Vampire-number create mode 120000 Lang/FreeBASIC/Van-der-Corput-sequence create mode 120000 Lang/FreeBASIC/Variable-size-Get create mode 120000 Lang/FreeBASIC/Vector-products create mode 120000 Lang/FreeBASIC/Window-creation create mode 120000 Lang/FreeBASIC/Write-float-arrays-to-a-text-file create mode 120000 Lang/FreeBASIC/Xiaolin-Wus-line-algorithm create mode 120000 Lang/FreeBASIC/Zeckendorf-number-representation create mode 120000 Lang/FreeBASIC/Zero-to-the-zero-power create mode 120000 Lang/FreeBASIC/Zhang-Suen-thinning-algorithm create mode 120000 Lang/FreeBASIC/Zig-zag-matrix create mode 100644 Lang/FunL/00DESCRIPTION create mode 120000 Lang/FunL/100-doors create mode 120000 Lang/FunL/99-Bottles-of-Beer create mode 120000 Lang/FunL/A+B create mode 120000 Lang/FunL/Ackermann-function create mode 120000 Lang/FunL/Apply-a-callback-to-an-array create mode 120000 Lang/FunL/Array-concatenation create mode 120000 Lang/FunL/Averages-Pythagorean-means create mode 120000 Lang/FunL/Bernoulli-numbers create mode 120000 Lang/FunL/Binary-digits create mode 120000 Lang/FunL/CSV-data-manipulation create mode 120000 Lang/FunL/Catalan-numbers create mode 120000 Lang/FunL/Chinese-remainder-theorem create mode 120000 Lang/FunL/Command-line-arguments create mode 120000 Lang/FunL/Conways-Game-of-Life create mode 120000 Lang/FunL/Count-occurrences-of-a-substring create mode 120000 Lang/FunL/Create-a-file create mode 120000 Lang/FunL/Date-format create mode 120000 Lang/FunL/Date-manipulation create mode 120000 Lang/FunL/Dot-product create mode 120000 Lang/FunL/Draw-a-clock create mode 120000 Lang/FunL/Empty-program create mode 120000 Lang/FunL/Environment-variables create mode 120000 Lang/FunL/Evaluate-binomial-coefficients create mode 120000 Lang/FunL/Execute-a-system-command create mode 120000 Lang/FunL/Factorial create mode 120000 Lang/FunL/Factors-of-an-integer create mode 120000 Lang/FunL/Fibonacci-n-step-number-sequences create mode 120000 Lang/FunL/Fibonacci-sequence create mode 120000 Lang/FunL/Function-composition create mode 120000 Lang/FunL/Generator-Exponential create mode 120000 Lang/FunL/Greatest-common-divisor create mode 120000 Lang/FunL/Greatest-element-of-a-list create mode 120000 Lang/FunL/Hailstone-sequence create mode 120000 Lang/FunL/Hamming-numbers create mode 120000 Lang/FunL/Haversine-formula create mode 120000 Lang/FunL/Hello-world-Graphical create mode 120000 Lang/FunL/Hello-world-Text create mode 120000 Lang/FunL/Hello-world-Web-server create mode 120000 Lang/FunL/Horners-rule-for-polynomial-evaluation create mode 120000 Lang/FunL/Identity-matrix create mode 120000 Lang/FunL/Integer-comparison create mode 120000 Lang/FunL/Integer-sequence create mode 120000 Lang/FunL/JSON create mode 120000 Lang/FunL/Knuth-shuffle create mode 120000 Lang/FunL/Least-common-multiple create mode 120000 Lang/FunL/List-comprehensions create mode 120000 Lang/FunL/Logical-operations create mode 120000 Lang/FunL/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/FunL/Lucas-Lehmer-test create mode 120000 Lang/FunL/Luhn-test-of-credit-card-numbers create mode 120000 Lang/FunL/Matrix-arithmetic create mode 120000 Lang/FunL/Modular-inverse create mode 120000 Lang/FunL/Multifactorial create mode 120000 Lang/FunL/Narcissistic-decimal-number create mode 120000 Lang/FunL/Non-decimal-radices-Convert create mode 120000 Lang/FunL/Parsing-RPN-calculator-algorithm create mode 120000 Lang/FunL/Partial-function-application create mode 120000 Lang/FunL/Pascals-triangle create mode 120000 Lang/FunL/Perfect-numbers create mode 120000 Lang/FunL/Pi create mode 120000 Lang/FunL/Power-set create mode 120000 Lang/FunL/Primality-by-trial-division create mode 120000 Lang/FunL/Priority-queue create mode 100644 Lang/FunL/README create mode 120000 Lang/FunL/Return-multiple-values create mode 120000 Lang/FunL/Roots-of-unity create mode 120000 Lang/FunL/Rot-13 create mode 120000 Lang/FunL/SHA-256 create mode 120000 Lang/FunL/Set create mode 120000 Lang/FunL/Sort-an-integer-array create mode 120000 Lang/FunL/Sort-using-a-custom-comparator create mode 120000 Lang/FunL/Sorting-algorithms-Heapsort create mode 120000 Lang/FunL/Sorting-algorithms-Merge-sort create mode 120000 Lang/FunL/Sorting-algorithms-Quicksort create mode 120000 Lang/FunL/String-interpolation--included- create mode 120000 Lang/FunL/Table-creation-Postal-addresses create mode 120000 Lang/FunL/Terminal-control-Coloured-text create mode 120000 Lang/FunL/Terminal-control-Hiding-the-cursor create mode 120000 Lang/FunL/Terminal-control-Inverse-video create mode 120000 Lang/FunL/Terminal-control-Unicode-output create mode 120000 Lang/FunL/Top-rank-per-group create mode 120000 Lang/FunL/Topological-sort create mode 120000 Lang/FunL/Tree-traversal create mode 120000 Lang/FunL/Unix-ls create mode 120000 Lang/FunL/Vector-products create mode 120000 Lang/FunL/Web-scraping create mode 100644 Lang/Futhark/00DESCRIPTION create mode 120000 Lang/Futhark/100-doors create mode 120000 Lang/Futhark/Ackermann-function create mode 120000 Lang/Futhark/Almost-prime create mode 120000 Lang/Futhark/Amicable-pairs create mode 120000 Lang/Futhark/Arithmetic-Complex create mode 120000 Lang/Futhark/Arithmetic-geometric-mean create mode 120000 Lang/Futhark/Array-concatenation create mode 120000 Lang/Futhark/Arrays create mode 120000 Lang/Futhark/Averages-Pythagorean-means create mode 120000 Lang/Futhark/Averages-Root-mean-square create mode 120000 Lang/Futhark/Binary-digits create mode 120000 Lang/Futhark/Binary-search create mode 120000 Lang/Futhark/Comments create mode 120000 Lang/Futhark/Conditional-structures create mode 120000 Lang/Futhark/Conways-Game-of-Life create mode 120000 Lang/Futhark/Count-in-octal create mode 120000 Lang/Futhark/Empty-program create mode 120000 Lang/Futhark/Euler-method create mode 120000 Lang/Futhark/Even-or-odd create mode 120000 Lang/Futhark/Factorial create mode 120000 Lang/Futhark/Fibonacci-sequence create mode 120000 Lang/Futhark/Filter create mode 120000 Lang/Futhark/Function-definition create mode 120000 Lang/Futhark/Hailstone-sequence create mode 120000 Lang/Futhark/Integer-sequence create mode 120000 Lang/Futhark/Loops-For create mode 120000 Lang/Futhark/MD5 create mode 120000 Lang/Futhark/Mandelbrot-set create mode 120000 Lang/Futhark/Matrix-multiplication create mode 120000 Lang/Futhark/Monte-Carlo-methods create mode 100644 Lang/Futhark/README create mode 100644 Lang/FutureBasic/00DESCRIPTION create mode 120000 Lang/FutureBasic/100-doors create mode 120000 Lang/FutureBasic/99-Bottles-of-Beer create mode 120000 Lang/FutureBasic/Ackermann-function create mode 120000 Lang/FutureBasic/Address-of-a-variable create mode 120000 Lang/FutureBasic/Anagrams create mode 120000 Lang/FutureBasic/Arithmetic-Integer create mode 120000 Lang/FutureBasic/Bitwise-operations create mode 120000 Lang/FutureBasic/Calendar create mode 120000 Lang/FutureBasic/Copy-a-string create mode 120000 Lang/FutureBasic/Count-in-octal create mode 120000 Lang/FutureBasic/Count-the-coins create mode 120000 Lang/FutureBasic/Detect-division-by-zero create mode 120000 Lang/FutureBasic/Draw-a-sphere create mode 120000 Lang/FutureBasic/Empty-program create mode 120000 Lang/FutureBasic/Empty-string create mode 120000 Lang/FutureBasic/Enumerations create mode 120000 Lang/FutureBasic/Execute-a-system-command create mode 120000 Lang/FutureBasic/Factorial create mode 120000 Lang/FutureBasic/Factors-of-an-integer create mode 120000 Lang/FutureBasic/Fibonacci-sequence create mode 120000 Lang/FutureBasic/FizzBuzz create mode 120000 Lang/FutureBasic/Formatted-numeric-output create mode 120000 Lang/FutureBasic/Function-definition create mode 120000 Lang/FutureBasic/Generic-swap create mode 120000 Lang/FutureBasic/Haversine-formula create mode 120000 Lang/FutureBasic/Hello-world-Newbie create mode 120000 Lang/FutureBasic/Heronian-triangles create mode 120000 Lang/FutureBasic/Higher-order-functions create mode 120000 Lang/FutureBasic/Hofstadter-Conway-$10,000-sequence create mode 120000 Lang/FutureBasic/Horizontal-sundial-calculations create mode 120000 Lang/FutureBasic/Include-a-file create mode 120000 Lang/FutureBasic/Increment-a-numerical-string create mode 120000 Lang/FutureBasic/Input-loop create mode 120000 Lang/FutureBasic/Integer-comparison create mode 120000 Lang/FutureBasic/Jump-anywhere create mode 120000 Lang/FutureBasic/Keyboard-input-Obtain-a-Y-or-N-response create mode 120000 Lang/FutureBasic/Knapsack-problem-0-1 create mode 120000 Lang/FutureBasic/Leap-year create mode 120000 Lang/FutureBasic/Levenshtein-distance create mode 120000 Lang/FutureBasic/Literals-Integer create mode 120000 Lang/FutureBasic/Logical-operations create mode 120000 Lang/FutureBasic/Loops-Break create mode 120000 Lang/FutureBasic/Loops-Do-while create mode 120000 Lang/FutureBasic/Loops-Downward-for create mode 120000 Lang/FutureBasic/Loops-For-with-a-specified-step create mode 120000 Lang/FutureBasic/Loops-Infinite create mode 120000 Lang/FutureBasic/Loops-N-plus-one-half create mode 120000 Lang/FutureBasic/Loops-While create mode 120000 Lang/FutureBasic/Nth-root create mode 120000 Lang/FutureBasic/Pi create mode 120000 Lang/FutureBasic/Primality-by-trial-division create mode 100644 Lang/FutureBasic/README create mode 120000 Lang/FutureBasic/Random-numbers create mode 120000 Lang/FutureBasic/Read-a-specific-line-from-a-file create mode 120000 Lang/FutureBasic/Read-entire-file create mode 120000 Lang/FutureBasic/Real-constants-and-functions create mode 120000 Lang/FutureBasic/Return-multiple-values create mode 120000 Lang/FutureBasic/Reverse-a-string create mode 120000 Lang/FutureBasic/Roman-numerals-Decode create mode 120000 Lang/FutureBasic/Roman-numerals-Encode create mode 120000 Lang/FutureBasic/Roots-of-unity create mode 120000 Lang/FutureBasic/Runge-Kutta-method create mode 120000 Lang/FutureBasic/Shell-one-liner create mode 120000 Lang/FutureBasic/Show-the-epoch create mode 120000 Lang/FutureBasic/Sieve-of-Eratosthenes create mode 120000 Lang/FutureBasic/Soundex create mode 120000 Lang/FutureBasic/String-case create mode 120000 Lang/FutureBasic/Sudoku create mode 120000 Lang/FutureBasic/Towers-of-Hanoi create mode 120000 Lang/FutureBasic/Zero-to-the-zero-power create mode 100644 Lang/GEORGE/00DESCRIPTION create mode 120000 Lang/GEORGE/Arithmetic-Integer create mode 120000 Lang/GEORGE/Averages-Arithmetic-mean create mode 120000 Lang/GEORGE/Averages-Root-mean-square create mode 100644 Lang/GEORGE/README create mode 120000 Lang/GEORGE/Sum-of-a-series create mode 120000 Lang/GEORGE/Sum-of-squares create mode 100644 Lang/GFA-Basic/00DESCRIPTION create mode 120000 Lang/GFA-Basic/100-doors create mode 120000 Lang/GFA-Basic/Abundant,-deficient-and-perfect-number-classifications create mode 120000 Lang/GFA-Basic/Amicable-pairs create mode 120000 Lang/GFA-Basic/Averages-Arithmetic-mean create mode 120000 Lang/GFA-Basic/Caesar-cipher create mode 120000 Lang/GFA-Basic/Fibonacci-sequence create mode 120000 Lang/GFA-Basic/FizzBuzz create mode 120000 Lang/GFA-Basic/Greatest-common-divisor create mode 120000 Lang/GFA-Basic/Hello-world-Text create mode 120000 Lang/GFA-Basic/Langtons-ant create mode 120000 Lang/GFA-Basic/One-dimensional-cellular-automata create mode 100644 Lang/GFA-Basic/README create mode 120000 Lang/GFA-Basic/Reverse-a-string create mode 120000 Lang/GFA-Basic/Sum-and-product-of-an-array create mode 120000 Lang/GFA-Basic/Tree-traversal create mode 100644 Lang/GLSL/00DESCRIPTION create mode 120000 Lang/GLSL/Mandelbrot-set create mode 120000 Lang/GLSL/Munching-squares create mode 100644 Lang/GLSL/README create mode 100644 Lang/Glagol/00DESCRIPTION create mode 120000 Lang/Glagol/Balanced-ternary create mode 100644 Lang/Glagol/README create mode 100644 Lang/Golo/00DESCRIPTION create mode 100644 Lang/Golo/README create mode 100644 Lang/Gri/00DESCRIPTION create mode 120000 Lang/Gri/Comments create mode 120000 Lang/Gri/Documentation create mode 120000 Lang/Gri/Dragon-curve create mode 120000 Lang/Gri/Environment-variables create mode 120000 Lang/Gri/Find-limit-of-recursion create mode 120000 Lang/Gri/Generic-swap create mode 100644 Lang/Gri/README create mode 100644 Lang/HPPPL/00DESCRIPTION create mode 120000 Lang/HPPPL/Bitwise-operations create mode 120000 Lang/HPPPL/Conditional-structures create mode 120000 Lang/HPPPL/Hello-world-Graphical create mode 120000 Lang/HPPPL/Hello-world-Text create mode 100644 Lang/HPPPL/README create mode 100644 Lang/Hack/00DESCRIPTION create mode 120000 Lang/Hack/Hello-world-Text create mode 120000 Lang/Hack/Loops-For create mode 100644 Lang/Hack/README create mode 100644 Lang/Harbour/00DESCRIPTION create mode 120000 Lang/Harbour/100-doors create mode 120000 Lang/Harbour/ABC-Problem create mode 120000 Lang/Harbour/Arithmetic-Integer create mode 120000 Lang/Harbour/Arrays create mode 120000 Lang/Harbour/Associative-array-Creation create mode 120000 Lang/Harbour/Associative-array-Iteration create mode 120000 Lang/Harbour/Catalan-numbers create mode 120000 Lang/Harbour/Command-line-arguments create mode 120000 Lang/Harbour/Conditional-structures create mode 120000 Lang/Harbour/Fibonacci-sequence create mode 120000 Lang/Harbour/Five-weekends create mode 120000 Lang/Harbour/Happy-numbers create mode 120000 Lang/Harbour/Hash-from-two-arrays create mode 120000 Lang/Harbour/Hello-world-Graphical create mode 120000 Lang/Harbour/Hello-world-Line-printer create mode 120000 Lang/Harbour/Hello-world-Newline-omission create mode 120000 Lang/Harbour/Hello-world-Text create mode 120000 Lang/Harbour/Hostname create mode 120000 Lang/Harbour/Include-a-file create mode 120000 Lang/Harbour/Integer-comparison create mode 120000 Lang/Harbour/JSON create mode 120000 Lang/Harbour/Leap-year create mode 120000 Lang/Harbour/Letter-frequency create mode 120000 Lang/Harbour/Literals-Integer create mode 120000 Lang/Harbour/Logical-operations create mode 120000 Lang/Harbour/Loops-Break create mode 120000 Lang/Harbour/Loops-Do-while create mode 120000 Lang/Harbour/Loops-Downward-for create mode 100644 Lang/Harbour/README create mode 120000 Lang/Harbour/Rename-a-file create mode 120000 Lang/Harbour/Repeat-a-string create mode 120000 Lang/Harbour/Return-multiple-values create mode 120000 Lang/Harbour/Reverse-a-string create mode 120000 Lang/Harbour/Runtime-evaluation create mode 120000 Lang/Harbour/String-comparison create mode 100644 Lang/HolyC/00DESCRIPTION create mode 100644 Lang/HolyC/README create mode 100644 Lang/Hoon/00DESCRIPTION create mode 120000 Lang/Hoon/Arbitrary-precision-integers--included- create mode 120000 Lang/Hoon/FizzBuzz create mode 120000 Lang/Hoon/Greatest-element-of-a-list create mode 120000 Lang/Hoon/Hello-world-Text create mode 120000 Lang/Hoon/JSON create mode 120000 Lang/Hoon/Quine create mode 100644 Lang/Hoon/README create mode 120000 Lang/Hoon/System-time create mode 100644 Lang/Hy/00DESCRIPTION create mode 120000 Lang/Hy/100-doors create mode 120000 Lang/Hy/Averages-Arithmetic-mean create mode 120000 Lang/Hy/Bulls-and-cows create mode 120000 Lang/Hy/Constrained-random-points-on-a-circle create mode 120000 Lang/Hy/Fibonacci-sequence create mode 120000 Lang/Hy/FizzBuzz create mode 120000 Lang/Hy/Hello-world-Text create mode 120000 Lang/Hy/Leap-year create mode 120000 Lang/Hy/Multiple-regression create mode 120000 Lang/Hy/Polynomial-regression create mode 100644 Lang/Hy/README create mode 120000 Lang/Hy/Statistics-Basic create mode 120000 Lang/Hy/Verify-distribution-uniformity-Chi-squared-test create mode 120000 Lang/Hy/Verify-distribution-uniformity-Naive create mode 100644 Lang/I/00DESCRIPTION create mode 120000 Lang/I/100-doors create mode 120000 Lang/I/A+B create mode 120000 Lang/I/Arithmetic-Integer create mode 120000 Lang/I/Array-concatenation create mode 120000 Lang/I/Arrays create mode 120000 Lang/I/Boolean-values create mode 120000 Lang/I/Call-a-function create mode 120000 Lang/I/Character-codes create mode 120000 Lang/I/Check-that-file-exists create mode 120000 Lang/I/Conditional-structures create mode 120000 Lang/I/Copy-a-string create mode 120000 Lang/I/Create-a-file create mode 120000 Lang/I/Detect-division-by-zero create mode 120000 Lang/I/Determine-if-a-string-is-numeric create mode 120000 Lang/I/Empty-program create mode 120000 Lang/I/Empty-string create mode 120000 Lang/I/Environment-variables create mode 120000 Lang/I/Factorial create mode 120000 Lang/I/File-input-output create mode 120000 Lang/I/Find-limit-of-recursion create mode 120000 Lang/I/FizzBuzz create mode 120000 Lang/I/Hello-world-Graphical create mode 120000 Lang/I/Hello-world-Text create mode 100644 Lang/I/README create mode 100644 Lang/Idris/00DESCRIPTION create mode 120000 Lang/Idris/100-doors create mode 120000 Lang/Idris/99-Bottles-of-Beer create mode 120000 Lang/Idris/A+B create mode 120000 Lang/Idris/AKS-test-for-primes create mode 120000 Lang/Idris/Ackermann-function create mode 120000 Lang/Idris/Binary-digits create mode 120000 Lang/Idris/Boolean-values create mode 120000 Lang/Idris/Cholesky-decomposition create mode 120000 Lang/Idris/Dot-product create mode 120000 Lang/Idris/Fast-Fourier-transform create mode 120000 Lang/Idris/Fibonacci-sequence create mode 120000 Lang/Idris/FizzBuzz create mode 120000 Lang/Idris/Haversine-formula create mode 120000 Lang/Idris/LU-decomposition create mode 120000 Lang/Idris/Matrix-multiplication create mode 120000 Lang/Idris/Matrix-transposition create mode 120000 Lang/Idris/Mutual-recursion create mode 100644 Lang/Idris/README create mode 120000 Lang/Idris/Repeat-a-string create mode 100644 Lang/JOVIAL/00DESCRIPTION create mode 120000 Lang/JOVIAL/Factorial create mode 100644 Lang/JOVIAL/README create mode 120000 Lang/JOVIAL/Sieve-of-Eratosthenes create mode 100644 Lang/Jack/00DESCRIPTION create mode 120000 Lang/Jack/Hello-world-Newline-omission create mode 120000 Lang/Jack/Hello-world-Text create mode 100644 Lang/Jack/README create mode 100644 Lang/Kamailio-Script/00DESCRIPTION create mode 120000 Lang/Kamailio-Script/FizzBuzz create mode 100644 Lang/Kamailio-Script/README create mode 100644 Lang/Kitten/00DESCRIPTION create mode 120000 Lang/Kitten/Hello-world-Text create mode 100644 Lang/Kitten/README create mode 100644 Lang/Klong/00DESCRIPTION create mode 120000 Lang/Klong/99-Bottles-of-Beer create mode 120000 Lang/Klong/Factorial create mode 120000 Lang/Klong/FizzBuzz create mode 120000 Lang/Klong/Greatest-element-of-a-list create mode 120000 Lang/Klong/Middle-three-digits create mode 100644 Lang/Klong/README create mode 100644 Lang/L++/00DESCRIPTION create mode 120000 Lang/L++/A+B create mode 120000 Lang/L++/Balanced-brackets create mode 120000 Lang/L++/Even-or-odd create mode 120000 Lang/L++/Fibonacci-sequence create mode 100644 Lang/L++/README create mode 120000 Lang/L++/Reverse-a-string create mode 100644 Lang/LC2200-Assembly/00DESCRIPTION create mode 100644 Lang/LC2200-Assembly/README create mode 100644 Lang/LC3-Assembly/00DESCRIPTION create mode 120000 Lang/LC3-Assembly/Conditional-structures create mode 120000 Lang/LC3-Assembly/Copy-a-string create mode 120000 Lang/LC3-Assembly/Empty-program create mode 120000 Lang/LC3-Assembly/Even-or-odd create mode 120000 Lang/LC3-Assembly/Generate-lower-case-ASCII-alphabet create mode 120000 Lang/LC3-Assembly/Hello-world-Text create mode 120000 Lang/LC3-Assembly/Loops-For create mode 100644 Lang/LC3-Assembly/README create mode 120000 Lang/LC3-Assembly/Reverse-a-string create mode 100644 Lang/LFE/00DESCRIPTION create mode 120000 Lang/LFE/Accumulator-factory create mode 120000 Lang/LFE/Ackermann-function create mode 120000 Lang/LFE/Arithmetic-Complex create mode 120000 Lang/LFE/Arithmetic-Integer create mode 120000 Lang/LFE/Arithmetic-geometric-mean create mode 120000 Lang/LFE/Array-concatenation create mode 120000 Lang/LFE/Arrays create mode 120000 Lang/LFE/Associative-array-Creation create mode 120000 Lang/LFE/Associative-array-Iteration create mode 120000 Lang/LFE/Averages-Arithmetic-mean create mode 120000 Lang/LFE/Binary-digits create mode 120000 Lang/LFE/Bitwise-operations create mode 120000 Lang/LFE/Boolean-values create mode 120000 Lang/LFE/Call-a-function create mode 120000 Lang/LFE/Call-an-object-method create mode 120000 Lang/LFE/Character-codes create mode 120000 Lang/LFE/Check-that-file-exists create mode 120000 Lang/LFE/Classes create mode 120000 Lang/LFE/Closures-Value-capture create mode 120000 Lang/LFE/Combinations-with-repetitions create mode 120000 Lang/LFE/Command-line-arguments create mode 120000 Lang/LFE/Compound-data-type create mode 120000 Lang/LFE/Concurrent-computing create mode 120000 Lang/LFE/Copy-a-string create mode 120000 Lang/LFE/Count-in-octal create mode 120000 Lang/LFE/Create-a-file create mode 120000 Lang/LFE/Currying create mode 120000 Lang/LFE/Distributed-programming create mode 120000 Lang/LFE/Dot-product create mode 120000 Lang/LFE/Echo-server create mode 120000 Lang/LFE/Empty-string create mode 120000 Lang/LFE/Events create mode 120000 Lang/LFE/Execute-a-system-command create mode 120000 Lang/LFE/Factorial create mode 120000 Lang/LFE/Factors-of-an-integer create mode 120000 Lang/LFE/Fibonacci-sequence create mode 120000 Lang/LFE/Flatten-a-list create mode 120000 Lang/LFE/Fork create mode 120000 Lang/LFE/Function-composition create mode 120000 Lang/LFE/Function-definition create mode 120000 Lang/LFE/Greatest-common-divisor create mode 120000 Lang/LFE/Greatest-element-of-a-list create mode 120000 Lang/LFE/Guess-the-number create mode 120000 Lang/LFE/Guess-the-number-With-feedback create mode 120000 Lang/LFE/HTTP create mode 120000 Lang/LFE/Hash-from-two-arrays create mode 120000 Lang/LFE/Hash-join create mode 120000 Lang/LFE/Hello-world-Newline-omission create mode 120000 Lang/LFE/Hello-world-Text create mode 120000 Lang/LFE/Hostname create mode 120000 Lang/LFE/Identity-matrix create mode 120000 Lang/LFE/JSON create mode 120000 Lang/LFE/Levenshtein-distance create mode 120000 Lang/LFE/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/LFE/Loops-Foreach create mode 120000 Lang/LFE/Matrix-multiplication create mode 120000 Lang/LFE/Matrix-transposition create mode 120000 Lang/LFE/Non-decimal-radices-Convert create mode 120000 Lang/LFE/Partial-function-application create mode 120000 Lang/LFE/Permutations create mode 120000 Lang/LFE/Prime-decomposition create mode 100644 Lang/LFE/README create mode 120000 Lang/LFE/Read-entire-file create mode 120000 Lang/LFE/Rename-a-file create mode 120000 Lang/LFE/Rep-string create mode 120000 Lang/LFE/Repeat-a-string create mode 120000 Lang/LFE/Reverse-a-string create mode 120000 Lang/LFE/Set create mode 120000 Lang/LFE/String-length create mode 120000 Lang/LFE/String-prepend create mode 120000 Lang/LFE/Substring create mode 120000 Lang/LFE/Sum-of-a-series create mode 120000 Lang/LFE/Sum-of-squares create mode 120000 Lang/LFE/System-time create mode 120000 Lang/LFE/Tokenize-a-string create mode 120000 Lang/LFE/Unicode-strings create mode 120000 Lang/LFE/Word-wrap create mode 100644 Lang/Lambda-Prolog/00DESCRIPTION create mode 120000 Lang/Lambda-Prolog/99-Bottles-of-Beer create mode 100644 Lang/Lambda-Prolog/README create mode 100644 Lang/Lasso/00DESCRIPTION create mode 120000 Lang/Lasso/100-doors create mode 120000 Lang/Lasso/24-game create mode 120000 Lang/Lasso/9-billion-names-of-God-the-integer create mode 120000 Lang/Lasso/99-Bottles-of-Beer create mode 120000 Lang/Lasso/A+B create mode 120000 Lang/Lasso/Abstract-type create mode 120000 Lang/Lasso/Ackermann-function create mode 120000 Lang/Lasso/Align-columns create mode 120000 Lang/Lasso/Anagrams create mode 120000 Lang/Lasso/Anagrams-Deranged-anagrams create mode 120000 Lang/Lasso/Apply-a-callback-to-an-array create mode 120000 Lang/Lasso/Arbitrary-precision-integers--included- create mode 120000 Lang/Lasso/Arithmetic-Integer create mode 120000 Lang/Lasso/Array-concatenation create mode 120000 Lang/Lasso/Arrays create mode 120000 Lang/Lasso/Assertions create mode 120000 Lang/Lasso/Associative-array-Creation create mode 120000 Lang/Lasso/Associative-array-Iteration create mode 120000 Lang/Lasso/Atomic-updates create mode 120000 Lang/Lasso/Averages-Arithmetic-mean create mode 120000 Lang/Lasso/Averages-Median create mode 120000 Lang/Lasso/Averages-Mode create mode 120000 Lang/Lasso/Averages-Pythagorean-means create mode 120000 Lang/Lasso/Averages-Root-mean-square create mode 120000 Lang/Lasso/Averages-Simple-moving-average create mode 120000 Lang/Lasso/Balanced-brackets create mode 120000 Lang/Lasso/Boolean-values create mode 120000 Lang/Lasso/Box-the-compass create mode 120000 Lang/Lasso/Bulls-and-cows create mode 120000 Lang/Lasso/Case-sensitivity-of-identifiers create mode 120000 Lang/Lasso/Character-codes create mode 120000 Lang/Lasso/Check-that-file-exists create mode 120000 Lang/Lasso/Classes create mode 120000 Lang/Lasso/Comma-quibbling create mode 120000 Lang/Lasso/Command-line-arguments create mode 120000 Lang/Lasso/Comments create mode 120000 Lang/Lasso/Compound-data-type create mode 120000 Lang/Lasso/Copy-a-string create mode 120000 Lang/Lasso/Count-occurrences-of-a-substring create mode 120000 Lang/Lasso/Count-the-coins create mode 120000 Lang/Lasso/Create-a-file create mode 120000 Lang/Lasso/Create-an-HTML-table create mode 120000 Lang/Lasso/DNS-query create mode 120000 Lang/Lasso/Date-format create mode 120000 Lang/Lasso/Date-manipulation create mode 120000 Lang/Lasso/Day-of-the-week create mode 120000 Lang/Lasso/Deepcopy create mode 120000 Lang/Lasso/Define-a-primitive-data-type create mode 120000 Lang/Lasso/Delete-a-file create mode 120000 Lang/Lasso/Detect-division-by-zero create mode 120000 Lang/Lasso/Determine-if-a-string-is-numeric create mode 120000 Lang/Lasso/Determine-if-only-one-instance-is-running create mode 120000 Lang/Lasso/Dutch-national-flag-problem create mode 120000 Lang/Lasso/Dynamic-variable-names create mode 120000 Lang/Lasso/Empty-directory create mode 120000 Lang/Lasso/Empty-program create mode 120000 Lang/Lasso/Empty-string create mode 120000 Lang/Lasso/Environment-variables create mode 120000 Lang/Lasso/Evaluate-binomial-coefficients create mode 120000 Lang/Lasso/Even-or-odd create mode 120000 Lang/Lasso/Exceptions create mode 120000 Lang/Lasso/Exceptions-Catch-an-exception-thrown-in-a-nested-call create mode 120000 Lang/Lasso/Execute-a-system-command create mode 120000 Lang/Lasso/Extend-your-language create mode 120000 Lang/Lasso/Factorial create mode 120000 Lang/Lasso/Fibonacci-sequence create mode 120000 Lang/Lasso/File-modification-time create mode 120000 Lang/Lasso/File-size create mode 120000 Lang/Lasso/Filter create mode 120000 Lang/Lasso/Find-common-directory-path create mode 120000 Lang/Lasso/Find-the-last-Sunday-of-each-month create mode 120000 Lang/Lasso/First-class-functions create mode 120000 Lang/Lasso/Five-weekends create mode 120000 Lang/Lasso/FizzBuzz create mode 120000 Lang/Lasso/Flatten-a-list create mode 120000 Lang/Lasso/Floyds-triangle create mode 120000 Lang/Lasso/Fork create mode 120000 Lang/Lasso/Formatted-numeric-output create mode 120000 Lang/Lasso/Forward-difference create mode 120000 Lang/Lasso/Function-definition create mode 120000 Lang/Lasso/Generic-swap create mode 120000 Lang/Lasso/Globally-replace-text-in-several-files create mode 120000 Lang/Lasso/Greatest-element-of-a-list create mode 120000 Lang/Lasso/Guess-the-number create mode 120000 Lang/Lasso/Guess-the-number-With-feedback create mode 120000 Lang/Lasso/Guess-the-number-With-feedback--player- create mode 120000 Lang/Lasso/HTTP create mode 120000 Lang/Lasso/HTTPS create mode 120000 Lang/Lasso/HTTPS-Authenticated create mode 120000 Lang/Lasso/HTTPS-Client-authenticated create mode 120000 Lang/Lasso/Hailstone-sequence create mode 120000 Lang/Lasso/Happy-numbers create mode 120000 Lang/Lasso/Hash-from-two-arrays create mode 120000 Lang/Lasso/Hello-world-Graphical create mode 120000 Lang/Lasso/Hello-world-Line-printer create mode 120000 Lang/Lasso/Hello-world-Newline-omission create mode 120000 Lang/Lasso/Hello-world-Standard-error create mode 120000 Lang/Lasso/Hello-world-Text create mode 120000 Lang/Lasso/Hello-world-Web-server create mode 120000 Lang/Lasso/Hostname create mode 120000 Lang/Lasso/I-before-E-except-after-C create mode 120000 Lang/Lasso/Include-a-file create mode 120000 Lang/Lasso/Increment-a-numerical-string create mode 120000 Lang/Lasso/Infinity create mode 120000 Lang/Lasso/Inheritance-Multiple create mode 120000 Lang/Lasso/Inheritance-Single create mode 120000 Lang/Lasso/Input-loop create mode 120000 Lang/Lasso/Integer-comparison create mode 120000 Lang/Lasso/Integer-sequence create mode 120000 Lang/Lasso/Interactive-programming create mode 120000 Lang/Lasso/Introspection create mode 120000 Lang/Lasso/JSON create mode 120000 Lang/Lasso/Knuth-shuffle create mode 120000 Lang/Lasso/Last-Friday-of-each-month create mode 120000 Lang/Lasso/Leap-year create mode 120000 Lang/Lasso/Least-common-multiple create mode 120000 Lang/Lasso/Letter-frequency create mode 120000 Lang/Lasso/List-comprehensions create mode 120000 Lang/Lasso/Literals-Floating-point create mode 120000 Lang/Lasso/Literals-Integer create mode 120000 Lang/Lasso/Literals-String create mode 120000 Lang/Lasso/Logical-operations create mode 120000 Lang/Lasso/Look-and-say-sequence create mode 120000 Lang/Lasso/Loops-Break create mode 120000 Lang/Lasso/Loops-Continue create mode 120000 Lang/Lasso/Loops-Do-while create mode 120000 Lang/Lasso/Loops-Downward-for create mode 120000 Lang/Lasso/Loops-For create mode 120000 Lang/Lasso/Loops-For-with-a-specified-step create mode 120000 Lang/Lasso/Loops-Foreach create mode 120000 Lang/Lasso/Loops-Infinite create mode 120000 Lang/Lasso/Loops-N-plus-one-half create mode 120000 Lang/Lasso/Loops-Nested create mode 120000 Lang/Lasso/Loops-While create mode 120000 Lang/Lasso/Luhn-test-of-credit-card-numbers create mode 120000 Lang/Lasso/MD4 create mode 120000 Lang/Lasso/MD5 create mode 120000 Lang/Lasso/Mandelbrot-set create mode 120000 Lang/Lasso/Map-range create mode 120000 Lang/Lasso/Middle-three-digits create mode 120000 Lang/Lasso/Multiplication-tables create mode 120000 Lang/Lasso/Named-parameters create mode 120000 Lang/Lasso/Null-object create mode 120000 Lang/Lasso/Odd-word-problem create mode 120000 Lang/Lasso/Optional-parameters create mode 120000 Lang/Lasso/Order-two-numerical-lists create mode 120000 Lang/Lasso/Ordered-words create mode 120000 Lang/Lasso/Palindrome-detection create mode 120000 Lang/Lasso/Perfect-numbers create mode 120000 Lang/Lasso/Pi create mode 120000 Lang/Lasso/Pick-random-element create mode 120000 Lang/Lasso/Priority-queue create mode 120000 Lang/Lasso/Problem-of-Apollonius create mode 120000 Lang/Lasso/Program-name create mode 120000 Lang/Lasso/Program-termination create mode 120000 Lang/Lasso/Pythagorean-triples create mode 120000 Lang/Lasso/Queue-Definition create mode 120000 Lang/Lasso/Queue-Usage create mode 120000 Lang/Lasso/Quine create mode 100644 Lang/Lasso/README create mode 120000 Lang/Lasso/RIPEMD-160 create mode 120000 Lang/Lasso/Random-number-generator--device- create mode 120000 Lang/Lasso/Range-expansion create mode 120000 Lang/Lasso/Read-a-configuration-file create mode 120000 Lang/Lasso/Read-a-file-line-by-line create mode 120000 Lang/Lasso/Read-a-specific-line-from-a-file create mode 120000 Lang/Lasso/Read-entire-file create mode 120000 Lang/Lasso/Real-constants-and-functions create mode 120000 Lang/Lasso/Regular-expressions create mode 120000 Lang/Lasso/Remove-duplicate-elements create mode 120000 Lang/Lasso/Remove-lines-from-a-file create mode 120000 Lang/Lasso/Rename-a-file create mode 120000 Lang/Lasso/Repeat-a-string create mode 120000 Lang/Lasso/Respond-to-an-unknown-method-call create mode 120000 Lang/Lasso/Return-multiple-values create mode 120000 Lang/Lasso/Reverse-a-string create mode 120000 Lang/Lasso/Rock-paper-scissors create mode 120000 Lang/Lasso/Roman-numerals-Decode create mode 120000 Lang/Lasso/Roman-numerals-Encode create mode 120000 Lang/Lasso/Rot-13 create mode 120000 Lang/Lasso/Run-length-encoding create mode 120000 Lang/Lasso/Runtime-evaluation create mode 120000 Lang/Lasso/SHA-1 create mode 120000 Lang/Lasso/SHA-256 create mode 120000 Lang/Lasso/Search-a-list create mode 120000 Lang/Lasso/Semordnilap create mode 120000 Lang/Lasso/Send-an-unknown-method-call create mode 120000 Lang/Lasso/Send-email create mode 120000 Lang/Lasso/Set create mode 120000 Lang/Lasso/Shell-one-liner create mode 120000 Lang/Lasso/Show-the-epoch create mode 120000 Lang/Lasso/Singleton create mode 120000 Lang/Lasso/Sleep create mode 120000 Lang/Lasso/Sockets create mode 120000 Lang/Lasso/Sort-an-integer-array create mode 120000 Lang/Lasso/Sort-stability create mode 120000 Lang/Lasso/Special-characters create mode 120000 Lang/Lasso/Special-variables create mode 120000 Lang/Lasso/Stack create mode 120000 Lang/Lasso/Stack-traces create mode 120000 Lang/Lasso/Statistics-Basic create mode 120000 Lang/Lasso/String-append create mode 120000 Lang/Lasso/String-case create mode 120000 Lang/Lasso/String-comparison create mode 120000 Lang/Lasso/String-concatenation create mode 120000 Lang/Lasso/String-interpolation--included- create mode 120000 Lang/Lasso/String-length create mode 120000 Lang/Lasso/String-matching create mode 120000 Lang/Lasso/String-prepend create mode 120000 Lang/Lasso/Strip-a-set-of-characters-from-a-string create mode 120000 Lang/Lasso/Strip-whitespace-from-a-string-Top-and-tail create mode 120000 Lang/Lasso/Substring create mode 120000 Lang/Lasso/Substring-Top-and-tail create mode 120000 Lang/Lasso/Sum-and-product-of-an-array create mode 120000 Lang/Lasso/Sum-digits-of-an-integer create mode 120000 Lang/Lasso/Sum-multiples-of-3-and-5 create mode 120000 Lang/Lasso/Sum-of-a-series create mode 120000 Lang/Lasso/Sum-of-squares create mode 120000 Lang/Lasso/Symmetric-difference create mode 120000 Lang/Lasso/System-time create mode 120000 Lang/Lasso/Table-creation-Postal-addresses create mode 120000 Lang/Lasso/Take-notes-on-the-command-line create mode 120000 Lang/Lasso/Temperature-conversion create mode 120000 Lang/Lasso/Terminal-control-Clear-the-screen create mode 120000 Lang/Lasso/Terminal-control-Coloured-text create mode 120000 Lang/Lasso/Terminal-control-Cursor-movement create mode 120000 Lang/Lasso/Terminal-control-Cursor-positioning create mode 120000 Lang/Lasso/Terminal-control-Display-an-extended-character create mode 120000 Lang/Lasso/Terminal-control-Hiding-the-cursor create mode 120000 Lang/Lasso/Terminal-control-Inverse-video create mode 120000 Lang/Lasso/Terminal-control-Ringing-the-terminal-bell create mode 120000 Lang/Lasso/Terminal-control-Unicode-output create mode 120000 Lang/Lasso/Test-a-function create mode 120000 Lang/Lasso/Tic-tac-toe create mode 120000 Lang/Lasso/Time-a-function create mode 120000 Lang/Lasso/Towers-of-Hanoi create mode 120000 Lang/Lasso/Truncate-a-file create mode 120000 Lang/Lasso/URL-decoding create mode 120000 Lang/Lasso/URL-encoding create mode 120000 Lang/Lasso/Unicode-strings create mode 120000 Lang/Lasso/Update-a-configuration-file create mode 120000 Lang/Lasso/User-input-Text create mode 120000 Lang/Lasso/Variable-size-Get create mode 120000 Lang/Lasso/Variables create mode 120000 Lang/Lasso/Variadic-function create mode 120000 Lang/Lasso/Walk-a-directory-Non-recursively create mode 120000 Lang/Lasso/Walk-a-directory-Recursively create mode 120000 Lang/Lasso/Web-scraping create mode 120000 Lang/Lasso/Word-wrap create mode 120000 Lang/Lasso/Write-language-name-in-3D-ASCII create mode 120000 Lang/Lasso/XML-DOM-serialization create mode 120000 Lang/Lasso/XML-Input create mode 120000 Lang/Lasso/XML-Output create mode 120000 Lang/Lasso/XML-XPath create mode 120000 Lang/Lasso/Zig-zag-matrix create mode 100644 Lang/Leon/00DESCRIPTION create mode 100644 Lang/Leon/README create mode 100644 Lang/LibreOffice-Basic/00DESCRIPTION create mode 120000 Lang/LibreOffice-Basic/Mutual-recursion create mode 100644 Lang/LibreOffice-Basic/README create mode 100644 Lang/Lily/00DESCRIPTION create mode 120000 Lang/Lily/100-doors create mode 120000 Lang/Lily/Comments create mode 120000 Lang/Lily/Function-definition create mode 120000 Lang/Lily/Hello-world-Text create mode 120000 Lang/Lily/Higher-order-functions create mode 120000 Lang/Lily/Loops-Infinite create mode 120000 Lang/Lily/Null-object create mode 100644 Lang/Lily/README create mode 120000 Lang/Lily/Return-multiple-values create mode 120000 Lang/Lily/Unicode-variable-names create mode 100644 Lang/Lingo/00DESCRIPTION create mode 120000 Lang/Lingo/Abstract-type create mode 120000 Lang/Lingo/Anonymous-recursion create mode 120000 Lang/Lingo/Arithmetic-Rational create mode 120000 Lang/Lingo/Array-concatenation create mode 120000 Lang/Lingo/Arrays create mode 120000 Lang/Lingo/Assertions create mode 120000 Lang/Lingo/Associative-array-Creation create mode 120000 Lang/Lingo/Associative-array-Iteration create mode 120000 Lang/Lingo/Bitmap create mode 120000 Lang/Lingo/Bitmap-Flood-fill create mode 120000 Lang/Lingo/Bitwise-IO create mode 120000 Lang/Lingo/Bitwise-operations create mode 120000 Lang/Lingo/Boolean-values create mode 120000 Lang/Lingo/CRC-32 create mode 120000 Lang/Lingo/CSV-data-manipulation create mode 120000 Lang/Lingo/Calendar create mode 120000 Lang/Lingo/Call-a-function create mode 120000 Lang/Lingo/Call-a-function-in-a-shared-library create mode 120000 Lang/Lingo/Call-an-object-method create mode 120000 Lang/Lingo/Character-codes create mode 120000 Lang/Lingo/Classes create mode 120000 Lang/Lingo/Closures-Value-capture create mode 120000 Lang/Lingo/Collections create mode 120000 Lang/Lingo/Color-of-a-screen-pixel create mode 120000 Lang/Lingo/Command-line-arguments create mode 120000 Lang/Lingo/Comments create mode 120000 Lang/Lingo/Compile-time-calculation create mode 120000 Lang/Lingo/Compound-data-type create mode 120000 Lang/Lingo/Copy-a-string create mode 120000 Lang/Lingo/Create-a-file create mode 120000 Lang/Lingo/Create-an-HTML-table create mode 120000 Lang/Lingo/Date-manipulation create mode 120000 Lang/Lingo/Day-of-the-week create mode 120000 Lang/Lingo/Deepcopy create mode 120000 Lang/Lingo/Delete-a-file create mode 120000 Lang/Lingo/Detect-division-by-zero create mode 120000 Lang/Lingo/Draw-a-sphere create mode 120000 Lang/Lingo/Dynamic-variable-names create mode 120000 Lang/Lingo/Empty-directory create mode 120000 Lang/Lingo/Empty-program create mode 120000 Lang/Lingo/Empty-string create mode 120000 Lang/Lingo/Enumerations create mode 120000 Lang/Lingo/Environment-variables create mode 120000 Lang/Lingo/Even-or-odd create mode 120000 Lang/Lingo/Events create mode 120000 Lang/Lingo/Exceptions create mode 120000 Lang/Lingo/Execute-a-system-command create mode 120000 Lang/Lingo/Exponentiation-operator create mode 120000 Lang/Lingo/Factorial create mode 120000 Lang/Lingo/Factors-of-an-integer create mode 120000 Lang/Lingo/Fibonacci-sequence create mode 120000 Lang/Lingo/File-input-output create mode 120000 Lang/Lingo/File-size create mode 120000 Lang/Lingo/Find-common-directory-path create mode 120000 Lang/Lingo/First-class-functions create mode 120000 Lang/Lingo/Fractal-tree create mode 120000 Lang/Lingo/Function-composition create mode 120000 Lang/Lingo/Function-definition create mode 120000 Lang/Lingo/GUI-Maximum-window-dimensions create mode 120000 Lang/Lingo/Generate-lower-case-ASCII-alphabet create mode 120000 Lang/Lingo/Generic-swap create mode 120000 Lang/Lingo/Grayscale-image create mode 120000 Lang/Lingo/Greatest-element-of-a-list create mode 120000 Lang/Lingo/HTTP create mode 120000 Lang/Lingo/HTTPS create mode 120000 Lang/Lingo/Hailstone-sequence create mode 120000 Lang/Lingo/Hash-from-two-arrays create mode 120000 Lang/Lingo/Hello-world-Graphical create mode 120000 Lang/Lingo/Hello-world-Standard-error create mode 120000 Lang/Lingo/Hello-world-Text create mode 120000 Lang/Lingo/Here-document create mode 120000 Lang/Lingo/Higher-order-functions create mode 120000 Lang/Lingo/Hostname create mode 120000 Lang/Lingo/Include-a-file create mode 120000 Lang/Lingo/Increment-a-numerical-string create mode 120000 Lang/Lingo/Infinity create mode 120000 Lang/Lingo/Inheritance-Multiple create mode 120000 Lang/Lingo/Inheritance-Single create mode 120000 Lang/Lingo/Integer-comparison create mode 120000 Lang/Lingo/Integer-overflow create mode 120000 Lang/Lingo/Integer-sequence create mode 120000 Lang/Lingo/Interactive-programming create mode 120000 Lang/Lingo/Introspection create mode 120000 Lang/Lingo/JSON create mode 120000 Lang/Lingo/Jump-anywhere create mode 120000 Lang/Lingo/Keyboard-input-Keypress-check create mode 120000 Lang/Lingo/Leap-year create mode 120000 Lang/Lingo/Literals-Floating-point create mode 120000 Lang/Lingo/Literals-String create mode 120000 Lang/Lingo/Loops-Break create mode 120000 Lang/Lingo/Loops-Continue create mode 120000 Lang/Lingo/Loops-Do-while create mode 120000 Lang/Lingo/Loops-Downward-for create mode 120000 Lang/Lingo/Loops-For create mode 120000 Lang/Lingo/Loops-For-with-a-specified-step create mode 120000 Lang/Lingo/Loops-Foreach create mode 120000 Lang/Lingo/Loops-Infinite create mode 120000 Lang/Lingo/Loops-Nested create mode 120000 Lang/Lingo/Loops-While create mode 120000 Lang/Lingo/MD5 create mode 120000 Lang/Lingo/Memory-allocation create mode 120000 Lang/Lingo/Metaprogramming create mode 120000 Lang/Lingo/Mouse-position create mode 120000 Lang/Lingo/Named-parameters create mode 120000 Lang/Lingo/Nth-root create mode 120000 Lang/Lingo/Null-object create mode 120000 Lang/Lingo/Ordered-words create mode 120000 Lang/Lingo/Perfect-numbers create mode 120000 Lang/Lingo/Prime-decomposition create mode 120000 Lang/Lingo/Program-name create mode 100644 Lang/Lingo/README create mode 120000 Lang/Lingo/Range-expansion create mode 120000 Lang/Lingo/Read-a-file-line-by-line create mode 120000 Lang/Lingo/Read-entire-file create mode 120000 Lang/Lingo/Real-constants-and-functions create mode 120000 Lang/Lingo/Repeat-a-string create mode 120000 Lang/Lingo/Reverse-a-string create mode 120000 Lang/Lingo/Search-a-list create mode 120000 Lang/Lingo/Send-an-unknown-method-call create mode 120000 Lang/Lingo/Send-email create mode 120000 Lang/Lingo/Simple-windowed-application create mode 120000 Lang/Lingo/Singleton create mode 120000 Lang/Lingo/Sleep create mode 120000 Lang/Lingo/Sort-an-integer-array create mode 120000 Lang/Lingo/Special-characters create mode 120000 Lang/Lingo/Stack create mode 120000 Lang/Lingo/String-append create mode 120000 Lang/Lingo/String-case create mode 120000 Lang/Lingo/String-comparison create mode 120000 Lang/Lingo/String-concatenation create mode 120000 Lang/Lingo/String-length create mode 120000 Lang/Lingo/String-matching create mode 120000 Lang/Lingo/String-prepend create mode 120000 Lang/Lingo/Substring create mode 120000 Lang/Lingo/Sum-and-product-of-an-array create mode 120000 Lang/Lingo/Sum-digits-of-an-integer create mode 120000 Lang/Lingo/Sum-multiples-of-3-and-5 create mode 120000 Lang/Lingo/Sum-of-a-series create mode 120000 Lang/Lingo/System-time create mode 120000 Lang/Lingo/Time-a-function create mode 120000 Lang/Lingo/Tokenize-a-string create mode 120000 Lang/Lingo/Towers-of-Hanoi create mode 120000 Lang/Lingo/Tree-traversal create mode 120000 Lang/Lingo/Truncate-a-file create mode 120000 Lang/Lingo/URL-encoding create mode 120000 Lang/Lingo/Undefined-values create mode 120000 Lang/Lingo/Unicode-strings create mode 120000 Lang/Lingo/Unicode-variable-names create mode 120000 Lang/Lingo/Variables create mode 120000 Lang/Lingo/Vector-products create mode 120000 Lang/Lingo/Visualize-a-tree create mode 120000 Lang/Lingo/Walk-a-directory-Non-recursively create mode 120000 Lang/Lingo/Window-creation create mode 120000 Lang/Lingo/Word-wrap create mode 120000 Lang/Lingo/Write-float-arrays-to-a-text-file create mode 120000 Lang/Lingo/XML-DOM-serialization create mode 120000 Lang/Lingo/XML-Input create mode 100644 Lang/LiveCode/00DESCRIPTION create mode 120000 Lang/LiveCode/100-doors create mode 120000 Lang/LiveCode/24-game create mode 120000 Lang/LiveCode/99-Bottles-of-Beer create mode 120000 Lang/LiveCode/A+B create mode 120000 Lang/LiveCode/Ackermann-function create mode 120000 Lang/LiveCode/Anagrams create mode 120000 Lang/LiveCode/Arithmetic-Integer create mode 120000 Lang/LiveCode/Arithmetic-geometric-mean create mode 120000 Lang/LiveCode/Associative-array-Creation create mode 120000 Lang/LiveCode/Associative-array-Iteration create mode 120000 Lang/LiveCode/Averages-Arithmetic-mean create mode 120000 Lang/LiveCode/Averages-Median create mode 120000 Lang/LiveCode/Bitwise-operations create mode 120000 Lang/LiveCode/Caesar-cipher create mode 120000 Lang/LiveCode/Character-codes create mode 120000 Lang/LiveCode/Check-that-file-exists create mode 120000 Lang/LiveCode/Comments create mode 120000 Lang/LiveCode/Copy-a-string create mode 120000 Lang/LiveCode/Day-of-the-week create mode 120000 Lang/LiveCode/Even-or-odd create mode 120000 Lang/LiveCode/Factorial create mode 120000 Lang/LiveCode/Fibonacci-sequence create mode 120000 Lang/LiveCode/File-size create mode 120000 Lang/LiveCode/Find-the-last-Sunday-of-each-month create mode 120000 Lang/LiveCode/FizzBuzz create mode 120000 Lang/LiveCode/Function-definition create mode 120000 Lang/LiveCode/Function-frequency create mode 120000 Lang/LiveCode/GUI-enabling-disabling-of-controls create mode 120000 Lang/LiveCode/Generic-swap create mode 120000 Lang/LiveCode/Greatest-common-divisor create mode 120000 Lang/LiveCode/Greatest-element-of-a-list create mode 120000 Lang/LiveCode/Guess-the-number create mode 120000 Lang/LiveCode/Guess-the-number-With-feedback create mode 120000 Lang/LiveCode/HTTP create mode 120000 Lang/LiveCode/HTTPS create mode 120000 Lang/LiveCode/HTTPS-Authenticated create mode 120000 Lang/LiveCode/Hash-from-two-arrays create mode 120000 Lang/LiveCode/Haversine-formula create mode 120000 Lang/LiveCode/Hello-world-Graphical create mode 120000 Lang/LiveCode/Hello-world-Text create mode 120000 Lang/LiveCode/Horizontal-sundial-calculations create mode 120000 Lang/LiveCode/Hostname create mode 120000 Lang/LiveCode/Increment-a-numerical-string create mode 120000 Lang/LiveCode/Integer-comparison create mode 120000 Lang/LiveCode/Keyboard-input-Keypress-check create mode 120000 Lang/LiveCode/Keyboard-input-Obtain-a-Y-or-N-response create mode 120000 Lang/LiveCode/Last-Friday-of-each-month create mode 120000 Lang/LiveCode/Leap-year create mode 120000 Lang/LiveCode/Literals-Integer create mode 120000 Lang/LiveCode/Literals-String create mode 120000 Lang/LiveCode/Logical-operations create mode 120000 Lang/LiveCode/Look-and-say-sequence create mode 120000 Lang/LiveCode/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/LiveCode/Loops-Break create mode 120000 Lang/LiveCode/Loops-Continue create mode 120000 Lang/LiveCode/Loops-Do-while create mode 120000 Lang/LiveCode/Loops-Downward-for create mode 120000 Lang/LiveCode/Loops-For create mode 120000 Lang/LiveCode/Loops-For-with-a-specified-step create mode 120000 Lang/LiveCode/Loops-Foreach create mode 120000 Lang/LiveCode/Loops-Infinite create mode 120000 Lang/LiveCode/Loops-N-plus-one-half create mode 120000 Lang/LiveCode/Loops-Nested create mode 120000 Lang/LiveCode/Loops-While create mode 120000 Lang/LiveCode/Luhn-test-of-credit-card-numbers create mode 120000 Lang/LiveCode/MD5 create mode 120000 Lang/LiveCode/Palindrome-detection create mode 120000 Lang/LiveCode/Pick-random-element create mode 100644 Lang/LiveCode/README create mode 120000 Lang/LiveCode/Range-expansion create mode 120000 Lang/LiveCode/Range-extraction create mode 120000 Lang/LiveCode/Read-a-file-line-by-line create mode 120000 Lang/LiveCode/Read-entire-file create mode 120000 Lang/LiveCode/Real-constants-and-functions create mode 120000 Lang/LiveCode/Record-sound create mode 120000 Lang/LiveCode/Rename-a-file create mode 120000 Lang/LiveCode/Repeat-a-string create mode 120000 Lang/LiveCode/Reverse-a-string create mode 120000 Lang/LiveCode/Reverse-words-in-a-string create mode 120000 Lang/LiveCode/Roman-numerals-Encode create mode 120000 Lang/LiveCode/Rot-13 create mode 120000 Lang/LiveCode/Run-length-encoding create mode 120000 Lang/LiveCode/SHA-1 create mode 120000 Lang/LiveCode/Self-describing-numbers create mode 120000 Lang/LiveCode/Send-email create mode 120000 Lang/LiveCode/Short-circuit-evaluation create mode 120000 Lang/LiveCode/Show-the-epoch create mode 120000 Lang/LiveCode/Sieve-of-Eratosthenes create mode 120000 Lang/LiveCode/Sort-an-integer-array create mode 120000 Lang/LiveCode/Sparkline-in-unicode create mode 120000 Lang/LiveCode/Special-variables create mode 120000 Lang/LiveCode/State-name-puzzle create mode 120000 Lang/LiveCode/String-append create mode 120000 Lang/LiveCode/String-case create mode 120000 Lang/LiveCode/String-concatenation create mode 120000 Lang/LiveCode/String-interpolation--included- create mode 120000 Lang/LiveCode/String-prepend create mode 120000 Lang/LiveCode/Strip-a-set-of-characters-from-a-string create mode 120000 Lang/LiveCode/Substring create mode 120000 Lang/LiveCode/Substring-Top-and-tail create mode 120000 Lang/LiveCode/Sum-and-product-of-an-array create mode 120000 Lang/LiveCode/Sum-digits-of-an-integer create mode 120000 Lang/LiveCode/Sum-multiples-of-3-and-5 create mode 120000 Lang/LiveCode/Sum-of-a-series create mode 120000 Lang/LiveCode/Sum-of-squares create mode 120000 Lang/LiveCode/System-time create mode 120000 Lang/LiveCode/Temperature-conversion create mode 120000 Lang/LiveCode/URL-decoding create mode 120000 Lang/LiveCode/URL-encoding create mode 120000 Lang/LiveCode/Unicode-variable-names create mode 120000 Lang/LiveCode/Unix-ls create mode 120000 Lang/LiveCode/Variable-length-quantity create mode 120000 Lang/LiveCode/Walk-a-directory-Non-recursively create mode 120000 Lang/LiveCode/Walk-a-directory-Recursively create mode 120000 Lang/LiveCode/XML-Input create mode 120000 Lang/LiveCode/XML-XPath create mode 100644 Lang/LiveScript/00DESCRIPTION create mode 120000 Lang/LiveScript/FizzBuzz create mode 100644 Lang/LiveScript/README create mode 120000 Lang/LiveScript/Reverse-words-in-a-string create mode 120000 Lang/LiveScript/Roman-numerals-Decode create mode 100644 Lang/Lobster/00DESCRIPTION create mode 120000 Lang/Lobster/FizzBuzz create mode 120000 Lang/Lobster/Hello-world-Graphical create mode 120000 Lang/Lobster/Hello-world-Text create mode 100644 Lang/Lobster/README create mode 120000 Lang/Lobster/Sorting-algorithms-Quicksort create mode 100644 Lang/Loglan82/00DESCRIPTION create mode 100644 Lang/Loglan82/README create mode 100644 Lang/Luck/00DESCRIPTION create mode 120000 Lang/Luck/Ackermann-function create mode 120000 Lang/Luck/Call-a-foreign-language-function create mode 120000 Lang/Luck/Call-a-function create mode 120000 Lang/Luck/Fibonacci-sequence create mode 120000 Lang/Luck/FizzBuzz create mode 120000 Lang/Luck/Function-prototype create mode 120000 Lang/Luck/Greatest-common-divisor create mode 120000 Lang/Luck/Higher-order-functions create mode 100644 Lang/Luck/README create mode 100644 Lang/MINIL/00DESCRIPTION create mode 120000 Lang/MINIL/Evaluate-binomial-coefficients create mode 120000 Lang/MINIL/Greatest-common-divisor create mode 100644 Lang/MINIL/README create mode 100644 Lang/MLite/00DESCRIPTION create mode 120000 Lang/MLite/Harshad-or-Niven-series create mode 100644 Lang/MLite/README create mode 100644 Lang/MSX-BASIC/00DESCRIPTION create mode 100644 Lang/MSX-BASIC/README create mode 100644 Lang/Malbolge/00DESCRIPTION create mode 120000 Lang/Malbolge/99-Bottles-of-Beer create mode 120000 Lang/Malbolge/Hello-world-Text create mode 100644 Lang/Malbolge/README create mode 100644 Lang/Maude/00DESCRIPTION create mode 120000 Lang/Maude/A+B create mode 120000 Lang/Maude/Factorial create mode 120000 Lang/Maude/Hello-world-Text create mode 100644 Lang/Maude/README create mode 100644 Lang/Mond/00DESCRIPTION create mode 100644 Lang/Mond/README create mode 120000 Lang/Mond/Sorting-algorithms-Quicksort create mode 100644 Lang/Monicelli/00DESCRIPTION create mode 120000 Lang/Monicelli/Conditional-structures create mode 120000 Lang/Monicelli/Fibonacci-sequence create mode 120000 Lang/Monicelli/Loops-Do-while create mode 100644 Lang/Monicelli/README create mode 100644 Lang/Monte/00DESCRIPTION create mode 120000 Lang/Monte/Arrays create mode 120000 Lang/Monte/Boolean-values create mode 120000 Lang/Monte/Comments create mode 120000 Lang/Monte/FizzBuzz create mode 120000 Lang/Monte/Hello-world-Newbie create mode 120000 Lang/Monte/Loops-Infinite create mode 120000 Lang/Monte/Loops-While create mode 100644 Lang/Monte/README create mode 120000 Lang/Monte/Repeat-a-string create mode 120000 Lang/Monte/Towers-of-Hanoi create mode 100644 Lang/MoonScript/00DESCRIPTION create mode 120000 Lang/MoonScript/100-doors create mode 120000 Lang/MoonScript/99-Bottles-of-Beer create mode 120000 Lang/MoonScript/A+B create mode 120000 Lang/MoonScript/FizzBuzz create mode 100644 Lang/MoonScript/README create mode 120000 Lang/MoonScript/Read-a-specific-line-from-a-file create mode 100644 Lang/Morfa/00DESCRIPTION create mode 120000 Lang/Morfa/Add-a-variable-to-a-class-instance-at-runtime create mode 120000 Lang/Morfa/Averages-Root-mean-square create mode 120000 Lang/Morfa/Conditional-structures create mode 120000 Lang/Morfa/Constrained-genericity create mode 120000 Lang/Morfa/Extend-your-language create mode 120000 Lang/Morfa/Hello-world-Text create mode 120000 Lang/Morfa/Higher-order-functions create mode 120000 Lang/Morfa/Loops-For create mode 120000 Lang/Morfa/Loops-While create mode 100644 Lang/Morfa/README create mode 100644 Lang/MyrtleScript/00DESCRIPTION create mode 120000 Lang/MyrtleScript/Factorial create mode 120000 Lang/MyrtleScript/Hello-world-Text create mode 100644 Lang/MyrtleScript/README create mode 100644 Lang/NESL/00DESCRIPTION create mode 120000 Lang/NESL/Case-sensitivity-of-identifiers create mode 120000 Lang/NESL/Character-codes create mode 120000 Lang/NESL/Comments create mode 120000 Lang/NESL/Empty-string create mode 120000 Lang/NESL/Even-or-odd create mode 120000 Lang/NESL/Fibonacci-sequence create mode 120000 Lang/NESL/Function-definition create mode 120000 Lang/NESL/Generate-lower-case-ASCII-alphabet create mode 100644 Lang/NESL/README create mode 100644 Lang/NGS/00DESCRIPTION create mode 120000 Lang/NGS/Accumulator-factory create mode 120000 Lang/NGS/Apply-a-callback-to-an-array create mode 120000 Lang/NGS/Delegates create mode 120000 Lang/NGS/Fibonacci-sequence create mode 120000 Lang/NGS/Flatten-a-list create mode 120000 Lang/NGS/Multiple-distinct-objects create mode 100644 Lang/NGS/README create mode 120000 Lang/NGS/Rep-string create mode 100644 Lang/NewtonScript/00DESCRIPTION create mode 120000 Lang/NewtonScript/FizzBuzz create mode 100644 Lang/NewtonScript/README create mode 100644 Lang/Nim/00DESCRIPTION create mode 120000 Lang/Nim/100-doors create mode 120000 Lang/Nim/24-game create mode 120000 Lang/Nim/9-billion-names-of-God-the-integer create mode 120000 Lang/Nim/99-Bottles-of-Beer create mode 120000 Lang/Nim/A+B create mode 120000 Lang/Nim/ABC-Problem create mode 120000 Lang/Nim/Abstract-type create mode 120000 Lang/Nim/Abundant,-deficient-and-perfect-number-classifications create mode 120000 Lang/Nim/Accumulator-factory create mode 120000 Lang/Nim/Ackermann-function create mode 120000 Lang/Nim/Address-of-a-variable create mode 120000 Lang/Nim/Align-columns create mode 120000 Lang/Nim/Amb create mode 120000 Lang/Nim/Amicable-pairs create mode 120000 Lang/Nim/Anagrams create mode 120000 Lang/Nim/Anonymous-recursion create mode 120000 Lang/Nim/Apply-a-callback-to-an-array create mode 120000 Lang/Nim/Arbitrary-precision-integers--included- create mode 120000 Lang/Nim/Arithmetic-Complex create mode 120000 Lang/Nim/Arithmetic-Integer create mode 120000 Lang/Nim/Arithmetic-Rational create mode 120000 Lang/Nim/Arithmetic-geometric-mean create mode 120000 Lang/Nim/Array-concatenation create mode 120000 Lang/Nim/Arrays create mode 120000 Lang/Nim/Assertions create mode 120000 Lang/Nim/Associative-array-Creation create mode 120000 Lang/Nim/Associative-array-Iteration create mode 120000 Lang/Nim/Average-loop-length create mode 120000 Lang/Nim/Averages-Arithmetic-mean create mode 120000 Lang/Nim/Averages-Mean-angle create mode 120000 Lang/Nim/Averages-Mean-time-of-day create mode 120000 Lang/Nim/Averages-Median create mode 120000 Lang/Nim/Averages-Mode create mode 120000 Lang/Nim/Averages-Pythagorean-means create mode 120000 Lang/Nim/Averages-Root-mean-square create mode 120000 Lang/Nim/Averages-Simple-moving-average create mode 120000 Lang/Nim/Balanced-brackets create mode 120000 Lang/Nim/Binary-digits create mode 120000 Lang/Nim/Binary-search create mode 120000 Lang/Nim/Binary-strings create mode 120000 Lang/Nim/Bitmap create mode 120000 Lang/Nim/Bitmap-Bresenhams-line-algorithm create mode 120000 Lang/Nim/Bitmap-Read-a-PPM-file create mode 120000 Lang/Nim/Bitwise-operations create mode 120000 Lang/Nim/Boolean-values create mode 120000 Lang/Nim/Box-the-compass create mode 120000 Lang/Nim/Break-OO-privacy create mode 120000 Lang/Nim/Bulls-and-cows create mode 120000 Lang/Nim/CRC-32 create mode 120000 Lang/Nim/CSV-data-manipulation create mode 120000 Lang/Nim/CSV-to-HTML-translation create mode 120000 Lang/Nim/Caesar-cipher create mode 120000 Lang/Nim/Call-a-foreign-language-function create mode 120000 Lang/Nim/Call-a-function create mode 120000 Lang/Nim/Call-a-function-in-a-shared-library create mode 120000 Lang/Nim/Call-an-object-method create mode 120000 Lang/Nim/Case-sensitivity-of-identifiers create mode 120000 Lang/Nim/Casting-out-nines create mode 120000 Lang/Nim/Catalan-numbers create mode 120000 Lang/Nim/Catalan-numbers-Pascals-triangle create mode 120000 Lang/Nim/Catamorphism create mode 120000 Lang/Nim/Character-codes create mode 120000 Lang/Nim/Chat-server create mode 120000 Lang/Nim/Check-that-file-exists create mode 120000 Lang/Nim/Chinese-remainder-theorem create mode 120000 Lang/Nim/Cholesky-decomposition create mode 120000 Lang/Nim/Circles-of-given-radius-through-two-points create mode 120000 Lang/Nim/Classes create mode 120000 Lang/Nim/Closures-Value-capture create mode 120000 Lang/Nim/Collections create mode 120000 Lang/Nim/Color-of-a-screen-pixel create mode 120000 Lang/Nim/Combinations create mode 120000 Lang/Nim/Combinations-and-permutations create mode 120000 Lang/Nim/Combinations-with-repetitions create mode 120000 Lang/Nim/Comma-quibbling create mode 120000 Lang/Nim/Command-line-arguments create mode 120000 Lang/Nim/Comments create mode 120000 Lang/Nim/Compile-time-calculation create mode 120000 Lang/Nim/Compound-data-type create mode 120000 Lang/Nim/Concurrent-computing create mode 120000 Lang/Nim/Conditional-structures create mode 120000 Lang/Nim/Constrained-genericity create mode 120000 Lang/Nim/Constrained-random-points-on-a-circle create mode 120000 Lang/Nim/Conways-Game-of-Life create mode 120000 Lang/Nim/Copy-a-string create mode 120000 Lang/Nim/Count-in-factors create mode 120000 Lang/Nim/Count-in-octal create mode 120000 Lang/Nim/Count-occurrences-of-a-substring create mode 120000 Lang/Nim/Count-the-coins create mode 120000 Lang/Nim/Create-a-file create mode 120000 Lang/Nim/Create-a-file-on-magnetic-tape create mode 120000 Lang/Nim/Create-a-two-dimensional-array-at-runtime create mode 120000 Lang/Nim/Create-an-HTML-table create mode 120000 Lang/Nim/Currying create mode 120000 Lang/Nim/Date-format create mode 120000 Lang/Nim/Date-manipulation create mode 120000 Lang/Nim/Day-of-the-week create mode 120000 Lang/Nim/Deal-cards-for-FreeCell create mode 120000 Lang/Nim/Deepcopy create mode 120000 Lang/Nim/Define-a-primitive-data-type create mode 120000 Lang/Nim/Delete-a-file create mode 120000 Lang/Nim/Detect-division-by-zero create mode 120000 Lang/Nim/Determine-if-a-string-is-numeric create mode 120000 Lang/Nim/Determine-if-only-one-instance-is-running create mode 120000 Lang/Nim/Digital-root create mode 120000 Lang/Nim/Digital-root-Multiplicative-digital-root create mode 120000 Lang/Nim/Dining-philosophers create mode 120000 Lang/Nim/Distributed-programming create mode 120000 Lang/Nim/Documentation create mode 120000 Lang/Nim/Dot-product create mode 120000 Lang/Nim/Doubly-linked-list-Definition create mode 120000 Lang/Nim/Doubly-linked-list-Element-definition create mode 120000 Lang/Nim/Doubly-linked-list-Element-insertion create mode 120000 Lang/Nim/Doubly-linked-list-Traversal create mode 120000 Lang/Nim/Draw-a-clock create mode 120000 Lang/Nim/Draw-a-cuboid create mode 120000 Lang/Nim/Draw-a-sphere create mode 120000 Lang/Nim/Echo-server create mode 120000 Lang/Nim/Empty-directory create mode 120000 Lang/Nim/Empty-string create mode 120000 Lang/Nim/Enforced-immutability create mode 120000 Lang/Nim/Entropy create mode 120000 Lang/Nim/Enumerations create mode 120000 Lang/Nim/Environment-variables create mode 120000 Lang/Nim/Equilibrium-index create mode 120000 Lang/Nim/Ethiopian-multiplication create mode 120000 Lang/Nim/Euler-method create mode 120000 Lang/Nim/Evaluate-binomial-coefficients create mode 120000 Lang/Nim/Even-or-odd create mode 120000 Lang/Nim/Events create mode 120000 Lang/Nim/Evolutionary-algorithm create mode 120000 Lang/Nim/Exceptions create mode 120000 Lang/Nim/Exceptions-Catch-an-exception-thrown-in-a-nested-call create mode 120000 Lang/Nim/Executable-library create mode 120000 Lang/Nim/Execute-Brain---- create mode 120000 Lang/Nim/Execute-HQ9+ create mode 120000 Lang/Nim/Execute-a-system-command create mode 120000 Lang/Nim/Exponentiation-operator create mode 120000 Lang/Nim/Extend-your-language create mode 120000 Lang/Nim/Extreme-floating-point-values create mode 120000 Lang/Nim/Factorial create mode 120000 Lang/Nim/Factors-of-a-Mersenne-number create mode 120000 Lang/Nim/Factors-of-an-integer create mode 120000 Lang/Nim/Fast-Fourier-transform create mode 120000 Lang/Nim/Fibonacci-n-step-number-sequences create mode 120000 Lang/Nim/Fibonacci-sequence create mode 120000 Lang/Nim/File-input-output create mode 120000 Lang/Nim/File-modification-time create mode 120000 Lang/Nim/File-size create mode 120000 Lang/Nim/Filter create mode 120000 Lang/Nim/Find-common-directory-path create mode 120000 Lang/Nim/Find-limit-of-recursion create mode 120000 Lang/Nim/Find-the-last-Sunday-of-each-month create mode 120000 Lang/Nim/Find-the-missing-permutation create mode 120000 Lang/Nim/First-class-functions create mode 120000 Lang/Nim/Five-weekends create mode 120000 Lang/Nim/FizzBuzz create mode 120000 Lang/Nim/Flatten-a-list create mode 120000 Lang/Nim/Flow-control-structures create mode 120000 Lang/Nim/Floyds-triangle create mode 120000 Lang/Nim/Forest-fire create mode 120000 Lang/Nim/Fork create mode 120000 Lang/Nim/Formatted-numeric-output create mode 120000 Lang/Nim/Forward-difference create mode 120000 Lang/Nim/Four-bit-adder create mode 120000 Lang/Nim/Function-composition create mode 120000 Lang/Nim/Function-definition create mode 120000 Lang/Nim/Function-prototype create mode 120000 Lang/Nim/GUI-Maximum-window-dimensions create mode 120000 Lang/Nim/GUI-component-interaction create mode 120000 Lang/Nim/GUI-enabling-disabling-of-controls create mode 120000 Lang/Nim/Gamma-function create mode 120000 Lang/Nim/Generate-lower-case-ASCII-alphabet create mode 120000 Lang/Nim/Generator-Exponential create mode 120000 Lang/Nim/Generic-swap create mode 120000 Lang/Nim/Globally-replace-text-in-several-files create mode 120000 Lang/Nim/Gray-code create mode 120000 Lang/Nim/Greatest-common-divisor create mode 120000 Lang/Nim/Greatest-element-of-a-list create mode 120000 Lang/Nim/Greatest-subsequential-sum create mode 120000 Lang/Nim/Guess-the-number create mode 120000 Lang/Nim/Guess-the-number-With-feedback create mode 120000 Lang/Nim/Guess-the-number-With-feedback--player- create mode 120000 Lang/Nim/HTTP create mode 120000 Lang/Nim/HTTPS create mode 120000 Lang/Nim/Hailstone-sequence create mode 120000 Lang/Nim/Hamming-numbers create mode 120000 Lang/Nim/Handle-a-signal create mode 120000 Lang/Nim/Happy-numbers create mode 120000 Lang/Nim/Harshad-or-Niven-series create mode 120000 Lang/Nim/Hash-from-two-arrays create mode 120000 Lang/Nim/Haversine-formula create mode 120000 Lang/Nim/Hello-world-Graphical create mode 120000 Lang/Nim/Hello-world-Line-printer create mode 120000 Lang/Nim/Hello-world-Newline-omission create mode 120000 Lang/Nim/Hello-world-Standard-error create mode 120000 Lang/Nim/Hello-world-Text create mode 120000 Lang/Nim/Hello-world-Web-server create mode 120000 Lang/Nim/Here-document create mode 120000 Lang/Nim/Heronian-triangles create mode 120000 Lang/Nim/Higher-order-functions create mode 120000 Lang/Nim/Hofstadter-Conway-$10,000-sequence create mode 120000 Lang/Nim/Hofstadter-Figure-Figure-sequences create mode 120000 Lang/Nim/Hofstadter-Q-sequence create mode 120000 Lang/Nim/Horizontal-sundial-calculations create mode 120000 Lang/Nim/Horners-rule-for-polynomial-evaluation create mode 120000 Lang/Nim/Host-introspection create mode 120000 Lang/Nim/Hostname create mode 120000 Lang/Nim/Huffman-coding create mode 120000 Lang/Nim/IBAN create mode 120000 Lang/Nim/Identity-matrix create mode 120000 Lang/Nim/Include-a-file create mode 120000 Lang/Nim/Increment-a-numerical-string create mode 120000 Lang/Nim/Infinity create mode 120000 Lang/Nim/Inheritance-Single create mode 120000 Lang/Nim/Input-loop create mode 120000 Lang/Nim/Integer-comparison create mode 120000 Lang/Nim/Integer-sequence create mode 120000 Lang/Nim/Introspection create mode 120000 Lang/Nim/JSON create mode 120000 Lang/Nim/Jensens-Device create mode 120000 Lang/Nim/Josephus-problem create mode 120000 Lang/Nim/Jump-anywhere create mode 120000 Lang/Nim/Kaprekar-numbers create mode 120000 Lang/Nim/Keyboard-input-Flush-the-keyboard-buffer create mode 120000 Lang/Nim/Knuth-shuffle create mode 120000 Lang/Nim/LZW-compression create mode 120000 Lang/Nim/Langtons-ant create mode 120000 Lang/Nim/Largest-int-from-concatenated-ints create mode 120000 Lang/Nim/Last-Friday-of-each-month create mode 120000 Lang/Nim/Leap-year create mode 120000 Lang/Nim/Least-common-multiple create mode 120000 Lang/Nim/Left-factorials create mode 120000 Lang/Nim/Letter-frequency create mode 120000 Lang/Nim/Levenshtein-distance create mode 120000 Lang/Nim/Linear-congruential-generator create mode 120000 Lang/Nim/List-comprehensions create mode 120000 Lang/Nim/Literals-Floating-point create mode 120000 Lang/Nim/Literals-Integer create mode 120000 Lang/Nim/Literals-String create mode 120000 Lang/Nim/Logical-operations create mode 120000 Lang/Nim/Long-multiplication create mode 120000 Lang/Nim/Longest-common-subsequence create mode 120000 Lang/Nim/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/Nim/Loops-Break create mode 120000 Lang/Nim/Loops-Continue create mode 120000 Lang/Nim/Loops-Do-while create mode 120000 Lang/Nim/Loops-Downward-for create mode 120000 Lang/Nim/Loops-For create mode 120000 Lang/Nim/Loops-For-with-a-specified-step create mode 120000 Lang/Nim/Loops-Foreach create mode 120000 Lang/Nim/Loops-Infinite create mode 120000 Lang/Nim/Loops-N-plus-one-half create mode 120000 Lang/Nim/Loops-Nested create mode 120000 Lang/Nim/Loops-While create mode 120000 Lang/Nim/Lucas-Lehmer-test create mode 120000 Lang/Nim/Luhn-test-of-credit-card-numbers create mode 120000 Lang/Nim/MD4 create mode 120000 Lang/Nim/MD5 create mode 120000 Lang/Nim/Machine-code create mode 120000 Lang/Nim/Mad-Libs create mode 120000 Lang/Nim/Magic-squares-of-odd-order create mode 120000 Lang/Nim/Main-step-of-GOST-28147-89 create mode 120000 Lang/Nim/Man-or-boy-test create mode 120000 Lang/Nim/Mandelbrot-set create mode 120000 Lang/Nim/Map-range create mode 120000 Lang/Nim/Matrix-arithmetic create mode 120000 Lang/Nim/Matrix-multiplication create mode 120000 Lang/Nim/Matrix-transposition create mode 120000 Lang/Nim/Maximum-triangle-path-sum create mode 120000 Lang/Nim/Maze-generation create mode 120000 Lang/Nim/Memory-allocation create mode 120000 Lang/Nim/Memory-layout-of-a-data-structure create mode 120000 Lang/Nim/Menu create mode 120000 Lang/Nim/Metaprogramming create mode 120000 Lang/Nim/Middle-three-digits create mode 120000 Lang/Nim/Modular-exponentiation create mode 120000 Lang/Nim/Modular-inverse create mode 120000 Lang/Nim/Monte-Carlo-methods create mode 120000 Lang/Nim/Monty-Hall-problem create mode 120000 Lang/Nim/Multifactorial create mode 120000 Lang/Nim/Multiple-distinct-objects create mode 120000 Lang/Nim/Multiplication-tables create mode 120000 Lang/Nim/Multisplit create mode 120000 Lang/Nim/Mutual-recursion create mode 120000 Lang/Nim/N-queens-problem create mode 120000 Lang/Nim/Named-parameters create mode 120000 Lang/Nim/Non-continuous-subsequences create mode 120000 Lang/Nim/Non-decimal-radices-Convert create mode 120000 Lang/Nim/Non-decimal-radices-Input create mode 120000 Lang/Nim/Non-decimal-radices-Output create mode 120000 Lang/Nim/Nth create mode 120000 Lang/Nim/Nth-root create mode 120000 Lang/Nim/Null-object create mode 120000 Lang/Nim/Number-names create mode 120000 Lang/Nim/Number-reversal-game create mode 120000 Lang/Nim/Numerical-integration create mode 120000 Lang/Nim/Odd-word-problem create mode 120000 Lang/Nim/Old-lady-swallowed-a-fly create mode 120000 Lang/Nim/One-dimensional-cellular-automata create mode 120000 Lang/Nim/One-of-n-lines-in-a-file create mode 120000 Lang/Nim/OpenGL create mode 120000 Lang/Nim/Optional-parameters create mode 120000 Lang/Nim/Order-two-numerical-lists create mode 120000 Lang/Nim/Ordered-words create mode 120000 Lang/Nim/Palindrome-detection create mode 120000 Lang/Nim/Pangram-checker create mode 120000 Lang/Nim/Paraffins create mode 120000 Lang/Nim/Parametric-polymorphism create mode 120000 Lang/Nim/Parsing-RPN-calculator-algorithm create mode 120000 Lang/Nim/Parsing-RPN-to-infix-conversion create mode 120000 Lang/Nim/Pascals-triangle create mode 120000 Lang/Nim/Pascals-triangle-Puzzle create mode 120000 Lang/Nim/Perfect-numbers create mode 120000 Lang/Nim/Permutations create mode 120000 Lang/Nim/Permutations-by-swapping create mode 120000 Lang/Nim/Pernicious-numbers create mode 120000 Lang/Nim/Pi create mode 120000 Lang/Nim/Pick-random-element create mode 120000 Lang/Nim/Playing-cards create mode 120000 Lang/Nim/Pointers-and-references create mode 120000 Lang/Nim/Polymorphic-copy create mode 120000 Lang/Nim/Polymorphism create mode 120000 Lang/Nim/Power-set create mode 120000 Lang/Nim/Price-fraction create mode 120000 Lang/Nim/Primality-by-trial-division create mode 120000 Lang/Nim/Prime-decomposition create mode 120000 Lang/Nim/Priority-queue create mode 120000 Lang/Nim/Probabilistic-choice create mode 120000 Lang/Nim/Problem-of-Apollonius create mode 120000 Lang/Nim/Program-name create mode 120000 Lang/Nim/Program-termination create mode 120000 Lang/Nim/Pythagorean-triples create mode 120000 Lang/Nim/Queue-Definition create mode 120000 Lang/Nim/Queue-Usage create mode 120000 Lang/Nim/Quickselect-algorithm create mode 120000 Lang/Nim/Quine create mode 100644 Lang/Nim/README create mode 120000 Lang/Nim/Random-number-generator--device- create mode 120000 Lang/Nim/Random-numbers create mode 120000 Lang/Nim/Range-expansion create mode 120000 Lang/Nim/Range-extraction create mode 120000 Lang/Nim/Read-a-file-line-by-line create mode 120000 Lang/Nim/Read-a-specific-line-from-a-file create mode 120000 Lang/Nim/Read-entire-file create mode 120000 Lang/Nim/Real-constants-and-functions create mode 120000 Lang/Nim/Record-sound create mode 120000 Lang/Nim/Regular-expressions create mode 120000 Lang/Nim/Remove-duplicate-elements create mode 120000 Lang/Nim/Rename-a-file create mode 120000 Lang/Nim/Rep-string create mode 120000 Lang/Nim/Repeat-a-string create mode 120000 Lang/Nim/Return-multiple-values create mode 120000 Lang/Nim/Reverse-a-string create mode 120000 Lang/Nim/Reverse-words-in-a-string create mode 120000 Lang/Nim/Roman-numerals-Decode create mode 120000 Lang/Nim/Roman-numerals-Encode create mode 120000 Lang/Nim/Roots-of-unity create mode 120000 Lang/Nim/Rot-13 create mode 120000 Lang/Nim/Run-length-encoding create mode 120000 Lang/Nim/SEDOLs create mode 120000 Lang/Nim/SHA-1 create mode 120000 Lang/Nim/SHA-256 create mode 120000 Lang/Nim/Safe-addition create mode 120000 Lang/Nim/Scope-modifiers create mode 120000 Lang/Nim/Search-a-list create mode 120000 Lang/Nim/Self-describing-numbers create mode 120000 Lang/Nim/Semordnilap create mode 120000 Lang/Nim/Send-email create mode 120000 Lang/Nim/Sequence-of-non-squares create mode 120000 Lang/Nim/Set create mode 120000 Lang/Nim/Short-circuit-evaluation create mode 120000 Lang/Nim/Show-the-epoch create mode 120000 Lang/Nim/Sierpinski-carpet create mode 120000 Lang/Nim/Sierpinski-triangle create mode 120000 Lang/Nim/Sieve-of-Eratosthenes create mode 120000 Lang/Nim/Simple-windowed-application create mode 120000 Lang/Nim/Singleton create mode 120000 Lang/Nim/Singly-linked-list-Element-definition create mode 120000 Lang/Nim/Singly-linked-list-Element-insertion create mode 120000 Lang/Nim/Singly-linked-list-Traversal create mode 120000 Lang/Nim/Sleep create mode 120000 Lang/Nim/Sockets create mode 120000 Lang/Nim/Solve-a-Hidato-puzzle create mode 120000 Lang/Nim/Sort-an-array-of-composite-structures create mode 120000 Lang/Nim/Sort-an-integer-array create mode 120000 Lang/Nim/Sort-disjoint-sublist create mode 120000 Lang/Nim/Sort-using-a-custom-comparator create mode 120000 Lang/Nim/Sorting-algorithms-Bead-sort create mode 120000 Lang/Nim/Sorting-algorithms-Bogosort create mode 120000 Lang/Nim/Sorting-algorithms-Bubble-sort create mode 120000 Lang/Nim/Sorting-algorithms-Cocktail-sort create mode 120000 Lang/Nim/Sorting-algorithms-Comb-sort create mode 120000 Lang/Nim/Sorting-algorithms-Counting-sort create mode 120000 Lang/Nim/Sorting-algorithms-Gnome-sort create mode 120000 Lang/Nim/Sorting-algorithms-Heapsort create mode 120000 Lang/Nim/Sorting-algorithms-Insertion-sort create mode 120000 Lang/Nim/Sorting-algorithms-Merge-sort create mode 120000 Lang/Nim/Sorting-algorithms-Pancake-sort create mode 120000 Lang/Nim/Sorting-algorithms-Permutation-sort create mode 120000 Lang/Nim/Sorting-algorithms-Quicksort create mode 120000 Lang/Nim/Sorting-algorithms-Selection-sort create mode 120000 Lang/Nim/Sorting-algorithms-Shell-sort create mode 120000 Lang/Nim/Sorting-algorithms-Sleep-sort create mode 120000 Lang/Nim/Sorting-algorithms-Stooge-sort create mode 120000 Lang/Nim/Sorting-algorithms-Strand-sort create mode 120000 Lang/Nim/Sparkline-in-unicode create mode 120000 Lang/Nim/Special-characters create mode 120000 Lang/Nim/Spiral-matrix create mode 120000 Lang/Nim/Stack create mode 120000 Lang/Nim/Stack-traces create mode 120000 Lang/Nim/Stair-climbing-puzzle create mode 120000 Lang/Nim/Statistics-Basic create mode 120000 Lang/Nim/String-append create mode 120000 Lang/Nim/String-case create mode 120000 Lang/Nim/String-comparison create mode 120000 Lang/Nim/String-concatenation create mode 120000 Lang/Nim/String-interpolation--included- create mode 120000 Lang/Nim/String-length create mode 120000 Lang/Nim/String-matching create mode 120000 Lang/Nim/String-prepend create mode 120000 Lang/Nim/Strip-a-set-of-characters-from-a-string create mode 120000 Lang/Nim/Strip-block-comments create mode 120000 Lang/Nim/Strip-comments-from-a-string create mode 120000 Lang/Nim/Strip-control-codes-and-extended-characters-from-a-string create mode 120000 Lang/Nim/Strip-whitespace-from-a-string-Top-and-tail create mode 120000 Lang/Nim/Substring create mode 120000 Lang/Nim/Substring-Top-and-tail create mode 120000 Lang/Nim/Sum-and-product-of-an-array create mode 120000 Lang/Nim/Sum-digits-of-an-integer create mode 120000 Lang/Nim/Sum-multiples-of-3-and-5 create mode 120000 Lang/Nim/Sum-of-a-series create mode 120000 Lang/Nim/Sum-of-squares create mode 120000 Lang/Nim/Symmetric-difference create mode 120000 Lang/Nim/System-time create mode 120000 Lang/Nim/Table-creation-Postal-addresses create mode 120000 Lang/Nim/Take-notes-on-the-command-line create mode 120000 Lang/Nim/Temperature-conversion create mode 120000 Lang/Nim/Terminal-control-Clear-the-screen create mode 120000 Lang/Nim/Terminal-control-Coloured-text create mode 120000 Lang/Nim/Terminal-control-Cursor-positioning create mode 120000 Lang/Nim/Terminal-control-Display-an-extended-character create mode 120000 Lang/Nim/Terminal-control-Inverse-video create mode 120000 Lang/Nim/Terminal-control-Preserve-screen create mode 120000 Lang/Nim/Terminal-control-Ringing-the-terminal-bell create mode 120000 Lang/Nim/Terminal-control-Unicode-output create mode 120000 Lang/Nim/Ternary-logic create mode 120000 Lang/Nim/Test-a-function create mode 120000 Lang/Nim/Text-processing-1 create mode 120000 Lang/Nim/Text-processing-2 create mode 120000 Lang/Nim/Text-processing-Max-licenses-in-use create mode 120000 Lang/Nim/The-Twelve-Days-of-Christmas create mode 120000 Lang/Nim/Time-a-function create mode 120000 Lang/Nim/Tokenize-a-string create mode 120000 Lang/Nim/Top-rank-per-group create mode 120000 Lang/Nim/Total-circles-area create mode 120000 Lang/Nim/Towers-of-Hanoi create mode 120000 Lang/Nim/Trabb-Pardo-Knuth-algorithm create mode 120000 Lang/Nim/Tree-traversal create mode 120000 Lang/Nim/Trigonometric-functions create mode 120000 Lang/Nim/Truncatable-primes create mode 120000 Lang/Nim/Truncate-a-file create mode 120000 Lang/Nim/URL-decoding create mode 120000 Lang/Nim/URL-encoding create mode 120000 Lang/Nim/Unbias-a-random-generator create mode 120000 Lang/Nim/Unicode-strings create mode 120000 Lang/Nim/Unicode-variable-names create mode 120000 Lang/Nim/Universal-Turing-machine create mode 120000 Lang/Nim/Unix-ls create mode 120000 Lang/Nim/Use-another-language-to-call-a-function create mode 120000 Lang/Nim/User-input-Text create mode 120000 Lang/Nim/Variable-length-quantity create mode 120000 Lang/Nim/Variable-size-Get create mode 120000 Lang/Nim/Variable-size-Set create mode 120000 Lang/Nim/Variables create mode 120000 Lang/Nim/Variadic-function create mode 120000 Lang/Nim/Vector-products create mode 120000 Lang/Nim/Vigen-re-cipher create mode 120000 Lang/Nim/Visualize-a-tree create mode 120000 Lang/Nim/Walk-a-directory-Non-recursively create mode 120000 Lang/Nim/Walk-a-directory-Recursively create mode 120000 Lang/Nim/Web-scraping create mode 120000 Lang/Nim/Window-creation create mode 120000 Lang/Nim/Window-management create mode 120000 Lang/Nim/Wireworld create mode 120000 Lang/Nim/Word-wrap create mode 120000 Lang/Nim/Write-float-arrays-to-a-text-file create mode 120000 Lang/Nim/Write-language-name-in-3D-ASCII create mode 120000 Lang/Nim/XML-DOM-serialization create mode 120000 Lang/Nim/XML-Input create mode 120000 Lang/Nim/XML-Output create mode 120000 Lang/Nim/XML-XPath create mode 120000 Lang/Nim/Zeckendorf-number-representation create mode 120000 Lang/Nim/Zero-to-the-zero-power create mode 120000 Lang/Nim/Zig-zag-matrix create mode 100644 Lang/Nit/00DESCRIPTION create mode 120000 Lang/Nit/A+B create mode 120000 Lang/Nit/Abstract-type create mode 120000 Lang/Nit/Hello-world-Text create mode 100644 Lang/Nit/README create mode 100644 Lang/Nix/00DESCRIPTION create mode 100644 Lang/Nix/README create mode 120000 Lang/Nix/Sorting-algorithms-Quicksort create mode 100644 Lang/Oforth/00DESCRIPTION create mode 120000 Lang/Oforth/100-doors create mode 120000 Lang/Oforth/24-game create mode 120000 Lang/Oforth/99-Bottles-of-Beer create mode 120000 Lang/Oforth/A+B create mode 120000 Lang/Oforth/ABC-Problem create mode 120000 Lang/Oforth/AKS-test-for-primes create mode 120000 Lang/Oforth/Abstract-type create mode 120000 Lang/Oforth/Abundant,-deficient-and-perfect-number-classifications create mode 120000 Lang/Oforth/Accumulator-factory create mode 120000 Lang/Oforth/Ackermann-function create mode 120000 Lang/Oforth/Align-columns create mode 120000 Lang/Oforth/Aliquot-sequence-classifications create mode 120000 Lang/Oforth/Almost-prime create mode 120000 Lang/Oforth/Amicable-pairs create mode 120000 Lang/Oforth/Anagrams create mode 120000 Lang/Oforth/Apply-a-callback-to-an-array create mode 120000 Lang/Oforth/Arbitrary-precision-integers--included- create mode 120000 Lang/Oforth/Arena-storage-pool create mode 120000 Lang/Oforth/Arithmetic-Complex create mode 120000 Lang/Oforth/Arithmetic-Integer create mode 120000 Lang/Oforth/Arithmetic-geometric-mean create mode 120000 Lang/Oforth/Array-concatenation create mode 120000 Lang/Oforth/Arrays create mode 120000 Lang/Oforth/Assertions create mode 120000 Lang/Oforth/Averages-Arithmetic-mean create mode 120000 Lang/Oforth/Averages-Pythagorean-means create mode 120000 Lang/Oforth/Averages-Root-mean-square create mode 120000 Lang/Oforth/Averages-Simple-moving-average create mode 120000 Lang/Oforth/Balanced-brackets create mode 120000 Lang/Oforth/Bitwise-operations create mode 120000 Lang/Oforth/Bulls-and-cows create mode 120000 Lang/Oforth/Caesar-cipher create mode 120000 Lang/Oforth/Call-a-function create mode 120000 Lang/Oforth/Call-an-object-method create mode 120000 Lang/Oforth/Case-sensitivity-of-identifiers create mode 120000 Lang/Oforth/Catalan-numbers create mode 120000 Lang/Oforth/Catalan-numbers-Pascals-triangle create mode 120000 Lang/Oforth/Catamorphism create mode 120000 Lang/Oforth/Character-codes create mode 120000 Lang/Oforth/Checkpoint-synchronization create mode 120000 Lang/Oforth/Circles-of-given-radius-through-two-points create mode 120000 Lang/Oforth/Classes create mode 120000 Lang/Oforth/Closures-Value-capture create mode 120000 Lang/Oforth/Collections create mode 120000 Lang/Oforth/Comma-quibbling create mode 120000 Lang/Oforth/Command-line-arguments create mode 120000 Lang/Oforth/Comments create mode 120000 Lang/Oforth/Compile-time-calculation create mode 120000 Lang/Oforth/Compound-data-type create mode 120000 Lang/Oforth/Concurrent-computing create mode 120000 Lang/Oforth/Conditional-structures create mode 120000 Lang/Oforth/Copy-a-string create mode 120000 Lang/Oforth/Count-occurrences-of-a-substring create mode 120000 Lang/Oforth/Currying create mode 120000 Lang/Oforth/Day-of-the-week create mode 120000 Lang/Oforth/Delegates create mode 120000 Lang/Oforth/Detect-division-by-zero create mode 120000 Lang/Oforth/Digital-root create mode 120000 Lang/Oforth/Dot-product create mode 120000 Lang/Oforth/Doubly-linked-list-Definition create mode 120000 Lang/Oforth/Doubly-linked-list-Element-definition create mode 120000 Lang/Oforth/Doubly-linked-list-Element-insertion create mode 120000 Lang/Oforth/Doubly-linked-list-Traversal create mode 120000 Lang/Oforth/Dynamic-variable-names create mode 120000 Lang/Oforth/Empty-program create mode 120000 Lang/Oforth/Empty-string create mode 120000 Lang/Oforth/Enforced-immutability create mode 120000 Lang/Oforth/Entropy create mode 120000 Lang/Oforth/Enumerations create mode 120000 Lang/Oforth/Environment-variables create mode 120000 Lang/Oforth/Equilibrium-index create mode 120000 Lang/Oforth/Ethiopian-multiplication create mode 120000 Lang/Oforth/Euler-method create mode 120000 Lang/Oforth/Evaluate-binomial-coefficients create mode 120000 Lang/Oforth/Even-or-odd create mode 120000 Lang/Oforth/Events create mode 120000 Lang/Oforth/Evolutionary-algorithm create mode 120000 Lang/Oforth/Exceptions create mode 120000 Lang/Oforth/Exceptions-Catch-an-exception-thrown-in-a-nested-call create mode 120000 Lang/Oforth/Execute-a-system-command create mode 120000 Lang/Oforth/Exponentiation-operator create mode 120000 Lang/Oforth/Factorial create mode 120000 Lang/Oforth/Factors-of-an-integer create mode 120000 Lang/Oforth/Fibonacci-sequence create mode 120000 Lang/Oforth/Fibonacci-word create mode 120000 Lang/Oforth/File-input-output create mode 120000 Lang/Oforth/File-modification-time create mode 120000 Lang/Oforth/File-size create mode 120000 Lang/Oforth/Filter create mode 120000 Lang/Oforth/Find-limit-of-recursion create mode 120000 Lang/Oforth/Find-the-last-Sunday-of-each-month create mode 120000 Lang/Oforth/First-class-functions create mode 120000 Lang/Oforth/First-class-functions-Use-numbers-analogously create mode 120000 Lang/Oforth/Five-weekends create mode 120000 Lang/Oforth/FizzBuzz create mode 120000 Lang/Oforth/Flatten-a-list create mode 120000 Lang/Oforth/Flow-control-structures create mode 120000 Lang/Oforth/Forward-difference create mode 120000 Lang/Oforth/Function-composition create mode 120000 Lang/Oforth/Function-definition create mode 120000 Lang/Oforth/Function-prototype create mode 120000 Lang/Oforth/Gamma-function create mode 120000 Lang/Oforth/Generate-lower-case-ASCII-alphabet create mode 120000 Lang/Oforth/Generic-swap create mode 120000 Lang/Oforth/Greatest-common-divisor create mode 120000 Lang/Oforth/Greatest-element-of-a-list create mode 120000 Lang/Oforth/Guess-the-number create mode 120000 Lang/Oforth/Guess-the-number-With-feedback create mode 120000 Lang/Oforth/Hailstone-sequence create mode 120000 Lang/Oforth/Happy-numbers create mode 120000 Lang/Oforth/Harshad-or-Niven-series create mode 120000 Lang/Oforth/Haversine-formula create mode 120000 Lang/Oforth/Hello-world-Line-printer create mode 120000 Lang/Oforth/Hello-world-Newbie create mode 120000 Lang/Oforth/Hello-world-Newline-omission create mode 120000 Lang/Oforth/Hello-world-Standard-error create mode 120000 Lang/Oforth/Hello-world-Text create mode 120000 Lang/Oforth/Higher-order-functions create mode 120000 Lang/Oforth/Hofstadter-Conway-$10,000-sequence create mode 120000 Lang/Oforth/Hofstadter-Figure-Figure-sequences create mode 120000 Lang/Oforth/Hofstadter-Q-sequence create mode 120000 Lang/Oforth/Include-a-file create mode 120000 Lang/Oforth/Increment-a-numerical-string create mode 120000 Lang/Oforth/Infinity create mode 120000 Lang/Oforth/Inheritance-Multiple create mode 120000 Lang/Oforth/Inheritance-Single create mode 120000 Lang/Oforth/Input-loop create mode 120000 Lang/Oforth/Integer-comparison create mode 120000 Lang/Oforth/Integer-sequence create mode 120000 Lang/Oforth/Interactive-programming create mode 120000 Lang/Oforth/Introspection create mode 120000 Lang/Oforth/Iterated-digits-squaring create mode 120000 Lang/Oforth/JSON create mode 120000 Lang/Oforth/Jensens-Device create mode 120000 Lang/Oforth/Josephus-problem create mode 120000 Lang/Oforth/Keyboard-input-Flush-the-keyboard-buffer create mode 120000 Lang/Oforth/Keyboard-input-Keypress-check create mode 120000 Lang/Oforth/Keyboard-input-Obtain-a-Y-or-N-response create mode 120000 Lang/Oforth/Knapsack-problem-Continuous create mode 120000 Lang/Oforth/Knuth-shuffle create mode 120000 Lang/Oforth/Largest-int-from-concatenated-ints create mode 120000 Lang/Oforth/Last-Friday-of-each-month create mode 120000 Lang/Oforth/Leap-year create mode 120000 Lang/Oforth/Least-common-multiple create mode 120000 Lang/Oforth/Left-factorials create mode 120000 Lang/Oforth/Linear-congruential-generator create mode 120000 Lang/Oforth/Literals-Floating-point create mode 120000 Lang/Oforth/Literals-String create mode 120000 Lang/Oforth/Logical-operations create mode 120000 Lang/Oforth/Long-multiplication create mode 120000 Lang/Oforth/Look-and-say-sequence create mode 120000 Lang/Oforth/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/Oforth/Loops-Break create mode 120000 Lang/Oforth/Loops-Continue create mode 120000 Lang/Oforth/Loops-Do-while create mode 120000 Lang/Oforth/Loops-Downward-for create mode 120000 Lang/Oforth/Loops-For create mode 120000 Lang/Oforth/Loops-For-with-a-specified-step create mode 120000 Lang/Oforth/Loops-Foreach create mode 120000 Lang/Oforth/Loops-Infinite create mode 120000 Lang/Oforth/Loops-N-plus-one-half create mode 120000 Lang/Oforth/Loops-While create mode 120000 Lang/Oforth/Ludic-numbers create mode 120000 Lang/Oforth/Luhn-test-of-credit-card-numbers create mode 120000 Lang/Oforth/Mad-Libs create mode 120000 Lang/Oforth/Magic-squares-of-odd-order create mode 120000 Lang/Oforth/Map-range create mode 120000 Lang/Oforth/Metered-concurrency create mode 120000 Lang/Oforth/Middle-three-digits create mode 120000 Lang/Oforth/Modular-exponentiation create mode 120000 Lang/Oforth/Modular-inverse create mode 120000 Lang/Oforth/Multifactorial create mode 120000 Lang/Oforth/Multiple-distinct-objects create mode 120000 Lang/Oforth/Mutual-recursion create mode 120000 Lang/Oforth/Narcissistic-decimal-number create mode 120000 Lang/Oforth/Nth create mode 120000 Lang/Oforth/Nth-root create mode 120000 Lang/Oforth/Null-object create mode 120000 Lang/Oforth/Number-reversal-game create mode 120000 Lang/Oforth/One-dimensional-cellular-automata create mode 120000 Lang/Oforth/Ordered-words create mode 120000 Lang/Oforth/Palindrome-detection create mode 120000 Lang/Oforth/Parallel-calculations create mode 120000 Lang/Oforth/Parsing-RPN-calculator-algorithm create mode 120000 Lang/Oforth/Partial-function-application create mode 120000 Lang/Oforth/Pascals-triangle create mode 120000 Lang/Oforth/Perfect-numbers create mode 120000 Lang/Oforth/Phrase-reversals create mode 120000 Lang/Oforth/Pi create mode 120000 Lang/Oforth/Pick-random-element create mode 120000 Lang/Oforth/Polymorphism create mode 120000 Lang/Oforth/Price-fraction create mode 120000 Lang/Oforth/Primality-by-trial-division create mode 120000 Lang/Oforth/Prime-decomposition create mode 120000 Lang/Oforth/Program-termination create mode 120000 Lang/Oforth/Quaternion-type create mode 120000 Lang/Oforth/Queue-Definition create mode 120000 Lang/Oforth/Queue-Usage create mode 120000 Lang/Oforth/Quine create mode 100644 Lang/Oforth/README create mode 120000 Lang/Oforth/Range-expansion create mode 120000 Lang/Oforth/Read-a-file-line-by-line create mode 120000 Lang/Oforth/Real-constants-and-functions create mode 120000 Lang/Oforth/Remove-lines-from-a-file create mode 120000 Lang/Oforth/Rep-string create mode 120000 Lang/Oforth/Repeat-a-string create mode 120000 Lang/Oforth/Respond-to-an-unknown-method-call create mode 120000 Lang/Oforth/Return-multiple-values create mode 120000 Lang/Oforth/Reverse-a-string create mode 120000 Lang/Oforth/Reverse-words-in-a-string create mode 120000 Lang/Oforth/Roman-numerals-Encode create mode 120000 Lang/Oforth/Roots-of-a-function create mode 120000 Lang/Oforth/Rot-13 create mode 120000 Lang/Oforth/Run-length-encoding create mode 120000 Lang/Oforth/Runtime-evaluation create mode 120000 Lang/Oforth/SEDOLs create mode 120000 Lang/Oforth/Search-a-list create mode 120000 Lang/Oforth/Semiprime create mode 120000 Lang/Oforth/Semordnilap create mode 120000 Lang/Oforth/Send-an-unknown-method-call create mode 120000 Lang/Oforth/Sequence-of-non-squares create mode 120000 Lang/Oforth/Sequence-of-primes-by-Trial-Division create mode 120000 Lang/Oforth/Shell-one-liner create mode 120000 Lang/Oforth/Show-the-epoch create mode 120000 Lang/Oforth/Sierpinski-carpet create mode 120000 Lang/Oforth/Sierpinski-triangle create mode 120000 Lang/Oforth/Sieve-of-Eratosthenes create mode 120000 Lang/Oforth/Singleton create mode 120000 Lang/Oforth/Singly-linked-list-Element-definition create mode 120000 Lang/Oforth/Singly-linked-list-Element-insertion create mode 120000 Lang/Oforth/Singly-linked-list-Traversal create mode 120000 Lang/Oforth/Sleep create mode 120000 Lang/Oforth/Sort-an-array-of-composite-structures create mode 120000 Lang/Oforth/Sort-an-integer-array create mode 120000 Lang/Oforth/Sort-using-a-custom-comparator create mode 120000 Lang/Oforth/Sorting-algorithms-Insertion-sort create mode 120000 Lang/Oforth/Sorting-algorithms-Quicksort create mode 120000 Lang/Oforth/Sorting-algorithms-Selection-sort create mode 120000 Lang/Oforth/Sorting-algorithms-Sleep-sort create mode 120000 Lang/Oforth/Stack create mode 120000 Lang/Oforth/Stack-traces create mode 120000 Lang/Oforth/Start-from-a-main-routine create mode 120000 Lang/Oforth/Statistics-Basic create mode 120000 Lang/Oforth/Stern-Brocot-sequence create mode 120000 Lang/Oforth/String-append create mode 120000 Lang/Oforth/String-case create mode 120000 Lang/Oforth/String-comparison create mode 120000 Lang/Oforth/String-concatenation create mode 120000 Lang/Oforth/String-matching create mode 120000 Lang/Oforth/String-prepend create mode 120000 Lang/Oforth/Strip-a-set-of-characters-from-a-string create mode 120000 Lang/Oforth/Strip-comments-from-a-string create mode 120000 Lang/Oforth/Substring create mode 120000 Lang/Oforth/Substring-Top-and-tail create mode 120000 Lang/Oforth/Sum-and-product-of-an-array create mode 120000 Lang/Oforth/Sum-digits-of-an-integer create mode 120000 Lang/Oforth/Sum-multiples-of-3-and-5 create mode 120000 Lang/Oforth/Sum-of-a-series create mode 120000 Lang/Oforth/Sum-of-squares create mode 120000 Lang/Oforth/Synchronous-concurrency create mode 120000 Lang/Oforth/System-time create mode 120000 Lang/Oforth/Temperature-conversion create mode 120000 Lang/Oforth/Test-a-function create mode 120000 Lang/Oforth/Tokenize-a-string create mode 120000 Lang/Oforth/Top-rank-per-group create mode 120000 Lang/Oforth/Topic-variable create mode 120000 Lang/Oforth/Towers-of-Hanoi create mode 120000 Lang/Oforth/Tree-traversal create mode 120000 Lang/Oforth/Trigonometric-functions create mode 120000 Lang/Oforth/User-input-Text create mode 120000 Lang/Oforth/Variables create mode 120000 Lang/Oforth/Variadic-function create mode 120000 Lang/Oforth/Y-combinator create mode 120000 Lang/Oforth/Zero-to-the-zero-power create mode 100644 Lang/Ol/00DESCRIPTION create mode 100644 Lang/Ol/README create mode 100644 Lang/OpenLisp/00DESCRIPTION create mode 120000 Lang/OpenLisp/Empty-program create mode 120000 Lang/OpenLisp/Hello-world-Text create mode 100644 Lang/OpenLisp/README create mode 100644 Lang/PHL/00DESCRIPTION create mode 120000 Lang/PHL/100-doors create mode 120000 Lang/PHL/99-Bottles-of-Beer create mode 120000 Lang/PHL/Arithmetic-Integer create mode 120000 Lang/PHL/Classes create mode 120000 Lang/PHL/Conditional-structures create mode 120000 Lang/PHL/Exceptions create mode 120000 Lang/PHL/Extend-your-language create mode 120000 Lang/PHL/Filter create mode 120000 Lang/PHL/FizzBuzz create mode 120000 Lang/PHL/Function-definition create mode 120000 Lang/PHL/Hello-world-Newline-omission create mode 120000 Lang/PHL/Hello-world-Text create mode 120000 Lang/PHL/Integer-comparison create mode 120000 Lang/PHL/Loops-Do-while create mode 120000 Lang/PHL/Loops-Foreach create mode 120000 Lang/PHL/Loops-While create mode 120000 Lang/PHL/Null-object create mode 100644 Lang/PHL/README create mode 120000 Lang/PHL/String-concatenation create mode 120000 Lang/PHL/Towers-of-Hanoi create mode 120000 Lang/PHL/Universal-Turing-machine create mode 120000 Lang/PHL/Yin-and-yang create mode 100644 Lang/Panda/00DESCRIPTION create mode 120000 Lang/Panda/Arithmetic-Integer create mode 120000 Lang/Panda/Binary-digits create mode 120000 Lang/Panda/Factorial create mode 120000 Lang/Panda/Factors-of-an-integer create mode 120000 Lang/Panda/Hello-world-Web-server create mode 120000 Lang/Panda/Loops-For-with-a-specified-step create mode 120000 Lang/Panda/Loops-N-plus-one-half create mode 120000 Lang/Panda/Loops-While create mode 120000 Lang/Panda/Pernicious-numbers create mode 120000 Lang/Panda/Primality-by-trial-division create mode 100644 Lang/Panda/README create mode 120000 Lang/Panda/Read-entire-file create mode 120000 Lang/Panda/Sum-of-a-series create mode 100644 Lang/Pare/00DESCRIPTION create mode 120000 Lang/Pare/Hello-world-Newbie create mode 100644 Lang/Pare/README create mode 100644 Lang/Peloton/00DESCRIPTION create mode 120000 Lang/Peloton/Binary-digits create mode 120000 Lang/Peloton/Comments create mode 120000 Lang/Peloton/Create-an-HTML-table create mode 120000 Lang/Peloton/Day-of-the-week create mode 120000 Lang/Peloton/Factorial create mode 120000 Lang/Peloton/Filter create mode 120000 Lang/Peloton/FizzBuzz create mode 120000 Lang/Peloton/HTTP create mode 120000 Lang/Peloton/History-variables create mode 120000 Lang/Peloton/Loops-Downward-for create mode 120000 Lang/Peloton/Loops-N-plus-one-half create mode 100644 Lang/Peloton/README create mode 120000 Lang/Peloton/Read-a-configuration-file create mode 120000 Lang/Peloton/Reverse-a-string create mode 120000 Lang/Peloton/Roman-numerals-Encode create mode 120000 Lang/Peloton/Singly-linked-list-Traversal create mode 120000 Lang/Peloton/Sleep create mode 120000 Lang/Peloton/Sort-an-integer-array create mode 120000 Lang/Peloton/String-case create mode 120000 Lang/Peloton/Strip-control-codes-and-extended-characters-from-a-string create mode 120000 Lang/Peloton/Unicode-variable-names create mode 120000 Lang/Peloton/Web-scraping create mode 100644 Lang/PeopleCode/00DESCRIPTION create mode 120000 Lang/PeopleCode/Determine-if-a-string-is-numeric create mode 120000 Lang/PeopleCode/Loops-While create mode 100644 Lang/PeopleCode/README create mode 100644 Lang/Perl5i/00DESCRIPTION create mode 120000 Lang/Perl5i/100-doors create mode 120000 Lang/Perl5i/Combinations create mode 100644 Lang/Perl5i/README create mode 100644 Lang/Phix/00DESCRIPTION create mode 120000 Lang/Phix/100-doors create mode 120000 Lang/Phix/24-game create mode 120000 Lang/Phix/24-game-Solve create mode 120000 Lang/Phix/9-billion-names-of-God-the-integer create mode 120000 Lang/Phix/99-Bottles-of-Beer create mode 120000 Lang/Phix/A+B create mode 120000 Lang/Phix/ABC-Problem create mode 120000 Lang/Phix/AKS-test-for-primes create mode 120000 Lang/Phix/Abundant,-deficient-and-perfect-number-classifications create mode 120000 Lang/Phix/Ackermann-function create mode 120000 Lang/Phix/Address-of-a-variable create mode 120000 Lang/Phix/Align-columns create mode 120000 Lang/Phix/Aliquot-sequence-classifications create mode 120000 Lang/Phix/Almost-prime create mode 120000 Lang/Phix/Amb create mode 120000 Lang/Phix/Amicable-pairs create mode 120000 Lang/Phix/Anagrams create mode 120000 Lang/Phix/Anagrams-Deranged-anagrams create mode 120000 Lang/Phix/Animate-a-pendulum create mode 120000 Lang/Phix/Animation create mode 120000 Lang/Phix/Apply-a-callback-to-an-array create mode 120000 Lang/Phix/Arbitrary-precision-integers--included- create mode 120000 Lang/Phix/Arithmetic-Complex create mode 120000 Lang/Phix/Arithmetic-Integer create mode 120000 Lang/Phix/Arithmetic-Rational create mode 120000 Lang/Phix/Arithmetic-evaluation create mode 120000 Lang/Phix/Arithmetic-geometric-mean create mode 120000 Lang/Phix/Arithmetic-geometric-mean-Calculate-Pi create mode 120000 Lang/Phix/Array-concatenation create mode 120000 Lang/Phix/Arrays create mode 120000 Lang/Phix/Assertions create mode 120000 Lang/Phix/Associative-array-Creation create mode 120000 Lang/Phix/Associative-array-Iteration create mode 120000 Lang/Phix/Atomic-updates create mode 120000 Lang/Phix/Average-loop-length create mode 120000 Lang/Phix/Averages-Arithmetic-mean create mode 120000 Lang/Phix/Averages-Mean-angle create mode 120000 Lang/Phix/Averages-Mean-time-of-day create mode 120000 Lang/Phix/Averages-Median create mode 120000 Lang/Phix/Averages-Mode create mode 120000 Lang/Phix/Averages-Pythagorean-means create mode 120000 Lang/Phix/Averages-Root-mean-square create mode 120000 Lang/Phix/Averages-Simple-moving-average create mode 120000 Lang/Phix/Balanced-brackets create mode 120000 Lang/Phix/Balanced-ternary create mode 120000 Lang/Phix/Benfords-law create mode 120000 Lang/Phix/Bernoulli-numbers create mode 120000 Lang/Phix/Best-shuffle create mode 120000 Lang/Phix/Binary-digits create mode 120000 Lang/Phix/Binary-search create mode 120000 Lang/Phix/Binary-strings create mode 120000 Lang/Phix/Bitmap create mode 120000 Lang/Phix/Bitmap-B-zier-curves-Cubic create mode 120000 Lang/Phix/Bitmap-B-zier-curves-Quadratic create mode 120000 Lang/Phix/Bitmap-Bresenhams-line-algorithm create mode 120000 Lang/Phix/Bitmap-Flood-fill create mode 120000 Lang/Phix/Bitmap-Histogram create mode 120000 Lang/Phix/Bitmap-Midpoint-circle-algorithm create mode 120000 Lang/Phix/Bitmap-Read-a-PPM-file create mode 120000 Lang/Phix/Bitmap-Write-a-PPM-file create mode 120000 Lang/Phix/Bitwise-operations create mode 120000 Lang/Phix/Box-the-compass create mode 120000 Lang/Phix/Brownian-tree create mode 120000 Lang/Phix/Bulls-and-cows create mode 120000 Lang/Phix/Bulls-and-cows-Player create mode 120000 Lang/Phix/CRC-32 create mode 120000 Lang/Phix/CSV-to-HTML-translation create mode 120000 Lang/Phix/Caesar-cipher create mode 120000 Lang/Phix/Calendar create mode 120000 Lang/Phix/Calendar---for-REAL-programmers create mode 120000 Lang/Phix/Call-a-foreign-language-function create mode 120000 Lang/Phix/Call-a-function create mode 120000 Lang/Phix/Case-sensitivity-of-identifiers create mode 120000 Lang/Phix/Catalan-numbers create mode 120000 Lang/Phix/Catalan-numbers-Pascals-triangle create mode 120000 Lang/Phix/Character-codes create mode 120000 Lang/Phix/Check-that-file-exists create mode 120000 Lang/Phix/Closest-pair-problem create mode 120000 Lang/Phix/Collections create mode 120000 Lang/Phix/Combinations create mode 120000 Lang/Phix/Combinations-and-permutations create mode 120000 Lang/Phix/Combinations-with-repetitions create mode 120000 Lang/Phix/Command-line-arguments create mode 120000 Lang/Phix/Comments create mode 120000 Lang/Phix/Compile-time-calculation create mode 120000 Lang/Phix/Compound-data-type create mode 120000 Lang/Phix/Concurrent-computing create mode 120000 Lang/Phix/Constrained-random-points-on-a-circle create mode 120000 Lang/Phix/Convert-decimal-number-to-rational create mode 120000 Lang/Phix/Copy-a-string create mode 120000 Lang/Phix/Count-in-factors create mode 120000 Lang/Phix/Count-in-octal create mode 120000 Lang/Phix/Count-occurrences-of-a-substring create mode 120000 Lang/Phix/Create-a-file create mode 120000 Lang/Phix/Create-a-two-dimensional-array-at-runtime create mode 120000 Lang/Phix/Create-an-HTML-table create mode 120000 Lang/Phix/Create-an-object-at-a-given-address create mode 120000 Lang/Phix/Date-format create mode 120000 Lang/Phix/Date-manipulation create mode 120000 Lang/Phix/Day-of-the-week create mode 120000 Lang/Phix/Define-a-primitive-data-type create mode 120000 Lang/Phix/Determine-if-a-string-is-numeric create mode 120000 Lang/Phix/Determine-if-only-one-instance-is-running create mode 120000 Lang/Phix/Dining-philosophers create mode 120000 Lang/Phix/Discordian-date create mode 120000 Lang/Phix/Dot-product create mode 120000 Lang/Phix/Draw-a-cuboid create mode 120000 Lang/Phix/Element-wise-operations create mode 120000 Lang/Phix/Empty-string create mode 120000 Lang/Phix/Enforced-immutability create mode 120000 Lang/Phix/Enumerations create mode 120000 Lang/Phix/Environment-variables create mode 120000 Lang/Phix/Equilibrium-index create mode 120000 Lang/Phix/Ethiopian-multiplication create mode 120000 Lang/Phix/Euler-method create mode 120000 Lang/Phix/Even-or-odd create mode 120000 Lang/Phix/Evolutionary-algorithm create mode 120000 Lang/Phix/Execute-Brain---- create mode 120000 Lang/Phix/Execute-HQ9+ create mode 120000 Lang/Phix/Execute-a-system-command create mode 120000 Lang/Phix/Exponentiation-operator create mode 120000 Lang/Phix/Extreme-floating-point-values create mode 120000 Lang/Phix/Factorial create mode 120000 Lang/Phix/Fibonacci-sequence create mode 120000 Lang/Phix/File-input-output create mode 120000 Lang/Phix/File-size create mode 120000 Lang/Phix/Filter create mode 120000 Lang/Phix/Find-limit-of-recursion create mode 120000 Lang/Phix/Find-the-last-Sunday-of-each-month create mode 120000 Lang/Phix/Find-the-missing-permutation create mode 120000 Lang/Phix/First-class-functions create mode 120000 Lang/Phix/First-class-functions-Use-numbers-analogously create mode 120000 Lang/Phix/Five-weekends create mode 120000 Lang/Phix/FizzBuzz create mode 120000 Lang/Phix/Flatten-a-list create mode 120000 Lang/Phix/Flow-control-structures create mode 120000 Lang/Phix/Fork create mode 120000 Lang/Phix/Formatted-numeric-output create mode 120000 Lang/Phix/Fractal-tree create mode 120000 Lang/Phix/Function-composition create mode 120000 Lang/Phix/Function-definition create mode 120000 Lang/Phix/GUI-component-interaction create mode 120000 Lang/Phix/GUI-enabling-disabling-of-controls create mode 120000 Lang/Phix/Generate-lower-case-ASCII-alphabet create mode 120000 Lang/Phix/Generic-swap create mode 120000 Lang/Phix/Gray-code create mode 120000 Lang/Phix/Grayscale-image create mode 120000 Lang/Phix/Greatest-common-divisor create mode 120000 Lang/Phix/Greatest-element-of-a-list create mode 120000 Lang/Phix/Greatest-subsequential-sum create mode 120000 Lang/Phix/Guess-the-number create mode 120000 Lang/Phix/Guess-the-number-With-feedback create mode 120000 Lang/Phix/Guess-the-number-With-feedback--player- create mode 120000 Lang/Phix/Hailstone-sequence create mode 120000 Lang/Phix/Happy-numbers create mode 120000 Lang/Phix/Hello-world-Graphical create mode 120000 Lang/Phix/Hello-world-Line-printer create mode 120000 Lang/Phix/Hello-world-Newline-omission create mode 120000 Lang/Phix/Hello-world-Standard-error create mode 120000 Lang/Phix/Hello-world-Text create mode 120000 Lang/Phix/Here-document create mode 120000 Lang/Phix/Heronian-triangles create mode 120000 Lang/Phix/Higher-order-functions create mode 120000 Lang/Phix/Honeycombs create mode 120000 Lang/Phix/Horizontal-sundial-calculations create mode 120000 Lang/Phix/Include-a-file create mode 120000 Lang/Phix/Increment-a-numerical-string create mode 120000 Lang/Phix/Infinity create mode 120000 Lang/Phix/Integer-comparison create mode 120000 Lang/Phix/Integer-overflow create mode 120000 Lang/Phix/Integer-sequence create mode 120000 Lang/Phix/Inverted-index create mode 120000 Lang/Phix/Jump-anywhere create mode 120000 Lang/Phix/Keyboard-input-Flush-the-keyboard-buffer create mode 120000 Lang/Phix/Keyboard-input-Keypress-check create mode 120000 Lang/Phix/Keyboard-input-Obtain-a-Y-or-N-response create mode 120000 Lang/Phix/Knights-tour create mode 120000 Lang/Phix/Knuth-shuffle create mode 120000 Lang/Phix/Langtons-ant create mode 120000 Lang/Phix/Largest-int-from-concatenated-ints create mode 120000 Lang/Phix/Last-Friday-of-each-month create mode 120000 Lang/Phix/Last-letter-first-letter create mode 120000 Lang/Phix/Leap-year create mode 120000 Lang/Phix/Least-common-multiple create mode 120000 Lang/Phix/Letter-frequency create mode 120000 Lang/Phix/Levenshtein-distance create mode 120000 Lang/Phix/Literals-Floating-point create mode 120000 Lang/Phix/Literals-Integer create mode 120000 Lang/Phix/Literals-String create mode 120000 Lang/Phix/Logical-operations create mode 120000 Lang/Phix/Long-multiplication create mode 120000 Lang/Phix/Longest-string-challenge create mode 120000 Lang/Phix/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/Phix/Loops-Break create mode 120000 Lang/Phix/Loops-Continue create mode 120000 Lang/Phix/Loops-Do-while create mode 120000 Lang/Phix/Loops-Downward-for create mode 120000 Lang/Phix/Loops-For create mode 120000 Lang/Phix/Loops-For-with-a-specified-step create mode 120000 Lang/Phix/Loops-Foreach create mode 120000 Lang/Phix/Loops-Infinite create mode 120000 Lang/Phix/Loops-N-plus-one-half create mode 120000 Lang/Phix/Loops-Nested create mode 120000 Lang/Phix/Loops-While create mode 120000 Lang/Phix/Luhn-test-of-credit-card-numbers create mode 120000 Lang/Phix/MD5-Implementation create mode 120000 Lang/Phix/Machine-code create mode 120000 Lang/Phix/Mandelbrot-set create mode 120000 Lang/Phix/Map-range create mode 120000 Lang/Phix/Matrix-multiplication create mode 120000 Lang/Phix/Matrix-transposition create mode 120000 Lang/Phix/Memory-allocation create mode 120000 Lang/Phix/Menu create mode 120000 Lang/Phix/Monty-Hall-problem create mode 120000 Lang/Phix/Morse-code create mode 120000 Lang/Phix/Multiplication-tables create mode 120000 Lang/Phix/Mutual-recursion create mode 120000 Lang/Phix/Named-parameters create mode 120000 Lang/Phix/Non-decimal-radices-Convert create mode 120000 Lang/Phix/Non-decimal-radices-Input create mode 120000 Lang/Phix/Non-decimal-radices-Output create mode 120000 Lang/Phix/Null-object create mode 120000 Lang/Phix/Number-names create mode 120000 Lang/Phix/Number-reversal-game create mode 120000 Lang/Phix/Numerical-integration create mode 120000 Lang/Phix/Old-lady-swallowed-a-fly create mode 120000 Lang/Phix/One-dimensional-cellular-automata create mode 120000 Lang/Phix/One-of-n-lines-in-a-file create mode 120000 Lang/Phix/OpenGL create mode 120000 Lang/Phix/Optional-parameters create mode 120000 Lang/Phix/Order-disjoint-list-items create mode 120000 Lang/Phix/Ordered-words create mode 120000 Lang/Phix/Palindrome-detection create mode 120000 Lang/Phix/Parsing-RPN-calculator-algorithm create mode 120000 Lang/Phix/Parsing-RPN-to-infix-conversion create mode 120000 Lang/Phix/Parsing-Shunting-yard-algorithm create mode 120000 Lang/Phix/Pascals-triangle create mode 120000 Lang/Phix/Perfect-numbers create mode 120000 Lang/Phix/Permutations create mode 120000 Lang/Phix/Phrase-reversals create mode 120000 Lang/Phix/Pi create mode 120000 Lang/Phix/Pick-random-element create mode 120000 Lang/Phix/Polymorphism create mode 120000 Lang/Phix/Price-fraction create mode 120000 Lang/Phix/Primality-by-trial-division create mode 120000 Lang/Phix/Probabilistic-choice create mode 120000 Lang/Phix/Program-name create mode 120000 Lang/Phix/Program-termination create mode 120000 Lang/Phix/Pythagorean-triples create mode 120000 Lang/Phix/Quaternion-type create mode 120000 Lang/Phix/Queue-Definition create mode 120000 Lang/Phix/Queue-Usage create mode 120000 Lang/Phix/Quickselect-algorithm create mode 120000 Lang/Phix/Quine create mode 100644 Lang/Phix/README create mode 120000 Lang/Phix/Random-numbers create mode 120000 Lang/Phix/Range-extraction create mode 120000 Lang/Phix/Ray-casting-algorithm create mode 120000 Lang/Phix/Read-a-file-line-by-line create mode 120000 Lang/Phix/Read-entire-file create mode 120000 Lang/Phix/Real-constants-and-functions create mode 120000 Lang/Phix/Reduced-row-echelon-form create mode 120000 Lang/Phix/Remove-duplicate-elements create mode 120000 Lang/Phix/Repeat-a-string create mode 120000 Lang/Phix/Return-multiple-values create mode 120000 Lang/Phix/Reverse-a-string create mode 120000 Lang/Phix/Reverse-words-in-a-string create mode 120000 Lang/Phix/Rock-paper-scissors create mode 120000 Lang/Phix/Roman-numerals-Decode create mode 120000 Lang/Phix/Roman-numerals-Encode create mode 120000 Lang/Phix/Rot-13 create mode 120000 Lang/Phix/Run-length-encoding create mode 120000 Lang/Phix/S-Expressions create mode 120000 Lang/Phix/SEDOLs create mode 120000 Lang/Phix/SHA-256 create mode 120000 Lang/Phix/Safe-addition create mode 120000 Lang/Phix/Search-a-list create mode 120000 Lang/Phix/Self-describing-numbers create mode 120000 Lang/Phix/Semordnilap create mode 120000 Lang/Phix/Sequence-of-non-squares create mode 120000 Lang/Phix/Short-circuit-evaluation create mode 120000 Lang/Phix/Sierpinski-carpet create mode 120000 Lang/Phix/Sierpinski-triangle create mode 120000 Lang/Phix/Sieve-of-Eratosthenes create mode 120000 Lang/Phix/Simple-database create mode 120000 Lang/Phix/Simple-windowed-application create mode 120000 Lang/Phix/Sleep create mode 120000 Lang/Phix/Solve-a-Hidato-puzzle create mode 120000 Lang/Phix/Solve-a-Holy-Knights-tour create mode 120000 Lang/Phix/Solve-a-Hopido-puzzle create mode 120000 Lang/Phix/Solve-a-Numbrix-puzzle create mode 120000 Lang/Phix/Solve-the-no-connection-puzzle create mode 120000 Lang/Phix/Sort-an-array-of-composite-structures create mode 120000 Lang/Phix/Sort-an-integer-array create mode 120000 Lang/Phix/Sort-disjoint-sublist create mode 120000 Lang/Phix/Sort-using-a-custom-comparator create mode 120000 Lang/Phix/Sorting-algorithms-Bead-sort create mode 120000 Lang/Phix/Sorting-algorithms-Bogosort create mode 120000 Lang/Phix/Sorting-algorithms-Bubble-sort create mode 120000 Lang/Phix/Sorting-algorithms-Cocktail-sort create mode 120000 Lang/Phix/Sorting-algorithms-Comb-sort create mode 120000 Lang/Phix/Sorting-algorithms-Counting-sort create mode 120000 Lang/Phix/Sorting-algorithms-Gnome-sort create mode 120000 Lang/Phix/Sorting-algorithms-Heapsort create mode 120000 Lang/Phix/Sorting-algorithms-Insertion-sort create mode 120000 Lang/Phix/Sorting-algorithms-Merge-sort create mode 120000 Lang/Phix/Sorting-algorithms-Pancake-sort create mode 120000 Lang/Phix/Sorting-algorithms-Permutation-sort create mode 120000 Lang/Phix/Sorting-algorithms-Quicksort create mode 120000 Lang/Phix/Sorting-algorithms-Radix-sort create mode 120000 Lang/Phix/Sorting-algorithms-Selection-sort create mode 120000 Lang/Phix/Sorting-algorithms-Shell-sort create mode 120000 Lang/Phix/Sorting-algorithms-Sleep-sort create mode 120000 Lang/Phix/Sorting-algorithms-Stooge-sort create mode 120000 Lang/Phix/Sorting-algorithms-Strand-sort create mode 120000 Lang/Phix/Spiral-matrix create mode 120000 Lang/Phix/Stack create mode 120000 Lang/Phix/Stair-climbing-puzzle create mode 120000 Lang/Phix/Start-from-a-main-routine create mode 120000 Lang/Phix/Stem-and-leaf-plot create mode 120000 Lang/Phix/String-append create mode 120000 Lang/Phix/String-case create mode 120000 Lang/Phix/String-comparison create mode 120000 Lang/Phix/String-concatenation create mode 120000 Lang/Phix/String-interpolation--included- create mode 120000 Lang/Phix/String-length create mode 120000 Lang/Phix/String-matching create mode 120000 Lang/Phix/String-prepend create mode 120000 Lang/Phix/Strip-a-set-of-characters-from-a-string create mode 120000 Lang/Phix/Strip-block-comments create mode 120000 Lang/Phix/Strip-comments-from-a-string create mode 120000 Lang/Phix/Strip-whitespace-from-a-string-Top-and-tail create mode 120000 Lang/Phix/Substring create mode 120000 Lang/Phix/Substring-Top-and-tail create mode 120000 Lang/Phix/Sudoku create mode 120000 Lang/Phix/Sum-and-product-of-an-array create mode 120000 Lang/Phix/Sum-digits-of-an-integer create mode 120000 Lang/Phix/Sum-of-a-series create mode 120000 Lang/Phix/Sum-of-squares create mode 120000 Lang/Phix/Synchronous-concurrency create mode 120000 Lang/Phix/System-time create mode 120000 Lang/Phix/Take-notes-on-the-command-line create mode 120000 Lang/Phix/Temperature-conversion create mode 120000 Lang/Phix/Terminal-control-Clear-the-screen create mode 120000 Lang/Phix/Terminal-control-Cursor-positioning create mode 120000 Lang/Phix/Terminal-control-Dimensions create mode 120000 Lang/Phix/Terminal-control-Display-an-extended-character create mode 120000 Lang/Phix/Terminal-control-Hiding-the-cursor create mode 120000 Lang/Phix/Ternary-logic create mode 120000 Lang/Phix/Text-processing-Max-licenses-in-use create mode 120000 Lang/Phix/Tic-tac-toe create mode 120000 Lang/Phix/Time-a-function create mode 120000 Lang/Phix/Tokenize-a-string create mode 120000 Lang/Phix/Topswops create mode 120000 Lang/Phix/Tree-traversal create mode 120000 Lang/Phix/Trigonometric-functions create mode 120000 Lang/Phix/Twelve-statements create mode 120000 Lang/Phix/Unbias-a-random-generator create mode 120000 Lang/Phix/Undefined-values create mode 120000 Lang/Phix/Unicode-variable-names create mode 120000 Lang/Phix/Use-another-language-to-call-a-function create mode 120000 Lang/Phix/User-input-Graphical create mode 120000 Lang/Phix/User-input-Text create mode 120000 Lang/Phix/Van-der-Corput-sequence create mode 120000 Lang/Phix/Variable-length-quantity create mode 120000 Lang/Phix/Variables create mode 120000 Lang/Phix/Variadic-function create mode 120000 Lang/Phix/Vector-products create mode 120000 Lang/Phix/Visualize-a-tree create mode 120000 Lang/Phix/Walk-a-directory-Non-recursively create mode 120000 Lang/Phix/Walk-a-directory-Recursively create mode 120000 Lang/Phix/Window-creation create mode 120000 Lang/Phix/Window-management create mode 120000 Lang/Phix/Write-float-arrays-to-a-text-file create mode 120000 Lang/Phix/Write-language-name-in-3D-ASCII create mode 120000 Lang/Phix/XML-Output create mode 120000 Lang/Phix/Zebra-puzzle create mode 120000 Lang/Phix/Zero-to-the-zero-power create mode 120000 Lang/Phix/Zhang-Suen-thinning-algorithm create mode 120000 Lang/Phix/Zig-zag-matrix create mode 100644 Lang/Picat/00DESCRIPTION create mode 120000 Lang/Picat/Function-definition create mode 100644 Lang/Picat/README create mode 100644 Lang/Pict/00DESCRIPTION create mode 120000 Lang/Pict/Hello-world-Newline-omission create mode 120000 Lang/Pict/Hello-world-Text create mode 100644 Lang/Pict/README create mode 100644 Lang/Pony/00DESCRIPTION create mode 120000 Lang/Pony/Arrays create mode 120000 Lang/Pony/Evolutionary-algorithm create mode 120000 Lang/Pony/FizzBuzz create mode 120000 Lang/Pony/Hello-world-Text create mode 100644 Lang/Pony/README create mode 120000 Lang/Pony/Variables create mode 100644 Lang/Potion/00DESCRIPTION create mode 120000 Lang/Potion/100-doors create mode 120000 Lang/Potion/24-game create mode 120000 Lang/Potion/A+B create mode 120000 Lang/Potion/Ackermann-function create mode 120000 Lang/Potion/Almost-prime create mode 120000 Lang/Potion/Arithmetic-geometric-mean create mode 120000 Lang/Potion/Associative-array-Creation create mode 120000 Lang/Potion/Associative-array-Iteration create mode 120000 Lang/Potion/Digital-root create mode 120000 Lang/Potion/Execute-Brain---- create mode 120000 Lang/Potion/Fibonacci-sequence create mode 120000 Lang/Potion/FizzBuzz create mode 120000 Lang/Potion/Greatest-subsequential-sum create mode 120000 Lang/Potion/Happy-numbers create mode 120000 Lang/Potion/Hello-world-Text create mode 120000 Lang/Potion/Horners-rule-for-polynomial-evaluation create mode 120000 Lang/Potion/Palindrome-detection create mode 120000 Lang/Potion/Pascals-triangle create mode 100644 Lang/Potion/README create mode 120000 Lang/Potion/S-Expressions create mode 120000 Lang/Potion/SEDOLs create mode 120000 Lang/Potion/Sort-an-integer-array create mode 120000 Lang/Potion/String-case create mode 120000 Lang/Potion/String-length create mode 120000 Lang/Potion/Sum-of-a-series create mode 120000 Lang/Potion/Topswops create mode 100644 Lang/Powerbuilder/00DESCRIPTION create mode 120000 Lang/Powerbuilder/Averages-Root-mean-square create mode 120000 Lang/Powerbuilder/Ethiopian-multiplication create mode 100644 Lang/Powerbuilder/README create mode 120000 Lang/Powerbuilder/String-case create mode 100644 Lang/Pyret/00DESCRIPTION create mode 120000 Lang/Pyret/100-doors create mode 120000 Lang/Pyret/Combinations create mode 120000 Lang/Pyret/FizzBuzz create mode 100644 Lang/Pyret/README create mode 100644 Lang/RPGIV/00DESCRIPTION create mode 120000 Lang/RPGIV/Detect-division-by-zero create mode 100644 Lang/RPGIV/README create mode 100644 Lang/RPL/00DESCRIPTION create mode 120000 Lang/RPL/Guess-the-number create mode 120000 Lang/RPL/Lucas-Lehmer-test create mode 100644 Lang/RPL/README create mode 100644 Lang/Ra/00DESCRIPTION create mode 120000 Lang/Ra/99-Bottles-of-Beer create mode 120000 Lang/Ra/A+B create mode 120000 Lang/Ra/Fibonacci-sequence create mode 120000 Lang/Ra/Hello-world-Newbie create mode 120000 Lang/Ra/Hello-world-Newline-omission create mode 120000 Lang/Ra/Hello-world-Standard-error create mode 120000 Lang/Ra/Hello-world-Text create mode 100644 Lang/Ra/README create mode 120000 Lang/Ra/Sorting-algorithms-Bubble-sort create mode 120000 Lang/Ra/Sorting-algorithms-Selection-sort create mode 100644 Lang/Rapira/00DESCRIPTION create mode 120000 Lang/Rapira/Factorial create mode 100644 Lang/Rapira/README create mode 100644 Lang/Red/00DESCRIPTION create mode 120000 Lang/Red/100-doors create mode 120000 Lang/Red/99-Bottles-of-Beer create mode 120000 Lang/Red/A+B create mode 120000 Lang/Red/Abstract-type create mode 120000 Lang/Red/Add-a-variable-to-a-class-instance-at-runtime create mode 120000 Lang/Red/Align-columns create mode 120000 Lang/Red/Flatten-a-list create mode 120000 Lang/Red/Hello-world-Newline-omission create mode 100644 Lang/Red/README create mode 120000 Lang/Red/Roman-numerals-Decode create mode 120000 Lang/Red/Roman-numerals-Encode create mode 100644 Lang/Reduce/00DESCRIPTION create mode 100644 Lang/Reduce/README create mode 100644 Lang/Ring/00DESCRIPTION create mode 120000 Lang/Ring/100-doors create mode 120000 Lang/Ring/99-Bottles-of-Beer create mode 120000 Lang/Ring/A+B create mode 120000 Lang/Ring/ABC-Problem create mode 120000 Lang/Ring/Abundant,-deficient-and-perfect-number-classifications create mode 120000 Lang/Ring/Accumulator-factory create mode 120000 Lang/Ring/Ackermann-function create mode 120000 Lang/Ring/Active-Directory-Connect create mode 120000 Lang/Ring/Add-a-variable-to-a-class-instance-at-runtime create mode 120000 Lang/Ring/Almost-prime create mode 120000 Lang/Ring/Amicable-pairs create mode 120000 Lang/Ring/Apply-a-callback-to-an-array create mode 120000 Lang/Ring/Arithmetic-Integer create mode 120000 Lang/Ring/Arithmetic-geometric-mean create mode 120000 Lang/Ring/Array-concatenation create mode 120000 Lang/Ring/Arrays create mode 120000 Lang/Ring/Assertions create mode 120000 Lang/Ring/Averages-Arithmetic-mean create mode 120000 Lang/Ring/Averages-Median create mode 120000 Lang/Ring/Averages-Pythagorean-means create mode 120000 Lang/Ring/Averages-Root-mean-square create mode 120000 Lang/Ring/Averages-Simple-moving-average create mode 120000 Lang/Ring/Balanced-brackets create mode 120000 Lang/Ring/Binary-digits create mode 120000 Lang/Ring/Binary-search create mode 120000 Lang/Ring/Binary-strings create mode 120000 Lang/Ring/Bitmap-Bresenhams-line-algorithm create mode 120000 Lang/Ring/Bitwise-operations create mode 120000 Lang/Ring/Boolean-values create mode 120000 Lang/Ring/Call-a-function create mode 120000 Lang/Ring/Call-an-object-method create mode 120000 Lang/Ring/Case-sensitivity-of-identifiers create mode 120000 Lang/Ring/Catalan-numbers create mode 120000 Lang/Ring/Catalan-numbers-Pascals-triangle create mode 120000 Lang/Ring/Catamorphism create mode 120000 Lang/Ring/Character-codes create mode 120000 Lang/Ring/Check-that-file-exists create mode 120000 Lang/Ring/Classes create mode 120000 Lang/Ring/Closest-pair-problem create mode 120000 Lang/Ring/Closures-Value-capture create mode 120000 Lang/Ring/Color-of-a-screen-pixel create mode 120000 Lang/Ring/Colour-bars-Display create mode 120000 Lang/Ring/Command-line-arguments create mode 120000 Lang/Ring/Comments create mode 120000 Lang/Ring/Compile-time-calculation create mode 120000 Lang/Ring/Compound-data-type create mode 120000 Lang/Ring/Conditional-structures create mode 120000 Lang/Ring/Constrained-random-points-on-a-circle create mode 120000 Lang/Ring/Copy-a-string create mode 120000 Lang/Ring/Count-in-factors create mode 120000 Lang/Ring/Count-in-octal create mode 120000 Lang/Ring/Count-occurrences-of-a-substring create mode 120000 Lang/Ring/Create-a-file create mode 120000 Lang/Ring/Create-a-two-dimensional-array-at-runtime create mode 120000 Lang/Ring/Date-format create mode 120000 Lang/Ring/Day-of-the-week create mode 120000 Lang/Ring/Delete-a-file create mode 120000 Lang/Ring/Detect-division-by-zero create mode 120000 Lang/Ring/Determine-if-a-string-is-numeric create mode 120000 Lang/Ring/Digital-root create mode 120000 Lang/Ring/Dinesmans-multiple-dwelling-problem create mode 120000 Lang/Ring/Documentation create mode 120000 Lang/Ring/Dot-product create mode 120000 Lang/Ring/Dynamic-variable-names create mode 120000 Lang/Ring/Empty-directory create mode 120000 Lang/Ring/Empty-program create mode 120000 Lang/Ring/Empty-string create mode 120000 Lang/Ring/Enumerations create mode 120000 Lang/Ring/Environment-variables create mode 120000 Lang/Ring/Equilibrium-index create mode 120000 Lang/Ring/Ethiopian-multiplication create mode 120000 Lang/Ring/Euler-method create mode 120000 Lang/Ring/Evaluate-binomial-coefficients create mode 120000 Lang/Ring/Even-or-odd create mode 120000 Lang/Ring/Exceptions create mode 120000 Lang/Ring/Execute-a-system-command create mode 120000 Lang/Ring/Exponentiation-operator create mode 120000 Lang/Ring/Extensible-prime-generator create mode 120000 Lang/Ring/Factorial create mode 120000 Lang/Ring/Factors-of-an-integer create mode 120000 Lang/Ring/Fibonacci-sequence create mode 120000 Lang/Ring/File-input-output create mode 120000 Lang/Ring/File-size create mode 120000 Lang/Ring/Filter create mode 120000 Lang/Ring/Find-limit-of-recursion create mode 120000 Lang/Ring/Find-the-last-Sunday-of-each-month create mode 120000 Lang/Ring/Find-the-missing-permutation create mode 120000 Lang/Ring/Five-weekends create mode 120000 Lang/Ring/FizzBuzz create mode 120000 Lang/Ring/Flatten-a-list create mode 120000 Lang/Ring/Flow-control-structures create mode 120000 Lang/Ring/Floyds-triangle create mode 120000 Lang/Ring/Formatted-numeric-output create mode 120000 Lang/Ring/Fractal-tree create mode 120000 Lang/Ring/Function-definition create mode 120000 Lang/Ring/GUI-Maximum-window-dimensions create mode 120000 Lang/Ring/GUI-component-interaction create mode 120000 Lang/Ring/GUI-enabling-disabling-of-controls create mode 120000 Lang/Ring/Gamma-function create mode 120000 Lang/Ring/Generate-lower-case-ASCII-alphabet create mode 120000 Lang/Ring/Generic-swap create mode 120000 Lang/Ring/Globally-replace-text-in-several-files create mode 120000 Lang/Ring/Greatest-common-divisor create mode 120000 Lang/Ring/Greatest-element-of-a-list create mode 120000 Lang/Ring/Guess-the-number create mode 120000 Lang/Ring/Guess-the-number-With-feedback create mode 120000 Lang/Ring/Guess-the-number-With-feedback--player- create mode 120000 Lang/Ring/HTTP create mode 120000 Lang/Ring/HTTPS create mode 120000 Lang/Ring/Hailstone-sequence create mode 120000 Lang/Ring/Hamming-numbers create mode 120000 Lang/Ring/Happy-numbers create mode 120000 Lang/Ring/Harshad-or-Niven-series create mode 120000 Lang/Ring/Hash-join create mode 120000 Lang/Ring/Haversine-formula create mode 120000 Lang/Ring/Hello-world-Graphical create mode 120000 Lang/Ring/Hello-world-Line-printer create mode 120000 Lang/Ring/Hello-world-Newbie create mode 120000 Lang/Ring/Hello-world-Newline-omission create mode 120000 Lang/Ring/Hello-world-Standard-error create mode 120000 Lang/Ring/Hello-world-Text create mode 120000 Lang/Ring/Hello-world-Web-server create mode 120000 Lang/Ring/Here-document create mode 120000 Lang/Ring/Heronian-triangles create mode 120000 Lang/Ring/Hickerson-series-of-almost-integers create mode 120000 Lang/Ring/Hofstadter-Conway-$10,000-sequence create mode 120000 Lang/Ring/Hofstadter-Q-sequence create mode 120000 Lang/Ring/Horners-rule-for-polynomial-evaluation create mode 120000 Lang/Ring/Identity-matrix create mode 120000 Lang/Ring/Include-a-file create mode 120000 Lang/Ring/Increment-a-numerical-string create mode 120000 Lang/Ring/Inheritance-Single create mode 120000 Lang/Ring/Input-loop create mode 120000 Lang/Ring/Integer-comparison create mode 120000 Lang/Ring/Integer-sequence create mode 120000 Lang/Ring/Interactive-programming create mode 120000 Lang/Ring/Iterated-digits-squaring create mode 120000 Lang/Ring/Kaprekar-numbers create mode 120000 Lang/Ring/Keyboard-input-Keypress-check create mode 120000 Lang/Ring/Keyboard-input-Obtain-a-Y-or-N-response create mode 120000 Lang/Ring/Knuth-shuffle create mode 120000 Lang/Ring/Langtons-ant create mode 120000 Lang/Ring/Largest-int-from-concatenated-ints create mode 120000 Lang/Ring/Last-Friday-of-each-month create mode 120000 Lang/Ring/Leap-year create mode 120000 Lang/Ring/Least-common-multiple create mode 120000 Lang/Ring/Left-factorials create mode 120000 Lang/Ring/Letter-frequency create mode 120000 Lang/Ring/List-comprehensions create mode 120000 Lang/Ring/Literals-String create mode 120000 Lang/Ring/Logical-operations create mode 120000 Lang/Ring/Longest-common-subsequence create mode 120000 Lang/Ring/Look-and-say-sequence create mode 120000 Lang/Ring/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/Ring/Loops-Break create mode 120000 Lang/Ring/Loops-Continue create mode 120000 Lang/Ring/Loops-Do-while create mode 120000 Lang/Ring/Loops-Downward-for create mode 120000 Lang/Ring/Loops-For create mode 120000 Lang/Ring/Loops-For-with-a-specified-step create mode 120000 Lang/Ring/Loops-Foreach create mode 120000 Lang/Ring/Loops-Infinite create mode 120000 Lang/Ring/Loops-N-plus-one-half create mode 120000 Lang/Ring/Loops-Nested create mode 120000 Lang/Ring/Loops-While create mode 120000 Lang/Ring/Lucas-Lehmer-test create mode 120000 Lang/Ring/Luhn-test-of-credit-card-numbers create mode 120000 Lang/Ring/MD5 create mode 120000 Lang/Ring/Mad-Libs create mode 120000 Lang/Ring/Magic-squares-of-odd-order create mode 120000 Lang/Ring/Make-directory-path create mode 120000 Lang/Ring/Mandelbrot-set create mode 120000 Lang/Ring/Matrix-multiplication create mode 120000 Lang/Ring/Matrix-transposition create mode 120000 Lang/Ring/Memory-allocation create mode 120000 Lang/Ring/Menu create mode 120000 Lang/Ring/Metaprogramming create mode 120000 Lang/Ring/Middle-three-digits create mode 120000 Lang/Ring/Modular-inverse create mode 120000 Lang/Ring/Monte-Carlo-methods create mode 120000 Lang/Ring/Mouse-position create mode 120000 Lang/Ring/Multifactorial create mode 120000 Lang/Ring/Multiplication-tables create mode 120000 Lang/Ring/Mutual-recursion create mode 120000 Lang/Ring/Narcissistic-decimal-number create mode 120000 Lang/Ring/Non-decimal-radices-Input create mode 120000 Lang/Ring/Nth create mode 120000 Lang/Ring/Nth-root create mode 120000 Lang/Ring/Null-object create mode 120000 Lang/Ring/Number-names create mode 120000 Lang/Ring/One-of-n-lines-in-a-file create mode 120000 Lang/Ring/Operator-precedence create mode 120000 Lang/Ring/Order-two-numerical-lists create mode 120000 Lang/Ring/Ordered-words create mode 120000 Lang/Ring/Palindrome-detection create mode 120000 Lang/Ring/Pangram-checker create mode 120000 Lang/Ring/Pascals-triangle create mode 120000 Lang/Ring/Perfect-numbers create mode 120000 Lang/Ring/Permutations create mode 120000 Lang/Ring/Phrase-reversals create mode 120000 Lang/Ring/Pick-random-element create mode 120000 Lang/Ring/Play-recorded-sounds create mode 120000 Lang/Ring/Playing-cards create mode 120000 Lang/Ring/Price-fraction create mode 120000 Lang/Ring/Primality-by-trial-division create mode 120000 Lang/Ring/Prime-decomposition create mode 120000 Lang/Ring/Program-name create mode 120000 Lang/Ring/Program-termination create mode 120000 Lang/Ring/Pythagorean-triples create mode 120000 Lang/Ring/Quickselect-algorithm create mode 120000 Lang/Ring/Quine create mode 100644 Lang/Ring/README create mode 120000 Lang/Ring/Random-number-generator--device- create mode 120000 Lang/Ring/Random-number-generator--included- create mode 120000 Lang/Ring/Random-numbers create mode 120000 Lang/Ring/Read-a-file-line-by-line create mode 120000 Lang/Ring/Read-a-specific-line-from-a-file create mode 120000 Lang/Ring/Read-entire-file create mode 120000 Lang/Ring/Real-constants-and-functions create mode 120000 Lang/Ring/Remove-duplicate-elements create mode 120000 Lang/Ring/Remove-lines-from-a-file create mode 120000 Lang/Ring/Rename-a-file create mode 120000 Lang/Ring/Repeat-a-string create mode 120000 Lang/Ring/Return-multiple-values create mode 120000 Lang/Ring/Reverse-a-string create mode 120000 Lang/Ring/Reverse-words-in-a-string create mode 120000 Lang/Ring/Roman-numerals-Decode create mode 120000 Lang/Ring/Roman-numerals-Encode create mode 120000 Lang/Ring/Roots-of-a-function create mode 120000 Lang/Ring/Roots-of-a-quadratic-function create mode 120000 Lang/Ring/Roots-of-unity create mode 120000 Lang/Ring/Rot-13 create mode 120000 Lang/Ring/Runge-Kutta-method create mode 120000 Lang/Ring/Runtime-evaluation create mode 120000 Lang/Ring/Runtime-evaluation-In-an-environment create mode 120000 Lang/Ring/SEDOLs create mode 120000 Lang/Ring/Search-a-list create mode 120000 Lang/Ring/Semiprime create mode 120000 Lang/Ring/Semordnilap create mode 120000 Lang/Ring/Send-email create mode 120000 Lang/Ring/Sequence-of-non-squares create mode 120000 Lang/Ring/Sequence-of-primes-by-Trial-Division create mode 120000 Lang/Ring/Shell-one-liner create mode 120000 Lang/Ring/Show-the-epoch create mode 120000 Lang/Ring/Sierpinski-carpet create mode 120000 Lang/Ring/Sierpinski-triangle-Graphical create mode 120000 Lang/Ring/Sieve-of-Eratosthenes create mode 120000 Lang/Ring/Simple-windowed-application create mode 120000 Lang/Ring/Sleep create mode 120000 Lang/Ring/Sockets create mode 120000 Lang/Ring/Sort-an-integer-array create mode 120000 Lang/Ring/Sort-stability create mode 120000 Lang/Ring/Sorting-algorithms-Bubble-sort create mode 120000 Lang/Ring/Sorting-algorithms-Cocktail-sort create mode 120000 Lang/Ring/Sorting-algorithms-Comb-sort create mode 120000 Lang/Ring/Sorting-algorithms-Counting-sort create mode 120000 Lang/Ring/Sorting-algorithms-Gnome-sort create mode 120000 Lang/Ring/Sorting-algorithms-Insertion-sort create mode 120000 Lang/Ring/Sorting-algorithms-Pancake-sort create mode 120000 Lang/Ring/Sorting-algorithms-Selection-sort create mode 120000 Lang/Ring/Sorting-algorithms-Shell-sort create mode 120000 Lang/Ring/Sorting-algorithms-Stooge-sort create mode 120000 Lang/Ring/Stair-climbing-puzzle create mode 120000 Lang/Ring/String-append create mode 120000 Lang/Ring/String-case create mode 120000 Lang/Ring/String-comparison create mode 120000 Lang/Ring/String-concatenation create mode 120000 Lang/Ring/String-interpolation--included- create mode 120000 Lang/Ring/String-length create mode 120000 Lang/Ring/String-matching create mode 120000 Lang/Ring/String-prepend create mode 120000 Lang/Ring/Strip-a-set-of-characters-from-a-string create mode 120000 Lang/Ring/Strip-block-comments create mode 120000 Lang/Ring/Strip-comments-from-a-string create mode 120000 Lang/Ring/Strip-control-codes-and-extended-characters-from-a-string create mode 120000 Lang/Ring/Strip-whitespace-from-a-string-Top-and-tail create mode 120000 Lang/Ring/Substring create mode 120000 Lang/Ring/Substring-Top-and-tail create mode 120000 Lang/Ring/Sum-and-product-of-an-array create mode 120000 Lang/Ring/Sum-digits-of-an-integer create mode 120000 Lang/Ring/Sum-multiples-of-3-and-5 create mode 120000 Lang/Ring/Sum-of-a-series create mode 120000 Lang/Ring/Sum-of-squares create mode 120000 Lang/Ring/Symmetric-difference create mode 120000 Lang/Ring/System-time create mode 120000 Lang/Ring/Temperature-conversion create mode 120000 Lang/Ring/Terminal-control-Clear-the-screen create mode 120000 Lang/Ring/Terminal-control-Dimensions create mode 120000 Lang/Ring/Terminal-control-Inverse-video create mode 120000 Lang/Ring/Terminal-control-Ringing-the-terminal-bell create mode 120000 Lang/Ring/Test-a-function create mode 120000 Lang/Ring/Tic-tac-toe create mode 120000 Lang/Ring/Time-a-function create mode 120000 Lang/Ring/Tokenize-a-string create mode 120000 Lang/Ring/Towers-of-Hanoi create mode 120000 Lang/Ring/Trabb-Pardo-Knuth-algorithm create mode 120000 Lang/Ring/Trigonometric-functions create mode 120000 Lang/Ring/Truncate-a-file create mode 120000 Lang/Ring/Unbias-a-random-generator create mode 120000 Lang/Ring/User-input-Graphical create mode 120000 Lang/Ring/User-input-Text create mode 120000 Lang/Ring/Van-der-Corput-sequence create mode 120000 Lang/Ring/Variable-size-Get create mode 120000 Lang/Ring/Variables create mode 120000 Lang/Ring/Walk-a-directory-Recursively create mode 120000 Lang/Ring/Window-creation create mode 120000 Lang/Ring/Window-management create mode 120000 Lang/Ring/Zero-to-the-zero-power create mode 100644 Lang/Robotic/00DESCRIPTION create mode 120000 Lang/Robotic/Hello-world-Newbie create mode 100644 Lang/Robotic/README create mode 100644 Lang/Rubylog/00DESCRIPTION create mode 100644 Lang/Rubylog/README create mode 100644 Lang/SPAD/00DESCRIPTION create mode 120000 Lang/SPAD/A+B create mode 120000 Lang/SPAD/ABC-Problem create mode 120000 Lang/SPAD/Ackermann-function create mode 120000 Lang/SPAD/Bernoulli-numbers create mode 120000 Lang/SPAD/Combinations create mode 120000 Lang/SPAD/Matrix-arithmetic create mode 120000 Lang/SPAD/Matrix-exponentiation-operator create mode 120000 Lang/SPAD/Matrix-multiplication create mode 120000 Lang/SPAD/Matrix-transposition create mode 120000 Lang/SPAD/Monty-Hall-problem create mode 120000 Lang/SPAD/Prime-decomposition create mode 100644 Lang/SPAD/README create mode 100644 Lang/SSEM/00DESCRIPTION create mode 120000 Lang/SSEM/A+B create mode 120000 Lang/SSEM/Arithmetic-Integer create mode 120000 Lang/SSEM/Arrays create mode 120000 Lang/SSEM/Caesar-cipher create mode 120000 Lang/SSEM/Call-a-function create mode 120000 Lang/SSEM/Comments create mode 120000 Lang/SSEM/Conditional-structures create mode 120000 Lang/SSEM/Empty-program create mode 120000 Lang/SSEM/Even-or-odd create mode 120000 Lang/SSEM/Factorial create mode 120000 Lang/SSEM/Fibonacci-sequence create mode 120000 Lang/SSEM/Flow-control-structures create mode 120000 Lang/SSEM/Function-definition create mode 120000 Lang/SSEM/Hello-world-Graphical create mode 120000 Lang/SSEM/Integer-comparison create mode 120000 Lang/SSEM/Integer-sequence create mode 120000 Lang/SSEM/Jump-anywhere create mode 120000 Lang/SSEM/Loops-Downward-for create mode 120000 Lang/SSEM/Loops-For-with-a-specified-step create mode 120000 Lang/SSEM/Program-termination create mode 100644 Lang/SSEM/README create mode 120000 Lang/SSEM/Singly-linked-list-Element-definition create mode 120000 Lang/SSEM/Singly-linked-list-Traversal create mode 100644 Lang/SequenceL/00DESCRIPTION create mode 120000 Lang/SequenceL/100-doors create mode 120000 Lang/SequenceL/99-Bottles-of-Beer create mode 120000 Lang/SequenceL/A+B create mode 120000 Lang/SequenceL/ABC-Problem create mode 120000 Lang/SequenceL/Almost-prime create mode 120000 Lang/SequenceL/Animate-a-pendulum create mode 120000 Lang/SequenceL/Binary-digits create mode 120000 Lang/SequenceL/Binary-search create mode 120000 Lang/SequenceL/Bitmap create mode 120000 Lang/SequenceL/Caesar-cipher create mode 120000 Lang/SequenceL/Character-codes create mode 120000 Lang/SequenceL/Conways-Game-of-Life create mode 120000 Lang/SequenceL/Dragon-curve create mode 120000 Lang/SequenceL/Euler-method create mode 120000 Lang/SequenceL/Even-or-odd create mode 120000 Lang/SequenceL/Evolutionary-algorithm create mode 120000 Lang/SequenceL/Factorial create mode 120000 Lang/SequenceL/Factors-of-an-integer create mode 120000 Lang/SequenceL/Fast-Fourier-transform create mode 120000 Lang/SequenceL/Fibonacci-sequence create mode 120000 Lang/SequenceL/Filter create mode 120000 Lang/SequenceL/FizzBuzz create mode 120000 Lang/SequenceL/Greatest-common-divisor create mode 120000 Lang/SequenceL/Happy-numbers create mode 120000 Lang/SequenceL/Here-document create mode 120000 Lang/SequenceL/Hough-transform create mode 120000 Lang/SequenceL/Mandelbrot-set create mode 120000 Lang/SequenceL/Matrix-multiplication create mode 120000 Lang/SequenceL/Number-names create mode 120000 Lang/SequenceL/Numerical-integration create mode 120000 Lang/SequenceL/Palindrome-detection create mode 120000 Lang/SequenceL/Parallel-calculations create mode 120000 Lang/SequenceL/Prime-decomposition create mode 100644 Lang/SequenceL/README create mode 120000 Lang/SequenceL/Reverse-a-string create mode 120000 Lang/SequenceL/Universal-Turing-machine create mode 100644 Lang/Set-lang/00DESCRIPTION create mode 120000 Lang/Set-lang/99-Bottles-of-Beer create mode 120000 Lang/Set-lang/Comments create mode 120000 Lang/Set-lang/Death-Star create mode 120000 Lang/Set-lang/Empty-program create mode 120000 Lang/Set-lang/Hello-world-Text create mode 120000 Lang/Set-lang/Nth create mode 100644 Lang/Set-lang/README create mode 120000 Lang/Set-lang/Variables create mode 100644 Lang/Shen/00DESCRIPTION create mode 120000 Lang/Shen/Ackermann-function create mode 120000 Lang/Shen/Compound-data-type create mode 120000 Lang/Shen/Conways-Game-of-Life create mode 120000 Lang/Shen/Extend-your-language create mode 120000 Lang/Shen/Factorial create mode 120000 Lang/Shen/Fibonacci-sequence create mode 120000 Lang/Shen/FizzBuzz create mode 120000 Lang/Shen/Hello-world-Text create mode 120000 Lang/Shen/Metaprogramming create mode 100644 Lang/Shen/README create mode 100644 Lang/Sidef/00DESCRIPTION create mode 120000 Lang/Sidef/100-doors create mode 120000 Lang/Sidef/24-game create mode 120000 Lang/Sidef/24-game-Solve create mode 120000 Lang/Sidef/9-billion-names-of-God-the-integer create mode 120000 Lang/Sidef/99-Bottles-of-Beer create mode 120000 Lang/Sidef/A+B create mode 120000 Lang/Sidef/ABC-Problem create mode 120000 Lang/Sidef/AKS-test-for-primes create mode 120000 Lang/Sidef/Abstract-type create mode 120000 Lang/Sidef/Abundant,-deficient-and-perfect-number-classifications create mode 120000 Lang/Sidef/Accumulator-factory create mode 120000 Lang/Sidef/Ackermann-function create mode 120000 Lang/Sidef/Add-a-variable-to-a-class-instance-at-runtime create mode 120000 Lang/Sidef/Address-of-a-variable create mode 120000 Lang/Sidef/Align-columns create mode 120000 Lang/Sidef/Almost-prime create mode 120000 Lang/Sidef/Amicable-pairs create mode 120000 Lang/Sidef/Anagrams create mode 120000 Lang/Sidef/Anagrams-Deranged-anagrams create mode 120000 Lang/Sidef/Animate-a-pendulum create mode 120000 Lang/Sidef/Anonymous-recursion create mode 120000 Lang/Sidef/Append-a-record-to-the-end-of-a-text-file create mode 120000 Lang/Sidef/Apply-a-callback-to-an-array create mode 120000 Lang/Sidef/Arbitrary-precision-integers--included- create mode 120000 Lang/Sidef/Arithmetic-Complex create mode 120000 Lang/Sidef/Arithmetic-Integer create mode 120000 Lang/Sidef/Arithmetic-evaluation create mode 120000 Lang/Sidef/Arithmetic-geometric-mean create mode 120000 Lang/Sidef/Arithmetic-geometric-mean-Calculate-Pi create mode 120000 Lang/Sidef/Array-concatenation create mode 120000 Lang/Sidef/Arrays create mode 120000 Lang/Sidef/Assertions create mode 120000 Lang/Sidef/Associative-array-Creation create mode 120000 Lang/Sidef/Associative-array-Iteration create mode 120000 Lang/Sidef/Averages-Arithmetic-mean create mode 120000 Lang/Sidef/Averages-Mean-angle create mode 120000 Lang/Sidef/Averages-Mean-time-of-day create mode 120000 Lang/Sidef/Averages-Median create mode 120000 Lang/Sidef/Averages-Mode create mode 120000 Lang/Sidef/Averages-Pythagorean-means create mode 120000 Lang/Sidef/Averages-Root-mean-square create mode 120000 Lang/Sidef/Averages-Simple-moving-average create mode 120000 Lang/Sidef/Balanced-brackets create mode 120000 Lang/Sidef/Benfords-law create mode 120000 Lang/Sidef/Bernoulli-numbers create mode 120000 Lang/Sidef/Best-shuffle create mode 120000 Lang/Sidef/Binary-digits create mode 120000 Lang/Sidef/Binary-search create mode 120000 Lang/Sidef/Bitmap-Bresenhams-line-algorithm create mode 120000 Lang/Sidef/Bitmap-Write-a-PPM-file create mode 120000 Lang/Sidef/Bitwise-operations create mode 120000 Lang/Sidef/Boolean-values create mode 120000 Lang/Sidef/Box-the-compass create mode 120000 Lang/Sidef/Break-OO-privacy create mode 120000 Lang/Sidef/Bulls-and-cows create mode 120000 Lang/Sidef/Bulls-and-cows-Player create mode 120000 Lang/Sidef/CSV-data-manipulation create mode 120000 Lang/Sidef/CSV-to-HTML-translation create mode 120000 Lang/Sidef/Caesar-cipher create mode 120000 Lang/Sidef/Calendar create mode 120000 Lang/Sidef/Calendar---for-REAL-programmers create mode 120000 Lang/Sidef/Call-a-function create mode 120000 Lang/Sidef/Call-an-object-method create mode 120000 Lang/Sidef/Carmichael-3-strong-pseudoprimes create mode 120000 Lang/Sidef/Case-sensitivity-of-identifiers create mode 120000 Lang/Sidef/Catalan-numbers create mode 120000 Lang/Sidef/Catalan-numbers-Pascals-triangle create mode 120000 Lang/Sidef/Catamorphism create mode 120000 Lang/Sidef/Character-codes create mode 120000 Lang/Sidef/Check-Machin-like-formulas create mode 120000 Lang/Sidef/Check-that-file-exists create mode 120000 Lang/Sidef/Chinese-remainder-theorem create mode 120000 Lang/Sidef/Cholesky-decomposition create mode 120000 Lang/Sidef/Classes create mode 120000 Lang/Sidef/Closest-pair-problem create mode 120000 Lang/Sidef/Closures-Value-capture create mode 120000 Lang/Sidef/Collections create mode 120000 Lang/Sidef/Colour-bars-Display create mode 120000 Lang/Sidef/Combinations create mode 120000 Lang/Sidef/Combinations-and-permutations create mode 120000 Lang/Sidef/Combinations-with-repetitions create mode 120000 Lang/Sidef/Comma-quibbling create mode 120000 Lang/Sidef/Command-line-arguments create mode 120000 Lang/Sidef/Comments create mode 120000 Lang/Sidef/Compile-time-calculation create mode 120000 Lang/Sidef/Compound-data-type create mode 120000 Lang/Sidef/Concurrent-computing create mode 120000 Lang/Sidef/Constrained-genericity create mode 120000 Lang/Sidef/Constrained-random-points-on-a-circle create mode 120000 Lang/Sidef/Continued-fraction create mode 120000 Lang/Sidef/Continued-fraction-Arithmetic-Construct-from-rational-number create mode 120000 Lang/Sidef/Convert-decimal-number-to-rational create mode 120000 Lang/Sidef/Conways-Game-of-Life create mode 120000 Lang/Sidef/Copy-a-string create mode 120000 Lang/Sidef/Count-in-factors create mode 120000 Lang/Sidef/Count-in-octal create mode 120000 Lang/Sidef/Count-occurrences-of-a-substring create mode 120000 Lang/Sidef/Count-the-coins create mode 120000 Lang/Sidef/Create-a-file create mode 120000 Lang/Sidef/Create-a-two-dimensional-array-at-runtime create mode 120000 Lang/Sidef/Create-an-HTML-table create mode 120000 Lang/Sidef/Currying create mode 120000 Lang/Sidef/DNS-query create mode 120000 Lang/Sidef/Date-format create mode 120000 Lang/Sidef/Date-manipulation create mode 120000 Lang/Sidef/Day-of-the-week create mode 120000 Lang/Sidef/Death-Star create mode 120000 Lang/Sidef/Deepcopy create mode 120000 Lang/Sidef/Define-a-primitive-data-type create mode 120000 Lang/Sidef/Delete-a-file create mode 120000 Lang/Sidef/Detect-division-by-zero create mode 120000 Lang/Sidef/Determine-if-a-string-is-numeric create mode 120000 Lang/Sidef/Determine-if-only-one-instance-is-running create mode 120000 Lang/Sidef/Digital-root create mode 120000 Lang/Sidef/Digital-root-Multiplicative-digital-root create mode 120000 Lang/Sidef/Dinesmans-multiple-dwelling-problem create mode 120000 Lang/Sidef/Discordian-date create mode 120000 Lang/Sidef/Dot-product create mode 120000 Lang/Sidef/Doubly-linked-list-Element-definition create mode 120000 Lang/Sidef/Dragon-curve create mode 120000 Lang/Sidef/Draw-a-clock create mode 120000 Lang/Sidef/Draw-a-cuboid create mode 120000 Lang/Sidef/Draw-a-sphere create mode 120000 Lang/Sidef/Dynamic-variable-names create mode 120000 Lang/Sidef/Empty-directory create mode 120000 Lang/Sidef/Empty-program create mode 120000 Lang/Sidef/Empty-string create mode 120000 Lang/Sidef/Enforced-immutability create mode 120000 Lang/Sidef/Entropy create mode 120000 Lang/Sidef/Enumerations create mode 120000 Lang/Sidef/Environment-variables create mode 120000 Lang/Sidef/Equilibrium-index create mode 120000 Lang/Sidef/Ethiopian-multiplication create mode 120000 Lang/Sidef/Euler-method create mode 120000 Lang/Sidef/Evaluate-binomial-coefficients create mode 120000 Lang/Sidef/Even-or-odd create mode 120000 Lang/Sidef/Evolutionary-algorithm create mode 120000 Lang/Sidef/Exceptions create mode 120000 Lang/Sidef/Exceptions-Catch-an-exception-thrown-in-a-nested-call create mode 120000 Lang/Sidef/Executable-library create mode 120000 Lang/Sidef/Execute-Brain---- create mode 120000 Lang/Sidef/Execute-HQ9+ create mode 120000 Lang/Sidef/Execute-a-system-command create mode 120000 Lang/Sidef/Exponentiation-operator create mode 120000 Lang/Sidef/Extend-your-language create mode 120000 Lang/Sidef/Extensible-prime-generator create mode 120000 Lang/Sidef/Extreme-floating-point-values create mode 120000 Lang/Sidef/Factorial create mode 120000 Lang/Sidef/Factors-of-a-Mersenne-number create mode 120000 Lang/Sidef/Factors-of-an-integer create mode 120000 Lang/Sidef/Fast-Fourier-transform create mode 120000 Lang/Sidef/Fibonacci-n-step-number-sequences create mode 120000 Lang/Sidef/Fibonacci-sequence create mode 120000 Lang/Sidef/Fibonacci-word create mode 120000 Lang/Sidef/Fibonacci-word-fractal create mode 120000 Lang/Sidef/File-input-output create mode 120000 Lang/Sidef/File-modification-time create mode 120000 Lang/Sidef/File-size create mode 120000 Lang/Sidef/Filter create mode 120000 Lang/Sidef/Find-common-directory-path create mode 120000 Lang/Sidef/Find-largest-left-truncatable-prime-in-a-given-base create mode 120000 Lang/Sidef/Find-limit-of-recursion create mode 120000 Lang/Sidef/Find-the-last-Sunday-of-each-month create mode 120000 Lang/Sidef/Find-the-missing-permutation create mode 120000 Lang/Sidef/First-class-environments create mode 120000 Lang/Sidef/First-class-functions create mode 120000 Lang/Sidef/First-class-functions-Use-numbers-analogously create mode 120000 Lang/Sidef/Five-weekends create mode 120000 Lang/Sidef/FizzBuzz create mode 120000 Lang/Sidef/Flatten-a-list create mode 120000 Lang/Sidef/Floyds-triangle create mode 120000 Lang/Sidef/Forest-fire create mode 120000 Lang/Sidef/Fork create mode 120000 Lang/Sidef/Formatted-numeric-output create mode 120000 Lang/Sidef/Forward-difference create mode 120000 Lang/Sidef/Four-bit-adder create mode 120000 Lang/Sidef/Fractal-tree create mode 120000 Lang/Sidef/Fractran create mode 120000 Lang/Sidef/Function-composition create mode 120000 Lang/Sidef/Function-definition create mode 120000 Lang/Sidef/Function-frequency create mode 120000 Lang/Sidef/GUI-Maximum-window-dimensions create mode 120000 Lang/Sidef/Gamma-function create mode 120000 Lang/Sidef/Gaussian-elimination create mode 120000 Lang/Sidef/Generate-lower-case-ASCII-alphabet create mode 120000 Lang/Sidef/Generator-Exponential create mode 120000 Lang/Sidef/Generic-swap create mode 120000 Lang/Sidef/Globally-replace-text-in-several-files create mode 120000 Lang/Sidef/Gray-code create mode 120000 Lang/Sidef/Grayscale-image create mode 120000 Lang/Sidef/Greatest-common-divisor create mode 120000 Lang/Sidef/Greatest-element-of-a-list create mode 120000 Lang/Sidef/Greatest-subsequential-sum create mode 120000 Lang/Sidef/Guess-the-number create mode 120000 Lang/Sidef/Guess-the-number-With-feedback create mode 120000 Lang/Sidef/Guess-the-number-With-feedback--player- create mode 120000 Lang/Sidef/HTTP create mode 120000 Lang/Sidef/HTTPS create mode 120000 Lang/Sidef/HTTPS-Authenticated create mode 120000 Lang/Sidef/Hailstone-sequence create mode 120000 Lang/Sidef/Hamming-numbers create mode 120000 Lang/Sidef/Handle-a-signal create mode 120000 Lang/Sidef/Happy-numbers create mode 120000 Lang/Sidef/Harshad-or-Niven-series create mode 120000 Lang/Sidef/Hash-from-two-arrays create mode 120000 Lang/Sidef/Hash-join create mode 120000 Lang/Sidef/Haversine-formula create mode 120000 Lang/Sidef/Hello-world-Graphical create mode 120000 Lang/Sidef/Hello-world-Line-printer create mode 120000 Lang/Sidef/Hello-world-Newline-omission create mode 120000 Lang/Sidef/Hello-world-Standard-error create mode 120000 Lang/Sidef/Hello-world-Text create mode 120000 Lang/Sidef/Hello-world-Web-server create mode 120000 Lang/Sidef/Here-document create mode 120000 Lang/Sidef/Heronian-triangles create mode 120000 Lang/Sidef/Hickerson-series-of-almost-integers create mode 120000 Lang/Sidef/Higher-order-functions create mode 120000 Lang/Sidef/History-variables create mode 120000 Lang/Sidef/Hofstadter-Conway-$10,000-sequence create mode 120000 Lang/Sidef/Hofstadter-Figure-Figure-sequences create mode 120000 Lang/Sidef/Hofstadter-Q-sequence create mode 120000 Lang/Sidef/Holidays-related-to-Easter create mode 120000 Lang/Sidef/Honeycombs create mode 120000 Lang/Sidef/Horizontal-sundial-calculations create mode 120000 Lang/Sidef/Horners-rule-for-polynomial-evaluation create mode 120000 Lang/Sidef/Hostname create mode 120000 Lang/Sidef/Hough-transform create mode 120000 Lang/Sidef/Huffman-coding create mode 120000 Lang/Sidef/IBAN create mode 120000 Lang/Sidef/Identity-matrix create mode 120000 Lang/Sidef/Include-a-file create mode 120000 Lang/Sidef/Increment-a-numerical-string create mode 120000 Lang/Sidef/Infinity create mode 120000 Lang/Sidef/Inheritance-Multiple create mode 120000 Lang/Sidef/Inheritance-Single create mode 120000 Lang/Sidef/Input-loop create mode 120000 Lang/Sidef/Integer-comparison create mode 120000 Lang/Sidef/Integer-overflow create mode 120000 Lang/Sidef/Integer-sequence create mode 120000 Lang/Sidef/Interactive-programming create mode 120000 Lang/Sidef/Inverted-syntax create mode 120000 Lang/Sidef/JSON create mode 120000 Lang/Sidef/Jensens-Device create mode 120000 Lang/Sidef/Josephus-problem create mode 120000 Lang/Sidef/K-d-tree create mode 120000 Lang/Sidef/Kaprekar-numbers create mode 120000 Lang/Sidef/Keyboard-input-Flush-the-keyboard-buffer create mode 120000 Lang/Sidef/Keyboard-input-Obtain-a-Y-or-N-response create mode 120000 Lang/Sidef/Knapsack-problem-0-1 create mode 120000 Lang/Sidef/Knapsack-problem-Bounded create mode 120000 Lang/Sidef/Knapsack-problem-Continuous create mode 120000 Lang/Sidef/Knapsack-problem-Unbounded create mode 120000 Lang/Sidef/Knights-tour create mode 120000 Lang/Sidef/Knuth-shuffle create mode 120000 Lang/Sidef/Knuths-algorithm-S create mode 120000 Lang/Sidef/LU-decomposition create mode 120000 Lang/Sidef/LZW-compression create mode 120000 Lang/Sidef/Langtons-ant create mode 120000 Lang/Sidef/Largest-int-from-concatenated-ints create mode 120000 Lang/Sidef/Last-Friday-of-each-month create mode 120000 Lang/Sidef/Leap-year create mode 120000 Lang/Sidef/Least-common-multiple create mode 120000 Lang/Sidef/Left-factorials create mode 120000 Lang/Sidef/Letter-frequency create mode 120000 Lang/Sidef/Levenshtein-distance create mode 120000 Lang/Sidef/Linear-congruential-generator create mode 120000 Lang/Sidef/List-comprehensions create mode 120000 Lang/Sidef/Literals-Floating-point create mode 120000 Lang/Sidef/Literals-Integer create mode 120000 Lang/Sidef/Literals-String create mode 120000 Lang/Sidef/Logical-operations create mode 120000 Lang/Sidef/Long-multiplication create mode 120000 Lang/Sidef/Longest-common-subsequence create mode 120000 Lang/Sidef/Longest-increasing-subsequence create mode 120000 Lang/Sidef/Longest-string-challenge create mode 120000 Lang/Sidef/Look-and-say-sequence create mode 120000 Lang/Sidef/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/Sidef/Loops-Break create mode 120000 Lang/Sidef/Loops-Continue create mode 120000 Lang/Sidef/Loops-Do-while create mode 120000 Lang/Sidef/Loops-Downward-for create mode 120000 Lang/Sidef/Loops-For create mode 120000 Lang/Sidef/Loops-For-with-a-specified-step create mode 120000 Lang/Sidef/Loops-Foreach create mode 120000 Lang/Sidef/Loops-Infinite create mode 120000 Lang/Sidef/Loops-N-plus-one-half create mode 120000 Lang/Sidef/Loops-Nested create mode 120000 Lang/Sidef/Loops-While create mode 120000 Lang/Sidef/Lucas-Lehmer-test create mode 120000 Lang/Sidef/Ludic-numbers create mode 120000 Lang/Sidef/Luhn-test-of-credit-card-numbers create mode 120000 Lang/Sidef/MD4 create mode 120000 Lang/Sidef/MD5 create mode 120000 Lang/Sidef/MD5-Implementation create mode 120000 Lang/Sidef/Mad-Libs create mode 120000 Lang/Sidef/Magic-squares-of-odd-order create mode 120000 Lang/Sidef/Make-directory-path create mode 120000 Lang/Sidef/Man-or-boy-test create mode 120000 Lang/Sidef/Mandelbrot-set create mode 120000 Lang/Sidef/Map-range create mode 120000 Lang/Sidef/Matrix-multiplication create mode 120000 Lang/Sidef/Matrix-transposition create mode 120000 Lang/Sidef/Maximum-triangle-path-sum create mode 120000 Lang/Sidef/Maze-generation create mode 120000 Lang/Sidef/Menu create mode 120000 Lang/Sidef/Metaprogramming create mode 120000 Lang/Sidef/Middle-three-digits create mode 120000 Lang/Sidef/Modular-exponentiation create mode 120000 Lang/Sidef/Modular-inverse create mode 120000 Lang/Sidef/Monty-Hall-problem create mode 120000 Lang/Sidef/Move-to-front-algorithm create mode 120000 Lang/Sidef/Multifactorial create mode 120000 Lang/Sidef/Multiple-distinct-objects create mode 120000 Lang/Sidef/Multiplication-tables create mode 120000 Lang/Sidef/Multisplit create mode 120000 Lang/Sidef/Munching-squares create mode 120000 Lang/Sidef/Mutual-recursion create mode 120000 Lang/Sidef/Named-parameters create mode 120000 Lang/Sidef/Narcissist create mode 120000 Lang/Sidef/Narcissistic-decimal-number create mode 120000 Lang/Sidef/Natural-sorting create mode 120000 Lang/Sidef/Non-continuous-subsequences create mode 120000 Lang/Sidef/Non-decimal-radices-Convert create mode 120000 Lang/Sidef/Non-decimal-radices-Input create mode 120000 Lang/Sidef/Non-decimal-radices-Output create mode 120000 Lang/Sidef/Nth create mode 120000 Lang/Sidef/Nth-root create mode 120000 Lang/Sidef/Null-object create mode 120000 Lang/Sidef/Number-names create mode 120000 Lang/Sidef/Number-reversal-game create mode 120000 Lang/Sidef/Numerical-integration create mode 120000 Lang/Sidef/Numerical-integration-Gauss-Legendre-Quadrature create mode 120000 Lang/Sidef/Odd-word-problem create mode 120000 Lang/Sidef/Old-lady-swallowed-a-fly create mode 120000 Lang/Sidef/One-dimensional-cellular-automata create mode 120000 Lang/Sidef/One-of-n-lines-in-a-file create mode 120000 Lang/Sidef/Operator-precedence create mode 120000 Lang/Sidef/Optional-parameters create mode 120000 Lang/Sidef/Order-disjoint-list-items create mode 120000 Lang/Sidef/Order-two-numerical-lists create mode 120000 Lang/Sidef/Ordered-Partitions create mode 120000 Lang/Sidef/Ordered-words create mode 120000 Lang/Sidef/Palindrome-detection create mode 120000 Lang/Sidef/Pangram-checker create mode 120000 Lang/Sidef/Parallel-calculations create mode 120000 Lang/Sidef/Parsing-RPN-calculator-algorithm create mode 120000 Lang/Sidef/Parsing-RPN-to-infix-conversion create mode 120000 Lang/Sidef/Parsing-Shunting-yard-algorithm create mode 120000 Lang/Sidef/Partial-function-application create mode 120000 Lang/Sidef/Pascals-triangle create mode 120000 Lang/Sidef/Pascals-triangle-Puzzle create mode 120000 Lang/Sidef/Percentage-difference-between-images create mode 120000 Lang/Sidef/Percolation-Mean-run-density create mode 120000 Lang/Sidef/Perfect-numbers create mode 120000 Lang/Sidef/Permutation-test create mode 120000 Lang/Sidef/Permutations create mode 120000 Lang/Sidef/Permutations-by-swapping create mode 120000 Lang/Sidef/Pernicious-numbers create mode 120000 Lang/Sidef/Phrase-reversals create mode 120000 Lang/Sidef/Pi create mode 120000 Lang/Sidef/Pick-random-element create mode 120000 Lang/Sidef/Pig-the-dice-game-Player create mode 120000 Lang/Sidef/Playing-cards create mode 120000 Lang/Sidef/Plot-coordinate-pairs create mode 120000 Lang/Sidef/Pointers-and-references create mode 120000 Lang/Sidef/Polymorphic-copy create mode 120000 Lang/Sidef/Polymorphism create mode 120000 Lang/Sidef/Polynomial-long-division create mode 120000 Lang/Sidef/Polynomial-regression create mode 120000 Lang/Sidef/Power-set create mode 120000 Lang/Sidef/Price-fraction create mode 120000 Lang/Sidef/Primality-by-trial-division create mode 120000 Lang/Sidef/Prime-decomposition create mode 120000 Lang/Sidef/Priority-queue create mode 120000 Lang/Sidef/Probabilistic-choice create mode 120000 Lang/Sidef/Problem-of-Apollonius create mode 120000 Lang/Sidef/Program-name create mode 120000 Lang/Sidef/Program-termination create mode 120000 Lang/Sidef/Pythagorean-triples create mode 120000 Lang/Sidef/Quaternion-type create mode 120000 Lang/Sidef/Queue-Definition create mode 120000 Lang/Sidef/Queue-Usage create mode 120000 Lang/Sidef/Quickselect-algorithm create mode 120000 Lang/Sidef/Quine create mode 100644 Lang/Sidef/README create mode 120000 Lang/Sidef/RSA-code create mode 120000 Lang/Sidef/Random-number-generator--device- create mode 120000 Lang/Sidef/Random-number-generator--included- create mode 120000 Lang/Sidef/Random-numbers create mode 120000 Lang/Sidef/Range-expansion create mode 120000 Lang/Sidef/Ranking-methods create mode 120000 Lang/Sidef/Rate-counter create mode 120000 Lang/Sidef/Read-a-configuration-file create mode 120000 Lang/Sidef/Read-a-file-line-by-line create mode 120000 Lang/Sidef/Read-a-specific-line-from-a-file create mode 120000 Lang/Sidef/Read-entire-file create mode 120000 Lang/Sidef/Real-constants-and-functions create mode 120000 Lang/Sidef/Reduced-row-echelon-form create mode 120000 Lang/Sidef/Regular-expressions create mode 120000 Lang/Sidef/Remove-duplicate-elements create mode 120000 Lang/Sidef/Remove-lines-from-a-file create mode 120000 Lang/Sidef/Rename-a-file create mode 120000 Lang/Sidef/Rep-string create mode 120000 Lang/Sidef/Repeat-a-string create mode 120000 Lang/Sidef/Resistor-mesh create mode 120000 Lang/Sidef/Respond-to-an-unknown-method-call create mode 120000 Lang/Sidef/Return-multiple-values create mode 120000 Lang/Sidef/Reverse-a-string create mode 120000 Lang/Sidef/Reverse-words-in-a-string create mode 120000 Lang/Sidef/Rock-paper-scissors create mode 120000 Lang/Sidef/Roman-numerals-Decode create mode 120000 Lang/Sidef/Roman-numerals-Encode create mode 120000 Lang/Sidef/Roots-of-a-function create mode 120000 Lang/Sidef/Roots-of-a-quadratic-function create mode 120000 Lang/Sidef/Roots-of-unity create mode 120000 Lang/Sidef/Rot-13 create mode 120000 Lang/Sidef/Run-length-encoding create mode 120000 Lang/Sidef/Runge-Kutta-method create mode 120000 Lang/Sidef/Runtime-evaluation create mode 120000 Lang/Sidef/Runtime-evaluation-In-an-environment create mode 120000 Lang/Sidef/S-Expressions create mode 120000 Lang/Sidef/SEDOLs create mode 120000 Lang/Sidef/SHA-1 create mode 120000 Lang/Sidef/SHA-256 create mode 120000 Lang/Sidef/SQL-based-authentication create mode 120000 Lang/Sidef/Same-Fringe create mode 120000 Lang/Sidef/Scope-Function-names-and-labels create mode 120000 Lang/Sidef/Search-a-list create mode 120000 Lang/Sidef/Secure-temporary-file create mode 120000 Lang/Sidef/Self-describing-numbers create mode 120000 Lang/Sidef/Semiprime create mode 120000 Lang/Sidef/Semordnilap create mode 120000 Lang/Sidef/Send-an-unknown-method-call create mode 120000 Lang/Sidef/Sequence-of-non-squares create mode 120000 Lang/Sidef/Sequence-of-primes-by-Trial-Division create mode 120000 Lang/Sidef/Set create mode 120000 Lang/Sidef/Set-consolidation create mode 120000 Lang/Sidef/Seven-sided-dice-from-five-sided-dice create mode 120000 Lang/Sidef/Shell-one-liner create mode 120000 Lang/Sidef/Short-circuit-evaluation create mode 120000 Lang/Sidef/Show-the-epoch create mode 120000 Lang/Sidef/Sierpinski-carpet create mode 120000 Lang/Sidef/Sierpinski-triangle create mode 120000 Lang/Sidef/Sierpinski-triangle-Graphical create mode 120000 Lang/Sidef/Sieve-of-Eratosthenes create mode 120000 Lang/Sidef/Simple-windowed-application create mode 120000 Lang/Sidef/Singleton create mode 120000 Lang/Sidef/Singly-linked-list-Element-definition create mode 120000 Lang/Sidef/Singly-linked-list-Element-insertion create mode 120000 Lang/Sidef/Singly-linked-list-Traversal create mode 120000 Lang/Sidef/Sleep create mode 120000 Lang/Sidef/Sockets create mode 120000 Lang/Sidef/Sort-an-array-of-composite-structures create mode 120000 Lang/Sidef/Sort-an-integer-array create mode 120000 Lang/Sidef/Sort-disjoint-sublist create mode 120000 Lang/Sidef/Sort-stability create mode 120000 Lang/Sidef/Sort-using-a-custom-comparator create mode 120000 Lang/Sidef/Sorting-algorithms-Bead-sort create mode 120000 Lang/Sidef/Sorting-algorithms-Bogosort create mode 120000 Lang/Sidef/Sorting-algorithms-Bubble-sort create mode 120000 Lang/Sidef/Sorting-algorithms-Cocktail-sort create mode 120000 Lang/Sidef/Sorting-algorithms-Comb-sort create mode 120000 Lang/Sidef/Sorting-algorithms-Counting-sort create mode 120000 Lang/Sidef/Sorting-algorithms-Gnome-sort create mode 120000 Lang/Sidef/Sorting-algorithms-Heapsort create mode 120000 Lang/Sidef/Sorting-algorithms-Insertion-sort create mode 120000 Lang/Sidef/Sorting-algorithms-Merge-sort create mode 120000 Lang/Sidef/Sorting-algorithms-Pancake-sort create mode 120000 Lang/Sidef/Sorting-algorithms-Permutation-sort create mode 120000 Lang/Sidef/Sorting-algorithms-Quicksort create mode 120000 Lang/Sidef/Sorting-algorithms-Radix-sort create mode 120000 Lang/Sidef/Sorting-algorithms-Selection-sort create mode 120000 Lang/Sidef/Sorting-algorithms-Shell-sort create mode 120000 Lang/Sidef/Sorting-algorithms-Sleep-sort create mode 120000 Lang/Sidef/Sorting-algorithms-Stooge-sort create mode 120000 Lang/Sidef/Sorting-algorithms-Strand-sort create mode 120000 Lang/Sidef/Soundex create mode 120000 Lang/Sidef/Sparkline-in-unicode create mode 120000 Lang/Sidef/Speech-synthesis create mode 120000 Lang/Sidef/Spiral-matrix create mode 120000 Lang/Sidef/Stable-marriage-problem create mode 120000 Lang/Sidef/Stack create mode 120000 Lang/Sidef/Stair-climbing-puzzle create mode 120000 Lang/Sidef/Statistics-Basic create mode 120000 Lang/Sidef/Stem-and-leaf-plot create mode 120000 Lang/Sidef/Stern-Brocot-sequence create mode 120000 Lang/Sidef/String-append create mode 120000 Lang/Sidef/String-case create mode 120000 Lang/Sidef/String-comparison create mode 120000 Lang/Sidef/String-concatenation create mode 120000 Lang/Sidef/String-interpolation--included- create mode 120000 Lang/Sidef/String-length create mode 120000 Lang/Sidef/String-matching create mode 120000 Lang/Sidef/String-prepend create mode 120000 Lang/Sidef/Strip-a-set-of-characters-from-a-string create mode 120000 Lang/Sidef/Strip-block-comments create mode 120000 Lang/Sidef/Strip-comments-from-a-string create mode 120000 Lang/Sidef/Strip-control-codes-and-extended-characters-from-a-string create mode 120000 Lang/Sidef/Strip-whitespace-from-a-string-Top-and-tail create mode 120000 Lang/Sidef/Substring create mode 120000 Lang/Sidef/Substring-Top-and-tail create mode 120000 Lang/Sidef/Subtractive-generator create mode 120000 Lang/Sidef/Sudoku create mode 120000 Lang/Sidef/Sum-and-product-of-an-array create mode 120000 Lang/Sidef/Sum-digits-of-an-integer create mode 120000 Lang/Sidef/Sum-multiples-of-3-and-5 create mode 120000 Lang/Sidef/Sum-of-a-series create mode 120000 Lang/Sidef/Sum-of-squares create mode 120000 Lang/Sidef/Sutherland-Hodgman-polygon-clipping create mode 120000 Lang/Sidef/Symmetric-difference create mode 120000 Lang/Sidef/System-time create mode 120000 Lang/Sidef/Table-creation-Postal-addresses create mode 120000 Lang/Sidef/Take-notes-on-the-command-line create mode 120000 Lang/Sidef/Temperature-conversion create mode 120000 Lang/Sidef/Terminal-control-Clear-the-screen create mode 120000 Lang/Sidef/Terminal-control-Coloured-text create mode 120000 Lang/Sidef/Terminal-control-Dimensions create mode 120000 Lang/Sidef/Terminal-control-Display-an-extended-character create mode 120000 Lang/Sidef/Terminal-control-Preserve-screen create mode 120000 Lang/Sidef/Terminal-control-Ringing-the-terminal-bell create mode 120000 Lang/Sidef/Terminal-control-Unicode-output create mode 120000 Lang/Sidef/Text-processing-1 create mode 120000 Lang/Sidef/Text-processing-2 create mode 120000 Lang/Sidef/Text-processing-Max-licenses-in-use create mode 120000 Lang/Sidef/Textonyms create mode 120000 Lang/Sidef/The-ISAAC-Cipher create mode 120000 Lang/Sidef/The-Twelve-Days-of-Christmas create mode 120000 Lang/Sidef/Thieles-interpolation-formula create mode 120000 Lang/Sidef/Time-a-function create mode 120000 Lang/Sidef/Tokenize-a-string create mode 120000 Lang/Sidef/Top-rank-per-group create mode 120000 Lang/Sidef/Topic-variable create mode 120000 Lang/Sidef/Topological-sort create mode 120000 Lang/Sidef/Towers-of-Hanoi create mode 120000 Lang/Sidef/Trabb-Pardo-Knuth-algorithm create mode 120000 Lang/Sidef/Tree-traversal create mode 120000 Lang/Sidef/Trigonometric-functions create mode 120000 Lang/Sidef/Truncatable-primes create mode 120000 Lang/Sidef/Truncate-a-file create mode 120000 Lang/Sidef/URL-decoding create mode 120000 Lang/Sidef/URL-encoding create mode 120000 Lang/Sidef/Ulam-spiral--for-primes- create mode 120000 Lang/Sidef/Unbias-a-random-generator create mode 120000 Lang/Sidef/Undefined-values create mode 120000 Lang/Sidef/Unicode-strings create mode 120000 Lang/Sidef/Unicode-variable-names create mode 120000 Lang/Sidef/Universal-Turing-machine create mode 120000 Lang/Sidef/Unix-ls create mode 120000 Lang/Sidef/User-input-Graphical create mode 120000 Lang/Sidef/User-input-Text create mode 120000 Lang/Sidef/Van-der-Corput-sequence create mode 120000 Lang/Sidef/Variadic-function create mode 120000 Lang/Sidef/Vector-products create mode 120000 Lang/Sidef/Vigen-re-cipher create mode 120000 Lang/Sidef/Visualize-a-tree create mode 120000 Lang/Sidef/Voronoi-diagram create mode 120000 Lang/Sidef/Walk-a-directory-Non-recursively create mode 120000 Lang/Sidef/Walk-a-directory-Recursively create mode 120000 Lang/Sidef/Web-scraping create mode 120000 Lang/Sidef/Window-creation create mode 120000 Lang/Sidef/Wireworld create mode 120000 Lang/Sidef/Word-wrap create mode 120000 Lang/Sidef/Write-float-arrays-to-a-text-file create mode 120000 Lang/Sidef/Write-language-name-in-3D-ASCII create mode 120000 Lang/Sidef/XML-DOM-serialization create mode 120000 Lang/Sidef/XML-Input create mode 120000 Lang/Sidef/XML-Output create mode 120000 Lang/Sidef/XML-XPath create mode 120000 Lang/Sidef/Xiaolin-Wus-line-algorithm create mode 120000 Lang/Sidef/Y-combinator create mode 120000 Lang/Sidef/Yin-and-yang create mode 120000 Lang/Sidef/Zebra-puzzle create mode 120000 Lang/Sidef/Zeckendorf-number-representation create mode 120000 Lang/Sidef/Zero-to-the-zero-power create mode 120000 Lang/Sidef/Zhang-Suen-thinning-algorithm create mode 120000 Lang/Sidef/Zig-zag-matrix create mode 100644 Lang/SkookumScript/00DESCRIPTION create mode 120000 Lang/SkookumScript/99-Bottles-of-Beer create mode 120000 Lang/SkookumScript/Binary-digits create mode 120000 Lang/SkookumScript/Fibonacci-sequence create mode 120000 Lang/SkookumScript/FizzBuzz create mode 120000 Lang/SkookumScript/Hello-world-Text create mode 120000 Lang/SkookumScript/Logical-operations create mode 100644 Lang/SkookumScript/README create mode 100644 Lang/SmileBASIC/00DESCRIPTION create mode 120000 Lang/SmileBASIC/A+B create mode 120000 Lang/SmileBASIC/Hello-world-Text create mode 100644 Lang/SmileBASIC/README create mode 100644 Lang/SoneKing-Assembly/00DESCRIPTION create mode 120000 Lang/SoneKing-Assembly/Hello-world-Text create mode 100644 Lang/SoneKing-Assembly/README create mode 100644 Lang/Sparkling/00DESCRIPTION create mode 120000 Lang/Sparkling/100-doors create mode 120000 Lang/Sparkling/99-Bottles-of-Beer create mode 120000 Lang/Sparkling/Anonymous-recursion create mode 120000 Lang/Sparkling/Apply-a-callback-to-an-array create mode 120000 Lang/Sparkling/Closures-Value-capture create mode 120000 Lang/Sparkling/Conjugate-transpose create mode 120000 Lang/Sparkling/Count-in-octal create mode 120000 Lang/Sparkling/Empty-program create mode 120000 Lang/Sparkling/Greatest-common-divisor create mode 120000 Lang/Sparkling/Guess-the-number-With-feedback create mode 120000 Lang/Sparkling/Hash-from-two-arrays create mode 120000 Lang/Sparkling/Hello-world-Text create mode 120000 Lang/Sparkling/Higher-order-functions create mode 120000 Lang/Sparkling/Identity-matrix create mode 120000 Lang/Sparkling/Increment-a-numerical-string create mode 120000 Lang/Sparkling/Input-loop create mode 120000 Lang/Sparkling/Integer-comparison create mode 120000 Lang/Sparkling/Least-common-multiple create mode 120000 Lang/Sparkling/Linear-congruential-generator create mode 120000 Lang/Sparkling/Loops-Do-while create mode 120000 Lang/Sparkling/Loops-Downward-for create mode 120000 Lang/Sparkling/Loops-For create mode 120000 Lang/Sparkling/Loops-Foreach create mode 120000 Lang/Sparkling/Loops-Infinite create mode 120000 Lang/Sparkling/Loops-While create mode 120000 Lang/Sparkling/Man-or-boy-test create mode 120000 Lang/Sparkling/Matrix-transposition create mode 120000 Lang/Sparkling/N-queens-problem create mode 100644 Lang/Sparkling/README create mode 120000 Lang/Sparkling/Read-a-file-line-by-line create mode 120000 Lang/Sparkling/Read-entire-file create mode 120000 Lang/Sparkling/Real-constants-and-functions create mode 120000 Lang/Sparkling/Remove-duplicate-elements create mode 120000 Lang/Sparkling/Repeat-a-string create mode 120000 Lang/Sparkling/Reverse-words-in-a-string create mode 120000 Lang/Sparkling/Roots-of-unity create mode 120000 Lang/Sparkling/Runtime-evaluation create mode 120000 Lang/Sparkling/Sort-an-integer-array create mode 120000 Lang/Sparkling/String-concatenation create mode 120000 Lang/Sparkling/String-length create mode 120000 Lang/Sparkling/Sum-and-product-of-an-array create mode 100644 Lang/Spin/00DESCRIPTION create mode 100644 Lang/Spin/README create mode 100644 Lang/Star/00DESCRIPTION create mode 100644 Lang/Star/README create mode 100644 Lang/Swift/00DESCRIPTION create mode 120000 Lang/Swift/100-doors create mode 120000 Lang/Swift/24-game create mode 120000 Lang/Swift/24-game-Solve create mode 120000 Lang/Swift/9-billion-names-of-God-the-integer create mode 120000 Lang/Swift/99-Bottles-of-Beer create mode 120000 Lang/Swift/A+B create mode 120000 Lang/Swift/ABC-Problem create mode 120000 Lang/Swift/AKS-test-for-primes create mode 120000 Lang/Swift/Abundant,-deficient-and-perfect-number-classifications create mode 120000 Lang/Swift/Accumulator-factory create mode 120000 Lang/Swift/Ackermann-function create mode 120000 Lang/Swift/Active-object create mode 120000 Lang/Swift/Add-a-variable-to-a-class-instance-at-runtime create mode 120000 Lang/Swift/Address-of-a-variable create mode 120000 Lang/Swift/Amicable-pairs create mode 120000 Lang/Swift/Anagrams create mode 120000 Lang/Swift/Anonymous-recursion create mode 120000 Lang/Swift/Apply-a-callback-to-an-array create mode 120000 Lang/Swift/Arithmetic-Complex create mode 120000 Lang/Swift/Array-concatenation create mode 120000 Lang/Swift/Arrays create mode 120000 Lang/Swift/Assertions create mode 120000 Lang/Swift/Associative-array-Creation create mode 120000 Lang/Swift/Associative-array-Iteration create mode 120000 Lang/Swift/Averages-Arithmetic-mean create mode 120000 Lang/Swift/Balanced-brackets create mode 120000 Lang/Swift/Binary-digits create mode 120000 Lang/Swift/Binary-search create mode 120000 Lang/Swift/Bitwise-operations create mode 120000 Lang/Swift/CRC-32 create mode 120000 Lang/Swift/Call-a-foreign-language-function create mode 120000 Lang/Swift/Call-a-function create mode 120000 Lang/Swift/Call-an-object-method create mode 120000 Lang/Swift/Case-sensitivity-of-identifiers create mode 120000 Lang/Swift/Character-codes create mode 120000 Lang/Swift/Classes create mode 120000 Lang/Swift/Closures-Value-capture create mode 120000 Lang/Swift/Combinations create mode 120000 Lang/Swift/Combinations-with-repetitions create mode 120000 Lang/Swift/Comma-quibbling create mode 120000 Lang/Swift/Command-line-arguments create mode 120000 Lang/Swift/Comments create mode 120000 Lang/Swift/Compound-data-type create mode 120000 Lang/Swift/Concurrent-computing create mode 120000 Lang/Swift/Constrained-genericity create mode 120000 Lang/Swift/Copy-a-string create mode 120000 Lang/Swift/Count-in-octal create mode 120000 Lang/Swift/Create-a-two-dimensional-array-at-runtime create mode 120000 Lang/Swift/Currying create mode 120000 Lang/Swift/Date-format create mode 120000 Lang/Swift/Day-of-the-week create mode 120000 Lang/Swift/Delegates create mode 120000 Lang/Swift/Determine-if-a-string-is-numeric create mode 120000 Lang/Swift/Determine-if-only-one-instance-is-running create mode 120000 Lang/Swift/Documentation create mode 120000 Lang/Swift/Dot-product create mode 120000 Lang/Swift/Draw-a-sphere create mode 120000 Lang/Swift/Empty-program create mode 120000 Lang/Swift/Empty-string create mode 120000 Lang/Swift/Enumerations create mode 120000 Lang/Swift/Ethiopian-multiplication create mode 120000 Lang/Swift/Even-or-odd create mode 120000 Lang/Swift/Exceptions create mode 120000 Lang/Swift/Exceptions-Catch-an-exception-thrown-in-a-nested-call create mode 120000 Lang/Swift/Execute-Brain---- create mode 120000 Lang/Swift/Execute-a-Markov-algorithm create mode 120000 Lang/Swift/Extreme-floating-point-values create mode 120000 Lang/Swift/Factorial create mode 120000 Lang/Swift/Factors-of-an-integer create mode 120000 Lang/Swift/Fibonacci-sequence create mode 120000 Lang/Swift/Filter create mode 120000 Lang/Swift/First-class-functions create mode 120000 Lang/Swift/FizzBuzz create mode 120000 Lang/Swift/Flatten-a-list create mode 120000 Lang/Swift/Flipping-bits-game create mode 120000 Lang/Swift/Fractal-tree create mode 120000 Lang/Swift/Function-composition create mode 120000 Lang/Swift/Function-definition create mode 120000 Lang/Swift/Generate-lower-case-ASCII-alphabet create mode 120000 Lang/Swift/Generator-Exponential create mode 120000 Lang/Swift/Generic-swap create mode 120000 Lang/Swift/Greatest-common-divisor create mode 120000 Lang/Swift/Greatest-element-of-a-list create mode 120000 Lang/Swift/Guess-the-number create mode 120000 Lang/Swift/Guess-the-number-With-feedback create mode 120000 Lang/Swift/Guess-the-number-With-feedback--player- create mode 120000 Lang/Swift/HTTP create mode 120000 Lang/Swift/HTTPS create mode 120000 Lang/Swift/Hailstone-sequence create mode 120000 Lang/Swift/Handle-a-signal create mode 120000 Lang/Swift/Happy-numbers create mode 120000 Lang/Swift/Hash-from-two-arrays create mode 120000 Lang/Swift/Haversine-formula create mode 120000 Lang/Swift/Hello-world-Graphical create mode 120000 Lang/Swift/Hello-world-Line-printer create mode 120000 Lang/Swift/Hello-world-Newline-omission create mode 120000 Lang/Swift/Hello-world-Standard-error create mode 120000 Lang/Swift/Hello-world-Text create mode 120000 Lang/Swift/Heronian-triangles create mode 120000 Lang/Swift/Higher-order-functions create mode 120000 Lang/Swift/History-variables create mode 120000 Lang/Swift/Hofstadter-Conway-$10,000-sequence create mode 120000 Lang/Swift/Horners-rule-for-polynomial-evaluation create mode 120000 Lang/Swift/Hostname create mode 120000 Lang/Swift/Huffman-coding create mode 120000 Lang/Swift/I-before-E-except-after-C create mode 120000 Lang/Swift/Increment-a-numerical-string create mode 120000 Lang/Swift/Infinity create mode 120000 Lang/Swift/Inheritance-Multiple create mode 120000 Lang/Swift/Inheritance-Single create mode 120000 Lang/Swift/Integer-comparison create mode 120000 Lang/Swift/Integer-overflow create mode 120000 Lang/Swift/Integer-sequence create mode 120000 Lang/Swift/Inverted-syntax create mode 120000 Lang/Swift/JSON create mode 120000 Lang/Swift/Jensens-Device create mode 120000 Lang/Swift/Josephus-problem create mode 120000 Lang/Swift/Knuth-shuffle create mode 120000 Lang/Swift/Knuths-algorithm-S create mode 120000 Lang/Swift/LZW-compression create mode 120000 Lang/Swift/Langtons-ant create mode 120000 Lang/Swift/Leap-year create mode 120000 Lang/Swift/Least-common-multiple create mode 120000 Lang/Swift/Levenshtein-distance create mode 120000 Lang/Swift/Linear-congruential-generator create mode 120000 Lang/Swift/Literals-Floating-point create mode 120000 Lang/Swift/Literals-Integer create mode 120000 Lang/Swift/Literals-String create mode 120000 Lang/Swift/Logical-operations create mode 120000 Lang/Swift/Longest-common-subsequence create mode 120000 Lang/Swift/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/Swift/Loops-Break create mode 120000 Lang/Swift/Loops-Continue create mode 120000 Lang/Swift/Loops-Do-while create mode 120000 Lang/Swift/Loops-Downward-for create mode 120000 Lang/Swift/Loops-For create mode 120000 Lang/Swift/Loops-For-with-a-specified-step create mode 120000 Lang/Swift/Loops-Foreach create mode 120000 Lang/Swift/Loops-Infinite create mode 120000 Lang/Swift/Loops-N-plus-one-half create mode 120000 Lang/Swift/Loops-Nested create mode 120000 Lang/Swift/Loops-While create mode 120000 Lang/Swift/Luhn-test-of-credit-card-numbers create mode 120000 Lang/Swift/MD5-Implementation create mode 120000 Lang/Swift/Man-or-boy-test create mode 120000 Lang/Swift/Maze-generation create mode 120000 Lang/Swift/Monte-Carlo-methods create mode 120000 Lang/Swift/Multiple-distinct-objects create mode 120000 Lang/Swift/Mutual-recursion create mode 120000 Lang/Swift/Named-parameters create mode 120000 Lang/Swift/Non-decimal-radices-Convert create mode 120000 Lang/Swift/Nth create mode 120000 Lang/Swift/Null-object create mode 120000 Lang/Swift/One-of-n-lines-in-a-file create mode 120000 Lang/Swift/Optional-parameters create mode 120000 Lang/Swift/Order-two-numerical-lists create mode 120000 Lang/Swift/Ordered-words create mode 120000 Lang/Swift/Palindrome-detection create mode 120000 Lang/Swift/Pangram-checker create mode 120000 Lang/Swift/Parametric-polymorphism create mode 120000 Lang/Swift/Parsing-RPN-calculator-algorithm create mode 120000 Lang/Swift/Parsing-Shunting-yard-algorithm create mode 120000 Lang/Swift/Pattern-matching create mode 120000 Lang/Swift/Perfect-numbers create mode 120000 Lang/Swift/Permutations create mode 120000 Lang/Swift/Pick-random-element create mode 120000 Lang/Swift/Play-recorded-sounds create mode 120000 Lang/Swift/Playing-cards create mode 120000 Lang/Swift/Polymorphic-copy create mode 120000 Lang/Swift/Polymorphism create mode 120000 Lang/Swift/Primality-by-trial-division create mode 120000 Lang/Swift/Priority-queue create mode 120000 Lang/Swift/Problem-of-Apollonius create mode 120000 Lang/Swift/Pythagorean-triples create mode 120000 Lang/Swift/Quickselect-algorithm create mode 120000 Lang/Swift/Quine create mode 100644 Lang/Swift/README create mode 120000 Lang/Swift/RIPEMD-160 create mode 120000 Lang/Swift/Range-extraction create mode 120000 Lang/Swift/Read-entire-file create mode 120000 Lang/Swift/Real-constants-and-functions create mode 120000 Lang/Swift/Reduced-row-echelon-form create mode 120000 Lang/Swift/Regular-expressions create mode 120000 Lang/Swift/Remove-duplicate-elements create mode 120000 Lang/Swift/Repeat-a-string create mode 120000 Lang/Swift/Return-multiple-values create mode 120000 Lang/Swift/Reverse-a-string create mode 120000 Lang/Swift/Reverse-words-in-a-string create mode 120000 Lang/Swift/Roman-numerals-Decode create mode 120000 Lang/Swift/Roman-numerals-Encode create mode 120000 Lang/Swift/Rot-13 create mode 120000 Lang/Swift/Run-length-encoding create mode 120000 Lang/Swift/Runge-Kutta-method create mode 120000 Lang/Swift/Search-a-list create mode 120000 Lang/Swift/Semiprime create mode 120000 Lang/Swift/Sequence-of-primes-by-Trial-Division create mode 120000 Lang/Swift/Set create mode 120000 Lang/Swift/Short-circuit-evaluation create mode 120000 Lang/Swift/Sierpinski-carpet create mode 120000 Lang/Swift/Sierpinski-triangle create mode 120000 Lang/Swift/Sieve-of-Eratosthenes create mode 120000 Lang/Swift/Sleep create mode 120000 Lang/Swift/Sort-an-integer-array create mode 120000 Lang/Swift/Sort-disjoint-sublist create mode 120000 Lang/Swift/Sort-using-a-custom-comparator create mode 120000 Lang/Swift/Sorting-algorithms-Bogosort create mode 120000 Lang/Swift/Sorting-algorithms-Bubble-sort create mode 120000 Lang/Swift/Sorting-algorithms-Comb-sort create mode 120000 Lang/Swift/Sorting-algorithms-Heapsort create mode 120000 Lang/Swift/Sorting-algorithms-Insertion-sort create mode 120000 Lang/Swift/Sorting-algorithms-Merge-sort create mode 120000 Lang/Swift/Sorting-algorithms-Pancake-sort create mode 120000 Lang/Swift/Sorting-algorithms-Quicksort create mode 120000 Lang/Swift/Sorting-algorithms-Selection-sort create mode 120000 Lang/Swift/Sorting-algorithms-Shell-sort create mode 120000 Lang/Swift/Sorting-algorithms-Sleep-sort create mode 120000 Lang/Swift/Sorting-algorithms-Stooge-sort create mode 120000 Lang/Swift/Speech-synthesis create mode 120000 Lang/Swift/Stable-marriage-problem create mode 120000 Lang/Swift/Stack create mode 120000 Lang/Swift/Stair-climbing-puzzle create mode 120000 Lang/Swift/String-append create mode 120000 Lang/Swift/String-case create mode 120000 Lang/Swift/String-comparison create mode 120000 Lang/Swift/String-concatenation create mode 120000 Lang/Swift/String-interpolation--included- create mode 120000 Lang/Swift/String-length create mode 120000 Lang/Swift/String-matching create mode 120000 Lang/Swift/String-prepend create mode 120000 Lang/Swift/Strip-a-set-of-characters-from-a-string create mode 120000 Lang/Swift/Substring create mode 120000 Lang/Swift/Substring-Top-and-tail create mode 120000 Lang/Swift/Sudoku create mode 120000 Lang/Swift/Sum-and-product-of-an-array create mode 120000 Lang/Swift/Sum-digits-of-an-integer create mode 120000 Lang/Swift/Sum-of-a-series create mode 120000 Lang/Swift/Sum-of-squares create mode 120000 Lang/Swift/Symmetric-difference create mode 120000 Lang/Swift/Synchronous-concurrency create mode 120000 Lang/Swift/System-time create mode 120000 Lang/Swift/Take-notes-on-the-command-line create mode 120000 Lang/Swift/Test-a-function create mode 120000 Lang/Swift/The-Twelve-Days-of-Christmas create mode 120000 Lang/Swift/Tokenize-a-string create mode 120000 Lang/Swift/Towers-of-Hanoi create mode 120000 Lang/Swift/Trabb-Pardo-Knuth-algorithm create mode 120000 Lang/Swift/Twelve-statements create mode 120000 Lang/Swift/URL-decoding create mode 120000 Lang/Swift/Unicode-variable-names create mode 120000 Lang/Swift/User-input-Text create mode 120000 Lang/Swift/Variable-size-Get create mode 120000 Lang/Swift/Variables create mode 120000 Lang/Swift/Variadic-function create mode 120000 Lang/Swift/Walk-a-directory-Recursively create mode 120000 Lang/Swift/Y-combinator create mode 120000 Lang/Swift/Zero-to-the-zero-power create mode 100644 Lang/Symsyn/00DESCRIPTION create mode 120000 Lang/Symsyn/99-Bottles-of-Beer create mode 120000 Lang/Symsyn/Empty-program create mode 120000 Lang/Symsyn/Even-or-odd create mode 120000 Lang/Symsyn/FizzBuzz create mode 120000 Lang/Symsyn/Hello-world-Text create mode 120000 Lang/Symsyn/Pernicious-numbers create mode 100644 Lang/Symsyn/README create mode 120000 Lang/Symsyn/Sockets create mode 120000 Lang/Symsyn/Trabb-Pardo-Knuth-algorithm create mode 100644 Lang/TI-83-Hex-Assembly/00DESCRIPTION create mode 120000 Lang/TI-83-Hex-Assembly/A+B create mode 120000 Lang/TI-83-Hex-Assembly/Empty-program create mode 120000 Lang/TI-83-Hex-Assembly/Hello-world-Newbie create mode 100644 Lang/TI-83-Hex-Assembly/README create mode 100644 Lang/Terra/00DESCRIPTION create mode 120000 Lang/Terra/Hello-world-Text create mode 100644 Lang/Terra/README create mode 100644 Lang/TestML/00DESCRIPTION create mode 120000 Lang/TestML/Hello-world-Text create mode 100644 Lang/TestML/README create mode 100644 Lang/ToffeeScript/00DESCRIPTION create mode 100644 Lang/ToffeeScript/README create mode 120000 Lang/ToffeeScript/Simple-database create mode 120000 Lang/ToffeeScript/Web-scraping create mode 100644 Lang/TypeScript/00DESCRIPTION create mode 120000 Lang/TypeScript/Caesar-cipher create mode 120000 Lang/TypeScript/Fractal-tree create mode 120000 Lang/TypeScript/Greatest-common-divisor create mode 120000 Lang/TypeScript/Loops-For create mode 100644 Lang/TypeScript/README create mode 120000 Lang/TypeScript/Vigen-re-cipher create mode 100644 Lang/Uniface/00DESCRIPTION create mode 120000 Lang/Uniface/100-doors create mode 120000 Lang/Uniface/Hello-world-Text create mode 120000 Lang/Uniface/Loops-While create mode 100644 Lang/Uniface/README create mode 120000 Lang/Uniface/SOAP create mode 100644 Lang/Ursa/00DESCRIPTION create mode 120000 Lang/Ursa/100-doors create mode 120000 Lang/Ursa/99-Bottles-of-Beer create mode 120000 Lang/Ursa/A+B create mode 120000 Lang/Ursa/Append-a-record-to-the-end-of-a-text-file create mode 120000 Lang/Ursa/Arbitrary-precision-integers--included- create mode 120000 Lang/Ursa/Arithmetic-Integer create mode 120000 Lang/Ursa/Array-concatenation create mode 120000 Lang/Ursa/Averages-Arithmetic-mean create mode 120000 Lang/Ursa/Boolean-values create mode 120000 Lang/Ursa/CSV-data-manipulation create mode 120000 Lang/Ursa/Caesar-cipher create mode 120000 Lang/Ursa/Call-an-object-method create mode 120000 Lang/Ursa/Case-sensitivity-of-identifiers create mode 120000 Lang/Ursa/Character-codes create mode 120000 Lang/Ursa/Check-that-file-exists create mode 120000 Lang/Ursa/Command-line-arguments create mode 120000 Lang/Ursa/Comments create mode 120000 Lang/Ursa/Copy-a-string create mode 120000 Lang/Ursa/Create-a-file create mode 120000 Lang/Ursa/Create-a-two-dimensional-array-at-runtime create mode 120000 Lang/Ursa/Create-an-HTML-table create mode 120000 Lang/Ursa/Date-format create mode 120000 Lang/Ursa/Delete-a-file create mode 120000 Lang/Ursa/Detect-division-by-zero create mode 120000 Lang/Ursa/Determine-if-a-string-is-numeric create mode 120000 Lang/Ursa/Empty-program create mode 120000 Lang/Ursa/Empty-string create mode 120000 Lang/Ursa/Environment-variables create mode 120000 Lang/Ursa/Even-or-odd create mode 120000 Lang/Ursa/Exceptions create mode 120000 Lang/Ursa/Execute-a-system-command create mode 120000 Lang/Ursa/Exponentiation-operator create mode 120000 Lang/Ursa/Factorial create mode 120000 Lang/Ursa/Factors-of-an-integer create mode 120000 Lang/Ursa/Fibonacci-sequence create mode 120000 Lang/Ursa/File-input-output create mode 120000 Lang/Ursa/File-modification-time create mode 120000 Lang/Ursa/File-size create mode 120000 Lang/Ursa/Find-limit-of-recursion create mode 120000 Lang/Ursa/FizzBuzz create mode 120000 Lang/Ursa/Function-definition create mode 120000 Lang/Ursa/Generate-lower-case-ASCII-alphabet create mode 120000 Lang/Ursa/Greatest-common-divisor create mode 120000 Lang/Ursa/Greatest-element-of-a-list create mode 120000 Lang/Ursa/Guess-the-number create mode 120000 Lang/Ursa/Guess-the-number-With-feedback create mode 120000 Lang/Ursa/Hailstone-sequence create mode 120000 Lang/Ursa/Hello-world-Newline-omission create mode 120000 Lang/Ursa/Hello-world-Standard-error create mode 120000 Lang/Ursa/Hello-world-Text create mode 120000 Lang/Ursa/Higher-order-functions create mode 120000 Lang/Ursa/Hostname create mode 120000 Lang/Ursa/Include-a-file create mode 120000 Lang/Ursa/Increment-a-numerical-string create mode 120000 Lang/Ursa/Infinity create mode 120000 Lang/Ursa/Input-loop create mode 120000 Lang/Ursa/Integer-comparison create mode 120000 Lang/Ursa/Integer-sequence create mode 120000 Lang/Ursa/Interactive-programming create mode 120000 Lang/Ursa/Leap-year create mode 120000 Lang/Ursa/Least-common-multiple create mode 120000 Lang/Ursa/Literals-Floating-point create mode 120000 Lang/Ursa/Literals-Integer create mode 120000 Lang/Ursa/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/Ursa/Loops-Break create mode 120000 Lang/Ursa/Loops-Continue create mode 120000 Lang/Ursa/Loops-Downward-for create mode 120000 Lang/Ursa/Loops-For create mode 120000 Lang/Ursa/Loops-For-with-a-specified-step create mode 120000 Lang/Ursa/Loops-Infinite create mode 120000 Lang/Ursa/Loops-N-plus-one-half create mode 120000 Lang/Ursa/Loops-While create mode 120000 Lang/Ursa/Menu create mode 120000 Lang/Ursa/Morse-code create mode 120000 Lang/Ursa/Null-object create mode 120000 Lang/Ursa/Old-lady-swallowed-a-fly create mode 120000 Lang/Ursa/Pick-random-element create mode 120000 Lang/Ursa/Program-termination create mode 100644 Lang/Ursa/README create mode 120000 Lang/Ursa/Read-a-file-line-by-line create mode 120000 Lang/Ursa/Read-a-specific-line-from-a-file create mode 120000 Lang/Ursa/Read-entire-file create mode 120000 Lang/Ursa/Return-multiple-values create mode 120000 Lang/Ursa/Runtime-evaluation create mode 120000 Lang/Ursa/Sleep create mode 120000 Lang/Ursa/Sort-an-integer-array create mode 120000 Lang/Ursa/Special-variables create mode 120000 Lang/Ursa/String-append create mode 120000 Lang/Ursa/String-case create mode 120000 Lang/Ursa/String-concatenation create mode 120000 Lang/Ursa/String-prepend create mode 120000 Lang/Ursa/Sum-and-product-of-an-array create mode 120000 Lang/Ursa/Sum-digits-of-an-integer create mode 120000 Lang/Ursa/System-time create mode 120000 Lang/Ursa/Temperature-conversion create mode 120000 Lang/Ursa/Tokenize-a-string create mode 120000 Lang/Ursa/Unix-ls create mode 120000 Lang/Ursa/User-input-Text create mode 120000 Lang/Ursa/Variables create mode 120000 Lang/Ursa/Zero-to-the-zero-power create mode 100644 Lang/VAX-Assembly/00DESCRIPTION create mode 100644 Lang/VAX-Assembly/README create mode 100644 Lang/Visual-FoxPro/00DESCRIPTION create mode 120000 Lang/Visual-FoxPro/Associative-array-Creation create mode 120000 Lang/Visual-FoxPro/Benfords-law create mode 120000 Lang/Visual-FoxPro/Binary-digits create mode 120000 Lang/Visual-FoxPro/CSV-data-manipulation create mode 120000 Lang/Visual-FoxPro/Circles-of-given-radius-through-two-points create mode 120000 Lang/Visual-FoxPro/Classes create mode 120000 Lang/Visual-FoxPro/Closest-pair-problem create mode 120000 Lang/Visual-FoxPro/Collections create mode 120000 Lang/Visual-FoxPro/Define-a-primitive-data-type create mode 120000 Lang/Visual-FoxPro/Dutch-national-flag-problem create mode 120000 Lang/Visual-FoxPro/Forward-difference create mode 120000 Lang/Visual-FoxPro/Gamma-function create mode 120000 Lang/Visual-FoxPro/Generic-swap create mode 120000 Lang/Visual-FoxPro/Handle-a-signal create mode 120000 Lang/Visual-FoxPro/Harshad-or-Niven-series create mode 120000 Lang/Visual-FoxPro/Hash-join create mode 120000 Lang/Visual-FoxPro/Hello-world-Graphical create mode 120000 Lang/Visual-FoxPro/Hofstadter-Q-sequence create mode 120000 Lang/Visual-FoxPro/Horners-rule-for-polynomial-evaluation create mode 120000 Lang/Visual-FoxPro/Last-Friday-of-each-month create mode 120000 Lang/Visual-FoxPro/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/Visual-FoxPro/Matrix-multiplication create mode 100644 Lang/Visual-FoxPro/README create mode 120000 Lang/Visual-FoxPro/Random-numbers create mode 120000 Lang/Visual-FoxPro/Ranking-methods create mode 120000 Lang/Visual-FoxPro/Reduced-row-echelon-form create mode 120000 Lang/Visual-FoxPro/Remove-duplicate-elements create mode 120000 Lang/Visual-FoxPro/Repeat-a-string create mode 120000 Lang/Visual-FoxPro/Return-multiple-values create mode 120000 Lang/Visual-FoxPro/SEDOLs create mode 120000 Lang/Visual-FoxPro/Short-circuit-evaluation create mode 120000 Lang/Visual-FoxPro/Table-creation-Postal-addresses create mode 120000 Lang/Visual-FoxPro/Temperature-conversion create mode 100644 Lang/Wart/00DESCRIPTION create mode 120000 Lang/Wart/100-doors create mode 120000 Lang/Wart/Accumulator-factory create mode 120000 Lang/Wart/Ackermann-function create mode 120000 Lang/Wart/Address-of-a-variable create mode 120000 Lang/Wart/Anonymous-recursion create mode 120000 Lang/Wart/Apply-a-callback-to-an-array create mode 120000 Lang/Wart/Arithmetic-Integer create mode 120000 Lang/Wart/Array-concatenation create mode 120000 Lang/Wart/Associative-array-Creation create mode 120000 Lang/Wart/Associative-array-Iteration create mode 120000 Lang/Wart/Averages-Arithmetic-mean create mode 120000 Lang/Wart/Bitmap-Bresenhams-line-algorithm create mode 120000 Lang/Wart/Comments create mode 120000 Lang/Wart/Dot-product create mode 120000 Lang/Wart/Execute-a-system-command create mode 120000 Lang/Wart/Factorial create mode 120000 Lang/Wart/Fibonacci-sequence create mode 120000 Lang/Wart/File-input-output create mode 120000 Lang/Wart/FizzBuzz create mode 120000 Lang/Wart/Flatten-a-list create mode 120000 Lang/Wart/Fork create mode 120000 Lang/Wart/Function-definition create mode 120000 Lang/Wart/Generic-swap create mode 120000 Lang/Wart/Greatest-element-of-a-list create mode 120000 Lang/Wart/Hello-world-Text create mode 120000 Lang/Wart/Hello-world-Web-server create mode 120000 Lang/Wart/Integer-comparison create mode 120000 Lang/Wart/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/Wart/Loops-Downward-for create mode 120000 Lang/Wart/Loops-For create mode 120000 Lang/Wart/Loops-For-with-a-specified-step create mode 120000 Lang/Wart/Loops-Foreach create mode 120000 Lang/Wart/Loops-Infinite create mode 120000 Lang/Wart/Loops-N-plus-one-half create mode 120000 Lang/Wart/Loops-While create mode 120000 Lang/Wart/Middle-three-digits create mode 120000 Lang/Wart/Null-object create mode 120000 Lang/Wart/One-dimensional-cellular-automata create mode 120000 Lang/Wart/Order-two-numerical-lists create mode 120000 Lang/Wart/Queue-Definition create mode 100644 Lang/Wart/README create mode 120000 Lang/Wart/Read-a-file-line-by-line create mode 120000 Lang/Wart/Read-entire-file create mode 120000 Lang/Wart/Remove-duplicate-elements create mode 120000 Lang/Wart/Repeat-a-string create mode 120000 Lang/Wart/Reverse-a-string create mode 120000 Lang/Wart/Rot-13 create mode 120000 Lang/Wart/Search-a-list create mode 120000 Lang/Wart/Shell-one-liner create mode 120000 Lang/Wart/Singly-linked-list-Traversal create mode 120000 Lang/Wart/Sorting-algorithms-Quicksort create mode 120000 Lang/Wart/Stack create mode 120000 Lang/Wart/String-append create mode 120000 Lang/Wart/String-prepend create mode 120000 Lang/Wart/Substring create mode 120000 Lang/Wart/Sum-and-product-of-an-array create mode 120000 Lang/Wart/Time-a-function create mode 120000 Lang/Wart/Y-combinator create mode 100644 Lang/Wolfram-Language/00DESCRIPTION create mode 120000 Lang/Wolfram-Language/Hello-world-Text create mode 100644 Lang/Wolfram-Language/README create mode 100644 Lang/Wollok/00DESCRIPTION create mode 120000 Lang/Wollok/Polymorphism create mode 100644 Lang/Wollok/README create mode 100644 Lang/Wortel/00DESCRIPTION create mode 120000 Lang/Wortel/100-doors create mode 120000 Lang/Wortel/99-Bottles-of-Beer create mode 120000 Lang/Wortel/Arithmetic-Complex create mode 120000 Lang/Wortel/Averages-Arithmetic-mean create mode 120000 Lang/Wortel/Averages-Median create mode 120000 Lang/Wortel/Averages-Root-mean-square create mode 120000 Lang/Wortel/Binary-digits create mode 120000 Lang/Wortel/Binary-search create mode 120000 Lang/Wortel/Caesar-cipher create mode 120000 Lang/Wortel/Catalan-numbers create mode 120000 Lang/Wortel/Catamorphism create mode 120000 Lang/Wortel/Conways-Game-of-Life create mode 120000 Lang/Wortel/Count-occurrences-of-a-substring create mode 120000 Lang/Wortel/Currying create mode 120000 Lang/Wortel/Day-of-the-week create mode 120000 Lang/Wortel/Digital-root create mode 120000 Lang/Wortel/Factorial create mode 120000 Lang/Wortel/Factors-of-an-integer create mode 120000 Lang/Wortel/FizzBuzz create mode 120000 Lang/Wortel/Function-composition create mode 120000 Lang/Wortel/Greatest-common-divisor create mode 120000 Lang/Wortel/Greatest-element-of-a-list create mode 120000 Lang/Wortel/Guess-the-number create mode 120000 Lang/Wortel/Hash-from-two-arrays create mode 120000 Lang/Wortel/Identity-matrix create mode 120000 Lang/Wortel/Inverted-syntax create mode 120000 Lang/Wortel/Kaprekar-numbers create mode 120000 Lang/Wortel/Leap-year create mode 120000 Lang/Wortel/Least-common-multiple create mode 120000 Lang/Wortel/Matrix-transposition create mode 120000 Lang/Wortel/Multifactorial create mode 120000 Lang/Wortel/Palindrome-detection create mode 120000 Lang/Wortel/Pernicious-numbers create mode 100644 Lang/Wortel/README create mode 120000 Lang/Wortel/Remove-duplicate-elements create mode 120000 Lang/Wortel/Repeat-a-string create mode 120000 Lang/Wortel/Reverse-a-string create mode 120000 Lang/Wortel/Sort-an-integer-array create mode 120000 Lang/Wortel/Sum-and-product-of-an-array create mode 120000 Lang/Wortel/Sum-multiples-of-3-and-5 create mode 120000 Lang/Wortel/Sum-of-a-series create mode 120000 Lang/Wortel/Sum-of-squares create mode 120000 Lang/Wortel/Tokenize-a-string create mode 120000 Lang/Wortel/Vector-products create mode 100644 Lang/Wren/00DESCRIPTION create mode 120000 Lang/Wren/100-doors create mode 120000 Lang/Wren/99-Bottles-of-Beer create mode 120000 Lang/Wren/A+B create mode 120000 Lang/Wren/Ackermann-function create mode 120000 Lang/Wren/Anonymous-recursion create mode 120000 Lang/Wren/Apply-a-callback-to-an-array create mode 120000 Lang/Wren/Arithmetic-Integer create mode 120000 Lang/Wren/Array-concatenation create mode 120000 Lang/Wren/Arrays create mode 120000 Lang/Wren/Averages-Arithmetic-mean create mode 120000 Lang/Wren/Averages-Mode create mode 120000 Lang/Wren/Collections create mode 120000 Lang/Wren/Hello-world-Newline-omission create mode 120000 Lang/Wren/Hello-world-Text create mode 100644 Lang/Wren/README create mode 120000 Lang/Wren/String-length create mode 100644 Lang/XEec/00DESCRIPTION create mode 100644 Lang/XEec/README create mode 100644 Lang/XLISP/00DESCRIPTION create mode 120000 Lang/XLISP/A+B create mode 120000 Lang/XLISP/Ackermann-function create mode 120000 Lang/XLISP/Arithmetic-Integer create mode 120000 Lang/XLISP/Arrays create mode 120000 Lang/XLISP/Associative-array-Creation create mode 120000 Lang/XLISP/Averages-Arithmetic-mean create mode 120000 Lang/XLISP/Averages-Root-mean-square create mode 120000 Lang/XLISP/Caesar-cipher create mode 120000 Lang/XLISP/Calendar create mode 120000 Lang/XLISP/Calendar---for-REAL-programmers create mode 120000 Lang/XLISP/Call-a-function create mode 120000 Lang/XLISP/Call-an-object-method create mode 120000 Lang/XLISP/Case-sensitivity-of-identifiers create mode 120000 Lang/XLISP/Character-codes create mode 120000 Lang/XLISP/Classes create mode 120000 Lang/XLISP/Comma-quibbling create mode 120000 Lang/XLISP/Comments create mode 120000 Lang/XLISP/Compile-time-calculation create mode 120000 Lang/XLISP/Determine-if-a-string-is-numeric create mode 120000 Lang/XLISP/Fibonacci-sequence create mode 120000 Lang/XLISP/FizzBuzz create mode 120000 Lang/XLISP/Function-definition create mode 120000 Lang/XLISP/Generate-lower-case-ASCII-alphabet create mode 120000 Lang/XLISP/Guess-the-number create mode 120000 Lang/XLISP/Guess-the-number-With-feedback create mode 120000 Lang/XLISP/Hello-world-Newline-omission create mode 120000 Lang/XLISP/Hello-world-Standard-error create mode 120000 Lang/XLISP/Hello-world-Text create mode 120000 Lang/XLISP/Increment-a-numerical-string create mode 120000 Lang/XLISP/Inheritance-Single create mode 120000 Lang/XLISP/Integer-comparison create mode 120000 Lang/XLISP/Interactive-programming create mode 120000 Lang/XLISP/Leap-year create mode 120000 Lang/XLISP/Logical-operations create mode 120000 Lang/XLISP/Loops-For create mode 120000 Lang/XLISP/Loops-Foreach create mode 120000 Lang/XLISP/Loops-While create mode 120000 Lang/XLISP/Nth create mode 120000 Lang/XLISP/Queue-Definition create mode 100644 Lang/XLISP/README create mode 120000 Lang/XLISP/Roman-numerals-Decode create mode 120000 Lang/XLISP/Roman-numerals-Encode create mode 120000 Lang/XLISP/Sequence-of-non-squares create mode 120000 Lang/XLISP/Special-variables create mode 120000 Lang/XLISP/Stack create mode 120000 Lang/XLISP/Sum-of-squares create mode 120000 Lang/XLISP/Temperature-conversion create mode 120000 Lang/XLISP/Variadic-function create mode 120000 Lang/XLISP/Zero-to-the-zero-power create mode 100644 Lang/XPath-2.0/00DESCRIPTION create mode 120000 Lang/XPath-2.0/FizzBuzz create mode 100644 Lang/XPath-2.0/README create mode 100644 Lang/Xojo/00DESCRIPTION create mode 120000 Lang/Xojo/99-Bottles-of-Beer create mode 120000 Lang/Xojo/Luhn-test-of-credit-card-numbers create mode 100644 Lang/Xojo/README create mode 100644 Lang/Ya/00DESCRIPTION create mode 120000 Lang/Ya/Balanced-brackets create mode 100644 Lang/Ya/README create mode 100644 Lang/Zkl/00DESCRIPTION create mode 100644 Lang/Zkl/README create mode 100644 Lang/jq/00DESCRIPTION create mode 120000 Lang/jq/100-doors create mode 120000 Lang/jq/24-game-Solve create mode 120000 Lang/jq/99-Bottles-of-Beer create mode 120000 Lang/jq/A+B create mode 120000 Lang/jq/ABC-Problem create mode 120000 Lang/jq/AKS-test-for-primes create mode 120000 Lang/jq/Abundant,-deficient-and-perfect-number-classifications create mode 120000 Lang/jq/Ackermann-function create mode 120000 Lang/jq/Add-a-variable-to-a-class-instance-at-runtime create mode 120000 Lang/jq/Align-columns create mode 120000 Lang/jq/Aliquot-sequence-classifications create mode 120000 Lang/jq/Almost-prime create mode 120000 Lang/jq/Amb create mode 120000 Lang/jq/Amicable-pairs create mode 120000 Lang/jq/Anagrams create mode 120000 Lang/jq/Anonymous-recursion create mode 120000 Lang/jq/Apply-a-callback-to-an-array create mode 120000 Lang/jq/Arithmetic-Complex create mode 120000 Lang/jq/Arithmetic-Integer create mode 120000 Lang/jq/Arithmetic-geometric-mean create mode 120000 Lang/jq/Array-concatenation create mode 120000 Lang/jq/Arrays create mode 120000 Lang/jq/Associative-array-Creation create mode 120000 Lang/jq/Averages-Arithmetic-mean create mode 120000 Lang/jq/Averages-Mean-angle create mode 120000 Lang/jq/Averages-Mean-time-of-day create mode 120000 Lang/jq/Averages-Median create mode 120000 Lang/jq/Averages-Mode create mode 120000 Lang/jq/Averages-Pythagorean-means create mode 120000 Lang/jq/Averages-Root-mean-square create mode 120000 Lang/jq/Benfords-law create mode 120000 Lang/jq/Bernoulli-numbers create mode 120000 Lang/jq/Binary-digits create mode 120000 Lang/jq/Binary-search create mode 120000 Lang/jq/Binary-strings create mode 120000 Lang/jq/CSV-data-manipulation create mode 120000 Lang/jq/CSV-to-HTML-translation create mode 120000 Lang/jq/Case-sensitivity-of-identifiers create mode 120000 Lang/jq/Casting-out-nines create mode 120000 Lang/jq/Catalan-numbers create mode 120000 Lang/jq/Catalan-numbers-Pascals-triangle create mode 120000 Lang/jq/Character-codes create mode 120000 Lang/jq/Chinese-remainder-theorem create mode 120000 Lang/jq/Cholesky-decomposition create mode 120000 Lang/jq/Circles-of-given-radius-through-two-points create mode 120000 Lang/jq/Closest-pair-problem create mode 120000 Lang/jq/Collections create mode 120000 Lang/jq/Combinations create mode 120000 Lang/jq/Combinations-and-permutations create mode 120000 Lang/jq/Combinations-with-repetitions create mode 120000 Lang/jq/Comma-quibbling create mode 120000 Lang/jq/Comments create mode 120000 Lang/jq/Compound-data-type create mode 120000 Lang/jq/Conditional-structures create mode 120000 Lang/jq/Conjugate-transpose create mode 120000 Lang/jq/Continued-fraction create mode 120000 Lang/jq/Conways-Game-of-Life create mode 120000 Lang/jq/Copy-a-string create mode 120000 Lang/jq/Count-occurrences-of-a-substring create mode 120000 Lang/jq/Count-the-coins create mode 120000 Lang/jq/Create-a-two-dimensional-array-at-runtime create mode 120000 Lang/jq/Create-an-HTML-table create mode 120000 Lang/jq/Currying create mode 120000 Lang/jq/Date-format create mode 120000 Lang/jq/Date-manipulation create mode 120000 Lang/jq/Day-of-the-week create mode 120000 Lang/jq/Define-a-primitive-data-type create mode 120000 Lang/jq/Detect-division-by-zero create mode 120000 Lang/jq/Determine-if-a-string-is-numeric create mode 120000 Lang/jq/Digital-root create mode 120000 Lang/jq/Digital-root-Multiplicative-digital-root create mode 120000 Lang/jq/Dinesmans-multiple-dwelling-problem create mode 120000 Lang/jq/Dot-product create mode 120000 Lang/jq/Dragon-curve create mode 120000 Lang/jq/Draw-a-sphere create mode 120000 Lang/jq/Element-wise-operations create mode 120000 Lang/jq/Empty-string create mode 120000 Lang/jq/Enforced-immutability create mode 120000 Lang/jq/Entropy create mode 120000 Lang/jq/Enumerations create mode 120000 Lang/jq/Environment-variables create mode 120000 Lang/jq/Equilibrium-index create mode 120000 Lang/jq/Euler-method create mode 120000 Lang/jq/Evaluate-binomial-coefficients create mode 120000 Lang/jq/Even-or-odd create mode 120000 Lang/jq/Exceptions create mode 120000 Lang/jq/Exceptions-Catch-an-exception-thrown-in-a-nested-call create mode 120000 Lang/jq/Exponentiation-operator create mode 120000 Lang/jq/Extensible-prime-generator create mode 120000 Lang/jq/Extreme-floating-point-values create mode 120000 Lang/jq/Factorial create mode 120000 Lang/jq/Factors-of-an-integer create mode 120000 Lang/jq/Fast-Fourier-transform create mode 120000 Lang/jq/Fibonacci-n-step-number-sequences create mode 120000 Lang/jq/Fibonacci-sequence create mode 120000 Lang/jq/Fibonacci-word create mode 120000 Lang/jq/File-input-output create mode 120000 Lang/jq/File-size create mode 120000 Lang/jq/Filter create mode 120000 Lang/jq/Find-common-directory-path create mode 120000 Lang/jq/Find-limit-of-recursion create mode 120000 Lang/jq/Find-the-last-Sunday-of-each-month create mode 120000 Lang/jq/Find-the-missing-permutation create mode 120000 Lang/jq/First-class-functions-Use-numbers-analogously create mode 120000 Lang/jq/Five-weekends create mode 120000 Lang/jq/FizzBuzz create mode 120000 Lang/jq/Flatten-a-list create mode 120000 Lang/jq/Floyds-triangle create mode 120000 Lang/jq/Formal-power-series create mode 120000 Lang/jq/Formatted-numeric-output create mode 120000 Lang/jq/Forward-difference create mode 120000 Lang/jq/Four-bit-adder create mode 120000 Lang/jq/Fractal-tree create mode 120000 Lang/jq/Function-composition create mode 120000 Lang/jq/Function-definition create mode 120000 Lang/jq/Gamma-function create mode 120000 Lang/jq/Generate-lower-case-ASCII-alphabet create mode 120000 Lang/jq/Generator-Exponential create mode 120000 Lang/jq/Generic-swap create mode 120000 Lang/jq/Greatest-common-divisor create mode 120000 Lang/jq/Greatest-element-of-a-list create mode 120000 Lang/jq/Greatest-subsequential-sum create mode 120000 Lang/jq/Hailstone-sequence create mode 120000 Lang/jq/Hamming-numbers create mode 120000 Lang/jq/Happy-numbers create mode 120000 Lang/jq/Harshad-or-Niven-series create mode 120000 Lang/jq/Hash-from-two-arrays create mode 120000 Lang/jq/Hash-join create mode 120000 Lang/jq/Haversine-formula create mode 120000 Lang/jq/Hello-world-Graphical create mode 120000 Lang/jq/Hello-world-Newbie create mode 120000 Lang/jq/Hello-world-Newline-omission create mode 120000 Lang/jq/Hello-world-Standard-error create mode 120000 Lang/jq/Hello-world-Text create mode 120000 Lang/jq/Here-document create mode 120000 Lang/jq/Heronian-triangles create mode 120000 Lang/jq/Hickerson-series-of-almost-integers create mode 120000 Lang/jq/Higher-order-functions create mode 120000 Lang/jq/Hofstadter-Q-sequence create mode 120000 Lang/jq/I-before-E-except-after-C create mode 120000 Lang/jq/IBAN create mode 120000 Lang/jq/Identity-matrix create mode 120000 Lang/jq/Include-a-file create mode 120000 Lang/jq/Increment-a-numerical-string create mode 120000 Lang/jq/Infinity create mode 120000 Lang/jq/Input-loop create mode 120000 Lang/jq/Integer-comparison create mode 120000 Lang/jq/Integer-sequence create mode 120000 Lang/jq/Inverted-index create mode 120000 Lang/jq/Inverted-syntax create mode 120000 Lang/jq/Iterated-digits-squaring create mode 120000 Lang/jq/JSON create mode 120000 Lang/jq/Jensens-Device create mode 120000 Lang/jq/Josephus-problem create mode 120000 Lang/jq/Jump-anywhere create mode 120000 Lang/jq/Kaprekar-numbers create mode 120000 Lang/jq/Knapsack-problem-0-1 create mode 120000 Lang/jq/Knapsack-problem-Continuous create mode 120000 Lang/jq/LU-decomposition create mode 120000 Lang/jq/LZW-compression create mode 120000 Lang/jq/Langtons-ant create mode 120000 Lang/jq/Largest-int-from-concatenated-ints create mode 120000 Lang/jq/Last-Friday-of-each-month create mode 120000 Lang/jq/Last-letter-first-letter create mode 120000 Lang/jq/Leap-year create mode 120000 Lang/jq/Least-common-multiple create mode 120000 Lang/jq/Left-factorials create mode 120000 Lang/jq/Letter-frequency create mode 120000 Lang/jq/Levenshtein-distance create mode 120000 Lang/jq/Linear-congruential-generator create mode 120000 Lang/jq/List-comprehensions create mode 120000 Lang/jq/Literals-Floating-point create mode 120000 Lang/jq/Logical-operations create mode 120000 Lang/jq/Long-multiplication create mode 120000 Lang/jq/Longest-common-subsequence create mode 120000 Lang/jq/Longest-increasing-subsequence create mode 120000 Lang/jq/Look-and-say-sequence create mode 120000 Lang/jq/Loop-over-multiple-arrays-simultaneously create mode 120000 Lang/jq/Loops-Continue create mode 120000 Lang/jq/Loops-Do-while create mode 120000 Lang/jq/Loops-Downward-for create mode 120000 Lang/jq/Loops-For create mode 120000 Lang/jq/Loops-For-with-a-specified-step create mode 120000 Lang/jq/Loops-Foreach create mode 120000 Lang/jq/Loops-Infinite create mode 120000 Lang/jq/Loops-N-plus-one-half create mode 120000 Lang/jq/Loops-While create mode 120000 Lang/jq/Luhn-test-of-credit-card-numbers create mode 120000 Lang/jq/Magic-squares-of-odd-order create mode 120000 Lang/jq/Mandelbrot-set create mode 120000 Lang/jq/Map-range create mode 120000 Lang/jq/Matrix-arithmetic create mode 120000 Lang/jq/Matrix-exponentiation-operator create mode 120000 Lang/jq/Matrix-multiplication create mode 120000 Lang/jq/Matrix-transposition create mode 120000 Lang/jq/Maximum-triangle-path-sum create mode 120000 Lang/jq/Menu create mode 120000 Lang/jq/Middle-three-digits create mode 120000 Lang/jq/Move-to-front-algorithm create mode 120000 Lang/jq/Multifactorial create mode 120000 Lang/jq/Multiple-distinct-objects create mode 120000 Lang/jq/Multisplit create mode 120000 Lang/jq/Munching-squares create mode 120000 Lang/jq/Mutual-recursion create mode 120000 Lang/jq/N-queens-problem create mode 120000 Lang/jq/Named-parameters create mode 120000 Lang/jq/Narcissistic-decimal-number create mode 120000 Lang/jq/Natural-sorting create mode 120000 Lang/jq/Non-continuous-subsequences create mode 120000 Lang/jq/Non-decimal-radices-Convert create mode 120000 Lang/jq/Nth create mode 120000 Lang/jq/Nth-root create mode 120000 Lang/jq/Null-object create mode 120000 Lang/jq/Number-names create mode 120000 Lang/jq/One-dimensional-cellular-automata create mode 120000 Lang/jq/Optional-parameters create mode 120000 Lang/jq/Order-disjoint-list-items create mode 120000 Lang/jq/Order-two-numerical-lists create mode 120000 Lang/jq/Ordered-Partitions create mode 120000 Lang/jq/Ordered-words create mode 120000 Lang/jq/Palindrome-detection create mode 120000 Lang/jq/Pangram-checker create mode 120000 Lang/jq/Paraffins create mode 120000 Lang/jq/Pascals-triangle create mode 120000 Lang/jq/Perfect-numbers create mode 120000 Lang/jq/Permutation-test create mode 120000 Lang/jq/Permutations create mode 120000 Lang/jq/Permutations-Derangements create mode 120000 Lang/jq/Permutations-by-swapping create mode 120000 Lang/jq/Pernicious-numbers create mode 120000 Lang/jq/Phrase-reversals create mode 120000 Lang/jq/Pi create mode 120000 Lang/jq/Plot-coordinate-pairs create mode 120000 Lang/jq/Power-set create mode 120000 Lang/jq/Price-fraction create mode 120000 Lang/jq/Prime-decomposition create mode 120000 Lang/jq/Priority-queue create mode 120000 Lang/jq/Problem-of-Apollonius create mode 120000 Lang/jq/Program-termination create mode 120000 Lang/jq/Pythagorean-triples create mode 120000 Lang/jq/Quaternion-type create mode 120000 Lang/jq/Queue-Definition create mode 120000 Lang/jq/Quickselect-algorithm create mode 100644 Lang/jq/README create mode 120000 Lang/jq/Random-numbers create mode 120000 Lang/jq/Range-expansion create mode 120000 Lang/jq/Range-extraction create mode 120000 Lang/jq/Ranking-methods create mode 120000 Lang/jq/Read-a-file-line-by-line create mode 120000 Lang/jq/Read-a-specific-line-from-a-file create mode 120000 Lang/jq/Read-entire-file create mode 120000 Lang/jq/Real-constants-and-functions create mode 120000 Lang/jq/Regular-expressions create mode 120000 Lang/jq/Remove-duplicate-elements create mode 120000 Lang/jq/Remove-lines-from-a-file create mode 120000 Lang/jq/Rep-string create mode 120000 Lang/jq/Repeat-a-string create mode 120000 Lang/jq/Return-multiple-values create mode 120000 Lang/jq/Reverse-a-string create mode 120000 Lang/jq/Reverse-words-in-a-string create mode 120000 Lang/jq/Roman-numerals-Decode create mode 120000 Lang/jq/Roots-of-a-function create mode 120000 Lang/jq/Roots-of-a-quadratic-function create mode 120000 Lang/jq/Roots-of-unity create mode 120000 Lang/jq/Rot-13 create mode 120000 Lang/jq/Run-length-encoding create mode 120000 Lang/jq/Runge-Kutta-method create mode 120000 Lang/jq/SEDOLs create mode 120000 Lang/jq/Same-Fringe create mode 120000 Lang/jq/Scope-Function-names-and-labels create mode 120000 Lang/jq/Search-a-list create mode 120000 Lang/jq/Self-describing-numbers create mode 120000 Lang/jq/Self-referential-sequence create mode 120000 Lang/jq/Semordnilap create mode 120000 Lang/jq/Sequence-of-non-squares create mode 120000 Lang/jq/Sequence-of-primes-by-Trial-Division create mode 120000 Lang/jq/Set create mode 120000 Lang/jq/Set-consolidation create mode 120000 Lang/jq/Shell-one-liner create mode 120000 Lang/jq/Short-circuit-evaluation create mode 120000 Lang/jq/Show-the-epoch create mode 120000 Lang/jq/Sierpinski-carpet create mode 120000 Lang/jq/Sieve-of-Eratosthenes create mode 120000 Lang/jq/Singly-linked-list-Traversal create mode 120000 Lang/jq/Solve-the-no-connection-puzzle create mode 120000 Lang/jq/Sort-an-array-of-composite-structures create mode 120000 Lang/jq/Sort-an-integer-array create mode 120000 Lang/jq/Sort-disjoint-sublist create mode 120000 Lang/jq/Sort-using-a-custom-comparator create mode 120000 Lang/jq/Sorting-algorithms-Bead-sort create mode 120000 Lang/jq/Sorting-algorithms-Bubble-sort create mode 120000 Lang/jq/Sorting-algorithms-Cocktail-sort create mode 120000 Lang/jq/Sorting-algorithms-Comb-sort create mode 120000 Lang/jq/Sorting-algorithms-Counting-sort create mode 120000 Lang/jq/Sorting-algorithms-Gnome-sort create mode 120000 Lang/jq/Sorting-algorithms-Insertion-sort create mode 120000 Lang/jq/Sorting-algorithms-Merge-sort create mode 120000 Lang/jq/Sorting-algorithms-Pancake-sort create mode 120000 Lang/jq/Sorting-algorithms-Permutation-sort create mode 120000 Lang/jq/Sorting-algorithms-Quicksort create mode 120000 Lang/jq/Sorting-algorithms-Radix-sort create mode 120000 Lang/jq/Sorting-algorithms-Selection-sort create mode 120000 Lang/jq/Sorting-algorithms-Shell-sort create mode 120000 Lang/jq/Sorting-algorithms-Sleep-sort create mode 120000 Lang/jq/Sorting-algorithms-Stooge-sort create mode 120000 Lang/jq/Sorting-algorithms-Strand-sort create mode 120000 Lang/jq/Sparkline-in-unicode create mode 120000 Lang/jq/Special-characters create mode 120000 Lang/jq/Special-variables create mode 120000 Lang/jq/Spiral-matrix create mode 120000 Lang/jq/Stair-climbing-puzzle create mode 120000 Lang/jq/State-name-puzzle create mode 120000 Lang/jq/Stem-and-leaf-plot create mode 120000 Lang/jq/Stern-Brocot-sequence create mode 120000 Lang/jq/String-append create mode 120000 Lang/jq/String-case create mode 120000 Lang/jq/String-comparison create mode 120000 Lang/jq/String-concatenation create mode 120000 Lang/jq/String-interpolation--included- create mode 120000 Lang/jq/String-length create mode 120000 Lang/jq/String-matching create mode 120000 Lang/jq/String-prepend create mode 120000 Lang/jq/Strip-a-set-of-characters-from-a-string create mode 120000 Lang/jq/Strip-block-comments create mode 120000 Lang/jq/Strip-comments-from-a-string create mode 120000 Lang/jq/Strip-control-codes-and-extended-characters-from-a-string create mode 120000 Lang/jq/Strip-whitespace-from-a-string-Top-and-tail create mode 120000 Lang/jq/Substring create mode 120000 Lang/jq/Substring-Top-and-tail create mode 120000 Lang/jq/Sum-and-product-of-an-array create mode 120000 Lang/jq/Sum-digits-of-an-integer create mode 120000 Lang/jq/Sum-multiples-of-3-and-5 create mode 120000 Lang/jq/Sum-of-a-series create mode 120000 Lang/jq/Sum-of-squares create mode 120000 Lang/jq/Symmetric-difference create mode 120000 Lang/jq/System-time create mode 120000 Lang/jq/Temperature-conversion create mode 120000 Lang/jq/Terminal-control-Clear-the-screen create mode 120000 Lang/jq/Terminal-control-Unicode-output create mode 120000 Lang/jq/Ternary-logic create mode 120000 Lang/jq/Test-a-function create mode 120000 Lang/jq/Text-processing-1 create mode 120000 Lang/jq/Text-processing-2 create mode 120000 Lang/jq/Text-processing-Max-licenses-in-use create mode 120000 Lang/jq/Textonyms create mode 120000 Lang/jq/Tokenize-a-string create mode 120000 Lang/jq/Top-rank-per-group create mode 120000 Lang/jq/Topological-sort create mode 120000 Lang/jq/Topswops create mode 120000 Lang/jq/Towers-of-Hanoi create mode 120000 Lang/jq/Trabb-Pardo-Knuth-algorithm create mode 120000 Lang/jq/Tree-traversal create mode 120000 Lang/jq/Trigonometric-functions create mode 120000 Lang/jq/Twelve-statements create mode 120000 Lang/jq/URL-decoding create mode 120000 Lang/jq/URL-encoding create mode 120000 Lang/jq/Undefined-values create mode 120000 Lang/jq/User-input-Text create mode 120000 Lang/jq/Van-der-Corput-sequence create mode 120000 Lang/jq/Variables create mode 120000 Lang/jq/Variadic-function create mode 120000 Lang/jq/Vector-products create mode 120000 Lang/jq/Web-scraping create mode 120000 Lang/jq/Wireworld create mode 120000 Lang/jq/Word-wrap create mode 120000 Lang/jq/Write-float-arrays-to-a-text-file create mode 120000 Lang/jq/Yin-and-yang create mode 120000 Lang/jq/Zebra-puzzle create mode 120000 Lang/jq/Zeckendorf-number-representation create mode 120000 Lang/jq/Zero-to-the-zero-power create mode 120000 Lang/jq/Zig-zag-matrix create mode 100644 Task/100-doors/68000-Assembly/100-doors.68000 create mode 100644 Task/100-doors/8th/100-doors.8th create mode 100644 Task/100-doors/Ceylon/100-doors.ceylon create mode 100644 Task/100-doors/Clarion/100-doors.clarion create mode 100644 Task/100-doors/Coco/100-doors.coco create mode 100644 Task/100-doors/Commodore-BASIC/100-doors.commodore create mode 100644 Task/100-doors/Crystal/100-doors.crystal create mode 100644 Task/100-doors/ECL/100-doors-1.ecl create mode 100644 Task/100-doors/ECL/100-doors-2.ecl create mode 100644 Task/100-doors/ECL/100-doors-3.ecl create mode 100644 Task/100-doors/ERRE/100-doors.erre create mode 100644 Task/100-doors/EchoLisp/100-doors.echolisp create mode 100644 Task/100-doors/Eero/100-doors.eero create mode 100644 Task/100-doors/FUZE-BASIC/100-doors.fuze create mode 100644 Task/100-doors/FreeBASIC/100-doors-1.freebasic create mode 100644 Task/100-doors/FreeBASIC/100-doors-2.freebasic create mode 100644 Task/100-doors/FreeBASIC/100-doors-3.freebasic create mode 100644 Task/100-doors/FunL/100-doors-1.funl create mode 100644 Task/100-doors/FunL/100-doors-2.funl create mode 100644 Task/100-doors/Futhark/100-doors.futhark create mode 100644 Task/100-doors/FutureBasic/100-doors.futurebasic create mode 100644 Task/100-doors/GFA-Basic/100-doors.gfa create mode 100644 Task/100-doors/Harbour/100-doors-1.harbour create mode 100644 Task/100-doors/Harbour/100-doors-2.harbour create mode 100644 Task/100-doors/Hy/100-doors.hy create mode 100644 Task/100-doors/I/100-doors.i create mode 100644 Task/100-doors/Idris/100-doors.idris create mode 100644 Task/100-doors/Lasso/100-doors.lasso create mode 100644 Task/100-doors/Lily/100-doors.lily create mode 100644 Task/100-doors/LiveCode/100-doors.livecode create mode 100644 Task/100-doors/MoonScript/100-doors.moon create mode 100644 Task/100-doors/Nim/100-doors-1.nim create mode 100644 Task/100-doors/Nim/100-doors-2.nim create mode 100644 Task/100-doors/Oforth/100-doors.oforth create mode 100644 Task/100-doors/PHL/100-doors-1.phl create mode 100644 Task/100-doors/PHL/100-doors-2.phl create mode 100644 Task/100-doors/Perl5i/100-doors.perl5i create mode 100644 Task/100-doors/Phix/100-doors-1.phix create mode 100644 Task/100-doors/Phix/100-doors-2.phix create mode 100644 Task/100-doors/Potion/100-doors.potion create mode 100644 Task/100-doors/Pyret/100-doors.pyret create mode 100644 Task/100-doors/Red/100-doors.red create mode 100644 Task/100-doors/Ring/100-doors-1.ring create mode 100644 Task/100-doors/Ring/100-doors-2.ring create mode 100644 Task/100-doors/SequenceL/100-doors-1.sequencel create mode 100644 Task/100-doors/SequenceL/100-doors-2.sequencel create mode 100644 Task/100-doors/Sidef/100-doors-1.sidef create mode 100644 Task/100-doors/Sidef/100-doors-2.sidef create mode 100644 Task/100-doors/Sparkling/100-doors-1.sparkling create mode 100644 Task/100-doors/Sparkling/100-doors-2.sparkling create mode 100644 Task/100-doors/Swift/100-doors-1.swift create mode 100644 Task/100-doors/Swift/100-doors-2.swift create mode 100644 Task/100-doors/Uniface/100-doors.uniface create mode 100644 Task/100-doors/Ursa/100-doors.ursa create mode 100644 Task/100-doors/Wart/100-doors.wart create mode 100644 Task/100-doors/Wortel/100-doors.wortel create mode 100644 Task/100-doors/Wren/100-doors-1.wren create mode 100644 Task/100-doors/Wren/100-doors-2.wren create mode 100644 Task/100-doors/jq/100-doors-1.jq create mode 100644 Task/100-doors/jq/100-doors-2.jq create mode 100644 Task/24-game-Solve/ERRE/24-game-solve.erre create mode 100644 Task/24-game-Solve/EchoLisp/24-game-solve.echolisp create mode 100644 Task/24-game-Solve/Phix/24-game-solve.phix create mode 100644 Task/24-game-Solve/Sidef/24-game-solve-1.sidef create mode 100644 Task/24-game-Solve/Sidef/24-game-solve-2.sidef create mode 100644 Task/24-game-Solve/Swift/24-game-solve.swift create mode 100644 Task/24-game-Solve/jq/24-game-solve-1.jq create mode 100644 Task/24-game-Solve/jq/24-game-solve-2.jq create mode 100644 Task/24-game-Solve/jq/24-game-solve-3.jq create mode 100644 Task/24-game-Solve/jq/24-game-solve-4.jq create mode 100644 Task/24-game/8th/24-game.8th create mode 100644 Task/24-game/Ceylon/24-game.ceylon create mode 100644 Task/24-game/EchoLisp/24-game.echolisp create mode 100644 Task/24-game/Lasso/24-game.lasso create mode 100644 Task/24-game/LiveCode/24-game-1.livecode create mode 100644 Task/24-game/LiveCode/24-game-2.livecode create mode 100644 Task/24-game/Nim/24-game.nim create mode 100644 Task/24-game/Oforth/24-game.oforth create mode 100644 Task/24-game/Phix/24-game.phix create mode 100644 Task/24-game/Potion/24-game.potion create mode 100644 Task/24-game/Sidef/24-game.sidef create mode 100644 Task/24-game/Swift/24-game.swift create mode 100644 Task/9-billion-names-of-God-the-integer/FreeBASIC/9-billion-names-of-god-the-integer.freebasic create mode 100644 Task/9-billion-names-of-God-the-integer/Lasso/9-billion-names-of-god-the-integer.lasso create mode 100644 Task/9-billion-names-of-God-the-integer/Nim/9-billion-names-of-god-the-integer-1.nim create mode 100644 Task/9-billion-names-of-God-the-integer/Nim/9-billion-names-of-god-the-integer-2.nim create mode 100644 Task/9-billion-names-of-God-the-integer/Phix/9-billion-names-of-god-the-integer.phix create mode 100644 Task/9-billion-names-of-God-the-integer/Sidef/9-billion-names-of-god-the-integer.sidef create mode 100644 Task/9-billion-names-of-God-the-integer/Swift/9-billion-names-of-god-the-integer.swift create mode 100644 Task/99-Bottles-of-Beer/8th/99-bottles-of-beer.8th create mode 100644 Task/99-Bottles-of-Beer/Apex/99-bottles-of-beer.apex create mode 100644 Task/99-Bottles-of-Beer/Axe/99-bottles-of-beer.axe create mode 100644 Task/99-Bottles-of-Beer/Battlestar/99-bottles-of-beer.battlestar create mode 100644 Task/99-Bottles-of-Beer/Ceylon/99-bottles-of-beer.ceylon create mode 100644 Task/99-Bottles-of-Beer/ECL/99-bottles-of-beer.ecl create mode 100644 Task/99-Bottles-of-Beer/FunL/99-bottles-of-beer.funl create mode 100644 Task/99-Bottles-of-Beer/FutureBasic/99-bottles-of-beer.futurebasic create mode 100644 Task/99-Bottles-of-Beer/Idris/99-bottles-of-beer.idris create mode 100644 Task/99-Bottles-of-Beer/Klong/99-bottles-of-beer.klong create mode 100644 Task/99-Bottles-of-Beer/Lambda-Prolog/99-bottles-of-beer-1.lambda create mode 100644 Task/99-Bottles-of-Beer/Lambda-Prolog/99-bottles-of-beer-2.lambda create mode 100644 Task/99-Bottles-of-Beer/Lambda-Prolog/99-bottles-of-beer-3.lambda create mode 100644 Task/99-Bottles-of-Beer/Lasso/99-bottles-of-beer-1.lasso create mode 100644 Task/99-Bottles-of-Beer/Lasso/99-bottles-of-beer-2.lasso create mode 100644 Task/99-Bottles-of-Beer/Lasso/99-bottles-of-beer-3.lasso create mode 100644 Task/99-Bottles-of-Beer/LiveCode/99-bottles-of-beer.livecode create mode 100644 Task/99-Bottles-of-Beer/Malbolge/99-bottles-of-beer-1.malbolge create mode 100644 Task/99-Bottles-of-Beer/Malbolge/99-bottles-of-beer-2.malbolge create mode 100644 Task/99-Bottles-of-Beer/MoonScript/99-bottles-of-beer.moon create mode 100644 Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-1.nim create mode 100644 Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-2.nim create mode 100644 Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-3.nim create mode 100644 Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-4.nim create mode 100644 Task/99-Bottles-of-Beer/Oforth/99-bottles-of-beer.oforth create mode 100644 Task/99-Bottles-of-Beer/PHL/99-bottles-of-beer.phl create mode 100644 Task/99-Bottles-of-Beer/Phix/99-bottles-of-beer.phix create mode 100644 Task/99-Bottles-of-Beer/Ra/99-bottles-of-beer.ra create mode 100644 Task/99-Bottles-of-Beer/Red/99-bottles-of-beer.red create mode 100644 Task/99-Bottles-of-Beer/Ring/99-bottles-of-beer.ring create mode 100644 Task/99-Bottles-of-Beer/SequenceL/99-bottles-of-beer.sequencel create mode 100644 Task/99-Bottles-of-Beer/Set-lang/99-bottles-of-beer.set create mode 100644 Task/99-Bottles-of-Beer/Sidef/99-bottles-of-beer-1.sidef create mode 100644 Task/99-Bottles-of-Beer/Sidef/99-bottles-of-beer-2.sidef create mode 100644 Task/99-Bottles-of-Beer/SkookumScript/99-bottles-of-beer.skookum create mode 100644 Task/99-Bottles-of-Beer/Sparkling/99-bottles-of-beer.sparkling create mode 100644 Task/99-Bottles-of-Beer/Swift/99-bottles-of-beer.swift create mode 100644 Task/99-Bottles-of-Beer/Symsyn/99-bottles-of-beer.symsyn create mode 100644 Task/99-Bottles-of-Beer/Ursa/99-bottles-of-beer.ursa create mode 100644 Task/99-Bottles-of-Beer/Wortel/99-bottles-of-beer.wortel create mode 100644 Task/99-Bottles-of-Beer/Wren/99-bottles-of-beer.wren create mode 100644 Task/99-Bottles-of-Beer/Xojo/99-bottles-of-beer.xojo create mode 100644 Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-1.jq create mode 100644 Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-2.jq create mode 100644 Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-3.jq create mode 100644 Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-4.jq create mode 100644 Task/A+B/8th/a+b.8th create mode 100644 Task/A+B/Apex/a+b.apex create mode 100644 Task/A+B/Arc/a+b.arc create mode 100644 Task/A+B/Ceylon/a+b.ceylon create mode 100644 Task/A+B/Computer-zero-Assembly/a+b.computer create mode 100644 Task/A+B/Crystal/a+b-1.crystal create mode 100644 Task/A+B/Crystal/a+b-2.crystal create mode 100644 Task/A+B/EDSAC-order-code/a+b.edsac create mode 100644 Task/A+B/ERRE/a+b.erre create mode 100644 Task/A+B/EchoLisp/a+b.echolisp create mode 100644 Task/A+B/FUZE-BASIC/a+b.fuze create mode 100644 Task/A+B/FreeBASIC/a+b.freebasic create mode 100644 Task/A+B/FunL/a+b.funl create mode 100644 Task/A+B/I/a+b.i create mode 100644 Task/A+B/Idris/a+b.idris create mode 100644 Task/A+B/L++/a+b.lpp create mode 100644 Task/A+B/Lasso/a+b.lasso create mode 100644 Task/A+B/LiveCode/a+b-1.livecode create mode 100644 Task/A+B/LiveCode/a+b-2.livecode create mode 100644 Task/A+B/Maude/a+b-1.maude create mode 100644 Task/A+B/Maude/a+b-2.maude create mode 100644 Task/A+B/MoonScript/a+b.moon create mode 100644 Task/A+B/Nim/a+b-1.nim create mode 100644 Task/A+B/Nim/a+b-2.nim create mode 100644 Task/A+B/Nim/a+b-3.nim create mode 100644 Task/A+B/Nit/a+b.nit create mode 100644 Task/A+B/Oforth/a+b.oforth create mode 100644 Task/A+B/Phix/a+b.phix create mode 100644 Task/A+B/Potion/a+b.potion create mode 100644 Task/A+B/Ra/a+b.ra create mode 100644 Task/A+B/Red/a+b.red create mode 100644 Task/A+B/Ring/a+b.ring create mode 100644 Task/A+B/SPAD/a+b.spad create mode 100644 Task/A+B/SSEM/a+b.ssem create mode 100644 Task/A+B/SequenceL/a+b.sequencel create mode 100644 Task/A+B/Sidef/a+b-1.sidef create mode 100644 Task/A+B/Sidef/a+b-2.sidef create mode 100644 Task/A+B/Sidef/a+b-3.sidef create mode 100644 Task/A+B/SmileBASIC/a+b.smilebasic create mode 100644 Task/A+B/Swift/a+b.swift create mode 100644 Task/A+B/TI-83-Hex-Assembly/a+b.ti-83 create mode 100644 Task/A+B/Ursa/a+b.ursa create mode 100644 Task/A+B/Wren/a+b.wren create mode 100644 Task/A+B/XLISP/a+b.xlisp create mode 100644 Task/A+B/jq/a+b-1.jq create mode 100644 Task/A+B/jq/a+b-2.jq create mode 100644 Task/A+B/jq/a+b-3.jq create mode 100644 Task/ABC-Problem/Apex/abc-problem.apex create mode 100644 Task/ABC-Problem/Ceylon/abc-problem-1.ceylon create mode 100644 Task/ABC-Problem/Ceylon/abc-problem-2.ceylon create mode 100644 Task/ABC-Problem/ERRE/abc-problem.erre create mode 100644 Task/ABC-Problem/EchoLisp/abc-problem.echolisp create mode 100644 Task/ABC-Problem/Harbour/abc-problem.harbour create mode 100644 Task/ABC-Problem/Nim/abc-problem.nim create mode 100644 Task/ABC-Problem/Oforth/abc-problem.oforth create mode 100644 Task/ABC-Problem/Phix/abc-problem.phix create mode 100644 Task/ABC-Problem/Ring/abc-problem.ring create mode 100644 Task/ABC-Problem/SPAD/abc-problem.spad create mode 100644 Task/ABC-Problem/SequenceL/abc-problem-1.sequencel create mode 100644 Task/ABC-Problem/SequenceL/abc-problem-2.sequencel create mode 100644 Task/ABC-Problem/Sidef/abc-problem-1.sidef create mode 100644 Task/ABC-Problem/Sidef/abc-problem-2.sidef create mode 100644 Task/ABC-Problem/Swift/abc-problem.swift create mode 100644 Task/ABC-Problem/jq/abc-problem-1.jq create mode 100644 Task/ABC-Problem/jq/abc-problem-2.jq create mode 100644 Task/AKS-test-for-primes/EchoLisp/aks-test-for-primes-1.echolisp create mode 100644 Task/AKS-test-for-primes/EchoLisp/aks-test-for-primes-2.echolisp create mode 100644 Task/AKS-test-for-primes/FreeBASIC/aks-test-for-primes.freebasic create mode 100644 Task/AKS-test-for-primes/Idris/aks-test-for-primes.idris create mode 100644 Task/AKS-test-for-primes/Oforth/aks-test-for-primes.oforth create mode 100644 Task/AKS-test-for-primes/Phix/aks-test-for-primes.phix create mode 100644 Task/AKS-test-for-primes/Sidef/aks-test-for-primes.sidef create mode 100644 Task/AKS-test-for-primes/Swift/aks-test-for-primes.swift create mode 100644 Task/AKS-test-for-primes/jq/aks-test-for-primes-1.jq create mode 100644 Task/AKS-test-for-primes/jq/aks-test-for-primes-2.jq create mode 100644 Task/AKS-test-for-primes/jq/aks-test-for-primes-3.jq create mode 100644 Task/AKS-test-for-primes/jq/aks-test-for-primes-4.jq create mode 100644 Task/AKS-test-for-primes/jq/aks-test-for-primes-5.jq create mode 100644 Task/AKS-test-for-primes/jq/aks-test-for-primes-6.jq create mode 100644 Task/AKS-test-for-primes/jq/aks-test-for-primes-7.jq create mode 100644 Task/AKS-test-for-primes/jq/aks-test-for-primes-8.jq create mode 100644 Task/AKS-test-for-primes/jq/aks-test-for-primes-9.jq create mode 100644 Task/Abstract-type/Apex/abstract-type.apex create mode 100644 Task/Abstract-type/FreeBASIC/abstract-type.freebasic create mode 100644 Task/Abstract-type/Lasso/abstract-type.lasso create mode 100644 Task/Abstract-type/Lingo/abstract-type-1.lingo create mode 100644 Task/Abstract-type/Lingo/abstract-type-2.lingo create mode 100644 Task/Abstract-type/Lingo/abstract-type-3.lingo create mode 100644 Task/Abstract-type/Lingo/abstract-type-4.lingo create mode 100644 Task/Abstract-type/Lingo/abstract-type-5.lingo create mode 100644 Task/Abstract-type/Lingo/abstract-type-6.lingo create mode 100644 Task/Abstract-type/Lingo/abstract-type-7.lingo create mode 100644 Task/Abstract-type/Lingo/abstract-type-8.lingo create mode 100644 Task/Abstract-type/Nim/abstract-type.nim create mode 100644 Task/Abstract-type/Nit/abstract-type.nit create mode 100644 Task/Abstract-type/Oforth/abstract-type-1.oforth create mode 100644 Task/Abstract-type/Oforth/abstract-type-2.oforth create mode 100644 Task/Abstract-type/Red/abstract-type.red create mode 100644 Task/Abstract-type/Sidef/abstract-type.sidef create mode 100644 Task/Abundant,-deficient-and-perfect-number-classifications/Ceylon/abundant,-deficient-and-perfect-number-classifications.ceylon create mode 100644 Task/Abundant,-deficient-and-perfect-number-classifications/EchoLisp/abundant,-deficient-and-perfect-number-classifications.echolisp create mode 100644 Task/Abundant,-deficient-and-perfect-number-classifications/FreeBASIC/abundant,-deficient-and-perfect-number-classifications.freebasic create mode 100644 Task/Abundant,-deficient-and-perfect-number-classifications/GFA-Basic/abundant,-deficient-and-perfect-number-classifications.gfa create mode 100644 Task/Abundant,-deficient-and-perfect-number-classifications/Nim/abundant,-deficient-and-perfect-number-classifications.nim create mode 100644 Task/Abundant,-deficient-and-perfect-number-classifications/Oforth/abundant,-deficient-and-perfect-number-classifications.oforth create mode 100644 Task/Abundant,-deficient-and-perfect-number-classifications/Phix/abundant,-deficient-and-perfect-number-classifications.phix create mode 100644 Task/Abundant,-deficient-and-perfect-number-classifications/Ring/abundant,-deficient-and-perfect-number-classifications.ring create mode 100644 Task/Abundant,-deficient-and-perfect-number-classifications/Sidef/abundant,-deficient-and-perfect-number-classifications.sidef create mode 100644 Task/Abundant,-deficient-and-perfect-number-classifications/Swift/abundant,-deficient-and-perfect-number-classifications.swift create mode 100644 Task/Abundant,-deficient-and-perfect-number-classifications/jq/abundant,-deficient-and-perfect-number-classifications-1.jq create mode 100644 Task/Abundant,-deficient-and-perfect-number-classifications/jq/abundant,-deficient-and-perfect-number-classifications-2.jq create mode 100644 Task/Abundant,-deficient-and-perfect-number-classifications/jq/abundant,-deficient-and-perfect-number-classifications-3.jq create mode 100644 Task/Accumulator-factory/Ceylon/accumulator-factory.ceylon create mode 100644 Task/Accumulator-factory/ERRE/accumulator-factory.erre create mode 100644 Task/Accumulator-factory/EchoLisp/accumulator-factory.echolisp create mode 100644 Task/Accumulator-factory/FreeBASIC/accumulator-factory.freebasic create mode 100644 Task/Accumulator-factory/LFE/accumulator-factory-1.lfe create mode 100644 Task/Accumulator-factory/LFE/accumulator-factory-2.lfe create mode 100644 Task/Accumulator-factory/NGS/accumulator-factory.ngs create mode 100644 Task/Accumulator-factory/Nim/accumulator-factory.nim create mode 100644 Task/Accumulator-factory/Oforth/accumulator-factory-1.oforth create mode 100644 Task/Accumulator-factory/Oforth/accumulator-factory-2.oforth create mode 100644 Task/Accumulator-factory/Ring/accumulator-factory.ring create mode 100644 Task/Accumulator-factory/Sidef/accumulator-factory-1.sidef create mode 100644 Task/Accumulator-factory/Sidef/accumulator-factory-2.sidef create mode 100644 Task/Accumulator-factory/Swift/accumulator-factory.swift create mode 100644 Task/Accumulator-factory/Wart/accumulator-factory.wart create mode 100644 Task/Ackermann-function/68000-Assembly/ackermann-function.68000 create mode 100644 Task/Ackermann-function/8th/ackermann-function.8th create mode 100644 Task/Ackermann-function/ERRE/ackermann-function.erre create mode 100644 Task/Ackermann-function/Ezhil/ackermann-function.ezhil create mode 100644 Task/Ackermann-function/FreeBASIC/ackermann-function.freebasic create mode 100644 Task/Ackermann-function/FunL/ackermann-function.funl create mode 100644 Task/Ackermann-function/Futhark/ackermann-function.futhark create mode 100644 Task/Ackermann-function/FutureBasic/ackermann-function.futurebasic create mode 100644 Task/Ackermann-function/Idris/ackermann-function.idris create mode 100644 Task/Ackermann-function/LFE/ackermann-function.lfe create mode 100644 Task/Ackermann-function/Lasso/ackermann-function.lasso create mode 100644 Task/Ackermann-function/LiveCode/ackermann-function.livecode create mode 100644 Task/Ackermann-function/Luck/ackermann-function.luck create mode 100644 Task/Ackermann-function/Nim/ackermann-function-1.nim create mode 100644 Task/Ackermann-function/Nim/ackermann-function-2.nim create mode 100644 Task/Ackermann-function/Oforth/ackermann-function.oforth create mode 100644 Task/Ackermann-function/Phix/ackermann-function.phix create mode 100644 Task/Ackermann-function/Potion/ackermann-function.potion create mode 100644 Task/Ackermann-function/Ring/ackermann-function.ring create mode 100644 Task/Ackermann-function/SPAD/ackermann-function.spad create mode 100644 Task/Ackermann-function/Shen/ackermann-function.shen create mode 100644 Task/Ackermann-function/Sidef/ackermann-function-1.sidef create mode 100644 Task/Ackermann-function/Sidef/ackermann-function-2.sidef create mode 100644 Task/Ackermann-function/Sidef/ackermann-function-3.sidef create mode 100644 Task/Ackermann-function/Swift/ackermann-function.swift create mode 100644 Task/Ackermann-function/Wart/ackermann-function.wart create mode 100644 Task/Ackermann-function/Wren/ackermann-function.wren create mode 100644 Task/Ackermann-function/XLISP/ackermann-function-1.xlisp create mode 100644 Task/Ackermann-function/XLISP/ackermann-function-2.xlisp create mode 100644 Task/Ackermann-function/XLISP/ackermann-function-3.xlisp create mode 100644 Task/Ackermann-function/jq/ackermann-function-1.jq create mode 100644 Task/Ackermann-function/jq/ackermann-function-2.jq create mode 100644 Task/Ackermann-function/jq/ackermann-function-3.jq create mode 100644 Task/Ackermann-function/jq/ackermann-function-4.jq create mode 100644 Task/Ackermann-function/jq/ackermann-function-5.jq create mode 100644 Task/Ackermann-function/jq/ackermann-function-6.jq create mode 100644 Task/Active-Directory-Connect/Ring/active-directory-connect.ring create mode 100644 Task/Active-object/EchoLisp/active-object-1.echolisp create mode 100644 Task/Active-object/EchoLisp/active-object-2.echolisp create mode 100644 Task/Active-object/Swift/active-object.swift create mode 100644 Task/Add-a-variable-to-a-class-instance-at-runtime/Morfa/add-a-variable-to-a-class-instance-at-runtime.morfa create mode 100644 Task/Add-a-variable-to-a-class-instance-at-runtime/Red/add-a-variable-to-a-class-instance-at-runtime.red create mode 100644 Task/Add-a-variable-to-a-class-instance-at-runtime/Ring/add-a-variable-to-a-class-instance-at-runtime.ring create mode 100644 Task/Add-a-variable-to-a-class-instance-at-runtime/Sidef/add-a-variable-to-a-class-instance-at-runtime.sidef create mode 100644 Task/Add-a-variable-to-a-class-instance-at-runtime/Swift/add-a-variable-to-a-class-instance-at-runtime.swift create mode 100644 Task/Add-a-variable-to-a-class-instance-at-runtime/jq/add-a-variable-to-a-class-instance-at-runtime-1.jq create mode 100644 Task/Add-a-variable-to-a-class-instance-at-runtime/jq/add-a-variable-to-a-class-instance-at-runtime-2.jq create mode 100644 Task/Address-of-a-variable/Axe/address-of-a-variable-1.axe create mode 100644 Task/Address-of-a-variable/Axe/address-of-a-variable-2.axe create mode 100644 Task/Address-of-a-variable/ERRE/address-of-a-variable-1.erre create mode 100644 Task/Address-of-a-variable/ERRE/address-of-a-variable-2.erre create mode 100644 Task/Address-of-a-variable/FreeBASIC/address-of-a-variable-1.freebasic create mode 100644 Task/Address-of-a-variable/FreeBASIC/address-of-a-variable-2.freebasic create mode 100644 Task/Address-of-a-variable/FutureBasic/address-of-a-variable.futurebasic create mode 100644 Task/Address-of-a-variable/Nim/address-of-a-variable.nim create mode 100644 Task/Address-of-a-variable/Phix/address-of-a-variable.phix create mode 100644 Task/Address-of-a-variable/Sidef/address-of-a-variable.sidef create mode 100644 Task/Address-of-a-variable/Swift/address-of-a-variable.swift create mode 100644 Task/Address-of-a-variable/Wart/address-of-a-variable-1.wart create mode 100644 Task/Address-of-a-variable/Wart/address-of-a-variable-2.wart create mode 100644 Task/Align-columns/8th/align-columns.8th create mode 100644 Task/Align-columns/FreeBASIC/align-columns.freebasic create mode 100644 Task/Align-columns/Lasso/align-columns.lasso create mode 100644 Task/Align-columns/Nim/align-columns.nim create mode 100644 Task/Align-columns/Oforth/align-columns.oforth create mode 100644 Task/Align-columns/Phix/align-columns.phix create mode 100644 Task/Align-columns/Red/align-columns.red create mode 100644 Task/Align-columns/Sidef/align-columns.sidef create mode 100644 Task/Align-columns/jq/align-columns-1.jq create mode 100644 Task/Align-columns/jq/align-columns-2.jq create mode 100644 Task/Align-columns/jq/align-columns-3.jq create mode 100644 Task/Aliquot-sequence-classifications/EchoLisp/aliquot-sequence-classifications-1.echolisp create mode 100644 Task/Aliquot-sequence-classifications/EchoLisp/aliquot-sequence-classifications-2.echolisp create mode 100644 Task/Aliquot-sequence-classifications/Oforth/aliquot-sequence-classifications.oforth create mode 100644 Task/Aliquot-sequence-classifications/Phix/aliquot-sequence-classifications.phix create mode 100644 Task/Aliquot-sequence-classifications/jq/aliquot-sequence-classifications-1.jq create mode 100644 Task/Aliquot-sequence-classifications/jq/aliquot-sequence-classifications-2.jq create mode 100644 Task/Almost-prime/ERRE/almost-prime.erre create mode 100644 Task/Almost-prime/EchoLisp/almost-prime-1.echolisp create mode 100644 Task/Almost-prime/EchoLisp/almost-prime-2.echolisp create mode 100644 Task/Almost-prime/EchoLisp/almost-prime-3.echolisp create mode 100644 Task/Almost-prime/EchoLisp/almost-prime-4.echolisp create mode 100644 Task/Almost-prime/FreeBASIC/almost-prime.freebasic create mode 100644 Task/Almost-prime/Futhark/almost-prime.futhark create mode 100644 Task/Almost-prime/Oforth/almost-prime.oforth create mode 100644 Task/Almost-prime/Phix/almost-prime-1.phix create mode 100644 Task/Almost-prime/Phix/almost-prime-2.phix create mode 100644 Task/Almost-prime/Potion/almost-prime.potion create mode 100644 Task/Almost-prime/Ring/almost-prime.ring create mode 100644 Task/Almost-prime/SequenceL/almost-prime.sequencel create mode 100644 Task/Almost-prime/Sidef/almost-prime.sidef create mode 100644 Task/Almost-prime/jq/almost-prime-1.jq create mode 100644 Task/Almost-prime/jq/almost-prime-2.jq create mode 100644 Task/Almost-prime/jq/almost-prime-3.jq create mode 100644 Task/Almost-prime/jq/almost-prime-4.jq create mode 100644 Task/Amb/ERRE/amb.erre create mode 100644 Task/Amb/Egison/amb-1.egison create mode 100644 Task/Amb/Egison/amb-2.egison create mode 100644 Task/Amb/Nim/amb.nim create mode 100644 Task/Amb/Phix/amb-1.phix create mode 100644 Task/Amb/Phix/amb-2.phix create mode 100644 Task/Amb/jq/amb-1.jq create mode 100644 Task/Amb/jq/amb-2.jq create mode 100644 Task/Amb/jq/amb-3.jq create mode 100644 Task/Amb/jq/amb-4.jq create mode 100644 Task/Amb/jq/amb-5.jq create mode 100644 Task/Amicable-pairs/Crystal/amicable-pairs.crystal create mode 100644 Task/Amicable-pairs/ERRE/amicable-pairs.erre create mode 100644 Task/Amicable-pairs/EchoLisp/amicable-pairs.echolisp create mode 100644 Task/Amicable-pairs/FreeBASIC/amicable-pairs-1.freebasic create mode 100644 Task/Amicable-pairs/FreeBASIC/amicable-pairs-2.freebasic create mode 100644 Task/Amicable-pairs/Futhark/amicable-pairs.futhark create mode 100644 Task/Amicable-pairs/GFA-Basic/amicable-pairs.gfa create mode 100644 Task/Amicable-pairs/Nim/amicable-pairs-1.nim create mode 100644 Task/Amicable-pairs/Nim/amicable-pairs-2.nim create mode 100644 Task/Amicable-pairs/Oforth/amicable-pairs.oforth create mode 100644 Task/Amicable-pairs/Phix/amicable-pairs.phix create mode 100644 Task/Amicable-pairs/Ring/amicable-pairs.ring create mode 100644 Task/Amicable-pairs/Sidef/amicable-pairs.sidef create mode 100644 Task/Amicable-pairs/Swift/amicable-pairs-1.swift create mode 100644 Task/Amicable-pairs/Swift/amicable-pairs-2.swift create mode 100644 Task/Amicable-pairs/jq/amicable-pairs-1.jq create mode 100644 Task/Amicable-pairs/jq/amicable-pairs-2.jq create mode 100644 Task/Anagrams-Deranged-anagrams/EchoLisp/anagrams-deranged-anagrams-1.echolisp create mode 100644 Task/Anagrams-Deranged-anagrams/EchoLisp/anagrams-deranged-anagrams-2.echolisp create mode 100644 Task/Anagrams-Deranged-anagrams/FreeBASIC/anagrams-deranged-anagrams.freebasic create mode 100644 Task/Anagrams-Deranged-anagrams/Lasso/anagrams-deranged-anagrams.lasso create mode 100644 Task/Anagrams-Deranged-anagrams/Phix/anagrams-deranged-anagrams.phix create mode 100644 Task/Anagrams-Deranged-anagrams/Sidef/anagrams-deranged-anagrams.sidef create mode 100644 Task/Anagrams/EchoLisp/anagrams-1.echolisp create mode 100644 Task/Anagrams/EchoLisp/anagrams-2.echolisp create mode 100644 Task/Anagrams/FreeBASIC/anagrams.freebasic create mode 100644 Task/Anagrams/FutureBasic/anagrams.futurebasic create mode 100644 Task/Anagrams/Lasso/anagrams.lasso create mode 100644 Task/Anagrams/LiveCode/anagrams.livecode create mode 100644 Task/Anagrams/Nim/anagrams.nim create mode 100644 Task/Anagrams/Oforth/anagrams.oforth create mode 100644 Task/Anagrams/Phix/anagrams.phix create mode 100644 Task/Anagrams/Sidef/anagrams.sidef create mode 100644 Task/Anagrams/Swift/anagrams.swift create mode 100644 Task/Anagrams/jq/anagrams-1.jq create mode 100644 Task/Anagrams/jq/anagrams-2.jq create mode 100644 Task/Animate-a-pendulum/ERRE/animate-a-pendulum.erre create mode 100644 Task/Animate-a-pendulum/Elm/animate-a-pendulum.elm create mode 100644 Task/Animate-a-pendulum/Phix/animate-a-pendulum.phix create mode 100644 Task/Animate-a-pendulum/SequenceL/animate-a-pendulum.sequencel create mode 100644 Task/Animate-a-pendulum/Sidef/animate-a-pendulum.sidef create mode 100644 Task/Animation/Ceylon/animation-1.ceylon create mode 100644 Task/Animation/Ceylon/animation-2.ceylon create mode 100644 Task/Animation/FreeBASIC/animation.freebasic create mode 100644 Task/Animation/Phix/animation.phix create mode 100644 Task/Anonymous-recursion/EchoLisp/anonymous-recursion.echolisp create mode 100644 Task/Anonymous-recursion/FreeBASIC/anonymous-recursion.freebasic create mode 100644 Task/Anonymous-recursion/Lingo/anonymous-recursion-1.lingo create mode 100644 Task/Anonymous-recursion/Lingo/anonymous-recursion-2.lingo create mode 100644 Task/Anonymous-recursion/Nim/anonymous-recursion.nim create mode 100644 Task/Anonymous-recursion/Sidef/anonymous-recursion-1.sidef create mode 100644 Task/Anonymous-recursion/Sidef/anonymous-recursion-2.sidef create mode 100644 Task/Anonymous-recursion/Sparkling/anonymous-recursion-1.sparkling create mode 100644 Task/Anonymous-recursion/Sparkling/anonymous-recursion-2.sparkling create mode 100644 Task/Anonymous-recursion/Swift/anonymous-recursion-1.swift create mode 100644 Task/Anonymous-recursion/Swift/anonymous-recursion-2.swift create mode 100644 Task/Anonymous-recursion/Swift/anonymous-recursion-3.swift create mode 100644 Task/Anonymous-recursion/Wart/anonymous-recursion.wart create mode 100644 Task/Anonymous-recursion/Wren/anonymous-recursion.wren create mode 100644 Task/Anonymous-recursion/jq/anonymous-recursion-1.jq create mode 100644 Task/Anonymous-recursion/jq/anonymous-recursion-2.jq create mode 100644 Task/Append-a-record-to-the-end-of-a-text-file/FreeBASIC/append-a-record-to-the-end-of-a-text-file.freebasic create mode 100644 Task/Append-a-record-to-the-end-of-a-text-file/Sidef/append-a-record-to-the-end-of-a-text-file.sidef create mode 100644 Task/Append-a-record-to-the-end-of-a-text-file/Ursa/append-a-record-to-the-end-of-a-text-file.ursa create mode 100644 Task/Apply-a-callback-to-an-array/8th/apply-a-callback-to-an-array.8th create mode 100644 Task/Apply-a-callback-to-an-array/ERRE/apply-a-callback-to-an-array.erre create mode 100644 Task/Apply-a-callback-to-an-array/EchoLisp/apply-a-callback-to-an-array.echolisp create mode 100644 Task/Apply-a-callback-to-an-array/FreeBASIC/apply-a-callback-to-an-array.freebasic create mode 100644 Task/Apply-a-callback-to-an-array/FunL/apply-a-callback-to-an-array.funl create mode 100644 Task/Apply-a-callback-to-an-array/Lasso/apply-a-callback-to-an-array.lasso create mode 100644 Task/Apply-a-callback-to-an-array/NGS/apply-a-callback-to-an-array.ngs create mode 100644 Task/Apply-a-callback-to-an-array/Nim/apply-a-callback-to-an-array.nim create mode 100644 Task/Apply-a-callback-to-an-array/Oforth/apply-a-callback-to-an-array-1.oforth create mode 100644 Task/Apply-a-callback-to-an-array/Oforth/apply-a-callback-to-an-array-2.oforth create mode 100644 Task/Apply-a-callback-to-an-array/Phix/apply-a-callback-to-an-array.phix create mode 100644 Task/Apply-a-callback-to-an-array/Ring/apply-a-callback-to-an-array.ring create mode 100644 Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-1.sidef create mode 100644 Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-2.sidef create mode 100644 Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-3.sidef create mode 100644 Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-4.sidef create mode 100644 Task/Apply-a-callback-to-an-array/Sparkling/apply-a-callback-to-an-array-1.sparkling create mode 100644 Task/Apply-a-callback-to-an-array/Sparkling/apply-a-callback-to-an-array-2.sparkling create mode 100644 Task/Apply-a-callback-to-an-array/Swift/apply-a-callback-to-an-array.swift create mode 100644 Task/Apply-a-callback-to-an-array/Wart/apply-a-callback-to-an-array.wart create mode 100644 Task/Apply-a-callback-to-an-array/Wren/apply-a-callback-to-an-array.wren create mode 100644 Task/Apply-a-callback-to-an-array/jq/apply-a-callback-to-an-array-1.jq create mode 100644 Task/Apply-a-callback-to-an-array/jq/apply-a-callback-to-an-array-2.jq create mode 100644 Task/Arbitrary-precision-integers--included-/8th/arbitrary-precision-integers--included-.8th create mode 100644 Task/Arbitrary-precision-integers--included-/EchoLisp/arbitrary-precision-integers--included-.echolisp create mode 100644 Task/Arbitrary-precision-integers--included-/FreeBASIC/arbitrary-precision-integers--included-.freebasic create mode 100644 Task/Arbitrary-precision-integers--included-/Hoon/arbitrary-precision-integers--included-.hoon create mode 100644 Task/Arbitrary-precision-integers--included-/Lasso/arbitrary-precision-integers--included-.lasso create mode 100644 Task/Arbitrary-precision-integers--included-/Nim/arbitrary-precision-integers--included-.nim create mode 100644 Task/Arbitrary-precision-integers--included-/Oforth/arbitrary-precision-integers--included-.oforth create mode 100644 Task/Arbitrary-precision-integers--included-/Phix/arbitrary-precision-integers--included-.phix create mode 100644 Task/Arbitrary-precision-integers--included-/Sidef/arbitrary-precision-integers--included-.sidef create mode 100644 Task/Arbitrary-precision-integers--included-/Ursa/arbitrary-precision-integers--included-.ursa create mode 100644 Task/Arena-storage-pool/Oforth/arena-storage-pool.oforth create mode 100644 Task/Arithmetic-Complex/ERRE/arithmetic-complex.erre create mode 100644 Task/Arithmetic-Complex/EchoLisp/arithmetic-complex.echolisp create mode 100644 Task/Arithmetic-Complex/FreeBASIC/arithmetic-complex.freebasic create mode 100644 Task/Arithmetic-Complex/Futhark/arithmetic-complex.futhark create mode 100644 Task/Arithmetic-Complex/LFE/arithmetic-complex-1.lfe create mode 100644 Task/Arithmetic-Complex/LFE/arithmetic-complex-2.lfe create mode 100644 Task/Arithmetic-Complex/LFE/arithmetic-complex-3.lfe create mode 100644 Task/Arithmetic-Complex/LFE/arithmetic-complex-4.lfe create mode 100644 Task/Arithmetic-Complex/LFE/arithmetic-complex-5.lfe create mode 100644 Task/Arithmetic-Complex/Nim/arithmetic-complex.nim create mode 100644 Task/Arithmetic-Complex/Oforth/arithmetic-complex-1.oforth create mode 100644 Task/Arithmetic-Complex/Oforth/arithmetic-complex-2.oforth create mode 100644 Task/Arithmetic-Complex/Phix/arithmetic-complex.phix create mode 100644 Task/Arithmetic-Complex/Sidef/arithmetic-complex.sidef create mode 100644 Task/Arithmetic-Complex/Swift/arithmetic-complex-1.swift create mode 100644 Task/Arithmetic-Complex/Swift/arithmetic-complex-2.swift create mode 100644 Task/Arithmetic-Complex/Swift/arithmetic-complex-3.swift create mode 100644 Task/Arithmetic-Complex/Wortel/arithmetic-complex.wortel create mode 100644 Task/Arithmetic-Complex/jq/arithmetic-complex-1.jq create mode 100644 Task/Arithmetic-Complex/jq/arithmetic-complex-2.jq create mode 100644 Task/Arithmetic-Integer/ECL/arithmetic-integer.ecl create mode 100644 Task/Arithmetic-Integer/ERRE/arithmetic-integer.erre create mode 100644 Task/Arithmetic-Integer/FreeBASIC/arithmetic-integer.freebasic create mode 100644 Task/Arithmetic-Integer/FutureBasic/arithmetic-integer.futurebasic create mode 100644 Task/Arithmetic-Integer/GEORGE/arithmetic-integer.george create mode 100644 Task/Arithmetic-Integer/Harbour/arithmetic-integer.harbour create mode 100644 Task/Arithmetic-Integer/I/arithmetic-integer.i create mode 100644 Task/Arithmetic-Integer/LFE/arithmetic-integer-1.lfe create mode 100644 Task/Arithmetic-Integer/LFE/arithmetic-integer-2.lfe create mode 100644 Task/Arithmetic-Integer/Lasso/arithmetic-integer.lasso create mode 100644 Task/Arithmetic-Integer/LiveCode/arithmetic-integer-1.livecode create mode 100644 Task/Arithmetic-Integer/LiveCode/arithmetic-integer-2.livecode create mode 100644 Task/Arithmetic-Integer/Nim/arithmetic-integer.nim create mode 100644 Task/Arithmetic-Integer/Oforth/arithmetic-integer.oforth create mode 100644 Task/Arithmetic-Integer/PHL/arithmetic-integer.phl create mode 100644 Task/Arithmetic-Integer/Panda/arithmetic-integer.panda create mode 100644 Task/Arithmetic-Integer/Phix/arithmetic-integer.phix create mode 100644 Task/Arithmetic-Integer/Ring/arithmetic-integer.ring create mode 100644 Task/Arithmetic-Integer/SSEM/arithmetic-integer-1.ssem create mode 100644 Task/Arithmetic-Integer/SSEM/arithmetic-integer-2.ssem create mode 100644 Task/Arithmetic-Integer/Sidef/arithmetic-integer.sidef create mode 100644 Task/Arithmetic-Integer/Ursa/arithmetic-integer.ursa create mode 100644 Task/Arithmetic-Integer/Wart/arithmetic-integer.wart create mode 100644 Task/Arithmetic-Integer/Wren/arithmetic-integer.wren create mode 100644 Task/Arithmetic-Integer/XLISP/arithmetic-integer.xlisp create mode 100644 Task/Arithmetic-Integer/jq/arithmetic-integer.jq create mode 100644 Task/Arithmetic-Rational/ERRE/arithmetic-rational.erre create mode 100644 Task/Arithmetic-Rational/EchoLisp/arithmetic-rational-1.echolisp create mode 100644 Task/Arithmetic-Rational/EchoLisp/arithmetic-rational-2.echolisp create mode 100644 Task/Arithmetic-Rational/Lingo/arithmetic-rational-1.lingo create mode 100644 Task/Arithmetic-Rational/Lingo/arithmetic-rational-2.lingo create mode 100644 Task/Arithmetic-Rational/Lingo/arithmetic-rational-3.lingo create mode 100644 Task/Arithmetic-Rational/Lingo/arithmetic-rational-4.lingo create mode 100644 Task/Arithmetic-Rational/Lingo/arithmetic-rational-5.lingo create mode 100644 Task/Arithmetic-Rational/Nim/arithmetic-rational.nim create mode 100644 Task/Arithmetic-Rational/Phix/arithmetic-rational.phix create mode 100644 Task/Arithmetic-evaluation/ERRE/arithmetic-evaluation.erre create mode 100644 Task/Arithmetic-evaluation/FreeBASIC/arithmetic-evaluation.freebasic create mode 100644 Task/Arithmetic-evaluation/Phix/arithmetic-evaluation.phix create mode 100644 Task/Arithmetic-evaluation/Sidef/arithmetic-evaluation-1.sidef create mode 100644 Task/Arithmetic-evaluation/Sidef/arithmetic-evaluation-2.sidef create mode 100644 Task/Arithmetic-geometric-mean-Calculate-Pi/Phix/arithmetic-geometric-mean-calculate-pi.phix create mode 100644 Task/Arithmetic-geometric-mean-Calculate-Pi/Sidef/arithmetic-geometric-mean-calculate-pi.sidef create mode 100644 Task/Arithmetic-geometric-mean/ERRE/arithmetic-geometric-mean.erre create mode 100644 Task/Arithmetic-geometric-mean/EchoLisp/arithmetic-geometric-mean.echolisp create mode 100644 Task/Arithmetic-geometric-mean/FreeBASIC/arithmetic-geometric-mean.freebasic create mode 100644 Task/Arithmetic-geometric-mean/Futhark/arithmetic-geometric-mean.futhark create mode 100644 Task/Arithmetic-geometric-mean/LFE/arithmetic-geometric-mean.lfe create mode 100644 Task/Arithmetic-geometric-mean/LiveCode/arithmetic-geometric-mean-1.livecode create mode 100644 Task/Arithmetic-geometric-mean/LiveCode/arithmetic-geometric-mean-2.livecode create mode 100644 Task/Arithmetic-geometric-mean/Nim/arithmetic-geometric-mean-1.nim create mode 100644 Task/Arithmetic-geometric-mean/Nim/arithmetic-geometric-mean-2.nim create mode 100644 Task/Arithmetic-geometric-mean/Oforth/arithmetic-geometric-mean-1.oforth create mode 100644 Task/Arithmetic-geometric-mean/Oforth/arithmetic-geometric-mean-2.oforth create mode 100644 Task/Arithmetic-geometric-mean/Phix/arithmetic-geometric-mean.phix create mode 100644 Task/Arithmetic-geometric-mean/Potion/arithmetic-geometric-mean.potion create mode 100644 Task/Arithmetic-geometric-mean/Ring/arithmetic-geometric-mean.ring create mode 100644 Task/Arithmetic-geometric-mean/Sidef/arithmetic-geometric-mean.sidef create mode 100644 Task/Arithmetic-geometric-mean/jq/arithmetic-geometric-mean-1.jq create mode 100644 Task/Arithmetic-geometric-mean/jq/arithmetic-geometric-mean-2.jq create mode 100644 Task/Array-concatenation/AntLang/array-concatenation.antlang create mode 100644 Task/Array-concatenation/Apex/array-concatenation.apex create mode 100644 Task/Array-concatenation/Ceylon/array-concatenation.ceylon create mode 100644 Task/Array-concatenation/ECL/array-concatenation.ecl create mode 100644 Task/Array-concatenation/ERRE/array-concatenation.erre create mode 100644 Task/Array-concatenation/EchoLisp/array-concatenation.echolisp create mode 100644 Task/Array-concatenation/Elm/array-concatenation.elm create mode 100644 Task/Array-concatenation/FreeBASIC/array-concatenation.freebasic create mode 100644 Task/Array-concatenation/FunL/array-concatenation.funl create mode 100644 Task/Array-concatenation/Futhark/array-concatenation.futhark create mode 100644 Task/Array-concatenation/I/array-concatenation.i create mode 100644 Task/Array-concatenation/LFE/array-concatenation.lfe create mode 100644 Task/Array-concatenation/Lasso/array-concatenation.lasso create mode 100644 Task/Array-concatenation/Lingo/array-concatenation.lingo create mode 100644 Task/Array-concatenation/Nim/array-concatenation-1.nim create mode 100644 Task/Array-concatenation/Nim/array-concatenation-2.nim create mode 100644 Task/Array-concatenation/Oforth/array-concatenation.oforth create mode 100644 Task/Array-concatenation/Phix/array-concatenation.phix create mode 100644 Task/Array-concatenation/Ring/array-concatenation.ring create mode 100644 Task/Array-concatenation/Sidef/array-concatenation.sidef create mode 100644 Task/Array-concatenation/Swift/array-concatenation.swift create mode 100644 Task/Array-concatenation/Ursa/array-concatenation.ursa create mode 100644 Task/Array-concatenation/Wart/array-concatenation.wart create mode 100644 Task/Array-concatenation/Wren/array-concatenation.wren create mode 100644 Task/Array-concatenation/jq/array-concatenation.jq create mode 100644 Task/Arrays/8051-Assembly/arrays.8051 create mode 100644 Task/Arrays/8th/arrays.8th create mode 100644 Task/Arrays/AntLang/arrays.antlang create mode 100644 Task/Arrays/Apex/arrays-1.apex create mode 100644 Task/Arrays/Apex/arrays-2.apex create mode 100644 Task/Arrays/Axe/arrays.axe create mode 100644 Task/Arrays/BML/arrays.bml create mode 100644 Task/Arrays/Ceylon/arrays.ceylon create mode 100644 Task/Arrays/ChucK/arrays.chuck create mode 100644 Task/Arrays/Computer-zero-Assembly/arrays-1.computer create mode 100644 Task/Arrays/Computer-zero-Assembly/arrays-2.computer create mode 100644 Task/Arrays/FreeBASIC/arrays.freebasic create mode 100644 Task/Arrays/Futhark/arrays-1.futhark create mode 100644 Task/Arrays/Futhark/arrays-2.futhark create mode 100644 Task/Arrays/Futhark/arrays-3.futhark create mode 100644 Task/Arrays/Harbour/arrays-1.harbour create mode 100644 Task/Arrays/Harbour/arrays-2.harbour create mode 100644 Task/Arrays/Harbour/arrays-3.harbour create mode 100644 Task/Arrays/Harbour/arrays-4.harbour create mode 100644 Task/Arrays/I/arrays-1.i create mode 100644 Task/Arrays/I/arrays-2.i create mode 100644 Task/Arrays/I/arrays-3.i create mode 100644 Task/Arrays/LFE/arrays.lfe create mode 100644 Task/Arrays/Lasso/arrays-1.lasso create mode 100644 Task/Arrays/Lasso/arrays-2.lasso create mode 100644 Task/Arrays/Lingo/arrays-1.lingo create mode 100644 Task/Arrays/Lingo/arrays-2.lingo create mode 100644 Task/Arrays/Monte/arrays-1.monte create mode 100644 Task/Arrays/Monte/arrays-2.monte create mode 100644 Task/Arrays/Monte/arrays-3.monte create mode 100644 Task/Arrays/Nim/arrays.nim create mode 100644 Task/Arrays/Oforth/arrays.oforth create mode 100644 Task/Arrays/Phix/arrays.phix create mode 100644 Task/Arrays/Pony/arrays.pony create mode 100644 Task/Arrays/Ring/arrays.ring create mode 100644 Task/Arrays/SSEM/arrays.ssem create mode 100644 Task/Arrays/Sidef/arrays.sidef create mode 100644 Task/Arrays/Swift/arrays.swift create mode 100644 Task/Arrays/Wren/arrays.wren create mode 100644 Task/Arrays/XLISP/arrays.xlisp create mode 100644 Task/Arrays/jq/arrays.jq create mode 100644 Task/Assertions/Apex/assertions-1.apex create mode 100644 Task/Assertions/Apex/assertions-2.apex create mode 100644 Task/Assertions/Apex/assertions-3.apex create mode 100644 Task/Assertions/Axe/assertions.axe create mode 100644 Task/Assertions/ECL/assertions.ecl create mode 100644 Task/Assertions/EchoLisp/assertions.echolisp create mode 100644 Task/Assertions/FreeBASIC/assertions.freebasic create mode 100644 Task/Assertions/Lasso/assertions.lasso create mode 100644 Task/Assertions/Lingo/assertions.lingo create mode 100644 Task/Assertions/Nim/assertions.nim create mode 100644 Task/Assertions/Oforth/assertions.oforth create mode 100644 Task/Assertions/Phix/assertions-1.phix create mode 100644 Task/Assertions/Phix/assertions-2.phix create mode 100644 Task/Assertions/Phix/assertions-3.phix create mode 100644 Task/Assertions/Ring/assertions.ring create mode 100644 Task/Assertions/Sidef/assertions.sidef create mode 100644 Task/Assertions/Swift/assertions.swift create mode 100644 Task/Associative-array-Creation/Apex/associative-array-creation-1.apex create mode 100644 Task/Associative-array-Creation/Apex/associative-array-creation-2.apex create mode 100644 Task/Associative-array-Creation/Ceylon/associative-array-creation.ceylon create mode 100644 Task/Associative-array-Creation/EchoLisp/associative-array-creation.echolisp create mode 100644 Task/Associative-array-Creation/Harbour/associative-array-creation-1.harbour create mode 100644 Task/Associative-array-Creation/Harbour/associative-array-creation-2.harbour create mode 100644 Task/Associative-array-Creation/LFE/associative-array-creation.lfe create mode 100644 Task/Associative-array-Creation/Lasso/associative-array-creation.lasso create mode 100644 Task/Associative-array-Creation/Lingo/associative-array-creation.lingo create mode 100644 Task/Associative-array-Creation/LiveCode/associative-array-creation-1.livecode create mode 100644 Task/Associative-array-Creation/LiveCode/associative-array-creation-2.livecode create mode 100644 Task/Associative-array-Creation/Nim/associative-array-creation.nim create mode 100644 Task/Associative-array-Creation/Phix/associative-array-creation.phix create mode 100644 Task/Associative-array-Creation/Potion/associative-array-creation.potion create mode 100644 Task/Associative-array-Creation/Sidef/associative-array-creation.sidef create mode 100644 Task/Associative-array-Creation/Swift/associative-array-creation.swift create mode 100644 Task/Associative-array-Creation/Visual-FoxPro/associative-array-creation.visual create mode 100644 Task/Associative-array-Creation/Wart/associative-array-creation.wart create mode 100644 Task/Associative-array-Creation/XLISP/associative-array-creation-1.xlisp create mode 100644 Task/Associative-array-Creation/XLISP/associative-array-creation-2.xlisp create mode 100644 Task/Associative-array-Creation/XLISP/associative-array-creation-3.xlisp create mode 100644 Task/Associative-array-Creation/XLISP/associative-array-creation-4.xlisp create mode 100644 Task/Associative-array-Creation/jq/associative-array-creation-1.jq create mode 100644 Task/Associative-array-Creation/jq/associative-array-creation-2.jq create mode 100644 Task/Associative-array-Creation/jq/associative-array-creation-3.jq create mode 100644 Task/Associative-array-Creation/jq/associative-array-creation-4.jq create mode 100644 Task/Associative-array-Iteration/Ceylon/associative-array-iteration.ceylon create mode 100644 Task/Associative-array-Iteration/EchoLisp/associative-array-iteration.echolisp create mode 100644 Task/Associative-array-Iteration/Harbour/associative-array-iteration.harbour create mode 100644 Task/Associative-array-Iteration/LFE/associative-array-iteration-1.lfe create mode 100644 Task/Associative-array-Iteration/LFE/associative-array-iteration-2.lfe create mode 100644 Task/Associative-array-Iteration/Lasso/associative-array-iteration.lasso create mode 100644 Task/Associative-array-Iteration/Lingo/associative-array-iteration.lingo create mode 100644 Task/Associative-array-Iteration/LiveCode/associative-array-iteration-1.livecode create mode 100644 Task/Associative-array-Iteration/LiveCode/associative-array-iteration-2.livecode create mode 100644 Task/Associative-array-Iteration/Nim/associative-array-iteration.nim create mode 100644 Task/Associative-array-Iteration/Phix/associative-array-iteration-1.phix create mode 100644 Task/Associative-array-Iteration/Phix/associative-array-iteration-2.phix create mode 100644 Task/Associative-array-Iteration/Potion/associative-array-iteration.potion create mode 100644 Task/Associative-array-Iteration/Sidef/associative-array-iteration.sidef create mode 100644 Task/Associative-array-Iteration/Swift/associative-array-iteration.swift create mode 100644 Task/Associative-array-Iteration/Wart/associative-array-iteration.wart create mode 100644 Task/Atomic-updates/Lasso/atomic-updates.lasso create mode 100644 Task/Atomic-updates/Phix/atomic-updates.phix create mode 100644 Task/Average-loop-length/EchoLisp/average-loop-length.echolisp create mode 100644 Task/Average-loop-length/Nim/average-loop-length.nim create mode 100644 Task/Average-loop-length/Phix/average-loop-length.phix create mode 100644 Task/Averages-Arithmetic-mean/8th/averages-arithmetic-mean.8th create mode 100644 Task/Averages-Arithmetic-mean/AntLang/averages-arithmetic-mean.antlang create mode 100644 Task/Averages-Arithmetic-mean/ECL/averages-arithmetic-mean.ecl create mode 100644 Task/Averages-Arithmetic-mean/EchoLisp/averages-arithmetic-mean.echolisp create mode 100644 Task/Averages-Arithmetic-mean/FreeBASIC/averages-arithmetic-mean.freebasic create mode 100644 Task/Averages-Arithmetic-mean/GEORGE/averages-arithmetic-mean.george create mode 100644 Task/Averages-Arithmetic-mean/GFA-Basic/averages-arithmetic-mean.gfa create mode 100644 Task/Averages-Arithmetic-mean/Hy/averages-arithmetic-mean.hy create mode 100644 Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-1.lfe create mode 100644 Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-2.lfe create mode 100644 Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-3.lfe create mode 100644 Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-4.lfe create mode 100644 Task/Averages-Arithmetic-mean/Lasso/averages-arithmetic-mean.lasso create mode 100644 Task/Averages-Arithmetic-mean/LiveCode/averages-arithmetic-mean.livecode create mode 100644 Task/Averages-Arithmetic-mean/Nim/averages-arithmetic-mean.nim create mode 100644 Task/Averages-Arithmetic-mean/Oforth/averages-arithmetic-mean.oforth create mode 100644 Task/Averages-Arithmetic-mean/Phix/averages-arithmetic-mean.phix create mode 100644 Task/Averages-Arithmetic-mean/Ring/averages-arithmetic-mean.ring create mode 100644 Task/Averages-Arithmetic-mean/Sidef/averages-arithmetic-mean.sidef create mode 100644 Task/Averages-Arithmetic-mean/Swift/averages-arithmetic-mean.swift create mode 100644 Task/Averages-Arithmetic-mean/Ursa/averages-arithmetic-mean.ursa create mode 100644 Task/Averages-Arithmetic-mean/Wart/averages-arithmetic-mean.wart create mode 100644 Task/Averages-Arithmetic-mean/Wortel/averages-arithmetic-mean.wortel create mode 100644 Task/Averages-Arithmetic-mean/Wren/averages-arithmetic-mean.wren create mode 100644 Task/Averages-Arithmetic-mean/XLISP/averages-arithmetic-mean.xlisp create mode 100644 Task/Averages-Arithmetic-mean/jq/averages-arithmetic-mean-1.jq create mode 100644 Task/Averages-Arithmetic-mean/jq/averages-arithmetic-mean-2.jq create mode 100644 Task/Averages-Mean-angle/EchoLisp/averages-mean-angle.echolisp create mode 100644 Task/Averages-Mean-angle/FreeBASIC/averages-mean-angle.freebasic create mode 100644 Task/Averages-Mean-angle/Nim/averages-mean-angle.nim create mode 100644 Task/Averages-Mean-angle/Phix/averages-mean-angle.phix create mode 100644 Task/Averages-Mean-angle/Sidef/averages-mean-angle.sidef create mode 100644 Task/Averages-Mean-angle/jq/averages-mean-angle-1.jq create mode 100644 Task/Averages-Mean-angle/jq/averages-mean-angle-2.jq create mode 100644 Task/Averages-Mean-angle/jq/averages-mean-angle-3.jq create mode 100644 Task/Averages-Mean-angle/jq/averages-mean-angle-4.jq create mode 100644 Task/Averages-Mean-time-of-day/EchoLisp/averages-mean-time-of-day.echolisp create mode 100644 Task/Averages-Mean-time-of-day/FreeBASIC/averages-mean-time-of-day.freebasic create mode 100644 Task/Averages-Mean-time-of-day/Nim/averages-mean-time-of-day.nim create mode 100644 Task/Averages-Mean-time-of-day/Phix/averages-mean-time-of-day.phix create mode 100644 Task/Averages-Mean-time-of-day/Sidef/averages-mean-time-of-day.sidef create mode 100644 Task/Averages-Mean-time-of-day/jq/averages-mean-time-of-day-1.jq create mode 100644 Task/Averages-Mean-time-of-day/jq/averages-mean-time-of-day-2.jq create mode 100644 Task/Averages-Mean-time-of-day/jq/averages-mean-time-of-day-3.jq create mode 100644 Task/Averages-Median/AntLang/averages-median.antlang create mode 100644 Task/Averages-Median/ERRE/averages-median.erre create mode 100644 Task/Averages-Median/EchoLisp/averages-median.echolisp create mode 100644 Task/Averages-Median/FreeBASIC/averages-median.freebasic create mode 100644 Task/Averages-Median/Lasso/averages-median.lasso create mode 100644 Task/Averages-Median/LiveCode/averages-median-1.livecode create mode 100644 Task/Averages-Median/LiveCode/averages-median-2.livecode create mode 100644 Task/Averages-Median/Nim/averages-median.nim create mode 100644 Task/Averages-Median/Phix/averages-median-1.phix create mode 100644 Task/Averages-Median/Phix/averages-median-2.phix create mode 100644 Task/Averages-Median/Ring/averages-median.ring create mode 100644 Task/Averages-Median/Sidef/averages-median.sidef create mode 100644 Task/Averages-Median/Wortel/averages-median.wortel create mode 100644 Task/Averages-Median/jq/averages-median-1.jq create mode 100644 Task/Averages-Median/jq/averages-median-2.jq create mode 100644 Task/Averages-Median/jq/averages-median-3.jq create mode 100644 Task/Averages-Mode/ERRE/averages-mode.erre create mode 100644 Task/Averages-Mode/EchoLisp/averages-mode.echolisp create mode 100644 Task/Averages-Mode/FreeBASIC/averages-mode.freebasic create mode 100644 Task/Averages-Mode/Lasso/averages-mode.lasso create mode 100644 Task/Averages-Mode/Nim/averages-mode.nim create mode 100644 Task/Averages-Mode/Phix/averages-mode.phix create mode 100644 Task/Averages-Mode/Sidef/averages-mode-1.sidef create mode 100644 Task/Averages-Mode/Sidef/averages-mode-2.sidef create mode 100644 Task/Averages-Mode/Sidef/averages-mode-3.sidef create mode 100644 Task/Averages-Mode/Wren/averages-mode.wren create mode 100644 Task/Averages-Mode/jq/averages-mode-1.jq create mode 100644 Task/Averages-Mode/jq/averages-mode-2.jq create mode 100644 Task/Averages-Pythagorean-means/ERRE/averages-pythagorean-means.erre create mode 100644 Task/Averages-Pythagorean-means/EchoLisp/averages-pythagorean-means.echolisp create mode 100644 Task/Averages-Pythagorean-means/FreeBASIC/averages-pythagorean-means.freebasic create mode 100644 Task/Averages-Pythagorean-means/FunL/averages-pythagorean-means.funl create mode 100644 Task/Averages-Pythagorean-means/Futhark/averages-pythagorean-means.futhark create mode 100644 Task/Averages-Pythagorean-means/Lasso/averages-pythagorean-means.lasso create mode 100644 Task/Averages-Pythagorean-means/Nim/averages-pythagorean-means.nim create mode 100644 Task/Averages-Pythagorean-means/Oforth/averages-pythagorean-means.oforth create mode 100644 Task/Averages-Pythagorean-means/Phix/averages-pythagorean-means.phix create mode 100644 Task/Averages-Pythagorean-means/Ring/averages-pythagorean-means.ring create mode 100644 Task/Averages-Pythagorean-means/Sidef/averages-pythagorean-means-1.sidef create mode 100644 Task/Averages-Pythagorean-means/Sidef/averages-pythagorean-means-2.sidef create mode 100644 Task/Averages-Pythagorean-means/Sidef/averages-pythagorean-means-3.sidef create mode 100644 Task/Averages-Pythagorean-means/jq/averages-pythagorean-means.jq create mode 100644 Task/Averages-Root-mean-square/ERRE/averages-root-mean-square.erre create mode 100644 Task/Averages-Root-mean-square/EchoLisp/averages-root-mean-square.echolisp create mode 100644 Task/Averages-Root-mean-square/FreeBASIC/averages-root-mean-square.freebasic create mode 100644 Task/Averages-Root-mean-square/Futhark/averages-root-mean-square.futhark create mode 100644 Task/Averages-Root-mean-square/GEORGE/averages-root-mean-square.george create mode 100644 Task/Averages-Root-mean-square/Lasso/averages-root-mean-square.lasso create mode 100644 Task/Averages-Root-mean-square/Morfa/averages-root-mean-square.morfa create mode 100644 Task/Averages-Root-mean-square/Nim/averages-root-mean-square.nim create mode 100644 Task/Averages-Root-mean-square/Oforth/averages-root-mean-square.oforth create mode 100644 Task/Averages-Root-mean-square/Phix/averages-root-mean-square.phix create mode 100644 Task/Averages-Root-mean-square/Powerbuilder/averages-root-mean-square.powerbuilder create mode 100644 Task/Averages-Root-mean-square/Ring/averages-root-mean-square.ring create mode 100644 Task/Averages-Root-mean-square/Sidef/averages-root-mean-square.sidef create mode 100644 Task/Averages-Root-mean-square/Wortel/averages-root-mean-square.wortel create mode 100644 Task/Averages-Root-mean-square/XLISP/averages-root-mean-square.xlisp create mode 100644 Task/Averages-Root-mean-square/jq/averages-root-mean-square-1.jq create mode 100644 Task/Averages-Root-mean-square/jq/averages-root-mean-square-2.jq create mode 100644 Task/Averages-Simple-moving-average/EchoLisp/averages-simple-moving-average.echolisp create mode 100644 Task/Averages-Simple-moving-average/FreeBASIC/averages-simple-moving-average.freebasic create mode 100644 Task/Averages-Simple-moving-average/Lasso/averages-simple-moving-average.lasso create mode 100644 Task/Averages-Simple-moving-average/Nim/averages-simple-moving-average.nim create mode 100644 Task/Averages-Simple-moving-average/Oforth/averages-simple-moving-average-1.oforth create mode 100644 Task/Averages-Simple-moving-average/Oforth/averages-simple-moving-average-2.oforth create mode 100644 Task/Averages-Simple-moving-average/Phix/averages-simple-moving-average-1.phix create mode 100644 Task/Averages-Simple-moving-average/Phix/averages-simple-moving-average-2.phix create mode 100644 Task/Averages-Simple-moving-average/Ring/averages-simple-moving-average-1.ring create mode 100644 Task/Averages-Simple-moving-average/Ring/averages-simple-moving-average-2.ring create mode 100644 Task/Averages-Simple-moving-average/Ring/averages-simple-moving-average-3.ring create mode 100644 Task/Averages-Simple-moving-average/Sidef/averages-simple-moving-average-1.sidef create mode 100644 Task/Averages-Simple-moving-average/Sidef/averages-simple-moving-average-2.sidef create mode 100644 Task/Balanced-brackets/Ceylon/balanced-brackets.ceylon create mode 100644 Task/Balanced-brackets/EchoLisp/balanced-brackets.echolisp create mode 100644 Task/Balanced-brackets/FreeBASIC/balanced-brackets.freebasic create mode 100644 Task/Balanced-brackets/L++/balanced-brackets.lpp create mode 100644 Task/Balanced-brackets/Lasso/balanced-brackets.lasso create mode 100644 Task/Balanced-brackets/Nim/balanced-brackets.nim create mode 100644 Task/Balanced-brackets/Oforth/balanced-brackets.oforth create mode 100644 Task/Balanced-brackets/Phix/balanced-brackets.phix create mode 100644 Task/Balanced-brackets/Ring/balanced-brackets.ring create mode 100644 Task/Balanced-brackets/Sidef/balanced-brackets.sidef create mode 100644 Task/Balanced-brackets/Swift/balanced-brackets-1.swift create mode 100644 Task/Balanced-brackets/Swift/balanced-brackets-2.swift create mode 100644 Task/Balanced-brackets/Swift/balanced-brackets-3.swift create mode 100644 Task/Balanced-brackets/Swift/balanced-brackets-4.swift create mode 100644 Task/Balanced-brackets/Swift/balanced-brackets-5.swift create mode 100644 Task/Balanced-brackets/Swift/balanced-brackets-6.swift create mode 100644 Task/Balanced-brackets/Ya/balanced-brackets.ya create mode 100644 Task/Balanced-ternary/Glagol/balanced-ternary.glagol create mode 100644 Task/Balanced-ternary/Phix/balanced-ternary-1.phix create mode 100644 Task/Balanced-ternary/Phix/balanced-ternary-2.phix create mode 100644 Task/Benfords-law/FreeBASIC/benfords-law.freebasic create mode 100644 Task/Benfords-law/Phix/benfords-law-1.phix create mode 100644 Task/Benfords-law/Phix/benfords-law-2.phix create mode 100644 Task/Benfords-law/Sidef/benfords-law.sidef create mode 100644 Task/Benfords-law/Visual-FoxPro/benfords-law.visual create mode 100644 Task/Benfords-law/jq/benfords-law.jq create mode 100644 Task/Bernoulli-numbers/Crystal/bernoulli-numbers.crystal create mode 100644 Task/Bernoulli-numbers/EchoLisp/bernoulli-numbers-1.echolisp create mode 100644 Task/Bernoulli-numbers/EchoLisp/bernoulli-numbers-2.echolisp create mode 100644 Task/Bernoulli-numbers/FreeBASIC/bernoulli-numbers.freebasic create mode 100644 Task/Bernoulli-numbers/FunL/bernoulli-numbers.funl create mode 100644 Task/Bernoulli-numbers/Phix/bernoulli-numbers-1.phix create mode 100644 Task/Bernoulli-numbers/Phix/bernoulli-numbers-2.phix create mode 100644 Task/Bernoulli-numbers/SPAD/bernoulli-numbers.spad create mode 100644 Task/Bernoulli-numbers/Sidef/bernoulli-numbers-1.sidef create mode 100644 Task/Bernoulli-numbers/Sidef/bernoulli-numbers-2.sidef create mode 100644 Task/Bernoulli-numbers/jq/bernoulli-numbers-1.jq create mode 100644 Task/Bernoulli-numbers/jq/bernoulli-numbers-2.jq create mode 100644 Task/Bernoulli-numbers/jq/bernoulli-numbers-3.jq create mode 100644 Task/Bernoulli-numbers/jq/bernoulli-numbers-4.jq create mode 100644 Task/Bernoulli-numbers/jq/bernoulli-numbers-5.jq create mode 100644 Task/Best-shuffle/Phix/best-shuffle.phix create mode 100644 Task/Best-shuffle/Sidef/best-shuffle.sidef create mode 100644 Task/Binary-digits/8th/binary-digits.8th create mode 100644 Task/Binary-digits/Axe/binary-digits.axe create mode 100644 Task/Binary-digits/EchoLisp/binary-digits.echolisp create mode 100644 Task/Binary-digits/FreeBASIC/binary-digits.freebasic create mode 100644 Task/Binary-digits/FunL/binary-digits.funl create mode 100644 Task/Binary-digits/Futhark/binary-digits.futhark create mode 100644 Task/Binary-digits/Idris/binary-digits.idris create mode 100644 Task/Binary-digits/LFE/binary-digits-1.lfe create mode 100644 Task/Binary-digits/LFE/binary-digits-2.lfe create mode 100644 Task/Binary-digits/Nim/binary-digits.nim create mode 100644 Task/Binary-digits/Panda/binary-digits.panda create mode 100644 Task/Binary-digits/Peloton/binary-digits.peloton create mode 100644 Task/Binary-digits/Phix/binary-digits.phix create mode 100644 Task/Binary-digits/Ring/binary-digits.ring create mode 100644 Task/Binary-digits/SequenceL/binary-digits.sequencel create mode 100644 Task/Binary-digits/Sidef/binary-digits.sidef create mode 100644 Task/Binary-digits/SkookumScript/binary-digits.skookum create mode 100644 Task/Binary-digits/Swift/binary-digits.swift create mode 100644 Task/Binary-digits/Visual-FoxPro/binary-digits.visual create mode 100644 Task/Binary-digits/Wortel/binary-digits-1.wortel create mode 100644 Task/Binary-digits/Wortel/binary-digits-2.wortel create mode 100644 Task/Binary-digits/jq/binary-digits.jq create mode 100644 Task/Binary-search/Axe/binary-search.axe create mode 100644 Task/Binary-search/Futhark/binary-search.futhark create mode 100644 Task/Binary-search/Nim/binary-search-1.nim create mode 100644 Task/Binary-search/Nim/binary-search-2.nim create mode 100644 Task/Binary-search/Phix/binary-search-1.phix create mode 100644 Task/Binary-search/Phix/binary-search-2.phix create mode 100644 Task/Binary-search/Ring/binary-search.ring create mode 100644 Task/Binary-search/SequenceL/binary-search.sequencel create mode 100644 Task/Binary-search/Sidef/binary-search-1.sidef create mode 100644 Task/Binary-search/Sidef/binary-search-2.sidef create mode 100644 Task/Binary-search/Sidef/binary-search-3.sidef create mode 100644 Task/Binary-search/Swift/binary-search-1.swift create mode 100644 Task/Binary-search/Swift/binary-search-2.swift create mode 100644 Task/Binary-search/Swift/binary-search-3.swift create mode 100644 Task/Binary-search/Wortel/binary-search.wortel create mode 100644 Task/Binary-search/jq/binary-search-1.jq create mode 100644 Task/Binary-search/jq/binary-search-2.jq create mode 100644 Task/Binary-strings/Nim/binary-strings.nim create mode 100644 Task/Binary-strings/Phix/binary-strings.phix create mode 100644 Task/Binary-strings/Ring/binary-strings.ring create mode 100644 Task/Binary-strings/jq/binary-strings-1.jq create mode 100644 Task/Binary-strings/jq/binary-strings-2.jq create mode 100644 Task/Bitmap-B-zier-curves-Cubic/FreeBASIC/bitmap-b-zier-curves-cubic.freebasic create mode 100644 Task/Bitmap-B-zier-curves-Cubic/Phix/bitmap-b-zier-curves-cubic.phix create mode 100644 Task/Bitmap-B-zier-curves-Quadratic/FreeBASIC/bitmap-b-zier-curves-quadratic.freebasic create mode 100644 Task/Bitmap-B-zier-curves-Quadratic/Phix/bitmap-b-zier-curves-quadratic.phix create mode 100644 Task/Bitmap-Bresenhams-line-algorithm/ERRE/bitmap-bresenhams-line-algorithm.erre create mode 100644 Task/Bitmap-Bresenhams-line-algorithm/FreeBASIC/bitmap-bresenhams-line-algorithm.freebasic create mode 100644 Task/Bitmap-Bresenhams-line-algorithm/Nim/bitmap-bresenhams-line-algorithm.nim create mode 100644 Task/Bitmap-Bresenhams-line-algorithm/Phix/bitmap-bresenhams-line-algorithm.phix create mode 100644 Task/Bitmap-Bresenhams-line-algorithm/Ring/bitmap-bresenhams-line-algorithm.ring create mode 100644 Task/Bitmap-Bresenhams-line-algorithm/Sidef/bitmap-bresenhams-line-algorithm.sidef create mode 100644 Task/Bitmap-Bresenhams-line-algorithm/Wart/bitmap-bresenhams-line-algorithm.wart create mode 100644 Task/Bitmap-Flood-fill/ERRE/bitmap-flood-fill.erre create mode 100644 Task/Bitmap-Flood-fill/FreeBASIC/bitmap-flood-fill.freebasic create mode 100644 Task/Bitmap-Flood-fill/Lingo/bitmap-flood-fill.lingo create mode 100644 Task/Bitmap-Flood-fill/Phix/bitmap-flood-fill.phix create mode 100644 Task/Bitmap-Histogram/Phix/bitmap-histogram.phix create mode 100644 Task/Bitmap-Midpoint-circle-algorithm/ERRE/bitmap-midpoint-circle-algorithm.erre create mode 100644 Task/Bitmap-Midpoint-circle-algorithm/FreeBASIC/bitmap-midpoint-circle-algorithm.freebasic create mode 100644 Task/Bitmap-Midpoint-circle-algorithm/Phix/bitmap-midpoint-circle-algorithm.phix create mode 100644 Task/Bitmap-Read-a-PPM-file/Nim/bitmap-read-a-ppm-file.nim create mode 100644 Task/Bitmap-Read-a-PPM-file/Phix/bitmap-read-a-ppm-file.phix create mode 100644 Task/Bitmap-Write-a-PPM-file/Phix/bitmap-write-a-ppm-file-1.phix create mode 100644 Task/Bitmap-Write-a-PPM-file/Phix/bitmap-write-a-ppm-file-2.phix create mode 100644 Task/Bitmap-Write-a-PPM-file/Sidef/bitmap-write-a-ppm-file.sidef create mode 100644 Task/Bitmap/Axe/bitmap.axe create mode 100644 Task/Bitmap/EchoLisp/bitmap.echolisp create mode 100644 Task/Bitmap/Lingo/bitmap.lingo create mode 100644 Task/Bitmap/Nim/bitmap.nim create mode 100644 Task/Bitmap/Phix/bitmap.phix create mode 100644 Task/Bitmap/SequenceL/bitmap.sequencel create mode 100644 Task/Bitwise-IO/Lingo/bitwise-io-1.lingo create mode 100644 Task/Bitwise-IO/Lingo/bitwise-io-2.lingo create mode 100644 Task/Bitwise-IO/Lingo/bitwise-io-3.lingo create mode 100644 Task/Bitwise-operations/8051-Assembly/bitwise-operations.8051 create mode 100644 Task/Bitwise-operations/Axe/bitwise-operations.axe create mode 100644 Task/Bitwise-operations/ECL/bitwise-operations.ecl create mode 100644 Task/Bitwise-operations/FreeBASIC/bitwise-operations.freebasic create mode 100644 Task/Bitwise-operations/FutureBasic/bitwise-operations.futurebasic create mode 100644 Task/Bitwise-operations/HPPPL/bitwise-operations.hpppl create mode 100644 Task/Bitwise-operations/LFE/bitwise-operations-1.lfe create mode 100644 Task/Bitwise-operations/LFE/bitwise-operations-2.lfe create mode 100644 Task/Bitwise-operations/Lingo/bitwise-operations.lingo create mode 100644 Task/Bitwise-operations/LiveCode/bitwise-operations.livecode create mode 100644 Task/Bitwise-operations/Nim/bitwise-operations.nim create mode 100644 Task/Bitwise-operations/Oforth/bitwise-operations.oforth create mode 100644 Task/Bitwise-operations/Phix/bitwise-operations.phix create mode 100644 Task/Bitwise-operations/Ring/bitwise-operations.ring create mode 100644 Task/Bitwise-operations/Sidef/bitwise-operations.sidef create mode 100644 Task/Bitwise-operations/Swift/bitwise-operations.swift create mode 100644 Task/Boolean-values/8051-Assembly/boolean-values.8051 create mode 100644 Task/Boolean-values/EchoLisp/boolean-values.echolisp create mode 100644 Task/Boolean-values/FreeBASIC/boolean-values.freebasic create mode 100644 Task/Boolean-values/I/boolean-values.i create mode 100644 Task/Boolean-values/Idris/boolean-values.idris create mode 100644 Task/Boolean-values/LFE/boolean-values.lfe create mode 100644 Task/Boolean-values/Lasso/boolean-values-1.lasso create mode 100644 Task/Boolean-values/Lasso/boolean-values-2.lasso create mode 100644 Task/Boolean-values/Lingo/boolean-values.lingo create mode 100644 Task/Boolean-values/Monte/boolean-values.monte create mode 100644 Task/Boolean-values/Nim/boolean-values.nim create mode 100644 Task/Boolean-values/Ring/boolean-values.ring create mode 100644 Task/Boolean-values/Sidef/boolean-values-1.sidef create mode 100644 Task/Boolean-values/Sidef/boolean-values-2.sidef create mode 100644 Task/Boolean-values/Ursa/boolean-values-1.ursa create mode 100644 Task/Boolean-values/Ursa/boolean-values-2.ursa create mode 100644 Task/Boolean-values/Ursa/boolean-values-3.ursa create mode 100644 Task/Box-the-compass/FreeBASIC/box-the-compass.freebasic create mode 100644 Task/Box-the-compass/Lasso/box-the-compass.lasso create mode 100644 Task/Box-the-compass/Nim/box-the-compass.nim create mode 100644 Task/Box-the-compass/Phix/box-the-compass.phix create mode 100644 Task/Box-the-compass/Sidef/box-the-compass.sidef create mode 100644 Task/Break-OO-privacy/Nim/break-oo-privacy-1.nim create mode 100644 Task/Break-OO-privacy/Nim/break-oo-privacy-2.nim create mode 100644 Task/Break-OO-privacy/Nim/break-oo-privacy-3.nim create mode 100644 Task/Break-OO-privacy/Nim/break-oo-privacy-4.nim create mode 100644 Task/Break-OO-privacy/Sidef/break-oo-privacy.sidef create mode 100644 Task/Brownian-tree/Phix/brownian-tree.phix create mode 100644 Task/Bulls-and-cows-Player/Phix/bulls-and-cows-player.phix create mode 100644 Task/Bulls-and-cows-Player/Sidef/bulls-and-cows-player.sidef create mode 100644 Task/Bulls-and-cows/Ceylon/bulls-and-cows.ceylon create mode 100644 Task/Bulls-and-cows/Coco/bulls-and-cows-1.coco create mode 100644 Task/Bulls-and-cows/Coco/bulls-and-cows-2.coco create mode 100644 Task/Bulls-and-cows/Hy/bulls-and-cows.hy create mode 100644 Task/Bulls-and-cows/Lasso/bulls-and-cows.lasso create mode 100644 Task/Bulls-and-cows/Nim/bulls-and-cows.nim create mode 100644 Task/Bulls-and-cows/Oforth/bulls-and-cows.oforth create mode 100644 Task/Bulls-and-cows/Phix/bulls-and-cows.phix create mode 100644 Task/Bulls-and-cows/Sidef/bulls-and-cows.sidef create mode 100644 Task/CRC-32/Lingo/crc-32-1.lingo create mode 100644 Task/CRC-32/Lingo/crc-32-2.lingo create mode 100644 Task/CRC-32/Lingo/crc-32-3.lingo create mode 100644 Task/CRC-32/Nim/crc-32.nim create mode 100644 Task/CRC-32/Phix/crc-32-1.phix create mode 100644 Task/CRC-32/Phix/crc-32-2.phix create mode 100644 Task/CRC-32/Swift/crc-32.swift create mode 100644 Task/CSV-data-manipulation/ECL/csv-data-manipulation.ecl create mode 100644 Task/CSV-data-manipulation/EchoLisp/csv-data-manipulation-1.echolisp create mode 100644 Task/CSV-data-manipulation/EchoLisp/csv-data-manipulation-2.echolisp create mode 100644 Task/CSV-data-manipulation/FreeBASIC/csv-data-manipulation.freebasic create mode 100644 Task/CSV-data-manipulation/FunL/csv-data-manipulation.funl create mode 100644 Task/CSV-data-manipulation/Lingo/csv-data-manipulation-1.lingo create mode 100644 Task/CSV-data-manipulation/Lingo/csv-data-manipulation-2.lingo create mode 100644 Task/CSV-data-manipulation/Nim/csv-data-manipulation.nim create mode 100644 Task/CSV-data-manipulation/Sidef/csv-data-manipulation-1.sidef create mode 100644 Task/CSV-data-manipulation/Sidef/csv-data-manipulation-2.sidef create mode 100644 Task/CSV-data-manipulation/Ursa/csv-data-manipulation.ursa create mode 100644 Task/CSV-data-manipulation/Visual-FoxPro/csv-data-manipulation.visual create mode 100644 Task/CSV-data-manipulation/jq/csv-data-manipulation.jq create mode 100644 Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-1.echolisp create mode 100644 Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-2.echolisp create mode 100644 Task/CSV-to-HTML-translation/Nim/csv-to-html-translation.nim create mode 100644 Task/CSV-to-HTML-translation/Phix/csv-to-html-translation-1.phix create mode 100644 Task/CSV-to-HTML-translation/Phix/csv-to-html-translation-2.phix create mode 100644 Task/CSV-to-HTML-translation/Sidef/csv-to-html-translation-1.sidef create mode 100644 Task/CSV-to-HTML-translation/Sidef/csv-to-html-translation-2.sidef create mode 100644 Task/CSV-to-HTML-translation/jq/csv-to-html-translation-1.jq create mode 100644 Task/CSV-to-HTML-translation/jq/csv-to-html-translation-2.jq create mode 100644 Task/CSV-to-HTML-translation/jq/csv-to-html-translation-3.jq create mode 100644 Task/Caesar-cipher/ERRE/caesar-cipher.erre create mode 100644 Task/Caesar-cipher/FreeBASIC/caesar-cipher.freebasic create mode 100644 Task/Caesar-cipher/GFA-Basic/caesar-cipher.gfa create mode 100644 Task/Caesar-cipher/LiveCode/caesar-cipher.livecode create mode 100644 Task/Caesar-cipher/Nim/caesar-cipher.nim create mode 100644 Task/Caesar-cipher/Oforth/caesar-cipher.oforth create mode 100644 Task/Caesar-cipher/Phix/caesar-cipher.phix create mode 100644 Task/Caesar-cipher/SSEM/caesar-cipher.ssem create mode 100644 Task/Caesar-cipher/SequenceL/caesar-cipher.sequencel create mode 100644 Task/Caesar-cipher/Sidef/caesar-cipher.sidef create mode 100644 Task/Caesar-cipher/TypeScript/caesar-cipher.type create mode 100644 Task/Caesar-cipher/Ursa/caesar-cipher.ursa create mode 100644 Task/Caesar-cipher/Wortel/caesar-cipher.wortel create mode 100644 Task/Caesar-cipher/XLISP/caesar-cipher-1.xlisp create mode 100644 Task/Caesar-cipher/XLISP/caesar-cipher-2.xlisp create mode 100644 Task/Calendar---for-REAL-programmers/FreeBASIC/calendar---for-real-programmers.freebasic create mode 100644 Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-1.phix create mode 100644 Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-2.phix create mode 100644 Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-3.phix create mode 100644 Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-4.phix create mode 100644 Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-5.phix create mode 100644 Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-6.phix create mode 100644 Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-7.phix create mode 100644 Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-8.phix create mode 100644 Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-9.phix create mode 100644 Task/Calendar---for-REAL-programmers/Sidef/calendar---for-real-programmers.sidef create mode 100644 Task/Calendar---for-REAL-programmers/XLISP/calendar---for-real-programmers.xlisp create mode 100644 Task/Calendar/FreeBASIC/calendar.freebasic create mode 100644 Task/Calendar/FutureBasic/calendar.futurebasic create mode 100644 Task/Calendar/Lingo/calendar-1.lingo create mode 100644 Task/Calendar/Lingo/calendar-2.lingo create mode 100644 Task/Calendar/Phix/calendar.phix create mode 100644 Task/Calendar/Sidef/calendar.sidef create mode 100644 Task/Calendar/XLISP/calendar.xlisp create mode 100644 Task/Call-a-foreign-language-function/8th/call-a-foreign-language-function.8th create mode 100644 Task/Call-a-foreign-language-function/FreeBASIC/call-a-foreign-language-function.freebasic create mode 100644 Task/Call-a-foreign-language-function/Luck/call-a-foreign-language-function.luck create mode 100644 Task/Call-a-foreign-language-function/Nim/call-a-foreign-language-function.nim create mode 100644 Task/Call-a-foreign-language-function/Phix/call-a-foreign-language-function.phix create mode 100644 Task/Call-a-foreign-language-function/Swift/call-a-foreign-language-function.swift create mode 100644 Task/Call-a-function-in-a-shared-library/FreeBASIC/call-a-function-in-a-shared-library.freebasic create mode 100644 Task/Call-a-function-in-a-shared-library/Lingo/call-a-function-in-a-shared-library.lingo create mode 100644 Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-1.nim create mode 100644 Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-2.nim create mode 100644 Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-3.nim create mode 100644 Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-4.nim create mode 100644 Task/Call-a-function/AntLang/call-a-function-1.antlang create mode 100644 Task/Call-a-function/AntLang/call-a-function-2.antlang create mode 100644 Task/Call-a-function/Axe/call-a-function-1.axe create mode 100644 Task/Call-a-function/Axe/call-a-function-2.axe create mode 100644 Task/Call-a-function/Axe/call-a-function-3.axe create mode 100644 Task/Call-a-function/Axe/call-a-function-4.axe create mode 100644 Task/Call-a-function/I/call-a-function.i create mode 100644 Task/Call-a-function/LFE/call-a-function-1.lfe create mode 100644 Task/Call-a-function/LFE/call-a-function-2.lfe create mode 100644 Task/Call-a-function/LFE/call-a-function-3.lfe create mode 100644 Task/Call-a-function/LFE/call-a-function-4.lfe create mode 100644 Task/Call-a-function/LFE/call-a-function-5.lfe create mode 100644 Task/Call-a-function/LFE/call-a-function-6.lfe create mode 100644 Task/Call-a-function/LFE/call-a-function-7.lfe create mode 100644 Task/Call-a-function/LFE/call-a-function-8.lfe create mode 100644 Task/Call-a-function/LFE/call-a-function-9.lfe create mode 100644 Task/Call-a-function/Lingo/call-a-function-1.lingo create mode 100644 Task/Call-a-function/Lingo/call-a-function-10.lingo create mode 100644 Task/Call-a-function/Lingo/call-a-function-11.lingo create mode 100644 Task/Call-a-function/Lingo/call-a-function-12.lingo create mode 100644 Task/Call-a-function/Lingo/call-a-function-13.lingo create mode 100644 Task/Call-a-function/Lingo/call-a-function-2.lingo create mode 100644 Task/Call-a-function/Lingo/call-a-function-3.lingo create mode 100644 Task/Call-a-function/Lingo/call-a-function-4.lingo create mode 100644 Task/Call-a-function/Lingo/call-a-function-5.lingo create mode 100644 Task/Call-a-function/Lingo/call-a-function-6.lingo create mode 100644 Task/Call-a-function/Lingo/call-a-function-7.lingo create mode 100644 Task/Call-a-function/Lingo/call-a-function-8.lingo create mode 100644 Task/Call-a-function/Lingo/call-a-function-9.lingo create mode 100644 Task/Call-a-function/Luck/call-a-function.luck create mode 100644 Task/Call-a-function/Nim/call-a-function.nim create mode 100644 Task/Call-a-function/Oforth/call-a-function-1.oforth create mode 100644 Task/Call-a-function/Oforth/call-a-function-2.oforth create mode 100644 Task/Call-a-function/Oforth/call-a-function-3.oforth create mode 100644 Task/Call-a-function/Oforth/call-a-function-4.oforth create mode 100644 Task/Call-a-function/Oforth/call-a-function-5.oforth create mode 100644 Task/Call-a-function/Phix/call-a-function-1.phix create mode 100644 Task/Call-a-function/Phix/call-a-function-2.phix create mode 100644 Task/Call-a-function/Phix/call-a-function-3.phix create mode 100644 Task/Call-a-function/Phix/call-a-function-4.phix create mode 100644 Task/Call-a-function/Phix/call-a-function-5.phix create mode 100644 Task/Call-a-function/Phix/call-a-function-6.phix create mode 100644 Task/Call-a-function/Ring/call-a-function-1.ring create mode 100644 Task/Call-a-function/Ring/call-a-function-2.ring create mode 100644 Task/Call-a-function/Ring/call-a-function-3.ring create mode 100644 Task/Call-a-function/Ring/call-a-function-4.ring create mode 100644 Task/Call-a-function/SSEM/call-a-function.ssem create mode 100644 Task/Call-a-function/Sidef/call-a-function-1.sidef create mode 100644 Task/Call-a-function/Sidef/call-a-function-2.sidef create mode 100644 Task/Call-a-function/Swift/call-a-function.swift create mode 100644 Task/Call-a-function/XLISP/call-a-function.xlisp create mode 100644 Task/Call-an-object-method/Apex/call-an-object-method.apex create mode 100644 Task/Call-an-object-method/ChucK/call-an-object-method.chuck create mode 100644 Task/Call-an-object-method/FreeBASIC/call-an-object-method.freebasic create mode 100644 Task/Call-an-object-method/LFE/call-an-object-method-1.lfe create mode 100644 Task/Call-an-object-method/LFE/call-an-object-method-2.lfe create mode 100644 Task/Call-an-object-method/LFE/call-an-object-method-3.lfe create mode 100644 Task/Call-an-object-method/LFE/call-an-object-method-4.lfe create mode 100644 Task/Call-an-object-method/Lingo/call-an-object-method.lingo create mode 100644 Task/Call-an-object-method/Nim/call-an-object-method.nim create mode 100644 Task/Call-an-object-method/Oforth/call-an-object-method-1.oforth create mode 100644 Task/Call-an-object-method/Oforth/call-an-object-method-2.oforth create mode 100644 Task/Call-an-object-method/Ring/call-an-object-method-1.ring create mode 100644 Task/Call-an-object-method/Ring/call-an-object-method-2.ring create mode 100644 Task/Call-an-object-method/Sidef/call-an-object-method.sidef create mode 100644 Task/Call-an-object-method/Swift/call-an-object-method.swift create mode 100644 Task/Call-an-object-method/Ursa/call-an-object-method.ursa create mode 100644 Task/Call-an-object-method/XLISP/call-an-object-method.xlisp create mode 100644 Task/Carmichael-3-strong-pseudoprimes/EchoLisp/carmichael-3-strong-pseudoprimes-1.echolisp create mode 100644 Task/Carmichael-3-strong-pseudoprimes/EchoLisp/carmichael-3-strong-pseudoprimes-2.echolisp create mode 100644 Task/Carmichael-3-strong-pseudoprimes/FreeBASIC/carmichael-3-strong-pseudoprimes.freebasic create mode 100644 Task/Carmichael-3-strong-pseudoprimes/Sidef/carmichael-3-strong-pseudoprimes.sidef create mode 100644 Task/Case-sensitivity-of-identifiers/EchoLisp/case-sensitivity-of-identifiers.echolisp create mode 100644 Task/Case-sensitivity-of-identifiers/FreeBASIC/case-sensitivity-of-identifiers.freebasic create mode 100644 Task/Case-sensitivity-of-identifiers/Lasso/case-sensitivity-of-identifiers-1.lasso create mode 100644 Task/Case-sensitivity-of-identifiers/Lasso/case-sensitivity-of-identifiers-2.lasso create mode 100644 Task/Case-sensitivity-of-identifiers/Lasso/case-sensitivity-of-identifiers-3.lasso create mode 100644 Task/Case-sensitivity-of-identifiers/NESL/case-sensitivity-of-identifiers.nesl create mode 100644 Task/Case-sensitivity-of-identifiers/Nim/case-sensitivity-of-identifiers.nim create mode 100644 Task/Case-sensitivity-of-identifiers/Oforth/case-sensitivity-of-identifiers.oforth create mode 100644 Task/Case-sensitivity-of-identifiers/Phix/case-sensitivity-of-identifiers.phix create mode 100644 Task/Case-sensitivity-of-identifiers/Ring/case-sensitivity-of-identifiers.ring create mode 100644 Task/Case-sensitivity-of-identifiers/Sidef/case-sensitivity-of-identifiers.sidef create mode 100644 Task/Case-sensitivity-of-identifiers/Swift/case-sensitivity-of-identifiers.swift create mode 100644 Task/Case-sensitivity-of-identifiers/Ursa/case-sensitivity-of-identifiers.ursa create mode 100644 Task/Case-sensitivity-of-identifiers/XLISP/case-sensitivity-of-identifiers.xlisp create mode 100644 Task/Case-sensitivity-of-identifiers/jq/case-sensitivity-of-identifiers-1.jq create mode 100644 Task/Case-sensitivity-of-identifiers/jq/case-sensitivity-of-identifiers-2.jq create mode 100644 Task/Casting-out-nines/Nim/casting-out-nines.nim create mode 100644 Task/Casting-out-nines/jq/casting-out-nines-1.jq create mode 100644 Task/Casting-out-nines/jq/casting-out-nines-2.jq create mode 100644 Task/Casting-out-nines/jq/casting-out-nines-3.jq create mode 100644 Task/Casting-out-nines/jq/casting-out-nines-4.jq create mode 100644 Task/Casting-out-nines/jq/casting-out-nines-5.jq create mode 100644 Task/Casting-out-nines/jq/casting-out-nines-6.jq create mode 100644 Task/Casting-out-nines/jq/casting-out-nines-7.jq create mode 100644 Task/Catalan-numbers-Pascals-triangle/ERRE/catalan-numbers-pascals-triangle.erre create mode 100644 Task/Catalan-numbers-Pascals-triangle/EchoLisp/catalan-numbers-pascals-triangle-1.echolisp create mode 100644 Task/Catalan-numbers-Pascals-triangle/EchoLisp/catalan-numbers-pascals-triangle-2.echolisp create mode 100644 Task/Catalan-numbers-Pascals-triangle/FreeBASIC/catalan-numbers-pascals-triangle.freebasic create mode 100644 Task/Catalan-numbers-Pascals-triangle/Nim/catalan-numbers-pascals-triangle.nim create mode 100644 Task/Catalan-numbers-Pascals-triangle/Oforth/catalan-numbers-pascals-triangle.oforth create mode 100644 Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-1.phix create mode 100644 Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-2.phix create mode 100644 Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-3.phix create mode 100644 Task/Catalan-numbers-Pascals-triangle/Ring/catalan-numbers-pascals-triangle.ring create mode 100644 Task/Catalan-numbers-Pascals-triangle/Sidef/catalan-numbers-pascals-triangle.sidef create mode 100644 Task/Catalan-numbers-Pascals-triangle/jq/catalan-numbers-pascals-triangle-1.jq create mode 100644 Task/Catalan-numbers-Pascals-triangle/jq/catalan-numbers-pascals-triangle-2.jq create mode 100644 Task/Catalan-numbers/ERRE/catalan-numbers.erre create mode 100644 Task/Catalan-numbers/EchoLisp/catalan-numbers.echolisp create mode 100644 Task/Catalan-numbers/FreeBASIC/catalan-numbers.freebasic create mode 100644 Task/Catalan-numbers/FunL/catalan-numbers.funl create mode 100644 Task/Catalan-numbers/Harbour/catalan-numbers.harbour create mode 100644 Task/Catalan-numbers/Nim/catalan-numbers.nim create mode 100644 Task/Catalan-numbers/Oforth/catalan-numbers.oforth create mode 100644 Task/Catalan-numbers/Phix/catalan-numbers.phix create mode 100644 Task/Catalan-numbers/Ring/catalan-numbers.ring create mode 100644 Task/Catalan-numbers/Sidef/catalan-numbers-1.sidef create mode 100644 Task/Catalan-numbers/Sidef/catalan-numbers-2.sidef create mode 100644 Task/Catalan-numbers/Sidef/catalan-numbers-3.sidef create mode 100644 Task/Catalan-numbers/Wortel/catalan-numbers.wortel create mode 100644 Task/Catalan-numbers/jq/catalan-numbers-1.jq create mode 100644 Task/Catalan-numbers/jq/catalan-numbers-2.jq create mode 100644 Task/Catalan-numbers/jq/catalan-numbers-3.jq create mode 100644 Task/Catalan-numbers/jq/catalan-numbers-4.jq create mode 100644 Task/Catalan-numbers/jq/catalan-numbers-5.jq create mode 100644 Task/Catalan-numbers/jq/catalan-numbers-6.jq create mode 100644 Task/Catamorphism/EchoLisp/catamorphism.echolisp create mode 100644 Task/Catamorphism/FreeBASIC/catamorphism.freebasic create mode 100644 Task/Catamorphism/Nim/catamorphism.nim create mode 100644 Task/Catamorphism/Oforth/catamorphism.oforth create mode 100644 Task/Catamorphism/Ring/catamorphism.ring create mode 100644 Task/Catamorphism/Sidef/catamorphism.sidef create mode 100644 Task/Catamorphism/Wortel/catamorphism-1.wortel create mode 100644 Task/Catamorphism/Wortel/catamorphism-2.wortel create mode 100644 Task/Character-codes/Axe/character-codes.axe create mode 100644 Task/Character-codes/FreeBASIC/character-codes.freebasic create mode 100644 Task/Character-codes/I/character-codes.i create mode 100644 Task/Character-codes/LFE/character-codes-1.lfe create mode 100644 Task/Character-codes/LFE/character-codes-2.lfe create mode 100644 Task/Character-codes/Lasso/character-codes.lasso create mode 100644 Task/Character-codes/Lingo/character-codes.lingo create mode 100644 Task/Character-codes/LiveCode/character-codes.livecode create mode 100644 Task/Character-codes/NESL/character-codes-1.nesl create mode 100644 Task/Character-codes/NESL/character-codes-2.nesl create mode 100644 Task/Character-codes/Nim/character-codes.nim create mode 100644 Task/Character-codes/Oforth/character-codes.oforth create mode 100644 Task/Character-codes/Phix/character-codes.phix create mode 100644 Task/Character-codes/Ring/character-codes.ring create mode 100644 Task/Character-codes/SequenceL/character-codes.sequencel create mode 100644 Task/Character-codes/Sidef/character-codes.sidef create mode 100644 Task/Character-codes/Swift/character-codes-1.swift create mode 100644 Task/Character-codes/Swift/character-codes-2.swift create mode 100644 Task/Character-codes/Swift/character-codes-3.swift create mode 100644 Task/Character-codes/Ursa/character-codes.ursa create mode 100644 Task/Character-codes/XLISP/character-codes.xlisp create mode 100644 Task/Character-codes/jq/character-codes-1.jq create mode 100644 Task/Character-codes/jq/character-codes-2.jq create mode 100644 Task/Chat-server/Nim/chat-server.nim create mode 100644 Task/Check-Machin-like-formulas/EchoLisp/check-machin-like-formulas-1.echolisp create mode 100644 Task/Check-Machin-like-formulas/EchoLisp/check-machin-like-formulas-2.echolisp create mode 100644 Task/Check-Machin-like-formulas/Sidef/check-machin-like-formulas.sidef create mode 100644 Task/Check-that-file-exists/Axe/check-that-file-exists.axe create mode 100644 Task/Check-that-file-exists/FreeBASIC/check-that-file-exists.freebasic create mode 100644 Task/Check-that-file-exists/I/check-that-file-exists.i create mode 100644 Task/Check-that-file-exists/LFE/check-that-file-exists.lfe create mode 100644 Task/Check-that-file-exists/Lasso/check-that-file-exists.lasso create mode 100644 Task/Check-that-file-exists/LiveCode/check-that-file-exists-1.livecode create mode 100644 Task/Check-that-file-exists/LiveCode/check-that-file-exists-2.livecode create mode 100644 Task/Check-that-file-exists/Nim/check-that-file-exists.nim create mode 100644 Task/Check-that-file-exists/Phix/check-that-file-exists.phix create mode 100644 Task/Check-that-file-exists/Ring/check-that-file-exists.ring create mode 100644 Task/Check-that-file-exists/Sidef/check-that-file-exists.sidef create mode 100644 Task/Check-that-file-exists/Ursa/check-that-file-exists.ursa create mode 100644 Task/Checkpoint-synchronization/Oforth/checkpoint-synchronization.oforth create mode 100644 Task/Chinese-remainder-theorem/EchoLisp/chinese-remainder-theorem.echolisp create mode 100644 Task/Chinese-remainder-theorem/FunL/chinese-remainder-theorem.funl create mode 100644 Task/Chinese-remainder-theorem/Nim/chinese-remainder-theorem.nim create mode 100644 Task/Chinese-remainder-theorem/Sidef/chinese-remainder-theorem.sidef create mode 100644 Task/Chinese-remainder-theorem/jq/chinese-remainder-theorem.jq create mode 100644 Task/Cholesky-decomposition/Idris/cholesky-decomposition.idris create mode 100644 Task/Cholesky-decomposition/Nim/cholesky-decomposition.nim create mode 100644 Task/Cholesky-decomposition/Sidef/cholesky-decomposition-1.sidef create mode 100644 Task/Cholesky-decomposition/Sidef/cholesky-decomposition-2.sidef create mode 100644 Task/Cholesky-decomposition/jq/cholesky-decomposition-1.jq create mode 100644 Task/Cholesky-decomposition/jq/cholesky-decomposition-2.jq create mode 100644 Task/Cholesky-decomposition/jq/cholesky-decomposition-3.jq create mode 100644 Task/Circles-of-given-radius-through-two-points/ERRE/circles-of-given-radius-through-two-points.erre create mode 100644 Task/Circles-of-given-radius-through-two-points/Nim/circles-of-given-radius-through-two-points.nim create mode 100644 Task/Circles-of-given-radius-through-two-points/Oforth/circles-of-given-radius-through-two-points.oforth create mode 100644 Task/Circles-of-given-radius-through-two-points/Visual-FoxPro/circles-of-given-radius-through-two-points.visual create mode 100644 Task/Circles-of-given-radius-through-two-points/jq/circles-of-given-radius-through-two-points-1.jq create mode 100644 Task/Circles-of-given-radius-through-two-points/jq/circles-of-given-radius-through-two-points-2.jq create mode 100644 Task/Circles-of-given-radius-through-two-points/jq/circles-of-given-radius-through-two-points-3.jq create mode 100644 Task/Classes/Coco/classes.coco create mode 100644 Task/Classes/ERRE/classes.erre create mode 100644 Task/Classes/EchoLisp/classes-1.echolisp create mode 100644 Task/Classes/EchoLisp/classes-2.echolisp create mode 100644 Task/Classes/FreeBASIC/classes.freebasic create mode 100644 Task/Classes/LFE/classes-1.lfe create mode 100644 Task/Classes/LFE/classes-2.lfe create mode 100644 Task/Classes/Lasso/classes.lasso create mode 100644 Task/Classes/Lingo/classes-1.lingo create mode 100644 Task/Classes/Lingo/classes-2.lingo create mode 100644 Task/Classes/Nim/classes.nim create mode 100644 Task/Classes/Oforth/classes-1.oforth create mode 100644 Task/Classes/Oforth/classes-2.oforth create mode 100644 Task/Classes/PHL/classes.phl create mode 100644 Task/Classes/Ring/classes-1.ring create mode 100644 Task/Classes/Ring/classes-2.ring create mode 100644 Task/Classes/Sidef/classes.sidef create mode 100644 Task/Classes/Swift/classes-1.swift create mode 100644 Task/Classes/Swift/classes-2.swift create mode 100644 Task/Classes/Visual-FoxPro/classes.visual create mode 100644 Task/Classes/XLISP/classes.xlisp create mode 100644 Task/Closest-pair-problem/Phix/closest-pair-problem.phix create mode 100644 Task/Closest-pair-problem/Ring/closest-pair-problem.ring create mode 100644 Task/Closest-pair-problem/Sidef/closest-pair-problem.sidef create mode 100644 Task/Closest-pair-problem/Visual-FoxPro/closest-pair-problem.visual create mode 100644 Task/Closest-pair-problem/jq/closest-pair-problem-1.jq create mode 100644 Task/Closest-pair-problem/jq/closest-pair-problem-2.jq create mode 100644 Task/Closest-pair-problem/jq/closest-pair-problem-3.jq create mode 100644 Task/Closures-Value-capture/AntLang/closures-value-capture.antlang create mode 100644 Task/Closures-Value-capture/Ceylon/closures-value-capture.ceylon create mode 100644 Task/Closures-Value-capture/EchoLisp/closures-value-capture.echolisp create mode 100644 Task/Closures-Value-capture/FreeBASIC/closures-value-capture.freebasic create mode 100644 Task/Closures-Value-capture/LFE/closures-value-capture-1.lfe create mode 100644 Task/Closures-Value-capture/LFE/closures-value-capture-2.lfe create mode 100644 Task/Closures-Value-capture/LFE/closures-value-capture-3.lfe create mode 100644 Task/Closures-Value-capture/Lingo/closures-value-capture-1.lingo create mode 100644 Task/Closures-Value-capture/Lingo/closures-value-capture-2.lingo create mode 100644 Task/Closures-Value-capture/Lingo/closures-value-capture-3.lingo create mode 100644 Task/Closures-Value-capture/Nim/closures-value-capture.nim create mode 100644 Task/Closures-Value-capture/Oforth/closures-value-capture.oforth create mode 100644 Task/Closures-Value-capture/Ring/closures-value-capture.ring create mode 100644 Task/Closures-Value-capture/Sidef/closures-value-capture-1.sidef create mode 100644 Task/Closures-Value-capture/Sidef/closures-value-capture-2.sidef create mode 100644 Task/Closures-Value-capture/Sparkling/closures-value-capture-1.sparkling create mode 100644 Task/Closures-Value-capture/Sparkling/closures-value-capture-2.sparkling create mode 100644 Task/Closures-Value-capture/Swift/closures-value-capture-1.swift create mode 100644 Task/Closures-Value-capture/Swift/closures-value-capture-2.swift create mode 100644 Task/Closures-Value-capture/Swift/closures-value-capture-3.swift create mode 100644 Task/Closures-Value-capture/Swift/closures-value-capture-4.swift create mode 100644 Task/Collections/Apex/collections-1.apex create mode 100644 Task/Collections/Apex/collections-2.apex create mode 100644 Task/Collections/Apex/collections-3.apex create mode 100644 Task/Collections/Apex/collections-4.apex create mode 100644 Task/Collections/Apex/collections-5.apex create mode 100644 Task/Collections/Apex/collections-6.apex create mode 100644 Task/Collections/Apex/collections-7.apex create mode 100644 Task/Collections/Axe/collections.axe create mode 100644 Task/Collections/EchoLisp/collections.echolisp create mode 100644 Task/Collections/FreeBASIC/collections.freebasic create mode 100644 Task/Collections/Lingo/collections.lingo create mode 100644 Task/Collections/Nim/collections-1.nim create mode 100644 Task/Collections/Nim/collections-2.nim create mode 100644 Task/Collections/Nim/collections-3.nim create mode 100644 Task/Collections/Nim/collections-4.nim create mode 100644 Task/Collections/Nim/collections-5.nim create mode 100644 Task/Collections/Nim/collections-6.nim create mode 100644 Task/Collections/Nim/collections-7.nim create mode 100644 Task/Collections/Oforth/collections-1.oforth create mode 100644 Task/Collections/Oforth/collections-2.oforth create mode 100644 Task/Collections/Phix/collections-1.phix create mode 100644 Task/Collections/Phix/collections-2.phix create mode 100644 Task/Collections/Sidef/collections-1.sidef create mode 100644 Task/Collections/Sidef/collections-2.sidef create mode 100644 Task/Collections/Sidef/collections-3.sidef create mode 100644 Task/Collections/Sidef/collections-4.sidef create mode 100644 Task/Collections/Visual-FoxPro/collections.visual create mode 100644 Task/Collections/Wren/collections.wren create mode 100644 Task/Collections/jq/collections-1.jq create mode 100644 Task/Collections/jq/collections-2.jq create mode 100644 Task/Collections/jq/collections-3.jq create mode 100644 Task/Color-of-a-screen-pixel/Axe/color-of-a-screen-pixel.axe create mode 100644 Task/Color-of-a-screen-pixel/FreeBASIC/color-of-a-screen-pixel.freebasic create mode 100644 Task/Color-of-a-screen-pixel/Lingo/color-of-a-screen-pixel.lingo create mode 100644 Task/Color-of-a-screen-pixel/Nim/color-of-a-screen-pixel.nim create mode 100644 Task/Color-of-a-screen-pixel/Ring/color-of-a-screen-pixel.ring create mode 100644 Task/Colour-bars-Display/FreeBASIC/colour-bars-display.freebasic create mode 100644 Task/Colour-bars-Display/Ring/colour-bars-display.ring create mode 100644 Task/Colour-bars-Display/Sidef/colour-bars-display.sidef create mode 100644 Task/Combinations-and-permutations/EchoLisp/combinations-and-permutations.echolisp create mode 100644 Task/Combinations-and-permutations/Nim/combinations-and-permutations.nim create mode 100644 Task/Combinations-and-permutations/Phix/combinations-and-permutations-1.phix create mode 100644 Task/Combinations-and-permutations/Phix/combinations-and-permutations-2.phix create mode 100644 Task/Combinations-and-permutations/Sidef/combinations-and-permutations.sidef create mode 100644 Task/Combinations-and-permutations/jq/combinations-and-permutations.jq create mode 100644 Task/Combinations-with-repetitions/EchoLisp/combinations-with-repetitions.echolisp create mode 100644 Task/Combinations-with-repetitions/Egison/combinations-with-repetitions.egison create mode 100644 Task/Combinations-with-repetitions/LFE/combinations-with-repetitions-1.lfe create mode 100644 Task/Combinations-with-repetitions/LFE/combinations-with-repetitions-2.lfe create mode 100644 Task/Combinations-with-repetitions/LFE/combinations-with-repetitions-3.lfe create mode 100644 Task/Combinations-with-repetitions/Nim/combinations-with-repetitions.nim create mode 100644 Task/Combinations-with-repetitions/Phix/combinations-with-repetitions-1.phix create mode 100644 Task/Combinations-with-repetitions/Phix/combinations-with-repetitions-2.phix create mode 100644 Task/Combinations-with-repetitions/Sidef/combinations-with-repetitions.sidef create mode 100644 Task/Combinations-with-repetitions/Swift/combinations-with-repetitions.swift create mode 100644 Task/Combinations-with-repetitions/jq/combinations-with-repetitions-1.jq create mode 100644 Task/Combinations-with-repetitions/jq/combinations-with-repetitions-2.jq create mode 100644 Task/Combinations/ERRE/combinations.erre create mode 100644 Task/Combinations/EchoLisp/combinations.echolisp create mode 100644 Task/Combinations/Egison/combinations.egison create mode 100644 Task/Combinations/Nim/combinations.nim create mode 100644 Task/Combinations/Perl5i/combinations.perl5i create mode 100644 Task/Combinations/Phix/combinations.phix create mode 100644 Task/Combinations/Pyret/combinations.pyret create mode 100644 Task/Combinations/SPAD/combinations.spad create mode 100644 Task/Combinations/Sidef/combinations-1.sidef create mode 100644 Task/Combinations/Sidef/combinations-2.sidef create mode 100644 Task/Combinations/Sidef/combinations-3.sidef create mode 100644 Task/Combinations/Swift/combinations.swift create mode 100644 Task/Combinations/jq/combinations.jq create mode 100644 Task/Comma-quibbling/EchoLisp/comma-quibbling.echolisp create mode 100644 Task/Comma-quibbling/FreeBASIC/comma-quibbling.freebasic create mode 100644 Task/Comma-quibbling/Lasso/comma-quibbling.lasso create mode 100644 Task/Comma-quibbling/Nim/comma-quibbling.nim create mode 100644 Task/Comma-quibbling/Oforth/comma-quibbling.oforth create mode 100644 Task/Comma-quibbling/Sidef/comma-quibbling.sidef create mode 100644 Task/Comma-quibbling/Swift/comma-quibbling.swift create mode 100644 Task/Comma-quibbling/XLISP/comma-quibbling.xlisp create mode 100644 Task/Comma-quibbling/jq/comma-quibbling-1.jq create mode 100644 Task/Comma-quibbling/jq/comma-quibbling-2.jq create mode 100644 Task/Comma-quibbling/jq/comma-quibbling-3.jq create mode 100644 Task/Command-line-arguments/FreeBASIC/command-line-arguments.freebasic create mode 100644 Task/Command-line-arguments/FunL/command-line-arguments.funl create mode 100644 Task/Command-line-arguments/Harbour/command-line-arguments.harbour create mode 100644 Task/Command-line-arguments/LFE/command-line-arguments-1.lfe create mode 100644 Task/Command-line-arguments/LFE/command-line-arguments-2.lfe create mode 100644 Task/Command-line-arguments/LFE/command-line-arguments-3.lfe create mode 100644 Task/Command-line-arguments/Lasso/command-line-arguments-1.lasso create mode 100644 Task/Command-line-arguments/Lasso/command-line-arguments-2.lasso create mode 100644 Task/Command-line-arguments/Lingo/command-line-arguments-1.lingo create mode 100644 Task/Command-line-arguments/Lingo/command-line-arguments-2.lingo create mode 100644 Task/Command-line-arguments/Nim/command-line-arguments.nim create mode 100644 Task/Command-line-arguments/Oforth/command-line-arguments.oforth create mode 100644 Task/Command-line-arguments/Phix/command-line-arguments.phix create mode 100644 Task/Command-line-arguments/Ring/command-line-arguments.ring create mode 100644 Task/Command-line-arguments/Sidef/command-line-arguments.sidef create mode 100644 Task/Command-line-arguments/Swift/command-line-arguments-1.swift create mode 100644 Task/Command-line-arguments/Swift/command-line-arguments-2.swift create mode 100644 Task/Command-line-arguments/Swift/command-line-arguments-3.swift create mode 100644 Task/Command-line-arguments/Ursa/command-line-arguments.ursa create mode 100644 Task/Comments/AntLang/comments.antlang create mode 100644 Task/Comments/Apex/comments.apex create mode 100644 Task/Comments/Axe/comments-1.axe create mode 100644 Task/Comments/Axe/comments-2.axe create mode 100644 Task/Comments/Axe/comments-3.axe create mode 100644 Task/Comments/Axe/comments-4.axe create mode 100644 Task/Comments/Axe/comments-5.axe create mode 100644 Task/Comments/ChucK/comments.chuck create mode 100644 Task/Comments/ECL/comments-1.ecl create mode 100644 Task/Comments/ECL/comments-2.ecl create mode 100644 Task/Comments/EDSAC-order-code/comments.edsac create mode 100644 Task/Comments/ERRE/comments.erre create mode 100644 Task/Comments/EchoLisp/comments.echolisp create mode 100644 Task/Comments/Elm/comments.elm create mode 100644 Task/Comments/FUZE-BASIC/comments.fuze create mode 100644 Task/Comments/FreeBASIC/comments.freebasic create mode 100644 Task/Comments/Futhark/comments.futhark create mode 100644 Task/Comments/Gri/comments-1.gri create mode 100644 Task/Comments/Gri/comments-2.gri create mode 100644 Task/Comments/Lasso/comments.lasso create mode 100644 Task/Comments/Lily/comments-1.lily create mode 100644 Task/Comments/Lily/comments-2.lily create mode 100644 Task/Comments/Lingo/comments.lingo create mode 100644 Task/Comments/LiveCode/comments.livecode create mode 100644 Task/Comments/Monte/comments.monte create mode 100644 Task/Comments/NESL/comments.nesl create mode 100644 Task/Comments/Nim/comments.nim create mode 100644 Task/Comments/Oforth/comments.oforth create mode 100644 Task/Comments/Peloton/comments.peloton create mode 100644 Task/Comments/Phix/comments-1.phix create mode 100644 Task/Comments/Phix/comments-2.phix create mode 100644 Task/Comments/Ring/comments-1.ring create mode 100644 Task/Comments/Ring/comments-2.ring create mode 100644 Task/Comments/SSEM/comments.ssem create mode 100644 Task/Comments/Set-lang/comments.set create mode 100644 Task/Comments/Sidef/comments-1.sidef create mode 100644 Task/Comments/Sidef/comments-2.sidef create mode 100644 Task/Comments/Sidef/comments-3.sidef create mode 100644 Task/Comments/Sidef/comments-4.sidef create mode 100644 Task/Comments/Swift/comments.swift create mode 100644 Task/Comments/Ursa/comments.ursa create mode 100644 Task/Comments/Wart/comments.wart create mode 100644 Task/Comments/XLISP/comments.xlisp create mode 100644 Task/Comments/jq/comments.jq create mode 100644 Task/Compile-time-calculation/EchoLisp/compile-time-calculation.echolisp create mode 100644 Task/Compile-time-calculation/FreeBASIC/compile-time-calculation.freebasic create mode 100644 Task/Compile-time-calculation/Lingo/compile-time-calculation.lingo create mode 100644 Task/Compile-time-calculation/Nim/compile-time-calculation-1.nim create mode 100644 Task/Compile-time-calculation/Nim/compile-time-calculation-2.nim create mode 100644 Task/Compile-time-calculation/Oforth/compile-time-calculation-1.oforth create mode 100644 Task/Compile-time-calculation/Oforth/compile-time-calculation-2.oforth create mode 100644 Task/Compile-time-calculation/Phix/compile-time-calculation.phix create mode 100644 Task/Compile-time-calculation/Ring/compile-time-calculation.ring create mode 100644 Task/Compile-time-calculation/Sidef/compile-time-calculation-1.sidef create mode 100644 Task/Compile-time-calculation/Sidef/compile-time-calculation-2.sidef create mode 100644 Task/Compile-time-calculation/XLISP/compile-time-calculation-1.xlisp create mode 100644 Task/Compile-time-calculation/XLISP/compile-time-calculation-2.xlisp create mode 100644 Task/Compile-time-calculation/XLISP/compile-time-calculation-3.xlisp create mode 100644 Task/Compound-data-type/Axe/compound-data-type-1.axe create mode 100644 Task/Compound-data-type/Axe/compound-data-type-2.axe create mode 100644 Task/Compound-data-type/EchoLisp/compound-data-type.echolisp create mode 100644 Task/Compound-data-type/FreeBASIC/compound-data-type.freebasic create mode 100644 Task/Compound-data-type/LFE/compound-data-type.lfe create mode 100644 Task/Compound-data-type/Lasso/compound-data-type.lasso create mode 100644 Task/Compound-data-type/Lingo/compound-data-type-1.lingo create mode 100644 Task/Compound-data-type/Lingo/compound-data-type-2.lingo create mode 100644 Task/Compound-data-type/Lingo/compound-data-type-3.lingo create mode 100644 Task/Compound-data-type/Lingo/compound-data-type-4.lingo create mode 100644 Task/Compound-data-type/Nim/compound-data-type.nim create mode 100644 Task/Compound-data-type/Oforth/compound-data-type.oforth create mode 100644 Task/Compound-data-type/Phix/compound-data-type.phix create mode 100644 Task/Compound-data-type/Ring/compound-data-type-1.ring create mode 100644 Task/Compound-data-type/Ring/compound-data-type-2.ring create mode 100644 Task/Compound-data-type/Shen/compound-data-type-1.shen create mode 100644 Task/Compound-data-type/Shen/compound-data-type-2.shen create mode 100644 Task/Compound-data-type/Sidef/compound-data-type.sidef create mode 100644 Task/Compound-data-type/Swift/compound-data-type.swift create mode 100644 Task/Compound-data-type/jq/compound-data-type-1.jq create mode 100644 Task/Compound-data-type/jq/compound-data-type-2.jq create mode 100644 Task/Concurrent-computing/EchoLisp/concurrent-computing.echolisp create mode 100644 Task/Concurrent-computing/FreeBASIC/concurrent-computing.freebasic create mode 100644 Task/Concurrent-computing/LFE/concurrent-computing.lfe create mode 100644 Task/Concurrent-computing/Nim/concurrent-computing-1.nim create mode 100644 Task/Concurrent-computing/Nim/concurrent-computing-2.nim create mode 100644 Task/Concurrent-computing/Nim/concurrent-computing-3.nim create mode 100644 Task/Concurrent-computing/Oforth/concurrent-computing-1.oforth create mode 100644 Task/Concurrent-computing/Oforth/concurrent-computing-2.oforth create mode 100644 Task/Concurrent-computing/Phix/concurrent-computing.phix create mode 100644 Task/Concurrent-computing/Sidef/concurrent-computing.sidef create mode 100644 Task/Concurrent-computing/Swift/concurrent-computing.swift create mode 100644 Task/Conditional-structures/Apex/conditional-structures-1.apex create mode 100644 Task/Conditional-structures/Apex/conditional-structures-2.apex create mode 100644 Task/Conditional-structures/Apex/conditional-structures-3.apex create mode 100644 Task/Conditional-structures/Apex/conditional-structures-4.apex create mode 100644 Task/Conditional-structures/Axe/conditional-structures-1.axe create mode 100644 Task/Conditional-structures/Axe/conditional-structures-2.axe create mode 100644 Task/Conditional-structures/Axe/conditional-structures-3.axe create mode 100644 Task/Conditional-structures/Axe/conditional-structures-4.axe create mode 100644 Task/Conditional-structures/Axe/conditional-structures-5.axe create mode 100644 Task/Conditional-structures/Comal/conditional-structures-1.comal create mode 100644 Task/Conditional-structures/Comal/conditional-structures-2.comal create mode 100644 Task/Conditional-structures/Comal/conditional-structures-3.comal create mode 100644 Task/Conditional-structures/Comal/conditional-structures-4.comal create mode 100644 Task/Conditional-structures/FreeBASIC/conditional-structures-1.freebasic create mode 100644 Task/Conditional-structures/FreeBASIC/conditional-structures-2.freebasic create mode 100644 Task/Conditional-structures/FreeBASIC/conditional-structures-3.freebasic create mode 100644 Task/Conditional-structures/FreeBASIC/conditional-structures-4.freebasic create mode 100644 Task/Conditional-structures/FreeBASIC/conditional-structures-5.freebasic create mode 100644 Task/Conditional-structures/FreeBASIC/conditional-structures-6.freebasic create mode 100644 Task/Conditional-structures/FreeBASIC/conditional-structures-7.freebasic create mode 100644 Task/Conditional-structures/FreeBASIC/conditional-structures-8.freebasic create mode 100644 Task/Conditional-structures/FreeBASIC/conditional-structures-9.freebasic create mode 100644 Task/Conditional-structures/Futhark/conditional-structures.futhark create mode 100644 Task/Conditional-structures/HPPPL/conditional-structures-1.hpppl create mode 100644 Task/Conditional-structures/HPPPL/conditional-structures-2.hpppl create mode 100644 Task/Conditional-structures/Harbour/conditional-structures-1.harbour create mode 100644 Task/Conditional-structures/Harbour/conditional-structures-2.harbour create mode 100644 Task/Conditional-structures/Harbour/conditional-structures-3.harbour create mode 100644 Task/Conditional-structures/I/conditional-structures.i create mode 100644 Task/Conditional-structures/LC3-Assembly/conditional-structures-1.lc3 create mode 100644 Task/Conditional-structures/LC3-Assembly/conditional-structures-2.lc3 create mode 100644 Task/Conditional-structures/Monicelli/conditional-structures.monicelli create mode 100644 Task/Conditional-structures/Morfa/conditional-structures-1.morfa create mode 100644 Task/Conditional-structures/Morfa/conditional-structures-2.morfa create mode 100644 Task/Conditional-structures/Morfa/conditional-structures-3.morfa create mode 100644 Task/Conditional-structures/Morfa/conditional-structures-4.morfa create mode 100644 Task/Conditional-structures/Nim/conditional-structures-1.nim create mode 100644 Task/Conditional-structures/Nim/conditional-structures-2.nim create mode 100644 Task/Conditional-structures/Oforth/conditional-structures-1.oforth create mode 100644 Task/Conditional-structures/Oforth/conditional-structures-2.oforth create mode 100644 Task/Conditional-structures/Oforth/conditional-structures-3.oforth create mode 100644 Task/Conditional-structures/PHL/conditional-structures.phl create mode 100644 Task/Conditional-structures/Ring/conditional-structures-1.ring create mode 100644 Task/Conditional-structures/Ring/conditional-structures-2.ring create mode 100644 Task/Conditional-structures/SSEM/conditional-structures.ssem create mode 100644 Task/Conditional-structures/jq/conditional-structures-1.jq create mode 100644 Task/Conditional-structures/jq/conditional-structures-2.jq create mode 100644 Task/Conditional-structures/jq/conditional-structures-3.jq create mode 100644 Task/Conditional-structures/jq/conditional-structures-4.jq create mode 100644 Task/Conjugate-transpose/Sparkling/conjugate-transpose.sparkling create mode 100644 Task/Conjugate-transpose/jq/conjugate-transpose-1.jq create mode 100644 Task/Conjugate-transpose/jq/conjugate-transpose-2.jq create mode 100644 Task/Conjugate-transpose/jq/conjugate-transpose-3.jq create mode 100644 Task/Conjugate-transpose/jq/conjugate-transpose-4.jq create mode 100644 Task/Conjugate-transpose/jq/conjugate-transpose-5.jq create mode 100644 Task/Conjugate-transpose/jq/conjugate-transpose-6.jq create mode 100644 Task/Conjugate-transpose/jq/conjugate-transpose-7.jq create mode 100644 Task/Constrained-genericity/Morfa/constrained-genericity-1.morfa create mode 100644 Task/Constrained-genericity/Morfa/constrained-genericity-2.morfa create mode 100644 Task/Constrained-genericity/Nim/constrained-genericity.nim create mode 100644 Task/Constrained-genericity/Sidef/constrained-genericity.sidef create mode 100644 Task/Constrained-genericity/Swift/constrained-genericity-1.swift create mode 100644 Task/Constrained-genericity/Swift/constrained-genericity-2.swift create mode 100644 Task/Constrained-genericity/Swift/constrained-genericity-3.swift create mode 100644 Task/Constrained-random-points-on-a-circle/EchoLisp/constrained-random-points-on-a-circle.echolisp create mode 100644 Task/Constrained-random-points-on-a-circle/Hy/constrained-random-points-on-a-circle.hy create mode 100644 Task/Constrained-random-points-on-a-circle/Nim/constrained-random-points-on-a-circle.nim create mode 100644 Task/Constrained-random-points-on-a-circle/Phix/constrained-random-points-on-a-circle.phix create mode 100644 Task/Constrained-random-points-on-a-circle/Ring/constrained-random-points-on-a-circle.ring create mode 100644 Task/Constrained-random-points-on-a-circle/Sidef/constrained-random-points-on-a-circle.sidef create mode 100644 Task/Continued-fraction-Arithmetic-Construct-from-rational-number/Sidef/continued-fraction-arithmetic-construct-from-rational-number.sidef create mode 100644 Task/Continued-fraction/Sidef/continued-fraction.sidef create mode 100644 Task/Continued-fraction/jq/continued-fraction-1.jq create mode 100644 Task/Continued-fraction/jq/continued-fraction-2.jq create mode 100644 Task/Continued-fraction/jq/continued-fraction-3.jq create mode 100644 Task/Convert-decimal-number-to-rational/EchoLisp/convert-decimal-number-to-rational.echolisp create mode 100644 Task/Convert-decimal-number-to-rational/FreeBASIC/convert-decimal-number-to-rational.freebasic create mode 100644 Task/Convert-decimal-number-to-rational/Phix/convert-decimal-number-to-rational.phix create mode 100644 Task/Convert-decimal-number-to-rational/Sidef/convert-decimal-number-to-rational-1.sidef create mode 100644 Task/Convert-decimal-number-to-rational/Sidef/convert-decimal-number-to-rational-2.sidef create mode 100644 Task/Conways-Game-of-Life/Axe/conways-game-of-life.axe create mode 100644 Task/Conways-Game-of-Life/FunL/conways-game-of-life.funl create mode 100644 Task/Conways-Game-of-Life/Futhark/conways-game-of-life.futhark create mode 100644 Task/Conways-Game-of-Life/Nim/conways-game-of-life.nim create mode 100644 Task/Conways-Game-of-Life/SequenceL/conways-game-of-life-1.sequencel create mode 100644 Task/Conways-Game-of-Life/SequenceL/conways-game-of-life-2.sequencel create mode 100644 Task/Conways-Game-of-Life/Shen/conways-game-of-life.shen create mode 100644 Task/Conways-Game-of-Life/Sidef/conways-game-of-life.sidef create mode 100644 Task/Conways-Game-of-Life/Wortel/conways-game-of-life-1.wortel create mode 100644 Task/Conways-Game-of-Life/Wortel/conways-game-of-life-2.wortel create mode 100644 Task/Conways-Game-of-Life/jq/conways-game-of-life-1.jq create mode 100644 Task/Conways-Game-of-Life/jq/conways-game-of-life-2.jq create mode 100644 Task/Conways-Game-of-Life/jq/conways-game-of-life-3.jq create mode 100644 Task/Conways-Game-of-Life/jq/conways-game-of-life-4.jq create mode 100644 Task/Conways-Game-of-Life/jq/conways-game-of-life-5.jq create mode 100644 Task/Conways-Game-of-Life/jq/conways-game-of-life-6.jq create mode 100644 Task/Copy-a-string/Apex/copy-a-string.apex create mode 100644 Task/Copy-a-string/Axe/copy-a-string.axe create mode 100644 Task/Copy-a-string/Computer-zero-Assembly/copy-a-string.computer create mode 100644 Task/Copy-a-string/EchoLisp/copy-a-string.echolisp create mode 100644 Task/Copy-a-string/FreeBASIC/copy-a-string.freebasic create mode 100644 Task/Copy-a-string/FutureBasic/copy-a-string.futurebasic create mode 100644 Task/Copy-a-string/I/copy-a-string.i create mode 100644 Task/Copy-a-string/LC3-Assembly/copy-a-string.lc3 create mode 100644 Task/Copy-a-string/LFE/copy-a-string-1.lfe create mode 100644 Task/Copy-a-string/LFE/copy-a-string-2.lfe create mode 100644 Task/Copy-a-string/Lasso/copy-a-string.lasso create mode 100644 Task/Copy-a-string/Lingo/copy-a-string-1.lingo create mode 100644 Task/Copy-a-string/Lingo/copy-a-string-2.lingo create mode 100644 Task/Copy-a-string/LiveCode/copy-a-string.livecode create mode 100644 Task/Copy-a-string/Nim/copy-a-string.nim create mode 100644 Task/Copy-a-string/Oforth/copy-a-string-1.oforth create mode 100644 Task/Copy-a-string/Oforth/copy-a-string-2.oforth create mode 100644 Task/Copy-a-string/Phix/copy-a-string.phix create mode 100644 Task/Copy-a-string/Ring/copy-a-string.ring create mode 100644 Task/Copy-a-string/Sidef/copy-a-string.sidef create mode 100644 Task/Copy-a-string/Swift/copy-a-string.swift create mode 100644 Task/Copy-a-string/Ursa/copy-a-string.ursa create mode 100644 Task/Copy-a-string/jq/copy-a-string.jq create mode 100644 Task/Count-in-factors/EchoLisp/count-in-factors.echolisp create mode 100644 Task/Count-in-factors/FreeBASIC/count-in-factors.freebasic create mode 100644 Task/Count-in-factors/Nim/count-in-factors.nim create mode 100644 Task/Count-in-factors/Phix/count-in-factors.phix create mode 100644 Task/Count-in-factors/Ring/count-in-factors.ring create mode 100644 Task/Count-in-factors/Sidef/count-in-factors.sidef create mode 100644 Task/Count-in-octal/FreeBASIC/count-in-octal.freebasic create mode 100644 Task/Count-in-octal/Futhark/count-in-octal.futhark create mode 100644 Task/Count-in-octal/FutureBasic/count-in-octal.futurebasic create mode 100644 Task/Count-in-octal/LFE/count-in-octal.lfe create mode 100644 Task/Count-in-octal/Nim/count-in-octal.nim create mode 100644 Task/Count-in-octal/Phix/count-in-octal.phix create mode 100644 Task/Count-in-octal/Ring/count-in-octal.ring create mode 100644 Task/Count-in-octal/Sidef/count-in-octal.sidef create mode 100644 Task/Count-in-octal/Sparkling/count-in-octal.sparkling create mode 100644 Task/Count-in-octal/Swift/count-in-octal.swift create mode 100644 Task/Count-occurrences-of-a-substring/Apex/count-occurrences-of-a-substring.apex create mode 100644 Task/Count-occurrences-of-a-substring/EchoLisp/count-occurrences-of-a-substring.echolisp create mode 100644 Task/Count-occurrences-of-a-substring/FreeBASIC/count-occurrences-of-a-substring.freebasic create mode 100644 Task/Count-occurrences-of-a-substring/FunL/count-occurrences-of-a-substring.funl create mode 100644 Task/Count-occurrences-of-a-substring/Lasso/count-occurrences-of-a-substring.lasso create mode 100644 Task/Count-occurrences-of-a-substring/Nim/count-occurrences-of-a-substring.nim create mode 100644 Task/Count-occurrences-of-a-substring/Oforth/count-occurrences-of-a-substring.oforth create mode 100644 Task/Count-occurrences-of-a-substring/Phix/count-occurrences-of-a-substring.phix create mode 100644 Task/Count-occurrences-of-a-substring/Ring/count-occurrences-of-a-substring.ring create mode 100644 Task/Count-occurrences-of-a-substring/Sidef/count-occurrences-of-a-substring-1.sidef create mode 100644 Task/Count-occurrences-of-a-substring/Sidef/count-occurrences-of-a-substring-2.sidef create mode 100644 Task/Count-occurrences-of-a-substring/Wortel/count-occurrences-of-a-substring.wortel create mode 100644 Task/Count-occurrences-of-a-substring/jq/count-occurrences-of-a-substring-1.jq create mode 100644 Task/Count-occurrences-of-a-substring/jq/count-occurrences-of-a-substring-2.jq create mode 100644 Task/Count-the-coins/Coco/count-the-coins.coco create mode 100644 Task/Count-the-coins/EchoLisp/count-the-coins-1.echolisp create mode 100644 Task/Count-the-coins/EchoLisp/count-the-coins-2.echolisp create mode 100644 Task/Count-the-coins/FreeBASIC/count-the-coins.freebasic create mode 100644 Task/Count-the-coins/FutureBasic/count-the-coins.futurebasic create mode 100644 Task/Count-the-coins/Lasso/count-the-coins.lasso create mode 100644 Task/Count-the-coins/Nim/count-the-coins.nim create mode 100644 Task/Count-the-coins/Sidef/count-the-coins.sidef create mode 100644 Task/Count-the-coins/jq/count-the-coins.jq create mode 100644 Task/Create-a-file-on-magnetic-tape/Nim/create-a-file-on-magnetic-tape.nim create mode 100644 Task/Create-a-file/Axe/create-a-file.axe create mode 100644 Task/Create-a-file/ChucK/create-a-file.chuck create mode 100644 Task/Create-a-file/ERRE/create-a-file.erre create mode 100644 Task/Create-a-file/EchoLisp/create-a-file.echolisp create mode 100644 Task/Create-a-file/FreeBASIC/create-a-file.freebasic create mode 100644 Task/Create-a-file/FunL/create-a-file.funl create mode 100644 Task/Create-a-file/I/create-a-file.i create mode 100644 Task/Create-a-file/LFE/create-a-file.lfe create mode 100644 Task/Create-a-file/Lasso/create-a-file.lasso create mode 100644 Task/Create-a-file/Lingo/create-a-file-1.lingo create mode 100644 Task/Create-a-file/Lingo/create-a-file-2.lingo create mode 100644 Task/Create-a-file/Lingo/create-a-file-3.lingo create mode 100644 Task/Create-a-file/Nim/create-a-file-1.nim create mode 100644 Task/Create-a-file/Nim/create-a-file-2.nim create mode 100644 Task/Create-a-file/Phix/create-a-file.phix create mode 100644 Task/Create-a-file/Ring/create-a-file.ring create mode 100644 Task/Create-a-file/Sidef/create-a-file.sidef create mode 100644 Task/Create-a-file/Ursa/create-a-file.ursa create mode 100644 Task/Create-a-two-dimensional-array-at-runtime/ERRE/create-a-two-dimensional-array-at-runtime.erre create mode 100644 Task/Create-a-two-dimensional-array-at-runtime/FreeBASIC/create-a-two-dimensional-array-at-runtime.freebasic create mode 100644 Task/Create-a-two-dimensional-array-at-runtime/Nim/create-a-two-dimensional-array-at-runtime.nim create mode 100644 Task/Create-a-two-dimensional-array-at-runtime/Phix/create-a-two-dimensional-array-at-runtime.phix create mode 100644 Task/Create-a-two-dimensional-array-at-runtime/Ring/create-a-two-dimensional-array-at-runtime.ring create mode 100644 Task/Create-a-two-dimensional-array-at-runtime/Sidef/create-a-two-dimensional-array-at-runtime.sidef create mode 100644 Task/Create-a-two-dimensional-array-at-runtime/Swift/create-a-two-dimensional-array-at-runtime.swift create mode 100644 Task/Create-a-two-dimensional-array-at-runtime/Ursa/create-a-two-dimensional-array-at-runtime.ursa create mode 100644 Task/Create-a-two-dimensional-array-at-runtime/jq/create-a-two-dimensional-array-at-runtime-1.jq create mode 100644 Task/Create-a-two-dimensional-array-at-runtime/jq/create-a-two-dimensional-array-at-runtime-2.jq create mode 100644 Task/Create-an-HTML-table/EchoLisp/create-an-html-table-1.echolisp create mode 100644 Task/Create-an-HTML-table/EchoLisp/create-an-html-table-2.echolisp create mode 100644 Task/Create-an-HTML-table/Lasso/create-an-html-table.lasso create mode 100644 Task/Create-an-HTML-table/Lingo/create-an-html-table-1.lingo create mode 100644 Task/Create-an-HTML-table/Lingo/create-an-html-table-2.lingo create mode 100644 Task/Create-an-HTML-table/Nim/create-an-html-table.nim create mode 100644 Task/Create-an-HTML-table/Peloton/create-an-html-table.peloton create mode 100644 Task/Create-an-HTML-table/Phix/create-an-html-table-1.phix create mode 100644 Task/Create-an-HTML-table/Phix/create-an-html-table-2.phix create mode 100644 Task/Create-an-HTML-table/Sidef/create-an-html-table.sidef create mode 100644 Task/Create-an-HTML-table/Ursa/create-an-html-table.ursa create mode 100644 Task/Create-an-HTML-table/jq/create-an-html-table-1.jq create mode 100644 Task/Create-an-HTML-table/jq/create-an-html-table-2.jq create mode 100644 Task/Create-an-HTML-table/jq/create-an-html-table-3.jq create mode 100644 Task/Create-an-object-at-a-given-address/FreeBASIC/create-an-object-at-a-given-address.freebasic create mode 100644 Task/Create-an-object-at-a-given-address/Phix/create-an-object-at-a-given-address.phix create mode 100644 Task/Currying/EchoLisp/currying.echolisp create mode 100644 Task/Currying/Eero/currying-1.eero create mode 100644 Task/Currying/Eero/currying-2.eero create mode 100644 Task/Currying/FreeBASIC/currying.freebasic create mode 100644 Task/Currying/LFE/currying-1.lfe create mode 100644 Task/Currying/LFE/currying-2.lfe create mode 100644 Task/Currying/Nim/currying-1.nim create mode 100644 Task/Currying/Nim/currying-2.nim create mode 100644 Task/Currying/Oforth/currying.oforth create mode 100644 Task/Currying/Sidef/currying-1.sidef create mode 100644 Task/Currying/Sidef/currying-2.sidef create mode 100644 Task/Currying/Swift/currying-1.swift create mode 100644 Task/Currying/Swift/currying-2.swift create mode 100644 Task/Currying/Swift/currying-3.swift create mode 100644 Task/Currying/Wortel/currying.wortel create mode 100644 Task/Currying/jq/currying-1.jq create mode 100644 Task/Currying/jq/currying-2.jq create mode 100644 Task/DNS-query/Lasso/dns-query-1.lasso create mode 100644 Task/DNS-query/Lasso/dns-query-2.lasso create mode 100644 Task/DNS-query/Lasso/dns-query-3.lasso create mode 100644 Task/DNS-query/Sidef/dns-query.sidef create mode 100644 Task/Date-format/8th/date-format.8th create mode 100644 Task/Date-format/Apex/date-format.apex create mode 100644 Task/Date-format/FreeBASIC/date-format.freebasic create mode 100644 Task/Date-format/FunL/date-format.funl create mode 100644 Task/Date-format/Lasso/date-format.lasso create mode 100644 Task/Date-format/Nim/date-format.nim create mode 100644 Task/Date-format/Phix/date-format.phix create mode 100644 Task/Date-format/Ring/date-format.ring create mode 100644 Task/Date-format/Sidef/date-format.sidef create mode 100644 Task/Date-format/Swift/date-format.swift create mode 100644 Task/Date-format/Ursa/date-format.ursa create mode 100644 Task/Date-format/jq/date-format.jq create mode 100644 Task/Date-manipulation/EchoLisp/date-manipulation.echolisp create mode 100644 Task/Date-manipulation/FreeBASIC/date-manipulation.freebasic create mode 100644 Task/Date-manipulation/FunL/date-manipulation.funl create mode 100644 Task/Date-manipulation/Lasso/date-manipulation.lasso create mode 100644 Task/Date-manipulation/Lingo/date-manipulation-1.lingo create mode 100644 Task/Date-manipulation/Lingo/date-manipulation-2.lingo create mode 100644 Task/Date-manipulation/Nim/date-manipulation.nim create mode 100644 Task/Date-manipulation/Phix/date-manipulation.phix create mode 100644 Task/Date-manipulation/Sidef/date-manipulation.sidef create mode 100644 Task/Date-manipulation/jq/date-manipulation-1.jq create mode 100644 Task/Date-manipulation/jq/date-manipulation-2.jq create mode 100644 Task/Day-of-the-week/ECL/day-of-the-week.ecl create mode 100644 Task/Day-of-the-week/ERRE/day-of-the-week.erre create mode 100644 Task/Day-of-the-week/Lasso/day-of-the-week.lasso create mode 100644 Task/Day-of-the-week/Lingo/day-of-the-week.lingo create mode 100644 Task/Day-of-the-week/LiveCode/day-of-the-week-1.livecode create mode 100644 Task/Day-of-the-week/LiveCode/day-of-the-week-2.livecode create mode 100644 Task/Day-of-the-week/Nim/day-of-the-week.nim create mode 100644 Task/Day-of-the-week/Oforth/day-of-the-week.oforth create mode 100644 Task/Day-of-the-week/Peloton/day-of-the-week-1.peloton create mode 100644 Task/Day-of-the-week/Peloton/day-of-the-week-2.peloton create mode 100644 Task/Day-of-the-week/Phix/day-of-the-week.phix create mode 100644 Task/Day-of-the-week/Ring/day-of-the-week.ring create mode 100644 Task/Day-of-the-week/Sidef/day-of-the-week.sidef create mode 100644 Task/Day-of-the-week/Swift/day-of-the-week.swift create mode 100644 Task/Day-of-the-week/Wortel/day-of-the-week.wortel create mode 100644 Task/Day-of-the-week/jq/day-of-the-week-1.jq create mode 100644 Task/Day-of-the-week/jq/day-of-the-week-2.jq create mode 100644 Task/Deal-cards-for-FreeCell/Ceylon/deal-cards-for-freecell.ceylon create mode 100644 Task/Deal-cards-for-FreeCell/ERRE/deal-cards-for-freecell.erre create mode 100644 Task/Deal-cards-for-FreeCell/FreeBASIC/deal-cards-for-freecell.freebasic create mode 100644 Task/Deal-cards-for-FreeCell/Nim/deal-cards-for-freecell.nim create mode 100644 Task/Death-Star/Set-lang/death-star.set create mode 100644 Task/Death-Star/Sidef/death-star.sidef create mode 100644 Task/Deepcopy/Lasso/deepcopy.lasso create mode 100644 Task/Deepcopy/Lingo/deepcopy-1.lingo create mode 100644 Task/Deepcopy/Lingo/deepcopy-2.lingo create mode 100644 Task/Deepcopy/Nim/deepcopy-1.nim create mode 100644 Task/Deepcopy/Nim/deepcopy-2.nim create mode 100644 Task/Deepcopy/Sidef/deepcopy.sidef create mode 100644 Task/Define-a-primitive-data-type/EchoLisp/define-a-primitive-data-type.echolisp create mode 100644 Task/Define-a-primitive-data-type/FreeBASIC/define-a-primitive-data-type.freebasic create mode 100644 Task/Define-a-primitive-data-type/Lasso/define-a-primitive-data-type.lasso create mode 100644 Task/Define-a-primitive-data-type/Nim/define-a-primitive-data-type.nim create mode 100644 Task/Define-a-primitive-data-type/Phix/define-a-primitive-data-type-1.phix create mode 100644 Task/Define-a-primitive-data-type/Phix/define-a-primitive-data-type-2.phix create mode 100644 Task/Define-a-primitive-data-type/Phix/define-a-primitive-data-type-3.phix create mode 100644 Task/Define-a-primitive-data-type/Sidef/define-a-primitive-data-type.sidef create mode 100644 Task/Define-a-primitive-data-type/Visual-FoxPro/define-a-primitive-data-type.visual create mode 100644 Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-1.jq create mode 100644 Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-2.jq create mode 100644 Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-3.jq create mode 100644 Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-4.jq create mode 100644 Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-5.jq create mode 100644 Task/Delegates/NGS/delegates.ngs create mode 100644 Task/Delegates/Oforth/delegates-1.oforth create mode 100644 Task/Delegates/Oforth/delegates-2.oforth create mode 100644 Task/Delegates/Swift/delegates-1.swift create mode 100644 Task/Delegates/Swift/delegates-2.swift create mode 100644 Task/Delete-a-file/8th/delete-a-file.8th create mode 100644 Task/Delete-a-file/Axe/delete-a-file.axe create mode 100644 Task/Delete-a-file/FreeBASIC/delete-a-file.freebasic create mode 100644 Task/Delete-a-file/Lasso/delete-a-file.lasso create mode 100644 Task/Delete-a-file/Lingo/delete-a-file-1.lingo create mode 100644 Task/Delete-a-file/Lingo/delete-a-file-2.lingo create mode 100644 Task/Delete-a-file/Lingo/delete-a-file-3.lingo create mode 100644 Task/Delete-a-file/Nim/delete-a-file.nim create mode 100644 Task/Delete-a-file/Ring/delete-a-file.ring create mode 100644 Task/Delete-a-file/Sidef/delete-a-file.sidef create mode 100644 Task/Delete-a-file/Ursa/delete-a-file.ursa create mode 100644 Task/Detect-division-by-zero/8th/detect-division-by-zero.8th create mode 100644 Task/Detect-division-by-zero/Ceylon/detect-division-by-zero.ceylon create mode 100644 Task/Detect-division-by-zero/ECL/detect-division-by-zero-1.ecl create mode 100644 Task/Detect-division-by-zero/ECL/detect-division-by-zero-2.ecl create mode 100644 Task/Detect-division-by-zero/ECL/detect-division-by-zero-3.ecl create mode 100644 Task/Detect-division-by-zero/ERRE/detect-division-by-zero.erre create mode 100644 Task/Detect-division-by-zero/FreeBASIC/detect-division-by-zero.freebasic create mode 100644 Task/Detect-division-by-zero/FutureBasic/detect-division-by-zero.futurebasic create mode 100644 Task/Detect-division-by-zero/I/detect-division-by-zero.i create mode 100644 Task/Detect-division-by-zero/Lasso/detect-division-by-zero.lasso create mode 100644 Task/Detect-division-by-zero/Lingo/detect-division-by-zero.lingo create mode 100644 Task/Detect-division-by-zero/Nim/detect-division-by-zero.nim create mode 100644 Task/Detect-division-by-zero/Oforth/detect-division-by-zero.oforth create mode 100644 Task/Detect-division-by-zero/RPGIV/detect-division-by-zero.rpgiv create mode 100644 Task/Detect-division-by-zero/Ring/detect-division-by-zero.ring create mode 100644 Task/Detect-division-by-zero/Sidef/detect-division-by-zero.sidef create mode 100644 Task/Detect-division-by-zero/Ursa/detect-division-by-zero.ursa create mode 100644 Task/Detect-division-by-zero/jq/detect-division-by-zero-1.jq create mode 100644 Task/Detect-division-by-zero/jq/detect-division-by-zero-2.jq create mode 100644 Task/Determine-if-a-string-is-numeric/8th/determine-if-a-string-is-numeric.8th create mode 100644 Task/Determine-if-a-string-is-numeric/Apex/determine-if-a-string-is-numeric.apex create mode 100644 Task/Determine-if-a-string-is-numeric/EchoLisp/determine-if-a-string-is-numeric.echolisp create mode 100644 Task/Determine-if-a-string-is-numeric/FreeBASIC/determine-if-a-string-is-numeric.freebasic create mode 100644 Task/Determine-if-a-string-is-numeric/I/determine-if-a-string-is-numeric.i create mode 100644 Task/Determine-if-a-string-is-numeric/Lasso/determine-if-a-string-is-numeric-1.lasso create mode 100644 Task/Determine-if-a-string-is-numeric/Lasso/determine-if-a-string-is-numeric-2.lasso create mode 100644 Task/Determine-if-a-string-is-numeric/Nim/determine-if-a-string-is-numeric.nim create mode 100644 Task/Determine-if-a-string-is-numeric/PeopleCode/determine-if-a-string-is-numeric.peoplecode create mode 100644 Task/Determine-if-a-string-is-numeric/Phix/determine-if-a-string-is-numeric-1.phix create mode 100644 Task/Determine-if-a-string-is-numeric/Phix/determine-if-a-string-is-numeric-2.phix create mode 100644 Task/Determine-if-a-string-is-numeric/Ring/determine-if-a-string-is-numeric.ring create mode 100644 Task/Determine-if-a-string-is-numeric/Sidef/determine-if-a-string-is-numeric-1.sidef create mode 100644 Task/Determine-if-a-string-is-numeric/Sidef/determine-if-a-string-is-numeric-2.sidef create mode 100644 Task/Determine-if-a-string-is-numeric/Sidef/determine-if-a-string-is-numeric-3.sidef create mode 100644 Task/Determine-if-a-string-is-numeric/Swift/determine-if-a-string-is-numeric-1.swift create mode 100644 Task/Determine-if-a-string-is-numeric/Swift/determine-if-a-string-is-numeric-2.swift create mode 100644 Task/Determine-if-a-string-is-numeric/Ursa/determine-if-a-string-is-numeric.ursa create mode 100644 Task/Determine-if-a-string-is-numeric/XLISP/determine-if-a-string-is-numeric.xlisp create mode 100644 Task/Determine-if-a-string-is-numeric/jq/determine-if-a-string-is-numeric-1.jq create mode 100644 Task/Determine-if-a-string-is-numeric/jq/determine-if-a-string-is-numeric-2.jq create mode 100644 Task/Determine-if-only-one-instance-is-running/Lasso/determine-if-only-one-instance-is-running.lasso create mode 100644 Task/Determine-if-only-one-instance-is-running/Nim/determine-if-only-one-instance-is-running.nim create mode 100644 Task/Determine-if-only-one-instance-is-running/Phix/determine-if-only-one-instance-is-running.phix create mode 100644 Task/Determine-if-only-one-instance-is-running/Sidef/determine-if-only-one-instance-is-running.sidef create mode 100644 Task/Determine-if-only-one-instance-is-running/Swift/determine-if-only-one-instance-is-running.swift create mode 100644 Task/Digital-root-Multiplicative-digital-root/Nim/digital-root-multiplicative-digital-root.nim create mode 100644 Task/Digital-root-Multiplicative-digital-root/Sidef/digital-root-multiplicative-digital-root.sidef create mode 100644 Task/Digital-root-Multiplicative-digital-root/jq/digital-root-multiplicative-digital-root-1.jq create mode 100644 Task/Digital-root-Multiplicative-digital-root/jq/digital-root-multiplicative-digital-root-2.jq create mode 100644 Task/Digital-root-Multiplicative-digital-root/jq/digital-root-multiplicative-digital-root-3.jq create mode 100644 Task/Digital-root/FreeBASIC/digital-root.freebasic create mode 100644 Task/Digital-root/Nim/digital-root.nim create mode 100644 Task/Digital-root/Oforth/digital-root.oforth create mode 100644 Task/Digital-root/Potion/digital-root.potion create mode 100644 Task/Digital-root/Ring/digital-root.ring create mode 100644 Task/Digital-root/Sidef/digital-root.sidef create mode 100644 Task/Digital-root/Wortel/digital-root.wortel create mode 100644 Task/Digital-root/jq/digital-root-1.jq create mode 100644 Task/Digital-root/jq/digital-root-2.jq create mode 100644 Task/Digital-root/jq/digital-root-3.jq create mode 100644 Task/Dinesmans-multiple-dwelling-problem/ERRE/dinesmans-multiple-dwelling-problem.erre create mode 100644 Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-1.echolisp create mode 100644 Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-2.echolisp create mode 100644 Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-3.echolisp create mode 100644 Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-4.echolisp create mode 100644 Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-5.echolisp create mode 100644 Task/Dinesmans-multiple-dwelling-problem/Ring/dinesmans-multiple-dwelling-problem.ring create mode 100644 Task/Dinesmans-multiple-dwelling-problem/Sidef/dinesmans-multiple-dwelling-problem-1.sidef create mode 100644 Task/Dinesmans-multiple-dwelling-problem/Sidef/dinesmans-multiple-dwelling-problem-2.sidef create mode 100644 Task/Dinesmans-multiple-dwelling-problem/Sidef/dinesmans-multiple-dwelling-problem-3.sidef create mode 100644 Task/Dinesmans-multiple-dwelling-problem/jq/dinesmans-multiple-dwelling-problem-1.jq create mode 100644 Task/Dinesmans-multiple-dwelling-problem/jq/dinesmans-multiple-dwelling-problem-2.jq create mode 100644 Task/Dinesmans-multiple-dwelling-problem/jq/dinesmans-multiple-dwelling-problem-3.jq create mode 100644 Task/Dining-philosophers/EchoLisp/dining-philosophers-1.echolisp create mode 100644 Task/Dining-philosophers/EchoLisp/dining-philosophers-2.echolisp create mode 100644 Task/Dining-philosophers/Nim/dining-philosophers.nim create mode 100644 Task/Dining-philosophers/Phix/dining-philosophers.phix create mode 100644 Task/Discordian-date/Phix/discordian-date-1.phix create mode 100644 Task/Discordian-date/Phix/discordian-date-2.phix create mode 100644 Task/Discordian-date/Sidef/discordian-date.sidef create mode 100644 Task/Distributed-programming/LFE/distributed-programming-1.lfe create mode 100644 Task/Distributed-programming/LFE/distributed-programming-2.lfe create mode 100644 Task/Distributed-programming/LFE/distributed-programming-3.lfe create mode 100644 Task/Distributed-programming/LFE/distributed-programming-4.lfe create mode 100644 Task/Distributed-programming/LFE/distributed-programming-5.lfe create mode 100644 Task/Distributed-programming/LFE/distributed-programming-6.lfe create mode 100644 Task/Distributed-programming/Nim/distributed-programming.nim create mode 100644 Task/Documentation/Gri/documentation-1.gri create mode 100644 Task/Documentation/Gri/documentation-2.gri create mode 100644 Task/Documentation/Nim/documentation.nim create mode 100644 Task/Documentation/Ring/documentation.ring create mode 100644 Task/Documentation/Swift/documentation.swift create mode 100644 Task/Dot-product/8th/dot-product.8th create mode 100644 Task/Dot-product/EchoLisp/dot-product.echolisp create mode 100644 Task/Dot-product/FunL/dot-product.funl create mode 100644 Task/Dot-product/Idris/dot-product.idris create mode 100644 Task/Dot-product/LFE/dot-product.lfe create mode 100644 Task/Dot-product/Nim/dot-product.nim create mode 100644 Task/Dot-product/Oforth/dot-product.oforth create mode 100644 Task/Dot-product/Phix/dot-product.phix create mode 100644 Task/Dot-product/Ring/dot-product.ring create mode 100644 Task/Dot-product/Sidef/dot-product.sidef create mode 100644 Task/Dot-product/Swift/dot-product.swift create mode 100644 Task/Dot-product/Wart/dot-product.wart create mode 100644 Task/Dot-product/jq/dot-product-1.jq create mode 100644 Task/Dot-product/jq/dot-product-2.jq create mode 100644 Task/Dot-product/jq/dot-product-3.jq create mode 100644 Task/Doubly-linked-list-Definition/Nim/doubly-linked-list-definition.nim create mode 100644 Task/Doubly-linked-list-Definition/Oforth/doubly-linked-list-definition.oforth create mode 100644 Task/Doubly-linked-list-Element-definition/Axe/doubly-linked-list-element-definition.axe create mode 100644 Task/Doubly-linked-list-Element-definition/Nim/doubly-linked-list-element-definition.nim create mode 100644 Task/Doubly-linked-list-Element-definition/Oforth/doubly-linked-list-element-definition.oforth create mode 100644 Task/Doubly-linked-list-Element-definition/Sidef/doubly-linked-list-element-definition.sidef create mode 100644 Task/Doubly-linked-list-Element-insertion/Axe/doubly-linked-list-element-insertion.axe create mode 100644 Task/Doubly-linked-list-Element-insertion/Nim/doubly-linked-list-element-insertion.nim create mode 100644 Task/Doubly-linked-list-Element-insertion/Oforth/doubly-linked-list-element-insertion.oforth create mode 100644 Task/Doubly-linked-list-Traversal/Axe/doubly-linked-list-traversal.axe create mode 100644 Task/Doubly-linked-list-Traversal/Nim/doubly-linked-list-traversal.nim create mode 100644 Task/Doubly-linked-list-Traversal/Oforth/doubly-linked-list-traversal.oforth create mode 100644 Task/Dragon-curve/ERRE/dragon-curve.erre create mode 100644 Task/Dragon-curve/Elm/dragon-curve.elm create mode 100644 Task/Dragon-curve/Gri/dragon-curve.gri create mode 100644 Task/Dragon-curve/SequenceL/dragon-curve-1.sequencel create mode 100644 Task/Dragon-curve/SequenceL/dragon-curve-2.sequencel create mode 100644 Task/Dragon-curve/Sidef/dragon-curve.sidef create mode 100644 Task/Dragon-curve/jq/dragon-curve-1.jq create mode 100644 Task/Dragon-curve/jq/dragon-curve-2.jq create mode 100644 Task/Dragon-curve/jq/dragon-curve-3.jq create mode 100644 Task/Draw-a-clock/FunL/draw-a-clock.funl create mode 100644 Task/Draw-a-clock/Nim/draw-a-clock.nim create mode 100644 Task/Draw-a-clock/Sidef/draw-a-clock.sidef create mode 100644 Task/Draw-a-cuboid/Nim/draw-a-cuboid.nim create mode 100644 Task/Draw-a-cuboid/Phix/draw-a-cuboid.phix create mode 100644 Task/Draw-a-cuboid/Sidef/draw-a-cuboid-1.sidef create mode 100644 Task/Draw-a-cuboid/Sidef/draw-a-cuboid-2.sidef create mode 100644 Task/Draw-a-sphere/ERRE/draw-a-sphere.erre create mode 100644 Task/Draw-a-sphere/FutureBasic/draw-a-sphere.futurebasic create mode 100644 Task/Draw-a-sphere/Lingo/draw-a-sphere.lingo create mode 100644 Task/Draw-a-sphere/Nim/draw-a-sphere.nim create mode 100644 Task/Draw-a-sphere/Sidef/draw-a-sphere.sidef create mode 100644 Task/Draw-a-sphere/Swift/draw-a-sphere.swift create mode 100644 Task/Draw-a-sphere/jq/draw-a-sphere-1.jq create mode 100644 Task/Draw-a-sphere/jq/draw-a-sphere-2.jq create mode 100644 Task/Draw-a-sphere/jq/draw-a-sphere-3.jq create mode 100644 Task/Dutch-national-flag-problem/Lasso/dutch-national-flag-problem.lasso create mode 100644 Task/Dutch-national-flag-problem/Visual-FoxPro/dutch-national-flag-problem-1.visual create mode 100644 Task/Dutch-national-flag-problem/Visual-FoxPro/dutch-national-flag-problem-2.visual create mode 100644 Task/Dynamic-variable-names/FreeBASIC/dynamic-variable-names.freebasic create mode 100644 Task/Dynamic-variable-names/Lasso/dynamic-variable-names.lasso create mode 100644 Task/Dynamic-variable-names/Lingo/dynamic-variable-names.lingo create mode 100644 Task/Dynamic-variable-names/Oforth/dynamic-variable-names.oforth create mode 100644 Task/Dynamic-variable-names/Ring/dynamic-variable-names-1.ring create mode 100644 Task/Dynamic-variable-names/Ring/dynamic-variable-names-2.ring create mode 100644 Task/Dynamic-variable-names/Sidef/dynamic-variable-names.sidef create mode 100644 Task/Echo-server/LFE/echo-server.lfe create mode 100644 Task/Echo-server/Nim/echo-server.nim create mode 100644 Task/Element-wise-operations/Phix/element-wise-operations.phix create mode 100644 Task/Element-wise-operations/jq/element-wise-operations-1.jq create mode 100644 Task/Element-wise-operations/jq/element-wise-operations-2.jq create mode 100644 Task/Element-wise-operations/jq/element-wise-operations-3.jq create mode 100644 Task/Element-wise-operations/jq/element-wise-operations-4.jq create mode 100644 Task/Element-wise-operations/jq/element-wise-operations-5.jq create mode 100644 Task/Element-wise-operations/jq/element-wise-operations-6.jq create mode 100644 Task/Empty-directory/FreeBASIC/empty-directory.freebasic create mode 100644 Task/Empty-directory/Lasso/empty-directory.lasso create mode 100644 Task/Empty-directory/Lingo/empty-directory.lingo create mode 100644 Task/Empty-directory/Nim/empty-directory.nim create mode 100644 Task/Empty-directory/Ring/empty-directory.ring create mode 100644 Task/Empty-directory/Sidef/empty-directory-1.sidef create mode 100644 Task/Empty-directory/Sidef/empty-directory-2.sidef create mode 100644 Task/Empty-program/8051-Assembly/empty-program.8051 create mode 100644 Task/Empty-program/Axe/empty-program.axe create mode 100644 Task/Empty-program/Computer-zero-Assembly/empty-program.computer create mode 100644 Task/Empty-program/EDSAC-order-code/empty-program.edsac create mode 100644 Task/Empty-program/ERRE/empty-program.erre create mode 100644 Task/Empty-program/EchoLisp/empty-program.echolisp create mode 100644 Task/Empty-program/FreeBASIC/empty-program.freebasic create mode 100644 Task/Empty-program/FunL/empty-program.funl create mode 100644 Task/Empty-program/Futhark/empty-program.futhark create mode 100644 Task/Empty-program/FutureBasic/empty-program.futurebasic create mode 100644 Task/Empty-program/I/empty-program.i create mode 100644 Task/Empty-program/LC3-Assembly/empty-program.lc3 create mode 100644 Task/Empty-program/Lasso/empty-program-1.lasso create mode 100644 Task/Empty-program/Lasso/empty-program-2.lasso create mode 100644 Task/Empty-program/Lasso/empty-program-3.lasso create mode 100644 Task/Empty-program/Lingo/empty-program.lingo create mode 100644 Task/Empty-program/Oforth/empty-program-1.oforth create mode 100644 Task/Empty-program/Oforth/empty-program-2.oforth create mode 100644 Task/Empty-program/OpenLisp/empty-program.openlisp create mode 100644 Task/Empty-program/Ring/empty-program.ring create mode 100644 Task/Empty-program/SSEM/empty-program-1.ssem create mode 100644 Task/Empty-program/SSEM/empty-program-2.ssem create mode 100644 Task/Empty-program/Set-lang/empty-program.set create mode 100644 Task/Empty-program/Sidef/empty-program.sidef create mode 100644 Task/Empty-program/Sparkling/empty-program.sparkling create mode 100644 Task/Empty-program/Swift/empty-program.swift create mode 100644 Task/Empty-program/Symsyn/empty-program.symsyn create mode 100644 Task/Empty-program/TI-83-Hex-Assembly/empty-program.ti-83 create mode 100644 Task/Empty-program/Ursa/empty-program.ursa create mode 100644 Task/Empty-string/8th/empty-string-1.8th create mode 100644 Task/Empty-string/8th/empty-string-2.8th create mode 100644 Task/Empty-string/Apex/empty-string.apex create mode 100644 Task/Empty-string/Axe/empty-string.axe create mode 100644 Task/Empty-string/FreeBASIC/empty-string.freebasic create mode 100644 Task/Empty-string/FutureBasic/empty-string.futurebasic create mode 100644 Task/Empty-string/I/empty-string.i create mode 100644 Task/Empty-string/LFE/empty-string.lfe create mode 100644 Task/Empty-string/Lasso/empty-string.lasso create mode 100644 Task/Empty-string/Lingo/empty-string.lingo create mode 100644 Task/Empty-string/NESL/empty-string.nesl create mode 100644 Task/Empty-string/Nim/empty-string.nim create mode 100644 Task/Empty-string/Oforth/empty-string.oforth create mode 100644 Task/Empty-string/Phix/empty-string.phix create mode 100644 Task/Empty-string/Ring/empty-string.ring create mode 100644 Task/Empty-string/Sidef/empty-string-1.sidef create mode 100644 Task/Empty-string/Sidef/empty-string-2.sidef create mode 100644 Task/Empty-string/Sidef/empty-string-3.sidef create mode 100644 Task/Empty-string/Swift/empty-string.swift create mode 100644 Task/Empty-string/Ursa/empty-string.ursa create mode 100644 Task/Empty-string/jq/empty-string-1.jq create mode 100644 Task/Empty-string/jq/empty-string-2.jq create mode 100644 Task/Empty-string/jq/empty-string-3.jq create mode 100644 Task/Enforced-immutability/8th/enforced-immutability.8th create mode 100644 Task/Enforced-immutability/Nim/enforced-immutability.nim create mode 100644 Task/Enforced-immutability/Oforth/enforced-immutability.oforth create mode 100644 Task/Enforced-immutability/Phix/enforced-immutability.phix create mode 100644 Task/Enforced-immutability/Sidef/enforced-immutability.sidef create mode 100644 Task/Enforced-immutability/jq/enforced-immutability.jq create mode 100644 Task/Entropy/EchoLisp/entropy-1.echolisp create mode 100644 Task/Entropy/EchoLisp/entropy-2.echolisp create mode 100644 Task/Entropy/FreeBASIC/entropy.freebasic create mode 100644 Task/Entropy/Nim/entropy.nim create mode 100644 Task/Entropy/Oforth/entropy.oforth create mode 100644 Task/Entropy/Sidef/entropy.sidef create mode 100644 Task/Entropy/jq/entropy-1.jq create mode 100644 Task/Entropy/jq/entropy-2.jq create mode 100644 Task/Enumerations/FreeBASIC/enumerations.freebasic create mode 100644 Task/Enumerations/FutureBasic/enumerations.futurebasic create mode 100644 Task/Enumerations/Lingo/enumerations-1.lingo create mode 100644 Task/Enumerations/Lingo/enumerations-2.lingo create mode 100644 Task/Enumerations/Nim/enumerations.nim create mode 100644 Task/Enumerations/Oforth/enumerations.oforth create mode 100644 Task/Enumerations/Phix/enumerations.phix create mode 100644 Task/Enumerations/Ring/enumerations.ring create mode 100644 Task/Enumerations/Sidef/enumerations-1.sidef create mode 100644 Task/Enumerations/Sidef/enumerations-2.sidef create mode 100644 Task/Enumerations/Swift/enumerations.swift create mode 100644 Task/Enumerations/jq/enumerations.jq create mode 100644 Task/Environment-variables/FreeBASIC/environment-variables.freebasic create mode 100644 Task/Environment-variables/FunL/environment-variables.funl create mode 100644 Task/Environment-variables/Gri/environment-variables-1.gri create mode 100644 Task/Environment-variables/Gri/environment-variables-2.gri create mode 100644 Task/Environment-variables/I/environment-variables.i create mode 100644 Task/Environment-variables/Lasso/environment-variables.lasso create mode 100644 Task/Environment-variables/Lingo/environment-variables.lingo create mode 100644 Task/Environment-variables/Nim/environment-variables.nim create mode 100644 Task/Environment-variables/Oforth/environment-variables.oforth create mode 100644 Task/Environment-variables/Phix/environment-variables.phix create mode 100644 Task/Environment-variables/Ring/environment-variables.ring create mode 100644 Task/Environment-variables/Sidef/environment-variables.sidef create mode 100644 Task/Environment-variables/Ursa/environment-variables.ursa create mode 100644 Task/Environment-variables/jq/environment-variables.jq create mode 100644 Task/Equilibrium-index/ERRE/equilibrium-index.erre create mode 100644 Task/Equilibrium-index/FreeBASIC/equilibrium-index.freebasic create mode 100644 Task/Equilibrium-index/Nim/equilibrium-index.nim create mode 100644 Task/Equilibrium-index/Oforth/equilibrium-index.oforth create mode 100644 Task/Equilibrium-index/Phix/equilibrium-index.phix create mode 100644 Task/Equilibrium-index/Ring/equilibrium-index.ring create mode 100644 Task/Equilibrium-index/Sidef/equilibrium-index-1.sidef create mode 100644 Task/Equilibrium-index/Sidef/equilibrium-index-2.sidef create mode 100644 Task/Equilibrium-index/jq/equilibrium-index-1.jq create mode 100644 Task/Equilibrium-index/jq/equilibrium-index-2.jq create mode 100644 Task/Equilibrium-index/jq/equilibrium-index-3.jq create mode 100644 Task/Ethiopian-multiplication/ERRE/ethiopian-multiplication.erre create mode 100644 Task/Ethiopian-multiplication/Nim/ethiopian-multiplication.nim create mode 100644 Task/Ethiopian-multiplication/Oforth/ethiopian-multiplication.oforth create mode 100644 Task/Ethiopian-multiplication/Phix/ethiopian-multiplication.phix create mode 100644 Task/Ethiopian-multiplication/Powerbuilder/ethiopian-multiplication.powerbuilder create mode 100644 Task/Ethiopian-multiplication/Ring/ethiopian-multiplication.ring create mode 100644 Task/Ethiopian-multiplication/Sidef/ethiopian-multiplication.sidef create mode 100644 Task/Ethiopian-multiplication/Swift/ethiopian-multiplication.swift create mode 100644 Task/Euler-method/Futhark/euler-method.futhark create mode 100644 Task/Euler-method/Nim/euler-method.nim create mode 100644 Task/Euler-method/Oforth/euler-method-1.oforth create mode 100644 Task/Euler-method/Oforth/euler-method-2.oforth create mode 100644 Task/Euler-method/Phix/euler-method.phix create mode 100644 Task/Euler-method/Ring/euler-method.ring create mode 100644 Task/Euler-method/SequenceL/euler-method.sequencel create mode 100644 Task/Euler-method/Sidef/euler-method.sidef create mode 100644 Task/Euler-method/jq/euler-method-1.jq create mode 100644 Task/Euler-method/jq/euler-method-2.jq create mode 100644 Task/Euler-method/jq/euler-method-3.jq create mode 100644 Task/Euler-method/jq/euler-method-4.jq create mode 100644 Task/Evaluate-binomial-coefficients/ERRE/evaluate-binomial-coefficients.erre create mode 100644 Task/Evaluate-binomial-coefficients/FreeBASIC/evaluate-binomial-coefficients.freebasic create mode 100644 Task/Evaluate-binomial-coefficients/FunL/evaluate-binomial-coefficients-1.funl create mode 100644 Task/Evaluate-binomial-coefficients/FunL/evaluate-binomial-coefficients-2.funl create mode 100644 Task/Evaluate-binomial-coefficients/Lasso/evaluate-binomial-coefficients.lasso create mode 100644 Task/Evaluate-binomial-coefficients/MINIL/evaluate-binomial-coefficients.minil create mode 100644 Task/Evaluate-binomial-coefficients/Nim/evaluate-binomial-coefficients.nim create mode 100644 Task/Evaluate-binomial-coefficients/Oforth/evaluate-binomial-coefficients.oforth create mode 100644 Task/Evaluate-binomial-coefficients/Ring/evaluate-binomial-coefficients.ring create mode 100644 Task/Evaluate-binomial-coefficients/Sidef/evaluate-binomial-coefficients-1.sidef create mode 100644 Task/Evaluate-binomial-coefficients/Sidef/evaluate-binomial-coefficients-2.sidef create mode 100644 Task/Evaluate-binomial-coefficients/jq/evaluate-binomial-coefficients.jq create mode 100644 Task/Even-or-odd/8th/even-or-odd-1.8th create mode 100644 Task/Even-or-odd/8th/even-or-odd-2.8th create mode 100644 Task/Even-or-odd/AntLang/even-or-odd.antlang create mode 100644 Task/Even-or-odd/Crystal/even-or-odd.crystal create mode 100644 Task/Even-or-odd/ERRE/even-or-odd.erre create mode 100644 Task/Even-or-odd/FreeBASIC/even-or-odd.freebasic create mode 100644 Task/Even-or-odd/Futhark/even-or-odd.futhark create mode 100644 Task/Even-or-odd/L++/even-or-odd.lpp create mode 100644 Task/Even-or-odd/LC3-Assembly/even-or-odd.lc3 create mode 100644 Task/Even-or-odd/Lasso/even-or-odd.lasso create mode 100644 Task/Even-or-odd/Lingo/even-or-odd.lingo create mode 100644 Task/Even-or-odd/LiveCode/even-or-odd.livecode create mode 100644 Task/Even-or-odd/NESL/even-or-odd.nesl create mode 100644 Task/Even-or-odd/Nim/even-or-odd.nim create mode 100644 Task/Even-or-odd/Oforth/even-or-odd.oforth create mode 100644 Task/Even-or-odd/Phix/even-or-odd.phix create mode 100644 Task/Even-or-odd/Ring/even-or-odd.ring create mode 100644 Task/Even-or-odd/SSEM/even-or-odd.ssem create mode 100644 Task/Even-or-odd/SequenceL/even-or-odd.sequencel create mode 100644 Task/Even-or-odd/Sidef/even-or-odd-1.sidef create mode 100644 Task/Even-or-odd/Sidef/even-or-odd-2.sidef create mode 100644 Task/Even-or-odd/Sidef/even-or-odd-3.sidef create mode 100644 Task/Even-or-odd/Swift/even-or-odd.swift create mode 100644 Task/Even-or-odd/Symsyn/even-or-odd.symsyn create mode 100644 Task/Even-or-odd/Ursa/even-or-odd.ursa create mode 100644 Task/Even-or-odd/jq/even-or-odd-1.jq create mode 100644 Task/Even-or-odd/jq/even-or-odd-2.jq create mode 100644 Task/Events/LFE/events.lfe create mode 100644 Task/Events/Lingo/events-1.lingo create mode 100644 Task/Events/Lingo/events-2.lingo create mode 100644 Task/Events/Lingo/events-3.lingo create mode 100644 Task/Events/Nim/events.nim create mode 100644 Task/Events/Oforth/events-1.oforth create mode 100644 Task/Events/Oforth/events-2.oforth create mode 100644 Task/Evolutionary-algorithm/8th/evolutionary-algorithm.8th create mode 100644 Task/Evolutionary-algorithm/Ceylon/evolutionary-algorithm.ceylon create mode 100644 Task/Evolutionary-algorithm/EchoLisp/evolutionary-algorithm.echolisp create mode 100644 Task/Evolutionary-algorithm/Nim/evolutionary-algorithm.nim create mode 100644 Task/Evolutionary-algorithm/Oforth/evolutionary-algorithm.oforth create mode 100644 Task/Evolutionary-algorithm/Phix/evolutionary-algorithm.phix create mode 100644 Task/Evolutionary-algorithm/Pony/evolutionary-algorithm-1.pony create mode 100644 Task/Evolutionary-algorithm/Pony/evolutionary-algorithm-2.pony create mode 100644 Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-1.sequencel create mode 100644 Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-2.sequencel create mode 100644 Task/Evolutionary-algorithm/Sidef/evolutionary-algorithm.sidef create mode 100644 Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/EchoLisp/exceptions-catch-an-exception-thrown-in-a-nested-call.echolisp create mode 100644 Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/FreeBASIC/exceptions-catch-an-exception-thrown-in-a-nested-call.freebasic create mode 100644 Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Lasso/exceptions-catch-an-exception-thrown-in-a-nested-call.lasso create mode 100644 Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Nim/exceptions-catch-an-exception-thrown-in-a-nested-call.nim create mode 100644 Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Oforth/exceptions-catch-an-exception-thrown-in-a-nested-call.oforth create mode 100644 Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Sidef/exceptions-catch-an-exception-thrown-in-a-nested-call.sidef create mode 100644 Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Swift/exceptions-catch-an-exception-thrown-in-a-nested-call.swift create mode 100644 Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/jq/exceptions-catch-an-exception-thrown-in-a-nested-call.jq create mode 100644 Task/Exceptions/FreeBASIC/exceptions.freebasic create mode 100644 Task/Exceptions/Lasso/exceptions.lasso create mode 100644 Task/Exceptions/Lingo/exceptions-1.lingo create mode 100644 Task/Exceptions/Lingo/exceptions-2.lingo create mode 100644 Task/Exceptions/Lingo/exceptions-3.lingo create mode 100644 Task/Exceptions/Nim/exceptions-1.nim create mode 100644 Task/Exceptions/Nim/exceptions-2.nim create mode 100644 Task/Exceptions/Nim/exceptions-3.nim create mode 100644 Task/Exceptions/Oforth/exceptions.oforth create mode 100644 Task/Exceptions/PHL/exceptions.phl create mode 100644 Task/Exceptions/Ring/exceptions.ring create mode 100644 Task/Exceptions/Sidef/exceptions.sidef create mode 100644 Task/Exceptions/Swift/exceptions-1.swift create mode 100644 Task/Exceptions/Swift/exceptions-2.swift create mode 100644 Task/Exceptions/Swift/exceptions-3.swift create mode 100644 Task/Exceptions/Ursa/exceptions-1.ursa create mode 100644 Task/Exceptions/Ursa/exceptions-2.ursa create mode 100644 Task/Exceptions/jq/exceptions-1.jq create mode 100644 Task/Exceptions/jq/exceptions-2.jq create mode 100644 Task/Executable-library/Nim/executable-library-1.nim create mode 100644 Task/Executable-library/Nim/executable-library-2.nim create mode 100644 Task/Executable-library/Sidef/executable-library-1.sidef create mode 100644 Task/Executable-library/Sidef/executable-library-2.sidef create mode 100644 Task/Executable-library/Sidef/executable-library-3.sidef create mode 100644 Task/Executable-library/Sidef/executable-library-4.sidef create mode 100644 Task/Execute-Brain----/Axe/execute-brain-----1.axe create mode 100644 Task/Execute-Brain----/Axe/execute-brain-----2.axe create mode 100644 Task/Execute-Brain----/Nim/execute-brain----.nim create mode 100644 Task/Execute-Brain----/Phix/execute-brain----.phix create mode 100644 Task/Execute-Brain----/Potion/execute-brain-----1.potion create mode 100644 Task/Execute-Brain----/Potion/execute-brain-----2.potion create mode 100644 Task/Execute-Brain----/Sidef/execute-brain----.sidef create mode 100644 Task/Execute-Brain----/Swift/execute-brain----.swift create mode 100644 Task/Execute-HQ9+/Ceylon/execute-hq9+.ceylon create mode 100644 Task/Execute-HQ9+/Nim/execute-hq9+.nim create mode 100644 Task/Execute-HQ9+/Phix/execute-hq9+-1.phix create mode 100644 Task/Execute-HQ9+/Phix/execute-hq9+-2.phix create mode 100644 Task/Execute-HQ9+/Sidef/execute-hq9+-1.sidef create mode 100644 Task/Execute-HQ9+/Sidef/execute-hq9+-2.sidef create mode 100644 Task/Execute-HQ9+/Sidef/execute-hq9+-3.sidef create mode 100644 Task/Execute-a-Markov-algorithm/EchoLisp/execute-a-markov-algorithm.echolisp create mode 100644 Task/Execute-a-Markov-algorithm/Swift/execute-a-markov-algorithm.swift create mode 100644 Task/Execute-a-system-command/ERRE/execute-a-system-command-1.erre create mode 100644 Task/Execute-a-system-command/ERRE/execute-a-system-command-2.erre create mode 100644 Task/Execute-a-system-command/FreeBASIC/execute-a-system-command.freebasic create mode 100644 Task/Execute-a-system-command/FunL/execute-a-system-command.funl create mode 100644 Task/Execute-a-system-command/FutureBasic/execute-a-system-command.futurebasic create mode 100644 Task/Execute-a-system-command/LFE/execute-a-system-command-1.lfe create mode 100644 Task/Execute-a-system-command/LFE/execute-a-system-command-2.lfe create mode 100644 Task/Execute-a-system-command/Lasso/execute-a-system-command.lasso create mode 100644 Task/Execute-a-system-command/Lingo/execute-a-system-command.lingo create mode 100644 Task/Execute-a-system-command/Nim/execute-a-system-command.nim create mode 100644 Task/Execute-a-system-command/Oforth/execute-a-system-command.oforth create mode 100644 Task/Execute-a-system-command/Phix/execute-a-system-command.phix create mode 100644 Task/Execute-a-system-command/Ring/execute-a-system-command.ring create mode 100644 Task/Execute-a-system-command/Sidef/execute-a-system-command.sidef create mode 100644 Task/Execute-a-system-command/Ursa/execute-a-system-command.ursa create mode 100644 Task/Execute-a-system-command/Wart/execute-a-system-command.wart create mode 100644 Task/Exponentiation-operator/ERRE/exponentiation-operator.erre create mode 100644 Task/Exponentiation-operator/EchoLisp/exponentiation-operator.echolisp create mode 100644 Task/Exponentiation-operator/FreeBASIC/exponentiation-operator.freebasic create mode 100644 Task/Exponentiation-operator/Lingo/exponentiation-operator.lingo create mode 100644 Task/Exponentiation-operator/Nim/exponentiation-operator.nim create mode 100644 Task/Exponentiation-operator/Oforth/exponentiation-operator.oforth create mode 100644 Task/Exponentiation-operator/Phix/exponentiation-operator.phix create mode 100644 Task/Exponentiation-operator/Ring/exponentiation-operator.ring create mode 100644 Task/Exponentiation-operator/Sidef/exponentiation-operator-1.sidef create mode 100644 Task/Exponentiation-operator/Sidef/exponentiation-operator-2.sidef create mode 100644 Task/Exponentiation-operator/Ursa/exponentiation-operator.ursa create mode 100644 Task/Exponentiation-operator/jq/exponentiation-operator-1.jq create mode 100644 Task/Exponentiation-operator/jq/exponentiation-operator-2.jq create mode 100644 Task/Extend-your-language/EchoLisp/extend-your-language.echolisp create mode 100644 Task/Extend-your-language/FreeBASIC/extend-your-language.freebasic create mode 100644 Task/Extend-your-language/Lasso/extend-your-language-1.lasso create mode 100644 Task/Extend-your-language/Lasso/extend-your-language-2.lasso create mode 100644 Task/Extend-your-language/Morfa/extend-your-language.morfa create mode 100644 Task/Extend-your-language/Nim/extend-your-language.nim create mode 100644 Task/Extend-your-language/PHL/extend-your-language.phl create mode 100644 Task/Extend-your-language/Shen/extend-your-language-1.shen create mode 100644 Task/Extend-your-language/Shen/extend-your-language-2.shen create mode 100644 Task/Extend-your-language/Sidef/extend-your-language.sidef create mode 100644 Task/Extensible-prime-generator/EchoLisp/extensible-prime-generator.echolisp create mode 100644 Task/Extensible-prime-generator/FreeBASIC/extensible-prime-generator.freebasic create mode 100644 Task/Extensible-prime-generator/Ring/extensible-prime-generator.ring create mode 100644 Task/Extensible-prime-generator/Sidef/extensible-prime-generator.sidef create mode 100644 Task/Extensible-prime-generator/jq/extensible-prime-generator-1.jq create mode 100644 Task/Extensible-prime-generator/jq/extensible-prime-generator-2.jq create mode 100644 Task/Extensible-prime-generator/jq/extensible-prime-generator-3.jq create mode 100644 Task/Extensible-prime-generator/jq/extensible-prime-generator-4.jq create mode 100644 Task/Extreme-floating-point-values/FreeBASIC/extreme-floating-point-values.freebasic create mode 100644 Task/Extreme-floating-point-values/Nim/extreme-floating-point-values.nim create mode 100644 Task/Extreme-floating-point-values/Phix/extreme-floating-point-values.phix create mode 100644 Task/Extreme-floating-point-values/Sidef/extreme-floating-point-values.sidef create mode 100644 Task/Extreme-floating-point-values/Swift/extreme-floating-point-values.swift create mode 100644 Task/Extreme-floating-point-values/jq/extreme-floating-point-values-1.jq create mode 100644 Task/Extreme-floating-point-values/jq/extreme-floating-point-values-2.jq create mode 100644 Task/Extreme-floating-point-values/jq/extreme-floating-point-values-3.jq create mode 100644 Task/Extreme-floating-point-values/jq/extreme-floating-point-values-4.jq create mode 100644 Task/Extreme-floating-point-values/jq/extreme-floating-point-values-5.jq create mode 100644 Task/Factorial/AntLang/factorial.antlang create mode 100644 Task/Factorial/Apex/factorial-1.apex create mode 100644 Task/Factorial/Apex/factorial-2.apex create mode 100644 Task/Factorial/Axe/factorial-1.axe create mode 100644 Task/Factorial/Axe/factorial-2.axe create mode 100644 Task/Factorial/Ceylon/factorial.ceylon create mode 100644 Task/Factorial/ChucK/factorial-1.chuck create mode 100644 Task/Factorial/ChucK/factorial-2.chuck create mode 100644 Task/Factorial/Comal/factorial.comal create mode 100644 Task/Factorial/Computer-zero-Assembly/factorial-1.computer create mode 100644 Task/Factorial/Computer-zero-Assembly/factorial-2.computer create mode 100644 Task/Factorial/ERRE/factorial-1.erre create mode 100644 Task/Factorial/ERRE/factorial-2.erre create mode 100644 Task/Factorial/EchoLisp/factorial-1.echolisp create mode 100644 Task/Factorial/EchoLisp/factorial-2.echolisp create mode 100644 Task/Factorial/EchoLisp/factorial-3.echolisp create mode 100644 Task/Factorial/EchoLisp/factorial-4.echolisp create mode 100644 Task/Factorial/EchoLisp/factorial-5.echolisp create mode 100644 Task/Factorial/Elm/factorial.elm create mode 100644 Task/Factorial/Ezhil/factorial.ezhil create mode 100644 Task/Factorial/FreeBASIC/factorial.freebasic create mode 100644 Task/Factorial/FunL/factorial-1.funl create mode 100644 Task/Factorial/FunL/factorial-2.funl create mode 100644 Task/Factorial/FunL/factorial-3.funl create mode 100644 Task/Factorial/FunL/factorial-4.funl create mode 100644 Task/Factorial/Futhark/factorial-1.futhark create mode 100644 Task/Factorial/Futhark/factorial-2.futhark create mode 100644 Task/Factorial/FutureBasic/factorial.futurebasic create mode 100644 Task/Factorial/I/factorial.i create mode 100644 Task/Factorial/JOVIAL/factorial.jovial create mode 100644 Task/Factorial/Klong/factorial.klong create mode 100644 Task/Factorial/LFE/factorial-1.lfe create mode 100644 Task/Factorial/LFE/factorial-2.lfe create mode 100644 Task/Factorial/LFE/factorial-3.lfe create mode 100644 Task/Factorial/LFE/factorial-4.lfe create mode 100644 Task/Factorial/LFE/factorial-5.lfe create mode 100644 Task/Factorial/LFE/factorial-6.lfe create mode 100644 Task/Factorial/Lasso/factorial-1.lasso create mode 100644 Task/Factorial/Lasso/factorial-2.lasso create mode 100644 Task/Factorial/Lingo/factorial-1.lingo create mode 100644 Task/Factorial/Lingo/factorial-2.lingo create mode 100644 Task/Factorial/LiveCode/factorial.livecode create mode 100644 Task/Factorial/Maude/factorial.maude create mode 100644 Task/Factorial/MyrtleScript/factorial.myrtle create mode 100644 Task/Factorial/Nim/factorial-1.nim create mode 100644 Task/Factorial/Nim/factorial-2.nim create mode 100644 Task/Factorial/Oforth/factorial-1.oforth create mode 100644 Task/Factorial/Oforth/factorial-2.oforth create mode 100644 Task/Factorial/Panda/factorial.panda create mode 100644 Task/Factorial/Peloton/factorial-1.peloton create mode 100644 Task/Factorial/Peloton/factorial-2.peloton create mode 100644 Task/Factorial/Phix/factorial.phix create mode 100644 Task/Factorial/Rapira/factorial-1.rapira create mode 100644 Task/Factorial/Rapira/factorial-2.rapira create mode 100644 Task/Factorial/Ring/factorial.ring create mode 100644 Task/Factorial/SSEM/factorial.ssem create mode 100644 Task/Factorial/SequenceL/factorial-1.sequencel create mode 100644 Task/Factorial/SequenceL/factorial-2.sequencel create mode 100644 Task/Factorial/SequenceL/factorial-3.sequencel create mode 100644 Task/Factorial/SequenceL/factorial-4.sequencel create mode 100644 Task/Factorial/Shen/factorial.shen create mode 100644 Task/Factorial/Sidef/factorial.sidef create mode 100644 Task/Factorial/Swift/factorial-1.swift create mode 100644 Task/Factorial/Swift/factorial-2.swift create mode 100644 Task/Factorial/Ursa/factorial-1.ursa create mode 100644 Task/Factorial/Ursa/factorial-2.ursa create mode 100644 Task/Factorial/Wart/factorial-1.wart create mode 100644 Task/Factorial/Wart/factorial-2.wart create mode 100644 Task/Factorial/Wart/factorial-3.wart create mode 100644 Task/Factorial/Wart/factorial-4.wart create mode 100644 Task/Factorial/Wortel/factorial-1.wortel create mode 100644 Task/Factorial/Wortel/factorial-2.wortel create mode 100644 Task/Factorial/Wortel/factorial-3.wortel create mode 100644 Task/Factorial/Wortel/factorial-4.wortel create mode 100644 Task/Factorial/Wortel/factorial-5.wortel create mode 100644 Task/Factorial/jq/factorial-1.jq create mode 100644 Task/Factorial/jq/factorial-2.jq create mode 100644 Task/Factorial/jq/factorial-3.jq create mode 100644 Task/Factors-of-a-Mersenne-number/EchoLisp/factors-of-a-mersenne-number.echolisp create mode 100644 Task/Factors-of-a-Mersenne-number/FreeBASIC/factors-of-a-mersenne-number.freebasic create mode 100644 Task/Factors-of-a-Mersenne-number/Nim/factors-of-a-mersenne-number.nim create mode 100644 Task/Factors-of-a-Mersenne-number/Sidef/factors-of-a-mersenne-number.sidef create mode 100644 Task/Factors-of-an-integer/Ceylon/factors-of-an-integer.ceylon create mode 100644 Task/Factors-of-an-integer/ERRE/factors-of-an-integer.erre create mode 100644 Task/Factors-of-an-integer/EchoLisp/factors-of-an-integer-1.echolisp create mode 100644 Task/Factors-of-an-integer/EchoLisp/factors-of-an-integer-2.echolisp create mode 100644 Task/Factors-of-an-integer/FreeBASIC/factors-of-an-integer.freebasic create mode 100644 Task/Factors-of-an-integer/FunL/factors-of-an-integer-1.funl create mode 100644 Task/Factors-of-an-integer/FunL/factors-of-an-integer-2.funl create mode 100644 Task/Factors-of-an-integer/FutureBasic/factors-of-an-integer.futurebasic create mode 100644 Task/Factors-of-an-integer/LFE/factors-of-an-integer-1.lfe create mode 100644 Task/Factors-of-an-integer/LFE/factors-of-an-integer-2.lfe create mode 100644 Task/Factors-of-an-integer/Lingo/factors-of-an-integer-1.lingo create mode 100644 Task/Factors-of-an-integer/Lingo/factors-of-an-integer-2.lingo create mode 100644 Task/Factors-of-an-integer/Nim/factors-of-an-integer.nim create mode 100644 Task/Factors-of-an-integer/Oforth/factors-of-an-integer.oforth create mode 100644 Task/Factors-of-an-integer/Panda/factors-of-an-integer.panda create mode 100644 Task/Factors-of-an-integer/Ring/factors-of-an-integer.ring create mode 100644 Task/Factors-of-an-integer/SequenceL/factors-of-an-integer-1.sequencel create mode 100644 Task/Factors-of-an-integer/SequenceL/factors-of-an-integer-2.sequencel create mode 100644 Task/Factors-of-an-integer/Sidef/factors-of-an-integer.sidef create mode 100644 Task/Factors-of-an-integer/Swift/factors-of-an-integer-1.swift create mode 100644 Task/Factors-of-an-integer/Swift/factors-of-an-integer-2.swift create mode 100644 Task/Factors-of-an-integer/Swift/factors-of-an-integer-3.swift create mode 100644 Task/Factors-of-an-integer/Ursa/factors-of-an-integer.ursa create mode 100644 Task/Factors-of-an-integer/Wortel/factors-of-an-integer.wortel create mode 100644 Task/Factors-of-an-integer/jq/factors-of-an-integer.jq create mode 100644 Task/Fast-Fourier-transform/Crystal/fast-fourier-transform.crystal create mode 100644 Task/Fast-Fourier-transform/ERRE/fast-fourier-transform.erre create mode 100644 Task/Fast-Fourier-transform/EchoLisp/fast-fourier-transform.echolisp create mode 100644 Task/Fast-Fourier-transform/Idris/fast-fourier-transform.idris create mode 100644 Task/Fast-Fourier-transform/Nim/fast-fourier-transform.nim create mode 100644 Task/Fast-Fourier-transform/SequenceL/fast-fourier-transform.sequencel create mode 100644 Task/Fast-Fourier-transform/Sidef/fast-fourier-transform.sidef create mode 100644 Task/Fast-Fourier-transform/jq/fast-fourier-transform-1.jq create mode 100644 Task/Fast-Fourier-transform/jq/fast-fourier-transform-2.jq create mode 100644 Task/Fast-Fourier-transform/jq/fast-fourier-transform-3.jq create mode 100644 Task/Fibonacci-n-step-number-sequences/ERRE/fibonacci-n-step-number-sequences.erre create mode 100644 Task/Fibonacci-n-step-number-sequences/EchoLisp/fibonacci-n-step-number-sequences.echolisp create mode 100644 Task/Fibonacci-n-step-number-sequences/FreeBASIC/fibonacci-n-step-number-sequences.freebasic create mode 100644 Task/Fibonacci-n-step-number-sequences/FunL/fibonacci-n-step-number-sequences.funl create mode 100644 Task/Fibonacci-n-step-number-sequences/Nim/fibonacci-n-step-number-sequences.nim create mode 100644 Task/Fibonacci-n-step-number-sequences/Sidef/fibonacci-n-step-number-sequences.sidef create mode 100644 Task/Fibonacci-n-step-number-sequences/jq/fibonacci-n-step-number-sequences-1.jq create mode 100644 Task/Fibonacci-n-step-number-sequences/jq/fibonacci-n-step-number-sequences-2.jq create mode 100644 Task/Fibonacci-sequence/8th/fibonacci-sequence.8th create mode 100644 Task/Fibonacci-sequence/AntLang/fibonacci-sequence.antlang create mode 100644 Task/Fibonacci-sequence/Apex/fibonacci-sequence.apex create mode 100644 Task/Fibonacci-sequence/Axe/fibonacci-sequence.axe create mode 100644 Task/Fibonacci-sequence/Battlestar/fibonacci-sequence.battlestar create mode 100644 Task/Fibonacci-sequence/Computer-zero-Assembly/fibonacci-sequence.computer create mode 100644 Task/Fibonacci-sequence/ECL/fibonacci-sequence.ecl create mode 100644 Task/Fibonacci-sequence/EDSAC-order-code/fibonacci-sequence.edsac create mode 100644 Task/Fibonacci-sequence/ERRE/fibonacci-sequence.erre create mode 100644 Task/Fibonacci-sequence/EchoLisp/fibonacci-sequence.echolisp create mode 100644 Task/Fibonacci-sequence/Elm/fibonacci-sequence.elm create mode 100644 Task/Fibonacci-sequence/FOCAL/fibonacci-sequence.focal create mode 100644 Task/Fibonacci-sequence/FRISC-Assembly/fibonacci-sequence.frisc create mode 100644 Task/Fibonacci-sequence/FreeBASIC/fibonacci-sequence.freebasic create mode 100644 Task/Fibonacci-sequence/FunL/fibonacci-sequence-1.funl create mode 100644 Task/Fibonacci-sequence/FunL/fibonacci-sequence-2.funl create mode 100644 Task/Fibonacci-sequence/FunL/fibonacci-sequence-3.funl create mode 100644 Task/Fibonacci-sequence/FunL/fibonacci-sequence-4.funl create mode 100644 Task/Fibonacci-sequence/FunL/fibonacci-sequence-5.funl create mode 100644 Task/Fibonacci-sequence/FunL/fibonacci-sequence-6.funl create mode 100644 Task/Fibonacci-sequence/Futhark/fibonacci-sequence.futhark create mode 100644 Task/Fibonacci-sequence/FutureBasic/fibonacci-sequence.futurebasic create mode 100644 Task/Fibonacci-sequence/GFA-Basic/fibonacci-sequence.gfa create mode 100644 Task/Fibonacci-sequence/Harbour/fibonacci-sequence-1.harbour create mode 100644 Task/Fibonacci-sequence/Harbour/fibonacci-sequence-2.harbour create mode 100644 Task/Fibonacci-sequence/Hy/fibonacci-sequence.hy create mode 100644 Task/Fibonacci-sequence/Idris/fibonacci-sequence-1.idris create mode 100644 Task/Fibonacci-sequence/Idris/fibonacci-sequence-2.idris create mode 100644 Task/Fibonacci-sequence/Idris/fibonacci-sequence-3.idris create mode 100644 Task/Fibonacci-sequence/Idris/fibonacci-sequence-4.idris create mode 100644 Task/Fibonacci-sequence/L++/fibonacci-sequence.lpp create mode 100644 Task/Fibonacci-sequence/LFE/fibonacci-sequence-1.lfe create mode 100644 Task/Fibonacci-sequence/LFE/fibonacci-sequence-2.lfe create mode 100644 Task/Fibonacci-sequence/Lasso/fibonacci-sequence.lasso create mode 100644 Task/Fibonacci-sequence/Lingo/fibonacci-sequence-1.lingo create mode 100644 Task/Fibonacci-sequence/Lingo/fibonacci-sequence-2.lingo create mode 100644 Task/Fibonacci-sequence/Lingo/fibonacci-sequence-3.lingo create mode 100644 Task/Fibonacci-sequence/LiveCode/fibonacci-sequence.livecode create mode 100644 Task/Fibonacci-sequence/Luck/fibonacci-sequence.luck create mode 100644 Task/Fibonacci-sequence/Monicelli/fibonacci-sequence.monicelli create mode 100644 Task/Fibonacci-sequence/NESL/fibonacci-sequence.nesl create mode 100644 Task/Fibonacci-sequence/NGS/fibonacci-sequence.ngs create mode 100644 Task/Fibonacci-sequence/Nim/fibonacci-sequence-1.nim create mode 100644 Task/Fibonacci-sequence/Nim/fibonacci-sequence-2.nim create mode 100644 Task/Fibonacci-sequence/Nim/fibonacci-sequence-3.nim create mode 100644 Task/Fibonacci-sequence/Nim/fibonacci-sequence-4.nim create mode 100644 Task/Fibonacci-sequence/Nim/fibonacci-sequence-5.nim create mode 100644 Task/Fibonacci-sequence/Oforth/fibonacci-sequence.oforth create mode 100644 Task/Fibonacci-sequence/Phix/fibonacci-sequence-1.phix create mode 100644 Task/Fibonacci-sequence/Phix/fibonacci-sequence-2.phix create mode 100644 Task/Fibonacci-sequence/Potion/fibonacci-sequence-1.potion create mode 100644 Task/Fibonacci-sequence/Potion/fibonacci-sequence-2.potion create mode 100644 Task/Fibonacci-sequence/Potion/fibonacci-sequence-3.potion create mode 100644 Task/Fibonacci-sequence/Potion/fibonacci-sequence-4.potion create mode 100644 Task/Fibonacci-sequence/Ra/fibonacci-sequence.ra create mode 100644 Task/Fibonacci-sequence/Ring/fibonacci-sequence.ring create mode 100644 Task/Fibonacci-sequence/SSEM/fibonacci-sequence.ssem create mode 100644 Task/Fibonacci-sequence/SequenceL/fibonacci-sequence-1.sequencel create mode 100644 Task/Fibonacci-sequence/SequenceL/fibonacci-sequence-2.sequencel create mode 100644 Task/Fibonacci-sequence/SequenceL/fibonacci-sequence-3.sequencel create mode 100644 Task/Fibonacci-sequence/Shen/fibonacci-sequence.shen create mode 100644 Task/Fibonacci-sequence/Sidef/fibonacci-sequence-1.sidef create mode 100644 Task/Fibonacci-sequence/Sidef/fibonacci-sequence-2.sidef create mode 100644 Task/Fibonacci-sequence/Sidef/fibonacci-sequence-3.sidef create mode 100644 Task/Fibonacci-sequence/Sidef/fibonacci-sequence-4.sidef create mode 100644 Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-1.skookum create mode 100644 Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-2.skookum create mode 100644 Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-3.skookum create mode 100644 Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-4.skookum create mode 100644 Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-5.skookum create mode 100644 Task/Fibonacci-sequence/Swift/fibonacci-sequence-1.swift create mode 100644 Task/Fibonacci-sequence/Swift/fibonacci-sequence-2.swift create mode 100644 Task/Fibonacci-sequence/Swift/fibonacci-sequence-3.swift create mode 100644 Task/Fibonacci-sequence/Swift/fibonacci-sequence-4.swift create mode 100644 Task/Fibonacci-sequence/Ursa/fibonacci-sequence.ursa create mode 100644 Task/Fibonacci-sequence/Wart/fibonacci-sequence-1.wart create mode 100644 Task/Fibonacci-sequence/Wart/fibonacci-sequence-2.wart create mode 100644 Task/Fibonacci-sequence/Wart/fibonacci-sequence-3.wart create mode 100644 Task/Fibonacci-sequence/XLISP/fibonacci-sequence-1.xlisp create mode 100644 Task/Fibonacci-sequence/XLISP/fibonacci-sequence-2.xlisp create mode 100644 Task/Fibonacci-sequence/jq/fibonacci-sequence-1.jq create mode 100644 Task/Fibonacci-sequence/jq/fibonacci-sequence-2.jq create mode 100644 Task/Fibonacci-sequence/jq/fibonacci-sequence-3.jq create mode 100644 Task/Fibonacci-sequence/jq/fibonacci-sequence-4.jq create mode 100644 Task/Fibonacci-sequence/jq/fibonacci-sequence-5.jq create mode 100644 Task/Fibonacci-sequence/jq/fibonacci-sequence-6.jq create mode 100644 Task/Fibonacci-word-fractal/FreeBASIC/fibonacci-word-fractal.freebasic create mode 100644 Task/Fibonacci-word-fractal/Sidef/fibonacci-word-fractal.sidef create mode 100644 Task/Fibonacci-word/EchoLisp/fibonacci-word.echolisp create mode 100644 Task/Fibonacci-word/FreeBASIC/fibonacci-word.freebasic create mode 100644 Task/Fibonacci-word/Oforth/fibonacci-word.oforth create mode 100644 Task/Fibonacci-word/Sidef/fibonacci-word.sidef create mode 100644 Task/Fibonacci-word/jq/fibonacci-word-1.jq create mode 100644 Task/Fibonacci-word/jq/fibonacci-word-2.jq create mode 100644 Task/Fibonacci-word/jq/fibonacci-word-3.jq create mode 100644 Task/File-input-output/FreeBASIC/file-input-output.freebasic create mode 100644 Task/File-input-output/I/file-input-output.i create mode 100644 Task/File-input-output/Lingo/file-input-output-1.lingo create mode 100644 Task/File-input-output/Lingo/file-input-output-2.lingo create mode 100644 Task/File-input-output/Nim/file-input-output-1.nim create mode 100644 Task/File-input-output/Nim/file-input-output-2.nim create mode 100644 Task/File-input-output/Nim/file-input-output-3.nim create mode 100644 Task/File-input-output/Nim/file-input-output-4.nim create mode 100644 Task/File-input-output/Nim/file-input-output-5.nim create mode 100644 Task/File-input-output/Oforth/file-input-output-1.oforth create mode 100644 Task/File-input-output/Oforth/file-input-output-2.oforth create mode 100644 Task/File-input-output/Phix/file-input-output-1.phix create mode 100644 Task/File-input-output/Phix/file-input-output-2.phix create mode 100644 Task/File-input-output/Phix/file-input-output-3.phix create mode 100644 Task/File-input-output/Ring/file-input-output.ring create mode 100644 Task/File-input-output/Sidef/file-input-output.sidef create mode 100644 Task/File-input-output/Ursa/file-input-output.ursa create mode 100644 Task/File-input-output/Wart/file-input-output.wart create mode 100644 Task/File-input-output/jq/file-input-output-1.jq create mode 100644 Task/File-input-output/jq/file-input-output-2.jq create mode 100644 Task/File-modification-time/FreeBASIC/file-modification-time.freebasic create mode 100644 Task/File-modification-time/Lasso/file-modification-time.lasso create mode 100644 Task/File-modification-time/Nim/file-modification-time.nim create mode 100644 Task/File-modification-time/Oforth/file-modification-time.oforth create mode 100644 Task/File-modification-time/Sidef/file-modification-time.sidef create mode 100644 Task/File-modification-time/Ursa/file-modification-time.ursa create mode 100644 Task/File-size/Axe/file-size.axe create mode 100644 Task/File-size/FreeBASIC/file-size.freebasic create mode 100644 Task/File-size/Lasso/file-size.lasso create mode 100644 Task/File-size/Lingo/file-size.lingo create mode 100644 Task/File-size/LiveCode/file-size.livecode create mode 100644 Task/File-size/Nim/file-size.nim create mode 100644 Task/File-size/Oforth/file-size.oforth create mode 100644 Task/File-size/Phix/file-size.phix create mode 100644 Task/File-size/Ring/file-size.ring create mode 100644 Task/File-size/Sidef/file-size.sidef create mode 100644 Task/File-size/Ursa/file-size.ursa create mode 100644 Task/File-size/jq/file-size.jq create mode 100644 Task/Filter/AntLang/filter.antlang create mode 100644 Task/Filter/Apex/filter.apex create mode 100644 Task/Filter/EchoLisp/filter.echolisp create mode 100644 Task/Filter/FreeBASIC/filter.freebasic create mode 100644 Task/Filter/Futhark/filter.futhark create mode 100644 Task/Filter/Lasso/filter-1.lasso create mode 100644 Task/Filter/Lasso/filter-2.lasso create mode 100644 Task/Filter/Nim/filter.nim create mode 100644 Task/Filter/Oforth/filter.oforth create mode 100644 Task/Filter/PHL/filter.phl create mode 100644 Task/Filter/Peloton/filter.peloton create mode 100644 Task/Filter/Phix/filter-1.phix create mode 100644 Task/Filter/Phix/filter-2.phix create mode 100644 Task/Filter/Ring/filter.ring create mode 100644 Task/Filter/SequenceL/filter.sequencel create mode 100644 Task/Filter/Sidef/filter.sidef create mode 100644 Task/Filter/Swift/filter.swift create mode 100644 Task/Filter/jq/filter-1.jq create mode 100644 Task/Filter/jq/filter-2.jq create mode 100644 Task/Find-common-directory-path/Lasso/find-common-directory-path.lasso create mode 100644 Task/Find-common-directory-path/Lingo/find-common-directory-path-1.lingo create mode 100644 Task/Find-common-directory-path/Lingo/find-common-directory-path-2.lingo create mode 100644 Task/Find-common-directory-path/Nim/find-common-directory-path.nim create mode 100644 Task/Find-common-directory-path/Sidef/find-common-directory-path.sidef create mode 100644 Task/Find-common-directory-path/jq/find-common-directory-path-1.jq create mode 100644 Task/Find-common-directory-path/jq/find-common-directory-path-2.jq create mode 100644 Task/Find-largest-left-truncatable-prime-in-a-given-base/Sidef/find-largest-left-truncatable-prime-in-a-given-base.sidef create mode 100644 Task/Find-limit-of-recursion/Axe/find-limit-of-recursion.axe create mode 100644 Task/Find-limit-of-recursion/Gri/find-limit-of-recursion.gri create mode 100644 Task/Find-limit-of-recursion/I/find-limit-of-recursion.i create mode 100644 Task/Find-limit-of-recursion/Nim/find-limit-of-recursion.nim create mode 100644 Task/Find-limit-of-recursion/Oforth/find-limit-of-recursion.oforth create mode 100644 Task/Find-limit-of-recursion/Phix/find-limit-of-recursion.phix create mode 100644 Task/Find-limit-of-recursion/Ring/find-limit-of-recursion.ring create mode 100644 Task/Find-limit-of-recursion/Sidef/find-limit-of-recursion.sidef create mode 100644 Task/Find-limit-of-recursion/Ursa/find-limit-of-recursion.ursa create mode 100644 Task/Find-limit-of-recursion/jq/find-limit-of-recursion-1.jq create mode 100644 Task/Find-limit-of-recursion/jq/find-limit-of-recursion-2.jq create mode 100644 Task/Find-limit-of-recursion/jq/find-limit-of-recursion-3.jq create mode 100644 Task/Find-limit-of-recursion/jq/find-limit-of-recursion-4.jq create mode 100644 Task/Find-limit-of-recursion/jq/find-limit-of-recursion-5.jq create mode 100644 Task/Find-the-last-Sunday-of-each-month/FreeBASIC/find-the-last-sunday-of-each-month.freebasic create mode 100644 Task/Find-the-last-Sunday-of-each-month/Lasso/find-the-last-sunday-of-each-month.lasso create mode 100644 Task/Find-the-last-Sunday-of-each-month/LiveCode/find-the-last-sunday-of-each-month-1.livecode create mode 100644 Task/Find-the-last-Sunday-of-each-month/LiveCode/find-the-last-sunday-of-each-month-2.livecode create mode 100644 Task/Find-the-last-Sunday-of-each-month/Nim/find-the-last-sunday-of-each-month.nim create mode 100644 Task/Find-the-last-Sunday-of-each-month/Oforth/find-the-last-sunday-of-each-month.oforth create mode 100644 Task/Find-the-last-Sunday-of-each-month/Phix/find-the-last-sunday-of-each-month.phix create mode 100644 Task/Find-the-last-Sunday-of-each-month/Ring/find-the-last-sunday-of-each-month.ring create mode 100644 Task/Find-the-last-Sunday-of-each-month/Sidef/find-the-last-sunday-of-each-month.sidef create mode 100644 Task/Find-the-last-Sunday-of-each-month/jq/find-the-last-sunday-of-each-month-1.jq create mode 100644 Task/Find-the-last-Sunday-of-each-month/jq/find-the-last-sunday-of-each-month-2.jq create mode 100644 Task/Find-the-last-Sunday-of-each-month/jq/find-the-last-sunday-of-each-month-3.jq create mode 100644 Task/Find-the-missing-permutation/ERRE/find-the-missing-permutation.erre create mode 100644 Task/Find-the-missing-permutation/EchoLisp/find-the-missing-permutation.echolisp create mode 100644 Task/Find-the-missing-permutation/Nim/find-the-missing-permutation.nim create mode 100644 Task/Find-the-missing-permutation/Phix/find-the-missing-permutation.phix create mode 100644 Task/Find-the-missing-permutation/Ring/find-the-missing-permutation.ring create mode 100644 Task/Find-the-missing-permutation/Sidef/find-the-missing-permutation.sidef create mode 100644 Task/Find-the-missing-permutation/jq/find-the-missing-permutation-1.jq create mode 100644 Task/Find-the-missing-permutation/jq/find-the-missing-permutation-2.jq create mode 100644 Task/Find-the-missing-permutation/jq/find-the-missing-permutation-3.jq create mode 100644 Task/First-class-environments/EchoLisp/first-class-environments.echolisp create mode 100644 Task/First-class-environments/Sidef/first-class-environments.sidef create mode 100644 Task/First-class-functions-Use-numbers-analogously/Oforth/first-class-functions-use-numbers-analogously.oforth create mode 100644 Task/First-class-functions-Use-numbers-analogously/Phix/first-class-functions-use-numbers-analogously-1.phix create mode 100644 Task/First-class-functions-Use-numbers-analogously/Phix/first-class-functions-use-numbers-analogously-2.phix create mode 100644 Task/First-class-functions-Use-numbers-analogously/Sidef/first-class-functions-use-numbers-analogously.sidef create mode 100644 Task/First-class-functions-Use-numbers-analogously/jq/first-class-functions-use-numbers-analogously.jq create mode 100644 Task/First-class-functions/Ceylon/first-class-functions-1.ceylon create mode 100644 Task/First-class-functions/Ceylon/first-class-functions-2.ceylon create mode 100644 Task/First-class-functions/EchoLisp/first-class-functions.echolisp create mode 100644 Task/First-class-functions/Lasso/first-class-functions.lasso create mode 100644 Task/First-class-functions/Lingo/first-class-functions-1.lingo create mode 100644 Task/First-class-functions/Lingo/first-class-functions-2.lingo create mode 100644 Task/First-class-functions/Nim/first-class-functions.nim create mode 100644 Task/First-class-functions/Oforth/first-class-functions.oforth create mode 100644 Task/First-class-functions/Phix/first-class-functions.phix create mode 100644 Task/First-class-functions/Sidef/first-class-functions.sidef create mode 100644 Task/First-class-functions/Swift/first-class-functions.swift create mode 100644 Task/Five-weekends/Ceylon/five-weekends-1.ceylon create mode 100644 Task/Five-weekends/Ceylon/five-weekends-2.ceylon create mode 100644 Task/Five-weekends/ERRE/five-weekends.erre create mode 100644 Task/Five-weekends/FreeBASIC/five-weekends.freebasic create mode 100644 Task/Five-weekends/Harbour/five-weekends.harbour create mode 100644 Task/Five-weekends/Lasso/five-weekends.lasso create mode 100644 Task/Five-weekends/Nim/five-weekends.nim create mode 100644 Task/Five-weekends/Oforth/five-weekends.oforth create mode 100644 Task/Five-weekends/Phix/five-weekends.phix create mode 100644 Task/Five-weekends/Ring/five-weekends.ring create mode 100644 Task/Five-weekends/Sidef/five-weekends.sidef create mode 100644 Task/Five-weekends/jq/five-weekends-1.jq create mode 100644 Task/Five-weekends/jq/five-weekends-2.jq create mode 100644 Task/Five-weekends/jq/five-weekends-3.jq create mode 100644 Task/Five-weekends/jq/five-weekends-4.jq create mode 100644 Task/FizzBuzz/8th/fizzbuzz.8th create mode 100644 Task/FizzBuzz/AntLang/fizzbuzz.antlang create mode 100644 Task/FizzBuzz/Arc/fizzbuzz-1.arc create mode 100644 Task/FizzBuzz/Arc/fizzbuzz-2.arc create mode 100644 Task/FizzBuzz/Arc/fizzbuzz-3.arc create mode 100644 Task/FizzBuzz/Axe/fizzbuzz.axe create mode 100644 Task/FizzBuzz/Ceylon/fizzbuzz.ceylon create mode 100644 Task/FizzBuzz/Coco/fizzbuzz-1.coco create mode 100644 Task/FizzBuzz/Coco/fizzbuzz-2.coco create mode 100644 Task/FizzBuzz/Crystal/fizzbuzz.crystal create mode 100644 Task/FizzBuzz/ECL/fizzbuzz.ecl create mode 100644 Task/FizzBuzz/ERRE/fizzbuzz.erre create mode 100644 Task/FizzBuzz/Eero/fizzbuzz.eero create mode 100644 Task/FizzBuzz/Elm/fizzbuzz-1.elm create mode 100644 Task/FizzBuzz/Elm/fizzbuzz-2.elm create mode 100644 Task/FizzBuzz/FOCAL/fizzbuzz.focal create mode 100644 Task/FizzBuzz/FutureBasic/fizzbuzz.futurebasic create mode 100644 Task/FizzBuzz/GFA-Basic/fizzbuzz.gfa create mode 100644 Task/FizzBuzz/Hoon/fizzbuzz.hoon create mode 100644 Task/FizzBuzz/Hy/fizzbuzz.hy create mode 100644 Task/FizzBuzz/I/fizzbuzz.i create mode 100644 Task/FizzBuzz/Idris/fizzbuzz.idris create mode 100644 Task/FizzBuzz/Kamailio-Script/fizzbuzz.kamailio create mode 100644 Task/FizzBuzz/Klong/fizzbuzz.klong create mode 100644 Task/FizzBuzz/Lasso/fizzbuzz.lasso create mode 100644 Task/FizzBuzz/LiveCode/fizzbuzz.livecode create mode 100644 Task/FizzBuzz/LiveScript/fizzbuzz.live create mode 100644 Task/FizzBuzz/Lobster/fizzbuzz.lobster create mode 100644 Task/FizzBuzz/Luck/fizzbuzz.luck create mode 100644 Task/FizzBuzz/Monte/fizzbuzz.monte create mode 100644 Task/FizzBuzz/MoonScript/fizzbuzz.moon create mode 100644 Task/FizzBuzz/NewtonScript/fizzbuzz.newton create mode 100644 Task/FizzBuzz/Nim/fizzbuzz-1.nim create mode 100644 Task/FizzBuzz/Nim/fizzbuzz-2.nim create mode 100644 Task/FizzBuzz/Nim/fizzbuzz-3.nim create mode 100644 Task/FizzBuzz/Oforth/fizzbuzz.oforth create mode 100644 Task/FizzBuzz/PHL/fizzbuzz.phl create mode 100644 Task/FizzBuzz/Peloton/fizzbuzz-1.peloton create mode 100644 Task/FizzBuzz/Peloton/fizzbuzz-2.peloton create mode 100644 Task/FizzBuzz/Phix/fizzbuzz.phix create mode 100644 Task/FizzBuzz/Pony/fizzbuzz.pony create mode 100644 Task/FizzBuzz/Potion/fizzbuzz.potion create mode 100644 Task/FizzBuzz/Pyret/fizzbuzz.pyret create mode 100644 Task/FizzBuzz/Ring/fizzbuzz.ring create mode 100644 Task/FizzBuzz/SequenceL/fizzbuzz.sequencel create mode 100644 Task/FizzBuzz/Shen/fizzbuzz.shen create mode 100644 Task/FizzBuzz/Sidef/fizzbuzz-1.sidef create mode 100644 Task/FizzBuzz/Sidef/fizzbuzz-2.sidef create mode 100644 Task/FizzBuzz/Sidef/fizzbuzz-3.sidef create mode 100644 Task/FizzBuzz/SkookumScript/fizzbuzz-1.skookum create mode 100644 Task/FizzBuzz/SkookumScript/fizzbuzz-2.skookum create mode 100644 Task/FizzBuzz/SkookumScript/fizzbuzz-3.skookum create mode 100644 Task/FizzBuzz/Swift/fizzbuzz.swift create mode 100644 Task/FizzBuzz/Symsyn/fizzbuzz.symsyn create mode 100644 Task/FizzBuzz/Ursa/fizzbuzz.ursa create mode 100644 Task/FizzBuzz/Wart/fizzbuzz.wart create mode 100644 Task/FizzBuzz/Wortel/fizzbuzz.wortel create mode 100644 Task/FizzBuzz/XLISP/fizzbuzz.xlisp create mode 100644 Task/FizzBuzz/XPath-2.0/fizzbuzz-1.xpath create mode 100644 Task/FizzBuzz/XPath-2.0/fizzbuzz-2.xpath create mode 100644 Task/FizzBuzz/jq/fizzbuzz-1.jq create mode 100644 Task/FizzBuzz/jq/fizzbuzz-2.jq create mode 100644 Task/Flatten-a-list/8th/flatten-a-list.8th create mode 100644 Task/Flatten-a-list/Ceylon/flatten-a-list.ceylon create mode 100644 Task/Flatten-a-list/EchoLisp/flatten-a-list.echolisp create mode 100644 Task/Flatten-a-list/Elm/flatten-a-list.elm create mode 100644 Task/Flatten-a-list/LFE/flatten-a-list.lfe create mode 100644 Task/Flatten-a-list/Lasso/flatten-a-list.lasso create mode 100644 Task/Flatten-a-list/NGS/flatten-a-list.ngs create mode 100644 Task/Flatten-a-list/Nim/flatten-a-list.nim create mode 100644 Task/Flatten-a-list/Oforth/flatten-a-list.oforth create mode 100644 Task/Flatten-a-list/Phix/flatten-a-list.phix create mode 100644 Task/Flatten-a-list/Red/flatten-a-list.red create mode 100644 Task/Flatten-a-list/Ring/flatten-a-list.ring create mode 100644 Task/Flatten-a-list/Sidef/flatten-a-list.sidef create mode 100644 Task/Flatten-a-list/Swift/flatten-a-list-1.swift create mode 100644 Task/Flatten-a-list/Swift/flatten-a-list-2.swift create mode 100644 Task/Flatten-a-list/Swift/flatten-a-list-3.swift create mode 100644 Task/Flatten-a-list/Wart/flatten-a-list.wart create mode 100644 Task/Flatten-a-list/jq/flatten-a-list-1.jq create mode 100644 Task/Flatten-a-list/jq/flatten-a-list-2.jq create mode 100644 Task/Flipping-bits-game/Swift/flipping-bits-game.swift create mode 100644 Task/Flow-control-structures/Comal/flow-control-structures-1.comal create mode 100644 Task/Flow-control-structures/Comal/flow-control-structures-2.comal create mode 100644 Task/Flow-control-structures/Comal/flow-control-structures-3.comal create mode 100644 Task/Flow-control-structures/Comal/flow-control-structures-4.comal create mode 100644 Task/Flow-control-structures/Nim/flow-control-structures-1.nim create mode 100644 Task/Flow-control-structures/Nim/flow-control-structures-2.nim create mode 100644 Task/Flow-control-structures/Oforth/flow-control-structures-1.oforth create mode 100644 Task/Flow-control-structures/Oforth/flow-control-structures-2.oforth create mode 100644 Task/Flow-control-structures/Oforth/flow-control-structures-3.oforth create mode 100644 Task/Flow-control-structures/Phix/flow-control-structures-1.phix create mode 100644 Task/Flow-control-structures/Phix/flow-control-structures-2.phix create mode 100644 Task/Flow-control-structures/Phix/flow-control-structures-3.phix create mode 100644 Task/Flow-control-structures/Phix/flow-control-structures-4.phix create mode 100644 Task/Flow-control-structures/Ring/flow-control-structures.ring create mode 100644 Task/Flow-control-structures/SSEM/flow-control-structures-1.ssem create mode 100644 Task/Flow-control-structures/SSEM/flow-control-structures-2.ssem create mode 100644 Task/Floyds-triangle/ERRE/floyds-triangle.erre create mode 100644 Task/Floyds-triangle/FreeBASIC/floyds-triangle.freebasic create mode 100644 Task/Floyds-triangle/Lasso/floyds-triangle.lasso create mode 100644 Task/Floyds-triangle/Nim/floyds-triangle.nim create mode 100644 Task/Floyds-triangle/Ring/floyds-triangle.ring create mode 100644 Task/Floyds-triangle/Sidef/floyds-triangle.sidef create mode 100644 Task/Floyds-triangle/jq/floyds-triangle-1.jq create mode 100644 Task/Floyds-triangle/jq/floyds-triangle-2.jq create mode 100644 Task/Floyds-triangle/jq/floyds-triangle-3.jq create mode 100644 Task/Forest-fire/Ceylon/forest-fire.ceylon create mode 100644 Task/Forest-fire/Nim/forest-fire.nim create mode 100644 Task/Forest-fire/Sidef/forest-fire-1.sidef create mode 100644 Task/Forest-fire/Sidef/forest-fire-2.sidef create mode 100644 Task/Fork/LFE/fork.lfe create mode 100644 Task/Fork/Lasso/fork.lasso create mode 100644 Task/Fork/Nim/fork.nim create mode 100644 Task/Fork/Phix/fork-1.phix create mode 100644 Task/Fork/Phix/fork-2.phix create mode 100644 Task/Fork/Sidef/fork.sidef create mode 100644 Task/Fork/Wart/fork.wart create mode 100644 Task/Formal-power-series/EchoLisp/formal-power-series-1.echolisp create mode 100644 Task/Formal-power-series/EchoLisp/formal-power-series-2.echolisp create mode 100644 Task/Formal-power-series/jq/formal-power-series-1.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-10.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-11.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-12.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-13.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-14.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-15.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-16.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-17.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-2.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-3.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-4.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-5.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-6.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-7.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-8.jq create mode 100644 Task/Formal-power-series/jq/formal-power-series-9.jq create mode 100644 Task/Formatted-numeric-output/8th/formatted-numeric-output.8th create mode 100644 Task/Formatted-numeric-output/ERRE/formatted-numeric-output.erre create mode 100644 Task/Formatted-numeric-output/FreeBASIC/formatted-numeric-output.freebasic create mode 100644 Task/Formatted-numeric-output/FutureBasic/formatted-numeric-output.futurebasic create mode 100644 Task/Formatted-numeric-output/Lasso/formatted-numeric-output.lasso create mode 100644 Task/Formatted-numeric-output/Nim/formatted-numeric-output.nim create mode 100644 Task/Formatted-numeric-output/Phix/formatted-numeric-output.phix create mode 100644 Task/Formatted-numeric-output/Ring/formatted-numeric-output.ring create mode 100644 Task/Formatted-numeric-output/Sidef/formatted-numeric-output-1.sidef create mode 100644 Task/Formatted-numeric-output/Sidef/formatted-numeric-output-2.sidef create mode 100644 Task/Formatted-numeric-output/jq/formatted-numeric-output-1.jq create mode 100644 Task/Formatted-numeric-output/jq/formatted-numeric-output-2.jq create mode 100644 Task/Formatted-numeric-output/jq/formatted-numeric-output-3.jq create mode 100644 Task/Formatted-numeric-output/jq/formatted-numeric-output-4.jq create mode 100644 Task/Formatted-numeric-output/jq/formatted-numeric-output-5.jq create mode 100644 Task/Forward-difference/EchoLisp/forward-difference.echolisp create mode 100644 Task/Forward-difference/Lasso/forward-difference.lasso create mode 100644 Task/Forward-difference/Nim/forward-difference.nim create mode 100644 Task/Forward-difference/Oforth/forward-difference.oforth create mode 100644 Task/Forward-difference/Sidef/forward-difference.sidef create mode 100644 Task/Forward-difference/Visual-FoxPro/forward-difference.visual create mode 100644 Task/Forward-difference/jq/forward-difference-1.jq create mode 100644 Task/Forward-difference/jq/forward-difference-2.jq create mode 100644 Task/Forward-difference/jq/forward-difference-3.jq create mode 100644 Task/Four-bit-adder/Nim/four-bit-adder.nim create mode 100644 Task/Four-bit-adder/Sidef/four-bit-adder.sidef create mode 100644 Task/Four-bit-adder/jq/four-bit-adder-1.jq create mode 100644 Task/Four-bit-adder/jq/four-bit-adder-2.jq create mode 100644 Task/Fractal-tree/Lingo/fractal-tree-1.lingo create mode 100644 Task/Fractal-tree/Lingo/fractal-tree-2.lingo create mode 100644 Task/Fractal-tree/Phix/fractal-tree.phix create mode 100644 Task/Fractal-tree/Ring/fractal-tree.ring create mode 100644 Task/Fractal-tree/Sidef/fractal-tree.sidef create mode 100644 Task/Fractal-tree/Swift/fractal-tree.swift create mode 100644 Task/Fractal-tree/TypeScript/fractal-tree.type create mode 100644 Task/Fractal-tree/jq/fractal-tree.jq create mode 100644 Task/Fractran/FreeBASIC/fractran.freebasic create mode 100644 Task/Fractran/Sidef/fractran.sidef create mode 100644 Task/Function-composition/AntLang/function-composition.antlang create mode 100644 Task/Function-composition/EchoLisp/function-composition-1.echolisp create mode 100644 Task/Function-composition/EchoLisp/function-composition-2.echolisp create mode 100644 Task/Function-composition/FunL/function-composition.funl create mode 100644 Task/Function-composition/LFE/function-composition-1.lfe create mode 100644 Task/Function-composition/LFE/function-composition-2.lfe create mode 100644 Task/Function-composition/Lingo/function-composition-1.lingo create mode 100644 Task/Function-composition/Lingo/function-composition-2.lingo create mode 100644 Task/Function-composition/Lingo/function-composition-3.lingo create mode 100644 Task/Function-composition/Lingo/function-composition-4.lingo create mode 100644 Task/Function-composition/Nim/function-composition.nim create mode 100644 Task/Function-composition/Oforth/function-composition-1.oforth create mode 100644 Task/Function-composition/Oforth/function-composition-2.oforth create mode 100644 Task/Function-composition/Oforth/function-composition-3.oforth create mode 100644 Task/Function-composition/Phix/function-composition.phix create mode 100644 Task/Function-composition/Sidef/function-composition.sidef create mode 100644 Task/Function-composition/Swift/function-composition.swift create mode 100644 Task/Function-composition/Wortel/function-composition-1.wortel create mode 100644 Task/Function-composition/Wortel/function-composition-2.wortel create mode 100644 Task/Function-composition/Wortel/function-composition-3.wortel create mode 100644 Task/Function-composition/jq/function-composition.jq create mode 100644 Task/Function-definition/8051-Assembly/function-definition.8051 create mode 100644 Task/Function-definition/AntLang/function-definition-1.antlang create mode 100644 Task/Function-definition/AntLang/function-definition-2.antlang create mode 100644 Task/Function-definition/Axe/function-definition.axe create mode 100644 Task/Function-definition/ChucK/function-definition.chuck create mode 100644 Task/Function-definition/Coco/function-definition-1.coco create mode 100644 Task/Function-definition/Coco/function-definition-2.coco create mode 100644 Task/Function-definition/EchoLisp/function-definition.echolisp create mode 100644 Task/Function-definition/FreeBASIC/function-definition-1.freebasic create mode 100644 Task/Function-definition/FreeBASIC/function-definition-2.freebasic create mode 100644 Task/Function-definition/Futhark/function-definition.futhark create mode 100644 Task/Function-definition/FutureBasic/function-definition.futurebasic create mode 100644 Task/Function-definition/LFE/function-definition.lfe create mode 100644 Task/Function-definition/Lasso/function-definition-1.lasso create mode 100644 Task/Function-definition/Lasso/function-definition-2.lasso create mode 100644 Task/Function-definition/Lasso/function-definition-3.lasso create mode 100644 Task/Function-definition/Lily/function-definition.lily create mode 100644 Task/Function-definition/Lingo/function-definition.lingo create mode 100644 Task/Function-definition/LiveCode/function-definition.livecode create mode 100644 Task/Function-definition/NESL/function-definition.nesl create mode 100644 Task/Function-definition/Nim/function-definition-1.nim create mode 100644 Task/Function-definition/Nim/function-definition-2.nim create mode 100644 Task/Function-definition/Nim/function-definition-3.nim create mode 100644 Task/Function-definition/Oforth/function-definition-1.oforth create mode 100644 Task/Function-definition/Oforth/function-definition-2.oforth create mode 100644 Task/Function-definition/PHL/function-definition.phl create mode 100644 Task/Function-definition/Phix/function-definition.phix create mode 100644 Task/Function-definition/Picat/function-definition.picat create mode 100644 Task/Function-definition/Ring/function-definition.ring create mode 100644 Task/Function-definition/SSEM/function-definition-1.ssem create mode 100644 Task/Function-definition/SSEM/function-definition-2.ssem create mode 100644 Task/Function-definition/Sidef/function-definition.sidef create mode 100644 Task/Function-definition/Swift/function-definition.swift create mode 100644 Task/Function-definition/Ursa/function-definition.ursa create mode 100644 Task/Function-definition/Wart/function-definition-1.wart create mode 100644 Task/Function-definition/Wart/function-definition-2.wart create mode 100644 Task/Function-definition/Wart/function-definition-3.wart create mode 100644 Task/Function-definition/Wart/function-definition-4.wart create mode 100644 Task/Function-definition/Wart/function-definition-5.wart create mode 100644 Task/Function-definition/XLISP/function-definition-1.xlisp create mode 100644 Task/Function-definition/XLISP/function-definition-2.xlisp create mode 100644 Task/Function-definition/XLISP/function-definition-3.xlisp create mode 100644 Task/Function-definition/jq/function-definition-1.jq create mode 100644 Task/Function-definition/jq/function-definition-2.jq create mode 100644 Task/Function-definition/jq/function-definition-3.jq create mode 100644 Task/Function-definition/jq/function-definition-4.jq create mode 100644 Task/Function-frequency/LiveCode/function-frequency-1.livecode create mode 100644 Task/Function-frequency/LiveCode/function-frequency-2.livecode create mode 100644 Task/Function-frequency/LiveCode/function-frequency-3.livecode create mode 100644 Task/Function-frequency/Sidef/function-frequency.sidef create mode 100644 Task/Function-prototype/FreeBASIC/function-prototype.freebasic create mode 100644 Task/Function-prototype/Luck/function-prototype.luck create mode 100644 Task/Function-prototype/Nim/function-prototype.nim create mode 100644 Task/Function-prototype/Oforth/function-prototype.oforth create mode 100644 Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-1.freebasic create mode 100644 Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-2.freebasic create mode 100644 Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-3.freebasic create mode 100644 Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-4.freebasic create mode 100644 Task/GUI-Maximum-window-dimensions/Lingo/gui-maximum-window-dimensions.lingo create mode 100644 Task/GUI-Maximum-window-dimensions/Nim/gui-maximum-window-dimensions-1.nim create mode 100644 Task/GUI-Maximum-window-dimensions/Nim/gui-maximum-window-dimensions-2.nim create mode 100644 Task/GUI-Maximum-window-dimensions/Ring/gui-maximum-window-dimensions.ring create mode 100644 Task/GUI-Maximum-window-dimensions/Sidef/gui-maximum-window-dimensions.sidef create mode 100644 Task/GUI-component-interaction/FreeBASIC/gui-component-interaction.freebasic create mode 100644 Task/GUI-component-interaction/Nim/gui-component-interaction-1.nim create mode 100644 Task/GUI-component-interaction/Nim/gui-component-interaction-2.nim create mode 100644 Task/GUI-component-interaction/Phix/gui-component-interaction.phix create mode 100644 Task/GUI-component-interaction/Ring/gui-component-interaction.ring create mode 100644 Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-1.livecode create mode 100644 Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-2.livecode create mode 100644 Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-3.livecode create mode 100644 Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-4.livecode create mode 100644 Task/GUI-enabling-disabling-of-controls/Nim/gui-enabling-disabling-of-controls-1.nim create mode 100644 Task/GUI-enabling-disabling-of-controls/Nim/gui-enabling-disabling-of-controls-2.nim create mode 100644 Task/GUI-enabling-disabling-of-controls/Phix/gui-enabling-disabling-of-controls.phix create mode 100644 Task/GUI-enabling-disabling-of-controls/Ring/gui-enabling-disabling-of-controls.ring create mode 100644 Task/Galton-box-animation/Elm/galton-box-animation.elm create mode 100644 Task/Gamma-function/FreeBASIC/gamma-function.freebasic create mode 100644 Task/Gamma-function/Nim/gamma-function.nim create mode 100644 Task/Gamma-function/Oforth/gamma-function.oforth create mode 100644 Task/Gamma-function/Ring/gamma-function.ring create mode 100644 Task/Gamma-function/Sidef/gamma-function-1.sidef create mode 100644 Task/Gamma-function/Sidef/gamma-function-2.sidef create mode 100644 Task/Gamma-function/Sidef/gamma-function-3.sidef create mode 100644 Task/Gamma-function/Visual-FoxPro/gamma-function.visual create mode 100644 Task/Gamma-function/jq/gamma-function-1.jq create mode 100644 Task/Gamma-function/jq/gamma-function-2.jq create mode 100644 Task/Gamma-function/jq/gamma-function-3.jq create mode 100644 Task/Gamma-function/jq/gamma-function-4.jq create mode 100644 Task/Gamma-function/jq/gamma-function-5.jq create mode 100644 Task/Gaussian-elimination/Sidef/gaussian-elimination.sidef create mode 100644 Task/Generate-Chess960-starting-position/EchoLisp/generate-chess960-starting-position.echolisp create mode 100644 Task/Generate-lower-case-ASCII-alphabet/8th/generate-lower-case-ascii-alphabet.8th create mode 100644 Task/Generate-lower-case-ASCII-alphabet/EchoLisp/generate-lower-case-ascii-alphabet.echolisp create mode 100644 Task/Generate-lower-case-ASCII-alphabet/FreeBASIC/generate-lower-case-ascii-alphabet.freebasic create mode 100644 Task/Generate-lower-case-ASCII-alphabet/LC3-Assembly/generate-lower-case-ascii-alphabet.lc3 create mode 100644 Task/Generate-lower-case-ASCII-alphabet/Lingo/generate-lower-case-ascii-alphabet.lingo create mode 100644 Task/Generate-lower-case-ASCII-alphabet/NESL/generate-lower-case-ascii-alphabet.nesl create mode 100644 Task/Generate-lower-case-ASCII-alphabet/Nim/generate-lower-case-ascii-alphabet.nim create mode 100644 Task/Generate-lower-case-ASCII-alphabet/Oforth/generate-lower-case-ascii-alphabet-1.oforth create mode 100644 Task/Generate-lower-case-ASCII-alphabet/Oforth/generate-lower-case-ascii-alphabet-2.oforth create mode 100644 Task/Generate-lower-case-ASCII-alphabet/Phix/generate-lower-case-ascii-alphabet-1.phix create mode 100644 Task/Generate-lower-case-ASCII-alphabet/Phix/generate-lower-case-ascii-alphabet-2.phix create mode 100644 Task/Generate-lower-case-ASCII-alphabet/Ring/generate-lower-case-ascii-alphabet.ring create mode 100644 Task/Generate-lower-case-ASCII-alphabet/Sidef/generate-lower-case-ascii-alphabet.sidef create mode 100644 Task/Generate-lower-case-ASCII-alphabet/Swift/generate-lower-case-ascii-alphabet.swift create mode 100644 Task/Generate-lower-case-ASCII-alphabet/Ursa/generate-lower-case-ascii-alphabet.ursa create mode 100644 Task/Generate-lower-case-ASCII-alphabet/XLISP/generate-lower-case-ascii-alphabet.xlisp create mode 100644 Task/Generate-lower-case-ASCII-alphabet/jq/generate-lower-case-ascii-alphabet.jq create mode 100644 Task/Generator-Exponential/EchoLisp/generator-exponential.echolisp create mode 100644 Task/Generator-Exponential/FunL/generator-exponential.funl create mode 100644 Task/Generator-Exponential/Nim/generator-exponential.nim create mode 100644 Task/Generator-Exponential/Sidef/generator-exponential.sidef create mode 100644 Task/Generator-Exponential/Swift/generator-exponential.swift create mode 100644 Task/Generator-Exponential/jq/generator-exponential-1.jq create mode 100644 Task/Generator-Exponential/jq/generator-exponential-2.jq create mode 100644 Task/Generator-Exponential/jq/generator-exponential-3.jq create mode 100644 Task/Generator-Exponential/jq/generator-exponential-4.jq create mode 100644 Task/Generator-Exponential/jq/generator-exponential-5.jq create mode 100644 Task/Generic-swap/8th/generic-swap-1.8th create mode 100644 Task/Generic-swap/8th/generic-swap-2.8th create mode 100644 Task/Generic-swap/Arc/generic-swap.arc create mode 100644 Task/Generic-swap/Axe/generic-swap.axe create mode 100644 Task/Generic-swap/EchoLisp/generic-swap.echolisp create mode 100644 Task/Generic-swap/FreeBASIC/generic-swap.freebasic create mode 100644 Task/Generic-swap/FutureBasic/generic-swap.futurebasic create mode 100644 Task/Generic-swap/Gri/generic-swap-1.gri create mode 100644 Task/Generic-swap/Gri/generic-swap-2.gri create mode 100644 Task/Generic-swap/Lasso/generic-swap-1.lasso create mode 100644 Task/Generic-swap/Lasso/generic-swap-2.lasso create mode 100644 Task/Generic-swap/Lingo/generic-swap-1.lingo create mode 100644 Task/Generic-swap/Lingo/generic-swap-2.lingo create mode 100644 Task/Generic-swap/LiveCode/generic-swap.livecode create mode 100644 Task/Generic-swap/Nim/generic-swap.nim create mode 100644 Task/Generic-swap/Oforth/generic-swap.oforth create mode 100644 Task/Generic-swap/Phix/generic-swap.phix create mode 100644 Task/Generic-swap/Ring/generic-swap.ring create mode 100644 Task/Generic-swap/Sidef/generic-swap-1.sidef create mode 100644 Task/Generic-swap/Sidef/generic-swap-2.sidef create mode 100644 Task/Generic-swap/Sidef/generic-swap-3.sidef create mode 100644 Task/Generic-swap/Sidef/generic-swap-4.sidef create mode 100644 Task/Generic-swap/Swift/generic-swap.swift create mode 100644 Task/Generic-swap/Visual-FoxPro/generic-swap.visual create mode 100644 Task/Generic-swap/Wart/generic-swap-1.wart create mode 100644 Task/Generic-swap/Wart/generic-swap-2.wart create mode 100644 Task/Generic-swap/jq/generic-swap-1.jq create mode 100644 Task/Generic-swap/jq/generic-swap-2.jq create mode 100644 Task/Generic-swap/jq/generic-swap-3.jq create mode 100644 Task/Globally-replace-text-in-several-files/Lasso/globally-replace-text-in-several-files.lasso create mode 100644 Task/Globally-replace-text-in-several-files/Nim/globally-replace-text-in-several-files.nim create mode 100644 Task/Globally-replace-text-in-several-files/Ring/globally-replace-text-in-several-files.ring create mode 100644 Task/Globally-replace-text-in-several-files/Sidef/globally-replace-text-in-several-files.sidef create mode 100644 Task/Gray-code/Nim/gray-code-1.nim create mode 100644 Task/Gray-code/Nim/gray-code-2.nim create mode 100644 Task/Gray-code/Phix/gray-code.phix create mode 100644 Task/Gray-code/Sidef/gray-code.sidef create mode 100644 Task/Grayscale-image/Lingo/grayscale-image.lingo create mode 100644 Task/Grayscale-image/Phix/grayscale-image.phix create mode 100644 Task/Grayscale-image/Sidef/grayscale-image.sidef create mode 100644 Task/Greatest-common-divisor/8th/greatest-common-divisor.8th create mode 100644 Task/Greatest-common-divisor/AntLang/greatest-common-divisor-1.antlang create mode 100644 Task/Greatest-common-divisor/AntLang/greatest-common-divisor-2.antlang create mode 100644 Task/Greatest-common-divisor/AntLang/greatest-common-divisor-3.antlang create mode 100644 Task/Greatest-common-divisor/AntLang/greatest-common-divisor-4.antlang create mode 100644 Task/Greatest-common-divisor/Axe/greatest-common-divisor.axe create mode 100644 Task/Greatest-common-divisor/ERRE/greatest-common-divisor.erre create mode 100644 Task/Greatest-common-divisor/Ezhil/greatest-common-divisor.ezhil create mode 100644 Task/Greatest-common-divisor/FreeBASIC/greatest-common-divisor.freebasic create mode 100644 Task/Greatest-common-divisor/FunL/greatest-common-divisor-1.funl create mode 100644 Task/Greatest-common-divisor/FunL/greatest-common-divisor-2.funl create mode 100644 Task/Greatest-common-divisor/FunL/greatest-common-divisor-3.funl create mode 100644 Task/Greatest-common-divisor/GFA-Basic/greatest-common-divisor.gfa create mode 100644 Task/Greatest-common-divisor/LFE/greatest-common-divisor.lfe create mode 100644 Task/Greatest-common-divisor/LiveCode/greatest-common-divisor.livecode create mode 100644 Task/Greatest-common-divisor/Luck/greatest-common-divisor.luck create mode 100644 Task/Greatest-common-divisor/MINIL/greatest-common-divisor.minil create mode 100644 Task/Greatest-common-divisor/Nim/greatest-common-divisor-1.nim create mode 100644 Task/Greatest-common-divisor/Nim/greatest-common-divisor-2.nim create mode 100644 Task/Greatest-common-divisor/Nim/greatest-common-divisor-3.nim create mode 100644 Task/Greatest-common-divisor/Oforth/greatest-common-divisor-1.oforth create mode 100644 Task/Greatest-common-divisor/Oforth/greatest-common-divisor-2.oforth create mode 100644 Task/Greatest-common-divisor/Phix/greatest-common-divisor.phix create mode 100644 Task/Greatest-common-divisor/Ring/greatest-common-divisor.ring create mode 100644 Task/Greatest-common-divisor/SequenceL/greatest-common-divisor.sequencel create mode 100644 Task/Greatest-common-divisor/Sidef/greatest-common-divisor-1.sidef create mode 100644 Task/Greatest-common-divisor/Sidef/greatest-common-divisor-2.sidef create mode 100644 Task/Greatest-common-divisor/Sparkling/greatest-common-divisor.sparkling create mode 100644 Task/Greatest-common-divisor/Swift/greatest-common-divisor.swift create mode 100644 Task/Greatest-common-divisor/TypeScript/greatest-common-divisor-1.type create mode 100644 Task/Greatest-common-divisor/TypeScript/greatest-common-divisor-2.type create mode 100644 Task/Greatest-common-divisor/Ursa/greatest-common-divisor.ursa create mode 100644 Task/Greatest-common-divisor/Wortel/greatest-common-divisor-1.wortel create mode 100644 Task/Greatest-common-divisor/Wortel/greatest-common-divisor-2.wortel create mode 100644 Task/Greatest-common-divisor/Wortel/greatest-common-divisor-3.wortel create mode 100644 Task/Greatest-common-divisor/Wortel/greatest-common-divisor-4.wortel create mode 100644 Task/Greatest-common-divisor/jq/greatest-common-divisor-1.jq create mode 100644 Task/Greatest-common-divisor/jq/greatest-common-divisor-2.jq create mode 100644 Task/Greatest-element-of-a-list/8th/greatest-element-of-a-list.8th create mode 100644 Task/Greatest-element-of-a-list/AntLang/greatest-element-of-a-list.antlang create mode 100644 Task/Greatest-element-of-a-list/Axe/greatest-element-of-a-list.axe create mode 100644 Task/Greatest-element-of-a-list/ECL/greatest-element-of-a-list.ecl create mode 100644 Task/Greatest-element-of-a-list/ERRE/greatest-element-of-a-list.erre create mode 100644 Task/Greatest-element-of-a-list/EchoLisp/greatest-element-of-a-list.echolisp create mode 100644 Task/Greatest-element-of-a-list/FreeBASIC/greatest-element-of-a-list.freebasic create mode 100644 Task/Greatest-element-of-a-list/FunL/greatest-element-of-a-list-1.funl create mode 100644 Task/Greatest-element-of-a-list/FunL/greatest-element-of-a-list-2.funl create mode 100644 Task/Greatest-element-of-a-list/Hoon/greatest-element-of-a-list.hoon create mode 100644 Task/Greatest-element-of-a-list/Klong/greatest-element-of-a-list.klong create mode 100644 Task/Greatest-element-of-a-list/LFE/greatest-element-of-a-list.lfe create mode 100644 Task/Greatest-element-of-a-list/Lasso/greatest-element-of-a-list.lasso create mode 100644 Task/Greatest-element-of-a-list/Lingo/greatest-element-of-a-list.lingo create mode 100644 Task/Greatest-element-of-a-list/LiveCode/greatest-element-of-a-list-1.livecode create mode 100644 Task/Greatest-element-of-a-list/LiveCode/greatest-element-of-a-list-2.livecode create mode 100644 Task/Greatest-element-of-a-list/Nim/greatest-element-of-a-list.nim create mode 100644 Task/Greatest-element-of-a-list/Oforth/greatest-element-of-a-list.oforth create mode 100644 Task/Greatest-element-of-a-list/Phix/greatest-element-of-a-list.phix create mode 100644 Task/Greatest-element-of-a-list/Ring/greatest-element-of-a-list.ring create mode 100644 Task/Greatest-element-of-a-list/Sidef/greatest-element-of-a-list.sidef create mode 100644 Task/Greatest-element-of-a-list/Swift/greatest-element-of-a-list-1.swift create mode 100644 Task/Greatest-element-of-a-list/Swift/greatest-element-of-a-list-2.swift create mode 100644 Task/Greatest-element-of-a-list/Ursa/greatest-element-of-a-list.ursa create mode 100644 Task/Greatest-element-of-a-list/Wart/greatest-element-of-a-list.wart create mode 100644 Task/Greatest-element-of-a-list/Wortel/greatest-element-of-a-list.wortel create mode 100644 Task/Greatest-element-of-a-list/jq/greatest-element-of-a-list-1.jq create mode 100644 Task/Greatest-element-of-a-list/jq/greatest-element-of-a-list-2.jq create mode 100644 Task/Greatest-subsequential-sum/ERRE/greatest-subsequential-sum.erre create mode 100644 Task/Greatest-subsequential-sum/EchoLisp/greatest-subsequential-sum.echolisp create mode 100644 Task/Greatest-subsequential-sum/FreeBASIC/greatest-subsequential-sum.freebasic create mode 100644 Task/Greatest-subsequential-sum/Nim/greatest-subsequential-sum.nim create mode 100644 Task/Greatest-subsequential-sum/Phix/greatest-subsequential-sum.phix create mode 100644 Task/Greatest-subsequential-sum/Potion/greatest-subsequential-sum.potion create mode 100644 Task/Greatest-subsequential-sum/Sidef/greatest-subsequential-sum.sidef create mode 100644 Task/Greatest-subsequential-sum/jq/greatest-subsequential-sum-1.jq create mode 100644 Task/Greatest-subsequential-sum/jq/greatest-subsequential-sum-2.jq create mode 100644 Task/Greatest-subsequential-sum/jq/greatest-subsequential-sum-3.jq create mode 100644 Task/Guess-the-number-With-feedback--player-/Ceylon/guess-the-number-with-feedback--player-.ceylon create mode 100644 Task/Guess-the-number-With-feedback--player-/FreeBASIC/guess-the-number-with-feedback--player-.freebasic create mode 100644 Task/Guess-the-number-With-feedback--player-/Lasso/guess-the-number-with-feedback--player-.lasso create mode 100644 Task/Guess-the-number-With-feedback--player-/Nim/guess-the-number-with-feedback--player-.nim create mode 100644 Task/Guess-the-number-With-feedback--player-/Phix/guess-the-number-with-feedback--player-.phix create mode 100644 Task/Guess-the-number-With-feedback--player-/Ring/guess-the-number-with-feedback--player-.ring create mode 100644 Task/Guess-the-number-With-feedback--player-/Sidef/guess-the-number-with-feedback--player-.sidef create mode 100644 Task/Guess-the-number-With-feedback--player-/Swift/guess-the-number-with-feedback--player-.swift create mode 100644 Task/Guess-the-number-With-feedback/Ceylon/guess-the-number-with-feedback.ceylon create mode 100644 Task/Guess-the-number-With-feedback/EchoLisp/guess-the-number-with-feedback.echolisp create mode 100644 Task/Guess-the-number-With-feedback/FreeBASIC/guess-the-number-with-feedback.freebasic create mode 100644 Task/Guess-the-number-With-feedback/LFE/guess-the-number-with-feedback-1.lfe create mode 100644 Task/Guess-the-number-With-feedback/LFE/guess-the-number-with-feedback-2.lfe create mode 100644 Task/Guess-the-number-With-feedback/Lasso/guess-the-number-with-feedback.lasso create mode 100644 Task/Guess-the-number-With-feedback/LiveCode/guess-the-number-with-feedback-1.livecode create mode 100644 Task/Guess-the-number-With-feedback/LiveCode/guess-the-number-with-feedback-2.livecode create mode 100644 Task/Guess-the-number-With-feedback/Nim/guess-the-number-with-feedback.nim create mode 100644 Task/Guess-the-number-With-feedback/Oforth/guess-the-number-with-feedback.oforth create mode 100644 Task/Guess-the-number-With-feedback/Phix/guess-the-number-with-feedback.phix create mode 100644 Task/Guess-the-number-With-feedback/Ring/guess-the-number-with-feedback.ring create mode 100644 Task/Guess-the-number-With-feedback/Sidef/guess-the-number-with-feedback.sidef create mode 100644 Task/Guess-the-number-With-feedback/Sparkling/guess-the-number-with-feedback.sparkling create mode 100644 Task/Guess-the-number-With-feedback/Swift/guess-the-number-with-feedback.swift create mode 100644 Task/Guess-the-number-With-feedback/Ursa/guess-the-number-with-feedback.ursa create mode 100644 Task/Guess-the-number-With-feedback/XLISP/guess-the-number-with-feedback.xlisp create mode 100644 Task/Guess-the-number/ERRE/guess-the-number.erre create mode 100644 Task/Guess-the-number/FreeBASIC/guess-the-number.freebasic create mode 100644 Task/Guess-the-number/LFE/guess-the-number-1.lfe create mode 100644 Task/Guess-the-number/LFE/guess-the-number-2.lfe create mode 100644 Task/Guess-the-number/Lasso/guess-the-number-1.lasso create mode 100644 Task/Guess-the-number/Lasso/guess-the-number-2.lasso create mode 100644 Task/Guess-the-number/LiveCode/guess-the-number.livecode create mode 100644 Task/Guess-the-number/Nim/guess-the-number.nim create mode 100644 Task/Guess-the-number/Oforth/guess-the-number.oforth create mode 100644 Task/Guess-the-number/Phix/guess-the-number.phix create mode 100644 Task/Guess-the-number/RPL/guess-the-number.rpl create mode 100644 Task/Guess-the-number/Ring/guess-the-number.ring create mode 100644 Task/Guess-the-number/Sidef/guess-the-number.sidef create mode 100644 Task/Guess-the-number/Swift/guess-the-number.swift create mode 100644 Task/Guess-the-number/Ursa/guess-the-number.ursa create mode 100644 Task/Guess-the-number/Wortel/guess-the-number.wortel create mode 100644 Task/Guess-the-number/XLISP/guess-the-number.xlisp create mode 100644 Task/HTTP/8th/http.8th create mode 100644 Task/HTTP/EchoLisp/http.echolisp create mode 100644 Task/HTTP/LFE/http-1.lfe create mode 100644 Task/HTTP/LFE/http-2.lfe create mode 100644 Task/HTTP/Lasso/http.lasso create mode 100644 Task/HTTP/Lingo/http-1.lingo create mode 100644 Task/HTTP/Lingo/http-2.lingo create mode 100644 Task/HTTP/Lingo/http-3.lingo create mode 100644 Task/HTTP/LiveCode/http-1.livecode create mode 100644 Task/HTTP/LiveCode/http-2.livecode create mode 100644 Task/HTTP/Nim/http.nim create mode 100644 Task/HTTP/Peloton/http-1.peloton create mode 100644 Task/HTTP/Peloton/http-2.peloton create mode 100644 Task/HTTP/Ring/http.ring create mode 100644 Task/HTTP/Sidef/http.sidef create mode 100644 Task/HTTP/Swift/http.swift create mode 100644 Task/HTTPS-Authenticated/Lasso/https-authenticated.lasso create mode 100644 Task/HTTPS-Authenticated/LiveCode/https-authenticated-1.livecode create mode 100644 Task/HTTPS-Authenticated/LiveCode/https-authenticated-2.livecode create mode 100644 Task/HTTPS-Authenticated/Sidef/https-authenticated.sidef create mode 100644 Task/HTTPS-Client-authenticated/Lasso/https-client-authenticated.lasso create mode 100644 Task/HTTPS/EchoLisp/https.echolisp create mode 100644 Task/HTTPS/Lasso/https.lasso create mode 100644 Task/HTTPS/Lingo/https-1.lingo create mode 100644 Task/HTTPS/Lingo/https-2.lingo create mode 100644 Task/HTTPS/LiveCode/https-1.livecode create mode 100644 Task/HTTPS/LiveCode/https-2.livecode create mode 100644 Task/HTTPS/Nim/https.nim create mode 100644 Task/HTTPS/Ring/https.ring create mode 100644 Task/HTTPS/Sidef/https.sidef create mode 100644 Task/HTTPS/Swift/https.swift create mode 100644 Task/Hailstone-sequence/Ceylon/hailstone-sequence.ceylon create mode 100644 Task/Hailstone-sequence/ERRE/hailstone-sequence.erre create mode 100644 Task/Hailstone-sequence/EchoLisp/hailstone-sequence-1.echolisp create mode 100644 Task/Hailstone-sequence/EchoLisp/hailstone-sequence-2.echolisp create mode 100644 Task/Hailstone-sequence/Ezhil/hailstone-sequence.ezhil create mode 100644 Task/Hailstone-sequence/FunL/hailstone-sequence.funl create mode 100644 Task/Hailstone-sequence/Futhark/hailstone-sequence.futhark create mode 100644 Task/Hailstone-sequence/Lasso/hailstone-sequence.lasso create mode 100644 Task/Hailstone-sequence/Lingo/hailstone-sequence-1.lingo create mode 100644 Task/Hailstone-sequence/Lingo/hailstone-sequence-2.lingo create mode 100644 Task/Hailstone-sequence/Nim/hailstone-sequence.nim create mode 100644 Task/Hailstone-sequence/Oforth/hailstone-sequence.oforth create mode 100644 Task/Hailstone-sequence/Phix/hailstone-sequence.phix create mode 100644 Task/Hailstone-sequence/Ring/hailstone-sequence.ring create mode 100644 Task/Hailstone-sequence/Sidef/hailstone-sequence.sidef create mode 100644 Task/Hailstone-sequence/Swift/hailstone-sequence.swift create mode 100644 Task/Hailstone-sequence/Ursa/hailstone-sequence.ursa create mode 100644 Task/Hailstone-sequence/jq/hailstone-sequence-1.jq create mode 100644 Task/Hailstone-sequence/jq/hailstone-sequence-2.jq create mode 100644 Task/Hailstone-sequence/jq/hailstone-sequence-3.jq create mode 100644 Task/Hamming-numbers/ERRE/hamming-numbers.erre create mode 100644 Task/Hamming-numbers/FreeBASIC/hamming-numbers.freebasic create mode 100644 Task/Hamming-numbers/FunL/hamming-numbers-1.funl create mode 100644 Task/Hamming-numbers/FunL/hamming-numbers-2.funl create mode 100644 Task/Hamming-numbers/Nim/hamming-numbers-1.nim create mode 100644 Task/Hamming-numbers/Nim/hamming-numbers-2.nim create mode 100644 Task/Hamming-numbers/Nim/hamming-numbers-3.nim create mode 100644 Task/Hamming-numbers/Nim/hamming-numbers-4.nim create mode 100644 Task/Hamming-numbers/Nim/hamming-numbers-5.nim create mode 100644 Task/Hamming-numbers/Nim/hamming-numbers-6.nim create mode 100644 Task/Hamming-numbers/Ring/hamming-numbers.ring create mode 100644 Task/Hamming-numbers/Sidef/hamming-numbers.sidef create mode 100644 Task/Hamming-numbers/jq/hamming-numbers-1.jq create mode 100644 Task/Hamming-numbers/jq/hamming-numbers-2.jq create mode 100644 Task/Hamming-numbers/jq/hamming-numbers-3.jq create mode 100644 Task/Hamming-numbers/jq/hamming-numbers-4.jq create mode 100644 Task/Handle-a-signal/Nim/handle-a-signal-1.nim create mode 100644 Task/Handle-a-signal/Nim/handle-a-signal-2.nim create mode 100644 Task/Handle-a-signal/Sidef/handle-a-signal.sidef create mode 100644 Task/Handle-a-signal/Swift/handle-a-signal.swift create mode 100644 Task/Handle-a-signal/Visual-FoxPro/handle-a-signal.visual create mode 100644 Task/Happy-numbers/FreeBASIC/happy-numbers.freebasic create mode 100644 Task/Happy-numbers/Harbour/happy-numbers.harbour create mode 100644 Task/Happy-numbers/Lasso/happy-numbers-1.lasso create mode 100644 Task/Happy-numbers/Lasso/happy-numbers-2.lasso create mode 100644 Task/Happy-numbers/Nim/happy-numbers.nim create mode 100644 Task/Happy-numbers/Oforth/happy-numbers.oforth create mode 100644 Task/Happy-numbers/Phix/happy-numbers.phix create mode 100644 Task/Happy-numbers/Potion/happy-numbers.potion create mode 100644 Task/Happy-numbers/Ring/happy-numbers.ring create mode 100644 Task/Happy-numbers/SequenceL/happy-numbers.sequencel create mode 100644 Task/Happy-numbers/Sidef/happy-numbers.sidef create mode 100644 Task/Happy-numbers/Swift/happy-numbers.swift create mode 100644 Task/Happy-numbers/jq/happy-numbers-1.jq create mode 100644 Task/Happy-numbers/jq/happy-numbers-2.jq create mode 100644 Task/Happy-numbers/jq/happy-numbers-3.jq create mode 100644 Task/Harshad-or-Niven-series/EchoLisp/harshad-or-niven-series.echolisp create mode 100644 Task/Harshad-or-Niven-series/FreeBASIC/harshad-or-niven-series.freebasic create mode 100644 Task/Harshad-or-Niven-series/MLite/harshad-or-niven-series.mlite create mode 100644 Task/Harshad-or-Niven-series/Nim/harshad-or-niven-series.nim create mode 100644 Task/Harshad-or-Niven-series/Oforth/harshad-or-niven-series.oforth create mode 100644 Task/Harshad-or-Niven-series/Ring/harshad-or-niven-series.ring create mode 100644 Task/Harshad-or-Niven-series/Sidef/harshad-or-niven-series.sidef create mode 100644 Task/Harshad-or-Niven-series/Visual-FoxPro/harshad-or-niven-series.visual create mode 100644 Task/Harshad-or-Niven-series/jq/harshad-or-niven-series.jq create mode 100644 Task/Hash-from-two-arrays/Ceylon/hash-from-two-arrays.ceylon create mode 100644 Task/Hash-from-two-arrays/Coco/hash-from-two-arrays.coco create mode 100644 Task/Hash-from-two-arrays/EchoLisp/hash-from-two-arrays.echolisp create mode 100644 Task/Hash-from-two-arrays/Harbour/hash-from-two-arrays.harbour create mode 100644 Task/Hash-from-two-arrays/LFE/hash-from-two-arrays.lfe create mode 100644 Task/Hash-from-two-arrays/Lasso/hash-from-two-arrays.lasso create mode 100644 Task/Hash-from-two-arrays/Lingo/hash-from-two-arrays.lingo create mode 100644 Task/Hash-from-two-arrays/LiveCode/hash-from-two-arrays.livecode create mode 100644 Task/Hash-from-two-arrays/Nim/hash-from-two-arrays.nim create mode 100644 Task/Hash-from-two-arrays/Sidef/hash-from-two-arrays.sidef create mode 100644 Task/Hash-from-two-arrays/Sparkling/hash-from-two-arrays.sparkling create mode 100644 Task/Hash-from-two-arrays/Swift/hash-from-two-arrays.swift create mode 100644 Task/Hash-from-two-arrays/Wortel/hash-from-two-arrays-1.wortel create mode 100644 Task/Hash-from-two-arrays/Wortel/hash-from-two-arrays-2.wortel create mode 100644 Task/Hash-from-two-arrays/Wortel/hash-from-two-arrays-3.wortel create mode 100644 Task/Hash-from-two-arrays/jq/hash-from-two-arrays-1.jq create mode 100644 Task/Hash-from-two-arrays/jq/hash-from-two-arrays-2.jq create mode 100644 Task/Hash-from-two-arrays/jq/hash-from-two-arrays-3.jq create mode 100644 Task/Hash-join/ECL/hash-join.ecl create mode 100644 Task/Hash-join/EchoLisp/hash-join-1.echolisp create mode 100644 Task/Hash-join/EchoLisp/hash-join-2.echolisp create mode 100644 Task/Hash-join/LFE/hash-join-1.lfe create mode 100644 Task/Hash-join/LFE/hash-join-2.lfe create mode 100644 Task/Hash-join/LFE/hash-join-3.lfe create mode 100644 Task/Hash-join/Ring/hash-join.ring create mode 100644 Task/Hash-join/Sidef/hash-join.sidef create mode 100644 Task/Hash-join/Visual-FoxPro/hash-join.visual create mode 100644 Task/Hash-join/jq/hash-join-1.jq create mode 100644 Task/Hash-join/jq/hash-join-2.jq create mode 100644 Task/Hash-join/jq/hash-join-3.jq create mode 100644 Task/Hash-join/jq/hash-join-4.jq create mode 100644 Task/Hash-join/jq/hash-join-5.jq create mode 100644 Task/Hash-join/jq/hash-join-6.jq create mode 100644 Task/Haversine-formula/ERRE/haversine-formula.erre create mode 100644 Task/Haversine-formula/FreeBASIC/haversine-formula.freebasic create mode 100644 Task/Haversine-formula/FunL/haversine-formula.funl create mode 100644 Task/Haversine-formula/FutureBasic/haversine-formula.futurebasic create mode 100644 Task/Haversine-formula/Idris/haversine-formula.idris create mode 100644 Task/Haversine-formula/LiveCode/haversine-formula-1.livecode create mode 100644 Task/Haversine-formula/LiveCode/haversine-formula-2.livecode create mode 100644 Task/Haversine-formula/Nim/haversine-formula.nim create mode 100644 Task/Haversine-formula/Oforth/haversine-formula.oforth create mode 100644 Task/Haversine-formula/Ring/haversine-formula.ring create mode 100644 Task/Haversine-formula/Sidef/haversine-formula.sidef create mode 100644 Task/Haversine-formula/Swift/haversine-formula.swift create mode 100644 Task/Haversine-formula/jq/haversine-formula.jq create mode 100644 Task/Hello-world-Graphical/Axe/hello-world-graphical.axe create mode 100644 Task/Hello-world-Graphical/BML/hello-world-graphical.bml create mode 100644 Task/Hello-world-Graphical/EchoLisp/hello-world-graphical.echolisp create mode 100644 Task/Hello-world-Graphical/FreeBASIC/hello-world-graphical.freebasic create mode 100644 Task/Hello-world-Graphical/FunL/hello-world-graphical.funl create mode 100644 Task/Hello-world-Graphical/HPPPL/hello-world-graphical-1.hpppl create mode 100644 Task/Hello-world-Graphical/HPPPL/hello-world-graphical-2.hpppl create mode 100644 Task/Hello-world-Graphical/Harbour/hello-world-graphical.harbour create mode 100644 Task/Hello-world-Graphical/I/hello-world-graphical-1.i create mode 100644 Task/Hello-world-Graphical/I/hello-world-graphical-2.i create mode 100644 Task/Hello-world-Graphical/I/hello-world-graphical-3.i create mode 100644 Task/Hello-world-Graphical/Lasso/hello-world-graphical.lasso create mode 100644 Task/Hello-world-Graphical/Lingo/hello-world-graphical-1.lingo create mode 100644 Task/Hello-world-Graphical/Lingo/hello-world-graphical-2.lingo create mode 100644 Task/Hello-world-Graphical/LiveCode/hello-world-graphical-1.livecode create mode 100644 Task/Hello-world-Graphical/LiveCode/hello-world-graphical-2.livecode create mode 100644 Task/Hello-world-Graphical/Lobster/hello-world-graphical.lobster create mode 100644 Task/Hello-world-Graphical/Nim/hello-world-graphical-1.nim create mode 100644 Task/Hello-world-Graphical/Nim/hello-world-graphical-2.nim create mode 100644 Task/Hello-world-Graphical/Phix/hello-world-graphical.phix create mode 100644 Task/Hello-world-Graphical/Ring/hello-world-graphical.ring create mode 100644 Task/Hello-world-Graphical/SSEM/hello-world-graphical.ssem create mode 100644 Task/Hello-world-Graphical/Sidef/hello-world-graphical-1.sidef create mode 100644 Task/Hello-world-Graphical/Sidef/hello-world-graphical-2.sidef create mode 100644 Task/Hello-world-Graphical/Swift/hello-world-graphical.swift create mode 100644 Task/Hello-world-Graphical/Visual-FoxPro/hello-world-graphical.visual create mode 100644 Task/Hello-world-Graphical/jq/hello-world-graphical-1.jq create mode 100644 Task/Hello-world-Graphical/jq/hello-world-graphical-2.jq create mode 100644 Task/Hello-world-Line-printer/ERRE/hello-world-line-printer.erre create mode 100644 Task/Hello-world-Line-printer/EchoLisp/hello-world-line-printer.echolisp create mode 100644 Task/Hello-world-Line-printer/FreeBASIC/hello-world-line-printer.freebasic create mode 100644 Task/Hello-world-Line-printer/Harbour/hello-world-line-printer.harbour create mode 100644 Task/Hello-world-Line-printer/Lasso/hello-world-line-printer.lasso create mode 100644 Task/Hello-world-Line-printer/Nim/hello-world-line-printer.nim create mode 100644 Task/Hello-world-Line-printer/Oforth/hello-world-line-printer.oforth create mode 100644 Task/Hello-world-Line-printer/Phix/hello-world-line-printer.phix create mode 100644 Task/Hello-world-Line-printer/Ring/hello-world-line-printer.ring create mode 100644 Task/Hello-world-Line-printer/Sidef/hello-world-line-printer.sidef create mode 100644 Task/Hello-world-Line-printer/Swift/hello-world-line-printer.swift create mode 100644 Task/Hello-world-Newbie/Axe/hello-world-newbie.axe create mode 100644 Task/Hello-world-Newbie/EchoLisp/hello-world-newbie-1.echolisp create mode 100644 Task/Hello-world-Newbie/EchoLisp/hello-world-newbie-2.echolisp create mode 100644 Task/Hello-world-Newbie/FutureBasic/hello-world-newbie.futurebasic create mode 100644 Task/Hello-world-Newbie/Monte/hello-world-newbie.monte create mode 100644 Task/Hello-world-Newbie/Oforth/hello-world-newbie-1.oforth create mode 100644 Task/Hello-world-Newbie/Oforth/hello-world-newbie-2.oforth create mode 100644 Task/Hello-world-Newbie/Oforth/hello-world-newbie-3.oforth create mode 100644 Task/Hello-world-Newbie/Pare/hello-world-newbie-1.pare create mode 100644 Task/Hello-world-Newbie/Pare/hello-world-newbie-2.pare create mode 100644 Task/Hello-world-Newbie/Ra/hello-world-newbie.ra create mode 100644 Task/Hello-world-Newbie/Ring/hello-world-newbie.ring create mode 100644 Task/Hello-world-Newbie/Robotic/hello-world-newbie.robotic create mode 100644 Task/Hello-world-Newbie/TI-83-Hex-Assembly/hello-world-newbie.ti-83 create mode 100644 Task/Hello-world-Newbie/jq/hello-world-newbie-1.jq create mode 100644 Task/Hello-world-Newbie/jq/hello-world-newbie-2.jq create mode 100644 Task/Hello-world-Newbie/jq/hello-world-newbie-3.jq create mode 100644 Task/Hello-world-Newbie/jq/hello-world-newbie-4.jq create mode 100644 Task/Hello-world-Newbie/jq/hello-world-newbie-5.jq create mode 100644 Task/Hello-world-Newbie/jq/hello-world-newbie-6.jq create mode 100644 Task/Hello-world-Newline-omission/Axe/hello-world-newline-omission.axe create mode 100644 Task/Hello-world-Newline-omission/ERRE/hello-world-newline-omission.erre create mode 100644 Task/Hello-world-Newline-omission/EchoLisp/hello-world-newline-omission.echolisp create mode 100644 Task/Hello-world-Newline-omission/FOCAL/hello-world-newline-omission.focal create mode 100644 Task/Hello-world-Newline-omission/FreeBASIC/hello-world-newline-omission.freebasic create mode 100644 Task/Hello-world-Newline-omission/Harbour/hello-world-newline-omission.harbour create mode 100644 Task/Hello-world-Newline-omission/Jack/hello-world-newline-omission.jack create mode 100644 Task/Hello-world-Newline-omission/LFE/hello-world-newline-omission.lfe create mode 100644 Task/Hello-world-Newline-omission/Lasso/hello-world-newline-omission.lasso create mode 100644 Task/Hello-world-Newline-omission/Nim/hello-world-newline-omission.nim create mode 100644 Task/Hello-world-Newline-omission/Oforth/hello-world-newline-omission.oforth create mode 100644 Task/Hello-world-Newline-omission/PHL/hello-world-newline-omission.phl create mode 100644 Task/Hello-world-Newline-omission/Phix/hello-world-newline-omission.phix create mode 100644 Task/Hello-world-Newline-omission/Pict/hello-world-newline-omission.pict create mode 100644 Task/Hello-world-Newline-omission/Ra/hello-world-newline-omission.ra create mode 100644 Task/Hello-world-Newline-omission/Red/hello-world-newline-omission.red create mode 100644 Task/Hello-world-Newline-omission/Ring/hello-world-newline-omission.ring create mode 100644 Task/Hello-world-Newline-omission/Sidef/hello-world-newline-omission-1.sidef create mode 100644 Task/Hello-world-Newline-omission/Sidef/hello-world-newline-omission-2.sidef create mode 100644 Task/Hello-world-Newline-omission/Swift/hello-world-newline-omission-1.swift create mode 100644 Task/Hello-world-Newline-omission/Swift/hello-world-newline-omission-2.swift create mode 100644 Task/Hello-world-Newline-omission/Ursa/hello-world-newline-omission.ursa create mode 100644 Task/Hello-world-Newline-omission/Wren/hello-world-newline-omission.wren create mode 100644 Task/Hello-world-Newline-omission/XLISP/hello-world-newline-omission-1.xlisp create mode 100644 Task/Hello-world-Newline-omission/XLISP/hello-world-newline-omission-2.xlisp create mode 100644 Task/Hello-world-Newline-omission/jq/hello-world-newline-omission-1.jq create mode 100644 Task/Hello-world-Newline-omission/jq/hello-world-newline-omission-2.jq create mode 100644 Task/Hello-world-Standard-error/FreeBASIC/hello-world-standard-error.freebasic create mode 100644 Task/Hello-world-Standard-error/Lasso/hello-world-standard-error.lasso create mode 100644 Task/Hello-world-Standard-error/Lingo/hello-world-standard-error-1.lingo create mode 100644 Task/Hello-world-Standard-error/Lingo/hello-world-standard-error-2.lingo create mode 100644 Task/Hello-world-Standard-error/Nim/hello-world-standard-error.nim create mode 100644 Task/Hello-world-Standard-error/Oforth/hello-world-standard-error.oforth create mode 100644 Task/Hello-world-Standard-error/Phix/hello-world-standard-error.phix create mode 100644 Task/Hello-world-Standard-error/Ra/hello-world-standard-error.ra create mode 100644 Task/Hello-world-Standard-error/Ring/hello-world-standard-error.ring create mode 100644 Task/Hello-world-Standard-error/Sidef/hello-world-standard-error.sidef create mode 100644 Task/Hello-world-Standard-error/Swift/hello-world-standard-error.swift create mode 100644 Task/Hello-world-Standard-error/Ursa/hello-world-standard-error.ursa create mode 100644 Task/Hello-world-Standard-error/XLISP/hello-world-standard-error.xlisp create mode 100644 Task/Hello-world-Standard-error/jq/hello-world-standard-error.jq create mode 100644 Task/Hello-world-Text/8th/hello-world-text.8th create mode 100644 Task/Hello-world-Text/AntLang/hello-world-text.antlang create mode 100644 Task/Hello-world-Text/Apricot/hello-world-text.apricot create mode 100644 Task/Hello-world-Text/AutoLISP/hello-world-text.autolisp create mode 100644 Task/Hello-world-Text/Axe/hello-world-text.axe create mode 100644 Task/Hello-world-Text/BML/hello-world-text.bml create mode 100644 Task/Hello-world-Text/Battlestar/hello-world-text.battlestar create mode 100644 Task/Hello-world-Text/ChucK/hello-world-text.chuck create mode 100644 Task/Hello-world-Text/Comal/hello-world-text.comal create mode 100644 Task/Hello-world-Text/Crystal/hello-world-text.crystal create mode 100644 Task/Hello-world-Text/DDNC/hello-world-text.ddnc create mode 100644 Task/Hello-world-Text/DIV-Games-Studio/hello-world-text.div create mode 100644 Task/Hello-world-Text/ECL/hello-world-text.ecl create mode 100644 Task/Hello-world-Text/EDSAC-order-code/hello-world-text.edsac create mode 100644 Task/Hello-world-Text/ERRE/hello-world-text.erre create mode 100644 Task/Hello-world-Text/EchoLisp/hello-world-text.echolisp create mode 100644 Task/Hello-world-Text/Egison/hello-world-text.egison create mode 100644 Task/Hello-world-Text/Elm/hello-world-text.elm create mode 100644 Task/Hello-world-Text/FOCAL/hello-world-text.focal create mode 100644 Task/Hello-world-Text/FUZE-BASIC/hello-world-text.fuze create mode 100644 Task/Hello-world-Text/FreeBASIC/hello-world-text.freebasic create mode 100644 Task/Hello-world-Text/FunL/hello-world-text.funl create mode 100644 Task/Hello-world-Text/GFA-Basic/hello-world-text.gfa create mode 100644 Task/Hello-world-Text/HPPPL/hello-world-text.hpppl create mode 100644 Task/Hello-world-Text/Hack/hello-world-text.hack create mode 100644 Task/Hello-world-Text/Harbour/hello-world-text.harbour create mode 100644 Task/Hello-world-Text/Hoon/hello-world-text.hoon create mode 100644 Task/Hello-world-Text/Hy/hello-world-text.hy create mode 100644 Task/Hello-world-Text/I/hello-world-text.i create mode 100644 Task/Hello-world-Text/Jack/hello-world-text.jack create mode 100644 Task/Hello-world-Text/Kitten/hello-world-text.kitten create mode 100644 Task/Hello-world-Text/LC3-Assembly/hello-world-text-1.lc3 create mode 100644 Task/Hello-world-Text/LC3-Assembly/hello-world-text-2.lc3 create mode 100644 Task/Hello-world-Text/LFE/hello-world-text.lfe create mode 100644 Task/Hello-world-Text/Lasso/hello-world-text.lasso create mode 100644 Task/Hello-world-Text/Lily/hello-world-text-1.lily create mode 100644 Task/Hello-world-Text/Lily/hello-world-text-2.lily create mode 100644 Task/Hello-world-Text/Lingo/hello-world-text-1.lingo create mode 100644 Task/Hello-world-Text/Lingo/hello-world-text-2.lingo create mode 100644 Task/Hello-world-Text/LiveCode/hello-world-text-1.livecode create mode 100644 Task/Hello-world-Text/LiveCode/hello-world-text-2.livecode create mode 100644 Task/Hello-world-Text/Lobster/hello-world-text.lobster create mode 100644 Task/Hello-world-Text/Malbolge/hello-world-text-1.malbolge create mode 100644 Task/Hello-world-Text/Malbolge/hello-world-text-2.malbolge create mode 100644 Task/Hello-world-Text/Maude/hello-world-text.maude create mode 100644 Task/Hello-world-Text/Morfa/hello-world-text.morfa create mode 100644 Task/Hello-world-Text/MyrtleScript/hello-world-text.myrtle create mode 100644 Task/Hello-world-Text/Nim/hello-world-text.nim create mode 100644 Task/Hello-world-Text/Nit/hello-world-text.nit create mode 100644 Task/Hello-world-Text/Oforth/hello-world-text.oforth create mode 100644 Task/Hello-world-Text/OpenLisp/hello-world-text.openlisp create mode 100644 Task/Hello-world-Text/PHL/hello-world-text.phl create mode 100644 Task/Hello-world-Text/Phix/hello-world-text.phix create mode 100644 Task/Hello-world-Text/Pict/hello-world-text-1.pict create mode 100644 Task/Hello-world-Text/Pict/hello-world-text-2.pict create mode 100644 Task/Hello-world-Text/Pony/hello-world-text.pony create mode 100644 Task/Hello-world-Text/Potion/hello-world-text.potion create mode 100644 Task/Hello-world-Text/Ra/hello-world-text.ra create mode 100644 Task/Hello-world-Text/Ring/hello-world-text.ring create mode 100644 Task/Hello-world-Text/Set-lang/hello-world-text.set create mode 100644 Task/Hello-world-Text/Shen/hello-world-text.shen create mode 100644 Task/Hello-world-Text/Sidef/hello-world-text.sidef create mode 100644 Task/Hello-world-Text/SkookumScript/hello-world-text-1.skookum create mode 100644 Task/Hello-world-Text/SkookumScript/hello-world-text-2.skookum create mode 100644 Task/Hello-world-Text/SmileBASIC/hello-world-text.smilebasic create mode 100644 Task/Hello-world-Text/SoneKing-Assembly/hello-world-text.soneking create mode 100644 Task/Hello-world-Text/Sparkling/hello-world-text.sparkling create mode 100644 Task/Hello-world-Text/Swift/hello-world-text-1.swift create mode 100644 Task/Hello-world-Text/Swift/hello-world-text-2.swift create mode 100644 Task/Hello-world-Text/Symsyn/hello-world-text.symsyn create mode 100644 Task/Hello-world-Text/Terra/hello-world-text.terra create mode 100644 Task/Hello-world-Text/TestML/hello-world-text.testml create mode 100644 Task/Hello-world-Text/Uniface/hello-world-text.uniface create mode 100644 Task/Hello-world-Text/Ursa/hello-world-text.ursa create mode 100644 Task/Hello-world-Text/Wart/hello-world-text.wart create mode 100644 Task/Hello-world-Text/Wolfram-Language/hello-world-text.wolfram create mode 100644 Task/Hello-world-Text/Wren/hello-world-text.wren create mode 100644 Task/Hello-world-Text/XLISP/hello-world-text.xlisp create mode 100644 Task/Hello-world-Text/jq/hello-world-text.jq create mode 100644 Task/Hello-world-Web-server/AntLang/hello-world-web-server-1.antlang create mode 100644 Task/Hello-world-Web-server/AntLang/hello-world-web-server-2.antlang create mode 100644 Task/Hello-world-Web-server/AntLang/hello-world-web-server-3.antlang create mode 100644 Task/Hello-world-Web-server/FunL/hello-world-web-server.funl create mode 100644 Task/Hello-world-Web-server/Lasso/hello-world-web-server.lasso create mode 100644 Task/Hello-world-Web-server/Nim/hello-world-web-server.nim create mode 100644 Task/Hello-world-Web-server/Panda/hello-world-web-server.panda create mode 100644 Task/Hello-world-Web-server/Ring/hello-world-web-server.ring create mode 100644 Task/Hello-world-Web-server/Sidef/hello-world-web-server-1.sidef create mode 100644 Task/Hello-world-Web-server/Sidef/hello-world-web-server-2.sidef create mode 100644 Task/Hello-world-Web-server/Wart/hello-world-web-server.wart create mode 100644 Task/Here-document/8th/here-document.8th create mode 100644 Task/Here-document/Lingo/here-document-1.lingo create mode 100644 Task/Here-document/Lingo/here-document-2.lingo create mode 100644 Task/Here-document/Nim/here-document.nim create mode 100644 Task/Here-document/Phix/here-document.phix create mode 100644 Task/Here-document/Ring/here-document.ring create mode 100644 Task/Here-document/SequenceL/here-document.sequencel create mode 100644 Task/Here-document/Sidef/here-document-1.sidef create mode 100644 Task/Here-document/Sidef/here-document-2.sidef create mode 100644 Task/Here-document/Sidef/here-document-3.sidef create mode 100644 Task/Here-document/Sidef/here-document-4.sidef create mode 100644 Task/Here-document/jq/here-document-1.jq create mode 100644 Task/Here-document/jq/here-document-2.jq create mode 100644 Task/Here-document/jq/here-document-3.jq create mode 100644 Task/Here-document/jq/here-document-4.jq create mode 100644 Task/Here-document/jq/here-document-5.jq create mode 100644 Task/Heronian-triangles/ERRE/heronian-triangles.erre create mode 100644 Task/Heronian-triangles/EchoLisp/heronian-triangles.echolisp create mode 100644 Task/Heronian-triangles/FreeBASIC/heronian-triangles.freebasic create mode 100644 Task/Heronian-triangles/FutureBasic/heronian-triangles.futurebasic create mode 100644 Task/Heronian-triangles/Nim/heronian-triangles.nim create mode 100644 Task/Heronian-triangles/Phix/heronian-triangles.phix create mode 100644 Task/Heronian-triangles/Ring/heronian-triangles.ring create mode 100644 Task/Heronian-triangles/Sidef/heronian-triangles.sidef create mode 100644 Task/Heronian-triangles/Swift/heronian-triangles.swift create mode 100644 Task/Heronian-triangles/jq/heronian-triangles-1.jq create mode 100644 Task/Heronian-triangles/jq/heronian-triangles-2.jq create mode 100644 Task/Hickerson-series-of-almost-integers/FreeBASIC/hickerson-series-of-almost-integers.freebasic create mode 100644 Task/Hickerson-series-of-almost-integers/Ring/hickerson-series-of-almost-integers.ring create mode 100644 Task/Hickerson-series-of-almost-integers/Sidef/hickerson-series-of-almost-integers.sidef create mode 100644 Task/Hickerson-series-of-almost-integers/jq/hickerson-series-of-almost-integers-1.jq create mode 100644 Task/Hickerson-series-of-almost-integers/jq/hickerson-series-of-almost-integers-2.jq create mode 100644 Task/Higher-order-functions/8th/higher-order-functions.8th create mode 100644 Task/Higher-order-functions/AntLang/higher-order-functions.antlang create mode 100644 Task/Higher-order-functions/ECL/higher-order-functions.ecl create mode 100644 Task/Higher-order-functions/ERRE/higher-order-functions.erre create mode 100644 Task/Higher-order-functions/FreeBASIC/higher-order-functions.freebasic create mode 100644 Task/Higher-order-functions/FutureBasic/higher-order-functions.futurebasic create mode 100644 Task/Higher-order-functions/Lily/higher-order-functions.lily create mode 100644 Task/Higher-order-functions/Lingo/higher-order-functions-1.lingo create mode 100644 Task/Higher-order-functions/Lingo/higher-order-functions-2.lingo create mode 100644 Task/Higher-order-functions/Luck/higher-order-functions.luck create mode 100644 Task/Higher-order-functions/Morfa/higher-order-functions.morfa create mode 100644 Task/Higher-order-functions/Nim/higher-order-functions.nim create mode 100644 Task/Higher-order-functions/Oforth/higher-order-functions.oforth create mode 100644 Task/Higher-order-functions/Phix/higher-order-functions.phix create mode 100644 Task/Higher-order-functions/Sidef/higher-order-functions.sidef create mode 100644 Task/Higher-order-functions/Sparkling/higher-order-functions.sparkling create mode 100644 Task/Higher-order-functions/Swift/higher-order-functions-1.swift create mode 100644 Task/Higher-order-functions/Swift/higher-order-functions-2.swift create mode 100644 Task/Higher-order-functions/Ursa/higher-order-functions.ursa create mode 100644 Task/Higher-order-functions/jq/higher-order-functions-1.jq create mode 100644 Task/Higher-order-functions/jq/higher-order-functions-2.jq create mode 100644 Task/Higher-order-functions/jq/higher-order-functions-3.jq create mode 100644 Task/Higher-order-functions/jq/higher-order-functions-4.jq create mode 100644 Task/History-variables/EchoLisp/history-variables.echolisp create mode 100644 Task/History-variables/Peloton/history-variables-1.peloton create mode 100644 Task/History-variables/Peloton/history-variables-2.peloton create mode 100644 Task/History-variables/Sidef/history-variables.sidef create mode 100644 Task/History-variables/Swift/history-variables-1.swift create mode 100644 Task/History-variables/Swift/history-variables-2.swift create mode 100644 Task/Hofstadter-Conway-$10,000-sequence/EchoLisp/hofstadter-conway-$10,000-sequence.echolisp create mode 100644 Task/Hofstadter-Conway-$10,000-sequence/FutureBasic/hofstadter-conway-$10,000-sequence.futurebasic create mode 100644 Task/Hofstadter-Conway-$10,000-sequence/Nim/hofstadter-conway-$10,000-sequence.nim create mode 100644 Task/Hofstadter-Conway-$10,000-sequence/Oforth/hofstadter-conway-$10,000-sequence.oforth create mode 100644 Task/Hofstadter-Conway-$10,000-sequence/Ring/hofstadter-conway-$10,000-sequence.ring create mode 100644 Task/Hofstadter-Conway-$10,000-sequence/Sidef/hofstadter-conway-$10,000-sequence.sidef create mode 100644 Task/Hofstadter-Conway-$10,000-sequence/Swift/hofstadter-conway-$10,000-sequence.swift create mode 100644 Task/Hofstadter-Figure-Figure-sequences/EchoLisp/hofstadter-figure-figure-sequences-1.echolisp create mode 100644 Task/Hofstadter-Figure-Figure-sequences/EchoLisp/hofstadter-figure-figure-sequences-2.echolisp create mode 100644 Task/Hofstadter-Figure-Figure-sequences/Nim/hofstadter-figure-figure-sequences.nim create mode 100644 Task/Hofstadter-Figure-Figure-sequences/Oforth/hofstadter-figure-figure-sequences.oforth create mode 100644 Task/Hofstadter-Figure-Figure-sequences/Sidef/hofstadter-figure-figure-sequences.sidef create mode 100644 Task/Hofstadter-Q-sequence/ERRE/hofstadter-q-sequence.erre create mode 100644 Task/Hofstadter-Q-sequence/EchoLisp/hofstadter-q-sequence.echolisp create mode 100644 Task/Hofstadter-Q-sequence/Nim/hofstadter-q-sequence.nim create mode 100644 Task/Hofstadter-Q-sequence/Oforth/hofstadter-q-sequence.oforth create mode 100644 Task/Hofstadter-Q-sequence/Ring/hofstadter-q-sequence.ring create mode 100644 Task/Hofstadter-Q-sequence/Sidef/hofstadter-q-sequence-1.sidef create mode 100644 Task/Hofstadter-Q-sequence/Sidef/hofstadter-q-sequence-2.sidef create mode 100644 Task/Hofstadter-Q-sequence/Visual-FoxPro/hofstadter-q-sequence.visual create mode 100644 Task/Hofstadter-Q-sequence/jq/hofstadter-q-sequence-1.jq create mode 100644 Task/Hofstadter-Q-sequence/jq/hofstadter-q-sequence-2.jq create mode 100644 Task/Holidays-related-to-Easter/Sidef/holidays-related-to-easter.sidef create mode 100644 Task/Honeycombs/Phix/honeycombs.phix create mode 100644 Task/Honeycombs/Sidef/honeycombs.sidef create mode 100644 Task/Horizontal-sundial-calculations/ERRE/horizontal-sundial-calculations.erre create mode 100644 Task/Horizontal-sundial-calculations/FutureBasic/horizontal-sundial-calculations.futurebasic create mode 100644 Task/Horizontal-sundial-calculations/LiveCode/horizontal-sundial-calculations.livecode create mode 100644 Task/Horizontal-sundial-calculations/Nim/horizontal-sundial-calculations.nim create mode 100644 Task/Horizontal-sundial-calculations/Phix/horizontal-sundial-calculations.phix create mode 100644 Task/Horizontal-sundial-calculations/Sidef/horizontal-sundial-calculations.sidef create mode 100644 Task/Horners-rule-for-polynomial-evaluation/ERRE/horners-rule-for-polynomial-evaluation.erre create mode 100644 Task/Horners-rule-for-polynomial-evaluation/EchoLisp/horners-rule-for-polynomial-evaluation-1.echolisp create mode 100644 Task/Horners-rule-for-polynomial-evaluation/EchoLisp/horners-rule-for-polynomial-evaluation-2.echolisp create mode 100644 Task/Horners-rule-for-polynomial-evaluation/FunL/horners-rule-for-polynomial-evaluation.funl create mode 100644 Task/Horners-rule-for-polynomial-evaluation/Nim/horners-rule-for-polynomial-evaluation.nim create mode 100644 Task/Horners-rule-for-polynomial-evaluation/Potion/horners-rule-for-polynomial-evaluation.potion create mode 100644 Task/Horners-rule-for-polynomial-evaluation/Ring/horners-rule-for-polynomial-evaluation.ring create mode 100644 Task/Horners-rule-for-polynomial-evaluation/Sidef/horners-rule-for-polynomial-evaluation-1.sidef create mode 100644 Task/Horners-rule-for-polynomial-evaluation/Sidef/horners-rule-for-polynomial-evaluation-2.sidef create mode 100644 Task/Horners-rule-for-polynomial-evaluation/Swift/horners-rule-for-polynomial-evaluation.swift create mode 100644 Task/Horners-rule-for-polynomial-evaluation/Visual-FoxPro/horners-rule-for-polynomial-evaluation-1.visual create mode 100644 Task/Horners-rule-for-polynomial-evaluation/Visual-FoxPro/horners-rule-for-polynomial-evaluation-2.visual create mode 100644 Task/Host-introspection/FreeBASIC/host-introspection.freebasic create mode 100644 Task/Host-introspection/Nim/host-introspection.nim create mode 100644 Task/Hostname/Arc/hostname.arc create mode 100644 Task/Hostname/FreeBASIC/hostname.freebasic create mode 100644 Task/Hostname/Harbour/hostname.harbour create mode 100644 Task/Hostname/LFE/hostname.lfe create mode 100644 Task/Hostname/Lasso/hostname-1.lasso create mode 100644 Task/Hostname/Lasso/hostname-2.lasso create mode 100644 Task/Hostname/Lingo/hostname.lingo create mode 100644 Task/Hostname/LiveCode/hostname.livecode create mode 100644 Task/Hostname/Nim/hostname.nim create mode 100644 Task/Hostname/Sidef/hostname-1.sidef create mode 100644 Task/Hostname/Sidef/hostname-2.sidef create mode 100644 Task/Hostname/Swift/hostname.swift create mode 100644 Task/Hostname/Ursa/hostname.ursa create mode 100644 Task/Hough-transform/SequenceL/hough-transform-1.sequencel create mode 100644 Task/Hough-transform/SequenceL/hough-transform-2.sequencel create mode 100644 Task/Hough-transform/Sidef/hough-transform.sidef create mode 100644 Task/Huffman-coding/Nim/huffman-coding.nim create mode 100644 Task/Huffman-coding/Sidef/huffman-coding.sidef create mode 100644 Task/Huffman-coding/Swift/huffman-coding.swift create mode 100644 Task/I-before-E-except-after-C/Coco/i-before-e-except-after-c.coco create mode 100644 Task/I-before-E-except-after-C/FreeBASIC/i-before-e-except-after-c.freebasic create mode 100644 Task/I-before-E-except-after-C/Lasso/i-before-e-except-after-c.lasso create mode 100644 Task/I-before-E-except-after-C/Swift/i-before-e-except-after-c.swift create mode 100644 Task/I-before-E-except-after-C/jq/i-before-e-except-after-c-1.jq create mode 100644 Task/I-before-E-except-after-C/jq/i-before-e-except-after-c-2.jq create mode 100644 Task/IBAN/FreeBASIC/iban.freebasic create mode 100644 Task/IBAN/Nim/iban.nim create mode 100644 Task/IBAN/Sidef/iban.sidef create mode 100644 Task/IBAN/jq/iban-1.jq create mode 100644 Task/IBAN/jq/iban-2.jq create mode 100644 Task/IBAN/jq/iban-3.jq create mode 100644 Task/Identity-matrix/ERRE/identity-matrix.erre create mode 100644 Task/Identity-matrix/FreeBASIC/identity-matrix.freebasic create mode 100644 Task/Identity-matrix/FunL/identity-matrix.funl create mode 100644 Task/Identity-matrix/LFE/identity-matrix-1.lfe create mode 100644 Task/Identity-matrix/LFE/identity-matrix-2.lfe create mode 100644 Task/Identity-matrix/Nim/identity-matrix.nim create mode 100644 Task/Identity-matrix/Ring/identity-matrix.ring create mode 100644 Task/Identity-matrix/Sidef/identity-matrix.sidef create mode 100644 Task/Identity-matrix/Sparkling/identity-matrix.sparkling create mode 100644 Task/Identity-matrix/Wortel/identity-matrix.wortel create mode 100644 Task/Identity-matrix/jq/identity-matrix-1.jq create mode 100644 Task/Identity-matrix/jq/identity-matrix-2.jq create mode 100644 Task/Identity-matrix/jq/identity-matrix-3.jq create mode 100644 Task/Image-noise/Axe/image-noise.axe create mode 100644 Task/Include-a-file/AntLang/include-a-file.antlang create mode 100644 Task/Include-a-file/Axe/include-a-file.axe create mode 100644 Task/Include-a-file/ChucK/include-a-file.chuck create mode 100644 Task/Include-a-file/FreeBASIC/include-a-file-1.freebasic create mode 100644 Task/Include-a-file/FreeBASIC/include-a-file-2.freebasic create mode 100644 Task/Include-a-file/FutureBasic/include-a-file.futurebasic create mode 100644 Task/Include-a-file/Harbour/include-a-file.harbour create mode 100644 Task/Include-a-file/Lasso/include-a-file.lasso create mode 100644 Task/Include-a-file/Lingo/include-a-file.lingo create mode 100644 Task/Include-a-file/Nim/include-a-file.nim create mode 100644 Task/Include-a-file/Oforth/include-a-file-1.oforth create mode 100644 Task/Include-a-file/Oforth/include-a-file-2.oforth create mode 100644 Task/Include-a-file/Phix/include-a-file.phix create mode 100644 Task/Include-a-file/Ring/include-a-file.ring create mode 100644 Task/Include-a-file/Sidef/include-a-file-1.sidef create mode 100644 Task/Include-a-file/Sidef/include-a-file-2.sidef create mode 100644 Task/Include-a-file/Ursa/include-a-file.ursa create mode 100644 Task/Include-a-file/jq/include-a-file-1.jq create mode 100644 Task/Include-a-file/jq/include-a-file-2.jq create mode 100644 Task/Include-a-file/jq/include-a-file-3.jq create mode 100644 Task/Increment-a-numerical-string/Apex/increment-a-numerical-string.apex create mode 100644 Task/Increment-a-numerical-string/Ceylon/increment-a-numerical-string.ceylon create mode 100644 Task/Increment-a-numerical-string/ERRE/increment-a-numerical-string.erre create mode 100644 Task/Increment-a-numerical-string/EchoLisp/increment-a-numerical-string.echolisp create mode 100644 Task/Increment-a-numerical-string/Eero/increment-a-numerical-string.eero create mode 100644 Task/Increment-a-numerical-string/FreeBASIC/increment-a-numerical-string.freebasic create mode 100644 Task/Increment-a-numerical-string/FutureBasic/increment-a-numerical-string.futurebasic create mode 100644 Task/Increment-a-numerical-string/Lasso/increment-a-numerical-string.lasso create mode 100644 Task/Increment-a-numerical-string/Lingo/increment-a-numerical-string.lingo create mode 100644 Task/Increment-a-numerical-string/LiveCode/increment-a-numerical-string.livecode create mode 100644 Task/Increment-a-numerical-string/Nim/increment-a-numerical-string.nim create mode 100644 Task/Increment-a-numerical-string/Oforth/increment-a-numerical-string.oforth create mode 100644 Task/Increment-a-numerical-string/Phix/increment-a-numerical-string.phix create mode 100644 Task/Increment-a-numerical-string/Ring/increment-a-numerical-string.ring create mode 100644 Task/Increment-a-numerical-string/Sidef/increment-a-numerical-string.sidef create mode 100644 Task/Increment-a-numerical-string/Sparkling/increment-a-numerical-string.sparkling create mode 100644 Task/Increment-a-numerical-string/Swift/increment-a-numerical-string-1.swift create mode 100644 Task/Increment-a-numerical-string/Swift/increment-a-numerical-string-2.swift create mode 100644 Task/Increment-a-numerical-string/Ursa/increment-a-numerical-string.ursa create mode 100644 Task/Increment-a-numerical-string/XLISP/increment-a-numerical-string.xlisp create mode 100644 Task/Increment-a-numerical-string/jq/increment-a-numerical-string-1.jq create mode 100644 Task/Increment-a-numerical-string/jq/increment-a-numerical-string-2.jq create mode 100644 Task/Increment-a-numerical-string/jq/increment-a-numerical-string-3.jq create mode 100644 Task/Infinity/ERRE/infinity.erre create mode 100644 Task/Infinity/FreeBASIC/infinity.freebasic create mode 100644 Task/Infinity/Lasso/infinity.lasso create mode 100644 Task/Infinity/Lingo/infinity.lingo create mode 100644 Task/Infinity/Nim/infinity-1.nim create mode 100644 Task/Infinity/Nim/infinity-2.nim create mode 100644 Task/Infinity/Oforth/infinity.oforth create mode 100644 Task/Infinity/Phix/infinity.phix create mode 100644 Task/Infinity/Sidef/infinity.sidef create mode 100644 Task/Infinity/Swift/infinity-1.swift create mode 100644 Task/Infinity/Swift/infinity-2.swift create mode 100644 Task/Infinity/Ursa/infinity.ursa create mode 100644 Task/Infinity/jq/infinity-1.jq create mode 100644 Task/Infinity/jq/infinity-2.jq create mode 100644 Task/Inheritance-Multiple/FreeBASIC/inheritance-multiple.freebasic create mode 100644 Task/Inheritance-Multiple/Lasso/inheritance-multiple.lasso create mode 100644 Task/Inheritance-Multiple/Lingo/inheritance-multiple-1.lingo create mode 100644 Task/Inheritance-Multiple/Lingo/inheritance-multiple-2.lingo create mode 100644 Task/Inheritance-Multiple/Lingo/inheritance-multiple-3.lingo create mode 100644 Task/Inheritance-Multiple/Lingo/inheritance-multiple-4.lingo create mode 100644 Task/Inheritance-Multiple/Oforth/inheritance-multiple.oforth create mode 100644 Task/Inheritance-Multiple/Sidef/inheritance-multiple.sidef create mode 100644 Task/Inheritance-Multiple/Swift/inheritance-multiple.swift create mode 100644 Task/Inheritance-Single/ChucK/inheritance-single-1.chuck create mode 100644 Task/Inheritance-Single/ChucK/inheritance-single-2.chuck create mode 100644 Task/Inheritance-Single/ChucK/inheritance-single-3.chuck create mode 100644 Task/Inheritance-Single/ChucK/inheritance-single-4.chuck create mode 100644 Task/Inheritance-Single/ChucK/inheritance-single-5.chuck create mode 100644 Task/Inheritance-Single/Coco/inheritance-single-1.coco create mode 100644 Task/Inheritance-Single/Coco/inheritance-single-2.coco create mode 100644 Task/Inheritance-Single/Comal/inheritance-single-1.comal create mode 100644 Task/Inheritance-Single/Comal/inheritance-single-2.comal create mode 100644 Task/Inheritance-Single/Comal/inheritance-single-3.comal create mode 100644 Task/Inheritance-Single/Comal/inheritance-single-4.comal create mode 100644 Task/Inheritance-Single/Comal/inheritance-single-5.comal create mode 100644 Task/Inheritance-Single/FreeBASIC/inheritance-single.freebasic create mode 100644 Task/Inheritance-Single/Lasso/inheritance-single.lasso create mode 100644 Task/Inheritance-Single/Lingo/inheritance-single-1.lingo create mode 100644 Task/Inheritance-Single/Lingo/inheritance-single-2.lingo create mode 100644 Task/Inheritance-Single/Lingo/inheritance-single-3.lingo create mode 100644 Task/Inheritance-Single/Lingo/inheritance-single-4.lingo create mode 100644 Task/Inheritance-Single/Lingo/inheritance-single-5.lingo create mode 100644 Task/Inheritance-Single/Nim/inheritance-single.nim create mode 100644 Task/Inheritance-Single/Oforth/inheritance-single.oforth create mode 100644 Task/Inheritance-Single/Ring/inheritance-single.ring create mode 100644 Task/Inheritance-Single/Sidef/inheritance-single.sidef create mode 100644 Task/Inheritance-Single/Swift/inheritance-single.swift create mode 100644 Task/Inheritance-Single/XLISP/inheritance-single-1.xlisp create mode 100644 Task/Inheritance-Single/XLISP/inheritance-single-2.xlisp create mode 100644 Task/Input-loop/FreeBASIC/input-loop.freebasic create mode 100644 Task/Input-loop/FutureBasic/input-loop.futurebasic create mode 100644 Task/Input-loop/Lasso/input-loop.lasso create mode 100644 Task/Input-loop/Nim/input-loop.nim create mode 100644 Task/Input-loop/Oforth/input-loop.oforth create mode 100644 Task/Input-loop/Ring/input-loop.ring create mode 100644 Task/Input-loop/Sidef/input-loop.sidef create mode 100644 Task/Input-loop/Sparkling/input-loop.sparkling create mode 100644 Task/Input-loop/Ursa/input-loop.ursa create mode 100644 Task/Input-loop/jq/input-loop-1.jq create mode 100644 Task/Input-loop/jq/input-loop-2.jq create mode 100644 Task/Integer-comparison/8051-Assembly/integer-comparison.8051 create mode 100644 Task/Integer-comparison/8th/integer-comparison.8th create mode 100644 Task/Integer-comparison/Axe/integer-comparison.axe create mode 100644 Task/Integer-comparison/ChucK/integer-comparison.chuck create mode 100644 Task/Integer-comparison/Computer-zero-Assembly/integer-comparison.computer create mode 100644 Task/Integer-comparison/ECL/integer-comparison.ecl create mode 100644 Task/Integer-comparison/EDSAC-order-code/integer-comparison.edsac create mode 100644 Task/Integer-comparison/FreeBASIC/integer-comparison.freebasic create mode 100644 Task/Integer-comparison/FunL/integer-comparison.funl create mode 100644 Task/Integer-comparison/FutureBasic/integer-comparison.futurebasic create mode 100644 Task/Integer-comparison/Harbour/integer-comparison.harbour create mode 100644 Task/Integer-comparison/Lasso/integer-comparison.lasso create mode 100644 Task/Integer-comparison/Lingo/integer-comparison.lingo create mode 100644 Task/Integer-comparison/LiveCode/integer-comparison.livecode create mode 100644 Task/Integer-comparison/Nim/integer-comparison.nim create mode 100644 Task/Integer-comparison/Oforth/integer-comparison.oforth create mode 100644 Task/Integer-comparison/PHL/integer-comparison.phl create mode 100644 Task/Integer-comparison/Phix/integer-comparison.phix create mode 100644 Task/Integer-comparison/Ring/integer-comparison.ring create mode 100644 Task/Integer-comparison/SSEM/integer-comparison.ssem create mode 100644 Task/Integer-comparison/Sidef/integer-comparison.sidef create mode 100644 Task/Integer-comparison/Sparkling/integer-comparison.sparkling create mode 100644 Task/Integer-comparison/Swift/integer-comparison.swift create mode 100644 Task/Integer-comparison/Ursa/integer-comparison.ursa create mode 100644 Task/Integer-comparison/Wart/integer-comparison.wart create mode 100644 Task/Integer-comparison/XLISP/integer-comparison.xlisp create mode 100644 Task/Integer-comparison/jq/integer-comparison-1.jq create mode 100644 Task/Integer-comparison/jq/integer-comparison-2.jq create mode 100644 Task/Integer-overflow/Axe/integer-overflow.axe create mode 100644 Task/Integer-overflow/Computer-zero-Assembly/integer-overflow.computer create mode 100644 Task/Integer-overflow/FreeBASIC/integer-overflow.freebasic create mode 100644 Task/Integer-overflow/Lingo/integer-overflow.lingo create mode 100644 Task/Integer-overflow/Phix/integer-overflow.phix create mode 100644 Task/Integer-overflow/Sidef/integer-overflow.sidef create mode 100644 Task/Integer-overflow/Swift/integer-overflow.swift create mode 100644 Task/Integer-sequence/Axe/integer-sequence.axe create mode 100644 Task/Integer-sequence/ChucK/integer-sequence.chuck create mode 100644 Task/Integer-sequence/Computer-zero-Assembly/integer-sequence.computer create mode 100644 Task/Integer-sequence/EDSAC-order-code/integer-sequence.edsac create mode 100644 Task/Integer-sequence/ERRE/integer-sequence.erre create mode 100644 Task/Integer-sequence/EchoLisp/integer-sequence.echolisp create mode 100644 Task/Integer-sequence/FreeBASIC/integer-sequence.freebasic create mode 100644 Task/Integer-sequence/FunL/integer-sequence.funl create mode 100644 Task/Integer-sequence/Futhark/integer-sequence.futhark create mode 100644 Task/Integer-sequence/Lasso/integer-sequence.lasso create mode 100644 Task/Integer-sequence/Lingo/integer-sequence-1.lingo create mode 100644 Task/Integer-sequence/Lingo/integer-sequence-2.lingo create mode 100644 Task/Integer-sequence/Lingo/integer-sequence-3.lingo create mode 100644 Task/Integer-sequence/Lingo/integer-sequence-4.lingo create mode 100644 Task/Integer-sequence/Nim/integer-sequence-1.nim create mode 100644 Task/Integer-sequence/Nim/integer-sequence-2.nim create mode 100644 Task/Integer-sequence/Oforth/integer-sequence.oforth create mode 100644 Task/Integer-sequence/Phix/integer-sequence-1.phix create mode 100644 Task/Integer-sequence/Phix/integer-sequence-2.phix create mode 100644 Task/Integer-sequence/Phix/integer-sequence-3.phix create mode 100644 Task/Integer-sequence/Ring/integer-sequence.ring create mode 100644 Task/Integer-sequence/SSEM/integer-sequence.ssem create mode 100644 Task/Integer-sequence/Sidef/integer-sequence.sidef create mode 100644 Task/Integer-sequence/Swift/integer-sequence.swift create mode 100644 Task/Integer-sequence/Ursa/integer-sequence.ursa create mode 100644 Task/Integer-sequence/jq/integer-sequence-1.jq create mode 100644 Task/Integer-sequence/jq/integer-sequence-2.jq create mode 100644 Task/Integer-sequence/jq/integer-sequence-3.jq create mode 100644 Task/Interactive-programming/EchoLisp/interactive-programming.echolisp create mode 100644 Task/Interactive-programming/FreeBASIC/interactive-programming.freebasic create mode 100644 Task/Interactive-programming/Lasso/interactive-programming.lasso create mode 100644 Task/Interactive-programming/Lingo/interactive-programming.lingo create mode 100644 Task/Interactive-programming/Oforth/interactive-programming-1.oforth create mode 100644 Task/Interactive-programming/Oforth/interactive-programming-2.oforth create mode 100644 Task/Interactive-programming/Oforth/interactive-programming-3.oforth create mode 100644 Task/Interactive-programming/Ring/interactive-programming.ring create mode 100644 Task/Interactive-programming/Sidef/interactive-programming.sidef create mode 100644 Task/Interactive-programming/Ursa/interactive-programming.ursa create mode 100644 Task/Interactive-programming/XLISP/interactive-programming.xlisp create mode 100644 Task/Introspection/EchoLisp/introspection.echolisp create mode 100644 Task/Introspection/Lasso/introspection-1.lasso create mode 100644 Task/Introspection/Lasso/introspection-2.lasso create mode 100644 Task/Introspection/Lingo/introspection-1.lingo create mode 100644 Task/Introspection/Lingo/introspection-2.lingo create mode 100644 Task/Introspection/Lingo/introspection-3.lingo create mode 100644 Task/Introspection/Nim/introspection.nim create mode 100644 Task/Introspection/Oforth/introspection.oforth create mode 100644 Task/Inverted-index/EchoLisp/inverted-index-1.echolisp create mode 100644 Task/Inverted-index/EchoLisp/inverted-index-2.echolisp create mode 100644 Task/Inverted-index/EchoLisp/inverted-index-3.echolisp create mode 100644 Task/Inverted-index/Phix/inverted-index.phix create mode 100644 Task/Inverted-index/jq/inverted-index-1.jq create mode 100644 Task/Inverted-index/jq/inverted-index-2.jq create mode 100644 Task/Inverted-index/jq/inverted-index-3.jq create mode 100644 Task/Inverted-syntax/EchoLisp/inverted-syntax.echolisp create mode 100644 Task/Inverted-syntax/FreeBASIC/inverted-syntax.freebasic create mode 100644 Task/Inverted-syntax/Sidef/inverted-syntax.sidef create mode 100644 Task/Inverted-syntax/Swift/inverted-syntax.swift create mode 100644 Task/Inverted-syntax/Wortel/inverted-syntax.wortel create mode 100644 Task/Inverted-syntax/jq/inverted-syntax-1.jq create mode 100644 Task/Inverted-syntax/jq/inverted-syntax-2.jq create mode 100644 Task/Iterated-digits-squaring/Ceylon/iterated-digits-squaring.ceylon create mode 100644 Task/Iterated-digits-squaring/ERRE/iterated-digits-squaring.erre create mode 100644 Task/Iterated-digits-squaring/FreeBASIC/iterated-digits-squaring.freebasic create mode 100644 Task/Iterated-digits-squaring/Oforth/iterated-digits-squaring.oforth create mode 100644 Task/Iterated-digits-squaring/Ring/iterated-digits-squaring.ring create mode 100644 Task/Iterated-digits-squaring/jq/iterated-digits-squaring-1.jq create mode 100644 Task/Iterated-digits-squaring/jq/iterated-digits-squaring-2.jq create mode 100644 Task/Iterated-digits-squaring/jq/iterated-digits-squaring-3.jq create mode 100644 Task/Iterated-digits-squaring/jq/iterated-digits-squaring-4.jq create mode 100644 Task/JSON/AntLang/json.antlang create mode 100644 Task/JSON/Apex/json.apex create mode 100644 Task/JSON/EchoLisp/json.echolisp create mode 100644 Task/JSON/FunL/json-1.funl create mode 100644 Task/JSON/FunL/json-2.funl create mode 100644 Task/JSON/Harbour/json-1.harbour create mode 100644 Task/JSON/Harbour/json-2.harbour create mode 100644 Task/JSON/Hoon/json.hoon create mode 100644 Task/JSON/LFE/json-1.lfe create mode 100644 Task/JSON/LFE/json-2.lfe create mode 100644 Task/JSON/LFE/json-3.lfe create mode 100644 Task/JSON/LFE/json-4.lfe create mode 100644 Task/JSON/LFE/json-5.lfe create mode 100644 Task/JSON/Lasso/json.lasso create mode 100644 Task/JSON/Lingo/json-1.lingo create mode 100644 Task/JSON/Lingo/json-2.lingo create mode 100644 Task/JSON/Lingo/json-3.lingo create mode 100644 Task/JSON/Nim/json.nim create mode 100644 Task/JSON/Oforth/json.oforth create mode 100644 Task/JSON/Sidef/json.sidef create mode 100644 Task/JSON/Swift/json.swift create mode 100644 Task/JSON/jq/json-1.jq create mode 100644 Task/JSON/jq/json-2.jq create mode 100644 Task/JSON/jq/json-3.jq create mode 100644 Task/Jensens-Device/Nim/jensens-device.nim create mode 100644 Task/Jensens-Device/Oforth/jensens-device.oforth create mode 100644 Task/Jensens-Device/Sidef/jensens-device.sidef create mode 100644 Task/Jensens-Device/Swift/jensens-device.swift create mode 100644 Task/Jensens-Device/jq/jensens-device.jq create mode 100644 Task/Josephus-problem/ERRE/josephus-problem.erre create mode 100644 Task/Josephus-problem/EchoLisp/josephus-problem-1.echolisp create mode 100644 Task/Josephus-problem/EchoLisp/josephus-problem-2.echolisp create mode 100644 Task/Josephus-problem/Nim/josephus-problem.nim create mode 100644 Task/Josephus-problem/Oforth/josephus-problem.oforth create mode 100644 Task/Josephus-problem/Sidef/josephus-problem-1.sidef create mode 100644 Task/Josephus-problem/Sidef/josephus-problem-2.sidef create mode 100644 Task/Josephus-problem/Sidef/josephus-problem-3.sidef create mode 100644 Task/Josephus-problem/Swift/josephus-problem.swift create mode 100644 Task/Josephus-problem/jq/josephus-problem-1.jq create mode 100644 Task/Josephus-problem/jq/josephus-problem-2.jq create mode 100644 Task/Jump-anywhere/Computer-zero-Assembly/jump-anywhere.computer create mode 100644 Task/Jump-anywhere/ERRE/jump-anywhere.erre create mode 100644 Task/Jump-anywhere/FreeBASIC/jump-anywhere.freebasic create mode 100644 Task/Jump-anywhere/FutureBasic/jump-anywhere.futurebasic create mode 100644 Task/Jump-anywhere/Lingo/jump-anywhere-1.lingo create mode 100644 Task/Jump-anywhere/Lingo/jump-anywhere-2.lingo create mode 100644 Task/Jump-anywhere/Nim/jump-anywhere.nim create mode 100644 Task/Jump-anywhere/Phix/jump-anywhere-1.phix create mode 100644 Task/Jump-anywhere/Phix/jump-anywhere-2.phix create mode 100644 Task/Jump-anywhere/Phix/jump-anywhere-3.phix create mode 100644 Task/Jump-anywhere/Phix/jump-anywhere-4.phix create mode 100644 Task/Jump-anywhere/Phix/jump-anywhere-5.phix create mode 100644 Task/Jump-anywhere/SSEM/jump-anywhere-1.ssem create mode 100644 Task/Jump-anywhere/SSEM/jump-anywhere-2.ssem create mode 100644 Task/Jump-anywhere/jq/jump-anywhere-1.jq create mode 100644 Task/Jump-anywhere/jq/jump-anywhere-2.jq create mode 100644 Task/Jump-anywhere/jq/jump-anywhere-3.jq create mode 100644 Task/K-d-tree/Sidef/k-d-tree.sidef create mode 100644 Task/Kaprekar-numbers/FreeBASIC/kaprekar-numbers.freebasic create mode 100644 Task/Kaprekar-numbers/Nim/kaprekar-numbers.nim create mode 100644 Task/Kaprekar-numbers/Ring/kaprekar-numbers.ring create mode 100644 Task/Kaprekar-numbers/Sidef/kaprekar-numbers.sidef create mode 100644 Task/Kaprekar-numbers/Wortel/kaprekar-numbers.wortel create mode 100644 Task/Kaprekar-numbers/jq/kaprekar-numbers-1.jq create mode 100644 Task/Kaprekar-numbers/jq/kaprekar-numbers-2.jq create mode 100644 Task/Keyboard-input-Flush-the-keyboard-buffer/Axe/keyboard-input-flush-the-keyboard-buffer.axe create mode 100644 Task/Keyboard-input-Flush-the-keyboard-buffer/ERRE/keyboard-input-flush-the-keyboard-buffer.erre create mode 100644 Task/Keyboard-input-Flush-the-keyboard-buffer/FreeBASIC/keyboard-input-flush-the-keyboard-buffer.freebasic create mode 100644 Task/Keyboard-input-Flush-the-keyboard-buffer/Nim/keyboard-input-flush-the-keyboard-buffer.nim create mode 100644 Task/Keyboard-input-Flush-the-keyboard-buffer/Oforth/keyboard-input-flush-the-keyboard-buffer.oforth create mode 100644 Task/Keyboard-input-Flush-the-keyboard-buffer/Phix/keyboard-input-flush-the-keyboard-buffer.phix create mode 100644 Task/Keyboard-input-Flush-the-keyboard-buffer/Sidef/keyboard-input-flush-the-keyboard-buffer.sidef create mode 100644 Task/Keyboard-input-Keypress-check/Axe/keyboard-input-keypress-check.axe create mode 100644 Task/Keyboard-input-Keypress-check/ERRE/keyboard-input-keypress-check.erre create mode 100644 Task/Keyboard-input-Keypress-check/FreeBASIC/keyboard-input-keypress-check.freebasic create mode 100644 Task/Keyboard-input-Keypress-check/Lingo/keyboard-input-keypress-check.lingo create mode 100644 Task/Keyboard-input-Keypress-check/LiveCode/keyboard-input-keypress-check-1.livecode create mode 100644 Task/Keyboard-input-Keypress-check/LiveCode/keyboard-input-keypress-check-2.livecode create mode 100644 Task/Keyboard-input-Keypress-check/Oforth/keyboard-input-keypress-check-1.oforth create mode 100644 Task/Keyboard-input-Keypress-check/Oforth/keyboard-input-keypress-check-2.oforth create mode 100644 Task/Keyboard-input-Keypress-check/Phix/keyboard-input-keypress-check.phix create mode 100644 Task/Keyboard-input-Keypress-check/Ring/keyboard-input-keypress-check.ring create mode 100644 Task/Keyboard-input-Obtain-a-Y-or-N-response/8th/keyboard-input-obtain-a-y-or-n-response.8th create mode 100644 Task/Keyboard-input-Obtain-a-Y-or-N-response/Axe/keyboard-input-obtain-a-y-or-n-response.axe create mode 100644 Task/Keyboard-input-Obtain-a-Y-or-N-response/ERRE/keyboard-input-obtain-a-y-or-n-response.erre create mode 100644 Task/Keyboard-input-Obtain-a-Y-or-N-response/Elm/keyboard-input-obtain-a-y-or-n-response.elm create mode 100644 Task/Keyboard-input-Obtain-a-Y-or-N-response/FreeBASIC/keyboard-input-obtain-a-y-or-n-response.freebasic create mode 100644 Task/Keyboard-input-Obtain-a-Y-or-N-response/FutureBasic/keyboard-input-obtain-a-y-or-n-response.futurebasic create mode 100644 Task/Keyboard-input-Obtain-a-Y-or-N-response/LiveCode/keyboard-input-obtain-a-y-or-n-response.livecode create mode 100644 Task/Keyboard-input-Obtain-a-Y-or-N-response/Oforth/keyboard-input-obtain-a-y-or-n-response.oforth create mode 100644 Task/Keyboard-input-Obtain-a-Y-or-N-response/Phix/keyboard-input-obtain-a-y-or-n-response.phix create mode 100644 Task/Keyboard-input-Obtain-a-Y-or-N-response/Ring/keyboard-input-obtain-a-y-or-n-response.ring create mode 100644 Task/Keyboard-input-Obtain-a-Y-or-N-response/Sidef/keyboard-input-obtain-a-y-or-n-response.sidef create mode 100644 Task/Keyboard-macros/EchoLisp/keyboard-macros.echolisp create mode 100644 Task/Knapsack-problem-0-1/Ceylon/knapsack-problem-0-1-1.ceylon create mode 100644 Task/Knapsack-problem-0-1/Ceylon/knapsack-problem-0-1-2.ceylon create mode 100644 Task/Knapsack-problem-0-1/EchoLisp/knapsack-problem-0-1-1.echolisp create mode 100644 Task/Knapsack-problem-0-1/EchoLisp/knapsack-problem-0-1-2.echolisp create mode 100644 Task/Knapsack-problem-0-1/FutureBasic/knapsack-problem-0-1.futurebasic create mode 100644 Task/Knapsack-problem-0-1/Sidef/knapsack-problem-0-1.sidef create mode 100644 Task/Knapsack-problem-0-1/jq/knapsack-problem-0-1-1.jq create mode 100644 Task/Knapsack-problem-0-1/jq/knapsack-problem-0-1-2.jq create mode 100644 Task/Knapsack-problem-0-1/jq/knapsack-problem-0-1-3.jq create mode 100644 Task/Knapsack-problem-Bounded/EchoLisp/knapsack-problem-bounded-1.echolisp create mode 100644 Task/Knapsack-problem-Bounded/EchoLisp/knapsack-problem-bounded-2.echolisp create mode 100644 Task/Knapsack-problem-Bounded/Sidef/knapsack-problem-bounded.sidef create mode 100644 Task/Knapsack-problem-Continuous/EchoLisp/knapsack-problem-continuous.echolisp create mode 100644 Task/Knapsack-problem-Continuous/Oforth/knapsack-problem-continuous.oforth create mode 100644 Task/Knapsack-problem-Continuous/Sidef/knapsack-problem-continuous.sidef create mode 100644 Task/Knapsack-problem-Continuous/jq/knapsack-problem-continuous-1.jq create mode 100644 Task/Knapsack-problem-Continuous/jq/knapsack-problem-continuous-2.jq create mode 100644 Task/Knapsack-problem-Continuous/jq/knapsack-problem-continuous-3.jq create mode 100644 Task/Knapsack-problem-Unbounded/EchoLisp/knapsack-problem-unbounded.echolisp create mode 100644 Task/Knapsack-problem-Unbounded/Sidef/knapsack-problem-unbounded.sidef create mode 100644 Task/Knights-tour/ERRE/knights-tour.erre create mode 100644 Task/Knights-tour/EchoLisp/knights-tour-1.echolisp create mode 100644 Task/Knights-tour/EchoLisp/knights-tour-2.echolisp create mode 100644 Task/Knights-tour/EchoLisp/knights-tour-3.echolisp create mode 100644 Task/Knights-tour/Elm/knights-tour.elm create mode 100644 Task/Knights-tour/Phix/knights-tour.phix create mode 100644 Task/Knights-tour/Sidef/knights-tour.sidef create mode 100644 Task/Knuth-shuffle/ERRE/knuth-shuffle.erre create mode 100644 Task/Knuth-shuffle/EchoLisp/knuth-shuffle.echolisp create mode 100644 Task/Knuth-shuffle/FreeBASIC/knuth-shuffle.freebasic create mode 100644 Task/Knuth-shuffle/FunL/knuth-shuffle.funl create mode 100644 Task/Knuth-shuffle/Lasso/knuth-shuffle.lasso create mode 100644 Task/Knuth-shuffle/Nim/knuth-shuffle.nim create mode 100644 Task/Knuth-shuffle/Oforth/knuth-shuffle.oforth create mode 100644 Task/Knuth-shuffle/Phix/knuth-shuffle.phix create mode 100644 Task/Knuth-shuffle/Ring/knuth-shuffle.ring create mode 100644 Task/Knuth-shuffle/Sidef/knuth-shuffle.sidef create mode 100644 Task/Knuth-shuffle/Swift/knuth-shuffle-1.swift create mode 100644 Task/Knuth-shuffle/Swift/knuth-shuffle-2.swift create mode 100644 Task/Knuth-shuffle/Swift/knuth-shuffle-3.swift create mode 100644 Task/Knuths-algorithm-S/Sidef/knuths-algorithm-s.sidef create mode 100644 Task/Knuths-algorithm-S/Swift/knuths-algorithm-s.swift create mode 100644 Task/LU-decomposition/EchoLisp/lu-decomposition.echolisp create mode 100644 Task/LU-decomposition/Idris/lu-decomposition.idris create mode 100644 Task/LU-decomposition/Sidef/lu-decomposition.sidef create mode 100644 Task/LU-decomposition/jq/lu-decomposition-1.jq create mode 100644 Task/LU-decomposition/jq/lu-decomposition-2.jq create mode 100644 Task/LU-decomposition/jq/lu-decomposition-3.jq create mode 100644 Task/LU-decomposition/jq/lu-decomposition-4.jq create mode 100644 Task/LU-decomposition/jq/lu-decomposition-5.jq create mode 100644 Task/LU-decomposition/jq/lu-decomposition-6.jq create mode 100644 Task/LU-decomposition/jq/lu-decomposition-7.jq create mode 100644 Task/LZW-compression/Nim/lzw-compression.nim create mode 100644 Task/LZW-compression/Sidef/lzw-compression.sidef create mode 100644 Task/LZW-compression/Swift/lzw-compression.swift create mode 100644 Task/LZW-compression/jq/lzw-compression-1.jq create mode 100644 Task/LZW-compression/jq/lzw-compression-2.jq create mode 100644 Task/Langtons-ant/EchoLisp/langtons-ant.echolisp create mode 100644 Task/Langtons-ant/Elm/langtons-ant.elm create mode 100644 Task/Langtons-ant/FreeBASIC/langtons-ant.freebasic create mode 100644 Task/Langtons-ant/GFA-Basic/langtons-ant.gfa create mode 100644 Task/Langtons-ant/Nim/langtons-ant.nim create mode 100644 Task/Langtons-ant/Phix/langtons-ant.phix create mode 100644 Task/Langtons-ant/Ring/langtons-ant.ring create mode 100644 Task/Langtons-ant/Sidef/langtons-ant.sidef create mode 100644 Task/Langtons-ant/Swift/langtons-ant.swift create mode 100644 Task/Langtons-ant/jq/langtons-ant.jq create mode 100644 Task/Largest-int-from-concatenated-ints/Ceylon/largest-int-from-concatenated-ints.ceylon create mode 100644 Task/Largest-int-from-concatenated-ints/Nim/largest-int-from-concatenated-ints.nim create mode 100644 Task/Largest-int-from-concatenated-ints/Oforth/largest-int-from-concatenated-ints.oforth create mode 100644 Task/Largest-int-from-concatenated-ints/Phix/largest-int-from-concatenated-ints.phix create mode 100644 Task/Largest-int-from-concatenated-ints/Ring/largest-int-from-concatenated-ints.ring create mode 100644 Task/Largest-int-from-concatenated-ints/Sidef/largest-int-from-concatenated-ints.sidef create mode 100644 Task/Largest-int-from-concatenated-ints/jq/largest-int-from-concatenated-ints-1.jq create mode 100644 Task/Largest-int-from-concatenated-ints/jq/largest-int-from-concatenated-ints-2.jq create mode 100644 Task/Last-Friday-of-each-month/Elm/last-friday-of-each-month.elm create mode 100644 Task/Last-Friday-of-each-month/FreeBASIC/last-friday-of-each-month.freebasic create mode 100644 Task/Last-Friday-of-each-month/Lasso/last-friday-of-each-month.lasso create mode 100644 Task/Last-Friday-of-each-month/LiveCode/last-friday-of-each-month-1.livecode create mode 100644 Task/Last-Friday-of-each-month/LiveCode/last-friday-of-each-month-2.livecode create mode 100644 Task/Last-Friday-of-each-month/LiveCode/last-friday-of-each-month-3.livecode create mode 100644 Task/Last-Friday-of-each-month/Nim/last-friday-of-each-month.nim create mode 100644 Task/Last-Friday-of-each-month/Oforth/last-friday-of-each-month.oforth create mode 100644 Task/Last-Friday-of-each-month/Phix/last-friday-of-each-month.phix create mode 100644 Task/Last-Friday-of-each-month/Ring/last-friday-of-each-month.ring create mode 100644 Task/Last-Friday-of-each-month/Sidef/last-friday-of-each-month.sidef create mode 100644 Task/Last-Friday-of-each-month/Visual-FoxPro/last-friday-of-each-month.visual create mode 100644 Task/Last-Friday-of-each-month/jq/last-friday-of-each-month-1.jq create mode 100644 Task/Last-Friday-of-each-month/jq/last-friday-of-each-month-2.jq create mode 100644 Task/Last-Friday-of-each-month/jq/last-friday-of-each-month-3.jq create mode 100644 Task/Last-letter-first-letter/Phix/last-letter-first-letter.phix create mode 100644 Task/Last-letter-first-letter/jq/last-letter-first-letter-1.jq create mode 100644 Task/Last-letter-first-letter/jq/last-letter-first-letter-2.jq create mode 100644 Task/Last-letter-first-letter/jq/last-letter-first-letter-3.jq create mode 100644 Task/Last-letter-first-letter/jq/last-letter-first-letter-4.jq create mode 100644 Task/Leap-year/ERRE/leap-year.erre create mode 100644 Task/Leap-year/FreeBASIC/leap-year.freebasic create mode 100644 Task/Leap-year/FutureBasic/leap-year.futurebasic create mode 100644 Task/Leap-year/Harbour/leap-year.harbour create mode 100644 Task/Leap-year/Hy/leap-year.hy create mode 100644 Task/Leap-year/Lasso/leap-year.lasso create mode 100644 Task/Leap-year/Lingo/leap-year.lingo create mode 100644 Task/Leap-year/LiveCode/leap-year.livecode create mode 100644 Task/Leap-year/Nim/leap-year.nim create mode 100644 Task/Leap-year/Oforth/leap-year.oforth create mode 100644 Task/Leap-year/Phix/leap-year.phix create mode 100644 Task/Leap-year/Ring/leap-year.ring create mode 100644 Task/Leap-year/Sidef/leap-year-1.sidef create mode 100644 Task/Leap-year/Sidef/leap-year-2.sidef create mode 100644 Task/Leap-year/Swift/leap-year.swift create mode 100644 Task/Leap-year/Ursa/leap-year.ursa create mode 100644 Task/Leap-year/Wortel/leap-year.wortel create mode 100644 Task/Leap-year/XLISP/leap-year.xlisp create mode 100644 Task/Leap-year/jq/leap-year-1.jq create mode 100644 Task/Leap-year/jq/leap-year-2.jq create mode 100644 Task/Least-common-multiple/8th/least-common-multiple.8th create mode 100644 Task/Least-common-multiple/ERRE/least-common-multiple.erre create mode 100644 Task/Least-common-multiple/EchoLisp/least-common-multiple.echolisp create mode 100644 Task/Least-common-multiple/Ezhil/least-common-multiple.ezhil create mode 100644 Task/Least-common-multiple/FreeBASIC/least-common-multiple.freebasic create mode 100644 Task/Least-common-multiple/FunL/least-common-multiple.funl create mode 100644 Task/Least-common-multiple/Lasso/least-common-multiple.lasso create mode 100644 Task/Least-common-multiple/Nim/least-common-multiple.nim create mode 100644 Task/Least-common-multiple/Oforth/least-common-multiple.oforth create mode 100644 Task/Least-common-multiple/Phix/least-common-multiple.phix create mode 100644 Task/Least-common-multiple/Ring/least-common-multiple.ring create mode 100644 Task/Least-common-multiple/Sidef/least-common-multiple-1.sidef create mode 100644 Task/Least-common-multiple/Sidef/least-common-multiple-2.sidef create mode 100644 Task/Least-common-multiple/Sparkling/least-common-multiple.sparkling create mode 100644 Task/Least-common-multiple/Swift/least-common-multiple.swift create mode 100644 Task/Least-common-multiple/Ursa/least-common-multiple.ursa create mode 100644 Task/Least-common-multiple/Wortel/least-common-multiple-1.wortel create mode 100644 Task/Least-common-multiple/Wortel/least-common-multiple-2.wortel create mode 100644 Task/Least-common-multiple/Wortel/least-common-multiple-3.wortel create mode 100644 Task/Least-common-multiple/jq/least-common-multiple.jq create mode 100644 Task/Left-factorials/EchoLisp/left-factorials-1.echolisp create mode 100644 Task/Left-factorials/EchoLisp/left-factorials-2.echolisp create mode 100644 Task/Left-factorials/Nim/left-factorials.nim create mode 100644 Task/Left-factorials/Oforth/left-factorials.oforth create mode 100644 Task/Left-factorials/Ring/left-factorials.ring create mode 100644 Task/Left-factorials/Sidef/left-factorials-1.sidef create mode 100644 Task/Left-factorials/Sidef/left-factorials-2.sidef create mode 100644 Task/Left-factorials/Sidef/left-factorials-3.sidef create mode 100644 Task/Left-factorials/Sidef/left-factorials-4.sidef create mode 100644 Task/Left-factorials/jq/left-factorials-1.jq create mode 100644 Task/Left-factorials/jq/left-factorials-2.jq create mode 100644 Task/Left-factorials/jq/left-factorials-3.jq create mode 100644 Task/Left-factorials/jq/left-factorials-4.jq create mode 100644 Task/Letter-frequency/ERRE/letter-frequency.erre create mode 100644 Task/Letter-frequency/EchoLisp/letter-frequency-1.echolisp create mode 100644 Task/Letter-frequency/EchoLisp/letter-frequency-2.echolisp create mode 100644 Task/Letter-frequency/FreeBASIC/letter-frequency.freebasic create mode 100644 Task/Letter-frequency/Harbour/letter-frequency.harbour create mode 100644 Task/Letter-frequency/Lasso/letter-frequency.lasso create mode 100644 Task/Letter-frequency/Nim/letter-frequency.nim create mode 100644 Task/Letter-frequency/Phix/letter-frequency.phix create mode 100644 Task/Letter-frequency/Ring/letter-frequency.ring create mode 100644 Task/Letter-frequency/Sidef/letter-frequency.sidef create mode 100644 Task/Letter-frequency/jq/letter-frequency-1.jq create mode 100644 Task/Letter-frequency/jq/letter-frequency-2.jq create mode 100644 Task/Levenshtein-distance/Arc/levenshtein-distance.arc create mode 100644 Task/Levenshtein-distance/ERRE/levenshtein-distance.erre create mode 100644 Task/Levenshtein-distance/EchoLisp/levenshtein-distance.echolisp create mode 100644 Task/Levenshtein-distance/FreeBASIC/levenshtein-distance.freebasic create mode 100644 Task/Levenshtein-distance/FutureBasic/levenshtein-distance.futurebasic create mode 100644 Task/Levenshtein-distance/LFE/levenshtein-distance-1.lfe create mode 100644 Task/Levenshtein-distance/LFE/levenshtein-distance-2.lfe create mode 100644 Task/Levenshtein-distance/LFE/levenshtein-distance-3.lfe create mode 100644 Task/Levenshtein-distance/LFE/levenshtein-distance-4.lfe create mode 100644 Task/Levenshtein-distance/Nim/levenshtein-distance.nim create mode 100644 Task/Levenshtein-distance/Phix/levenshtein-distance.phix create mode 100644 Task/Levenshtein-distance/Sidef/levenshtein-distance-1.sidef create mode 100644 Task/Levenshtein-distance/Sidef/levenshtein-distance-2.sidef create mode 100644 Task/Levenshtein-distance/Sidef/levenshtein-distance-3.sidef create mode 100644 Task/Levenshtein-distance/Swift/levenshtein-distance-1.swift create mode 100644 Task/Levenshtein-distance/Swift/levenshtein-distance-2.swift create mode 100644 Task/Levenshtein-distance/jq/levenshtein-distance-1.jq create mode 100644 Task/Levenshtein-distance/jq/levenshtein-distance-2.jq create mode 100644 Task/Linear-congruential-generator/ERRE/linear-congruential-generator.erre create mode 100644 Task/Linear-congruential-generator/FreeBASIC/linear-congruential-generator.freebasic create mode 100644 Task/Linear-congruential-generator/Nim/linear-congruential-generator.nim create mode 100644 Task/Linear-congruential-generator/Oforth/linear-congruential-generator.oforth create mode 100644 Task/Linear-congruential-generator/Sidef/linear-congruential-generator.sidef create mode 100644 Task/Linear-congruential-generator/Sparkling/linear-congruential-generator-1.sparkling create mode 100644 Task/Linear-congruential-generator/Sparkling/linear-congruential-generator-2.sparkling create mode 100644 Task/Linear-congruential-generator/Swift/linear-congruential-generator.swift create mode 100644 Task/Linear-congruential-generator/jq/linear-congruential-generator-1.jq create mode 100644 Task/Linear-congruential-generator/jq/linear-congruential-generator-2.jq create mode 100644 Task/Linear-congruential-generator/jq/linear-congruential-generator-3.jq create mode 100644 Task/Linear-congruential-generator/jq/linear-congruential-generator-4.jq create mode 100644 Task/List-comprehensions/EchoLisp/list-comprehensions.echolisp create mode 100644 Task/List-comprehensions/FunL/list-comprehensions.funl create mode 100644 Task/List-comprehensions/Lasso/list-comprehensions-1.lasso create mode 100644 Task/List-comprehensions/Lasso/list-comprehensions-2.lasso create mode 100644 Task/List-comprehensions/Nim/list-comprehensions.nim create mode 100644 Task/List-comprehensions/Ring/list-comprehensions.ring create mode 100644 Task/List-comprehensions/Sidef/list-comprehensions.sidef create mode 100644 Task/List-comprehensions/jq/list-comprehensions-1.jq create mode 100644 Task/List-comprehensions/jq/list-comprehensions-2.jq create mode 100644 Task/Literals-Floating-point/Axe/literals-floating-point-1.axe create mode 100644 Task/Literals-Floating-point/Axe/literals-floating-point-2.axe create mode 100644 Task/Literals-Floating-point/FreeBASIC/literals-floating-point.freebasic create mode 100644 Task/Literals-Floating-point/Lasso/literals-floating-point.lasso create mode 100644 Task/Literals-Floating-point/Lingo/literals-floating-point.lingo create mode 100644 Task/Literals-Floating-point/Nim/literals-floating-point.nim create mode 100644 Task/Literals-Floating-point/Oforth/literals-floating-point.oforth create mode 100644 Task/Literals-Floating-point/Phix/literals-floating-point.phix create mode 100644 Task/Literals-Floating-point/Sidef/literals-floating-point.sidef create mode 100644 Task/Literals-Floating-point/Swift/literals-floating-point.swift create mode 100644 Task/Literals-Floating-point/Ursa/literals-floating-point.ursa create mode 100644 Task/Literals-Floating-point/jq/literals-floating-point.jq create mode 100644 Task/Literals-Integer/Axe/literals-integer.axe create mode 100644 Task/Literals-Integer/Comal/literals-integer.comal create mode 100644 Task/Literals-Integer/ERRE/literals-integer.erre create mode 100644 Task/Literals-Integer/FreeBASIC/literals-integer.freebasic create mode 100644 Task/Literals-Integer/FutureBasic/literals-integer.futurebasic create mode 100644 Task/Literals-Integer/Harbour/literals-integer.harbour create mode 100644 Task/Literals-Integer/Lasso/literals-integer.lasso create mode 100644 Task/Literals-Integer/LiveCode/literals-integer.livecode create mode 100644 Task/Literals-Integer/Nim/literals-integer.nim create mode 100644 Task/Literals-Integer/Phix/literals-integer.phix create mode 100644 Task/Literals-Integer/Sidef/literals-integer.sidef create mode 100644 Task/Literals-Integer/Swift/literals-integer.swift create mode 100644 Task/Literals-Integer/Ursa/literals-integer.ursa create mode 100644 Task/Literals-String/Axe/literals-string-1.axe create mode 100644 Task/Literals-String/Axe/literals-string-2.axe create mode 100644 Task/Literals-String/Lasso/literals-string-1.lasso create mode 100644 Task/Literals-String/Lasso/literals-string-2.lasso create mode 100644 Task/Literals-String/Lingo/literals-string-1.lingo create mode 100644 Task/Literals-String/Lingo/literals-string-2.lingo create mode 100644 Task/Literals-String/Lingo/literals-string-3.lingo create mode 100644 Task/Literals-String/LiveCode/literals-string.livecode create mode 100644 Task/Literals-String/Nim/literals-string.nim create mode 100644 Task/Literals-String/Oforth/literals-string.oforth create mode 100644 Task/Literals-String/Phix/literals-string-1.phix create mode 100644 Task/Literals-String/Phix/literals-string-2.phix create mode 100644 Task/Literals-String/Phix/literals-string-3.phix create mode 100644 Task/Literals-String/Phix/literals-string-4.phix create mode 100644 Task/Literals-String/Phix/literals-string-5.phix create mode 100644 Task/Literals-String/Phix/literals-string-6.phix create mode 100644 Task/Literals-String/Ring/literals-string.ring create mode 100644 Task/Literals-String/Sidef/literals-string-1.sidef create mode 100644 Task/Literals-String/Sidef/literals-string-2.sidef create mode 100644 Task/Literals-String/Sidef/literals-string-3.sidef create mode 100644 Task/Literals-String/Swift/literals-string.swift create mode 100644 Task/Logical-operations/Apex/logical-operations.apex create mode 100644 Task/Logical-operations/Axe/logical-operations.axe create mode 100644 Task/Logical-operations/ECL/logical-operations.ecl create mode 100644 Task/Logical-operations/FreeBASIC/logical-operations.freebasic create mode 100644 Task/Logical-operations/FunL/logical-operations.funl create mode 100644 Task/Logical-operations/FutureBasic/logical-operations.futurebasic create mode 100644 Task/Logical-operations/Harbour/logical-operations.harbour create mode 100644 Task/Logical-operations/Lasso/logical-operations.lasso create mode 100644 Task/Logical-operations/LiveCode/logical-operations-1.livecode create mode 100644 Task/Logical-operations/LiveCode/logical-operations-2.livecode create mode 100644 Task/Logical-operations/Nim/logical-operations.nim create mode 100644 Task/Logical-operations/Oforth/logical-operations.oforth create mode 100644 Task/Logical-operations/Phix/logical-operations-1.phix create mode 100644 Task/Logical-operations/Phix/logical-operations-2.phix create mode 100644 Task/Logical-operations/Ring/logical-operations.ring create mode 100644 Task/Logical-operations/Sidef/logical-operations.sidef create mode 100644 Task/Logical-operations/SkookumScript/logical-operations-1.skookum create mode 100644 Task/Logical-operations/SkookumScript/logical-operations-2.skookum create mode 100644 Task/Logical-operations/Swift/logical-operations.swift create mode 100644 Task/Logical-operations/XLISP/logical-operations.xlisp create mode 100644 Task/Logical-operations/jq/logical-operations-1.jq create mode 100644 Task/Logical-operations/jq/logical-operations-2.jq create mode 100644 Task/Logical-operations/jq/logical-operations-3.jq create mode 100644 Task/Long-multiplication/EchoLisp/long-multiplication.echolisp create mode 100644 Task/Long-multiplication/Nim/long-multiplication.nim create mode 100644 Task/Long-multiplication/Oforth/long-multiplication.oforth create mode 100644 Task/Long-multiplication/Phix/long-multiplication.phix create mode 100644 Task/Long-multiplication/Sidef/long-multiplication-1.sidef create mode 100644 Task/Long-multiplication/Sidef/long-multiplication-2.sidef create mode 100644 Task/Long-multiplication/Sidef/long-multiplication-3.sidef create mode 100644 Task/Long-multiplication/jq/long-multiplication-1.jq create mode 100644 Task/Long-multiplication/jq/long-multiplication-2.jq create mode 100644 Task/Long-multiplication/jq/long-multiplication-3.jq create mode 100644 Task/Longest-common-subsequence/Egison/longest-common-subsequence-1.egison create mode 100644 Task/Longest-common-subsequence/Egison/longest-common-subsequence-2.egison create mode 100644 Task/Longest-common-subsequence/Nim/longest-common-subsequence-1.nim create mode 100644 Task/Longest-common-subsequence/Nim/longest-common-subsequence-2.nim create mode 100644 Task/Longest-common-subsequence/Ring/longest-common-subsequence.ring create mode 100644 Task/Longest-common-subsequence/Sidef/longest-common-subsequence.sidef create mode 100644 Task/Longest-common-subsequence/Swift/longest-common-subsequence-1.swift create mode 100644 Task/Longest-common-subsequence/Swift/longest-common-subsequence-2.swift create mode 100644 Task/Longest-common-subsequence/jq/longest-common-subsequence-1.jq create mode 100644 Task/Longest-common-subsequence/jq/longest-common-subsequence-2.jq create mode 100644 Task/Longest-common-subsequence/jq/longest-common-subsequence-3.jq create mode 100644 Task/Longest-increasing-subsequence/Sidef/longest-increasing-subsequence-1.sidef create mode 100644 Task/Longest-increasing-subsequence/Sidef/longest-increasing-subsequence-2.sidef create mode 100644 Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-1.jq create mode 100644 Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-2.jq create mode 100644 Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-3.jq create mode 100644 Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-4.jq create mode 100644 Task/Longest-string-challenge/Phix/longest-string-challenge-1.phix create mode 100644 Task/Longest-string-challenge/Phix/longest-string-challenge-2.phix create mode 100644 Task/Longest-string-challenge/Sidef/longest-string-challenge.sidef create mode 100644 Task/Look-and-say-sequence/ERRE/look-and-say-sequence.erre create mode 100644 Task/Look-and-say-sequence/EchoLisp/look-and-say-sequence-1.echolisp create mode 100644 Task/Look-and-say-sequence/EchoLisp/look-and-say-sequence-2.echolisp create mode 100644 Task/Look-and-say-sequence/Lasso/look-and-say-sequence.lasso create mode 100644 Task/Look-and-say-sequence/LiveCode/look-and-say-sequence.livecode create mode 100644 Task/Look-and-say-sequence/Oforth/look-and-say-sequence.oforth create mode 100644 Task/Look-and-say-sequence/Ring/look-and-say-sequence.ring create mode 100644 Task/Look-and-say-sequence/Sidef/look-and-say-sequence.sidef create mode 100644 Task/Look-and-say-sequence/jq/look-and-say-sequence.jq create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/Axe/loop-over-multiple-arrays-simultaneously.axe create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/EchoLisp/loop-over-multiple-arrays-simultaneously.echolisp create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/FreeBASIC/loop-over-multiple-arrays-simultaneously.freebasic create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/FunL/loop-over-multiple-arrays-simultaneously.funl create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/LFE/loop-over-multiple-arrays-simultaneously.lfe create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/LiveCode/loop-over-multiple-arrays-simultaneously-1.livecode create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/LiveCode/loop-over-multiple-arrays-simultaneously-2.livecode create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/Nim/loop-over-multiple-arrays-simultaneously.nim create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/Oforth/loop-over-multiple-arrays-simultaneously.oforth create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/Phix/loop-over-multiple-arrays-simultaneously.phix create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/Ring/loop-over-multiple-arrays-simultaneously.ring create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/Sidef/loop-over-multiple-arrays-simultaneously.sidef create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/Swift/loop-over-multiple-arrays-simultaneously.swift create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/Ursa/loop-over-multiple-arrays-simultaneously.ursa create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/Visual-FoxPro/loop-over-multiple-arrays-simultaneously.visual create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/Wart/loop-over-multiple-arrays-simultaneously.wart create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/jq/loop-over-multiple-arrays-simultaneously-1.jq create mode 100644 Task/Loop-over-multiple-arrays-simultaneously/jq/loop-over-multiple-arrays-simultaneously-2.jq create mode 100644 Task/Loops-Break/Axe/loops-break.axe create mode 100644 Task/Loops-Break/ERRE/loops-break.erre create mode 100644 Task/Loops-Break/FreeBASIC/loops-break.freebasic create mode 100644 Task/Loops-Break/FutureBasic/loops-break.futurebasic create mode 100644 Task/Loops-Break/Harbour/loops-break.harbour create mode 100644 Task/Loops-Break/Lasso/loops-break.lasso create mode 100644 Task/Loops-Break/Lingo/loops-break.lingo create mode 100644 Task/Loops-Break/LiveCode/loops-break.livecode create mode 100644 Task/Loops-Break/Nim/loops-break.nim create mode 100644 Task/Loops-Break/Oforth/loops-break.oforth create mode 100644 Task/Loops-Break/Phix/loops-break.phix create mode 100644 Task/Loops-Break/Ring/loops-break.ring create mode 100644 Task/Loops-Break/Sidef/loops-break.sidef create mode 100644 Task/Loops-Break/Swift/loops-break.swift create mode 100644 Task/Loops-Break/Ursa/loops-break.ursa create mode 100644 Task/Loops-Continue/ERRE/loops-continue.erre create mode 100644 Task/Loops-Continue/FreeBASIC/loops-continue.freebasic create mode 100644 Task/Loops-Continue/Lasso/loops-continue.lasso create mode 100644 Task/Loops-Continue/Lingo/loops-continue.lingo create mode 100644 Task/Loops-Continue/LiveCode/loops-continue.livecode create mode 100644 Task/Loops-Continue/Nim/loops-continue.nim create mode 100644 Task/Loops-Continue/Oforth/loops-continue.oforth create mode 100644 Task/Loops-Continue/Phix/loops-continue.phix create mode 100644 Task/Loops-Continue/Ring/loops-continue.ring create mode 100644 Task/Loops-Continue/Sidef/loops-continue.sidef create mode 100644 Task/Loops-Continue/Swift/loops-continue.swift create mode 100644 Task/Loops-Continue/Ursa/loops-continue.ursa create mode 100644 Task/Loops-Continue/jq/loops-continue.jq create mode 100644 Task/Loops-Do-while/Axe/loops-do-while.axe create mode 100644 Task/Loops-Do-while/ChucK/loops-do-while.chuck create mode 100644 Task/Loops-Do-while/Coco/loops-do-while.coco create mode 100644 Task/Loops-Do-while/ERRE/loops-do-while.erre create mode 100644 Task/Loops-Do-while/FreeBASIC/loops-do-while.freebasic create mode 100644 Task/Loops-Do-while/FutureBasic/loops-do-while.futurebasic create mode 100644 Task/Loops-Do-while/Harbour/loops-do-while.harbour create mode 100644 Task/Loops-Do-while/Lasso/loops-do-while.lasso create mode 100644 Task/Loops-Do-while/Lingo/loops-do-while.lingo create mode 100644 Task/Loops-Do-while/LiveCode/loops-do-while.livecode create mode 100644 Task/Loops-Do-while/Monicelli/loops-do-while.monicelli create mode 100644 Task/Loops-Do-while/Nim/loops-do-while.nim create mode 100644 Task/Loops-Do-while/Oforth/loops-do-while.oforth create mode 100644 Task/Loops-Do-while/PHL/loops-do-while.phl create mode 100644 Task/Loops-Do-while/Phix/loops-do-while.phix create mode 100644 Task/Loops-Do-while/Ring/loops-do-while.ring create mode 100644 Task/Loops-Do-while/Sidef/loops-do-while.sidef create mode 100644 Task/Loops-Do-while/Sparkling/loops-do-while.sparkling create mode 100644 Task/Loops-Do-while/Swift/loops-do-while-1.swift create mode 100644 Task/Loops-Do-while/Swift/loops-do-while-2.swift create mode 100644 Task/Loops-Do-while/jq/loops-do-while-1.jq create mode 100644 Task/Loops-Do-while/jq/loops-do-while-2.jq create mode 100644 Task/Loops-Downward-for/Axe/loops-downward-for.axe create mode 100644 Task/Loops-Downward-for/Ceylon/loops-downward-for.ceylon create mode 100644 Task/Loops-Downward-for/ERRE/loops-downward-for.erre create mode 100644 Task/Loops-Downward-for/EchoLisp/loops-downward-for.echolisp create mode 100644 Task/Loops-Downward-for/FreeBASIC/loops-downward-for.freebasic create mode 100644 Task/Loops-Downward-for/FutureBasic/loops-downward-for.futurebasic create mode 100644 Task/Loops-Downward-for/Harbour/loops-downward-for.harbour create mode 100644 Task/Loops-Downward-for/Lasso/loops-downward-for.lasso create mode 100644 Task/Loops-Downward-for/Lingo/loops-downward-for.lingo create mode 100644 Task/Loops-Downward-for/LiveCode/loops-downward-for-1.livecode create mode 100644 Task/Loops-Downward-for/LiveCode/loops-downward-for-2.livecode create mode 100644 Task/Loops-Downward-for/Nim/loops-downward-for.nim create mode 100644 Task/Loops-Downward-for/Oforth/loops-downward-for.oforth create mode 100644 Task/Loops-Downward-for/Peloton/loops-downward-for-1.peloton create mode 100644 Task/Loops-Downward-for/Peloton/loops-downward-for-2.peloton create mode 100644 Task/Loops-Downward-for/Phix/loops-downward-for.phix create mode 100644 Task/Loops-Downward-for/Ring/loops-downward-for.ring create mode 100644 Task/Loops-Downward-for/SSEM/loops-downward-for.ssem create mode 100644 Task/Loops-Downward-for/Sidef/loops-downward-for-1.sidef create mode 100644 Task/Loops-Downward-for/Sidef/loops-downward-for-2.sidef create mode 100644 Task/Loops-Downward-for/Sidef/loops-downward-for-3.sidef create mode 100644 Task/Loops-Downward-for/Sparkling/loops-downward-for.sparkling create mode 100644 Task/Loops-Downward-for/Swift/loops-downward-for-1.swift create mode 100644 Task/Loops-Downward-for/Swift/loops-downward-for-2.swift create mode 100644 Task/Loops-Downward-for/Swift/loops-downward-for-3.swift create mode 100644 Task/Loops-Downward-for/Swift/loops-downward-for-4.swift create mode 100644 Task/Loops-Downward-for/Swift/loops-downward-for-5.swift create mode 100644 Task/Loops-Downward-for/Ursa/loops-downward-for.ursa create mode 100644 Task/Loops-Downward-for/Wart/loops-downward-for.wart create mode 100644 Task/Loops-Downward-for/jq/loops-downward-for.jq create mode 100644 Task/Loops-For-with-a-specified-step/Axe/loops-for-with-a-specified-step.axe create mode 100644 Task/Loops-For-with-a-specified-step/Ceylon/loops-for-with-a-specified-step.ceylon create mode 100644 Task/Loops-For-with-a-specified-step/ChucK/loops-for-with-a-specified-step-1.chuck create mode 100644 Task/Loops-For-with-a-specified-step/ChucK/loops-for-with-a-specified-step-2.chuck create mode 100644 Task/Loops-For-with-a-specified-step/ERRE/loops-for-with-a-specified-step.erre create mode 100644 Task/Loops-For-with-a-specified-step/EchoLisp/loops-for-with-a-specified-step.echolisp create mode 100644 Task/Loops-For-with-a-specified-step/FOCAL/loops-for-with-a-specified-step.focal create mode 100644 Task/Loops-For-with-a-specified-step/FreeBASIC/loops-for-with-a-specified-step.freebasic create mode 100644 Task/Loops-For-with-a-specified-step/FutureBasic/loops-for-with-a-specified-step.futurebasic create mode 100644 Task/Loops-For-with-a-specified-step/Lasso/loops-for-with-a-specified-step.lasso create mode 100644 Task/Loops-For-with-a-specified-step/Lingo/loops-for-with-a-specified-step.lingo create mode 100644 Task/Loops-For-with-a-specified-step/LiveCode/loops-for-with-a-specified-step-1.livecode create mode 100644 Task/Loops-For-with-a-specified-step/LiveCode/loops-for-with-a-specified-step-2.livecode create mode 100644 Task/Loops-For-with-a-specified-step/Nim/loops-for-with-a-specified-step.nim create mode 100644 Task/Loops-For-with-a-specified-step/Oforth/loops-for-with-a-specified-step.oforth create mode 100644 Task/Loops-For-with-a-specified-step/Panda/loops-for-with-a-specified-step.panda create mode 100644 Task/Loops-For-with-a-specified-step/Phix/loops-for-with-a-specified-step.phix create mode 100644 Task/Loops-For-with-a-specified-step/Ring/loops-for-with-a-specified-step-1.ring create mode 100644 Task/Loops-For-with-a-specified-step/Ring/loops-for-with-a-specified-step-2.ring create mode 100644 Task/Loops-For-with-a-specified-step/SSEM/loops-for-with-a-specified-step.ssem create mode 100644 Task/Loops-For-with-a-specified-step/Sidef/loops-for-with-a-specified-step-1.sidef create mode 100644 Task/Loops-For-with-a-specified-step/Sidef/loops-for-with-a-specified-step-2.sidef create mode 100644 Task/Loops-For-with-a-specified-step/Sidef/loops-for-with-a-specified-step-3.sidef create mode 100644 Task/Loops-For-with-a-specified-step/Swift/loops-for-with-a-specified-step-1.swift create mode 100644 Task/Loops-For-with-a-specified-step/Swift/loops-for-with-a-specified-step-2.swift create mode 100644 Task/Loops-For-with-a-specified-step/Ursa/loops-for-with-a-specified-step.ursa create mode 100644 Task/Loops-For-with-a-specified-step/Wart/loops-for-with-a-specified-step.wart create mode 100644 Task/Loops-For-with-a-specified-step/jq/loops-for-with-a-specified-step-1.jq create mode 100644 Task/Loops-For-with-a-specified-step/jq/loops-for-with-a-specified-step-2.jq create mode 100644 Task/Loops-For/8th/loops-for.8th create mode 100644 Task/Loops-For/Apex/loops-for.apex create mode 100644 Task/Loops-For/Axe/loops-for.axe create mode 100644 Task/Loops-For/Ceylon/loops-for.ceylon create mode 100644 Task/Loops-For/EDSAC-order-code/loops-for.edsac create mode 100644 Task/Loops-For/ERRE/loops-for.erre create mode 100644 Task/Loops-For/FOCAL/loops-for.focal create mode 100644 Task/Loops-For/FreeBASIC/loops-for.freebasic create mode 100644 Task/Loops-For/Futhark/loops-for.futhark create mode 100644 Task/Loops-For/Hack/loops-for.hack create mode 100644 Task/Loops-For/LC3-Assembly/loops-for.lc3 create mode 100644 Task/Loops-For/Lasso/loops-for.lasso create mode 100644 Task/Loops-For/Lingo/loops-for.lingo create mode 100644 Task/Loops-For/LiveCode/loops-for.livecode create mode 100644 Task/Loops-For/Morfa/loops-for.morfa create mode 100644 Task/Loops-For/Nim/loops-for.nim create mode 100644 Task/Loops-For/Oforth/loops-for.oforth create mode 100644 Task/Loops-For/Phix/loops-for.phix create mode 100644 Task/Loops-For/Ring/loops-for-1.ring create mode 100644 Task/Loops-For/Ring/loops-for-2.ring create mode 100644 Task/Loops-For/Sidef/loops-for-1.sidef create mode 100644 Task/Loops-For/Sidef/loops-for-2.sidef create mode 100644 Task/Loops-For/Sidef/loops-for-3.sidef create mode 100644 Task/Loops-For/Sidef/loops-for-4.sidef create mode 100644 Task/Loops-For/Sparkling/loops-for.sparkling create mode 100644 Task/Loops-For/Swift/loops-for-1.swift create mode 100644 Task/Loops-For/Swift/loops-for-2.swift create mode 100644 Task/Loops-For/Swift/loops-for-3.swift create mode 100644 Task/Loops-For/TypeScript/loops-for.type create mode 100644 Task/Loops-For/Ursa/loops-for.ursa create mode 100644 Task/Loops-For/Wart/loops-for.wart create mode 100644 Task/Loops-For/XLISP/loops-for.xlisp create mode 100644 Task/Loops-For/jq/loops-for.jq create mode 100644 Task/Loops-Foreach/Apex/loops-foreach.apex create mode 100644 Task/Loops-Foreach/ERRE/loops-foreach.erre create mode 100644 Task/Loops-Foreach/EchoLisp/loops-foreach.echolisp create mode 100644 Task/Loops-Foreach/FreeBASIC/loops-foreach.freebasic create mode 100644 Task/Loops-Foreach/LFE/loops-foreach.lfe create mode 100644 Task/Loops-Foreach/Lasso/loops-foreach-1.lasso create mode 100644 Task/Loops-Foreach/Lasso/loops-foreach-2.lasso create mode 100644 Task/Loops-Foreach/Lingo/loops-foreach-1.lingo create mode 100644 Task/Loops-Foreach/Lingo/loops-foreach-2.lingo create mode 100644 Task/Loops-Foreach/Lingo/loops-foreach-3.lingo create mode 100644 Task/Loops-Foreach/LiveCode/loops-foreach.livecode create mode 100644 Task/Loops-Foreach/Nim/loops-foreach.nim create mode 100644 Task/Loops-Foreach/Oforth/loops-foreach-1.oforth create mode 100644 Task/Loops-Foreach/Oforth/loops-foreach-2.oforth create mode 100644 Task/Loops-Foreach/PHL/loops-foreach.phl create mode 100644 Task/Loops-Foreach/Phix/loops-foreach.phix create mode 100644 Task/Loops-Foreach/Ring/loops-foreach.ring create mode 100644 Task/Loops-Foreach/Sidef/loops-foreach-1.sidef create mode 100644 Task/Loops-Foreach/Sidef/loops-foreach-2.sidef create mode 100644 Task/Loops-Foreach/Sidef/loops-foreach-3.sidef create mode 100644 Task/Loops-Foreach/Sparkling/loops-foreach.sparkling create mode 100644 Task/Loops-Foreach/Swift/loops-foreach-1.swift create mode 100644 Task/Loops-Foreach/Swift/loops-foreach-2.swift create mode 100644 Task/Loops-Foreach/Wart/loops-foreach.wart create mode 100644 Task/Loops-Foreach/XLISP/loops-foreach.xlisp create mode 100644 Task/Loops-Foreach/jq/loops-foreach-1.jq create mode 100644 Task/Loops-Foreach/jq/loops-foreach-2.jq create mode 100644 Task/Loops-Foreach/jq/loops-foreach-3.jq create mode 100644 Task/Loops-Foreach/jq/loops-foreach-4.jq create mode 100644 Task/Loops-Foreach/jq/loops-foreach-5.jq create mode 100644 Task/Loops-Foreach/jq/loops-foreach-6.jq create mode 100644 Task/Loops-Infinite/8th/loops-infinite-1.8th create mode 100644 Task/Loops-Infinite/8th/loops-infinite-2.8th create mode 100644 Task/Loops-Infinite/Axe/loops-infinite.axe create mode 100644 Task/Loops-Infinite/ChucK/loops-infinite.chuck create mode 100644 Task/Loops-Infinite/Comal/loops-infinite.comal create mode 100644 Task/Loops-Infinite/ERRE/loops-infinite.erre create mode 100644 Task/Loops-Infinite/FreeBASIC/loops-infinite.freebasic create mode 100644 Task/Loops-Infinite/FutureBasic/loops-infinite.futurebasic create mode 100644 Task/Loops-Infinite/Lasso/loops-infinite.lasso create mode 100644 Task/Loops-Infinite/Lily/loops-infinite.lily create mode 100644 Task/Loops-Infinite/Lingo/loops-infinite.lingo create mode 100644 Task/Loops-Infinite/LiveCode/loops-infinite.livecode create mode 100644 Task/Loops-Infinite/Monte/loops-infinite.monte create mode 100644 Task/Loops-Infinite/Nim/loops-infinite.nim create mode 100644 Task/Loops-Infinite/Oforth/loops-infinite.oforth create mode 100644 Task/Loops-Infinite/Phix/loops-infinite.phix create mode 100644 Task/Loops-Infinite/Ring/loops-infinite.ring create mode 100644 Task/Loops-Infinite/Sidef/loops-infinite.sidef create mode 100644 Task/Loops-Infinite/Sparkling/loops-infinite-1.sparkling create mode 100644 Task/Loops-Infinite/Sparkling/loops-infinite-2.sparkling create mode 100644 Task/Loops-Infinite/Sparkling/loops-infinite-3.sparkling create mode 100644 Task/Loops-Infinite/Swift/loops-infinite.swift create mode 100644 Task/Loops-Infinite/Ursa/loops-infinite.ursa create mode 100644 Task/Loops-Infinite/Wart/loops-infinite.wart create mode 100644 Task/Loops-Infinite/jq/loops-infinite.jq create mode 100644 Task/Loops-N-plus-one-half/Axe/loops-n-plus-one-half.axe create mode 100644 Task/Loops-N-plus-one-half/ERRE/loops-n-plus-one-half.erre create mode 100644 Task/Loops-N-plus-one-half/EchoLisp/loops-n-plus-one-half.echolisp create mode 100644 Task/Loops-N-plus-one-half/FreeBASIC/loops-n-plus-one-half.freebasic create mode 100644 Task/Loops-N-plus-one-half/FutureBasic/loops-n-plus-one-half.futurebasic create mode 100644 Task/Loops-N-plus-one-half/Lasso/loops-n-plus-one-half.lasso create mode 100644 Task/Loops-N-plus-one-half/LiveCode/loops-n-plus-one-half.livecode create mode 100644 Task/Loops-N-plus-one-half/Nim/loops-n-plus-one-half.nim create mode 100644 Task/Loops-N-plus-one-half/Oforth/loops-n-plus-one-half.oforth create mode 100644 Task/Loops-N-plus-one-half/Panda/loops-n-plus-one-half.panda create mode 100644 Task/Loops-N-plus-one-half/Peloton/loops-n-plus-one-half.peloton create mode 100644 Task/Loops-N-plus-one-half/Phix/loops-n-plus-one-half.phix create mode 100644 Task/Loops-N-plus-one-half/Ring/loops-n-plus-one-half.ring create mode 100644 Task/Loops-N-plus-one-half/Sidef/loops-n-plus-one-half.sidef create mode 100644 Task/Loops-N-plus-one-half/Swift/loops-n-plus-one-half-1.swift create mode 100644 Task/Loops-N-plus-one-half/Swift/loops-n-plus-one-half-2.swift create mode 100644 Task/Loops-N-plus-one-half/Swift/loops-n-plus-one-half-3.swift create mode 100644 Task/Loops-N-plus-one-half/Ursa/loops-n-plus-one-half.ursa create mode 100644 Task/Loops-N-plus-one-half/Wart/loops-n-plus-one-half.wart create mode 100644 Task/Loops-N-plus-one-half/jq/loops-n-plus-one-half.jq create mode 100644 Task/Loops-Nested/ERRE/loops-nested.erre create mode 100644 Task/Loops-Nested/EchoLisp/loops-nested.echolisp create mode 100644 Task/Loops-Nested/FreeBASIC/loops-nested.freebasic create mode 100644 Task/Loops-Nested/Lasso/loops-nested.lasso create mode 100644 Task/Loops-Nested/Lingo/loops-nested.lingo create mode 100644 Task/Loops-Nested/LiveCode/loops-nested.livecode create mode 100644 Task/Loops-Nested/Nim/loops-nested.nim create mode 100644 Task/Loops-Nested/Phix/loops-nested-1.phix create mode 100644 Task/Loops-Nested/Phix/loops-nested-2.phix create mode 100644 Task/Loops-Nested/Phix/loops-nested-3.phix create mode 100644 Task/Loops-Nested/Ring/loops-nested.ring create mode 100644 Task/Loops-Nested/Sidef/loops-nested.sidef create mode 100644 Task/Loops-Nested/Swift/loops-nested.swift create mode 100644 Task/Loops-While/Axe/loops-while.axe create mode 100644 Task/Loops-While/ChucK/loops-while.chuck create mode 100644 Task/Loops-While/ERRE/loops-while.erre create mode 100644 Task/Loops-While/EchoLisp/loops-while.echolisp create mode 100644 Task/Loops-While/FreeBASIC/loops-while.freebasic create mode 100644 Task/Loops-While/FutureBasic/loops-while.futurebasic create mode 100644 Task/Loops-While/Lasso/loops-while.lasso create mode 100644 Task/Loops-While/Lingo/loops-while.lingo create mode 100644 Task/Loops-While/LiveCode/loops-while.livecode create mode 100644 Task/Loops-While/Monte/loops-while.monte create mode 100644 Task/Loops-While/Morfa/loops-while.morfa create mode 100644 Task/Loops-While/Nim/loops-while.nim create mode 100644 Task/Loops-While/Oforth/loops-while.oforth create mode 100644 Task/Loops-While/PHL/loops-while.phl create mode 100644 Task/Loops-While/Panda/loops-while.panda create mode 100644 Task/Loops-While/PeopleCode/loops-while.peoplecode create mode 100644 Task/Loops-While/Phix/loops-while.phix create mode 100644 Task/Loops-While/Ring/loops-while.ring create mode 100644 Task/Loops-While/Sidef/loops-while.sidef create mode 100644 Task/Loops-While/Sparkling/loops-while.sparkling create mode 100644 Task/Loops-While/Swift/loops-while.swift create mode 100644 Task/Loops-While/Uniface/loops-while.uniface create mode 100644 Task/Loops-While/Ursa/loops-while.ursa create mode 100644 Task/Loops-While/Wart/loops-while.wart create mode 100644 Task/Loops-While/XLISP/loops-while.xlisp create mode 100644 Task/Loops-While/jq/loops-while-1.jq create mode 100644 Task/Loops-While/jq/loops-while-2.jq create mode 100644 Task/Loops-While/jq/loops-while-3.jq create mode 100644 Task/Loops-While/jq/loops-while-4.jq create mode 100644 Task/Loops-While/jq/loops-while-5.jq create mode 100644 Task/Lucas-Lehmer-test/ERRE/lucas-lehmer-test.erre create mode 100644 Task/Lucas-Lehmer-test/EchoLisp/lucas-lehmer-test.echolisp create mode 100644 Task/Lucas-Lehmer-test/FreeBASIC/lucas-lehmer-test-1.freebasic create mode 100644 Task/Lucas-Lehmer-test/FreeBASIC/lucas-lehmer-test-2.freebasic create mode 100644 Task/Lucas-Lehmer-test/FunL/lucas-lehmer-test.funl create mode 100644 Task/Lucas-Lehmer-test/Nim/lucas-lehmer-test.nim create mode 100644 Task/Lucas-Lehmer-test/RPL/lucas-lehmer-test.rpl create mode 100644 Task/Lucas-Lehmer-test/Ring/lucas-lehmer-test.ring create mode 100644 Task/Lucas-Lehmer-test/Sidef/lucas-lehmer-test.sidef create mode 100644 Task/Ludic-numbers/FreeBASIC/ludic-numbers.freebasic create mode 100644 Task/Ludic-numbers/Oforth/ludic-numbers.oforth create mode 100644 Task/Ludic-numbers/Sidef/ludic-numbers.sidef create mode 100644 Task/Luhn-test-of-credit-card-numbers/Ceylon/luhn-test-of-credit-card-numbers.ceylon create mode 100644 Task/Luhn-test-of-credit-card-numbers/EchoLisp/luhn-test-of-credit-card-numbers.echolisp create mode 100644 Task/Luhn-test-of-credit-card-numbers/FreeBASIC/luhn-test-of-credit-card-numbers.freebasic create mode 100644 Task/Luhn-test-of-credit-card-numbers/FunL/luhn-test-of-credit-card-numbers.funl create mode 100644 Task/Luhn-test-of-credit-card-numbers/Lasso/luhn-test-of-credit-card-numbers.lasso create mode 100644 Task/Luhn-test-of-credit-card-numbers/LiveCode/luhn-test-of-credit-card-numbers.livecode create mode 100644 Task/Luhn-test-of-credit-card-numbers/Nim/luhn-test-of-credit-card-numbers.nim create mode 100644 Task/Luhn-test-of-credit-card-numbers/Oforth/luhn-test-of-credit-card-numbers.oforth create mode 100644 Task/Luhn-test-of-credit-card-numbers/Phix/luhn-test-of-credit-card-numbers.phix create mode 100644 Task/Luhn-test-of-credit-card-numbers/Ring/luhn-test-of-credit-card-numbers.ring create mode 100644 Task/Luhn-test-of-credit-card-numbers/Sidef/luhn-test-of-credit-card-numbers.sidef create mode 100644 Task/Luhn-test-of-credit-card-numbers/Swift/luhn-test-of-credit-card-numbers.swift create mode 100644 Task/Luhn-test-of-credit-card-numbers/Xojo/luhn-test-of-credit-card-numbers.xojo create mode 100644 Task/Luhn-test-of-credit-card-numbers/jq/luhn-test-of-credit-card-numbers-1.jq create mode 100644 Task/Luhn-test-of-credit-card-numbers/jq/luhn-test-of-credit-card-numbers-2.jq create mode 100644 Task/MD4/FreeBASIC/md4.freebasic create mode 100644 Task/MD4/Lasso/md4.lasso create mode 100644 Task/MD4/Nim/md4.nim create mode 100644 Task/MD4/Sidef/md4.sidef create mode 100644 Task/MD5-Implementation/FreeBASIC/md5-implementation.freebasic create mode 100644 Task/MD5-Implementation/Phix/md5-implementation.phix create mode 100644 Task/MD5-Implementation/Sidef/md5-implementation.sidef create mode 100644 Task/MD5-Implementation/Swift/md5-implementation-1.swift create mode 100644 Task/MD5-Implementation/Swift/md5-implementation-2.swift create mode 100644 Task/MD5/8th/md5.8th create mode 100644 Task/MD5/Futhark/md5.futhark create mode 100644 Task/MD5/Lasso/md5-1.lasso create mode 100644 Task/MD5/Lasso/md5-2.lasso create mode 100644 Task/MD5/Lingo/md5-1.lingo create mode 100644 Task/MD5/Lingo/md5-2.lingo create mode 100644 Task/MD5/LiveCode/md5-1.livecode create mode 100644 Task/MD5/LiveCode/md5-2.livecode create mode 100644 Task/MD5/Nim/md5.nim create mode 100644 Task/MD5/Ring/md5.ring create mode 100644 Task/MD5/Sidef/md5-1.sidef create mode 100644 Task/MD5/Sidef/md5-2.sidef create mode 100644 Task/Machine-code/Nim/machine-code.nim create mode 100644 Task/Machine-code/Phix/machine-code-1.phix create mode 100644 Task/Machine-code/Phix/machine-code-2.phix create mode 100644 Task/Mad-Libs/Nim/mad-libs.nim create mode 100644 Task/Mad-Libs/Oforth/mad-libs.oforth create mode 100644 Task/Mad-Libs/Ring/mad-libs.ring create mode 100644 Task/Mad-Libs/Sidef/mad-libs.sidef create mode 100644 Task/Magic-squares-of-odd-order/ERRE/magic-squares-of-odd-order.erre create mode 100644 Task/Magic-squares-of-odd-order/EchoLisp/magic-squares-of-odd-order.echolisp create mode 100644 Task/Magic-squares-of-odd-order/FreeBASIC/magic-squares-of-odd-order.freebasic create mode 100644 Task/Magic-squares-of-odd-order/Nim/magic-squares-of-odd-order.nim create mode 100644 Task/Magic-squares-of-odd-order/Oforth/magic-squares-of-odd-order.oforth create mode 100644 Task/Magic-squares-of-odd-order/Ring/magic-squares-of-odd-order.ring create mode 100644 Task/Magic-squares-of-odd-order/Sidef/magic-squares-of-odd-order.sidef create mode 100644 Task/Magic-squares-of-odd-order/jq/magic-squares-of-odd-order-1.jq create mode 100644 Task/Magic-squares-of-odd-order/jq/magic-squares-of-odd-order-2.jq create mode 100644 Task/Magic-squares-of-odd-order/jq/magic-squares-of-odd-order-3.jq create mode 100644 Task/Main-step-of-GOST-28147-89/Nim/main-step-of-gost-28147-89.nim create mode 100644 Task/Make-directory-path/ERRE/make-directory-path.erre create mode 100644 Task/Make-directory-path/Ring/make-directory-path.ring create mode 100644 Task/Make-directory-path/Sidef/make-directory-path.sidef create mode 100644 Task/Man-or-boy-test/Crystal/man-or-boy-test.crystal create mode 100644 Task/Man-or-boy-test/EchoLisp/man-or-boy-test.echolisp create mode 100644 Task/Man-or-boy-test/Nim/man-or-boy-test.nim create mode 100644 Task/Man-or-boy-test/Sidef/man-or-boy-test-1.sidef create mode 100644 Task/Man-or-boy-test/Sidef/man-or-boy-test-2.sidef create mode 100644 Task/Man-or-boy-test/Sidef/man-or-boy-test-3.sidef create mode 100644 Task/Man-or-boy-test/Sparkling/man-or-boy-test.sparkling create mode 100644 Task/Man-or-boy-test/Swift/man-or-boy-test-1.swift create mode 100644 Task/Man-or-boy-test/Swift/man-or-boy-test-2.swift create mode 100644 Task/Mandelbrot-set/ERRE/mandelbrot-set.erre create mode 100644 Task/Mandelbrot-set/EchoLisp/mandelbrot-set.echolisp create mode 100644 Task/Mandelbrot-set/Futhark/mandelbrot-set.futhark create mode 100644 Task/Mandelbrot-set/GLSL/mandelbrot-set.glsl create mode 100644 Task/Mandelbrot-set/Lasso/mandelbrot-set.lasso create mode 100644 Task/Mandelbrot-set/Nim/mandelbrot-set.nim create mode 100644 Task/Mandelbrot-set/Phix/mandelbrot-set-1.phix create mode 100644 Task/Mandelbrot-set/Phix/mandelbrot-set-2.phix create mode 100644 Task/Mandelbrot-set/Ring/mandelbrot-set.ring create mode 100644 Task/Mandelbrot-set/SequenceL/mandelbrot-set-1.sequencel create mode 100644 Task/Mandelbrot-set/SequenceL/mandelbrot-set-2.sequencel create mode 100644 Task/Mandelbrot-set/Sidef/mandelbrot-set.sidef create mode 100644 Task/Mandelbrot-set/jq/mandelbrot-set-1.jq create mode 100644 Task/Mandelbrot-set/jq/mandelbrot-set-2.jq create mode 100644 Task/Mandelbrot-set/jq/mandelbrot-set-3.jq create mode 100644 Task/Map-range/ERRE/map-range.erre create mode 100644 Task/Map-range/EchoLisp/map-range.echolisp create mode 100644 Task/Map-range/Lasso/map-range.lasso create mode 100644 Task/Map-range/Nim/map-range.nim create mode 100644 Task/Map-range/Oforth/map-range.oforth create mode 100644 Task/Map-range/Phix/map-range.phix create mode 100644 Task/Map-range/Sidef/map-range.sidef create mode 100644 Task/Map-range/jq/map-range-1.jq create mode 100644 Task/Map-range/jq/map-range-2.jq create mode 100644 Task/Map-range/jq/map-range-3.jq create mode 100644 Task/Matrix-arithmetic/EchoLisp/matrix-arithmetic.echolisp create mode 100644 Task/Matrix-arithmetic/FunL/matrix-arithmetic-1.funl create mode 100644 Task/Matrix-arithmetic/FunL/matrix-arithmetic-2.funl create mode 100644 Task/Matrix-arithmetic/FunL/matrix-arithmetic-3.funl create mode 100644 Task/Matrix-arithmetic/Nim/matrix-arithmetic.nim create mode 100644 Task/Matrix-arithmetic/SPAD/matrix-arithmetic.spad create mode 100644 Task/Matrix-arithmetic/jq/matrix-arithmetic-1.jq create mode 100644 Task/Matrix-arithmetic/jq/matrix-arithmetic-2.jq create mode 100644 Task/Matrix-arithmetic/jq/matrix-arithmetic-3.jq create mode 100644 Task/Matrix-arithmetic/jq/matrix-arithmetic-4.jq create mode 100644 Task/Matrix-arithmetic/jq/matrix-arithmetic-5.jq create mode 100644 Task/Matrix-exponentiation-operator/ERRE/matrix-exponentiation-operator.erre create mode 100644 Task/Matrix-exponentiation-operator/SPAD/matrix-exponentiation-operator.spad create mode 100644 Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-1.jq create mode 100644 Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-2.jq create mode 100644 Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-3.jq create mode 100644 Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-4.jq create mode 100644 Task/Matrix-multiplication/ERRE/matrix-multiplication.erre create mode 100644 Task/Matrix-multiplication/Futhark/matrix-multiplication.futhark create mode 100644 Task/Matrix-multiplication/Idris/matrix-multiplication.idris create mode 100644 Task/Matrix-multiplication/LFE/matrix-multiplication-1.lfe create mode 100644 Task/Matrix-multiplication/LFE/matrix-multiplication-2.lfe create mode 100644 Task/Matrix-multiplication/Nim/matrix-multiplication.nim create mode 100644 Task/Matrix-multiplication/Phix/matrix-multiplication.phix create mode 100644 Task/Matrix-multiplication/Ring/matrix-multiplication.ring create mode 100644 Task/Matrix-multiplication/SPAD/matrix-multiplication.spad create mode 100644 Task/Matrix-multiplication/SequenceL/matrix-multiplication-1.sequencel create mode 100644 Task/Matrix-multiplication/SequenceL/matrix-multiplication-2.sequencel create mode 100644 Task/Matrix-multiplication/Sidef/matrix-multiplication.sidef create mode 100644 Task/Matrix-multiplication/Visual-FoxPro/matrix-multiplication.visual create mode 100644 Task/Matrix-multiplication/jq/matrix-multiplication.jq create mode 100644 Task/Matrix-transposition/EchoLisp/matrix-transposition.echolisp create mode 100644 Task/Matrix-transposition/Idris/matrix-transposition.idris create mode 100644 Task/Matrix-transposition/LFE/matrix-transposition-1.lfe create mode 100644 Task/Matrix-transposition/LFE/matrix-transposition-2.lfe create mode 100644 Task/Matrix-transposition/Nim/matrix-transposition-1.nim create mode 100644 Task/Matrix-transposition/Nim/matrix-transposition-2.nim create mode 100644 Task/Matrix-transposition/Phix/matrix-transposition.phix create mode 100644 Task/Matrix-transposition/Ring/matrix-transposition.ring create mode 100644 Task/Matrix-transposition/SPAD/matrix-transposition.spad create mode 100644 Task/Matrix-transposition/Sidef/matrix-transposition.sidef create mode 100644 Task/Matrix-transposition/Sparkling/matrix-transposition.sparkling create mode 100644 Task/Matrix-transposition/Wortel/matrix-transposition.wortel create mode 100644 Task/Matrix-transposition/jq/matrix-transposition.jq create mode 100644 Task/Maximum-triangle-path-sum/ERRE/maximum-triangle-path-sum.erre create mode 100644 Task/Maximum-triangle-path-sum/FreeBASIC/maximum-triangle-path-sum.freebasic create mode 100644 Task/Maximum-triangle-path-sum/Nim/maximum-triangle-path-sum.nim create mode 100644 Task/Maximum-triangle-path-sum/Sidef/maximum-triangle-path-sum-1.sidef create mode 100644 Task/Maximum-triangle-path-sum/Sidef/maximum-triangle-path-sum-2.sidef create mode 100644 Task/Maximum-triangle-path-sum/jq/maximum-triangle-path-sum.jq create mode 100644 Task/Maze-generation/Elm/maze-generation.elm create mode 100644 Task/Maze-generation/FreeBASIC/maze-generation.freebasic create mode 100644 Task/Maze-generation/Nim/maze-generation.nim create mode 100644 Task/Maze-generation/Sidef/maze-generation.sidef create mode 100644 Task/Maze-generation/Swift/maze-generation.swift create mode 100644 Task/Memory-allocation/Axe/memory-allocation.axe create mode 100644 Task/Memory-allocation/Lingo/memory-allocation.lingo create mode 100644 Task/Memory-allocation/Nim/memory-allocation.nim create mode 100644 Task/Memory-allocation/Phix/memory-allocation.phix create mode 100644 Task/Memory-allocation/Ring/memory-allocation.ring create mode 100644 Task/Memory-layout-of-a-data-structure/FreeBASIC/memory-layout-of-a-data-structure.freebasic create mode 100644 Task/Memory-layout-of-a-data-structure/Nim/memory-layout-of-a-data-structure.nim create mode 100644 Task/Menu/Axe/menu.axe create mode 100644 Task/Menu/Ceylon/menu.ceylon create mode 100644 Task/Menu/ERRE/menu.erre create mode 100644 Task/Menu/Nim/menu.nim create mode 100644 Task/Menu/Phix/menu.phix create mode 100644 Task/Menu/Ring/menu.ring create mode 100644 Task/Menu/Sidef/menu.sidef create mode 100644 Task/Menu/Ursa/menu.ursa create mode 100644 Task/Menu/jq/menu-1.jq create mode 100644 Task/Menu/jq/menu-2.jq create mode 100644 Task/Menu/jq/menu-3.jq create mode 100644 Task/Metaprogramming/FreeBASIC/metaprogramming.freebasic create mode 100644 Task/Metaprogramming/Lingo/metaprogramming.lingo create mode 100644 Task/Metaprogramming/Nim/metaprogramming-1.nim create mode 100644 Task/Metaprogramming/Nim/metaprogramming-2.nim create mode 100644 Task/Metaprogramming/Nim/metaprogramming-3.nim create mode 100644 Task/Metaprogramming/Nim/metaprogramming-4.nim create mode 100644 Task/Metaprogramming/Nim/metaprogramming-5.nim create mode 100644 Task/Metaprogramming/Nim/metaprogramming-6.nim create mode 100644 Task/Metaprogramming/Nim/metaprogramming-7.nim create mode 100644 Task/Metaprogramming/Nim/metaprogramming-8.nim create mode 100644 Task/Metaprogramming/Nim/metaprogramming-9.nim create mode 100644 Task/Metaprogramming/Ring/metaprogramming-1.ring create mode 100644 Task/Metaprogramming/Ring/metaprogramming-2.ring create mode 100644 Task/Metaprogramming/Shen/metaprogramming-1.shen create mode 100644 Task/Metaprogramming/Shen/metaprogramming-2.shen create mode 100644 Task/Metaprogramming/Shen/metaprogramming-3.shen create mode 100644 Task/Metaprogramming/Sidef/metaprogramming-1.sidef create mode 100644 Task/Metaprogramming/Sidef/metaprogramming-2.sidef create mode 100644 Task/Metered-concurrency/EchoLisp/metered-concurrency.echolisp create mode 100644 Task/Metered-concurrency/Oforth/metered-concurrency-1.oforth create mode 100644 Task/Metered-concurrency/Oforth/metered-concurrency-2.oforth create mode 100644 Task/Metronome/EchoLisp/metronome.echolisp create mode 100644 Task/Middle-three-digits/ERRE/middle-three-digits.erre create mode 100644 Task/Middle-three-digits/FreeBASIC/middle-three-digits.freebasic create mode 100644 Task/Middle-three-digits/Klong/middle-three-digits.klong create mode 100644 Task/Middle-three-digits/Lasso/middle-three-digits.lasso create mode 100644 Task/Middle-three-digits/Nim/middle-three-digits.nim create mode 100644 Task/Middle-three-digits/Oforth/middle-three-digits.oforth create mode 100644 Task/Middle-three-digits/Ring/middle-three-digits.ring create mode 100644 Task/Middle-three-digits/Sidef/middle-three-digits.sidef create mode 100644 Task/Middle-three-digits/Wart/middle-three-digits.wart create mode 100644 Task/Middle-three-digits/jq/middle-three-digits-1.jq create mode 100644 Task/Middle-three-digits/jq/middle-three-digits-2.jq create mode 100644 Task/Modular-exponentiation/EchoLisp/modular-exponentiation.echolisp create mode 100644 Task/Modular-exponentiation/Nim/modular-exponentiation.nim create mode 100644 Task/Modular-exponentiation/Oforth/modular-exponentiation.oforth create mode 100644 Task/Modular-exponentiation/Sidef/modular-exponentiation-1.sidef create mode 100644 Task/Modular-exponentiation/Sidef/modular-exponentiation-2.sidef create mode 100644 Task/Modular-inverse/8th/modular-inverse.8th create mode 100644 Task/Modular-inverse/ERRE/modular-inverse.erre create mode 100644 Task/Modular-inverse/EchoLisp/modular-inverse.echolisp create mode 100644 Task/Modular-inverse/FunL/modular-inverse.funl create mode 100644 Task/Modular-inverse/Nim/modular-inverse.nim create mode 100644 Task/Modular-inverse/Oforth/modular-inverse.oforth create mode 100644 Task/Modular-inverse/Ring/modular-inverse.ring create mode 100644 Task/Modular-inverse/Sidef/modular-inverse-1.sidef create mode 100644 Task/Modular-inverse/Sidef/modular-inverse-2.sidef create mode 100644 Task/Monte-Carlo-methods/ERRE/monte-carlo-methods.erre create mode 100644 Task/Monte-Carlo-methods/FreeBASIC/monte-carlo-methods.freebasic create mode 100644 Task/Monte-Carlo-methods/Futhark/monte-carlo-methods.futhark create mode 100644 Task/Monte-Carlo-methods/Nim/monte-carlo-methods.nim create mode 100644 Task/Monte-Carlo-methods/Ring/monte-carlo-methods.ring create mode 100644 Task/Monte-Carlo-methods/Swift/monte-carlo-methods.swift create mode 100644 Task/Monty-Hall-problem/Nim/monty-hall-problem.nim create mode 100644 Task/Monty-Hall-problem/Phix/monty-hall-problem.phix create mode 100644 Task/Monty-Hall-problem/SPAD/monty-hall-problem.spad create mode 100644 Task/Monty-Hall-problem/Sidef/monty-hall-problem.sidef create mode 100644 Task/Morse-code/EchoLisp/morse-code.echolisp create mode 100644 Task/Morse-code/FreeBASIC/morse-code.freebasic create mode 100644 Task/Morse-code/Phix/morse-code.phix create mode 100644 Task/Morse-code/Ursa/morse-code.ursa create mode 100644 Task/Mouse-position/ERRE/mouse-position.erre create mode 100644 Task/Mouse-position/EchoLisp/mouse-position.echolisp create mode 100644 Task/Mouse-position/Elm/mouse-position.elm create mode 100644 Task/Mouse-position/Lingo/mouse-position.lingo create mode 100644 Task/Mouse-position/Ring/mouse-position.ring create mode 100644 Task/Move-to-front-algorithm/Sidef/move-to-front-algorithm-1.sidef create mode 100644 Task/Move-to-front-algorithm/Sidef/move-to-front-algorithm-2.sidef create mode 100644 Task/Move-to-front-algorithm/jq/move-to-front-algorithm-1.jq create mode 100644 Task/Move-to-front-algorithm/jq/move-to-front-algorithm-2.jq create mode 100644 Task/Move-to-front-algorithm/jq/move-to-front-algorithm-3.jq create mode 100644 Task/Multifactorial/ERRE/multifactorial.erre create mode 100644 Task/Multifactorial/FreeBASIC/multifactorial.freebasic create mode 100644 Task/Multifactorial/FunL/multifactorial.funl create mode 100644 Task/Multifactorial/Nim/multifactorial.nim create mode 100644 Task/Multifactorial/Oforth/multifactorial.oforth create mode 100644 Task/Multifactorial/Ring/multifactorial.ring create mode 100644 Task/Multifactorial/Sidef/multifactorial.sidef create mode 100644 Task/Multifactorial/Wortel/multifactorial.wortel create mode 100644 Task/Multifactorial/jq/multifactorial-1.jq create mode 100644 Task/Multifactorial/jq/multifactorial-2.jq create mode 100644 Task/Multifactorial/jq/multifactorial-3.jq create mode 100644 Task/Multifactorial/jq/multifactorial-4.jq create mode 100644 Task/Multiple-distinct-objects/EchoLisp/multiple-distinct-objects.echolisp create mode 100644 Task/Multiple-distinct-objects/NGS/multiple-distinct-objects-1.ngs create mode 100644 Task/Multiple-distinct-objects/NGS/multiple-distinct-objects-2.ngs create mode 100644 Task/Multiple-distinct-objects/Nim/multiple-distinct-objects-1.nim create mode 100644 Task/Multiple-distinct-objects/Nim/multiple-distinct-objects-2.nim create mode 100644 Task/Multiple-distinct-objects/Nim/multiple-distinct-objects-3.nim create mode 100644 Task/Multiple-distinct-objects/Oforth/multiple-distinct-objects-1.oforth create mode 100644 Task/Multiple-distinct-objects/Oforth/multiple-distinct-objects-2.oforth create mode 100644 Task/Multiple-distinct-objects/Sidef/multiple-distinct-objects-1.sidef create mode 100644 Task/Multiple-distinct-objects/Sidef/multiple-distinct-objects-2.sidef create mode 100644 Task/Multiple-distinct-objects/Swift/multiple-distinct-objects.swift create mode 100644 Task/Multiple-distinct-objects/jq/multiple-distinct-objects.jq create mode 100644 Task/Multiple-regression/ERRE/multiple-regression.erre create mode 100644 Task/Multiple-regression/Hy/multiple-regression.hy create mode 100644 Task/Multiplication-tables/Axe/multiplication-tables.axe create mode 100644 Task/Multiplication-tables/EchoLisp/multiplication-tables.echolisp create mode 100644 Task/Multiplication-tables/FreeBASIC/multiplication-tables.freebasic create mode 100644 Task/Multiplication-tables/Lasso/multiplication-tables.lasso create mode 100644 Task/Multiplication-tables/Nim/multiplication-tables.nim create mode 100644 Task/Multiplication-tables/Phix/multiplication-tables.phix create mode 100644 Task/Multiplication-tables/Ring/multiplication-tables-1.ring create mode 100644 Task/Multiplication-tables/Ring/multiplication-tables-2.ring create mode 100644 Task/Multiplication-tables/Sidef/multiplication-tables.sidef create mode 100644 Task/Multiplicative-order/EchoLisp/multiplicative-order.echolisp create mode 100644 Task/Multisplit/FreeBASIC/multisplit.freebasic create mode 100644 Task/Multisplit/Nim/multisplit.nim create mode 100644 Task/Multisplit/Sidef/multisplit.sidef create mode 100644 Task/Multisplit/jq/multisplit.jq create mode 100644 Task/Munching-squares/EchoLisp/munching-squares.echolisp create mode 100644 Task/Munching-squares/FreeBASIC/munching-squares.freebasic create mode 100644 Task/Munching-squares/GLSL/munching-squares.glsl create mode 100644 Task/Munching-squares/Sidef/munching-squares.sidef create mode 100644 Task/Munching-squares/jq/munching-squares-1.jq create mode 100644 Task/Munching-squares/jq/munching-squares-2.jq create mode 100644 Task/Munching-squares/jq/munching-squares-3.jq create mode 100644 Task/Munching-squares/jq/munching-squares-4.jq create mode 100644 Task/Munching-squares/jq/munching-squares-5.jq create mode 100644 Task/Mutual-recursion/Ceylon/mutual-recursion.ceylon create mode 100644 Task/Mutual-recursion/FreeBASIC/mutual-recursion.freebasic create mode 100644 Task/Mutual-recursion/Idris/mutual-recursion.idris create mode 100644 Task/Mutual-recursion/LibreOffice-Basic/mutual-recursion.libreoffice create mode 100644 Task/Mutual-recursion/Nim/mutual-recursion.nim create mode 100644 Task/Mutual-recursion/Oforth/mutual-recursion.oforth create mode 100644 Task/Mutual-recursion/Phix/mutual-recursion-1.phix create mode 100644 Task/Mutual-recursion/Phix/mutual-recursion-2.phix create mode 100644 Task/Mutual-recursion/Ring/mutual-recursion.ring create mode 100644 Task/Mutual-recursion/Sidef/mutual-recursion.sidef create mode 100644 Task/Mutual-recursion/Swift/mutual-recursion.swift create mode 100644 Task/Mutual-recursion/jq/mutual-recursion-1.jq create mode 100644 Task/Mutual-recursion/jq/mutual-recursion-2.jq create mode 100644 Task/Mutual-recursion/jq/mutual-recursion-3.jq create mode 100644 Task/N-queens-problem/Arc/n-queens-problem.arc create mode 100644 Task/N-queens-problem/ERRE/n-queens-problem.erre create mode 100644 Task/N-queens-problem/EchoLisp/n-queens-problem.echolisp create mode 100644 Task/N-queens-problem/Nim/n-queens-problem.nim create mode 100644 Task/N-queens-problem/Sparkling/n-queens-problem.sparkling create mode 100644 Task/N-queens-problem/jq/n-queens-problem-1.jq create mode 100644 Task/N-queens-problem/jq/n-queens-problem-2.jq create mode 100644 Task/N-queens-problem/jq/n-queens-problem-3.jq create mode 100644 Task/N-queens-problem/jq/n-queens-problem-4.jq create mode 100644 Task/N-queens-problem/jq/n-queens-problem-5.jq create mode 100644 Task/Named-parameters/Lasso/named-parameters.lasso create mode 100644 Task/Named-parameters/Lingo/named-parameters.lingo create mode 100644 Task/Named-parameters/Nim/named-parameters.nim create mode 100644 Task/Named-parameters/Phix/named-parameters.phix create mode 100644 Task/Named-parameters/Sidef/named-parameters.sidef create mode 100644 Task/Named-parameters/Swift/named-parameters-1.swift create mode 100644 Task/Named-parameters/Swift/named-parameters-2.swift create mode 100644 Task/Named-parameters/jq/named-parameters-1.jq create mode 100644 Task/Named-parameters/jq/named-parameters-2.jq create mode 100644 Task/Narcissist/Sidef/narcissist.sidef create mode 100644 Task/Narcissistic-decimal-number/ERRE/narcissistic-decimal-number.erre create mode 100644 Task/Narcissistic-decimal-number/FreeBASIC/narcissistic-decimal-number-1.freebasic create mode 100644 Task/Narcissistic-decimal-number/FreeBASIC/narcissistic-decimal-number-2.freebasic create mode 100644 Task/Narcissistic-decimal-number/FunL/narcissistic-decimal-number.funl create mode 100644 Task/Narcissistic-decimal-number/Oforth/narcissistic-decimal-number.oforth create mode 100644 Task/Narcissistic-decimal-number/Ring/narcissistic-decimal-number.ring create mode 100644 Task/Narcissistic-decimal-number/Sidef/narcissistic-decimal-number.sidef create mode 100644 Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-1.jq create mode 100644 Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-2.jq create mode 100644 Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-3.jq create mode 100644 Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-4.jq create mode 100644 Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-5.jq create mode 100644 Task/Natural-sorting/Sidef/natural-sorting-1.sidef create mode 100644 Task/Natural-sorting/Sidef/natural-sorting-2.sidef create mode 100644 Task/Natural-sorting/jq/natural-sorting-1.jq create mode 100644 Task/Natural-sorting/jq/natural-sorting-2.jq create mode 100644 Task/Natural-sorting/jq/natural-sorting-3.jq create mode 100644 Task/Non-continuous-subsequences/Nim/non-continuous-subsequences.nim create mode 100644 Task/Non-continuous-subsequences/Sidef/non-continuous-subsequences.sidef create mode 100644 Task/Non-continuous-subsequences/jq/non-continuous-subsequences-1.jq create mode 100644 Task/Non-continuous-subsequences/jq/non-continuous-subsequences-2.jq create mode 100644 Task/Non-decimal-radices-Convert/FreeBASIC/non-decimal-radices-convert.freebasic create mode 100644 Task/Non-decimal-radices-Convert/FunL/non-decimal-radices-convert-1.funl create mode 100644 Task/Non-decimal-radices-Convert/FunL/non-decimal-radices-convert-2.funl create mode 100644 Task/Non-decimal-radices-Convert/LFE/non-decimal-radices-convert.lfe create mode 100644 Task/Non-decimal-radices-Convert/Nim/non-decimal-radices-convert.nim create mode 100644 Task/Non-decimal-radices-Convert/Phix/non-decimal-radices-convert.phix create mode 100644 Task/Non-decimal-radices-Convert/Sidef/non-decimal-radices-convert-1.sidef create mode 100644 Task/Non-decimal-radices-Convert/Sidef/non-decimal-radices-convert-2.sidef create mode 100644 Task/Non-decimal-radices-Convert/Swift/non-decimal-radices-convert-1.swift create mode 100644 Task/Non-decimal-radices-Convert/Swift/non-decimal-radices-convert-2.swift create mode 100644 Task/Non-decimal-radices-Convert/jq/non-decimal-radices-convert-1.jq create mode 100644 Task/Non-decimal-radices-Convert/jq/non-decimal-radices-convert-2.jq create mode 100644 Task/Non-decimal-radices-Input/FreeBASIC/non-decimal-radices-input.freebasic create mode 100644 Task/Non-decimal-radices-Input/Nim/non-decimal-radices-input.nim create mode 100644 Task/Non-decimal-radices-Input/Phix/non-decimal-radices-input.phix create mode 100644 Task/Non-decimal-radices-Input/Ring/non-decimal-radices-input.ring create mode 100644 Task/Non-decimal-radices-Input/Sidef/non-decimal-radices-input.sidef create mode 100644 Task/Non-decimal-radices-Output/FreeBASIC/non-decimal-radices-output.freebasic create mode 100644 Task/Non-decimal-radices-Output/Nim/non-decimal-radices-output.nim create mode 100644 Task/Non-decimal-radices-Output/Phix/non-decimal-radices-output.phix create mode 100644 Task/Non-decimal-radices-Output/Sidef/non-decimal-radices-output.sidef create mode 100644 Task/Nth-root/FutureBasic/nth-root.futurebasic create mode 100644 Task/Nth-root/Lingo/nth-root-1.lingo create mode 100644 Task/Nth-root/Lingo/nth-root-2.lingo create mode 100644 Task/Nth-root/Nim/nth-root.nim create mode 100644 Task/Nth-root/Oforth/nth-root.oforth create mode 100644 Task/Nth-root/Ring/nth-root.ring create mode 100644 Task/Nth-root/Sidef/nth-root-1.sidef create mode 100644 Task/Nth-root/Sidef/nth-root-2.sidef create mode 100644 Task/Nth-root/jq/nth-root-1.jq create mode 100644 Task/Nth-root/jq/nth-root-2.jq create mode 100644 Task/Nth-root/jq/nth-root-3.jq create mode 100644 Task/Nth/ERRE/nth.erre create mode 100644 Task/Nth/FreeBASIC/nth.freebasic create mode 100644 Task/Nth/Nim/nth.nim create mode 100644 Task/Nth/Oforth/nth.oforth create mode 100644 Task/Nth/Ring/nth.ring create mode 100644 Task/Nth/Set-lang/nth.set create mode 100644 Task/Nth/Sidef/nth.sidef create mode 100644 Task/Nth/Swift/nth.swift create mode 100644 Task/Nth/XLISP/nth.xlisp create mode 100644 Task/Nth/jq/nth.jq create mode 100644 Task/Null-object/8th/null-object.8th create mode 100644 Task/Null-object/Axe/null-object.axe create mode 100644 Task/Null-object/EchoLisp/null-object.echolisp create mode 100644 Task/Null-object/FreeBASIC/null-object.freebasic create mode 100644 Task/Null-object/Lasso/null-object.lasso create mode 100644 Task/Null-object/Lily/null-object.lily create mode 100644 Task/Null-object/Lingo/null-object.lingo create mode 100644 Task/Null-object/Nim/null-object.nim create mode 100644 Task/Null-object/Oforth/null-object.oforth create mode 100644 Task/Null-object/PHL/null-object.phl create mode 100644 Task/Null-object/Phix/null-object.phix create mode 100644 Task/Null-object/Ring/null-object.ring create mode 100644 Task/Null-object/Sidef/null-object-1.sidef create mode 100644 Task/Null-object/Sidef/null-object-2.sidef create mode 100644 Task/Null-object/Swift/null-object-1.swift create mode 100644 Task/Null-object/Swift/null-object-2.swift create mode 100644 Task/Null-object/Ursa/null-object.ursa create mode 100644 Task/Null-object/Wart/null-object.wart create mode 100644 Task/Null-object/jq/null-object.jq create mode 100644 Task/Number-names/Nim/number-names.nim create mode 100644 Task/Number-names/Phix/number-names.phix create mode 100644 Task/Number-names/Ring/number-names.ring create mode 100644 Task/Number-names/SequenceL/number-names.sequencel create mode 100644 Task/Number-names/Sidef/number-names.sidef create mode 100644 Task/Number-names/jq/number-names-1.jq create mode 100644 Task/Number-names/jq/number-names-2.jq create mode 100644 Task/Number-reversal-game/Nim/number-reversal-game.nim create mode 100644 Task/Number-reversal-game/Oforth/number-reversal-game.oforth create mode 100644 Task/Number-reversal-game/Phix/number-reversal-game.phix create mode 100644 Task/Number-reversal-game/Sidef/number-reversal-game.sidef create mode 100644 Task/Numerical-integration-Gauss-Legendre-Quadrature/Sidef/numerical-integration-gauss-legendre-quadrature.sidef create mode 100644 Task/Numerical-integration/FreeBASIC/numerical-integration.freebasic create mode 100644 Task/Numerical-integration/Nim/numerical-integration.nim create mode 100644 Task/Numerical-integration/Phix/numerical-integration.phix create mode 100644 Task/Numerical-integration/SequenceL/numerical-integration.sequencel create mode 100644 Task/Numerical-integration/Sidef/numerical-integration.sidef create mode 100644 Task/Object-serialization/EchoLisp/object-serialization-1.echolisp create mode 100644 Task/Object-serialization/EchoLisp/object-serialization-2.echolisp create mode 100644 Task/Odd-word-problem/EchoLisp/odd-word-problem-1.echolisp create mode 100644 Task/Odd-word-problem/EchoLisp/odd-word-problem-2.echolisp create mode 100644 Task/Odd-word-problem/Lasso/odd-word-problem.lasso create mode 100644 Task/Odd-word-problem/Nim/odd-word-problem.nim create mode 100644 Task/Odd-word-problem/Sidef/odd-word-problem.sidef create mode 100644 Task/Old-lady-swallowed-a-fly/Nim/old-lady-swallowed-a-fly.nim create mode 100644 Task/Old-lady-swallowed-a-fly/Phix/old-lady-swallowed-a-fly.phix create mode 100644 Task/Old-lady-swallowed-a-fly/Sidef/old-lady-swallowed-a-fly.sidef create mode 100644 Task/Old-lady-swallowed-a-fly/Ursa/old-lady-swallowed-a-fly.ursa create mode 100644 Task/One-dimensional-cellular-automata/8th/one-dimensional-cellular-automata.8th create mode 100644 Task/One-dimensional-cellular-automata/Ceylon/one-dimensional-cellular-automata.ceylon create mode 100644 Task/One-dimensional-cellular-automata/ERRE/one-dimensional-cellular-automata.erre create mode 100644 Task/One-dimensional-cellular-automata/Elm/one-dimensional-cellular-automata.elm create mode 100644 Task/One-dimensional-cellular-automata/GFA-Basic/one-dimensional-cellular-automata.gfa create mode 100644 Task/One-dimensional-cellular-automata/Nim/one-dimensional-cellular-automata-1.nim create mode 100644 Task/One-dimensional-cellular-automata/Nim/one-dimensional-cellular-automata-2.nim create mode 100644 Task/One-dimensional-cellular-automata/Oforth/one-dimensional-cellular-automata.oforth create mode 100644 Task/One-dimensional-cellular-automata/Phix/one-dimensional-cellular-automata-1.phix create mode 100644 Task/One-dimensional-cellular-automata/Phix/one-dimensional-cellular-automata-2.phix create mode 100644 Task/One-dimensional-cellular-automata/Sidef/one-dimensional-cellular-automata-1.sidef create mode 100644 Task/One-dimensional-cellular-automata/Sidef/one-dimensional-cellular-automata-2.sidef create mode 100644 Task/One-dimensional-cellular-automata/Wart/one-dimensional-cellular-automata-1.wart create mode 100644 Task/One-dimensional-cellular-automata/Wart/one-dimensional-cellular-automata-2.wart create mode 100644 Task/One-dimensional-cellular-automata/jq/one-dimensional-cellular-automata-1.jq create mode 100644 Task/One-dimensional-cellular-automata/jq/one-dimensional-cellular-automata-2.jq create mode 100644 Task/One-of-n-lines-in-a-file/ERRE/one-of-n-lines-in-a-file.erre create mode 100644 Task/One-of-n-lines-in-a-file/Nim/one-of-n-lines-in-a-file.nim create mode 100644 Task/One-of-n-lines-in-a-file/Phix/one-of-n-lines-in-a-file.phix create mode 100644 Task/One-of-n-lines-in-a-file/Ring/one-of-n-lines-in-a-file.ring create mode 100644 Task/One-of-n-lines-in-a-file/Sidef/one-of-n-lines-in-a-file.sidef create mode 100644 Task/One-of-n-lines-in-a-file/Swift/one-of-n-lines-in-a-file.swift create mode 100644 Task/OpenGL/Nim/opengl.nim create mode 100644 Task/OpenGL/Phix/opengl-1.phix create mode 100644 Task/OpenGL/Phix/opengl-2.phix create mode 100644 Task/Operator-precedence/Ring/operator-precedence.ring create mode 100644 Task/Operator-precedence/Sidef/operator-precedence.sidef create mode 100644 Task/Optional-parameters/Lasso/optional-parameters.lasso create mode 100644 Task/Optional-parameters/Nim/optional-parameters.nim create mode 100644 Task/Optional-parameters/Phix/optional-parameters-1.phix create mode 100644 Task/Optional-parameters/Phix/optional-parameters-2.phix create mode 100644 Task/Optional-parameters/Phix/optional-parameters-3.phix create mode 100644 Task/Optional-parameters/Sidef/optional-parameters-1.sidef create mode 100644 Task/Optional-parameters/Sidef/optional-parameters-2.sidef create mode 100644 Task/Optional-parameters/Swift/optional-parameters.swift create mode 100644 Task/Optional-parameters/jq/optional-parameters-1.jq create mode 100644 Task/Optional-parameters/jq/optional-parameters-2.jq create mode 100644 Task/Optional-parameters/jq/optional-parameters-3.jq create mode 100644 Task/Optional-parameters/jq/optional-parameters-4.jq create mode 100644 Task/Order-disjoint-list-items/EchoLisp/order-disjoint-list-items.echolisp create mode 100644 Task/Order-disjoint-list-items/Phix/order-disjoint-list-items.phix create mode 100644 Task/Order-disjoint-list-items/Sidef/order-disjoint-list-items.sidef create mode 100644 Task/Order-disjoint-list-items/jq/order-disjoint-list-items-1.jq create mode 100644 Task/Order-disjoint-list-items/jq/order-disjoint-list-items-2.jq create mode 100644 Task/Order-disjoint-list-items/jq/order-disjoint-list-items-3.jq create mode 100644 Task/Order-disjoint-list-items/jq/order-disjoint-list-items-4.jq create mode 100644 Task/Order-disjoint-list-items/jq/order-disjoint-list-items-5.jq create mode 100644 Task/Order-disjoint-list-items/jq/order-disjoint-list-items-6.jq create mode 100644 Task/Order-disjoint-list-items/jq/order-disjoint-list-items-7.jq create mode 100644 Task/Order-disjoint-list-items/jq/order-disjoint-list-items-8.jq create mode 100644 Task/Order-disjoint-list-items/jq/order-disjoint-list-items-9.jq create mode 100644 Task/Order-two-numerical-lists/Lasso/order-two-numerical-lists.lasso create mode 100644 Task/Order-two-numerical-lists/Nim/order-two-numerical-lists.nim create mode 100644 Task/Order-two-numerical-lists/Ring/order-two-numerical-lists.ring create mode 100644 Task/Order-two-numerical-lists/Sidef/order-two-numerical-lists.sidef create mode 100644 Task/Order-two-numerical-lists/Swift/order-two-numerical-lists.swift create mode 100644 Task/Order-two-numerical-lists/Wart/order-two-numerical-lists.wart create mode 100644 Task/Order-two-numerical-lists/jq/order-two-numerical-lists.jq create mode 100644 Task/Ordered-Partitions/EchoLisp/ordered-partitions.echolisp create mode 100644 Task/Ordered-Partitions/Sidef/ordered-partitions.sidef create mode 100644 Task/Ordered-Partitions/jq/ordered-partitions-1.jq create mode 100644 Task/Ordered-Partitions/jq/ordered-partitions-2.jq create mode 100644 Task/Ordered-Partitions/jq/ordered-partitions-3.jq create mode 100644 Task/Ordered-words/EchoLisp/ordered-words.echolisp create mode 100644 Task/Ordered-words/FreeBASIC/ordered-words.freebasic create mode 100644 Task/Ordered-words/Lasso/ordered-words.lasso create mode 100644 Task/Ordered-words/Lingo/ordered-words.lingo create mode 100644 Task/Ordered-words/Nim/ordered-words.nim create mode 100644 Task/Ordered-words/Oforth/ordered-words.oforth create mode 100644 Task/Ordered-words/Phix/ordered-words.phix create mode 100644 Task/Ordered-words/Ring/ordered-words.ring create mode 100644 Task/Ordered-words/Sidef/ordered-words.sidef create mode 100644 Task/Ordered-words/Swift/ordered-words.swift create mode 100644 Task/Ordered-words/jq/ordered-words.jq create mode 100644 Task/Palindrome-detection/EchoLisp/palindrome-detection.echolisp create mode 100644 Task/Palindrome-detection/Elm/palindrome-detection.elm create mode 100644 Task/Palindrome-detection/FreeBASIC/palindrome-detection.freebasic create mode 100644 Task/Palindrome-detection/Lasso/palindrome-detection.lasso create mode 100644 Task/Palindrome-detection/LiveCode/palindrome-detection.livecode create mode 100644 Task/Palindrome-detection/Nim/palindrome-detection.nim create mode 100644 Task/Palindrome-detection/Oforth/palindrome-detection.oforth create mode 100644 Task/Palindrome-detection/Phix/palindrome-detection.phix create mode 100644 Task/Palindrome-detection/Potion/palindrome-detection.potion create mode 100644 Task/Palindrome-detection/Ring/palindrome-detection.ring create mode 100644 Task/Palindrome-detection/SequenceL/palindrome-detection-1.sequencel create mode 100644 Task/Palindrome-detection/SequenceL/palindrome-detection-2.sequencel create mode 100644 Task/Palindrome-detection/Sidef/palindrome-detection-1.sidef create mode 100644 Task/Palindrome-detection/Sidef/palindrome-detection-2.sidef create mode 100644 Task/Palindrome-detection/Sidef/palindrome-detection-3.sidef create mode 100644 Task/Palindrome-detection/Swift/palindrome-detection-1.swift create mode 100644 Task/Palindrome-detection/Swift/palindrome-detection-2.swift create mode 100644 Task/Palindrome-detection/Wortel/palindrome-detection.wortel create mode 100644 Task/Palindrome-detection/jq/palindrome-detection.jq create mode 100644 Task/Pangram-checker/Ceylon/pangram-checker.ceylon create mode 100644 Task/Pangram-checker/FreeBASIC/pangram-checker.freebasic create mode 100644 Task/Pangram-checker/Nim/pangram-checker.nim create mode 100644 Task/Pangram-checker/Ring/pangram-checker.ring create mode 100644 Task/Pangram-checker/Sidef/pangram-checker.sidef create mode 100644 Task/Pangram-checker/Swift/pangram-checker-1.swift create mode 100644 Task/Pangram-checker/Swift/pangram-checker-2.swift create mode 100644 Task/Pangram-checker/jq/pangram-checker.jq create mode 100644 Task/Paraffins/Nim/paraffins.nim create mode 100644 Task/Paraffins/jq/paraffins-1.jq create mode 100644 Task/Paraffins/jq/paraffins-2.jq create mode 100644 Task/Parallel-calculations/Oforth/parallel-calculations.oforth create mode 100644 Task/Parallel-calculations/SequenceL/parallel-calculations-1.sequencel create mode 100644 Task/Parallel-calculations/SequenceL/parallel-calculations-2.sequencel create mode 100644 Task/Parallel-calculations/Sidef/parallel-calculations.sidef create mode 100644 Task/Parametric-polymorphism/Ceylon/parametric-polymorphism.ceylon create mode 100644 Task/Parametric-polymorphism/Nim/parametric-polymorphism.nim create mode 100644 Task/Parametric-polymorphism/Swift/parametric-polymorphism-1.swift create mode 100644 Task/Parametric-polymorphism/Swift/parametric-polymorphism-2.swift create mode 100644 Task/Parametrized-SQL-statement/8th/parametrized-sql-statement.8th create mode 100644 Task/Parsing-RPN-calculator-algorithm/Ceylon/parsing-rpn-calculator-algorithm.ceylon create mode 100644 Task/Parsing-RPN-calculator-algorithm/EchoLisp/parsing-rpn-calculator-algorithm.echolisp create mode 100644 Task/Parsing-RPN-calculator-algorithm/FunL/parsing-rpn-calculator-algorithm.funl create mode 100644 Task/Parsing-RPN-calculator-algorithm/Nim/parsing-rpn-calculator-algorithm.nim create mode 100644 Task/Parsing-RPN-calculator-algorithm/Oforth/parsing-rpn-calculator-algorithm-1.oforth create mode 100644 Task/Parsing-RPN-calculator-algorithm/Oforth/parsing-rpn-calculator-algorithm-2.oforth create mode 100644 Task/Parsing-RPN-calculator-algorithm/Phix/parsing-rpn-calculator-algorithm.phix create mode 100644 Task/Parsing-RPN-calculator-algorithm/Sidef/parsing-rpn-calculator-algorithm.sidef create mode 100644 Task/Parsing-RPN-calculator-algorithm/Swift/parsing-rpn-calculator-algorithm.swift create mode 100644 Task/Parsing-RPN-to-infix-conversion/EchoLisp/parsing-rpn-to-infix-conversion.echolisp create mode 100644 Task/Parsing-RPN-to-infix-conversion/Nim/parsing-rpn-to-infix-conversion.nim create mode 100644 Task/Parsing-RPN-to-infix-conversion/Phix/parsing-rpn-to-infix-conversion.phix create mode 100644 Task/Parsing-RPN-to-infix-conversion/Sidef/parsing-rpn-to-infix-conversion.sidef create mode 100644 Task/Parsing-Shunting-yard-algorithm/Ceylon/parsing-shunting-yard-algorithm.ceylon create mode 100644 Task/Parsing-Shunting-yard-algorithm/EchoLisp/parsing-shunting-yard-algorithm.echolisp create mode 100644 Task/Parsing-Shunting-yard-algorithm/Phix/parsing-shunting-yard-algorithm.phix create mode 100644 Task/Parsing-Shunting-yard-algorithm/Sidef/parsing-shunting-yard-algorithm.sidef create mode 100644 Task/Parsing-Shunting-yard-algorithm/Swift/parsing-shunting-yard-algorithm.swift create mode 100644 Task/Partial-function-application/Ceylon/partial-function-application.ceylon create mode 100644 Task/Partial-function-application/Egison/partial-function-application-1.egison create mode 100644 Task/Partial-function-application/Egison/partial-function-application-2.egison create mode 100644 Task/Partial-function-application/FunL/partial-function-application.funl create mode 100644 Task/Partial-function-application/LFE/partial-function-application-1.lfe create mode 100644 Task/Partial-function-application/LFE/partial-function-application-2.lfe create mode 100644 Task/Partial-function-application/Oforth/partial-function-application.oforth create mode 100644 Task/Partial-function-application/Sidef/partial-function-application.sidef create mode 100644 Task/Pascals-triangle-Puzzle/Nim/pascals-triangle-puzzle.nim create mode 100644 Task/Pascals-triangle-Puzzle/Sidef/pascals-triangle-puzzle.sidef create mode 100644 Task/Pascals-triangle/8th/pascals-triangle-1.8th create mode 100644 Task/Pascals-triangle/8th/pascals-triangle-2.8th create mode 100644 Task/Pascals-triangle/ERRE/pascals-triangle.erre create mode 100644 Task/Pascals-triangle/FreeBASIC/pascals-triangle.freebasic create mode 100644 Task/Pascals-triangle/FunL/pascals-triangle-1.funl create mode 100644 Task/Pascals-triangle/FunL/pascals-triangle-2.funl create mode 100644 Task/Pascals-triangle/FunL/pascals-triangle-3.funl create mode 100644 Task/Pascals-triangle/Nim/pascals-triangle.nim create mode 100644 Task/Pascals-triangle/Oforth/pascals-triangle.oforth create mode 100644 Task/Pascals-triangle/Phix/pascals-triangle.phix create mode 100644 Task/Pascals-triangle/Potion/pascals-triangle.potion create mode 100644 Task/Pascals-triangle/Ring/pascals-triangle.ring create mode 100644 Task/Pascals-triangle/Sidef/pascals-triangle.sidef create mode 100644 Task/Pascals-triangle/jq/pascals-triangle-1.jq create mode 100644 Task/Pascals-triangle/jq/pascals-triangle-2.jq create mode 100644 Task/Pascals-triangle/jq/pascals-triangle-3.jq create mode 100644 Task/Pattern-matching/EchoLisp/pattern-matching-1.echolisp create mode 100644 Task/Pattern-matching/EchoLisp/pattern-matching-2.echolisp create mode 100644 Task/Pattern-matching/Swift/pattern-matching.swift create mode 100644 Task/Percentage-difference-between-images/Sidef/percentage-difference-between-images.sidef create mode 100644 Task/Percolation-Mean-cluster-density/EchoLisp/percolation-mean-cluster-density.echolisp create mode 100644 Task/Percolation-Mean-run-density/EchoLisp/percolation-mean-run-density.echolisp create mode 100644 Task/Percolation-Mean-run-density/Sidef/percolation-mean-run-density.sidef create mode 100644 Task/Perfect-numbers/ERRE/perfect-numbers.erre create mode 100644 Task/Perfect-numbers/FreeBASIC/perfect-numbers.freebasic create mode 100644 Task/Perfect-numbers/FunL/perfect-numbers.funl create mode 100644 Task/Perfect-numbers/Lasso/perfect-numbers-1.lasso create mode 100644 Task/Perfect-numbers/Lasso/perfect-numbers-2.lasso create mode 100644 Task/Perfect-numbers/Lingo/perfect-numbers.lingo create mode 100644 Task/Perfect-numbers/Nim/perfect-numbers.nim create mode 100644 Task/Perfect-numbers/Oforth/perfect-numbers.oforth create mode 100644 Task/Perfect-numbers/Phix/perfect-numbers.phix create mode 100644 Task/Perfect-numbers/Ring/perfect-numbers.ring create mode 100644 Task/Perfect-numbers/Sidef/perfect-numbers-1.sidef create mode 100644 Task/Perfect-numbers/Sidef/perfect-numbers-2.sidef create mode 100644 Task/Perfect-numbers/Swift/perfect-numbers.swift create mode 100644 Task/Perfect-numbers/jq/perfect-numbers.jq create mode 100644 Task/Permutation-test/Sidef/permutation-test.sidef create mode 100644 Task/Permutation-test/jq/permutation-test-1.jq create mode 100644 Task/Permutation-test/jq/permutation-test-2.jq create mode 100644 Task/Permutation-test/jq/permutation-test-3.jq create mode 100644 Task/Permutations-Derangements/EchoLisp/permutations-derangements-1.echolisp create mode 100644 Task/Permutations-Derangements/EchoLisp/permutations-derangements-2.echolisp create mode 100644 Task/Permutations-Derangements/jq/permutations-derangements-1.jq create mode 100644 Task/Permutations-Derangements/jq/permutations-derangements-2.jq create mode 100644 Task/Permutations-Derangements/jq/permutations-derangements-3.jq create mode 100644 Task/Permutations-by-swapping/EchoLisp/permutations-by-swapping.echolisp create mode 100644 Task/Permutations-by-swapping/Nim/permutations-by-swapping.nim create mode 100644 Task/Permutations-by-swapping/Sidef/permutations-by-swapping.sidef create mode 100644 Task/Permutations-by-swapping/jq/permutations-by-swapping-1.jq create mode 100644 Task/Permutations-by-swapping/jq/permutations-by-swapping-2.jq create mode 100644 Task/Permutations-by-swapping/jq/permutations-by-swapping-3.jq create mode 100644 Task/Permutations/LFE/permutations-1.lfe create mode 100644 Task/Permutations/LFE/permutations-2.lfe create mode 100644 Task/Permutations/Nim/permutations.nim create mode 100644 Task/Permutations/Phix/permutations-1.phix create mode 100644 Task/Permutations/Phix/permutations-2.phix create mode 100644 Task/Permutations/Ring/permutations.ring create mode 100644 Task/Permutations/Sidef/permutations-1.sidef create mode 100644 Task/Permutations/Sidef/permutations-2.sidef create mode 100644 Task/Permutations/Sidef/permutations-3.sidef create mode 100644 Task/Permutations/Swift/permutations.swift create mode 100644 Task/Permutations/jq/permutations.jq create mode 100644 Task/Pernicious-numbers/EchoLisp/pernicious-numbers.echolisp create mode 100644 Task/Pernicious-numbers/FreeBASIC/pernicious-numbers.freebasic create mode 100644 Task/Pernicious-numbers/Nim/pernicious-numbers.nim create mode 100644 Task/Pernicious-numbers/Panda/pernicious-numbers.panda create mode 100644 Task/Pernicious-numbers/Sidef/pernicious-numbers.sidef create mode 100644 Task/Pernicious-numbers/Symsyn/pernicious-numbers.symsyn create mode 100644 Task/Pernicious-numbers/Wortel/pernicious-numbers-1.wortel create mode 100644 Task/Pernicious-numbers/Wortel/pernicious-numbers-2.wortel create mode 100644 Task/Pernicious-numbers/jq/pernicious-numbers.jq create mode 100644 Task/Phrase-reversals/EchoLisp/phrase-reversals.echolisp create mode 100644 Task/Phrase-reversals/FreeBASIC/phrase-reversals.freebasic create mode 100644 Task/Phrase-reversals/Oforth/phrase-reversals.oforth create mode 100644 Task/Phrase-reversals/Phix/phrase-reversals.phix create mode 100644 Task/Phrase-reversals/Ring/phrase-reversals.ring create mode 100644 Task/Phrase-reversals/Sidef/phrase-reversals.sidef create mode 100644 Task/Phrase-reversals/jq/phrase-reversals.jq create mode 100644 Task/Pi/FunL/pi.funl create mode 100644 Task/Pi/FutureBasic/pi.futurebasic create mode 100644 Task/Pi/Lasso/pi.lasso create mode 100644 Task/Pi/Nim/pi.nim create mode 100644 Task/Pi/Oforth/pi.oforth create mode 100644 Task/Pi/Phix/pi.phix create mode 100644 Task/Pi/Sidef/pi.sidef create mode 100644 Task/Pi/jq/pi-1.jq create mode 100644 Task/Pi/jq/pi-2.jq create mode 100644 Task/Pick-random-element/Ceylon/pick-random-element.ceylon create mode 100644 Task/Pick-random-element/EchoLisp/pick-random-element.echolisp create mode 100644 Task/Pick-random-element/FreeBASIC/pick-random-element.freebasic create mode 100644 Task/Pick-random-element/Lasso/pick-random-element.lasso create mode 100644 Task/Pick-random-element/LiveCode/pick-random-element.livecode create mode 100644 Task/Pick-random-element/Nim/pick-random-element.nim create mode 100644 Task/Pick-random-element/Oforth/pick-random-element.oforth create mode 100644 Task/Pick-random-element/Phix/pick-random-element.phix create mode 100644 Task/Pick-random-element/Ring/pick-random-element.ring create mode 100644 Task/Pick-random-element/Sidef/pick-random-element.sidef create mode 100644 Task/Pick-random-element/Swift/pick-random-element.swift create mode 100644 Task/Pick-random-element/Ursa/pick-random-element.ursa create mode 100644 Task/Pig-the-dice-game-Player/Sidef/pig-the-dice-game-player.sidef create mode 100644 Task/Play-recorded-sounds/Ring/play-recorded-sounds.ring create mode 100644 Task/Play-recorded-sounds/Swift/play-recorded-sounds.swift create mode 100644 Task/Playing-cards/Ceylon/playing-cards.ceylon create mode 100644 Task/Playing-cards/Nim/playing-cards.nim create mode 100644 Task/Playing-cards/Ring/playing-cards.ring create mode 100644 Task/Playing-cards/Sidef/playing-cards.sidef create mode 100644 Task/Playing-cards/Swift/playing-cards.swift create mode 100644 Task/Plot-coordinate-pairs/EchoLisp/plot-coordinate-pairs.echolisp create mode 100644 Task/Plot-coordinate-pairs/Sidef/plot-coordinate-pairs.sidef create mode 100644 Task/Plot-coordinate-pairs/jq/plot-coordinate-pairs-1.jq create mode 100644 Task/Plot-coordinate-pairs/jq/plot-coordinate-pairs-2.jq create mode 100644 Task/Plot-coordinate-pairs/jq/plot-coordinate-pairs-3.jq create mode 100644 Task/Pointers-and-references/EchoLisp/pointers-and-references.echolisp create mode 100644 Task/Pointers-and-references/FreeBASIC/pointers-and-references.freebasic create mode 100644 Task/Pointers-and-references/Nim/pointers-and-references-1.nim create mode 100644 Task/Pointers-and-references/Nim/pointers-and-references-2.nim create mode 100644 Task/Pointers-and-references/Nim/pointers-and-references-3.nim create mode 100644 Task/Pointers-and-references/Nim/pointers-and-references-4.nim create mode 100644 Task/Pointers-and-references/Nim/pointers-and-references-5.nim create mode 100644 Task/Pointers-and-references/Nim/pointers-and-references-6.nim create mode 100644 Task/Pointers-and-references/Nim/pointers-and-references-7.nim create mode 100644 Task/Pointers-and-references/Sidef/pointers-and-references.sidef create mode 100644 Task/Polymorphic-copy/EchoLisp/polymorphic-copy.echolisp create mode 100644 Task/Polymorphic-copy/Nim/polymorphic-copy.nim create mode 100644 Task/Polymorphic-copy/Sidef/polymorphic-copy.sidef create mode 100644 Task/Polymorphic-copy/Swift/polymorphic-copy.swift create mode 100644 Task/Polymorphism/EchoLisp/polymorphism.echolisp create mode 100644 Task/Polymorphism/Nim/polymorphism.nim create mode 100644 Task/Polymorphism/Oforth/polymorphism-1.oforth create mode 100644 Task/Polymorphism/Oforth/polymorphism-2.oforth create mode 100644 Task/Polymorphism/Phix/polymorphism.phix create mode 100644 Task/Polymorphism/Sidef/polymorphism-1.sidef create mode 100644 Task/Polymorphism/Sidef/polymorphism-2.sidef create mode 100644 Task/Polymorphism/Swift/polymorphism.swift create mode 100644 Task/Polymorphism/Wollok/polymorphism.wollok create mode 100644 Task/Polynomial-long-division/Sidef/polynomial-long-division-1.sidef create mode 100644 Task/Polynomial-long-division/Sidef/polynomial-long-division-2.sidef create mode 100644 Task/Polynomial-regression/FreeBASIC/polynomial-regression.freebasic create mode 100644 Task/Polynomial-regression/Hy/polynomial-regression.hy create mode 100644 Task/Polynomial-regression/Sidef/polynomial-regression.sidef create mode 100644 Task/Power-set/EchoLisp/power-set.echolisp create mode 100644 Task/Power-set/FunL/power-set-1.funl create mode 100644 Task/Power-set/FunL/power-set-2.funl create mode 100644 Task/Power-set/FunL/power-set-3.funl create mode 100644 Task/Power-set/Nim/power-set.nim create mode 100644 Task/Power-set/Sidef/power-set.sidef create mode 100644 Task/Power-set/jq/power-set-1.jq create mode 100644 Task/Power-set/jq/power-set-2.jq create mode 100644 Task/Power-set/jq/power-set-3.jq create mode 100644 Task/Price-fraction/FreeBASIC/price-fraction.freebasic create mode 100644 Task/Price-fraction/Nim/price-fraction.nim create mode 100644 Task/Price-fraction/Oforth/price-fraction.oforth create mode 100644 Task/Price-fraction/Phix/price-fraction.phix create mode 100644 Task/Price-fraction/Ring/price-fraction.ring create mode 100644 Task/Price-fraction/Sidef/price-fraction.sidef create mode 100644 Task/Price-fraction/jq/price-fraction-1.jq create mode 100644 Task/Price-fraction/jq/price-fraction-2.jq create mode 100644 Task/Primality-by-trial-division/ERRE/primality-by-trial-division.erre create mode 100644 Task/Primality-by-trial-division/EchoLisp/primality-by-trial-division.echolisp create mode 100644 Task/Primality-by-trial-division/FreeBASIC/primality-by-trial-division.freebasic create mode 100644 Task/Primality-by-trial-division/FunL/primality-by-trial-division.funl create mode 100644 Task/Primality-by-trial-division/FutureBasic/primality-by-trial-division.futurebasic create mode 100644 Task/Primality-by-trial-division/Nim/primality-by-trial-division.nim create mode 100644 Task/Primality-by-trial-division/Oforth/primality-by-trial-division.oforth create mode 100644 Task/Primality-by-trial-division/Panda/primality-by-trial-division.panda create mode 100644 Task/Primality-by-trial-division/Phix/primality-by-trial-division.phix create mode 100644 Task/Primality-by-trial-division/Ring/primality-by-trial-division.ring create mode 100644 Task/Primality-by-trial-division/Sidef/primality-by-trial-division.sidef create mode 100644 Task/Primality-by-trial-division/Swift/primality-by-trial-division.swift create mode 100644 Task/Prime-decomposition/Commodore-BASIC/prime-decomposition.commodore create mode 100644 Task/Prime-decomposition/ERRE/prime-decomposition.erre create mode 100644 Task/Prime-decomposition/EchoLisp/prime-decomposition.echolisp create mode 100644 Task/Prime-decomposition/Ezhil/prime-decomposition.ezhil create mode 100644 Task/Prime-decomposition/FreeBASIC/prime-decomposition.freebasic create mode 100644 Task/Prime-decomposition/LFE/prime-decomposition.lfe create mode 100644 Task/Prime-decomposition/Lingo/prime-decomposition-1.lingo create mode 100644 Task/Prime-decomposition/Lingo/prime-decomposition-2.lingo create mode 100644 Task/Prime-decomposition/Nim/prime-decomposition.nim create mode 100644 Task/Prime-decomposition/Oforth/prime-decomposition.oforth create mode 100644 Task/Prime-decomposition/Ring/prime-decomposition.ring create mode 100644 Task/Prime-decomposition/SPAD/prime-decomposition.spad create mode 100644 Task/Prime-decomposition/SequenceL/prime-decomposition-1.sequencel create mode 100644 Task/Prime-decomposition/SequenceL/prime-decomposition-2.sequencel create mode 100644 Task/Prime-decomposition/Sidef/prime-decomposition-1.sidef create mode 100644 Task/Prime-decomposition/Sidef/prime-decomposition-2.sidef create mode 100644 Task/Prime-decomposition/Sidef/prime-decomposition-3.sidef create mode 100644 Task/Prime-decomposition/jq/prime-decomposition-1.jq create mode 100644 Task/Prime-decomposition/jq/prime-decomposition-2.jq create mode 100644 Task/Priority-queue/EchoLisp/priority-queue.echolisp create mode 100644 Task/Priority-queue/FunL/priority-queue.funl create mode 100644 Task/Priority-queue/Lasso/priority-queue.lasso create mode 100644 Task/Priority-queue/Nim/priority-queue-1.nim create mode 100644 Task/Priority-queue/Nim/priority-queue-2.nim create mode 100644 Task/Priority-queue/Sidef/priority-queue.sidef create mode 100644 Task/Priority-queue/Swift/priority-queue.swift create mode 100644 Task/Priority-queue/jq/priority-queue-1.jq create mode 100644 Task/Priority-queue/jq/priority-queue-2.jq create mode 100644 Task/Probabilistic-choice/ERRE/probabilistic-choice.erre create mode 100644 Task/Probabilistic-choice/FreeBASIC/probabilistic-choice.freebasic create mode 100644 Task/Probabilistic-choice/Nim/probabilistic-choice.nim create mode 100644 Task/Probabilistic-choice/Phix/probabilistic-choice.phix create mode 100644 Task/Probabilistic-choice/Sidef/probabilistic-choice.sidef create mode 100644 Task/Problem-of-Apollonius/Lasso/problem-of-apollonius.lasso create mode 100644 Task/Problem-of-Apollonius/Nim/problem-of-apollonius.nim create mode 100644 Task/Problem-of-Apollonius/Sidef/problem-of-apollonius.sidef create mode 100644 Task/Problem-of-Apollonius/Swift/problem-of-apollonius.swift create mode 100644 Task/Problem-of-Apollonius/jq/problem-of-apollonius-1.jq create mode 100644 Task/Problem-of-Apollonius/jq/problem-of-apollonius-2.jq create mode 100644 Task/Problem-of-Apollonius/jq/problem-of-apollonius-3.jq create mode 100644 Task/Program-name/EchoLisp/program-name.echolisp create mode 100644 Task/Program-name/FreeBASIC/program-name.freebasic create mode 100644 Task/Program-name/Lasso/program-name-1.lasso create mode 100644 Task/Program-name/Lasso/program-name-2.lasso create mode 100644 Task/Program-name/Lingo/program-name.lingo create mode 100644 Task/Program-name/Nim/program-name.nim create mode 100644 Task/Program-name/Phix/program-name.phix create mode 100644 Task/Program-name/Ring/program-name-1.ring create mode 100644 Task/Program-name/Ring/program-name-2.ring create mode 100644 Task/Program-name/Ring/program-name-3.ring create mode 100644 Task/Program-name/Sidef/program-name.sidef create mode 100644 Task/Program-termination/Axe/program-termination.axe create mode 100644 Task/Program-termination/FreeBASIC/program-termination.freebasic create mode 100644 Task/Program-termination/Lasso/program-termination-1.lasso create mode 100644 Task/Program-termination/Lasso/program-termination-2.lasso create mode 100644 Task/Program-termination/Nim/program-termination.nim create mode 100644 Task/Program-termination/Oforth/program-termination.oforth create mode 100644 Task/Program-termination/Phix/program-termination-1.phix create mode 100644 Task/Program-termination/Phix/program-termination-2.phix create mode 100644 Task/Program-termination/Ring/program-termination.ring create mode 100644 Task/Program-termination/SSEM/program-termination.ssem create mode 100644 Task/Program-termination/Sidef/program-termination.sidef create mode 100644 Task/Program-termination/Ursa/program-termination.ursa create mode 100644 Task/Program-termination/jq/program-termination-1.jq create mode 100644 Task/Program-termination/jq/program-termination-2.jq create mode 100644 Task/Pythagorean-triples/ERRE/pythagorean-triples.erre create mode 100644 Task/Pythagorean-triples/FreeBASIC/pythagorean-triples-1.freebasic create mode 100644 Task/Pythagorean-triples/FreeBASIC/pythagorean-triples-2.freebasic create mode 100644 Task/Pythagorean-triples/Lasso/pythagorean-triples.lasso create mode 100644 Task/Pythagorean-triples/Nim/pythagorean-triples.nim create mode 100644 Task/Pythagorean-triples/Phix/pythagorean-triples.phix create mode 100644 Task/Pythagorean-triples/Ring/pythagorean-triples.ring create mode 100644 Task/Pythagorean-triples/Sidef/pythagorean-triples.sidef create mode 100644 Task/Pythagorean-triples/Swift/pythagorean-triples.swift create mode 100644 Task/Pythagorean-triples/jq/pythagorean-triples-1.jq create mode 100644 Task/Pythagorean-triples/jq/pythagorean-triples-2.jq create mode 100644 Task/Quaternion-type/ERRE/quaternion-type.erre create mode 100644 Task/Quaternion-type/Eero/quaternion-type.eero create mode 100644 Task/Quaternion-type/Oforth/quaternion-type-1.oforth create mode 100644 Task/Quaternion-type/Oforth/quaternion-type-2.oforth create mode 100644 Task/Quaternion-type/Phix/quaternion-type.phix create mode 100644 Task/Quaternion-type/Sidef/quaternion-type.sidef create mode 100644 Task/Quaternion-type/jq/quaternion-type-1.jq create mode 100644 Task/Quaternion-type/jq/quaternion-type-2.jq create mode 100644 Task/Queue-Definition/ERRE/queue-definition.erre create mode 100644 Task/Queue-Definition/EchoLisp/queue-definition.echolisp create mode 100644 Task/Queue-Definition/Lasso/queue-definition-1.lasso create mode 100644 Task/Queue-Definition/Lasso/queue-definition-2.lasso create mode 100644 Task/Queue-Definition/Nim/queue-definition.nim create mode 100644 Task/Queue-Definition/Oforth/queue-definition.oforth create mode 100644 Task/Queue-Definition/Phix/queue-definition.phix create mode 100644 Task/Queue-Definition/Sidef/queue-definition.sidef create mode 100644 Task/Queue-Definition/Wart/queue-definition.wart create mode 100644 Task/Queue-Definition/XLISP/queue-definition-1.xlisp create mode 100644 Task/Queue-Definition/XLISP/queue-definition-2.xlisp create mode 100644 Task/Queue-Definition/jq/queue-definition-1.jq create mode 100644 Task/Queue-Definition/jq/queue-definition-2.jq create mode 100644 Task/Queue-Usage/8th/queue-usage.8th create mode 100644 Task/Queue-Usage/Lasso/queue-usage.lasso create mode 100644 Task/Queue-Usage/Nim/queue-usage.nim create mode 100644 Task/Queue-Usage/Oforth/queue-usage.oforth create mode 100644 Task/Queue-Usage/Phix/queue-usage.phix create mode 100644 Task/Queue-Usage/Sidef/queue-usage.sidef create mode 100644 Task/Quickselect-algorithm/Nim/quickselect-algorithm.nim create mode 100644 Task/Quickselect-algorithm/Phix/quickselect-algorithm.phix create mode 100644 Task/Quickselect-algorithm/Ring/quickselect-algorithm.ring create mode 100644 Task/Quickselect-algorithm/Sidef/quickselect-algorithm.sidef create mode 100644 Task/Quickselect-algorithm/Swift/quickselect-algorithm.swift create mode 100644 Task/Quickselect-algorithm/jq/quickselect-algorithm-1.jq create mode 100644 Task/Quickselect-algorithm/jq/quickselect-algorithm-2.jq create mode 100644 Task/Quickselect-algorithm/jq/quickselect-algorithm-3.jq create mode 100644 Task/Quine/Ceylon/quine.ceylon create mode 100644 Task/Quine/Commodore-BASIC/quine.commodore create mode 100644 Task/Quine/ERRE/quine.erre create mode 100644 Task/Quine/Free-Pascal/quine.free create mode 100644 Task/Quine/Hoon/quine-1.hoon create mode 100644 Task/Quine/Hoon/quine-2.hoon create mode 100644 Task/Quine/Hoon/quine-3.hoon create mode 100644 Task/Quine/Lasso/quine.lasso create mode 100644 Task/Quine/Nim/quine-1.nim create mode 100644 Task/Quine/Nim/quine-2.nim create mode 100644 Task/Quine/Nim/quine-3.nim create mode 100644 Task/Quine/Oforth/quine.oforth create mode 100644 Task/Quine/Phix/quine.phix create mode 100644 Task/Quine/Ring/quine.ring create mode 100644 Task/Quine/Sidef/quine-1.sidef create mode 100644 Task/Quine/Sidef/quine-2.sidef create mode 100644 Task/Quine/Swift/quine-1.swift create mode 100644 Task/Quine/Swift/quine-2.swift create mode 100644 Task/RIPEMD-160/FreeBASIC/ripemd-160.freebasic create mode 100644 Task/RIPEMD-160/Lasso/ripemd-160.lasso create mode 100644 Task/RIPEMD-160/Swift/ripemd-160-1.swift create mode 100644 Task/RIPEMD-160/Swift/ripemd-160-2.swift create mode 100644 Task/RSA-code/Sidef/rsa-code.sidef create mode 100644 Task/Random-number-generator--device-/EchoLisp/random-number-generator--device-.echolisp create mode 100644 Task/Random-number-generator--device-/FreeBASIC/random-number-generator--device-.freebasic create mode 100644 Task/Random-number-generator--device-/Lasso/random-number-generator--device-.lasso create mode 100644 Task/Random-number-generator--device-/Nim/random-number-generator--device-.nim create mode 100644 Task/Random-number-generator--device-/Ring/random-number-generator--device-.ring create mode 100644 Task/Random-number-generator--device-/Sidef/random-number-generator--device-.sidef create mode 100644 Task/Random-number-generator--included-/EchoLisp/random-number-generator--included-.echolisp create mode 100644 Task/Random-number-generator--included-/Ring/random-number-generator--included-.ring create mode 100644 Task/Random-number-generator--included-/Sidef/random-number-generator--included-.sidef create mode 100644 Task/Random-numbers/ERRE/random-numbers.erre create mode 100644 Task/Random-numbers/Free-Pascal/random-numbers.free create mode 100644 Task/Random-numbers/FreeBASIC/random-numbers.freebasic create mode 100644 Task/Random-numbers/FutureBasic/random-numbers.futurebasic create mode 100644 Task/Random-numbers/Nim/random-numbers.nim create mode 100644 Task/Random-numbers/Phix/random-numbers.phix create mode 100644 Task/Random-numbers/Ring/random-numbers.ring create mode 100644 Task/Random-numbers/Sidef/random-numbers.sidef create mode 100644 Task/Random-numbers/Visual-FoxPro/random-numbers.visual create mode 100644 Task/Random-numbers/jq/random-numbers-1.jq create mode 100644 Task/Random-numbers/jq/random-numbers-2.jq create mode 100644 Task/Random-numbers/jq/random-numbers-3.jq create mode 100644 Task/Range-expansion/8th/range-expansion.8th create mode 100644 Task/Range-expansion/EchoLisp/range-expansion.echolisp create mode 100644 Task/Range-expansion/FreeBASIC/range-expansion.freebasic create mode 100644 Task/Range-expansion/Lasso/range-expansion.lasso create mode 100644 Task/Range-expansion/Lingo/range-expansion-1.lingo create mode 100644 Task/Range-expansion/Lingo/range-expansion-2.lingo create mode 100644 Task/Range-expansion/LiveCode/range-expansion-1.livecode create mode 100644 Task/Range-expansion/LiveCode/range-expansion-2.livecode create mode 100644 Task/Range-expansion/Nim/range-expansion.nim create mode 100644 Task/Range-expansion/Oforth/range-expansion.oforth create mode 100644 Task/Range-expansion/Sidef/range-expansion.sidef create mode 100644 Task/Range-expansion/jq/range-expansion-1.jq create mode 100644 Task/Range-expansion/jq/range-expansion-2.jq create mode 100644 Task/Range-extraction/Ceylon/range-extraction.ceylon create mode 100644 Task/Range-extraction/EchoLisp/range-extraction.echolisp create mode 100644 Task/Range-extraction/FreeBASIC/range-extraction.freebasic create mode 100644 Task/Range-extraction/LiveCode/range-extraction-1.livecode create mode 100644 Task/Range-extraction/LiveCode/range-extraction-2.livecode create mode 100644 Task/Range-extraction/LiveCode/range-extraction-3.livecode create mode 100644 Task/Range-extraction/Nim/range-extraction.nim create mode 100644 Task/Range-extraction/Phix/range-extraction.phix create mode 100644 Task/Range-extraction/Swift/range-extraction-1.swift create mode 100644 Task/Range-extraction/Swift/range-extraction-2.swift create mode 100644 Task/Range-extraction/jq/range-extraction.jq create mode 100644 Task/Ranking-methods/Sidef/ranking-methods.sidef create mode 100644 Task/Ranking-methods/Visual-FoxPro/ranking-methods.visual create mode 100644 Task/Ranking-methods/jq/ranking-methods-1.jq create mode 100644 Task/Ranking-methods/jq/ranking-methods-2.jq create mode 100644 Task/Rate-counter/ERRE/rate-counter.erre create mode 100644 Task/Rate-counter/Sidef/rate-counter.sidef create mode 100644 Task/Ray-casting-algorithm/FreeBASIC/ray-casting-algorithm.freebasic create mode 100644 Task/Ray-casting-algorithm/Phix/ray-casting-algorithm.phix create mode 100644 Task/Read-a-configuration-file/EchoLisp/read-a-configuration-file-1.echolisp create mode 100644 Task/Read-a-configuration-file/EchoLisp/read-a-configuration-file-2.echolisp create mode 100644 Task/Read-a-configuration-file/FreeBASIC/read-a-configuration-file.freebasic create mode 100644 Task/Read-a-configuration-file/Lasso/read-a-configuration-file.lasso create mode 100644 Task/Read-a-configuration-file/Peloton/read-a-configuration-file.peloton create mode 100644 Task/Read-a-configuration-file/Sidef/read-a-configuration-file.sidef create mode 100644 Task/Read-a-file-line-by-line/8th/read-a-file-line-by-line.8th create mode 100644 Task/Read-a-file-line-by-line/ERRE/read-a-file-line-by-line.erre create mode 100644 Task/Read-a-file-line-by-line/FreeBASIC/read-a-file-line-by-line.freebasic create mode 100644 Task/Read-a-file-line-by-line/Lasso/read-a-file-line-by-line.lasso create mode 100644 Task/Read-a-file-line-by-line/Lingo/read-a-file-line-by-line.lingo create mode 100644 Task/Read-a-file-line-by-line/LiveCode/read-a-file-line-by-line.livecode create mode 100644 Task/Read-a-file-line-by-line/Nim/read-a-file-line-by-line.nim create mode 100644 Task/Read-a-file-line-by-line/Oforth/read-a-file-line-by-line.oforth create mode 100644 Task/Read-a-file-line-by-line/Phix/read-a-file-line-by-line.phix create mode 100644 Task/Read-a-file-line-by-line/Ring/read-a-file-line-by-line.ring create mode 100644 Task/Read-a-file-line-by-line/Sidef/read-a-file-line-by-line-1.sidef create mode 100644 Task/Read-a-file-line-by-line/Sidef/read-a-file-line-by-line-2.sidef create mode 100644 Task/Read-a-file-line-by-line/Sparkling/read-a-file-line-by-line.sparkling create mode 100644 Task/Read-a-file-line-by-line/Ursa/read-a-file-line-by-line.ursa create mode 100644 Task/Read-a-file-line-by-line/Wart/read-a-file-line-by-line.wart create mode 100644 Task/Read-a-file-line-by-line/jq/read-a-file-line-by-line-1.jq create mode 100644 Task/Read-a-file-line-by-line/jq/read-a-file-line-by-line-2.jq create mode 100644 Task/Read-a-specific-line-from-a-file/FreeBASIC/read-a-specific-line-from-a-file.freebasic create mode 100644 Task/Read-a-specific-line-from-a-file/FutureBasic/read-a-specific-line-from-a-file.futurebasic create mode 100644 Task/Read-a-specific-line-from-a-file/Lasso/read-a-specific-line-from-a-file.lasso create mode 100644 Task/Read-a-specific-line-from-a-file/MoonScript/read-a-specific-line-from-a-file.moon create mode 100644 Task/Read-a-specific-line-from-a-file/Nim/read-a-specific-line-from-a-file.nim create mode 100644 Task/Read-a-specific-line-from-a-file/Ring/read-a-specific-line-from-a-file.ring create mode 100644 Task/Read-a-specific-line-from-a-file/Sidef/read-a-specific-line-from-a-file.sidef create mode 100644 Task/Read-a-specific-line-from-a-file/Ursa/read-a-specific-line-from-a-file.ursa create mode 100644 Task/Read-a-specific-line-from-a-file/jq/read-a-specific-line-from-a-file-1.jq create mode 100644 Task/Read-a-specific-line-from-a-file/jq/read-a-specific-line-from-a-file-2.jq create mode 100644 Task/Read-a-specific-line-from-a-file/jq/read-a-specific-line-from-a-file-3.jq create mode 100644 Task/Read-entire-file/8th/read-entire-file.8th create mode 100644 Task/Read-entire-file/FreeBASIC/read-entire-file.freebasic create mode 100644 Task/Read-entire-file/FutureBasic/read-entire-file.futurebasic create mode 100644 Task/Read-entire-file/LFE/read-entire-file.lfe create mode 100644 Task/Read-entire-file/Lasso/read-entire-file.lasso create mode 100644 Task/Read-entire-file/Lingo/read-entire-file.lingo create mode 100644 Task/Read-entire-file/LiveCode/read-entire-file-1.livecode create mode 100644 Task/Read-entire-file/LiveCode/read-entire-file-2.livecode create mode 100644 Task/Read-entire-file/Nim/read-entire-file.nim create mode 100644 Task/Read-entire-file/Panda/read-entire-file.panda create mode 100644 Task/Read-entire-file/Phix/read-entire-file.phix create mode 100644 Task/Read-entire-file/Ring/read-entire-file-1.ring create mode 100644 Task/Read-entire-file/Ring/read-entire-file-2.ring create mode 100644 Task/Read-entire-file/Ring/read-entire-file-3.ring create mode 100644 Task/Read-entire-file/Sidef/read-entire-file-1.sidef create mode 100644 Task/Read-entire-file/Sidef/read-entire-file-2.sidef create mode 100644 Task/Read-entire-file/Sparkling/read-entire-file.sparkling create mode 100644 Task/Read-entire-file/Swift/read-entire-file.swift create mode 100644 Task/Read-entire-file/Ursa/read-entire-file.ursa create mode 100644 Task/Read-entire-file/Wart/read-entire-file.wart create mode 100644 Task/Read-entire-file/jq/read-entire-file-1.jq create mode 100644 Task/Read-entire-file/jq/read-entire-file-2.jq create mode 100644 Task/Read-entire-file/jq/read-entire-file-3.jq create mode 100644 Task/Real-constants-and-functions/Axe/real-constants-and-functions-1.axe create mode 100644 Task/Real-constants-and-functions/Axe/real-constants-and-functions-2.axe create mode 100644 Task/Real-constants-and-functions/Axe/real-constants-and-functions-3.axe create mode 100644 Task/Real-constants-and-functions/Axe/real-constants-and-functions-4.axe create mode 100644 Task/Real-constants-and-functions/Axe/real-constants-and-functions-5.axe create mode 100644 Task/Real-constants-and-functions/ERRE/real-constants-and-functions.erre create mode 100644 Task/Real-constants-and-functions/Elm/real-constants-and-functions.elm create mode 100644 Task/Real-constants-and-functions/FreeBASIC/real-constants-and-functions.freebasic create mode 100644 Task/Real-constants-and-functions/FutureBasic/real-constants-and-functions.futurebasic create mode 100644 Task/Real-constants-and-functions/Lasso/real-constants-and-functions.lasso create mode 100644 Task/Real-constants-and-functions/Lingo/real-constants-and-functions.lingo create mode 100644 Task/Real-constants-and-functions/LiveCode/real-constants-and-functions.livecode create mode 100644 Task/Real-constants-and-functions/Nim/real-constants-and-functions.nim create mode 100644 Task/Real-constants-and-functions/Oforth/real-constants-and-functions.oforth create mode 100644 Task/Real-constants-and-functions/Phix/real-constants-and-functions.phix create mode 100644 Task/Real-constants-and-functions/Ring/real-constants-and-functions.ring create mode 100644 Task/Real-constants-and-functions/Sidef/real-constants-and-functions.sidef create mode 100644 Task/Real-constants-and-functions/Sparkling/real-constants-and-functions.sparkling create mode 100644 Task/Real-constants-and-functions/Swift/real-constants-and-functions.swift create mode 100644 Task/Real-constants-and-functions/jq/real-constants-and-functions.jq create mode 100644 Task/Record-sound/ChucK/record-sound.chuck create mode 100644 Task/Record-sound/LiveCode/record-sound.livecode create mode 100644 Task/Record-sound/Nim/record-sound.nim create mode 100644 Task/Reduced-row-echelon-form/Phix/reduced-row-echelon-form.phix create mode 100644 Task/Reduced-row-echelon-form/Sidef/reduced-row-echelon-form.sidef create mode 100644 Task/Reduced-row-echelon-form/Swift/reduced-row-echelon-form.swift create mode 100644 Task/Reduced-row-echelon-form/Visual-FoxPro/reduced-row-echelon-form.visual create mode 100644 Task/Regular-expressions/8th/regular-expressions.8th create mode 100644 Task/Regular-expressions/Lasso/regular-expressions.lasso create mode 100644 Task/Regular-expressions/Nim/regular-expressions.nim create mode 100644 Task/Regular-expressions/Sidef/regular-expressions-1.sidef create mode 100644 Task/Regular-expressions/Sidef/regular-expressions-2.sidef create mode 100644 Task/Regular-expressions/Sidef/regular-expressions-3.sidef create mode 100644 Task/Regular-expressions/Swift/regular-expressions-1.swift create mode 100644 Task/Regular-expressions/Swift/regular-expressions-2.swift create mode 100644 Task/Regular-expressions/Swift/regular-expressions-3.swift create mode 100644 Task/Regular-expressions/Swift/regular-expressions-4.swift create mode 100644 Task/Regular-expressions/Swift/regular-expressions-5.swift create mode 100644 Task/Regular-expressions/jq/regular-expressions-1.jq create mode 100644 Task/Regular-expressions/jq/regular-expressions-2.jq create mode 100644 Task/Regular-expressions/jq/regular-expressions-3.jq create mode 100644 Task/Remove-duplicate-elements/CafeOBJ/remove-duplicate-elements.cafeobj create mode 100644 Task/Remove-duplicate-elements/Ceylon/remove-duplicate-elements.ceylon create mode 100644 Task/Remove-duplicate-elements/ECL/remove-duplicate-elements.ecl create mode 100644 Task/Remove-duplicate-elements/FreeBASIC/remove-duplicate-elements.freebasic create mode 100644 Task/Remove-duplicate-elements/Lasso/remove-duplicate-elements.lasso create mode 100644 Task/Remove-duplicate-elements/Nim/remove-duplicate-elements.nim create mode 100644 Task/Remove-duplicate-elements/Phix/remove-duplicate-elements.phix create mode 100644 Task/Remove-duplicate-elements/Ring/remove-duplicate-elements.ring create mode 100644 Task/Remove-duplicate-elements/Sidef/remove-duplicate-elements.sidef create mode 100644 Task/Remove-duplicate-elements/Sparkling/remove-duplicate-elements.sparkling create mode 100644 Task/Remove-duplicate-elements/Swift/remove-duplicate-elements-1.swift create mode 100644 Task/Remove-duplicate-elements/Swift/remove-duplicate-elements-2.swift create mode 100644 Task/Remove-duplicate-elements/Swift/remove-duplicate-elements-3.swift create mode 100644 Task/Remove-duplicate-elements/Visual-FoxPro/remove-duplicate-elements.visual create mode 100644 Task/Remove-duplicate-elements/Wart/remove-duplicate-elements.wart create mode 100644 Task/Remove-duplicate-elements/Wortel/remove-duplicate-elements.wortel create mode 100644 Task/Remove-duplicate-elements/jq/remove-duplicate-elements-1.jq create mode 100644 Task/Remove-duplicate-elements/jq/remove-duplicate-elements-2.jq create mode 100644 Task/Remove-lines-from-a-file/ECL/remove-lines-from-a-file-1.ecl create mode 100644 Task/Remove-lines-from-a-file/ECL/remove-lines-from-a-file-2.ecl create mode 100644 Task/Remove-lines-from-a-file/FreeBASIC/remove-lines-from-a-file.freebasic create mode 100644 Task/Remove-lines-from-a-file/Lasso/remove-lines-from-a-file-1.lasso create mode 100644 Task/Remove-lines-from-a-file/Lasso/remove-lines-from-a-file-2.lasso create mode 100644 Task/Remove-lines-from-a-file/Oforth/remove-lines-from-a-file.oforth create mode 100644 Task/Remove-lines-from-a-file/Ring/remove-lines-from-a-file.ring create mode 100644 Task/Remove-lines-from-a-file/Sidef/remove-lines-from-a-file.sidef create mode 100644 Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-1.jq create mode 100644 Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-2.jq create mode 100644 Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-3.jq create mode 100644 Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-4.jq create mode 100644 Task/Rename-a-file/FreeBASIC/rename-a-file.freebasic create mode 100644 Task/Rename-a-file/Harbour/rename-a-file.harbour create mode 100644 Task/Rename-a-file/LFE/rename-a-file.lfe create mode 100644 Task/Rename-a-file/Lasso/rename-a-file.lasso create mode 100644 Task/Rename-a-file/LiveCode/rename-a-file.livecode create mode 100644 Task/Rename-a-file/Nim/rename-a-file.nim create mode 100644 Task/Rename-a-file/Ring/rename-a-file.ring create mode 100644 Task/Rename-a-file/Sidef/rename-a-file.sidef create mode 100644 Task/Rep-string/EchoLisp/rep-string-1.echolisp create mode 100644 Task/Rep-string/EchoLisp/rep-string-2.echolisp create mode 100644 Task/Rep-string/LFE/rep-string-1.lfe create mode 100644 Task/Rep-string/LFE/rep-string-2.lfe create mode 100644 Task/Rep-string/NGS/rep-string.ngs create mode 100644 Task/Rep-string/Nim/rep-string.nim create mode 100644 Task/Rep-string/Oforth/rep-string.oforth create mode 100644 Task/Rep-string/Sidef/rep-string.sidef create mode 100644 Task/Rep-string/jq/rep-string-1.jq create mode 100644 Task/Rep-string/jq/rep-string-2.jq create mode 100644 Task/Rep-string/jq/rep-string-3.jq create mode 100644 Task/Repeat-a-string/8th/repeat-a-string.8th create mode 100644 Task/Repeat-a-string/Ceylon/repeat-a-string.ceylon create mode 100644 Task/Repeat-a-string/ECL/repeat-a-string-1.ecl create mode 100644 Task/Repeat-a-string/ECL/repeat-a-string-2.ecl create mode 100644 Task/Repeat-a-string/ERRE/repeat-a-string.erre create mode 100644 Task/Repeat-a-string/Egison/repeat-a-string.egison create mode 100644 Task/Repeat-a-string/FreeBASIC/repeat-a-string.freebasic create mode 100644 Task/Repeat-a-string/Harbour/repeat-a-string.harbour create mode 100644 Task/Repeat-a-string/Idris/repeat-a-string.idris create mode 100644 Task/Repeat-a-string/LFE/repeat-a-string.lfe create mode 100644 Task/Repeat-a-string/Lasso/repeat-a-string-1.lasso create mode 100644 Task/Repeat-a-string/Lasso/repeat-a-string-2.lasso create mode 100644 Task/Repeat-a-string/Lingo/repeat-a-string-1.lingo create mode 100644 Task/Repeat-a-string/Lingo/repeat-a-string-2.lingo create mode 100644 Task/Repeat-a-string/Lingo/repeat-a-string-3.lingo create mode 100644 Task/Repeat-a-string/LiveCode/repeat-a-string.livecode create mode 100644 Task/Repeat-a-string/Monte/repeat-a-string.monte create mode 100644 Task/Repeat-a-string/Nim/repeat-a-string.nim create mode 100644 Task/Repeat-a-string/Oforth/repeat-a-string.oforth create mode 100644 Task/Repeat-a-string/Phix/repeat-a-string.phix create mode 100644 Task/Repeat-a-string/Ring/repeat-a-string.ring create mode 100644 Task/Repeat-a-string/Sidef/repeat-a-string.sidef create mode 100644 Task/Repeat-a-string/Sparkling/repeat-a-string.sparkling create mode 100644 Task/Repeat-a-string/Swift/repeat-a-string-1.swift create mode 100644 Task/Repeat-a-string/Swift/repeat-a-string-2.swift create mode 100644 Task/Repeat-a-string/Swift/repeat-a-string-3.swift create mode 100644 Task/Repeat-a-string/Visual-FoxPro/repeat-a-string.visual create mode 100644 Task/Repeat-a-string/Wart/repeat-a-string.wart create mode 100644 Task/Repeat-a-string/Wortel/repeat-a-string-1.wortel create mode 100644 Task/Repeat-a-string/Wortel/repeat-a-string-2.wortel create mode 100644 Task/Repeat-a-string/jq/repeat-a-string.jq create mode 100644 Task/Resistor-mesh/ERRE/resistor-mesh.erre create mode 100644 Task/Resistor-mesh/Sidef/resistor-mesh.sidef create mode 100644 Task/Respond-to-an-unknown-method-call/Lasso/respond-to-an-unknown-method-call.lasso create mode 100644 Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-1.oforth create mode 100644 Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-2.oforth create mode 100644 Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-3.oforth create mode 100644 Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-4.oforth create mode 100644 Task/Respond-to-an-unknown-method-call/Sidef/respond-to-an-unknown-method-call.sidef create mode 100644 Task/Return-multiple-values/ECL/return-multiple-values.ecl create mode 100644 Task/Return-multiple-values/ERRE/return-multiple-values.erre create mode 100644 Task/Return-multiple-values/EchoLisp/return-multiple-values.echolisp create mode 100644 Task/Return-multiple-values/FreeBASIC/return-multiple-values.freebasic create mode 100644 Task/Return-multiple-values/FunL/return-multiple-values.funl create mode 100644 Task/Return-multiple-values/FutureBasic/return-multiple-values-1.futurebasic create mode 100644 Task/Return-multiple-values/FutureBasic/return-multiple-values-2.futurebasic create mode 100644 Task/Return-multiple-values/FutureBasic/return-multiple-values-3.futurebasic create mode 100644 Task/Return-multiple-values/FutureBasic/return-multiple-values-4.futurebasic create mode 100644 Task/Return-multiple-values/Harbour/return-multiple-values.harbour create mode 100644 Task/Return-multiple-values/Lasso/return-multiple-values.lasso create mode 100644 Task/Return-multiple-values/Lily/return-multiple-values.lily create mode 100644 Task/Return-multiple-values/Nim/return-multiple-values-1.nim create mode 100644 Task/Return-multiple-values/Nim/return-multiple-values-2.nim create mode 100644 Task/Return-multiple-values/Oforth/return-multiple-values.oforth create mode 100644 Task/Return-multiple-values/Phix/return-multiple-values.phix create mode 100644 Task/Return-multiple-values/Ring/return-multiple-values.ring create mode 100644 Task/Return-multiple-values/Sidef/return-multiple-values-1.sidef create mode 100644 Task/Return-multiple-values/Sidef/return-multiple-values-2.sidef create mode 100644 Task/Return-multiple-values/Swift/return-multiple-values-1.swift create mode 100644 Task/Return-multiple-values/Swift/return-multiple-values-2.swift create mode 100644 Task/Return-multiple-values/Ursa/return-multiple-values.ursa create mode 100644 Task/Return-multiple-values/Visual-FoxPro/return-multiple-values.visual create mode 100644 Task/Return-multiple-values/jq/return-multiple-values-1.jq create mode 100644 Task/Return-multiple-values/jq/return-multiple-values-2.jq create mode 100644 Task/Reverse-a-string/8th/reverse-a-string.8th create mode 100644 Task/Reverse-a-string/Apex/reverse-a-string-1.apex create mode 100644 Task/Reverse-a-string/Apex/reverse-a-string-2.apex create mode 100644 Task/Reverse-a-string/ERRE/reverse-a-string.erre create mode 100644 Task/Reverse-a-string/EchoLisp/reverse-a-string.echolisp create mode 100644 Task/Reverse-a-string/Elm/reverse-a-string.elm create mode 100644 Task/Reverse-a-string/Ezhil/reverse-a-string.ezhil create mode 100644 Task/Reverse-a-string/FreeBASIC/reverse-a-string.freebasic create mode 100644 Task/Reverse-a-string/FutureBasic/reverse-a-string.futurebasic create mode 100644 Task/Reverse-a-string/GFA-Basic/reverse-a-string.gfa create mode 100644 Task/Reverse-a-string/Harbour/reverse-a-string.harbour create mode 100644 Task/Reverse-a-string/L++/reverse-a-string.lpp create mode 100644 Task/Reverse-a-string/LC3-Assembly/reverse-a-string.lc3 create mode 100644 Task/Reverse-a-string/LFE/reverse-a-string-1.lfe create mode 100644 Task/Reverse-a-string/LFE/reverse-a-string-2.lfe create mode 100644 Task/Reverse-a-string/LFE/reverse-a-string-3.lfe create mode 100644 Task/Reverse-a-string/LFE/reverse-a-string-4.lfe create mode 100644 Task/Reverse-a-string/Lasso/reverse-a-string-1.lasso create mode 100644 Task/Reverse-a-string/Lasso/reverse-a-string-2.lasso create mode 100644 Task/Reverse-a-string/Lingo/reverse-a-string-1.lingo create mode 100644 Task/Reverse-a-string/Lingo/reverse-a-string-2.lingo create mode 100644 Task/Reverse-a-string/LiveCode/reverse-a-string.livecode create mode 100644 Task/Reverse-a-string/Nim/reverse-a-string.nim create mode 100644 Task/Reverse-a-string/Oforth/reverse-a-string.oforth create mode 100644 Task/Reverse-a-string/Peloton/reverse-a-string-1.peloton create mode 100644 Task/Reverse-a-string/Peloton/reverse-a-string-2.peloton create mode 100644 Task/Reverse-a-string/Peloton/reverse-a-string-3.peloton create mode 100644 Task/Reverse-a-string/Phix/reverse-a-string-1.phix create mode 100644 Task/Reverse-a-string/Phix/reverse-a-string-2.phix create mode 100644 Task/Reverse-a-string/Ring/reverse-a-string.ring create mode 100644 Task/Reverse-a-string/SequenceL/reverse-a-string-1.sequencel create mode 100644 Task/Reverse-a-string/SequenceL/reverse-a-string-2.sequencel create mode 100644 Task/Reverse-a-string/Sidef/reverse-a-string.sidef create mode 100644 Task/Reverse-a-string/Swift/reverse-a-string-1.swift create mode 100644 Task/Reverse-a-string/Swift/reverse-a-string-2.swift create mode 100644 Task/Reverse-a-string/Wart/reverse-a-string.wart create mode 100644 Task/Reverse-a-string/Wortel/reverse-a-string.wortel create mode 100644 Task/Reverse-a-string/jq/reverse-a-string.jq create mode 100644 Task/Reverse-words-in-a-string/EchoLisp/reverse-words-in-a-string.echolisp create mode 100644 Task/Reverse-words-in-a-string/Elm/reverse-words-in-a-string.elm create mode 100644 Task/Reverse-words-in-a-string/FreeBASIC/reverse-words-in-a-string.freebasic create mode 100644 Task/Reverse-words-in-a-string/LiveCode/reverse-words-in-a-string.livecode create mode 100644 Task/Reverse-words-in-a-string/LiveScript/reverse-words-in-a-string.live create mode 100644 Task/Reverse-words-in-a-string/Nim/reverse-words-in-a-string.nim create mode 100644 Task/Reverse-words-in-a-string/Oforth/reverse-words-in-a-string.oforth create mode 100644 Task/Reverse-words-in-a-string/Phix/reverse-words-in-a-string.phix create mode 100644 Task/Reverse-words-in-a-string/Ring/reverse-words-in-a-string-1.ring create mode 100644 Task/Reverse-words-in-a-string/Ring/reverse-words-in-a-string-2.ring create mode 100644 Task/Reverse-words-in-a-string/Sidef/reverse-words-in-a-string.sidef create mode 100644 Task/Reverse-words-in-a-string/Sparkling/reverse-words-in-a-string.sparkling create mode 100644 Task/Reverse-words-in-a-string/Swift/reverse-words-in-a-string.swift create mode 100644 Task/Reverse-words-in-a-string/jq/reverse-words-in-a-string-1.jq create mode 100644 Task/Reverse-words-in-a-string/jq/reverse-words-in-a-string-2.jq create mode 100644 Task/Rock-paper-scissors/Lasso/rock-paper-scissors.lasso create mode 100644 Task/Rock-paper-scissors/Phix/rock-paper-scissors.phix create mode 100644 Task/Rock-paper-scissors/Sidef/rock-paper-scissors.sidef create mode 100644 Task/Roman-numerals-Decode/Ceylon/roman-numerals-decode.ceylon create mode 100644 Task/Roman-numerals-Decode/ECL/roman-numerals-decode-1.ecl create mode 100644 Task/Roman-numerals-Decode/ECL/roman-numerals-decode-2.ecl create mode 100644 Task/Roman-numerals-Decode/ERRE/roman-numerals-decode.erre create mode 100644 Task/Roman-numerals-Decode/FreeBASIC/roman-numerals-decode.freebasic create mode 100644 Task/Roman-numerals-Decode/FutureBasic/roman-numerals-decode.futurebasic create mode 100644 Task/Roman-numerals-Decode/Lasso/roman-numerals-decode.lasso create mode 100644 Task/Roman-numerals-Decode/LiveScript/roman-numerals-decode.live create mode 100644 Task/Roman-numerals-Decode/Nim/roman-numerals-decode.nim create mode 100644 Task/Roman-numerals-Decode/Phix/roman-numerals-decode.phix create mode 100644 Task/Roman-numerals-Decode/Red/roman-numerals-decode.red create mode 100644 Task/Roman-numerals-Decode/Ring/roman-numerals-decode.ring create mode 100644 Task/Roman-numerals-Decode/Sidef/roman-numerals-decode-1.sidef create mode 100644 Task/Roman-numerals-Decode/Sidef/roman-numerals-decode-2.sidef create mode 100644 Task/Roman-numerals-Decode/Swift/roman-numerals-decode-1.swift create mode 100644 Task/Roman-numerals-Decode/Swift/roman-numerals-decode-2.swift create mode 100644 Task/Roman-numerals-Decode/XLISP/roman-numerals-decode-1.xlisp create mode 100644 Task/Roman-numerals-Decode/XLISP/roman-numerals-decode-2.xlisp create mode 100644 Task/Roman-numerals-Decode/jq/roman-numerals-decode-1.jq create mode 100644 Task/Roman-numerals-Decode/jq/roman-numerals-decode-2.jq create mode 100644 Task/Roman-numerals-Decode/jq/roman-numerals-decode-3.jq create mode 100644 Task/Roman-numerals-Encode/Ceylon/roman-numerals-encode.ceylon create mode 100644 Task/Roman-numerals-Encode/ECL/roman-numerals-encode.ecl create mode 100644 Task/Roman-numerals-Encode/ERRE/roman-numerals-encode.erre create mode 100644 Task/Roman-numerals-Encode/FreeBASIC/roman-numerals-encode.freebasic create mode 100644 Task/Roman-numerals-Encode/FutureBasic/roman-numerals-encode.futurebasic create mode 100644 Task/Roman-numerals-Encode/Lasso/roman-numerals-encode.lasso create mode 100644 Task/Roman-numerals-Encode/LiveCode/roman-numerals-encode.livecode create mode 100644 Task/Roman-numerals-Encode/Nim/roman-numerals-encode.nim create mode 100644 Task/Roman-numerals-Encode/Oforth/roman-numerals-encode.oforth create mode 100644 Task/Roman-numerals-Encode/Peloton/roman-numerals-encode-1.peloton create mode 100644 Task/Roman-numerals-Encode/Peloton/roman-numerals-encode-2.peloton create mode 100644 Task/Roman-numerals-Encode/Phix/roman-numerals-encode.phix create mode 100644 Task/Roman-numerals-Encode/Red/roman-numerals-encode-1.red create mode 100644 Task/Roman-numerals-Encode/Red/roman-numerals-encode-2.red create mode 100644 Task/Roman-numerals-Encode/Red/roman-numerals-encode-3.red create mode 100644 Task/Roman-numerals-Encode/Ring/roman-numerals-encode.ring create mode 100644 Task/Roman-numerals-Encode/Sidef/roman-numerals-encode.sidef create mode 100644 Task/Roman-numerals-Encode/Swift/roman-numerals-encode-1.swift create mode 100644 Task/Roman-numerals-Encode/Swift/roman-numerals-encode-2.swift create mode 100644 Task/Roman-numerals-Encode/Swift/roman-numerals-encode-3.swift create mode 100644 Task/Roman-numerals-Encode/XLISP/roman-numerals-encode.xlisp create mode 100644 Task/Roots-of-a-function/ERRE/roots-of-a-function.erre create mode 100644 Task/Roots-of-a-function/EchoLisp/roots-of-a-function.echolisp create mode 100644 Task/Roots-of-a-function/Oforth/roots-of-a-function.oforth create mode 100644 Task/Roots-of-a-function/Ring/roots-of-a-function.ring create mode 100644 Task/Roots-of-a-function/Sidef/roots-of-a-function.sidef create mode 100644 Task/Roots-of-a-function/jq/roots-of-a-function-1.jq create mode 100644 Task/Roots-of-a-function/jq/roots-of-a-function-2.jq create mode 100644 Task/Roots-of-a-quadratic-function/ERRE/roots-of-a-quadratic-function.erre create mode 100644 Task/Roots-of-a-quadratic-function/Ring/roots-of-a-quadratic-function.ring create mode 100644 Task/Roots-of-a-quadratic-function/Sidef/roots-of-a-quadratic-function.sidef create mode 100644 Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-1.jq create mode 100644 Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-2.jq create mode 100644 Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-3.jq create mode 100644 Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-4.jq create mode 100644 Task/Roots-of-unity/ERRE/roots-of-unity.erre create mode 100644 Task/Roots-of-unity/EchoLisp/roots-of-unity.echolisp create mode 100644 Task/Roots-of-unity/FunL/roots-of-unity.funl create mode 100644 Task/Roots-of-unity/FutureBasic/roots-of-unity.futurebasic create mode 100644 Task/Roots-of-unity/Nim/roots-of-unity.nim create mode 100644 Task/Roots-of-unity/Ring/roots-of-unity.ring create mode 100644 Task/Roots-of-unity/Sidef/roots-of-unity-1.sidef create mode 100644 Task/Roots-of-unity/Sidef/roots-of-unity-2.sidef create mode 100644 Task/Roots-of-unity/Sparkling/roots-of-unity.sparkling create mode 100644 Task/Roots-of-unity/jq/roots-of-unity-1.jq create mode 100644 Task/Roots-of-unity/jq/roots-of-unity-2.jq create mode 100644 Task/Rot-13/ERRE/rot-13.erre create mode 100644 Task/Rot-13/FreeBASIC/rot-13.freebasic create mode 100644 Task/Rot-13/FunL/rot-13.funl create mode 100644 Task/Rot-13/Lasso/rot-13-1.lasso create mode 100644 Task/Rot-13/Lasso/rot-13-2.lasso create mode 100644 Task/Rot-13/LiveCode/rot-13.livecode create mode 100644 Task/Rot-13/Nim/rot-13.nim create mode 100644 Task/Rot-13/Oforth/rot-13.oforth create mode 100644 Task/Rot-13/Phix/rot-13.phix create mode 100644 Task/Rot-13/Ring/rot-13.ring create mode 100644 Task/Rot-13/Sidef/rot-13.sidef create mode 100644 Task/Rot-13/Swift/rot-13.swift create mode 100644 Task/Rot-13/Wart/rot-13-1.wart create mode 100644 Task/Rot-13/Wart/rot-13-2.wart create mode 100644 Task/Rot-13/jq/rot-13-1.jq create mode 100644 Task/Rot-13/jq/rot-13-2.jq create mode 100644 Task/Run-length-encoding/Lasso/run-length-encoding.lasso create mode 100644 Task/Run-length-encoding/LiveCode/run-length-encoding.livecode create mode 100644 Task/Run-length-encoding/Nim/run-length-encoding.nim create mode 100644 Task/Run-length-encoding/Oforth/run-length-encoding.oforth create mode 100644 Task/Run-length-encoding/Phix/run-length-encoding.phix create mode 100644 Task/Run-length-encoding/Sidef/run-length-encoding-1.sidef create mode 100644 Task/Run-length-encoding/Sidef/run-length-encoding-2.sidef create mode 100644 Task/Run-length-encoding/Swift/run-length-encoding-1.swift create mode 100644 Task/Run-length-encoding/Swift/run-length-encoding-2.swift create mode 100644 Task/Run-length-encoding/Swift/run-length-encoding-3.swift create mode 100644 Task/Run-length-encoding/Swift/run-length-encoding-4.swift create mode 100644 Task/Run-length-encoding/jq/run-length-encoding-1.jq create mode 100644 Task/Run-length-encoding/jq/run-length-encoding-2.jq create mode 100644 Task/Run-length-encoding/jq/run-length-encoding-3.jq create mode 100644 Task/Run-length-encoding/jq/run-length-encoding-4.jq create mode 100644 Task/Runge-Kutta-method/ERRE/runge-kutta-method.erre create mode 100644 Task/Runge-Kutta-method/FreeBASIC/runge-kutta-method.freebasic create mode 100644 Task/Runge-Kutta-method/FutureBasic/runge-kutta-method.futurebasic create mode 100644 Task/Runge-Kutta-method/Ring/runge-kutta-method.ring create mode 100644 Task/Runge-Kutta-method/Sidef/runge-kutta-method.sidef create mode 100644 Task/Runge-Kutta-method/Swift/runge-kutta-method.swift create mode 100644 Task/Runge-Kutta-method/jq/runge-kutta-method-1.jq create mode 100644 Task/Runge-Kutta-method/jq/runge-kutta-method-2.jq create mode 100644 Task/Runge-Kutta-method/jq/runge-kutta-method-3.jq create mode 100644 Task/Runge-Kutta-method/jq/runge-kutta-method-4.jq create mode 100644 Task/Runge-Kutta-method/jq/runge-kutta-method-5.jq create mode 100644 Task/Runge-Kutta-method/jq/runge-kutta-method-6.jq create mode 100644 Task/Runge-Kutta-method/jq/runge-kutta-method-7.jq create mode 100644 Task/Runge-Kutta-method/jq/runge-kutta-method-8.jq create mode 100644 Task/Runtime-evaluation-In-an-environment/EchoLisp/runtime-evaluation-in-an-environment.echolisp create mode 100644 Task/Runtime-evaluation-In-an-environment/Ring/runtime-evaluation-in-an-environment.ring create mode 100644 Task/Runtime-evaluation-In-an-environment/Sidef/runtime-evaluation-in-an-environment.sidef create mode 100644 Task/Runtime-evaluation/EchoLisp/runtime-evaluation.echolisp create mode 100644 Task/Runtime-evaluation/Harbour/runtime-evaluation.harbour create mode 100644 Task/Runtime-evaluation/Lasso/runtime-evaluation.lasso create mode 100644 Task/Runtime-evaluation/Oforth/runtime-evaluation-1.oforth create mode 100644 Task/Runtime-evaluation/Oforth/runtime-evaluation-2.oforth create mode 100644 Task/Runtime-evaluation/Ring/runtime-evaluation-1.ring create mode 100644 Task/Runtime-evaluation/Ring/runtime-evaluation-2.ring create mode 100644 Task/Runtime-evaluation/Ring/runtime-evaluation-3.ring create mode 100644 Task/Runtime-evaluation/Ring/runtime-evaluation-4.ring create mode 100644 Task/Runtime-evaluation/Sidef/runtime-evaluation.sidef create mode 100644 Task/Runtime-evaluation/Sparkling/runtime-evaluation-1.sparkling create mode 100644 Task/Runtime-evaluation/Sparkling/runtime-evaluation-2.sparkling create mode 100644 Task/Runtime-evaluation/Sparkling/runtime-evaluation-3.sparkling create mode 100644 Task/Runtime-evaluation/Ursa/runtime-evaluation.ursa create mode 100644 Task/S-Expressions/Ceylon/s-expressions-1.ceylon create mode 100644 Task/S-Expressions/Ceylon/s-expressions-2.ceylon create mode 100644 Task/S-Expressions/EchoLisp/s-expressions.echolisp create mode 100644 Task/S-Expressions/Phix/s-expressions.phix create mode 100644 Task/S-Expressions/Potion/s-expressions.potion create mode 100644 Task/S-Expressions/Sidef/s-expressions.sidef create mode 100644 Task/SEDOLs/FreeBASIC/sedols.freebasic create mode 100644 Task/SEDOLs/Nim/sedols.nim create mode 100644 Task/SEDOLs/Oforth/sedols.oforth create mode 100644 Task/SEDOLs/Phix/sedols.phix create mode 100644 Task/SEDOLs/Potion/sedols.potion create mode 100644 Task/SEDOLs/Ring/sedols.ring create mode 100644 Task/SEDOLs/Sidef/sedols.sidef create mode 100644 Task/SEDOLs/Visual-FoxPro/sedols.visual create mode 100644 Task/SEDOLs/jq/sedols.jq create mode 100644 Task/SHA-1/FreeBASIC/sha-1.freebasic create mode 100644 Task/SHA-1/Lasso/sha-1.lasso create mode 100644 Task/SHA-1/LiveCode/sha-1.livecode create mode 100644 Task/SHA-1/Nim/sha-1.nim create mode 100644 Task/SHA-1/Sidef/sha-1.sidef create mode 100644 Task/SHA-256/FreeBASIC/sha-256.freebasic create mode 100644 Task/SHA-256/FunL/sha-256-1.funl create mode 100644 Task/SHA-256/FunL/sha-256-2.funl create mode 100644 Task/SHA-256/FunL/sha-256-3.funl create mode 100644 Task/SHA-256/Lasso/sha-256.lasso create mode 100644 Task/SHA-256/Nim/sha-256.nim create mode 100644 Task/SHA-256/Phix/sha-256-1.phix create mode 100644 Task/SHA-256/Phix/sha-256-2.phix create mode 100644 Task/SHA-256/Sidef/sha-256.sidef create mode 100644 Task/SOAP/Uniface/soap.uniface create mode 100644 Task/SQL-based-authentication/Sidef/sql-based-authentication.sidef create mode 100644 Task/Safe-addition/Nim/safe-addition.nim create mode 100644 Task/Safe-addition/Phix/safe-addition.phix create mode 100644 Task/Same-Fringe/Sidef/same-fringe.sidef create mode 100644 Task/Same-Fringe/jq/same-fringe-1.jq create mode 100644 Task/Same-Fringe/jq/same-fringe-2.jq create mode 100644 Task/Same-Fringe/jq/same-fringe-3.jq create mode 100644 Task/Same-Fringe/jq/same-fringe-4.jq create mode 100644 Task/Scope-Function-names-and-labels/Sidef/scope-function-names-and-labels.sidef create mode 100644 Task/Scope-Function-names-and-labels/jq/scope-function-names-and-labels-1.jq create mode 100644 Task/Scope-Function-names-and-labels/jq/scope-function-names-and-labels-2.jq create mode 100644 Task/Scope-Function-names-and-labels/jq/scope-function-names-and-labels-3.jq create mode 100644 Task/Scope-modifiers/Nim/scope-modifiers.nim create mode 100644 Task/Search-a-list/Ceylon/search-a-list.ceylon create mode 100644 Task/Search-a-list/Lasso/search-a-list.lasso create mode 100644 Task/Search-a-list/Lingo/search-a-list.lingo create mode 100644 Task/Search-a-list/Nim/search-a-list.nim create mode 100644 Task/Search-a-list/Oforth/search-a-list.oforth create mode 100644 Task/Search-a-list/Phix/search-a-list.phix create mode 100644 Task/Search-a-list/Ring/search-a-list.ring create mode 100644 Task/Search-a-list/Sidef/search-a-list-1.sidef create mode 100644 Task/Search-a-list/Sidef/search-a-list-2.sidef create mode 100644 Task/Search-a-list/Swift/search-a-list-1.swift create mode 100644 Task/Search-a-list/Swift/search-a-list-2.swift create mode 100644 Task/Search-a-list/Swift/search-a-list-3.swift create mode 100644 Task/Search-a-list/Wart/search-a-list.wart create mode 100644 Task/Search-a-list/jq/search-a-list.jq create mode 100644 Task/Secure-temporary-file/Sidef/secure-temporary-file.sidef create mode 100644 Task/Self-describing-numbers/FreeBASIC/self-describing-numbers.freebasic create mode 100644 Task/Self-describing-numbers/LiveCode/self-describing-numbers-1.livecode create mode 100644 Task/Self-describing-numbers/LiveCode/self-describing-numbers-2.livecode create mode 100644 Task/Self-describing-numbers/LiveCode/self-describing-numbers-3.livecode create mode 100644 Task/Self-describing-numbers/Nim/self-describing-numbers.nim create mode 100644 Task/Self-describing-numbers/Phix/self-describing-numbers.phix create mode 100644 Task/Self-describing-numbers/Sidef/self-describing-numbers-1.sidef create mode 100644 Task/Self-describing-numbers/Sidef/self-describing-numbers-2.sidef create mode 100644 Task/Self-describing-numbers/jq/self-describing-numbers-1.jq create mode 100644 Task/Self-describing-numbers/jq/self-describing-numbers-2.jq create mode 100644 Task/Self-describing-numbers/jq/self-describing-numbers-3.jq create mode 100644 Task/Self-describing-numbers/jq/self-describing-numbers-4.jq create mode 100644 Task/Self-referential-sequence/EchoLisp/self-referential-sequence-1.echolisp create mode 100644 Task/Self-referential-sequence/EchoLisp/self-referential-sequence-2.echolisp create mode 100644 Task/Self-referential-sequence/jq/self-referential-sequence-1.jq create mode 100644 Task/Self-referential-sequence/jq/self-referential-sequence-2.jq create mode 100644 Task/Semiprime/ERRE/semiprime.erre create mode 100644 Task/Semiprime/EchoLisp/semiprime.echolisp create mode 100644 Task/Semiprime/Oforth/semiprime.oforth create mode 100644 Task/Semiprime/Ring/semiprime.ring create mode 100644 Task/Semiprime/Sidef/semiprime.sidef create mode 100644 Task/Semiprime/Swift/semiprime.swift create mode 100644 Task/Semordnilap/8th/semordnilap.8th create mode 100644 Task/Semordnilap/EchoLisp/semordnilap.echolisp create mode 100644 Task/Semordnilap/FreeBASIC/semordnilap.freebasic create mode 100644 Task/Semordnilap/Lasso/semordnilap.lasso create mode 100644 Task/Semordnilap/Nim/semordnilap.nim create mode 100644 Task/Semordnilap/Oforth/semordnilap.oforth create mode 100644 Task/Semordnilap/Phix/semordnilap.phix create mode 100644 Task/Semordnilap/Ring/semordnilap.ring create mode 100644 Task/Semordnilap/Sidef/semordnilap.sidef create mode 100644 Task/Semordnilap/jq/semordnilap.jq create mode 100644 Task/Send-an-unknown-method-call/Lasso/send-an-unknown-method-call.lasso create mode 100644 Task/Send-an-unknown-method-call/Lingo/send-an-unknown-method-call.lingo create mode 100644 Task/Send-an-unknown-method-call/Oforth/send-an-unknown-method-call-1.oforth create mode 100644 Task/Send-an-unknown-method-call/Oforth/send-an-unknown-method-call-2.oforth create mode 100644 Task/Send-an-unknown-method-call/Sidef/send-an-unknown-method-call.sidef create mode 100644 Task/Send-email/Lasso/send-email.lasso create mode 100644 Task/Send-email/Lingo/send-email.lingo create mode 100644 Task/Send-email/LiveCode/send-email.livecode create mode 100644 Task/Send-email/Nim/send-email.nim create mode 100644 Task/Send-email/Ring/send-email.ring create mode 100644 Task/Sequence-of-non-squares/EchoLisp/sequence-of-non-squares.echolisp create mode 100644 Task/Sequence-of-non-squares/FreeBASIC/sequence-of-non-squares.freebasic create mode 100644 Task/Sequence-of-non-squares/Nim/sequence-of-non-squares.nim create mode 100644 Task/Sequence-of-non-squares/Oforth/sequence-of-non-squares.oforth create mode 100644 Task/Sequence-of-non-squares/Phix/sequence-of-non-squares.phix create mode 100644 Task/Sequence-of-non-squares/Ring/sequence-of-non-squares.ring create mode 100644 Task/Sequence-of-non-squares/Sidef/sequence-of-non-squares.sidef create mode 100644 Task/Sequence-of-non-squares/XLISP/sequence-of-non-squares.xlisp create mode 100644 Task/Sequence-of-non-squares/jq/sequence-of-non-squares-1.jq create mode 100644 Task/Sequence-of-non-squares/jq/sequence-of-non-squares-2.jq create mode 100644 Task/Sequence-of-primes-by-Trial-Division/ERRE/sequence-of-primes-by-trial-division.erre create mode 100644 Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-1.echolisp create mode 100644 Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-2.echolisp create mode 100644 Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-3.echolisp create mode 100644 Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-4.echolisp create mode 100644 Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-5.echolisp create mode 100644 Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-6.echolisp create mode 100644 Task/Sequence-of-primes-by-Trial-Division/FreeBASIC/sequence-of-primes-by-trial-division.freebasic create mode 100644 Task/Sequence-of-primes-by-Trial-Division/Oforth/sequence-of-primes-by-trial-division.oforth create mode 100644 Task/Sequence-of-primes-by-Trial-Division/Ring/sequence-of-primes-by-trial-division.ring create mode 100644 Task/Sequence-of-primes-by-Trial-Division/Sidef/sequence-of-primes-by-trial-division.sidef create mode 100644 Task/Sequence-of-primes-by-Trial-Division/Swift/sequence-of-primes-by-trial-division-1.swift create mode 100644 Task/Sequence-of-primes-by-Trial-Division/Swift/sequence-of-primes-by-trial-division-2.swift create mode 100644 Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-1.jq create mode 100644 Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-2.jq create mode 100644 Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-3.jq create mode 100644 Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-4.jq create mode 100644 Task/Set-consolidation/EchoLisp/set-consolidation.echolisp create mode 100644 Task/Set-consolidation/Egison/set-consolidation-1.egison create mode 100644 Task/Set-consolidation/Egison/set-consolidation-2.egison create mode 100644 Task/Set-consolidation/Sidef/set-consolidation.sidef create mode 100644 Task/Set-consolidation/jq/set-consolidation-1.jq create mode 100644 Task/Set-consolidation/jq/set-consolidation-2.jq create mode 100644 Task/Set-consolidation/jq/set-consolidation-3.jq create mode 100644 Task/Set-consolidation/jq/set-consolidation-4.jq create mode 100644 Task/Set-of-real-numbers/EchoLisp/set-of-real-numbers-1.echolisp create mode 100644 Task/Set-of-real-numbers/EchoLisp/set-of-real-numbers-2.echolisp create mode 100644 Task/Set-puzzle/EchoLisp/set-puzzle.echolisp create mode 100644 Task/Set/Apex/set.apex create mode 100644 Task/Set/EchoLisp/set.echolisp create mode 100644 Task/Set/FunL/set.funl create mode 100644 Task/Set/LFE/set.lfe create mode 100644 Task/Set/Lasso/set.lasso create mode 100644 Task/Set/Nim/set.nim create mode 100644 Task/Set/Sidef/set-1.sidef create mode 100644 Task/Set/Sidef/set-2.sidef create mode 100644 Task/Set/Swift/set.swift create mode 100644 Task/Set/jq/set-1.jq create mode 100644 Task/Set/jq/set-10.jq create mode 100644 Task/Set/jq/set-11.jq create mode 100644 Task/Set/jq/set-12.jq create mode 100644 Task/Set/jq/set-13.jq create mode 100644 Task/Set/jq/set-2.jq create mode 100644 Task/Set/jq/set-3.jq create mode 100644 Task/Set/jq/set-4.jq create mode 100644 Task/Set/jq/set-5.jq create mode 100644 Task/Set/jq/set-6.jq create mode 100644 Task/Set/jq/set-7.jq create mode 100644 Task/Set/jq/set-8.jq create mode 100644 Task/Set/jq/set-9.jq create mode 100644 Task/Seven-sided-dice-from-five-sided-dice/Sidef/seven-sided-dice-from-five-sided-dice.sidef create mode 100644 Task/Shell-one-liner/FreeBASIC/shell-one-liner.freebasic create mode 100644 Task/Shell-one-liner/FutureBasic/shell-one-liner.futurebasic create mode 100644 Task/Shell-one-liner/Lasso/shell-one-liner-1.lasso create mode 100644 Task/Shell-one-liner/Lasso/shell-one-liner-2.lasso create mode 100644 Task/Shell-one-liner/Oforth/shell-one-liner.oforth create mode 100644 Task/Shell-one-liner/Ring/shell-one-liner.ring create mode 100644 Task/Shell-one-liner/Sidef/shell-one-liner.sidef create mode 100644 Task/Shell-one-liner/Wart/shell-one-liner.wart create mode 100644 Task/Shell-one-liner/jq/shell-one-liner.jq create mode 100644 Task/Short-circuit-evaluation/Axe/short-circuit-evaluation.axe create mode 100644 Task/Short-circuit-evaluation/FreeBASIC/short-circuit-evaluation.freebasic create mode 100644 Task/Short-circuit-evaluation/LiveCode/short-circuit-evaluation.livecode create mode 100644 Task/Short-circuit-evaluation/Nim/short-circuit-evaluation.nim create mode 100644 Task/Short-circuit-evaluation/Phix/short-circuit-evaluation.phix create mode 100644 Task/Short-circuit-evaluation/Sidef/short-circuit-evaluation.sidef create mode 100644 Task/Short-circuit-evaluation/Swift/short-circuit-evaluation.swift create mode 100644 Task/Short-circuit-evaluation/Visual-FoxPro/short-circuit-evaluation.visual create mode 100644 Task/Short-circuit-evaluation/jq/short-circuit-evaluation-1.jq create mode 100644 Task/Short-circuit-evaluation/jq/short-circuit-evaluation-2.jq create mode 100644 Task/Show-the-epoch/FreeBASIC/show-the-epoch.freebasic create mode 100644 Task/Show-the-epoch/FutureBasic/show-the-epoch.futurebasic create mode 100644 Task/Show-the-epoch/Lasso/show-the-epoch.lasso create mode 100644 Task/Show-the-epoch/LiveCode/show-the-epoch.livecode create mode 100644 Task/Show-the-epoch/Nim/show-the-epoch.nim create mode 100644 Task/Show-the-epoch/Oforth/show-the-epoch.oforth create mode 100644 Task/Show-the-epoch/Ring/show-the-epoch.ring create mode 100644 Task/Show-the-epoch/Sidef/show-the-epoch.sidef create mode 100644 Task/Show-the-epoch/jq/show-the-epoch-1.jq create mode 100644 Task/Show-the-epoch/jq/show-the-epoch-2.jq create mode 100644 Task/Sierpinski-carpet/ERRE/sierpinski-carpet.erre create mode 100644 Task/Sierpinski-carpet/Nim/sierpinski-carpet.nim create mode 100644 Task/Sierpinski-carpet/Oforth/sierpinski-carpet.oforth create mode 100644 Task/Sierpinski-carpet/Phix/sierpinski-carpet.phix create mode 100644 Task/Sierpinski-carpet/Ring/sierpinski-carpet.ring create mode 100644 Task/Sierpinski-carpet/Sidef/sierpinski-carpet.sidef create mode 100644 Task/Sierpinski-carpet/Swift/sierpinski-carpet.swift create mode 100644 Task/Sierpinski-carpet/jq/sierpinski-carpet-1.jq create mode 100644 Task/Sierpinski-carpet/jq/sierpinski-carpet-2.jq create mode 100644 Task/Sierpinski-triangle-Graphical/ERRE/sierpinski-triangle-graphical.erre create mode 100644 Task/Sierpinski-triangle-Graphical/FreeBASIC/sierpinski-triangle-graphical.freebasic create mode 100644 Task/Sierpinski-triangle-Graphical/Ring/sierpinski-triangle-graphical.ring create mode 100644 Task/Sierpinski-triangle-Graphical/Sidef/sierpinski-triangle-graphical.sidef create mode 100644 Task/Sierpinski-triangle/Elm/sierpinski-triangle.elm create mode 100644 Task/Sierpinski-triangle/Nim/sierpinski-triangle.nim create mode 100644 Task/Sierpinski-triangle/Oforth/sierpinski-triangle.oforth create mode 100644 Task/Sierpinski-triangle/Phix/sierpinski-triangle.phix create mode 100644 Task/Sierpinski-triangle/Sidef/sierpinski-triangle.sidef create mode 100644 Task/Sierpinski-triangle/Swift/sierpinski-triangle.swift create mode 100644 Task/Sieve-of-Eratosthenes/68000-Assembly/sieve-of-eratosthenes.68000 create mode 100644 Task/Sieve-of-Eratosthenes/ERRE/sieve-of-eratosthenes.erre create mode 100644 Task/Sieve-of-Eratosthenes/EchoLisp/sieve-of-eratosthenes-1.echolisp create mode 100644 Task/Sieve-of-Eratosthenes/EchoLisp/sieve-of-eratosthenes-2.echolisp create mode 100644 Task/Sieve-of-Eratosthenes/EchoLisp/sieve-of-eratosthenes-3.echolisp create mode 100644 Task/Sieve-of-Eratosthenes/FreeBASIC/sieve-of-eratosthenes.freebasic create mode 100644 Task/Sieve-of-Eratosthenes/FutureBasic/sieve-of-eratosthenes.futurebasic create mode 100644 Task/Sieve-of-Eratosthenes/JOVIAL/sieve-of-eratosthenes.jovial create mode 100644 Task/Sieve-of-Eratosthenes/LiveCode/sieve-of-eratosthenes-1.livecode create mode 100644 Task/Sieve-of-Eratosthenes/LiveCode/sieve-of-eratosthenes-2.livecode create mode 100644 Task/Sieve-of-Eratosthenes/Nim/sieve-of-eratosthenes-1.nim create mode 100644 Task/Sieve-of-Eratosthenes/Nim/sieve-of-eratosthenes-2.nim create mode 100644 Task/Sieve-of-Eratosthenes/Oforth/sieve-of-eratosthenes.oforth create mode 100644 Task/Sieve-of-Eratosthenes/Phix/sieve-of-eratosthenes.phix create mode 100644 Task/Sieve-of-Eratosthenes/Ring/sieve-of-eratosthenes.ring create mode 100644 Task/Sieve-of-Eratosthenes/Sidef/sieve-of-eratosthenes.sidef create mode 100644 Task/Sieve-of-Eratosthenes/Swift/sieve-of-eratosthenes.swift create mode 100644 Task/Sieve-of-Eratosthenes/jq/sieve-of-eratosthenes-1.jq create mode 100644 Task/Sieve-of-Eratosthenes/jq/sieve-of-eratosthenes-2.jq create mode 100644 Task/Sieve-of-Eratosthenes/jq/sieve-of-eratosthenes-3.jq create mode 100644 Task/Simple-database/Phix/simple-database.phix create mode 100644 Task/Simple-database/ToffeeScript/simple-database.toffee create mode 100644 Task/Simple-windowed-application/B4J/simple-windowed-application-1.b4j create mode 100644 Task/Simple-windowed-application/B4J/simple-windowed-application-2.b4j create mode 100644 Task/Simple-windowed-application/EchoLisp/simple-windowed-application.echolisp create mode 100644 Task/Simple-windowed-application/FreeBASIC/simple-windowed-application.freebasic create mode 100644 Task/Simple-windowed-application/Lingo/simple-windowed-application.lingo create mode 100644 Task/Simple-windowed-application/Nim/simple-windowed-application.nim create mode 100644 Task/Simple-windowed-application/Phix/simple-windowed-application.phix create mode 100644 Task/Simple-windowed-application/Ring/simple-windowed-application.ring create mode 100644 Task/Simple-windowed-application/Sidef/simple-windowed-application.sidef create mode 100644 Task/Singleton/Lasso/singleton-1.lasso create mode 100644 Task/Singleton/Lasso/singleton-2.lasso create mode 100644 Task/Singleton/Lingo/singleton.lingo create mode 100644 Task/Singleton/Nim/singleton-1.nim create mode 100644 Task/Singleton/Nim/singleton-2.nim create mode 100644 Task/Singleton/Oforth/singleton-1.oforth create mode 100644 Task/Singleton/Oforth/singleton-2.oforth create mode 100644 Task/Singleton/Sidef/singleton.sidef create mode 100644 Task/Singly-linked-list-Element-definition/Axe/singly-linked-list-element-definition.axe create mode 100644 Task/Singly-linked-list-Element-definition/Nim/singly-linked-list-element-definition.nim create mode 100644 Task/Singly-linked-list-Element-definition/Oforth/singly-linked-list-element-definition.oforth create mode 100644 Task/Singly-linked-list-Element-definition/SSEM/singly-linked-list-element-definition.ssem create mode 100644 Task/Singly-linked-list-Element-definition/Sidef/singly-linked-list-element-definition.sidef create mode 100644 Task/Singly-linked-list-Element-insertion/Axe/singly-linked-list-element-insertion.axe create mode 100644 Task/Singly-linked-list-Element-insertion/EchoLisp/singly-linked-list-element-insertion.echolisp create mode 100644 Task/Singly-linked-list-Element-insertion/Nim/singly-linked-list-element-insertion.nim create mode 100644 Task/Singly-linked-list-Element-insertion/Oforth/singly-linked-list-element-insertion.oforth create mode 100644 Task/Singly-linked-list-Element-insertion/Sidef/singly-linked-list-element-insertion.sidef create mode 100644 Task/Singly-linked-list-Traversal/Axe/singly-linked-list-traversal.axe create mode 100644 Task/Singly-linked-list-Traversal/Computer-zero-Assembly/singly-linked-list-traversal.computer create mode 100644 Task/Singly-linked-list-Traversal/EchoLisp/singly-linked-list-traversal.echolisp create mode 100644 Task/Singly-linked-list-Traversal/Nim/singly-linked-list-traversal.nim create mode 100644 Task/Singly-linked-list-Traversal/Oforth/singly-linked-list-traversal.oforth create mode 100644 Task/Singly-linked-list-Traversal/Peloton/singly-linked-list-traversal-1.peloton create mode 100644 Task/Singly-linked-list-Traversal/Peloton/singly-linked-list-traversal-2.peloton create mode 100644 Task/Singly-linked-list-Traversal/SSEM/singly-linked-list-traversal.ssem create mode 100644 Task/Singly-linked-list-Traversal/Sidef/singly-linked-list-traversal.sidef create mode 100644 Task/Singly-linked-list-Traversal/Wart/singly-linked-list-traversal.wart create mode 100644 Task/Singly-linked-list-Traversal/jq/singly-linked-list-traversal.jq create mode 100644 Task/Sleep/8051-Assembly/sleep.8051 create mode 100644 Task/Sleep/8th/sleep.8th create mode 100644 Task/Sleep/AntLang/sleep.antlang create mode 100644 Task/Sleep/Axe/sleep.axe create mode 100644 Task/Sleep/ERRE/sleep.erre create mode 100644 Task/Sleep/FreeBASIC/sleep.freebasic create mode 100644 Task/Sleep/Lasso/sleep.lasso create mode 100644 Task/Sleep/Lingo/sleep.lingo create mode 100644 Task/Sleep/Nim/sleep.nim create mode 100644 Task/Sleep/Oforth/sleep.oforth create mode 100644 Task/Sleep/Peloton/sleep-1.peloton create mode 100644 Task/Sleep/Peloton/sleep-2.peloton create mode 100644 Task/Sleep/Peloton/sleep-3.peloton create mode 100644 Task/Sleep/Phix/sleep.phix create mode 100644 Task/Sleep/Ring/sleep.ring create mode 100644 Task/Sleep/Sidef/sleep.sidef create mode 100644 Task/Sleep/Swift/sleep.swift create mode 100644 Task/Sleep/Ursa/sleep.ursa create mode 100644 Task/Sockets/Lasso/sockets.lasso create mode 100644 Task/Sockets/Nim/sockets.nim create mode 100644 Task/Sockets/Ring/sockets.ring create mode 100644 Task/Sockets/Sidef/sockets.sidef create mode 100644 Task/Sockets/Symsyn/sockets.symsyn create mode 100644 Task/Solve-a-Hidato-puzzle/Nim/solve-a-hidato-puzzle.nim create mode 100644 Task/Solve-a-Hidato-puzzle/Phix/solve-a-hidato-puzzle.phix create mode 100644 Task/Solve-a-Holy-Knights-tour/Phix/solve-a-holy-knights-tour.phix create mode 100644 Task/Solve-a-Hopido-puzzle/Phix/solve-a-hopido-puzzle.phix create mode 100644 Task/Solve-a-Numbrix-puzzle/Phix/solve-a-numbrix-puzzle.phix create mode 100644 Task/Solve-the-no-connection-puzzle/Phix/solve-the-no-connection-puzzle.phix create mode 100644 Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-1.jq create mode 100644 Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-2.jq create mode 100644 Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-3.jq create mode 100644 Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-4.jq create mode 100644 Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-5.jq create mode 100644 Task/Sort-an-array-of-composite-structures/EchoLisp/sort-an-array-of-composite-structures.echolisp create mode 100644 Task/Sort-an-array-of-composite-structures/Nim/sort-an-array-of-composite-structures.nim create mode 100644 Task/Sort-an-array-of-composite-structures/Oforth/sort-an-array-of-composite-structures.oforth create mode 100644 Task/Sort-an-array-of-composite-structures/Phix/sort-an-array-of-composite-structures.phix create mode 100644 Task/Sort-an-array-of-composite-structures/Sidef/sort-an-array-of-composite-structures.sidef create mode 100644 Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-1.jq create mode 100644 Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-2.jq create mode 100644 Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-3.jq create mode 100644 Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-4.jq create mode 100644 Task/Sort-an-integer-array/8th/sort-an-integer-array.8th create mode 100644 Task/Sort-an-integer-array/Axe/sort-an-integer-array.axe create mode 100644 Task/Sort-an-integer-array/FreeBASIC/sort-an-integer-array.freebasic create mode 100644 Task/Sort-an-integer-array/FunL/sort-an-integer-array.funl create mode 100644 Task/Sort-an-integer-array/Lasso/sort-an-integer-array.lasso create mode 100644 Task/Sort-an-integer-array/Lingo/sort-an-integer-array.lingo create mode 100644 Task/Sort-an-integer-array/LiveCode/sort-an-integer-array.livecode create mode 100644 Task/Sort-an-integer-array/Nim/sort-an-integer-array.nim create mode 100644 Task/Sort-an-integer-array/Oforth/sort-an-integer-array.oforth create mode 100644 Task/Sort-an-integer-array/Peloton/sort-an-integer-array-1.peloton create mode 100644 Task/Sort-an-integer-array/Peloton/sort-an-integer-array-2.peloton create mode 100644 Task/Sort-an-integer-array/Phix/sort-an-integer-array.phix create mode 100644 Task/Sort-an-integer-array/Potion/sort-an-integer-array.potion create mode 100644 Task/Sort-an-integer-array/Ring/sort-an-integer-array.ring create mode 100644 Task/Sort-an-integer-array/Sidef/sort-an-integer-array.sidef create mode 100644 Task/Sort-an-integer-array/Sparkling/sort-an-integer-array.sparkling create mode 100644 Task/Sort-an-integer-array/Swift/sort-an-integer-array-1.swift create mode 100644 Task/Sort-an-integer-array/Swift/sort-an-integer-array-2.swift create mode 100644 Task/Sort-an-integer-array/Swift/sort-an-integer-array-3.swift create mode 100644 Task/Sort-an-integer-array/Swift/sort-an-integer-array-4.swift create mode 100644 Task/Sort-an-integer-array/Swift/sort-an-integer-array-5.swift create mode 100644 Task/Sort-an-integer-array/Swift/sort-an-integer-array-6.swift create mode 100644 Task/Sort-an-integer-array/Swift/sort-an-integer-array-7.swift create mode 100644 Task/Sort-an-integer-array/Swift/sort-an-integer-array-8.swift create mode 100644 Task/Sort-an-integer-array/Swift/sort-an-integer-array-9.swift create mode 100644 Task/Sort-an-integer-array/Ursa/sort-an-integer-array.ursa create mode 100644 Task/Sort-an-integer-array/Wortel/sort-an-integer-array.wortel create mode 100644 Task/Sort-an-integer-array/jq/sort-an-integer-array.jq create mode 100644 Task/Sort-disjoint-sublist/ERRE/sort-disjoint-sublist.erre create mode 100644 Task/Sort-disjoint-sublist/EchoLisp/sort-disjoint-sublist.echolisp create mode 100644 Task/Sort-disjoint-sublist/Nim/sort-disjoint-sublist.nim create mode 100644 Task/Sort-disjoint-sublist/Phix/sort-disjoint-sublist.phix create mode 100644 Task/Sort-disjoint-sublist/Sidef/sort-disjoint-sublist.sidef create mode 100644 Task/Sort-disjoint-sublist/Swift/sort-disjoint-sublist.swift create mode 100644 Task/Sort-disjoint-sublist/jq/sort-disjoint-sublist-1.jq create mode 100644 Task/Sort-disjoint-sublist/jq/sort-disjoint-sublist-2.jq create mode 100644 Task/Sort-stability/Lasso/sort-stability-1.lasso create mode 100644 Task/Sort-stability/Lasso/sort-stability-2.lasso create mode 100644 Task/Sort-stability/Lasso/sort-stability-3.lasso create mode 100644 Task/Sort-stability/Ring/sort-stability.ring create mode 100644 Task/Sort-stability/Sidef/sort-stability.sidef create mode 100644 Task/Sort-using-a-custom-comparator/Ceylon/sort-using-a-custom-comparator.ceylon create mode 100644 Task/Sort-using-a-custom-comparator/FreeBASIC/sort-using-a-custom-comparator.freebasic create mode 100644 Task/Sort-using-a-custom-comparator/FunL/sort-using-a-custom-comparator.funl create mode 100644 Task/Sort-using-a-custom-comparator/Nim/sort-using-a-custom-comparator.nim create mode 100644 Task/Sort-using-a-custom-comparator/Oforth/sort-using-a-custom-comparator.oforth create mode 100644 Task/Sort-using-a-custom-comparator/Phix/sort-using-a-custom-comparator.phix create mode 100644 Task/Sort-using-a-custom-comparator/Sidef/sort-using-a-custom-comparator.sidef create mode 100644 Task/Sort-using-a-custom-comparator/Swift/sort-using-a-custom-comparator-1.swift create mode 100644 Task/Sort-using-a-custom-comparator/Swift/sort-using-a-custom-comparator-2.swift create mode 100644 Task/Sort-using-a-custom-comparator/jq/sort-using-a-custom-comparator-1.jq create mode 100644 Task/Sort-using-a-custom-comparator/jq/sort-using-a-custom-comparator-2.jq create mode 100644 Task/Sort-using-a-custom-comparator/jq/sort-using-a-custom-comparator-3.jq create mode 100644 Task/Sorting-algorithms-Bead-sort/Nim/sorting-algorithms-bead-sort.nim create mode 100644 Task/Sorting-algorithms-Bead-sort/Phix/sorting-algorithms-bead-sort.phix create mode 100644 Task/Sorting-algorithms-Bead-sort/Sidef/sorting-algorithms-bead-sort.sidef create mode 100644 Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-1.jq create mode 100644 Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-2.jq create mode 100644 Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-3.jq create mode 100644 Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-4.jq create mode 100644 Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-5.jq create mode 100644 Task/Sorting-algorithms-Bogosort/Nim/sorting-algorithms-bogosort.nim create mode 100644 Task/Sorting-algorithms-Bogosort/Phix/sorting-algorithms-bogosort.phix create mode 100644 Task/Sorting-algorithms-Bogosort/Sidef/sorting-algorithms-bogosort.sidef create mode 100644 Task/Sorting-algorithms-Bogosort/Swift/sorting-algorithms-bogosort.swift create mode 100644 Task/Sorting-algorithms-Bubble-sort/ERRE/sorting-algorithms-bubble-sort.erre create mode 100644 Task/Sorting-algorithms-Bubble-sort/EchoLisp/sorting-algorithms-bubble-sort.echolisp create mode 100644 Task/Sorting-algorithms-Bubble-sort/Ezhil/sorting-algorithms-bubble-sort.ezhil create mode 100644 Task/Sorting-algorithms-Bubble-sort/FreeBASIC/sorting-algorithms-bubble-sort.freebasic create mode 100644 Task/Sorting-algorithms-Bubble-sort/Nim/sorting-algorithms-bubble-sort.nim create mode 100644 Task/Sorting-algorithms-Bubble-sort/Phix/sorting-algorithms-bubble-sort.phix create mode 100644 Task/Sorting-algorithms-Bubble-sort/Ra/sorting-algorithms-bubble-sort.ra create mode 100644 Task/Sorting-algorithms-Bubble-sort/Ring/sorting-algorithms-bubble-sort.ring create mode 100644 Task/Sorting-algorithms-Bubble-sort/Sidef/sorting-algorithms-bubble-sort.sidef create mode 100644 Task/Sorting-algorithms-Bubble-sort/Swift/sorting-algorithms-bubble-sort.swift create mode 100644 Task/Sorting-algorithms-Bubble-sort/jq/sorting-algorithms-bubble-sort-1.jq create mode 100644 Task/Sorting-algorithms-Bubble-sort/jq/sorting-algorithms-bubble-sort-2.jq create mode 100644 Task/Sorting-algorithms-Bubble-sort/jq/sorting-algorithms-bubble-sort-3.jq create mode 100644 Task/Sorting-algorithms-Cocktail-sort/FreeBASIC/sorting-algorithms-cocktail-sort.freebasic create mode 100644 Task/Sorting-algorithms-Cocktail-sort/Nim/sorting-algorithms-cocktail-sort.nim create mode 100644 Task/Sorting-algorithms-Cocktail-sort/Phix/sorting-algorithms-cocktail-sort.phix create mode 100644 Task/Sorting-algorithms-Cocktail-sort/Ring/sorting-algorithms-cocktail-sort.ring create mode 100644 Task/Sorting-algorithms-Cocktail-sort/Sidef/sorting-algorithms-cocktail-sort-1.sidef create mode 100644 Task/Sorting-algorithms-Cocktail-sort/Sidef/sorting-algorithms-cocktail-sort-2.sidef create mode 100644 Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-1.jq create mode 100644 Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-2.jq create mode 100644 Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-3.jq create mode 100644 Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-4.jq create mode 100644 Task/Sorting-algorithms-Comb-sort/FreeBASIC/sorting-algorithms-comb-sort.freebasic create mode 100644 Task/Sorting-algorithms-Comb-sort/Nim/sorting-algorithms-comb-sort.nim create mode 100644 Task/Sorting-algorithms-Comb-sort/Phix/sorting-algorithms-comb-sort.phix create mode 100644 Task/Sorting-algorithms-Comb-sort/Ring/sorting-algorithms-comb-sort.ring create mode 100644 Task/Sorting-algorithms-Comb-sort/Sidef/sorting-algorithms-comb-sort.sidef create mode 100644 Task/Sorting-algorithms-Comb-sort/Swift/sorting-algorithms-comb-sort.swift create mode 100644 Task/Sorting-algorithms-Comb-sort/jq/sorting-algorithms-comb-sort.jq create mode 100644 Task/Sorting-algorithms-Counting-sort/FreeBASIC/sorting-algorithms-counting-sort.freebasic create mode 100644 Task/Sorting-algorithms-Counting-sort/Nim/sorting-algorithms-counting-sort.nim create mode 100644 Task/Sorting-algorithms-Counting-sort/Phix/sorting-algorithms-counting-sort.phix create mode 100644 Task/Sorting-algorithms-Counting-sort/Ring/sorting-algorithms-counting-sort.ring create mode 100644 Task/Sorting-algorithms-Counting-sort/Sidef/sorting-algorithms-counting-sort.sidef create mode 100644 Task/Sorting-algorithms-Counting-sort/jq/sorting-algorithms-counting-sort-1.jq create mode 100644 Task/Sorting-algorithms-Counting-sort/jq/sorting-algorithms-counting-sort-2.jq create mode 100644 Task/Sorting-algorithms-Counting-sort/jq/sorting-algorithms-counting-sort-3.jq create mode 100644 Task/Sorting-algorithms-Gnome-sort/FreeBASIC/sorting-algorithms-gnome-sort.freebasic create mode 100644 Task/Sorting-algorithms-Gnome-sort/Nim/sorting-algorithms-gnome-sort.nim create mode 100644 Task/Sorting-algorithms-Gnome-sort/Phix/sorting-algorithms-gnome-sort.phix create mode 100644 Task/Sorting-algorithms-Gnome-sort/Ring/sorting-algorithms-gnome-sort.ring create mode 100644 Task/Sorting-algorithms-Gnome-sort/Sidef/sorting-algorithms-gnome-sort.sidef create mode 100644 Task/Sorting-algorithms-Gnome-sort/jq/sorting-algorithms-gnome-sort-1.jq create mode 100644 Task/Sorting-algorithms-Gnome-sort/jq/sorting-algorithms-gnome-sort-2.jq create mode 100644 Task/Sorting-algorithms-Gnome-sort/jq/sorting-algorithms-gnome-sort-3.jq create mode 100644 Task/Sorting-algorithms-Heapsort/EchoLisp/sorting-algorithms-heapsort.echolisp create mode 100644 Task/Sorting-algorithms-Heapsort/FreeBASIC/sorting-algorithms-heapsort.freebasic create mode 100644 Task/Sorting-algorithms-Heapsort/FunL/sorting-algorithms-heapsort.funl create mode 100644 Task/Sorting-algorithms-Heapsort/Nim/sorting-algorithms-heapsort.nim create mode 100644 Task/Sorting-algorithms-Heapsort/Phix/sorting-algorithms-heapsort.phix create mode 100644 Task/Sorting-algorithms-Heapsort/Sidef/sorting-algorithms-heapsort.sidef create mode 100644 Task/Sorting-algorithms-Heapsort/Swift/sorting-algorithms-heapsort.swift create mode 100644 Task/Sorting-algorithms-Insertion-sort/Commodore-BASIC/sorting-algorithms-insertion-sort.commodore create mode 100644 Task/Sorting-algorithms-Insertion-sort/ERRE/sorting-algorithms-insertion-sort.erre create mode 100644 Task/Sorting-algorithms-Insertion-sort/FreeBASIC/sorting-algorithms-insertion-sort.freebasic create mode 100644 Task/Sorting-algorithms-Insertion-sort/Nim/sorting-algorithms-insertion-sort.nim create mode 100644 Task/Sorting-algorithms-Insertion-sort/Oforth/sorting-algorithms-insertion-sort.oforth create mode 100644 Task/Sorting-algorithms-Insertion-sort/Phix/sorting-algorithms-insertion-sort.phix create mode 100644 Task/Sorting-algorithms-Insertion-sort/Ring/sorting-algorithms-insertion-sort.ring create mode 100644 Task/Sorting-algorithms-Insertion-sort/Sidef/sorting-algorithms-insertion-sort.sidef create mode 100644 Task/Sorting-algorithms-Insertion-sort/Swift/sorting-algorithms-insertion-sort.swift create mode 100644 Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-1.jq create mode 100644 Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-2.jq create mode 100644 Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-3.jq create mode 100644 Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-4.jq create mode 100644 Task/Sorting-algorithms-Merge-sort/Crystal/sorting-algorithms-merge-sort.crystal create mode 100644 Task/Sorting-algorithms-Merge-sort/ERRE/sorting-algorithms-merge-sort.erre create mode 100644 Task/Sorting-algorithms-Merge-sort/FunL/sorting-algorithms-merge-sort.funl create mode 100644 Task/Sorting-algorithms-Merge-sort/Nim/sorting-algorithms-merge-sort.nim create mode 100644 Task/Sorting-algorithms-Merge-sort/Phix/sorting-algorithms-merge-sort.phix create mode 100644 Task/Sorting-algorithms-Merge-sort/Sidef/sorting-algorithms-merge-sort.sidef create mode 100644 Task/Sorting-algorithms-Merge-sort/Swift/sorting-algorithms-merge-sort.swift create mode 100644 Task/Sorting-algorithms-Merge-sort/jq/sorting-algorithms-merge-sort-1.jq create mode 100644 Task/Sorting-algorithms-Merge-sort/jq/sorting-algorithms-merge-sort-2.jq create mode 100644 Task/Sorting-algorithms-Pancake-sort/Nim/sorting-algorithms-pancake-sort.nim create mode 100644 Task/Sorting-algorithms-Pancake-sort/Phix/sorting-algorithms-pancake-sort.phix create mode 100644 Task/Sorting-algorithms-Pancake-sort/Ring/sorting-algorithms-pancake-sort.ring create mode 100644 Task/Sorting-algorithms-Pancake-sort/Sidef/sorting-algorithms-pancake-sort.sidef create mode 100644 Task/Sorting-algorithms-Pancake-sort/Swift/sorting-algorithms-pancake-sort.swift create mode 100644 Task/Sorting-algorithms-Pancake-sort/jq/sorting-algorithms-pancake-sort-1.jq create mode 100644 Task/Sorting-algorithms-Pancake-sort/jq/sorting-algorithms-pancake-sort-2.jq create mode 100644 Task/Sorting-algorithms-Pancake-sort/jq/sorting-algorithms-pancake-sort-3.jq create mode 100644 Task/Sorting-algorithms-Permutation-sort/EchoLisp/sorting-algorithms-permutation-sort.echolisp create mode 100644 Task/Sorting-algorithms-Permutation-sort/Nim/sorting-algorithms-permutation-sort.nim create mode 100644 Task/Sorting-algorithms-Permutation-sort/Phix/sorting-algorithms-permutation-sort.phix create mode 100644 Task/Sorting-algorithms-Permutation-sort/Sidef/sorting-algorithms-permutation-sort.sidef create mode 100644 Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-1.jq create mode 100644 Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-2.jq create mode 100644 Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-3.jq create mode 100644 Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-4.jq create mode 100644 Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-5.jq create mode 100644 Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-6.jq create mode 100644 Task/Sorting-algorithms-Quicksort/Crystal/sorting-algorithms-quicksort.crystal create mode 100644 Task/Sorting-algorithms-Quicksort/ERRE/sorting-algorithms-quicksort.erre create mode 100644 Task/Sorting-algorithms-Quicksort/EchoLisp/sorting-algorithms-quicksort-1.echolisp create mode 100644 Task/Sorting-algorithms-Quicksort/EchoLisp/sorting-algorithms-quicksort-2.echolisp create mode 100644 Task/Sorting-algorithms-Quicksort/Eero/sorting-algorithms-quicksort-1.eero create mode 100644 Task/Sorting-algorithms-Quicksort/Eero/sorting-algorithms-quicksort-2.eero create mode 100644 Task/Sorting-algorithms-Quicksort/FreeBASIC/sorting-algorithms-quicksort.freebasic create mode 100644 Task/Sorting-algorithms-Quicksort/FunL/sorting-algorithms-quicksort-1.funl create mode 100644 Task/Sorting-algorithms-Quicksort/FunL/sorting-algorithms-quicksort-2.funl create mode 100644 Task/Sorting-algorithms-Quicksort/Lobster/sorting-algorithms-quicksort.lobster create mode 100644 Task/Sorting-algorithms-Quicksort/Mond/sorting-algorithms-quicksort-1.mond create mode 100644 Task/Sorting-algorithms-Quicksort/Mond/sorting-algorithms-quicksort-2.mond create mode 100644 Task/Sorting-algorithms-Quicksort/Nim/sorting-algorithms-quicksort.nim create mode 100644 Task/Sorting-algorithms-Quicksort/Nix/sorting-algorithms-quicksort.nix create mode 100644 Task/Sorting-algorithms-Quicksort/Oforth/sorting-algorithms-quicksort.oforth create mode 100644 Task/Sorting-algorithms-Quicksort/Phix/sorting-algorithms-quicksort.phix create mode 100644 Task/Sorting-algorithms-Quicksort/Sidef/sorting-algorithms-quicksort.sidef create mode 100644 Task/Sorting-algorithms-Quicksort/Swift/sorting-algorithms-quicksort.swift create mode 100644 Task/Sorting-algorithms-Quicksort/Wart/sorting-algorithms-quicksort.wart create mode 100644 Task/Sorting-algorithms-Quicksort/jq/sorting-algorithms-quicksort-1.jq create mode 100644 Task/Sorting-algorithms-Quicksort/jq/sorting-algorithms-quicksort-2.jq create mode 100644 Task/Sorting-algorithms-Quicksort/jq/sorting-algorithms-quicksort-3.jq create mode 100644 Task/Sorting-algorithms-Radix-sort/Phix/sorting-algorithms-radix-sort.phix create mode 100644 Task/Sorting-algorithms-Radix-sort/Sidef/sorting-algorithms-radix-sort.sidef create mode 100644 Task/Sorting-algorithms-Radix-sort/jq/sorting-algorithms-radix-sort-1.jq create mode 100644 Task/Sorting-algorithms-Radix-sort/jq/sorting-algorithms-radix-sort-2.jq create mode 100644 Task/Sorting-algorithms-Selection-sort/EchoLisp/sorting-algorithms-selection-sort-1.echolisp create mode 100644 Task/Sorting-algorithms-Selection-sort/EchoLisp/sorting-algorithms-selection-sort-2.echolisp create mode 100644 Task/Sorting-algorithms-Selection-sort/FreeBASIC/sorting-algorithms-selection-sort.freebasic create mode 100644 Task/Sorting-algorithms-Selection-sort/Nim/sorting-algorithms-selection-sort.nim create mode 100644 Task/Sorting-algorithms-Selection-sort/Oforth/sorting-algorithms-selection-sort.oforth create mode 100644 Task/Sorting-algorithms-Selection-sort/Phix/sorting-algorithms-selection-sort.phix create mode 100644 Task/Sorting-algorithms-Selection-sort/Ra/sorting-algorithms-selection-sort.ra create mode 100644 Task/Sorting-algorithms-Selection-sort/Ring/sorting-algorithms-selection-sort.ring create mode 100644 Task/Sorting-algorithms-Selection-sort/Sidef/sorting-algorithms-selection-sort.sidef create mode 100644 Task/Sorting-algorithms-Selection-sort/Swift/sorting-algorithms-selection-sort.swift create mode 100644 Task/Sorting-algorithms-Selection-sort/jq/sorting-algorithms-selection-sort-1.jq create mode 100644 Task/Sorting-algorithms-Selection-sort/jq/sorting-algorithms-selection-sort-2.jq create mode 100644 Task/Sorting-algorithms-Shell-sort/FreeBASIC/sorting-algorithms-shell-sort.freebasic create mode 100644 Task/Sorting-algorithms-Shell-sort/Nim/sorting-algorithms-shell-sort.nim create mode 100644 Task/Sorting-algorithms-Shell-sort/Phix/sorting-algorithms-shell-sort.phix create mode 100644 Task/Sorting-algorithms-Shell-sort/Ring/sorting-algorithms-shell-sort.ring create mode 100644 Task/Sorting-algorithms-Shell-sort/Sidef/sorting-algorithms-shell-sort.sidef create mode 100644 Task/Sorting-algorithms-Shell-sort/Swift/sorting-algorithms-shell-sort.swift create mode 100644 Task/Sorting-algorithms-Shell-sort/jq/sorting-algorithms-shell-sort-1.jq create mode 100644 Task/Sorting-algorithms-Shell-sort/jq/sorting-algorithms-shell-sort-2.jq create mode 100644 Task/Sorting-algorithms-Shell-sort/jq/sorting-algorithms-shell-sort-3.jq create mode 100644 Task/Sorting-algorithms-Sleep-sort/FreeBASIC/sorting-algorithms-sleep-sort.freebasic create mode 100644 Task/Sorting-algorithms-Sleep-sort/Nim/sorting-algorithms-sleep-sort.nim create mode 100644 Task/Sorting-algorithms-Sleep-sort/Oforth/sorting-algorithms-sleep-sort.oforth create mode 100644 Task/Sorting-algorithms-Sleep-sort/Phix/sorting-algorithms-sleep-sort.phix create mode 100644 Task/Sorting-algorithms-Sleep-sort/Sidef/sorting-algorithms-sleep-sort.sidef create mode 100644 Task/Sorting-algorithms-Sleep-sort/Swift/sorting-algorithms-sleep-sort.swift create mode 100644 Task/Sorting-algorithms-Sleep-sort/jq/sorting-algorithms-sleep-sort.jq create mode 100644 Task/Sorting-algorithms-Stooge-sort/FreeBASIC/sorting-algorithms-stooge-sort.freebasic create mode 100644 Task/Sorting-algorithms-Stooge-sort/Nim/sorting-algorithms-stooge-sort.nim create mode 100644 Task/Sorting-algorithms-Stooge-sort/Phix/sorting-algorithms-stooge-sort.phix create mode 100644 Task/Sorting-algorithms-Stooge-sort/Ring/sorting-algorithms-stooge-sort.ring create mode 100644 Task/Sorting-algorithms-Stooge-sort/Sidef/sorting-algorithms-stooge-sort.sidef create mode 100644 Task/Sorting-algorithms-Stooge-sort/Swift/sorting-algorithms-stooge-sort.swift create mode 100644 Task/Sorting-algorithms-Stooge-sort/jq/sorting-algorithms-stooge-sort-1.jq create mode 100644 Task/Sorting-algorithms-Stooge-sort/jq/sorting-algorithms-stooge-sort-2.jq create mode 100644 Task/Sorting-algorithms-Stooge-sort/jq/sorting-algorithms-stooge-sort-3.jq create mode 100644 Task/Sorting-algorithms-Strand-sort/Nim/sorting-algorithms-strand-sort.nim create mode 100644 Task/Sorting-algorithms-Strand-sort/Phix/sorting-algorithms-strand-sort.phix create mode 100644 Task/Sorting-algorithms-Strand-sort/Sidef/sorting-algorithms-strand-sort.sidef create mode 100644 Task/Sorting-algorithms-Strand-sort/jq/sorting-algorithms-strand-sort.jq create mode 100644 Task/Soundex/FutureBasic/soundex.futurebasic create mode 100644 Task/Soundex/Sidef/soundex.sidef create mode 100644 Task/Sparkline-in-unicode/LiveCode/sparkline-in-unicode.livecode create mode 100644 Task/Sparkline-in-unicode/Nim/sparkline-in-unicode.nim create mode 100644 Task/Sparkline-in-unicode/Sidef/sparkline-in-unicode.sidef create mode 100644 Task/Sparkline-in-unicode/jq/sparkline-in-unicode.jq create mode 100644 Task/Special-characters/Lasso/special-characters.lasso create mode 100644 Task/Special-characters/Lingo/special-characters.lingo create mode 100644 Task/Special-characters/Nim/special-characters-1.nim create mode 100644 Task/Special-characters/Nim/special-characters-2.nim create mode 100644 Task/Special-characters/Nim/special-characters-3.nim create mode 100644 Task/Special-characters/jq/special-characters.jq create mode 100644 Task/Special-variables/Lasso/special-variables-1.lasso create mode 100644 Task/Special-variables/Lasso/special-variables-2.lasso create mode 100644 Task/Special-variables/LiveCode/special-variables-1.livecode create mode 100644 Task/Special-variables/LiveCode/special-variables-2.livecode create mode 100644 Task/Special-variables/Ursa/special-variables.ursa create mode 100644 Task/Special-variables/XLISP/special-variables-1.xlisp create mode 100644 Task/Special-variables/XLISP/special-variables-2.xlisp create mode 100644 Task/Special-variables/jq/special-variables.jq create mode 100644 Task/Speech-synthesis/Sidef/speech-synthesis.sidef create mode 100644 Task/Speech-synthesis/Swift/speech-synthesis.swift create mode 100644 Task/Spiral-matrix/FreeBASIC/spiral-matrix.freebasic create mode 100644 Task/Spiral-matrix/Nim/spiral-matrix.nim create mode 100644 Task/Spiral-matrix/Phix/spiral-matrix.phix create mode 100644 Task/Spiral-matrix/Sidef/spiral-matrix.sidef create mode 100644 Task/Spiral-matrix/jq/spiral-matrix-1.jq create mode 100644 Task/Spiral-matrix/jq/spiral-matrix-2.jq create mode 100644 Task/Stable-marriage-problem/EchoLisp/stable-marriage-problem.echolisp create mode 100644 Task/Stable-marriage-problem/Sidef/stable-marriage-problem.sidef create mode 100644 Task/Stable-marriage-problem/Swift/stable-marriage-problem.swift create mode 100644 Task/Stack-traces/Lasso/stack-traces-1.lasso create mode 100644 Task/Stack-traces/Lasso/stack-traces-2.lasso create mode 100644 Task/Stack-traces/Nim/stack-traces.nim create mode 100644 Task/Stack-traces/Oforth/stack-traces.oforth create mode 100644 Task/Stack/Axe/stack.axe create mode 100644 Task/Stack/EchoLisp/stack.echolisp create mode 100644 Task/Stack/Lasso/stack.lasso create mode 100644 Task/Stack/Lingo/stack.lingo create mode 100644 Task/Stack/Nim/stack.nim create mode 100644 Task/Stack/Oforth/stack-1.oforth create mode 100644 Task/Stack/Oforth/stack-2.oforth create mode 100644 Task/Stack/Phix/stack-1.phix create mode 100644 Task/Stack/Phix/stack-2.phix create mode 100644 Task/Stack/Phix/stack-3.phix create mode 100644 Task/Stack/Sidef/stack-1.sidef create mode 100644 Task/Stack/Sidef/stack-2.sidef create mode 100644 Task/Stack/Swift/stack.swift create mode 100644 Task/Stack/Wart/stack.wart create mode 100644 Task/Stack/XLISP/stack-1.xlisp create mode 100644 Task/Stack/XLISP/stack-2.xlisp create mode 100644 Task/Stair-climbing-puzzle/EchoLisp/stair-climbing-puzzle.echolisp create mode 100644 Task/Stair-climbing-puzzle/Nim/stair-climbing-puzzle.nim create mode 100644 Task/Stair-climbing-puzzle/Phix/stair-climbing-puzzle.phix create mode 100644 Task/Stair-climbing-puzzle/Ring/stair-climbing-puzzle.ring create mode 100644 Task/Stair-climbing-puzzle/Sidef/stair-climbing-puzzle.sidef create mode 100644 Task/Stair-climbing-puzzle/Swift/stair-climbing-puzzle-1.swift create mode 100644 Task/Stair-climbing-puzzle/Swift/stair-climbing-puzzle-2.swift create mode 100644 Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-1.jq create mode 100644 Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-2.jq create mode 100644 Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-3.jq create mode 100644 Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-4.jq create mode 100644 Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-5.jq create mode 100644 Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-6.jq create mode 100644 Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-7.jq create mode 100644 Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-8.jq create mode 100644 Task/Start-from-a-main-routine/FreeBASIC/start-from-a-main-routine.freebasic create mode 100644 Task/Start-from-a-main-routine/Oforth/start-from-a-main-routine-1.oforth create mode 100644 Task/Start-from-a-main-routine/Oforth/start-from-a-main-routine-2.oforth create mode 100644 Task/Start-from-a-main-routine/Phix/start-from-a-main-routine.phix create mode 100644 Task/State-name-puzzle/LiveCode/state-name-puzzle.livecode create mode 100644 Task/State-name-puzzle/jq/state-name-puzzle-1.jq create mode 100644 Task/State-name-puzzle/jq/state-name-puzzle-2.jq create mode 100644 Task/State-name-puzzle/jq/state-name-puzzle-3.jq create mode 100644 Task/Statistics-Basic/FreeBASIC/statistics-basic.freebasic create mode 100644 Task/Statistics-Basic/Hy/statistics-basic.hy create mode 100644 Task/Statistics-Basic/Lasso/statistics-basic.lasso create mode 100644 Task/Statistics-Basic/Nim/statistics-basic.nim create mode 100644 Task/Statistics-Basic/Oforth/statistics-basic.oforth create mode 100644 Task/Statistics-Basic/Sidef/statistics-basic.sidef create mode 100644 Task/Stem-and-leaf-plot/Ceylon/stem-and-leaf-plot.ceylon create mode 100644 Task/Stem-and-leaf-plot/FreeBASIC/stem-and-leaf-plot.freebasic create mode 100644 Task/Stem-and-leaf-plot/Phix/stem-and-leaf-plot.phix create mode 100644 Task/Stem-and-leaf-plot/Sidef/stem-and-leaf-plot.sidef create mode 100644 Task/Stem-and-leaf-plot/jq/stem-and-leaf-plot-1.jq create mode 100644 Task/Stem-and-leaf-plot/jq/stem-and-leaf-plot-2.jq create mode 100644 Task/Stem-and-leaf-plot/jq/stem-and-leaf-plot-3.jq create mode 100644 Task/Stern-Brocot-sequence/EchoLisp/stern-brocot-sequence-1.echolisp create mode 100644 Task/Stern-Brocot-sequence/EchoLisp/stern-brocot-sequence-2.echolisp create mode 100644 Task/Stern-Brocot-sequence/EchoLisp/stern-brocot-sequence-3.echolisp create mode 100644 Task/Stern-Brocot-sequence/Oforth/stern-brocot-sequence.oforth create mode 100644 Task/Stern-Brocot-sequence/Sidef/stern-brocot-sequence.sidef create mode 100644 Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-1.jq create mode 100644 Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-2.jq create mode 100644 Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-3.jq create mode 100644 Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-4.jq create mode 100644 Task/String-append/Axe/string-append.axe create mode 100644 Task/String-append/EchoLisp/string-append.echolisp create mode 100644 Task/String-append/FreeBASIC/string-append.freebasic create mode 100644 Task/String-append/Lasso/string-append.lasso create mode 100644 Task/String-append/Lingo/string-append.lingo create mode 100644 Task/String-append/LiveCode/string-append.livecode create mode 100644 Task/String-append/Nim/string-append.nim create mode 100644 Task/String-append/Oforth/string-append.oforth create mode 100644 Task/String-append/Phix/string-append.phix create mode 100644 Task/String-append/Ring/string-append.ring create mode 100644 Task/String-append/Sidef/string-append.sidef create mode 100644 Task/String-append/Swift/string-append.swift create mode 100644 Task/String-append/Ursa/string-append.ursa create mode 100644 Task/String-append/Wart/string-append.wart create mode 100644 Task/String-append/jq/string-append-1.jq create mode 100644 Task/String-append/jq/string-append-2.jq create mode 100644 Task/String-case/ECL/string-case.ecl create mode 100644 Task/String-case/EchoLisp/string-case.echolisp create mode 100644 Task/String-case/Elm/string-case.elm create mode 100644 Task/String-case/FreeBASIC/string-case.freebasic create mode 100644 Task/String-case/FutureBasic/string-case.futurebasic create mode 100644 Task/String-case/Lasso/string-case.lasso create mode 100644 Task/String-case/Lingo/string-case-1.lingo create mode 100644 Task/String-case/Lingo/string-case-2.lingo create mode 100644 Task/String-case/LiveCode/string-case.livecode create mode 100644 Task/String-case/Nim/string-case.nim create mode 100644 Task/String-case/Oforth/string-case.oforth create mode 100644 Task/String-case/Peloton/string-case-1.peloton create mode 100644 Task/String-case/Peloton/string-case-2.peloton create mode 100644 Task/String-case/Phix/string-case.phix create mode 100644 Task/String-case/Potion/string-case.potion create mode 100644 Task/String-case/Powerbuilder/string-case.powerbuilder create mode 100644 Task/String-case/Ring/string-case.ring create mode 100644 Task/String-case/Sidef/string-case.sidef create mode 100644 Task/String-case/Swift/string-case.swift create mode 100644 Task/String-case/Ursa/string-case.ursa create mode 100644 Task/String-case/jq/string-case-1.jq create mode 100644 Task/String-case/jq/string-case-2.jq create mode 100644 Task/String-comparison/Apex/string-comparison.apex create mode 100644 Task/String-comparison/FreeBASIC/string-comparison.freebasic create mode 100644 Task/String-comparison/Harbour/string-comparison-1.harbour create mode 100644 Task/String-comparison/Harbour/string-comparison-2.harbour create mode 100644 Task/String-comparison/Lasso/string-comparison.lasso create mode 100644 Task/String-comparison/Lingo/string-comparison-1.lingo create mode 100644 Task/String-comparison/Lingo/string-comparison-2.lingo create mode 100644 Task/String-comparison/Nim/string-comparison.nim create mode 100644 Task/String-comparison/Oforth/string-comparison.oforth create mode 100644 Task/String-comparison/Phix/string-comparison.phix create mode 100644 Task/String-comparison/Ring/string-comparison.ring create mode 100644 Task/String-comparison/Sidef/string-comparison.sidef create mode 100644 Task/String-comparison/Swift/string-comparison.swift create mode 100644 Task/String-comparison/jq/string-comparison-1.jq create mode 100644 Task/String-comparison/jq/string-comparison-2.jq create mode 100644 Task/String-comparison/jq/string-comparison-3.jq create mode 100644 Task/String-concatenation/Apex/string-concatenation.apex create mode 100644 Task/String-concatenation/Axe/string-concatenation.axe create mode 100644 Task/String-concatenation/ChucK/string-concatenation.chuck create mode 100644 Task/String-concatenation/ERRE/string-concatenation.erre create mode 100644 Task/String-concatenation/FreeBASIC/string-concatenation.freebasic create mode 100644 Task/String-concatenation/Lasso/string-concatenation.lasso create mode 100644 Task/String-concatenation/Lingo/string-concatenation.lingo create mode 100644 Task/String-concatenation/LiveCode/string-concatenation.livecode create mode 100644 Task/String-concatenation/Nim/string-concatenation-1.nim create mode 100644 Task/String-concatenation/Nim/string-concatenation-2.nim create mode 100644 Task/String-concatenation/Nim/string-concatenation-3.nim create mode 100644 Task/String-concatenation/Oforth/string-concatenation.oforth create mode 100644 Task/String-concatenation/PHL/string-concatenation.phl create mode 100644 Task/String-concatenation/Phix/string-concatenation.phix create mode 100644 Task/String-concatenation/Ring/string-concatenation.ring create mode 100644 Task/String-concatenation/Sidef/string-concatenation-1.sidef create mode 100644 Task/String-concatenation/Sidef/string-concatenation-2.sidef create mode 100644 Task/String-concatenation/Sparkling/string-concatenation.sparkling create mode 100644 Task/String-concatenation/Swift/string-concatenation.swift create mode 100644 Task/String-concatenation/Ursa/string-concatenation.ursa create mode 100644 Task/String-concatenation/jq/string-concatenation.jq create mode 100644 Task/String-interpolation--included-/Coco/string-interpolation--included-.coco create mode 100644 Task/String-interpolation--included-/ECL/string-interpolation--included-.ecl create mode 100644 Task/String-interpolation--included-/EchoLisp/string-interpolation--included-.echolisp create mode 100644 Task/String-interpolation--included-/FreeBASIC/string-interpolation--included-.freebasic create mode 100644 Task/String-interpolation--included-/FunL/string-interpolation--included-.funl create mode 100644 Task/String-interpolation--included-/Lasso/string-interpolation--included-.lasso create mode 100644 Task/String-interpolation--included-/LiveCode/string-interpolation--included-.livecode create mode 100644 Task/String-interpolation--included-/Nim/string-interpolation--included-.nim create mode 100644 Task/String-interpolation--included-/Phix/string-interpolation--included-.phix create mode 100644 Task/String-interpolation--included-/Ring/string-interpolation--included-.ring create mode 100644 Task/String-interpolation--included-/Sidef/string-interpolation--included--1.sidef create mode 100644 Task/String-interpolation--included-/Sidef/string-interpolation--included--2.sidef create mode 100644 Task/String-interpolation--included-/Swift/string-interpolation--included-.swift create mode 100644 Task/String-interpolation--included-/jq/string-interpolation--included--1.jq create mode 100644 Task/String-interpolation--included-/jq/string-interpolation--included--2.jq create mode 100644 Task/String-length/Apex/string-length.apex create mode 100644 Task/String-length/Axe/string-length.axe create mode 100644 Task/String-length/FreeBASIC/string-length.freebasic create mode 100644 Task/String-length/LFE/string-length-1.lfe create mode 100644 Task/String-length/LFE/string-length-2.lfe create mode 100644 Task/String-length/Lasso/string-length-1.lasso create mode 100644 Task/String-length/Lasso/string-length-2.lasso create mode 100644 Task/String-length/Lingo/string-length-1.lingo create mode 100644 Task/String-length/Lingo/string-length-2.lingo create mode 100644 Task/String-length/Nim/string-length-1.nim create mode 100644 Task/String-length/Nim/string-length-2.nim create mode 100644 Task/String-length/Phix/string-length.phix create mode 100644 Task/String-length/Potion/string-length.potion create mode 100644 Task/String-length/Ring/string-length.ring create mode 100644 Task/String-length/Sidef/string-length-1.sidef create mode 100644 Task/String-length/Sidef/string-length-2.sidef create mode 100644 Task/String-length/Sidef/string-length-3.sidef create mode 100644 Task/String-length/Sidef/string-length-4.sidef create mode 100644 Task/String-length/Sidef/string-length-5.sidef create mode 100644 Task/String-length/Sparkling/string-length.sparkling create mode 100644 Task/String-length/Swift/string-length-1.swift create mode 100644 Task/String-length/Swift/string-length-10.swift create mode 100644 Task/String-length/Swift/string-length-11.swift create mode 100644 Task/String-length/Swift/string-length-12.swift create mode 100644 Task/String-length/Swift/string-length-2.swift create mode 100644 Task/String-length/Swift/string-length-3.swift create mode 100644 Task/String-length/Swift/string-length-4.swift create mode 100644 Task/String-length/Swift/string-length-5.swift create mode 100644 Task/String-length/Swift/string-length-6.swift create mode 100644 Task/String-length/Swift/string-length-7.swift create mode 100644 Task/String-length/Swift/string-length-8.swift create mode 100644 Task/String-length/Swift/string-length-9.swift create mode 100644 Task/String-length/Wren/string-length-1.wren create mode 100644 Task/String-length/Wren/string-length-2.wren create mode 100644 Task/String-length/jq/string-length-1.jq create mode 100644 Task/String-length/jq/string-length-2.jq create mode 100644 Task/String-matching/EchoLisp/string-matching.echolisp create mode 100644 Task/String-matching/FreeBASIC/string-matching.freebasic create mode 100644 Task/String-matching/Lasso/string-matching.lasso create mode 100644 Task/String-matching/Lingo/string-matching.lingo create mode 100644 Task/String-matching/Nim/string-matching.nim create mode 100644 Task/String-matching/Oforth/string-matching.oforth create mode 100644 Task/String-matching/Phix/string-matching.phix create mode 100644 Task/String-matching/Ring/string-matching.ring create mode 100644 Task/String-matching/Sidef/string-matching.sidef create mode 100644 Task/String-matching/Swift/string-matching.swift create mode 100644 Task/String-matching/jq/string-matching-1.jq create mode 100644 Task/String-matching/jq/string-matching-2.jq create mode 100644 Task/String-matching/jq/string-matching-3.jq create mode 100644 Task/String-matching/jq/string-matching-4.jq create mode 100644 Task/String-matching/jq/string-matching-5.jq create mode 100644 Task/String-matching/jq/string-matching-6.jq create mode 100644 Task/String-prepend/ERRE/string-prepend.erre create mode 100644 Task/String-prepend/EchoLisp/string-prepend.echolisp create mode 100644 Task/String-prepend/FreeBASIC/string-prepend.freebasic create mode 100644 Task/String-prepend/LFE/string-prepend-1.lfe create mode 100644 Task/String-prepend/LFE/string-prepend-2.lfe create mode 100644 Task/String-prepend/Lasso/string-prepend.lasso create mode 100644 Task/String-prepend/Lingo/string-prepend.lingo create mode 100644 Task/String-prepend/LiveCode/string-prepend.livecode create mode 100644 Task/String-prepend/Nim/string-prepend.nim create mode 100644 Task/String-prepend/Oforth/string-prepend.oforth create mode 100644 Task/String-prepend/Phix/string-prepend.phix create mode 100644 Task/String-prepend/Ring/string-prepend.ring create mode 100644 Task/String-prepend/Sidef/string-prepend-1.sidef create mode 100644 Task/String-prepend/Sidef/string-prepend-2.sidef create mode 100644 Task/String-prepend/Swift/string-prepend.swift create mode 100644 Task/String-prepend/Ursa/string-prepend.ursa create mode 100644 Task/String-prepend/Wart/string-prepend.wart create mode 100644 Task/String-prepend/jq/string-prepend.jq create mode 100644 Task/Strip-a-set-of-characters-from-a-string/EchoLisp/strip-a-set-of-characters-from-a-string.echolisp create mode 100644 Task/Strip-a-set-of-characters-from-a-string/FreeBASIC/strip-a-set-of-characters-from-a-string.freebasic create mode 100644 Task/Strip-a-set-of-characters-from-a-string/Lasso/strip-a-set-of-characters-from-a-string.lasso create mode 100644 Task/Strip-a-set-of-characters-from-a-string/LiveCode/strip-a-set-of-characters-from-a-string-1.livecode create mode 100644 Task/Strip-a-set-of-characters-from-a-string/LiveCode/strip-a-set-of-characters-from-a-string-2.livecode create mode 100644 Task/Strip-a-set-of-characters-from-a-string/Nim/strip-a-set-of-characters-from-a-string.nim create mode 100644 Task/Strip-a-set-of-characters-from-a-string/Oforth/strip-a-set-of-characters-from-a-string.oforth create mode 100644 Task/Strip-a-set-of-characters-from-a-string/Phix/strip-a-set-of-characters-from-a-string.phix create mode 100644 Task/Strip-a-set-of-characters-from-a-string/Ring/strip-a-set-of-characters-from-a-string.ring create mode 100644 Task/Strip-a-set-of-characters-from-a-string/Sidef/strip-a-set-of-characters-from-a-string-1.sidef create mode 100644 Task/Strip-a-set-of-characters-from-a-string/Sidef/strip-a-set-of-characters-from-a-string-2.sidef create mode 100644 Task/Strip-a-set-of-characters-from-a-string/Sidef/strip-a-set-of-characters-from-a-string-3.sidef create mode 100644 Task/Strip-a-set-of-characters-from-a-string/Swift/strip-a-set-of-characters-from-a-string.swift create mode 100644 Task/Strip-a-set-of-characters-from-a-string/jq/strip-a-set-of-characters-from-a-string-1.jq create mode 100644 Task/Strip-a-set-of-characters-from-a-string/jq/strip-a-set-of-characters-from-a-string-2.jq create mode 100644 Task/Strip-block-comments/Nim/strip-block-comments.nim create mode 100644 Task/Strip-block-comments/Phix/strip-block-comments.phix create mode 100644 Task/Strip-block-comments/Ring/strip-block-comments.ring create mode 100644 Task/Strip-block-comments/Sidef/strip-block-comments.sidef create mode 100644 Task/Strip-block-comments/jq/strip-block-comments.jq create mode 100644 Task/Strip-comments-from-a-string/FreeBASIC/strip-comments-from-a-string.freebasic create mode 100644 Task/Strip-comments-from-a-string/Nim/strip-comments-from-a-string.nim create mode 100644 Task/Strip-comments-from-a-string/Oforth/strip-comments-from-a-string.oforth create mode 100644 Task/Strip-comments-from-a-string/Phix/strip-comments-from-a-string.phix create mode 100644 Task/Strip-comments-from-a-string/Ring/strip-comments-from-a-string.ring create mode 100644 Task/Strip-comments-from-a-string/Sidef/strip-comments-from-a-string.sidef create mode 100644 Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-1.jq create mode 100644 Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-2.jq create mode 100644 Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-3.jq create mode 100644 Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-4.jq create mode 100644 Task/Strip-control-codes-and-extended-characters-from-a-string/FreeBASIC/strip-control-codes-and-extended-characters-from-a-string.freebasic create mode 100644 Task/Strip-control-codes-and-extended-characters-from-a-string/Nim/strip-control-codes-and-extended-characters-from-a-string.nim create mode 100644 Task/Strip-control-codes-and-extended-characters-from-a-string/Peloton/strip-control-codes-and-extended-characters-from-a-string-1.peloton create mode 100644 Task/Strip-control-codes-and-extended-characters-from-a-string/Peloton/strip-control-codes-and-extended-characters-from-a-string-2.peloton create mode 100644 Task/Strip-control-codes-and-extended-characters-from-a-string/Ring/strip-control-codes-and-extended-characters-from-a-string.ring create mode 100644 Task/Strip-control-codes-and-extended-characters-from-a-string/Sidef/strip-control-codes-and-extended-characters-from-a-string.sidef create mode 100644 Task/Strip-control-codes-and-extended-characters-from-a-string/jq/strip-control-codes-and-extended-characters-from-a-string-1.jq create mode 100644 Task/Strip-control-codes-and-extended-characters-from-a-string/jq/strip-control-codes-and-extended-characters-from-a-string-2.jq create mode 100644 Task/Strip-control-codes-and-extended-characters-from-a-string/jq/strip-control-codes-and-extended-characters-from-a-string-3.jq create mode 100644 Task/Strip-whitespace-from-a-string-Top-and-tail/EchoLisp/strip-whitespace-from-a-string-top-and-tail.echolisp create mode 100644 Task/Strip-whitespace-from-a-string-Top-and-tail/FreeBASIC/strip-whitespace-from-a-string-top-and-tail.freebasic create mode 100644 Task/Strip-whitespace-from-a-string-Top-and-tail/Lasso/strip-whitespace-from-a-string-top-and-tail.lasso create mode 100644 Task/Strip-whitespace-from-a-string-Top-and-tail/Nim/strip-whitespace-from-a-string-top-and-tail.nim create mode 100644 Task/Strip-whitespace-from-a-string-Top-and-tail/Phix/strip-whitespace-from-a-string-top-and-tail.phix create mode 100644 Task/Strip-whitespace-from-a-string-Top-and-tail/Ring/strip-whitespace-from-a-string-top-and-tail.ring create mode 100644 Task/Strip-whitespace-from-a-string-Top-and-tail/Sidef/strip-whitespace-from-a-string-top-and-tail.sidef create mode 100644 Task/Strip-whitespace-from-a-string-Top-and-tail/jq/strip-whitespace-from-a-string-top-and-tail-1.jq create mode 100644 Task/Strip-whitespace-from-a-string-Top-and-tail/jq/strip-whitespace-from-a-string-top-and-tail-2.jq create mode 100644 Task/Strip-whitespace-from-a-string-Top-and-tail/jq/strip-whitespace-from-a-string-top-and-tail-3.jq create mode 100644 Task/Substring-Top-and-tail/Apex/substring-top-and-tail.apex create mode 100644 Task/Substring-Top-and-tail/Eero/substring-top-and-tail.eero create mode 100644 Task/Substring-Top-and-tail/FreeBASIC/substring-top-and-tail.freebasic create mode 100644 Task/Substring-Top-and-tail/Lasso/substring-top-and-tail-1.lasso create mode 100644 Task/Substring-Top-and-tail/Lasso/substring-top-and-tail-2.lasso create mode 100644 Task/Substring-Top-and-tail/Lasso/substring-top-and-tail.lasso create mode 100644 Task/Substring-Top-and-tail/LiveCode/substring-top-and-tail.livecode create mode 100644 Task/Substring-Top-and-tail/Nim/substring-top-and-tail.nim create mode 100644 Task/Substring-Top-and-tail/Oforth/substring-top-and-tail.oforth create mode 100644 Task/Substring-Top-and-tail/Phix/substring-top-and-tail.phix create mode 100644 Task/Substring-Top-and-tail/Ring/substring-top-and-tail.ring create mode 100644 Task/Substring-Top-and-tail/Sidef/substring-top-and-tail-1.sidef create mode 100644 Task/Substring-Top-and-tail/Sidef/substring-top-and-tail-2.sidef create mode 100644 Task/Substring-Top-and-tail/Swift/substring-top-and-tail-1.swift create mode 100644 Task/Substring-Top-and-tail/Swift/substring-top-and-tail-2.swift create mode 100644 Task/Substring-Top-and-tail/Swift/substring-top-and-tail-3.swift create mode 100644 Task/Substring-Top-and-tail/Swift/substring-top-and-tail-4.swift create mode 100644 Task/Substring-Top-and-tail/jq/substring-top-and-tail-1.jq create mode 100644 Task/Substring-Top-and-tail/jq/substring-top-and-tail-2.jq create mode 100644 Task/Substring/Apex/substring.apex create mode 100644 Task/Substring/Axe/substring.axe create mode 100644 Task/Substring/ECL/substring.ecl create mode 100644 Task/Substring/Eero/substring.eero create mode 100644 Task/Substring/FreeBASIC/substring.freebasic create mode 100644 Task/Substring/LFE/substring.lfe create mode 100644 Task/Substring/Lasso/substring.lasso create mode 100644 Task/Substring/Lingo/substring.lingo create mode 100644 Task/Substring/LiveCode/substring.livecode create mode 100644 Task/Substring/Nim/substring.nim create mode 100644 Task/Substring/Oforth/substring.oforth create mode 100644 Task/Substring/Phix/substring-1.phix create mode 100644 Task/Substring/Phix/substring-2.phix create mode 100644 Task/Substring/Ring/substring.ring create mode 100644 Task/Substring/Sidef/substring.sidef create mode 100644 Task/Substring/Swift/substring.swift create mode 100644 Task/Substring/Wart/substring.wart create mode 100644 Task/Substring/jq/substring-1.jq create mode 100644 Task/Substring/jq/substring-2.jq create mode 100644 Task/Substring/jq/substring-3.jq create mode 100644 Task/Substring/jq/substring-4.jq create mode 100644 Task/Subtractive-generator/Sidef/subtractive-generator.sidef create mode 100644 Task/Sudoku/ERRE/sudoku.erre create mode 100644 Task/Sudoku/FutureBasic/sudoku.futurebasic create mode 100644 Task/Sudoku/Phix/sudoku-1.phix create mode 100644 Task/Sudoku/Phix/sudoku-2.phix create mode 100644 Task/Sudoku/Sidef/sudoku.sidef create mode 100644 Task/Sudoku/Swift/sudoku.swift create mode 100644 Task/Sum-and-product-of-an-array/FreeBASIC/sum-and-product-of-an-array.freebasic create mode 100644 Task/Sum-and-product-of-an-array/GFA-Basic/sum-and-product-of-an-array.gfa create mode 100644 Task/Sum-and-product-of-an-array/Lasso/sum-and-product-of-an-array.lasso create mode 100644 Task/Sum-and-product-of-an-array/Lingo/sum-and-product-of-an-array.lingo create mode 100644 Task/Sum-and-product-of-an-array/LiveCode/sum-and-product-of-an-array.livecode create mode 100644 Task/Sum-and-product-of-an-array/Nim/sum-and-product-of-an-array-1.nim create mode 100644 Task/Sum-and-product-of-an-array/Nim/sum-and-product-of-an-array-2.nim create mode 100644 Task/Sum-and-product-of-an-array/Oforth/sum-and-product-of-an-array.oforth create mode 100644 Task/Sum-and-product-of-an-array/Phix/sum-and-product-of-an-array.phix create mode 100644 Task/Sum-and-product-of-an-array/Ring/sum-and-product-of-an-array.ring create mode 100644 Task/Sum-and-product-of-an-array/Sidef/sum-and-product-of-an-array-1.sidef create mode 100644 Task/Sum-and-product-of-an-array/Sidef/sum-and-product-of-an-array-2.sidef create mode 100644 Task/Sum-and-product-of-an-array/Sparkling/sum-and-product-of-an-array.sparkling create mode 100644 Task/Sum-and-product-of-an-array/Swift/sum-and-product-of-an-array.swift create mode 100644 Task/Sum-and-product-of-an-array/Ursa/sum-and-product-of-an-array.ursa create mode 100644 Task/Sum-and-product-of-an-array/Wart/sum-and-product-of-an-array.wart create mode 100644 Task/Sum-and-product-of-an-array/Wortel/sum-and-product-of-an-array.wortel create mode 100644 Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-1.jq create mode 100644 Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-2.jq create mode 100644 Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-3.jq create mode 100644 Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-4.jq create mode 100644 Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-5.jq create mode 100644 Task/Sum-digits-of-an-integer/Ezhil/sum-digits-of-an-integer.ezhil create mode 100644 Task/Sum-digits-of-an-integer/FreeBASIC/sum-digits-of-an-integer.freebasic create mode 100644 Task/Sum-digits-of-an-integer/Lasso/sum-digits-of-an-integer.lasso create mode 100644 Task/Sum-digits-of-an-integer/Lingo/sum-digits-of-an-integer-1.lingo create mode 100644 Task/Sum-digits-of-an-integer/Lingo/sum-digits-of-an-integer-2.lingo create mode 100644 Task/Sum-digits-of-an-integer/LiveCode/sum-digits-of-an-integer-1.livecode create mode 100644 Task/Sum-digits-of-an-integer/LiveCode/sum-digits-of-an-integer-2.livecode create mode 100644 Task/Sum-digits-of-an-integer/LiveCode/sum-digits-of-an-integer-3.livecode create mode 100644 Task/Sum-digits-of-an-integer/Nim/sum-digits-of-an-integer.nim create mode 100644 Task/Sum-digits-of-an-integer/Oforth/sum-digits-of-an-integer-1.oforth create mode 100644 Task/Sum-digits-of-an-integer/Oforth/sum-digits-of-an-integer-2.oforth create mode 100644 Task/Sum-digits-of-an-integer/Phix/sum-digits-of-an-integer.phix create mode 100644 Task/Sum-digits-of-an-integer/Ring/sum-digits-of-an-integer.ring create mode 100644 Task/Sum-digits-of-an-integer/Sidef/sum-digits-of-an-integer.sidef create mode 100644 Task/Sum-digits-of-an-integer/Swift/sum-digits-of-an-integer-1.swift create mode 100644 Task/Sum-digits-of-an-integer/Swift/sum-digits-of-an-integer-2.swift create mode 100644 Task/Sum-digits-of-an-integer/Ursa/sum-digits-of-an-integer-1.ursa create mode 100644 Task/Sum-digits-of-an-integer/Ursa/sum-digits-of-an-integer-2.ursa create mode 100644 Task/Sum-digits-of-an-integer/jq/sum-digits-of-an-integer-1.jq create mode 100644 Task/Sum-digits-of-an-integer/jq/sum-digits-of-an-integer-2.jq create mode 100644 Task/Sum-multiples-of-3-and-5/EchoLisp/sum-multiples-of-3-and-5.echolisp create mode 100644 Task/Sum-multiples-of-3-and-5/FreeBASIC/sum-multiples-of-3-and-5.freebasic create mode 100644 Task/Sum-multiples-of-3-and-5/Lasso/sum-multiples-of-3-and-5.lasso create mode 100644 Task/Sum-multiples-of-3-and-5/Lingo/sum-multiples-of-3-and-5-1.lingo create mode 100644 Task/Sum-multiples-of-3-and-5/Lingo/sum-multiples-of-3-and-5-2.lingo create mode 100644 Task/Sum-multiples-of-3-and-5/LiveCode/sum-multiples-of-3-and-5.livecode create mode 100644 Task/Sum-multiples-of-3-and-5/Nim/sum-multiples-of-3-and-5-1.nim create mode 100644 Task/Sum-multiples-of-3-and-5/Nim/sum-multiples-of-3-and-5-2.nim create mode 100644 Task/Sum-multiples-of-3-and-5/Oforth/sum-multiples-of-3-and-5.oforth create mode 100644 Task/Sum-multiples-of-3-and-5/Ring/sum-multiples-of-3-and-5.ring create mode 100644 Task/Sum-multiples-of-3-and-5/Sidef/sum-multiples-of-3-and-5.sidef create mode 100644 Task/Sum-multiples-of-3-and-5/Wortel/sum-multiples-of-3-and-5.wortel create mode 100644 Task/Sum-multiples-of-3-and-5/jq/sum-multiples-of-3-and-5-1.jq create mode 100644 Task/Sum-multiples-of-3-and-5/jq/sum-multiples-of-3-and-5-2.jq create mode 100644 Task/Sum-of-a-series/EchoLisp/sum-of-a-series.echolisp create mode 100644 Task/Sum-of-a-series/Ezhil/sum-of-a-series.ezhil create mode 100644 Task/Sum-of-a-series/FreeBASIC/sum-of-a-series.freebasic create mode 100644 Task/Sum-of-a-series/GEORGE/sum-of-a-series.george create mode 100644 Task/Sum-of-a-series/LFE/sum-of-a-series-1.lfe create mode 100644 Task/Sum-of-a-series/LFE/sum-of-a-series-2.lfe create mode 100644 Task/Sum-of-a-series/LFE/sum-of-a-series-3.lfe create mode 100644 Task/Sum-of-a-series/Lasso/sum-of-a-series.lasso create mode 100644 Task/Sum-of-a-series/Lingo/sum-of-a-series.lingo create mode 100644 Task/Sum-of-a-series/LiveCode/sum-of-a-series.livecode create mode 100644 Task/Sum-of-a-series/Nim/sum-of-a-series.nim create mode 100644 Task/Sum-of-a-series/Oforth/sum-of-a-series-1.oforth create mode 100644 Task/Sum-of-a-series/Oforth/sum-of-a-series-2.oforth create mode 100644 Task/Sum-of-a-series/Panda/sum-of-a-series.panda create mode 100644 Task/Sum-of-a-series/Phix/sum-of-a-series.phix create mode 100644 Task/Sum-of-a-series/Potion/sum-of-a-series.potion create mode 100644 Task/Sum-of-a-series/Ring/sum-of-a-series.ring create mode 100644 Task/Sum-of-a-series/Sidef/sum-of-a-series-1.sidef create mode 100644 Task/Sum-of-a-series/Sidef/sum-of-a-series-2.sidef create mode 100644 Task/Sum-of-a-series/Swift/sum-of-a-series-1.swift create mode 100644 Task/Sum-of-a-series/Swift/sum-of-a-series-2.swift create mode 100644 Task/Sum-of-a-series/Wortel/sum-of-a-series-1.wortel create mode 100644 Task/Sum-of-a-series/Wortel/sum-of-a-series-2.wortel create mode 100644 Task/Sum-of-a-series/jq/sum-of-a-series-1.jq create mode 100644 Task/Sum-of-a-series/jq/sum-of-a-series-2.jq create mode 100644 Task/Sum-of-squares/FreeBASIC/sum-of-squares.freebasic create mode 100644 Task/Sum-of-squares/GEORGE/sum-of-squares.george create mode 100644 Task/Sum-of-squares/LFE/sum-of-squares-1.lfe create mode 100644 Task/Sum-of-squares/LFE/sum-of-squares-2.lfe create mode 100644 Task/Sum-of-squares/Lasso/sum-of-squares.lasso create mode 100644 Task/Sum-of-squares/LiveCode/sum-of-squares.livecode create mode 100644 Task/Sum-of-squares/Nim/sum-of-squares.nim create mode 100644 Task/Sum-of-squares/Oforth/sum-of-squares.oforth create mode 100644 Task/Sum-of-squares/Phix/sum-of-squares.phix create mode 100644 Task/Sum-of-squares/Ring/sum-of-squares.ring create mode 100644 Task/Sum-of-squares/Sidef/sum-of-squares.sidef create mode 100644 Task/Sum-of-squares/Swift/sum-of-squares.swift create mode 100644 Task/Sum-of-squares/Wortel/sum-of-squares-1.wortel create mode 100644 Task/Sum-of-squares/Wortel/sum-of-squares-2.wortel create mode 100644 Task/Sum-of-squares/Wortel/sum-of-squares-3.wortel create mode 100644 Task/Sum-of-squares/Wortel/sum-of-squares-4.wortel create mode 100644 Task/Sum-of-squares/XLISP/sum-of-squares.xlisp create mode 100644 Task/Sum-of-squares/jq/sum-of-squares-1.jq create mode 100644 Task/Sum-of-squares/jq/sum-of-squares-2.jq create mode 100644 Task/Sum-of-squares/jq/sum-of-squares-3.jq create mode 100644 Task/Sum-of-squares/jq/sum-of-squares-4.jq create mode 100644 Task/Sum-of-squares/jq/sum-of-squares-5.jq create mode 100644 Task/Sutherland-Hodgman-polygon-clipping/Sidef/sutherland-hodgman-polygon-clipping.sidef create mode 100644 Task/Symmetric-difference/Apex/symmetric-difference.apex create mode 100644 Task/Symmetric-difference/Lasso/symmetric-difference.lasso create mode 100644 Task/Symmetric-difference/Nim/symmetric-difference.nim create mode 100644 Task/Symmetric-difference/Ring/symmetric-difference.ring create mode 100644 Task/Symmetric-difference/Sidef/symmetric-difference.sidef create mode 100644 Task/Symmetric-difference/Swift/symmetric-difference.swift create mode 100644 Task/Symmetric-difference/jq/symmetric-difference-1.jq create mode 100644 Task/Symmetric-difference/jq/symmetric-difference-2.jq create mode 100644 Task/Synchronous-concurrency/EchoLisp/synchronous-concurrency.echolisp create mode 100644 Task/Synchronous-concurrency/Oforth/synchronous-concurrency.oforth create mode 100644 Task/Synchronous-concurrency/Phix/synchronous-concurrency.phix create mode 100644 Task/Synchronous-concurrency/Swift/synchronous-concurrency-1.swift create mode 100644 Task/Synchronous-concurrency/Swift/synchronous-concurrency-2.swift create mode 100644 Task/Synchronous-concurrency/Swift/synchronous-concurrency-3.swift create mode 100644 Task/System-time/FreeBASIC/system-time.freebasic create mode 100644 Task/System-time/Hoon/system-time.hoon create mode 100644 Task/System-time/LFE/system-time-1.lfe create mode 100644 Task/System-time/LFE/system-time-2.lfe create mode 100644 Task/System-time/LFE/system-time-3.lfe create mode 100644 Task/System-time/Lasso/system-time.lasso create mode 100644 Task/System-time/Lingo/system-time.lingo create mode 100644 Task/System-time/LiveCode/system-time.livecode create mode 100644 Task/System-time/Nim/system-time.nim create mode 100644 Task/System-time/Oforth/system-time-1.oforth create mode 100644 Task/System-time/Oforth/system-time-2.oforth create mode 100644 Task/System-time/Phix/system-time.phix create mode 100644 Task/System-time/Ring/system-time.ring create mode 100644 Task/System-time/Sidef/system-time.sidef create mode 100644 Task/System-time/Swift/system-time.swift create mode 100644 Task/System-time/Ursa/system-time.ursa create mode 100644 Task/System-time/jq/system-time.jq create mode 100644 Task/Table-creation-Postal-addresses/EchoLisp/table-creation-postal-addresses.echolisp create mode 100644 Task/Table-creation-Postal-addresses/FunL/table-creation-postal-addresses.funl create mode 100644 Task/Table-creation-Postal-addresses/Lasso/table-creation-postal-addresses.lasso create mode 100644 Task/Table-creation-Postal-addresses/Nim/table-creation-postal-addresses.nim create mode 100644 Task/Table-creation-Postal-addresses/Sidef/table-creation-postal-addresses.sidef create mode 100644 Task/Table-creation-Postal-addresses/Visual-FoxPro/table-creation-postal-addresses.visual create mode 100644 Task/Take-notes-on-the-command-line/Lasso/take-notes-on-the-command-line.lasso create mode 100644 Task/Take-notes-on-the-command-line/Nim/take-notes-on-the-command-line.nim create mode 100644 Task/Take-notes-on-the-command-line/Phix/take-notes-on-the-command-line.phix create mode 100644 Task/Take-notes-on-the-command-line/Sidef/take-notes-on-the-command-line.sidef create mode 100644 Task/Take-notes-on-the-command-line/Swift/take-notes-on-the-command-line.swift create mode 100644 Task/Temperature-conversion/8th/temperature-conversion.8th create mode 100644 Task/Temperature-conversion/Ceylon/temperature-conversion.ceylon create mode 100644 Task/Temperature-conversion/Ezhil/temperature-conversion.ezhil create mode 100644 Task/Temperature-conversion/FOCAL/temperature-conversion.focal create mode 100644 Task/Temperature-conversion/FreeBASIC/temperature-conversion.freebasic create mode 100644 Task/Temperature-conversion/Lasso/temperature-conversion.lasso create mode 100644 Task/Temperature-conversion/LiveCode/temperature-conversion-1.livecode create mode 100644 Task/Temperature-conversion/LiveCode/temperature-conversion-2.livecode create mode 100644 Task/Temperature-conversion/Nim/temperature-conversion.nim create mode 100644 Task/Temperature-conversion/Oforth/temperature-conversion.oforth create mode 100644 Task/Temperature-conversion/Phix/temperature-conversion.phix create mode 100644 Task/Temperature-conversion/Ring/temperature-conversion.ring create mode 100644 Task/Temperature-conversion/Sidef/temperature-conversion.sidef create mode 100644 Task/Temperature-conversion/Ursa/temperature-conversion.ursa create mode 100644 Task/Temperature-conversion/Visual-FoxPro/temperature-conversion.visual create mode 100644 Task/Temperature-conversion/XLISP/temperature-conversion.xlisp create mode 100644 Task/Temperature-conversion/jq/temperature-conversion-1.jq create mode 100644 Task/Temperature-conversion/jq/temperature-conversion-2.jq create mode 100644 Task/Terminal-control-Clear-the-screen/Axe/terminal-control-clear-the-screen.axe create mode 100644 Task/Terminal-control-Clear-the-screen/Comal/terminal-control-clear-the-screen.comal create mode 100644 Task/Terminal-control-Clear-the-screen/FreeBASIC/terminal-control-clear-the-screen.freebasic create mode 100644 Task/Terminal-control-Clear-the-screen/Lasso/terminal-control-clear-the-screen.lasso create mode 100644 Task/Terminal-control-Clear-the-screen/Nim/terminal-control-clear-the-screen.nim create mode 100644 Task/Terminal-control-Clear-the-screen/Phix/terminal-control-clear-the-screen.phix create mode 100644 Task/Terminal-control-Clear-the-screen/Ring/terminal-control-clear-the-screen.ring create mode 100644 Task/Terminal-control-Clear-the-screen/Sidef/terminal-control-clear-the-screen-1.sidef create mode 100644 Task/Terminal-control-Clear-the-screen/Sidef/terminal-control-clear-the-screen-2.sidef create mode 100644 Task/Terminal-control-Clear-the-screen/Sidef/terminal-control-clear-the-screen-3.sidef create mode 100644 Task/Terminal-control-Clear-the-screen/jq/terminal-control-clear-the-screen-1.jq create mode 100644 Task/Terminal-control-Clear-the-screen/jq/terminal-control-clear-the-screen-2.jq create mode 100644 Task/Terminal-control-Coloured-text/FunL/terminal-control-coloured-text.funl create mode 100644 Task/Terminal-control-Coloured-text/Lasso/terminal-control-coloured-text.lasso create mode 100644 Task/Terminal-control-Coloured-text/Nim/terminal-control-coloured-text.nim create mode 100644 Task/Terminal-control-Coloured-text/Sidef/terminal-control-coloured-text.sidef create mode 100644 Task/Terminal-control-Cursor-movement/Axe/terminal-control-cursor-movement.axe create mode 100644 Task/Terminal-control-Cursor-movement/Lasso/terminal-control-cursor-movement.lasso create mode 100644 Task/Terminal-control-Cursor-positioning/Axe/terminal-control-cursor-positioning.axe create mode 100644 Task/Terminal-control-Cursor-positioning/Lasso/terminal-control-cursor-positioning.lasso create mode 100644 Task/Terminal-control-Cursor-positioning/Nim/terminal-control-cursor-positioning.nim create mode 100644 Task/Terminal-control-Cursor-positioning/Phix/terminal-control-cursor-positioning.phix create mode 100644 Task/Terminal-control-Dimensions/Phix/terminal-control-dimensions.phix create mode 100644 Task/Terminal-control-Dimensions/Ring/terminal-control-dimensions.ring create mode 100644 Task/Terminal-control-Dimensions/Sidef/terminal-control-dimensions.sidef create mode 100644 Task/Terminal-control-Display-an-extended-character/EchoLisp/terminal-control-display-an-extended-character.echolisp create mode 100644 Task/Terminal-control-Display-an-extended-character/Lasso/terminal-control-display-an-extended-character.lasso create mode 100644 Task/Terminal-control-Display-an-extended-character/Nim/terminal-control-display-an-extended-character.nim create mode 100644 Task/Terminal-control-Display-an-extended-character/Phix/terminal-control-display-an-extended-character.phix create mode 100644 Task/Terminal-control-Display-an-extended-character/Sidef/terminal-control-display-an-extended-character.sidef create mode 100644 Task/Terminal-control-Hiding-the-cursor/FunL/terminal-control-hiding-the-cursor.funl create mode 100644 Task/Terminal-control-Hiding-the-cursor/Lasso/terminal-control-hiding-the-cursor.lasso create mode 100644 Task/Terminal-control-Hiding-the-cursor/Phix/terminal-control-hiding-the-cursor.phix create mode 100644 Task/Terminal-control-Inverse-video/Axe/terminal-control-inverse-video.axe create mode 100644 Task/Terminal-control-Inverse-video/FunL/terminal-control-inverse-video.funl create mode 100644 Task/Terminal-control-Inverse-video/Lasso/terminal-control-inverse-video.lasso create mode 100644 Task/Terminal-control-Inverse-video/Nim/terminal-control-inverse-video.nim create mode 100644 Task/Terminal-control-Inverse-video/Ring/terminal-control-inverse-video.ring create mode 100644 Task/Terminal-control-Preserve-screen/Nim/terminal-control-preserve-screen.nim create mode 100644 Task/Terminal-control-Preserve-screen/Sidef/terminal-control-preserve-screen.sidef create mode 100644 Task/Terminal-control-Ringing-the-terminal-bell/FreeBASIC/terminal-control-ringing-the-terminal-bell.freebasic create mode 100644 Task/Terminal-control-Ringing-the-terminal-bell/Lasso/terminal-control-ringing-the-terminal-bell.lasso create mode 100644 Task/Terminal-control-Ringing-the-terminal-bell/Nim/terminal-control-ringing-the-terminal-bell.nim create mode 100644 Task/Terminal-control-Ringing-the-terminal-bell/Ring/terminal-control-ringing-the-terminal-bell.ring create mode 100644 Task/Terminal-control-Ringing-the-terminal-bell/Sidef/terminal-control-ringing-the-terminal-bell.sidef create mode 100644 Task/Terminal-control-Unicode-output/FunL/terminal-control-unicode-output.funl create mode 100644 Task/Terminal-control-Unicode-output/Lasso/terminal-control-unicode-output.lasso create mode 100644 Task/Terminal-control-Unicode-output/Nim/terminal-control-unicode-output.nim create mode 100644 Task/Terminal-control-Unicode-output/Sidef/terminal-control-unicode-output.sidef create mode 100644 Task/Terminal-control-Unicode-output/jq/terminal-control-unicode-output.jq create mode 100644 Task/Ternary-logic/Nim/ternary-logic.nim create mode 100644 Task/Ternary-logic/Phix/ternary-logic.phix create mode 100644 Task/Ternary-logic/jq/ternary-logic.jq create mode 100644 Task/Test-a-function/EchoLisp/test-a-function.echolisp create mode 100644 Task/Test-a-function/Lasso/test-a-function.lasso create mode 100644 Task/Test-a-function/Nim/test-a-function-1.nim create mode 100644 Task/Test-a-function/Nim/test-a-function-2.nim create mode 100644 Task/Test-a-function/Oforth/test-a-function.oforth create mode 100644 Task/Test-a-function/Ring/test-a-function.ring create mode 100644 Task/Test-a-function/Swift/test-a-function.swift create mode 100644 Task/Test-a-function/jq/test-a-function-1.jq create mode 100644 Task/Test-a-function/jq/test-a-function-2.jq create mode 100644 Task/Test-a-function/jq/test-a-function-3.jq create mode 100644 Task/Test-a-function/jq/test-a-function-4.jq create mode 100644 Task/Test-a-function/jq/test-a-function-5.jq create mode 100644 Task/Text-processing-1/Nim/text-processing-1.nim create mode 100644 Task/Text-processing-1/Sidef/text-processing-1.sidef create mode 100644 Task/Text-processing-1/jq/text-processing-1-1.jq create mode 100644 Task/Text-processing-1/jq/text-processing-1-2.jq create mode 100644 Task/Text-processing-1/jq/text-processing-1-3.jq create mode 100644 Task/Text-processing-1/jq/text-processing-1-4.jq create mode 100644 Task/Text-processing-1/jq/text-processing-1-5.jq create mode 100644 Task/Text-processing-2/Nim/text-processing-2.nim create mode 100644 Task/Text-processing-2/Sidef/text-processing-2.sidef create mode 100644 Task/Text-processing-2/jq/text-processing-2-1.jq create mode 100644 Task/Text-processing-2/jq/text-processing-2-2.jq create mode 100644 Task/Text-processing-2/jq/text-processing-2-3.jq create mode 100644 Task/Text-processing-2/jq/text-processing-2-4.jq create mode 100644 Task/Text-processing-2/jq/text-processing-2-5.jq create mode 100644 Task/Text-processing-2/jq/text-processing-2-6.jq create mode 100644 Task/Text-processing-2/jq/text-processing-2-7.jq create mode 100644 Task/Text-processing-2/jq/text-processing-2-8.jq create mode 100644 Task/Text-processing-Max-licenses-in-use/Nim/text-processing-max-licenses-in-use.nim create mode 100644 Task/Text-processing-Max-licenses-in-use/Phix/text-processing-max-licenses-in-use.phix create mode 100644 Task/Text-processing-Max-licenses-in-use/Sidef/text-processing-max-licenses-in-use.sidef create mode 100644 Task/Text-processing-Max-licenses-in-use/jq/text-processing-max-licenses-in-use.jq create mode 100644 Task/Textonyms/Sidef/textonyms.sidef create mode 100644 Task/Textonyms/jq/textonyms-1.jq create mode 100644 Task/Textonyms/jq/textonyms-2.jq create mode 100644 Task/The-ISAAC-Cipher/FreeBASIC/the-isaac-cipher.freebasic create mode 100644 Task/The-ISAAC-Cipher/Sidef/the-isaac-cipher.sidef create mode 100644 Task/The-Twelve-Days-of-Christmas/FreeBASIC/the-twelve-days-of-christmas.freebasic create mode 100644 Task/The-Twelve-Days-of-Christmas/Nim/the-twelve-days-of-christmas.nim create mode 100644 Task/The-Twelve-Days-of-Christmas/Sidef/the-twelve-days-of-christmas.sidef create mode 100644 Task/The-Twelve-Days-of-Christmas/Swift/the-twelve-days-of-christmas.swift create mode 100644 Task/Thieles-interpolation-formula/Sidef/thieles-interpolation-formula.sidef create mode 100644 Task/Tic-tac-toe/Lasso/tic-tac-toe.lasso create mode 100644 Task/Tic-tac-toe/Phix/tic-tac-toe.phix create mode 100644 Task/Tic-tac-toe/Ring/tic-tac-toe.ring create mode 100644 Task/Time-a-function/8051-Assembly/time-a-function.8051 create mode 100644 Task/Time-a-function/FreeBASIC/time-a-function.freebasic create mode 100644 Task/Time-a-function/Lasso/time-a-function.lasso create mode 100644 Task/Time-a-function/Lingo/time-a-function-1.lingo create mode 100644 Task/Time-a-function/Lingo/time-a-function-2.lingo create mode 100644 Task/Time-a-function/Nim/time-a-function.nim create mode 100644 Task/Time-a-function/Phix/time-a-function.phix create mode 100644 Task/Time-a-function/Ring/time-a-function.ring create mode 100644 Task/Time-a-function/Sidef/time-a-function.sidef create mode 100644 Task/Time-a-function/Wart/time-a-function.wart create mode 100644 Task/Tokenize-a-string/Ceylon/tokenize-a-string.ceylon create mode 100644 Task/Tokenize-a-string/LFE/tokenize-a-string.lfe create mode 100644 Task/Tokenize-a-string/Lingo/tokenize-a-string.lingo create mode 100644 Task/Tokenize-a-string/Nim/tokenize-a-string.nim create mode 100644 Task/Tokenize-a-string/Oforth/tokenize-a-string.oforth create mode 100644 Task/Tokenize-a-string/Phix/tokenize-a-string.phix create mode 100644 Task/Tokenize-a-string/Ring/tokenize-a-string.ring create mode 100644 Task/Tokenize-a-string/Sidef/tokenize-a-string.sidef create mode 100644 Task/Tokenize-a-string/Swift/tokenize-a-string-1.swift create mode 100644 Task/Tokenize-a-string/Swift/tokenize-a-string-2.swift create mode 100644 Task/Tokenize-a-string/Swift/tokenize-a-string-3.swift create mode 100644 Task/Tokenize-a-string/Ursa/tokenize-a-string.ursa create mode 100644 Task/Tokenize-a-string/Wortel/tokenize-a-string.wortel create mode 100644 Task/Tokenize-a-string/jq/tokenize-a-string-1.jq create mode 100644 Task/Tokenize-a-string/jq/tokenize-a-string-2.jq create mode 100644 Task/Top-rank-per-group/EchoLisp/top-rank-per-group-1.echolisp create mode 100644 Task/Top-rank-per-group/EchoLisp/top-rank-per-group-2.echolisp create mode 100644 Task/Top-rank-per-group/FunL/top-rank-per-group.funl create mode 100644 Task/Top-rank-per-group/Nim/top-rank-per-group.nim create mode 100644 Task/Top-rank-per-group/Oforth/top-rank-per-group.oforth create mode 100644 Task/Top-rank-per-group/Sidef/top-rank-per-group.sidef create mode 100644 Task/Top-rank-per-group/jq/top-rank-per-group-1.jq create mode 100644 Task/Top-rank-per-group/jq/top-rank-per-group-2.jq create mode 100644 Task/Top-rank-per-group/jq/top-rank-per-group-3.jq create mode 100644 Task/Topic-variable/Axe/topic-variable.axe create mode 100644 Task/Topic-variable/FreeBASIC/topic-variable.freebasic create mode 100644 Task/Topic-variable/Oforth/topic-variable.oforth create mode 100644 Task/Topic-variable/Sidef/topic-variable.sidef create mode 100644 Task/Topological-sort/EchoLisp/topological-sort-1.echolisp create mode 100644 Task/Topological-sort/EchoLisp/topological-sort-2.echolisp create mode 100644 Task/Topological-sort/EchoLisp/topological-sort-3.echolisp create mode 100644 Task/Topological-sort/FunL/topological-sort.funl create mode 100644 Task/Topological-sort/Sidef/topological-sort.sidef create mode 100644 Task/Topological-sort/jq/topological-sort-1.jq create mode 100644 Task/Topological-sort/jq/topological-sort-2.jq create mode 100644 Task/Topological-sort/jq/topological-sort-3.jq create mode 100644 Task/Topswops/Phix/topswops.phix create mode 100644 Task/Topswops/Potion/topswops.potion create mode 100644 Task/Topswops/jq/topswops-1.jq create mode 100644 Task/Topswops/jq/topswops-2.jq create mode 100644 Task/Topswops/jq/topswops-3.jq create mode 100644 Task/Topswops/jq/topswops-4.jq create mode 100644 Task/Total-circles-area/EchoLisp/total-circles-area.echolisp create mode 100644 Task/Total-circles-area/Nim/total-circles-area.nim create mode 100644 Task/Towers-of-Hanoi/8th/towers-of-hanoi.8th create mode 100644 Task/Towers-of-Hanoi/ERRE/towers-of-hanoi.erre create mode 100644 Task/Towers-of-Hanoi/Ezhil/towers-of-hanoi.ezhil create mode 100644 Task/Towers-of-Hanoi/FreeBASIC/towers-of-hanoi.freebasic create mode 100644 Task/Towers-of-Hanoi/FutureBasic/towers-of-hanoi.futurebasic create mode 100644 Task/Towers-of-Hanoi/Lasso/towers-of-hanoi-1.lasso create mode 100644 Task/Towers-of-Hanoi/Lasso/towers-of-hanoi-2.lasso create mode 100644 Task/Towers-of-Hanoi/Lasso/towers-of-hanoi-3.lasso create mode 100644 Task/Towers-of-Hanoi/Lingo/towers-of-hanoi-1.lingo create mode 100644 Task/Towers-of-Hanoi/Lingo/towers-of-hanoi-2.lingo create mode 100644 Task/Towers-of-Hanoi/Monte/towers-of-hanoi.monte create mode 100644 Task/Towers-of-Hanoi/Nim/towers-of-hanoi.nim create mode 100644 Task/Towers-of-Hanoi/Oforth/towers-of-hanoi.oforth create mode 100644 Task/Towers-of-Hanoi/PHL/towers-of-hanoi.phl create mode 100644 Task/Towers-of-Hanoi/Ring/towers-of-hanoi.ring create mode 100644 Task/Towers-of-Hanoi/Sidef/towers-of-hanoi.sidef create mode 100644 Task/Towers-of-Hanoi/Swift/towers-of-hanoi-1.swift create mode 100644 Task/Towers-of-Hanoi/Swift/towers-of-hanoi-2.swift create mode 100644 Task/Towers-of-Hanoi/jq/towers-of-hanoi.jq create mode 100644 Task/Trabb-Pardo-Knuth-algorithm/ERRE/trabb-pardo-knuth-algorithm.erre create mode 100644 Task/Trabb-Pardo-Knuth-algorithm/EchoLisp/trabb-pardo-knuth-algorithm-1.echolisp create mode 100644 Task/Trabb-Pardo-Knuth-algorithm/EchoLisp/trabb-pardo-knuth-algorithm-2.echolisp create mode 100644 Task/Trabb-Pardo-Knuth-algorithm/FreeBASIC/trabb-pardo-knuth-algorithm.freebasic create mode 100644 Task/Trabb-Pardo-Knuth-algorithm/Nim/trabb-pardo-knuth-algorithm.nim create mode 100644 Task/Trabb-Pardo-Knuth-algorithm/Ring/trabb-pardo-knuth-algorithm.ring create mode 100644 Task/Trabb-Pardo-Knuth-algorithm/Sidef/trabb-pardo-knuth-algorithm.sidef create mode 100644 Task/Trabb-Pardo-Knuth-algorithm/Swift/trabb-pardo-knuth-algorithm.swift create mode 100644 Task/Trabb-Pardo-Knuth-algorithm/Symsyn/trabb-pardo-knuth-algorithm.symsyn create mode 100644 Task/Trabb-Pardo-Knuth-algorithm/jq/trabb-pardo-knuth-algorithm-1.jq create mode 100644 Task/Trabb-Pardo-Knuth-algorithm/jq/trabb-pardo-knuth-algorithm-2.jq create mode 100644 Task/Tree-traversal/Ceylon/tree-traversal.ceylon create mode 100644 Task/Tree-traversal/FunL/tree-traversal.funl create mode 100644 Task/Tree-traversal/GFA-Basic/tree-traversal.gfa create mode 100644 Task/Tree-traversal/Lingo/tree-traversal-1.lingo create mode 100644 Task/Tree-traversal/Lingo/tree-traversal-2.lingo create mode 100644 Task/Tree-traversal/Lingo/tree-traversal-3.lingo create mode 100644 Task/Tree-traversal/Nim/tree-traversal.nim create mode 100644 Task/Tree-traversal/Oforth/tree-traversal.oforth create mode 100644 Task/Tree-traversal/Phix/tree-traversal.phix create mode 100644 Task/Tree-traversal/Sidef/tree-traversal.sidef create mode 100644 Task/Tree-traversal/jq/tree-traversal-1.jq create mode 100644 Task/Tree-traversal/jq/tree-traversal-2.jq create mode 100644 Task/Trigonometric-functions/Axe/trigonometric-functions.axe create mode 100644 Task/Trigonometric-functions/FreeBASIC/trigonometric-functions.freebasic create mode 100644 Task/Trigonometric-functions/Nim/trigonometric-functions.nim create mode 100644 Task/Trigonometric-functions/Oforth/trigonometric-functions.oforth create mode 100644 Task/Trigonometric-functions/Phix/trigonometric-functions.phix create mode 100644 Task/Trigonometric-functions/Ring/trigonometric-functions.ring create mode 100644 Task/Trigonometric-functions/Sidef/trigonometric-functions.sidef create mode 100644 Task/Trigonometric-functions/jq/trigonometric-functions-1.jq create mode 100644 Task/Trigonometric-functions/jq/trigonometric-functions-2.jq create mode 100644 Task/Truncatable-primes/EchoLisp/truncatable-primes-1.echolisp create mode 100644 Task/Truncatable-primes/EchoLisp/truncatable-primes-2.echolisp create mode 100644 Task/Truncatable-primes/Nim/truncatable-primes.nim create mode 100644 Task/Truncatable-primes/Sidef/truncatable-primes.sidef create mode 100644 Task/Truncate-a-file/Lasso/truncate-a-file.lasso create mode 100644 Task/Truncate-a-file/Lingo/truncate-a-file-1.lingo create mode 100644 Task/Truncate-a-file/Lingo/truncate-a-file-2.lingo create mode 100644 Task/Truncate-a-file/Nim/truncate-a-file.nim create mode 100644 Task/Truncate-a-file/Ring/truncate-a-file.ring create mode 100644 Task/Truncate-a-file/Sidef/truncate-a-file.sidef create mode 100644 Task/Twelve-statements/ERRE/twelve-statements.erre create mode 100644 Task/Twelve-statements/Phix/twelve-statements.phix create mode 100644 Task/Twelve-statements/Swift/twelve-statements-1.swift create mode 100644 Task/Twelve-statements/Swift/twelve-statements-2.swift create mode 100644 Task/Twelve-statements/jq/twelve-statements.jq create mode 100644 Task/URL-decoding/Apex/url-decoding.apex create mode 100644 Task/URL-decoding/Lasso/url-decoding.lasso create mode 100644 Task/URL-decoding/LiveCode/url-decoding-1.livecode create mode 100644 Task/URL-decoding/LiveCode/url-decoding-2.livecode create mode 100644 Task/URL-decoding/Nim/url-decoding.nim create mode 100644 Task/URL-decoding/Sidef/url-decoding.sidef create mode 100644 Task/URL-decoding/Swift/url-decoding.swift create mode 100644 Task/URL-decoding/jq/url-decoding-1.jq create mode 100644 Task/URL-decoding/jq/url-decoding-2.jq create mode 100644 Task/URL-decoding/jq/url-decoding-3.jq create mode 100644 Task/URL-encoding/Apex/url-encoding.apex create mode 100644 Task/URL-encoding/Lasso/url-encoding.lasso create mode 100644 Task/URL-encoding/Lingo/url-encoding.lingo create mode 100644 Task/URL-encoding/LiveCode/url-encoding.livecode create mode 100644 Task/URL-encoding/Nim/url-encoding.nim create mode 100644 Task/URL-encoding/Sidef/url-encoding.sidef create mode 100644 Task/URL-encoding/jq/url-encoding-1.jq create mode 100644 Task/URL-encoding/jq/url-encoding-2.jq create mode 100644 Task/URL-encoding/jq/url-encoding-3.jq create mode 100644 Task/URL-encoding/jq/url-encoding-4.jq create mode 100644 Task/URL-encoding/jq/url-encoding-5.jq create mode 100644 Task/URL-encoding/jq/url-encoding-6.jq create mode 100644 Task/Ulam-spiral--for-primes-/ERRE/ulam-spiral--for-primes-.erre create mode 100644 Task/Ulam-spiral--for-primes-/EchoLisp/ulam-spiral--for-primes-.echolisp create mode 100644 Task/Ulam-spiral--for-primes-/Sidef/ulam-spiral--for-primes-.sidef create mode 100644 Task/Unbias-a-random-generator/ERRE/unbias-a-random-generator.erre create mode 100644 Task/Unbias-a-random-generator/Nim/unbias-a-random-generator.nim create mode 100644 Task/Unbias-a-random-generator/Phix/unbias-a-random-generator.phix create mode 100644 Task/Unbias-a-random-generator/Ring/unbias-a-random-generator.ring create mode 100644 Task/Unbias-a-random-generator/Sidef/unbias-a-random-generator.sidef create mode 100644 Task/Undefined-values/FreeBASIC/undefined-values.freebasic create mode 100644 Task/Undefined-values/Lingo/undefined-values.lingo create mode 100644 Task/Undefined-values/Phix/undefined-values.phix create mode 100644 Task/Undefined-values/Sidef/undefined-values.sidef create mode 100644 Task/Undefined-values/jq/undefined-values-1.jq create mode 100644 Task/Undefined-values/jq/undefined-values-2.jq create mode 100644 Task/Undefined-values/jq/undefined-values-3.jq create mode 100644 Task/Unicode-strings/LFE/unicode-strings-1.lfe create mode 100644 Task/Unicode-strings/LFE/unicode-strings-2.lfe create mode 100644 Task/Unicode-strings/LFE/unicode-strings-3.lfe create mode 100644 Task/Unicode-strings/Lasso/unicode-strings.lasso create mode 100644 Task/Unicode-strings/Lingo/unicode-strings.lingo create mode 100644 Task/Unicode-strings/Nim/unicode-strings.nim create mode 100644 Task/Unicode-strings/Sidef/unicode-strings.sidef create mode 100644 Task/Unicode-variable-names/8th/unicode-variable-names.8th create mode 100644 Task/Unicode-variable-names/EchoLisp/unicode-variable-names.echolisp create mode 100644 Task/Unicode-variable-names/FreeBASIC/unicode-variable-names.freebasic create mode 100644 Task/Unicode-variable-names/Lily/unicode-variable-names.lily create mode 100644 Task/Unicode-variable-names/Lingo/unicode-variable-names.lingo create mode 100644 Task/Unicode-variable-names/LiveCode/unicode-variable-names.livecode create mode 100644 Task/Unicode-variable-names/Nim/unicode-variable-names.nim create mode 100644 Task/Unicode-variable-names/Peloton/unicode-variable-names-1.peloton create mode 100644 Task/Unicode-variable-names/Peloton/unicode-variable-names-2.peloton create mode 100644 Task/Unicode-variable-names/Phix/unicode-variable-names.phix create mode 100644 Task/Unicode-variable-names/Sidef/unicode-variable-names.sidef create mode 100644 Task/Unicode-variable-names/Swift/unicode-variable-names.swift create mode 100644 Task/Universal-Turing-machine/EchoLisp/universal-turing-machine-1.echolisp create mode 100644 Task/Universal-Turing-machine/EchoLisp/universal-turing-machine-2.echolisp create mode 100644 Task/Universal-Turing-machine/Nim/universal-turing-machine.nim create mode 100644 Task/Universal-Turing-machine/PHL/universal-turing-machine.phl create mode 100644 Task/Universal-Turing-machine/SequenceL/universal-turing-machine-1.sequencel create mode 100644 Task/Universal-Turing-machine/SequenceL/universal-turing-machine-2.sequencel create mode 100644 Task/Universal-Turing-machine/Sidef/universal-turing-machine.sidef create mode 100644 Task/Unix-ls/8th/unix-ls.8th create mode 100644 Task/Unix-ls/EchoLisp/unix-ls.echolisp create mode 100644 Task/Unix-ls/FunL/unix-ls.funl create mode 100644 Task/Unix-ls/LiveCode/unix-ls.livecode create mode 100644 Task/Unix-ls/Nim/unix-ls.nim create mode 100644 Task/Unix-ls/Sidef/unix-ls-1.sidef create mode 100644 Task/Unix-ls/Sidef/unix-ls-2.sidef create mode 100644 Task/Unix-ls/Ursa/unix-ls.ursa create mode 100644 Task/Update-a-configuration-file/FreeBASIC/update-a-configuration-file.freebasic create mode 100644 Task/Update-a-configuration-file/Lasso/update-a-configuration-file-1.lasso create mode 100644 Task/Update-a-configuration-file/Lasso/update-a-configuration-file-2.lasso create mode 100644 Task/Use-another-language-to-call-a-function/Nim/use-another-language-to-call-a-function-1.nim create mode 100644 Task/Use-another-language-to-call-a-function/Nim/use-another-language-to-call-a-function-2.nim create mode 100644 Task/Use-another-language-to-call-a-function/Phix/use-another-language-to-call-a-function.phix create mode 100644 Task/User-input-Graphical/Phix/user-input-graphical.phix create mode 100644 Task/User-input-Graphical/Ring/user-input-graphical.ring create mode 100644 Task/User-input-Graphical/Sidef/user-input-graphical.sidef create mode 100644 Task/User-input-Text/Axe/user-input-text.axe create mode 100644 Task/User-input-Text/Ceylon/user-input-text.ceylon create mode 100644 Task/User-input-Text/FreeBASIC/user-input-text.freebasic create mode 100644 Task/User-input-Text/Lasso/user-input-text.lasso create mode 100644 Task/User-input-Text/Nim/user-input-text.nim create mode 100644 Task/User-input-Text/Oforth/user-input-text.oforth create mode 100644 Task/User-input-Text/Phix/user-input-text.phix create mode 100644 Task/User-input-Text/Ring/user-input-text.ring create mode 100644 Task/User-input-Text/Sidef/user-input-text-1.sidef create mode 100644 Task/User-input-Text/Sidef/user-input-text-2.sidef create mode 100644 Task/User-input-Text/Swift/user-input-text.swift create mode 100644 Task/User-input-Text/Ursa/user-input-text.ursa create mode 100644 Task/User-input-Text/jq/user-input-text-1.jq create mode 100644 Task/User-input-Text/jq/user-input-text-2.jq create mode 100644 Task/Vampire-number/FreeBASIC/vampire-number.freebasic create mode 100644 Task/Van-der-Corput-sequence/ERRE/van-der-corput-sequence.erre create mode 100644 Task/Van-der-Corput-sequence/FreeBASIC/van-der-corput-sequence.freebasic create mode 100644 Task/Van-der-Corput-sequence/Phix/van-der-corput-sequence.phix create mode 100644 Task/Van-der-Corput-sequence/Ring/van-der-corput-sequence.ring create mode 100644 Task/Van-der-Corput-sequence/Sidef/van-der-corput-sequence.sidef create mode 100644 Task/Van-der-Corput-sequence/jq/van-der-corput-sequence-1.jq create mode 100644 Task/Van-der-Corput-sequence/jq/van-der-corput-sequence-2.jq create mode 100644 Task/Van-der-Corput-sequence/jq/van-der-corput-sequence-3.jq create mode 100644 Task/Variable-length-quantity/LiveCode/variable-length-quantity-1.livecode create mode 100644 Task/Variable-length-quantity/LiveCode/variable-length-quantity-2.livecode create mode 100644 Task/Variable-length-quantity/Nim/variable-length-quantity.nim create mode 100644 Task/Variable-length-quantity/Phix/variable-length-quantity.phix create mode 100644 Task/Variable-size-Get/FreeBASIC/variable-size-get.freebasic create mode 100644 Task/Variable-size-Get/Lasso/variable-size-get.lasso create mode 100644 Task/Variable-size-Get/Nim/variable-size-get.nim create mode 100644 Task/Variable-size-Get/Ring/variable-size-get.ring create mode 100644 Task/Variable-size-Get/Swift/variable-size-get-1.swift create mode 100644 Task/Variable-size-Get/Swift/variable-size-get-2.swift create mode 100644 Task/Variable-size-Set/Nim/variable-size-set.nim create mode 100644 Task/Variables/8th/variables.8th create mode 100644 Task/Variables/Apex/variables.apex create mode 100644 Task/Variables/Axe/variables-1.axe create mode 100644 Task/Variables/Axe/variables-2.axe create mode 100644 Task/Variables/ChucK/variables-1.chuck create mode 100644 Task/Variables/ChucK/variables-2.chuck create mode 100644 Task/Variables/ChucK/variables-3.chuck create mode 100644 Task/Variables/Lasso/variables.lasso create mode 100644 Task/Variables/Lingo/variables-1.lingo create mode 100644 Task/Variables/Lingo/variables-2.lingo create mode 100644 Task/Variables/Lingo/variables-3.lingo create mode 100644 Task/Variables/Lingo/variables-4.lingo create mode 100644 Task/Variables/Lingo/variables-5.lingo create mode 100644 Task/Variables/Lingo/variables-6.lingo create mode 100644 Task/Variables/Lingo/variables-7.lingo create mode 100644 Task/Variables/Lingo/variables-8.lingo create mode 100644 Task/Variables/Nim/variables.nim create mode 100644 Task/Variables/Oforth/variables.oforth create mode 100644 Task/Variables/Phix/variables-1.phix create mode 100644 Task/Variables/Phix/variables-2.phix create mode 100644 Task/Variables/Pony/variables-1.pony create mode 100644 Task/Variables/Pony/variables-2.pony create mode 100644 Task/Variables/Ring/variables-1.ring create mode 100644 Task/Variables/Ring/variables-2.ring create mode 100644 Task/Variables/Ring/variables-3.ring create mode 100644 Task/Variables/Ring/variables-4.ring create mode 100644 Task/Variables/Ring/variables-5.ring create mode 100644 Task/Variables/Set-lang/variables.set create mode 100644 Task/Variables/Swift/variables.swift create mode 100644 Task/Variables/Ursa/variables.ursa create mode 100644 Task/Variables/jq/variables-1.jq create mode 100644 Task/Variables/jq/variables-2.jq create mode 100644 Task/Variables/jq/variables-3.jq create mode 100644 Task/Variables/jq/variables-4.jq create mode 100644 Task/Variadic-function/Lasso/variadic-function-1.lasso create mode 100644 Task/Variadic-function/Lasso/variadic-function-2.lasso create mode 100644 Task/Variadic-function/Lasso/variadic-function-3.lasso create mode 100644 Task/Variadic-function/Nim/variadic-function-1.nim create mode 100644 Task/Variadic-function/Nim/variadic-function-2.nim create mode 100644 Task/Variadic-function/Oforth/variadic-function.oforth create mode 100644 Task/Variadic-function/Phix/variadic-function.phix create mode 100644 Task/Variadic-function/Sidef/variadic-function-1.sidef create mode 100644 Task/Variadic-function/Sidef/variadic-function-2.sidef create mode 100644 Task/Variadic-function/Sidef/variadic-function-3.sidef create mode 100644 Task/Variadic-function/Swift/variadic-function-1.swift create mode 100644 Task/Variadic-function/Swift/variadic-function-2.swift create mode 100644 Task/Variadic-function/XLISP/variadic-function.xlisp create mode 100644 Task/Variadic-function/jq/variadic-function-1.jq create mode 100644 Task/Variadic-function/jq/variadic-function-2.jq create mode 100644 Task/Variadic-function/jq/variadic-function-3.jq create mode 100644 Task/Variadic-function/jq/variadic-function-4.jq create mode 100644 Task/Variadic-function/jq/variadic-function-5.jq create mode 100644 Task/Variadic-function/jq/variadic-function-6.jq create mode 100644 Task/Vector-products/ERRE/vector-products.erre create mode 100644 Task/Vector-products/EchoLisp/vector-products.echolisp create mode 100644 Task/Vector-products/FreeBASIC/vector-products.freebasic create mode 100644 Task/Vector-products/FunL/vector-products.funl create mode 100644 Task/Vector-products/Lingo/vector-products.lingo create mode 100644 Task/Vector-products/Nim/vector-products.nim create mode 100644 Task/Vector-products/Phix/vector-products.phix create mode 100644 Task/Vector-products/Sidef/vector-products.sidef create mode 100644 Task/Vector-products/Wortel/vector-products.wortel create mode 100644 Task/Vector-products/jq/vector-products-1.jq create mode 100644 Task/Vector-products/jq/vector-products-2.jq create mode 100644 Task/Verify-distribution-uniformity-Chi-squared-test/Hy/verify-distribution-uniformity-chi-squared-test-1.hy create mode 100644 Task/Verify-distribution-uniformity-Chi-squared-test/Hy/verify-distribution-uniformity-chi-squared-test-2.hy create mode 100644 Task/Verify-distribution-uniformity-Naive/Hy/verify-distribution-uniformity-naive-1.hy create mode 100644 Task/Verify-distribution-uniformity-Naive/Hy/verify-distribution-uniformity-naive-2.hy create mode 100644 Task/Vigen-re-cipher/Nim/vigen-re-cipher.nim create mode 100644 Task/Vigen-re-cipher/Sidef/vigen-re-cipher.sidef create mode 100644 Task/Vigen-re-cipher/TypeScript/vigen-re-cipher.type create mode 100644 Task/Visualize-a-tree/Lingo/visualize-a-tree-1.lingo create mode 100644 Task/Visualize-a-tree/Lingo/visualize-a-tree-2.lingo create mode 100644 Task/Visualize-a-tree/Nim/visualize-a-tree.nim create mode 100644 Task/Visualize-a-tree/Phix/visualize-a-tree-1.phix create mode 100644 Task/Visualize-a-tree/Phix/visualize-a-tree-2.phix create mode 100644 Task/Visualize-a-tree/Sidef/visualize-a-tree.sidef create mode 100644 Task/Voronoi-diagram/Sidef/voronoi-diagram.sidef create mode 100644 Task/Walk-a-directory-Non-recursively/68000-Assembly/walk-a-directory-non-recursively.68000 create mode 100644 Task/Walk-a-directory-Non-recursively/8th/walk-a-directory-non-recursively.8th create mode 100644 Task/Walk-a-directory-Non-recursively/Lasso/walk-a-directory-non-recursively.lasso create mode 100644 Task/Walk-a-directory-Non-recursively/Lingo/walk-a-directory-non-recursively.lingo create mode 100644 Task/Walk-a-directory-Non-recursively/LiveCode/walk-a-directory-non-recursively.livecode create mode 100644 Task/Walk-a-directory-Non-recursively/Nim/walk-a-directory-non-recursively.nim create mode 100644 Task/Walk-a-directory-Non-recursively/Phix/walk-a-directory-non-recursively.phix create mode 100644 Task/Walk-a-directory-Non-recursively/Sidef/walk-a-directory-non-recursively-1.sidef create mode 100644 Task/Walk-a-directory-Non-recursively/Sidef/walk-a-directory-non-recursively-2.sidef create mode 100644 Task/Walk-a-directory-Recursively/8th/walk-a-directory-recursively.8th create mode 100644 Task/Walk-a-directory-Recursively/Lasso/walk-a-directory-recursively.lasso create mode 100644 Task/Walk-a-directory-Recursively/LiveCode/walk-a-directory-recursively-1.livecode create mode 100644 Task/Walk-a-directory-Recursively/LiveCode/walk-a-directory-recursively-2.livecode create mode 100644 Task/Walk-a-directory-Recursively/Nim/walk-a-directory-recursively.nim create mode 100644 Task/Walk-a-directory-Recursively/Phix/walk-a-directory-recursively.phix create mode 100644 Task/Walk-a-directory-Recursively/Ring/walk-a-directory-recursively.ring create mode 100644 Task/Walk-a-directory-Recursively/Sidef/walk-a-directory-recursively.sidef create mode 100644 Task/Walk-a-directory-Recursively/Swift/walk-a-directory-recursively.swift create mode 100644 Task/Web-scraping/8th/web-scraping.8th create mode 100644 Task/Web-scraping/App-Inventor/web-scraping.app create mode 100644 Task/Web-scraping/FunL/web-scraping.funl create mode 100644 Task/Web-scraping/Lasso/web-scraping.lasso create mode 100644 Task/Web-scraping/Nim/web-scraping.nim create mode 100644 Task/Web-scraping/Peloton/web-scraping-1.peloton create mode 100644 Task/Web-scraping/Peloton/web-scraping-2.peloton create mode 100644 Task/Web-scraping/Peloton/web-scraping-3.peloton create mode 100644 Task/Web-scraping/Sidef/web-scraping.sidef create mode 100644 Task/Web-scraping/ToffeeScript/web-scraping.toffee create mode 100644 Task/Web-scraping/jq/web-scraping-1.jq create mode 100644 Task/Web-scraping/jq/web-scraping-2.jq create mode 100644 Task/Window-creation/FreeBASIC/window-creation.freebasic create mode 100644 Task/Window-creation/Lingo/window-creation.lingo create mode 100644 Task/Window-creation/Nim/window-creation-1.nim create mode 100644 Task/Window-creation/Nim/window-creation-2.nim create mode 100644 Task/Window-creation/Nim/window-creation-3.nim create mode 100644 Task/Window-creation/Nim/window-creation-4.nim create mode 100644 Task/Window-creation/Nim/window-creation-5.nim create mode 100644 Task/Window-creation/Nim/window-creation-6.nim create mode 100644 Task/Window-creation/Phix/window-creation.phix create mode 100644 Task/Window-creation/Ring/window-creation.ring create mode 100644 Task/Window-creation/Sidef/window-creation-1.sidef create mode 100644 Task/Window-creation/Sidef/window-creation-2.sidef create mode 100644 Task/Window-management/Nim/window-management-1.nim create mode 100644 Task/Window-management/Nim/window-management-2.nim create mode 100644 Task/Window-management/Phix/window-management.phix create mode 100644 Task/Window-management/Ring/window-management.ring create mode 100644 Task/Wireworld/Nim/wireworld.nim create mode 100644 Task/Wireworld/Sidef/wireworld.sidef create mode 100644 Task/Wireworld/jq/wireworld-1.jq create mode 100644 Task/Wireworld/jq/wireworld-2.jq create mode 100644 Task/Wireworld/jq/wireworld-3.jq create mode 100644 Task/Wireworld/jq/wireworld-4.jq create mode 100644 Task/Wireworld/jq/wireworld-5.jq create mode 100644 Task/Word-wrap/LFE/word-wrap-1.lfe create mode 100644 Task/Word-wrap/LFE/word-wrap-2.lfe create mode 100644 Task/Word-wrap/LFE/word-wrap-3.lfe create mode 100644 Task/Word-wrap/LFE/word-wrap-4.lfe create mode 100644 Task/Word-wrap/Lasso/word-wrap.lasso create mode 100644 Task/Word-wrap/Lingo/word-wrap-1.lingo create mode 100644 Task/Word-wrap/Lingo/word-wrap-2.lingo create mode 100644 Task/Word-wrap/Nim/word-wrap.nim create mode 100644 Task/Word-wrap/Sidef/word-wrap-1.sidef create mode 100644 Task/Word-wrap/Sidef/word-wrap-2.sidef create mode 100644 Task/Word-wrap/jq/word-wrap-1.jq create mode 100644 Task/Word-wrap/jq/word-wrap-2.jq create mode 100644 Task/Word-wrap/jq/word-wrap-3.jq create mode 100644 Task/Word-wrap/jq/word-wrap-4.jq create mode 100644 Task/Word-wrap/jq/word-wrap-5.jq create mode 100644 Task/Write-float-arrays-to-a-text-file/FreeBASIC/write-float-arrays-to-a-text-file.freebasic create mode 100644 Task/Write-float-arrays-to-a-text-file/Lingo/write-float-arrays-to-a-text-file-1.lingo create mode 100644 Task/Write-float-arrays-to-a-text-file/Lingo/write-float-arrays-to-a-text-file-2.lingo create mode 100644 Task/Write-float-arrays-to-a-text-file/Nim/write-float-arrays-to-a-text-file.nim create mode 100644 Task/Write-float-arrays-to-a-text-file/Phix/write-float-arrays-to-a-text-file.phix create mode 100644 Task/Write-float-arrays-to-a-text-file/Sidef/write-float-arrays-to-a-text-file.sidef create mode 100644 Task/Write-float-arrays-to-a-text-file/jq/write-float-arrays-to-a-text-file-1.jq create mode 100644 Task/Write-float-arrays-to-a-text-file/jq/write-float-arrays-to-a-text-file-2.jq create mode 100644 Task/Write-language-name-in-3D-ASCII/ERRE/write-language-name-in-3d-ascii.erre create mode 100644 Task/Write-language-name-in-3D-ASCII/Lasso/write-language-name-in-3d-ascii.lasso create mode 100644 Task/Write-language-name-in-3D-ASCII/Nim/write-language-name-in-3d-ascii.nim create mode 100644 Task/Write-language-name-in-3D-ASCII/Phix/write-language-name-in-3d-ascii.phix create mode 100644 Task/Write-language-name-in-3D-ASCII/Sidef/write-language-name-in-3d-ascii.sidef create mode 100644 Task/XML-DOM-serialization/Lasso/xml-dom-serialization.lasso create mode 100644 Task/XML-DOM-serialization/Lingo/xml-dom-serialization.lingo create mode 100644 Task/XML-DOM-serialization/Nim/xml-dom-serialization.nim create mode 100644 Task/XML-DOM-serialization/Sidef/xml-dom-serialization.sidef create mode 100644 Task/XML-Input/8th/xml-input.8th create mode 100644 Task/XML-Input/Lasso/xml-input-1.lasso create mode 100644 Task/XML-Input/Lasso/xml-input-2.lasso create mode 100644 Task/XML-Input/Lingo/xml-input.lingo create mode 100644 Task/XML-Input/LiveCode/xml-input.livecode create mode 100644 Task/XML-Input/Nim/xml-input.nim create mode 100644 Task/XML-Input/Sidef/xml-input.sidef create mode 100644 Task/XML-Output/Lasso/xml-output-1.lasso create mode 100644 Task/XML-Output/Lasso/xml-output-2.lasso create mode 100644 Task/XML-Output/Nim/xml-output.nim create mode 100644 Task/XML-Output/Phix/xml-output.phix create mode 100644 Task/XML-Output/Sidef/xml-output.sidef create mode 100644 Task/XML-XPath/Lasso/xml-xpath.lasso create mode 100644 Task/XML-XPath/LiveCode/xml-xpath.livecode create mode 100644 Task/XML-XPath/Nim/xml-xpath.nim create mode 100644 Task/XML-XPath/Sidef/xml-xpath.sidef create mode 100644 Task/Xiaolin-Wus-line-algorithm/FreeBASIC/xiaolin-wus-line-algorithm.freebasic create mode 100644 Task/Xiaolin-Wus-line-algorithm/Sidef/xiaolin-wus-line-algorithm.sidef create mode 100644 Task/Y-combinator/Ceylon/y-combinator-1.ceylon create mode 100644 Task/Y-combinator/Ceylon/y-combinator-2.ceylon create mode 100644 Task/Y-combinator/Ceylon/y-combinator-3.ceylon create mode 100644 Task/Y-combinator/EchoLisp/y-combinator.echolisp create mode 100644 Task/Y-combinator/Eero/y-combinator.eero create mode 100644 Task/Y-combinator/Oforth/y-combinator-1.oforth create mode 100644 Task/Y-combinator/Oforth/y-combinator-2.oforth create mode 100644 Task/Y-combinator/Oforth/y-combinator-3.oforth create mode 100644 Task/Y-combinator/Sidef/y-combinator.sidef create mode 100644 Task/Y-combinator/Swift/y-combinator-1.swift create mode 100644 Task/Y-combinator/Swift/y-combinator-2.swift create mode 100644 Task/Y-combinator/Swift/y-combinator-3.swift create mode 100644 Task/Y-combinator/Wart/y-combinator.wart create mode 100644 Task/Yin-and-yang/Commodore-BASIC/yin-and-yang.commodore create mode 100644 Task/Yin-and-yang/PHL/yin-and-yang.phl create mode 100644 Task/Yin-and-yang/Sidef/yin-and-yang.sidef create mode 100644 Task/Yin-and-yang/jq/yin-and-yang-1.jq create mode 100644 Task/Yin-and-yang/jq/yin-and-yang-2.jq create mode 100644 Task/Zebra-puzzle/ERRE/zebra-puzzle.erre create mode 100644 Task/Zebra-puzzle/EchoLisp/zebra-puzzle-1.echolisp create mode 100644 Task/Zebra-puzzle/EchoLisp/zebra-puzzle-2.echolisp create mode 100644 Task/Zebra-puzzle/FormulaOne/zebra-puzzle.formulaone create mode 100644 Task/Zebra-puzzle/Phix/zebra-puzzle.phix create mode 100644 Task/Zebra-puzzle/Sidef/zebra-puzzle.sidef create mode 100644 Task/Zebra-puzzle/jq/zebra-puzzle-1.jq create mode 100644 Task/Zebra-puzzle/jq/zebra-puzzle-2.jq create mode 100644 Task/Zebra-puzzle/jq/zebra-puzzle-3.jq create mode 100644 Task/Zeckendorf-number-representation/EchoLisp/zeckendorf-number-representation.echolisp create mode 100644 Task/Zeckendorf-number-representation/FreeBASIC/zeckendorf-number-representation.freebasic create mode 100644 Task/Zeckendorf-number-representation/Nim/zeckendorf-number-representation.nim create mode 100644 Task/Zeckendorf-number-representation/Sidef/zeckendorf-number-representation.sidef create mode 100644 Task/Zeckendorf-number-representation/jq/zeckendorf-number-representation-1.jq create mode 100644 Task/Zeckendorf-number-representation/jq/zeckendorf-number-representation-2.jq create mode 100644 Task/Zeckendorf-number-representation/jq/zeckendorf-number-representation-3.jq create mode 100644 Task/Zero-to-the-zero-power/8th/zero-to-the-zero-power.8th create mode 100644 Task/Zero-to-the-zero-power/ERRE/zero-to-the-zero-power.erre create mode 100644 Task/Zero-to-the-zero-power/EchoLisp/zero-to-the-zero-power.echolisp create mode 100644 Task/Zero-to-the-zero-power/FreeBASIC/zero-to-the-zero-power.freebasic create mode 100644 Task/Zero-to-the-zero-power/FutureBasic/zero-to-the-zero-power.futurebasic create mode 100644 Task/Zero-to-the-zero-power/Nim/zero-to-the-zero-power.nim create mode 100644 Task/Zero-to-the-zero-power/Oforth/zero-to-the-zero-power.oforth create mode 100644 Task/Zero-to-the-zero-power/Phix/zero-to-the-zero-power.phix create mode 100644 Task/Zero-to-the-zero-power/Ring/zero-to-the-zero-power.ring create mode 100644 Task/Zero-to-the-zero-power/Sidef/zero-to-the-zero-power-1.sidef create mode 100644 Task/Zero-to-the-zero-power/Sidef/zero-to-the-zero-power-2.sidef create mode 100644 Task/Zero-to-the-zero-power/Swift/zero-to-the-zero-power.swift create mode 100644 Task/Zero-to-the-zero-power/Ursa/zero-to-the-zero-power.ursa create mode 100644 Task/Zero-to-the-zero-power/XLISP/zero-to-the-zero-power.xlisp create mode 100644 Task/Zero-to-the-zero-power/jq/zero-to-the-zero-power.jq create mode 100644 Task/Zhang-Suen-thinning-algorithm/FreeBASIC/zhang-suen-thinning-algorithm.freebasic create mode 100644 Task/Zhang-Suen-thinning-algorithm/Phix/zhang-suen-thinning-algorithm.phix create mode 100644 Task/Zhang-Suen-thinning-algorithm/Sidef/zhang-suen-thinning-algorithm.sidef create mode 100644 Task/Zig-zag-matrix/ERRE/zig-zag-matrix.erre create mode 100644 Task/Zig-zag-matrix/FreeBASIC/zig-zag-matrix.freebasic create mode 100644 Task/Zig-zag-matrix/Lasso/zig-zag-matrix.lasso create mode 100644 Task/Zig-zag-matrix/Nim/zig-zag-matrix.nim create mode 100644 Task/Zig-zag-matrix/Phix/zig-zag-matrix-1.phix create mode 100644 Task/Zig-zag-matrix/Phix/zig-zag-matrix-2.phix create mode 100644 Task/Zig-zag-matrix/Sidef/zig-zag-matrix.sidef create mode 100644 Task/Zig-zag-matrix/jq/zig-zag-matrix-1.jq create mode 100644 Task/Zig-zag-matrix/jq/zig-zag-matrix-2.jq diff --git a/Lang/68000-Assembly/00DESCRIPTION b/Lang/68000-Assembly/00DESCRIPTION new file mode 100644 index 0000000000..8a0d8fc1d6 --- /dev/null +++ b/Lang/68000-Assembly/00DESCRIPTION @@ -0,0 +1,4 @@ +{{stub}}{{language}} +68000 assembly is the assembly language used for the Motorola 68000, or commonly known as the 68K. It should not be confused with the 6800 (which predates it). It was used in many computers such as the Amiga or the Canon Cat. + +{{merge language | M680x0 }} \ No newline at end of file diff --git a/Lang/68000-Assembly/100-doors b/Lang/68000-Assembly/100-doors new file mode 120000 index 0000000000..61fcc2bd9f --- /dev/null +++ b/Lang/68000-Assembly/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/68000-Assembly \ No newline at end of file diff --git a/Lang/68000-Assembly/Ackermann-function b/Lang/68000-Assembly/Ackermann-function new file mode 120000 index 0000000000..ee257838d6 --- /dev/null +++ b/Lang/68000-Assembly/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/68000-Assembly \ No newline at end of file diff --git a/Lang/68000-Assembly/README b/Lang/68000-Assembly/README new file mode 100644 index 0000000000..6869f6ac7f --- /dev/null +++ b/Lang/68000-Assembly/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:68000_Assembly diff --git a/Lang/68000-Assembly/Sieve-of-Eratosthenes b/Lang/68000-Assembly/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..a33995aa11 --- /dev/null +++ b/Lang/68000-Assembly/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/68000-Assembly \ No newline at end of file diff --git a/Lang/68000-Assembly/Walk-a-directory-Non-recursively b/Lang/68000-Assembly/Walk-a-directory-Non-recursively new file mode 120000 index 0000000000..28dcd7482f --- /dev/null +++ b/Lang/68000-Assembly/Walk-a-directory-Non-recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Non-recursively/68000-Assembly \ No newline at end of file diff --git a/Lang/8051-Assembly/00DESCRIPTION b/Lang/8051-Assembly/00DESCRIPTION new file mode 100644 index 0000000000..43f44b77ea --- /dev/null +++ b/Lang/8051-Assembly/00DESCRIPTION @@ -0,0 +1,25 @@ +{{language}} +[[Category:Assembly]] +'''8051 Assembly''' is the [[Assembly|assembly language]] used by the [[wp:Intel_MCS-51|Intel 8051 (MCS-51)]] microcontroller, and its many derivatives. This 8-bit microcontroller is very popular because of its Boolean processor that operates on any of 32 bit-addressable bytes (16 in RAM, 16 SFRs). The 8051 has the ability to directly read, write and branch based on these individual bits. + +Many chip makers, with the exception of Intel, continue to develop 8051 derivatives. All derivatives are compatible with the original instruction set, but most add new features. For this reason it is important to note whether the original 8051 or a derivative is used. + +The 8051 has greatly increased in performance. Modern derivatives can perform over 400 times faster than the first ones ever could. 8051s exist nowadays in many embedded systems because they are smaller and use less power when compared with a 32-bit processor. + +Original 8051 features: +* 12 oscillator periods per machine cycle +* 1 or 2 machine cycles per instruction (with the exception of MUL and DIV - both 4 machine cycles) +* Four 8-bit bidirectional I/O ports +* 128 bytes of internal RAM +* Two 16-bit timers +* Two-level priority interrupt +* Six interrupt sources +* Full-duplex [[wp:Universal_asynchronous_receiver/transmitter|UART]] +* No [[wp:Watchdog_timer|watchdog]] + +Derivatives exist that alter many or all features listed above. + +==Useful links== +* [http://www.keil.com/dd/docs/datashts/intel/ism51.pdf Instruction set] +* [http://www.8052.com/tutintro.phtml Basic tutorial] +* [http://plit.de/asem-51/ Freeware assembler] \ No newline at end of file diff --git a/Lang/8051-Assembly/Arrays b/Lang/8051-Assembly/Arrays new file mode 120000 index 0000000000..2543258a22 --- /dev/null +++ b/Lang/8051-Assembly/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/8051-Assembly \ No newline at end of file diff --git a/Lang/8051-Assembly/Bitwise-operations b/Lang/8051-Assembly/Bitwise-operations new file mode 120000 index 0000000000..864a4cd49b --- /dev/null +++ b/Lang/8051-Assembly/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/8051-Assembly \ No newline at end of file diff --git a/Lang/8051-Assembly/Boolean-values b/Lang/8051-Assembly/Boolean-values new file mode 120000 index 0000000000..140a9860af --- /dev/null +++ b/Lang/8051-Assembly/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/8051-Assembly \ No newline at end of file diff --git a/Lang/8051-Assembly/Empty-program b/Lang/8051-Assembly/Empty-program new file mode 120000 index 0000000000..543e14264d --- /dev/null +++ b/Lang/8051-Assembly/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/8051-Assembly \ No newline at end of file diff --git a/Lang/8051-Assembly/Function-definition b/Lang/8051-Assembly/Function-definition new file mode 120000 index 0000000000..8ead551d73 --- /dev/null +++ b/Lang/8051-Assembly/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/8051-Assembly \ No newline at end of file diff --git a/Lang/8051-Assembly/Integer-comparison b/Lang/8051-Assembly/Integer-comparison new file mode 120000 index 0000000000..6bd9daa14a --- /dev/null +++ b/Lang/8051-Assembly/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/8051-Assembly \ No newline at end of file diff --git a/Lang/8051-Assembly/README b/Lang/8051-Assembly/README new file mode 100644 index 0000000000..4cc0a35bf1 --- /dev/null +++ b/Lang/8051-Assembly/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:8051_Assembly diff --git a/Lang/8051-Assembly/Sleep b/Lang/8051-Assembly/Sleep new file mode 120000 index 0000000000..604e4e8fbd --- /dev/null +++ b/Lang/8051-Assembly/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/8051-Assembly \ No newline at end of file diff --git a/Lang/8051-Assembly/Time-a-function b/Lang/8051-Assembly/Time-a-function new file mode 120000 index 0000000000..73704c1397 --- /dev/null +++ b/Lang/8051-Assembly/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/8051-Assembly \ No newline at end of file diff --git a/Lang/8th/00DESCRIPTION b/Lang/8th/00DESCRIPTION new file mode 100644 index 0000000000..5000115cc8 --- /dev/null +++ b/Lang/8th/00DESCRIPTION @@ -0,0 +1,26 @@ + +{{language|8th +|site=http://8th-dev.com +|untyped=no +|exec=both +|gc=yes +|parampass=reference +|strength=strong +|checking=dynamic +}} +{{language programming paradigm|concatenative}} +{{language programming paradigm|imperative}} +8th™ is a cross-platform, secure, robust, cost-effective, extensible, and modern programming language and development environment. + +Some of its features include: +* Code is cross-platform (Windows, OS X, Linux, Android, iOS, Raspberry Pi) +* Interprets source to native-code, no VM +* Garbage collection via reference-counting +* Integrated large integer/float numeric support +* Strings are always UTF-8 +* Data declared using (extended) JSON syntax +* L10N support +* Easy cross-platform GUI +* FFI (call native libraries) +* Built-in networking (sockets, http etc) +* Lots of other things... [http://8th-dev.com see the website] for more information. \ No newline at end of file diff --git a/Lang/8th/100-doors b/Lang/8th/100-doors new file mode 120000 index 0000000000..2addba6336 --- /dev/null +++ b/Lang/8th/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/8th \ No newline at end of file diff --git a/Lang/8th/24-game b/Lang/8th/24-game new file mode 120000 index 0000000000..69bb8b58bf --- /dev/null +++ b/Lang/8th/24-game @@ -0,0 +1 @@ +../../Task/24-game/8th \ No newline at end of file diff --git a/Lang/8th/99-Bottles-of-Beer b/Lang/8th/99-Bottles-of-Beer new file mode 120000 index 0000000000..945da0fe8a --- /dev/null +++ b/Lang/8th/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/8th \ No newline at end of file diff --git a/Lang/8th/A+B b/Lang/8th/A+B new file mode 120000 index 0000000000..1e6df494fe --- /dev/null +++ b/Lang/8th/A+B @@ -0,0 +1 @@ +../../Task/A+B/8th \ No newline at end of file diff --git a/Lang/8th/Ackermann-function b/Lang/8th/Ackermann-function new file mode 120000 index 0000000000..f05e86163b --- /dev/null +++ b/Lang/8th/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/8th \ No newline at end of file diff --git a/Lang/8th/Align-columns b/Lang/8th/Align-columns new file mode 120000 index 0000000000..d8910b043e --- /dev/null +++ b/Lang/8th/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/8th \ No newline at end of file diff --git a/Lang/8th/Apply-a-callback-to-an-array b/Lang/8th/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..1e588aadaf --- /dev/null +++ b/Lang/8th/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/8th \ No newline at end of file diff --git a/Lang/8th/Arbitrary-precision-integers--included- b/Lang/8th/Arbitrary-precision-integers--included- new file mode 120000 index 0000000000..a999bb8096 --- /dev/null +++ b/Lang/8th/Arbitrary-precision-integers--included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers--included-/8th \ No newline at end of file diff --git a/Lang/8th/Arrays b/Lang/8th/Arrays new file mode 120000 index 0000000000..e123c0e6de --- /dev/null +++ b/Lang/8th/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/8th \ No newline at end of file diff --git a/Lang/8th/Averages-Arithmetic-mean b/Lang/8th/Averages-Arithmetic-mean new file mode 120000 index 0000000000..10b932d712 --- /dev/null +++ b/Lang/8th/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/8th \ No newline at end of file diff --git a/Lang/8th/Binary-digits b/Lang/8th/Binary-digits new file mode 120000 index 0000000000..1aac5d0c78 --- /dev/null +++ b/Lang/8th/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/8th \ No newline at end of file diff --git a/Lang/8th/Call-a-foreign-language-function b/Lang/8th/Call-a-foreign-language-function new file mode 120000 index 0000000000..054ad013b5 --- /dev/null +++ b/Lang/8th/Call-a-foreign-language-function @@ -0,0 +1 @@ +../../Task/Call-a-foreign-language-function/8th \ No newline at end of file diff --git a/Lang/8th/Date-format b/Lang/8th/Date-format new file mode 120000 index 0000000000..7f3ba6f942 --- /dev/null +++ b/Lang/8th/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/8th \ No newline at end of file diff --git a/Lang/8th/Delete-a-file b/Lang/8th/Delete-a-file new file mode 120000 index 0000000000..37e1e11e85 --- /dev/null +++ b/Lang/8th/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/8th \ No newline at end of file diff --git a/Lang/8th/Detect-division-by-zero b/Lang/8th/Detect-division-by-zero new file mode 120000 index 0000000000..6c8e910fb9 --- /dev/null +++ b/Lang/8th/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/8th \ No newline at end of file diff --git a/Lang/8th/Determine-if-a-string-is-numeric b/Lang/8th/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..15f08f9fc2 --- /dev/null +++ b/Lang/8th/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/8th \ No newline at end of file diff --git a/Lang/8th/Dot-product b/Lang/8th/Dot-product new file mode 120000 index 0000000000..717aef0b84 --- /dev/null +++ b/Lang/8th/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/8th \ No newline at end of file diff --git a/Lang/8th/Empty-string b/Lang/8th/Empty-string new file mode 120000 index 0000000000..9bd2e6e706 --- /dev/null +++ b/Lang/8th/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/8th \ No newline at end of file diff --git a/Lang/8th/Enforced-immutability b/Lang/8th/Enforced-immutability new file mode 120000 index 0000000000..ee2ba69fe0 --- /dev/null +++ b/Lang/8th/Enforced-immutability @@ -0,0 +1 @@ +../../Task/Enforced-immutability/8th \ No newline at end of file diff --git a/Lang/8th/Even-or-odd b/Lang/8th/Even-or-odd new file mode 120000 index 0000000000..44ab08eb6b --- /dev/null +++ b/Lang/8th/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/8th \ No newline at end of file diff --git a/Lang/8th/Evolutionary-algorithm b/Lang/8th/Evolutionary-algorithm new file mode 120000 index 0000000000..6747fa8d2d --- /dev/null +++ b/Lang/8th/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/8th \ No newline at end of file diff --git a/Lang/8th/Fibonacci-sequence b/Lang/8th/Fibonacci-sequence new file mode 120000 index 0000000000..2206c9258e --- /dev/null +++ b/Lang/8th/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/8th \ No newline at end of file diff --git a/Lang/8th/FizzBuzz b/Lang/8th/FizzBuzz new file mode 120000 index 0000000000..1f27d55b2d --- /dev/null +++ b/Lang/8th/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/8th \ No newline at end of file diff --git a/Lang/8th/Flatten-a-list b/Lang/8th/Flatten-a-list new file mode 120000 index 0000000000..ec56ceff91 --- /dev/null +++ b/Lang/8th/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/8th \ No newline at end of file diff --git a/Lang/8th/Formatted-numeric-output b/Lang/8th/Formatted-numeric-output new file mode 120000 index 0000000000..515971745b --- /dev/null +++ b/Lang/8th/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/8th \ No newline at end of file diff --git a/Lang/8th/Generate-lower-case-ASCII-alphabet b/Lang/8th/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..d58af7bf52 --- /dev/null +++ b/Lang/8th/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/8th \ No newline at end of file diff --git a/Lang/8th/Generic-swap b/Lang/8th/Generic-swap new file mode 120000 index 0000000000..cfd24e9276 --- /dev/null +++ b/Lang/8th/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/8th \ No newline at end of file diff --git a/Lang/8th/Greatest-common-divisor b/Lang/8th/Greatest-common-divisor new file mode 120000 index 0000000000..8797ec86bf --- /dev/null +++ b/Lang/8th/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/8th \ No newline at end of file diff --git a/Lang/8th/Greatest-element-of-a-list b/Lang/8th/Greatest-element-of-a-list new file mode 120000 index 0000000000..19e273efec --- /dev/null +++ b/Lang/8th/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/8th \ No newline at end of file diff --git a/Lang/8th/HTTP b/Lang/8th/HTTP new file mode 120000 index 0000000000..0652ae816d --- /dev/null +++ b/Lang/8th/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/8th \ No newline at end of file diff --git a/Lang/8th/Hello-world-Text b/Lang/8th/Hello-world-Text new file mode 120000 index 0000000000..4fa515a46f --- /dev/null +++ b/Lang/8th/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/8th \ No newline at end of file diff --git a/Lang/8th/Here-document b/Lang/8th/Here-document new file mode 120000 index 0000000000..2eb648bd1e --- /dev/null +++ b/Lang/8th/Here-document @@ -0,0 +1 @@ +../../Task/Here-document/8th \ No newline at end of file diff --git a/Lang/8th/Higher-order-functions b/Lang/8th/Higher-order-functions new file mode 120000 index 0000000000..79558cfdee --- /dev/null +++ b/Lang/8th/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/8th \ No newline at end of file diff --git a/Lang/8th/Integer-comparison b/Lang/8th/Integer-comparison new file mode 120000 index 0000000000..1b0bd3722c --- /dev/null +++ b/Lang/8th/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/8th \ No newline at end of file diff --git a/Lang/8th/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/8th/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..65ec7ec9c3 --- /dev/null +++ b/Lang/8th/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/8th \ No newline at end of file diff --git a/Lang/8th/Least-common-multiple b/Lang/8th/Least-common-multiple new file mode 120000 index 0000000000..e4f443b025 --- /dev/null +++ b/Lang/8th/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/8th \ No newline at end of file diff --git a/Lang/8th/Loops-For b/Lang/8th/Loops-For new file mode 120000 index 0000000000..c6395f9b48 --- /dev/null +++ b/Lang/8th/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/8th \ No newline at end of file diff --git a/Lang/8th/Loops-Infinite b/Lang/8th/Loops-Infinite new file mode 120000 index 0000000000..c0826c8b19 --- /dev/null +++ b/Lang/8th/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/8th \ No newline at end of file diff --git a/Lang/8th/MD5 b/Lang/8th/MD5 new file mode 120000 index 0000000000..d431a02ed6 --- /dev/null +++ b/Lang/8th/MD5 @@ -0,0 +1 @@ +../../Task/MD5/8th \ No newline at end of file diff --git a/Lang/8th/Modular-inverse b/Lang/8th/Modular-inverse new file mode 120000 index 0000000000..6ce53b96de --- /dev/null +++ b/Lang/8th/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/8th \ No newline at end of file diff --git a/Lang/8th/Null-object b/Lang/8th/Null-object new file mode 120000 index 0000000000..f9e8e19480 --- /dev/null +++ b/Lang/8th/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/8th \ No newline at end of file diff --git a/Lang/8th/One-dimensional-cellular-automata b/Lang/8th/One-dimensional-cellular-automata new file mode 120000 index 0000000000..7f2fb770b3 --- /dev/null +++ b/Lang/8th/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/8th \ No newline at end of file diff --git a/Lang/8th/Parametrized-SQL-statement b/Lang/8th/Parametrized-SQL-statement new file mode 120000 index 0000000000..b7e85a9ecd --- /dev/null +++ b/Lang/8th/Parametrized-SQL-statement @@ -0,0 +1 @@ +../../Task/Parametrized-SQL-statement/8th \ No newline at end of file diff --git a/Lang/8th/Pascals-triangle b/Lang/8th/Pascals-triangle new file mode 120000 index 0000000000..917a183db7 --- /dev/null +++ b/Lang/8th/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/8th \ No newline at end of file diff --git a/Lang/8th/Queue-Usage b/Lang/8th/Queue-Usage new file mode 120000 index 0000000000..004c3fd2b7 --- /dev/null +++ b/Lang/8th/Queue-Usage @@ -0,0 +1 @@ +../../Task/Queue-Usage/8th \ No newline at end of file diff --git a/Lang/8th/README b/Lang/8th/README new file mode 100644 index 0000000000..00e20b81e7 --- /dev/null +++ b/Lang/8th/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:8th diff --git a/Lang/8th/Range-expansion b/Lang/8th/Range-expansion new file mode 120000 index 0000000000..8b3bf4041a --- /dev/null +++ b/Lang/8th/Range-expansion @@ -0,0 +1 @@ +../../Task/Range-expansion/8th \ No newline at end of file diff --git a/Lang/8th/Read-a-file-line-by-line b/Lang/8th/Read-a-file-line-by-line new file mode 120000 index 0000000000..58166b5da8 --- /dev/null +++ b/Lang/8th/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/8th \ No newline at end of file diff --git a/Lang/8th/Read-entire-file b/Lang/8th/Read-entire-file new file mode 120000 index 0000000000..18733f5d5a --- /dev/null +++ b/Lang/8th/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/8th \ No newline at end of file diff --git a/Lang/8th/Regular-expressions b/Lang/8th/Regular-expressions new file mode 120000 index 0000000000..61d08832c1 --- /dev/null +++ b/Lang/8th/Regular-expressions @@ -0,0 +1 @@ +../../Task/Regular-expressions/8th \ No newline at end of file diff --git a/Lang/8th/Repeat-a-string b/Lang/8th/Repeat-a-string new file mode 120000 index 0000000000..b282260d53 --- /dev/null +++ b/Lang/8th/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/8th \ No newline at end of file diff --git a/Lang/8th/Reverse-a-string b/Lang/8th/Reverse-a-string new file mode 120000 index 0000000000..9fc7d17aab --- /dev/null +++ b/Lang/8th/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/8th \ No newline at end of file diff --git a/Lang/8th/Semordnilap b/Lang/8th/Semordnilap new file mode 120000 index 0000000000..5708a3765f --- /dev/null +++ b/Lang/8th/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/8th \ No newline at end of file diff --git a/Lang/8th/Sleep b/Lang/8th/Sleep new file mode 120000 index 0000000000..052f7d8b21 --- /dev/null +++ b/Lang/8th/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/8th \ No newline at end of file diff --git a/Lang/8th/Sort-an-integer-array b/Lang/8th/Sort-an-integer-array new file mode 120000 index 0000000000..210bb859be --- /dev/null +++ b/Lang/8th/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/8th \ No newline at end of file diff --git a/Lang/8th/Temperature-conversion b/Lang/8th/Temperature-conversion new file mode 120000 index 0000000000..e5a477dc24 --- /dev/null +++ b/Lang/8th/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/8th \ No newline at end of file diff --git a/Lang/8th/Towers-of-Hanoi b/Lang/8th/Towers-of-Hanoi new file mode 120000 index 0000000000..0bda70a039 --- /dev/null +++ b/Lang/8th/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/8th \ No newline at end of file diff --git a/Lang/8th/Unicode-variable-names b/Lang/8th/Unicode-variable-names new file mode 120000 index 0000000000..cf2c800158 --- /dev/null +++ b/Lang/8th/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/8th \ No newline at end of file diff --git a/Lang/8th/Unix-ls b/Lang/8th/Unix-ls new file mode 120000 index 0000000000..837cc58e7f --- /dev/null +++ b/Lang/8th/Unix-ls @@ -0,0 +1 @@ +../../Task/Unix-ls/8th \ No newline at end of file diff --git a/Lang/8th/Variables b/Lang/8th/Variables new file mode 120000 index 0000000000..88da953ef7 --- /dev/null +++ b/Lang/8th/Variables @@ -0,0 +1 @@ +../../Task/Variables/8th \ No newline at end of file diff --git a/Lang/8th/Walk-a-directory-Non-recursively b/Lang/8th/Walk-a-directory-Non-recursively new file mode 120000 index 0000000000..845f34ecb9 --- /dev/null +++ b/Lang/8th/Walk-a-directory-Non-recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Non-recursively/8th \ No newline at end of file diff --git a/Lang/8th/Walk-a-directory-Recursively b/Lang/8th/Walk-a-directory-Recursively new file mode 120000 index 0000000000..8132c134f0 --- /dev/null +++ b/Lang/8th/Walk-a-directory-Recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Recursively/8th \ No newline at end of file diff --git a/Lang/8th/Web-scraping b/Lang/8th/Web-scraping new file mode 120000 index 0000000000..4400dcfde9 --- /dev/null +++ b/Lang/8th/Web-scraping @@ -0,0 +1 @@ +../../Task/Web-scraping/8th \ No newline at end of file diff --git a/Lang/8th/XML-Input b/Lang/8th/XML-Input new file mode 120000 index 0000000000..857ae1564b --- /dev/null +++ b/Lang/8th/XML-Input @@ -0,0 +1 @@ +../../Task/XML-Input/8th \ No newline at end of file diff --git a/Lang/8th/Zero-to-the-zero-power b/Lang/8th/Zero-to-the-zero-power new file mode 120000 index 0000000000..72b4d07c3b --- /dev/null +++ b/Lang/8th/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/8th \ No newline at end of file diff --git a/Lang/AngelScript/00DESCRIPTION b/Lang/AngelScript/00DESCRIPTION new file mode 100644 index 0000000000..e3222a1749 --- /dev/null +++ b/Lang/AngelScript/00DESCRIPTION @@ -0,0 +1,6 @@ +{{stub}} +{{language|AngelScript}} + +This is a scripting language created by Andreas Jönsson. The AngelCode Scripting Library, or AngelScript as it is also known, is an extremely flexible cross-platform scripting library designed to allow applications to extend their functionality through external scripts. It has been designed from the beginning to be an easy to use component, both for the application programmer and the script writer. + +* [http://www.angelcode.com/angelscript/ Learn More] \ No newline at end of file diff --git a/Lang/AngelScript/README b/Lang/AngelScript/README new file mode 100644 index 0000000000..09f10ece84 --- /dev/null +++ b/Lang/AngelScript/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:AngelScript diff --git a/Lang/AntLang/00DESCRIPTION b/Lang/AntLang/00DESCRIPTION new file mode 100644 index 0000000000..2bc3d5cadf --- /dev/null +++ b/Lang/AntLang/00DESCRIPTION @@ -0,0 +1,56 @@ +{{language|AntLang}} +'''AntLang''' is a functional scripting language named after its creator Anthony Cipriano. Its main distinctive feature is short syntax oriented towards mathematical equations. + +It is a combination of APL and M-Expressions, which main strength is its short and concise syntax. + +The first implementation of AntLang was written in [[Haskell]], another one called OpenCally is a [[C]] framework and can be used as a software library to write AntLang compilers. + +This framework is in use for writing the AntLang-to-[[JavaScript]]-compiler antlang-js and the command run-antlang. + +== Code examples == + +=== Simple math === + 5*1+2 /=> 15 + +AntLang uses right-to-left evaluation, so 1+2 gets executed before 5*3. + +Even though AntLang evaluates right-to-left, it is recommended to read left-to-right in a top-down manner. + +=== Hello World === + echo["helloworld"] + +The echo function is called with the string ''helloworld'', prints it and returns it. + +=== Factorial === + factorial:{1 */ 1+range[x]} + +The times-reduction (*/) with the accumulator value 1 over the list 1+range[x]. + +=== Fibonacci sequence === + fib:{<0;1>{x,<+|-2#x>}/range[x]} + +== Implementations == +=== hsAntLang === +hsAntLang was the first AntLang implementation, which is still used by most of AntLang users. + +It fully implements the language standard plus several extensions, like multithreading, file Input/output and exception handling. + +It is hosted on GitHub. + +=== OpenCally === +OpenCally is an AntLang compiler by AntLang Software. + +It is under active development and doesn't support all the standard functions and syntax yet. + +OpenCally adds interfaces to all its target languages (currently [[JavaScript]]): + / load the standard library + :"?/lib/stdlib.a" + / make a JavaScript function available to AntLang (prefix: v_) + js)v_console_log = console.log; + / call that function from within AntLang + console_log each <"APL"; "Haskell"; "Erlang"> + +To execute the code above on a machine with OpenCally installed, run: + $ run-antlang file.ant + +It is also hosted on GitHub. \ No newline at end of file diff --git a/Lang/AntLang/Array-concatenation b/Lang/AntLang/Array-concatenation new file mode 120000 index 0000000000..317d69324e --- /dev/null +++ b/Lang/AntLang/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Arrays b/Lang/AntLang/Arrays new file mode 120000 index 0000000000..2625251d2a --- /dev/null +++ b/Lang/AntLang/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Averages-Arithmetic-mean b/Lang/AntLang/Averages-Arithmetic-mean new file mode 120000 index 0000000000..edd0149374 --- /dev/null +++ b/Lang/AntLang/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Averages-Median b/Lang/AntLang/Averages-Median new file mode 120000 index 0000000000..df0b4c5b29 --- /dev/null +++ b/Lang/AntLang/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Call-a-function b/Lang/AntLang/Call-a-function new file mode 120000 index 0000000000..6d3733fb7b --- /dev/null +++ b/Lang/AntLang/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Closures-Value-capture b/Lang/AntLang/Closures-Value-capture new file mode 120000 index 0000000000..c03e4d1e63 --- /dev/null +++ b/Lang/AntLang/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Comments b/Lang/AntLang/Comments new file mode 120000 index 0000000000..17e85e50e3 --- /dev/null +++ b/Lang/AntLang/Comments @@ -0,0 +1 @@ +../../Task/Comments/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Even-or-odd b/Lang/AntLang/Even-or-odd new file mode 120000 index 0000000000..b7a4bd7e46 --- /dev/null +++ b/Lang/AntLang/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Factorial b/Lang/AntLang/Factorial new file mode 120000 index 0000000000..01f1c3edbd --- /dev/null +++ b/Lang/AntLang/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Fibonacci-sequence b/Lang/AntLang/Fibonacci-sequence new file mode 120000 index 0000000000..9725b0c0e6 --- /dev/null +++ b/Lang/AntLang/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Filter b/Lang/AntLang/Filter new file mode 120000 index 0000000000..f3c7402143 --- /dev/null +++ b/Lang/AntLang/Filter @@ -0,0 +1 @@ +../../Task/Filter/AntLang \ No newline at end of file diff --git a/Lang/AntLang/FizzBuzz b/Lang/AntLang/FizzBuzz new file mode 120000 index 0000000000..5586cce3ae --- /dev/null +++ b/Lang/AntLang/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Function-composition b/Lang/AntLang/Function-composition new file mode 120000 index 0000000000..03facd08f3 --- /dev/null +++ b/Lang/AntLang/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Function-definition b/Lang/AntLang/Function-definition new file mode 120000 index 0000000000..1049966512 --- /dev/null +++ b/Lang/AntLang/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Greatest-common-divisor b/Lang/AntLang/Greatest-common-divisor new file mode 120000 index 0000000000..74c78f6009 --- /dev/null +++ b/Lang/AntLang/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Greatest-element-of-a-list b/Lang/AntLang/Greatest-element-of-a-list new file mode 120000 index 0000000000..1a628d3a74 --- /dev/null +++ b/Lang/AntLang/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Hello-world-Text b/Lang/AntLang/Hello-world-Text new file mode 120000 index 0000000000..21f2a276ef --- /dev/null +++ b/Lang/AntLang/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Hello-world-Web-server b/Lang/AntLang/Hello-world-Web-server new file mode 120000 index 0000000000..356866dfb6 --- /dev/null +++ b/Lang/AntLang/Hello-world-Web-server @@ -0,0 +1 @@ +../../Task/Hello-world-Web-server/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Higher-order-functions b/Lang/AntLang/Higher-order-functions new file mode 120000 index 0000000000..70af482998 --- /dev/null +++ b/Lang/AntLang/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/AntLang \ No newline at end of file diff --git a/Lang/AntLang/Include-a-file b/Lang/AntLang/Include-a-file new file mode 120000 index 0000000000..702479f577 --- /dev/null +++ b/Lang/AntLang/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/AntLang \ No newline at end of file diff --git a/Lang/AntLang/JSON b/Lang/AntLang/JSON new file mode 120000 index 0000000000..162a4fbd74 --- /dev/null +++ b/Lang/AntLang/JSON @@ -0,0 +1 @@ +../../Task/JSON/AntLang \ No newline at end of file diff --git a/Lang/AntLang/README b/Lang/AntLang/README new file mode 100644 index 0000000000..e887d14bb0 --- /dev/null +++ b/Lang/AntLang/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:AntLang diff --git a/Lang/AntLang/Sleep b/Lang/AntLang/Sleep new file mode 120000 index 0000000000..099766343e --- /dev/null +++ b/Lang/AntLang/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/AntLang \ No newline at end of file diff --git a/Lang/Apex/00DESCRIPTION b/Lang/Apex/00DESCRIPTION new file mode 100644 index 0000000000..1c77d92879 --- /dev/null +++ b/Lang/Apex/00DESCRIPTION @@ -0,0 +1,38 @@ +{{stub}}{{language|Apex}} +{{language +|exec=bytecode +|site=http://developer.salesforce.com +|gc=yes +|parampass=value +|safety=safe +|express=explicit +|compat=nominative +|checking=static +|strength=strong +|tags=Apex, Salesforce, Visualforce +|LCT=yes}} +{{language programming paradigm|Object-oriented}} +{{language programming paradigm|Imperative}} +{{language programming paradigm|generic}} +{{language programming paradigm|reflective}}[[runs on force.com| ]] +The '''Apex''' programming language, developed by [[Salesforce.com]], is a the world's first on-demand programming language that provides a complete set of features for building business applications – including data models and objects to manage data, a workflow engine for managing collaboration of that data between users, a user interface model to handle forms and other interactions, and wide variety of API's for programmatic access and integration. + +Apex Code extends the powerful and proven success of the Force.com platform by introducing the ability to write code that runs on salesforce.com servers. The language enables a new class of applications and features to be developed and deployed entirely on demand. These applications make existing Force.com apps “smarter” by providing the ability to capture business logic and rules – such as data validation – and make entirely new kinds of apps possible on demand – such as complex inventory checking and order fulfillment. +Among the concepts behind Apex Code, two provide an especially good introduction to the language’s potential and implementation. + +Some of the Apex features and functionality: +* '''Hosted—Apex''' is saved, compiled, and executed on the server—the Force.com platform. +* '''Automatically''' upgradeable—Because compiled code is stored as metadata in the platform, Apex is automatically upgraded as part of Salesforce releases. +* '''Object oriented—Apex''' supports classes, interfaces, and inheritance. +* '''Strongly typed—Apex''' validates references to objects at compile time. +* '''Multitenant aware'''—Because Apex runs in a multitenant platform, it guards closely against runaway code by enforcing limits, which prevent code from monopolizing shared resources. +* '''Integrated with the database'''—It is straightforward to access and manipulate records. Apex provides direct access to records and their fields, and provides statements and query languages to manipulate those records. +* '''Data focused—Apex''' provides transactional access to the database, allowing you to roll back operations. +* '''Easy to use—Apex''' is based on familiar Java idioms. +* '''Easy to test—Apex''' provides built-in support for unit test creation, execution, and code coverage. Salesforce ensures that all custom Apex code works as expected by executing all unit tests prior to any platform upgrades. +* '''Versioned—Custom''' Apex code can be saved against different versions of the API. + + +Useful Apex Programming links: + +* [http://developer.salesforce.com Salesforce Developers] \ No newline at end of file diff --git a/Lang/Apex/99-Bottles-of-Beer b/Lang/Apex/99-Bottles-of-Beer new file mode 120000 index 0000000000..66efb81d43 --- /dev/null +++ b/Lang/Apex/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Apex \ No newline at end of file diff --git a/Lang/Apex/A+B b/Lang/Apex/A+B new file mode 120000 index 0000000000..3148c27d63 --- /dev/null +++ b/Lang/Apex/A+B @@ -0,0 +1 @@ +../../Task/A+B/Apex \ No newline at end of file diff --git a/Lang/Apex/ABC-Problem b/Lang/Apex/ABC-Problem new file mode 120000 index 0000000000..029a998d2f --- /dev/null +++ b/Lang/Apex/ABC-Problem @@ -0,0 +1 @@ +../../Task/ABC-Problem/Apex \ No newline at end of file diff --git a/Lang/Apex/Abstract-type b/Lang/Apex/Abstract-type new file mode 120000 index 0000000000..39059ed197 --- /dev/null +++ b/Lang/Apex/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/Apex \ No newline at end of file diff --git a/Lang/Apex/Array-concatenation b/Lang/Apex/Array-concatenation new file mode 120000 index 0000000000..6d1981e72c --- /dev/null +++ b/Lang/Apex/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Apex \ No newline at end of file diff --git a/Lang/Apex/Arrays b/Lang/Apex/Arrays new file mode 120000 index 0000000000..579e4ce956 --- /dev/null +++ b/Lang/Apex/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Apex \ No newline at end of file diff --git a/Lang/Apex/Assertions b/Lang/Apex/Assertions new file mode 120000 index 0000000000..9b890907cf --- /dev/null +++ b/Lang/Apex/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Apex \ No newline at end of file diff --git a/Lang/Apex/Associative-array-Creation b/Lang/Apex/Associative-array-Creation new file mode 120000 index 0000000000..715a03be0d --- /dev/null +++ b/Lang/Apex/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Apex \ No newline at end of file diff --git a/Lang/Apex/Call-an-object-method b/Lang/Apex/Call-an-object-method new file mode 120000 index 0000000000..6d02baf7ff --- /dev/null +++ b/Lang/Apex/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/Apex \ No newline at end of file diff --git a/Lang/Apex/Collections b/Lang/Apex/Collections new file mode 120000 index 0000000000..f3cd95ca7b --- /dev/null +++ b/Lang/Apex/Collections @@ -0,0 +1 @@ +../../Task/Collections/Apex \ No newline at end of file diff --git a/Lang/Apex/Comments b/Lang/Apex/Comments new file mode 120000 index 0000000000..0ebdeb1faf --- /dev/null +++ b/Lang/Apex/Comments @@ -0,0 +1 @@ +../../Task/Comments/Apex \ No newline at end of file diff --git a/Lang/Apex/Conditional-structures b/Lang/Apex/Conditional-structures new file mode 120000 index 0000000000..bea5ce8202 --- /dev/null +++ b/Lang/Apex/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Apex \ No newline at end of file diff --git a/Lang/Apex/Copy-a-string b/Lang/Apex/Copy-a-string new file mode 120000 index 0000000000..4d5ebaf5cf --- /dev/null +++ b/Lang/Apex/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Apex \ No newline at end of file diff --git a/Lang/Apex/Count-occurrences-of-a-substring b/Lang/Apex/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..b270de3509 --- /dev/null +++ b/Lang/Apex/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Apex \ No newline at end of file diff --git a/Lang/Apex/Date-format b/Lang/Apex/Date-format new file mode 120000 index 0000000000..1a0bbab0b6 --- /dev/null +++ b/Lang/Apex/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/Apex \ No newline at end of file diff --git a/Lang/Apex/Determine-if-a-string-is-numeric b/Lang/Apex/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..834be6823a --- /dev/null +++ b/Lang/Apex/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Apex \ No newline at end of file diff --git a/Lang/Apex/Empty-string b/Lang/Apex/Empty-string new file mode 120000 index 0000000000..ed2f821d93 --- /dev/null +++ b/Lang/Apex/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Apex \ No newline at end of file diff --git a/Lang/Apex/Factorial b/Lang/Apex/Factorial new file mode 120000 index 0000000000..32aa516b5c --- /dev/null +++ b/Lang/Apex/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Apex \ No newline at end of file diff --git a/Lang/Apex/Fibonacci-sequence b/Lang/Apex/Fibonacci-sequence new file mode 120000 index 0000000000..3af68b79bc --- /dev/null +++ b/Lang/Apex/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Apex \ No newline at end of file diff --git a/Lang/Apex/Filter b/Lang/Apex/Filter new file mode 120000 index 0000000000..a29275b503 --- /dev/null +++ b/Lang/Apex/Filter @@ -0,0 +1 @@ +../../Task/Filter/Apex \ No newline at end of file diff --git a/Lang/Apex/Increment-a-numerical-string b/Lang/Apex/Increment-a-numerical-string new file mode 120000 index 0000000000..e490c325e8 --- /dev/null +++ b/Lang/Apex/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Apex \ No newline at end of file diff --git a/Lang/Apex/JSON b/Lang/Apex/JSON new file mode 120000 index 0000000000..8957695a64 --- /dev/null +++ b/Lang/Apex/JSON @@ -0,0 +1 @@ +../../Task/JSON/Apex \ No newline at end of file diff --git a/Lang/Apex/Logical-operations b/Lang/Apex/Logical-operations new file mode 120000 index 0000000000..6b9fa0ef18 --- /dev/null +++ b/Lang/Apex/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Apex \ No newline at end of file diff --git a/Lang/Apex/Loops-For b/Lang/Apex/Loops-For new file mode 120000 index 0000000000..8eae190041 --- /dev/null +++ b/Lang/Apex/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Apex \ No newline at end of file diff --git a/Lang/Apex/Loops-Foreach b/Lang/Apex/Loops-Foreach new file mode 120000 index 0000000000..4518aeb091 --- /dev/null +++ b/Lang/Apex/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Apex \ No newline at end of file diff --git a/Lang/Apex/README b/Lang/Apex/README new file mode 100644 index 0000000000..734c1e13e9 --- /dev/null +++ b/Lang/Apex/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Apex diff --git a/Lang/Apex/Reverse-a-string b/Lang/Apex/Reverse-a-string new file mode 120000 index 0000000000..3f463f144e --- /dev/null +++ b/Lang/Apex/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Apex \ No newline at end of file diff --git a/Lang/Apex/Set b/Lang/Apex/Set new file mode 120000 index 0000000000..804769d77d --- /dev/null +++ b/Lang/Apex/Set @@ -0,0 +1 @@ +../../Task/Set/Apex \ No newline at end of file diff --git a/Lang/Apex/String-comparison b/Lang/Apex/String-comparison new file mode 120000 index 0000000000..4e5f63a917 --- /dev/null +++ b/Lang/Apex/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/Apex \ No newline at end of file diff --git a/Lang/Apex/String-concatenation b/Lang/Apex/String-concatenation new file mode 120000 index 0000000000..ae332f30f1 --- /dev/null +++ b/Lang/Apex/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Apex \ No newline at end of file diff --git a/Lang/Apex/String-length b/Lang/Apex/String-length new file mode 120000 index 0000000000..7d3f957d0e --- /dev/null +++ b/Lang/Apex/String-length @@ -0,0 +1 @@ +../../Task/String-length/Apex \ No newline at end of file diff --git a/Lang/Apex/Substring b/Lang/Apex/Substring new file mode 120000 index 0000000000..af692edb8c --- /dev/null +++ b/Lang/Apex/Substring @@ -0,0 +1 @@ +../../Task/Substring/Apex \ No newline at end of file diff --git a/Lang/Apex/Substring-Top-and-tail b/Lang/Apex/Substring-Top-and-tail new file mode 120000 index 0000000000..09027362b5 --- /dev/null +++ b/Lang/Apex/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/Apex \ No newline at end of file diff --git a/Lang/Apex/Symmetric-difference b/Lang/Apex/Symmetric-difference new file mode 120000 index 0000000000..f9f98bd379 --- /dev/null +++ b/Lang/Apex/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/Apex \ No newline at end of file diff --git a/Lang/Apex/URL-decoding b/Lang/Apex/URL-decoding new file mode 120000 index 0000000000..619e5c009e --- /dev/null +++ b/Lang/Apex/URL-decoding @@ -0,0 +1 @@ +../../Task/URL-decoding/Apex \ No newline at end of file diff --git a/Lang/Apex/URL-encoding b/Lang/Apex/URL-encoding new file mode 120000 index 0000000000..45e67a0976 --- /dev/null +++ b/Lang/Apex/URL-encoding @@ -0,0 +1 @@ +../../Task/URL-encoding/Apex \ No newline at end of file diff --git a/Lang/Apex/Variables b/Lang/Apex/Variables new file mode 120000 index 0000000000..82a0330594 --- /dev/null +++ b/Lang/Apex/Variables @@ -0,0 +1 @@ +../../Task/Variables/Apex \ No newline at end of file diff --git a/Lang/App-Inventor/00DESCRIPTION b/Lang/App-Inventor/00DESCRIPTION new file mode 100644 index 0000000000..29307761ee --- /dev/null +++ b/Lang/App-Inventor/00DESCRIPTION @@ -0,0 +1,5 @@ +{{language +|site=http://appinventor.mit.edu/explore/}} +'''App Inventor''' is a cloud-based Android apps-development platform. It was developed at Google Labs and is now maintained by the Media Lab at the Massachusetts Institute of Technology (MIT). It uses a graphical drag-and-drop interface to connect programming blocks which have the appearance of puzzle pieces. The intent is to use this tool as an introduction to programming for non-programmers as well as to build real-world applications. + +See also the [[wp:App_Inventor_for_Android|Wikipedia article]] for more information. \ No newline at end of file diff --git a/Lang/App-Inventor/README b/Lang/App-Inventor/README new file mode 100644 index 0000000000..5608b558bd --- /dev/null +++ b/Lang/App-Inventor/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:App_Inventor diff --git a/Lang/App-Inventor/Web-scraping b/Lang/App-Inventor/Web-scraping new file mode 120000 index 0000000000..1ade54d0fa --- /dev/null +++ b/Lang/App-Inventor/Web-scraping @@ -0,0 +1 @@ +../../Task/Web-scraping/App-Inventor \ No newline at end of file diff --git a/Lang/Apricot/00DESCRIPTION b/Lang/Apricot/00DESCRIPTION new file mode 100644 index 0000000000..9932da9ad3 --- /dev/null +++ b/Lang/Apricot/00DESCRIPTION @@ -0,0 +1,5 @@ +{{Language +|site=https://github.com/apricot-lang +|hopl=no}} +Clojure-like Lisp on Rubinius +{{stub}} \ No newline at end of file diff --git a/Lang/Apricot/Hello-world-Text b/Lang/Apricot/Hello-world-Text new file mode 120000 index 0000000000..7b7a89f2bc --- /dev/null +++ b/Lang/Apricot/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Apricot \ No newline at end of file diff --git a/Lang/Apricot/README b/Lang/Apricot/README new file mode 100644 index 0000000000..4485a3eab5 --- /dev/null +++ b/Lang/Apricot/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Apricot diff --git a/Lang/Arc/00DESCRIPTION b/Lang/Arc/00DESCRIPTION new file mode 100644 index 0000000000..008afae699 --- /dev/null +++ b/Lang/Arc/00DESCRIPTION @@ -0,0 +1,4 @@ +{{language}} +{{implementation|Lisp}} + +http://arclanguage.org \ No newline at end of file diff --git a/Lang/Arc/A+B b/Lang/Arc/A+B new file mode 120000 index 0000000000..d1f3d6b2b6 --- /dev/null +++ b/Lang/Arc/A+B @@ -0,0 +1 @@ +../../Task/A+B/Arc \ No newline at end of file diff --git a/Lang/Arc/FizzBuzz b/Lang/Arc/FizzBuzz new file mode 120000 index 0000000000..06eb4f8345 --- /dev/null +++ b/Lang/Arc/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Arc \ No newline at end of file diff --git a/Lang/Arc/Generic-swap b/Lang/Arc/Generic-swap new file mode 120000 index 0000000000..f497ce3740 --- /dev/null +++ b/Lang/Arc/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/Arc \ No newline at end of file diff --git a/Lang/Arc/Hostname b/Lang/Arc/Hostname new file mode 120000 index 0000000000..f79f12fedb --- /dev/null +++ b/Lang/Arc/Hostname @@ -0,0 +1 @@ +../../Task/Hostname/Arc \ No newline at end of file diff --git a/Lang/Arc/Levenshtein-distance b/Lang/Arc/Levenshtein-distance new file mode 120000 index 0000000000..9307998ba9 --- /dev/null +++ b/Lang/Arc/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Arc \ No newline at end of file diff --git a/Lang/Arc/N-queens-problem b/Lang/Arc/N-queens-problem new file mode 120000 index 0000000000..56b4728266 --- /dev/null +++ b/Lang/Arc/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/Arc \ No newline at end of file diff --git a/Lang/Arc/README b/Lang/Arc/README new file mode 100644 index 0000000000..72bad07769 --- /dev/null +++ b/Lang/Arc/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Arc diff --git a/Lang/Arendelle/00DESCRIPTION b/Lang/Arendelle/00DESCRIPTION new file mode 100644 index 0000000000..7258bfdae4 --- /dev/null +++ b/Lang/Arendelle/00DESCRIPTION @@ -0,0 +1,14 @@ +{{stub}}{{language +|site=http://web.arendelle.org/ +|gc=yes +|parampass=value +|tags=arendelle +}} + +[http://web.arendelle.org/ Arendelle] is a very minimal simple language designed for educational purposes and has 3 implementations in [[implemented in language::Java]], [[implemented in language::Swift]] and [[implemented in language::C#]] plus 2 code highlighting libraries in [[implemented in language::JavaScript]] as well as [[implemented in language::C#]]. Concepts of Arendelle are fairly different from all existing languages so to understand you may read [http://book.arendelle.org this online book] + +== Some good links == +* [http://web.arendelle.org Website] +* [http://book.arendelle.org Book] +* [http://web.arendelle.org/developer/ Arendelle Developer] +* [https://github.com/arendelle Project on GitHub] \ No newline at end of file diff --git a/Lang/Arendelle/README b/Lang/Arendelle/README new file mode 100644 index 0000000000..8d0f5ac589 --- /dev/null +++ b/Lang/Arendelle/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Arendelle diff --git a/Lang/AutoLISP/00DESCRIPTION b/Lang/AutoLISP/00DESCRIPTION new file mode 100644 index 0000000000..e62fe4c012 --- /dev/null +++ b/Lang/AutoLISP/00DESCRIPTION @@ -0,0 +1,7 @@ +{{language +|exec=interpreted +|gc=yes +|checking=dynamic +}} + +'''AutoLISP''' is a dialect of the [[Lisp]] programming language, and is built specifically for use within AutoCAD. \ No newline at end of file diff --git a/Lang/AutoLISP/Hello-world-Text b/Lang/AutoLISP/Hello-world-Text new file mode 120000 index 0000000000..3a1e13aec7 --- /dev/null +++ b/Lang/AutoLISP/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/AutoLISP \ No newline at end of file diff --git a/Lang/AutoLISP/README b/Lang/AutoLISP/README new file mode 100644 index 0000000000..727a0f5aa4 --- /dev/null +++ b/Lang/AutoLISP/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:AutoLISP diff --git a/Lang/Axe/00DESCRIPTION b/Lang/Axe/00DESCRIPTION new file mode 100644 index 0000000000..1248887894 --- /dev/null +++ b/Lang/Axe/00DESCRIPTION @@ -0,0 +1,16 @@ +{{ +language|Axe +|LCT=no +}} + +'''Axe''' is a compiled programming language for the TI-83 and TI-84 series calculators. It has a syntax similar to (but far more powerful than) [[TI-83 BASIC]], but it compiles to a no-stub [[Z80 Assembly]] executable rather than being interpreted like BASIC. Many of the language features are designed to ease writing games, but it can be used to write any kind of program. + +Its initial release was in 2010 and has been in constant development since then. It quickly became a favorite among TI-83/84 developers due to its speed of development and high performance. + +==See Also== +*[http://axe.eeems.ca/Documentation.pdf User's guide] +*[http://clrhome.org/tutorials/axe/ Tutorial] +*[http://axe.eeems.ca/Commands.html Language guide] +*[https://www.omnimaga.org/the-axe-parser-project/axe-parser/ Version history] + +[[Category:Programming Languages]] \ No newline at end of file diff --git a/Lang/Axe/99-Bottles-of-Beer b/Lang/Axe/99-Bottles-of-Beer new file mode 120000 index 0000000000..8bc43f777d --- /dev/null +++ b/Lang/Axe/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Axe \ No newline at end of file diff --git a/Lang/Axe/Address-of-a-variable b/Lang/Axe/Address-of-a-variable new file mode 120000 index 0000000000..1531c136c0 --- /dev/null +++ b/Lang/Axe/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/Axe \ No newline at end of file diff --git a/Lang/Axe/Arrays b/Lang/Axe/Arrays new file mode 120000 index 0000000000..9ac314196d --- /dev/null +++ b/Lang/Axe/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Axe \ No newline at end of file diff --git a/Lang/Axe/Assertions b/Lang/Axe/Assertions new file mode 120000 index 0000000000..eb689fc24f --- /dev/null +++ b/Lang/Axe/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Axe \ No newline at end of file diff --git a/Lang/Axe/Binary-digits b/Lang/Axe/Binary-digits new file mode 120000 index 0000000000..3771a4b03d --- /dev/null +++ b/Lang/Axe/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Axe \ No newline at end of file diff --git a/Lang/Axe/Binary-search b/Lang/Axe/Binary-search new file mode 120000 index 0000000000..378f5c23c0 --- /dev/null +++ b/Lang/Axe/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Axe \ No newline at end of file diff --git a/Lang/Axe/Bitmap b/Lang/Axe/Bitmap new file mode 120000 index 0000000000..7c95758f1d --- /dev/null +++ b/Lang/Axe/Bitmap @@ -0,0 +1 @@ +../../Task/Bitmap/Axe \ No newline at end of file diff --git a/Lang/Axe/Bitwise-operations b/Lang/Axe/Bitwise-operations new file mode 120000 index 0000000000..15c77bcc78 --- /dev/null +++ b/Lang/Axe/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/Axe \ No newline at end of file diff --git a/Lang/Axe/Call-a-function b/Lang/Axe/Call-a-function new file mode 120000 index 0000000000..dd6b0a6fe7 --- /dev/null +++ b/Lang/Axe/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/Axe \ No newline at end of file diff --git a/Lang/Axe/Character-codes b/Lang/Axe/Character-codes new file mode 120000 index 0000000000..6323ce39a4 --- /dev/null +++ b/Lang/Axe/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Axe \ No newline at end of file diff --git a/Lang/Axe/Check-that-file-exists b/Lang/Axe/Check-that-file-exists new file mode 120000 index 0000000000..3771036e14 --- /dev/null +++ b/Lang/Axe/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Axe \ No newline at end of file diff --git a/Lang/Axe/Collections b/Lang/Axe/Collections new file mode 120000 index 0000000000..d7d8eab5f0 --- /dev/null +++ b/Lang/Axe/Collections @@ -0,0 +1 @@ +../../Task/Collections/Axe \ No newline at end of file diff --git a/Lang/Axe/Color-of-a-screen-pixel b/Lang/Axe/Color-of-a-screen-pixel new file mode 120000 index 0000000000..d573b78114 --- /dev/null +++ b/Lang/Axe/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/Axe \ No newline at end of file diff --git a/Lang/Axe/Comments b/Lang/Axe/Comments new file mode 120000 index 0000000000..fd380db6f6 --- /dev/null +++ b/Lang/Axe/Comments @@ -0,0 +1 @@ +../../Task/Comments/Axe \ No newline at end of file diff --git a/Lang/Axe/Compound-data-type b/Lang/Axe/Compound-data-type new file mode 120000 index 0000000000..5513ca963b --- /dev/null +++ b/Lang/Axe/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/Axe \ No newline at end of file diff --git a/Lang/Axe/Conditional-structures b/Lang/Axe/Conditional-structures new file mode 120000 index 0000000000..6646412fa9 --- /dev/null +++ b/Lang/Axe/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Axe \ No newline at end of file diff --git a/Lang/Axe/Conways-Game-of-Life b/Lang/Axe/Conways-Game-of-Life new file mode 120000 index 0000000000..fdfecb4f10 --- /dev/null +++ b/Lang/Axe/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/Axe \ No newline at end of file diff --git a/Lang/Axe/Copy-a-string b/Lang/Axe/Copy-a-string new file mode 120000 index 0000000000..d4c2d2b2a7 --- /dev/null +++ b/Lang/Axe/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Axe \ No newline at end of file diff --git a/Lang/Axe/Create-a-file b/Lang/Axe/Create-a-file new file mode 120000 index 0000000000..f85da60a34 --- /dev/null +++ b/Lang/Axe/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/Axe \ No newline at end of file diff --git a/Lang/Axe/Delete-a-file b/Lang/Axe/Delete-a-file new file mode 120000 index 0000000000..d3683a2978 --- /dev/null +++ b/Lang/Axe/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Axe \ No newline at end of file diff --git a/Lang/Axe/Doubly-linked-list-Element-definition b/Lang/Axe/Doubly-linked-list-Element-definition new file mode 120000 index 0000000000..b0d156ada5 --- /dev/null +++ b/Lang/Axe/Doubly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Element-definition/Axe \ No newline at end of file diff --git a/Lang/Axe/Doubly-linked-list-Element-insertion b/Lang/Axe/Doubly-linked-list-Element-insertion new file mode 120000 index 0000000000..12f31e34e2 --- /dev/null +++ b/Lang/Axe/Doubly-linked-list-Element-insertion @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Element-insertion/Axe \ No newline at end of file diff --git a/Lang/Axe/Doubly-linked-list-Traversal b/Lang/Axe/Doubly-linked-list-Traversal new file mode 120000 index 0000000000..0df0ddc492 --- /dev/null +++ b/Lang/Axe/Doubly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Traversal/Axe \ No newline at end of file diff --git a/Lang/Axe/Empty-program b/Lang/Axe/Empty-program new file mode 120000 index 0000000000..00cb51e44d --- /dev/null +++ b/Lang/Axe/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/Axe \ No newline at end of file diff --git a/Lang/Axe/Empty-string b/Lang/Axe/Empty-string new file mode 120000 index 0000000000..2795d87606 --- /dev/null +++ b/Lang/Axe/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Axe \ No newline at end of file diff --git a/Lang/Axe/Execute-Brain---- b/Lang/Axe/Execute-Brain---- new file mode 120000 index 0000000000..2b54a20ba4 --- /dev/null +++ b/Lang/Axe/Execute-Brain---- @@ -0,0 +1 @@ +../../Task/Execute-Brain----/Axe \ No newline at end of file diff --git a/Lang/Axe/Factorial b/Lang/Axe/Factorial new file mode 120000 index 0000000000..48799f7ad0 --- /dev/null +++ b/Lang/Axe/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Axe \ No newline at end of file diff --git a/Lang/Axe/Fibonacci-sequence b/Lang/Axe/Fibonacci-sequence new file mode 120000 index 0000000000..226b6e01b6 --- /dev/null +++ b/Lang/Axe/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Axe \ No newline at end of file diff --git a/Lang/Axe/File-size b/Lang/Axe/File-size new file mode 120000 index 0000000000..4fbbf7936f --- /dev/null +++ b/Lang/Axe/File-size @@ -0,0 +1 @@ +../../Task/File-size/Axe \ No newline at end of file diff --git a/Lang/Axe/Find-limit-of-recursion b/Lang/Axe/Find-limit-of-recursion new file mode 120000 index 0000000000..3429851e90 --- /dev/null +++ b/Lang/Axe/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/Axe \ No newline at end of file diff --git a/Lang/Axe/FizzBuzz b/Lang/Axe/FizzBuzz new file mode 120000 index 0000000000..b2889047ff --- /dev/null +++ b/Lang/Axe/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Axe \ No newline at end of file diff --git a/Lang/Axe/Function-definition b/Lang/Axe/Function-definition new file mode 120000 index 0000000000..3cd73cb7b8 --- /dev/null +++ b/Lang/Axe/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Axe \ No newline at end of file diff --git a/Lang/Axe/Generic-swap b/Lang/Axe/Generic-swap new file mode 120000 index 0000000000..e402260f30 --- /dev/null +++ b/Lang/Axe/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/Axe \ No newline at end of file diff --git a/Lang/Axe/Greatest-common-divisor b/Lang/Axe/Greatest-common-divisor new file mode 120000 index 0000000000..f3d27a7b3c --- /dev/null +++ b/Lang/Axe/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Axe \ No newline at end of file diff --git a/Lang/Axe/Greatest-element-of-a-list b/Lang/Axe/Greatest-element-of-a-list new file mode 120000 index 0000000000..6d7bae262e --- /dev/null +++ b/Lang/Axe/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Axe \ No newline at end of file diff --git a/Lang/Axe/Hello-world-Graphical b/Lang/Axe/Hello-world-Graphical new file mode 120000 index 0000000000..94cbbbcdd2 --- /dev/null +++ b/Lang/Axe/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Axe \ No newline at end of file diff --git a/Lang/Axe/Hello-world-Newbie b/Lang/Axe/Hello-world-Newbie new file mode 120000 index 0000000000..aefbe61d54 --- /dev/null +++ b/Lang/Axe/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/Axe \ No newline at end of file diff --git a/Lang/Axe/Hello-world-Newline-omission b/Lang/Axe/Hello-world-Newline-omission new file mode 120000 index 0000000000..64983552d3 --- /dev/null +++ b/Lang/Axe/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Axe \ No newline at end of file diff --git a/Lang/Axe/Hello-world-Text b/Lang/Axe/Hello-world-Text new file mode 120000 index 0000000000..06ada5def3 --- /dev/null +++ b/Lang/Axe/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Axe \ No newline at end of file diff --git a/Lang/Axe/Image-noise b/Lang/Axe/Image-noise new file mode 120000 index 0000000000..56526c6c11 --- /dev/null +++ b/Lang/Axe/Image-noise @@ -0,0 +1 @@ +../../Task/Image-noise/Axe \ No newline at end of file diff --git a/Lang/Axe/Include-a-file b/Lang/Axe/Include-a-file new file mode 120000 index 0000000000..0b4154f958 --- /dev/null +++ b/Lang/Axe/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/Axe \ No newline at end of file diff --git a/Lang/Axe/Integer-comparison b/Lang/Axe/Integer-comparison new file mode 120000 index 0000000000..db8942becf --- /dev/null +++ b/Lang/Axe/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Axe \ No newline at end of file diff --git a/Lang/Axe/Integer-overflow b/Lang/Axe/Integer-overflow new file mode 120000 index 0000000000..c89c91fed6 --- /dev/null +++ b/Lang/Axe/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/Axe \ No newline at end of file diff --git a/Lang/Axe/Integer-sequence b/Lang/Axe/Integer-sequence new file mode 120000 index 0000000000..e3d23b90f2 --- /dev/null +++ b/Lang/Axe/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Axe \ No newline at end of file diff --git a/Lang/Axe/Keyboard-input-Flush-the-keyboard-buffer b/Lang/Axe/Keyboard-input-Flush-the-keyboard-buffer new file mode 120000 index 0000000000..a0b5d999db --- /dev/null +++ b/Lang/Axe/Keyboard-input-Flush-the-keyboard-buffer @@ -0,0 +1 @@ +../../Task/Keyboard-input-Flush-the-keyboard-buffer/Axe \ No newline at end of file diff --git a/Lang/Axe/Keyboard-input-Keypress-check b/Lang/Axe/Keyboard-input-Keypress-check new file mode 120000 index 0000000000..d518fae5a0 --- /dev/null +++ b/Lang/Axe/Keyboard-input-Keypress-check @@ -0,0 +1 @@ +../../Task/Keyboard-input-Keypress-check/Axe \ No newline at end of file diff --git a/Lang/Axe/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/Axe/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..fd2ea9fc0f --- /dev/null +++ b/Lang/Axe/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/Axe \ No newline at end of file diff --git a/Lang/Axe/Literals-Floating-point b/Lang/Axe/Literals-Floating-point new file mode 120000 index 0000000000..6853d0f6fa --- /dev/null +++ b/Lang/Axe/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/Axe \ No newline at end of file diff --git a/Lang/Axe/Literals-Integer b/Lang/Axe/Literals-Integer new file mode 120000 index 0000000000..284a4af51e --- /dev/null +++ b/Lang/Axe/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/Axe \ No newline at end of file diff --git a/Lang/Axe/Literals-String b/Lang/Axe/Literals-String new file mode 120000 index 0000000000..8e169fe38b --- /dev/null +++ b/Lang/Axe/Literals-String @@ -0,0 +1 @@ +../../Task/Literals-String/Axe \ No newline at end of file diff --git a/Lang/Axe/Logical-operations b/Lang/Axe/Logical-operations new file mode 120000 index 0000000000..6badf399e5 --- /dev/null +++ b/Lang/Axe/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Axe \ No newline at end of file diff --git a/Lang/Axe/Loop-over-multiple-arrays-simultaneously b/Lang/Axe/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..22e208f3c2 --- /dev/null +++ b/Lang/Axe/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Axe \ No newline at end of file diff --git a/Lang/Axe/Loops-Break b/Lang/Axe/Loops-Break new file mode 120000 index 0000000000..ee25d666c1 --- /dev/null +++ b/Lang/Axe/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Axe \ No newline at end of file diff --git a/Lang/Axe/Loops-Do-while b/Lang/Axe/Loops-Do-while new file mode 120000 index 0000000000..fcae914f24 --- /dev/null +++ b/Lang/Axe/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Axe \ No newline at end of file diff --git a/Lang/Axe/Loops-Downward-for b/Lang/Axe/Loops-Downward-for new file mode 120000 index 0000000000..d2344b8661 --- /dev/null +++ b/Lang/Axe/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Axe \ No newline at end of file diff --git a/Lang/Axe/Loops-For b/Lang/Axe/Loops-For new file mode 120000 index 0000000000..877e887ad6 --- /dev/null +++ b/Lang/Axe/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Axe \ No newline at end of file diff --git a/Lang/Axe/Loops-For-with-a-specified-step b/Lang/Axe/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..6421eeaffc --- /dev/null +++ b/Lang/Axe/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Axe \ No newline at end of file diff --git a/Lang/Axe/Loops-Infinite b/Lang/Axe/Loops-Infinite new file mode 120000 index 0000000000..de18401521 --- /dev/null +++ b/Lang/Axe/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Axe \ No newline at end of file diff --git a/Lang/Axe/Loops-N-plus-one-half b/Lang/Axe/Loops-N-plus-one-half new file mode 120000 index 0000000000..c9b2c1aea6 --- /dev/null +++ b/Lang/Axe/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Axe \ No newline at end of file diff --git a/Lang/Axe/Loops-While b/Lang/Axe/Loops-While new file mode 120000 index 0000000000..a7ce0de2f3 --- /dev/null +++ b/Lang/Axe/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Axe \ No newline at end of file diff --git a/Lang/Axe/Memory-allocation b/Lang/Axe/Memory-allocation new file mode 120000 index 0000000000..ed830172e4 --- /dev/null +++ b/Lang/Axe/Memory-allocation @@ -0,0 +1 @@ +../../Task/Memory-allocation/Axe \ No newline at end of file diff --git a/Lang/Axe/Menu b/Lang/Axe/Menu new file mode 120000 index 0000000000..4a5e1f9437 --- /dev/null +++ b/Lang/Axe/Menu @@ -0,0 +1 @@ +../../Task/Menu/Axe \ No newline at end of file diff --git a/Lang/Axe/Multiplication-tables b/Lang/Axe/Multiplication-tables new file mode 120000 index 0000000000..c64bce3b7d --- /dev/null +++ b/Lang/Axe/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/Axe \ No newline at end of file diff --git a/Lang/Axe/Null-object b/Lang/Axe/Null-object new file mode 120000 index 0000000000..5bbf1953cc --- /dev/null +++ b/Lang/Axe/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/Axe \ No newline at end of file diff --git a/Lang/Axe/Program-termination b/Lang/Axe/Program-termination new file mode 120000 index 0000000000..2680f93419 --- /dev/null +++ b/Lang/Axe/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/Axe \ No newline at end of file diff --git a/Lang/Axe/README b/Lang/Axe/README new file mode 100644 index 0000000000..f52f235f7b --- /dev/null +++ b/Lang/Axe/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Axe diff --git a/Lang/Axe/Real-constants-and-functions b/Lang/Axe/Real-constants-and-functions new file mode 120000 index 0000000000..00ae08a367 --- /dev/null +++ b/Lang/Axe/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/Axe \ No newline at end of file diff --git a/Lang/Axe/Short-circuit-evaluation b/Lang/Axe/Short-circuit-evaluation new file mode 120000 index 0000000000..e4596be192 --- /dev/null +++ b/Lang/Axe/Short-circuit-evaluation @@ -0,0 +1 @@ +../../Task/Short-circuit-evaluation/Axe \ No newline at end of file diff --git a/Lang/Axe/Singly-linked-list-Element-definition b/Lang/Axe/Singly-linked-list-Element-definition new file mode 120000 index 0000000000..d926a65e8c --- /dev/null +++ b/Lang/Axe/Singly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-definition/Axe \ No newline at end of file diff --git a/Lang/Axe/Singly-linked-list-Element-insertion b/Lang/Axe/Singly-linked-list-Element-insertion new file mode 120000 index 0000000000..c6c2b7e06a --- /dev/null +++ b/Lang/Axe/Singly-linked-list-Element-insertion @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-insertion/Axe \ No newline at end of file diff --git a/Lang/Axe/Singly-linked-list-Traversal b/Lang/Axe/Singly-linked-list-Traversal new file mode 120000 index 0000000000..47f87966a7 --- /dev/null +++ b/Lang/Axe/Singly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Traversal/Axe \ No newline at end of file diff --git a/Lang/Axe/Sleep b/Lang/Axe/Sleep new file mode 120000 index 0000000000..0969294dd3 --- /dev/null +++ b/Lang/Axe/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Axe \ No newline at end of file diff --git a/Lang/Axe/Sort-an-integer-array b/Lang/Axe/Sort-an-integer-array new file mode 120000 index 0000000000..441df4850b --- /dev/null +++ b/Lang/Axe/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Axe \ No newline at end of file diff --git a/Lang/Axe/Stack b/Lang/Axe/Stack new file mode 120000 index 0000000000..9390948ed1 --- /dev/null +++ b/Lang/Axe/Stack @@ -0,0 +1 @@ +../../Task/Stack/Axe \ No newline at end of file diff --git a/Lang/Axe/String-append b/Lang/Axe/String-append new file mode 120000 index 0000000000..42ba008f6e --- /dev/null +++ b/Lang/Axe/String-append @@ -0,0 +1 @@ +../../Task/String-append/Axe \ No newline at end of file diff --git a/Lang/Axe/String-concatenation b/Lang/Axe/String-concatenation new file mode 120000 index 0000000000..e2502b674c --- /dev/null +++ b/Lang/Axe/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Axe \ No newline at end of file diff --git a/Lang/Axe/String-length b/Lang/Axe/String-length new file mode 120000 index 0000000000..6dd723954f --- /dev/null +++ b/Lang/Axe/String-length @@ -0,0 +1 @@ +../../Task/String-length/Axe \ No newline at end of file diff --git a/Lang/Axe/Substring b/Lang/Axe/Substring new file mode 120000 index 0000000000..1e715f41a4 --- /dev/null +++ b/Lang/Axe/Substring @@ -0,0 +1 @@ +../../Task/Substring/Axe \ No newline at end of file diff --git a/Lang/Axe/Terminal-control-Clear-the-screen b/Lang/Axe/Terminal-control-Clear-the-screen new file mode 120000 index 0000000000..5fc887de68 --- /dev/null +++ b/Lang/Axe/Terminal-control-Clear-the-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Clear-the-screen/Axe \ No newline at end of file diff --git a/Lang/Axe/Terminal-control-Cursor-movement b/Lang/Axe/Terminal-control-Cursor-movement new file mode 120000 index 0000000000..b0b384096a --- /dev/null +++ b/Lang/Axe/Terminal-control-Cursor-movement @@ -0,0 +1 @@ +../../Task/Terminal-control-Cursor-movement/Axe \ No newline at end of file diff --git a/Lang/Axe/Terminal-control-Cursor-positioning b/Lang/Axe/Terminal-control-Cursor-positioning new file mode 120000 index 0000000000..b0c328622a --- /dev/null +++ b/Lang/Axe/Terminal-control-Cursor-positioning @@ -0,0 +1 @@ +../../Task/Terminal-control-Cursor-positioning/Axe \ No newline at end of file diff --git a/Lang/Axe/Terminal-control-Inverse-video b/Lang/Axe/Terminal-control-Inverse-video new file mode 120000 index 0000000000..3b33465131 --- /dev/null +++ b/Lang/Axe/Terminal-control-Inverse-video @@ -0,0 +1 @@ +../../Task/Terminal-control-Inverse-video/Axe \ No newline at end of file diff --git a/Lang/Axe/Topic-variable b/Lang/Axe/Topic-variable new file mode 120000 index 0000000000..4051d7c9aa --- /dev/null +++ b/Lang/Axe/Topic-variable @@ -0,0 +1 @@ +../../Task/Topic-variable/Axe \ No newline at end of file diff --git a/Lang/Axe/Trigonometric-functions b/Lang/Axe/Trigonometric-functions new file mode 120000 index 0000000000..b3e527e064 --- /dev/null +++ b/Lang/Axe/Trigonometric-functions @@ -0,0 +1 @@ +../../Task/Trigonometric-functions/Axe \ No newline at end of file diff --git a/Lang/Axe/User-input-Text b/Lang/Axe/User-input-Text new file mode 120000 index 0000000000..2ccc6d9854 --- /dev/null +++ b/Lang/Axe/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/Axe \ No newline at end of file diff --git a/Lang/Axe/Variables b/Lang/Axe/Variables new file mode 120000 index 0000000000..d7060cfe4f --- /dev/null +++ b/Lang/Axe/Variables @@ -0,0 +1 @@ +../../Task/Variables/Axe \ No newline at end of file diff --git a/Lang/B4J/00DESCRIPTION b/Lang/B4J/00DESCRIPTION new file mode 100644 index 0000000000..c2e0848006 --- /dev/null +++ b/Lang/B4J/00DESCRIPTION @@ -0,0 +1,16 @@ +{{language +|site=http://www.basic4ppc.com/android/b4j.html}} +B4J is a 100% free development tool, similar to Basic4android that generates cross platform, desktop, server and web applications. +B4J follows the same concepts of Basic4android, providing a simple and powerful development tool. + +Q: Is B4J completely free, including for commercial purposes?
+A: Yes. + +Q: What are the requirements for UI apps developers with B4J?
+A: B4J UI apps depend on Java FX. Java FX is part of Java JRE 7 (build 6+). B4J UI apps will run on Windows, Mac, Linux and ARM Linux (Raspberry Pi for example) computers. + +Q: Which file should be distributed?
+A: When you compile your project in Release mode, the complete app is packaged in a single jar file under the Objects folder. You should distribute this jar file. + +Q: Can I reuse Basic4android code with B4J?
+A: Most of the non-UI code can be reused. \ No newline at end of file diff --git a/Lang/B4J/README b/Lang/B4J/README new file mode 100644 index 0000000000..29e9ac0421 --- /dev/null +++ b/Lang/B4J/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:B4J diff --git a/Lang/B4J/Simple-windowed-application b/Lang/B4J/Simple-windowed-application new file mode 120000 index 0000000000..4abeddd8c8 --- /dev/null +++ b/Lang/B4J/Simple-windowed-application @@ -0,0 +1 @@ +../../Task/Simple-windowed-application/B4J \ No newline at end of file diff --git a/Lang/BML/00DESCRIPTION b/Lang/BML/00DESCRIPTION new file mode 100644 index 0000000000..0a834e1c18 --- /dev/null +++ b/Lang/BML/00DESCRIPTION @@ -0,0 +1,13 @@ +{{stub}} +{{language +|exec=bytecode +|gc=no +|safety=unsafe +|express=implicit +|checking=dynamic +|tags=bml +}} + +The '''BML''' programming language is a BASIC dialect currently being developed by Fluffy Smoke Technologies(formerly The BuRg3r Team) and some of its features are based on [http://rosettacode.org/wiki/Category:Lua Lua]. + +BML is also compiled into its own bytecode which can then either be executed or translated into a different language entirely. \ No newline at end of file diff --git a/Lang/BML/Arrays b/Lang/BML/Arrays new file mode 120000 index 0000000000..d0511418ec --- /dev/null +++ b/Lang/BML/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/BML \ No newline at end of file diff --git a/Lang/BML/Hello-world-Graphical b/Lang/BML/Hello-world-Graphical new file mode 120000 index 0000000000..0df9e38a2e --- /dev/null +++ b/Lang/BML/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/BML \ No newline at end of file diff --git a/Lang/BML/Hello-world-Text b/Lang/BML/Hello-world-Text new file mode 120000 index 0000000000..228442d64d --- /dev/null +++ b/Lang/BML/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/BML \ No newline at end of file diff --git a/Lang/BML/README b/Lang/BML/README new file mode 100644 index 0000000000..2c08ab8849 --- /dev/null +++ b/Lang/BML/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:BML diff --git a/Lang/Battlestar/00DESCRIPTION b/Lang/Battlestar/00DESCRIPTION new file mode 100644 index 0000000000..0408ca94e0 --- /dev/null +++ b/Lang/Battlestar/00DESCRIPTION @@ -0,0 +1,30 @@ +{{language}} + += Battlestar = + +A different take on assembly, with the goal of creating tiny executables. + +== Battlestar is == + +* A work in progress. +* Created for fun and for the educational process. +* A programming language specifically for 64-bit x86 Linux, 32-bit x86 Linux, 32-bit x86 OS X and 16-bit x86 DOS. +* Subset of assembly with different syntax and support for inline C. +* The indended purpose is for writing 4k and 64k demoscene demos. + +== Features == + +* The resulting executables are tiny! +* "hello world" is only 129 bytes on 32-bit Linux (when using sstrip from elfkickers). +* It's possible to write an operating system with only one source file. +* Full support for inline C (by utilizing an external compiler like gcc or tcc). +* C and Battlestar code can exist in the same source file and calls can be made both ways. +* Battlestar programs compile almost instantly. +* Programs can be run like scripts by including this line at the top: #!/usr/bin/bts +* Interrupts can be called with the same syntax for both 32-bit and 64-bit x86 on Linux. +* Also supports 16-bit x86 with DosBox. +* The intermediate assembly is fully commented. + +== Project page == + +https://github.com/xyproto/battlestar \ No newline at end of file diff --git a/Lang/Battlestar/99-Bottles-of-Beer b/Lang/Battlestar/99-Bottles-of-Beer new file mode 120000 index 0000000000..00f45400b1 --- /dev/null +++ b/Lang/Battlestar/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Battlestar \ No newline at end of file diff --git a/Lang/Battlestar/Fibonacci-sequence b/Lang/Battlestar/Fibonacci-sequence new file mode 120000 index 0000000000..3e7ca7365c --- /dev/null +++ b/Lang/Battlestar/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Battlestar \ No newline at end of file diff --git a/Lang/Battlestar/Hello-world-Text b/Lang/Battlestar/Hello-world-Text new file mode 120000 index 0000000000..7ee10e0993 --- /dev/null +++ b/Lang/Battlestar/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Battlestar \ No newline at end of file diff --git a/Lang/Battlestar/README b/Lang/Battlestar/README new file mode 100644 index 0000000000..171e5d8ae2 --- /dev/null +++ b/Lang/Battlestar/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Battlestar diff --git a/Lang/Beeswax/00DESCRIPTION b/Lang/Beeswax/00DESCRIPTION new file mode 100644 index 0000000000..bea56d7b6b --- /dev/null +++ b/Lang/Beeswax/00DESCRIPTION @@ -0,0 +1,35 @@ +{{language|beeswax}} + +'''beeswax''' is a stack-based 2 dimensional esoteric programming language developed by [[user:Albedo]] (Manuel Lohmann). Beeswax draws inspiration from bees moving around on a honeycomb, and is partly inspired by languages like [http://esolangs.org/wiki/Cardinal Cardinal] etc. +The instruction pointers (bees) move around on a 2D hexagonal grid (the honeycomb). beeswax programs can manipulate their own source code, change the program size, and can read and write files. +beeswax programs are stored in a rectangular grid with a 6-neigborhood. β depicts a bee/instruction pointer. + + 21 + 3β0 + 45 + +analogous to + + 2 — 1 + / \ / \ + 3 — β — 0 + \ / \ / + 4 — 5 + +Bees can perform all kinds of arithmetic operations, jumps, code modifications etc. Each bee carries a fixed-size stack of length 3 and can store or retrieve data by interacting either with the global stack (of arbitrary size) or the honeycomb/source code itself. + +Data on the global stack can be written to files on disk, and global stack contents can be written to files on disk. + +All data in the local and global stacks are unsigned 64-bit integers, output as characters uses UTF8 encoding. + + +== More information == + +* [[eso:Beeswax|Esoteric languages wiki entry]] + +== Reference implementation, example programs and complete language specification == + +* [https://github.com/m-lohmann/BeeswaxEsolang.jl GitHub repository containing reference implementation in Julia, example programs and language specification] + + +[[Category:Esoteric_Languages]] \ No newline at end of file diff --git a/Lang/Beeswax/README b/Lang/Beeswax/README new file mode 100644 index 0000000000..e83e7559d4 --- /dev/null +++ b/Lang/Beeswax/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Beeswax diff --git a/Lang/Binary-Lambda-Calculus/00DESCRIPTION b/Lang/Binary-Lambda-Calculus/00DESCRIPTION new file mode 100644 index 0000000000..b1d24e9edd --- /dev/null +++ b/Lang/Binary-Lambda-Calculus/00DESCRIPTION @@ -0,0 +1,10 @@ +{{language|Binary lambda calculus +|exec=interpreted +|site=http://tromp.github.io/cl/cl.html +|LCT=no +}} +{{language programming paradigm|functional}} +'''Binary Lambda Calculus''' is a minimal, pure, functional, esoteric language based on lambda calculus. [[provides::Capability:First class functions| ]] +==External links== +* [[eso:Binary_lambda_calculus|Esoteric languages wiki page]] +[[Category:Esoteric Languages]] \ No newline at end of file diff --git a/Lang/Binary-Lambda-Calculus/README b/Lang/Binary-Lambda-Calculus/README new file mode 100644 index 0000000000..e34150dde1 --- /dev/null +++ b/Lang/Binary-Lambda-Calculus/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Binary_Lambda_Calculus diff --git a/Lang/CHR/00DESCRIPTION b/Lang/CHR/00DESCRIPTION new file mode 100644 index 0000000000..876460e02e --- /dev/null +++ b/Lang/CHR/00DESCRIPTION @@ -0,0 +1,8 @@ +{{stub}} +{{language|CHR +|exec=both +|site=http://dtai.cs.kuleuven.be/CHR/ +|gc=yes +|safety=safe +|checking=both +}} \ No newline at end of file diff --git a/Lang/CHR/README b/Lang/CHR/README new file mode 100644 index 0000000000..7d2fbaae76 --- /dev/null +++ b/Lang/CHR/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:CHR diff --git a/Lang/CafeOBJ/00DESCRIPTION b/Lang/CafeOBJ/00DESCRIPTION new file mode 100644 index 0000000000..967f002eee --- /dev/null +++ b/Lang/CafeOBJ/00DESCRIPTION @@ -0,0 +1,66 @@ +{{language}} +==Basic Information== +CafeOBJ is a algebraic specification language. +It has an executable sub-language which is broadly similar to Haskell or ML. +CafeOBJ has many advanced features including: multiple logics, flexible mix-fix syntax, powerful and clear typing system with ordered sorts, parametric modules and views for instantiating the parameters, and module expressions, and more. +Many of these features are inherited from [http://en.wikipedia.org/wiki/OBJ3 OBJ3] + +[http://www.ldl.jaist.ac.jp/cafeobj/ Download] , +[http://www.jaist.ac.jp/~t-seino/lectures/cafeobj-intro/en/index.html Tutorial] , +[http://www.jaist.ac.jp/~ogata/lecture/i217/ Lectures] , +[http://logic.pdmi.ras.ru/csclub/en/node/1819 Video-1] , +[http://sel.ifmo.ru/seminar/cafeobj.webm Video-2] , + + + + +===Examples=== + +-- Text file called say Hello.cafe ,contains the following +mod! HELLO-WORLD { +pr(STRING) +op hello : -> String +eq hello = "Hello World" . +} +-- Bring *in* the file at CafeOBJ prompt +in hello.cafe +-- Open the HELLO-WORLD module +open HELLO-WORLD +-- Execute with the reduce command +reduce hello . +-- Gives ("Hello World"):String + + + + +-- Here is a sorting program. +mod! SORTING-NAT { +pr(NAT) +[Nat < Strg ] +-- Simple list structure +op nil : -> Strg +op _._ : Strg Strg -> Strg { assoc id: nil } + +vars N N' : Nat +-- A very short sorting program using on transition equation in POA logic, which is a type of rewrite logic/ +-- The program is in the form of a condition transition, which will swap N and N' if N is larger or equal to N'. +-- This is a equation in POA logic so there is no need for an intermediate variable to do the swap. +ctrans [swap] : (N . N') => (N' . N) if N' <= N . +} + +**> Sorting natural numbers using exec command +open SORTING-NAT +exec (3 . 2 . 1) . +**> We can consider sorting as a path through the state space of the permutations of N numbers. +**> There are N! permutations only one of which is sorted. +**> Sorting natural numbers using search command +**> we can use (show path N) with this command, where N is the number of possible states. +red (3 . 2 . 1) =(1,1)=>* (1 . 2 . 3) . +red (3 . 2 . 1) =(1,2)=>* (1 . 2 . 3) . +red (3 . 2 . 1) =(1,3)=>* (1 . 2 . 3) . +**> search for any number of solutions at any depth +red (3 . 2 . 1) =(*,*)=>* (1 . 2 . 3) . +**> print the transitions from initial to goal state +show path 5 +eof + \ No newline at end of file diff --git a/Lang/CafeOBJ/README b/Lang/CafeOBJ/README new file mode 100644 index 0000000000..e6629b1ade --- /dev/null +++ b/Lang/CafeOBJ/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:CafeOBJ diff --git a/Lang/CafeOBJ/Remove-duplicate-elements b/Lang/CafeOBJ/Remove-duplicate-elements new file mode 120000 index 0000000000..fb4d648d98 --- /dev/null +++ b/Lang/CafeOBJ/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/CafeOBJ \ No newline at end of file diff --git a/Lang/Ceylon/00DESCRIPTION b/Lang/Ceylon/00DESCRIPTION new file mode 100644 index 0000000000..c220840664 --- /dev/null +++ b/Lang/Ceylon/00DESCRIPTION @@ -0,0 +1,21 @@ +{{stub}}{{language}} + +{{language|Ceylon +|site=http://ceylon-lang.org/ +|gc=yes +|strength=strong +|safety=safe +|express=both +|compat=nominative +|tags=ceylon +|checking=both}} +{{language programming paradigm|Imperative}} +{{language programming paradigm|procedural}} +{{language programming paradigm|object-oriented}} +{{language programming paradigm|Functional}} +{{language programming paradigm|generic}} + +The '''Ceylon''' is a high-level, statically and strong-typed programming language and SDK, created by [[wp:Red Hat|Red Hat]]. It is based on the [[Java|Java programming language]]. Ceylon programs run on the [[Java Virtual Machine]] and JavaScript Virtual Machines. + +==Citations== +* [[wp:Ceylon (programming language)|Wikipedia:Ceylon (programming language)]] \ No newline at end of file diff --git a/Lang/Ceylon/100-doors b/Lang/Ceylon/100-doors new file mode 120000 index 0000000000..d676bee3d0 --- /dev/null +++ b/Lang/Ceylon/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/24-game b/Lang/Ceylon/24-game new file mode 120000 index 0000000000..a9cd95b225 --- /dev/null +++ b/Lang/Ceylon/24-game @@ -0,0 +1 @@ +../../Task/24-game/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/99-Bottles-of-Beer b/Lang/Ceylon/99-Bottles-of-Beer new file mode 120000 index 0000000000..1e72e3ffcb --- /dev/null +++ b/Lang/Ceylon/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/A+B b/Lang/Ceylon/A+B new file mode 120000 index 0000000000..836a4ea2d4 --- /dev/null +++ b/Lang/Ceylon/A+B @@ -0,0 +1 @@ +../../Task/A+B/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/ABC-Problem b/Lang/Ceylon/ABC-Problem new file mode 120000 index 0000000000..f27e245571 --- /dev/null +++ b/Lang/Ceylon/ABC-Problem @@ -0,0 +1 @@ +../../Task/ABC-Problem/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Abundant,-deficient-and-perfect-number-classifications b/Lang/Ceylon/Abundant,-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..6f0c030f55 --- /dev/null +++ b/Lang/Ceylon/Abundant,-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant,-deficient-and-perfect-number-classifications/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Accumulator-factory b/Lang/Ceylon/Accumulator-factory new file mode 120000 index 0000000000..facba1d3ad --- /dev/null +++ b/Lang/Ceylon/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Animation b/Lang/Ceylon/Animation new file mode 120000 index 0000000000..d3c5aeda08 --- /dev/null +++ b/Lang/Ceylon/Animation @@ -0,0 +1 @@ +../../Task/Animation/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Array-concatenation b/Lang/Ceylon/Array-concatenation new file mode 120000 index 0000000000..7243372c79 --- /dev/null +++ b/Lang/Ceylon/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Arrays b/Lang/Ceylon/Arrays new file mode 120000 index 0000000000..1248c75317 --- /dev/null +++ b/Lang/Ceylon/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Associative-array-Creation b/Lang/Ceylon/Associative-array-Creation new file mode 120000 index 0000000000..6e93052462 --- /dev/null +++ b/Lang/Ceylon/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Associative-array-Iteration b/Lang/Ceylon/Associative-array-Iteration new file mode 120000 index 0000000000..a92714d3ee --- /dev/null +++ b/Lang/Ceylon/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Balanced-brackets b/Lang/Ceylon/Balanced-brackets new file mode 120000 index 0000000000..e46a522e4b --- /dev/null +++ b/Lang/Ceylon/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Bulls-and-cows b/Lang/Ceylon/Bulls-and-cows new file mode 120000 index 0000000000..fcfd855101 --- /dev/null +++ b/Lang/Ceylon/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Closures-Value-capture b/Lang/Ceylon/Closures-Value-capture new file mode 120000 index 0000000000..c6571627fa --- /dev/null +++ b/Lang/Ceylon/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Deal-cards-for-FreeCell b/Lang/Ceylon/Deal-cards-for-FreeCell new file mode 120000 index 0000000000..3f1001099e --- /dev/null +++ b/Lang/Ceylon/Deal-cards-for-FreeCell @@ -0,0 +1 @@ +../../Task/Deal-cards-for-FreeCell/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Detect-division-by-zero b/Lang/Ceylon/Detect-division-by-zero new file mode 120000 index 0000000000..33fa9b9c41 --- /dev/null +++ b/Lang/Ceylon/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Evolutionary-algorithm b/Lang/Ceylon/Evolutionary-algorithm new file mode 120000 index 0000000000..080447f805 --- /dev/null +++ b/Lang/Ceylon/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Execute-HQ9+ b/Lang/Ceylon/Execute-HQ9+ new file mode 120000 index 0000000000..7179937ee0 --- /dev/null +++ b/Lang/Ceylon/Execute-HQ9+ @@ -0,0 +1 @@ +../../Task/Execute-HQ9+/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Factorial b/Lang/Ceylon/Factorial new file mode 120000 index 0000000000..94713e7c6e --- /dev/null +++ b/Lang/Ceylon/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Factors-of-an-integer b/Lang/Ceylon/Factors-of-an-integer new file mode 120000 index 0000000000..2c2bf5b1d9 --- /dev/null +++ b/Lang/Ceylon/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/First-class-functions b/Lang/Ceylon/First-class-functions new file mode 120000 index 0000000000..2d8d374402 --- /dev/null +++ b/Lang/Ceylon/First-class-functions @@ -0,0 +1 @@ +../../Task/First-class-functions/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Five-weekends b/Lang/Ceylon/Five-weekends new file mode 120000 index 0000000000..c48988f1a2 --- /dev/null +++ b/Lang/Ceylon/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/FizzBuzz b/Lang/Ceylon/FizzBuzz new file mode 120000 index 0000000000..e800d01910 --- /dev/null +++ b/Lang/Ceylon/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Flatten-a-list b/Lang/Ceylon/Flatten-a-list new file mode 120000 index 0000000000..8fc538482f --- /dev/null +++ b/Lang/Ceylon/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Forest-fire b/Lang/Ceylon/Forest-fire new file mode 120000 index 0000000000..a1f62de34d --- /dev/null +++ b/Lang/Ceylon/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Guess-the-number-With-feedback b/Lang/Ceylon/Guess-the-number-With-feedback new file mode 120000 index 0000000000..34b01ef414 --- /dev/null +++ b/Lang/Ceylon/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Guess-the-number-With-feedback--player- b/Lang/Ceylon/Guess-the-number-With-feedback--player- new file mode 120000 index 0000000000..de2265c795 --- /dev/null +++ b/Lang/Ceylon/Guess-the-number-With-feedback--player- @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback--player-/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Hailstone-sequence b/Lang/Ceylon/Hailstone-sequence new file mode 120000 index 0000000000..9a6eba23d9 --- /dev/null +++ b/Lang/Ceylon/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Hash-from-two-arrays b/Lang/Ceylon/Hash-from-two-arrays new file mode 120000 index 0000000000..7610432069 --- /dev/null +++ b/Lang/Ceylon/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Increment-a-numerical-string b/Lang/Ceylon/Increment-a-numerical-string new file mode 120000 index 0000000000..7e69226791 --- /dev/null +++ b/Lang/Ceylon/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Iterated-digits-squaring b/Lang/Ceylon/Iterated-digits-squaring new file mode 120000 index 0000000000..8e779515ab --- /dev/null +++ b/Lang/Ceylon/Iterated-digits-squaring @@ -0,0 +1 @@ +../../Task/Iterated-digits-squaring/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Knapsack-problem-0-1 b/Lang/Ceylon/Knapsack-problem-0-1 new file mode 120000 index 0000000000..d38ba63399 --- /dev/null +++ b/Lang/Ceylon/Knapsack-problem-0-1 @@ -0,0 +1 @@ +../../Task/Knapsack-problem-0-1/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Largest-int-from-concatenated-ints b/Lang/Ceylon/Largest-int-from-concatenated-ints new file mode 120000 index 0000000000..f53b9b5bb1 --- /dev/null +++ b/Lang/Ceylon/Largest-int-from-concatenated-ints @@ -0,0 +1 @@ +../../Task/Largest-int-from-concatenated-ints/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Loops-Downward-for b/Lang/Ceylon/Loops-Downward-for new file mode 120000 index 0000000000..e7ea513838 --- /dev/null +++ b/Lang/Ceylon/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Loops-For b/Lang/Ceylon/Loops-For new file mode 120000 index 0000000000..be0e7d9224 --- /dev/null +++ b/Lang/Ceylon/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Loops-For-with-a-specified-step b/Lang/Ceylon/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..98accc538d --- /dev/null +++ b/Lang/Ceylon/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Luhn-test-of-credit-card-numbers b/Lang/Ceylon/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..7a595e8952 --- /dev/null +++ b/Lang/Ceylon/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Menu b/Lang/Ceylon/Menu new file mode 120000 index 0000000000..cb678ee406 --- /dev/null +++ b/Lang/Ceylon/Menu @@ -0,0 +1 @@ +../../Task/Menu/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Mutual-recursion b/Lang/Ceylon/Mutual-recursion new file mode 120000 index 0000000000..210d68ff4a --- /dev/null +++ b/Lang/Ceylon/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/One-dimensional-cellular-automata b/Lang/Ceylon/One-dimensional-cellular-automata new file mode 120000 index 0000000000..22f96e1bd5 --- /dev/null +++ b/Lang/Ceylon/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Pangram-checker b/Lang/Ceylon/Pangram-checker new file mode 120000 index 0000000000..51d88a71d8 --- /dev/null +++ b/Lang/Ceylon/Pangram-checker @@ -0,0 +1 @@ +../../Task/Pangram-checker/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Parametric-polymorphism b/Lang/Ceylon/Parametric-polymorphism new file mode 120000 index 0000000000..e06f3fa0ed --- /dev/null +++ b/Lang/Ceylon/Parametric-polymorphism @@ -0,0 +1 @@ +../../Task/Parametric-polymorphism/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Parsing-RPN-calculator-algorithm b/Lang/Ceylon/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..03022f3479 --- /dev/null +++ b/Lang/Ceylon/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Parsing-Shunting-yard-algorithm b/Lang/Ceylon/Parsing-Shunting-yard-algorithm new file mode 120000 index 0000000000..9843708f65 --- /dev/null +++ b/Lang/Ceylon/Parsing-Shunting-yard-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-Shunting-yard-algorithm/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Partial-function-application b/Lang/Ceylon/Partial-function-application new file mode 120000 index 0000000000..99aa3dc5d6 --- /dev/null +++ b/Lang/Ceylon/Partial-function-application @@ -0,0 +1 @@ +../../Task/Partial-function-application/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Pick-random-element b/Lang/Ceylon/Pick-random-element new file mode 120000 index 0000000000..be8cf0c0b7 --- /dev/null +++ b/Lang/Ceylon/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Playing-cards b/Lang/Ceylon/Playing-cards new file mode 120000 index 0000000000..e86a2892ea --- /dev/null +++ b/Lang/Ceylon/Playing-cards @@ -0,0 +1 @@ +../../Task/Playing-cards/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Quine b/Lang/Ceylon/Quine new file mode 120000 index 0000000000..1c0d0be931 --- /dev/null +++ b/Lang/Ceylon/Quine @@ -0,0 +1 @@ +../../Task/Quine/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/README b/Lang/Ceylon/README new file mode 100644 index 0000000000..dc62de4082 --- /dev/null +++ b/Lang/Ceylon/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Ceylon diff --git a/Lang/Ceylon/Range-extraction b/Lang/Ceylon/Range-extraction new file mode 120000 index 0000000000..d4e3606470 --- /dev/null +++ b/Lang/Ceylon/Range-extraction @@ -0,0 +1 @@ +../../Task/Range-extraction/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Remove-duplicate-elements b/Lang/Ceylon/Remove-duplicate-elements new file mode 120000 index 0000000000..cd2c1c4b07 --- /dev/null +++ b/Lang/Ceylon/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Repeat-a-string b/Lang/Ceylon/Repeat-a-string new file mode 120000 index 0000000000..d64d74fb25 --- /dev/null +++ b/Lang/Ceylon/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Roman-numerals-Decode b/Lang/Ceylon/Roman-numerals-Decode new file mode 120000 index 0000000000..96b7a12fb5 --- /dev/null +++ b/Lang/Ceylon/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Roman-numerals-Encode b/Lang/Ceylon/Roman-numerals-Encode new file mode 120000 index 0000000000..721b872ac9 --- /dev/null +++ b/Lang/Ceylon/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/S-Expressions b/Lang/Ceylon/S-Expressions new file mode 120000 index 0000000000..e5d284578b --- /dev/null +++ b/Lang/Ceylon/S-Expressions @@ -0,0 +1 @@ +../../Task/S-Expressions/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Search-a-list b/Lang/Ceylon/Search-a-list new file mode 120000 index 0000000000..c6a7a83fac --- /dev/null +++ b/Lang/Ceylon/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Sort-using-a-custom-comparator b/Lang/Ceylon/Sort-using-a-custom-comparator new file mode 120000 index 0000000000..f00eb12127 --- /dev/null +++ b/Lang/Ceylon/Sort-using-a-custom-comparator @@ -0,0 +1 @@ +../../Task/Sort-using-a-custom-comparator/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Stem-and-leaf-plot b/Lang/Ceylon/Stem-and-leaf-plot new file mode 120000 index 0000000000..4b93000cad --- /dev/null +++ b/Lang/Ceylon/Stem-and-leaf-plot @@ -0,0 +1 @@ +../../Task/Stem-and-leaf-plot/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Temperature-conversion b/Lang/Ceylon/Temperature-conversion new file mode 120000 index 0000000000..1362a642ee --- /dev/null +++ b/Lang/Ceylon/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Tokenize-a-string b/Lang/Ceylon/Tokenize-a-string new file mode 120000 index 0000000000..e20f2604dd --- /dev/null +++ b/Lang/Ceylon/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Tree-traversal b/Lang/Ceylon/Tree-traversal new file mode 120000 index 0000000000..7a7abc867c --- /dev/null +++ b/Lang/Ceylon/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/User-input-Text b/Lang/Ceylon/User-input-Text new file mode 120000 index 0000000000..fa9b55daee --- /dev/null +++ b/Lang/Ceylon/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/Ceylon \ No newline at end of file diff --git a/Lang/Ceylon/Y-combinator b/Lang/Ceylon/Y-combinator new file mode 120000 index 0000000000..776152f199 --- /dev/null +++ b/Lang/Ceylon/Y-combinator @@ -0,0 +1 @@ +../../Task/Y-combinator/Ceylon \ No newline at end of file diff --git a/Lang/ChucK/00DESCRIPTION b/Lang/ChucK/00DESCRIPTION new file mode 100644 index 0000000000..7942dba74b --- /dev/null +++ b/Lang/ChucK/00DESCRIPTION @@ -0,0 +1,7 @@ +{{stub}}{{language|ChucK +|strength=strong +|site=http://chuck.cs.princeton.edu/ +}} + + +'''ChucK''' is a concurrent, strongly timed audio programming language for real-time synthesis, composition, and performance, which runs on Mac OS X, Linux, Microsoft Windows, and iOS. It is designed to favor readability and flexibility for the programmer over other considerations such as raw performance. It natively supports deterministic concurrency and multiple, simultaneous, dynamic control rates. Another key feature is the ability to live code; adding, removing, and modifying code on the fly, while the program is running, without stopping or restarting. It has a highly precise timing/concurrency model, allowing for arbitrarily fine granularity. It offers composers and researchers a powerful and flexible programming tool for building and experimenting with complex audio synthesis programs, and real-time interactive control. \ No newline at end of file diff --git a/Lang/ChucK/Arrays b/Lang/ChucK/Arrays new file mode 120000 index 0000000000..fa1d646638 --- /dev/null +++ b/Lang/ChucK/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/ChucK \ No newline at end of file diff --git a/Lang/ChucK/Call-an-object-method b/Lang/ChucK/Call-an-object-method new file mode 120000 index 0000000000..a4bc284424 --- /dev/null +++ b/Lang/ChucK/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/ChucK \ No newline at end of file diff --git a/Lang/ChucK/Comments b/Lang/ChucK/Comments new file mode 120000 index 0000000000..b016cef838 --- /dev/null +++ b/Lang/ChucK/Comments @@ -0,0 +1 @@ +../../Task/Comments/ChucK \ No newline at end of file diff --git a/Lang/ChucK/Create-a-file b/Lang/ChucK/Create-a-file new file mode 120000 index 0000000000..ab7e88ab81 --- /dev/null +++ b/Lang/ChucK/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/ChucK \ No newline at end of file diff --git a/Lang/ChucK/Factorial b/Lang/ChucK/Factorial new file mode 120000 index 0000000000..d342055818 --- /dev/null +++ b/Lang/ChucK/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/ChucK \ No newline at end of file diff --git a/Lang/ChucK/Function-definition b/Lang/ChucK/Function-definition new file mode 120000 index 0000000000..460f63c1da --- /dev/null +++ b/Lang/ChucK/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/ChucK \ No newline at end of file diff --git a/Lang/ChucK/Hello-world-Text b/Lang/ChucK/Hello-world-Text new file mode 120000 index 0000000000..dbfe9897af --- /dev/null +++ b/Lang/ChucK/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/ChucK \ No newline at end of file diff --git a/Lang/ChucK/Include-a-file b/Lang/ChucK/Include-a-file new file mode 120000 index 0000000000..af38a95906 --- /dev/null +++ b/Lang/ChucK/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/ChucK \ No newline at end of file diff --git a/Lang/ChucK/Inheritance-Single b/Lang/ChucK/Inheritance-Single new file mode 120000 index 0000000000..0b4c4669c9 --- /dev/null +++ b/Lang/ChucK/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/ChucK \ No newline at end of file diff --git a/Lang/ChucK/Integer-comparison b/Lang/ChucK/Integer-comparison new file mode 120000 index 0000000000..2a960a1c1e --- /dev/null +++ b/Lang/ChucK/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/ChucK \ No newline at end of file diff --git a/Lang/ChucK/Integer-sequence b/Lang/ChucK/Integer-sequence new file mode 120000 index 0000000000..5942f21d4e --- /dev/null +++ b/Lang/ChucK/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/ChucK \ No newline at end of file diff --git a/Lang/ChucK/Loops-Do-while b/Lang/ChucK/Loops-Do-while new file mode 120000 index 0000000000..8a853c6f08 --- /dev/null +++ b/Lang/ChucK/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/ChucK \ No newline at end of file diff --git a/Lang/ChucK/Loops-For-with-a-specified-step b/Lang/ChucK/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..8e4240d62f --- /dev/null +++ b/Lang/ChucK/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/ChucK \ No newline at end of file diff --git a/Lang/ChucK/Loops-Infinite b/Lang/ChucK/Loops-Infinite new file mode 120000 index 0000000000..ff60acf7c1 --- /dev/null +++ b/Lang/ChucK/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/ChucK \ No newline at end of file diff --git a/Lang/ChucK/Loops-While b/Lang/ChucK/Loops-While new file mode 120000 index 0000000000..e751fa55ab --- /dev/null +++ b/Lang/ChucK/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/ChucK \ No newline at end of file diff --git a/Lang/ChucK/README b/Lang/ChucK/README new file mode 100644 index 0000000000..c97ae3411d --- /dev/null +++ b/Lang/ChucK/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:ChucK diff --git a/Lang/ChucK/Record-sound b/Lang/ChucK/Record-sound new file mode 120000 index 0000000000..e10bf9aab5 --- /dev/null +++ b/Lang/ChucK/Record-sound @@ -0,0 +1 @@ +../../Task/Record-sound/ChucK \ No newline at end of file diff --git a/Lang/ChucK/String-concatenation b/Lang/ChucK/String-concatenation new file mode 120000 index 0000000000..d150571424 --- /dev/null +++ b/Lang/ChucK/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/ChucK \ No newline at end of file diff --git a/Lang/ChucK/Variables b/Lang/ChucK/Variables new file mode 120000 index 0000000000..241cd01c73 --- /dev/null +++ b/Lang/ChucK/Variables @@ -0,0 +1 @@ +../../Task/Variables/ChucK \ No newline at end of file diff --git a/Lang/Clarion/00DESCRIPTION b/Lang/Clarion/00DESCRIPTION new file mode 100644 index 0000000000..a8534ec3ba --- /dev/null +++ b/Lang/Clarion/00DESCRIPTION @@ -0,0 +1,3 @@ +{{language}} +Clarion is a programming language with a focus on simplicity and productivity. It has an english-like syntax that is natural to read, and easy to write. +Its focus is on creating database applications through the use of interchangeable database drivers that allow the same syntax to be used for CRUD operations on flat-files, ISAM files, and SQL databases, without the need to know any SQL syntax. \ No newline at end of file diff --git a/Lang/Clarion/100-doors b/Lang/Clarion/100-doors new file mode 120000 index 0000000000..53f355e078 --- /dev/null +++ b/Lang/Clarion/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Clarion \ No newline at end of file diff --git a/Lang/Clarion/README b/Lang/Clarion/README new file mode 100644 index 0000000000..a5d05b32fb --- /dev/null +++ b/Lang/Clarion/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Clarion diff --git a/Lang/Coco/00DESCRIPTION b/Lang/Coco/00DESCRIPTION new file mode 100644 index 0000000000..ff28b785c2 --- /dev/null +++ b/Lang/Coco/00DESCRIPTION @@ -0,0 +1,10 @@ +{{language}} + +'''Coco''' is a variant of [[CoffeeScript]], and thus an alternative syntax for [[JavaScript]]. Like [[MoonScript]], it generally errs on the side of including more features, as opposed to the partly minimalist philosophy of CoffeeScript. + +It is described on [https://github.com/satyr/coco GitHub] (where all the documentation currently resides) as being designed according to the following principles: + +* Respect JS semantics and idioms. +* Die for DRY. +* [[Perl]] over [[Ruby]]. +* Fewer keywords, punctuations and runtime errors. \ No newline at end of file diff --git a/Lang/Coco/100-doors b/Lang/Coco/100-doors new file mode 120000 index 0000000000..461865df93 --- /dev/null +++ b/Lang/Coco/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Coco \ No newline at end of file diff --git a/Lang/Coco/Bulls-and-cows b/Lang/Coco/Bulls-and-cows new file mode 120000 index 0000000000..d587946f5e --- /dev/null +++ b/Lang/Coco/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Coco \ No newline at end of file diff --git a/Lang/Coco/Classes b/Lang/Coco/Classes new file mode 120000 index 0000000000..eb91578b2d --- /dev/null +++ b/Lang/Coco/Classes @@ -0,0 +1 @@ +../../Task/Classes/Coco \ No newline at end of file diff --git a/Lang/Coco/Count-the-coins b/Lang/Coco/Count-the-coins new file mode 120000 index 0000000000..3a1776ad90 --- /dev/null +++ b/Lang/Coco/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/Coco \ No newline at end of file diff --git a/Lang/Coco/FizzBuzz b/Lang/Coco/FizzBuzz new file mode 120000 index 0000000000..536fcf2d64 --- /dev/null +++ b/Lang/Coco/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Coco \ No newline at end of file diff --git a/Lang/Coco/Function-definition b/Lang/Coco/Function-definition new file mode 120000 index 0000000000..01500b2065 --- /dev/null +++ b/Lang/Coco/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Coco \ No newline at end of file diff --git a/Lang/Coco/Hash-from-two-arrays b/Lang/Coco/Hash-from-two-arrays new file mode 120000 index 0000000000..1f37494401 --- /dev/null +++ b/Lang/Coco/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/Coco \ No newline at end of file diff --git a/Lang/Coco/I-before-E-except-after-C b/Lang/Coco/I-before-E-except-after-C new file mode 120000 index 0000000000..2ab9dfe868 --- /dev/null +++ b/Lang/Coco/I-before-E-except-after-C @@ -0,0 +1 @@ +../../Task/I-before-E-except-after-C/Coco \ No newline at end of file diff --git a/Lang/Coco/Inheritance-Single b/Lang/Coco/Inheritance-Single new file mode 120000 index 0000000000..d68bccd206 --- /dev/null +++ b/Lang/Coco/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/Coco \ No newline at end of file diff --git a/Lang/Coco/Loops-Do-while b/Lang/Coco/Loops-Do-while new file mode 120000 index 0000000000..1677e240ad --- /dev/null +++ b/Lang/Coco/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Coco \ No newline at end of file diff --git a/Lang/Coco/README b/Lang/Coco/README new file mode 100644 index 0000000000..949bdde4d6 --- /dev/null +++ b/Lang/Coco/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Coco diff --git a/Lang/Coco/String-interpolation--included- b/Lang/Coco/String-interpolation--included- new file mode 120000 index 0000000000..1fcfc6961c --- /dev/null +++ b/Lang/Coco/String-interpolation--included- @@ -0,0 +1 @@ +../../Task/String-interpolation--included-/Coco \ No newline at end of file diff --git a/Lang/Comal/00DESCRIPTION b/Lang/Comal/00DESCRIPTION new file mode 100644 index 0000000000..df1d9125d0 --- /dev/null +++ b/Lang/Comal/00DESCRIPTION @@ -0,0 +1,8 @@ +{{language|Comal +|exec=both +|LCT=no}} +{{language programming paradigm|Procedural}} +{{language programming paradigm|Object-oriented}} +[[wp:COMAL|COMAL]] (Common Algorithmic Language) is a structured language derived from [[Basic]] with inspiration from [[Pascal]] by Benedict Løfstedt and Børge R. Christensen in Denmark in 1973. Its aim was to replace Basic as an educational language, keeping its basic syntax while introducing support for proper structured programming. Its first implementations were built upon extended Basic interpreters, with a formalised specification realised in COMAL 80. + +Later implementations have added turtle graphics and object orientation, but these additions have never been standardised. Comal implementations are available for most popular home computers and operating systems. \ No newline at end of file diff --git a/Lang/Comal/Conditional-structures b/Lang/Comal/Conditional-structures new file mode 120000 index 0000000000..af603a7104 --- /dev/null +++ b/Lang/Comal/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Comal \ No newline at end of file diff --git a/Lang/Comal/Factorial b/Lang/Comal/Factorial new file mode 120000 index 0000000000..c80b6c5e68 --- /dev/null +++ b/Lang/Comal/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Comal \ No newline at end of file diff --git a/Lang/Comal/Flow-control-structures b/Lang/Comal/Flow-control-structures new file mode 120000 index 0000000000..dfb6f0daaf --- /dev/null +++ b/Lang/Comal/Flow-control-structures @@ -0,0 +1 @@ +../../Task/Flow-control-structures/Comal \ No newline at end of file diff --git a/Lang/Comal/Hello-world-Text b/Lang/Comal/Hello-world-Text new file mode 120000 index 0000000000..5719757b9e --- /dev/null +++ b/Lang/Comal/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Comal \ No newline at end of file diff --git a/Lang/Comal/Inheritance-Single b/Lang/Comal/Inheritance-Single new file mode 120000 index 0000000000..589a28b655 --- /dev/null +++ b/Lang/Comal/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/Comal \ No newline at end of file diff --git a/Lang/Comal/Literals-Integer b/Lang/Comal/Literals-Integer new file mode 120000 index 0000000000..ad8689cf62 --- /dev/null +++ b/Lang/Comal/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/Comal \ No newline at end of file diff --git a/Lang/Comal/Loops-Infinite b/Lang/Comal/Loops-Infinite new file mode 120000 index 0000000000..8ce817d96b --- /dev/null +++ b/Lang/Comal/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Comal \ No newline at end of file diff --git a/Lang/Comal/README b/Lang/Comal/README new file mode 100644 index 0000000000..7f5a18849a --- /dev/null +++ b/Lang/Comal/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Comal diff --git a/Lang/Comal/Terminal-control-Clear-the-screen b/Lang/Comal/Terminal-control-Clear-the-screen new file mode 120000 index 0000000000..1886a1b956 --- /dev/null +++ b/Lang/Comal/Terminal-control-Clear-the-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Clear-the-screen/Comal \ No newline at end of file diff --git a/Lang/Commodore-BASIC/00DESCRIPTION b/Lang/Commodore-BASIC/00DESCRIPTION new file mode 100644 index 0000000000..e6e7a3d3a2 --- /dev/null +++ b/Lang/Commodore-BASIC/00DESCRIPTION @@ -0,0 +1,10 @@ +{{language|Commodore BASIC}}{{Implementation|BASIC}} +'''Commodore BASIC''' is the collective name for the various versions of [[:Category:BASIC|BASIC]] developed by [[Microsoft]] for [[Commodore]] 8-bit computers, starting with the [[wp:Commodore PET|PET]] in 1977. There were several versions; see [[wp:Commodore BASIC|Wikipedia's Commodore BASIC page]] for details. + +Commodore BASIC is notable for its lack of integer arithmetic; all operations were carried out in floating-point, which made the interpreter slower than some of its peers. + +Programs were tokenized into [[wp:bytecode|bytecode]], although many characters were left intact to facilitate printing the source code back out in original form; it's one of the few BASICs of the time that preserved whitespace (though not leading whitespace). Unlike some contemporary BASICs, it supported arrays of strings, and arrays could have thousands of elements as long as there was sufficient memory for them (but strings were limited to 255 bytes). + +The most well-known version is 2.0, which came with the [[wp:Commodore VIC-20|VIC-20]] and [[wp:Commodore 64|Commodore 64]]. Despite the impressive sound and graphics capabilities of the machines, the language had no support for them; machine code was required to take advantage of those features. Later BASIC versions added support, but the later machines that came with those versions never came close to the popularity of the 64. + +In addition to the sound and graphic statements, the later versions also introduced structured programming constructs: DO...LOOP, which supported both pre- and post-evaluated conditions (DO WHILE/UNTIL ... LOOP and DO ... LOOP WHILE/UNTIL) as well as unconditional loop exit (EXIT) and BEGIN...BEND code blocks, which allowed multi-line conditional clauses. However, other limitations remained: variables were still all global and limited to 2-letter names, user-defined functions were restricted to a single expression with a single argument, etc. \ No newline at end of file diff --git a/Lang/Commodore-BASIC/100-doors b/Lang/Commodore-BASIC/100-doors new file mode 120000 index 0000000000..1fb48134fc --- /dev/null +++ b/Lang/Commodore-BASIC/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Commodore-BASIC \ No newline at end of file diff --git a/Lang/Commodore-BASIC/Prime-decomposition b/Lang/Commodore-BASIC/Prime-decomposition new file mode 120000 index 0000000000..107e7823d3 --- /dev/null +++ b/Lang/Commodore-BASIC/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/Commodore-BASIC \ No newline at end of file diff --git a/Lang/Commodore-BASIC/Quine b/Lang/Commodore-BASIC/Quine new file mode 120000 index 0000000000..6094bb0fda --- /dev/null +++ b/Lang/Commodore-BASIC/Quine @@ -0,0 +1 @@ +../../Task/Quine/Commodore-BASIC \ No newline at end of file diff --git a/Lang/Commodore-BASIC/README b/Lang/Commodore-BASIC/README new file mode 100644 index 0000000000..cc8872e6a7 --- /dev/null +++ b/Lang/Commodore-BASIC/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Commodore_BASIC diff --git a/Lang/Commodore-BASIC/Sorting-algorithms-Insertion-sort b/Lang/Commodore-BASIC/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..8ea4f9023d --- /dev/null +++ b/Lang/Commodore-BASIC/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/Commodore-BASIC \ No newline at end of file diff --git a/Lang/Commodore-BASIC/Yin-and-yang b/Lang/Commodore-BASIC/Yin-and-yang new file mode 120000 index 0000000000..1c17a578c6 --- /dev/null +++ b/Lang/Commodore-BASIC/Yin-and-yang @@ -0,0 +1 @@ +../../Task/Yin-and-yang/Commodore-BASIC \ No newline at end of file diff --git a/Lang/Computer-zero-Assembly/00DESCRIPTION b/Lang/Computer-zero-Assembly/00DESCRIPTION new file mode 100644 index 0000000000..2e1235d023 --- /dev/null +++ b/Lang/Computer-zero-Assembly/00DESCRIPTION @@ -0,0 +1,2 @@ +{{stub}}{{language|Computer/zero Assembly}} +Computer/zero is a simple instruction set architecture designed to accompany [http://edmundgriffiths.com/degreezero.html Programming degree zero], a short tutorial on computers and machine-level programming for the absolute beginner. It is deliberately minimal, offering only eight instructions, one general-purpose register, and 32 bytes of memory. As a result, it is not only easy to learn but also very easy to implement: the core interpreter for Computer/zero machine code comes to about 15 lines in a high-level language, making it quite feasible for beginners to implement and extend it for themselves. A partly graphical browser-based implementation (written in JavaScript) is available [http://edmundgriffiths.com/czero.html here]. \ No newline at end of file diff --git a/Lang/Computer-zero-Assembly/A+B b/Lang/Computer-zero-Assembly/A+B new file mode 120000 index 0000000000..171147e6d9 --- /dev/null +++ b/Lang/Computer-zero-Assembly/A+B @@ -0,0 +1 @@ +../../Task/A+B/Computer-zero-Assembly \ No newline at end of file diff --git a/Lang/Computer-zero-Assembly/Arrays b/Lang/Computer-zero-Assembly/Arrays new file mode 120000 index 0000000000..8714dd3465 --- /dev/null +++ b/Lang/Computer-zero-Assembly/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Computer-zero-Assembly \ No newline at end of file diff --git a/Lang/Computer-zero-Assembly/Copy-a-string b/Lang/Computer-zero-Assembly/Copy-a-string new file mode 120000 index 0000000000..b4e3822b17 --- /dev/null +++ b/Lang/Computer-zero-Assembly/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Computer-zero-Assembly \ No newline at end of file diff --git a/Lang/Computer-zero-Assembly/Empty-program b/Lang/Computer-zero-Assembly/Empty-program new file mode 120000 index 0000000000..cffffad5b1 --- /dev/null +++ b/Lang/Computer-zero-Assembly/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/Computer-zero-Assembly \ No newline at end of file diff --git a/Lang/Computer-zero-Assembly/Factorial b/Lang/Computer-zero-Assembly/Factorial new file mode 120000 index 0000000000..c92ff3a6cd --- /dev/null +++ b/Lang/Computer-zero-Assembly/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Computer-zero-Assembly \ No newline at end of file diff --git a/Lang/Computer-zero-Assembly/Fibonacci-sequence b/Lang/Computer-zero-Assembly/Fibonacci-sequence new file mode 120000 index 0000000000..d9f9fda827 --- /dev/null +++ b/Lang/Computer-zero-Assembly/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Computer-zero-Assembly \ No newline at end of file diff --git a/Lang/Computer-zero-Assembly/Integer-comparison b/Lang/Computer-zero-Assembly/Integer-comparison new file mode 120000 index 0000000000..4aa2098137 --- /dev/null +++ b/Lang/Computer-zero-Assembly/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Computer-zero-Assembly \ No newline at end of file diff --git a/Lang/Computer-zero-Assembly/Integer-overflow b/Lang/Computer-zero-Assembly/Integer-overflow new file mode 120000 index 0000000000..bd59b2389c --- /dev/null +++ b/Lang/Computer-zero-Assembly/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/Computer-zero-Assembly \ No newline at end of file diff --git a/Lang/Computer-zero-Assembly/Integer-sequence b/Lang/Computer-zero-Assembly/Integer-sequence new file mode 120000 index 0000000000..4d1a4a336b --- /dev/null +++ b/Lang/Computer-zero-Assembly/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Computer-zero-Assembly \ No newline at end of file diff --git a/Lang/Computer-zero-Assembly/Jump-anywhere b/Lang/Computer-zero-Assembly/Jump-anywhere new file mode 120000 index 0000000000..c86c0c8e05 --- /dev/null +++ b/Lang/Computer-zero-Assembly/Jump-anywhere @@ -0,0 +1 @@ +../../Task/Jump-anywhere/Computer-zero-Assembly \ No newline at end of file diff --git a/Lang/Computer-zero-Assembly/README b/Lang/Computer-zero-Assembly/README new file mode 100644 index 0000000000..9c27a68d4e --- /dev/null +++ b/Lang/Computer-zero-Assembly/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Computer/zero_Assembly diff --git a/Lang/Computer-zero-Assembly/Singly-linked-list-Traversal b/Lang/Computer-zero-Assembly/Singly-linked-list-Traversal new file mode 120000 index 0000000000..09804558ad --- /dev/null +++ b/Lang/Computer-zero-Assembly/Singly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Traversal/Computer-zero-Assembly \ No newline at end of file diff --git a/Lang/Crystal/00DESCRIPTION b/Lang/Crystal/00DESCRIPTION new file mode 100644 index 0000000000..b671a267bf --- /dev/null +++ b/Lang/Crystal/00DESCRIPTION @@ -0,0 +1,17 @@ +{{language +|exec=machine +|gc=yes +|parampass=both +|express=both +|strength=strong +|checking=static +|compat=duck +|site=http://crystal-lang.org}} +Crystal is a programming language with the following goals: +* Have the same syntax as Ruby, or at least as similar as possible. +* Never have to specify the type of a variable or method argument. +* Be able to call C code by writing bindings to it in Crystal. +* Have compile-time evaluation and generation of code, to avoid boilerplate code. +* Compile to efficient native code. + +You can ask for help on Freenode in the #crystal-lang channel. \ No newline at end of file diff --git a/Lang/Crystal/100-doors b/Lang/Crystal/100-doors new file mode 120000 index 0000000000..b78b01ba01 --- /dev/null +++ b/Lang/Crystal/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Crystal \ No newline at end of file diff --git a/Lang/Crystal/A+B b/Lang/Crystal/A+B new file mode 120000 index 0000000000..a6ba64b157 --- /dev/null +++ b/Lang/Crystal/A+B @@ -0,0 +1 @@ +../../Task/A+B/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Amicable-pairs b/Lang/Crystal/Amicable-pairs new file mode 120000 index 0000000000..cad71c55ee --- /dev/null +++ b/Lang/Crystal/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Bernoulli-numbers b/Lang/Crystal/Bernoulli-numbers new file mode 120000 index 0000000000..5acce6cd7c --- /dev/null +++ b/Lang/Crystal/Bernoulli-numbers @@ -0,0 +1 @@ +../../Task/Bernoulli-numbers/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Even-or-odd b/Lang/Crystal/Even-or-odd new file mode 120000 index 0000000000..5c1f44be38 --- /dev/null +++ b/Lang/Crystal/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Fast-Fourier-transform b/Lang/Crystal/Fast-Fourier-transform new file mode 120000 index 0000000000..ff2a5cb51b --- /dev/null +++ b/Lang/Crystal/Fast-Fourier-transform @@ -0,0 +1 @@ +../../Task/Fast-Fourier-transform/Crystal \ No newline at end of file diff --git a/Lang/Crystal/FizzBuzz b/Lang/Crystal/FizzBuzz new file mode 120000 index 0000000000..01d5f07a5c --- /dev/null +++ b/Lang/Crystal/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Hello-world-Text b/Lang/Crystal/Hello-world-Text new file mode 120000 index 0000000000..61d1af0858 --- /dev/null +++ b/Lang/Crystal/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Man-or-boy-test b/Lang/Crystal/Man-or-boy-test new file mode 120000 index 0000000000..cf3cd901ea --- /dev/null +++ b/Lang/Crystal/Man-or-boy-test @@ -0,0 +1 @@ +../../Task/Man-or-boy-test/Crystal \ No newline at end of file diff --git a/Lang/Crystal/README b/Lang/Crystal/README new file mode 100644 index 0000000000..665e4b5c8d --- /dev/null +++ b/Lang/Crystal/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Crystal diff --git a/Lang/Crystal/Sorting-algorithms-Merge-sort b/Lang/Crystal/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..23732bfddf --- /dev/null +++ b/Lang/Crystal/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sorting-algorithms-Quicksort b/Lang/Crystal/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..5712638a68 --- /dev/null +++ b/Lang/Crystal/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Crystal \ No newline at end of file diff --git a/Lang/DDNC/00DESCRIPTION b/Lang/DDNC/00DESCRIPTION new file mode 100644 index 0000000000..e4f2988779 --- /dev/null +++ b/Lang/DDNC/00DESCRIPTION @@ -0,0 +1,4 @@ +[http://ostracodfiles.com/decimal/guide.pdf] +[http://ostracodfiles.com/decimal/emulator.html] + +{{stub}}{{language}} \ No newline at end of file diff --git a/Lang/DDNC/Hello-world-Text b/Lang/DDNC/Hello-world-Text new file mode 120000 index 0000000000..8c832ee68a --- /dev/null +++ b/Lang/DDNC/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/DDNC \ No newline at end of file diff --git a/Lang/DDNC/README b/Lang/DDNC/README new file mode 100644 index 0000000000..3be5487744 --- /dev/null +++ b/Lang/DDNC/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:DDNC diff --git a/Lang/DIV-Games-Studio/00DESCRIPTION b/Lang/DIV-Games-Studio/00DESCRIPTION new file mode 100644 index 0000000000..98976bcaea --- /dev/null +++ b/Lang/DIV-Games-Studio/00DESCRIPTION @@ -0,0 +1,2 @@ +{{stub}}{{language|DIV Games Studio}} +{{unimpl_Page|DIV Games Studio}} \ No newline at end of file diff --git a/Lang/DIV-Games-Studio/Hello-world-Text b/Lang/DIV-Games-Studio/Hello-world-Text new file mode 120000 index 0000000000..25a3509cf4 --- /dev/null +++ b/Lang/DIV-Games-Studio/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/DIV-Games-Studio \ No newline at end of file diff --git a/Lang/DIV-Games-Studio/README b/Lang/DIV-Games-Studio/README new file mode 100644 index 0000000000..2067b1bd70 --- /dev/null +++ b/Lang/DIV-Games-Studio/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:DIV_Games_Studio diff --git a/Lang/ECL/00DESCRIPTION b/Lang/ECL/00DESCRIPTION new file mode 100644 index 0000000000..ac3c1a3215 --- /dev/null +++ b/Lang/ECL/00DESCRIPTION @@ -0,0 +1,12 @@ +{{language|ECL +|site=http://hpccsystems.com/ +}} + +The Enterprise Control Language (ECL) is an advanced programming language supporting both query and ETL +(Extract, Transform, and Load) operations. ECL is designed and used with HPCC Systems. http://www.lexisnexis.com/risk/newsevents/press-release.aspx?Id=1308140007126875 It is specifically designed for data management and query processing. ECL code is written using the ECL IDE programming development tool. ECL is compiled into optimized C++ which is then compiled into DLLs for execution on the Thor and Roxie platforms. ECL can include inline C++ code encapsulated in functions. External services can be written in any language and compiled into shared libraries of functions callable from ECL. A pipe interface allows execution of external programs written in any language to be incorporated into jobs. ECL's design allows the leverage of created code for re-use in subsequent queries, the language extends itself as it is used. http://hpccsystems.com/download/docs/programmers-guidehttp://hpccsystems.com/download/docs/ecl-language-reference + +==See Also== +* [[wp:ECL_%28data-centric_programming_language%29|Wikipedia:ECL (data-centric programming language)]] + +==References== + \ No newline at end of file diff --git a/Lang/ECL/100-doors b/Lang/ECL/100-doors new file mode 120000 index 0000000000..40cc060549 --- /dev/null +++ b/Lang/ECL/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/ECL \ No newline at end of file diff --git a/Lang/ECL/99-Bottles-of-Beer b/Lang/ECL/99-Bottles-of-Beer new file mode 120000 index 0000000000..77b5a1ff4e --- /dev/null +++ b/Lang/ECL/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/ECL \ No newline at end of file diff --git a/Lang/ECL/Arithmetic-Integer b/Lang/ECL/Arithmetic-Integer new file mode 120000 index 0000000000..fcb78a6cbd --- /dev/null +++ b/Lang/ECL/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/ECL \ No newline at end of file diff --git a/Lang/ECL/Array-concatenation b/Lang/ECL/Array-concatenation new file mode 120000 index 0000000000..4df2cb38ed --- /dev/null +++ b/Lang/ECL/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/ECL \ No newline at end of file diff --git a/Lang/ECL/Assertions b/Lang/ECL/Assertions new file mode 120000 index 0000000000..abf9a26332 --- /dev/null +++ b/Lang/ECL/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/ECL \ No newline at end of file diff --git a/Lang/ECL/Averages-Arithmetic-mean b/Lang/ECL/Averages-Arithmetic-mean new file mode 120000 index 0000000000..d16f65bedc --- /dev/null +++ b/Lang/ECL/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/ECL \ No newline at end of file diff --git a/Lang/ECL/Bitwise-operations b/Lang/ECL/Bitwise-operations new file mode 120000 index 0000000000..4d4b3378df --- /dev/null +++ b/Lang/ECL/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/ECL \ No newline at end of file diff --git a/Lang/ECL/CSV-data-manipulation b/Lang/ECL/CSV-data-manipulation new file mode 120000 index 0000000000..3ec3440689 --- /dev/null +++ b/Lang/ECL/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/ECL \ No newline at end of file diff --git a/Lang/ECL/Comments b/Lang/ECL/Comments new file mode 120000 index 0000000000..013550acaf --- /dev/null +++ b/Lang/ECL/Comments @@ -0,0 +1 @@ +../../Task/Comments/ECL \ No newline at end of file diff --git a/Lang/ECL/Day-of-the-week b/Lang/ECL/Day-of-the-week new file mode 120000 index 0000000000..984a8b0500 --- /dev/null +++ b/Lang/ECL/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/ECL \ No newline at end of file diff --git a/Lang/ECL/Detect-division-by-zero b/Lang/ECL/Detect-division-by-zero new file mode 120000 index 0000000000..8c10ae29f3 --- /dev/null +++ b/Lang/ECL/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/ECL \ No newline at end of file diff --git a/Lang/ECL/Fibonacci-sequence b/Lang/ECL/Fibonacci-sequence new file mode 120000 index 0000000000..b379a82427 --- /dev/null +++ b/Lang/ECL/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/ECL \ No newline at end of file diff --git a/Lang/ECL/FizzBuzz b/Lang/ECL/FizzBuzz new file mode 120000 index 0000000000..d48f77daf0 --- /dev/null +++ b/Lang/ECL/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/ECL \ No newline at end of file diff --git a/Lang/ECL/Greatest-element-of-a-list b/Lang/ECL/Greatest-element-of-a-list new file mode 120000 index 0000000000..1c9fae4165 --- /dev/null +++ b/Lang/ECL/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/ECL \ No newline at end of file diff --git a/Lang/ECL/Hash-join b/Lang/ECL/Hash-join new file mode 120000 index 0000000000..8a4fa4231f --- /dev/null +++ b/Lang/ECL/Hash-join @@ -0,0 +1 @@ +../../Task/Hash-join/ECL \ No newline at end of file diff --git a/Lang/ECL/Hello-world-Text b/Lang/ECL/Hello-world-Text new file mode 120000 index 0000000000..8cca270b81 --- /dev/null +++ b/Lang/ECL/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/ECL \ No newline at end of file diff --git a/Lang/ECL/Higher-order-functions b/Lang/ECL/Higher-order-functions new file mode 120000 index 0000000000..4b4c8825db --- /dev/null +++ b/Lang/ECL/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/ECL \ No newline at end of file diff --git a/Lang/ECL/Integer-comparison b/Lang/ECL/Integer-comparison new file mode 120000 index 0000000000..3be1fd3c55 --- /dev/null +++ b/Lang/ECL/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/ECL \ No newline at end of file diff --git a/Lang/ECL/Logical-operations b/Lang/ECL/Logical-operations new file mode 120000 index 0000000000..c5aa29da8c --- /dev/null +++ b/Lang/ECL/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/ECL \ No newline at end of file diff --git a/Lang/ECL/README b/Lang/ECL/README new file mode 100644 index 0000000000..2f4b3ab643 --- /dev/null +++ b/Lang/ECL/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:ECL diff --git a/Lang/ECL/Remove-duplicate-elements b/Lang/ECL/Remove-duplicate-elements new file mode 120000 index 0000000000..6c62a8c4cf --- /dev/null +++ b/Lang/ECL/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/ECL \ No newline at end of file diff --git a/Lang/ECL/Remove-lines-from-a-file b/Lang/ECL/Remove-lines-from-a-file new file mode 120000 index 0000000000..2d2b718599 --- /dev/null +++ b/Lang/ECL/Remove-lines-from-a-file @@ -0,0 +1 @@ +../../Task/Remove-lines-from-a-file/ECL \ No newline at end of file diff --git a/Lang/ECL/Repeat-a-string b/Lang/ECL/Repeat-a-string new file mode 120000 index 0000000000..5467349743 --- /dev/null +++ b/Lang/ECL/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/ECL \ No newline at end of file diff --git a/Lang/ECL/Return-multiple-values b/Lang/ECL/Return-multiple-values new file mode 120000 index 0000000000..da8bd8836e --- /dev/null +++ b/Lang/ECL/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/ECL \ No newline at end of file diff --git a/Lang/ECL/Roman-numerals-Decode b/Lang/ECL/Roman-numerals-Decode new file mode 120000 index 0000000000..9d36d91c5a --- /dev/null +++ b/Lang/ECL/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/ECL \ No newline at end of file diff --git a/Lang/ECL/Roman-numerals-Encode b/Lang/ECL/Roman-numerals-Encode new file mode 120000 index 0000000000..f9d985c589 --- /dev/null +++ b/Lang/ECL/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/ECL \ No newline at end of file diff --git a/Lang/ECL/String-case b/Lang/ECL/String-case new file mode 120000 index 0000000000..912481b562 --- /dev/null +++ b/Lang/ECL/String-case @@ -0,0 +1 @@ +../../Task/String-case/ECL \ No newline at end of file diff --git a/Lang/ECL/String-interpolation--included- b/Lang/ECL/String-interpolation--included- new file mode 120000 index 0000000000..5917a6e9cb --- /dev/null +++ b/Lang/ECL/String-interpolation--included- @@ -0,0 +1 @@ +../../Task/String-interpolation--included-/ECL \ No newline at end of file diff --git a/Lang/ECL/Substring b/Lang/ECL/Substring new file mode 120000 index 0000000000..f1f69743fa --- /dev/null +++ b/Lang/ECL/Substring @@ -0,0 +1 @@ +../../Task/Substring/ECL \ No newline at end of file diff --git a/Lang/EDSAC-order-code/00DESCRIPTION b/Lang/EDSAC-order-code/00DESCRIPTION new file mode 100644 index 0000000000..caa85bba93 --- /dev/null +++ b/Lang/EDSAC-order-code/00DESCRIPTION @@ -0,0 +1,6 @@ +{{stub}}{{language|EDSAC order code}} +The Electronic Delay Storage Automatic Calculator (EDSAC), which went into operation at Cambridge in 1949, was one of the first stored-program computers. It was also the machine on which the first programming book—The Preparation of Programs for an Electronic Digital Computer (1951), by Wilkes, Wheeler, and Gill—was based. + +The EDSAC featured a memory of 512 17-bit words, later upgraded to 1,024, and a rather sophisticated loader (Initial Orders) in read-only memory. The machine's 'order code' (instruction set) was designed to be partly mnemonic, subject to the restriction that each 'order' was encoded using a single character: so A stood for 'add', S for 'subtract', etc. The Initial Orders also provided for relocatable code, with the character θ denoting 'offset from base address'. + +The original EDSAC was retired in 1958, but simulators exist allowing EDSAC programs to be run under Windows, GNU Linux, or OS X, and also in the browser. These simulations additionally permit the use of comments, newlines, and whitespace, to make the orders more readable; and they employ ASCII characters in place of the handful of Greek letters used in EDSAC code (@ instead of θ, for instance). Work is underway at the National Museum of Computing in Bletchley Park to construct a full working replica of the EDSAC. \ No newline at end of file diff --git a/Lang/EDSAC-order-code/A+B b/Lang/EDSAC-order-code/A+B new file mode 120000 index 0000000000..46a38f4f9d --- /dev/null +++ b/Lang/EDSAC-order-code/A+B @@ -0,0 +1 @@ +../../Task/A+B/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Comments b/Lang/EDSAC-order-code/Comments new file mode 120000 index 0000000000..23e76bdd21 --- /dev/null +++ b/Lang/EDSAC-order-code/Comments @@ -0,0 +1 @@ +../../Task/Comments/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Empty-program b/Lang/EDSAC-order-code/Empty-program new file mode 120000 index 0000000000..48d58bbfc6 --- /dev/null +++ b/Lang/EDSAC-order-code/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Fibonacci-sequence b/Lang/EDSAC-order-code/Fibonacci-sequence new file mode 120000 index 0000000000..24dd31a77e --- /dev/null +++ b/Lang/EDSAC-order-code/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Hello-world-Text b/Lang/EDSAC-order-code/Hello-world-Text new file mode 120000 index 0000000000..4c2a65507e --- /dev/null +++ b/Lang/EDSAC-order-code/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Integer-comparison b/Lang/EDSAC-order-code/Integer-comparison new file mode 120000 index 0000000000..72dbb8a8ba --- /dev/null +++ b/Lang/EDSAC-order-code/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Integer-sequence b/Lang/EDSAC-order-code/Integer-sequence new file mode 120000 index 0000000000..c953ecbc64 --- /dev/null +++ b/Lang/EDSAC-order-code/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Loops-For b/Lang/EDSAC-order-code/Loops-For new file mode 120000 index 0000000000..fa63fe8779 --- /dev/null +++ b/Lang/EDSAC-order-code/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/README b/Lang/EDSAC-order-code/README new file mode 100644 index 0000000000..23beeb5180 --- /dev/null +++ b/Lang/EDSAC-order-code/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:EDSAC_order_code diff --git a/Lang/ERRE/00DESCRIPTION b/Lang/ERRE/00DESCRIPTION new file mode 100644 index 0000000000..79da0fca04 --- /dev/null +++ b/Lang/ERRE/00DESCRIPTION @@ -0,0 +1,23 @@ +{{language|ERRE +|site=http://claudiolarini.altervista.org/erre.htm}} +{{language programming paradigm|Imperative}} +ERRE was born as a university project (Politecnico di Milano - Italy) in the 80's on a C-64 computer. +The language was ported to IBM PC and revised various times. + +The actual versions are: + +* '''V 2.6''' on PC IBM and compatibles (from MS-DOS 5.0 to Win XP) + +* '''V 3.2''' on C-64 + +There also a reduced version for VIC-20 ('''V 1.3''') and a more recent version for PC ('''V 3.0''') with limited OOP support. + +---- + +ERRE is a [[imperative programming|imperative]] programming language: it's compiled in R-Code and then executed with an interpreter. + +Web site: '''ERRE PROJECT'''''[http://www.claudiolarini.altervista.org/erre.htm]'' + +Web site: '''ERRE TUTORIAL'''''[http://www.claudiolarini.altervista.org/erre_tutor.htm]'' + +---- \ No newline at end of file diff --git a/Lang/ERRE/100-doors b/Lang/ERRE/100-doors new file mode 120000 index 0000000000..c169ce98d4 --- /dev/null +++ b/Lang/ERRE/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/ERRE \ No newline at end of file diff --git a/Lang/ERRE/24-game-Solve b/Lang/ERRE/24-game-Solve new file mode 120000 index 0000000000..ef812ad3db --- /dev/null +++ b/Lang/ERRE/24-game-Solve @@ -0,0 +1 @@ +../../Task/24-game-Solve/ERRE \ No newline at end of file diff --git a/Lang/ERRE/A+B b/Lang/ERRE/A+B new file mode 120000 index 0000000000..969bdf467e --- /dev/null +++ b/Lang/ERRE/A+B @@ -0,0 +1 @@ +../../Task/A+B/ERRE \ No newline at end of file diff --git a/Lang/ERRE/ABC-Problem b/Lang/ERRE/ABC-Problem new file mode 120000 index 0000000000..7018674d8f --- /dev/null +++ b/Lang/ERRE/ABC-Problem @@ -0,0 +1 @@ +../../Task/ABC-Problem/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Accumulator-factory b/Lang/ERRE/Accumulator-factory new file mode 120000 index 0000000000..f8afdeefdd --- /dev/null +++ b/Lang/ERRE/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Ackermann-function b/Lang/ERRE/Ackermann-function new file mode 120000 index 0000000000..3b7840b7b1 --- /dev/null +++ b/Lang/ERRE/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Address-of-a-variable b/Lang/ERRE/Address-of-a-variable new file mode 120000 index 0000000000..989f1ea7c1 --- /dev/null +++ b/Lang/ERRE/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Almost-prime b/Lang/ERRE/Almost-prime new file mode 120000 index 0000000000..494751fc74 --- /dev/null +++ b/Lang/ERRE/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Amb b/Lang/ERRE/Amb new file mode 120000 index 0000000000..e5466cb760 --- /dev/null +++ b/Lang/ERRE/Amb @@ -0,0 +1 @@ +../../Task/Amb/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Amicable-pairs b/Lang/ERRE/Amicable-pairs new file mode 120000 index 0000000000..59a0e84713 --- /dev/null +++ b/Lang/ERRE/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Animate-a-pendulum b/Lang/ERRE/Animate-a-pendulum new file mode 120000 index 0000000000..3745e4b3a8 --- /dev/null +++ b/Lang/ERRE/Animate-a-pendulum @@ -0,0 +1 @@ +../../Task/Animate-a-pendulum/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Apply-a-callback-to-an-array b/Lang/ERRE/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..5a2da68ac3 --- /dev/null +++ b/Lang/ERRE/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Arithmetic-Complex b/Lang/ERRE/Arithmetic-Complex new file mode 120000 index 0000000000..6e38e258fb --- /dev/null +++ b/Lang/ERRE/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Arithmetic-Integer b/Lang/ERRE/Arithmetic-Integer new file mode 120000 index 0000000000..23fce29ca6 --- /dev/null +++ b/Lang/ERRE/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Arithmetic-Rational b/Lang/ERRE/Arithmetic-Rational new file mode 120000 index 0000000000..40a5411ada --- /dev/null +++ b/Lang/ERRE/Arithmetic-Rational @@ -0,0 +1 @@ +../../Task/Arithmetic-Rational/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Arithmetic-evaluation b/Lang/ERRE/Arithmetic-evaluation new file mode 120000 index 0000000000..c28c435f48 --- /dev/null +++ b/Lang/ERRE/Arithmetic-evaluation @@ -0,0 +1 @@ +../../Task/Arithmetic-evaluation/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Arithmetic-geometric-mean b/Lang/ERRE/Arithmetic-geometric-mean new file mode 120000 index 0000000000..27c8f9e3b6 --- /dev/null +++ b/Lang/ERRE/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Array-concatenation b/Lang/ERRE/Array-concatenation new file mode 120000 index 0000000000..c6883e35f8 --- /dev/null +++ b/Lang/ERRE/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Averages-Median b/Lang/ERRE/Averages-Median new file mode 120000 index 0000000000..3ac8bbd6a2 --- /dev/null +++ b/Lang/ERRE/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Averages-Mode b/Lang/ERRE/Averages-Mode new file mode 120000 index 0000000000..12a10e076b --- /dev/null +++ b/Lang/ERRE/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Averages-Pythagorean-means b/Lang/ERRE/Averages-Pythagorean-means new file mode 120000 index 0000000000..161d197688 --- /dev/null +++ b/Lang/ERRE/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Averages-Root-mean-square b/Lang/ERRE/Averages-Root-mean-square new file mode 120000 index 0000000000..7cbb17e4bd --- /dev/null +++ b/Lang/ERRE/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Bitmap-Bresenhams-line-algorithm b/Lang/ERRE/Bitmap-Bresenhams-line-algorithm new file mode 120000 index 0000000000..7edf9e8661 --- /dev/null +++ b/Lang/ERRE/Bitmap-Bresenhams-line-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Bresenhams-line-algorithm/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Bitmap-Flood-fill b/Lang/ERRE/Bitmap-Flood-fill new file mode 120000 index 0000000000..d334a8162f --- /dev/null +++ b/Lang/ERRE/Bitmap-Flood-fill @@ -0,0 +1 @@ +../../Task/Bitmap-Flood-fill/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Bitmap-Midpoint-circle-algorithm b/Lang/ERRE/Bitmap-Midpoint-circle-algorithm new file mode 120000 index 0000000000..c0999208cc --- /dev/null +++ b/Lang/ERRE/Bitmap-Midpoint-circle-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Midpoint-circle-algorithm/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Caesar-cipher b/Lang/ERRE/Caesar-cipher new file mode 120000 index 0000000000..820da499ac --- /dev/null +++ b/Lang/ERRE/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Catalan-numbers b/Lang/ERRE/Catalan-numbers new file mode 120000 index 0000000000..3a9f81024f --- /dev/null +++ b/Lang/ERRE/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Catalan-numbers-Pascals-triangle b/Lang/ERRE/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..c98f102870 --- /dev/null +++ b/Lang/ERRE/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Circles-of-given-radius-through-two-points b/Lang/ERRE/Circles-of-given-radius-through-two-points new file mode 120000 index 0000000000..80179d8f45 --- /dev/null +++ b/Lang/ERRE/Circles-of-given-radius-through-two-points @@ -0,0 +1 @@ +../../Task/Circles-of-given-radius-through-two-points/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Classes b/Lang/ERRE/Classes new file mode 120000 index 0000000000..f96e610322 --- /dev/null +++ b/Lang/ERRE/Classes @@ -0,0 +1 @@ +../../Task/Classes/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Combinations b/Lang/ERRE/Combinations new file mode 120000 index 0000000000..8d8732ef10 --- /dev/null +++ b/Lang/ERRE/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Comments b/Lang/ERRE/Comments new file mode 120000 index 0000000000..c182492ca0 --- /dev/null +++ b/Lang/ERRE/Comments @@ -0,0 +1 @@ +../../Task/Comments/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Create-a-file b/Lang/ERRE/Create-a-file new file mode 120000 index 0000000000..dd5bd7c038 --- /dev/null +++ b/Lang/ERRE/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Create-a-two-dimensional-array-at-runtime b/Lang/ERRE/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..de7ea7a005 --- /dev/null +++ b/Lang/ERRE/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Day-of-the-week b/Lang/ERRE/Day-of-the-week new file mode 120000 index 0000000000..6b6b3ef104 --- /dev/null +++ b/Lang/ERRE/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Deal-cards-for-FreeCell b/Lang/ERRE/Deal-cards-for-FreeCell new file mode 120000 index 0000000000..397a8feb2f --- /dev/null +++ b/Lang/ERRE/Deal-cards-for-FreeCell @@ -0,0 +1 @@ +../../Task/Deal-cards-for-FreeCell/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Detect-division-by-zero b/Lang/ERRE/Detect-division-by-zero new file mode 120000 index 0000000000..a25ec4aa2a --- /dev/null +++ b/Lang/ERRE/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Dinesmans-multiple-dwelling-problem b/Lang/ERRE/Dinesmans-multiple-dwelling-problem new file mode 120000 index 0000000000..5558a955ab --- /dev/null +++ b/Lang/ERRE/Dinesmans-multiple-dwelling-problem @@ -0,0 +1 @@ +../../Task/Dinesmans-multiple-dwelling-problem/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Dragon-curve b/Lang/ERRE/Dragon-curve new file mode 120000 index 0000000000..d7000ba64f --- /dev/null +++ b/Lang/ERRE/Dragon-curve @@ -0,0 +1 @@ +../../Task/Dragon-curve/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Draw-a-sphere b/Lang/ERRE/Draw-a-sphere new file mode 120000 index 0000000000..e67c237a87 --- /dev/null +++ b/Lang/ERRE/Draw-a-sphere @@ -0,0 +1 @@ +../../Task/Draw-a-sphere/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Empty-program b/Lang/ERRE/Empty-program new file mode 120000 index 0000000000..207de9d0b8 --- /dev/null +++ b/Lang/ERRE/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Equilibrium-index b/Lang/ERRE/Equilibrium-index new file mode 120000 index 0000000000..b2d84b1950 --- /dev/null +++ b/Lang/ERRE/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Ethiopian-multiplication b/Lang/ERRE/Ethiopian-multiplication new file mode 120000 index 0000000000..d446a4e5e2 --- /dev/null +++ b/Lang/ERRE/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Evaluate-binomial-coefficients b/Lang/ERRE/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..49a28d56e8 --- /dev/null +++ b/Lang/ERRE/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Even-or-odd b/Lang/ERRE/Even-or-odd new file mode 120000 index 0000000000..e4539f12fd --- /dev/null +++ b/Lang/ERRE/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Execute-a-system-command b/Lang/ERRE/Execute-a-system-command new file mode 120000 index 0000000000..cf20441226 --- /dev/null +++ b/Lang/ERRE/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Exponentiation-operator b/Lang/ERRE/Exponentiation-operator new file mode 120000 index 0000000000..da7aaaa45c --- /dev/null +++ b/Lang/ERRE/Exponentiation-operator @@ -0,0 +1 @@ +../../Task/Exponentiation-operator/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Factorial b/Lang/ERRE/Factorial new file mode 120000 index 0000000000..be633d2e47 --- /dev/null +++ b/Lang/ERRE/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Factors-of-an-integer b/Lang/ERRE/Factors-of-an-integer new file mode 120000 index 0000000000..1205db8eba --- /dev/null +++ b/Lang/ERRE/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Fast-Fourier-transform b/Lang/ERRE/Fast-Fourier-transform new file mode 120000 index 0000000000..6b3862a7da --- /dev/null +++ b/Lang/ERRE/Fast-Fourier-transform @@ -0,0 +1 @@ +../../Task/Fast-Fourier-transform/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Fibonacci-n-step-number-sequences b/Lang/ERRE/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..c6d3d6930d --- /dev/null +++ b/Lang/ERRE/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Fibonacci-sequence b/Lang/ERRE/Fibonacci-sequence new file mode 120000 index 0000000000..08116dd7c9 --- /dev/null +++ b/Lang/ERRE/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Find-the-missing-permutation b/Lang/ERRE/Find-the-missing-permutation new file mode 120000 index 0000000000..534a5614d4 --- /dev/null +++ b/Lang/ERRE/Find-the-missing-permutation @@ -0,0 +1 @@ +../../Task/Find-the-missing-permutation/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Five-weekends b/Lang/ERRE/Five-weekends new file mode 120000 index 0000000000..c807207056 --- /dev/null +++ b/Lang/ERRE/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/ERRE \ No newline at end of file diff --git a/Lang/ERRE/FizzBuzz b/Lang/ERRE/FizzBuzz new file mode 120000 index 0000000000..f04c901cc5 --- /dev/null +++ b/Lang/ERRE/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Floyds-triangle b/Lang/ERRE/Floyds-triangle new file mode 120000 index 0000000000..5c8e253727 --- /dev/null +++ b/Lang/ERRE/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Formatted-numeric-output b/Lang/ERRE/Formatted-numeric-output new file mode 120000 index 0000000000..7479ac7cea --- /dev/null +++ b/Lang/ERRE/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Greatest-common-divisor b/Lang/ERRE/Greatest-common-divisor new file mode 120000 index 0000000000..831f3457fb --- /dev/null +++ b/Lang/ERRE/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Greatest-element-of-a-list b/Lang/ERRE/Greatest-element-of-a-list new file mode 120000 index 0000000000..611476f353 --- /dev/null +++ b/Lang/ERRE/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Greatest-subsequential-sum b/Lang/ERRE/Greatest-subsequential-sum new file mode 120000 index 0000000000..3b29f718b3 --- /dev/null +++ b/Lang/ERRE/Greatest-subsequential-sum @@ -0,0 +1 @@ +../../Task/Greatest-subsequential-sum/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Guess-the-number b/Lang/ERRE/Guess-the-number new file mode 120000 index 0000000000..e8f0dd097a --- /dev/null +++ b/Lang/ERRE/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Hailstone-sequence b/Lang/ERRE/Hailstone-sequence new file mode 120000 index 0000000000..df67b94051 --- /dev/null +++ b/Lang/ERRE/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Hamming-numbers b/Lang/ERRE/Hamming-numbers new file mode 120000 index 0000000000..3660961650 --- /dev/null +++ b/Lang/ERRE/Hamming-numbers @@ -0,0 +1 @@ +../../Task/Hamming-numbers/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Haversine-formula b/Lang/ERRE/Haversine-formula new file mode 120000 index 0000000000..36d7de413e --- /dev/null +++ b/Lang/ERRE/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Hello-world-Line-printer b/Lang/ERRE/Hello-world-Line-printer new file mode 120000 index 0000000000..79f32385c1 --- /dev/null +++ b/Lang/ERRE/Hello-world-Line-printer @@ -0,0 +1 @@ +../../Task/Hello-world-Line-printer/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Hello-world-Newline-omission b/Lang/ERRE/Hello-world-Newline-omission new file mode 120000 index 0000000000..dda23e8561 --- /dev/null +++ b/Lang/ERRE/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Hello-world-Text b/Lang/ERRE/Hello-world-Text new file mode 120000 index 0000000000..f8e3041ac1 --- /dev/null +++ b/Lang/ERRE/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Heronian-triangles b/Lang/ERRE/Heronian-triangles new file mode 120000 index 0000000000..b5034ef3c6 --- /dev/null +++ b/Lang/ERRE/Heronian-triangles @@ -0,0 +1 @@ +../../Task/Heronian-triangles/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Higher-order-functions b/Lang/ERRE/Higher-order-functions new file mode 120000 index 0000000000..4712f5cb4c --- /dev/null +++ b/Lang/ERRE/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Hofstadter-Q-sequence b/Lang/ERRE/Hofstadter-Q-sequence new file mode 120000 index 0000000000..adf1be21c5 --- /dev/null +++ b/Lang/ERRE/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Horizontal-sundial-calculations b/Lang/ERRE/Horizontal-sundial-calculations new file mode 120000 index 0000000000..739e3ab321 --- /dev/null +++ b/Lang/ERRE/Horizontal-sundial-calculations @@ -0,0 +1 @@ +../../Task/Horizontal-sundial-calculations/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Horners-rule-for-polynomial-evaluation b/Lang/ERRE/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..e464676a34 --- /dev/null +++ b/Lang/ERRE/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Identity-matrix b/Lang/ERRE/Identity-matrix new file mode 120000 index 0000000000..a122e566d4 --- /dev/null +++ b/Lang/ERRE/Identity-matrix @@ -0,0 +1 @@ +../../Task/Identity-matrix/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Increment-a-numerical-string b/Lang/ERRE/Increment-a-numerical-string new file mode 120000 index 0000000000..0921acee4d --- /dev/null +++ b/Lang/ERRE/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Infinity b/Lang/ERRE/Infinity new file mode 120000 index 0000000000..a2ca508539 --- /dev/null +++ b/Lang/ERRE/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Integer-sequence b/Lang/ERRE/Integer-sequence new file mode 120000 index 0000000000..5c49a883ac --- /dev/null +++ b/Lang/ERRE/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Iterated-digits-squaring b/Lang/ERRE/Iterated-digits-squaring new file mode 120000 index 0000000000..ce36029bdd --- /dev/null +++ b/Lang/ERRE/Iterated-digits-squaring @@ -0,0 +1 @@ +../../Task/Iterated-digits-squaring/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Josephus-problem b/Lang/ERRE/Josephus-problem new file mode 120000 index 0000000000..e6a733f2df --- /dev/null +++ b/Lang/ERRE/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Jump-anywhere b/Lang/ERRE/Jump-anywhere new file mode 120000 index 0000000000..8ce8e7ce71 --- /dev/null +++ b/Lang/ERRE/Jump-anywhere @@ -0,0 +1 @@ +../../Task/Jump-anywhere/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Keyboard-input-Flush-the-keyboard-buffer b/Lang/ERRE/Keyboard-input-Flush-the-keyboard-buffer new file mode 120000 index 0000000000..3813c2c518 --- /dev/null +++ b/Lang/ERRE/Keyboard-input-Flush-the-keyboard-buffer @@ -0,0 +1 @@ +../../Task/Keyboard-input-Flush-the-keyboard-buffer/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Keyboard-input-Keypress-check b/Lang/ERRE/Keyboard-input-Keypress-check new file mode 120000 index 0000000000..5960672d02 --- /dev/null +++ b/Lang/ERRE/Keyboard-input-Keypress-check @@ -0,0 +1 @@ +../../Task/Keyboard-input-Keypress-check/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/ERRE/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..52d6edfd3d --- /dev/null +++ b/Lang/ERRE/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Knights-tour b/Lang/ERRE/Knights-tour new file mode 120000 index 0000000000..4408ff7ed8 --- /dev/null +++ b/Lang/ERRE/Knights-tour @@ -0,0 +1 @@ +../../Task/Knights-tour/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Knuth-shuffle b/Lang/ERRE/Knuth-shuffle new file mode 120000 index 0000000000..e7df30d54d --- /dev/null +++ b/Lang/ERRE/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Leap-year b/Lang/ERRE/Leap-year new file mode 120000 index 0000000000..00e219078a --- /dev/null +++ b/Lang/ERRE/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Least-common-multiple b/Lang/ERRE/Least-common-multiple new file mode 120000 index 0000000000..b0649caf1e --- /dev/null +++ b/Lang/ERRE/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Letter-frequency b/Lang/ERRE/Letter-frequency new file mode 120000 index 0000000000..b0b3f48089 --- /dev/null +++ b/Lang/ERRE/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Levenshtein-distance b/Lang/ERRE/Levenshtein-distance new file mode 120000 index 0000000000..cec54076b3 --- /dev/null +++ b/Lang/ERRE/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Linear-congruential-generator b/Lang/ERRE/Linear-congruential-generator new file mode 120000 index 0000000000..50cae74374 --- /dev/null +++ b/Lang/ERRE/Linear-congruential-generator @@ -0,0 +1 @@ +../../Task/Linear-congruential-generator/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Literals-Integer b/Lang/ERRE/Literals-Integer new file mode 120000 index 0000000000..96291b695e --- /dev/null +++ b/Lang/ERRE/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Look-and-say-sequence b/Lang/ERRE/Look-and-say-sequence new file mode 120000 index 0000000000..86a74f1cab --- /dev/null +++ b/Lang/ERRE/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Loops-Break b/Lang/ERRE/Loops-Break new file mode 120000 index 0000000000..ee00c5e62f --- /dev/null +++ b/Lang/ERRE/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Loops-Continue b/Lang/ERRE/Loops-Continue new file mode 120000 index 0000000000..007ab00f7b --- /dev/null +++ b/Lang/ERRE/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Loops-Do-while b/Lang/ERRE/Loops-Do-while new file mode 120000 index 0000000000..bc0e89efd2 --- /dev/null +++ b/Lang/ERRE/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Loops-Downward-for b/Lang/ERRE/Loops-Downward-for new file mode 120000 index 0000000000..ffac8c925e --- /dev/null +++ b/Lang/ERRE/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Loops-For b/Lang/ERRE/Loops-For new file mode 120000 index 0000000000..a919b01f60 --- /dev/null +++ b/Lang/ERRE/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Loops-For-with-a-specified-step b/Lang/ERRE/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..2457567d92 --- /dev/null +++ b/Lang/ERRE/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Loops-Foreach b/Lang/ERRE/Loops-Foreach new file mode 120000 index 0000000000..b5ff99c3ca --- /dev/null +++ b/Lang/ERRE/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Loops-Infinite b/Lang/ERRE/Loops-Infinite new file mode 120000 index 0000000000..e7211de2fc --- /dev/null +++ b/Lang/ERRE/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Loops-N-plus-one-half b/Lang/ERRE/Loops-N-plus-one-half new file mode 120000 index 0000000000..b2a3c6369f --- /dev/null +++ b/Lang/ERRE/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Loops-Nested b/Lang/ERRE/Loops-Nested new file mode 120000 index 0000000000..7b0ea06782 --- /dev/null +++ b/Lang/ERRE/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Loops-While b/Lang/ERRE/Loops-While new file mode 120000 index 0000000000..d0929f16fd --- /dev/null +++ b/Lang/ERRE/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Lucas-Lehmer-test b/Lang/ERRE/Lucas-Lehmer-test new file mode 120000 index 0000000000..e2c9a0280e --- /dev/null +++ b/Lang/ERRE/Lucas-Lehmer-test @@ -0,0 +1 @@ +../../Task/Lucas-Lehmer-test/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Magic-squares-of-odd-order b/Lang/ERRE/Magic-squares-of-odd-order new file mode 120000 index 0000000000..b758f54e8d --- /dev/null +++ b/Lang/ERRE/Magic-squares-of-odd-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-odd-order/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Make-directory-path b/Lang/ERRE/Make-directory-path new file mode 120000 index 0000000000..36425dbdec --- /dev/null +++ b/Lang/ERRE/Make-directory-path @@ -0,0 +1 @@ +../../Task/Make-directory-path/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Mandelbrot-set b/Lang/ERRE/Mandelbrot-set new file mode 120000 index 0000000000..1f452bb576 --- /dev/null +++ b/Lang/ERRE/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Map-range b/Lang/ERRE/Map-range new file mode 120000 index 0000000000..a756ca9b16 --- /dev/null +++ b/Lang/ERRE/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Matrix-exponentiation-operator b/Lang/ERRE/Matrix-exponentiation-operator new file mode 120000 index 0000000000..049914603a --- /dev/null +++ b/Lang/ERRE/Matrix-exponentiation-operator @@ -0,0 +1 @@ +../../Task/Matrix-exponentiation-operator/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Matrix-multiplication b/Lang/ERRE/Matrix-multiplication new file mode 120000 index 0000000000..fb285de00b --- /dev/null +++ b/Lang/ERRE/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Maximum-triangle-path-sum b/Lang/ERRE/Maximum-triangle-path-sum new file mode 120000 index 0000000000..12ac198c7a --- /dev/null +++ b/Lang/ERRE/Maximum-triangle-path-sum @@ -0,0 +1 @@ +../../Task/Maximum-triangle-path-sum/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Menu b/Lang/ERRE/Menu new file mode 120000 index 0000000000..5375605f20 --- /dev/null +++ b/Lang/ERRE/Menu @@ -0,0 +1 @@ +../../Task/Menu/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Middle-three-digits b/Lang/ERRE/Middle-three-digits new file mode 120000 index 0000000000..9d633161db --- /dev/null +++ b/Lang/ERRE/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Modular-inverse b/Lang/ERRE/Modular-inverse new file mode 120000 index 0000000000..336f9df4eb --- /dev/null +++ b/Lang/ERRE/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Monte-Carlo-methods b/Lang/ERRE/Monte-Carlo-methods new file mode 120000 index 0000000000..18ce68876c --- /dev/null +++ b/Lang/ERRE/Monte-Carlo-methods @@ -0,0 +1 @@ +../../Task/Monte-Carlo-methods/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Mouse-position b/Lang/ERRE/Mouse-position new file mode 120000 index 0000000000..67ae686c1a --- /dev/null +++ b/Lang/ERRE/Mouse-position @@ -0,0 +1 @@ +../../Task/Mouse-position/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Multifactorial b/Lang/ERRE/Multifactorial new file mode 120000 index 0000000000..2ec00f5115 --- /dev/null +++ b/Lang/ERRE/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Multiple-regression b/Lang/ERRE/Multiple-regression new file mode 120000 index 0000000000..033bdad63f --- /dev/null +++ b/Lang/ERRE/Multiple-regression @@ -0,0 +1 @@ +../../Task/Multiple-regression/ERRE \ No newline at end of file diff --git a/Lang/ERRE/N-queens-problem b/Lang/ERRE/N-queens-problem new file mode 120000 index 0000000000..6df9efe6f2 --- /dev/null +++ b/Lang/ERRE/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Narcissistic-decimal-number b/Lang/ERRE/Narcissistic-decimal-number new file mode 120000 index 0000000000..a5c6879834 --- /dev/null +++ b/Lang/ERRE/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Nth b/Lang/ERRE/Nth new file mode 120000 index 0000000000..14504711c1 --- /dev/null +++ b/Lang/ERRE/Nth @@ -0,0 +1 @@ +../../Task/Nth/ERRE \ No newline at end of file diff --git a/Lang/ERRE/One-dimensional-cellular-automata b/Lang/ERRE/One-dimensional-cellular-automata new file mode 120000 index 0000000000..ed5a2dc82c --- /dev/null +++ b/Lang/ERRE/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/ERRE \ No newline at end of file diff --git a/Lang/ERRE/One-of-n-lines-in-a-file b/Lang/ERRE/One-of-n-lines-in-a-file new file mode 120000 index 0000000000..de7b93a1f0 --- /dev/null +++ b/Lang/ERRE/One-of-n-lines-in-a-file @@ -0,0 +1 @@ +../../Task/One-of-n-lines-in-a-file/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Pascals-triangle b/Lang/ERRE/Pascals-triangle new file mode 120000 index 0000000000..6216fbef1c --- /dev/null +++ b/Lang/ERRE/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Perfect-numbers b/Lang/ERRE/Perfect-numbers new file mode 120000 index 0000000000..cf8a7b50f2 --- /dev/null +++ b/Lang/ERRE/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Primality-by-trial-division b/Lang/ERRE/Primality-by-trial-division new file mode 120000 index 0000000000..e5e1b10282 --- /dev/null +++ b/Lang/ERRE/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Prime-decomposition b/Lang/ERRE/Prime-decomposition new file mode 120000 index 0000000000..bf47b8c059 --- /dev/null +++ b/Lang/ERRE/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Probabilistic-choice b/Lang/ERRE/Probabilistic-choice new file mode 120000 index 0000000000..85569b9883 --- /dev/null +++ b/Lang/ERRE/Probabilistic-choice @@ -0,0 +1 @@ +../../Task/Probabilistic-choice/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Pythagorean-triples b/Lang/ERRE/Pythagorean-triples new file mode 120000 index 0000000000..bb939b9f8c --- /dev/null +++ b/Lang/ERRE/Pythagorean-triples @@ -0,0 +1 @@ +../../Task/Pythagorean-triples/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Quaternion-type b/Lang/ERRE/Quaternion-type new file mode 120000 index 0000000000..fcc1edb64e --- /dev/null +++ b/Lang/ERRE/Quaternion-type @@ -0,0 +1 @@ +../../Task/Quaternion-type/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Queue-Definition b/Lang/ERRE/Queue-Definition new file mode 120000 index 0000000000..3ca1cb8f71 --- /dev/null +++ b/Lang/ERRE/Queue-Definition @@ -0,0 +1 @@ +../../Task/Queue-Definition/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Quine b/Lang/ERRE/Quine new file mode 120000 index 0000000000..87842c5189 --- /dev/null +++ b/Lang/ERRE/Quine @@ -0,0 +1 @@ +../../Task/Quine/ERRE \ No newline at end of file diff --git a/Lang/ERRE/README b/Lang/ERRE/README new file mode 100644 index 0000000000..31a681da10 --- /dev/null +++ b/Lang/ERRE/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:ERRE diff --git a/Lang/ERRE/Random-numbers b/Lang/ERRE/Random-numbers new file mode 120000 index 0000000000..c9fdcfaed9 --- /dev/null +++ b/Lang/ERRE/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Rate-counter b/Lang/ERRE/Rate-counter new file mode 120000 index 0000000000..efdf25515c --- /dev/null +++ b/Lang/ERRE/Rate-counter @@ -0,0 +1 @@ +../../Task/Rate-counter/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Read-a-file-line-by-line b/Lang/ERRE/Read-a-file-line-by-line new file mode 120000 index 0000000000..980d7e75c9 --- /dev/null +++ b/Lang/ERRE/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Real-constants-and-functions b/Lang/ERRE/Real-constants-and-functions new file mode 120000 index 0000000000..54806766d6 --- /dev/null +++ b/Lang/ERRE/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Repeat-a-string b/Lang/ERRE/Repeat-a-string new file mode 120000 index 0000000000..5cdf4ac3a2 --- /dev/null +++ b/Lang/ERRE/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Resistor-mesh b/Lang/ERRE/Resistor-mesh new file mode 120000 index 0000000000..d0351169ab --- /dev/null +++ b/Lang/ERRE/Resistor-mesh @@ -0,0 +1 @@ +../../Task/Resistor-mesh/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Return-multiple-values b/Lang/ERRE/Return-multiple-values new file mode 120000 index 0000000000..44760ab8c3 --- /dev/null +++ b/Lang/ERRE/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Reverse-a-string b/Lang/ERRE/Reverse-a-string new file mode 120000 index 0000000000..b3aee77117 --- /dev/null +++ b/Lang/ERRE/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Roman-numerals-Decode b/Lang/ERRE/Roman-numerals-Decode new file mode 120000 index 0000000000..f362852a63 --- /dev/null +++ b/Lang/ERRE/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Roman-numerals-Encode b/Lang/ERRE/Roman-numerals-Encode new file mode 120000 index 0000000000..60239a1c54 --- /dev/null +++ b/Lang/ERRE/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Roots-of-a-function b/Lang/ERRE/Roots-of-a-function new file mode 120000 index 0000000000..8bc55bdbff --- /dev/null +++ b/Lang/ERRE/Roots-of-a-function @@ -0,0 +1 @@ +../../Task/Roots-of-a-function/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Roots-of-a-quadratic-function b/Lang/ERRE/Roots-of-a-quadratic-function new file mode 120000 index 0000000000..f26486f6a5 --- /dev/null +++ b/Lang/ERRE/Roots-of-a-quadratic-function @@ -0,0 +1 @@ +../../Task/Roots-of-a-quadratic-function/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Roots-of-unity b/Lang/ERRE/Roots-of-unity new file mode 120000 index 0000000000..0dc424a560 --- /dev/null +++ b/Lang/ERRE/Roots-of-unity @@ -0,0 +1 @@ +../../Task/Roots-of-unity/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Rot-13 b/Lang/ERRE/Rot-13 new file mode 120000 index 0000000000..e611b4cc08 --- /dev/null +++ b/Lang/ERRE/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Runge-Kutta-method b/Lang/ERRE/Runge-Kutta-method new file mode 120000 index 0000000000..12613de1ec --- /dev/null +++ b/Lang/ERRE/Runge-Kutta-method @@ -0,0 +1 @@ +../../Task/Runge-Kutta-method/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Semiprime b/Lang/ERRE/Semiprime new file mode 120000 index 0000000000..46c0cf31f1 --- /dev/null +++ b/Lang/ERRE/Semiprime @@ -0,0 +1 @@ +../../Task/Semiprime/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Sequence-of-primes-by-Trial-Division b/Lang/ERRE/Sequence-of-primes-by-Trial-Division new file mode 120000 index 0000000000..3ccb32a3f0 --- /dev/null +++ b/Lang/ERRE/Sequence-of-primes-by-Trial-Division @@ -0,0 +1 @@ +../../Task/Sequence-of-primes-by-Trial-Division/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Sierpinski-carpet b/Lang/ERRE/Sierpinski-carpet new file mode 120000 index 0000000000..81abd37737 --- /dev/null +++ b/Lang/ERRE/Sierpinski-carpet @@ -0,0 +1 @@ +../../Task/Sierpinski-carpet/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Sierpinski-triangle-Graphical b/Lang/ERRE/Sierpinski-triangle-Graphical new file mode 120000 index 0000000000..156b32de36 --- /dev/null +++ b/Lang/ERRE/Sierpinski-triangle-Graphical @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle-Graphical/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Sieve-of-Eratosthenes b/Lang/ERRE/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..31ef353f5f --- /dev/null +++ b/Lang/ERRE/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Sleep b/Lang/ERRE/Sleep new file mode 120000 index 0000000000..636e167b68 --- /dev/null +++ b/Lang/ERRE/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Sort-disjoint-sublist b/Lang/ERRE/Sort-disjoint-sublist new file mode 120000 index 0000000000..4d3b0baa77 --- /dev/null +++ b/Lang/ERRE/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Sorting-algorithms-Bubble-sort b/Lang/ERRE/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..eccace6260 --- /dev/null +++ b/Lang/ERRE/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Sorting-algorithms-Insertion-sort b/Lang/ERRE/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..e711bf20c8 --- /dev/null +++ b/Lang/ERRE/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Sorting-algorithms-Merge-sort b/Lang/ERRE/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..9e25d7de91 --- /dev/null +++ b/Lang/ERRE/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Sorting-algorithms-Quicksort b/Lang/ERRE/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..2607f46ebe --- /dev/null +++ b/Lang/ERRE/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/ERRE \ No newline at end of file diff --git a/Lang/ERRE/String-concatenation b/Lang/ERRE/String-concatenation new file mode 120000 index 0000000000..bef02907aa --- /dev/null +++ b/Lang/ERRE/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/ERRE \ No newline at end of file diff --git a/Lang/ERRE/String-prepend b/Lang/ERRE/String-prepend new file mode 120000 index 0000000000..8bf2e747b5 --- /dev/null +++ b/Lang/ERRE/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Sudoku b/Lang/ERRE/Sudoku new file mode 120000 index 0000000000..aa8cca96d6 --- /dev/null +++ b/Lang/ERRE/Sudoku @@ -0,0 +1 @@ +../../Task/Sudoku/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Towers-of-Hanoi b/Lang/ERRE/Towers-of-Hanoi new file mode 120000 index 0000000000..8294de945f --- /dev/null +++ b/Lang/ERRE/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Trabb-Pardo-Knuth-algorithm b/Lang/ERRE/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..c2e7061a68 --- /dev/null +++ b/Lang/ERRE/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Twelve-statements b/Lang/ERRE/Twelve-statements new file mode 120000 index 0000000000..66e3480fb6 --- /dev/null +++ b/Lang/ERRE/Twelve-statements @@ -0,0 +1 @@ +../../Task/Twelve-statements/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Ulam-spiral--for-primes- b/Lang/ERRE/Ulam-spiral--for-primes- new file mode 120000 index 0000000000..30565e5f89 --- /dev/null +++ b/Lang/ERRE/Ulam-spiral--for-primes- @@ -0,0 +1 @@ +../../Task/Ulam-spiral--for-primes-/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Unbias-a-random-generator b/Lang/ERRE/Unbias-a-random-generator new file mode 120000 index 0000000000..eae87fea10 --- /dev/null +++ b/Lang/ERRE/Unbias-a-random-generator @@ -0,0 +1 @@ +../../Task/Unbias-a-random-generator/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Van-der-Corput-sequence b/Lang/ERRE/Van-der-Corput-sequence new file mode 120000 index 0000000000..530dc22e38 --- /dev/null +++ b/Lang/ERRE/Van-der-Corput-sequence @@ -0,0 +1 @@ +../../Task/Van-der-Corput-sequence/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Vector-products b/Lang/ERRE/Vector-products new file mode 120000 index 0000000000..44a0c74bf7 --- /dev/null +++ b/Lang/ERRE/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Write-language-name-in-3D-ASCII b/Lang/ERRE/Write-language-name-in-3D-ASCII new file mode 120000 index 0000000000..ae3ae62742 --- /dev/null +++ b/Lang/ERRE/Write-language-name-in-3D-ASCII @@ -0,0 +1 @@ +../../Task/Write-language-name-in-3D-ASCII/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Zebra-puzzle b/Lang/ERRE/Zebra-puzzle new file mode 120000 index 0000000000..bb3a7318e3 --- /dev/null +++ b/Lang/ERRE/Zebra-puzzle @@ -0,0 +1 @@ +../../Task/Zebra-puzzle/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Zero-to-the-zero-power b/Lang/ERRE/Zero-to-the-zero-power new file mode 120000 index 0000000000..90ea6188bf --- /dev/null +++ b/Lang/ERRE/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Zig-zag-matrix b/Lang/ERRE/Zig-zag-matrix new file mode 120000 index 0000000000..a9036c6218 --- /dev/null +++ b/Lang/ERRE/Zig-zag-matrix @@ -0,0 +1 @@ +../../Task/Zig-zag-matrix/ERRE \ No newline at end of file diff --git a/Lang/EchoLisp/00DESCRIPTION b/Lang/EchoLisp/00DESCRIPTION new file mode 100644 index 0000000000..4126dc2243 --- /dev/null +++ b/Lang/EchoLisp/00DESCRIPTION @@ -0,0 +1,15 @@ +{{language|EchoLisp +|site=http://www.echolalie.org/echolisp/ +|exec=javascript +|gc=yes +|safety=safe +|checking=both}} +{{language programming paradigm|functional}} +{{implementation|Lisp}} + +EchoLisp is a javascript implementation of a Scheme-like [[Lisp]]. EchoLisp includes lexical scoping, tail call elimination, access to the browser local storage, a graphical library, complex numbers, large integers, a JSON library, {sets}, streams, syntax rules, background operations for complex drawings, CSS styled objects, rational numbers, access to javascript IndexedDB, auto-completion, and extensive on-line help. + +EchoLisp runs in a browser window. Validated under FireFox, Chrome and Safari. + +The reference manual is here: [http://www.echolalie.org/echolisp/help.html]. +To run EchoLisp: [http://www.echolalie.org/echolisp/]. \ No newline at end of file diff --git a/Lang/EchoLisp/100-doors b/Lang/EchoLisp/100-doors new file mode 120000 index 0000000000..b1b2c9adbf --- /dev/null +++ b/Lang/EchoLisp/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/24-game b/Lang/EchoLisp/24-game new file mode 120000 index 0000000000..318970cc5b --- /dev/null +++ b/Lang/EchoLisp/24-game @@ -0,0 +1 @@ +../../Task/24-game/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/24-game-Solve b/Lang/EchoLisp/24-game-Solve new file mode 120000 index 0000000000..a0e02ea97f --- /dev/null +++ b/Lang/EchoLisp/24-game-Solve @@ -0,0 +1 @@ +../../Task/24-game-Solve/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/A+B b/Lang/EchoLisp/A+B new file mode 120000 index 0000000000..ad8b281d8c --- /dev/null +++ b/Lang/EchoLisp/A+B @@ -0,0 +1 @@ +../../Task/A+B/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/ABC-Problem b/Lang/EchoLisp/ABC-Problem new file mode 120000 index 0000000000..8f6febdb7e --- /dev/null +++ b/Lang/EchoLisp/ABC-Problem @@ -0,0 +1 @@ +../../Task/ABC-Problem/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/AKS-test-for-primes b/Lang/EchoLisp/AKS-test-for-primes new file mode 120000 index 0000000000..03f6d63569 --- /dev/null +++ b/Lang/EchoLisp/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Abundant,-deficient-and-perfect-number-classifications b/Lang/EchoLisp/Abundant,-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..3f0d7974f1 --- /dev/null +++ b/Lang/EchoLisp/Abundant,-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant,-deficient-and-perfect-number-classifications/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Accumulator-factory b/Lang/EchoLisp/Accumulator-factory new file mode 120000 index 0000000000..f3899fb132 --- /dev/null +++ b/Lang/EchoLisp/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Active-object b/Lang/EchoLisp/Active-object new file mode 120000 index 0000000000..d4c06a8f81 --- /dev/null +++ b/Lang/EchoLisp/Active-object @@ -0,0 +1 @@ +../../Task/Active-object/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Aliquot-sequence-classifications b/Lang/EchoLisp/Aliquot-sequence-classifications new file mode 120000 index 0000000000..db40e6f998 --- /dev/null +++ b/Lang/EchoLisp/Aliquot-sequence-classifications @@ -0,0 +1 @@ +../../Task/Aliquot-sequence-classifications/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Almost-prime b/Lang/EchoLisp/Almost-prime new file mode 120000 index 0000000000..f6ea76be4f --- /dev/null +++ b/Lang/EchoLisp/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Amicable-pairs b/Lang/EchoLisp/Amicable-pairs new file mode 120000 index 0000000000..cfd17d91ce --- /dev/null +++ b/Lang/EchoLisp/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Anagrams b/Lang/EchoLisp/Anagrams new file mode 120000 index 0000000000..5daf836249 --- /dev/null +++ b/Lang/EchoLisp/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Anagrams-Deranged-anagrams b/Lang/EchoLisp/Anagrams-Deranged-anagrams new file mode 120000 index 0000000000..2405b973a7 --- /dev/null +++ b/Lang/EchoLisp/Anagrams-Deranged-anagrams @@ -0,0 +1 @@ +../../Task/Anagrams-Deranged-anagrams/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Anonymous-recursion b/Lang/EchoLisp/Anonymous-recursion new file mode 120000 index 0000000000..50327fb658 --- /dev/null +++ b/Lang/EchoLisp/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Apply-a-callback-to-an-array b/Lang/EchoLisp/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..c0f837b89c --- /dev/null +++ b/Lang/EchoLisp/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Arbitrary-precision-integers--included- b/Lang/EchoLisp/Arbitrary-precision-integers--included- new file mode 120000 index 0000000000..56f5abd369 --- /dev/null +++ b/Lang/EchoLisp/Arbitrary-precision-integers--included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers--included-/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Arithmetic-Complex b/Lang/EchoLisp/Arithmetic-Complex new file mode 120000 index 0000000000..837c4a25dd --- /dev/null +++ b/Lang/EchoLisp/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Arithmetic-Rational b/Lang/EchoLisp/Arithmetic-Rational new file mode 120000 index 0000000000..90d4737ede --- /dev/null +++ b/Lang/EchoLisp/Arithmetic-Rational @@ -0,0 +1 @@ +../../Task/Arithmetic-Rational/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Arithmetic-geometric-mean b/Lang/EchoLisp/Arithmetic-geometric-mean new file mode 120000 index 0000000000..9ff632660d --- /dev/null +++ b/Lang/EchoLisp/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Array-concatenation b/Lang/EchoLisp/Array-concatenation new file mode 120000 index 0000000000..f7d6005ffc --- /dev/null +++ b/Lang/EchoLisp/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Assertions b/Lang/EchoLisp/Assertions new file mode 120000 index 0000000000..75ca9c7515 --- /dev/null +++ b/Lang/EchoLisp/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Associative-array-Creation b/Lang/EchoLisp/Associative-array-Creation new file mode 120000 index 0000000000..3456c522c4 --- /dev/null +++ b/Lang/EchoLisp/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Associative-array-Iteration b/Lang/EchoLisp/Associative-array-Iteration new file mode 120000 index 0000000000..28d73efb62 --- /dev/null +++ b/Lang/EchoLisp/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Average-loop-length b/Lang/EchoLisp/Average-loop-length new file mode 120000 index 0000000000..c00572ecda --- /dev/null +++ b/Lang/EchoLisp/Average-loop-length @@ -0,0 +1 @@ +../../Task/Average-loop-length/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Averages-Arithmetic-mean b/Lang/EchoLisp/Averages-Arithmetic-mean new file mode 120000 index 0000000000..4b73b848af --- /dev/null +++ b/Lang/EchoLisp/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Averages-Mean-angle b/Lang/EchoLisp/Averages-Mean-angle new file mode 120000 index 0000000000..4202a6917e --- /dev/null +++ b/Lang/EchoLisp/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Averages-Mean-time-of-day b/Lang/EchoLisp/Averages-Mean-time-of-day new file mode 120000 index 0000000000..be688159df --- /dev/null +++ b/Lang/EchoLisp/Averages-Mean-time-of-day @@ -0,0 +1 @@ +../../Task/Averages-Mean-time-of-day/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Averages-Median b/Lang/EchoLisp/Averages-Median new file mode 120000 index 0000000000..3be6da2b6c --- /dev/null +++ b/Lang/EchoLisp/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Averages-Mode b/Lang/EchoLisp/Averages-Mode new file mode 120000 index 0000000000..51a2a81004 --- /dev/null +++ b/Lang/EchoLisp/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Averages-Pythagorean-means b/Lang/EchoLisp/Averages-Pythagorean-means new file mode 120000 index 0000000000..784371874d --- /dev/null +++ b/Lang/EchoLisp/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Averages-Root-mean-square b/Lang/EchoLisp/Averages-Root-mean-square new file mode 120000 index 0000000000..6bb50554d1 --- /dev/null +++ b/Lang/EchoLisp/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Averages-Simple-moving-average b/Lang/EchoLisp/Averages-Simple-moving-average new file mode 120000 index 0000000000..9b935350a5 --- /dev/null +++ b/Lang/EchoLisp/Averages-Simple-moving-average @@ -0,0 +1 @@ +../../Task/Averages-Simple-moving-average/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Balanced-brackets b/Lang/EchoLisp/Balanced-brackets new file mode 120000 index 0000000000..b2c124b046 --- /dev/null +++ b/Lang/EchoLisp/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Bernoulli-numbers b/Lang/EchoLisp/Bernoulli-numbers new file mode 120000 index 0000000000..6ab35e4204 --- /dev/null +++ b/Lang/EchoLisp/Bernoulli-numbers @@ -0,0 +1 @@ +../../Task/Bernoulli-numbers/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Binary-digits b/Lang/EchoLisp/Binary-digits new file mode 120000 index 0000000000..28029b2f84 --- /dev/null +++ b/Lang/EchoLisp/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Bitmap b/Lang/EchoLisp/Bitmap new file mode 120000 index 0000000000..efe17ea4de --- /dev/null +++ b/Lang/EchoLisp/Bitmap @@ -0,0 +1 @@ +../../Task/Bitmap/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Boolean-values b/Lang/EchoLisp/Boolean-values new file mode 120000 index 0000000000..d6805db5ec --- /dev/null +++ b/Lang/EchoLisp/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/CSV-data-manipulation b/Lang/EchoLisp/CSV-data-manipulation new file mode 120000 index 0000000000..0c593dd393 --- /dev/null +++ b/Lang/EchoLisp/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/CSV-to-HTML-translation b/Lang/EchoLisp/CSV-to-HTML-translation new file mode 120000 index 0000000000..00b9f0f96e --- /dev/null +++ b/Lang/EchoLisp/CSV-to-HTML-translation @@ -0,0 +1 @@ +../../Task/CSV-to-HTML-translation/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Carmichael-3-strong-pseudoprimes b/Lang/EchoLisp/Carmichael-3-strong-pseudoprimes new file mode 120000 index 0000000000..ce3608a5d6 --- /dev/null +++ b/Lang/EchoLisp/Carmichael-3-strong-pseudoprimes @@ -0,0 +1 @@ +../../Task/Carmichael-3-strong-pseudoprimes/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Case-sensitivity-of-identifiers b/Lang/EchoLisp/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..8b15cf5d71 --- /dev/null +++ b/Lang/EchoLisp/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Catalan-numbers b/Lang/EchoLisp/Catalan-numbers new file mode 120000 index 0000000000..1725f73fe3 --- /dev/null +++ b/Lang/EchoLisp/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Catalan-numbers-Pascals-triangle b/Lang/EchoLisp/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..7f2bd432d5 --- /dev/null +++ b/Lang/EchoLisp/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Catamorphism b/Lang/EchoLisp/Catamorphism new file mode 120000 index 0000000000..37d56805d0 --- /dev/null +++ b/Lang/EchoLisp/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Check-Machin-like-formulas b/Lang/EchoLisp/Check-Machin-like-formulas new file mode 120000 index 0000000000..239494e499 --- /dev/null +++ b/Lang/EchoLisp/Check-Machin-like-formulas @@ -0,0 +1 @@ +../../Task/Check-Machin-like-formulas/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Chinese-remainder-theorem b/Lang/EchoLisp/Chinese-remainder-theorem new file mode 120000 index 0000000000..1741e76f40 --- /dev/null +++ b/Lang/EchoLisp/Chinese-remainder-theorem @@ -0,0 +1 @@ +../../Task/Chinese-remainder-theorem/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Classes b/Lang/EchoLisp/Classes new file mode 120000 index 0000000000..652ea52085 --- /dev/null +++ b/Lang/EchoLisp/Classes @@ -0,0 +1 @@ +../../Task/Classes/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Closures-Value-capture b/Lang/EchoLisp/Closures-Value-capture new file mode 120000 index 0000000000..50d836b341 --- /dev/null +++ b/Lang/EchoLisp/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Collections b/Lang/EchoLisp/Collections new file mode 120000 index 0000000000..18b3aad3b4 --- /dev/null +++ b/Lang/EchoLisp/Collections @@ -0,0 +1 @@ +../../Task/Collections/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Combinations b/Lang/EchoLisp/Combinations new file mode 120000 index 0000000000..26454cb503 --- /dev/null +++ b/Lang/EchoLisp/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Combinations-and-permutations b/Lang/EchoLisp/Combinations-and-permutations new file mode 120000 index 0000000000..5bc2429879 --- /dev/null +++ b/Lang/EchoLisp/Combinations-and-permutations @@ -0,0 +1 @@ +../../Task/Combinations-and-permutations/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Combinations-with-repetitions b/Lang/EchoLisp/Combinations-with-repetitions new file mode 120000 index 0000000000..b7ab6b271e --- /dev/null +++ b/Lang/EchoLisp/Combinations-with-repetitions @@ -0,0 +1 @@ +../../Task/Combinations-with-repetitions/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Comma-quibbling b/Lang/EchoLisp/Comma-quibbling new file mode 120000 index 0000000000..5e6f6f8083 --- /dev/null +++ b/Lang/EchoLisp/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Comments b/Lang/EchoLisp/Comments new file mode 120000 index 0000000000..5e908205aa --- /dev/null +++ b/Lang/EchoLisp/Comments @@ -0,0 +1 @@ +../../Task/Comments/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Compile-time-calculation b/Lang/EchoLisp/Compile-time-calculation new file mode 120000 index 0000000000..9332ad59b3 --- /dev/null +++ b/Lang/EchoLisp/Compile-time-calculation @@ -0,0 +1 @@ +../../Task/Compile-time-calculation/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Compound-data-type b/Lang/EchoLisp/Compound-data-type new file mode 120000 index 0000000000..5f135077d7 --- /dev/null +++ b/Lang/EchoLisp/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Concurrent-computing b/Lang/EchoLisp/Concurrent-computing new file mode 120000 index 0000000000..cdb2067eb2 --- /dev/null +++ b/Lang/EchoLisp/Concurrent-computing @@ -0,0 +1 @@ +../../Task/Concurrent-computing/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Constrained-random-points-on-a-circle b/Lang/EchoLisp/Constrained-random-points-on-a-circle new file mode 120000 index 0000000000..6e2c086540 --- /dev/null +++ b/Lang/EchoLisp/Constrained-random-points-on-a-circle @@ -0,0 +1 @@ +../../Task/Constrained-random-points-on-a-circle/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Convert-decimal-number-to-rational b/Lang/EchoLisp/Convert-decimal-number-to-rational new file mode 120000 index 0000000000..4a06effe3e --- /dev/null +++ b/Lang/EchoLisp/Convert-decimal-number-to-rational @@ -0,0 +1 @@ +../../Task/Convert-decimal-number-to-rational/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Copy-a-string b/Lang/EchoLisp/Copy-a-string new file mode 120000 index 0000000000..aa64f547ca --- /dev/null +++ b/Lang/EchoLisp/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Count-in-factors b/Lang/EchoLisp/Count-in-factors new file mode 120000 index 0000000000..836ee2c5e8 --- /dev/null +++ b/Lang/EchoLisp/Count-in-factors @@ -0,0 +1 @@ +../../Task/Count-in-factors/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Count-occurrences-of-a-substring b/Lang/EchoLisp/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..ae19b5ebfa --- /dev/null +++ b/Lang/EchoLisp/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Count-the-coins b/Lang/EchoLisp/Count-the-coins new file mode 120000 index 0000000000..8704a7849e --- /dev/null +++ b/Lang/EchoLisp/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Create-a-file b/Lang/EchoLisp/Create-a-file new file mode 120000 index 0000000000..f374853494 --- /dev/null +++ b/Lang/EchoLisp/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Create-an-HTML-table b/Lang/EchoLisp/Create-an-HTML-table new file mode 120000 index 0000000000..384118213d --- /dev/null +++ b/Lang/EchoLisp/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Currying b/Lang/EchoLisp/Currying new file mode 120000 index 0000000000..52dc224e67 --- /dev/null +++ b/Lang/EchoLisp/Currying @@ -0,0 +1 @@ +../../Task/Currying/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Date-manipulation b/Lang/EchoLisp/Date-manipulation new file mode 120000 index 0000000000..1394444fd9 --- /dev/null +++ b/Lang/EchoLisp/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Define-a-primitive-data-type b/Lang/EchoLisp/Define-a-primitive-data-type new file mode 120000 index 0000000000..55dffd95fd --- /dev/null +++ b/Lang/EchoLisp/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Determine-if-a-string-is-numeric b/Lang/EchoLisp/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..6c403b4125 --- /dev/null +++ b/Lang/EchoLisp/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Dinesmans-multiple-dwelling-problem b/Lang/EchoLisp/Dinesmans-multiple-dwelling-problem new file mode 120000 index 0000000000..6a205c568c --- /dev/null +++ b/Lang/EchoLisp/Dinesmans-multiple-dwelling-problem @@ -0,0 +1 @@ +../../Task/Dinesmans-multiple-dwelling-problem/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Dining-philosophers b/Lang/EchoLisp/Dining-philosophers new file mode 120000 index 0000000000..53b7aab50d --- /dev/null +++ b/Lang/EchoLisp/Dining-philosophers @@ -0,0 +1 @@ +../../Task/Dining-philosophers/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Dot-product b/Lang/EchoLisp/Dot-product new file mode 120000 index 0000000000..e0ba1d80f6 --- /dev/null +++ b/Lang/EchoLisp/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Empty-program b/Lang/EchoLisp/Empty-program new file mode 120000 index 0000000000..24f8f7f353 --- /dev/null +++ b/Lang/EchoLisp/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Entropy b/Lang/EchoLisp/Entropy new file mode 120000 index 0000000000..f50395d65d --- /dev/null +++ b/Lang/EchoLisp/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Evolutionary-algorithm b/Lang/EchoLisp/Evolutionary-algorithm new file mode 120000 index 0000000000..1d862e8379 --- /dev/null +++ b/Lang/EchoLisp/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Exceptions-Catch-an-exception-thrown-in-a-nested-call b/Lang/EchoLisp/Exceptions-Catch-an-exception-thrown-in-a-nested-call new file mode 120000 index 0000000000..b2c5f84999 --- /dev/null +++ b/Lang/EchoLisp/Exceptions-Catch-an-exception-thrown-in-a-nested-call @@ -0,0 +1 @@ +../../Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Execute-a-Markov-algorithm b/Lang/EchoLisp/Execute-a-Markov-algorithm new file mode 120000 index 0000000000..b7cfb2929b --- /dev/null +++ b/Lang/EchoLisp/Execute-a-Markov-algorithm @@ -0,0 +1 @@ +../../Task/Execute-a-Markov-algorithm/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Exponentiation-operator b/Lang/EchoLisp/Exponentiation-operator new file mode 120000 index 0000000000..899ed3c028 --- /dev/null +++ b/Lang/EchoLisp/Exponentiation-operator @@ -0,0 +1 @@ +../../Task/Exponentiation-operator/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Extend-your-language b/Lang/EchoLisp/Extend-your-language new file mode 120000 index 0000000000..56d5458a2b --- /dev/null +++ b/Lang/EchoLisp/Extend-your-language @@ -0,0 +1 @@ +../../Task/Extend-your-language/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Extensible-prime-generator b/Lang/EchoLisp/Extensible-prime-generator new file mode 120000 index 0000000000..740c0d0e62 --- /dev/null +++ b/Lang/EchoLisp/Extensible-prime-generator @@ -0,0 +1 @@ +../../Task/Extensible-prime-generator/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Factorial b/Lang/EchoLisp/Factorial new file mode 120000 index 0000000000..ec6ce2fd4a --- /dev/null +++ b/Lang/EchoLisp/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Factors-of-a-Mersenne-number b/Lang/EchoLisp/Factors-of-a-Mersenne-number new file mode 120000 index 0000000000..8e4b2d07ff --- /dev/null +++ b/Lang/EchoLisp/Factors-of-a-Mersenne-number @@ -0,0 +1 @@ +../../Task/Factors-of-a-Mersenne-number/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Factors-of-an-integer b/Lang/EchoLisp/Factors-of-an-integer new file mode 120000 index 0000000000..f5a013aa5d --- /dev/null +++ b/Lang/EchoLisp/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Fast-Fourier-transform b/Lang/EchoLisp/Fast-Fourier-transform new file mode 120000 index 0000000000..34049b3c20 --- /dev/null +++ b/Lang/EchoLisp/Fast-Fourier-transform @@ -0,0 +1 @@ +../../Task/Fast-Fourier-transform/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Fibonacci-n-step-number-sequences b/Lang/EchoLisp/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..cd9af09d57 --- /dev/null +++ b/Lang/EchoLisp/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Fibonacci-sequence b/Lang/EchoLisp/Fibonacci-sequence new file mode 120000 index 0000000000..4035c7bcee --- /dev/null +++ b/Lang/EchoLisp/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Fibonacci-word b/Lang/EchoLisp/Fibonacci-word new file mode 120000 index 0000000000..ce214ff9c6 --- /dev/null +++ b/Lang/EchoLisp/Fibonacci-word @@ -0,0 +1 @@ +../../Task/Fibonacci-word/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Filter b/Lang/EchoLisp/Filter new file mode 120000 index 0000000000..b4645fcbc7 --- /dev/null +++ b/Lang/EchoLisp/Filter @@ -0,0 +1 @@ +../../Task/Filter/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Find-the-missing-permutation b/Lang/EchoLisp/Find-the-missing-permutation new file mode 120000 index 0000000000..cbe4a6eab5 --- /dev/null +++ b/Lang/EchoLisp/Find-the-missing-permutation @@ -0,0 +1 @@ +../../Task/Find-the-missing-permutation/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/First-class-environments b/Lang/EchoLisp/First-class-environments new file mode 120000 index 0000000000..52b196f76a --- /dev/null +++ b/Lang/EchoLisp/First-class-environments @@ -0,0 +1 @@ +../../Task/First-class-environments/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/First-class-functions b/Lang/EchoLisp/First-class-functions new file mode 120000 index 0000000000..ada0c8cd71 --- /dev/null +++ b/Lang/EchoLisp/First-class-functions @@ -0,0 +1 @@ +../../Task/First-class-functions/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Flatten-a-list b/Lang/EchoLisp/Flatten-a-list new file mode 120000 index 0000000000..2e01321107 --- /dev/null +++ b/Lang/EchoLisp/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Formal-power-series b/Lang/EchoLisp/Formal-power-series new file mode 120000 index 0000000000..78536506e5 --- /dev/null +++ b/Lang/EchoLisp/Formal-power-series @@ -0,0 +1 @@ +../../Task/Formal-power-series/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Forward-difference b/Lang/EchoLisp/Forward-difference new file mode 120000 index 0000000000..2947c14238 --- /dev/null +++ b/Lang/EchoLisp/Forward-difference @@ -0,0 +1 @@ +../../Task/Forward-difference/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Function-composition b/Lang/EchoLisp/Function-composition new file mode 120000 index 0000000000..6ccb23ea99 --- /dev/null +++ b/Lang/EchoLisp/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Function-definition b/Lang/EchoLisp/Function-definition new file mode 120000 index 0000000000..7ecb30cac2 --- /dev/null +++ b/Lang/EchoLisp/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Generate-Chess960-starting-position b/Lang/EchoLisp/Generate-Chess960-starting-position new file mode 120000 index 0000000000..bc1eaea11e --- /dev/null +++ b/Lang/EchoLisp/Generate-Chess960-starting-position @@ -0,0 +1 @@ +../../Task/Generate-Chess960-starting-position/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Generate-lower-case-ASCII-alphabet b/Lang/EchoLisp/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..964fd17f92 --- /dev/null +++ b/Lang/EchoLisp/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Generator-Exponential b/Lang/EchoLisp/Generator-Exponential new file mode 120000 index 0000000000..09a162bb1b --- /dev/null +++ b/Lang/EchoLisp/Generator-Exponential @@ -0,0 +1 @@ +../../Task/Generator-Exponential/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Generic-swap b/Lang/EchoLisp/Generic-swap new file mode 120000 index 0000000000..ec12fec352 --- /dev/null +++ b/Lang/EchoLisp/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Greatest-element-of-a-list b/Lang/EchoLisp/Greatest-element-of-a-list new file mode 120000 index 0000000000..4c22e9afad --- /dev/null +++ b/Lang/EchoLisp/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Greatest-subsequential-sum b/Lang/EchoLisp/Greatest-subsequential-sum new file mode 120000 index 0000000000..96566c8872 --- /dev/null +++ b/Lang/EchoLisp/Greatest-subsequential-sum @@ -0,0 +1 @@ +../../Task/Greatest-subsequential-sum/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Guess-the-number-With-feedback b/Lang/EchoLisp/Guess-the-number-With-feedback new file mode 120000 index 0000000000..95a302aa91 --- /dev/null +++ b/Lang/EchoLisp/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/HTTP b/Lang/EchoLisp/HTTP new file mode 120000 index 0000000000..97a12d6ccd --- /dev/null +++ b/Lang/EchoLisp/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/HTTPS b/Lang/EchoLisp/HTTPS new file mode 120000 index 0000000000..4b8415d970 --- /dev/null +++ b/Lang/EchoLisp/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Hailstone-sequence b/Lang/EchoLisp/Hailstone-sequence new file mode 120000 index 0000000000..393e1de777 --- /dev/null +++ b/Lang/EchoLisp/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Harshad-or-Niven-series b/Lang/EchoLisp/Harshad-or-Niven-series new file mode 120000 index 0000000000..f7cf2aced3 --- /dev/null +++ b/Lang/EchoLisp/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Hash-from-two-arrays b/Lang/EchoLisp/Hash-from-two-arrays new file mode 120000 index 0000000000..0b0fd61de1 --- /dev/null +++ b/Lang/EchoLisp/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Hash-join b/Lang/EchoLisp/Hash-join new file mode 120000 index 0000000000..6369783cc8 --- /dev/null +++ b/Lang/EchoLisp/Hash-join @@ -0,0 +1 @@ +../../Task/Hash-join/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Hello-world-Graphical b/Lang/EchoLisp/Hello-world-Graphical new file mode 120000 index 0000000000..2586e4b9c4 --- /dev/null +++ b/Lang/EchoLisp/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Hello-world-Line-printer b/Lang/EchoLisp/Hello-world-Line-printer new file mode 120000 index 0000000000..ab87d28fa0 --- /dev/null +++ b/Lang/EchoLisp/Hello-world-Line-printer @@ -0,0 +1 @@ +../../Task/Hello-world-Line-printer/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Hello-world-Newbie b/Lang/EchoLisp/Hello-world-Newbie new file mode 120000 index 0000000000..b38acff562 --- /dev/null +++ b/Lang/EchoLisp/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Hello-world-Newline-omission b/Lang/EchoLisp/Hello-world-Newline-omission new file mode 120000 index 0000000000..f8035fa6b9 --- /dev/null +++ b/Lang/EchoLisp/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Hello-world-Text b/Lang/EchoLisp/Hello-world-Text new file mode 120000 index 0000000000..3c432d117c --- /dev/null +++ b/Lang/EchoLisp/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Heronian-triangles b/Lang/EchoLisp/Heronian-triangles new file mode 120000 index 0000000000..ede1f60cf6 --- /dev/null +++ b/Lang/EchoLisp/Heronian-triangles @@ -0,0 +1 @@ +../../Task/Heronian-triangles/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/History-variables b/Lang/EchoLisp/History-variables new file mode 120000 index 0000000000..ab28b4af55 --- /dev/null +++ b/Lang/EchoLisp/History-variables @@ -0,0 +1 @@ +../../Task/History-variables/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Hofstadter-Conway-$10,000-sequence b/Lang/EchoLisp/Hofstadter-Conway-$10,000-sequence new file mode 120000 index 0000000000..ac58c5f039 --- /dev/null +++ b/Lang/EchoLisp/Hofstadter-Conway-$10,000-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Conway-$10,000-sequence/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Hofstadter-Figure-Figure-sequences b/Lang/EchoLisp/Hofstadter-Figure-Figure-sequences new file mode 120000 index 0000000000..050f3e5529 --- /dev/null +++ b/Lang/EchoLisp/Hofstadter-Figure-Figure-sequences @@ -0,0 +1 @@ +../../Task/Hofstadter-Figure-Figure-sequences/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Hofstadter-Q-sequence b/Lang/EchoLisp/Hofstadter-Q-sequence new file mode 120000 index 0000000000..8edc7780c8 --- /dev/null +++ b/Lang/EchoLisp/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Horners-rule-for-polynomial-evaluation b/Lang/EchoLisp/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..4202e2b216 --- /dev/null +++ b/Lang/EchoLisp/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Increment-a-numerical-string b/Lang/EchoLisp/Increment-a-numerical-string new file mode 120000 index 0000000000..b5254b59c3 --- /dev/null +++ b/Lang/EchoLisp/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Integer-sequence b/Lang/EchoLisp/Integer-sequence new file mode 120000 index 0000000000..48a0f87459 --- /dev/null +++ b/Lang/EchoLisp/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Interactive-programming b/Lang/EchoLisp/Interactive-programming new file mode 120000 index 0000000000..f266072c3c --- /dev/null +++ b/Lang/EchoLisp/Interactive-programming @@ -0,0 +1 @@ +../../Task/Interactive-programming/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Introspection b/Lang/EchoLisp/Introspection new file mode 120000 index 0000000000..d0590ab9bb --- /dev/null +++ b/Lang/EchoLisp/Introspection @@ -0,0 +1 @@ +../../Task/Introspection/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Inverted-index b/Lang/EchoLisp/Inverted-index new file mode 120000 index 0000000000..9277ecc03e --- /dev/null +++ b/Lang/EchoLisp/Inverted-index @@ -0,0 +1 @@ +../../Task/Inverted-index/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Inverted-syntax b/Lang/EchoLisp/Inverted-syntax new file mode 120000 index 0000000000..0f283f786c --- /dev/null +++ b/Lang/EchoLisp/Inverted-syntax @@ -0,0 +1 @@ +../../Task/Inverted-syntax/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/JSON b/Lang/EchoLisp/JSON new file mode 120000 index 0000000000..52f3c80f7e --- /dev/null +++ b/Lang/EchoLisp/JSON @@ -0,0 +1 @@ +../../Task/JSON/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Josephus-problem b/Lang/EchoLisp/Josephus-problem new file mode 120000 index 0000000000..ff0d18da91 --- /dev/null +++ b/Lang/EchoLisp/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Keyboard-macros b/Lang/EchoLisp/Keyboard-macros new file mode 120000 index 0000000000..0003573343 --- /dev/null +++ b/Lang/EchoLisp/Keyboard-macros @@ -0,0 +1 @@ +../../Task/Keyboard-macros/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Knapsack-problem-0-1 b/Lang/EchoLisp/Knapsack-problem-0-1 new file mode 120000 index 0000000000..32d7b9544a --- /dev/null +++ b/Lang/EchoLisp/Knapsack-problem-0-1 @@ -0,0 +1 @@ +../../Task/Knapsack-problem-0-1/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Knapsack-problem-Bounded b/Lang/EchoLisp/Knapsack-problem-Bounded new file mode 120000 index 0000000000..7de3c3ecc6 --- /dev/null +++ b/Lang/EchoLisp/Knapsack-problem-Bounded @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Bounded/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Knapsack-problem-Continuous b/Lang/EchoLisp/Knapsack-problem-Continuous new file mode 120000 index 0000000000..35920c111d --- /dev/null +++ b/Lang/EchoLisp/Knapsack-problem-Continuous @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Continuous/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Knapsack-problem-Unbounded b/Lang/EchoLisp/Knapsack-problem-Unbounded new file mode 120000 index 0000000000..8501216d3b --- /dev/null +++ b/Lang/EchoLisp/Knapsack-problem-Unbounded @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Unbounded/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Knights-tour b/Lang/EchoLisp/Knights-tour new file mode 120000 index 0000000000..d1c5784b09 --- /dev/null +++ b/Lang/EchoLisp/Knights-tour @@ -0,0 +1 @@ +../../Task/Knights-tour/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Knuth-shuffle b/Lang/EchoLisp/Knuth-shuffle new file mode 120000 index 0000000000..0da381568a --- /dev/null +++ b/Lang/EchoLisp/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/LU-decomposition b/Lang/EchoLisp/LU-decomposition new file mode 120000 index 0000000000..b73c84ee4c --- /dev/null +++ b/Lang/EchoLisp/LU-decomposition @@ -0,0 +1 @@ +../../Task/LU-decomposition/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Langtons-ant b/Lang/EchoLisp/Langtons-ant new file mode 120000 index 0000000000..53412f8ecb --- /dev/null +++ b/Lang/EchoLisp/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Least-common-multiple b/Lang/EchoLisp/Least-common-multiple new file mode 120000 index 0000000000..b0a5762f04 --- /dev/null +++ b/Lang/EchoLisp/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Left-factorials b/Lang/EchoLisp/Left-factorials new file mode 120000 index 0000000000..fd0dc14de2 --- /dev/null +++ b/Lang/EchoLisp/Left-factorials @@ -0,0 +1 @@ +../../Task/Left-factorials/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Letter-frequency b/Lang/EchoLisp/Letter-frequency new file mode 120000 index 0000000000..282ef106fc --- /dev/null +++ b/Lang/EchoLisp/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Levenshtein-distance b/Lang/EchoLisp/Levenshtein-distance new file mode 120000 index 0000000000..139fd8cbce --- /dev/null +++ b/Lang/EchoLisp/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/List-comprehensions b/Lang/EchoLisp/List-comprehensions new file mode 120000 index 0000000000..2518d24d43 --- /dev/null +++ b/Lang/EchoLisp/List-comprehensions @@ -0,0 +1 @@ +../../Task/List-comprehensions/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Long-multiplication b/Lang/EchoLisp/Long-multiplication new file mode 120000 index 0000000000..cc56a5d60a --- /dev/null +++ b/Lang/EchoLisp/Long-multiplication @@ -0,0 +1 @@ +../../Task/Long-multiplication/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Look-and-say-sequence b/Lang/EchoLisp/Look-and-say-sequence new file mode 120000 index 0000000000..b89cd1c935 --- /dev/null +++ b/Lang/EchoLisp/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Loop-over-multiple-arrays-simultaneously b/Lang/EchoLisp/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..0368e958c6 --- /dev/null +++ b/Lang/EchoLisp/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Loops-Downward-for b/Lang/EchoLisp/Loops-Downward-for new file mode 120000 index 0000000000..e696deb9a7 --- /dev/null +++ b/Lang/EchoLisp/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Loops-For-with-a-specified-step b/Lang/EchoLisp/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..becf774b3b --- /dev/null +++ b/Lang/EchoLisp/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Loops-Foreach b/Lang/EchoLisp/Loops-Foreach new file mode 120000 index 0000000000..79d0757997 --- /dev/null +++ b/Lang/EchoLisp/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Loops-N-plus-one-half b/Lang/EchoLisp/Loops-N-plus-one-half new file mode 120000 index 0000000000..379288d95e --- /dev/null +++ b/Lang/EchoLisp/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Loops-Nested b/Lang/EchoLisp/Loops-Nested new file mode 120000 index 0000000000..256b4ba317 --- /dev/null +++ b/Lang/EchoLisp/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Loops-While b/Lang/EchoLisp/Loops-While new file mode 120000 index 0000000000..2b8f21146b --- /dev/null +++ b/Lang/EchoLisp/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Lucas-Lehmer-test b/Lang/EchoLisp/Lucas-Lehmer-test new file mode 120000 index 0000000000..4960a94ee2 --- /dev/null +++ b/Lang/EchoLisp/Lucas-Lehmer-test @@ -0,0 +1 @@ +../../Task/Lucas-Lehmer-test/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Luhn-test-of-credit-card-numbers b/Lang/EchoLisp/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..4262d224f5 --- /dev/null +++ b/Lang/EchoLisp/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Magic-squares-of-odd-order b/Lang/EchoLisp/Magic-squares-of-odd-order new file mode 120000 index 0000000000..9a691e028e --- /dev/null +++ b/Lang/EchoLisp/Magic-squares-of-odd-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-odd-order/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Man-or-boy-test b/Lang/EchoLisp/Man-or-boy-test new file mode 120000 index 0000000000..23b9fe03f4 --- /dev/null +++ b/Lang/EchoLisp/Man-or-boy-test @@ -0,0 +1 @@ +../../Task/Man-or-boy-test/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Mandelbrot-set b/Lang/EchoLisp/Mandelbrot-set new file mode 120000 index 0000000000..7a0427610b --- /dev/null +++ b/Lang/EchoLisp/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Map-range b/Lang/EchoLisp/Map-range new file mode 120000 index 0000000000..8a445b4d6e --- /dev/null +++ b/Lang/EchoLisp/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Matrix-arithmetic b/Lang/EchoLisp/Matrix-arithmetic new file mode 120000 index 0000000000..ab86f4a558 --- /dev/null +++ b/Lang/EchoLisp/Matrix-arithmetic @@ -0,0 +1 @@ +../../Task/Matrix-arithmetic/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Matrix-transposition b/Lang/EchoLisp/Matrix-transposition new file mode 120000 index 0000000000..bfd42fb70d --- /dev/null +++ b/Lang/EchoLisp/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Metered-concurrency b/Lang/EchoLisp/Metered-concurrency new file mode 120000 index 0000000000..2838fa96bf --- /dev/null +++ b/Lang/EchoLisp/Metered-concurrency @@ -0,0 +1 @@ +../../Task/Metered-concurrency/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Metronome b/Lang/EchoLisp/Metronome new file mode 120000 index 0000000000..1595fa662e --- /dev/null +++ b/Lang/EchoLisp/Metronome @@ -0,0 +1 @@ +../../Task/Metronome/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Modular-exponentiation b/Lang/EchoLisp/Modular-exponentiation new file mode 120000 index 0000000000..52aac3075c --- /dev/null +++ b/Lang/EchoLisp/Modular-exponentiation @@ -0,0 +1 @@ +../../Task/Modular-exponentiation/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Modular-inverse b/Lang/EchoLisp/Modular-inverse new file mode 120000 index 0000000000..5a1269223b --- /dev/null +++ b/Lang/EchoLisp/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Morse-code b/Lang/EchoLisp/Morse-code new file mode 120000 index 0000000000..247e5c9d7b --- /dev/null +++ b/Lang/EchoLisp/Morse-code @@ -0,0 +1 @@ +../../Task/Morse-code/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Mouse-position b/Lang/EchoLisp/Mouse-position new file mode 120000 index 0000000000..5107f7dcd2 --- /dev/null +++ b/Lang/EchoLisp/Mouse-position @@ -0,0 +1 @@ +../../Task/Mouse-position/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Multiple-distinct-objects b/Lang/EchoLisp/Multiple-distinct-objects new file mode 120000 index 0000000000..dee8114ad4 --- /dev/null +++ b/Lang/EchoLisp/Multiple-distinct-objects @@ -0,0 +1 @@ +../../Task/Multiple-distinct-objects/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Multiplication-tables b/Lang/EchoLisp/Multiplication-tables new file mode 120000 index 0000000000..111a0e0b70 --- /dev/null +++ b/Lang/EchoLisp/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Multiplicative-order b/Lang/EchoLisp/Multiplicative-order new file mode 120000 index 0000000000..d9eec6223a --- /dev/null +++ b/Lang/EchoLisp/Multiplicative-order @@ -0,0 +1 @@ +../../Task/Multiplicative-order/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Munching-squares b/Lang/EchoLisp/Munching-squares new file mode 120000 index 0000000000..4984aad18d --- /dev/null +++ b/Lang/EchoLisp/Munching-squares @@ -0,0 +1 @@ +../../Task/Munching-squares/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/N-queens-problem b/Lang/EchoLisp/N-queens-problem new file mode 120000 index 0000000000..c3f5c38166 --- /dev/null +++ b/Lang/EchoLisp/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Null-object b/Lang/EchoLisp/Null-object new file mode 120000 index 0000000000..15587fb58a --- /dev/null +++ b/Lang/EchoLisp/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Object-serialization b/Lang/EchoLisp/Object-serialization new file mode 120000 index 0000000000..e80f52f78b --- /dev/null +++ b/Lang/EchoLisp/Object-serialization @@ -0,0 +1 @@ +../../Task/Object-serialization/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Odd-word-problem b/Lang/EchoLisp/Odd-word-problem new file mode 120000 index 0000000000..e7e59d82f4 --- /dev/null +++ b/Lang/EchoLisp/Odd-word-problem @@ -0,0 +1 @@ +../../Task/Odd-word-problem/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Order-disjoint-list-items b/Lang/EchoLisp/Order-disjoint-list-items new file mode 120000 index 0000000000..9747f4b9f6 --- /dev/null +++ b/Lang/EchoLisp/Order-disjoint-list-items @@ -0,0 +1 @@ +../../Task/Order-disjoint-list-items/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Ordered-Partitions b/Lang/EchoLisp/Ordered-Partitions new file mode 120000 index 0000000000..f0a008dbfd --- /dev/null +++ b/Lang/EchoLisp/Ordered-Partitions @@ -0,0 +1 @@ +../../Task/Ordered-Partitions/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Ordered-words b/Lang/EchoLisp/Ordered-words new file mode 120000 index 0000000000..2543405326 --- /dev/null +++ b/Lang/EchoLisp/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Palindrome-detection b/Lang/EchoLisp/Palindrome-detection new file mode 120000 index 0000000000..e4b90317e5 --- /dev/null +++ b/Lang/EchoLisp/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Parsing-RPN-calculator-algorithm b/Lang/EchoLisp/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..244d19cf8f --- /dev/null +++ b/Lang/EchoLisp/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Parsing-RPN-to-infix-conversion b/Lang/EchoLisp/Parsing-RPN-to-infix-conversion new file mode 120000 index 0000000000..84aa01cadf --- /dev/null +++ b/Lang/EchoLisp/Parsing-RPN-to-infix-conversion @@ -0,0 +1 @@ +../../Task/Parsing-RPN-to-infix-conversion/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Parsing-Shunting-yard-algorithm b/Lang/EchoLisp/Parsing-Shunting-yard-algorithm new file mode 120000 index 0000000000..aa539f8ed6 --- /dev/null +++ b/Lang/EchoLisp/Parsing-Shunting-yard-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-Shunting-yard-algorithm/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Pattern-matching b/Lang/EchoLisp/Pattern-matching new file mode 120000 index 0000000000..76d86150c8 --- /dev/null +++ b/Lang/EchoLisp/Pattern-matching @@ -0,0 +1 @@ +../../Task/Pattern-matching/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Percolation-Mean-cluster-density b/Lang/EchoLisp/Percolation-Mean-cluster-density new file mode 120000 index 0000000000..0da3ffa685 --- /dev/null +++ b/Lang/EchoLisp/Percolation-Mean-cluster-density @@ -0,0 +1 @@ +../../Task/Percolation-Mean-cluster-density/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Percolation-Mean-run-density b/Lang/EchoLisp/Percolation-Mean-run-density new file mode 120000 index 0000000000..0cfa4ffc31 --- /dev/null +++ b/Lang/EchoLisp/Percolation-Mean-run-density @@ -0,0 +1 @@ +../../Task/Percolation-Mean-run-density/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Permutations-Derangements b/Lang/EchoLisp/Permutations-Derangements new file mode 120000 index 0000000000..cdae55c685 --- /dev/null +++ b/Lang/EchoLisp/Permutations-Derangements @@ -0,0 +1 @@ +../../Task/Permutations-Derangements/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Permutations-by-swapping b/Lang/EchoLisp/Permutations-by-swapping new file mode 120000 index 0000000000..0e5677eace --- /dev/null +++ b/Lang/EchoLisp/Permutations-by-swapping @@ -0,0 +1 @@ +../../Task/Permutations-by-swapping/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Pernicious-numbers b/Lang/EchoLisp/Pernicious-numbers new file mode 120000 index 0000000000..91c2bd88b4 --- /dev/null +++ b/Lang/EchoLisp/Pernicious-numbers @@ -0,0 +1 @@ +../../Task/Pernicious-numbers/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Phrase-reversals b/Lang/EchoLisp/Phrase-reversals new file mode 120000 index 0000000000..5b1f420c2b --- /dev/null +++ b/Lang/EchoLisp/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Pick-random-element b/Lang/EchoLisp/Pick-random-element new file mode 120000 index 0000000000..850dc61a51 --- /dev/null +++ b/Lang/EchoLisp/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Plot-coordinate-pairs b/Lang/EchoLisp/Plot-coordinate-pairs new file mode 120000 index 0000000000..53fdac0295 --- /dev/null +++ b/Lang/EchoLisp/Plot-coordinate-pairs @@ -0,0 +1 @@ +../../Task/Plot-coordinate-pairs/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Pointers-and-references b/Lang/EchoLisp/Pointers-and-references new file mode 120000 index 0000000000..5015ad4558 --- /dev/null +++ b/Lang/EchoLisp/Pointers-and-references @@ -0,0 +1 @@ +../../Task/Pointers-and-references/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Polymorphic-copy b/Lang/EchoLisp/Polymorphic-copy new file mode 120000 index 0000000000..5e4b2753fb --- /dev/null +++ b/Lang/EchoLisp/Polymorphic-copy @@ -0,0 +1 @@ +../../Task/Polymorphic-copy/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Polymorphism b/Lang/EchoLisp/Polymorphism new file mode 120000 index 0000000000..049e695c04 --- /dev/null +++ b/Lang/EchoLisp/Polymorphism @@ -0,0 +1 @@ +../../Task/Polymorphism/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Power-set b/Lang/EchoLisp/Power-set new file mode 120000 index 0000000000..0de594ffe2 --- /dev/null +++ b/Lang/EchoLisp/Power-set @@ -0,0 +1 @@ +../../Task/Power-set/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Primality-by-trial-division b/Lang/EchoLisp/Primality-by-trial-division new file mode 120000 index 0000000000..811884be9e --- /dev/null +++ b/Lang/EchoLisp/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Prime-decomposition b/Lang/EchoLisp/Prime-decomposition new file mode 120000 index 0000000000..bfb73c7c2c --- /dev/null +++ b/Lang/EchoLisp/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Priority-queue b/Lang/EchoLisp/Priority-queue new file mode 120000 index 0000000000..364da16b5a --- /dev/null +++ b/Lang/EchoLisp/Priority-queue @@ -0,0 +1 @@ +../../Task/Priority-queue/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Program-name b/Lang/EchoLisp/Program-name new file mode 120000 index 0000000000..ae27eac223 --- /dev/null +++ b/Lang/EchoLisp/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Queue-Definition b/Lang/EchoLisp/Queue-Definition new file mode 120000 index 0000000000..ae214fa6e7 --- /dev/null +++ b/Lang/EchoLisp/Queue-Definition @@ -0,0 +1 @@ +../../Task/Queue-Definition/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/README b/Lang/EchoLisp/README new file mode 100644 index 0000000000..3e5f48be06 --- /dev/null +++ b/Lang/EchoLisp/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:EchoLisp diff --git a/Lang/EchoLisp/Random-number-generator--device- b/Lang/EchoLisp/Random-number-generator--device- new file mode 120000 index 0000000000..ec25a16c46 --- /dev/null +++ b/Lang/EchoLisp/Random-number-generator--device- @@ -0,0 +1 @@ +../../Task/Random-number-generator--device-/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Random-number-generator--included- b/Lang/EchoLisp/Random-number-generator--included- new file mode 120000 index 0000000000..c530734add --- /dev/null +++ b/Lang/EchoLisp/Random-number-generator--included- @@ -0,0 +1 @@ +../../Task/Random-number-generator--included-/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Range-expansion b/Lang/EchoLisp/Range-expansion new file mode 120000 index 0000000000..606e9d5868 --- /dev/null +++ b/Lang/EchoLisp/Range-expansion @@ -0,0 +1 @@ +../../Task/Range-expansion/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Range-extraction b/Lang/EchoLisp/Range-extraction new file mode 120000 index 0000000000..ae2a996bf5 --- /dev/null +++ b/Lang/EchoLisp/Range-extraction @@ -0,0 +1 @@ +../../Task/Range-extraction/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Read-a-configuration-file b/Lang/EchoLisp/Read-a-configuration-file new file mode 120000 index 0000000000..45a08d50c2 --- /dev/null +++ b/Lang/EchoLisp/Read-a-configuration-file @@ -0,0 +1 @@ +../../Task/Read-a-configuration-file/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Rep-string b/Lang/EchoLisp/Rep-string new file mode 120000 index 0000000000..b48807af51 --- /dev/null +++ b/Lang/EchoLisp/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Return-multiple-values b/Lang/EchoLisp/Return-multiple-values new file mode 120000 index 0000000000..386315806e --- /dev/null +++ b/Lang/EchoLisp/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Reverse-a-string b/Lang/EchoLisp/Reverse-a-string new file mode 120000 index 0000000000..43faa5b8d2 --- /dev/null +++ b/Lang/EchoLisp/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Reverse-words-in-a-string b/Lang/EchoLisp/Reverse-words-in-a-string new file mode 120000 index 0000000000..35e6a15965 --- /dev/null +++ b/Lang/EchoLisp/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Roots-of-a-function b/Lang/EchoLisp/Roots-of-a-function new file mode 120000 index 0000000000..020932c595 --- /dev/null +++ b/Lang/EchoLisp/Roots-of-a-function @@ -0,0 +1 @@ +../../Task/Roots-of-a-function/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Roots-of-unity b/Lang/EchoLisp/Roots-of-unity new file mode 120000 index 0000000000..9a5004cc6e --- /dev/null +++ b/Lang/EchoLisp/Roots-of-unity @@ -0,0 +1 @@ +../../Task/Roots-of-unity/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Runtime-evaluation b/Lang/EchoLisp/Runtime-evaluation new file mode 120000 index 0000000000..cc3843dd4b --- /dev/null +++ b/Lang/EchoLisp/Runtime-evaluation @@ -0,0 +1 @@ +../../Task/Runtime-evaluation/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Runtime-evaluation-In-an-environment b/Lang/EchoLisp/Runtime-evaluation-In-an-environment new file mode 120000 index 0000000000..09c477c2ff --- /dev/null +++ b/Lang/EchoLisp/Runtime-evaluation-In-an-environment @@ -0,0 +1 @@ +../../Task/Runtime-evaluation-In-an-environment/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/S-Expressions b/Lang/EchoLisp/S-Expressions new file mode 120000 index 0000000000..5510d4b5f3 --- /dev/null +++ b/Lang/EchoLisp/S-Expressions @@ -0,0 +1 @@ +../../Task/S-Expressions/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Self-referential-sequence b/Lang/EchoLisp/Self-referential-sequence new file mode 120000 index 0000000000..6f907ecc72 --- /dev/null +++ b/Lang/EchoLisp/Self-referential-sequence @@ -0,0 +1 @@ +../../Task/Self-referential-sequence/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Semiprime b/Lang/EchoLisp/Semiprime new file mode 120000 index 0000000000..547a1c25b5 --- /dev/null +++ b/Lang/EchoLisp/Semiprime @@ -0,0 +1 @@ +../../Task/Semiprime/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Semordnilap b/Lang/EchoLisp/Semordnilap new file mode 120000 index 0000000000..ad7d92e490 --- /dev/null +++ b/Lang/EchoLisp/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Sequence-of-non-squares b/Lang/EchoLisp/Sequence-of-non-squares new file mode 120000 index 0000000000..efe3dbb524 --- /dev/null +++ b/Lang/EchoLisp/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Sequence-of-primes-by-Trial-Division b/Lang/EchoLisp/Sequence-of-primes-by-Trial-Division new file mode 120000 index 0000000000..687a516813 --- /dev/null +++ b/Lang/EchoLisp/Sequence-of-primes-by-Trial-Division @@ -0,0 +1 @@ +../../Task/Sequence-of-primes-by-Trial-Division/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Set b/Lang/EchoLisp/Set new file mode 120000 index 0000000000..d9c76c9784 --- /dev/null +++ b/Lang/EchoLisp/Set @@ -0,0 +1 @@ +../../Task/Set/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Set-consolidation b/Lang/EchoLisp/Set-consolidation new file mode 120000 index 0000000000..8b0185802e --- /dev/null +++ b/Lang/EchoLisp/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Set-of-real-numbers b/Lang/EchoLisp/Set-of-real-numbers new file mode 120000 index 0000000000..03c7b8b76f --- /dev/null +++ b/Lang/EchoLisp/Set-of-real-numbers @@ -0,0 +1 @@ +../../Task/Set-of-real-numbers/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Set-puzzle b/Lang/EchoLisp/Set-puzzle new file mode 120000 index 0000000000..9bcfde864b --- /dev/null +++ b/Lang/EchoLisp/Set-puzzle @@ -0,0 +1 @@ +../../Task/Set-puzzle/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Sieve-of-Eratosthenes b/Lang/EchoLisp/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..d9449449a9 --- /dev/null +++ b/Lang/EchoLisp/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Simple-windowed-application b/Lang/EchoLisp/Simple-windowed-application new file mode 120000 index 0000000000..3e97616779 --- /dev/null +++ b/Lang/EchoLisp/Simple-windowed-application @@ -0,0 +1 @@ +../../Task/Simple-windowed-application/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Singly-linked-list-Element-insertion b/Lang/EchoLisp/Singly-linked-list-Element-insertion new file mode 120000 index 0000000000..f86e267137 --- /dev/null +++ b/Lang/EchoLisp/Singly-linked-list-Element-insertion @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-insertion/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Singly-linked-list-Traversal b/Lang/EchoLisp/Singly-linked-list-Traversal new file mode 120000 index 0000000000..559c84fa66 --- /dev/null +++ b/Lang/EchoLisp/Singly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Traversal/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Sort-an-array-of-composite-structures b/Lang/EchoLisp/Sort-an-array-of-composite-structures new file mode 120000 index 0000000000..68cf20858c --- /dev/null +++ b/Lang/EchoLisp/Sort-an-array-of-composite-structures @@ -0,0 +1 @@ +../../Task/Sort-an-array-of-composite-structures/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Sort-disjoint-sublist b/Lang/EchoLisp/Sort-disjoint-sublist new file mode 120000 index 0000000000..3718a71ec2 --- /dev/null +++ b/Lang/EchoLisp/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Sorting-algorithms-Bubble-sort b/Lang/EchoLisp/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..5b7d327ae2 --- /dev/null +++ b/Lang/EchoLisp/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Sorting-algorithms-Heapsort b/Lang/EchoLisp/Sorting-algorithms-Heapsort new file mode 120000 index 0000000000..a955b7a1bd --- /dev/null +++ b/Lang/EchoLisp/Sorting-algorithms-Heapsort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Heapsort/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Sorting-algorithms-Permutation-sort b/Lang/EchoLisp/Sorting-algorithms-Permutation-sort new file mode 120000 index 0000000000..2009c0588a --- /dev/null +++ b/Lang/EchoLisp/Sorting-algorithms-Permutation-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Permutation-sort/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Sorting-algorithms-Quicksort b/Lang/EchoLisp/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..746100bbff --- /dev/null +++ b/Lang/EchoLisp/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Sorting-algorithms-Selection-sort b/Lang/EchoLisp/Sorting-algorithms-Selection-sort new file mode 120000 index 0000000000..1178f7128a --- /dev/null +++ b/Lang/EchoLisp/Sorting-algorithms-Selection-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Selection-sort/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Stable-marriage-problem b/Lang/EchoLisp/Stable-marriage-problem new file mode 120000 index 0000000000..065402023d --- /dev/null +++ b/Lang/EchoLisp/Stable-marriage-problem @@ -0,0 +1 @@ +../../Task/Stable-marriage-problem/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Stack b/Lang/EchoLisp/Stack new file mode 120000 index 0000000000..08e6feb840 --- /dev/null +++ b/Lang/EchoLisp/Stack @@ -0,0 +1 @@ +../../Task/Stack/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Stair-climbing-puzzle b/Lang/EchoLisp/Stair-climbing-puzzle new file mode 120000 index 0000000000..f97bab81a0 --- /dev/null +++ b/Lang/EchoLisp/Stair-climbing-puzzle @@ -0,0 +1 @@ +../../Task/Stair-climbing-puzzle/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Stern-Brocot-sequence b/Lang/EchoLisp/Stern-Brocot-sequence new file mode 120000 index 0000000000..d546b9622c --- /dev/null +++ b/Lang/EchoLisp/Stern-Brocot-sequence @@ -0,0 +1 @@ +../../Task/Stern-Brocot-sequence/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/String-append b/Lang/EchoLisp/String-append new file mode 120000 index 0000000000..3cbccfb052 --- /dev/null +++ b/Lang/EchoLisp/String-append @@ -0,0 +1 @@ +../../Task/String-append/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/String-case b/Lang/EchoLisp/String-case new file mode 120000 index 0000000000..cc6828b44b --- /dev/null +++ b/Lang/EchoLisp/String-case @@ -0,0 +1 @@ +../../Task/String-case/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/String-interpolation--included- b/Lang/EchoLisp/String-interpolation--included- new file mode 120000 index 0000000000..442c5ddb6e --- /dev/null +++ b/Lang/EchoLisp/String-interpolation--included- @@ -0,0 +1 @@ +../../Task/String-interpolation--included-/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/String-matching b/Lang/EchoLisp/String-matching new file mode 120000 index 0000000000..f076541af7 --- /dev/null +++ b/Lang/EchoLisp/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/String-prepend b/Lang/EchoLisp/String-prepend new file mode 120000 index 0000000000..269af0c35e --- /dev/null +++ b/Lang/EchoLisp/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Strip-a-set-of-characters-from-a-string b/Lang/EchoLisp/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..cf4bd81f5d --- /dev/null +++ b/Lang/EchoLisp/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Strip-whitespace-from-a-string-Top-and-tail b/Lang/EchoLisp/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..2fe065a2a7 --- /dev/null +++ b/Lang/EchoLisp/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Sum-multiples-of-3-and-5 b/Lang/EchoLisp/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..02ee9041f1 --- /dev/null +++ b/Lang/EchoLisp/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Sum-of-a-series b/Lang/EchoLisp/Sum-of-a-series new file mode 120000 index 0000000000..a9bf975b27 --- /dev/null +++ b/Lang/EchoLisp/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Synchronous-concurrency b/Lang/EchoLisp/Synchronous-concurrency new file mode 120000 index 0000000000..c726d69ad6 --- /dev/null +++ b/Lang/EchoLisp/Synchronous-concurrency @@ -0,0 +1 @@ +../../Task/Synchronous-concurrency/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Table-creation-Postal-addresses b/Lang/EchoLisp/Table-creation-Postal-addresses new file mode 120000 index 0000000000..cca8a1b47b --- /dev/null +++ b/Lang/EchoLisp/Table-creation-Postal-addresses @@ -0,0 +1 @@ +../../Task/Table-creation-Postal-addresses/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Terminal-control-Display-an-extended-character b/Lang/EchoLisp/Terminal-control-Display-an-extended-character new file mode 120000 index 0000000000..87de8598d1 --- /dev/null +++ b/Lang/EchoLisp/Terminal-control-Display-an-extended-character @@ -0,0 +1 @@ +../../Task/Terminal-control-Display-an-extended-character/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Test-a-function b/Lang/EchoLisp/Test-a-function new file mode 120000 index 0000000000..431d00a50d --- /dev/null +++ b/Lang/EchoLisp/Test-a-function @@ -0,0 +1 @@ +../../Task/Test-a-function/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Top-rank-per-group b/Lang/EchoLisp/Top-rank-per-group new file mode 120000 index 0000000000..7d8c469bb0 --- /dev/null +++ b/Lang/EchoLisp/Top-rank-per-group @@ -0,0 +1 @@ +../../Task/Top-rank-per-group/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Topological-sort b/Lang/EchoLisp/Topological-sort new file mode 120000 index 0000000000..543d92f960 --- /dev/null +++ b/Lang/EchoLisp/Topological-sort @@ -0,0 +1 @@ +../../Task/Topological-sort/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Total-circles-area b/Lang/EchoLisp/Total-circles-area new file mode 120000 index 0000000000..fe8c51bb9a --- /dev/null +++ b/Lang/EchoLisp/Total-circles-area @@ -0,0 +1 @@ +../../Task/Total-circles-area/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Trabb-Pardo-Knuth-algorithm b/Lang/EchoLisp/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..69a3a416b9 --- /dev/null +++ b/Lang/EchoLisp/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Truncatable-primes b/Lang/EchoLisp/Truncatable-primes new file mode 120000 index 0000000000..2323437fdd --- /dev/null +++ b/Lang/EchoLisp/Truncatable-primes @@ -0,0 +1 @@ +../../Task/Truncatable-primes/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Ulam-spiral--for-primes- b/Lang/EchoLisp/Ulam-spiral--for-primes- new file mode 120000 index 0000000000..5c1c6b2445 --- /dev/null +++ b/Lang/EchoLisp/Ulam-spiral--for-primes- @@ -0,0 +1 @@ +../../Task/Ulam-spiral--for-primes-/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Unicode-variable-names b/Lang/EchoLisp/Unicode-variable-names new file mode 120000 index 0000000000..7a641a6389 --- /dev/null +++ b/Lang/EchoLisp/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Universal-Turing-machine b/Lang/EchoLisp/Universal-Turing-machine new file mode 120000 index 0000000000..612ca8f77f --- /dev/null +++ b/Lang/EchoLisp/Universal-Turing-machine @@ -0,0 +1 @@ +../../Task/Universal-Turing-machine/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Unix-ls b/Lang/EchoLisp/Unix-ls new file mode 120000 index 0000000000..b18e815a12 --- /dev/null +++ b/Lang/EchoLisp/Unix-ls @@ -0,0 +1 @@ +../../Task/Unix-ls/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Vector-products b/Lang/EchoLisp/Vector-products new file mode 120000 index 0000000000..a419b4bc5e --- /dev/null +++ b/Lang/EchoLisp/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Y-combinator b/Lang/EchoLisp/Y-combinator new file mode 120000 index 0000000000..c6568a78b3 --- /dev/null +++ b/Lang/EchoLisp/Y-combinator @@ -0,0 +1 @@ +../../Task/Y-combinator/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Zebra-puzzle b/Lang/EchoLisp/Zebra-puzzle new file mode 120000 index 0000000000..63497bbdef --- /dev/null +++ b/Lang/EchoLisp/Zebra-puzzle @@ -0,0 +1 @@ +../../Task/Zebra-puzzle/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Zeckendorf-number-representation b/Lang/EchoLisp/Zeckendorf-number-representation new file mode 120000 index 0000000000..86f0c2b26d --- /dev/null +++ b/Lang/EchoLisp/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/EchoLisp \ No newline at end of file diff --git a/Lang/EchoLisp/Zero-to-the-zero-power b/Lang/EchoLisp/Zero-to-the-zero-power new file mode 120000 index 0000000000..ad027c7307 --- /dev/null +++ b/Lang/EchoLisp/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/EchoLisp \ No newline at end of file diff --git a/Lang/Eero/00DESCRIPTION b/Lang/Eero/00DESCRIPTION new file mode 100644 index 0000000000..feb5c0fc6b --- /dev/null +++ b/Lang/Eero/00DESCRIPTION @@ -0,0 +1,16 @@ +{{language|Eero +|exec=machine +|strength=strong/weak +|express=explicit +|checking=static +|parampass=value +|gc=allowed +|site=http://eerolanguage.org/ +|LCT=yes}}{{language programming paradigm|Object-oriented}} +'''Eero''' is an [[object-oriented]] dialect of the [[derived from::compatible with::Objective-C]] language. + +It is fully header- and binary-compatible with standard Objective-C, and is implemented with a modified version of the Apple-sponsored LLVM/clang open-source compiler. + +It features a streamlined syntax, Python-like indentation, universal dot notation, local type inference, limited operator overloading, and other features to improve readability and code safety. It was inspired by languages such as Smalltalk, Python, and Ruby. + +
\ No newline at end of file diff --git a/Lang/Eero/100-doors b/Lang/Eero/100-doors new file mode 120000 index 0000000000..f30586f003 --- /dev/null +++ b/Lang/Eero/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Eero \ No newline at end of file diff --git a/Lang/Eero/Currying b/Lang/Eero/Currying new file mode 120000 index 0000000000..b8b81f3367 --- /dev/null +++ b/Lang/Eero/Currying @@ -0,0 +1 @@ +../../Task/Currying/Eero \ No newline at end of file diff --git a/Lang/Eero/FizzBuzz b/Lang/Eero/FizzBuzz new file mode 120000 index 0000000000..982ad1ecd5 --- /dev/null +++ b/Lang/Eero/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Eero \ No newline at end of file diff --git a/Lang/Eero/Increment-a-numerical-string b/Lang/Eero/Increment-a-numerical-string new file mode 120000 index 0000000000..4b8920b260 --- /dev/null +++ b/Lang/Eero/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Eero \ No newline at end of file diff --git a/Lang/Eero/Quaternion-type b/Lang/Eero/Quaternion-type new file mode 120000 index 0000000000..91a82e433f --- /dev/null +++ b/Lang/Eero/Quaternion-type @@ -0,0 +1 @@ +../../Task/Quaternion-type/Eero \ No newline at end of file diff --git a/Lang/Eero/README b/Lang/Eero/README new file mode 100644 index 0000000000..7a2fb12169 --- /dev/null +++ b/Lang/Eero/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Eero diff --git a/Lang/Eero/Sorting-algorithms-Quicksort b/Lang/Eero/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..aa14b294cb --- /dev/null +++ b/Lang/Eero/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Eero \ No newline at end of file diff --git a/Lang/Eero/Substring b/Lang/Eero/Substring new file mode 120000 index 0000000000..19d29f1ef8 --- /dev/null +++ b/Lang/Eero/Substring @@ -0,0 +1 @@ +../../Task/Substring/Eero \ No newline at end of file diff --git a/Lang/Eero/Substring-Top-and-tail b/Lang/Eero/Substring-Top-and-tail new file mode 120000 index 0000000000..5db53418fa --- /dev/null +++ b/Lang/Eero/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/Eero \ No newline at end of file diff --git a/Lang/Eero/Y-combinator b/Lang/Eero/Y-combinator new file mode 120000 index 0000000000..b8fd81b59d --- /dev/null +++ b/Lang/Eero/Y-combinator @@ -0,0 +1 @@ +../../Task/Y-combinator/Eero \ No newline at end of file diff --git a/Lang/Egison/00DESCRIPTION b/Lang/Egison/00DESCRIPTION new file mode 100644 index 0000000000..27323d651f --- /dev/null +++ b/Lang/Egison/00DESCRIPTION @@ -0,0 +1,141 @@ +{{language|Egison +|strength=strong +|safety=safe +|checking=dynamic +|gc=yes +|LCT=yes +|site=http://www.egison.org}} +{{language programming paradigm|Pattern-matching oriented}} +{{language programming paradigm|functional}} +{{implementation|Lisp}} + +'''Egison''' is a programming language that realizes non-linear pattern-matching against unfree data types. +We can directly represent pattern-matching against a wide range of data types such as lists, multisets, sets, trees and graphs. +Egison makes programming dramatically simple! + += Pattern Matching Oriented = + +Egison proposes a new paradigm pattern-matching-oriented. The combination of all of the following features enables intuitive powerful pattern-matching. + +* Non-linear patterns +* Pattern-matching with multiple results +* Modularization of the way of pattern-matching +* Pattern-matching with lexical scoping + += Poker Hands Demonstration = + + +;;; +;;; +;;; Poker-hands demonstration +;;; +;;; + +;; +;; Matcher definitions +;; +(define $suit + (algebraic-data-matcher + { })) + +(define $card + (algebraic-data-matcher + {})) + +;; +;; A function that determins poker-hands +;; +(define $poker-hands + (lambda [$cs] + (match cs (multiset card) + {[ + + + + + >>>>> + ] + [ + + + + >>>>> + ] + [ + + + + + >>>>> + ] + [ + + + + + >>>>> + ] + [ + + + + + >>>>> + ] + [ + + + >>>>> + ] + [ + + + + >>>>> + ] + [ + + >>>>> + ] + [>>>>> + ]}))) + +;; +;; Demonstration code +;; +(poker-hands { 12> + 10> + 13> + 1> + 11>});=> + +(poker-hands { 1> + 2> + 1> + 1> + 2>});=> + +(poker-hands { 4> + 2> + 5> + 1> + 3>});=> + +(poker-hands { 4> + 10> + 5> + 1> + 3>});=> + \ No newline at end of file diff --git a/Lang/Egison/Amb b/Lang/Egison/Amb new file mode 120000 index 0000000000..23f741d925 --- /dev/null +++ b/Lang/Egison/Amb @@ -0,0 +1 @@ +../../Task/Amb/Egison \ No newline at end of file diff --git a/Lang/Egison/Combinations b/Lang/Egison/Combinations new file mode 120000 index 0000000000..ff833547ae --- /dev/null +++ b/Lang/Egison/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/Egison \ No newline at end of file diff --git a/Lang/Egison/Combinations-with-repetitions b/Lang/Egison/Combinations-with-repetitions new file mode 120000 index 0000000000..3343f088e1 --- /dev/null +++ b/Lang/Egison/Combinations-with-repetitions @@ -0,0 +1 @@ +../../Task/Combinations-with-repetitions/Egison \ No newline at end of file diff --git a/Lang/Egison/Hello-world-Text b/Lang/Egison/Hello-world-Text new file mode 120000 index 0000000000..71daa248a4 --- /dev/null +++ b/Lang/Egison/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Egison \ No newline at end of file diff --git a/Lang/Egison/Longest-common-subsequence b/Lang/Egison/Longest-common-subsequence new file mode 120000 index 0000000000..d760354ab9 --- /dev/null +++ b/Lang/Egison/Longest-common-subsequence @@ -0,0 +1 @@ +../../Task/Longest-common-subsequence/Egison \ No newline at end of file diff --git a/Lang/Egison/Partial-function-application b/Lang/Egison/Partial-function-application new file mode 120000 index 0000000000..95cae3844c --- /dev/null +++ b/Lang/Egison/Partial-function-application @@ -0,0 +1 @@ +../../Task/Partial-function-application/Egison \ No newline at end of file diff --git a/Lang/Egison/README b/Lang/Egison/README new file mode 100644 index 0000000000..6f7564fdc1 --- /dev/null +++ b/Lang/Egison/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Egison diff --git a/Lang/Egison/Repeat-a-string b/Lang/Egison/Repeat-a-string new file mode 120000 index 0000000000..8cd074ac0b --- /dev/null +++ b/Lang/Egison/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Egison \ No newline at end of file diff --git a/Lang/Egison/Set-consolidation b/Lang/Egison/Set-consolidation new file mode 120000 index 0000000000..1680fa5b57 --- /dev/null +++ b/Lang/Egison/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/Egison \ No newline at end of file diff --git a/Lang/EhBASIC/00DESCRIPTION b/Lang/EhBASIC/00DESCRIPTION new file mode 100644 index 0000000000..a8288dc4a3 --- /dev/null +++ b/Lang/EhBASIC/00DESCRIPTION @@ -0,0 +1,6 @@ +{{stub}}{{language}} + +ehBASIC is a BASIC variant designed for the 6502. It is supposedly extremely portable and has a very clean simple syntax. You can find the source at +http://mycorner.no-ip.org/6502/ehbasic/index.html + +The author is Lee Davison. More info can be found at the 6502.org forums \ No newline at end of file diff --git a/Lang/EhBASIC/README b/Lang/EhBASIC/README new file mode 100644 index 0000000000..ad3363598e --- /dev/null +++ b/Lang/EhBASIC/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:EhBASIC diff --git a/Lang/Elm/00DESCRIPTION b/Lang/Elm/00DESCRIPTION new file mode 100644 index 0000000000..7cc7e43bbd --- /dev/null +++ b/Lang/Elm/00DESCRIPTION @@ -0,0 +1,17 @@ +{{language|Elm +|tags = elm +|checking = static +|safety = safe +|strength = strong +|site = http://elm-lang.org/ +|LCT = yes +}} + +'''Elm''' is a programming language for developping browser-based applications and graphical user interfaces that strictly adheres to the functional paradigm. This means that Elm does not rely on mutability or destructive updates. + +In order to run web applications, Elm compiles to Javascript, HTML, and CSS. The Functional model-view-update architecture is used in lieu of event handlers and callbacks. For right markup, Elm allows to embed Markdown directly in the language. + +Elm's syntax closely resembles that of Haskell while influenced by OCaml, FSharp, and Javascript. Unlike Haskell, Elm's "has type" operator is written with a single colon and borrows the application operators (<|) and (|>) from FSharp. From Javascript, Elm borrows the idea of JSON-like objects which it turns into records. These are type-safe objects whose fields are accessible with a (.) operator. This means that records in Elm have the flexibility of Javascript objects minus their unpredictable dynamism. + +{{language programming paradigm|Functional}} +{{language programming paradigm|Declarative}} \ No newline at end of file diff --git a/Lang/Elm/Animate-a-pendulum b/Lang/Elm/Animate-a-pendulum new file mode 120000 index 0000000000..74a4a8e0d7 --- /dev/null +++ b/Lang/Elm/Animate-a-pendulum @@ -0,0 +1 @@ +../../Task/Animate-a-pendulum/Elm \ No newline at end of file diff --git a/Lang/Elm/Array-concatenation b/Lang/Elm/Array-concatenation new file mode 120000 index 0000000000..7ce6effb49 --- /dev/null +++ b/Lang/Elm/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Elm \ No newline at end of file diff --git a/Lang/Elm/Comments b/Lang/Elm/Comments new file mode 120000 index 0000000000..2fbf7f7cfc --- /dev/null +++ b/Lang/Elm/Comments @@ -0,0 +1 @@ +../../Task/Comments/Elm \ No newline at end of file diff --git a/Lang/Elm/Dragon-curve b/Lang/Elm/Dragon-curve new file mode 120000 index 0000000000..0272c58962 --- /dev/null +++ b/Lang/Elm/Dragon-curve @@ -0,0 +1 @@ +../../Task/Dragon-curve/Elm \ No newline at end of file diff --git a/Lang/Elm/Factorial b/Lang/Elm/Factorial new file mode 120000 index 0000000000..f0c592a94a --- /dev/null +++ b/Lang/Elm/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Elm \ No newline at end of file diff --git a/Lang/Elm/Fibonacci-sequence b/Lang/Elm/Fibonacci-sequence new file mode 120000 index 0000000000..0a54e5735d --- /dev/null +++ b/Lang/Elm/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Elm \ No newline at end of file diff --git a/Lang/Elm/FizzBuzz b/Lang/Elm/FizzBuzz new file mode 120000 index 0000000000..4ca622e0a4 --- /dev/null +++ b/Lang/Elm/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Elm \ No newline at end of file diff --git a/Lang/Elm/Flatten-a-list b/Lang/Elm/Flatten-a-list new file mode 120000 index 0000000000..1d551a7ef9 --- /dev/null +++ b/Lang/Elm/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Elm \ No newline at end of file diff --git a/Lang/Elm/Galton-box-animation b/Lang/Elm/Galton-box-animation new file mode 120000 index 0000000000..aed94d112b --- /dev/null +++ b/Lang/Elm/Galton-box-animation @@ -0,0 +1 @@ +../../Task/Galton-box-animation/Elm \ No newline at end of file diff --git a/Lang/Elm/Hello-world-Text b/Lang/Elm/Hello-world-Text new file mode 120000 index 0000000000..b5dbcf8c63 --- /dev/null +++ b/Lang/Elm/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Elm \ No newline at end of file diff --git a/Lang/Elm/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/Elm/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..0e01fcdcf4 --- /dev/null +++ b/Lang/Elm/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/Elm \ No newline at end of file diff --git a/Lang/Elm/Knights-tour b/Lang/Elm/Knights-tour new file mode 120000 index 0000000000..e555d6c4a7 --- /dev/null +++ b/Lang/Elm/Knights-tour @@ -0,0 +1 @@ +../../Task/Knights-tour/Elm \ No newline at end of file diff --git a/Lang/Elm/Langtons-ant b/Lang/Elm/Langtons-ant new file mode 120000 index 0000000000..86d5e8e58d --- /dev/null +++ b/Lang/Elm/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/Elm \ No newline at end of file diff --git a/Lang/Elm/Last-Friday-of-each-month b/Lang/Elm/Last-Friday-of-each-month new file mode 120000 index 0000000000..1cc930cea3 --- /dev/null +++ b/Lang/Elm/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/Elm \ No newline at end of file diff --git a/Lang/Elm/Maze-generation b/Lang/Elm/Maze-generation new file mode 120000 index 0000000000..7661da1f0d --- /dev/null +++ b/Lang/Elm/Maze-generation @@ -0,0 +1 @@ +../../Task/Maze-generation/Elm \ No newline at end of file diff --git a/Lang/Elm/Mouse-position b/Lang/Elm/Mouse-position new file mode 120000 index 0000000000..b2ee7642e1 --- /dev/null +++ b/Lang/Elm/Mouse-position @@ -0,0 +1 @@ +../../Task/Mouse-position/Elm \ No newline at end of file diff --git a/Lang/Elm/One-dimensional-cellular-automata b/Lang/Elm/One-dimensional-cellular-automata new file mode 120000 index 0000000000..e01ce2e5d6 --- /dev/null +++ b/Lang/Elm/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/Elm \ No newline at end of file diff --git a/Lang/Elm/Palindrome-detection b/Lang/Elm/Palindrome-detection new file mode 120000 index 0000000000..220ea77a5c --- /dev/null +++ b/Lang/Elm/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Elm \ No newline at end of file diff --git a/Lang/Elm/README b/Lang/Elm/README new file mode 100644 index 0000000000..6713a96f6c --- /dev/null +++ b/Lang/Elm/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Elm diff --git a/Lang/Elm/Real-constants-and-functions b/Lang/Elm/Real-constants-and-functions new file mode 120000 index 0000000000..b96fee5e9e --- /dev/null +++ b/Lang/Elm/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/Elm \ No newline at end of file diff --git a/Lang/Elm/Reverse-a-string b/Lang/Elm/Reverse-a-string new file mode 120000 index 0000000000..8b3ab74ac7 --- /dev/null +++ b/Lang/Elm/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Elm \ No newline at end of file diff --git a/Lang/Elm/Reverse-words-in-a-string b/Lang/Elm/Reverse-words-in-a-string new file mode 120000 index 0000000000..dc9ca18199 --- /dev/null +++ b/Lang/Elm/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/Elm \ No newline at end of file diff --git a/Lang/Elm/Sierpinski-triangle b/Lang/Elm/Sierpinski-triangle new file mode 120000 index 0000000000..c5d360bb69 --- /dev/null +++ b/Lang/Elm/Sierpinski-triangle @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle/Elm \ No newline at end of file diff --git a/Lang/Elm/String-case b/Lang/Elm/String-case new file mode 120000 index 0000000000..00e6b6b7cb --- /dev/null +++ b/Lang/Elm/String-case @@ -0,0 +1 @@ +../../Task/String-case/Elm \ No newline at end of file diff --git a/Lang/Ezhil/00DESCRIPTION b/Lang/Ezhil/00DESCRIPTION new file mode 100644 index 0000000000..e73daa86bb --- /dev/null +++ b/Lang/Ezhil/00DESCRIPTION @@ -0,0 +1,10 @@ +{{language +|exec=interpreted +|site=http://ezhillang.org/ +|parampass=value +|strength=strong +|checking=dynamic}} +'''Ezhil''' is a Tamil programming language with a syntax similar to [[BASIC]]. It is designed to help Tamil-speaking people learn programming. + +==See also== +[[wp:Ezhil programming language|Wikipedia article]] \ No newline at end of file diff --git a/Lang/Ezhil/Ackermann-function b/Lang/Ezhil/Ackermann-function new file mode 120000 index 0000000000..c72b704996 --- /dev/null +++ b/Lang/Ezhil/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Ezhil \ No newline at end of file diff --git a/Lang/Ezhil/Factorial b/Lang/Ezhil/Factorial new file mode 120000 index 0000000000..a38a8267fe --- /dev/null +++ b/Lang/Ezhil/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Ezhil \ No newline at end of file diff --git a/Lang/Ezhil/Greatest-common-divisor b/Lang/Ezhil/Greatest-common-divisor new file mode 120000 index 0000000000..5432c62ed7 --- /dev/null +++ b/Lang/Ezhil/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Ezhil \ No newline at end of file diff --git a/Lang/Ezhil/Hailstone-sequence b/Lang/Ezhil/Hailstone-sequence new file mode 120000 index 0000000000..6a46747ab4 --- /dev/null +++ b/Lang/Ezhil/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Ezhil \ No newline at end of file diff --git a/Lang/Ezhil/Least-common-multiple b/Lang/Ezhil/Least-common-multiple new file mode 120000 index 0000000000..75eaf0d0ff --- /dev/null +++ b/Lang/Ezhil/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/Ezhil \ No newline at end of file diff --git a/Lang/Ezhil/Prime-decomposition b/Lang/Ezhil/Prime-decomposition new file mode 120000 index 0000000000..2c3230068f --- /dev/null +++ b/Lang/Ezhil/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/Ezhil \ No newline at end of file diff --git a/Lang/Ezhil/README b/Lang/Ezhil/README new file mode 100644 index 0000000000..1806f3f2db --- /dev/null +++ b/Lang/Ezhil/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Ezhil diff --git a/Lang/Ezhil/Reverse-a-string b/Lang/Ezhil/Reverse-a-string new file mode 120000 index 0000000000..ef496b851a --- /dev/null +++ b/Lang/Ezhil/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Ezhil \ No newline at end of file diff --git a/Lang/Ezhil/Sorting-algorithms-Bubble-sort b/Lang/Ezhil/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..e725dee5b0 --- /dev/null +++ b/Lang/Ezhil/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/Ezhil \ No newline at end of file diff --git a/Lang/Ezhil/Sum-digits-of-an-integer b/Lang/Ezhil/Sum-digits-of-an-integer new file mode 120000 index 0000000000..8921ad40a8 --- /dev/null +++ b/Lang/Ezhil/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/Ezhil \ No newline at end of file diff --git a/Lang/Ezhil/Sum-of-a-series b/Lang/Ezhil/Sum-of-a-series new file mode 120000 index 0000000000..2e7ba86234 --- /dev/null +++ b/Lang/Ezhil/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Ezhil \ No newline at end of file diff --git a/Lang/Ezhil/Temperature-conversion b/Lang/Ezhil/Temperature-conversion new file mode 120000 index 0000000000..316d1df289 --- /dev/null +++ b/Lang/Ezhil/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Ezhil \ No newline at end of file diff --git a/Lang/Ezhil/Towers-of-Hanoi b/Lang/Ezhil/Towers-of-Hanoi new file mode 120000 index 0000000000..946b45c062 --- /dev/null +++ b/Lang/Ezhil/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Ezhil \ No newline at end of file diff --git a/Lang/FOCAL/00DESCRIPTION b/Lang/FOCAL/00DESCRIPTION new file mode 100644 index 0000000000..985f5569d7 --- /dev/null +++ b/Lang/FOCAL/00DESCRIPTION @@ -0,0 +1,3 @@ +{{stub}}{{language|FOCAL}} + +FOCAL, which is allegedly short for "Formulating On-line Calculations in Algebraic Language", is an imperative, interpreted programming language similar to JOSS. It was first introduced in 1968, and FOCAL-69 was widely used on the PDP-8 minicomputer from Digital Equipment Corporation. Like JOSS and BASIC, FOCAL was not intended to be used for developing large applications; the manual said it was "designed to help scientists, engineers, and students solve numerical problems." The design goals thus emphasize simplicity and accessibility. It could also be used satisfactorily on quite small computers: the FOCAL interpreter would run on a PDP-8 with only 4k words (6k bytes) of storage and still leave some space for user programs. \ No newline at end of file diff --git a/Lang/FOCAL/Fibonacci-sequence b/Lang/FOCAL/Fibonacci-sequence new file mode 120000 index 0000000000..84186a20d0 --- /dev/null +++ b/Lang/FOCAL/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/FOCAL \ No newline at end of file diff --git a/Lang/FOCAL/FizzBuzz b/Lang/FOCAL/FizzBuzz new file mode 120000 index 0000000000..1aa9766dc3 --- /dev/null +++ b/Lang/FOCAL/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/FOCAL \ No newline at end of file diff --git a/Lang/FOCAL/Hello-world-Newline-omission b/Lang/FOCAL/Hello-world-Newline-omission new file mode 120000 index 0000000000..d1c43008a2 --- /dev/null +++ b/Lang/FOCAL/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/FOCAL \ No newline at end of file diff --git a/Lang/FOCAL/Hello-world-Text b/Lang/FOCAL/Hello-world-Text new file mode 120000 index 0000000000..d59d9f4232 --- /dev/null +++ b/Lang/FOCAL/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/FOCAL \ No newline at end of file diff --git a/Lang/FOCAL/Loops-For b/Lang/FOCAL/Loops-For new file mode 120000 index 0000000000..621dba143e --- /dev/null +++ b/Lang/FOCAL/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/FOCAL \ No newline at end of file diff --git a/Lang/FOCAL/Loops-For-with-a-specified-step b/Lang/FOCAL/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..9ab6439f3f --- /dev/null +++ b/Lang/FOCAL/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/FOCAL \ No newline at end of file diff --git a/Lang/FOCAL/README b/Lang/FOCAL/README new file mode 100644 index 0000000000..f8b275925e --- /dev/null +++ b/Lang/FOCAL/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:FOCAL diff --git a/Lang/FOCAL/Temperature-conversion b/Lang/FOCAL/Temperature-conversion new file mode 120000 index 0000000000..10bb04330b --- /dev/null +++ b/Lang/FOCAL/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/FOCAL \ No newline at end of file diff --git a/Lang/FRISC-Assembly/00DESCRIPTION b/Lang/FRISC-Assembly/00DESCRIPTION new file mode 100644 index 0000000000..908cc8aa69 --- /dev/null +++ b/Lang/FRISC-Assembly/00DESCRIPTION @@ -0,0 +1,3 @@ +{{stub}}{{language|FRISC Assembly}} + +FRISC (Faculty of Electrical Engineering and Computing Reduced Instruction Set Computer) is a simplified 32-bit processor architecture developed at the University of Zagreb. \ No newline at end of file diff --git a/Lang/FRISC-Assembly/Fibonacci-sequence b/Lang/FRISC-Assembly/Fibonacci-sequence new file mode 120000 index 0000000000..98e578fe28 --- /dev/null +++ b/Lang/FRISC-Assembly/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/FRISC-Assembly \ No newline at end of file diff --git a/Lang/FRISC-Assembly/README b/Lang/FRISC-Assembly/README new file mode 100644 index 0000000000..ff39ecf825 --- /dev/null +++ b/Lang/FRISC-Assembly/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:FRISC_Assembly diff --git a/Lang/FUZE-BASIC/00DESCRIPTION b/Lang/FUZE-BASIC/00DESCRIPTION new file mode 100644 index 0000000000..0212cf4444 --- /dev/null +++ b/Lang/FUZE-BASIC/00DESCRIPTION @@ -0,0 +1,24 @@ +{{language|FUZE BASIC +|exec=interpreted +|site=https://www.fuze.co.uk/ +|parampass=both +|tags=fuze}} +{{language programming paradigm|procedural}} +{{implementation|BASIC}} + +[[Image:Logo.png]]         [[Image:FUZE.png]][[File:Pi.jpg|250px]] +
+'''FUZE BASIC''' is included, pre-configured and ready-to-run on the FUZE, a computer based on the [[Raspberry Pi]], but can also be installed, [https://www.fuze.co.uk/getfuzebasic/ free of charge] on a standard [[Raspberry Pi]] with some minor limitations due to a lack of on-board sensors which are added to the FUZE hardware. + +
+Quotes from the official website (https://www.fuze.co.uk/): + +"FUZE BASIC [is a] highly advanced and modernised version of the programming language widely accepted as the easiest to learn and teach." + +"The FUZE is a computing platform designed to encourage exploration and experimentation with basic electronics, communications and even robotics while at all times developing a core knowledge of computer programming. It is most of all, incredibly inspirational and for many, a life changing experience as students quickly realise technology is not an inaccessible over-complex mystical art but actually very reachable, very rewarding and downright good fun to boot!" +
+ +
'''FUZE BASIC''' initially introduced to Rosetta Code on February 27, 2016 by [http://rosettacode.org/wiki/User:Sarossell Scott A. Rossell]
FUZE BASIC and the FUZE logo are registered trademarks of FUZE Technologies Ltd.
Raspberry Pi and the Raspberry Pi logo are registered trademarks of The Raspberry Pi Foundation,
+---- +
+ \ No newline at end of file diff --git a/Lang/FUZE-BASIC/100-doors b/Lang/FUZE-BASIC/100-doors new file mode 120000 index 0000000000..7dabe891b5 --- /dev/null +++ b/Lang/FUZE-BASIC/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/FUZE-BASIC \ No newline at end of file diff --git a/Lang/FUZE-BASIC/A+B b/Lang/FUZE-BASIC/A+B new file mode 120000 index 0000000000..9dfcff73b7 --- /dev/null +++ b/Lang/FUZE-BASIC/A+B @@ -0,0 +1 @@ +../../Task/A+B/FUZE-BASIC \ No newline at end of file diff --git a/Lang/FUZE-BASIC/Comments b/Lang/FUZE-BASIC/Comments new file mode 120000 index 0000000000..66941e6482 --- /dev/null +++ b/Lang/FUZE-BASIC/Comments @@ -0,0 +1 @@ +../../Task/Comments/FUZE-BASIC \ No newline at end of file diff --git a/Lang/FUZE-BASIC/Hello-world-Text b/Lang/FUZE-BASIC/Hello-world-Text new file mode 120000 index 0000000000..b80bfcbfae --- /dev/null +++ b/Lang/FUZE-BASIC/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/FUZE-BASIC \ No newline at end of file diff --git a/Lang/FUZE-BASIC/README b/Lang/FUZE-BASIC/README new file mode 100644 index 0000000000..a7573335c1 --- /dev/null +++ b/Lang/FUZE-BASIC/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:FUZE_BASIC diff --git a/Lang/FormulaOne/00DESCRIPTION b/Lang/FormulaOne/00DESCRIPTION new file mode 100644 index 0000000000..142dcd7c68 --- /dev/null +++ b/Lang/FormulaOne/00DESCRIPTION @@ -0,0 +1,30 @@ +{{language +|site=http://www.f1compiler.com/ +|exec=bytecode +|strength=weak +|express=implicit +|checking=both +|parampass=reference +|gc=no +|tags=FormulaOne}} +{{language programming paradigm|imperative}} +{{language programming paradigm|procedural}} +{{language programming paradigm|functional}} +{{language programming paradigm|generic}} +'''FormulaOne''' is the name of the language, implementation, and environment. + +FormulaOne integrates procedural, declarative and database programming into one highly efficient language. Procedural programming shows weakness when faced with problems concerning logic reasoning. FormulaOne, being a declarative language as well, has the tools built into its inference engine, which organizes information and then, when queried, finds a way to logically interpret and process that information. + +If you are a problem solver, FormulaOne's truly unique implementation of constraints will be invaluable. They work readily with FormulaOne's highly structured and modular nature to produce better code. "Better" code means more readable, more error-free and easier to maintain and change. + +FormulaOne is also a complete programming environment. At the heart the language itself, extended to cover the paradigms of database languages (fourth generation) and logic languages (fifth generation). FormulaOne has the readability and efficiency of third-generation languages like BASIC, C, and Pascal, and the database update and query capabilities of fourth-generation systems. These features are all brought together by the powers of symbolic computing and logic programming with backtracking search - the same power as in fifth-generation languages like Prolog. + +Along with the FormulaOne language comes a complete visually oriented IDE environment. In the FormulaOne system, users can edit, compile, and run programs; build, query, and update database files; and create interlocking structures of program modules and databases of any desired complexity. + +FormulaOne is a relatively new programming language, so it's useful to compare and contrast it to other popular programming languages. The foundations of FormulaOne are most like those of Prolog. Like Prolog, FornmulaOne is based on mathematical logic, with a precise declarative semantics; programs are run by asking questions rather than giving commands. It is able to handle symbolic variables, whose values are determined by backtracking search. However, FormulaOne recognizes the deficiencies of Prolog in areas where languages like Pascal do better. + +As in Pascal, FormulaOne has a clear but concise nested program structure, rather than the difficult-to-read clauses of Prolog; 'if' and 'case' constructs that improve readability; produces fast, compact, non-backtracking code when desired. + +The type structure of FormulaOne is more like that of C. You can build arrays, structures, lists, and unions which are implemented as efficiently as they are in C. And as in C, terms of one type can be recast into terms of another type, when needed (and possible). FormulaOne also has many advanced features which are not found in either Prolog, Pascal or C. These include a leading-edge decision procedure for systems of constraints composed of arithmetic formulas, built into the language itself; a database file query system which is fully integrated with programs; variable modes, which allow the language to check the data flow in programs for correctness; useful data types not found in most languages, such as relations and injections; a module system which supports incremental compilation, linking, and loading of program modules. + +The basic unit of programming in FormulaOne is the formula. A formula is a statement about the world, phrased in a language similar to mathematical logic. When we enter a formula into the query window of the FormulaOne system, it is interpreted as a query; the system will respond by stating whether the query is true, or by stating the conditions under which it's true. \ No newline at end of file diff --git a/Lang/FormulaOne/README b/Lang/FormulaOne/README new file mode 100644 index 0000000000..29e189630b --- /dev/null +++ b/Lang/FormulaOne/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:FormulaOne diff --git a/Lang/FormulaOne/Zebra-puzzle b/Lang/FormulaOne/Zebra-puzzle new file mode 120000 index 0000000000..aa1325a5d2 --- /dev/null +++ b/Lang/FormulaOne/Zebra-puzzle @@ -0,0 +1 @@ +../../Task/Zebra-puzzle/FormulaOne \ No newline at end of file diff --git a/Lang/Free-Pascal/00DESCRIPTION b/Lang/Free-Pascal/00DESCRIPTION new file mode 100644 index 0000000000..430ee102c4 --- /dev/null +++ b/Lang/Free-Pascal/00DESCRIPTION @@ -0,0 +1,7 @@ +{{Language|Free Pascal +|strength=strong +|safety=safe}} +{{Compiler}} +{{language programming paradigm|object-oriented}} +{{language programming paradigm|imperative}} +{{implementation|Object Pascal}} \ No newline at end of file diff --git a/Lang/Free-Pascal/Quine b/Lang/Free-Pascal/Quine new file mode 120000 index 0000000000..aa97ea7f87 --- /dev/null +++ b/Lang/Free-Pascal/Quine @@ -0,0 +1 @@ +../../Task/Quine/Free-Pascal \ No newline at end of file diff --git a/Lang/Free-Pascal/README b/Lang/Free-Pascal/README new file mode 100644 index 0000000000..c7417e3401 --- /dev/null +++ b/Lang/Free-Pascal/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Free_Pascal diff --git a/Lang/Free-Pascal/Random-numbers b/Lang/Free-Pascal/Random-numbers new file mode 120000 index 0000000000..c802249c69 --- /dev/null +++ b/Lang/Free-Pascal/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/Free-Pascal \ No newline at end of file diff --git a/Lang/FreeBASIC/00DESCRIPTION b/Lang/FreeBASIC/00DESCRIPTION new file mode 100644 index 0000000000..86a1580ece --- /dev/null +++ b/Lang/FreeBASIC/00DESCRIPTION @@ -0,0 +1,17 @@ +{{language +|exec=machine +|gc=yes +|checking=static +|site=http://www.freebasic.net/}} +{{implementation|BASIC}}'''FreeBASIC''' is a free/[[open source]] ([[GPL]]), 32-bit [[BASIC]] compiler for [[Microsoft]] [[Windows]], protected-mode [[DOS]] (via a [[wp:DOS extender|DOS extender]]), [[Linux]], [[BSD|FreeBSD]], and the [[wp:Xbox|Xbox]]. The [[wp:Xbox|Xbox]] version is no longer maintained. + + +It makes use of the [[wp:GNU Binutils|GNU Binutils]] programming tools as backends, and can produce console, [[QuickBASIC]]-compatible graphical and [[GUI]] executables, along with dynamic and static libraries. A [[GCC]] frontend is under development, which will enable compilation for many more operating systems than currently supported. + +Currently, software libraries like [[GTK+]], [[wp:GNU Scientific Library|GSL]], [[:Category:SDL|SDL]], [[wp:Allegro library|Allegro]], [[Lua]] and [[OpenGL]] can be used directly (no wrappers, only function and structure prototypes), and more are being added on every new release. A complete set of the Windows [[API]] headers is also included. + +The compiler, and its nearly 90,000 lines of code, was, and still is, compiled by itself (in other words, FreeBASIC is a [[wp:Self-hosting|self-hosting compiler]]). The first version of FreeBASIC was written in [[:Category:Visual Basic|Visual Basic]] for DOS for that purpose. + +==See also== +* [http://www.freebasic.net/ FreeBASIC homepage] +* [[wp:FreeBASIC|FreeBASIC]] on Wikipedia \ No newline at end of file diff --git a/Lang/FreeBASIC/100-doors b/Lang/FreeBASIC/100-doors new file mode 120000 index 0000000000..a7d4934cda --- /dev/null +++ b/Lang/FreeBASIC/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/9-billion-names-of-God-the-integer b/Lang/FreeBASIC/9-billion-names-of-God-the-integer new file mode 120000 index 0000000000..394fd17fd3 --- /dev/null +++ b/Lang/FreeBASIC/9-billion-names-of-God-the-integer @@ -0,0 +1 @@ +../../Task/9-billion-names-of-God-the-integer/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/A+B b/Lang/FreeBASIC/A+B new file mode 120000 index 0000000000..c053bd49db --- /dev/null +++ b/Lang/FreeBASIC/A+B @@ -0,0 +1 @@ +../../Task/A+B/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/AKS-test-for-primes b/Lang/FreeBASIC/AKS-test-for-primes new file mode 120000 index 0000000000..de6a1ab69e --- /dev/null +++ b/Lang/FreeBASIC/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Abstract-type b/Lang/FreeBASIC/Abstract-type new file mode 120000 index 0000000000..49f8e3f4f0 --- /dev/null +++ b/Lang/FreeBASIC/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Abundant,-deficient-and-perfect-number-classifications b/Lang/FreeBASIC/Abundant,-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..a6df19d88d --- /dev/null +++ b/Lang/FreeBASIC/Abundant,-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant,-deficient-and-perfect-number-classifications/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Accumulator-factory b/Lang/FreeBASIC/Accumulator-factory new file mode 120000 index 0000000000..dd3b2cab04 --- /dev/null +++ b/Lang/FreeBASIC/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Ackermann-function b/Lang/FreeBASIC/Ackermann-function new file mode 120000 index 0000000000..f5c3ced94f --- /dev/null +++ b/Lang/FreeBASIC/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Address-of-a-variable b/Lang/FreeBASIC/Address-of-a-variable new file mode 120000 index 0000000000..8fa8618e6b --- /dev/null +++ b/Lang/FreeBASIC/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Align-columns b/Lang/FreeBASIC/Align-columns new file mode 120000 index 0000000000..cb81fd6365 --- /dev/null +++ b/Lang/FreeBASIC/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Almost-prime b/Lang/FreeBASIC/Almost-prime new file mode 120000 index 0000000000..fc6e988bc2 --- /dev/null +++ b/Lang/FreeBASIC/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Amicable-pairs b/Lang/FreeBASIC/Amicable-pairs new file mode 120000 index 0000000000..9209d4fabc --- /dev/null +++ b/Lang/FreeBASIC/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Anagrams b/Lang/FreeBASIC/Anagrams new file mode 120000 index 0000000000..5d2e2cdc71 --- /dev/null +++ b/Lang/FreeBASIC/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Anagrams-Deranged-anagrams b/Lang/FreeBASIC/Anagrams-Deranged-anagrams new file mode 120000 index 0000000000..0fbd7386a6 --- /dev/null +++ b/Lang/FreeBASIC/Anagrams-Deranged-anagrams @@ -0,0 +1 @@ +../../Task/Anagrams-Deranged-anagrams/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Animation b/Lang/FreeBASIC/Animation new file mode 120000 index 0000000000..c942019b75 --- /dev/null +++ b/Lang/FreeBASIC/Animation @@ -0,0 +1 @@ +../../Task/Animation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Anonymous-recursion b/Lang/FreeBASIC/Anonymous-recursion new file mode 120000 index 0000000000..6692274568 --- /dev/null +++ b/Lang/FreeBASIC/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Append-a-record-to-the-end-of-a-text-file b/Lang/FreeBASIC/Append-a-record-to-the-end-of-a-text-file new file mode 120000 index 0000000000..76fe9af421 --- /dev/null +++ b/Lang/FreeBASIC/Append-a-record-to-the-end-of-a-text-file @@ -0,0 +1 @@ +../../Task/Append-a-record-to-the-end-of-a-text-file/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Apply-a-callback-to-an-array b/Lang/FreeBASIC/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..ba8d054274 --- /dev/null +++ b/Lang/FreeBASIC/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Arbitrary-precision-integers--included- b/Lang/FreeBASIC/Arbitrary-precision-integers--included- new file mode 120000 index 0000000000..950f43694e --- /dev/null +++ b/Lang/FreeBASIC/Arbitrary-precision-integers--included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers--included-/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Arithmetic-Complex b/Lang/FreeBASIC/Arithmetic-Complex new file mode 120000 index 0000000000..2df674abbf --- /dev/null +++ b/Lang/FreeBASIC/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Arithmetic-Integer b/Lang/FreeBASIC/Arithmetic-Integer new file mode 120000 index 0000000000..c15e5923c4 --- /dev/null +++ b/Lang/FreeBASIC/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Arithmetic-evaluation b/Lang/FreeBASIC/Arithmetic-evaluation new file mode 120000 index 0000000000..4002b439ef --- /dev/null +++ b/Lang/FreeBASIC/Arithmetic-evaluation @@ -0,0 +1 @@ +../../Task/Arithmetic-evaluation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Arithmetic-geometric-mean b/Lang/FreeBASIC/Arithmetic-geometric-mean new file mode 120000 index 0000000000..65900e702a --- /dev/null +++ b/Lang/FreeBASIC/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Array-concatenation b/Lang/FreeBASIC/Array-concatenation new file mode 120000 index 0000000000..91f23d50f3 --- /dev/null +++ b/Lang/FreeBASIC/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Arrays b/Lang/FreeBASIC/Arrays new file mode 120000 index 0000000000..f9c313e81b --- /dev/null +++ b/Lang/FreeBASIC/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Assertions b/Lang/FreeBASIC/Assertions new file mode 120000 index 0000000000..fe627cd38f --- /dev/null +++ b/Lang/FreeBASIC/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Averages-Arithmetic-mean b/Lang/FreeBASIC/Averages-Arithmetic-mean new file mode 120000 index 0000000000..f8e5659ad1 --- /dev/null +++ b/Lang/FreeBASIC/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Averages-Mean-angle b/Lang/FreeBASIC/Averages-Mean-angle new file mode 120000 index 0000000000..58d1adba5b --- /dev/null +++ b/Lang/FreeBASIC/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Averages-Mean-time-of-day b/Lang/FreeBASIC/Averages-Mean-time-of-day new file mode 120000 index 0000000000..004789f6ff --- /dev/null +++ b/Lang/FreeBASIC/Averages-Mean-time-of-day @@ -0,0 +1 @@ +../../Task/Averages-Mean-time-of-day/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Averages-Median b/Lang/FreeBASIC/Averages-Median new file mode 120000 index 0000000000..bc29e6ca0d --- /dev/null +++ b/Lang/FreeBASIC/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Averages-Mode b/Lang/FreeBASIC/Averages-Mode new file mode 120000 index 0000000000..81958dd6ce --- /dev/null +++ b/Lang/FreeBASIC/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Averages-Pythagorean-means b/Lang/FreeBASIC/Averages-Pythagorean-means new file mode 120000 index 0000000000..c22ac066b4 --- /dev/null +++ b/Lang/FreeBASIC/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Averages-Root-mean-square b/Lang/FreeBASIC/Averages-Root-mean-square new file mode 120000 index 0000000000..bdfb1b41bd --- /dev/null +++ b/Lang/FreeBASIC/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Averages-Simple-moving-average b/Lang/FreeBASIC/Averages-Simple-moving-average new file mode 120000 index 0000000000..37790fb6c8 --- /dev/null +++ b/Lang/FreeBASIC/Averages-Simple-moving-average @@ -0,0 +1 @@ +../../Task/Averages-Simple-moving-average/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Balanced-brackets b/Lang/FreeBASIC/Balanced-brackets new file mode 120000 index 0000000000..90df6386c8 --- /dev/null +++ b/Lang/FreeBASIC/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Benfords-law b/Lang/FreeBASIC/Benfords-law new file mode 120000 index 0000000000..f2903c1815 --- /dev/null +++ b/Lang/FreeBASIC/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bernoulli-numbers b/Lang/FreeBASIC/Bernoulli-numbers new file mode 120000 index 0000000000..632b8c23cb --- /dev/null +++ b/Lang/FreeBASIC/Bernoulli-numbers @@ -0,0 +1 @@ +../../Task/Bernoulli-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Binary-digits b/Lang/FreeBASIC/Binary-digits new file mode 120000 index 0000000000..f164dcdbb4 --- /dev/null +++ b/Lang/FreeBASIC/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bitmap-B-zier-curves-Cubic b/Lang/FreeBASIC/Bitmap-B-zier-curves-Cubic new file mode 120000 index 0000000000..e5167de221 --- /dev/null +++ b/Lang/FreeBASIC/Bitmap-B-zier-curves-Cubic @@ -0,0 +1 @@ +../../Task/Bitmap-B-zier-curves-Cubic/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bitmap-B-zier-curves-Quadratic b/Lang/FreeBASIC/Bitmap-B-zier-curves-Quadratic new file mode 120000 index 0000000000..575eceeae5 --- /dev/null +++ b/Lang/FreeBASIC/Bitmap-B-zier-curves-Quadratic @@ -0,0 +1 @@ +../../Task/Bitmap-B-zier-curves-Quadratic/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bitmap-Bresenhams-line-algorithm b/Lang/FreeBASIC/Bitmap-Bresenhams-line-algorithm new file mode 120000 index 0000000000..e5ba2cb299 --- /dev/null +++ b/Lang/FreeBASIC/Bitmap-Bresenhams-line-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Bresenhams-line-algorithm/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bitmap-Flood-fill b/Lang/FreeBASIC/Bitmap-Flood-fill new file mode 120000 index 0000000000..2d93230d50 --- /dev/null +++ b/Lang/FreeBASIC/Bitmap-Flood-fill @@ -0,0 +1 @@ +../../Task/Bitmap-Flood-fill/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bitmap-Midpoint-circle-algorithm b/Lang/FreeBASIC/Bitmap-Midpoint-circle-algorithm new file mode 120000 index 0000000000..13b80acd51 --- /dev/null +++ b/Lang/FreeBASIC/Bitmap-Midpoint-circle-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Midpoint-circle-algorithm/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bitwise-operations b/Lang/FreeBASIC/Bitwise-operations new file mode 120000 index 0000000000..ff594cbea3 --- /dev/null +++ b/Lang/FreeBASIC/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Boolean-values b/Lang/FreeBASIC/Boolean-values new file mode 120000 index 0000000000..4110dfb2db --- /dev/null +++ b/Lang/FreeBASIC/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Box-the-compass b/Lang/FreeBASIC/Box-the-compass new file mode 120000 index 0000000000..85e8f5d180 --- /dev/null +++ b/Lang/FreeBASIC/Box-the-compass @@ -0,0 +1 @@ +../../Task/Box-the-compass/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/CSV-data-manipulation b/Lang/FreeBASIC/CSV-data-manipulation new file mode 120000 index 0000000000..29c3296535 --- /dev/null +++ b/Lang/FreeBASIC/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Caesar-cipher b/Lang/FreeBASIC/Caesar-cipher new file mode 120000 index 0000000000..bf9ca4afa0 --- /dev/null +++ b/Lang/FreeBASIC/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Calendar b/Lang/FreeBASIC/Calendar new file mode 120000 index 0000000000..58e23280e6 --- /dev/null +++ b/Lang/FreeBASIC/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Calendar---for-REAL-programmers b/Lang/FreeBASIC/Calendar---for-REAL-programmers new file mode 120000 index 0000000000..f4eba75817 --- /dev/null +++ b/Lang/FreeBASIC/Calendar---for-REAL-programmers @@ -0,0 +1 @@ +../../Task/Calendar---for-REAL-programmers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Call-a-foreign-language-function b/Lang/FreeBASIC/Call-a-foreign-language-function new file mode 120000 index 0000000000..1e3991ca7a --- /dev/null +++ b/Lang/FreeBASIC/Call-a-foreign-language-function @@ -0,0 +1 @@ +../../Task/Call-a-foreign-language-function/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Call-a-function-in-a-shared-library b/Lang/FreeBASIC/Call-a-function-in-a-shared-library new file mode 120000 index 0000000000..5b9d703940 --- /dev/null +++ b/Lang/FreeBASIC/Call-a-function-in-a-shared-library @@ -0,0 +1 @@ +../../Task/Call-a-function-in-a-shared-library/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Call-an-object-method b/Lang/FreeBASIC/Call-an-object-method new file mode 120000 index 0000000000..d6d7cf13e0 --- /dev/null +++ b/Lang/FreeBASIC/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Carmichael-3-strong-pseudoprimes b/Lang/FreeBASIC/Carmichael-3-strong-pseudoprimes new file mode 120000 index 0000000000..53b32c48c0 --- /dev/null +++ b/Lang/FreeBASIC/Carmichael-3-strong-pseudoprimes @@ -0,0 +1 @@ +../../Task/Carmichael-3-strong-pseudoprimes/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Case-sensitivity-of-identifiers b/Lang/FreeBASIC/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..96cc83f587 --- /dev/null +++ b/Lang/FreeBASIC/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Catalan-numbers b/Lang/FreeBASIC/Catalan-numbers new file mode 120000 index 0000000000..d08f6f1fda --- /dev/null +++ b/Lang/FreeBASIC/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Catalan-numbers-Pascals-triangle b/Lang/FreeBASIC/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..d368703c01 --- /dev/null +++ b/Lang/FreeBASIC/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Catamorphism b/Lang/FreeBASIC/Catamorphism new file mode 120000 index 0000000000..f3d15e34b6 --- /dev/null +++ b/Lang/FreeBASIC/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Character-codes b/Lang/FreeBASIC/Character-codes new file mode 120000 index 0000000000..e95648638a --- /dev/null +++ b/Lang/FreeBASIC/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Check-that-file-exists b/Lang/FreeBASIC/Check-that-file-exists new file mode 120000 index 0000000000..5bb7c80a2a --- /dev/null +++ b/Lang/FreeBASIC/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Classes b/Lang/FreeBASIC/Classes new file mode 120000 index 0000000000..643a39aa2e --- /dev/null +++ b/Lang/FreeBASIC/Classes @@ -0,0 +1 @@ +../../Task/Classes/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Closures-Value-capture b/Lang/FreeBASIC/Closures-Value-capture new file mode 120000 index 0000000000..3b5cd4cf9c --- /dev/null +++ b/Lang/FreeBASIC/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Collections b/Lang/FreeBASIC/Collections new file mode 120000 index 0000000000..98d62470e2 --- /dev/null +++ b/Lang/FreeBASIC/Collections @@ -0,0 +1 @@ +../../Task/Collections/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Color-of-a-screen-pixel b/Lang/FreeBASIC/Color-of-a-screen-pixel new file mode 120000 index 0000000000..9e576db5eb --- /dev/null +++ b/Lang/FreeBASIC/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Colour-bars-Display b/Lang/FreeBASIC/Colour-bars-Display new file mode 120000 index 0000000000..e0c0178190 --- /dev/null +++ b/Lang/FreeBASIC/Colour-bars-Display @@ -0,0 +1 @@ +../../Task/Colour-bars-Display/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Comma-quibbling b/Lang/FreeBASIC/Comma-quibbling new file mode 120000 index 0000000000..3016d22268 --- /dev/null +++ b/Lang/FreeBASIC/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Command-line-arguments b/Lang/FreeBASIC/Command-line-arguments new file mode 120000 index 0000000000..2205e7f1ef --- /dev/null +++ b/Lang/FreeBASIC/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Comments b/Lang/FreeBASIC/Comments new file mode 120000 index 0000000000..7b1b976971 --- /dev/null +++ b/Lang/FreeBASIC/Comments @@ -0,0 +1 @@ +../../Task/Comments/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Compile-time-calculation b/Lang/FreeBASIC/Compile-time-calculation new file mode 120000 index 0000000000..fe3360bd16 --- /dev/null +++ b/Lang/FreeBASIC/Compile-time-calculation @@ -0,0 +1 @@ +../../Task/Compile-time-calculation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Compound-data-type b/Lang/FreeBASIC/Compound-data-type new file mode 120000 index 0000000000..5f63bcf602 --- /dev/null +++ b/Lang/FreeBASIC/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Concurrent-computing b/Lang/FreeBASIC/Concurrent-computing new file mode 120000 index 0000000000..4b29b9ba25 --- /dev/null +++ b/Lang/FreeBASIC/Concurrent-computing @@ -0,0 +1 @@ +../../Task/Concurrent-computing/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Conditional-structures b/Lang/FreeBASIC/Conditional-structures new file mode 120000 index 0000000000..5242385d9b --- /dev/null +++ b/Lang/FreeBASIC/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Convert-decimal-number-to-rational b/Lang/FreeBASIC/Convert-decimal-number-to-rational new file mode 120000 index 0000000000..e77445aaa8 --- /dev/null +++ b/Lang/FreeBASIC/Convert-decimal-number-to-rational @@ -0,0 +1 @@ +../../Task/Convert-decimal-number-to-rational/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Copy-a-string b/Lang/FreeBASIC/Copy-a-string new file mode 120000 index 0000000000..64abd24be8 --- /dev/null +++ b/Lang/FreeBASIC/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Count-in-factors b/Lang/FreeBASIC/Count-in-factors new file mode 120000 index 0000000000..49d653516c --- /dev/null +++ b/Lang/FreeBASIC/Count-in-factors @@ -0,0 +1 @@ +../../Task/Count-in-factors/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Count-in-octal b/Lang/FreeBASIC/Count-in-octal new file mode 120000 index 0000000000..55f6393e20 --- /dev/null +++ b/Lang/FreeBASIC/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Count-occurrences-of-a-substring b/Lang/FreeBASIC/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..74c1ada0fb --- /dev/null +++ b/Lang/FreeBASIC/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Count-the-coins b/Lang/FreeBASIC/Count-the-coins new file mode 120000 index 0000000000..509c640b5b --- /dev/null +++ b/Lang/FreeBASIC/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Create-a-file b/Lang/FreeBASIC/Create-a-file new file mode 120000 index 0000000000..1dc7df2642 --- /dev/null +++ b/Lang/FreeBASIC/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Create-a-two-dimensional-array-at-runtime b/Lang/FreeBASIC/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..6917c0b14d --- /dev/null +++ b/Lang/FreeBASIC/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Create-an-object-at-a-given-address b/Lang/FreeBASIC/Create-an-object-at-a-given-address new file mode 120000 index 0000000000..c128512646 --- /dev/null +++ b/Lang/FreeBASIC/Create-an-object-at-a-given-address @@ -0,0 +1 @@ +../../Task/Create-an-object-at-a-given-address/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Currying b/Lang/FreeBASIC/Currying new file mode 120000 index 0000000000..99f4193b78 --- /dev/null +++ b/Lang/FreeBASIC/Currying @@ -0,0 +1 @@ +../../Task/Currying/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Date-format b/Lang/FreeBASIC/Date-format new file mode 120000 index 0000000000..b64f40918a --- /dev/null +++ b/Lang/FreeBASIC/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Date-manipulation b/Lang/FreeBASIC/Date-manipulation new file mode 120000 index 0000000000..454cc62b75 --- /dev/null +++ b/Lang/FreeBASIC/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Deal-cards-for-FreeCell b/Lang/FreeBASIC/Deal-cards-for-FreeCell new file mode 120000 index 0000000000..b9206797a3 --- /dev/null +++ b/Lang/FreeBASIC/Deal-cards-for-FreeCell @@ -0,0 +1 @@ +../../Task/Deal-cards-for-FreeCell/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Define-a-primitive-data-type b/Lang/FreeBASIC/Define-a-primitive-data-type new file mode 120000 index 0000000000..9c51b22647 --- /dev/null +++ b/Lang/FreeBASIC/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Delete-a-file b/Lang/FreeBASIC/Delete-a-file new file mode 120000 index 0000000000..c37b3f74e7 --- /dev/null +++ b/Lang/FreeBASIC/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Detect-division-by-zero b/Lang/FreeBASIC/Detect-division-by-zero new file mode 120000 index 0000000000..a6c5e84e38 --- /dev/null +++ b/Lang/FreeBASIC/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Determine-if-a-string-is-numeric b/Lang/FreeBASIC/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..3febdb6c3f --- /dev/null +++ b/Lang/FreeBASIC/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Digital-root b/Lang/FreeBASIC/Digital-root new file mode 120000 index 0000000000..8fb8fc9270 --- /dev/null +++ b/Lang/FreeBASIC/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Dynamic-variable-names b/Lang/FreeBASIC/Dynamic-variable-names new file mode 120000 index 0000000000..ded39e05d4 --- /dev/null +++ b/Lang/FreeBASIC/Dynamic-variable-names @@ -0,0 +1 @@ +../../Task/Dynamic-variable-names/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Empty-directory b/Lang/FreeBASIC/Empty-directory new file mode 120000 index 0000000000..578d076db8 --- /dev/null +++ b/Lang/FreeBASIC/Empty-directory @@ -0,0 +1 @@ +../../Task/Empty-directory/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Empty-program b/Lang/FreeBASIC/Empty-program new file mode 120000 index 0000000000..7c4447dfa6 --- /dev/null +++ b/Lang/FreeBASIC/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Empty-string b/Lang/FreeBASIC/Empty-string new file mode 120000 index 0000000000..37f532f733 --- /dev/null +++ b/Lang/FreeBASIC/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Entropy b/Lang/FreeBASIC/Entropy new file mode 120000 index 0000000000..1b91e050cb --- /dev/null +++ b/Lang/FreeBASIC/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Enumerations b/Lang/FreeBASIC/Enumerations new file mode 120000 index 0000000000..44a4f5bfb8 --- /dev/null +++ b/Lang/FreeBASIC/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Environment-variables b/Lang/FreeBASIC/Environment-variables new file mode 120000 index 0000000000..ffd65c6db1 --- /dev/null +++ b/Lang/FreeBASIC/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Equilibrium-index b/Lang/FreeBASIC/Equilibrium-index new file mode 120000 index 0000000000..595d736fb9 --- /dev/null +++ b/Lang/FreeBASIC/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Evaluate-binomial-coefficients b/Lang/FreeBASIC/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..0d2a0625d7 --- /dev/null +++ b/Lang/FreeBASIC/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Even-or-odd b/Lang/FreeBASIC/Even-or-odd new file mode 120000 index 0000000000..178dc86e46 --- /dev/null +++ b/Lang/FreeBASIC/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Exceptions b/Lang/FreeBASIC/Exceptions new file mode 120000 index 0000000000..bc909a2690 --- /dev/null +++ b/Lang/FreeBASIC/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Exceptions-Catch-an-exception-thrown-in-a-nested-call b/Lang/FreeBASIC/Exceptions-Catch-an-exception-thrown-in-a-nested-call new file mode 120000 index 0000000000..c41b9f678d --- /dev/null +++ b/Lang/FreeBASIC/Exceptions-Catch-an-exception-thrown-in-a-nested-call @@ -0,0 +1 @@ +../../Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Execute-a-system-command b/Lang/FreeBASIC/Execute-a-system-command new file mode 120000 index 0000000000..cb911ddc47 --- /dev/null +++ b/Lang/FreeBASIC/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Exponentiation-operator b/Lang/FreeBASIC/Exponentiation-operator new file mode 120000 index 0000000000..f4c296f117 --- /dev/null +++ b/Lang/FreeBASIC/Exponentiation-operator @@ -0,0 +1 @@ +../../Task/Exponentiation-operator/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Extend-your-language b/Lang/FreeBASIC/Extend-your-language new file mode 120000 index 0000000000..fd3edafa1b --- /dev/null +++ b/Lang/FreeBASIC/Extend-your-language @@ -0,0 +1 @@ +../../Task/Extend-your-language/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Extensible-prime-generator b/Lang/FreeBASIC/Extensible-prime-generator new file mode 120000 index 0000000000..b3969c6692 --- /dev/null +++ b/Lang/FreeBASIC/Extensible-prime-generator @@ -0,0 +1 @@ +../../Task/Extensible-prime-generator/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Extreme-floating-point-values b/Lang/FreeBASIC/Extreme-floating-point-values new file mode 120000 index 0000000000..fae27ed2df --- /dev/null +++ b/Lang/FreeBASIC/Extreme-floating-point-values @@ -0,0 +1 @@ +../../Task/Extreme-floating-point-values/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Factorial b/Lang/FreeBASIC/Factorial new file mode 120000 index 0000000000..7220f8d64d --- /dev/null +++ b/Lang/FreeBASIC/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Factors-of-a-Mersenne-number b/Lang/FreeBASIC/Factors-of-a-Mersenne-number new file mode 120000 index 0000000000..8ff5e57f58 --- /dev/null +++ b/Lang/FreeBASIC/Factors-of-a-Mersenne-number @@ -0,0 +1 @@ +../../Task/Factors-of-a-Mersenne-number/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Factors-of-an-integer b/Lang/FreeBASIC/Factors-of-an-integer new file mode 120000 index 0000000000..8f4316ebf4 --- /dev/null +++ b/Lang/FreeBASIC/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Fibonacci-n-step-number-sequences b/Lang/FreeBASIC/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..38a1ed10a5 --- /dev/null +++ b/Lang/FreeBASIC/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Fibonacci-sequence b/Lang/FreeBASIC/Fibonacci-sequence new file mode 120000 index 0000000000..e3553d4ef4 --- /dev/null +++ b/Lang/FreeBASIC/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Fibonacci-word b/Lang/FreeBASIC/Fibonacci-word new file mode 120000 index 0000000000..4a9a5a1577 --- /dev/null +++ b/Lang/FreeBASIC/Fibonacci-word @@ -0,0 +1 @@ +../../Task/Fibonacci-word/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Fibonacci-word-fractal b/Lang/FreeBASIC/Fibonacci-word-fractal new file mode 120000 index 0000000000..afcc7d9408 --- /dev/null +++ b/Lang/FreeBASIC/Fibonacci-word-fractal @@ -0,0 +1 @@ +../../Task/Fibonacci-word-fractal/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/File-input-output b/Lang/FreeBASIC/File-input-output new file mode 120000 index 0000000000..4bf07b8dde --- /dev/null +++ b/Lang/FreeBASIC/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/File-modification-time b/Lang/FreeBASIC/File-modification-time new file mode 120000 index 0000000000..446b091996 --- /dev/null +++ b/Lang/FreeBASIC/File-modification-time @@ -0,0 +1 @@ +../../Task/File-modification-time/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/File-size b/Lang/FreeBASIC/File-size new file mode 120000 index 0000000000..0253ee4855 --- /dev/null +++ b/Lang/FreeBASIC/File-size @@ -0,0 +1 @@ +../../Task/File-size/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Filter b/Lang/FreeBASIC/Filter new file mode 120000 index 0000000000..a1ce3f38f7 --- /dev/null +++ b/Lang/FreeBASIC/Filter @@ -0,0 +1 @@ +../../Task/Filter/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Find-the-last-Sunday-of-each-month b/Lang/FreeBASIC/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..536d3d1db6 --- /dev/null +++ b/Lang/FreeBASIC/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Five-weekends b/Lang/FreeBASIC/Five-weekends new file mode 120000 index 0000000000..934923783a --- /dev/null +++ b/Lang/FreeBASIC/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Floyds-triangle b/Lang/FreeBASIC/Floyds-triangle new file mode 120000 index 0000000000..aed33d8654 --- /dev/null +++ b/Lang/FreeBASIC/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Formatted-numeric-output b/Lang/FreeBASIC/Formatted-numeric-output new file mode 120000 index 0000000000..2eebf5f3aa --- /dev/null +++ b/Lang/FreeBASIC/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Fractran b/Lang/FreeBASIC/Fractran new file mode 120000 index 0000000000..fa89501c0b --- /dev/null +++ b/Lang/FreeBASIC/Fractran @@ -0,0 +1 @@ +../../Task/Fractran/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Function-definition b/Lang/FreeBASIC/Function-definition new file mode 120000 index 0000000000..4d29859c3a --- /dev/null +++ b/Lang/FreeBASIC/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Function-prototype b/Lang/FreeBASIC/Function-prototype new file mode 120000 index 0000000000..8a7445e88e --- /dev/null +++ b/Lang/FreeBASIC/Function-prototype @@ -0,0 +1 @@ +../../Task/Function-prototype/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/GUI-Maximum-window-dimensions b/Lang/FreeBASIC/GUI-Maximum-window-dimensions new file mode 120000 index 0000000000..af5a5ea7d3 --- /dev/null +++ b/Lang/FreeBASIC/GUI-Maximum-window-dimensions @@ -0,0 +1 @@ +../../Task/GUI-Maximum-window-dimensions/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/GUI-component-interaction b/Lang/FreeBASIC/GUI-component-interaction new file mode 120000 index 0000000000..27227169a2 --- /dev/null +++ b/Lang/FreeBASIC/GUI-component-interaction @@ -0,0 +1 @@ +../../Task/GUI-component-interaction/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Gamma-function b/Lang/FreeBASIC/Gamma-function new file mode 120000 index 0000000000..98dd21076c --- /dev/null +++ b/Lang/FreeBASIC/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Generate-lower-case-ASCII-alphabet b/Lang/FreeBASIC/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..52a073acbf --- /dev/null +++ b/Lang/FreeBASIC/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Generic-swap b/Lang/FreeBASIC/Generic-swap new file mode 120000 index 0000000000..6303b9322d --- /dev/null +++ b/Lang/FreeBASIC/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Greatest-common-divisor b/Lang/FreeBASIC/Greatest-common-divisor new file mode 120000 index 0000000000..48ea0a23d8 --- /dev/null +++ b/Lang/FreeBASIC/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Greatest-element-of-a-list b/Lang/FreeBASIC/Greatest-element-of-a-list new file mode 120000 index 0000000000..1262c6af9e --- /dev/null +++ b/Lang/FreeBASIC/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Greatest-subsequential-sum b/Lang/FreeBASIC/Greatest-subsequential-sum new file mode 120000 index 0000000000..ab54c29e9a --- /dev/null +++ b/Lang/FreeBASIC/Greatest-subsequential-sum @@ -0,0 +1 @@ +../../Task/Greatest-subsequential-sum/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Guess-the-number b/Lang/FreeBASIC/Guess-the-number new file mode 120000 index 0000000000..5cbdd18897 --- /dev/null +++ b/Lang/FreeBASIC/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Guess-the-number-With-feedback b/Lang/FreeBASIC/Guess-the-number-With-feedback new file mode 120000 index 0000000000..4674ce8b2e --- /dev/null +++ b/Lang/FreeBASIC/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Guess-the-number-With-feedback--player- b/Lang/FreeBASIC/Guess-the-number-With-feedback--player- new file mode 120000 index 0000000000..6b548d1d9c --- /dev/null +++ b/Lang/FreeBASIC/Guess-the-number-With-feedback--player- @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback--player-/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Hamming-numbers b/Lang/FreeBASIC/Hamming-numbers new file mode 120000 index 0000000000..0fc374cee3 --- /dev/null +++ b/Lang/FreeBASIC/Hamming-numbers @@ -0,0 +1 @@ +../../Task/Hamming-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Happy-numbers b/Lang/FreeBASIC/Happy-numbers new file mode 120000 index 0000000000..e3b1b03e9a --- /dev/null +++ b/Lang/FreeBASIC/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Harshad-or-Niven-series b/Lang/FreeBASIC/Harshad-or-Niven-series new file mode 120000 index 0000000000..cf31010747 --- /dev/null +++ b/Lang/FreeBASIC/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Haversine-formula b/Lang/FreeBASIC/Haversine-formula new file mode 120000 index 0000000000..1dcc6ac66d --- /dev/null +++ b/Lang/FreeBASIC/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Hello-world-Graphical b/Lang/FreeBASIC/Hello-world-Graphical new file mode 120000 index 0000000000..0209f88ce1 --- /dev/null +++ b/Lang/FreeBASIC/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Hello-world-Line-printer b/Lang/FreeBASIC/Hello-world-Line-printer new file mode 120000 index 0000000000..cd9e0e3428 --- /dev/null +++ b/Lang/FreeBASIC/Hello-world-Line-printer @@ -0,0 +1 @@ +../../Task/Hello-world-Line-printer/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Hello-world-Newline-omission b/Lang/FreeBASIC/Hello-world-Newline-omission new file mode 120000 index 0000000000..1c7f6c4bd8 --- /dev/null +++ b/Lang/FreeBASIC/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Hello-world-Standard-error b/Lang/FreeBASIC/Hello-world-Standard-error new file mode 120000 index 0000000000..70ba9797d3 --- /dev/null +++ b/Lang/FreeBASIC/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Hello-world-Text b/Lang/FreeBASIC/Hello-world-Text new file mode 120000 index 0000000000..90df935286 --- /dev/null +++ b/Lang/FreeBASIC/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Heronian-triangles b/Lang/FreeBASIC/Heronian-triangles new file mode 120000 index 0000000000..6a41638d40 --- /dev/null +++ b/Lang/FreeBASIC/Heronian-triangles @@ -0,0 +1 @@ +../../Task/Heronian-triangles/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Hickerson-series-of-almost-integers b/Lang/FreeBASIC/Hickerson-series-of-almost-integers new file mode 120000 index 0000000000..5b14072eb8 --- /dev/null +++ b/Lang/FreeBASIC/Hickerson-series-of-almost-integers @@ -0,0 +1 @@ +../../Task/Hickerson-series-of-almost-integers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Higher-order-functions b/Lang/FreeBASIC/Higher-order-functions new file mode 120000 index 0000000000..b87e92f367 --- /dev/null +++ b/Lang/FreeBASIC/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Host-introspection b/Lang/FreeBASIC/Host-introspection new file mode 120000 index 0000000000..c4d4ac4861 --- /dev/null +++ b/Lang/FreeBASIC/Host-introspection @@ -0,0 +1 @@ +../../Task/Host-introspection/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Hostname b/Lang/FreeBASIC/Hostname new file mode 120000 index 0000000000..f6753d7cda --- /dev/null +++ b/Lang/FreeBASIC/Hostname @@ -0,0 +1 @@ +../../Task/Hostname/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/I-before-E-except-after-C b/Lang/FreeBASIC/I-before-E-except-after-C new file mode 120000 index 0000000000..1156db0822 --- /dev/null +++ b/Lang/FreeBASIC/I-before-E-except-after-C @@ -0,0 +1 @@ +../../Task/I-before-E-except-after-C/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/IBAN b/Lang/FreeBASIC/IBAN new file mode 120000 index 0000000000..2b70805de4 --- /dev/null +++ b/Lang/FreeBASIC/IBAN @@ -0,0 +1 @@ +../../Task/IBAN/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Identity-matrix b/Lang/FreeBASIC/Identity-matrix new file mode 120000 index 0000000000..b10d230033 --- /dev/null +++ b/Lang/FreeBASIC/Identity-matrix @@ -0,0 +1 @@ +../../Task/Identity-matrix/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Include-a-file b/Lang/FreeBASIC/Include-a-file new file mode 120000 index 0000000000..89ad0ab8ca --- /dev/null +++ b/Lang/FreeBASIC/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Increment-a-numerical-string b/Lang/FreeBASIC/Increment-a-numerical-string new file mode 120000 index 0000000000..e38bef4f7b --- /dev/null +++ b/Lang/FreeBASIC/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Infinity b/Lang/FreeBASIC/Infinity new file mode 120000 index 0000000000..19bb9113a7 --- /dev/null +++ b/Lang/FreeBASIC/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Inheritance-Multiple b/Lang/FreeBASIC/Inheritance-Multiple new file mode 120000 index 0000000000..27fdd65b87 --- /dev/null +++ b/Lang/FreeBASIC/Inheritance-Multiple @@ -0,0 +1 @@ +../../Task/Inheritance-Multiple/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Inheritance-Single b/Lang/FreeBASIC/Inheritance-Single new file mode 120000 index 0000000000..1bd79092d4 --- /dev/null +++ b/Lang/FreeBASIC/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Input-loop b/Lang/FreeBASIC/Input-loop new file mode 120000 index 0000000000..6d5335c1a2 --- /dev/null +++ b/Lang/FreeBASIC/Input-loop @@ -0,0 +1 @@ +../../Task/Input-loop/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Integer-comparison b/Lang/FreeBASIC/Integer-comparison new file mode 120000 index 0000000000..5a2c34ff05 --- /dev/null +++ b/Lang/FreeBASIC/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Integer-overflow b/Lang/FreeBASIC/Integer-overflow new file mode 120000 index 0000000000..e88ce3dff2 --- /dev/null +++ b/Lang/FreeBASIC/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Integer-sequence b/Lang/FreeBASIC/Integer-sequence new file mode 120000 index 0000000000..06992da143 --- /dev/null +++ b/Lang/FreeBASIC/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Interactive-programming b/Lang/FreeBASIC/Interactive-programming new file mode 120000 index 0000000000..9a7d2b12a9 --- /dev/null +++ b/Lang/FreeBASIC/Interactive-programming @@ -0,0 +1 @@ +../../Task/Interactive-programming/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Inverted-syntax b/Lang/FreeBASIC/Inverted-syntax new file mode 120000 index 0000000000..48c95a826e --- /dev/null +++ b/Lang/FreeBASIC/Inverted-syntax @@ -0,0 +1 @@ +../../Task/Inverted-syntax/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Iterated-digits-squaring b/Lang/FreeBASIC/Iterated-digits-squaring new file mode 120000 index 0000000000..877f833a98 --- /dev/null +++ b/Lang/FreeBASIC/Iterated-digits-squaring @@ -0,0 +1 @@ +../../Task/Iterated-digits-squaring/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Jump-anywhere b/Lang/FreeBASIC/Jump-anywhere new file mode 120000 index 0000000000..76cc0df987 --- /dev/null +++ b/Lang/FreeBASIC/Jump-anywhere @@ -0,0 +1 @@ +../../Task/Jump-anywhere/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Kaprekar-numbers b/Lang/FreeBASIC/Kaprekar-numbers new file mode 120000 index 0000000000..da0dd0e9a1 --- /dev/null +++ b/Lang/FreeBASIC/Kaprekar-numbers @@ -0,0 +1 @@ +../../Task/Kaprekar-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Keyboard-input-Flush-the-keyboard-buffer b/Lang/FreeBASIC/Keyboard-input-Flush-the-keyboard-buffer new file mode 120000 index 0000000000..d49c0ad426 --- /dev/null +++ b/Lang/FreeBASIC/Keyboard-input-Flush-the-keyboard-buffer @@ -0,0 +1 @@ +../../Task/Keyboard-input-Flush-the-keyboard-buffer/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Keyboard-input-Keypress-check b/Lang/FreeBASIC/Keyboard-input-Keypress-check new file mode 120000 index 0000000000..4b18d4795f --- /dev/null +++ b/Lang/FreeBASIC/Keyboard-input-Keypress-check @@ -0,0 +1 @@ +../../Task/Keyboard-input-Keypress-check/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/FreeBASIC/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..ff5e29f36c --- /dev/null +++ b/Lang/FreeBASIC/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Knuth-shuffle b/Lang/FreeBASIC/Knuth-shuffle new file mode 120000 index 0000000000..dfc9810b99 --- /dev/null +++ b/Lang/FreeBASIC/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Langtons-ant b/Lang/FreeBASIC/Langtons-ant new file mode 120000 index 0000000000..e4ab696197 --- /dev/null +++ b/Lang/FreeBASIC/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Last-Friday-of-each-month b/Lang/FreeBASIC/Last-Friday-of-each-month new file mode 120000 index 0000000000..7eadc386b9 --- /dev/null +++ b/Lang/FreeBASIC/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Leap-year b/Lang/FreeBASIC/Leap-year new file mode 120000 index 0000000000..054e93c3c1 --- /dev/null +++ b/Lang/FreeBASIC/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Least-common-multiple b/Lang/FreeBASIC/Least-common-multiple new file mode 120000 index 0000000000..94b0c6eedf --- /dev/null +++ b/Lang/FreeBASIC/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Letter-frequency b/Lang/FreeBASIC/Letter-frequency new file mode 120000 index 0000000000..4cc8d09ef2 --- /dev/null +++ b/Lang/FreeBASIC/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Levenshtein-distance b/Lang/FreeBASIC/Levenshtein-distance new file mode 120000 index 0000000000..c1a5786059 --- /dev/null +++ b/Lang/FreeBASIC/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Linear-congruential-generator b/Lang/FreeBASIC/Linear-congruential-generator new file mode 120000 index 0000000000..b3ac2c9157 --- /dev/null +++ b/Lang/FreeBASIC/Linear-congruential-generator @@ -0,0 +1 @@ +../../Task/Linear-congruential-generator/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Literals-Floating-point b/Lang/FreeBASIC/Literals-Floating-point new file mode 120000 index 0000000000..116f3416f7 --- /dev/null +++ b/Lang/FreeBASIC/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Literals-Integer b/Lang/FreeBASIC/Literals-Integer new file mode 120000 index 0000000000..f9474297ce --- /dev/null +++ b/Lang/FreeBASIC/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Logical-operations b/Lang/FreeBASIC/Logical-operations new file mode 120000 index 0000000000..c33bc3af60 --- /dev/null +++ b/Lang/FreeBASIC/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Loop-over-multiple-arrays-simultaneously b/Lang/FreeBASIC/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..3513eb2b3a --- /dev/null +++ b/Lang/FreeBASIC/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Loops-Break b/Lang/FreeBASIC/Loops-Break new file mode 120000 index 0000000000..b68a2c0652 --- /dev/null +++ b/Lang/FreeBASIC/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Loops-Continue b/Lang/FreeBASIC/Loops-Continue new file mode 120000 index 0000000000..84b964a752 --- /dev/null +++ b/Lang/FreeBASIC/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Loops-Do-while b/Lang/FreeBASIC/Loops-Do-while new file mode 120000 index 0000000000..678ab4b632 --- /dev/null +++ b/Lang/FreeBASIC/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Loops-Downward-for b/Lang/FreeBASIC/Loops-Downward-for new file mode 120000 index 0000000000..2d04af28bf --- /dev/null +++ b/Lang/FreeBASIC/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Loops-For b/Lang/FreeBASIC/Loops-For new file mode 120000 index 0000000000..b40eebe311 --- /dev/null +++ b/Lang/FreeBASIC/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Loops-For-with-a-specified-step b/Lang/FreeBASIC/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..27078fcd8d --- /dev/null +++ b/Lang/FreeBASIC/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Loops-Foreach b/Lang/FreeBASIC/Loops-Foreach new file mode 120000 index 0000000000..0260d67ece --- /dev/null +++ b/Lang/FreeBASIC/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Loops-Infinite b/Lang/FreeBASIC/Loops-Infinite new file mode 120000 index 0000000000..3e7acf4a09 --- /dev/null +++ b/Lang/FreeBASIC/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Loops-N-plus-one-half b/Lang/FreeBASIC/Loops-N-plus-one-half new file mode 120000 index 0000000000..b5c61acdef --- /dev/null +++ b/Lang/FreeBASIC/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Loops-Nested b/Lang/FreeBASIC/Loops-Nested new file mode 120000 index 0000000000..08c26e833a --- /dev/null +++ b/Lang/FreeBASIC/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Loops-While b/Lang/FreeBASIC/Loops-While new file mode 120000 index 0000000000..e95bbe103e --- /dev/null +++ b/Lang/FreeBASIC/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Lucas-Lehmer-test b/Lang/FreeBASIC/Lucas-Lehmer-test new file mode 120000 index 0000000000..f1bb85eada --- /dev/null +++ b/Lang/FreeBASIC/Lucas-Lehmer-test @@ -0,0 +1 @@ +../../Task/Lucas-Lehmer-test/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Ludic-numbers b/Lang/FreeBASIC/Ludic-numbers new file mode 120000 index 0000000000..7358aa5ee2 --- /dev/null +++ b/Lang/FreeBASIC/Ludic-numbers @@ -0,0 +1 @@ +../../Task/Ludic-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Luhn-test-of-credit-card-numbers b/Lang/FreeBASIC/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..c8a12d5ff9 --- /dev/null +++ b/Lang/FreeBASIC/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/MD4 b/Lang/FreeBASIC/MD4 new file mode 120000 index 0000000000..069d63502f --- /dev/null +++ b/Lang/FreeBASIC/MD4 @@ -0,0 +1 @@ +../../Task/MD4/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/MD5-Implementation b/Lang/FreeBASIC/MD5-Implementation new file mode 120000 index 0000000000..2a40fb0e7c --- /dev/null +++ b/Lang/FreeBASIC/MD5-Implementation @@ -0,0 +1 @@ +../../Task/MD5-Implementation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Magic-squares-of-odd-order b/Lang/FreeBASIC/Magic-squares-of-odd-order new file mode 120000 index 0000000000..0956ed010a --- /dev/null +++ b/Lang/FreeBASIC/Magic-squares-of-odd-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-odd-order/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Maximum-triangle-path-sum b/Lang/FreeBASIC/Maximum-triangle-path-sum new file mode 120000 index 0000000000..a0ff09a322 --- /dev/null +++ b/Lang/FreeBASIC/Maximum-triangle-path-sum @@ -0,0 +1 @@ +../../Task/Maximum-triangle-path-sum/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Maze-generation b/Lang/FreeBASIC/Maze-generation new file mode 120000 index 0000000000..96d9270392 --- /dev/null +++ b/Lang/FreeBASIC/Maze-generation @@ -0,0 +1 @@ +../../Task/Maze-generation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Memory-layout-of-a-data-structure b/Lang/FreeBASIC/Memory-layout-of-a-data-structure new file mode 120000 index 0000000000..0483d465d2 --- /dev/null +++ b/Lang/FreeBASIC/Memory-layout-of-a-data-structure @@ -0,0 +1 @@ +../../Task/Memory-layout-of-a-data-structure/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Metaprogramming b/Lang/FreeBASIC/Metaprogramming new file mode 120000 index 0000000000..b03cfa72dc --- /dev/null +++ b/Lang/FreeBASIC/Metaprogramming @@ -0,0 +1 @@ +../../Task/Metaprogramming/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Middle-three-digits b/Lang/FreeBASIC/Middle-three-digits new file mode 120000 index 0000000000..cc94dab024 --- /dev/null +++ b/Lang/FreeBASIC/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Monte-Carlo-methods b/Lang/FreeBASIC/Monte-Carlo-methods new file mode 120000 index 0000000000..4a5b3ae97c --- /dev/null +++ b/Lang/FreeBASIC/Monte-Carlo-methods @@ -0,0 +1 @@ +../../Task/Monte-Carlo-methods/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Morse-code b/Lang/FreeBASIC/Morse-code new file mode 120000 index 0000000000..dfd98fd672 --- /dev/null +++ b/Lang/FreeBASIC/Morse-code @@ -0,0 +1 @@ +../../Task/Morse-code/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Multifactorial b/Lang/FreeBASIC/Multifactorial new file mode 120000 index 0000000000..401be767dc --- /dev/null +++ b/Lang/FreeBASIC/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Multiplication-tables b/Lang/FreeBASIC/Multiplication-tables new file mode 120000 index 0000000000..95a1ceb2c2 --- /dev/null +++ b/Lang/FreeBASIC/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Multisplit b/Lang/FreeBASIC/Multisplit new file mode 120000 index 0000000000..0054f22aa7 --- /dev/null +++ b/Lang/FreeBASIC/Multisplit @@ -0,0 +1 @@ +../../Task/Multisplit/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Munching-squares b/Lang/FreeBASIC/Munching-squares new file mode 120000 index 0000000000..6d90833327 --- /dev/null +++ b/Lang/FreeBASIC/Munching-squares @@ -0,0 +1 @@ +../../Task/Munching-squares/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Mutual-recursion b/Lang/FreeBASIC/Mutual-recursion new file mode 120000 index 0000000000..08b414c6c3 --- /dev/null +++ b/Lang/FreeBASIC/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Narcissistic-decimal-number b/Lang/FreeBASIC/Narcissistic-decimal-number new file mode 120000 index 0000000000..098b7d2036 --- /dev/null +++ b/Lang/FreeBASIC/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Non-decimal-radices-Convert b/Lang/FreeBASIC/Non-decimal-radices-Convert new file mode 120000 index 0000000000..5817136a0b --- /dev/null +++ b/Lang/FreeBASIC/Non-decimal-radices-Convert @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Convert/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Non-decimal-radices-Input b/Lang/FreeBASIC/Non-decimal-radices-Input new file mode 120000 index 0000000000..7be99a170d --- /dev/null +++ b/Lang/FreeBASIC/Non-decimal-radices-Input @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Input/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Non-decimal-radices-Output b/Lang/FreeBASIC/Non-decimal-radices-Output new file mode 120000 index 0000000000..6a87b0a081 --- /dev/null +++ b/Lang/FreeBASIC/Non-decimal-radices-Output @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Output/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Nth b/Lang/FreeBASIC/Nth new file mode 120000 index 0000000000..b7d005579e --- /dev/null +++ b/Lang/FreeBASIC/Nth @@ -0,0 +1 @@ +../../Task/Nth/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Null-object b/Lang/FreeBASIC/Null-object new file mode 120000 index 0000000000..3f20a83122 --- /dev/null +++ b/Lang/FreeBASIC/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Numerical-integration b/Lang/FreeBASIC/Numerical-integration new file mode 120000 index 0000000000..798dc881ab --- /dev/null +++ b/Lang/FreeBASIC/Numerical-integration @@ -0,0 +1 @@ +../../Task/Numerical-integration/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Ordered-words b/Lang/FreeBASIC/Ordered-words new file mode 120000 index 0000000000..30909d55b0 --- /dev/null +++ b/Lang/FreeBASIC/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Palindrome-detection b/Lang/FreeBASIC/Palindrome-detection new file mode 120000 index 0000000000..b1be44719d --- /dev/null +++ b/Lang/FreeBASIC/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pangram-checker b/Lang/FreeBASIC/Pangram-checker new file mode 120000 index 0000000000..4cd7985b1d --- /dev/null +++ b/Lang/FreeBASIC/Pangram-checker @@ -0,0 +1 @@ +../../Task/Pangram-checker/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pascals-triangle b/Lang/FreeBASIC/Pascals-triangle new file mode 120000 index 0000000000..6d24bd1306 --- /dev/null +++ b/Lang/FreeBASIC/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Perfect-numbers b/Lang/FreeBASIC/Perfect-numbers new file mode 120000 index 0000000000..10e993a09b --- /dev/null +++ b/Lang/FreeBASIC/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pernicious-numbers b/Lang/FreeBASIC/Pernicious-numbers new file mode 120000 index 0000000000..97edac0d23 --- /dev/null +++ b/Lang/FreeBASIC/Pernicious-numbers @@ -0,0 +1 @@ +../../Task/Pernicious-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Phrase-reversals b/Lang/FreeBASIC/Phrase-reversals new file mode 120000 index 0000000000..e2df95410a --- /dev/null +++ b/Lang/FreeBASIC/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pick-random-element b/Lang/FreeBASIC/Pick-random-element new file mode 120000 index 0000000000..8fe2ef3fb1 --- /dev/null +++ b/Lang/FreeBASIC/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pointers-and-references b/Lang/FreeBASIC/Pointers-and-references new file mode 120000 index 0000000000..c7c9ad98a8 --- /dev/null +++ b/Lang/FreeBASIC/Pointers-and-references @@ -0,0 +1 @@ +../../Task/Pointers-and-references/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Polynomial-regression b/Lang/FreeBASIC/Polynomial-regression new file mode 120000 index 0000000000..9682382183 --- /dev/null +++ b/Lang/FreeBASIC/Polynomial-regression @@ -0,0 +1 @@ +../../Task/Polynomial-regression/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Price-fraction b/Lang/FreeBASIC/Price-fraction new file mode 120000 index 0000000000..368b0b4fe1 --- /dev/null +++ b/Lang/FreeBASIC/Price-fraction @@ -0,0 +1 @@ +../../Task/Price-fraction/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Primality-by-trial-division b/Lang/FreeBASIC/Primality-by-trial-division new file mode 120000 index 0000000000..32e2bef230 --- /dev/null +++ b/Lang/FreeBASIC/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Prime-decomposition b/Lang/FreeBASIC/Prime-decomposition new file mode 120000 index 0000000000..9957b3a563 --- /dev/null +++ b/Lang/FreeBASIC/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Probabilistic-choice b/Lang/FreeBASIC/Probabilistic-choice new file mode 120000 index 0000000000..cc5deca28f --- /dev/null +++ b/Lang/FreeBASIC/Probabilistic-choice @@ -0,0 +1 @@ +../../Task/Probabilistic-choice/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Program-name b/Lang/FreeBASIC/Program-name new file mode 120000 index 0000000000..b103502a19 --- /dev/null +++ b/Lang/FreeBASIC/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Program-termination b/Lang/FreeBASIC/Program-termination new file mode 120000 index 0000000000..e17937d422 --- /dev/null +++ b/Lang/FreeBASIC/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pythagorean-triples b/Lang/FreeBASIC/Pythagorean-triples new file mode 120000 index 0000000000..0059770017 --- /dev/null +++ b/Lang/FreeBASIC/Pythagorean-triples @@ -0,0 +1 @@ +../../Task/Pythagorean-triples/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/README b/Lang/FreeBASIC/README new file mode 100644 index 0000000000..37745999d8 --- /dev/null +++ b/Lang/FreeBASIC/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:FreeBASIC diff --git a/Lang/FreeBASIC/RIPEMD-160 b/Lang/FreeBASIC/RIPEMD-160 new file mode 120000 index 0000000000..43533e8acc --- /dev/null +++ b/Lang/FreeBASIC/RIPEMD-160 @@ -0,0 +1 @@ +../../Task/RIPEMD-160/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Random-number-generator--device- b/Lang/FreeBASIC/Random-number-generator--device- new file mode 120000 index 0000000000..3553155656 --- /dev/null +++ b/Lang/FreeBASIC/Random-number-generator--device- @@ -0,0 +1 @@ +../../Task/Random-number-generator--device-/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Random-numbers b/Lang/FreeBASIC/Random-numbers new file mode 120000 index 0000000000..c75abceecc --- /dev/null +++ b/Lang/FreeBASIC/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Range-expansion b/Lang/FreeBASIC/Range-expansion new file mode 120000 index 0000000000..a76fbfb388 --- /dev/null +++ b/Lang/FreeBASIC/Range-expansion @@ -0,0 +1 @@ +../../Task/Range-expansion/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Range-extraction b/Lang/FreeBASIC/Range-extraction new file mode 120000 index 0000000000..8428a3d939 --- /dev/null +++ b/Lang/FreeBASIC/Range-extraction @@ -0,0 +1 @@ +../../Task/Range-extraction/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Ray-casting-algorithm b/Lang/FreeBASIC/Ray-casting-algorithm new file mode 120000 index 0000000000..72d555d737 --- /dev/null +++ b/Lang/FreeBASIC/Ray-casting-algorithm @@ -0,0 +1 @@ +../../Task/Ray-casting-algorithm/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Read-a-configuration-file b/Lang/FreeBASIC/Read-a-configuration-file new file mode 120000 index 0000000000..3e2d1148f4 --- /dev/null +++ b/Lang/FreeBASIC/Read-a-configuration-file @@ -0,0 +1 @@ +../../Task/Read-a-configuration-file/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Read-a-file-line-by-line b/Lang/FreeBASIC/Read-a-file-line-by-line new file mode 120000 index 0000000000..969d4dfe36 --- /dev/null +++ b/Lang/FreeBASIC/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Read-a-specific-line-from-a-file b/Lang/FreeBASIC/Read-a-specific-line-from-a-file new file mode 120000 index 0000000000..91df6b7564 --- /dev/null +++ b/Lang/FreeBASIC/Read-a-specific-line-from-a-file @@ -0,0 +1 @@ +../../Task/Read-a-specific-line-from-a-file/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Read-entire-file b/Lang/FreeBASIC/Read-entire-file new file mode 120000 index 0000000000..1153753679 --- /dev/null +++ b/Lang/FreeBASIC/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Real-constants-and-functions b/Lang/FreeBASIC/Real-constants-and-functions new file mode 120000 index 0000000000..d1c57cb119 --- /dev/null +++ b/Lang/FreeBASIC/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Remove-duplicate-elements b/Lang/FreeBASIC/Remove-duplicate-elements new file mode 120000 index 0000000000..64a99fc256 --- /dev/null +++ b/Lang/FreeBASIC/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Remove-lines-from-a-file b/Lang/FreeBASIC/Remove-lines-from-a-file new file mode 120000 index 0000000000..c5ab8a9305 --- /dev/null +++ b/Lang/FreeBASIC/Remove-lines-from-a-file @@ -0,0 +1 @@ +../../Task/Remove-lines-from-a-file/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Rename-a-file b/Lang/FreeBASIC/Rename-a-file new file mode 120000 index 0000000000..82faedf18e --- /dev/null +++ b/Lang/FreeBASIC/Rename-a-file @@ -0,0 +1 @@ +../../Task/Rename-a-file/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Repeat-a-string b/Lang/FreeBASIC/Repeat-a-string new file mode 120000 index 0000000000..b769dc7b91 --- /dev/null +++ b/Lang/FreeBASIC/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Return-multiple-values b/Lang/FreeBASIC/Return-multiple-values new file mode 120000 index 0000000000..4480f86914 --- /dev/null +++ b/Lang/FreeBASIC/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Reverse-a-string b/Lang/FreeBASIC/Reverse-a-string new file mode 120000 index 0000000000..7690a87bf1 --- /dev/null +++ b/Lang/FreeBASIC/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Reverse-words-in-a-string b/Lang/FreeBASIC/Reverse-words-in-a-string new file mode 120000 index 0000000000..4c8c663c29 --- /dev/null +++ b/Lang/FreeBASIC/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Roman-numerals-Decode b/Lang/FreeBASIC/Roman-numerals-Decode new file mode 120000 index 0000000000..0d64d0211c --- /dev/null +++ b/Lang/FreeBASIC/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Roman-numerals-Encode b/Lang/FreeBASIC/Roman-numerals-Encode new file mode 120000 index 0000000000..10994ec271 --- /dev/null +++ b/Lang/FreeBASIC/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Rot-13 b/Lang/FreeBASIC/Rot-13 new file mode 120000 index 0000000000..ed40feddd6 --- /dev/null +++ b/Lang/FreeBASIC/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Runge-Kutta-method b/Lang/FreeBASIC/Runge-Kutta-method new file mode 120000 index 0000000000..9bf9b1faae --- /dev/null +++ b/Lang/FreeBASIC/Runge-Kutta-method @@ -0,0 +1 @@ +../../Task/Runge-Kutta-method/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/SEDOLs b/Lang/FreeBASIC/SEDOLs new file mode 120000 index 0000000000..1838033d94 --- /dev/null +++ b/Lang/FreeBASIC/SEDOLs @@ -0,0 +1 @@ +../../Task/SEDOLs/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/SHA-1 b/Lang/FreeBASIC/SHA-1 new file mode 120000 index 0000000000..a8edb1b4ea --- /dev/null +++ b/Lang/FreeBASIC/SHA-1 @@ -0,0 +1 @@ +../../Task/SHA-1/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/SHA-256 b/Lang/FreeBASIC/SHA-256 new file mode 120000 index 0000000000..4827559543 --- /dev/null +++ b/Lang/FreeBASIC/SHA-256 @@ -0,0 +1 @@ +../../Task/SHA-256/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Self-describing-numbers b/Lang/FreeBASIC/Self-describing-numbers new file mode 120000 index 0000000000..375f08dd77 --- /dev/null +++ b/Lang/FreeBASIC/Self-describing-numbers @@ -0,0 +1 @@ +../../Task/Self-describing-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Semordnilap b/Lang/FreeBASIC/Semordnilap new file mode 120000 index 0000000000..1c5e72b9a8 --- /dev/null +++ b/Lang/FreeBASIC/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sequence-of-non-squares b/Lang/FreeBASIC/Sequence-of-non-squares new file mode 120000 index 0000000000..6acc27fd74 --- /dev/null +++ b/Lang/FreeBASIC/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sequence-of-primes-by-Trial-Division b/Lang/FreeBASIC/Sequence-of-primes-by-Trial-Division new file mode 120000 index 0000000000..3e17f8f22c --- /dev/null +++ b/Lang/FreeBASIC/Sequence-of-primes-by-Trial-Division @@ -0,0 +1 @@ +../../Task/Sequence-of-primes-by-Trial-Division/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Shell-one-liner b/Lang/FreeBASIC/Shell-one-liner new file mode 120000 index 0000000000..aa8910e048 --- /dev/null +++ b/Lang/FreeBASIC/Shell-one-liner @@ -0,0 +1 @@ +../../Task/Shell-one-liner/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Short-circuit-evaluation b/Lang/FreeBASIC/Short-circuit-evaluation new file mode 120000 index 0000000000..0411e625f3 --- /dev/null +++ b/Lang/FreeBASIC/Short-circuit-evaluation @@ -0,0 +1 @@ +../../Task/Short-circuit-evaluation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Show-the-epoch b/Lang/FreeBASIC/Show-the-epoch new file mode 120000 index 0000000000..fc7872d4f6 --- /dev/null +++ b/Lang/FreeBASIC/Show-the-epoch @@ -0,0 +1 @@ +../../Task/Show-the-epoch/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sierpinski-triangle-Graphical b/Lang/FreeBASIC/Sierpinski-triangle-Graphical new file mode 120000 index 0000000000..055ba7ea53 --- /dev/null +++ b/Lang/FreeBASIC/Sierpinski-triangle-Graphical @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle-Graphical/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sieve-of-Eratosthenes b/Lang/FreeBASIC/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..04e2d2bff7 --- /dev/null +++ b/Lang/FreeBASIC/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Simple-windowed-application b/Lang/FreeBASIC/Simple-windowed-application new file mode 120000 index 0000000000..67c53ae8a1 --- /dev/null +++ b/Lang/FreeBASIC/Simple-windowed-application @@ -0,0 +1 @@ +../../Task/Simple-windowed-application/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sleep b/Lang/FreeBASIC/Sleep new file mode 120000 index 0000000000..f0e219714d --- /dev/null +++ b/Lang/FreeBASIC/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sort-an-integer-array b/Lang/FreeBASIC/Sort-an-integer-array new file mode 120000 index 0000000000..40cef4697e --- /dev/null +++ b/Lang/FreeBASIC/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sort-using-a-custom-comparator b/Lang/FreeBASIC/Sort-using-a-custom-comparator new file mode 120000 index 0000000000..8735262469 --- /dev/null +++ b/Lang/FreeBASIC/Sort-using-a-custom-comparator @@ -0,0 +1 @@ +../../Task/Sort-using-a-custom-comparator/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-algorithms-Bubble-sort b/Lang/FreeBASIC/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..cb39af2641 --- /dev/null +++ b/Lang/FreeBASIC/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-algorithms-Cocktail-sort b/Lang/FreeBASIC/Sorting-algorithms-Cocktail-sort new file mode 120000 index 0000000000..5de0d0be5e --- /dev/null +++ b/Lang/FreeBASIC/Sorting-algorithms-Cocktail-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Cocktail-sort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-algorithms-Comb-sort b/Lang/FreeBASIC/Sorting-algorithms-Comb-sort new file mode 120000 index 0000000000..50d56c5580 --- /dev/null +++ b/Lang/FreeBASIC/Sorting-algorithms-Comb-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Comb-sort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-algorithms-Counting-sort b/Lang/FreeBASIC/Sorting-algorithms-Counting-sort new file mode 120000 index 0000000000..5f92cba007 --- /dev/null +++ b/Lang/FreeBASIC/Sorting-algorithms-Counting-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Counting-sort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-algorithms-Gnome-sort b/Lang/FreeBASIC/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..1949874f27 --- /dev/null +++ b/Lang/FreeBASIC/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-algorithms-Heapsort b/Lang/FreeBASIC/Sorting-algorithms-Heapsort new file mode 120000 index 0000000000..1c5c578259 --- /dev/null +++ b/Lang/FreeBASIC/Sorting-algorithms-Heapsort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Heapsort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-algorithms-Insertion-sort b/Lang/FreeBASIC/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..48ff100378 --- /dev/null +++ b/Lang/FreeBASIC/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-algorithms-Quicksort b/Lang/FreeBASIC/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..afd29b5348 --- /dev/null +++ b/Lang/FreeBASIC/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-algorithms-Selection-sort b/Lang/FreeBASIC/Sorting-algorithms-Selection-sort new file mode 120000 index 0000000000..27c6b03711 --- /dev/null +++ b/Lang/FreeBASIC/Sorting-algorithms-Selection-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Selection-sort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-algorithms-Shell-sort b/Lang/FreeBASIC/Sorting-algorithms-Shell-sort new file mode 120000 index 0000000000..5fd88d2afa --- /dev/null +++ b/Lang/FreeBASIC/Sorting-algorithms-Shell-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Shell-sort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-algorithms-Sleep-sort b/Lang/FreeBASIC/Sorting-algorithms-Sleep-sort new file mode 120000 index 0000000000..bbc44ec126 --- /dev/null +++ b/Lang/FreeBASIC/Sorting-algorithms-Sleep-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Sleep-sort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-algorithms-Stooge-sort b/Lang/FreeBASIC/Sorting-algorithms-Stooge-sort new file mode 120000 index 0000000000..283d0415b1 --- /dev/null +++ b/Lang/FreeBASIC/Sorting-algorithms-Stooge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Stooge-sort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Spiral-matrix b/Lang/FreeBASIC/Spiral-matrix new file mode 120000 index 0000000000..0a9cb77380 --- /dev/null +++ b/Lang/FreeBASIC/Spiral-matrix @@ -0,0 +1 @@ +../../Task/Spiral-matrix/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Start-from-a-main-routine b/Lang/FreeBASIC/Start-from-a-main-routine new file mode 120000 index 0000000000..dd680b32da --- /dev/null +++ b/Lang/FreeBASIC/Start-from-a-main-routine @@ -0,0 +1 @@ +../../Task/Start-from-a-main-routine/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Statistics-Basic b/Lang/FreeBASIC/Statistics-Basic new file mode 120000 index 0000000000..64d03449c0 --- /dev/null +++ b/Lang/FreeBASIC/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Stem-and-leaf-plot b/Lang/FreeBASIC/Stem-and-leaf-plot new file mode 120000 index 0000000000..34fe440791 --- /dev/null +++ b/Lang/FreeBASIC/Stem-and-leaf-plot @@ -0,0 +1 @@ +../../Task/Stem-and-leaf-plot/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/String-append b/Lang/FreeBASIC/String-append new file mode 120000 index 0000000000..dd91c0c58b --- /dev/null +++ b/Lang/FreeBASIC/String-append @@ -0,0 +1 @@ +../../Task/String-append/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/String-case b/Lang/FreeBASIC/String-case new file mode 120000 index 0000000000..b9cedb0365 --- /dev/null +++ b/Lang/FreeBASIC/String-case @@ -0,0 +1 @@ +../../Task/String-case/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/String-comparison b/Lang/FreeBASIC/String-comparison new file mode 120000 index 0000000000..e6ed5fd713 --- /dev/null +++ b/Lang/FreeBASIC/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/String-concatenation b/Lang/FreeBASIC/String-concatenation new file mode 120000 index 0000000000..c4bf5d4973 --- /dev/null +++ b/Lang/FreeBASIC/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/String-interpolation--included- b/Lang/FreeBASIC/String-interpolation--included- new file mode 120000 index 0000000000..4672801a00 --- /dev/null +++ b/Lang/FreeBASIC/String-interpolation--included- @@ -0,0 +1 @@ +../../Task/String-interpolation--included-/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/String-length b/Lang/FreeBASIC/String-length new file mode 120000 index 0000000000..c8d6e9bc85 --- /dev/null +++ b/Lang/FreeBASIC/String-length @@ -0,0 +1 @@ +../../Task/String-length/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/String-matching b/Lang/FreeBASIC/String-matching new file mode 120000 index 0000000000..7dbfde711d --- /dev/null +++ b/Lang/FreeBASIC/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/String-prepend b/Lang/FreeBASIC/String-prepend new file mode 120000 index 0000000000..3a2c80b9de --- /dev/null +++ b/Lang/FreeBASIC/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Strip-a-set-of-characters-from-a-string b/Lang/FreeBASIC/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..caa04dacfe --- /dev/null +++ b/Lang/FreeBASIC/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Strip-comments-from-a-string b/Lang/FreeBASIC/Strip-comments-from-a-string new file mode 120000 index 0000000000..b570baa240 --- /dev/null +++ b/Lang/FreeBASIC/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Strip-control-codes-and-extended-characters-from-a-string b/Lang/FreeBASIC/Strip-control-codes-and-extended-characters-from-a-string new file mode 120000 index 0000000000..a09d18391f --- /dev/null +++ b/Lang/FreeBASIC/Strip-control-codes-and-extended-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-control-codes-and-extended-characters-from-a-string/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Strip-whitespace-from-a-string-Top-and-tail b/Lang/FreeBASIC/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..d9a032b5bb --- /dev/null +++ b/Lang/FreeBASIC/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Substring b/Lang/FreeBASIC/Substring new file mode 120000 index 0000000000..2547faee97 --- /dev/null +++ b/Lang/FreeBASIC/Substring @@ -0,0 +1 @@ +../../Task/Substring/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Substring-Top-and-tail b/Lang/FreeBASIC/Substring-Top-and-tail new file mode 120000 index 0000000000..7f1e36f604 --- /dev/null +++ b/Lang/FreeBASIC/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sum-and-product-of-an-array b/Lang/FreeBASIC/Sum-and-product-of-an-array new file mode 120000 index 0000000000..9df2d1608b --- /dev/null +++ b/Lang/FreeBASIC/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sum-digits-of-an-integer b/Lang/FreeBASIC/Sum-digits-of-an-integer new file mode 120000 index 0000000000..b9642efccc --- /dev/null +++ b/Lang/FreeBASIC/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sum-multiples-of-3-and-5 b/Lang/FreeBASIC/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..d4aede56b9 --- /dev/null +++ b/Lang/FreeBASIC/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sum-of-a-series b/Lang/FreeBASIC/Sum-of-a-series new file mode 120000 index 0000000000..95b8712a94 --- /dev/null +++ b/Lang/FreeBASIC/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sum-of-squares b/Lang/FreeBASIC/Sum-of-squares new file mode 120000 index 0000000000..ad92d249d3 --- /dev/null +++ b/Lang/FreeBASIC/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/System-time b/Lang/FreeBASIC/System-time new file mode 120000 index 0000000000..1b9c5a6bba --- /dev/null +++ b/Lang/FreeBASIC/System-time @@ -0,0 +1 @@ +../../Task/System-time/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Temperature-conversion b/Lang/FreeBASIC/Temperature-conversion new file mode 120000 index 0000000000..94f2d6c9a8 --- /dev/null +++ b/Lang/FreeBASIC/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Terminal-control-Clear-the-screen b/Lang/FreeBASIC/Terminal-control-Clear-the-screen new file mode 120000 index 0000000000..4a763ae125 --- /dev/null +++ b/Lang/FreeBASIC/Terminal-control-Clear-the-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Clear-the-screen/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Terminal-control-Ringing-the-terminal-bell b/Lang/FreeBASIC/Terminal-control-Ringing-the-terminal-bell new file mode 120000 index 0000000000..fe56136a2e --- /dev/null +++ b/Lang/FreeBASIC/Terminal-control-Ringing-the-terminal-bell @@ -0,0 +1 @@ +../../Task/Terminal-control-Ringing-the-terminal-bell/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/The-ISAAC-Cipher b/Lang/FreeBASIC/The-ISAAC-Cipher new file mode 120000 index 0000000000..e0e1c20e81 --- /dev/null +++ b/Lang/FreeBASIC/The-ISAAC-Cipher @@ -0,0 +1 @@ +../../Task/The-ISAAC-Cipher/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/The-Twelve-Days-of-Christmas b/Lang/FreeBASIC/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..8081eb91a1 --- /dev/null +++ b/Lang/FreeBASIC/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Time-a-function b/Lang/FreeBASIC/Time-a-function new file mode 120000 index 0000000000..3d04318b7c --- /dev/null +++ b/Lang/FreeBASIC/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Topic-variable b/Lang/FreeBASIC/Topic-variable new file mode 120000 index 0000000000..412e78d76f --- /dev/null +++ b/Lang/FreeBASIC/Topic-variable @@ -0,0 +1 @@ +../../Task/Topic-variable/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Towers-of-Hanoi b/Lang/FreeBASIC/Towers-of-Hanoi new file mode 120000 index 0000000000..8c6a5b5d9a --- /dev/null +++ b/Lang/FreeBASIC/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Trabb-Pardo-Knuth-algorithm b/Lang/FreeBASIC/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..d6105bd530 --- /dev/null +++ b/Lang/FreeBASIC/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Trigonometric-functions b/Lang/FreeBASIC/Trigonometric-functions new file mode 120000 index 0000000000..d5b6c2fc0e --- /dev/null +++ b/Lang/FreeBASIC/Trigonometric-functions @@ -0,0 +1 @@ +../../Task/Trigonometric-functions/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Undefined-values b/Lang/FreeBASIC/Undefined-values new file mode 120000 index 0000000000..5fd58c038c --- /dev/null +++ b/Lang/FreeBASIC/Undefined-values @@ -0,0 +1 @@ +../../Task/Undefined-values/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Unicode-variable-names b/Lang/FreeBASIC/Unicode-variable-names new file mode 120000 index 0000000000..df79bf7e79 --- /dev/null +++ b/Lang/FreeBASIC/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Update-a-configuration-file b/Lang/FreeBASIC/Update-a-configuration-file new file mode 120000 index 0000000000..94383a833d --- /dev/null +++ b/Lang/FreeBASIC/Update-a-configuration-file @@ -0,0 +1 @@ +../../Task/Update-a-configuration-file/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/User-input-Text b/Lang/FreeBASIC/User-input-Text new file mode 120000 index 0000000000..7f673303d7 --- /dev/null +++ b/Lang/FreeBASIC/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Vampire-number b/Lang/FreeBASIC/Vampire-number new file mode 120000 index 0000000000..7451d7fc27 --- /dev/null +++ b/Lang/FreeBASIC/Vampire-number @@ -0,0 +1 @@ +../../Task/Vampire-number/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Van-der-Corput-sequence b/Lang/FreeBASIC/Van-der-Corput-sequence new file mode 120000 index 0000000000..3e7bb6c12d --- /dev/null +++ b/Lang/FreeBASIC/Van-der-Corput-sequence @@ -0,0 +1 @@ +../../Task/Van-der-Corput-sequence/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Variable-size-Get b/Lang/FreeBASIC/Variable-size-Get new file mode 120000 index 0000000000..7117ee9c84 --- /dev/null +++ b/Lang/FreeBASIC/Variable-size-Get @@ -0,0 +1 @@ +../../Task/Variable-size-Get/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Vector-products b/Lang/FreeBASIC/Vector-products new file mode 120000 index 0000000000..29745bc39f --- /dev/null +++ b/Lang/FreeBASIC/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Window-creation b/Lang/FreeBASIC/Window-creation new file mode 120000 index 0000000000..e3defc1f61 --- /dev/null +++ b/Lang/FreeBASIC/Window-creation @@ -0,0 +1 @@ +../../Task/Window-creation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Write-float-arrays-to-a-text-file b/Lang/FreeBASIC/Write-float-arrays-to-a-text-file new file mode 120000 index 0000000000..9cde41d76d --- /dev/null +++ b/Lang/FreeBASIC/Write-float-arrays-to-a-text-file @@ -0,0 +1 @@ +../../Task/Write-float-arrays-to-a-text-file/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Xiaolin-Wus-line-algorithm b/Lang/FreeBASIC/Xiaolin-Wus-line-algorithm new file mode 120000 index 0000000000..e3b76f1226 --- /dev/null +++ b/Lang/FreeBASIC/Xiaolin-Wus-line-algorithm @@ -0,0 +1 @@ +../../Task/Xiaolin-Wus-line-algorithm/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Zeckendorf-number-representation b/Lang/FreeBASIC/Zeckendorf-number-representation new file mode 120000 index 0000000000..425ea9f1e9 --- /dev/null +++ b/Lang/FreeBASIC/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Zero-to-the-zero-power b/Lang/FreeBASIC/Zero-to-the-zero-power new file mode 120000 index 0000000000..f468e9af9f --- /dev/null +++ b/Lang/FreeBASIC/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Zhang-Suen-thinning-algorithm b/Lang/FreeBASIC/Zhang-Suen-thinning-algorithm new file mode 120000 index 0000000000..a4b196a388 --- /dev/null +++ b/Lang/FreeBASIC/Zhang-Suen-thinning-algorithm @@ -0,0 +1 @@ +../../Task/Zhang-Suen-thinning-algorithm/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Zig-zag-matrix b/Lang/FreeBASIC/Zig-zag-matrix new file mode 120000 index 0000000000..b5baab438e --- /dev/null +++ b/Lang/FreeBASIC/Zig-zag-matrix @@ -0,0 +1 @@ +../../Task/Zig-zag-matrix/FreeBASIC \ No newline at end of file diff --git a/Lang/FunL/00DESCRIPTION b/Lang/FunL/00DESCRIPTION new file mode 100644 index 0000000000..73baf70fc4 --- /dev/null +++ b/Lang/FunL/00DESCRIPTION @@ -0,0 +1,5 @@ +{{language| +|site=http://edadma.github.io/funl-docs/ +}}FunL (pronounced "funnel") is a functional dynamically typed scripting language. The name FunL stands for "fun language", but it can also stand for "functional language". One goal in creating FunL was to make a scripting language that would be as enjoyable and convenient to use as Python but with the added support for pattern matching and more of an "equational" style of programming. FunL has the same kind of indentation or "off-side rule" syntax that Python has. + +Another goal in creating FunL was to have a scripting language that is highly Java and Scala interoperable. FunL is implemented in Scala and therefore relies upon both the Scala and Java runtime support libraries. \ No newline at end of file diff --git a/Lang/FunL/100-doors b/Lang/FunL/100-doors new file mode 120000 index 0000000000..00e128039c --- /dev/null +++ b/Lang/FunL/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/FunL \ No newline at end of file diff --git a/Lang/FunL/99-Bottles-of-Beer b/Lang/FunL/99-Bottles-of-Beer new file mode 120000 index 0000000000..fba441e32a --- /dev/null +++ b/Lang/FunL/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/FunL \ No newline at end of file diff --git a/Lang/FunL/A+B b/Lang/FunL/A+B new file mode 120000 index 0000000000..a5166a2c61 --- /dev/null +++ b/Lang/FunL/A+B @@ -0,0 +1 @@ +../../Task/A+B/FunL \ No newline at end of file diff --git a/Lang/FunL/Ackermann-function b/Lang/FunL/Ackermann-function new file mode 120000 index 0000000000..d90288e47f --- /dev/null +++ b/Lang/FunL/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/FunL \ No newline at end of file diff --git a/Lang/FunL/Apply-a-callback-to-an-array b/Lang/FunL/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..0a0d879335 --- /dev/null +++ b/Lang/FunL/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/FunL \ No newline at end of file diff --git a/Lang/FunL/Array-concatenation b/Lang/FunL/Array-concatenation new file mode 120000 index 0000000000..2bf351e5a3 --- /dev/null +++ b/Lang/FunL/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/FunL \ No newline at end of file diff --git a/Lang/FunL/Averages-Pythagorean-means b/Lang/FunL/Averages-Pythagorean-means new file mode 120000 index 0000000000..f05319952e --- /dev/null +++ b/Lang/FunL/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/FunL \ No newline at end of file diff --git a/Lang/FunL/Bernoulli-numbers b/Lang/FunL/Bernoulli-numbers new file mode 120000 index 0000000000..a2914dce00 --- /dev/null +++ b/Lang/FunL/Bernoulli-numbers @@ -0,0 +1 @@ +../../Task/Bernoulli-numbers/FunL \ No newline at end of file diff --git a/Lang/FunL/Binary-digits b/Lang/FunL/Binary-digits new file mode 120000 index 0000000000..561cad15d5 --- /dev/null +++ b/Lang/FunL/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/FunL \ No newline at end of file diff --git a/Lang/FunL/CSV-data-manipulation b/Lang/FunL/CSV-data-manipulation new file mode 120000 index 0000000000..2f2b0d7e6b --- /dev/null +++ b/Lang/FunL/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/FunL \ No newline at end of file diff --git a/Lang/FunL/Catalan-numbers b/Lang/FunL/Catalan-numbers new file mode 120000 index 0000000000..6960128572 --- /dev/null +++ b/Lang/FunL/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/FunL \ No newline at end of file diff --git a/Lang/FunL/Chinese-remainder-theorem b/Lang/FunL/Chinese-remainder-theorem new file mode 120000 index 0000000000..11fe375924 --- /dev/null +++ b/Lang/FunL/Chinese-remainder-theorem @@ -0,0 +1 @@ +../../Task/Chinese-remainder-theorem/FunL \ No newline at end of file diff --git a/Lang/FunL/Command-line-arguments b/Lang/FunL/Command-line-arguments new file mode 120000 index 0000000000..512d6e9afe --- /dev/null +++ b/Lang/FunL/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/FunL \ No newline at end of file diff --git a/Lang/FunL/Conways-Game-of-Life b/Lang/FunL/Conways-Game-of-Life new file mode 120000 index 0000000000..dc6162306a --- /dev/null +++ b/Lang/FunL/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/FunL \ No newline at end of file diff --git a/Lang/FunL/Count-occurrences-of-a-substring b/Lang/FunL/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..9912f250b0 --- /dev/null +++ b/Lang/FunL/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/FunL \ No newline at end of file diff --git a/Lang/FunL/Create-a-file b/Lang/FunL/Create-a-file new file mode 120000 index 0000000000..888ab78c23 --- /dev/null +++ b/Lang/FunL/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/FunL \ No newline at end of file diff --git a/Lang/FunL/Date-format b/Lang/FunL/Date-format new file mode 120000 index 0000000000..aa04be9dc4 --- /dev/null +++ b/Lang/FunL/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/FunL \ No newline at end of file diff --git a/Lang/FunL/Date-manipulation b/Lang/FunL/Date-manipulation new file mode 120000 index 0000000000..3f76a94ec2 --- /dev/null +++ b/Lang/FunL/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/FunL \ No newline at end of file diff --git a/Lang/FunL/Dot-product b/Lang/FunL/Dot-product new file mode 120000 index 0000000000..dc36a0e854 --- /dev/null +++ b/Lang/FunL/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/FunL \ No newline at end of file diff --git a/Lang/FunL/Draw-a-clock b/Lang/FunL/Draw-a-clock new file mode 120000 index 0000000000..9a6575245a --- /dev/null +++ b/Lang/FunL/Draw-a-clock @@ -0,0 +1 @@ +../../Task/Draw-a-clock/FunL \ No newline at end of file diff --git a/Lang/FunL/Empty-program b/Lang/FunL/Empty-program new file mode 120000 index 0000000000..952629195c --- /dev/null +++ b/Lang/FunL/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/FunL \ No newline at end of file diff --git a/Lang/FunL/Environment-variables b/Lang/FunL/Environment-variables new file mode 120000 index 0000000000..32261b386d --- /dev/null +++ b/Lang/FunL/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/FunL \ No newline at end of file diff --git a/Lang/FunL/Evaluate-binomial-coefficients b/Lang/FunL/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..44a5128f73 --- /dev/null +++ b/Lang/FunL/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/FunL \ No newline at end of file diff --git a/Lang/FunL/Execute-a-system-command b/Lang/FunL/Execute-a-system-command new file mode 120000 index 0000000000..272db1c592 --- /dev/null +++ b/Lang/FunL/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/FunL \ No newline at end of file diff --git a/Lang/FunL/Factorial b/Lang/FunL/Factorial new file mode 120000 index 0000000000..6b9ff7510d --- /dev/null +++ b/Lang/FunL/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/FunL \ No newline at end of file diff --git a/Lang/FunL/Factors-of-an-integer b/Lang/FunL/Factors-of-an-integer new file mode 120000 index 0000000000..fa7cd45a17 --- /dev/null +++ b/Lang/FunL/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/FunL \ No newline at end of file diff --git a/Lang/FunL/Fibonacci-n-step-number-sequences b/Lang/FunL/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..7f8e29ce3a --- /dev/null +++ b/Lang/FunL/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/FunL \ No newline at end of file diff --git a/Lang/FunL/Fibonacci-sequence b/Lang/FunL/Fibonacci-sequence new file mode 120000 index 0000000000..30d2632811 --- /dev/null +++ b/Lang/FunL/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/FunL \ No newline at end of file diff --git a/Lang/FunL/Function-composition b/Lang/FunL/Function-composition new file mode 120000 index 0000000000..3790c6790a --- /dev/null +++ b/Lang/FunL/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/FunL \ No newline at end of file diff --git a/Lang/FunL/Generator-Exponential b/Lang/FunL/Generator-Exponential new file mode 120000 index 0000000000..3385f06741 --- /dev/null +++ b/Lang/FunL/Generator-Exponential @@ -0,0 +1 @@ +../../Task/Generator-Exponential/FunL \ No newline at end of file diff --git a/Lang/FunL/Greatest-common-divisor b/Lang/FunL/Greatest-common-divisor new file mode 120000 index 0000000000..2fe8478810 --- /dev/null +++ b/Lang/FunL/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/FunL \ No newline at end of file diff --git a/Lang/FunL/Greatest-element-of-a-list b/Lang/FunL/Greatest-element-of-a-list new file mode 120000 index 0000000000..d778a6cd10 --- /dev/null +++ b/Lang/FunL/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/FunL \ No newline at end of file diff --git a/Lang/FunL/Hailstone-sequence b/Lang/FunL/Hailstone-sequence new file mode 120000 index 0000000000..8c38e53801 --- /dev/null +++ b/Lang/FunL/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/FunL \ No newline at end of file diff --git a/Lang/FunL/Hamming-numbers b/Lang/FunL/Hamming-numbers new file mode 120000 index 0000000000..f40a456d0e --- /dev/null +++ b/Lang/FunL/Hamming-numbers @@ -0,0 +1 @@ +../../Task/Hamming-numbers/FunL \ No newline at end of file diff --git a/Lang/FunL/Haversine-formula b/Lang/FunL/Haversine-formula new file mode 120000 index 0000000000..c70fb6937d --- /dev/null +++ b/Lang/FunL/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/FunL \ No newline at end of file diff --git a/Lang/FunL/Hello-world-Graphical b/Lang/FunL/Hello-world-Graphical new file mode 120000 index 0000000000..ef22fe413d --- /dev/null +++ b/Lang/FunL/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/FunL \ No newline at end of file diff --git a/Lang/FunL/Hello-world-Text b/Lang/FunL/Hello-world-Text new file mode 120000 index 0000000000..7e778d5d83 --- /dev/null +++ b/Lang/FunL/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/FunL \ No newline at end of file diff --git a/Lang/FunL/Hello-world-Web-server b/Lang/FunL/Hello-world-Web-server new file mode 120000 index 0000000000..a424bd0073 --- /dev/null +++ b/Lang/FunL/Hello-world-Web-server @@ -0,0 +1 @@ +../../Task/Hello-world-Web-server/FunL \ No newline at end of file diff --git a/Lang/FunL/Horners-rule-for-polynomial-evaluation b/Lang/FunL/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..938ed9dac3 --- /dev/null +++ b/Lang/FunL/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/FunL \ No newline at end of file diff --git a/Lang/FunL/Identity-matrix b/Lang/FunL/Identity-matrix new file mode 120000 index 0000000000..dc68e31c6d --- /dev/null +++ b/Lang/FunL/Identity-matrix @@ -0,0 +1 @@ +../../Task/Identity-matrix/FunL \ No newline at end of file diff --git a/Lang/FunL/Integer-comparison b/Lang/FunL/Integer-comparison new file mode 120000 index 0000000000..759c04870b --- /dev/null +++ b/Lang/FunL/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/FunL \ No newline at end of file diff --git a/Lang/FunL/Integer-sequence b/Lang/FunL/Integer-sequence new file mode 120000 index 0000000000..01d16bb0e7 --- /dev/null +++ b/Lang/FunL/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/FunL \ No newline at end of file diff --git a/Lang/FunL/JSON b/Lang/FunL/JSON new file mode 120000 index 0000000000..84e7350a0b --- /dev/null +++ b/Lang/FunL/JSON @@ -0,0 +1 @@ +../../Task/JSON/FunL \ No newline at end of file diff --git a/Lang/FunL/Knuth-shuffle b/Lang/FunL/Knuth-shuffle new file mode 120000 index 0000000000..3ea1be97a9 --- /dev/null +++ b/Lang/FunL/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/FunL \ No newline at end of file diff --git a/Lang/FunL/Least-common-multiple b/Lang/FunL/Least-common-multiple new file mode 120000 index 0000000000..56751b48da --- /dev/null +++ b/Lang/FunL/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/FunL \ No newline at end of file diff --git a/Lang/FunL/List-comprehensions b/Lang/FunL/List-comprehensions new file mode 120000 index 0000000000..8640689243 --- /dev/null +++ b/Lang/FunL/List-comprehensions @@ -0,0 +1 @@ +../../Task/List-comprehensions/FunL \ No newline at end of file diff --git a/Lang/FunL/Logical-operations b/Lang/FunL/Logical-operations new file mode 120000 index 0000000000..fa6a949bf4 --- /dev/null +++ b/Lang/FunL/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/FunL \ No newline at end of file diff --git a/Lang/FunL/Loop-over-multiple-arrays-simultaneously b/Lang/FunL/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..82a4b0f203 --- /dev/null +++ b/Lang/FunL/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/FunL \ No newline at end of file diff --git a/Lang/FunL/Lucas-Lehmer-test b/Lang/FunL/Lucas-Lehmer-test new file mode 120000 index 0000000000..ee7d28e9df --- /dev/null +++ b/Lang/FunL/Lucas-Lehmer-test @@ -0,0 +1 @@ +../../Task/Lucas-Lehmer-test/FunL \ No newline at end of file diff --git a/Lang/FunL/Luhn-test-of-credit-card-numbers b/Lang/FunL/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..d46f71494c --- /dev/null +++ b/Lang/FunL/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/FunL \ No newline at end of file diff --git a/Lang/FunL/Matrix-arithmetic b/Lang/FunL/Matrix-arithmetic new file mode 120000 index 0000000000..0c75168c3e --- /dev/null +++ b/Lang/FunL/Matrix-arithmetic @@ -0,0 +1 @@ +../../Task/Matrix-arithmetic/FunL \ No newline at end of file diff --git a/Lang/FunL/Modular-inverse b/Lang/FunL/Modular-inverse new file mode 120000 index 0000000000..bf9bac88d0 --- /dev/null +++ b/Lang/FunL/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/FunL \ No newline at end of file diff --git a/Lang/FunL/Multifactorial b/Lang/FunL/Multifactorial new file mode 120000 index 0000000000..029d7490a6 --- /dev/null +++ b/Lang/FunL/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/FunL \ No newline at end of file diff --git a/Lang/FunL/Narcissistic-decimal-number b/Lang/FunL/Narcissistic-decimal-number new file mode 120000 index 0000000000..cd81972a6f --- /dev/null +++ b/Lang/FunL/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/FunL \ No newline at end of file diff --git a/Lang/FunL/Non-decimal-radices-Convert b/Lang/FunL/Non-decimal-radices-Convert new file mode 120000 index 0000000000..ba10f44f9e --- /dev/null +++ b/Lang/FunL/Non-decimal-radices-Convert @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Convert/FunL \ No newline at end of file diff --git a/Lang/FunL/Parsing-RPN-calculator-algorithm b/Lang/FunL/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..7cf3ce87e5 --- /dev/null +++ b/Lang/FunL/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/FunL \ No newline at end of file diff --git a/Lang/FunL/Partial-function-application b/Lang/FunL/Partial-function-application new file mode 120000 index 0000000000..8fe31ec832 --- /dev/null +++ b/Lang/FunL/Partial-function-application @@ -0,0 +1 @@ +../../Task/Partial-function-application/FunL \ No newline at end of file diff --git a/Lang/FunL/Pascals-triangle b/Lang/FunL/Pascals-triangle new file mode 120000 index 0000000000..0616acaff5 --- /dev/null +++ b/Lang/FunL/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/FunL \ No newline at end of file diff --git a/Lang/FunL/Perfect-numbers b/Lang/FunL/Perfect-numbers new file mode 120000 index 0000000000..e819e9219b --- /dev/null +++ b/Lang/FunL/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/FunL \ No newline at end of file diff --git a/Lang/FunL/Pi b/Lang/FunL/Pi new file mode 120000 index 0000000000..4a9c09a806 --- /dev/null +++ b/Lang/FunL/Pi @@ -0,0 +1 @@ +../../Task/Pi/FunL \ No newline at end of file diff --git a/Lang/FunL/Power-set b/Lang/FunL/Power-set new file mode 120000 index 0000000000..1c9c2e37ae --- /dev/null +++ b/Lang/FunL/Power-set @@ -0,0 +1 @@ +../../Task/Power-set/FunL \ No newline at end of file diff --git a/Lang/FunL/Primality-by-trial-division b/Lang/FunL/Primality-by-trial-division new file mode 120000 index 0000000000..3d39ae3091 --- /dev/null +++ b/Lang/FunL/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/FunL \ No newline at end of file diff --git a/Lang/FunL/Priority-queue b/Lang/FunL/Priority-queue new file mode 120000 index 0000000000..8d5f65b0f9 --- /dev/null +++ b/Lang/FunL/Priority-queue @@ -0,0 +1 @@ +../../Task/Priority-queue/FunL \ No newline at end of file diff --git a/Lang/FunL/README b/Lang/FunL/README new file mode 100644 index 0000000000..9e3d26e863 --- /dev/null +++ b/Lang/FunL/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:FunL diff --git a/Lang/FunL/Return-multiple-values b/Lang/FunL/Return-multiple-values new file mode 120000 index 0000000000..636119a0e8 --- /dev/null +++ b/Lang/FunL/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/FunL \ No newline at end of file diff --git a/Lang/FunL/Roots-of-unity b/Lang/FunL/Roots-of-unity new file mode 120000 index 0000000000..1a91af8e4b --- /dev/null +++ b/Lang/FunL/Roots-of-unity @@ -0,0 +1 @@ +../../Task/Roots-of-unity/FunL \ No newline at end of file diff --git a/Lang/FunL/Rot-13 b/Lang/FunL/Rot-13 new file mode 120000 index 0000000000..81a6c45cc0 --- /dev/null +++ b/Lang/FunL/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/FunL \ No newline at end of file diff --git a/Lang/FunL/SHA-256 b/Lang/FunL/SHA-256 new file mode 120000 index 0000000000..2e2b89e668 --- /dev/null +++ b/Lang/FunL/SHA-256 @@ -0,0 +1 @@ +../../Task/SHA-256/FunL \ No newline at end of file diff --git a/Lang/FunL/Set b/Lang/FunL/Set new file mode 120000 index 0000000000..43ef8325ca --- /dev/null +++ b/Lang/FunL/Set @@ -0,0 +1 @@ +../../Task/Set/FunL \ No newline at end of file diff --git a/Lang/FunL/Sort-an-integer-array b/Lang/FunL/Sort-an-integer-array new file mode 120000 index 0000000000..efad7b2a42 --- /dev/null +++ b/Lang/FunL/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/FunL \ No newline at end of file diff --git a/Lang/FunL/Sort-using-a-custom-comparator b/Lang/FunL/Sort-using-a-custom-comparator new file mode 120000 index 0000000000..fbf58aa5e8 --- /dev/null +++ b/Lang/FunL/Sort-using-a-custom-comparator @@ -0,0 +1 @@ +../../Task/Sort-using-a-custom-comparator/FunL \ No newline at end of file diff --git a/Lang/FunL/Sorting-algorithms-Heapsort b/Lang/FunL/Sorting-algorithms-Heapsort new file mode 120000 index 0000000000..56be2f6d1d --- /dev/null +++ b/Lang/FunL/Sorting-algorithms-Heapsort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Heapsort/FunL \ No newline at end of file diff --git a/Lang/FunL/Sorting-algorithms-Merge-sort b/Lang/FunL/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..f79fa87b1f --- /dev/null +++ b/Lang/FunL/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/FunL \ No newline at end of file diff --git a/Lang/FunL/Sorting-algorithms-Quicksort b/Lang/FunL/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..f7d3a75601 --- /dev/null +++ b/Lang/FunL/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/FunL \ No newline at end of file diff --git a/Lang/FunL/String-interpolation--included- b/Lang/FunL/String-interpolation--included- new file mode 120000 index 0000000000..d628491b74 --- /dev/null +++ b/Lang/FunL/String-interpolation--included- @@ -0,0 +1 @@ +../../Task/String-interpolation--included-/FunL \ No newline at end of file diff --git a/Lang/FunL/Table-creation-Postal-addresses b/Lang/FunL/Table-creation-Postal-addresses new file mode 120000 index 0000000000..bd2532ef40 --- /dev/null +++ b/Lang/FunL/Table-creation-Postal-addresses @@ -0,0 +1 @@ +../../Task/Table-creation-Postal-addresses/FunL \ No newline at end of file diff --git a/Lang/FunL/Terminal-control-Coloured-text b/Lang/FunL/Terminal-control-Coloured-text new file mode 120000 index 0000000000..5feeab6019 --- /dev/null +++ b/Lang/FunL/Terminal-control-Coloured-text @@ -0,0 +1 @@ +../../Task/Terminal-control-Coloured-text/FunL \ No newline at end of file diff --git a/Lang/FunL/Terminal-control-Hiding-the-cursor b/Lang/FunL/Terminal-control-Hiding-the-cursor new file mode 120000 index 0000000000..694170765a --- /dev/null +++ b/Lang/FunL/Terminal-control-Hiding-the-cursor @@ -0,0 +1 @@ +../../Task/Terminal-control-Hiding-the-cursor/FunL \ No newline at end of file diff --git a/Lang/FunL/Terminal-control-Inverse-video b/Lang/FunL/Terminal-control-Inverse-video new file mode 120000 index 0000000000..359991887b --- /dev/null +++ b/Lang/FunL/Terminal-control-Inverse-video @@ -0,0 +1 @@ +../../Task/Terminal-control-Inverse-video/FunL \ No newline at end of file diff --git a/Lang/FunL/Terminal-control-Unicode-output b/Lang/FunL/Terminal-control-Unicode-output new file mode 120000 index 0000000000..b28e70c4e8 --- /dev/null +++ b/Lang/FunL/Terminal-control-Unicode-output @@ -0,0 +1 @@ +../../Task/Terminal-control-Unicode-output/FunL \ No newline at end of file diff --git a/Lang/FunL/Top-rank-per-group b/Lang/FunL/Top-rank-per-group new file mode 120000 index 0000000000..d777810385 --- /dev/null +++ b/Lang/FunL/Top-rank-per-group @@ -0,0 +1 @@ +../../Task/Top-rank-per-group/FunL \ No newline at end of file diff --git a/Lang/FunL/Topological-sort b/Lang/FunL/Topological-sort new file mode 120000 index 0000000000..a3ceffbf9f --- /dev/null +++ b/Lang/FunL/Topological-sort @@ -0,0 +1 @@ +../../Task/Topological-sort/FunL \ No newline at end of file diff --git a/Lang/FunL/Tree-traversal b/Lang/FunL/Tree-traversal new file mode 120000 index 0000000000..a7d8664b4b --- /dev/null +++ b/Lang/FunL/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/FunL \ No newline at end of file diff --git a/Lang/FunL/Unix-ls b/Lang/FunL/Unix-ls new file mode 120000 index 0000000000..f28597ed5c --- /dev/null +++ b/Lang/FunL/Unix-ls @@ -0,0 +1 @@ +../../Task/Unix-ls/FunL \ No newline at end of file diff --git a/Lang/FunL/Vector-products b/Lang/FunL/Vector-products new file mode 120000 index 0000000000..7c072a6800 --- /dev/null +++ b/Lang/FunL/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/FunL \ No newline at end of file diff --git a/Lang/FunL/Web-scraping b/Lang/FunL/Web-scraping new file mode 120000 index 0000000000..abd4ed3d5c --- /dev/null +++ b/Lang/FunL/Web-scraping @@ -0,0 +1 @@ +../../Task/Web-scraping/FunL \ No newline at end of file diff --git a/Lang/Futhark/00DESCRIPTION b/Lang/Futhark/00DESCRIPTION new file mode 100644 index 0000000000..9d30242ca5 --- /dev/null +++ b/Lang/Futhark/00DESCRIPTION @@ -0,0 +1,12 @@ +{{stub}} +{{language +|exec=machine +|strength=strong +|express=implicit +|checking=static +|parampass=value +|gc=yes +|tags=futhark +|site=https://www.futhark-lang.org}} + +Futhark is a small programming language designed to be compiled to efficient GPU code. It is a statically typed, data-parallel, and purely functional array language, and comes with a heavily optimising ahead-of-time compiler that generates GPU code via OpenCL. Futhark is not designed for graphics programming, but instead uses the compute power of the GPU to accelerate data-parallel array computations. The language support regular nested data-parallelism, as well as a form of imperative-style in-place modification of arrays, while still preserving the purity of the language via the use of a uniqueness type system. \ No newline at end of file diff --git a/Lang/Futhark/100-doors b/Lang/Futhark/100-doors new file mode 120000 index 0000000000..13b1b8717f --- /dev/null +++ b/Lang/Futhark/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Ackermann-function b/Lang/Futhark/Ackermann-function new file mode 120000 index 0000000000..b6f3844d3d --- /dev/null +++ b/Lang/Futhark/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Almost-prime b/Lang/Futhark/Almost-prime new file mode 120000 index 0000000000..260457cbf9 --- /dev/null +++ b/Lang/Futhark/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Amicable-pairs b/Lang/Futhark/Amicable-pairs new file mode 120000 index 0000000000..2fb6237c7b --- /dev/null +++ b/Lang/Futhark/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Arithmetic-Complex b/Lang/Futhark/Arithmetic-Complex new file mode 120000 index 0000000000..91908cda38 --- /dev/null +++ b/Lang/Futhark/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Arithmetic-geometric-mean b/Lang/Futhark/Arithmetic-geometric-mean new file mode 120000 index 0000000000..e9730012e4 --- /dev/null +++ b/Lang/Futhark/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Array-concatenation b/Lang/Futhark/Array-concatenation new file mode 120000 index 0000000000..1ab589d9b4 --- /dev/null +++ b/Lang/Futhark/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Arrays b/Lang/Futhark/Arrays new file mode 120000 index 0000000000..4c680473b6 --- /dev/null +++ b/Lang/Futhark/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Averages-Pythagorean-means b/Lang/Futhark/Averages-Pythagorean-means new file mode 120000 index 0000000000..b7a5b506a0 --- /dev/null +++ b/Lang/Futhark/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Averages-Root-mean-square b/Lang/Futhark/Averages-Root-mean-square new file mode 120000 index 0000000000..54d1bff313 --- /dev/null +++ b/Lang/Futhark/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Binary-digits b/Lang/Futhark/Binary-digits new file mode 120000 index 0000000000..3a82fa7347 --- /dev/null +++ b/Lang/Futhark/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Binary-search b/Lang/Futhark/Binary-search new file mode 120000 index 0000000000..ba6b7be7d4 --- /dev/null +++ b/Lang/Futhark/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Comments b/Lang/Futhark/Comments new file mode 120000 index 0000000000..6c01f8ce96 --- /dev/null +++ b/Lang/Futhark/Comments @@ -0,0 +1 @@ +../../Task/Comments/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Conditional-structures b/Lang/Futhark/Conditional-structures new file mode 120000 index 0000000000..9ab8207a98 --- /dev/null +++ b/Lang/Futhark/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Conways-Game-of-Life b/Lang/Futhark/Conways-Game-of-Life new file mode 120000 index 0000000000..869eef8822 --- /dev/null +++ b/Lang/Futhark/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Count-in-octal b/Lang/Futhark/Count-in-octal new file mode 120000 index 0000000000..ea7714c253 --- /dev/null +++ b/Lang/Futhark/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Empty-program b/Lang/Futhark/Empty-program new file mode 120000 index 0000000000..3965487294 --- /dev/null +++ b/Lang/Futhark/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Euler-method b/Lang/Futhark/Euler-method new file mode 120000 index 0000000000..ee807cf720 --- /dev/null +++ b/Lang/Futhark/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Even-or-odd b/Lang/Futhark/Even-or-odd new file mode 120000 index 0000000000..c0f86a4b8f --- /dev/null +++ b/Lang/Futhark/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Factorial b/Lang/Futhark/Factorial new file mode 120000 index 0000000000..1ef01428b1 --- /dev/null +++ b/Lang/Futhark/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Fibonacci-sequence b/Lang/Futhark/Fibonacci-sequence new file mode 120000 index 0000000000..67a9d5f585 --- /dev/null +++ b/Lang/Futhark/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Filter b/Lang/Futhark/Filter new file mode 120000 index 0000000000..707edd9035 --- /dev/null +++ b/Lang/Futhark/Filter @@ -0,0 +1 @@ +../../Task/Filter/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Function-definition b/Lang/Futhark/Function-definition new file mode 120000 index 0000000000..4663358599 --- /dev/null +++ b/Lang/Futhark/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Hailstone-sequence b/Lang/Futhark/Hailstone-sequence new file mode 120000 index 0000000000..642bc4a081 --- /dev/null +++ b/Lang/Futhark/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Integer-sequence b/Lang/Futhark/Integer-sequence new file mode 120000 index 0000000000..961a25da20 --- /dev/null +++ b/Lang/Futhark/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Loops-For b/Lang/Futhark/Loops-For new file mode 120000 index 0000000000..2a761694c5 --- /dev/null +++ b/Lang/Futhark/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Futhark \ No newline at end of file diff --git a/Lang/Futhark/MD5 b/Lang/Futhark/MD5 new file mode 120000 index 0000000000..582bad6ada --- /dev/null +++ b/Lang/Futhark/MD5 @@ -0,0 +1 @@ +../../Task/MD5/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Mandelbrot-set b/Lang/Futhark/Mandelbrot-set new file mode 120000 index 0000000000..3f5ebf146e --- /dev/null +++ b/Lang/Futhark/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Matrix-multiplication b/Lang/Futhark/Matrix-multiplication new file mode 120000 index 0000000000..c9a989daa9 --- /dev/null +++ b/Lang/Futhark/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/Futhark \ No newline at end of file diff --git a/Lang/Futhark/Monte-Carlo-methods b/Lang/Futhark/Monte-Carlo-methods new file mode 120000 index 0000000000..01ab975a69 --- /dev/null +++ b/Lang/Futhark/Monte-Carlo-methods @@ -0,0 +1 @@ +../../Task/Monte-Carlo-methods/Futhark \ No newline at end of file diff --git a/Lang/Futhark/README b/Lang/Futhark/README new file mode 100644 index 0000000000..6109ccbc70 --- /dev/null +++ b/Lang/Futhark/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Futhark diff --git a/Lang/FutureBasic/00DESCRIPTION b/Lang/FutureBasic/00DESCRIPTION new file mode 100644 index 0000000000..7c11f444dd --- /dev/null +++ b/Lang/FutureBasic/00DESCRIPTION @@ -0,0 +1,69 @@ +{{language|FutureBasic +|exec=interpreted +|strength=strong +|safety=safe +|parampass=both +|exec=machine +|gc=no +|site=http://4toc.com/fb/index.htm +|tags=futurebasic}} +{{language programming paradigm|procedural}} +{{implementation|BASIC}} + +FutureBasic began life as Zbasic, a commercial variant of [[BASIC]] for the early Macintoshes, but has grown far beyond that into a mature freeware IDE that, through its FBtoC translator, can be used to compile C and Objective-C [[object-oriented]] code using the clang compiler included with an Xcode installation. It is excellent as a educational tool and for fast prototyping -- especially in Objective-C (Cocoa) by those who prefer programmatic code over the overhead of Xcode. Among its enthusiasts are commercial developers, engineers, professors, doctors, musicians, writers and a host of amateurs who program with FB for the sheer joy of it. + +== FutureBasic Home Page & Download == +http://4toc.com/fb/index.htm + +Here is where you can download your freeware copy of the FutureBasic IDE for Macintosh OS X 10.4 and newer, along with detailed installation instructions (FB requires installation of Xcode and QuickDraw headers); programming examples; and other information. + +On 1 January 2008, Staz Software announced FB as freeware. Downloads and their executables are freeware, but source code and rights of distribution are reserved to the respective authors (the FBtoC team and Staz Software). The IDE is continuously being improved. + +FB 5.x builds Mac OS X Carbon applications (32-bit only) and command-line tools (32- and 64-bit). + +The FB 5 IDE consists of a syntax-aware editor, and a translator (FBtoC) that converts FB code into C code. The translation is then compiled with the system compiler gcc, or in the most recent versions, clang. + +Here is a sample program: +
+include "ConsoleWindow"
+
+local fn PrintSomething( str as Str255 )
+ print str
+end fn
+
+fn PrintSomething( "Hello, World!" )
+
+ +== FutureBasic List == +http://freegroups.net/groups/futurebasic/ + +The FutureBasic mailing list is a free service to the FB programming community, courtesy of associate.com. The list is available by online, and/or by email subscription to anyone interested FB programming on the Macintosh. List members include raw beginners through published commercial software authors. The FB development team and some long-time enthusiasts are knowledgeable and friendly and are very quick to respond to questions posted on the list. In addition, demonstration program code is frequently posted here. + +== Wikipedia == +https://en.wikipedia.org/wiki/FutureBASIC + +Discusses the history of FutureBasic and its predecessor, ZBasic, from the early days of the Macintosh when it was a commercial product, until its morph into today's robust front end to the clang compiler. Information on this page can be outdated, to a better source of the most current information about FB can be found at the web sites above. + +== Why FutureBasic? == + +Considering the contempt some programmers have for the BASIC language -- "BASIC ruins programmers" -- it's almost a shame FB has the word "Basic" in its official name. Not only can FB handle BASIC source code, but since it is a front end to clang, it can translate C, Apple's Core Foundation, Objective-C (Cocoa), HTML, XML, SOAP, UNIX Shell, Open GL, etc. This makes it an excellent tool for prototyping -- especially for programmatic Objective-C when the overhead of Xcode is not needed. + +According to Wikipedia, FutureBasic began life at the dawn of Apple's Macintosh in the mid-1980s as ZBasic, an implementation of '''BASIC''' -- the ''Beginner's All-purpose Symbolic Instruction Code'' -- which had been around since the language was invented by John G. Kemeny and Thomas E. Kurtz at Dartmouth College during 1963 and 1964. + +ZBasic acquired a devoted following of developers who praised its ease of use and the tight, fast code produced by the compiler (a legendary labor involving extensive use of hand-built 68K assembly language code and the brainchild of Andrew Gariepy). + +In 1992, Zedcor Inc., the company of the Gariepy brothers Andy, Mike, Peter and friends based in Tucson, Arizona presented announced their reworked compiler called FutureBASIC. + +In 1995 Staz Software, led by Chris Stasny based in Diamondhead, Miss., acquired the rights to market FutureBASIC. Stasny started this business with an upgraded version, namely FBII, and with his own development, the Program Generator (PG PRO), a CASE tool. + +When Apple transitioned the Mac from 68k to PowerPC, the FB editor was rewritten by Stasny and was coupled with an adaptation of the compiler by Andy Gariepy. The result of their efforts, a dramatically enhanced IDE called FB^3 (FB-cubed) was released in September 1999. + +Major update releases introduced a full-featured Appearance Compliant runtime written by the late New Zealander Robert Purves renown for his brilliant programming. Once completely carbonized to run natively on the Mac OS X, the FutureBASIC Integrated Development Environment (FB IDE) was called FB4 and released in July 2004. + +In August 2005, Staz Software was devastated by Hurricane Katrina just at the time Apple was transitioning from Motorola PPC microprocessors to Intel chips. FB development slowed almost to a standstill. On January 1, 2008, Staz Software announced that FB would henceforth be freeware and FB4 with FBtoC 1.0 was made available. + +Since that time, an independent team of volunteer developers initially lead by Purves continued to improve FBtoC, which took code produced by the FB Editor and translated it to C for processing by gcc, and more recently the more robust clang. + +On Sunday, June 3, 2012, members of the FB List Serve were notified that Robert Purves had died after a long bout with cancer. The news came as a surprise to many FB developers who were unaware of Purves' illness. While coping with cancer, he continued as an active member of the FB community, improving FB, answering questions, solving problems, and posting exquisitely terse code often salted with pithy remarks from his wonderfully dry humor. He never mentioned his health problems and never complained. A tribute to Purves can be found at the bottom of the FB Home Page + +Today, a team of skilled developers who worked on the FB editor, who were also tutored at Purves' knee on his pet FB project, the FBtoC translator, continue his work keeping the Macintosh's oldest compiler viable for a new generation of coders. \ No newline at end of file diff --git a/Lang/FutureBasic/100-doors b/Lang/FutureBasic/100-doors new file mode 120000 index 0000000000..a581eaf422 --- /dev/null +++ b/Lang/FutureBasic/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/99-Bottles-of-Beer b/Lang/FutureBasic/99-Bottles-of-Beer new file mode 120000 index 0000000000..860e6072ce --- /dev/null +++ b/Lang/FutureBasic/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Ackermann-function b/Lang/FutureBasic/Ackermann-function new file mode 120000 index 0000000000..9f90426171 --- /dev/null +++ b/Lang/FutureBasic/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Address-of-a-variable b/Lang/FutureBasic/Address-of-a-variable new file mode 120000 index 0000000000..3a995e3122 --- /dev/null +++ b/Lang/FutureBasic/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Anagrams b/Lang/FutureBasic/Anagrams new file mode 120000 index 0000000000..b8a435fc34 --- /dev/null +++ b/Lang/FutureBasic/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Arithmetic-Integer b/Lang/FutureBasic/Arithmetic-Integer new file mode 120000 index 0000000000..3600b76754 --- /dev/null +++ b/Lang/FutureBasic/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Bitwise-operations b/Lang/FutureBasic/Bitwise-operations new file mode 120000 index 0000000000..20309ee082 --- /dev/null +++ b/Lang/FutureBasic/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Calendar b/Lang/FutureBasic/Calendar new file mode 120000 index 0000000000..15a341fde4 --- /dev/null +++ b/Lang/FutureBasic/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Copy-a-string b/Lang/FutureBasic/Copy-a-string new file mode 120000 index 0000000000..a8379a842c --- /dev/null +++ b/Lang/FutureBasic/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Count-in-octal b/Lang/FutureBasic/Count-in-octal new file mode 120000 index 0000000000..7ba730f6f5 --- /dev/null +++ b/Lang/FutureBasic/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Count-the-coins b/Lang/FutureBasic/Count-the-coins new file mode 120000 index 0000000000..1535fee5f1 --- /dev/null +++ b/Lang/FutureBasic/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Detect-division-by-zero b/Lang/FutureBasic/Detect-division-by-zero new file mode 120000 index 0000000000..9bf584a5c7 --- /dev/null +++ b/Lang/FutureBasic/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Draw-a-sphere b/Lang/FutureBasic/Draw-a-sphere new file mode 120000 index 0000000000..6bf8638e29 --- /dev/null +++ b/Lang/FutureBasic/Draw-a-sphere @@ -0,0 +1 @@ +../../Task/Draw-a-sphere/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Empty-program b/Lang/FutureBasic/Empty-program new file mode 120000 index 0000000000..94e777d178 --- /dev/null +++ b/Lang/FutureBasic/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Empty-string b/Lang/FutureBasic/Empty-string new file mode 120000 index 0000000000..b77f9070ee --- /dev/null +++ b/Lang/FutureBasic/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Enumerations b/Lang/FutureBasic/Enumerations new file mode 120000 index 0000000000..d2580d4062 --- /dev/null +++ b/Lang/FutureBasic/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Execute-a-system-command b/Lang/FutureBasic/Execute-a-system-command new file mode 120000 index 0000000000..838ed73c26 --- /dev/null +++ b/Lang/FutureBasic/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Factorial b/Lang/FutureBasic/Factorial new file mode 120000 index 0000000000..c8c8d92095 --- /dev/null +++ b/Lang/FutureBasic/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Factors-of-an-integer b/Lang/FutureBasic/Factors-of-an-integer new file mode 120000 index 0000000000..2d70308300 --- /dev/null +++ b/Lang/FutureBasic/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Fibonacci-sequence b/Lang/FutureBasic/Fibonacci-sequence new file mode 120000 index 0000000000..89ae6c56fe --- /dev/null +++ b/Lang/FutureBasic/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/FizzBuzz b/Lang/FutureBasic/FizzBuzz new file mode 120000 index 0000000000..8f3c3e7aa3 --- /dev/null +++ b/Lang/FutureBasic/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Formatted-numeric-output b/Lang/FutureBasic/Formatted-numeric-output new file mode 120000 index 0000000000..dcd1cfc74c --- /dev/null +++ b/Lang/FutureBasic/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Function-definition b/Lang/FutureBasic/Function-definition new file mode 120000 index 0000000000..88cf936e9c --- /dev/null +++ b/Lang/FutureBasic/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Generic-swap b/Lang/FutureBasic/Generic-swap new file mode 120000 index 0000000000..cc8fc68c07 --- /dev/null +++ b/Lang/FutureBasic/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Haversine-formula b/Lang/FutureBasic/Haversine-formula new file mode 120000 index 0000000000..80ab7737c1 --- /dev/null +++ b/Lang/FutureBasic/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Hello-world-Newbie b/Lang/FutureBasic/Hello-world-Newbie new file mode 120000 index 0000000000..9dcfe56bb4 --- /dev/null +++ b/Lang/FutureBasic/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Heronian-triangles b/Lang/FutureBasic/Heronian-triangles new file mode 120000 index 0000000000..d84fc0116a --- /dev/null +++ b/Lang/FutureBasic/Heronian-triangles @@ -0,0 +1 @@ +../../Task/Heronian-triangles/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Higher-order-functions b/Lang/FutureBasic/Higher-order-functions new file mode 120000 index 0000000000..399e58fd50 --- /dev/null +++ b/Lang/FutureBasic/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Hofstadter-Conway-$10,000-sequence b/Lang/FutureBasic/Hofstadter-Conway-$10,000-sequence new file mode 120000 index 0000000000..2c4b3e62a6 --- /dev/null +++ b/Lang/FutureBasic/Hofstadter-Conway-$10,000-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Conway-$10,000-sequence/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Horizontal-sundial-calculations b/Lang/FutureBasic/Horizontal-sundial-calculations new file mode 120000 index 0000000000..b30178a64d --- /dev/null +++ b/Lang/FutureBasic/Horizontal-sundial-calculations @@ -0,0 +1 @@ +../../Task/Horizontal-sundial-calculations/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Include-a-file b/Lang/FutureBasic/Include-a-file new file mode 120000 index 0000000000..41bdc635ec --- /dev/null +++ b/Lang/FutureBasic/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Increment-a-numerical-string b/Lang/FutureBasic/Increment-a-numerical-string new file mode 120000 index 0000000000..e5ff3b937e --- /dev/null +++ b/Lang/FutureBasic/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Input-loop b/Lang/FutureBasic/Input-loop new file mode 120000 index 0000000000..50ca707c62 --- /dev/null +++ b/Lang/FutureBasic/Input-loop @@ -0,0 +1 @@ +../../Task/Input-loop/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Integer-comparison b/Lang/FutureBasic/Integer-comparison new file mode 120000 index 0000000000..2c448ce0b7 --- /dev/null +++ b/Lang/FutureBasic/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Jump-anywhere b/Lang/FutureBasic/Jump-anywhere new file mode 120000 index 0000000000..2257d2979e --- /dev/null +++ b/Lang/FutureBasic/Jump-anywhere @@ -0,0 +1 @@ +../../Task/Jump-anywhere/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/FutureBasic/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..ed23d67fda --- /dev/null +++ b/Lang/FutureBasic/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Knapsack-problem-0-1 b/Lang/FutureBasic/Knapsack-problem-0-1 new file mode 120000 index 0000000000..34c7134d1f --- /dev/null +++ b/Lang/FutureBasic/Knapsack-problem-0-1 @@ -0,0 +1 @@ +../../Task/Knapsack-problem-0-1/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Leap-year b/Lang/FutureBasic/Leap-year new file mode 120000 index 0000000000..e1f1c56e29 --- /dev/null +++ b/Lang/FutureBasic/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Levenshtein-distance b/Lang/FutureBasic/Levenshtein-distance new file mode 120000 index 0000000000..a0c1e9be3f --- /dev/null +++ b/Lang/FutureBasic/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Literals-Integer b/Lang/FutureBasic/Literals-Integer new file mode 120000 index 0000000000..8afa3e5f5a --- /dev/null +++ b/Lang/FutureBasic/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Logical-operations b/Lang/FutureBasic/Logical-operations new file mode 120000 index 0000000000..bb6580fb85 --- /dev/null +++ b/Lang/FutureBasic/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Loops-Break b/Lang/FutureBasic/Loops-Break new file mode 120000 index 0000000000..b7c7d000cb --- /dev/null +++ b/Lang/FutureBasic/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Loops-Do-while b/Lang/FutureBasic/Loops-Do-while new file mode 120000 index 0000000000..b4f4fa6eda --- /dev/null +++ b/Lang/FutureBasic/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Loops-Downward-for b/Lang/FutureBasic/Loops-Downward-for new file mode 120000 index 0000000000..6a94f8fcf4 --- /dev/null +++ b/Lang/FutureBasic/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Loops-For-with-a-specified-step b/Lang/FutureBasic/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..d0f718d739 --- /dev/null +++ b/Lang/FutureBasic/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Loops-Infinite b/Lang/FutureBasic/Loops-Infinite new file mode 120000 index 0000000000..84ecaa597b --- /dev/null +++ b/Lang/FutureBasic/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Loops-N-plus-one-half b/Lang/FutureBasic/Loops-N-plus-one-half new file mode 120000 index 0000000000..07e82b3567 --- /dev/null +++ b/Lang/FutureBasic/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Loops-While b/Lang/FutureBasic/Loops-While new file mode 120000 index 0000000000..50ace4f08e --- /dev/null +++ b/Lang/FutureBasic/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Nth-root b/Lang/FutureBasic/Nth-root new file mode 120000 index 0000000000..71b673e272 --- /dev/null +++ b/Lang/FutureBasic/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Pi b/Lang/FutureBasic/Pi new file mode 120000 index 0000000000..2b75d63bf0 --- /dev/null +++ b/Lang/FutureBasic/Pi @@ -0,0 +1 @@ +../../Task/Pi/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Primality-by-trial-division b/Lang/FutureBasic/Primality-by-trial-division new file mode 120000 index 0000000000..80bad85988 --- /dev/null +++ b/Lang/FutureBasic/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/README b/Lang/FutureBasic/README new file mode 100644 index 0000000000..86b05de698 --- /dev/null +++ b/Lang/FutureBasic/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:FutureBasic diff --git a/Lang/FutureBasic/Random-numbers b/Lang/FutureBasic/Random-numbers new file mode 120000 index 0000000000..b3171b3163 --- /dev/null +++ b/Lang/FutureBasic/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Read-a-specific-line-from-a-file b/Lang/FutureBasic/Read-a-specific-line-from-a-file new file mode 120000 index 0000000000..eb35b0e48f --- /dev/null +++ b/Lang/FutureBasic/Read-a-specific-line-from-a-file @@ -0,0 +1 @@ +../../Task/Read-a-specific-line-from-a-file/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Read-entire-file b/Lang/FutureBasic/Read-entire-file new file mode 120000 index 0000000000..5b7a5eef6b --- /dev/null +++ b/Lang/FutureBasic/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Real-constants-and-functions b/Lang/FutureBasic/Real-constants-and-functions new file mode 120000 index 0000000000..362fe5ad2b --- /dev/null +++ b/Lang/FutureBasic/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Return-multiple-values b/Lang/FutureBasic/Return-multiple-values new file mode 120000 index 0000000000..4c782aa7f6 --- /dev/null +++ b/Lang/FutureBasic/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Reverse-a-string b/Lang/FutureBasic/Reverse-a-string new file mode 120000 index 0000000000..c594834278 --- /dev/null +++ b/Lang/FutureBasic/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Roman-numerals-Decode b/Lang/FutureBasic/Roman-numerals-Decode new file mode 120000 index 0000000000..828b70be47 --- /dev/null +++ b/Lang/FutureBasic/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Roman-numerals-Encode b/Lang/FutureBasic/Roman-numerals-Encode new file mode 120000 index 0000000000..4b78c0deae --- /dev/null +++ b/Lang/FutureBasic/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Roots-of-unity b/Lang/FutureBasic/Roots-of-unity new file mode 120000 index 0000000000..c091a22f69 --- /dev/null +++ b/Lang/FutureBasic/Roots-of-unity @@ -0,0 +1 @@ +../../Task/Roots-of-unity/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Runge-Kutta-method b/Lang/FutureBasic/Runge-Kutta-method new file mode 120000 index 0000000000..8f5c9b6671 --- /dev/null +++ b/Lang/FutureBasic/Runge-Kutta-method @@ -0,0 +1 @@ +../../Task/Runge-Kutta-method/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Shell-one-liner b/Lang/FutureBasic/Shell-one-liner new file mode 120000 index 0000000000..484753c97d --- /dev/null +++ b/Lang/FutureBasic/Shell-one-liner @@ -0,0 +1 @@ +../../Task/Shell-one-liner/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Show-the-epoch b/Lang/FutureBasic/Show-the-epoch new file mode 120000 index 0000000000..ae8d68a737 --- /dev/null +++ b/Lang/FutureBasic/Show-the-epoch @@ -0,0 +1 @@ +../../Task/Show-the-epoch/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sieve-of-Eratosthenes b/Lang/FutureBasic/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..b91b2d4f27 --- /dev/null +++ b/Lang/FutureBasic/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Soundex b/Lang/FutureBasic/Soundex new file mode 120000 index 0000000000..00e8849971 --- /dev/null +++ b/Lang/FutureBasic/Soundex @@ -0,0 +1 @@ +../../Task/Soundex/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/String-case b/Lang/FutureBasic/String-case new file mode 120000 index 0000000000..e20e1f4d4f --- /dev/null +++ b/Lang/FutureBasic/String-case @@ -0,0 +1 @@ +../../Task/String-case/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sudoku b/Lang/FutureBasic/Sudoku new file mode 120000 index 0000000000..9d89eb0725 --- /dev/null +++ b/Lang/FutureBasic/Sudoku @@ -0,0 +1 @@ +../../Task/Sudoku/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Towers-of-Hanoi b/Lang/FutureBasic/Towers-of-Hanoi new file mode 120000 index 0000000000..3469a1127d --- /dev/null +++ b/Lang/FutureBasic/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Zero-to-the-zero-power b/Lang/FutureBasic/Zero-to-the-zero-power new file mode 120000 index 0000000000..c00f46e652 --- /dev/null +++ b/Lang/FutureBasic/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/FutureBasic \ No newline at end of file diff --git a/Lang/GEORGE/00DESCRIPTION b/Lang/GEORGE/00DESCRIPTION new file mode 100644 index 0000000000..9f3e77f40b --- /dev/null +++ b/Lang/GEORGE/00DESCRIPTION @@ -0,0 +1,12 @@ +{{language}} +GEORGE is a high-level language invented by Charles Leonard Hamblin in 1957. + +It makes use of a push-down pop-up Accumulator. +Operations are presented in Reverse Polish notation. +A monadic arithmetic operation is performed on the top element of the Accumulator. +Diadic operations are performed using the top two elements of the Accumulator. +The two values are removed (popped) and the result is placed on the top +of the Accumulator. +A Read [R] takes a value from the input, while a Print [P] prints the value +at the top of the Accumulator. +To explicitly remove (delete) the top of the accumulator, use a semicolon [;]. \ No newline at end of file diff --git a/Lang/GEORGE/Arithmetic-Integer b/Lang/GEORGE/Arithmetic-Integer new file mode 120000 index 0000000000..985b32dc36 --- /dev/null +++ b/Lang/GEORGE/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/GEORGE \ No newline at end of file diff --git a/Lang/GEORGE/Averages-Arithmetic-mean b/Lang/GEORGE/Averages-Arithmetic-mean new file mode 120000 index 0000000000..1b10f67d43 --- /dev/null +++ b/Lang/GEORGE/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/GEORGE \ No newline at end of file diff --git a/Lang/GEORGE/Averages-Root-mean-square b/Lang/GEORGE/Averages-Root-mean-square new file mode 120000 index 0000000000..e95484ea9b --- /dev/null +++ b/Lang/GEORGE/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/GEORGE \ No newline at end of file diff --git a/Lang/GEORGE/README b/Lang/GEORGE/README new file mode 100644 index 0000000000..9821bc99a2 --- /dev/null +++ b/Lang/GEORGE/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:GEORGE diff --git a/Lang/GEORGE/Sum-of-a-series b/Lang/GEORGE/Sum-of-a-series new file mode 120000 index 0000000000..5e2d693d1e --- /dev/null +++ b/Lang/GEORGE/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/GEORGE \ No newline at end of file diff --git a/Lang/GEORGE/Sum-of-squares b/Lang/GEORGE/Sum-of-squares new file mode 120000 index 0000000000..fdd8aa6bce --- /dev/null +++ b/Lang/GEORGE/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/GEORGE \ No newline at end of file diff --git a/Lang/GFA-Basic/00DESCRIPTION b/Lang/GFA-Basic/00DESCRIPTION new file mode 100644 index 0000000000..c82ca94924 --- /dev/null +++ b/Lang/GFA-Basic/00DESCRIPTION @@ -0,0 +1,11 @@ +{{language|GFA Basic}} + +GFA Basic was a popular form of basic for the Atari ST computer. It provided an integrated editor and interpreter, and the ability to compile code into standalone programs. Full access was provided to the Atari operating system (TOS, VDI and AES). + +GFA Basic for the Atari ST can be used through an emulator, see [http://www.atari-wiki.com/index.php/Emulators#Atari_Computer_Emulation_Matrix Emulator list]. GFA Basic also runs on the Atari-compatible [http://firebee.org Firebee]. + +==See also== + +*[http://gfa.atari-users.net/atari/html/download.htm Version 3.6 for Atari ST] +*[http://gfa.atari-users.net/atari/ The Unofficial Home for GFA Basic (with ongoing support for the language)] +*[http://www.atari-wiki.com/index.php/GFA_BASIC Information about GFA Basic on Atari wiki] \ No newline at end of file diff --git a/Lang/GFA-Basic/100-doors b/Lang/GFA-Basic/100-doors new file mode 120000 index 0000000000..26180e0340 --- /dev/null +++ b/Lang/GFA-Basic/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/GFA-Basic \ No newline at end of file diff --git a/Lang/GFA-Basic/Abundant,-deficient-and-perfect-number-classifications b/Lang/GFA-Basic/Abundant,-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..df5160c611 --- /dev/null +++ b/Lang/GFA-Basic/Abundant,-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant,-deficient-and-perfect-number-classifications/GFA-Basic \ No newline at end of file diff --git a/Lang/GFA-Basic/Amicable-pairs b/Lang/GFA-Basic/Amicable-pairs new file mode 120000 index 0000000000..2ee22a4762 --- /dev/null +++ b/Lang/GFA-Basic/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/GFA-Basic \ No newline at end of file diff --git a/Lang/GFA-Basic/Averages-Arithmetic-mean b/Lang/GFA-Basic/Averages-Arithmetic-mean new file mode 120000 index 0000000000..c331c296e5 --- /dev/null +++ b/Lang/GFA-Basic/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/GFA-Basic \ No newline at end of file diff --git a/Lang/GFA-Basic/Caesar-cipher b/Lang/GFA-Basic/Caesar-cipher new file mode 120000 index 0000000000..7d3335e4fa --- /dev/null +++ b/Lang/GFA-Basic/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/GFA-Basic \ No newline at end of file diff --git a/Lang/GFA-Basic/Fibonacci-sequence b/Lang/GFA-Basic/Fibonacci-sequence new file mode 120000 index 0000000000..32132767a5 --- /dev/null +++ b/Lang/GFA-Basic/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/GFA-Basic \ No newline at end of file diff --git a/Lang/GFA-Basic/FizzBuzz b/Lang/GFA-Basic/FizzBuzz new file mode 120000 index 0000000000..fe5808e752 --- /dev/null +++ b/Lang/GFA-Basic/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/GFA-Basic \ No newline at end of file diff --git a/Lang/GFA-Basic/Greatest-common-divisor b/Lang/GFA-Basic/Greatest-common-divisor new file mode 120000 index 0000000000..49ce22c0ec --- /dev/null +++ b/Lang/GFA-Basic/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/GFA-Basic \ No newline at end of file diff --git a/Lang/GFA-Basic/Hello-world-Text b/Lang/GFA-Basic/Hello-world-Text new file mode 120000 index 0000000000..414233605e --- /dev/null +++ b/Lang/GFA-Basic/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/GFA-Basic \ No newline at end of file diff --git a/Lang/GFA-Basic/Langtons-ant b/Lang/GFA-Basic/Langtons-ant new file mode 120000 index 0000000000..5744bcfe09 --- /dev/null +++ b/Lang/GFA-Basic/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/GFA-Basic \ No newline at end of file diff --git a/Lang/GFA-Basic/One-dimensional-cellular-automata b/Lang/GFA-Basic/One-dimensional-cellular-automata new file mode 120000 index 0000000000..3f6e6ca21a --- /dev/null +++ b/Lang/GFA-Basic/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/GFA-Basic \ No newline at end of file diff --git a/Lang/GFA-Basic/README b/Lang/GFA-Basic/README new file mode 100644 index 0000000000..c4b20503d8 --- /dev/null +++ b/Lang/GFA-Basic/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:GFA_Basic diff --git a/Lang/GFA-Basic/Reverse-a-string b/Lang/GFA-Basic/Reverse-a-string new file mode 120000 index 0000000000..01e2115f01 --- /dev/null +++ b/Lang/GFA-Basic/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/GFA-Basic \ No newline at end of file diff --git a/Lang/GFA-Basic/Sum-and-product-of-an-array b/Lang/GFA-Basic/Sum-and-product-of-an-array new file mode 120000 index 0000000000..9b260b90e8 --- /dev/null +++ b/Lang/GFA-Basic/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/GFA-Basic \ No newline at end of file diff --git a/Lang/GFA-Basic/Tree-traversal b/Lang/GFA-Basic/Tree-traversal new file mode 120000 index 0000000000..6acfd551f3 --- /dev/null +++ b/Lang/GFA-Basic/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/GFA-Basic \ No newline at end of file diff --git a/Lang/GLSL/00DESCRIPTION b/Lang/GLSL/00DESCRIPTION new file mode 100644 index 0000000000..5d3deb7729 --- /dev/null +++ b/Lang/GLSL/00DESCRIPTION @@ -0,0 +1,2 @@ +{{stub}}{{language}} +http://en.wikipedia.org/wiki/OpenGL_Shading_Language \ No newline at end of file diff --git a/Lang/GLSL/Mandelbrot-set b/Lang/GLSL/Mandelbrot-set new file mode 120000 index 0000000000..fcaf9f655e --- /dev/null +++ b/Lang/GLSL/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/GLSL \ No newline at end of file diff --git a/Lang/GLSL/Munching-squares b/Lang/GLSL/Munching-squares new file mode 120000 index 0000000000..c40560d351 --- /dev/null +++ b/Lang/GLSL/Munching-squares @@ -0,0 +1 @@ +../../Task/Munching-squares/GLSL \ No newline at end of file diff --git a/Lang/GLSL/README b/Lang/GLSL/README new file mode 100644 index 0000000000..dd73dc96b4 --- /dev/null +++ b/Lang/GLSL/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:GLSL diff --git a/Lang/Glagol/00DESCRIPTION b/Lang/Glagol/00DESCRIPTION new file mode 100644 index 0000000000..4c2a1b96c2 --- /dev/null +++ b/Lang/Glagol/00DESCRIPTION @@ -0,0 +1,6 @@ +{{language}} +Glagol (Russian Глагол, translated as "''verb''", or old Russian — as "''word''") is a programming language based on the Russian lexicon. It is strongly reminiscent of Oberon and Pascal. The complete distribution includes, along with the compiler, a set of mathematical and system libraries, games and applications with source code attached. + +The language inherits the tradition of the Soviet school of programming and absorbed features from Oberon. Unfortunately, development tools for Glagol aren't too advanced at the moment. The terminology used in Glagol is a little different from that which is used to describe most programming languages. While it is closer to everyday Russian speech, it may confuse those who want to learn Glagol but who already know another programming language. + +[http://www.seomastering.com/wiki/Glagol] includes a translation of the Russian terminology into English, which may help some users. \ No newline at end of file diff --git a/Lang/Glagol/Balanced-ternary b/Lang/Glagol/Balanced-ternary new file mode 120000 index 0000000000..169f1b70e7 --- /dev/null +++ b/Lang/Glagol/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/Glagol \ No newline at end of file diff --git a/Lang/Glagol/README b/Lang/Glagol/README new file mode 100644 index 0000000000..065026d5d9 --- /dev/null +++ b/Lang/Glagol/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Glagol diff --git a/Lang/Golo/00DESCRIPTION b/Lang/Golo/00DESCRIPTION new file mode 100644 index 0000000000..d931d0cdba --- /dev/null +++ b/Lang/Golo/00DESCRIPTION @@ -0,0 +1,16 @@ +{{language|Golo +|LCT=yes}} +{{language programming paradigm|Imperative}} +{{language programming paradigm|Functional}} +Golo is a simple, dynamic, weakly-typed language for the [[runs on vm::Java Virtual Machine]]. Originally built as a showcase on how to build a language runtime with [http://docs.oracle.com/javase/7/docs/technotes/guides/vm/multiple-language-support.html invokedynamic] introduced with Java 7 / OpenJDK 7. The language is now an Eclipse Foundation project under incubation. + +Golo 2.1.0 is licensed under the terms of the Apache License, Version 2.0. It will switch to the Eclipse Public License going forward, with the Eclipse Distribution License for samples. +==Main features== + +Golo supports imperative and functional programming patterns. +Golo is interoperable with Java and other JVM languages. + +==See also== +* [[wp:Golo_(programming_language)|Golo programming language on Wikipedia]] +* [http://golo-lang.org/ Golo language main web site] +* [http://projects.eclipse.org/proposals/golo Project incubation page at Eclipse] \ No newline at end of file diff --git a/Lang/Golo/README b/Lang/Golo/README new file mode 100644 index 0000000000..961183c147 --- /dev/null +++ b/Lang/Golo/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Golo diff --git a/Lang/Gri/00DESCRIPTION b/Lang/Gri/00DESCRIPTION new file mode 100644 index 0000000000..d9d9c4a666 --- /dev/null +++ b/Lang/Gri/00DESCRIPTION @@ -0,0 +1,31 @@ +{{language|Gri +|site=http://gri.sourceforge.net/ +|parampass=both +|safety=safe +|express=implicit +|checking=dynamic +}} +'''Gri''' is a scripting language for drawing scientific graphs with output to [[PostScript]]. + +Data points to plot can be read from a file or can be generated by an external program such as [[Awk]]. Data manipulation within Gri is limited, it being designed to be done by external crunching. + +Drawing commands are provided to add various kinds of symbols, textual annotations, trend lines, etc. Those commands can be used for general purpose drawing too, with no graph data at all. + +New commands are defined with a kind of keyword matching + +`My Command .arg1. to .arg2.' +Docstring describing this command. +{ + # code here +} + +# call as +My Command 123 to 456 + +New commands can loop and call each other, including recursively. Commands can set global or local variables and can use "synonyms" to act on named variables. + +Arithmetic is done in reverse-polish such as + +{rpn 123 456 +} + +New rpn functions can be defined. They're a simple substitution with no looping, conditionals or recursion. \ No newline at end of file diff --git a/Lang/Gri/Comments b/Lang/Gri/Comments new file mode 120000 index 0000000000..f2cc552baf --- /dev/null +++ b/Lang/Gri/Comments @@ -0,0 +1 @@ +../../Task/Comments/Gri \ No newline at end of file diff --git a/Lang/Gri/Documentation b/Lang/Gri/Documentation new file mode 120000 index 0000000000..e48c1693c7 --- /dev/null +++ b/Lang/Gri/Documentation @@ -0,0 +1 @@ +../../Task/Documentation/Gri \ No newline at end of file diff --git a/Lang/Gri/Dragon-curve b/Lang/Gri/Dragon-curve new file mode 120000 index 0000000000..5f571004e7 --- /dev/null +++ b/Lang/Gri/Dragon-curve @@ -0,0 +1 @@ +../../Task/Dragon-curve/Gri \ No newline at end of file diff --git a/Lang/Gri/Environment-variables b/Lang/Gri/Environment-variables new file mode 120000 index 0000000000..a02c1e74d5 --- /dev/null +++ b/Lang/Gri/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/Gri \ No newline at end of file diff --git a/Lang/Gri/Find-limit-of-recursion b/Lang/Gri/Find-limit-of-recursion new file mode 120000 index 0000000000..5aa50ccbe0 --- /dev/null +++ b/Lang/Gri/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/Gri \ No newline at end of file diff --git a/Lang/Gri/Generic-swap b/Lang/Gri/Generic-swap new file mode 120000 index 0000000000..1b056966e8 --- /dev/null +++ b/Lang/Gri/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/Gri \ No newline at end of file diff --git a/Lang/Gri/README b/Lang/Gri/README new file mode 100644 index 0000000000..425138d689 --- /dev/null +++ b/Lang/Gri/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Gri diff --git a/Lang/HPPPL/00DESCRIPTION b/Lang/HPPPL/00DESCRIPTION new file mode 100644 index 0000000000..bcd32cd704 --- /dev/null +++ b/Lang/HPPPL/00DESCRIPTION @@ -0,0 +1,20 @@ +{{stub}} + +{{language|HPPPL +|exec=machine +|gc=yes +|parampass=value +|safety=unsafe +|strength=weak +|hopl=no +|LCT=no +|tags=hpppl, hppl +}} + +The '''HP Prime Programming Language''' ('''HPPPL''' for short, and also known as '''HPPL''' or '''HP BASIC''') is the onboard calculator programming language for the [[wp:HP Prime|HP Prime]] graphing calculator. It is quite sophisticated for a calculator language; it is compiled directly before running, unlike interpreted languages such as [[TI-BASIC]] or [[RPL]]. It contains functions for advanced screen manipulation, altering the HP Prime file system, and (of course), a large mathematical library. It also allows you to leverage all the commands provided with the [[wp:Xcas|xCas]] algebra system available on the calculator. + +The language is slower than most compiled languages because of how it integrates with the existing calculator abstractions, but it is still relatively speedy to both compile and execute. Its combination of speed and CAS integration makes it very suitable for on-the-fly mathematical computation. + +A note on the name for this language: HP itself provides no set name for the language. The names above are what the language is usually referred to. + +[[Category:Mathematical programming languages]] \ No newline at end of file diff --git a/Lang/HPPPL/Bitwise-operations b/Lang/HPPPL/Bitwise-operations new file mode 120000 index 0000000000..1e1124b0e5 --- /dev/null +++ b/Lang/HPPPL/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/HPPPL \ No newline at end of file diff --git a/Lang/HPPPL/Conditional-structures b/Lang/HPPPL/Conditional-structures new file mode 120000 index 0000000000..02c715be47 --- /dev/null +++ b/Lang/HPPPL/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/HPPPL \ No newline at end of file diff --git a/Lang/HPPPL/Hello-world-Graphical b/Lang/HPPPL/Hello-world-Graphical new file mode 120000 index 0000000000..bede0913a1 --- /dev/null +++ b/Lang/HPPPL/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/HPPPL \ No newline at end of file diff --git a/Lang/HPPPL/Hello-world-Text b/Lang/HPPPL/Hello-world-Text new file mode 120000 index 0000000000..55804e7986 --- /dev/null +++ b/Lang/HPPPL/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/HPPPL \ No newline at end of file diff --git a/Lang/HPPPL/README b/Lang/HPPPL/README new file mode 100644 index 0000000000..c4a2a3882a --- /dev/null +++ b/Lang/HPPPL/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:HPPPL diff --git a/Lang/Hack/00DESCRIPTION b/Lang/Hack/00DESCRIPTION new file mode 100644 index 0000000000..6b3112e697 --- /dev/null +++ b/Lang/Hack/00DESCRIPTION @@ -0,0 +1,5 @@ +{{stub}} +{{language +|site=http://www.hacklang.org/}} + +'''Hack''' is a programming language developed by Facebook and can communicate seamlessly with PHP. \ No newline at end of file diff --git a/Lang/Hack/Hello-world-Text b/Lang/Hack/Hello-world-Text new file mode 120000 index 0000000000..298456595e --- /dev/null +++ b/Lang/Hack/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Hack \ No newline at end of file diff --git a/Lang/Hack/Loops-For b/Lang/Hack/Loops-For new file mode 120000 index 0000000000..05963614be --- /dev/null +++ b/Lang/Hack/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Hack \ No newline at end of file diff --git a/Lang/Hack/README b/Lang/Hack/README new file mode 100644 index 0000000000..b9cd4db33a --- /dev/null +++ b/Lang/Hack/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Hack diff --git a/Lang/Harbour/00DESCRIPTION b/Lang/Harbour/00DESCRIPTION new file mode 100644 index 0000000000..3952aa0926 --- /dev/null +++ b/Lang/Harbour/00DESCRIPTION @@ -0,0 +1,17 @@ +{{language +|exec=bytecode +|site=http://www.harbour-project.org/ +|gc=yes +|parampass=value,reference +|strength=weak +|checking=dynamic +}}Harbour is a successor of the [[Clipper]], its modernized version. +The development of [[Clipper]] was discontinued in 1997, it was DOS-only 16-bit system and did not meet the requirements of the time. So, in 1999 an international group of developers begin to work on a modern, open source, cross-platform [[Clipper]] clone. The founder of a Harbour project is Antonio Linares. + +For now Harbour is much more than a Clipper clone. It is downward compatible with Clipper, but it introduces many language extensions and gives a lot of new possibilities. It is really a cross-platform environment, it runs under Windows, Linux, Mac OS, under various Unixes, mobile platforms, there are 16-, 32- and 64-bit versions. + +[http://www.harbour-project.org/ Harbour project official site] + +[http://en.wikipedia.org/wiki/Harbour_%28software%29 Harbour in WikiPedia] + +[http://www.kresin.ru/en/harbour.html Harbour related stuff - beginners guide, libraries, tools, ...] \ No newline at end of file diff --git a/Lang/Harbour/100-doors b/Lang/Harbour/100-doors new file mode 120000 index 0000000000..8c83138f27 --- /dev/null +++ b/Lang/Harbour/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Harbour \ No newline at end of file diff --git a/Lang/Harbour/ABC-Problem b/Lang/Harbour/ABC-Problem new file mode 120000 index 0000000000..4be4bb46a8 --- /dev/null +++ b/Lang/Harbour/ABC-Problem @@ -0,0 +1 @@ +../../Task/ABC-Problem/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Arithmetic-Integer b/Lang/Harbour/Arithmetic-Integer new file mode 120000 index 0000000000..adf968973e --- /dev/null +++ b/Lang/Harbour/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Arrays b/Lang/Harbour/Arrays new file mode 120000 index 0000000000..b93d68f430 --- /dev/null +++ b/Lang/Harbour/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Associative-array-Creation b/Lang/Harbour/Associative-array-Creation new file mode 120000 index 0000000000..97583ff033 --- /dev/null +++ b/Lang/Harbour/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Associative-array-Iteration b/Lang/Harbour/Associative-array-Iteration new file mode 120000 index 0000000000..1a324aa2fb --- /dev/null +++ b/Lang/Harbour/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Catalan-numbers b/Lang/Harbour/Catalan-numbers new file mode 120000 index 0000000000..0316db2119 --- /dev/null +++ b/Lang/Harbour/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Command-line-arguments b/Lang/Harbour/Command-line-arguments new file mode 120000 index 0000000000..5840a3d870 --- /dev/null +++ b/Lang/Harbour/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Conditional-structures b/Lang/Harbour/Conditional-structures new file mode 120000 index 0000000000..d7ec67a66c --- /dev/null +++ b/Lang/Harbour/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Fibonacci-sequence b/Lang/Harbour/Fibonacci-sequence new file mode 120000 index 0000000000..fe3f32fadc --- /dev/null +++ b/Lang/Harbour/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Five-weekends b/Lang/Harbour/Five-weekends new file mode 120000 index 0000000000..991b9fc748 --- /dev/null +++ b/Lang/Harbour/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Happy-numbers b/Lang/Harbour/Happy-numbers new file mode 120000 index 0000000000..e1ff934b12 --- /dev/null +++ b/Lang/Harbour/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Hash-from-two-arrays b/Lang/Harbour/Hash-from-two-arrays new file mode 120000 index 0000000000..fcf9dd055d --- /dev/null +++ b/Lang/Harbour/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Hello-world-Graphical b/Lang/Harbour/Hello-world-Graphical new file mode 120000 index 0000000000..eb5a2b4538 --- /dev/null +++ b/Lang/Harbour/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Hello-world-Line-printer b/Lang/Harbour/Hello-world-Line-printer new file mode 120000 index 0000000000..74700d414d --- /dev/null +++ b/Lang/Harbour/Hello-world-Line-printer @@ -0,0 +1 @@ +../../Task/Hello-world-Line-printer/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Hello-world-Newline-omission b/Lang/Harbour/Hello-world-Newline-omission new file mode 120000 index 0000000000..530e01640a --- /dev/null +++ b/Lang/Harbour/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Hello-world-Text b/Lang/Harbour/Hello-world-Text new file mode 120000 index 0000000000..4b865cf7ed --- /dev/null +++ b/Lang/Harbour/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Hostname b/Lang/Harbour/Hostname new file mode 120000 index 0000000000..dd162e2ba8 --- /dev/null +++ b/Lang/Harbour/Hostname @@ -0,0 +1 @@ +../../Task/Hostname/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Include-a-file b/Lang/Harbour/Include-a-file new file mode 120000 index 0000000000..6fea371deb --- /dev/null +++ b/Lang/Harbour/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Integer-comparison b/Lang/Harbour/Integer-comparison new file mode 120000 index 0000000000..4841e74677 --- /dev/null +++ b/Lang/Harbour/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Harbour \ No newline at end of file diff --git a/Lang/Harbour/JSON b/Lang/Harbour/JSON new file mode 120000 index 0000000000..8abc436222 --- /dev/null +++ b/Lang/Harbour/JSON @@ -0,0 +1 @@ +../../Task/JSON/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Leap-year b/Lang/Harbour/Leap-year new file mode 120000 index 0000000000..24ce142003 --- /dev/null +++ b/Lang/Harbour/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Letter-frequency b/Lang/Harbour/Letter-frequency new file mode 120000 index 0000000000..01e6391284 --- /dev/null +++ b/Lang/Harbour/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Literals-Integer b/Lang/Harbour/Literals-Integer new file mode 120000 index 0000000000..c3f414efa9 --- /dev/null +++ b/Lang/Harbour/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Logical-operations b/Lang/Harbour/Logical-operations new file mode 120000 index 0000000000..1822ad9e9e --- /dev/null +++ b/Lang/Harbour/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Loops-Break b/Lang/Harbour/Loops-Break new file mode 120000 index 0000000000..4fb5ca3d07 --- /dev/null +++ b/Lang/Harbour/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Loops-Do-while b/Lang/Harbour/Loops-Do-while new file mode 120000 index 0000000000..138e19f7fa --- /dev/null +++ b/Lang/Harbour/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Loops-Downward-for b/Lang/Harbour/Loops-Downward-for new file mode 120000 index 0000000000..9f7c732dcb --- /dev/null +++ b/Lang/Harbour/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Harbour \ No newline at end of file diff --git a/Lang/Harbour/README b/Lang/Harbour/README new file mode 100644 index 0000000000..974ee77ff5 --- /dev/null +++ b/Lang/Harbour/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Harbour diff --git a/Lang/Harbour/Rename-a-file b/Lang/Harbour/Rename-a-file new file mode 120000 index 0000000000..9de14eb8b2 --- /dev/null +++ b/Lang/Harbour/Rename-a-file @@ -0,0 +1 @@ +../../Task/Rename-a-file/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Repeat-a-string b/Lang/Harbour/Repeat-a-string new file mode 120000 index 0000000000..2677eea8cb --- /dev/null +++ b/Lang/Harbour/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Return-multiple-values b/Lang/Harbour/Return-multiple-values new file mode 120000 index 0000000000..c87f176e93 --- /dev/null +++ b/Lang/Harbour/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Reverse-a-string b/Lang/Harbour/Reverse-a-string new file mode 120000 index 0000000000..46e0f89b89 --- /dev/null +++ b/Lang/Harbour/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Harbour \ No newline at end of file diff --git a/Lang/Harbour/Runtime-evaluation b/Lang/Harbour/Runtime-evaluation new file mode 120000 index 0000000000..bbd3017354 --- /dev/null +++ b/Lang/Harbour/Runtime-evaluation @@ -0,0 +1 @@ +../../Task/Runtime-evaluation/Harbour \ No newline at end of file diff --git a/Lang/Harbour/String-comparison b/Lang/Harbour/String-comparison new file mode 120000 index 0000000000..f4dbb00f74 --- /dev/null +++ b/Lang/Harbour/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/Harbour \ No newline at end of file diff --git a/Lang/HolyC/00DESCRIPTION b/Lang/HolyC/00DESCRIPTION new file mode 100644 index 0000000000..737f7285b5 --- /dev/null +++ b/Lang/HolyC/00DESCRIPTION @@ -0,0 +1,5 @@ +{{stub}} +{{language +|site=http://www.templeos.org/Wb/Doc/HolyC.html}} + +'''HolyC''' is a programming language developed by Terry Davis for The Temple Operating System ([http://www.templeos.org/ TempleOS]) \ No newline at end of file diff --git a/Lang/HolyC/README b/Lang/HolyC/README new file mode 100644 index 0000000000..3958713f46 --- /dev/null +++ b/Lang/HolyC/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:HolyC diff --git a/Lang/Hoon/00DESCRIPTION b/Lang/Hoon/00DESCRIPTION new file mode 100644 index 0000000000..a5b76a4e9e --- /dev/null +++ b/Lang/Hoon/00DESCRIPTION @@ -0,0 +1,3 @@ +{{stub}} +Hoon is the lisp-y runic language used in [https://github.com/urbit/urbit Urbit]. +Unlike most other language, it has no reserved keywords and instead relies on two-character symbols called runes, which are converted into AST nodes. Hoon compiles to Nock, the simple combinator-based virtual machine that Urbit runs on top of.{{language}} \ No newline at end of file diff --git a/Lang/Hoon/Arbitrary-precision-integers--included- b/Lang/Hoon/Arbitrary-precision-integers--included- new file mode 120000 index 0000000000..a24d0c28a8 --- /dev/null +++ b/Lang/Hoon/Arbitrary-precision-integers--included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers--included-/Hoon \ No newline at end of file diff --git a/Lang/Hoon/FizzBuzz b/Lang/Hoon/FizzBuzz new file mode 120000 index 0000000000..cddde20d68 --- /dev/null +++ b/Lang/Hoon/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Hoon \ No newline at end of file diff --git a/Lang/Hoon/Greatest-element-of-a-list b/Lang/Hoon/Greatest-element-of-a-list new file mode 120000 index 0000000000..a8817b8490 --- /dev/null +++ b/Lang/Hoon/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Hoon \ No newline at end of file diff --git a/Lang/Hoon/Hello-world-Text b/Lang/Hoon/Hello-world-Text new file mode 120000 index 0000000000..36257187d4 --- /dev/null +++ b/Lang/Hoon/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Hoon \ No newline at end of file diff --git a/Lang/Hoon/JSON b/Lang/Hoon/JSON new file mode 120000 index 0000000000..79cbce97fc --- /dev/null +++ b/Lang/Hoon/JSON @@ -0,0 +1 @@ +../../Task/JSON/Hoon \ No newline at end of file diff --git a/Lang/Hoon/Quine b/Lang/Hoon/Quine new file mode 120000 index 0000000000..fb6a937973 --- /dev/null +++ b/Lang/Hoon/Quine @@ -0,0 +1 @@ +../../Task/Quine/Hoon \ No newline at end of file diff --git a/Lang/Hoon/README b/Lang/Hoon/README new file mode 100644 index 0000000000..8a5c7f9339 --- /dev/null +++ b/Lang/Hoon/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Hoon diff --git a/Lang/Hoon/System-time b/Lang/Hoon/System-time new file mode 120000 index 0000000000..5877edb9b1 --- /dev/null +++ b/Lang/Hoon/System-time @@ -0,0 +1 @@ +../../Task/System-time/Hoon \ No newline at end of file diff --git a/Lang/Hy/00DESCRIPTION b/Lang/Hy/00DESCRIPTION new file mode 100644 index 0000000000..5a454a90bf --- /dev/null +++ b/Lang/Hy/00DESCRIPTION @@ -0,0 +1,6 @@ +{{language}} +{{implementation|Lisp}} + +A Lispy syntax for [[Python]]. The implementation can generate Python source code, not just bytecode, so you can use Hy with, e.g., PyPy just as well as CPython. + +Website: http://hylang.org \ No newline at end of file diff --git a/Lang/Hy/100-doors b/Lang/Hy/100-doors new file mode 120000 index 0000000000..e0f7e5adba --- /dev/null +++ b/Lang/Hy/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Hy \ No newline at end of file diff --git a/Lang/Hy/Averages-Arithmetic-mean b/Lang/Hy/Averages-Arithmetic-mean new file mode 120000 index 0000000000..a1ea146089 --- /dev/null +++ b/Lang/Hy/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Hy \ No newline at end of file diff --git a/Lang/Hy/Bulls-and-cows b/Lang/Hy/Bulls-and-cows new file mode 120000 index 0000000000..bef1ab697a --- /dev/null +++ b/Lang/Hy/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Hy \ No newline at end of file diff --git a/Lang/Hy/Constrained-random-points-on-a-circle b/Lang/Hy/Constrained-random-points-on-a-circle new file mode 120000 index 0000000000..c4ef776859 --- /dev/null +++ b/Lang/Hy/Constrained-random-points-on-a-circle @@ -0,0 +1 @@ +../../Task/Constrained-random-points-on-a-circle/Hy \ No newline at end of file diff --git a/Lang/Hy/Fibonacci-sequence b/Lang/Hy/Fibonacci-sequence new file mode 120000 index 0000000000..f60d7b9b91 --- /dev/null +++ b/Lang/Hy/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Hy \ No newline at end of file diff --git a/Lang/Hy/FizzBuzz b/Lang/Hy/FizzBuzz new file mode 120000 index 0000000000..339208bfe7 --- /dev/null +++ b/Lang/Hy/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Hy \ No newline at end of file diff --git a/Lang/Hy/Hello-world-Text b/Lang/Hy/Hello-world-Text new file mode 120000 index 0000000000..a590e5a7f0 --- /dev/null +++ b/Lang/Hy/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Hy \ No newline at end of file diff --git a/Lang/Hy/Leap-year b/Lang/Hy/Leap-year new file mode 120000 index 0000000000..5980cc74b1 --- /dev/null +++ b/Lang/Hy/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Hy \ No newline at end of file diff --git a/Lang/Hy/Multiple-regression b/Lang/Hy/Multiple-regression new file mode 120000 index 0000000000..2de35030e7 --- /dev/null +++ b/Lang/Hy/Multiple-regression @@ -0,0 +1 @@ +../../Task/Multiple-regression/Hy \ No newline at end of file diff --git a/Lang/Hy/Polynomial-regression b/Lang/Hy/Polynomial-regression new file mode 120000 index 0000000000..6edbac6c60 --- /dev/null +++ b/Lang/Hy/Polynomial-regression @@ -0,0 +1 @@ +../../Task/Polynomial-regression/Hy \ No newline at end of file diff --git a/Lang/Hy/README b/Lang/Hy/README new file mode 100644 index 0000000000..0f77e34f25 --- /dev/null +++ b/Lang/Hy/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Hy diff --git a/Lang/Hy/Statistics-Basic b/Lang/Hy/Statistics-Basic new file mode 120000 index 0000000000..373c54e0de --- /dev/null +++ b/Lang/Hy/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/Hy \ No newline at end of file diff --git a/Lang/Hy/Verify-distribution-uniformity-Chi-squared-test b/Lang/Hy/Verify-distribution-uniformity-Chi-squared-test new file mode 120000 index 0000000000..5a189ef664 --- /dev/null +++ b/Lang/Hy/Verify-distribution-uniformity-Chi-squared-test @@ -0,0 +1 @@ +../../Task/Verify-distribution-uniformity-Chi-squared-test/Hy \ No newline at end of file diff --git a/Lang/Hy/Verify-distribution-uniformity-Naive b/Lang/Hy/Verify-distribution-uniformity-Naive new file mode 120000 index 0000000000..8c97f5a3ba --- /dev/null +++ b/Lang/Hy/Verify-distribution-uniformity-Naive @@ -0,0 +1 @@ +../../Task/Verify-distribution-uniformity-Naive/Hy \ No newline at end of file diff --git a/Lang/I/00DESCRIPTION b/Lang/I/00DESCRIPTION new file mode 100644 index 0000000000..6dd69d18ca --- /dev/null +++ b/Lang/I/00DESCRIPTION @@ -0,0 +1 @@ +{{stub}}{{language|I}} \ No newline at end of file diff --git a/Lang/I/100-doors b/Lang/I/100-doors new file mode 120000 index 0000000000..5c20857c1a --- /dev/null +++ b/Lang/I/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/I \ No newline at end of file diff --git a/Lang/I/A+B b/Lang/I/A+B new file mode 120000 index 0000000000..8803bee392 --- /dev/null +++ b/Lang/I/A+B @@ -0,0 +1 @@ +../../Task/A+B/I \ No newline at end of file diff --git a/Lang/I/Arithmetic-Integer b/Lang/I/Arithmetic-Integer new file mode 120000 index 0000000000..94e203f924 --- /dev/null +++ b/Lang/I/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/I \ No newline at end of file diff --git a/Lang/I/Array-concatenation b/Lang/I/Array-concatenation new file mode 120000 index 0000000000..b7bdf42b56 --- /dev/null +++ b/Lang/I/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/I \ No newline at end of file diff --git a/Lang/I/Arrays b/Lang/I/Arrays new file mode 120000 index 0000000000..11815cfb48 --- /dev/null +++ b/Lang/I/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/I \ No newline at end of file diff --git a/Lang/I/Boolean-values b/Lang/I/Boolean-values new file mode 120000 index 0000000000..c793fb0fc4 --- /dev/null +++ b/Lang/I/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/I \ No newline at end of file diff --git a/Lang/I/Call-a-function b/Lang/I/Call-a-function new file mode 120000 index 0000000000..50fc723117 --- /dev/null +++ b/Lang/I/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/I \ No newline at end of file diff --git a/Lang/I/Character-codes b/Lang/I/Character-codes new file mode 120000 index 0000000000..1d52fd0617 --- /dev/null +++ b/Lang/I/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/I \ No newline at end of file diff --git a/Lang/I/Check-that-file-exists b/Lang/I/Check-that-file-exists new file mode 120000 index 0000000000..dc8fe1e1c7 --- /dev/null +++ b/Lang/I/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/I \ No newline at end of file diff --git a/Lang/I/Conditional-structures b/Lang/I/Conditional-structures new file mode 120000 index 0000000000..ee1c3d2703 --- /dev/null +++ b/Lang/I/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/I \ No newline at end of file diff --git a/Lang/I/Copy-a-string b/Lang/I/Copy-a-string new file mode 120000 index 0000000000..ef5d01cc49 --- /dev/null +++ b/Lang/I/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/I \ No newline at end of file diff --git a/Lang/I/Create-a-file b/Lang/I/Create-a-file new file mode 120000 index 0000000000..afce8155fe --- /dev/null +++ b/Lang/I/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/I \ No newline at end of file diff --git a/Lang/I/Detect-division-by-zero b/Lang/I/Detect-division-by-zero new file mode 120000 index 0000000000..2397545deb --- /dev/null +++ b/Lang/I/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/I \ No newline at end of file diff --git a/Lang/I/Determine-if-a-string-is-numeric b/Lang/I/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..57ac73c5c2 --- /dev/null +++ b/Lang/I/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/I \ No newline at end of file diff --git a/Lang/I/Empty-program b/Lang/I/Empty-program new file mode 120000 index 0000000000..dd90c3783f --- /dev/null +++ b/Lang/I/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/I \ No newline at end of file diff --git a/Lang/I/Empty-string b/Lang/I/Empty-string new file mode 120000 index 0000000000..fb569218ec --- /dev/null +++ b/Lang/I/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/I \ No newline at end of file diff --git a/Lang/I/Environment-variables b/Lang/I/Environment-variables new file mode 120000 index 0000000000..1f2b635873 --- /dev/null +++ b/Lang/I/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/I \ No newline at end of file diff --git a/Lang/I/Factorial b/Lang/I/Factorial new file mode 120000 index 0000000000..2529b7ba1d --- /dev/null +++ b/Lang/I/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/I \ No newline at end of file diff --git a/Lang/I/File-input-output b/Lang/I/File-input-output new file mode 120000 index 0000000000..33d5e9e4f5 --- /dev/null +++ b/Lang/I/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/I \ No newline at end of file diff --git a/Lang/I/Find-limit-of-recursion b/Lang/I/Find-limit-of-recursion new file mode 120000 index 0000000000..07d63d263b --- /dev/null +++ b/Lang/I/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/I \ No newline at end of file diff --git a/Lang/I/FizzBuzz b/Lang/I/FizzBuzz new file mode 120000 index 0000000000..cfb0a59e84 --- /dev/null +++ b/Lang/I/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/I \ No newline at end of file diff --git a/Lang/I/Hello-world-Graphical b/Lang/I/Hello-world-Graphical new file mode 120000 index 0000000000..43c47d331a --- /dev/null +++ b/Lang/I/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/I \ No newline at end of file diff --git a/Lang/I/Hello-world-Text b/Lang/I/Hello-world-Text new file mode 120000 index 0000000000..4d6bc08bec --- /dev/null +++ b/Lang/I/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/I \ No newline at end of file diff --git a/Lang/I/README b/Lang/I/README new file mode 100644 index 0000000000..42ebd5934b --- /dev/null +++ b/Lang/I/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:I diff --git a/Lang/Idris/00DESCRIPTION b/Lang/Idris/00DESCRIPTION new file mode 100644 index 0000000000..4d3d27c049 --- /dev/null +++ b/Lang/Idris/00DESCRIPTION @@ -0,0 +1 @@ +{{stub}}{{language}} \ No newline at end of file diff --git a/Lang/Idris/100-doors b/Lang/Idris/100-doors new file mode 120000 index 0000000000..3af637dc00 --- /dev/null +++ b/Lang/Idris/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Idris \ No newline at end of file diff --git a/Lang/Idris/99-Bottles-of-Beer b/Lang/Idris/99-Bottles-of-Beer new file mode 120000 index 0000000000..9af526d662 --- /dev/null +++ b/Lang/Idris/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Idris \ No newline at end of file diff --git a/Lang/Idris/A+B b/Lang/Idris/A+B new file mode 120000 index 0000000000..4eee00321a --- /dev/null +++ b/Lang/Idris/A+B @@ -0,0 +1 @@ +../../Task/A+B/Idris \ No newline at end of file diff --git a/Lang/Idris/AKS-test-for-primes b/Lang/Idris/AKS-test-for-primes new file mode 120000 index 0000000000..8478214c02 --- /dev/null +++ b/Lang/Idris/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/Idris \ No newline at end of file diff --git a/Lang/Idris/Ackermann-function b/Lang/Idris/Ackermann-function new file mode 120000 index 0000000000..2227d01128 --- /dev/null +++ b/Lang/Idris/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Idris \ No newline at end of file diff --git a/Lang/Idris/Binary-digits b/Lang/Idris/Binary-digits new file mode 120000 index 0000000000..dfc9b3a2aa --- /dev/null +++ b/Lang/Idris/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Idris \ No newline at end of file diff --git a/Lang/Idris/Boolean-values b/Lang/Idris/Boolean-values new file mode 120000 index 0000000000..4bcd1182c1 --- /dev/null +++ b/Lang/Idris/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/Idris \ No newline at end of file diff --git a/Lang/Idris/Cholesky-decomposition b/Lang/Idris/Cholesky-decomposition new file mode 120000 index 0000000000..12f16d06de --- /dev/null +++ b/Lang/Idris/Cholesky-decomposition @@ -0,0 +1 @@ +../../Task/Cholesky-decomposition/Idris \ No newline at end of file diff --git a/Lang/Idris/Dot-product b/Lang/Idris/Dot-product new file mode 120000 index 0000000000..1544c7c4c3 --- /dev/null +++ b/Lang/Idris/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Idris \ No newline at end of file diff --git a/Lang/Idris/Fast-Fourier-transform b/Lang/Idris/Fast-Fourier-transform new file mode 120000 index 0000000000..a73cc8b384 --- /dev/null +++ b/Lang/Idris/Fast-Fourier-transform @@ -0,0 +1 @@ +../../Task/Fast-Fourier-transform/Idris \ No newline at end of file diff --git a/Lang/Idris/Fibonacci-sequence b/Lang/Idris/Fibonacci-sequence new file mode 120000 index 0000000000..31782db7c3 --- /dev/null +++ b/Lang/Idris/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Idris \ No newline at end of file diff --git a/Lang/Idris/FizzBuzz b/Lang/Idris/FizzBuzz new file mode 120000 index 0000000000..8bec60f5ee --- /dev/null +++ b/Lang/Idris/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Idris \ No newline at end of file diff --git a/Lang/Idris/Haversine-formula b/Lang/Idris/Haversine-formula new file mode 120000 index 0000000000..1eec283c9f --- /dev/null +++ b/Lang/Idris/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/Idris \ No newline at end of file diff --git a/Lang/Idris/LU-decomposition b/Lang/Idris/LU-decomposition new file mode 120000 index 0000000000..1ce9e72c75 --- /dev/null +++ b/Lang/Idris/LU-decomposition @@ -0,0 +1 @@ +../../Task/LU-decomposition/Idris \ No newline at end of file diff --git a/Lang/Idris/Matrix-multiplication b/Lang/Idris/Matrix-multiplication new file mode 120000 index 0000000000..067ee799a9 --- /dev/null +++ b/Lang/Idris/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/Idris \ No newline at end of file diff --git a/Lang/Idris/Matrix-transposition b/Lang/Idris/Matrix-transposition new file mode 120000 index 0000000000..5583f849f5 --- /dev/null +++ b/Lang/Idris/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/Idris \ No newline at end of file diff --git a/Lang/Idris/Mutual-recursion b/Lang/Idris/Mutual-recursion new file mode 120000 index 0000000000..0a458c20a6 --- /dev/null +++ b/Lang/Idris/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/Idris \ No newline at end of file diff --git a/Lang/Idris/README b/Lang/Idris/README new file mode 100644 index 0000000000..532630d999 --- /dev/null +++ b/Lang/Idris/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Idris diff --git a/Lang/Idris/Repeat-a-string b/Lang/Idris/Repeat-a-string new file mode 120000 index 0000000000..c05852041d --- /dev/null +++ b/Lang/Idris/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Idris \ No newline at end of file diff --git a/Lang/JOVIAL/00DESCRIPTION b/Lang/JOVIAL/00DESCRIPTION new file mode 100644 index 0000000000..2235706b1a --- /dev/null +++ b/Lang/JOVIAL/00DESCRIPTION @@ -0,0 +1,5 @@ +{{language|JOVIAL +|hopl id=83}} +JOVIAL is an [[ALGOL]]-based language used for avionics and air traffic control systems. + +[[wp:JOVIAL|Wikipedia page]] \ No newline at end of file diff --git a/Lang/JOVIAL/Factorial b/Lang/JOVIAL/Factorial new file mode 120000 index 0000000000..fd26b839d4 --- /dev/null +++ b/Lang/JOVIAL/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/JOVIAL \ No newline at end of file diff --git a/Lang/JOVIAL/README b/Lang/JOVIAL/README new file mode 100644 index 0000000000..74556b5342 --- /dev/null +++ b/Lang/JOVIAL/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:JOVIAL diff --git a/Lang/JOVIAL/Sieve-of-Eratosthenes b/Lang/JOVIAL/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..19c70e5ad5 --- /dev/null +++ b/Lang/JOVIAL/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/JOVIAL \ No newline at end of file diff --git a/Lang/Jack/00DESCRIPTION b/Lang/Jack/00DESCRIPTION new file mode 100644 index 0000000000..7472f029f8 --- /dev/null +++ b/Lang/Jack/00DESCRIPTION @@ -0,0 +1,6 @@ +{{stub}} +{{language +|exec=bytecode +|site=http://nand2tetris.org/ +|gc=no +}} \ No newline at end of file diff --git a/Lang/Jack/Hello-world-Newline-omission b/Lang/Jack/Hello-world-Newline-omission new file mode 120000 index 0000000000..44310eb4a7 --- /dev/null +++ b/Lang/Jack/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Jack \ No newline at end of file diff --git a/Lang/Jack/Hello-world-Text b/Lang/Jack/Hello-world-Text new file mode 120000 index 0000000000..478d38e025 --- /dev/null +++ b/Lang/Jack/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Jack \ No newline at end of file diff --git a/Lang/Jack/README b/Lang/Jack/README new file mode 100644 index 0000000000..5bea36b766 --- /dev/null +++ b/Lang/Jack/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Jack diff --git a/Lang/Kamailio-Script/00DESCRIPTION b/Lang/Kamailio-Script/00DESCRIPTION new file mode 100644 index 0000000000..35866ffd32 --- /dev/null +++ b/Lang/Kamailio-Script/00DESCRIPTION @@ -0,0 +1,6 @@ +{{stub}} +{{language|Kamailio Script +|site=http://www.kamailio.org/w/documentation/ +|hopl=no +}} +Kamailio Script is the language for configuring the [http://www.kamailio.org/w/ Kamailio SIP Server]. \ No newline at end of file diff --git a/Lang/Kamailio-Script/FizzBuzz b/Lang/Kamailio-Script/FizzBuzz new file mode 120000 index 0000000000..f01bcf5154 --- /dev/null +++ b/Lang/Kamailio-Script/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Kamailio-Script \ No newline at end of file diff --git a/Lang/Kamailio-Script/README b/Lang/Kamailio-Script/README new file mode 100644 index 0000000000..6361a9306c --- /dev/null +++ b/Lang/Kamailio-Script/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Kamailio_Script diff --git a/Lang/Kitten/00DESCRIPTION b/Lang/Kitten/00DESCRIPTION new file mode 100644 index 0000000000..d19654bb74 --- /dev/null +++ b/Lang/Kitten/00DESCRIPTION @@ -0,0 +1,11 @@ +{{stub}} +{{language +|site=http://kittenlang.org/ +}} + +Kitten is a statically typed, stack-based functional programming language designed to be simple and fast. It is a concatenative language, combining aspects of imperative and pure functional programming. + +The source code for the main implementation can be found [https://github.com/evincarofautumn/kitten here]. + +{{language programming paradigm|Functional}} +{{language programming paradigm|Concatenative}} \ No newline at end of file diff --git a/Lang/Kitten/Hello-world-Text b/Lang/Kitten/Hello-world-Text new file mode 120000 index 0000000000..631937f9fa --- /dev/null +++ b/Lang/Kitten/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Kitten \ No newline at end of file diff --git a/Lang/Kitten/README b/Lang/Kitten/README new file mode 100644 index 0000000000..037b92f74c --- /dev/null +++ b/Lang/Kitten/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Kitten diff --git a/Lang/Klong/00DESCRIPTION b/Lang/Klong/00DESCRIPTION new file mode 100644 index 0000000000..8da661795b --- /dev/null +++ b/Lang/Klong/00DESCRIPTION @@ -0,0 +1,8 @@ +{{language|Klong +|site=http://www.t3x.org/klong/index.html +}} +Klong is an array language, like [[K]], but without the ambiguity. If you know K or [[APL]], you may be disappointed by Klong. If you don't know any array languages, it might explode your brain. Use at your own risk! + +A Klong program is a set of functions that use powerful operators to manipulate lists (vectors) and (multi-dimensional) arrays. + +Note that Klong is a mathematical notation rather than a programming language. If you try to use it like your favorite OO/functional/procedural programming language, you will only get frustrated. \ No newline at end of file diff --git a/Lang/Klong/99-Bottles-of-Beer b/Lang/Klong/99-Bottles-of-Beer new file mode 120000 index 0000000000..d7557a62f0 --- /dev/null +++ b/Lang/Klong/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Klong \ No newline at end of file diff --git a/Lang/Klong/Factorial b/Lang/Klong/Factorial new file mode 120000 index 0000000000..7de0e546aa --- /dev/null +++ b/Lang/Klong/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Klong \ No newline at end of file diff --git a/Lang/Klong/FizzBuzz b/Lang/Klong/FizzBuzz new file mode 120000 index 0000000000..917a5e972b --- /dev/null +++ b/Lang/Klong/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Klong \ No newline at end of file diff --git a/Lang/Klong/Greatest-element-of-a-list b/Lang/Klong/Greatest-element-of-a-list new file mode 120000 index 0000000000..38d441462f --- /dev/null +++ b/Lang/Klong/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Klong \ No newline at end of file diff --git a/Lang/Klong/Middle-three-digits b/Lang/Klong/Middle-three-digits new file mode 120000 index 0000000000..f5115898c1 --- /dev/null +++ b/Lang/Klong/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/Klong \ No newline at end of file diff --git a/Lang/Klong/README b/Lang/Klong/README new file mode 100644 index 0000000000..23676ea812 --- /dev/null +++ b/Lang/Klong/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Klong diff --git a/Lang/L++/00DESCRIPTION b/Lang/L++/00DESCRIPTION new file mode 100644 index 0000000000..aff12f52d6 --- /dev/null +++ b/Lang/L++/00DESCRIPTION @@ -0,0 +1,7 @@ +{{language|L++}} +L++ is a programming language that transcompiles to C++. It uses Lisp-like syntax. + +==See also== +* [https://bitbucket.org/ktg/l L++ website] + +{{language programming paradigm|Imperative}} \ No newline at end of file diff --git a/Lang/L++/A+B b/Lang/L++/A+B new file mode 120000 index 0000000000..c46432d643 --- /dev/null +++ b/Lang/L++/A+B @@ -0,0 +1 @@ +../../Task/A+B/L++ \ No newline at end of file diff --git a/Lang/L++/Balanced-brackets b/Lang/L++/Balanced-brackets new file mode 120000 index 0000000000..c3991be3ec --- /dev/null +++ b/Lang/L++/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/L++ \ No newline at end of file diff --git a/Lang/L++/Even-or-odd b/Lang/L++/Even-or-odd new file mode 120000 index 0000000000..2f46f3a6a5 --- /dev/null +++ b/Lang/L++/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/L++ \ No newline at end of file diff --git a/Lang/L++/Fibonacci-sequence b/Lang/L++/Fibonacci-sequence new file mode 120000 index 0000000000..0b22aa6a9a --- /dev/null +++ b/Lang/L++/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/L++ \ No newline at end of file diff --git a/Lang/L++/README b/Lang/L++/README new file mode 100644 index 0000000000..5b625aca54 --- /dev/null +++ b/Lang/L++/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:L++ diff --git a/Lang/L++/Reverse-a-string b/Lang/L++/Reverse-a-string new file mode 120000 index 0000000000..23822a1f11 --- /dev/null +++ b/Lang/L++/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/L++ \ No newline at end of file diff --git a/Lang/LC2200-Assembly/00DESCRIPTION b/Lang/LC2200-Assembly/00DESCRIPTION new file mode 100644 index 0000000000..818262c2bc --- /dev/null +++ b/Lang/LC2200-Assembly/00DESCRIPTION @@ -0,0 +1,6 @@ +{{stub}}{{language}}{{assembler language}} +[[Category:Assembly]] +'''LC-2200 assembly''' is an assembly language that runs on the LC-2200 datapath; both were developed by Umakishore Ramachandran and William D. Leahy Jr. for educational purposes. +==See Also== + +''Computer Systems: An Integrated Approach to Architecture and Operating Systems'' \ No newline at end of file diff --git a/Lang/LC2200-Assembly/README b/Lang/LC2200-Assembly/README new file mode 100644 index 0000000000..ea01a7a2c6 --- /dev/null +++ b/Lang/LC2200-Assembly/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:LC2200_Assembly diff --git a/Lang/LC3-Assembly/00DESCRIPTION b/Lang/LC3-Assembly/00DESCRIPTION new file mode 100644 index 0000000000..d844485fd2 --- /dev/null +++ b/Lang/LC3-Assembly/00DESCRIPTION @@ -0,0 +1,8 @@ +{{stub}}{{language}}{{assembler language}} +[[Category:Assembly]] +'''LC-3 assembly''' is an assembly language developed by Yale Patt and Sanjay Patel for educational purposes. LC-3 assembly runs on the eponymous hardware (“Little Computer 3”); however, simulations are far more common. Although it has a simplified instruction set, compared to x86 assembly, LC-3 is a viable target for a C compiler. +==See Also== + +[[http://highered.mheducation.com/sites/dl/free/0072467509/104653/PattPatelAppA.pdf The LC3 ISA]] + +[[http://highered.mheducation.com/sites/dl/free/0072467509/104652/pat67509_appc.pdf The Microarchitecture of the LC-3]] \ No newline at end of file diff --git a/Lang/LC3-Assembly/Conditional-structures b/Lang/LC3-Assembly/Conditional-structures new file mode 120000 index 0000000000..f19da625b6 --- /dev/null +++ b/Lang/LC3-Assembly/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/LC3-Assembly \ No newline at end of file diff --git a/Lang/LC3-Assembly/Copy-a-string b/Lang/LC3-Assembly/Copy-a-string new file mode 120000 index 0000000000..82762cd674 --- /dev/null +++ b/Lang/LC3-Assembly/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/LC3-Assembly \ No newline at end of file diff --git a/Lang/LC3-Assembly/Empty-program b/Lang/LC3-Assembly/Empty-program new file mode 120000 index 0000000000..636d129f10 --- /dev/null +++ b/Lang/LC3-Assembly/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/LC3-Assembly \ No newline at end of file diff --git a/Lang/LC3-Assembly/Even-or-odd b/Lang/LC3-Assembly/Even-or-odd new file mode 120000 index 0000000000..9eb371a7db --- /dev/null +++ b/Lang/LC3-Assembly/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/LC3-Assembly \ No newline at end of file diff --git a/Lang/LC3-Assembly/Generate-lower-case-ASCII-alphabet b/Lang/LC3-Assembly/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..4770c61f6d --- /dev/null +++ b/Lang/LC3-Assembly/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/LC3-Assembly \ No newline at end of file diff --git a/Lang/LC3-Assembly/Hello-world-Text b/Lang/LC3-Assembly/Hello-world-Text new file mode 120000 index 0000000000..e41e1ada2a --- /dev/null +++ b/Lang/LC3-Assembly/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/LC3-Assembly \ No newline at end of file diff --git a/Lang/LC3-Assembly/Loops-For b/Lang/LC3-Assembly/Loops-For new file mode 120000 index 0000000000..f4b300c334 --- /dev/null +++ b/Lang/LC3-Assembly/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/LC3-Assembly \ No newline at end of file diff --git a/Lang/LC3-Assembly/README b/Lang/LC3-Assembly/README new file mode 100644 index 0000000000..8ce8e96b2a --- /dev/null +++ b/Lang/LC3-Assembly/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:LC3_Assembly diff --git a/Lang/LC3-Assembly/Reverse-a-string b/Lang/LC3-Assembly/Reverse-a-string new file mode 120000 index 0000000000..c3f487125d --- /dev/null +++ b/Lang/LC3-Assembly/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/LC3-Assembly \ No newline at end of file diff --git a/Lang/LFE/00DESCRIPTION b/Lang/LFE/00DESCRIPTION new file mode 100644 index 0000000000..519609b048 --- /dev/null +++ b/Lang/LFE/00DESCRIPTION @@ -0,0 +1,18 @@ +{{language|LFE +|site=http://lfe.github.io/ +|exec=bytecode +|strength=strong +|safety=safe +|express=implicit +|checking=dynamic +|gc=yes +|LCT=yes}} +{{language programming paradigm|functional}} +{{language programming paradigm|concurrent}} +{{language programming paradigm|distributed}} +{{language programming paradigm|declarative}} +{{language programming paradigm|imperative}} +{{implementation|Lisp}} +{{implementation|Erlang}} + +LFE, or Lisp Flavored Erlang, is a programming language which runs on the Erlang VM. Like Erlang itself, it has many features more commonly associated with an [[OS|operating system]] than with a programming language: concurrent [[process|processes]], scheduling, [[garbage collection|memory management]], distribution, networking, etc. LFE provides developers the option of creating software that has the power of Erlang but with the syntax of a Lisp-2 language. Furthermore, LFE is 100% compatible/interoperable with Erlang Core. \ No newline at end of file diff --git a/Lang/LFE/Accumulator-factory b/Lang/LFE/Accumulator-factory new file mode 120000 index 0000000000..170e78a095 --- /dev/null +++ b/Lang/LFE/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/LFE \ No newline at end of file diff --git a/Lang/LFE/Ackermann-function b/Lang/LFE/Ackermann-function new file mode 120000 index 0000000000..04c7c47929 --- /dev/null +++ b/Lang/LFE/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/LFE \ No newline at end of file diff --git a/Lang/LFE/Arithmetic-Complex b/Lang/LFE/Arithmetic-Complex new file mode 120000 index 0000000000..4b8509c89d --- /dev/null +++ b/Lang/LFE/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/LFE \ No newline at end of file diff --git a/Lang/LFE/Arithmetic-Integer b/Lang/LFE/Arithmetic-Integer new file mode 120000 index 0000000000..95a816ec7a --- /dev/null +++ b/Lang/LFE/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/LFE \ No newline at end of file diff --git a/Lang/LFE/Arithmetic-geometric-mean b/Lang/LFE/Arithmetic-geometric-mean new file mode 120000 index 0000000000..8054f38e59 --- /dev/null +++ b/Lang/LFE/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/LFE \ No newline at end of file diff --git a/Lang/LFE/Array-concatenation b/Lang/LFE/Array-concatenation new file mode 120000 index 0000000000..e58e389f12 --- /dev/null +++ b/Lang/LFE/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/LFE \ No newline at end of file diff --git a/Lang/LFE/Arrays b/Lang/LFE/Arrays new file mode 120000 index 0000000000..acc8c1d8d2 --- /dev/null +++ b/Lang/LFE/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/LFE \ No newline at end of file diff --git a/Lang/LFE/Associative-array-Creation b/Lang/LFE/Associative-array-Creation new file mode 120000 index 0000000000..e6987546d2 --- /dev/null +++ b/Lang/LFE/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/LFE \ No newline at end of file diff --git a/Lang/LFE/Associative-array-Iteration b/Lang/LFE/Associative-array-Iteration new file mode 120000 index 0000000000..bff4e5f4e0 --- /dev/null +++ b/Lang/LFE/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/LFE \ No newline at end of file diff --git a/Lang/LFE/Averages-Arithmetic-mean b/Lang/LFE/Averages-Arithmetic-mean new file mode 120000 index 0000000000..609c079c5d --- /dev/null +++ b/Lang/LFE/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/LFE \ No newline at end of file diff --git a/Lang/LFE/Binary-digits b/Lang/LFE/Binary-digits new file mode 120000 index 0000000000..f393615695 --- /dev/null +++ b/Lang/LFE/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/LFE \ No newline at end of file diff --git a/Lang/LFE/Bitwise-operations b/Lang/LFE/Bitwise-operations new file mode 120000 index 0000000000..e2ca3b41b1 --- /dev/null +++ b/Lang/LFE/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/LFE \ No newline at end of file diff --git a/Lang/LFE/Boolean-values b/Lang/LFE/Boolean-values new file mode 120000 index 0000000000..55dcf83e34 --- /dev/null +++ b/Lang/LFE/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/LFE \ No newline at end of file diff --git a/Lang/LFE/Call-a-function b/Lang/LFE/Call-a-function new file mode 120000 index 0000000000..96de5d7420 --- /dev/null +++ b/Lang/LFE/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/LFE \ No newline at end of file diff --git a/Lang/LFE/Call-an-object-method b/Lang/LFE/Call-an-object-method new file mode 120000 index 0000000000..462bc160e9 --- /dev/null +++ b/Lang/LFE/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/LFE \ No newline at end of file diff --git a/Lang/LFE/Character-codes b/Lang/LFE/Character-codes new file mode 120000 index 0000000000..894a6a605d --- /dev/null +++ b/Lang/LFE/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/LFE \ No newline at end of file diff --git a/Lang/LFE/Check-that-file-exists b/Lang/LFE/Check-that-file-exists new file mode 120000 index 0000000000..74f5f7b7f2 --- /dev/null +++ b/Lang/LFE/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/LFE \ No newline at end of file diff --git a/Lang/LFE/Classes b/Lang/LFE/Classes new file mode 120000 index 0000000000..91cd5c2de2 --- /dev/null +++ b/Lang/LFE/Classes @@ -0,0 +1 @@ +../../Task/Classes/LFE \ No newline at end of file diff --git a/Lang/LFE/Closures-Value-capture b/Lang/LFE/Closures-Value-capture new file mode 120000 index 0000000000..554811c141 --- /dev/null +++ b/Lang/LFE/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/LFE \ No newline at end of file diff --git a/Lang/LFE/Combinations-with-repetitions b/Lang/LFE/Combinations-with-repetitions new file mode 120000 index 0000000000..c838978dbd --- /dev/null +++ b/Lang/LFE/Combinations-with-repetitions @@ -0,0 +1 @@ +../../Task/Combinations-with-repetitions/LFE \ No newline at end of file diff --git a/Lang/LFE/Command-line-arguments b/Lang/LFE/Command-line-arguments new file mode 120000 index 0000000000..4429b88aae --- /dev/null +++ b/Lang/LFE/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/LFE \ No newline at end of file diff --git a/Lang/LFE/Compound-data-type b/Lang/LFE/Compound-data-type new file mode 120000 index 0000000000..aa0e09bc0b --- /dev/null +++ b/Lang/LFE/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/LFE \ No newline at end of file diff --git a/Lang/LFE/Concurrent-computing b/Lang/LFE/Concurrent-computing new file mode 120000 index 0000000000..c7ac31b130 --- /dev/null +++ b/Lang/LFE/Concurrent-computing @@ -0,0 +1 @@ +../../Task/Concurrent-computing/LFE \ No newline at end of file diff --git a/Lang/LFE/Copy-a-string b/Lang/LFE/Copy-a-string new file mode 120000 index 0000000000..221c938e72 --- /dev/null +++ b/Lang/LFE/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/LFE \ No newline at end of file diff --git a/Lang/LFE/Count-in-octal b/Lang/LFE/Count-in-octal new file mode 120000 index 0000000000..9c7baa7ac2 --- /dev/null +++ b/Lang/LFE/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/LFE \ No newline at end of file diff --git a/Lang/LFE/Create-a-file b/Lang/LFE/Create-a-file new file mode 120000 index 0000000000..429b13f26a --- /dev/null +++ b/Lang/LFE/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/LFE \ No newline at end of file diff --git a/Lang/LFE/Currying b/Lang/LFE/Currying new file mode 120000 index 0000000000..cababf59a3 --- /dev/null +++ b/Lang/LFE/Currying @@ -0,0 +1 @@ +../../Task/Currying/LFE \ No newline at end of file diff --git a/Lang/LFE/Distributed-programming b/Lang/LFE/Distributed-programming new file mode 120000 index 0000000000..3e56073b80 --- /dev/null +++ b/Lang/LFE/Distributed-programming @@ -0,0 +1 @@ +../../Task/Distributed-programming/LFE \ No newline at end of file diff --git a/Lang/LFE/Dot-product b/Lang/LFE/Dot-product new file mode 120000 index 0000000000..266575e151 --- /dev/null +++ b/Lang/LFE/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/LFE \ No newline at end of file diff --git a/Lang/LFE/Echo-server b/Lang/LFE/Echo-server new file mode 120000 index 0000000000..8dc68b7081 --- /dev/null +++ b/Lang/LFE/Echo-server @@ -0,0 +1 @@ +../../Task/Echo-server/LFE \ No newline at end of file diff --git a/Lang/LFE/Empty-string b/Lang/LFE/Empty-string new file mode 120000 index 0000000000..220f96e421 --- /dev/null +++ b/Lang/LFE/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/LFE \ No newline at end of file diff --git a/Lang/LFE/Events b/Lang/LFE/Events new file mode 120000 index 0000000000..7c50ed31a0 --- /dev/null +++ b/Lang/LFE/Events @@ -0,0 +1 @@ +../../Task/Events/LFE \ No newline at end of file diff --git a/Lang/LFE/Execute-a-system-command b/Lang/LFE/Execute-a-system-command new file mode 120000 index 0000000000..3f61654641 --- /dev/null +++ b/Lang/LFE/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/LFE \ No newline at end of file diff --git a/Lang/LFE/Factorial b/Lang/LFE/Factorial new file mode 120000 index 0000000000..be531cb4dc --- /dev/null +++ b/Lang/LFE/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/LFE \ No newline at end of file diff --git a/Lang/LFE/Factors-of-an-integer b/Lang/LFE/Factors-of-an-integer new file mode 120000 index 0000000000..230b960341 --- /dev/null +++ b/Lang/LFE/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/LFE \ No newline at end of file diff --git a/Lang/LFE/Fibonacci-sequence b/Lang/LFE/Fibonacci-sequence new file mode 120000 index 0000000000..73cefa49cd --- /dev/null +++ b/Lang/LFE/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/LFE \ No newline at end of file diff --git a/Lang/LFE/Flatten-a-list b/Lang/LFE/Flatten-a-list new file mode 120000 index 0000000000..b162f4fbf8 --- /dev/null +++ b/Lang/LFE/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/LFE \ No newline at end of file diff --git a/Lang/LFE/Fork b/Lang/LFE/Fork new file mode 120000 index 0000000000..1eb20f2454 --- /dev/null +++ b/Lang/LFE/Fork @@ -0,0 +1 @@ +../../Task/Fork/LFE \ No newline at end of file diff --git a/Lang/LFE/Function-composition b/Lang/LFE/Function-composition new file mode 120000 index 0000000000..45ef8c0273 --- /dev/null +++ b/Lang/LFE/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/LFE \ No newline at end of file diff --git a/Lang/LFE/Function-definition b/Lang/LFE/Function-definition new file mode 120000 index 0000000000..33e0457175 --- /dev/null +++ b/Lang/LFE/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/LFE \ No newline at end of file diff --git a/Lang/LFE/Greatest-common-divisor b/Lang/LFE/Greatest-common-divisor new file mode 120000 index 0000000000..2bd7c78ac0 --- /dev/null +++ b/Lang/LFE/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/LFE \ No newline at end of file diff --git a/Lang/LFE/Greatest-element-of-a-list b/Lang/LFE/Greatest-element-of-a-list new file mode 120000 index 0000000000..5ffc3eba04 --- /dev/null +++ b/Lang/LFE/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/LFE \ No newline at end of file diff --git a/Lang/LFE/Guess-the-number b/Lang/LFE/Guess-the-number new file mode 120000 index 0000000000..7ef9a21f98 --- /dev/null +++ b/Lang/LFE/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/LFE \ No newline at end of file diff --git a/Lang/LFE/Guess-the-number-With-feedback b/Lang/LFE/Guess-the-number-With-feedback new file mode 120000 index 0000000000..b38dd9d04a --- /dev/null +++ b/Lang/LFE/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/LFE \ No newline at end of file diff --git a/Lang/LFE/HTTP b/Lang/LFE/HTTP new file mode 120000 index 0000000000..0a31cf2e57 --- /dev/null +++ b/Lang/LFE/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/LFE \ No newline at end of file diff --git a/Lang/LFE/Hash-from-two-arrays b/Lang/LFE/Hash-from-two-arrays new file mode 120000 index 0000000000..a06bc1a2b1 --- /dev/null +++ b/Lang/LFE/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/LFE \ No newline at end of file diff --git a/Lang/LFE/Hash-join b/Lang/LFE/Hash-join new file mode 120000 index 0000000000..a3e1d12794 --- /dev/null +++ b/Lang/LFE/Hash-join @@ -0,0 +1 @@ +../../Task/Hash-join/LFE \ No newline at end of file diff --git a/Lang/LFE/Hello-world-Newline-omission b/Lang/LFE/Hello-world-Newline-omission new file mode 120000 index 0000000000..c28db54ba7 --- /dev/null +++ b/Lang/LFE/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/LFE \ No newline at end of file diff --git a/Lang/LFE/Hello-world-Text b/Lang/LFE/Hello-world-Text new file mode 120000 index 0000000000..c211abf19b --- /dev/null +++ b/Lang/LFE/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/LFE \ No newline at end of file diff --git a/Lang/LFE/Hostname b/Lang/LFE/Hostname new file mode 120000 index 0000000000..8294131313 --- /dev/null +++ b/Lang/LFE/Hostname @@ -0,0 +1 @@ +../../Task/Hostname/LFE \ No newline at end of file diff --git a/Lang/LFE/Identity-matrix b/Lang/LFE/Identity-matrix new file mode 120000 index 0000000000..8df62a9b51 --- /dev/null +++ b/Lang/LFE/Identity-matrix @@ -0,0 +1 @@ +../../Task/Identity-matrix/LFE \ No newline at end of file diff --git a/Lang/LFE/JSON b/Lang/LFE/JSON new file mode 120000 index 0000000000..d54fd457fe --- /dev/null +++ b/Lang/LFE/JSON @@ -0,0 +1 @@ +../../Task/JSON/LFE \ No newline at end of file diff --git a/Lang/LFE/Levenshtein-distance b/Lang/LFE/Levenshtein-distance new file mode 120000 index 0000000000..1132ca92ed --- /dev/null +++ b/Lang/LFE/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/LFE \ No newline at end of file diff --git a/Lang/LFE/Loop-over-multiple-arrays-simultaneously b/Lang/LFE/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..69db53a849 --- /dev/null +++ b/Lang/LFE/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/LFE \ No newline at end of file diff --git a/Lang/LFE/Loops-Foreach b/Lang/LFE/Loops-Foreach new file mode 120000 index 0000000000..b7cb8ed6b9 --- /dev/null +++ b/Lang/LFE/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/LFE \ No newline at end of file diff --git a/Lang/LFE/Matrix-multiplication b/Lang/LFE/Matrix-multiplication new file mode 120000 index 0000000000..d018eaf83f --- /dev/null +++ b/Lang/LFE/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/LFE \ No newline at end of file diff --git a/Lang/LFE/Matrix-transposition b/Lang/LFE/Matrix-transposition new file mode 120000 index 0000000000..28e21f3b12 --- /dev/null +++ b/Lang/LFE/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/LFE \ No newline at end of file diff --git a/Lang/LFE/Non-decimal-radices-Convert b/Lang/LFE/Non-decimal-radices-Convert new file mode 120000 index 0000000000..22108fe532 --- /dev/null +++ b/Lang/LFE/Non-decimal-radices-Convert @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Convert/LFE \ No newline at end of file diff --git a/Lang/LFE/Partial-function-application b/Lang/LFE/Partial-function-application new file mode 120000 index 0000000000..6df528a093 --- /dev/null +++ b/Lang/LFE/Partial-function-application @@ -0,0 +1 @@ +../../Task/Partial-function-application/LFE \ No newline at end of file diff --git a/Lang/LFE/Permutations b/Lang/LFE/Permutations new file mode 120000 index 0000000000..c73e9aba11 --- /dev/null +++ b/Lang/LFE/Permutations @@ -0,0 +1 @@ +../../Task/Permutations/LFE \ No newline at end of file diff --git a/Lang/LFE/Prime-decomposition b/Lang/LFE/Prime-decomposition new file mode 120000 index 0000000000..c76c220f72 --- /dev/null +++ b/Lang/LFE/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/LFE \ No newline at end of file diff --git a/Lang/LFE/README b/Lang/LFE/README new file mode 100644 index 0000000000..d73a872bc6 --- /dev/null +++ b/Lang/LFE/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:LFE diff --git a/Lang/LFE/Read-entire-file b/Lang/LFE/Read-entire-file new file mode 120000 index 0000000000..bd2c50c49a --- /dev/null +++ b/Lang/LFE/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/LFE \ No newline at end of file diff --git a/Lang/LFE/Rename-a-file b/Lang/LFE/Rename-a-file new file mode 120000 index 0000000000..4a332f94b9 --- /dev/null +++ b/Lang/LFE/Rename-a-file @@ -0,0 +1 @@ +../../Task/Rename-a-file/LFE \ No newline at end of file diff --git a/Lang/LFE/Rep-string b/Lang/LFE/Rep-string new file mode 120000 index 0000000000..4e09554694 --- /dev/null +++ b/Lang/LFE/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/LFE \ No newline at end of file diff --git a/Lang/LFE/Repeat-a-string b/Lang/LFE/Repeat-a-string new file mode 120000 index 0000000000..e3eb1d42f0 --- /dev/null +++ b/Lang/LFE/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/LFE \ No newline at end of file diff --git a/Lang/LFE/Reverse-a-string b/Lang/LFE/Reverse-a-string new file mode 120000 index 0000000000..b8109d2396 --- /dev/null +++ b/Lang/LFE/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/LFE \ No newline at end of file diff --git a/Lang/LFE/Set b/Lang/LFE/Set new file mode 120000 index 0000000000..c946883526 --- /dev/null +++ b/Lang/LFE/Set @@ -0,0 +1 @@ +../../Task/Set/LFE \ No newline at end of file diff --git a/Lang/LFE/String-length b/Lang/LFE/String-length new file mode 120000 index 0000000000..2f150280d3 --- /dev/null +++ b/Lang/LFE/String-length @@ -0,0 +1 @@ +../../Task/String-length/LFE \ No newline at end of file diff --git a/Lang/LFE/String-prepend b/Lang/LFE/String-prepend new file mode 120000 index 0000000000..6ccecd90fd --- /dev/null +++ b/Lang/LFE/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/LFE \ No newline at end of file diff --git a/Lang/LFE/Substring b/Lang/LFE/Substring new file mode 120000 index 0000000000..d17468906a --- /dev/null +++ b/Lang/LFE/Substring @@ -0,0 +1 @@ +../../Task/Substring/LFE \ No newline at end of file diff --git a/Lang/LFE/Sum-of-a-series b/Lang/LFE/Sum-of-a-series new file mode 120000 index 0000000000..a4e76b8101 --- /dev/null +++ b/Lang/LFE/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/LFE \ No newline at end of file diff --git a/Lang/LFE/Sum-of-squares b/Lang/LFE/Sum-of-squares new file mode 120000 index 0000000000..0ea74d3c5c --- /dev/null +++ b/Lang/LFE/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/LFE \ No newline at end of file diff --git a/Lang/LFE/System-time b/Lang/LFE/System-time new file mode 120000 index 0000000000..5d4eb0f620 --- /dev/null +++ b/Lang/LFE/System-time @@ -0,0 +1 @@ +../../Task/System-time/LFE \ No newline at end of file diff --git a/Lang/LFE/Tokenize-a-string b/Lang/LFE/Tokenize-a-string new file mode 120000 index 0000000000..93a029933d --- /dev/null +++ b/Lang/LFE/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/LFE \ No newline at end of file diff --git a/Lang/LFE/Unicode-strings b/Lang/LFE/Unicode-strings new file mode 120000 index 0000000000..6a949dc941 --- /dev/null +++ b/Lang/LFE/Unicode-strings @@ -0,0 +1 @@ +../../Task/Unicode-strings/LFE \ No newline at end of file diff --git a/Lang/LFE/Word-wrap b/Lang/LFE/Word-wrap new file mode 120000 index 0000000000..8d6b34cefd --- /dev/null +++ b/Lang/LFE/Word-wrap @@ -0,0 +1 @@ +../../Task/Word-wrap/LFE \ No newline at end of file diff --git a/Lang/Lambda-Prolog/00DESCRIPTION b/Lang/Lambda-Prolog/00DESCRIPTION new file mode 100644 index 0000000000..0b53dea7e7 --- /dev/null +++ b/Lang/Lambda-Prolog/00DESCRIPTION @@ -0,0 +1,29 @@ +{{language +|exec=compiled +|site=http://www.lix.polytechnique.fr/~dale/lProlog/ +|strength=strong +|safety=safe +|express=explicit +|checking=static +|parampass=value +|compat=structural +|gc=yes +|LCT=yes +|bnf=no}}{{language programming paradigm|Declarative}}{{language programming paradigm|Logic_Programming}} + +From [http://www.lix.polytechnique.fr/~dale/lProlog/ the principle λProlog] page: + +
+λProlog is a logic programming language based on an intuitionistic fragment of Church's Simple Theory of Types. Such a strong logical foundation provides λProlog with logically supported notions of + +# modular programming, +# abstract datatypes, +# higher-order programming, and +# the lambda-tree syntax approach to the treatment of bound variables in syntax. + +Implementations of λProlog contain implementations of the simply typed λ-terms as well as (of subsets) of higher-order unification. +
+ +The syntax is similar to [[Prolog]], but it extends Prolog's basis of [https://en.wikipedia.org/wiki/Horn_clause Horn clause logic] to [https://en.wikipedia.org/wiki/Harrop_formula higher-order hereditary Harrop formulas]. Its higher-order nature allows for quantifying over predicates, and its basis in lambda-tree syntax facilitates construction of terms using lambda abstraction. All λProlog predicates require explicit type signatures. + +λProlog was first developed in 1986. It has had a number implementations, and is still under active development. \ No newline at end of file diff --git a/Lang/Lambda-Prolog/99-Bottles-of-Beer b/Lang/Lambda-Prolog/99-Bottles-of-Beer new file mode 120000 index 0000000000..0a0d7013ea --- /dev/null +++ b/Lang/Lambda-Prolog/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Lambda-Prolog \ No newline at end of file diff --git a/Lang/Lambda-Prolog/README b/Lang/Lambda-Prolog/README new file mode 100644 index 0000000000..cecf87ae43 --- /dev/null +++ b/Lang/Lambda-Prolog/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Lambda_Prolog diff --git a/Lang/Lasso/00DESCRIPTION b/Lang/Lasso/00DESCRIPTION new file mode 100644 index 0000000000..3e9743ca77 --- /dev/null +++ b/Lang/Lasso/00DESCRIPTION @@ -0,0 +1,8 @@ +{{language|Lasso +|site=http://www.LassoSoft.com +}} +Lasso is an application server and server management interface used for developing internet applications as well as a general-purpose, high-level programming language. Born as a web datasource connection tool for Filemaker and later included in Apple Computer's FileMaker 4.0 and Claris Homepage as CDML, it has since evolved into a complex language used to develop and serve large-scale internet applications and web pages. + +==See also== +* [[wp:Lasso_(programming_language)|Lasso on Wikipedia]] +* [http://www.LassoGuide.com The Lasso Programming Guide] \ No newline at end of file diff --git a/Lang/Lasso/100-doors b/Lang/Lasso/100-doors new file mode 120000 index 0000000000..a3d7d31f2a --- /dev/null +++ b/Lang/Lasso/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Lasso \ No newline at end of file diff --git a/Lang/Lasso/24-game b/Lang/Lasso/24-game new file mode 120000 index 0000000000..9c5bb85ea4 --- /dev/null +++ b/Lang/Lasso/24-game @@ -0,0 +1 @@ +../../Task/24-game/Lasso \ No newline at end of file diff --git a/Lang/Lasso/9-billion-names-of-God-the-integer b/Lang/Lasso/9-billion-names-of-God-the-integer new file mode 120000 index 0000000000..4ab04d41a1 --- /dev/null +++ b/Lang/Lasso/9-billion-names-of-God-the-integer @@ -0,0 +1 @@ +../../Task/9-billion-names-of-God-the-integer/Lasso \ No newline at end of file diff --git a/Lang/Lasso/99-Bottles-of-Beer b/Lang/Lasso/99-Bottles-of-Beer new file mode 120000 index 0000000000..e9f7a26b3c --- /dev/null +++ b/Lang/Lasso/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Lasso \ No newline at end of file diff --git a/Lang/Lasso/A+B b/Lang/Lasso/A+B new file mode 120000 index 0000000000..f65ca49709 --- /dev/null +++ b/Lang/Lasso/A+B @@ -0,0 +1 @@ +../../Task/A+B/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Abstract-type b/Lang/Lasso/Abstract-type new file mode 120000 index 0000000000..6ff9fa5d94 --- /dev/null +++ b/Lang/Lasso/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Ackermann-function b/Lang/Lasso/Ackermann-function new file mode 120000 index 0000000000..54a7a2cba3 --- /dev/null +++ b/Lang/Lasso/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Align-columns b/Lang/Lasso/Align-columns new file mode 120000 index 0000000000..3f13f1688f --- /dev/null +++ b/Lang/Lasso/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Anagrams b/Lang/Lasso/Anagrams new file mode 120000 index 0000000000..d99706dca0 --- /dev/null +++ b/Lang/Lasso/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Anagrams-Deranged-anagrams b/Lang/Lasso/Anagrams-Deranged-anagrams new file mode 120000 index 0000000000..a5a849c490 --- /dev/null +++ b/Lang/Lasso/Anagrams-Deranged-anagrams @@ -0,0 +1 @@ +../../Task/Anagrams-Deranged-anagrams/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Apply-a-callback-to-an-array b/Lang/Lasso/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..9c2059c0d6 --- /dev/null +++ b/Lang/Lasso/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Arbitrary-precision-integers--included- b/Lang/Lasso/Arbitrary-precision-integers--included- new file mode 120000 index 0000000000..08d204e231 --- /dev/null +++ b/Lang/Lasso/Arbitrary-precision-integers--included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers--included-/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Arithmetic-Integer b/Lang/Lasso/Arithmetic-Integer new file mode 120000 index 0000000000..45279c13e0 --- /dev/null +++ b/Lang/Lasso/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Array-concatenation b/Lang/Lasso/Array-concatenation new file mode 120000 index 0000000000..048a2c2bd1 --- /dev/null +++ b/Lang/Lasso/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Arrays b/Lang/Lasso/Arrays new file mode 120000 index 0000000000..4d8de3e114 --- /dev/null +++ b/Lang/Lasso/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Assertions b/Lang/Lasso/Assertions new file mode 120000 index 0000000000..220f6758da --- /dev/null +++ b/Lang/Lasso/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Associative-array-Creation b/Lang/Lasso/Associative-array-Creation new file mode 120000 index 0000000000..34c66e6f54 --- /dev/null +++ b/Lang/Lasso/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Associative-array-Iteration b/Lang/Lasso/Associative-array-Iteration new file mode 120000 index 0000000000..cfd14f6aa1 --- /dev/null +++ b/Lang/Lasso/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Atomic-updates b/Lang/Lasso/Atomic-updates new file mode 120000 index 0000000000..eb441fa49b --- /dev/null +++ b/Lang/Lasso/Atomic-updates @@ -0,0 +1 @@ +../../Task/Atomic-updates/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Averages-Arithmetic-mean b/Lang/Lasso/Averages-Arithmetic-mean new file mode 120000 index 0000000000..3e6267b039 --- /dev/null +++ b/Lang/Lasso/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Averages-Median b/Lang/Lasso/Averages-Median new file mode 120000 index 0000000000..9c34119668 --- /dev/null +++ b/Lang/Lasso/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Averages-Mode b/Lang/Lasso/Averages-Mode new file mode 120000 index 0000000000..f6ce312cf5 --- /dev/null +++ b/Lang/Lasso/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Averages-Pythagorean-means b/Lang/Lasso/Averages-Pythagorean-means new file mode 120000 index 0000000000..59dc112cc4 --- /dev/null +++ b/Lang/Lasso/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Averages-Root-mean-square b/Lang/Lasso/Averages-Root-mean-square new file mode 120000 index 0000000000..7ffb852358 --- /dev/null +++ b/Lang/Lasso/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Averages-Simple-moving-average b/Lang/Lasso/Averages-Simple-moving-average new file mode 120000 index 0000000000..ad9f40813e --- /dev/null +++ b/Lang/Lasso/Averages-Simple-moving-average @@ -0,0 +1 @@ +../../Task/Averages-Simple-moving-average/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Balanced-brackets b/Lang/Lasso/Balanced-brackets new file mode 120000 index 0000000000..c9194f67f4 --- /dev/null +++ b/Lang/Lasso/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Boolean-values b/Lang/Lasso/Boolean-values new file mode 120000 index 0000000000..8bb6ede1e1 --- /dev/null +++ b/Lang/Lasso/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Box-the-compass b/Lang/Lasso/Box-the-compass new file mode 120000 index 0000000000..356f2ae6af --- /dev/null +++ b/Lang/Lasso/Box-the-compass @@ -0,0 +1 @@ +../../Task/Box-the-compass/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Bulls-and-cows b/Lang/Lasso/Bulls-and-cows new file mode 120000 index 0000000000..225910bcf1 --- /dev/null +++ b/Lang/Lasso/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Case-sensitivity-of-identifiers b/Lang/Lasso/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..05b802c670 --- /dev/null +++ b/Lang/Lasso/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Character-codes b/Lang/Lasso/Character-codes new file mode 120000 index 0000000000..17e12b8bfa --- /dev/null +++ b/Lang/Lasso/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Check-that-file-exists b/Lang/Lasso/Check-that-file-exists new file mode 120000 index 0000000000..c63c702616 --- /dev/null +++ b/Lang/Lasso/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Classes b/Lang/Lasso/Classes new file mode 120000 index 0000000000..8012ff0d69 --- /dev/null +++ b/Lang/Lasso/Classes @@ -0,0 +1 @@ +../../Task/Classes/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Comma-quibbling b/Lang/Lasso/Comma-quibbling new file mode 120000 index 0000000000..28ab2a19f0 --- /dev/null +++ b/Lang/Lasso/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Command-line-arguments b/Lang/Lasso/Command-line-arguments new file mode 120000 index 0000000000..0e7169d635 --- /dev/null +++ b/Lang/Lasso/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Comments b/Lang/Lasso/Comments new file mode 120000 index 0000000000..d70f467f36 --- /dev/null +++ b/Lang/Lasso/Comments @@ -0,0 +1 @@ +../../Task/Comments/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Compound-data-type b/Lang/Lasso/Compound-data-type new file mode 120000 index 0000000000..200bfa7274 --- /dev/null +++ b/Lang/Lasso/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Copy-a-string b/Lang/Lasso/Copy-a-string new file mode 120000 index 0000000000..8531cf6b48 --- /dev/null +++ b/Lang/Lasso/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Count-occurrences-of-a-substring b/Lang/Lasso/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..932c964588 --- /dev/null +++ b/Lang/Lasso/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Count-the-coins b/Lang/Lasso/Count-the-coins new file mode 120000 index 0000000000..e0401e4f31 --- /dev/null +++ b/Lang/Lasso/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Create-a-file b/Lang/Lasso/Create-a-file new file mode 120000 index 0000000000..66b123f867 --- /dev/null +++ b/Lang/Lasso/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Create-an-HTML-table b/Lang/Lasso/Create-an-HTML-table new file mode 120000 index 0000000000..2944e724bd --- /dev/null +++ b/Lang/Lasso/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/Lasso \ No newline at end of file diff --git a/Lang/Lasso/DNS-query b/Lang/Lasso/DNS-query new file mode 120000 index 0000000000..bbd59a6125 --- /dev/null +++ b/Lang/Lasso/DNS-query @@ -0,0 +1 @@ +../../Task/DNS-query/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Date-format b/Lang/Lasso/Date-format new file mode 120000 index 0000000000..2f1220eeda --- /dev/null +++ b/Lang/Lasso/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Date-manipulation b/Lang/Lasso/Date-manipulation new file mode 120000 index 0000000000..75267b7939 --- /dev/null +++ b/Lang/Lasso/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Day-of-the-week b/Lang/Lasso/Day-of-the-week new file mode 120000 index 0000000000..a82ff743c5 --- /dev/null +++ b/Lang/Lasso/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Deepcopy b/Lang/Lasso/Deepcopy new file mode 120000 index 0000000000..0280a4a9bb --- /dev/null +++ b/Lang/Lasso/Deepcopy @@ -0,0 +1 @@ +../../Task/Deepcopy/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Define-a-primitive-data-type b/Lang/Lasso/Define-a-primitive-data-type new file mode 120000 index 0000000000..463dcd9865 --- /dev/null +++ b/Lang/Lasso/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Delete-a-file b/Lang/Lasso/Delete-a-file new file mode 120000 index 0000000000..edd449e6de --- /dev/null +++ b/Lang/Lasso/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Detect-division-by-zero b/Lang/Lasso/Detect-division-by-zero new file mode 120000 index 0000000000..da5816a93f --- /dev/null +++ b/Lang/Lasso/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Determine-if-a-string-is-numeric b/Lang/Lasso/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..4d9b3e00ae --- /dev/null +++ b/Lang/Lasso/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Determine-if-only-one-instance-is-running b/Lang/Lasso/Determine-if-only-one-instance-is-running new file mode 120000 index 0000000000..d07a683d4b --- /dev/null +++ b/Lang/Lasso/Determine-if-only-one-instance-is-running @@ -0,0 +1 @@ +../../Task/Determine-if-only-one-instance-is-running/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Dutch-national-flag-problem b/Lang/Lasso/Dutch-national-flag-problem new file mode 120000 index 0000000000..1bcd0d4951 --- /dev/null +++ b/Lang/Lasso/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Dynamic-variable-names b/Lang/Lasso/Dynamic-variable-names new file mode 120000 index 0000000000..ac7ac09cb1 --- /dev/null +++ b/Lang/Lasso/Dynamic-variable-names @@ -0,0 +1 @@ +../../Task/Dynamic-variable-names/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Empty-directory b/Lang/Lasso/Empty-directory new file mode 120000 index 0000000000..5161710e82 --- /dev/null +++ b/Lang/Lasso/Empty-directory @@ -0,0 +1 @@ +../../Task/Empty-directory/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Empty-program b/Lang/Lasso/Empty-program new file mode 120000 index 0000000000..a3bca564e7 --- /dev/null +++ b/Lang/Lasso/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Empty-string b/Lang/Lasso/Empty-string new file mode 120000 index 0000000000..fdc6a0fa35 --- /dev/null +++ b/Lang/Lasso/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Environment-variables b/Lang/Lasso/Environment-variables new file mode 120000 index 0000000000..b4835778f4 --- /dev/null +++ b/Lang/Lasso/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Evaluate-binomial-coefficients b/Lang/Lasso/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..18e7d22f93 --- /dev/null +++ b/Lang/Lasso/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Even-or-odd b/Lang/Lasso/Even-or-odd new file mode 120000 index 0000000000..3de8570da3 --- /dev/null +++ b/Lang/Lasso/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Exceptions b/Lang/Lasso/Exceptions new file mode 120000 index 0000000000..9decca47ee --- /dev/null +++ b/Lang/Lasso/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Exceptions-Catch-an-exception-thrown-in-a-nested-call b/Lang/Lasso/Exceptions-Catch-an-exception-thrown-in-a-nested-call new file mode 120000 index 0000000000..4c6f9544e9 --- /dev/null +++ b/Lang/Lasso/Exceptions-Catch-an-exception-thrown-in-a-nested-call @@ -0,0 +1 @@ +../../Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Execute-a-system-command b/Lang/Lasso/Execute-a-system-command new file mode 120000 index 0000000000..9317fbb574 --- /dev/null +++ b/Lang/Lasso/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Extend-your-language b/Lang/Lasso/Extend-your-language new file mode 120000 index 0000000000..add5415bd1 --- /dev/null +++ b/Lang/Lasso/Extend-your-language @@ -0,0 +1 @@ +../../Task/Extend-your-language/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Factorial b/Lang/Lasso/Factorial new file mode 120000 index 0000000000..fae17157b6 --- /dev/null +++ b/Lang/Lasso/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Fibonacci-sequence b/Lang/Lasso/Fibonacci-sequence new file mode 120000 index 0000000000..b9f253f932 --- /dev/null +++ b/Lang/Lasso/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Lasso \ No newline at end of file diff --git a/Lang/Lasso/File-modification-time b/Lang/Lasso/File-modification-time new file mode 120000 index 0000000000..5574cb209a --- /dev/null +++ b/Lang/Lasso/File-modification-time @@ -0,0 +1 @@ +../../Task/File-modification-time/Lasso \ No newline at end of file diff --git a/Lang/Lasso/File-size b/Lang/Lasso/File-size new file mode 120000 index 0000000000..7e216f69d6 --- /dev/null +++ b/Lang/Lasso/File-size @@ -0,0 +1 @@ +../../Task/File-size/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Filter b/Lang/Lasso/Filter new file mode 120000 index 0000000000..b9cc171029 --- /dev/null +++ b/Lang/Lasso/Filter @@ -0,0 +1 @@ +../../Task/Filter/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Find-common-directory-path b/Lang/Lasso/Find-common-directory-path new file mode 120000 index 0000000000..8148fb2333 --- /dev/null +++ b/Lang/Lasso/Find-common-directory-path @@ -0,0 +1 @@ +../../Task/Find-common-directory-path/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Find-the-last-Sunday-of-each-month b/Lang/Lasso/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..bf351a993f --- /dev/null +++ b/Lang/Lasso/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/Lasso \ No newline at end of file diff --git a/Lang/Lasso/First-class-functions b/Lang/Lasso/First-class-functions new file mode 120000 index 0000000000..aef7df3fc0 --- /dev/null +++ b/Lang/Lasso/First-class-functions @@ -0,0 +1 @@ +../../Task/First-class-functions/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Five-weekends b/Lang/Lasso/Five-weekends new file mode 120000 index 0000000000..e0c98afcc9 --- /dev/null +++ b/Lang/Lasso/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/Lasso \ No newline at end of file diff --git a/Lang/Lasso/FizzBuzz b/Lang/Lasso/FizzBuzz new file mode 120000 index 0000000000..5e6a3c7084 --- /dev/null +++ b/Lang/Lasso/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Flatten-a-list b/Lang/Lasso/Flatten-a-list new file mode 120000 index 0000000000..3ce7267c66 --- /dev/null +++ b/Lang/Lasso/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Floyds-triangle b/Lang/Lasso/Floyds-triangle new file mode 120000 index 0000000000..5ee60bb91b --- /dev/null +++ b/Lang/Lasso/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Fork b/Lang/Lasso/Fork new file mode 120000 index 0000000000..abf6fe8325 --- /dev/null +++ b/Lang/Lasso/Fork @@ -0,0 +1 @@ +../../Task/Fork/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Formatted-numeric-output b/Lang/Lasso/Formatted-numeric-output new file mode 120000 index 0000000000..a9f349292f --- /dev/null +++ b/Lang/Lasso/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Forward-difference b/Lang/Lasso/Forward-difference new file mode 120000 index 0000000000..57bd6aa5c3 --- /dev/null +++ b/Lang/Lasso/Forward-difference @@ -0,0 +1 @@ +../../Task/Forward-difference/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Function-definition b/Lang/Lasso/Function-definition new file mode 120000 index 0000000000..5fbcc0e7df --- /dev/null +++ b/Lang/Lasso/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Generic-swap b/Lang/Lasso/Generic-swap new file mode 120000 index 0000000000..77bbd1b007 --- /dev/null +++ b/Lang/Lasso/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Globally-replace-text-in-several-files b/Lang/Lasso/Globally-replace-text-in-several-files new file mode 120000 index 0000000000..96a1ac47fa --- /dev/null +++ b/Lang/Lasso/Globally-replace-text-in-several-files @@ -0,0 +1 @@ +../../Task/Globally-replace-text-in-several-files/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Greatest-element-of-a-list b/Lang/Lasso/Greatest-element-of-a-list new file mode 120000 index 0000000000..bcfa00f9fc --- /dev/null +++ b/Lang/Lasso/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Guess-the-number b/Lang/Lasso/Guess-the-number new file mode 120000 index 0000000000..753b7885c6 --- /dev/null +++ b/Lang/Lasso/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Guess-the-number-With-feedback b/Lang/Lasso/Guess-the-number-With-feedback new file mode 120000 index 0000000000..29b88840ac --- /dev/null +++ b/Lang/Lasso/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Guess-the-number-With-feedback--player- b/Lang/Lasso/Guess-the-number-With-feedback--player- new file mode 120000 index 0000000000..ef587dc308 --- /dev/null +++ b/Lang/Lasso/Guess-the-number-With-feedback--player- @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback--player-/Lasso \ No newline at end of file diff --git a/Lang/Lasso/HTTP b/Lang/Lasso/HTTP new file mode 120000 index 0000000000..49a6792bd9 --- /dev/null +++ b/Lang/Lasso/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/Lasso \ No newline at end of file diff --git a/Lang/Lasso/HTTPS b/Lang/Lasso/HTTPS new file mode 120000 index 0000000000..2b38f28cde --- /dev/null +++ b/Lang/Lasso/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/Lasso \ No newline at end of file diff --git a/Lang/Lasso/HTTPS-Authenticated b/Lang/Lasso/HTTPS-Authenticated new file mode 120000 index 0000000000..62af1a9005 --- /dev/null +++ b/Lang/Lasso/HTTPS-Authenticated @@ -0,0 +1 @@ +../../Task/HTTPS-Authenticated/Lasso \ No newline at end of file diff --git a/Lang/Lasso/HTTPS-Client-authenticated b/Lang/Lasso/HTTPS-Client-authenticated new file mode 120000 index 0000000000..5b730b9ce3 --- /dev/null +++ b/Lang/Lasso/HTTPS-Client-authenticated @@ -0,0 +1 @@ +../../Task/HTTPS-Client-authenticated/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Hailstone-sequence b/Lang/Lasso/Hailstone-sequence new file mode 120000 index 0000000000..c363841e37 --- /dev/null +++ b/Lang/Lasso/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Happy-numbers b/Lang/Lasso/Happy-numbers new file mode 120000 index 0000000000..2cd3f21457 --- /dev/null +++ b/Lang/Lasso/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Hash-from-two-arrays b/Lang/Lasso/Hash-from-two-arrays new file mode 120000 index 0000000000..580072d954 --- /dev/null +++ b/Lang/Lasso/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Hello-world-Graphical b/Lang/Lasso/Hello-world-Graphical new file mode 120000 index 0000000000..13daebceb1 --- /dev/null +++ b/Lang/Lasso/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Hello-world-Line-printer b/Lang/Lasso/Hello-world-Line-printer new file mode 120000 index 0000000000..a3785b054e --- /dev/null +++ b/Lang/Lasso/Hello-world-Line-printer @@ -0,0 +1 @@ +../../Task/Hello-world-Line-printer/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Hello-world-Newline-omission b/Lang/Lasso/Hello-world-Newline-omission new file mode 120000 index 0000000000..b1c3e9756a --- /dev/null +++ b/Lang/Lasso/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Hello-world-Standard-error b/Lang/Lasso/Hello-world-Standard-error new file mode 120000 index 0000000000..8903c987ea --- /dev/null +++ b/Lang/Lasso/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Hello-world-Text b/Lang/Lasso/Hello-world-Text new file mode 120000 index 0000000000..1445a2a085 --- /dev/null +++ b/Lang/Lasso/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Hello-world-Web-server b/Lang/Lasso/Hello-world-Web-server new file mode 120000 index 0000000000..3ac8d9b508 --- /dev/null +++ b/Lang/Lasso/Hello-world-Web-server @@ -0,0 +1 @@ +../../Task/Hello-world-Web-server/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Hostname b/Lang/Lasso/Hostname new file mode 120000 index 0000000000..14e3e79148 --- /dev/null +++ b/Lang/Lasso/Hostname @@ -0,0 +1 @@ +../../Task/Hostname/Lasso \ No newline at end of file diff --git a/Lang/Lasso/I-before-E-except-after-C b/Lang/Lasso/I-before-E-except-after-C new file mode 120000 index 0000000000..99759132dc --- /dev/null +++ b/Lang/Lasso/I-before-E-except-after-C @@ -0,0 +1 @@ +../../Task/I-before-E-except-after-C/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Include-a-file b/Lang/Lasso/Include-a-file new file mode 120000 index 0000000000..b281f3dc3d --- /dev/null +++ b/Lang/Lasso/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Increment-a-numerical-string b/Lang/Lasso/Increment-a-numerical-string new file mode 120000 index 0000000000..e97b12f666 --- /dev/null +++ b/Lang/Lasso/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Infinity b/Lang/Lasso/Infinity new file mode 120000 index 0000000000..22fc28b83f --- /dev/null +++ b/Lang/Lasso/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Inheritance-Multiple b/Lang/Lasso/Inheritance-Multiple new file mode 120000 index 0000000000..cdb9f763f1 --- /dev/null +++ b/Lang/Lasso/Inheritance-Multiple @@ -0,0 +1 @@ +../../Task/Inheritance-Multiple/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Inheritance-Single b/Lang/Lasso/Inheritance-Single new file mode 120000 index 0000000000..d58ffaeea0 --- /dev/null +++ b/Lang/Lasso/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Input-loop b/Lang/Lasso/Input-loop new file mode 120000 index 0000000000..afeaec6ede --- /dev/null +++ b/Lang/Lasso/Input-loop @@ -0,0 +1 @@ +../../Task/Input-loop/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Integer-comparison b/Lang/Lasso/Integer-comparison new file mode 120000 index 0000000000..b7af7ff72f --- /dev/null +++ b/Lang/Lasso/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Integer-sequence b/Lang/Lasso/Integer-sequence new file mode 120000 index 0000000000..01d9e4f70c --- /dev/null +++ b/Lang/Lasso/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Interactive-programming b/Lang/Lasso/Interactive-programming new file mode 120000 index 0000000000..db21d78f34 --- /dev/null +++ b/Lang/Lasso/Interactive-programming @@ -0,0 +1 @@ +../../Task/Interactive-programming/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Introspection b/Lang/Lasso/Introspection new file mode 120000 index 0000000000..7409ce946e --- /dev/null +++ b/Lang/Lasso/Introspection @@ -0,0 +1 @@ +../../Task/Introspection/Lasso \ No newline at end of file diff --git a/Lang/Lasso/JSON b/Lang/Lasso/JSON new file mode 120000 index 0000000000..38cbbbec1e --- /dev/null +++ b/Lang/Lasso/JSON @@ -0,0 +1 @@ +../../Task/JSON/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Knuth-shuffle b/Lang/Lasso/Knuth-shuffle new file mode 120000 index 0000000000..e1fa217bab --- /dev/null +++ b/Lang/Lasso/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Last-Friday-of-each-month b/Lang/Lasso/Last-Friday-of-each-month new file mode 120000 index 0000000000..eaa8b6c3c2 --- /dev/null +++ b/Lang/Lasso/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Leap-year b/Lang/Lasso/Leap-year new file mode 120000 index 0000000000..2ea13453b8 --- /dev/null +++ b/Lang/Lasso/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Least-common-multiple b/Lang/Lasso/Least-common-multiple new file mode 120000 index 0000000000..66014b443f --- /dev/null +++ b/Lang/Lasso/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Letter-frequency b/Lang/Lasso/Letter-frequency new file mode 120000 index 0000000000..33cda282ab --- /dev/null +++ b/Lang/Lasso/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/Lasso \ No newline at end of file diff --git a/Lang/Lasso/List-comprehensions b/Lang/Lasso/List-comprehensions new file mode 120000 index 0000000000..0e754f9f32 --- /dev/null +++ b/Lang/Lasso/List-comprehensions @@ -0,0 +1 @@ +../../Task/List-comprehensions/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Literals-Floating-point b/Lang/Lasso/Literals-Floating-point new file mode 120000 index 0000000000..88ce8d7e52 --- /dev/null +++ b/Lang/Lasso/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Literals-Integer b/Lang/Lasso/Literals-Integer new file mode 120000 index 0000000000..a54ab15712 --- /dev/null +++ b/Lang/Lasso/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Literals-String b/Lang/Lasso/Literals-String new file mode 120000 index 0000000000..f93f31abb6 --- /dev/null +++ b/Lang/Lasso/Literals-String @@ -0,0 +1 @@ +../../Task/Literals-String/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Logical-operations b/Lang/Lasso/Logical-operations new file mode 120000 index 0000000000..e872670637 --- /dev/null +++ b/Lang/Lasso/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Look-and-say-sequence b/Lang/Lasso/Look-and-say-sequence new file mode 120000 index 0000000000..df3b998ce6 --- /dev/null +++ b/Lang/Lasso/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Loops-Break b/Lang/Lasso/Loops-Break new file mode 120000 index 0000000000..0b92e81b47 --- /dev/null +++ b/Lang/Lasso/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Loops-Continue b/Lang/Lasso/Loops-Continue new file mode 120000 index 0000000000..4a0b12af14 --- /dev/null +++ b/Lang/Lasso/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Loops-Do-while b/Lang/Lasso/Loops-Do-while new file mode 120000 index 0000000000..1fb5870b10 --- /dev/null +++ b/Lang/Lasso/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Loops-Downward-for b/Lang/Lasso/Loops-Downward-for new file mode 120000 index 0000000000..fc515b795b --- /dev/null +++ b/Lang/Lasso/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Loops-For b/Lang/Lasso/Loops-For new file mode 120000 index 0000000000..18162efb58 --- /dev/null +++ b/Lang/Lasso/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Loops-For-with-a-specified-step b/Lang/Lasso/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..3de4abd5d5 --- /dev/null +++ b/Lang/Lasso/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Loops-Foreach b/Lang/Lasso/Loops-Foreach new file mode 120000 index 0000000000..bb57528029 --- /dev/null +++ b/Lang/Lasso/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Loops-Infinite b/Lang/Lasso/Loops-Infinite new file mode 120000 index 0000000000..21da8759ca --- /dev/null +++ b/Lang/Lasso/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Loops-N-plus-one-half b/Lang/Lasso/Loops-N-plus-one-half new file mode 120000 index 0000000000..326632a81d --- /dev/null +++ b/Lang/Lasso/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Loops-Nested b/Lang/Lasso/Loops-Nested new file mode 120000 index 0000000000..0919d29f4f --- /dev/null +++ b/Lang/Lasso/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Loops-While b/Lang/Lasso/Loops-While new file mode 120000 index 0000000000..fa59600da6 --- /dev/null +++ b/Lang/Lasso/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Luhn-test-of-credit-card-numbers b/Lang/Lasso/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..5821740a95 --- /dev/null +++ b/Lang/Lasso/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Lasso \ No newline at end of file diff --git a/Lang/Lasso/MD4 b/Lang/Lasso/MD4 new file mode 120000 index 0000000000..6c8bd9b3ce --- /dev/null +++ b/Lang/Lasso/MD4 @@ -0,0 +1 @@ +../../Task/MD4/Lasso \ No newline at end of file diff --git a/Lang/Lasso/MD5 b/Lang/Lasso/MD5 new file mode 120000 index 0000000000..1e0ab7a979 --- /dev/null +++ b/Lang/Lasso/MD5 @@ -0,0 +1 @@ +../../Task/MD5/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Mandelbrot-set b/Lang/Lasso/Mandelbrot-set new file mode 120000 index 0000000000..4804fdd9f9 --- /dev/null +++ b/Lang/Lasso/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Map-range b/Lang/Lasso/Map-range new file mode 120000 index 0000000000..70d0e80c3a --- /dev/null +++ b/Lang/Lasso/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Middle-three-digits b/Lang/Lasso/Middle-three-digits new file mode 120000 index 0000000000..35c1f9e42b --- /dev/null +++ b/Lang/Lasso/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Multiplication-tables b/Lang/Lasso/Multiplication-tables new file mode 120000 index 0000000000..bc678d9f9f --- /dev/null +++ b/Lang/Lasso/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Named-parameters b/Lang/Lasso/Named-parameters new file mode 120000 index 0000000000..dde335d1d2 --- /dev/null +++ b/Lang/Lasso/Named-parameters @@ -0,0 +1 @@ +../../Task/Named-parameters/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Null-object b/Lang/Lasso/Null-object new file mode 120000 index 0000000000..0dfeaa1f24 --- /dev/null +++ b/Lang/Lasso/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Odd-word-problem b/Lang/Lasso/Odd-word-problem new file mode 120000 index 0000000000..1135b87a2c --- /dev/null +++ b/Lang/Lasso/Odd-word-problem @@ -0,0 +1 @@ +../../Task/Odd-word-problem/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Optional-parameters b/Lang/Lasso/Optional-parameters new file mode 120000 index 0000000000..a277262db9 --- /dev/null +++ b/Lang/Lasso/Optional-parameters @@ -0,0 +1 @@ +../../Task/Optional-parameters/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Order-two-numerical-lists b/Lang/Lasso/Order-two-numerical-lists new file mode 120000 index 0000000000..84df1b5c4b --- /dev/null +++ b/Lang/Lasso/Order-two-numerical-lists @@ -0,0 +1 @@ +../../Task/Order-two-numerical-lists/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Ordered-words b/Lang/Lasso/Ordered-words new file mode 120000 index 0000000000..d51eb65a53 --- /dev/null +++ b/Lang/Lasso/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Palindrome-detection b/Lang/Lasso/Palindrome-detection new file mode 120000 index 0000000000..4310001c77 --- /dev/null +++ b/Lang/Lasso/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Perfect-numbers b/Lang/Lasso/Perfect-numbers new file mode 120000 index 0000000000..3e111ac015 --- /dev/null +++ b/Lang/Lasso/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Pi b/Lang/Lasso/Pi new file mode 120000 index 0000000000..8a696881eb --- /dev/null +++ b/Lang/Lasso/Pi @@ -0,0 +1 @@ +../../Task/Pi/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Pick-random-element b/Lang/Lasso/Pick-random-element new file mode 120000 index 0000000000..a846b972f9 --- /dev/null +++ b/Lang/Lasso/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Priority-queue b/Lang/Lasso/Priority-queue new file mode 120000 index 0000000000..f5ac8f679f --- /dev/null +++ b/Lang/Lasso/Priority-queue @@ -0,0 +1 @@ +../../Task/Priority-queue/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Problem-of-Apollonius b/Lang/Lasso/Problem-of-Apollonius new file mode 120000 index 0000000000..93aca7b937 --- /dev/null +++ b/Lang/Lasso/Problem-of-Apollonius @@ -0,0 +1 @@ +../../Task/Problem-of-Apollonius/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Program-name b/Lang/Lasso/Program-name new file mode 120000 index 0000000000..c157178a15 --- /dev/null +++ b/Lang/Lasso/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Program-termination b/Lang/Lasso/Program-termination new file mode 120000 index 0000000000..fcad01000b --- /dev/null +++ b/Lang/Lasso/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Pythagorean-triples b/Lang/Lasso/Pythagorean-triples new file mode 120000 index 0000000000..8ce0366cea --- /dev/null +++ b/Lang/Lasso/Pythagorean-triples @@ -0,0 +1 @@ +../../Task/Pythagorean-triples/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Queue-Definition b/Lang/Lasso/Queue-Definition new file mode 120000 index 0000000000..10f8006534 --- /dev/null +++ b/Lang/Lasso/Queue-Definition @@ -0,0 +1 @@ +../../Task/Queue-Definition/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Queue-Usage b/Lang/Lasso/Queue-Usage new file mode 120000 index 0000000000..748eca583f --- /dev/null +++ b/Lang/Lasso/Queue-Usage @@ -0,0 +1 @@ +../../Task/Queue-Usage/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Quine b/Lang/Lasso/Quine new file mode 120000 index 0000000000..7ad6ee4408 --- /dev/null +++ b/Lang/Lasso/Quine @@ -0,0 +1 @@ +../../Task/Quine/Lasso \ No newline at end of file diff --git a/Lang/Lasso/README b/Lang/Lasso/README new file mode 100644 index 0000000000..e8fe7d89fb --- /dev/null +++ b/Lang/Lasso/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Lasso diff --git a/Lang/Lasso/RIPEMD-160 b/Lang/Lasso/RIPEMD-160 new file mode 120000 index 0000000000..eba3cd49c3 --- /dev/null +++ b/Lang/Lasso/RIPEMD-160 @@ -0,0 +1 @@ +../../Task/RIPEMD-160/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Random-number-generator--device- b/Lang/Lasso/Random-number-generator--device- new file mode 120000 index 0000000000..9cb849207e --- /dev/null +++ b/Lang/Lasso/Random-number-generator--device- @@ -0,0 +1 @@ +../../Task/Random-number-generator--device-/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Range-expansion b/Lang/Lasso/Range-expansion new file mode 120000 index 0000000000..88bc6b8b0e --- /dev/null +++ b/Lang/Lasso/Range-expansion @@ -0,0 +1 @@ +../../Task/Range-expansion/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Read-a-configuration-file b/Lang/Lasso/Read-a-configuration-file new file mode 120000 index 0000000000..a02bd62518 --- /dev/null +++ b/Lang/Lasso/Read-a-configuration-file @@ -0,0 +1 @@ +../../Task/Read-a-configuration-file/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Read-a-file-line-by-line b/Lang/Lasso/Read-a-file-line-by-line new file mode 120000 index 0000000000..e0cddc8ac1 --- /dev/null +++ b/Lang/Lasso/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Read-a-specific-line-from-a-file b/Lang/Lasso/Read-a-specific-line-from-a-file new file mode 120000 index 0000000000..abb51e877a --- /dev/null +++ b/Lang/Lasso/Read-a-specific-line-from-a-file @@ -0,0 +1 @@ +../../Task/Read-a-specific-line-from-a-file/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Read-entire-file b/Lang/Lasso/Read-entire-file new file mode 120000 index 0000000000..7a8e8fe6d0 --- /dev/null +++ b/Lang/Lasso/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Real-constants-and-functions b/Lang/Lasso/Real-constants-and-functions new file mode 120000 index 0000000000..80dda4e2bd --- /dev/null +++ b/Lang/Lasso/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Regular-expressions b/Lang/Lasso/Regular-expressions new file mode 120000 index 0000000000..3da510a73e --- /dev/null +++ b/Lang/Lasso/Regular-expressions @@ -0,0 +1 @@ +../../Task/Regular-expressions/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Remove-duplicate-elements b/Lang/Lasso/Remove-duplicate-elements new file mode 120000 index 0000000000..95b4a8e9f4 --- /dev/null +++ b/Lang/Lasso/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Remove-lines-from-a-file b/Lang/Lasso/Remove-lines-from-a-file new file mode 120000 index 0000000000..889408782e --- /dev/null +++ b/Lang/Lasso/Remove-lines-from-a-file @@ -0,0 +1 @@ +../../Task/Remove-lines-from-a-file/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Rename-a-file b/Lang/Lasso/Rename-a-file new file mode 120000 index 0000000000..3d61cee4c6 --- /dev/null +++ b/Lang/Lasso/Rename-a-file @@ -0,0 +1 @@ +../../Task/Rename-a-file/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Repeat-a-string b/Lang/Lasso/Repeat-a-string new file mode 120000 index 0000000000..17648dd1b0 --- /dev/null +++ b/Lang/Lasso/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Respond-to-an-unknown-method-call b/Lang/Lasso/Respond-to-an-unknown-method-call new file mode 120000 index 0000000000..18df7a3d75 --- /dev/null +++ b/Lang/Lasso/Respond-to-an-unknown-method-call @@ -0,0 +1 @@ +../../Task/Respond-to-an-unknown-method-call/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Return-multiple-values b/Lang/Lasso/Return-multiple-values new file mode 120000 index 0000000000..22ebdd2b51 --- /dev/null +++ b/Lang/Lasso/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Reverse-a-string b/Lang/Lasso/Reverse-a-string new file mode 120000 index 0000000000..d32d406df3 --- /dev/null +++ b/Lang/Lasso/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Rock-paper-scissors b/Lang/Lasso/Rock-paper-scissors new file mode 120000 index 0000000000..01e9af6f0d --- /dev/null +++ b/Lang/Lasso/Rock-paper-scissors @@ -0,0 +1 @@ +../../Task/Rock-paper-scissors/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Roman-numerals-Decode b/Lang/Lasso/Roman-numerals-Decode new file mode 120000 index 0000000000..b8845a830a --- /dev/null +++ b/Lang/Lasso/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Roman-numerals-Encode b/Lang/Lasso/Roman-numerals-Encode new file mode 120000 index 0000000000..ee19bff621 --- /dev/null +++ b/Lang/Lasso/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Rot-13 b/Lang/Lasso/Rot-13 new file mode 120000 index 0000000000..b1d915d199 --- /dev/null +++ b/Lang/Lasso/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Run-length-encoding b/Lang/Lasso/Run-length-encoding new file mode 120000 index 0000000000..b30ff024d4 --- /dev/null +++ b/Lang/Lasso/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Runtime-evaluation b/Lang/Lasso/Runtime-evaluation new file mode 120000 index 0000000000..aca6f1e0ad --- /dev/null +++ b/Lang/Lasso/Runtime-evaluation @@ -0,0 +1 @@ +../../Task/Runtime-evaluation/Lasso \ No newline at end of file diff --git a/Lang/Lasso/SHA-1 b/Lang/Lasso/SHA-1 new file mode 120000 index 0000000000..d2a765ce79 --- /dev/null +++ b/Lang/Lasso/SHA-1 @@ -0,0 +1 @@ +../../Task/SHA-1/Lasso \ No newline at end of file diff --git a/Lang/Lasso/SHA-256 b/Lang/Lasso/SHA-256 new file mode 120000 index 0000000000..b9fb008f87 --- /dev/null +++ b/Lang/Lasso/SHA-256 @@ -0,0 +1 @@ +../../Task/SHA-256/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Search-a-list b/Lang/Lasso/Search-a-list new file mode 120000 index 0000000000..7f1171254c --- /dev/null +++ b/Lang/Lasso/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Semordnilap b/Lang/Lasso/Semordnilap new file mode 120000 index 0000000000..899b0dd03c --- /dev/null +++ b/Lang/Lasso/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Send-an-unknown-method-call b/Lang/Lasso/Send-an-unknown-method-call new file mode 120000 index 0000000000..81832cec3d --- /dev/null +++ b/Lang/Lasso/Send-an-unknown-method-call @@ -0,0 +1 @@ +../../Task/Send-an-unknown-method-call/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Send-email b/Lang/Lasso/Send-email new file mode 120000 index 0000000000..da325bb75f --- /dev/null +++ b/Lang/Lasso/Send-email @@ -0,0 +1 @@ +../../Task/Send-email/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Set b/Lang/Lasso/Set new file mode 120000 index 0000000000..0e527dc60a --- /dev/null +++ b/Lang/Lasso/Set @@ -0,0 +1 @@ +../../Task/Set/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Shell-one-liner b/Lang/Lasso/Shell-one-liner new file mode 120000 index 0000000000..fd7d449ee8 --- /dev/null +++ b/Lang/Lasso/Shell-one-liner @@ -0,0 +1 @@ +../../Task/Shell-one-liner/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Show-the-epoch b/Lang/Lasso/Show-the-epoch new file mode 120000 index 0000000000..54213c0dd7 --- /dev/null +++ b/Lang/Lasso/Show-the-epoch @@ -0,0 +1 @@ +../../Task/Show-the-epoch/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Singleton b/Lang/Lasso/Singleton new file mode 120000 index 0000000000..b8a92e66dd --- /dev/null +++ b/Lang/Lasso/Singleton @@ -0,0 +1 @@ +../../Task/Singleton/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Sleep b/Lang/Lasso/Sleep new file mode 120000 index 0000000000..28f6e5dbc5 --- /dev/null +++ b/Lang/Lasso/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Sockets b/Lang/Lasso/Sockets new file mode 120000 index 0000000000..1af63434ce --- /dev/null +++ b/Lang/Lasso/Sockets @@ -0,0 +1 @@ +../../Task/Sockets/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Sort-an-integer-array b/Lang/Lasso/Sort-an-integer-array new file mode 120000 index 0000000000..f482f491a5 --- /dev/null +++ b/Lang/Lasso/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Sort-stability b/Lang/Lasso/Sort-stability new file mode 120000 index 0000000000..d31456f595 --- /dev/null +++ b/Lang/Lasso/Sort-stability @@ -0,0 +1 @@ +../../Task/Sort-stability/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Special-characters b/Lang/Lasso/Special-characters new file mode 120000 index 0000000000..a56004ab85 --- /dev/null +++ b/Lang/Lasso/Special-characters @@ -0,0 +1 @@ +../../Task/Special-characters/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Special-variables b/Lang/Lasso/Special-variables new file mode 120000 index 0000000000..f64e2cd9b9 --- /dev/null +++ b/Lang/Lasso/Special-variables @@ -0,0 +1 @@ +../../Task/Special-variables/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Stack b/Lang/Lasso/Stack new file mode 120000 index 0000000000..de5886e83e --- /dev/null +++ b/Lang/Lasso/Stack @@ -0,0 +1 @@ +../../Task/Stack/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Stack-traces b/Lang/Lasso/Stack-traces new file mode 120000 index 0000000000..b46128a0f3 --- /dev/null +++ b/Lang/Lasso/Stack-traces @@ -0,0 +1 @@ +../../Task/Stack-traces/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Statistics-Basic b/Lang/Lasso/Statistics-Basic new file mode 120000 index 0000000000..c51a903063 --- /dev/null +++ b/Lang/Lasso/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/Lasso \ No newline at end of file diff --git a/Lang/Lasso/String-append b/Lang/Lasso/String-append new file mode 120000 index 0000000000..b97ee499d0 --- /dev/null +++ b/Lang/Lasso/String-append @@ -0,0 +1 @@ +../../Task/String-append/Lasso \ No newline at end of file diff --git a/Lang/Lasso/String-case b/Lang/Lasso/String-case new file mode 120000 index 0000000000..1bcee351a7 --- /dev/null +++ b/Lang/Lasso/String-case @@ -0,0 +1 @@ +../../Task/String-case/Lasso \ No newline at end of file diff --git a/Lang/Lasso/String-comparison b/Lang/Lasso/String-comparison new file mode 120000 index 0000000000..60a8cb6a45 --- /dev/null +++ b/Lang/Lasso/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/Lasso \ No newline at end of file diff --git a/Lang/Lasso/String-concatenation b/Lang/Lasso/String-concatenation new file mode 120000 index 0000000000..beee67b4de --- /dev/null +++ b/Lang/Lasso/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Lasso \ No newline at end of file diff --git a/Lang/Lasso/String-interpolation--included- b/Lang/Lasso/String-interpolation--included- new file mode 120000 index 0000000000..470b998155 --- /dev/null +++ b/Lang/Lasso/String-interpolation--included- @@ -0,0 +1 @@ +../../Task/String-interpolation--included-/Lasso \ No newline at end of file diff --git a/Lang/Lasso/String-length b/Lang/Lasso/String-length new file mode 120000 index 0000000000..709986bc6e --- /dev/null +++ b/Lang/Lasso/String-length @@ -0,0 +1 @@ +../../Task/String-length/Lasso \ No newline at end of file diff --git a/Lang/Lasso/String-matching b/Lang/Lasso/String-matching new file mode 120000 index 0000000000..6c1a4578e2 --- /dev/null +++ b/Lang/Lasso/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/Lasso \ No newline at end of file diff --git a/Lang/Lasso/String-prepend b/Lang/Lasso/String-prepend new file mode 120000 index 0000000000..7ce0e83f60 --- /dev/null +++ b/Lang/Lasso/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Strip-a-set-of-characters-from-a-string b/Lang/Lasso/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..6e1b9b392e --- /dev/null +++ b/Lang/Lasso/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Strip-whitespace-from-a-string-Top-and-tail b/Lang/Lasso/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..34f30074e5 --- /dev/null +++ b/Lang/Lasso/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Substring b/Lang/Lasso/Substring new file mode 120000 index 0000000000..3a8d47921f --- /dev/null +++ b/Lang/Lasso/Substring @@ -0,0 +1 @@ +../../Task/Substring/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Substring-Top-and-tail b/Lang/Lasso/Substring-Top-and-tail new file mode 120000 index 0000000000..ac41ba60bb --- /dev/null +++ b/Lang/Lasso/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Sum-and-product-of-an-array b/Lang/Lasso/Sum-and-product-of-an-array new file mode 120000 index 0000000000..a7997d3dd6 --- /dev/null +++ b/Lang/Lasso/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Sum-digits-of-an-integer b/Lang/Lasso/Sum-digits-of-an-integer new file mode 120000 index 0000000000..97a9695b73 --- /dev/null +++ b/Lang/Lasso/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Sum-multiples-of-3-and-5 b/Lang/Lasso/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..eeea9d6d50 --- /dev/null +++ b/Lang/Lasso/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Sum-of-a-series b/Lang/Lasso/Sum-of-a-series new file mode 120000 index 0000000000..612fb77c21 --- /dev/null +++ b/Lang/Lasso/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Sum-of-squares b/Lang/Lasso/Sum-of-squares new file mode 120000 index 0000000000..4ac03859c6 --- /dev/null +++ b/Lang/Lasso/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Symmetric-difference b/Lang/Lasso/Symmetric-difference new file mode 120000 index 0000000000..990569cab7 --- /dev/null +++ b/Lang/Lasso/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/Lasso \ No newline at end of file diff --git a/Lang/Lasso/System-time b/Lang/Lasso/System-time new file mode 120000 index 0000000000..431ca71951 --- /dev/null +++ b/Lang/Lasso/System-time @@ -0,0 +1 @@ +../../Task/System-time/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Table-creation-Postal-addresses b/Lang/Lasso/Table-creation-Postal-addresses new file mode 120000 index 0000000000..3dfff077fd --- /dev/null +++ b/Lang/Lasso/Table-creation-Postal-addresses @@ -0,0 +1 @@ +../../Task/Table-creation-Postal-addresses/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Take-notes-on-the-command-line b/Lang/Lasso/Take-notes-on-the-command-line new file mode 120000 index 0000000000..dcf7871ce4 --- /dev/null +++ b/Lang/Lasso/Take-notes-on-the-command-line @@ -0,0 +1 @@ +../../Task/Take-notes-on-the-command-line/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Temperature-conversion b/Lang/Lasso/Temperature-conversion new file mode 120000 index 0000000000..7d7ae8126e --- /dev/null +++ b/Lang/Lasso/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Terminal-control-Clear-the-screen b/Lang/Lasso/Terminal-control-Clear-the-screen new file mode 120000 index 0000000000..e146a52fd9 --- /dev/null +++ b/Lang/Lasso/Terminal-control-Clear-the-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Clear-the-screen/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Terminal-control-Coloured-text b/Lang/Lasso/Terminal-control-Coloured-text new file mode 120000 index 0000000000..684535f463 --- /dev/null +++ b/Lang/Lasso/Terminal-control-Coloured-text @@ -0,0 +1 @@ +../../Task/Terminal-control-Coloured-text/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Terminal-control-Cursor-movement b/Lang/Lasso/Terminal-control-Cursor-movement new file mode 120000 index 0000000000..5fff028f61 --- /dev/null +++ b/Lang/Lasso/Terminal-control-Cursor-movement @@ -0,0 +1 @@ +../../Task/Terminal-control-Cursor-movement/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Terminal-control-Cursor-positioning b/Lang/Lasso/Terminal-control-Cursor-positioning new file mode 120000 index 0000000000..d74a537627 --- /dev/null +++ b/Lang/Lasso/Terminal-control-Cursor-positioning @@ -0,0 +1 @@ +../../Task/Terminal-control-Cursor-positioning/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Terminal-control-Display-an-extended-character b/Lang/Lasso/Terminal-control-Display-an-extended-character new file mode 120000 index 0000000000..a6e38e8fe8 --- /dev/null +++ b/Lang/Lasso/Terminal-control-Display-an-extended-character @@ -0,0 +1 @@ +../../Task/Terminal-control-Display-an-extended-character/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Terminal-control-Hiding-the-cursor b/Lang/Lasso/Terminal-control-Hiding-the-cursor new file mode 120000 index 0000000000..8f8ad3b215 --- /dev/null +++ b/Lang/Lasso/Terminal-control-Hiding-the-cursor @@ -0,0 +1 @@ +../../Task/Terminal-control-Hiding-the-cursor/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Terminal-control-Inverse-video b/Lang/Lasso/Terminal-control-Inverse-video new file mode 120000 index 0000000000..159cceabeb --- /dev/null +++ b/Lang/Lasso/Terminal-control-Inverse-video @@ -0,0 +1 @@ +../../Task/Terminal-control-Inverse-video/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Terminal-control-Ringing-the-terminal-bell b/Lang/Lasso/Terminal-control-Ringing-the-terminal-bell new file mode 120000 index 0000000000..b437a43feb --- /dev/null +++ b/Lang/Lasso/Terminal-control-Ringing-the-terminal-bell @@ -0,0 +1 @@ +../../Task/Terminal-control-Ringing-the-terminal-bell/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Terminal-control-Unicode-output b/Lang/Lasso/Terminal-control-Unicode-output new file mode 120000 index 0000000000..e89891e31d --- /dev/null +++ b/Lang/Lasso/Terminal-control-Unicode-output @@ -0,0 +1 @@ +../../Task/Terminal-control-Unicode-output/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Test-a-function b/Lang/Lasso/Test-a-function new file mode 120000 index 0000000000..af8ebdf2fb --- /dev/null +++ b/Lang/Lasso/Test-a-function @@ -0,0 +1 @@ +../../Task/Test-a-function/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Tic-tac-toe b/Lang/Lasso/Tic-tac-toe new file mode 120000 index 0000000000..5fcc263842 --- /dev/null +++ b/Lang/Lasso/Tic-tac-toe @@ -0,0 +1 @@ +../../Task/Tic-tac-toe/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Time-a-function b/Lang/Lasso/Time-a-function new file mode 120000 index 0000000000..e8bbccf645 --- /dev/null +++ b/Lang/Lasso/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Towers-of-Hanoi b/Lang/Lasso/Towers-of-Hanoi new file mode 120000 index 0000000000..9dabea5979 --- /dev/null +++ b/Lang/Lasso/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Truncate-a-file b/Lang/Lasso/Truncate-a-file new file mode 120000 index 0000000000..53f237ebdd --- /dev/null +++ b/Lang/Lasso/Truncate-a-file @@ -0,0 +1 @@ +../../Task/Truncate-a-file/Lasso \ No newline at end of file diff --git a/Lang/Lasso/URL-decoding b/Lang/Lasso/URL-decoding new file mode 120000 index 0000000000..4df73860f3 --- /dev/null +++ b/Lang/Lasso/URL-decoding @@ -0,0 +1 @@ +../../Task/URL-decoding/Lasso \ No newline at end of file diff --git a/Lang/Lasso/URL-encoding b/Lang/Lasso/URL-encoding new file mode 120000 index 0000000000..0aca74e6cc --- /dev/null +++ b/Lang/Lasso/URL-encoding @@ -0,0 +1 @@ +../../Task/URL-encoding/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Unicode-strings b/Lang/Lasso/Unicode-strings new file mode 120000 index 0000000000..2a3079931f --- /dev/null +++ b/Lang/Lasso/Unicode-strings @@ -0,0 +1 @@ +../../Task/Unicode-strings/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Update-a-configuration-file b/Lang/Lasso/Update-a-configuration-file new file mode 120000 index 0000000000..a01000723b --- /dev/null +++ b/Lang/Lasso/Update-a-configuration-file @@ -0,0 +1 @@ +../../Task/Update-a-configuration-file/Lasso \ No newline at end of file diff --git a/Lang/Lasso/User-input-Text b/Lang/Lasso/User-input-Text new file mode 120000 index 0000000000..66dc2b0989 --- /dev/null +++ b/Lang/Lasso/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Variable-size-Get b/Lang/Lasso/Variable-size-Get new file mode 120000 index 0000000000..ab7e787334 --- /dev/null +++ b/Lang/Lasso/Variable-size-Get @@ -0,0 +1 @@ +../../Task/Variable-size-Get/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Variables b/Lang/Lasso/Variables new file mode 120000 index 0000000000..7330800fa0 --- /dev/null +++ b/Lang/Lasso/Variables @@ -0,0 +1 @@ +../../Task/Variables/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Variadic-function b/Lang/Lasso/Variadic-function new file mode 120000 index 0000000000..a2487528e1 --- /dev/null +++ b/Lang/Lasso/Variadic-function @@ -0,0 +1 @@ +../../Task/Variadic-function/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Walk-a-directory-Non-recursively b/Lang/Lasso/Walk-a-directory-Non-recursively new file mode 120000 index 0000000000..4ebdebce5f --- /dev/null +++ b/Lang/Lasso/Walk-a-directory-Non-recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Non-recursively/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Walk-a-directory-Recursively b/Lang/Lasso/Walk-a-directory-Recursively new file mode 120000 index 0000000000..73c8845a32 --- /dev/null +++ b/Lang/Lasso/Walk-a-directory-Recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Recursively/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Web-scraping b/Lang/Lasso/Web-scraping new file mode 120000 index 0000000000..ed068b0016 --- /dev/null +++ b/Lang/Lasso/Web-scraping @@ -0,0 +1 @@ +../../Task/Web-scraping/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Word-wrap b/Lang/Lasso/Word-wrap new file mode 120000 index 0000000000..f9c66761be --- /dev/null +++ b/Lang/Lasso/Word-wrap @@ -0,0 +1 @@ +../../Task/Word-wrap/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Write-language-name-in-3D-ASCII b/Lang/Lasso/Write-language-name-in-3D-ASCII new file mode 120000 index 0000000000..a87b80bde5 --- /dev/null +++ b/Lang/Lasso/Write-language-name-in-3D-ASCII @@ -0,0 +1 @@ +../../Task/Write-language-name-in-3D-ASCII/Lasso \ No newline at end of file diff --git a/Lang/Lasso/XML-DOM-serialization b/Lang/Lasso/XML-DOM-serialization new file mode 120000 index 0000000000..5a5575aa02 --- /dev/null +++ b/Lang/Lasso/XML-DOM-serialization @@ -0,0 +1 @@ +../../Task/XML-DOM-serialization/Lasso \ No newline at end of file diff --git a/Lang/Lasso/XML-Input b/Lang/Lasso/XML-Input new file mode 120000 index 0000000000..001648f9f5 --- /dev/null +++ b/Lang/Lasso/XML-Input @@ -0,0 +1 @@ +../../Task/XML-Input/Lasso \ No newline at end of file diff --git a/Lang/Lasso/XML-Output b/Lang/Lasso/XML-Output new file mode 120000 index 0000000000..e0aae69cac --- /dev/null +++ b/Lang/Lasso/XML-Output @@ -0,0 +1 @@ +../../Task/XML-Output/Lasso \ No newline at end of file diff --git a/Lang/Lasso/XML-XPath b/Lang/Lasso/XML-XPath new file mode 120000 index 0000000000..6edd40f5c1 --- /dev/null +++ b/Lang/Lasso/XML-XPath @@ -0,0 +1 @@ +../../Task/XML-XPath/Lasso \ No newline at end of file diff --git a/Lang/Lasso/Zig-zag-matrix b/Lang/Lasso/Zig-zag-matrix new file mode 120000 index 0000000000..f33525a6b9 --- /dev/null +++ b/Lang/Lasso/Zig-zag-matrix @@ -0,0 +1 @@ +../../Task/Zig-zag-matrix/Lasso \ No newline at end of file diff --git a/Lang/Leon/00DESCRIPTION b/Lang/Leon/00DESCRIPTION new file mode 100644 index 0000000000..ec5bba3665 --- /dev/null +++ b/Lang/Leon/00DESCRIPTION @@ -0,0 +1,17 @@ +{{language|Leon +|strength=strong +|checking=static +|gc=yes +|site=http://leon.epfl.ch +|parampass=value +|tags=leon}} +{{language programming paradigm|functional}} +{{language programming paradigm|object-oriented}} +{{language programming paradigm|generic}} +The Leon system aims to help developers build verified Scala software. It encourages using a small set of core Scala features, but provides unique automation functionality. In particular, Leon can + +* verify statically that your program confirms to a given specification and that it cannot crash at run-time +* repair a program for you to ensure that the above holds +* automatically execute and synthesize working functions from partial input/output specifications and test cases. + +[http://leon.epfl.ch/doc/intro.html Link to the documentation] \ No newline at end of file diff --git a/Lang/Leon/README b/Lang/Leon/README new file mode 100644 index 0000000000..4922b6f6d7 --- /dev/null +++ b/Lang/Leon/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Leon diff --git a/Lang/LibreOffice-Basic/00DESCRIPTION b/Lang/LibreOffice-Basic/00DESCRIPTION new file mode 100644 index 0000000000..e958bbfbc9 --- /dev/null +++ b/Lang/LibreOffice-Basic/00DESCRIPTION @@ -0,0 +1,6 @@ +{{stub}}{{language}} +The LibreOffice Basic (once called OpenOffice.org Basic) programming language has been developed especially for LibreOffice and is firmly integrated in the LibreOffice package. + +As the name suggests, OpenOffice.org Basic is a programming language from the Basic family. Anyone who has previously worked with other Basic languages — in particular with Visual Basic or Visual Basic for Applications (VBA) from Microsoft — will quickly become accustomed to LibreOffice Basic. Large sections of the basic constructs of LibreOffice Basic are compatible with Visual Basic. + +See https://help.libreoffice.org/Basic/Basic_Help \ No newline at end of file diff --git a/Lang/LibreOffice-Basic/Mutual-recursion b/Lang/LibreOffice-Basic/Mutual-recursion new file mode 120000 index 0000000000..5687d6750f --- /dev/null +++ b/Lang/LibreOffice-Basic/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/LibreOffice-Basic \ No newline at end of file diff --git a/Lang/LibreOffice-Basic/README b/Lang/LibreOffice-Basic/README new file mode 100644 index 0000000000..cbc7326c14 --- /dev/null +++ b/Lang/LibreOffice-Basic/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:LibreOffice_Basic diff --git a/Lang/Lily/00DESCRIPTION b/Lang/Lily/00DESCRIPTION new file mode 100644 index 0000000000..5e27172ddd --- /dev/null +++ b/Lang/Lily/00DESCRIPTION @@ -0,0 +1,4 @@ +{{stub}}{{language}} +Lily is a statically-typed, interpreted language developed by Jesse Ray Adkins. The source code of the interpreter can be found [https://github.com/jesserayadkins/lily here]. + +The language provides strong type-inference, and has functional influences from Scala and Haskell. However, it also has a number of features from Python (such as the exception hierarchy) and Ruby (the @ syntax for accessing class members). \ No newline at end of file diff --git a/Lang/Lily/100-doors b/Lang/Lily/100-doors new file mode 120000 index 0000000000..f9b73acb0e --- /dev/null +++ b/Lang/Lily/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Lily \ No newline at end of file diff --git a/Lang/Lily/Comments b/Lang/Lily/Comments new file mode 120000 index 0000000000..1c3ac7dc5c --- /dev/null +++ b/Lang/Lily/Comments @@ -0,0 +1 @@ +../../Task/Comments/Lily \ No newline at end of file diff --git a/Lang/Lily/Function-definition b/Lang/Lily/Function-definition new file mode 120000 index 0000000000..f4d49b985f --- /dev/null +++ b/Lang/Lily/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Lily \ No newline at end of file diff --git a/Lang/Lily/Hello-world-Text b/Lang/Lily/Hello-world-Text new file mode 120000 index 0000000000..af6dd0b10e --- /dev/null +++ b/Lang/Lily/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Lily \ No newline at end of file diff --git a/Lang/Lily/Higher-order-functions b/Lang/Lily/Higher-order-functions new file mode 120000 index 0000000000..092cfb1bd6 --- /dev/null +++ b/Lang/Lily/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/Lily \ No newline at end of file diff --git a/Lang/Lily/Loops-Infinite b/Lang/Lily/Loops-Infinite new file mode 120000 index 0000000000..0bd60637af --- /dev/null +++ b/Lang/Lily/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Lily \ No newline at end of file diff --git a/Lang/Lily/Null-object b/Lang/Lily/Null-object new file mode 120000 index 0000000000..c8a47e0289 --- /dev/null +++ b/Lang/Lily/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/Lily \ No newline at end of file diff --git a/Lang/Lily/README b/Lang/Lily/README new file mode 100644 index 0000000000..141179c402 --- /dev/null +++ b/Lang/Lily/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Lily diff --git a/Lang/Lily/Return-multiple-values b/Lang/Lily/Return-multiple-values new file mode 120000 index 0000000000..33b3edf557 --- /dev/null +++ b/Lang/Lily/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/Lily \ No newline at end of file diff --git a/Lang/Lily/Unicode-variable-names b/Lang/Lily/Unicode-variable-names new file mode 120000 index 0000000000..8b8fed89f7 --- /dev/null +++ b/Lang/Lily/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/Lily \ No newline at end of file diff --git a/Lang/Lingo/00DESCRIPTION b/Lang/Lingo/00DESCRIPTION new file mode 100644 index 0000000000..10321e0784 --- /dev/null +++ b/Lang/Lingo/00DESCRIPTION @@ -0,0 +1,3 @@ +{{language|Lingo}} + +'''Lingo''' is the primary scripting language of [[Adobe Director]] and its predecessors. It was created by [https://en.wikipedia.org/wiki/John_Thompson_(inventor) John H. Thompson] at [https://en.wikipedia.org/wiki/MacroMind MacroMind] in 1989, and first implemented in Director 2.2. \ No newline at end of file diff --git a/Lang/Lingo/Abstract-type b/Lang/Lingo/Abstract-type new file mode 120000 index 0000000000..1791a0ca99 --- /dev/null +++ b/Lang/Lingo/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Anonymous-recursion b/Lang/Lingo/Anonymous-recursion new file mode 120000 index 0000000000..dfc0e506ff --- /dev/null +++ b/Lang/Lingo/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Arithmetic-Rational b/Lang/Lingo/Arithmetic-Rational new file mode 120000 index 0000000000..c1680ef376 --- /dev/null +++ b/Lang/Lingo/Arithmetic-Rational @@ -0,0 +1 @@ +../../Task/Arithmetic-Rational/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Array-concatenation b/Lang/Lingo/Array-concatenation new file mode 120000 index 0000000000..83d4641d1d --- /dev/null +++ b/Lang/Lingo/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Arrays b/Lang/Lingo/Arrays new file mode 120000 index 0000000000..5f1ad5a3fd --- /dev/null +++ b/Lang/Lingo/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Assertions b/Lang/Lingo/Assertions new file mode 120000 index 0000000000..8417c6b174 --- /dev/null +++ b/Lang/Lingo/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Associative-array-Creation b/Lang/Lingo/Associative-array-Creation new file mode 120000 index 0000000000..601890c68c --- /dev/null +++ b/Lang/Lingo/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Associative-array-Iteration b/Lang/Lingo/Associative-array-Iteration new file mode 120000 index 0000000000..1a3a565265 --- /dev/null +++ b/Lang/Lingo/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Bitmap b/Lang/Lingo/Bitmap new file mode 120000 index 0000000000..536c95301c --- /dev/null +++ b/Lang/Lingo/Bitmap @@ -0,0 +1 @@ +../../Task/Bitmap/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Bitmap-Flood-fill b/Lang/Lingo/Bitmap-Flood-fill new file mode 120000 index 0000000000..07bb906b00 --- /dev/null +++ b/Lang/Lingo/Bitmap-Flood-fill @@ -0,0 +1 @@ +../../Task/Bitmap-Flood-fill/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Bitwise-IO b/Lang/Lingo/Bitwise-IO new file mode 120000 index 0000000000..2165ce6f1a --- /dev/null +++ b/Lang/Lingo/Bitwise-IO @@ -0,0 +1 @@ +../../Task/Bitwise-IO/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Bitwise-operations b/Lang/Lingo/Bitwise-operations new file mode 120000 index 0000000000..b0cd40babf --- /dev/null +++ b/Lang/Lingo/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Boolean-values b/Lang/Lingo/Boolean-values new file mode 120000 index 0000000000..68c8a4320a --- /dev/null +++ b/Lang/Lingo/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/Lingo \ No newline at end of file diff --git a/Lang/Lingo/CRC-32 b/Lang/Lingo/CRC-32 new file mode 120000 index 0000000000..16c46216df --- /dev/null +++ b/Lang/Lingo/CRC-32 @@ -0,0 +1 @@ +../../Task/CRC-32/Lingo \ No newline at end of file diff --git a/Lang/Lingo/CSV-data-manipulation b/Lang/Lingo/CSV-data-manipulation new file mode 120000 index 0000000000..622a313881 --- /dev/null +++ b/Lang/Lingo/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Calendar b/Lang/Lingo/Calendar new file mode 120000 index 0000000000..bc514a1ce8 --- /dev/null +++ b/Lang/Lingo/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Call-a-function b/Lang/Lingo/Call-a-function new file mode 120000 index 0000000000..5642f58b3f --- /dev/null +++ b/Lang/Lingo/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Call-a-function-in-a-shared-library b/Lang/Lingo/Call-a-function-in-a-shared-library new file mode 120000 index 0000000000..294d96a4c8 --- /dev/null +++ b/Lang/Lingo/Call-a-function-in-a-shared-library @@ -0,0 +1 @@ +../../Task/Call-a-function-in-a-shared-library/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Call-an-object-method b/Lang/Lingo/Call-an-object-method new file mode 120000 index 0000000000..453fea3315 --- /dev/null +++ b/Lang/Lingo/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Character-codes b/Lang/Lingo/Character-codes new file mode 120000 index 0000000000..f877824a66 --- /dev/null +++ b/Lang/Lingo/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Classes b/Lang/Lingo/Classes new file mode 120000 index 0000000000..0edfe54f63 --- /dev/null +++ b/Lang/Lingo/Classes @@ -0,0 +1 @@ +../../Task/Classes/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Closures-Value-capture b/Lang/Lingo/Closures-Value-capture new file mode 120000 index 0000000000..d07fff5fcf --- /dev/null +++ b/Lang/Lingo/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Collections b/Lang/Lingo/Collections new file mode 120000 index 0000000000..b421099eef --- /dev/null +++ b/Lang/Lingo/Collections @@ -0,0 +1 @@ +../../Task/Collections/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Color-of-a-screen-pixel b/Lang/Lingo/Color-of-a-screen-pixel new file mode 120000 index 0000000000..163e0e7b42 --- /dev/null +++ b/Lang/Lingo/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Command-line-arguments b/Lang/Lingo/Command-line-arguments new file mode 120000 index 0000000000..aaa48f62ec --- /dev/null +++ b/Lang/Lingo/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Comments b/Lang/Lingo/Comments new file mode 120000 index 0000000000..c7770e8d54 --- /dev/null +++ b/Lang/Lingo/Comments @@ -0,0 +1 @@ +../../Task/Comments/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Compile-time-calculation b/Lang/Lingo/Compile-time-calculation new file mode 120000 index 0000000000..43e1509241 --- /dev/null +++ b/Lang/Lingo/Compile-time-calculation @@ -0,0 +1 @@ +../../Task/Compile-time-calculation/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Compound-data-type b/Lang/Lingo/Compound-data-type new file mode 120000 index 0000000000..86a42035ec --- /dev/null +++ b/Lang/Lingo/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Copy-a-string b/Lang/Lingo/Copy-a-string new file mode 120000 index 0000000000..6454d3e437 --- /dev/null +++ b/Lang/Lingo/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Create-a-file b/Lang/Lingo/Create-a-file new file mode 120000 index 0000000000..9f8bbe7fae --- /dev/null +++ b/Lang/Lingo/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Create-an-HTML-table b/Lang/Lingo/Create-an-HTML-table new file mode 120000 index 0000000000..6164671673 --- /dev/null +++ b/Lang/Lingo/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Date-manipulation b/Lang/Lingo/Date-manipulation new file mode 120000 index 0000000000..9a77421f33 --- /dev/null +++ b/Lang/Lingo/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Day-of-the-week b/Lang/Lingo/Day-of-the-week new file mode 120000 index 0000000000..746b2cb062 --- /dev/null +++ b/Lang/Lingo/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Deepcopy b/Lang/Lingo/Deepcopy new file mode 120000 index 0000000000..609379622f --- /dev/null +++ b/Lang/Lingo/Deepcopy @@ -0,0 +1 @@ +../../Task/Deepcopy/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Delete-a-file b/Lang/Lingo/Delete-a-file new file mode 120000 index 0000000000..1b072ec997 --- /dev/null +++ b/Lang/Lingo/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Detect-division-by-zero b/Lang/Lingo/Detect-division-by-zero new file mode 120000 index 0000000000..289bd6a882 --- /dev/null +++ b/Lang/Lingo/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Draw-a-sphere b/Lang/Lingo/Draw-a-sphere new file mode 120000 index 0000000000..2d40118442 --- /dev/null +++ b/Lang/Lingo/Draw-a-sphere @@ -0,0 +1 @@ +../../Task/Draw-a-sphere/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Dynamic-variable-names b/Lang/Lingo/Dynamic-variable-names new file mode 120000 index 0000000000..d9b17c22e2 --- /dev/null +++ b/Lang/Lingo/Dynamic-variable-names @@ -0,0 +1 @@ +../../Task/Dynamic-variable-names/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Empty-directory b/Lang/Lingo/Empty-directory new file mode 120000 index 0000000000..0dbdd0c476 --- /dev/null +++ b/Lang/Lingo/Empty-directory @@ -0,0 +1 @@ +../../Task/Empty-directory/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Empty-program b/Lang/Lingo/Empty-program new file mode 120000 index 0000000000..9edcb71a38 --- /dev/null +++ b/Lang/Lingo/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Empty-string b/Lang/Lingo/Empty-string new file mode 120000 index 0000000000..563eef54ff --- /dev/null +++ b/Lang/Lingo/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Enumerations b/Lang/Lingo/Enumerations new file mode 120000 index 0000000000..6a23ac126e --- /dev/null +++ b/Lang/Lingo/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Environment-variables b/Lang/Lingo/Environment-variables new file mode 120000 index 0000000000..8c0c39da7f --- /dev/null +++ b/Lang/Lingo/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Even-or-odd b/Lang/Lingo/Even-or-odd new file mode 120000 index 0000000000..2d5dc9c369 --- /dev/null +++ b/Lang/Lingo/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Events b/Lang/Lingo/Events new file mode 120000 index 0000000000..9116b14adc --- /dev/null +++ b/Lang/Lingo/Events @@ -0,0 +1 @@ +../../Task/Events/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Exceptions b/Lang/Lingo/Exceptions new file mode 120000 index 0000000000..da03b2bd8e --- /dev/null +++ b/Lang/Lingo/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Execute-a-system-command b/Lang/Lingo/Execute-a-system-command new file mode 120000 index 0000000000..7110a621aa --- /dev/null +++ b/Lang/Lingo/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Exponentiation-operator b/Lang/Lingo/Exponentiation-operator new file mode 120000 index 0000000000..415fb13b96 --- /dev/null +++ b/Lang/Lingo/Exponentiation-operator @@ -0,0 +1 @@ +../../Task/Exponentiation-operator/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Factorial b/Lang/Lingo/Factorial new file mode 120000 index 0000000000..55b6c23780 --- /dev/null +++ b/Lang/Lingo/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Factors-of-an-integer b/Lang/Lingo/Factors-of-an-integer new file mode 120000 index 0000000000..94d53da3ad --- /dev/null +++ b/Lang/Lingo/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Fibonacci-sequence b/Lang/Lingo/Fibonacci-sequence new file mode 120000 index 0000000000..fe6866feb7 --- /dev/null +++ b/Lang/Lingo/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Lingo \ No newline at end of file diff --git a/Lang/Lingo/File-input-output b/Lang/Lingo/File-input-output new file mode 120000 index 0000000000..09e5bc0f13 --- /dev/null +++ b/Lang/Lingo/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/Lingo \ No newline at end of file diff --git a/Lang/Lingo/File-size b/Lang/Lingo/File-size new file mode 120000 index 0000000000..eb31231dff --- /dev/null +++ b/Lang/Lingo/File-size @@ -0,0 +1 @@ +../../Task/File-size/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Find-common-directory-path b/Lang/Lingo/Find-common-directory-path new file mode 120000 index 0000000000..fd101f6ff2 --- /dev/null +++ b/Lang/Lingo/Find-common-directory-path @@ -0,0 +1 @@ +../../Task/Find-common-directory-path/Lingo \ No newline at end of file diff --git a/Lang/Lingo/First-class-functions b/Lang/Lingo/First-class-functions new file mode 120000 index 0000000000..cf695db4fd --- /dev/null +++ b/Lang/Lingo/First-class-functions @@ -0,0 +1 @@ +../../Task/First-class-functions/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Fractal-tree b/Lang/Lingo/Fractal-tree new file mode 120000 index 0000000000..76365738b8 --- /dev/null +++ b/Lang/Lingo/Fractal-tree @@ -0,0 +1 @@ +../../Task/Fractal-tree/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Function-composition b/Lang/Lingo/Function-composition new file mode 120000 index 0000000000..67dd89655e --- /dev/null +++ b/Lang/Lingo/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Function-definition b/Lang/Lingo/Function-definition new file mode 120000 index 0000000000..5898f7d254 --- /dev/null +++ b/Lang/Lingo/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Lingo \ No newline at end of file diff --git a/Lang/Lingo/GUI-Maximum-window-dimensions b/Lang/Lingo/GUI-Maximum-window-dimensions new file mode 120000 index 0000000000..b7191d24bb --- /dev/null +++ b/Lang/Lingo/GUI-Maximum-window-dimensions @@ -0,0 +1 @@ +../../Task/GUI-Maximum-window-dimensions/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Generate-lower-case-ASCII-alphabet b/Lang/Lingo/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..0a7744df15 --- /dev/null +++ b/Lang/Lingo/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Generic-swap b/Lang/Lingo/Generic-swap new file mode 120000 index 0000000000..c201e41c0e --- /dev/null +++ b/Lang/Lingo/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Grayscale-image b/Lang/Lingo/Grayscale-image new file mode 120000 index 0000000000..c7af2cf0ae --- /dev/null +++ b/Lang/Lingo/Grayscale-image @@ -0,0 +1 @@ +../../Task/Grayscale-image/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Greatest-element-of-a-list b/Lang/Lingo/Greatest-element-of-a-list new file mode 120000 index 0000000000..7a50ea1b4d --- /dev/null +++ b/Lang/Lingo/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Lingo \ No newline at end of file diff --git a/Lang/Lingo/HTTP b/Lang/Lingo/HTTP new file mode 120000 index 0000000000..4072910e01 --- /dev/null +++ b/Lang/Lingo/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/Lingo \ No newline at end of file diff --git a/Lang/Lingo/HTTPS b/Lang/Lingo/HTTPS new file mode 120000 index 0000000000..3163e5a358 --- /dev/null +++ b/Lang/Lingo/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Hailstone-sequence b/Lang/Lingo/Hailstone-sequence new file mode 120000 index 0000000000..7c90ddc758 --- /dev/null +++ b/Lang/Lingo/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Hash-from-two-arrays b/Lang/Lingo/Hash-from-two-arrays new file mode 120000 index 0000000000..b254adcc08 --- /dev/null +++ b/Lang/Lingo/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Hello-world-Graphical b/Lang/Lingo/Hello-world-Graphical new file mode 120000 index 0000000000..1b3be6c15e --- /dev/null +++ b/Lang/Lingo/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Hello-world-Standard-error b/Lang/Lingo/Hello-world-Standard-error new file mode 120000 index 0000000000..534d997aec --- /dev/null +++ b/Lang/Lingo/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Hello-world-Text b/Lang/Lingo/Hello-world-Text new file mode 120000 index 0000000000..fb2fe773ba --- /dev/null +++ b/Lang/Lingo/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Here-document b/Lang/Lingo/Here-document new file mode 120000 index 0000000000..e11fe4f0a6 --- /dev/null +++ b/Lang/Lingo/Here-document @@ -0,0 +1 @@ +../../Task/Here-document/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Higher-order-functions b/Lang/Lingo/Higher-order-functions new file mode 120000 index 0000000000..e9c2634854 --- /dev/null +++ b/Lang/Lingo/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Hostname b/Lang/Lingo/Hostname new file mode 120000 index 0000000000..027d0ab027 --- /dev/null +++ b/Lang/Lingo/Hostname @@ -0,0 +1 @@ +../../Task/Hostname/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Include-a-file b/Lang/Lingo/Include-a-file new file mode 120000 index 0000000000..3740585e7a --- /dev/null +++ b/Lang/Lingo/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Increment-a-numerical-string b/Lang/Lingo/Increment-a-numerical-string new file mode 120000 index 0000000000..b1d0f5fa01 --- /dev/null +++ b/Lang/Lingo/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Infinity b/Lang/Lingo/Infinity new file mode 120000 index 0000000000..06eea46099 --- /dev/null +++ b/Lang/Lingo/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Inheritance-Multiple b/Lang/Lingo/Inheritance-Multiple new file mode 120000 index 0000000000..b74876a33b --- /dev/null +++ b/Lang/Lingo/Inheritance-Multiple @@ -0,0 +1 @@ +../../Task/Inheritance-Multiple/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Inheritance-Single b/Lang/Lingo/Inheritance-Single new file mode 120000 index 0000000000..7dee7ef40f --- /dev/null +++ b/Lang/Lingo/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Integer-comparison b/Lang/Lingo/Integer-comparison new file mode 120000 index 0000000000..14e1d8ba22 --- /dev/null +++ b/Lang/Lingo/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Integer-overflow b/Lang/Lingo/Integer-overflow new file mode 120000 index 0000000000..61623ce7e9 --- /dev/null +++ b/Lang/Lingo/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Integer-sequence b/Lang/Lingo/Integer-sequence new file mode 120000 index 0000000000..41ef99fcf0 --- /dev/null +++ b/Lang/Lingo/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Interactive-programming b/Lang/Lingo/Interactive-programming new file mode 120000 index 0000000000..ce5a8e2aad --- /dev/null +++ b/Lang/Lingo/Interactive-programming @@ -0,0 +1 @@ +../../Task/Interactive-programming/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Introspection b/Lang/Lingo/Introspection new file mode 120000 index 0000000000..04f4d7a865 --- /dev/null +++ b/Lang/Lingo/Introspection @@ -0,0 +1 @@ +../../Task/Introspection/Lingo \ No newline at end of file diff --git a/Lang/Lingo/JSON b/Lang/Lingo/JSON new file mode 120000 index 0000000000..8d2c3c0bfb --- /dev/null +++ b/Lang/Lingo/JSON @@ -0,0 +1 @@ +../../Task/JSON/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Jump-anywhere b/Lang/Lingo/Jump-anywhere new file mode 120000 index 0000000000..8dbb9d9d71 --- /dev/null +++ b/Lang/Lingo/Jump-anywhere @@ -0,0 +1 @@ +../../Task/Jump-anywhere/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Keyboard-input-Keypress-check b/Lang/Lingo/Keyboard-input-Keypress-check new file mode 120000 index 0000000000..8385a5c3bc --- /dev/null +++ b/Lang/Lingo/Keyboard-input-Keypress-check @@ -0,0 +1 @@ +../../Task/Keyboard-input-Keypress-check/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Leap-year b/Lang/Lingo/Leap-year new file mode 120000 index 0000000000..4f03cbf9ec --- /dev/null +++ b/Lang/Lingo/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Literals-Floating-point b/Lang/Lingo/Literals-Floating-point new file mode 120000 index 0000000000..c4ae39f547 --- /dev/null +++ b/Lang/Lingo/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Literals-String b/Lang/Lingo/Literals-String new file mode 120000 index 0000000000..be957e1987 --- /dev/null +++ b/Lang/Lingo/Literals-String @@ -0,0 +1 @@ +../../Task/Literals-String/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Loops-Break b/Lang/Lingo/Loops-Break new file mode 120000 index 0000000000..817ef867b8 --- /dev/null +++ b/Lang/Lingo/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Loops-Continue b/Lang/Lingo/Loops-Continue new file mode 120000 index 0000000000..98b0d9b02e --- /dev/null +++ b/Lang/Lingo/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Loops-Do-while b/Lang/Lingo/Loops-Do-while new file mode 120000 index 0000000000..ecbc3f13d3 --- /dev/null +++ b/Lang/Lingo/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Loops-Downward-for b/Lang/Lingo/Loops-Downward-for new file mode 120000 index 0000000000..666a98d7d3 --- /dev/null +++ b/Lang/Lingo/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Loops-For b/Lang/Lingo/Loops-For new file mode 120000 index 0000000000..545febc5cf --- /dev/null +++ b/Lang/Lingo/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Loops-For-with-a-specified-step b/Lang/Lingo/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..6a85bfd00c --- /dev/null +++ b/Lang/Lingo/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Loops-Foreach b/Lang/Lingo/Loops-Foreach new file mode 120000 index 0000000000..4903743a04 --- /dev/null +++ b/Lang/Lingo/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Loops-Infinite b/Lang/Lingo/Loops-Infinite new file mode 120000 index 0000000000..edeb01abf1 --- /dev/null +++ b/Lang/Lingo/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Loops-Nested b/Lang/Lingo/Loops-Nested new file mode 120000 index 0000000000..a3cf7a908f --- /dev/null +++ b/Lang/Lingo/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Loops-While b/Lang/Lingo/Loops-While new file mode 120000 index 0000000000..42a2a96fe1 --- /dev/null +++ b/Lang/Lingo/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Lingo \ No newline at end of file diff --git a/Lang/Lingo/MD5 b/Lang/Lingo/MD5 new file mode 120000 index 0000000000..cfd1f95463 --- /dev/null +++ b/Lang/Lingo/MD5 @@ -0,0 +1 @@ +../../Task/MD5/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Memory-allocation b/Lang/Lingo/Memory-allocation new file mode 120000 index 0000000000..6d862da328 --- /dev/null +++ b/Lang/Lingo/Memory-allocation @@ -0,0 +1 @@ +../../Task/Memory-allocation/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Metaprogramming b/Lang/Lingo/Metaprogramming new file mode 120000 index 0000000000..9fd09ff610 --- /dev/null +++ b/Lang/Lingo/Metaprogramming @@ -0,0 +1 @@ +../../Task/Metaprogramming/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Mouse-position b/Lang/Lingo/Mouse-position new file mode 120000 index 0000000000..70a75dbe74 --- /dev/null +++ b/Lang/Lingo/Mouse-position @@ -0,0 +1 @@ +../../Task/Mouse-position/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Named-parameters b/Lang/Lingo/Named-parameters new file mode 120000 index 0000000000..6920b77a13 --- /dev/null +++ b/Lang/Lingo/Named-parameters @@ -0,0 +1 @@ +../../Task/Named-parameters/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Nth-root b/Lang/Lingo/Nth-root new file mode 120000 index 0000000000..eaeae2dea7 --- /dev/null +++ b/Lang/Lingo/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Null-object b/Lang/Lingo/Null-object new file mode 120000 index 0000000000..594516fcca --- /dev/null +++ b/Lang/Lingo/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Ordered-words b/Lang/Lingo/Ordered-words new file mode 120000 index 0000000000..cd12e4bb52 --- /dev/null +++ b/Lang/Lingo/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Perfect-numbers b/Lang/Lingo/Perfect-numbers new file mode 120000 index 0000000000..b24d02fc1f --- /dev/null +++ b/Lang/Lingo/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Prime-decomposition b/Lang/Lingo/Prime-decomposition new file mode 120000 index 0000000000..ca3839f6f5 --- /dev/null +++ b/Lang/Lingo/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Program-name b/Lang/Lingo/Program-name new file mode 120000 index 0000000000..1b060eec6f --- /dev/null +++ b/Lang/Lingo/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/Lingo \ No newline at end of file diff --git a/Lang/Lingo/README b/Lang/Lingo/README new file mode 100644 index 0000000000..10e4154095 --- /dev/null +++ b/Lang/Lingo/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Lingo diff --git a/Lang/Lingo/Range-expansion b/Lang/Lingo/Range-expansion new file mode 120000 index 0000000000..2c633c5c1e --- /dev/null +++ b/Lang/Lingo/Range-expansion @@ -0,0 +1 @@ +../../Task/Range-expansion/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Read-a-file-line-by-line b/Lang/Lingo/Read-a-file-line-by-line new file mode 120000 index 0000000000..21878246e2 --- /dev/null +++ b/Lang/Lingo/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Read-entire-file b/Lang/Lingo/Read-entire-file new file mode 120000 index 0000000000..7e9533ff55 --- /dev/null +++ b/Lang/Lingo/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Real-constants-and-functions b/Lang/Lingo/Real-constants-and-functions new file mode 120000 index 0000000000..8e22199bfd --- /dev/null +++ b/Lang/Lingo/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Repeat-a-string b/Lang/Lingo/Repeat-a-string new file mode 120000 index 0000000000..1d534add0f --- /dev/null +++ b/Lang/Lingo/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Reverse-a-string b/Lang/Lingo/Reverse-a-string new file mode 120000 index 0000000000..cbc9c9e353 --- /dev/null +++ b/Lang/Lingo/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Search-a-list b/Lang/Lingo/Search-a-list new file mode 120000 index 0000000000..a315ff2238 --- /dev/null +++ b/Lang/Lingo/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Send-an-unknown-method-call b/Lang/Lingo/Send-an-unknown-method-call new file mode 120000 index 0000000000..c7e1a3379d --- /dev/null +++ b/Lang/Lingo/Send-an-unknown-method-call @@ -0,0 +1 @@ +../../Task/Send-an-unknown-method-call/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Send-email b/Lang/Lingo/Send-email new file mode 120000 index 0000000000..fa4fb6dd1f --- /dev/null +++ b/Lang/Lingo/Send-email @@ -0,0 +1 @@ +../../Task/Send-email/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Simple-windowed-application b/Lang/Lingo/Simple-windowed-application new file mode 120000 index 0000000000..8fbac74086 --- /dev/null +++ b/Lang/Lingo/Simple-windowed-application @@ -0,0 +1 @@ +../../Task/Simple-windowed-application/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Singleton b/Lang/Lingo/Singleton new file mode 120000 index 0000000000..256bbfff7e --- /dev/null +++ b/Lang/Lingo/Singleton @@ -0,0 +1 @@ +../../Task/Singleton/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Sleep b/Lang/Lingo/Sleep new file mode 120000 index 0000000000..af21897e64 --- /dev/null +++ b/Lang/Lingo/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Sort-an-integer-array b/Lang/Lingo/Sort-an-integer-array new file mode 120000 index 0000000000..1f822c6a78 --- /dev/null +++ b/Lang/Lingo/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Special-characters b/Lang/Lingo/Special-characters new file mode 120000 index 0000000000..9a5f375089 --- /dev/null +++ b/Lang/Lingo/Special-characters @@ -0,0 +1 @@ +../../Task/Special-characters/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Stack b/Lang/Lingo/Stack new file mode 120000 index 0000000000..8e68578163 --- /dev/null +++ b/Lang/Lingo/Stack @@ -0,0 +1 @@ +../../Task/Stack/Lingo \ No newline at end of file diff --git a/Lang/Lingo/String-append b/Lang/Lingo/String-append new file mode 120000 index 0000000000..82f3cd59d8 --- /dev/null +++ b/Lang/Lingo/String-append @@ -0,0 +1 @@ +../../Task/String-append/Lingo \ No newline at end of file diff --git a/Lang/Lingo/String-case b/Lang/Lingo/String-case new file mode 120000 index 0000000000..6524d40811 --- /dev/null +++ b/Lang/Lingo/String-case @@ -0,0 +1 @@ +../../Task/String-case/Lingo \ No newline at end of file diff --git a/Lang/Lingo/String-comparison b/Lang/Lingo/String-comparison new file mode 120000 index 0000000000..0049443fdc --- /dev/null +++ b/Lang/Lingo/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/Lingo \ No newline at end of file diff --git a/Lang/Lingo/String-concatenation b/Lang/Lingo/String-concatenation new file mode 120000 index 0000000000..6d14f45ff4 --- /dev/null +++ b/Lang/Lingo/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Lingo \ No newline at end of file diff --git a/Lang/Lingo/String-length b/Lang/Lingo/String-length new file mode 120000 index 0000000000..e2f1d1fda6 --- /dev/null +++ b/Lang/Lingo/String-length @@ -0,0 +1 @@ +../../Task/String-length/Lingo \ No newline at end of file diff --git a/Lang/Lingo/String-matching b/Lang/Lingo/String-matching new file mode 120000 index 0000000000..8672c9cecd --- /dev/null +++ b/Lang/Lingo/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/Lingo \ No newline at end of file diff --git a/Lang/Lingo/String-prepend b/Lang/Lingo/String-prepend new file mode 120000 index 0000000000..e01150f59f --- /dev/null +++ b/Lang/Lingo/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Substring b/Lang/Lingo/Substring new file mode 120000 index 0000000000..df79c31903 --- /dev/null +++ b/Lang/Lingo/Substring @@ -0,0 +1 @@ +../../Task/Substring/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Sum-and-product-of-an-array b/Lang/Lingo/Sum-and-product-of-an-array new file mode 120000 index 0000000000..1b33081cb5 --- /dev/null +++ b/Lang/Lingo/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Sum-digits-of-an-integer b/Lang/Lingo/Sum-digits-of-an-integer new file mode 120000 index 0000000000..fdf9167ad5 --- /dev/null +++ b/Lang/Lingo/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Sum-multiples-of-3-and-5 b/Lang/Lingo/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..07b8b1bbbd --- /dev/null +++ b/Lang/Lingo/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Sum-of-a-series b/Lang/Lingo/Sum-of-a-series new file mode 120000 index 0000000000..fb2ce0e0b8 --- /dev/null +++ b/Lang/Lingo/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Lingo \ No newline at end of file diff --git a/Lang/Lingo/System-time b/Lang/Lingo/System-time new file mode 120000 index 0000000000..4c962ad34c --- /dev/null +++ b/Lang/Lingo/System-time @@ -0,0 +1 @@ +../../Task/System-time/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Time-a-function b/Lang/Lingo/Time-a-function new file mode 120000 index 0000000000..2762362dab --- /dev/null +++ b/Lang/Lingo/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Tokenize-a-string b/Lang/Lingo/Tokenize-a-string new file mode 120000 index 0000000000..a21371063c --- /dev/null +++ b/Lang/Lingo/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Towers-of-Hanoi b/Lang/Lingo/Towers-of-Hanoi new file mode 120000 index 0000000000..cb0dbc0269 --- /dev/null +++ b/Lang/Lingo/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Tree-traversal b/Lang/Lingo/Tree-traversal new file mode 120000 index 0000000000..7257f94a7e --- /dev/null +++ b/Lang/Lingo/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Truncate-a-file b/Lang/Lingo/Truncate-a-file new file mode 120000 index 0000000000..c8851e67dc --- /dev/null +++ b/Lang/Lingo/Truncate-a-file @@ -0,0 +1 @@ +../../Task/Truncate-a-file/Lingo \ No newline at end of file diff --git a/Lang/Lingo/URL-encoding b/Lang/Lingo/URL-encoding new file mode 120000 index 0000000000..353dc46977 --- /dev/null +++ b/Lang/Lingo/URL-encoding @@ -0,0 +1 @@ +../../Task/URL-encoding/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Undefined-values b/Lang/Lingo/Undefined-values new file mode 120000 index 0000000000..9ee8196334 --- /dev/null +++ b/Lang/Lingo/Undefined-values @@ -0,0 +1 @@ +../../Task/Undefined-values/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Unicode-strings b/Lang/Lingo/Unicode-strings new file mode 120000 index 0000000000..3e968de68a --- /dev/null +++ b/Lang/Lingo/Unicode-strings @@ -0,0 +1 @@ +../../Task/Unicode-strings/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Unicode-variable-names b/Lang/Lingo/Unicode-variable-names new file mode 120000 index 0000000000..ca0721f4c7 --- /dev/null +++ b/Lang/Lingo/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Variables b/Lang/Lingo/Variables new file mode 120000 index 0000000000..67d71f4ed6 --- /dev/null +++ b/Lang/Lingo/Variables @@ -0,0 +1 @@ +../../Task/Variables/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Vector-products b/Lang/Lingo/Vector-products new file mode 120000 index 0000000000..537ffbf2a4 --- /dev/null +++ b/Lang/Lingo/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Visualize-a-tree b/Lang/Lingo/Visualize-a-tree new file mode 120000 index 0000000000..410a6af3d6 --- /dev/null +++ b/Lang/Lingo/Visualize-a-tree @@ -0,0 +1 @@ +../../Task/Visualize-a-tree/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Walk-a-directory-Non-recursively b/Lang/Lingo/Walk-a-directory-Non-recursively new file mode 120000 index 0000000000..7db64f5f4b --- /dev/null +++ b/Lang/Lingo/Walk-a-directory-Non-recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Non-recursively/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Window-creation b/Lang/Lingo/Window-creation new file mode 120000 index 0000000000..7c59c6b7d3 --- /dev/null +++ b/Lang/Lingo/Window-creation @@ -0,0 +1 @@ +../../Task/Window-creation/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Word-wrap b/Lang/Lingo/Word-wrap new file mode 120000 index 0000000000..a9da17ac2a --- /dev/null +++ b/Lang/Lingo/Word-wrap @@ -0,0 +1 @@ +../../Task/Word-wrap/Lingo \ No newline at end of file diff --git a/Lang/Lingo/Write-float-arrays-to-a-text-file b/Lang/Lingo/Write-float-arrays-to-a-text-file new file mode 120000 index 0000000000..f3de5aeb4b --- /dev/null +++ b/Lang/Lingo/Write-float-arrays-to-a-text-file @@ -0,0 +1 @@ +../../Task/Write-float-arrays-to-a-text-file/Lingo \ No newline at end of file diff --git a/Lang/Lingo/XML-DOM-serialization b/Lang/Lingo/XML-DOM-serialization new file mode 120000 index 0000000000..c57322f690 --- /dev/null +++ b/Lang/Lingo/XML-DOM-serialization @@ -0,0 +1 @@ +../../Task/XML-DOM-serialization/Lingo \ No newline at end of file diff --git a/Lang/Lingo/XML-Input b/Lang/Lingo/XML-Input new file mode 120000 index 0000000000..85ee11c3ab --- /dev/null +++ b/Lang/Lingo/XML-Input @@ -0,0 +1 @@ +../../Task/XML-Input/Lingo \ No newline at end of file diff --git a/Lang/LiveCode/00DESCRIPTION b/Lang/LiveCode/00DESCRIPTION new file mode 100644 index 0000000000..9c54104075 --- /dev/null +++ b/Lang/LiveCode/00DESCRIPTION @@ -0,0 +1,23 @@ +{{language|LiveCode +|exec=bytecode +|gc=yes +|site= http://www.livecode.com +|LCT=yes}}{{language programming paradigm|Dynamic}} +{{language programming paradigm|Object-oriented}} +{{language programming paradigm|Imperative}} +LiveCode (formerly known as Revolution) is a byte-code compiled language created by [http://www.runrev.com Runtime Revolution] + +It is inspired by HyperCard/HyperTalk, but goes far beyond that heritage by: +*Creating applications that run on: +** OS X +** Mac Classic +** Windows +** Unix +** iOS +** Android +** Web Servers (with LiveCode sever) +** Web Browser HTML5 Engine (as of version 8) +*Having a full interface toolkit with native widgets on all platforms +*Incorporating modern language features like regex, associative arrays, support for internet protocols, etc. +*Supporting color natively (HyperCard die-hards are now breathing a sigh of relief) +** As of version 8 LiveCode includes an additional, strictly typed language variant called LiveCodeBuilder (LCB) which allows access to foreign code libraries (currently supports C libraries only, support for others to be added) \ No newline at end of file diff --git a/Lang/LiveCode/100-doors b/Lang/LiveCode/100-doors new file mode 120000 index 0000000000..3eb2d4cd7a --- /dev/null +++ b/Lang/LiveCode/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/24-game b/Lang/LiveCode/24-game new file mode 120000 index 0000000000..1715377e9f --- /dev/null +++ b/Lang/LiveCode/24-game @@ -0,0 +1 @@ +../../Task/24-game/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/99-Bottles-of-Beer b/Lang/LiveCode/99-Bottles-of-Beer new file mode 120000 index 0000000000..c30d25a023 --- /dev/null +++ b/Lang/LiveCode/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/A+B b/Lang/LiveCode/A+B new file mode 120000 index 0000000000..62e579865c --- /dev/null +++ b/Lang/LiveCode/A+B @@ -0,0 +1 @@ +../../Task/A+B/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Ackermann-function b/Lang/LiveCode/Ackermann-function new file mode 120000 index 0000000000..5bed464ea4 --- /dev/null +++ b/Lang/LiveCode/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Anagrams b/Lang/LiveCode/Anagrams new file mode 120000 index 0000000000..637bf3f92f --- /dev/null +++ b/Lang/LiveCode/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Arithmetic-Integer b/Lang/LiveCode/Arithmetic-Integer new file mode 120000 index 0000000000..fbfb2c2a8b --- /dev/null +++ b/Lang/LiveCode/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Arithmetic-geometric-mean b/Lang/LiveCode/Arithmetic-geometric-mean new file mode 120000 index 0000000000..617f749f7e --- /dev/null +++ b/Lang/LiveCode/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Associative-array-Creation b/Lang/LiveCode/Associative-array-Creation new file mode 120000 index 0000000000..6d78d9d30f --- /dev/null +++ b/Lang/LiveCode/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Associative-array-Iteration b/Lang/LiveCode/Associative-array-Iteration new file mode 120000 index 0000000000..7ea6f89e03 --- /dev/null +++ b/Lang/LiveCode/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Averages-Arithmetic-mean b/Lang/LiveCode/Averages-Arithmetic-mean new file mode 120000 index 0000000000..10a24d640f --- /dev/null +++ b/Lang/LiveCode/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Averages-Median b/Lang/LiveCode/Averages-Median new file mode 120000 index 0000000000..7a4fd0ff9e --- /dev/null +++ b/Lang/LiveCode/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Bitwise-operations b/Lang/LiveCode/Bitwise-operations new file mode 120000 index 0000000000..cef8748af7 --- /dev/null +++ b/Lang/LiveCode/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Caesar-cipher b/Lang/LiveCode/Caesar-cipher new file mode 120000 index 0000000000..bf79527e49 --- /dev/null +++ b/Lang/LiveCode/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Character-codes b/Lang/LiveCode/Character-codes new file mode 120000 index 0000000000..d7ea02f1e8 --- /dev/null +++ b/Lang/LiveCode/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Check-that-file-exists b/Lang/LiveCode/Check-that-file-exists new file mode 120000 index 0000000000..86c501ab96 --- /dev/null +++ b/Lang/LiveCode/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Comments b/Lang/LiveCode/Comments new file mode 120000 index 0000000000..d1f6653e23 --- /dev/null +++ b/Lang/LiveCode/Comments @@ -0,0 +1 @@ +../../Task/Comments/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Copy-a-string b/Lang/LiveCode/Copy-a-string new file mode 120000 index 0000000000..4632374fd0 --- /dev/null +++ b/Lang/LiveCode/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Day-of-the-week b/Lang/LiveCode/Day-of-the-week new file mode 120000 index 0000000000..d50f94013c --- /dev/null +++ b/Lang/LiveCode/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Even-or-odd b/Lang/LiveCode/Even-or-odd new file mode 120000 index 0000000000..831da29043 --- /dev/null +++ b/Lang/LiveCode/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Factorial b/Lang/LiveCode/Factorial new file mode 120000 index 0000000000..c0f934962b --- /dev/null +++ b/Lang/LiveCode/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Fibonacci-sequence b/Lang/LiveCode/Fibonacci-sequence new file mode 120000 index 0000000000..ee30fceff7 --- /dev/null +++ b/Lang/LiveCode/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/File-size b/Lang/LiveCode/File-size new file mode 120000 index 0000000000..d8b153cca7 --- /dev/null +++ b/Lang/LiveCode/File-size @@ -0,0 +1 @@ +../../Task/File-size/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Find-the-last-Sunday-of-each-month b/Lang/LiveCode/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..22c90f6947 --- /dev/null +++ b/Lang/LiveCode/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/FizzBuzz b/Lang/LiveCode/FizzBuzz new file mode 120000 index 0000000000..4f4b10933d --- /dev/null +++ b/Lang/LiveCode/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Function-definition b/Lang/LiveCode/Function-definition new file mode 120000 index 0000000000..eab58050a2 --- /dev/null +++ b/Lang/LiveCode/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Function-frequency b/Lang/LiveCode/Function-frequency new file mode 120000 index 0000000000..0a2c5bdee8 --- /dev/null +++ b/Lang/LiveCode/Function-frequency @@ -0,0 +1 @@ +../../Task/Function-frequency/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/GUI-enabling-disabling-of-controls b/Lang/LiveCode/GUI-enabling-disabling-of-controls new file mode 120000 index 0000000000..e04936e69a --- /dev/null +++ b/Lang/LiveCode/GUI-enabling-disabling-of-controls @@ -0,0 +1 @@ +../../Task/GUI-enabling-disabling-of-controls/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Generic-swap b/Lang/LiveCode/Generic-swap new file mode 120000 index 0000000000..c5f98feadc --- /dev/null +++ b/Lang/LiveCode/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Greatest-common-divisor b/Lang/LiveCode/Greatest-common-divisor new file mode 120000 index 0000000000..b72575db01 --- /dev/null +++ b/Lang/LiveCode/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Greatest-element-of-a-list b/Lang/LiveCode/Greatest-element-of-a-list new file mode 120000 index 0000000000..b876ed47cf --- /dev/null +++ b/Lang/LiveCode/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Guess-the-number b/Lang/LiveCode/Guess-the-number new file mode 120000 index 0000000000..92c649d360 --- /dev/null +++ b/Lang/LiveCode/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Guess-the-number-With-feedback b/Lang/LiveCode/Guess-the-number-With-feedback new file mode 120000 index 0000000000..7b613b15c3 --- /dev/null +++ b/Lang/LiveCode/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/HTTP b/Lang/LiveCode/HTTP new file mode 120000 index 0000000000..41d46ff126 --- /dev/null +++ b/Lang/LiveCode/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/HTTPS b/Lang/LiveCode/HTTPS new file mode 120000 index 0000000000..b90dc61157 --- /dev/null +++ b/Lang/LiveCode/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/HTTPS-Authenticated b/Lang/LiveCode/HTTPS-Authenticated new file mode 120000 index 0000000000..6590ab66a6 --- /dev/null +++ b/Lang/LiveCode/HTTPS-Authenticated @@ -0,0 +1 @@ +../../Task/HTTPS-Authenticated/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Hash-from-two-arrays b/Lang/LiveCode/Hash-from-two-arrays new file mode 120000 index 0000000000..be18212c46 --- /dev/null +++ b/Lang/LiveCode/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Haversine-formula b/Lang/LiveCode/Haversine-formula new file mode 120000 index 0000000000..c0c6de32c7 --- /dev/null +++ b/Lang/LiveCode/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Hello-world-Graphical b/Lang/LiveCode/Hello-world-Graphical new file mode 120000 index 0000000000..cbbab18ac6 --- /dev/null +++ b/Lang/LiveCode/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Hello-world-Text b/Lang/LiveCode/Hello-world-Text new file mode 120000 index 0000000000..7a305a9a8d --- /dev/null +++ b/Lang/LiveCode/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Horizontal-sundial-calculations b/Lang/LiveCode/Horizontal-sundial-calculations new file mode 120000 index 0000000000..1eaefc4e44 --- /dev/null +++ b/Lang/LiveCode/Horizontal-sundial-calculations @@ -0,0 +1 @@ +../../Task/Horizontal-sundial-calculations/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Hostname b/Lang/LiveCode/Hostname new file mode 120000 index 0000000000..4b18376c71 --- /dev/null +++ b/Lang/LiveCode/Hostname @@ -0,0 +1 @@ +../../Task/Hostname/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Increment-a-numerical-string b/Lang/LiveCode/Increment-a-numerical-string new file mode 120000 index 0000000000..d8eb3473c9 --- /dev/null +++ b/Lang/LiveCode/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Integer-comparison b/Lang/LiveCode/Integer-comparison new file mode 120000 index 0000000000..493ef9f61c --- /dev/null +++ b/Lang/LiveCode/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Keyboard-input-Keypress-check b/Lang/LiveCode/Keyboard-input-Keypress-check new file mode 120000 index 0000000000..3e89b64e27 --- /dev/null +++ b/Lang/LiveCode/Keyboard-input-Keypress-check @@ -0,0 +1 @@ +../../Task/Keyboard-input-Keypress-check/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/LiveCode/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..43b98e6f05 --- /dev/null +++ b/Lang/LiveCode/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Last-Friday-of-each-month b/Lang/LiveCode/Last-Friday-of-each-month new file mode 120000 index 0000000000..cdb3f8dee7 --- /dev/null +++ b/Lang/LiveCode/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Leap-year b/Lang/LiveCode/Leap-year new file mode 120000 index 0000000000..f53973e9d6 --- /dev/null +++ b/Lang/LiveCode/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Literals-Integer b/Lang/LiveCode/Literals-Integer new file mode 120000 index 0000000000..976b2b5e09 --- /dev/null +++ b/Lang/LiveCode/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Literals-String b/Lang/LiveCode/Literals-String new file mode 120000 index 0000000000..eb412b0227 --- /dev/null +++ b/Lang/LiveCode/Literals-String @@ -0,0 +1 @@ +../../Task/Literals-String/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Logical-operations b/Lang/LiveCode/Logical-operations new file mode 120000 index 0000000000..cb53160252 --- /dev/null +++ b/Lang/LiveCode/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Look-and-say-sequence b/Lang/LiveCode/Look-and-say-sequence new file mode 120000 index 0000000000..16c02ba646 --- /dev/null +++ b/Lang/LiveCode/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Loop-over-multiple-arrays-simultaneously b/Lang/LiveCode/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..97f9a6d5cd --- /dev/null +++ b/Lang/LiveCode/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Loops-Break b/Lang/LiveCode/Loops-Break new file mode 120000 index 0000000000..98fc2d9810 --- /dev/null +++ b/Lang/LiveCode/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Loops-Continue b/Lang/LiveCode/Loops-Continue new file mode 120000 index 0000000000..a660beb8f3 --- /dev/null +++ b/Lang/LiveCode/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Loops-Do-while b/Lang/LiveCode/Loops-Do-while new file mode 120000 index 0000000000..0611d6e9cb --- /dev/null +++ b/Lang/LiveCode/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Loops-Downward-for b/Lang/LiveCode/Loops-Downward-for new file mode 120000 index 0000000000..87f499bdd4 --- /dev/null +++ b/Lang/LiveCode/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Loops-For b/Lang/LiveCode/Loops-For new file mode 120000 index 0000000000..0f86da507c --- /dev/null +++ b/Lang/LiveCode/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Loops-For-with-a-specified-step b/Lang/LiveCode/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..10fcb4361c --- /dev/null +++ b/Lang/LiveCode/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Loops-Foreach b/Lang/LiveCode/Loops-Foreach new file mode 120000 index 0000000000..548f103442 --- /dev/null +++ b/Lang/LiveCode/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Loops-Infinite b/Lang/LiveCode/Loops-Infinite new file mode 120000 index 0000000000..77f513e8aa --- /dev/null +++ b/Lang/LiveCode/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Loops-N-plus-one-half b/Lang/LiveCode/Loops-N-plus-one-half new file mode 120000 index 0000000000..dbc3ebbdec --- /dev/null +++ b/Lang/LiveCode/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Loops-Nested b/Lang/LiveCode/Loops-Nested new file mode 120000 index 0000000000..9d3ec9ca01 --- /dev/null +++ b/Lang/LiveCode/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Loops-While b/Lang/LiveCode/Loops-While new file mode 120000 index 0000000000..5db2fe1f11 --- /dev/null +++ b/Lang/LiveCode/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Luhn-test-of-credit-card-numbers b/Lang/LiveCode/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..a2b2b45965 --- /dev/null +++ b/Lang/LiveCode/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/MD5 b/Lang/LiveCode/MD5 new file mode 120000 index 0000000000..7f58c8fadd --- /dev/null +++ b/Lang/LiveCode/MD5 @@ -0,0 +1 @@ +../../Task/MD5/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Palindrome-detection b/Lang/LiveCode/Palindrome-detection new file mode 120000 index 0000000000..3bcdb98957 --- /dev/null +++ b/Lang/LiveCode/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Pick-random-element b/Lang/LiveCode/Pick-random-element new file mode 120000 index 0000000000..ec973dd194 --- /dev/null +++ b/Lang/LiveCode/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/README b/Lang/LiveCode/README new file mode 100644 index 0000000000..2970e2d359 --- /dev/null +++ b/Lang/LiveCode/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:LiveCode diff --git a/Lang/LiveCode/Range-expansion b/Lang/LiveCode/Range-expansion new file mode 120000 index 0000000000..86eec91b11 --- /dev/null +++ b/Lang/LiveCode/Range-expansion @@ -0,0 +1 @@ +../../Task/Range-expansion/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Range-extraction b/Lang/LiveCode/Range-extraction new file mode 120000 index 0000000000..946e482cc9 --- /dev/null +++ b/Lang/LiveCode/Range-extraction @@ -0,0 +1 @@ +../../Task/Range-extraction/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Read-a-file-line-by-line b/Lang/LiveCode/Read-a-file-line-by-line new file mode 120000 index 0000000000..e7c40b2b23 --- /dev/null +++ b/Lang/LiveCode/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Read-entire-file b/Lang/LiveCode/Read-entire-file new file mode 120000 index 0000000000..36ce1514cb --- /dev/null +++ b/Lang/LiveCode/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Real-constants-and-functions b/Lang/LiveCode/Real-constants-and-functions new file mode 120000 index 0000000000..787c64771b --- /dev/null +++ b/Lang/LiveCode/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Record-sound b/Lang/LiveCode/Record-sound new file mode 120000 index 0000000000..f9d90e8716 --- /dev/null +++ b/Lang/LiveCode/Record-sound @@ -0,0 +1 @@ +../../Task/Record-sound/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Rename-a-file b/Lang/LiveCode/Rename-a-file new file mode 120000 index 0000000000..12a8d9cb19 --- /dev/null +++ b/Lang/LiveCode/Rename-a-file @@ -0,0 +1 @@ +../../Task/Rename-a-file/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Repeat-a-string b/Lang/LiveCode/Repeat-a-string new file mode 120000 index 0000000000..f92c795330 --- /dev/null +++ b/Lang/LiveCode/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Reverse-a-string b/Lang/LiveCode/Reverse-a-string new file mode 120000 index 0000000000..b64175625c --- /dev/null +++ b/Lang/LiveCode/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Reverse-words-in-a-string b/Lang/LiveCode/Reverse-words-in-a-string new file mode 120000 index 0000000000..86d39e5e61 --- /dev/null +++ b/Lang/LiveCode/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Roman-numerals-Encode b/Lang/LiveCode/Roman-numerals-Encode new file mode 120000 index 0000000000..bc66102a7c --- /dev/null +++ b/Lang/LiveCode/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Rot-13 b/Lang/LiveCode/Rot-13 new file mode 120000 index 0000000000..ff0707347c --- /dev/null +++ b/Lang/LiveCode/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Run-length-encoding b/Lang/LiveCode/Run-length-encoding new file mode 120000 index 0000000000..0096ee1eaa --- /dev/null +++ b/Lang/LiveCode/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/SHA-1 b/Lang/LiveCode/SHA-1 new file mode 120000 index 0000000000..01f78c0f8f --- /dev/null +++ b/Lang/LiveCode/SHA-1 @@ -0,0 +1 @@ +../../Task/SHA-1/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Self-describing-numbers b/Lang/LiveCode/Self-describing-numbers new file mode 120000 index 0000000000..d1d6ff11db --- /dev/null +++ b/Lang/LiveCode/Self-describing-numbers @@ -0,0 +1 @@ +../../Task/Self-describing-numbers/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Send-email b/Lang/LiveCode/Send-email new file mode 120000 index 0000000000..8e86e5db1e --- /dev/null +++ b/Lang/LiveCode/Send-email @@ -0,0 +1 @@ +../../Task/Send-email/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Short-circuit-evaluation b/Lang/LiveCode/Short-circuit-evaluation new file mode 120000 index 0000000000..4705bbf139 --- /dev/null +++ b/Lang/LiveCode/Short-circuit-evaluation @@ -0,0 +1 @@ +../../Task/Short-circuit-evaluation/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Show-the-epoch b/Lang/LiveCode/Show-the-epoch new file mode 120000 index 0000000000..d2b5a6116f --- /dev/null +++ b/Lang/LiveCode/Show-the-epoch @@ -0,0 +1 @@ +../../Task/Show-the-epoch/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Sieve-of-Eratosthenes b/Lang/LiveCode/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..98b17f5ae5 --- /dev/null +++ b/Lang/LiveCode/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Sort-an-integer-array b/Lang/LiveCode/Sort-an-integer-array new file mode 120000 index 0000000000..6e28bd8e07 --- /dev/null +++ b/Lang/LiveCode/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Sparkline-in-unicode b/Lang/LiveCode/Sparkline-in-unicode new file mode 120000 index 0000000000..699fcdf7dd --- /dev/null +++ b/Lang/LiveCode/Sparkline-in-unicode @@ -0,0 +1 @@ +../../Task/Sparkline-in-unicode/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Special-variables b/Lang/LiveCode/Special-variables new file mode 120000 index 0000000000..3a7756fc64 --- /dev/null +++ b/Lang/LiveCode/Special-variables @@ -0,0 +1 @@ +../../Task/Special-variables/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/State-name-puzzle b/Lang/LiveCode/State-name-puzzle new file mode 120000 index 0000000000..277235684c --- /dev/null +++ b/Lang/LiveCode/State-name-puzzle @@ -0,0 +1 @@ +../../Task/State-name-puzzle/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/String-append b/Lang/LiveCode/String-append new file mode 120000 index 0000000000..8a56193904 --- /dev/null +++ b/Lang/LiveCode/String-append @@ -0,0 +1 @@ +../../Task/String-append/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/String-case b/Lang/LiveCode/String-case new file mode 120000 index 0000000000..648feea40e --- /dev/null +++ b/Lang/LiveCode/String-case @@ -0,0 +1 @@ +../../Task/String-case/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/String-concatenation b/Lang/LiveCode/String-concatenation new file mode 120000 index 0000000000..3c02bcfdb8 --- /dev/null +++ b/Lang/LiveCode/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/String-interpolation--included- b/Lang/LiveCode/String-interpolation--included- new file mode 120000 index 0000000000..9363ab72f9 --- /dev/null +++ b/Lang/LiveCode/String-interpolation--included- @@ -0,0 +1 @@ +../../Task/String-interpolation--included-/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/String-prepend b/Lang/LiveCode/String-prepend new file mode 120000 index 0000000000..faa77d6491 --- /dev/null +++ b/Lang/LiveCode/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Strip-a-set-of-characters-from-a-string b/Lang/LiveCode/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..546182199c --- /dev/null +++ b/Lang/LiveCode/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Substring b/Lang/LiveCode/Substring new file mode 120000 index 0000000000..6518af2502 --- /dev/null +++ b/Lang/LiveCode/Substring @@ -0,0 +1 @@ +../../Task/Substring/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Substring-Top-and-tail b/Lang/LiveCode/Substring-Top-and-tail new file mode 120000 index 0000000000..29c68ecdb9 --- /dev/null +++ b/Lang/LiveCode/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Sum-and-product-of-an-array b/Lang/LiveCode/Sum-and-product-of-an-array new file mode 120000 index 0000000000..2559ce7bb4 --- /dev/null +++ b/Lang/LiveCode/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Sum-digits-of-an-integer b/Lang/LiveCode/Sum-digits-of-an-integer new file mode 120000 index 0000000000..cb77f585cf --- /dev/null +++ b/Lang/LiveCode/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Sum-multiples-of-3-and-5 b/Lang/LiveCode/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..a481e8f3ad --- /dev/null +++ b/Lang/LiveCode/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Sum-of-a-series b/Lang/LiveCode/Sum-of-a-series new file mode 120000 index 0000000000..c0e6b9b158 --- /dev/null +++ b/Lang/LiveCode/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Sum-of-squares b/Lang/LiveCode/Sum-of-squares new file mode 120000 index 0000000000..33be653527 --- /dev/null +++ b/Lang/LiveCode/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/System-time b/Lang/LiveCode/System-time new file mode 120000 index 0000000000..a7229c5563 --- /dev/null +++ b/Lang/LiveCode/System-time @@ -0,0 +1 @@ +../../Task/System-time/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Temperature-conversion b/Lang/LiveCode/Temperature-conversion new file mode 120000 index 0000000000..5af35859c8 --- /dev/null +++ b/Lang/LiveCode/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/URL-decoding b/Lang/LiveCode/URL-decoding new file mode 120000 index 0000000000..1341f0fdca --- /dev/null +++ b/Lang/LiveCode/URL-decoding @@ -0,0 +1 @@ +../../Task/URL-decoding/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/URL-encoding b/Lang/LiveCode/URL-encoding new file mode 120000 index 0000000000..31c83673c2 --- /dev/null +++ b/Lang/LiveCode/URL-encoding @@ -0,0 +1 @@ +../../Task/URL-encoding/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Unicode-variable-names b/Lang/LiveCode/Unicode-variable-names new file mode 120000 index 0000000000..e6448aec50 --- /dev/null +++ b/Lang/LiveCode/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Unix-ls b/Lang/LiveCode/Unix-ls new file mode 120000 index 0000000000..83304946a8 --- /dev/null +++ b/Lang/LiveCode/Unix-ls @@ -0,0 +1 @@ +../../Task/Unix-ls/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Variable-length-quantity b/Lang/LiveCode/Variable-length-quantity new file mode 120000 index 0000000000..ea7333afcb --- /dev/null +++ b/Lang/LiveCode/Variable-length-quantity @@ -0,0 +1 @@ +../../Task/Variable-length-quantity/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Walk-a-directory-Non-recursively b/Lang/LiveCode/Walk-a-directory-Non-recursively new file mode 120000 index 0000000000..351fa03d36 --- /dev/null +++ b/Lang/LiveCode/Walk-a-directory-Non-recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Non-recursively/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/Walk-a-directory-Recursively b/Lang/LiveCode/Walk-a-directory-Recursively new file mode 120000 index 0000000000..3eacc81cf8 --- /dev/null +++ b/Lang/LiveCode/Walk-a-directory-Recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Recursively/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/XML-Input b/Lang/LiveCode/XML-Input new file mode 120000 index 0000000000..497a5fac7d --- /dev/null +++ b/Lang/LiveCode/XML-Input @@ -0,0 +1 @@ +../../Task/XML-Input/LiveCode \ No newline at end of file diff --git a/Lang/LiveCode/XML-XPath b/Lang/LiveCode/XML-XPath new file mode 120000 index 0000000000..20f6141155 --- /dev/null +++ b/Lang/LiveCode/XML-XPath @@ -0,0 +1 @@ +../../Task/XML-XPath/LiveCode \ No newline at end of file diff --git a/Lang/LiveScript/00DESCRIPTION b/Lang/LiveScript/00DESCRIPTION new file mode 100644 index 0000000000..ab1cd11a63 --- /dev/null +++ b/Lang/LiveScript/00DESCRIPTION @@ -0,0 +1,3 @@ +{{stub}} +{{language +|site=http://livescript.net/}} \ No newline at end of file diff --git a/Lang/LiveScript/FizzBuzz b/Lang/LiveScript/FizzBuzz new file mode 120000 index 0000000000..fc591bf554 --- /dev/null +++ b/Lang/LiveScript/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/LiveScript \ No newline at end of file diff --git a/Lang/LiveScript/README b/Lang/LiveScript/README new file mode 100644 index 0000000000..f21f13a4a6 --- /dev/null +++ b/Lang/LiveScript/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:LiveScript diff --git a/Lang/LiveScript/Reverse-words-in-a-string b/Lang/LiveScript/Reverse-words-in-a-string new file mode 120000 index 0000000000..e5897917d6 --- /dev/null +++ b/Lang/LiveScript/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/LiveScript \ No newline at end of file diff --git a/Lang/LiveScript/Roman-numerals-Decode b/Lang/LiveScript/Roman-numerals-Decode new file mode 120000 index 0000000000..9002331eaa --- /dev/null +++ b/Lang/LiveScript/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/LiveScript \ No newline at end of file diff --git a/Lang/Lobster/00DESCRIPTION b/Lang/Lobster/00DESCRIPTION new file mode 100644 index 0000000000..4e7d54dc2d --- /dev/null +++ b/Lang/Lobster/00DESCRIPTION @@ -0,0 +1,5 @@ +{{language|Lobster +|site=http://strlen.com/lobster}} +'''Lobster''' is a general purpose programming language originally created for programming games. It has a [[Python]]-like syntax, with a static type system that feels like dynamic typing thanks to flow-sensitive type inference and specialization. It has lightweight anonymous functions, encouraging every function to look like a built-in control structure. Additionally it has vector operations, multi-methods, coroutines and immutable types. + +It is currently implemented as a bytecode VM that runs on all desktop and mobile platforms (through SDL), and comes with built-in functionality for easy access to OpenGL, FreeType etc. \ No newline at end of file diff --git a/Lang/Lobster/FizzBuzz b/Lang/Lobster/FizzBuzz new file mode 120000 index 0000000000..9d6736093c --- /dev/null +++ b/Lang/Lobster/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Lobster \ No newline at end of file diff --git a/Lang/Lobster/Hello-world-Graphical b/Lang/Lobster/Hello-world-Graphical new file mode 120000 index 0000000000..042c207a7c --- /dev/null +++ b/Lang/Lobster/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Lobster \ No newline at end of file diff --git a/Lang/Lobster/Hello-world-Text b/Lang/Lobster/Hello-world-Text new file mode 120000 index 0000000000..068782706a --- /dev/null +++ b/Lang/Lobster/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Lobster \ No newline at end of file diff --git a/Lang/Lobster/README b/Lang/Lobster/README new file mode 100644 index 0000000000..a6376beeaa --- /dev/null +++ b/Lang/Lobster/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Lobster diff --git a/Lang/Lobster/Sorting-algorithms-Quicksort b/Lang/Lobster/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..e47911af55 --- /dev/null +++ b/Lang/Lobster/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Lobster \ No newline at end of file diff --git a/Lang/Loglan82/00DESCRIPTION b/Lang/Loglan82/00DESCRIPTION new file mode 100644 index 0000000000..94fd464f80 --- /dev/null +++ b/Lang/Loglan82/00DESCRIPTION @@ -0,0 +1,22 @@ +{{language|Loglan82 +|exec=machine +|safety=both +|gc=yes +|hopl id=2180 +|site=http://lem12.uksw.edu.pl/wiki/Loglan'82_project}} + +'''Loglan'82''' is a programming language conceived for object and distributed programming. + +It has many features that make Loglan'82 a tool surpassing other programming languages: +* It enjoys a unique safe and efficient system of managing objects, see [[Safe deallocation]], +* It offers modules of classes ('''class'''), moreover it allows to declare modules of cooperating objects i.e. '''coroutines''' and modules of threads ('''process'''). One can create not only objects of classes, but also objects of coroutines with their ''fibres'' and objects of processes, aka agents with their ''threads''. +* Virtual machines of Loglan may connect (through internet) in a virtual, multiprocesorr computer.This allows to distribute a computation of a program between processors in a controlled way. +* Objects of processes (agents) can be alocated on different nodes of a network of virtual machines or on the same machine. It means that Loglan uses one model for concurrent as well as for distributed computations. (Less learning). +* Loglan'82 offers an original, fully object protocol of communication and synchronization, so called ''alien call'' of methods of an agent. +* Each object of a process, i.e. an agent may create its own system of coroutine objects and manage it, + +[https://sourceforge.net/projects/loglan82/ Loglan82 on Sourceforge] + +{{language programming paradigm|Imperative}} +{{language programming paradigm|Object-oriented}} +{{language programming paradigm|Generic}} \ No newline at end of file diff --git a/Lang/Loglan82/README b/Lang/Loglan82/README new file mode 100644 index 0000000000..be6892f82e --- /dev/null +++ b/Lang/Loglan82/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Loglan82 diff --git a/Lang/Luck/00DESCRIPTION b/Lang/Luck/00DESCRIPTION new file mode 100644 index 0000000000..3859c189b4 --- /dev/null +++ b/Lang/Luck/00DESCRIPTION @@ -0,0 +1,13 @@ +{{language +|exec=machine +|gc=yes +|safety=unsafe +|parampass=value +|checking=static +|compat=nominative +|express=explicit +|strength=weak +|tags=luck +|LCT=yes +}}{{language programming paradigm|Imperative}}{{Codepad}} +'''Luck''' is a general-purpose, [[functional programming|functional]], [[imperative programming|imperative]] computer programming language developed in 2013 by Andrew Johnson at [[Subarctic Limited|Subarctic Limited]] for use with the [[UNIX]] operating system. Luck was influenced by several languages, [[derived from::Standard ML]], [[derived from::C]]. \ No newline at end of file diff --git a/Lang/Luck/Ackermann-function b/Lang/Luck/Ackermann-function new file mode 120000 index 0000000000..c726637018 --- /dev/null +++ b/Lang/Luck/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Luck \ No newline at end of file diff --git a/Lang/Luck/Call-a-foreign-language-function b/Lang/Luck/Call-a-foreign-language-function new file mode 120000 index 0000000000..cf2b8039b4 --- /dev/null +++ b/Lang/Luck/Call-a-foreign-language-function @@ -0,0 +1 @@ +../../Task/Call-a-foreign-language-function/Luck \ No newline at end of file diff --git a/Lang/Luck/Call-a-function b/Lang/Luck/Call-a-function new file mode 120000 index 0000000000..5308d8aa63 --- /dev/null +++ b/Lang/Luck/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/Luck \ No newline at end of file diff --git a/Lang/Luck/Fibonacci-sequence b/Lang/Luck/Fibonacci-sequence new file mode 120000 index 0000000000..1fbe6cd944 --- /dev/null +++ b/Lang/Luck/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Luck \ No newline at end of file diff --git a/Lang/Luck/FizzBuzz b/Lang/Luck/FizzBuzz new file mode 120000 index 0000000000..b08659e416 --- /dev/null +++ b/Lang/Luck/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Luck \ No newline at end of file diff --git a/Lang/Luck/Function-prototype b/Lang/Luck/Function-prototype new file mode 120000 index 0000000000..de410c3cee --- /dev/null +++ b/Lang/Luck/Function-prototype @@ -0,0 +1 @@ +../../Task/Function-prototype/Luck \ No newline at end of file diff --git a/Lang/Luck/Greatest-common-divisor b/Lang/Luck/Greatest-common-divisor new file mode 120000 index 0000000000..4fc17eceb1 --- /dev/null +++ b/Lang/Luck/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Luck \ No newline at end of file diff --git a/Lang/Luck/Higher-order-functions b/Lang/Luck/Higher-order-functions new file mode 120000 index 0000000000..463b65401f --- /dev/null +++ b/Lang/Luck/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/Luck \ No newline at end of file diff --git a/Lang/Luck/README b/Lang/Luck/README new file mode 100644 index 0000000000..a9afba10e4 --- /dev/null +++ b/Lang/Luck/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Luck diff --git a/Lang/MINIL/00DESCRIPTION b/Lang/MINIL/00DESCRIPTION new file mode 100644 index 0000000000..468ca7f61c --- /dev/null +++ b/Lang/MINIL/00DESCRIPTION @@ -0,0 +1,3 @@ +{{stub}}{{language|MINIL +|site=http://www.technoblogy.com/show?NNJ}} +MINIL (MINiature Interpreted Language) is a simple machine-code language containing just eight mnemonics. It was designed to help beginners to learn about the concepts of instruction sets, machine code, and simple algorithms. \ No newline at end of file diff --git a/Lang/MINIL/Evaluate-binomial-coefficients b/Lang/MINIL/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..9349a6dc7f --- /dev/null +++ b/Lang/MINIL/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/MINIL \ No newline at end of file diff --git a/Lang/MINIL/Greatest-common-divisor b/Lang/MINIL/Greatest-common-divisor new file mode 120000 index 0000000000..c953f36426 --- /dev/null +++ b/Lang/MINIL/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/MINIL \ No newline at end of file diff --git a/Lang/MINIL/README b/Lang/MINIL/README new file mode 100644 index 0000000000..123d601087 --- /dev/null +++ b/Lang/MINIL/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:MINIL diff --git a/Lang/MLite/00DESCRIPTION b/Lang/MLite/00DESCRIPTION new file mode 100644 index 0000000000..a7390f7dc4 --- /dev/null +++ b/Lang/MLite/00DESCRIPTION @@ -0,0 +1,15 @@ +{{DISPLAYTITLE: Category:mLite}} +{{language|mLite +|hopl=no +|exec=interpreted +|strength=strong +|safety=safe +|checking=dynamic +|parampass=value +|gc=yes +|site=http://www.t3x.org/mlite/index.html}} +{{language programming paradigm|functional}} + +'''mLite''' is a is a general-purpose, functional, lightweight, dynamic programming language. It borrows ideas from both the Scheme [R4RS] and Standard ML [DEFSML] languages, taking most of its syntax from ML and its dynamic nature from Scheme. It extends ML-style pattern matching by adding guarded patterns and also introduces the principle of implicit guards. The implementation presented here is intended to be portable and easily realized on top of existing Scheme systems. + +mLite source files use the extension .m. \ No newline at end of file diff --git a/Lang/MLite/Harshad-or-Niven-series b/Lang/MLite/Harshad-or-Niven-series new file mode 120000 index 0000000000..6578fcba13 --- /dev/null +++ b/Lang/MLite/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/MLite \ No newline at end of file diff --git a/Lang/MLite/README b/Lang/MLite/README new file mode 100644 index 0000000000..5bee39264e --- /dev/null +++ b/Lang/MLite/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:MLite diff --git a/Lang/MSX-BASIC/00DESCRIPTION b/Lang/MSX-BASIC/00DESCRIPTION new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Lang/MSX-BASIC/README b/Lang/MSX-BASIC/README new file mode 100644 index 0000000000..f989612689 --- /dev/null +++ b/Lang/MSX-BASIC/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:MSX_BASIC diff --git a/Lang/Malbolge/00DESCRIPTION b/Lang/Malbolge/00DESCRIPTION new file mode 100644 index 0000000000..bfbce07037 --- /dev/null +++ b/Lang/Malbolge/00DESCRIPTION @@ -0,0 +1,5 @@ +{{stub}} +{{language +|exec=interpreted}} + +'''Malbolge''' is an esoteric programming language invented by Ben Olmstead in 1998 and named after the eighth circle of hell in Dante's Inferno, named Malebolge. \ No newline at end of file diff --git a/Lang/Malbolge/99-Bottles-of-Beer b/Lang/Malbolge/99-Bottles-of-Beer new file mode 120000 index 0000000000..a4cc99ad55 --- /dev/null +++ b/Lang/Malbolge/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Malbolge \ No newline at end of file diff --git a/Lang/Malbolge/Hello-world-Text b/Lang/Malbolge/Hello-world-Text new file mode 120000 index 0000000000..ccaff00db9 --- /dev/null +++ b/Lang/Malbolge/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Malbolge \ No newline at end of file diff --git a/Lang/Malbolge/README b/Lang/Malbolge/README new file mode 100644 index 0000000000..19bf46cb2e --- /dev/null +++ b/Lang/Malbolge/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Malbolge diff --git a/Lang/Maude/00DESCRIPTION b/Lang/Maude/00DESCRIPTION new file mode 100644 index 0000000000..92d50f77b4 --- /dev/null +++ b/Lang/Maude/00DESCRIPTION @@ -0,0 +1,3 @@ +{{stub}} +{{language +|site=http://maude.cs.uiuc.edu/}} \ No newline at end of file diff --git a/Lang/Maude/A+B b/Lang/Maude/A+B new file mode 120000 index 0000000000..4e654d5788 --- /dev/null +++ b/Lang/Maude/A+B @@ -0,0 +1 @@ +../../Task/A+B/Maude \ No newline at end of file diff --git a/Lang/Maude/Factorial b/Lang/Maude/Factorial new file mode 120000 index 0000000000..a2bc3e5958 --- /dev/null +++ b/Lang/Maude/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Maude \ No newline at end of file diff --git a/Lang/Maude/Hello-world-Text b/Lang/Maude/Hello-world-Text new file mode 120000 index 0000000000..83eb152447 --- /dev/null +++ b/Lang/Maude/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Maude \ No newline at end of file diff --git a/Lang/Maude/README b/Lang/Maude/README new file mode 100644 index 0000000000..9cab92a3b2 --- /dev/null +++ b/Lang/Maude/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Maude diff --git a/Lang/Mond/00DESCRIPTION b/Lang/Mond/00DESCRIPTION new file mode 100644 index 0000000000..4d3d27c049 --- /dev/null +++ b/Lang/Mond/00DESCRIPTION @@ -0,0 +1 @@ +{{stub}}{{language}} \ No newline at end of file diff --git a/Lang/Mond/README b/Lang/Mond/README new file mode 100644 index 0000000000..b295145363 --- /dev/null +++ b/Lang/Mond/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Mond diff --git a/Lang/Mond/Sorting-algorithms-Quicksort b/Lang/Mond/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..8b820eae1c --- /dev/null +++ b/Lang/Mond/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Mond \ No newline at end of file diff --git a/Lang/Monicelli/00DESCRIPTION b/Lang/Monicelli/00DESCRIPTION new file mode 100644 index 0000000000..702a10c84c --- /dev/null +++ b/Lang/Monicelli/00DESCRIPTION @@ -0,0 +1,6 @@ +{{language|Monicelli +|site=https://github.com/esseks/monicelli +}} + +Monicelli is an esoterical programming language based on the so-called "supercazzole" from the movie [http://www.imdb.com/title/tt0072637/ Amici Miei], a classic Italian comedy. +The [https://github.com/esseks/monicelli Monicelli project page] offers a compiler and a description of the language. \ No newline at end of file diff --git a/Lang/Monicelli/Conditional-structures b/Lang/Monicelli/Conditional-structures new file mode 120000 index 0000000000..d8bc893b64 --- /dev/null +++ b/Lang/Monicelli/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Monicelli \ No newline at end of file diff --git a/Lang/Monicelli/Fibonacci-sequence b/Lang/Monicelli/Fibonacci-sequence new file mode 120000 index 0000000000..821046c460 --- /dev/null +++ b/Lang/Monicelli/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Monicelli \ No newline at end of file diff --git a/Lang/Monicelli/Loops-Do-while b/Lang/Monicelli/Loops-Do-while new file mode 120000 index 0000000000..298667f533 --- /dev/null +++ b/Lang/Monicelli/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Monicelli \ No newline at end of file diff --git a/Lang/Monicelli/README b/Lang/Monicelli/README new file mode 100644 index 0000000000..0d522baa5d --- /dev/null +++ b/Lang/Monicelli/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Monicelli diff --git a/Lang/Monte/00DESCRIPTION b/Lang/Monte/00DESCRIPTION new file mode 100644 index 0000000000..0897cee57e --- /dev/null +++ b/Lang/Monte/00DESCRIPTION @@ -0,0 +1,5 @@ +{{stub}}{{language}} + +Monte is a dynamic language inspired by Python and E, and is currently under active development. + +Monte's documentation is available on readthedocs at [http://monte.readthedocs.org/en/latest/]. \ No newline at end of file diff --git a/Lang/Monte/Arrays b/Lang/Monte/Arrays new file mode 120000 index 0000000000..2533126ff1 --- /dev/null +++ b/Lang/Monte/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Monte \ No newline at end of file diff --git a/Lang/Monte/Boolean-values b/Lang/Monte/Boolean-values new file mode 120000 index 0000000000..df93216aa1 --- /dev/null +++ b/Lang/Monte/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/Monte \ No newline at end of file diff --git a/Lang/Monte/Comments b/Lang/Monte/Comments new file mode 120000 index 0000000000..aca94a0ad0 --- /dev/null +++ b/Lang/Monte/Comments @@ -0,0 +1 @@ +../../Task/Comments/Monte \ No newline at end of file diff --git a/Lang/Monte/FizzBuzz b/Lang/Monte/FizzBuzz new file mode 120000 index 0000000000..0b8e55c6f0 --- /dev/null +++ b/Lang/Monte/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Monte \ No newline at end of file diff --git a/Lang/Monte/Hello-world-Newbie b/Lang/Monte/Hello-world-Newbie new file mode 120000 index 0000000000..358c4e3744 --- /dev/null +++ b/Lang/Monte/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/Monte \ No newline at end of file diff --git a/Lang/Monte/Loops-Infinite b/Lang/Monte/Loops-Infinite new file mode 120000 index 0000000000..1933a5a022 --- /dev/null +++ b/Lang/Monte/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Monte \ No newline at end of file diff --git a/Lang/Monte/Loops-While b/Lang/Monte/Loops-While new file mode 120000 index 0000000000..8c64993fba --- /dev/null +++ b/Lang/Monte/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Monte \ No newline at end of file diff --git a/Lang/Monte/README b/Lang/Monte/README new file mode 100644 index 0000000000..5f419388c6 --- /dev/null +++ b/Lang/Monte/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Monte diff --git a/Lang/Monte/Repeat-a-string b/Lang/Monte/Repeat-a-string new file mode 120000 index 0000000000..5dde8cb520 --- /dev/null +++ b/Lang/Monte/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Monte \ No newline at end of file diff --git a/Lang/Monte/Towers-of-Hanoi b/Lang/Monte/Towers-of-Hanoi new file mode 120000 index 0000000000..e3aeeb00c0 --- /dev/null +++ b/Lang/Monte/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Monte \ No newline at end of file diff --git a/Lang/MoonScript/00DESCRIPTION b/Lang/MoonScript/00DESCRIPTION new file mode 100644 index 0000000000..812622c928 --- /dev/null +++ b/Lang/MoonScript/00DESCRIPTION @@ -0,0 +1,12 @@ +{{stub}} +{{language +|site=http://moonscript.org/}} +MoonScript is a dynamic scripting language that compiles into Lua. It gives you the power of one of the fastest scripting languages combined with a rich set of features. + +MoonScript can either be compiled into [[Lua]] and run at a later time, or it can be dynamically compiled and run using the moonloader. It’s as simple as require "moonscript" in order to have Lua understand how to load and run any MoonScript file. + +Because it compiles right into Lua code, it is completely compatible with alternative Lua implementations like LuaJIT, and it is also compatible with all existing Lua code and libraries. + +The command line tools also let you run MoonScript directly from the command line, like any first-class scripting language. + +A comprehensive overview of the language can be found in the [http://moonscript.org/reference/ reference manual], the rest of this page serves as an overview of the language. \ No newline at end of file diff --git a/Lang/MoonScript/100-doors b/Lang/MoonScript/100-doors new file mode 120000 index 0000000000..266ea7137c --- /dev/null +++ b/Lang/MoonScript/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/MoonScript \ No newline at end of file diff --git a/Lang/MoonScript/99-Bottles-of-Beer b/Lang/MoonScript/99-Bottles-of-Beer new file mode 120000 index 0000000000..b8283f1a73 --- /dev/null +++ b/Lang/MoonScript/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/MoonScript \ No newline at end of file diff --git a/Lang/MoonScript/A+B b/Lang/MoonScript/A+B new file mode 120000 index 0000000000..f850701bf6 --- /dev/null +++ b/Lang/MoonScript/A+B @@ -0,0 +1 @@ +../../Task/A+B/MoonScript \ No newline at end of file diff --git a/Lang/MoonScript/FizzBuzz b/Lang/MoonScript/FizzBuzz new file mode 120000 index 0000000000..239e96a0c5 --- /dev/null +++ b/Lang/MoonScript/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/MoonScript \ No newline at end of file diff --git a/Lang/MoonScript/README b/Lang/MoonScript/README new file mode 100644 index 0000000000..a624a64d0c --- /dev/null +++ b/Lang/MoonScript/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:MoonScript diff --git a/Lang/MoonScript/Read-a-specific-line-from-a-file b/Lang/MoonScript/Read-a-specific-line-from-a-file new file mode 120000 index 0000000000..44fa7f1158 --- /dev/null +++ b/Lang/MoonScript/Read-a-specific-line-from-a-file @@ -0,0 +1 @@ +../../Task/Read-a-specific-line-from-a-file/MoonScript \ No newline at end of file diff --git a/Lang/Morfa/00DESCRIPTION b/Lang/Morfa/00DESCRIPTION new file mode 100644 index 0000000000..35fbdcf257 --- /dev/null +++ b/Lang/Morfa/00DESCRIPTION @@ -0,0 +1,25 @@ +{{language|Morfa +|exec=machine +|strength=strong +|gc=yes +|safety=both +|express=both +|compat=nominal +|checking=both +|parampass=both +|site=http://morfalang.org/ +|hopl=no +|LCT=no}} +{{language programming paradigm|Imperative}} +{{language programming paradigm|procedural}} +{{language programming paradigm|object-oriented}} +{{language programming paradigm|Functional}} +{{language programming paradigm|generic}} +'''Morfa''' is a general purpose programming language which enables custom Domain Specific Language (DSL) creation. It aims at combining fast and robust development of large systems with high expressiveness and performance. + +* statically typed with type inference for variables +* JIT compiled +* user-defined operators +* [[object-oriented]], [[functional programming|functional ]] and [[generic programming|generic]] + +Morfa has been inspired by '''[[D]]''' and shares some of its features. \ No newline at end of file diff --git a/Lang/Morfa/Add-a-variable-to-a-class-instance-at-runtime b/Lang/Morfa/Add-a-variable-to-a-class-instance-at-runtime new file mode 120000 index 0000000000..99ccbeddf6 --- /dev/null +++ b/Lang/Morfa/Add-a-variable-to-a-class-instance-at-runtime @@ -0,0 +1 @@ +../../Task/Add-a-variable-to-a-class-instance-at-runtime/Morfa \ No newline at end of file diff --git a/Lang/Morfa/Averages-Root-mean-square b/Lang/Morfa/Averages-Root-mean-square new file mode 120000 index 0000000000..8110de4cd8 --- /dev/null +++ b/Lang/Morfa/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/Morfa \ No newline at end of file diff --git a/Lang/Morfa/Conditional-structures b/Lang/Morfa/Conditional-structures new file mode 120000 index 0000000000..e4b7b32c3e --- /dev/null +++ b/Lang/Morfa/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Morfa \ No newline at end of file diff --git a/Lang/Morfa/Constrained-genericity b/Lang/Morfa/Constrained-genericity new file mode 120000 index 0000000000..f9f4654978 --- /dev/null +++ b/Lang/Morfa/Constrained-genericity @@ -0,0 +1 @@ +../../Task/Constrained-genericity/Morfa \ No newline at end of file diff --git a/Lang/Morfa/Extend-your-language b/Lang/Morfa/Extend-your-language new file mode 120000 index 0000000000..9402461a9a --- /dev/null +++ b/Lang/Morfa/Extend-your-language @@ -0,0 +1 @@ +../../Task/Extend-your-language/Morfa \ No newline at end of file diff --git a/Lang/Morfa/Hello-world-Text b/Lang/Morfa/Hello-world-Text new file mode 120000 index 0000000000..02823c6c54 --- /dev/null +++ b/Lang/Morfa/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Morfa \ No newline at end of file diff --git a/Lang/Morfa/Higher-order-functions b/Lang/Morfa/Higher-order-functions new file mode 120000 index 0000000000..56b01ea83a --- /dev/null +++ b/Lang/Morfa/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/Morfa \ No newline at end of file diff --git a/Lang/Morfa/Loops-For b/Lang/Morfa/Loops-For new file mode 120000 index 0000000000..cbc6e8933e --- /dev/null +++ b/Lang/Morfa/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Morfa \ No newline at end of file diff --git a/Lang/Morfa/Loops-While b/Lang/Morfa/Loops-While new file mode 120000 index 0000000000..64868600d4 --- /dev/null +++ b/Lang/Morfa/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Morfa \ No newline at end of file diff --git a/Lang/Morfa/README b/Lang/Morfa/README new file mode 100644 index 0000000000..8ed12637bd --- /dev/null +++ b/Lang/Morfa/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Morfa diff --git a/Lang/MyrtleScript/00DESCRIPTION b/Lang/MyrtleScript/00DESCRIPTION new file mode 100644 index 0000000000..b8f37c0361 --- /dev/null +++ b/Lang/MyrtleScript/00DESCRIPTION @@ -0,0 +1,14 @@ +{{stub}}{{language|MyrtleScript}} + +MyrtleScript is a language developed by Finn Thomas in 2015. +The language is interpreted and statically typed. + +== Syntax == +Program structure: + +script ExampleProgram { + public func main returns: int { + // Do stuff + } +} + \ No newline at end of file diff --git a/Lang/MyrtleScript/Factorial b/Lang/MyrtleScript/Factorial new file mode 120000 index 0000000000..c62ad13171 --- /dev/null +++ b/Lang/MyrtleScript/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/MyrtleScript \ No newline at end of file diff --git a/Lang/MyrtleScript/Hello-world-Text b/Lang/MyrtleScript/Hello-world-Text new file mode 120000 index 0000000000..322dcfee37 --- /dev/null +++ b/Lang/MyrtleScript/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/MyrtleScript \ No newline at end of file diff --git a/Lang/MyrtleScript/README b/Lang/MyrtleScript/README new file mode 100644 index 0000000000..200587e7e5 --- /dev/null +++ b/Lang/MyrtleScript/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:MyrtleScript diff --git a/Lang/NESL/00DESCRIPTION b/Lang/NESL/00DESCRIPTION new file mode 100644 index 0000000000..4b0f5bd00f --- /dev/null +++ b/Lang/NESL/00DESCRIPTION @@ -0,0 +1,4 @@ +{{stub}}{{language|NESL}} +NESL is a functional language with an ML-like syntax, type inference, and support for parallel programming based on the idea of nested data parallelism. It has been used to teach parallel algorithms. + +For more information see the [https://www.cs.cmu.edu/~scandal/nesl.html NESL language page]. You can also try evaluating some NESL expressions online, using the [http://www.cs.cmu.edu/~scandal/nesl/nesl_form.html Interactive NESL Interface]. \ No newline at end of file diff --git a/Lang/NESL/Case-sensitivity-of-identifiers b/Lang/NESL/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..f8bcb71cdb --- /dev/null +++ b/Lang/NESL/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/NESL \ No newline at end of file diff --git a/Lang/NESL/Character-codes b/Lang/NESL/Character-codes new file mode 120000 index 0000000000..168b01fc65 --- /dev/null +++ b/Lang/NESL/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/NESL \ No newline at end of file diff --git a/Lang/NESL/Comments b/Lang/NESL/Comments new file mode 120000 index 0000000000..cc89c1bf2d --- /dev/null +++ b/Lang/NESL/Comments @@ -0,0 +1 @@ +../../Task/Comments/NESL \ No newline at end of file diff --git a/Lang/NESL/Empty-string b/Lang/NESL/Empty-string new file mode 120000 index 0000000000..5aa501d518 --- /dev/null +++ b/Lang/NESL/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/NESL \ No newline at end of file diff --git a/Lang/NESL/Even-or-odd b/Lang/NESL/Even-or-odd new file mode 120000 index 0000000000..f283728f30 --- /dev/null +++ b/Lang/NESL/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/NESL \ No newline at end of file diff --git a/Lang/NESL/Fibonacci-sequence b/Lang/NESL/Fibonacci-sequence new file mode 120000 index 0000000000..92c9915051 --- /dev/null +++ b/Lang/NESL/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/NESL \ No newline at end of file diff --git a/Lang/NESL/Function-definition b/Lang/NESL/Function-definition new file mode 120000 index 0000000000..f8e51dd0c4 --- /dev/null +++ b/Lang/NESL/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/NESL \ No newline at end of file diff --git a/Lang/NESL/Generate-lower-case-ASCII-alphabet b/Lang/NESL/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..8f4c539660 --- /dev/null +++ b/Lang/NESL/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/NESL \ No newline at end of file diff --git a/Lang/NESL/README b/Lang/NESL/README new file mode 100644 index 0000000000..d4c512caab --- /dev/null +++ b/Lang/NESL/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:NESL diff --git a/Lang/NGS/00DESCRIPTION b/Lang/NGS/00DESCRIPTION new file mode 100644 index 0000000000..847efea2dd --- /dev/null +++ b/Lang/NGS/00DESCRIPTION @@ -0,0 +1,11 @@ +{{language +|exec=interpreted +|gc=yes +|tags=NGS +|site=https://github.com/ilyash/ngs/}} +{{language programming paradigm|Dynamic}} +{{language programming paradigm|Functional}} + +NGS tries to fill the void between classical shells such as bash and general-purpose programming languages such as Ruby, Python, Perl, Go. The shells are domain-specific languages but the domain has changed so classical shells are not optimal for today's tasks. General-purpose languages on the other hand are not domain-specific so they are not good as shells and too verbose for system tasks scripting, making them also not a good fit. + +The language is now under development. Somewhat functional scripts can already be written, see https://github.com/ilyash/ngs/tree/master/c/demo \ No newline at end of file diff --git a/Lang/NGS/Accumulator-factory b/Lang/NGS/Accumulator-factory new file mode 120000 index 0000000000..6d6de9a25a --- /dev/null +++ b/Lang/NGS/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/NGS \ No newline at end of file diff --git a/Lang/NGS/Apply-a-callback-to-an-array b/Lang/NGS/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..0c108512e8 --- /dev/null +++ b/Lang/NGS/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/NGS \ No newline at end of file diff --git a/Lang/NGS/Delegates b/Lang/NGS/Delegates new file mode 120000 index 0000000000..d9534b3d80 --- /dev/null +++ b/Lang/NGS/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/NGS \ No newline at end of file diff --git a/Lang/NGS/Fibonacci-sequence b/Lang/NGS/Fibonacci-sequence new file mode 120000 index 0000000000..7ba1b2ccf0 --- /dev/null +++ b/Lang/NGS/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/NGS \ No newline at end of file diff --git a/Lang/NGS/Flatten-a-list b/Lang/NGS/Flatten-a-list new file mode 120000 index 0000000000..378048101d --- /dev/null +++ b/Lang/NGS/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/NGS \ No newline at end of file diff --git a/Lang/NGS/Multiple-distinct-objects b/Lang/NGS/Multiple-distinct-objects new file mode 120000 index 0000000000..2c05f7e0b4 --- /dev/null +++ b/Lang/NGS/Multiple-distinct-objects @@ -0,0 +1 @@ +../../Task/Multiple-distinct-objects/NGS \ No newline at end of file diff --git a/Lang/NGS/README b/Lang/NGS/README new file mode 100644 index 0000000000..ab0c588eb1 --- /dev/null +++ b/Lang/NGS/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:NGS diff --git a/Lang/NGS/Rep-string b/Lang/NGS/Rep-string new file mode 120000 index 0000000000..aa214c1cad --- /dev/null +++ b/Lang/NGS/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/NGS \ No newline at end of file diff --git a/Lang/NewtonScript/00DESCRIPTION b/Lang/NewtonScript/00DESCRIPTION new file mode 100644 index 0000000000..cdb4888c11 --- /dev/null +++ b/Lang/NewtonScript/00DESCRIPTION @@ -0,0 +1,15 @@ +{{language|NewtonScript +|strength=strong +|checking=dynamic +|parampass=both +|gc=yes +|LCT=no}} +NewtonScript is a [[Self]]-influenced prototype-based programming language, originally written for the Apple Newton platforms by Walter Smith. It was designed to be as resourceful as possible through its prototyping interface, to accomodate the small memory of the original Newton MessagePad. + +The language [[Io]] is partly influenced by NewtonScript's design, using a similar prototyping model as well as NewtonScript's differential inheritance. + +==External links== +* [http://www.newted.org/download/manuals/NewtonScriptProgramLanguage.pdf Language Guide] +* [http://www.newted.org/download/manuals/NewtonProgrammerRef20.pdf Language Reference] +* [http://communicrossings.com/html/newton/newtdev.htm IDE for Newton devices] +* [http://gnue.github.io/NEWT0/ Multiplatform interpreter] \ No newline at end of file diff --git a/Lang/NewtonScript/FizzBuzz b/Lang/NewtonScript/FizzBuzz new file mode 120000 index 0000000000..33fd7b070f --- /dev/null +++ b/Lang/NewtonScript/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/NewtonScript \ No newline at end of file diff --git a/Lang/NewtonScript/README b/Lang/NewtonScript/README new file mode 100644 index 0000000000..bcc6fab765 --- /dev/null +++ b/Lang/NewtonScript/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:NewtonScript diff --git a/Lang/Nim/00DESCRIPTION b/Lang/Nim/00DESCRIPTION new file mode 100644 index 0000000000..ac05eedde3 --- /dev/null +++ b/Lang/Nim/00DESCRIPTION @@ -0,0 +1,13 @@ +{{language +|exec=machine +|gc=yes +|parampass=both +|express=both +|strength=strong +|LCT=yes +|checking=static +|site=http://nim-lang.org}} +{{language programming paradigm|imperative}} +Nim (formerly known as Nimrod) is a general purpose, high-level, system programming, statically typed imperative compiled programming language that is developed by Andreas Rumpf. There is a lot of focus on portability and efficiency. The language compiles to C and supports many C compilers. Nim is actively being developed although it could use more developers. The language has extensive [http://nim-lang.org/docs/lib.html documentation], and a very good [http://nimrod-lang.org/docs/tut1.html tutorial]. + +You can ask for help on Freenode in the #nim channel. \ No newline at end of file diff --git a/Lang/Nim/100-doors b/Lang/Nim/100-doors new file mode 120000 index 0000000000..ce07fc4238 --- /dev/null +++ b/Lang/Nim/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Nim \ No newline at end of file diff --git a/Lang/Nim/24-game b/Lang/Nim/24-game new file mode 120000 index 0000000000..0ada16a441 --- /dev/null +++ b/Lang/Nim/24-game @@ -0,0 +1 @@ +../../Task/24-game/Nim \ No newline at end of file diff --git a/Lang/Nim/9-billion-names-of-God-the-integer b/Lang/Nim/9-billion-names-of-God-the-integer new file mode 120000 index 0000000000..9296f7c386 --- /dev/null +++ b/Lang/Nim/9-billion-names-of-God-the-integer @@ -0,0 +1 @@ +../../Task/9-billion-names-of-God-the-integer/Nim \ No newline at end of file diff --git a/Lang/Nim/99-Bottles-of-Beer b/Lang/Nim/99-Bottles-of-Beer new file mode 120000 index 0000000000..7546a2fa35 --- /dev/null +++ b/Lang/Nim/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Nim \ No newline at end of file diff --git a/Lang/Nim/A+B b/Lang/Nim/A+B new file mode 120000 index 0000000000..7410e7b09f --- /dev/null +++ b/Lang/Nim/A+B @@ -0,0 +1 @@ +../../Task/A+B/Nim \ No newline at end of file diff --git a/Lang/Nim/ABC-Problem b/Lang/Nim/ABC-Problem new file mode 120000 index 0000000000..065b943bc6 --- /dev/null +++ b/Lang/Nim/ABC-Problem @@ -0,0 +1 @@ +../../Task/ABC-Problem/Nim \ No newline at end of file diff --git a/Lang/Nim/Abstract-type b/Lang/Nim/Abstract-type new file mode 120000 index 0000000000..6cec66bcfa --- /dev/null +++ b/Lang/Nim/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/Nim \ No newline at end of file diff --git a/Lang/Nim/Abundant,-deficient-and-perfect-number-classifications b/Lang/Nim/Abundant,-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..351171411e --- /dev/null +++ b/Lang/Nim/Abundant,-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant,-deficient-and-perfect-number-classifications/Nim \ No newline at end of file diff --git a/Lang/Nim/Accumulator-factory b/Lang/Nim/Accumulator-factory new file mode 120000 index 0000000000..640510b71f --- /dev/null +++ b/Lang/Nim/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/Nim \ No newline at end of file diff --git a/Lang/Nim/Ackermann-function b/Lang/Nim/Ackermann-function new file mode 120000 index 0000000000..f5d48ea937 --- /dev/null +++ b/Lang/Nim/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Nim \ No newline at end of file diff --git a/Lang/Nim/Address-of-a-variable b/Lang/Nim/Address-of-a-variable new file mode 120000 index 0000000000..a1429e7525 --- /dev/null +++ b/Lang/Nim/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/Nim \ No newline at end of file diff --git a/Lang/Nim/Align-columns b/Lang/Nim/Align-columns new file mode 120000 index 0000000000..cd4e6825c5 --- /dev/null +++ b/Lang/Nim/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/Nim \ No newline at end of file diff --git a/Lang/Nim/Amb b/Lang/Nim/Amb new file mode 120000 index 0000000000..3a4ab45fa4 --- /dev/null +++ b/Lang/Nim/Amb @@ -0,0 +1 @@ +../../Task/Amb/Nim \ No newline at end of file diff --git a/Lang/Nim/Amicable-pairs b/Lang/Nim/Amicable-pairs new file mode 120000 index 0000000000..dc81bca546 --- /dev/null +++ b/Lang/Nim/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/Nim \ No newline at end of file diff --git a/Lang/Nim/Anagrams b/Lang/Nim/Anagrams new file mode 120000 index 0000000000..a6bc6aaf3a --- /dev/null +++ b/Lang/Nim/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/Nim \ No newline at end of file diff --git a/Lang/Nim/Anonymous-recursion b/Lang/Nim/Anonymous-recursion new file mode 120000 index 0000000000..f9385145c7 --- /dev/null +++ b/Lang/Nim/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/Nim \ No newline at end of file diff --git a/Lang/Nim/Apply-a-callback-to-an-array b/Lang/Nim/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..a3a798db9b --- /dev/null +++ b/Lang/Nim/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Nim \ No newline at end of file diff --git a/Lang/Nim/Arbitrary-precision-integers--included- b/Lang/Nim/Arbitrary-precision-integers--included- new file mode 120000 index 0000000000..b3750042b3 --- /dev/null +++ b/Lang/Nim/Arbitrary-precision-integers--included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers--included-/Nim \ No newline at end of file diff --git a/Lang/Nim/Arithmetic-Complex b/Lang/Nim/Arithmetic-Complex new file mode 120000 index 0000000000..21484ed79e --- /dev/null +++ b/Lang/Nim/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/Nim \ No newline at end of file diff --git a/Lang/Nim/Arithmetic-Integer b/Lang/Nim/Arithmetic-Integer new file mode 120000 index 0000000000..f1acb62fe2 --- /dev/null +++ b/Lang/Nim/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Nim \ No newline at end of file diff --git a/Lang/Nim/Arithmetic-Rational b/Lang/Nim/Arithmetic-Rational new file mode 120000 index 0000000000..22a962af82 --- /dev/null +++ b/Lang/Nim/Arithmetic-Rational @@ -0,0 +1 @@ +../../Task/Arithmetic-Rational/Nim \ No newline at end of file diff --git a/Lang/Nim/Arithmetic-geometric-mean b/Lang/Nim/Arithmetic-geometric-mean new file mode 120000 index 0000000000..6aef29488c --- /dev/null +++ b/Lang/Nim/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/Nim \ No newline at end of file diff --git a/Lang/Nim/Array-concatenation b/Lang/Nim/Array-concatenation new file mode 120000 index 0000000000..202891e5e1 --- /dev/null +++ b/Lang/Nim/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Nim \ No newline at end of file diff --git a/Lang/Nim/Arrays b/Lang/Nim/Arrays new file mode 120000 index 0000000000..b5c2e0db23 --- /dev/null +++ b/Lang/Nim/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Nim \ No newline at end of file diff --git a/Lang/Nim/Assertions b/Lang/Nim/Assertions new file mode 120000 index 0000000000..f6a8fce64f --- /dev/null +++ b/Lang/Nim/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Nim \ No newline at end of file diff --git a/Lang/Nim/Associative-array-Creation b/Lang/Nim/Associative-array-Creation new file mode 120000 index 0000000000..812e439faf --- /dev/null +++ b/Lang/Nim/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Nim \ No newline at end of file diff --git a/Lang/Nim/Associative-array-Iteration b/Lang/Nim/Associative-array-Iteration new file mode 120000 index 0000000000..051ed47131 --- /dev/null +++ b/Lang/Nim/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Nim \ No newline at end of file diff --git a/Lang/Nim/Average-loop-length b/Lang/Nim/Average-loop-length new file mode 120000 index 0000000000..e8b5b0ee49 --- /dev/null +++ b/Lang/Nim/Average-loop-length @@ -0,0 +1 @@ +../../Task/Average-loop-length/Nim \ No newline at end of file diff --git a/Lang/Nim/Averages-Arithmetic-mean b/Lang/Nim/Averages-Arithmetic-mean new file mode 120000 index 0000000000..fa84f4afb4 --- /dev/null +++ b/Lang/Nim/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Nim \ No newline at end of file diff --git a/Lang/Nim/Averages-Mean-angle b/Lang/Nim/Averages-Mean-angle new file mode 120000 index 0000000000..34e9c5f5f4 --- /dev/null +++ b/Lang/Nim/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/Nim \ No newline at end of file diff --git a/Lang/Nim/Averages-Mean-time-of-day b/Lang/Nim/Averages-Mean-time-of-day new file mode 120000 index 0000000000..67c8d997f9 --- /dev/null +++ b/Lang/Nim/Averages-Mean-time-of-day @@ -0,0 +1 @@ +../../Task/Averages-Mean-time-of-day/Nim \ No newline at end of file diff --git a/Lang/Nim/Averages-Median b/Lang/Nim/Averages-Median new file mode 120000 index 0000000000..703dec6a51 --- /dev/null +++ b/Lang/Nim/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/Nim \ No newline at end of file diff --git a/Lang/Nim/Averages-Mode b/Lang/Nim/Averages-Mode new file mode 120000 index 0000000000..d1d33175d6 --- /dev/null +++ b/Lang/Nim/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/Nim \ No newline at end of file diff --git a/Lang/Nim/Averages-Pythagorean-means b/Lang/Nim/Averages-Pythagorean-means new file mode 120000 index 0000000000..88bf33b8b6 --- /dev/null +++ b/Lang/Nim/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/Nim \ No newline at end of file diff --git a/Lang/Nim/Averages-Root-mean-square b/Lang/Nim/Averages-Root-mean-square new file mode 120000 index 0000000000..01dd6bfe02 --- /dev/null +++ b/Lang/Nim/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/Nim \ No newline at end of file diff --git a/Lang/Nim/Averages-Simple-moving-average b/Lang/Nim/Averages-Simple-moving-average new file mode 120000 index 0000000000..3c7f10e701 --- /dev/null +++ b/Lang/Nim/Averages-Simple-moving-average @@ -0,0 +1 @@ +../../Task/Averages-Simple-moving-average/Nim \ No newline at end of file diff --git a/Lang/Nim/Balanced-brackets b/Lang/Nim/Balanced-brackets new file mode 120000 index 0000000000..5571182410 --- /dev/null +++ b/Lang/Nim/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Nim \ No newline at end of file diff --git a/Lang/Nim/Binary-digits b/Lang/Nim/Binary-digits new file mode 120000 index 0000000000..362c1220fd --- /dev/null +++ b/Lang/Nim/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Nim \ No newline at end of file diff --git a/Lang/Nim/Binary-search b/Lang/Nim/Binary-search new file mode 120000 index 0000000000..59a540e491 --- /dev/null +++ b/Lang/Nim/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Nim \ No newline at end of file diff --git a/Lang/Nim/Binary-strings b/Lang/Nim/Binary-strings new file mode 120000 index 0000000000..fa5a5c2664 --- /dev/null +++ b/Lang/Nim/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Nim \ No newline at end of file diff --git a/Lang/Nim/Bitmap b/Lang/Nim/Bitmap new file mode 120000 index 0000000000..579e4f41ad --- /dev/null +++ b/Lang/Nim/Bitmap @@ -0,0 +1 @@ +../../Task/Bitmap/Nim \ No newline at end of file diff --git a/Lang/Nim/Bitmap-Bresenhams-line-algorithm b/Lang/Nim/Bitmap-Bresenhams-line-algorithm new file mode 120000 index 0000000000..02a42deb07 --- /dev/null +++ b/Lang/Nim/Bitmap-Bresenhams-line-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Bresenhams-line-algorithm/Nim \ No newline at end of file diff --git a/Lang/Nim/Bitmap-Read-a-PPM-file b/Lang/Nim/Bitmap-Read-a-PPM-file new file mode 120000 index 0000000000..8b7f6f7602 --- /dev/null +++ b/Lang/Nim/Bitmap-Read-a-PPM-file @@ -0,0 +1 @@ +../../Task/Bitmap-Read-a-PPM-file/Nim \ No newline at end of file diff --git a/Lang/Nim/Bitwise-operations b/Lang/Nim/Bitwise-operations new file mode 120000 index 0000000000..00d9810684 --- /dev/null +++ b/Lang/Nim/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/Nim \ No newline at end of file diff --git a/Lang/Nim/Boolean-values b/Lang/Nim/Boolean-values new file mode 120000 index 0000000000..2796b0d914 --- /dev/null +++ b/Lang/Nim/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/Nim \ No newline at end of file diff --git a/Lang/Nim/Box-the-compass b/Lang/Nim/Box-the-compass new file mode 120000 index 0000000000..9edd5f051a --- /dev/null +++ b/Lang/Nim/Box-the-compass @@ -0,0 +1 @@ +../../Task/Box-the-compass/Nim \ No newline at end of file diff --git a/Lang/Nim/Break-OO-privacy b/Lang/Nim/Break-OO-privacy new file mode 120000 index 0000000000..8623e06106 --- /dev/null +++ b/Lang/Nim/Break-OO-privacy @@ -0,0 +1 @@ +../../Task/Break-OO-privacy/Nim \ No newline at end of file diff --git a/Lang/Nim/Bulls-and-cows b/Lang/Nim/Bulls-and-cows new file mode 120000 index 0000000000..6b445cc900 --- /dev/null +++ b/Lang/Nim/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Nim \ No newline at end of file diff --git a/Lang/Nim/CRC-32 b/Lang/Nim/CRC-32 new file mode 120000 index 0000000000..8fd1afb84a --- /dev/null +++ b/Lang/Nim/CRC-32 @@ -0,0 +1 @@ +../../Task/CRC-32/Nim \ No newline at end of file diff --git a/Lang/Nim/CSV-data-manipulation b/Lang/Nim/CSV-data-manipulation new file mode 120000 index 0000000000..2692e5d28b --- /dev/null +++ b/Lang/Nim/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/Nim \ No newline at end of file diff --git a/Lang/Nim/CSV-to-HTML-translation b/Lang/Nim/CSV-to-HTML-translation new file mode 120000 index 0000000000..eb5c469d15 --- /dev/null +++ b/Lang/Nim/CSV-to-HTML-translation @@ -0,0 +1 @@ +../../Task/CSV-to-HTML-translation/Nim \ No newline at end of file diff --git a/Lang/Nim/Caesar-cipher b/Lang/Nim/Caesar-cipher new file mode 120000 index 0000000000..b5e0565223 --- /dev/null +++ b/Lang/Nim/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Nim \ No newline at end of file diff --git a/Lang/Nim/Call-a-foreign-language-function b/Lang/Nim/Call-a-foreign-language-function new file mode 120000 index 0000000000..e45bf5d1c8 --- /dev/null +++ b/Lang/Nim/Call-a-foreign-language-function @@ -0,0 +1 @@ +../../Task/Call-a-foreign-language-function/Nim \ No newline at end of file diff --git a/Lang/Nim/Call-a-function b/Lang/Nim/Call-a-function new file mode 120000 index 0000000000..6bd4d69f49 --- /dev/null +++ b/Lang/Nim/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/Nim \ No newline at end of file diff --git a/Lang/Nim/Call-a-function-in-a-shared-library b/Lang/Nim/Call-a-function-in-a-shared-library new file mode 120000 index 0000000000..f59ce0d598 --- /dev/null +++ b/Lang/Nim/Call-a-function-in-a-shared-library @@ -0,0 +1 @@ +../../Task/Call-a-function-in-a-shared-library/Nim \ No newline at end of file diff --git a/Lang/Nim/Call-an-object-method b/Lang/Nim/Call-an-object-method new file mode 120000 index 0000000000..48bf9bd9ef --- /dev/null +++ b/Lang/Nim/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/Nim \ No newline at end of file diff --git a/Lang/Nim/Case-sensitivity-of-identifiers b/Lang/Nim/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..c27b0193a0 --- /dev/null +++ b/Lang/Nim/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/Nim \ No newline at end of file diff --git a/Lang/Nim/Casting-out-nines b/Lang/Nim/Casting-out-nines new file mode 120000 index 0000000000..a51332a76f --- /dev/null +++ b/Lang/Nim/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/Nim \ No newline at end of file diff --git a/Lang/Nim/Catalan-numbers b/Lang/Nim/Catalan-numbers new file mode 120000 index 0000000000..ddce00c340 --- /dev/null +++ b/Lang/Nim/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/Nim \ No newline at end of file diff --git a/Lang/Nim/Catalan-numbers-Pascals-triangle b/Lang/Nim/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..6be3d02270 --- /dev/null +++ b/Lang/Nim/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/Nim \ No newline at end of file diff --git a/Lang/Nim/Catamorphism b/Lang/Nim/Catamorphism new file mode 120000 index 0000000000..b1aeb07c63 --- /dev/null +++ b/Lang/Nim/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/Nim \ No newline at end of file diff --git a/Lang/Nim/Character-codes b/Lang/Nim/Character-codes new file mode 120000 index 0000000000..2b13eeac62 --- /dev/null +++ b/Lang/Nim/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Nim \ No newline at end of file diff --git a/Lang/Nim/Chat-server b/Lang/Nim/Chat-server new file mode 120000 index 0000000000..4af4b2f97d --- /dev/null +++ b/Lang/Nim/Chat-server @@ -0,0 +1 @@ +../../Task/Chat-server/Nim \ No newline at end of file diff --git a/Lang/Nim/Check-that-file-exists b/Lang/Nim/Check-that-file-exists new file mode 120000 index 0000000000..162ea95fbd --- /dev/null +++ b/Lang/Nim/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Nim \ No newline at end of file diff --git a/Lang/Nim/Chinese-remainder-theorem b/Lang/Nim/Chinese-remainder-theorem new file mode 120000 index 0000000000..5c33d7d67d --- /dev/null +++ b/Lang/Nim/Chinese-remainder-theorem @@ -0,0 +1 @@ +../../Task/Chinese-remainder-theorem/Nim \ No newline at end of file diff --git a/Lang/Nim/Cholesky-decomposition b/Lang/Nim/Cholesky-decomposition new file mode 120000 index 0000000000..46209ad759 --- /dev/null +++ b/Lang/Nim/Cholesky-decomposition @@ -0,0 +1 @@ +../../Task/Cholesky-decomposition/Nim \ No newline at end of file diff --git a/Lang/Nim/Circles-of-given-radius-through-two-points b/Lang/Nim/Circles-of-given-radius-through-two-points new file mode 120000 index 0000000000..ea98209762 --- /dev/null +++ b/Lang/Nim/Circles-of-given-radius-through-two-points @@ -0,0 +1 @@ +../../Task/Circles-of-given-radius-through-two-points/Nim \ No newline at end of file diff --git a/Lang/Nim/Classes b/Lang/Nim/Classes new file mode 120000 index 0000000000..cafe76bcfb --- /dev/null +++ b/Lang/Nim/Classes @@ -0,0 +1 @@ +../../Task/Classes/Nim \ No newline at end of file diff --git a/Lang/Nim/Closures-Value-capture b/Lang/Nim/Closures-Value-capture new file mode 120000 index 0000000000..2c70a8198c --- /dev/null +++ b/Lang/Nim/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/Nim \ No newline at end of file diff --git a/Lang/Nim/Collections b/Lang/Nim/Collections new file mode 120000 index 0000000000..a39d4da816 --- /dev/null +++ b/Lang/Nim/Collections @@ -0,0 +1 @@ +../../Task/Collections/Nim \ No newline at end of file diff --git a/Lang/Nim/Color-of-a-screen-pixel b/Lang/Nim/Color-of-a-screen-pixel new file mode 120000 index 0000000000..f298b7a0ce --- /dev/null +++ b/Lang/Nim/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/Nim \ No newline at end of file diff --git a/Lang/Nim/Combinations b/Lang/Nim/Combinations new file mode 120000 index 0000000000..22b433029b --- /dev/null +++ b/Lang/Nim/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/Nim \ No newline at end of file diff --git a/Lang/Nim/Combinations-and-permutations b/Lang/Nim/Combinations-and-permutations new file mode 120000 index 0000000000..51fe79bd5f --- /dev/null +++ b/Lang/Nim/Combinations-and-permutations @@ -0,0 +1 @@ +../../Task/Combinations-and-permutations/Nim \ No newline at end of file diff --git a/Lang/Nim/Combinations-with-repetitions b/Lang/Nim/Combinations-with-repetitions new file mode 120000 index 0000000000..0f7e94072e --- /dev/null +++ b/Lang/Nim/Combinations-with-repetitions @@ -0,0 +1 @@ +../../Task/Combinations-with-repetitions/Nim \ No newline at end of file diff --git a/Lang/Nim/Comma-quibbling b/Lang/Nim/Comma-quibbling new file mode 120000 index 0000000000..694509c225 --- /dev/null +++ b/Lang/Nim/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/Nim \ No newline at end of file diff --git a/Lang/Nim/Command-line-arguments b/Lang/Nim/Command-line-arguments new file mode 120000 index 0000000000..37c1abe69c --- /dev/null +++ b/Lang/Nim/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/Nim \ No newline at end of file diff --git a/Lang/Nim/Comments b/Lang/Nim/Comments new file mode 120000 index 0000000000..e3a36b4c9c --- /dev/null +++ b/Lang/Nim/Comments @@ -0,0 +1 @@ +../../Task/Comments/Nim \ No newline at end of file diff --git a/Lang/Nim/Compile-time-calculation b/Lang/Nim/Compile-time-calculation new file mode 120000 index 0000000000..c9d0edd801 --- /dev/null +++ b/Lang/Nim/Compile-time-calculation @@ -0,0 +1 @@ +../../Task/Compile-time-calculation/Nim \ No newline at end of file diff --git a/Lang/Nim/Compound-data-type b/Lang/Nim/Compound-data-type new file mode 120000 index 0000000000..b285b5c9cf --- /dev/null +++ b/Lang/Nim/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/Nim \ No newline at end of file diff --git a/Lang/Nim/Concurrent-computing b/Lang/Nim/Concurrent-computing new file mode 120000 index 0000000000..1d15651159 --- /dev/null +++ b/Lang/Nim/Concurrent-computing @@ -0,0 +1 @@ +../../Task/Concurrent-computing/Nim \ No newline at end of file diff --git a/Lang/Nim/Conditional-structures b/Lang/Nim/Conditional-structures new file mode 120000 index 0000000000..5451fd17db --- /dev/null +++ b/Lang/Nim/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Nim \ No newline at end of file diff --git a/Lang/Nim/Constrained-genericity b/Lang/Nim/Constrained-genericity new file mode 120000 index 0000000000..51a67805e4 --- /dev/null +++ b/Lang/Nim/Constrained-genericity @@ -0,0 +1 @@ +../../Task/Constrained-genericity/Nim \ No newline at end of file diff --git a/Lang/Nim/Constrained-random-points-on-a-circle b/Lang/Nim/Constrained-random-points-on-a-circle new file mode 120000 index 0000000000..f31ae44cf1 --- /dev/null +++ b/Lang/Nim/Constrained-random-points-on-a-circle @@ -0,0 +1 @@ +../../Task/Constrained-random-points-on-a-circle/Nim \ No newline at end of file diff --git a/Lang/Nim/Conways-Game-of-Life b/Lang/Nim/Conways-Game-of-Life new file mode 120000 index 0000000000..4af2ea4972 --- /dev/null +++ b/Lang/Nim/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/Nim \ No newline at end of file diff --git a/Lang/Nim/Copy-a-string b/Lang/Nim/Copy-a-string new file mode 120000 index 0000000000..dce36be3a2 --- /dev/null +++ b/Lang/Nim/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Nim \ No newline at end of file diff --git a/Lang/Nim/Count-in-factors b/Lang/Nim/Count-in-factors new file mode 120000 index 0000000000..28cfb4a929 --- /dev/null +++ b/Lang/Nim/Count-in-factors @@ -0,0 +1 @@ +../../Task/Count-in-factors/Nim \ No newline at end of file diff --git a/Lang/Nim/Count-in-octal b/Lang/Nim/Count-in-octal new file mode 120000 index 0000000000..d5453c30d0 --- /dev/null +++ b/Lang/Nim/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/Nim \ No newline at end of file diff --git a/Lang/Nim/Count-occurrences-of-a-substring b/Lang/Nim/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..d8f9510691 --- /dev/null +++ b/Lang/Nim/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Nim \ No newline at end of file diff --git a/Lang/Nim/Count-the-coins b/Lang/Nim/Count-the-coins new file mode 120000 index 0000000000..401f0e6cfa --- /dev/null +++ b/Lang/Nim/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/Nim \ No newline at end of file diff --git a/Lang/Nim/Create-a-file b/Lang/Nim/Create-a-file new file mode 120000 index 0000000000..7f5076f596 --- /dev/null +++ b/Lang/Nim/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/Nim \ No newline at end of file diff --git a/Lang/Nim/Create-a-file-on-magnetic-tape b/Lang/Nim/Create-a-file-on-magnetic-tape new file mode 120000 index 0000000000..f134cce362 --- /dev/null +++ b/Lang/Nim/Create-a-file-on-magnetic-tape @@ -0,0 +1 @@ +../../Task/Create-a-file-on-magnetic-tape/Nim \ No newline at end of file diff --git a/Lang/Nim/Create-a-two-dimensional-array-at-runtime b/Lang/Nim/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..038a678b6d --- /dev/null +++ b/Lang/Nim/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/Nim \ No newline at end of file diff --git a/Lang/Nim/Create-an-HTML-table b/Lang/Nim/Create-an-HTML-table new file mode 120000 index 0000000000..857332a5e7 --- /dev/null +++ b/Lang/Nim/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/Nim \ No newline at end of file diff --git a/Lang/Nim/Currying b/Lang/Nim/Currying new file mode 120000 index 0000000000..b18daa09bf --- /dev/null +++ b/Lang/Nim/Currying @@ -0,0 +1 @@ +../../Task/Currying/Nim \ No newline at end of file diff --git a/Lang/Nim/Date-format b/Lang/Nim/Date-format new file mode 120000 index 0000000000..fb4c138049 --- /dev/null +++ b/Lang/Nim/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/Nim \ No newline at end of file diff --git a/Lang/Nim/Date-manipulation b/Lang/Nim/Date-manipulation new file mode 120000 index 0000000000..ed33845b3d --- /dev/null +++ b/Lang/Nim/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/Nim \ No newline at end of file diff --git a/Lang/Nim/Day-of-the-week b/Lang/Nim/Day-of-the-week new file mode 120000 index 0000000000..160c9f4807 --- /dev/null +++ b/Lang/Nim/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Nim \ No newline at end of file diff --git a/Lang/Nim/Deal-cards-for-FreeCell b/Lang/Nim/Deal-cards-for-FreeCell new file mode 120000 index 0000000000..7af5e99710 --- /dev/null +++ b/Lang/Nim/Deal-cards-for-FreeCell @@ -0,0 +1 @@ +../../Task/Deal-cards-for-FreeCell/Nim \ No newline at end of file diff --git a/Lang/Nim/Deepcopy b/Lang/Nim/Deepcopy new file mode 120000 index 0000000000..5fe04c5233 --- /dev/null +++ b/Lang/Nim/Deepcopy @@ -0,0 +1 @@ +../../Task/Deepcopy/Nim \ No newline at end of file diff --git a/Lang/Nim/Define-a-primitive-data-type b/Lang/Nim/Define-a-primitive-data-type new file mode 120000 index 0000000000..0a38799b15 --- /dev/null +++ b/Lang/Nim/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/Nim \ No newline at end of file diff --git a/Lang/Nim/Delete-a-file b/Lang/Nim/Delete-a-file new file mode 120000 index 0000000000..04d62d58e1 --- /dev/null +++ b/Lang/Nim/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Nim \ No newline at end of file diff --git a/Lang/Nim/Detect-division-by-zero b/Lang/Nim/Detect-division-by-zero new file mode 120000 index 0000000000..e116fc2838 --- /dev/null +++ b/Lang/Nim/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Nim \ No newline at end of file diff --git a/Lang/Nim/Determine-if-a-string-is-numeric b/Lang/Nim/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..9ddc79e589 --- /dev/null +++ b/Lang/Nim/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Nim \ No newline at end of file diff --git a/Lang/Nim/Determine-if-only-one-instance-is-running b/Lang/Nim/Determine-if-only-one-instance-is-running new file mode 120000 index 0000000000..16067be1a4 --- /dev/null +++ b/Lang/Nim/Determine-if-only-one-instance-is-running @@ -0,0 +1 @@ +../../Task/Determine-if-only-one-instance-is-running/Nim \ No newline at end of file diff --git a/Lang/Nim/Digital-root b/Lang/Nim/Digital-root new file mode 120000 index 0000000000..3014e8f965 --- /dev/null +++ b/Lang/Nim/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/Nim \ No newline at end of file diff --git a/Lang/Nim/Digital-root-Multiplicative-digital-root b/Lang/Nim/Digital-root-Multiplicative-digital-root new file mode 120000 index 0000000000..0d76c25234 --- /dev/null +++ b/Lang/Nim/Digital-root-Multiplicative-digital-root @@ -0,0 +1 @@ +../../Task/Digital-root-Multiplicative-digital-root/Nim \ No newline at end of file diff --git a/Lang/Nim/Dining-philosophers b/Lang/Nim/Dining-philosophers new file mode 120000 index 0000000000..19b9dabe53 --- /dev/null +++ b/Lang/Nim/Dining-philosophers @@ -0,0 +1 @@ +../../Task/Dining-philosophers/Nim \ No newline at end of file diff --git a/Lang/Nim/Distributed-programming b/Lang/Nim/Distributed-programming new file mode 120000 index 0000000000..6715c54ac1 --- /dev/null +++ b/Lang/Nim/Distributed-programming @@ -0,0 +1 @@ +../../Task/Distributed-programming/Nim \ No newline at end of file diff --git a/Lang/Nim/Documentation b/Lang/Nim/Documentation new file mode 120000 index 0000000000..31cd559a05 --- /dev/null +++ b/Lang/Nim/Documentation @@ -0,0 +1 @@ +../../Task/Documentation/Nim \ No newline at end of file diff --git a/Lang/Nim/Dot-product b/Lang/Nim/Dot-product new file mode 120000 index 0000000000..e76ac8ff73 --- /dev/null +++ b/Lang/Nim/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Nim \ No newline at end of file diff --git a/Lang/Nim/Doubly-linked-list-Definition b/Lang/Nim/Doubly-linked-list-Definition new file mode 120000 index 0000000000..d461d371fa --- /dev/null +++ b/Lang/Nim/Doubly-linked-list-Definition @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Definition/Nim \ No newline at end of file diff --git a/Lang/Nim/Doubly-linked-list-Element-definition b/Lang/Nim/Doubly-linked-list-Element-definition new file mode 120000 index 0000000000..bc5b58953b --- /dev/null +++ b/Lang/Nim/Doubly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Element-definition/Nim \ No newline at end of file diff --git a/Lang/Nim/Doubly-linked-list-Element-insertion b/Lang/Nim/Doubly-linked-list-Element-insertion new file mode 120000 index 0000000000..a28b127ca9 --- /dev/null +++ b/Lang/Nim/Doubly-linked-list-Element-insertion @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Element-insertion/Nim \ No newline at end of file diff --git a/Lang/Nim/Doubly-linked-list-Traversal b/Lang/Nim/Doubly-linked-list-Traversal new file mode 120000 index 0000000000..1f7eda1cea --- /dev/null +++ b/Lang/Nim/Doubly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Traversal/Nim \ No newline at end of file diff --git a/Lang/Nim/Draw-a-clock b/Lang/Nim/Draw-a-clock new file mode 120000 index 0000000000..68890d0e36 --- /dev/null +++ b/Lang/Nim/Draw-a-clock @@ -0,0 +1 @@ +../../Task/Draw-a-clock/Nim \ No newline at end of file diff --git a/Lang/Nim/Draw-a-cuboid b/Lang/Nim/Draw-a-cuboid new file mode 120000 index 0000000000..c3730c3abf --- /dev/null +++ b/Lang/Nim/Draw-a-cuboid @@ -0,0 +1 @@ +../../Task/Draw-a-cuboid/Nim \ No newline at end of file diff --git a/Lang/Nim/Draw-a-sphere b/Lang/Nim/Draw-a-sphere new file mode 120000 index 0000000000..91009765d1 --- /dev/null +++ b/Lang/Nim/Draw-a-sphere @@ -0,0 +1 @@ +../../Task/Draw-a-sphere/Nim \ No newline at end of file diff --git a/Lang/Nim/Echo-server b/Lang/Nim/Echo-server new file mode 120000 index 0000000000..6a4a37627c --- /dev/null +++ b/Lang/Nim/Echo-server @@ -0,0 +1 @@ +../../Task/Echo-server/Nim \ No newline at end of file diff --git a/Lang/Nim/Empty-directory b/Lang/Nim/Empty-directory new file mode 120000 index 0000000000..58e057a197 --- /dev/null +++ b/Lang/Nim/Empty-directory @@ -0,0 +1 @@ +../../Task/Empty-directory/Nim \ No newline at end of file diff --git a/Lang/Nim/Empty-string b/Lang/Nim/Empty-string new file mode 120000 index 0000000000..9149eb3267 --- /dev/null +++ b/Lang/Nim/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Nim \ No newline at end of file diff --git a/Lang/Nim/Enforced-immutability b/Lang/Nim/Enforced-immutability new file mode 120000 index 0000000000..337be3846b --- /dev/null +++ b/Lang/Nim/Enforced-immutability @@ -0,0 +1 @@ +../../Task/Enforced-immutability/Nim \ No newline at end of file diff --git a/Lang/Nim/Entropy b/Lang/Nim/Entropy new file mode 120000 index 0000000000..a0815e7daa --- /dev/null +++ b/Lang/Nim/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/Nim \ No newline at end of file diff --git a/Lang/Nim/Enumerations b/Lang/Nim/Enumerations new file mode 120000 index 0000000000..4eb8b73435 --- /dev/null +++ b/Lang/Nim/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/Nim \ No newline at end of file diff --git a/Lang/Nim/Environment-variables b/Lang/Nim/Environment-variables new file mode 120000 index 0000000000..24c72ba2d5 --- /dev/null +++ b/Lang/Nim/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/Nim \ No newline at end of file diff --git a/Lang/Nim/Equilibrium-index b/Lang/Nim/Equilibrium-index new file mode 120000 index 0000000000..e67585d400 --- /dev/null +++ b/Lang/Nim/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/Nim \ No newline at end of file diff --git a/Lang/Nim/Ethiopian-multiplication b/Lang/Nim/Ethiopian-multiplication new file mode 120000 index 0000000000..e7e8f983c2 --- /dev/null +++ b/Lang/Nim/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Nim \ No newline at end of file diff --git a/Lang/Nim/Euler-method b/Lang/Nim/Euler-method new file mode 120000 index 0000000000..31db65f6a8 --- /dev/null +++ b/Lang/Nim/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/Nim \ No newline at end of file diff --git a/Lang/Nim/Evaluate-binomial-coefficients b/Lang/Nim/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..e0735e0529 --- /dev/null +++ b/Lang/Nim/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/Nim \ No newline at end of file diff --git a/Lang/Nim/Even-or-odd b/Lang/Nim/Even-or-odd new file mode 120000 index 0000000000..003729bc2a --- /dev/null +++ b/Lang/Nim/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Nim \ No newline at end of file diff --git a/Lang/Nim/Events b/Lang/Nim/Events new file mode 120000 index 0000000000..1badb0c798 --- /dev/null +++ b/Lang/Nim/Events @@ -0,0 +1 @@ +../../Task/Events/Nim \ No newline at end of file diff --git a/Lang/Nim/Evolutionary-algorithm b/Lang/Nim/Evolutionary-algorithm new file mode 120000 index 0000000000..0943d0ebfa --- /dev/null +++ b/Lang/Nim/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/Nim \ No newline at end of file diff --git a/Lang/Nim/Exceptions b/Lang/Nim/Exceptions new file mode 120000 index 0000000000..4c21d1366d --- /dev/null +++ b/Lang/Nim/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/Nim \ No newline at end of file diff --git a/Lang/Nim/Exceptions-Catch-an-exception-thrown-in-a-nested-call b/Lang/Nim/Exceptions-Catch-an-exception-thrown-in-a-nested-call new file mode 120000 index 0000000000..0990469801 --- /dev/null +++ b/Lang/Nim/Exceptions-Catch-an-exception-thrown-in-a-nested-call @@ -0,0 +1 @@ +../../Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Nim \ No newline at end of file diff --git a/Lang/Nim/Executable-library b/Lang/Nim/Executable-library new file mode 120000 index 0000000000..4ad1573f23 --- /dev/null +++ b/Lang/Nim/Executable-library @@ -0,0 +1 @@ +../../Task/Executable-library/Nim \ No newline at end of file diff --git a/Lang/Nim/Execute-Brain---- b/Lang/Nim/Execute-Brain---- new file mode 120000 index 0000000000..301931e0da --- /dev/null +++ b/Lang/Nim/Execute-Brain---- @@ -0,0 +1 @@ +../../Task/Execute-Brain----/Nim \ No newline at end of file diff --git a/Lang/Nim/Execute-HQ9+ b/Lang/Nim/Execute-HQ9+ new file mode 120000 index 0000000000..78f8576b2a --- /dev/null +++ b/Lang/Nim/Execute-HQ9+ @@ -0,0 +1 @@ +../../Task/Execute-HQ9+/Nim \ No newline at end of file diff --git a/Lang/Nim/Execute-a-system-command b/Lang/Nim/Execute-a-system-command new file mode 120000 index 0000000000..b52878d297 --- /dev/null +++ b/Lang/Nim/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/Nim \ No newline at end of file diff --git a/Lang/Nim/Exponentiation-operator b/Lang/Nim/Exponentiation-operator new file mode 120000 index 0000000000..f5f793981a --- /dev/null +++ b/Lang/Nim/Exponentiation-operator @@ -0,0 +1 @@ +../../Task/Exponentiation-operator/Nim \ No newline at end of file diff --git a/Lang/Nim/Extend-your-language b/Lang/Nim/Extend-your-language new file mode 120000 index 0000000000..3e6786cc17 --- /dev/null +++ b/Lang/Nim/Extend-your-language @@ -0,0 +1 @@ +../../Task/Extend-your-language/Nim \ No newline at end of file diff --git a/Lang/Nim/Extreme-floating-point-values b/Lang/Nim/Extreme-floating-point-values new file mode 120000 index 0000000000..d458dc101e --- /dev/null +++ b/Lang/Nim/Extreme-floating-point-values @@ -0,0 +1 @@ +../../Task/Extreme-floating-point-values/Nim \ No newline at end of file diff --git a/Lang/Nim/Factorial b/Lang/Nim/Factorial new file mode 120000 index 0000000000..5d5a3b1ee3 --- /dev/null +++ b/Lang/Nim/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Nim \ No newline at end of file diff --git a/Lang/Nim/Factors-of-a-Mersenne-number b/Lang/Nim/Factors-of-a-Mersenne-number new file mode 120000 index 0000000000..fef5bce4c9 --- /dev/null +++ b/Lang/Nim/Factors-of-a-Mersenne-number @@ -0,0 +1 @@ +../../Task/Factors-of-a-Mersenne-number/Nim \ No newline at end of file diff --git a/Lang/Nim/Factors-of-an-integer b/Lang/Nim/Factors-of-an-integer new file mode 120000 index 0000000000..cf66d1e430 --- /dev/null +++ b/Lang/Nim/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Nim \ No newline at end of file diff --git a/Lang/Nim/Fast-Fourier-transform b/Lang/Nim/Fast-Fourier-transform new file mode 120000 index 0000000000..75a0b19009 --- /dev/null +++ b/Lang/Nim/Fast-Fourier-transform @@ -0,0 +1 @@ +../../Task/Fast-Fourier-transform/Nim \ No newline at end of file diff --git a/Lang/Nim/Fibonacci-n-step-number-sequences b/Lang/Nim/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..56ef379b67 --- /dev/null +++ b/Lang/Nim/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/Nim \ No newline at end of file diff --git a/Lang/Nim/Fibonacci-sequence b/Lang/Nim/Fibonacci-sequence new file mode 120000 index 0000000000..dbc3b59bce --- /dev/null +++ b/Lang/Nim/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Nim \ No newline at end of file diff --git a/Lang/Nim/File-input-output b/Lang/Nim/File-input-output new file mode 120000 index 0000000000..84e97ef074 --- /dev/null +++ b/Lang/Nim/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/Nim \ No newline at end of file diff --git a/Lang/Nim/File-modification-time b/Lang/Nim/File-modification-time new file mode 120000 index 0000000000..b773f3af53 --- /dev/null +++ b/Lang/Nim/File-modification-time @@ -0,0 +1 @@ +../../Task/File-modification-time/Nim \ No newline at end of file diff --git a/Lang/Nim/File-size b/Lang/Nim/File-size new file mode 120000 index 0000000000..b50f4a6dc6 --- /dev/null +++ b/Lang/Nim/File-size @@ -0,0 +1 @@ +../../Task/File-size/Nim \ No newline at end of file diff --git a/Lang/Nim/Filter b/Lang/Nim/Filter new file mode 120000 index 0000000000..b1ea952f54 --- /dev/null +++ b/Lang/Nim/Filter @@ -0,0 +1 @@ +../../Task/Filter/Nim \ No newline at end of file diff --git a/Lang/Nim/Find-common-directory-path b/Lang/Nim/Find-common-directory-path new file mode 120000 index 0000000000..75e18404c5 --- /dev/null +++ b/Lang/Nim/Find-common-directory-path @@ -0,0 +1 @@ +../../Task/Find-common-directory-path/Nim \ No newline at end of file diff --git a/Lang/Nim/Find-limit-of-recursion b/Lang/Nim/Find-limit-of-recursion new file mode 120000 index 0000000000..c2be8fc26c --- /dev/null +++ b/Lang/Nim/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/Nim \ No newline at end of file diff --git a/Lang/Nim/Find-the-last-Sunday-of-each-month b/Lang/Nim/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..d8ab6a4b75 --- /dev/null +++ b/Lang/Nim/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/Nim \ No newline at end of file diff --git a/Lang/Nim/Find-the-missing-permutation b/Lang/Nim/Find-the-missing-permutation new file mode 120000 index 0000000000..a22d1ecb04 --- /dev/null +++ b/Lang/Nim/Find-the-missing-permutation @@ -0,0 +1 @@ +../../Task/Find-the-missing-permutation/Nim \ No newline at end of file diff --git a/Lang/Nim/First-class-functions b/Lang/Nim/First-class-functions new file mode 120000 index 0000000000..e53f5de8f1 --- /dev/null +++ b/Lang/Nim/First-class-functions @@ -0,0 +1 @@ +../../Task/First-class-functions/Nim \ No newline at end of file diff --git a/Lang/Nim/Five-weekends b/Lang/Nim/Five-weekends new file mode 120000 index 0000000000..0b9056a514 --- /dev/null +++ b/Lang/Nim/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/Nim \ No newline at end of file diff --git a/Lang/Nim/FizzBuzz b/Lang/Nim/FizzBuzz new file mode 120000 index 0000000000..40c77e6876 --- /dev/null +++ b/Lang/Nim/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Nim \ No newline at end of file diff --git a/Lang/Nim/Flatten-a-list b/Lang/Nim/Flatten-a-list new file mode 120000 index 0000000000..357ffb96e8 --- /dev/null +++ b/Lang/Nim/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Nim \ No newline at end of file diff --git a/Lang/Nim/Flow-control-structures b/Lang/Nim/Flow-control-structures new file mode 120000 index 0000000000..6376fdcf40 --- /dev/null +++ b/Lang/Nim/Flow-control-structures @@ -0,0 +1 @@ +../../Task/Flow-control-structures/Nim \ No newline at end of file diff --git a/Lang/Nim/Floyds-triangle b/Lang/Nim/Floyds-triangle new file mode 120000 index 0000000000..3d9989b810 --- /dev/null +++ b/Lang/Nim/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/Nim \ No newline at end of file diff --git a/Lang/Nim/Forest-fire b/Lang/Nim/Forest-fire new file mode 120000 index 0000000000..4dead57b3b --- /dev/null +++ b/Lang/Nim/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Nim \ No newline at end of file diff --git a/Lang/Nim/Fork b/Lang/Nim/Fork new file mode 120000 index 0000000000..f52fbc8910 --- /dev/null +++ b/Lang/Nim/Fork @@ -0,0 +1 @@ +../../Task/Fork/Nim \ No newline at end of file diff --git a/Lang/Nim/Formatted-numeric-output b/Lang/Nim/Formatted-numeric-output new file mode 120000 index 0000000000..85add82e1f --- /dev/null +++ b/Lang/Nim/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/Nim \ No newline at end of file diff --git a/Lang/Nim/Forward-difference b/Lang/Nim/Forward-difference new file mode 120000 index 0000000000..3876d3f4b0 --- /dev/null +++ b/Lang/Nim/Forward-difference @@ -0,0 +1 @@ +../../Task/Forward-difference/Nim \ No newline at end of file diff --git a/Lang/Nim/Four-bit-adder b/Lang/Nim/Four-bit-adder new file mode 120000 index 0000000000..0563958c72 --- /dev/null +++ b/Lang/Nim/Four-bit-adder @@ -0,0 +1 @@ +../../Task/Four-bit-adder/Nim \ No newline at end of file diff --git a/Lang/Nim/Function-composition b/Lang/Nim/Function-composition new file mode 120000 index 0000000000..2faad31f82 --- /dev/null +++ b/Lang/Nim/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/Nim \ No newline at end of file diff --git a/Lang/Nim/Function-definition b/Lang/Nim/Function-definition new file mode 120000 index 0000000000..d196a68044 --- /dev/null +++ b/Lang/Nim/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Nim \ No newline at end of file diff --git a/Lang/Nim/Function-prototype b/Lang/Nim/Function-prototype new file mode 120000 index 0000000000..e6a6059517 --- /dev/null +++ b/Lang/Nim/Function-prototype @@ -0,0 +1 @@ +../../Task/Function-prototype/Nim \ No newline at end of file diff --git a/Lang/Nim/GUI-Maximum-window-dimensions b/Lang/Nim/GUI-Maximum-window-dimensions new file mode 120000 index 0000000000..d856bbd1bc --- /dev/null +++ b/Lang/Nim/GUI-Maximum-window-dimensions @@ -0,0 +1 @@ +../../Task/GUI-Maximum-window-dimensions/Nim \ No newline at end of file diff --git a/Lang/Nim/GUI-component-interaction b/Lang/Nim/GUI-component-interaction new file mode 120000 index 0000000000..c148792f54 --- /dev/null +++ b/Lang/Nim/GUI-component-interaction @@ -0,0 +1 @@ +../../Task/GUI-component-interaction/Nim \ No newline at end of file diff --git a/Lang/Nim/GUI-enabling-disabling-of-controls b/Lang/Nim/GUI-enabling-disabling-of-controls new file mode 120000 index 0000000000..e1e891fade --- /dev/null +++ b/Lang/Nim/GUI-enabling-disabling-of-controls @@ -0,0 +1 @@ +../../Task/GUI-enabling-disabling-of-controls/Nim \ No newline at end of file diff --git a/Lang/Nim/Gamma-function b/Lang/Nim/Gamma-function new file mode 120000 index 0000000000..92cfcbe66e --- /dev/null +++ b/Lang/Nim/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/Nim \ No newline at end of file diff --git a/Lang/Nim/Generate-lower-case-ASCII-alphabet b/Lang/Nim/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..76294c44a6 --- /dev/null +++ b/Lang/Nim/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Nim \ No newline at end of file diff --git a/Lang/Nim/Generator-Exponential b/Lang/Nim/Generator-Exponential new file mode 120000 index 0000000000..3f94a91d7c --- /dev/null +++ b/Lang/Nim/Generator-Exponential @@ -0,0 +1 @@ +../../Task/Generator-Exponential/Nim \ No newline at end of file diff --git a/Lang/Nim/Generic-swap b/Lang/Nim/Generic-swap new file mode 120000 index 0000000000..6e5c96cec2 --- /dev/null +++ b/Lang/Nim/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/Nim \ No newline at end of file diff --git a/Lang/Nim/Globally-replace-text-in-several-files b/Lang/Nim/Globally-replace-text-in-several-files new file mode 120000 index 0000000000..bd8dbf9096 --- /dev/null +++ b/Lang/Nim/Globally-replace-text-in-several-files @@ -0,0 +1 @@ +../../Task/Globally-replace-text-in-several-files/Nim \ No newline at end of file diff --git a/Lang/Nim/Gray-code b/Lang/Nim/Gray-code new file mode 120000 index 0000000000..6817e1c81c --- /dev/null +++ b/Lang/Nim/Gray-code @@ -0,0 +1 @@ +../../Task/Gray-code/Nim \ No newline at end of file diff --git a/Lang/Nim/Greatest-common-divisor b/Lang/Nim/Greatest-common-divisor new file mode 120000 index 0000000000..23d56bb942 --- /dev/null +++ b/Lang/Nim/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Nim \ No newline at end of file diff --git a/Lang/Nim/Greatest-element-of-a-list b/Lang/Nim/Greatest-element-of-a-list new file mode 120000 index 0000000000..f8f317a475 --- /dev/null +++ b/Lang/Nim/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Nim \ No newline at end of file diff --git a/Lang/Nim/Greatest-subsequential-sum b/Lang/Nim/Greatest-subsequential-sum new file mode 120000 index 0000000000..6fe3c7228d --- /dev/null +++ b/Lang/Nim/Greatest-subsequential-sum @@ -0,0 +1 @@ +../../Task/Greatest-subsequential-sum/Nim \ No newline at end of file diff --git a/Lang/Nim/Guess-the-number b/Lang/Nim/Guess-the-number new file mode 120000 index 0000000000..1022d27afb --- /dev/null +++ b/Lang/Nim/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/Nim \ No newline at end of file diff --git a/Lang/Nim/Guess-the-number-With-feedback b/Lang/Nim/Guess-the-number-With-feedback new file mode 120000 index 0000000000..b143a50d54 --- /dev/null +++ b/Lang/Nim/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/Nim \ No newline at end of file diff --git a/Lang/Nim/Guess-the-number-With-feedback--player- b/Lang/Nim/Guess-the-number-With-feedback--player- new file mode 120000 index 0000000000..6edf554417 --- /dev/null +++ b/Lang/Nim/Guess-the-number-With-feedback--player- @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback--player-/Nim \ No newline at end of file diff --git a/Lang/Nim/HTTP b/Lang/Nim/HTTP new file mode 120000 index 0000000000..5c6c018486 --- /dev/null +++ b/Lang/Nim/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/Nim \ No newline at end of file diff --git a/Lang/Nim/HTTPS b/Lang/Nim/HTTPS new file mode 120000 index 0000000000..d20786fd59 --- /dev/null +++ b/Lang/Nim/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/Nim \ No newline at end of file diff --git a/Lang/Nim/Hailstone-sequence b/Lang/Nim/Hailstone-sequence new file mode 120000 index 0000000000..1c086f2acf --- /dev/null +++ b/Lang/Nim/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Nim \ No newline at end of file diff --git a/Lang/Nim/Hamming-numbers b/Lang/Nim/Hamming-numbers new file mode 120000 index 0000000000..7bbdbfdc95 --- /dev/null +++ b/Lang/Nim/Hamming-numbers @@ -0,0 +1 @@ +../../Task/Hamming-numbers/Nim \ No newline at end of file diff --git a/Lang/Nim/Handle-a-signal b/Lang/Nim/Handle-a-signal new file mode 120000 index 0000000000..940d21d786 --- /dev/null +++ b/Lang/Nim/Handle-a-signal @@ -0,0 +1 @@ +../../Task/Handle-a-signal/Nim \ No newline at end of file diff --git a/Lang/Nim/Happy-numbers b/Lang/Nim/Happy-numbers new file mode 120000 index 0000000000..7367896ff8 --- /dev/null +++ b/Lang/Nim/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/Nim \ No newline at end of file diff --git a/Lang/Nim/Harshad-or-Niven-series b/Lang/Nim/Harshad-or-Niven-series new file mode 120000 index 0000000000..ba0533976b --- /dev/null +++ b/Lang/Nim/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/Nim \ No newline at end of file diff --git a/Lang/Nim/Hash-from-two-arrays b/Lang/Nim/Hash-from-two-arrays new file mode 120000 index 0000000000..aea370065d --- /dev/null +++ b/Lang/Nim/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/Nim \ No newline at end of file diff --git a/Lang/Nim/Haversine-formula b/Lang/Nim/Haversine-formula new file mode 120000 index 0000000000..95205af996 --- /dev/null +++ b/Lang/Nim/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/Nim \ No newline at end of file diff --git a/Lang/Nim/Hello-world-Graphical b/Lang/Nim/Hello-world-Graphical new file mode 120000 index 0000000000..c07ee2154f --- /dev/null +++ b/Lang/Nim/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Nim \ No newline at end of file diff --git a/Lang/Nim/Hello-world-Line-printer b/Lang/Nim/Hello-world-Line-printer new file mode 120000 index 0000000000..6c4b7cbbf9 --- /dev/null +++ b/Lang/Nim/Hello-world-Line-printer @@ -0,0 +1 @@ +../../Task/Hello-world-Line-printer/Nim \ No newline at end of file diff --git a/Lang/Nim/Hello-world-Newline-omission b/Lang/Nim/Hello-world-Newline-omission new file mode 120000 index 0000000000..8fd45605cf --- /dev/null +++ b/Lang/Nim/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Nim \ No newline at end of file diff --git a/Lang/Nim/Hello-world-Standard-error b/Lang/Nim/Hello-world-Standard-error new file mode 120000 index 0000000000..d5d4d43c3b --- /dev/null +++ b/Lang/Nim/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Nim \ No newline at end of file diff --git a/Lang/Nim/Hello-world-Text b/Lang/Nim/Hello-world-Text new file mode 120000 index 0000000000..24e19fe20a --- /dev/null +++ b/Lang/Nim/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Nim \ No newline at end of file diff --git a/Lang/Nim/Hello-world-Web-server b/Lang/Nim/Hello-world-Web-server new file mode 120000 index 0000000000..7e6a066afd --- /dev/null +++ b/Lang/Nim/Hello-world-Web-server @@ -0,0 +1 @@ +../../Task/Hello-world-Web-server/Nim \ No newline at end of file diff --git a/Lang/Nim/Here-document b/Lang/Nim/Here-document new file mode 120000 index 0000000000..ae79a3ad97 --- /dev/null +++ b/Lang/Nim/Here-document @@ -0,0 +1 @@ +../../Task/Here-document/Nim \ No newline at end of file diff --git a/Lang/Nim/Heronian-triangles b/Lang/Nim/Heronian-triangles new file mode 120000 index 0000000000..07465de1ea --- /dev/null +++ b/Lang/Nim/Heronian-triangles @@ -0,0 +1 @@ +../../Task/Heronian-triangles/Nim \ No newline at end of file diff --git a/Lang/Nim/Higher-order-functions b/Lang/Nim/Higher-order-functions new file mode 120000 index 0000000000..aba1e4467e --- /dev/null +++ b/Lang/Nim/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/Nim \ No newline at end of file diff --git a/Lang/Nim/Hofstadter-Conway-$10,000-sequence b/Lang/Nim/Hofstadter-Conway-$10,000-sequence new file mode 120000 index 0000000000..a7b5d5d8b4 --- /dev/null +++ b/Lang/Nim/Hofstadter-Conway-$10,000-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Conway-$10,000-sequence/Nim \ No newline at end of file diff --git a/Lang/Nim/Hofstadter-Figure-Figure-sequences b/Lang/Nim/Hofstadter-Figure-Figure-sequences new file mode 120000 index 0000000000..e1250fc127 --- /dev/null +++ b/Lang/Nim/Hofstadter-Figure-Figure-sequences @@ -0,0 +1 @@ +../../Task/Hofstadter-Figure-Figure-sequences/Nim \ No newline at end of file diff --git a/Lang/Nim/Hofstadter-Q-sequence b/Lang/Nim/Hofstadter-Q-sequence new file mode 120000 index 0000000000..7212b6f415 --- /dev/null +++ b/Lang/Nim/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/Nim \ No newline at end of file diff --git a/Lang/Nim/Horizontal-sundial-calculations b/Lang/Nim/Horizontal-sundial-calculations new file mode 120000 index 0000000000..57c62d829d --- /dev/null +++ b/Lang/Nim/Horizontal-sundial-calculations @@ -0,0 +1 @@ +../../Task/Horizontal-sundial-calculations/Nim \ No newline at end of file diff --git a/Lang/Nim/Horners-rule-for-polynomial-evaluation b/Lang/Nim/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..5a538212f0 --- /dev/null +++ b/Lang/Nim/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/Nim \ No newline at end of file diff --git a/Lang/Nim/Host-introspection b/Lang/Nim/Host-introspection new file mode 120000 index 0000000000..df088bf8a6 --- /dev/null +++ b/Lang/Nim/Host-introspection @@ -0,0 +1 @@ +../../Task/Host-introspection/Nim \ No newline at end of file diff --git a/Lang/Nim/Hostname b/Lang/Nim/Hostname new file mode 120000 index 0000000000..6ea5d62b86 --- /dev/null +++ b/Lang/Nim/Hostname @@ -0,0 +1 @@ +../../Task/Hostname/Nim \ No newline at end of file diff --git a/Lang/Nim/Huffman-coding b/Lang/Nim/Huffman-coding new file mode 120000 index 0000000000..2d17340199 --- /dev/null +++ b/Lang/Nim/Huffman-coding @@ -0,0 +1 @@ +../../Task/Huffman-coding/Nim \ No newline at end of file diff --git a/Lang/Nim/IBAN b/Lang/Nim/IBAN new file mode 120000 index 0000000000..6d46e629ee --- /dev/null +++ b/Lang/Nim/IBAN @@ -0,0 +1 @@ +../../Task/IBAN/Nim \ No newline at end of file diff --git a/Lang/Nim/Identity-matrix b/Lang/Nim/Identity-matrix new file mode 120000 index 0000000000..9fff697dc5 --- /dev/null +++ b/Lang/Nim/Identity-matrix @@ -0,0 +1 @@ +../../Task/Identity-matrix/Nim \ No newline at end of file diff --git a/Lang/Nim/Include-a-file b/Lang/Nim/Include-a-file new file mode 120000 index 0000000000..996b51f8b0 --- /dev/null +++ b/Lang/Nim/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/Nim \ No newline at end of file diff --git a/Lang/Nim/Increment-a-numerical-string b/Lang/Nim/Increment-a-numerical-string new file mode 120000 index 0000000000..4437c5b575 --- /dev/null +++ b/Lang/Nim/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Nim \ No newline at end of file diff --git a/Lang/Nim/Infinity b/Lang/Nim/Infinity new file mode 120000 index 0000000000..6c38c16416 --- /dev/null +++ b/Lang/Nim/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/Nim \ No newline at end of file diff --git a/Lang/Nim/Inheritance-Single b/Lang/Nim/Inheritance-Single new file mode 120000 index 0000000000..9165fd5120 --- /dev/null +++ b/Lang/Nim/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/Nim \ No newline at end of file diff --git a/Lang/Nim/Input-loop b/Lang/Nim/Input-loop new file mode 120000 index 0000000000..74ed91cd33 --- /dev/null +++ b/Lang/Nim/Input-loop @@ -0,0 +1 @@ +../../Task/Input-loop/Nim \ No newline at end of file diff --git a/Lang/Nim/Integer-comparison b/Lang/Nim/Integer-comparison new file mode 120000 index 0000000000..0bafb0c763 --- /dev/null +++ b/Lang/Nim/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Nim \ No newline at end of file diff --git a/Lang/Nim/Integer-sequence b/Lang/Nim/Integer-sequence new file mode 120000 index 0000000000..8ed5622cea --- /dev/null +++ b/Lang/Nim/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Nim \ No newline at end of file diff --git a/Lang/Nim/Introspection b/Lang/Nim/Introspection new file mode 120000 index 0000000000..5f27897b15 --- /dev/null +++ b/Lang/Nim/Introspection @@ -0,0 +1 @@ +../../Task/Introspection/Nim \ No newline at end of file diff --git a/Lang/Nim/JSON b/Lang/Nim/JSON new file mode 120000 index 0000000000..d8b450c45f --- /dev/null +++ b/Lang/Nim/JSON @@ -0,0 +1 @@ +../../Task/JSON/Nim \ No newline at end of file diff --git a/Lang/Nim/Jensens-Device b/Lang/Nim/Jensens-Device new file mode 120000 index 0000000000..0fc9ee7d74 --- /dev/null +++ b/Lang/Nim/Jensens-Device @@ -0,0 +1 @@ +../../Task/Jensens-Device/Nim \ No newline at end of file diff --git a/Lang/Nim/Josephus-problem b/Lang/Nim/Josephus-problem new file mode 120000 index 0000000000..a37be15194 --- /dev/null +++ b/Lang/Nim/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/Nim \ No newline at end of file diff --git a/Lang/Nim/Jump-anywhere b/Lang/Nim/Jump-anywhere new file mode 120000 index 0000000000..fd273e6031 --- /dev/null +++ b/Lang/Nim/Jump-anywhere @@ -0,0 +1 @@ +../../Task/Jump-anywhere/Nim \ No newline at end of file diff --git a/Lang/Nim/Kaprekar-numbers b/Lang/Nim/Kaprekar-numbers new file mode 120000 index 0000000000..5659c21275 --- /dev/null +++ b/Lang/Nim/Kaprekar-numbers @@ -0,0 +1 @@ +../../Task/Kaprekar-numbers/Nim \ No newline at end of file diff --git a/Lang/Nim/Keyboard-input-Flush-the-keyboard-buffer b/Lang/Nim/Keyboard-input-Flush-the-keyboard-buffer new file mode 120000 index 0000000000..c5a3e8416c --- /dev/null +++ b/Lang/Nim/Keyboard-input-Flush-the-keyboard-buffer @@ -0,0 +1 @@ +../../Task/Keyboard-input-Flush-the-keyboard-buffer/Nim \ No newline at end of file diff --git a/Lang/Nim/Knuth-shuffle b/Lang/Nim/Knuth-shuffle new file mode 120000 index 0000000000..2562d00b42 --- /dev/null +++ b/Lang/Nim/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Nim \ No newline at end of file diff --git a/Lang/Nim/LZW-compression b/Lang/Nim/LZW-compression new file mode 120000 index 0000000000..76fedfa7eb --- /dev/null +++ b/Lang/Nim/LZW-compression @@ -0,0 +1 @@ +../../Task/LZW-compression/Nim \ No newline at end of file diff --git a/Lang/Nim/Langtons-ant b/Lang/Nim/Langtons-ant new file mode 120000 index 0000000000..2f4275704b --- /dev/null +++ b/Lang/Nim/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/Nim \ No newline at end of file diff --git a/Lang/Nim/Largest-int-from-concatenated-ints b/Lang/Nim/Largest-int-from-concatenated-ints new file mode 120000 index 0000000000..54b56e5652 --- /dev/null +++ b/Lang/Nim/Largest-int-from-concatenated-ints @@ -0,0 +1 @@ +../../Task/Largest-int-from-concatenated-ints/Nim \ No newline at end of file diff --git a/Lang/Nim/Last-Friday-of-each-month b/Lang/Nim/Last-Friday-of-each-month new file mode 120000 index 0000000000..ea09c5a1ad --- /dev/null +++ b/Lang/Nim/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/Nim \ No newline at end of file diff --git a/Lang/Nim/Leap-year b/Lang/Nim/Leap-year new file mode 120000 index 0000000000..4e41965fd6 --- /dev/null +++ b/Lang/Nim/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Nim \ No newline at end of file diff --git a/Lang/Nim/Least-common-multiple b/Lang/Nim/Least-common-multiple new file mode 120000 index 0000000000..fffbf628db --- /dev/null +++ b/Lang/Nim/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/Nim \ No newline at end of file diff --git a/Lang/Nim/Left-factorials b/Lang/Nim/Left-factorials new file mode 120000 index 0000000000..af98c6cdc9 --- /dev/null +++ b/Lang/Nim/Left-factorials @@ -0,0 +1 @@ +../../Task/Left-factorials/Nim \ No newline at end of file diff --git a/Lang/Nim/Letter-frequency b/Lang/Nim/Letter-frequency new file mode 120000 index 0000000000..4f81c6173d --- /dev/null +++ b/Lang/Nim/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/Nim \ No newline at end of file diff --git a/Lang/Nim/Levenshtein-distance b/Lang/Nim/Levenshtein-distance new file mode 120000 index 0000000000..e52ab67908 --- /dev/null +++ b/Lang/Nim/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Nim \ No newline at end of file diff --git a/Lang/Nim/Linear-congruential-generator b/Lang/Nim/Linear-congruential-generator new file mode 120000 index 0000000000..54c8fb1b70 --- /dev/null +++ b/Lang/Nim/Linear-congruential-generator @@ -0,0 +1 @@ +../../Task/Linear-congruential-generator/Nim \ No newline at end of file diff --git a/Lang/Nim/List-comprehensions b/Lang/Nim/List-comprehensions new file mode 120000 index 0000000000..eaff5384dc --- /dev/null +++ b/Lang/Nim/List-comprehensions @@ -0,0 +1 @@ +../../Task/List-comprehensions/Nim \ No newline at end of file diff --git a/Lang/Nim/Literals-Floating-point b/Lang/Nim/Literals-Floating-point new file mode 120000 index 0000000000..e5df2d7b9e --- /dev/null +++ b/Lang/Nim/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/Nim \ No newline at end of file diff --git a/Lang/Nim/Literals-Integer b/Lang/Nim/Literals-Integer new file mode 120000 index 0000000000..5e5691254a --- /dev/null +++ b/Lang/Nim/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/Nim \ No newline at end of file diff --git a/Lang/Nim/Literals-String b/Lang/Nim/Literals-String new file mode 120000 index 0000000000..586d73096f --- /dev/null +++ b/Lang/Nim/Literals-String @@ -0,0 +1 @@ +../../Task/Literals-String/Nim \ No newline at end of file diff --git a/Lang/Nim/Logical-operations b/Lang/Nim/Logical-operations new file mode 120000 index 0000000000..80a96cd46c --- /dev/null +++ b/Lang/Nim/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Nim \ No newline at end of file diff --git a/Lang/Nim/Long-multiplication b/Lang/Nim/Long-multiplication new file mode 120000 index 0000000000..348f203898 --- /dev/null +++ b/Lang/Nim/Long-multiplication @@ -0,0 +1 @@ +../../Task/Long-multiplication/Nim \ No newline at end of file diff --git a/Lang/Nim/Longest-common-subsequence b/Lang/Nim/Longest-common-subsequence new file mode 120000 index 0000000000..905ec14704 --- /dev/null +++ b/Lang/Nim/Longest-common-subsequence @@ -0,0 +1 @@ +../../Task/Longest-common-subsequence/Nim \ No newline at end of file diff --git a/Lang/Nim/Loop-over-multiple-arrays-simultaneously b/Lang/Nim/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..5eab66a250 --- /dev/null +++ b/Lang/Nim/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Nim \ No newline at end of file diff --git a/Lang/Nim/Loops-Break b/Lang/Nim/Loops-Break new file mode 120000 index 0000000000..98a744b761 --- /dev/null +++ b/Lang/Nim/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Nim \ No newline at end of file diff --git a/Lang/Nim/Loops-Continue b/Lang/Nim/Loops-Continue new file mode 120000 index 0000000000..35e9d16804 --- /dev/null +++ b/Lang/Nim/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Nim \ No newline at end of file diff --git a/Lang/Nim/Loops-Do-while b/Lang/Nim/Loops-Do-while new file mode 120000 index 0000000000..b8c1caa8f6 --- /dev/null +++ b/Lang/Nim/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Nim \ No newline at end of file diff --git a/Lang/Nim/Loops-Downward-for b/Lang/Nim/Loops-Downward-for new file mode 120000 index 0000000000..831418c68a --- /dev/null +++ b/Lang/Nim/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Nim \ No newline at end of file diff --git a/Lang/Nim/Loops-For b/Lang/Nim/Loops-For new file mode 120000 index 0000000000..1fd1d39d90 --- /dev/null +++ b/Lang/Nim/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Nim \ No newline at end of file diff --git a/Lang/Nim/Loops-For-with-a-specified-step b/Lang/Nim/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..e23e8ed269 --- /dev/null +++ b/Lang/Nim/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Nim \ No newline at end of file diff --git a/Lang/Nim/Loops-Foreach b/Lang/Nim/Loops-Foreach new file mode 120000 index 0000000000..e401520397 --- /dev/null +++ b/Lang/Nim/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Nim \ No newline at end of file diff --git a/Lang/Nim/Loops-Infinite b/Lang/Nim/Loops-Infinite new file mode 120000 index 0000000000..ab42596e5d --- /dev/null +++ b/Lang/Nim/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Nim \ No newline at end of file diff --git a/Lang/Nim/Loops-N-plus-one-half b/Lang/Nim/Loops-N-plus-one-half new file mode 120000 index 0000000000..85a31f327a --- /dev/null +++ b/Lang/Nim/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Nim \ No newline at end of file diff --git a/Lang/Nim/Loops-Nested b/Lang/Nim/Loops-Nested new file mode 120000 index 0000000000..7c6a4c0ffe --- /dev/null +++ b/Lang/Nim/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/Nim \ No newline at end of file diff --git a/Lang/Nim/Loops-While b/Lang/Nim/Loops-While new file mode 120000 index 0000000000..2ca371d913 --- /dev/null +++ b/Lang/Nim/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Nim \ No newline at end of file diff --git a/Lang/Nim/Lucas-Lehmer-test b/Lang/Nim/Lucas-Lehmer-test new file mode 120000 index 0000000000..6c6d2b137c --- /dev/null +++ b/Lang/Nim/Lucas-Lehmer-test @@ -0,0 +1 @@ +../../Task/Lucas-Lehmer-test/Nim \ No newline at end of file diff --git a/Lang/Nim/Luhn-test-of-credit-card-numbers b/Lang/Nim/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..e4910c71cb --- /dev/null +++ b/Lang/Nim/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Nim \ No newline at end of file diff --git a/Lang/Nim/MD4 b/Lang/Nim/MD4 new file mode 120000 index 0000000000..f6d2099ebc --- /dev/null +++ b/Lang/Nim/MD4 @@ -0,0 +1 @@ +../../Task/MD4/Nim \ No newline at end of file diff --git a/Lang/Nim/MD5 b/Lang/Nim/MD5 new file mode 120000 index 0000000000..a96d3236a1 --- /dev/null +++ b/Lang/Nim/MD5 @@ -0,0 +1 @@ +../../Task/MD5/Nim \ No newline at end of file diff --git a/Lang/Nim/Machine-code b/Lang/Nim/Machine-code new file mode 120000 index 0000000000..f7807f45a8 --- /dev/null +++ b/Lang/Nim/Machine-code @@ -0,0 +1 @@ +../../Task/Machine-code/Nim \ No newline at end of file diff --git a/Lang/Nim/Mad-Libs b/Lang/Nim/Mad-Libs new file mode 120000 index 0000000000..9570f4bd92 --- /dev/null +++ b/Lang/Nim/Mad-Libs @@ -0,0 +1 @@ +../../Task/Mad-Libs/Nim \ No newline at end of file diff --git a/Lang/Nim/Magic-squares-of-odd-order b/Lang/Nim/Magic-squares-of-odd-order new file mode 120000 index 0000000000..0590a29c87 --- /dev/null +++ b/Lang/Nim/Magic-squares-of-odd-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-odd-order/Nim \ No newline at end of file diff --git a/Lang/Nim/Main-step-of-GOST-28147-89 b/Lang/Nim/Main-step-of-GOST-28147-89 new file mode 120000 index 0000000000..b922d89bf9 --- /dev/null +++ b/Lang/Nim/Main-step-of-GOST-28147-89 @@ -0,0 +1 @@ +../../Task/Main-step-of-GOST-28147-89/Nim \ No newline at end of file diff --git a/Lang/Nim/Man-or-boy-test b/Lang/Nim/Man-or-boy-test new file mode 120000 index 0000000000..c34b85c917 --- /dev/null +++ b/Lang/Nim/Man-or-boy-test @@ -0,0 +1 @@ +../../Task/Man-or-boy-test/Nim \ No newline at end of file diff --git a/Lang/Nim/Mandelbrot-set b/Lang/Nim/Mandelbrot-set new file mode 120000 index 0000000000..820e1d3af5 --- /dev/null +++ b/Lang/Nim/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/Nim \ No newline at end of file diff --git a/Lang/Nim/Map-range b/Lang/Nim/Map-range new file mode 120000 index 0000000000..cb0f123841 --- /dev/null +++ b/Lang/Nim/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/Nim \ No newline at end of file diff --git a/Lang/Nim/Matrix-arithmetic b/Lang/Nim/Matrix-arithmetic new file mode 120000 index 0000000000..54a53c91f8 --- /dev/null +++ b/Lang/Nim/Matrix-arithmetic @@ -0,0 +1 @@ +../../Task/Matrix-arithmetic/Nim \ No newline at end of file diff --git a/Lang/Nim/Matrix-multiplication b/Lang/Nim/Matrix-multiplication new file mode 120000 index 0000000000..fcc5dcb5b9 --- /dev/null +++ b/Lang/Nim/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/Nim \ No newline at end of file diff --git a/Lang/Nim/Matrix-transposition b/Lang/Nim/Matrix-transposition new file mode 120000 index 0000000000..603a843d17 --- /dev/null +++ b/Lang/Nim/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/Nim \ No newline at end of file diff --git a/Lang/Nim/Maximum-triangle-path-sum b/Lang/Nim/Maximum-triangle-path-sum new file mode 120000 index 0000000000..5df51ff805 --- /dev/null +++ b/Lang/Nim/Maximum-triangle-path-sum @@ -0,0 +1 @@ +../../Task/Maximum-triangle-path-sum/Nim \ No newline at end of file diff --git a/Lang/Nim/Maze-generation b/Lang/Nim/Maze-generation new file mode 120000 index 0000000000..72ab0b65d0 --- /dev/null +++ b/Lang/Nim/Maze-generation @@ -0,0 +1 @@ +../../Task/Maze-generation/Nim \ No newline at end of file diff --git a/Lang/Nim/Memory-allocation b/Lang/Nim/Memory-allocation new file mode 120000 index 0000000000..7507f72853 --- /dev/null +++ b/Lang/Nim/Memory-allocation @@ -0,0 +1 @@ +../../Task/Memory-allocation/Nim \ No newline at end of file diff --git a/Lang/Nim/Memory-layout-of-a-data-structure b/Lang/Nim/Memory-layout-of-a-data-structure new file mode 120000 index 0000000000..e1a72e34c9 --- /dev/null +++ b/Lang/Nim/Memory-layout-of-a-data-structure @@ -0,0 +1 @@ +../../Task/Memory-layout-of-a-data-structure/Nim \ No newline at end of file diff --git a/Lang/Nim/Menu b/Lang/Nim/Menu new file mode 120000 index 0000000000..612eff67fd --- /dev/null +++ b/Lang/Nim/Menu @@ -0,0 +1 @@ +../../Task/Menu/Nim \ No newline at end of file diff --git a/Lang/Nim/Metaprogramming b/Lang/Nim/Metaprogramming new file mode 120000 index 0000000000..213770e06a --- /dev/null +++ b/Lang/Nim/Metaprogramming @@ -0,0 +1 @@ +../../Task/Metaprogramming/Nim \ No newline at end of file diff --git a/Lang/Nim/Middle-three-digits b/Lang/Nim/Middle-three-digits new file mode 120000 index 0000000000..cda7646071 --- /dev/null +++ b/Lang/Nim/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/Nim \ No newline at end of file diff --git a/Lang/Nim/Modular-exponentiation b/Lang/Nim/Modular-exponentiation new file mode 120000 index 0000000000..581ee9eba2 --- /dev/null +++ b/Lang/Nim/Modular-exponentiation @@ -0,0 +1 @@ +../../Task/Modular-exponentiation/Nim \ No newline at end of file diff --git a/Lang/Nim/Modular-inverse b/Lang/Nim/Modular-inverse new file mode 120000 index 0000000000..dd4a2f3c5f --- /dev/null +++ b/Lang/Nim/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/Nim \ No newline at end of file diff --git a/Lang/Nim/Monte-Carlo-methods b/Lang/Nim/Monte-Carlo-methods new file mode 120000 index 0000000000..ccefcc7ee0 --- /dev/null +++ b/Lang/Nim/Monte-Carlo-methods @@ -0,0 +1 @@ +../../Task/Monte-Carlo-methods/Nim \ No newline at end of file diff --git a/Lang/Nim/Monty-Hall-problem b/Lang/Nim/Monty-Hall-problem new file mode 120000 index 0000000000..2f2db49b25 --- /dev/null +++ b/Lang/Nim/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/Nim \ No newline at end of file diff --git a/Lang/Nim/Multifactorial b/Lang/Nim/Multifactorial new file mode 120000 index 0000000000..4b162280e3 --- /dev/null +++ b/Lang/Nim/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/Nim \ No newline at end of file diff --git a/Lang/Nim/Multiple-distinct-objects b/Lang/Nim/Multiple-distinct-objects new file mode 120000 index 0000000000..0a78ea84d1 --- /dev/null +++ b/Lang/Nim/Multiple-distinct-objects @@ -0,0 +1 @@ +../../Task/Multiple-distinct-objects/Nim \ No newline at end of file diff --git a/Lang/Nim/Multiplication-tables b/Lang/Nim/Multiplication-tables new file mode 120000 index 0000000000..91d57f5e16 --- /dev/null +++ b/Lang/Nim/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/Nim \ No newline at end of file diff --git a/Lang/Nim/Multisplit b/Lang/Nim/Multisplit new file mode 120000 index 0000000000..51ca6c0f30 --- /dev/null +++ b/Lang/Nim/Multisplit @@ -0,0 +1 @@ +../../Task/Multisplit/Nim \ No newline at end of file diff --git a/Lang/Nim/Mutual-recursion b/Lang/Nim/Mutual-recursion new file mode 120000 index 0000000000..54aa65ee65 --- /dev/null +++ b/Lang/Nim/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/Nim \ No newline at end of file diff --git a/Lang/Nim/N-queens-problem b/Lang/Nim/N-queens-problem new file mode 120000 index 0000000000..cc5e69fbfa --- /dev/null +++ b/Lang/Nim/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/Nim \ No newline at end of file diff --git a/Lang/Nim/Named-parameters b/Lang/Nim/Named-parameters new file mode 120000 index 0000000000..c111a94a70 --- /dev/null +++ b/Lang/Nim/Named-parameters @@ -0,0 +1 @@ +../../Task/Named-parameters/Nim \ No newline at end of file diff --git a/Lang/Nim/Non-continuous-subsequences b/Lang/Nim/Non-continuous-subsequences new file mode 120000 index 0000000000..7ce4d2599b --- /dev/null +++ b/Lang/Nim/Non-continuous-subsequences @@ -0,0 +1 @@ +../../Task/Non-continuous-subsequences/Nim \ No newline at end of file diff --git a/Lang/Nim/Non-decimal-radices-Convert b/Lang/Nim/Non-decimal-radices-Convert new file mode 120000 index 0000000000..068156ac14 --- /dev/null +++ b/Lang/Nim/Non-decimal-radices-Convert @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Convert/Nim \ No newline at end of file diff --git a/Lang/Nim/Non-decimal-radices-Input b/Lang/Nim/Non-decimal-radices-Input new file mode 120000 index 0000000000..681be6f66c --- /dev/null +++ b/Lang/Nim/Non-decimal-radices-Input @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Input/Nim \ No newline at end of file diff --git a/Lang/Nim/Non-decimal-radices-Output b/Lang/Nim/Non-decimal-radices-Output new file mode 120000 index 0000000000..9b4ac82346 --- /dev/null +++ b/Lang/Nim/Non-decimal-radices-Output @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Output/Nim \ No newline at end of file diff --git a/Lang/Nim/Nth b/Lang/Nim/Nth new file mode 120000 index 0000000000..96b4cd94ab --- /dev/null +++ b/Lang/Nim/Nth @@ -0,0 +1 @@ +../../Task/Nth/Nim \ No newline at end of file diff --git a/Lang/Nim/Nth-root b/Lang/Nim/Nth-root new file mode 120000 index 0000000000..b6246a7566 --- /dev/null +++ b/Lang/Nim/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/Nim \ No newline at end of file diff --git a/Lang/Nim/Null-object b/Lang/Nim/Null-object new file mode 120000 index 0000000000..3d9bae61fb --- /dev/null +++ b/Lang/Nim/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/Nim \ No newline at end of file diff --git a/Lang/Nim/Number-names b/Lang/Nim/Number-names new file mode 120000 index 0000000000..551a0086cf --- /dev/null +++ b/Lang/Nim/Number-names @@ -0,0 +1 @@ +../../Task/Number-names/Nim \ No newline at end of file diff --git a/Lang/Nim/Number-reversal-game b/Lang/Nim/Number-reversal-game new file mode 120000 index 0000000000..ff65fb0d56 --- /dev/null +++ b/Lang/Nim/Number-reversal-game @@ -0,0 +1 @@ +../../Task/Number-reversal-game/Nim \ No newline at end of file diff --git a/Lang/Nim/Numerical-integration b/Lang/Nim/Numerical-integration new file mode 120000 index 0000000000..fb6453b4d3 --- /dev/null +++ b/Lang/Nim/Numerical-integration @@ -0,0 +1 @@ +../../Task/Numerical-integration/Nim \ No newline at end of file diff --git a/Lang/Nim/Odd-word-problem b/Lang/Nim/Odd-word-problem new file mode 120000 index 0000000000..51af794bfb --- /dev/null +++ b/Lang/Nim/Odd-word-problem @@ -0,0 +1 @@ +../../Task/Odd-word-problem/Nim \ No newline at end of file diff --git a/Lang/Nim/Old-lady-swallowed-a-fly b/Lang/Nim/Old-lady-swallowed-a-fly new file mode 120000 index 0000000000..692c4b360d --- /dev/null +++ b/Lang/Nim/Old-lady-swallowed-a-fly @@ -0,0 +1 @@ +../../Task/Old-lady-swallowed-a-fly/Nim \ No newline at end of file diff --git a/Lang/Nim/One-dimensional-cellular-automata b/Lang/Nim/One-dimensional-cellular-automata new file mode 120000 index 0000000000..4f82779151 --- /dev/null +++ b/Lang/Nim/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/Nim \ No newline at end of file diff --git a/Lang/Nim/One-of-n-lines-in-a-file b/Lang/Nim/One-of-n-lines-in-a-file new file mode 120000 index 0000000000..8f8701bd3e --- /dev/null +++ b/Lang/Nim/One-of-n-lines-in-a-file @@ -0,0 +1 @@ +../../Task/One-of-n-lines-in-a-file/Nim \ No newline at end of file diff --git a/Lang/Nim/OpenGL b/Lang/Nim/OpenGL new file mode 120000 index 0000000000..2b9edc022d --- /dev/null +++ b/Lang/Nim/OpenGL @@ -0,0 +1 @@ +../../Task/OpenGL/Nim \ No newline at end of file diff --git a/Lang/Nim/Optional-parameters b/Lang/Nim/Optional-parameters new file mode 120000 index 0000000000..4bd19e03bc --- /dev/null +++ b/Lang/Nim/Optional-parameters @@ -0,0 +1 @@ +../../Task/Optional-parameters/Nim \ No newline at end of file diff --git a/Lang/Nim/Order-two-numerical-lists b/Lang/Nim/Order-two-numerical-lists new file mode 120000 index 0000000000..fd24a5aa45 --- /dev/null +++ b/Lang/Nim/Order-two-numerical-lists @@ -0,0 +1 @@ +../../Task/Order-two-numerical-lists/Nim \ No newline at end of file diff --git a/Lang/Nim/Ordered-words b/Lang/Nim/Ordered-words new file mode 120000 index 0000000000..40a3fcbb0b --- /dev/null +++ b/Lang/Nim/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Nim \ No newline at end of file diff --git a/Lang/Nim/Palindrome-detection b/Lang/Nim/Palindrome-detection new file mode 120000 index 0000000000..4986bc4130 --- /dev/null +++ b/Lang/Nim/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Nim \ No newline at end of file diff --git a/Lang/Nim/Pangram-checker b/Lang/Nim/Pangram-checker new file mode 120000 index 0000000000..cea6713ded --- /dev/null +++ b/Lang/Nim/Pangram-checker @@ -0,0 +1 @@ +../../Task/Pangram-checker/Nim \ No newline at end of file diff --git a/Lang/Nim/Paraffins b/Lang/Nim/Paraffins new file mode 120000 index 0000000000..591478c3cd --- /dev/null +++ b/Lang/Nim/Paraffins @@ -0,0 +1 @@ +../../Task/Paraffins/Nim \ No newline at end of file diff --git a/Lang/Nim/Parametric-polymorphism b/Lang/Nim/Parametric-polymorphism new file mode 120000 index 0000000000..1954485233 --- /dev/null +++ b/Lang/Nim/Parametric-polymorphism @@ -0,0 +1 @@ +../../Task/Parametric-polymorphism/Nim \ No newline at end of file diff --git a/Lang/Nim/Parsing-RPN-calculator-algorithm b/Lang/Nim/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..8448d08d5c --- /dev/null +++ b/Lang/Nim/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/Nim \ No newline at end of file diff --git a/Lang/Nim/Parsing-RPN-to-infix-conversion b/Lang/Nim/Parsing-RPN-to-infix-conversion new file mode 120000 index 0000000000..0f968d22cc --- /dev/null +++ b/Lang/Nim/Parsing-RPN-to-infix-conversion @@ -0,0 +1 @@ +../../Task/Parsing-RPN-to-infix-conversion/Nim \ No newline at end of file diff --git a/Lang/Nim/Pascals-triangle b/Lang/Nim/Pascals-triangle new file mode 120000 index 0000000000..666f229270 --- /dev/null +++ b/Lang/Nim/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/Nim \ No newline at end of file diff --git a/Lang/Nim/Pascals-triangle-Puzzle b/Lang/Nim/Pascals-triangle-Puzzle new file mode 120000 index 0000000000..4d3957924d --- /dev/null +++ b/Lang/Nim/Pascals-triangle-Puzzle @@ -0,0 +1 @@ +../../Task/Pascals-triangle-Puzzle/Nim \ No newline at end of file diff --git a/Lang/Nim/Perfect-numbers b/Lang/Nim/Perfect-numbers new file mode 120000 index 0000000000..df36bc8f4a --- /dev/null +++ b/Lang/Nim/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/Nim \ No newline at end of file diff --git a/Lang/Nim/Permutations b/Lang/Nim/Permutations new file mode 120000 index 0000000000..570f0fc944 --- /dev/null +++ b/Lang/Nim/Permutations @@ -0,0 +1 @@ +../../Task/Permutations/Nim \ No newline at end of file diff --git a/Lang/Nim/Permutations-by-swapping b/Lang/Nim/Permutations-by-swapping new file mode 120000 index 0000000000..a16788c4d7 --- /dev/null +++ b/Lang/Nim/Permutations-by-swapping @@ -0,0 +1 @@ +../../Task/Permutations-by-swapping/Nim \ No newline at end of file diff --git a/Lang/Nim/Pernicious-numbers b/Lang/Nim/Pernicious-numbers new file mode 120000 index 0000000000..168a07fc6b --- /dev/null +++ b/Lang/Nim/Pernicious-numbers @@ -0,0 +1 @@ +../../Task/Pernicious-numbers/Nim \ No newline at end of file diff --git a/Lang/Nim/Pi b/Lang/Nim/Pi new file mode 120000 index 0000000000..73134692d3 --- /dev/null +++ b/Lang/Nim/Pi @@ -0,0 +1 @@ +../../Task/Pi/Nim \ No newline at end of file diff --git a/Lang/Nim/Pick-random-element b/Lang/Nim/Pick-random-element new file mode 120000 index 0000000000..9c24a90853 --- /dev/null +++ b/Lang/Nim/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/Nim \ No newline at end of file diff --git a/Lang/Nim/Playing-cards b/Lang/Nim/Playing-cards new file mode 120000 index 0000000000..2ae04f847c --- /dev/null +++ b/Lang/Nim/Playing-cards @@ -0,0 +1 @@ +../../Task/Playing-cards/Nim \ No newline at end of file diff --git a/Lang/Nim/Pointers-and-references b/Lang/Nim/Pointers-and-references new file mode 120000 index 0000000000..ed8b7b5d62 --- /dev/null +++ b/Lang/Nim/Pointers-and-references @@ -0,0 +1 @@ +../../Task/Pointers-and-references/Nim \ No newline at end of file diff --git a/Lang/Nim/Polymorphic-copy b/Lang/Nim/Polymorphic-copy new file mode 120000 index 0000000000..60daa6d402 --- /dev/null +++ b/Lang/Nim/Polymorphic-copy @@ -0,0 +1 @@ +../../Task/Polymorphic-copy/Nim \ No newline at end of file diff --git a/Lang/Nim/Polymorphism b/Lang/Nim/Polymorphism new file mode 120000 index 0000000000..f35e5a1e71 --- /dev/null +++ b/Lang/Nim/Polymorphism @@ -0,0 +1 @@ +../../Task/Polymorphism/Nim \ No newline at end of file diff --git a/Lang/Nim/Power-set b/Lang/Nim/Power-set new file mode 120000 index 0000000000..637f42c36d --- /dev/null +++ b/Lang/Nim/Power-set @@ -0,0 +1 @@ +../../Task/Power-set/Nim \ No newline at end of file diff --git a/Lang/Nim/Price-fraction b/Lang/Nim/Price-fraction new file mode 120000 index 0000000000..43bb66a221 --- /dev/null +++ b/Lang/Nim/Price-fraction @@ -0,0 +1 @@ +../../Task/Price-fraction/Nim \ No newline at end of file diff --git a/Lang/Nim/Primality-by-trial-division b/Lang/Nim/Primality-by-trial-division new file mode 120000 index 0000000000..aeb4f8b042 --- /dev/null +++ b/Lang/Nim/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/Nim \ No newline at end of file diff --git a/Lang/Nim/Prime-decomposition b/Lang/Nim/Prime-decomposition new file mode 120000 index 0000000000..c557b95eee --- /dev/null +++ b/Lang/Nim/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/Nim \ No newline at end of file diff --git a/Lang/Nim/Priority-queue b/Lang/Nim/Priority-queue new file mode 120000 index 0000000000..306f86bd07 --- /dev/null +++ b/Lang/Nim/Priority-queue @@ -0,0 +1 @@ +../../Task/Priority-queue/Nim \ No newline at end of file diff --git a/Lang/Nim/Probabilistic-choice b/Lang/Nim/Probabilistic-choice new file mode 120000 index 0000000000..7e780cb3f5 --- /dev/null +++ b/Lang/Nim/Probabilistic-choice @@ -0,0 +1 @@ +../../Task/Probabilistic-choice/Nim \ No newline at end of file diff --git a/Lang/Nim/Problem-of-Apollonius b/Lang/Nim/Problem-of-Apollonius new file mode 120000 index 0000000000..87567da6da --- /dev/null +++ b/Lang/Nim/Problem-of-Apollonius @@ -0,0 +1 @@ +../../Task/Problem-of-Apollonius/Nim \ No newline at end of file diff --git a/Lang/Nim/Program-name b/Lang/Nim/Program-name new file mode 120000 index 0000000000..55742ebae0 --- /dev/null +++ b/Lang/Nim/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/Nim \ No newline at end of file diff --git a/Lang/Nim/Program-termination b/Lang/Nim/Program-termination new file mode 120000 index 0000000000..8b32645e31 --- /dev/null +++ b/Lang/Nim/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/Nim \ No newline at end of file diff --git a/Lang/Nim/Pythagorean-triples b/Lang/Nim/Pythagorean-triples new file mode 120000 index 0000000000..eb8104c233 --- /dev/null +++ b/Lang/Nim/Pythagorean-triples @@ -0,0 +1 @@ +../../Task/Pythagorean-triples/Nim \ No newline at end of file diff --git a/Lang/Nim/Queue-Definition b/Lang/Nim/Queue-Definition new file mode 120000 index 0000000000..e3aad29b37 --- /dev/null +++ b/Lang/Nim/Queue-Definition @@ -0,0 +1 @@ +../../Task/Queue-Definition/Nim \ No newline at end of file diff --git a/Lang/Nim/Queue-Usage b/Lang/Nim/Queue-Usage new file mode 120000 index 0000000000..0540ad12d4 --- /dev/null +++ b/Lang/Nim/Queue-Usage @@ -0,0 +1 @@ +../../Task/Queue-Usage/Nim \ No newline at end of file diff --git a/Lang/Nim/Quickselect-algorithm b/Lang/Nim/Quickselect-algorithm new file mode 120000 index 0000000000..58612f8d39 --- /dev/null +++ b/Lang/Nim/Quickselect-algorithm @@ -0,0 +1 @@ +../../Task/Quickselect-algorithm/Nim \ No newline at end of file diff --git a/Lang/Nim/Quine b/Lang/Nim/Quine new file mode 120000 index 0000000000..9943dba2c2 --- /dev/null +++ b/Lang/Nim/Quine @@ -0,0 +1 @@ +../../Task/Quine/Nim \ No newline at end of file diff --git a/Lang/Nim/README b/Lang/Nim/README new file mode 100644 index 0000000000..bbe288d66f --- /dev/null +++ b/Lang/Nim/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Nim diff --git a/Lang/Nim/Random-number-generator--device- b/Lang/Nim/Random-number-generator--device- new file mode 120000 index 0000000000..511f7495c7 --- /dev/null +++ b/Lang/Nim/Random-number-generator--device- @@ -0,0 +1 @@ +../../Task/Random-number-generator--device-/Nim \ No newline at end of file diff --git a/Lang/Nim/Random-numbers b/Lang/Nim/Random-numbers new file mode 120000 index 0000000000..e111f23d78 --- /dev/null +++ b/Lang/Nim/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/Nim \ No newline at end of file diff --git a/Lang/Nim/Range-expansion b/Lang/Nim/Range-expansion new file mode 120000 index 0000000000..1d877f25dd --- /dev/null +++ b/Lang/Nim/Range-expansion @@ -0,0 +1 @@ +../../Task/Range-expansion/Nim \ No newline at end of file diff --git a/Lang/Nim/Range-extraction b/Lang/Nim/Range-extraction new file mode 120000 index 0000000000..3c6a57f056 --- /dev/null +++ b/Lang/Nim/Range-extraction @@ -0,0 +1 @@ +../../Task/Range-extraction/Nim \ No newline at end of file diff --git a/Lang/Nim/Read-a-file-line-by-line b/Lang/Nim/Read-a-file-line-by-line new file mode 120000 index 0000000000..672eda0dc4 --- /dev/null +++ b/Lang/Nim/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/Nim \ No newline at end of file diff --git a/Lang/Nim/Read-a-specific-line-from-a-file b/Lang/Nim/Read-a-specific-line-from-a-file new file mode 120000 index 0000000000..02d3278b84 --- /dev/null +++ b/Lang/Nim/Read-a-specific-line-from-a-file @@ -0,0 +1 @@ +../../Task/Read-a-specific-line-from-a-file/Nim \ No newline at end of file diff --git a/Lang/Nim/Read-entire-file b/Lang/Nim/Read-entire-file new file mode 120000 index 0000000000..a95b6eb715 --- /dev/null +++ b/Lang/Nim/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Nim \ No newline at end of file diff --git a/Lang/Nim/Real-constants-and-functions b/Lang/Nim/Real-constants-and-functions new file mode 120000 index 0000000000..7042f3be1b --- /dev/null +++ b/Lang/Nim/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/Nim \ No newline at end of file diff --git a/Lang/Nim/Record-sound b/Lang/Nim/Record-sound new file mode 120000 index 0000000000..f7d86b7dad --- /dev/null +++ b/Lang/Nim/Record-sound @@ -0,0 +1 @@ +../../Task/Record-sound/Nim \ No newline at end of file diff --git a/Lang/Nim/Regular-expressions b/Lang/Nim/Regular-expressions new file mode 120000 index 0000000000..96c884c8f5 --- /dev/null +++ b/Lang/Nim/Regular-expressions @@ -0,0 +1 @@ +../../Task/Regular-expressions/Nim \ No newline at end of file diff --git a/Lang/Nim/Remove-duplicate-elements b/Lang/Nim/Remove-duplicate-elements new file mode 120000 index 0000000000..73d3a93063 --- /dev/null +++ b/Lang/Nim/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/Nim \ No newline at end of file diff --git a/Lang/Nim/Rename-a-file b/Lang/Nim/Rename-a-file new file mode 120000 index 0000000000..ff13e4cd5a --- /dev/null +++ b/Lang/Nim/Rename-a-file @@ -0,0 +1 @@ +../../Task/Rename-a-file/Nim \ No newline at end of file diff --git a/Lang/Nim/Rep-string b/Lang/Nim/Rep-string new file mode 120000 index 0000000000..b8806f3bb6 --- /dev/null +++ b/Lang/Nim/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/Nim \ No newline at end of file diff --git a/Lang/Nim/Repeat-a-string b/Lang/Nim/Repeat-a-string new file mode 120000 index 0000000000..0309cb6e1a --- /dev/null +++ b/Lang/Nim/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Nim \ No newline at end of file diff --git a/Lang/Nim/Return-multiple-values b/Lang/Nim/Return-multiple-values new file mode 120000 index 0000000000..1f1b7ec557 --- /dev/null +++ b/Lang/Nim/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/Nim \ No newline at end of file diff --git a/Lang/Nim/Reverse-a-string b/Lang/Nim/Reverse-a-string new file mode 120000 index 0000000000..f62d81e583 --- /dev/null +++ b/Lang/Nim/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Nim \ No newline at end of file diff --git a/Lang/Nim/Reverse-words-in-a-string b/Lang/Nim/Reverse-words-in-a-string new file mode 120000 index 0000000000..3c6609ef3c --- /dev/null +++ b/Lang/Nim/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/Nim \ No newline at end of file diff --git a/Lang/Nim/Roman-numerals-Decode b/Lang/Nim/Roman-numerals-Decode new file mode 120000 index 0000000000..c021f65faa --- /dev/null +++ b/Lang/Nim/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/Nim \ No newline at end of file diff --git a/Lang/Nim/Roman-numerals-Encode b/Lang/Nim/Roman-numerals-Encode new file mode 120000 index 0000000000..a065e98de1 --- /dev/null +++ b/Lang/Nim/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/Nim \ No newline at end of file diff --git a/Lang/Nim/Roots-of-unity b/Lang/Nim/Roots-of-unity new file mode 120000 index 0000000000..927a876356 --- /dev/null +++ b/Lang/Nim/Roots-of-unity @@ -0,0 +1 @@ +../../Task/Roots-of-unity/Nim \ No newline at end of file diff --git a/Lang/Nim/Rot-13 b/Lang/Nim/Rot-13 new file mode 120000 index 0000000000..7d2a77f635 --- /dev/null +++ b/Lang/Nim/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Nim \ No newline at end of file diff --git a/Lang/Nim/Run-length-encoding b/Lang/Nim/Run-length-encoding new file mode 120000 index 0000000000..c1ce49807f --- /dev/null +++ b/Lang/Nim/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/Nim \ No newline at end of file diff --git a/Lang/Nim/SEDOLs b/Lang/Nim/SEDOLs new file mode 120000 index 0000000000..4f0af363e6 --- /dev/null +++ b/Lang/Nim/SEDOLs @@ -0,0 +1 @@ +../../Task/SEDOLs/Nim \ No newline at end of file diff --git a/Lang/Nim/SHA-1 b/Lang/Nim/SHA-1 new file mode 120000 index 0000000000..f274132b47 --- /dev/null +++ b/Lang/Nim/SHA-1 @@ -0,0 +1 @@ +../../Task/SHA-1/Nim \ No newline at end of file diff --git a/Lang/Nim/SHA-256 b/Lang/Nim/SHA-256 new file mode 120000 index 0000000000..725ab8dfe5 --- /dev/null +++ b/Lang/Nim/SHA-256 @@ -0,0 +1 @@ +../../Task/SHA-256/Nim \ No newline at end of file diff --git a/Lang/Nim/Safe-addition b/Lang/Nim/Safe-addition new file mode 120000 index 0000000000..5ed02880f0 --- /dev/null +++ b/Lang/Nim/Safe-addition @@ -0,0 +1 @@ +../../Task/Safe-addition/Nim \ No newline at end of file diff --git a/Lang/Nim/Scope-modifiers b/Lang/Nim/Scope-modifiers new file mode 120000 index 0000000000..d9dc29f229 --- /dev/null +++ b/Lang/Nim/Scope-modifiers @@ -0,0 +1 @@ +../../Task/Scope-modifiers/Nim \ No newline at end of file diff --git a/Lang/Nim/Search-a-list b/Lang/Nim/Search-a-list new file mode 120000 index 0000000000..df45e4364e --- /dev/null +++ b/Lang/Nim/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Nim \ No newline at end of file diff --git a/Lang/Nim/Self-describing-numbers b/Lang/Nim/Self-describing-numbers new file mode 120000 index 0000000000..34441a50d4 --- /dev/null +++ b/Lang/Nim/Self-describing-numbers @@ -0,0 +1 @@ +../../Task/Self-describing-numbers/Nim \ No newline at end of file diff --git a/Lang/Nim/Semordnilap b/Lang/Nim/Semordnilap new file mode 120000 index 0000000000..2e7b3f3619 --- /dev/null +++ b/Lang/Nim/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/Nim \ No newline at end of file diff --git a/Lang/Nim/Send-email b/Lang/Nim/Send-email new file mode 120000 index 0000000000..af2e965fcf --- /dev/null +++ b/Lang/Nim/Send-email @@ -0,0 +1 @@ +../../Task/Send-email/Nim \ No newline at end of file diff --git a/Lang/Nim/Sequence-of-non-squares b/Lang/Nim/Sequence-of-non-squares new file mode 120000 index 0000000000..398baadd99 --- /dev/null +++ b/Lang/Nim/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/Nim \ No newline at end of file diff --git a/Lang/Nim/Set b/Lang/Nim/Set new file mode 120000 index 0000000000..9152d40a1e --- /dev/null +++ b/Lang/Nim/Set @@ -0,0 +1 @@ +../../Task/Set/Nim \ No newline at end of file diff --git a/Lang/Nim/Short-circuit-evaluation b/Lang/Nim/Short-circuit-evaluation new file mode 120000 index 0000000000..592269a7ef --- /dev/null +++ b/Lang/Nim/Short-circuit-evaluation @@ -0,0 +1 @@ +../../Task/Short-circuit-evaluation/Nim \ No newline at end of file diff --git a/Lang/Nim/Show-the-epoch b/Lang/Nim/Show-the-epoch new file mode 120000 index 0000000000..3e10f2eadd --- /dev/null +++ b/Lang/Nim/Show-the-epoch @@ -0,0 +1 @@ +../../Task/Show-the-epoch/Nim \ No newline at end of file diff --git a/Lang/Nim/Sierpinski-carpet b/Lang/Nim/Sierpinski-carpet new file mode 120000 index 0000000000..045fec0cdf --- /dev/null +++ b/Lang/Nim/Sierpinski-carpet @@ -0,0 +1 @@ +../../Task/Sierpinski-carpet/Nim \ No newline at end of file diff --git a/Lang/Nim/Sierpinski-triangle b/Lang/Nim/Sierpinski-triangle new file mode 120000 index 0000000000..f8ecf0940d --- /dev/null +++ b/Lang/Nim/Sierpinski-triangle @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle/Nim \ No newline at end of file diff --git a/Lang/Nim/Sieve-of-Eratosthenes b/Lang/Nim/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..71a77b30cc --- /dev/null +++ b/Lang/Nim/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/Nim \ No newline at end of file diff --git a/Lang/Nim/Simple-windowed-application b/Lang/Nim/Simple-windowed-application new file mode 120000 index 0000000000..76cd301529 --- /dev/null +++ b/Lang/Nim/Simple-windowed-application @@ -0,0 +1 @@ +../../Task/Simple-windowed-application/Nim \ No newline at end of file diff --git a/Lang/Nim/Singleton b/Lang/Nim/Singleton new file mode 120000 index 0000000000..56e8a6fec9 --- /dev/null +++ b/Lang/Nim/Singleton @@ -0,0 +1 @@ +../../Task/Singleton/Nim \ No newline at end of file diff --git a/Lang/Nim/Singly-linked-list-Element-definition b/Lang/Nim/Singly-linked-list-Element-definition new file mode 120000 index 0000000000..374be4d10c --- /dev/null +++ b/Lang/Nim/Singly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-definition/Nim \ No newline at end of file diff --git a/Lang/Nim/Singly-linked-list-Element-insertion b/Lang/Nim/Singly-linked-list-Element-insertion new file mode 120000 index 0000000000..485c297573 --- /dev/null +++ b/Lang/Nim/Singly-linked-list-Element-insertion @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-insertion/Nim \ No newline at end of file diff --git a/Lang/Nim/Singly-linked-list-Traversal b/Lang/Nim/Singly-linked-list-Traversal new file mode 120000 index 0000000000..78d7381b53 --- /dev/null +++ b/Lang/Nim/Singly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Traversal/Nim \ No newline at end of file diff --git a/Lang/Nim/Sleep b/Lang/Nim/Sleep new file mode 120000 index 0000000000..deb2684b60 --- /dev/null +++ b/Lang/Nim/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Nim \ No newline at end of file diff --git a/Lang/Nim/Sockets b/Lang/Nim/Sockets new file mode 120000 index 0000000000..7126c7101d --- /dev/null +++ b/Lang/Nim/Sockets @@ -0,0 +1 @@ +../../Task/Sockets/Nim \ No newline at end of file diff --git a/Lang/Nim/Solve-a-Hidato-puzzle b/Lang/Nim/Solve-a-Hidato-puzzle new file mode 120000 index 0000000000..1c54e9b581 --- /dev/null +++ b/Lang/Nim/Solve-a-Hidato-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Hidato-puzzle/Nim \ No newline at end of file diff --git a/Lang/Nim/Sort-an-array-of-composite-structures b/Lang/Nim/Sort-an-array-of-composite-structures new file mode 120000 index 0000000000..0056b8a716 --- /dev/null +++ b/Lang/Nim/Sort-an-array-of-composite-structures @@ -0,0 +1 @@ +../../Task/Sort-an-array-of-composite-structures/Nim \ No newline at end of file diff --git a/Lang/Nim/Sort-an-integer-array b/Lang/Nim/Sort-an-integer-array new file mode 120000 index 0000000000..e7cbff7f28 --- /dev/null +++ b/Lang/Nim/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Nim \ No newline at end of file diff --git a/Lang/Nim/Sort-disjoint-sublist b/Lang/Nim/Sort-disjoint-sublist new file mode 120000 index 0000000000..cdf94a13cf --- /dev/null +++ b/Lang/Nim/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/Nim \ No newline at end of file diff --git a/Lang/Nim/Sort-using-a-custom-comparator b/Lang/Nim/Sort-using-a-custom-comparator new file mode 120000 index 0000000000..5cd6608015 --- /dev/null +++ b/Lang/Nim/Sort-using-a-custom-comparator @@ -0,0 +1 @@ +../../Task/Sort-using-a-custom-comparator/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Bead-sort b/Lang/Nim/Sorting-algorithms-Bead-sort new file mode 120000 index 0000000000..093dc78b94 --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Bead-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bead-sort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Bogosort b/Lang/Nim/Sorting-algorithms-Bogosort new file mode 120000 index 0000000000..3ef1fb142f --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Bogosort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bogosort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Bubble-sort b/Lang/Nim/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..21248c1c04 --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Cocktail-sort b/Lang/Nim/Sorting-algorithms-Cocktail-sort new file mode 120000 index 0000000000..b84f891774 --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Cocktail-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Cocktail-sort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Comb-sort b/Lang/Nim/Sorting-algorithms-Comb-sort new file mode 120000 index 0000000000..e5be0ae283 --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Comb-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Comb-sort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Counting-sort b/Lang/Nim/Sorting-algorithms-Counting-sort new file mode 120000 index 0000000000..dbf78e2eea --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Counting-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Counting-sort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Gnome-sort b/Lang/Nim/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..103ae5b98b --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Heapsort b/Lang/Nim/Sorting-algorithms-Heapsort new file mode 120000 index 0000000000..ebd7892aa8 --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Heapsort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Heapsort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Insertion-sort b/Lang/Nim/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..84de502289 --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Merge-sort b/Lang/Nim/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..4f13b8031e --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Pancake-sort b/Lang/Nim/Sorting-algorithms-Pancake-sort new file mode 120000 index 0000000000..0224df058f --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Pancake-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Pancake-sort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Permutation-sort b/Lang/Nim/Sorting-algorithms-Permutation-sort new file mode 120000 index 0000000000..e1bb43a319 --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Permutation-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Permutation-sort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Quicksort b/Lang/Nim/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..cc9abc6681 --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Selection-sort b/Lang/Nim/Sorting-algorithms-Selection-sort new file mode 120000 index 0000000000..22217fce44 --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Selection-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Selection-sort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Shell-sort b/Lang/Nim/Sorting-algorithms-Shell-sort new file mode 120000 index 0000000000..4299b9b277 --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Shell-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Shell-sort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Sleep-sort b/Lang/Nim/Sorting-algorithms-Sleep-sort new file mode 120000 index 0000000000..88783e7a52 --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Sleep-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Sleep-sort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Stooge-sort b/Lang/Nim/Sorting-algorithms-Stooge-sort new file mode 120000 index 0000000000..faddc011c3 --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Stooge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Stooge-sort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sorting-algorithms-Strand-sort b/Lang/Nim/Sorting-algorithms-Strand-sort new file mode 120000 index 0000000000..50817ea12d --- /dev/null +++ b/Lang/Nim/Sorting-algorithms-Strand-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Strand-sort/Nim \ No newline at end of file diff --git a/Lang/Nim/Sparkline-in-unicode b/Lang/Nim/Sparkline-in-unicode new file mode 120000 index 0000000000..a9b55b61f3 --- /dev/null +++ b/Lang/Nim/Sparkline-in-unicode @@ -0,0 +1 @@ +../../Task/Sparkline-in-unicode/Nim \ No newline at end of file diff --git a/Lang/Nim/Special-characters b/Lang/Nim/Special-characters new file mode 120000 index 0000000000..93ae8a4dfa --- /dev/null +++ b/Lang/Nim/Special-characters @@ -0,0 +1 @@ +../../Task/Special-characters/Nim \ No newline at end of file diff --git a/Lang/Nim/Spiral-matrix b/Lang/Nim/Spiral-matrix new file mode 120000 index 0000000000..9bb893b742 --- /dev/null +++ b/Lang/Nim/Spiral-matrix @@ -0,0 +1 @@ +../../Task/Spiral-matrix/Nim \ No newline at end of file diff --git a/Lang/Nim/Stack b/Lang/Nim/Stack new file mode 120000 index 0000000000..3f966c8f2c --- /dev/null +++ b/Lang/Nim/Stack @@ -0,0 +1 @@ +../../Task/Stack/Nim \ No newline at end of file diff --git a/Lang/Nim/Stack-traces b/Lang/Nim/Stack-traces new file mode 120000 index 0000000000..250e8f8ab5 --- /dev/null +++ b/Lang/Nim/Stack-traces @@ -0,0 +1 @@ +../../Task/Stack-traces/Nim \ No newline at end of file diff --git a/Lang/Nim/Stair-climbing-puzzle b/Lang/Nim/Stair-climbing-puzzle new file mode 120000 index 0000000000..c10e1a5330 --- /dev/null +++ b/Lang/Nim/Stair-climbing-puzzle @@ -0,0 +1 @@ +../../Task/Stair-climbing-puzzle/Nim \ No newline at end of file diff --git a/Lang/Nim/Statistics-Basic b/Lang/Nim/Statistics-Basic new file mode 120000 index 0000000000..65118223a8 --- /dev/null +++ b/Lang/Nim/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/Nim \ No newline at end of file diff --git a/Lang/Nim/String-append b/Lang/Nim/String-append new file mode 120000 index 0000000000..71134eb509 --- /dev/null +++ b/Lang/Nim/String-append @@ -0,0 +1 @@ +../../Task/String-append/Nim \ No newline at end of file diff --git a/Lang/Nim/String-case b/Lang/Nim/String-case new file mode 120000 index 0000000000..2cafdea96c --- /dev/null +++ b/Lang/Nim/String-case @@ -0,0 +1 @@ +../../Task/String-case/Nim \ No newline at end of file diff --git a/Lang/Nim/String-comparison b/Lang/Nim/String-comparison new file mode 120000 index 0000000000..67218b6dfb --- /dev/null +++ b/Lang/Nim/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/Nim \ No newline at end of file diff --git a/Lang/Nim/String-concatenation b/Lang/Nim/String-concatenation new file mode 120000 index 0000000000..56053bb989 --- /dev/null +++ b/Lang/Nim/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Nim \ No newline at end of file diff --git a/Lang/Nim/String-interpolation--included- b/Lang/Nim/String-interpolation--included- new file mode 120000 index 0000000000..f22cd08631 --- /dev/null +++ b/Lang/Nim/String-interpolation--included- @@ -0,0 +1 @@ +../../Task/String-interpolation--included-/Nim \ No newline at end of file diff --git a/Lang/Nim/String-length b/Lang/Nim/String-length new file mode 120000 index 0000000000..cf530b3683 --- /dev/null +++ b/Lang/Nim/String-length @@ -0,0 +1 @@ +../../Task/String-length/Nim \ No newline at end of file diff --git a/Lang/Nim/String-matching b/Lang/Nim/String-matching new file mode 120000 index 0000000000..9f2f44eca0 --- /dev/null +++ b/Lang/Nim/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/Nim \ No newline at end of file diff --git a/Lang/Nim/String-prepend b/Lang/Nim/String-prepend new file mode 120000 index 0000000000..ffef717127 --- /dev/null +++ b/Lang/Nim/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Nim \ No newline at end of file diff --git a/Lang/Nim/Strip-a-set-of-characters-from-a-string b/Lang/Nim/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..bc602b66f4 --- /dev/null +++ b/Lang/Nim/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Nim \ No newline at end of file diff --git a/Lang/Nim/Strip-block-comments b/Lang/Nim/Strip-block-comments new file mode 120000 index 0000000000..77cfba8b70 --- /dev/null +++ b/Lang/Nim/Strip-block-comments @@ -0,0 +1 @@ +../../Task/Strip-block-comments/Nim \ No newline at end of file diff --git a/Lang/Nim/Strip-comments-from-a-string b/Lang/Nim/Strip-comments-from-a-string new file mode 120000 index 0000000000..f714426787 --- /dev/null +++ b/Lang/Nim/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/Nim \ No newline at end of file diff --git a/Lang/Nim/Strip-control-codes-and-extended-characters-from-a-string b/Lang/Nim/Strip-control-codes-and-extended-characters-from-a-string new file mode 120000 index 0000000000..8f74e18bff --- /dev/null +++ b/Lang/Nim/Strip-control-codes-and-extended-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-control-codes-and-extended-characters-from-a-string/Nim \ No newline at end of file diff --git a/Lang/Nim/Strip-whitespace-from-a-string-Top-and-tail b/Lang/Nim/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..515cf6de5a --- /dev/null +++ b/Lang/Nim/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/Nim \ No newline at end of file diff --git a/Lang/Nim/Substring b/Lang/Nim/Substring new file mode 120000 index 0000000000..56877d7268 --- /dev/null +++ b/Lang/Nim/Substring @@ -0,0 +1 @@ +../../Task/Substring/Nim \ No newline at end of file diff --git a/Lang/Nim/Substring-Top-and-tail b/Lang/Nim/Substring-Top-and-tail new file mode 120000 index 0000000000..1c2cd32da8 --- /dev/null +++ b/Lang/Nim/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/Nim \ No newline at end of file diff --git a/Lang/Nim/Sum-and-product-of-an-array b/Lang/Nim/Sum-and-product-of-an-array new file mode 120000 index 0000000000..46199f3127 --- /dev/null +++ b/Lang/Nim/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Nim \ No newline at end of file diff --git a/Lang/Nim/Sum-digits-of-an-integer b/Lang/Nim/Sum-digits-of-an-integer new file mode 120000 index 0000000000..144a59136f --- /dev/null +++ b/Lang/Nim/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/Nim \ No newline at end of file diff --git a/Lang/Nim/Sum-multiples-of-3-and-5 b/Lang/Nim/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..8e81654260 --- /dev/null +++ b/Lang/Nim/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/Nim \ No newline at end of file diff --git a/Lang/Nim/Sum-of-a-series b/Lang/Nim/Sum-of-a-series new file mode 120000 index 0000000000..0de59f07b1 --- /dev/null +++ b/Lang/Nim/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Nim \ No newline at end of file diff --git a/Lang/Nim/Sum-of-squares b/Lang/Nim/Sum-of-squares new file mode 120000 index 0000000000..d61e611680 --- /dev/null +++ b/Lang/Nim/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/Nim \ No newline at end of file diff --git a/Lang/Nim/Symmetric-difference b/Lang/Nim/Symmetric-difference new file mode 120000 index 0000000000..58e62553f4 --- /dev/null +++ b/Lang/Nim/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/Nim \ No newline at end of file diff --git a/Lang/Nim/System-time b/Lang/Nim/System-time new file mode 120000 index 0000000000..0497de1f7d --- /dev/null +++ b/Lang/Nim/System-time @@ -0,0 +1 @@ +../../Task/System-time/Nim \ No newline at end of file diff --git a/Lang/Nim/Table-creation-Postal-addresses b/Lang/Nim/Table-creation-Postal-addresses new file mode 120000 index 0000000000..3fa958c4a1 --- /dev/null +++ b/Lang/Nim/Table-creation-Postal-addresses @@ -0,0 +1 @@ +../../Task/Table-creation-Postal-addresses/Nim \ No newline at end of file diff --git a/Lang/Nim/Take-notes-on-the-command-line b/Lang/Nim/Take-notes-on-the-command-line new file mode 120000 index 0000000000..b44034f082 --- /dev/null +++ b/Lang/Nim/Take-notes-on-the-command-line @@ -0,0 +1 @@ +../../Task/Take-notes-on-the-command-line/Nim \ No newline at end of file diff --git a/Lang/Nim/Temperature-conversion b/Lang/Nim/Temperature-conversion new file mode 120000 index 0000000000..73339c29f4 --- /dev/null +++ b/Lang/Nim/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Nim \ No newline at end of file diff --git a/Lang/Nim/Terminal-control-Clear-the-screen b/Lang/Nim/Terminal-control-Clear-the-screen new file mode 120000 index 0000000000..ab090b5657 --- /dev/null +++ b/Lang/Nim/Terminal-control-Clear-the-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Clear-the-screen/Nim \ No newline at end of file diff --git a/Lang/Nim/Terminal-control-Coloured-text b/Lang/Nim/Terminal-control-Coloured-text new file mode 120000 index 0000000000..70cd6c1cec --- /dev/null +++ b/Lang/Nim/Terminal-control-Coloured-text @@ -0,0 +1 @@ +../../Task/Terminal-control-Coloured-text/Nim \ No newline at end of file diff --git a/Lang/Nim/Terminal-control-Cursor-positioning b/Lang/Nim/Terminal-control-Cursor-positioning new file mode 120000 index 0000000000..397cd62d4a --- /dev/null +++ b/Lang/Nim/Terminal-control-Cursor-positioning @@ -0,0 +1 @@ +../../Task/Terminal-control-Cursor-positioning/Nim \ No newline at end of file diff --git a/Lang/Nim/Terminal-control-Display-an-extended-character b/Lang/Nim/Terminal-control-Display-an-extended-character new file mode 120000 index 0000000000..efcdfe8891 --- /dev/null +++ b/Lang/Nim/Terminal-control-Display-an-extended-character @@ -0,0 +1 @@ +../../Task/Terminal-control-Display-an-extended-character/Nim \ No newline at end of file diff --git a/Lang/Nim/Terminal-control-Inverse-video b/Lang/Nim/Terminal-control-Inverse-video new file mode 120000 index 0000000000..dab4a2eaf9 --- /dev/null +++ b/Lang/Nim/Terminal-control-Inverse-video @@ -0,0 +1 @@ +../../Task/Terminal-control-Inverse-video/Nim \ No newline at end of file diff --git a/Lang/Nim/Terminal-control-Preserve-screen b/Lang/Nim/Terminal-control-Preserve-screen new file mode 120000 index 0000000000..dacbbb70a8 --- /dev/null +++ b/Lang/Nim/Terminal-control-Preserve-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Preserve-screen/Nim \ No newline at end of file diff --git a/Lang/Nim/Terminal-control-Ringing-the-terminal-bell b/Lang/Nim/Terminal-control-Ringing-the-terminal-bell new file mode 120000 index 0000000000..4bf47f586b --- /dev/null +++ b/Lang/Nim/Terminal-control-Ringing-the-terminal-bell @@ -0,0 +1 @@ +../../Task/Terminal-control-Ringing-the-terminal-bell/Nim \ No newline at end of file diff --git a/Lang/Nim/Terminal-control-Unicode-output b/Lang/Nim/Terminal-control-Unicode-output new file mode 120000 index 0000000000..05f9a69cd4 --- /dev/null +++ b/Lang/Nim/Terminal-control-Unicode-output @@ -0,0 +1 @@ +../../Task/Terminal-control-Unicode-output/Nim \ No newline at end of file diff --git a/Lang/Nim/Ternary-logic b/Lang/Nim/Ternary-logic new file mode 120000 index 0000000000..46695bcb57 --- /dev/null +++ b/Lang/Nim/Ternary-logic @@ -0,0 +1 @@ +../../Task/Ternary-logic/Nim \ No newline at end of file diff --git a/Lang/Nim/Test-a-function b/Lang/Nim/Test-a-function new file mode 120000 index 0000000000..c37a31e1e8 --- /dev/null +++ b/Lang/Nim/Test-a-function @@ -0,0 +1 @@ +../../Task/Test-a-function/Nim \ No newline at end of file diff --git a/Lang/Nim/Text-processing-1 b/Lang/Nim/Text-processing-1 new file mode 120000 index 0000000000..b75e3d62e0 --- /dev/null +++ b/Lang/Nim/Text-processing-1 @@ -0,0 +1 @@ +../../Task/Text-processing-1/Nim \ No newline at end of file diff --git a/Lang/Nim/Text-processing-2 b/Lang/Nim/Text-processing-2 new file mode 120000 index 0000000000..e441595bb0 --- /dev/null +++ b/Lang/Nim/Text-processing-2 @@ -0,0 +1 @@ +../../Task/Text-processing-2/Nim \ No newline at end of file diff --git a/Lang/Nim/Text-processing-Max-licenses-in-use b/Lang/Nim/Text-processing-Max-licenses-in-use new file mode 120000 index 0000000000..a596bd286b --- /dev/null +++ b/Lang/Nim/Text-processing-Max-licenses-in-use @@ -0,0 +1 @@ +../../Task/Text-processing-Max-licenses-in-use/Nim \ No newline at end of file diff --git a/Lang/Nim/The-Twelve-Days-of-Christmas b/Lang/Nim/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..b26a58308c --- /dev/null +++ b/Lang/Nim/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/Nim \ No newline at end of file diff --git a/Lang/Nim/Time-a-function b/Lang/Nim/Time-a-function new file mode 120000 index 0000000000..cb31ba8c79 --- /dev/null +++ b/Lang/Nim/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/Nim \ No newline at end of file diff --git a/Lang/Nim/Tokenize-a-string b/Lang/Nim/Tokenize-a-string new file mode 120000 index 0000000000..7c6f29a7c5 --- /dev/null +++ b/Lang/Nim/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Nim \ No newline at end of file diff --git a/Lang/Nim/Top-rank-per-group b/Lang/Nim/Top-rank-per-group new file mode 120000 index 0000000000..0245d2dbff --- /dev/null +++ b/Lang/Nim/Top-rank-per-group @@ -0,0 +1 @@ +../../Task/Top-rank-per-group/Nim \ No newline at end of file diff --git a/Lang/Nim/Total-circles-area b/Lang/Nim/Total-circles-area new file mode 120000 index 0000000000..ffc0e68590 --- /dev/null +++ b/Lang/Nim/Total-circles-area @@ -0,0 +1 @@ +../../Task/Total-circles-area/Nim \ No newline at end of file diff --git a/Lang/Nim/Towers-of-Hanoi b/Lang/Nim/Towers-of-Hanoi new file mode 120000 index 0000000000..b2c6d2f7be --- /dev/null +++ b/Lang/Nim/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Nim \ No newline at end of file diff --git a/Lang/Nim/Trabb-Pardo-Knuth-algorithm b/Lang/Nim/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..2bcbfeb09f --- /dev/null +++ b/Lang/Nim/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/Nim \ No newline at end of file diff --git a/Lang/Nim/Tree-traversal b/Lang/Nim/Tree-traversal new file mode 120000 index 0000000000..d2e3e5698c --- /dev/null +++ b/Lang/Nim/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/Nim \ No newline at end of file diff --git a/Lang/Nim/Trigonometric-functions b/Lang/Nim/Trigonometric-functions new file mode 120000 index 0000000000..15aad082a3 --- /dev/null +++ b/Lang/Nim/Trigonometric-functions @@ -0,0 +1 @@ +../../Task/Trigonometric-functions/Nim \ No newline at end of file diff --git a/Lang/Nim/Truncatable-primes b/Lang/Nim/Truncatable-primes new file mode 120000 index 0000000000..5284a6ebe3 --- /dev/null +++ b/Lang/Nim/Truncatable-primes @@ -0,0 +1 @@ +../../Task/Truncatable-primes/Nim \ No newline at end of file diff --git a/Lang/Nim/Truncate-a-file b/Lang/Nim/Truncate-a-file new file mode 120000 index 0000000000..bda1f88647 --- /dev/null +++ b/Lang/Nim/Truncate-a-file @@ -0,0 +1 @@ +../../Task/Truncate-a-file/Nim \ No newline at end of file diff --git a/Lang/Nim/URL-decoding b/Lang/Nim/URL-decoding new file mode 120000 index 0000000000..084757d2cc --- /dev/null +++ b/Lang/Nim/URL-decoding @@ -0,0 +1 @@ +../../Task/URL-decoding/Nim \ No newline at end of file diff --git a/Lang/Nim/URL-encoding b/Lang/Nim/URL-encoding new file mode 120000 index 0000000000..dd8929f41f --- /dev/null +++ b/Lang/Nim/URL-encoding @@ -0,0 +1 @@ +../../Task/URL-encoding/Nim \ No newline at end of file diff --git a/Lang/Nim/Unbias-a-random-generator b/Lang/Nim/Unbias-a-random-generator new file mode 120000 index 0000000000..c57d01e498 --- /dev/null +++ b/Lang/Nim/Unbias-a-random-generator @@ -0,0 +1 @@ +../../Task/Unbias-a-random-generator/Nim \ No newline at end of file diff --git a/Lang/Nim/Unicode-strings b/Lang/Nim/Unicode-strings new file mode 120000 index 0000000000..d017cb14d6 --- /dev/null +++ b/Lang/Nim/Unicode-strings @@ -0,0 +1 @@ +../../Task/Unicode-strings/Nim \ No newline at end of file diff --git a/Lang/Nim/Unicode-variable-names b/Lang/Nim/Unicode-variable-names new file mode 120000 index 0000000000..c8d1ff05ad --- /dev/null +++ b/Lang/Nim/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/Nim \ No newline at end of file diff --git a/Lang/Nim/Universal-Turing-machine b/Lang/Nim/Universal-Turing-machine new file mode 120000 index 0000000000..c61df9675b --- /dev/null +++ b/Lang/Nim/Universal-Turing-machine @@ -0,0 +1 @@ +../../Task/Universal-Turing-machine/Nim \ No newline at end of file diff --git a/Lang/Nim/Unix-ls b/Lang/Nim/Unix-ls new file mode 120000 index 0000000000..50732055ba --- /dev/null +++ b/Lang/Nim/Unix-ls @@ -0,0 +1 @@ +../../Task/Unix-ls/Nim \ No newline at end of file diff --git a/Lang/Nim/Use-another-language-to-call-a-function b/Lang/Nim/Use-another-language-to-call-a-function new file mode 120000 index 0000000000..6b60c69a7f --- /dev/null +++ b/Lang/Nim/Use-another-language-to-call-a-function @@ -0,0 +1 @@ +../../Task/Use-another-language-to-call-a-function/Nim \ No newline at end of file diff --git a/Lang/Nim/User-input-Text b/Lang/Nim/User-input-Text new file mode 120000 index 0000000000..cd7b2b1a35 --- /dev/null +++ b/Lang/Nim/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/Nim \ No newline at end of file diff --git a/Lang/Nim/Variable-length-quantity b/Lang/Nim/Variable-length-quantity new file mode 120000 index 0000000000..ca2ee0d65f --- /dev/null +++ b/Lang/Nim/Variable-length-quantity @@ -0,0 +1 @@ +../../Task/Variable-length-quantity/Nim \ No newline at end of file diff --git a/Lang/Nim/Variable-size-Get b/Lang/Nim/Variable-size-Get new file mode 120000 index 0000000000..8655dbc8cb --- /dev/null +++ b/Lang/Nim/Variable-size-Get @@ -0,0 +1 @@ +../../Task/Variable-size-Get/Nim \ No newline at end of file diff --git a/Lang/Nim/Variable-size-Set b/Lang/Nim/Variable-size-Set new file mode 120000 index 0000000000..5f889a68c0 --- /dev/null +++ b/Lang/Nim/Variable-size-Set @@ -0,0 +1 @@ +../../Task/Variable-size-Set/Nim \ No newline at end of file diff --git a/Lang/Nim/Variables b/Lang/Nim/Variables new file mode 120000 index 0000000000..f907c07d60 --- /dev/null +++ b/Lang/Nim/Variables @@ -0,0 +1 @@ +../../Task/Variables/Nim \ No newline at end of file diff --git a/Lang/Nim/Variadic-function b/Lang/Nim/Variadic-function new file mode 120000 index 0000000000..5dc9df0930 --- /dev/null +++ b/Lang/Nim/Variadic-function @@ -0,0 +1 @@ +../../Task/Variadic-function/Nim \ No newline at end of file diff --git a/Lang/Nim/Vector-products b/Lang/Nim/Vector-products new file mode 120000 index 0000000000..c4236f947b --- /dev/null +++ b/Lang/Nim/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/Nim \ No newline at end of file diff --git a/Lang/Nim/Vigen-re-cipher b/Lang/Nim/Vigen-re-cipher new file mode 120000 index 0000000000..f91bf1cae4 --- /dev/null +++ b/Lang/Nim/Vigen-re-cipher @@ -0,0 +1 @@ +../../Task/Vigen-re-cipher/Nim \ No newline at end of file diff --git a/Lang/Nim/Visualize-a-tree b/Lang/Nim/Visualize-a-tree new file mode 120000 index 0000000000..c5c6d50451 --- /dev/null +++ b/Lang/Nim/Visualize-a-tree @@ -0,0 +1 @@ +../../Task/Visualize-a-tree/Nim \ No newline at end of file diff --git a/Lang/Nim/Walk-a-directory-Non-recursively b/Lang/Nim/Walk-a-directory-Non-recursively new file mode 120000 index 0000000000..a4473345c0 --- /dev/null +++ b/Lang/Nim/Walk-a-directory-Non-recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Non-recursively/Nim \ No newline at end of file diff --git a/Lang/Nim/Walk-a-directory-Recursively b/Lang/Nim/Walk-a-directory-Recursively new file mode 120000 index 0000000000..934954ff60 --- /dev/null +++ b/Lang/Nim/Walk-a-directory-Recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Recursively/Nim \ No newline at end of file diff --git a/Lang/Nim/Web-scraping b/Lang/Nim/Web-scraping new file mode 120000 index 0000000000..4143fee01d --- /dev/null +++ b/Lang/Nim/Web-scraping @@ -0,0 +1 @@ +../../Task/Web-scraping/Nim \ No newline at end of file diff --git a/Lang/Nim/Window-creation b/Lang/Nim/Window-creation new file mode 120000 index 0000000000..faf09e3339 --- /dev/null +++ b/Lang/Nim/Window-creation @@ -0,0 +1 @@ +../../Task/Window-creation/Nim \ No newline at end of file diff --git a/Lang/Nim/Window-management b/Lang/Nim/Window-management new file mode 120000 index 0000000000..f28dcb36d5 --- /dev/null +++ b/Lang/Nim/Window-management @@ -0,0 +1 @@ +../../Task/Window-management/Nim \ No newline at end of file diff --git a/Lang/Nim/Wireworld b/Lang/Nim/Wireworld new file mode 120000 index 0000000000..6fa429ffcf --- /dev/null +++ b/Lang/Nim/Wireworld @@ -0,0 +1 @@ +../../Task/Wireworld/Nim \ No newline at end of file diff --git a/Lang/Nim/Word-wrap b/Lang/Nim/Word-wrap new file mode 120000 index 0000000000..baef52fb00 --- /dev/null +++ b/Lang/Nim/Word-wrap @@ -0,0 +1 @@ +../../Task/Word-wrap/Nim \ No newline at end of file diff --git a/Lang/Nim/Write-float-arrays-to-a-text-file b/Lang/Nim/Write-float-arrays-to-a-text-file new file mode 120000 index 0000000000..1293b16631 --- /dev/null +++ b/Lang/Nim/Write-float-arrays-to-a-text-file @@ -0,0 +1 @@ +../../Task/Write-float-arrays-to-a-text-file/Nim \ No newline at end of file diff --git a/Lang/Nim/Write-language-name-in-3D-ASCII b/Lang/Nim/Write-language-name-in-3D-ASCII new file mode 120000 index 0000000000..17a8d4ca59 --- /dev/null +++ b/Lang/Nim/Write-language-name-in-3D-ASCII @@ -0,0 +1 @@ +../../Task/Write-language-name-in-3D-ASCII/Nim \ No newline at end of file diff --git a/Lang/Nim/XML-DOM-serialization b/Lang/Nim/XML-DOM-serialization new file mode 120000 index 0000000000..d965468016 --- /dev/null +++ b/Lang/Nim/XML-DOM-serialization @@ -0,0 +1 @@ +../../Task/XML-DOM-serialization/Nim \ No newline at end of file diff --git a/Lang/Nim/XML-Input b/Lang/Nim/XML-Input new file mode 120000 index 0000000000..2bc2b245b1 --- /dev/null +++ b/Lang/Nim/XML-Input @@ -0,0 +1 @@ +../../Task/XML-Input/Nim \ No newline at end of file diff --git a/Lang/Nim/XML-Output b/Lang/Nim/XML-Output new file mode 120000 index 0000000000..2d5492c60c --- /dev/null +++ b/Lang/Nim/XML-Output @@ -0,0 +1 @@ +../../Task/XML-Output/Nim \ No newline at end of file diff --git a/Lang/Nim/XML-XPath b/Lang/Nim/XML-XPath new file mode 120000 index 0000000000..d1fec8c848 --- /dev/null +++ b/Lang/Nim/XML-XPath @@ -0,0 +1 @@ +../../Task/XML-XPath/Nim \ No newline at end of file diff --git a/Lang/Nim/Zeckendorf-number-representation b/Lang/Nim/Zeckendorf-number-representation new file mode 120000 index 0000000000..6fcd05eb90 --- /dev/null +++ b/Lang/Nim/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/Nim \ No newline at end of file diff --git a/Lang/Nim/Zero-to-the-zero-power b/Lang/Nim/Zero-to-the-zero-power new file mode 120000 index 0000000000..6de42e1f31 --- /dev/null +++ b/Lang/Nim/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/Nim \ No newline at end of file diff --git a/Lang/Nim/Zig-zag-matrix b/Lang/Nim/Zig-zag-matrix new file mode 120000 index 0000000000..979414abe2 --- /dev/null +++ b/Lang/Nim/Zig-zag-matrix @@ -0,0 +1 @@ +../../Task/Zig-zag-matrix/Nim \ No newline at end of file diff --git a/Lang/Nit/00DESCRIPTION b/Lang/Nit/00DESCRIPTION new file mode 100644 index 0000000000..126e5dabcc --- /dev/null +++ b/Lang/Nit/00DESCRIPTION @@ -0,0 +1,12 @@ +{{stub}} +{{language +|exec=machine +|site=http://nitlanguage.org +|gc=yes +|parampass=reference +|safety=safe +|strength=strong +|compat=nominative +|express=both +|checking=static +|tags=nit}} \ No newline at end of file diff --git a/Lang/Nit/A+B b/Lang/Nit/A+B new file mode 120000 index 0000000000..1ff644c558 --- /dev/null +++ b/Lang/Nit/A+B @@ -0,0 +1 @@ +../../Task/A+B/Nit \ No newline at end of file diff --git a/Lang/Nit/Abstract-type b/Lang/Nit/Abstract-type new file mode 120000 index 0000000000..24a224d9ac --- /dev/null +++ b/Lang/Nit/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/Nit \ No newline at end of file diff --git a/Lang/Nit/Hello-world-Text b/Lang/Nit/Hello-world-Text new file mode 120000 index 0000000000..75136a5316 --- /dev/null +++ b/Lang/Nit/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Nit \ No newline at end of file diff --git a/Lang/Nit/README b/Lang/Nit/README new file mode 100644 index 0000000000..e832af9908 --- /dev/null +++ b/Lang/Nit/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Nit diff --git a/Lang/Nix/00DESCRIPTION b/Lang/Nix/00DESCRIPTION new file mode 100644 index 0000000000..48cf0b3814 --- /dev/null +++ b/Lang/Nix/00DESCRIPTION @@ -0,0 +1 @@ +{{stub}}{{language|Nix}} \ No newline at end of file diff --git a/Lang/Nix/README b/Lang/Nix/README new file mode 100644 index 0000000000..5f79a9e98b --- /dev/null +++ b/Lang/Nix/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Nix diff --git a/Lang/Nix/Sorting-algorithms-Quicksort b/Lang/Nix/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..e494a7e508 --- /dev/null +++ b/Lang/Nix/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Nix \ No newline at end of file diff --git a/Lang/Oforth/00DESCRIPTION b/Lang/Oforth/00DESCRIPTION new file mode 100644 index 0000000000..b488e6a9ee --- /dev/null +++ b/Lang/Oforth/00DESCRIPTION @@ -0,0 +1,19 @@ +{{language +|site=http://www.oforth.com/ +|gc=yes +}} + +{{language programming paradigm|concatenative}} +{{language programming paradigm|imperative}} + +Oforth is for Object + Forth : while based on Forth philosophy (data stack, one pass compilation, ...), it implements a full object metamodel. + +Features include : +* Dynamic language (which does not mean a slow language). +* Oforth comes with an interpreter : you can try things interactively. +* Object metamodel : everything is an object. +* Automatic garbage collection. +* Support of functional programming style and closures using blocks. +* While mutability is allowed, immutability is the default behavior, and sometimes required. +* Support of parallelism using ligth-weight tasks and communication using channels. +* Very concise language : "the more code you write, the more bugs you have" \ No newline at end of file diff --git a/Lang/Oforth/100-doors b/Lang/Oforth/100-doors new file mode 120000 index 0000000000..1a184ec1e2 --- /dev/null +++ b/Lang/Oforth/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Oforth \ No newline at end of file diff --git a/Lang/Oforth/24-game b/Lang/Oforth/24-game new file mode 120000 index 0000000000..08bc7a096b --- /dev/null +++ b/Lang/Oforth/24-game @@ -0,0 +1 @@ +../../Task/24-game/Oforth \ No newline at end of file diff --git a/Lang/Oforth/99-Bottles-of-Beer b/Lang/Oforth/99-Bottles-of-Beer new file mode 120000 index 0000000000..d397e99907 --- /dev/null +++ b/Lang/Oforth/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Oforth \ No newline at end of file diff --git a/Lang/Oforth/A+B b/Lang/Oforth/A+B new file mode 120000 index 0000000000..41aeac19fe --- /dev/null +++ b/Lang/Oforth/A+B @@ -0,0 +1 @@ +../../Task/A+B/Oforth \ No newline at end of file diff --git a/Lang/Oforth/ABC-Problem b/Lang/Oforth/ABC-Problem new file mode 120000 index 0000000000..0b1901c5c6 --- /dev/null +++ b/Lang/Oforth/ABC-Problem @@ -0,0 +1 @@ +../../Task/ABC-Problem/Oforth \ No newline at end of file diff --git a/Lang/Oforth/AKS-test-for-primes b/Lang/Oforth/AKS-test-for-primes new file mode 120000 index 0000000000..06f13fe933 --- /dev/null +++ b/Lang/Oforth/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Abstract-type b/Lang/Oforth/Abstract-type new file mode 120000 index 0000000000..fba1c65b3f --- /dev/null +++ b/Lang/Oforth/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Abundant,-deficient-and-perfect-number-classifications b/Lang/Oforth/Abundant,-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..57da286092 --- /dev/null +++ b/Lang/Oforth/Abundant,-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant,-deficient-and-perfect-number-classifications/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Accumulator-factory b/Lang/Oforth/Accumulator-factory new file mode 120000 index 0000000000..3afec9f348 --- /dev/null +++ b/Lang/Oforth/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Ackermann-function b/Lang/Oforth/Ackermann-function new file mode 120000 index 0000000000..565b1c97b8 --- /dev/null +++ b/Lang/Oforth/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Align-columns b/Lang/Oforth/Align-columns new file mode 120000 index 0000000000..3004992cd9 --- /dev/null +++ b/Lang/Oforth/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Aliquot-sequence-classifications b/Lang/Oforth/Aliquot-sequence-classifications new file mode 120000 index 0000000000..00d61293e9 --- /dev/null +++ b/Lang/Oforth/Aliquot-sequence-classifications @@ -0,0 +1 @@ +../../Task/Aliquot-sequence-classifications/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Almost-prime b/Lang/Oforth/Almost-prime new file mode 120000 index 0000000000..e2ec006986 --- /dev/null +++ b/Lang/Oforth/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Amicable-pairs b/Lang/Oforth/Amicable-pairs new file mode 120000 index 0000000000..12cdfb9674 --- /dev/null +++ b/Lang/Oforth/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Anagrams b/Lang/Oforth/Anagrams new file mode 120000 index 0000000000..c9e3c9a9e6 --- /dev/null +++ b/Lang/Oforth/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Apply-a-callback-to-an-array b/Lang/Oforth/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..f80f833811 --- /dev/null +++ b/Lang/Oforth/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Arbitrary-precision-integers--included- b/Lang/Oforth/Arbitrary-precision-integers--included- new file mode 120000 index 0000000000..dd86999902 --- /dev/null +++ b/Lang/Oforth/Arbitrary-precision-integers--included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers--included-/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Arena-storage-pool b/Lang/Oforth/Arena-storage-pool new file mode 120000 index 0000000000..5d8ce7f96e --- /dev/null +++ b/Lang/Oforth/Arena-storage-pool @@ -0,0 +1 @@ +../../Task/Arena-storage-pool/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Arithmetic-Complex b/Lang/Oforth/Arithmetic-Complex new file mode 120000 index 0000000000..183d7852c8 --- /dev/null +++ b/Lang/Oforth/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Arithmetic-Integer b/Lang/Oforth/Arithmetic-Integer new file mode 120000 index 0000000000..57ab950634 --- /dev/null +++ b/Lang/Oforth/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Arithmetic-geometric-mean b/Lang/Oforth/Arithmetic-geometric-mean new file mode 120000 index 0000000000..b85eceb401 --- /dev/null +++ b/Lang/Oforth/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Array-concatenation b/Lang/Oforth/Array-concatenation new file mode 120000 index 0000000000..00abc09956 --- /dev/null +++ b/Lang/Oforth/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Arrays b/Lang/Oforth/Arrays new file mode 120000 index 0000000000..8919113324 --- /dev/null +++ b/Lang/Oforth/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Assertions b/Lang/Oforth/Assertions new file mode 120000 index 0000000000..3fc4240191 --- /dev/null +++ b/Lang/Oforth/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Averages-Arithmetic-mean b/Lang/Oforth/Averages-Arithmetic-mean new file mode 120000 index 0000000000..feccb3c134 --- /dev/null +++ b/Lang/Oforth/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Averages-Pythagorean-means b/Lang/Oforth/Averages-Pythagorean-means new file mode 120000 index 0000000000..663b084008 --- /dev/null +++ b/Lang/Oforth/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Averages-Root-mean-square b/Lang/Oforth/Averages-Root-mean-square new file mode 120000 index 0000000000..c2912304fc --- /dev/null +++ b/Lang/Oforth/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Averages-Simple-moving-average b/Lang/Oforth/Averages-Simple-moving-average new file mode 120000 index 0000000000..e861bf2379 --- /dev/null +++ b/Lang/Oforth/Averages-Simple-moving-average @@ -0,0 +1 @@ +../../Task/Averages-Simple-moving-average/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Balanced-brackets b/Lang/Oforth/Balanced-brackets new file mode 120000 index 0000000000..925f948428 --- /dev/null +++ b/Lang/Oforth/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Bitwise-operations b/Lang/Oforth/Bitwise-operations new file mode 120000 index 0000000000..0d2b791abf --- /dev/null +++ b/Lang/Oforth/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Bulls-and-cows b/Lang/Oforth/Bulls-and-cows new file mode 120000 index 0000000000..76e8e04cf7 --- /dev/null +++ b/Lang/Oforth/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Caesar-cipher b/Lang/Oforth/Caesar-cipher new file mode 120000 index 0000000000..d46641db8e --- /dev/null +++ b/Lang/Oforth/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Call-a-function b/Lang/Oforth/Call-a-function new file mode 120000 index 0000000000..483a68bd8d --- /dev/null +++ b/Lang/Oforth/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Call-an-object-method b/Lang/Oforth/Call-an-object-method new file mode 120000 index 0000000000..cc29f3edb4 --- /dev/null +++ b/Lang/Oforth/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Case-sensitivity-of-identifiers b/Lang/Oforth/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..ffb200606c --- /dev/null +++ b/Lang/Oforth/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Catalan-numbers b/Lang/Oforth/Catalan-numbers new file mode 120000 index 0000000000..d000417678 --- /dev/null +++ b/Lang/Oforth/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Catalan-numbers-Pascals-triangle b/Lang/Oforth/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..8b07ef0f62 --- /dev/null +++ b/Lang/Oforth/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Catamorphism b/Lang/Oforth/Catamorphism new file mode 120000 index 0000000000..41d25f6245 --- /dev/null +++ b/Lang/Oforth/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Character-codes b/Lang/Oforth/Character-codes new file mode 120000 index 0000000000..ca76cab3a3 --- /dev/null +++ b/Lang/Oforth/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Checkpoint-synchronization b/Lang/Oforth/Checkpoint-synchronization new file mode 120000 index 0000000000..77d80474d8 --- /dev/null +++ b/Lang/Oforth/Checkpoint-synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint-synchronization/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Circles-of-given-radius-through-two-points b/Lang/Oforth/Circles-of-given-radius-through-two-points new file mode 120000 index 0000000000..764d31d9b8 --- /dev/null +++ b/Lang/Oforth/Circles-of-given-radius-through-two-points @@ -0,0 +1 @@ +../../Task/Circles-of-given-radius-through-two-points/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Classes b/Lang/Oforth/Classes new file mode 120000 index 0000000000..5daaeafec0 --- /dev/null +++ b/Lang/Oforth/Classes @@ -0,0 +1 @@ +../../Task/Classes/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Closures-Value-capture b/Lang/Oforth/Closures-Value-capture new file mode 120000 index 0000000000..9b77c326ef --- /dev/null +++ b/Lang/Oforth/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Collections b/Lang/Oforth/Collections new file mode 120000 index 0000000000..4ba1578d0d --- /dev/null +++ b/Lang/Oforth/Collections @@ -0,0 +1 @@ +../../Task/Collections/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Comma-quibbling b/Lang/Oforth/Comma-quibbling new file mode 120000 index 0000000000..2c79d3ad63 --- /dev/null +++ b/Lang/Oforth/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Command-line-arguments b/Lang/Oforth/Command-line-arguments new file mode 120000 index 0000000000..8ad9871bef --- /dev/null +++ b/Lang/Oforth/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Comments b/Lang/Oforth/Comments new file mode 120000 index 0000000000..99ac67ab49 --- /dev/null +++ b/Lang/Oforth/Comments @@ -0,0 +1 @@ +../../Task/Comments/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Compile-time-calculation b/Lang/Oforth/Compile-time-calculation new file mode 120000 index 0000000000..7be60457f6 --- /dev/null +++ b/Lang/Oforth/Compile-time-calculation @@ -0,0 +1 @@ +../../Task/Compile-time-calculation/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Compound-data-type b/Lang/Oforth/Compound-data-type new file mode 120000 index 0000000000..663da5d9b6 --- /dev/null +++ b/Lang/Oforth/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Concurrent-computing b/Lang/Oforth/Concurrent-computing new file mode 120000 index 0000000000..a6a7ac9df0 --- /dev/null +++ b/Lang/Oforth/Concurrent-computing @@ -0,0 +1 @@ +../../Task/Concurrent-computing/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Conditional-structures b/Lang/Oforth/Conditional-structures new file mode 120000 index 0000000000..0650f9d3ff --- /dev/null +++ b/Lang/Oforth/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Copy-a-string b/Lang/Oforth/Copy-a-string new file mode 120000 index 0000000000..54b8a77dc1 --- /dev/null +++ b/Lang/Oforth/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Count-occurrences-of-a-substring b/Lang/Oforth/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..108dbddbd6 --- /dev/null +++ b/Lang/Oforth/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Currying b/Lang/Oforth/Currying new file mode 120000 index 0000000000..cad7b5f71e --- /dev/null +++ b/Lang/Oforth/Currying @@ -0,0 +1 @@ +../../Task/Currying/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Day-of-the-week b/Lang/Oforth/Day-of-the-week new file mode 120000 index 0000000000..40359ed208 --- /dev/null +++ b/Lang/Oforth/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Delegates b/Lang/Oforth/Delegates new file mode 120000 index 0000000000..dbb3ea0f28 --- /dev/null +++ b/Lang/Oforth/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Detect-division-by-zero b/Lang/Oforth/Detect-division-by-zero new file mode 120000 index 0000000000..3f22d4c1ce --- /dev/null +++ b/Lang/Oforth/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Digital-root b/Lang/Oforth/Digital-root new file mode 120000 index 0000000000..1d247707eb --- /dev/null +++ b/Lang/Oforth/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Dot-product b/Lang/Oforth/Dot-product new file mode 120000 index 0000000000..c6fea6f23c --- /dev/null +++ b/Lang/Oforth/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Doubly-linked-list-Definition b/Lang/Oforth/Doubly-linked-list-Definition new file mode 120000 index 0000000000..007b36bb03 --- /dev/null +++ b/Lang/Oforth/Doubly-linked-list-Definition @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Definition/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Doubly-linked-list-Element-definition b/Lang/Oforth/Doubly-linked-list-Element-definition new file mode 120000 index 0000000000..f1ff937b15 --- /dev/null +++ b/Lang/Oforth/Doubly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Element-definition/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Doubly-linked-list-Element-insertion b/Lang/Oforth/Doubly-linked-list-Element-insertion new file mode 120000 index 0000000000..14e8aa84ed --- /dev/null +++ b/Lang/Oforth/Doubly-linked-list-Element-insertion @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Element-insertion/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Doubly-linked-list-Traversal b/Lang/Oforth/Doubly-linked-list-Traversal new file mode 120000 index 0000000000..ee369a1926 --- /dev/null +++ b/Lang/Oforth/Doubly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Traversal/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Dynamic-variable-names b/Lang/Oforth/Dynamic-variable-names new file mode 120000 index 0000000000..088fb0adcc --- /dev/null +++ b/Lang/Oforth/Dynamic-variable-names @@ -0,0 +1 @@ +../../Task/Dynamic-variable-names/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Empty-program b/Lang/Oforth/Empty-program new file mode 120000 index 0000000000..6d103add0d --- /dev/null +++ b/Lang/Oforth/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Empty-string b/Lang/Oforth/Empty-string new file mode 120000 index 0000000000..a1a45f2698 --- /dev/null +++ b/Lang/Oforth/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Enforced-immutability b/Lang/Oforth/Enforced-immutability new file mode 120000 index 0000000000..891321c2e8 --- /dev/null +++ b/Lang/Oforth/Enforced-immutability @@ -0,0 +1 @@ +../../Task/Enforced-immutability/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Entropy b/Lang/Oforth/Entropy new file mode 120000 index 0000000000..0f3b325d20 --- /dev/null +++ b/Lang/Oforth/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Enumerations b/Lang/Oforth/Enumerations new file mode 120000 index 0000000000..bd4de82550 --- /dev/null +++ b/Lang/Oforth/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Environment-variables b/Lang/Oforth/Environment-variables new file mode 120000 index 0000000000..f592f0dd23 --- /dev/null +++ b/Lang/Oforth/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Equilibrium-index b/Lang/Oforth/Equilibrium-index new file mode 120000 index 0000000000..fcc48b109e --- /dev/null +++ b/Lang/Oforth/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Ethiopian-multiplication b/Lang/Oforth/Ethiopian-multiplication new file mode 120000 index 0000000000..22c1e247a0 --- /dev/null +++ b/Lang/Oforth/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Euler-method b/Lang/Oforth/Euler-method new file mode 120000 index 0000000000..5c6a0ceffe --- /dev/null +++ b/Lang/Oforth/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Evaluate-binomial-coefficients b/Lang/Oforth/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..8a5c3152ca --- /dev/null +++ b/Lang/Oforth/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Even-or-odd b/Lang/Oforth/Even-or-odd new file mode 120000 index 0000000000..cab30fa028 --- /dev/null +++ b/Lang/Oforth/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Events b/Lang/Oforth/Events new file mode 120000 index 0000000000..2ec6174010 --- /dev/null +++ b/Lang/Oforth/Events @@ -0,0 +1 @@ +../../Task/Events/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Evolutionary-algorithm b/Lang/Oforth/Evolutionary-algorithm new file mode 120000 index 0000000000..0f92638944 --- /dev/null +++ b/Lang/Oforth/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Exceptions b/Lang/Oforth/Exceptions new file mode 120000 index 0000000000..5af7b631cb --- /dev/null +++ b/Lang/Oforth/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Exceptions-Catch-an-exception-thrown-in-a-nested-call b/Lang/Oforth/Exceptions-Catch-an-exception-thrown-in-a-nested-call new file mode 120000 index 0000000000..00665d3725 --- /dev/null +++ b/Lang/Oforth/Exceptions-Catch-an-exception-thrown-in-a-nested-call @@ -0,0 +1 @@ +../../Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Execute-a-system-command b/Lang/Oforth/Execute-a-system-command new file mode 120000 index 0000000000..f28a57adb1 --- /dev/null +++ b/Lang/Oforth/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Exponentiation-operator b/Lang/Oforth/Exponentiation-operator new file mode 120000 index 0000000000..6c45835749 --- /dev/null +++ b/Lang/Oforth/Exponentiation-operator @@ -0,0 +1 @@ +../../Task/Exponentiation-operator/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Factorial b/Lang/Oforth/Factorial new file mode 120000 index 0000000000..a7614a30ef --- /dev/null +++ b/Lang/Oforth/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Factors-of-an-integer b/Lang/Oforth/Factors-of-an-integer new file mode 120000 index 0000000000..4b4e6bc89f --- /dev/null +++ b/Lang/Oforth/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Fibonacci-sequence b/Lang/Oforth/Fibonacci-sequence new file mode 120000 index 0000000000..b06ac10fed --- /dev/null +++ b/Lang/Oforth/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Fibonacci-word b/Lang/Oforth/Fibonacci-word new file mode 120000 index 0000000000..9cdcacb178 --- /dev/null +++ b/Lang/Oforth/Fibonacci-word @@ -0,0 +1 @@ +../../Task/Fibonacci-word/Oforth \ No newline at end of file diff --git a/Lang/Oforth/File-input-output b/Lang/Oforth/File-input-output new file mode 120000 index 0000000000..edb67b27c7 --- /dev/null +++ b/Lang/Oforth/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/Oforth \ No newline at end of file diff --git a/Lang/Oforth/File-modification-time b/Lang/Oforth/File-modification-time new file mode 120000 index 0000000000..b49425d44b --- /dev/null +++ b/Lang/Oforth/File-modification-time @@ -0,0 +1 @@ +../../Task/File-modification-time/Oforth \ No newline at end of file diff --git a/Lang/Oforth/File-size b/Lang/Oforth/File-size new file mode 120000 index 0000000000..4be0122bd6 --- /dev/null +++ b/Lang/Oforth/File-size @@ -0,0 +1 @@ +../../Task/File-size/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Filter b/Lang/Oforth/Filter new file mode 120000 index 0000000000..3fd4840154 --- /dev/null +++ b/Lang/Oforth/Filter @@ -0,0 +1 @@ +../../Task/Filter/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Find-limit-of-recursion b/Lang/Oforth/Find-limit-of-recursion new file mode 120000 index 0000000000..4c957ce014 --- /dev/null +++ b/Lang/Oforth/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Find-the-last-Sunday-of-each-month b/Lang/Oforth/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..a84d5a3df6 --- /dev/null +++ b/Lang/Oforth/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/Oforth \ No newline at end of file diff --git a/Lang/Oforth/First-class-functions b/Lang/Oforth/First-class-functions new file mode 120000 index 0000000000..43585f9112 --- /dev/null +++ b/Lang/Oforth/First-class-functions @@ -0,0 +1 @@ +../../Task/First-class-functions/Oforth \ No newline at end of file diff --git a/Lang/Oforth/First-class-functions-Use-numbers-analogously b/Lang/Oforth/First-class-functions-Use-numbers-analogously new file mode 120000 index 0000000000..c1ec0fde09 --- /dev/null +++ b/Lang/Oforth/First-class-functions-Use-numbers-analogously @@ -0,0 +1 @@ +../../Task/First-class-functions-Use-numbers-analogously/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Five-weekends b/Lang/Oforth/Five-weekends new file mode 120000 index 0000000000..e5a2cb23e6 --- /dev/null +++ b/Lang/Oforth/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/Oforth \ No newline at end of file diff --git a/Lang/Oforth/FizzBuzz b/Lang/Oforth/FizzBuzz new file mode 120000 index 0000000000..ca43ba51a9 --- /dev/null +++ b/Lang/Oforth/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Flatten-a-list b/Lang/Oforth/Flatten-a-list new file mode 120000 index 0000000000..fa1d1e7c21 --- /dev/null +++ b/Lang/Oforth/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Flow-control-structures b/Lang/Oforth/Flow-control-structures new file mode 120000 index 0000000000..f2bea3e542 --- /dev/null +++ b/Lang/Oforth/Flow-control-structures @@ -0,0 +1 @@ +../../Task/Flow-control-structures/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Forward-difference b/Lang/Oforth/Forward-difference new file mode 120000 index 0000000000..08c2e1844e --- /dev/null +++ b/Lang/Oforth/Forward-difference @@ -0,0 +1 @@ +../../Task/Forward-difference/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Function-composition b/Lang/Oforth/Function-composition new file mode 120000 index 0000000000..eb5e3b5050 --- /dev/null +++ b/Lang/Oforth/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Function-definition b/Lang/Oforth/Function-definition new file mode 120000 index 0000000000..3bdd51c029 --- /dev/null +++ b/Lang/Oforth/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Function-prototype b/Lang/Oforth/Function-prototype new file mode 120000 index 0000000000..baf52702bf --- /dev/null +++ b/Lang/Oforth/Function-prototype @@ -0,0 +1 @@ +../../Task/Function-prototype/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Gamma-function b/Lang/Oforth/Gamma-function new file mode 120000 index 0000000000..776f51d411 --- /dev/null +++ b/Lang/Oforth/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Generate-lower-case-ASCII-alphabet b/Lang/Oforth/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..950be80bab --- /dev/null +++ b/Lang/Oforth/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Generic-swap b/Lang/Oforth/Generic-swap new file mode 120000 index 0000000000..4d41bdee5e --- /dev/null +++ b/Lang/Oforth/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Greatest-common-divisor b/Lang/Oforth/Greatest-common-divisor new file mode 120000 index 0000000000..8d217b94fc --- /dev/null +++ b/Lang/Oforth/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Greatest-element-of-a-list b/Lang/Oforth/Greatest-element-of-a-list new file mode 120000 index 0000000000..1a852315a3 --- /dev/null +++ b/Lang/Oforth/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Guess-the-number b/Lang/Oforth/Guess-the-number new file mode 120000 index 0000000000..b1e44e2275 --- /dev/null +++ b/Lang/Oforth/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Guess-the-number-With-feedback b/Lang/Oforth/Guess-the-number-With-feedback new file mode 120000 index 0000000000..8f258728d0 --- /dev/null +++ b/Lang/Oforth/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Hailstone-sequence b/Lang/Oforth/Hailstone-sequence new file mode 120000 index 0000000000..ace21463fb --- /dev/null +++ b/Lang/Oforth/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Happy-numbers b/Lang/Oforth/Happy-numbers new file mode 120000 index 0000000000..44ca713034 --- /dev/null +++ b/Lang/Oforth/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Harshad-or-Niven-series b/Lang/Oforth/Harshad-or-Niven-series new file mode 120000 index 0000000000..91bb270e4f --- /dev/null +++ b/Lang/Oforth/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Haversine-formula b/Lang/Oforth/Haversine-formula new file mode 120000 index 0000000000..854429568f --- /dev/null +++ b/Lang/Oforth/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Hello-world-Line-printer b/Lang/Oforth/Hello-world-Line-printer new file mode 120000 index 0000000000..90b57e3a80 --- /dev/null +++ b/Lang/Oforth/Hello-world-Line-printer @@ -0,0 +1 @@ +../../Task/Hello-world-Line-printer/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Hello-world-Newbie b/Lang/Oforth/Hello-world-Newbie new file mode 120000 index 0000000000..77ba9845ce --- /dev/null +++ b/Lang/Oforth/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Hello-world-Newline-omission b/Lang/Oforth/Hello-world-Newline-omission new file mode 120000 index 0000000000..56625e8ea9 --- /dev/null +++ b/Lang/Oforth/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Hello-world-Standard-error b/Lang/Oforth/Hello-world-Standard-error new file mode 120000 index 0000000000..c61ad036a8 --- /dev/null +++ b/Lang/Oforth/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Hello-world-Text b/Lang/Oforth/Hello-world-Text new file mode 120000 index 0000000000..c15f883ce7 --- /dev/null +++ b/Lang/Oforth/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Higher-order-functions b/Lang/Oforth/Higher-order-functions new file mode 120000 index 0000000000..16bee00d76 --- /dev/null +++ b/Lang/Oforth/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Hofstadter-Conway-$10,000-sequence b/Lang/Oforth/Hofstadter-Conway-$10,000-sequence new file mode 120000 index 0000000000..8edf460ef6 --- /dev/null +++ b/Lang/Oforth/Hofstadter-Conway-$10,000-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Conway-$10,000-sequence/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Hofstadter-Figure-Figure-sequences b/Lang/Oforth/Hofstadter-Figure-Figure-sequences new file mode 120000 index 0000000000..bb74c10814 --- /dev/null +++ b/Lang/Oforth/Hofstadter-Figure-Figure-sequences @@ -0,0 +1 @@ +../../Task/Hofstadter-Figure-Figure-sequences/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Hofstadter-Q-sequence b/Lang/Oforth/Hofstadter-Q-sequence new file mode 120000 index 0000000000..53346f2410 --- /dev/null +++ b/Lang/Oforth/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Include-a-file b/Lang/Oforth/Include-a-file new file mode 120000 index 0000000000..5cab4b231b --- /dev/null +++ b/Lang/Oforth/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Increment-a-numerical-string b/Lang/Oforth/Increment-a-numerical-string new file mode 120000 index 0000000000..2bb5983ea0 --- /dev/null +++ b/Lang/Oforth/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Infinity b/Lang/Oforth/Infinity new file mode 120000 index 0000000000..db08dab27c --- /dev/null +++ b/Lang/Oforth/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Inheritance-Multiple b/Lang/Oforth/Inheritance-Multiple new file mode 120000 index 0000000000..5565834460 --- /dev/null +++ b/Lang/Oforth/Inheritance-Multiple @@ -0,0 +1 @@ +../../Task/Inheritance-Multiple/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Inheritance-Single b/Lang/Oforth/Inheritance-Single new file mode 120000 index 0000000000..e6757a88e4 --- /dev/null +++ b/Lang/Oforth/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Input-loop b/Lang/Oforth/Input-loop new file mode 120000 index 0000000000..d8e21972a9 --- /dev/null +++ b/Lang/Oforth/Input-loop @@ -0,0 +1 @@ +../../Task/Input-loop/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Integer-comparison b/Lang/Oforth/Integer-comparison new file mode 120000 index 0000000000..c7a65f1134 --- /dev/null +++ b/Lang/Oforth/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Integer-sequence b/Lang/Oforth/Integer-sequence new file mode 120000 index 0000000000..f2ac013270 --- /dev/null +++ b/Lang/Oforth/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Interactive-programming b/Lang/Oforth/Interactive-programming new file mode 120000 index 0000000000..67a125fbb2 --- /dev/null +++ b/Lang/Oforth/Interactive-programming @@ -0,0 +1 @@ +../../Task/Interactive-programming/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Introspection b/Lang/Oforth/Introspection new file mode 120000 index 0000000000..aa0831e682 --- /dev/null +++ b/Lang/Oforth/Introspection @@ -0,0 +1 @@ +../../Task/Introspection/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Iterated-digits-squaring b/Lang/Oforth/Iterated-digits-squaring new file mode 120000 index 0000000000..f91edd395b --- /dev/null +++ b/Lang/Oforth/Iterated-digits-squaring @@ -0,0 +1 @@ +../../Task/Iterated-digits-squaring/Oforth \ No newline at end of file diff --git a/Lang/Oforth/JSON b/Lang/Oforth/JSON new file mode 120000 index 0000000000..6e98652bf3 --- /dev/null +++ b/Lang/Oforth/JSON @@ -0,0 +1 @@ +../../Task/JSON/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Jensens-Device b/Lang/Oforth/Jensens-Device new file mode 120000 index 0000000000..ce7e355a9f --- /dev/null +++ b/Lang/Oforth/Jensens-Device @@ -0,0 +1 @@ +../../Task/Jensens-Device/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Josephus-problem b/Lang/Oforth/Josephus-problem new file mode 120000 index 0000000000..ec7b5968aa --- /dev/null +++ b/Lang/Oforth/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Keyboard-input-Flush-the-keyboard-buffer b/Lang/Oforth/Keyboard-input-Flush-the-keyboard-buffer new file mode 120000 index 0000000000..e63d147427 --- /dev/null +++ b/Lang/Oforth/Keyboard-input-Flush-the-keyboard-buffer @@ -0,0 +1 @@ +../../Task/Keyboard-input-Flush-the-keyboard-buffer/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Keyboard-input-Keypress-check b/Lang/Oforth/Keyboard-input-Keypress-check new file mode 120000 index 0000000000..76e53ac674 --- /dev/null +++ b/Lang/Oforth/Keyboard-input-Keypress-check @@ -0,0 +1 @@ +../../Task/Keyboard-input-Keypress-check/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/Oforth/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..2eae1017ec --- /dev/null +++ b/Lang/Oforth/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Knapsack-problem-Continuous b/Lang/Oforth/Knapsack-problem-Continuous new file mode 120000 index 0000000000..656e317627 --- /dev/null +++ b/Lang/Oforth/Knapsack-problem-Continuous @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Continuous/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Knuth-shuffle b/Lang/Oforth/Knuth-shuffle new file mode 120000 index 0000000000..062f8b8755 --- /dev/null +++ b/Lang/Oforth/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Largest-int-from-concatenated-ints b/Lang/Oforth/Largest-int-from-concatenated-ints new file mode 120000 index 0000000000..f6e141b8a5 --- /dev/null +++ b/Lang/Oforth/Largest-int-from-concatenated-ints @@ -0,0 +1 @@ +../../Task/Largest-int-from-concatenated-ints/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Last-Friday-of-each-month b/Lang/Oforth/Last-Friday-of-each-month new file mode 120000 index 0000000000..57d102e42e --- /dev/null +++ b/Lang/Oforth/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Leap-year b/Lang/Oforth/Leap-year new file mode 120000 index 0000000000..4334fa45df --- /dev/null +++ b/Lang/Oforth/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Least-common-multiple b/Lang/Oforth/Least-common-multiple new file mode 120000 index 0000000000..2d768caebc --- /dev/null +++ b/Lang/Oforth/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Left-factorials b/Lang/Oforth/Left-factorials new file mode 120000 index 0000000000..bc9ebe5d07 --- /dev/null +++ b/Lang/Oforth/Left-factorials @@ -0,0 +1 @@ +../../Task/Left-factorials/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Linear-congruential-generator b/Lang/Oforth/Linear-congruential-generator new file mode 120000 index 0000000000..c2f65e570b --- /dev/null +++ b/Lang/Oforth/Linear-congruential-generator @@ -0,0 +1 @@ +../../Task/Linear-congruential-generator/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Literals-Floating-point b/Lang/Oforth/Literals-Floating-point new file mode 120000 index 0000000000..569e2c79e8 --- /dev/null +++ b/Lang/Oforth/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Literals-String b/Lang/Oforth/Literals-String new file mode 120000 index 0000000000..58f7fa061a --- /dev/null +++ b/Lang/Oforth/Literals-String @@ -0,0 +1 @@ +../../Task/Literals-String/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Logical-operations b/Lang/Oforth/Logical-operations new file mode 120000 index 0000000000..f4fc3c2ea2 --- /dev/null +++ b/Lang/Oforth/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Long-multiplication b/Lang/Oforth/Long-multiplication new file mode 120000 index 0000000000..bab6b5baed --- /dev/null +++ b/Lang/Oforth/Long-multiplication @@ -0,0 +1 @@ +../../Task/Long-multiplication/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Look-and-say-sequence b/Lang/Oforth/Look-and-say-sequence new file mode 120000 index 0000000000..a15da6092d --- /dev/null +++ b/Lang/Oforth/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Loop-over-multiple-arrays-simultaneously b/Lang/Oforth/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..e0a2569e5a --- /dev/null +++ b/Lang/Oforth/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Loops-Break b/Lang/Oforth/Loops-Break new file mode 120000 index 0000000000..0e054e3745 --- /dev/null +++ b/Lang/Oforth/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Loops-Continue b/Lang/Oforth/Loops-Continue new file mode 120000 index 0000000000..11aa7ce7d4 --- /dev/null +++ b/Lang/Oforth/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Loops-Do-while b/Lang/Oforth/Loops-Do-while new file mode 120000 index 0000000000..f7226c160c --- /dev/null +++ b/Lang/Oforth/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Loops-Downward-for b/Lang/Oforth/Loops-Downward-for new file mode 120000 index 0000000000..4aa2c518f0 --- /dev/null +++ b/Lang/Oforth/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Loops-For b/Lang/Oforth/Loops-For new file mode 120000 index 0000000000..58c9418b70 --- /dev/null +++ b/Lang/Oforth/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Loops-For-with-a-specified-step b/Lang/Oforth/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..f6c8172570 --- /dev/null +++ b/Lang/Oforth/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Loops-Foreach b/Lang/Oforth/Loops-Foreach new file mode 120000 index 0000000000..6537f249aa --- /dev/null +++ b/Lang/Oforth/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Loops-Infinite b/Lang/Oforth/Loops-Infinite new file mode 120000 index 0000000000..4a3c7e7f25 --- /dev/null +++ b/Lang/Oforth/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Loops-N-plus-one-half b/Lang/Oforth/Loops-N-plus-one-half new file mode 120000 index 0000000000..0dfae78320 --- /dev/null +++ b/Lang/Oforth/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Loops-While b/Lang/Oforth/Loops-While new file mode 120000 index 0000000000..0bad04afa9 --- /dev/null +++ b/Lang/Oforth/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Ludic-numbers b/Lang/Oforth/Ludic-numbers new file mode 120000 index 0000000000..980b9d333b --- /dev/null +++ b/Lang/Oforth/Ludic-numbers @@ -0,0 +1 @@ +../../Task/Ludic-numbers/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Luhn-test-of-credit-card-numbers b/Lang/Oforth/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..d248469055 --- /dev/null +++ b/Lang/Oforth/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Mad-Libs b/Lang/Oforth/Mad-Libs new file mode 120000 index 0000000000..f8842f3dab --- /dev/null +++ b/Lang/Oforth/Mad-Libs @@ -0,0 +1 @@ +../../Task/Mad-Libs/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Magic-squares-of-odd-order b/Lang/Oforth/Magic-squares-of-odd-order new file mode 120000 index 0000000000..167210f4d8 --- /dev/null +++ b/Lang/Oforth/Magic-squares-of-odd-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-odd-order/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Map-range b/Lang/Oforth/Map-range new file mode 120000 index 0000000000..2597ff32d2 --- /dev/null +++ b/Lang/Oforth/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Metered-concurrency b/Lang/Oforth/Metered-concurrency new file mode 120000 index 0000000000..9e01d71d52 --- /dev/null +++ b/Lang/Oforth/Metered-concurrency @@ -0,0 +1 @@ +../../Task/Metered-concurrency/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Middle-three-digits b/Lang/Oforth/Middle-three-digits new file mode 120000 index 0000000000..71de1cec93 --- /dev/null +++ b/Lang/Oforth/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Modular-exponentiation b/Lang/Oforth/Modular-exponentiation new file mode 120000 index 0000000000..9babb5e740 --- /dev/null +++ b/Lang/Oforth/Modular-exponentiation @@ -0,0 +1 @@ +../../Task/Modular-exponentiation/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Modular-inverse b/Lang/Oforth/Modular-inverse new file mode 120000 index 0000000000..6f4e79ffb1 --- /dev/null +++ b/Lang/Oforth/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Multifactorial b/Lang/Oforth/Multifactorial new file mode 120000 index 0000000000..c6c891a4e0 --- /dev/null +++ b/Lang/Oforth/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Multiple-distinct-objects b/Lang/Oforth/Multiple-distinct-objects new file mode 120000 index 0000000000..69c2d2f187 --- /dev/null +++ b/Lang/Oforth/Multiple-distinct-objects @@ -0,0 +1 @@ +../../Task/Multiple-distinct-objects/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Mutual-recursion b/Lang/Oforth/Mutual-recursion new file mode 120000 index 0000000000..6126a03731 --- /dev/null +++ b/Lang/Oforth/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Narcissistic-decimal-number b/Lang/Oforth/Narcissistic-decimal-number new file mode 120000 index 0000000000..d7ddcc6ae6 --- /dev/null +++ b/Lang/Oforth/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Nth b/Lang/Oforth/Nth new file mode 120000 index 0000000000..8c20622160 --- /dev/null +++ b/Lang/Oforth/Nth @@ -0,0 +1 @@ +../../Task/Nth/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Nth-root b/Lang/Oforth/Nth-root new file mode 120000 index 0000000000..5c468ce18e --- /dev/null +++ b/Lang/Oforth/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Null-object b/Lang/Oforth/Null-object new file mode 120000 index 0000000000..34f59ce6b8 --- /dev/null +++ b/Lang/Oforth/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Number-reversal-game b/Lang/Oforth/Number-reversal-game new file mode 120000 index 0000000000..1dda95dc57 --- /dev/null +++ b/Lang/Oforth/Number-reversal-game @@ -0,0 +1 @@ +../../Task/Number-reversal-game/Oforth \ No newline at end of file diff --git a/Lang/Oforth/One-dimensional-cellular-automata b/Lang/Oforth/One-dimensional-cellular-automata new file mode 120000 index 0000000000..e3e4506ad4 --- /dev/null +++ b/Lang/Oforth/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Ordered-words b/Lang/Oforth/Ordered-words new file mode 120000 index 0000000000..4f51de3d5c --- /dev/null +++ b/Lang/Oforth/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Palindrome-detection b/Lang/Oforth/Palindrome-detection new file mode 120000 index 0000000000..a161866036 --- /dev/null +++ b/Lang/Oforth/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Parallel-calculations b/Lang/Oforth/Parallel-calculations new file mode 120000 index 0000000000..4ce31d67e2 --- /dev/null +++ b/Lang/Oforth/Parallel-calculations @@ -0,0 +1 @@ +../../Task/Parallel-calculations/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Parsing-RPN-calculator-algorithm b/Lang/Oforth/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..6fb6caafa8 --- /dev/null +++ b/Lang/Oforth/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Partial-function-application b/Lang/Oforth/Partial-function-application new file mode 120000 index 0000000000..1b35b4ba8f --- /dev/null +++ b/Lang/Oforth/Partial-function-application @@ -0,0 +1 @@ +../../Task/Partial-function-application/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Pascals-triangle b/Lang/Oforth/Pascals-triangle new file mode 120000 index 0000000000..608d9f5a71 --- /dev/null +++ b/Lang/Oforth/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Perfect-numbers b/Lang/Oforth/Perfect-numbers new file mode 120000 index 0000000000..8b69b59d86 --- /dev/null +++ b/Lang/Oforth/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Phrase-reversals b/Lang/Oforth/Phrase-reversals new file mode 120000 index 0000000000..46e15e9cd2 --- /dev/null +++ b/Lang/Oforth/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Pi b/Lang/Oforth/Pi new file mode 120000 index 0000000000..bcb162509f --- /dev/null +++ b/Lang/Oforth/Pi @@ -0,0 +1 @@ +../../Task/Pi/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Pick-random-element b/Lang/Oforth/Pick-random-element new file mode 120000 index 0000000000..a0af2dd2b8 --- /dev/null +++ b/Lang/Oforth/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Polymorphism b/Lang/Oforth/Polymorphism new file mode 120000 index 0000000000..e2fdd9ed7c --- /dev/null +++ b/Lang/Oforth/Polymorphism @@ -0,0 +1 @@ +../../Task/Polymorphism/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Price-fraction b/Lang/Oforth/Price-fraction new file mode 120000 index 0000000000..4064d4fd25 --- /dev/null +++ b/Lang/Oforth/Price-fraction @@ -0,0 +1 @@ +../../Task/Price-fraction/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Primality-by-trial-division b/Lang/Oforth/Primality-by-trial-division new file mode 120000 index 0000000000..094f0c2514 --- /dev/null +++ b/Lang/Oforth/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Prime-decomposition b/Lang/Oforth/Prime-decomposition new file mode 120000 index 0000000000..00bcf8fafd --- /dev/null +++ b/Lang/Oforth/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Program-termination b/Lang/Oforth/Program-termination new file mode 120000 index 0000000000..e22c72e515 --- /dev/null +++ b/Lang/Oforth/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Quaternion-type b/Lang/Oforth/Quaternion-type new file mode 120000 index 0000000000..51caedda0e --- /dev/null +++ b/Lang/Oforth/Quaternion-type @@ -0,0 +1 @@ +../../Task/Quaternion-type/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Queue-Definition b/Lang/Oforth/Queue-Definition new file mode 120000 index 0000000000..9ce0625fdd --- /dev/null +++ b/Lang/Oforth/Queue-Definition @@ -0,0 +1 @@ +../../Task/Queue-Definition/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Queue-Usage b/Lang/Oforth/Queue-Usage new file mode 120000 index 0000000000..c574fa6397 --- /dev/null +++ b/Lang/Oforth/Queue-Usage @@ -0,0 +1 @@ +../../Task/Queue-Usage/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Quine b/Lang/Oforth/Quine new file mode 120000 index 0000000000..7db7f85958 --- /dev/null +++ b/Lang/Oforth/Quine @@ -0,0 +1 @@ +../../Task/Quine/Oforth \ No newline at end of file diff --git a/Lang/Oforth/README b/Lang/Oforth/README new file mode 100644 index 0000000000..a344cd7e62 --- /dev/null +++ b/Lang/Oforth/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Oforth diff --git a/Lang/Oforth/Range-expansion b/Lang/Oforth/Range-expansion new file mode 120000 index 0000000000..5eb6b692d9 --- /dev/null +++ b/Lang/Oforth/Range-expansion @@ -0,0 +1 @@ +../../Task/Range-expansion/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Read-a-file-line-by-line b/Lang/Oforth/Read-a-file-line-by-line new file mode 120000 index 0000000000..3e04e8290a --- /dev/null +++ b/Lang/Oforth/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Real-constants-and-functions b/Lang/Oforth/Real-constants-and-functions new file mode 120000 index 0000000000..90f45b779a --- /dev/null +++ b/Lang/Oforth/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Remove-lines-from-a-file b/Lang/Oforth/Remove-lines-from-a-file new file mode 120000 index 0000000000..4550228b8c --- /dev/null +++ b/Lang/Oforth/Remove-lines-from-a-file @@ -0,0 +1 @@ +../../Task/Remove-lines-from-a-file/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Rep-string b/Lang/Oforth/Rep-string new file mode 120000 index 0000000000..02e14ad555 --- /dev/null +++ b/Lang/Oforth/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Repeat-a-string b/Lang/Oforth/Repeat-a-string new file mode 120000 index 0000000000..b1a0cf9ed1 --- /dev/null +++ b/Lang/Oforth/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Respond-to-an-unknown-method-call b/Lang/Oforth/Respond-to-an-unknown-method-call new file mode 120000 index 0000000000..8f4cf6bae0 --- /dev/null +++ b/Lang/Oforth/Respond-to-an-unknown-method-call @@ -0,0 +1 @@ +../../Task/Respond-to-an-unknown-method-call/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Return-multiple-values b/Lang/Oforth/Return-multiple-values new file mode 120000 index 0000000000..abc3387154 --- /dev/null +++ b/Lang/Oforth/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Reverse-a-string b/Lang/Oforth/Reverse-a-string new file mode 120000 index 0000000000..2ba2362f45 --- /dev/null +++ b/Lang/Oforth/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Reverse-words-in-a-string b/Lang/Oforth/Reverse-words-in-a-string new file mode 120000 index 0000000000..fcf67423b4 --- /dev/null +++ b/Lang/Oforth/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Roman-numerals-Encode b/Lang/Oforth/Roman-numerals-Encode new file mode 120000 index 0000000000..fa93e8e675 --- /dev/null +++ b/Lang/Oforth/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Roots-of-a-function b/Lang/Oforth/Roots-of-a-function new file mode 120000 index 0000000000..1f0ac33eee --- /dev/null +++ b/Lang/Oforth/Roots-of-a-function @@ -0,0 +1 @@ +../../Task/Roots-of-a-function/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Rot-13 b/Lang/Oforth/Rot-13 new file mode 120000 index 0000000000..ac761e1d03 --- /dev/null +++ b/Lang/Oforth/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Run-length-encoding b/Lang/Oforth/Run-length-encoding new file mode 120000 index 0000000000..320ce3008b --- /dev/null +++ b/Lang/Oforth/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Runtime-evaluation b/Lang/Oforth/Runtime-evaluation new file mode 120000 index 0000000000..ff499950f2 --- /dev/null +++ b/Lang/Oforth/Runtime-evaluation @@ -0,0 +1 @@ +../../Task/Runtime-evaluation/Oforth \ No newline at end of file diff --git a/Lang/Oforth/SEDOLs b/Lang/Oforth/SEDOLs new file mode 120000 index 0000000000..f15858d936 --- /dev/null +++ b/Lang/Oforth/SEDOLs @@ -0,0 +1 @@ +../../Task/SEDOLs/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Search-a-list b/Lang/Oforth/Search-a-list new file mode 120000 index 0000000000..30123ead20 --- /dev/null +++ b/Lang/Oforth/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Semiprime b/Lang/Oforth/Semiprime new file mode 120000 index 0000000000..4c258dbbcf --- /dev/null +++ b/Lang/Oforth/Semiprime @@ -0,0 +1 @@ +../../Task/Semiprime/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Semordnilap b/Lang/Oforth/Semordnilap new file mode 120000 index 0000000000..1db3b7921e --- /dev/null +++ b/Lang/Oforth/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Send-an-unknown-method-call b/Lang/Oforth/Send-an-unknown-method-call new file mode 120000 index 0000000000..77805ec852 --- /dev/null +++ b/Lang/Oforth/Send-an-unknown-method-call @@ -0,0 +1 @@ +../../Task/Send-an-unknown-method-call/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sequence-of-non-squares b/Lang/Oforth/Sequence-of-non-squares new file mode 120000 index 0000000000..bf5d050777 --- /dev/null +++ b/Lang/Oforth/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sequence-of-primes-by-Trial-Division b/Lang/Oforth/Sequence-of-primes-by-Trial-Division new file mode 120000 index 0000000000..bcf087cb72 --- /dev/null +++ b/Lang/Oforth/Sequence-of-primes-by-Trial-Division @@ -0,0 +1 @@ +../../Task/Sequence-of-primes-by-Trial-Division/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Shell-one-liner b/Lang/Oforth/Shell-one-liner new file mode 120000 index 0000000000..b6766605cf --- /dev/null +++ b/Lang/Oforth/Shell-one-liner @@ -0,0 +1 @@ +../../Task/Shell-one-liner/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Show-the-epoch b/Lang/Oforth/Show-the-epoch new file mode 120000 index 0000000000..cd0c25801a --- /dev/null +++ b/Lang/Oforth/Show-the-epoch @@ -0,0 +1 @@ +../../Task/Show-the-epoch/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sierpinski-carpet b/Lang/Oforth/Sierpinski-carpet new file mode 120000 index 0000000000..efc421a530 --- /dev/null +++ b/Lang/Oforth/Sierpinski-carpet @@ -0,0 +1 @@ +../../Task/Sierpinski-carpet/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sierpinski-triangle b/Lang/Oforth/Sierpinski-triangle new file mode 120000 index 0000000000..634da048ea --- /dev/null +++ b/Lang/Oforth/Sierpinski-triangle @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sieve-of-Eratosthenes b/Lang/Oforth/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..9e9fb09caa --- /dev/null +++ b/Lang/Oforth/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Singleton b/Lang/Oforth/Singleton new file mode 120000 index 0000000000..c432550fa3 --- /dev/null +++ b/Lang/Oforth/Singleton @@ -0,0 +1 @@ +../../Task/Singleton/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Singly-linked-list-Element-definition b/Lang/Oforth/Singly-linked-list-Element-definition new file mode 120000 index 0000000000..3198e56ffd --- /dev/null +++ b/Lang/Oforth/Singly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-definition/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Singly-linked-list-Element-insertion b/Lang/Oforth/Singly-linked-list-Element-insertion new file mode 120000 index 0000000000..84ae0aded4 --- /dev/null +++ b/Lang/Oforth/Singly-linked-list-Element-insertion @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-insertion/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Singly-linked-list-Traversal b/Lang/Oforth/Singly-linked-list-Traversal new file mode 120000 index 0000000000..c5b42e6fae --- /dev/null +++ b/Lang/Oforth/Singly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Traversal/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sleep b/Lang/Oforth/Sleep new file mode 120000 index 0000000000..b15fa0b6cd --- /dev/null +++ b/Lang/Oforth/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sort-an-array-of-composite-structures b/Lang/Oforth/Sort-an-array-of-composite-structures new file mode 120000 index 0000000000..3f7557d1a0 --- /dev/null +++ b/Lang/Oforth/Sort-an-array-of-composite-structures @@ -0,0 +1 @@ +../../Task/Sort-an-array-of-composite-structures/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sort-an-integer-array b/Lang/Oforth/Sort-an-integer-array new file mode 120000 index 0000000000..62e34c62e0 --- /dev/null +++ b/Lang/Oforth/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sort-using-a-custom-comparator b/Lang/Oforth/Sort-using-a-custom-comparator new file mode 120000 index 0000000000..6fbd37b326 --- /dev/null +++ b/Lang/Oforth/Sort-using-a-custom-comparator @@ -0,0 +1 @@ +../../Task/Sort-using-a-custom-comparator/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sorting-algorithms-Insertion-sort b/Lang/Oforth/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..5660ed0762 --- /dev/null +++ b/Lang/Oforth/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sorting-algorithms-Quicksort b/Lang/Oforth/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..95f84ec23e --- /dev/null +++ b/Lang/Oforth/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sorting-algorithms-Selection-sort b/Lang/Oforth/Sorting-algorithms-Selection-sort new file mode 120000 index 0000000000..44d4ac6641 --- /dev/null +++ b/Lang/Oforth/Sorting-algorithms-Selection-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Selection-sort/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sorting-algorithms-Sleep-sort b/Lang/Oforth/Sorting-algorithms-Sleep-sort new file mode 120000 index 0000000000..d3458661be --- /dev/null +++ b/Lang/Oforth/Sorting-algorithms-Sleep-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Sleep-sort/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Stack b/Lang/Oforth/Stack new file mode 120000 index 0000000000..5430b2e97f --- /dev/null +++ b/Lang/Oforth/Stack @@ -0,0 +1 @@ +../../Task/Stack/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Stack-traces b/Lang/Oforth/Stack-traces new file mode 120000 index 0000000000..bae1ebb188 --- /dev/null +++ b/Lang/Oforth/Stack-traces @@ -0,0 +1 @@ +../../Task/Stack-traces/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Start-from-a-main-routine b/Lang/Oforth/Start-from-a-main-routine new file mode 120000 index 0000000000..4f75c373da --- /dev/null +++ b/Lang/Oforth/Start-from-a-main-routine @@ -0,0 +1 @@ +../../Task/Start-from-a-main-routine/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Statistics-Basic b/Lang/Oforth/Statistics-Basic new file mode 120000 index 0000000000..cbda2e8846 --- /dev/null +++ b/Lang/Oforth/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Stern-Brocot-sequence b/Lang/Oforth/Stern-Brocot-sequence new file mode 120000 index 0000000000..1f1f970c45 --- /dev/null +++ b/Lang/Oforth/Stern-Brocot-sequence @@ -0,0 +1 @@ +../../Task/Stern-Brocot-sequence/Oforth \ No newline at end of file diff --git a/Lang/Oforth/String-append b/Lang/Oforth/String-append new file mode 120000 index 0000000000..de6510582d --- /dev/null +++ b/Lang/Oforth/String-append @@ -0,0 +1 @@ +../../Task/String-append/Oforth \ No newline at end of file diff --git a/Lang/Oforth/String-case b/Lang/Oforth/String-case new file mode 120000 index 0000000000..0f3f1cf815 --- /dev/null +++ b/Lang/Oforth/String-case @@ -0,0 +1 @@ +../../Task/String-case/Oforth \ No newline at end of file diff --git a/Lang/Oforth/String-comparison b/Lang/Oforth/String-comparison new file mode 120000 index 0000000000..b10dd77a52 --- /dev/null +++ b/Lang/Oforth/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/Oforth \ No newline at end of file diff --git a/Lang/Oforth/String-concatenation b/Lang/Oforth/String-concatenation new file mode 120000 index 0000000000..4df30c85c1 --- /dev/null +++ b/Lang/Oforth/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Oforth \ No newline at end of file diff --git a/Lang/Oforth/String-matching b/Lang/Oforth/String-matching new file mode 120000 index 0000000000..f8c50889cc --- /dev/null +++ b/Lang/Oforth/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/Oforth \ No newline at end of file diff --git a/Lang/Oforth/String-prepend b/Lang/Oforth/String-prepend new file mode 120000 index 0000000000..0b8be36c09 --- /dev/null +++ b/Lang/Oforth/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Strip-a-set-of-characters-from-a-string b/Lang/Oforth/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..46ef74cafa --- /dev/null +++ b/Lang/Oforth/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Strip-comments-from-a-string b/Lang/Oforth/Strip-comments-from-a-string new file mode 120000 index 0000000000..729c3fa83e --- /dev/null +++ b/Lang/Oforth/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Substring b/Lang/Oforth/Substring new file mode 120000 index 0000000000..a0557274b9 --- /dev/null +++ b/Lang/Oforth/Substring @@ -0,0 +1 @@ +../../Task/Substring/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Substring-Top-and-tail b/Lang/Oforth/Substring-Top-and-tail new file mode 120000 index 0000000000..d42c4e7193 --- /dev/null +++ b/Lang/Oforth/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sum-and-product-of-an-array b/Lang/Oforth/Sum-and-product-of-an-array new file mode 120000 index 0000000000..da2aee3ffa --- /dev/null +++ b/Lang/Oforth/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sum-digits-of-an-integer b/Lang/Oforth/Sum-digits-of-an-integer new file mode 120000 index 0000000000..d007a8be96 --- /dev/null +++ b/Lang/Oforth/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sum-multiples-of-3-and-5 b/Lang/Oforth/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..ad63fda95a --- /dev/null +++ b/Lang/Oforth/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sum-of-a-series b/Lang/Oforth/Sum-of-a-series new file mode 120000 index 0000000000..7176fee9ed --- /dev/null +++ b/Lang/Oforth/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Sum-of-squares b/Lang/Oforth/Sum-of-squares new file mode 120000 index 0000000000..0ee7251f4d --- /dev/null +++ b/Lang/Oforth/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Synchronous-concurrency b/Lang/Oforth/Synchronous-concurrency new file mode 120000 index 0000000000..8e1c745986 --- /dev/null +++ b/Lang/Oforth/Synchronous-concurrency @@ -0,0 +1 @@ +../../Task/Synchronous-concurrency/Oforth \ No newline at end of file diff --git a/Lang/Oforth/System-time b/Lang/Oforth/System-time new file mode 120000 index 0000000000..877145243e --- /dev/null +++ b/Lang/Oforth/System-time @@ -0,0 +1 @@ +../../Task/System-time/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Temperature-conversion b/Lang/Oforth/Temperature-conversion new file mode 120000 index 0000000000..646d6c2684 --- /dev/null +++ b/Lang/Oforth/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Test-a-function b/Lang/Oforth/Test-a-function new file mode 120000 index 0000000000..97e222280b --- /dev/null +++ b/Lang/Oforth/Test-a-function @@ -0,0 +1 @@ +../../Task/Test-a-function/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Tokenize-a-string b/Lang/Oforth/Tokenize-a-string new file mode 120000 index 0000000000..3a960d2350 --- /dev/null +++ b/Lang/Oforth/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Top-rank-per-group b/Lang/Oforth/Top-rank-per-group new file mode 120000 index 0000000000..1656317221 --- /dev/null +++ b/Lang/Oforth/Top-rank-per-group @@ -0,0 +1 @@ +../../Task/Top-rank-per-group/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Topic-variable b/Lang/Oforth/Topic-variable new file mode 120000 index 0000000000..f06b8e3d4c --- /dev/null +++ b/Lang/Oforth/Topic-variable @@ -0,0 +1 @@ +../../Task/Topic-variable/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Towers-of-Hanoi b/Lang/Oforth/Towers-of-Hanoi new file mode 120000 index 0000000000..e89f6081eb --- /dev/null +++ b/Lang/Oforth/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Tree-traversal b/Lang/Oforth/Tree-traversal new file mode 120000 index 0000000000..867d926109 --- /dev/null +++ b/Lang/Oforth/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Trigonometric-functions b/Lang/Oforth/Trigonometric-functions new file mode 120000 index 0000000000..95927ec2ed --- /dev/null +++ b/Lang/Oforth/Trigonometric-functions @@ -0,0 +1 @@ +../../Task/Trigonometric-functions/Oforth \ No newline at end of file diff --git a/Lang/Oforth/User-input-Text b/Lang/Oforth/User-input-Text new file mode 120000 index 0000000000..b6e1cf424c --- /dev/null +++ b/Lang/Oforth/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Variables b/Lang/Oforth/Variables new file mode 120000 index 0000000000..adb429867a --- /dev/null +++ b/Lang/Oforth/Variables @@ -0,0 +1 @@ +../../Task/Variables/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Variadic-function b/Lang/Oforth/Variadic-function new file mode 120000 index 0000000000..74a31c9566 --- /dev/null +++ b/Lang/Oforth/Variadic-function @@ -0,0 +1 @@ +../../Task/Variadic-function/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Y-combinator b/Lang/Oforth/Y-combinator new file mode 120000 index 0000000000..ccb8c32804 --- /dev/null +++ b/Lang/Oforth/Y-combinator @@ -0,0 +1 @@ +../../Task/Y-combinator/Oforth \ No newline at end of file diff --git a/Lang/Oforth/Zero-to-the-zero-power b/Lang/Oforth/Zero-to-the-zero-power new file mode 120000 index 0000000000..3ad0be5d3c --- /dev/null +++ b/Lang/Oforth/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/Oforth \ No newline at end of file diff --git a/Lang/Ol/00DESCRIPTION b/Lang/Ol/00DESCRIPTION new file mode 100644 index 0000000000..5d57b6433f --- /dev/null +++ b/Lang/Ol/00DESCRIPTION @@ -0,0 +1,14 @@ +{{language +|exec=interpreted +|checking=dynamic +|gc=yes +|site=http://yuriy-chumak.github.io/OL/}} +{{implementation|Lisp}} +[[Category:Lisp Implementations]] + +'''OL (Owl Lisp)''' is a purely (mostly) functional dialect of Lisp. It implements an extended subset of R5RS Scheme. + +You can try RosettaCode tasks directly in the project page. + +==See Also== +* [https://github.com/yuriy-chumak/OL Github project page] \ No newline at end of file diff --git a/Lang/Ol/README b/Lang/Ol/README new file mode 100644 index 0000000000..cc0a5bb6f8 --- /dev/null +++ b/Lang/Ol/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Ol diff --git a/Lang/OpenLisp/00DESCRIPTION b/Lang/OpenLisp/00DESCRIPTION new file mode 100644 index 0000000000..4bf872fa8b --- /dev/null +++ b/Lang/OpenLisp/00DESCRIPTION @@ -0,0 +1,7 @@ +{{language|openlisp}} + +From: http://www.eligis.com + +OpenLisp is a KISS (Keep It Simple, Stupid) full conforming implementation of ISO/IEC 13816:2007 ISLISP Language, the International Standard version of Lisp. Entirely written in C, OpenLisp has been ported on more than 90 different architectures (compiler/OS/processor) from small 16 bits MS-DOS systems to 64 bits systems such as DEC Alpha processor. All major processors (Intel 16/32 bits, Intel IA64, AMD/Intel EM64T, Sparc 32 bits and UltraSparc 64 bits, Motorola 68k and 88k, RS6000, PowerPC, MIPS R3000/R4x00/R8000/R10000, HP PA 32 and 64 bits mode, Alpha 32 and 64 bits mode, IBM s390, StrongARM, VAX) are supported. It even runs on Pocket PC. + +OpenLisp is essentially a very fast interpreter (see benchmarks) that competes in speed with some CLtL compilers. It also has a compiler that produce LAP to be interpreted by a native virtual machine. You can even make standalone applications using the C code backend that also will make your code run from 10 to 20 times faster. OpenLisp is written in ISO C for the kernel and using POSIX like interface for the operating System when available. \ No newline at end of file diff --git a/Lang/OpenLisp/Empty-program b/Lang/OpenLisp/Empty-program new file mode 120000 index 0000000000..909b16d4a3 --- /dev/null +++ b/Lang/OpenLisp/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/OpenLisp \ No newline at end of file diff --git a/Lang/OpenLisp/Hello-world-Text b/Lang/OpenLisp/Hello-world-Text new file mode 120000 index 0000000000..a9804d57a0 --- /dev/null +++ b/Lang/OpenLisp/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/OpenLisp \ No newline at end of file diff --git a/Lang/OpenLisp/README b/Lang/OpenLisp/README new file mode 100644 index 0000000000..d5ac7406df --- /dev/null +++ b/Lang/OpenLisp/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:OpenLisp diff --git a/Lang/PHL/00DESCRIPTION b/Lang/PHL/00DESCRIPTION new file mode 100644 index 0000000000..1c690e6a77 --- /dev/null +++ b/Lang/PHL/00DESCRIPTION @@ -0,0 +1,18 @@ +{{stub}} +{{language +|site=http://www.kaivos.org/doc/phl/phl.html +|exec=machine +|gc=yes +|safety=unsafe +|parampass=value +|express=implicit +|checking=static +|strength=strong +|tags=phl +}} + +{{language programming paradigm|Object-oriented}} +{{language programming paradigm|Imperative}} +{{language programming paradigm|generic}} + +'''Proceed High Language''' is an general purpose object-oriented language. \ No newline at end of file diff --git a/Lang/PHL/100-doors b/Lang/PHL/100-doors new file mode 120000 index 0000000000..b29c41ff33 --- /dev/null +++ b/Lang/PHL/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/PHL \ No newline at end of file diff --git a/Lang/PHL/99-Bottles-of-Beer b/Lang/PHL/99-Bottles-of-Beer new file mode 120000 index 0000000000..93dd8da533 --- /dev/null +++ b/Lang/PHL/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/PHL \ No newline at end of file diff --git a/Lang/PHL/Arithmetic-Integer b/Lang/PHL/Arithmetic-Integer new file mode 120000 index 0000000000..45c6dfe90f --- /dev/null +++ b/Lang/PHL/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/PHL \ No newline at end of file diff --git a/Lang/PHL/Classes b/Lang/PHL/Classes new file mode 120000 index 0000000000..af2a112c09 --- /dev/null +++ b/Lang/PHL/Classes @@ -0,0 +1 @@ +../../Task/Classes/PHL \ No newline at end of file diff --git a/Lang/PHL/Conditional-structures b/Lang/PHL/Conditional-structures new file mode 120000 index 0000000000..efdc855643 --- /dev/null +++ b/Lang/PHL/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/PHL \ No newline at end of file diff --git a/Lang/PHL/Exceptions b/Lang/PHL/Exceptions new file mode 120000 index 0000000000..76eaa10f9d --- /dev/null +++ b/Lang/PHL/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/PHL \ No newline at end of file diff --git a/Lang/PHL/Extend-your-language b/Lang/PHL/Extend-your-language new file mode 120000 index 0000000000..8dc805f5dd --- /dev/null +++ b/Lang/PHL/Extend-your-language @@ -0,0 +1 @@ +../../Task/Extend-your-language/PHL \ No newline at end of file diff --git a/Lang/PHL/Filter b/Lang/PHL/Filter new file mode 120000 index 0000000000..e64d160283 --- /dev/null +++ b/Lang/PHL/Filter @@ -0,0 +1 @@ +../../Task/Filter/PHL \ No newline at end of file diff --git a/Lang/PHL/FizzBuzz b/Lang/PHL/FizzBuzz new file mode 120000 index 0000000000..6fbe75c676 --- /dev/null +++ b/Lang/PHL/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/PHL \ No newline at end of file diff --git a/Lang/PHL/Function-definition b/Lang/PHL/Function-definition new file mode 120000 index 0000000000..bba7f27e48 --- /dev/null +++ b/Lang/PHL/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/PHL \ No newline at end of file diff --git a/Lang/PHL/Hello-world-Newline-omission b/Lang/PHL/Hello-world-Newline-omission new file mode 120000 index 0000000000..76b1b2a08f --- /dev/null +++ b/Lang/PHL/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/PHL \ No newline at end of file diff --git a/Lang/PHL/Hello-world-Text b/Lang/PHL/Hello-world-Text new file mode 120000 index 0000000000..94fdfa0e33 --- /dev/null +++ b/Lang/PHL/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/PHL \ No newline at end of file diff --git a/Lang/PHL/Integer-comparison b/Lang/PHL/Integer-comparison new file mode 120000 index 0000000000..40cceba2d1 --- /dev/null +++ b/Lang/PHL/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/PHL \ No newline at end of file diff --git a/Lang/PHL/Loops-Do-while b/Lang/PHL/Loops-Do-while new file mode 120000 index 0000000000..0aec580587 --- /dev/null +++ b/Lang/PHL/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/PHL \ No newline at end of file diff --git a/Lang/PHL/Loops-Foreach b/Lang/PHL/Loops-Foreach new file mode 120000 index 0000000000..52d0abfffa --- /dev/null +++ b/Lang/PHL/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/PHL \ No newline at end of file diff --git a/Lang/PHL/Loops-While b/Lang/PHL/Loops-While new file mode 120000 index 0000000000..b9d1b769f0 --- /dev/null +++ b/Lang/PHL/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/PHL \ No newline at end of file diff --git a/Lang/PHL/Null-object b/Lang/PHL/Null-object new file mode 120000 index 0000000000..30eb052050 --- /dev/null +++ b/Lang/PHL/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/PHL \ No newline at end of file diff --git a/Lang/PHL/README b/Lang/PHL/README new file mode 100644 index 0000000000..de7e8f5615 --- /dev/null +++ b/Lang/PHL/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:PHL diff --git a/Lang/PHL/String-concatenation b/Lang/PHL/String-concatenation new file mode 120000 index 0000000000..b1500dd7d1 --- /dev/null +++ b/Lang/PHL/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/PHL \ No newline at end of file diff --git a/Lang/PHL/Towers-of-Hanoi b/Lang/PHL/Towers-of-Hanoi new file mode 120000 index 0000000000..344448937c --- /dev/null +++ b/Lang/PHL/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/PHL \ No newline at end of file diff --git a/Lang/PHL/Universal-Turing-machine b/Lang/PHL/Universal-Turing-machine new file mode 120000 index 0000000000..c671d3a583 --- /dev/null +++ b/Lang/PHL/Universal-Turing-machine @@ -0,0 +1 @@ +../../Task/Universal-Turing-machine/PHL \ No newline at end of file diff --git a/Lang/PHL/Yin-and-yang b/Lang/PHL/Yin-and-yang new file mode 120000 index 0000000000..0181460cbc --- /dev/null +++ b/Lang/PHL/Yin-and-yang @@ -0,0 +1 @@ +../../Task/Yin-and-yang/PHL \ No newline at end of file diff --git a/Lang/Panda/00DESCRIPTION b/Lang/Panda/00DESCRIPTION new file mode 100644 index 0000000000..7b7f61c42e --- /dev/null +++ b/Lang/Panda/00DESCRIPTION @@ -0,0 +1,5 @@ +{{stub}}{{language|gc=yes|checking=static|hopl=no|site=http://pandalang.org}} + +Panda is a new interactive functional typed dataflow event based programming language. It reminds people of jquery, or unix pipes. + +Panda does not have explicit loop constructs, doesn't use recursion but instead is based on generators, transformers, and consumers (aggregators). \ No newline at end of file diff --git a/Lang/Panda/Arithmetic-Integer b/Lang/Panda/Arithmetic-Integer new file mode 120000 index 0000000000..78ccfab482 --- /dev/null +++ b/Lang/Panda/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Panda \ No newline at end of file diff --git a/Lang/Panda/Binary-digits b/Lang/Panda/Binary-digits new file mode 120000 index 0000000000..cb9ca7846c --- /dev/null +++ b/Lang/Panda/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Panda \ No newline at end of file diff --git a/Lang/Panda/Factorial b/Lang/Panda/Factorial new file mode 120000 index 0000000000..0e455d5194 --- /dev/null +++ b/Lang/Panda/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Panda \ No newline at end of file diff --git a/Lang/Panda/Factors-of-an-integer b/Lang/Panda/Factors-of-an-integer new file mode 120000 index 0000000000..3373312ffb --- /dev/null +++ b/Lang/Panda/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Panda \ No newline at end of file diff --git a/Lang/Panda/Hello-world-Web-server b/Lang/Panda/Hello-world-Web-server new file mode 120000 index 0000000000..b8a32f92b3 --- /dev/null +++ b/Lang/Panda/Hello-world-Web-server @@ -0,0 +1 @@ +../../Task/Hello-world-Web-server/Panda \ No newline at end of file diff --git a/Lang/Panda/Loops-For-with-a-specified-step b/Lang/Panda/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..fcea28a16c --- /dev/null +++ b/Lang/Panda/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Panda \ No newline at end of file diff --git a/Lang/Panda/Loops-N-plus-one-half b/Lang/Panda/Loops-N-plus-one-half new file mode 120000 index 0000000000..68170ca24f --- /dev/null +++ b/Lang/Panda/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Panda \ No newline at end of file diff --git a/Lang/Panda/Loops-While b/Lang/Panda/Loops-While new file mode 120000 index 0000000000..acb19611dc --- /dev/null +++ b/Lang/Panda/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Panda \ No newline at end of file diff --git a/Lang/Panda/Pernicious-numbers b/Lang/Panda/Pernicious-numbers new file mode 120000 index 0000000000..a93029b470 --- /dev/null +++ b/Lang/Panda/Pernicious-numbers @@ -0,0 +1 @@ +../../Task/Pernicious-numbers/Panda \ No newline at end of file diff --git a/Lang/Panda/Primality-by-trial-division b/Lang/Panda/Primality-by-trial-division new file mode 120000 index 0000000000..c6b8419109 --- /dev/null +++ b/Lang/Panda/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/Panda \ No newline at end of file diff --git a/Lang/Panda/README b/Lang/Panda/README new file mode 100644 index 0000000000..f6be698f31 --- /dev/null +++ b/Lang/Panda/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Panda diff --git a/Lang/Panda/Read-entire-file b/Lang/Panda/Read-entire-file new file mode 120000 index 0000000000..783c8ea780 --- /dev/null +++ b/Lang/Panda/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Panda \ No newline at end of file diff --git a/Lang/Panda/Sum-of-a-series b/Lang/Panda/Sum-of-a-series new file mode 120000 index 0000000000..a76e63c115 --- /dev/null +++ b/Lang/Panda/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Panda \ No newline at end of file diff --git a/Lang/Pare/00DESCRIPTION b/Lang/Pare/00DESCRIPTION new file mode 100644 index 0000000000..9fc465170b --- /dev/null +++ b/Lang/Pare/00DESCRIPTION @@ -0,0 +1,7 @@ +{{language|Pare +|site=http://parelang.bitbucket.org/ +}} + + +{{implementation|Lisp}} +Pare is a scripting language and a compiler. \ No newline at end of file diff --git a/Lang/Pare/Hello-world-Newbie b/Lang/Pare/Hello-world-Newbie new file mode 120000 index 0000000000..28a72d6eee --- /dev/null +++ b/Lang/Pare/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/Pare \ No newline at end of file diff --git a/Lang/Pare/README b/Lang/Pare/README new file mode 100644 index 0000000000..89c7c00674 --- /dev/null +++ b/Lang/Pare/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Pare diff --git a/Lang/Peloton/00DESCRIPTION b/Lang/Peloton/00DESCRIPTION new file mode 100644 index 0000000000..022c0662cc --- /dev/null +++ b/Lang/Peloton/00DESCRIPTION @@ -0,0 +1,7 @@ +{{Stub}} +{{language|Peloton +}} +Peloton is a universal, symbolic programming language system, based on a systematic a priori analysis of the tasks required for computation. + +== See Also == +* [http://lambda-the-ultimate.org/node/2586 Discussion of Protium on "Lambda the Ultimate"] \ No newline at end of file diff --git a/Lang/Peloton/Binary-digits b/Lang/Peloton/Binary-digits new file mode 120000 index 0000000000..98b8ae59c6 --- /dev/null +++ b/Lang/Peloton/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Peloton \ No newline at end of file diff --git a/Lang/Peloton/Comments b/Lang/Peloton/Comments new file mode 120000 index 0000000000..0af8817d77 --- /dev/null +++ b/Lang/Peloton/Comments @@ -0,0 +1 @@ +../../Task/Comments/Peloton \ No newline at end of file diff --git a/Lang/Peloton/Create-an-HTML-table b/Lang/Peloton/Create-an-HTML-table new file mode 120000 index 0000000000..7d08edd5c6 --- /dev/null +++ b/Lang/Peloton/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/Peloton \ No newline at end of file diff --git a/Lang/Peloton/Day-of-the-week b/Lang/Peloton/Day-of-the-week new file mode 120000 index 0000000000..6820435d76 --- /dev/null +++ b/Lang/Peloton/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Peloton \ No newline at end of file diff --git a/Lang/Peloton/Factorial b/Lang/Peloton/Factorial new file mode 120000 index 0000000000..c87a464e2d --- /dev/null +++ b/Lang/Peloton/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Peloton \ No newline at end of file diff --git a/Lang/Peloton/Filter b/Lang/Peloton/Filter new file mode 120000 index 0000000000..c42ff90421 --- /dev/null +++ b/Lang/Peloton/Filter @@ -0,0 +1 @@ +../../Task/Filter/Peloton \ No newline at end of file diff --git a/Lang/Peloton/FizzBuzz b/Lang/Peloton/FizzBuzz new file mode 120000 index 0000000000..5d2180b9c1 --- /dev/null +++ b/Lang/Peloton/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Peloton \ No newline at end of file diff --git a/Lang/Peloton/HTTP b/Lang/Peloton/HTTP new file mode 120000 index 0000000000..c5d17f2c77 --- /dev/null +++ b/Lang/Peloton/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/Peloton \ No newline at end of file diff --git a/Lang/Peloton/History-variables b/Lang/Peloton/History-variables new file mode 120000 index 0000000000..aa16896d75 --- /dev/null +++ b/Lang/Peloton/History-variables @@ -0,0 +1 @@ +../../Task/History-variables/Peloton \ No newline at end of file diff --git a/Lang/Peloton/Loops-Downward-for b/Lang/Peloton/Loops-Downward-for new file mode 120000 index 0000000000..dc62add29a --- /dev/null +++ b/Lang/Peloton/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Peloton \ No newline at end of file diff --git a/Lang/Peloton/Loops-N-plus-one-half b/Lang/Peloton/Loops-N-plus-one-half new file mode 120000 index 0000000000..7e52734327 --- /dev/null +++ b/Lang/Peloton/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Peloton \ No newline at end of file diff --git a/Lang/Peloton/README b/Lang/Peloton/README new file mode 100644 index 0000000000..d66677e3bd --- /dev/null +++ b/Lang/Peloton/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Peloton diff --git a/Lang/Peloton/Read-a-configuration-file b/Lang/Peloton/Read-a-configuration-file new file mode 120000 index 0000000000..27d3c3add0 --- /dev/null +++ b/Lang/Peloton/Read-a-configuration-file @@ -0,0 +1 @@ +../../Task/Read-a-configuration-file/Peloton \ No newline at end of file diff --git a/Lang/Peloton/Reverse-a-string b/Lang/Peloton/Reverse-a-string new file mode 120000 index 0000000000..7f58283a83 --- /dev/null +++ b/Lang/Peloton/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Peloton \ No newline at end of file diff --git a/Lang/Peloton/Roman-numerals-Encode b/Lang/Peloton/Roman-numerals-Encode new file mode 120000 index 0000000000..5630a1dc65 --- /dev/null +++ b/Lang/Peloton/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/Peloton \ No newline at end of file diff --git a/Lang/Peloton/Singly-linked-list-Traversal b/Lang/Peloton/Singly-linked-list-Traversal new file mode 120000 index 0000000000..a8ae1d4fe8 --- /dev/null +++ b/Lang/Peloton/Singly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Traversal/Peloton \ No newline at end of file diff --git a/Lang/Peloton/Sleep b/Lang/Peloton/Sleep new file mode 120000 index 0000000000..f8029041f4 --- /dev/null +++ b/Lang/Peloton/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Peloton \ No newline at end of file diff --git a/Lang/Peloton/Sort-an-integer-array b/Lang/Peloton/Sort-an-integer-array new file mode 120000 index 0000000000..30050f625e --- /dev/null +++ b/Lang/Peloton/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Peloton \ No newline at end of file diff --git a/Lang/Peloton/String-case b/Lang/Peloton/String-case new file mode 120000 index 0000000000..2977917d47 --- /dev/null +++ b/Lang/Peloton/String-case @@ -0,0 +1 @@ +../../Task/String-case/Peloton \ No newline at end of file diff --git a/Lang/Peloton/Strip-control-codes-and-extended-characters-from-a-string b/Lang/Peloton/Strip-control-codes-and-extended-characters-from-a-string new file mode 120000 index 0000000000..d8ec28f0bd --- /dev/null +++ b/Lang/Peloton/Strip-control-codes-and-extended-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-control-codes-and-extended-characters-from-a-string/Peloton \ No newline at end of file diff --git a/Lang/Peloton/Unicode-variable-names b/Lang/Peloton/Unicode-variable-names new file mode 120000 index 0000000000..dd3a264036 --- /dev/null +++ b/Lang/Peloton/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/Peloton \ No newline at end of file diff --git a/Lang/Peloton/Web-scraping b/Lang/Peloton/Web-scraping new file mode 120000 index 0000000000..291c769b94 --- /dev/null +++ b/Lang/Peloton/Web-scraping @@ -0,0 +1 @@ +../../Task/Web-scraping/Peloton \ No newline at end of file diff --git a/Lang/PeopleCode/00DESCRIPTION b/Lang/PeopleCode/00DESCRIPTION new file mode 100644 index 0000000000..95cd0642a1 --- /dev/null +++ b/Lang/PeopleCode/00DESCRIPTION @@ -0,0 +1,2 @@ +PeopleCode is an (ool) object-oriented proprietary (case-insensitive) language used to express business logic for PeopleSoft applications. In its fundamentals, PeopleCode syntax resembles other programming languages. Some aspects of the PeopleCode language, however, are specifically related to the PeopleTools environment. However, the fundamentals of objects and classes are the same as in Java language. Definition name references, for example, enable you to refer to PeopleTools definitions, such as record definitions or pages, without using hard-coded string literals. Other language features, such as PeopleCode data types and metastrings, reflect the close interaction of PeopleTools and Structured Query Language (SQL). Dot notation, classes and methods in PeopleCode are similar to other object oriented languages, like Java. Object syntax was an important feature of PeopleTools 8.[http://en.wikipedia.org/wiki/PeopleCode a PeopleCode - Wikipedia] +{{language}} \ No newline at end of file diff --git a/Lang/PeopleCode/Determine-if-a-string-is-numeric b/Lang/PeopleCode/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..24c5914781 --- /dev/null +++ b/Lang/PeopleCode/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/PeopleCode \ No newline at end of file diff --git a/Lang/PeopleCode/Loops-While b/Lang/PeopleCode/Loops-While new file mode 120000 index 0000000000..e0c8dc6288 --- /dev/null +++ b/Lang/PeopleCode/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/PeopleCode \ No newline at end of file diff --git a/Lang/PeopleCode/README b/Lang/PeopleCode/README new file mode 100644 index 0000000000..83f1e07d1c --- /dev/null +++ b/Lang/PeopleCode/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:PeopleCode diff --git a/Lang/Perl5i/00DESCRIPTION b/Lang/Perl5i/00DESCRIPTION new file mode 100644 index 0000000000..b2ab4c8edf --- /dev/null +++ b/Lang/Perl5i/00DESCRIPTION @@ -0,0 +1,7 @@ +{{language}} + +While the Perl examples on Rosetta Code are correct, some of them reflect an older style of using the language. After all, Perl has been around since the 80s; Perl5 was released in 1994. Things that were barely manageable on a 386 running at 16 MHz with 4MB of RAM are a breeze, now. + +Object-Oriented Perl has been transformed by the development of Moose and its lightweight cousins, Mouse, Moo, etc. + +A number of modules encourage good non-OO style and simplify the boilerplate involved, such as Modern::Perl. I've decided to treat one of those modules, perl5i, as if it were a language on its own. While the existing code focuses on the use of Perl as a quick and easy scripting language, I want to emphasize its use for more engineered situations. Were I use OO, I've gone for a minimal style. As well, I've avoided POD and used minimal per-routine documentation. \ No newline at end of file diff --git a/Lang/Perl5i/100-doors b/Lang/Perl5i/100-doors new file mode 120000 index 0000000000..0c20e2c951 --- /dev/null +++ b/Lang/Perl5i/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Perl5i \ No newline at end of file diff --git a/Lang/Perl5i/Combinations b/Lang/Perl5i/Combinations new file mode 120000 index 0000000000..0f52b9e602 --- /dev/null +++ b/Lang/Perl5i/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/Perl5i \ No newline at end of file diff --git a/Lang/Perl5i/README b/Lang/Perl5i/README new file mode 100644 index 0000000000..ab42b9e7a5 --- /dev/null +++ b/Lang/Perl5i/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Perl5i diff --git a/Lang/Phix/00DESCRIPTION b/Lang/Phix/00DESCRIPTION new file mode 100644 index 0000000000..2fa7a1f02b --- /dev/null +++ b/Lang/Phix/00DESCRIPTION @@ -0,0 +1,26 @@ +{{language +|exec=both +|site=http://phix.is-great.org +|gc=Reference Counting +|parampass=copy-on-write +|express=explicit +|checking=both +|tags=phix, Phix +|altexec=compiled +|hopl=no +|LCT=yes +|bnf=http://phix.is-great.org/bnf.php +}} +Phix is a self-hosted hybrid interpreter/compiler, developed by Pete Lomax. It is very easy to use, and similar to Euphoria. + +A single 6MB download contains a precompiled executable, all the sources, and'' '''everything''' ''needed to recompile them, in about 15 seconds. The download also contains a full-featured programmer's editor and 130+ demo programs. + +Phix applies the principle of least surprise, for instance in some languages myproc(list) or res = myfunc(list) can mangle list, whereas in Phix if you actually want that to happen you would code list = myproc(list) (and myproc would need to become a function) or {res,list} = myfunc(list). A core tenet is that for any line of code there is one and only one possible interpretation of it, and said meaning is utterly intuitive. + +sequences (the one type covers lists/queues/tables/trees/arrays etc) and strings can grow and shrink automatically without any memory management overhead. For example if s="food" then s[2..3]="e" makes s "fed", and then s[2..1]="east" makes s "feasted". + +My goal on rosettacode is to show that Phix is easy to understand (succinct but not terse), and easy to debug. + +==See also== +* [http://phix.is-great.org Phix site] +* [https://bitbucket.org/petelomax/phix/src bitbucket] \ No newline at end of file diff --git a/Lang/Phix/100-doors b/Lang/Phix/100-doors new file mode 120000 index 0000000000..4192862ee4 --- /dev/null +++ b/Lang/Phix/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Phix \ No newline at end of file diff --git a/Lang/Phix/24-game b/Lang/Phix/24-game new file mode 120000 index 0000000000..50dd509695 --- /dev/null +++ b/Lang/Phix/24-game @@ -0,0 +1 @@ +../../Task/24-game/Phix \ No newline at end of file diff --git a/Lang/Phix/24-game-Solve b/Lang/Phix/24-game-Solve new file mode 120000 index 0000000000..68077603b5 --- /dev/null +++ b/Lang/Phix/24-game-Solve @@ -0,0 +1 @@ +../../Task/24-game-Solve/Phix \ No newline at end of file diff --git a/Lang/Phix/9-billion-names-of-God-the-integer b/Lang/Phix/9-billion-names-of-God-the-integer new file mode 120000 index 0000000000..c6e31791ff --- /dev/null +++ b/Lang/Phix/9-billion-names-of-God-the-integer @@ -0,0 +1 @@ +../../Task/9-billion-names-of-God-the-integer/Phix \ No newline at end of file diff --git a/Lang/Phix/99-Bottles-of-Beer b/Lang/Phix/99-Bottles-of-Beer new file mode 120000 index 0000000000..ff29a94f7d --- /dev/null +++ b/Lang/Phix/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Phix \ No newline at end of file diff --git a/Lang/Phix/A+B b/Lang/Phix/A+B new file mode 120000 index 0000000000..56dbe92140 --- /dev/null +++ b/Lang/Phix/A+B @@ -0,0 +1 @@ +../../Task/A+B/Phix \ No newline at end of file diff --git a/Lang/Phix/ABC-Problem b/Lang/Phix/ABC-Problem new file mode 120000 index 0000000000..a38311d624 --- /dev/null +++ b/Lang/Phix/ABC-Problem @@ -0,0 +1 @@ +../../Task/ABC-Problem/Phix \ No newline at end of file diff --git a/Lang/Phix/AKS-test-for-primes b/Lang/Phix/AKS-test-for-primes new file mode 120000 index 0000000000..8b607db14d --- /dev/null +++ b/Lang/Phix/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/Phix \ No newline at end of file diff --git a/Lang/Phix/Abundant,-deficient-and-perfect-number-classifications b/Lang/Phix/Abundant,-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..d9b5da1754 --- /dev/null +++ b/Lang/Phix/Abundant,-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant,-deficient-and-perfect-number-classifications/Phix \ No newline at end of file diff --git a/Lang/Phix/Ackermann-function b/Lang/Phix/Ackermann-function new file mode 120000 index 0000000000..1316b5017d --- /dev/null +++ b/Lang/Phix/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Phix \ No newline at end of file diff --git a/Lang/Phix/Address-of-a-variable b/Lang/Phix/Address-of-a-variable new file mode 120000 index 0000000000..e92e361b5f --- /dev/null +++ b/Lang/Phix/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/Phix \ No newline at end of file diff --git a/Lang/Phix/Align-columns b/Lang/Phix/Align-columns new file mode 120000 index 0000000000..eec8c0ea69 --- /dev/null +++ b/Lang/Phix/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/Phix \ No newline at end of file diff --git a/Lang/Phix/Aliquot-sequence-classifications b/Lang/Phix/Aliquot-sequence-classifications new file mode 120000 index 0000000000..8e1916c293 --- /dev/null +++ b/Lang/Phix/Aliquot-sequence-classifications @@ -0,0 +1 @@ +../../Task/Aliquot-sequence-classifications/Phix \ No newline at end of file diff --git a/Lang/Phix/Almost-prime b/Lang/Phix/Almost-prime new file mode 120000 index 0000000000..a00bb63ee1 --- /dev/null +++ b/Lang/Phix/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Phix \ No newline at end of file diff --git a/Lang/Phix/Amb b/Lang/Phix/Amb new file mode 120000 index 0000000000..9a4a04d56a --- /dev/null +++ b/Lang/Phix/Amb @@ -0,0 +1 @@ +../../Task/Amb/Phix \ No newline at end of file diff --git a/Lang/Phix/Amicable-pairs b/Lang/Phix/Amicable-pairs new file mode 120000 index 0000000000..f69269c82e --- /dev/null +++ b/Lang/Phix/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/Phix \ No newline at end of file diff --git a/Lang/Phix/Anagrams b/Lang/Phix/Anagrams new file mode 120000 index 0000000000..5e1b42fa44 --- /dev/null +++ b/Lang/Phix/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/Phix \ No newline at end of file diff --git a/Lang/Phix/Anagrams-Deranged-anagrams b/Lang/Phix/Anagrams-Deranged-anagrams new file mode 120000 index 0000000000..fc2e2aca90 --- /dev/null +++ b/Lang/Phix/Anagrams-Deranged-anagrams @@ -0,0 +1 @@ +../../Task/Anagrams-Deranged-anagrams/Phix \ No newline at end of file diff --git a/Lang/Phix/Animate-a-pendulum b/Lang/Phix/Animate-a-pendulum new file mode 120000 index 0000000000..bec80f48e3 --- /dev/null +++ b/Lang/Phix/Animate-a-pendulum @@ -0,0 +1 @@ +../../Task/Animate-a-pendulum/Phix \ No newline at end of file diff --git a/Lang/Phix/Animation b/Lang/Phix/Animation new file mode 120000 index 0000000000..b0a404cc0e --- /dev/null +++ b/Lang/Phix/Animation @@ -0,0 +1 @@ +../../Task/Animation/Phix \ No newline at end of file diff --git a/Lang/Phix/Apply-a-callback-to-an-array b/Lang/Phix/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..24bf027cda --- /dev/null +++ b/Lang/Phix/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Phix \ No newline at end of file diff --git a/Lang/Phix/Arbitrary-precision-integers--included- b/Lang/Phix/Arbitrary-precision-integers--included- new file mode 120000 index 0000000000..0e53d3a4a5 --- /dev/null +++ b/Lang/Phix/Arbitrary-precision-integers--included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers--included-/Phix \ No newline at end of file diff --git a/Lang/Phix/Arithmetic-Complex b/Lang/Phix/Arithmetic-Complex new file mode 120000 index 0000000000..374ca6e7cd --- /dev/null +++ b/Lang/Phix/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/Phix \ No newline at end of file diff --git a/Lang/Phix/Arithmetic-Integer b/Lang/Phix/Arithmetic-Integer new file mode 120000 index 0000000000..e7e0cb56df --- /dev/null +++ b/Lang/Phix/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Phix \ No newline at end of file diff --git a/Lang/Phix/Arithmetic-Rational b/Lang/Phix/Arithmetic-Rational new file mode 120000 index 0000000000..9d481124bb --- /dev/null +++ b/Lang/Phix/Arithmetic-Rational @@ -0,0 +1 @@ +../../Task/Arithmetic-Rational/Phix \ No newline at end of file diff --git a/Lang/Phix/Arithmetic-evaluation b/Lang/Phix/Arithmetic-evaluation new file mode 120000 index 0000000000..ae2902ff58 --- /dev/null +++ b/Lang/Phix/Arithmetic-evaluation @@ -0,0 +1 @@ +../../Task/Arithmetic-evaluation/Phix \ No newline at end of file diff --git a/Lang/Phix/Arithmetic-geometric-mean b/Lang/Phix/Arithmetic-geometric-mean new file mode 120000 index 0000000000..5568159f16 --- /dev/null +++ b/Lang/Phix/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/Phix \ No newline at end of file diff --git a/Lang/Phix/Arithmetic-geometric-mean-Calculate-Pi b/Lang/Phix/Arithmetic-geometric-mean-Calculate-Pi new file mode 120000 index 0000000000..4cbc5f6a8f --- /dev/null +++ b/Lang/Phix/Arithmetic-geometric-mean-Calculate-Pi @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean-Calculate-Pi/Phix \ No newline at end of file diff --git a/Lang/Phix/Array-concatenation b/Lang/Phix/Array-concatenation new file mode 120000 index 0000000000..f487a36912 --- /dev/null +++ b/Lang/Phix/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Phix \ No newline at end of file diff --git a/Lang/Phix/Arrays b/Lang/Phix/Arrays new file mode 120000 index 0000000000..501d2ccbda --- /dev/null +++ b/Lang/Phix/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Phix \ No newline at end of file diff --git a/Lang/Phix/Assertions b/Lang/Phix/Assertions new file mode 120000 index 0000000000..3f4bd51ec0 --- /dev/null +++ b/Lang/Phix/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Phix \ No newline at end of file diff --git a/Lang/Phix/Associative-array-Creation b/Lang/Phix/Associative-array-Creation new file mode 120000 index 0000000000..45a09643ca --- /dev/null +++ b/Lang/Phix/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Phix \ No newline at end of file diff --git a/Lang/Phix/Associative-array-Iteration b/Lang/Phix/Associative-array-Iteration new file mode 120000 index 0000000000..d08a45dbec --- /dev/null +++ b/Lang/Phix/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Phix \ No newline at end of file diff --git a/Lang/Phix/Atomic-updates b/Lang/Phix/Atomic-updates new file mode 120000 index 0000000000..f72f157179 --- /dev/null +++ b/Lang/Phix/Atomic-updates @@ -0,0 +1 @@ +../../Task/Atomic-updates/Phix \ No newline at end of file diff --git a/Lang/Phix/Average-loop-length b/Lang/Phix/Average-loop-length new file mode 120000 index 0000000000..9c66ee18d9 --- /dev/null +++ b/Lang/Phix/Average-loop-length @@ -0,0 +1 @@ +../../Task/Average-loop-length/Phix \ No newline at end of file diff --git a/Lang/Phix/Averages-Arithmetic-mean b/Lang/Phix/Averages-Arithmetic-mean new file mode 120000 index 0000000000..193177d576 --- /dev/null +++ b/Lang/Phix/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Phix \ No newline at end of file diff --git a/Lang/Phix/Averages-Mean-angle b/Lang/Phix/Averages-Mean-angle new file mode 120000 index 0000000000..7aaf9dbdc1 --- /dev/null +++ b/Lang/Phix/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/Phix \ No newline at end of file diff --git a/Lang/Phix/Averages-Mean-time-of-day b/Lang/Phix/Averages-Mean-time-of-day new file mode 120000 index 0000000000..6ebb25cb90 --- /dev/null +++ b/Lang/Phix/Averages-Mean-time-of-day @@ -0,0 +1 @@ +../../Task/Averages-Mean-time-of-day/Phix \ No newline at end of file diff --git a/Lang/Phix/Averages-Median b/Lang/Phix/Averages-Median new file mode 120000 index 0000000000..6a91e2cd16 --- /dev/null +++ b/Lang/Phix/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/Phix \ No newline at end of file diff --git a/Lang/Phix/Averages-Mode b/Lang/Phix/Averages-Mode new file mode 120000 index 0000000000..3400582e25 --- /dev/null +++ b/Lang/Phix/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/Phix \ No newline at end of file diff --git a/Lang/Phix/Averages-Pythagorean-means b/Lang/Phix/Averages-Pythagorean-means new file mode 120000 index 0000000000..600cca5f8b --- /dev/null +++ b/Lang/Phix/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/Phix \ No newline at end of file diff --git a/Lang/Phix/Averages-Root-mean-square b/Lang/Phix/Averages-Root-mean-square new file mode 120000 index 0000000000..599e242f15 --- /dev/null +++ b/Lang/Phix/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/Phix \ No newline at end of file diff --git a/Lang/Phix/Averages-Simple-moving-average b/Lang/Phix/Averages-Simple-moving-average new file mode 120000 index 0000000000..27f54c8e0e --- /dev/null +++ b/Lang/Phix/Averages-Simple-moving-average @@ -0,0 +1 @@ +../../Task/Averages-Simple-moving-average/Phix \ No newline at end of file diff --git a/Lang/Phix/Balanced-brackets b/Lang/Phix/Balanced-brackets new file mode 120000 index 0000000000..86b616a615 --- /dev/null +++ b/Lang/Phix/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Phix \ No newline at end of file diff --git a/Lang/Phix/Balanced-ternary b/Lang/Phix/Balanced-ternary new file mode 120000 index 0000000000..7a10c07728 --- /dev/null +++ b/Lang/Phix/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/Phix \ No newline at end of file diff --git a/Lang/Phix/Benfords-law b/Lang/Phix/Benfords-law new file mode 120000 index 0000000000..6bda1f406e --- /dev/null +++ b/Lang/Phix/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/Phix \ No newline at end of file diff --git a/Lang/Phix/Bernoulli-numbers b/Lang/Phix/Bernoulli-numbers new file mode 120000 index 0000000000..4eb81c1c76 --- /dev/null +++ b/Lang/Phix/Bernoulli-numbers @@ -0,0 +1 @@ +../../Task/Bernoulli-numbers/Phix \ No newline at end of file diff --git a/Lang/Phix/Best-shuffle b/Lang/Phix/Best-shuffle new file mode 120000 index 0000000000..f27d40e2b0 --- /dev/null +++ b/Lang/Phix/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Phix \ No newline at end of file diff --git a/Lang/Phix/Binary-digits b/Lang/Phix/Binary-digits new file mode 120000 index 0000000000..8ff916d51a --- /dev/null +++ b/Lang/Phix/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Phix \ No newline at end of file diff --git a/Lang/Phix/Binary-search b/Lang/Phix/Binary-search new file mode 120000 index 0000000000..cf7bc43d20 --- /dev/null +++ b/Lang/Phix/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Phix \ No newline at end of file diff --git a/Lang/Phix/Binary-strings b/Lang/Phix/Binary-strings new file mode 120000 index 0000000000..baa580418a --- /dev/null +++ b/Lang/Phix/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Phix \ No newline at end of file diff --git a/Lang/Phix/Bitmap b/Lang/Phix/Bitmap new file mode 120000 index 0000000000..3466aacf1e --- /dev/null +++ b/Lang/Phix/Bitmap @@ -0,0 +1 @@ +../../Task/Bitmap/Phix \ No newline at end of file diff --git a/Lang/Phix/Bitmap-B-zier-curves-Cubic b/Lang/Phix/Bitmap-B-zier-curves-Cubic new file mode 120000 index 0000000000..e0aedf140d --- /dev/null +++ b/Lang/Phix/Bitmap-B-zier-curves-Cubic @@ -0,0 +1 @@ +../../Task/Bitmap-B-zier-curves-Cubic/Phix \ No newline at end of file diff --git a/Lang/Phix/Bitmap-B-zier-curves-Quadratic b/Lang/Phix/Bitmap-B-zier-curves-Quadratic new file mode 120000 index 0000000000..3797b61899 --- /dev/null +++ b/Lang/Phix/Bitmap-B-zier-curves-Quadratic @@ -0,0 +1 @@ +../../Task/Bitmap-B-zier-curves-Quadratic/Phix \ No newline at end of file diff --git a/Lang/Phix/Bitmap-Bresenhams-line-algorithm b/Lang/Phix/Bitmap-Bresenhams-line-algorithm new file mode 120000 index 0000000000..003bf9bd38 --- /dev/null +++ b/Lang/Phix/Bitmap-Bresenhams-line-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Bresenhams-line-algorithm/Phix \ No newline at end of file diff --git a/Lang/Phix/Bitmap-Flood-fill b/Lang/Phix/Bitmap-Flood-fill new file mode 120000 index 0000000000..7931c05902 --- /dev/null +++ b/Lang/Phix/Bitmap-Flood-fill @@ -0,0 +1 @@ +../../Task/Bitmap-Flood-fill/Phix \ No newline at end of file diff --git a/Lang/Phix/Bitmap-Histogram b/Lang/Phix/Bitmap-Histogram new file mode 120000 index 0000000000..749743f52e --- /dev/null +++ b/Lang/Phix/Bitmap-Histogram @@ -0,0 +1 @@ +../../Task/Bitmap-Histogram/Phix \ No newline at end of file diff --git a/Lang/Phix/Bitmap-Midpoint-circle-algorithm b/Lang/Phix/Bitmap-Midpoint-circle-algorithm new file mode 120000 index 0000000000..a0c165bbdc --- /dev/null +++ b/Lang/Phix/Bitmap-Midpoint-circle-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Midpoint-circle-algorithm/Phix \ No newline at end of file diff --git a/Lang/Phix/Bitmap-Read-a-PPM-file b/Lang/Phix/Bitmap-Read-a-PPM-file new file mode 120000 index 0000000000..b86f59911d --- /dev/null +++ b/Lang/Phix/Bitmap-Read-a-PPM-file @@ -0,0 +1 @@ +../../Task/Bitmap-Read-a-PPM-file/Phix \ No newline at end of file diff --git a/Lang/Phix/Bitmap-Write-a-PPM-file b/Lang/Phix/Bitmap-Write-a-PPM-file new file mode 120000 index 0000000000..332ff341a1 --- /dev/null +++ b/Lang/Phix/Bitmap-Write-a-PPM-file @@ -0,0 +1 @@ +../../Task/Bitmap-Write-a-PPM-file/Phix \ No newline at end of file diff --git a/Lang/Phix/Bitwise-operations b/Lang/Phix/Bitwise-operations new file mode 120000 index 0000000000..3ec2c118e8 --- /dev/null +++ b/Lang/Phix/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/Phix \ No newline at end of file diff --git a/Lang/Phix/Box-the-compass b/Lang/Phix/Box-the-compass new file mode 120000 index 0000000000..2aebb93131 --- /dev/null +++ b/Lang/Phix/Box-the-compass @@ -0,0 +1 @@ +../../Task/Box-the-compass/Phix \ No newline at end of file diff --git a/Lang/Phix/Brownian-tree b/Lang/Phix/Brownian-tree new file mode 120000 index 0000000000..e82643e4f1 --- /dev/null +++ b/Lang/Phix/Brownian-tree @@ -0,0 +1 @@ +../../Task/Brownian-tree/Phix \ No newline at end of file diff --git a/Lang/Phix/Bulls-and-cows b/Lang/Phix/Bulls-and-cows new file mode 120000 index 0000000000..43f5e57079 --- /dev/null +++ b/Lang/Phix/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Phix \ No newline at end of file diff --git a/Lang/Phix/Bulls-and-cows-Player b/Lang/Phix/Bulls-and-cows-Player new file mode 120000 index 0000000000..4271acca28 --- /dev/null +++ b/Lang/Phix/Bulls-and-cows-Player @@ -0,0 +1 @@ +../../Task/Bulls-and-cows-Player/Phix \ No newline at end of file diff --git a/Lang/Phix/CRC-32 b/Lang/Phix/CRC-32 new file mode 120000 index 0000000000..7b8b670b28 --- /dev/null +++ b/Lang/Phix/CRC-32 @@ -0,0 +1 @@ +../../Task/CRC-32/Phix \ No newline at end of file diff --git a/Lang/Phix/CSV-to-HTML-translation b/Lang/Phix/CSV-to-HTML-translation new file mode 120000 index 0000000000..b50facbd5b --- /dev/null +++ b/Lang/Phix/CSV-to-HTML-translation @@ -0,0 +1 @@ +../../Task/CSV-to-HTML-translation/Phix \ No newline at end of file diff --git a/Lang/Phix/Caesar-cipher b/Lang/Phix/Caesar-cipher new file mode 120000 index 0000000000..f717b6ff86 --- /dev/null +++ b/Lang/Phix/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Phix \ No newline at end of file diff --git a/Lang/Phix/Calendar b/Lang/Phix/Calendar new file mode 120000 index 0000000000..d1272cc149 --- /dev/null +++ b/Lang/Phix/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/Phix \ No newline at end of file diff --git a/Lang/Phix/Calendar---for-REAL-programmers b/Lang/Phix/Calendar---for-REAL-programmers new file mode 120000 index 0000000000..b022f588be --- /dev/null +++ b/Lang/Phix/Calendar---for-REAL-programmers @@ -0,0 +1 @@ +../../Task/Calendar---for-REAL-programmers/Phix \ No newline at end of file diff --git a/Lang/Phix/Call-a-foreign-language-function b/Lang/Phix/Call-a-foreign-language-function new file mode 120000 index 0000000000..28b6bdbbc1 --- /dev/null +++ b/Lang/Phix/Call-a-foreign-language-function @@ -0,0 +1 @@ +../../Task/Call-a-foreign-language-function/Phix \ No newline at end of file diff --git a/Lang/Phix/Call-a-function b/Lang/Phix/Call-a-function new file mode 120000 index 0000000000..bf3e52d448 --- /dev/null +++ b/Lang/Phix/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/Phix \ No newline at end of file diff --git a/Lang/Phix/Case-sensitivity-of-identifiers b/Lang/Phix/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..67fe366f74 --- /dev/null +++ b/Lang/Phix/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/Phix \ No newline at end of file diff --git a/Lang/Phix/Catalan-numbers b/Lang/Phix/Catalan-numbers new file mode 120000 index 0000000000..369bf0d1d9 --- /dev/null +++ b/Lang/Phix/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/Phix \ No newline at end of file diff --git a/Lang/Phix/Catalan-numbers-Pascals-triangle b/Lang/Phix/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..6d54206bb1 --- /dev/null +++ b/Lang/Phix/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/Phix \ No newline at end of file diff --git a/Lang/Phix/Character-codes b/Lang/Phix/Character-codes new file mode 120000 index 0000000000..8c8323355c --- /dev/null +++ b/Lang/Phix/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Phix \ No newline at end of file diff --git a/Lang/Phix/Check-that-file-exists b/Lang/Phix/Check-that-file-exists new file mode 120000 index 0000000000..dc0837dc48 --- /dev/null +++ b/Lang/Phix/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Phix \ No newline at end of file diff --git a/Lang/Phix/Closest-pair-problem b/Lang/Phix/Closest-pair-problem new file mode 120000 index 0000000000..8f88567add --- /dev/null +++ b/Lang/Phix/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/Phix \ No newline at end of file diff --git a/Lang/Phix/Collections b/Lang/Phix/Collections new file mode 120000 index 0000000000..2fe360323f --- /dev/null +++ b/Lang/Phix/Collections @@ -0,0 +1 @@ +../../Task/Collections/Phix \ No newline at end of file diff --git a/Lang/Phix/Combinations b/Lang/Phix/Combinations new file mode 120000 index 0000000000..2a0c03d7e4 --- /dev/null +++ b/Lang/Phix/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/Phix \ No newline at end of file diff --git a/Lang/Phix/Combinations-and-permutations b/Lang/Phix/Combinations-and-permutations new file mode 120000 index 0000000000..e9e7fdb658 --- /dev/null +++ b/Lang/Phix/Combinations-and-permutations @@ -0,0 +1 @@ +../../Task/Combinations-and-permutations/Phix \ No newline at end of file diff --git a/Lang/Phix/Combinations-with-repetitions b/Lang/Phix/Combinations-with-repetitions new file mode 120000 index 0000000000..895a278fc9 --- /dev/null +++ b/Lang/Phix/Combinations-with-repetitions @@ -0,0 +1 @@ +../../Task/Combinations-with-repetitions/Phix \ No newline at end of file diff --git a/Lang/Phix/Command-line-arguments b/Lang/Phix/Command-line-arguments new file mode 120000 index 0000000000..ac5131a286 --- /dev/null +++ b/Lang/Phix/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/Phix \ No newline at end of file diff --git a/Lang/Phix/Comments b/Lang/Phix/Comments new file mode 120000 index 0000000000..4bc04aa217 --- /dev/null +++ b/Lang/Phix/Comments @@ -0,0 +1 @@ +../../Task/Comments/Phix \ No newline at end of file diff --git a/Lang/Phix/Compile-time-calculation b/Lang/Phix/Compile-time-calculation new file mode 120000 index 0000000000..1533edec9f --- /dev/null +++ b/Lang/Phix/Compile-time-calculation @@ -0,0 +1 @@ +../../Task/Compile-time-calculation/Phix \ No newline at end of file diff --git a/Lang/Phix/Compound-data-type b/Lang/Phix/Compound-data-type new file mode 120000 index 0000000000..39cbbade15 --- /dev/null +++ b/Lang/Phix/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/Phix \ No newline at end of file diff --git a/Lang/Phix/Concurrent-computing b/Lang/Phix/Concurrent-computing new file mode 120000 index 0000000000..0279122e02 --- /dev/null +++ b/Lang/Phix/Concurrent-computing @@ -0,0 +1 @@ +../../Task/Concurrent-computing/Phix \ No newline at end of file diff --git a/Lang/Phix/Constrained-random-points-on-a-circle b/Lang/Phix/Constrained-random-points-on-a-circle new file mode 120000 index 0000000000..27f68aa0c1 --- /dev/null +++ b/Lang/Phix/Constrained-random-points-on-a-circle @@ -0,0 +1 @@ +../../Task/Constrained-random-points-on-a-circle/Phix \ No newline at end of file diff --git a/Lang/Phix/Convert-decimal-number-to-rational b/Lang/Phix/Convert-decimal-number-to-rational new file mode 120000 index 0000000000..8b157265a6 --- /dev/null +++ b/Lang/Phix/Convert-decimal-number-to-rational @@ -0,0 +1 @@ +../../Task/Convert-decimal-number-to-rational/Phix \ No newline at end of file diff --git a/Lang/Phix/Copy-a-string b/Lang/Phix/Copy-a-string new file mode 120000 index 0000000000..67b0852bc3 --- /dev/null +++ b/Lang/Phix/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Phix \ No newline at end of file diff --git a/Lang/Phix/Count-in-factors b/Lang/Phix/Count-in-factors new file mode 120000 index 0000000000..b00065bfc4 --- /dev/null +++ b/Lang/Phix/Count-in-factors @@ -0,0 +1 @@ +../../Task/Count-in-factors/Phix \ No newline at end of file diff --git a/Lang/Phix/Count-in-octal b/Lang/Phix/Count-in-octal new file mode 120000 index 0000000000..72378ab330 --- /dev/null +++ b/Lang/Phix/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/Phix \ No newline at end of file diff --git a/Lang/Phix/Count-occurrences-of-a-substring b/Lang/Phix/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..f322b5367c --- /dev/null +++ b/Lang/Phix/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Phix \ No newline at end of file diff --git a/Lang/Phix/Create-a-file b/Lang/Phix/Create-a-file new file mode 120000 index 0000000000..dd1e577742 --- /dev/null +++ b/Lang/Phix/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/Phix \ No newline at end of file diff --git a/Lang/Phix/Create-a-two-dimensional-array-at-runtime b/Lang/Phix/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..90e3ffe96b --- /dev/null +++ b/Lang/Phix/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/Phix \ No newline at end of file diff --git a/Lang/Phix/Create-an-HTML-table b/Lang/Phix/Create-an-HTML-table new file mode 120000 index 0000000000..4dce81bf85 --- /dev/null +++ b/Lang/Phix/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/Phix \ No newline at end of file diff --git a/Lang/Phix/Create-an-object-at-a-given-address b/Lang/Phix/Create-an-object-at-a-given-address new file mode 120000 index 0000000000..6914232651 --- /dev/null +++ b/Lang/Phix/Create-an-object-at-a-given-address @@ -0,0 +1 @@ +../../Task/Create-an-object-at-a-given-address/Phix \ No newline at end of file diff --git a/Lang/Phix/Date-format b/Lang/Phix/Date-format new file mode 120000 index 0000000000..f6ec86e88e --- /dev/null +++ b/Lang/Phix/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/Phix \ No newline at end of file diff --git a/Lang/Phix/Date-manipulation b/Lang/Phix/Date-manipulation new file mode 120000 index 0000000000..79676c067f --- /dev/null +++ b/Lang/Phix/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/Phix \ No newline at end of file diff --git a/Lang/Phix/Day-of-the-week b/Lang/Phix/Day-of-the-week new file mode 120000 index 0000000000..a70fe905cf --- /dev/null +++ b/Lang/Phix/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Phix \ No newline at end of file diff --git a/Lang/Phix/Define-a-primitive-data-type b/Lang/Phix/Define-a-primitive-data-type new file mode 120000 index 0000000000..637e0bac25 --- /dev/null +++ b/Lang/Phix/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/Phix \ No newline at end of file diff --git a/Lang/Phix/Determine-if-a-string-is-numeric b/Lang/Phix/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..5bdce681d1 --- /dev/null +++ b/Lang/Phix/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Phix \ No newline at end of file diff --git a/Lang/Phix/Determine-if-only-one-instance-is-running b/Lang/Phix/Determine-if-only-one-instance-is-running new file mode 120000 index 0000000000..b07312b077 --- /dev/null +++ b/Lang/Phix/Determine-if-only-one-instance-is-running @@ -0,0 +1 @@ +../../Task/Determine-if-only-one-instance-is-running/Phix \ No newline at end of file diff --git a/Lang/Phix/Dining-philosophers b/Lang/Phix/Dining-philosophers new file mode 120000 index 0000000000..d10270da49 --- /dev/null +++ b/Lang/Phix/Dining-philosophers @@ -0,0 +1 @@ +../../Task/Dining-philosophers/Phix \ No newline at end of file diff --git a/Lang/Phix/Discordian-date b/Lang/Phix/Discordian-date new file mode 120000 index 0000000000..c0ff31a701 --- /dev/null +++ b/Lang/Phix/Discordian-date @@ -0,0 +1 @@ +../../Task/Discordian-date/Phix \ No newline at end of file diff --git a/Lang/Phix/Dot-product b/Lang/Phix/Dot-product new file mode 120000 index 0000000000..a2def013f7 --- /dev/null +++ b/Lang/Phix/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Phix \ No newline at end of file diff --git a/Lang/Phix/Draw-a-cuboid b/Lang/Phix/Draw-a-cuboid new file mode 120000 index 0000000000..500609149f --- /dev/null +++ b/Lang/Phix/Draw-a-cuboid @@ -0,0 +1 @@ +../../Task/Draw-a-cuboid/Phix \ No newline at end of file diff --git a/Lang/Phix/Element-wise-operations b/Lang/Phix/Element-wise-operations new file mode 120000 index 0000000000..59a8389bd3 --- /dev/null +++ b/Lang/Phix/Element-wise-operations @@ -0,0 +1 @@ +../../Task/Element-wise-operations/Phix \ No newline at end of file diff --git a/Lang/Phix/Empty-string b/Lang/Phix/Empty-string new file mode 120000 index 0000000000..44e96b2d05 --- /dev/null +++ b/Lang/Phix/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Phix \ No newline at end of file diff --git a/Lang/Phix/Enforced-immutability b/Lang/Phix/Enforced-immutability new file mode 120000 index 0000000000..90dba7e40a --- /dev/null +++ b/Lang/Phix/Enforced-immutability @@ -0,0 +1 @@ +../../Task/Enforced-immutability/Phix \ No newline at end of file diff --git a/Lang/Phix/Enumerations b/Lang/Phix/Enumerations new file mode 120000 index 0000000000..fda7ae7af0 --- /dev/null +++ b/Lang/Phix/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/Phix \ No newline at end of file diff --git a/Lang/Phix/Environment-variables b/Lang/Phix/Environment-variables new file mode 120000 index 0000000000..033cefee38 --- /dev/null +++ b/Lang/Phix/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/Phix \ No newline at end of file diff --git a/Lang/Phix/Equilibrium-index b/Lang/Phix/Equilibrium-index new file mode 120000 index 0000000000..34e5bb7eb4 --- /dev/null +++ b/Lang/Phix/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/Phix \ No newline at end of file diff --git a/Lang/Phix/Ethiopian-multiplication b/Lang/Phix/Ethiopian-multiplication new file mode 120000 index 0000000000..9640a8b91f --- /dev/null +++ b/Lang/Phix/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Phix \ No newline at end of file diff --git a/Lang/Phix/Euler-method b/Lang/Phix/Euler-method new file mode 120000 index 0000000000..a23eb49fc1 --- /dev/null +++ b/Lang/Phix/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/Phix \ No newline at end of file diff --git a/Lang/Phix/Even-or-odd b/Lang/Phix/Even-or-odd new file mode 120000 index 0000000000..041d432cad --- /dev/null +++ b/Lang/Phix/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Phix \ No newline at end of file diff --git a/Lang/Phix/Evolutionary-algorithm b/Lang/Phix/Evolutionary-algorithm new file mode 120000 index 0000000000..86b1c81517 --- /dev/null +++ b/Lang/Phix/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/Phix \ No newline at end of file diff --git a/Lang/Phix/Execute-Brain---- b/Lang/Phix/Execute-Brain---- new file mode 120000 index 0000000000..2bc5472928 --- /dev/null +++ b/Lang/Phix/Execute-Brain---- @@ -0,0 +1 @@ +../../Task/Execute-Brain----/Phix \ No newline at end of file diff --git a/Lang/Phix/Execute-HQ9+ b/Lang/Phix/Execute-HQ9+ new file mode 120000 index 0000000000..8aaf7c2b62 --- /dev/null +++ b/Lang/Phix/Execute-HQ9+ @@ -0,0 +1 @@ +../../Task/Execute-HQ9+/Phix \ No newline at end of file diff --git a/Lang/Phix/Execute-a-system-command b/Lang/Phix/Execute-a-system-command new file mode 120000 index 0000000000..f9d57921bb --- /dev/null +++ b/Lang/Phix/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/Phix \ No newline at end of file diff --git a/Lang/Phix/Exponentiation-operator b/Lang/Phix/Exponentiation-operator new file mode 120000 index 0000000000..42997c9566 --- /dev/null +++ b/Lang/Phix/Exponentiation-operator @@ -0,0 +1 @@ +../../Task/Exponentiation-operator/Phix \ No newline at end of file diff --git a/Lang/Phix/Extreme-floating-point-values b/Lang/Phix/Extreme-floating-point-values new file mode 120000 index 0000000000..bb4087b159 --- /dev/null +++ b/Lang/Phix/Extreme-floating-point-values @@ -0,0 +1 @@ +../../Task/Extreme-floating-point-values/Phix \ No newline at end of file diff --git a/Lang/Phix/Factorial b/Lang/Phix/Factorial new file mode 120000 index 0000000000..69f86d3db7 --- /dev/null +++ b/Lang/Phix/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Phix \ No newline at end of file diff --git a/Lang/Phix/Fibonacci-sequence b/Lang/Phix/Fibonacci-sequence new file mode 120000 index 0000000000..d420c28a98 --- /dev/null +++ b/Lang/Phix/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Phix \ No newline at end of file diff --git a/Lang/Phix/File-input-output b/Lang/Phix/File-input-output new file mode 120000 index 0000000000..c71504d77e --- /dev/null +++ b/Lang/Phix/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/Phix \ No newline at end of file diff --git a/Lang/Phix/File-size b/Lang/Phix/File-size new file mode 120000 index 0000000000..ca3e23fc0d --- /dev/null +++ b/Lang/Phix/File-size @@ -0,0 +1 @@ +../../Task/File-size/Phix \ No newline at end of file diff --git a/Lang/Phix/Filter b/Lang/Phix/Filter new file mode 120000 index 0000000000..b3e0871c94 --- /dev/null +++ b/Lang/Phix/Filter @@ -0,0 +1 @@ +../../Task/Filter/Phix \ No newline at end of file diff --git a/Lang/Phix/Find-limit-of-recursion b/Lang/Phix/Find-limit-of-recursion new file mode 120000 index 0000000000..d7f4e7467c --- /dev/null +++ b/Lang/Phix/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/Phix \ No newline at end of file diff --git a/Lang/Phix/Find-the-last-Sunday-of-each-month b/Lang/Phix/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..96900f5227 --- /dev/null +++ b/Lang/Phix/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/Phix \ No newline at end of file diff --git a/Lang/Phix/Find-the-missing-permutation b/Lang/Phix/Find-the-missing-permutation new file mode 120000 index 0000000000..acf06be88f --- /dev/null +++ b/Lang/Phix/Find-the-missing-permutation @@ -0,0 +1 @@ +../../Task/Find-the-missing-permutation/Phix \ No newline at end of file diff --git a/Lang/Phix/First-class-functions b/Lang/Phix/First-class-functions new file mode 120000 index 0000000000..a1eb674d58 --- /dev/null +++ b/Lang/Phix/First-class-functions @@ -0,0 +1 @@ +../../Task/First-class-functions/Phix \ No newline at end of file diff --git a/Lang/Phix/First-class-functions-Use-numbers-analogously b/Lang/Phix/First-class-functions-Use-numbers-analogously new file mode 120000 index 0000000000..478d504457 --- /dev/null +++ b/Lang/Phix/First-class-functions-Use-numbers-analogously @@ -0,0 +1 @@ +../../Task/First-class-functions-Use-numbers-analogously/Phix \ No newline at end of file diff --git a/Lang/Phix/Five-weekends b/Lang/Phix/Five-weekends new file mode 120000 index 0000000000..cd14804a17 --- /dev/null +++ b/Lang/Phix/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/Phix \ No newline at end of file diff --git a/Lang/Phix/FizzBuzz b/Lang/Phix/FizzBuzz new file mode 120000 index 0000000000..fcadc00b5b --- /dev/null +++ b/Lang/Phix/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Phix \ No newline at end of file diff --git a/Lang/Phix/Flatten-a-list b/Lang/Phix/Flatten-a-list new file mode 120000 index 0000000000..757b57bfa1 --- /dev/null +++ b/Lang/Phix/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Phix \ No newline at end of file diff --git a/Lang/Phix/Flow-control-structures b/Lang/Phix/Flow-control-structures new file mode 120000 index 0000000000..60652799ad --- /dev/null +++ b/Lang/Phix/Flow-control-structures @@ -0,0 +1 @@ +../../Task/Flow-control-structures/Phix \ No newline at end of file diff --git a/Lang/Phix/Fork b/Lang/Phix/Fork new file mode 120000 index 0000000000..ca1084feed --- /dev/null +++ b/Lang/Phix/Fork @@ -0,0 +1 @@ +../../Task/Fork/Phix \ No newline at end of file diff --git a/Lang/Phix/Formatted-numeric-output b/Lang/Phix/Formatted-numeric-output new file mode 120000 index 0000000000..f085493ffb --- /dev/null +++ b/Lang/Phix/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/Phix \ No newline at end of file diff --git a/Lang/Phix/Fractal-tree b/Lang/Phix/Fractal-tree new file mode 120000 index 0000000000..a191531b28 --- /dev/null +++ b/Lang/Phix/Fractal-tree @@ -0,0 +1 @@ +../../Task/Fractal-tree/Phix \ No newline at end of file diff --git a/Lang/Phix/Function-composition b/Lang/Phix/Function-composition new file mode 120000 index 0000000000..715af81c88 --- /dev/null +++ b/Lang/Phix/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/Phix \ No newline at end of file diff --git a/Lang/Phix/Function-definition b/Lang/Phix/Function-definition new file mode 120000 index 0000000000..867b1cdcaa --- /dev/null +++ b/Lang/Phix/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Phix \ No newline at end of file diff --git a/Lang/Phix/GUI-component-interaction b/Lang/Phix/GUI-component-interaction new file mode 120000 index 0000000000..5c31b801ef --- /dev/null +++ b/Lang/Phix/GUI-component-interaction @@ -0,0 +1 @@ +../../Task/GUI-component-interaction/Phix \ No newline at end of file diff --git a/Lang/Phix/GUI-enabling-disabling-of-controls b/Lang/Phix/GUI-enabling-disabling-of-controls new file mode 120000 index 0000000000..81e4ed191c --- /dev/null +++ b/Lang/Phix/GUI-enabling-disabling-of-controls @@ -0,0 +1 @@ +../../Task/GUI-enabling-disabling-of-controls/Phix \ No newline at end of file diff --git a/Lang/Phix/Generate-lower-case-ASCII-alphabet b/Lang/Phix/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..920652684e --- /dev/null +++ b/Lang/Phix/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Phix \ No newline at end of file diff --git a/Lang/Phix/Generic-swap b/Lang/Phix/Generic-swap new file mode 120000 index 0000000000..98a9075dc9 --- /dev/null +++ b/Lang/Phix/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/Phix \ No newline at end of file diff --git a/Lang/Phix/Gray-code b/Lang/Phix/Gray-code new file mode 120000 index 0000000000..82c7acc978 --- /dev/null +++ b/Lang/Phix/Gray-code @@ -0,0 +1 @@ +../../Task/Gray-code/Phix \ No newline at end of file diff --git a/Lang/Phix/Grayscale-image b/Lang/Phix/Grayscale-image new file mode 120000 index 0000000000..d5f313b9a8 --- /dev/null +++ b/Lang/Phix/Grayscale-image @@ -0,0 +1 @@ +../../Task/Grayscale-image/Phix \ No newline at end of file diff --git a/Lang/Phix/Greatest-common-divisor b/Lang/Phix/Greatest-common-divisor new file mode 120000 index 0000000000..b9639eb2f8 --- /dev/null +++ b/Lang/Phix/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Phix \ No newline at end of file diff --git a/Lang/Phix/Greatest-element-of-a-list b/Lang/Phix/Greatest-element-of-a-list new file mode 120000 index 0000000000..d82b62688f --- /dev/null +++ b/Lang/Phix/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Phix \ No newline at end of file diff --git a/Lang/Phix/Greatest-subsequential-sum b/Lang/Phix/Greatest-subsequential-sum new file mode 120000 index 0000000000..e4a853d60a --- /dev/null +++ b/Lang/Phix/Greatest-subsequential-sum @@ -0,0 +1 @@ +../../Task/Greatest-subsequential-sum/Phix \ No newline at end of file diff --git a/Lang/Phix/Guess-the-number b/Lang/Phix/Guess-the-number new file mode 120000 index 0000000000..ce741541c6 --- /dev/null +++ b/Lang/Phix/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/Phix \ No newline at end of file diff --git a/Lang/Phix/Guess-the-number-With-feedback b/Lang/Phix/Guess-the-number-With-feedback new file mode 120000 index 0000000000..bd84f07ad3 --- /dev/null +++ b/Lang/Phix/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/Phix \ No newline at end of file diff --git a/Lang/Phix/Guess-the-number-With-feedback--player- b/Lang/Phix/Guess-the-number-With-feedback--player- new file mode 120000 index 0000000000..58592db615 --- /dev/null +++ b/Lang/Phix/Guess-the-number-With-feedback--player- @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback--player-/Phix \ No newline at end of file diff --git a/Lang/Phix/Hailstone-sequence b/Lang/Phix/Hailstone-sequence new file mode 120000 index 0000000000..d8152f9dcc --- /dev/null +++ b/Lang/Phix/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Phix \ No newline at end of file diff --git a/Lang/Phix/Happy-numbers b/Lang/Phix/Happy-numbers new file mode 120000 index 0000000000..d76d0fbaee --- /dev/null +++ b/Lang/Phix/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/Phix \ No newline at end of file diff --git a/Lang/Phix/Hello-world-Graphical b/Lang/Phix/Hello-world-Graphical new file mode 120000 index 0000000000..d0cc803164 --- /dev/null +++ b/Lang/Phix/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Phix \ No newline at end of file diff --git a/Lang/Phix/Hello-world-Line-printer b/Lang/Phix/Hello-world-Line-printer new file mode 120000 index 0000000000..f3ed61b9a2 --- /dev/null +++ b/Lang/Phix/Hello-world-Line-printer @@ -0,0 +1 @@ +../../Task/Hello-world-Line-printer/Phix \ No newline at end of file diff --git a/Lang/Phix/Hello-world-Newline-omission b/Lang/Phix/Hello-world-Newline-omission new file mode 120000 index 0000000000..e581174b50 --- /dev/null +++ b/Lang/Phix/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Phix \ No newline at end of file diff --git a/Lang/Phix/Hello-world-Standard-error b/Lang/Phix/Hello-world-Standard-error new file mode 120000 index 0000000000..56fec753b8 --- /dev/null +++ b/Lang/Phix/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Phix \ No newline at end of file diff --git a/Lang/Phix/Hello-world-Text b/Lang/Phix/Hello-world-Text new file mode 120000 index 0000000000..62177feb52 --- /dev/null +++ b/Lang/Phix/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Phix \ No newline at end of file diff --git a/Lang/Phix/Here-document b/Lang/Phix/Here-document new file mode 120000 index 0000000000..4a855eadb5 --- /dev/null +++ b/Lang/Phix/Here-document @@ -0,0 +1 @@ +../../Task/Here-document/Phix \ No newline at end of file diff --git a/Lang/Phix/Heronian-triangles b/Lang/Phix/Heronian-triangles new file mode 120000 index 0000000000..c8ca85f588 --- /dev/null +++ b/Lang/Phix/Heronian-triangles @@ -0,0 +1 @@ +../../Task/Heronian-triangles/Phix \ No newline at end of file diff --git a/Lang/Phix/Higher-order-functions b/Lang/Phix/Higher-order-functions new file mode 120000 index 0000000000..fb812b21ec --- /dev/null +++ b/Lang/Phix/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/Phix \ No newline at end of file diff --git a/Lang/Phix/Honeycombs b/Lang/Phix/Honeycombs new file mode 120000 index 0000000000..6591202626 --- /dev/null +++ b/Lang/Phix/Honeycombs @@ -0,0 +1 @@ +../../Task/Honeycombs/Phix \ No newline at end of file diff --git a/Lang/Phix/Horizontal-sundial-calculations b/Lang/Phix/Horizontal-sundial-calculations new file mode 120000 index 0000000000..848346f114 --- /dev/null +++ b/Lang/Phix/Horizontal-sundial-calculations @@ -0,0 +1 @@ +../../Task/Horizontal-sundial-calculations/Phix \ No newline at end of file diff --git a/Lang/Phix/Include-a-file b/Lang/Phix/Include-a-file new file mode 120000 index 0000000000..9fcba8e59b --- /dev/null +++ b/Lang/Phix/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/Phix \ No newline at end of file diff --git a/Lang/Phix/Increment-a-numerical-string b/Lang/Phix/Increment-a-numerical-string new file mode 120000 index 0000000000..bbca6e1230 --- /dev/null +++ b/Lang/Phix/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Phix \ No newline at end of file diff --git a/Lang/Phix/Infinity b/Lang/Phix/Infinity new file mode 120000 index 0000000000..14d71d3cc2 --- /dev/null +++ b/Lang/Phix/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/Phix \ No newline at end of file diff --git a/Lang/Phix/Integer-comparison b/Lang/Phix/Integer-comparison new file mode 120000 index 0000000000..43de9eb4b6 --- /dev/null +++ b/Lang/Phix/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Phix \ No newline at end of file diff --git a/Lang/Phix/Integer-overflow b/Lang/Phix/Integer-overflow new file mode 120000 index 0000000000..a37fbed389 --- /dev/null +++ b/Lang/Phix/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/Phix \ No newline at end of file diff --git a/Lang/Phix/Integer-sequence b/Lang/Phix/Integer-sequence new file mode 120000 index 0000000000..9388249499 --- /dev/null +++ b/Lang/Phix/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Phix \ No newline at end of file diff --git a/Lang/Phix/Inverted-index b/Lang/Phix/Inverted-index new file mode 120000 index 0000000000..08940f3305 --- /dev/null +++ b/Lang/Phix/Inverted-index @@ -0,0 +1 @@ +../../Task/Inverted-index/Phix \ No newline at end of file diff --git a/Lang/Phix/Jump-anywhere b/Lang/Phix/Jump-anywhere new file mode 120000 index 0000000000..0ec91bccdd --- /dev/null +++ b/Lang/Phix/Jump-anywhere @@ -0,0 +1 @@ +../../Task/Jump-anywhere/Phix \ No newline at end of file diff --git a/Lang/Phix/Keyboard-input-Flush-the-keyboard-buffer b/Lang/Phix/Keyboard-input-Flush-the-keyboard-buffer new file mode 120000 index 0000000000..c8f09c259b --- /dev/null +++ b/Lang/Phix/Keyboard-input-Flush-the-keyboard-buffer @@ -0,0 +1 @@ +../../Task/Keyboard-input-Flush-the-keyboard-buffer/Phix \ No newline at end of file diff --git a/Lang/Phix/Keyboard-input-Keypress-check b/Lang/Phix/Keyboard-input-Keypress-check new file mode 120000 index 0000000000..dfb3982fdc --- /dev/null +++ b/Lang/Phix/Keyboard-input-Keypress-check @@ -0,0 +1 @@ +../../Task/Keyboard-input-Keypress-check/Phix \ No newline at end of file diff --git a/Lang/Phix/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/Phix/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..340e2affe3 --- /dev/null +++ b/Lang/Phix/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/Phix \ No newline at end of file diff --git a/Lang/Phix/Knights-tour b/Lang/Phix/Knights-tour new file mode 120000 index 0000000000..d6d9452010 --- /dev/null +++ b/Lang/Phix/Knights-tour @@ -0,0 +1 @@ +../../Task/Knights-tour/Phix \ No newline at end of file diff --git a/Lang/Phix/Knuth-shuffle b/Lang/Phix/Knuth-shuffle new file mode 120000 index 0000000000..2106541356 --- /dev/null +++ b/Lang/Phix/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Phix \ No newline at end of file diff --git a/Lang/Phix/Langtons-ant b/Lang/Phix/Langtons-ant new file mode 120000 index 0000000000..f7524e0d5b --- /dev/null +++ b/Lang/Phix/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/Phix \ No newline at end of file diff --git a/Lang/Phix/Largest-int-from-concatenated-ints b/Lang/Phix/Largest-int-from-concatenated-ints new file mode 120000 index 0000000000..d1bb1bcf2b --- /dev/null +++ b/Lang/Phix/Largest-int-from-concatenated-ints @@ -0,0 +1 @@ +../../Task/Largest-int-from-concatenated-ints/Phix \ No newline at end of file diff --git a/Lang/Phix/Last-Friday-of-each-month b/Lang/Phix/Last-Friday-of-each-month new file mode 120000 index 0000000000..e2cd6b7056 --- /dev/null +++ b/Lang/Phix/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/Phix \ No newline at end of file diff --git a/Lang/Phix/Last-letter-first-letter b/Lang/Phix/Last-letter-first-letter new file mode 120000 index 0000000000..20a6eb6b66 --- /dev/null +++ b/Lang/Phix/Last-letter-first-letter @@ -0,0 +1 @@ +../../Task/Last-letter-first-letter/Phix \ No newline at end of file diff --git a/Lang/Phix/Leap-year b/Lang/Phix/Leap-year new file mode 120000 index 0000000000..073525b81f --- /dev/null +++ b/Lang/Phix/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Phix \ No newline at end of file diff --git a/Lang/Phix/Least-common-multiple b/Lang/Phix/Least-common-multiple new file mode 120000 index 0000000000..73d74cad31 --- /dev/null +++ b/Lang/Phix/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/Phix \ No newline at end of file diff --git a/Lang/Phix/Letter-frequency b/Lang/Phix/Letter-frequency new file mode 120000 index 0000000000..abc4a090b8 --- /dev/null +++ b/Lang/Phix/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/Phix \ No newline at end of file diff --git a/Lang/Phix/Levenshtein-distance b/Lang/Phix/Levenshtein-distance new file mode 120000 index 0000000000..5310801463 --- /dev/null +++ b/Lang/Phix/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Phix \ No newline at end of file diff --git a/Lang/Phix/Literals-Floating-point b/Lang/Phix/Literals-Floating-point new file mode 120000 index 0000000000..2a61a103a2 --- /dev/null +++ b/Lang/Phix/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/Phix \ No newline at end of file diff --git a/Lang/Phix/Literals-Integer b/Lang/Phix/Literals-Integer new file mode 120000 index 0000000000..31ee35911c --- /dev/null +++ b/Lang/Phix/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/Phix \ No newline at end of file diff --git a/Lang/Phix/Literals-String b/Lang/Phix/Literals-String new file mode 120000 index 0000000000..b5cdebf8f4 --- /dev/null +++ b/Lang/Phix/Literals-String @@ -0,0 +1 @@ +../../Task/Literals-String/Phix \ No newline at end of file diff --git a/Lang/Phix/Logical-operations b/Lang/Phix/Logical-operations new file mode 120000 index 0000000000..ae6193bda4 --- /dev/null +++ b/Lang/Phix/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Phix \ No newline at end of file diff --git a/Lang/Phix/Long-multiplication b/Lang/Phix/Long-multiplication new file mode 120000 index 0000000000..6c9bcdf400 --- /dev/null +++ b/Lang/Phix/Long-multiplication @@ -0,0 +1 @@ +../../Task/Long-multiplication/Phix \ No newline at end of file diff --git a/Lang/Phix/Longest-string-challenge b/Lang/Phix/Longest-string-challenge new file mode 120000 index 0000000000..d077bb7992 --- /dev/null +++ b/Lang/Phix/Longest-string-challenge @@ -0,0 +1 @@ +../../Task/Longest-string-challenge/Phix \ No newline at end of file diff --git a/Lang/Phix/Loop-over-multiple-arrays-simultaneously b/Lang/Phix/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..d1819e1267 --- /dev/null +++ b/Lang/Phix/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Phix \ No newline at end of file diff --git a/Lang/Phix/Loops-Break b/Lang/Phix/Loops-Break new file mode 120000 index 0000000000..b3f2913d26 --- /dev/null +++ b/Lang/Phix/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Phix \ No newline at end of file diff --git a/Lang/Phix/Loops-Continue b/Lang/Phix/Loops-Continue new file mode 120000 index 0000000000..cb122b5b66 --- /dev/null +++ b/Lang/Phix/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Phix \ No newline at end of file diff --git a/Lang/Phix/Loops-Do-while b/Lang/Phix/Loops-Do-while new file mode 120000 index 0000000000..dcb58bf26c --- /dev/null +++ b/Lang/Phix/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Phix \ No newline at end of file diff --git a/Lang/Phix/Loops-Downward-for b/Lang/Phix/Loops-Downward-for new file mode 120000 index 0000000000..e3f5fdf658 --- /dev/null +++ b/Lang/Phix/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Phix \ No newline at end of file diff --git a/Lang/Phix/Loops-For b/Lang/Phix/Loops-For new file mode 120000 index 0000000000..c3d4720e80 --- /dev/null +++ b/Lang/Phix/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Phix \ No newline at end of file diff --git a/Lang/Phix/Loops-For-with-a-specified-step b/Lang/Phix/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..a3ac1e6af5 --- /dev/null +++ b/Lang/Phix/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Phix \ No newline at end of file diff --git a/Lang/Phix/Loops-Foreach b/Lang/Phix/Loops-Foreach new file mode 120000 index 0000000000..4268b8f417 --- /dev/null +++ b/Lang/Phix/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Phix \ No newline at end of file diff --git a/Lang/Phix/Loops-Infinite b/Lang/Phix/Loops-Infinite new file mode 120000 index 0000000000..51cbcf26f0 --- /dev/null +++ b/Lang/Phix/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Phix \ No newline at end of file diff --git a/Lang/Phix/Loops-N-plus-one-half b/Lang/Phix/Loops-N-plus-one-half new file mode 120000 index 0000000000..945cf7b145 --- /dev/null +++ b/Lang/Phix/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Phix \ No newline at end of file diff --git a/Lang/Phix/Loops-Nested b/Lang/Phix/Loops-Nested new file mode 120000 index 0000000000..395d8cbd6e --- /dev/null +++ b/Lang/Phix/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/Phix \ No newline at end of file diff --git a/Lang/Phix/Loops-While b/Lang/Phix/Loops-While new file mode 120000 index 0000000000..2aa9c54d89 --- /dev/null +++ b/Lang/Phix/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Phix \ No newline at end of file diff --git a/Lang/Phix/Luhn-test-of-credit-card-numbers b/Lang/Phix/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..fb62b42743 --- /dev/null +++ b/Lang/Phix/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Phix \ No newline at end of file diff --git a/Lang/Phix/MD5-Implementation b/Lang/Phix/MD5-Implementation new file mode 120000 index 0000000000..0ad4221854 --- /dev/null +++ b/Lang/Phix/MD5-Implementation @@ -0,0 +1 @@ +../../Task/MD5-Implementation/Phix \ No newline at end of file diff --git a/Lang/Phix/Machine-code b/Lang/Phix/Machine-code new file mode 120000 index 0000000000..e323f098a3 --- /dev/null +++ b/Lang/Phix/Machine-code @@ -0,0 +1 @@ +../../Task/Machine-code/Phix \ No newline at end of file diff --git a/Lang/Phix/Mandelbrot-set b/Lang/Phix/Mandelbrot-set new file mode 120000 index 0000000000..330cd9ce92 --- /dev/null +++ b/Lang/Phix/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/Phix \ No newline at end of file diff --git a/Lang/Phix/Map-range b/Lang/Phix/Map-range new file mode 120000 index 0000000000..a9a530c43d --- /dev/null +++ b/Lang/Phix/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/Phix \ No newline at end of file diff --git a/Lang/Phix/Matrix-multiplication b/Lang/Phix/Matrix-multiplication new file mode 120000 index 0000000000..630b2760b9 --- /dev/null +++ b/Lang/Phix/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/Phix \ No newline at end of file diff --git a/Lang/Phix/Matrix-transposition b/Lang/Phix/Matrix-transposition new file mode 120000 index 0000000000..af65b8ad21 --- /dev/null +++ b/Lang/Phix/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/Phix \ No newline at end of file diff --git a/Lang/Phix/Memory-allocation b/Lang/Phix/Memory-allocation new file mode 120000 index 0000000000..d895cd047a --- /dev/null +++ b/Lang/Phix/Memory-allocation @@ -0,0 +1 @@ +../../Task/Memory-allocation/Phix \ No newline at end of file diff --git a/Lang/Phix/Menu b/Lang/Phix/Menu new file mode 120000 index 0000000000..0e919e4b02 --- /dev/null +++ b/Lang/Phix/Menu @@ -0,0 +1 @@ +../../Task/Menu/Phix \ No newline at end of file diff --git a/Lang/Phix/Monty-Hall-problem b/Lang/Phix/Monty-Hall-problem new file mode 120000 index 0000000000..8cc9512b53 --- /dev/null +++ b/Lang/Phix/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/Phix \ No newline at end of file diff --git a/Lang/Phix/Morse-code b/Lang/Phix/Morse-code new file mode 120000 index 0000000000..7d06d4f7c4 --- /dev/null +++ b/Lang/Phix/Morse-code @@ -0,0 +1 @@ +../../Task/Morse-code/Phix \ No newline at end of file diff --git a/Lang/Phix/Multiplication-tables b/Lang/Phix/Multiplication-tables new file mode 120000 index 0000000000..64d15b4572 --- /dev/null +++ b/Lang/Phix/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/Phix \ No newline at end of file diff --git a/Lang/Phix/Mutual-recursion b/Lang/Phix/Mutual-recursion new file mode 120000 index 0000000000..d7bc8fcd14 --- /dev/null +++ b/Lang/Phix/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/Phix \ No newline at end of file diff --git a/Lang/Phix/Named-parameters b/Lang/Phix/Named-parameters new file mode 120000 index 0000000000..630df3cfdd --- /dev/null +++ b/Lang/Phix/Named-parameters @@ -0,0 +1 @@ +../../Task/Named-parameters/Phix \ No newline at end of file diff --git a/Lang/Phix/Non-decimal-radices-Convert b/Lang/Phix/Non-decimal-radices-Convert new file mode 120000 index 0000000000..da87b4ffa2 --- /dev/null +++ b/Lang/Phix/Non-decimal-radices-Convert @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Convert/Phix \ No newline at end of file diff --git a/Lang/Phix/Non-decimal-radices-Input b/Lang/Phix/Non-decimal-radices-Input new file mode 120000 index 0000000000..8fabdccc62 --- /dev/null +++ b/Lang/Phix/Non-decimal-radices-Input @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Input/Phix \ No newline at end of file diff --git a/Lang/Phix/Non-decimal-radices-Output b/Lang/Phix/Non-decimal-radices-Output new file mode 120000 index 0000000000..b9dba0fb21 --- /dev/null +++ b/Lang/Phix/Non-decimal-radices-Output @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Output/Phix \ No newline at end of file diff --git a/Lang/Phix/Null-object b/Lang/Phix/Null-object new file mode 120000 index 0000000000..d596c9efbb --- /dev/null +++ b/Lang/Phix/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/Phix \ No newline at end of file diff --git a/Lang/Phix/Number-names b/Lang/Phix/Number-names new file mode 120000 index 0000000000..a4fe2f533d --- /dev/null +++ b/Lang/Phix/Number-names @@ -0,0 +1 @@ +../../Task/Number-names/Phix \ No newline at end of file diff --git a/Lang/Phix/Number-reversal-game b/Lang/Phix/Number-reversal-game new file mode 120000 index 0000000000..b6a8e5102f --- /dev/null +++ b/Lang/Phix/Number-reversal-game @@ -0,0 +1 @@ +../../Task/Number-reversal-game/Phix \ No newline at end of file diff --git a/Lang/Phix/Numerical-integration b/Lang/Phix/Numerical-integration new file mode 120000 index 0000000000..0bc6cce2f0 --- /dev/null +++ b/Lang/Phix/Numerical-integration @@ -0,0 +1 @@ +../../Task/Numerical-integration/Phix \ No newline at end of file diff --git a/Lang/Phix/Old-lady-swallowed-a-fly b/Lang/Phix/Old-lady-swallowed-a-fly new file mode 120000 index 0000000000..ca0c43f7db --- /dev/null +++ b/Lang/Phix/Old-lady-swallowed-a-fly @@ -0,0 +1 @@ +../../Task/Old-lady-swallowed-a-fly/Phix \ No newline at end of file diff --git a/Lang/Phix/One-dimensional-cellular-automata b/Lang/Phix/One-dimensional-cellular-automata new file mode 120000 index 0000000000..3a4e9019b6 --- /dev/null +++ b/Lang/Phix/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/Phix \ No newline at end of file diff --git a/Lang/Phix/One-of-n-lines-in-a-file b/Lang/Phix/One-of-n-lines-in-a-file new file mode 120000 index 0000000000..702f0220f7 --- /dev/null +++ b/Lang/Phix/One-of-n-lines-in-a-file @@ -0,0 +1 @@ +../../Task/One-of-n-lines-in-a-file/Phix \ No newline at end of file diff --git a/Lang/Phix/OpenGL b/Lang/Phix/OpenGL new file mode 120000 index 0000000000..4d0870521c --- /dev/null +++ b/Lang/Phix/OpenGL @@ -0,0 +1 @@ +../../Task/OpenGL/Phix \ No newline at end of file diff --git a/Lang/Phix/Optional-parameters b/Lang/Phix/Optional-parameters new file mode 120000 index 0000000000..a405007449 --- /dev/null +++ b/Lang/Phix/Optional-parameters @@ -0,0 +1 @@ +../../Task/Optional-parameters/Phix \ No newline at end of file diff --git a/Lang/Phix/Order-disjoint-list-items b/Lang/Phix/Order-disjoint-list-items new file mode 120000 index 0000000000..37d7989052 --- /dev/null +++ b/Lang/Phix/Order-disjoint-list-items @@ -0,0 +1 @@ +../../Task/Order-disjoint-list-items/Phix \ No newline at end of file diff --git a/Lang/Phix/Ordered-words b/Lang/Phix/Ordered-words new file mode 120000 index 0000000000..025cd5191d --- /dev/null +++ b/Lang/Phix/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Phix \ No newline at end of file diff --git a/Lang/Phix/Palindrome-detection b/Lang/Phix/Palindrome-detection new file mode 120000 index 0000000000..c974ad6599 --- /dev/null +++ b/Lang/Phix/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Phix \ No newline at end of file diff --git a/Lang/Phix/Parsing-RPN-calculator-algorithm b/Lang/Phix/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..74f432c39d --- /dev/null +++ b/Lang/Phix/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/Phix \ No newline at end of file diff --git a/Lang/Phix/Parsing-RPN-to-infix-conversion b/Lang/Phix/Parsing-RPN-to-infix-conversion new file mode 120000 index 0000000000..c5a3fac3c6 --- /dev/null +++ b/Lang/Phix/Parsing-RPN-to-infix-conversion @@ -0,0 +1 @@ +../../Task/Parsing-RPN-to-infix-conversion/Phix \ No newline at end of file diff --git a/Lang/Phix/Parsing-Shunting-yard-algorithm b/Lang/Phix/Parsing-Shunting-yard-algorithm new file mode 120000 index 0000000000..3b33b67e48 --- /dev/null +++ b/Lang/Phix/Parsing-Shunting-yard-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-Shunting-yard-algorithm/Phix \ No newline at end of file diff --git a/Lang/Phix/Pascals-triangle b/Lang/Phix/Pascals-triangle new file mode 120000 index 0000000000..7c5c4ee6ff --- /dev/null +++ b/Lang/Phix/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/Phix \ No newline at end of file diff --git a/Lang/Phix/Perfect-numbers b/Lang/Phix/Perfect-numbers new file mode 120000 index 0000000000..d8c04a7866 --- /dev/null +++ b/Lang/Phix/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/Phix \ No newline at end of file diff --git a/Lang/Phix/Permutations b/Lang/Phix/Permutations new file mode 120000 index 0000000000..8392170ddb --- /dev/null +++ b/Lang/Phix/Permutations @@ -0,0 +1 @@ +../../Task/Permutations/Phix \ No newline at end of file diff --git a/Lang/Phix/Phrase-reversals b/Lang/Phix/Phrase-reversals new file mode 120000 index 0000000000..50bd9dba1c --- /dev/null +++ b/Lang/Phix/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/Phix \ No newline at end of file diff --git a/Lang/Phix/Pi b/Lang/Phix/Pi new file mode 120000 index 0000000000..2cb8e3fe52 --- /dev/null +++ b/Lang/Phix/Pi @@ -0,0 +1 @@ +../../Task/Pi/Phix \ No newline at end of file diff --git a/Lang/Phix/Pick-random-element b/Lang/Phix/Pick-random-element new file mode 120000 index 0000000000..b815961fa4 --- /dev/null +++ b/Lang/Phix/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/Phix \ No newline at end of file diff --git a/Lang/Phix/Polymorphism b/Lang/Phix/Polymorphism new file mode 120000 index 0000000000..4f3adc02a3 --- /dev/null +++ b/Lang/Phix/Polymorphism @@ -0,0 +1 @@ +../../Task/Polymorphism/Phix \ No newline at end of file diff --git a/Lang/Phix/Price-fraction b/Lang/Phix/Price-fraction new file mode 120000 index 0000000000..f4fbebea61 --- /dev/null +++ b/Lang/Phix/Price-fraction @@ -0,0 +1 @@ +../../Task/Price-fraction/Phix \ No newline at end of file diff --git a/Lang/Phix/Primality-by-trial-division b/Lang/Phix/Primality-by-trial-division new file mode 120000 index 0000000000..2f8a83388d --- /dev/null +++ b/Lang/Phix/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/Phix \ No newline at end of file diff --git a/Lang/Phix/Probabilistic-choice b/Lang/Phix/Probabilistic-choice new file mode 120000 index 0000000000..127b5769a5 --- /dev/null +++ b/Lang/Phix/Probabilistic-choice @@ -0,0 +1 @@ +../../Task/Probabilistic-choice/Phix \ No newline at end of file diff --git a/Lang/Phix/Program-name b/Lang/Phix/Program-name new file mode 120000 index 0000000000..3d99ca54ab --- /dev/null +++ b/Lang/Phix/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/Phix \ No newline at end of file diff --git a/Lang/Phix/Program-termination b/Lang/Phix/Program-termination new file mode 120000 index 0000000000..1ae18b0c93 --- /dev/null +++ b/Lang/Phix/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/Phix \ No newline at end of file diff --git a/Lang/Phix/Pythagorean-triples b/Lang/Phix/Pythagorean-triples new file mode 120000 index 0000000000..b80370e794 --- /dev/null +++ b/Lang/Phix/Pythagorean-triples @@ -0,0 +1 @@ +../../Task/Pythagorean-triples/Phix \ No newline at end of file diff --git a/Lang/Phix/Quaternion-type b/Lang/Phix/Quaternion-type new file mode 120000 index 0000000000..bae473b66e --- /dev/null +++ b/Lang/Phix/Quaternion-type @@ -0,0 +1 @@ +../../Task/Quaternion-type/Phix \ No newline at end of file diff --git a/Lang/Phix/Queue-Definition b/Lang/Phix/Queue-Definition new file mode 120000 index 0000000000..8065b02f5e --- /dev/null +++ b/Lang/Phix/Queue-Definition @@ -0,0 +1 @@ +../../Task/Queue-Definition/Phix \ No newline at end of file diff --git a/Lang/Phix/Queue-Usage b/Lang/Phix/Queue-Usage new file mode 120000 index 0000000000..085b00337d --- /dev/null +++ b/Lang/Phix/Queue-Usage @@ -0,0 +1 @@ +../../Task/Queue-Usage/Phix \ No newline at end of file diff --git a/Lang/Phix/Quickselect-algorithm b/Lang/Phix/Quickselect-algorithm new file mode 120000 index 0000000000..c7520f1d81 --- /dev/null +++ b/Lang/Phix/Quickselect-algorithm @@ -0,0 +1 @@ +../../Task/Quickselect-algorithm/Phix \ No newline at end of file diff --git a/Lang/Phix/Quine b/Lang/Phix/Quine new file mode 120000 index 0000000000..7a0e7c40d3 --- /dev/null +++ b/Lang/Phix/Quine @@ -0,0 +1 @@ +../../Task/Quine/Phix \ No newline at end of file diff --git a/Lang/Phix/README b/Lang/Phix/README new file mode 100644 index 0000000000..5e6f0cd8c3 --- /dev/null +++ b/Lang/Phix/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Phix diff --git a/Lang/Phix/Random-numbers b/Lang/Phix/Random-numbers new file mode 120000 index 0000000000..1354c46d04 --- /dev/null +++ b/Lang/Phix/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/Phix \ No newline at end of file diff --git a/Lang/Phix/Range-extraction b/Lang/Phix/Range-extraction new file mode 120000 index 0000000000..15a9700b3e --- /dev/null +++ b/Lang/Phix/Range-extraction @@ -0,0 +1 @@ +../../Task/Range-extraction/Phix \ No newline at end of file diff --git a/Lang/Phix/Ray-casting-algorithm b/Lang/Phix/Ray-casting-algorithm new file mode 120000 index 0000000000..9eef01e1b8 --- /dev/null +++ b/Lang/Phix/Ray-casting-algorithm @@ -0,0 +1 @@ +../../Task/Ray-casting-algorithm/Phix \ No newline at end of file diff --git a/Lang/Phix/Read-a-file-line-by-line b/Lang/Phix/Read-a-file-line-by-line new file mode 120000 index 0000000000..a240696c30 --- /dev/null +++ b/Lang/Phix/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/Phix \ No newline at end of file diff --git a/Lang/Phix/Read-entire-file b/Lang/Phix/Read-entire-file new file mode 120000 index 0000000000..fb553f4f68 --- /dev/null +++ b/Lang/Phix/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Phix \ No newline at end of file diff --git a/Lang/Phix/Real-constants-and-functions b/Lang/Phix/Real-constants-and-functions new file mode 120000 index 0000000000..e28ba8c8b4 --- /dev/null +++ b/Lang/Phix/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/Phix \ No newline at end of file diff --git a/Lang/Phix/Reduced-row-echelon-form b/Lang/Phix/Reduced-row-echelon-form new file mode 120000 index 0000000000..9665778f03 --- /dev/null +++ b/Lang/Phix/Reduced-row-echelon-form @@ -0,0 +1 @@ +../../Task/Reduced-row-echelon-form/Phix \ No newline at end of file diff --git a/Lang/Phix/Remove-duplicate-elements b/Lang/Phix/Remove-duplicate-elements new file mode 120000 index 0000000000..1495f6f7fb --- /dev/null +++ b/Lang/Phix/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/Phix \ No newline at end of file diff --git a/Lang/Phix/Repeat-a-string b/Lang/Phix/Repeat-a-string new file mode 120000 index 0000000000..0b02f498b9 --- /dev/null +++ b/Lang/Phix/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Phix \ No newline at end of file diff --git a/Lang/Phix/Return-multiple-values b/Lang/Phix/Return-multiple-values new file mode 120000 index 0000000000..49afc0f5c7 --- /dev/null +++ b/Lang/Phix/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/Phix \ No newline at end of file diff --git a/Lang/Phix/Reverse-a-string b/Lang/Phix/Reverse-a-string new file mode 120000 index 0000000000..5db8418d4f --- /dev/null +++ b/Lang/Phix/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Phix \ No newline at end of file diff --git a/Lang/Phix/Reverse-words-in-a-string b/Lang/Phix/Reverse-words-in-a-string new file mode 120000 index 0000000000..94b085b023 --- /dev/null +++ b/Lang/Phix/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/Phix \ No newline at end of file diff --git a/Lang/Phix/Rock-paper-scissors b/Lang/Phix/Rock-paper-scissors new file mode 120000 index 0000000000..836f272a96 --- /dev/null +++ b/Lang/Phix/Rock-paper-scissors @@ -0,0 +1 @@ +../../Task/Rock-paper-scissors/Phix \ No newline at end of file diff --git a/Lang/Phix/Roman-numerals-Decode b/Lang/Phix/Roman-numerals-Decode new file mode 120000 index 0000000000..a57fb4d8c7 --- /dev/null +++ b/Lang/Phix/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/Phix \ No newline at end of file diff --git a/Lang/Phix/Roman-numerals-Encode b/Lang/Phix/Roman-numerals-Encode new file mode 120000 index 0000000000..297c16957b --- /dev/null +++ b/Lang/Phix/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/Phix \ No newline at end of file diff --git a/Lang/Phix/Rot-13 b/Lang/Phix/Rot-13 new file mode 120000 index 0000000000..d6584e2e0c --- /dev/null +++ b/Lang/Phix/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Phix \ No newline at end of file diff --git a/Lang/Phix/Run-length-encoding b/Lang/Phix/Run-length-encoding new file mode 120000 index 0000000000..954adb9907 --- /dev/null +++ b/Lang/Phix/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/Phix \ No newline at end of file diff --git a/Lang/Phix/S-Expressions b/Lang/Phix/S-Expressions new file mode 120000 index 0000000000..58f2314d3e --- /dev/null +++ b/Lang/Phix/S-Expressions @@ -0,0 +1 @@ +../../Task/S-Expressions/Phix \ No newline at end of file diff --git a/Lang/Phix/SEDOLs b/Lang/Phix/SEDOLs new file mode 120000 index 0000000000..6e780340fb --- /dev/null +++ b/Lang/Phix/SEDOLs @@ -0,0 +1 @@ +../../Task/SEDOLs/Phix \ No newline at end of file diff --git a/Lang/Phix/SHA-256 b/Lang/Phix/SHA-256 new file mode 120000 index 0000000000..a00e0e800a --- /dev/null +++ b/Lang/Phix/SHA-256 @@ -0,0 +1 @@ +../../Task/SHA-256/Phix \ No newline at end of file diff --git a/Lang/Phix/Safe-addition b/Lang/Phix/Safe-addition new file mode 120000 index 0000000000..32df4fe9d3 --- /dev/null +++ b/Lang/Phix/Safe-addition @@ -0,0 +1 @@ +../../Task/Safe-addition/Phix \ No newline at end of file diff --git a/Lang/Phix/Search-a-list b/Lang/Phix/Search-a-list new file mode 120000 index 0000000000..c7ca25385f --- /dev/null +++ b/Lang/Phix/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Phix \ No newline at end of file diff --git a/Lang/Phix/Self-describing-numbers b/Lang/Phix/Self-describing-numbers new file mode 120000 index 0000000000..579d03e462 --- /dev/null +++ b/Lang/Phix/Self-describing-numbers @@ -0,0 +1 @@ +../../Task/Self-describing-numbers/Phix \ No newline at end of file diff --git a/Lang/Phix/Semordnilap b/Lang/Phix/Semordnilap new file mode 120000 index 0000000000..f0b7dfbcaf --- /dev/null +++ b/Lang/Phix/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/Phix \ No newline at end of file diff --git a/Lang/Phix/Sequence-of-non-squares b/Lang/Phix/Sequence-of-non-squares new file mode 120000 index 0000000000..ae77b9b63c --- /dev/null +++ b/Lang/Phix/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/Phix \ No newline at end of file diff --git a/Lang/Phix/Short-circuit-evaluation b/Lang/Phix/Short-circuit-evaluation new file mode 120000 index 0000000000..0640f1fca6 --- /dev/null +++ b/Lang/Phix/Short-circuit-evaluation @@ -0,0 +1 @@ +../../Task/Short-circuit-evaluation/Phix \ No newline at end of file diff --git a/Lang/Phix/Sierpinski-carpet b/Lang/Phix/Sierpinski-carpet new file mode 120000 index 0000000000..c9910d3c62 --- /dev/null +++ b/Lang/Phix/Sierpinski-carpet @@ -0,0 +1 @@ +../../Task/Sierpinski-carpet/Phix \ No newline at end of file diff --git a/Lang/Phix/Sierpinski-triangle b/Lang/Phix/Sierpinski-triangle new file mode 120000 index 0000000000..4d93dec868 --- /dev/null +++ b/Lang/Phix/Sierpinski-triangle @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle/Phix \ No newline at end of file diff --git a/Lang/Phix/Sieve-of-Eratosthenes b/Lang/Phix/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..8d26365526 --- /dev/null +++ b/Lang/Phix/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/Phix \ No newline at end of file diff --git a/Lang/Phix/Simple-database b/Lang/Phix/Simple-database new file mode 120000 index 0000000000..f4755fb27a --- /dev/null +++ b/Lang/Phix/Simple-database @@ -0,0 +1 @@ +../../Task/Simple-database/Phix \ No newline at end of file diff --git a/Lang/Phix/Simple-windowed-application b/Lang/Phix/Simple-windowed-application new file mode 120000 index 0000000000..77364680d5 --- /dev/null +++ b/Lang/Phix/Simple-windowed-application @@ -0,0 +1 @@ +../../Task/Simple-windowed-application/Phix \ No newline at end of file diff --git a/Lang/Phix/Sleep b/Lang/Phix/Sleep new file mode 120000 index 0000000000..be290569f3 --- /dev/null +++ b/Lang/Phix/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Phix \ No newline at end of file diff --git a/Lang/Phix/Solve-a-Hidato-puzzle b/Lang/Phix/Solve-a-Hidato-puzzle new file mode 120000 index 0000000000..614f3df153 --- /dev/null +++ b/Lang/Phix/Solve-a-Hidato-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Hidato-puzzle/Phix \ No newline at end of file diff --git a/Lang/Phix/Solve-a-Holy-Knights-tour b/Lang/Phix/Solve-a-Holy-Knights-tour new file mode 120000 index 0000000000..7f58c188ef --- /dev/null +++ b/Lang/Phix/Solve-a-Holy-Knights-tour @@ -0,0 +1 @@ +../../Task/Solve-a-Holy-Knights-tour/Phix \ No newline at end of file diff --git a/Lang/Phix/Solve-a-Hopido-puzzle b/Lang/Phix/Solve-a-Hopido-puzzle new file mode 120000 index 0000000000..c3182a37c2 --- /dev/null +++ b/Lang/Phix/Solve-a-Hopido-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Hopido-puzzle/Phix \ No newline at end of file diff --git a/Lang/Phix/Solve-a-Numbrix-puzzle b/Lang/Phix/Solve-a-Numbrix-puzzle new file mode 120000 index 0000000000..5f89584fd6 --- /dev/null +++ b/Lang/Phix/Solve-a-Numbrix-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Numbrix-puzzle/Phix \ No newline at end of file diff --git a/Lang/Phix/Solve-the-no-connection-puzzle b/Lang/Phix/Solve-the-no-connection-puzzle new file mode 120000 index 0000000000..ce8014e578 --- /dev/null +++ b/Lang/Phix/Solve-the-no-connection-puzzle @@ -0,0 +1 @@ +../../Task/Solve-the-no-connection-puzzle/Phix \ No newline at end of file diff --git a/Lang/Phix/Sort-an-array-of-composite-structures b/Lang/Phix/Sort-an-array-of-composite-structures new file mode 120000 index 0000000000..9288c9d25f --- /dev/null +++ b/Lang/Phix/Sort-an-array-of-composite-structures @@ -0,0 +1 @@ +../../Task/Sort-an-array-of-composite-structures/Phix \ No newline at end of file diff --git a/Lang/Phix/Sort-an-integer-array b/Lang/Phix/Sort-an-integer-array new file mode 120000 index 0000000000..2b520eaccb --- /dev/null +++ b/Lang/Phix/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Phix \ No newline at end of file diff --git a/Lang/Phix/Sort-disjoint-sublist b/Lang/Phix/Sort-disjoint-sublist new file mode 120000 index 0000000000..5ceaf24f0b --- /dev/null +++ b/Lang/Phix/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/Phix \ No newline at end of file diff --git a/Lang/Phix/Sort-using-a-custom-comparator b/Lang/Phix/Sort-using-a-custom-comparator new file mode 120000 index 0000000000..2ad0e7cf76 --- /dev/null +++ b/Lang/Phix/Sort-using-a-custom-comparator @@ -0,0 +1 @@ +../../Task/Sort-using-a-custom-comparator/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Bead-sort b/Lang/Phix/Sorting-algorithms-Bead-sort new file mode 120000 index 0000000000..7d34a21f1d --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Bead-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bead-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Bogosort b/Lang/Phix/Sorting-algorithms-Bogosort new file mode 120000 index 0000000000..f3dc2b6274 --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Bogosort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bogosort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Bubble-sort b/Lang/Phix/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..690688aef9 --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Cocktail-sort b/Lang/Phix/Sorting-algorithms-Cocktail-sort new file mode 120000 index 0000000000..ae9b7c6d35 --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Cocktail-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Cocktail-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Comb-sort b/Lang/Phix/Sorting-algorithms-Comb-sort new file mode 120000 index 0000000000..e452317deb --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Comb-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Comb-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Counting-sort b/Lang/Phix/Sorting-algorithms-Counting-sort new file mode 120000 index 0000000000..a1a8899371 --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Counting-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Counting-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Gnome-sort b/Lang/Phix/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..0e4365fac9 --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Heapsort b/Lang/Phix/Sorting-algorithms-Heapsort new file mode 120000 index 0000000000..32c86d0072 --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Heapsort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Heapsort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Insertion-sort b/Lang/Phix/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..66d8843b3c --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Merge-sort b/Lang/Phix/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..650b7c8c54 --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Pancake-sort b/Lang/Phix/Sorting-algorithms-Pancake-sort new file mode 120000 index 0000000000..39beab7726 --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Pancake-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Pancake-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Permutation-sort b/Lang/Phix/Sorting-algorithms-Permutation-sort new file mode 120000 index 0000000000..eeed718162 --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Permutation-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Permutation-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Quicksort b/Lang/Phix/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..a9d7f48502 --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Radix-sort b/Lang/Phix/Sorting-algorithms-Radix-sort new file mode 120000 index 0000000000..c45c1f15d4 --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Radix-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Radix-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Selection-sort b/Lang/Phix/Sorting-algorithms-Selection-sort new file mode 120000 index 0000000000..ef086ad9be --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Selection-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Selection-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Shell-sort b/Lang/Phix/Sorting-algorithms-Shell-sort new file mode 120000 index 0000000000..07429e886e --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Shell-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Shell-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Sleep-sort b/Lang/Phix/Sorting-algorithms-Sleep-sort new file mode 120000 index 0000000000..ff2a56162e --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Sleep-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Sleep-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Stooge-sort b/Lang/Phix/Sorting-algorithms-Stooge-sort new file mode 120000 index 0000000000..f60e573928 --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Stooge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Stooge-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Sorting-algorithms-Strand-sort b/Lang/Phix/Sorting-algorithms-Strand-sort new file mode 120000 index 0000000000..566b86132b --- /dev/null +++ b/Lang/Phix/Sorting-algorithms-Strand-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Strand-sort/Phix \ No newline at end of file diff --git a/Lang/Phix/Spiral-matrix b/Lang/Phix/Spiral-matrix new file mode 120000 index 0000000000..b3fc41937c --- /dev/null +++ b/Lang/Phix/Spiral-matrix @@ -0,0 +1 @@ +../../Task/Spiral-matrix/Phix \ No newline at end of file diff --git a/Lang/Phix/Stack b/Lang/Phix/Stack new file mode 120000 index 0000000000..bc915e90b6 --- /dev/null +++ b/Lang/Phix/Stack @@ -0,0 +1 @@ +../../Task/Stack/Phix \ No newline at end of file diff --git a/Lang/Phix/Stair-climbing-puzzle b/Lang/Phix/Stair-climbing-puzzle new file mode 120000 index 0000000000..695b93446b --- /dev/null +++ b/Lang/Phix/Stair-climbing-puzzle @@ -0,0 +1 @@ +../../Task/Stair-climbing-puzzle/Phix \ No newline at end of file diff --git a/Lang/Phix/Start-from-a-main-routine b/Lang/Phix/Start-from-a-main-routine new file mode 120000 index 0000000000..6188d9ca00 --- /dev/null +++ b/Lang/Phix/Start-from-a-main-routine @@ -0,0 +1 @@ +../../Task/Start-from-a-main-routine/Phix \ No newline at end of file diff --git a/Lang/Phix/Stem-and-leaf-plot b/Lang/Phix/Stem-and-leaf-plot new file mode 120000 index 0000000000..963dc7f19f --- /dev/null +++ b/Lang/Phix/Stem-and-leaf-plot @@ -0,0 +1 @@ +../../Task/Stem-and-leaf-plot/Phix \ No newline at end of file diff --git a/Lang/Phix/String-append b/Lang/Phix/String-append new file mode 120000 index 0000000000..5293b647ed --- /dev/null +++ b/Lang/Phix/String-append @@ -0,0 +1 @@ +../../Task/String-append/Phix \ No newline at end of file diff --git a/Lang/Phix/String-case b/Lang/Phix/String-case new file mode 120000 index 0000000000..7f7eedef8b --- /dev/null +++ b/Lang/Phix/String-case @@ -0,0 +1 @@ +../../Task/String-case/Phix \ No newline at end of file diff --git a/Lang/Phix/String-comparison b/Lang/Phix/String-comparison new file mode 120000 index 0000000000..c03f9236d0 --- /dev/null +++ b/Lang/Phix/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/Phix \ No newline at end of file diff --git a/Lang/Phix/String-concatenation b/Lang/Phix/String-concatenation new file mode 120000 index 0000000000..b2b7a5b26e --- /dev/null +++ b/Lang/Phix/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Phix \ No newline at end of file diff --git a/Lang/Phix/String-interpolation--included- b/Lang/Phix/String-interpolation--included- new file mode 120000 index 0000000000..0decc8f790 --- /dev/null +++ b/Lang/Phix/String-interpolation--included- @@ -0,0 +1 @@ +../../Task/String-interpolation--included-/Phix \ No newline at end of file diff --git a/Lang/Phix/String-length b/Lang/Phix/String-length new file mode 120000 index 0000000000..89b6b3198a --- /dev/null +++ b/Lang/Phix/String-length @@ -0,0 +1 @@ +../../Task/String-length/Phix \ No newline at end of file diff --git a/Lang/Phix/String-matching b/Lang/Phix/String-matching new file mode 120000 index 0000000000..d0ce71d95a --- /dev/null +++ b/Lang/Phix/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/Phix \ No newline at end of file diff --git a/Lang/Phix/String-prepend b/Lang/Phix/String-prepend new file mode 120000 index 0000000000..8f6873c3ca --- /dev/null +++ b/Lang/Phix/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Phix \ No newline at end of file diff --git a/Lang/Phix/Strip-a-set-of-characters-from-a-string b/Lang/Phix/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..f7ea42f3ef --- /dev/null +++ b/Lang/Phix/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Phix \ No newline at end of file diff --git a/Lang/Phix/Strip-block-comments b/Lang/Phix/Strip-block-comments new file mode 120000 index 0000000000..c4ae1656ad --- /dev/null +++ b/Lang/Phix/Strip-block-comments @@ -0,0 +1 @@ +../../Task/Strip-block-comments/Phix \ No newline at end of file diff --git a/Lang/Phix/Strip-comments-from-a-string b/Lang/Phix/Strip-comments-from-a-string new file mode 120000 index 0000000000..d84061ba05 --- /dev/null +++ b/Lang/Phix/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/Phix \ No newline at end of file diff --git a/Lang/Phix/Strip-whitespace-from-a-string-Top-and-tail b/Lang/Phix/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..b601a142c6 --- /dev/null +++ b/Lang/Phix/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/Phix \ No newline at end of file diff --git a/Lang/Phix/Substring b/Lang/Phix/Substring new file mode 120000 index 0000000000..d653671804 --- /dev/null +++ b/Lang/Phix/Substring @@ -0,0 +1 @@ +../../Task/Substring/Phix \ No newline at end of file diff --git a/Lang/Phix/Substring-Top-and-tail b/Lang/Phix/Substring-Top-and-tail new file mode 120000 index 0000000000..a1036a8594 --- /dev/null +++ b/Lang/Phix/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/Phix \ No newline at end of file diff --git a/Lang/Phix/Sudoku b/Lang/Phix/Sudoku new file mode 120000 index 0000000000..a98bee8218 --- /dev/null +++ b/Lang/Phix/Sudoku @@ -0,0 +1 @@ +../../Task/Sudoku/Phix \ No newline at end of file diff --git a/Lang/Phix/Sum-and-product-of-an-array b/Lang/Phix/Sum-and-product-of-an-array new file mode 120000 index 0000000000..0fdf69daa8 --- /dev/null +++ b/Lang/Phix/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Phix \ No newline at end of file diff --git a/Lang/Phix/Sum-digits-of-an-integer b/Lang/Phix/Sum-digits-of-an-integer new file mode 120000 index 0000000000..7e17721558 --- /dev/null +++ b/Lang/Phix/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/Phix \ No newline at end of file diff --git a/Lang/Phix/Sum-of-a-series b/Lang/Phix/Sum-of-a-series new file mode 120000 index 0000000000..b6648e37b1 --- /dev/null +++ b/Lang/Phix/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Phix \ No newline at end of file diff --git a/Lang/Phix/Sum-of-squares b/Lang/Phix/Sum-of-squares new file mode 120000 index 0000000000..2b92e2c619 --- /dev/null +++ b/Lang/Phix/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/Phix \ No newline at end of file diff --git a/Lang/Phix/Synchronous-concurrency b/Lang/Phix/Synchronous-concurrency new file mode 120000 index 0000000000..c6029f1b9e --- /dev/null +++ b/Lang/Phix/Synchronous-concurrency @@ -0,0 +1 @@ +../../Task/Synchronous-concurrency/Phix \ No newline at end of file diff --git a/Lang/Phix/System-time b/Lang/Phix/System-time new file mode 120000 index 0000000000..e27485c5c6 --- /dev/null +++ b/Lang/Phix/System-time @@ -0,0 +1 @@ +../../Task/System-time/Phix \ No newline at end of file diff --git a/Lang/Phix/Take-notes-on-the-command-line b/Lang/Phix/Take-notes-on-the-command-line new file mode 120000 index 0000000000..10fece88e1 --- /dev/null +++ b/Lang/Phix/Take-notes-on-the-command-line @@ -0,0 +1 @@ +../../Task/Take-notes-on-the-command-line/Phix \ No newline at end of file diff --git a/Lang/Phix/Temperature-conversion b/Lang/Phix/Temperature-conversion new file mode 120000 index 0000000000..e72a4365a3 --- /dev/null +++ b/Lang/Phix/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Phix \ No newline at end of file diff --git a/Lang/Phix/Terminal-control-Clear-the-screen b/Lang/Phix/Terminal-control-Clear-the-screen new file mode 120000 index 0000000000..7bbf67305d --- /dev/null +++ b/Lang/Phix/Terminal-control-Clear-the-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Clear-the-screen/Phix \ No newline at end of file diff --git a/Lang/Phix/Terminal-control-Cursor-positioning b/Lang/Phix/Terminal-control-Cursor-positioning new file mode 120000 index 0000000000..3fb12bf317 --- /dev/null +++ b/Lang/Phix/Terminal-control-Cursor-positioning @@ -0,0 +1 @@ +../../Task/Terminal-control-Cursor-positioning/Phix \ No newline at end of file diff --git a/Lang/Phix/Terminal-control-Dimensions b/Lang/Phix/Terminal-control-Dimensions new file mode 120000 index 0000000000..6f61648de3 --- /dev/null +++ b/Lang/Phix/Terminal-control-Dimensions @@ -0,0 +1 @@ +../../Task/Terminal-control-Dimensions/Phix \ No newline at end of file diff --git a/Lang/Phix/Terminal-control-Display-an-extended-character b/Lang/Phix/Terminal-control-Display-an-extended-character new file mode 120000 index 0000000000..ac4c229fa7 --- /dev/null +++ b/Lang/Phix/Terminal-control-Display-an-extended-character @@ -0,0 +1 @@ +../../Task/Terminal-control-Display-an-extended-character/Phix \ No newline at end of file diff --git a/Lang/Phix/Terminal-control-Hiding-the-cursor b/Lang/Phix/Terminal-control-Hiding-the-cursor new file mode 120000 index 0000000000..5a88bab712 --- /dev/null +++ b/Lang/Phix/Terminal-control-Hiding-the-cursor @@ -0,0 +1 @@ +../../Task/Terminal-control-Hiding-the-cursor/Phix \ No newline at end of file diff --git a/Lang/Phix/Ternary-logic b/Lang/Phix/Ternary-logic new file mode 120000 index 0000000000..7ad0ee5a0b --- /dev/null +++ b/Lang/Phix/Ternary-logic @@ -0,0 +1 @@ +../../Task/Ternary-logic/Phix \ No newline at end of file diff --git a/Lang/Phix/Text-processing-Max-licenses-in-use b/Lang/Phix/Text-processing-Max-licenses-in-use new file mode 120000 index 0000000000..cdec254532 --- /dev/null +++ b/Lang/Phix/Text-processing-Max-licenses-in-use @@ -0,0 +1 @@ +../../Task/Text-processing-Max-licenses-in-use/Phix \ No newline at end of file diff --git a/Lang/Phix/Tic-tac-toe b/Lang/Phix/Tic-tac-toe new file mode 120000 index 0000000000..da5e62681e --- /dev/null +++ b/Lang/Phix/Tic-tac-toe @@ -0,0 +1 @@ +../../Task/Tic-tac-toe/Phix \ No newline at end of file diff --git a/Lang/Phix/Time-a-function b/Lang/Phix/Time-a-function new file mode 120000 index 0000000000..a34e9ec0a3 --- /dev/null +++ b/Lang/Phix/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/Phix \ No newline at end of file diff --git a/Lang/Phix/Tokenize-a-string b/Lang/Phix/Tokenize-a-string new file mode 120000 index 0000000000..0a1aefb6eb --- /dev/null +++ b/Lang/Phix/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Phix \ No newline at end of file diff --git a/Lang/Phix/Topswops b/Lang/Phix/Topswops new file mode 120000 index 0000000000..4fdd2826a6 --- /dev/null +++ b/Lang/Phix/Topswops @@ -0,0 +1 @@ +../../Task/Topswops/Phix \ No newline at end of file diff --git a/Lang/Phix/Tree-traversal b/Lang/Phix/Tree-traversal new file mode 120000 index 0000000000..3025eb89f7 --- /dev/null +++ b/Lang/Phix/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/Phix \ No newline at end of file diff --git a/Lang/Phix/Trigonometric-functions b/Lang/Phix/Trigonometric-functions new file mode 120000 index 0000000000..4e725381e3 --- /dev/null +++ b/Lang/Phix/Trigonometric-functions @@ -0,0 +1 @@ +../../Task/Trigonometric-functions/Phix \ No newline at end of file diff --git a/Lang/Phix/Twelve-statements b/Lang/Phix/Twelve-statements new file mode 120000 index 0000000000..269c29d413 --- /dev/null +++ b/Lang/Phix/Twelve-statements @@ -0,0 +1 @@ +../../Task/Twelve-statements/Phix \ No newline at end of file diff --git a/Lang/Phix/Unbias-a-random-generator b/Lang/Phix/Unbias-a-random-generator new file mode 120000 index 0000000000..58ade67a7f --- /dev/null +++ b/Lang/Phix/Unbias-a-random-generator @@ -0,0 +1 @@ +../../Task/Unbias-a-random-generator/Phix \ No newline at end of file diff --git a/Lang/Phix/Undefined-values b/Lang/Phix/Undefined-values new file mode 120000 index 0000000000..f4e1e9bff0 --- /dev/null +++ b/Lang/Phix/Undefined-values @@ -0,0 +1 @@ +../../Task/Undefined-values/Phix \ No newline at end of file diff --git a/Lang/Phix/Unicode-variable-names b/Lang/Phix/Unicode-variable-names new file mode 120000 index 0000000000..c978d0d618 --- /dev/null +++ b/Lang/Phix/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/Phix \ No newline at end of file diff --git a/Lang/Phix/Use-another-language-to-call-a-function b/Lang/Phix/Use-another-language-to-call-a-function new file mode 120000 index 0000000000..96b5f0aaf0 --- /dev/null +++ b/Lang/Phix/Use-another-language-to-call-a-function @@ -0,0 +1 @@ +../../Task/Use-another-language-to-call-a-function/Phix \ No newline at end of file diff --git a/Lang/Phix/User-input-Graphical b/Lang/Phix/User-input-Graphical new file mode 120000 index 0000000000..fdd1ae4ca3 --- /dev/null +++ b/Lang/Phix/User-input-Graphical @@ -0,0 +1 @@ +../../Task/User-input-Graphical/Phix \ No newline at end of file diff --git a/Lang/Phix/User-input-Text b/Lang/Phix/User-input-Text new file mode 120000 index 0000000000..ecbd9833e6 --- /dev/null +++ b/Lang/Phix/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/Phix \ No newline at end of file diff --git a/Lang/Phix/Van-der-Corput-sequence b/Lang/Phix/Van-der-Corput-sequence new file mode 120000 index 0000000000..8e2ffa5023 --- /dev/null +++ b/Lang/Phix/Van-der-Corput-sequence @@ -0,0 +1 @@ +../../Task/Van-der-Corput-sequence/Phix \ No newline at end of file diff --git a/Lang/Phix/Variable-length-quantity b/Lang/Phix/Variable-length-quantity new file mode 120000 index 0000000000..e2770deede --- /dev/null +++ b/Lang/Phix/Variable-length-quantity @@ -0,0 +1 @@ +../../Task/Variable-length-quantity/Phix \ No newline at end of file diff --git a/Lang/Phix/Variables b/Lang/Phix/Variables new file mode 120000 index 0000000000..1e730fdcff --- /dev/null +++ b/Lang/Phix/Variables @@ -0,0 +1 @@ +../../Task/Variables/Phix \ No newline at end of file diff --git a/Lang/Phix/Variadic-function b/Lang/Phix/Variadic-function new file mode 120000 index 0000000000..6d7cb8cd26 --- /dev/null +++ b/Lang/Phix/Variadic-function @@ -0,0 +1 @@ +../../Task/Variadic-function/Phix \ No newline at end of file diff --git a/Lang/Phix/Vector-products b/Lang/Phix/Vector-products new file mode 120000 index 0000000000..8c507c9f79 --- /dev/null +++ b/Lang/Phix/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/Phix \ No newline at end of file diff --git a/Lang/Phix/Visualize-a-tree b/Lang/Phix/Visualize-a-tree new file mode 120000 index 0000000000..37e8f950bb --- /dev/null +++ b/Lang/Phix/Visualize-a-tree @@ -0,0 +1 @@ +../../Task/Visualize-a-tree/Phix \ No newline at end of file diff --git a/Lang/Phix/Walk-a-directory-Non-recursively b/Lang/Phix/Walk-a-directory-Non-recursively new file mode 120000 index 0000000000..83465ea551 --- /dev/null +++ b/Lang/Phix/Walk-a-directory-Non-recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Non-recursively/Phix \ No newline at end of file diff --git a/Lang/Phix/Walk-a-directory-Recursively b/Lang/Phix/Walk-a-directory-Recursively new file mode 120000 index 0000000000..34688e21e5 --- /dev/null +++ b/Lang/Phix/Walk-a-directory-Recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Recursively/Phix \ No newline at end of file diff --git a/Lang/Phix/Window-creation b/Lang/Phix/Window-creation new file mode 120000 index 0000000000..57e99cd75c --- /dev/null +++ b/Lang/Phix/Window-creation @@ -0,0 +1 @@ +../../Task/Window-creation/Phix \ No newline at end of file diff --git a/Lang/Phix/Window-management b/Lang/Phix/Window-management new file mode 120000 index 0000000000..31500780b4 --- /dev/null +++ b/Lang/Phix/Window-management @@ -0,0 +1 @@ +../../Task/Window-management/Phix \ No newline at end of file diff --git a/Lang/Phix/Write-float-arrays-to-a-text-file b/Lang/Phix/Write-float-arrays-to-a-text-file new file mode 120000 index 0000000000..34400d3055 --- /dev/null +++ b/Lang/Phix/Write-float-arrays-to-a-text-file @@ -0,0 +1 @@ +../../Task/Write-float-arrays-to-a-text-file/Phix \ No newline at end of file diff --git a/Lang/Phix/Write-language-name-in-3D-ASCII b/Lang/Phix/Write-language-name-in-3D-ASCII new file mode 120000 index 0000000000..04da16acb7 --- /dev/null +++ b/Lang/Phix/Write-language-name-in-3D-ASCII @@ -0,0 +1 @@ +../../Task/Write-language-name-in-3D-ASCII/Phix \ No newline at end of file diff --git a/Lang/Phix/XML-Output b/Lang/Phix/XML-Output new file mode 120000 index 0000000000..82f825ed33 --- /dev/null +++ b/Lang/Phix/XML-Output @@ -0,0 +1 @@ +../../Task/XML-Output/Phix \ No newline at end of file diff --git a/Lang/Phix/Zebra-puzzle b/Lang/Phix/Zebra-puzzle new file mode 120000 index 0000000000..607e56abd3 --- /dev/null +++ b/Lang/Phix/Zebra-puzzle @@ -0,0 +1 @@ +../../Task/Zebra-puzzle/Phix \ No newline at end of file diff --git a/Lang/Phix/Zero-to-the-zero-power b/Lang/Phix/Zero-to-the-zero-power new file mode 120000 index 0000000000..f6c791ed9b --- /dev/null +++ b/Lang/Phix/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/Phix \ No newline at end of file diff --git a/Lang/Phix/Zhang-Suen-thinning-algorithm b/Lang/Phix/Zhang-Suen-thinning-algorithm new file mode 120000 index 0000000000..8024ea2a2f --- /dev/null +++ b/Lang/Phix/Zhang-Suen-thinning-algorithm @@ -0,0 +1 @@ +../../Task/Zhang-Suen-thinning-algorithm/Phix \ No newline at end of file diff --git a/Lang/Phix/Zig-zag-matrix b/Lang/Phix/Zig-zag-matrix new file mode 120000 index 0000000000..64baef5790 --- /dev/null +++ b/Lang/Phix/Zig-zag-matrix @@ -0,0 +1 @@ +../../Task/Zig-zag-matrix/Phix \ No newline at end of file diff --git a/Lang/Picat/00DESCRIPTION b/Lang/Picat/00DESCRIPTION new file mode 100644 index 0000000000..f66cf163bf --- /dev/null +++ b/Lang/Picat/00DESCRIPTION @@ -0,0 +1 @@ +{{language}}{{stub}} \ No newline at end of file diff --git a/Lang/Picat/Function-definition b/Lang/Picat/Function-definition new file mode 120000 index 0000000000..1ee01c29f5 --- /dev/null +++ b/Lang/Picat/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Picat \ No newline at end of file diff --git a/Lang/Picat/README b/Lang/Picat/README new file mode 100644 index 0000000000..7dae1785b3 --- /dev/null +++ b/Lang/Picat/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Picat diff --git a/Lang/Pict/00DESCRIPTION b/Lang/Pict/00DESCRIPTION new file mode 100644 index 0000000000..f647b1f3cb --- /dev/null +++ b/Lang/Pict/00DESCRIPTION @@ -0,0 +1 @@ +{{stub}}{{language|Pict}} \ No newline at end of file diff --git a/Lang/Pict/Hello-world-Newline-omission b/Lang/Pict/Hello-world-Newline-omission new file mode 120000 index 0000000000..c4c4f573ab --- /dev/null +++ b/Lang/Pict/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Pict \ No newline at end of file diff --git a/Lang/Pict/Hello-world-Text b/Lang/Pict/Hello-world-Text new file mode 120000 index 0000000000..7c923c41c5 --- /dev/null +++ b/Lang/Pict/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Pict \ No newline at end of file diff --git a/Lang/Pict/README b/Lang/Pict/README new file mode 100644 index 0000000000..d6403663b4 --- /dev/null +++ b/Lang/Pict/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Pict diff --git a/Lang/Pony/00DESCRIPTION b/Lang/Pony/00DESCRIPTION new file mode 100644 index 0000000000..76cf164498 --- /dev/null +++ b/Lang/Pony/00DESCRIPTION @@ -0,0 +1,13 @@ +{{language| +|exec=machine +|strength=strong +|safety=safe +|checking=static +|gc=yes +|site=http://ponylang.org/ +}} + + +'''Pony''' is an object-oriented, actor-model, capabilities-secure, high performance programming language. + +'''Pony''' provides type safety with a mathematical proof, memory safety, exception safety and data-race free concurrency with no runtime overhead. \ No newline at end of file diff --git a/Lang/Pony/Arrays b/Lang/Pony/Arrays new file mode 120000 index 0000000000..dfa8cf96aa --- /dev/null +++ b/Lang/Pony/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Pony \ No newline at end of file diff --git a/Lang/Pony/Evolutionary-algorithm b/Lang/Pony/Evolutionary-algorithm new file mode 120000 index 0000000000..4ccb4bbf0b --- /dev/null +++ b/Lang/Pony/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/Pony \ No newline at end of file diff --git a/Lang/Pony/FizzBuzz b/Lang/Pony/FizzBuzz new file mode 120000 index 0000000000..729d3687b7 --- /dev/null +++ b/Lang/Pony/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Pony \ No newline at end of file diff --git a/Lang/Pony/Hello-world-Text b/Lang/Pony/Hello-world-Text new file mode 120000 index 0000000000..be4696e87b --- /dev/null +++ b/Lang/Pony/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Pony \ No newline at end of file diff --git a/Lang/Pony/README b/Lang/Pony/README new file mode 100644 index 0000000000..5860cb1949 --- /dev/null +++ b/Lang/Pony/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Pony diff --git a/Lang/Pony/Variables b/Lang/Pony/Variables new file mode 120000 index 0000000000..be5b0a8d65 --- /dev/null +++ b/Lang/Pony/Variables @@ -0,0 +1 @@ +../../Task/Variables/Pony \ No newline at end of file diff --git a/Lang/Potion/00DESCRIPTION b/Lang/Potion/00DESCRIPTION new file mode 100644 index 0000000000..2e99d271f7 --- /dev/null +++ b/Lang/Potion/00DESCRIPTION @@ -0,0 +1,21 @@ +{{language|Potion +|exec=machine +|site=http://perl11.org/potion/ +|exec=interpreted +|strength=weak +|safety=safe +|express=implicit +|checking=dynamic +|parampass=value +|gc=yes +|LCT=yes +|bnf=https://github.com/perl11/potion/blob/master/core/syntax.y}} +{{language programming paradigm|Object-oriented}} + +Potion is a small, fast, object and mixin-orientated, high-level, cross-platform, dynamic functional programming language under 10k sloc, with a stack-based syntax. +Message passing as in [[Smalltalk]], an object system as in [[Io]] and the vm based on [[Lua]]. The [[JIT]] is simplier and new. +The parser generator is based on [http://piumarta.com/software/peg/ peg/leg]. + +==See also== +* [https://github.com/perl11/potion/ Potion repo] +* [http://perl11.org/p2/ perl11.org/p2/] is based on potion \ No newline at end of file diff --git a/Lang/Potion/100-doors b/Lang/Potion/100-doors new file mode 120000 index 0000000000..0951d4ab08 --- /dev/null +++ b/Lang/Potion/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Potion \ No newline at end of file diff --git a/Lang/Potion/24-game b/Lang/Potion/24-game new file mode 120000 index 0000000000..533788e69a --- /dev/null +++ b/Lang/Potion/24-game @@ -0,0 +1 @@ +../../Task/24-game/Potion \ No newline at end of file diff --git a/Lang/Potion/A+B b/Lang/Potion/A+B new file mode 120000 index 0000000000..75a8b8bc98 --- /dev/null +++ b/Lang/Potion/A+B @@ -0,0 +1 @@ +../../Task/A+B/Potion \ No newline at end of file diff --git a/Lang/Potion/Ackermann-function b/Lang/Potion/Ackermann-function new file mode 120000 index 0000000000..21de2f81a3 --- /dev/null +++ b/Lang/Potion/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Potion \ No newline at end of file diff --git a/Lang/Potion/Almost-prime b/Lang/Potion/Almost-prime new file mode 120000 index 0000000000..7d19670e0d --- /dev/null +++ b/Lang/Potion/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Potion \ No newline at end of file diff --git a/Lang/Potion/Arithmetic-geometric-mean b/Lang/Potion/Arithmetic-geometric-mean new file mode 120000 index 0000000000..44595a98cb --- /dev/null +++ b/Lang/Potion/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/Potion \ No newline at end of file diff --git a/Lang/Potion/Associative-array-Creation b/Lang/Potion/Associative-array-Creation new file mode 120000 index 0000000000..48d440452a --- /dev/null +++ b/Lang/Potion/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Potion \ No newline at end of file diff --git a/Lang/Potion/Associative-array-Iteration b/Lang/Potion/Associative-array-Iteration new file mode 120000 index 0000000000..e30b7ef183 --- /dev/null +++ b/Lang/Potion/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Potion \ No newline at end of file diff --git a/Lang/Potion/Digital-root b/Lang/Potion/Digital-root new file mode 120000 index 0000000000..b162d0bb2e --- /dev/null +++ b/Lang/Potion/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/Potion \ No newline at end of file diff --git a/Lang/Potion/Execute-Brain---- b/Lang/Potion/Execute-Brain---- new file mode 120000 index 0000000000..f48d6a9ae8 --- /dev/null +++ b/Lang/Potion/Execute-Brain---- @@ -0,0 +1 @@ +../../Task/Execute-Brain----/Potion \ No newline at end of file diff --git a/Lang/Potion/Fibonacci-sequence b/Lang/Potion/Fibonacci-sequence new file mode 120000 index 0000000000..5c23f9b25f --- /dev/null +++ b/Lang/Potion/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Potion \ No newline at end of file diff --git a/Lang/Potion/FizzBuzz b/Lang/Potion/FizzBuzz new file mode 120000 index 0000000000..b835e2bcc4 --- /dev/null +++ b/Lang/Potion/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Potion \ No newline at end of file diff --git a/Lang/Potion/Greatest-subsequential-sum b/Lang/Potion/Greatest-subsequential-sum new file mode 120000 index 0000000000..15f395cba1 --- /dev/null +++ b/Lang/Potion/Greatest-subsequential-sum @@ -0,0 +1 @@ +../../Task/Greatest-subsequential-sum/Potion \ No newline at end of file diff --git a/Lang/Potion/Happy-numbers b/Lang/Potion/Happy-numbers new file mode 120000 index 0000000000..a11330946d --- /dev/null +++ b/Lang/Potion/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/Potion \ No newline at end of file diff --git a/Lang/Potion/Hello-world-Text b/Lang/Potion/Hello-world-Text new file mode 120000 index 0000000000..a96cbefc6f --- /dev/null +++ b/Lang/Potion/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Potion \ No newline at end of file diff --git a/Lang/Potion/Horners-rule-for-polynomial-evaluation b/Lang/Potion/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..e45177a4d4 --- /dev/null +++ b/Lang/Potion/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/Potion \ No newline at end of file diff --git a/Lang/Potion/Palindrome-detection b/Lang/Potion/Palindrome-detection new file mode 120000 index 0000000000..b9398e9a7a --- /dev/null +++ b/Lang/Potion/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Potion \ No newline at end of file diff --git a/Lang/Potion/Pascals-triangle b/Lang/Potion/Pascals-triangle new file mode 120000 index 0000000000..122122e1c8 --- /dev/null +++ b/Lang/Potion/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/Potion \ No newline at end of file diff --git a/Lang/Potion/README b/Lang/Potion/README new file mode 100644 index 0000000000..9c41869402 --- /dev/null +++ b/Lang/Potion/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Potion diff --git a/Lang/Potion/S-Expressions b/Lang/Potion/S-Expressions new file mode 120000 index 0000000000..d5fe91d5a2 --- /dev/null +++ b/Lang/Potion/S-Expressions @@ -0,0 +1 @@ +../../Task/S-Expressions/Potion \ No newline at end of file diff --git a/Lang/Potion/SEDOLs b/Lang/Potion/SEDOLs new file mode 120000 index 0000000000..831cc3e00f --- /dev/null +++ b/Lang/Potion/SEDOLs @@ -0,0 +1 @@ +../../Task/SEDOLs/Potion \ No newline at end of file diff --git a/Lang/Potion/Sort-an-integer-array b/Lang/Potion/Sort-an-integer-array new file mode 120000 index 0000000000..f74bbca0cd --- /dev/null +++ b/Lang/Potion/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Potion \ No newline at end of file diff --git a/Lang/Potion/String-case b/Lang/Potion/String-case new file mode 120000 index 0000000000..a67ca016ce --- /dev/null +++ b/Lang/Potion/String-case @@ -0,0 +1 @@ +../../Task/String-case/Potion \ No newline at end of file diff --git a/Lang/Potion/String-length b/Lang/Potion/String-length new file mode 120000 index 0000000000..dad48649bc --- /dev/null +++ b/Lang/Potion/String-length @@ -0,0 +1 @@ +../../Task/String-length/Potion \ No newline at end of file diff --git a/Lang/Potion/Sum-of-a-series b/Lang/Potion/Sum-of-a-series new file mode 120000 index 0000000000..a0d77d1283 --- /dev/null +++ b/Lang/Potion/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Potion \ No newline at end of file diff --git a/Lang/Potion/Topswops b/Lang/Potion/Topswops new file mode 120000 index 0000000000..4cf6319965 --- /dev/null +++ b/Lang/Potion/Topswops @@ -0,0 +1 @@ +../../Task/Topswops/Potion \ No newline at end of file diff --git a/Lang/Powerbuilder/00DESCRIPTION b/Lang/Powerbuilder/00DESCRIPTION new file mode 100644 index 0000000000..baab5f0f74 --- /dev/null +++ b/Lang/Powerbuilder/00DESCRIPTION @@ -0,0 +1,3 @@ +{{Language +|site=http://www.sybase.com/powerbuilder}} +{{stub}} \ No newline at end of file diff --git a/Lang/Powerbuilder/Averages-Root-mean-square b/Lang/Powerbuilder/Averages-Root-mean-square new file mode 120000 index 0000000000..a921cd587a --- /dev/null +++ b/Lang/Powerbuilder/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/Powerbuilder \ No newline at end of file diff --git a/Lang/Powerbuilder/Ethiopian-multiplication b/Lang/Powerbuilder/Ethiopian-multiplication new file mode 120000 index 0000000000..42f72d8785 --- /dev/null +++ b/Lang/Powerbuilder/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Powerbuilder \ No newline at end of file diff --git a/Lang/Powerbuilder/README b/Lang/Powerbuilder/README new file mode 100644 index 0000000000..1bd86b16ca --- /dev/null +++ b/Lang/Powerbuilder/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Powerbuilder diff --git a/Lang/Powerbuilder/String-case b/Lang/Powerbuilder/String-case new file mode 120000 index 0000000000..5a37154d4b --- /dev/null +++ b/Lang/Powerbuilder/String-case @@ -0,0 +1 @@ +../../Task/String-case/Powerbuilder \ No newline at end of file diff --git a/Lang/Pyret/00DESCRIPTION b/Lang/Pyret/00DESCRIPTION new file mode 100644 index 0000000000..f0a1560ec8 --- /dev/null +++ b/Lang/Pyret/00DESCRIPTION @@ -0,0 +1,10 @@ +{{language|Pyret +|site=https://www.pyret.org/ +|hopl=no +}} +'''Pyret''' is a programming language designed to serve as an outstanding choice for programming education. It supports functional programming, optional type annotations, recursive data definitions, and including tests with function definitions. It is under active development. + + +==External Links== +* [https://www.pyret.org/ Pyret site] +* [http://papl.cs.brown.edu/2015/ Programming and Programming Languages book] \ No newline at end of file diff --git a/Lang/Pyret/100-doors b/Lang/Pyret/100-doors new file mode 120000 index 0000000000..b7bfd2e6c3 --- /dev/null +++ b/Lang/Pyret/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Pyret \ No newline at end of file diff --git a/Lang/Pyret/Combinations b/Lang/Pyret/Combinations new file mode 120000 index 0000000000..d5cb9f5407 --- /dev/null +++ b/Lang/Pyret/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/Pyret \ No newline at end of file diff --git a/Lang/Pyret/FizzBuzz b/Lang/Pyret/FizzBuzz new file mode 120000 index 0000000000..116d2362d7 --- /dev/null +++ b/Lang/Pyret/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Pyret \ No newline at end of file diff --git a/Lang/Pyret/README b/Lang/Pyret/README new file mode 100644 index 0000000000..5d03a5d7ba --- /dev/null +++ b/Lang/Pyret/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Pyret diff --git a/Lang/RPGIV/00DESCRIPTION b/Lang/RPGIV/00DESCRIPTION new file mode 100644 index 0000000000..4d3d27c049 --- /dev/null +++ b/Lang/RPGIV/00DESCRIPTION @@ -0,0 +1 @@ +{{stub}}{{language}} \ No newline at end of file diff --git a/Lang/RPGIV/Detect-division-by-zero b/Lang/RPGIV/Detect-division-by-zero new file mode 120000 index 0000000000..bdb5d3caea --- /dev/null +++ b/Lang/RPGIV/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/RPGIV \ No newline at end of file diff --git a/Lang/RPGIV/README b/Lang/RPGIV/README new file mode 100644 index 0000000000..5461c20e5f --- /dev/null +++ b/Lang/RPGIV/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:RPGIV diff --git a/Lang/RPL/00DESCRIPTION b/Lang/RPL/00DESCRIPTION new file mode 100644 index 0000000000..5d6846caff --- /dev/null +++ b/Lang/RPL/00DESCRIPTION @@ -0,0 +1,19 @@ +{{stub|language}} + +{{language|RPL +|exec=interpreted +|gc=yes +|parampass=value +|safety=unsafe +|strength=weak +|tags=rpl +|hopl id=2456 +|LCT=no +|site=https://en.wikipedia.org/wiki/RPL_(programming_language) +}} + +'''RPL''' (an acronym for '''Reverse Polish Lisp''') is the onboard calculator language for the [[wp:HP 48 series|HP 48]] line of graphing calculators. It is a stack language (not a [[Lisp]]-like language, as its name implies), tightly integrated with the HP 48 system. + +There are actually two languages with the name RPL: '''User RPL''' and '''System RPL'''. System RPL is used in implementing the HP 48 operating system, and User RPL is the language users use to write programs on the calculator. + +The language [[RPL/2]] is a recreation of this language for POSIX machines. \ No newline at end of file diff --git a/Lang/RPL/Guess-the-number b/Lang/RPL/Guess-the-number new file mode 120000 index 0000000000..c108a4519e --- /dev/null +++ b/Lang/RPL/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/RPL \ No newline at end of file diff --git a/Lang/RPL/Lucas-Lehmer-test b/Lang/RPL/Lucas-Lehmer-test new file mode 120000 index 0000000000..305b8dadf2 --- /dev/null +++ b/Lang/RPL/Lucas-Lehmer-test @@ -0,0 +1 @@ +../../Task/Lucas-Lehmer-test/RPL \ No newline at end of file diff --git a/Lang/RPL/README b/Lang/RPL/README new file mode 100644 index 0000000000..d201f2faf2 --- /dev/null +++ b/Lang/RPL/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:RPL diff --git a/Lang/Ra/00DESCRIPTION b/Lang/Ra/00DESCRIPTION new file mode 100644 index 0000000000..99061f1d8c --- /dev/null +++ b/Lang/Ra/00DESCRIPTION @@ -0,0 +1,19 @@ +{{stub}}{{language +|site=http://oahmad04.github.io/ra/ +|exec=machine +|express=both +|strength=strong +|gc=yes +|safety=safe +|tags=Ra +}} +The Ra Programming Language is an alternative syntax for the .NET language Cobra that allows you to program in your native tongue. + +=Links= +[http://oahmad04.github.io/ra/ Ra website] + +[https://github.com/oahmad04/ra Ra source code] + +[http://cobra-language.com/ Cobra website] + +[[RaCompiler]] \ No newline at end of file diff --git a/Lang/Ra/99-Bottles-of-Beer b/Lang/Ra/99-Bottles-of-Beer new file mode 120000 index 0000000000..14bacc741c --- /dev/null +++ b/Lang/Ra/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Ra \ No newline at end of file diff --git a/Lang/Ra/A+B b/Lang/Ra/A+B new file mode 120000 index 0000000000..eb79a2ee68 --- /dev/null +++ b/Lang/Ra/A+B @@ -0,0 +1 @@ +../../Task/A+B/Ra \ No newline at end of file diff --git a/Lang/Ra/Fibonacci-sequence b/Lang/Ra/Fibonacci-sequence new file mode 120000 index 0000000000..d66cbc5a8e --- /dev/null +++ b/Lang/Ra/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Ra \ No newline at end of file diff --git a/Lang/Ra/Hello-world-Newbie b/Lang/Ra/Hello-world-Newbie new file mode 120000 index 0000000000..f825cc0764 --- /dev/null +++ b/Lang/Ra/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/Ra \ No newline at end of file diff --git a/Lang/Ra/Hello-world-Newline-omission b/Lang/Ra/Hello-world-Newline-omission new file mode 120000 index 0000000000..b1cf11b745 --- /dev/null +++ b/Lang/Ra/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Ra \ No newline at end of file diff --git a/Lang/Ra/Hello-world-Standard-error b/Lang/Ra/Hello-world-Standard-error new file mode 120000 index 0000000000..a9d75d053d --- /dev/null +++ b/Lang/Ra/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Ra \ No newline at end of file diff --git a/Lang/Ra/Hello-world-Text b/Lang/Ra/Hello-world-Text new file mode 120000 index 0000000000..fbede483d4 --- /dev/null +++ b/Lang/Ra/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Ra \ No newline at end of file diff --git a/Lang/Ra/README b/Lang/Ra/README new file mode 100644 index 0000000000..fd945d6f1a --- /dev/null +++ b/Lang/Ra/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Ra diff --git a/Lang/Ra/Sorting-algorithms-Bubble-sort b/Lang/Ra/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..ca7a347883 --- /dev/null +++ b/Lang/Ra/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/Ra \ No newline at end of file diff --git a/Lang/Ra/Sorting-algorithms-Selection-sort b/Lang/Ra/Sorting-algorithms-Selection-sort new file mode 120000 index 0000000000..98d7b6671f --- /dev/null +++ b/Lang/Ra/Sorting-algorithms-Selection-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Selection-sort/Ra \ No newline at end of file diff --git a/Lang/Rapira/00DESCRIPTION b/Lang/Rapira/00DESCRIPTION new file mode 100644 index 0000000000..53170978c0 --- /dev/null +++ b/Lang/Rapira/00DESCRIPTION @@ -0,0 +1,3 @@ +{{language +|exec=interpreted}} +'''Rapira''' is a procedural programming language. It was an interpreted language with dynamic type system and high level constructions. Rapira was used in teaching computer programming in Soviet schools. The programming environment included a text editor and an integrated debugger. \ No newline at end of file diff --git a/Lang/Rapira/Factorial b/Lang/Rapira/Factorial new file mode 120000 index 0000000000..dd2a77fc4f --- /dev/null +++ b/Lang/Rapira/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Rapira \ No newline at end of file diff --git a/Lang/Rapira/README b/Lang/Rapira/README new file mode 100644 index 0000000000..452e3e34d4 --- /dev/null +++ b/Lang/Rapira/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Rapira diff --git a/Lang/Red/00DESCRIPTION b/Lang/Red/00DESCRIPTION new file mode 100644 index 0000000000..a2c2993cf6 --- /dev/null +++ b/Lang/Red/00DESCRIPTION @@ -0,0 +1,12 @@ +{{language|Red}} + +Red is a paradigm-neutral [http://en.wikipedia.org/wiki/Homoiconicity homoiconic] language, strongly inspired by [[Rebol]]. + +Like Rebol, Red has a low memory footprint, is garbage collected, and has a [http://www.red-lang.org/p/download.html low disk footprint (< 1MB)]. But while Rebol is an interpreted language written in ANSI-C, Red seeks to be a "full-stack" language whose methodology is independent of any other toolchain. It compiles that which can be known ahead of time, JIT-compiles that which cannot, and embeds a small interpreter into its executables to handle constructions which are not amenable to any compilation. + +Red embeds several DSLs, among which Red/System (C semantics meet Red syntax), dedicated to low-level and system programming. It is also used as an intermediate language (IL) when Red is compiled. The Red executable is able to build Red/System files directly (`*.reds`) as well as Red files (`*.red`), and Red/System code may be embedded freely in Red code. + +* [http://www.red-lang.org Red Language Website] +* [https://twitter.com/red_lang @red_lang] on Twitter. +* [https://gitter.im/red/red Red community chat] on Gitter. +* [http://groups.google.com/group/red-lang?hl=en Mailing-List] \ No newline at end of file diff --git a/Lang/Red/100-doors b/Lang/Red/100-doors new file mode 120000 index 0000000000..5217abefef --- /dev/null +++ b/Lang/Red/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Red \ No newline at end of file diff --git a/Lang/Red/99-Bottles-of-Beer b/Lang/Red/99-Bottles-of-Beer new file mode 120000 index 0000000000..427c8141d0 --- /dev/null +++ b/Lang/Red/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Red \ No newline at end of file diff --git a/Lang/Red/A+B b/Lang/Red/A+B new file mode 120000 index 0000000000..c9d158d21a --- /dev/null +++ b/Lang/Red/A+B @@ -0,0 +1 @@ +../../Task/A+B/Red \ No newline at end of file diff --git a/Lang/Red/Abstract-type b/Lang/Red/Abstract-type new file mode 120000 index 0000000000..2e07d765b3 --- /dev/null +++ b/Lang/Red/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/Red \ No newline at end of file diff --git a/Lang/Red/Add-a-variable-to-a-class-instance-at-runtime b/Lang/Red/Add-a-variable-to-a-class-instance-at-runtime new file mode 120000 index 0000000000..015a78183e --- /dev/null +++ b/Lang/Red/Add-a-variable-to-a-class-instance-at-runtime @@ -0,0 +1 @@ +../../Task/Add-a-variable-to-a-class-instance-at-runtime/Red \ No newline at end of file diff --git a/Lang/Red/Align-columns b/Lang/Red/Align-columns new file mode 120000 index 0000000000..2d5d5b9c2d --- /dev/null +++ b/Lang/Red/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/Red \ No newline at end of file diff --git a/Lang/Red/Flatten-a-list b/Lang/Red/Flatten-a-list new file mode 120000 index 0000000000..2482123b7b --- /dev/null +++ b/Lang/Red/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Red \ No newline at end of file diff --git a/Lang/Red/Hello-world-Newline-omission b/Lang/Red/Hello-world-Newline-omission new file mode 120000 index 0000000000..677b71cfec --- /dev/null +++ b/Lang/Red/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Red \ No newline at end of file diff --git a/Lang/Red/README b/Lang/Red/README new file mode 100644 index 0000000000..55af2b5b5f --- /dev/null +++ b/Lang/Red/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Red diff --git a/Lang/Red/Roman-numerals-Decode b/Lang/Red/Roman-numerals-Decode new file mode 120000 index 0000000000..1aa3825d5c --- /dev/null +++ b/Lang/Red/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/Red \ No newline at end of file diff --git a/Lang/Red/Roman-numerals-Encode b/Lang/Red/Roman-numerals-Encode new file mode 120000 index 0000000000..93556f034e --- /dev/null +++ b/Lang/Red/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/Red \ No newline at end of file diff --git a/Lang/Reduce/00DESCRIPTION b/Lang/Reduce/00DESCRIPTION new file mode 100644 index 0000000000..e377ca9758 --- /dev/null +++ b/Lang/Reduce/00DESCRIPTION @@ -0,0 +1,8 @@ +{{language|Reduce +|site=http://www.reduce-algebra.com/ +|express=implicit}} + +Reduce is the language used in the computer algebra system of the same name. + +==See Also== +* [[wp:Reduce_%28computer_algebra_system%29|Wikipedia:Reduce (computer algebra system)]] \ No newline at end of file diff --git a/Lang/Reduce/README b/Lang/Reduce/README new file mode 100644 index 0000000000..142379a711 --- /dev/null +++ b/Lang/Reduce/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Reduce diff --git a/Lang/Ring/00DESCRIPTION b/Lang/Ring/00DESCRIPTION new file mode 100644 index 0000000000..2c29fe8fa1 --- /dev/null +++ b/Lang/Ring/00DESCRIPTION @@ -0,0 +1,17 @@ +{{language}} + +The [http://ring-lang.net Ring programming language] is an Innovative and practical general-purpose multi-paradigm scripting language that can be embedded in C/C++ projects, extended using C/C++ code and/or used as standalone language. The supported programming paradigms are Imperative, Procedural, Object-Oriented, Functional, Meta programming, Declarative programming using nested structures, and Natural programming. The language is portable (Windows, Linux, Mac OS X, Android, etc.) and can be used to create Console, GUI, Web, Games and Mobile applications. The language is designed to be Simple, Small, Flexible and Fast. Its Dynamic Language (Dynamic Typing and Weakly Typed) that compile the source code to byte code then execute it by the Ring Virtual Machine, which is integrated with the Ring Compiler in one program. The first version of the language (around 100,000 lines of C/C++/Ring code) is released on January 25th, 2016 + +The language is simple, trying to be natural, encourage organization and comes with transparent and visual implementation. It comes with compact syntax and a group of features that enable the programmer to create natural interfaces and declarative domain-specific languages in a fraction of time. It is very small, fast and comes with smart garbage collector that puts the memory under the programmer control. It supports many programming paradigms, comes with useful and practical libraries. The language is designed for productivity and developing high quality solutions that can scale. + +Designed for a Clear Goal + + Applications programming language. + Productivity and developing high quality solutions that can scale. + Small and fast language that can be embedded in C/C++ projects. + Simple language that can be used in education and introducing Compiler/VM concepts. + General-Purpose language that can be used for creating domain-specific libraries, frameworks and tools. + Practical language designed for creating the next version of the Programming Without Coding Technology software. + + +Website : http://ring-lang.net \ No newline at end of file diff --git a/Lang/Ring/100-doors b/Lang/Ring/100-doors new file mode 120000 index 0000000000..8c3c694e08 --- /dev/null +++ b/Lang/Ring/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Ring \ No newline at end of file diff --git a/Lang/Ring/99-Bottles-of-Beer b/Lang/Ring/99-Bottles-of-Beer new file mode 120000 index 0000000000..b975a4683d --- /dev/null +++ b/Lang/Ring/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Ring \ No newline at end of file diff --git a/Lang/Ring/A+B b/Lang/Ring/A+B new file mode 120000 index 0000000000..44253ee3e1 --- /dev/null +++ b/Lang/Ring/A+B @@ -0,0 +1 @@ +../../Task/A+B/Ring \ No newline at end of file diff --git a/Lang/Ring/ABC-Problem b/Lang/Ring/ABC-Problem new file mode 120000 index 0000000000..c565810b97 --- /dev/null +++ b/Lang/Ring/ABC-Problem @@ -0,0 +1 @@ +../../Task/ABC-Problem/Ring \ No newline at end of file diff --git a/Lang/Ring/Abundant,-deficient-and-perfect-number-classifications b/Lang/Ring/Abundant,-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..148b3f8866 --- /dev/null +++ b/Lang/Ring/Abundant,-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant,-deficient-and-perfect-number-classifications/Ring \ No newline at end of file diff --git a/Lang/Ring/Accumulator-factory b/Lang/Ring/Accumulator-factory new file mode 120000 index 0000000000..de256e26ff --- /dev/null +++ b/Lang/Ring/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/Ring \ No newline at end of file diff --git a/Lang/Ring/Ackermann-function b/Lang/Ring/Ackermann-function new file mode 120000 index 0000000000..68a213c79f --- /dev/null +++ b/Lang/Ring/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Ring \ No newline at end of file diff --git a/Lang/Ring/Active-Directory-Connect b/Lang/Ring/Active-Directory-Connect new file mode 120000 index 0000000000..cb7598136c --- /dev/null +++ b/Lang/Ring/Active-Directory-Connect @@ -0,0 +1 @@ +../../Task/Active-Directory-Connect/Ring \ No newline at end of file diff --git a/Lang/Ring/Add-a-variable-to-a-class-instance-at-runtime b/Lang/Ring/Add-a-variable-to-a-class-instance-at-runtime new file mode 120000 index 0000000000..c957400d88 --- /dev/null +++ b/Lang/Ring/Add-a-variable-to-a-class-instance-at-runtime @@ -0,0 +1 @@ +../../Task/Add-a-variable-to-a-class-instance-at-runtime/Ring \ No newline at end of file diff --git a/Lang/Ring/Almost-prime b/Lang/Ring/Almost-prime new file mode 120000 index 0000000000..135ffe9a10 --- /dev/null +++ b/Lang/Ring/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Ring \ No newline at end of file diff --git a/Lang/Ring/Amicable-pairs b/Lang/Ring/Amicable-pairs new file mode 120000 index 0000000000..0978f2d2a6 --- /dev/null +++ b/Lang/Ring/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/Ring \ No newline at end of file diff --git a/Lang/Ring/Apply-a-callback-to-an-array b/Lang/Ring/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..232af896cf --- /dev/null +++ b/Lang/Ring/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Ring \ No newline at end of file diff --git a/Lang/Ring/Arithmetic-Integer b/Lang/Ring/Arithmetic-Integer new file mode 120000 index 0000000000..225b6121be --- /dev/null +++ b/Lang/Ring/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Ring \ No newline at end of file diff --git a/Lang/Ring/Arithmetic-geometric-mean b/Lang/Ring/Arithmetic-geometric-mean new file mode 120000 index 0000000000..69a577b0b6 --- /dev/null +++ b/Lang/Ring/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/Ring \ No newline at end of file diff --git a/Lang/Ring/Array-concatenation b/Lang/Ring/Array-concatenation new file mode 120000 index 0000000000..bd6a6e9e3c --- /dev/null +++ b/Lang/Ring/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Ring \ No newline at end of file diff --git a/Lang/Ring/Arrays b/Lang/Ring/Arrays new file mode 120000 index 0000000000..5173ccc135 --- /dev/null +++ b/Lang/Ring/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Ring \ No newline at end of file diff --git a/Lang/Ring/Assertions b/Lang/Ring/Assertions new file mode 120000 index 0000000000..4a98d02535 --- /dev/null +++ b/Lang/Ring/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Ring \ No newline at end of file diff --git a/Lang/Ring/Averages-Arithmetic-mean b/Lang/Ring/Averages-Arithmetic-mean new file mode 120000 index 0000000000..653900f376 --- /dev/null +++ b/Lang/Ring/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Ring \ No newline at end of file diff --git a/Lang/Ring/Averages-Median b/Lang/Ring/Averages-Median new file mode 120000 index 0000000000..6d49b3aca0 --- /dev/null +++ b/Lang/Ring/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/Ring \ No newline at end of file diff --git a/Lang/Ring/Averages-Pythagorean-means b/Lang/Ring/Averages-Pythagorean-means new file mode 120000 index 0000000000..2372d354d2 --- /dev/null +++ b/Lang/Ring/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/Ring \ No newline at end of file diff --git a/Lang/Ring/Averages-Root-mean-square b/Lang/Ring/Averages-Root-mean-square new file mode 120000 index 0000000000..bdd8a66ffe --- /dev/null +++ b/Lang/Ring/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/Ring \ No newline at end of file diff --git a/Lang/Ring/Averages-Simple-moving-average b/Lang/Ring/Averages-Simple-moving-average new file mode 120000 index 0000000000..3d35223171 --- /dev/null +++ b/Lang/Ring/Averages-Simple-moving-average @@ -0,0 +1 @@ +../../Task/Averages-Simple-moving-average/Ring \ No newline at end of file diff --git a/Lang/Ring/Balanced-brackets b/Lang/Ring/Balanced-brackets new file mode 120000 index 0000000000..5948033f59 --- /dev/null +++ b/Lang/Ring/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Ring \ No newline at end of file diff --git a/Lang/Ring/Binary-digits b/Lang/Ring/Binary-digits new file mode 120000 index 0000000000..e532af791a --- /dev/null +++ b/Lang/Ring/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Ring \ No newline at end of file diff --git a/Lang/Ring/Binary-search b/Lang/Ring/Binary-search new file mode 120000 index 0000000000..1b1da04345 --- /dev/null +++ b/Lang/Ring/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Ring \ No newline at end of file diff --git a/Lang/Ring/Binary-strings b/Lang/Ring/Binary-strings new file mode 120000 index 0000000000..0d1a66ce86 --- /dev/null +++ b/Lang/Ring/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Ring \ No newline at end of file diff --git a/Lang/Ring/Bitmap-Bresenhams-line-algorithm b/Lang/Ring/Bitmap-Bresenhams-line-algorithm new file mode 120000 index 0000000000..dce4321cb8 --- /dev/null +++ b/Lang/Ring/Bitmap-Bresenhams-line-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Bresenhams-line-algorithm/Ring \ No newline at end of file diff --git a/Lang/Ring/Bitwise-operations b/Lang/Ring/Bitwise-operations new file mode 120000 index 0000000000..efaa234771 --- /dev/null +++ b/Lang/Ring/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/Ring \ No newline at end of file diff --git a/Lang/Ring/Boolean-values b/Lang/Ring/Boolean-values new file mode 120000 index 0000000000..968a84839b --- /dev/null +++ b/Lang/Ring/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/Ring \ No newline at end of file diff --git a/Lang/Ring/Call-a-function b/Lang/Ring/Call-a-function new file mode 120000 index 0000000000..efe1c579b8 --- /dev/null +++ b/Lang/Ring/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/Ring \ No newline at end of file diff --git a/Lang/Ring/Call-an-object-method b/Lang/Ring/Call-an-object-method new file mode 120000 index 0000000000..099bdf06cb --- /dev/null +++ b/Lang/Ring/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/Ring \ No newline at end of file diff --git a/Lang/Ring/Case-sensitivity-of-identifiers b/Lang/Ring/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..b582e7c76f --- /dev/null +++ b/Lang/Ring/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/Ring \ No newline at end of file diff --git a/Lang/Ring/Catalan-numbers b/Lang/Ring/Catalan-numbers new file mode 120000 index 0000000000..3fb87ee6b4 --- /dev/null +++ b/Lang/Ring/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/Ring \ No newline at end of file diff --git a/Lang/Ring/Catalan-numbers-Pascals-triangle b/Lang/Ring/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..7b9bca0a58 --- /dev/null +++ b/Lang/Ring/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/Ring \ No newline at end of file diff --git a/Lang/Ring/Catamorphism b/Lang/Ring/Catamorphism new file mode 120000 index 0000000000..8ba94484ce --- /dev/null +++ b/Lang/Ring/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/Ring \ No newline at end of file diff --git a/Lang/Ring/Character-codes b/Lang/Ring/Character-codes new file mode 120000 index 0000000000..9d92c876d5 --- /dev/null +++ b/Lang/Ring/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Ring \ No newline at end of file diff --git a/Lang/Ring/Check-that-file-exists b/Lang/Ring/Check-that-file-exists new file mode 120000 index 0000000000..f7ba0bc2d2 --- /dev/null +++ b/Lang/Ring/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Ring \ No newline at end of file diff --git a/Lang/Ring/Classes b/Lang/Ring/Classes new file mode 120000 index 0000000000..57c397a864 --- /dev/null +++ b/Lang/Ring/Classes @@ -0,0 +1 @@ +../../Task/Classes/Ring \ No newline at end of file diff --git a/Lang/Ring/Closest-pair-problem b/Lang/Ring/Closest-pair-problem new file mode 120000 index 0000000000..89247bb828 --- /dev/null +++ b/Lang/Ring/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/Ring \ No newline at end of file diff --git a/Lang/Ring/Closures-Value-capture b/Lang/Ring/Closures-Value-capture new file mode 120000 index 0000000000..aeaaac6098 --- /dev/null +++ b/Lang/Ring/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/Ring \ No newline at end of file diff --git a/Lang/Ring/Color-of-a-screen-pixel b/Lang/Ring/Color-of-a-screen-pixel new file mode 120000 index 0000000000..76d3becf7b --- /dev/null +++ b/Lang/Ring/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/Ring \ No newline at end of file diff --git a/Lang/Ring/Colour-bars-Display b/Lang/Ring/Colour-bars-Display new file mode 120000 index 0000000000..175b717027 --- /dev/null +++ b/Lang/Ring/Colour-bars-Display @@ -0,0 +1 @@ +../../Task/Colour-bars-Display/Ring \ No newline at end of file diff --git a/Lang/Ring/Command-line-arguments b/Lang/Ring/Command-line-arguments new file mode 120000 index 0000000000..2a74b32132 --- /dev/null +++ b/Lang/Ring/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/Ring \ No newline at end of file diff --git a/Lang/Ring/Comments b/Lang/Ring/Comments new file mode 120000 index 0000000000..5eae1e1cdb --- /dev/null +++ b/Lang/Ring/Comments @@ -0,0 +1 @@ +../../Task/Comments/Ring \ No newline at end of file diff --git a/Lang/Ring/Compile-time-calculation b/Lang/Ring/Compile-time-calculation new file mode 120000 index 0000000000..4d5da00394 --- /dev/null +++ b/Lang/Ring/Compile-time-calculation @@ -0,0 +1 @@ +../../Task/Compile-time-calculation/Ring \ No newline at end of file diff --git a/Lang/Ring/Compound-data-type b/Lang/Ring/Compound-data-type new file mode 120000 index 0000000000..f2e7e66c45 --- /dev/null +++ b/Lang/Ring/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/Ring \ No newline at end of file diff --git a/Lang/Ring/Conditional-structures b/Lang/Ring/Conditional-structures new file mode 120000 index 0000000000..55aa7fb524 --- /dev/null +++ b/Lang/Ring/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Ring \ No newline at end of file diff --git a/Lang/Ring/Constrained-random-points-on-a-circle b/Lang/Ring/Constrained-random-points-on-a-circle new file mode 120000 index 0000000000..bfde432a7c --- /dev/null +++ b/Lang/Ring/Constrained-random-points-on-a-circle @@ -0,0 +1 @@ +../../Task/Constrained-random-points-on-a-circle/Ring \ No newline at end of file diff --git a/Lang/Ring/Copy-a-string b/Lang/Ring/Copy-a-string new file mode 120000 index 0000000000..2159c71938 --- /dev/null +++ b/Lang/Ring/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Ring \ No newline at end of file diff --git a/Lang/Ring/Count-in-factors b/Lang/Ring/Count-in-factors new file mode 120000 index 0000000000..8d324eb63d --- /dev/null +++ b/Lang/Ring/Count-in-factors @@ -0,0 +1 @@ +../../Task/Count-in-factors/Ring \ No newline at end of file diff --git a/Lang/Ring/Count-in-octal b/Lang/Ring/Count-in-octal new file mode 120000 index 0000000000..40ba70799c --- /dev/null +++ b/Lang/Ring/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/Ring \ No newline at end of file diff --git a/Lang/Ring/Count-occurrences-of-a-substring b/Lang/Ring/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..ae6277d2de --- /dev/null +++ b/Lang/Ring/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Ring \ No newline at end of file diff --git a/Lang/Ring/Create-a-file b/Lang/Ring/Create-a-file new file mode 120000 index 0000000000..e7c3bb0aa5 --- /dev/null +++ b/Lang/Ring/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/Ring \ No newline at end of file diff --git a/Lang/Ring/Create-a-two-dimensional-array-at-runtime b/Lang/Ring/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..5b4963051e --- /dev/null +++ b/Lang/Ring/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/Ring \ No newline at end of file diff --git a/Lang/Ring/Date-format b/Lang/Ring/Date-format new file mode 120000 index 0000000000..d6260b8be6 --- /dev/null +++ b/Lang/Ring/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/Ring \ No newline at end of file diff --git a/Lang/Ring/Day-of-the-week b/Lang/Ring/Day-of-the-week new file mode 120000 index 0000000000..9ec2a96908 --- /dev/null +++ b/Lang/Ring/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Ring \ No newline at end of file diff --git a/Lang/Ring/Delete-a-file b/Lang/Ring/Delete-a-file new file mode 120000 index 0000000000..50e5864025 --- /dev/null +++ b/Lang/Ring/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Ring \ No newline at end of file diff --git a/Lang/Ring/Detect-division-by-zero b/Lang/Ring/Detect-division-by-zero new file mode 120000 index 0000000000..8d2fe41c6a --- /dev/null +++ b/Lang/Ring/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Ring \ No newline at end of file diff --git a/Lang/Ring/Determine-if-a-string-is-numeric b/Lang/Ring/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..6222c25138 --- /dev/null +++ b/Lang/Ring/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Ring \ No newline at end of file diff --git a/Lang/Ring/Digital-root b/Lang/Ring/Digital-root new file mode 120000 index 0000000000..1af9b235bf --- /dev/null +++ b/Lang/Ring/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/Ring \ No newline at end of file diff --git a/Lang/Ring/Dinesmans-multiple-dwelling-problem b/Lang/Ring/Dinesmans-multiple-dwelling-problem new file mode 120000 index 0000000000..f0b51da0fc --- /dev/null +++ b/Lang/Ring/Dinesmans-multiple-dwelling-problem @@ -0,0 +1 @@ +../../Task/Dinesmans-multiple-dwelling-problem/Ring \ No newline at end of file diff --git a/Lang/Ring/Documentation b/Lang/Ring/Documentation new file mode 120000 index 0000000000..107d4905e7 --- /dev/null +++ b/Lang/Ring/Documentation @@ -0,0 +1 @@ +../../Task/Documentation/Ring \ No newline at end of file diff --git a/Lang/Ring/Dot-product b/Lang/Ring/Dot-product new file mode 120000 index 0000000000..23bbd26d28 --- /dev/null +++ b/Lang/Ring/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Ring \ No newline at end of file diff --git a/Lang/Ring/Dynamic-variable-names b/Lang/Ring/Dynamic-variable-names new file mode 120000 index 0000000000..7b6547513b --- /dev/null +++ b/Lang/Ring/Dynamic-variable-names @@ -0,0 +1 @@ +../../Task/Dynamic-variable-names/Ring \ No newline at end of file diff --git a/Lang/Ring/Empty-directory b/Lang/Ring/Empty-directory new file mode 120000 index 0000000000..366ac1ac9e --- /dev/null +++ b/Lang/Ring/Empty-directory @@ -0,0 +1 @@ +../../Task/Empty-directory/Ring \ No newline at end of file diff --git a/Lang/Ring/Empty-program b/Lang/Ring/Empty-program new file mode 120000 index 0000000000..05941ac0c2 --- /dev/null +++ b/Lang/Ring/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/Ring \ No newline at end of file diff --git a/Lang/Ring/Empty-string b/Lang/Ring/Empty-string new file mode 120000 index 0000000000..0400e65ae0 --- /dev/null +++ b/Lang/Ring/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Ring \ No newline at end of file diff --git a/Lang/Ring/Enumerations b/Lang/Ring/Enumerations new file mode 120000 index 0000000000..6975f6ff49 --- /dev/null +++ b/Lang/Ring/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/Ring \ No newline at end of file diff --git a/Lang/Ring/Environment-variables b/Lang/Ring/Environment-variables new file mode 120000 index 0000000000..8f75ae80f6 --- /dev/null +++ b/Lang/Ring/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/Ring \ No newline at end of file diff --git a/Lang/Ring/Equilibrium-index b/Lang/Ring/Equilibrium-index new file mode 120000 index 0000000000..43ed9c557e --- /dev/null +++ b/Lang/Ring/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/Ring \ No newline at end of file diff --git a/Lang/Ring/Ethiopian-multiplication b/Lang/Ring/Ethiopian-multiplication new file mode 120000 index 0000000000..99fd47ffaa --- /dev/null +++ b/Lang/Ring/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Ring \ No newline at end of file diff --git a/Lang/Ring/Euler-method b/Lang/Ring/Euler-method new file mode 120000 index 0000000000..f83be90142 --- /dev/null +++ b/Lang/Ring/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/Ring \ No newline at end of file diff --git a/Lang/Ring/Evaluate-binomial-coefficients b/Lang/Ring/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..5d78e549b6 --- /dev/null +++ b/Lang/Ring/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/Ring \ No newline at end of file diff --git a/Lang/Ring/Even-or-odd b/Lang/Ring/Even-or-odd new file mode 120000 index 0000000000..0c6dda7f74 --- /dev/null +++ b/Lang/Ring/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Ring \ No newline at end of file diff --git a/Lang/Ring/Exceptions b/Lang/Ring/Exceptions new file mode 120000 index 0000000000..516b6d6aff --- /dev/null +++ b/Lang/Ring/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/Ring \ No newline at end of file diff --git a/Lang/Ring/Execute-a-system-command b/Lang/Ring/Execute-a-system-command new file mode 120000 index 0000000000..4e3bd021fa --- /dev/null +++ b/Lang/Ring/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/Ring \ No newline at end of file diff --git a/Lang/Ring/Exponentiation-operator b/Lang/Ring/Exponentiation-operator new file mode 120000 index 0000000000..854a655016 --- /dev/null +++ b/Lang/Ring/Exponentiation-operator @@ -0,0 +1 @@ +../../Task/Exponentiation-operator/Ring \ No newline at end of file diff --git a/Lang/Ring/Extensible-prime-generator b/Lang/Ring/Extensible-prime-generator new file mode 120000 index 0000000000..e679264072 --- /dev/null +++ b/Lang/Ring/Extensible-prime-generator @@ -0,0 +1 @@ +../../Task/Extensible-prime-generator/Ring \ No newline at end of file diff --git a/Lang/Ring/Factorial b/Lang/Ring/Factorial new file mode 120000 index 0000000000..5ea9d13e55 --- /dev/null +++ b/Lang/Ring/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Ring \ No newline at end of file diff --git a/Lang/Ring/Factors-of-an-integer b/Lang/Ring/Factors-of-an-integer new file mode 120000 index 0000000000..4abdd05b11 --- /dev/null +++ b/Lang/Ring/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Ring \ No newline at end of file diff --git a/Lang/Ring/Fibonacci-sequence b/Lang/Ring/Fibonacci-sequence new file mode 120000 index 0000000000..1f064742ee --- /dev/null +++ b/Lang/Ring/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Ring \ No newline at end of file diff --git a/Lang/Ring/File-input-output b/Lang/Ring/File-input-output new file mode 120000 index 0000000000..cfa3aaccd2 --- /dev/null +++ b/Lang/Ring/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/Ring \ No newline at end of file diff --git a/Lang/Ring/File-size b/Lang/Ring/File-size new file mode 120000 index 0000000000..afe0be527f --- /dev/null +++ b/Lang/Ring/File-size @@ -0,0 +1 @@ +../../Task/File-size/Ring \ No newline at end of file diff --git a/Lang/Ring/Filter b/Lang/Ring/Filter new file mode 120000 index 0000000000..0c617a521e --- /dev/null +++ b/Lang/Ring/Filter @@ -0,0 +1 @@ +../../Task/Filter/Ring \ No newline at end of file diff --git a/Lang/Ring/Find-limit-of-recursion b/Lang/Ring/Find-limit-of-recursion new file mode 120000 index 0000000000..fd49430ad5 --- /dev/null +++ b/Lang/Ring/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/Ring \ No newline at end of file diff --git a/Lang/Ring/Find-the-last-Sunday-of-each-month b/Lang/Ring/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..35719a2424 --- /dev/null +++ b/Lang/Ring/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/Ring \ No newline at end of file diff --git a/Lang/Ring/Find-the-missing-permutation b/Lang/Ring/Find-the-missing-permutation new file mode 120000 index 0000000000..e905401db4 --- /dev/null +++ b/Lang/Ring/Find-the-missing-permutation @@ -0,0 +1 @@ +../../Task/Find-the-missing-permutation/Ring \ No newline at end of file diff --git a/Lang/Ring/Five-weekends b/Lang/Ring/Five-weekends new file mode 120000 index 0000000000..a87f1ce662 --- /dev/null +++ b/Lang/Ring/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/Ring \ No newline at end of file diff --git a/Lang/Ring/FizzBuzz b/Lang/Ring/FizzBuzz new file mode 120000 index 0000000000..bd2f210a80 --- /dev/null +++ b/Lang/Ring/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Ring \ No newline at end of file diff --git a/Lang/Ring/Flatten-a-list b/Lang/Ring/Flatten-a-list new file mode 120000 index 0000000000..2e25f14257 --- /dev/null +++ b/Lang/Ring/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Ring \ No newline at end of file diff --git a/Lang/Ring/Flow-control-structures b/Lang/Ring/Flow-control-structures new file mode 120000 index 0000000000..e12c81efbd --- /dev/null +++ b/Lang/Ring/Flow-control-structures @@ -0,0 +1 @@ +../../Task/Flow-control-structures/Ring \ No newline at end of file diff --git a/Lang/Ring/Floyds-triangle b/Lang/Ring/Floyds-triangle new file mode 120000 index 0000000000..6d0ad4bfcb --- /dev/null +++ b/Lang/Ring/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/Ring \ No newline at end of file diff --git a/Lang/Ring/Formatted-numeric-output b/Lang/Ring/Formatted-numeric-output new file mode 120000 index 0000000000..31dd6a2f69 --- /dev/null +++ b/Lang/Ring/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/Ring \ No newline at end of file diff --git a/Lang/Ring/Fractal-tree b/Lang/Ring/Fractal-tree new file mode 120000 index 0000000000..135f082428 --- /dev/null +++ b/Lang/Ring/Fractal-tree @@ -0,0 +1 @@ +../../Task/Fractal-tree/Ring \ No newline at end of file diff --git a/Lang/Ring/Function-definition b/Lang/Ring/Function-definition new file mode 120000 index 0000000000..7e6918b0cc --- /dev/null +++ b/Lang/Ring/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Ring \ No newline at end of file diff --git a/Lang/Ring/GUI-Maximum-window-dimensions b/Lang/Ring/GUI-Maximum-window-dimensions new file mode 120000 index 0000000000..e42e8e4e61 --- /dev/null +++ b/Lang/Ring/GUI-Maximum-window-dimensions @@ -0,0 +1 @@ +../../Task/GUI-Maximum-window-dimensions/Ring \ No newline at end of file diff --git a/Lang/Ring/GUI-component-interaction b/Lang/Ring/GUI-component-interaction new file mode 120000 index 0000000000..38536108d3 --- /dev/null +++ b/Lang/Ring/GUI-component-interaction @@ -0,0 +1 @@ +../../Task/GUI-component-interaction/Ring \ No newline at end of file diff --git a/Lang/Ring/GUI-enabling-disabling-of-controls b/Lang/Ring/GUI-enabling-disabling-of-controls new file mode 120000 index 0000000000..9b466ec9ae --- /dev/null +++ b/Lang/Ring/GUI-enabling-disabling-of-controls @@ -0,0 +1 @@ +../../Task/GUI-enabling-disabling-of-controls/Ring \ No newline at end of file diff --git a/Lang/Ring/Gamma-function b/Lang/Ring/Gamma-function new file mode 120000 index 0000000000..7b4fe294ca --- /dev/null +++ b/Lang/Ring/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/Ring \ No newline at end of file diff --git a/Lang/Ring/Generate-lower-case-ASCII-alphabet b/Lang/Ring/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..4b2ccc7dd6 --- /dev/null +++ b/Lang/Ring/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Ring \ No newline at end of file diff --git a/Lang/Ring/Generic-swap b/Lang/Ring/Generic-swap new file mode 120000 index 0000000000..192acd858f --- /dev/null +++ b/Lang/Ring/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/Ring \ No newline at end of file diff --git a/Lang/Ring/Globally-replace-text-in-several-files b/Lang/Ring/Globally-replace-text-in-several-files new file mode 120000 index 0000000000..0511896f5d --- /dev/null +++ b/Lang/Ring/Globally-replace-text-in-several-files @@ -0,0 +1 @@ +../../Task/Globally-replace-text-in-several-files/Ring \ No newline at end of file diff --git a/Lang/Ring/Greatest-common-divisor b/Lang/Ring/Greatest-common-divisor new file mode 120000 index 0000000000..37bae0e653 --- /dev/null +++ b/Lang/Ring/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Ring \ No newline at end of file diff --git a/Lang/Ring/Greatest-element-of-a-list b/Lang/Ring/Greatest-element-of-a-list new file mode 120000 index 0000000000..3642ebe7b5 --- /dev/null +++ b/Lang/Ring/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Ring \ No newline at end of file diff --git a/Lang/Ring/Guess-the-number b/Lang/Ring/Guess-the-number new file mode 120000 index 0000000000..18355f67b8 --- /dev/null +++ b/Lang/Ring/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/Ring \ No newline at end of file diff --git a/Lang/Ring/Guess-the-number-With-feedback b/Lang/Ring/Guess-the-number-With-feedback new file mode 120000 index 0000000000..35d552c0d3 --- /dev/null +++ b/Lang/Ring/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/Ring \ No newline at end of file diff --git a/Lang/Ring/Guess-the-number-With-feedback--player- b/Lang/Ring/Guess-the-number-With-feedback--player- new file mode 120000 index 0000000000..1222f86db6 --- /dev/null +++ b/Lang/Ring/Guess-the-number-With-feedback--player- @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback--player-/Ring \ No newline at end of file diff --git a/Lang/Ring/HTTP b/Lang/Ring/HTTP new file mode 120000 index 0000000000..85d2ee3a2d --- /dev/null +++ b/Lang/Ring/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/Ring \ No newline at end of file diff --git a/Lang/Ring/HTTPS b/Lang/Ring/HTTPS new file mode 120000 index 0000000000..e20d40f4e1 --- /dev/null +++ b/Lang/Ring/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/Ring \ No newline at end of file diff --git a/Lang/Ring/Hailstone-sequence b/Lang/Ring/Hailstone-sequence new file mode 120000 index 0000000000..06934d4caa --- /dev/null +++ b/Lang/Ring/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Ring \ No newline at end of file diff --git a/Lang/Ring/Hamming-numbers b/Lang/Ring/Hamming-numbers new file mode 120000 index 0000000000..1e33a75768 --- /dev/null +++ b/Lang/Ring/Hamming-numbers @@ -0,0 +1 @@ +../../Task/Hamming-numbers/Ring \ No newline at end of file diff --git a/Lang/Ring/Happy-numbers b/Lang/Ring/Happy-numbers new file mode 120000 index 0000000000..76141711c3 --- /dev/null +++ b/Lang/Ring/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/Ring \ No newline at end of file diff --git a/Lang/Ring/Harshad-or-Niven-series b/Lang/Ring/Harshad-or-Niven-series new file mode 120000 index 0000000000..9e0c7757b9 --- /dev/null +++ b/Lang/Ring/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/Ring \ No newline at end of file diff --git a/Lang/Ring/Hash-join b/Lang/Ring/Hash-join new file mode 120000 index 0000000000..b9c9903be7 --- /dev/null +++ b/Lang/Ring/Hash-join @@ -0,0 +1 @@ +../../Task/Hash-join/Ring \ No newline at end of file diff --git a/Lang/Ring/Haversine-formula b/Lang/Ring/Haversine-formula new file mode 120000 index 0000000000..a538188067 --- /dev/null +++ b/Lang/Ring/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/Ring \ No newline at end of file diff --git a/Lang/Ring/Hello-world-Graphical b/Lang/Ring/Hello-world-Graphical new file mode 120000 index 0000000000..74af4f8f65 --- /dev/null +++ b/Lang/Ring/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Ring \ No newline at end of file diff --git a/Lang/Ring/Hello-world-Line-printer b/Lang/Ring/Hello-world-Line-printer new file mode 120000 index 0000000000..c2b3320ca3 --- /dev/null +++ b/Lang/Ring/Hello-world-Line-printer @@ -0,0 +1 @@ +../../Task/Hello-world-Line-printer/Ring \ No newline at end of file diff --git a/Lang/Ring/Hello-world-Newbie b/Lang/Ring/Hello-world-Newbie new file mode 120000 index 0000000000..2800e0a461 --- /dev/null +++ b/Lang/Ring/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/Ring \ No newline at end of file diff --git a/Lang/Ring/Hello-world-Newline-omission b/Lang/Ring/Hello-world-Newline-omission new file mode 120000 index 0000000000..aed30ed318 --- /dev/null +++ b/Lang/Ring/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Ring \ No newline at end of file diff --git a/Lang/Ring/Hello-world-Standard-error b/Lang/Ring/Hello-world-Standard-error new file mode 120000 index 0000000000..692a45e7db --- /dev/null +++ b/Lang/Ring/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Ring \ No newline at end of file diff --git a/Lang/Ring/Hello-world-Text b/Lang/Ring/Hello-world-Text new file mode 120000 index 0000000000..319383caf9 --- /dev/null +++ b/Lang/Ring/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Ring \ No newline at end of file diff --git a/Lang/Ring/Hello-world-Web-server b/Lang/Ring/Hello-world-Web-server new file mode 120000 index 0000000000..85e508fdc7 --- /dev/null +++ b/Lang/Ring/Hello-world-Web-server @@ -0,0 +1 @@ +../../Task/Hello-world-Web-server/Ring \ No newline at end of file diff --git a/Lang/Ring/Here-document b/Lang/Ring/Here-document new file mode 120000 index 0000000000..e9e3636edd --- /dev/null +++ b/Lang/Ring/Here-document @@ -0,0 +1 @@ +../../Task/Here-document/Ring \ No newline at end of file diff --git a/Lang/Ring/Heronian-triangles b/Lang/Ring/Heronian-triangles new file mode 120000 index 0000000000..1c13dd5c7a --- /dev/null +++ b/Lang/Ring/Heronian-triangles @@ -0,0 +1 @@ +../../Task/Heronian-triangles/Ring \ No newline at end of file diff --git a/Lang/Ring/Hickerson-series-of-almost-integers b/Lang/Ring/Hickerson-series-of-almost-integers new file mode 120000 index 0000000000..a14a6df7a9 --- /dev/null +++ b/Lang/Ring/Hickerson-series-of-almost-integers @@ -0,0 +1 @@ +../../Task/Hickerson-series-of-almost-integers/Ring \ No newline at end of file diff --git a/Lang/Ring/Hofstadter-Conway-$10,000-sequence b/Lang/Ring/Hofstadter-Conway-$10,000-sequence new file mode 120000 index 0000000000..1711f97110 --- /dev/null +++ b/Lang/Ring/Hofstadter-Conway-$10,000-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Conway-$10,000-sequence/Ring \ No newline at end of file diff --git a/Lang/Ring/Hofstadter-Q-sequence b/Lang/Ring/Hofstadter-Q-sequence new file mode 120000 index 0000000000..6303330f74 --- /dev/null +++ b/Lang/Ring/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/Ring \ No newline at end of file diff --git a/Lang/Ring/Horners-rule-for-polynomial-evaluation b/Lang/Ring/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..1a52b02c70 --- /dev/null +++ b/Lang/Ring/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/Ring \ No newline at end of file diff --git a/Lang/Ring/Identity-matrix b/Lang/Ring/Identity-matrix new file mode 120000 index 0000000000..d84b11c5d4 --- /dev/null +++ b/Lang/Ring/Identity-matrix @@ -0,0 +1 @@ +../../Task/Identity-matrix/Ring \ No newline at end of file diff --git a/Lang/Ring/Include-a-file b/Lang/Ring/Include-a-file new file mode 120000 index 0000000000..4f4fa1d678 --- /dev/null +++ b/Lang/Ring/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/Ring \ No newline at end of file diff --git a/Lang/Ring/Increment-a-numerical-string b/Lang/Ring/Increment-a-numerical-string new file mode 120000 index 0000000000..d50af0ce4a --- /dev/null +++ b/Lang/Ring/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Ring \ No newline at end of file diff --git a/Lang/Ring/Inheritance-Single b/Lang/Ring/Inheritance-Single new file mode 120000 index 0000000000..17476bac83 --- /dev/null +++ b/Lang/Ring/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/Ring \ No newline at end of file diff --git a/Lang/Ring/Input-loop b/Lang/Ring/Input-loop new file mode 120000 index 0000000000..4919f0ac7e --- /dev/null +++ b/Lang/Ring/Input-loop @@ -0,0 +1 @@ +../../Task/Input-loop/Ring \ No newline at end of file diff --git a/Lang/Ring/Integer-comparison b/Lang/Ring/Integer-comparison new file mode 120000 index 0000000000..17aa1aeecf --- /dev/null +++ b/Lang/Ring/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Ring \ No newline at end of file diff --git a/Lang/Ring/Integer-sequence b/Lang/Ring/Integer-sequence new file mode 120000 index 0000000000..e521ec0ef6 --- /dev/null +++ b/Lang/Ring/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Ring \ No newline at end of file diff --git a/Lang/Ring/Interactive-programming b/Lang/Ring/Interactive-programming new file mode 120000 index 0000000000..ef35f1bad8 --- /dev/null +++ b/Lang/Ring/Interactive-programming @@ -0,0 +1 @@ +../../Task/Interactive-programming/Ring \ No newline at end of file diff --git a/Lang/Ring/Iterated-digits-squaring b/Lang/Ring/Iterated-digits-squaring new file mode 120000 index 0000000000..57e8168b05 --- /dev/null +++ b/Lang/Ring/Iterated-digits-squaring @@ -0,0 +1 @@ +../../Task/Iterated-digits-squaring/Ring \ No newline at end of file diff --git a/Lang/Ring/Kaprekar-numbers b/Lang/Ring/Kaprekar-numbers new file mode 120000 index 0000000000..59473eb7e9 --- /dev/null +++ b/Lang/Ring/Kaprekar-numbers @@ -0,0 +1 @@ +../../Task/Kaprekar-numbers/Ring \ No newline at end of file diff --git a/Lang/Ring/Keyboard-input-Keypress-check b/Lang/Ring/Keyboard-input-Keypress-check new file mode 120000 index 0000000000..19538862d2 --- /dev/null +++ b/Lang/Ring/Keyboard-input-Keypress-check @@ -0,0 +1 @@ +../../Task/Keyboard-input-Keypress-check/Ring \ No newline at end of file diff --git a/Lang/Ring/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/Ring/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..26a1574f63 --- /dev/null +++ b/Lang/Ring/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/Ring \ No newline at end of file diff --git a/Lang/Ring/Knuth-shuffle b/Lang/Ring/Knuth-shuffle new file mode 120000 index 0000000000..3fa0caf480 --- /dev/null +++ b/Lang/Ring/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Ring \ No newline at end of file diff --git a/Lang/Ring/Langtons-ant b/Lang/Ring/Langtons-ant new file mode 120000 index 0000000000..d8a91171d6 --- /dev/null +++ b/Lang/Ring/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/Ring \ No newline at end of file diff --git a/Lang/Ring/Largest-int-from-concatenated-ints b/Lang/Ring/Largest-int-from-concatenated-ints new file mode 120000 index 0000000000..6b069e8dad --- /dev/null +++ b/Lang/Ring/Largest-int-from-concatenated-ints @@ -0,0 +1 @@ +../../Task/Largest-int-from-concatenated-ints/Ring \ No newline at end of file diff --git a/Lang/Ring/Last-Friday-of-each-month b/Lang/Ring/Last-Friday-of-each-month new file mode 120000 index 0000000000..4db6edf331 --- /dev/null +++ b/Lang/Ring/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/Ring \ No newline at end of file diff --git a/Lang/Ring/Leap-year b/Lang/Ring/Leap-year new file mode 120000 index 0000000000..2549714f35 --- /dev/null +++ b/Lang/Ring/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Ring \ No newline at end of file diff --git a/Lang/Ring/Least-common-multiple b/Lang/Ring/Least-common-multiple new file mode 120000 index 0000000000..9590dd5d8b --- /dev/null +++ b/Lang/Ring/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/Ring \ No newline at end of file diff --git a/Lang/Ring/Left-factorials b/Lang/Ring/Left-factorials new file mode 120000 index 0000000000..e8a978829a --- /dev/null +++ b/Lang/Ring/Left-factorials @@ -0,0 +1 @@ +../../Task/Left-factorials/Ring \ No newline at end of file diff --git a/Lang/Ring/Letter-frequency b/Lang/Ring/Letter-frequency new file mode 120000 index 0000000000..e09290b008 --- /dev/null +++ b/Lang/Ring/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/Ring \ No newline at end of file diff --git a/Lang/Ring/List-comprehensions b/Lang/Ring/List-comprehensions new file mode 120000 index 0000000000..ebc47d38bb --- /dev/null +++ b/Lang/Ring/List-comprehensions @@ -0,0 +1 @@ +../../Task/List-comprehensions/Ring \ No newline at end of file diff --git a/Lang/Ring/Literals-String b/Lang/Ring/Literals-String new file mode 120000 index 0000000000..1039b7903a --- /dev/null +++ b/Lang/Ring/Literals-String @@ -0,0 +1 @@ +../../Task/Literals-String/Ring \ No newline at end of file diff --git a/Lang/Ring/Logical-operations b/Lang/Ring/Logical-operations new file mode 120000 index 0000000000..f86236bccc --- /dev/null +++ b/Lang/Ring/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Ring \ No newline at end of file diff --git a/Lang/Ring/Longest-common-subsequence b/Lang/Ring/Longest-common-subsequence new file mode 120000 index 0000000000..01a3d4153a --- /dev/null +++ b/Lang/Ring/Longest-common-subsequence @@ -0,0 +1 @@ +../../Task/Longest-common-subsequence/Ring \ No newline at end of file diff --git a/Lang/Ring/Look-and-say-sequence b/Lang/Ring/Look-and-say-sequence new file mode 120000 index 0000000000..8980076246 --- /dev/null +++ b/Lang/Ring/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/Ring \ No newline at end of file diff --git a/Lang/Ring/Loop-over-multiple-arrays-simultaneously b/Lang/Ring/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..18edcda833 --- /dev/null +++ b/Lang/Ring/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Ring \ No newline at end of file diff --git a/Lang/Ring/Loops-Break b/Lang/Ring/Loops-Break new file mode 120000 index 0000000000..2a8e2dc8b3 --- /dev/null +++ b/Lang/Ring/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Ring \ No newline at end of file diff --git a/Lang/Ring/Loops-Continue b/Lang/Ring/Loops-Continue new file mode 120000 index 0000000000..1208816780 --- /dev/null +++ b/Lang/Ring/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Ring \ No newline at end of file diff --git a/Lang/Ring/Loops-Do-while b/Lang/Ring/Loops-Do-while new file mode 120000 index 0000000000..8ff3b732bd --- /dev/null +++ b/Lang/Ring/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Ring \ No newline at end of file diff --git a/Lang/Ring/Loops-Downward-for b/Lang/Ring/Loops-Downward-for new file mode 120000 index 0000000000..7be6127d0e --- /dev/null +++ b/Lang/Ring/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Ring \ No newline at end of file diff --git a/Lang/Ring/Loops-For b/Lang/Ring/Loops-For new file mode 120000 index 0000000000..c7930283a9 --- /dev/null +++ b/Lang/Ring/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Ring \ No newline at end of file diff --git a/Lang/Ring/Loops-For-with-a-specified-step b/Lang/Ring/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..fcd493c1f3 --- /dev/null +++ b/Lang/Ring/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Ring \ No newline at end of file diff --git a/Lang/Ring/Loops-Foreach b/Lang/Ring/Loops-Foreach new file mode 120000 index 0000000000..a2edb1bbfa --- /dev/null +++ b/Lang/Ring/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Ring \ No newline at end of file diff --git a/Lang/Ring/Loops-Infinite b/Lang/Ring/Loops-Infinite new file mode 120000 index 0000000000..ab11eb276c --- /dev/null +++ b/Lang/Ring/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Ring \ No newline at end of file diff --git a/Lang/Ring/Loops-N-plus-one-half b/Lang/Ring/Loops-N-plus-one-half new file mode 120000 index 0000000000..1415c0bad5 --- /dev/null +++ b/Lang/Ring/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Ring \ No newline at end of file diff --git a/Lang/Ring/Loops-Nested b/Lang/Ring/Loops-Nested new file mode 120000 index 0000000000..206e6479c5 --- /dev/null +++ b/Lang/Ring/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/Ring \ No newline at end of file diff --git a/Lang/Ring/Loops-While b/Lang/Ring/Loops-While new file mode 120000 index 0000000000..32fafdb540 --- /dev/null +++ b/Lang/Ring/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Ring \ No newline at end of file diff --git a/Lang/Ring/Lucas-Lehmer-test b/Lang/Ring/Lucas-Lehmer-test new file mode 120000 index 0000000000..2de591f32a --- /dev/null +++ b/Lang/Ring/Lucas-Lehmer-test @@ -0,0 +1 @@ +../../Task/Lucas-Lehmer-test/Ring \ No newline at end of file diff --git a/Lang/Ring/Luhn-test-of-credit-card-numbers b/Lang/Ring/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..6356ea970b --- /dev/null +++ b/Lang/Ring/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Ring \ No newline at end of file diff --git a/Lang/Ring/MD5 b/Lang/Ring/MD5 new file mode 120000 index 0000000000..039c37c0c0 --- /dev/null +++ b/Lang/Ring/MD5 @@ -0,0 +1 @@ +../../Task/MD5/Ring \ No newline at end of file diff --git a/Lang/Ring/Mad-Libs b/Lang/Ring/Mad-Libs new file mode 120000 index 0000000000..38983f671e --- /dev/null +++ b/Lang/Ring/Mad-Libs @@ -0,0 +1 @@ +../../Task/Mad-Libs/Ring \ No newline at end of file diff --git a/Lang/Ring/Magic-squares-of-odd-order b/Lang/Ring/Magic-squares-of-odd-order new file mode 120000 index 0000000000..d36b9526b7 --- /dev/null +++ b/Lang/Ring/Magic-squares-of-odd-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-odd-order/Ring \ No newline at end of file diff --git a/Lang/Ring/Make-directory-path b/Lang/Ring/Make-directory-path new file mode 120000 index 0000000000..43f91bb0e7 --- /dev/null +++ b/Lang/Ring/Make-directory-path @@ -0,0 +1 @@ +../../Task/Make-directory-path/Ring \ No newline at end of file diff --git a/Lang/Ring/Mandelbrot-set b/Lang/Ring/Mandelbrot-set new file mode 120000 index 0000000000..8ea77e11b7 --- /dev/null +++ b/Lang/Ring/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/Ring \ No newline at end of file diff --git a/Lang/Ring/Matrix-multiplication b/Lang/Ring/Matrix-multiplication new file mode 120000 index 0000000000..0073f1c421 --- /dev/null +++ b/Lang/Ring/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/Ring \ No newline at end of file diff --git a/Lang/Ring/Matrix-transposition b/Lang/Ring/Matrix-transposition new file mode 120000 index 0000000000..f5b101523c --- /dev/null +++ b/Lang/Ring/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/Ring \ No newline at end of file diff --git a/Lang/Ring/Memory-allocation b/Lang/Ring/Memory-allocation new file mode 120000 index 0000000000..347d01c682 --- /dev/null +++ b/Lang/Ring/Memory-allocation @@ -0,0 +1 @@ +../../Task/Memory-allocation/Ring \ No newline at end of file diff --git a/Lang/Ring/Menu b/Lang/Ring/Menu new file mode 120000 index 0000000000..878ebcc238 --- /dev/null +++ b/Lang/Ring/Menu @@ -0,0 +1 @@ +../../Task/Menu/Ring \ No newline at end of file diff --git a/Lang/Ring/Metaprogramming b/Lang/Ring/Metaprogramming new file mode 120000 index 0000000000..6a38e5b097 --- /dev/null +++ b/Lang/Ring/Metaprogramming @@ -0,0 +1 @@ +../../Task/Metaprogramming/Ring \ No newline at end of file diff --git a/Lang/Ring/Middle-three-digits b/Lang/Ring/Middle-three-digits new file mode 120000 index 0000000000..3cc28241f2 --- /dev/null +++ b/Lang/Ring/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/Ring \ No newline at end of file diff --git a/Lang/Ring/Modular-inverse b/Lang/Ring/Modular-inverse new file mode 120000 index 0000000000..2d2798d8ca --- /dev/null +++ b/Lang/Ring/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/Ring \ No newline at end of file diff --git a/Lang/Ring/Monte-Carlo-methods b/Lang/Ring/Monte-Carlo-methods new file mode 120000 index 0000000000..f54f6f42dd --- /dev/null +++ b/Lang/Ring/Monte-Carlo-methods @@ -0,0 +1 @@ +../../Task/Monte-Carlo-methods/Ring \ No newline at end of file diff --git a/Lang/Ring/Mouse-position b/Lang/Ring/Mouse-position new file mode 120000 index 0000000000..5d46455db9 --- /dev/null +++ b/Lang/Ring/Mouse-position @@ -0,0 +1 @@ +../../Task/Mouse-position/Ring \ No newline at end of file diff --git a/Lang/Ring/Multifactorial b/Lang/Ring/Multifactorial new file mode 120000 index 0000000000..deb9547305 --- /dev/null +++ b/Lang/Ring/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/Ring \ No newline at end of file diff --git a/Lang/Ring/Multiplication-tables b/Lang/Ring/Multiplication-tables new file mode 120000 index 0000000000..6e68cb2f6f --- /dev/null +++ b/Lang/Ring/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/Ring \ No newline at end of file diff --git a/Lang/Ring/Mutual-recursion b/Lang/Ring/Mutual-recursion new file mode 120000 index 0000000000..4baed651dc --- /dev/null +++ b/Lang/Ring/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/Ring \ No newline at end of file diff --git a/Lang/Ring/Narcissistic-decimal-number b/Lang/Ring/Narcissistic-decimal-number new file mode 120000 index 0000000000..046fe48204 --- /dev/null +++ b/Lang/Ring/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/Ring \ No newline at end of file diff --git a/Lang/Ring/Non-decimal-radices-Input b/Lang/Ring/Non-decimal-radices-Input new file mode 120000 index 0000000000..8218a2ceb6 --- /dev/null +++ b/Lang/Ring/Non-decimal-radices-Input @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Input/Ring \ No newline at end of file diff --git a/Lang/Ring/Nth b/Lang/Ring/Nth new file mode 120000 index 0000000000..4c10b6a032 --- /dev/null +++ b/Lang/Ring/Nth @@ -0,0 +1 @@ +../../Task/Nth/Ring \ No newline at end of file diff --git a/Lang/Ring/Nth-root b/Lang/Ring/Nth-root new file mode 120000 index 0000000000..709fe4351e --- /dev/null +++ b/Lang/Ring/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/Ring \ No newline at end of file diff --git a/Lang/Ring/Null-object b/Lang/Ring/Null-object new file mode 120000 index 0000000000..5973c807ca --- /dev/null +++ b/Lang/Ring/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/Ring \ No newline at end of file diff --git a/Lang/Ring/Number-names b/Lang/Ring/Number-names new file mode 120000 index 0000000000..519e6a2af9 --- /dev/null +++ b/Lang/Ring/Number-names @@ -0,0 +1 @@ +../../Task/Number-names/Ring \ No newline at end of file diff --git a/Lang/Ring/One-of-n-lines-in-a-file b/Lang/Ring/One-of-n-lines-in-a-file new file mode 120000 index 0000000000..ea1e01bb6c --- /dev/null +++ b/Lang/Ring/One-of-n-lines-in-a-file @@ -0,0 +1 @@ +../../Task/One-of-n-lines-in-a-file/Ring \ No newline at end of file diff --git a/Lang/Ring/Operator-precedence b/Lang/Ring/Operator-precedence new file mode 120000 index 0000000000..d274bb463b --- /dev/null +++ b/Lang/Ring/Operator-precedence @@ -0,0 +1 @@ +../../Task/Operator-precedence/Ring \ No newline at end of file diff --git a/Lang/Ring/Order-two-numerical-lists b/Lang/Ring/Order-two-numerical-lists new file mode 120000 index 0000000000..8e78350cf1 --- /dev/null +++ b/Lang/Ring/Order-two-numerical-lists @@ -0,0 +1 @@ +../../Task/Order-two-numerical-lists/Ring \ No newline at end of file diff --git a/Lang/Ring/Ordered-words b/Lang/Ring/Ordered-words new file mode 120000 index 0000000000..467657feae --- /dev/null +++ b/Lang/Ring/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Ring \ No newline at end of file diff --git a/Lang/Ring/Palindrome-detection b/Lang/Ring/Palindrome-detection new file mode 120000 index 0000000000..129c43bc55 --- /dev/null +++ b/Lang/Ring/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Ring \ No newline at end of file diff --git a/Lang/Ring/Pangram-checker b/Lang/Ring/Pangram-checker new file mode 120000 index 0000000000..0fe48cec00 --- /dev/null +++ b/Lang/Ring/Pangram-checker @@ -0,0 +1 @@ +../../Task/Pangram-checker/Ring \ No newline at end of file diff --git a/Lang/Ring/Pascals-triangle b/Lang/Ring/Pascals-triangle new file mode 120000 index 0000000000..207cf6676a --- /dev/null +++ b/Lang/Ring/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/Ring \ No newline at end of file diff --git a/Lang/Ring/Perfect-numbers b/Lang/Ring/Perfect-numbers new file mode 120000 index 0000000000..09ce17f0ab --- /dev/null +++ b/Lang/Ring/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/Ring \ No newline at end of file diff --git a/Lang/Ring/Permutations b/Lang/Ring/Permutations new file mode 120000 index 0000000000..1e45c5a327 --- /dev/null +++ b/Lang/Ring/Permutations @@ -0,0 +1 @@ +../../Task/Permutations/Ring \ No newline at end of file diff --git a/Lang/Ring/Phrase-reversals b/Lang/Ring/Phrase-reversals new file mode 120000 index 0000000000..2b9464824f --- /dev/null +++ b/Lang/Ring/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/Ring \ No newline at end of file diff --git a/Lang/Ring/Pick-random-element b/Lang/Ring/Pick-random-element new file mode 120000 index 0000000000..bdde203c39 --- /dev/null +++ b/Lang/Ring/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/Ring \ No newline at end of file diff --git a/Lang/Ring/Play-recorded-sounds b/Lang/Ring/Play-recorded-sounds new file mode 120000 index 0000000000..7d19640fa2 --- /dev/null +++ b/Lang/Ring/Play-recorded-sounds @@ -0,0 +1 @@ +../../Task/Play-recorded-sounds/Ring \ No newline at end of file diff --git a/Lang/Ring/Playing-cards b/Lang/Ring/Playing-cards new file mode 120000 index 0000000000..8a154f86ae --- /dev/null +++ b/Lang/Ring/Playing-cards @@ -0,0 +1 @@ +../../Task/Playing-cards/Ring \ No newline at end of file diff --git a/Lang/Ring/Price-fraction b/Lang/Ring/Price-fraction new file mode 120000 index 0000000000..d49857b151 --- /dev/null +++ b/Lang/Ring/Price-fraction @@ -0,0 +1 @@ +../../Task/Price-fraction/Ring \ No newline at end of file diff --git a/Lang/Ring/Primality-by-trial-division b/Lang/Ring/Primality-by-trial-division new file mode 120000 index 0000000000..0c6682fad2 --- /dev/null +++ b/Lang/Ring/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/Ring \ No newline at end of file diff --git a/Lang/Ring/Prime-decomposition b/Lang/Ring/Prime-decomposition new file mode 120000 index 0000000000..567be3cccb --- /dev/null +++ b/Lang/Ring/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/Ring \ No newline at end of file diff --git a/Lang/Ring/Program-name b/Lang/Ring/Program-name new file mode 120000 index 0000000000..9ea79f335b --- /dev/null +++ b/Lang/Ring/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/Ring \ No newline at end of file diff --git a/Lang/Ring/Program-termination b/Lang/Ring/Program-termination new file mode 120000 index 0000000000..98cc00df29 --- /dev/null +++ b/Lang/Ring/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/Ring \ No newline at end of file diff --git a/Lang/Ring/Pythagorean-triples b/Lang/Ring/Pythagorean-triples new file mode 120000 index 0000000000..e728ed3ad9 --- /dev/null +++ b/Lang/Ring/Pythagorean-triples @@ -0,0 +1 @@ +../../Task/Pythagorean-triples/Ring \ No newline at end of file diff --git a/Lang/Ring/Quickselect-algorithm b/Lang/Ring/Quickselect-algorithm new file mode 120000 index 0000000000..161ccfcfdf --- /dev/null +++ b/Lang/Ring/Quickselect-algorithm @@ -0,0 +1 @@ +../../Task/Quickselect-algorithm/Ring \ No newline at end of file diff --git a/Lang/Ring/Quine b/Lang/Ring/Quine new file mode 120000 index 0000000000..8a9c702d46 --- /dev/null +++ b/Lang/Ring/Quine @@ -0,0 +1 @@ +../../Task/Quine/Ring \ No newline at end of file diff --git a/Lang/Ring/README b/Lang/Ring/README new file mode 100644 index 0000000000..7ebdb5de0d --- /dev/null +++ b/Lang/Ring/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Ring diff --git a/Lang/Ring/Random-number-generator--device- b/Lang/Ring/Random-number-generator--device- new file mode 120000 index 0000000000..b7781c3926 --- /dev/null +++ b/Lang/Ring/Random-number-generator--device- @@ -0,0 +1 @@ +../../Task/Random-number-generator--device-/Ring \ No newline at end of file diff --git a/Lang/Ring/Random-number-generator--included- b/Lang/Ring/Random-number-generator--included- new file mode 120000 index 0000000000..6dce01a50c --- /dev/null +++ b/Lang/Ring/Random-number-generator--included- @@ -0,0 +1 @@ +../../Task/Random-number-generator--included-/Ring \ No newline at end of file diff --git a/Lang/Ring/Random-numbers b/Lang/Ring/Random-numbers new file mode 120000 index 0000000000..a95342d978 --- /dev/null +++ b/Lang/Ring/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/Ring \ No newline at end of file diff --git a/Lang/Ring/Read-a-file-line-by-line b/Lang/Ring/Read-a-file-line-by-line new file mode 120000 index 0000000000..6a592653e9 --- /dev/null +++ b/Lang/Ring/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/Ring \ No newline at end of file diff --git a/Lang/Ring/Read-a-specific-line-from-a-file b/Lang/Ring/Read-a-specific-line-from-a-file new file mode 120000 index 0000000000..af169fff65 --- /dev/null +++ b/Lang/Ring/Read-a-specific-line-from-a-file @@ -0,0 +1 @@ +../../Task/Read-a-specific-line-from-a-file/Ring \ No newline at end of file diff --git a/Lang/Ring/Read-entire-file b/Lang/Ring/Read-entire-file new file mode 120000 index 0000000000..f0e326e32d --- /dev/null +++ b/Lang/Ring/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Ring \ No newline at end of file diff --git a/Lang/Ring/Real-constants-and-functions b/Lang/Ring/Real-constants-and-functions new file mode 120000 index 0000000000..1a071ae776 --- /dev/null +++ b/Lang/Ring/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/Ring \ No newline at end of file diff --git a/Lang/Ring/Remove-duplicate-elements b/Lang/Ring/Remove-duplicate-elements new file mode 120000 index 0000000000..eaf4311615 --- /dev/null +++ b/Lang/Ring/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/Ring \ No newline at end of file diff --git a/Lang/Ring/Remove-lines-from-a-file b/Lang/Ring/Remove-lines-from-a-file new file mode 120000 index 0000000000..0c544e79bf --- /dev/null +++ b/Lang/Ring/Remove-lines-from-a-file @@ -0,0 +1 @@ +../../Task/Remove-lines-from-a-file/Ring \ No newline at end of file diff --git a/Lang/Ring/Rename-a-file b/Lang/Ring/Rename-a-file new file mode 120000 index 0000000000..cc34a815fe --- /dev/null +++ b/Lang/Ring/Rename-a-file @@ -0,0 +1 @@ +../../Task/Rename-a-file/Ring \ No newline at end of file diff --git a/Lang/Ring/Repeat-a-string b/Lang/Ring/Repeat-a-string new file mode 120000 index 0000000000..d04ef31db2 --- /dev/null +++ b/Lang/Ring/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Ring \ No newline at end of file diff --git a/Lang/Ring/Return-multiple-values b/Lang/Ring/Return-multiple-values new file mode 120000 index 0000000000..91490278ec --- /dev/null +++ b/Lang/Ring/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/Ring \ No newline at end of file diff --git a/Lang/Ring/Reverse-a-string b/Lang/Ring/Reverse-a-string new file mode 120000 index 0000000000..ce2acb9e56 --- /dev/null +++ b/Lang/Ring/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Ring \ No newline at end of file diff --git a/Lang/Ring/Reverse-words-in-a-string b/Lang/Ring/Reverse-words-in-a-string new file mode 120000 index 0000000000..ebcc3deced --- /dev/null +++ b/Lang/Ring/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/Ring \ No newline at end of file diff --git a/Lang/Ring/Roman-numerals-Decode b/Lang/Ring/Roman-numerals-Decode new file mode 120000 index 0000000000..7207bf8886 --- /dev/null +++ b/Lang/Ring/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/Ring \ No newline at end of file diff --git a/Lang/Ring/Roman-numerals-Encode b/Lang/Ring/Roman-numerals-Encode new file mode 120000 index 0000000000..4cb58ed171 --- /dev/null +++ b/Lang/Ring/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/Ring \ No newline at end of file diff --git a/Lang/Ring/Roots-of-a-function b/Lang/Ring/Roots-of-a-function new file mode 120000 index 0000000000..6f17178a17 --- /dev/null +++ b/Lang/Ring/Roots-of-a-function @@ -0,0 +1 @@ +../../Task/Roots-of-a-function/Ring \ No newline at end of file diff --git a/Lang/Ring/Roots-of-a-quadratic-function b/Lang/Ring/Roots-of-a-quadratic-function new file mode 120000 index 0000000000..e5979aaee8 --- /dev/null +++ b/Lang/Ring/Roots-of-a-quadratic-function @@ -0,0 +1 @@ +../../Task/Roots-of-a-quadratic-function/Ring \ No newline at end of file diff --git a/Lang/Ring/Roots-of-unity b/Lang/Ring/Roots-of-unity new file mode 120000 index 0000000000..cd012c233a --- /dev/null +++ b/Lang/Ring/Roots-of-unity @@ -0,0 +1 @@ +../../Task/Roots-of-unity/Ring \ No newline at end of file diff --git a/Lang/Ring/Rot-13 b/Lang/Ring/Rot-13 new file mode 120000 index 0000000000..853e9d5f51 --- /dev/null +++ b/Lang/Ring/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Ring \ No newline at end of file diff --git a/Lang/Ring/Runge-Kutta-method b/Lang/Ring/Runge-Kutta-method new file mode 120000 index 0000000000..3a12e259b2 --- /dev/null +++ b/Lang/Ring/Runge-Kutta-method @@ -0,0 +1 @@ +../../Task/Runge-Kutta-method/Ring \ No newline at end of file diff --git a/Lang/Ring/Runtime-evaluation b/Lang/Ring/Runtime-evaluation new file mode 120000 index 0000000000..03afe4f33d --- /dev/null +++ b/Lang/Ring/Runtime-evaluation @@ -0,0 +1 @@ +../../Task/Runtime-evaluation/Ring \ No newline at end of file diff --git a/Lang/Ring/Runtime-evaluation-In-an-environment b/Lang/Ring/Runtime-evaluation-In-an-environment new file mode 120000 index 0000000000..55fecbd766 --- /dev/null +++ b/Lang/Ring/Runtime-evaluation-In-an-environment @@ -0,0 +1 @@ +../../Task/Runtime-evaluation-In-an-environment/Ring \ No newline at end of file diff --git a/Lang/Ring/SEDOLs b/Lang/Ring/SEDOLs new file mode 120000 index 0000000000..e1dd2046f9 --- /dev/null +++ b/Lang/Ring/SEDOLs @@ -0,0 +1 @@ +../../Task/SEDOLs/Ring \ No newline at end of file diff --git a/Lang/Ring/Search-a-list b/Lang/Ring/Search-a-list new file mode 120000 index 0000000000..ee5f75a3e7 --- /dev/null +++ b/Lang/Ring/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Ring \ No newline at end of file diff --git a/Lang/Ring/Semiprime b/Lang/Ring/Semiprime new file mode 120000 index 0000000000..7f3106d318 --- /dev/null +++ b/Lang/Ring/Semiprime @@ -0,0 +1 @@ +../../Task/Semiprime/Ring \ No newline at end of file diff --git a/Lang/Ring/Semordnilap b/Lang/Ring/Semordnilap new file mode 120000 index 0000000000..93fb93ca65 --- /dev/null +++ b/Lang/Ring/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/Ring \ No newline at end of file diff --git a/Lang/Ring/Send-email b/Lang/Ring/Send-email new file mode 120000 index 0000000000..fe2d446f47 --- /dev/null +++ b/Lang/Ring/Send-email @@ -0,0 +1 @@ +../../Task/Send-email/Ring \ No newline at end of file diff --git a/Lang/Ring/Sequence-of-non-squares b/Lang/Ring/Sequence-of-non-squares new file mode 120000 index 0000000000..31caa9a39f --- /dev/null +++ b/Lang/Ring/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/Ring \ No newline at end of file diff --git a/Lang/Ring/Sequence-of-primes-by-Trial-Division b/Lang/Ring/Sequence-of-primes-by-Trial-Division new file mode 120000 index 0000000000..10a3543cde --- /dev/null +++ b/Lang/Ring/Sequence-of-primes-by-Trial-Division @@ -0,0 +1 @@ +../../Task/Sequence-of-primes-by-Trial-Division/Ring \ No newline at end of file diff --git a/Lang/Ring/Shell-one-liner b/Lang/Ring/Shell-one-liner new file mode 120000 index 0000000000..a516117ec0 --- /dev/null +++ b/Lang/Ring/Shell-one-liner @@ -0,0 +1 @@ +../../Task/Shell-one-liner/Ring \ No newline at end of file diff --git a/Lang/Ring/Show-the-epoch b/Lang/Ring/Show-the-epoch new file mode 120000 index 0000000000..91ec4682ae --- /dev/null +++ b/Lang/Ring/Show-the-epoch @@ -0,0 +1 @@ +../../Task/Show-the-epoch/Ring \ No newline at end of file diff --git a/Lang/Ring/Sierpinski-carpet b/Lang/Ring/Sierpinski-carpet new file mode 120000 index 0000000000..21bf1856c9 --- /dev/null +++ b/Lang/Ring/Sierpinski-carpet @@ -0,0 +1 @@ +../../Task/Sierpinski-carpet/Ring \ No newline at end of file diff --git a/Lang/Ring/Sierpinski-triangle-Graphical b/Lang/Ring/Sierpinski-triangle-Graphical new file mode 120000 index 0000000000..ba9fbf7022 --- /dev/null +++ b/Lang/Ring/Sierpinski-triangle-Graphical @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle-Graphical/Ring \ No newline at end of file diff --git a/Lang/Ring/Sieve-of-Eratosthenes b/Lang/Ring/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..8397311383 --- /dev/null +++ b/Lang/Ring/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/Ring \ No newline at end of file diff --git a/Lang/Ring/Simple-windowed-application b/Lang/Ring/Simple-windowed-application new file mode 120000 index 0000000000..5e6a419825 --- /dev/null +++ b/Lang/Ring/Simple-windowed-application @@ -0,0 +1 @@ +../../Task/Simple-windowed-application/Ring \ No newline at end of file diff --git a/Lang/Ring/Sleep b/Lang/Ring/Sleep new file mode 120000 index 0000000000..f399843c4e --- /dev/null +++ b/Lang/Ring/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Ring \ No newline at end of file diff --git a/Lang/Ring/Sockets b/Lang/Ring/Sockets new file mode 120000 index 0000000000..30f492e69c --- /dev/null +++ b/Lang/Ring/Sockets @@ -0,0 +1 @@ +../../Task/Sockets/Ring \ No newline at end of file diff --git a/Lang/Ring/Sort-an-integer-array b/Lang/Ring/Sort-an-integer-array new file mode 120000 index 0000000000..52573a9df5 --- /dev/null +++ b/Lang/Ring/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Ring \ No newline at end of file diff --git a/Lang/Ring/Sort-stability b/Lang/Ring/Sort-stability new file mode 120000 index 0000000000..b1bbcbf55e --- /dev/null +++ b/Lang/Ring/Sort-stability @@ -0,0 +1 @@ +../../Task/Sort-stability/Ring \ No newline at end of file diff --git a/Lang/Ring/Sorting-algorithms-Bubble-sort b/Lang/Ring/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..e369f34668 --- /dev/null +++ b/Lang/Ring/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/Ring \ No newline at end of file diff --git a/Lang/Ring/Sorting-algorithms-Cocktail-sort b/Lang/Ring/Sorting-algorithms-Cocktail-sort new file mode 120000 index 0000000000..eeb76d50dc --- /dev/null +++ b/Lang/Ring/Sorting-algorithms-Cocktail-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Cocktail-sort/Ring \ No newline at end of file diff --git a/Lang/Ring/Sorting-algorithms-Comb-sort b/Lang/Ring/Sorting-algorithms-Comb-sort new file mode 120000 index 0000000000..5874069ccb --- /dev/null +++ b/Lang/Ring/Sorting-algorithms-Comb-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Comb-sort/Ring \ No newline at end of file diff --git a/Lang/Ring/Sorting-algorithms-Counting-sort b/Lang/Ring/Sorting-algorithms-Counting-sort new file mode 120000 index 0000000000..4f85343de1 --- /dev/null +++ b/Lang/Ring/Sorting-algorithms-Counting-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Counting-sort/Ring \ No newline at end of file diff --git a/Lang/Ring/Sorting-algorithms-Gnome-sort b/Lang/Ring/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..06df526f64 --- /dev/null +++ b/Lang/Ring/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/Ring \ No newline at end of file diff --git a/Lang/Ring/Sorting-algorithms-Insertion-sort b/Lang/Ring/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..da6aef5ae6 --- /dev/null +++ b/Lang/Ring/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/Ring \ No newline at end of file diff --git a/Lang/Ring/Sorting-algorithms-Pancake-sort b/Lang/Ring/Sorting-algorithms-Pancake-sort new file mode 120000 index 0000000000..a1bae70cc7 --- /dev/null +++ b/Lang/Ring/Sorting-algorithms-Pancake-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Pancake-sort/Ring \ No newline at end of file diff --git a/Lang/Ring/Sorting-algorithms-Selection-sort b/Lang/Ring/Sorting-algorithms-Selection-sort new file mode 120000 index 0000000000..64aee4d0ec --- /dev/null +++ b/Lang/Ring/Sorting-algorithms-Selection-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Selection-sort/Ring \ No newline at end of file diff --git a/Lang/Ring/Sorting-algorithms-Shell-sort b/Lang/Ring/Sorting-algorithms-Shell-sort new file mode 120000 index 0000000000..8959798130 --- /dev/null +++ b/Lang/Ring/Sorting-algorithms-Shell-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Shell-sort/Ring \ No newline at end of file diff --git a/Lang/Ring/Sorting-algorithms-Stooge-sort b/Lang/Ring/Sorting-algorithms-Stooge-sort new file mode 120000 index 0000000000..f34d643617 --- /dev/null +++ b/Lang/Ring/Sorting-algorithms-Stooge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Stooge-sort/Ring \ No newline at end of file diff --git a/Lang/Ring/Stair-climbing-puzzle b/Lang/Ring/Stair-climbing-puzzle new file mode 120000 index 0000000000..037f839b46 --- /dev/null +++ b/Lang/Ring/Stair-climbing-puzzle @@ -0,0 +1 @@ +../../Task/Stair-climbing-puzzle/Ring \ No newline at end of file diff --git a/Lang/Ring/String-append b/Lang/Ring/String-append new file mode 120000 index 0000000000..4df6a2df97 --- /dev/null +++ b/Lang/Ring/String-append @@ -0,0 +1 @@ +../../Task/String-append/Ring \ No newline at end of file diff --git a/Lang/Ring/String-case b/Lang/Ring/String-case new file mode 120000 index 0000000000..5746dd4d2f --- /dev/null +++ b/Lang/Ring/String-case @@ -0,0 +1 @@ +../../Task/String-case/Ring \ No newline at end of file diff --git a/Lang/Ring/String-comparison b/Lang/Ring/String-comparison new file mode 120000 index 0000000000..0a0f6ba260 --- /dev/null +++ b/Lang/Ring/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/Ring \ No newline at end of file diff --git a/Lang/Ring/String-concatenation b/Lang/Ring/String-concatenation new file mode 120000 index 0000000000..5c63a7aa59 --- /dev/null +++ b/Lang/Ring/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Ring \ No newline at end of file diff --git a/Lang/Ring/String-interpolation--included- b/Lang/Ring/String-interpolation--included- new file mode 120000 index 0000000000..9d8d97fece --- /dev/null +++ b/Lang/Ring/String-interpolation--included- @@ -0,0 +1 @@ +../../Task/String-interpolation--included-/Ring \ No newline at end of file diff --git a/Lang/Ring/String-length b/Lang/Ring/String-length new file mode 120000 index 0000000000..290f35bd8c --- /dev/null +++ b/Lang/Ring/String-length @@ -0,0 +1 @@ +../../Task/String-length/Ring \ No newline at end of file diff --git a/Lang/Ring/String-matching b/Lang/Ring/String-matching new file mode 120000 index 0000000000..8043ce6a67 --- /dev/null +++ b/Lang/Ring/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/Ring \ No newline at end of file diff --git a/Lang/Ring/String-prepend b/Lang/Ring/String-prepend new file mode 120000 index 0000000000..d6b1d195eb --- /dev/null +++ b/Lang/Ring/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Ring \ No newline at end of file diff --git a/Lang/Ring/Strip-a-set-of-characters-from-a-string b/Lang/Ring/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..a7cfaf13d1 --- /dev/null +++ b/Lang/Ring/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Ring \ No newline at end of file diff --git a/Lang/Ring/Strip-block-comments b/Lang/Ring/Strip-block-comments new file mode 120000 index 0000000000..14d5785b10 --- /dev/null +++ b/Lang/Ring/Strip-block-comments @@ -0,0 +1 @@ +../../Task/Strip-block-comments/Ring \ No newline at end of file diff --git a/Lang/Ring/Strip-comments-from-a-string b/Lang/Ring/Strip-comments-from-a-string new file mode 120000 index 0000000000..a52b602ea9 --- /dev/null +++ b/Lang/Ring/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/Ring \ No newline at end of file diff --git a/Lang/Ring/Strip-control-codes-and-extended-characters-from-a-string b/Lang/Ring/Strip-control-codes-and-extended-characters-from-a-string new file mode 120000 index 0000000000..7b332335e9 --- /dev/null +++ b/Lang/Ring/Strip-control-codes-and-extended-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-control-codes-and-extended-characters-from-a-string/Ring \ No newline at end of file diff --git a/Lang/Ring/Strip-whitespace-from-a-string-Top-and-tail b/Lang/Ring/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..61e1beffc8 --- /dev/null +++ b/Lang/Ring/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/Ring \ No newline at end of file diff --git a/Lang/Ring/Substring b/Lang/Ring/Substring new file mode 120000 index 0000000000..07ef078bee --- /dev/null +++ b/Lang/Ring/Substring @@ -0,0 +1 @@ +../../Task/Substring/Ring \ No newline at end of file diff --git a/Lang/Ring/Substring-Top-and-tail b/Lang/Ring/Substring-Top-and-tail new file mode 120000 index 0000000000..b3c80924b6 --- /dev/null +++ b/Lang/Ring/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/Ring \ No newline at end of file diff --git a/Lang/Ring/Sum-and-product-of-an-array b/Lang/Ring/Sum-and-product-of-an-array new file mode 120000 index 0000000000..ec233bb34a --- /dev/null +++ b/Lang/Ring/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Ring \ No newline at end of file diff --git a/Lang/Ring/Sum-digits-of-an-integer b/Lang/Ring/Sum-digits-of-an-integer new file mode 120000 index 0000000000..8677455a3d --- /dev/null +++ b/Lang/Ring/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/Ring \ No newline at end of file diff --git a/Lang/Ring/Sum-multiples-of-3-and-5 b/Lang/Ring/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..762e3de1eb --- /dev/null +++ b/Lang/Ring/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/Ring \ No newline at end of file diff --git a/Lang/Ring/Sum-of-a-series b/Lang/Ring/Sum-of-a-series new file mode 120000 index 0000000000..0a554f6b6c --- /dev/null +++ b/Lang/Ring/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Ring \ No newline at end of file diff --git a/Lang/Ring/Sum-of-squares b/Lang/Ring/Sum-of-squares new file mode 120000 index 0000000000..9eff99c2ec --- /dev/null +++ b/Lang/Ring/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/Ring \ No newline at end of file diff --git a/Lang/Ring/Symmetric-difference b/Lang/Ring/Symmetric-difference new file mode 120000 index 0000000000..334c44f725 --- /dev/null +++ b/Lang/Ring/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/Ring \ No newline at end of file diff --git a/Lang/Ring/System-time b/Lang/Ring/System-time new file mode 120000 index 0000000000..9c972e4620 --- /dev/null +++ b/Lang/Ring/System-time @@ -0,0 +1 @@ +../../Task/System-time/Ring \ No newline at end of file diff --git a/Lang/Ring/Temperature-conversion b/Lang/Ring/Temperature-conversion new file mode 120000 index 0000000000..f530ea1c1d --- /dev/null +++ b/Lang/Ring/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Ring \ No newline at end of file diff --git a/Lang/Ring/Terminal-control-Clear-the-screen b/Lang/Ring/Terminal-control-Clear-the-screen new file mode 120000 index 0000000000..31cc83c51c --- /dev/null +++ b/Lang/Ring/Terminal-control-Clear-the-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Clear-the-screen/Ring \ No newline at end of file diff --git a/Lang/Ring/Terminal-control-Dimensions b/Lang/Ring/Terminal-control-Dimensions new file mode 120000 index 0000000000..19593c7f13 --- /dev/null +++ b/Lang/Ring/Terminal-control-Dimensions @@ -0,0 +1 @@ +../../Task/Terminal-control-Dimensions/Ring \ No newline at end of file diff --git a/Lang/Ring/Terminal-control-Inverse-video b/Lang/Ring/Terminal-control-Inverse-video new file mode 120000 index 0000000000..c27ac12f1c --- /dev/null +++ b/Lang/Ring/Terminal-control-Inverse-video @@ -0,0 +1 @@ +../../Task/Terminal-control-Inverse-video/Ring \ No newline at end of file diff --git a/Lang/Ring/Terminal-control-Ringing-the-terminal-bell b/Lang/Ring/Terminal-control-Ringing-the-terminal-bell new file mode 120000 index 0000000000..ed1e6db745 --- /dev/null +++ b/Lang/Ring/Terminal-control-Ringing-the-terminal-bell @@ -0,0 +1 @@ +../../Task/Terminal-control-Ringing-the-terminal-bell/Ring \ No newline at end of file diff --git a/Lang/Ring/Test-a-function b/Lang/Ring/Test-a-function new file mode 120000 index 0000000000..f9864decd9 --- /dev/null +++ b/Lang/Ring/Test-a-function @@ -0,0 +1 @@ +../../Task/Test-a-function/Ring \ No newline at end of file diff --git a/Lang/Ring/Tic-tac-toe b/Lang/Ring/Tic-tac-toe new file mode 120000 index 0000000000..ff16ed6917 --- /dev/null +++ b/Lang/Ring/Tic-tac-toe @@ -0,0 +1 @@ +../../Task/Tic-tac-toe/Ring \ No newline at end of file diff --git a/Lang/Ring/Time-a-function b/Lang/Ring/Time-a-function new file mode 120000 index 0000000000..6d502765dd --- /dev/null +++ b/Lang/Ring/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/Ring \ No newline at end of file diff --git a/Lang/Ring/Tokenize-a-string b/Lang/Ring/Tokenize-a-string new file mode 120000 index 0000000000..dc91aa12d5 --- /dev/null +++ b/Lang/Ring/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Ring \ No newline at end of file diff --git a/Lang/Ring/Towers-of-Hanoi b/Lang/Ring/Towers-of-Hanoi new file mode 120000 index 0000000000..713139c1a3 --- /dev/null +++ b/Lang/Ring/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Ring \ No newline at end of file diff --git a/Lang/Ring/Trabb-Pardo-Knuth-algorithm b/Lang/Ring/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..57fd3446ef --- /dev/null +++ b/Lang/Ring/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/Ring \ No newline at end of file diff --git a/Lang/Ring/Trigonometric-functions b/Lang/Ring/Trigonometric-functions new file mode 120000 index 0000000000..9770886749 --- /dev/null +++ b/Lang/Ring/Trigonometric-functions @@ -0,0 +1 @@ +../../Task/Trigonometric-functions/Ring \ No newline at end of file diff --git a/Lang/Ring/Truncate-a-file b/Lang/Ring/Truncate-a-file new file mode 120000 index 0000000000..0c4e59a40e --- /dev/null +++ b/Lang/Ring/Truncate-a-file @@ -0,0 +1 @@ +../../Task/Truncate-a-file/Ring \ No newline at end of file diff --git a/Lang/Ring/Unbias-a-random-generator b/Lang/Ring/Unbias-a-random-generator new file mode 120000 index 0000000000..9649a59dfa --- /dev/null +++ b/Lang/Ring/Unbias-a-random-generator @@ -0,0 +1 @@ +../../Task/Unbias-a-random-generator/Ring \ No newline at end of file diff --git a/Lang/Ring/User-input-Graphical b/Lang/Ring/User-input-Graphical new file mode 120000 index 0000000000..65d8ca8a90 --- /dev/null +++ b/Lang/Ring/User-input-Graphical @@ -0,0 +1 @@ +../../Task/User-input-Graphical/Ring \ No newline at end of file diff --git a/Lang/Ring/User-input-Text b/Lang/Ring/User-input-Text new file mode 120000 index 0000000000..1a2a2f9b0c --- /dev/null +++ b/Lang/Ring/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/Ring \ No newline at end of file diff --git a/Lang/Ring/Van-der-Corput-sequence b/Lang/Ring/Van-der-Corput-sequence new file mode 120000 index 0000000000..e1b43b3cdf --- /dev/null +++ b/Lang/Ring/Van-der-Corput-sequence @@ -0,0 +1 @@ +../../Task/Van-der-Corput-sequence/Ring \ No newline at end of file diff --git a/Lang/Ring/Variable-size-Get b/Lang/Ring/Variable-size-Get new file mode 120000 index 0000000000..af338d0adc --- /dev/null +++ b/Lang/Ring/Variable-size-Get @@ -0,0 +1 @@ +../../Task/Variable-size-Get/Ring \ No newline at end of file diff --git a/Lang/Ring/Variables b/Lang/Ring/Variables new file mode 120000 index 0000000000..bb8aec980c --- /dev/null +++ b/Lang/Ring/Variables @@ -0,0 +1 @@ +../../Task/Variables/Ring \ No newline at end of file diff --git a/Lang/Ring/Walk-a-directory-Recursively b/Lang/Ring/Walk-a-directory-Recursively new file mode 120000 index 0000000000..a16af6da42 --- /dev/null +++ b/Lang/Ring/Walk-a-directory-Recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Recursively/Ring \ No newline at end of file diff --git a/Lang/Ring/Window-creation b/Lang/Ring/Window-creation new file mode 120000 index 0000000000..5da5d951cb --- /dev/null +++ b/Lang/Ring/Window-creation @@ -0,0 +1 @@ +../../Task/Window-creation/Ring \ No newline at end of file diff --git a/Lang/Ring/Window-management b/Lang/Ring/Window-management new file mode 120000 index 0000000000..0a6a31219c --- /dev/null +++ b/Lang/Ring/Window-management @@ -0,0 +1 @@ +../../Task/Window-management/Ring \ No newline at end of file diff --git a/Lang/Ring/Zero-to-the-zero-power b/Lang/Ring/Zero-to-the-zero-power new file mode 120000 index 0000000000..96656cc5de --- /dev/null +++ b/Lang/Ring/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/Ring \ No newline at end of file diff --git a/Lang/Robotic/00DESCRIPTION b/Lang/Robotic/00DESCRIPTION new file mode 100644 index 0000000000..9df7a5fb92 --- /dev/null +++ b/Lang/Robotic/00DESCRIPTION @@ -0,0 +1,6 @@ +{{stub}} +{{language| +site=http://vault.digitalmzx.net/index.php +}} + +Robotic is a [[programming language]] for the game creation system titled [[wp:MegaZeux|MegaZeux]]. It is a simple language that is used for Robots placed within a MegaZeux world. Some of the few features for this language include the use of subroutines, arithmetic expressions, strings, counters, etc. \ No newline at end of file diff --git a/Lang/Robotic/Hello-world-Newbie b/Lang/Robotic/Hello-world-Newbie new file mode 120000 index 0000000000..4d2b934f45 --- /dev/null +++ b/Lang/Robotic/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/Robotic \ No newline at end of file diff --git a/Lang/Robotic/README b/Lang/Robotic/README new file mode 100644 index 0000000000..a2fd141aa2 --- /dev/null +++ b/Lang/Robotic/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Robotic diff --git a/Lang/Rubylog/00DESCRIPTION b/Lang/Rubylog/00DESCRIPTION new file mode 100644 index 0000000000..081fff902d --- /dev/null +++ b/Lang/Rubylog/00DESCRIPTION @@ -0,0 +1,4 @@ +{{stub}}{{language}} +Rubylog is a Prolog-like DSL for Ruby. + +See it on [https://github.com/cie/rubylog Github] or [http://rubygems.org/gems/rubylog Rubygems] \ No newline at end of file diff --git a/Lang/Rubylog/README b/Lang/Rubylog/README new file mode 100644 index 0000000000..0e7a5edbcb --- /dev/null +++ b/Lang/Rubylog/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Rubylog diff --git a/Lang/SPAD/00DESCRIPTION b/Lang/SPAD/00DESCRIPTION new file mode 100644 index 0000000000..4008131372 --- /dev/null +++ b/Lang/SPAD/00DESCRIPTION @@ -0,0 +1,11 @@ +{{language|SPAD +|strength=strong +|checking=static +|gc=yes +|LCT=yes}}{{implementation|FriCAS,Axiom,OpenAxiom}}{{language programming paradigm|Declarative}} +[http://fricas.github.io/ SPAD] is programming language used by the Fricas Computer Algebra System (as well as by Axiom and OpenAxiom). It is a multiparadigm language with second order dependent types. It is useful for research and development of mathematical algorithms. It defines a strongly typed, mathematically correct type hierarchy and is used in compiler - or interpreter mode. + + +
+ +[[Category:Mathematical programming languages]] \ No newline at end of file diff --git a/Lang/SPAD/A+B b/Lang/SPAD/A+B new file mode 120000 index 0000000000..e591697df5 --- /dev/null +++ b/Lang/SPAD/A+B @@ -0,0 +1 @@ +../../Task/A+B/SPAD \ No newline at end of file diff --git a/Lang/SPAD/ABC-Problem b/Lang/SPAD/ABC-Problem new file mode 120000 index 0000000000..6129989c64 --- /dev/null +++ b/Lang/SPAD/ABC-Problem @@ -0,0 +1 @@ +../../Task/ABC-Problem/SPAD \ No newline at end of file diff --git a/Lang/SPAD/Ackermann-function b/Lang/SPAD/Ackermann-function new file mode 120000 index 0000000000..f67480e0e1 --- /dev/null +++ b/Lang/SPAD/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/SPAD \ No newline at end of file diff --git a/Lang/SPAD/Bernoulli-numbers b/Lang/SPAD/Bernoulli-numbers new file mode 120000 index 0000000000..e62bfc7623 --- /dev/null +++ b/Lang/SPAD/Bernoulli-numbers @@ -0,0 +1 @@ +../../Task/Bernoulli-numbers/SPAD \ No newline at end of file diff --git a/Lang/SPAD/Combinations b/Lang/SPAD/Combinations new file mode 120000 index 0000000000..c8966e0a81 --- /dev/null +++ b/Lang/SPAD/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/SPAD \ No newline at end of file diff --git a/Lang/SPAD/Matrix-arithmetic b/Lang/SPAD/Matrix-arithmetic new file mode 120000 index 0000000000..aa39130429 --- /dev/null +++ b/Lang/SPAD/Matrix-arithmetic @@ -0,0 +1 @@ +../../Task/Matrix-arithmetic/SPAD \ No newline at end of file diff --git a/Lang/SPAD/Matrix-exponentiation-operator b/Lang/SPAD/Matrix-exponentiation-operator new file mode 120000 index 0000000000..8137f17b5f --- /dev/null +++ b/Lang/SPAD/Matrix-exponentiation-operator @@ -0,0 +1 @@ +../../Task/Matrix-exponentiation-operator/SPAD \ No newline at end of file diff --git a/Lang/SPAD/Matrix-multiplication b/Lang/SPAD/Matrix-multiplication new file mode 120000 index 0000000000..adf87a7a6d --- /dev/null +++ b/Lang/SPAD/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/SPAD \ No newline at end of file diff --git a/Lang/SPAD/Matrix-transposition b/Lang/SPAD/Matrix-transposition new file mode 120000 index 0000000000..546713a6df --- /dev/null +++ b/Lang/SPAD/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/SPAD \ No newline at end of file diff --git a/Lang/SPAD/Monty-Hall-problem b/Lang/SPAD/Monty-Hall-problem new file mode 120000 index 0000000000..5ae12d341a --- /dev/null +++ b/Lang/SPAD/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/SPAD \ No newline at end of file diff --git a/Lang/SPAD/Prime-decomposition b/Lang/SPAD/Prime-decomposition new file mode 120000 index 0000000000..ab79dfe6e0 --- /dev/null +++ b/Lang/SPAD/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/SPAD \ No newline at end of file diff --git a/Lang/SPAD/README b/Lang/SPAD/README new file mode 100644 index 0000000000..d3c9e84ea0 --- /dev/null +++ b/Lang/SPAD/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:SPAD diff --git a/Lang/SSEM/00DESCRIPTION b/Lang/SSEM/00DESCRIPTION new file mode 100644 index 0000000000..ebc359361a --- /dev/null +++ b/Lang/SSEM/00DESCRIPTION @@ -0,0 +1,35 @@ +{{language|SSEM}} +The Manchester Small-Scale Experimental Machine (SSEM or "Manchester Baby"), constructed in 1948, was the world's first stored-program electronic computer. Although its storage space (32 words of 32 bits each) was too limited for it to be a really practical general-purpose machine, the SSEM is of considerable historical interest. + +The machine could only be programmed in pure binary machine code from the front panel. No assembly language was ever specified for it, but there was a more or less standardized mnemonic notation used when drafting programs on a piece of paper before entering them into the machine. + +Each storage address could hold either a signed 32-bit integer (using two's complement for negative values) or an instruction word. Unlike most later digital computers, the SSEM's binary notation has the least significant bit first: 1 is one, 01 is two, 001 is four, etc. In an instruction word, the leftmost five bits stored the address of the operand and bits 13-15 stored the instruction itself. The operand was always a storage address and never an immediate value, even in the case of jumps: the jump target needed to be stored in a separate word, to which the jump would refer. The instruction set consisted of: + + + + + + + + + + + + + + + + + + + + + + + + + +
000 to CIload the number stored at address operand into the Current Instruction register. CI would then be incremented, so this is equivalent to goto store[operand] + 1
100 Add to CIrelative jump ahead by one more than the number stored at operand (because CI is incremented anyway after the instruction has been executed)
010 - to cload the negation of the number stored at operand into the accumulator
110 c to store the number in the accumulator at address operand
001 Sub. subtract the number stored at operand from the number stored in the accumulator, leaving the result in the accumulator
101 Sub. identical to 001
011 Testskip the next instruction if the number in the accumulator is negative
111 Stophalt
+ + +Several emulators exist allowing SSEM code to be run on modern computers, including two browser-based implementations: David Sharp's [http://www.davidsharp.com/baby/ Manchester Baby Simulator] in Java and Edmund Griffiths's [http://www.edmundgriffiths.com/jsssem.html JsSSEM] in JavaScript. \ No newline at end of file diff --git a/Lang/SSEM/A+B b/Lang/SSEM/A+B new file mode 120000 index 0000000000..ce43ca0139 --- /dev/null +++ b/Lang/SSEM/A+B @@ -0,0 +1 @@ +../../Task/A+B/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Arithmetic-Integer b/Lang/SSEM/Arithmetic-Integer new file mode 120000 index 0000000000..abff1862d6 --- /dev/null +++ b/Lang/SSEM/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Arrays b/Lang/SSEM/Arrays new file mode 120000 index 0000000000..907760eaa7 --- /dev/null +++ b/Lang/SSEM/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Caesar-cipher b/Lang/SSEM/Caesar-cipher new file mode 120000 index 0000000000..e59536c288 --- /dev/null +++ b/Lang/SSEM/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Call-a-function b/Lang/SSEM/Call-a-function new file mode 120000 index 0000000000..4887208455 --- /dev/null +++ b/Lang/SSEM/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Comments b/Lang/SSEM/Comments new file mode 120000 index 0000000000..8d47943d78 --- /dev/null +++ b/Lang/SSEM/Comments @@ -0,0 +1 @@ +../../Task/Comments/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Conditional-structures b/Lang/SSEM/Conditional-structures new file mode 120000 index 0000000000..34a2c4b020 --- /dev/null +++ b/Lang/SSEM/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Empty-program b/Lang/SSEM/Empty-program new file mode 120000 index 0000000000..13deb75ba1 --- /dev/null +++ b/Lang/SSEM/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Even-or-odd b/Lang/SSEM/Even-or-odd new file mode 120000 index 0000000000..87faddf512 --- /dev/null +++ b/Lang/SSEM/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Factorial b/Lang/SSEM/Factorial new file mode 120000 index 0000000000..444d7e3453 --- /dev/null +++ b/Lang/SSEM/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Fibonacci-sequence b/Lang/SSEM/Fibonacci-sequence new file mode 120000 index 0000000000..144831173e --- /dev/null +++ b/Lang/SSEM/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Flow-control-structures b/Lang/SSEM/Flow-control-structures new file mode 120000 index 0000000000..dae0394bec --- /dev/null +++ b/Lang/SSEM/Flow-control-structures @@ -0,0 +1 @@ +../../Task/Flow-control-structures/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Function-definition b/Lang/SSEM/Function-definition new file mode 120000 index 0000000000..4f5a2641f1 --- /dev/null +++ b/Lang/SSEM/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Hello-world-Graphical b/Lang/SSEM/Hello-world-Graphical new file mode 120000 index 0000000000..21a7f728ba --- /dev/null +++ b/Lang/SSEM/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Integer-comparison b/Lang/SSEM/Integer-comparison new file mode 120000 index 0000000000..d78364180f --- /dev/null +++ b/Lang/SSEM/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Integer-sequence b/Lang/SSEM/Integer-sequence new file mode 120000 index 0000000000..77250db65b --- /dev/null +++ b/Lang/SSEM/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Jump-anywhere b/Lang/SSEM/Jump-anywhere new file mode 120000 index 0000000000..aee58f62a5 --- /dev/null +++ b/Lang/SSEM/Jump-anywhere @@ -0,0 +1 @@ +../../Task/Jump-anywhere/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Loops-Downward-for b/Lang/SSEM/Loops-Downward-for new file mode 120000 index 0000000000..59ef55ef4b --- /dev/null +++ b/Lang/SSEM/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Loops-For-with-a-specified-step b/Lang/SSEM/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..b736bae9c4 --- /dev/null +++ b/Lang/SSEM/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Program-termination b/Lang/SSEM/Program-termination new file mode 120000 index 0000000000..401e93519b --- /dev/null +++ b/Lang/SSEM/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/SSEM \ No newline at end of file diff --git a/Lang/SSEM/README b/Lang/SSEM/README new file mode 100644 index 0000000000..8be921beb5 --- /dev/null +++ b/Lang/SSEM/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:SSEM diff --git a/Lang/SSEM/Singly-linked-list-Element-definition b/Lang/SSEM/Singly-linked-list-Element-definition new file mode 120000 index 0000000000..0184d8c5a5 --- /dev/null +++ b/Lang/SSEM/Singly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-definition/SSEM \ No newline at end of file diff --git a/Lang/SSEM/Singly-linked-list-Traversal b/Lang/SSEM/Singly-linked-list-Traversal new file mode 120000 index 0000000000..19a8c75336 --- /dev/null +++ b/Lang/SSEM/Singly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Traversal/SSEM \ No newline at end of file diff --git a/Lang/SequenceL/00DESCRIPTION b/Lang/SequenceL/00DESCRIPTION new file mode 100644 index 0000000000..3c3098bf74 --- /dev/null +++ b/Lang/SequenceL/00DESCRIPTION @@ -0,0 +1,16 @@ +{{stub}} +{{language|SequenceL +|strength=strong +|safety=safe +|checking=static +|site=http://sequencel.com +|tags=sequencel +|hopl=no}} +{{language programming paradigm|Declarative}} +{{language programming paradigm|functional}} +SequenceL is a general purpose functional programming language, whose primary design objectives are performance on multicore hardware, ease of programming, and code clarity/readability. Its primary advantage is that it can be used to write straightforward code that automatically takes full advantage of all the processing power available, without the developer having to concern themselves with identifying parallelisms, avoiding race conditions, and the like. + +Programs written in SequenceL can be compiled to multithreaded code that runs in parallel with no explicit indications from the programmer of how or what to parallelize. (Current versions of the SequenceL compiler generate C++ and OpenCL code, though other languages may also be supported.) An OS-specific runtime manages the threads safely, automatically providing parallel performance according to the cores available. + +==Citations== +* [[wp:SequenceL|Wikipedia:SequenceL]] \ No newline at end of file diff --git a/Lang/SequenceL/100-doors b/Lang/SequenceL/100-doors new file mode 120000 index 0000000000..993ddead53 --- /dev/null +++ b/Lang/SequenceL/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/99-Bottles-of-Beer b/Lang/SequenceL/99-Bottles-of-Beer new file mode 120000 index 0000000000..1bdcd3c4c4 --- /dev/null +++ b/Lang/SequenceL/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/A+B b/Lang/SequenceL/A+B new file mode 120000 index 0000000000..31db753e3f --- /dev/null +++ b/Lang/SequenceL/A+B @@ -0,0 +1 @@ +../../Task/A+B/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/ABC-Problem b/Lang/SequenceL/ABC-Problem new file mode 120000 index 0000000000..26e36c8b24 --- /dev/null +++ b/Lang/SequenceL/ABC-Problem @@ -0,0 +1 @@ +../../Task/ABC-Problem/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Almost-prime b/Lang/SequenceL/Almost-prime new file mode 120000 index 0000000000..11798aca8c --- /dev/null +++ b/Lang/SequenceL/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Animate-a-pendulum b/Lang/SequenceL/Animate-a-pendulum new file mode 120000 index 0000000000..aa2422182c --- /dev/null +++ b/Lang/SequenceL/Animate-a-pendulum @@ -0,0 +1 @@ +../../Task/Animate-a-pendulum/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Binary-digits b/Lang/SequenceL/Binary-digits new file mode 120000 index 0000000000..28cbbfa02d --- /dev/null +++ b/Lang/SequenceL/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Binary-search b/Lang/SequenceL/Binary-search new file mode 120000 index 0000000000..3435cd7c16 --- /dev/null +++ b/Lang/SequenceL/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Bitmap b/Lang/SequenceL/Bitmap new file mode 120000 index 0000000000..71f1e3697f --- /dev/null +++ b/Lang/SequenceL/Bitmap @@ -0,0 +1 @@ +../../Task/Bitmap/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Caesar-cipher b/Lang/SequenceL/Caesar-cipher new file mode 120000 index 0000000000..625f487dbb --- /dev/null +++ b/Lang/SequenceL/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Character-codes b/Lang/SequenceL/Character-codes new file mode 120000 index 0000000000..36eb64227b --- /dev/null +++ b/Lang/SequenceL/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Conways-Game-of-Life b/Lang/SequenceL/Conways-Game-of-Life new file mode 120000 index 0000000000..56f4e7d237 --- /dev/null +++ b/Lang/SequenceL/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Dragon-curve b/Lang/SequenceL/Dragon-curve new file mode 120000 index 0000000000..049257783a --- /dev/null +++ b/Lang/SequenceL/Dragon-curve @@ -0,0 +1 @@ +../../Task/Dragon-curve/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Euler-method b/Lang/SequenceL/Euler-method new file mode 120000 index 0000000000..6f977b6e76 --- /dev/null +++ b/Lang/SequenceL/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Even-or-odd b/Lang/SequenceL/Even-or-odd new file mode 120000 index 0000000000..84222a298f --- /dev/null +++ b/Lang/SequenceL/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Evolutionary-algorithm b/Lang/SequenceL/Evolutionary-algorithm new file mode 120000 index 0000000000..d16fdd2876 --- /dev/null +++ b/Lang/SequenceL/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Factorial b/Lang/SequenceL/Factorial new file mode 120000 index 0000000000..2e39b26676 --- /dev/null +++ b/Lang/SequenceL/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Factors-of-an-integer b/Lang/SequenceL/Factors-of-an-integer new file mode 120000 index 0000000000..ab3f37b77f --- /dev/null +++ b/Lang/SequenceL/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Fast-Fourier-transform b/Lang/SequenceL/Fast-Fourier-transform new file mode 120000 index 0000000000..e5944d203e --- /dev/null +++ b/Lang/SequenceL/Fast-Fourier-transform @@ -0,0 +1 @@ +../../Task/Fast-Fourier-transform/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Fibonacci-sequence b/Lang/SequenceL/Fibonacci-sequence new file mode 120000 index 0000000000..bee98b13ae --- /dev/null +++ b/Lang/SequenceL/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Filter b/Lang/SequenceL/Filter new file mode 120000 index 0000000000..0b27a50c33 --- /dev/null +++ b/Lang/SequenceL/Filter @@ -0,0 +1 @@ +../../Task/Filter/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/FizzBuzz b/Lang/SequenceL/FizzBuzz new file mode 120000 index 0000000000..b75f2b8b18 --- /dev/null +++ b/Lang/SequenceL/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Greatest-common-divisor b/Lang/SequenceL/Greatest-common-divisor new file mode 120000 index 0000000000..7bfe472bf0 --- /dev/null +++ b/Lang/SequenceL/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Happy-numbers b/Lang/SequenceL/Happy-numbers new file mode 120000 index 0000000000..f91714c88c --- /dev/null +++ b/Lang/SequenceL/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Here-document b/Lang/SequenceL/Here-document new file mode 120000 index 0000000000..48500c4315 --- /dev/null +++ b/Lang/SequenceL/Here-document @@ -0,0 +1 @@ +../../Task/Here-document/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Hough-transform b/Lang/SequenceL/Hough-transform new file mode 120000 index 0000000000..8ac741a046 --- /dev/null +++ b/Lang/SequenceL/Hough-transform @@ -0,0 +1 @@ +../../Task/Hough-transform/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Mandelbrot-set b/Lang/SequenceL/Mandelbrot-set new file mode 120000 index 0000000000..2ddb71b154 --- /dev/null +++ b/Lang/SequenceL/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Matrix-multiplication b/Lang/SequenceL/Matrix-multiplication new file mode 120000 index 0000000000..3b86e16172 --- /dev/null +++ b/Lang/SequenceL/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Number-names b/Lang/SequenceL/Number-names new file mode 120000 index 0000000000..809f7bcabf --- /dev/null +++ b/Lang/SequenceL/Number-names @@ -0,0 +1 @@ +../../Task/Number-names/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Numerical-integration b/Lang/SequenceL/Numerical-integration new file mode 120000 index 0000000000..2c1b9f099b --- /dev/null +++ b/Lang/SequenceL/Numerical-integration @@ -0,0 +1 @@ +../../Task/Numerical-integration/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Palindrome-detection b/Lang/SequenceL/Palindrome-detection new file mode 120000 index 0000000000..f744645eb1 --- /dev/null +++ b/Lang/SequenceL/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Parallel-calculations b/Lang/SequenceL/Parallel-calculations new file mode 120000 index 0000000000..1bef8cfd9e --- /dev/null +++ b/Lang/SequenceL/Parallel-calculations @@ -0,0 +1 @@ +../../Task/Parallel-calculations/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Prime-decomposition b/Lang/SequenceL/Prime-decomposition new file mode 120000 index 0000000000..0fd75f1dc4 --- /dev/null +++ b/Lang/SequenceL/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/README b/Lang/SequenceL/README new file mode 100644 index 0000000000..528ca90b81 --- /dev/null +++ b/Lang/SequenceL/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:SequenceL diff --git a/Lang/SequenceL/Reverse-a-string b/Lang/SequenceL/Reverse-a-string new file mode 120000 index 0000000000..cea4963bea --- /dev/null +++ b/Lang/SequenceL/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/SequenceL \ No newline at end of file diff --git a/Lang/SequenceL/Universal-Turing-machine b/Lang/SequenceL/Universal-Turing-machine new file mode 120000 index 0000000000..73aabf3215 --- /dev/null +++ b/Lang/SequenceL/Universal-Turing-machine @@ -0,0 +1 @@ +../../Task/Universal-Turing-machine/SequenceL \ No newline at end of file diff --git a/Lang/Set-lang/00DESCRIPTION b/Lang/Set-lang/00DESCRIPTION new file mode 100644 index 0000000000..43032cd540 --- /dev/null +++ b/Lang/Set-lang/00DESCRIPTION @@ -0,0 +1,10 @@ +{{stub}} +{{language|Set lang}} +[[Category:Esoteric_Languages]] + +[https://www.reddit.com/r/esolangs/comments/54b0b1/set_an_language_with_1_command/ Original reddit post] by the user [https://www.reddit.com/user/qwertyu63 qwertyu63], with the original specifications on how the language works. + +The '''Set''' language uses only a single command, ''set''. It allows for 52 development variables and 1 system variable. +It is ASCII based, so output is in the integer format, and is converted to characters upon ran. + +There is currently an [https://avellar.ml/set-lang online implementation] of a '''Set''' interpreter, done in JavaScript. A [https://github.com/MatheusAvellar/set-lang public GitHub repository] also exists, so feel free to contribute. \ No newline at end of file diff --git a/Lang/Set-lang/99-Bottles-of-Beer b/Lang/Set-lang/99-Bottles-of-Beer new file mode 120000 index 0000000000..59515e7681 --- /dev/null +++ b/Lang/Set-lang/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Set-lang \ No newline at end of file diff --git a/Lang/Set-lang/Comments b/Lang/Set-lang/Comments new file mode 120000 index 0000000000..ca168f5b05 --- /dev/null +++ b/Lang/Set-lang/Comments @@ -0,0 +1 @@ +../../Task/Comments/Set-lang \ No newline at end of file diff --git a/Lang/Set-lang/Death-Star b/Lang/Set-lang/Death-Star new file mode 120000 index 0000000000..0077a7a7e1 --- /dev/null +++ b/Lang/Set-lang/Death-Star @@ -0,0 +1 @@ +../../Task/Death-Star/Set-lang \ No newline at end of file diff --git a/Lang/Set-lang/Empty-program b/Lang/Set-lang/Empty-program new file mode 120000 index 0000000000..e6f84e5a85 --- /dev/null +++ b/Lang/Set-lang/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/Set-lang \ No newline at end of file diff --git a/Lang/Set-lang/Hello-world-Text b/Lang/Set-lang/Hello-world-Text new file mode 120000 index 0000000000..29628e357f --- /dev/null +++ b/Lang/Set-lang/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Set-lang \ No newline at end of file diff --git a/Lang/Set-lang/Nth b/Lang/Set-lang/Nth new file mode 120000 index 0000000000..dc5bb7a3ee --- /dev/null +++ b/Lang/Set-lang/Nth @@ -0,0 +1 @@ +../../Task/Nth/Set-lang \ No newline at end of file diff --git a/Lang/Set-lang/README b/Lang/Set-lang/README new file mode 100644 index 0000000000..5e0badffb7 --- /dev/null +++ b/Lang/Set-lang/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Set_lang diff --git a/Lang/Set-lang/Variables b/Lang/Set-lang/Variables new file mode 120000 index 0000000000..ca4d223c8a --- /dev/null +++ b/Lang/Set-lang/Variables @@ -0,0 +1 @@ +../../Task/Variables/Set-lang \ No newline at end of file diff --git a/Lang/Shen/00DESCRIPTION b/Lang/Shen/00DESCRIPTION new file mode 100644 index 0000000000..1739f7401e --- /dev/null +++ b/Lang/Shen/00DESCRIPTION @@ -0,0 +1,4 @@ +{{stub}} +{{language +|site=http://www.shenlanguage.org/}} +{{implementation|Lisp}} \ No newline at end of file diff --git a/Lang/Shen/Ackermann-function b/Lang/Shen/Ackermann-function new file mode 120000 index 0000000000..4b0f67d5b3 --- /dev/null +++ b/Lang/Shen/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Shen \ No newline at end of file diff --git a/Lang/Shen/Compound-data-type b/Lang/Shen/Compound-data-type new file mode 120000 index 0000000000..914a9b2dba --- /dev/null +++ b/Lang/Shen/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/Shen \ No newline at end of file diff --git a/Lang/Shen/Conways-Game-of-Life b/Lang/Shen/Conways-Game-of-Life new file mode 120000 index 0000000000..a237dd2c2e --- /dev/null +++ b/Lang/Shen/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/Shen \ No newline at end of file diff --git a/Lang/Shen/Extend-your-language b/Lang/Shen/Extend-your-language new file mode 120000 index 0000000000..efeeae2dd1 --- /dev/null +++ b/Lang/Shen/Extend-your-language @@ -0,0 +1 @@ +../../Task/Extend-your-language/Shen \ No newline at end of file diff --git a/Lang/Shen/Factorial b/Lang/Shen/Factorial new file mode 120000 index 0000000000..021af9b3e4 --- /dev/null +++ b/Lang/Shen/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Shen \ No newline at end of file diff --git a/Lang/Shen/Fibonacci-sequence b/Lang/Shen/Fibonacci-sequence new file mode 120000 index 0000000000..550606fb53 --- /dev/null +++ b/Lang/Shen/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Shen \ No newline at end of file diff --git a/Lang/Shen/FizzBuzz b/Lang/Shen/FizzBuzz new file mode 120000 index 0000000000..a537dcadfa --- /dev/null +++ b/Lang/Shen/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Shen \ No newline at end of file diff --git a/Lang/Shen/Hello-world-Text b/Lang/Shen/Hello-world-Text new file mode 120000 index 0000000000..b59ac12bfc --- /dev/null +++ b/Lang/Shen/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Shen \ No newline at end of file diff --git a/Lang/Shen/Metaprogramming b/Lang/Shen/Metaprogramming new file mode 120000 index 0000000000..918bcb7412 --- /dev/null +++ b/Lang/Shen/Metaprogramming @@ -0,0 +1 @@ +../../Task/Metaprogramming/Shen \ No newline at end of file diff --git a/Lang/Shen/README b/Lang/Shen/README new file mode 100644 index 0000000000..3a63bbd6d7 --- /dev/null +++ b/Lang/Shen/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Shen diff --git a/Lang/Sidef/00DESCRIPTION b/Lang/Sidef/00DESCRIPTION new file mode 100644 index 0000000000..26ba2cc083 --- /dev/null +++ b/Lang/Sidef/00DESCRIPTION @@ -0,0 +1,25 @@ +{{language +|exec=interpreted +|strength=weak +|express=implicit +|checking=dynamic +|compat=duck +|parampass=reference +|gc=yes +|site=http://github.com/trizen/sidef +|tags=ruby +|LCT=yes}} +{{language programming paradigm|Dynamic}} +{{language programming paradigm|Object-oriented}} +{{language programming paradigm|Imperative}} +{{language programming paradigm|Functional}} +{{language programming paradigm|Generic}} + +Sidef is a modern, dynamic, object-oriented programming language, focusing on simplicity, readability and elegance, taking the best from languages like [[derived from::Ruby]], [[derived from::Go]], [[derived from::Perl 6]] and [[derived from::Julia]]. + +The language is mostly used as a research programming language. + +For more details, see: +* Gitbook: [http://trizen.gitbooks.io/sidef-lang/content/ http://trizen.gitbooks.io/sidef-lang/content/] +* Tutorial: [https://github.com/trizen/sidef/wiki https://github.com/trizen/sidef/wiki] +* Development page: [https://github.com/trizen/sidef https://github.com/trizen/sidef] \ No newline at end of file diff --git a/Lang/Sidef/100-doors b/Lang/Sidef/100-doors new file mode 120000 index 0000000000..b3b16d9957 --- /dev/null +++ b/Lang/Sidef/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Sidef \ No newline at end of file diff --git a/Lang/Sidef/24-game b/Lang/Sidef/24-game new file mode 120000 index 0000000000..96b6387c13 --- /dev/null +++ b/Lang/Sidef/24-game @@ -0,0 +1 @@ +../../Task/24-game/Sidef \ No newline at end of file diff --git a/Lang/Sidef/24-game-Solve b/Lang/Sidef/24-game-Solve new file mode 120000 index 0000000000..f7d2d3152a --- /dev/null +++ b/Lang/Sidef/24-game-Solve @@ -0,0 +1 @@ +../../Task/24-game-Solve/Sidef \ No newline at end of file diff --git a/Lang/Sidef/9-billion-names-of-God-the-integer b/Lang/Sidef/9-billion-names-of-God-the-integer new file mode 120000 index 0000000000..0f4f1511a1 --- /dev/null +++ b/Lang/Sidef/9-billion-names-of-God-the-integer @@ -0,0 +1 @@ +../../Task/9-billion-names-of-God-the-integer/Sidef \ No newline at end of file diff --git a/Lang/Sidef/99-Bottles-of-Beer b/Lang/Sidef/99-Bottles-of-Beer new file mode 120000 index 0000000000..b9739d1073 --- /dev/null +++ b/Lang/Sidef/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Sidef \ No newline at end of file diff --git a/Lang/Sidef/A+B b/Lang/Sidef/A+B new file mode 120000 index 0000000000..fcf09e394d --- /dev/null +++ b/Lang/Sidef/A+B @@ -0,0 +1 @@ +../../Task/A+B/Sidef \ No newline at end of file diff --git a/Lang/Sidef/ABC-Problem b/Lang/Sidef/ABC-Problem new file mode 120000 index 0000000000..4815322980 --- /dev/null +++ b/Lang/Sidef/ABC-Problem @@ -0,0 +1 @@ +../../Task/ABC-Problem/Sidef \ No newline at end of file diff --git a/Lang/Sidef/AKS-test-for-primes b/Lang/Sidef/AKS-test-for-primes new file mode 120000 index 0000000000..0c30f0b06c --- /dev/null +++ b/Lang/Sidef/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Abstract-type b/Lang/Sidef/Abstract-type new file mode 120000 index 0000000000..b7d984be1a --- /dev/null +++ b/Lang/Sidef/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Abundant,-deficient-and-perfect-number-classifications b/Lang/Sidef/Abundant,-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..d9cb90835d --- /dev/null +++ b/Lang/Sidef/Abundant,-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant,-deficient-and-perfect-number-classifications/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Accumulator-factory b/Lang/Sidef/Accumulator-factory new file mode 120000 index 0000000000..6de3b73a42 --- /dev/null +++ b/Lang/Sidef/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Ackermann-function b/Lang/Sidef/Ackermann-function new file mode 120000 index 0000000000..e8d9641711 --- /dev/null +++ b/Lang/Sidef/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Add-a-variable-to-a-class-instance-at-runtime b/Lang/Sidef/Add-a-variable-to-a-class-instance-at-runtime new file mode 120000 index 0000000000..4bbfd709ef --- /dev/null +++ b/Lang/Sidef/Add-a-variable-to-a-class-instance-at-runtime @@ -0,0 +1 @@ +../../Task/Add-a-variable-to-a-class-instance-at-runtime/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Address-of-a-variable b/Lang/Sidef/Address-of-a-variable new file mode 120000 index 0000000000..cfeebb5363 --- /dev/null +++ b/Lang/Sidef/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Align-columns b/Lang/Sidef/Align-columns new file mode 120000 index 0000000000..995c53a9a8 --- /dev/null +++ b/Lang/Sidef/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Almost-prime b/Lang/Sidef/Almost-prime new file mode 120000 index 0000000000..7f4694c7a7 --- /dev/null +++ b/Lang/Sidef/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Amicable-pairs b/Lang/Sidef/Amicable-pairs new file mode 120000 index 0000000000..cc2aa3b008 --- /dev/null +++ b/Lang/Sidef/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Anagrams b/Lang/Sidef/Anagrams new file mode 120000 index 0000000000..e63ba298bd --- /dev/null +++ b/Lang/Sidef/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Anagrams-Deranged-anagrams b/Lang/Sidef/Anagrams-Deranged-anagrams new file mode 120000 index 0000000000..0ca7fee75f --- /dev/null +++ b/Lang/Sidef/Anagrams-Deranged-anagrams @@ -0,0 +1 @@ +../../Task/Anagrams-Deranged-anagrams/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Animate-a-pendulum b/Lang/Sidef/Animate-a-pendulum new file mode 120000 index 0000000000..9bf5c96350 --- /dev/null +++ b/Lang/Sidef/Animate-a-pendulum @@ -0,0 +1 @@ +../../Task/Animate-a-pendulum/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Anonymous-recursion b/Lang/Sidef/Anonymous-recursion new file mode 120000 index 0000000000..4e5e8bbe74 --- /dev/null +++ b/Lang/Sidef/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Append-a-record-to-the-end-of-a-text-file b/Lang/Sidef/Append-a-record-to-the-end-of-a-text-file new file mode 120000 index 0000000000..69c7a92d6c --- /dev/null +++ b/Lang/Sidef/Append-a-record-to-the-end-of-a-text-file @@ -0,0 +1 @@ +../../Task/Append-a-record-to-the-end-of-a-text-file/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Apply-a-callback-to-an-array b/Lang/Sidef/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..0bc210f2c9 --- /dev/null +++ b/Lang/Sidef/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Arbitrary-precision-integers--included- b/Lang/Sidef/Arbitrary-precision-integers--included- new file mode 120000 index 0000000000..43bca051cc --- /dev/null +++ b/Lang/Sidef/Arbitrary-precision-integers--included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers--included-/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Arithmetic-Complex b/Lang/Sidef/Arithmetic-Complex new file mode 120000 index 0000000000..c234398b2a --- /dev/null +++ b/Lang/Sidef/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Arithmetic-Integer b/Lang/Sidef/Arithmetic-Integer new file mode 120000 index 0000000000..c2f994de60 --- /dev/null +++ b/Lang/Sidef/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Arithmetic-evaluation b/Lang/Sidef/Arithmetic-evaluation new file mode 120000 index 0000000000..e9c8808f6e --- /dev/null +++ b/Lang/Sidef/Arithmetic-evaluation @@ -0,0 +1 @@ +../../Task/Arithmetic-evaluation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Arithmetic-geometric-mean b/Lang/Sidef/Arithmetic-geometric-mean new file mode 120000 index 0000000000..706cc31fea --- /dev/null +++ b/Lang/Sidef/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Arithmetic-geometric-mean-Calculate-Pi b/Lang/Sidef/Arithmetic-geometric-mean-Calculate-Pi new file mode 120000 index 0000000000..3b23a0fd4b --- /dev/null +++ b/Lang/Sidef/Arithmetic-geometric-mean-Calculate-Pi @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean-Calculate-Pi/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Array-concatenation b/Lang/Sidef/Array-concatenation new file mode 120000 index 0000000000..a677e253a0 --- /dev/null +++ b/Lang/Sidef/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Arrays b/Lang/Sidef/Arrays new file mode 120000 index 0000000000..ac5c8aeffc --- /dev/null +++ b/Lang/Sidef/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Assertions b/Lang/Sidef/Assertions new file mode 120000 index 0000000000..b2a9283b8b --- /dev/null +++ b/Lang/Sidef/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Associative-array-Creation b/Lang/Sidef/Associative-array-Creation new file mode 120000 index 0000000000..598f061dea --- /dev/null +++ b/Lang/Sidef/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Associative-array-Iteration b/Lang/Sidef/Associative-array-Iteration new file mode 120000 index 0000000000..3690ea5418 --- /dev/null +++ b/Lang/Sidef/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Averages-Arithmetic-mean b/Lang/Sidef/Averages-Arithmetic-mean new file mode 120000 index 0000000000..6fb83aa50f --- /dev/null +++ b/Lang/Sidef/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Averages-Mean-angle b/Lang/Sidef/Averages-Mean-angle new file mode 120000 index 0000000000..600a38bbd2 --- /dev/null +++ b/Lang/Sidef/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Averages-Mean-time-of-day b/Lang/Sidef/Averages-Mean-time-of-day new file mode 120000 index 0000000000..dc4f20686e --- /dev/null +++ b/Lang/Sidef/Averages-Mean-time-of-day @@ -0,0 +1 @@ +../../Task/Averages-Mean-time-of-day/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Averages-Median b/Lang/Sidef/Averages-Median new file mode 120000 index 0000000000..0ac93954c0 --- /dev/null +++ b/Lang/Sidef/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Averages-Mode b/Lang/Sidef/Averages-Mode new file mode 120000 index 0000000000..c26d952f59 --- /dev/null +++ b/Lang/Sidef/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Averages-Pythagorean-means b/Lang/Sidef/Averages-Pythagorean-means new file mode 120000 index 0000000000..8f5da46887 --- /dev/null +++ b/Lang/Sidef/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Averages-Root-mean-square b/Lang/Sidef/Averages-Root-mean-square new file mode 120000 index 0000000000..f7541694f3 --- /dev/null +++ b/Lang/Sidef/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Averages-Simple-moving-average b/Lang/Sidef/Averages-Simple-moving-average new file mode 120000 index 0000000000..29fa7bc2da --- /dev/null +++ b/Lang/Sidef/Averages-Simple-moving-average @@ -0,0 +1 @@ +../../Task/Averages-Simple-moving-average/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Balanced-brackets b/Lang/Sidef/Balanced-brackets new file mode 120000 index 0000000000..b07ba6e906 --- /dev/null +++ b/Lang/Sidef/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Benfords-law b/Lang/Sidef/Benfords-law new file mode 120000 index 0000000000..bcc3366cec --- /dev/null +++ b/Lang/Sidef/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Bernoulli-numbers b/Lang/Sidef/Bernoulli-numbers new file mode 120000 index 0000000000..cd49e92a2c --- /dev/null +++ b/Lang/Sidef/Bernoulli-numbers @@ -0,0 +1 @@ +../../Task/Bernoulli-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Best-shuffle b/Lang/Sidef/Best-shuffle new file mode 120000 index 0000000000..4879a32395 --- /dev/null +++ b/Lang/Sidef/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Binary-digits b/Lang/Sidef/Binary-digits new file mode 120000 index 0000000000..8f55d1942e --- /dev/null +++ b/Lang/Sidef/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Binary-search b/Lang/Sidef/Binary-search new file mode 120000 index 0000000000..fa761255b7 --- /dev/null +++ b/Lang/Sidef/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Bitmap-Bresenhams-line-algorithm b/Lang/Sidef/Bitmap-Bresenhams-line-algorithm new file mode 120000 index 0000000000..9e401924c4 --- /dev/null +++ b/Lang/Sidef/Bitmap-Bresenhams-line-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Bresenhams-line-algorithm/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Bitmap-Write-a-PPM-file b/Lang/Sidef/Bitmap-Write-a-PPM-file new file mode 120000 index 0000000000..494fa32d6a --- /dev/null +++ b/Lang/Sidef/Bitmap-Write-a-PPM-file @@ -0,0 +1 @@ +../../Task/Bitmap-Write-a-PPM-file/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Bitwise-operations b/Lang/Sidef/Bitwise-operations new file mode 120000 index 0000000000..2d040c8389 --- /dev/null +++ b/Lang/Sidef/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Boolean-values b/Lang/Sidef/Boolean-values new file mode 120000 index 0000000000..a9ad65e840 --- /dev/null +++ b/Lang/Sidef/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Box-the-compass b/Lang/Sidef/Box-the-compass new file mode 120000 index 0000000000..5ffc8fe467 --- /dev/null +++ b/Lang/Sidef/Box-the-compass @@ -0,0 +1 @@ +../../Task/Box-the-compass/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Break-OO-privacy b/Lang/Sidef/Break-OO-privacy new file mode 120000 index 0000000000..2a2f12861a --- /dev/null +++ b/Lang/Sidef/Break-OO-privacy @@ -0,0 +1 @@ +../../Task/Break-OO-privacy/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Bulls-and-cows b/Lang/Sidef/Bulls-and-cows new file mode 120000 index 0000000000..876426a86d --- /dev/null +++ b/Lang/Sidef/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Bulls-and-cows-Player b/Lang/Sidef/Bulls-and-cows-Player new file mode 120000 index 0000000000..31a52deb97 --- /dev/null +++ b/Lang/Sidef/Bulls-and-cows-Player @@ -0,0 +1 @@ +../../Task/Bulls-and-cows-Player/Sidef \ No newline at end of file diff --git a/Lang/Sidef/CSV-data-manipulation b/Lang/Sidef/CSV-data-manipulation new file mode 120000 index 0000000000..cdef997507 --- /dev/null +++ b/Lang/Sidef/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/CSV-to-HTML-translation b/Lang/Sidef/CSV-to-HTML-translation new file mode 120000 index 0000000000..8c7c5d0f89 --- /dev/null +++ b/Lang/Sidef/CSV-to-HTML-translation @@ -0,0 +1 @@ +../../Task/CSV-to-HTML-translation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Caesar-cipher b/Lang/Sidef/Caesar-cipher new file mode 120000 index 0000000000..eb3466bc88 --- /dev/null +++ b/Lang/Sidef/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Calendar b/Lang/Sidef/Calendar new file mode 120000 index 0000000000..d710cf997e --- /dev/null +++ b/Lang/Sidef/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Calendar---for-REAL-programmers b/Lang/Sidef/Calendar---for-REAL-programmers new file mode 120000 index 0000000000..9aacce6a1d --- /dev/null +++ b/Lang/Sidef/Calendar---for-REAL-programmers @@ -0,0 +1 @@ +../../Task/Calendar---for-REAL-programmers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Call-a-function b/Lang/Sidef/Call-a-function new file mode 120000 index 0000000000..85936edc31 --- /dev/null +++ b/Lang/Sidef/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Call-an-object-method b/Lang/Sidef/Call-an-object-method new file mode 120000 index 0000000000..f151168b8a --- /dev/null +++ b/Lang/Sidef/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Carmichael-3-strong-pseudoprimes b/Lang/Sidef/Carmichael-3-strong-pseudoprimes new file mode 120000 index 0000000000..444e9a4586 --- /dev/null +++ b/Lang/Sidef/Carmichael-3-strong-pseudoprimes @@ -0,0 +1 @@ +../../Task/Carmichael-3-strong-pseudoprimes/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Case-sensitivity-of-identifiers b/Lang/Sidef/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..94a4e06658 --- /dev/null +++ b/Lang/Sidef/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Catalan-numbers b/Lang/Sidef/Catalan-numbers new file mode 120000 index 0000000000..3c3713095f --- /dev/null +++ b/Lang/Sidef/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Catalan-numbers-Pascals-triangle b/Lang/Sidef/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..a761cbed00 --- /dev/null +++ b/Lang/Sidef/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Catamorphism b/Lang/Sidef/Catamorphism new file mode 120000 index 0000000000..6df9819158 --- /dev/null +++ b/Lang/Sidef/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Character-codes b/Lang/Sidef/Character-codes new file mode 120000 index 0000000000..05efc98f98 --- /dev/null +++ b/Lang/Sidef/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Check-Machin-like-formulas b/Lang/Sidef/Check-Machin-like-formulas new file mode 120000 index 0000000000..c64ef3bbfa --- /dev/null +++ b/Lang/Sidef/Check-Machin-like-formulas @@ -0,0 +1 @@ +../../Task/Check-Machin-like-formulas/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Check-that-file-exists b/Lang/Sidef/Check-that-file-exists new file mode 120000 index 0000000000..2e68b96354 --- /dev/null +++ b/Lang/Sidef/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Chinese-remainder-theorem b/Lang/Sidef/Chinese-remainder-theorem new file mode 120000 index 0000000000..aa7c80718e --- /dev/null +++ b/Lang/Sidef/Chinese-remainder-theorem @@ -0,0 +1 @@ +../../Task/Chinese-remainder-theorem/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Cholesky-decomposition b/Lang/Sidef/Cholesky-decomposition new file mode 120000 index 0000000000..e61a9f5598 --- /dev/null +++ b/Lang/Sidef/Cholesky-decomposition @@ -0,0 +1 @@ +../../Task/Cholesky-decomposition/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Classes b/Lang/Sidef/Classes new file mode 120000 index 0000000000..881bb353fd --- /dev/null +++ b/Lang/Sidef/Classes @@ -0,0 +1 @@ +../../Task/Classes/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Closest-pair-problem b/Lang/Sidef/Closest-pair-problem new file mode 120000 index 0000000000..1a21dcd0d5 --- /dev/null +++ b/Lang/Sidef/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Closures-Value-capture b/Lang/Sidef/Closures-Value-capture new file mode 120000 index 0000000000..8740a655f7 --- /dev/null +++ b/Lang/Sidef/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Collections b/Lang/Sidef/Collections new file mode 120000 index 0000000000..7c9f7a9893 --- /dev/null +++ b/Lang/Sidef/Collections @@ -0,0 +1 @@ +../../Task/Collections/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Colour-bars-Display b/Lang/Sidef/Colour-bars-Display new file mode 120000 index 0000000000..107ad3ebe0 --- /dev/null +++ b/Lang/Sidef/Colour-bars-Display @@ -0,0 +1 @@ +../../Task/Colour-bars-Display/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Combinations b/Lang/Sidef/Combinations new file mode 120000 index 0000000000..e9bb65121c --- /dev/null +++ b/Lang/Sidef/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Combinations-and-permutations b/Lang/Sidef/Combinations-and-permutations new file mode 120000 index 0000000000..afd94f28a3 --- /dev/null +++ b/Lang/Sidef/Combinations-and-permutations @@ -0,0 +1 @@ +../../Task/Combinations-and-permutations/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Combinations-with-repetitions b/Lang/Sidef/Combinations-with-repetitions new file mode 120000 index 0000000000..c01c372a22 --- /dev/null +++ b/Lang/Sidef/Combinations-with-repetitions @@ -0,0 +1 @@ +../../Task/Combinations-with-repetitions/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Comma-quibbling b/Lang/Sidef/Comma-quibbling new file mode 120000 index 0000000000..89363121eb --- /dev/null +++ b/Lang/Sidef/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Command-line-arguments b/Lang/Sidef/Command-line-arguments new file mode 120000 index 0000000000..22638f4dd4 --- /dev/null +++ b/Lang/Sidef/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Comments b/Lang/Sidef/Comments new file mode 120000 index 0000000000..c1b232e0c5 --- /dev/null +++ b/Lang/Sidef/Comments @@ -0,0 +1 @@ +../../Task/Comments/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Compile-time-calculation b/Lang/Sidef/Compile-time-calculation new file mode 120000 index 0000000000..d468592b53 --- /dev/null +++ b/Lang/Sidef/Compile-time-calculation @@ -0,0 +1 @@ +../../Task/Compile-time-calculation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Compound-data-type b/Lang/Sidef/Compound-data-type new file mode 120000 index 0000000000..70ff3e4de7 --- /dev/null +++ b/Lang/Sidef/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Concurrent-computing b/Lang/Sidef/Concurrent-computing new file mode 120000 index 0000000000..e71c7356ef --- /dev/null +++ b/Lang/Sidef/Concurrent-computing @@ -0,0 +1 @@ +../../Task/Concurrent-computing/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Constrained-genericity b/Lang/Sidef/Constrained-genericity new file mode 120000 index 0000000000..3e4701c61a --- /dev/null +++ b/Lang/Sidef/Constrained-genericity @@ -0,0 +1 @@ +../../Task/Constrained-genericity/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Constrained-random-points-on-a-circle b/Lang/Sidef/Constrained-random-points-on-a-circle new file mode 120000 index 0000000000..7002049d04 --- /dev/null +++ b/Lang/Sidef/Constrained-random-points-on-a-circle @@ -0,0 +1 @@ +../../Task/Constrained-random-points-on-a-circle/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Continued-fraction b/Lang/Sidef/Continued-fraction new file mode 120000 index 0000000000..59d0a53d52 --- /dev/null +++ b/Lang/Sidef/Continued-fraction @@ -0,0 +1 @@ +../../Task/Continued-fraction/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Continued-fraction-Arithmetic-Construct-from-rational-number b/Lang/Sidef/Continued-fraction-Arithmetic-Construct-from-rational-number new file mode 120000 index 0000000000..bacfd78c50 --- /dev/null +++ b/Lang/Sidef/Continued-fraction-Arithmetic-Construct-from-rational-number @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-Construct-from-rational-number/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Convert-decimal-number-to-rational b/Lang/Sidef/Convert-decimal-number-to-rational new file mode 120000 index 0000000000..2dbe63ba01 --- /dev/null +++ b/Lang/Sidef/Convert-decimal-number-to-rational @@ -0,0 +1 @@ +../../Task/Convert-decimal-number-to-rational/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Conways-Game-of-Life b/Lang/Sidef/Conways-Game-of-Life new file mode 120000 index 0000000000..b06256d2ec --- /dev/null +++ b/Lang/Sidef/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Copy-a-string b/Lang/Sidef/Copy-a-string new file mode 120000 index 0000000000..1b0530bdde --- /dev/null +++ b/Lang/Sidef/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Count-in-factors b/Lang/Sidef/Count-in-factors new file mode 120000 index 0000000000..50a155d34c --- /dev/null +++ b/Lang/Sidef/Count-in-factors @@ -0,0 +1 @@ +../../Task/Count-in-factors/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Count-in-octal b/Lang/Sidef/Count-in-octal new file mode 120000 index 0000000000..a03bcd854a --- /dev/null +++ b/Lang/Sidef/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Count-occurrences-of-a-substring b/Lang/Sidef/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..e1ed067265 --- /dev/null +++ b/Lang/Sidef/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Count-the-coins b/Lang/Sidef/Count-the-coins new file mode 120000 index 0000000000..9cfa665d14 --- /dev/null +++ b/Lang/Sidef/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Create-a-file b/Lang/Sidef/Create-a-file new file mode 120000 index 0000000000..e06f071752 --- /dev/null +++ b/Lang/Sidef/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Create-a-two-dimensional-array-at-runtime b/Lang/Sidef/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..ef09b7128c --- /dev/null +++ b/Lang/Sidef/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Create-an-HTML-table b/Lang/Sidef/Create-an-HTML-table new file mode 120000 index 0000000000..beea3ef11f --- /dev/null +++ b/Lang/Sidef/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Currying b/Lang/Sidef/Currying new file mode 120000 index 0000000000..4949a37c99 --- /dev/null +++ b/Lang/Sidef/Currying @@ -0,0 +1 @@ +../../Task/Currying/Sidef \ No newline at end of file diff --git a/Lang/Sidef/DNS-query b/Lang/Sidef/DNS-query new file mode 120000 index 0000000000..60a6d55d6b --- /dev/null +++ b/Lang/Sidef/DNS-query @@ -0,0 +1 @@ +../../Task/DNS-query/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Date-format b/Lang/Sidef/Date-format new file mode 120000 index 0000000000..83d93ec28c --- /dev/null +++ b/Lang/Sidef/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Date-manipulation b/Lang/Sidef/Date-manipulation new file mode 120000 index 0000000000..8a499505c7 --- /dev/null +++ b/Lang/Sidef/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Day-of-the-week b/Lang/Sidef/Day-of-the-week new file mode 120000 index 0000000000..fe837f6fd7 --- /dev/null +++ b/Lang/Sidef/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Death-Star b/Lang/Sidef/Death-Star new file mode 120000 index 0000000000..5826effa01 --- /dev/null +++ b/Lang/Sidef/Death-Star @@ -0,0 +1 @@ +../../Task/Death-Star/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Deepcopy b/Lang/Sidef/Deepcopy new file mode 120000 index 0000000000..613b6159ed --- /dev/null +++ b/Lang/Sidef/Deepcopy @@ -0,0 +1 @@ +../../Task/Deepcopy/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Define-a-primitive-data-type b/Lang/Sidef/Define-a-primitive-data-type new file mode 120000 index 0000000000..94d8f52012 --- /dev/null +++ b/Lang/Sidef/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Delete-a-file b/Lang/Sidef/Delete-a-file new file mode 120000 index 0000000000..715806f6fc --- /dev/null +++ b/Lang/Sidef/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Detect-division-by-zero b/Lang/Sidef/Detect-division-by-zero new file mode 120000 index 0000000000..49e63d5f8c --- /dev/null +++ b/Lang/Sidef/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Determine-if-a-string-is-numeric b/Lang/Sidef/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..447c978eb7 --- /dev/null +++ b/Lang/Sidef/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Determine-if-only-one-instance-is-running b/Lang/Sidef/Determine-if-only-one-instance-is-running new file mode 120000 index 0000000000..3e9e25d9be --- /dev/null +++ b/Lang/Sidef/Determine-if-only-one-instance-is-running @@ -0,0 +1 @@ +../../Task/Determine-if-only-one-instance-is-running/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Digital-root b/Lang/Sidef/Digital-root new file mode 120000 index 0000000000..0a183f34e8 --- /dev/null +++ b/Lang/Sidef/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Digital-root-Multiplicative-digital-root b/Lang/Sidef/Digital-root-Multiplicative-digital-root new file mode 120000 index 0000000000..b3ef8bf634 --- /dev/null +++ b/Lang/Sidef/Digital-root-Multiplicative-digital-root @@ -0,0 +1 @@ +../../Task/Digital-root-Multiplicative-digital-root/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Dinesmans-multiple-dwelling-problem b/Lang/Sidef/Dinesmans-multiple-dwelling-problem new file mode 120000 index 0000000000..fc5edd420f --- /dev/null +++ b/Lang/Sidef/Dinesmans-multiple-dwelling-problem @@ -0,0 +1 @@ +../../Task/Dinesmans-multiple-dwelling-problem/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Discordian-date b/Lang/Sidef/Discordian-date new file mode 120000 index 0000000000..bebdd5e219 --- /dev/null +++ b/Lang/Sidef/Discordian-date @@ -0,0 +1 @@ +../../Task/Discordian-date/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Dot-product b/Lang/Sidef/Dot-product new file mode 120000 index 0000000000..b84b617d54 --- /dev/null +++ b/Lang/Sidef/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Doubly-linked-list-Element-definition b/Lang/Sidef/Doubly-linked-list-Element-definition new file mode 120000 index 0000000000..050d99c0f1 --- /dev/null +++ b/Lang/Sidef/Doubly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Element-definition/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Dragon-curve b/Lang/Sidef/Dragon-curve new file mode 120000 index 0000000000..e4e0ad032b --- /dev/null +++ b/Lang/Sidef/Dragon-curve @@ -0,0 +1 @@ +../../Task/Dragon-curve/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Draw-a-clock b/Lang/Sidef/Draw-a-clock new file mode 120000 index 0000000000..836034623b --- /dev/null +++ b/Lang/Sidef/Draw-a-clock @@ -0,0 +1 @@ +../../Task/Draw-a-clock/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Draw-a-cuboid b/Lang/Sidef/Draw-a-cuboid new file mode 120000 index 0000000000..351e14c9a4 --- /dev/null +++ b/Lang/Sidef/Draw-a-cuboid @@ -0,0 +1 @@ +../../Task/Draw-a-cuboid/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Draw-a-sphere b/Lang/Sidef/Draw-a-sphere new file mode 120000 index 0000000000..9e64ef8ace --- /dev/null +++ b/Lang/Sidef/Draw-a-sphere @@ -0,0 +1 @@ +../../Task/Draw-a-sphere/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Dynamic-variable-names b/Lang/Sidef/Dynamic-variable-names new file mode 120000 index 0000000000..c2b7339e0e --- /dev/null +++ b/Lang/Sidef/Dynamic-variable-names @@ -0,0 +1 @@ +../../Task/Dynamic-variable-names/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Empty-directory b/Lang/Sidef/Empty-directory new file mode 120000 index 0000000000..25642faefb --- /dev/null +++ b/Lang/Sidef/Empty-directory @@ -0,0 +1 @@ +../../Task/Empty-directory/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Empty-program b/Lang/Sidef/Empty-program new file mode 120000 index 0000000000..c7465e3077 --- /dev/null +++ b/Lang/Sidef/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Empty-string b/Lang/Sidef/Empty-string new file mode 120000 index 0000000000..40144d0e78 --- /dev/null +++ b/Lang/Sidef/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Enforced-immutability b/Lang/Sidef/Enforced-immutability new file mode 120000 index 0000000000..dc8f53b61e --- /dev/null +++ b/Lang/Sidef/Enforced-immutability @@ -0,0 +1 @@ +../../Task/Enforced-immutability/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Entropy b/Lang/Sidef/Entropy new file mode 120000 index 0000000000..6b334f35bf --- /dev/null +++ b/Lang/Sidef/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Enumerations b/Lang/Sidef/Enumerations new file mode 120000 index 0000000000..84998061ff --- /dev/null +++ b/Lang/Sidef/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Environment-variables b/Lang/Sidef/Environment-variables new file mode 120000 index 0000000000..05612de554 --- /dev/null +++ b/Lang/Sidef/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Equilibrium-index b/Lang/Sidef/Equilibrium-index new file mode 120000 index 0000000000..47e4110bcb --- /dev/null +++ b/Lang/Sidef/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Ethiopian-multiplication b/Lang/Sidef/Ethiopian-multiplication new file mode 120000 index 0000000000..f4d8fb894c --- /dev/null +++ b/Lang/Sidef/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Euler-method b/Lang/Sidef/Euler-method new file mode 120000 index 0000000000..6abdf584ce --- /dev/null +++ b/Lang/Sidef/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Evaluate-binomial-coefficients b/Lang/Sidef/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..460acd5d1d --- /dev/null +++ b/Lang/Sidef/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Even-or-odd b/Lang/Sidef/Even-or-odd new file mode 120000 index 0000000000..8e54d2109d --- /dev/null +++ b/Lang/Sidef/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Evolutionary-algorithm b/Lang/Sidef/Evolutionary-algorithm new file mode 120000 index 0000000000..2e9a703b8b --- /dev/null +++ b/Lang/Sidef/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Exceptions b/Lang/Sidef/Exceptions new file mode 120000 index 0000000000..0b291f6e15 --- /dev/null +++ b/Lang/Sidef/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Exceptions-Catch-an-exception-thrown-in-a-nested-call b/Lang/Sidef/Exceptions-Catch-an-exception-thrown-in-a-nested-call new file mode 120000 index 0000000000..34e6af2ebb --- /dev/null +++ b/Lang/Sidef/Exceptions-Catch-an-exception-thrown-in-a-nested-call @@ -0,0 +1 @@ +../../Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Executable-library b/Lang/Sidef/Executable-library new file mode 120000 index 0000000000..da7106a825 --- /dev/null +++ b/Lang/Sidef/Executable-library @@ -0,0 +1 @@ +../../Task/Executable-library/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Execute-Brain---- b/Lang/Sidef/Execute-Brain---- new file mode 120000 index 0000000000..603bce2800 --- /dev/null +++ b/Lang/Sidef/Execute-Brain---- @@ -0,0 +1 @@ +../../Task/Execute-Brain----/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Execute-HQ9+ b/Lang/Sidef/Execute-HQ9+ new file mode 120000 index 0000000000..1116d8f1eb --- /dev/null +++ b/Lang/Sidef/Execute-HQ9+ @@ -0,0 +1 @@ +../../Task/Execute-HQ9+/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Execute-a-system-command b/Lang/Sidef/Execute-a-system-command new file mode 120000 index 0000000000..f85553b33f --- /dev/null +++ b/Lang/Sidef/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Exponentiation-operator b/Lang/Sidef/Exponentiation-operator new file mode 120000 index 0000000000..04765be313 --- /dev/null +++ b/Lang/Sidef/Exponentiation-operator @@ -0,0 +1 @@ +../../Task/Exponentiation-operator/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Extend-your-language b/Lang/Sidef/Extend-your-language new file mode 120000 index 0000000000..8304a7288c --- /dev/null +++ b/Lang/Sidef/Extend-your-language @@ -0,0 +1 @@ +../../Task/Extend-your-language/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Extensible-prime-generator b/Lang/Sidef/Extensible-prime-generator new file mode 120000 index 0000000000..838a3302b3 --- /dev/null +++ b/Lang/Sidef/Extensible-prime-generator @@ -0,0 +1 @@ +../../Task/Extensible-prime-generator/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Extreme-floating-point-values b/Lang/Sidef/Extreme-floating-point-values new file mode 120000 index 0000000000..5328732565 --- /dev/null +++ b/Lang/Sidef/Extreme-floating-point-values @@ -0,0 +1 @@ +../../Task/Extreme-floating-point-values/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Factorial b/Lang/Sidef/Factorial new file mode 120000 index 0000000000..5359606c74 --- /dev/null +++ b/Lang/Sidef/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Factors-of-a-Mersenne-number b/Lang/Sidef/Factors-of-a-Mersenne-number new file mode 120000 index 0000000000..de1c2b6803 --- /dev/null +++ b/Lang/Sidef/Factors-of-a-Mersenne-number @@ -0,0 +1 @@ +../../Task/Factors-of-a-Mersenne-number/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Factors-of-an-integer b/Lang/Sidef/Factors-of-an-integer new file mode 120000 index 0000000000..53c1233765 --- /dev/null +++ b/Lang/Sidef/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Fast-Fourier-transform b/Lang/Sidef/Fast-Fourier-transform new file mode 120000 index 0000000000..68d0354dae --- /dev/null +++ b/Lang/Sidef/Fast-Fourier-transform @@ -0,0 +1 @@ +../../Task/Fast-Fourier-transform/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Fibonacci-n-step-number-sequences b/Lang/Sidef/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..34d44e199c --- /dev/null +++ b/Lang/Sidef/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Fibonacci-sequence b/Lang/Sidef/Fibonacci-sequence new file mode 120000 index 0000000000..4abccb1cfa --- /dev/null +++ b/Lang/Sidef/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Fibonacci-word b/Lang/Sidef/Fibonacci-word new file mode 120000 index 0000000000..b34827d478 --- /dev/null +++ b/Lang/Sidef/Fibonacci-word @@ -0,0 +1 @@ +../../Task/Fibonacci-word/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Fibonacci-word-fractal b/Lang/Sidef/Fibonacci-word-fractal new file mode 120000 index 0000000000..da0c686284 --- /dev/null +++ b/Lang/Sidef/Fibonacci-word-fractal @@ -0,0 +1 @@ +../../Task/Fibonacci-word-fractal/Sidef \ No newline at end of file diff --git a/Lang/Sidef/File-input-output b/Lang/Sidef/File-input-output new file mode 120000 index 0000000000..98e251eed3 --- /dev/null +++ b/Lang/Sidef/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/Sidef \ No newline at end of file diff --git a/Lang/Sidef/File-modification-time b/Lang/Sidef/File-modification-time new file mode 120000 index 0000000000..9158f7164f --- /dev/null +++ b/Lang/Sidef/File-modification-time @@ -0,0 +1 @@ +../../Task/File-modification-time/Sidef \ No newline at end of file diff --git a/Lang/Sidef/File-size b/Lang/Sidef/File-size new file mode 120000 index 0000000000..b2da505219 --- /dev/null +++ b/Lang/Sidef/File-size @@ -0,0 +1 @@ +../../Task/File-size/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Filter b/Lang/Sidef/Filter new file mode 120000 index 0000000000..27517ab7c7 --- /dev/null +++ b/Lang/Sidef/Filter @@ -0,0 +1 @@ +../../Task/Filter/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Find-common-directory-path b/Lang/Sidef/Find-common-directory-path new file mode 120000 index 0000000000..4aca5ab226 --- /dev/null +++ b/Lang/Sidef/Find-common-directory-path @@ -0,0 +1 @@ +../../Task/Find-common-directory-path/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Find-largest-left-truncatable-prime-in-a-given-base b/Lang/Sidef/Find-largest-left-truncatable-prime-in-a-given-base new file mode 120000 index 0000000000..f174f570f8 --- /dev/null +++ b/Lang/Sidef/Find-largest-left-truncatable-prime-in-a-given-base @@ -0,0 +1 @@ +../../Task/Find-largest-left-truncatable-prime-in-a-given-base/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Find-limit-of-recursion b/Lang/Sidef/Find-limit-of-recursion new file mode 120000 index 0000000000..6731605666 --- /dev/null +++ b/Lang/Sidef/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Find-the-last-Sunday-of-each-month b/Lang/Sidef/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..8be56f1230 --- /dev/null +++ b/Lang/Sidef/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Find-the-missing-permutation b/Lang/Sidef/Find-the-missing-permutation new file mode 120000 index 0000000000..8d674ae31f --- /dev/null +++ b/Lang/Sidef/Find-the-missing-permutation @@ -0,0 +1 @@ +../../Task/Find-the-missing-permutation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/First-class-environments b/Lang/Sidef/First-class-environments new file mode 120000 index 0000000000..f6d95b2586 --- /dev/null +++ b/Lang/Sidef/First-class-environments @@ -0,0 +1 @@ +../../Task/First-class-environments/Sidef \ No newline at end of file diff --git a/Lang/Sidef/First-class-functions b/Lang/Sidef/First-class-functions new file mode 120000 index 0000000000..3ecee717cc --- /dev/null +++ b/Lang/Sidef/First-class-functions @@ -0,0 +1 @@ +../../Task/First-class-functions/Sidef \ No newline at end of file diff --git a/Lang/Sidef/First-class-functions-Use-numbers-analogously b/Lang/Sidef/First-class-functions-Use-numbers-analogously new file mode 120000 index 0000000000..73113de730 --- /dev/null +++ b/Lang/Sidef/First-class-functions-Use-numbers-analogously @@ -0,0 +1 @@ +../../Task/First-class-functions-Use-numbers-analogously/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Five-weekends b/Lang/Sidef/Five-weekends new file mode 120000 index 0000000000..863b07ed73 --- /dev/null +++ b/Lang/Sidef/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/Sidef \ No newline at end of file diff --git a/Lang/Sidef/FizzBuzz b/Lang/Sidef/FizzBuzz new file mode 120000 index 0000000000..85de05a83f --- /dev/null +++ b/Lang/Sidef/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Flatten-a-list b/Lang/Sidef/Flatten-a-list new file mode 120000 index 0000000000..e181b993a6 --- /dev/null +++ b/Lang/Sidef/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Floyds-triangle b/Lang/Sidef/Floyds-triangle new file mode 120000 index 0000000000..6cea5dbafc --- /dev/null +++ b/Lang/Sidef/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Forest-fire b/Lang/Sidef/Forest-fire new file mode 120000 index 0000000000..e2e2a2ba57 --- /dev/null +++ b/Lang/Sidef/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Fork b/Lang/Sidef/Fork new file mode 120000 index 0000000000..bb2c4dae19 --- /dev/null +++ b/Lang/Sidef/Fork @@ -0,0 +1 @@ +../../Task/Fork/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Formatted-numeric-output b/Lang/Sidef/Formatted-numeric-output new file mode 120000 index 0000000000..75865d7664 --- /dev/null +++ b/Lang/Sidef/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Forward-difference b/Lang/Sidef/Forward-difference new file mode 120000 index 0000000000..5c9538611b --- /dev/null +++ b/Lang/Sidef/Forward-difference @@ -0,0 +1 @@ +../../Task/Forward-difference/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Four-bit-adder b/Lang/Sidef/Four-bit-adder new file mode 120000 index 0000000000..4e2b43360e --- /dev/null +++ b/Lang/Sidef/Four-bit-adder @@ -0,0 +1 @@ +../../Task/Four-bit-adder/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Fractal-tree b/Lang/Sidef/Fractal-tree new file mode 120000 index 0000000000..4ef202eb10 --- /dev/null +++ b/Lang/Sidef/Fractal-tree @@ -0,0 +1 @@ +../../Task/Fractal-tree/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Fractran b/Lang/Sidef/Fractran new file mode 120000 index 0000000000..b07fe5e320 --- /dev/null +++ b/Lang/Sidef/Fractran @@ -0,0 +1 @@ +../../Task/Fractran/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Function-composition b/Lang/Sidef/Function-composition new file mode 120000 index 0000000000..1d73a95bf3 --- /dev/null +++ b/Lang/Sidef/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Function-definition b/Lang/Sidef/Function-definition new file mode 120000 index 0000000000..19850c326b --- /dev/null +++ b/Lang/Sidef/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Function-frequency b/Lang/Sidef/Function-frequency new file mode 120000 index 0000000000..d98f265aeb --- /dev/null +++ b/Lang/Sidef/Function-frequency @@ -0,0 +1 @@ +../../Task/Function-frequency/Sidef \ No newline at end of file diff --git a/Lang/Sidef/GUI-Maximum-window-dimensions b/Lang/Sidef/GUI-Maximum-window-dimensions new file mode 120000 index 0000000000..55d3db5ed0 --- /dev/null +++ b/Lang/Sidef/GUI-Maximum-window-dimensions @@ -0,0 +1 @@ +../../Task/GUI-Maximum-window-dimensions/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Gamma-function b/Lang/Sidef/Gamma-function new file mode 120000 index 0000000000..e334af81b7 --- /dev/null +++ b/Lang/Sidef/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Gaussian-elimination b/Lang/Sidef/Gaussian-elimination new file mode 120000 index 0000000000..0dba9b42f9 --- /dev/null +++ b/Lang/Sidef/Gaussian-elimination @@ -0,0 +1 @@ +../../Task/Gaussian-elimination/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Generate-lower-case-ASCII-alphabet b/Lang/Sidef/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..6105403724 --- /dev/null +++ b/Lang/Sidef/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Generator-Exponential b/Lang/Sidef/Generator-Exponential new file mode 120000 index 0000000000..3b1968536f --- /dev/null +++ b/Lang/Sidef/Generator-Exponential @@ -0,0 +1 @@ +../../Task/Generator-Exponential/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Generic-swap b/Lang/Sidef/Generic-swap new file mode 120000 index 0000000000..ef1384cff2 --- /dev/null +++ b/Lang/Sidef/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Globally-replace-text-in-several-files b/Lang/Sidef/Globally-replace-text-in-several-files new file mode 120000 index 0000000000..7261999864 --- /dev/null +++ b/Lang/Sidef/Globally-replace-text-in-several-files @@ -0,0 +1 @@ +../../Task/Globally-replace-text-in-several-files/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Gray-code b/Lang/Sidef/Gray-code new file mode 120000 index 0000000000..e57d617f51 --- /dev/null +++ b/Lang/Sidef/Gray-code @@ -0,0 +1 @@ +../../Task/Gray-code/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Grayscale-image b/Lang/Sidef/Grayscale-image new file mode 120000 index 0000000000..05c6c636ae --- /dev/null +++ b/Lang/Sidef/Grayscale-image @@ -0,0 +1 @@ +../../Task/Grayscale-image/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Greatest-common-divisor b/Lang/Sidef/Greatest-common-divisor new file mode 120000 index 0000000000..c644c4cd27 --- /dev/null +++ b/Lang/Sidef/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Greatest-element-of-a-list b/Lang/Sidef/Greatest-element-of-a-list new file mode 120000 index 0000000000..1eca1203e6 --- /dev/null +++ b/Lang/Sidef/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Greatest-subsequential-sum b/Lang/Sidef/Greatest-subsequential-sum new file mode 120000 index 0000000000..1587bf0c7e --- /dev/null +++ b/Lang/Sidef/Greatest-subsequential-sum @@ -0,0 +1 @@ +../../Task/Greatest-subsequential-sum/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Guess-the-number b/Lang/Sidef/Guess-the-number new file mode 120000 index 0000000000..2f4e961b76 --- /dev/null +++ b/Lang/Sidef/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Guess-the-number-With-feedback b/Lang/Sidef/Guess-the-number-With-feedback new file mode 120000 index 0000000000..b9b8fd55b7 --- /dev/null +++ b/Lang/Sidef/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Guess-the-number-With-feedback--player- b/Lang/Sidef/Guess-the-number-With-feedback--player- new file mode 120000 index 0000000000..ebe48fe6be --- /dev/null +++ b/Lang/Sidef/Guess-the-number-With-feedback--player- @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback--player-/Sidef \ No newline at end of file diff --git a/Lang/Sidef/HTTP b/Lang/Sidef/HTTP new file mode 120000 index 0000000000..1d5e817673 --- /dev/null +++ b/Lang/Sidef/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/Sidef \ No newline at end of file diff --git a/Lang/Sidef/HTTPS b/Lang/Sidef/HTTPS new file mode 120000 index 0000000000..4e0d5946c3 --- /dev/null +++ b/Lang/Sidef/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/Sidef \ No newline at end of file diff --git a/Lang/Sidef/HTTPS-Authenticated b/Lang/Sidef/HTTPS-Authenticated new file mode 120000 index 0000000000..4726f56241 --- /dev/null +++ b/Lang/Sidef/HTTPS-Authenticated @@ -0,0 +1 @@ +../../Task/HTTPS-Authenticated/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hailstone-sequence b/Lang/Sidef/Hailstone-sequence new file mode 120000 index 0000000000..b8958b1cf0 --- /dev/null +++ b/Lang/Sidef/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hamming-numbers b/Lang/Sidef/Hamming-numbers new file mode 120000 index 0000000000..d28436a758 --- /dev/null +++ b/Lang/Sidef/Hamming-numbers @@ -0,0 +1 @@ +../../Task/Hamming-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Handle-a-signal b/Lang/Sidef/Handle-a-signal new file mode 120000 index 0000000000..340bd599ec --- /dev/null +++ b/Lang/Sidef/Handle-a-signal @@ -0,0 +1 @@ +../../Task/Handle-a-signal/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Happy-numbers b/Lang/Sidef/Happy-numbers new file mode 120000 index 0000000000..ca8b41062f --- /dev/null +++ b/Lang/Sidef/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Harshad-or-Niven-series b/Lang/Sidef/Harshad-or-Niven-series new file mode 120000 index 0000000000..9799891582 --- /dev/null +++ b/Lang/Sidef/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hash-from-two-arrays b/Lang/Sidef/Hash-from-two-arrays new file mode 120000 index 0000000000..c095c3a3b9 --- /dev/null +++ b/Lang/Sidef/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hash-join b/Lang/Sidef/Hash-join new file mode 120000 index 0000000000..049d4cfdc4 --- /dev/null +++ b/Lang/Sidef/Hash-join @@ -0,0 +1 @@ +../../Task/Hash-join/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Haversine-formula b/Lang/Sidef/Haversine-formula new file mode 120000 index 0000000000..b174b4390d --- /dev/null +++ b/Lang/Sidef/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hello-world-Graphical b/Lang/Sidef/Hello-world-Graphical new file mode 120000 index 0000000000..948e9410b2 --- /dev/null +++ b/Lang/Sidef/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hello-world-Line-printer b/Lang/Sidef/Hello-world-Line-printer new file mode 120000 index 0000000000..fecdd661da --- /dev/null +++ b/Lang/Sidef/Hello-world-Line-printer @@ -0,0 +1 @@ +../../Task/Hello-world-Line-printer/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hello-world-Newline-omission b/Lang/Sidef/Hello-world-Newline-omission new file mode 120000 index 0000000000..4a6e94aa63 --- /dev/null +++ b/Lang/Sidef/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hello-world-Standard-error b/Lang/Sidef/Hello-world-Standard-error new file mode 120000 index 0000000000..00d77c6883 --- /dev/null +++ b/Lang/Sidef/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hello-world-Text b/Lang/Sidef/Hello-world-Text new file mode 120000 index 0000000000..a7ebd3008f --- /dev/null +++ b/Lang/Sidef/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hello-world-Web-server b/Lang/Sidef/Hello-world-Web-server new file mode 120000 index 0000000000..0132eecd97 --- /dev/null +++ b/Lang/Sidef/Hello-world-Web-server @@ -0,0 +1 @@ +../../Task/Hello-world-Web-server/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Here-document b/Lang/Sidef/Here-document new file mode 120000 index 0000000000..f3661b575e --- /dev/null +++ b/Lang/Sidef/Here-document @@ -0,0 +1 @@ +../../Task/Here-document/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Heronian-triangles b/Lang/Sidef/Heronian-triangles new file mode 120000 index 0000000000..11dc7caa8d --- /dev/null +++ b/Lang/Sidef/Heronian-triangles @@ -0,0 +1 @@ +../../Task/Heronian-triangles/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hickerson-series-of-almost-integers b/Lang/Sidef/Hickerson-series-of-almost-integers new file mode 120000 index 0000000000..e04e286674 --- /dev/null +++ b/Lang/Sidef/Hickerson-series-of-almost-integers @@ -0,0 +1 @@ +../../Task/Hickerson-series-of-almost-integers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Higher-order-functions b/Lang/Sidef/Higher-order-functions new file mode 120000 index 0000000000..413a343d3e --- /dev/null +++ b/Lang/Sidef/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/Sidef \ No newline at end of file diff --git a/Lang/Sidef/History-variables b/Lang/Sidef/History-variables new file mode 120000 index 0000000000..b60a383f0f --- /dev/null +++ b/Lang/Sidef/History-variables @@ -0,0 +1 @@ +../../Task/History-variables/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hofstadter-Conway-$10,000-sequence b/Lang/Sidef/Hofstadter-Conway-$10,000-sequence new file mode 120000 index 0000000000..e948b62603 --- /dev/null +++ b/Lang/Sidef/Hofstadter-Conway-$10,000-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Conway-$10,000-sequence/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hofstadter-Figure-Figure-sequences b/Lang/Sidef/Hofstadter-Figure-Figure-sequences new file mode 120000 index 0000000000..625b9aa441 --- /dev/null +++ b/Lang/Sidef/Hofstadter-Figure-Figure-sequences @@ -0,0 +1 @@ +../../Task/Hofstadter-Figure-Figure-sequences/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hofstadter-Q-sequence b/Lang/Sidef/Hofstadter-Q-sequence new file mode 120000 index 0000000000..cf6fe1414c --- /dev/null +++ b/Lang/Sidef/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Holidays-related-to-Easter b/Lang/Sidef/Holidays-related-to-Easter new file mode 120000 index 0000000000..627e59ff49 --- /dev/null +++ b/Lang/Sidef/Holidays-related-to-Easter @@ -0,0 +1 @@ +../../Task/Holidays-related-to-Easter/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Honeycombs b/Lang/Sidef/Honeycombs new file mode 120000 index 0000000000..6a3f74a4a1 --- /dev/null +++ b/Lang/Sidef/Honeycombs @@ -0,0 +1 @@ +../../Task/Honeycombs/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Horizontal-sundial-calculations b/Lang/Sidef/Horizontal-sundial-calculations new file mode 120000 index 0000000000..e195225ff3 --- /dev/null +++ b/Lang/Sidef/Horizontal-sundial-calculations @@ -0,0 +1 @@ +../../Task/Horizontal-sundial-calculations/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Horners-rule-for-polynomial-evaluation b/Lang/Sidef/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..ad9e308ea9 --- /dev/null +++ b/Lang/Sidef/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hostname b/Lang/Sidef/Hostname new file mode 120000 index 0000000000..dc9c51e7c2 --- /dev/null +++ b/Lang/Sidef/Hostname @@ -0,0 +1 @@ +../../Task/Hostname/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Hough-transform b/Lang/Sidef/Hough-transform new file mode 120000 index 0000000000..abb5ee3859 --- /dev/null +++ b/Lang/Sidef/Hough-transform @@ -0,0 +1 @@ +../../Task/Hough-transform/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Huffman-coding b/Lang/Sidef/Huffman-coding new file mode 120000 index 0000000000..2689c0f49a --- /dev/null +++ b/Lang/Sidef/Huffman-coding @@ -0,0 +1 @@ +../../Task/Huffman-coding/Sidef \ No newline at end of file diff --git a/Lang/Sidef/IBAN b/Lang/Sidef/IBAN new file mode 120000 index 0000000000..8033c433a8 --- /dev/null +++ b/Lang/Sidef/IBAN @@ -0,0 +1 @@ +../../Task/IBAN/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Identity-matrix b/Lang/Sidef/Identity-matrix new file mode 120000 index 0000000000..84ab866ed4 --- /dev/null +++ b/Lang/Sidef/Identity-matrix @@ -0,0 +1 @@ +../../Task/Identity-matrix/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Include-a-file b/Lang/Sidef/Include-a-file new file mode 120000 index 0000000000..aaa85b3335 --- /dev/null +++ b/Lang/Sidef/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Increment-a-numerical-string b/Lang/Sidef/Increment-a-numerical-string new file mode 120000 index 0000000000..3ed683381a --- /dev/null +++ b/Lang/Sidef/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Infinity b/Lang/Sidef/Infinity new file mode 120000 index 0000000000..e22ddd1020 --- /dev/null +++ b/Lang/Sidef/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Inheritance-Multiple b/Lang/Sidef/Inheritance-Multiple new file mode 120000 index 0000000000..6d8ce5b07b --- /dev/null +++ b/Lang/Sidef/Inheritance-Multiple @@ -0,0 +1 @@ +../../Task/Inheritance-Multiple/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Inheritance-Single b/Lang/Sidef/Inheritance-Single new file mode 120000 index 0000000000..8b7f8d2188 --- /dev/null +++ b/Lang/Sidef/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Input-loop b/Lang/Sidef/Input-loop new file mode 120000 index 0000000000..802832cc3e --- /dev/null +++ b/Lang/Sidef/Input-loop @@ -0,0 +1 @@ +../../Task/Input-loop/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Integer-comparison b/Lang/Sidef/Integer-comparison new file mode 120000 index 0000000000..90a18489ed --- /dev/null +++ b/Lang/Sidef/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Integer-overflow b/Lang/Sidef/Integer-overflow new file mode 120000 index 0000000000..e142fea97c --- /dev/null +++ b/Lang/Sidef/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Integer-sequence b/Lang/Sidef/Integer-sequence new file mode 120000 index 0000000000..d2de00c748 --- /dev/null +++ b/Lang/Sidef/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Interactive-programming b/Lang/Sidef/Interactive-programming new file mode 120000 index 0000000000..2397062b83 --- /dev/null +++ b/Lang/Sidef/Interactive-programming @@ -0,0 +1 @@ +../../Task/Interactive-programming/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Inverted-syntax b/Lang/Sidef/Inverted-syntax new file mode 120000 index 0000000000..37aaffca88 --- /dev/null +++ b/Lang/Sidef/Inverted-syntax @@ -0,0 +1 @@ +../../Task/Inverted-syntax/Sidef \ No newline at end of file diff --git a/Lang/Sidef/JSON b/Lang/Sidef/JSON new file mode 120000 index 0000000000..62158f3f49 --- /dev/null +++ b/Lang/Sidef/JSON @@ -0,0 +1 @@ +../../Task/JSON/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Jensens-Device b/Lang/Sidef/Jensens-Device new file mode 120000 index 0000000000..7d4b2871cd --- /dev/null +++ b/Lang/Sidef/Jensens-Device @@ -0,0 +1 @@ +../../Task/Jensens-Device/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Josephus-problem b/Lang/Sidef/Josephus-problem new file mode 120000 index 0000000000..3111569fe3 --- /dev/null +++ b/Lang/Sidef/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/Sidef \ No newline at end of file diff --git a/Lang/Sidef/K-d-tree b/Lang/Sidef/K-d-tree new file mode 120000 index 0000000000..1a2ae497b1 --- /dev/null +++ b/Lang/Sidef/K-d-tree @@ -0,0 +1 @@ +../../Task/K-d-tree/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Kaprekar-numbers b/Lang/Sidef/Kaprekar-numbers new file mode 120000 index 0000000000..ea1434836f --- /dev/null +++ b/Lang/Sidef/Kaprekar-numbers @@ -0,0 +1 @@ +../../Task/Kaprekar-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Keyboard-input-Flush-the-keyboard-buffer b/Lang/Sidef/Keyboard-input-Flush-the-keyboard-buffer new file mode 120000 index 0000000000..ba8890d116 --- /dev/null +++ b/Lang/Sidef/Keyboard-input-Flush-the-keyboard-buffer @@ -0,0 +1 @@ +../../Task/Keyboard-input-Flush-the-keyboard-buffer/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/Sidef/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..4d2204d315 --- /dev/null +++ b/Lang/Sidef/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Knapsack-problem-0-1 b/Lang/Sidef/Knapsack-problem-0-1 new file mode 120000 index 0000000000..fb83f2a2c7 --- /dev/null +++ b/Lang/Sidef/Knapsack-problem-0-1 @@ -0,0 +1 @@ +../../Task/Knapsack-problem-0-1/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Knapsack-problem-Bounded b/Lang/Sidef/Knapsack-problem-Bounded new file mode 120000 index 0000000000..941124a568 --- /dev/null +++ b/Lang/Sidef/Knapsack-problem-Bounded @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Bounded/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Knapsack-problem-Continuous b/Lang/Sidef/Knapsack-problem-Continuous new file mode 120000 index 0000000000..5ebcc738be --- /dev/null +++ b/Lang/Sidef/Knapsack-problem-Continuous @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Continuous/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Knapsack-problem-Unbounded b/Lang/Sidef/Knapsack-problem-Unbounded new file mode 120000 index 0000000000..6fea980dd7 --- /dev/null +++ b/Lang/Sidef/Knapsack-problem-Unbounded @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Unbounded/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Knights-tour b/Lang/Sidef/Knights-tour new file mode 120000 index 0000000000..4b6e4c153f --- /dev/null +++ b/Lang/Sidef/Knights-tour @@ -0,0 +1 @@ +../../Task/Knights-tour/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Knuth-shuffle b/Lang/Sidef/Knuth-shuffle new file mode 120000 index 0000000000..1b6251bc43 --- /dev/null +++ b/Lang/Sidef/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Knuths-algorithm-S b/Lang/Sidef/Knuths-algorithm-S new file mode 120000 index 0000000000..f4f7a1beb4 --- /dev/null +++ b/Lang/Sidef/Knuths-algorithm-S @@ -0,0 +1 @@ +../../Task/Knuths-algorithm-S/Sidef \ No newline at end of file diff --git a/Lang/Sidef/LU-decomposition b/Lang/Sidef/LU-decomposition new file mode 120000 index 0000000000..1b777652f9 --- /dev/null +++ b/Lang/Sidef/LU-decomposition @@ -0,0 +1 @@ +../../Task/LU-decomposition/Sidef \ No newline at end of file diff --git a/Lang/Sidef/LZW-compression b/Lang/Sidef/LZW-compression new file mode 120000 index 0000000000..64fd966d64 --- /dev/null +++ b/Lang/Sidef/LZW-compression @@ -0,0 +1 @@ +../../Task/LZW-compression/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Langtons-ant b/Lang/Sidef/Langtons-ant new file mode 120000 index 0000000000..e6814f816c --- /dev/null +++ b/Lang/Sidef/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Largest-int-from-concatenated-ints b/Lang/Sidef/Largest-int-from-concatenated-ints new file mode 120000 index 0000000000..b5dc3e78ef --- /dev/null +++ b/Lang/Sidef/Largest-int-from-concatenated-ints @@ -0,0 +1 @@ +../../Task/Largest-int-from-concatenated-ints/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Last-Friday-of-each-month b/Lang/Sidef/Last-Friday-of-each-month new file mode 120000 index 0000000000..c5c68d86cc --- /dev/null +++ b/Lang/Sidef/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Leap-year b/Lang/Sidef/Leap-year new file mode 120000 index 0000000000..b531dd39f3 --- /dev/null +++ b/Lang/Sidef/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Least-common-multiple b/Lang/Sidef/Least-common-multiple new file mode 120000 index 0000000000..5a1377bac0 --- /dev/null +++ b/Lang/Sidef/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Left-factorials b/Lang/Sidef/Left-factorials new file mode 120000 index 0000000000..c54bcb74e0 --- /dev/null +++ b/Lang/Sidef/Left-factorials @@ -0,0 +1 @@ +../../Task/Left-factorials/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Letter-frequency b/Lang/Sidef/Letter-frequency new file mode 120000 index 0000000000..01f2d18663 --- /dev/null +++ b/Lang/Sidef/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Levenshtein-distance b/Lang/Sidef/Levenshtein-distance new file mode 120000 index 0000000000..e245210415 --- /dev/null +++ b/Lang/Sidef/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Linear-congruential-generator b/Lang/Sidef/Linear-congruential-generator new file mode 120000 index 0000000000..23c8d7370d --- /dev/null +++ b/Lang/Sidef/Linear-congruential-generator @@ -0,0 +1 @@ +../../Task/Linear-congruential-generator/Sidef \ No newline at end of file diff --git a/Lang/Sidef/List-comprehensions b/Lang/Sidef/List-comprehensions new file mode 120000 index 0000000000..2ccf061d41 --- /dev/null +++ b/Lang/Sidef/List-comprehensions @@ -0,0 +1 @@ +../../Task/List-comprehensions/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Literals-Floating-point b/Lang/Sidef/Literals-Floating-point new file mode 120000 index 0000000000..8f1cfcfc18 --- /dev/null +++ b/Lang/Sidef/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Literals-Integer b/Lang/Sidef/Literals-Integer new file mode 120000 index 0000000000..70f9ee87c7 --- /dev/null +++ b/Lang/Sidef/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Literals-String b/Lang/Sidef/Literals-String new file mode 120000 index 0000000000..84cf5935cf --- /dev/null +++ b/Lang/Sidef/Literals-String @@ -0,0 +1 @@ +../../Task/Literals-String/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Logical-operations b/Lang/Sidef/Logical-operations new file mode 120000 index 0000000000..dd10ed087c --- /dev/null +++ b/Lang/Sidef/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Long-multiplication b/Lang/Sidef/Long-multiplication new file mode 120000 index 0000000000..76896763e7 --- /dev/null +++ b/Lang/Sidef/Long-multiplication @@ -0,0 +1 @@ +../../Task/Long-multiplication/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Longest-common-subsequence b/Lang/Sidef/Longest-common-subsequence new file mode 120000 index 0000000000..40926c45b9 --- /dev/null +++ b/Lang/Sidef/Longest-common-subsequence @@ -0,0 +1 @@ +../../Task/Longest-common-subsequence/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Longest-increasing-subsequence b/Lang/Sidef/Longest-increasing-subsequence new file mode 120000 index 0000000000..5f479f4f66 --- /dev/null +++ b/Lang/Sidef/Longest-increasing-subsequence @@ -0,0 +1 @@ +../../Task/Longest-increasing-subsequence/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Longest-string-challenge b/Lang/Sidef/Longest-string-challenge new file mode 120000 index 0000000000..3f15e8302f --- /dev/null +++ b/Lang/Sidef/Longest-string-challenge @@ -0,0 +1 @@ +../../Task/Longest-string-challenge/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Look-and-say-sequence b/Lang/Sidef/Look-and-say-sequence new file mode 120000 index 0000000000..08f4d2d4c7 --- /dev/null +++ b/Lang/Sidef/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Loop-over-multiple-arrays-simultaneously b/Lang/Sidef/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..3cc4a9bb2c --- /dev/null +++ b/Lang/Sidef/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Loops-Break b/Lang/Sidef/Loops-Break new file mode 120000 index 0000000000..c24e93ec8e --- /dev/null +++ b/Lang/Sidef/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Loops-Continue b/Lang/Sidef/Loops-Continue new file mode 120000 index 0000000000..09373db86d --- /dev/null +++ b/Lang/Sidef/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Loops-Do-while b/Lang/Sidef/Loops-Do-while new file mode 120000 index 0000000000..1aef52892e --- /dev/null +++ b/Lang/Sidef/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Loops-Downward-for b/Lang/Sidef/Loops-Downward-for new file mode 120000 index 0000000000..3cc40e0e1f --- /dev/null +++ b/Lang/Sidef/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Loops-For b/Lang/Sidef/Loops-For new file mode 120000 index 0000000000..81e33655fa --- /dev/null +++ b/Lang/Sidef/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Loops-For-with-a-specified-step b/Lang/Sidef/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..abd26df172 --- /dev/null +++ b/Lang/Sidef/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Loops-Foreach b/Lang/Sidef/Loops-Foreach new file mode 120000 index 0000000000..5c6b208f37 --- /dev/null +++ b/Lang/Sidef/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Loops-Infinite b/Lang/Sidef/Loops-Infinite new file mode 120000 index 0000000000..7de9d9e83a --- /dev/null +++ b/Lang/Sidef/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Loops-N-plus-one-half b/Lang/Sidef/Loops-N-plus-one-half new file mode 120000 index 0000000000..f71edbc94d --- /dev/null +++ b/Lang/Sidef/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Loops-Nested b/Lang/Sidef/Loops-Nested new file mode 120000 index 0000000000..a6dfe7d3e6 --- /dev/null +++ b/Lang/Sidef/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Loops-While b/Lang/Sidef/Loops-While new file mode 120000 index 0000000000..dbf4b917f9 --- /dev/null +++ b/Lang/Sidef/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Lucas-Lehmer-test b/Lang/Sidef/Lucas-Lehmer-test new file mode 120000 index 0000000000..342501b52c --- /dev/null +++ b/Lang/Sidef/Lucas-Lehmer-test @@ -0,0 +1 @@ +../../Task/Lucas-Lehmer-test/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Ludic-numbers b/Lang/Sidef/Ludic-numbers new file mode 120000 index 0000000000..f7c9c0b7d6 --- /dev/null +++ b/Lang/Sidef/Ludic-numbers @@ -0,0 +1 @@ +../../Task/Ludic-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Luhn-test-of-credit-card-numbers b/Lang/Sidef/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..3c5eec825f --- /dev/null +++ b/Lang/Sidef/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/MD4 b/Lang/Sidef/MD4 new file mode 120000 index 0000000000..f69de2b546 --- /dev/null +++ b/Lang/Sidef/MD4 @@ -0,0 +1 @@ +../../Task/MD4/Sidef \ No newline at end of file diff --git a/Lang/Sidef/MD5 b/Lang/Sidef/MD5 new file mode 120000 index 0000000000..abd1d41f94 --- /dev/null +++ b/Lang/Sidef/MD5 @@ -0,0 +1 @@ +../../Task/MD5/Sidef \ No newline at end of file diff --git a/Lang/Sidef/MD5-Implementation b/Lang/Sidef/MD5-Implementation new file mode 120000 index 0000000000..3274c859f7 --- /dev/null +++ b/Lang/Sidef/MD5-Implementation @@ -0,0 +1 @@ +../../Task/MD5-Implementation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Mad-Libs b/Lang/Sidef/Mad-Libs new file mode 120000 index 0000000000..ff6610eef8 --- /dev/null +++ b/Lang/Sidef/Mad-Libs @@ -0,0 +1 @@ +../../Task/Mad-Libs/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Magic-squares-of-odd-order b/Lang/Sidef/Magic-squares-of-odd-order new file mode 120000 index 0000000000..860a00f4f9 --- /dev/null +++ b/Lang/Sidef/Magic-squares-of-odd-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-odd-order/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Make-directory-path b/Lang/Sidef/Make-directory-path new file mode 120000 index 0000000000..3102df7791 --- /dev/null +++ b/Lang/Sidef/Make-directory-path @@ -0,0 +1 @@ +../../Task/Make-directory-path/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Man-or-boy-test b/Lang/Sidef/Man-or-boy-test new file mode 120000 index 0000000000..afb505478b --- /dev/null +++ b/Lang/Sidef/Man-or-boy-test @@ -0,0 +1 @@ +../../Task/Man-or-boy-test/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Mandelbrot-set b/Lang/Sidef/Mandelbrot-set new file mode 120000 index 0000000000..a9dbb04ad2 --- /dev/null +++ b/Lang/Sidef/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Map-range b/Lang/Sidef/Map-range new file mode 120000 index 0000000000..406a8dd5ee --- /dev/null +++ b/Lang/Sidef/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Matrix-multiplication b/Lang/Sidef/Matrix-multiplication new file mode 120000 index 0000000000..c1557b0f21 --- /dev/null +++ b/Lang/Sidef/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Matrix-transposition b/Lang/Sidef/Matrix-transposition new file mode 120000 index 0000000000..e250e3daf1 --- /dev/null +++ b/Lang/Sidef/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Maximum-triangle-path-sum b/Lang/Sidef/Maximum-triangle-path-sum new file mode 120000 index 0000000000..52466c453f --- /dev/null +++ b/Lang/Sidef/Maximum-triangle-path-sum @@ -0,0 +1 @@ +../../Task/Maximum-triangle-path-sum/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Maze-generation b/Lang/Sidef/Maze-generation new file mode 120000 index 0000000000..644365a57d --- /dev/null +++ b/Lang/Sidef/Maze-generation @@ -0,0 +1 @@ +../../Task/Maze-generation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Menu b/Lang/Sidef/Menu new file mode 120000 index 0000000000..0355a0ef99 --- /dev/null +++ b/Lang/Sidef/Menu @@ -0,0 +1 @@ +../../Task/Menu/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Metaprogramming b/Lang/Sidef/Metaprogramming new file mode 120000 index 0000000000..b109828f17 --- /dev/null +++ b/Lang/Sidef/Metaprogramming @@ -0,0 +1 @@ +../../Task/Metaprogramming/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Middle-three-digits b/Lang/Sidef/Middle-three-digits new file mode 120000 index 0000000000..767545156d --- /dev/null +++ b/Lang/Sidef/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Modular-exponentiation b/Lang/Sidef/Modular-exponentiation new file mode 120000 index 0000000000..c62f4b4e71 --- /dev/null +++ b/Lang/Sidef/Modular-exponentiation @@ -0,0 +1 @@ +../../Task/Modular-exponentiation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Modular-inverse b/Lang/Sidef/Modular-inverse new file mode 120000 index 0000000000..50d3be1645 --- /dev/null +++ b/Lang/Sidef/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Monty-Hall-problem b/Lang/Sidef/Monty-Hall-problem new file mode 120000 index 0000000000..9a7784c5b6 --- /dev/null +++ b/Lang/Sidef/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Move-to-front-algorithm b/Lang/Sidef/Move-to-front-algorithm new file mode 120000 index 0000000000..5d74f77349 --- /dev/null +++ b/Lang/Sidef/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Multifactorial b/Lang/Sidef/Multifactorial new file mode 120000 index 0000000000..19ffd655d9 --- /dev/null +++ b/Lang/Sidef/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Multiple-distinct-objects b/Lang/Sidef/Multiple-distinct-objects new file mode 120000 index 0000000000..5417d0e2de --- /dev/null +++ b/Lang/Sidef/Multiple-distinct-objects @@ -0,0 +1 @@ +../../Task/Multiple-distinct-objects/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Multiplication-tables b/Lang/Sidef/Multiplication-tables new file mode 120000 index 0000000000..722ccaf5c8 --- /dev/null +++ b/Lang/Sidef/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Multisplit b/Lang/Sidef/Multisplit new file mode 120000 index 0000000000..8b5a15d04e --- /dev/null +++ b/Lang/Sidef/Multisplit @@ -0,0 +1 @@ +../../Task/Multisplit/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Munching-squares b/Lang/Sidef/Munching-squares new file mode 120000 index 0000000000..56f122da14 --- /dev/null +++ b/Lang/Sidef/Munching-squares @@ -0,0 +1 @@ +../../Task/Munching-squares/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Mutual-recursion b/Lang/Sidef/Mutual-recursion new file mode 120000 index 0000000000..f014178a10 --- /dev/null +++ b/Lang/Sidef/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Named-parameters b/Lang/Sidef/Named-parameters new file mode 120000 index 0000000000..1c12675f57 --- /dev/null +++ b/Lang/Sidef/Named-parameters @@ -0,0 +1 @@ +../../Task/Named-parameters/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Narcissist b/Lang/Sidef/Narcissist new file mode 120000 index 0000000000..c831f1c512 --- /dev/null +++ b/Lang/Sidef/Narcissist @@ -0,0 +1 @@ +../../Task/Narcissist/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Narcissistic-decimal-number b/Lang/Sidef/Narcissistic-decimal-number new file mode 120000 index 0000000000..a6a53ff1c7 --- /dev/null +++ b/Lang/Sidef/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Natural-sorting b/Lang/Sidef/Natural-sorting new file mode 120000 index 0000000000..f476f47023 --- /dev/null +++ b/Lang/Sidef/Natural-sorting @@ -0,0 +1 @@ +../../Task/Natural-sorting/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Non-continuous-subsequences b/Lang/Sidef/Non-continuous-subsequences new file mode 120000 index 0000000000..7ec8767e0c --- /dev/null +++ b/Lang/Sidef/Non-continuous-subsequences @@ -0,0 +1 @@ +../../Task/Non-continuous-subsequences/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Non-decimal-radices-Convert b/Lang/Sidef/Non-decimal-radices-Convert new file mode 120000 index 0000000000..1affdd73f8 --- /dev/null +++ b/Lang/Sidef/Non-decimal-radices-Convert @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Convert/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Non-decimal-radices-Input b/Lang/Sidef/Non-decimal-radices-Input new file mode 120000 index 0000000000..f8bb29ebb8 --- /dev/null +++ b/Lang/Sidef/Non-decimal-radices-Input @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Input/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Non-decimal-radices-Output b/Lang/Sidef/Non-decimal-radices-Output new file mode 120000 index 0000000000..4069c5e62d --- /dev/null +++ b/Lang/Sidef/Non-decimal-radices-Output @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Output/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Nth b/Lang/Sidef/Nth new file mode 120000 index 0000000000..fb35d55fe7 --- /dev/null +++ b/Lang/Sidef/Nth @@ -0,0 +1 @@ +../../Task/Nth/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Nth-root b/Lang/Sidef/Nth-root new file mode 120000 index 0000000000..96c0c90522 --- /dev/null +++ b/Lang/Sidef/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Null-object b/Lang/Sidef/Null-object new file mode 120000 index 0000000000..3a357b4803 --- /dev/null +++ b/Lang/Sidef/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Number-names b/Lang/Sidef/Number-names new file mode 120000 index 0000000000..d54ab03d20 --- /dev/null +++ b/Lang/Sidef/Number-names @@ -0,0 +1 @@ +../../Task/Number-names/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Number-reversal-game b/Lang/Sidef/Number-reversal-game new file mode 120000 index 0000000000..50d23a950d --- /dev/null +++ b/Lang/Sidef/Number-reversal-game @@ -0,0 +1 @@ +../../Task/Number-reversal-game/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Numerical-integration b/Lang/Sidef/Numerical-integration new file mode 120000 index 0000000000..239fe59f1e --- /dev/null +++ b/Lang/Sidef/Numerical-integration @@ -0,0 +1 @@ +../../Task/Numerical-integration/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Numerical-integration-Gauss-Legendre-Quadrature b/Lang/Sidef/Numerical-integration-Gauss-Legendre-Quadrature new file mode 120000 index 0000000000..570b10aad0 --- /dev/null +++ b/Lang/Sidef/Numerical-integration-Gauss-Legendre-Quadrature @@ -0,0 +1 @@ +../../Task/Numerical-integration-Gauss-Legendre-Quadrature/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Odd-word-problem b/Lang/Sidef/Odd-word-problem new file mode 120000 index 0000000000..3cd503017f --- /dev/null +++ b/Lang/Sidef/Odd-word-problem @@ -0,0 +1 @@ +../../Task/Odd-word-problem/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Old-lady-swallowed-a-fly b/Lang/Sidef/Old-lady-swallowed-a-fly new file mode 120000 index 0000000000..2b678dadfb --- /dev/null +++ b/Lang/Sidef/Old-lady-swallowed-a-fly @@ -0,0 +1 @@ +../../Task/Old-lady-swallowed-a-fly/Sidef \ No newline at end of file diff --git a/Lang/Sidef/One-dimensional-cellular-automata b/Lang/Sidef/One-dimensional-cellular-automata new file mode 120000 index 0000000000..c1a272de7b --- /dev/null +++ b/Lang/Sidef/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/Sidef \ No newline at end of file diff --git a/Lang/Sidef/One-of-n-lines-in-a-file b/Lang/Sidef/One-of-n-lines-in-a-file new file mode 120000 index 0000000000..18f995f557 --- /dev/null +++ b/Lang/Sidef/One-of-n-lines-in-a-file @@ -0,0 +1 @@ +../../Task/One-of-n-lines-in-a-file/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Operator-precedence b/Lang/Sidef/Operator-precedence new file mode 120000 index 0000000000..671331840c --- /dev/null +++ b/Lang/Sidef/Operator-precedence @@ -0,0 +1 @@ +../../Task/Operator-precedence/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Optional-parameters b/Lang/Sidef/Optional-parameters new file mode 120000 index 0000000000..5f16faa04e --- /dev/null +++ b/Lang/Sidef/Optional-parameters @@ -0,0 +1 @@ +../../Task/Optional-parameters/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Order-disjoint-list-items b/Lang/Sidef/Order-disjoint-list-items new file mode 120000 index 0000000000..d10e6eb7e2 --- /dev/null +++ b/Lang/Sidef/Order-disjoint-list-items @@ -0,0 +1 @@ +../../Task/Order-disjoint-list-items/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Order-two-numerical-lists b/Lang/Sidef/Order-two-numerical-lists new file mode 120000 index 0000000000..662ada8a9c --- /dev/null +++ b/Lang/Sidef/Order-two-numerical-lists @@ -0,0 +1 @@ +../../Task/Order-two-numerical-lists/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Ordered-Partitions b/Lang/Sidef/Ordered-Partitions new file mode 120000 index 0000000000..31f061e4fc --- /dev/null +++ b/Lang/Sidef/Ordered-Partitions @@ -0,0 +1 @@ +../../Task/Ordered-Partitions/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Ordered-words b/Lang/Sidef/Ordered-words new file mode 120000 index 0000000000..e7fc88c65f --- /dev/null +++ b/Lang/Sidef/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Palindrome-detection b/Lang/Sidef/Palindrome-detection new file mode 120000 index 0000000000..b500a5fc7b --- /dev/null +++ b/Lang/Sidef/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Pangram-checker b/Lang/Sidef/Pangram-checker new file mode 120000 index 0000000000..3a42f8755e --- /dev/null +++ b/Lang/Sidef/Pangram-checker @@ -0,0 +1 @@ +../../Task/Pangram-checker/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Parallel-calculations b/Lang/Sidef/Parallel-calculations new file mode 120000 index 0000000000..365d6324ae --- /dev/null +++ b/Lang/Sidef/Parallel-calculations @@ -0,0 +1 @@ +../../Task/Parallel-calculations/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Parsing-RPN-calculator-algorithm b/Lang/Sidef/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..4512ae8661 --- /dev/null +++ b/Lang/Sidef/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Parsing-RPN-to-infix-conversion b/Lang/Sidef/Parsing-RPN-to-infix-conversion new file mode 120000 index 0000000000..37ebe08fc6 --- /dev/null +++ b/Lang/Sidef/Parsing-RPN-to-infix-conversion @@ -0,0 +1 @@ +../../Task/Parsing-RPN-to-infix-conversion/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Parsing-Shunting-yard-algorithm b/Lang/Sidef/Parsing-Shunting-yard-algorithm new file mode 120000 index 0000000000..4a232f2eb2 --- /dev/null +++ b/Lang/Sidef/Parsing-Shunting-yard-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-Shunting-yard-algorithm/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Partial-function-application b/Lang/Sidef/Partial-function-application new file mode 120000 index 0000000000..317e1ec7cc --- /dev/null +++ b/Lang/Sidef/Partial-function-application @@ -0,0 +1 @@ +../../Task/Partial-function-application/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Pascals-triangle b/Lang/Sidef/Pascals-triangle new file mode 120000 index 0000000000..f6e5fdded9 --- /dev/null +++ b/Lang/Sidef/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Pascals-triangle-Puzzle b/Lang/Sidef/Pascals-triangle-Puzzle new file mode 120000 index 0000000000..740df8d338 --- /dev/null +++ b/Lang/Sidef/Pascals-triangle-Puzzle @@ -0,0 +1 @@ +../../Task/Pascals-triangle-Puzzle/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Percentage-difference-between-images b/Lang/Sidef/Percentage-difference-between-images new file mode 120000 index 0000000000..fc8a98936c --- /dev/null +++ b/Lang/Sidef/Percentage-difference-between-images @@ -0,0 +1 @@ +../../Task/Percentage-difference-between-images/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Percolation-Mean-run-density b/Lang/Sidef/Percolation-Mean-run-density new file mode 120000 index 0000000000..b8128032bd --- /dev/null +++ b/Lang/Sidef/Percolation-Mean-run-density @@ -0,0 +1 @@ +../../Task/Percolation-Mean-run-density/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Perfect-numbers b/Lang/Sidef/Perfect-numbers new file mode 120000 index 0000000000..2130b44bf5 --- /dev/null +++ b/Lang/Sidef/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Permutation-test b/Lang/Sidef/Permutation-test new file mode 120000 index 0000000000..8be03e0d31 --- /dev/null +++ b/Lang/Sidef/Permutation-test @@ -0,0 +1 @@ +../../Task/Permutation-test/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Permutations b/Lang/Sidef/Permutations new file mode 120000 index 0000000000..6aad2ab3ce --- /dev/null +++ b/Lang/Sidef/Permutations @@ -0,0 +1 @@ +../../Task/Permutations/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Permutations-by-swapping b/Lang/Sidef/Permutations-by-swapping new file mode 120000 index 0000000000..45381fd9b3 --- /dev/null +++ b/Lang/Sidef/Permutations-by-swapping @@ -0,0 +1 @@ +../../Task/Permutations-by-swapping/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Pernicious-numbers b/Lang/Sidef/Pernicious-numbers new file mode 120000 index 0000000000..65616fdc2c --- /dev/null +++ b/Lang/Sidef/Pernicious-numbers @@ -0,0 +1 @@ +../../Task/Pernicious-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Phrase-reversals b/Lang/Sidef/Phrase-reversals new file mode 120000 index 0000000000..3eb15464d9 --- /dev/null +++ b/Lang/Sidef/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Pi b/Lang/Sidef/Pi new file mode 120000 index 0000000000..2cd0cba45a --- /dev/null +++ b/Lang/Sidef/Pi @@ -0,0 +1 @@ +../../Task/Pi/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Pick-random-element b/Lang/Sidef/Pick-random-element new file mode 120000 index 0000000000..cc86ea71d7 --- /dev/null +++ b/Lang/Sidef/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Pig-the-dice-game-Player b/Lang/Sidef/Pig-the-dice-game-Player new file mode 120000 index 0000000000..c9bc9134a6 --- /dev/null +++ b/Lang/Sidef/Pig-the-dice-game-Player @@ -0,0 +1 @@ +../../Task/Pig-the-dice-game-Player/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Playing-cards b/Lang/Sidef/Playing-cards new file mode 120000 index 0000000000..8fdebcecea --- /dev/null +++ b/Lang/Sidef/Playing-cards @@ -0,0 +1 @@ +../../Task/Playing-cards/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Plot-coordinate-pairs b/Lang/Sidef/Plot-coordinate-pairs new file mode 120000 index 0000000000..83b102030c --- /dev/null +++ b/Lang/Sidef/Plot-coordinate-pairs @@ -0,0 +1 @@ +../../Task/Plot-coordinate-pairs/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Pointers-and-references b/Lang/Sidef/Pointers-and-references new file mode 120000 index 0000000000..44934b3501 --- /dev/null +++ b/Lang/Sidef/Pointers-and-references @@ -0,0 +1 @@ +../../Task/Pointers-and-references/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Polymorphic-copy b/Lang/Sidef/Polymorphic-copy new file mode 120000 index 0000000000..e82f0c11a9 --- /dev/null +++ b/Lang/Sidef/Polymorphic-copy @@ -0,0 +1 @@ +../../Task/Polymorphic-copy/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Polymorphism b/Lang/Sidef/Polymorphism new file mode 120000 index 0000000000..8c7825e67c --- /dev/null +++ b/Lang/Sidef/Polymorphism @@ -0,0 +1 @@ +../../Task/Polymorphism/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Polynomial-long-division b/Lang/Sidef/Polynomial-long-division new file mode 120000 index 0000000000..66bc934a92 --- /dev/null +++ b/Lang/Sidef/Polynomial-long-division @@ -0,0 +1 @@ +../../Task/Polynomial-long-division/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Polynomial-regression b/Lang/Sidef/Polynomial-regression new file mode 120000 index 0000000000..f71ce268df --- /dev/null +++ b/Lang/Sidef/Polynomial-regression @@ -0,0 +1 @@ +../../Task/Polynomial-regression/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Power-set b/Lang/Sidef/Power-set new file mode 120000 index 0000000000..23e3796735 --- /dev/null +++ b/Lang/Sidef/Power-set @@ -0,0 +1 @@ +../../Task/Power-set/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Price-fraction b/Lang/Sidef/Price-fraction new file mode 120000 index 0000000000..15ddc5d4d7 --- /dev/null +++ b/Lang/Sidef/Price-fraction @@ -0,0 +1 @@ +../../Task/Price-fraction/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Primality-by-trial-division b/Lang/Sidef/Primality-by-trial-division new file mode 120000 index 0000000000..2a61f357b4 --- /dev/null +++ b/Lang/Sidef/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Prime-decomposition b/Lang/Sidef/Prime-decomposition new file mode 120000 index 0000000000..be447d9d62 --- /dev/null +++ b/Lang/Sidef/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Priority-queue b/Lang/Sidef/Priority-queue new file mode 120000 index 0000000000..8445c98480 --- /dev/null +++ b/Lang/Sidef/Priority-queue @@ -0,0 +1 @@ +../../Task/Priority-queue/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Probabilistic-choice b/Lang/Sidef/Probabilistic-choice new file mode 120000 index 0000000000..2e8a4181c6 --- /dev/null +++ b/Lang/Sidef/Probabilistic-choice @@ -0,0 +1 @@ +../../Task/Probabilistic-choice/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Problem-of-Apollonius b/Lang/Sidef/Problem-of-Apollonius new file mode 120000 index 0000000000..dde2b142f8 --- /dev/null +++ b/Lang/Sidef/Problem-of-Apollonius @@ -0,0 +1 @@ +../../Task/Problem-of-Apollonius/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Program-name b/Lang/Sidef/Program-name new file mode 120000 index 0000000000..a62888fe39 --- /dev/null +++ b/Lang/Sidef/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Program-termination b/Lang/Sidef/Program-termination new file mode 120000 index 0000000000..2066c2c040 --- /dev/null +++ b/Lang/Sidef/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Pythagorean-triples b/Lang/Sidef/Pythagorean-triples new file mode 120000 index 0000000000..eff852e00a --- /dev/null +++ b/Lang/Sidef/Pythagorean-triples @@ -0,0 +1 @@ +../../Task/Pythagorean-triples/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Quaternion-type b/Lang/Sidef/Quaternion-type new file mode 120000 index 0000000000..5e28a5e41d --- /dev/null +++ b/Lang/Sidef/Quaternion-type @@ -0,0 +1 @@ +../../Task/Quaternion-type/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Queue-Definition b/Lang/Sidef/Queue-Definition new file mode 120000 index 0000000000..ab036eafcc --- /dev/null +++ b/Lang/Sidef/Queue-Definition @@ -0,0 +1 @@ +../../Task/Queue-Definition/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Queue-Usage b/Lang/Sidef/Queue-Usage new file mode 120000 index 0000000000..9217d91d21 --- /dev/null +++ b/Lang/Sidef/Queue-Usage @@ -0,0 +1 @@ +../../Task/Queue-Usage/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Quickselect-algorithm b/Lang/Sidef/Quickselect-algorithm new file mode 120000 index 0000000000..f08bd1790b --- /dev/null +++ b/Lang/Sidef/Quickselect-algorithm @@ -0,0 +1 @@ +../../Task/Quickselect-algorithm/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Quine b/Lang/Sidef/Quine new file mode 120000 index 0000000000..96abc3b363 --- /dev/null +++ b/Lang/Sidef/Quine @@ -0,0 +1 @@ +../../Task/Quine/Sidef \ No newline at end of file diff --git a/Lang/Sidef/README b/Lang/Sidef/README new file mode 100644 index 0000000000..8b43cb6803 --- /dev/null +++ b/Lang/Sidef/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Sidef diff --git a/Lang/Sidef/RSA-code b/Lang/Sidef/RSA-code new file mode 120000 index 0000000000..57729ac701 --- /dev/null +++ b/Lang/Sidef/RSA-code @@ -0,0 +1 @@ +../../Task/RSA-code/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Random-number-generator--device- b/Lang/Sidef/Random-number-generator--device- new file mode 120000 index 0000000000..bfa51ffc33 --- /dev/null +++ b/Lang/Sidef/Random-number-generator--device- @@ -0,0 +1 @@ +../../Task/Random-number-generator--device-/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Random-number-generator--included- b/Lang/Sidef/Random-number-generator--included- new file mode 120000 index 0000000000..3b6b3cc6fd --- /dev/null +++ b/Lang/Sidef/Random-number-generator--included- @@ -0,0 +1 @@ +../../Task/Random-number-generator--included-/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Random-numbers b/Lang/Sidef/Random-numbers new file mode 120000 index 0000000000..d3b12faf6b --- /dev/null +++ b/Lang/Sidef/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Range-expansion b/Lang/Sidef/Range-expansion new file mode 120000 index 0000000000..fc46d6e694 --- /dev/null +++ b/Lang/Sidef/Range-expansion @@ -0,0 +1 @@ +../../Task/Range-expansion/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Ranking-methods b/Lang/Sidef/Ranking-methods new file mode 120000 index 0000000000..6a8562e9e6 --- /dev/null +++ b/Lang/Sidef/Ranking-methods @@ -0,0 +1 @@ +../../Task/Ranking-methods/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Rate-counter b/Lang/Sidef/Rate-counter new file mode 120000 index 0000000000..f928f47a6c --- /dev/null +++ b/Lang/Sidef/Rate-counter @@ -0,0 +1 @@ +../../Task/Rate-counter/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Read-a-configuration-file b/Lang/Sidef/Read-a-configuration-file new file mode 120000 index 0000000000..75d2707ef1 --- /dev/null +++ b/Lang/Sidef/Read-a-configuration-file @@ -0,0 +1 @@ +../../Task/Read-a-configuration-file/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Read-a-file-line-by-line b/Lang/Sidef/Read-a-file-line-by-line new file mode 120000 index 0000000000..fc755640e0 --- /dev/null +++ b/Lang/Sidef/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Read-a-specific-line-from-a-file b/Lang/Sidef/Read-a-specific-line-from-a-file new file mode 120000 index 0000000000..687914ab74 --- /dev/null +++ b/Lang/Sidef/Read-a-specific-line-from-a-file @@ -0,0 +1 @@ +../../Task/Read-a-specific-line-from-a-file/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Read-entire-file b/Lang/Sidef/Read-entire-file new file mode 120000 index 0000000000..4dbff1a71c --- /dev/null +++ b/Lang/Sidef/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Real-constants-and-functions b/Lang/Sidef/Real-constants-and-functions new file mode 120000 index 0000000000..205205c69f --- /dev/null +++ b/Lang/Sidef/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Reduced-row-echelon-form b/Lang/Sidef/Reduced-row-echelon-form new file mode 120000 index 0000000000..4893ffcb9c --- /dev/null +++ b/Lang/Sidef/Reduced-row-echelon-form @@ -0,0 +1 @@ +../../Task/Reduced-row-echelon-form/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Regular-expressions b/Lang/Sidef/Regular-expressions new file mode 120000 index 0000000000..9573c45764 --- /dev/null +++ b/Lang/Sidef/Regular-expressions @@ -0,0 +1 @@ +../../Task/Regular-expressions/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Remove-duplicate-elements b/Lang/Sidef/Remove-duplicate-elements new file mode 120000 index 0000000000..5903a7a364 --- /dev/null +++ b/Lang/Sidef/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Remove-lines-from-a-file b/Lang/Sidef/Remove-lines-from-a-file new file mode 120000 index 0000000000..402e30b8cb --- /dev/null +++ b/Lang/Sidef/Remove-lines-from-a-file @@ -0,0 +1 @@ +../../Task/Remove-lines-from-a-file/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Rename-a-file b/Lang/Sidef/Rename-a-file new file mode 120000 index 0000000000..25bd8e812f --- /dev/null +++ b/Lang/Sidef/Rename-a-file @@ -0,0 +1 @@ +../../Task/Rename-a-file/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Rep-string b/Lang/Sidef/Rep-string new file mode 120000 index 0000000000..913a2b5546 --- /dev/null +++ b/Lang/Sidef/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Repeat-a-string b/Lang/Sidef/Repeat-a-string new file mode 120000 index 0000000000..40d9d72484 --- /dev/null +++ b/Lang/Sidef/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Resistor-mesh b/Lang/Sidef/Resistor-mesh new file mode 120000 index 0000000000..98ed0c35aa --- /dev/null +++ b/Lang/Sidef/Resistor-mesh @@ -0,0 +1 @@ +../../Task/Resistor-mesh/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Respond-to-an-unknown-method-call b/Lang/Sidef/Respond-to-an-unknown-method-call new file mode 120000 index 0000000000..0a88e48113 --- /dev/null +++ b/Lang/Sidef/Respond-to-an-unknown-method-call @@ -0,0 +1 @@ +../../Task/Respond-to-an-unknown-method-call/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Return-multiple-values b/Lang/Sidef/Return-multiple-values new file mode 120000 index 0000000000..cb3c5bbd8f --- /dev/null +++ b/Lang/Sidef/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Reverse-a-string b/Lang/Sidef/Reverse-a-string new file mode 120000 index 0000000000..f393483406 --- /dev/null +++ b/Lang/Sidef/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Reverse-words-in-a-string b/Lang/Sidef/Reverse-words-in-a-string new file mode 120000 index 0000000000..8e68176b7c --- /dev/null +++ b/Lang/Sidef/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Rock-paper-scissors b/Lang/Sidef/Rock-paper-scissors new file mode 120000 index 0000000000..af99e43d44 --- /dev/null +++ b/Lang/Sidef/Rock-paper-scissors @@ -0,0 +1 @@ +../../Task/Rock-paper-scissors/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Roman-numerals-Decode b/Lang/Sidef/Roman-numerals-Decode new file mode 120000 index 0000000000..9228589121 --- /dev/null +++ b/Lang/Sidef/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Roman-numerals-Encode b/Lang/Sidef/Roman-numerals-Encode new file mode 120000 index 0000000000..1d044c553f --- /dev/null +++ b/Lang/Sidef/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Roots-of-a-function b/Lang/Sidef/Roots-of-a-function new file mode 120000 index 0000000000..0efc32e51f --- /dev/null +++ b/Lang/Sidef/Roots-of-a-function @@ -0,0 +1 @@ +../../Task/Roots-of-a-function/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Roots-of-a-quadratic-function b/Lang/Sidef/Roots-of-a-quadratic-function new file mode 120000 index 0000000000..f5e5cf653e --- /dev/null +++ b/Lang/Sidef/Roots-of-a-quadratic-function @@ -0,0 +1 @@ +../../Task/Roots-of-a-quadratic-function/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Roots-of-unity b/Lang/Sidef/Roots-of-unity new file mode 120000 index 0000000000..450f1d4bd9 --- /dev/null +++ b/Lang/Sidef/Roots-of-unity @@ -0,0 +1 @@ +../../Task/Roots-of-unity/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Rot-13 b/Lang/Sidef/Rot-13 new file mode 120000 index 0000000000..a9c0163a82 --- /dev/null +++ b/Lang/Sidef/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Run-length-encoding b/Lang/Sidef/Run-length-encoding new file mode 120000 index 0000000000..e74c258f91 --- /dev/null +++ b/Lang/Sidef/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Runge-Kutta-method b/Lang/Sidef/Runge-Kutta-method new file mode 120000 index 0000000000..d66e73792d --- /dev/null +++ b/Lang/Sidef/Runge-Kutta-method @@ -0,0 +1 @@ +../../Task/Runge-Kutta-method/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Runtime-evaluation b/Lang/Sidef/Runtime-evaluation new file mode 120000 index 0000000000..295b241a28 --- /dev/null +++ b/Lang/Sidef/Runtime-evaluation @@ -0,0 +1 @@ +../../Task/Runtime-evaluation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Runtime-evaluation-In-an-environment b/Lang/Sidef/Runtime-evaluation-In-an-environment new file mode 120000 index 0000000000..069669c7aa --- /dev/null +++ b/Lang/Sidef/Runtime-evaluation-In-an-environment @@ -0,0 +1 @@ +../../Task/Runtime-evaluation-In-an-environment/Sidef \ No newline at end of file diff --git a/Lang/Sidef/S-Expressions b/Lang/Sidef/S-Expressions new file mode 120000 index 0000000000..5f85088617 --- /dev/null +++ b/Lang/Sidef/S-Expressions @@ -0,0 +1 @@ +../../Task/S-Expressions/Sidef \ No newline at end of file diff --git a/Lang/Sidef/SEDOLs b/Lang/Sidef/SEDOLs new file mode 120000 index 0000000000..27b9cc6f64 --- /dev/null +++ b/Lang/Sidef/SEDOLs @@ -0,0 +1 @@ +../../Task/SEDOLs/Sidef \ No newline at end of file diff --git a/Lang/Sidef/SHA-1 b/Lang/Sidef/SHA-1 new file mode 120000 index 0000000000..2fef2f3b97 --- /dev/null +++ b/Lang/Sidef/SHA-1 @@ -0,0 +1 @@ +../../Task/SHA-1/Sidef \ No newline at end of file diff --git a/Lang/Sidef/SHA-256 b/Lang/Sidef/SHA-256 new file mode 120000 index 0000000000..e1fe5f66ac --- /dev/null +++ b/Lang/Sidef/SHA-256 @@ -0,0 +1 @@ +../../Task/SHA-256/Sidef \ No newline at end of file diff --git a/Lang/Sidef/SQL-based-authentication b/Lang/Sidef/SQL-based-authentication new file mode 120000 index 0000000000..cc79e04e95 --- /dev/null +++ b/Lang/Sidef/SQL-based-authentication @@ -0,0 +1 @@ +../../Task/SQL-based-authentication/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Same-Fringe b/Lang/Sidef/Same-Fringe new file mode 120000 index 0000000000..ddbc597db1 --- /dev/null +++ b/Lang/Sidef/Same-Fringe @@ -0,0 +1 @@ +../../Task/Same-Fringe/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Scope-Function-names-and-labels b/Lang/Sidef/Scope-Function-names-and-labels new file mode 120000 index 0000000000..2aa29479f6 --- /dev/null +++ b/Lang/Sidef/Scope-Function-names-and-labels @@ -0,0 +1 @@ +../../Task/Scope-Function-names-and-labels/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Search-a-list b/Lang/Sidef/Search-a-list new file mode 120000 index 0000000000..5ff694f834 --- /dev/null +++ b/Lang/Sidef/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Secure-temporary-file b/Lang/Sidef/Secure-temporary-file new file mode 120000 index 0000000000..66098edb6a --- /dev/null +++ b/Lang/Sidef/Secure-temporary-file @@ -0,0 +1 @@ +../../Task/Secure-temporary-file/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Self-describing-numbers b/Lang/Sidef/Self-describing-numbers new file mode 120000 index 0000000000..4c977fd126 --- /dev/null +++ b/Lang/Sidef/Self-describing-numbers @@ -0,0 +1 @@ +../../Task/Self-describing-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Semiprime b/Lang/Sidef/Semiprime new file mode 120000 index 0000000000..7becc1d3e7 --- /dev/null +++ b/Lang/Sidef/Semiprime @@ -0,0 +1 @@ +../../Task/Semiprime/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Semordnilap b/Lang/Sidef/Semordnilap new file mode 120000 index 0000000000..4a4c211744 --- /dev/null +++ b/Lang/Sidef/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Send-an-unknown-method-call b/Lang/Sidef/Send-an-unknown-method-call new file mode 120000 index 0000000000..62da5b4f16 --- /dev/null +++ b/Lang/Sidef/Send-an-unknown-method-call @@ -0,0 +1 @@ +../../Task/Send-an-unknown-method-call/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sequence-of-non-squares b/Lang/Sidef/Sequence-of-non-squares new file mode 120000 index 0000000000..78d429a639 --- /dev/null +++ b/Lang/Sidef/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sequence-of-primes-by-Trial-Division b/Lang/Sidef/Sequence-of-primes-by-Trial-Division new file mode 120000 index 0000000000..f70455d8c8 --- /dev/null +++ b/Lang/Sidef/Sequence-of-primes-by-Trial-Division @@ -0,0 +1 @@ +../../Task/Sequence-of-primes-by-Trial-Division/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Set b/Lang/Sidef/Set new file mode 120000 index 0000000000..11d8128008 --- /dev/null +++ b/Lang/Sidef/Set @@ -0,0 +1 @@ +../../Task/Set/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Set-consolidation b/Lang/Sidef/Set-consolidation new file mode 120000 index 0000000000..499f41fbda --- /dev/null +++ b/Lang/Sidef/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Seven-sided-dice-from-five-sided-dice b/Lang/Sidef/Seven-sided-dice-from-five-sided-dice new file mode 120000 index 0000000000..6bf180ab69 --- /dev/null +++ b/Lang/Sidef/Seven-sided-dice-from-five-sided-dice @@ -0,0 +1 @@ +../../Task/Seven-sided-dice-from-five-sided-dice/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Shell-one-liner b/Lang/Sidef/Shell-one-liner new file mode 120000 index 0000000000..edc9827728 --- /dev/null +++ b/Lang/Sidef/Shell-one-liner @@ -0,0 +1 @@ +../../Task/Shell-one-liner/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Short-circuit-evaluation b/Lang/Sidef/Short-circuit-evaluation new file mode 120000 index 0000000000..a5091cbfdf --- /dev/null +++ b/Lang/Sidef/Short-circuit-evaluation @@ -0,0 +1 @@ +../../Task/Short-circuit-evaluation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Show-the-epoch b/Lang/Sidef/Show-the-epoch new file mode 120000 index 0000000000..f144d8f124 --- /dev/null +++ b/Lang/Sidef/Show-the-epoch @@ -0,0 +1 @@ +../../Task/Show-the-epoch/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sierpinski-carpet b/Lang/Sidef/Sierpinski-carpet new file mode 120000 index 0000000000..2230da5252 --- /dev/null +++ b/Lang/Sidef/Sierpinski-carpet @@ -0,0 +1 @@ +../../Task/Sierpinski-carpet/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sierpinski-triangle b/Lang/Sidef/Sierpinski-triangle new file mode 120000 index 0000000000..ae66c46952 --- /dev/null +++ b/Lang/Sidef/Sierpinski-triangle @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sierpinski-triangle-Graphical b/Lang/Sidef/Sierpinski-triangle-Graphical new file mode 120000 index 0000000000..8386d7a616 --- /dev/null +++ b/Lang/Sidef/Sierpinski-triangle-Graphical @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle-Graphical/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sieve-of-Eratosthenes b/Lang/Sidef/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..8f82e0caea --- /dev/null +++ b/Lang/Sidef/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Simple-windowed-application b/Lang/Sidef/Simple-windowed-application new file mode 120000 index 0000000000..9f665b876a --- /dev/null +++ b/Lang/Sidef/Simple-windowed-application @@ -0,0 +1 @@ +../../Task/Simple-windowed-application/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Singleton b/Lang/Sidef/Singleton new file mode 120000 index 0000000000..7c106d8ec8 --- /dev/null +++ b/Lang/Sidef/Singleton @@ -0,0 +1 @@ +../../Task/Singleton/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Singly-linked-list-Element-definition b/Lang/Sidef/Singly-linked-list-Element-definition new file mode 120000 index 0000000000..e04fd380aa --- /dev/null +++ b/Lang/Sidef/Singly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-definition/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Singly-linked-list-Element-insertion b/Lang/Sidef/Singly-linked-list-Element-insertion new file mode 120000 index 0000000000..fcb8ec94d3 --- /dev/null +++ b/Lang/Sidef/Singly-linked-list-Element-insertion @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-insertion/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Singly-linked-list-Traversal b/Lang/Sidef/Singly-linked-list-Traversal new file mode 120000 index 0000000000..9589863c91 --- /dev/null +++ b/Lang/Sidef/Singly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Traversal/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sleep b/Lang/Sidef/Sleep new file mode 120000 index 0000000000..1ed65fbf12 --- /dev/null +++ b/Lang/Sidef/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sockets b/Lang/Sidef/Sockets new file mode 120000 index 0000000000..edb056f4f2 --- /dev/null +++ b/Lang/Sidef/Sockets @@ -0,0 +1 @@ +../../Task/Sockets/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sort-an-array-of-composite-structures b/Lang/Sidef/Sort-an-array-of-composite-structures new file mode 120000 index 0000000000..4200f76b8c --- /dev/null +++ b/Lang/Sidef/Sort-an-array-of-composite-structures @@ -0,0 +1 @@ +../../Task/Sort-an-array-of-composite-structures/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sort-an-integer-array b/Lang/Sidef/Sort-an-integer-array new file mode 120000 index 0000000000..31ad061174 --- /dev/null +++ b/Lang/Sidef/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sort-disjoint-sublist b/Lang/Sidef/Sort-disjoint-sublist new file mode 120000 index 0000000000..85f5b1e824 --- /dev/null +++ b/Lang/Sidef/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sort-stability b/Lang/Sidef/Sort-stability new file mode 120000 index 0000000000..86843bc634 --- /dev/null +++ b/Lang/Sidef/Sort-stability @@ -0,0 +1 @@ +../../Task/Sort-stability/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sort-using-a-custom-comparator b/Lang/Sidef/Sort-using-a-custom-comparator new file mode 120000 index 0000000000..7b56f930c6 --- /dev/null +++ b/Lang/Sidef/Sort-using-a-custom-comparator @@ -0,0 +1 @@ +../../Task/Sort-using-a-custom-comparator/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Bead-sort b/Lang/Sidef/Sorting-algorithms-Bead-sort new file mode 120000 index 0000000000..f3281df9dc --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Bead-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bead-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Bogosort b/Lang/Sidef/Sorting-algorithms-Bogosort new file mode 120000 index 0000000000..13cc565a8a --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Bogosort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bogosort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Bubble-sort b/Lang/Sidef/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..7a6daf0a2d --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Cocktail-sort b/Lang/Sidef/Sorting-algorithms-Cocktail-sort new file mode 120000 index 0000000000..9b08c57ea7 --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Cocktail-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Cocktail-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Comb-sort b/Lang/Sidef/Sorting-algorithms-Comb-sort new file mode 120000 index 0000000000..2665473d22 --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Comb-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Comb-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Counting-sort b/Lang/Sidef/Sorting-algorithms-Counting-sort new file mode 120000 index 0000000000..822dea20ce --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Counting-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Counting-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Gnome-sort b/Lang/Sidef/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..6bf2ed74ed --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Heapsort b/Lang/Sidef/Sorting-algorithms-Heapsort new file mode 120000 index 0000000000..0095593dbd --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Heapsort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Heapsort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Insertion-sort b/Lang/Sidef/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..a49a515bde --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Merge-sort b/Lang/Sidef/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..e3e13e015b --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Pancake-sort b/Lang/Sidef/Sorting-algorithms-Pancake-sort new file mode 120000 index 0000000000..5d32e219f6 --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Pancake-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Pancake-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Permutation-sort b/Lang/Sidef/Sorting-algorithms-Permutation-sort new file mode 120000 index 0000000000..d4ffbe9c4e --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Permutation-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Permutation-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Quicksort b/Lang/Sidef/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..c758001760 --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Radix-sort b/Lang/Sidef/Sorting-algorithms-Radix-sort new file mode 120000 index 0000000000..37db83e797 --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Radix-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Radix-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Selection-sort b/Lang/Sidef/Sorting-algorithms-Selection-sort new file mode 120000 index 0000000000..5988e0c677 --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Selection-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Selection-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Shell-sort b/Lang/Sidef/Sorting-algorithms-Shell-sort new file mode 120000 index 0000000000..c8891b19de --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Shell-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Shell-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Sleep-sort b/Lang/Sidef/Sorting-algorithms-Sleep-sort new file mode 120000 index 0000000000..fe2545835e --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Sleep-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Sleep-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Stooge-sort b/Lang/Sidef/Sorting-algorithms-Stooge-sort new file mode 120000 index 0000000000..087eca2015 --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Stooge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Stooge-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-algorithms-Strand-sort b/Lang/Sidef/Sorting-algorithms-Strand-sort new file mode 120000 index 0000000000..92fdea3f84 --- /dev/null +++ b/Lang/Sidef/Sorting-algorithms-Strand-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Strand-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Soundex b/Lang/Sidef/Soundex new file mode 120000 index 0000000000..3bcb5bbc57 --- /dev/null +++ b/Lang/Sidef/Soundex @@ -0,0 +1 @@ +../../Task/Soundex/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sparkline-in-unicode b/Lang/Sidef/Sparkline-in-unicode new file mode 120000 index 0000000000..42fa5a758c --- /dev/null +++ b/Lang/Sidef/Sparkline-in-unicode @@ -0,0 +1 @@ +../../Task/Sparkline-in-unicode/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Speech-synthesis b/Lang/Sidef/Speech-synthesis new file mode 120000 index 0000000000..45b53f4a3d --- /dev/null +++ b/Lang/Sidef/Speech-synthesis @@ -0,0 +1 @@ +../../Task/Speech-synthesis/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Spiral-matrix b/Lang/Sidef/Spiral-matrix new file mode 120000 index 0000000000..21c883bcbc --- /dev/null +++ b/Lang/Sidef/Spiral-matrix @@ -0,0 +1 @@ +../../Task/Spiral-matrix/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Stable-marriage-problem b/Lang/Sidef/Stable-marriage-problem new file mode 120000 index 0000000000..ea222b1701 --- /dev/null +++ b/Lang/Sidef/Stable-marriage-problem @@ -0,0 +1 @@ +../../Task/Stable-marriage-problem/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Stack b/Lang/Sidef/Stack new file mode 120000 index 0000000000..3208251571 --- /dev/null +++ b/Lang/Sidef/Stack @@ -0,0 +1 @@ +../../Task/Stack/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Stair-climbing-puzzle b/Lang/Sidef/Stair-climbing-puzzle new file mode 120000 index 0000000000..157f84709b --- /dev/null +++ b/Lang/Sidef/Stair-climbing-puzzle @@ -0,0 +1 @@ +../../Task/Stair-climbing-puzzle/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Statistics-Basic b/Lang/Sidef/Statistics-Basic new file mode 120000 index 0000000000..1926f1596a --- /dev/null +++ b/Lang/Sidef/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Stem-and-leaf-plot b/Lang/Sidef/Stem-and-leaf-plot new file mode 120000 index 0000000000..fb7930ef22 --- /dev/null +++ b/Lang/Sidef/Stem-and-leaf-plot @@ -0,0 +1 @@ +../../Task/Stem-and-leaf-plot/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Stern-Brocot-sequence b/Lang/Sidef/Stern-Brocot-sequence new file mode 120000 index 0000000000..8ca9ca9d4e --- /dev/null +++ b/Lang/Sidef/Stern-Brocot-sequence @@ -0,0 +1 @@ +../../Task/Stern-Brocot-sequence/Sidef \ No newline at end of file diff --git a/Lang/Sidef/String-append b/Lang/Sidef/String-append new file mode 120000 index 0000000000..3551bed226 --- /dev/null +++ b/Lang/Sidef/String-append @@ -0,0 +1 @@ +../../Task/String-append/Sidef \ No newline at end of file diff --git a/Lang/Sidef/String-case b/Lang/Sidef/String-case new file mode 120000 index 0000000000..fa801216f5 --- /dev/null +++ b/Lang/Sidef/String-case @@ -0,0 +1 @@ +../../Task/String-case/Sidef \ No newline at end of file diff --git a/Lang/Sidef/String-comparison b/Lang/Sidef/String-comparison new file mode 120000 index 0000000000..807f3ac515 --- /dev/null +++ b/Lang/Sidef/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/Sidef \ No newline at end of file diff --git a/Lang/Sidef/String-concatenation b/Lang/Sidef/String-concatenation new file mode 120000 index 0000000000..5cd88aa594 --- /dev/null +++ b/Lang/Sidef/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/String-interpolation--included- b/Lang/Sidef/String-interpolation--included- new file mode 120000 index 0000000000..1c7a500cf0 --- /dev/null +++ b/Lang/Sidef/String-interpolation--included- @@ -0,0 +1 @@ +../../Task/String-interpolation--included-/Sidef \ No newline at end of file diff --git a/Lang/Sidef/String-length b/Lang/Sidef/String-length new file mode 120000 index 0000000000..01a32f99ec --- /dev/null +++ b/Lang/Sidef/String-length @@ -0,0 +1 @@ +../../Task/String-length/Sidef \ No newline at end of file diff --git a/Lang/Sidef/String-matching b/Lang/Sidef/String-matching new file mode 120000 index 0000000000..dc3e23ae56 --- /dev/null +++ b/Lang/Sidef/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/Sidef \ No newline at end of file diff --git a/Lang/Sidef/String-prepend b/Lang/Sidef/String-prepend new file mode 120000 index 0000000000..104e1f1735 --- /dev/null +++ b/Lang/Sidef/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Strip-a-set-of-characters-from-a-string b/Lang/Sidef/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..dae179b362 --- /dev/null +++ b/Lang/Sidef/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Strip-block-comments b/Lang/Sidef/Strip-block-comments new file mode 120000 index 0000000000..95c0919d78 --- /dev/null +++ b/Lang/Sidef/Strip-block-comments @@ -0,0 +1 @@ +../../Task/Strip-block-comments/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Strip-comments-from-a-string b/Lang/Sidef/Strip-comments-from-a-string new file mode 120000 index 0000000000..535aa43c4e --- /dev/null +++ b/Lang/Sidef/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Strip-control-codes-and-extended-characters-from-a-string b/Lang/Sidef/Strip-control-codes-and-extended-characters-from-a-string new file mode 120000 index 0000000000..1ee04b9bac --- /dev/null +++ b/Lang/Sidef/Strip-control-codes-and-extended-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-control-codes-and-extended-characters-from-a-string/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Strip-whitespace-from-a-string-Top-and-tail b/Lang/Sidef/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..a7b120ac19 --- /dev/null +++ b/Lang/Sidef/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Substring b/Lang/Sidef/Substring new file mode 120000 index 0000000000..1e3da0af02 --- /dev/null +++ b/Lang/Sidef/Substring @@ -0,0 +1 @@ +../../Task/Substring/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Substring-Top-and-tail b/Lang/Sidef/Substring-Top-and-tail new file mode 120000 index 0000000000..67f2615d4c --- /dev/null +++ b/Lang/Sidef/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Subtractive-generator b/Lang/Sidef/Subtractive-generator new file mode 120000 index 0000000000..15488ebe32 --- /dev/null +++ b/Lang/Sidef/Subtractive-generator @@ -0,0 +1 @@ +../../Task/Subtractive-generator/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sudoku b/Lang/Sidef/Sudoku new file mode 120000 index 0000000000..1efc466096 --- /dev/null +++ b/Lang/Sidef/Sudoku @@ -0,0 +1 @@ +../../Task/Sudoku/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sum-and-product-of-an-array b/Lang/Sidef/Sum-and-product-of-an-array new file mode 120000 index 0000000000..e52c7a4c00 --- /dev/null +++ b/Lang/Sidef/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sum-digits-of-an-integer b/Lang/Sidef/Sum-digits-of-an-integer new file mode 120000 index 0000000000..93e257ab77 --- /dev/null +++ b/Lang/Sidef/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sum-multiples-of-3-and-5 b/Lang/Sidef/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..85fa6ad183 --- /dev/null +++ b/Lang/Sidef/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sum-of-a-series b/Lang/Sidef/Sum-of-a-series new file mode 120000 index 0000000000..92c3a73541 --- /dev/null +++ b/Lang/Sidef/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sum-of-squares b/Lang/Sidef/Sum-of-squares new file mode 120000 index 0000000000..b0922ac599 --- /dev/null +++ b/Lang/Sidef/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sutherland-Hodgman-polygon-clipping b/Lang/Sidef/Sutherland-Hodgman-polygon-clipping new file mode 120000 index 0000000000..04b35589e2 --- /dev/null +++ b/Lang/Sidef/Sutherland-Hodgman-polygon-clipping @@ -0,0 +1 @@ +../../Task/Sutherland-Hodgman-polygon-clipping/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Symmetric-difference b/Lang/Sidef/Symmetric-difference new file mode 120000 index 0000000000..f1252b8629 --- /dev/null +++ b/Lang/Sidef/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/Sidef \ No newline at end of file diff --git a/Lang/Sidef/System-time b/Lang/Sidef/System-time new file mode 120000 index 0000000000..afbcc112b9 --- /dev/null +++ b/Lang/Sidef/System-time @@ -0,0 +1 @@ +../../Task/System-time/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Table-creation-Postal-addresses b/Lang/Sidef/Table-creation-Postal-addresses new file mode 120000 index 0000000000..1981ca1d8c --- /dev/null +++ b/Lang/Sidef/Table-creation-Postal-addresses @@ -0,0 +1 @@ +../../Task/Table-creation-Postal-addresses/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Take-notes-on-the-command-line b/Lang/Sidef/Take-notes-on-the-command-line new file mode 120000 index 0000000000..68b1eccecc --- /dev/null +++ b/Lang/Sidef/Take-notes-on-the-command-line @@ -0,0 +1 @@ +../../Task/Take-notes-on-the-command-line/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Temperature-conversion b/Lang/Sidef/Temperature-conversion new file mode 120000 index 0000000000..457d7ebbb5 --- /dev/null +++ b/Lang/Sidef/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Terminal-control-Clear-the-screen b/Lang/Sidef/Terminal-control-Clear-the-screen new file mode 120000 index 0000000000..bbfeba7a37 --- /dev/null +++ b/Lang/Sidef/Terminal-control-Clear-the-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Clear-the-screen/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Terminal-control-Coloured-text b/Lang/Sidef/Terminal-control-Coloured-text new file mode 120000 index 0000000000..44f6d8cc19 --- /dev/null +++ b/Lang/Sidef/Terminal-control-Coloured-text @@ -0,0 +1 @@ +../../Task/Terminal-control-Coloured-text/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Terminal-control-Dimensions b/Lang/Sidef/Terminal-control-Dimensions new file mode 120000 index 0000000000..55bec6a8a9 --- /dev/null +++ b/Lang/Sidef/Terminal-control-Dimensions @@ -0,0 +1 @@ +../../Task/Terminal-control-Dimensions/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Terminal-control-Display-an-extended-character b/Lang/Sidef/Terminal-control-Display-an-extended-character new file mode 120000 index 0000000000..30deb492ff --- /dev/null +++ b/Lang/Sidef/Terminal-control-Display-an-extended-character @@ -0,0 +1 @@ +../../Task/Terminal-control-Display-an-extended-character/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Terminal-control-Preserve-screen b/Lang/Sidef/Terminal-control-Preserve-screen new file mode 120000 index 0000000000..8220ce5ccc --- /dev/null +++ b/Lang/Sidef/Terminal-control-Preserve-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Preserve-screen/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Terminal-control-Ringing-the-terminal-bell b/Lang/Sidef/Terminal-control-Ringing-the-terminal-bell new file mode 120000 index 0000000000..d60d3d4f6b --- /dev/null +++ b/Lang/Sidef/Terminal-control-Ringing-the-terminal-bell @@ -0,0 +1 @@ +../../Task/Terminal-control-Ringing-the-terminal-bell/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Terminal-control-Unicode-output b/Lang/Sidef/Terminal-control-Unicode-output new file mode 120000 index 0000000000..4c6c489368 --- /dev/null +++ b/Lang/Sidef/Terminal-control-Unicode-output @@ -0,0 +1 @@ +../../Task/Terminal-control-Unicode-output/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Text-processing-1 b/Lang/Sidef/Text-processing-1 new file mode 120000 index 0000000000..01ea4da909 --- /dev/null +++ b/Lang/Sidef/Text-processing-1 @@ -0,0 +1 @@ +../../Task/Text-processing-1/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Text-processing-2 b/Lang/Sidef/Text-processing-2 new file mode 120000 index 0000000000..8ca9be1913 --- /dev/null +++ b/Lang/Sidef/Text-processing-2 @@ -0,0 +1 @@ +../../Task/Text-processing-2/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Text-processing-Max-licenses-in-use b/Lang/Sidef/Text-processing-Max-licenses-in-use new file mode 120000 index 0000000000..2f03c9ff99 --- /dev/null +++ b/Lang/Sidef/Text-processing-Max-licenses-in-use @@ -0,0 +1 @@ +../../Task/Text-processing-Max-licenses-in-use/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Textonyms b/Lang/Sidef/Textonyms new file mode 120000 index 0000000000..7e3610095e --- /dev/null +++ b/Lang/Sidef/Textonyms @@ -0,0 +1 @@ +../../Task/Textonyms/Sidef \ No newline at end of file diff --git a/Lang/Sidef/The-ISAAC-Cipher b/Lang/Sidef/The-ISAAC-Cipher new file mode 120000 index 0000000000..a51e988079 --- /dev/null +++ b/Lang/Sidef/The-ISAAC-Cipher @@ -0,0 +1 @@ +../../Task/The-ISAAC-Cipher/Sidef \ No newline at end of file diff --git a/Lang/Sidef/The-Twelve-Days-of-Christmas b/Lang/Sidef/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..3578131572 --- /dev/null +++ b/Lang/Sidef/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Thieles-interpolation-formula b/Lang/Sidef/Thieles-interpolation-formula new file mode 120000 index 0000000000..667583be06 --- /dev/null +++ b/Lang/Sidef/Thieles-interpolation-formula @@ -0,0 +1 @@ +../../Task/Thieles-interpolation-formula/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Time-a-function b/Lang/Sidef/Time-a-function new file mode 120000 index 0000000000..71e183db11 --- /dev/null +++ b/Lang/Sidef/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Tokenize-a-string b/Lang/Sidef/Tokenize-a-string new file mode 120000 index 0000000000..bdf7ab2d70 --- /dev/null +++ b/Lang/Sidef/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Top-rank-per-group b/Lang/Sidef/Top-rank-per-group new file mode 120000 index 0000000000..95a3fe94ab --- /dev/null +++ b/Lang/Sidef/Top-rank-per-group @@ -0,0 +1 @@ +../../Task/Top-rank-per-group/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Topic-variable b/Lang/Sidef/Topic-variable new file mode 120000 index 0000000000..b4dd0c8fcf --- /dev/null +++ b/Lang/Sidef/Topic-variable @@ -0,0 +1 @@ +../../Task/Topic-variable/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Topological-sort b/Lang/Sidef/Topological-sort new file mode 120000 index 0000000000..ffc66262d2 --- /dev/null +++ b/Lang/Sidef/Topological-sort @@ -0,0 +1 @@ +../../Task/Topological-sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Towers-of-Hanoi b/Lang/Sidef/Towers-of-Hanoi new file mode 120000 index 0000000000..7646e1a6a9 --- /dev/null +++ b/Lang/Sidef/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Trabb-Pardo-Knuth-algorithm b/Lang/Sidef/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..07ba659c64 --- /dev/null +++ b/Lang/Sidef/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Tree-traversal b/Lang/Sidef/Tree-traversal new file mode 120000 index 0000000000..e31911b261 --- /dev/null +++ b/Lang/Sidef/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Trigonometric-functions b/Lang/Sidef/Trigonometric-functions new file mode 120000 index 0000000000..50db81643d --- /dev/null +++ b/Lang/Sidef/Trigonometric-functions @@ -0,0 +1 @@ +../../Task/Trigonometric-functions/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Truncatable-primes b/Lang/Sidef/Truncatable-primes new file mode 120000 index 0000000000..00ec8aa552 --- /dev/null +++ b/Lang/Sidef/Truncatable-primes @@ -0,0 +1 @@ +../../Task/Truncatable-primes/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Truncate-a-file b/Lang/Sidef/Truncate-a-file new file mode 120000 index 0000000000..d63e9ba8dc --- /dev/null +++ b/Lang/Sidef/Truncate-a-file @@ -0,0 +1 @@ +../../Task/Truncate-a-file/Sidef \ No newline at end of file diff --git a/Lang/Sidef/URL-decoding b/Lang/Sidef/URL-decoding new file mode 120000 index 0000000000..1fa0f87898 --- /dev/null +++ b/Lang/Sidef/URL-decoding @@ -0,0 +1 @@ +../../Task/URL-decoding/Sidef \ No newline at end of file diff --git a/Lang/Sidef/URL-encoding b/Lang/Sidef/URL-encoding new file mode 120000 index 0000000000..1979b69a15 --- /dev/null +++ b/Lang/Sidef/URL-encoding @@ -0,0 +1 @@ +../../Task/URL-encoding/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Ulam-spiral--for-primes- b/Lang/Sidef/Ulam-spiral--for-primes- new file mode 120000 index 0000000000..3bf0008dfc --- /dev/null +++ b/Lang/Sidef/Ulam-spiral--for-primes- @@ -0,0 +1 @@ +../../Task/Ulam-spiral--for-primes-/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Unbias-a-random-generator b/Lang/Sidef/Unbias-a-random-generator new file mode 120000 index 0000000000..5e18ece7f5 --- /dev/null +++ b/Lang/Sidef/Unbias-a-random-generator @@ -0,0 +1 @@ +../../Task/Unbias-a-random-generator/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Undefined-values b/Lang/Sidef/Undefined-values new file mode 120000 index 0000000000..91f555c94d --- /dev/null +++ b/Lang/Sidef/Undefined-values @@ -0,0 +1 @@ +../../Task/Undefined-values/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Unicode-strings b/Lang/Sidef/Unicode-strings new file mode 120000 index 0000000000..4abb647cda --- /dev/null +++ b/Lang/Sidef/Unicode-strings @@ -0,0 +1 @@ +../../Task/Unicode-strings/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Unicode-variable-names b/Lang/Sidef/Unicode-variable-names new file mode 120000 index 0000000000..2a9e759ea6 --- /dev/null +++ b/Lang/Sidef/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Universal-Turing-machine b/Lang/Sidef/Universal-Turing-machine new file mode 120000 index 0000000000..01dce440da --- /dev/null +++ b/Lang/Sidef/Universal-Turing-machine @@ -0,0 +1 @@ +../../Task/Universal-Turing-machine/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Unix-ls b/Lang/Sidef/Unix-ls new file mode 120000 index 0000000000..79ba27070a --- /dev/null +++ b/Lang/Sidef/Unix-ls @@ -0,0 +1 @@ +../../Task/Unix-ls/Sidef \ No newline at end of file diff --git a/Lang/Sidef/User-input-Graphical b/Lang/Sidef/User-input-Graphical new file mode 120000 index 0000000000..d006bad919 --- /dev/null +++ b/Lang/Sidef/User-input-Graphical @@ -0,0 +1 @@ +../../Task/User-input-Graphical/Sidef \ No newline at end of file diff --git a/Lang/Sidef/User-input-Text b/Lang/Sidef/User-input-Text new file mode 120000 index 0000000000..7399ce938e --- /dev/null +++ b/Lang/Sidef/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Van-der-Corput-sequence b/Lang/Sidef/Van-der-Corput-sequence new file mode 120000 index 0000000000..87e42b2f87 --- /dev/null +++ b/Lang/Sidef/Van-der-Corput-sequence @@ -0,0 +1 @@ +../../Task/Van-der-Corput-sequence/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Variadic-function b/Lang/Sidef/Variadic-function new file mode 120000 index 0000000000..b780847ef6 --- /dev/null +++ b/Lang/Sidef/Variadic-function @@ -0,0 +1 @@ +../../Task/Variadic-function/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Vector-products b/Lang/Sidef/Vector-products new file mode 120000 index 0000000000..0f3c919feb --- /dev/null +++ b/Lang/Sidef/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Vigen-re-cipher b/Lang/Sidef/Vigen-re-cipher new file mode 120000 index 0000000000..873293f102 --- /dev/null +++ b/Lang/Sidef/Vigen-re-cipher @@ -0,0 +1 @@ +../../Task/Vigen-re-cipher/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Visualize-a-tree b/Lang/Sidef/Visualize-a-tree new file mode 120000 index 0000000000..945daad9ed --- /dev/null +++ b/Lang/Sidef/Visualize-a-tree @@ -0,0 +1 @@ +../../Task/Visualize-a-tree/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Voronoi-diagram b/Lang/Sidef/Voronoi-diagram new file mode 120000 index 0000000000..41e86f1d8e --- /dev/null +++ b/Lang/Sidef/Voronoi-diagram @@ -0,0 +1 @@ +../../Task/Voronoi-diagram/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Walk-a-directory-Non-recursively b/Lang/Sidef/Walk-a-directory-Non-recursively new file mode 120000 index 0000000000..a9ce7e2409 --- /dev/null +++ b/Lang/Sidef/Walk-a-directory-Non-recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Non-recursively/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Walk-a-directory-Recursively b/Lang/Sidef/Walk-a-directory-Recursively new file mode 120000 index 0000000000..dcc6a13f5e --- /dev/null +++ b/Lang/Sidef/Walk-a-directory-Recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Recursively/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Web-scraping b/Lang/Sidef/Web-scraping new file mode 120000 index 0000000000..9d94a7083a --- /dev/null +++ b/Lang/Sidef/Web-scraping @@ -0,0 +1 @@ +../../Task/Web-scraping/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Window-creation b/Lang/Sidef/Window-creation new file mode 120000 index 0000000000..50776176fb --- /dev/null +++ b/Lang/Sidef/Window-creation @@ -0,0 +1 @@ +../../Task/Window-creation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Wireworld b/Lang/Sidef/Wireworld new file mode 120000 index 0000000000..19792ddb76 --- /dev/null +++ b/Lang/Sidef/Wireworld @@ -0,0 +1 @@ +../../Task/Wireworld/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Word-wrap b/Lang/Sidef/Word-wrap new file mode 120000 index 0000000000..012c38664a --- /dev/null +++ b/Lang/Sidef/Word-wrap @@ -0,0 +1 @@ +../../Task/Word-wrap/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Write-float-arrays-to-a-text-file b/Lang/Sidef/Write-float-arrays-to-a-text-file new file mode 120000 index 0000000000..acd6467af5 --- /dev/null +++ b/Lang/Sidef/Write-float-arrays-to-a-text-file @@ -0,0 +1 @@ +../../Task/Write-float-arrays-to-a-text-file/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Write-language-name-in-3D-ASCII b/Lang/Sidef/Write-language-name-in-3D-ASCII new file mode 120000 index 0000000000..08e44d7255 --- /dev/null +++ b/Lang/Sidef/Write-language-name-in-3D-ASCII @@ -0,0 +1 @@ +../../Task/Write-language-name-in-3D-ASCII/Sidef \ No newline at end of file diff --git a/Lang/Sidef/XML-DOM-serialization b/Lang/Sidef/XML-DOM-serialization new file mode 120000 index 0000000000..91f40a4ec0 --- /dev/null +++ b/Lang/Sidef/XML-DOM-serialization @@ -0,0 +1 @@ +../../Task/XML-DOM-serialization/Sidef \ No newline at end of file diff --git a/Lang/Sidef/XML-Input b/Lang/Sidef/XML-Input new file mode 120000 index 0000000000..11e9581e79 --- /dev/null +++ b/Lang/Sidef/XML-Input @@ -0,0 +1 @@ +../../Task/XML-Input/Sidef \ No newline at end of file diff --git a/Lang/Sidef/XML-Output b/Lang/Sidef/XML-Output new file mode 120000 index 0000000000..bb1031bba6 --- /dev/null +++ b/Lang/Sidef/XML-Output @@ -0,0 +1 @@ +../../Task/XML-Output/Sidef \ No newline at end of file diff --git a/Lang/Sidef/XML-XPath b/Lang/Sidef/XML-XPath new file mode 120000 index 0000000000..1d1e0a2824 --- /dev/null +++ b/Lang/Sidef/XML-XPath @@ -0,0 +1 @@ +../../Task/XML-XPath/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Xiaolin-Wus-line-algorithm b/Lang/Sidef/Xiaolin-Wus-line-algorithm new file mode 120000 index 0000000000..a820b75939 --- /dev/null +++ b/Lang/Sidef/Xiaolin-Wus-line-algorithm @@ -0,0 +1 @@ +../../Task/Xiaolin-Wus-line-algorithm/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Y-combinator b/Lang/Sidef/Y-combinator new file mode 120000 index 0000000000..7d0cc33d62 --- /dev/null +++ b/Lang/Sidef/Y-combinator @@ -0,0 +1 @@ +../../Task/Y-combinator/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Yin-and-yang b/Lang/Sidef/Yin-and-yang new file mode 120000 index 0000000000..9914a10232 --- /dev/null +++ b/Lang/Sidef/Yin-and-yang @@ -0,0 +1 @@ +../../Task/Yin-and-yang/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Zebra-puzzle b/Lang/Sidef/Zebra-puzzle new file mode 120000 index 0000000000..93e6b250f0 --- /dev/null +++ b/Lang/Sidef/Zebra-puzzle @@ -0,0 +1 @@ +../../Task/Zebra-puzzle/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Zeckendorf-number-representation b/Lang/Sidef/Zeckendorf-number-representation new file mode 120000 index 0000000000..6184fe0994 --- /dev/null +++ b/Lang/Sidef/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Zero-to-the-zero-power b/Lang/Sidef/Zero-to-the-zero-power new file mode 120000 index 0000000000..e3c5b4a912 --- /dev/null +++ b/Lang/Sidef/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Zhang-Suen-thinning-algorithm b/Lang/Sidef/Zhang-Suen-thinning-algorithm new file mode 120000 index 0000000000..cae34fdf2e --- /dev/null +++ b/Lang/Sidef/Zhang-Suen-thinning-algorithm @@ -0,0 +1 @@ +../../Task/Zhang-Suen-thinning-algorithm/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Zig-zag-matrix b/Lang/Sidef/Zig-zag-matrix new file mode 120000 index 0000000000..697559719a --- /dev/null +++ b/Lang/Sidef/Zig-zag-matrix @@ -0,0 +1 @@ +../../Task/Zig-zag-matrix/Sidef \ No newline at end of file diff --git a/Lang/SkookumScript/00DESCRIPTION b/Lang/SkookumScript/00DESCRIPTION new file mode 100644 index 0000000000..fb028795d6 --- /dev/null +++ b/Lang/SkookumScript/00DESCRIPTION @@ -0,0 +1,21 @@ +{{language|SkookumScript +|exec=compiled +|parampass=reference +|gc=yes +|safety=safe +|strength=strong +|express=Partially implicit +|checking=static +|compat=nominative +|site=http://skookumscript.com/ +|LCT=yes +|bnf=http://skookumscript.com/docs/v3.0/lang/syntax/}} +{{language programming paradigm|Object-oriented}} +{{language programming paradigm|Concurrent}} +{{language programming paradigm|Imperative}} +{{language programming paradigm|Functional}} +{{language programming paradigm|Generic}} + +SkookumScript is the superpowered video game programming language and tool suite that is set to revolutionize the video game industry. It transforms team composition, workflow, and even the thought process of video game development. Simple, powerful and easy to learn, SkookumScript empowers the entire development team to create compelling gameplay (AI, missions, interactive audio, user interfaces, real-time automation and more) with surprisingly few lines of code. SkookumScript has key game concepts such as concurrency and interactivity built in, and leverages context from all areas of workflow such as world editors. Turnaround is lightning-fast, as code can be modified and debugged in real-time on live games. SkookumScript scales painlessly and facilitates large-scale content creation, making it ideal for both major studios and small indie teams. Crafted over more than 12 years by veteran game developers, SkookumScript has been battle-tested on major game titles. It is available as a powerful turn-key SkookumScript Plugin for Unreal Engine 4, and other major game engines are on the way. + +SkookumScript is the scripting solution for every genre of video game, on every platform, everywhere. \ No newline at end of file diff --git a/Lang/SkookumScript/99-Bottles-of-Beer b/Lang/SkookumScript/99-Bottles-of-Beer new file mode 120000 index 0000000000..92fdb3483f --- /dev/null +++ b/Lang/SkookumScript/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/SkookumScript \ No newline at end of file diff --git a/Lang/SkookumScript/Binary-digits b/Lang/SkookumScript/Binary-digits new file mode 120000 index 0000000000..5ebca14513 --- /dev/null +++ b/Lang/SkookumScript/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/SkookumScript \ No newline at end of file diff --git a/Lang/SkookumScript/Fibonacci-sequence b/Lang/SkookumScript/Fibonacci-sequence new file mode 120000 index 0000000000..4755515c28 --- /dev/null +++ b/Lang/SkookumScript/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/SkookumScript \ No newline at end of file diff --git a/Lang/SkookumScript/FizzBuzz b/Lang/SkookumScript/FizzBuzz new file mode 120000 index 0000000000..678ef85f8e --- /dev/null +++ b/Lang/SkookumScript/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/SkookumScript \ No newline at end of file diff --git a/Lang/SkookumScript/Hello-world-Text b/Lang/SkookumScript/Hello-world-Text new file mode 120000 index 0000000000..218ab84c7f --- /dev/null +++ b/Lang/SkookumScript/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/SkookumScript \ No newline at end of file diff --git a/Lang/SkookumScript/Logical-operations b/Lang/SkookumScript/Logical-operations new file mode 120000 index 0000000000..e937ed5342 --- /dev/null +++ b/Lang/SkookumScript/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/SkookumScript \ No newline at end of file diff --git a/Lang/SkookumScript/README b/Lang/SkookumScript/README new file mode 100644 index 0000000000..0cd242e4c1 --- /dev/null +++ b/Lang/SkookumScript/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:SkookumScript diff --git a/Lang/SmileBASIC/00DESCRIPTION b/Lang/SmileBASIC/00DESCRIPTION new file mode 100644 index 0000000000..4d3d27c049 --- /dev/null +++ b/Lang/SmileBASIC/00DESCRIPTION @@ -0,0 +1 @@ +{{stub}}{{language}} \ No newline at end of file diff --git a/Lang/SmileBASIC/A+B b/Lang/SmileBASIC/A+B new file mode 120000 index 0000000000..3264668e8e --- /dev/null +++ b/Lang/SmileBASIC/A+B @@ -0,0 +1 @@ +../../Task/A+B/SmileBASIC \ No newline at end of file diff --git a/Lang/SmileBASIC/Hello-world-Text b/Lang/SmileBASIC/Hello-world-Text new file mode 120000 index 0000000000..bce62858d3 --- /dev/null +++ b/Lang/SmileBASIC/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/SmileBASIC \ No newline at end of file diff --git a/Lang/SmileBASIC/README b/Lang/SmileBASIC/README new file mode 100644 index 0000000000..69a98952d1 --- /dev/null +++ b/Lang/SmileBASIC/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:SmileBASIC diff --git a/Lang/SoneKing-Assembly/00DESCRIPTION b/Lang/SoneKing-Assembly/00DESCRIPTION new file mode 100644 index 0000000000..e875301c99 --- /dev/null +++ b/Lang/SoneKing-Assembly/00DESCRIPTION @@ -0,0 +1,9 @@ +{{stub}} +{{language +|exec=machine +|gc=no +|checking=dynamic +|tags=asm +}} + +'''SoneKing Assembly''' is a SoneKing's version of assembly. SoneKing Assembly can be both compiled and interpreted, though compiling it is recommended for speed/optimizing purposes. \ No newline at end of file diff --git a/Lang/SoneKing-Assembly/Hello-world-Text b/Lang/SoneKing-Assembly/Hello-world-Text new file mode 120000 index 0000000000..744c9e0cec --- /dev/null +++ b/Lang/SoneKing-Assembly/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/SoneKing-Assembly \ No newline at end of file diff --git a/Lang/SoneKing-Assembly/README b/Lang/SoneKing-Assembly/README new file mode 100644 index 0000000000..878e01d441 --- /dev/null +++ b/Lang/SoneKing-Assembly/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:SoneKing_Assembly diff --git a/Lang/Sparkling/00DESCRIPTION b/Lang/Sparkling/00DESCRIPTION new file mode 100644 index 0000000000..93e3ea21f6 --- /dev/null +++ b/Lang/Sparkling/00DESCRIPTION @@ -0,0 +1,113 @@ +{{stub}}{{language}} + +Sparkling is an embeddable, extensible, dynamically and strictly typed, C-like scripting language. Created by Árpád Goretity (a. k. a. H2CO3) in late 2013, the aim of the language is to provide an easy-to-use, easy-to-embed, portable scripting engine suited for various purposes. + +== Design and heritage == + +The design, syntax and semantics of Sparkling have been influenced by several popular languages, such as C, Python, Lua and JavaScript (the latter being mostly negatively credited). This implies that parts of the language have a lot in common with these technologies. For example, its syntax should be familiar for someone having coded in C or JavaScript, the strict but dynamic type system resembles that of Python, and the "drop-in" library nature of the implementation was admittedly inspired by Lua. + +Quite a few design decisions oppose the architecture of the aforementioned languages, though. For example, in contrast with most popular scripting languages, Sparkling has two numeric types. It operates not only on floating-point numbers, but on integers as well. Operations involving both floating-point and integral operands have well-defined semantics, similar to that in C. + +Another rarely seen feature is the obligation to declare each local variable used, and the lack of (implied) global variables. All local variables must be declared before they can be referred to (read or written). Undeclared names are assumed to be globals (for practical reasons, i. e. because of the lack of header files), although global objects cannot be modified (they are always constants). The goal of this behavior is to minimize programmer errors and bugs arising out of forgotten declarations and interfering globals. + +== The reference implementation == + +The reference implementation is written in portable C89: "portable" in the sense that it tries to follow the ANSI C International Standard (C89) as strictly as possible. It does not mean, however, that the entire source is compatible with C++. The public API can be used from within a C++ program, though. + +Another aspect of portableness or platform-independence is that the Sparkling engine tries to make use of a bunch of convenient libraries in order to improve user experience. For instance, the REPL optionally uses the well-known readline library - if available - in order to provide basic line editing capabilities. Or, on OS X and iOS, the parser and runtime support library conditionally provide Objective-C bindings, so it's possible to call Objective-C methods directly from Sparkling, with proper Objective-C syntax. Neither of these features are required, though, nor do they impose a strong dependency on either libreadline or libobjc. The build system tries to guess if they are available and configures compilation accordingly. + +The reference implementation is currently hosted on GitHub, at H2CO3/Sparkling[http://github.com/H2CO3/Sparkling]. + +== Syntax and semantics == + +Sparkling borrows most of its syntax from C and a tiny bit from JavaScript. Semantics also follow a - hopefully - "intuitive" or "expected" convention, so that they're easier to grasp, especially for someone who has programmed before in C, C++, JavaScript or a similar language. + +The basic "Hello world" program looks like: + +print("Hello world!"); + +A somewhat more complex (unnecessarily complex for this purpose) version demonstrates some more language elements: + +extern helloWorldString = "Hello, world!"; + +let printMessage = fn (msg) { + let numCharsWritten = printf("%s\n", msg); + stdout.printf("%d characters written\n", numCharsWritten); +}; + +printMessage(helloWorldString); + +return 0; + +The output of this program is: + +
+$ spn hello.spn
+Hello, world!
+14 characters written
+$
+
+ +=== Fundamental language features === + +==== Types ==== +Sparkling is a dynamically but strictly typed language. Typically, binary operators operate on values of the same type only, which is enforced by runtime checks. Standard library functions type-check their arguments as well. There are 7 types in the language: +* Nil ("nil"): the empty value. It has only one possible value: nil. It indicates the absence of any other meaningful value. It is the result of array indexing by a key that is not found, the return value of functions that don't return anything explicitly, the default initial value of local variables, and the value of missing function arguments. +* Boolean ("bool"): Sparkling has a proper Boolean (true/false) type. Conditions of the if statement and loops and logical operators require their condition to evaluate to a Boolean value (otherwise, a runtime error is raised -- there are no implicit conversions to Booleans). +* Number ("number"): either a signed integer (C's long type) or a double-precision floating-point number. The only type of implicit conversion in the language is between integers and floating-point numbers (if an arithmetic operator has an integer and a floating-point operand, it will treat both values as floating-point and it will produce a floating-point result as well.) +* String ("string"): a sequence of bytes, which is not necessarily a human-readable string (it can contain arbitrary binary data). When exposed through the C API, a terminating 0 byte is always appended to the end of string. It does not count against the length of the string object, but it makes standard C functions to operate on Sparkling strings easily. +* Array ("array"): Simple integer-indexed array. Arrays are mutable. Arrays are bounds-checked (an out-of-bounds access causes a runtime error). +* Hash tables ("hashmap"): Mutable associative container. The type of its keys and values can be of any type, but indexing by nil or by the floating-point NaN value is not permitted. +* Function ("function"): in Sparkling, functions are first-class values. They can be passed to functions as arguments and returned by functions. There is a literal syntax for creating - possibly unnamed - function objects. Sparkling has lexical closures, so functions capture variables (by value) from outer scopes. All functions are variadic; it is not an error to call a function with more or less arguments than the number of arguments it is defined with. +* User information objects ("userinfo"): in order to facilitate the creation of third-party extension libraries, Sparkling has a "joker" data type, the user info. User info objects have two subtypes: weak and strong. Weak user info values hold an arbitrary, unmanaged, generic C pointer (void *), while strong user info objects contain a managed, reference-counted Sparkling object of an user-defined "class". (The Sparkling API makes it possible for users to define their own classes -- memory-intensive built-in objects like strings and arrays already use this mechanism for managing memory.) + +Being a rudimentary feature of reflection, Sparkling supports querying the type of an object at runtime, using the typeof operator. + +==== Variables ==== + +==== Expressions ==== + +==== Statements ==== + + +==== Functions ==== + +A full language tutorial is available in the official documentation[https://github.com/H2CO3/Sparkling/blob/master/doc/tutorial.md]. + +== The standard library == + +Similarly to most modern languages, the Sparkling distribution comes with a bunch of utility and run-time support functions bundled in various "packages" of the Sparkling standard library. These packages can be loaded separately by the host program (i. e. the native environment that runs the Sparkling interpreter); in the default mode, however, all standard functions are loaded at the beginning of a Sparkling session (represented by an SpnContext object, from an API point of view). Library functions are not special in the sense that they are just normal native extension functions. There is one exception, though: standard library functions assume the use of the context API, and as such, they require their user info argument to point to a valid SpnContext object. This is done so that these functions can use the error reporting facilities of the virtual machine. + +The currently available standard packages are: + +* I/O routines (writing/reading to/from standard streams and files) +* String manipulation: searching for and creating substrings, creating formatted strings, etc. +* Array and associative array manipulation, including sorting, searching and functional-style list processing, such as map() and reduce() +* Floating-point, integral and complex mathematical functions +* Shell and environment access (including system date and time), and access to the Sparkling API itself (e. g. compiling to bytecode, stack traces, etc.) + +== Implementation == + +Sparkling is an interpreted language, featuring a simple two-pass compiler and a register-based virtual machine. The compiler consists of a purely recursive descent parser and an almost naive (overwhelmingly non-optimizing) code generator, which directly generates bytecode for the VM. The compiler and the parser communicate using a right-leaning, binary abstract syntax tree (AST). The REPL also contains a disassembler which can convert bytecode into an assembly-like, human-readable textual representation. + +Despite the fact that the reference implementation imposes an interpreted nature on the language, there are plans aiming to create a just-in-time (JIT) compiler back-end that produces native executable code (rather than bytecode targeting the VM). The implementation of the REPL also features a "compiler" option (-c), which converts Sparkling source files into bytecode files. The format of the bytecode is not portable, so such an "object file" runs only on the platform/architecture it has been compiled on. This is done like so for simplicity and performance reasons: for example, floating-point and integer constants are stored in the bytecode as they are represented in memory, so that there needn't be any - potentially expensive and/or inconvenient to implement - runtime conversions. + +Although the primary goal of Sparkling is to be used as an extension language, there is a separate, stand-alone program that comes with the source as well. It contains an interactive interpreter (REPL, read-eval-print loop), a compiler and a disassembler. + +== Performance == + +The reference implementation, being an interpreted language, doesn't have performance comparable to statically-typed, natively compiled or JITed languages. However, its speed is quite decent, and is mostly comparable to that of Lua, which is often considered the fastest interpreted scripting language available. + +== Extensibility == + +Users can write and load native extension functions with the aid of the Sparkling C API. Extension functions must be written in C (or in C++ with external C linkage, or any language that supports C linkage and calling conventions), and they must follow a predefined signature, which makes it possible for the Sparkling virtual machine to call such a function. The signature of a native extension function is the following: + +int native_ext_fn(SpnValue *retVal, int argc, SpnValue *argv, void *context); + +Function arguments are passed in an array of Sparkling value (SpnValue) objects, and the return value of a function - as seen by a Sparkling script - should be moved into place using a pointer to another SpnValue. The (actual, integer) return value of the native function determines whether the virtual machine continues the execution of a program (zero) or raises a runtime exception (non-zero). + +The use of compiled, platform-dependent, native dynamic libraries is a work in progress. It is desired that they be added to the library with support for conditional compilation, in the same way libreadline and libobjc is used by the engine. This would mean that on systems which support dynamic loading and expose a C API, users will be able to benefit from the use of pre-compiled libraries, meanwhile on platforms that do not support dynamic code loading, this feature would not impose an irresolvable dependency, so Sparkling could continue to run on those platforms as well, without the ability to load dynamic libraries. + +== Debugging == + +Apart from the already mentioned disassembler, the virtual machine provides a basic stack tracing feature, which can be accessed using the C API and, through a standard library function called backtrace, from a Sparkling program itself. Efforts are being made to extend the bytecode format with basic debugging information (filename and line numbers). This would make it possible to integrate a native debugger into the REPL and expose a debugger API to the users of the library. \ No newline at end of file diff --git a/Lang/Sparkling/100-doors b/Lang/Sparkling/100-doors new file mode 120000 index 0000000000..f69fe407b1 --- /dev/null +++ b/Lang/Sparkling/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/99-Bottles-of-Beer b/Lang/Sparkling/99-Bottles-of-Beer new file mode 120000 index 0000000000..0998712424 --- /dev/null +++ b/Lang/Sparkling/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Anonymous-recursion b/Lang/Sparkling/Anonymous-recursion new file mode 120000 index 0000000000..7d39304018 --- /dev/null +++ b/Lang/Sparkling/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Apply-a-callback-to-an-array b/Lang/Sparkling/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..84d9918a9e --- /dev/null +++ b/Lang/Sparkling/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Closures-Value-capture b/Lang/Sparkling/Closures-Value-capture new file mode 120000 index 0000000000..bf26e50bc4 --- /dev/null +++ b/Lang/Sparkling/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Conjugate-transpose b/Lang/Sparkling/Conjugate-transpose new file mode 120000 index 0000000000..8d8921c271 --- /dev/null +++ b/Lang/Sparkling/Conjugate-transpose @@ -0,0 +1 @@ +../../Task/Conjugate-transpose/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Count-in-octal b/Lang/Sparkling/Count-in-octal new file mode 120000 index 0000000000..ef555a0ea1 --- /dev/null +++ b/Lang/Sparkling/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Empty-program b/Lang/Sparkling/Empty-program new file mode 120000 index 0000000000..519287810d --- /dev/null +++ b/Lang/Sparkling/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Greatest-common-divisor b/Lang/Sparkling/Greatest-common-divisor new file mode 120000 index 0000000000..4284e2a071 --- /dev/null +++ b/Lang/Sparkling/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Guess-the-number-With-feedback b/Lang/Sparkling/Guess-the-number-With-feedback new file mode 120000 index 0000000000..84bdc9b3df --- /dev/null +++ b/Lang/Sparkling/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Hash-from-two-arrays b/Lang/Sparkling/Hash-from-two-arrays new file mode 120000 index 0000000000..7ea3dbc777 --- /dev/null +++ b/Lang/Sparkling/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Hello-world-Text b/Lang/Sparkling/Hello-world-Text new file mode 120000 index 0000000000..3563c1376c --- /dev/null +++ b/Lang/Sparkling/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Higher-order-functions b/Lang/Sparkling/Higher-order-functions new file mode 120000 index 0000000000..28be4bddb8 --- /dev/null +++ b/Lang/Sparkling/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Identity-matrix b/Lang/Sparkling/Identity-matrix new file mode 120000 index 0000000000..7e07e726af --- /dev/null +++ b/Lang/Sparkling/Identity-matrix @@ -0,0 +1 @@ +../../Task/Identity-matrix/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Increment-a-numerical-string b/Lang/Sparkling/Increment-a-numerical-string new file mode 120000 index 0000000000..e0754cca40 --- /dev/null +++ b/Lang/Sparkling/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Input-loop b/Lang/Sparkling/Input-loop new file mode 120000 index 0000000000..d496d44556 --- /dev/null +++ b/Lang/Sparkling/Input-loop @@ -0,0 +1 @@ +../../Task/Input-loop/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Integer-comparison b/Lang/Sparkling/Integer-comparison new file mode 120000 index 0000000000..08bab020c6 --- /dev/null +++ b/Lang/Sparkling/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Least-common-multiple b/Lang/Sparkling/Least-common-multiple new file mode 120000 index 0000000000..abd264cbbf --- /dev/null +++ b/Lang/Sparkling/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Linear-congruential-generator b/Lang/Sparkling/Linear-congruential-generator new file mode 120000 index 0000000000..65c9e10cdc --- /dev/null +++ b/Lang/Sparkling/Linear-congruential-generator @@ -0,0 +1 @@ +../../Task/Linear-congruential-generator/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Loops-Do-while b/Lang/Sparkling/Loops-Do-while new file mode 120000 index 0000000000..033efaff53 --- /dev/null +++ b/Lang/Sparkling/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Loops-Downward-for b/Lang/Sparkling/Loops-Downward-for new file mode 120000 index 0000000000..8952fb5c2d --- /dev/null +++ b/Lang/Sparkling/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Loops-For b/Lang/Sparkling/Loops-For new file mode 120000 index 0000000000..11647e249b --- /dev/null +++ b/Lang/Sparkling/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Loops-Foreach b/Lang/Sparkling/Loops-Foreach new file mode 120000 index 0000000000..339aca8296 --- /dev/null +++ b/Lang/Sparkling/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Loops-Infinite b/Lang/Sparkling/Loops-Infinite new file mode 120000 index 0000000000..6d84044567 --- /dev/null +++ b/Lang/Sparkling/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Loops-While b/Lang/Sparkling/Loops-While new file mode 120000 index 0000000000..85bd9a1ef9 --- /dev/null +++ b/Lang/Sparkling/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Man-or-boy-test b/Lang/Sparkling/Man-or-boy-test new file mode 120000 index 0000000000..e18e0c89a6 --- /dev/null +++ b/Lang/Sparkling/Man-or-boy-test @@ -0,0 +1 @@ +../../Task/Man-or-boy-test/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Matrix-transposition b/Lang/Sparkling/Matrix-transposition new file mode 120000 index 0000000000..23f8a3e4df --- /dev/null +++ b/Lang/Sparkling/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/N-queens-problem b/Lang/Sparkling/N-queens-problem new file mode 120000 index 0000000000..9f85f751d2 --- /dev/null +++ b/Lang/Sparkling/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/README b/Lang/Sparkling/README new file mode 100644 index 0000000000..6e48297ed9 --- /dev/null +++ b/Lang/Sparkling/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Sparkling diff --git a/Lang/Sparkling/Read-a-file-line-by-line b/Lang/Sparkling/Read-a-file-line-by-line new file mode 120000 index 0000000000..1b961580f0 --- /dev/null +++ b/Lang/Sparkling/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Read-entire-file b/Lang/Sparkling/Read-entire-file new file mode 120000 index 0000000000..8590258716 --- /dev/null +++ b/Lang/Sparkling/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Real-constants-and-functions b/Lang/Sparkling/Real-constants-and-functions new file mode 120000 index 0000000000..1c1778ac5d --- /dev/null +++ b/Lang/Sparkling/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Remove-duplicate-elements b/Lang/Sparkling/Remove-duplicate-elements new file mode 120000 index 0000000000..7997e368c3 --- /dev/null +++ b/Lang/Sparkling/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Repeat-a-string b/Lang/Sparkling/Repeat-a-string new file mode 120000 index 0000000000..2d67e0a5d5 --- /dev/null +++ b/Lang/Sparkling/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Reverse-words-in-a-string b/Lang/Sparkling/Reverse-words-in-a-string new file mode 120000 index 0000000000..694584e918 --- /dev/null +++ b/Lang/Sparkling/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Roots-of-unity b/Lang/Sparkling/Roots-of-unity new file mode 120000 index 0000000000..b13793e474 --- /dev/null +++ b/Lang/Sparkling/Roots-of-unity @@ -0,0 +1 @@ +../../Task/Roots-of-unity/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Runtime-evaluation b/Lang/Sparkling/Runtime-evaluation new file mode 120000 index 0000000000..8420393bd6 --- /dev/null +++ b/Lang/Sparkling/Runtime-evaluation @@ -0,0 +1 @@ +../../Task/Runtime-evaluation/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Sort-an-integer-array b/Lang/Sparkling/Sort-an-integer-array new file mode 120000 index 0000000000..cde18ec66a --- /dev/null +++ b/Lang/Sparkling/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/String-concatenation b/Lang/Sparkling/String-concatenation new file mode 120000 index 0000000000..2c0bca0ce4 --- /dev/null +++ b/Lang/Sparkling/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/String-length b/Lang/Sparkling/String-length new file mode 120000 index 0000000000..26a74455ff --- /dev/null +++ b/Lang/Sparkling/String-length @@ -0,0 +1 @@ +../../Task/String-length/Sparkling \ No newline at end of file diff --git a/Lang/Sparkling/Sum-and-product-of-an-array b/Lang/Sparkling/Sum-and-product-of-an-array new file mode 120000 index 0000000000..da74af45bc --- /dev/null +++ b/Lang/Sparkling/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Sparkling \ No newline at end of file diff --git a/Lang/Spin/00DESCRIPTION b/Lang/Spin/00DESCRIPTION new file mode 100644 index 0000000000..020019de51 --- /dev/null +++ b/Lang/Spin/00DESCRIPTION @@ -0,0 +1,25 @@ +{{stub}} +{{language|exec=bytecode|Spin}} +Spin is the primary high level language for programming the Parallax P8X32A microcontroller. + +Typically a Spin compiler runs on a PC and produces Spin bytecode for the bytecode interpreter each P8X32A chip contains. + +Atypical: + +[http://forums.parallax.com/discussion/164101/fastspin-an-lmm-compiler-for-spin FastSpin] can compile Spin code to C, C++, LMM-PASM and COG-PASM (the native machine code of the P8X32A) and even generate C or C++ code for e.g. GCC on other systems than the Parallax P8X32A microcontroller. + +[http://www.sphinxcompiler.com/ Sphinxcompiler] and [http://forums.parallax.com/discussion/123795/spinix/p1 Spinc] are executed on operating systems running on the P8X32A. + +==Implementations== +* [https://www.parallax.com/downloads/propeller-tool-software-windows The Propeller Tool] - Parallax's original Spin IDE. +* [http://www.fnarfbargle.com/ Brad's Spin Tool] +* [http://forums.parallax.com/discussion/106401/homespun-spin-compiler-0-31-now-open-source HomeSpun] +* [http://www.sphinxcompiler.com/ Sphinxcompiler] +* Spinc (included in [http://forums.parallax.com/discussion/123795/spinix/p1 Spinix]) +* [https://github.com/parallaxinc/OpenSpin OpenSpin] +* [http://forums.parallax.com/discussion/164101/fastspin-an-lmm-compiler-for-spin FastSpin] + +==Links== +* https://www.parallax.com/sites/default/files/downloads/P8X32A-Web-PropellerManual-v1.2.pdf +* https://lamestation.atlassian.net/wiki/display/SPIN/Propeller+Spin+Manual+Home +* https://github.com/rosco-pc/propeller-wiki \ No newline at end of file diff --git a/Lang/Spin/README b/Lang/Spin/README new file mode 100644 index 0000000000..37825fcb43 --- /dev/null +++ b/Lang/Spin/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Spin diff --git a/Lang/Star/00DESCRIPTION b/Lang/Star/00DESCRIPTION new file mode 100644 index 0000000000..4d3d27c049 --- /dev/null +++ b/Lang/Star/00DESCRIPTION @@ -0,0 +1 @@ +{{stub}}{{language}} \ No newline at end of file diff --git a/Lang/Star/README b/Lang/Star/README new file mode 100644 index 0000000000..c76b026890 --- /dev/null +++ b/Lang/Star/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Star diff --git a/Lang/Swift/00DESCRIPTION b/Lang/Swift/00DESCRIPTION new file mode 100644 index 0000000000..6870507618 --- /dev/null +++ b/Lang/Swift/00DESCRIPTION @@ -0,0 +1,11 @@ +{{language|Swift +|exec=machine +|strength=strong +|checking=both +|parampass=both +|gc=reference counting +|safety=safe +|compat=nominative +|site=http://developer.apple.com/swift/ +|LCT=yes}}{{language programming paradigm|Object-oriented}} +[[wp:Swift (Apple programming language)|Swift]] is an [[object-oriented]] programming language developed by Apple Inc. for Mac OS X and iOS development. It runs on the Objective-C runtime and is mainly used with the Cocoa API. It was announced at WWDC 2014. \ No newline at end of file diff --git a/Lang/Swift/100-doors b/Lang/Swift/100-doors new file mode 120000 index 0000000000..2c2b61108e --- /dev/null +++ b/Lang/Swift/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Swift \ No newline at end of file diff --git a/Lang/Swift/24-game b/Lang/Swift/24-game new file mode 120000 index 0000000000..ce5490044a --- /dev/null +++ b/Lang/Swift/24-game @@ -0,0 +1 @@ +../../Task/24-game/Swift \ No newline at end of file diff --git a/Lang/Swift/24-game-Solve b/Lang/Swift/24-game-Solve new file mode 120000 index 0000000000..51e7bbb2ba --- /dev/null +++ b/Lang/Swift/24-game-Solve @@ -0,0 +1 @@ +../../Task/24-game-Solve/Swift \ No newline at end of file diff --git a/Lang/Swift/9-billion-names-of-God-the-integer b/Lang/Swift/9-billion-names-of-God-the-integer new file mode 120000 index 0000000000..262696a861 --- /dev/null +++ b/Lang/Swift/9-billion-names-of-God-the-integer @@ -0,0 +1 @@ +../../Task/9-billion-names-of-God-the-integer/Swift \ No newline at end of file diff --git a/Lang/Swift/99-Bottles-of-Beer b/Lang/Swift/99-Bottles-of-Beer new file mode 120000 index 0000000000..ccf6d2358a --- /dev/null +++ b/Lang/Swift/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Swift \ No newline at end of file diff --git a/Lang/Swift/A+B b/Lang/Swift/A+B new file mode 120000 index 0000000000..a8ee8819d9 --- /dev/null +++ b/Lang/Swift/A+B @@ -0,0 +1 @@ +../../Task/A+B/Swift \ No newline at end of file diff --git a/Lang/Swift/ABC-Problem b/Lang/Swift/ABC-Problem new file mode 120000 index 0000000000..52b7621000 --- /dev/null +++ b/Lang/Swift/ABC-Problem @@ -0,0 +1 @@ +../../Task/ABC-Problem/Swift \ No newline at end of file diff --git a/Lang/Swift/AKS-test-for-primes b/Lang/Swift/AKS-test-for-primes new file mode 120000 index 0000000000..9661905ff1 --- /dev/null +++ b/Lang/Swift/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/Swift \ No newline at end of file diff --git a/Lang/Swift/Abundant,-deficient-and-perfect-number-classifications b/Lang/Swift/Abundant,-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..52ab5cd002 --- /dev/null +++ b/Lang/Swift/Abundant,-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant,-deficient-and-perfect-number-classifications/Swift \ No newline at end of file diff --git a/Lang/Swift/Accumulator-factory b/Lang/Swift/Accumulator-factory new file mode 120000 index 0000000000..dfb6e0ee4c --- /dev/null +++ b/Lang/Swift/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/Swift \ No newline at end of file diff --git a/Lang/Swift/Ackermann-function b/Lang/Swift/Ackermann-function new file mode 120000 index 0000000000..f35e9edcd0 --- /dev/null +++ b/Lang/Swift/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Swift \ No newline at end of file diff --git a/Lang/Swift/Active-object b/Lang/Swift/Active-object new file mode 120000 index 0000000000..0c284b7f76 --- /dev/null +++ b/Lang/Swift/Active-object @@ -0,0 +1 @@ +../../Task/Active-object/Swift \ No newline at end of file diff --git a/Lang/Swift/Add-a-variable-to-a-class-instance-at-runtime b/Lang/Swift/Add-a-variable-to-a-class-instance-at-runtime new file mode 120000 index 0000000000..06063b3338 --- /dev/null +++ b/Lang/Swift/Add-a-variable-to-a-class-instance-at-runtime @@ -0,0 +1 @@ +../../Task/Add-a-variable-to-a-class-instance-at-runtime/Swift \ No newline at end of file diff --git a/Lang/Swift/Address-of-a-variable b/Lang/Swift/Address-of-a-variable new file mode 120000 index 0000000000..f82ae8239c --- /dev/null +++ b/Lang/Swift/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/Swift \ No newline at end of file diff --git a/Lang/Swift/Amicable-pairs b/Lang/Swift/Amicable-pairs new file mode 120000 index 0000000000..e309e5ab22 --- /dev/null +++ b/Lang/Swift/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/Swift \ No newline at end of file diff --git a/Lang/Swift/Anagrams b/Lang/Swift/Anagrams new file mode 120000 index 0000000000..b57ce47f70 --- /dev/null +++ b/Lang/Swift/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/Swift \ No newline at end of file diff --git a/Lang/Swift/Anonymous-recursion b/Lang/Swift/Anonymous-recursion new file mode 120000 index 0000000000..62aac94d19 --- /dev/null +++ b/Lang/Swift/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/Swift \ No newline at end of file diff --git a/Lang/Swift/Apply-a-callback-to-an-array b/Lang/Swift/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..9ed7895d6a --- /dev/null +++ b/Lang/Swift/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Swift \ No newline at end of file diff --git a/Lang/Swift/Arithmetic-Complex b/Lang/Swift/Arithmetic-Complex new file mode 120000 index 0000000000..c5b9ed536b --- /dev/null +++ b/Lang/Swift/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/Swift \ No newline at end of file diff --git a/Lang/Swift/Array-concatenation b/Lang/Swift/Array-concatenation new file mode 120000 index 0000000000..f4ca37b021 --- /dev/null +++ b/Lang/Swift/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Swift \ No newline at end of file diff --git a/Lang/Swift/Arrays b/Lang/Swift/Arrays new file mode 120000 index 0000000000..16db4e631a --- /dev/null +++ b/Lang/Swift/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Swift \ No newline at end of file diff --git a/Lang/Swift/Assertions b/Lang/Swift/Assertions new file mode 120000 index 0000000000..4c0ff9c5dc --- /dev/null +++ b/Lang/Swift/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Swift \ No newline at end of file diff --git a/Lang/Swift/Associative-array-Creation b/Lang/Swift/Associative-array-Creation new file mode 120000 index 0000000000..ce675124a9 --- /dev/null +++ b/Lang/Swift/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Swift \ No newline at end of file diff --git a/Lang/Swift/Associative-array-Iteration b/Lang/Swift/Associative-array-Iteration new file mode 120000 index 0000000000..f603f137c9 --- /dev/null +++ b/Lang/Swift/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Swift \ No newline at end of file diff --git a/Lang/Swift/Averages-Arithmetic-mean b/Lang/Swift/Averages-Arithmetic-mean new file mode 120000 index 0000000000..d44f2e569f --- /dev/null +++ b/Lang/Swift/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Swift \ No newline at end of file diff --git a/Lang/Swift/Balanced-brackets b/Lang/Swift/Balanced-brackets new file mode 120000 index 0000000000..963570863a --- /dev/null +++ b/Lang/Swift/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Swift \ No newline at end of file diff --git a/Lang/Swift/Binary-digits b/Lang/Swift/Binary-digits new file mode 120000 index 0000000000..c164d1e997 --- /dev/null +++ b/Lang/Swift/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Swift \ No newline at end of file diff --git a/Lang/Swift/Binary-search b/Lang/Swift/Binary-search new file mode 120000 index 0000000000..44ecb44520 --- /dev/null +++ b/Lang/Swift/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Swift \ No newline at end of file diff --git a/Lang/Swift/Bitwise-operations b/Lang/Swift/Bitwise-operations new file mode 120000 index 0000000000..fb81102f53 --- /dev/null +++ b/Lang/Swift/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/Swift \ No newline at end of file diff --git a/Lang/Swift/CRC-32 b/Lang/Swift/CRC-32 new file mode 120000 index 0000000000..ea5462acf1 --- /dev/null +++ b/Lang/Swift/CRC-32 @@ -0,0 +1 @@ +../../Task/CRC-32/Swift \ No newline at end of file diff --git a/Lang/Swift/Call-a-foreign-language-function b/Lang/Swift/Call-a-foreign-language-function new file mode 120000 index 0000000000..4495bc65b7 --- /dev/null +++ b/Lang/Swift/Call-a-foreign-language-function @@ -0,0 +1 @@ +../../Task/Call-a-foreign-language-function/Swift \ No newline at end of file diff --git a/Lang/Swift/Call-a-function b/Lang/Swift/Call-a-function new file mode 120000 index 0000000000..fcbbf97be9 --- /dev/null +++ b/Lang/Swift/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/Swift \ No newline at end of file diff --git a/Lang/Swift/Call-an-object-method b/Lang/Swift/Call-an-object-method new file mode 120000 index 0000000000..dfccd6d9f1 --- /dev/null +++ b/Lang/Swift/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/Swift \ No newline at end of file diff --git a/Lang/Swift/Case-sensitivity-of-identifiers b/Lang/Swift/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..19493b70d2 --- /dev/null +++ b/Lang/Swift/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/Swift \ No newline at end of file diff --git a/Lang/Swift/Character-codes b/Lang/Swift/Character-codes new file mode 120000 index 0000000000..f2d3fbafd6 --- /dev/null +++ b/Lang/Swift/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Swift \ No newline at end of file diff --git a/Lang/Swift/Classes b/Lang/Swift/Classes new file mode 120000 index 0000000000..990313c5a0 --- /dev/null +++ b/Lang/Swift/Classes @@ -0,0 +1 @@ +../../Task/Classes/Swift \ No newline at end of file diff --git a/Lang/Swift/Closures-Value-capture b/Lang/Swift/Closures-Value-capture new file mode 120000 index 0000000000..5ba456e521 --- /dev/null +++ b/Lang/Swift/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/Swift \ No newline at end of file diff --git a/Lang/Swift/Combinations b/Lang/Swift/Combinations new file mode 120000 index 0000000000..7c205a7c15 --- /dev/null +++ b/Lang/Swift/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/Swift \ No newline at end of file diff --git a/Lang/Swift/Combinations-with-repetitions b/Lang/Swift/Combinations-with-repetitions new file mode 120000 index 0000000000..13ebeb085f --- /dev/null +++ b/Lang/Swift/Combinations-with-repetitions @@ -0,0 +1 @@ +../../Task/Combinations-with-repetitions/Swift \ No newline at end of file diff --git a/Lang/Swift/Comma-quibbling b/Lang/Swift/Comma-quibbling new file mode 120000 index 0000000000..8c75339812 --- /dev/null +++ b/Lang/Swift/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/Swift \ No newline at end of file diff --git a/Lang/Swift/Command-line-arguments b/Lang/Swift/Command-line-arguments new file mode 120000 index 0000000000..ef89a4b266 --- /dev/null +++ b/Lang/Swift/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/Swift \ No newline at end of file diff --git a/Lang/Swift/Comments b/Lang/Swift/Comments new file mode 120000 index 0000000000..0588c7f7d0 --- /dev/null +++ b/Lang/Swift/Comments @@ -0,0 +1 @@ +../../Task/Comments/Swift \ No newline at end of file diff --git a/Lang/Swift/Compound-data-type b/Lang/Swift/Compound-data-type new file mode 120000 index 0000000000..8127447c51 --- /dev/null +++ b/Lang/Swift/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/Swift \ No newline at end of file diff --git a/Lang/Swift/Concurrent-computing b/Lang/Swift/Concurrent-computing new file mode 120000 index 0000000000..54d6ac5a10 --- /dev/null +++ b/Lang/Swift/Concurrent-computing @@ -0,0 +1 @@ +../../Task/Concurrent-computing/Swift \ No newline at end of file diff --git a/Lang/Swift/Constrained-genericity b/Lang/Swift/Constrained-genericity new file mode 120000 index 0000000000..0c9a9c0c5a --- /dev/null +++ b/Lang/Swift/Constrained-genericity @@ -0,0 +1 @@ +../../Task/Constrained-genericity/Swift \ No newline at end of file diff --git a/Lang/Swift/Copy-a-string b/Lang/Swift/Copy-a-string new file mode 120000 index 0000000000..77d8d7bc96 --- /dev/null +++ b/Lang/Swift/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Swift \ No newline at end of file diff --git a/Lang/Swift/Count-in-octal b/Lang/Swift/Count-in-octal new file mode 120000 index 0000000000..930adc7aad --- /dev/null +++ b/Lang/Swift/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/Swift \ No newline at end of file diff --git a/Lang/Swift/Create-a-two-dimensional-array-at-runtime b/Lang/Swift/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..dd80b1c443 --- /dev/null +++ b/Lang/Swift/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/Swift \ No newline at end of file diff --git a/Lang/Swift/Currying b/Lang/Swift/Currying new file mode 120000 index 0000000000..3be1c8ee0a --- /dev/null +++ b/Lang/Swift/Currying @@ -0,0 +1 @@ +../../Task/Currying/Swift \ No newline at end of file diff --git a/Lang/Swift/Date-format b/Lang/Swift/Date-format new file mode 120000 index 0000000000..d06bbe3c11 --- /dev/null +++ b/Lang/Swift/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/Swift \ No newline at end of file diff --git a/Lang/Swift/Day-of-the-week b/Lang/Swift/Day-of-the-week new file mode 120000 index 0000000000..ccb86b613c --- /dev/null +++ b/Lang/Swift/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Swift \ No newline at end of file diff --git a/Lang/Swift/Delegates b/Lang/Swift/Delegates new file mode 120000 index 0000000000..d7f79caec5 --- /dev/null +++ b/Lang/Swift/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/Swift \ No newline at end of file diff --git a/Lang/Swift/Determine-if-a-string-is-numeric b/Lang/Swift/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..6703b40c49 --- /dev/null +++ b/Lang/Swift/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Swift \ No newline at end of file diff --git a/Lang/Swift/Determine-if-only-one-instance-is-running b/Lang/Swift/Determine-if-only-one-instance-is-running new file mode 120000 index 0000000000..8fc062ff1f --- /dev/null +++ b/Lang/Swift/Determine-if-only-one-instance-is-running @@ -0,0 +1 @@ +../../Task/Determine-if-only-one-instance-is-running/Swift \ No newline at end of file diff --git a/Lang/Swift/Documentation b/Lang/Swift/Documentation new file mode 120000 index 0000000000..75ca8d03d2 --- /dev/null +++ b/Lang/Swift/Documentation @@ -0,0 +1 @@ +../../Task/Documentation/Swift \ No newline at end of file diff --git a/Lang/Swift/Dot-product b/Lang/Swift/Dot-product new file mode 120000 index 0000000000..1fcfcad4c6 --- /dev/null +++ b/Lang/Swift/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Swift \ No newline at end of file diff --git a/Lang/Swift/Draw-a-sphere b/Lang/Swift/Draw-a-sphere new file mode 120000 index 0000000000..6079258ced --- /dev/null +++ b/Lang/Swift/Draw-a-sphere @@ -0,0 +1 @@ +../../Task/Draw-a-sphere/Swift \ No newline at end of file diff --git a/Lang/Swift/Empty-program b/Lang/Swift/Empty-program new file mode 120000 index 0000000000..2c1baaa481 --- /dev/null +++ b/Lang/Swift/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/Swift \ No newline at end of file diff --git a/Lang/Swift/Empty-string b/Lang/Swift/Empty-string new file mode 120000 index 0000000000..02c529f05f --- /dev/null +++ b/Lang/Swift/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Swift \ No newline at end of file diff --git a/Lang/Swift/Enumerations b/Lang/Swift/Enumerations new file mode 120000 index 0000000000..7ed5aabcf3 --- /dev/null +++ b/Lang/Swift/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/Swift \ No newline at end of file diff --git a/Lang/Swift/Ethiopian-multiplication b/Lang/Swift/Ethiopian-multiplication new file mode 120000 index 0000000000..4ee84b7795 --- /dev/null +++ b/Lang/Swift/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Swift \ No newline at end of file diff --git a/Lang/Swift/Even-or-odd b/Lang/Swift/Even-or-odd new file mode 120000 index 0000000000..de7cdf1921 --- /dev/null +++ b/Lang/Swift/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Swift \ No newline at end of file diff --git a/Lang/Swift/Exceptions b/Lang/Swift/Exceptions new file mode 120000 index 0000000000..8b401ecfab --- /dev/null +++ b/Lang/Swift/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/Swift \ No newline at end of file diff --git a/Lang/Swift/Exceptions-Catch-an-exception-thrown-in-a-nested-call b/Lang/Swift/Exceptions-Catch-an-exception-thrown-in-a-nested-call new file mode 120000 index 0000000000..be416dd9bc --- /dev/null +++ b/Lang/Swift/Exceptions-Catch-an-exception-thrown-in-a-nested-call @@ -0,0 +1 @@ +../../Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Swift \ No newline at end of file diff --git a/Lang/Swift/Execute-Brain---- b/Lang/Swift/Execute-Brain---- new file mode 120000 index 0000000000..9904c262bd --- /dev/null +++ b/Lang/Swift/Execute-Brain---- @@ -0,0 +1 @@ +../../Task/Execute-Brain----/Swift \ No newline at end of file diff --git a/Lang/Swift/Execute-a-Markov-algorithm b/Lang/Swift/Execute-a-Markov-algorithm new file mode 120000 index 0000000000..3cc809bbd1 --- /dev/null +++ b/Lang/Swift/Execute-a-Markov-algorithm @@ -0,0 +1 @@ +../../Task/Execute-a-Markov-algorithm/Swift \ No newline at end of file diff --git a/Lang/Swift/Extreme-floating-point-values b/Lang/Swift/Extreme-floating-point-values new file mode 120000 index 0000000000..81798d4ef7 --- /dev/null +++ b/Lang/Swift/Extreme-floating-point-values @@ -0,0 +1 @@ +../../Task/Extreme-floating-point-values/Swift \ No newline at end of file diff --git a/Lang/Swift/Factorial b/Lang/Swift/Factorial new file mode 120000 index 0000000000..387b35e9b1 --- /dev/null +++ b/Lang/Swift/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Swift \ No newline at end of file diff --git a/Lang/Swift/Factors-of-an-integer b/Lang/Swift/Factors-of-an-integer new file mode 120000 index 0000000000..951c31cf82 --- /dev/null +++ b/Lang/Swift/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Swift \ No newline at end of file diff --git a/Lang/Swift/Fibonacci-sequence b/Lang/Swift/Fibonacci-sequence new file mode 120000 index 0000000000..bd6f401919 --- /dev/null +++ b/Lang/Swift/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Swift \ No newline at end of file diff --git a/Lang/Swift/Filter b/Lang/Swift/Filter new file mode 120000 index 0000000000..c52ada0ad0 --- /dev/null +++ b/Lang/Swift/Filter @@ -0,0 +1 @@ +../../Task/Filter/Swift \ No newline at end of file diff --git a/Lang/Swift/First-class-functions b/Lang/Swift/First-class-functions new file mode 120000 index 0000000000..d9814f0eb5 --- /dev/null +++ b/Lang/Swift/First-class-functions @@ -0,0 +1 @@ +../../Task/First-class-functions/Swift \ No newline at end of file diff --git a/Lang/Swift/FizzBuzz b/Lang/Swift/FizzBuzz new file mode 120000 index 0000000000..a6903ad670 --- /dev/null +++ b/Lang/Swift/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Swift \ No newline at end of file diff --git a/Lang/Swift/Flatten-a-list b/Lang/Swift/Flatten-a-list new file mode 120000 index 0000000000..1f70da8f28 --- /dev/null +++ b/Lang/Swift/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Swift \ No newline at end of file diff --git a/Lang/Swift/Flipping-bits-game b/Lang/Swift/Flipping-bits-game new file mode 120000 index 0000000000..9bdb42d8b3 --- /dev/null +++ b/Lang/Swift/Flipping-bits-game @@ -0,0 +1 @@ +../../Task/Flipping-bits-game/Swift \ No newline at end of file diff --git a/Lang/Swift/Fractal-tree b/Lang/Swift/Fractal-tree new file mode 120000 index 0000000000..24f38d2e8f --- /dev/null +++ b/Lang/Swift/Fractal-tree @@ -0,0 +1 @@ +../../Task/Fractal-tree/Swift \ No newline at end of file diff --git a/Lang/Swift/Function-composition b/Lang/Swift/Function-composition new file mode 120000 index 0000000000..8eda03c153 --- /dev/null +++ b/Lang/Swift/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/Swift \ No newline at end of file diff --git a/Lang/Swift/Function-definition b/Lang/Swift/Function-definition new file mode 120000 index 0000000000..cc1539b267 --- /dev/null +++ b/Lang/Swift/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Swift \ No newline at end of file diff --git a/Lang/Swift/Generate-lower-case-ASCII-alphabet b/Lang/Swift/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..7b409d97aa --- /dev/null +++ b/Lang/Swift/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Swift \ No newline at end of file diff --git a/Lang/Swift/Generator-Exponential b/Lang/Swift/Generator-Exponential new file mode 120000 index 0000000000..8da9739c1d --- /dev/null +++ b/Lang/Swift/Generator-Exponential @@ -0,0 +1 @@ +../../Task/Generator-Exponential/Swift \ No newline at end of file diff --git a/Lang/Swift/Generic-swap b/Lang/Swift/Generic-swap new file mode 120000 index 0000000000..2563c6f346 --- /dev/null +++ b/Lang/Swift/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/Swift \ No newline at end of file diff --git a/Lang/Swift/Greatest-common-divisor b/Lang/Swift/Greatest-common-divisor new file mode 120000 index 0000000000..e70873123e --- /dev/null +++ b/Lang/Swift/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Swift \ No newline at end of file diff --git a/Lang/Swift/Greatest-element-of-a-list b/Lang/Swift/Greatest-element-of-a-list new file mode 120000 index 0000000000..63d0ad2ecf --- /dev/null +++ b/Lang/Swift/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Swift \ No newline at end of file diff --git a/Lang/Swift/Guess-the-number b/Lang/Swift/Guess-the-number new file mode 120000 index 0000000000..47acfc6973 --- /dev/null +++ b/Lang/Swift/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/Swift \ No newline at end of file diff --git a/Lang/Swift/Guess-the-number-With-feedback b/Lang/Swift/Guess-the-number-With-feedback new file mode 120000 index 0000000000..2902193860 --- /dev/null +++ b/Lang/Swift/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/Swift \ No newline at end of file diff --git a/Lang/Swift/Guess-the-number-With-feedback--player- b/Lang/Swift/Guess-the-number-With-feedback--player- new file mode 120000 index 0000000000..9a8cb79b45 --- /dev/null +++ b/Lang/Swift/Guess-the-number-With-feedback--player- @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback--player-/Swift \ No newline at end of file diff --git a/Lang/Swift/HTTP b/Lang/Swift/HTTP new file mode 120000 index 0000000000..3fdbb3b64d --- /dev/null +++ b/Lang/Swift/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/Swift \ No newline at end of file diff --git a/Lang/Swift/HTTPS b/Lang/Swift/HTTPS new file mode 120000 index 0000000000..cf9bf4a8e5 --- /dev/null +++ b/Lang/Swift/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/Swift \ No newline at end of file diff --git a/Lang/Swift/Hailstone-sequence b/Lang/Swift/Hailstone-sequence new file mode 120000 index 0000000000..0741840e79 --- /dev/null +++ b/Lang/Swift/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Swift \ No newline at end of file diff --git a/Lang/Swift/Handle-a-signal b/Lang/Swift/Handle-a-signal new file mode 120000 index 0000000000..d430fed302 --- /dev/null +++ b/Lang/Swift/Handle-a-signal @@ -0,0 +1 @@ +../../Task/Handle-a-signal/Swift \ No newline at end of file diff --git a/Lang/Swift/Happy-numbers b/Lang/Swift/Happy-numbers new file mode 120000 index 0000000000..9ba7fd4158 --- /dev/null +++ b/Lang/Swift/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/Swift \ No newline at end of file diff --git a/Lang/Swift/Hash-from-two-arrays b/Lang/Swift/Hash-from-two-arrays new file mode 120000 index 0000000000..024ab6999b --- /dev/null +++ b/Lang/Swift/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/Swift \ No newline at end of file diff --git a/Lang/Swift/Haversine-formula b/Lang/Swift/Haversine-formula new file mode 120000 index 0000000000..986fcc10a9 --- /dev/null +++ b/Lang/Swift/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/Swift \ No newline at end of file diff --git a/Lang/Swift/Hello-world-Graphical b/Lang/Swift/Hello-world-Graphical new file mode 120000 index 0000000000..6e1883641c --- /dev/null +++ b/Lang/Swift/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Swift \ No newline at end of file diff --git a/Lang/Swift/Hello-world-Line-printer b/Lang/Swift/Hello-world-Line-printer new file mode 120000 index 0000000000..421fa82769 --- /dev/null +++ b/Lang/Swift/Hello-world-Line-printer @@ -0,0 +1 @@ +../../Task/Hello-world-Line-printer/Swift \ No newline at end of file diff --git a/Lang/Swift/Hello-world-Newline-omission b/Lang/Swift/Hello-world-Newline-omission new file mode 120000 index 0000000000..9479c0677a --- /dev/null +++ b/Lang/Swift/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Swift \ No newline at end of file diff --git a/Lang/Swift/Hello-world-Standard-error b/Lang/Swift/Hello-world-Standard-error new file mode 120000 index 0000000000..bf47cc0a9f --- /dev/null +++ b/Lang/Swift/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Swift \ No newline at end of file diff --git a/Lang/Swift/Hello-world-Text b/Lang/Swift/Hello-world-Text new file mode 120000 index 0000000000..6e8e091c9d --- /dev/null +++ b/Lang/Swift/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Swift \ No newline at end of file diff --git a/Lang/Swift/Heronian-triangles b/Lang/Swift/Heronian-triangles new file mode 120000 index 0000000000..a716522cab --- /dev/null +++ b/Lang/Swift/Heronian-triangles @@ -0,0 +1 @@ +../../Task/Heronian-triangles/Swift \ No newline at end of file diff --git a/Lang/Swift/Higher-order-functions b/Lang/Swift/Higher-order-functions new file mode 120000 index 0000000000..03d7de730f --- /dev/null +++ b/Lang/Swift/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/Swift \ No newline at end of file diff --git a/Lang/Swift/History-variables b/Lang/Swift/History-variables new file mode 120000 index 0000000000..7366c4de50 --- /dev/null +++ b/Lang/Swift/History-variables @@ -0,0 +1 @@ +../../Task/History-variables/Swift \ No newline at end of file diff --git a/Lang/Swift/Hofstadter-Conway-$10,000-sequence b/Lang/Swift/Hofstadter-Conway-$10,000-sequence new file mode 120000 index 0000000000..b968183733 --- /dev/null +++ b/Lang/Swift/Hofstadter-Conway-$10,000-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Conway-$10,000-sequence/Swift \ No newline at end of file diff --git a/Lang/Swift/Horners-rule-for-polynomial-evaluation b/Lang/Swift/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..95749d7b5a --- /dev/null +++ b/Lang/Swift/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/Swift \ No newline at end of file diff --git a/Lang/Swift/Hostname b/Lang/Swift/Hostname new file mode 120000 index 0000000000..46b4719a99 --- /dev/null +++ b/Lang/Swift/Hostname @@ -0,0 +1 @@ +../../Task/Hostname/Swift \ No newline at end of file diff --git a/Lang/Swift/Huffman-coding b/Lang/Swift/Huffman-coding new file mode 120000 index 0000000000..71b6ff5235 --- /dev/null +++ b/Lang/Swift/Huffman-coding @@ -0,0 +1 @@ +../../Task/Huffman-coding/Swift \ No newline at end of file diff --git a/Lang/Swift/I-before-E-except-after-C b/Lang/Swift/I-before-E-except-after-C new file mode 120000 index 0000000000..ca9deb78f3 --- /dev/null +++ b/Lang/Swift/I-before-E-except-after-C @@ -0,0 +1 @@ +../../Task/I-before-E-except-after-C/Swift \ No newline at end of file diff --git a/Lang/Swift/Increment-a-numerical-string b/Lang/Swift/Increment-a-numerical-string new file mode 120000 index 0000000000..630667be48 --- /dev/null +++ b/Lang/Swift/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Swift \ No newline at end of file diff --git a/Lang/Swift/Infinity b/Lang/Swift/Infinity new file mode 120000 index 0000000000..5bdb1cdd47 --- /dev/null +++ b/Lang/Swift/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/Swift \ No newline at end of file diff --git a/Lang/Swift/Inheritance-Multiple b/Lang/Swift/Inheritance-Multiple new file mode 120000 index 0000000000..bdec5892ce --- /dev/null +++ b/Lang/Swift/Inheritance-Multiple @@ -0,0 +1 @@ +../../Task/Inheritance-Multiple/Swift \ No newline at end of file diff --git a/Lang/Swift/Inheritance-Single b/Lang/Swift/Inheritance-Single new file mode 120000 index 0000000000..346d4c884b --- /dev/null +++ b/Lang/Swift/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/Swift \ No newline at end of file diff --git a/Lang/Swift/Integer-comparison b/Lang/Swift/Integer-comparison new file mode 120000 index 0000000000..5a64224ccd --- /dev/null +++ b/Lang/Swift/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Swift \ No newline at end of file diff --git a/Lang/Swift/Integer-overflow b/Lang/Swift/Integer-overflow new file mode 120000 index 0000000000..20cfb9632a --- /dev/null +++ b/Lang/Swift/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/Swift \ No newline at end of file diff --git a/Lang/Swift/Integer-sequence b/Lang/Swift/Integer-sequence new file mode 120000 index 0000000000..315bc8af53 --- /dev/null +++ b/Lang/Swift/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Swift \ No newline at end of file diff --git a/Lang/Swift/Inverted-syntax b/Lang/Swift/Inverted-syntax new file mode 120000 index 0000000000..f327316424 --- /dev/null +++ b/Lang/Swift/Inverted-syntax @@ -0,0 +1 @@ +../../Task/Inverted-syntax/Swift \ No newline at end of file diff --git a/Lang/Swift/JSON b/Lang/Swift/JSON new file mode 120000 index 0000000000..66a8d21785 --- /dev/null +++ b/Lang/Swift/JSON @@ -0,0 +1 @@ +../../Task/JSON/Swift \ No newline at end of file diff --git a/Lang/Swift/Jensens-Device b/Lang/Swift/Jensens-Device new file mode 120000 index 0000000000..1e03e58ac6 --- /dev/null +++ b/Lang/Swift/Jensens-Device @@ -0,0 +1 @@ +../../Task/Jensens-Device/Swift \ No newline at end of file diff --git a/Lang/Swift/Josephus-problem b/Lang/Swift/Josephus-problem new file mode 120000 index 0000000000..a57e89f5ef --- /dev/null +++ b/Lang/Swift/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/Swift \ No newline at end of file diff --git a/Lang/Swift/Knuth-shuffle b/Lang/Swift/Knuth-shuffle new file mode 120000 index 0000000000..d804af7f40 --- /dev/null +++ b/Lang/Swift/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Swift \ No newline at end of file diff --git a/Lang/Swift/Knuths-algorithm-S b/Lang/Swift/Knuths-algorithm-S new file mode 120000 index 0000000000..2d898f7ef3 --- /dev/null +++ b/Lang/Swift/Knuths-algorithm-S @@ -0,0 +1 @@ +../../Task/Knuths-algorithm-S/Swift \ No newline at end of file diff --git a/Lang/Swift/LZW-compression b/Lang/Swift/LZW-compression new file mode 120000 index 0000000000..1a83f9c940 --- /dev/null +++ b/Lang/Swift/LZW-compression @@ -0,0 +1 @@ +../../Task/LZW-compression/Swift \ No newline at end of file diff --git a/Lang/Swift/Langtons-ant b/Lang/Swift/Langtons-ant new file mode 120000 index 0000000000..cc6ccb4094 --- /dev/null +++ b/Lang/Swift/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/Swift \ No newline at end of file diff --git a/Lang/Swift/Leap-year b/Lang/Swift/Leap-year new file mode 120000 index 0000000000..375db7fe7b --- /dev/null +++ b/Lang/Swift/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Swift \ No newline at end of file diff --git a/Lang/Swift/Least-common-multiple b/Lang/Swift/Least-common-multiple new file mode 120000 index 0000000000..24a7fdef60 --- /dev/null +++ b/Lang/Swift/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/Swift \ No newline at end of file diff --git a/Lang/Swift/Levenshtein-distance b/Lang/Swift/Levenshtein-distance new file mode 120000 index 0000000000..4a5c2794f9 --- /dev/null +++ b/Lang/Swift/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Swift \ No newline at end of file diff --git a/Lang/Swift/Linear-congruential-generator b/Lang/Swift/Linear-congruential-generator new file mode 120000 index 0000000000..7a69cca795 --- /dev/null +++ b/Lang/Swift/Linear-congruential-generator @@ -0,0 +1 @@ +../../Task/Linear-congruential-generator/Swift \ No newline at end of file diff --git a/Lang/Swift/Literals-Floating-point b/Lang/Swift/Literals-Floating-point new file mode 120000 index 0000000000..866d5239dc --- /dev/null +++ b/Lang/Swift/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/Swift \ No newline at end of file diff --git a/Lang/Swift/Literals-Integer b/Lang/Swift/Literals-Integer new file mode 120000 index 0000000000..aac6b92184 --- /dev/null +++ b/Lang/Swift/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/Swift \ No newline at end of file diff --git a/Lang/Swift/Literals-String b/Lang/Swift/Literals-String new file mode 120000 index 0000000000..38bc8ae368 --- /dev/null +++ b/Lang/Swift/Literals-String @@ -0,0 +1 @@ +../../Task/Literals-String/Swift \ No newline at end of file diff --git a/Lang/Swift/Logical-operations b/Lang/Swift/Logical-operations new file mode 120000 index 0000000000..9654c15267 --- /dev/null +++ b/Lang/Swift/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Swift \ No newline at end of file diff --git a/Lang/Swift/Longest-common-subsequence b/Lang/Swift/Longest-common-subsequence new file mode 120000 index 0000000000..7aed156605 --- /dev/null +++ b/Lang/Swift/Longest-common-subsequence @@ -0,0 +1 @@ +../../Task/Longest-common-subsequence/Swift \ No newline at end of file diff --git a/Lang/Swift/Loop-over-multiple-arrays-simultaneously b/Lang/Swift/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..a878c68817 --- /dev/null +++ b/Lang/Swift/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Swift \ No newline at end of file diff --git a/Lang/Swift/Loops-Break b/Lang/Swift/Loops-Break new file mode 120000 index 0000000000..77523bfd04 --- /dev/null +++ b/Lang/Swift/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Swift \ No newline at end of file diff --git a/Lang/Swift/Loops-Continue b/Lang/Swift/Loops-Continue new file mode 120000 index 0000000000..09fc26721c --- /dev/null +++ b/Lang/Swift/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Swift \ No newline at end of file diff --git a/Lang/Swift/Loops-Do-while b/Lang/Swift/Loops-Do-while new file mode 120000 index 0000000000..68ec1d22f5 --- /dev/null +++ b/Lang/Swift/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Swift \ No newline at end of file diff --git a/Lang/Swift/Loops-Downward-for b/Lang/Swift/Loops-Downward-for new file mode 120000 index 0000000000..030f93c895 --- /dev/null +++ b/Lang/Swift/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Swift \ No newline at end of file diff --git a/Lang/Swift/Loops-For b/Lang/Swift/Loops-For new file mode 120000 index 0000000000..c771e31750 --- /dev/null +++ b/Lang/Swift/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Swift \ No newline at end of file diff --git a/Lang/Swift/Loops-For-with-a-specified-step b/Lang/Swift/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..d2a3a1cb4b --- /dev/null +++ b/Lang/Swift/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Swift \ No newline at end of file diff --git a/Lang/Swift/Loops-Foreach b/Lang/Swift/Loops-Foreach new file mode 120000 index 0000000000..994708ed14 --- /dev/null +++ b/Lang/Swift/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Swift \ No newline at end of file diff --git a/Lang/Swift/Loops-Infinite b/Lang/Swift/Loops-Infinite new file mode 120000 index 0000000000..b5bf2f93ab --- /dev/null +++ b/Lang/Swift/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Swift \ No newline at end of file diff --git a/Lang/Swift/Loops-N-plus-one-half b/Lang/Swift/Loops-N-plus-one-half new file mode 120000 index 0000000000..13daebcb58 --- /dev/null +++ b/Lang/Swift/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Swift \ No newline at end of file diff --git a/Lang/Swift/Loops-Nested b/Lang/Swift/Loops-Nested new file mode 120000 index 0000000000..1043153568 --- /dev/null +++ b/Lang/Swift/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/Swift \ No newline at end of file diff --git a/Lang/Swift/Loops-While b/Lang/Swift/Loops-While new file mode 120000 index 0000000000..6e5d058bdf --- /dev/null +++ b/Lang/Swift/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Swift \ No newline at end of file diff --git a/Lang/Swift/Luhn-test-of-credit-card-numbers b/Lang/Swift/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..7da6adfb6e --- /dev/null +++ b/Lang/Swift/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Swift \ No newline at end of file diff --git a/Lang/Swift/MD5-Implementation b/Lang/Swift/MD5-Implementation new file mode 120000 index 0000000000..657af81f02 --- /dev/null +++ b/Lang/Swift/MD5-Implementation @@ -0,0 +1 @@ +../../Task/MD5-Implementation/Swift \ No newline at end of file diff --git a/Lang/Swift/Man-or-boy-test b/Lang/Swift/Man-or-boy-test new file mode 120000 index 0000000000..538f01a500 --- /dev/null +++ b/Lang/Swift/Man-or-boy-test @@ -0,0 +1 @@ +../../Task/Man-or-boy-test/Swift \ No newline at end of file diff --git a/Lang/Swift/Maze-generation b/Lang/Swift/Maze-generation new file mode 120000 index 0000000000..0731e1452f --- /dev/null +++ b/Lang/Swift/Maze-generation @@ -0,0 +1 @@ +../../Task/Maze-generation/Swift \ No newline at end of file diff --git a/Lang/Swift/Monte-Carlo-methods b/Lang/Swift/Monte-Carlo-methods new file mode 120000 index 0000000000..1984c49f04 --- /dev/null +++ b/Lang/Swift/Monte-Carlo-methods @@ -0,0 +1 @@ +../../Task/Monte-Carlo-methods/Swift \ No newline at end of file diff --git a/Lang/Swift/Multiple-distinct-objects b/Lang/Swift/Multiple-distinct-objects new file mode 120000 index 0000000000..eb75a1fd84 --- /dev/null +++ b/Lang/Swift/Multiple-distinct-objects @@ -0,0 +1 @@ +../../Task/Multiple-distinct-objects/Swift \ No newline at end of file diff --git a/Lang/Swift/Mutual-recursion b/Lang/Swift/Mutual-recursion new file mode 120000 index 0000000000..3ce8ee9b4f --- /dev/null +++ b/Lang/Swift/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/Swift \ No newline at end of file diff --git a/Lang/Swift/Named-parameters b/Lang/Swift/Named-parameters new file mode 120000 index 0000000000..1718e07f54 --- /dev/null +++ b/Lang/Swift/Named-parameters @@ -0,0 +1 @@ +../../Task/Named-parameters/Swift \ No newline at end of file diff --git a/Lang/Swift/Non-decimal-radices-Convert b/Lang/Swift/Non-decimal-radices-Convert new file mode 120000 index 0000000000..567a3cac79 --- /dev/null +++ b/Lang/Swift/Non-decimal-radices-Convert @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Convert/Swift \ No newline at end of file diff --git a/Lang/Swift/Nth b/Lang/Swift/Nth new file mode 120000 index 0000000000..ebfead0bbf --- /dev/null +++ b/Lang/Swift/Nth @@ -0,0 +1 @@ +../../Task/Nth/Swift \ No newline at end of file diff --git a/Lang/Swift/Null-object b/Lang/Swift/Null-object new file mode 120000 index 0000000000..32d31c83f2 --- /dev/null +++ b/Lang/Swift/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/Swift \ No newline at end of file diff --git a/Lang/Swift/One-of-n-lines-in-a-file b/Lang/Swift/One-of-n-lines-in-a-file new file mode 120000 index 0000000000..500c2ae32c --- /dev/null +++ b/Lang/Swift/One-of-n-lines-in-a-file @@ -0,0 +1 @@ +../../Task/One-of-n-lines-in-a-file/Swift \ No newline at end of file diff --git a/Lang/Swift/Optional-parameters b/Lang/Swift/Optional-parameters new file mode 120000 index 0000000000..b6f652de6b --- /dev/null +++ b/Lang/Swift/Optional-parameters @@ -0,0 +1 @@ +../../Task/Optional-parameters/Swift \ No newline at end of file diff --git a/Lang/Swift/Order-two-numerical-lists b/Lang/Swift/Order-two-numerical-lists new file mode 120000 index 0000000000..ff62cce5cc --- /dev/null +++ b/Lang/Swift/Order-two-numerical-lists @@ -0,0 +1 @@ +../../Task/Order-two-numerical-lists/Swift \ No newline at end of file diff --git a/Lang/Swift/Ordered-words b/Lang/Swift/Ordered-words new file mode 120000 index 0000000000..0db7ba8ef9 --- /dev/null +++ b/Lang/Swift/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Swift \ No newline at end of file diff --git a/Lang/Swift/Palindrome-detection b/Lang/Swift/Palindrome-detection new file mode 120000 index 0000000000..fc6f659b60 --- /dev/null +++ b/Lang/Swift/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Swift \ No newline at end of file diff --git a/Lang/Swift/Pangram-checker b/Lang/Swift/Pangram-checker new file mode 120000 index 0000000000..f4ce56eafc --- /dev/null +++ b/Lang/Swift/Pangram-checker @@ -0,0 +1 @@ +../../Task/Pangram-checker/Swift \ No newline at end of file diff --git a/Lang/Swift/Parametric-polymorphism b/Lang/Swift/Parametric-polymorphism new file mode 120000 index 0000000000..5fc1173336 --- /dev/null +++ b/Lang/Swift/Parametric-polymorphism @@ -0,0 +1 @@ +../../Task/Parametric-polymorphism/Swift \ No newline at end of file diff --git a/Lang/Swift/Parsing-RPN-calculator-algorithm b/Lang/Swift/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..69e2d7b48a --- /dev/null +++ b/Lang/Swift/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/Swift \ No newline at end of file diff --git a/Lang/Swift/Parsing-Shunting-yard-algorithm b/Lang/Swift/Parsing-Shunting-yard-algorithm new file mode 120000 index 0000000000..08c82598d6 --- /dev/null +++ b/Lang/Swift/Parsing-Shunting-yard-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-Shunting-yard-algorithm/Swift \ No newline at end of file diff --git a/Lang/Swift/Pattern-matching b/Lang/Swift/Pattern-matching new file mode 120000 index 0000000000..0258d935b6 --- /dev/null +++ b/Lang/Swift/Pattern-matching @@ -0,0 +1 @@ +../../Task/Pattern-matching/Swift \ No newline at end of file diff --git a/Lang/Swift/Perfect-numbers b/Lang/Swift/Perfect-numbers new file mode 120000 index 0000000000..2e67281de1 --- /dev/null +++ b/Lang/Swift/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/Swift \ No newline at end of file diff --git a/Lang/Swift/Permutations b/Lang/Swift/Permutations new file mode 120000 index 0000000000..b4ead516ea --- /dev/null +++ b/Lang/Swift/Permutations @@ -0,0 +1 @@ +../../Task/Permutations/Swift \ No newline at end of file diff --git a/Lang/Swift/Pick-random-element b/Lang/Swift/Pick-random-element new file mode 120000 index 0000000000..d4c4e94a8f --- /dev/null +++ b/Lang/Swift/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/Swift \ No newline at end of file diff --git a/Lang/Swift/Play-recorded-sounds b/Lang/Swift/Play-recorded-sounds new file mode 120000 index 0000000000..297f980ac1 --- /dev/null +++ b/Lang/Swift/Play-recorded-sounds @@ -0,0 +1 @@ +../../Task/Play-recorded-sounds/Swift \ No newline at end of file diff --git a/Lang/Swift/Playing-cards b/Lang/Swift/Playing-cards new file mode 120000 index 0000000000..ba517e9d7b --- /dev/null +++ b/Lang/Swift/Playing-cards @@ -0,0 +1 @@ +../../Task/Playing-cards/Swift \ No newline at end of file diff --git a/Lang/Swift/Polymorphic-copy b/Lang/Swift/Polymorphic-copy new file mode 120000 index 0000000000..9179b304c6 --- /dev/null +++ b/Lang/Swift/Polymorphic-copy @@ -0,0 +1 @@ +../../Task/Polymorphic-copy/Swift \ No newline at end of file diff --git a/Lang/Swift/Polymorphism b/Lang/Swift/Polymorphism new file mode 120000 index 0000000000..c29794d617 --- /dev/null +++ b/Lang/Swift/Polymorphism @@ -0,0 +1 @@ +../../Task/Polymorphism/Swift \ No newline at end of file diff --git a/Lang/Swift/Primality-by-trial-division b/Lang/Swift/Primality-by-trial-division new file mode 120000 index 0000000000..f08eab66f1 --- /dev/null +++ b/Lang/Swift/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/Swift \ No newline at end of file diff --git a/Lang/Swift/Priority-queue b/Lang/Swift/Priority-queue new file mode 120000 index 0000000000..9dab01f4d2 --- /dev/null +++ b/Lang/Swift/Priority-queue @@ -0,0 +1 @@ +../../Task/Priority-queue/Swift \ No newline at end of file diff --git a/Lang/Swift/Problem-of-Apollonius b/Lang/Swift/Problem-of-Apollonius new file mode 120000 index 0000000000..49a64a3757 --- /dev/null +++ b/Lang/Swift/Problem-of-Apollonius @@ -0,0 +1 @@ +../../Task/Problem-of-Apollonius/Swift \ No newline at end of file diff --git a/Lang/Swift/Pythagorean-triples b/Lang/Swift/Pythagorean-triples new file mode 120000 index 0000000000..a7921a2d1e --- /dev/null +++ b/Lang/Swift/Pythagorean-triples @@ -0,0 +1 @@ +../../Task/Pythagorean-triples/Swift \ No newline at end of file diff --git a/Lang/Swift/Quickselect-algorithm b/Lang/Swift/Quickselect-algorithm new file mode 120000 index 0000000000..f21548fd20 --- /dev/null +++ b/Lang/Swift/Quickselect-algorithm @@ -0,0 +1 @@ +../../Task/Quickselect-algorithm/Swift \ No newline at end of file diff --git a/Lang/Swift/Quine b/Lang/Swift/Quine new file mode 120000 index 0000000000..7a3a633f47 --- /dev/null +++ b/Lang/Swift/Quine @@ -0,0 +1 @@ +../../Task/Quine/Swift \ No newline at end of file diff --git a/Lang/Swift/README b/Lang/Swift/README new file mode 100644 index 0000000000..d3e06c3963 --- /dev/null +++ b/Lang/Swift/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Swift diff --git a/Lang/Swift/RIPEMD-160 b/Lang/Swift/RIPEMD-160 new file mode 120000 index 0000000000..cb7735ccc7 --- /dev/null +++ b/Lang/Swift/RIPEMD-160 @@ -0,0 +1 @@ +../../Task/RIPEMD-160/Swift \ No newline at end of file diff --git a/Lang/Swift/Range-extraction b/Lang/Swift/Range-extraction new file mode 120000 index 0000000000..aab426a728 --- /dev/null +++ b/Lang/Swift/Range-extraction @@ -0,0 +1 @@ +../../Task/Range-extraction/Swift \ No newline at end of file diff --git a/Lang/Swift/Read-entire-file b/Lang/Swift/Read-entire-file new file mode 120000 index 0000000000..aa81fc1b2a --- /dev/null +++ b/Lang/Swift/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Swift \ No newline at end of file diff --git a/Lang/Swift/Real-constants-and-functions b/Lang/Swift/Real-constants-and-functions new file mode 120000 index 0000000000..5b3e1559fc --- /dev/null +++ b/Lang/Swift/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/Swift \ No newline at end of file diff --git a/Lang/Swift/Reduced-row-echelon-form b/Lang/Swift/Reduced-row-echelon-form new file mode 120000 index 0000000000..86232195a8 --- /dev/null +++ b/Lang/Swift/Reduced-row-echelon-form @@ -0,0 +1 @@ +../../Task/Reduced-row-echelon-form/Swift \ No newline at end of file diff --git a/Lang/Swift/Regular-expressions b/Lang/Swift/Regular-expressions new file mode 120000 index 0000000000..99dcaab47a --- /dev/null +++ b/Lang/Swift/Regular-expressions @@ -0,0 +1 @@ +../../Task/Regular-expressions/Swift \ No newline at end of file diff --git a/Lang/Swift/Remove-duplicate-elements b/Lang/Swift/Remove-duplicate-elements new file mode 120000 index 0000000000..3f9ecea32c --- /dev/null +++ b/Lang/Swift/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/Swift \ No newline at end of file diff --git a/Lang/Swift/Repeat-a-string b/Lang/Swift/Repeat-a-string new file mode 120000 index 0000000000..4322ec12f5 --- /dev/null +++ b/Lang/Swift/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Swift \ No newline at end of file diff --git a/Lang/Swift/Return-multiple-values b/Lang/Swift/Return-multiple-values new file mode 120000 index 0000000000..777ca903ad --- /dev/null +++ b/Lang/Swift/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/Swift \ No newline at end of file diff --git a/Lang/Swift/Reverse-a-string b/Lang/Swift/Reverse-a-string new file mode 120000 index 0000000000..14f173f391 --- /dev/null +++ b/Lang/Swift/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Swift \ No newline at end of file diff --git a/Lang/Swift/Reverse-words-in-a-string b/Lang/Swift/Reverse-words-in-a-string new file mode 120000 index 0000000000..ed8c5794ab --- /dev/null +++ b/Lang/Swift/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/Swift \ No newline at end of file diff --git a/Lang/Swift/Roman-numerals-Decode b/Lang/Swift/Roman-numerals-Decode new file mode 120000 index 0000000000..ec46205e90 --- /dev/null +++ b/Lang/Swift/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/Swift \ No newline at end of file diff --git a/Lang/Swift/Roman-numerals-Encode b/Lang/Swift/Roman-numerals-Encode new file mode 120000 index 0000000000..920fd56776 --- /dev/null +++ b/Lang/Swift/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/Swift \ No newline at end of file diff --git a/Lang/Swift/Rot-13 b/Lang/Swift/Rot-13 new file mode 120000 index 0000000000..21f29e523c --- /dev/null +++ b/Lang/Swift/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Swift \ No newline at end of file diff --git a/Lang/Swift/Run-length-encoding b/Lang/Swift/Run-length-encoding new file mode 120000 index 0000000000..a062e6bc93 --- /dev/null +++ b/Lang/Swift/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/Swift \ No newline at end of file diff --git a/Lang/Swift/Runge-Kutta-method b/Lang/Swift/Runge-Kutta-method new file mode 120000 index 0000000000..e7e092a718 --- /dev/null +++ b/Lang/Swift/Runge-Kutta-method @@ -0,0 +1 @@ +../../Task/Runge-Kutta-method/Swift \ No newline at end of file diff --git a/Lang/Swift/Search-a-list b/Lang/Swift/Search-a-list new file mode 120000 index 0000000000..8df57e4f6e --- /dev/null +++ b/Lang/Swift/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Swift \ No newline at end of file diff --git a/Lang/Swift/Semiprime b/Lang/Swift/Semiprime new file mode 120000 index 0000000000..15091937ff --- /dev/null +++ b/Lang/Swift/Semiprime @@ -0,0 +1 @@ +../../Task/Semiprime/Swift \ No newline at end of file diff --git a/Lang/Swift/Sequence-of-primes-by-Trial-Division b/Lang/Swift/Sequence-of-primes-by-Trial-Division new file mode 120000 index 0000000000..da631b5207 --- /dev/null +++ b/Lang/Swift/Sequence-of-primes-by-Trial-Division @@ -0,0 +1 @@ +../../Task/Sequence-of-primes-by-Trial-Division/Swift \ No newline at end of file diff --git a/Lang/Swift/Set b/Lang/Swift/Set new file mode 120000 index 0000000000..e6bca5748e --- /dev/null +++ b/Lang/Swift/Set @@ -0,0 +1 @@ +../../Task/Set/Swift \ No newline at end of file diff --git a/Lang/Swift/Short-circuit-evaluation b/Lang/Swift/Short-circuit-evaluation new file mode 120000 index 0000000000..5ee7c3145c --- /dev/null +++ b/Lang/Swift/Short-circuit-evaluation @@ -0,0 +1 @@ +../../Task/Short-circuit-evaluation/Swift \ No newline at end of file diff --git a/Lang/Swift/Sierpinski-carpet b/Lang/Swift/Sierpinski-carpet new file mode 120000 index 0000000000..78bc277bd5 --- /dev/null +++ b/Lang/Swift/Sierpinski-carpet @@ -0,0 +1 @@ +../../Task/Sierpinski-carpet/Swift \ No newline at end of file diff --git a/Lang/Swift/Sierpinski-triangle b/Lang/Swift/Sierpinski-triangle new file mode 120000 index 0000000000..028b90bec6 --- /dev/null +++ b/Lang/Swift/Sierpinski-triangle @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle/Swift \ No newline at end of file diff --git a/Lang/Swift/Sieve-of-Eratosthenes b/Lang/Swift/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..4718d6be72 --- /dev/null +++ b/Lang/Swift/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/Swift \ No newline at end of file diff --git a/Lang/Swift/Sleep b/Lang/Swift/Sleep new file mode 120000 index 0000000000..1c2e120d4a --- /dev/null +++ b/Lang/Swift/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Swift \ No newline at end of file diff --git a/Lang/Swift/Sort-an-integer-array b/Lang/Swift/Sort-an-integer-array new file mode 120000 index 0000000000..a4e8925fce --- /dev/null +++ b/Lang/Swift/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Swift \ No newline at end of file diff --git a/Lang/Swift/Sort-disjoint-sublist b/Lang/Swift/Sort-disjoint-sublist new file mode 120000 index 0000000000..d565d1c98b --- /dev/null +++ b/Lang/Swift/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/Swift \ No newline at end of file diff --git a/Lang/Swift/Sort-using-a-custom-comparator b/Lang/Swift/Sort-using-a-custom-comparator new file mode 120000 index 0000000000..1a42c4f728 --- /dev/null +++ b/Lang/Swift/Sort-using-a-custom-comparator @@ -0,0 +1 @@ +../../Task/Sort-using-a-custom-comparator/Swift \ No newline at end of file diff --git a/Lang/Swift/Sorting-algorithms-Bogosort b/Lang/Swift/Sorting-algorithms-Bogosort new file mode 120000 index 0000000000..15b406a6c1 --- /dev/null +++ b/Lang/Swift/Sorting-algorithms-Bogosort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bogosort/Swift \ No newline at end of file diff --git a/Lang/Swift/Sorting-algorithms-Bubble-sort b/Lang/Swift/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..179cf980e6 --- /dev/null +++ b/Lang/Swift/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/Swift \ No newline at end of file diff --git a/Lang/Swift/Sorting-algorithms-Comb-sort b/Lang/Swift/Sorting-algorithms-Comb-sort new file mode 120000 index 0000000000..c3df655bc3 --- /dev/null +++ b/Lang/Swift/Sorting-algorithms-Comb-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Comb-sort/Swift \ No newline at end of file diff --git a/Lang/Swift/Sorting-algorithms-Heapsort b/Lang/Swift/Sorting-algorithms-Heapsort new file mode 120000 index 0000000000..7cb6dc98d2 --- /dev/null +++ b/Lang/Swift/Sorting-algorithms-Heapsort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Heapsort/Swift \ No newline at end of file diff --git a/Lang/Swift/Sorting-algorithms-Insertion-sort b/Lang/Swift/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..c4f73a66da --- /dev/null +++ b/Lang/Swift/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/Swift \ No newline at end of file diff --git a/Lang/Swift/Sorting-algorithms-Merge-sort b/Lang/Swift/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..378708167e --- /dev/null +++ b/Lang/Swift/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/Swift \ No newline at end of file diff --git a/Lang/Swift/Sorting-algorithms-Pancake-sort b/Lang/Swift/Sorting-algorithms-Pancake-sort new file mode 120000 index 0000000000..e43025e988 --- /dev/null +++ b/Lang/Swift/Sorting-algorithms-Pancake-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Pancake-sort/Swift \ No newline at end of file diff --git a/Lang/Swift/Sorting-algorithms-Quicksort b/Lang/Swift/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..a5ce726310 --- /dev/null +++ b/Lang/Swift/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Swift \ No newline at end of file diff --git a/Lang/Swift/Sorting-algorithms-Selection-sort b/Lang/Swift/Sorting-algorithms-Selection-sort new file mode 120000 index 0000000000..a9830bb2e3 --- /dev/null +++ b/Lang/Swift/Sorting-algorithms-Selection-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Selection-sort/Swift \ No newline at end of file diff --git a/Lang/Swift/Sorting-algorithms-Shell-sort b/Lang/Swift/Sorting-algorithms-Shell-sort new file mode 120000 index 0000000000..8fa926332d --- /dev/null +++ b/Lang/Swift/Sorting-algorithms-Shell-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Shell-sort/Swift \ No newline at end of file diff --git a/Lang/Swift/Sorting-algorithms-Sleep-sort b/Lang/Swift/Sorting-algorithms-Sleep-sort new file mode 120000 index 0000000000..0b34034667 --- /dev/null +++ b/Lang/Swift/Sorting-algorithms-Sleep-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Sleep-sort/Swift \ No newline at end of file diff --git a/Lang/Swift/Sorting-algorithms-Stooge-sort b/Lang/Swift/Sorting-algorithms-Stooge-sort new file mode 120000 index 0000000000..96b91f0104 --- /dev/null +++ b/Lang/Swift/Sorting-algorithms-Stooge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Stooge-sort/Swift \ No newline at end of file diff --git a/Lang/Swift/Speech-synthesis b/Lang/Swift/Speech-synthesis new file mode 120000 index 0000000000..d8003198b7 --- /dev/null +++ b/Lang/Swift/Speech-synthesis @@ -0,0 +1 @@ +../../Task/Speech-synthesis/Swift \ No newline at end of file diff --git a/Lang/Swift/Stable-marriage-problem b/Lang/Swift/Stable-marriage-problem new file mode 120000 index 0000000000..5e0c5eb77f --- /dev/null +++ b/Lang/Swift/Stable-marriage-problem @@ -0,0 +1 @@ +../../Task/Stable-marriage-problem/Swift \ No newline at end of file diff --git a/Lang/Swift/Stack b/Lang/Swift/Stack new file mode 120000 index 0000000000..78e1d23e5c --- /dev/null +++ b/Lang/Swift/Stack @@ -0,0 +1 @@ +../../Task/Stack/Swift \ No newline at end of file diff --git a/Lang/Swift/Stair-climbing-puzzle b/Lang/Swift/Stair-climbing-puzzle new file mode 120000 index 0000000000..80acafd5bd --- /dev/null +++ b/Lang/Swift/Stair-climbing-puzzle @@ -0,0 +1 @@ +../../Task/Stair-climbing-puzzle/Swift \ No newline at end of file diff --git a/Lang/Swift/String-append b/Lang/Swift/String-append new file mode 120000 index 0000000000..399edc8bb7 --- /dev/null +++ b/Lang/Swift/String-append @@ -0,0 +1 @@ +../../Task/String-append/Swift \ No newline at end of file diff --git a/Lang/Swift/String-case b/Lang/Swift/String-case new file mode 120000 index 0000000000..05f3555e28 --- /dev/null +++ b/Lang/Swift/String-case @@ -0,0 +1 @@ +../../Task/String-case/Swift \ No newline at end of file diff --git a/Lang/Swift/String-comparison b/Lang/Swift/String-comparison new file mode 120000 index 0000000000..425bccad96 --- /dev/null +++ b/Lang/Swift/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/Swift \ No newline at end of file diff --git a/Lang/Swift/String-concatenation b/Lang/Swift/String-concatenation new file mode 120000 index 0000000000..97400e45df --- /dev/null +++ b/Lang/Swift/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Swift \ No newline at end of file diff --git a/Lang/Swift/String-interpolation--included- b/Lang/Swift/String-interpolation--included- new file mode 120000 index 0000000000..7452a8c0a2 --- /dev/null +++ b/Lang/Swift/String-interpolation--included- @@ -0,0 +1 @@ +../../Task/String-interpolation--included-/Swift \ No newline at end of file diff --git a/Lang/Swift/String-length b/Lang/Swift/String-length new file mode 120000 index 0000000000..0eaa56b912 --- /dev/null +++ b/Lang/Swift/String-length @@ -0,0 +1 @@ +../../Task/String-length/Swift \ No newline at end of file diff --git a/Lang/Swift/String-matching b/Lang/Swift/String-matching new file mode 120000 index 0000000000..ed324c275e --- /dev/null +++ b/Lang/Swift/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/Swift \ No newline at end of file diff --git a/Lang/Swift/String-prepend b/Lang/Swift/String-prepend new file mode 120000 index 0000000000..f3ceb1fe92 --- /dev/null +++ b/Lang/Swift/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Swift \ No newline at end of file diff --git a/Lang/Swift/Strip-a-set-of-characters-from-a-string b/Lang/Swift/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..181944e99a --- /dev/null +++ b/Lang/Swift/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Swift \ No newline at end of file diff --git a/Lang/Swift/Substring b/Lang/Swift/Substring new file mode 120000 index 0000000000..b45fe3886d --- /dev/null +++ b/Lang/Swift/Substring @@ -0,0 +1 @@ +../../Task/Substring/Swift \ No newline at end of file diff --git a/Lang/Swift/Substring-Top-and-tail b/Lang/Swift/Substring-Top-and-tail new file mode 120000 index 0000000000..10a1059443 --- /dev/null +++ b/Lang/Swift/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/Swift \ No newline at end of file diff --git a/Lang/Swift/Sudoku b/Lang/Swift/Sudoku new file mode 120000 index 0000000000..b6d911d223 --- /dev/null +++ b/Lang/Swift/Sudoku @@ -0,0 +1 @@ +../../Task/Sudoku/Swift \ No newline at end of file diff --git a/Lang/Swift/Sum-and-product-of-an-array b/Lang/Swift/Sum-and-product-of-an-array new file mode 120000 index 0000000000..d8f4a79acd --- /dev/null +++ b/Lang/Swift/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Swift \ No newline at end of file diff --git a/Lang/Swift/Sum-digits-of-an-integer b/Lang/Swift/Sum-digits-of-an-integer new file mode 120000 index 0000000000..a3d1ed203c --- /dev/null +++ b/Lang/Swift/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/Swift \ No newline at end of file diff --git a/Lang/Swift/Sum-of-a-series b/Lang/Swift/Sum-of-a-series new file mode 120000 index 0000000000..7604860bb1 --- /dev/null +++ b/Lang/Swift/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Swift \ No newline at end of file diff --git a/Lang/Swift/Sum-of-squares b/Lang/Swift/Sum-of-squares new file mode 120000 index 0000000000..e837220c20 --- /dev/null +++ b/Lang/Swift/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/Swift \ No newline at end of file diff --git a/Lang/Swift/Symmetric-difference b/Lang/Swift/Symmetric-difference new file mode 120000 index 0000000000..356624c52f --- /dev/null +++ b/Lang/Swift/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/Swift \ No newline at end of file diff --git a/Lang/Swift/Synchronous-concurrency b/Lang/Swift/Synchronous-concurrency new file mode 120000 index 0000000000..42fd031fda --- /dev/null +++ b/Lang/Swift/Synchronous-concurrency @@ -0,0 +1 @@ +../../Task/Synchronous-concurrency/Swift \ No newline at end of file diff --git a/Lang/Swift/System-time b/Lang/Swift/System-time new file mode 120000 index 0000000000..34e34e6f12 --- /dev/null +++ b/Lang/Swift/System-time @@ -0,0 +1 @@ +../../Task/System-time/Swift \ No newline at end of file diff --git a/Lang/Swift/Take-notes-on-the-command-line b/Lang/Swift/Take-notes-on-the-command-line new file mode 120000 index 0000000000..2d31d3f3c9 --- /dev/null +++ b/Lang/Swift/Take-notes-on-the-command-line @@ -0,0 +1 @@ +../../Task/Take-notes-on-the-command-line/Swift \ No newline at end of file diff --git a/Lang/Swift/Test-a-function b/Lang/Swift/Test-a-function new file mode 120000 index 0000000000..cf5f8a5128 --- /dev/null +++ b/Lang/Swift/Test-a-function @@ -0,0 +1 @@ +../../Task/Test-a-function/Swift \ No newline at end of file diff --git a/Lang/Swift/The-Twelve-Days-of-Christmas b/Lang/Swift/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..220d724610 --- /dev/null +++ b/Lang/Swift/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/Swift \ No newline at end of file diff --git a/Lang/Swift/Tokenize-a-string b/Lang/Swift/Tokenize-a-string new file mode 120000 index 0000000000..6b72eafd8f --- /dev/null +++ b/Lang/Swift/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Swift \ No newline at end of file diff --git a/Lang/Swift/Towers-of-Hanoi b/Lang/Swift/Towers-of-Hanoi new file mode 120000 index 0000000000..d3381903c6 --- /dev/null +++ b/Lang/Swift/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Swift \ No newline at end of file diff --git a/Lang/Swift/Trabb-Pardo-Knuth-algorithm b/Lang/Swift/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..7db3a02a82 --- /dev/null +++ b/Lang/Swift/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/Swift \ No newline at end of file diff --git a/Lang/Swift/Twelve-statements b/Lang/Swift/Twelve-statements new file mode 120000 index 0000000000..f95b188529 --- /dev/null +++ b/Lang/Swift/Twelve-statements @@ -0,0 +1 @@ +../../Task/Twelve-statements/Swift \ No newline at end of file diff --git a/Lang/Swift/URL-decoding b/Lang/Swift/URL-decoding new file mode 120000 index 0000000000..1e23a26125 --- /dev/null +++ b/Lang/Swift/URL-decoding @@ -0,0 +1 @@ +../../Task/URL-decoding/Swift \ No newline at end of file diff --git a/Lang/Swift/Unicode-variable-names b/Lang/Swift/Unicode-variable-names new file mode 120000 index 0000000000..727fe30417 --- /dev/null +++ b/Lang/Swift/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/Swift \ No newline at end of file diff --git a/Lang/Swift/User-input-Text b/Lang/Swift/User-input-Text new file mode 120000 index 0000000000..a1443293f6 --- /dev/null +++ b/Lang/Swift/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/Swift \ No newline at end of file diff --git a/Lang/Swift/Variable-size-Get b/Lang/Swift/Variable-size-Get new file mode 120000 index 0000000000..2cfccd5ed1 --- /dev/null +++ b/Lang/Swift/Variable-size-Get @@ -0,0 +1 @@ +../../Task/Variable-size-Get/Swift \ No newline at end of file diff --git a/Lang/Swift/Variables b/Lang/Swift/Variables new file mode 120000 index 0000000000..ff75ea40bc --- /dev/null +++ b/Lang/Swift/Variables @@ -0,0 +1 @@ +../../Task/Variables/Swift \ No newline at end of file diff --git a/Lang/Swift/Variadic-function b/Lang/Swift/Variadic-function new file mode 120000 index 0000000000..296b995c93 --- /dev/null +++ b/Lang/Swift/Variadic-function @@ -0,0 +1 @@ +../../Task/Variadic-function/Swift \ No newline at end of file diff --git a/Lang/Swift/Walk-a-directory-Recursively b/Lang/Swift/Walk-a-directory-Recursively new file mode 120000 index 0000000000..03202b8a94 --- /dev/null +++ b/Lang/Swift/Walk-a-directory-Recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Recursively/Swift \ No newline at end of file diff --git a/Lang/Swift/Y-combinator b/Lang/Swift/Y-combinator new file mode 120000 index 0000000000..98df097d58 --- /dev/null +++ b/Lang/Swift/Y-combinator @@ -0,0 +1 @@ +../../Task/Y-combinator/Swift \ No newline at end of file diff --git a/Lang/Swift/Zero-to-the-zero-power b/Lang/Swift/Zero-to-the-zero-power new file mode 120000 index 0000000000..981735ebf5 --- /dev/null +++ b/Lang/Swift/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/Swift \ No newline at end of file diff --git a/Lang/Symsyn/00DESCRIPTION b/Lang/Symsyn/00DESCRIPTION new file mode 100644 index 0000000000..a8c4f306af --- /dev/null +++ b/Lang/Symsyn/00DESCRIPTION @@ -0,0 +1,15 @@ +{{stub}}{{language|symsyn}} + +Symsyn is a simple programming language and realtime multitasking operating environment. A Symsyn program consists of one or more instructions. Each instruction maps directly to a Pascal procedure which resides in the runtime emulator. It can accomodate a virtually unlimited number of new instructions. There are three data types: 64 bit word, 8 bit character, and Ansi strings. + +Features: + +Re-assignable version specific opcodes. +Extensible architecture designed to accommodate new instructions. +Written in Pascal - any Pascal procedure can be reduced to an instruction. +Interprogram communication (synchronization and data passing) instructions. +Bit, character, and word manipulation. +TCP/IP support. + + +More info at : http://qsys.us/symsyn \ No newline at end of file diff --git a/Lang/Symsyn/99-Bottles-of-Beer b/Lang/Symsyn/99-Bottles-of-Beer new file mode 120000 index 0000000000..2b05b061db --- /dev/null +++ b/Lang/Symsyn/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Symsyn \ No newline at end of file diff --git a/Lang/Symsyn/Empty-program b/Lang/Symsyn/Empty-program new file mode 120000 index 0000000000..73cbdf1eb6 --- /dev/null +++ b/Lang/Symsyn/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/Symsyn \ No newline at end of file diff --git a/Lang/Symsyn/Even-or-odd b/Lang/Symsyn/Even-or-odd new file mode 120000 index 0000000000..8583c08be5 --- /dev/null +++ b/Lang/Symsyn/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Symsyn \ No newline at end of file diff --git a/Lang/Symsyn/FizzBuzz b/Lang/Symsyn/FizzBuzz new file mode 120000 index 0000000000..c3534c800e --- /dev/null +++ b/Lang/Symsyn/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Symsyn \ No newline at end of file diff --git a/Lang/Symsyn/Hello-world-Text b/Lang/Symsyn/Hello-world-Text new file mode 120000 index 0000000000..eec13649ec --- /dev/null +++ b/Lang/Symsyn/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Symsyn \ No newline at end of file diff --git a/Lang/Symsyn/Pernicious-numbers b/Lang/Symsyn/Pernicious-numbers new file mode 120000 index 0000000000..0ce3a546a8 --- /dev/null +++ b/Lang/Symsyn/Pernicious-numbers @@ -0,0 +1 @@ +../../Task/Pernicious-numbers/Symsyn \ No newline at end of file diff --git a/Lang/Symsyn/README b/Lang/Symsyn/README new file mode 100644 index 0000000000..c71810f063 --- /dev/null +++ b/Lang/Symsyn/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Symsyn diff --git a/Lang/Symsyn/Sockets b/Lang/Symsyn/Sockets new file mode 120000 index 0000000000..1e004851b7 --- /dev/null +++ b/Lang/Symsyn/Sockets @@ -0,0 +1 @@ +../../Task/Sockets/Symsyn \ No newline at end of file diff --git a/Lang/Symsyn/Trabb-Pardo-Knuth-algorithm b/Lang/Symsyn/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..efececb2c3 --- /dev/null +++ b/Lang/Symsyn/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/Symsyn \ No newline at end of file diff --git a/Lang/TI-83-Hex-Assembly/00DESCRIPTION b/Lang/TI-83-Hex-Assembly/00DESCRIPTION new file mode 100644 index 0000000000..4d3d27c049 --- /dev/null +++ b/Lang/TI-83-Hex-Assembly/00DESCRIPTION @@ -0,0 +1 @@ +{{stub}}{{language}} \ No newline at end of file diff --git a/Lang/TI-83-Hex-Assembly/A+B b/Lang/TI-83-Hex-Assembly/A+B new file mode 120000 index 0000000000..ad05d2f425 --- /dev/null +++ b/Lang/TI-83-Hex-Assembly/A+B @@ -0,0 +1 @@ +../../Task/A+B/TI-83-Hex-Assembly \ No newline at end of file diff --git a/Lang/TI-83-Hex-Assembly/Empty-program b/Lang/TI-83-Hex-Assembly/Empty-program new file mode 120000 index 0000000000..2b8e781610 --- /dev/null +++ b/Lang/TI-83-Hex-Assembly/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/TI-83-Hex-Assembly \ No newline at end of file diff --git a/Lang/TI-83-Hex-Assembly/Hello-world-Newbie b/Lang/TI-83-Hex-Assembly/Hello-world-Newbie new file mode 120000 index 0000000000..f090b29be0 --- /dev/null +++ b/Lang/TI-83-Hex-Assembly/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/TI-83-Hex-Assembly \ No newline at end of file diff --git a/Lang/TI-83-Hex-Assembly/README b/Lang/TI-83-Hex-Assembly/README new file mode 100644 index 0000000000..b91ee493b4 --- /dev/null +++ b/Lang/TI-83-Hex-Assembly/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:TI-83_Hex_Assembly diff --git a/Lang/Terra/00DESCRIPTION b/Lang/Terra/00DESCRIPTION new file mode 100644 index 0000000000..4d3d27c049 --- /dev/null +++ b/Lang/Terra/00DESCRIPTION @@ -0,0 +1 @@ +{{stub}}{{language}} \ No newline at end of file diff --git a/Lang/Terra/Hello-world-Text b/Lang/Terra/Hello-world-Text new file mode 120000 index 0000000000..4897dcf67f --- /dev/null +++ b/Lang/Terra/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Terra \ No newline at end of file diff --git a/Lang/Terra/README b/Lang/Terra/README new file mode 100644 index 0000000000..6ac40cadec --- /dev/null +++ b/Lang/Terra/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Terra diff --git a/Lang/TestML/00DESCRIPTION b/Lang/TestML/00DESCRIPTION new file mode 100644 index 0000000000..08bcc2b215 --- /dev/null +++ b/Lang/TestML/00DESCRIPTION @@ -0,0 +1,9 @@ +{{language|TestML +|site=http://testml.org}} +[http://testml.org TestML] is an [http://acmeism.org Acmeist], data-driven, unit test language/framework. This means that you can write the same software (since it passes the same tests) in multiple programming languages. + +The primary purpose of TestML is to write one set of tests, for libraries (think CPAN, RubyGems, PyPI, NPM) that are intended to be ported to (or generated in) more than one programming language. + +TestML tests/programs are typically integrated into the testing framework of a given project. However TestML can also be run as a standalone programming language. To install the TestML runner, install this [https://rubygems.org/gems/testml-command Ruby gem]. + +TestML originally took inspiration from Ward Cunningham's FIT framework. The idea is that you write one suite of language agnostic tests, and then implement your software in any programming language that has support for the framework. Unlike FIT, TestML is entirely text based (rather than table based), and runs well next to native tests in all the supported languages. In other words, it is better suited for Open Source projects, where FIT was more directly targeted at business/IT software development. \ No newline at end of file diff --git a/Lang/TestML/Hello-world-Text b/Lang/TestML/Hello-world-Text new file mode 120000 index 0000000000..cddb478981 --- /dev/null +++ b/Lang/TestML/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/TestML \ No newline at end of file diff --git a/Lang/TestML/README b/Lang/TestML/README new file mode 100644 index 0000000000..862899775c --- /dev/null +++ b/Lang/TestML/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:TestML diff --git a/Lang/ToffeeScript/00DESCRIPTION b/Lang/ToffeeScript/00DESCRIPTION new file mode 100644 index 0000000000..4d3d27c049 --- /dev/null +++ b/Lang/ToffeeScript/00DESCRIPTION @@ -0,0 +1 @@ +{{stub}}{{language}} \ No newline at end of file diff --git a/Lang/ToffeeScript/README b/Lang/ToffeeScript/README new file mode 100644 index 0000000000..e1149e4d5f --- /dev/null +++ b/Lang/ToffeeScript/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:ToffeeScript diff --git a/Lang/ToffeeScript/Simple-database b/Lang/ToffeeScript/Simple-database new file mode 120000 index 0000000000..833c4d9c67 --- /dev/null +++ b/Lang/ToffeeScript/Simple-database @@ -0,0 +1 @@ +../../Task/Simple-database/ToffeeScript \ No newline at end of file diff --git a/Lang/ToffeeScript/Web-scraping b/Lang/ToffeeScript/Web-scraping new file mode 120000 index 0000000000..246364a37c --- /dev/null +++ b/Lang/ToffeeScript/Web-scraping @@ -0,0 +1 @@ +../../Task/Web-scraping/ToffeeScript \ No newline at end of file diff --git a/Lang/TypeScript/00DESCRIPTION b/Lang/TypeScript/00DESCRIPTION new file mode 100644 index 0000000000..bf649c49fa --- /dev/null +++ b/Lang/TypeScript/00DESCRIPTION @@ -0,0 +1,17 @@ +{{language|TypeScript +|exec=JavaScript +|strength=weak +|express=implicit +|checking=dynamic, static +|gc=yes +|parampass=value +|LCT=yes|{{language programming paradigm|Object-oriented}}{{language programming paradigm|functional}}{{language programming paradigm|structured}}{{language programming paradigm|generic}}{{language programming paradigm|imperative}}{{language programming paradigm|scripting}}}} + +'''TypeScript''' is a free and open source programming language developed and maintained by Microsoft. It is a strict superset of [[JavaScript]], and adds optional static typing and class-based [[object-oriented language|object-oriented programming language]] programming to the language. Anders Hejlsberg, lead architect of [[C sharp|C#]] and creator of [[Delphi]] and [[Turbo Pascal]], has worked on the development of TypeScript. + +==Citations== +*[[wp:TypeScript|Wikipedia:TypeScript]] + +{{language programming paradigm|Imperative}} +{{language programming paradigm|Object-oriented}} +{{language programming paradigm|Generic}} \ No newline at end of file diff --git a/Lang/TypeScript/Caesar-cipher b/Lang/TypeScript/Caesar-cipher new file mode 120000 index 0000000000..7c74c5a1be --- /dev/null +++ b/Lang/TypeScript/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/TypeScript \ No newline at end of file diff --git a/Lang/TypeScript/Fractal-tree b/Lang/TypeScript/Fractal-tree new file mode 120000 index 0000000000..0c22a2c240 --- /dev/null +++ b/Lang/TypeScript/Fractal-tree @@ -0,0 +1 @@ +../../Task/Fractal-tree/TypeScript \ No newline at end of file diff --git a/Lang/TypeScript/Greatest-common-divisor b/Lang/TypeScript/Greatest-common-divisor new file mode 120000 index 0000000000..eb34abd0cd --- /dev/null +++ b/Lang/TypeScript/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/TypeScript \ No newline at end of file diff --git a/Lang/TypeScript/Loops-For b/Lang/TypeScript/Loops-For new file mode 120000 index 0000000000..2e76df332a --- /dev/null +++ b/Lang/TypeScript/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/TypeScript \ No newline at end of file diff --git a/Lang/TypeScript/README b/Lang/TypeScript/README new file mode 100644 index 0000000000..f74dcf4bb8 --- /dev/null +++ b/Lang/TypeScript/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:TypeScript diff --git a/Lang/TypeScript/Vigen-re-cipher b/Lang/TypeScript/Vigen-re-cipher new file mode 120000 index 0000000000..03223acf05 --- /dev/null +++ b/Lang/TypeScript/Vigen-re-cipher @@ -0,0 +1 @@ +../../Task/Vigen-re-cipher/TypeScript \ No newline at end of file diff --git a/Lang/Uniface/00DESCRIPTION b/Lang/Uniface/00DESCRIPTION new file mode 100644 index 0000000000..e5e50854f5 --- /dev/null +++ b/Lang/Uniface/00DESCRIPTION @@ -0,0 +1,156 @@ +{{language}}'''Uniface''' is a development and deployment platform for enterprise applications that can run in a large range of runtime environments, including mobile, mainframe, web, [[Service-oriented architecture]] (SOA), [[Microsoft Windows|Windows]], [[Java Platform, Enterprise Edition|Java EE]] and [[Microsoft .NET|.NET]]. Uniface is a model-driven, Rapid Application Development(RAD)environment used to create mission-critical applications. + +Uniface applications are database- and platform-independent. Uniface provides an integration framework that enables Uniface applications to integrate with all major DBMS products such as [[Oracle]], [[Microsoft SQL Server]], [[MySQL]] and [[IBM DB2]]. In addition, Uniface also supports file systems such as RMS (HP OpenVMS), Sequential files, operating system text files and a wide range of other technologies, such as mainframe-based products ([[CICS]], [[IBM Information Management System|IMS]]), [[web service]]s, [[Simple Mail Transfer Protocol|SMTP]] and [[Post Office Protocol|POP]] email, [[LDAP]] directories, [[Microsoft .NET|.NET]], [[ActiveX]], [[Component Object Model]] (COM), [[C (programming language)|C(++)]] programs, and [[Java (programming language)|Java]]. Uniface operates under [[Microsoft Windows]], [[Windows Mobile]], various flavors of [[Unix]] and [[Linux]], [[OpenVMS|VMS]], IBM [[IBM System i|iSeries]], and [[z/OS]]. + +Uniface can be used in complex systems that maintain critical enterprise data supporting mission-critical business processes such as point-of sale and web-based online shopping, financial transactions, salary administration, and inventory control. It is currently used by thousands of companies in more than 30 countries, with an effective installed base of millions of end-users. Uniface applications range from client/server to web, and from data entry to workflow, as well as portals that are accessed locally, via intranets and the internet. + +Originally developed in the Netherlands by Inside Automation, later Uniface B.V., the product and company were acquired by Detroit-based [[Compuware]] Corp in 1994, and in 2014 was acquired by Marlin Equity Partners and is now an independent company. Uniface B.V. global headquarters are based in [[Amsterdam]]. + +== Uniface Products == +Uniface Development Environment—an integrated collection of tools for modeling, implementing, compiling, debugging, and distributing applications. + + +Uniface applications, including the above, use a common runtime infrastructure, consisting of: +* Uniface Runtime Engine—a platform-specific process that interprets and executes compiled application components and libraries. +* Uniface Router—a multi-threaded process responsible for interprocess communication in Uniface applications. It starts and stops Uniface Server processes, performs load balancing, and passing messages between various Uniface processes. +* Uniface Server—a server-based process that enables Uniface clients to access remote resources or to execute remote components. It acts as an application server, a data server, and a file server. +*Uniface Repository—an [[SQL]]-capable DBMS used to store definitions and properties of development objects, process and organization models, and portal definitions. +*Web server—Uniface bundles the Apache Tomcat Server for developing and testing web applications, but any web server can be used in a production environment. +*Servlets—Java servlets that broker communication between a web server and the Uniface Server for Uniface web applications and web services. +*Database connectors—drivers that handle the connection between Uniface and a variety of databases. +*Integration tools—drivers, components, and APIs that handle communication between Uniface and third-party applications and technologies, including Java, CICS, IMS, LDAP, SMTP, POP, operating system commands, COM, and more. + +In addition, the Uniface JTi (Java Thin Client Interface) can deliver client/server Uniface applications to any computer connected to the Internet. + +Uniface has a proprietary procedural language called Proc that is used to code application behavior. Uniface automates most input/output operations through its kernel and default code, so much fundamental behavior does not need to be coded. + +== Uniface Applications == +Uniface applications are component-based, infrastructure-independent software programs that can create or use data stored in one or more databases or file-systems. They can be composite applications that include non-Uniface components created using other development tools, and they can be deployed in distributed client/server and web environments, as mobile applications or web services, and in mainframe environments. + +Uniface has a variety of component types that are intended for use in different layers of a multi-tier application architecture. + +Components for the presentation tier are responsible for the user interface, and include: +*Forms—interactive screens for displaying and updating data in a client/server environment. +*Server Pages—interactive pages for displaying and updating data in a web environment. +*Reports—layouts for presenting data in a printed output. + +Components for the business logic tier handle business rules and task-specific behavior and have no user interface: +*Services—provide processing and business logic functionality when called by other components, either locally or remotely. +*Session Services—centralize complex business rules affecting multiple data entities, such as task-specific behavior, transactions, and referential integrity. +*Entity Services—centralize simple business rules for single data entities. + +The data access tier contains physical database structures captured in the Uniface application model. Uniface ensures physical data access by encapsulating SQL in its DBMS connectors. Network and middleware access are encapsulated by the middleware drivers and the Uniface Router. + +The runtime engine executes the application components. It displays presentation components using the appropriate user interface connector (either GUI or character-based), and sends and receives data via a DBMS connector. + +== Application Development == +Uniface applications are developed on with the Uniface Development Environment. Originally, it was possible to develop on [[Apple Inc.|Apple]] and [[Digital Equipment|DEC]] platforms; now, [[Microsoft Windows|Windows]] is the supported platform for development. + +Uniface applications development is model-driven and component-based. The data structure, business rules, and default behavior of the application are captured in the Application Model. Model definitions can be reused and inherited by components, which can override inherited definitions and provide component-specific behavior and characteristics. Templates improve productivity and enforce consistency when defining models. + +=== Application Model === + +The application model defines entities (tables), fields, keys (indexes) and relationships together with referential integrity. Each entity and field in the model has properties and a set of triggers. Business rules are added to the model declaratively by setting properties and procedurally by adding Proc code (Uniface's procedural language) in triggers. + +Triggers are containers for code. Some triggers represent user or system events, for example Occurrence Gets Focus, Read or Leave Field. Others cover matters such as validation or act as place holders for methods associated with the particular object. + +The use of model-level triggers enables Uniface to collect properties and behavior within business objects, separating logical from the physical data structures. It makes it possible to define default behavior once, for reuse throughout the application, speeding development and facilitating the 3-tier application architecture. + +Each entity (table) is first defined in the Application Model from where it can be exported to the physical database in the form of CREATE TABLE scripts. + +=== Components === + +Objects described in the application model are reused by components. Developers embed objects from the model on the component by drawing them on the layout canvas (for presentation components), or inserting them into a tree view of the component structure. They can also add component-level objects that are not in the application model, such as control fields, menus, and component variables. + +The properties and triggers defined in the application model are inherited by being copied into the component. The definitions can be changed at the component level to provide specific functionality. This breaks the link between the application model and the component (although it is possible to restore the link to the model). If the model code or properties are changed at the model level, all components holding that object need only be recompiled to collect the new definitions. This provides benefits in maintenance and ensures that the rules associated with the object are available wherever it is used. + +=== Uniface Repository === + +Uniface maintains a database of its own metadata for the purposes of reuse—application models, component definitions, component layouts, procedural code, and so on. The repository is proprietary and intended for access via the Uniface Development Environment, to ensure repository integrity. However, the repository structure is documented, making it possible (though not recommended) to interface directly with it for, for example, reporting. + +By using a centralized repository, application development can be shared over teams of software developers. Uniface can integrate with any [[version control system]] (VCS) that supports the Microsoft Common Source Code Control Interface Specification. The VCS functionality available within Uniface depends on the VCS used, because software vendors have interpreted and implemented the MS CSCC API differently. + +== Application Deployment == +Uniface applications can be deployed on platforms from mainframe through mobile, without changing the code. The components (and other objects such as startup shells, menus, toolbars (panels), glyphs, global and included Proc entries) are compiled into runtime objects that can be packaged into zip files and deployed onto any platform. The runtime objects are executed using a virtual machine and a platform-specific interpreter. (Java later followed Uniface in this respect). Components can be compiled on one machine and executed on another, providing the Uniface Virtual Machine is present. + +The Uniface Router and Uniface Server make Uniface scalable, balanceable and make is possible to run processes asynchronously. + +== Database Connectivity == + +Uniface accesses the many databases and file systems it supports by means of database connectors (or drivers). DBMS connectors map and convert Uniface data types to the most suitable format of the particular storage medium. At runtime, it is possible to pass parameters to invoke (or disable) database-specific extensions. Provided the database connector is licensed, it is possible to convert between different data sources. Uniface also provides an API, the Database Connector Interface, which can be used to create proprietary connectors for any [[SQL]]-based database. + +== Licensing == + +Licensing is managed through the Compuware Distributed License Manager (DLM), a server based system of distributing licenses to clients on request, precluding the need for them to be held locally. + +== History of Uniface == +Originally called UNIS, the product was created in The Netherlands in 1984 by Inside Automation, a company that was headed by Bodo Douqué, with Frits Kress as Technical Director. By 1986, both the product and the company had changed their name to Uniface. (An early logo for the product included a red capital A which reflected the red capital A in the Inside Automation logo.) + +Uniface was developed on the principles of the American National Standards Institute, (ANSI), [[Three_schema_approach|3-schema architecture]]. First proposed in 1975, this was a standard approach to the building of database management systems consisting of 3 schema (or metamodels): +*Conceptual schema—definition of all the data items and relationships between them. There is only one conceptual schema per database. Uniface implements the conceptual schema as the Application Model (in various Uniface versions known as the Business Object Model and the Application Object Model). +*External schema—different external (user) views of the data. There can be many external schemas for a database. Uniface implements external schemas as components. During Uniface's evolution, the External Schema became forms; hidden forms, which ran in the background without displaying to the user, became services; services split into session services for objects of the business tier and entity services that may be either business or data tier. Forms that were printed instead of being displayed became report components. The server page (USP) was introduced for web development, and later the dynamic server page was introduced to support Web 2.0 functionality. +*Internal schema—definition of the physical representation of the stored data. Uniface leaves the internal schema to the many relational database systems to which it could be connected, enabling it to be database-independent. + +Uniface was developed on the [[Digital Equipment Corporation|DEC]] [[VAX]] machine, using the native VAX file-management system [[Record Management Services|RMS]]. A vestige of this is still seen in today’s product by its continued use of a [[Gold key (DEC)|“GOLD” key]] to change modes ([[VT100|DEC VT terminals]] actually had a gold or yellow key on the keyboard. Today the “GOLD” is simply mapped to the numeric keyboard + key, or a function key). + +Early versions of the product were bundled with the Sybase RDBMS under the name FastBuild, although it was not limited to accessing only that database. + +Uniface has continuously evolved to handle new technologies and application architectures. This has been critical to its success, because applications built with Uniface can be migrated, updated and modernized without losing the original development investment. + +== Uniface Versions == + +'''Uniface Version 3''' (1986): +Uniface 3 was the first public release. It featured support for multiple databases (RMS, Oracle, C_ISAM, Ingres, and RDB); virtual machine interpretation; the Structure Editor, the Uniface text and command editor. + +'''Uniface Version 4''' (1988): +Uniface 4 improved the text editor (now form editor), improved printing and display support, introduced support for MS-DOS, and added a CASE tool interface. + +'''Uniface Version 5''' (1990): +Uniface 5 enabled client/server deployment with the introduction of remote database access through Polyserver. It introduced graphical user interface via the Universal Presentation Interface (UPI). Database support was extended to a total of 13 databases and file systems, and it was now available on DOS, VMS, OS/2, Stratus VOS and UNIX. Japanese character support was also introduced. + +'''Uniface Six''' (1994): +Uniface Six completed the move to fully graphical development environments. It included the graphical form painter and application model editor; improved deployment through Dynamic Object Libraries; added support for Microsoft Object Linking and Embedding (OLE); included support for Apple Macintosh; added permissions control; integrated version control; added Personal Series reporting tools (although these were later removed when the 3rd party decided not to enhance its product); wider platform support. + +'''Uniface Seven''' (1997): +Uniface Seven focused on component integration for both Uniface and external components through the introduction of the Uniface Request Broker (URB) architecture. The URB supports bi-directional and synchronous or asynchronous communication between components. As well as remote data access, it added partitioned Application Servers and messaging. Uniface Seven also delivered the first Uniface web development and deployment tools with Web Application Server and Uniface Request Dispatcher. + +Other enhancements included new component types (Services, Server Pages, Reports); Signature Editor and Assembly Workbench; subsystems; operations; non-modal forms; component instances; improved editors and navigation; enhanced editor plug-in; new debugger; integrated online help; component templates; Web Application Server; improved validation; Uniface Name Server and graphical partitioning manager. + +Uniface Seven also saw the introduction of several other tools: +*A tool for the modeling, integration and management of business processes. This functionality became Optimal Flow under Uniface 8, then Uniface Flow under Uniface 9. +*A business integration portal, initially called Optimal View, and later Uniface View +*Uniface—a server-based, thin-client solution for delivering web-enabled applications over the Internet or Intranet, providing high-performance in low-bandwidth connections. + +'''Uniface 8''' (2001): +Uniface 8 brought about major changes in the area of process integration. The Uniface Router and Uniface Server provided scalable, balanced deployment. The Web Request Dispatcher (WRD) replaced the URD, improving performance. Support for web services, with SOAP and XML, was introduced. Connectivity and interoperability were improved and a method for implementing a 3-tier application architecture was introduced. +Connectors for SOAP, COM, CORBA and MQSeries were added; window and file management was improved; a new deployment utility) was introduced, improving application distribution; component subtypes for 3-tier architecture were added; handles were added for component instances, and automatic garbage collection was added. + +'''Uniface 9''' (2006): +The Uniface 9 release focused on GUI and usability improvements, thin deployment, and integration. Support for Windows Mobile was added, and configuration and deployment was simplified using zipped archives. Support for Unicode improved what was an already impressive multilingual capability, and improvements in web development and XML handling brought Uniface further into line with industry standards. Dynamic field movement in form components removed some old barriers to flexibility. + +Other features included improved color handling, dynamic menus, an XML API, a diagram editor for the Application Model; cross-referencing functionality to support refactoring and deployment, and enhanced web services functionality. + +'''Uniface 9.4''' (2010): +Despite being a point release, Uniface 9.4 introduced enough major new functionality to be considered a major release. The major focus was on rich internet application (RIA) functionality, making it possible to develop Web 2.0 applications with the rich functionality of client/server applications using the same tools and methodologies used to develop classic client/server applications. Language and locale support was substantially improved, as was support for HTML email, and security and encryption. + +'''Uniface 9.5''' (2011): +The release of Uniface 9.5 has improved the product’s integration with the World Wide Web. The introduction of a JavaScript API, together with other improvements, means that client-side processing can bring benefits in the areas of performance, integration, functionality and user-friendliness. The session management capability has been extended to offer improved security. And the processing of Web Services now fully supports complex datatypes for both SOAP and RESTful services. There have also been improvements for those customers who have business-critical client/server applications, particularly in the area of the grid widget. + +'''Uniface 9.6''' (2012): +Uniface 9.6, provided a significant overhaul of the Uniface client server GUI capabilities. Functionality included an HTML5 control leveraging the JavaScript APIs originally delivered for the web, an enhanced tab control and updates to image handling, buttons plus other improvements. The form container control enables 'forms within forms', enabling the development of dynamic user experiences. + +In addition to the GUI enhancements, Uniface 9.6 also delivered enhancements to the Uniface Web and Web Services capabilities, including the ability to dynamical change the scope of web transactions, web pagination and hitlist processing and improved WSDL and XML capabilities. + +The Uniface Business Unit has been very transparent to the customer base that Uniface 9.6 is the last release of Uniface 9, before the release of Uniface 10 into the market place. + +There is the intention to continue to provide minor enhancements to Uniface 9.6 until 2017. + +==External links== +*[http://www.uniface.com Uniface product page] The Uniface Corporate Site +*[http://www.nextcomcz.eu/index.php?kategorie=en.php Nextcom] Czech company developing in Uniface +*[http://www.udev.info www.udev.info] building better web applications with Uniface (Tutorials und HowTo's) +*[http://www.uniface.info The Uniface Community] The Uniface Community web site +*[http://hosted.byjones.net/turf/ T.U.R.F.] An independent Uniface Related Forum +*[http://march-hare.com/library/html/ud6blurb.htm Database Driver for Source Code] UD6: a database driver for the Uniface repository (used with Version Control) +*[http://tcco.nl/index.html TCCO.NL] Designer Developer Uniface-FAST templates - speeds up your Uniface development process. +*[http://www.uniface.es Uniface. Toda ayuda cuenta] Spanish Uniface forum, news and tutorials. \ No newline at end of file diff --git a/Lang/Uniface/100-doors b/Lang/Uniface/100-doors new file mode 120000 index 0000000000..908d20141a --- /dev/null +++ b/Lang/Uniface/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Uniface \ No newline at end of file diff --git a/Lang/Uniface/Hello-world-Text b/Lang/Uniface/Hello-world-Text new file mode 120000 index 0000000000..3af0d79701 --- /dev/null +++ b/Lang/Uniface/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Uniface \ No newline at end of file diff --git a/Lang/Uniface/Loops-While b/Lang/Uniface/Loops-While new file mode 120000 index 0000000000..e3558a6db2 --- /dev/null +++ b/Lang/Uniface/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Uniface \ No newline at end of file diff --git a/Lang/Uniface/README b/Lang/Uniface/README new file mode 100644 index 0000000000..4dc088bb58 --- /dev/null +++ b/Lang/Uniface/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Uniface diff --git a/Lang/Uniface/SOAP b/Lang/Uniface/SOAP new file mode 120000 index 0000000000..8c1593aa04 --- /dev/null +++ b/Lang/Uniface/SOAP @@ -0,0 +1 @@ +../../Task/SOAP/Uniface \ No newline at end of file diff --git a/Lang/Ursa/00DESCRIPTION b/Lang/Ursa/00DESCRIPTION new file mode 100644 index 0000000000..39a15a646e --- /dev/null +++ b/Lang/Ursa/00DESCRIPTION @@ -0,0 +1,56 @@ +{{stub}}{{language|Ursa|exec=interpreted|site=http://cygnus-x.net/geekstuff/projects/ursa|strength=strong|gc=no}} + +==About== +Ursa is a simple programming language that [[user:whinson|I've]] been working on for awhile now. Its syntax is (at times) similar to Lisp, but instead of being list-based, it is "stream-based." Most in-built statements operate on types of data called streams. Streams are are variable-length arrays of data of a certain type. + +The basic premise of ursa is to function as a very high-level abstraction layer between streams and "I/O devices." I/O devices are objects that represent locations that can be read and written using data streams; namely, the console, files, and network ports. Ursa greatly simplifies the implementation of programs that transfer data between these devices. + +Ursa uses reverse polish notation for math and functions are simply seperated from their arguments by space characters. This makes implentation of Standard Ursa interpreters since this syntax is easier to write a parser for. + +==Example Code== +===Raw File Transfer=== +This Ursa code opens a port on a remote server, then outputs the specified file to the port. + +if (< (size args) 4) + out "usage: " args<0> " [server] [port] [file]" endl console + stop +end if + +decl file f +decl port p +f.open args<3> +p.connect args<1> (int args<2>) +out (f.readall) p +f.close +p.close + + +===Single-User Echo Server=== +# declare a serverport and a port to attach new connections to +declare serverport sp +declare port p + +# declare a string to contain lines of input +declare string input + +# attach the serverport to port 20000 +sp.attach 20000 + +# loop indefinitely, getting connections then echoing the data they send +while true + set p (sp.getconn) + out "%msg: connection from " (p.addr) endl console + out "echo server " _version endl endl p + while true + set input (in string p) + out input endl p + if (and (= input "") (not (p.isopen 1000))) + break + end if + end while + p.close + out "%msg: connection closed" endl console +end while + +==See Also== +* [http://cygnus-x.net/geekstuff/projects/ursa Ursa homepage] \ No newline at end of file diff --git a/Lang/Ursa/100-doors b/Lang/Ursa/100-doors new file mode 120000 index 0000000000..1b1e7071b0 --- /dev/null +++ b/Lang/Ursa/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Ursa \ No newline at end of file diff --git a/Lang/Ursa/99-Bottles-of-Beer b/Lang/Ursa/99-Bottles-of-Beer new file mode 120000 index 0000000000..24cf74a8a6 --- /dev/null +++ b/Lang/Ursa/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Ursa \ No newline at end of file diff --git a/Lang/Ursa/A+B b/Lang/Ursa/A+B new file mode 120000 index 0000000000..79c742192f --- /dev/null +++ b/Lang/Ursa/A+B @@ -0,0 +1 @@ +../../Task/A+B/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Append-a-record-to-the-end-of-a-text-file b/Lang/Ursa/Append-a-record-to-the-end-of-a-text-file new file mode 120000 index 0000000000..dc3dd68157 --- /dev/null +++ b/Lang/Ursa/Append-a-record-to-the-end-of-a-text-file @@ -0,0 +1 @@ +../../Task/Append-a-record-to-the-end-of-a-text-file/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Arbitrary-precision-integers--included- b/Lang/Ursa/Arbitrary-precision-integers--included- new file mode 120000 index 0000000000..cdb24c01dd --- /dev/null +++ b/Lang/Ursa/Arbitrary-precision-integers--included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers--included-/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Arithmetic-Integer b/Lang/Ursa/Arithmetic-Integer new file mode 120000 index 0000000000..b3cd3c1a96 --- /dev/null +++ b/Lang/Ursa/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Array-concatenation b/Lang/Ursa/Array-concatenation new file mode 120000 index 0000000000..71a42708cb --- /dev/null +++ b/Lang/Ursa/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Averages-Arithmetic-mean b/Lang/Ursa/Averages-Arithmetic-mean new file mode 120000 index 0000000000..8c713431e0 --- /dev/null +++ b/Lang/Ursa/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Boolean-values b/Lang/Ursa/Boolean-values new file mode 120000 index 0000000000..dcc657857d --- /dev/null +++ b/Lang/Ursa/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/Ursa \ No newline at end of file diff --git a/Lang/Ursa/CSV-data-manipulation b/Lang/Ursa/CSV-data-manipulation new file mode 120000 index 0000000000..252aa58905 --- /dev/null +++ b/Lang/Ursa/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Caesar-cipher b/Lang/Ursa/Caesar-cipher new file mode 120000 index 0000000000..9da4334693 --- /dev/null +++ b/Lang/Ursa/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Call-an-object-method b/Lang/Ursa/Call-an-object-method new file mode 120000 index 0000000000..f0fa2ec247 --- /dev/null +++ b/Lang/Ursa/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Case-sensitivity-of-identifiers b/Lang/Ursa/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..4fccbaa38a --- /dev/null +++ b/Lang/Ursa/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Character-codes b/Lang/Ursa/Character-codes new file mode 120000 index 0000000000..8910047779 --- /dev/null +++ b/Lang/Ursa/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Check-that-file-exists b/Lang/Ursa/Check-that-file-exists new file mode 120000 index 0000000000..654e8b7e55 --- /dev/null +++ b/Lang/Ursa/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Command-line-arguments b/Lang/Ursa/Command-line-arguments new file mode 120000 index 0000000000..524e0282f0 --- /dev/null +++ b/Lang/Ursa/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Comments b/Lang/Ursa/Comments new file mode 120000 index 0000000000..0a3b2b80a4 --- /dev/null +++ b/Lang/Ursa/Comments @@ -0,0 +1 @@ +../../Task/Comments/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Copy-a-string b/Lang/Ursa/Copy-a-string new file mode 120000 index 0000000000..cb6fcb5317 --- /dev/null +++ b/Lang/Ursa/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Create-a-file b/Lang/Ursa/Create-a-file new file mode 120000 index 0000000000..ed6f504895 --- /dev/null +++ b/Lang/Ursa/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Create-a-two-dimensional-array-at-runtime b/Lang/Ursa/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..68fbeb106a --- /dev/null +++ b/Lang/Ursa/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Create-an-HTML-table b/Lang/Ursa/Create-an-HTML-table new file mode 120000 index 0000000000..a094ca6dd8 --- /dev/null +++ b/Lang/Ursa/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Date-format b/Lang/Ursa/Date-format new file mode 120000 index 0000000000..0e76b4f34f --- /dev/null +++ b/Lang/Ursa/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Delete-a-file b/Lang/Ursa/Delete-a-file new file mode 120000 index 0000000000..cbc340623b --- /dev/null +++ b/Lang/Ursa/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Detect-division-by-zero b/Lang/Ursa/Detect-division-by-zero new file mode 120000 index 0000000000..ed69b9e8e9 --- /dev/null +++ b/Lang/Ursa/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Determine-if-a-string-is-numeric b/Lang/Ursa/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..f5eee6658c --- /dev/null +++ b/Lang/Ursa/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Empty-program b/Lang/Ursa/Empty-program new file mode 120000 index 0000000000..2b7e35dd6a --- /dev/null +++ b/Lang/Ursa/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Empty-string b/Lang/Ursa/Empty-string new file mode 120000 index 0000000000..f9153f34d9 --- /dev/null +++ b/Lang/Ursa/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Environment-variables b/Lang/Ursa/Environment-variables new file mode 120000 index 0000000000..c3263d3114 --- /dev/null +++ b/Lang/Ursa/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Even-or-odd b/Lang/Ursa/Even-or-odd new file mode 120000 index 0000000000..9f8f0bafe7 --- /dev/null +++ b/Lang/Ursa/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Exceptions b/Lang/Ursa/Exceptions new file mode 120000 index 0000000000..333ba37b1d --- /dev/null +++ b/Lang/Ursa/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Execute-a-system-command b/Lang/Ursa/Execute-a-system-command new file mode 120000 index 0000000000..40808298bc --- /dev/null +++ b/Lang/Ursa/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Exponentiation-operator b/Lang/Ursa/Exponentiation-operator new file mode 120000 index 0000000000..e2c9618d61 --- /dev/null +++ b/Lang/Ursa/Exponentiation-operator @@ -0,0 +1 @@ +../../Task/Exponentiation-operator/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Factorial b/Lang/Ursa/Factorial new file mode 120000 index 0000000000..fec95e2567 --- /dev/null +++ b/Lang/Ursa/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Factors-of-an-integer b/Lang/Ursa/Factors-of-an-integer new file mode 120000 index 0000000000..b64d670157 --- /dev/null +++ b/Lang/Ursa/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Fibonacci-sequence b/Lang/Ursa/Fibonacci-sequence new file mode 120000 index 0000000000..7df09a5342 --- /dev/null +++ b/Lang/Ursa/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Ursa \ No newline at end of file diff --git a/Lang/Ursa/File-input-output b/Lang/Ursa/File-input-output new file mode 120000 index 0000000000..461d5939ad --- /dev/null +++ b/Lang/Ursa/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/Ursa \ No newline at end of file diff --git a/Lang/Ursa/File-modification-time b/Lang/Ursa/File-modification-time new file mode 120000 index 0000000000..917998e303 --- /dev/null +++ b/Lang/Ursa/File-modification-time @@ -0,0 +1 @@ +../../Task/File-modification-time/Ursa \ No newline at end of file diff --git a/Lang/Ursa/File-size b/Lang/Ursa/File-size new file mode 120000 index 0000000000..23c3d1d566 --- /dev/null +++ b/Lang/Ursa/File-size @@ -0,0 +1 @@ +../../Task/File-size/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Find-limit-of-recursion b/Lang/Ursa/Find-limit-of-recursion new file mode 120000 index 0000000000..9e2e104f15 --- /dev/null +++ b/Lang/Ursa/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/Ursa \ No newline at end of file diff --git a/Lang/Ursa/FizzBuzz b/Lang/Ursa/FizzBuzz new file mode 120000 index 0000000000..0f2931e328 --- /dev/null +++ b/Lang/Ursa/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Function-definition b/Lang/Ursa/Function-definition new file mode 120000 index 0000000000..4802e77c83 --- /dev/null +++ b/Lang/Ursa/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Generate-lower-case-ASCII-alphabet b/Lang/Ursa/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..f38339cb20 --- /dev/null +++ b/Lang/Ursa/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Greatest-common-divisor b/Lang/Ursa/Greatest-common-divisor new file mode 120000 index 0000000000..dd08e45e70 --- /dev/null +++ b/Lang/Ursa/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Greatest-element-of-a-list b/Lang/Ursa/Greatest-element-of-a-list new file mode 120000 index 0000000000..5974f0a6ae --- /dev/null +++ b/Lang/Ursa/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Guess-the-number b/Lang/Ursa/Guess-the-number new file mode 120000 index 0000000000..ab4b399aa4 --- /dev/null +++ b/Lang/Ursa/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Guess-the-number-With-feedback b/Lang/Ursa/Guess-the-number-With-feedback new file mode 120000 index 0000000000..71006ca099 --- /dev/null +++ b/Lang/Ursa/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Hailstone-sequence b/Lang/Ursa/Hailstone-sequence new file mode 120000 index 0000000000..29652fdab8 --- /dev/null +++ b/Lang/Ursa/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Hello-world-Newline-omission b/Lang/Ursa/Hello-world-Newline-omission new file mode 120000 index 0000000000..8c9bdd8a45 --- /dev/null +++ b/Lang/Ursa/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Hello-world-Standard-error b/Lang/Ursa/Hello-world-Standard-error new file mode 120000 index 0000000000..4688a11c24 --- /dev/null +++ b/Lang/Ursa/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Hello-world-Text b/Lang/Ursa/Hello-world-Text new file mode 120000 index 0000000000..b9955d8d10 --- /dev/null +++ b/Lang/Ursa/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Higher-order-functions b/Lang/Ursa/Higher-order-functions new file mode 120000 index 0000000000..a881a6d97b --- /dev/null +++ b/Lang/Ursa/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Hostname b/Lang/Ursa/Hostname new file mode 120000 index 0000000000..96cfc79131 --- /dev/null +++ b/Lang/Ursa/Hostname @@ -0,0 +1 @@ +../../Task/Hostname/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Include-a-file b/Lang/Ursa/Include-a-file new file mode 120000 index 0000000000..b7075bbf32 --- /dev/null +++ b/Lang/Ursa/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Increment-a-numerical-string b/Lang/Ursa/Increment-a-numerical-string new file mode 120000 index 0000000000..5175637e5e --- /dev/null +++ b/Lang/Ursa/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Infinity b/Lang/Ursa/Infinity new file mode 120000 index 0000000000..87dd48c07e --- /dev/null +++ b/Lang/Ursa/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Input-loop b/Lang/Ursa/Input-loop new file mode 120000 index 0000000000..d6c3ee037d --- /dev/null +++ b/Lang/Ursa/Input-loop @@ -0,0 +1 @@ +../../Task/Input-loop/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Integer-comparison b/Lang/Ursa/Integer-comparison new file mode 120000 index 0000000000..61b714af1e --- /dev/null +++ b/Lang/Ursa/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Integer-sequence b/Lang/Ursa/Integer-sequence new file mode 120000 index 0000000000..19919bb9ac --- /dev/null +++ b/Lang/Ursa/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Interactive-programming b/Lang/Ursa/Interactive-programming new file mode 120000 index 0000000000..f0bdca96b4 --- /dev/null +++ b/Lang/Ursa/Interactive-programming @@ -0,0 +1 @@ +../../Task/Interactive-programming/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Leap-year b/Lang/Ursa/Leap-year new file mode 120000 index 0000000000..87c62cc0aa --- /dev/null +++ b/Lang/Ursa/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Least-common-multiple b/Lang/Ursa/Least-common-multiple new file mode 120000 index 0000000000..3e315674ed --- /dev/null +++ b/Lang/Ursa/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Literals-Floating-point b/Lang/Ursa/Literals-Floating-point new file mode 120000 index 0000000000..7d8c883f92 --- /dev/null +++ b/Lang/Ursa/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Literals-Integer b/Lang/Ursa/Literals-Integer new file mode 120000 index 0000000000..5567a83826 --- /dev/null +++ b/Lang/Ursa/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Loop-over-multiple-arrays-simultaneously b/Lang/Ursa/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..1b252149af --- /dev/null +++ b/Lang/Ursa/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Loops-Break b/Lang/Ursa/Loops-Break new file mode 120000 index 0000000000..df23f2501a --- /dev/null +++ b/Lang/Ursa/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Loops-Continue b/Lang/Ursa/Loops-Continue new file mode 120000 index 0000000000..b080b6a3f2 --- /dev/null +++ b/Lang/Ursa/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Loops-Downward-for b/Lang/Ursa/Loops-Downward-for new file mode 120000 index 0000000000..e82ed1562f --- /dev/null +++ b/Lang/Ursa/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Loops-For b/Lang/Ursa/Loops-For new file mode 120000 index 0000000000..991cc301e6 --- /dev/null +++ b/Lang/Ursa/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Loops-For-with-a-specified-step b/Lang/Ursa/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..c827b0c328 --- /dev/null +++ b/Lang/Ursa/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Loops-Infinite b/Lang/Ursa/Loops-Infinite new file mode 120000 index 0000000000..ecb9d8cfdb --- /dev/null +++ b/Lang/Ursa/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Loops-N-plus-one-half b/Lang/Ursa/Loops-N-plus-one-half new file mode 120000 index 0000000000..7cf9dffa5c --- /dev/null +++ b/Lang/Ursa/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Loops-While b/Lang/Ursa/Loops-While new file mode 120000 index 0000000000..646244ae7a --- /dev/null +++ b/Lang/Ursa/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Menu b/Lang/Ursa/Menu new file mode 120000 index 0000000000..184d1e5ae5 --- /dev/null +++ b/Lang/Ursa/Menu @@ -0,0 +1 @@ +../../Task/Menu/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Morse-code b/Lang/Ursa/Morse-code new file mode 120000 index 0000000000..fbd51bf07d --- /dev/null +++ b/Lang/Ursa/Morse-code @@ -0,0 +1 @@ +../../Task/Morse-code/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Null-object b/Lang/Ursa/Null-object new file mode 120000 index 0000000000..c9a62522b0 --- /dev/null +++ b/Lang/Ursa/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Old-lady-swallowed-a-fly b/Lang/Ursa/Old-lady-swallowed-a-fly new file mode 120000 index 0000000000..065a97b574 --- /dev/null +++ b/Lang/Ursa/Old-lady-swallowed-a-fly @@ -0,0 +1 @@ +../../Task/Old-lady-swallowed-a-fly/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Pick-random-element b/Lang/Ursa/Pick-random-element new file mode 120000 index 0000000000..75234f510a --- /dev/null +++ b/Lang/Ursa/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Program-termination b/Lang/Ursa/Program-termination new file mode 120000 index 0000000000..8c3f886f3a --- /dev/null +++ b/Lang/Ursa/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/Ursa \ No newline at end of file diff --git a/Lang/Ursa/README b/Lang/Ursa/README new file mode 100644 index 0000000000..fdb80ac60a --- /dev/null +++ b/Lang/Ursa/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Ursa diff --git a/Lang/Ursa/Read-a-file-line-by-line b/Lang/Ursa/Read-a-file-line-by-line new file mode 120000 index 0000000000..832cda8147 --- /dev/null +++ b/Lang/Ursa/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Read-a-specific-line-from-a-file b/Lang/Ursa/Read-a-specific-line-from-a-file new file mode 120000 index 0000000000..9c3cd0f18d --- /dev/null +++ b/Lang/Ursa/Read-a-specific-line-from-a-file @@ -0,0 +1 @@ +../../Task/Read-a-specific-line-from-a-file/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Read-entire-file b/Lang/Ursa/Read-entire-file new file mode 120000 index 0000000000..6fe966277b --- /dev/null +++ b/Lang/Ursa/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Return-multiple-values b/Lang/Ursa/Return-multiple-values new file mode 120000 index 0000000000..d4941fe1f8 --- /dev/null +++ b/Lang/Ursa/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Runtime-evaluation b/Lang/Ursa/Runtime-evaluation new file mode 120000 index 0000000000..063b9bf951 --- /dev/null +++ b/Lang/Ursa/Runtime-evaluation @@ -0,0 +1 @@ +../../Task/Runtime-evaluation/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Sleep b/Lang/Ursa/Sleep new file mode 120000 index 0000000000..0af61c6bee --- /dev/null +++ b/Lang/Ursa/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Sort-an-integer-array b/Lang/Ursa/Sort-an-integer-array new file mode 120000 index 0000000000..7fac9c5bc8 --- /dev/null +++ b/Lang/Ursa/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Special-variables b/Lang/Ursa/Special-variables new file mode 120000 index 0000000000..e94d490a00 --- /dev/null +++ b/Lang/Ursa/Special-variables @@ -0,0 +1 @@ +../../Task/Special-variables/Ursa \ No newline at end of file diff --git a/Lang/Ursa/String-append b/Lang/Ursa/String-append new file mode 120000 index 0000000000..1e177e2659 --- /dev/null +++ b/Lang/Ursa/String-append @@ -0,0 +1 @@ +../../Task/String-append/Ursa \ No newline at end of file diff --git a/Lang/Ursa/String-case b/Lang/Ursa/String-case new file mode 120000 index 0000000000..d5539e1ee3 --- /dev/null +++ b/Lang/Ursa/String-case @@ -0,0 +1 @@ +../../Task/String-case/Ursa \ No newline at end of file diff --git a/Lang/Ursa/String-concatenation b/Lang/Ursa/String-concatenation new file mode 120000 index 0000000000..5b2f357810 --- /dev/null +++ b/Lang/Ursa/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Ursa \ No newline at end of file diff --git a/Lang/Ursa/String-prepend b/Lang/Ursa/String-prepend new file mode 120000 index 0000000000..beb5d5b8fc --- /dev/null +++ b/Lang/Ursa/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Sum-and-product-of-an-array b/Lang/Ursa/Sum-and-product-of-an-array new file mode 120000 index 0000000000..20d4ca7d2b --- /dev/null +++ b/Lang/Ursa/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Sum-digits-of-an-integer b/Lang/Ursa/Sum-digits-of-an-integer new file mode 120000 index 0000000000..e67bc42e28 --- /dev/null +++ b/Lang/Ursa/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/Ursa \ No newline at end of file diff --git a/Lang/Ursa/System-time b/Lang/Ursa/System-time new file mode 120000 index 0000000000..642270253d --- /dev/null +++ b/Lang/Ursa/System-time @@ -0,0 +1 @@ +../../Task/System-time/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Temperature-conversion b/Lang/Ursa/Temperature-conversion new file mode 120000 index 0000000000..22bc7a6fff --- /dev/null +++ b/Lang/Ursa/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Tokenize-a-string b/Lang/Ursa/Tokenize-a-string new file mode 120000 index 0000000000..b4f8935259 --- /dev/null +++ b/Lang/Ursa/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Unix-ls b/Lang/Ursa/Unix-ls new file mode 120000 index 0000000000..1107a2225b --- /dev/null +++ b/Lang/Ursa/Unix-ls @@ -0,0 +1 @@ +../../Task/Unix-ls/Ursa \ No newline at end of file diff --git a/Lang/Ursa/User-input-Text b/Lang/Ursa/User-input-Text new file mode 120000 index 0000000000..28e0aa6cd1 --- /dev/null +++ b/Lang/Ursa/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Variables b/Lang/Ursa/Variables new file mode 120000 index 0000000000..7639b39301 --- /dev/null +++ b/Lang/Ursa/Variables @@ -0,0 +1 @@ +../../Task/Variables/Ursa \ No newline at end of file diff --git a/Lang/Ursa/Zero-to-the-zero-power b/Lang/Ursa/Zero-to-the-zero-power new file mode 120000 index 0000000000..b73e16f520 --- /dev/null +++ b/Lang/Ursa/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/Ursa \ No newline at end of file diff --git a/Lang/VAX-Assembly/00DESCRIPTION b/Lang/VAX-Assembly/00DESCRIPTION new file mode 100644 index 0000000000..4d3d27c049 --- /dev/null +++ b/Lang/VAX-Assembly/00DESCRIPTION @@ -0,0 +1 @@ +{{stub}}{{language}} \ No newline at end of file diff --git a/Lang/VAX-Assembly/README b/Lang/VAX-Assembly/README new file mode 100644 index 0000000000..00bf7b8642 --- /dev/null +++ b/Lang/VAX-Assembly/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:VAX_Assembly diff --git a/Lang/Visual-FoxPro/00DESCRIPTION b/Lang/Visual-FoxPro/00DESCRIPTION new file mode 100644 index 0000000000..9bf42c1b9e --- /dev/null +++ b/Lang/Visual-FoxPro/00DESCRIPTION @@ -0,0 +1,8 @@ +{{stub}} +{{language +|exec=machine +|site=http://msdn.microsoft.com/en-us/vfoxpro/bb190225.aspx/}} + +'''Visual FoxPro''' is a discontinued programming language developed by Microsoft(formerly Fox Software). + +It may be discontinued by Microsoft (it does not fit into the .NET environment) but the VFP community is alive and well (see Visual Foxpro Wiki and ProFox). There are thousands of Visual FoxPro applications in use. It is a rich, versatile language with excellent data handling capabilities both for native data and remote data sources (SQL Server, Oracle etc.). It was originally written by Dave Fulton of Ashton Tate who sold Fox Software to Microsoft who saw Fox supplanting their own desktop database application (Access). \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Associative-array-Creation b/Lang/Visual-FoxPro/Associative-array-Creation new file mode 120000 index 0000000000..1194a277ce --- /dev/null +++ b/Lang/Visual-FoxPro/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Benfords-law b/Lang/Visual-FoxPro/Benfords-law new file mode 120000 index 0000000000..6358dc1e1e --- /dev/null +++ b/Lang/Visual-FoxPro/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Binary-digits b/Lang/Visual-FoxPro/Binary-digits new file mode 120000 index 0000000000..35df61487c --- /dev/null +++ b/Lang/Visual-FoxPro/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/CSV-data-manipulation b/Lang/Visual-FoxPro/CSV-data-manipulation new file mode 120000 index 0000000000..1508de98f9 --- /dev/null +++ b/Lang/Visual-FoxPro/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Circles-of-given-radius-through-two-points b/Lang/Visual-FoxPro/Circles-of-given-radius-through-two-points new file mode 120000 index 0000000000..02af3c43fa --- /dev/null +++ b/Lang/Visual-FoxPro/Circles-of-given-radius-through-two-points @@ -0,0 +1 @@ +../../Task/Circles-of-given-radius-through-two-points/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Classes b/Lang/Visual-FoxPro/Classes new file mode 120000 index 0000000000..47f273ba60 --- /dev/null +++ b/Lang/Visual-FoxPro/Classes @@ -0,0 +1 @@ +../../Task/Classes/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Closest-pair-problem b/Lang/Visual-FoxPro/Closest-pair-problem new file mode 120000 index 0000000000..512aa1802b --- /dev/null +++ b/Lang/Visual-FoxPro/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Collections b/Lang/Visual-FoxPro/Collections new file mode 120000 index 0000000000..ac588c22d1 --- /dev/null +++ b/Lang/Visual-FoxPro/Collections @@ -0,0 +1 @@ +../../Task/Collections/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Define-a-primitive-data-type b/Lang/Visual-FoxPro/Define-a-primitive-data-type new file mode 120000 index 0000000000..c6c3d5d350 --- /dev/null +++ b/Lang/Visual-FoxPro/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Dutch-national-flag-problem b/Lang/Visual-FoxPro/Dutch-national-flag-problem new file mode 120000 index 0000000000..dbe3df892e --- /dev/null +++ b/Lang/Visual-FoxPro/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Forward-difference b/Lang/Visual-FoxPro/Forward-difference new file mode 120000 index 0000000000..65b75e46b5 --- /dev/null +++ b/Lang/Visual-FoxPro/Forward-difference @@ -0,0 +1 @@ +../../Task/Forward-difference/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Gamma-function b/Lang/Visual-FoxPro/Gamma-function new file mode 120000 index 0000000000..a8abca4868 --- /dev/null +++ b/Lang/Visual-FoxPro/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Generic-swap b/Lang/Visual-FoxPro/Generic-swap new file mode 120000 index 0000000000..9ca32bacbb --- /dev/null +++ b/Lang/Visual-FoxPro/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Handle-a-signal b/Lang/Visual-FoxPro/Handle-a-signal new file mode 120000 index 0000000000..a300a70e15 --- /dev/null +++ b/Lang/Visual-FoxPro/Handle-a-signal @@ -0,0 +1 @@ +../../Task/Handle-a-signal/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Harshad-or-Niven-series b/Lang/Visual-FoxPro/Harshad-or-Niven-series new file mode 120000 index 0000000000..37f4aae1f4 --- /dev/null +++ b/Lang/Visual-FoxPro/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Hash-join b/Lang/Visual-FoxPro/Hash-join new file mode 120000 index 0000000000..f46667b3cb --- /dev/null +++ b/Lang/Visual-FoxPro/Hash-join @@ -0,0 +1 @@ +../../Task/Hash-join/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Hello-world-Graphical b/Lang/Visual-FoxPro/Hello-world-Graphical new file mode 120000 index 0000000000..68f255442e --- /dev/null +++ b/Lang/Visual-FoxPro/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Hofstadter-Q-sequence b/Lang/Visual-FoxPro/Hofstadter-Q-sequence new file mode 120000 index 0000000000..e5befebcbf --- /dev/null +++ b/Lang/Visual-FoxPro/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Horners-rule-for-polynomial-evaluation b/Lang/Visual-FoxPro/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..5d9436a1cf --- /dev/null +++ b/Lang/Visual-FoxPro/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Last-Friday-of-each-month b/Lang/Visual-FoxPro/Last-Friday-of-each-month new file mode 120000 index 0000000000..f626afca7b --- /dev/null +++ b/Lang/Visual-FoxPro/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Loop-over-multiple-arrays-simultaneously b/Lang/Visual-FoxPro/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..4a7c5c3689 --- /dev/null +++ b/Lang/Visual-FoxPro/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Matrix-multiplication b/Lang/Visual-FoxPro/Matrix-multiplication new file mode 120000 index 0000000000..3e90a2207f --- /dev/null +++ b/Lang/Visual-FoxPro/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/README b/Lang/Visual-FoxPro/README new file mode 100644 index 0000000000..ef9105dcd1 --- /dev/null +++ b/Lang/Visual-FoxPro/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Visual_FoxPro diff --git a/Lang/Visual-FoxPro/Random-numbers b/Lang/Visual-FoxPro/Random-numbers new file mode 120000 index 0000000000..a13cfb663d --- /dev/null +++ b/Lang/Visual-FoxPro/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Ranking-methods b/Lang/Visual-FoxPro/Ranking-methods new file mode 120000 index 0000000000..12e397ea9f --- /dev/null +++ b/Lang/Visual-FoxPro/Ranking-methods @@ -0,0 +1 @@ +../../Task/Ranking-methods/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Reduced-row-echelon-form b/Lang/Visual-FoxPro/Reduced-row-echelon-form new file mode 120000 index 0000000000..06e4e8da21 --- /dev/null +++ b/Lang/Visual-FoxPro/Reduced-row-echelon-form @@ -0,0 +1 @@ +../../Task/Reduced-row-echelon-form/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Remove-duplicate-elements b/Lang/Visual-FoxPro/Remove-duplicate-elements new file mode 120000 index 0000000000..a02f938e8d --- /dev/null +++ b/Lang/Visual-FoxPro/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Repeat-a-string b/Lang/Visual-FoxPro/Repeat-a-string new file mode 120000 index 0000000000..0ffaef8c1e --- /dev/null +++ b/Lang/Visual-FoxPro/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Return-multiple-values b/Lang/Visual-FoxPro/Return-multiple-values new file mode 120000 index 0000000000..c6a8252284 --- /dev/null +++ b/Lang/Visual-FoxPro/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/SEDOLs b/Lang/Visual-FoxPro/SEDOLs new file mode 120000 index 0000000000..dfd078edab --- /dev/null +++ b/Lang/Visual-FoxPro/SEDOLs @@ -0,0 +1 @@ +../../Task/SEDOLs/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Short-circuit-evaluation b/Lang/Visual-FoxPro/Short-circuit-evaluation new file mode 120000 index 0000000000..4beaf175b8 --- /dev/null +++ b/Lang/Visual-FoxPro/Short-circuit-evaluation @@ -0,0 +1 @@ +../../Task/Short-circuit-evaluation/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Table-creation-Postal-addresses b/Lang/Visual-FoxPro/Table-creation-Postal-addresses new file mode 120000 index 0000000000..235ce67038 --- /dev/null +++ b/Lang/Visual-FoxPro/Table-creation-Postal-addresses @@ -0,0 +1 @@ +../../Task/Table-creation-Postal-addresses/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Visual-FoxPro/Temperature-conversion b/Lang/Visual-FoxPro/Temperature-conversion new file mode 120000 index 0000000000..4c12f803fd --- /dev/null +++ b/Lang/Visual-FoxPro/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Visual-FoxPro \ No newline at end of file diff --git a/Lang/Wart/00DESCRIPTION b/Lang/Wart/00DESCRIPTION new file mode 100644 index 0000000000..af54cfbb2b --- /dev/null +++ b/Lang/Wart/00DESCRIPTION @@ -0,0 +1,34 @@ +{{language}} +[http://github.com/akkartik/wart#readme Wart] is an experimental, dynamic, [http://plus.google.com/110981030061712822816/posts/KaSKeg4vQtz batshit-liberal] language designed for small teams of [http://en.wikipedia.org/wiki/Motivation#Intrinsic_and_extrinsic_motivation intrinsically-motivated] programmers. Wart is based on [http://paulgraham.com/lispfaq1.html lisp], but with a cleaner syntax and more powerful primitives to help non-lispers appreciate the power of lisp. Wart was designed with several questions in mind: + +* How far can we change the syntax of lisp without compromising the power of lisp macros? Wart has several features to help make codebases more pleasurable to read and easier to ramp up on. +*# While lispers can continue to write fully-parenthesized lisp, wart provides a whitespace-sensitive syntax that is easy to get used to and eliminates most parentheses for the convenience of non-lisp readers.
if (odd 3) "odd"
+*# Wart provides infix operators in an elegant way without compromising homoiconicity or macros. Infix operations provide only one precedence rule: operators without whitespace are evaluated before operators with whitespace.
(n * n-1)  # does what you think
The catch: infix characters like dashes can't be used in names, unlike traditional lisps. +*# All functions can be called with keyword arguments as needed, using ''aliases'' so both caller and callee can use the right name for them. +
+def (subtract a|from b)
+  a-b
+
+subtract 4 3
+=> 1
+
+subtract 3 :from 4
+=> 1
+
+ +* What would a language ecosystem be like without any backwards-compatibility guarantees, super easy to change and fork promiscuously? Wart has no version numbers, and new versions and forks are free to change all semantics to their hearts' desire. Instead of a spec or frozen interfaces, we rely on automated tests. Wart is thoroughly tested, and wart programs are expected to be thoroughly tested as well, and to buy in to the investment of needing to make changes during upgrades. The hope is that upgrade effort might be higher than the best-case scenario in other languages, but the worst-case time will remain tightly bounded because clients of libraries will be more likely to understand how they're implemented, and so be more empowered. (More info: http://akkartik.name/blog/libraries2) + +* What would a language look like with an emphasis on a parsimonious and harmonious system of names? This is only possible if the language has no reserved words, and even primitives can be overloaded in arbitrary ways. So you never end up with constructions like 'my_if' or 'append2' or 'queue_length'. (More info: http://akkartik.name/blog/readable-bad) + +* Can a language implementation remain intelligible to outsiders over time, especially under pressure to run fast? Wart is exploring experimental primitives in the core interpreter that will make partial evaluation as easy as passing code through eval multiple times. + +These are all hard open questions, not expected to be definitively answered anytime soon. Wart is an experiment, and looking for feedback from people unafraid to bounce between language and implementation. If that's you, check it out: http://github.com/akkartik/wart#readme + +To run the following examples: + + $ git clone http://github.com/akkartik/wart + $ cd wart + $ ./wart + ready! type in an expression, then hit enter twice. ctrl-d exits. + +Now you can start pasting in code. Lines starting with '=>' are results printed by Wart; don't type those in. \ No newline at end of file diff --git a/Lang/Wart/100-doors b/Lang/Wart/100-doors new file mode 120000 index 0000000000..7c626e1ac3 --- /dev/null +++ b/Lang/Wart/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Wart \ No newline at end of file diff --git a/Lang/Wart/Accumulator-factory b/Lang/Wart/Accumulator-factory new file mode 120000 index 0000000000..26920e454a --- /dev/null +++ b/Lang/Wart/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/Wart \ No newline at end of file diff --git a/Lang/Wart/Ackermann-function b/Lang/Wart/Ackermann-function new file mode 120000 index 0000000000..41595e8414 --- /dev/null +++ b/Lang/Wart/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Wart \ No newline at end of file diff --git a/Lang/Wart/Address-of-a-variable b/Lang/Wart/Address-of-a-variable new file mode 120000 index 0000000000..9427a0e693 --- /dev/null +++ b/Lang/Wart/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/Wart \ No newline at end of file diff --git a/Lang/Wart/Anonymous-recursion b/Lang/Wart/Anonymous-recursion new file mode 120000 index 0000000000..d75b61b047 --- /dev/null +++ b/Lang/Wart/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/Wart \ No newline at end of file diff --git a/Lang/Wart/Apply-a-callback-to-an-array b/Lang/Wart/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..a4b15e4f51 --- /dev/null +++ b/Lang/Wart/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Wart \ No newline at end of file diff --git a/Lang/Wart/Arithmetic-Integer b/Lang/Wart/Arithmetic-Integer new file mode 120000 index 0000000000..25cdde6f42 --- /dev/null +++ b/Lang/Wart/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Wart \ No newline at end of file diff --git a/Lang/Wart/Array-concatenation b/Lang/Wart/Array-concatenation new file mode 120000 index 0000000000..dbc2148997 --- /dev/null +++ b/Lang/Wart/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Wart \ No newline at end of file diff --git a/Lang/Wart/Associative-array-Creation b/Lang/Wart/Associative-array-Creation new file mode 120000 index 0000000000..aaf6111173 --- /dev/null +++ b/Lang/Wart/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Wart \ No newline at end of file diff --git a/Lang/Wart/Associative-array-Iteration b/Lang/Wart/Associative-array-Iteration new file mode 120000 index 0000000000..b176de6cb1 --- /dev/null +++ b/Lang/Wart/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Wart \ No newline at end of file diff --git a/Lang/Wart/Averages-Arithmetic-mean b/Lang/Wart/Averages-Arithmetic-mean new file mode 120000 index 0000000000..f0e9366190 --- /dev/null +++ b/Lang/Wart/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Wart \ No newline at end of file diff --git a/Lang/Wart/Bitmap-Bresenhams-line-algorithm b/Lang/Wart/Bitmap-Bresenhams-line-algorithm new file mode 120000 index 0000000000..065fdd86aa --- /dev/null +++ b/Lang/Wart/Bitmap-Bresenhams-line-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Bresenhams-line-algorithm/Wart \ No newline at end of file diff --git a/Lang/Wart/Comments b/Lang/Wart/Comments new file mode 120000 index 0000000000..89fb2f23f2 --- /dev/null +++ b/Lang/Wart/Comments @@ -0,0 +1 @@ +../../Task/Comments/Wart \ No newline at end of file diff --git a/Lang/Wart/Dot-product b/Lang/Wart/Dot-product new file mode 120000 index 0000000000..0dca003232 --- /dev/null +++ b/Lang/Wart/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Wart \ No newline at end of file diff --git a/Lang/Wart/Execute-a-system-command b/Lang/Wart/Execute-a-system-command new file mode 120000 index 0000000000..ae81cf4fce --- /dev/null +++ b/Lang/Wart/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/Wart \ No newline at end of file diff --git a/Lang/Wart/Factorial b/Lang/Wart/Factorial new file mode 120000 index 0000000000..3759e63c23 --- /dev/null +++ b/Lang/Wart/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Wart \ No newline at end of file diff --git a/Lang/Wart/Fibonacci-sequence b/Lang/Wart/Fibonacci-sequence new file mode 120000 index 0000000000..c5938ec4fc --- /dev/null +++ b/Lang/Wart/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Wart \ No newline at end of file diff --git a/Lang/Wart/File-input-output b/Lang/Wart/File-input-output new file mode 120000 index 0000000000..624cdfe16e --- /dev/null +++ b/Lang/Wart/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/Wart \ No newline at end of file diff --git a/Lang/Wart/FizzBuzz b/Lang/Wart/FizzBuzz new file mode 120000 index 0000000000..504aeee8b6 --- /dev/null +++ b/Lang/Wart/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Wart \ No newline at end of file diff --git a/Lang/Wart/Flatten-a-list b/Lang/Wart/Flatten-a-list new file mode 120000 index 0000000000..2f07d43ae1 --- /dev/null +++ b/Lang/Wart/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Wart \ No newline at end of file diff --git a/Lang/Wart/Fork b/Lang/Wart/Fork new file mode 120000 index 0000000000..eae73b3a81 --- /dev/null +++ b/Lang/Wart/Fork @@ -0,0 +1 @@ +../../Task/Fork/Wart \ No newline at end of file diff --git a/Lang/Wart/Function-definition b/Lang/Wart/Function-definition new file mode 120000 index 0000000000..2ad3b9190a --- /dev/null +++ b/Lang/Wart/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Wart \ No newline at end of file diff --git a/Lang/Wart/Generic-swap b/Lang/Wart/Generic-swap new file mode 120000 index 0000000000..e818d12d17 --- /dev/null +++ b/Lang/Wart/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/Wart \ No newline at end of file diff --git a/Lang/Wart/Greatest-element-of-a-list b/Lang/Wart/Greatest-element-of-a-list new file mode 120000 index 0000000000..9883ae210d --- /dev/null +++ b/Lang/Wart/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Wart \ No newline at end of file diff --git a/Lang/Wart/Hello-world-Text b/Lang/Wart/Hello-world-Text new file mode 120000 index 0000000000..f98300cbf6 --- /dev/null +++ b/Lang/Wart/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Wart \ No newline at end of file diff --git a/Lang/Wart/Hello-world-Web-server b/Lang/Wart/Hello-world-Web-server new file mode 120000 index 0000000000..cdbf091f74 --- /dev/null +++ b/Lang/Wart/Hello-world-Web-server @@ -0,0 +1 @@ +../../Task/Hello-world-Web-server/Wart \ No newline at end of file diff --git a/Lang/Wart/Integer-comparison b/Lang/Wart/Integer-comparison new file mode 120000 index 0000000000..67b3709b90 --- /dev/null +++ b/Lang/Wart/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Wart \ No newline at end of file diff --git a/Lang/Wart/Loop-over-multiple-arrays-simultaneously b/Lang/Wart/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..980fd11f54 --- /dev/null +++ b/Lang/Wart/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Wart \ No newline at end of file diff --git a/Lang/Wart/Loops-Downward-for b/Lang/Wart/Loops-Downward-for new file mode 120000 index 0000000000..058f8371a0 --- /dev/null +++ b/Lang/Wart/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Wart \ No newline at end of file diff --git a/Lang/Wart/Loops-For b/Lang/Wart/Loops-For new file mode 120000 index 0000000000..9b0122779e --- /dev/null +++ b/Lang/Wart/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Wart \ No newline at end of file diff --git a/Lang/Wart/Loops-For-with-a-specified-step b/Lang/Wart/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..81937f5aa9 --- /dev/null +++ b/Lang/Wart/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Wart \ No newline at end of file diff --git a/Lang/Wart/Loops-Foreach b/Lang/Wart/Loops-Foreach new file mode 120000 index 0000000000..9a8cd6d762 --- /dev/null +++ b/Lang/Wart/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Wart \ No newline at end of file diff --git a/Lang/Wart/Loops-Infinite b/Lang/Wart/Loops-Infinite new file mode 120000 index 0000000000..3df2b7d3a9 --- /dev/null +++ b/Lang/Wart/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Wart \ No newline at end of file diff --git a/Lang/Wart/Loops-N-plus-one-half b/Lang/Wart/Loops-N-plus-one-half new file mode 120000 index 0000000000..d78d7ca738 --- /dev/null +++ b/Lang/Wart/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Wart \ No newline at end of file diff --git a/Lang/Wart/Loops-While b/Lang/Wart/Loops-While new file mode 120000 index 0000000000..d8fa866d96 --- /dev/null +++ b/Lang/Wart/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Wart \ No newline at end of file diff --git a/Lang/Wart/Middle-three-digits b/Lang/Wart/Middle-three-digits new file mode 120000 index 0000000000..4784f1df8d --- /dev/null +++ b/Lang/Wart/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/Wart \ No newline at end of file diff --git a/Lang/Wart/Null-object b/Lang/Wart/Null-object new file mode 120000 index 0000000000..562753c928 --- /dev/null +++ b/Lang/Wart/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/Wart \ No newline at end of file diff --git a/Lang/Wart/One-dimensional-cellular-automata b/Lang/Wart/One-dimensional-cellular-automata new file mode 120000 index 0000000000..4e0aa97916 --- /dev/null +++ b/Lang/Wart/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/Wart \ No newline at end of file diff --git a/Lang/Wart/Order-two-numerical-lists b/Lang/Wart/Order-two-numerical-lists new file mode 120000 index 0000000000..730c00d15d --- /dev/null +++ b/Lang/Wart/Order-two-numerical-lists @@ -0,0 +1 @@ +../../Task/Order-two-numerical-lists/Wart \ No newline at end of file diff --git a/Lang/Wart/Queue-Definition b/Lang/Wart/Queue-Definition new file mode 120000 index 0000000000..446216c46b --- /dev/null +++ b/Lang/Wart/Queue-Definition @@ -0,0 +1 @@ +../../Task/Queue-Definition/Wart \ No newline at end of file diff --git a/Lang/Wart/README b/Lang/Wart/README new file mode 100644 index 0000000000..0a67279af3 --- /dev/null +++ b/Lang/Wart/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Wart diff --git a/Lang/Wart/Read-a-file-line-by-line b/Lang/Wart/Read-a-file-line-by-line new file mode 120000 index 0000000000..8542487f06 --- /dev/null +++ b/Lang/Wart/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/Wart \ No newline at end of file diff --git a/Lang/Wart/Read-entire-file b/Lang/Wart/Read-entire-file new file mode 120000 index 0000000000..c4cb1f7f52 --- /dev/null +++ b/Lang/Wart/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Wart \ No newline at end of file diff --git a/Lang/Wart/Remove-duplicate-elements b/Lang/Wart/Remove-duplicate-elements new file mode 120000 index 0000000000..6ff2bb6f2d --- /dev/null +++ b/Lang/Wart/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/Wart \ No newline at end of file diff --git a/Lang/Wart/Repeat-a-string b/Lang/Wart/Repeat-a-string new file mode 120000 index 0000000000..2b9c6feec6 --- /dev/null +++ b/Lang/Wart/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Wart \ No newline at end of file diff --git a/Lang/Wart/Reverse-a-string b/Lang/Wart/Reverse-a-string new file mode 120000 index 0000000000..00e7970317 --- /dev/null +++ b/Lang/Wart/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Wart \ No newline at end of file diff --git a/Lang/Wart/Rot-13 b/Lang/Wart/Rot-13 new file mode 120000 index 0000000000..66459cb062 --- /dev/null +++ b/Lang/Wart/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Wart \ No newline at end of file diff --git a/Lang/Wart/Search-a-list b/Lang/Wart/Search-a-list new file mode 120000 index 0000000000..0cdccb5c92 --- /dev/null +++ b/Lang/Wart/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Wart \ No newline at end of file diff --git a/Lang/Wart/Shell-one-liner b/Lang/Wart/Shell-one-liner new file mode 120000 index 0000000000..a83228e5ca --- /dev/null +++ b/Lang/Wart/Shell-one-liner @@ -0,0 +1 @@ +../../Task/Shell-one-liner/Wart \ No newline at end of file diff --git a/Lang/Wart/Singly-linked-list-Traversal b/Lang/Wart/Singly-linked-list-Traversal new file mode 120000 index 0000000000..2d05919c8f --- /dev/null +++ b/Lang/Wart/Singly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Traversal/Wart \ No newline at end of file diff --git a/Lang/Wart/Sorting-algorithms-Quicksort b/Lang/Wart/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..1123c7591c --- /dev/null +++ b/Lang/Wart/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Wart \ No newline at end of file diff --git a/Lang/Wart/Stack b/Lang/Wart/Stack new file mode 120000 index 0000000000..ee93000703 --- /dev/null +++ b/Lang/Wart/Stack @@ -0,0 +1 @@ +../../Task/Stack/Wart \ No newline at end of file diff --git a/Lang/Wart/String-append b/Lang/Wart/String-append new file mode 120000 index 0000000000..f271bbdf97 --- /dev/null +++ b/Lang/Wart/String-append @@ -0,0 +1 @@ +../../Task/String-append/Wart \ No newline at end of file diff --git a/Lang/Wart/String-prepend b/Lang/Wart/String-prepend new file mode 120000 index 0000000000..8b24f2a34b --- /dev/null +++ b/Lang/Wart/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Wart \ No newline at end of file diff --git a/Lang/Wart/Substring b/Lang/Wart/Substring new file mode 120000 index 0000000000..49a0703c84 --- /dev/null +++ b/Lang/Wart/Substring @@ -0,0 +1 @@ +../../Task/Substring/Wart \ No newline at end of file diff --git a/Lang/Wart/Sum-and-product-of-an-array b/Lang/Wart/Sum-and-product-of-an-array new file mode 120000 index 0000000000..5211b1385a --- /dev/null +++ b/Lang/Wart/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Wart \ No newline at end of file diff --git a/Lang/Wart/Time-a-function b/Lang/Wart/Time-a-function new file mode 120000 index 0000000000..305cdcd6bd --- /dev/null +++ b/Lang/Wart/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/Wart \ No newline at end of file diff --git a/Lang/Wart/Y-combinator b/Lang/Wart/Y-combinator new file mode 120000 index 0000000000..1903f3edff --- /dev/null +++ b/Lang/Wart/Y-combinator @@ -0,0 +1 @@ +../../Task/Y-combinator/Wart \ No newline at end of file diff --git a/Lang/Wolfram-Language/00DESCRIPTION b/Lang/Wolfram-Language/00DESCRIPTION new file mode 100644 index 0000000000..d2a432395c --- /dev/null +++ b/Lang/Wolfram-Language/00DESCRIPTION @@ -0,0 +1,9 @@ +{{language|Wolfram Language +|site=http://reference.wolfram.com/language/ +|strength=strong +|checking=dynamic +|gc=yes +|LCT=yes}}{{language programming paradigm|Declarative}}{{language programming paradigm|Functional}} +The Wolfram Language is the programming language that is used in the computational software program, [[Mathematica]]. It is a multi-paradigm programming language developed by [http://wolfram.com Wolfram Research]. It is designed to be as general as possible, with emphasis on symbolic computation, functional programming, and rule-based programming, as well as built to represent arbitrary structures and data. + +[[Category:Mathematical programming languages]] \ No newline at end of file diff --git a/Lang/Wolfram-Language/Hello-world-Text b/Lang/Wolfram-Language/Hello-world-Text new file mode 120000 index 0000000000..47aa1a0a39 --- /dev/null +++ b/Lang/Wolfram-Language/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Wolfram-Language \ No newline at end of file diff --git a/Lang/Wolfram-Language/README b/Lang/Wolfram-Language/README new file mode 100644 index 0000000000..37312a9c0a --- /dev/null +++ b/Lang/Wolfram-Language/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Wolfram_Language diff --git a/Lang/Wollok/00DESCRIPTION b/Lang/Wollok/00DESCRIPTION new file mode 100644 index 0000000000..1846dc32e5 --- /dev/null +++ b/Lang/Wollok/00DESCRIPTION @@ -0,0 +1,12 @@ +{{language}} + +Wollok is a programming language and environment for teaching OOP. +It is currently under active development. + +It takes away syntax complexity and focus on objects, messages and polymorphism. + +It features objects as first class citizens in order to start programming OOP without the need of classes (and its complexity). +But it also supports classes and simple inheritance. + + +For more information visit https://github.com/uqbar-project/wollok \ No newline at end of file diff --git a/Lang/Wollok/Polymorphism b/Lang/Wollok/Polymorphism new file mode 120000 index 0000000000..31e057c546 --- /dev/null +++ b/Lang/Wollok/Polymorphism @@ -0,0 +1 @@ +../../Task/Polymorphism/Wollok \ No newline at end of file diff --git a/Lang/Wollok/README b/Lang/Wollok/README new file mode 100644 index 0000000000..01673a95ad --- /dev/null +++ b/Lang/Wollok/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Wollok diff --git a/Lang/Wortel/00DESCRIPTION b/Lang/Wortel/00DESCRIPTION new file mode 100644 index 0000000000..d71d2314fe --- /dev/null +++ b/Lang/Wortel/00DESCRIPTION @@ -0,0 +1,6 @@ +{{language|Wortel +|site=http://github.com/atennapel/Wortel +|LCT=no +}} +{{language programming paradigm|Functional}} +Wortel is a programming language that compiles down to JavaScript, like CoffeeScript. It's main goals are to be concise and to provide functional features such as partial application and composition. \ No newline at end of file diff --git a/Lang/Wortel/100-doors b/Lang/Wortel/100-doors new file mode 120000 index 0000000000..d63c7693f0 --- /dev/null +++ b/Lang/Wortel/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Wortel \ No newline at end of file diff --git a/Lang/Wortel/99-Bottles-of-Beer b/Lang/Wortel/99-Bottles-of-Beer new file mode 120000 index 0000000000..dc8eb103a5 --- /dev/null +++ b/Lang/Wortel/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Arithmetic-Complex b/Lang/Wortel/Arithmetic-Complex new file mode 120000 index 0000000000..c5c796e6ff --- /dev/null +++ b/Lang/Wortel/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Averages-Arithmetic-mean b/Lang/Wortel/Averages-Arithmetic-mean new file mode 120000 index 0000000000..d580db476e --- /dev/null +++ b/Lang/Wortel/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Averages-Median b/Lang/Wortel/Averages-Median new file mode 120000 index 0000000000..7d75d2b91b --- /dev/null +++ b/Lang/Wortel/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Averages-Root-mean-square b/Lang/Wortel/Averages-Root-mean-square new file mode 120000 index 0000000000..798ab0acdb --- /dev/null +++ b/Lang/Wortel/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Binary-digits b/Lang/Wortel/Binary-digits new file mode 120000 index 0000000000..1e0c1ec77c --- /dev/null +++ b/Lang/Wortel/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Binary-search b/Lang/Wortel/Binary-search new file mode 120000 index 0000000000..f4d7dbe89e --- /dev/null +++ b/Lang/Wortel/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Caesar-cipher b/Lang/Wortel/Caesar-cipher new file mode 120000 index 0000000000..552443a41e --- /dev/null +++ b/Lang/Wortel/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Catalan-numbers b/Lang/Wortel/Catalan-numbers new file mode 120000 index 0000000000..667a5eb67f --- /dev/null +++ b/Lang/Wortel/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Catamorphism b/Lang/Wortel/Catamorphism new file mode 120000 index 0000000000..ea89f73c79 --- /dev/null +++ b/Lang/Wortel/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Conways-Game-of-Life b/Lang/Wortel/Conways-Game-of-Life new file mode 120000 index 0000000000..beec3ed522 --- /dev/null +++ b/Lang/Wortel/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Count-occurrences-of-a-substring b/Lang/Wortel/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..c01c728f44 --- /dev/null +++ b/Lang/Wortel/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Currying b/Lang/Wortel/Currying new file mode 120000 index 0000000000..cd5dcc3f2c --- /dev/null +++ b/Lang/Wortel/Currying @@ -0,0 +1 @@ +../../Task/Currying/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Day-of-the-week b/Lang/Wortel/Day-of-the-week new file mode 120000 index 0000000000..33022c4b8c --- /dev/null +++ b/Lang/Wortel/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Digital-root b/Lang/Wortel/Digital-root new file mode 120000 index 0000000000..4d05296b17 --- /dev/null +++ b/Lang/Wortel/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Factorial b/Lang/Wortel/Factorial new file mode 120000 index 0000000000..efcc7d4c4a --- /dev/null +++ b/Lang/Wortel/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Factors-of-an-integer b/Lang/Wortel/Factors-of-an-integer new file mode 120000 index 0000000000..3686267bac --- /dev/null +++ b/Lang/Wortel/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Wortel \ No newline at end of file diff --git a/Lang/Wortel/FizzBuzz b/Lang/Wortel/FizzBuzz new file mode 120000 index 0000000000..a29212b8a6 --- /dev/null +++ b/Lang/Wortel/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Function-composition b/Lang/Wortel/Function-composition new file mode 120000 index 0000000000..9637713705 --- /dev/null +++ b/Lang/Wortel/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Greatest-common-divisor b/Lang/Wortel/Greatest-common-divisor new file mode 120000 index 0000000000..5a37ffed4e --- /dev/null +++ b/Lang/Wortel/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Greatest-element-of-a-list b/Lang/Wortel/Greatest-element-of-a-list new file mode 120000 index 0000000000..86cadc3824 --- /dev/null +++ b/Lang/Wortel/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Guess-the-number b/Lang/Wortel/Guess-the-number new file mode 120000 index 0000000000..0e3dc5ce4e --- /dev/null +++ b/Lang/Wortel/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Hash-from-two-arrays b/Lang/Wortel/Hash-from-two-arrays new file mode 120000 index 0000000000..4c0a3a015e --- /dev/null +++ b/Lang/Wortel/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Identity-matrix b/Lang/Wortel/Identity-matrix new file mode 120000 index 0000000000..fc40876489 --- /dev/null +++ b/Lang/Wortel/Identity-matrix @@ -0,0 +1 @@ +../../Task/Identity-matrix/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Inverted-syntax b/Lang/Wortel/Inverted-syntax new file mode 120000 index 0000000000..321baf21a7 --- /dev/null +++ b/Lang/Wortel/Inverted-syntax @@ -0,0 +1 @@ +../../Task/Inverted-syntax/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Kaprekar-numbers b/Lang/Wortel/Kaprekar-numbers new file mode 120000 index 0000000000..99d98dcd65 --- /dev/null +++ b/Lang/Wortel/Kaprekar-numbers @@ -0,0 +1 @@ +../../Task/Kaprekar-numbers/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Leap-year b/Lang/Wortel/Leap-year new file mode 120000 index 0000000000..a0aa833d23 --- /dev/null +++ b/Lang/Wortel/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Least-common-multiple b/Lang/Wortel/Least-common-multiple new file mode 120000 index 0000000000..724c2d7690 --- /dev/null +++ b/Lang/Wortel/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Matrix-transposition b/Lang/Wortel/Matrix-transposition new file mode 120000 index 0000000000..6077f6e25e --- /dev/null +++ b/Lang/Wortel/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Multifactorial b/Lang/Wortel/Multifactorial new file mode 120000 index 0000000000..890035972b --- /dev/null +++ b/Lang/Wortel/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Palindrome-detection b/Lang/Wortel/Palindrome-detection new file mode 120000 index 0000000000..af379cca3e --- /dev/null +++ b/Lang/Wortel/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Pernicious-numbers b/Lang/Wortel/Pernicious-numbers new file mode 120000 index 0000000000..a400196c1a --- /dev/null +++ b/Lang/Wortel/Pernicious-numbers @@ -0,0 +1 @@ +../../Task/Pernicious-numbers/Wortel \ No newline at end of file diff --git a/Lang/Wortel/README b/Lang/Wortel/README new file mode 100644 index 0000000000..5f53e4da14 --- /dev/null +++ b/Lang/Wortel/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Wortel diff --git a/Lang/Wortel/Remove-duplicate-elements b/Lang/Wortel/Remove-duplicate-elements new file mode 120000 index 0000000000..2347b874df --- /dev/null +++ b/Lang/Wortel/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Repeat-a-string b/Lang/Wortel/Repeat-a-string new file mode 120000 index 0000000000..277fefa84d --- /dev/null +++ b/Lang/Wortel/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Reverse-a-string b/Lang/Wortel/Reverse-a-string new file mode 120000 index 0000000000..d58150d9c7 --- /dev/null +++ b/Lang/Wortel/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Sort-an-integer-array b/Lang/Wortel/Sort-an-integer-array new file mode 120000 index 0000000000..923e19ed00 --- /dev/null +++ b/Lang/Wortel/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Sum-and-product-of-an-array b/Lang/Wortel/Sum-and-product-of-an-array new file mode 120000 index 0000000000..985b260176 --- /dev/null +++ b/Lang/Wortel/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Sum-multiples-of-3-and-5 b/Lang/Wortel/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..ba960e21ae --- /dev/null +++ b/Lang/Wortel/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Sum-of-a-series b/Lang/Wortel/Sum-of-a-series new file mode 120000 index 0000000000..232c822a31 --- /dev/null +++ b/Lang/Wortel/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Sum-of-squares b/Lang/Wortel/Sum-of-squares new file mode 120000 index 0000000000..3b936e98cf --- /dev/null +++ b/Lang/Wortel/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Tokenize-a-string b/Lang/Wortel/Tokenize-a-string new file mode 120000 index 0000000000..6949cb7e64 --- /dev/null +++ b/Lang/Wortel/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Wortel \ No newline at end of file diff --git a/Lang/Wortel/Vector-products b/Lang/Wortel/Vector-products new file mode 120000 index 0000000000..c755bba8e2 --- /dev/null +++ b/Lang/Wortel/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/Wortel \ No newline at end of file diff --git a/Lang/Wren/00DESCRIPTION b/Lang/Wren/00DESCRIPTION new file mode 100644 index 0000000000..39f23de2c7 --- /dev/null +++ b/Lang/Wren/00DESCRIPTION @@ -0,0 +1,11 @@ +{{language|Wren +|exec=interpreted +|strength=strong +|safety=safe +|express=implicit +|checking=dynamic +|gc=yes +|site=https://munificent.github.io/wren +}}{{language programming paradigm|Object-oriented}} + +Wren is a lightweight, [[object-oriented]] [[programming language]] designed to be an easily-embeddable scripting language. \ No newline at end of file diff --git a/Lang/Wren/100-doors b/Lang/Wren/100-doors new file mode 120000 index 0000000000..15702034a1 --- /dev/null +++ b/Lang/Wren/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Wren \ No newline at end of file diff --git a/Lang/Wren/99-Bottles-of-Beer b/Lang/Wren/99-Bottles-of-Beer new file mode 120000 index 0000000000..9b075f6fa8 --- /dev/null +++ b/Lang/Wren/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Wren \ No newline at end of file diff --git a/Lang/Wren/A+B b/Lang/Wren/A+B new file mode 120000 index 0000000000..4fa16daa4f --- /dev/null +++ b/Lang/Wren/A+B @@ -0,0 +1 @@ +../../Task/A+B/Wren \ No newline at end of file diff --git a/Lang/Wren/Ackermann-function b/Lang/Wren/Ackermann-function new file mode 120000 index 0000000000..8b0e75ee75 --- /dev/null +++ b/Lang/Wren/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Wren \ No newline at end of file diff --git a/Lang/Wren/Anonymous-recursion b/Lang/Wren/Anonymous-recursion new file mode 120000 index 0000000000..0c9de7c246 --- /dev/null +++ b/Lang/Wren/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/Wren \ No newline at end of file diff --git a/Lang/Wren/Apply-a-callback-to-an-array b/Lang/Wren/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..d0b7ee6a3e --- /dev/null +++ b/Lang/Wren/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Wren \ No newline at end of file diff --git a/Lang/Wren/Arithmetic-Integer b/Lang/Wren/Arithmetic-Integer new file mode 120000 index 0000000000..3e48c2493e --- /dev/null +++ b/Lang/Wren/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Wren \ No newline at end of file diff --git a/Lang/Wren/Array-concatenation b/Lang/Wren/Array-concatenation new file mode 120000 index 0000000000..49c8441767 --- /dev/null +++ b/Lang/Wren/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Wren \ No newline at end of file diff --git a/Lang/Wren/Arrays b/Lang/Wren/Arrays new file mode 120000 index 0000000000..4527d84fe5 --- /dev/null +++ b/Lang/Wren/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Wren \ No newline at end of file diff --git a/Lang/Wren/Averages-Arithmetic-mean b/Lang/Wren/Averages-Arithmetic-mean new file mode 120000 index 0000000000..8749a9a7fd --- /dev/null +++ b/Lang/Wren/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Wren \ No newline at end of file diff --git a/Lang/Wren/Averages-Mode b/Lang/Wren/Averages-Mode new file mode 120000 index 0000000000..f79f6ce2b7 --- /dev/null +++ b/Lang/Wren/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/Wren \ No newline at end of file diff --git a/Lang/Wren/Collections b/Lang/Wren/Collections new file mode 120000 index 0000000000..374ef181d1 --- /dev/null +++ b/Lang/Wren/Collections @@ -0,0 +1 @@ +../../Task/Collections/Wren \ No newline at end of file diff --git a/Lang/Wren/Hello-world-Newline-omission b/Lang/Wren/Hello-world-Newline-omission new file mode 120000 index 0000000000..56e5a5635d --- /dev/null +++ b/Lang/Wren/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Wren \ No newline at end of file diff --git a/Lang/Wren/Hello-world-Text b/Lang/Wren/Hello-world-Text new file mode 120000 index 0000000000..3fddc456f6 --- /dev/null +++ b/Lang/Wren/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Wren \ No newline at end of file diff --git a/Lang/Wren/README b/Lang/Wren/README new file mode 100644 index 0000000000..a7b37d3f10 --- /dev/null +++ b/Lang/Wren/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Wren diff --git a/Lang/Wren/String-length b/Lang/Wren/String-length new file mode 120000 index 0000000000..1ad1255324 --- /dev/null +++ b/Lang/Wren/String-length @@ -0,0 +1 @@ +../../Task/String-length/Wren \ No newline at end of file diff --git a/Lang/XEec/00DESCRIPTION b/Lang/XEec/00DESCRIPTION new file mode 100644 index 0000000000..355b8157f9 --- /dev/null +++ b/Lang/XEec/00DESCRIPTION @@ -0,0 +1,9 @@ +{{language|xEec}} +'''xEec''' is an esoteric programming language designed and implemented in October 2015 by [[Paulo Jorente]]. + + +==See also== +* [http://esolangs.org/wiki/xEec xEec Esolangs] – xEec on Esolangs +* [http://paulo-jorente.de/poncho/esolang/xEec xEec page] – features specs, programs and an interpreter. + +[[Category:Esoteric_Languages]] \ No newline at end of file diff --git a/Lang/XEec/README b/Lang/XEec/README new file mode 100644 index 0000000000..6c5141c237 --- /dev/null +++ b/Lang/XEec/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:XEec diff --git a/Lang/XLISP/00DESCRIPTION b/Lang/XLISP/00DESCRIPTION new file mode 100644 index 0000000000..3d65edc294 --- /dev/null +++ b/Lang/XLISP/00DESCRIPTION @@ -0,0 +1,2 @@ +{{stub}}{{language|XLISP}} +XLISP, created by David Betz and first released in 1984, is a Lisp dialect with support for simple object-oriented programming using classes. Since 1997 it has been based on Scheme, with some extensions resembling Common Lisp. \ No newline at end of file diff --git a/Lang/XLISP/A+B b/Lang/XLISP/A+B new file mode 120000 index 0000000000..1b2eaa8567 --- /dev/null +++ b/Lang/XLISP/A+B @@ -0,0 +1 @@ +../../Task/A+B/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Ackermann-function b/Lang/XLISP/Ackermann-function new file mode 120000 index 0000000000..b56dcbde07 --- /dev/null +++ b/Lang/XLISP/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Arithmetic-Integer b/Lang/XLISP/Arithmetic-Integer new file mode 120000 index 0000000000..c22844266b --- /dev/null +++ b/Lang/XLISP/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Arrays b/Lang/XLISP/Arrays new file mode 120000 index 0000000000..73bf6d5437 --- /dev/null +++ b/Lang/XLISP/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Associative-array-Creation b/Lang/XLISP/Associative-array-Creation new file mode 120000 index 0000000000..92259fce80 --- /dev/null +++ b/Lang/XLISP/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Averages-Arithmetic-mean b/Lang/XLISP/Averages-Arithmetic-mean new file mode 120000 index 0000000000..fe6bac880f --- /dev/null +++ b/Lang/XLISP/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Averages-Root-mean-square b/Lang/XLISP/Averages-Root-mean-square new file mode 120000 index 0000000000..380e5aa096 --- /dev/null +++ b/Lang/XLISP/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Caesar-cipher b/Lang/XLISP/Caesar-cipher new file mode 120000 index 0000000000..8ee339fa1f --- /dev/null +++ b/Lang/XLISP/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Calendar b/Lang/XLISP/Calendar new file mode 120000 index 0000000000..7a43ebdec5 --- /dev/null +++ b/Lang/XLISP/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Calendar---for-REAL-programmers b/Lang/XLISP/Calendar---for-REAL-programmers new file mode 120000 index 0000000000..a685681e83 --- /dev/null +++ b/Lang/XLISP/Calendar---for-REAL-programmers @@ -0,0 +1 @@ +../../Task/Calendar---for-REAL-programmers/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Call-a-function b/Lang/XLISP/Call-a-function new file mode 120000 index 0000000000..1ae88ed101 --- /dev/null +++ b/Lang/XLISP/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Call-an-object-method b/Lang/XLISP/Call-an-object-method new file mode 120000 index 0000000000..7ed14dda0d --- /dev/null +++ b/Lang/XLISP/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Case-sensitivity-of-identifiers b/Lang/XLISP/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..f7a8f6aa6b --- /dev/null +++ b/Lang/XLISP/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Character-codes b/Lang/XLISP/Character-codes new file mode 120000 index 0000000000..d5a384a85c --- /dev/null +++ b/Lang/XLISP/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Classes b/Lang/XLISP/Classes new file mode 120000 index 0000000000..55101b2759 --- /dev/null +++ b/Lang/XLISP/Classes @@ -0,0 +1 @@ +../../Task/Classes/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Comma-quibbling b/Lang/XLISP/Comma-quibbling new file mode 120000 index 0000000000..05e8dd6d64 --- /dev/null +++ b/Lang/XLISP/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Comments b/Lang/XLISP/Comments new file mode 120000 index 0000000000..a7cca48024 --- /dev/null +++ b/Lang/XLISP/Comments @@ -0,0 +1 @@ +../../Task/Comments/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Compile-time-calculation b/Lang/XLISP/Compile-time-calculation new file mode 120000 index 0000000000..102056b162 --- /dev/null +++ b/Lang/XLISP/Compile-time-calculation @@ -0,0 +1 @@ +../../Task/Compile-time-calculation/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Determine-if-a-string-is-numeric b/Lang/XLISP/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..d59f5cf96b --- /dev/null +++ b/Lang/XLISP/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Fibonacci-sequence b/Lang/XLISP/Fibonacci-sequence new file mode 120000 index 0000000000..03f89be9d2 --- /dev/null +++ b/Lang/XLISP/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/XLISP \ No newline at end of file diff --git a/Lang/XLISP/FizzBuzz b/Lang/XLISP/FizzBuzz new file mode 120000 index 0000000000..1688431bba --- /dev/null +++ b/Lang/XLISP/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Function-definition b/Lang/XLISP/Function-definition new file mode 120000 index 0000000000..200912fc49 --- /dev/null +++ b/Lang/XLISP/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Generate-lower-case-ASCII-alphabet b/Lang/XLISP/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..4b41a1be6e --- /dev/null +++ b/Lang/XLISP/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Guess-the-number b/Lang/XLISP/Guess-the-number new file mode 120000 index 0000000000..979dc75365 --- /dev/null +++ b/Lang/XLISP/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Guess-the-number-With-feedback b/Lang/XLISP/Guess-the-number-With-feedback new file mode 120000 index 0000000000..961aa4b37f --- /dev/null +++ b/Lang/XLISP/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Hello-world-Newline-omission b/Lang/XLISP/Hello-world-Newline-omission new file mode 120000 index 0000000000..2eeefe0368 --- /dev/null +++ b/Lang/XLISP/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Hello-world-Standard-error b/Lang/XLISP/Hello-world-Standard-error new file mode 120000 index 0000000000..870bbed132 --- /dev/null +++ b/Lang/XLISP/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Hello-world-Text b/Lang/XLISP/Hello-world-Text new file mode 120000 index 0000000000..ca59dbe888 --- /dev/null +++ b/Lang/XLISP/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Increment-a-numerical-string b/Lang/XLISP/Increment-a-numerical-string new file mode 120000 index 0000000000..ec8c8db29c --- /dev/null +++ b/Lang/XLISP/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Inheritance-Single b/Lang/XLISP/Inheritance-Single new file mode 120000 index 0000000000..895f37cde1 --- /dev/null +++ b/Lang/XLISP/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Integer-comparison b/Lang/XLISP/Integer-comparison new file mode 120000 index 0000000000..a07c063245 --- /dev/null +++ b/Lang/XLISP/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Interactive-programming b/Lang/XLISP/Interactive-programming new file mode 120000 index 0000000000..b86e6296d2 --- /dev/null +++ b/Lang/XLISP/Interactive-programming @@ -0,0 +1 @@ +../../Task/Interactive-programming/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Leap-year b/Lang/XLISP/Leap-year new file mode 120000 index 0000000000..bc1412451b --- /dev/null +++ b/Lang/XLISP/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Logical-operations b/Lang/XLISP/Logical-operations new file mode 120000 index 0000000000..acfb0c3df9 --- /dev/null +++ b/Lang/XLISP/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Loops-For b/Lang/XLISP/Loops-For new file mode 120000 index 0000000000..1bfa281f89 --- /dev/null +++ b/Lang/XLISP/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Loops-Foreach b/Lang/XLISP/Loops-Foreach new file mode 120000 index 0000000000..9acdab2860 --- /dev/null +++ b/Lang/XLISP/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Loops-While b/Lang/XLISP/Loops-While new file mode 120000 index 0000000000..ebeade15cb --- /dev/null +++ b/Lang/XLISP/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Nth b/Lang/XLISP/Nth new file mode 120000 index 0000000000..2abdb7b1af --- /dev/null +++ b/Lang/XLISP/Nth @@ -0,0 +1 @@ +../../Task/Nth/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Queue-Definition b/Lang/XLISP/Queue-Definition new file mode 120000 index 0000000000..97ad6136da --- /dev/null +++ b/Lang/XLISP/Queue-Definition @@ -0,0 +1 @@ +../../Task/Queue-Definition/XLISP \ No newline at end of file diff --git a/Lang/XLISP/README b/Lang/XLISP/README new file mode 100644 index 0000000000..eea60b4e9e --- /dev/null +++ b/Lang/XLISP/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:XLISP diff --git a/Lang/XLISP/Roman-numerals-Decode b/Lang/XLISP/Roman-numerals-Decode new file mode 120000 index 0000000000..af3e85f75a --- /dev/null +++ b/Lang/XLISP/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Roman-numerals-Encode b/Lang/XLISP/Roman-numerals-Encode new file mode 120000 index 0000000000..25e85df3c1 --- /dev/null +++ b/Lang/XLISP/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Sequence-of-non-squares b/Lang/XLISP/Sequence-of-non-squares new file mode 120000 index 0000000000..eef009b2aa --- /dev/null +++ b/Lang/XLISP/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Special-variables b/Lang/XLISP/Special-variables new file mode 120000 index 0000000000..7172444fa4 --- /dev/null +++ b/Lang/XLISP/Special-variables @@ -0,0 +1 @@ +../../Task/Special-variables/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Stack b/Lang/XLISP/Stack new file mode 120000 index 0000000000..639097c8d2 --- /dev/null +++ b/Lang/XLISP/Stack @@ -0,0 +1 @@ +../../Task/Stack/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Sum-of-squares b/Lang/XLISP/Sum-of-squares new file mode 120000 index 0000000000..7348b55152 --- /dev/null +++ b/Lang/XLISP/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Temperature-conversion b/Lang/XLISP/Temperature-conversion new file mode 120000 index 0000000000..f299738a39 --- /dev/null +++ b/Lang/XLISP/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Variadic-function b/Lang/XLISP/Variadic-function new file mode 120000 index 0000000000..9fec69fb19 --- /dev/null +++ b/Lang/XLISP/Variadic-function @@ -0,0 +1 @@ +../../Task/Variadic-function/XLISP \ No newline at end of file diff --git a/Lang/XLISP/Zero-to-the-zero-power b/Lang/XLISP/Zero-to-the-zero-power new file mode 120000 index 0000000000..6309c27313 --- /dev/null +++ b/Lang/XLISP/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/XLISP \ No newline at end of file diff --git a/Lang/XPath-2.0/00DESCRIPTION b/Lang/XPath-2.0/00DESCRIPTION new file mode 100644 index 0000000000..c8485c9fa4 --- /dev/null +++ b/Lang/XPath-2.0/00DESCRIPTION @@ -0,0 +1,9 @@ +{{Language| +site=http://www.w3.org/TR/xpath20| +hopl=no| +bnf=http://www.w3.org/TR/xpath20/#id-grammar +}} + +XPath 2.0 is a query language mainly used for selecting nodes or atomic values from an XML document. +{{Language_programming_paradigm|Declarative}} +{{stub}} \ No newline at end of file diff --git a/Lang/XPath-2.0/FizzBuzz b/Lang/XPath-2.0/FizzBuzz new file mode 120000 index 0000000000..ce8dab262e --- /dev/null +++ b/Lang/XPath-2.0/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/XPath-2.0 \ No newline at end of file diff --git a/Lang/XPath-2.0/README b/Lang/XPath-2.0/README new file mode 100644 index 0000000000..4e172a0689 --- /dev/null +++ b/Lang/XPath-2.0/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:XPath_2.0 diff --git a/Lang/Xojo/00DESCRIPTION b/Lang/Xojo/00DESCRIPTION new file mode 100644 index 0000000000..b7efb3665f --- /dev/null +++ b/Lang/Xojo/00DESCRIPTION @@ -0,0 +1,10 @@ +{{language|Xojo +|exec=machine +|strength=strong +|checking=both +|parampass=both +|gc=reference counting +|safety=safe +|site=http://developer.apple.com/swift/}} +{{language programming paradigm|Object-oriented}} +[[wp:Xojo|Xojo]] is an object-oriented, multi-platform language made by Xojo, Inc. Xojo uses its own IDE and has the ability to create native desktop apps for Windows, OS X and Linux; web apps (HTML5/JavaScript) and native iOS apps. \ No newline at end of file diff --git a/Lang/Xojo/99-Bottles-of-Beer b/Lang/Xojo/99-Bottles-of-Beer new file mode 120000 index 0000000000..0c5296ca79 --- /dev/null +++ b/Lang/Xojo/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Xojo \ No newline at end of file diff --git a/Lang/Xojo/Luhn-test-of-credit-card-numbers b/Lang/Xojo/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..4a9e85e4a9 --- /dev/null +++ b/Lang/Xojo/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Xojo \ No newline at end of file diff --git a/Lang/Xojo/README b/Lang/Xojo/README new file mode 100644 index 0000000000..98570f48a3 --- /dev/null +++ b/Lang/Xojo/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Xojo diff --git a/Lang/Ya/00DESCRIPTION b/Lang/Ya/00DESCRIPTION new file mode 100644 index 0000000000..6662852284 --- /dev/null +++ b/Lang/Ya/00DESCRIPTION @@ -0,0 +1,105 @@ +{{language|Ya +|exec=machine +|safety=both +|gc=no +|parampass=both +|checking=both +|express=explicit +|strength=strong +|compat=both +|tags=Ya +|site=http://Ya-Lang.com +| operating_system = Only [[Windows]] for now +| file_ext = .ya +| paradigm = [[multi-paradigm programming language|multi-paradigm]]: [[object-oriented programming|object-oriented]], [[structured programming|structured]], [[imperative programming|imperative]], [[generic programming|generic]], [[metaprogramming]] +| year = {{Start date|2012}} +| designer = [[Pavel Senatorov]] +| developer = [[Pavel Senatorov]] +| latest_test_version = Ya Trial Compiler 0.0 +| latest_test_date = {{Start date and age|2013|08|05}} +| turing-complete = Yes +| typing = [[type system|Static, strong, safe]] +| influenced_by = [[C++]], [[Ceylon (programming language)|Ceylon]] +}} + +'''Ya''' (pronounced /jˈʌ/) is based on '''[[C++]]''' and gets most of '''C++''' as is. Yet there is no compatibility with '''C++''', '''C++''' program is not a '''Ya''' program and cannot be compiled as is. + +'''Ya''' adds to '''C++''' extensible syntax, extensible lexical tokens, possibility to execute parts of compiling program during it's compilation ('''[[metaprogramming]]'''), support for '''SQL'''-like operations for processing databases and database-like internal data, and many small improvements over '''C++'''. + +== Example: Hello World == + +@HelloWorld.Ya; +using ; +$int($char[][] args) main + printf("Hello, %s!\n", args.Length > 1 ? args[1] : "World"); + return 0; + + +== Basics of Ya == + +=== Block structure is described by tabs at start of lines === +Tabs at start of line are counted and used for specifying code blocks '''{...}''', like in [[Python]]. But blocks made in '''single''' line with '''{''' and '''}''' are also supported. Typical Ya program has near to no one '''{''' and '''}'''. + +=== Modules, ala #define and no project file === +* Named modules: '''@FileName;''' at the start of each compiled file. Modules are always named starting by '''@''' and module name is module's file name. Example: '''@C:/S/Ya/YaParser.Ya;''' +* Header files are not used. Instead it is the statement '''using @module, @module;''' so separate header and implementation for a module does not used, because '''using @module;''' gets interface of module into work but not implementation details. +* In Ya there are no project files. Each Ya project has '''main''' or '''starting''' source that is specified for compiler on command line to compile. Main source includes '''using @module, @module;''' so that all required modules will be included and compiled. As a result a separate project file is not required. + +=== Double compilation aka [[Metaprogramming]] === +* While compiler compiles, parts of the compiling program could be executed. +* It's required for extending Ya syntax, lexical tokens and to perform optimizations, with optimizer being written in the program being compiled. +* This feature is named [[metaprogramming]] in theory of languages. + +=== Extensible syntax === +* New statements maybe described. For example it's possible to add statement '''foreach''' for newly written type of a container. +* New nonterminals: Maybe it will be possible to add to language syntax even a new nonterminal and rules for using it. + +=== Extensible lexical tokens === +* Possibility to add new operators to expressions. Examples: +** For sortings it's required comparison result of lesser or equal or bigger and it's possible to add new operator, let's name it '''<=>''', which makes such kind of comparison. +** Let's '''<->''' will notify exchange of values of variables (swap). Usage: '''$int i,j; i <-> j;''' +* Possibility to make other new constants +** For example time is typically written like '''10:53:17''' - addition of a new kind of constant is described as '''[[regex|regular expression]]''' and the code for transforming of text of new constant into required type the programmer writes on Ya. Note that this code will be executed at compile time, not run time. So this feature requires what they name '''[[metaprogramming|double compilation]]'''. Making new constants not yet ready. + +=== Support for databases and internal structures like databases === +It will probably be done as library. It will be possible to write expression that works with a number of tables, which are sets (f.e. arrays, lists) of fielded type (of class), and perform '''join where sortby''' of SQL. In C# it is named '''[[Language Integrated Query]]'''. + +=== Multiple names for any entity === +Variables, functions, types and template argument requirements all may be named by a number of names. No need to use '''#define''' instead. Example: '''$int a b c = 100;''' - here you can use this variable by name '''a''' or '''b''' or '''c'''. + +=== Description of types === +* Any type name is started by '''$''' and type name must go after '''$''' without spaces - it's a single token. +* All additions to type like pointer '''*''' are written without spaces also. +* All types are considered classes, for example it is possible to inherit from '''$int'''. +* New types are described like here: '''!any $constint = $int-; !any $PtrToInt = $int*;''' +* Keyword '''class''' is not used. Instead you just write '''!any $myClass { body of structure-class }''' +* Description of type properties, for example 'pointer to type', are '''all''' written '''after''' the type name, and all properties are specified by signs. Example: '''$int+-*-''' means in C++ '''const unsigned int* const''', here '''+''' means '''unsigned''' and '''-''' means '''const'''. +* No references '''&''', only pointers '''*''' are used. References in C++ is a side-effect feature and is of value only because no need to write '''*''' to dereference a reference. But the same is with pointers in Ya, even more, see below. +* That makes type description much more short. But it's required to learn the type signs, because keywords like '''const unsigned signed''' all have gone. +* If you need to define a number of vars of the same type, for example '''$int**''', then you write '''$int** A, B, C;''' instead of '''int **A, **B, **C;'''. Description becomes shorter, yet there is no way to define '''int A, *B;''' in 1 statement, 2 statements are required: '''$int A; $int* B;'''. + +=== Many small improvements in the base of C++ === +* Work with pointers is simple, no need to dereference or getting address, all this is automatically inserted. Example: '''$int** ptrptr; $int i = ptrptr;''' - here in '''i = ptrptr;''' is automatic double dereferencing a pointer. +* Specification of new or old operators for some type is made simple, for example '''$T* $T* a = $T* b;''' specifies assignment for type '''$T'''. Both args and return type are specified as pointers - this is because there are no references and because working with pointers is simple, no need to dereference or getting address, all this is automatically inserted. +* Specification of requirements for template args are added, like a not included feature of '''[[C++11]]'''. This specifications are named '''!SomeName''', for example '''!any''' in type definitions above means that specified type has no requirements. Example of requirements definition: '''#template != { $* $* a = $* b; }''' specifies that '''!=''' types must have assignment operator '''$* $* a = $* b;''' +* '''for''' statement: '''for InitExprOrVarDef; ConditionExpr; IncExpr { BodyOfLoop }''' - so 1.parenceses not used, 2.body of loop is always in {} - typically it means that body of loop is on next lines and is 1 tab right shifted. All other is the same as in C++. '''if while do while switch''' are all the same - everywhere no '''()''' and body of statement is block. +* '''switch''' statement example: + +switch 10-5 + 0..3,7 + printf("Wow! It's 0,1,2,3 or 7\n"); + 5 + printf("Simple case!\n"); + else + printf("default is written as default or else.\n"); + +Each case starts without '''case''' and ''':''' after case values is not written. Case values can include many values and also ranges '''value..value''', like in '''0..3,7''' - this case works for 0,1,2,3 or 7. Also no need to write '''break;''' to break out of case - it is automatically included at the end of a case. But if it's required to continue on next case then '''continue;''' may be used - it jumps to the body of next case. +* '''break;''' - breaking from loops and switches is enchanced, it is possible to break from many loops+switches in 1 step. Example: '''for ;; { for ;; { switch 7 { 0..3,7 { break for for switch; }}}}''' +* Operator precedence in expressions: in Ya spaces around operator are counted and it's used for defining precedence. Example: '''1+2 * 3;''' - it's '''(1+2) * 3;''' because no spaces in '''1+2''' and 1 space in '''2 *''' +* '''enum''' is extended: they are not only '''int''' but of any type, the type is specified. Example: + +!any $StringEnum enum $char[] + Str1 = "lala", Str2 = "bebe" +!any $ErraType enum $int+:8 // i.e. they are unsigned bytes + eFatal, eErr, eWarn, eMess, + \ No newline at end of file diff --git a/Lang/Ya/Balanced-brackets b/Lang/Ya/Balanced-brackets new file mode 120000 index 0000000000..517be59b87 --- /dev/null +++ b/Lang/Ya/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Ya \ No newline at end of file diff --git a/Lang/Ya/README b/Lang/Ya/README new file mode 100644 index 0000000000..fb96e4a49c --- /dev/null +++ b/Lang/Ya/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Ya diff --git a/Lang/Zkl/00DESCRIPTION b/Lang/Zkl/00DESCRIPTION new file mode 100644 index 0000000000..42aae14b69 --- /dev/null +++ b/Lang/Zkl/00DESCRIPTION @@ -0,0 +1,24 @@ +{{language|zkl +|site=http://www.zenkinetic.com/zkl.html +|exec=bytecode +|gc=yes +|strength=strong +|safety=safe +|checking=dynamic +|express=implicit +|parampass=reference +|hopl=no +|tags=zkl +}} +zkl is a general purpose object oriented programming language. It is imperative but borrows concepts from many programming paradigms, including functional and prototype based. It is curly-bracketed, dynamic, reflective, and threaded. It has built in garbage collection, strings, lists, dictionaries, threads, fibers (continuations and co-routines) and more. The syntax strongly resembles the C programming language while the data model is closer to that of Python and Smalltalk. +The goals of the language are rapid prototyping and programmer productivity. Program speed and the the constraints of production oriented programming are not high on the "needs" list. + +It is open source and free. Download, compile and play with it. The VM is written in C, it compiles with clang, GCC or VisualStudio (makefiles, project files included) on Linux/FreeBSD/MS Windows. Running it is old school: command line or REPL, no IDE or GUI. Will work with emacs or vi! I use c mode. + +== External Links and References == +=== Web Pages === +* [http://www.zenkinetic.com/zkl.html zkl home page] +* [http://www.zenkinetic.com/zklDownloads.html zkl downloads page] + +=== Books === +* [http://www.zenkinetic.com/Documents/zklManual.pdf The zkl programming language and reference manual (PDF)] \ No newline at end of file diff --git a/Lang/Zkl/README b/Lang/Zkl/README new file mode 100644 index 0000000000..33b54a467f --- /dev/null +++ b/Lang/Zkl/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:Zkl diff --git a/Lang/jq/00DESCRIPTION b/Lang/jq/00DESCRIPTION new file mode 100644 index 0000000000..553ca50eda --- /dev/null +++ b/Lang/jq/00DESCRIPTION @@ -0,0 +1,6 @@ +{{language +|site=http://stedolan.github.io/jq}} +{{language programming paradigm|Functional}} +jq is a [[functional programming]] language that is oriented towards processing text files or [[JSON]]. jq is also the name of a portable executable that compiles and runs jq programs. + +jq was originally designed and developed by Stephen Dolan. \ No newline at end of file diff --git a/Lang/jq/100-doors b/Lang/jq/100-doors new file mode 120000 index 0000000000..64620c24ef --- /dev/null +++ b/Lang/jq/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/jq \ No newline at end of file diff --git a/Lang/jq/24-game-Solve b/Lang/jq/24-game-Solve new file mode 120000 index 0000000000..c90a118112 --- /dev/null +++ b/Lang/jq/24-game-Solve @@ -0,0 +1 @@ +../../Task/24-game-Solve/jq \ No newline at end of file diff --git a/Lang/jq/99-Bottles-of-Beer b/Lang/jq/99-Bottles-of-Beer new file mode 120000 index 0000000000..fd06f971ca --- /dev/null +++ b/Lang/jq/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/jq \ No newline at end of file diff --git a/Lang/jq/A+B b/Lang/jq/A+B new file mode 120000 index 0000000000..6361cd7926 --- /dev/null +++ b/Lang/jq/A+B @@ -0,0 +1 @@ +../../Task/A+B/jq \ No newline at end of file diff --git a/Lang/jq/ABC-Problem b/Lang/jq/ABC-Problem new file mode 120000 index 0000000000..9dbe42d1f2 --- /dev/null +++ b/Lang/jq/ABC-Problem @@ -0,0 +1 @@ +../../Task/ABC-Problem/jq \ No newline at end of file diff --git a/Lang/jq/AKS-test-for-primes b/Lang/jq/AKS-test-for-primes new file mode 120000 index 0000000000..1d445baabf --- /dev/null +++ b/Lang/jq/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/jq \ No newline at end of file diff --git a/Lang/jq/Abundant,-deficient-and-perfect-number-classifications b/Lang/jq/Abundant,-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..8700f2750b --- /dev/null +++ b/Lang/jq/Abundant,-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant,-deficient-and-perfect-number-classifications/jq \ No newline at end of file diff --git a/Lang/jq/Ackermann-function b/Lang/jq/Ackermann-function new file mode 120000 index 0000000000..5f15421b94 --- /dev/null +++ b/Lang/jq/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/jq \ No newline at end of file diff --git a/Lang/jq/Add-a-variable-to-a-class-instance-at-runtime b/Lang/jq/Add-a-variable-to-a-class-instance-at-runtime new file mode 120000 index 0000000000..e5a02b3885 --- /dev/null +++ b/Lang/jq/Add-a-variable-to-a-class-instance-at-runtime @@ -0,0 +1 @@ +../../Task/Add-a-variable-to-a-class-instance-at-runtime/jq \ No newline at end of file diff --git a/Lang/jq/Align-columns b/Lang/jq/Align-columns new file mode 120000 index 0000000000..4f5471e554 --- /dev/null +++ b/Lang/jq/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/jq \ No newline at end of file diff --git a/Lang/jq/Aliquot-sequence-classifications b/Lang/jq/Aliquot-sequence-classifications new file mode 120000 index 0000000000..2b48aff453 --- /dev/null +++ b/Lang/jq/Aliquot-sequence-classifications @@ -0,0 +1 @@ +../../Task/Aliquot-sequence-classifications/jq \ No newline at end of file diff --git a/Lang/jq/Almost-prime b/Lang/jq/Almost-prime new file mode 120000 index 0000000000..ce12bdb414 --- /dev/null +++ b/Lang/jq/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/jq \ No newline at end of file diff --git a/Lang/jq/Amb b/Lang/jq/Amb new file mode 120000 index 0000000000..4e0cd6e134 --- /dev/null +++ b/Lang/jq/Amb @@ -0,0 +1 @@ +../../Task/Amb/jq \ No newline at end of file diff --git a/Lang/jq/Amicable-pairs b/Lang/jq/Amicable-pairs new file mode 120000 index 0000000000..0e2e48e729 --- /dev/null +++ b/Lang/jq/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/jq \ No newline at end of file diff --git a/Lang/jq/Anagrams b/Lang/jq/Anagrams new file mode 120000 index 0000000000..9f636a01bd --- /dev/null +++ b/Lang/jq/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/jq \ No newline at end of file diff --git a/Lang/jq/Anonymous-recursion b/Lang/jq/Anonymous-recursion new file mode 120000 index 0000000000..9455fcd8fd --- /dev/null +++ b/Lang/jq/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/jq \ No newline at end of file diff --git a/Lang/jq/Apply-a-callback-to-an-array b/Lang/jq/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..0baca02d61 --- /dev/null +++ b/Lang/jq/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/jq \ No newline at end of file diff --git a/Lang/jq/Arithmetic-Complex b/Lang/jq/Arithmetic-Complex new file mode 120000 index 0000000000..db7763bb31 --- /dev/null +++ b/Lang/jq/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/jq \ No newline at end of file diff --git a/Lang/jq/Arithmetic-Integer b/Lang/jq/Arithmetic-Integer new file mode 120000 index 0000000000..ad19e7ca66 --- /dev/null +++ b/Lang/jq/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/jq \ No newline at end of file diff --git a/Lang/jq/Arithmetic-geometric-mean b/Lang/jq/Arithmetic-geometric-mean new file mode 120000 index 0000000000..ca9b6deb24 --- /dev/null +++ b/Lang/jq/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/jq \ No newline at end of file diff --git a/Lang/jq/Array-concatenation b/Lang/jq/Array-concatenation new file mode 120000 index 0000000000..f027bac8cb --- /dev/null +++ b/Lang/jq/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/jq \ No newline at end of file diff --git a/Lang/jq/Arrays b/Lang/jq/Arrays new file mode 120000 index 0000000000..ba381d3771 --- /dev/null +++ b/Lang/jq/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/jq \ No newline at end of file diff --git a/Lang/jq/Associative-array-Creation b/Lang/jq/Associative-array-Creation new file mode 120000 index 0000000000..8cf173c3f5 --- /dev/null +++ b/Lang/jq/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/jq \ No newline at end of file diff --git a/Lang/jq/Averages-Arithmetic-mean b/Lang/jq/Averages-Arithmetic-mean new file mode 120000 index 0000000000..0c9b68267a --- /dev/null +++ b/Lang/jq/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/jq \ No newline at end of file diff --git a/Lang/jq/Averages-Mean-angle b/Lang/jq/Averages-Mean-angle new file mode 120000 index 0000000000..f55f649ff4 --- /dev/null +++ b/Lang/jq/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/jq \ No newline at end of file diff --git a/Lang/jq/Averages-Mean-time-of-day b/Lang/jq/Averages-Mean-time-of-day new file mode 120000 index 0000000000..66e9750781 --- /dev/null +++ b/Lang/jq/Averages-Mean-time-of-day @@ -0,0 +1 @@ +../../Task/Averages-Mean-time-of-day/jq \ No newline at end of file diff --git a/Lang/jq/Averages-Median b/Lang/jq/Averages-Median new file mode 120000 index 0000000000..44b59e8aa9 --- /dev/null +++ b/Lang/jq/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/jq \ No newline at end of file diff --git a/Lang/jq/Averages-Mode b/Lang/jq/Averages-Mode new file mode 120000 index 0000000000..e454ba61ad --- /dev/null +++ b/Lang/jq/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/jq \ No newline at end of file diff --git a/Lang/jq/Averages-Pythagorean-means b/Lang/jq/Averages-Pythagorean-means new file mode 120000 index 0000000000..54687ab122 --- /dev/null +++ b/Lang/jq/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/jq \ No newline at end of file diff --git a/Lang/jq/Averages-Root-mean-square b/Lang/jq/Averages-Root-mean-square new file mode 120000 index 0000000000..f2aed7d862 --- /dev/null +++ b/Lang/jq/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/jq \ No newline at end of file diff --git a/Lang/jq/Benfords-law b/Lang/jq/Benfords-law new file mode 120000 index 0000000000..8911fc1a34 --- /dev/null +++ b/Lang/jq/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/jq \ No newline at end of file diff --git a/Lang/jq/Bernoulli-numbers b/Lang/jq/Bernoulli-numbers new file mode 120000 index 0000000000..a997f43128 --- /dev/null +++ b/Lang/jq/Bernoulli-numbers @@ -0,0 +1 @@ +../../Task/Bernoulli-numbers/jq \ No newline at end of file diff --git a/Lang/jq/Binary-digits b/Lang/jq/Binary-digits new file mode 120000 index 0000000000..75fc620e9c --- /dev/null +++ b/Lang/jq/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/jq \ No newline at end of file diff --git a/Lang/jq/Binary-search b/Lang/jq/Binary-search new file mode 120000 index 0000000000..4d9c9511f1 --- /dev/null +++ b/Lang/jq/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/jq \ No newline at end of file diff --git a/Lang/jq/Binary-strings b/Lang/jq/Binary-strings new file mode 120000 index 0000000000..b148f22acb --- /dev/null +++ b/Lang/jq/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/jq \ No newline at end of file diff --git a/Lang/jq/CSV-data-manipulation b/Lang/jq/CSV-data-manipulation new file mode 120000 index 0000000000..c0ad56b70e --- /dev/null +++ b/Lang/jq/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/jq \ No newline at end of file diff --git a/Lang/jq/CSV-to-HTML-translation b/Lang/jq/CSV-to-HTML-translation new file mode 120000 index 0000000000..46cccba951 --- /dev/null +++ b/Lang/jq/CSV-to-HTML-translation @@ -0,0 +1 @@ +../../Task/CSV-to-HTML-translation/jq \ No newline at end of file diff --git a/Lang/jq/Case-sensitivity-of-identifiers b/Lang/jq/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..915d942945 --- /dev/null +++ b/Lang/jq/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/jq \ No newline at end of file diff --git a/Lang/jq/Casting-out-nines b/Lang/jq/Casting-out-nines new file mode 120000 index 0000000000..fb944eaf04 --- /dev/null +++ b/Lang/jq/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/jq \ No newline at end of file diff --git a/Lang/jq/Catalan-numbers b/Lang/jq/Catalan-numbers new file mode 120000 index 0000000000..e3f6e86128 --- /dev/null +++ b/Lang/jq/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/jq \ No newline at end of file diff --git a/Lang/jq/Catalan-numbers-Pascals-triangle b/Lang/jq/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..b25f0007ca --- /dev/null +++ b/Lang/jq/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/jq \ No newline at end of file diff --git a/Lang/jq/Character-codes b/Lang/jq/Character-codes new file mode 120000 index 0000000000..3beaf03f67 --- /dev/null +++ b/Lang/jq/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/jq \ No newline at end of file diff --git a/Lang/jq/Chinese-remainder-theorem b/Lang/jq/Chinese-remainder-theorem new file mode 120000 index 0000000000..0d73598544 --- /dev/null +++ b/Lang/jq/Chinese-remainder-theorem @@ -0,0 +1 @@ +../../Task/Chinese-remainder-theorem/jq \ No newline at end of file diff --git a/Lang/jq/Cholesky-decomposition b/Lang/jq/Cholesky-decomposition new file mode 120000 index 0000000000..6c068aaea2 --- /dev/null +++ b/Lang/jq/Cholesky-decomposition @@ -0,0 +1 @@ +../../Task/Cholesky-decomposition/jq \ No newline at end of file diff --git a/Lang/jq/Circles-of-given-radius-through-two-points b/Lang/jq/Circles-of-given-radius-through-two-points new file mode 120000 index 0000000000..39b6dd572d --- /dev/null +++ b/Lang/jq/Circles-of-given-radius-through-two-points @@ -0,0 +1 @@ +../../Task/Circles-of-given-radius-through-two-points/jq \ No newline at end of file diff --git a/Lang/jq/Closest-pair-problem b/Lang/jq/Closest-pair-problem new file mode 120000 index 0000000000..eb8d48b547 --- /dev/null +++ b/Lang/jq/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/jq \ No newline at end of file diff --git a/Lang/jq/Collections b/Lang/jq/Collections new file mode 120000 index 0000000000..8492e6ab97 --- /dev/null +++ b/Lang/jq/Collections @@ -0,0 +1 @@ +../../Task/Collections/jq \ No newline at end of file diff --git a/Lang/jq/Combinations b/Lang/jq/Combinations new file mode 120000 index 0000000000..c6012ce04b --- /dev/null +++ b/Lang/jq/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/jq \ No newline at end of file diff --git a/Lang/jq/Combinations-and-permutations b/Lang/jq/Combinations-and-permutations new file mode 120000 index 0000000000..b1fa8a8b7b --- /dev/null +++ b/Lang/jq/Combinations-and-permutations @@ -0,0 +1 @@ +../../Task/Combinations-and-permutations/jq \ No newline at end of file diff --git a/Lang/jq/Combinations-with-repetitions b/Lang/jq/Combinations-with-repetitions new file mode 120000 index 0000000000..00ec71621e --- /dev/null +++ b/Lang/jq/Combinations-with-repetitions @@ -0,0 +1 @@ +../../Task/Combinations-with-repetitions/jq \ No newline at end of file diff --git a/Lang/jq/Comma-quibbling b/Lang/jq/Comma-quibbling new file mode 120000 index 0000000000..b4ffffba2f --- /dev/null +++ b/Lang/jq/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/jq \ No newline at end of file diff --git a/Lang/jq/Comments b/Lang/jq/Comments new file mode 120000 index 0000000000..fc994d7ff2 --- /dev/null +++ b/Lang/jq/Comments @@ -0,0 +1 @@ +../../Task/Comments/jq \ No newline at end of file diff --git a/Lang/jq/Compound-data-type b/Lang/jq/Compound-data-type new file mode 120000 index 0000000000..b0f540a6a0 --- /dev/null +++ b/Lang/jq/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/jq \ No newline at end of file diff --git a/Lang/jq/Conditional-structures b/Lang/jq/Conditional-structures new file mode 120000 index 0000000000..1ec37e927b --- /dev/null +++ b/Lang/jq/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/jq \ No newline at end of file diff --git a/Lang/jq/Conjugate-transpose b/Lang/jq/Conjugate-transpose new file mode 120000 index 0000000000..c3ddd7b7c9 --- /dev/null +++ b/Lang/jq/Conjugate-transpose @@ -0,0 +1 @@ +../../Task/Conjugate-transpose/jq \ No newline at end of file diff --git a/Lang/jq/Continued-fraction b/Lang/jq/Continued-fraction new file mode 120000 index 0000000000..502e963312 --- /dev/null +++ b/Lang/jq/Continued-fraction @@ -0,0 +1 @@ +../../Task/Continued-fraction/jq \ No newline at end of file diff --git a/Lang/jq/Conways-Game-of-Life b/Lang/jq/Conways-Game-of-Life new file mode 120000 index 0000000000..d6960290f8 --- /dev/null +++ b/Lang/jq/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/jq \ No newline at end of file diff --git a/Lang/jq/Copy-a-string b/Lang/jq/Copy-a-string new file mode 120000 index 0000000000..c7574393ef --- /dev/null +++ b/Lang/jq/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/jq \ No newline at end of file diff --git a/Lang/jq/Count-occurrences-of-a-substring b/Lang/jq/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..d2aac595aa --- /dev/null +++ b/Lang/jq/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/jq \ No newline at end of file diff --git a/Lang/jq/Count-the-coins b/Lang/jq/Count-the-coins new file mode 120000 index 0000000000..3f202f31bc --- /dev/null +++ b/Lang/jq/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/jq \ No newline at end of file diff --git a/Lang/jq/Create-a-two-dimensional-array-at-runtime b/Lang/jq/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..2b956d97e5 --- /dev/null +++ b/Lang/jq/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/jq \ No newline at end of file diff --git a/Lang/jq/Create-an-HTML-table b/Lang/jq/Create-an-HTML-table new file mode 120000 index 0000000000..3ae0044846 --- /dev/null +++ b/Lang/jq/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/jq \ No newline at end of file diff --git a/Lang/jq/Currying b/Lang/jq/Currying new file mode 120000 index 0000000000..cab9263491 --- /dev/null +++ b/Lang/jq/Currying @@ -0,0 +1 @@ +../../Task/Currying/jq \ No newline at end of file diff --git a/Lang/jq/Date-format b/Lang/jq/Date-format new file mode 120000 index 0000000000..72829a1392 --- /dev/null +++ b/Lang/jq/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/jq \ No newline at end of file diff --git a/Lang/jq/Date-manipulation b/Lang/jq/Date-manipulation new file mode 120000 index 0000000000..17cbf7da3e --- /dev/null +++ b/Lang/jq/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/jq \ No newline at end of file diff --git a/Lang/jq/Day-of-the-week b/Lang/jq/Day-of-the-week new file mode 120000 index 0000000000..c061bc1c35 --- /dev/null +++ b/Lang/jq/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/jq \ No newline at end of file diff --git a/Lang/jq/Define-a-primitive-data-type b/Lang/jq/Define-a-primitive-data-type new file mode 120000 index 0000000000..dc95ff836a --- /dev/null +++ b/Lang/jq/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/jq \ No newline at end of file diff --git a/Lang/jq/Detect-division-by-zero b/Lang/jq/Detect-division-by-zero new file mode 120000 index 0000000000..3c1b98ee62 --- /dev/null +++ b/Lang/jq/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/jq \ No newline at end of file diff --git a/Lang/jq/Determine-if-a-string-is-numeric b/Lang/jq/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..c27a82cd1b --- /dev/null +++ b/Lang/jq/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/jq \ No newline at end of file diff --git a/Lang/jq/Digital-root b/Lang/jq/Digital-root new file mode 120000 index 0000000000..c63c2a55a5 --- /dev/null +++ b/Lang/jq/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/jq \ No newline at end of file diff --git a/Lang/jq/Digital-root-Multiplicative-digital-root b/Lang/jq/Digital-root-Multiplicative-digital-root new file mode 120000 index 0000000000..b5c7415db1 --- /dev/null +++ b/Lang/jq/Digital-root-Multiplicative-digital-root @@ -0,0 +1 @@ +../../Task/Digital-root-Multiplicative-digital-root/jq \ No newline at end of file diff --git a/Lang/jq/Dinesmans-multiple-dwelling-problem b/Lang/jq/Dinesmans-multiple-dwelling-problem new file mode 120000 index 0000000000..eadad000fe --- /dev/null +++ b/Lang/jq/Dinesmans-multiple-dwelling-problem @@ -0,0 +1 @@ +../../Task/Dinesmans-multiple-dwelling-problem/jq \ No newline at end of file diff --git a/Lang/jq/Dot-product b/Lang/jq/Dot-product new file mode 120000 index 0000000000..a65f918946 --- /dev/null +++ b/Lang/jq/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/jq \ No newline at end of file diff --git a/Lang/jq/Dragon-curve b/Lang/jq/Dragon-curve new file mode 120000 index 0000000000..62f7cafec1 --- /dev/null +++ b/Lang/jq/Dragon-curve @@ -0,0 +1 @@ +../../Task/Dragon-curve/jq \ No newline at end of file diff --git a/Lang/jq/Draw-a-sphere b/Lang/jq/Draw-a-sphere new file mode 120000 index 0000000000..1246656fef --- /dev/null +++ b/Lang/jq/Draw-a-sphere @@ -0,0 +1 @@ +../../Task/Draw-a-sphere/jq \ No newline at end of file diff --git a/Lang/jq/Element-wise-operations b/Lang/jq/Element-wise-operations new file mode 120000 index 0000000000..ed3f1bc8e4 --- /dev/null +++ b/Lang/jq/Element-wise-operations @@ -0,0 +1 @@ +../../Task/Element-wise-operations/jq \ No newline at end of file diff --git a/Lang/jq/Empty-string b/Lang/jq/Empty-string new file mode 120000 index 0000000000..51f274698d --- /dev/null +++ b/Lang/jq/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/jq \ No newline at end of file diff --git a/Lang/jq/Enforced-immutability b/Lang/jq/Enforced-immutability new file mode 120000 index 0000000000..68c05481df --- /dev/null +++ b/Lang/jq/Enforced-immutability @@ -0,0 +1 @@ +../../Task/Enforced-immutability/jq \ No newline at end of file diff --git a/Lang/jq/Entropy b/Lang/jq/Entropy new file mode 120000 index 0000000000..c93f61f414 --- /dev/null +++ b/Lang/jq/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/jq \ No newline at end of file diff --git a/Lang/jq/Enumerations b/Lang/jq/Enumerations new file mode 120000 index 0000000000..593efca591 --- /dev/null +++ b/Lang/jq/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/jq \ No newline at end of file diff --git a/Lang/jq/Environment-variables b/Lang/jq/Environment-variables new file mode 120000 index 0000000000..004aa3b98b --- /dev/null +++ b/Lang/jq/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/jq \ No newline at end of file diff --git a/Lang/jq/Equilibrium-index b/Lang/jq/Equilibrium-index new file mode 120000 index 0000000000..f494d635e4 --- /dev/null +++ b/Lang/jq/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/jq \ No newline at end of file diff --git a/Lang/jq/Euler-method b/Lang/jq/Euler-method new file mode 120000 index 0000000000..aa62ee130c --- /dev/null +++ b/Lang/jq/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/jq \ No newline at end of file diff --git a/Lang/jq/Evaluate-binomial-coefficients b/Lang/jq/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..238f725fec --- /dev/null +++ b/Lang/jq/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/jq \ No newline at end of file diff --git a/Lang/jq/Even-or-odd b/Lang/jq/Even-or-odd new file mode 120000 index 0000000000..0b205d47ab --- /dev/null +++ b/Lang/jq/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/jq \ No newline at end of file diff --git a/Lang/jq/Exceptions b/Lang/jq/Exceptions new file mode 120000 index 0000000000..b7def3ddba --- /dev/null +++ b/Lang/jq/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/jq \ No newline at end of file diff --git a/Lang/jq/Exceptions-Catch-an-exception-thrown-in-a-nested-call b/Lang/jq/Exceptions-Catch-an-exception-thrown-in-a-nested-call new file mode 120000 index 0000000000..563618c174 --- /dev/null +++ b/Lang/jq/Exceptions-Catch-an-exception-thrown-in-a-nested-call @@ -0,0 +1 @@ +../../Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/jq \ No newline at end of file diff --git a/Lang/jq/Exponentiation-operator b/Lang/jq/Exponentiation-operator new file mode 120000 index 0000000000..c4e0cc03e1 --- /dev/null +++ b/Lang/jq/Exponentiation-operator @@ -0,0 +1 @@ +../../Task/Exponentiation-operator/jq \ No newline at end of file diff --git a/Lang/jq/Extensible-prime-generator b/Lang/jq/Extensible-prime-generator new file mode 120000 index 0000000000..c63a971559 --- /dev/null +++ b/Lang/jq/Extensible-prime-generator @@ -0,0 +1 @@ +../../Task/Extensible-prime-generator/jq \ No newline at end of file diff --git a/Lang/jq/Extreme-floating-point-values b/Lang/jq/Extreme-floating-point-values new file mode 120000 index 0000000000..542d124028 --- /dev/null +++ b/Lang/jq/Extreme-floating-point-values @@ -0,0 +1 @@ +../../Task/Extreme-floating-point-values/jq \ No newline at end of file diff --git a/Lang/jq/Factorial b/Lang/jq/Factorial new file mode 120000 index 0000000000..dcc5573f66 --- /dev/null +++ b/Lang/jq/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/jq \ No newline at end of file diff --git a/Lang/jq/Factors-of-an-integer b/Lang/jq/Factors-of-an-integer new file mode 120000 index 0000000000..04ea6d9645 --- /dev/null +++ b/Lang/jq/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/jq \ No newline at end of file diff --git a/Lang/jq/Fast-Fourier-transform b/Lang/jq/Fast-Fourier-transform new file mode 120000 index 0000000000..3f07990b2a --- /dev/null +++ b/Lang/jq/Fast-Fourier-transform @@ -0,0 +1 @@ +../../Task/Fast-Fourier-transform/jq \ No newline at end of file diff --git a/Lang/jq/Fibonacci-n-step-number-sequences b/Lang/jq/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..fb36031b57 --- /dev/null +++ b/Lang/jq/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/jq \ No newline at end of file diff --git a/Lang/jq/Fibonacci-sequence b/Lang/jq/Fibonacci-sequence new file mode 120000 index 0000000000..be17810558 --- /dev/null +++ b/Lang/jq/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/jq \ No newline at end of file diff --git a/Lang/jq/Fibonacci-word b/Lang/jq/Fibonacci-word new file mode 120000 index 0000000000..8e839a910d --- /dev/null +++ b/Lang/jq/Fibonacci-word @@ -0,0 +1 @@ +../../Task/Fibonacci-word/jq \ No newline at end of file diff --git a/Lang/jq/File-input-output b/Lang/jq/File-input-output new file mode 120000 index 0000000000..0238b84121 --- /dev/null +++ b/Lang/jq/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/jq \ No newline at end of file diff --git a/Lang/jq/File-size b/Lang/jq/File-size new file mode 120000 index 0000000000..38d2e5ad66 --- /dev/null +++ b/Lang/jq/File-size @@ -0,0 +1 @@ +../../Task/File-size/jq \ No newline at end of file diff --git a/Lang/jq/Filter b/Lang/jq/Filter new file mode 120000 index 0000000000..d720eff4cd --- /dev/null +++ b/Lang/jq/Filter @@ -0,0 +1 @@ +../../Task/Filter/jq \ No newline at end of file diff --git a/Lang/jq/Find-common-directory-path b/Lang/jq/Find-common-directory-path new file mode 120000 index 0000000000..c2afe1e03c --- /dev/null +++ b/Lang/jq/Find-common-directory-path @@ -0,0 +1 @@ +../../Task/Find-common-directory-path/jq \ No newline at end of file diff --git a/Lang/jq/Find-limit-of-recursion b/Lang/jq/Find-limit-of-recursion new file mode 120000 index 0000000000..207fe5532a --- /dev/null +++ b/Lang/jq/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/jq \ No newline at end of file diff --git a/Lang/jq/Find-the-last-Sunday-of-each-month b/Lang/jq/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..32cc04d83f --- /dev/null +++ b/Lang/jq/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/jq \ No newline at end of file diff --git a/Lang/jq/Find-the-missing-permutation b/Lang/jq/Find-the-missing-permutation new file mode 120000 index 0000000000..e6135c39b9 --- /dev/null +++ b/Lang/jq/Find-the-missing-permutation @@ -0,0 +1 @@ +../../Task/Find-the-missing-permutation/jq \ No newline at end of file diff --git a/Lang/jq/First-class-functions-Use-numbers-analogously b/Lang/jq/First-class-functions-Use-numbers-analogously new file mode 120000 index 0000000000..4b6ebaee94 --- /dev/null +++ b/Lang/jq/First-class-functions-Use-numbers-analogously @@ -0,0 +1 @@ +../../Task/First-class-functions-Use-numbers-analogously/jq \ No newline at end of file diff --git a/Lang/jq/Five-weekends b/Lang/jq/Five-weekends new file mode 120000 index 0000000000..618c750622 --- /dev/null +++ b/Lang/jq/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/jq \ No newline at end of file diff --git a/Lang/jq/FizzBuzz b/Lang/jq/FizzBuzz new file mode 120000 index 0000000000..1ffda480cd --- /dev/null +++ b/Lang/jq/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/jq \ No newline at end of file diff --git a/Lang/jq/Flatten-a-list b/Lang/jq/Flatten-a-list new file mode 120000 index 0000000000..8d8d5d0011 --- /dev/null +++ b/Lang/jq/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/jq \ No newline at end of file diff --git a/Lang/jq/Floyds-triangle b/Lang/jq/Floyds-triangle new file mode 120000 index 0000000000..feca7b37ba --- /dev/null +++ b/Lang/jq/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/jq \ No newline at end of file diff --git a/Lang/jq/Formal-power-series b/Lang/jq/Formal-power-series new file mode 120000 index 0000000000..f3237a2ec3 --- /dev/null +++ b/Lang/jq/Formal-power-series @@ -0,0 +1 @@ +../../Task/Formal-power-series/jq \ No newline at end of file diff --git a/Lang/jq/Formatted-numeric-output b/Lang/jq/Formatted-numeric-output new file mode 120000 index 0000000000..0d016e90d9 --- /dev/null +++ b/Lang/jq/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/jq \ No newline at end of file diff --git a/Lang/jq/Forward-difference b/Lang/jq/Forward-difference new file mode 120000 index 0000000000..6ef6d304dd --- /dev/null +++ b/Lang/jq/Forward-difference @@ -0,0 +1 @@ +../../Task/Forward-difference/jq \ No newline at end of file diff --git a/Lang/jq/Four-bit-adder b/Lang/jq/Four-bit-adder new file mode 120000 index 0000000000..7b9d205879 --- /dev/null +++ b/Lang/jq/Four-bit-adder @@ -0,0 +1 @@ +../../Task/Four-bit-adder/jq \ No newline at end of file diff --git a/Lang/jq/Fractal-tree b/Lang/jq/Fractal-tree new file mode 120000 index 0000000000..5fc5742c6a --- /dev/null +++ b/Lang/jq/Fractal-tree @@ -0,0 +1 @@ +../../Task/Fractal-tree/jq \ No newline at end of file diff --git a/Lang/jq/Function-composition b/Lang/jq/Function-composition new file mode 120000 index 0000000000..5d68b294a4 --- /dev/null +++ b/Lang/jq/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/jq \ No newline at end of file diff --git a/Lang/jq/Function-definition b/Lang/jq/Function-definition new file mode 120000 index 0000000000..fb88f4218a --- /dev/null +++ b/Lang/jq/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/jq \ No newline at end of file diff --git a/Lang/jq/Gamma-function b/Lang/jq/Gamma-function new file mode 120000 index 0000000000..e98ab4bbc0 --- /dev/null +++ b/Lang/jq/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/jq \ No newline at end of file diff --git a/Lang/jq/Generate-lower-case-ASCII-alphabet b/Lang/jq/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..00511b6172 --- /dev/null +++ b/Lang/jq/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/jq \ No newline at end of file diff --git a/Lang/jq/Generator-Exponential b/Lang/jq/Generator-Exponential new file mode 120000 index 0000000000..5dc816f45f --- /dev/null +++ b/Lang/jq/Generator-Exponential @@ -0,0 +1 @@ +../../Task/Generator-Exponential/jq \ No newline at end of file diff --git a/Lang/jq/Generic-swap b/Lang/jq/Generic-swap new file mode 120000 index 0000000000..9b3b623e9e --- /dev/null +++ b/Lang/jq/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/jq \ No newline at end of file diff --git a/Lang/jq/Greatest-common-divisor b/Lang/jq/Greatest-common-divisor new file mode 120000 index 0000000000..458e3d1487 --- /dev/null +++ b/Lang/jq/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/jq \ No newline at end of file diff --git a/Lang/jq/Greatest-element-of-a-list b/Lang/jq/Greatest-element-of-a-list new file mode 120000 index 0000000000..8e7c217278 --- /dev/null +++ b/Lang/jq/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/jq \ No newline at end of file diff --git a/Lang/jq/Greatest-subsequential-sum b/Lang/jq/Greatest-subsequential-sum new file mode 120000 index 0000000000..d16c4ff425 --- /dev/null +++ b/Lang/jq/Greatest-subsequential-sum @@ -0,0 +1 @@ +../../Task/Greatest-subsequential-sum/jq \ No newline at end of file diff --git a/Lang/jq/Hailstone-sequence b/Lang/jq/Hailstone-sequence new file mode 120000 index 0000000000..531c842938 --- /dev/null +++ b/Lang/jq/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/jq \ No newline at end of file diff --git a/Lang/jq/Hamming-numbers b/Lang/jq/Hamming-numbers new file mode 120000 index 0000000000..ffbca6177b --- /dev/null +++ b/Lang/jq/Hamming-numbers @@ -0,0 +1 @@ +../../Task/Hamming-numbers/jq \ No newline at end of file diff --git a/Lang/jq/Happy-numbers b/Lang/jq/Happy-numbers new file mode 120000 index 0000000000..f0daba2747 --- /dev/null +++ b/Lang/jq/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/jq \ No newline at end of file diff --git a/Lang/jq/Harshad-or-Niven-series b/Lang/jq/Harshad-or-Niven-series new file mode 120000 index 0000000000..aae4606e1b --- /dev/null +++ b/Lang/jq/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/jq \ No newline at end of file diff --git a/Lang/jq/Hash-from-two-arrays b/Lang/jq/Hash-from-two-arrays new file mode 120000 index 0000000000..05834b8d3e --- /dev/null +++ b/Lang/jq/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/jq \ No newline at end of file diff --git a/Lang/jq/Hash-join b/Lang/jq/Hash-join new file mode 120000 index 0000000000..89b30387b6 --- /dev/null +++ b/Lang/jq/Hash-join @@ -0,0 +1 @@ +../../Task/Hash-join/jq \ No newline at end of file diff --git a/Lang/jq/Haversine-formula b/Lang/jq/Haversine-formula new file mode 120000 index 0000000000..45605bf44e --- /dev/null +++ b/Lang/jq/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/jq \ No newline at end of file diff --git a/Lang/jq/Hello-world-Graphical b/Lang/jq/Hello-world-Graphical new file mode 120000 index 0000000000..86ef90b894 --- /dev/null +++ b/Lang/jq/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/jq \ No newline at end of file diff --git a/Lang/jq/Hello-world-Newbie b/Lang/jq/Hello-world-Newbie new file mode 120000 index 0000000000..3739263b20 --- /dev/null +++ b/Lang/jq/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/jq \ No newline at end of file diff --git a/Lang/jq/Hello-world-Newline-omission b/Lang/jq/Hello-world-Newline-omission new file mode 120000 index 0000000000..79184d07a0 --- /dev/null +++ b/Lang/jq/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/jq \ No newline at end of file diff --git a/Lang/jq/Hello-world-Standard-error b/Lang/jq/Hello-world-Standard-error new file mode 120000 index 0000000000..4ef9ce9225 --- /dev/null +++ b/Lang/jq/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/jq \ No newline at end of file diff --git a/Lang/jq/Hello-world-Text b/Lang/jq/Hello-world-Text new file mode 120000 index 0000000000..fd30d28d8b --- /dev/null +++ b/Lang/jq/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/jq \ No newline at end of file diff --git a/Lang/jq/Here-document b/Lang/jq/Here-document new file mode 120000 index 0000000000..e5a693fc0e --- /dev/null +++ b/Lang/jq/Here-document @@ -0,0 +1 @@ +../../Task/Here-document/jq \ No newline at end of file diff --git a/Lang/jq/Heronian-triangles b/Lang/jq/Heronian-triangles new file mode 120000 index 0000000000..62d6773394 --- /dev/null +++ b/Lang/jq/Heronian-triangles @@ -0,0 +1 @@ +../../Task/Heronian-triangles/jq \ No newline at end of file diff --git a/Lang/jq/Hickerson-series-of-almost-integers b/Lang/jq/Hickerson-series-of-almost-integers new file mode 120000 index 0000000000..9f135439e9 --- /dev/null +++ b/Lang/jq/Hickerson-series-of-almost-integers @@ -0,0 +1 @@ +../../Task/Hickerson-series-of-almost-integers/jq \ No newline at end of file diff --git a/Lang/jq/Higher-order-functions b/Lang/jq/Higher-order-functions new file mode 120000 index 0000000000..039ab453b1 --- /dev/null +++ b/Lang/jq/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/jq \ No newline at end of file diff --git a/Lang/jq/Hofstadter-Q-sequence b/Lang/jq/Hofstadter-Q-sequence new file mode 120000 index 0000000000..ea0068c389 --- /dev/null +++ b/Lang/jq/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/jq \ No newline at end of file diff --git a/Lang/jq/I-before-E-except-after-C b/Lang/jq/I-before-E-except-after-C new file mode 120000 index 0000000000..8677e5a0c0 --- /dev/null +++ b/Lang/jq/I-before-E-except-after-C @@ -0,0 +1 @@ +../../Task/I-before-E-except-after-C/jq \ No newline at end of file diff --git a/Lang/jq/IBAN b/Lang/jq/IBAN new file mode 120000 index 0000000000..a0af10f6de --- /dev/null +++ b/Lang/jq/IBAN @@ -0,0 +1 @@ +../../Task/IBAN/jq \ No newline at end of file diff --git a/Lang/jq/Identity-matrix b/Lang/jq/Identity-matrix new file mode 120000 index 0000000000..050df62dfd --- /dev/null +++ b/Lang/jq/Identity-matrix @@ -0,0 +1 @@ +../../Task/Identity-matrix/jq \ No newline at end of file diff --git a/Lang/jq/Include-a-file b/Lang/jq/Include-a-file new file mode 120000 index 0000000000..f3950cfe6d --- /dev/null +++ b/Lang/jq/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/jq \ No newline at end of file diff --git a/Lang/jq/Increment-a-numerical-string b/Lang/jq/Increment-a-numerical-string new file mode 120000 index 0000000000..65e61ac457 --- /dev/null +++ b/Lang/jq/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/jq \ No newline at end of file diff --git a/Lang/jq/Infinity b/Lang/jq/Infinity new file mode 120000 index 0000000000..1eae182da0 --- /dev/null +++ b/Lang/jq/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/jq \ No newline at end of file diff --git a/Lang/jq/Input-loop b/Lang/jq/Input-loop new file mode 120000 index 0000000000..087b2f007f --- /dev/null +++ b/Lang/jq/Input-loop @@ -0,0 +1 @@ +../../Task/Input-loop/jq \ No newline at end of file diff --git a/Lang/jq/Integer-comparison b/Lang/jq/Integer-comparison new file mode 120000 index 0000000000..b3a0c6689e --- /dev/null +++ b/Lang/jq/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/jq \ No newline at end of file diff --git a/Lang/jq/Integer-sequence b/Lang/jq/Integer-sequence new file mode 120000 index 0000000000..7bd6e7d13d --- /dev/null +++ b/Lang/jq/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/jq \ No newline at end of file diff --git a/Lang/jq/Inverted-index b/Lang/jq/Inverted-index new file mode 120000 index 0000000000..d589eb77ac --- /dev/null +++ b/Lang/jq/Inverted-index @@ -0,0 +1 @@ +../../Task/Inverted-index/jq \ No newline at end of file diff --git a/Lang/jq/Inverted-syntax b/Lang/jq/Inverted-syntax new file mode 120000 index 0000000000..74b8d52f4a --- /dev/null +++ b/Lang/jq/Inverted-syntax @@ -0,0 +1 @@ +../../Task/Inverted-syntax/jq \ No newline at end of file diff --git a/Lang/jq/Iterated-digits-squaring b/Lang/jq/Iterated-digits-squaring new file mode 120000 index 0000000000..155dbe5090 --- /dev/null +++ b/Lang/jq/Iterated-digits-squaring @@ -0,0 +1 @@ +../../Task/Iterated-digits-squaring/jq \ No newline at end of file diff --git a/Lang/jq/JSON b/Lang/jq/JSON new file mode 120000 index 0000000000..77a3e298e4 --- /dev/null +++ b/Lang/jq/JSON @@ -0,0 +1 @@ +../../Task/JSON/jq \ No newline at end of file diff --git a/Lang/jq/Jensens-Device b/Lang/jq/Jensens-Device new file mode 120000 index 0000000000..c6703d83bc --- /dev/null +++ b/Lang/jq/Jensens-Device @@ -0,0 +1 @@ +../../Task/Jensens-Device/jq \ No newline at end of file diff --git a/Lang/jq/Josephus-problem b/Lang/jq/Josephus-problem new file mode 120000 index 0000000000..ee00505f82 --- /dev/null +++ b/Lang/jq/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/jq \ No newline at end of file diff --git a/Lang/jq/Jump-anywhere b/Lang/jq/Jump-anywhere new file mode 120000 index 0000000000..c9c37ea35f --- /dev/null +++ b/Lang/jq/Jump-anywhere @@ -0,0 +1 @@ +../../Task/Jump-anywhere/jq \ No newline at end of file diff --git a/Lang/jq/Kaprekar-numbers b/Lang/jq/Kaprekar-numbers new file mode 120000 index 0000000000..cb34e2a076 --- /dev/null +++ b/Lang/jq/Kaprekar-numbers @@ -0,0 +1 @@ +../../Task/Kaprekar-numbers/jq \ No newline at end of file diff --git a/Lang/jq/Knapsack-problem-0-1 b/Lang/jq/Knapsack-problem-0-1 new file mode 120000 index 0000000000..c5a9085dcc --- /dev/null +++ b/Lang/jq/Knapsack-problem-0-1 @@ -0,0 +1 @@ +../../Task/Knapsack-problem-0-1/jq \ No newline at end of file diff --git a/Lang/jq/Knapsack-problem-Continuous b/Lang/jq/Knapsack-problem-Continuous new file mode 120000 index 0000000000..6cdb0bad20 --- /dev/null +++ b/Lang/jq/Knapsack-problem-Continuous @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Continuous/jq \ No newline at end of file diff --git a/Lang/jq/LU-decomposition b/Lang/jq/LU-decomposition new file mode 120000 index 0000000000..65231474ef --- /dev/null +++ b/Lang/jq/LU-decomposition @@ -0,0 +1 @@ +../../Task/LU-decomposition/jq \ No newline at end of file diff --git a/Lang/jq/LZW-compression b/Lang/jq/LZW-compression new file mode 120000 index 0000000000..31d6658418 --- /dev/null +++ b/Lang/jq/LZW-compression @@ -0,0 +1 @@ +../../Task/LZW-compression/jq \ No newline at end of file diff --git a/Lang/jq/Langtons-ant b/Lang/jq/Langtons-ant new file mode 120000 index 0000000000..2765fc5d09 --- /dev/null +++ b/Lang/jq/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/jq \ No newline at end of file diff --git a/Lang/jq/Largest-int-from-concatenated-ints b/Lang/jq/Largest-int-from-concatenated-ints new file mode 120000 index 0000000000..1a4e31a859 --- /dev/null +++ b/Lang/jq/Largest-int-from-concatenated-ints @@ -0,0 +1 @@ +../../Task/Largest-int-from-concatenated-ints/jq \ No newline at end of file diff --git a/Lang/jq/Last-Friday-of-each-month b/Lang/jq/Last-Friday-of-each-month new file mode 120000 index 0000000000..f5af02bf27 --- /dev/null +++ b/Lang/jq/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/jq \ No newline at end of file diff --git a/Lang/jq/Last-letter-first-letter b/Lang/jq/Last-letter-first-letter new file mode 120000 index 0000000000..4e30a86949 --- /dev/null +++ b/Lang/jq/Last-letter-first-letter @@ -0,0 +1 @@ +../../Task/Last-letter-first-letter/jq \ No newline at end of file diff --git a/Lang/jq/Leap-year b/Lang/jq/Leap-year new file mode 120000 index 0000000000..06f5b5f3a2 --- /dev/null +++ b/Lang/jq/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/jq \ No newline at end of file diff --git a/Lang/jq/Least-common-multiple b/Lang/jq/Least-common-multiple new file mode 120000 index 0000000000..e28bff4b1c --- /dev/null +++ b/Lang/jq/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/jq \ No newline at end of file diff --git a/Lang/jq/Left-factorials b/Lang/jq/Left-factorials new file mode 120000 index 0000000000..74a810951f --- /dev/null +++ b/Lang/jq/Left-factorials @@ -0,0 +1 @@ +../../Task/Left-factorials/jq \ No newline at end of file diff --git a/Lang/jq/Letter-frequency b/Lang/jq/Letter-frequency new file mode 120000 index 0000000000..68fca3d40a --- /dev/null +++ b/Lang/jq/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/jq \ No newline at end of file diff --git a/Lang/jq/Levenshtein-distance b/Lang/jq/Levenshtein-distance new file mode 120000 index 0000000000..28121fc841 --- /dev/null +++ b/Lang/jq/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/jq \ No newline at end of file diff --git a/Lang/jq/Linear-congruential-generator b/Lang/jq/Linear-congruential-generator new file mode 120000 index 0000000000..60dfe034dc --- /dev/null +++ b/Lang/jq/Linear-congruential-generator @@ -0,0 +1 @@ +../../Task/Linear-congruential-generator/jq \ No newline at end of file diff --git a/Lang/jq/List-comprehensions b/Lang/jq/List-comprehensions new file mode 120000 index 0000000000..9a93ffd2d2 --- /dev/null +++ b/Lang/jq/List-comprehensions @@ -0,0 +1 @@ +../../Task/List-comprehensions/jq \ No newline at end of file diff --git a/Lang/jq/Literals-Floating-point b/Lang/jq/Literals-Floating-point new file mode 120000 index 0000000000..edd07c4b1e --- /dev/null +++ b/Lang/jq/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/jq \ No newline at end of file diff --git a/Lang/jq/Logical-operations b/Lang/jq/Logical-operations new file mode 120000 index 0000000000..95ff723fd1 --- /dev/null +++ b/Lang/jq/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/jq \ No newline at end of file diff --git a/Lang/jq/Long-multiplication b/Lang/jq/Long-multiplication new file mode 120000 index 0000000000..5b95ab175f --- /dev/null +++ b/Lang/jq/Long-multiplication @@ -0,0 +1 @@ +../../Task/Long-multiplication/jq \ No newline at end of file diff --git a/Lang/jq/Longest-common-subsequence b/Lang/jq/Longest-common-subsequence new file mode 120000 index 0000000000..5ce4aedc1e --- /dev/null +++ b/Lang/jq/Longest-common-subsequence @@ -0,0 +1 @@ +../../Task/Longest-common-subsequence/jq \ No newline at end of file diff --git a/Lang/jq/Longest-increasing-subsequence b/Lang/jq/Longest-increasing-subsequence new file mode 120000 index 0000000000..cf75b768be --- /dev/null +++ b/Lang/jq/Longest-increasing-subsequence @@ -0,0 +1 @@ +../../Task/Longest-increasing-subsequence/jq \ No newline at end of file diff --git a/Lang/jq/Look-and-say-sequence b/Lang/jq/Look-and-say-sequence new file mode 120000 index 0000000000..55e24d4596 --- /dev/null +++ b/Lang/jq/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/jq \ No newline at end of file diff --git a/Lang/jq/Loop-over-multiple-arrays-simultaneously b/Lang/jq/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..0103d65f43 --- /dev/null +++ b/Lang/jq/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/jq \ No newline at end of file diff --git a/Lang/jq/Loops-Continue b/Lang/jq/Loops-Continue new file mode 120000 index 0000000000..e6bd8fa39a --- /dev/null +++ b/Lang/jq/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/jq \ No newline at end of file diff --git a/Lang/jq/Loops-Do-while b/Lang/jq/Loops-Do-while new file mode 120000 index 0000000000..5a9c41e0a5 --- /dev/null +++ b/Lang/jq/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/jq \ No newline at end of file diff --git a/Lang/jq/Loops-Downward-for b/Lang/jq/Loops-Downward-for new file mode 120000 index 0000000000..b8f7c3f61f --- /dev/null +++ b/Lang/jq/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/jq \ No newline at end of file diff --git a/Lang/jq/Loops-For b/Lang/jq/Loops-For new file mode 120000 index 0000000000..64f2246b7e --- /dev/null +++ b/Lang/jq/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/jq \ No newline at end of file diff --git a/Lang/jq/Loops-For-with-a-specified-step b/Lang/jq/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..cf3c63285c --- /dev/null +++ b/Lang/jq/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/jq \ No newline at end of file diff --git a/Lang/jq/Loops-Foreach b/Lang/jq/Loops-Foreach new file mode 120000 index 0000000000..a12051ada1 --- /dev/null +++ b/Lang/jq/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/jq \ No newline at end of file diff --git a/Lang/jq/Loops-Infinite b/Lang/jq/Loops-Infinite new file mode 120000 index 0000000000..5ad8e6cc2e --- /dev/null +++ b/Lang/jq/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/jq \ No newline at end of file diff --git a/Lang/jq/Loops-N-plus-one-half b/Lang/jq/Loops-N-plus-one-half new file mode 120000 index 0000000000..a103981177 --- /dev/null +++ b/Lang/jq/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/jq \ No newline at end of file diff --git a/Lang/jq/Loops-While b/Lang/jq/Loops-While new file mode 120000 index 0000000000..8db73e32d6 --- /dev/null +++ b/Lang/jq/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/jq \ No newline at end of file diff --git a/Lang/jq/Luhn-test-of-credit-card-numbers b/Lang/jq/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..01dc7c1efb --- /dev/null +++ b/Lang/jq/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/jq \ No newline at end of file diff --git a/Lang/jq/Magic-squares-of-odd-order b/Lang/jq/Magic-squares-of-odd-order new file mode 120000 index 0000000000..eac823e88f --- /dev/null +++ b/Lang/jq/Magic-squares-of-odd-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-odd-order/jq \ No newline at end of file diff --git a/Lang/jq/Mandelbrot-set b/Lang/jq/Mandelbrot-set new file mode 120000 index 0000000000..26b0c4d984 --- /dev/null +++ b/Lang/jq/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/jq \ No newline at end of file diff --git a/Lang/jq/Map-range b/Lang/jq/Map-range new file mode 120000 index 0000000000..177b47215e --- /dev/null +++ b/Lang/jq/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/jq \ No newline at end of file diff --git a/Lang/jq/Matrix-arithmetic b/Lang/jq/Matrix-arithmetic new file mode 120000 index 0000000000..dab94d242d --- /dev/null +++ b/Lang/jq/Matrix-arithmetic @@ -0,0 +1 @@ +../../Task/Matrix-arithmetic/jq \ No newline at end of file diff --git a/Lang/jq/Matrix-exponentiation-operator b/Lang/jq/Matrix-exponentiation-operator new file mode 120000 index 0000000000..126393f6f4 --- /dev/null +++ b/Lang/jq/Matrix-exponentiation-operator @@ -0,0 +1 @@ +../../Task/Matrix-exponentiation-operator/jq \ No newline at end of file diff --git a/Lang/jq/Matrix-multiplication b/Lang/jq/Matrix-multiplication new file mode 120000 index 0000000000..966ca1487a --- /dev/null +++ b/Lang/jq/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/jq \ No newline at end of file diff --git a/Lang/jq/Matrix-transposition b/Lang/jq/Matrix-transposition new file mode 120000 index 0000000000..edacbd31f4 --- /dev/null +++ b/Lang/jq/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/jq \ No newline at end of file diff --git a/Lang/jq/Maximum-triangle-path-sum b/Lang/jq/Maximum-triangle-path-sum new file mode 120000 index 0000000000..d5c87fdf6e --- /dev/null +++ b/Lang/jq/Maximum-triangle-path-sum @@ -0,0 +1 @@ +../../Task/Maximum-triangle-path-sum/jq \ No newline at end of file diff --git a/Lang/jq/Menu b/Lang/jq/Menu new file mode 120000 index 0000000000..afb7510e54 --- /dev/null +++ b/Lang/jq/Menu @@ -0,0 +1 @@ +../../Task/Menu/jq \ No newline at end of file diff --git a/Lang/jq/Middle-three-digits b/Lang/jq/Middle-three-digits new file mode 120000 index 0000000000..755f8144b9 --- /dev/null +++ b/Lang/jq/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/jq \ No newline at end of file diff --git a/Lang/jq/Move-to-front-algorithm b/Lang/jq/Move-to-front-algorithm new file mode 120000 index 0000000000..831f5b4af8 --- /dev/null +++ b/Lang/jq/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/jq \ No newline at end of file diff --git a/Lang/jq/Multifactorial b/Lang/jq/Multifactorial new file mode 120000 index 0000000000..720c39d429 --- /dev/null +++ b/Lang/jq/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/jq \ No newline at end of file diff --git a/Lang/jq/Multiple-distinct-objects b/Lang/jq/Multiple-distinct-objects new file mode 120000 index 0000000000..1845b7dd46 --- /dev/null +++ b/Lang/jq/Multiple-distinct-objects @@ -0,0 +1 @@ +../../Task/Multiple-distinct-objects/jq \ No newline at end of file diff --git a/Lang/jq/Multisplit b/Lang/jq/Multisplit new file mode 120000 index 0000000000..117c105741 --- /dev/null +++ b/Lang/jq/Multisplit @@ -0,0 +1 @@ +../../Task/Multisplit/jq \ No newline at end of file diff --git a/Lang/jq/Munching-squares b/Lang/jq/Munching-squares new file mode 120000 index 0000000000..9ad05e5792 --- /dev/null +++ b/Lang/jq/Munching-squares @@ -0,0 +1 @@ +../../Task/Munching-squares/jq \ No newline at end of file diff --git a/Lang/jq/Mutual-recursion b/Lang/jq/Mutual-recursion new file mode 120000 index 0000000000..10e27ca341 --- /dev/null +++ b/Lang/jq/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/jq \ No newline at end of file diff --git a/Lang/jq/N-queens-problem b/Lang/jq/N-queens-problem new file mode 120000 index 0000000000..2f185da6e8 --- /dev/null +++ b/Lang/jq/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/jq \ No newline at end of file diff --git a/Lang/jq/Named-parameters b/Lang/jq/Named-parameters new file mode 120000 index 0000000000..467073a675 --- /dev/null +++ b/Lang/jq/Named-parameters @@ -0,0 +1 @@ +../../Task/Named-parameters/jq \ No newline at end of file diff --git a/Lang/jq/Narcissistic-decimal-number b/Lang/jq/Narcissistic-decimal-number new file mode 120000 index 0000000000..8d9dd3f2c3 --- /dev/null +++ b/Lang/jq/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/jq \ No newline at end of file diff --git a/Lang/jq/Natural-sorting b/Lang/jq/Natural-sorting new file mode 120000 index 0000000000..90b3c8c6f6 --- /dev/null +++ b/Lang/jq/Natural-sorting @@ -0,0 +1 @@ +../../Task/Natural-sorting/jq \ No newline at end of file diff --git a/Lang/jq/Non-continuous-subsequences b/Lang/jq/Non-continuous-subsequences new file mode 120000 index 0000000000..1eee870240 --- /dev/null +++ b/Lang/jq/Non-continuous-subsequences @@ -0,0 +1 @@ +../../Task/Non-continuous-subsequences/jq \ No newline at end of file diff --git a/Lang/jq/Non-decimal-radices-Convert b/Lang/jq/Non-decimal-radices-Convert new file mode 120000 index 0000000000..510cd0a48e --- /dev/null +++ b/Lang/jq/Non-decimal-radices-Convert @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Convert/jq \ No newline at end of file diff --git a/Lang/jq/Nth b/Lang/jq/Nth new file mode 120000 index 0000000000..27e77b9610 --- /dev/null +++ b/Lang/jq/Nth @@ -0,0 +1 @@ +../../Task/Nth/jq \ No newline at end of file diff --git a/Lang/jq/Nth-root b/Lang/jq/Nth-root new file mode 120000 index 0000000000..466ab46741 --- /dev/null +++ b/Lang/jq/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/jq \ No newline at end of file diff --git a/Lang/jq/Null-object b/Lang/jq/Null-object new file mode 120000 index 0000000000..65ecb9bf9e --- /dev/null +++ b/Lang/jq/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/jq \ No newline at end of file diff --git a/Lang/jq/Number-names b/Lang/jq/Number-names new file mode 120000 index 0000000000..222d8bbbe6 --- /dev/null +++ b/Lang/jq/Number-names @@ -0,0 +1 @@ +../../Task/Number-names/jq \ No newline at end of file diff --git a/Lang/jq/One-dimensional-cellular-automata b/Lang/jq/One-dimensional-cellular-automata new file mode 120000 index 0000000000..6ddf378c3d --- /dev/null +++ b/Lang/jq/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/jq \ No newline at end of file diff --git a/Lang/jq/Optional-parameters b/Lang/jq/Optional-parameters new file mode 120000 index 0000000000..220ff8eaac --- /dev/null +++ b/Lang/jq/Optional-parameters @@ -0,0 +1 @@ +../../Task/Optional-parameters/jq \ No newline at end of file diff --git a/Lang/jq/Order-disjoint-list-items b/Lang/jq/Order-disjoint-list-items new file mode 120000 index 0000000000..1e6b3145a5 --- /dev/null +++ b/Lang/jq/Order-disjoint-list-items @@ -0,0 +1 @@ +../../Task/Order-disjoint-list-items/jq \ No newline at end of file diff --git a/Lang/jq/Order-two-numerical-lists b/Lang/jq/Order-two-numerical-lists new file mode 120000 index 0000000000..0cea96e323 --- /dev/null +++ b/Lang/jq/Order-two-numerical-lists @@ -0,0 +1 @@ +../../Task/Order-two-numerical-lists/jq \ No newline at end of file diff --git a/Lang/jq/Ordered-Partitions b/Lang/jq/Ordered-Partitions new file mode 120000 index 0000000000..9e5b4c3a90 --- /dev/null +++ b/Lang/jq/Ordered-Partitions @@ -0,0 +1 @@ +../../Task/Ordered-Partitions/jq \ No newline at end of file diff --git a/Lang/jq/Ordered-words b/Lang/jq/Ordered-words new file mode 120000 index 0000000000..59b3880dd1 --- /dev/null +++ b/Lang/jq/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/jq \ No newline at end of file diff --git a/Lang/jq/Palindrome-detection b/Lang/jq/Palindrome-detection new file mode 120000 index 0000000000..1c9e94b134 --- /dev/null +++ b/Lang/jq/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/jq \ No newline at end of file diff --git a/Lang/jq/Pangram-checker b/Lang/jq/Pangram-checker new file mode 120000 index 0000000000..d60ef3dbf4 --- /dev/null +++ b/Lang/jq/Pangram-checker @@ -0,0 +1 @@ +../../Task/Pangram-checker/jq \ No newline at end of file diff --git a/Lang/jq/Paraffins b/Lang/jq/Paraffins new file mode 120000 index 0000000000..73cba13b96 --- /dev/null +++ b/Lang/jq/Paraffins @@ -0,0 +1 @@ +../../Task/Paraffins/jq \ No newline at end of file diff --git a/Lang/jq/Pascals-triangle b/Lang/jq/Pascals-triangle new file mode 120000 index 0000000000..56fae8663c --- /dev/null +++ b/Lang/jq/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/jq \ No newline at end of file diff --git a/Lang/jq/Perfect-numbers b/Lang/jq/Perfect-numbers new file mode 120000 index 0000000000..6088ecf85d --- /dev/null +++ b/Lang/jq/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/jq \ No newline at end of file diff --git a/Lang/jq/Permutation-test b/Lang/jq/Permutation-test new file mode 120000 index 0000000000..8bc91beafb --- /dev/null +++ b/Lang/jq/Permutation-test @@ -0,0 +1 @@ +../../Task/Permutation-test/jq \ No newline at end of file diff --git a/Lang/jq/Permutations b/Lang/jq/Permutations new file mode 120000 index 0000000000..99f3a3311c --- /dev/null +++ b/Lang/jq/Permutations @@ -0,0 +1 @@ +../../Task/Permutations/jq \ No newline at end of file diff --git a/Lang/jq/Permutations-Derangements b/Lang/jq/Permutations-Derangements new file mode 120000 index 0000000000..e67767a37d --- /dev/null +++ b/Lang/jq/Permutations-Derangements @@ -0,0 +1 @@ +../../Task/Permutations-Derangements/jq \ No newline at end of file diff --git a/Lang/jq/Permutations-by-swapping b/Lang/jq/Permutations-by-swapping new file mode 120000 index 0000000000..2a983dd029 --- /dev/null +++ b/Lang/jq/Permutations-by-swapping @@ -0,0 +1 @@ +../../Task/Permutations-by-swapping/jq \ No newline at end of file diff --git a/Lang/jq/Pernicious-numbers b/Lang/jq/Pernicious-numbers new file mode 120000 index 0000000000..e119be00b3 --- /dev/null +++ b/Lang/jq/Pernicious-numbers @@ -0,0 +1 @@ +../../Task/Pernicious-numbers/jq \ No newline at end of file diff --git a/Lang/jq/Phrase-reversals b/Lang/jq/Phrase-reversals new file mode 120000 index 0000000000..21a929b605 --- /dev/null +++ b/Lang/jq/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/jq \ No newline at end of file diff --git a/Lang/jq/Pi b/Lang/jq/Pi new file mode 120000 index 0000000000..43e516f667 --- /dev/null +++ b/Lang/jq/Pi @@ -0,0 +1 @@ +../../Task/Pi/jq \ No newline at end of file diff --git a/Lang/jq/Plot-coordinate-pairs b/Lang/jq/Plot-coordinate-pairs new file mode 120000 index 0000000000..42672a5592 --- /dev/null +++ b/Lang/jq/Plot-coordinate-pairs @@ -0,0 +1 @@ +../../Task/Plot-coordinate-pairs/jq \ No newline at end of file diff --git a/Lang/jq/Power-set b/Lang/jq/Power-set new file mode 120000 index 0000000000..c5a2556b1e --- /dev/null +++ b/Lang/jq/Power-set @@ -0,0 +1 @@ +../../Task/Power-set/jq \ No newline at end of file diff --git a/Lang/jq/Price-fraction b/Lang/jq/Price-fraction new file mode 120000 index 0000000000..b540e6c2fd --- /dev/null +++ b/Lang/jq/Price-fraction @@ -0,0 +1 @@ +../../Task/Price-fraction/jq \ No newline at end of file diff --git a/Lang/jq/Prime-decomposition b/Lang/jq/Prime-decomposition new file mode 120000 index 0000000000..f4227c02ff --- /dev/null +++ b/Lang/jq/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/jq \ No newline at end of file diff --git a/Lang/jq/Priority-queue b/Lang/jq/Priority-queue new file mode 120000 index 0000000000..28de1716dd --- /dev/null +++ b/Lang/jq/Priority-queue @@ -0,0 +1 @@ +../../Task/Priority-queue/jq \ No newline at end of file diff --git a/Lang/jq/Problem-of-Apollonius b/Lang/jq/Problem-of-Apollonius new file mode 120000 index 0000000000..0a953668a7 --- /dev/null +++ b/Lang/jq/Problem-of-Apollonius @@ -0,0 +1 @@ +../../Task/Problem-of-Apollonius/jq \ No newline at end of file diff --git a/Lang/jq/Program-termination b/Lang/jq/Program-termination new file mode 120000 index 0000000000..b10fef1a76 --- /dev/null +++ b/Lang/jq/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/jq \ No newline at end of file diff --git a/Lang/jq/Pythagorean-triples b/Lang/jq/Pythagorean-triples new file mode 120000 index 0000000000..f866b4dce7 --- /dev/null +++ b/Lang/jq/Pythagorean-triples @@ -0,0 +1 @@ +../../Task/Pythagorean-triples/jq \ No newline at end of file diff --git a/Lang/jq/Quaternion-type b/Lang/jq/Quaternion-type new file mode 120000 index 0000000000..2dc96e6e0b --- /dev/null +++ b/Lang/jq/Quaternion-type @@ -0,0 +1 @@ +../../Task/Quaternion-type/jq \ No newline at end of file diff --git a/Lang/jq/Queue-Definition b/Lang/jq/Queue-Definition new file mode 120000 index 0000000000..bce75a40b9 --- /dev/null +++ b/Lang/jq/Queue-Definition @@ -0,0 +1 @@ +../../Task/Queue-Definition/jq \ No newline at end of file diff --git a/Lang/jq/Quickselect-algorithm b/Lang/jq/Quickselect-algorithm new file mode 120000 index 0000000000..e597b8ada9 --- /dev/null +++ b/Lang/jq/Quickselect-algorithm @@ -0,0 +1 @@ +../../Task/Quickselect-algorithm/jq \ No newline at end of file diff --git a/Lang/jq/README b/Lang/jq/README new file mode 100644 index 0000000000..50c6497a74 --- /dev/null +++ b/Lang/jq/README @@ -0,0 +1 @@ +Data source: http://rosettacode.org/wiki/Category:jq diff --git a/Lang/jq/Random-numbers b/Lang/jq/Random-numbers new file mode 120000 index 0000000000..f68fa5ce2f --- /dev/null +++ b/Lang/jq/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/jq \ No newline at end of file diff --git a/Lang/jq/Range-expansion b/Lang/jq/Range-expansion new file mode 120000 index 0000000000..e2f4bc5b32 --- /dev/null +++ b/Lang/jq/Range-expansion @@ -0,0 +1 @@ +../../Task/Range-expansion/jq \ No newline at end of file diff --git a/Lang/jq/Range-extraction b/Lang/jq/Range-extraction new file mode 120000 index 0000000000..1c985adf8b --- /dev/null +++ b/Lang/jq/Range-extraction @@ -0,0 +1 @@ +../../Task/Range-extraction/jq \ No newline at end of file diff --git a/Lang/jq/Ranking-methods b/Lang/jq/Ranking-methods new file mode 120000 index 0000000000..c2d2760578 --- /dev/null +++ b/Lang/jq/Ranking-methods @@ -0,0 +1 @@ +../../Task/Ranking-methods/jq \ No newline at end of file diff --git a/Lang/jq/Read-a-file-line-by-line b/Lang/jq/Read-a-file-line-by-line new file mode 120000 index 0000000000..7cbe91eb10 --- /dev/null +++ b/Lang/jq/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/jq \ No newline at end of file diff --git a/Lang/jq/Read-a-specific-line-from-a-file b/Lang/jq/Read-a-specific-line-from-a-file new file mode 120000 index 0000000000..9e11c6474b --- /dev/null +++ b/Lang/jq/Read-a-specific-line-from-a-file @@ -0,0 +1 @@ +../../Task/Read-a-specific-line-from-a-file/jq \ No newline at end of file diff --git a/Lang/jq/Read-entire-file b/Lang/jq/Read-entire-file new file mode 120000 index 0000000000..2506b1c8d7 --- /dev/null +++ b/Lang/jq/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/jq \ No newline at end of file diff --git a/Lang/jq/Real-constants-and-functions b/Lang/jq/Real-constants-and-functions new file mode 120000 index 0000000000..e234ea60b1 --- /dev/null +++ b/Lang/jq/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/jq \ No newline at end of file diff --git a/Lang/jq/Regular-expressions b/Lang/jq/Regular-expressions new file mode 120000 index 0000000000..47b2212198 --- /dev/null +++ b/Lang/jq/Regular-expressions @@ -0,0 +1 @@ +../../Task/Regular-expressions/jq \ No newline at end of file diff --git a/Lang/jq/Remove-duplicate-elements b/Lang/jq/Remove-duplicate-elements new file mode 120000 index 0000000000..43c62d7c60 --- /dev/null +++ b/Lang/jq/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/jq \ No newline at end of file diff --git a/Lang/jq/Remove-lines-from-a-file b/Lang/jq/Remove-lines-from-a-file new file mode 120000 index 0000000000..c1086e79d3 --- /dev/null +++ b/Lang/jq/Remove-lines-from-a-file @@ -0,0 +1 @@ +../../Task/Remove-lines-from-a-file/jq \ No newline at end of file diff --git a/Lang/jq/Rep-string b/Lang/jq/Rep-string new file mode 120000 index 0000000000..da208ba1a3 --- /dev/null +++ b/Lang/jq/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/jq \ No newline at end of file diff --git a/Lang/jq/Repeat-a-string b/Lang/jq/Repeat-a-string new file mode 120000 index 0000000000..c89321c0c8 --- /dev/null +++ b/Lang/jq/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/jq \ No newline at end of file diff --git a/Lang/jq/Return-multiple-values b/Lang/jq/Return-multiple-values new file mode 120000 index 0000000000..de2dbd8f1d --- /dev/null +++ b/Lang/jq/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/jq \ No newline at end of file diff --git a/Lang/jq/Reverse-a-string b/Lang/jq/Reverse-a-string new file mode 120000 index 0000000000..e1c723ce82 --- /dev/null +++ b/Lang/jq/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/jq \ No newline at end of file diff --git a/Lang/jq/Reverse-words-in-a-string b/Lang/jq/Reverse-words-in-a-string new file mode 120000 index 0000000000..5998372f95 --- /dev/null +++ b/Lang/jq/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/jq \ No newline at end of file diff --git a/Lang/jq/Roman-numerals-Decode b/Lang/jq/Roman-numerals-Decode new file mode 120000 index 0000000000..7cea44a0a6 --- /dev/null +++ b/Lang/jq/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/jq \ No newline at end of file diff --git a/Lang/jq/Roots-of-a-function b/Lang/jq/Roots-of-a-function new file mode 120000 index 0000000000..44c0ca6870 --- /dev/null +++ b/Lang/jq/Roots-of-a-function @@ -0,0 +1 @@ +../../Task/Roots-of-a-function/jq \ No newline at end of file diff --git a/Lang/jq/Roots-of-a-quadratic-function b/Lang/jq/Roots-of-a-quadratic-function new file mode 120000 index 0000000000..7973a6b551 --- /dev/null +++ b/Lang/jq/Roots-of-a-quadratic-function @@ -0,0 +1 @@ +../../Task/Roots-of-a-quadratic-function/jq \ No newline at end of file diff --git a/Lang/jq/Roots-of-unity b/Lang/jq/Roots-of-unity new file mode 120000 index 0000000000..6e0084fb35 --- /dev/null +++ b/Lang/jq/Roots-of-unity @@ -0,0 +1 @@ +../../Task/Roots-of-unity/jq \ No newline at end of file diff --git a/Lang/jq/Rot-13 b/Lang/jq/Rot-13 new file mode 120000 index 0000000000..5d55e3e6f7 --- /dev/null +++ b/Lang/jq/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/jq \ No newline at end of file diff --git a/Lang/jq/Run-length-encoding b/Lang/jq/Run-length-encoding new file mode 120000 index 0000000000..a1e01d72b8 --- /dev/null +++ b/Lang/jq/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/jq \ No newline at end of file diff --git a/Lang/jq/Runge-Kutta-method b/Lang/jq/Runge-Kutta-method new file mode 120000 index 0000000000..a3f07a6b01 --- /dev/null +++ b/Lang/jq/Runge-Kutta-method @@ -0,0 +1 @@ +../../Task/Runge-Kutta-method/jq \ No newline at end of file diff --git a/Lang/jq/SEDOLs b/Lang/jq/SEDOLs new file mode 120000 index 0000000000..ac26655cb3 --- /dev/null +++ b/Lang/jq/SEDOLs @@ -0,0 +1 @@ +../../Task/SEDOLs/jq \ No newline at end of file diff --git a/Lang/jq/Same-Fringe b/Lang/jq/Same-Fringe new file mode 120000 index 0000000000..62e5474996 --- /dev/null +++ b/Lang/jq/Same-Fringe @@ -0,0 +1 @@ +../../Task/Same-Fringe/jq \ No newline at end of file diff --git a/Lang/jq/Scope-Function-names-and-labels b/Lang/jq/Scope-Function-names-and-labels new file mode 120000 index 0000000000..021c5767a4 --- /dev/null +++ b/Lang/jq/Scope-Function-names-and-labels @@ -0,0 +1 @@ +../../Task/Scope-Function-names-and-labels/jq \ No newline at end of file diff --git a/Lang/jq/Search-a-list b/Lang/jq/Search-a-list new file mode 120000 index 0000000000..a27836f5cf --- /dev/null +++ b/Lang/jq/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/jq \ No newline at end of file diff --git a/Lang/jq/Self-describing-numbers b/Lang/jq/Self-describing-numbers new file mode 120000 index 0000000000..129e1a77f5 --- /dev/null +++ b/Lang/jq/Self-describing-numbers @@ -0,0 +1 @@ +../../Task/Self-describing-numbers/jq \ No newline at end of file diff --git a/Lang/jq/Self-referential-sequence b/Lang/jq/Self-referential-sequence new file mode 120000 index 0000000000..124129a36b --- /dev/null +++ b/Lang/jq/Self-referential-sequence @@ -0,0 +1 @@ +../../Task/Self-referential-sequence/jq \ No newline at end of file diff --git a/Lang/jq/Semordnilap b/Lang/jq/Semordnilap new file mode 120000 index 0000000000..2993c47e97 --- /dev/null +++ b/Lang/jq/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/jq \ No newline at end of file diff --git a/Lang/jq/Sequence-of-non-squares b/Lang/jq/Sequence-of-non-squares new file mode 120000 index 0000000000..a0d478b1a4 --- /dev/null +++ b/Lang/jq/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/jq \ No newline at end of file diff --git a/Lang/jq/Sequence-of-primes-by-Trial-Division b/Lang/jq/Sequence-of-primes-by-Trial-Division new file mode 120000 index 0000000000..e0bdc3d074 --- /dev/null +++ b/Lang/jq/Sequence-of-primes-by-Trial-Division @@ -0,0 +1 @@ +../../Task/Sequence-of-primes-by-Trial-Division/jq \ No newline at end of file diff --git a/Lang/jq/Set b/Lang/jq/Set new file mode 120000 index 0000000000..e23e4f0705 --- /dev/null +++ b/Lang/jq/Set @@ -0,0 +1 @@ +../../Task/Set/jq \ No newline at end of file diff --git a/Lang/jq/Set-consolidation b/Lang/jq/Set-consolidation new file mode 120000 index 0000000000..953e3cb130 --- /dev/null +++ b/Lang/jq/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/jq \ No newline at end of file diff --git a/Lang/jq/Shell-one-liner b/Lang/jq/Shell-one-liner new file mode 120000 index 0000000000..7389e9117d --- /dev/null +++ b/Lang/jq/Shell-one-liner @@ -0,0 +1 @@ +../../Task/Shell-one-liner/jq \ No newline at end of file diff --git a/Lang/jq/Short-circuit-evaluation b/Lang/jq/Short-circuit-evaluation new file mode 120000 index 0000000000..d182ba1ef4 --- /dev/null +++ b/Lang/jq/Short-circuit-evaluation @@ -0,0 +1 @@ +../../Task/Short-circuit-evaluation/jq \ No newline at end of file diff --git a/Lang/jq/Show-the-epoch b/Lang/jq/Show-the-epoch new file mode 120000 index 0000000000..5658c2c7dd --- /dev/null +++ b/Lang/jq/Show-the-epoch @@ -0,0 +1 @@ +../../Task/Show-the-epoch/jq \ No newline at end of file diff --git a/Lang/jq/Sierpinski-carpet b/Lang/jq/Sierpinski-carpet new file mode 120000 index 0000000000..4ae292ba8f --- /dev/null +++ b/Lang/jq/Sierpinski-carpet @@ -0,0 +1 @@ +../../Task/Sierpinski-carpet/jq \ No newline at end of file diff --git a/Lang/jq/Sieve-of-Eratosthenes b/Lang/jq/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..743ce5c4c0 --- /dev/null +++ b/Lang/jq/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/jq \ No newline at end of file diff --git a/Lang/jq/Singly-linked-list-Traversal b/Lang/jq/Singly-linked-list-Traversal new file mode 120000 index 0000000000..52a1fbba76 --- /dev/null +++ b/Lang/jq/Singly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Traversal/jq \ No newline at end of file diff --git a/Lang/jq/Solve-the-no-connection-puzzle b/Lang/jq/Solve-the-no-connection-puzzle new file mode 120000 index 0000000000..035b893b36 --- /dev/null +++ b/Lang/jq/Solve-the-no-connection-puzzle @@ -0,0 +1 @@ +../../Task/Solve-the-no-connection-puzzle/jq \ No newline at end of file diff --git a/Lang/jq/Sort-an-array-of-composite-structures b/Lang/jq/Sort-an-array-of-composite-structures new file mode 120000 index 0000000000..0d743b8a3c --- /dev/null +++ b/Lang/jq/Sort-an-array-of-composite-structures @@ -0,0 +1 @@ +../../Task/Sort-an-array-of-composite-structures/jq \ No newline at end of file diff --git a/Lang/jq/Sort-an-integer-array b/Lang/jq/Sort-an-integer-array new file mode 120000 index 0000000000..7c88949063 --- /dev/null +++ b/Lang/jq/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/jq \ No newline at end of file diff --git a/Lang/jq/Sort-disjoint-sublist b/Lang/jq/Sort-disjoint-sublist new file mode 120000 index 0000000000..10a763fd6c --- /dev/null +++ b/Lang/jq/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/jq \ No newline at end of file diff --git a/Lang/jq/Sort-using-a-custom-comparator b/Lang/jq/Sort-using-a-custom-comparator new file mode 120000 index 0000000000..bc1818ca5e --- /dev/null +++ b/Lang/jq/Sort-using-a-custom-comparator @@ -0,0 +1 @@ +../../Task/Sort-using-a-custom-comparator/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Bead-sort b/Lang/jq/Sorting-algorithms-Bead-sort new file mode 120000 index 0000000000..d400bd9a6e --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Bead-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bead-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Bubble-sort b/Lang/jq/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..292f1c2e61 --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Cocktail-sort b/Lang/jq/Sorting-algorithms-Cocktail-sort new file mode 120000 index 0000000000..da4a852235 --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Cocktail-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Cocktail-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Comb-sort b/Lang/jq/Sorting-algorithms-Comb-sort new file mode 120000 index 0000000000..ad11942ee0 --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Comb-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Comb-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Counting-sort b/Lang/jq/Sorting-algorithms-Counting-sort new file mode 120000 index 0000000000..f3c096680f --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Counting-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Counting-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Gnome-sort b/Lang/jq/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..6ace37f6c8 --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Insertion-sort b/Lang/jq/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..1bf0689053 --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Merge-sort b/Lang/jq/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..b79f579b4f --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Pancake-sort b/Lang/jq/Sorting-algorithms-Pancake-sort new file mode 120000 index 0000000000..8834489380 --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Pancake-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Pancake-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Permutation-sort b/Lang/jq/Sorting-algorithms-Permutation-sort new file mode 120000 index 0000000000..208aeeac7b --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Permutation-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Permutation-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Quicksort b/Lang/jq/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..ce8b37cc43 --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Radix-sort b/Lang/jq/Sorting-algorithms-Radix-sort new file mode 120000 index 0000000000..824eb9aafd --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Radix-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Radix-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Selection-sort b/Lang/jq/Sorting-algorithms-Selection-sort new file mode 120000 index 0000000000..9f2e1fd6c3 --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Selection-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Selection-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Shell-sort b/Lang/jq/Sorting-algorithms-Shell-sort new file mode 120000 index 0000000000..4cc63e4524 --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Shell-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Shell-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Sleep-sort b/Lang/jq/Sorting-algorithms-Sleep-sort new file mode 120000 index 0000000000..78ef28618e --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Sleep-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Sleep-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Stooge-sort b/Lang/jq/Sorting-algorithms-Stooge-sort new file mode 120000 index 0000000000..cdac9a092f --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Stooge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Stooge-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sorting-algorithms-Strand-sort b/Lang/jq/Sorting-algorithms-Strand-sort new file mode 120000 index 0000000000..6698f286b4 --- /dev/null +++ b/Lang/jq/Sorting-algorithms-Strand-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Strand-sort/jq \ No newline at end of file diff --git a/Lang/jq/Sparkline-in-unicode b/Lang/jq/Sparkline-in-unicode new file mode 120000 index 0000000000..95b041634f --- /dev/null +++ b/Lang/jq/Sparkline-in-unicode @@ -0,0 +1 @@ +../../Task/Sparkline-in-unicode/jq \ No newline at end of file diff --git a/Lang/jq/Special-characters b/Lang/jq/Special-characters new file mode 120000 index 0000000000..ebae3996af --- /dev/null +++ b/Lang/jq/Special-characters @@ -0,0 +1 @@ +../../Task/Special-characters/jq \ No newline at end of file diff --git a/Lang/jq/Special-variables b/Lang/jq/Special-variables new file mode 120000 index 0000000000..069535d958 --- /dev/null +++ b/Lang/jq/Special-variables @@ -0,0 +1 @@ +../../Task/Special-variables/jq \ No newline at end of file diff --git a/Lang/jq/Spiral-matrix b/Lang/jq/Spiral-matrix new file mode 120000 index 0000000000..a22ff50613 --- /dev/null +++ b/Lang/jq/Spiral-matrix @@ -0,0 +1 @@ +../../Task/Spiral-matrix/jq \ No newline at end of file diff --git a/Lang/jq/Stair-climbing-puzzle b/Lang/jq/Stair-climbing-puzzle new file mode 120000 index 0000000000..742761de1f --- /dev/null +++ b/Lang/jq/Stair-climbing-puzzle @@ -0,0 +1 @@ +../../Task/Stair-climbing-puzzle/jq \ No newline at end of file diff --git a/Lang/jq/State-name-puzzle b/Lang/jq/State-name-puzzle new file mode 120000 index 0000000000..4883f2bdf8 --- /dev/null +++ b/Lang/jq/State-name-puzzle @@ -0,0 +1 @@ +../../Task/State-name-puzzle/jq \ No newline at end of file diff --git a/Lang/jq/Stem-and-leaf-plot b/Lang/jq/Stem-and-leaf-plot new file mode 120000 index 0000000000..c080f9f998 --- /dev/null +++ b/Lang/jq/Stem-and-leaf-plot @@ -0,0 +1 @@ +../../Task/Stem-and-leaf-plot/jq \ No newline at end of file diff --git a/Lang/jq/Stern-Brocot-sequence b/Lang/jq/Stern-Brocot-sequence new file mode 120000 index 0000000000..5f7cfd7283 --- /dev/null +++ b/Lang/jq/Stern-Brocot-sequence @@ -0,0 +1 @@ +../../Task/Stern-Brocot-sequence/jq \ No newline at end of file diff --git a/Lang/jq/String-append b/Lang/jq/String-append new file mode 120000 index 0000000000..582a64a5bb --- /dev/null +++ b/Lang/jq/String-append @@ -0,0 +1 @@ +../../Task/String-append/jq \ No newline at end of file diff --git a/Lang/jq/String-case b/Lang/jq/String-case new file mode 120000 index 0000000000..0cd6afcfa3 --- /dev/null +++ b/Lang/jq/String-case @@ -0,0 +1 @@ +../../Task/String-case/jq \ No newline at end of file diff --git a/Lang/jq/String-comparison b/Lang/jq/String-comparison new file mode 120000 index 0000000000..6a1dd5e26a --- /dev/null +++ b/Lang/jq/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/jq \ No newline at end of file diff --git a/Lang/jq/String-concatenation b/Lang/jq/String-concatenation new file mode 120000 index 0000000000..fa23f5442d --- /dev/null +++ b/Lang/jq/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/jq \ No newline at end of file diff --git a/Lang/jq/String-interpolation--included- b/Lang/jq/String-interpolation--included- new file mode 120000 index 0000000000..a3a6fd6c34 --- /dev/null +++ b/Lang/jq/String-interpolation--included- @@ -0,0 +1 @@ +../../Task/String-interpolation--included-/jq \ No newline at end of file diff --git a/Lang/jq/String-length b/Lang/jq/String-length new file mode 120000 index 0000000000..4479772647 --- /dev/null +++ b/Lang/jq/String-length @@ -0,0 +1 @@ +../../Task/String-length/jq \ No newline at end of file diff --git a/Lang/jq/String-matching b/Lang/jq/String-matching new file mode 120000 index 0000000000..246ce28073 --- /dev/null +++ b/Lang/jq/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/jq \ No newline at end of file diff --git a/Lang/jq/String-prepend b/Lang/jq/String-prepend new file mode 120000 index 0000000000..edf9e7a1b6 --- /dev/null +++ b/Lang/jq/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/jq \ No newline at end of file diff --git a/Lang/jq/Strip-a-set-of-characters-from-a-string b/Lang/jq/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..c8ebb83f38 --- /dev/null +++ b/Lang/jq/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/jq \ No newline at end of file diff --git a/Lang/jq/Strip-block-comments b/Lang/jq/Strip-block-comments new file mode 120000 index 0000000000..683d8e8bc9 --- /dev/null +++ b/Lang/jq/Strip-block-comments @@ -0,0 +1 @@ +../../Task/Strip-block-comments/jq \ No newline at end of file diff --git a/Lang/jq/Strip-comments-from-a-string b/Lang/jq/Strip-comments-from-a-string new file mode 120000 index 0000000000..e401e6e704 --- /dev/null +++ b/Lang/jq/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/jq \ No newline at end of file diff --git a/Lang/jq/Strip-control-codes-and-extended-characters-from-a-string b/Lang/jq/Strip-control-codes-and-extended-characters-from-a-string new file mode 120000 index 0000000000..d641a32f13 --- /dev/null +++ b/Lang/jq/Strip-control-codes-and-extended-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-control-codes-and-extended-characters-from-a-string/jq \ No newline at end of file diff --git a/Lang/jq/Strip-whitespace-from-a-string-Top-and-tail b/Lang/jq/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..41a5799b1a --- /dev/null +++ b/Lang/jq/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/jq \ No newline at end of file diff --git a/Lang/jq/Substring b/Lang/jq/Substring new file mode 120000 index 0000000000..28fb6d4429 --- /dev/null +++ b/Lang/jq/Substring @@ -0,0 +1 @@ +../../Task/Substring/jq \ No newline at end of file diff --git a/Lang/jq/Substring-Top-and-tail b/Lang/jq/Substring-Top-and-tail new file mode 120000 index 0000000000..0b8db46deb --- /dev/null +++ b/Lang/jq/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/jq \ No newline at end of file diff --git a/Lang/jq/Sum-and-product-of-an-array b/Lang/jq/Sum-and-product-of-an-array new file mode 120000 index 0000000000..0e0f713900 --- /dev/null +++ b/Lang/jq/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/jq \ No newline at end of file diff --git a/Lang/jq/Sum-digits-of-an-integer b/Lang/jq/Sum-digits-of-an-integer new file mode 120000 index 0000000000..10ac4f4a1d --- /dev/null +++ b/Lang/jq/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/jq \ No newline at end of file diff --git a/Lang/jq/Sum-multiples-of-3-and-5 b/Lang/jq/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..b0aaec49b9 --- /dev/null +++ b/Lang/jq/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/jq \ No newline at end of file diff --git a/Lang/jq/Sum-of-a-series b/Lang/jq/Sum-of-a-series new file mode 120000 index 0000000000..a20ef46ff7 --- /dev/null +++ b/Lang/jq/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/jq \ No newline at end of file diff --git a/Lang/jq/Sum-of-squares b/Lang/jq/Sum-of-squares new file mode 120000 index 0000000000..a9b2ebd898 --- /dev/null +++ b/Lang/jq/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/jq \ No newline at end of file diff --git a/Lang/jq/Symmetric-difference b/Lang/jq/Symmetric-difference new file mode 120000 index 0000000000..606f196876 --- /dev/null +++ b/Lang/jq/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/jq \ No newline at end of file diff --git a/Lang/jq/System-time b/Lang/jq/System-time new file mode 120000 index 0000000000..f3877f16a2 --- /dev/null +++ b/Lang/jq/System-time @@ -0,0 +1 @@ +../../Task/System-time/jq \ No newline at end of file diff --git a/Lang/jq/Temperature-conversion b/Lang/jq/Temperature-conversion new file mode 120000 index 0000000000..269edf9aa9 --- /dev/null +++ b/Lang/jq/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/jq \ No newline at end of file diff --git a/Lang/jq/Terminal-control-Clear-the-screen b/Lang/jq/Terminal-control-Clear-the-screen new file mode 120000 index 0000000000..ebd0f09b48 --- /dev/null +++ b/Lang/jq/Terminal-control-Clear-the-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Clear-the-screen/jq \ No newline at end of file diff --git a/Lang/jq/Terminal-control-Unicode-output b/Lang/jq/Terminal-control-Unicode-output new file mode 120000 index 0000000000..86f2fa2c65 --- /dev/null +++ b/Lang/jq/Terminal-control-Unicode-output @@ -0,0 +1 @@ +../../Task/Terminal-control-Unicode-output/jq \ No newline at end of file diff --git a/Lang/jq/Ternary-logic b/Lang/jq/Ternary-logic new file mode 120000 index 0000000000..4c48247f66 --- /dev/null +++ b/Lang/jq/Ternary-logic @@ -0,0 +1 @@ +../../Task/Ternary-logic/jq \ No newline at end of file diff --git a/Lang/jq/Test-a-function b/Lang/jq/Test-a-function new file mode 120000 index 0000000000..f8b7aafb81 --- /dev/null +++ b/Lang/jq/Test-a-function @@ -0,0 +1 @@ +../../Task/Test-a-function/jq \ No newline at end of file diff --git a/Lang/jq/Text-processing-1 b/Lang/jq/Text-processing-1 new file mode 120000 index 0000000000..d3f7c5d91a --- /dev/null +++ b/Lang/jq/Text-processing-1 @@ -0,0 +1 @@ +../../Task/Text-processing-1/jq \ No newline at end of file diff --git a/Lang/jq/Text-processing-2 b/Lang/jq/Text-processing-2 new file mode 120000 index 0000000000..e2fc79d8f2 --- /dev/null +++ b/Lang/jq/Text-processing-2 @@ -0,0 +1 @@ +../../Task/Text-processing-2/jq \ No newline at end of file diff --git a/Lang/jq/Text-processing-Max-licenses-in-use b/Lang/jq/Text-processing-Max-licenses-in-use new file mode 120000 index 0000000000..96c9e5b2cf --- /dev/null +++ b/Lang/jq/Text-processing-Max-licenses-in-use @@ -0,0 +1 @@ +../../Task/Text-processing-Max-licenses-in-use/jq \ No newline at end of file diff --git a/Lang/jq/Textonyms b/Lang/jq/Textonyms new file mode 120000 index 0000000000..6d9acf6952 --- /dev/null +++ b/Lang/jq/Textonyms @@ -0,0 +1 @@ +../../Task/Textonyms/jq \ No newline at end of file diff --git a/Lang/jq/Tokenize-a-string b/Lang/jq/Tokenize-a-string new file mode 120000 index 0000000000..119878379b --- /dev/null +++ b/Lang/jq/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/jq \ No newline at end of file diff --git a/Lang/jq/Top-rank-per-group b/Lang/jq/Top-rank-per-group new file mode 120000 index 0000000000..ec19fec1c7 --- /dev/null +++ b/Lang/jq/Top-rank-per-group @@ -0,0 +1 @@ +../../Task/Top-rank-per-group/jq \ No newline at end of file diff --git a/Lang/jq/Topological-sort b/Lang/jq/Topological-sort new file mode 120000 index 0000000000..f9a70e2dbc --- /dev/null +++ b/Lang/jq/Topological-sort @@ -0,0 +1 @@ +../../Task/Topological-sort/jq \ No newline at end of file diff --git a/Lang/jq/Topswops b/Lang/jq/Topswops new file mode 120000 index 0000000000..5150fd859b --- /dev/null +++ b/Lang/jq/Topswops @@ -0,0 +1 @@ +../../Task/Topswops/jq \ No newline at end of file diff --git a/Lang/jq/Towers-of-Hanoi b/Lang/jq/Towers-of-Hanoi new file mode 120000 index 0000000000..1e867f3f65 --- /dev/null +++ b/Lang/jq/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/jq \ No newline at end of file diff --git a/Lang/jq/Trabb-Pardo-Knuth-algorithm b/Lang/jq/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..c5aa935547 --- /dev/null +++ b/Lang/jq/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/jq \ No newline at end of file diff --git a/Lang/jq/Tree-traversal b/Lang/jq/Tree-traversal new file mode 120000 index 0000000000..c59a763bf5 --- /dev/null +++ b/Lang/jq/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/jq \ No newline at end of file diff --git a/Lang/jq/Trigonometric-functions b/Lang/jq/Trigonometric-functions new file mode 120000 index 0000000000..c1de7e3f6e --- /dev/null +++ b/Lang/jq/Trigonometric-functions @@ -0,0 +1 @@ +../../Task/Trigonometric-functions/jq \ No newline at end of file diff --git a/Lang/jq/Twelve-statements b/Lang/jq/Twelve-statements new file mode 120000 index 0000000000..00e5b95a35 --- /dev/null +++ b/Lang/jq/Twelve-statements @@ -0,0 +1 @@ +../../Task/Twelve-statements/jq \ No newline at end of file diff --git a/Lang/jq/URL-decoding b/Lang/jq/URL-decoding new file mode 120000 index 0000000000..c131226015 --- /dev/null +++ b/Lang/jq/URL-decoding @@ -0,0 +1 @@ +../../Task/URL-decoding/jq \ No newline at end of file diff --git a/Lang/jq/URL-encoding b/Lang/jq/URL-encoding new file mode 120000 index 0000000000..ebdbac90c2 --- /dev/null +++ b/Lang/jq/URL-encoding @@ -0,0 +1 @@ +../../Task/URL-encoding/jq \ No newline at end of file diff --git a/Lang/jq/Undefined-values b/Lang/jq/Undefined-values new file mode 120000 index 0000000000..bd98db8a00 --- /dev/null +++ b/Lang/jq/Undefined-values @@ -0,0 +1 @@ +../../Task/Undefined-values/jq \ No newline at end of file diff --git a/Lang/jq/User-input-Text b/Lang/jq/User-input-Text new file mode 120000 index 0000000000..0831b549fc --- /dev/null +++ b/Lang/jq/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/jq \ No newline at end of file diff --git a/Lang/jq/Van-der-Corput-sequence b/Lang/jq/Van-der-Corput-sequence new file mode 120000 index 0000000000..11908cf2c6 --- /dev/null +++ b/Lang/jq/Van-der-Corput-sequence @@ -0,0 +1 @@ +../../Task/Van-der-Corput-sequence/jq \ No newline at end of file diff --git a/Lang/jq/Variables b/Lang/jq/Variables new file mode 120000 index 0000000000..ee4a7e5976 --- /dev/null +++ b/Lang/jq/Variables @@ -0,0 +1 @@ +../../Task/Variables/jq \ No newline at end of file diff --git a/Lang/jq/Variadic-function b/Lang/jq/Variadic-function new file mode 120000 index 0000000000..74c9a0051c --- /dev/null +++ b/Lang/jq/Variadic-function @@ -0,0 +1 @@ +../../Task/Variadic-function/jq \ No newline at end of file diff --git a/Lang/jq/Vector-products b/Lang/jq/Vector-products new file mode 120000 index 0000000000..1489030b13 --- /dev/null +++ b/Lang/jq/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/jq \ No newline at end of file diff --git a/Lang/jq/Web-scraping b/Lang/jq/Web-scraping new file mode 120000 index 0000000000..a5ee6db52b --- /dev/null +++ b/Lang/jq/Web-scraping @@ -0,0 +1 @@ +../../Task/Web-scraping/jq \ No newline at end of file diff --git a/Lang/jq/Wireworld b/Lang/jq/Wireworld new file mode 120000 index 0000000000..61dff942e6 --- /dev/null +++ b/Lang/jq/Wireworld @@ -0,0 +1 @@ +../../Task/Wireworld/jq \ No newline at end of file diff --git a/Lang/jq/Word-wrap b/Lang/jq/Word-wrap new file mode 120000 index 0000000000..0cec64a4cb --- /dev/null +++ b/Lang/jq/Word-wrap @@ -0,0 +1 @@ +../../Task/Word-wrap/jq \ No newline at end of file diff --git a/Lang/jq/Write-float-arrays-to-a-text-file b/Lang/jq/Write-float-arrays-to-a-text-file new file mode 120000 index 0000000000..3bf983eaa3 --- /dev/null +++ b/Lang/jq/Write-float-arrays-to-a-text-file @@ -0,0 +1 @@ +../../Task/Write-float-arrays-to-a-text-file/jq \ No newline at end of file diff --git a/Lang/jq/Yin-and-yang b/Lang/jq/Yin-and-yang new file mode 120000 index 0000000000..44c616aab4 --- /dev/null +++ b/Lang/jq/Yin-and-yang @@ -0,0 +1 @@ +../../Task/Yin-and-yang/jq \ No newline at end of file diff --git a/Lang/jq/Zebra-puzzle b/Lang/jq/Zebra-puzzle new file mode 120000 index 0000000000..337008ab04 --- /dev/null +++ b/Lang/jq/Zebra-puzzle @@ -0,0 +1 @@ +../../Task/Zebra-puzzle/jq \ No newline at end of file diff --git a/Lang/jq/Zeckendorf-number-representation b/Lang/jq/Zeckendorf-number-representation new file mode 120000 index 0000000000..2b9524c79b --- /dev/null +++ b/Lang/jq/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/jq \ No newline at end of file diff --git a/Lang/jq/Zero-to-the-zero-power b/Lang/jq/Zero-to-the-zero-power new file mode 120000 index 0000000000..643a7470db --- /dev/null +++ b/Lang/jq/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/jq \ No newline at end of file diff --git a/Lang/jq/Zig-zag-matrix b/Lang/jq/Zig-zag-matrix new file mode 120000 index 0000000000..72f067914b --- /dev/null +++ b/Lang/jq/Zig-zag-matrix @@ -0,0 +1 @@ +../../Task/Zig-zag-matrix/jq \ No newline at end of file diff --git a/Task/100-doors/68000-Assembly/100-doors.68000 b/Task/100-doors/68000-Assembly/100-doors.68000 new file mode 100644 index 0000000000..b966a4380f --- /dev/null +++ b/Task/100-doors/68000-Assembly/100-doors.68000 @@ -0,0 +1,110 @@ +*----------------------------------------------------------- +* Title : 100Doors.X68 +* Written by : G. A. Tippery +* Date : 2014-01-17 +* Description: Solves "100 Doors" problem, see: http://rosettacode.org/wiki/100_doors +* Notes : Translated from C "Unoptimized" version, http://rosettacode.org/wiki/100_doors#unoptimized +* : No optimizations done relative to C version; "for("-equivalent loops could be optimized. +*----------------------------------------------------------- + +* +* System-specific general console I/O macros (Sim68K, in this case) +* +PUTS MACRO + ** Print a null-terminated string w/o CRLF ** + ** Usage: PUTS stringaddress + ** Returns with D0, A1 modified + MOVEQ #14,D0 ; task number 14 (display null string) + LEA \1,A1 ; address of string + TRAP #15 ; display it + ENDM +* +PRINTN MACRO + ** Print decimal integer from number in register + ** Usage: PRINTN register + ** Returns with D0,D1 modified + IFNC '\1','D1' ;if some register other than D1 + MOVE.L \1,D1 ;put number to display in D1 + ENDC + MOVE.B #3,D0 + TRAP #15 ;display number in D1 +* +* Generic constants +* +CR EQU 13 ;ASCII Carriage Return +LF EQU 10 ;ASCII Line Feed + +* +* Definitions specific to this program +* +* Register usage: +* D3 == pass (index) +* D4 == door (index) +* A2 == Doors array pointer +* +SIZE EQU 100 ;Define a symbolic constant for # of doors + + ORG $1000 ;Specify load address for program -- actual address system-specific +START: ; Execution starts here + LEA Doors,A2 ; make A2 point to Doors byte array + MOVEQ #0,D3 +PassLoop: + CMP #SIZE,D3 + BCC ExitPassLoop ; Branch on Carry Clear - being used as Branch on Higher or Equal + MOVE D3,D4 +DoorLoop: + CMP #SIZE,D4 + BCC ExitDoorLoop + NOT.B 0(A2,D4) + ADD D3,D4 + ADDQ #1,D4 + BRA DoorLoop +ExitDoorLoop: + ADDQ #1,D3 + BRA PassLoop +ExitPassLoop: + +* $28 = 40. bytes of code to this point. 32626 cycles so far. +* At this point, the result exists as the 100 bytes starting at address Doors. +* To get output, we must use methods specific to the particular hardware, OS, or +* emulator system that the code is running on. I use macros to "hide" some of the +* system-specific details; equivalent macros would be written for another system. + + MOVEQ #0,D4 +PrintLoop: + CMP #SIZE,D4 + BCC ExitPrintLoop + PUTS DoorMsg1 + MOVE D4,D1 + ADDQ #1,D1 ; Convert index to 1-based instead of 0-based + PRINTN D1 + PUTS DoorMsg2 + TST.B 0(A2,D4) ; Is this door open (!= 0)? + BNE ItsOpen + PUTS DoorMsgC + BRA Next +ItsOpen: + PUTS DoorMsgO +Next: + ADDQ #1,D4 + BRA PrintLoop +ExitPrintLoop: + +* What to do at end of program is also system-specific + SIMHALT ;Halt simulator +* +* $78 = 120. bytes of code to this point, but this will depend on how the I/O macros are actually written. +* Cycle count is nearly meaningless, as the I/O hardware and routines will dominate the timing. + +* +* Data memory usage +* + ORG $2000 +Doors DCB.B SIZE,0 ;Reserve 100 bytes, prefilled with zeros + +DoorMsg1 DC.B 'Door ',0 +DoorMsg2 DC.B ' is ',0 +DoorMsgC DC.B 'closed',CR,LF,0 +DoorMsgO DC.B 'open',CR,LF,0 + + END START ;last line of source diff --git a/Task/100-doors/8th/100-doors.8th b/Task/100-doors/8th/100-doors.8th new file mode 100644 index 0000000000..e90ae6d11f --- /dev/null +++ b/Task/100-doors/8th/100-doors.8th @@ -0,0 +1,31 @@ +\ Array of doors; init to empty; accessing a non-extant member will return +\ 'null', which is treated as 'false', so we don't need to initialize it: +[] var, doors + +\ given a door number, get the value and toggle it: +: toggle-door \ n -- + doors @ over a:@ + not rot swap a:! drop ; + +\ print which doors are open: +: .doors + ( + doors @ over a:@ nip + if . space else drop then + ) 1 100 loop ; + +\ iterate over the doors, skipping 'n': +: main-pass \ n -- + 0 + true + repeat + drop + dup toggle-door + over n:+ + dup 101 < + while 2drop drop ; + +\ calculate the first 100 doors: +' main-pass 1 100 loop +\ print the results: +.doors cr bye diff --git a/Task/100-doors/Ceylon/100-doors.ceylon b/Task/100-doors/Ceylon/100-doors.ceylon new file mode 100644 index 0000000000..1532024718 --- /dev/null +++ b/Task/100-doors/Ceylon/100-doors.ceylon @@ -0,0 +1,23 @@ +shared void run() { + print("Open doors (naive): ``naive()`` + Open doors (optimized): ``optimized()``"); + +} + +shared {Integer*} naive(Integer count = 100) { + variable value doors = [ for (_ in 1..count) closed ]; + for (step in 1..count) { + doors = [for (i->door in doors.indexed) let (index = i+1) if (step == 1 || step.divides(index)) then door.toggle() else door ]; + } + return doors.indexesWhere((door) => door == opened).map(1.plusInteger); +} + +shared {Integer*} optimized(Integer count = 100) => + { for (i in 1..count) i*i }.takeWhile(count.notSmallerThan); + + +shared abstract class Door(shared actual String string) of opened | closed { + shared formal Door toggle(); +} +object opened extends Door("opened") { toggle() => closed; } +object closed extends Door("closed") { toggle() => opened; } diff --git a/Task/100-doors/Clarion/100-doors.clarion b/Task/100-doors/Clarion/100-doors.clarion new file mode 100644 index 0000000000..c237f1520c --- /dev/null +++ b/Task/100-doors/Clarion/100-doors.clarion @@ -0,0 +1,37 @@ + program + + map + end + +MAX_DOOR_NUMBER equate(100) +CRLF equate('<13,10>') + +Doors byte,dim(MAX_DOOR_NUMBER) +Pass byte +DoorNumber byte +DisplayString cstring(2000) + +ResultWindow window('Result'),at(,,133,291),center,double,auto + prompt('Door states:'),at(8,4),use(?PromptTitle) + text,at(8,16,116,266),use(DisplayString),boxed,vscroll,font('Courier New',,,,CHARSET:ANSI),readonly + end + + code + + Doors :=: false + loop Pass = 1 to MAX_DOOR_NUMBER + loop DoorNumber = Pass to MAX_DOOR_NUMBER by Pass + Doors[DoorNumber] = choose(Doors[DoorNumber], false, true) + end + end + + clear(DisplayString) + loop DoorNumber = 1 to MAX_DOOR_NUMBER + DisplayString = DisplayString & format(DoorNumber, @n3) & ' is ' & choose(Doors[DoorNumber], 'opened', 'closed') & CRLF + end + open(ResultWindow) + accept + end + close(ResultWindow) + + return diff --git a/Task/100-doors/Coco/100-doors.coco b/Task/100-doors/Coco/100-doors.coco new file mode 100644 index 0000000000..058b09f601 --- /dev/null +++ b/Task/100-doors/Coco/100-doors.coco @@ -0,0 +1,8 @@ +doors = [false] * 100 + +for pass til doors.length + for i from pass til doors.length by pass + 1 + ! = doors[i] + +for i til doors.length + console.log 'Door %d is %s.', i + 1, if doors[i] then 'open' else 'closed' diff --git a/Task/100-doors/Commodore-BASIC/100-doors.commodore b/Task/100-doors/Commodore-BASIC/100-doors.commodore new file mode 100644 index 0000000000..3c008f6904 --- /dev/null +++ b/Task/100-doors/Commodore-BASIC/100-doors.commodore @@ -0,0 +1,8 @@ +10 D=100: DIMD(D): P=1 +20 PRINT CHR$(147);"PASS: ";P +22 FOR I=P TO D STEP P: D(I)=NOTD(I): NEXT +30 IF P=100 THEN 40 +32 P=P+1: GOTO20 +40 PRINT: PRINT"THE FOLLOWING DOORS ARE OPEN: " +42 FOR I=1 TO D: IF D(I)=-1 THEN PRINTI; +44 NEXT diff --git a/Task/100-doors/Crystal/100-doors.crystal b/Task/100-doors/Crystal/100-doors.crystal new file mode 100644 index 0000000000..f5cfd1926b --- /dev/null +++ b/Task/100-doors/Crystal/100-doors.crystal @@ -0,0 +1,11 @@ +doors = Array.new(100, false) + +1.upto(100) do |i| + i.step(by: i, limit: 100) do |j| + doors[j - 1] = !doors[j - 1] + end +end + +doors.each_with_index do |open, i| + puts "Door #{i + 1} is #{open ? "open" : "closed"}" +end diff --git a/Task/100-doors/ECL/100-doors-1.ecl b/Task/100-doors/ECL/100-doors-1.ecl new file mode 100644 index 0000000000..1c0a0209a2 --- /dev/null +++ b/Task/100-doors/ECL/100-doors-1.ecl @@ -0,0 +1,15 @@ +Doors := RECORD + UNSIGNED1 DoorNumber; + STRING6 State; +END; + +AllDoors := DATASET([{0,0}],Doors); + +Doors OpenThem(AllDoors L,INTEGER Cnt) := TRANSFORM + SELF.DoorNumber := Cnt; + SELF.State := IF((CNT * 10) % (SQRT(CNT)*10)<>0,'Closed','Opened'); +END; + +OpenDoors := NORMALIZE(AllDoors,100,OpenThem(LEFT,COUNTER)); + +OpenDoors; diff --git a/Task/100-doors/ECL/100-doors-2.ecl b/Task/100-doors/ECL/100-doors-2.ecl new file mode 100644 index 0000000000..2ae12f2f0f --- /dev/null +++ b/Task/100-doors/ECL/100-doors-2.ecl @@ -0,0 +1,30 @@ +Doors := RECORD + UNSIGNED1 DoorNumber; + STRING6 State; +END; + +AllDoors := DATASET([{0,'0'}],Doors); + +//first build the 100 doors + +Doors OpenThem(AllDoors L,INTEGER Cnt) := TRANSFORM + SELF.DoorNumber := Cnt; + SELF.State := 'Closed'; +END; + +ClosedDoors := NORMALIZE(AllDoors,100,OpenThem(LEFT,COUNTER)); + +//now iterate through them and use door logic + +loopBody(DATASET(Doors) ds, UNSIGNED4 c) := + PROJECT(ds, //ds=original input + TRANSFORM(Doors, + SELF.State := CASE((COUNTER % c) * 100, + 0 => IF(LEFT.STATE = 'Opened','Closed','Opened') + ,LEFT.STATE); + SELF.DoorNumber := COUNTER; //PROJECT COUNTER + )); + +g1 := LOOP(ClosedDoors,100,loopBody(ROWS(LEFT),COUNTER)); + +OUTPUT(g1); diff --git a/Task/100-doors/ECL/100-doors-3.ecl b/Task/100-doors/ECL/100-doors-3.ecl new file mode 100644 index 0000000000..3e788c5a31 --- /dev/null +++ b/Task/100-doors/ECL/100-doors-3.ecl @@ -0,0 +1,23 @@ +DoorSet := DATASET(100,TRANSFORM({UNSIGNED1 DoorState},SELF.DoorState := 1)); +SetDoors := SET(DoorSet,DoorState); + +Doors := RECORD + UNSIGNED1 Pass; + SET OF UNSIGNED1 DoorSet; +END; + +StartDoors := DATASET(100,TRANSFORM(Doors,SELF.Pass := COUNTER,SELF.DoorSet := SetDoors)); + +Doors XF(Doors L, Doors R) := TRANSFORM + ds := DATASET(L.DoorSet,{UNSIGNED1 DoorState}); + NextDoorSet := PROJECT(ds, + TRANSFORM({UNSIGNED1 DoorState}, + SELF.DoorState := CASE((COUNTER % R.Pass) * 100, + 0 => IF(LEFT.DoorState = 1,0,1), + LEFT.DoorState))); + SELF.DoorSet := IF(L.Pass=0,R.DoorSet,SET(NextDoorSet,DoorState)); + SELF.Pass := R.Pass +END; + +Res := DATASET(ITERATE(StartDoors,XF(LEFT,RIGHT))[100].DoorSet,{UNSIGNED1 DoorState}); +PROJECT(Res,TRANSFORM({STRING20 txt},SELF.Txt := 'Door ' + COUNTER + ' is ' + IF(LEFT.DoorState=1,'Open','Closed'))); diff --git a/Task/100-doors/ERRE/100-doors.erre b/Task/100-doors/ERRE/100-doors.erre new file mode 100644 index 0000000000..4417a0825b --- /dev/null +++ b/Task/100-doors/ERRE/100-doors.erre @@ -0,0 +1,29 @@ +! "100 Doors" program for ERRE LANGUAGE +! Author: Claudio Larini +! Date: 21-Nov-2014 +! +! PC Unoptimized version translated from a QB version + +PROGRAM 100DOORS + +!$INTEGER + +CONST N=100 + +DIM DOOR[N] + +BEGIN + +FOR STRIDE=1 TO N DO + FOR INDEX=STRIDE TO N STEP STRIDE DO + DOOR[INDEX]=NOT(DOOR[INDEX]) + END FOR +END FOR + +PRINT("Open doors:";) +FOR INDEX=1 TO N DO + IF DOOR[INDEX] THEN PRINT(INDEX;) END IF +END FOR +PRINT + +END PROGRAM diff --git a/Task/100-doors/EchoLisp/100-doors.echolisp b/Task/100-doors/EchoLisp/100-doors.echolisp new file mode 100644 index 0000000000..92dc7618d7 --- /dev/null +++ b/Task/100-doors/EchoLisp/100-doors.echolisp @@ -0,0 +1,21 @@ +; initial state = closed = #f +(define doors (make-vector 101 #f)) +; run pass 100 to 1 +(for* + ((pass (in-range 100 0 -1)) + (door (in-range 0 101 pass))) + (when (and + (vector-set! doors door (not (vector-ref doors door))) + (= pass 1)) + (writeln door "is open"))) + +1 "is open" +4 "is open" +9 "is open" +16 "is open" +25 "is open" +36 "is open" +49 "is open" +64 "is open" +81 "is open" +100 "is open" diff --git a/Task/100-doors/Eero/100-doors.eero b/Task/100-doors/Eero/100-doors.eero new file mode 100644 index 0000000000..97c91d0fdb --- /dev/null +++ b/Task/100-doors/Eero/100-doors.eero @@ -0,0 +1,16 @@ +#import + +int main() + square := 1, increment = 3 + + for int door in 1 .. 100 + printf("door #%d", door) + + if door == square + puts(" is open.") + square += increment + increment += 2 + else + puts(" is closed.") + + return 0 diff --git a/Task/100-doors/FUZE-BASIC/100-doors.fuze b/Task/100-doors/FUZE-BASIC/100-doors.fuze new file mode 100644 index 0000000000..b6e9dc67ef --- /dev/null +++ b/Task/100-doors/FUZE-BASIC/100-doors.fuze @@ -0,0 +1,10 @@ +READ x,y,z +PRINT "Open doors: ";x;" "; +CYCLE + z=x+y + PRINT z;" "; + x=z + y=y+2 +REPEAT UNTIL z>=100 +DATA 1,3,0 +END diff --git a/Task/100-doors/FreeBASIC/100-doors-1.freebasic b/Task/100-doors/FreeBASIC/100-doors-1.freebasic new file mode 100644 index 0000000000..5e9cee00e9 --- /dev/null +++ b/Task/100-doors/FreeBASIC/100-doors-1.freebasic @@ -0,0 +1,32 @@ +' version 27-10-2016 +' compile with: fbc -s console + +#Define max_doors 100 + +Dim As ULong c, n, n1, door(1 To max_doors) + +' toggle, at start all doors are closed (0) +' 0 = door closed, 1 = door open +For n = 1 To max_doors + For n1 = n To max_doors Step n + door(n1) = 1 - door(n1) + Next +Next + +' count the doors that are open (1) +Print "doors that are open nr: "; +For n = 1 To max_doors + If door(n) = 1 Then + Print n; " "; + c = c + 1 + End If +Next + +Print : Print +Print "There are " + Str(c) + " doors open" + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/100-doors/FreeBASIC/100-doors-2.freebasic b/Task/100-doors/FreeBASIC/100-doors-2.freebasic new file mode 100644 index 0000000000..436ca632db --- /dev/null +++ b/Task/100-doors/FreeBASIC/100-doors-2.freebasic @@ -0,0 +1,33 @@ +' version 27-10-2016 +' compile with: fbc -s console + +#Define max_doors 100 + +Dim As ULong c, n, n1, door(1 To max_doors) + +' at start all doors are closed +' simple add 1 each time we open or close a door +' doors with odd numbers are open +' doors with even numbers are closed +For n = 1 To max_doors + For n1 = n To max_doors Step n + door(n1) += 1 + Next +Next + +Print "doors that are open nr: "; +For n = 1 To max_doors + If door(n) And 1 Then + Print n; " "; + c = c + 1 + End If +Next + +Print : Print +Print "There are " + Str(c) + " doors open" + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/100-doors/FreeBASIC/100-doors-3.freebasic b/Task/100-doors/FreeBASIC/100-doors-3.freebasic new file mode 100644 index 0000000000..a06c5fd2ad --- /dev/null +++ b/Task/100-doors/FreeBASIC/100-doors-3.freebasic @@ -0,0 +1,21 @@ +' version 27-10-2016 +' compile with: fbc -s console + +#Define max_doors 100 + +Dim As ULong c, n + +Print "doors that are open nr: "; +For n = 1 To 10 + Print n * n; " "; + c = c + 1 +Next + +Print : Print +Print "There are " + Str(c) + " doors open" + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/100-doors/FunL/100-doors-1.funl b/Task/100-doors/FunL/100-doors-1.funl new file mode 100644 index 0000000000..81b90d8e09 --- /dev/null +++ b/Task/100-doors/FunL/100-doors-1.funl @@ -0,0 +1,3 @@ +for i <- 1..100 + r = foldl1( \a, b -> a xor b, [(a|i) | a <- 1..100] ) + println( i + ' ' + (if r then 'open' else 'closed') ) diff --git a/Task/100-doors/FunL/100-doors-2.funl b/Task/100-doors/FunL/100-doors-2.funl new file mode 100644 index 0000000000..f3fb19a39b --- /dev/null +++ b/Task/100-doors/FunL/100-doors-2.funl @@ -0,0 +1,4 @@ +import math.sqrt + +for i <- 1..100 + println( i + ' ' + (if sqrt(i) is Integer then 'open' else 'closed') ) diff --git a/Task/100-doors/Futhark/100-doors.futhark b/Task/100-doors/Futhark/100-doors.futhark new file mode 100644 index 0000000000..769b5e8e4c --- /dev/null +++ b/Task/100-doors/Futhark/100-doors.futhark @@ -0,0 +1,11 @@ +fun main(n: int): [n]bool = + let is_open = replicate n False + loop (is_open) = for i < n do + let js = map (*i+1) (iota n) + let flips = map (fn j => + if j < n + then unsafe !is_open[j] + else True -- Doesn't matter. + ) js + in write js flips is_open + in is_open diff --git a/Task/100-doors/FutureBasic/100-doors.futurebasic b/Task/100-doors/FutureBasic/100-doors.futurebasic new file mode 100644 index 0000000000..a4891f609f --- /dev/null +++ b/Task/100-doors/FutureBasic/100-doors.futurebasic @@ -0,0 +1,14 @@ +include "ConsoleWindow" + +dim as short door, square : square = 1 +dim as short increment : increment = 3 + +for door = 1 to 100 + if (door == square) + print "Door"; door; " is open." + square += increment + increment += 2 + else + print "Door"; door; " is closed." + end if +next diff --git a/Task/100-doors/GFA-Basic/100-doors.gfa b/Task/100-doors/GFA-Basic/100-doors.gfa new file mode 100644 index 0000000000..1f68bf2c6a --- /dev/null +++ b/Task/100-doors/GFA-Basic/100-doors.gfa @@ -0,0 +1,34 @@ +' +' 100 doors problem +' +DIM doors!(101) ! use indices 1 to 100 +@close_doors +@do_passes +@show_doors +' +PROCEDURE close_doors + ARRAYFILL doors!(),FALSE +RETURN +' +PROCEDURE do_passes + LOCAL i%,j% + FOR i%=1 TO 100 + FOR j%=i% TO 100 STEP i% + doors!(j%)=NOT doors!(j%) + NEXT j% + NEXT i% +RETURN +' +PROCEDURE show_doors + LOCAL i% + OPENW 1 + CLEARW 1 + FOR i%=1 TO 100 + IF doors!(i%) + PRINT "Door ";i%;" is open" + ENDIF + NEXT i% + PRINT "(press a key to end program)" + ~INP(2) + CLOSEW 1 +RETURN diff --git a/Task/100-doors/Harbour/100-doors-1.harbour b/Task/100-doors/Harbour/100-doors-1.harbour new file mode 100644 index 0000000000..922ac7b007 --- /dev/null +++ b/Task/100-doors/Harbour/100-doors-1.harbour @@ -0,0 +1,13 @@ +#define ARRAY_ELEMENTS 100 +PROCEDURE Main() + LOCAL aDoors := Array( ARRAY_ELEMENTS ) + LOCAL i, j + + AFill( aDoors, .F. ) + FOR i := 1 TO ARRAY_ELEMENTS + FOR j := i TO ARRAY_ELEMENTS STEP i + aDoors[ j ] = ! aDoors[ j ] + NEXT + NEXT + AEval( aDoors, {|e, n| QQout( Padl(n,3) + " is " + Iif(aDoors[n], "*open*", "closed" ) + "|" ), Iif( n%5 == 0, Qout(), e:=NIL) } ) + RETURN diff --git a/Task/100-doors/Harbour/100-doors-2.harbour b/Task/100-doors/Harbour/100-doors-2.harbour new file mode 100644 index 0000000000..376536e5f9 --- /dev/null +++ b/Task/100-doors/Harbour/100-doors-2.harbour @@ -0,0 +1,8 @@ +#define ARRAY_ELEMENTS 100 +PROCEDURE Main() + LOCAL aDoors := Array( ARRAY_ELEMENTS ) + + AFill( aDoors, .F. ) + AEval( aDoors, {|e, n| aDoors[n] := e := Iif( Int(Sqrt(n))==Sqrt(n), .T., .F. ) } ) + AEval( aDoors, {|e, n| QQout( Padl(n,3) + " is " + Iif(aDoors[n], "*open*", "closed" ) + "|" ), Iif( n%5 == 0, Qout(), e:=NIL )} ) + RETURN diff --git a/Task/100-doors/Hy/100-doors.hy b/Task/100-doors/Hy/100-doors.hy new file mode 100644 index 0000000000..82c04d11ba --- /dev/null +++ b/Task/100-doors/Hy/100-doors.hy @@ -0,0 +1,10 @@ +(def doors (* [False] 100)) + +(for [pass (range (len doors))] + (for [i (range pass (len doors) (inc pass))] + (assoc doors i (not (get doors i))))) + +(for [i (range (len doors))] + (print (.format "Door {} is {}." + (inc i) + (if (get doors i) "open" "closed")))) diff --git a/Task/100-doors/I/100-doors.i b/Task/100-doors/I/100-doors.i new file mode 100644 index 0000000000..d324924be4 --- /dev/null +++ b/Task/100-doors/I/100-doors.i @@ -0,0 +1,18 @@ +software { + var doors = len(100) + + for pass over [1, 100] + var door = pass - 1 + loop door < len(doors) { + doors[door] = doors[door]/0 + door += pass + } + end + + for door,isopen in doors + if isopen + print("Door ",door+1,": open") + end + end + print("All other doors are closed") +} diff --git a/Task/100-doors/Idris/100-doors.idris b/Task/100-doors/Idris/100-doors.idris new file mode 100644 index 0000000000..898f4f34b0 --- /dev/null +++ b/Task/100-doors/Idris/100-doors.idris @@ -0,0 +1,35 @@ +import Data.Vect + +-- Creates list from 0 to n (not including n) +upTo : (m : Nat) -> Vect m (Fin m) +upTo Z = [] +upTo (S n) = 0 :: (map FS (upTo n)) + +data DoorState = DoorOpen | DoorClosed + +toggleDoor : DoorState -> DoorState +toggleDoor DoorOpen = DoorClosed +toggleDoor DoorClosed = DoorOpen + +isOpen : DoorState -> Bool +isOpen DoorOpen = True +isOpen DoorClosed = False + +initialDoors : Vect 100 DoorState +initialDoors = fromList $ map (\_ => DoorClosed) [1..100] + +iterate : (n : Fin m) -> Vect m DoorState -> Vect m DoorState +iterate n doors {m} = + map (\(idx, doorState) => + if ((S (finToNat idx)) `mod` (S (finToNat n))) == Z + then toggleDoor doorState + else doorState) + (zip (upTo m) doors) + +-- Returns all doors left open at the end +solveDoors : List (Fin 100) +solveDoors = + findIndices isOpen $ foldl (\doors,val => iterate val doors) initialDoors (upTo 100) + +main : IO () +main = print $ map (\n => S (finToNat n)) solveDoors diff --git a/Task/100-doors/Lasso/100-doors.lasso b/Task/100-doors/Lasso/100-doors.lasso new file mode 100644 index 0000000000..f401f33c0a --- /dev/null +++ b/Task/100-doors/Lasso/100-doors.lasso @@ -0,0 +1,5 @@ +loop(100) => {^ + local(root = math_sqrt(loop_count)) + local(state = (#root == math_ceil(#root) ? 'open' | 'closed')) + #state != 'closed' ? 'Door ' + loop_count + ': ' + #state + '
' +^} diff --git a/Task/100-doors/Lily/100-doors.lily b/Task/100-doors/Lily/100-doors.lily new file mode 100644 index 0000000000..16fe50a3f0 --- /dev/null +++ b/Task/100-doors/Lily/100-doors.lily @@ -0,0 +1,15 @@ +var doors = List.fill(100, false) + +for i in 0...99: + for j in i...99 by i + 1: + doors[j] = !doors[j] + +# The type must be specified since the list starts off empty. +var open_doors: List[Integer] = [] + +doors.each_index{|i| + if doors[i]: + open_doors.push(i + 1) +} + +print($"Open doors: ^(open_doors)") diff --git a/Task/100-doors/LiveCode/100-doors.livecode b/Task/100-doors/LiveCode/100-doors.livecode new file mode 100644 index 0000000000..369ee6add7 --- /dev/null +++ b/Task/100-doors/LiveCode/100-doors.livecode @@ -0,0 +1,9 @@ +on mouseUp + repeat with tStep = 1 to 100 + repeat with tDoor = tStep to 100 step tStep + put not tDoors[tDoor] into tDoors[tDoor] + end repeat + if tDoors[tStep] then put "Door " & tStep & " is open" & cr after tList + end repeat + set the text of field "Doors" to tList +end mouseUp diff --git a/Task/100-doors/MoonScript/100-doors.moon b/Task/100-doors/MoonScript/100-doors.moon new file mode 100644 index 0000000000..72b750ef40 --- /dev/null +++ b/Task/100-doors/MoonScript/100-doors.moon @@ -0,0 +1,8 @@ +is_open = [false for door = 1,100] + +for pass = 1,100 + for door = pass,100,pass + is_open[door] = not is_open[door] + +for i,v in ipairs is_open + print "Door #{i}: " .. if v then 'open' else 'closed' diff --git a/Task/100-doors/Nim/100-doors-1.nim b/Task/100-doors/Nim/100-doors-1.nim new file mode 100644 index 0000000000..8b914ad3d1 --- /dev/null +++ b/Task/100-doors/Nim/100-doors-1.nim @@ -0,0 +1,16 @@ +from strutils import format + +proc check_doors() = + const n = 100 + var is_open : array[1..n, bool] # auto-initialized to false + # pass over the doors n times + for pass in 1..n: + var i = pass + while i <= n: + is_open[i] = not is_open[i] + i += pass + # print the result + for door in 1..n: + echo format("door $1 is $2.", door, (if is_open[door]: "open" else: "closed")) + +check_doors() diff --git a/Task/100-doors/Nim/100-doors-2.nim b/Task/100-doors/Nim/100-doors-2.nim new file mode 100644 index 0000000000..b58f5fa2e3 --- /dev/null +++ b/Task/100-doors/Nim/100-doors-2.nim @@ -0,0 +1,9 @@ +var isOpen: array[1..100, bool] + +for pass in countup(1, 100): + for door in countup(pass,100,pass): + isOpen[door] = not isOpen[door] + +for i in countup(1, 100): + if isOpen[i]: + echo("Door ",i," is open.") diff --git a/Task/100-doors/Oforth/100-doors.oforth b/Task/100-doors/Oforth/100-doors.oforth new file mode 100644 index 0000000000..4697e15ac4 --- /dev/null +++ b/Task/100-doors/Oforth/100-doors.oforth @@ -0,0 +1,7 @@ +: doors +| i j l | + ListBuffer initValue(100, false) ->l + 100 loop: i [ + i 100 i step: j [ l put(j, l at(j) not) ] + ] + l println ; diff --git a/Task/100-doors/PHL/100-doors-1.phl b/Task/100-doors/PHL/100-doors-1.phl new file mode 100644 index 0000000000..cb4bd6f1f6 --- /dev/null +++ b/Task/100-doors/PHL/100-doors-1.phl @@ -0,0 +1,22 @@ +module doors; + +extern printf; + +@Integer main [ + @Array<@Boolean> doors = new @Array<@Boolean>.init(100); + var i = 1; + while (i <= 100) { + var j = i-1; + while (j < 100) { + doors.set(j, doors.get(j)::not); + j = j + i; + } + i = i::inc; + } + i = 0; + while (i < 100) { + printf("%i %s\n", i+1, iif(doors.get(i), "open", "closed")); + i = i::inc; + } + return 0; +] diff --git a/Task/100-doors/PHL/100-doors-2.phl b/Task/100-doors/PHL/100-doors-2.phl new file mode 100644 index 0000000000..602e02489a --- /dev/null +++ b/Task/100-doors/PHL/100-doors-2.phl @@ -0,0 +1,26 @@ +module var; + +extern printf; + +@Integer main [ + var door = 1; + var incrementer = 0; + var current = 1; + while (current <= 100) + { + printf("Door %i ", current); + if (current == door) + { + printf("open\n"); + incrementer = incrementer::inc; + door = door + 2 * incrementer + 1; + } + else + printf("closed\n"); + + current = current + 1; + + } + + return 0; +] diff --git a/Task/100-doors/Perl5i/100-doors.perl5i b/Task/100-doors/Perl5i/100-doors.perl5i new file mode 100644 index 0000000000..506f6af6a9 --- /dev/null +++ b/Task/100-doors/Perl5i/100-doors.perl5i @@ -0,0 +1,79 @@ +use perl5i::2; + +package doors { + + use perl5i::2; + use Const::Fast; + + const my $OPEN => 1; + const my $CLOSED => 0; + + # ---------------------------------------- + # Constructor: door->new( @args ); + # input: N - how many doors? + # returns: door object + # + method new($class: @args ) { + my $self = bless {}, $class; + $self->_init( @args ); + return $self; + } + + # ---------------------------------------- + # class initializer. + # input: how many doors? + # sets N, creates N+1 doors ( door zero is not used ). + # + method _init( $N ) { + $self->{N} = $N; + $self->{doors} = [ ($CLOSED) x ($N+1) ]; + } + + # ---------------------------------------- + # $self->toggle( $door_number ); + # input: number of door to toggle. + # OPEN a CLOSED door; CLOSE an OPEN door. + # + method toggle( $which ) { + $self->{doors}[$which] = ( $self->{doors}[$which] == $OPEN + ? $CLOSED + : $OPEN + ); + } + + # ---------------------------------------- + # $self->toggle_n( $cycle ); + # input: number. + # Toggle doors 0, $cycle, 2 * $cycle, 3 * $cycle, .. $self->{N} + # + method toggle_n( $n ) { + $self->toggle($_) + for map { $n * $_ } + ( 1 .. int( $self->{N} / $n) ); + + } + + # ---------------------------------------- + # $self->toggle_all(); + # Toggle every door, then every other door, every third door, ... + # + method toggle_all() { + $self->toggle_n( $_ ) for ( 1 .. $self->{N} ); + } + + + # ---------------------------------------- + # $self->print_open(); + # Print list of which doors are open. + # + method print_open() { + say join ', ', grep { $self->{doors}[$_] == $OPEN } ( 1 ... $self->{N} ); + } +} + +# ---------------------------------------------------------------------- +# Main Thread +# +my $doors = doors->new(100); +$doors->toggle_all(); +$doors->print_open(); diff --git a/Task/100-doors/Phix/100-doors-1.phix b/Task/100-doors/Phix/100-doors-1.phix new file mode 100644 index 0000000000..20d1a1666a --- /dev/null +++ b/Task/100-doors/Phix/100-doors-1.phix @@ -0,0 +1,13 @@ +sequence doors = repeat(false,100) + +for i=1 to 100 do + for j=i to 100 by i do + doors[j] = not doors[j] + end for +end for + +for i=1 to 100 do + if doors[i] == true then + printf(1,"Door #%d is open.\n", i) + end if +end for diff --git a/Task/100-doors/Phix/100-doors-2.phix b/Task/100-doors/Phix/100-doors-2.phix new file mode 100644 index 0000000000..35277b8db1 --- /dev/null +++ b/Task/100-doors/Phix/100-doors-2.phix @@ -0,0 +1,13 @@ +function doors(integer n) +-- returns the perfect squares<=n +integer door = 1, step = 1 +sequence res = {} + while door<=n do + res &= door + step += 2 + door += step + end while + return res +end function + +?doors(100) diff --git a/Task/100-doors/Potion/100-doors.potion b/Task/100-doors/Potion/100-doors.potion new file mode 100644 index 0000000000..c2c0f4bc8c --- /dev/null +++ b/Task/100-doors/Potion/100-doors.potion @@ -0,0 +1,7 @@ +square=1, i=3 +1 to 100(door): + if (door == square): + ("door", door, "is open") say + square += i + i += 2. +. diff --git a/Task/100-doors/Pyret/100-doors.pyret b/Task/100-doors/Pyret/100-doors.pyret new file mode 100644 index 0000000000..33fbedfea7 --- /dev/null +++ b/Task/100-doors/Pyret/100-doors.pyret @@ -0,0 +1,69 @@ +data Door: + | open + | closed +end + +fun flip-door(d :: Door) -> Door: + cases(Door) d: + | open => closed + | closed => open + end +end + + +fun flip-doors(doors :: List) -> List: + doc:```Given a list of door positions, repeatedly switch the positions of + every nth door for every nth pass, and return the final list of door + positions``` + for fold(flipped-doors from doors, n from range(1, doors.length() + 1)): + for map_n(m from 1, d from flipped-doors): + if num-modulo(m, n) == 0: + flip-door(d) + else: + d + end + end + end +where: + flip-doors([list: closed, closed, closed]) is + [list: open, closed, closed] + + flip-doors([list: closed, closed, closed, closed]) is + [list: open, closed, closed, open] + + flip-doors([list: closed, closed, closed, closed, closed, closed]) is + [list: open, closed, closed, open, closed, closed] + + closed-100 = for map(_ from range(1, 101)): closed end + answer-100 = for map(n from range(1, 101)): + if num-is-integer(num-sqrt(n)): open + else: closed + end + end + + flip-doors(closed-100) is answer-100 +end + +fun find-indices(pred :: (A -> Boolean), xs :: List) -> List: + doc:```Given a list and a predicate function, produce a list of index + positions where there's a match on the predicate``` + ps = map_n(lam(n,e): if pred(e): n else: -1 end end, 1, xs) + ps.filter(lam(x): x >= 0 end) +where: + find-indices((lam(i): i == true end), [list: true,false,true]) is [list:1,3] +end + + +fun run(n): + doc:```Given a list of doors that are closed, make repeated passes + over the list, switching the positions of every nth door for + each nth pass. Return a list of positions in the list where the + door is Open.``` + doors = repeat(n, closed) + ys = flip-doors(doors) + find-indices((lam(y): y == open end), ys) +where: + run(4) is [list: 1,4] +end + +run(100) diff --git a/Task/100-doors/Red/100-doors.red b/Task/100-doors/Red/100-doors.red new file mode 100644 index 0000000000..378da86288 --- /dev/null +++ b/Task/100-doors/Red/100-doors.red @@ -0,0 +1,20 @@ +Red [ + Purpose: "100 Doors Problem (Perfect Squares)" + Author: "Barry Arthur" + Date: "07-Oct-2016" +] +doors: make vector! [char! 8 100] +repeat i 100 [change at doors i #"."] + +repeat i 100 [ + j: i + while [j <= 100] [ + door: at doors j + change door either #"O" = first door [#"."] [#"O"] + j: j + i + ] +] + +repeat i 10 [ + print copy/part at doors (i - 1 * 10 + 1) 10 +] diff --git a/Task/100-doors/Ring/100-doors-1.ring b/Task/100-doors/Ring/100-doors-1.ring new file mode 100644 index 0000000000..b817f6df2e --- /dev/null +++ b/Task/100-doors/Ring/100-doors-1.ring @@ -0,0 +1,17 @@ +doors = list(100) +for i = 1 to 100 +doors[i] = false +next + +For pass = 1 To 100 + For door = pass To 100 + if doors[door] doors[door] = false else doors[door] = true ok + door += pass-1 + Next +Next + +For door = 1 To 100 + see "Door (" + door + ") is " + If doors[door] see "Open" else see "Closed" ok + see nl +Next diff --git a/Task/100-doors/Ring/100-doors-2.ring b/Task/100-doors/Ring/100-doors-2.ring new file mode 100644 index 0000000000..1ced0ba938 --- /dev/null +++ b/Task/100-doors/Ring/100-doors-2.ring @@ -0,0 +1,14 @@ +doors = list(100) +for i = 1 to 100 +doors[i] = false +next + +For p = 1 To 10 + doors[pow(p,2)] = True +Next + +For door = 1 To 100 + see "Door (" + door + ") is " + If doors[door] see "Open" else see "Closed" ok + see nl +Next diff --git a/Task/100-doors/SequenceL/100-doors-1.sequencel b/Task/100-doors/SequenceL/100-doors-1.sequencel new file mode 100644 index 0000000000..5cbf02a740 --- /dev/null +++ b/Task/100-doors/SequenceL/100-doors-1.sequencel @@ -0,0 +1,14 @@ +import ; + +main:= + let + doors := flipDoors(duplicate(false, 100), 1); + open[i] := i when doors[i]; + in + open; + +flipDoors(doors(1), count) := + let + newDoors[i] := not doors[i] when i mod count = 0 else doors[i]; + in + doors when count >= 100 else flipDoors(newDoors, count + 1); diff --git a/Task/100-doors/SequenceL/100-doors-2.sequencel b/Task/100-doors/SequenceL/100-doors-2.sequencel new file mode 100644 index 0000000000..e571e979f2 --- /dev/null +++ b/Task/100-doors/SequenceL/100-doors-2.sequencel @@ -0,0 +1,4 @@ +main := flipDoors([1], 2); + +flipDoors(openDoors(1), i) := + openDoors when i * i >= 100 else flipDoors(openDoors ++ [i * i], i + 1); diff --git a/Task/100-doors/Sidef/100-doors-1.sidef b/Task/100-doors/Sidef/100-doors-1.sidef new file mode 100644 index 0000000000..249d06af23 --- /dev/null +++ b/Task/100-doors/Sidef/100-doors-1.sidef @@ -0,0 +1,13 @@ +var doors = [] + +100.times { |pass| + 100.times { |i| + if (i % pass == 0) { + doors[i] := false -> not! + } + } +} + +100.times { |i| + "Door %3d is %s\n".printf(i, doors[i] ? 'open' : 'closed') +} diff --git a/Task/100-doors/Sidef/100-doors-2.sidef b/Task/100-doors/Sidef/100-doors-2.sidef new file mode 100644 index 0000000000..34ece006fa --- /dev/null +++ b/Task/100-doors/Sidef/100-doors-2.sidef @@ -0,0 +1,3 @@ +{ |i| + "Door %3d is %s\n".printf(i, ["closed", "open"][i.is_sqr]) +} * 100 diff --git a/Task/100-doors/Sparkling/100-doors-1.sparkling b/Task/100-doors/Sparkling/100-doors-1.sparkling new file mode 100644 index 0000000000..18f013ebbb --- /dev/null +++ b/Task/100-doors/Sparkling/100-doors-1.sparkling @@ -0,0 +1,21 @@ +/* declare the variables */ +var isOpen = {}; +var pass, door; + +/* initialize the doors */ +for door = 0; door < 100; door++ { + isOpen[door] = true; +} + +/* do the 99 remaining passes */ +for pass = 1; pass < 100; ++pass { + for door = pass; door < 100; door += pass+1 { + isOpen[door] = !isOpen[door]; + } +} + +/* print the results */ +var states = { true: "open", false: "closed" }; +for door = 0; door < 100; door++ { + printf("Door #%d is %s.\n", door+1, states[isOpen[door]]); +} diff --git a/Task/100-doors/Sparkling/100-doors-2.sparkling b/Task/100-doors/Sparkling/100-doors-2.sparkling new file mode 100644 index 0000000000..70e02d8cdc --- /dev/null +++ b/Task/100-doors/Sparkling/100-doors-2.sparkling @@ -0,0 +1,13 @@ +/* declare the variables */ +var door_sqrt = 1; +var door; + +/* print the perfect square doors as open */ +for door = 0; door < 100; door++ { + if (door_sqrt*door_sqrt == door+1) { + printf("Door #%d is open.\n", door+1); + door_sqrt ++; + } else { + printf("Door #%d is closed.\n", door+1); + } +} diff --git a/Task/100-doors/Swift/100-doors-1.swift b/Task/100-doors/Swift/100-doors-1.swift new file mode 100644 index 0000000000..3ce1147e60 --- /dev/null +++ b/Task/100-doors/Swift/100-doors-1.swift @@ -0,0 +1,21 @@ +/* declare enum to identify the state of a door */ +enum DoorState : String { + case Opened = "Opened" + case Closed = "Closed" +} + +/* declare list of doors state and initialize them */ +var doorsStateList = [DoorState](count: 100, repeatedValue: DoorState.Closed) + +/* do the 100 passes */ +for i in 1...100 { + /* map on a strideTo instance to only visit the needed doors on each iteration */ + map(stride(from: i - 1, to: 100, by: i)) { + doorsStateList[$0] = doorsStateList[$0] == .Opened ? .Closed : .Opened + } +} + +/* print the results */ +for (index, item) in enumerate(doorsStateList) { + println("Door \(index+1) is \(item.rawValue)") +} diff --git a/Task/100-doors/Swift/100-doors-2.swift b/Task/100-doors/Swift/100-doors-2.swift new file mode 100644 index 0000000000..d1c92b6632 --- /dev/null +++ b/Task/100-doors/Swift/100-doors-2.swift @@ -0,0 +1,20 @@ +/* declare enum to identify the state of a door */ +enum DoorState : String { + case Opened = "Opened" + case Closed = "Closed" +} + +/* declare list of doors state and initialize them */ +var doorsStateList = [DoorState](count: 100, repeatedValue: DoorState.Closed) + +/* set i^2 doors to opened */ +var i = 1 +do { + doorsStateList[(i*i)-1] = DoorState.Opened + ++i +} while (i*i) <= doorsStateList.count + +/* print the results */ +for (index, item) in enumerate(doorsStateList) { + println("Door \(index+1) is \(item.rawValue)") +} diff --git a/Task/100-doors/Uniface/100-doors.uniface b/Task/100-doors/Uniface/100-doors.uniface new file mode 100644 index 0000000000..bb9020dc13 --- /dev/null +++ b/Task/100-doors/Uniface/100-doors.uniface @@ -0,0 +1,53 @@ +entry LP_DO_IT + + variables + string V_DOORS + boolean V_DOOR_STATE + string V_DOOR_STATE_S + numeric V_IDX + numeric V_TOTAL_DOORS + string V_DOOR_STATE_LIST + numeric V_LOOP_COUNT + endvariables + + V_TOTAL_DOORS = 100 + putitem V_DOORS, V_TOTAL_DOORS, 0 + + V_DOORS = $replace (V_DOORS, 1, "·;", "·;0", -1) + + putitem/id V_DOOR_STATE_LIST, "1", "Open" + putitem/id V_DOOR_STATE_LIST, "0", "Close" + + V_LOOP_COUNT = 1 + while (V_LOOP_COUNT <= V_TOTAL_DOORS) + V_IDX = 0 + V_IDX = V_IDX + V_LOOP_COUNT + + getitem V_DOOR_STATE, V_DOORS, V_IDX + while (V_IDX <= V_TOTAL_DOORS) + + V_DOOR_STATE = !V_DOOR_STATE + getitem/id V_DOOR_STATE_S, V_DOOR_STATE_LIST, $number(V_DOOR_STATE) + putitem V_DOORS, V_IDX, V_DOOR_STATE + + V_IDX = V_IDX + V_LOOP_COUNT + getitem V_DOOR_STATE, V_DOORS, V_IDX + endwhile + + V_LOOP_COUNT = V_LOOP_COUNT + 1 + + endwhile + + V_IDX = 1 + getitem V_DOOR_STATE, V_DOORS, V_IDX + while (V_IDX <= V_TOTAL_DOORS) + getitem/id V_DOOR_STATE_S, V_DOOR_STATE_LIST, $number(V_DOOR_STATE) + if (V_DOOR_STATE) + putmess "Door %%V_IDX%%% is finally %%V_DOOR_STATE_S%%%" + endif + + V_IDX = V_IDX + 1 + getitem V_DOOR_STATE, V_DOORS, V_IDX + endwhile + +end ; LP_DO_IT diff --git a/Task/100-doors/Ursa/100-doors.ursa b/Task/100-doors/Ursa/100-doors.ursa new file mode 100644 index 0000000000..133411dd42 --- /dev/null +++ b/Task/100-doors/Ursa/100-doors.ursa @@ -0,0 +1,30 @@ +# +# 100 doors +# + +decl int i j +decl boolean<> doors + +# append 101 boolean values to doors stream +for (set i 0) (or (< i 100) (= i 100)) (inc i) + append false doors +end for + +# loop through, opening and closing doors +for (set i 1) (or (< i 100) (= i 100)) (inc i) + for (set j i) (or (< j 100) (= j 100)) (inc j) + if (= (mod j i) 0) + set doors (not doors) + end if + end for +end for + +# loop through and output which doors are open +for (set i 1) (or (< i 100) (= i 100)) (inc i) + out "Door " i ": " console + if doors + out "open" endl console + else + out "closed" endl console + end if +end if diff --git a/Task/100-doors/Wart/100-doors.wart b/Task/100-doors/Wart/100-doors.wart new file mode 100644 index 0000000000..335ef36dfb --- /dev/null +++ b/Task/100-doors/Wart/100-doors.wart @@ -0,0 +1,10 @@ +def (doors n) + let door (table) + for step 1 (step <= n) ++step + for j 0 (j < n) (j <- j+step) + zap! not door.j + + for j 0 (j < n) ++j + when door.j + pr j + pr " " diff --git a/Task/100-doors/Wortel/100-doors.wortel b/Task/100-doors/Wortel/100-doors.wortel new file mode 100644 index 0000000000..fa9dbc3d66 --- /dev/null +++ b/Task/100-doors/Wortel/100-doors.wortel @@ -0,0 +1,14 @@ +; unoptimized ++^[ + @var doors [] + + @for i rangei [1 100] + @for j rangei [i 100 i] + :!@not `j doors + + @for i rangei [1 100] + @if `i doors + !console.log "door {i} is open" +] +; optimized, map square over 1 to 10 +!*^@sq @to 10 diff --git a/Task/100-doors/Wren/100-doors-1.wren b/Task/100-doors/Wren/100-doors-1.wren new file mode 100644 index 0000000000..a6bf3cff9c --- /dev/null +++ b/Task/100-doors/Wren/100-doors-1.wren @@ -0,0 +1,12 @@ +var doors = [true] * 100 +for (i in 1..100) { + var j = i + while(j < 100) { + doors[j] = !doors[j] + j = j + i + 1 + } +} + +for (i in 0...100) { + if (doors[i]) System.print(i + 1) +} diff --git a/Task/100-doors/Wren/100-doors-2.wren b/Task/100-doors/Wren/100-doors-2.wren new file mode 100644 index 0000000000..5854cabde7 --- /dev/null +++ b/Task/100-doors/Wren/100-doors-2.wren @@ -0,0 +1,7 @@ +var door = 1 +var increment = 3 +while(door <= 100) { + System.print(door) + door = door + increment + increment = increment + 2 +} diff --git a/Task/100-doors/jq/100-doors-1.jq b/Task/100-doors/jq/100-doors-1.jq new file mode 100644 index 0000000000..b3cbb11c94 --- /dev/null +++ b/Task/100-doors/jq/100-doors-1.jq @@ -0,0 +1,13 @@ +# Solution for n doors: +def doors(n): + + def print: + . as $doors + | range(1; length+1) + | if $doors[.] then "Door \(.) is open" else empty end; + + ([][n+1] = null) as $doors + | reduce range(1; n+1) as $run + ( $doors; reduce range($run; n+1; $run ) as $door + ( .; .[$door] = (.[$door] | not) ) ) + | print ; diff --git a/Task/100-doors/jq/100-doors-2.jq b/Task/100-doors/jq/100-doors-2.jq new file mode 100644 index 0000000000..7a0dba2ca7 --- /dev/null +++ b/Task/100-doors/jq/100-doors-2.jq @@ -0,0 +1,3 @@ +# Solution for 100 doors: +def solution: + range(1;11) | "Door \(. * .) is open"; diff --git a/Task/24-game-Solve/ERRE/24-game-solve.erre b/Task/24-game-Solve/ERRE/24-game-solve.erre new file mode 100644 index 0000000000..30f1d8fbd4 --- /dev/null +++ b/Task/24-game-Solve/ERRE/24-game-solve.erre @@ -0,0 +1,311 @@ +PROGRAM 24SOLVE + +LABEL 98,99,2540,2550,2560 + +! possible brackets +CONST NBRACKETS=11,ST_CONST$="+-*/^(" + +DIM D[4],PERM[24,4] +DIM BRAKETS$[NBRACKETS] +DIM OP$[3] +DIM STACK$[50] + +PROCEDURE COMPATTA_STACK + IF NS>1 THEN + R=1 + WHILE R=NS2 THEN GOTO 99 END IF + N1#=VAL(STACK$[L-1]) N2#=VAL(STACK$[L+1]) NOP=NOP-1 + IF STACK$[L]="^" THEN + RI#=N1#^N2# + END IF + STACK$[L-1]=STR$(RI#) + N=L + WHILE N<=NS2-2 DO + STACK$[N]=STACK$[N+2] + N=N+1 + END WHILE + NS2=NS2-2 + L=NS1-1 + END IF + L=L+1 + END WHILE + + L=NS1 + WHILE L<=NS2 DO + IF STACK$[L]="*" OR STACK$[L]="/" THEN + IF L>=NS2 THEN GOTO 99 END IF + N1#=VAL(STACK$[L-1]) N2#=VAL(STACK$[L+1]) NOP=NOP-1 + IF STACK$[L]="*" THEN + RI#=N1#*N2# + ELSE + IF N2#<>0 THEN RI#=N1#/N2# ELSE NERR=6 RI#=0 END IF + END IF + STACK$[L-1]=STR$(RI#) + N=L + WHILE N<=NS2-2 DO + STACK$[N]=STACK$[N+2] + N=N+1 + END WHILE + NS2=NS2-2 + L=NS1-1 + END IF + L=L+1 + END WHILE + + L=NS1 + WHILE L<=NS2 DO + IF STACK$[L]="+" OR STACK$[L]="-" THEN + EXIT IF L>=NS2 + N1#=VAL(STACK$[L-1]) N2#=VAL(STACK$[L+1]) NOP=NOP-1 + IF STACK$[L]="+" THEN RI#=N1#+N2# ELSE RI#=N1#-N2# END IF + STACK$[L-1]=STR$(RI#) + N=L + WHILE N<=NS2-2 DO + STACK$[N]=STACK$[N+2] + N=N+1 + END WHILE + NS2=NS2-2 + L=NS1-1 + END IF + L=L+1 + END WHILE +99: + IF NOP<2 THEN ! precedenza tra gli operatori + DB#=VAL(STACK$[NS1]) + ELSE + IF NOP<3 THEN + DB#=VAL(STACK$[NS1+2]) + ELSE + DB#=VAL(STACK$[NS1+4]) + END IF + END IF +END PROCEDURE + +PROCEDURE SVOLGI_PAR + NPA=NPA-1 + FOR J=NS TO 1 STEP -1 DO + EXIT IF STACK$[J]="(" + END FOR + IF J=0 THEN + NS1=1 NS2=NS CALC_ARITM NERR=7 + ELSE + FOR R=J TO NS-1 DO + STACK$[R]=STACK$[R+1] + END FOR + NS1=J NS2=NS-1 CALC_ARITM + IF NS1=2 THEN + NS1=1 STACK$[1]=STACK$[2] + END IF + NS=NS1 + COMPATTA_STACK + END IF +END PROCEDURE + +PROCEDURE MYEVAL(EXPRESSION$,DB#,NERR->DB#,NERR) + + NOP=0 NPA=0 NS=1 K$="" NERR=0 + STACK$[1]="@" ! init stack + + FOR W=1 TO LEN(EXPRESSION$) DO + LOOP + CODE=ASC(MID$(EXPRESSION$,W,1)) + IF (CODE>=48 AND CODE<=57) OR CODE=46 THEN + K$=K$+CHR$(CODE) + W=W+1 IF W>LEN(EXPRESSION$) THEN GOTO 98 END IF + ELSE + EXIT IF K$="" + IF NS>1 OR (NS=1 AND STACK$[1]<>"@") THEN NS=NS+1 END IF + IF FLAG=0 THEN + STACK$[NS]=K$ + ELSE + STACK$[NS]=STR$(VAL(K$)*FLAG) + END IF + K$="" FLAG=0 + EXIT + END IF + END LOOP + IF CODE=43 THEN K$="+" END IF + IF CODE=45 THEN K$="-" END IF + IF CODE=42 THEN K$="*" END IF + IF CODE=47 THEN K$="/" END IF + IF CODE=94 THEN K$="^" END IF + + CASE CODE OF + 43,45,42,47,94-> ! +-*/^ + IF MID$(EXPRESSION$,W+1,1)="-" THEN FLAG=-1 W=W+1 END IF + IF INSTR(ST_CONST$,STACK$[NS])<>0 THEN + NERR=5 + ELSE + NS=NS+1 STACK$[NS]=K$ NOP=NOP+1 + IF NOP>=2 THEN + FOR J=NS TO 1 STEP -1 DO + IF STACK$[J]<>"(" THEN GOTO 2540 END IF + IF J + + 40-> ! ( + IF NS>1 OR (NS=1 AND STACK$[1]<>"@") THEN NS=NS+1 END IF + STACK$[NS]="(" NPA=NPA+1 + IF MID$(EXPRESSION$,W+1,1)="-" THEN FLAG=-1 W=W+1 END IF + END -> + + 41-> ! ) + SVOLGI_PAR + IF NERR=7 THEN + NERR=0 NOP=0 NPA=0 NS=1 + ELSE + IF NERR=0 OR NERR=1 THEN + DB#=VAL(STACK$[NS]) + REGISTRO_X#=DB# + ELSE + NOP=0 NPA=0 NS=1 + END IF + END IF + END -> + + OTHERWISE + NERR=8 + END CASE + K$="" + END FOR +98: + IF K$<>"" THEN + IF NS>1 OR (NS=1 AND STACK$[1]<>"@") THEN NS=NS+1 END IF + IF FLAG=0 THEN STACK$[NS]=K$ ELSE STACK$[NS]=STR$(VAL(K$)*FLAG) END IF + END IF + + IF INSTR(ST_CONST$,STACK$[NS])<>0 THEN + NERR=6 + ELSE + WHILE NPA<>0 DO + SVOLGI_PAR + END WHILE + IF NERR<>7 THEN NS1=1 NS2=NS CALCARITM END IF + END IF + + NS=1 NOP=0 NPA=0 + +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) ! CLS + + ! possible brackets + DATA("4#4#4#4") + DATA("(4#4)#4#4") + DATA("4#(4#4)#4") + DATA("4#4#(4#4)") + DATA("(4#4)#(4#4)") + DATA("(4#4#4)#4") + DATA("4#(4#4#4)") + DATA("((4#4)#4)#4") + DATA("(4#(4#4))#4") + DATA("4#((4#4)#4)") + DATA("4#(4#(4#4))") + FOR I=1 TO NBRACKETS DO + READ(BRAKETS$[I]) + END FOR + + INPUT("ENTER 4 DIGITS: ",A$) + ND=0 + FOR I=1 TO LEN(A$) DO + C$=MID$(A$,I,1) + IF INSTR("123456789",C$)>0 THEN + ND=ND+1 + D[ND]=VAL(C$) + END IF + END FOR + ! precompute permutations. dumb way. + NPERM=1*2*3*4 + N=0 + FOR I=1 TO 4 DO + FOR J=1 TO 4 DO + FOR K=1 TO 4 DO + FOR L=1 TO 4 DO + ! valid permutation (no dupes) + IF I<>J AND I<>K AND I<>L AND J<>K AND J<>L AND K<>L THEN + N=N+1 +! actually,we can as well permute given digits + PERM[N,1]=D[I] + PERM[N,2]=D[J] + PERM[N,3]=D[K] + PERM[N,4]=D[L] + END IF + END FOR + END FOR + END FOR + END FOR + + ! operations: full search + COUNT=0 + OPS$="+-*/" + FOR OP1=1 TO 4 DO + OP$[1]=MID$(OPS$,OP1,1) + FOR OP2=1 TO 4 DO + OP$[2]=MID$(OPS$,OP2,1) + FOR OP3=1 TO 4 DO + OP$[3]=MID$(OPS$,OP3,1) + ! substitute all brackets + FOR T=1 TO NBRACKETS DO + TMPL$=BRAKETS$[T] + ! now,substitute all digits: permutations. + FOR P=1 TO NPERM DO + RES$="" + NOP=0 + ND=0 + FOR I=1 TO LEN(TMPL$) DO + C$=MID$(TMPL$,I,1) + CASE C$ OF + "#"-> ! operations + NOP=NOP+1 + RES$=RES$+OP$[NOP] + END -> + "4"-> ! digits + ND=NOP+1 + RES$=RES$+MID$(STR$(PERM[P,ND]),2) + END -> + OTHERWISE ! brackets goes here + RES$=RES$+C$ + END CASE + END FOR + ! eval here + MY_EVAL(RES$,DB#,NERR->DB#,NERR) + IF DB#=24 AND NERR=0 THEN + PRINT("24=";RES$) + COUNT=COUNT+1 + END IF + END FOR + END FOR + END FOR + END FOR + END FOR + + IF COUNT=0 THEN + PRINT("If you see this, probably task cannot be solved with these digits") + ELSE + PRINT("Total=";COUNT) + END IF + +END PROGRAM diff --git a/Task/24-game-Solve/EchoLisp/24-game-solve.echolisp b/Task/24-game-Solve/EchoLisp/24-game-solve.echolisp new file mode 100644 index 0000000000..450acaf0da --- /dev/null +++ b/Task/24-game-Solve/EchoLisp/24-game-solve.echolisp @@ -0,0 +1,111 @@ +;; use task [[RPN_to_infix_conversion#EchoLisp]] to print results +(define (rpn->string rpn) + (if (vector? rpn) + (infix->string (rpn->infix rpn)) + "😥 Not found")) + + +(string-delimiter "") +(define OPS #(* + - // )) ;; use float division +(define-syntax-rule (commutative? op) (or (= op *) (= op +))) + +;; --------------------------------- +;; calc rpn -> num value or #f if bad rpn +;; rpn is a vector of ops or numbers +;; ---------------------------------- +(define (calc rpn) +(define S (stack 'S)) + (for ((token rpn)) + (if (procedure? token) + (let [(op2 (pop S)) (op1 (pop S))] + (if (and op1 op2) + (push S (apply token (list op1 op2))) + (push S #f))) ;; not-well formed + (push S token )) + #:break (not (stack-top S))) + (if (= 1 (stack-length S)) (pop S) #f)) + +;; check for legal rpn -> #f if not legal +(define (rpn? rpn) +(define S (stack 'S)) + (for ((token rpn)) + (if (procedure? token) + (push S (and (pop S) (pop S))) + (push S token )) + #:break (not (stack-top S))) + (stack-top S)) + +;; -------------------------------------- +;; build-rpn : push next rpn op or number +;; dleft is number of not used digits +;; --------------------------------------- +(define count 0) + +(define (build-rpn into: rpn depth maxdepth digits ops dleft target &hit ) +(define cmpop #f) + (cond +;; tooo long + [(> (++ count) 200_000) (set-box! &hit 'not-found)] +;; stop on first hit + [(unbox &hit) &hit] +;; partial rpn must be legal + [(not (rpn? rpn)) #f] +;; eval rpn if complete + [(> depth maxdepth) + (when (= target (calc rpn)) (set-box! &hit rpn))] +;; else, add a digit to rpn + [else + [when (< depth maxdepth) ;; digits anywhere except last + (for [(d digits) (i 10)] + #:continue (zero? d) + (vector-set! digits i 0) ;; mark used + (vector-set! rpn depth d) + (build-rpn rpn (1+ depth) maxdepth digits ops (1- dleft) target &hit) + (vector-set! digits i d)) ;; mark unused + ] ;; add digit +;; or, add an op +;; ops anywhere except positions 0,1 + [when (and (> depth 1) (<= (+ depth dleft) maxdepth));; cutter : must use all digits + (set! cmpop + (and (number? [rpn (1- depth)]) + (number? [rpn (- depth 2)]) + (> [rpn (1- depth)] [rpn (- depth 2)]))) + + (for [(op ops)] + #:continue (and cmpop (commutative? op)) ;; cutter : 3 4 + === 4 3 + + (vector-set! rpn depth op) + (build-rpn rpn (1+ depth) maxdepth digits ops dleft target &hit) + (vector-set! rpn depth 0))] ;; add op + ] ; add something to rpn vector + )) ; build-rpn + +;;------------------------ +;;gen24 : num random numbers +;;------------------------ +(define (gen24 num maxrange) + (->> (append (range 1 maxrange)(range 1 maxrange)) shuffle (take num))) + +;;------------------------------------------- +;; try-rpn : sets starter values for build-rpn +;;------------------------------------------- +(define (try-rpn digits target) + (set! digits (list-sort > digits)) ;; seems to accelerate things + (define rpn (make-vector (1- (* 2 (length digits))))) + (define &hit (box #f)) + (set! count 0) + + (build-rpn rpn starter-depth: 0 + max-depth: (1- (vector-length rpn)) + (list->vector digits) + OPS + remaining-digits: (length digits) + target &hit ) + (writeln target '= (rpn->string (unbox &hit)) 'tries= count)) + +;; ------------------------------- +;; (task numdigits target maxrange) +;; -------------------------------- +(define (task (numdigits 4) (target 24) (maxrange 10)) + (define digits (gen24 numdigits maxrange)) + (writeln digits '→ target) + (try-rpn digits target)) diff --git a/Task/24-game-Solve/Phix/24-game-solve.phix b/Task/24-game-Solve/Phix/24-game-solve.phix new file mode 100644 index 0000000000..263add89f1 --- /dev/null +++ b/Task/24-game-Solve/Phix/24-game-solve.phix @@ -0,0 +1,121 @@ +-- +-- 24_game_solve.exw +-- ================= +-- +-- Write a function that given four digits subject to the rules of the 24 game, computes an expression to solve the game if possible. +-- Show examples of solutions generated by the function +-- +-- The following 5 parse expressions are possible. +-- Obviously numbers 1234 represent 24 permutations from +-- {1,2,3,4} to {4,3,2,1} of indexes to the real numbers. +-- Likewise "+-*" is like "123" representing 64 combinations +-- from {1,1,1} to {4,4,4} of indexes to "+-*/". +-- Both will be replaced if/when the strings get printed. +-- +constant OPS = "+-*/" +constant expressions = {"1+(2-(3*4))", + "1+((2-3)*4)", + "(1+2)-(3*4)", + "(1+(2-3))*4", + "((1+2)-3)*4"} -- (equivalent to "1+2-3*4") +--TODO: I'm sure there is a simple (recursive) way to programatically +-- generate the above (for n=2..9) but I'm not seeing it yet... + +-- The above represented as three sequential operations (the result gets +-- left in <(map)1>, ie vars[perms[operations[i][3][1]]] aka vars[lhs]): +constant operations = {{{3,'*',4},{2,'-',3},{1,'+',2}}, --3*=4; 2-=3; 1+=2 + {{2,'-',3},{2,'*',4},{1,'+',2}}, --2-=3; 2*=4; 1+=2 + {{1,'+',2},{3,'*',4},{1,'-',3}}, --1+=2; 3*=4; 1-=3 + {{2,'-',3},{1,'+',2},{1,'*',4}}, --2-=3; 1+=2; 1*=4 + {{1,'+',2},{1,'-',3},{1,'*',4}}} --1+=2; 1-=3; 1*=4 +--TODO: ... and likewise for parsing "expressions" to yield "operations". + +function evalopset(sequence opset, sequence perms, sequence ops, sequence vars) +-- invoked 5*24*64 = 7680 times, to try all possible expressions/vars/operators +-- (btw, vars is copy-on-write, like all parameters not explicitly returned, so +-- we can safely re-use it without clobbering the callee version.) +integer lhs,op,rhs +atom inf + for i=1 to length(opset) do + {lhs,op,rhs} = opset[i] + lhs = perms[lhs] + op = ops[find(op,OPS)] + rhs = perms[rhs] + if op='+' then + vars[lhs] += vars[rhs] + elsif op='-' then + vars[lhs] -= vars[rhs] + elsif op='*' then + vars[lhs] *= vars[rhs] + elsif op='/' then + if vars[rhs]=0 then inf = 1e300*1e300 return inf end if + vars[lhs] /= vars[rhs] + end if + end for + return vars[lhs] +end function + +integer nSolutions +sequence xSolutions + +procedure success(string expr, sequence perms, sequence ops, sequence vars, atom r) +integer ch + for i=1 to length(expr) do + ch = expr[i] + if ch>='1' and ch<='9' then + expr[i] = vars[perms[ch-'0']]+'0' + else + ch = find(ch,OPS) + if ch then + expr[i] = ops[ch] + end if + end if + end for + if not find(expr,xSolutions) then + -- avoid duplicates for eg {1,1,2,7} because this has found + -- the "same" solution but with the 1st and 2nd 1s swapped, + -- and likewise whenever an operator is used more than once. + printf(1,"success: %s = %s\n",{expr,sprint(r)}) + nSolutions += 1 + xSolutions = append(xSolutions,expr) + end if +end procedure + +procedure tryperms(sequence perms, sequence ops, sequence vars) +atom r + for i=1 to length(operations) do + -- 5 parse expressions + r = evalopset(operations[i], perms, ops, vars) + if r=24 then + success(expressions[i], perms, ops, vars, r) + end if + end for +end procedure + +include builtins/factorial.e +include builtins/permute.e + +procedure tryops(sequence ops, sequence vars) + for p=1 to factorial(4) do + -- 24 var permutations + tryperms(permute(p,{1,2,3,4}),ops, vars) + end for +end procedure + +global procedure solve24(sequence vars) + nSolutions = 0 + xSolutions = {} + for op1=1 to 4 do + for op2=1 to 4 do + for op3=1 to 4 do + -- 64 operator combinations + tryops({OPS[op1],OPS[op2],OPS[op3]},vars) + end for + end for + end for + + printf(1,"\n%d solutions\n",{nSolutions}) +end procedure + + solve24({1,1,2,7}) + if getc(0) then end if diff --git a/Task/24-game-Solve/Sidef/24-game-solve-1.sidef b/Task/24-game-Solve/Sidef/24-game-solve-1.sidef new file mode 100644 index 0000000000..724691c463 --- /dev/null +++ b/Task/24-game-Solve/Sidef/24-game-solve-1.sidef @@ -0,0 +1,32 @@ +var formats = [ + '((%d %s %d) %s %d) %s %d', + '(%d %s (%d %s %d)) %s %d', + '(%d %s %d) %s (%d %s %d)', + '%d %s ((%d %s %d) %s %d)', + '%d %s (%d %s (%d %s %d))', +]; + +var op = %w( + - * / ); +var operators = op.map { |a| op.map {|b| op.map {|c| "#{a} #{b} #{c}" } } }.flatten; + +loop { + var input = Sys.scanln("Enter four integers or 'q' to exit: "); + input == 'q' && break; + + input ~~ /^\h*[1-9]\h+[1-9]\h+[1-9]\h+[1-9]\h*$/ || ( + say "Invalid input!"; next; + ); + + var n = input.split.map{.to_i}; + var numbers = n.permute; + + formats.each { |format| + numbers.each { |n| + operators.each { |operator| + var o = operator.split; + var str = (format % (n[0],o[0],n[1],o[1],n[2],o[2],n[3])); + eval(str) == 24 && say str; + } + } + } +} diff --git a/Task/24-game-Solve/Sidef/24-game-solve-2.sidef b/Task/24-game-Solve/Sidef/24-game-solve-2.sidef new file mode 100644 index 0000000000..c5290c51a3 --- /dev/null +++ b/Task/24-game-Solve/Sidef/24-game-solve-2.sidef @@ -0,0 +1,57 @@ +var formats = [ + {|a,b,c| + Hash.new( + func => {|d,e,f,g| ((d.$a(e)).$b(f)).$c(g) }, + format => "((%d #{a} %d) #{b} %d) #{c} %d" + ) + }, + {|a,b,c| + Hash.new( + func => {|d,e,f,g| (d.$a((e.$b(f)))).$c(g) }, + format => "(%d #{a} (%d #{b} %d)) #{c} %d", + ) + }, + {|a,b,c| + Hash.new( + func => {|d,e,f,g| (d.$a(e)).$b(f.$c(g)) }, + format => "(%d #{a} %d) #{b} (%d #{c} %d)", + ) + }, + {|a,b,c| + Hash.new( + func => {|d,e,f,g| (d.$a(e)).$b(f.$c(g)) }, + format => "(%d #{a} %d) #{b} (%d #{c} %d)", + ) + }, + {|a,b,c| + Hash.new( + func => {|d,e,f,g| d.$a(e.$b(f.$c(g))) }, + format => "%d #{a} (%d #{b} (%d #{c} %d))", + ) + }, +]; + +var op = %w( + - * / ); +var blocks = op.map { |a| op.map { |b| op.map { |c| formats.map { |format| + format(a,b,c) +}}}}.flatten; + +loop { + var input = Sys.scanln("Enter four integers or 'q' to exit: "); + input == 'q' && break; + + input ~~ /^\h*[1-9]\h+[1-9]\h+[1-9]\h+[1-9]\h*$/ || ( + say "Invalid input!"; next; + ); + + var n = input.split.map{.to_num}; + var numbers = n.permute; + + blocks.each { |block| + numbers.each { |n| + if (block{:func}.call(n...) == 24) { + say (block{:format} % (n...)); + } + } + } +} diff --git a/Task/24-game-Solve/Swift/24-game-solve.swift b/Task/24-game-Solve/Swift/24-game-solve.swift new file mode 100644 index 0000000000..af1f83c0a1 --- /dev/null +++ b/Task/24-game-Solve/Swift/24-game-solve.swift @@ -0,0 +1,172 @@ +import Darwin +import Foundation + +var solution = "" + +println("24 Game") +println("Generating 4 digits...") + +func randomDigits() -> [Int] { + var result = [Int]() + for i in 0 ..< 4 { + result.append(Int(arc4random_uniform(9)+1)) + } + return result +} + +// Choose 4 digits +let digits = randomDigits() + +print("Make 24 using these digits : ") + +for digit in digits { + print("\(digit) ") +} +println() + +// get input from operator +var input = NSString(data:NSFileHandle.fileHandleWithStandardInput().availableData, encoding:NSUTF8StringEncoding)! + +var enteredDigits = [Double]() + +var enteredOperations = [Character]() + +let inputString = input as String + +// store input in the appropriate table +for character in inputString { + switch character { + case "1", "2", "3", "4", "5", "6", "7", "8", "9": + let digit = String(character) + enteredDigits.append(Double(digit.toInt()!)) + case "+", "-", "*", "/": + enteredOperations.append(character) + case "\n": + println() + default: + println("Invalid expression") + } +} + +// check value of expression provided by the operator +var value = 0.0 + +if enteredDigits.count == 4 && enteredOperations.count == 3 { + value = enteredDigits[0] + for (i, operation) in enumerate(enteredOperations) { + switch operation { + case "+": + value = value + enteredDigits[i+1] + case "-": + value = value - enteredDigits[i+1] + case "*": + value = value * enteredDigits[i+1] + case "/": + value = value / enteredDigits[i+1] + default: + println("This message should never happen!") + } + } +} + +func evaluate(dPerm: [Double], oPerm: [String]) -> Bool { + var value = 0.0 + + if dPerm.count == 4 && oPerm.count == 3 { + value = dPerm[0] + for (i, operation) in enumerate(oPerm) { + switch operation { + case "+": + value = value + dPerm[i+1] + case "-": + value = value - dPerm[i+1] + case "*": + value = value * dPerm[i+1] + case "/": + value = value / dPerm[i+1] + default: + println("This message should never happen!") + } + } + } + return (abs(24 - value) < 0.001) +} + +func isSolvable(inout digits: [Double]) -> Bool { + + var result = false + var dPerms = [[Double]]() + permute(&digits, &dPerms, 0) + + let total = 4 * 4 * 4 + var oPerms = [[String]]() + permuteOperators(&oPerms, 4, total) + + + for dig in dPerms { + for opr in oPerms { + var expression = "" + + if evaluate(dig, opr) { + for digit in dig { + expression += "\(digit)" + } + + for oper in opr { + expression += oper + } + + solution = beautify(expression) + result = true + } + } + } + return result +} + +func permute(inout lst: [Double], inout res: [[Double]], k: Int) -> Void { + for i in k ..< lst.count { + swap(&lst[i], &lst[k]) + permute(&lst, &res, k + 1) + swap(&lst[k], &lst[i]) + } + if k == lst.count { + res.append(lst) + } +} + +// n=4, total=64, npow=16 +func permuteOperators(inout res: [[String]], n: Int, total: Int) -> Void { + let posOperations = ["+", "-", "*", "/"] + let npow = n * n + for i in 0 ..< total { + res.append([posOperations[(i / npow)], posOperations[((i % npow) / n)], posOperations[(i % n)]]) + } +} + +func beautify(infix: String) -> String { + let newString = infix as NSString + + var solution = "" + + solution += newString.substringWithRange(NSMakeRange(0, 1)) + solution += newString.substringWithRange(NSMakeRange(12, 1)) + solution += newString.substringWithRange(NSMakeRange(3, 1)) + solution += newString.substringWithRange(NSMakeRange(13, 1)) + solution += newString.substringWithRange(NSMakeRange(6, 1)) + solution += newString.substringWithRange(NSMakeRange(14, 1)) + solution += newString.substringWithRange(NSMakeRange(9, 1)) + + return solution +} + +if value != 24 { + println("The value of the provided expression is \(value) instead of 24!") + if isSolvable(&enteredDigits) { + println("A possible solution could have been " + solution) + } else { + println("Anyway, there was no known solution to this one.") + } +} else { + println("Congratulations, you found a solution!") +} diff --git a/Task/24-game-Solve/jq/24-game-solve-1.jq b/Task/24-game-Solve/jq/24-game-solve-1.jq new file mode 100644 index 0000000000..cf29d3c5fa --- /dev/null +++ b/Task/24-game-Solve/jq/24-game-solve-1.jq @@ -0,0 +1,40 @@ +# Generate a stream of the permutations of the input array. +def permutations: + if length == 0 then [] + else + . as $in | range(0;length) | . as $i + | ($in|del(.[$i])|permutations) + | [$in[$i]] + . + end ; + +# Generate a stream of arrays of length n, +# with members drawn from the input array. +def take(n): + length as $l | + if n == 1 then range(0;$l) as $i | [ .[$i] ] + else take(n-1) + take(1) + end; + +# Emit an array with elements that alternate between those in the input array and those in short, +# starting with the former, and using nothing if "short" is too too short. +def intersperse(short): + . as $in + | reduce range(0;length) as $i + ([]; . + [ $in[$i], (short[$i] // empty) ]); + +# Emit a stream of all the nested triplet groupings of the input array elements, +# e.g. [1,2,3,4,5] => +# [1,2,[3,4,5]] +# [[1,2,3],4,5] +# +def triples: + . as $in + | if length == 3 then . + elif length == 1 then $in[0] + elif length < 3 then empty + else + (range(0; (length-1) / 2) * 2 + 1) as $i + | ($in[0:$i] | triples) as $head + | ($in[$i+1:] | triples) as $tail + | [$head, $in[$i], $tail] + end; diff --git a/Task/24-game-Solve/jq/24-game-solve-2.jq b/Task/24-game-Solve/jq/24-game-solve-2.jq new file mode 100644 index 0000000000..f2bd624a8c --- /dev/null +++ b/Task/24-game-Solve/jq/24-game-solve-2.jq @@ -0,0 +1,23 @@ +# Evaluate the input, which must be a number or a triple: [x, op, y] +def eval: + if type == "array" then + .[1] as $op + | if .[0] == null or .[2] == null then null + else + (.[0] | eval) as $left | (.[2] | eval) as $right + | if $left == null or $right == null then null + elif $op == "+" then $left + $right + elif $op == "-" then $left - $right + elif $op == "*" then $left * $right + elif $op == "/" then + if $right == 0 then null + else $left / $right + end + else "invalid arithmetic operator: \($op)" | error + end + end + else . + end; + +def pp: + "\(.)" | explode | map([.] | implode | if . == "," then " " elif . == "\"" then "" else . end) | join(""); diff --git a/Task/24-game-Solve/jq/24-game-solve-3.jq b/Task/24-game-Solve/jq/24-game-solve-3.jq new file mode 100644 index 0000000000..fa715a935f --- /dev/null +++ b/Task/24-game-Solve/jq/24-game-solve-3.jq @@ -0,0 +1,21 @@ +def OPERATORS: ["+", "-", "*", "/"]; + +# Input: an array of 4 digits +# o: an array of 3 operators +# Output: a stream +def EXPRESSIONS(o): + intersperse( o ) | triples; + +def solve(objective): + length as $length + | [ (OPERATORS | take($length-1)) as $poperators + | permutations | EXPRESSIONS($poperators) + | select( eval == objective) + ] as $answers + | if $answers|length > 3 then "That was too easy. I found \($answers|length) answers, e.g. \($answers[0] | pp)" + elif $answers|length > 1 then $answers[] | pp + else "You lose! There are no solutions." + end +; + +solve(24), "Please try again." diff --git a/Task/24-game-Solve/jq/24-game-solve-4.jq b/Task/24-game-Solve/jq/24-game-solve-4.jq new file mode 100644 index 0000000000..c721de6bdd --- /dev/null +++ b/Task/24-game-Solve/jq/24-game-solve-4.jq @@ -0,0 +1,16 @@ +$ jq -r -f Solve.jq +[1,2,3,4] +That was too easy. I found 242 answers, e.g. [4 * [1 + [2 + 3]]] +Please try again. +[1,2,3,40,1] +That was too easy. I found 636 answers, e.g. [[[1 / 2] * 40] + [3 + 1]] +Please try again. +[3,8,9] +That was too easy. I found 8 answers, e.g. [[8 / 3] * 9] +Please try again. +[4,5,6] +You lose! There are no solutions. +Please try again. +[1,2,3,4,5,6] +That was too easy. I found 197926 answers, e.g. [[2 * [1 + 4]] + [3 + [5 + 6]]] +Please try again. diff --git a/Task/24-game/8th/24-game.8th b/Task/24-game/8th/24-game.8th new file mode 100644 index 0000000000..b23afc002c --- /dev/null +++ b/Task/24-game/8th/24-game.8th @@ -0,0 +1,109 @@ +\ Generate four random digits and display to the user +\ then get an expression from the user using +, -, / and * and the digits +\ the result must equal 24 +\ http://8th-dev.com/24game.html + +\ Only the words in namespace 'game' are available to the player: +ns: game + +: + n:+ ; +: - n:- ; +: * n:* ; +: / n:/ ; + +ns: G + +var random-digits +var user-input + +: one-digit \ a -- a + rand n:abs 9 n:mod n:1+ a:push ; + +: gen-digits \ - a + [] clone nip \ the clone nip is not needed in versions past 1.0.2... + ' one-digit 4 times + ' n:cmp a:sort + random-digits ! ; + +: prompt-user + cr "The digits are: " . random-digits @ . cr ; + +: goodbye + cr "Thanks for playing!\n" . cr 0 die ; + +: get-input + 70 null con:accept dup user-input ! + null? if drop goodbye then ; + +: compare-digits + true swap + ( + \ inputed-array index + dup >r + a:@ + random-digits @ r> a:@ nip + n:= not if + break + swap drop false swap + then + ) 0 3 loop drop ; + +/^\D*(\d)\D+(\d)\D+(\d)\D+(\d)\D*$/ var, digits-regex + +: all-digits? + user-input @ digits-regex @ r:match + null? if drop false else + 5 = not if + false + else + \ convert the captured digits in the regex into a sorted array: + digits-regex @ + ( r:@ >n swap ) 1 4 loop drop + 4 a:close ' n:cmp a:sort + compare-digits + then + then ; + +: does-eval? + 0 user-input @ eval 24 n:= + dup not if + cr "Sorry, that expression is wrong" . cr + then ; + +: check-input + reset + all-digits? if + does-eval? if + cr "Excellent! Your expression: \"" . + user-input @ . + "\" worked!" . cr + then + else + cr "You did not use the digits properly, try again." . cr + then ; + +: intro quote | + +Welcome to the '24 game'! + +You will be shown four digits each time. Using only the + - * and / operators +and all the digits (and only the digits), produce the number '24' + +Enter your result in 8th syntax, e.g.: 4 4 + 2 1 + * + +To quit the game, just hit enter by itself. Enjoy! + + | . ; + +: start + \ don't allow anything but the desired words + ns:game only + intro + repeat + gen-digits + prompt-user + get-input + check-input + again ; + +start diff --git a/Task/24-game/Ceylon/24-game.ceylon b/Task/24-game/Ceylon/24-game.ceylon new file mode 100644 index 0000000000..f1f0e667ca --- /dev/null +++ b/Task/24-game/Ceylon/24-game.ceylon @@ -0,0 +1,221 @@ +import ceylon.random { + + DefaultRandom +} + +class Rational(shared Integer numerator, shared Integer denominator = 1) satisfies Numeric { + + assert(denominator != 0); + + Integer gcd(Integer a, Integer b) => if(b == 0) then a else gcd(b, a % b); + + shared Rational inverted => Rational(denominator, numerator); + + shared Rational simplified => + let(largestFactor = gcd(numerator, denominator)) + Rational(numerator / largestFactor, denominator / largestFactor); + + divided(Rational other) => (this * other.inverted).simplified; + + negated => Rational(-numerator, denominator).simplified; + + plus(Rational other) => + let(top = numerator * other.denominator + other.numerator * denominator, + bottom = denominator * other.denominator) + Rational(top, bottom).simplified; + + times(Rational other) => + Rational(numerator * other.numerator, denominator * other.denominator).simplified; + + shared Integer integer => numerator / denominator; + shared Float float => numerator.float / denominator.float; + + string => denominator == 1 then numerator.string else "``numerator``/``denominator``"; +} + +interface Expression { + shared formal Rational evaluate(); +} + +class NumberExpression(Rational number) satisfies Expression { + evaluate() => number; + string => number.string; +} + +class OperatorExpression(Expression left, Character operator, Expression right) satisfies Expression { + shared actual Rational evaluate() { + switch(operator) + case('*') { + return left.evaluate() * right.evaluate(); + } + case('/') { + return left.evaluate() / right.evaluate(); + } + case('-') { + return left.evaluate() - right.evaluate(); + } + case('+') { + return left.evaluate() + right.evaluate(); + } + else { + throw Exception("unknown operator ``operator``"); + } + } + + string => "(``left.string`` ``operator.string`` ``right.string``)"; +} + +"A simplified top down operator precedence parser. There aren't any right + binding operators so we don't have to worry about that." +class PrattParser(String input) { + + value tokens = input.replace(" ", ""); + variable value index = -1; + + shared Expression expression(Integer precedence = 0) { + value token = advance(); + variable value left = parseUnary(token); + while(precedence < getPrecedence(peek())) { + value nextToken = advance(); + left = parseBinary(left, nextToken); + } + return left; + } + + Integer getPrecedence(Character op) => + switch(op) + case('*' | '/') 2 + case('+' | '-') 1 + else 0; + + Character advance(Character? expected = null) { + index++; + value token = tokens[index] else ' '; + if(exists expected, token != expected) { + throw Exception("unknown character ``token``"); + } + return token; + } + + Character peek() => tokens[index + 1] else ' '; + + Expression parseBinary(Expression left, Character operator) => + let(right = expression(getPrecedence(operator))) + OperatorExpression(left, operator, right); + + Expression parseUnary(Character token) { + if(token.digit) { + assert(exists int = parseInteger(token.string)); + return NumberExpression(Rational(int)); + } else if(token == '(') { + value exp = expression(); + advance(')'); + return exp; + } else { + throw Exception("unknown character ``token``"); + } + } +} + +"Run the module `twentyfourgame`." +shared void run() { + + value random = DefaultRandom(); + + function random4Numbers() => + random.elements(1..9).take(4).sequence(); + + function isValidGuess(String input, {Integer*} allowedNumbers) { + value allowedOperators = set {*"()+-/*"}; + value extractedNumbers = input + .split((Character ch) => ch in allowedOperators || ch.whitespace) + .map((String element) => parseInteger(element)) + .coalesced; + if(extractedNumbers.any((Integer element) => element > 9)) { + print("number too big!"); + return false; + } + if(extractedNumbers.any((Integer element) => element < 1)) { + print("number too small!"); + return false; + } + if(extractedNumbers.sort(byIncreasing(Integer.magnitude)) != allowedNumbers.sort(byIncreasing(Integer.magnitude))) { + print("use all the numbers, please!"); + return false; + } + if(!input.every((Character element) => element in allowedOperators || element.digit || element.whitespace)) { + print("only digits and mathematical operators, please"); + return false; + } + variable value lefts = 0; + for(c in input) { + if(c == '(') { + lefts++; + } else if(c == ')') { + lefts--; + if(lefts < 0) { + break; + } + } + } + if(lefts != 0) { + print("unbalanced brackets!"); + return false; + } + return true; + } + + function evaluate(String input) => + let(parser = PrattParser(input), + exp = parser.expression()) + exp.evaluate(); + + print("Welcome to The 24 Game. + Create a mathematical equation with four random + numbers that evaluates to 24. + You must use all the numbers once and only once, + but in any order. + Also, only + - / * and parentheses are allowed. + For example: (1 + 2 + 3) * 4 + Also: enter n for new numbers and q to quit. + -----------------------------------------------"); + + while(true) { + + value chosenNumbers = random4Numbers(); + void pleaseTryAgain() => print("Sorry, please try again. (Your numbers are ``chosenNumbers``)"); + + print("Your numbers are ``chosenNumbers``. Please turn them into 24."); + + while(true) { + value line = process.readLine()?.trimmed; + if(exists line) { + if(line.uppercased == "Q") { + print("bye!"); + return; + } + if(line.uppercased == "N") { + break; + } + if(isValidGuess(line, chosenNumbers)) { + try { + value result = evaluate(line); + print("= ``result``"); + if(result.integer == 24) { + print("You did it!"); + break; + } else { + pleaseTryAgain(); + } + } catch(Exception e) { + print(e.message); + pleaseTryAgain(); + } + } else { + pleaseTryAgain(); + } + } + } + } + +} diff --git a/Task/24-game/EchoLisp/24-game.echolisp b/Task/24-game/EchoLisp/24-game.echolisp new file mode 100644 index 0000000000..d7985ba71e --- /dev/null +++ b/Task/24-game/EchoLisp/24-game.echolisp @@ -0,0 +1,31 @@ +(string-delimiter "") +;; check that nums are in expr, and only once +(define (is-valid? expr sorted: nums) + (when (equal? 'q expr) (error "24-game" "Thx for playing")) + (unless (and + (list? expr) + (equal? nums (list-sort < (filter number? (flatten expr))))) + (writeln "🎃 Please use" nums) + #f)) + +;; 4 random digits +(define (gen24) + (->> (append (range 1 10)(range 1 10)) shuffle (take 4) (list-sort < ))) + +(define (is-24? num) + (unless (= 24 num) + (writeln "😧 Sorry - Result = " num) + #f)) + +(define (check-24 expr) + (if (and + (is-valid? expr nums) + (is-24? (js-eval (string expr)))) ;; use js evaluator + "🍀 🌸 Congrats - (play24) for another one." + (input-expr check-24 (string nums)))) + +(define nums null) +(define (play24) + (set! nums (gen24)) + (writeln "24-game - Can you combine" nums "to get 24 ❓ (q to exit)") + (input-expr check-24 (string-append (string nums) " -> 24 ❓"))) diff --git a/Task/24-game/Lasso/24-game.lasso b/Task/24-game/Lasso/24-game.lasso new file mode 100644 index 0000000000..9853319ee1 --- /dev/null +++ b/Task/24-game/Lasso/24-game.lasso @@ -0,0 +1,70 @@ +[ +if(sys_listunboundmethods !>> 'randoms') => { + define randoms()::array => { + local(out = array) + loop(4) => { #out->insert(math_random(9,1)) } + return #out + } +} +if(sys_listunboundmethods !>> 'checkvalid') => { + define checkvalid(str::string, nums::array)::boolean => { + local(chk = array('*','/','+','-','(',')',' '), chknums = array, lastintpos = -1, poscounter = 0) + loop(9) => { #chk->insert(loop_count) } + with s in #str->values do => { + #poscounter++ + #chk !>> #s && #chk !>> integer(#s) ? return false + integer(#s) > 0 && #lastintpos + 1 >= #poscounter ? return false + integer(#s) > 0 ? #chknums->insert(integer(#s)) + integer(#s) > 0 ? #lastintpos = #poscounter + } + #chknums->size != 4 ? return false + #nums->sort + #chknums->sort + loop(4) => { #nums->get(loop_count) != #chknums(loop_count) ? return false } + return true + } +} +if(sys_listunboundmethods !>> 'executeexpr') => { + define executeexpr(expr::string)::integer => { + local(keep = string) + with i in #expr->values do => { + if(array('*','/','+','-','(',')') >> #i) => { + #keep->append(#i) + else + integer(#i) > 0 ? #keep->append(decimal(#i)) + } + } + return integer(sourcefile('['+#keep+']','24game',true,true)->invoke) + } +} + +local(numbers = array, exprsafe = true, exprcorrect = false, exprresult = 0) +if(web_request->param('nums')->asString->size) => { + with n in web_request->param('nums')->asString->split(',') do => { #numbers->insert(integer(#n->trim&)) } +} +#numbers->size != 4 ? #numbers = randoms() +if(web_request->param('nums')->asString->size) => { + #exprsafe = checkvalid(web_request->param('expr')->asString,#numbers) + if(#exprsafe) => { + #exprresult = executeexpr(web_request->param('expr')->asString) + #exprresult == 24 ? #exprcorrect = true + } +} + +]

24 Game

+

Rules:
+Enter an expression that evaluates to 24

+
    +
  • Only multiplication, division, addition, and subtraction operators/functions are allowed.
  • +
  • Brackets are allowed.
  • +
  • Forming multiple digit numbers from the supplied digits is disallowed. (So an answer of 12+12 when given 1, 2, 2, and 1 is wrong).
  • +
  • The order of the digits when given does not have to be preserved.
  • +
+ +

Numbers

+
+[!#exprsafe ? '

Please provide a valid expression

'] +
+[if(#exprsafe)] +

Result: [#exprresult] [#exprcorrect ? 'is CORRECT!' | 'is incorrect']

+[/if] diff --git a/Task/24-game/LiveCode/24-game-1.livecode b/Task/24-game/LiveCode/24-game-1.livecode new file mode 100644 index 0000000000..f8a608d520 --- /dev/null +++ b/Task/24-game/LiveCode/24-game-1.livecode @@ -0,0 +1,5 @@ +on mouseUp + put empty into fld "EvalField" + put empty into fld "AnswerField" + put random(9) & comma & random(9) & comma & random(9) & comma & random(9) into fld "YourNumbersField" +end mouseUp diff --git a/Task/24-game/LiveCode/24-game-2.livecode b/Task/24-game/LiveCode/24-game-2.livecode new file mode 100644 index 0000000000..c3ec78b0bf --- /dev/null +++ b/Task/24-game/LiveCode/24-game-2.livecode @@ -0,0 +1,30 @@ +on keyDown k + local ops, nums, allowedKeys, numsCopy, expr + put "+,-,/,*,(,)" into ops + put the text of fld "YourNumbersField" into nums + put the text of fld "EvalField" into expr + if matchText(expr & k,"\d\d") then + answer "You can't enter 2 digits together" + exit keyDown + end if + repeat with n = 1 to the number of chars of expr + if offset(char n of expr, nums) > 0 then + delete char offset(char n of expr, nums) of nums + end if + end repeat + put ops & comma & nums into allowedKeys + if k is among the items of allowedKeys then + put k after expr + delete char offset(k, nums) of nums + replace comma with empty in nums + try + put the value of merge("[[expr]]") into fld "AnswerField" + if the value of fld "AnswerField" is 24 and nums is empty then + answer "You win!" + end if + end try + pass keyDown + else + exit keyDown + end if +end keyDown diff --git a/Task/24-game/Nim/24-game.nim b/Task/24-game/Nim/24-game.nim new file mode 100644 index 0000000000..92c8a0e884 --- /dev/null +++ b/Task/24-game/Nim/24-game.nim @@ -0,0 +1,40 @@ +import math, strutils, algorithm, sequtils +randomize() + +template newSeqWith(len: int, init: expr): expr = + var result {.gensym.} = newSeq[type(init)](len) + for i in 0 .. l + + System.Out "Digits : " << l << " --> RPN Expression for 24 : " << drop + System.Console askln ->expr + + expr words forEach: w [ + w "+" == ifTrue: [ + continue ] + w "-" == ifTrue: [ - continue ] + w "*" == ifTrue: [ * continue ] + w "/" == ifTrue: [ asFloat / continue ] + + w asInteger dup ->n ifNull: [ System.Out "Word " << w << " not allowed " << cr break ] + l indexOf(n) dup ->i ifNull: [ System.Out "Integer " << n << " is wrong " << cr break ] + n l put(i, null) + ] + l conform(#isNull) ifFalse: [ "Sorry, all numbers must be used..." println return ] + 24 == ifTrue: [ "You won !" ] else: [ "You loose..." ] println ; diff --git a/Task/24-game/Phix/24-game.phix b/Task/24-game/Phix/24-game.phix new file mode 100644 index 0000000000..2fe99ca0de --- /dev/null +++ b/Task/24-game/Phix/24-game.phix @@ -0,0 +1,177 @@ +-- Note this uses simple/strict left association, so for example: +-- 1+2*1*8 is ((1+2)*1)*8 not 1+((2*1)*8) [or 1+(2*(1*8))], and +-- 7-(2*2)*8 is (7-(2*2))*8 not 7-((2*2)*8) +-- Does not allow unary minus on the first digit. +-- Uses solve24() from the next task, when it can. +-- (you may want to comment out the last 2 lines/uncomment the if 0, in that file) +-- +--include 24_game_solve.exw + +--with trace +forward function eval(string equation, sequence unused, integer idx=1) +-- (the above definition is entirely optional, but good coding style) + +constant errorcodes = {"digit expected", -- 1 + "')' expected", -- 2 + "digit already used", -- 3 + "digit not offered", -- 4 + "operand expected"} -- 5 + +function card(integer idx) -- (for error handling) + if idx=1 then return "1st" end if + if idx=2 then return "2nd" end if + -- (assumes expression is less than 21 characters) + return sprintf("%dth",idx) +end function + +function errorchar(sequence equation, integer idx) + if idx>length(equation) then return "" end if + return sprintf("(%s)",equation[idx]) +end function + +sequence rset = repeat(0,4) + +procedure new_rset() + for i=1 to length(rset) do + rset[i] = rand(9) + end for +end procedure + +function get_operand(string equation, integer idx, sequence unused) +integer ch, k, + error = 1 -- "digit expected" +atom res + + if idx<=length(equation) then + ch = equation[idx] + if ch='(' then + {error,res,unused,idx} = eval(equation,unused,idx+1) + if error=0 + and idx<=length(equation) then + ch = equation[idx] + if ch=')' then + return {0,res,unused,idx+1} + end if + end if + if error=0 then + error = 2 -- "')' expected" + end if + elsif ch>='0' and ch<='9' then + res = ch-'0' + k = find(res,unused) + if k!=0 then + unused[k..k] = {} + return {0,res,unused,idx+1} + end if + if find(res,rset) then + error = 3 -- "digit already used" + else + error = 4 -- "digit not offered" + end if + end if + end if + return {error,0,unused,idx} +end function + +function get_operator(string equation, integer idx) +integer ch, error = 5 -- "operand expected" + if idx<=length(equation) then + ch = equation[idx] + if find(ch,"+-/*") then + return {0,ch,idx+1} + end if + end if + return {error,0,idx} +end function + +function eval(string equation, sequence unused, integer idx=1) +atom lhs, rhs +integer ch, error + {error,lhs,unused,idx} = get_operand(equation,idx,unused) + if error=0 then + while 1 do + {error,ch,idx} = get_operator(equation,idx) + if error!=0 then exit end if + {error,rhs,unused,idx} = get_operand(equation,idx,unused) + if error!=0 then exit end if + if ch='+' then lhs += rhs + elsif ch='-' then lhs -= rhs + elsif ch='/' then lhs /= rhs + elsif ch='*' then lhs *= rhs + else ?9/0 -- (should not happen) + end if + if idx>length(equation) then + return {0,lhs,unused,idx} + end if + ch = equation[idx] + if ch=')' then + return {0,lhs,unused,idx} + end if + end while + end if + return {error,0,unused,idx} +end function + +function strip(string equation) + for i=length(equation) to 1 by -1 do + if find(equation[i]," \t\r\n") then + equation[i..i] = "" + end if + end for + return equation +end function + +function strip0(atom a) -- (for error handling) +string res = sprintf("%f",a) +integer ch + for i=length(res) to 2 by -1 do + ch = res[i] + if ch='.' then return res[1..i-1] end if + if ch!='0' then return res[1..i] end if + end for + return res +end function + +procedure play() +sequence unused +string equation +integer error,idx +atom res + + new_rset() + printf(1,"Enter an expression which evaluates to exactly 24\n"& + "Use all of, and only, the digits %d, %d, %d, and %d\n"& + "You may only use the operators + - * /\n"& + "Parentheses and spaces are allowed\n",rset) + while 1 do + equation = strip(gets(0)) + if upper(equation)="Q" then exit end if + if equation="?" then + puts(1,"\n") + integer r_solve24 = routine_id("solve24") -- see below + if r_solve24=-1 then -- (someone copied just this code out?) + puts(1,"no solve24 routine\n") + else + call_proc(r_solve24,{rset}) + end if + else + {error,res,unused,idx} = eval(equation, rset) + if error!=0 then + printf(1," %s on the %s character%s\n",{errorcodes[error],card(idx),errorchar(equation,idx)}) + elsif idx<=length(equation) then + printf(1,"\neval() returned only having processed %d of %d characters\n",{idx,length(equation)}) + elsif length(unused) then + printf(1," not all the digits were used\n",error) + elsif res!=24 then + printf(1,"\nresult is %s, not 24\n",{strip0(res)}) + else + puts(1," correct! Press any key to quit\n") + if getc(0) then end if + exit + end if + end if + puts(1,"enter Q to give up and quit\n") + end while +end procedure + + play() diff --git a/Task/24-game/Potion/24-game.potion b/Task/24-game/Potion/24-game.potion new file mode 100644 index 0000000000..9b3ffd94d1 --- /dev/null +++ b/Task/24-game/Potion/24-game.potion @@ -0,0 +1,40 @@ +is_num = (s): + x = s ord(0) + if (x >= "0"ord && x <= "9"ord): true. + else: false. + . + +nums = (s): + res = () + 0 to (s length, (b): + c = s(b) + if (is_num(c)): + res push(c). + .) + res. + +try = 1 +while (true): + r = rand string + digits = (r(0),r(1),r(2),r(3)) + "\nMy next four digits: " print + digits join(" ") say + digit_s = digits ins_sort string + + ("Your expression to create 24 (try ", try, "): ") print + entry = read slice(0,-1) + expr = entry eval + parse = nums(entry) + parse_s = parse clone ins_sort string + try++ + if (parse length != 4): + ("Wrong number of digits:", parse) say. + elsif (parse_s != digit_s): + ("Wrong digits:", parse) say. + elsif (expr == 24): + "You won!" say + entry print, " => 24" say + return(). + else: + (entry, " => ", expr string, " != 24") join("") say. +. diff --git a/Task/24-game/Sidef/24-game.sidef b/Task/24-game/Sidef/24-game.sidef new file mode 100644 index 0000000000..f1a3063ce9 --- /dev/null +++ b/Task/24-game/Sidef/24-game.sidef @@ -0,0 +1,36 @@ +const digits = (1..9 -> pick(4)); +const grammar = Regex.new( + '^ (?&exp) \z + (?(DEFINE) + (? ( (?&term) (?&op) (?&term) )+ ) + (? \( (?&exp) \) | [' + digits.join + ']) + (? [-+*/] ) + )', 'x' +); +  +say "Here are your digits: #{digits.join(' ')}"; +  +loop { + var input = Sys.scanln("Expression: "); +  + var expr = input; + expr -= /\s+/g; # remove all whitespace +  + input == 'q' && ( + say "Goodbye. Sorry you couldn't win."; + break; + ); +  + var given_digits = digits.map{.to_s}.sort.join; + var entry_digits = input.scan(/\d/).sort.join; +  + if ((given_digits != entry_digits) || (expr !~ grammar)) { + say "That's not valid"; + next; + } +  + given(var n = eval(input)) { + when (24) { say "You win!"; break } + default { say "Sorry, your expression is #{n}, not 24" } + } +} diff --git a/Task/24-game/Swift/24-game.swift b/Task/24-game/Swift/24-game.swift new file mode 100644 index 0000000000..15bd6016c2 --- /dev/null +++ b/Task/24-game/Swift/24-game.swift @@ -0,0 +1,74 @@ +import Darwin +import Foundation + +println("24 Game") +println("Generating 4 digits...") + +func randomDigits() -> Int[] { + var result = Int[](); + for var i = 0; i < 4; i++ { + result.append(Int(arc4random_uniform(9)+1)) + } + return result; +} + +// Choose 4 digits +let digits = randomDigits() + +print("Make 24 using these digits : ") + +for digit in digits { + print("\(digit) ") +} +println() + +// get input from operator +var input = NSString(data:NSFileHandle.fileHandleWithStandardInput().availableData, encoding:NSUTF8StringEncoding) + +var enteredDigits = Int[]() + +var enteredOperations = Character[]() + +let inputString = input as String + +// store input in the appropriate table +for character in inputString { + switch character { + case "1", "2", "3", "4", "5", "6", "7", "8", "9": + let digit = String(character) + enteredDigits.append(digit.toInt()!) + case "+", "-", "*", "/": + enteredOperations.append(character) + case "\n": + println() + default: + println("Invalid expression") + } +} + +// check value of expression provided by the operator +var value = Int() + +if enteredDigits.count == 4 && enteredOperations.count == 3 { + value = enteredDigits[0] + for (i, operation) in enumerate(enteredOperations) { + switch operation { + case "+": + value = value + enteredDigits[i+1] + case "-": + value = value - enteredDigits[i+1] + case "*": + value = value * enteredDigits[i+1] + case "/": + value = value / enteredDigits[i+1] + default: + println("This message should never happen!") + } + } +} + +if value != 24 { + println("The value of the provided expression is \(value) instead of 24!") +} else { + println("Congratulations, you found a solution!") +} diff --git a/Task/9-billion-names-of-God-the-integer/FreeBASIC/9-billion-names-of-god-the-integer.freebasic b/Task/9-billion-names-of-God-the-integer/FreeBASIC/9-billion-names-of-god-the-integer.freebasic new file mode 100644 index 0000000000..4c576295e0 --- /dev/null +++ b/Task/9-billion-names-of-God-the-integer/FreeBASIC/9-billion-names-of-god-the-integer.freebasic @@ -0,0 +1,89 @@ +' version 03-11-2016 +' compile with: fbc -s console + +#Include Once "gmp.bi" + +Sub partitions(max As ULong, p() As MpZ_ptr) + ' based on Numericana code example + Dim As ULong a, b, i, k + Dim As Long j + + Dim As Mpz_ptr s = Allocate(Len(__mpz_struct)) : Mpz_init(s) + + Mpz_set_ui(p(0), 1) + + For i = 1 To max + j = 1 : k = 1 : b = 2 : a = 5 + While j > 0 + ' j = i - (3*k*k+k) \ 2 + j = i - b : b = b + a : a = a + 3 + If j >= 0 Then + If k And 1 Then Mpz_add(s, s, p(j)) Else Mpz_sub(s, s, p(j)) + End If + j = j + k + If j >= 0 Then + If k And 1 Then Mpz_add(s, s, p(j)) Else Mpz_sub(s, s, p(j)) + End If + k = k +1 + Wend + Mpz_swap(p(i), s) + Next + + Mpz_clear(s) + +End Sub + +' ------=< MAIN >=------ + +Dim As ULong n, k, max = 25 ' with max > 479 the numbers become +Dim As ULongInt p(max, max) ' to big for a 64bit unsigned integer + +p(1, 1) = 1 ' fill the first 3 rows +p(2, 1) = 1 : p(2, 2) = 1 +p(3, 1) = 1 : p(3, 2) = 1 : p(3, 3) = 1 + +For n = 4 To max ' fill the rest + For k = 1 To n + If k * 2 > n Then + p(n,k)= p(n-1,k-1) + Else + p(n,k) = p(n-1,k-1) + p(n-k, k) + End If + Next +Next + +For n = 1 To 25 ' print the triangle + Print Space((max - n) * 2); + For k = 1 To n + Print Using "####"; p(n, k); + Next + Print +Next +Print : print + + ' calculate the integer partition +max = 123456 ' 1234567 takes about ten minutes +Dim As ZString Ptr ans + +ReDim big_p(max) As Mpz_ptr +For n = 0 To max + big_p(n) = Allocate(Len(__mpz_struct)) : Mpz_init(big_p(n)) +Next + +partitions(max, big_p()) + +For n = 1 To Len(Str(max)) + k = Val(Left(Str(max), n)) + ans = Mpz_get_str (0, 10, big_p(k)) + Print Space(10 - n); "P("; Str(k); ") = "; *ans +Next + +For n = 0 To max + Mpz_clear(big_p(n)) +Next + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/9-billion-names-of-God-the-integer/Lasso/9-billion-names-of-god-the-integer.lasso b/Task/9-billion-names-of-God-the-integer/Lasso/9-billion-names-of-god-the-integer.lasso new file mode 100644 index 0000000000..eae54ce227 --- /dev/null +++ b/Task/9-billion-names-of-God-the-integer/Lasso/9-billion-names-of-god-the-integer.lasso @@ -0,0 +1,31 @@ +define cumu(n::integer) => { + loop(-from=$cache->size,-to=#n+1) => { + local(r = array(0), l = loop_count) + loop(loop_count) => { + protect => { #r->insert(#r->last + $cache->get(#l - loop_count)->get(math_min(loop_count+1, #l - loop_count))) } + } + #r->size > 1 ? $cache->insert(#r) + } + return $cache->get(#n) +} +define row(n::integer) => { + // cache gets reset & rebuilt for each row, slower but more accurate + var(cache = array(array(1))) + local(r = cumu(#n+1)) + local(o = array) + loop(#n) => { + protect => { #o->insert(#r->get(loop_count+1) - #r->get(loop_count)) } + } + return #o +} +'rows:\r' +loop(25) => {^ + loop_count + ': '+ row(loop_count)->join(' ') + '\r' +^} + +'sums:\r' +with x in array(23, 123, 1234) do => {^ + var(cache = array(array(1))) + cumu(#x+1)->last + '\r' +^} diff --git a/Task/9-billion-names-of-God-the-integer/Nim/9-billion-names-of-god-the-integer-1.nim b/Task/9-billion-names-of-God-the-integer/Nim/9-billion-names-of-god-the-integer-1.nim new file mode 100644 index 0000000000..34a1d0bf09 --- /dev/null +++ b/Task/9-billion-names-of-God-the-integer/Nim/9-billion-names-of-god-the-integer-1.nim @@ -0,0 +1,26 @@ +import bigints + +var cache = @[@[1.initBigInt]] + +proc cumu(n): seq[BigInt] = + for l in cache.len .. n: + var r = @[0.initBigInt] + for x in 1..l: + r.add r[r.high] + cache[l-x][min(x, l-x)] + cache.add r + result = cache[n] + +proc row(n): seq[BigInt] = + let r = cumu n + result = @[] + for i in 0 .. [Int] { + for l in cache.count...n { + var r = [0] + for x in 1...l { + r.append(r[r.count - 1] + cache[l - x][min(x, l-x)]) + } + cache.append(r) + } + return cache[n] +} + +func row(n:Int) -> [Int] { + let r = namesOfGod(n) + var returnArray = [Int]() + for i in 0...n - 1 { + returnArray.append(r[i + 1] - r[i]) + } + return returnArray +} + +println("rows:") +for x in 1...25 { + println("\(x): \(row(x))") +} + +println("\nsums: ") + +for x in [23, 123, 1234, 12345] { + cache = [[1]] + var array = namesOfGod(x) + var numInt = array[array.count - 1] + println("\(x): \(numInt)") +} diff --git a/Task/99-Bottles-of-Beer/8th/99-bottles-of-beer.8th b/Task/99-Bottles-of-Beer/8th/99-bottles-of-beer.8th new file mode 100644 index 0000000000..fa816e4a36 --- /dev/null +++ b/Task/99-Bottles-of-Beer/8th/99-bottles-of-beer.8th @@ -0,0 +1,20 @@ +\ 99 bottles of beer on the wall: +: allout "no more bottles" ; +: just-one "1 bottle" ; +: yeah! dup . " bottles" ; + +[ + ' allout , + ' just-one , + ' yeah! , +] var, bottles + +: .bottles dup 2 n:min bottles @ swap caseof ; +: .beer .bottles . " of beer" . ; +: .wall .beer " on the wall" . ; +: .take " Take one down and pass it around" . ; +: beers .wall ", " . .beer '; putc cr + n:1- 0 max .take ", " . + .wall '. putc cr drop ; + +' beers 1 99 loop- bye diff --git a/Task/99-Bottles-of-Beer/Apex/99-bottles-of-beer.apex b/Task/99-Bottles-of-Beer/Apex/99-bottles-of-beer.apex new file mode 100644 index 0000000000..af5ac72991 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Apex/99-bottles-of-beer.apex @@ -0,0 +1,7 @@ + for(Integer i = 99; i=0; i--){ + system.debug(i + ' bottles of beer on the wall'); + system.debug('\n'); + system.debug(i + ' bottles of beer on the wall'); + system.debug(i + ' bottles of beer'); + system.debug('take one down, pass it around'); + } diff --git a/Task/99-Bottles-of-Beer/Axe/99-bottles-of-beer.axe b/Task/99-Bottles-of-Beer/Axe/99-bottles-of-beer.axe new file mode 100644 index 0000000000..2ae079fdee --- /dev/null +++ b/Task/99-Bottles-of-Beer/Axe/99-bottles-of-beer.axe @@ -0,0 +1,10 @@ +99→B +While B + Disp B▶Dec," BOTTLES OF","BEER ON THE WALL" + Disp B▶Dec," BOTTLES OF","BEER",i,i + getKeyʳ + Disp "TAKE ONE DOWN",i,"PASS IT AROUND",i + B-- + Disp B▶Dec," BOTTLES OF","BEER ON THE WALL",i + getKeyʳ +End diff --git a/Task/99-Bottles-of-Beer/Battlestar/99-bottles-of-beer.battlestar b/Task/99-Bottles-of-Beer/Battlestar/99-bottles-of-beer.battlestar new file mode 100644 index 0000000000..031a606634 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Battlestar/99-bottles-of-beer.battlestar @@ -0,0 +1,139 @@ +const bottle = " bottle" +const plural = "s" +const ofbeer = " of beer" +const wall = " on the wall" +const sep = ", " +const takedown = "Take one down and pass it around, " +const u_no = "No" +const l_no = "no" +const more = " more bottles of beer" +const store = "Go to the store and buy some more, " +const dotnl = ".\n" +const nl = "\n" + +// Print two digits, use the value in a +fun printnum + b = a + loop + break (a < 10) + a /= 10 + // modulo is in the d register after idiv + b = d + a += 48 // ASCII value for '0' + print(chr(a)) + break + end + a = b + a += 48 // ASCII value for '0' + print(chr(a)) +end + +fun main + loop 99 + // Save loop counter for later, twice + c -> stack + c -> stack + + // Print the loop counter (passed in the a register) + a = c + printnum() + + // N, "bottles of beer on the wall, " + print(bottle) + print(plural) + print(ofbeer) + print(wall) + print(sep) + + // Retrieve and print the number + stack -> a + printnum() + + // N, "bottles of beer." + print(bottle) + print(plural) + print(ofbeer) + print(dotnl) + + // "Take one down and pass it around," + print(takedown) + + // N-1, "bottles of beer on the wall." + stack -> a + a-- + // Store N-1, used just a few lines down + a -> stack + printnum() + print(bottle) + // Retrieve N-1 + stack -> a + // Write an "s" if the count is not 1 + a != 1 + print(plural) + end + // Write the rest + print(ofbeer) + print(wall) + print(dotnl) + + // Blank line + print(nl) + + // Skip to the top of the loop while the counter is >= 2 + continue (c >= 2) + + // At the last two + + // "1 bottle of beer on the wall," + a = 1 + printnum() + print(bottle) + print(ofbeer) + print(wall) + print(sep) + + // "1 bottle of beer." + a = 1 + printnum() + print(bottle) + print(ofbeer) + print(dotnl) + + // "Take one down and pass it around," + print(takedown) + + // "no more bottles of beer on the wall." + print(l_no) + print(more) + print(wall) + print(dotnl) + + // Blank line + print(nl) + + // "No more bottles of beer on the wall," + print(u_no) + print(more) + print(wall) + print(sep) + + // "no more bottles of beer." + print(l_no) + print(more) + print(dotnl) + + // "Go to the store and buy some more," + print(store) + + // "99 bottles of beer on the wall." + a = 99 + printnum() + print(bottle) + print(plural) + print(ofbeer) + print(wall) + print(dotnl) + end +end + +// vim: set syntax=c ts=4 sw=4 et: diff --git a/Task/99-Bottles-of-Beer/Ceylon/99-bottles-of-beer.ceylon b/Task/99-Bottles-of-Beer/Ceylon/99-bottles-of-beer.ceylon new file mode 100644 index 0000000000..f0469ed974 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Ceylon/99-bottles-of-beer.ceylon @@ -0,0 +1,13 @@ +shared void ninetyNineBottles() { + + String bottles(Integer count) => + "``count == 0 then "No" else count`` + bottle``count == 1 then "" else "s"``".normalized; + + for(i in 99..1) { + print("``bottles(i)`` of beer on the wall + ``bottles(i)`` of beer! + Take one down, pass it around + ``bottles(i - 1)`` of beer on the wall!\n"); + } +} diff --git a/Task/99-Bottles-of-Beer/ECL/99-bottles-of-beer.ecl b/Task/99-Bottles-of-Beer/ECL/99-bottles-of-beer.ecl new file mode 100644 index 0000000000..f07e67f935 --- /dev/null +++ b/Task/99-Bottles-of-Beer/ECL/99-bottles-of-beer.ecl @@ -0,0 +1,22 @@ +Layout := RECORD + UNSIGNED1 RecID1; + UNSIGNED1 RecID2; + STRING30 txt; +END; +Beers := DATASET(99,TRANSFORM(Layout, + SELF.RecID1 := COUNTER,SELF.RecID2 := 0,SELF.txt := '')); + +Layout XF(Layout L,INTEGER C) := TRANSFORM + IsOneNext := L.RecID1-1 = 1; + IsOne := L.RecID1 = 1; + SELF.txt := CHOOSE(C, + (STRING)(L.RecID1-1) + ' bottle'+IF(IsOneNext,'','s')+' of beer on the wall', + 'Take one down, pass it around', + (STRING)(L.RecID1) + ' bottle'+IF(IsOne,'','s')+' of beer', + (STRING)(L.RecID1) + ' bottle'+IF(IsOne,'','s')+' of beer on the wall',''); + SELF.RecID2 := C; + SELF := L; +END; + +Rev := NORMALIZE(Beers,5,XF(LEFT,COUNTER)); +OUTPUT(SORT(Rev,-Recid1,-RecID2),{txt},ALL); diff --git a/Task/99-Bottles-of-Beer/FunL/99-bottles-of-beer.funl b/Task/99-Bottles-of-Beer/FunL/99-bottles-of-beer.funl new file mode 100644 index 0000000000..9f8e395ded --- /dev/null +++ b/Task/99-Bottles-of-Beer/FunL/99-bottles-of-beer.funl @@ -0,0 +1,30 @@ +val + numbers = {1:'one', 2:'two', 3:'three', 4:'four', 5:'five', 6:'six', 7:'seven', + 8:'eight', 9:'nine', 10:'ten', 11:'eleven', 12:'twelve'} + alt = {3:'thir', 5:'fif'} + +def + suffix( a, b ) = (if a.endsWith( 't' ) then a.substring( 0, a.length()-1 ) else a) + b + + number( n@(13 | 15) ) = suffix( alt(n%10), 'teen' ) + number( 20 ) = 'twenty' + number( n@(30 | 50) ) = suffix( alt(n\10), 'ty' ) + number( n ) + | n <= 12 = numbers(n) + | n <= 19 = suffix( numbers(n%10), 'teen' ) + | 10|n = suffix( numbers(n\10), 'ty' ) + | otherwise = number( n\10*10 ) + '-' + number( n%10 ) + + cap( s ) = s.substring( 0, 1 ).toUpperCase() + s.substring( 1, s.length() ) + + bottles( 0 ) = 'no more bottles' + bottles( 1 ) = 'one bottle' + bottles( n ) = number( n ) + ' bottles' + + verse( 0 ) = ('No more bottles of beer on the wall, no more bottles of beer.\n' + + 'Go to the store and buy some more, ninety-nine bottles of beer on the wall.') + verse( n ) = (cap( bottles(n) ) + ' of beer on the wall, ' + bottles( n ) + ' of beer.\n' + + 'Take one down and pass it around, ' + bottles( n-1 ) + + ' of beer on the wall.\n') + +for i <- 99..0 by -1 do println( verse(i) ) diff --git a/Task/99-Bottles-of-Beer/FutureBasic/99-bottles-of-beer.futurebasic b/Task/99-Bottles-of-Beer/FutureBasic/99-bottles-of-beer.futurebasic new file mode 100644 index 0000000000..5d93b2aa7a --- /dev/null +++ b/Task/99-Bottles-of-Beer/FutureBasic/99-bottles-of-beer.futurebasic @@ -0,0 +1,12 @@ +include "ConsoleWindow" + +dim as short i + +for i = 99 to 1 step -1 + print i; " bottles of beer on the wall," + print i; " bottles of beer." + print + print "Take one down, pass it around," + print i-1; " bottles of beer on the wall." + print +next diff --git a/Task/99-Bottles-of-Beer/Idris/99-bottles-of-beer.idris b/Task/99-Bottles-of-Beer/Idris/99-bottles-of-beer.idris new file mode 100644 index 0000000000..798184297b --- /dev/null +++ b/Task/99-Bottles-of-Beer/Idris/99-bottles-of-beer.idris @@ -0,0 +1,19 @@ +beerSong : Fin 100 -> String +beerSong x = verses x where + + bottlesOfBeer : Fin n -> String + bottlesOfBeer fZ = "No more bottles of beer" + bottlesOfBeer (fS fZ) = "1 bottle of beer" + bottlesOfBeer k = (show (finToInteger k)) ++ " bottles of beer" + + verse : Fin n -> String + verse fZ = "" + verse (fS n) = + (bottlesOfBeer (fS n)) ++ " on the wall,\n" ++ + (bottlesOfBeer (fS n)) ++ "\n" ++ + "Take one down, pass it around\n" ++ + (bottlesOfBeer n) ++ " on the wall\n" + + verses : Fin n -> String + verses fZ = "" + verses (fS n) = (verse (fS n)) ++ (verses n) diff --git a/Task/99-Bottles-of-Beer/Klong/99-bottles-of-beer.klong b/Task/99-Bottles-of-Beer/Klong/99-bottles-of-beer.klong new file mode 100644 index 0000000000..ccff832418 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Klong/99-bottles-of-beer.klong @@ -0,0 +1,19 @@ +bottles::{:[x=1;"bottle";"bottles"]} +itone::{:[x=1;"it";"one"]} +numno::{:[x=0;"no";x]} +drink::{.d(numno(x)); + .d(" "); + .d(bottles(x)); + .p(" of beer on the wall"); + .d(numno(x)); + .d(" "); + .d(bottles(x)); + .p(" of beer"); + .d("take "); + .d(itone(x)); + .p(" down and pass it round"); + .d(numno(x-1)); + .d(" "); + .d(bottles(x-1)); + .p(" of beer on the wall");.p("")} +drink'1+|!99 diff --git a/Task/99-Bottles-of-Beer/Lambda-Prolog/99-bottles-of-beer-1.lambda b/Task/99-Bottles-of-Beer/Lambda-Prolog/99-bottles-of-beer-1.lambda new file mode 100644 index 0000000000..31ece99213 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Lambda-Prolog/99-bottles-of-beer-1.lambda @@ -0,0 +1,5 @@ +sig bottles. + +type println string -> o. +type round int -> o. +type bottles_song int -> o. diff --git a/Task/99-Bottles-of-Beer/Lambda-Prolog/99-bottles-of-beer-2.lambda b/Task/99-Bottles-of-Beer/Lambda-Prolog/99-bottles-of-beer-2.lambda new file mode 100644 index 0000000000..defafc44b3 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Lambda-Prolog/99-bottles-of-beer-2.lambda @@ -0,0 +1,22 @@ +module bottles. + +println Str :- print Str, print "\n". + +round N :- M is N - 1, + NStr is int_to_string N, + MStr is int_to_string M, + BOB = " bottles of beer ", + Line1 is NStr ^ BOB ^ "on the wall", + Line2 is NStr ^ BOB, + Line3 is "take one down, pass it around", + Line4 is MStr ^ BOB ^ "on the wall", + println Line1, + println Line2, + println Line3, + println Line4. + +bottles_song 0. +bottles_song N :- N > 0, + round N, + M is N - 1, + bottles_song M. diff --git a/Task/99-Bottles-of-Beer/Lambda-Prolog/99-bottles-of-beer-3.lambda b/Task/99-Bottles-of-Beer/Lambda-Prolog/99-bottles-of-beer-3.lambda new file mode 100644 index 0000000000..b764f312ab --- /dev/null +++ b/Task/99-Bottles-of-Beer/Lambda-Prolog/99-bottles-of-beer-3.lambda @@ -0,0 +1 @@ +[bottles] ?- bottles_song 99. diff --git a/Task/99-Bottles-of-Beer/Lasso/99-bottles-of-beer-1.lasso b/Task/99-Bottles-of-Beer/Lasso/99-bottles-of-beer-1.lasso new file mode 100644 index 0000000000..3d87bd2f00 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Lasso/99-bottles-of-beer-1.lasso @@ -0,0 +1,15 @@ +local( + beer = 99, + song = '' +) +while(#beer > 0) => { + #song->append( + #beer + ' bottles of beer on the wall\n' + + #beer + ' bottles of beer\n' + + 'Take one down, pass it around\n' + + (#beer-1) + ' bottles of beer on the wall\n\n' + ) + #beer-- +} + +#song diff --git a/Task/99-Bottles-of-Beer/Lasso/99-bottles-of-beer-2.lasso b/Task/99-Bottles-of-Beer/Lasso/99-bottles-of-beer-2.lasso new file mode 100644 index 0000000000..dd95530a78 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Lasso/99-bottles-of-beer-2.lasso @@ -0,0 +1,6 @@ +(with beer in 99 to 1 by -1 select + #beer + ' bottles of beer on the wall' + + #beer + ' bottles of beer\n' + + 'Take one down, pass it around\n' + + --#beer + ' bottles of beer on the wall\n' +)->join('\n') diff --git a/Task/99-Bottles-of-Beer/Lasso/99-bottles-of-beer-3.lasso b/Task/99-Bottles-of-Beer/Lasso/99-bottles-of-beer-3.lasso new file mode 100644 index 0000000000..71cd10109a --- /dev/null +++ b/Task/99-Bottles-of-Beer/Lasso/99-bottles-of-beer-3.lasso @@ -0,0 +1,11 @@ +// this example adds an "s" to bottle until there is only 1 bottle left on the wall + +local(s = 's') +with n in 99 to 1 by -1 do {^ + #n + ' bottle' + #s + ' of beer on the wall,
' + #n + ' bottle' + #s + ' of beer,
' + #n = #n - 1 + #s = (#n != 1 ? 's' | '') + 'Take one down, pass it around,
' + #n + ' bottle' + #s + ' of beer on the wall.

' +^} diff --git a/Task/99-Bottles-of-Beer/LiveCode/99-bottles-of-beer.livecode b/Task/99-Bottles-of-Beer/LiveCode/99-bottles-of-beer.livecode new file mode 100644 index 0000000000..36aaba1f09 --- /dev/null +++ b/Task/99-Bottles-of-Beer/LiveCode/99-bottles-of-beer.livecode @@ -0,0 +1,10 @@ +function beerMe numberOfBottles +    put "XX bottles of beer on the wall" into verseA +    put "Take one down, pass it around" into verseB +    repeat with N = numberOfBottles down to 1 +       put replaceText(verseA,"XX",N) & cr & word 1 to 4 of \ + replaceText(verseA,"XX",N) & cr & verseB & cr & replaceText(verseA,"XX",N-1) \ + & cr & cr after theSong +    end repeat +    return theSong +end beerMe diff --git a/Task/99-Bottles-of-Beer/Malbolge/99-bottles-of-beer-1.malbolge b/Task/99-Bottles-of-Beer/Malbolge/99-bottles-of-beer-1.malbolge new file mode 100644 index 0000000000..4c873c8b60 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Malbolge/99-bottles-of-beer-1.malbolge @@ -0,0 +1,246 @@ +b'`;$9!=IlXFiVwwvtPO0)pon%IHGFDV|dd@Q=+^:('&Y$#m!1S|.QOO=v('98$65aCB}0i.Tw+QPU'7qK#I20jiDVgG +S(bt<%@#!7~|4{y1xv.us+rp(om%lj"ig}fd"cx``uz]rwvYnslkTonPfOjiKgJeG]\EC_X]@[Z7~;:9y16w43s10)p-,l*#(i&%e#d!~``{tyxZpuXsrTTongOkdMhg`Hd]ba`_^W@[ZYXW9UNSRQPOHMLK +J-++FE''=<;:387xw43s10/(-&m*)('&}${d!~}|^zyxwvutmVqpiRQlkjiKafedc\E`_^@\[ZYX;V9NMRQ42NG +LK.IH*F?DCBA$#>7~;{{8xx5uu2rr/oo,ll)ii&f|e"!aw`{z\r[vXnmVTpongPkNihgJ_dcFa`B^]\UZ=RWV8TSLQ4O +N0LE.IHA)E>'BA:?!7~5|38y6/v321q).-&m*)i'&%|{d!~}_{zs\wvutsUqTonPlOjiKgJedFbE`_A]@[Z7~;:987w5v32r0)p-,+k)('~g$#"b~w|uz]xwvutsrqTinQlOjLhgfeH]bE`CB]\>ZSXWVUTS +RQPON1LE.I,+*((&&$$""~~||zzxxv4u210/(-n+l)(i&g$ddy~}`u^]\ZvutVlUjSQQOOdMKgfeG]F[DBB@@>><<:VU +T6L5JO200EJ-HG*E>'B%$9>=<|4{2y05v321r).o,mlj(igg|#d!~}`uz]x[ZotWUUjoRmlkNibKJIGGEEZ_B]\?Z=XW +PU876442NM/KD-B+))''%%##!!}}{{yyw5v32s0q.-&+l)j'hff{"caav{^yxwZutslUpSnQOOdiLgfHHcba`Y^A\?Z= +;;PU8SRQ4ONMLEJ-,+))''%%##!=<;{3z1xvvttrrppnnll#j!&g$#d!b}|{zyr[vYtsrTjShQfkNihgJedcba`Y^A\? +Z=;WV9TSRQPOHM0K.-++)ED&B;$9"~<;:z2y0wuussqqoom+ljj!&%$dzcx}`{zy\wvutsrqjSnQPNNLhgIedG\EZCA] +\[=SY<;P9775533H1/KJ,HA*?(&&$$">=<|4{2ywwu321q)p'nl*k('gg${"c~a`^z]xwvYtmrUpSRPlOMMbK`IGGEE +Z_^]?U>S<::8866442200.JIH*@)>C&A@?"=<5|{8y65vtt10/(-n+lk"'&%e{dyb``^^\\ZvutVlUjSQmlkMcLaJHHF +bECCX]\[=S>>YXWP9T76K42200.JI+G@)>'%A@?!7~5|zzx654t,s*qo-n+*jj!h%fec!b}|{^s\[vYWWlqTonQlO +jchKfIHFFDDB^]\>T=R;P9NS6QPO2MLE.-,*FED&<%:#!!}}{{yyw543s+r)pnnl*kii~%f#"caa|{zsx[ZutVrkTinQ +lkNiLgfe^cFEDYBW\[=YR;P977553O200EJIH*@)>C&$$9>!<;|9z7654-tsrppnnll#('&f|ezca}|{]s\qZXtsrTjS +hQOOMihgI_H]FDDB^A\[><=<5:{zy0wuussqqoomm$ki'hff{"c~}`{t]\wvuWmVk +pSnmPNNcLKfIGG\aD_^A\?T=<;99775QPO1G0E.,HG)E>'<%#?"~~5:98x0w.ussq/pnn%*k('hff#z!ba|{z\r[puXs +rUpSnglONihgI_H]FDDYBW\[Z=}5|3zxxv4u21r/p-,+*#(i&g$# +c!~av_t][[YutsUkTiRPPNNLLJJHHFFDDB^A\[Z=XWVUTM6Q43HM0..CH+FE''BA@?>=6;|9z765u-t+0q.-,m*)('&% +|#dcb``uzy[wpYnWUUSonmOeNcLJJHHFFDDBB@\?ZY=}5|3zxxvvttrrppn,m*)ii +&%$#"!~}v{^y\wvuWmVkpSnmlOjihgfedc\aD_BAV[ZC&%$""7~|:9y70w.us10/o' +n%ljjhhffddb~a|{^\\wvutmVUTRnQlkNiLgfed]FE`_A]V?TY=<;:927x5vuss +qqo-,+k#j!hffddbb``^^s\qZXXVVTpSQQfkNihg`IHcbaCYBW\?==RW:UT755J321FK.IH+F)>'B%$9"~~||zzxxvvt +210p(o&mkki'&%e{dyb``^z]xwvYtmrUTSQmlkMcLaJHdcbDZCXA?[><T=R;99775Q4ON00KJIBG*E('%A$?>=~;:927 +xwvttr0/.n,m$)('g}f{"c~}`{^yxwvoXsVUSShQOkjLhaJ_HFba`BXAV?=YX:VO8M644220L/JI++FEDCB;@#>!<;:z +2y05v321r/.-,+$)j'hgeeccaa__]][wZXXmVkTiRPPNjMhgfIdcba`_XA@?==;;9977L5J31MLK-C,A*((&BA@"8!6} +{{y765u-t+rppn,m*)j'h%$#"!~}v{^y\[YutsUkTiRPPNNLhgfH^G\ECCAA??==;;9UTS5K4IN1LKJC,G*)''%%#?>= +}5|3zxxvvttrrppnnl*k('gg|e"c~a__ty\wvuXmVUTinmlNdMbKIedFb[DYB@\?==RWVU7M6K42N1LK.,,G@E('&$@# +>=~;|927xw4uss*/.n,%l#(i&%f#d!~w`{^][[YYWWlUjonmOeNcLJJHHFFDDB^A\[==XWVOT7R542N1LKJ-HGF?D'&% +:?"=<}:3z7xwuussqqo-,+k#j!h}fddb~}_{t]r[YYWWUqpoQgPeNLLJJHHFFDDBB@@>Z=XWV9N7R54I2GLKJ,B+@)'' +%%#?>=}5|3zx654t,s*qoommkkiig%f#"bb}v{^y\wvuWmVkpSnmlOjchKJIGGEaD_^A\?ZYR;V986RQP2H1F/--++)) +''%%##!=~;:zz765.3t1rq(-,+k#j!&g$#"c~}|uz]x[ZXtsrTjShQOOMMKKIIGGEECCAA?[><=6}|9zxx/432r*q(o&mk)j'&g$e"!~}|{zsx[vYXVVTponPfOdMbKIIGG\ECCAA??=YXW9O8MR5PONG0K +.I,**?D'BA@9"=~}4{yywwuussqqoommkki'h%$ddyb}`_ty\ZZotsrTjShmPkjiLaJIHFba`BXAV?==;;9977553311 +//-IHG)?(=B%@?"=~;49z7x543s+r)pnnl*)(h~g|ec!b``uzyxZpYnWUqpoQgPeNLLJJHHFFD`C^]??ZYR;V986R5PO +N1LKD-,+))''%%##!=<;{3z1xvvttrrppn,mkk"'&f${dy~a|{^\\wvunsVUpSQQfkNihKfIdcb[`C^A\[ZZS7~;|{y76v4-t+rp.-,l$k"iggeecca}`{z\\wvunsVqTonPleNchKfedGba`Y^A@?==;W +VU7M6K42N1//DIHG)?(=&$$""~~||zzxxv4u21rpp-,+*#ji&geez!b}|_z]xwvunWrUpSQQfkjiKaJ_HFbE`_AA\[ZY +XQV9T764P3NML/JIHGF?D'&%##!=<;{3z1x/v-2s0/p-n+*)('&}f#d!b``uz][[pYnsrqSiRgPNNLLJfedF\EZCA]\[ +=S!<}:{yy05v321r/.-,+*)"'hg$e"!b``{zyxwvutmVqToRPlkNihgfedcb[DCBW +@>><<::8TSR4J3H1//--++))''%A@?!7~5:{87x5.u2s0/o-&m$)j'&ff{"c~a|_]]rwZutsVkpSnQPeNchgfH^G\ECC +AA??==;;997S6QPO2MF/J-,A*((&&$$""~~||zzxx/4u210q.-&+l)jig%$d"ybw|_zyx[vunsVUTRnmlNdMbKIIGGEa +`B^W@U><<::88664PON0F/DI,GF)D'BA@9"=~}4{yy0wuus10/o'n%ljjh&%$dzcxa__]][wvXtmVkTRRPPNjMhgIIdc +baZ_B]@[ZY;Q:OT7RQP3NMLKDI,+FED&<%:#!=<|:3z1xvvttrrppnnlljjh&g$#d!b}|{zyr[vYXVrqpRhQfOMMKKII +GGEECCAA??=Y'=~;:9876/4utsq/pnn%*)i'~g|ec!b}|_z]xwvutsrkToRQOkjiKa +J_HFFDDBB@\?==RWV8TM6K42NML.D-B+))'C&A@""=<;:9876/4u2s0/o-&m$)j'&%f#"!~}|{zsx[vuXsVqSShmlOdM +hKJ_HFFDDBB@\[ZT=RW:UT7R5J32M0KJ-++F?D'&A@">7~5:{87xvv32+rq.omm$)j'&g$e"!xa|_^\xwYunWlUSonm +OeNcLJJHHFFDDBB@@>Z=XW99TSRKP3N10.J-HGF)DCB;@#"!6}{{y765u-t+rppn,+*j"i~geeccaa__]][wZutWUUpo +nmfONihgI_H]bE`_B]@[ZYXQ:9T755JO200E.CHGF(>'!<}:9876/4utsq/.-m%l#jhhf$#c!xav_]][[YuXsrU +pSnmlkjchKJIGGEa`_AW@U><<::8TS5QJ3H1/KJI+A*?(&&$@#>=~||9876543,1rq.-m+$k"'h%$e"c~}|{zyxqvYXs +VTTinmlNdMbgJedGbE`_^]\[ZYR;:9775QPO1M0EJ-HG*E>'B%$9"~~||zzxxvvttrrppn,m*)ii~%f#d!b``uz]xwvY +nsVqTSQQOkjiKaJ_HFFDDBB@@>><<::886R5PON1LE.-H+))>'Y<;P977553311//--++)EDC%;$9"7~5:{876w432+rqpnn%lj('g%|ezcaa__]y +\wvYtWrqpohmPkNMKKIIGGEECCAA??==;W:88MR5PON1LKJIHA*)(=&$$">!<;|zz765432+0qpo&+*)i!h}fd"!~`v_ +t][[YutsUkTiRPPNNLLJJHdGbaD_B]\[ZYXQV9T76KP3NM//JIHGFED=&A$#8=~||3876v.u,1r/.-n+*)('&%|edcx} +|^zs\qZXXVrqSohQfkNihKf_HGF[`_^@V?TY<::OT7RQ4OH10K.IH+F)>'B%@#!=<}4{z765u-t+r).o,+l)j'~%fedb +~a__ty\wvYtWrkpSRQfkNLLafIdcFaD_^W@?Z=;;PU8SR533NMLEJ-,G*((=B%@?"=~;:927xw43s10q(-,+k#j!hffd +db~}_{t]r[YYWWUUSSQQOkNihKfIdcbaZCBA?[><><<:V9TSR5PONMLKD-,+@)>C&$$9>!<;|92yx543s+r)p'n%lj(i +&%f#zc~a`u^\\ZZXXVVTTRRPPNNLLafIdcbEZ_B]@?=Y<::OT7RQP3HM0K.-BG*((=B%@?>!<5|{z1xvvt2sqq(-,+k# +j!hffddbb``^^\\ZvuWslUjoRmlOMMhg`eHGbECCX]@[Z=X;VUNS6Q4O200EJ-++@E(CBA$?>=6}:{8yww.3t10pp-,+ +*#(i&g$eccx}`{zy\wvutmrUpSnQOOdiLJJ_dGba`C^]\[ZSC&A$?"~~5:{876w43210/(- +n+l)jhh}$eccx}`{zy\wvutsrqjSnQlOMMbgJedFFa`_^]\[ZSX;V9T755JO2MLK.IHGFEDCB;@#"!6}{{y765u3t+0q +.-n+$k(i&geez!b``uz]xwvYnWrUpSQQfkNihJJe^cFaD_B@@UZ=XWV9TMR5P3200..,,**((&&$$""~<;:z2y0w.3t1 +0/p-,%l)jiggeecca}|{]s\qZXXVVTponPfOdMKgfeG]F[DBB@@>><<:V9TS55PONGL/J-H+))>C&A@?"=<;49zy6w43 +tr*qp-n+*kii~g$e"ca}|_t]x[vuWslUjoRmlNNibgJeHcFDDY^A\[Z=XQV9T76K4INML.D-B+))''%%##!!}}{9z765 +v32+rqp'nllj('&f|ezca}|{]s\qZXtsrTjShmPkjMKKfed]bEDCA]@[Z=X;VUTMR5P320LKJ,B+@)''%%##!!}}{{yy +wwu321q)p',m*)(i&%$#zc~a|{]yr[pYWsVqpohQlOjMKK`I^cbD`YBW\?ZYX;PU8S653311//--+GFE'=&;$""~~|:9 +y70w.ussqqo-n+*)j!&g$e"!~`v{zyx[voXWrUpoRmPkdMhKJHdGEEZ_^]?U>S<:VUT6L5J311//--++))''%A$?>~~; +:38y6wvt2s0/.o,+$)j'hgeeccaa_{zy[qZoXmVTTRRPPeNLLJJHdGba`C^]\U>=X;VU86L5P32GLKJ,B+@)''%%##!= +~||3876v.u,sqqo-,+k#j!&g$#ccx}`{^y\ZZotWrqpShmPkNMKK`edFb[DYB@@>><<::88664PON0F/D-BG*EDC&A:# +"!}}{{yyw543s+r)p'n%*k('h%f#"y~a|_^\\ZZXXmrqpRhQfOMiLJJ_dcEaZCXA?[ZY;Q:O8664PO1MF/DI,GFE(CBA +:#"=~||38y65v3,srq(-n+*k(i~%f#dcaav_t][wvuWmVkTRRPPNNLLJJHHFFD`CAAV[>YXW:UN7R542N1//D-BG*((= +B%@?>!<;49z7x5vtt+r).-,l$k"'h%$#d!~w|_z]\ZZoXVrqSohQfOMMKgfeG]F[DBB@@>ZYX:P9N75QPO1G0E.,,**( +(&B%@?!!<;:3z7xwu3t10/p-,+$kj'h%$ecc~}|{ty\wZutVrkTinQlkMMhgfed]FaD_B@@UZ=XWV9TSRQPI21LKJ,B+ +@)''%%##!!}}{{yyw5v32sqq.-,+*)"'hg$#"bxav{^yx[vYtsrqpohmPONchKII^cFa`C^W@?Z=;;PU8SR5PI2M0/D- +++)EDC%;$9"~~||z876v.u,sqqoommk)j'&ff{d!ba_{^yxwZoXWVkTinmlNdMbgJedGbE`Y^A@?=YXW9O8M6442NM/K +D-B+))''%A$?>!<}:38y6wv-21q/(o&mk)(h&}f{dbb``^^\\ZZXXVVTpSnmOOjihafIdGFD`C^]\?ZYXQV9T7R533HM +LK-C,AF)DCB%@?>=6}|{2ywwuuss*q(om+*)i!h}fddbb``^^\\ZvYtsVTTonmlkdiLKJHdGbaD_B]\[ZYRW:U87L5J3 +H1/KJI+A*?D'BA@9"!<}{{2765u-t+0q.-n+l#jih}f{dy~a|{^y\qZuXWlUjonmOeNcLJfIdcbE`Y^A\?><<::88664 +PON0F/D-++))'CB$@9"7~||zzx6w432s0).onmk)(h&}f{db~}|^t]r[YYWWUUSSQQOOMMKgJHH]bE`_B]@[ZS!<;:38y6w432r*/.-,m*)('~gf#d!~a|_zyxwpYXWUqpoQgPeNLLJJHHFFDDBB@@UZ=XW:U +8SRQPOHM0/.,HG)E>'<%#?"~~5:98x0w.ussq/p-,m*k('&%${"c~a`u^\\qZotWrqSSnmlkjibKfIdcbDZCX]@[ZYT= +RW:UT7R5JO21L/JI,G*E>'&A$?>!<}:3z7xwu321q)p'nlljjhhffddbb``^zyxZpYnsVqpRRmlejMhKfIGG\aD_^]@[ +ZSX;:977553311//--++)E(&&;@?>~6}49z76w4u210)po,mkk"'h%$ecc~}|{ty\[vuWslUjoRmlOjMhgfe^cFaDCXA +?[><YXWVOT7R542200..,HGF(>'<%:#8!}}{987w/v-2sqq(-n+*)j'&%$#zcb}`{z]x[vutsrqjoRQlOjiLgJe +dcba`Y^A@?=YXW9O8M6K4I20L/--BGFE'=&;@#>=~;|9876543,s0qpnnlljjhhffddbb`|_]]rwZutVVqponmlkjchK +fIdcbDZCX]@[ZY'<%:#!!}}{{2ywwuussq/pnn%*k('&}f#d!b``uz]xwvoXsVUjonPlkNc +LafedF\EZCAA??==;;997SRQ3I2G0..,H+FED'<%$#!!};:9y1x/vttrrppnnlljjh&g$#dbb}v{^]\ZvYtsVqTohmPO +NchgIe^G\EC_^]?U>SX;VU8S6QPI210..,,*FED&<%:#!!}}{{yywwu3t10qoo,+*#(ihge#d!~a|_zyxqvYtWVTTinm +OkdMbKIedFbaDY^]\>T=R;997SR4PI2G0..,HG)E>'~~;:981x5vus1r/.-n+*)(!hg$e"!b``{zyxwpuXsVqTR +nmPkjihg`eHcFa`B^W@UZ=XW99TSRQPOH1L/J-++@E(CBA$?>=<;:3zy654t,s*/p-,m*#jih}$#"b~av{^yx[voXWVT +TRRPPNNLhgfH^G\ECCA]\[=S!~;|98y6w4-ts0q.-n+l)"i&gfd"!~`v_t]r[pYWs +VqpoRmlejMLKIIGGEECCAA??==;W:88MRQP2H1FK.IH+F)DCB;$?"!6;|zz16w43ss0/.-&+l)j'hff{"c~}|_zyxwpu +XWVTpSQQfOdMbgfeG]F[DBB@@>><<::88664P311FKJI+A*?D'BA$?"=<;:92yx54t2+r).o,+l)"i&gfd"!~`|_ty\w +vuXmrUTShQOOMMKKIIGGEECCAA?[ZY;Q:OT7RQ4O2MF/.-B+@EDC%;$9>!<;|9z76/4uts*qoommkki'&f${dyb`|{]y +r[pYWsVqpSnQlkdiLKJ_dcbDZCXA??==;;99775QPO1G0E.,,*F)''=<;49zyxvvttrrp.-,l$k"iggeeccaa +__]][wvuWmVkpSnmPkNihgfe^GbEDYBW\[ZZ=XW:U8SRQPOHM0/.,,**((&&$@?>~6}4{yyw5vtt+0/.n&m +$kiig%$#cybw|_]]rwZutWrUponmlkdMhgJeHcEEZ_^AV?Z=XW9UN7LQ422GL/JIHA*E('%%##!!}}{987w/v-trrppn +nlljjh&g$#ccx}`{^yxZvoXmrUponQfkNMLaJHHFba`BXAV?==;WVU7M6K4220L/--BGFE'=&;@#>=~;|92y6wvttrrp +.-,l*k"'h%$#d!~w|_^yxZvoXmrUSShmPkjMhKfed]FaD_^]?U>S<::8866442200..,H+FE''BA@?8=~;|{y7x543t1 +0/.',m*kjh&geez!b}|{t]\wZXXmrqpRhQfOdMKgfeG]F[DBB@\[Z=<;:3 +z7x5vtt+0q.-,m*)('&%|e"!b}`{]]rwvYnWVUSSQQOOMihJf_H]bE`_B]V?Z='%%##!= +<|:3z1xvvttr0q.-mm*)(!h%f#"!aw`uz]xwvYtsrkTSRPPNNLhgfH^G\ECCAA??==;;997S6QP311LKJIBG*)DCB$:# +8=~;:{8y6543,1rqp'nl*)i'~g|ec!~}_u^s\ZZXXVVTTRRPPNNLhKfeHcFa`_^]V?>YYXW9O8M6442200.JIH*@) +>'%A$?>!}}:98705vutr0q.-n+l)('&}$e"cbw`^zyxZpYnWUUSonmOeNcLJJHdcEaZCXA??==;W:UT66QPONMF/J-HG +F(>'=~;:9870w4ut+0/o-&m$kiiggeeccaa__]yxwYoXmrUponQlkjihg`eHcFECCX]@>>SX;VUT7RQPONMFK.I +,+@E(&&;@?>~6}49zxx/4u210)p-n+ljj!&g$#"yb}`_t][wvuWmVkTRRPPNNLLJJHHFFDDB^A\[Z=R;:97SRQ3I2G0. +.,,**((&&;$">=};4{2yw5v32s0q.',m*k('g%|ezcaa__]][[YYWWUUSSQmPNNchKfeGGbaZC^A\[Z'%%:?>=}5|3zx654t,s*qo-n+*k(i&%${"cb}|{]s\qZXXmrqSohQfkNihKfIdcb[`CBAV?=YXW9O8MR5PO +200KJIHA*)(=B%@?"=~;:981xwvt210p(o&+l)(i&}f#dcaa__]][[pYWWUqpRngPeNLLJfedF\EZCAA??==R;9U8SRQ +4IN10/--++)E(CB%##>7~}|3876v.u,sqqoommkkiig%$#cybw|_zy\wZunWVUSoRPPejiKg`I^GEECCAA??=YXW9O8M +64P3NM0..IHAF)('%A$?>!<}:927x5vussqqoom+*j(!h}fddb~}|^t]r[pYnWUqTonPPkjibKfIdcbDZCX]@[ZY7<}|{yywwu321q)p'nlljjhhf$#"bxav_]][wZXXmrqpRhQfOMMKgJedGbE`_^]\U>=X; +VU86L5P32GL/JIHA*E('<%:#8=~;:9z16wvus10p.-n%*)i'~g|ecca}`^^sxwYunWlUSoRmlOjMhaJIHFba`BXAV?== +;WV8TM6K4220LKJ,B+@)''%%##!!};|98yww43,1rq.omm$)j'&g$e"!x}`{^yxwYoXmVTTRRPlkjLbK`IGcbaCYBW@> +><<::88664P3NM//JIHA*E(C&$$9>!<;:{876/vutrrppn,m*)jhh%$#"y~a`_tyxwYoXmVTTRnmlNdMbKIIGGEECCA] +@[Z=X;VUTSLQ4O21//-IHG)?(=&$@?>~6}4{yywwuussqqo-n+*jj'&%$#zc~a`^z]xwvYtsrqpiRmPkjiKaJ_HFF[DY +B@\[=YR;PU8SRQJ321/K.,,AFED&<%:#!!}}{{yywwuussq/p-,mkk"'hgfd"c~}`{^sx[ZYWsrqSiRgPNNLLJJHHFFD +`_^@V?T=;;9U8SR5P3NMLKJC,+*((&&$$""~~5:9y70w.3t10q.o,+*)('~%fe"caav_ty\ZZotWrqToRmlkjihafIdG +F[DBB@@U>!<;:{8765432+rqpnnl*)(h~g|eccaa__]][[YutsUkTinQlkNibKJe +HFF[`C^]@[T=X;:88M64PON0F/D-++))''%%##!!};|98xx/4u2s0qoo&+l)('h}$edcx}|^zy\qvYtsVqTohQlOjMKK +`eHcbDD_^W\?Z=X;99NS6QPO2MLEJ-,G*((=BA#?8!6;|98y6w432+r/p-nll#(i&%ee"!~}v{^y\wZXXmrUponQlkji +bgJIdGbaD_B]\[ZYR;VU8S6Q332MLKJIB+F)D'%%:?"=<||987654-2s0q.omm$)j'&%f#"!~}|uz]x[vYWWlqpoQgPe +NLLJJHHFFDDBB@@>>=};4{2ywwuussqqoommk)('g}f{"c~}`{^s\wZYWsrTpiRg +lOjiKKf_dGbE`CAAV[>YXW:UNS65P311FKJ,HA*?D'BA$?"=<5|9z7xvv-2s0/oo,+*#(i&g$eccx}`{zy\wvunsVUpS +QQfkjiKaJ_dGbaD_B]\[ZSY<<<::8866442200.JIH*@)>C&A@?"=<;:3z7xwuussqqoommkk"iggeec!b``uzy +xZpYnsVqpoRmlkjibgJIH]FDDY^]\>T=R;9977553311//--++)EDC%;$9>!<;|9z765432+rq.o,+l)j'&%$#"!x}`_ +^s\ZZXXVVkTRRPlkMibK`IGGEECCAA??=Y<::OT7RQ4O2MLKJIHGF?(CB%@#>~~5:9z1x5vussqqoommk)('g}f{dbb` +`^^\\ZvYWWlqTonmfONiLgfIdG\aDC^A\[>Y7<}|{yywwuussqqoom+ljj!h}$e +"!b}`{zyxwpYtWrUSShmPNNchKfedGba`_^]V[>=<:VUT6L5J311//-IHG)?(=&$$""~~||z8yww.321q)p',m*)j'h% +$#"!~}v_z]x[YYnsVTTinQlkjMhgfedcbaZ_BA@U>S'%%:?>=}5|3zxxv4uss*/.n,%l#jh +hffddbb``^^\x[YYnsVqpoRgPONLLJfedF\EZCAA?[ZC&%@#!!6;|98y6w4-2sr/.-m%l# +jhhffddbb``^^\\ZZXXmrUSShmlkMcLafIdcFaD_^W@?><<::88664422G0..,,*F)''!}}49z76w4-ts0q +oo&+l)(i&g|#d!ba__]][[YYWWUUSSQQOkNLLafedF\EZ_B]\[>YR;:U8SR5P3NMFK.I,+@)''%%:?>=}5|3zxxvvttr +rppnnllj('&f|ez!b}|{^yxwpYtWVkTinQlkjcLKfIGG\aDBBW\?ZY'%%##!!}}{{yywwu3 +21q)p',m*)(i&}fe"caav{^\\qvYtsVqTonglOjMLJJHHFFDDB^]?[T=R;997755331MLK-C,A*(D'BA@#>=<5|{8yww +.3trr).o,+l)j'&%${"cba__]yxwYoXmVTponPfOdMKKIIGGEECCA]@[Z=;;VUTSRQJO210.J-HG*E(CBA@?>7<}:{zx +xv43s1*q(om+*)i!h}fddbb``^^\\ZZXXVrUponQlkjihgf_HGFD`_A]V?T=;;9UTS5K4I200..,,**((&&$@#>=~;4{ +z7xvv-2s0/p-&m*kjhhffddbb``^^s\ZZXXVrUSShmlkMcLafIdcbEZ_BA\[Z><<:V9TS6Q4ONMF/J-H+))>C&$$9>! +<;:{8765.3tsr)pnn%*)(h~g|#dbbw|_zy\wZutsrqjSnQlOMMbgJHH]bE`_^A\[ZYXWPU87644220LKJ,B+@)''<%## +!!}}{{yy05v32s0)p-nmkki'&f${dyb`|{]yx[putVrkTiRPlkMibK`IGGEECCAA??=Y=XWV8N7L53ONM/K.CHGF( +>'!<}:98765.u2s0qoo&+ljj!&g$#"c~}|{zyxqvYtWrqpRhQfkNihg`IdGF[DBBW\[=YR;P977553311//--+G +FE'=&;@#>=<}4{8yxvvttrrppn,+*j"i~ge#"!aw`u^s\qZXtWrqpSnglONMKKIIGGEECCAA??==;WV8TM6KP311FK.I +H+F)DC<%$?"=<}:{876/4ut10/o'n%ljjhhffddbb``^^sx[vuXsVqpongPkNiLJJ_dGEEZ_B]\[>YXWVUNS65P311FK +.,,AF)DC&A$?>=<;:3z7x5vtt+0qoo&+l)('h%$#"!~}v{^y\[YYnWUUSonPleNcLJJHdGba`YB]@[ZY;Q:O866K4IN1 +LKJC,+F)''<YX; +V9TSL5P3N1//DI,**?D'BA@#>=<5:{8yxvv-trrp.-m+$k"igge#d!~``{zyxwpuXsVqpoQgPejMhgfIdcba`Y^A@[ZY +;Q:O86R533HML.JC,A*((&&$$""~~||zzx654t,s*/p-,m*k('&%$#zc~a`^^\\ZvuWslUjSQQOOMMKKIIGGEaDBBW\? +ZYX;VUTSRQPIN10/D-++))>C&A@#>!<;:98765.u2srp.-,l$k"iggeeccaa__]][[YutsUkTinQlkjcLgJI^cbD`YBW +@>Z=XWV9NS6Q4311F/--+GF(D=&;$">=<|4{2ywwuussqqo-n+*)j'~g$e"!a}v_t][[YutsUkTiRPPNNLLJJHH]FDDB +B@\?ZYX;VUNS6Q4311FKJI+A*?(&&$$""~~||zzxxvvt2sqq(-n+*)j'&%|ed!b}|_z]xwvunsVqTSQQOOMMKgJHH]ba +C_^AV[Z7~}:{87x5v3210/.',ml)('g}f{dbb``^^\\ZZXXVVTponPfOdiLgfIdG +ba`_^]\U>Y7<}:9z7x5uu,10q(onm$ki'&%e{dyb``^^\\ZvutVlUjSQQOOMMKKIe +HFF[`C^]@[T=X;VUT6L5J31M0..C,AFED&<%:?"~~5:{876w.utsqq(ommkkii~%$#cybw`^^\\ZZXXVVTpSnmPkNibg +JeHGEECCAA?[Z'=~;:3zy6wuu,1rpp',m*)j'h%$#z!b}`{zy[qZoXVrqpRhQfOMM +KKIIGGEECCAA??=Y><<::O866442N1//DIHG)?(=B%@?>!6;|9zyww.3trr).-,l$k"ig%$#cybw`^^\\ZZXXVVTTR +RPlOMMbgJedcFaZCBAV?TY!<;:{87654-ts0qoo&+ljj!&g$#d!b}|{zyxq +vYtWVkTRRPPNNcLafedF\EZCAA??==;;997755331M0KJIB+*EDC%;$9"~<}{{2y0543s+r).omm$)j'&g$ezc~a`^^\ +\ZZXtsrTjShQOOMMKKIIGGEaD_^]@[TY<;:8866442NM/KD-B+))''%%##!!};:z81x/4u21r/p-,%l)j'hff{"caav{ +^yxwZutslqToRQOOdihgI_H]FDDBB@@>><<::88664P311FK.IHG*EDCB;$#>!<;|9z76543,1rq.o,+lj"i&g$#"b~a +v{^yxwpYXWUqpoQgPeNLLJJHHFFDDBB@@>>~<5|3zxxvvttrrp.-,l$k"'h%$e"c +~w|_^][[putsUkTiRPlkjLbK`IGcbD`YBW@>><<::8866442N1//DI,GF)D'BA:#"!}}{{yy0wu32r0)p'nlljjhhffd +"!~`v_ty\wvYtWrqpinQPkjiKaJ_HFbECCXAV[ZY;Q:OT755JO2ML/J-HGFE>'&%##!!}}{{yyww.ussqqo-nll#('&f +|ez!b}|_z]xwvutmrUTSQQOkjLhaJ_HFbaC_^AV[Z!<}:98765.ut10p.'n%*kii +~g|#d!~a|_zyxwvutmrUpoRmPkMMbgfI^GFEC_^]?U>S<::8866442200..,H+FE(C<%@#"7~5:98x0w.us10/o'n%lj +jh&%e#zcxa__]][[YYWWUqpoQgPejMhgfI^GFEC_B@@UZ=XW:U8SLQ4O21F/--BG*((=BA@"8!6;|987x54-ts0qoo&+ +ljj!&g$#d!b}|{ty\wZYWWUUSSQQOOMMKKIIGcbD`YBW\?==RW:UTS6QPONG0/J-HG*E(CBA@?8=~;|987w5v-2s0/.' +nmljj!&%$dzcxa_{zy[qZoXVrqSohQfOMMKKIIGGEECCA]\[=S~6}4{yyw543s+r) +pnnlljjhhffd"c~}|_zsx[ZuXVVkpSQQfOdMbgJedGbE`_XA\?Z=;;PU866KP3NML/JIHAF)D'&$$">=<|4{2ywwu321 +q)p'nlljjhhff{"c~}|_zyxwpYtWVTTRRPPNNLLJJ_dcbDZCXA??==;;99775Q4ONM0KJIHG@E('BA@"8!6}{987w/v- +trrppnnlljjhhffddb~a|{^y\wvutsrkToRQOkNLLaJ_H]ba`BXAV?==;;9977553311//-I,GFE>'B%$""~~||z876v +.u,sqqoommkkiig%f#"!bw|_z]\ZZoXVrqpRhQfOMMKKIIGGEECCAA?[><=<| +4{2yw543s+r)pnnlljjhhf$e"!~w`_z][[puXVVkTinQlkNLLafIHcbD`YBW\?ZY7 +~;|{yywwuussqq(-,+k#j!hffddbb``^^\x[vutWrqjoRmPOMihgI_H]FDDB^]\>T=R;9977553311//--BG*EDC&A@? +8!~}4{2ywwuus10p.'n%ljjhhffddbb``^zyxZpYnsVqpSnQlkjibgJIdcbDZCXA?[><=6}|{yywwuussqqoo&mkkiig%fddy~}|^t]rwZutWrUponmlkdiLgJedFb[DYB@\[Z!}}49z76w4u21*/ponlljjh&geez!~}_u^s\ZvutVlUjSQQOOMMKKIeHcbECC^]\[TY<;:8T7RQ4O2MLK +JCH+FE(C&A##8=<}4{8y65u3,10/.'nml#jhhff{"!~`v_t][[YutsUkTiRPPNNLLJJHHFFD`C^]@[>S<;V977LQ4ON1 +//JCHGF)D&&;@#>=~;|92765vussq/.-m%l#jhhf$#"bxav_]y\ZZoXW2qjiR.-e=)KgJ%^]F!~C}W@[ZY;WPbTSqK#m +2k}ih,gTF)bPO%:"K7I54zW7gvv-sr*N.'JI[6FE&fUeAR>P+u:9[[pYW3lkS/.QyON*bKJ%dcF!m_^W@>-<;W:sN6%4 +]n[MjEWz,GFd'&s`#L]~6;|WW7UBeuc1qNpLJIk6FEgD1{zyQ=|*:([775WVrUSoAQ,Od*KJJ%HFF!!}}|?.Z=;QPtTq +%4o31kj/WIyfSRbC<`MLo\<|k{2V0fv-Qb=q.o&JH#G4~V$Bdy>P_;](x8vH5"3UpSh.fe=ib(J%7cF!`2B{i.Z+{]]88Y6XslT0B.zl,=<;(J%d]F!`}BW@yyY+d +tO8Mq5PINkjih-BTecQCa`qp>J~5XzW165eR,bO/L^m8[6j'D%UBdc>}`N^9x&vonF2qCSRmf>M*;J&8^]\n~}}@?[xY ++:Pt8S6o]3l~Y..,,*@RQ diff --git a/Task/99-Bottles-of-Beer/Malbolge/99-bottles-of-beer-2.malbolge b/Task/99-Bottles-of-Beer/Malbolge/99-bottles-of-beer-2.malbolge new file mode 100644 index 0000000000..f71ec269f2 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Malbolge/99-bottles-of-beer-2.malbolge @@ -0,0 +1,98 @@ +DCBA@?>!}}{{yywwuussqqL-,+*)('&%$#c!a>v{z99wv5Ws3DpoA-lON*hg`_dc#a~_^Az>Z<;;uUN7 +R5nO2~L/JzHe@ED'`N$?\7<;:W87C54us1N`.-nm*GF43gU#dRx=_N)sK&vo4Vrqji.z,Odvh'&e7Fb" +DlkAVhZS+Q9(7M_$o"110EhzgxFccbBNqLo\}}Y9z7gT4us1*/LKn87G(!&VeT/c?w|_M(xwY5XmVTjo +QP-O*LLt9rHGF4C}k@@y-YXut(87p5oON1Li.zf*)?DaO%@^]~~5X9zh05eu?sO/.oJlHGi'~ff0z??` +|{tL\[YYnWVkjihP,ONy,yweW:sNSRo#31GLi.CB+*?u&Or@]]=~} +{9zy6Setc1r/o-JII)jh~%B#dyb=|_tsxJZYnV2kSSRQ,k+x-fwQtU7qL4]2HMLEW,gGdcbta$$]\~~5Y9W70vu@csONLnm8*)iX&De#@cxav_]]\qpYnW +!~SinmPkMi(K&eHp"E~CA0\.Zf+:PsrqLK33N10.h,yGSEDPO$$98=mZ|XWD6S43cOqq_:,+lk(E&C|{ +A!bav_]y'[vHnFrTjS.Q,+N)KK9edc#!~~^0V>gwvd)98rqp3mN1L|Jz+G@?(a`r@9"!~5{{2hxwAdsr +q=*:\\JI64WlTSS{Q?e=iLJJe$cF!D_X@?> +y=vW9sTSRQ#ON0FKWgU+F)bC<$$?\\IYGWz7x5uut1*q;nKI*Z5'Wg${cb?}<;:y\qY6nmVUToQQ?k+i +KKs_$c5D~2}@/.>=+::9N&RQ#I!l}ihCHe*E''B_$9"!}HY{Eyx5.3ts0/_-KmlZY'EVCB/b~}`^zLKq +voGm!qjRQQy,NLbKJ&Hc5EmB|{{?g\-x;utb7Mp$4"l1}i{,yG))Da``:]"n<;{{EUx/ +4-QOrq;n,+*jjF3gBT"!Q,`*)sKJv5XFr~TRnQ,xjav^:yr[7onF31poh@lNdi;as%7cEE~BXA{UxY<:t8NSqQ +4n!1F..-,GFEDC&Nq?!7~Zk9WygTAt2baM.Kn8*kj'EV$eA.>``*)ha'I7c#!!l +^A@.-x!}HkFiyxTS3Qbr=XW:UNSp4PI[l}KiCffwEbPBA^]>=Z}GFW105vuQr0/;:Klkj('h}${z! +~w+u]9xq%YX43q0o/Q,xNM)KfHG#5ECC|j\hZSeu)8TSp53nNGYihgB+*Eu'B%#9>7aO;^y[[I5t"2qpi.PlkjiLJseGpEaZ}^j\y>YvQ)UN7qQ]nN0}KJIUGFE(C&_:?>~ +}5:9z7x/Rt21*q.^m+lZ"'EC$Adb~}`_u;sr8Yon4lkj0Qgf,dc)a`_%]\"ZY}WVz=S +RvV8Nr5Ko2HGkEi,Bf)?>=a$:^!76Z43Wx0T.-Q+Op(Lm%Ij"Fg}|Bzyx>_u;yrqp6Wml2pi/Pf,Mc)J +`_%F\[!YX|?UTx;QPtNMqQ3Im0FEiIH*@d'=<`#98\}54Xy1Uv.-Q+*N.n&Jk#"Fg}|{A!~`=^ts9wp6 +tm3Tjih.Oed*Ka'H^]#aCY}WVzZSRvPOs6Lp3Im0Fj-CBAe(>bB;:^!76Z432Vw/S3s+Op(Lm%Ij"F&f +|Bcy?}_ut:[q7Xnm3Tji/gfe+Lb(`_%cE[!BX|\>TxX:PtTS5Ko2HGkEiCBf@d'=a$:^>~[54Xy10Tu- +Qr*N.-m%Ij(!E}|B"!aw=^t:[qp6tVl2ji/Pf,dc)J`&G]#DZ~XW{UTSwW9Os6LKJnNM/EiCBf)?>b%; +:^!76Z{3Wx0Tu-Qr*No'K%$Hi!~De{z@aw=^ts9Zp6Wm3Tjih.Oed*hgI_%F\"CY}@VzZY;Qu8NMLp3I +m0FEiIBf)?>b<;_"8\<|43Wx0Tu-,+Op(Lm%I#G!~D|{z@aw=^t:xZpo5m3Tjih.lNd*hJ`&G]#DZY}] +?Uyvu;sr8Yo5Vlkj0Qg-N +d*Ka'H^]#DZY}@Vz=SRv9Os6LKoIHlFEi,BAe?>b<;_9]=65Yz21Uv.Rs+*N(L,l$#Gh~}Cdz@aw=^ts +9Zpon4rTj0Qg-kMc)a`&G]\"ZYX|?UySRvPOs6Lp3ImGFEi,Bf@?>b%;_"87[;{X21Uv.Rs+O)M'&%Ij +"!E}|B"bx>v<]s9wYo5sUkj0hg-Nd*hJ`_%F\[!BX|VzZ_u;\r8Yonm3Tji/Pfe+iKa`&d]#DZY}]?UTxXQuOs6LpJIm0FEiCBf)? +>bB;_?!7[|43Wx0T.-Qr*No'&J$#"Fg}|B"bxw=ut:r8po5ml2poQg-kMc)J`&d]#[Z~^]?zTSwQuOsS +R4o2HlLK-Cg*@dD&<`#98\<;{3Wx0/S3s+*N.nK%$H"!Ef|{Ayx>_u;\r8vXnm3kj0hg-Nd*hJ`&G]#D +ZY}]VUy=aA#9]~65Y32Vw/.R,+Op('K%$H"!Ef|Bcy?`v<]s9Z7on4Ukj0 +Qgf,jLb(I_%]\"CYX|VUySRv9ONMq4Jn1GFj-Cg*@?c&<;_"8\}54X21U/.R,P*)Mn&%IjGh~}Cdz@x> +_ut:[q7Xn4Ukj0hg-ed*Ka'eG]#DZY}@Vz=SRv9ONr5KJnHGkK-Cg*@?>b<;_"87[|43W10/St,+OpM- +m%Ij"F~D|{Abxw=^t:xZp6Wm3kj0Qgf,Mcb(I_^$E[Z~AW{>TSw:PtT6Lp3IHlLEiCg*@d'=aA#9]~65 +Y9y10T4-Qr*No'&J*j"Fg}|Bcyx>vu;sr8pon4rTj0Qgf,dc)a`&G]#[!BXW{UTx;QPt7Mq4JIHl/EiC +Bf)?>b%;:^87[|43Wx0/S-Qr*No'&Jk#G'g}|Bzy?`v<]sr8Yon4Ukj0nPfe+Lb(`_%F\"CY}]?UyY;v +POsMq4JnHGk.Dh+Ae(>=a$:9]76Z{32Vw/.R2r*No'Kl$H"!Ef|{Ayx>|^t:xZp6tVlk1oQ.fed*Ka'e +G]#DZY}@VUySw:PtT6LpJIHl/jDCg*@dD=a$:^!7[|43W10T.-Qr*)M'&Jk#"F~}C#cy?`v<]s9Zpo5m +lk1Rhg-ed*Ka`&G]\"CY}WVz=SRvV8NrRKo2HGk.DCg*@?cC%;_"8\}543Wx0Tu-,P*)M-m%$Hi!E}|B +cy?`=^zs9Zp6Wml2ji/gfe+Lba'_^$bD!YX|VUy=aA#9]~65Y9y1Uv.Rs+ +Op(Lm%$H"!E}|Bcy?`v<]sr8Yon4rqSi/Pf,jLb(feG$E[!_AW{UySRv9Os6LKoIm0Fj-CgG)d>=a$_9 +87[|4X8x0T4t,P0p(Lm%$H"!E}|Bcy?`v<]sr8Yon4rqSi/Pf,jLb(feG$E[!_AW{UySRv9Os6LKoIm0 +Fj-CgG)d>=a$_987[|4X8x0T4t,P0/oLm%$Hi!E}|{Ay?`v +Tx;Qu8NMqQ3nHlFEi,BAe?>bB$:^!7[|43W10Tu-,Pq)Mn&%I#"!E%e{z@xw={]sr8po5Vlk1Rhg-kMc +)J`_%cE[!YX|?Uy~[;:3W10Tu-Qr*No'Kl$Hi! +~DeB"bx>_u;\rq7onm3qSih.fe+iKa`&d]#DZY}@VUybB;_"87[|43W7w/ +.R,+Op('&J*j"Fg}Cdzy?wv=<;{3210T43s1*)M-,l$#"!Ef$#"yx>|ut:[qpo5slkj0nm +lkjLb(fedcba`_AWVUyYRQPt7MLKJnHGkKJ,BAeEDCBA@?!765Y9y10T.-,+*N.-,+*jG'&}|Bcy?}|{ +zyxZpo5Vrqj0hgfed*Kgfe^$E[ZYX|VUTSwQPtT6LKJnNM/EiIHGFE>=<`@?>=<;:98x0/.-Q10/o'&J +*j"!~De#zyxwvu;yxwvutsUk1onPfedc)a`&d]\[!B^WVz=SRvPONrRQJnHGkK-CBA@?cCBA#987[543 +2V65432r*N.-,+*jG'~}C#cyxwv<]srq7uWml2Sihgf,jihJ'H^]\"CY}W{UTSRQuUTS5KJn1MLKDhBA +@d'=aA@98\}54X210/S-,+O/('K%$H"!~D$#"b?`v=a$:98\<;{321U5.-Q10/o'&%$H(!~}|B"!~`|ut:xwvutsUqji/mlkjiha'edc +bDZ~^]?[TSRvV8NMqQPO1GkK-CBf@?cC<;_987[;:z2Vw/.R21*)Mn&%$H(h~}|Bc!~wv= +<|43W70/.R,+Op(L,l$#"!E%$dAyx>vu;yr8vun4rk1oh.Oe+ihgfeG]\"ZYXW{[=SRvVUTS5KoO1GFE +DhH*@?>=aA@?!=6543Wx0T4321q)(L,l*#"!E}|{z@~`|ut:xwvXnm3qjih.fe+iKg`&dcbD`YX|\>TS +RvV8NMq4POHGFEiIHG)?>=aA@?!765Y9210TuR210/.n&%$H"!~}C#z@~}vTx;WVUNMqQPO1GFEDhH*@?c&<;:98\65Y921U54321*)Mn&%I)(h~}|{z@a}vuts9wYo +n4rqSihg-kjLhg`&dcba`BXWVzZYXWPOs6LKJnNM/EDCg*@?cC<;_?!76Z:z870/S3s10/('K+k#"Fg% +|{A!~w=uts9wvXtmlkji/mlNdcba'e^]#a`BXW{>ZYXQuUNrRKoOHGFjJCBfFED&B;:9]=654321U543 +210/.-,+k#"!E}|{Ab~}|{t:xwvXn4lk1ongfe+Lha'edF\"C_XWVUyYRQPOsS5KJnHGkKJCBf)?>=aA +#?87[;{9810T43s1*)M-,+*)i!~D$dA!~}|^;yxwvutsrT1ohg-kMcb(`_^]#DZ~AWVUTxRQPtTS5KJI +HlFEi,BA@dD&B;_?>765Yz21U54t,+*N.-&%I)('&%$dz@~}|{z\9Zpon4lkj0nmOe+iKa'edcba`_^@ +VzZ=<;432V65432r0/.'&J*j"!~}|{z@~}|^;y[qpo5srqS0Qmf, +jL)gf_^]#D`_^]VUTxXQPtNMLpPIHGk.DhHGFE>bBA#9876Z:9810T43210/o'K+k#"!~D$#"!a}vut: +xwvo5srqpih.Oedcba'Hd]\"`BX|VUy=aA@"8\654X87w5.R21*N.-,+k# +"F&%e{zyx>|{zsr8vXtslkji/Pfe+ihgI_^$E[Z~^]?UTxX:VUNMq4oONMLKJIHG)?>=aA@"876Z{3W7 +w/.Rs1*)('&J*j"F&f|B"!~`|ut:xZvonm3qji/mlkMc)gf_%cE[!_^]\[=SwWV8NMqQ3IHGkK-CBA@d +DCBA@">=<54X8x0T4321q)M-,+k#"F&f$#zyx>|{]s9wvonmlk1ongfedcb(feG]\[Z~^]?UyY;QuONr +RQPO1GFEDh+A@dDCBA@98\65Y9y1Uv.-,+*N.-,%Ij(!~}C#zyxw=^zsrqp6nm3qpoQmlkd*Ka`&G]\[ +Z~^]\UyYX:VOs6qQJIm0k.DhHG)?cCBA#98\<|432V65.-Q+*No-&%I)('g}Cdzyxw=^zyxq7on4rTji +h.ledcba'_^$o diff --git a/Task/99-Bottles-of-Beer/MoonScript/99-bottles-of-beer.moon b/Task/99-Bottles-of-Beer/MoonScript/99-bottles-of-beer.moon new file mode 100644 index 0000000000..a2af06ba68 --- /dev/null +++ b/Task/99-Bottles-of-Beer/MoonScript/99-bottles-of-beer.moon @@ -0,0 +1,13 @@ +p = (i) -> + i != 1 and 's' or '' + +for b = 99,1,-1 + for i = 1,4 + print if i == 3 + 'Take one down, pass it around' + else + string.format '%s bottle%s of beer%s', + i < 4 and b or b-1, + i < 4 and (p b) or (p b-1), + i%3 == 1 and ' on the wall' or '' + io.write '\n' diff --git a/Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-1.nim b/Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-1.nim new file mode 100644 index 0000000000..c7c4ad6527 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-1.nim @@ -0,0 +1,17 @@ +proc GetBottleNumber(n: int): string = + var bs: string + if n == 0: + bs = "No more bottles" + elif n == 1: + bs = "1 bottle" + else: + bs = $n & " bottles" + return bs & " of beer" + +for bn in countdown(99, 1): + var cur = GetBottleNumber(bn) + echo(cur, " on the wall, ", cur, ".") + echo("Take one down and pass it around, ", GetBottleNumber(bn-1), " on the wall.\n") + +echo "No more bottles of beer on the wall, no more bottles of beer." +echo "Go to the store and buy some more, 99 bottles of beer on the wall." diff --git a/Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-2.nim b/Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-2.nim new file mode 100644 index 0000000000..e58c3fc701 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-2.nim @@ -0,0 +1,21 @@ +from strutils import format + +for i in countdown(99, 1): + case i + of 3..99: + echo format("""$1 bottles of beer on the wall +$1 bottles of beer +Take one down, pass it around +$2 bottles of beer on the wall""", i, i-1) + of 2: + echo format("""$1 bottles of beer on the wall +$1 bottles of beer +Take one down, pass it around +$2 bottle of beer on the wall""", i, i-1) + of 1: + echo format("""$1 bottle of beer on the wall +$1 bottle of beer +Take one down, pass it around +No more bottles of beer on the wall""", i) + else: + discard diff --git a/Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-3.nim b/Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-3.nim new file mode 100644 index 0000000000..6417583d95 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-3.nim @@ -0,0 +1,11 @@ +from strutils import format + +proc pluralize(a: int): string = + if a > 1 or a == 0: return "s" + else: return "" + +for i in countdown(99, 1): + echo format("""$1 bottle$3 of beer on the wall +$1 bottle$3 of beer +Take one down, pass it around +$2 bottle$4 of beer on the wall""", i, i-1, pluralize(i), pluralize(i-1)) diff --git a/Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-4.nim b/Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-4.nim new file mode 100644 index 0000000000..fa3e90a96c --- /dev/null +++ b/Task/99-Bottles-of-Beer/Nim/99-bottles-of-beer-4.nim @@ -0,0 +1,13 @@ +from strutils import format + +var verse = """$1 bottle$3 of beer on the wall +$1 bottle$3 of beer +Take one down, pass it around +$2 bottle$4 of beer on the wall""" + +proc pluralize(a: int): string = + if a > 1 or a == 0: return "s" + else: return "" + +for i in countdown(99, 1): + echo format(verse, i, i-1, pluralize(i), pluralize(i-1)) diff --git a/Task/99-Bottles-of-Beer/Oforth/99-bottles-of-beer.oforth b/Task/99-Bottles-of-Beer/Oforth/99-bottles-of-beer.oforth new file mode 100644 index 0000000000..bc51776a8a --- /dev/null +++ b/Task/99-Bottles-of-Beer/Oforth/99-bottles-of-beer.oforth @@ -0,0 +1,4 @@ +"bottles of beer on the wall\n" const: B +"bottles of beer\nTake one down, pass it around\n" const: T + +: beer #[ dup . B print dup . T print 1- . B .cr ] 100 seq applyr ; diff --git a/Task/99-Bottles-of-Beer/PHL/99-bottles-of-beer.phl b/Task/99-Bottles-of-Beer/PHL/99-bottles-of-beer.phl new file mode 100644 index 0000000000..c245a4332d --- /dev/null +++ b/Task/99-Bottles-of-Beer/PHL/99-bottles-of-beer.phl @@ -0,0 +1,15 @@ +module bottles; +extern printf; + +@Integer main [ + @Integer bottles = 99; + do + { + printf("%u bottles of beer on the wall\n", bottles); + printf("%u bottles of beer\n", bottles); + printf("Take one down, pass it around\n"); + bottles = bottles::dec; + printf("%u bottles of beer on the wall\n\n", bottles); + } while(bottles > 0); + return 0; +] diff --git a/Task/99-Bottles-of-Beer/Phix/99-bottles-of-beer.phix b/Task/99-Bottles-of-Beer/Phix/99-bottles-of-beer.phix new file mode 100644 index 0000000000..ade02cad76 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Phix/99-bottles-of-beer.phix @@ -0,0 +1,30 @@ +constant ninetynine = 99 -- (set this to 9 for testing) + +function bottles(integer count) + if count=0 then return "no more bottles " + elsif count=1 then return "1 bottle " end if + if count=-1 then count = ninetynine end if + return sprintf("%d bottles ",count) +end function + +function bob(integer count) + return bottles(count)&"of beer" +end function + +function up1(string bob) +-- Capitalise sentence start (needed just the once, "no more"=>"No more") + bob[1] = upper(bob[1]) + return bob +end function + +string this = bob(ninetynine) +string that = "Take one down, pass it around,\n" + for i=ninetynine to 0 by -1 do + puts(1,up1(this)&" on the wall,\n") + puts(1,this&".\n") + if i=0 then that = "Go to the store, buy some more,\n" + elsif i=1 then that[6..8] = "it" end if + this = bob(i-1) + puts(1,that&this&" on the wall.\n\n") + end for + if getc(0) then end if diff --git a/Task/99-Bottles-of-Beer/Ra/99-bottles-of-beer.ra b/Task/99-Bottles-of-Beer/Ra/99-bottles-of-beer.ra new file mode 100644 index 0000000000..24d837cf39 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Ra/99-bottles-of-beer.ra @@ -0,0 +1,49 @@ +class BottlesOfBeer + **Prints the "99 Bottles of Beer" song"** + + on start + + args := program arguments + + # If no arguments given, print the song once + if args empty + .printSong + + # Otherwise, print the song the given number of times + else + .printSong(integer.parse(args[0])) + + shared + + define printSong(times := 1) + **Print the song the given number of times** + + for times, _printSong + + define _printSong + **Print the song** + + # Print for bottles 99 to 1 + for bottle in 99 to 0 by -1 + + print "[_bottles(bottle)] of beer on the wall + [_bottles(bottle)] of beer + Take one down, pass it around + [_bottles(bottle - 1)] of beer on the wall + " + + print "No more bottles of beer on the wall + No more bottles of beer + Go to the store, buy some more + 99 bottles of beer on the wall" + + define _bottles(bottle as integer) as String + ** + If bottle is 0, returns "No more bottles" + If bottle is 1, returns "1 bottle" + Otherwise, returns "[bottle] bottles" + ** + + if bottle = 0, return "No more bottles" + if bottle = 1, return "1 bottle" + return "[bottle] bottles" diff --git a/Task/99-Bottles-of-Beer/Red/99-bottles-of-beer.red b/Task/99-Bottles-of-Beer/Red/99-bottles-of-beer.red new file mode 100644 index 0000000000..941b7cb84c --- /dev/null +++ b/Task/99-Bottles-of-Beer/Red/99-bottles-of-beer.red @@ -0,0 +1,21 @@ +Red [ + Title: "99 Bottles of Beer" + Original-Author: oofoe +] + +; The 'bottles' function maintains correct grammar. + +bottles: function [n] [ + b: either 1 = n ["bottle"]["bottles"] + if 0 = n [n: "no"] + form reduce [n b] +] + +repeat x 99 [ + n: 100 - x + print [ + bottles n "of beer on the wall" crlf + bottles n "of beer" crlf + "Take one down, pass it around" crlf + bottles n - 1 "of beer on the wall" crlf + ]] diff --git a/Task/99-Bottles-of-Beer/Ring/99-bottles-of-beer.ring b/Task/99-Bottles-of-Beer/Ring/99-bottles-of-beer.ring new file mode 100644 index 0000000000..0179f244f2 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Ring/99-bottles-of-beer.ring @@ -0,0 +1,22 @@ +for i = 99 to 0 step -1 +switch i +on 0 +see "No more bottles of beer on the wall, +no more bottles of beer. +Go to the store and buy some more, 99 bottles of beer on the wall." +on 1 +see "1 bottle of beer on the wall, +1 bottle of beer. +Take one down and pass it around, +No more bottles of beer on the wall. + +" +other +see string(i) + " bottles of beer on the wall, +" + string(i) + " bottles of beer. +Take one down and pass it around, +" + string(i-1) + " bottles of beer on the wall. + +" +off +next diff --git a/Task/99-Bottles-of-Beer/SequenceL/99-bottles-of-beer.sequencel b/Task/99-Bottles-of-Beer/SequenceL/99-bottles-of-beer.sequencel new file mode 100644 index 0000000000..58ce952fbe --- /dev/null +++ b/Task/99-Bottles-of-Beer/SequenceL/99-bottles-of-beer.sequencel @@ -0,0 +1,30 @@ +import ; +import ; + +main(args(2)) := + join(phrase(reverse(0 ... 99))); + +phrase(num) := + let + action := + "Take one down and pass it around" when num > 0 + else + "Go to the store and buy some more"; + in + describeCount(num, true) ++ " on the wall, " ++ + describeCount(num, false) ++ ".\n" ++ + action ++ ", " ++ + describeCount(num - 1, false) ++ " on the wall.\n\n"; + +describeCount(num, capitalize) := + let + count := + intToString(num) when num > 0 + else + intToString(99) when num < 0 + else + ("N" when capitalize else "n") ++ "o more"; + + plural := "s" when num /= 1 else ""; + in + count ++ " bottle" ++ plural ++ " of beer"; diff --git a/Task/99-Bottles-of-Beer/Set-lang/99-bottles-of-beer.set b/Task/99-Bottles-of-Beer/Set-lang/99-bottles-of-beer.set new file mode 100644 index 0000000000..5ae9e16405 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Set-lang/99-bottles-of-beer.set @@ -0,0 +1,97 @@ +set l 10 +set s 32 +set m 44 +set t 48 +set a 57 +set b 57 +set e (a-c) +set f (b-d) +[i=4] set i 0 +set ! e +set ! f +set ! s +set ! B +set ! O +set ! T +set ! T +set ! L +set ! E +set ! S +set ! s +set ! O +set ! F +set ! s +set ! B +set ! E +set ! E +set ! R +[i=1] set ? 49 +set ! s +set ! O +set ! N +set ! s +set ! T +set ! H +set ! E +set ! s +set ! W +set ! A +set ! L +set ! L +set ! l +[k=1] set ? 97 +[i=3] set i 4 +[i=4] set ! l +[i=4] set ? 9 +[i/2] set i 1 +[i=1] set ? 9 +[i=2] set ? 87 +set ! l +set ! T +set ! A +set ! K +set ! E +set ! s +set ! O +set ! N +set ! E +set ! s +set ! D +set ! O +set ! W +set ! N +set ! m +set ! s +set ! P +set ! A +set ! S +set ! S +set ! s +set ! I +set ! T +set ! s +set ! A +set ! R +set ! O +set ! U +set ! N +set ! D +set ! l +set i 2 +[d=9] set d l +[d/l] set d (d+1) +[d=l] set c (c+1) +[d=l] set d 0 +set e (a-c) +set f (b-d) +[e=f] set ? 93 +[c=l] set ? 91 +[i=2] set i 3 +[i=3] set ? 9 +[d=l] set ? 93 +[d/l] set ? 88 +[e=t] set ? 95 +set ? 88 +set k 1 +set ? 9 +> EOF diff --git a/Task/99-Bottles-of-Beer/Sidef/99-bottles-of-beer-1.sidef b/Task/99-Bottles-of-Beer/Sidef/99-bottles-of-beer-1.sidef new file mode 100644 index 0000000000..f575ac88be --- /dev/null +++ b/Task/99-Bottles-of-Beer/Sidef/99-bottles-of-beer-1.sidef @@ -0,0 +1,8 @@ +for i in (100 ^.. 0) { + var bottles = "#{i == 0 ? 'No' : i} bottle#{i == 1 ? '' : 's'}" + var sentence = "#{bottles} of beer on the wall" -> say + if (i > 0) { + say sentence.substr(0, bottles.length + 8) + say "Take one down, pass it around\n" + } +} diff --git a/Task/99-Bottles-of-Beer/Sidef/99-bottles-of-beer-2.sidef b/Task/99-Bottles-of-Beer/Sidef/99-bottles-of-beer-2.sidef new file mode 100644 index 0000000000..a1e349cad6 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Sidef/99-bottles-of-beer-2.sidef @@ -0,0 +1,7 @@ +for n in (100 ^.. 2) { + say "#{n} bottles of beer on the wall, #{n} bottles of beer!" + say "Take one down, pass it around, #{n - 1} bottle#{n > 2 ? 's' : ''} of beer on the wall.\n" +} + +say "One bottle of beer on the wall, one bottle of beer!" +say "Take one down, pass it around, no more bottles of beer on the wall." diff --git a/Task/99-Bottles-of-Beer/SkookumScript/99-bottles-of-beer.skookum b/Task/99-Bottles-of-Beer/SkookumScript/99-bottles-of-beer.skookum new file mode 100644 index 0000000000..ba2f048b57 --- /dev/null +++ b/Task/99-Bottles-of-Beer/SkookumScript/99-bottles-of-beer.skookum @@ -0,0 +1,9 @@ +!bottles: (Integer num) [num.String += if num=1 [" bottle"] else [" bottles"]] +99.to 1 + [ + print( + bottles(idx) " of beer on the wall\n" + bottles(idx) " of beer\n" + "Take one down, pass it around\n" + bottles(idx-1) " of beer on the wall\n") + ] diff --git a/Task/99-Bottles-of-Beer/Sparkling/99-bottles-of-beer.sparkling b/Task/99-Bottles-of-Beer/Sparkling/99-bottles-of-beer.sparkling new file mode 100644 index 0000000000..bb9ef8167f --- /dev/null +++ b/Task/99-Bottles-of-Beer/Sparkling/99-bottles-of-beer.sparkling @@ -0,0 +1,10 @@ +var bottles = 99; + +do { + printf("%u bottles of beer on the wall\n", bottles); + printf("%u bottles of beer\n", bottles); + printf("Take one down, pass it around\n"); + printf("%u bottles of beer on the wall\n\n", --bottles); +} while(bottles > 1); + +printf("1 bottle of beer on the wall\n1 bottle of beer\nTake it down, pass it around\n0 bottles of beer on the wall\n"); diff --git a/Task/99-Bottles-of-Beer/Swift/99-bottles-of-beer.swift b/Task/99-Bottles-of-Beer/Swift/99-bottles-of-beer.swift new file mode 100644 index 0000000000..b47b0f166e --- /dev/null +++ b/Task/99-Bottles-of-Beer/Swift/99-bottles-of-beer.swift @@ -0,0 +1,6 @@ +for i in reverse(1...99) { + + println("\(i) bottles of beer on the wall, \(i) bottles of beer.") + let next = i == 1 ? "no" : i.description + println("Take one down and pass it around, \(next) bottles of beer on the wall.") +} diff --git a/Task/99-Bottles-of-Beer/Symsyn/99-bottles-of-beer.symsyn b/Task/99-Bottles-of-Beer/Symsyn/99-bottles-of-beer.symsyn new file mode 100644 index 0000000000..1e627d1f5e --- /dev/null +++ b/Task/99-Bottles-of-Beer/Symsyn/99-bottles-of-beer.symsyn @@ -0,0 +1,19 @@ +BBW : ' Bottles of beer on the wall ' +TOD : 'Take one down and pass it around ' + + if 99 GT 0 | numbers are variables initialized to value + ~ 99 $S | convert to string + + BBW $S | add phrase to end of string + + $S $S | add string to itself + #$S N | size to N + - 12 N | decrement size by 12 + N #$S | change size of string + $S [] | output string + - 99 | decrement counter + TOD $S | phrase to string + ~ 99 $R | convert to string + + $R $S | add to end of string $S + + BBW $S | add phrase to end of $S + $S [] | output string + goif | go back to if + endif diff --git a/Task/99-Bottles-of-Beer/Ursa/99-bottles-of-beer.ursa b/Task/99-Bottles-of-Beer/Ursa/99-bottles-of-beer.ursa new file mode 100644 index 0000000000..28434e9015 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Ursa/99-bottles-of-beer.ursa @@ -0,0 +1,24 @@ +# +# 99 bottles of beer +# + +decl int bottles +decl string bottlestr + +for (set bottles 99) (> bottles 0) (dec bottles) + if (= bottles 1) + set bottlestr "bottle" + else + set bottlestr "bottles" + end if + + out bottles " " bottlestr " of beer on the wall" endl console + out bottles " " bottlestr " of beer" endl console + out "Take one down, pass it around." endl console + + if (not (= bottles 2)) + out (int (- bottles 1)) " bottles of beer on the wall." endl endl console + else + out (int (- bottles 1)) " bottle of beer on the wall." endl endl console + end if +end for diff --git a/Task/99-Bottles-of-Beer/Wortel/99-bottles-of-beer.wortel b/Task/99-Bottles-of-Beer/Wortel/99-bottles-of-beer.wortel new file mode 100644 index 0000000000..28128ec76f --- /dev/null +++ b/Task/99-Bottles-of-Beer/Wortel/99-bottles-of-beer.wortel @@ -0,0 +1,4 @@ +!console.log @unlines ~!* 99..0 !? { + 0 "0 bottles of beer on the wall\n0 bottles of beer\nbetter go to the store and buy some more." + "{@x} bottle{@?@x{1 @e 's}} of beer on the wall\n{@x} bottle{@?@x{1 @e 's}} of beer\nTake one down, pass it around" +} diff --git a/Task/99-Bottles-of-Beer/Wren/99-bottles-of-beer.wren b/Task/99-Bottles-of-Beer/Wren/99-bottles-of-beer.wren new file mode 100644 index 0000000000..1dcb048e01 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Wren/99-bottles-of-beer.wren @@ -0,0 +1,6 @@ +for (i in 99...0) { + System.print("%(i) bottles of beer on the wall,") + System.print("%(i) bottles of beer,") + System.print("Take one down, pass it around,") + System.print("%(i - 1) bottles of beer on the wall.\n") +} diff --git a/Task/99-Bottles-of-Beer/Xojo/99-bottles-of-beer.xojo b/Task/99-Bottles-of-Beer/Xojo/99-bottles-of-beer.xojo new file mode 100644 index 0000000000..42597d0947 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Xojo/99-bottles-of-beer.xojo @@ -0,0 +1,9 @@ +Dim bottles As Integer = 99 +While bottles > 0 + Print(bottles.ToText) + " bottles of beer on the wall,") + Print(bottles.ToText + " bottles of beer.") + Print("Take one down, pass it around.") + bottles = bottles - 1 + Print(bottles.ToText + " bottles of beer on the wall.") + Print "" +Wend diff --git a/Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-1.jq b/Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-1.jq new file mode 100644 index 0000000000..727e077be5 --- /dev/null +++ b/Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-1.jq @@ -0,0 +1,7 @@ +99 +| (. - range(0;.+1) ) +| " +\(.) bottles of beer on the wall +\(.) bottles of beer +Take one down, pass it around +\(.) bottles of beer on the wall" diff --git a/Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-2.jq b/Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-2.jq new file mode 100644 index 0000000000..565006a579 --- /dev/null +++ b/Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-2.jq @@ -0,0 +1,17 @@ +$ jq -n -r -f 99_bottles.jq +... + +2 bottles of beer on the wall +2 bottles of beer +Take one down, pass it around +2 bottles of beer on the wall + +1 bottles of beer on the wall +1 bottles of beer +Take one down, pass it around +1 bottles of beer on the wall + +0 bottles of beer on the wall +0 bottles of beer +Take one down, pass it around +0 bottles of beer on the wall diff --git a/Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-3.jq b/Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-3.jq new file mode 100644 index 0000000000..2e45edc9c2 --- /dev/null +++ b/Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-3.jq @@ -0,0 +1,15 @@ +def sing: + def s: if . == 1 then "" else "s" end; + def bottles: + if . == 0 then "No more" + else "\(.)" + end + " bottle\(s)"; + (. - range(0;.+1) ) + | " +\(bottles) of beer on the wall +\(bottles) of beer +Take one down, pass it around +\(bottles) of beer on the wall." +; + +$bottles | tonumber | sing diff --git a/Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-4.jq b/Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-4.jq new file mode 100644 index 0000000000..f0d82b6367 --- /dev/null +++ b/Task/99-Bottles-of-Beer/jq/99-bottles-of-beer-4.jq @@ -0,0 +1,16 @@ +$ jq -r --arg bottles 99 -f 99_bottles_variant.jq +... +2 bottles of beer on the wall +2 bottles of beer +Take one down, pass it around +2 bottles of beer on the wall. + +1 bottle of beer on the wall +1 bottle of beer +Take one down, pass it around +1 bottle of beer on the wall. + +No more bottles of beer on the wall +No more bottles of beer +Take one down, pass it around +No more bottles of beer on the wall. diff --git a/Task/A+B/8th/a+b.8th b/Task/A+B/8th/a+b.8th new file mode 100644 index 0000000000..f7eae08dd3 --- /dev/null +++ b/Task/A+B/8th/a+b.8th @@ -0,0 +1 @@ +gets dup . space eval n:+ . cr diff --git a/Task/A+B/Apex/a+b.apex b/Task/A+B/Apex/a+b.apex new file mode 100644 index 0000000000..0549866377 --- /dev/null +++ b/Task/A+B/Apex/a+b.apex @@ -0,0 +1,14 @@ +static Integer sumOfTwoNums(Integer A, Integer B) { + return A + B; +} + +System.debug('A = 50 and B = 25: ' + sumOfTwoNums(50, 25)); +System.debug('A = -50 and B = 25: ' +sumOfTwoNums(-50, 25)); +System.debug('A = -50 and B = -25: ' +sumOfTwoNums(-50, -25)); +System.debug('A = 50 and B = -25: ' +sumOfTwoNums(50, -25)); + +'''Output''' +A = 50 and B = 25: 75 +A = -50 and B = 25: -25 +A = -50 and B = -25: -75 +A = 50 and B = -25: 25 diff --git a/Task/A+B/Arc/a+b.arc b/Task/A+B/Arc/a+b.arc new file mode 100644 index 0000000000..9910374612 --- /dev/null +++ b/Task/A+B/Arc/a+b.arc @@ -0,0 +1,2 @@ +(prn (+ (read) + (read))) diff --git a/Task/A+B/Ceylon/a+b.ceylon b/Task/A+B/Ceylon/a+b.ceylon new file mode 100644 index 0000000000..6b8bba821c --- /dev/null +++ b/Task/A+B/Ceylon/a+b.ceylon @@ -0,0 +1,23 @@ +shared void run() { + while(true) { + print("please enter two numbers for me to add"); + value input = process.readLine(); + if(exists input) { + value tokens = input.split(); + value numbers = tokens.map(parseInteger); + if(numbers.any((Integer? element) => element is Null)) { + print("numbers only, please"); + } else if(numbers.size != 2) { + print("two numbers, please"); + } else if(!numbers.coalesced.every((Integer element) => -1k <= element <= 1k)) { + print("only numbers between -1000 and 1000, please"); + } else if(exists a = numbers.first, exists b = numbers.last) { + print(a + b); + } else { + print("something went wrong"); + } + } else { + break; + } + } +} diff --git a/Task/A+B/Computer-zero-Assembly/a+b.computer b/Task/A+B/Computer-zero-Assembly/a+b.computer new file mode 100644 index 0000000000..06c00d3181 --- /dev/null +++ b/Task/A+B/Computer-zero-Assembly/a+b.computer @@ -0,0 +1,6 @@ + STP ; wait for input +a: 0 +b: 0 + LDA a + ADD b + STP diff --git a/Task/A+B/Crystal/a+b-1.crystal b/Task/A+B/Crystal/a+b-1.crystal new file mode 100644 index 0000000000..cb2d97748c --- /dev/null +++ b/Task/A+B/Crystal/a+b-1.crystal @@ -0,0 +1 @@ +puts gets.not_nil!.split.map(&.to_i).sum diff --git a/Task/A+B/Crystal/a+b-2.crystal b/Task/A+B/Crystal/a+b-2.crystal new file mode 100644 index 0000000000..9eb8e472f5 --- /dev/null +++ b/Task/A+B/Crystal/a+b-2.crystal @@ -0,0 +1,5 @@ +if line = gets + puts line.split.map(&.to_i).sum +else + puts "No input" +end diff --git a/Task/A+B/EDSAC-order-code/a+b.edsac b/Task/A+B/EDSAC-order-code/a+b.edsac new file mode 100644 index 0000000000..e4edbbf777 --- /dev/null +++ b/Task/A+B/EDSAC-order-code/a+b.edsac @@ -0,0 +1,33 @@ +[ A plus B + ======== + + A program for the EDSAC + + Adds two integers & displays + the sum at the top of storage + tank 3 + + Works with Initial Orders 2 ] + +[ Set load point & base address ] + +T56K [ Load at address 56 ] +GK [ Base addr (theta) here ] + +[ Orders ] + +T96F [ Clear accumulator ] +A5@ [ Acc += C(theta + 5) ] +A6@ [ Acc += C(theta + 6) ] +T96F [ C(96) = Acc; Acc = 0 ] + +ZF [ Halt ] + +[ Pseudo-orders (data) ] + +P18D [ 5@: 18*2 + 1 = 37 ] +P14F [ 6@: 14*2 + 0 = 28 ] + +[ When loading is finished: ] + +EZPF [ Branch to load point ] diff --git a/Task/A+B/ERRE/a+b.erre b/Task/A+B/ERRE/a+b.erre new file mode 100644 index 0000000000..704a3f225b --- /dev/null +++ b/Task/A+B/ERRE/a+b.erre @@ -0,0 +1,12 @@ +PROGRAM SUM2 + +BEGIN + + LOOP + INPUT(LINE,Q$) + EXIT IF Q$="" + SP%=INSTR(Q$," ") + PRINT(VAL(LEFT$(Q$,SP%-1))+VAL(MID$(Q$,SP%+1))) + END LOOP + +END PROGRAM diff --git a/Task/A+B/EchoLisp/a+b.echolisp b/Task/A+B/EchoLisp/a+b.echolisp new file mode 100644 index 0000000000..7dc1dbda4f --- /dev/null +++ b/Task/A+B/EchoLisp/a+b.echolisp @@ -0,0 +1 @@ +(+ (read-number 1 "value for A") (read-number 2 "value for B")) diff --git a/Task/A+B/FUZE-BASIC/a+b.fuze b/Task/A+B/FUZE-BASIC/a+b.fuze new file mode 100644 index 0000000000..0196934620 --- /dev/null +++ b/Task/A+B/FUZE-BASIC/a+b.fuze @@ -0,0 +1,3 @@ +INPUT n$ +PRINT VAL(LEFT$(n$,(LEN(STR$(VAL(n$))))))+VAL(RIGHT$(n$,(LEN(n$)-LEN(STR$(VAL(n$)))-1))) +END diff --git a/Task/A+B/FreeBASIC/a+b.freebasic b/Task/A+B/FreeBASIC/a+b.freebasic new file mode 100644 index 0000000000..aa13065731 --- /dev/null +++ b/Task/A+B/FreeBASIC/a+b.freebasic @@ -0,0 +1,17 @@ +' fb 1.05.0 Win64 + +Dim As Integer a, b +Do + Print "Enter two integers separated by a space : "; + Input "", a, b + If Abs(a) > 1000 OrElse Abs(b) > 1000 then + Print "Both numbers must be in the interval [-1000, 1000] - try again" + Print + Else + Print "Their sum is"; a + b + Exit Do + End If +Loop +Print +Print "Press any key to quit the program" +Sleep diff --git a/Task/A+B/FunL/a+b.funl b/Task/A+B/FunL/a+b.funl new file mode 100644 index 0000000000..00aa39adaf --- /dev/null +++ b/Task/A+B/FunL/a+b.funl @@ -0,0 +1 @@ +println( sum(map(int, readLine().split(' +'))) ) diff --git a/Task/A+B/I/a+b.i b/Task/A+B/I/a+b.i new file mode 100644 index 0000000000..385107f25d --- /dev/null +++ b/Task/A+B/I/a+b.i @@ -0,0 +1,6 @@ +software { + var a = number(read(' ')) + var b = number(read('\n')) + + print(a + b) +} diff --git a/Task/A+B/Idris/a+b.idris b/Task/A+B/Idris/a+b.idris new file mode 100644 index 0000000000..7dc049d490 --- /dev/null +++ b/Task/A+B/Idris/a+b.idris @@ -0,0 +1,4 @@ +main : IO() +main = do + line <- getLine + print $ sum $ map cast $ words line diff --git a/Task/A+B/L++/a+b.lpp b/Task/A+B/L++/a+b.lpp new file mode 100644 index 0000000000..1c4e2b61ea --- /dev/null +++ b/Task/A+B/L++/a+b.lpp @@ -0,0 +1,5 @@ +(main + (decl int a) + (decl int b) + (>> std::cin a b) + (prn (+ a b))) diff --git a/Task/A+B/Lasso/a+b.lasso b/Task/A+B/Lasso/a+b.lasso new file mode 100644 index 0000000000..3d31f6327a --- /dev/null +++ b/Task/A+B/Lasso/a+b.lasso @@ -0,0 +1 @@ +[a + b] diff --git a/Task/A+B/LiveCode/a+b-1.livecode b/Task/A+B/LiveCode/a+b-1.livecode new file mode 100644 index 0000000000..73b4b6a2a0 --- /dev/null +++ b/Task/A+B/LiveCode/a+b-1.livecode @@ -0,0 +1,7 @@ + diff --git a/Task/A+B/LiveCode/a+b-2.livecode b/Task/A+B/LiveCode/a+b-2.livecode new file mode 100644 index 0000000000..3a3ffd20bf --- /dev/null +++ b/Task/A+B/LiveCode/a+b-2.livecode @@ -0,0 +1,10 @@ +on mouseUp + ask "Enter two numbers" + set itemdelimiter to space + put it into nums + if isNumber(item 1 of nums) and isNumber(item 2 of nums) then + answer item 1 of nums + item 2 of nums + else + answer item 1 of nums && item 2 of nums + end if +end mouseUp diff --git a/Task/A+B/Maude/a+b-1.maude b/Task/A+B/Maude/a+b-1.maude new file mode 100644 index 0000000000..c51b6e834f --- /dev/null +++ b/Task/A+B/Maude/a+b-1.maude @@ -0,0 +1 @@ +red 3 + 4 . diff --git a/Task/A+B/Maude/a+b-2.maude b/Task/A+B/Maude/a+b-2.maude new file mode 100644 index 0000000000..48e69a06fa --- /dev/null +++ b/Task/A+B/Maude/a+b-2.maude @@ -0,0 +1,12 @@ +fmod ADD is + + protecting INT . + + op undefined : -> Int . + op _add_ : Int Int -> Int [assoc comm] . + + vars A B : Int . + + eq A add B = if (A < -1000 or B < -1000) or (A > 1000 or B > 1000) then undefined else A + B fi . + +endfm diff --git a/Task/A+B/MoonScript/a+b.moon b/Task/A+B/MoonScript/a+b.moon new file mode 100644 index 0000000000..07629881b5 --- /dev/null +++ b/Task/A+B/MoonScript/a+b.moon @@ -0,0 +1,2 @@ +a,b = io.read '*number','*number' +print a + b diff --git a/Task/A+B/Nim/a+b-1.nim b/Task/A+B/Nim/a+b-1.nim new file mode 100644 index 0000000000..b0365dd189 --- /dev/null +++ b/Task/A+B/Nim/a+b-1.nim @@ -0,0 +1,3 @@ +import strutils, os + +echo parseInt(paramStr(1)) + parseInt(paramStr(2)) diff --git a/Task/A+B/Nim/a+b-2.nim b/Task/A+B/Nim/a+b-2.nim new file mode 100644 index 0000000000..848c54d708 --- /dev/null +++ b/Task/A+B/Nim/a+b-2.nim @@ -0,0 +1,5 @@ +import strutils, os +var sum = 0 +for i in countup(1, paramCount()): + sum = sum + parseInt(paramStr(i)) +echo sum diff --git a/Task/A+B/Nim/a+b-3.nim b/Task/A+B/Nim/a+b-3.nim new file mode 100644 index 0000000000..9782c6d193 --- /dev/null +++ b/Task/A+B/Nim/a+b-3.nim @@ -0,0 +1,19 @@ +from strutils import parseFloat, formatFloat, ffDecimal + +proc aplusb(a,b: float): float = + return a + b + +proc getnumber(): float = + try: + parseFloat(readLine(stdin)) + except EInvalidValue: + echo("Please enter a number: ") + getnumber() + +echo("First number please: ") +let first: float = getnumber() + +echo("Second number please: ") +let second: float = getnumber() + +echo("Result: " & formatFloat(aplusb(first, second), ffDecimal, 2)) diff --git a/Task/A+B/Nit/a+b.nit b/Task/A+B/Nit/a+b.nit new file mode 100644 index 0000000000..34b4c22a06 --- /dev/null +++ b/Task/A+B/Nit/a+b.nit @@ -0,0 +1,4 @@ +module ab + +var words = gets.split(" ") +print words[0].to_i + words[1].to_i diff --git a/Task/A+B/Oforth/a+b.oforth b/Task/A+B/Oforth/a+b.oforth new file mode 100644 index 0000000000..1392dd6796 --- /dev/null +++ b/Task/A+B/Oforth/a+b.oforth @@ -0,0 +1 @@ +System.Console askln words map(#asInteger) sum . diff --git a/Task/A+B/Phix/a+b.phix b/Task/A+B/Phix/a+b.phix new file mode 100644 index 0000000000..842f95a2ab --- /dev/null +++ b/Task/A+B/Phix/a+b.phix @@ -0,0 +1,65 @@ +-- longhand version, input is echoed, full error handling +string text +integer idx = 0 +integer ch + +procedure nextch() + idx += 1 + if idx>length(text) then + idx = 0 + ch = 0 + else + ch = text[idx] + end if +end procedure + +function getNumber() +integer sign = 0 +integer res = 0 + while find(ch," \t\r\n") do + nextch() + end while + if idx=0 then + puts(1,"\nenter another number\n") + text = gets(0) + idx = 0 + nextch() + end if + if ch='-' then + sign = 1 + nextch() + end if + if idx=0 or ch<'0' or ch>'9' then + idx = 0 + else + while 1 do + res = res*10+ch-'0' + nextch() + if idx=0 or ch<'0' or ch>'9' then exit end if + end while + if sign then + res = -res + end if + end if + return res +end function + +procedure twoNumbers() +integer a, b + text = gets(0) + idx = 0 + nextch() + if idx!=0 then + a = getNumber() + if idx!=0 and a>=-1000 and a<=1000 then + b = getNumber() + if idx!=0 and b>=-1000 and b<=1000 then + printf(1," %d\n",{a+b}) + return + end if + end if + end if + puts(1," some error\n") +end procedure + +twoNumbers() diff --git a/Task/A+B/Potion/a+b.potion b/Task/A+B/Potion/a+b.potion new file mode 100644 index 0000000000..7eefe784f5 --- /dev/null +++ b/Task/A+B/Potion/a+b.potion @@ -0,0 +1,13 @@ +# The numbers are entered, piped, or redirected in via STDIN and the format is proper (i.e., "%d %d"). +input = read +i = 0 +while (i < input length): + if (input(i) == " "): + break + . + i++ +. +(input slice(0, i) number + input slice(i, nil) number) print + +# The numbers are manually inputted, but the format is improper (i.e., "%d\n%d\n"). +(read number + read number) print diff --git a/Task/A+B/Ra/a+b.ra b/Task/A+B/Ra/a+b.ra new file mode 100644 index 0000000000..a122fe2e92 --- /dev/null +++ b/Task/A+B/Ra/a+b.ra @@ -0,0 +1,25 @@ +class Sum + **Adds two given integers** + + on start + + args := program arguments + + if args empty + print to Console.error made !, "No arguments given" + exit program with error code + + if args.count = 1 + print to Console.error made !, "Only one argument given" + exit program with error code + + try + print integer.parse(args[0]) + integer.parse(args[1]) + + catch FormatException + print to Console.error made !, "Arguments must be integers" + exit program with error code + + catch OverflowException + print to Console.error made !, "Numbers too large" + exit program with error code diff --git a/Task/A+B/Red/a+b.red b/Task/A+B/Red/a+b.red new file mode 100644 index 0000000000..003613d500 --- /dev/null +++ b/Task/A+B/Red/a+b.red @@ -0,0 +1 @@ +forever [x: load input print x/1 + x/2] diff --git a/Task/A+B/Ring/a+b.ring b/Task/A+B/Ring/a+b.ring new file mode 100644 index 0000000000..c275cfe045 --- /dev/null +++ b/Task/A+B/Ring/a+b.ring @@ -0,0 +1,9 @@ +give Numbers +Numbers = split(Numbers) +sum = 0 +for x in Numbers sum += x next +see sum + +func Split Str +for x in str if x = " " x = nl ok next +return str2list(str) diff --git a/Task/A+B/SPAD/a+b.spad b/Task/A+B/SPAD/a+b.spad new file mode 100644 index 0000000000..dd5c0aeb34 --- /dev/null +++ b/Task/A+B/SPAD/a+b.spad @@ -0,0 +1,5 @@ +(1) -> integer READ()$Lisp + integer READ()$Lisp +333 444 + + (1) 777 + Type: PositiveInteger diff --git a/Task/A+B/SSEM/a+b.ssem b/Task/A+B/SSEM/a+b.ssem new file mode 100644 index 0000000000..9e0a69b380 --- /dev/null +++ b/Task/A+B/SSEM/a+b.ssem @@ -0,0 +1,8 @@ +10100000000000100000000000000000 0. -5 to c acc = -A +01100000000001010000000000000000 1. Sub. 6 acc -= B +11100000000001100000000000000000 2. c to 7 X = acc +11100000000000100000000000000000 3. -7 to c acc = -X +00000000000001110000000000000000 4. Stop +10100100000000000000000000000000 5. 37 A +00111000000000000000000000000000 6. 28 B +00000000000000000000000000000000 7. 0 X diff --git a/Task/A+B/SequenceL/a+b.sequencel b/Task/A+B/SequenceL/a+b.sequencel new file mode 100644 index 0000000000..6b5a8704a0 --- /dev/null +++ b/Task/A+B/SequenceL/a+b.sequencel @@ -0,0 +1,3 @@ +import ; + +main(args(2)) := stringToInt(args[1]) + stringToInt(args[2]); diff --git a/Task/A+B/Sidef/a+b-1.sidef b/Task/A+B/Sidef/a+b-1.sidef new file mode 100644 index 0000000000..b3b759ddc3 --- /dev/null +++ b/Task/A+B/Sidef/a+b-1.sidef @@ -0,0 +1 @@ +say STDIN.readline.words.map{.to_i}.sum diff --git a/Task/A+B/Sidef/a+b-2.sidef b/Task/A+B/Sidef/a+b-2.sidef new file mode 100644 index 0000000000..0170bf8af0 --- /dev/null +++ b/Task/A+B/Sidef/a+b-2.sidef @@ -0,0 +1 @@ +say read(String).words»to_i»()«+» diff --git a/Task/A+B/Sidef/a+b-3.sidef b/Task/A+B/Sidef/a+b-3.sidef new file mode 100644 index 0000000000..79d5360deb --- /dev/null +++ b/Task/A+B/Sidef/a+b-3.sidef @@ -0,0 +1,2 @@ +var (a, b) = read(String).words.map{.to_i}... +say a+b diff --git a/Task/A+B/SmileBASIC/a+b.smilebasic b/Task/A+B/SmileBASIC/a+b.smilebasic new file mode 100644 index 0000000000..2b9bb102c0 --- /dev/null +++ b/Task/A+B/SmileBASIC/a+b.smilebasic @@ -0,0 +1,3 @@ +INPUT A +INPUT B +PRINT A+B diff --git a/Task/A+B/Swift/a+b.swift b/Task/A+B/Swift/a+b.swift new file mode 100644 index 0000000000..5272fd45e5 --- /dev/null +++ b/Task/A+B/Swift/a+b.swift @@ -0,0 +1,12 @@ +import Foundation + +let input = NSFileHandle.fileHandleWithStandardInput() + +let data = input.availableData +let str = NSString(data: data, encoding: NSUTF8StringEncoding)! + +let nums = str.componentsSeparatedByString(" ") +let a = (nums[0] as String).toInt()! +let b = (nums[1] as String).toInt()! + +print(" \(a + b)") diff --git a/Task/A+B/TI-83-Hex-Assembly/a+b.ti-83 b/Task/A+B/TI-83-Hex-Assembly/a+b.ti-83 new file mode 100644 index 0000000000..ead544f302 --- /dev/null +++ b/Task/A+B/TI-83-Hex-Assembly/a+b.ti-83 @@ -0,0 +1,17 @@ +PROGRAM:APLUSB +:AsmPrgm +: +:EFC541 ; ZeroOP1 +:217984 ; ld hl,op1+1 +:3641 ; ld (hl),'A' +:EFE34A ; RclVarSym +:CF ; rst OP1toOP2 +: +:EFC541 ; ZeroOP1 +:217984 ; ld hl,op1+1 +:3642 ; ld (hl),'B' +:EFE34A ; RclVarSym +: +:F7 ; rst FPAdd +:EFBF4A ; StoAns +:C9 ; ret diff --git a/Task/A+B/Ursa/a+b.ursa b/Task/A+B/Ursa/a+b.ursa new file mode 100644 index 0000000000..f935652e69 --- /dev/null +++ b/Task/A+B/Ursa/a+b.ursa @@ -0,0 +1,15 @@ +# +# a + b +# + +# read a string containing the two ints +decl string input +set input (in string console) + +# determine the sum +decl int sum +set sum (int (+ sum (int (split input " ")<0>))) +set sum (int (+ sum (int (split input " ")<1>))) + +# output the sum +out sum endl console diff --git a/Task/A+B/Wren/a+b.wren b/Task/A+B/Wren/a+b.wren new file mode 100644 index 0000000000..ed88343e37 --- /dev/null +++ b/Task/A+B/Wren/a+b.wren @@ -0,0 +1,4 @@ +import "io" for Stdin +var a = Num.fromString(Stdin.readLine()) +var b = Num.fromString(Stdin.readLine()) +System.print(a + b) diff --git a/Task/A+B/XLISP/a+b.xlisp b/Task/A+B/XLISP/a+b.xlisp new file mode 100644 index 0000000000..cba0b48581 --- /dev/null +++ b/Task/A+B/XLISP/a+b.xlisp @@ -0,0 +1,7 @@ +(DEFUN A-PLUS-B () + (DISPLAY "Enter two numbers separated by a space.") + (NEWLINE) + (DISPLAY "> ") + (DEFINE A (READ)) + (DEFINE B (READ)) + (+ A B)) diff --git a/Task/A+B/jq/a+b-1.jq b/Task/A+B/jq/a+b-1.jq new file mode 100644 index 0000000000..6f650cc560 --- /dev/null +++ b/Task/A+B/jq/a+b-1.jq @@ -0,0 +1,3 @@ +$ jq -s add +3 2 +5 diff --git a/Task/A+B/jq/a+b-2.jq b/Task/A+B/jq/a+b-2.jq new file mode 100644 index 0000000000..e822122d64 --- /dev/null +++ b/Task/A+B/jq/a+b-2.jq @@ -0,0 +1,6 @@ +def addpairs: + if length < 2 then empty + else (.[0] + .[1]), (.[2:] | addpairs) + end; + +addpairs diff --git a/Task/A+B/jq/a+b-3.jq b/Task/A+B/jq/a+b-3.jq new file mode 100644 index 0000000000..ff0b90dbdf --- /dev/null +++ b/Task/A+B/jq/a+b-3.jq @@ -0,0 +1,5 @@ +$ jq -s -f AB.jq +1 2 3 4 5 6 +3 +7 +11 diff --git a/Task/ABC-Problem/Apex/abc-problem.apex b/Task/ABC-Problem/Apex/abc-problem.apex new file mode 100644 index 0000000000..01d39ce093 --- /dev/null +++ b/Task/ABC-Problem/Apex/abc-problem.apex @@ -0,0 +1,45 @@ +static Boolean canMakeWord(List src_blocks, String word) { + if (String.isEmpty(word)) { + return true; + } + + List blocks = new List(); + for (String block : src_blocks) { + blocks.add(block.toUpperCase()); + } + + for (Integer i = 0; i < word.length(); i++) { + Integer blockIndex = -1; + String c = word.mid(i, 1).toUpperCase(); + + for (Integer j = 0; j < blocks.size(); j++) { + if (blocks.get(j).contains(c)) { + blockIndex = j; + break; + } + } + + if (blockIndex == -1) { + return false; + } else { + blocks.remove(blockIndex); + } + } + + return true; +} + +List blocks = new List{ + 'BO', 'XK', 'DQ', 'CP', 'NA', + 'GT', 'RE', 'TG', 'QD', 'FS', + 'JW', 'HU', 'VI', 'AN', 'OB', + 'ER', 'FS', 'LY', 'PC', 'ZM' +}; +System.debug('"": ' + canMakeWord(blocks, '')); +System.debug('"A": ' + canMakeWord(blocks, 'A')); +System.debug('"BARK": ' + canMakeWord(blocks, 'BARK')); +System.debug('"book": ' + canMakeWord(blocks, 'book')); +System.debug('"treat": ' + canMakeWord(blocks, 'treat')); +System.debug('"COMMON": ' + canMakeWord(blocks, 'COMMON')); +System.debug('"SQuAd": ' + canMakeWord(blocks, 'SQuAd')); +System.debug('"CONFUSE": ' + canMakeWord(blocks, 'CONFUSE')); diff --git a/Task/ABC-Problem/Ceylon/abc-problem-1.ceylon b/Task/ABC-Problem/Ceylon/abc-problem-1.ceylon new file mode 100644 index 0000000000..aaa8e1e65f --- /dev/null +++ b/Task/ABC-Problem/Ceylon/abc-problem-1.ceylon @@ -0,0 +1 @@ +module rosetta.abc "1.0.0" {} diff --git a/Task/ABC-Problem/Ceylon/abc-problem-2.ceylon b/Task/ABC-Problem/Ceylon/abc-problem-2.ceylon new file mode 100644 index 0000000000..12ccef789e --- /dev/null +++ b/Task/ABC-Problem/Ceylon/abc-problem-2.ceylon @@ -0,0 +1,74 @@ +shared void run() { + printAndCanMakeWord("A", blocks); + //True + printAndCanMakeWord("BARK", blocks); + //True + printAndCanMakeWord("BOOK", blocks); + //False + printAndCanMakeWord("TREAT", blocks); + //True + printAndCanMakeWord("COMMON", blocks); + //False + printAndCanMakeWord("SQUAD", blocks); + //True + printAndCanMakeWord("CONFUSE", blocks); + //True +} + +Block[] blocks = + [ + Block('B','O'), + Block('X','K'), + Block('D','Q'), + Block('C','P'), + Block('N','A'), + Block('G','T'), + Block('R','E'), + Block('T','G'), + Block('Q','D'), + Block('F','S'), + Block('J','W'), + Block('H','U'), + Block('V','I'), + Block('A','N'), + Block('O','B'), + Block('E','R'), + Block('F','S'), + Block('L','Y'), + Block('P','C'), + Block('Z','M') + ]; + +void printAndCanMakeWord(String word, Block[] blocks) { + print("``word``:``canMakeWord(word, blocks)``"); +} + +class Block(Character firstLetter, Character secondLetter) { + shared Character firstLetterUpper = firstLetter.uppercased; + shared Character secondLetterUpper = secondLetter.uppercased; + + shared Boolean containsLetter(Character letter) + => let (letterUpper = letter.uppercased) + firstLetterUpper == letterUpper || secondLetterUpper == letterUpper; + + shared actual String string = "``firstLetterUpper``,``secondLetterUpper``"; +} + +Boolean canMakeWord(String word, Block[] blocks) + => canMakeWordRecursive(word.uppercased.sequence(), 0, blocks, word.indexes()); + +Boolean canMakeWordRecursive(Character[] word, + Integer index, + Block[] remainingBlocks, + Integer[] remainingLetterIndexes) + => if (exists wordFirst = word.first, // first is the Ceylon attribute for head + exists remainingBlock = remainingBlocks.find((remainingBlock) => remainingBlock.containsLetter(wordFirst))) + then + let (myRemainingLetterIndexes = remainingLetterIndexes.filter((theIndex) => index != theIndex).sequence()) + if (myRemainingLetterIndexes.empty) + then true + else canMakeWordRecursive(word.rest,// rest is the Ceylon attribute for tail + index+1, // move through the letter indexes + remainingBlocks.filter((block) => remainingBlock != block).sequence(), // one less block + myRemainingLetterIndexes) + else false; diff --git a/Task/ABC-Problem/ERRE/abc-problem.erre b/Task/ABC-Problem/ERRE/abc-problem.erre new file mode 100644 index 0000000000..0076fdc57d --- /dev/null +++ b/Task/ABC-Problem/ERRE/abc-problem.erre @@ -0,0 +1,28 @@ +PROGRAM BLOCKS + +!$INCLUDE="PC.LIB" + +PROCEDURE CANMAKEWORD(WORD$) + LOCAL B$,P% + B$=BLOCKS$ + PRINT(WORD$;" -> ";) + P%=INSTR(B$,CHR$(ASC(WORD$) AND $DF)) + WHILE P%>0 AND WORD$>"" DO + CHANGE(B$,P%-1+(P% MOD 2),".."->B$) + WORD$=MID$(WORD$,2) + EXIT IF WORD$="" + P%=INSTR(B$,CHR$(ASC(WORD$) AND $DF)) + END WHILE + IF WORD$>"" THEN PRINT("False") ELSE PRINT("True") END IF +END PROCEDURE + +BEGIN + BLOCKS$="BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM" + CANMAKEWORD("A") + CANMAKEWORD("BARK") + CANMAKEWORD("BOOK") + CANMAKEWORD("TREAT") + CANMAKEWORD("COMMON") + CANMAKEWORD("SQUAD") + CANMAKEWORD("Confuse") +END PROGRAM diff --git a/Task/ABC-Problem/EchoLisp/abc-problem.echolisp b/Task/ABC-Problem/EchoLisp/abc-problem.echolisp new file mode 100644 index 0000000000..20f3578009 --- /dev/null +++ b/Task/ABC-Problem/EchoLisp/abc-problem.echolisp @@ -0,0 +1,16 @@ +(lib 'list) ;; list-delete + +(define BLOCKS '("BO" "XK" "DQ" "CP" "NA" "GT" "RE" "TG" "QD" "FS" + "JW" "HU" "VI" "AN" "OB" "ER" "FS" "LY" "PC" "ZM" )) + +(define WORDS '("A" "BARK" "BOOK" "TREAT" "COMMON" "SQUAD" "CONFUSE")) + +(define (spell word blocks) + (cond + ((string-empty? word) #t) + ((empty? blocks) #f) + (else + (for/or [(block blocks)] + #:continue (not (string-match block (string-first word))) + (spell (string-rest word) (list-delete blocks block)))))) + diff --git a/Task/ABC-Problem/Harbour/abc-problem.harbour b/Task/ABC-Problem/Harbour/abc-problem.harbour new file mode 100644 index 0000000000..8813481dd4 --- /dev/null +++ b/Task/ABC-Problem/Harbour/abc-problem.harbour @@ -0,0 +1,32 @@ +PROCEDURE Main() + + LOCAL cStr + + FOR EACH cStr IN { "A", "BARK", "BooK", "TrEaT", "comMON", "sQuAd", "Confuse" } + ? PadL( cStr, 10 ), iif( Blockable( cStr ), "can", "cannot" ), "be spelled with blocks." + NEXT + + RETURN + +STATIC FUNCTION Blockable( cStr ) + + LOCAL blocks := { ; + "BO", "XK", "DQ", "CP", "NA", "GT", "RE", "TG", "QD", "FS", ; + "JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM" } + + LOCAL cFinal := "" + LOCAL i, j + + cStr := Upper( cStr ) + + FOR i := 1 TO Len( cStr ) + FOR EACH j IN blocks + IF SubStr( cStr, i, 1 ) $ j + cFinal += SubStr( cStr, i, 1 ) + j := "" + EXIT + ENDIF + NEXT + NEXT + + RETURN cFinal == cStr diff --git a/Task/ABC-Problem/Nim/abc-problem.nim b/Task/ABC-Problem/Nim/abc-problem.nim new file mode 100644 index 0000000000..7fbc590119 --- /dev/null +++ b/Task/ABC-Problem/Nim/abc-problem.nim @@ -0,0 +1,33 @@ +from strutils import contains, format, toUpper +from sequtils import delete + +proc canMakeWord(s: string): bool = + var + abcs = @["BO", "XK", "DQ", "CP", "NA", "GT", "RE", "TG", "QD", "FS", + "JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM"] + matched = newSeq[string]() + + if s.len > abcs.len: + return false + + for i in 0 .. s.len - 1: + var + letter = s[i].toUpper + n = 0 + for abc in abcs: + if contains(abc, letter): + delete(abcs, n, n) + matched = matched & abc + break + else: + inc(n) + + if matched.len == s.len: + return true + else: + return false + +var words = @["A", "bArK", "BOOK", "treat", "common", "sQuAd", "CONFUSE"] +for word in words: + echo format("Can the blocks make the word \"$1\"? $2", word, + (if canMakeWord(word): "yes" else: "no")) diff --git a/Task/ABC-Problem/Oforth/abc-problem.oforth b/Task/ABC-Problem/Oforth/abc-problem.oforth new file mode 100644 index 0000000000..6689704078 --- /dev/null +++ b/Task/ABC-Problem/Oforth/abc-problem.oforth @@ -0,0 +1,10 @@ +["BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS","JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"] const: ABCBlocks + +: canMakeWord(w, blocks) +| i | + w isEmpty ifTrue: [ true return ] + blocks size loop: i [ + blocks at(i) include(w first toUpper) ifFalse: [ continue ] + canMakeWord(w right(w size 1 -), blocks del(i, i)) ifTrue: [ true return ] + ] + false ; diff --git a/Task/ABC-Problem/Phix/abc-problem.phix b/Task/ABC-Problem/Phix/abc-problem.phix new file mode 100644 index 0000000000..67643e16ec --- /dev/null +++ b/Task/ABC-Problem/Phix/abc-problem.phix @@ -0,0 +1,44 @@ +-- Here is my recursive solution which also solves the extra problems on the discussion page: + +sequence blocks = {"BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS", + "JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"} + +sequence words = {"","A","BarK","BOOK","TrEaT","COMMON","SQUAD","CONFUSE"} + +--sequence blocks = {"US","TZ","AO","QA"} +--sequence words = {"AuTO"} + +--sequence blocks = {"AB","AB","AC","AC"} +--sequence words = {"abba"} + +sequence used = repeat(0,length(blocks)) + +function ABC_Solve(sequence word, integer idx) +integer ch +integer res = 0 + if idx>length(word) then + res = 1 + else + ch = word[idx] + for k=1 to length(blocks) do + if used[k]=0 + and find(ch,blocks[k]) then + used[k] = 1 + res = ABC_Solve(word,idx+1) + used[k] = 0 + if res then exit end if + end if + end for + end if + return res +end function + +constant TF = {"False","True"} +procedure ABC_Problem() + for i=1 to length(words) do + printf(1,"%s: %s\n",{words[i],TF[ABC_Solve(upper(words[i]),1)+1]}) + end for + if getc(0) then end if +end procedure + + ABC_Problem() diff --git a/Task/ABC-Problem/Ring/abc-problem.ring b/Task/ABC-Problem/Ring/abc-problem.ring new file mode 100644 index 0000000000..6272d4863c --- /dev/null +++ b/Task/ABC-Problem/Ring/abc-problem.ring @@ -0,0 +1,24 @@ +Blocks = [ :BO, :XK, :DQ, :CP, :NA, :GT, :RE, :TG, :QD, :FS, :JW, :HU, :VI, :AN, :OB, :ER, :FS, :LY, :PC, :ZM ] +Words = [ :A, :BARK, :BOOK, :TREAT, :COMMON, :SQUAD, :CONFUSE ] + +for x in words +see '>>> can_make_word("' + upper(x) + '")' + nl +if checkword(x,blocks) see "True" + nl +else see "False" + nl +ok +next + +func CheckWord Word,Blocks +cBlocks = BLocks +for x in word +Found = false +for y = 1 to len(cblocks) +if x = cblocks[y][1] or x = cblocks[y][2] +cblocks[y] = "--" +found = true +exit +ok +next +if found = false return false ok +next +return true diff --git a/Task/ABC-Problem/SPAD/abc-problem.spad b/Task/ABC-Problem/SPAD/abc-problem.spad new file mode 100644 index 0000000000..9478d7ec8d --- /dev/null +++ b/Task/ABC-Problem/SPAD/abc-problem.spad @@ -0,0 +1,23 @@ +blocks:List Tuple Symbol:= _ + [(B,O),(X,K),(D,Q),(C,P),(N,A),(G,T),(R,E),(T,G),(Q,D),(F,S), _ + (J,W),(H,U),(V,I),(A,N),(O,B),(E,R),(F,S),(L,Y),(P,C),(Z,M)] + + +findComb(l:List List NNI):List List NNI == + #l=0 => [] + #l=1 => [[s] for s in first l] + r:List List NNI:=[] + for y in findComb(rest l) repeat + r:=concat(r,[concat(x,y) for x in first l]) + return r + +canMakeWord?(word,blocks) == + word:=upperCase word + bchr:=[map(char,map(string,s::List(Symbol))) for s in blocks] + c:=[[j for j in 1..#blocks | member?(word.k,bchr.j)] for k in 1..#word] + reduce(_or,[test(#removeDuplicates(l)=#word) for l in findComb(c)]) + + +Example:=["a","bark","book","treat","common","squad","confuse"] + +[canMakeWord?(s,blocks) for s in Example] diff --git a/Task/ABC-Problem/SequenceL/abc-problem-1.sequencel b/Task/ABC-Problem/SequenceL/abc-problem-1.sequencel new file mode 100644 index 0000000000..57f03ba268 --- /dev/null +++ b/Task/ABC-Problem/SequenceL/abc-problem-1.sequencel @@ -0,0 +1,29 @@ +import ; +import ; + +main(args(2)) := + let + result[i] := args[i] ++ ": " ++ boolToString(can_make_word(args[i], InitBlocks)); + in + delimit(result, '\n'); + +InitBlocks := ["BO", "XK", "DQ", "CP", "NA", "GT", "RE", "TG", "QD", "FS", "JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM"]; + +can_make_word(word(1), blocks(2)) := + let + choices[i] := i when some(blocks[i] = toUpper(head(word))); + blocksAfterChoice[i] := blocks[(1 ... (choices[i] - 1)) ++ ((choices[i] + 1) ... size(blocks))]; + in + true when size(word) = 0 + else + false when size(choices) = 0 + else + some(can_make_word(tail(word), blocksAfterChoice)); + +toUpper(letter(0)) := + let + ascii := asciiToInt(letter); + in + letter when ascii >= 65 and ascii <= 90 + else + intToAscii(ascii - 32); diff --git a/Task/ABC-Problem/SequenceL/abc-problem-2.sequencel b/Task/ABC-Problem/SequenceL/abc-problem-2.sequencel new file mode 100644 index 0000000000..a82214ee48 --- /dev/null +++ b/Task/ABC-Problem/SequenceL/abc-problem-2.sequencel @@ -0,0 +1,31 @@ +import ; +import ; +import ; + +main(args(2)) := + let + result[i] := args[i] ++ ": " ++ boolToString(can_make_word(args[i], InitBlocks)); + in + delimit(result, '\n'); + +InitBlocks := "BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM"; + +can_make_word(word(1), blocks(1)) := + let + regEx := "(\\a" ++ [toUpper(head(word))] ++ "|" ++ [toUpper(head(word))] ++ "\\a)"; + + newBlocks := replaceFirst(blocks, regEx, ""); + in + true when size(word) = 0 + else + false when size(newBlocks) = size(blocks) + else + can_make_word(tail(word), newBlocks); + +toUpper(letter(0)) := + let + ascii := asciiToInt(letter); + in + letter when ascii >= 65 and ascii <= 90 + else + intToAscii(ascii - 32); diff --git a/Task/ABC-Problem/Sidef/abc-problem-1.sidef b/Task/ABC-Problem/Sidef/abc-problem-1.sidef new file mode 100644 index 0000000000..776682a71a --- /dev/null +++ b/Task/ABC-Problem/Sidef/abc-problem-1.sidef @@ -0,0 +1,17 @@ +func can_make_word(word, blocks) { + + blocks.map! { |b| b.uc.chars.sort.join }.freq! + + func(word, blocks) { + var char = word.shift + var candidates = blocks.keys.grep { |k| 0 <= k.index(char) } + + for candidate in candidates { + blocks{candidate} <= 0 && next; + local blocks{candidate} = (blocks{candidate} - 1); + return true if (word.is_empty || __FUNC__(word, blocks)); + } + + return false; + }(word.uc.chars, blocks) +} diff --git a/Task/ABC-Problem/Sidef/abc-problem-2.sidef b/Task/ABC-Problem/Sidef/abc-problem-2.sidef new file mode 100644 index 0000000000..a989e23221 --- /dev/null +++ b/Task/ABC-Problem/Sidef/abc-problem-2.sidef @@ -0,0 +1,19 @@ +var b1 = %w(BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM) +var b2 = %w(US TZ AO QA) + +var tests = [ + ["A", true, b1], + ["BARK", true, b1], + ["BOOK", false, b1], + ["TREAT", true, b1], + ["COMMON", false, b1], + ["SQUAD", true, b1], + ["CONFUSE", true, b1], + ["auto", true, b2], +]; + +tests.each { |t| + var bool = can_make_word(t[0], t[2]); + say ("%7s -> %s" % (t[0], bool)); + assert(bool == t[1]) +} diff --git a/Task/ABC-Problem/Swift/abc-problem.swift b/Task/ABC-Problem/Swift/abc-problem.swift new file mode 100644 index 0000000000..c96c8cff6c --- /dev/null +++ b/Task/ABC-Problem/Swift/abc-problem.swift @@ -0,0 +1,33 @@ +import Foundation + +func Blockable(str: String) -> Bool { + + var blocks = [ + "BO", "XK", "DQ", "CP", "NA", "GT", "RE", "TG", "QD", "FS", + "JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM" ] + + var strUp = str.uppercaseString + var final = "" + + for char: Character in strUp { + var CharString: String = ""; CharString.append(char) + for j in 0.. String { + return can ? "can" : "cannot" +} + +for str in [ "A", "BARK", "BooK", "TrEaT", "comMON", "sQuAd", "Confuse" ] { + println("'\(str)' \(CanOrNot(Blockable(str))) be spelled with blocks.") +} diff --git a/Task/ABC-Problem/jq/abc-problem-1.jq b/Task/ABC-Problem/jq/abc-problem-1.jq new file mode 100644 index 0000000000..b6716926dc --- /dev/null +++ b/Task/ABC-Problem/jq/abc-problem-1.jq @@ -0,0 +1,29 @@ +# when_index(cond;ary) returns the index of the first element in ary +# that satisfies cond; it uses a helper function that takes advantage +# of tail-recursion optimization in recent versions of jq. +def index_when(cond; ary): + # state variable: counter + def when: if . >= (ary | length) then null + elif ary[.] | cond then . + else (.+1) | when + end; + 0 | when; + +# Attempt to match a single letter with a block; +# return null if no match, else the remaining blocks +def match_letter(letter): + . as $ary | index_when( index(letter); $ary ) as $ix + | if $ix == null then null + else del( .[$ix] ) + end; + +# Usage: string | abc(blocks) +def abc(blocks): + if length == 0 then true + else + .[0:1] as $letter + | (blocks | match_letter( $letter )) as $blks + | if $blks == null then false + else .[1:] | abc($blks) + end + end; diff --git a/Task/ABC-Problem/jq/abc-problem-2.jq b/Task/ABC-Problem/jq/abc-problem-2.jq new file mode 100644 index 0000000000..74d1e9c8a2 --- /dev/null +++ b/Task/ABC-Problem/jq/abc-problem-2.jq @@ -0,0 +1,5 @@ +def task: + ["BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS", + "JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"] as $blocks + | ("A", "BARK","BOOK","TREAT","COMMON","SQUAD","CONFUSE") + | "\(.) : \( .|abc($blocks) )" ;task diff --git a/Task/AKS-test-for-primes/EchoLisp/aks-test-for-primes-1.echolisp b/Task/AKS-test-for-primes/EchoLisp/aks-test-for-primes-1.echolisp new file mode 100644 index 0000000000..651419ec27 --- /dev/null +++ b/Task/AKS-test-for-primes/EchoLisp/aks-test-for-primes-1.echolisp @@ -0,0 +1,19 @@ +(lib 'math.lib) +;; 1 - x^p : P = (1 0 0 0 ... 0 -1) +(define (mono p) (append (list 1) (make-list (1- p) 0) (list -1))) + +;; compute (x-1)^p , p >= 1 +(define (aks-poly p) + (poly-pow (list -1 1) p)) + +;; +(define (show-them n) + (for ((p (in-range 1 n))) + (writeln 'p p (poly->string 'x (aks-poly p))))) + +;; aks-test +;; P = (x-1)^p + 1 - x^p +(define (aks-test p) + (let ((P (poly-add (mono p) (aks-poly p))) + (test (lambda(a) (zero? (modulo a p))))) ;; p divides a[i] ? + (apply and (map test P)))) ;; returns #t if true for all a[i] diff --git a/Task/AKS-test-for-primes/EchoLisp/aks-test-for-primes-2.echolisp b/Task/AKS-test-for-primes/EchoLisp/aks-test-for-primes-2.echolisp new file mode 100644 index 0000000000..b349d6b79e --- /dev/null +++ b/Task/AKS-test-for-primes/EchoLisp/aks-test-for-primes-2.echolisp @@ -0,0 +1,21 @@ +(show-them 13) → +p 1 x -1 +p 2 x^2 -2x +1 +p 3 x^3 -3x^2 +3x -1 +p 4 x^4 -4x^3 +6x^2 -4x +1 +p 5 x^5 -5x^4 +10x^3 -10x^2 +5x -1 +p 6 x^6 -6x^5 +15x^4 -20x^3 +15x^2 -6x +1 +p 7 x^7 -7x^6 +21x^5 -35x^4 +35x^3 -21x^2 +7x -1 +p 8 x^8 -8x^7 +28x^6 -56x^5 +70x^4 -56x^3 +28x^2 -8x +1 +p 9 x^9 -9x^8 +36x^7 -84x^6 +126x^5 -126x^4 +84x^3 -36x^2 +9x -1 +p 10 x^10 -10x^9 +45x^8 -120x^7 +210x^6 -252x^5 +210x^4 -120x^3 +45x^2 -10x +1 +p 11 x^11 -11x^10 +55x^9 -165x^8 +330x^7 -462x^6 +462x^5 -330x^4 +165x^3 -55x^2 +11x -1 +p 12 x^12 -12x^11 +66x^10 -220x^9 +495x^8 -792x^7 +924x^6 -792x^5 +495x^4 -220x^3 +66x^2 -12x +1 + +(lib 'bigint) +Lib: bigint.lib loaded. + +(for ((p (in-range 2 100))) + (when (aks-test p) (write p))) → + +2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 diff --git a/Task/AKS-test-for-primes/FreeBASIC/aks-test-for-primes.freebasic b/Task/AKS-test-for-primes/FreeBASIC/aks-test-for-primes.freebasic new file mode 100644 index 0000000000..91df9ad83f --- /dev/null +++ b/Task/AKS-test-for-primes/FreeBASIC/aks-test-for-primes.freebasic @@ -0,0 +1,75 @@ +'METHOD -- Use the Pascal triangle to retrieve the coefficients +'UPPER LIMIT OF FREEBASIC ULONGINT GETS PRIMES UP TO 70 +Sub string_split(s_in As String,char As String,result() As String) + Dim As String s=s_in,var1,var2 + Dim As Integer n,pst + #macro split(stri,char,var1,var2) + pst=Instr(stri,char) + var1="":var2="" + If pst<>0 Then + var1=Mid(stri,1,pst-1) + var2=Mid(stri,pst+1) + Else + var1=stri + End If + Redim Preserve result(1 To 1+n-((Len(var1)>0)+(Len(var2)>0))) + result(n+1)=var1 + #endmacro + Do + split(s,char,var1,var2):n=n+1:s=var2 + Loop Until var2="" + Redim Preserve result(1 To Ubound(result)-1) +End Sub + +'Get Pascal triangle components +Function pasc(n As Integer,flag As Integer=0) As String + n+=1 + Dim As Ulongint V(n):V(1)=1ul + Dim As String s,sign + For r As Integer= 2 To n + s="" + For i As Integer = r To 1 Step -1 + V(i) += V(i-1) + If i Mod 2=1 Then sign="" Else sign="-" + s+=sign+Str(V(i))+"," + Next i + Next r + If flag Then 'formatted output + Dim As String i,i2,i3,g + Redim As String a(0) + string_split(s,",",a()) + For n1 As Integer=1 To Ubound(a) + If Left(a(n1),1)="-" Then sign="" Else sign="+" + If n1=Ubound(a) Then i2="" Else i2=a(n1) + If n1=2 Then i3="x" Else i3="x^"+Str(n1-1) + If n1=1 Then i="":sign=" " Else i=i3 + g+=sign+i2+i+" " + Next n1 + g="(x-1)^"+Str(n-1)+" = "+g + Return g + End If + Return s +End Function + +Function isprime(num As Integer) As Integer + Redim As String a(0) + string_split(pasc(num),",",a()) + For n As Integer=Lbound(a)+1 To Ubound(a)-1 + If (Valulng(Ltrim(a(n),"-"))) Mod num<>0 Then Return 0 + Next n + Return -1 +End Function +'==================================== +'Formatted output +For n As Integer=1 To 9 + Print pasc(n,1) +Next n + +Print +'Limit of Freebasic Ulongint sets about 70 max +Print "Primes up to 70:" +For n As Integer=2 To 70 + If isprime(n) Then Print n; +Next n + +Sleep diff --git a/Task/AKS-test-for-primes/Idris/aks-test-for-primes.idris b/Task/AKS-test-for-primes/Idris/aks-test-for-primes.idris new file mode 100644 index 0000000000..aa68ed3096 --- /dev/null +++ b/Task/AKS-test-for-primes/Idris/aks-test-for-primes.idris @@ -0,0 +1,70 @@ +import Data.Vect + +-- Computes Binomial Coefficients +binCoef : Nat -> Nat -> Nat +binCoef _ Z = (S Z) +binCoef (S n) (S k) = + if n == k then (S Z) else ((S n) * (binCoef n k)) `div` (S k) + +-- Binomial Expansion Of (x - 1)^p +expansion : (n : Nat) -> Vect (S n) Integer +expansion n = expansion' n 1 + where + expansion' : (n : Nat) -> Integer -> Vect (S n) Integer + expansion' (S m) s = s * (toIntegerNat $ binCoef n (n `minus` (S m))) :: + expansion' m (s * -1) + expansion' Z s = [s] + + +showExpansion : Vect n Integer -> String +showExpansion [] = " " +showExpansion (x::xs) {n = S k} = (if x < 0 then "-" else "") ++ + term x k ++ showExpansion' xs + where + term : Integer -> Nat -> String + term x n = if n == 0 then (show (abs x)) else + (if (abs x) == 1 then "" else + (show (abs x))) ++ "x" ++ + (if n == 1 then "" else "^" ++ show n) + + sign : Integer -> String + sign x = if x >= 0 then " + " else " - " + + showExpansion' : Vect m Integer -> String + showExpansion' [] = "" + showExpansion' (y::ys) {m = S k} = sign y ++ term y k ++ + showExpansion' ys + + +natToFin' : (m : Nat) -> Fin (S m) +natToFin' n with (natToFin n (S n)) + natToFin' n | Just y = y + + +isPrime : Nat -> Bool +isPrime Z = False +isPrime (S Z ) = False +isPrime n = foldl (\divs, term => divs && (term `mod` (toIntegerNat n)) == 0) + True (fullExpansion $ expansion n) + + -- (x - 1)^p - ((x^p) - 1) + where fullExpansion : Vect (S m) Integer -> Vect (S m) Integer + fullExpansion (x::xs) {m} = updateAt (natToFin' m) (+1) $ (x-1)::xs + + +printExpansions : Nat -> IO () +printExpansions n = do + putStrLn "-- p: (x-1)^p for small p" + sequence_ $ map printExpansion [0..n] + where printExpansion : Nat -> IO () + printExpansion n = do + print n + putStr ": " + putStrLn $ showExpansion $ expansion n + + +main : IO() +main = do + printExpansions 10 + putStrLn "\n-- Primes Up To 100:" + putStrLn $ show $ filter isPrime [0..100] diff --git a/Task/AKS-test-for-primes/Oforth/aks-test-for-primes.oforth b/Task/AKS-test-for-primes/Oforth/aks-test-for-primes.oforth new file mode 100644 index 0000000000..709c0c889d --- /dev/null +++ b/Task/AKS-test-for-primes/Oforth/aks-test-for-primes.oforth @@ -0,0 +1,13 @@ +: nextCoef(prev) +| i | + ListBuffer new dup add(0) + prev size 1- loop: i [ dup add(prev at(i) prev at(i 1+) - ) ] + dup add(0) ; + +: coefs(n) [ 0, 1, 0 ] #nextCoef times(n) extract(2, n 2 + ) ; +: isPrime(n) coefs(n) extract(2, n) conform(#[n mod 0 == ]) ; + +: aks +| i | + 0 10 for: i [ System.Out "(x-1)^" << i << " = " << coefs(i) << cr ] + 50 seq filter(#isPrime) apply(#[ print " " print ]) printcr ; diff --git a/Task/AKS-test-for-primes/Phix/aks-test-for-primes.phix b/Task/AKS-test-for-primes/Phix/aks-test-for-primes.phix new file mode 100644 index 0000000000..a30261e622 --- /dev/null +++ b/Task/AKS-test-for-primes/Phix/aks-test-for-primes.phix @@ -0,0 +1,80 @@ +-- Does not work for primes above 53, which is actually beyond the original task anyway. +-- Translated from the C version, just about everything is (working) out-by-1, what fun. + +sequence c = repeat(0,100) + +procedure coef(integer n) +-- out-by-1, ie coef(1)==^0, coef(2)==^1, coef(3)==^2 etc. + c[n] = 1 + for i=n-1 to 2 by -1 do + c[i] = c[i]+c[i-1] + end for +end procedure + +function is_prime(integer n) + coef(n+1); -- (I said it was out-by-1) + for i=2 to n-1 do -- (technically "to n" is more correct) + if remainder(c[i],n)!=0 then + return 0 + end if + end for + return 1 +end function + +procedure show(integer n) +-- (As per coef, this is (working) out-by-1) +object ci + for i=n to 1 by -1 do + ci = c[i] + if ci=1 then + if remainder(n-i,2)=0 then + if i=1 then + if n=1 then + ci = "1" + else + ci = "+1" + end if + else + ci = "" + end if + else + ci = "-1" + end if + else + if remainder(n-i,2)=0 then + ci = sprintf("+%d",ci) + else + ci = sprintf("-%d",ci) + end if + end if + if i=1 then -- ie ^0 + printf(1,"%s",{ci}) + elsif i=2 then -- ie ^1 + printf(1,"%sx",{ci}) + else + printf(1,"%sx^%d",{ci,i-1}) + end if + end for +end procedure + +procedure AKS_test_for_primes() + for n=1 to 10 do -- (0 to 9 really) + coef(n); + printf(1,"(x-1)^%d = ", n-1); + show(n); + puts(1,'\n'); + end for + + puts(1,"\nprimes (<=53):"); +-- coef(2); -- (needed to reset c, if we want to avoid saying 1 is prime...) + c[2] = 1 -- (this manages "", which is all that call did anyway...) + for n = 2 to 53 do + if is_prime(n) then + printf(1," %d", n); + end if + end for + puts(1,'\n'); + if getc(0) then end if +end procedure + + AKS_test_for_primes() diff --git a/Task/AKS-test-for-primes/Sidef/aks-test-for-primes.sidef b/Task/AKS-test-for-primes/Sidef/aks-test-for-primes.sidef new file mode 100644 index 0000000000..41ccf9ee63 --- /dev/null +++ b/Task/AKS-test-for-primes/Sidef/aks-test-for-primes.sidef @@ -0,0 +1,23 @@ +func binprime(p) { + p >= 2 || return false + for i in (1 .. p>>1) { + (binomial(p, i) % p) && return false + } + return true +} + +func coef(n, e) { + (e == 0) && return "#{n}" + (n == 1) && (n = "") + (e == 1) ? "#{n}x" : "#{n}x^#{e}" +} + +func binpoly(p) { + join(" ", coef(1, p), ^p -> map {|i| + join(" ", %w(+ -)[(p-i)&1], coef(binomial(p, i), i)) + }.reverse...) +} + +say "expansions of (x-1)^p:" +for i in ^10 { say binpoly(i) } +say "Primes to 80: [#{2..80 -> grep { binprime(_) }.join(' ')}]" diff --git a/Task/AKS-test-for-primes/Swift/aks-test-for-primes.swift b/Task/AKS-test-for-primes/Swift/aks-test-for-primes.swift new file mode 100644 index 0000000000..b644dae8ae --- /dev/null +++ b/Task/AKS-test-for-primes/Swift/aks-test-for-primes.swift @@ -0,0 +1,80 @@ +func polynomialCoeffs(n: Int) -> [Int] { + var result = [Int](count : n+1, repeatedValue : 0) + + result[0]=1 + for i in 1 ..< n/2+1 { //Progress up, until reaching the middle value + result[i] = result[i-1] * (n-i+1)/i; + } + for i in n/2+1 ..< n+1 { //Copy the inverse of the first part + result[i] = result[n-i]; + } + // Take into account the sign + for i in stride(from: 1, through: n, by: 2) { + result[i] = -result[i] + } + + return result +} + +func isPrime(n: Int) -> Bool { + + var coeffs = polynomialCoeffs(n) + + coeffs[0]-- + coeffs[n]++ + + for i in 1 ... n { + if coeffs[i]%n != 0 { + return false + } + } + + return true +} + +for i in 0...10 { + + let coeffs = polynomialCoeffs(i) + + print("(x-1)^\(i) = ") + if i == 0 { + print("1") + } else { + if i == 1 { + print("x") + } else { + print("x^\(i)") + if i == 2 { + print("\(coeffs[i-1])x") + } else { + for j in 1...(i - 2) { + if j%2 == 0 { + print("+\(coeffs[j])x^\(i-j)") + } else { + print("\(coeffs[j])x^\(i-j)") + } + } + if (i-1)%2 == 0 { + print("+\(coeffs[i-1])x") + } else { + print("\(coeffs[i-1])x") + } + } + } + if i%2 == 0 { + print("+\(coeffs[i])") + } else { + print("\(coeffs[i])") + } + } + println() +} + +println() +print("Primes under 50 : ") + +for i in 1...50 { + if isPrime(i) { + print("\(i) ") + } +} diff --git a/Task/AKS-test-for-primes/jq/aks-test-for-primes-1.jq b/Task/AKS-test-for-primes/jq/aks-test-for-primes-1.jq new file mode 100644 index 0000000000..857057da4d --- /dev/null +++ b/Task/AKS-test-for-primes/jq/aks-test-for-primes-1.jq @@ -0,0 +1,35 @@ +# add_pairs is a helper function for optpascal/0 +# Input: an OptPascal array +# Output: the next OptPascal array (obtained by adding adjacent items, +# but if the last two items are unequal, then their sum is repeated) +def add_pairs: + if length <= 1 then . + elif length == 2 then (.[0] + .[1]) as $S + | if (.[0] == .[1]) then [$S] + else [$S,$S] + end + else [.[0] + .[1]] + (.[1:]|add_pairs) + end; + +# Input: an OptPascal row +# Output: the next OptPascalRow +def next_optpascal: [1] + add_pairs; + +# generate a stream of OptPascal arrays, beginning with [] +def optpascals: [] | recurse(next_optpascal); + +# generate a stream of Pascal arrays +def pascals: + # pascalize takes as input an OptPascal array and produces + # the corresponding Pascal array; + # if the input ends in a pair, then peel it off before reversing it. + def pascalize: + . + ((if .[-2] == .[-1] then .[0:-2] else .[0:-1] end) | reverse); + + optpascals | pascalize; + +# Input: integer n +# Output: the n-th Pascal row +def pascal: nth(.; pascals); + +def optpascal: nth(.; optpascals); diff --git a/Task/AKS-test-for-primes/jq/aks-test-for-primes-2.jq b/Task/AKS-test-for-primes/jq/aks-test-for-primes-2.jq new file mode 100644 index 0000000000..ffeaea12b7 --- /dev/null +++ b/Task/AKS-test-for-primes/jq/aks-test-for-primes-2.jq @@ -0,0 +1,4 @@ +def coefficients: + def alternate_signs: . as $in + | reduce range(0; length) as $i ([]; . + [$in[$i] * (if $i % 2 == 0 then 1 else -1 end )]); + (.+1) | pascal | alternate_signs; diff --git a/Task/AKS-test-for-primes/jq/aks-test-for-primes-3.jq b/Task/AKS-test-for-primes/jq/aks-test-for-primes-3.jq new file mode 100644 index 0000000000..25fc5316d0 --- /dev/null +++ b/Task/AKS-test-for-primes/jq/aks-test-for-primes-3.jq @@ -0,0 +1 @@ +range(0;8) | "Coefficient for (x - 1)^\(.): \(coefficients)" diff --git a/Task/AKS-test-for-primes/jq/aks-test-for-primes-4.jq b/Task/AKS-test-for-primes/jq/aks-test-for-primes-4.jq new file mode 100644 index 0000000000..0f47d461f1 --- /dev/null +++ b/Task/AKS-test-for-primes/jq/aks-test-for-primes-4.jq @@ -0,0 +1,8 @@ +Coefficients for (x - 1)^0: [1] +Coefficients for (x - 1)^1: [1,-1] +Coefficients for (x - 1)^2: [1,-2,1] +Coefficients for (x - 1)^3: [1,-3,3,-1] +Coefficients for (x - 1)^4: [1,-4,6,-4,1] +Coefficients for (x - 1)^5: [1,-5,10,-10,5,-1] +Coefficients for (x - 1)^6: [1,-6,15,-20,15,-6,1] +Coefficients for (x - 1)^7: [1,-7,21,-35,35,-21,7,-1] diff --git a/Task/AKS-test-for-primes/jq/aks-test-for-primes-5.jq b/Task/AKS-test-for-primes/jq/aks-test-for-primes-5.jq new file mode 100644 index 0000000000..1cefdab866 --- /dev/null +++ b/Task/AKS-test-for-primes/jq/aks-test-for-primes-5.jq @@ -0,0 +1,6 @@ +def is_prime: + . as $N + | if . < 2 then false + else (1+.) | optpascal + | all( .[2:][]; . % $N == 0 ) + end; diff --git a/Task/AKS-test-for-primes/jq/aks-test-for-primes-6.jq b/Task/AKS-test-for-primes/jq/aks-test-for-primes-6.jq new file mode 100644 index 0000000000..26762baaa8 --- /dev/null +++ b/Task/AKS-test-for-primes/jq/aks-test-for-primes-6.jq @@ -0,0 +1 @@ +range(0;36) | select(is_prime) diff --git a/Task/AKS-test-for-primes/jq/aks-test-for-primes-7.jq b/Task/AKS-test-for-primes/jq/aks-test-for-primes-7.jq new file mode 100644 index 0000000000..d3c9c34697 --- /dev/null +++ b/Task/AKS-test-for-primes/jq/aks-test-for-primes-7.jq @@ -0,0 +1,11 @@ +2 +3 +5 +7 +11 +13 +17 +19 +23 +29 +31 diff --git a/Task/AKS-test-for-primes/jq/aks-test-for-primes-8.jq b/Task/AKS-test-for-primes/jq/aks-test-for-primes-8.jq new file mode 100644 index 0000000000..faf0997b8c --- /dev/null +++ b/Task/AKS-test-for-primes/jq/aks-test-for-primes-8.jq @@ -0,0 +1 @@ +[range(0;50) | select(is_prime)] diff --git a/Task/AKS-test-for-primes/jq/aks-test-for-primes-9.jq b/Task/AKS-test-for-primes/jq/aks-test-for-primes-9.jq new file mode 100644 index 0000000000..20a5c1660c --- /dev/null +++ b/Task/AKS-test-for-primes/jq/aks-test-for-primes-9.jq @@ -0,0 +1 @@ +[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47] diff --git a/Task/Abstract-type/Apex/abstract-type.apex b/Task/Abstract-type/Apex/abstract-type.apex new file mode 100644 index 0000000000..cf26923a81 --- /dev/null +++ b/Task/Abstract-type/Apex/abstract-type.apex @@ -0,0 +1,23 @@ +// Interface +public interface PurchaseOrder { + // All other functionality excluded + Double discount(); +} + +// One implementation of the interface for customers +public class CustomerPurchaseOrder implements PurchaseOrder { + public Double discount() { + return .05; // Flat 5% discount + } +} + + +// Abstract Class +public abstract class AbstractExampleClass { + protected abstract Integer abstractMethod(); +} + +// Complete the abstract class by implementing its abstract method +public class Class1 extends AbstractExampleClass { + public override Integer abstractMethod() { return 5; } +} diff --git a/Task/Abstract-type/FreeBASIC/abstract-type.freebasic b/Task/Abstract-type/FreeBASIC/abstract-type.freebasic new file mode 100644 index 0000000000..3dcfaa567d --- /dev/null +++ b/Task/Abstract-type/FreeBASIC/abstract-type.freebasic @@ -0,0 +1,43 @@ +' FB 1.05.0 Win64 + +Type Animal Extends Object + Declare Abstract Sub MakeNoise() +End Type + +Type Bear Extends Animal + name As String + Declare Constructor(name As String) + Declare Sub MakeNoise() +End Type + +Constructor Bear(name As String) + This.name = name +End Constructor + +Sub Bear.MakeNoise() + Print name; " is growling" +End Sub + +Type Dog Extends Animal + name As String + Declare Constructor(name As String) + Declare Sub MakeNoise() +End Type + +Constructor Dog(name As String) + This.name = name +End Constructor + +Sub Dog.MakeNoise() + Print name; " is barking" +End Sub + +Dim b As Animal Ptr = New Bear("Bruno") +b -> MakeNoise() +Dim d As Animal Ptr = New Dog("Rover") +d -> MakeNoise() +Delete b +Delete d +Print +Print "Press any key to quit program" +Sleep diff --git a/Task/Abstract-type/Lasso/abstract-type.lasso b/Task/Abstract-type/Lasso/abstract-type.lasso new file mode 100644 index 0000000000..df9800aad4 --- /dev/null +++ b/Task/Abstract-type/Lasso/abstract-type.lasso @@ -0,0 +1,21 @@ +define abstract_trait => trait { + require get(index::integer) + + provide first() => .get(1) + provide second() => .get(2) + provide third() => .get(3) + provide fourth() => .get(4) +} + +define my_type => type { + parent array + trait { import abstract_trait } + + public onCreate(...) => ..onCreate(:#rest) +} + +local(test) = my_type('a','b','c','d','e') +#test->first + "\n" +#test->second + "\n" +#test->third + "\n" +#test->fourth + "\n" diff --git a/Task/Abstract-type/Lingo/abstract-type-1.lingo b/Task/Abstract-type/Lingo/abstract-type-1.lingo new file mode 100644 index 0000000000..fb892fb15a --- /dev/null +++ b/Task/Abstract-type/Lingo/abstract-type-1.lingo @@ -0,0 +1,5 @@ +on extendAbstractClass (instance, abstractClass) + -- 'raw' instance of abstract class is made parent ("ancestor") of the + -- passed instance, i.e. the passed instance extends the abstract class + instance.setProp(#ancestor, abstractClass.rawNew()) +end diff --git a/Task/Abstract-type/Lingo/abstract-type-2.lingo b/Task/Abstract-type/Lingo/abstract-type-2.lingo new file mode 100644 index 0000000000..08df999cb7 --- /dev/null +++ b/Task/Abstract-type/Lingo/abstract-type-2.lingo @@ -0,0 +1,12 @@ +-- instantiation of abstract class by calling its constructor fails +on new (me) + -- optional: show error message as alert + _player.alert("Error:"&&me.script&&" is an abstract class") + return VOID +end + +on ring (me, n) + repeat with i = 1 to n + put me.ringtone + end repeat +end diff --git a/Task/Abstract-type/Lingo/abstract-type-3.lingo b/Task/Abstract-type/Lingo/abstract-type-3.lingo new file mode 100644 index 0000000000..501d7d1487 --- /dev/null +++ b/Task/Abstract-type/Lingo/abstract-type-3.lingo @@ -0,0 +1,11 @@ +property ringtone + +on new (me) + extendAbstractClass(me, script("AbstractClass")) + me.ringtone = "Bell" + return me +end + +on foo (me) + put "FOO" +end diff --git a/Task/Abstract-type/Lingo/abstract-type-4.lingo b/Task/Abstract-type/Lingo/abstract-type-4.lingo new file mode 100644 index 0000000000..46345665f2 --- /dev/null +++ b/Task/Abstract-type/Lingo/abstract-type-4.lingo @@ -0,0 +1,10 @@ +obj = script("MyClass").new() +obj.ring(3) +-- "Bell" +-- "Bell" +-- "Bell" + +-- this fails +test = script("AbstractClass").new() +put test +-- diff --git a/Task/Abstract-type/Lingo/abstract-type-5.lingo b/Task/Abstract-type/Lingo/abstract-type-5.lingo new file mode 100644 index 0000000000..bdc5edce01 --- /dev/null +++ b/Task/Abstract-type/Lingo/abstract-type-5.lingo @@ -0,0 +1,12 @@ +on implementsInterface (instance, interfaceClass) + interfaceFuncs = interfaceClass.handlers() + funcs = instance.handlers() + repeat with f in interfaceFuncs + if funcs.getPos(f)=0 then + -- optional: show error message as alert + _player.alert("Error:"&&instance.script&&"doesn't implement interface"&&interfaceClass) + return FALSE + end if + end repeat + return TRUE +end diff --git a/Task/Abstract-type/Lingo/abstract-type-6.lingo b/Task/Abstract-type/Lingo/abstract-type-6.lingo new file mode 100644 index 0000000000..84b37aea69 --- /dev/null +++ b/Task/Abstract-type/Lingo/abstract-type-6.lingo @@ -0,0 +1,3 @@ +on foo +on bar +on foobar diff --git a/Task/Abstract-type/Lingo/abstract-type-7.lingo b/Task/Abstract-type/Lingo/abstract-type-7.lingo new file mode 100644 index 0000000000..6df2cf21a9 --- /dev/null +++ b/Task/Abstract-type/Lingo/abstract-type-7.lingo @@ -0,0 +1,20 @@ +on new (me) + -- if this class doesn't implement all functions of the + -- interface class, instantiation fails + if not implementsInterface(me, script("InterfaceClass")) then + return VOID + end if + return me +end + +on foo (me) + put "FOO" +end + +on bar (me) + put "BAR" +end + +on foobar (me) + put "FOOBAR" +end diff --git a/Task/Abstract-type/Lingo/abstract-type-8.lingo b/Task/Abstract-type/Lingo/abstract-type-8.lingo new file mode 100644 index 0000000000..9914681982 --- /dev/null +++ b/Task/Abstract-type/Lingo/abstract-type-8.lingo @@ -0,0 +1,3 @@ +obj = script("MyClass").new() +put obj -- would show if interface is not fully implemented +-- diff --git a/Task/Abstract-type/Nim/abstract-type.nim b/Task/Abstract-type/Nim/abstract-type.nim new file mode 100644 index 0000000000..eefb4189e9 --- /dev/null +++ b/Task/Abstract-type/Nim/abstract-type.nim @@ -0,0 +1,9 @@ +type + Comparable = generic x, y + (x < y) is bool + + Container[T] = generic c + c.len is ordinal + items(c) is iterator + for value in c: + type(value) is T diff --git a/Task/Abstract-type/Nit/abstract-type.nit b/Task/Abstract-type/Nit/abstract-type.nit new file mode 100644 index 0000000000..b9aff3b648 --- /dev/null +++ b/Task/Abstract-type/Nit/abstract-type.nit @@ -0,0 +1,18 @@ +# Task: abstract type +# +# Methods without implementation are annotated `abstract`. +# +# Abstract classes and interfaces can contain abstract methods and concrete (i.e. non-abstract) methods. +# Abstract classes can also have attributes. +module abstract_type + +interface Inter + fun method1: Int is abstract + fun method2: Int do return 1 +end + +abstract class Abs + fun method1: Int is abstract + fun method2: Int do return 1 + var attr: Int +end diff --git a/Task/Abstract-type/Oforth/abstract-type-1.oforth b/Task/Abstract-type/Oforth/abstract-type-1.oforth new file mode 100644 index 0000000000..c1d9d05864 --- /dev/null +++ b/Task/Abstract-type/Oforth/abstract-type-1.oforth @@ -0,0 +1,13 @@ +Property new: Spherical(r) +Spherical method: radius @r ; +Spherical method: setRadius := r ; +Spherical method: perimeter @r 2 * Pi * ; +Spherical method: surface @r sq Pi * 4 * ; + +Object Class new: Ballon(color) +Ballon is: Spherical +Ballon method: initialize(color, r) color := color self setRadius(r) ; + +Object Class new: Planete(name) +Planete is: Spherical +Planete method: initialize(n, r) n := name self setRadius(r) ; diff --git a/Task/Abstract-type/Oforth/abstract-type-2.oforth b/Task/Abstract-type/Oforth/abstract-type-2.oforth new file mode 100644 index 0000000000..fb880a83e5 --- /dev/null +++ b/Task/Abstract-type/Oforth/abstract-type-2.oforth @@ -0,0 +1,11 @@ +: testProperty +| b p | + Ballon new($red, 0.1) ->b + System.Out "Ballon radius is : " << b radius << cr + System.Out "Ballon perimeter is : " << b perimeter << cr + System.Out "Ballon surface is : " << b surface << cr + + Planete new("Earth", 6371000.0) ->p + System.Out "Earth radius is : " << p radius << cr + System.Out "Earth perimeter is : " << p perimeter << cr + System.Out "Earth surface is : " << p surface << cr ; diff --git a/Task/Abstract-type/Red/abstract-type.red b/Task/Abstract-type/Red/abstract-type.red new file mode 100644 index 0000000000..c1ec36075c --- /dev/null +++ b/Task/Abstract-type/Red/abstract-type.red @@ -0,0 +1,45 @@ +Red [ + Title: "Abstract Type" + Original-Author: oofoe +] + +; The "shape" class is an abstract class -- it defines the "pen" +; property and "line" method, but "size" and "draw" are undefined and +; unimplemented. + +shape: make object! [ + pen: "X" + size: none + + line: func [count][loop count [prin self/pen] prin newline] + draw: does [none] +] + +; The "box" class inherits from "shape" and provides the missing +; information for drawing boxes. + +box: make shape [ + size: 10 + draw: does [loop self/size [line self/size]] +] + +; "rectangle" also inherits from "shape", but handles the +; implementation very differently. + +rectangle: make shape [ + size: 20x10 + draw: does [loop self/size/y [line self/size/x]] +] + +; Unlike some languages discussed, REBOL has absolutely no qualms +; about instantiating an "abstract" class -- that's how I created the +; derived classes of "rectangle" and "box", after all. + +print "An abstract shape (nothing):" +s: make shape [] s/draw ; Nothing happens. + +print [newline "A box:"] +b: make box [pen: "O" size: 5] b/draw + +print [newline "A rectangle:"] +r: make rectangle [size: 32x5] r/draw diff --git a/Task/Abstract-type/Sidef/abstract-type.sidef b/Task/Abstract-type/Sidef/abstract-type.sidef new file mode 100644 index 0000000000..6a1de8e381 --- /dev/null +++ b/Task/Abstract-type/Sidef/abstract-type.sidef @@ -0,0 +1,17 @@ +class A { + # must be filled in by the class which will inherit it + method abstract() { die 'Unimplemented' }; + + # can be overridden in the class, but that's not mandatory + method concrete() { say '# 42' }; +} + +class SomeClass << A { + method abstract() { + say "# made concrete in class" + } +} + +var obj = SomeClass.new; +obj.abstract(); # made concrete in class +obj.concrete(); # 42 diff --git a/Task/Abundant,-deficient-and-perfect-number-classifications/Ceylon/abundant,-deficient-and-perfect-number-classifications.ceylon b/Task/Abundant,-deficient-and-perfect-number-classifications/Ceylon/abundant,-deficient-and-perfect-number-classifications.ceylon new file mode 100644 index 0000000000..0285ee92c1 --- /dev/null +++ b/Task/Abundant,-deficient-and-perfect-number-classifications/Ceylon/abundant,-deficient-and-perfect-number-classifications.ceylon @@ -0,0 +1,13 @@ +shared void run() { + + function divisors(Integer int) => + if(int <= 1) then {} else (1..int / 2).filter((Integer element) => element.divides(int)); + + function classify(Integer int) => sum {0, *divisors(int)} <=> int; + + value counts = (1..20k).map(classify).frequencies(); + + print("deficient: ``counts[smaller] else "none"``"); + print("perfect: ``counts[equal] else "none"``"); + print("abundant: ``counts[larger] else "none"``"); +} diff --git a/Task/Abundant,-deficient-and-perfect-number-classifications/EchoLisp/abundant,-deficient-and-perfect-number-classifications.echolisp b/Task/Abundant,-deficient-and-perfect-number-classifications/EchoLisp/abundant,-deficient-and-perfect-number-classifications.echolisp new file mode 100644 index 0000000000..c4968679ed --- /dev/null +++ b/Task/Abundant,-deficient-and-perfect-number-classifications/EchoLisp/abundant,-deficient-and-perfect-number-classifications.echolisp @@ -0,0 +1,25 @@ +(lib 'math) ;; sum-divisors function + +(define-syntax-rule (++ a) (set! a (1+ a))) + +(define (abondance (N 20000)) + (define-values (delta abondant deficient perfect) '(0 0 0 0)) + (for ((n (in-range 1 (1+ N)))) + (set! delta (- (sum-divisors n) n)) + (cond + ((< delta 0) (++ deficient)) + ((> delta 0) (++ abondant)) + (else (writeln 'perfect→ n) (++ perfect)))) + + (printf "In range 1.. %d" N) + (for-each (lambda(x) (writeln x (eval x))) '(abondant deficient perfect))) + +(abondance) + perfect→ 6 + perfect→ 28 + perfect→ 496 + perfect→ 8128 + In range 1.. 20000 + abondant 4953 + deficient 15043 + perfect 4 diff --git a/Task/Abundant,-deficient-and-perfect-number-classifications/FreeBASIC/abundant,-deficient-and-perfect-number-classifications.freebasic b/Task/Abundant,-deficient-and-perfect-number-classifications/FreeBASIC/abundant,-deficient-and-perfect-number-classifications.freebasic new file mode 100644 index 0000000000..af0e3e25f6 --- /dev/null +++ b/Task/Abundant,-deficient-and-perfect-number-classifications/FreeBASIC/abundant,-deficient-and-perfect-number-classifications.freebasic @@ -0,0 +1,33 @@ +' FreeBASIC v1.05.0 win64 + +Function SumProperDivisors(number As Integer) As Integer + If number < 2 Then Return 0 + Dim sum As Integer = 0 + For i As Integer = 1 To number \ 2 + If number Mod i = 0 Then sum += i + Next + Return sum +End Function + +Dim As Integer sum, deficient, perfect, abundant + +For n As Integer = 1 To 20000 + sum = SumProperDivisors(n) + If sum < n Then + deficient += 1 + ElseIf sum = n Then + perfect += 1 + Else + abundant += 1 + EndIf +Next + +Print "The classification of the numbers from 1 to 20,000 is as follows : " +Print +Print "Deficient = "; deficient +Print "Perfect = "; perfect +Print "Abundant = "; abundant +Print +Print "Press any key to exit the program" +Sleep +End diff --git a/Task/Abundant,-deficient-and-perfect-number-classifications/GFA-Basic/abundant,-deficient-and-perfect-number-classifications.gfa b/Task/Abundant,-deficient-and-perfect-number-classifications/GFA-Basic/abundant,-deficient-and-perfect-number-classifications.gfa new file mode 100644 index 0000000000..0ed2ccbe34 --- /dev/null +++ b/Task/Abundant,-deficient-and-perfect-number-classifications/GFA-Basic/abundant,-deficient-and-perfect-number-classifications.gfa @@ -0,0 +1,45 @@ +num_deficient%=0 +num_perfect%=0 +num_abundant%=0 +' +FOR current%=1 TO 20000 + sum_divisors%=@sum_proper_divisors(current%) + IF sum_divisors%current% + num_abundant%=num_abundant%+1 + ENDIF +NEXT current% +' +' Display results on a window +' +OPENW 1 +CLEARW 1 +PRINT "Number deficient ";num_deficient% +PRINT "Number perfect ";num_perfect% +PRINT "Number abundant ";num_abundant% +~INP(2) +CLOSEW 1 +' +' Compute the sum of proper divisors of given number +' +FUNCTION sum_proper_divisors(n%) + LOCAL i%,sum%,root% + ' + IF n%>1 ! n% must be 2 or higher + sum%=1 ! start with 1 + root%=SQR(n%) ! note that root% is an integer + ' check possible factors, up to sqrt + FOR i%=2 TO root% + IF n% MOD i%=0 + sum%=sum%+i% ! i% is a factor + IF i%*i%<>n% ! check i% is not actual square root of n% + sum%=sum%+n%/i% ! so n%/i% will also be a factor + ENDIF + ENDIF + NEXT i% + ENDIF + RETURN sum% +ENDFUNC diff --git a/Task/Abundant,-deficient-and-perfect-number-classifications/Nim/abundant,-deficient-and-perfect-number-classifications.nim b/Task/Abundant,-deficient-and-perfect-number-classifications/Nim/abundant,-deficient-and-perfect-number-classifications.nim new file mode 100644 index 0000000000..9a2cdc4cf6 --- /dev/null +++ b/Task/Abundant,-deficient-and-perfect-number-classifications/Nim/abundant,-deficient-and-perfect-number-classifications.nim @@ -0,0 +1,24 @@ +proc sumProperDivisors(number: int) : int = + if number < 2 : return 0 + for i in 1 .. number div 2 : + if number mod i == 0 : result += i + +var + sum : int + deficient = 0 + perfect = 0 + abundant = 0 + +for n in 1 .. 20000 : + sum = sumProperDivisors(n) + if sum < n : + inc(deficient) + elif sum == n : + inc(perfect) + else : + inc(abundant) + +echo "The classification of the numbers between 1 and 20,000 is as follows :\n" +echo " Deficient = " , deficient +echo " Perfect = " , perfect +echo " Abundant = " , abundant diff --git a/Task/Abundant,-deficient-and-perfect-number-classifications/Oforth/abundant,-deficient-and-perfect-number-classifications.oforth b/Task/Abundant,-deficient-and-perfect-number-classifications/Oforth/abundant,-deficient-and-perfect-number-classifications.oforth new file mode 100644 index 0000000000..5dd5b52817 --- /dev/null +++ b/Task/Abundant,-deficient-and-perfect-number-classifications/Oforth/abundant,-deficient-and-perfect-number-classifications.oforth @@ -0,0 +1,14 @@ +Integer method: properDivs self 2 / seq filter(#[ self swap mod 0 == ]) ; + +: numberClasses +| i deficient perfect s | + 0 0 ->deficient ->perfect + 0 20000 loop: i [ + i properDivs sum ->s + s i < ifTrue: [ deficient 1+ ->deficient continue ] + s i == ifTrue: [ perfect 1+ ->perfect continue ] + 1+ + ] + "Deficients : " print deficient println + "Perfects : " print perfect println + "Abundant : " print println ; diff --git a/Task/Abundant,-deficient-and-perfect-number-classifications/Phix/abundant,-deficient-and-perfect-number-classifications.phix b/Task/Abundant,-deficient-and-perfect-number-classifications/Phix/abundant,-deficient-and-perfect-number-classifications.phix new file mode 100644 index 0000000000..6cf533020d --- /dev/null +++ b/Task/Abundant,-deficient-and-perfect-number-classifications/Phix/abundant,-deficient-and-perfect-number-classifications.phix @@ -0,0 +1,12 @@ +integer deficient=0, perfect=0, abundant=0, N +for i=1 to 20000 do + N = sum(factors(i))+(i!=1) + if N=i then + perfect += 1 + elsif N 1 ? 1 : 0) +} + +var h = Hash() +20000.times { |i| ++(h{propdivsum(i) <=> i} := 0) } +say "Perfect: #{h{0}} Deficient: #{h{-1}} Abundant: #{h{1}}" diff --git a/Task/Abundant,-deficient-and-perfect-number-classifications/Swift/abundant,-deficient-and-perfect-number-classifications.swift b/Task/Abundant,-deficient-and-perfect-number-classifications/Swift/abundant,-deficient-and-perfect-number-classifications.swift new file mode 100644 index 0000000000..ba34d8571f --- /dev/null +++ b/Task/Abundant,-deficient-and-perfect-number-classifications/Swift/abundant,-deficient-and-perfect-number-classifications.swift @@ -0,0 +1,41 @@ +var deficients = 0 // sumPd < n +var perfects = 0 // sumPd = n +var abundants = 0 // sumPd > n + +// 1 is deficient (no proper divisor) +deficients++ + + +for i in 2...20000 { + + var sumPd = 1 // 1 is a proper divisor of all integer above 1 + + var maxPdToTest = i/2 // the max divisor to test + + for var j = 2; j < maxPdToTest; j++ { + + if (i%j) == 0 { + // j is a proper divisor + sumPd += j + + // New maximum for divisibility check + maxPdToTest = i / j + + // To add to sum of proper divisors unless already done + if maxPdToTest != j { + sumPd += maxPdToTest + } + } + } + + // Select type according to sum of Proper divisors + if sumPd < i { + deficients++ + } else if sumPd > i { + abundants++ + } else { + perfects++ + } +} + +println("There are \(deficients) deficient, \(perfects) perfect and \(abundants) abundant integers from 1 to 20000.") diff --git a/Task/Abundant,-deficient-and-perfect-number-classifications/jq/abundant,-deficient-and-perfect-number-classifications-1.jq b/Task/Abundant,-deficient-and-perfect-number-classifications/jq/abundant,-deficient-and-perfect-number-classifications-1.jq new file mode 100644 index 0000000000..54250f477c --- /dev/null +++ b/Task/Abundant,-deficient-and-perfect-number-classifications/jq/abundant,-deficient-and-perfect-number-classifications-1.jq @@ -0,0 +1,11 @@ +# unordered +def proper_divisors: + . as $n + | if $n > 1 then 1, + ( range(2; 1 + (sqrt|floor)) as $i + | if ($n % $i) == 0 then $i, + (($n / $i) | if . == $i then empty else . end) + else empty + end) + else empty + end; diff --git a/Task/Abundant,-deficient-and-perfect-number-classifications/jq/abundant,-deficient-and-perfect-number-classifications-2.jq b/Task/Abundant,-deficient-and-perfect-number-classifications/jq/abundant,-deficient-and-perfect-number-classifications-2.jq new file mode 100644 index 0000000000..6739baa3ff --- /dev/null +++ b/Task/Abundant,-deficient-and-perfect-number-classifications/jq/abundant,-deficient-and-perfect-number-classifications-2.jq @@ -0,0 +1,8 @@ +def sum(stream): reduce stream as $i (0; . + $i); + +def classify: + . as $n + | sum(proper_divisors) + | if . < $n then "deficient" elif . == $n then "perfect" else "abundant" end; + +reduce (range(1; 20001) | classify) as $c ({}; .[$c] += 1 ) diff --git a/Task/Abundant,-deficient-and-perfect-number-classifications/jq/abundant,-deficient-and-perfect-number-classifications-3.jq b/Task/Abundant,-deficient-and-perfect-number-classifications/jq/abundant,-deficient-and-perfect-number-classifications-3.jq new file mode 100644 index 0000000000..5aec946b5e --- /dev/null +++ b/Task/Abundant,-deficient-and-perfect-number-classifications/jq/abundant,-deficient-and-perfect-number-classifications-3.jq @@ -0,0 +1,2 @@ +$ jq -n -c -f AbundantDeficientPerfect.jq +{"deficient":15043,"perfect":4,"abundant":4953} diff --git a/Task/Accumulator-factory/Ceylon/accumulator-factory.ceylon b/Task/Accumulator-factory/Ceylon/accumulator-factory.ceylon new file mode 100644 index 0000000000..99c1217a70 --- /dev/null +++ b/Task/Accumulator-factory/Ceylon/accumulator-factory.ceylon @@ -0,0 +1,17 @@ +shared void run() { + Integer|Float accumulator + (variable Integer|Float n) + (Integer|Float i) + => switch (i) + case (is Integer) + (n = n.plusInteger(i)) + case (is Float) + (n = i + (switch(prev = n) + case (is Float) prev + case (is Integer) prev.float)); + + value x = accumulator(1); + print(x(5)); + print(accumulator(3)); + print(x(2.3)); +} diff --git a/Task/Accumulator-factory/ERRE/accumulator-factory.erre b/Task/Accumulator-factory/ERRE/accumulator-factory.erre new file mode 100644 index 0000000000..3d923905df --- /dev/null +++ b/Task/Accumulator-factory/ERRE/accumulator-factory.erre @@ -0,0 +1,17 @@ +PROGRAM ACCUMULATOR + +PROCEDURE ACCUMULATOR(SUM,N,A->SUM) + IF NOT A THEN SUM=N ELSE SUM=SUM+N +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) ! CLS + ACCUMULATOR(X,1,FALSE->X) ! INIT FIRST ACCUMULATOR + ACCUMULATOR(X,-15,TRUE->X) + ACCUMULATOR(X,2.3,TRUE->X) + + ACCUMULATOR(Z,3,FALSE->Z) ! INIT SECOND ACCUMULATOR + ACCUMULATOR(Z,5,TRUE->Z) + ACCUMULATOR(Z,2.3,TRUE->Z) + PRINT(X,Z) +END PROGRAM diff --git a/Task/Accumulator-factory/EchoLisp/accumulator-factory.echolisp b/Task/Accumulator-factory/EchoLisp/accumulator-factory.echolisp new file mode 100644 index 0000000000..2155fae54e --- /dev/null +++ b/Task/Accumulator-factory/EchoLisp/accumulator-factory.echolisp @@ -0,0 +1,10 @@ +(define-syntax-rule (inc x v) (set! x (+ x v))) +(define (accumulator (sum 0)) (lambda(x) (inc sum x) sum)) + +(define x (accumulator 1)) → x +(x 5) → 6 + +;; another closure +(accumulator 3) → (🔒 λ (_x) (📝 #set! sum (#+ sum _x)) sum) + +(x 2.3) → 8.3 diff --git a/Task/Accumulator-factory/FreeBASIC/accumulator-factory.freebasic b/Task/Accumulator-factory/FreeBASIC/accumulator-factory.freebasic new file mode 100644 index 0000000000..46479f7dcb --- /dev/null +++ b/Task/Accumulator-factory/FreeBASIC/accumulator-factory.freebasic @@ -0,0 +1,49 @@ +' FB 1.05.0 Win64 + +' uses overloaded methods to deal with the integer/float aspect (long and single are both 4 bytes) +Type Bar + Public: + Declare Constructor(As Long) + Declare Constructor(As Single) + Declare Function g(As Long) As Long + Declare Function g(As Single) As Single + Private: + As Single sum_ '' can't be altered by external code +End Type + +Constructor Bar(i As Long) + sum_ = i +End Constructor + +Constructor Bar(s As Single) + sum_ = s +End Constructor + +Function Bar.g(i As Long) As Long + sum_ += i + Return sum_ '' would round down to a Long if non-integral Singles had been added previously +End Function + +Function Bar.g(s As Single) As Single + sum_ += s + Return sum_ +End Function + +Function foo Overload(i As Long) As Bar '' returns a Bar object rather than a pointer to Bar.g + Dim b As Bar = Bar(i) + Return b +End Function + +Function foo Overload(s As Single) As Bar '' overload of foo to deal with Single argument + Dim b As Bar = Bar(s) + Return b +End Function + +Dim x As Bar = foo(1) '' assigns Bar object to x +x.g(5) '' calls the Long overload of g on the Bar object +foo(3) '' creates a separate Bar object which is unused +print x.g(2.3) '' calls the Single overload of g on the Bar object and should print 1 + 5 + 2.3 = 8.3 + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Accumulator-factory/LFE/accumulator-factory-1.lfe b/Task/Accumulator-factory/LFE/accumulator-factory-1.lfe new file mode 100644 index 0000000000..0c0f4a0bbd --- /dev/null +++ b/Task/Accumulator-factory/LFE/accumulator-factory-1.lfe @@ -0,0 +1,5 @@ +(defun accum (m) + (lambda (n) + (let ((sum (+ m n))) + `(#(func ,(accum sum)) + #(sum ,sum))))) diff --git a/Task/Accumulator-factory/LFE/accumulator-factory-2.lfe b/Task/Accumulator-factory/LFE/accumulator-factory-2.lfe new file mode 100644 index 0000000000..b7d170bb3e --- /dev/null +++ b/Task/Accumulator-factory/LFE/accumulator-factory-2.lfe @@ -0,0 +1,13 @@ +(defun loop (m) + (receive + (`#(,caller ,n) + (let ((sum (+ m n))) + (! caller sum) + (loop sum))))) + +(defun accum (m) + (let ((loop-pid (spawn (lambda () (loop m))))) + (lambda (n) + (! loop-pid `#(,(self) ,n)) + (receive + (sum sum))))) diff --git a/Task/Accumulator-factory/NGS/accumulator-factory.ngs b/Task/Accumulator-factory/NGS/accumulator-factory.ngs new file mode 100644 index 0000000000..4357695b11 --- /dev/null +++ b/Task/Accumulator-factory/NGS/accumulator-factory.ngs @@ -0,0 +1,13 @@ +{ + F Acc(start:Int) { + sum = start + F acc(i:Int) { + sum = sum + i + sum + } + } + + acc = Acc(10) + echo(acc(5)) + echo(acc(2)) +} diff --git a/Task/Accumulator-factory/Nim/accumulator-factory.nim b/Task/Accumulator-factory/Nim/accumulator-factory.nim new file mode 100644 index 0000000000..644ab13aa5 --- /dev/null +++ b/Task/Accumulator-factory/Nim/accumulator-factory.nim @@ -0,0 +1,19 @@ +proc accumulator(sum: float): auto = + var sum = sum + return proc (n: float): float = + sum += n + return sum + +var x = accumulator(1) +echo x(5) # 6 +echo x(2.3) # 8.3 + +var y = accumulator(1) +echo y(5) # 6 +echo y(2.3) # 8.3 + +var z = accumulator(3) +echo z(5) # 8 +echo z(2.3) # 10.3 +echo x(0) # 8.3 +echo z(0) # 10.3 diff --git a/Task/Accumulator-factory/Oforth/accumulator-factory-1.oforth b/Task/Accumulator-factory/Oforth/accumulator-factory-1.oforth new file mode 100644 index 0000000000..bcec77c0f1 --- /dev/null +++ b/Task/Accumulator-factory/Oforth/accumulator-factory-1.oforth @@ -0,0 +1,4 @@ +: foo(n) +| ch | + Channel new dup ->ch send(n) drop + #[ ch receive swap + dup ch send drop ] ; diff --git a/Task/Accumulator-factory/Oforth/accumulator-factory-2.oforth b/Task/Accumulator-factory/Oforth/accumulator-factory-2.oforth new file mode 100644 index 0000000000..cd9ea24f77 --- /dev/null +++ b/Task/Accumulator-factory/Oforth/accumulator-factory-2.oforth @@ -0,0 +1,9 @@ +: testfoo +| x y z | + foo(1) ->x + 5 x perform . + foo(3) ->y + 2.3 x perform dup . ", x accumulator value is a " . class .cr + 10 y perform dup . ", y accumulator value is a " . class .cr + foo("aaa") ->z + "bbb" z perform dup . ", z accumulator value is a " . class .cr ; diff --git a/Task/Accumulator-factory/Ring/accumulator-factory.ring b/Task/Accumulator-factory/Ring/accumulator-factory.ring new file mode 100644 index 0000000000..56557ba2b8 --- /dev/null +++ b/Task/Accumulator-factory/Ring/accumulator-factory.ring @@ -0,0 +1,22 @@ +oGenerator = new Generator + +Func main + oGenerator { + accumulator = generator(1) + see call accumulator(5) + see nl + generator(3) + see call accumulator(2.3) + } + +Class Generator + aN = [] + + func generator i + aN + i + return eval(substr("return func d { + oGenerator { + aN[#id#] += d + return aN[#id#] + } + }","#id#",string(len(aN)))) diff --git a/Task/Accumulator-factory/Sidef/accumulator-factory-1.sidef b/Task/Accumulator-factory/Sidef/accumulator-factory-1.sidef new file mode 100644 index 0000000000..14300349d0 --- /dev/null +++ b/Task/Accumulator-factory/Sidef/accumulator-factory-1.sidef @@ -0,0 +1,10 @@ +class Accumulator(sum) { + method add(num) { + sum += num; + } +} + +var x = Accumulator(1); +x.add(5); +Accumulator(3); +say x.add(2.3); # prints: 8.3 diff --git a/Task/Accumulator-factory/Sidef/accumulator-factory-2.sidef b/Task/Accumulator-factory/Sidef/accumulator-factory-2.sidef new file mode 100644 index 0000000000..f88f640172 --- /dev/null +++ b/Task/Accumulator-factory/Sidef/accumulator-factory-2.sidef @@ -0,0 +1,8 @@ +func Accumulator(sum) { + func(num) { sum += num }; +} + +var x = Accumulator(1); +x(5); +Accumulator(3); +say x(2.3); # prints: 8.3 diff --git a/Task/Accumulator-factory/Swift/accumulator-factory.swift b/Task/Accumulator-factory/Swift/accumulator-factory.swift new file mode 100644 index 0000000000..c6160e53c7 --- /dev/null +++ b/Task/Accumulator-factory/Swift/accumulator-factory.swift @@ -0,0 +1,11 @@ +func makeAccumulator(var sum: Double) -> Double -> Double { + return { + sum += $0 + return sum + } +} + +let x = makeAccumulator(1) +x(5) +let _ = makeAccumulator(3) +println(x(2.3)) diff --git a/Task/Accumulator-factory/Wart/accumulator-factory.wart b/Task/Accumulator-factory/Wart/accumulator-factory.wart new file mode 100644 index 0000000000..92b5907de8 --- /dev/null +++ b/Task/Accumulator-factory/Wart/accumulator-factory.wart @@ -0,0 +1,2 @@ +def (accumulator n) + (fn() ++n) diff --git a/Task/Ackermann-function/68000-Assembly/ackermann-function.68000 b/Task/Ackermann-function/68000-Assembly/ackermann-function.68000 new file mode 100644 index 0000000000..2db8d189e6 --- /dev/null +++ b/Task/Ackermann-function/68000-Assembly/ackermann-function.68000 @@ -0,0 +1,112 @@ +; +; Ackermann function for Motorola 68000 under AmigaOs 2+ by Thorham +; +; Set stack space to 60000 for m = 3, n = 5. +; +; The program will print the ackermann values for the range m = 0..3, n = 0..5 +; +_LVOOpenLibrary equ -552 +_LVOCloseLibrary equ -414 +_LVOVPrintf equ -954 + +m equ 3 ; Nr of iterations for the main loop. +n equ 5 ; Do NOT set them higher, or it will take hours to complete on + ; 68k, not to mention that the stack usage will become astronomical. + ; Perhaps n can be a little higher... If you do increase the ranges + ; then don't forget to increase the stack size. + +execBase=4 + +start + move.l execBase,a6 + + lea dosName,a1 + moveq #36,d0 + jsr _LVOOpenLibrary(a6) + move.l d0,dosBase + beq exit + + move.l dosBase,a6 + lea printfArgs,a2 + + clr.l d3 ; m +.loopn + clr.l d4 ; n +.loopm + bsr ackermann + + move.l d3,0(a2) + move.l d4,4(a2) + move.l d5,8(a2) + move.l #outString,d1 + move.l a2,d2 + jsr _LVOVPrintf(a6) + + addq.l #1,d4 + cmp.l #n,d4 + ble .loopm + + addq.l #1,d3 + cmp.l #m,d3 + ble .loopn + +exit + move.l execBase,a6 + move.l dosBase,a1 + jsr _LVOCloseLibrary(a6) + rts +; +; ackermann function +; +; in: +; +; d3 = m +; d4 = n +; +; out: +; +; d5 = ans +; +ackermann + move.l d3,-(sp) + move.l d4,-(sp) + + tst.l d3 + bne .l1 + move.l d4,d5 + addq.l #1,d5 + bra .return +.l1 + tst.l d4 + bne .l2 + subq.l #1,d3 + moveq #1,d4 + bsr ackermann + bra .return +.l2 + subq.l #1,d4 + bsr ackermann + move.l d5,d4 + subq.l #1,d3 + bsr ackermann + +.return + move.l (sp)+,d4 + move.l (sp)+,d3 + rts +; +; variables +; +dosBase + dc.l 0 + +printfArgs + dcb.l 3 +; +; strings +; +dosName + dc.b "dos.library",0 + +outString + dc.b "ackermann (%ld,%ld) is: %ld",10,0 diff --git a/Task/Ackermann-function/8th/ackermann-function.8th b/Task/Ackermann-function/8th/ackermann-function.8th new file mode 100644 index 0000000000..2cce854387 --- /dev/null +++ b/Task/Ackermann-function/8th/ackermann-function.8th @@ -0,0 +1,75 @@ +\ Ackermann function, illustrating use of "memoization". + +\ Memoization is a technique whereby intermediate computed values are stored +\ away against later need. It is particularly valuable when calculating those +\ values is time or resource intensive, as with the Ackermann function. + +\ make the stack much bigger so this can complete! +100000 stack-size + +\ This is where memoized values are stored: +{} var, dict + +\ Simple accessor words +: dict! \ "key" val -- + dict @ -rot m:! drop ; + +: dict@ \ "key" -- val + dict @ swap m:@ nip ; + +defer: ack1 + +\ We just jam the string representation of the two numbers together for a key: +: makeKey \ m n -- m n key + 2dup >s swap >s s:+ ; + +: ack2 \ m n -- A + makeKey dup + dict@ null? + if \ can't find key in dict + \ m n key null + drop \ m n key + -rot \ key m n + ack1 \ key A + tuck \ A key A + dict! \ A + else \ found value + \ m n key value + >r drop 2drop r> + then ; + +: ack \ m n -- A + over not + if + nip n:1+ + else + dup not + if + drop n:1- 1 ack2 + else + over swap n:1- ack2 + swap n:1- swap ack2 + then + then ; + +' ack is ack1 + +: ackOf \ m n -- + 2dup + "Ack(" . swap . ", " . . ") = " . ack . cr ; + + +0 0 ackOf +0 4 ackOf +1 0 ackOf +1 1 ackOf +2 1 ackOf +2 2 ackOf +3 1 ackOf +3 3 ackOf +4 0 ackOf + +\ this last requires a very large data stack. So start 8th with a parameter '-k 100000' +4 1 ackOf + +bye diff --git a/Task/Ackermann-function/ERRE/ackermann-function.erre b/Task/Ackermann-function/ERRE/ackermann-function.erre new file mode 100644 index 0000000000..f99eb6a934 --- /dev/null +++ b/Task/Ackermann-function/ERRE/ackermann-function.erre @@ -0,0 +1,54 @@ +PROGRAM ACKERMAN + +! +! computes Ackermann function +! (second version for rosettacode.org) +! + +!$INTEGER + +DIM STACK[10000] + +!$INCLUDE="PC.LIB" + +PROCEDURE ACK(M,N->N) + LOOP + CURSOR_SAVE(->CURX%,CURY%) + LOCATE(8,1) + PRINT("Livello Stack:";S;" ") + LOCATE(CURY%,CURX%) + IF M<>0 THEN + IF N<>0 THEN + STACK[S]=M + S+=1 + N-=1 + ELSE + M-=1 + N+=1 + END IF + CONTINUE LOOP + ELSE + N+=1 + S-=1 + END IF + IF S<>0 THEN + M=STACK[S] + M-=1 + CONTINUE LOOP + ELSE + EXIT PROCEDURE + END IF + END LOOP +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) + FOR X=0 TO 3 DO + FOR Y=0 TO 9 DO + S=1 + ACK(X,Y->ANS) + PRINT(ANS;) + END FOR + PRINT + END FOR +END PROGRAM diff --git a/Task/Ackermann-function/Ezhil/ackermann-function.ezhil b/Task/Ackermann-function/Ezhil/ackermann-function.ezhil new file mode 100644 index 0000000000..075f6aaf31 --- /dev/null +++ b/Task/Ackermann-function/Ezhil/ackermann-function.ezhil @@ -0,0 +1,38 @@ +நிரல்பாகம் அகெர்மன்(முதலெண், இரண்டாமெண்) + + @((முதலெண் < 0) || (இரண்டாமெண் < 0)) ஆனால் + + பின்கொடு -1 + + முடி + + @(முதலெண் == 0) ஆனால் + + பின்கொடு இரண்டாமெண்+1 + + முடி + + @((முதலெண் > 0) && (இரண்டாமெண் == 00)) ஆனால் + + பின்கொடு அகெர்மன்(முதலெண் - 1, 1) + + முடி + + பின்கொடு அகெர்மன்(முதலெண் - 1, அகெர்மன்(முதலெண், இரண்டாமெண் - 1)) + +முடி + +அ = int(உள்ளீடு("ஓர் எண்ணைத் தாருங்கள், அது பூஜ்ஜியமாகவோ, அதைவிடப் பெரியதாக இருக்கலாம்: ")) +ஆ = int(உள்ளீடு("அதேபோல் இன்னோர் எண்ணைத் தாருங்கள், இதுவும் பூஜ்ஜியமாகவோ, அதைவிடப் பெரியதாகவோ இருக்கலாம்: ")) + +விடை = அகெர்மன்(அ, ஆ) + +@(விடை < 0) ஆனால் + + பதிப்பி "தவறான எண்களைத் தந்துள்ளீர்கள்!" + +இல்லை + + பதிப்பி "நீங்கள் தந்த எண்களுக்கான அகர்மென் மதிப்பு: ", விடை + +முடி diff --git a/Task/Ackermann-function/FreeBASIC/ackermann-function.freebasic b/Task/Ackermann-function/FreeBASIC/ackermann-function.freebasic new file mode 100644 index 0000000000..a21e605c22 --- /dev/null +++ b/Task/Ackermann-function/FreeBASIC/ackermann-function.freebasic @@ -0,0 +1,41 @@ +' version 28-10-2016 +' compile with: fbc -s console +' to do A(4, 2) the stack size needs to be increased +' compile with: fbc -s console -t 2000 + +Function ackerman (m As Long, n As Long) As Long + + If m = 0 Then ackerman = n +1 + + If m > 0 Then + If n = 0 Then + ackerman = ackerman(m -1, 1) + Else + If n > 0 Then + ackerman = ackerman(m -1, ackerman(m, n -1)) + End If + End If + End If +End Function + +' ------=< MAIN >=------ + +Dim As Long m, n +Print + +For m = 0 To 4 + Print Using "###"; m; + For n = 0 To 10 + ' A(4, 1) or higher will run out of stack memory (default 1M) + ' change n = 1 to n = 2 to calculate A(4, 2), increase stack! + If m = 4 And n = 1 Then Exit For + Print Using "######"; ackerman(m, n); + Next + Print +Next + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Ackermann-function/FunL/ackermann-function.funl b/Task/Ackermann-function/FunL/ackermann-function.funl new file mode 100644 index 0000000000..2c6a03f207 --- /dev/null +++ b/Task/Ackermann-function/FunL/ackermann-function.funl @@ -0,0 +1,7 @@ +def + ackermann( 0, n ) = n + 1 + ackermann( m, 0 ) = ackermann( m - 1, 1 ) + ackermann( m, n ) = ackermann( m - 1, ackermann(m, n - 1) ) + +for m <- 0..3, n <- 0..4 + printf( 'Ackermann( %d, %d ) = %d\n', m, n, ackermann(m, n) ) diff --git a/Task/Ackermann-function/Futhark/ackermann-function.futhark b/Task/Ackermann-function/Futhark/ackermann-function.futhark new file mode 100644 index 0000000000..6de31e2cf6 --- /dev/null +++ b/Task/Ackermann-function/Futhark/ackermann-function.futhark @@ -0,0 +1,4 @@ +fun ackermann(m: int, n: int): int = + if m == 0 then n + 1 + else if n == 0 then ackermann(m-1, 1) + else ackermann(m - 1, ackermann(m, n-1)) diff --git a/Task/Ackermann-function/FutureBasic/ackermann-function.futurebasic b/Task/Ackermann-function/FutureBasic/ackermann-function.futurebasic new file mode 100644 index 0000000000..17c5d48b79 --- /dev/null +++ b/Task/Ackermann-function/FutureBasic/ackermann-function.futurebasic @@ -0,0 +1,36 @@ +include "ConsoleWindow" + +def tab 1 + +begin globals +dim as container gC +end globals + +def fn Ackerman( m as long, n as long ) as long + +local fn Ackerman( m as long, n as long ) as long +dim as long result + +if m == 0 then result = n + 1 : exit fn + +if ( n == 0 ) + result = fn Ackerman( m - 1, 1 ) + exit fn +end if + +result = fn Ackerman( m - 1, fn Ackerman(m, n - 1) ) +end fn = result + +dim as long n, m + +/* + Cache response in global string container to speed + processing rather printing each iteration. +*/ +for m = 0 to 3 + for n = 0 to 10 + gC += "fn ackerman(" + str$(m) + "," + str$(n) + " ) =" + Str$( fn Ackerman( m, n ) ) + chr$(13) + next +next + +print gC diff --git a/Task/Ackermann-function/Idris/ackermann-function.idris b/Task/Ackermann-function/Idris/ackermann-function.idris new file mode 100644 index 0000000000..840332a6a1 --- /dev/null +++ b/Task/Ackermann-function/Idris/ackermann-function.idris @@ -0,0 +1,4 @@ +A : Nat -> Nat -> Nat +A Z n = S n +A (S m) Z = A m (S Z) +A (S m) (S n) = A m (A (S m) n) diff --git a/Task/Ackermann-function/LFE/ackermann-function.lfe b/Task/Ackermann-function/LFE/ackermann-function.lfe new file mode 100644 index 0000000000..c608e42a4a --- /dev/null +++ b/Task/Ackermann-function/LFE/ackermann-function.lfe @@ -0,0 +1,4 @@ +(defun ackermann + ((0 n) (+ n 1)) + ((m 0) (ackermann (- m 1) 1)) + ((m n) (ackermann (- m 1) (ackermann m (- n 1))))) diff --git a/Task/Ackermann-function/Lasso/ackermann-function.lasso b/Task/Ackermann-function/Lasso/ackermann-function.lasso new file mode 100644 index 0000000000..65e73a4d54 --- /dev/null +++ b/Task/Ackermann-function/Lasso/ackermann-function.lasso @@ -0,0 +1,15 @@ +#!/usr/bin/lasso9 + +define ackermann(m::integer, n::integer) => { + if(#m == 0) => { + return ++#n + else(#n == 0) + return ackermann(--#m, 1) + else + return ackermann(#m-1, ackermann(#m, --#n)) + } +} + +with x in generateSeries(1,3), + y in generateSeries(0,8,2) +do stdoutnl(#x+', '#y+': ' + ackermann(#x, #y)) diff --git a/Task/Ackermann-function/LiveCode/ackermann-function.livecode b/Task/Ackermann-function/LiveCode/ackermann-function.livecode new file mode 100644 index 0000000000..b0cb33b213 --- /dev/null +++ b/Task/Ackermann-function/LiveCode/ackermann-function.livecode @@ -0,0 +1,10 @@ +function ackermann m,n + switch + Case m = 0 + return n + 1 + Case (m > 0 And n = 0) + return ackermann((m - 1), 1) + Case (m > 0 And n > 0) + return ackermann((m - 1), ackermann(m, (n - 1))) + end switch +end ackermann diff --git a/Task/Ackermann-function/Luck/ackermann-function.luck b/Task/Ackermann-function/Luck/ackermann-function.luck new file mode 100644 index 0000000000..2a6bfa933c --- /dev/null +++ b/Task/Ackermann-function/Luck/ackermann-function.luck @@ -0,0 +1,5 @@ +function ackermann(m: int, n: int): int = ( + if m==0 then n+1 + else if n==0 then ackermann(m-1,1) + else ackermann(m-1,ackermann(m,n-1)) +) diff --git a/Task/Ackermann-function/Nim/ackermann-function-1.nim b/Task/Ackermann-function/Nim/ackermann-function-1.nim new file mode 100644 index 0000000000..a9bf77abe2 --- /dev/null +++ b/Task/Ackermann-function/Nim/ackermann-function-1.nim @@ -0,0 +1,7 @@ +proc Ackermann(m, n: int64): int64 = + if m == 0: + result = n + 1 + elif n == 0: + result = Ackermann(m - 1, 1) + else: + result = Ackermann(m - 1, Ackermann(m, n - 1)) diff --git a/Task/Ackermann-function/Nim/ackermann-function-2.nim b/Task/Ackermann-function/Nim/ackermann-function-2.nim new file mode 100644 index 0000000000..8f68f25d51 --- /dev/null +++ b/Task/Ackermann-function/Nim/ackermann-function-2.nim @@ -0,0 +1,32 @@ +from strutils import parseInt + +proc ackermann(m,n: int): int = + var res: int + if m == 0: + res += n + 1 + elif m > 0 and n == 0: + res += ackermann(m-1, 1) + elif m > 0 and n > 0: + res += ackermann(m-1, ackermann(m, n-1)) + return res + +proc getnumber(): int = + try: + parseInt(readLine(stdin)) + except EInvalidValue: + echo("Please enter an integer: ") + getnumber() + +echo("First number please: ") +var first: int = getnumber() +while first < 0: + echo("Please enter a non-negative integer value.") + first = getnumber() + +echo("Second number please: ") +var second: int = getnumber() +while second < 0: + echo("Please enter a non-negative integer value.") + second = getnumber() + +echo("Result: " & $ackermann(first, second)) diff --git a/Task/Ackermann-function/Oforth/ackermann-function.oforth b/Task/Ackermann-function/Oforth/ackermann-function.oforth new file mode 100644 index 0000000000..57be08fca0 --- /dev/null +++ b/Task/Ackermann-function/Oforth/ackermann-function.oforth @@ -0,0 +1,4 @@ +: A(m, n) + m ifZero: [ n 1+ return ] + n ifZero: [ A(m 1-, 1) return ] + A(m 1-, A(m, n 1-)) ; diff --git a/Task/Ackermann-function/Phix/ackermann-function.phix b/Task/Ackermann-function/Phix/ackermann-function.phix new file mode 100644 index 0000000000..015221f858 --- /dev/null +++ b/Task/Ackermann-function/Phix/ackermann-function.phix @@ -0,0 +1,37 @@ +-- +-- Ackermann.exw +-- ============= +-- +-- optimised. still no bignum library, so ack(4,2), which is power(2,65536)-3, which is +-- apparently 19729 digits, and any above, are beyond (the CPU/FPU hardware) and this. +-- (replaced ack(atom,atom) with ack(int,int) since the former fares no better.) + +function ack(integer m, integer n) + if m=0 then + return n+1 + elsif m=1 then + return n+2 + elsif m=2 then + return 2*n+3 + elsif m=3 then + return power(2,n+3)-3 + elsif m>0 and n=0 then + return ack(m-1,1) + else + return ack(m-1,ack(m,n-1)) + end if +end function + +procedure Ackermann() + for i=0 to 3 do + for j=0 to 10 do + printf(1,"%5d",ack(i,j)) + end for + puts(1,"\n") + end for + printf(1,"ack(4,1) %5d\n",ack(4,1)) +-- printf(1,"ack(4,2) %5d\n",ack(4,2)) -- power function overflow + if getc(0) then end if +end procedure + + Ackermann() diff --git a/Task/Ackermann-function/Potion/ackermann-function.potion b/Task/Ackermann-function/Potion/ackermann-function.potion new file mode 100644 index 0000000000..102b630222 --- /dev/null +++ b/Task/Ackermann-function/Potion/ackermann-function.potion @@ -0,0 +1,11 @@ +ack = (m, n): + if (m == 0): n + 1 +. elsif (n == 0): ack(m - 1, 1) +. else: ack(m - 1, ack(m, n - 1)). +. + +4 times(m): + 7 times(n): + ack(m, n) print + " " print. + "\n" print. diff --git a/Task/Ackermann-function/Ring/ackermann-function.ring b/Task/Ackermann-function/Ring/ackermann-function.ring new file mode 100644 index 0000000000..1e58c5d152 --- /dev/null +++ b/Task/Ackermann-function/Ring/ackermann-function.ring @@ -0,0 +1,19 @@ +for m = 0 to 3 + for n = 0 to 4 + see "Ackermann(" + m + ", " + n + ") = " + Ackermann(m, n) + nl + next +next + +func Ackermann m, n + if m > 0 + if n > 0 + return Ackermann(m - 1, Ackermann(m, n - 1)) + but n = 0 + return Ackermann(m - 1, 1) + ok + but m = 0 + if n >= 0 + return n + 1 + ok + ok +Raise("Incorrect Numerical input !!!") diff --git a/Task/Ackermann-function/SPAD/ackermann-function.spad b/Task/Ackermann-function/SPAD/ackermann-function.spad new file mode 100644 index 0000000000..7d1a91c2fc --- /dev/null +++ b/Task/Ackermann-function/SPAD/ackermann-function.spad @@ -0,0 +1,11 @@ +NNI ==> NonNegativeInteger + +A:(NNI,NNI) -> NNI + +A(m,n) == + m=0 => n+1 + m>0 and n=0 => A(m-1,1) + m>0 and n>0 => A(m-1,A(m,n-1)) + +-- Example +matrix [[A(i,j) for i in 0..3] for j in 0..3] diff --git a/Task/Ackermann-function/Shen/ackermann-function.shen b/Task/Ackermann-function/Shen/ackermann-function.shen new file mode 100644 index 0000000000..a200455519 --- /dev/null +++ b/Task/Ackermann-function/Shen/ackermann-function.shen @@ -0,0 +1,5 @@ +(define ack + 0 N -> (+ N 1) + M 0 -> (ack (- M 1) 1) + M N -> (ack (- M 1) + (ack M (- N 1)))) diff --git a/Task/Ackermann-function/Sidef/ackermann-function-1.sidef b/Task/Ackermann-function/Sidef/ackermann-function-1.sidef new file mode 100644 index 0000000000..1576144bc5 --- /dev/null +++ b/Task/Ackermann-function/Sidef/ackermann-function-1.sidef @@ -0,0 +1,5 @@ +func A(m, n) { + m == 0 ? (n + 1) + : (n == 0 ? (A(m - 1, 1)) + : (A(m - 1, A(m, n - 1)))); +} diff --git a/Task/Ackermann-function/Sidef/ackermann-function-2.sidef b/Task/Ackermann-function/Sidef/ackermann-function-2.sidef new file mode 100644 index 0000000000..ff2e7cbd34 --- /dev/null +++ b/Task/Ackermann-function/Sidef/ackermann-function-2.sidef @@ -0,0 +1,3 @@ +func A((0), n) { n + 1 } +func A(m, (0)) { A(m - 1, 1) } +func A(m, n) { A(m-1, A(m, n-1)) } diff --git a/Task/Ackermann-function/Sidef/ackermann-function-3.sidef b/Task/Ackermann-function/Sidef/ackermann-function-3.sidef new file mode 100644 index 0000000000..ac5867bc0f --- /dev/null +++ b/Task/Ackermann-function/Sidef/ackermann-function-3.sidef @@ -0,0 +1 @@ +say A(3, 2); # prints: 29 diff --git a/Task/Ackermann-function/Swift/ackermann-function.swift b/Task/Ackermann-function/Swift/ackermann-function.swift new file mode 100644 index 0000000000..e6ee6ff259 --- /dev/null +++ b/Task/Ackermann-function/Swift/ackermann-function.swift @@ -0,0 +1,9 @@ +func ackerman(m:Int, n:Int) -> Int { + if m == 0 { + return n+1 + } else if n == 0 { + return ackerman(m-1, 1) + } else { + return ackerman(m-1, ackerman(m, n-1)) + } +} diff --git a/Task/Ackermann-function/Wart/ackermann-function.wart b/Task/Ackermann-function/Wart/ackermann-function.wart new file mode 100644 index 0000000000..a5a34fa3f3 --- /dev/null +++ b/Task/Ackermann-function/Wart/ackermann-function.wart @@ -0,0 +1,7 @@ +def (ackermann m n) + (if m=0 + n+1 + n=0 + (ackermann m-1 1) + :else + (ackermann m-1 (ackermann m n-1))) diff --git a/Task/Ackermann-function/Wren/ackermann-function.wren b/Task/Ackermann-function/Wren/ackermann-function.wren new file mode 100644 index 0000000000..7515f4c5af --- /dev/null +++ b/Task/Ackermann-function/Wren/ackermann-function.wren @@ -0,0 +1,7 @@ +// To use recursion definition and declaration must be on separate lines +var Ackermann +Ackermann = Fn.new {|m, n| + if (m == 0) return n + 1 + if (n == 0) return Ackermann.call(m - 1, 1) + return Ackermann.call(m - 1, Ackermann.call(m, n - 1)) +} diff --git a/Task/Ackermann-function/XLISP/ackermann-function-1.xlisp b/Task/Ackermann-function/XLISP/ackermann-function-1.xlisp new file mode 100644 index 0000000000..794f557fd5 --- /dev/null +++ b/Task/Ackermann-function/XLISP/ackermann-function-1.xlisp @@ -0,0 +1,5 @@ +(defun ackermann (m n) + (cond + ((= m 0) (+ n 1)) + ((= n 0) (ackermann (- m 1) 1)) + (t (ackermann (- m 1) (ackermann m (- n 1)))))) diff --git a/Task/Ackermann-function/XLISP/ackermann-function-2.xlisp b/Task/Ackermann-function/XLISP/ackermann-function-2.xlisp new file mode 100644 index 0000000000..86773a1d69 --- /dev/null +++ b/Task/Ackermann-function/XLISP/ackermann-function-2.xlisp @@ -0,0 +1 @@ +(print (ackermann 3 9)) diff --git a/Task/Ackermann-function/XLISP/ackermann-function-3.xlisp b/Task/Ackermann-function/XLISP/ackermann-function-3.xlisp new file mode 100644 index 0000000000..fdc9047a05 --- /dev/null +++ b/Task/Ackermann-function/XLISP/ackermann-function-3.xlisp @@ -0,0 +1 @@ +(print (ackermann 4 1)) diff --git a/Task/Ackermann-function/jq/ackermann-function-1.jq b/Task/Ackermann-function/jq/ackermann-function-1.jq new file mode 100644 index 0000000000..8c58872da4 --- /dev/null +++ b/Task/Ackermann-function/jq/ackermann-function-1.jq @@ -0,0 +1,7 @@ +# input: [m,n] +def ack: + .[0] as $m | .[1] as $n + | if $m == 0 then $n + 1 + elif $n == 0 then [$m-1, 1] | ack + else [$m-1, ([$m, $n-1 ] | ack)] | ack + end ; diff --git a/Task/Ackermann-function/jq/ackermann-function-2.jq b/Task/Ackermann-function/jq/ackermann-function-2.jq new file mode 100644 index 0000000000..b5e639bfc5 --- /dev/null +++ b/Task/Ackermann-function/jq/ackermann-function-2.jq @@ -0,0 +1,3 @@ +range(0;5) as $i +| range(0; if $i > 3 then 1 else 6 end) as $j +| "A(\($i),\($j)) = \( [$i,$j] | ack )" diff --git a/Task/Ackermann-function/jq/ackermann-function-3.jq b/Task/Ackermann-function/jq/ackermann-function-3.jq new file mode 100644 index 0000000000..99b3cd100d --- /dev/null +++ b/Task/Ackermann-function/jq/ackermann-function-3.jq @@ -0,0 +1,26 @@ +# jq -n -r -f ackermann.jq +A(0,0) = 1 +A(0,1) = 2 +A(0,2) = 3 +A(0,3) = 4 +A(0,4) = 5 +A(0,5) = 6 +A(1,0) = 2 +A(1,1) = 3 +A(1,2) = 4 +A(1,3) = 5 +A(1,4) = 6 +A(1,5) = 7 +A(2,0) = 3 +A(2,1) = 5 +A(2,2) = 7 +A(2,3) = 9 +A(2,4) = 11 +A(2,5) = 13 +A(3,0) = 5 +A(3,1) = 13 +A(3,2) = 29 +A(3,3) = 61 +A(3,4) = 125 +A(3,5) = 253 +A(4,0) = 13 diff --git a/Task/Ackermann-function/jq/ackermann-function-4.jq b/Task/Ackermann-function/jq/ackermann-function-4.jq new file mode 100644 index 0000000000..3df0a98822 --- /dev/null +++ b/Task/Ackermann-function/jq/ackermann-function-4.jq @@ -0,0 +1,29 @@ +# input: [m,n, cache] +# output [value, updatedCache] +def ack: + + # input: [value,cache]; output: [value, updatedCache] + def cache(key): .[1] += { (key): .[0] }; + + def pow2: reduce range(0; .) as $i (1; .*2); + + .[0] as $m | .[1] as $n | .[2] as $cache + | if $m == 0 then [$n + 1, $cache] + elif $m == 1 then [$n + 2, $cache] + elif $m == 2 then [2 * $n + 3, $cache] + elif $m == 3 then [8 * ($n|pow2) - 3, $cache] + else + (.[0:2]|tostring) as $key + | $cache[$key] as $value + | if $value then [$value, $cache] + elif $n == 0 then + ([$m-1, 1, $cache] | ack) + | cache($key) + else + ([$m, $n-1, $cache ] | ack) + | [$m-1, .[0], .[1]] | ack + | cache($key) + end + end; + +def A(m;n): [m,n,{}] | ack | .[0]; diff --git a/Task/Ackermann-function/jq/ackermann-function-5.jq b/Task/Ackermann-function/jq/ackermann-function-5.jq new file mode 100644 index 0000000000..c4347e6a2f --- /dev/null +++ b/Task/Ackermann-function/jq/ackermann-function-5.jq @@ -0,0 +1 @@ +A(4,1) diff --git a/Task/Ackermann-function/jq/ackermann-function-6.jq b/Task/Ackermann-function/jq/ackermann-function-6.jq new file mode 100644 index 0000000000..b07de00606 --- /dev/null +++ b/Task/Ackermann-function/jq/ackermann-function-6.jq @@ -0,0 +1 @@ +65533 diff --git a/Task/Active-Directory-Connect/Ring/active-directory-connect.ring b/Task/Active-Directory-Connect/Ring/active-directory-connect.ring new file mode 100644 index 0000000000..24c184f0dc --- /dev/null +++ b/Task/Active-Directory-Connect/Ring/active-directory-connect.ring @@ -0,0 +1 @@ +see system("dir") + nl diff --git a/Task/Active-object/EchoLisp/active-object-1.echolisp b/Task/Active-object/EchoLisp/active-object-1.echolisp new file mode 100644 index 0000000000..bb2fd691c4 --- /dev/null +++ b/Task/Active-object/EchoLisp/active-object-1.echolisp @@ -0,0 +1,30 @@ +(require 'timer) + +;; returns an 'object' : (&lamdba; message [values]) +;; messages : input, output, sample, inspect +(define (make-active) + (let [ + (t0 #f) (dt 0) + (t 0) (Kt 0) ; K(t) + (S 0) (K 0)] + (lambda (message . args) + (case message + ((output) (// S 2)) + ((input ) (set! K (car args)) (set! t0 #f)) + ((inspect) (printf " Active obj : t0 %v t %v S %v " t0 t Kt (// S 2 ))) + ((sample) + (when (procedure? K) +;; recved new K : init + (unless t0 + (set! t0 (first args)) + (set! t 0) + (set! Kt (K 0))) + +;; integrate K(t) every time 'sample message is received + (set! dt (- (first args) t t0)) ;; compute once K(t) + (set! S (+ S (* dt Kt))) + (set! t (+ t dt)) + (set! Kt (K t)) + (set! S (+ S (* dt Kt))))) + + (else (error "active:bad message" message)))))) diff --git a/Task/Active-object/EchoLisp/active-object-2.echolisp b/Task/Active-object/EchoLisp/active-object-2.echolisp new file mode 100644 index 0000000000..05b55b38f0 --- /dev/null +++ b/Task/Active-object/EchoLisp/active-object-2.echolisp @@ -0,0 +1,19 @@ +(define (experiment) + (define (K t) (sin (* PI t ))) + (define A (make-active)) + (define (stop) (A 'input 0)) + (define (sample t) (A 'sample (// t 1000))) + (define (result) (writeln 'result (A 'output))) + + (at 2.5 'seconds 'result) + (every 10 'sample) ;; integrate every 10 ms + + (A 'input K) + (wait 2000 'stop)) + +(experiment) → + 3/7/2015 20:34:18 : result + result 0.0002266920372221955 +(experiment) → + 3/7/2015 20:34:28 : result + result 0.00026510586971023164 diff --git a/Task/Active-object/Swift/active-object.swift b/Task/Active-object/Swift/active-object.swift new file mode 100644 index 0000000000..ada21ff7f4 --- /dev/null +++ b/Task/Active-object/Swift/active-object.swift @@ -0,0 +1,65 @@ +// For NSObject, NSTimeInterval and NSThread +import Foundation +// For PI and sin +import Darwin + +class ActiveObject:NSObject { + + let sampling = 0.1 + var K: (t: NSTimeInterval) -> Double + var S: Double + var t0, t1: NSTimeInterval + var thread = NSThread() + + func integrateK() { + t0 = t1 + t1 += sampling + S += (K(t:t1) + K(t: t0)) * (t1 - t0) / 2 + } + + func updateObject() { + while true { + integrateK() + usleep(100000) + } + } + + init(function: (NSTimeInterval) -> Double) { + S = 0 + t0 = 0 + t1 = 0 + K = function + super.init() + thread = NSThread(target: self, selector: "updateObject", object: nil) + thread.start() + } + + func Input(function: (NSTimeInterval) -> Double) { + K = function + + } + + func Output() -> Double { + return S + } + +} + +// main +func sine(t: NSTimeInterval) -> Double { + let f = 0.5 + + return sin(2 * M_PI * f * t) +} + +var activeObject = ActiveObject(function: sine) + +var date = NSDate() + +sleep(2) + +activeObject.Input({(t: NSTimeInterval) -> Double in return 0.0}) + +usleep(500000) + +println(activeObject.Output()) diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/Morfa/add-a-variable-to-a-class-instance-at-runtime.morfa b/Task/Add-a-variable-to-a-class-instance-at-runtime/Morfa/add-a-variable-to-a-class-instance-at-runtime.morfa new file mode 100644 index 0000000000..ec31736a9c --- /dev/null +++ b/Task/Add-a-variable-to-a-class-instance-at-runtime/Morfa/add-a-variable-to-a-class-instance-at-runtime.morfa @@ -0,0 +1,62 @@ +import morfa.base; + +template +public struct Dynamic +{ + var data: Dict; +} + +// convenience to create new Dynamic instances +template +public property dynamic(): Dynamic +{ + return Dynamic(new Dict()); +} + +// introduce replacement operator for . - a quoting ` operator +public operator ` { kind = infix, precedence = max, associativity = left, quoting = right } +template +public func `(d: Dynamic, name: text): DynamicElementAccess +{ + return DynamicElementAccess(d, name); +} + +// to allow implicit cast from the wrapped instance of T (on access) +template +public func convert(dea: DynamicElementAccess): T +{ + return dea.holder.data[dea.name]; +} + +// cannot overload assignment - introduce special assignment operator +public operator <- { kind = infix, precedence = assign } +template +public func <-(access: DynamicElementAccess, newEl: T): void +{ + access.holder.data[access.name] = newEl; +} + +func main(): void +{ + var test = dynamic; + + test`a <- 10; + test`b <- 20; + test`a <- 30; + + println(test`a, test`b); +} + +// private helper structure +template +struct DynamicElementAccess +{ + var holder: Dynamic; + var name: text; + + import morfa.io.format.Formatter; + public func format(formatt: text, formatter: Formatter): text + { + return getFormatFunction(holder.data[name])(formatt, formatter); + } +} diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/Red/add-a-variable-to-a-class-instance-at-runtime.red b/Task/Add-a-variable-to-a-class-instance-at-runtime/Red/add-a-variable-to-a-class-instance-at-runtime.red new file mode 100644 index 0000000000..00a7b0ded5 --- /dev/null +++ b/Task/Add-a-variable-to-a-class-instance-at-runtime/Red/add-a-variable-to-a-class-instance-at-runtime.red @@ -0,0 +1,11 @@ +person: make object! [ + name: none + age: none +] + +people: reduce [make person [name: "fred" age: 20] make person [name: "paul" age: 21]] +people/1: make people/1 [skill: "fishing"] + +foreach person people [ + print reduce [person/age "year old" person/name "is good at" any [select person 'skill "nothing"]] +] diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/Ring/add-a-variable-to-a-class-instance-at-runtime.ring b/Task/Add-a-variable-to-a-class-instance-at-runtime/Ring/add-a-variable-to-a-class-instance-at-runtime.ring new file mode 100644 index 0000000000..06aa05eada --- /dev/null +++ b/Task/Add-a-variable-to-a-class-instance-at-runtime/Ring/add-a-variable-to-a-class-instance-at-runtime.ring @@ -0,0 +1,6 @@ +o1 = new point +addattribute(o1,"x") +addattribute(o1,"y") +addattribute(o1,"z") +see o1 {x=10 y=20 z=30} +class point diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/Sidef/add-a-variable-to-a-class-instance-at-runtime.sidef b/Task/Add-a-variable-to-a-class-instance-at-runtime/Sidef/add-a-variable-to-a-class-instance-at-runtime.sidef new file mode 100644 index 0000000000..a5e472582a --- /dev/null +++ b/Task/Add-a-variable-to-a-class-instance-at-runtime/Sidef/add-a-variable-to-a-class-instance-at-runtime.sidef @@ -0,0 +1,4 @@ +class Empty{}; +var e = Empty(); # create a new class instance +e{:foo} = 42; # add variable 'foo' +say e{:foo}; # print the value of 'foo' diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/Swift/add-a-variable-to-a-class-instance-at-runtime.swift b/Task/Add-a-variable-to-a-class-instance-at-runtime/Swift/add-a-variable-to-a-class-instance-at-runtime.swift new file mode 100644 index 0000000000..7ee9188d7f --- /dev/null +++ b/Task/Add-a-variable-to-a-class-instance-at-runtime/Swift/add-a-variable-to-a-class-instance-at-runtime.swift @@ -0,0 +1,16 @@ +import Foundation + +let fooKey = UnsafeMutablePointer.alloc(1) + +class MyClass { } +let e = MyClass() + +// set +objc_setAssociatedObject(e, fooKey, 1, .OBJC_ASSOCIATION_RETAIN) + +// get +if let associatedObject = objc_getAssociatedObject(e, fooKey) { + print("associated object: \(associatedObject)") +} else { + print("no associated object") +} diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/jq/add-a-variable-to-a-class-instance-at-runtime-1.jq b/Task/Add-a-variable-to-a-class-instance-at-runtime/jq/add-a-variable-to-a-class-instance-at-runtime-1.jq new file mode 100644 index 0000000000..97ce61a2cf --- /dev/null +++ b/Task/Add-a-variable-to-a-class-instance-at-runtime/jq/add-a-variable-to-a-class-instance-at-runtime-1.jq @@ -0,0 +1 @@ +{"a":1} as $a | ($a + {"b":2}) as $a | $a diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/jq/add-a-variable-to-a-class-instance-at-runtime-2.jq b/Task/Add-a-variable-to-a-class-instance-at-runtime/jq/add-a-variable-to-a-class-instance-at-runtime-2.jq new file mode 100644 index 0000000000..8ebdc68f11 --- /dev/null +++ b/Task/Add-a-variable-to-a-class-instance-at-runtime/jq/add-a-variable-to-a-class-instance-at-runtime-2.jq @@ -0,0 +1,3 @@ +$a|.c = 3 +# or equivalently: +$a|.["c"] = 3 diff --git a/Task/Address-of-a-variable/Axe/address-of-a-variable-1.axe b/Task/Address-of-a-variable/Axe/address-of-a-variable-1.axe new file mode 100644 index 0000000000..006d4410c8 --- /dev/null +++ b/Task/Address-of-a-variable/Axe/address-of-a-variable-1.axe @@ -0,0 +1,2 @@ +°A→B +.B now contains the address of A diff --git a/Task/Address-of-a-variable/Axe/address-of-a-variable-2.axe b/Task/Address-of-a-variable/Axe/address-of-a-variable-2.axe new file mode 100644 index 0000000000..eed89d980e --- /dev/null +++ b/Task/Address-of-a-variable/Axe/address-of-a-variable-2.axe @@ -0,0 +1,2 @@ +1234→A +1→{A} diff --git a/Task/Address-of-a-variable/ERRE/address-of-a-variable-1.erre b/Task/Address-of-a-variable/ERRE/address-of-a-variable-1.erre new file mode 100644 index 0000000000..e7ad1569fe --- /dev/null +++ b/Task/Address-of-a-variable/ERRE/address-of-a-variable-1.erre @@ -0,0 +1,4 @@ +........ +A%=100 +ADDR=VARPTR(A%) +....... diff --git a/Task/Address-of-a-variable/ERRE/address-of-a-variable-2.erre b/Task/Address-of-a-variable/ERRE/address-of-a-variable-2.erre new file mode 100644 index 0000000000..725b097f92 --- /dev/null +++ b/Task/Address-of-a-variable/ERRE/address-of-a-variable-2.erre @@ -0,0 +1,8 @@ +PROGRAM POINTER +BEGIN + A%=100 + ADDR=VARPTR(A%) + PRINT(A%) ! prints 100 + POKE(ADDR,200) + PRINT(A%) ! prints 200 +END PROGRAM diff --git a/Task/Address-of-a-variable/FreeBASIC/address-of-a-variable-1.freebasic b/Task/Address-of-a-variable/FreeBASIC/address-of-a-variable-1.freebasic new file mode 100644 index 0000000000..ceb7de0677 --- /dev/null +++ b/Task/Address-of-a-variable/FreeBASIC/address-of-a-variable-1.freebasic @@ -0,0 +1,4 @@ +' FB 1.05.0 Win64 +Dim a As Integer = 3 +Dim p As Integer Ptr = @a +Print a, p diff --git a/Task/Address-of-a-variable/FreeBASIC/address-of-a-variable-2.freebasic b/Task/Address-of-a-variable/FreeBASIC/address-of-a-variable-2.freebasic new file mode 100644 index 0000000000..6db68804e5 --- /dev/null +++ b/Task/Address-of-a-variable/FreeBASIC/address-of-a-variable-2.freebasic @@ -0,0 +1,3 @@ +Var p = Cast(Integer Ptr, 1375832) +*p = 42 +Print p, *p diff --git a/Task/Address-of-a-variable/FutureBasic/address-of-a-variable.futurebasic b/Task/Address-of-a-variable/FutureBasic/address-of-a-variable.futurebasic new file mode 100644 index 0000000000..cf7ad188e1 --- /dev/null +++ b/Task/Address-of-a-variable/FutureBasic/address-of-a-variable.futurebasic @@ -0,0 +1,9 @@ +include "ConsoleWindow" + +dim as short i : i = 575 +dim as ptr j : j = NULL + +j = @i + +print "Adddress of i ="; j +print "Value of i ="; [j] diff --git a/Task/Address-of-a-variable/Nim/address-of-a-variable.nim b/Task/Address-of-a-variable/Nim/address-of-a-variable.nim new file mode 100644 index 0000000000..a0fc7266eb --- /dev/null +++ b/Task/Address-of-a-variable/Nim/address-of-a-variable.nim @@ -0,0 +1,4 @@ +var x = 12 +var xptr = addr(x) # Get address of variable +echo cast[int](xptr) # and print it +xptr = cast[ptr int](0xFFFE) # Set the address diff --git a/Task/Address-of-a-variable/Phix/address-of-a-variable.phix b/Task/Address-of-a-variable/Phix/address-of-a-variable.phix new file mode 100644 index 0000000000..86ad32960a --- /dev/null +++ b/Task/Address-of-a-variable/Phix/address-of-a-variable.phix @@ -0,0 +1,24 @@ +procedure address() +object V +integer addr4 -- stored /4 (assuming dword aligned, which it will be) +#ilASM{ + [32] + lea eax,[V] + shr eax,2 + mov [addr4],eax + [64] + lea rax,[V] + shr rax,2 + mov [addr4],rax + [] + } + if machine_bits()=32 then + poke4(addr4*4,123) + elsif machine_bits()=64 then + poke8(addr4*4,123) + end if + ?V + if getc(0) then end if +end procedure + +address() diff --git a/Task/Address-of-a-variable/Sidef/address-of-a-variable.sidef b/Task/Address-of-a-variable/Sidef/address-of-a-variable.sidef new file mode 100644 index 0000000000..c7dd73d30a --- /dev/null +++ b/Task/Address-of-a-variable/Sidef/address-of-a-variable.sidef @@ -0,0 +1,3 @@ +var n = 42; +say Sys.refaddr(\n); # prints the address of the variable +say Sys.refaddr(n); # prints the address of the object at which the variable points to diff --git a/Task/Address-of-a-variable/Swift/address-of-a-variable.swift b/Task/Address-of-a-variable/Swift/address-of-a-variable.swift new file mode 100644 index 0000000000..99aa87aae4 --- /dev/null +++ b/Task/Address-of-a-variable/Swift/address-of-a-variable.swift @@ -0,0 +1,31 @@ +class MyClass { +} + +func printPointer(ptr: UnsafePointer) { + println(ptr) +} + +func test() { + var x = 42 + var y = 3.14 + var z = "foo" + var obj = MyClass() + + // Use a pointer to a variable on the stack and print its address + withUnsafePointer(&x) { ptr in println(ptr) } + withUnsafePointer(&y) { ptr in println(ptr) } + withUnsafePointer(&z) { ptr in println(ptr) } + withUnsafePointer(&obj) { ptr in println(ptr) } + + // Alternately: + printPointer(&x) + printPointer(&y) + printPointer(&z) + printPointer(&obj) + + // Printing the address of an object that an object reference points to + // In Swift 3, unsafeAddress is removed + println(Unmanaged.passUnretained(obj).toOpaque()) +} + +test() diff --git a/Task/Address-of-a-variable/Wart/address-of-a-variable-1.wart b/Task/Address-of-a-variable/Wart/address-of-a-variable-1.wart new file mode 100644 index 0000000000..05e9ec1607 --- /dev/null +++ b/Task/Address-of-a-variable/Wart/address-of-a-variable-1.wart @@ -0,0 +1,2 @@ +addr.x +=> 27975840 diff --git a/Task/Address-of-a-variable/Wart/address-of-a-variable-2.wart b/Task/Address-of-a-variable/Wart/address-of-a-variable-2.wart new file mode 100644 index 0000000000..734cc6c432 --- /dev/null +++ b/Task/Address-of-a-variable/Wart/address-of-a-variable-2.wart @@ -0,0 +1,2 @@ +if (addr.x = addr.y) + .. diff --git a/Task/Align-columns/8th/align-columns.8th b/Task/Align-columns/8th/align-columns.8th new file mode 100644 index 0000000000..2c14524853 --- /dev/null +++ b/Task/Align-columns/8th/align-columns.8th @@ -0,0 +1,44 @@ +quote | Given$a$text$file$of$many$lines,$where$fields$within$a$line$ +are$delineated$by$a$single$'dollar'$character,$write$a$program +that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$ +column$are$separated$by$at$least$one$space. +Further,$allow$for$each$word$in$a$column$to$be$either$left$ +justified,$right$justified,$or$center$justified$within$its$column.| +var, raw-text + +[] var, data +var width + +: read-and-parse \ -- + raw-text @ + ( "$" s:/ data @ swap a:push drop ) + s:eachline ; + +: find-widest \ -- n + data @ ( ( swap s:len nip n:max ) swap a:reduce ) 0 a:reduce ; + +: print-data \ fmt -- + width @ swap s:strfmt >r + data @ + ( + nip + ( + nip + r@ s:strfmt . + ) a:each drop + + cr + ) a:each drop rdrop ; + + +: app:main + read-and-parse + + \ find widest column, and add one for the space: + find-widest n:1+ width ! + + \ print the data + cr "right:" . cr "%%>%ds" print-data + cr "left:" . cr "%%<%ds" print-data + cr "center:" . cr "%%|%ds" print-data + bye ; diff --git a/Task/Align-columns/FreeBASIC/align-columns.freebasic b/Task/Align-columns/FreeBASIC/align-columns.freebasic new file mode 100644 index 0000000000..efafa5f34a --- /dev/null +++ b/Task/Align-columns/FreeBASIC/align-columns.freebasic @@ -0,0 +1,98 @@ +' FB 1.05.0 Win64 + +Sub Split(s As String, sep As String, result() As String) + Dim As Integer i, j, count = 0 + Dim temp As String + Dim As Integer position(Len(s) + 1) + position(0) = 0 + For i = 0 To Len(s) - 1 + For j = 0 To Len(sep) - 1 + If s[i] = sep[j] Then + count += 1 + position(count) = i + 1 + End If + Next j + Next i + position(count + 1) = Len(s) + 1 + Redim result(count) + For i = 1 To count + 1 + result(i - 1) = Mid(s, position(i - 1) + 1, position(i) - position(i - 1) - 1) + Next +End Sub + +Sub CSet(buffer As String, s As Const String) + Dim As Integer bLength = Len(buffer) + Dim As Integer sLength = Len(s) + Dim As Integer diff, lSpaces + If sLength >= bLength Then + LSet buffer, s + Else + diff = bLength - sLength + lSpaces = diff \ 2 + LSet buffer, Space(lSpaces) + s + End If +End Sub + +Dim lines() As String +Dim count As Integer = 0 + +Open "align_columns.txt" For Input As #1 + +While Not Eof(1) + Redim Preserve lines(count) + Line Input #1, lines(count) + count +=1 +Wend + +Close #1 + +Dim As Integer i,j, length, numColumns = 0 +Dim As Integer numLines = UBound(lines) + 1 +Dim fields() As String + +' Work out the maximum number of columns +For i = 0 To numLines - 1 + Erase fields + Split RTrim(lines(i), "$"), "$", fields() + length = UBound(fields) + 1 + If length > numColumns Then numColumns = length +Next + +' Split lines into fields and work out maximum size of each column +Dim matrix(numLines - 1, numColumns - 1) As String +Dim columnSizes(numColumns - 1) As Integer + +For i = 0 To numLines - 1 + Erase fields + Split RTrim(lines(i), "$"), "$", fields() + For j = 0 To UBound(fields) + matrix(i, j) = fields(j) + length = Len(fields(j)) + If length > columnSizes(j) Then columnSizes(j) = length + Next j +Next i + +Dim buffer As String + +'Separate each column by 2 spaces +Open "align_left_columns.txt" For Output As #1 +Open "align_right_columns.txt" For Output As #2 +Open "align_center_columns.txt" For Output As #3 + +For i = 0 To UBound(matrix, 1) + For j = 0 To UBound(matrix, 2) + buffer = Space(columnSizes(j)) + LSet buffer, matrix(i, j) + Print #1, buffer; + RSet buffer, matrix(i, j) + Print #2, buffer; + CSet buffer, matrix(i, j) + Print #3, buffer; + If j < UBound(matrix, 2) Then + Print #1, " "; : Print #2, " "; : Print #3, " "; + End If + Next j + Print #1, : Print #2, : Print #3, +Next i + +Close #1 : Close #2 : Close #3 diff --git a/Task/Align-columns/Lasso/align-columns.lasso b/Task/Align-columns/Lasso/align-columns.lasso new file mode 100644 index 0000000000..e139927864 --- /dev/null +++ b/Task/Align-columns/Lasso/align-columns.lasso @@ -0,0 +1,67 @@ +#!/usr/bin/lasso9 + +local(text = "Given$a$text$file$of$many$lines,$where$fields$within$a$line$ +are$delineated$by$a$single$'dollar'$character,$write$a$program +that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$ +column$are$separated$by$at$least$one$space. +Further,$allow$for$each$word$in$a$column$to$be$either$left$ +justified,$right$justified,$or$center$justified$within$its$column. +") + + +define go_left(text::array, width::integer) => { + local(output = string) + with row in #text do { + with word in #row do { + #output -> append(string(#word) -> padtrailing(#width + 1)&) + } + #output -> append('\n') + } + return #output +} + +define go_right(text::array, width::integer) => { + local(output = string) + with row in #text do { + with word in #row do { + #output -> append(string(#word) -> padleading(#width + 1)&) + } + #output -> append('\n') + } + return #output +} + +define go_center(text::array, width::integer) => { + local(output = string) + with row in #text do { + with word in #row do { + local( + padlength = (#width + 1 - #word -> size), + padleft = (' ' * (#padlength / 2)), + padright = (' ' * (#padlength - #padleft -> size)) + ) + #output -> append(#padleft + string(#word) + #padright) + } + #output -> append('\n') + } + return #output +} + +define prepcols(text::string) => { + local( + result = array, + maxwidth = 0 + ) + with row in #text -> split('\n') do { + #row -> removetrailing('$') + #result -> insert(#row -> split('$')) + } + with word in delve(#result) do { + #word -> size > #maxwidth ? #maxwidth = #word -> size + } + stdoutnl('Left aligned result: \n' + go_left(#result, #maxwidth)) + stdoutnl('Right aligned result: \n' + go_right(#result, #maxwidth)) + stdoutnl('Centered result: \n' + go_center(#result, #maxwidth)) +} + +prepcols(#text) diff --git a/Task/Align-columns/Nim/align-columns.nim b/Task/Align-columns/Nim/align-columns.nim new file mode 100644 index 0000000000..02ee86e0e9 --- /dev/null +++ b/Task/Align-columns/Nim/align-columns.nim @@ -0,0 +1,22 @@ +import strutils, sequtils, strfmt + +let textinfile = """Given$a$text$file$of$many$lines,$where$fields$within$a$line$ +are$delineated$by$a$single$'dollar'$character,$write$a$program +that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$ +column$are$separated$by$at$least$one$space. +Further,$allow$for$each$word$in$a$column$to$be$either$left$ +justified,$right$justified,$or$center$justified$within$its$column.""" + +var words = textinfile.splitLines.mapIt(seq[string], it.split '$') +var maxs = newSeq[int](max words.mapIt(int, it.len)) + +for l in words: + for j,w in l: + maxs[j] = max(maxs[j], w.len+1) + +for i, align in ["<",">","^"]: + echo(["Left", "Right", "Center"][i], " column-aligned output:") + for l in words: + for j,w in l: + stdout.write w.format align & $maxs[j] + stdout.write "\n" diff --git a/Task/Align-columns/Oforth/align-columns.oforth b/Task/Align-columns/Oforth/align-columns.oforth new file mode 100644 index 0000000000..288cc2a654 --- /dev/null +++ b/Task/Align-columns/Oforth/align-columns.oforth @@ -0,0 +1,15 @@ +String method: justify(n, just) // ( just size string -- string ) +| l m | + n self size - dup ->l 2 / ->m + StringBuffer new + just $RIGHT == ifTrue: [ " " <lines + 0 lines apply(#[ apply(#[ size max ]) ]) ->maxsize + + lines apply(#[ apply(#[ justify(maxsize, just) . ]) printcr ]) ; diff --git a/Task/Align-columns/Phix/align-columns.phix b/Task/Align-columns/Phix/align-columns.phix new file mode 100644 index 0000000000..a2b06da5e6 --- /dev/null +++ b/Task/Align-columns/Phix/align-columns.phix @@ -0,0 +1,67 @@ +constant data = { + "Given$a$text$file$of$many$lines,$where$fields$within$a$line$", + "are$delineated$by$a$single$'dollar'$character,$write$a$program", + "that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$", + "column$are$separated$by$at$least$one$space.", + "Further,$allow$for$each$word$in$a$column$to$be$either$left$", + "justified,$right$justified,$or$center$justified$within$its$column." +} + +function split(sequence s, integer c) +sequence out = {} +integer first = 1, delim + while first<=length(s) do + delim = find_from(c,s,first) + if delim = 0 then + delim = length(s)+1 + end if + out = append(out,s[first..delim-1]) + first = delim + 1 + end while + return out +end function + +function align(sequence s, integer width, integer alignment) +integer n = width-length(s) + if n<=0 then + return s + elsif alignment<0 then + return s & repeat(' ', n) + elsif alignment>0 then + return repeat(' ', n) & s + else + -- (PL if I'd written this, I'd have n-floor(n/2) on the rhs) + return repeat(' ', floor(n/2)) & s & repeat(' ', floor(n/2+0.5)) + end if +end function + +procedure AlignColumns() +integer llij +sequence lines, li +sequence maxlens = {} + lines = repeat(0,length(data)) + for i=1 to length(data) do + li = split(data[i],'$') + lines[i] = li + if length(li)>length(maxlens) then + maxlens &= repeat(0,length(li)-length(maxlens)) + end if + for j=1 to length(li) do + llij = length(li[j]) + if llij>maxlens[j] then maxlens[j] = llij end if + end for + end for + + for a=-1 to 1 do -- (alignment = left/centre/right) + for i=1 to length(lines) do + for j=1 to length(lines[i]) do + puts(1, align(lines[i][j],maxlens[j],a) & ' ') + end for + puts(1,'\n') + end for + puts(1,'\n') + end for + if getc(0) then end if +end procedure + + AlignColumns() diff --git a/Task/Align-columns/Red/align-columns.red b/Task/Align-columns/Red/align-columns.red new file mode 100644 index 0000000000..b3c560f743 --- /dev/null +++ b/Task/Align-columns/Red/align-columns.red @@ -0,0 +1,59 @@ +Red [ + Title: "Align Columns" + Original-Author: oofoe +] + +text: {Given$a$text$file$of$many$lines,$where$fields$within$a$line$ +are$delineated$by$a$single$'dollar'$character,$write$a$program +that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$ +column$are$separated$by$at$least$one$space. +Further,$allow$for$each$word$in$a$column$to$be$either$left$ +justified,$right$justified,$or$center$justified$within$its$column.} + +; Parse specimen into data grid. + +data: copy [] +foreach line split text lf [ + append/only data split line "$" +] + +; Compute independent widths for each column. + +widths: copy [] +foreach line data [ + forall line [ + i: index? line + if i > length? widths [append widths 0] + widths/:i: max widths/:i length? line/1 + ] +] + +pad: function [n] [x: copy "" insert/dup x " " n x] + +; These formatting functions are passed as arguments to entable. + +right: func [n s][rejoin [pad n - length? s s]] + +left: func [n s][rejoin [s pad n - length? s]] + +centre: function [n s] [ + d: n - length? s + h: round/down d / 2 + rejoin [pad h s pad d - h] +] + +; Display data as table. + +entable: func [data format] [ + foreach line data [ + forall line [ + prin rejoin [format pick widths index? line line/1 " "] + ] + print "" + ] +] + +; Format data table. + +foreach i [left centre right] [ + print [newline "Align" i "..." newline] entable data get i] diff --git a/Task/Align-columns/Sidef/align-columns.sidef b/Task/Align-columns/Sidef/align-columns.sidef new file mode 100644 index 0000000000..24a7c9c9e6 --- /dev/null +++ b/Task/Align-columns/Sidef/align-columns.sidef @@ -0,0 +1,47 @@ +class Format(text, width) { + method align(j) { + text.map { |row| + row.range.map { |i| + '%-*s ' % (width[i], + '%*s' % (row[i].len + (width[i]-row[i].len * j/2), row[i])); + }.join(""); + }.join("\n") + "\n"; + } +} + +func Formatter(text) { + var textArr = []; + var widthArr = []; + + text.each_line { + var words = .split('$'); + textArr.append(words); + + words.each_kv { |i, word| + if (i == widthArr.len) { + widthArr.append(word.len); + } + elsif (word.len > widthArr[i]) { + widthArr[i] = word.len; + } + } + } + + return Format(textArr, widthArr); +} + +enum |left, middle, right|; +const text = <<'EOT'; +Given$a$text$file$of$many$lines,$where$fields$within$a$line$ +are$delineated$by$a$single$'dollar'$character,$write$a$program +that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$ +column$are$separated$by$at$least$one$space. +Further,$allow$for$each$word$in$a$column$to$be$either$left$ +justified,$right$justified,$or$center$justified$within$its$column. +EOT + +var f = Formatter(text); + +say f.align(left); +say f.align(middle); +say f.align(right); diff --git a/Task/Align-columns/jq/align-columns-1.jq b/Task/Align-columns/jq/align-columns-1.jq new file mode 100644 index 0000000000..928d9570a4 --- /dev/null +++ b/Task/Align-columns/jq/align-columns-1.jq @@ -0,0 +1,43 @@ +# transpose a possibly jagged matrix +def transpose: + if . == [] then [] + else (.[1:] | transpose) as $t + | .[0] as $row + | reduce range(0; [($t|length), (.[0]|length)] | max) as $i + ([]; . + [ [ $row[$i] ] + $t[$i] ]) + end; + +# left/right/center justification of strings: +def ljust(width): . + " " * (width - length); + +def rjust(width): " " * (width - length) + .; + +def center(width): + (width - length) as $pad + | if $pad <= 0 then . + else ($pad / 2 | floor) as $half + | $half * " " + . + ($pad-$half) * " " + end ; + +# input: a single string, which includes newlines to separate lines, and $ to separate phrases; +# method must be "left" "right" or anything else for central justification. +def format(method): + def justify(width): + if method == "left" then ljust(width) + elif method == "right" then rjust(width) + else center(width) + end; + + # max_widths: input: an array of strings, each with "$" as phrase-separator; + # return the appropriate column-wise maximum lengths + def max_widths: + map(split("$") | map(length)) + | transpose | map(max) ; + + split("\n") as $input + | $input + | (max_widths | map(.+1)) as $widths + | map( split("$") | . as $line | reduce range(0; length) as $i + (""; . + ($line[$i]|justify($widths[$i])) )) + | join("\n") +; diff --git a/Task/Align-columns/jq/align-columns-2.jq b/Task/Align-columns/jq/align-columns-2.jq new file mode 100644 index 0000000000..7d56451360 --- /dev/null +++ b/Task/Align-columns/jq/align-columns-2.jq @@ -0,0 +1,3 @@ +"Center:", format("center"), "", +"Left:", format("left"), "", +"Right:", format("right") diff --git a/Task/Align-columns/jq/align-columns-3.jq b/Task/Align-columns/jq/align-columns-3.jq new file mode 100644 index 0000000000..a3ad155b00 --- /dev/null +++ b/Task/Align-columns/jq/align-columns-3.jq @@ -0,0 +1,24 @@ +$ jq -M -R -r -s -f Align_columns.jq Align_columns.txt +Center: + Given a text file of many lines, where fields within a line + are delineated by a single 'dollar' character, write a program + that aligns each column of fields by ensuring that words in each + column are separated by at least one space. + Further, allow for each word in a column to be either left +justified, right justified, or center justified within its column. + +Left: +Given a text file of many lines, where fields within a line +are delineated by a single 'dollar' character, write a program +that aligns each column of fields by ensuring that words in each +column are separated by at least one space. +Further, allow for each word in a column to be either left +justified, right justified, or center justified within its column. + +Right: + Given a text file of many lines, where fields within a line + are delineated by a single 'dollar' character, write a program + that aligns each column of fields by ensuring that words in each + column are separated by at least one space. + Further, allow for each word in a column to be either left + justified, right justified, or center justified within its column. diff --git a/Task/Aliquot-sequence-classifications/EchoLisp/aliquot-sequence-classifications-1.echolisp b/Task/Aliquot-sequence-classifications/EchoLisp/aliquot-sequence-classifications-1.echolisp new file mode 100644 index 0000000000..fa1fe4a1b0 --- /dev/null +++ b/Task/Aliquot-sequence-classifications/EchoLisp/aliquot-sequence-classifications-1.echolisp @@ -0,0 +1,54 @@ +;; implementation of Floyd algorithm to find cycles in a graph +;; see Wikipedia https://en.wikipedia.org/wiki/Cycle_detection +;; returns (cycle-length cycle-starter steps) +;; steps = 0 if no cycle found +;; it's all about a tortoise 🐢 running at speed f(x) after a hare 🐰 at speed f(f (x)) +;; when they meet, a cycle is found + +(define (floyd f x0 steps maxvalue) + (define lam 1) ; cycle length + (define tortoise (f x0)) + (define hare (f (f x0))) + + ;; cyclic ? yes if steps > 0 + (while (and (!= tortoise hare) (> steps 0)) + (set!-values (tortoise hare) (values (f tortoise) (f (f hare)))) + #:break (and (> hare maxvalue) (set! steps 0)) + (set! steps (1- steps))) + + ;; first repetition = cycle starter + (set! tortoise x0) + (while (and (!= tortoise hare) (> steps 0)) + (set!-values (tortoise hare) (values (f tortoise) (f hare)))) + + ;; length of shortest cycle + (set! hare (f tortoise)) + (while (and (!= tortoise hare) (> steps 0)) + (set! hare (f hare)) + (set! lam (1+ lam))) + (values lam tortoise steps)) + +;; find cycle and classify +(define (taxonomy n (steps 16) (maxvalue 140737488355328)) + (define-values (cycle starter steps) (floyd sum-divisors n steps maxvalue)) + (write n + (cond + (( = steps 0) 'non-terminating) + (( = starter 0) 'terminating) + ((and (= starter n) (= cycle 1)) 'perfect) + ((and (= starter n) (= cycle 2)) 'amicable) + ((= starter n) 'sociable ) + ((= cycle 1) 'aspiring ) + (else 'cyclic))) + + (aliquote n starter) + ) + +;; print sequence +(define (aliquote x0 (starter -1) (end -1 )(n 8)) + (for ((i n)) + (write x0) + (set! x0 (sum-divisors x0)) + #:break (and (= x0 end) (write x0)) + (when (= x0 starter) (set! end starter))) + (writeln ...)) diff --git a/Task/Aliquot-sequence-classifications/EchoLisp/aliquot-sequence-classifications-2.echolisp b/Task/Aliquot-sequence-classifications/EchoLisp/aliquot-sequence-classifications-2.echolisp new file mode 100644 index 0000000000..61742d9d92 --- /dev/null +++ b/Task/Aliquot-sequence-classifications/EchoLisp/aliquot-sequence-classifications-2.echolisp @@ -0,0 +1,39 @@ +(lib 'math) +(lib 'bigint) + +(for-each taxonomy (range 1 13)) + +1 terminating 1 0 0 ... +2 terminating 2 1 0 0 ... +3 terminating 3 1 0 0 ... +4 terminating 4 3 1 0 0 ... +5 terminating 5 1 0 0 ... +6 perfect 6 6 6 ... +7 terminating 7 1 0 0 ... +8 terminating 8 7 1 0 0 ... +9 terminating 9 4 3 1 0 0 ... +10 terminating 10 8 7 1 0 0 ... +11 terminating 11 1 0 0 ... +12 terminating 12 16 15 9 4 3 1 0 0 ... + +(for-each taxonomy '( 28 496 220 1184 12496 1264460 790 909 562 1064 1488 15355717786080)) + +28 perfect 28 28 28 ... +496 perfect 496 496 496 ... +220 amicable 220 284 220 284 220 ... +1184 amicable 1184 1210 1184 1210 1184 ... +12496 sociable 12496 14288 15472 14536 14264 12496 14288 15472 ... +1264460 sociable 1264460 1547860 1727636 1305184 1264460 1547860 1727636 1305184 1264460 ... +790 aspiring 790 650 652 496 496 ... +909 aspiring 909 417 143 25 6 6 ... +562 cyclic 562 284 220 284 ... +1064 cyclic 1064 1336 1184 1210 1184 ... +1488 non-terminating 1488 2480 3472 4464 8432 9424 10416 21328 ... +15355717786080 non-terminating 15355717786080 44534663601120 144940087464480 471714103310688 1130798979186912 2688948041357088 6050151708497568 13613157922639968 ... + +(taxonomy 1000) ;; 1000 non-terminating after 16 steps +1000 non-terminating 1000 1340 1516 1144 1376 1396 1054 674 ... + +(taxonomy 1000 32) ;; but terminating if we increase the number of steps +1000 terminating +1000 1340 1516 1144 1376 1396 1054 674 340 416 466 236 184 176 196 203 37 1 0 0 ... diff --git a/Task/Aliquot-sequence-classifications/Oforth/aliquot-sequence-classifications.oforth b/Task/Aliquot-sequence-classifications/Oforth/aliquot-sequence-classifications.oforth new file mode 100644 index 0000000000..690ba6a13b --- /dev/null +++ b/Task/Aliquot-sequence-classifications/Oforth/aliquot-sequence-classifications.oforth @@ -0,0 +1,27 @@ +Integer method: properDivs +| i l | + ListBuffer new dup add(1) ->l + 2 self nsqrt tuck for: i [ self i mod ifFalse: [ l add(i) l add(self i / ) ] ] + sq self == ifTrue: [ l removeLast drop ] + l sort ; + +: aliquot(n) // ( n -- aList ) : Returns aliquot sequence of n +| end l | + 2 47 pow ->end + ListBuffer new dup add(n) dup ->l + while (l size 16 < l last 0 <> and l last end <= and) [ l last properDivs sum l add ] ; + +: aliquotClass(n) // ( n -- aList aString ) : Returns aliquot sequence and classification +| l i j | + n aliquot dup ->l + l last 0 == ifTrue: [ "terminate" return ] + l second n == ifTrue: [ "perfect" return ] + l third n == ifTrue: [ "amicable" return ] + l indexOfFrom(n, 2) ifNotNull: [ "sociable" return ] + + l size loop: i [ + l indexOfFrom(l at(i), i 1 +) -> j + j i 1 + == ifTrue: [ "aspiring" return ] + j ifNotNull: [ "cyclic" return ] + ] + "non-terminating" ; diff --git a/Task/Aliquot-sequence-classifications/Phix/aliquot-sequence-classifications.phix b/Task/Aliquot-sequence-classifications/Phix/aliquot-sequence-classifications.phix new file mode 100644 index 0000000000..ca96fe7c02 --- /dev/null +++ b/Task/Aliquot-sequence-classifications/Phix/aliquot-sequence-classifications.phix @@ -0,0 +1,33 @@ +function aliquot(atom n) +sequence s = {n} +integer k + if n=0 then return {"terminating",{0}} end if + while length(s)<16 + and n<140737488355328 do + n = sum(factors(n,-1)) + k = find(n,s) + if k then + if k=1 then + if length(s)=1 then return {"perfect",s} + elsif length(s)=2 then return {"amicable",s} + end if return {"sociable",s} + elsif k=length(s) then return {"aspiring",s} + end if return {"cyclic",append(s,n)} + elsif n=0 then return {"terminating",s} + end if + s = append(s,n) + end while + return {"non-terminating",s} +end function + +function flat_d(sequence s) + for i=1 to length(s) do s[i] = sprintf("%d",s[i]) end for + return join(s,",") +end function + +constant n = tagset(12)&{28, 496, 220, 1184, 12496, 1264460, 790, 909, 562, 1064, 1488, 15355717786080} +sequence class, dseq +for i=1 to length(n) do + {class, dseq} = aliquot(n[i]) + printf(1,"%14d => %15s, {%s}\n",{n[i],class,flat_d(dseq)}) +end for diff --git a/Task/Aliquot-sequence-classifications/jq/aliquot-sequence-classifications-1.jq b/Task/Aliquot-sequence-classifications/jq/aliquot-sequence-classifications-1.jq new file mode 100644 index 0000000000..950e5e6160 --- /dev/null +++ b/Task/Aliquot-sequence-classifications/jq/aliquot-sequence-classifications-1.jq @@ -0,0 +1,59 @@ +# "until" is available in more recent versions of jq +# than jq 1.4 +def until(cond; next): + def _until: + if cond then . else (next|_until) end; + _until; + +# unordered +def proper_divisors: + . as $n + | if $n > 1 then 1, + ( range(2; 1 + (sqrt|floor)) as $i + | if ($n % $i) == 0 then $i, + (($n / $i) | if . == $i then empty else . end) + else empty + end) + else empty + end; + +# sum of proper divisors, or 0 +def pdsum: + [proper_divisors] | add // 0; + +# input is n +# maxlen defaults to 16; +# maxterm defaults to 2^47 +def aliquot(maxlen; maxterm): + (maxlen // 15) as $maxlen + | (maxterm // 40737488355328) as $maxterm + | if . == 0 then "terminating at 0" + else + # [s, slen, new] = [[n], 1, n] + [ [.], 1, .] + | until( type == "string" or .[1] > $maxlen or .[2] > $maxterm; + .[0] as $s | .[1] as $slen + | ($s | .[length-1] | pdsum) as $new + | if ($s|index($new)) then + if $s[0] == $new then + if $slen == 1 then "perfect \($s)" + elif $slen == 2 then "amicable: \($s)" + else "sociable of length \($slen): \($s)" + end + elif ($s | .[length-1]) == $new then "aspiring: \($s)" + else "cyclic back to \($new): \($s)" + end + elif $new == 0 then "terminating: \($s + [0])" + else [ ($s + [$new]), ($slen + 1), $new ] + end ) + | if type == "string" then . else "non-terminating: \(.[0])" end + end; + +def task: + def pp: "\(.): \(aliquot(null;null))"; + (range(1; 11) | pp), + "", + ((11, 12, 28, 496, 220, 1184, 12496, 1264460, + 790, 909, 562, 1064, 1488, 15355717786080) | pp); + +task diff --git a/Task/Aliquot-sequence-classifications/jq/aliquot-sequence-classifications-2.jq b/Task/Aliquot-sequence-classifications/jq/aliquot-sequence-classifications-2.jq new file mode 100644 index 0000000000..280b1d96c7 --- /dev/null +++ b/Task/Aliquot-sequence-classifications/jq/aliquot-sequence-classifications-2.jq @@ -0,0 +1,26 @@ +$ jq -n -r -f aliquot.jq +1: terminating: [1,0] +2: terminating: [2,1,0] +3: terminating: [3,1,0] +4: terminating: [4,3,1,0] +5: terminating: [5,1,0] +6: perfect [6] +7: terminating: [7,1,0] +8: terminating: [8,7,1,0] +9: terminating: [9,4,3,1,0] +10: terminating: [10,8,7,1,0] + +11: terminating: [11,1,0] +12: terminating: [12,16,15,9,4,3,1,0] +28: perfect [28] +496: perfect [496] +220: amicable: [220,284] +1184: amicable: [1184,1210] +12496: sociable of length 5: [12496,14288,15472,14536,14264] +1264460: sociable of length 4: [1264460,1547860,1727636,1305184] +790: aspiring: [790,650,652,496] +909: aspiring: [909,417,143,25,6] +562: cyclic back to 284: [562,284,220] +1064: cyclic back to 1184: [1064,1336,1184,1210] +1488: non-terminating: [1488,2480,3472,4464,8432,9424,10416,21328,22320,55056,95728,96720,236592,459792,881392,882384] +15355717786080: non-terminating: [15355717786080,44534663601120] diff --git a/Task/Almost-prime/ERRE/almost-prime.erre b/Task/Almost-prime/ERRE/almost-prime.erre new file mode 100644 index 0000000000..1085cb3255 --- /dev/null +++ b/Task/Almost-prime/ERRE/almost-prime.erre @@ -0,0 +1,36 @@ +PROGRAM ALMOST_PRIME + +! +! for rosettacode.org +! + +!$INTEGER + +PROCEDURE KPRIME(N,K->KP) + LOCAL P,F + FOR P=2 TO 999 DO + EXIT IF NOT((F1)=K) +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) !CLS + FOR K=1 TO 5 DO + PRINT("k =";K;":";) + C=0 + FOR I=2 TO 999 DO + EXIT IF NOT(C<10) + KPRIME(I,K->KP) + IF KP THEN + PRINT(I;) + C+=1 + END IF + END FOR + PRINT + END FOR +END PROGRAM diff --git a/Task/Almost-prime/EchoLisp/almost-prime-1.echolisp b/Task/Almost-prime/EchoLisp/almost-prime-1.echolisp new file mode 100644 index 0000000000..0403e9f5fd --- /dev/null +++ b/Task/Almost-prime/EchoLisp/almost-prime-1.echolisp @@ -0,0 +1,11 @@ +(define (almost-prime? p k) + (= k (length (prime-factors p)))) + +(define (almost-primes k nmax) + (take (filter (rcurry almost-prime? k) [2 ..]) nmax)) + +(define (task (kmax 6) (nmax 10)) + (for ((k [1 .. kmax])) + (write 'k= k '|) + (for-each write (almost-primes k nmax)) + (writeln))) diff --git a/Task/Almost-prime/EchoLisp/almost-prime-2.echolisp b/Task/Almost-prime/EchoLisp/almost-prime-2.echolisp new file mode 100644 index 0000000000..f6e426dc9c --- /dev/null +++ b/Task/Almost-prime/EchoLisp/almost-prime-2.echolisp @@ -0,0 +1,7 @@ +(task) + +k= 1 | 2 3 5 7 11 13 17 19 23 29 +k= 2 | 4 6 9 10 14 15 21 22 25 26 +k= 3 | 8 12 18 20 27 28 30 42 44 45 +k= 4 | 16 24 36 40 54 56 60 81 84 88 +k= 5 | 32 48 72 80 108 112 120 162 168 176 diff --git a/Task/Almost-prime/EchoLisp/almost-prime-3.echolisp b/Task/Almost-prime/EchoLisp/almost-prime-3.echolisp new file mode 100644 index 0000000000..6a231eed7a --- /dev/null +++ b/Task/Almost-prime/EchoLisp/almost-prime-3.echolisp @@ -0,0 +1,50 @@ +(lib 'match) +(define-syntax-rule (: v i) (vector-ref v i)) +(reader-infix ':) ;; abbrev (vector-ref v i) === [v : i] + + +(lib 'bigint) +(define cprimes (list->vector (primes 10000))) + +;; generates next k-almost-prime < pmax +;; c = vector of k primes indices c[i] <= c[j] +;; p = vector of intermediate products prime[c[0]]*prime[c[1]]*.. +;; p[k-1] is the generated k-almost-prime +;; increment one c[i] at each step + +(define (almost-next pmax k c p) + (define almost-prime #f) + (define cp 0) + + (for ((i (in-range (1- k) -1 -1))) ;; look backwards for c[i] to increment + (vector-set! c i (1+ [c : i])) ;; increment c[i] + (set! cp [cprimes : [c : i]]) + (vector-set! p i (if (> i 0) (* [ p : (1- i)] cp) cp)) ;; update partial product + + (when (< [p : i) pmax) + (set! almost-prime + (and ;; set followers to c[i] value + (for ((j (in-range (1+ i) k))) + (vector-set! c j [c : i]) + (vector-set! p j (* [ p : (1- j)] cp)) + #:break (>= [p : j] pmax) => #f ) + [p : (1- k)] + ) ;; // and + ) ;; set! + ) ;; when + #:break almost-prime + ) ;; // for i + almost-prime ) + +;; not sorted list of k-almost-primes < pmax +(define (almost-primes k nmax) + (define base (expt 2 k)) ;; first one is 2^k + (define pmax (* base nmax)) + (define c (make-vector k #0)) + (define p (build-vector k (lambda(i) (expt #2 (1+ i))))) + + (cons base + (for/list + ((almost-prime (in-producer almost-next pmax k c p ))) + almost-prime))) + diff --git a/Task/Almost-prime/EchoLisp/almost-prime-4.echolisp b/Task/Almost-prime/EchoLisp/almost-prime-4.echolisp new file mode 100644 index 0000000000..186a314cf9 --- /dev/null +++ b/Task/Almost-prime/EchoLisp/almost-prime-4.echolisp @@ -0,0 +1,8 @@ +;; we want 500-almost-primes from the 10000-th. +(take (drop (list-sort < (almost-primes 500 10000)) 10000 ) 10) + +(7241149198492252834202927258094752774597239286103014697435725917649659974371690699721153852986 +440733637405206125678822081264723636566725108094369093648384 +etc ... + +;; The first one is 2^497 * 3 * 17 * 347 , same result as Haskell. diff --git a/Task/Almost-prime/FreeBASIC/almost-prime.freebasic b/Task/Almost-prime/FreeBASIC/almost-prime.freebasic new file mode 100644 index 0000000000..bf0c709e8a --- /dev/null +++ b/Task/Almost-prime/FreeBASIC/almost-prime.freebasic @@ -0,0 +1,32 @@ +' FB 1.05.0 Win64 + +Function kPrime(n As Integer, k As Integer) As Boolean + Dim f As Integer = 0 + For i As Integer = 2 To n + While n Mod i = 0 + If f = k Then Return false + f += 1 + n \= i + Wend + Next + Return f = k +End Function + +Dim As Integer i, c, k +For k = 1 To 5 + Print "k = "; k; " : "; + i = 2 + c = 0 + While c < 10 + If kPrime(i, k) Then + Print Using "### "; i; + c += 1 + End If + i += 1 + Wend + Print +Next + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Almost-prime/Futhark/almost-prime.futhark b/Task/Almost-prime/Futhark/almost-prime.futhark new file mode 100644 index 0000000000..b9e10b95c9 --- /dev/null +++ b/Task/Almost-prime/Futhark/almost-prime.futhark @@ -0,0 +1,18 @@ +fun kprime(n: int, k: int): bool = + let (p,f) = (2, 0) + loop ((n, p, f)) = while f < k && p*p <= n do + loop ((n,f)) = while 0 == n % p do + (n/p, f+1) + in (n, p+1, f) + in f + (if n > 1 then 1 else 0) == k + +fun main(m: int): [][]int = + map (fn k: [10]int => + let ps = replicate 10 0 + loop ((i,c,ps) = (2,0,ps)) = while c < 10 do + if kprime(i,k) then + unsafe let ps[c] = i + in (i+1, c+1, ps) + else (i+1, c, ps) + in ps) + (map (1+) (iota m)) diff --git a/Task/Almost-prime/Oforth/almost-prime.oforth b/Task/Almost-prime/Oforth/almost-prime.oforth new file mode 100644 index 0000000000..d640556c5f --- /dev/null +++ b/Task/Almost-prime/Oforth/almost-prime.oforth @@ -0,0 +1,9 @@ +: kprime(n, k) +| i | + 0 2 n for: i [ while(n i /mod swap 0 &= ) [ ->n 1+ ] drop ] k == ; + +: table(k) +| l | + ListBuffer new ->l + 2 while (l size 10 <>) [ dup k kprime ifTrue: [ dup l add ] 1+ ] + drop l ; diff --git a/Task/Almost-prime/Phix/almost-prime-1.phix b/Task/Almost-prime/Phix/almost-prime-1.phix new file mode 100644 index 0000000000..af7da60d93 --- /dev/null +++ b/Task/Almost-prime/Phix/almost-prime-1.phix @@ -0,0 +1,117 @@ +-- Naieve stuff, mostly, but coded with enthuiasm! +-- Following the idea behind (but not the code from!) the J submission: +-- Generate 10 primes (kept in p10) -- (print K=1) +-- Multiply each of them by the first ten primes +-- Sort and find unique values, take the first ten of those -- (print K=2) +-- Multiply each of them by the first ten primes +-- Sort and find unique values, take the first ten of those -- (print K=3) +-- ... +-- However I just keep a "top 10", using a bubble insertion, and stop +-- multiplying as soon as everything else for p10[i] will be too big. + +-- (as calculated earlier from this routine, +-- or that "return 1" in pi() works just fine.) +--constant f17={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59} +constant f17={2,3,5,7,11,13,17} + +function pi(integer n) +-- approximates the number of primes less than or equal to n +-- if n<=10 then return 4 end if +-- -- best estimate +-- return floor(n/(log(n)-1)) +-- if n<=20 then return 1 end if -- (or use a table:) + if n<17 then + for i=1 to length(f17) do + if n<=f17[i] then return i end if + end for + end if +-- -- upper bound for n>=17 (Rosser and Schoenfeld 1962): +-- return floor(1.25506*n/log(n)) + -- lower bound for n>=17 (Rosser and Schoenfeld 1962): + return floor(n/log(n)) +end function + +function primes(integer n) +-- return the first n prime numbers (tested 0 to 20,000, which took ~86s) +sequence prime +integer count = 0 +integer lowN, highN, midN + + -- First, iteratively estimate the sieve size required + lowN = 2*n + highN = n*n+1 + while lowNn then + highN = midN + else + lowN = midN+1 + end if + end while + -- Then apply standard sieve and store primes as we find + -- them towards the (no longer used) start of the sieve. + prime = repeat(1,highN) + for i=2 to highN do + if prime[i] then + count += 1 + prime[count] = i + if count>=n then exit end if + for k=i+i to highN by i do + prime[k] = 0 + end for + end if + end for + return prime[1..n] +end function + +procedure display(integer k, sequence kprimes) + printf(1,"%d: ",k) + for i=1 to length(kprimes) do + printf(1,"%5d",kprimes[i]) + end for + puts(1,"\n") +end procedure + +function bubble(sequence next, integer v) +-- insert v into next (discarding next[$]), keeping next in ascending order +-- (relies on next[1] /always/ being smaller that anything that we insert.) + for i=length(next)-1 to 1 by -1 do + if v>next[i] then + next[i+1] = v + exit + end if + next[i+1] = next[i] + end for + return next +end function + +procedure almost_prime() +sequence p10 = primes(10) +sequence apk = p10 -- (almostprime[k]) +sequence next = repeat(0,length(p10)) +integer high, test + for k=1 to 5 do + display(k,apk) + if k=5 then exit end if + next = apk + for i=1 to length(p10) do +-- next[i] = apk[i]*p10[1] + next[i] = apk[i]*2 + end for + high = next[$] + for i=2 to length(p10) do + for j=1 to length(next) do + test = apk[j]*p10[i] + if not find(test,next) then + if test>high then exit end if + next = bubble(next,test) + high = next[$] + end if + end for + end for + apk = next + end for + if getc(0) then end if +end procedure + + almost_prime() diff --git a/Task/Almost-prime/Phix/almost-prime-2.phix b/Task/Almost-prime/Phix/almost-prime-2.phix new file mode 100644 index 0000000000..2646629027 --- /dev/null +++ b/Task/Almost-prime/Phix/almost-prime-2.phix @@ -0,0 +1,44 @@ +function kprime(integer n, integer k) +-- +-- returns true if n has exactly k factors +-- +-- p is a "pseudo prime" in that 2,3,4,5,6,7,8,9,10,11 will behave +-- exactly like 2,3,5,7,11, ie the remainder(n,4)=0 (etc) will never +-- succeed because remainder(n,2) would have succeeded twice first. +-- Hence for larger n consider replacing p+=1 with p=next_prime(), +-- then again, on "" this performs an obscene number of divisions.. +-- +integer p = 2, + factors = 0 + + while factors1) + return factors==k +end function + +procedure almost_primeC() +integer nextkprime, count + + for k=1 to 5 do + printf(1,"k = %d: ", k); + nextkprime = 2 + count = 0 + while count<10 do + if kprime(nextkprime, k) then + printf(1," %4d", nextkprime) + count += 1 + end if + nextkprime += 1 + end while + puts(1,"\n") + end for + if getc(0) then end if +end procedure + + almost_primeC() diff --git a/Task/Almost-prime/Potion/almost-prime.potion b/Task/Almost-prime/Potion/almost-prime.potion new file mode 100644 index 0000000000..0358e27fa9 --- /dev/null +++ b/Task/Almost-prime/Potion/almost-prime.potion @@ -0,0 +1,20 @@ +# Converted from C +kprime = (n, k): + p = 2, f = 0 + while (f < k && p*p <= n): + while (0 == n % p): + n /= p + f++. + p++. + n = if (n > 1): 1. + else: 0. + f + n == k. + +1 to 5 (k): + "k = " print, k print, ":" print + i = 2, c = 0 + while (c < 10): + if (kprime(i, k)): " " print, i print, c++. + i++ + . + "" say. diff --git a/Task/Almost-prime/Ring/almost-prime.ring b/Task/Almost-prime/Ring/almost-prime.ring new file mode 100644 index 0000000000..0d3ba09946 --- /dev/null +++ b/Task/Almost-prime/Ring/almost-prime.ring @@ -0,0 +1,33 @@ +for ap = 1 to 5 + see "k = " + ap + ":" + aList = [] + for n = 1 to 200 + num = 0 + for nr = 1 to n + if n%nr=0 and isPrime(nr)=1 + num = num + 1 + pr = nr + while true + pr = pr * nr + if n%pr = 0 + num = num + 1 + else exit ok + end ok + next + if (ap = 1 and isPrime(n) = 1) or (ap > 1 and num = ap) + add(aList, n) + if len(aList)=10 exit ok ok + next + for m = 1 to len(aList) + see " " + aList[m] + next + see nl +next + +func isPrime num + if (num <= 1) return 0 ok + if (num % 2 = 0 and num != 2) return 0 ok + for i = 3 to floor(num / 2) -1 step 2 + if (num % i = 0) return 0 ok + next + return 1 diff --git a/Task/Almost-prime/SequenceL/almost-prime.sequencel b/Task/Almost-prime/SequenceL/almost-prime.sequencel new file mode 100644 index 0000000000..0fad5652b4 --- /dev/null +++ b/Task/Almost-prime/SequenceL/almost-prime.sequencel @@ -0,0 +1,22 @@ +import ; +import ; + +main(args(2)) := + let + result := firstNKPrimes(1 ... 5, 10); + + output[i] := "k = " ++ intToString(i) ++ ": " ++ delimit(intToString(result[i]), ' '); + in + delimit(output, '\n'); + +firstNKPrimes(k, N) := firstNKPrimesHelper(k, N, 2, []); + +firstNKPrimesHelper(k, N, current, result(1)) := + let + newResult := result when not isKPrime(k, current) else result ++ [current]; + in + result when size(result) = N + else + firstNKPrimesHelper(k, N, current + 1, newResult); + +isKPrime(k, n) := size(primeFactorization(n)) = k; diff --git a/Task/Almost-prime/Sidef/almost-prime.sidef b/Task/Almost-prime/Sidef/almost-prime.sidef new file mode 100644 index 0000000000..941dd2d248 --- /dev/null +++ b/Task/Almost-prime/Sidef/almost-prime.sidef @@ -0,0 +1,17 @@ +func is_k_almost_prime(n, k) { + for (var (p, f) = (2, 0); (f < k) && (p*p <= n); ++p) { + (n /= p; ++f) while p.divides(n); + } + n > 1 ? (f.inc == k) : (f == k) +} + +5.times { |k| + var x = 10 + say gather { + Math.inf.times { |i| + if (is_k_almost_prime(i, k)) { + take(i); (--x).is_zero && break; + } + } + } +} diff --git a/Task/Almost-prime/jq/almost-prime-1.jq b/Task/Almost-prime/jq/almost-prime-1.jq new file mode 100644 index 0000000000..d07c5f3943 --- /dev/null +++ b/Task/Almost-prime/jq/almost-prime-1.jq @@ -0,0 +1,84 @@ +# Recent versions of jq (version > 1.4) have the following definition of "until": +def until(cond; next): + def _until: + if cond then . else (next|_until) end; + _until; + +# relatively_prime(previous) tests whether the input integer is prime +# relative to the primes in the array "previous": +def relatively_prime(previous): + . as $in + | (previous|length) as $plen + # state: [found, ix] + | [false, 0] + | until( .[0] or .[1] >= $plen; + [ ($in % previous[.[1]]) == 0, .[1] + 1] ) + | .[0] | not ; + +# Emit a stream in increasing order of all primes (from 2 onwards) +# that are less than or equal to mx: +def primes(mx): + + # The helper function, next, has arity 0 for tail recursion optimization; + # it expects its input to be the array of previously found primes: + def next: + . as $previous + | ($previous | .[length-1]) as $last + | if ($last >= mx) then empty + else ((2 + $last) + | until( relatively_prime($previous) ; . + 2)) as $nextp + | if $nextp <= mx + then $nextp, (( $previous + [$nextp] ) | next) + else empty + end + end; + if mx <= 1 then empty + elif mx == 2 then 2 + else (2, 3, ( [2,3] | next)) + end +; + +# Return an array of the distinct prime factors of . in increasing order +def prime_factors: + + # Return an array of prime factors of . given that "primes" + # is an array of relevant primes: + def pf(primes): + if . <= 1 then [] + else . as $in + | if ($in | relatively_prime(primes)) then [$in] + else reduce primes[] as $p + ([]; + if ($in % $p) != 0 then . + else . + [$p] + (($in / $p) | pf(primes)) + end) + end + | unique + end; + + if . <= 1 then [] + else . as $in + | pf( [ primes( (1+$in) | sqrt | floor) ] ) + end; + +# Return an array of prime factors of . repeated according to their multiplicities: +def prime_factors_with_multiplicities: + # Emit p according to the multiplicity of p + # in the input integer assuming p > 1 + def multiplicity(p): + if . < p then empty + elif . == p then p + elif (. % p) == 0 then + ((./p) | recurse( if (. % p) == 0 then (. / p) else empty end) | p) + else empty + end; + + if . <= 1 then [] + else . as $in + | prime_factors as $primes + | if ($in|relatively_prime($primes)) then [$in] + else reduce $primes[] as $p + ([]; + if ($in % $p) == 0 then . + [$in|multiplicity($p)] else . end ) + end + end; diff --git a/Task/Almost-prime/jq/almost-prime-2.jq b/Task/Almost-prime/jq/almost-prime-2.jq new file mode 100644 index 0000000000..7f3dea6e36 --- /dev/null +++ b/Task/Almost-prime/jq/almost-prime-2.jq @@ -0,0 +1,14 @@ +def isalmostprime(k): (prime_factors_with_multiplicities | length) == k; + +# Emit a stream of the first N almost-k primes +def almostprimes(N; k): + if N <= 0 then empty + else + # state [remaining, candidate, answer] + [N, 1, null] + | recurse( if .[0] <= 0 then empty + elif (.[1] | isalmostprime(k)) then [.[0]-1, .[1]+1, .[1]] + else [.[0], .[1]+1, null] + end) + | .[2] | select(. != null) + end; diff --git a/Task/Almost-prime/jq/almost-prime-3.jq b/Task/Almost-prime/jq/almost-prime-3.jq new file mode 100644 index 0000000000..b3a84e301b --- /dev/null +++ b/Task/Almost-prime/jq/almost-prime-3.jq @@ -0,0 +1 @@ +range(1;6) as $k | "k=\($k): \([almostprimes(10;$k)])" diff --git a/Task/Almost-prime/jq/almost-prime-4.jq b/Task/Almost-prime/jq/almost-prime-4.jq new file mode 100644 index 0000000000..3de893f787 --- /dev/null +++ b/Task/Almost-prime/jq/almost-prime-4.jq @@ -0,0 +1,6 @@ +$ jq -c -r -n -f Almost_prime.jq +k=1: [2,3,5,7,11,13,17,19,23,29] +k=2: [4,6,9,10,14,15,21,22,25,26] +k=3: [8,12,18,20,27,28,30,42,44,45] +k=4: [16,24,36,40,54,56,60,81,84,88] +k=5: [32,48,72,80,108,112,120,162,168,176] diff --git a/Task/Amb/ERRE/amb.erre b/Task/Amb/ERRE/amb.erre new file mode 100644 index 0000000000..62e13a95ba --- /dev/null +++ b/Task/Amb/ERRE/amb.erre @@ -0,0 +1,50 @@ +PROGRAM AMB + +! +! for rosettacode.org +! + +!$KEY + +DIM SET1$[2],SET2$[2],SET3$[2],SET4$[2] + +FUNCTION WORDS_OK(STRING1$,STRING2$) + WORDS_OK=(RIGHT$(STRING1$,1)=LEFT$(STRING2$,1)) +END FUNCTION + +PROCEDURE AMB(SET1$[],SET2$[],SET3$[],SET4$[]->RESULT$) + RESULT$="" ! Empty string, e.g. fail + FOR A=0 TO 2 DO + FOR B=0 TO 2 DO + FOR C=0 TO 2 DO + FOR D=0 TO 2 DO + IF WORDS_OK(SET1$[A],SET2$[B]) AND WORDS_OK(SET2$[B],SET3$[C]) AND WORDS_OK(SET3$[C],SET4$[D]) THEN + RESULT$=SET1$[A]+" "+SET2$[B]+" "+SET3$[C]+" "+SET4$[D] + EXIT PROCEDURE + END IF + END FOR + END FOR + END FOR + END FOR +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) ! CLS + SET1$[0]="the" SET1$[1]="that" SET1$[2]="a" + SET2$[0]="frog" SET2$[1]="elephant" SET2$[2]="thing" + SET3$[0]="walked" SET3$[1]="treaded" SET3$[2]="grows" + SET4$[0]="slowly" SET4$[1]="quickly" SET4$[2]="" + + AMB(SET1$[],SET2$[],SET3$[],SET4$[]->TEXT$) + IF TEXT$<>"" THEN + PRINT("Correct sentence would be:") + PRINT(TEXT$) + ELSE + PRINT("Failed to fine a correct sentence.") + END IF + PRINT + PRINT("Press any key to exit.") + REPEAT + GET(Z$) + UNTIL LEN(Z$)<>0 +END PROGRAM diff --git a/Task/Amb/Egison/amb-1.egison b/Task/Amb/Egison/amb-1.egison new file mode 100644 index 0000000000..c946657bc3 --- /dev/null +++ b/Task/Amb/Egison/amb-1.egison @@ -0,0 +1,7 @@ +; We don't need 'amb' in the code since pattern-matching of Egison automatically do backtracking. +(match-all {{"the" "that" "a"} {"frog" "elephant" "thing"} {"walked" "treaded" "grows"} {"slowly" "quickly"}} (list (multiset string)) + [ $w_1) _> + (loop $i [2 $n] + > $w_i) _> ...> + )> + (map (lambda [$i] w_i) (between 1 n))]) diff --git a/Task/Amb/Egison/amb-2.egison b/Task/Amb/Egison/amb-2.egison new file mode 100644 index 0000000000..9812960ebb --- /dev/null +++ b/Task/Amb/Egison/amb-2.egison @@ -0,0 +1 @@ +{{"that" "thing" "grows" "slowly"}} diff --git a/Task/Amb/Nim/amb.nim b/Task/Amb/Nim/amb.nim new file mode 100644 index 0000000000..f24b66a4f9 --- /dev/null +++ b/Task/Amb/Nim/amb.nim @@ -0,0 +1,31 @@ +import future, strutils + +proc amb(comp: proc(a, b: string): bool, options: seq[seq[string]], + prev: string = nil): seq[string] = + if options.len == 0: return @[] + + for opt in options[0]: + # If this is the base call, prev is nil and we need to continue. + if prev != nil and not comp(prev, opt): continue + + # Take care of the case where we have no options left. + if options.len == 1: return @[opt] + + # Traverse into the tree. + let res = amb(comp, options[1..options.high], opt) + + # If it was a failure, try the next one. + if res.len > 0: return opt & res # We have a match + + return @[] + +const sets = @[@["the", "that", "a"], + @["frog", "elephant", "thing"], + @["walked", "treaded", "grows"], + @["slowly", "quickly"]] + +let result = amb((s, t: string) => (s[s.high] == t[0]), sets) +if result.len == 0: + echo "No matches found!" +else: + echo result.join " " diff --git a/Task/Amb/Phix/amb-1.phix b/Task/Amb/Phix/amb-1.phix new file mode 100644 index 0000000000..d095b6d582 --- /dev/null +++ b/Task/Amb/Phix/amb-1.phix @@ -0,0 +1,38 @@ +function amb1(sequence sets, object res=0, integer idx=1) +integer ch = 0 +integer pass = 0 + if idx>length(sets) then + pass = 1 + else + if res=0 then + res = repeat(0,length(sets)) + else + ch = sets[idx-1][res[idx-1]][$] + end if + for k=1 to length(sets[idx]) do + if ch=0 or sets[idx][k][1]=ch then + res[idx] = k + {pass,res} = amb1(sets,res,idx+1) + if pass then exit end if + end if + end for + end if + return {pass,res} +end function + +sequence sets = {{"the","that","a"}, + {"frog","elephant","thing"}, + {"walked","treaded","grows"}, + {"slowly","quickly"}} +integer pass +sequence res + {pass,res} = amb1(sets) + if pass then + puts(1,"success: ") + for i=1 to length(sets) do + res[i] = sets[i][res[i]] + end for + ?res + else + puts(1,"failure\n") + end if diff --git a/Task/Amb/Phix/amb-2.phix b/Task/Amb/Phix/amb-2.phix new file mode 100644 index 0000000000..1fe7998c79 --- /dev/null +++ b/Task/Amb/Phix/amb-2.phix @@ -0,0 +1,82 @@ +function amb(sequence sets, integer testrid, integer resrid=-1, object res=0, integer idx=1) +integer flag = (res==0) +integer pass = 0 + if idx>length(sets) then + pass = 1 + if resrid!=-1 then + call_proc(resrid,{sets,res}) + end if + else + if flag then + res = repeat(0,length(sets)) + end if + for k=1 to length(sets[idx]) do + res[idx] = k + if flag or call_func(testrid,{sets,res,idx}) then + {pass,res} = amb(sets,testrid,resrid,res,idx+1) + if pass and resrid=-1 then exit end if + end if + end for + end if + return {pass,res} +end function + +function pairable(sequence sets, sequence res, integer idx) + return sets[idx-1][res[idx-1]][$] = sets[idx][res[idx]][1] +end function +constant r_pairable = routine_id("pairable") + +procedure AMB_Show(sequence sets, sequence res) + puts(1,"success: ") + for i=1 to length(sets) do + res[i] = sets[i][res[i]] + end for + ?res +end procedure +constant r_show = routine_id("AMB_Show") + +function pythagorean(sequence sets, sequence res, integer idx) +-- (note that res[idx]==sets[idx][res[idx]] in all cases) +integer x, y, z + if sequence(sets) then end if -- (suppress warning) + {x,y,z} = res + return idx<3 or (x*x+y*y=z*z) +end function +constant r_pythagorean = routine_id("pythagorean") + +procedure pythag_show(sequence sets, sequence res) + if sequence(sets) then end if -- (suppress warning) + puts(1,"success: ") + ?res +end procedure +constant r_pythag_show = routine_id("pythag_show") + +-- see http://www.randomhacks.net/articles/2005/10/11/amb-operator +function not8(sequence sets, sequence res, integer idx) +-- (note that idx==2 in all cases) +-- (at the last moment, I flipped the test, after realising that +-- someone had completely misunderstood the original article... +-- ...and proved it by showing some strange output on rosetta.) +-- return sets[1][res[1]]*sets[idx][res[idx]]!=8 + return sets[1][res[1]]*sets[idx][res[idx]]=8 +end function +constant r_not8 = routine_id("not8") + +procedure not8_show(sequence sets, sequence res) + puts(1,"success: ") + ?{sets[1][res[1]],sets[2][res[2]]} +end procedure +constant r_not8_show = routine_id("not8_show") + +sequence sets = {{"the","that","a"}, + {"frog","elephant","thing"}, + {"walked","treaded","grows"}, + {"slowly","quickly"}} +sequence sets2 = repeat(tagset(11),3) +sequence sets3 = {{1, 2, 3}, {4, 5, 6}} + puts(1,"\nThe original:\n") + {} = amb(sets,r_pairable,r_show) + puts(1,"\nSmall Pythagorean triples problem:\n") + {} = amb(sets2,r_pythagorean,r_pythag_show) + puts(1,"\nSome strange not 8 problem:\n") -- (now fixed) + {} = amb(sets3,r_not8,r_not8_show) diff --git a/Task/Amb/jq/amb-1.jq b/Task/Amb/jq/amb-1.jq new file mode 100644 index 0000000000..808f291e9e --- /dev/null +++ b/Task/Amb/jq/amb-1.jq @@ -0,0 +1,6 @@ +def amb: .[]; + +def joins: + (.[0][-1:]) as $left + | (.[1][0:1]) as $right + | if $left == $right then true else empty end; diff --git a/Task/Amb/jq/amb-2.jq b/Task/Amb/jq/amb-2.jq new file mode 100644 index 0000000000..1df5257d17 --- /dev/null +++ b/Task/Amb/jq/amb-2.jq @@ -0,0 +1,8 @@ +(["the","that","a"] | amb) as $word1 + | (["frog","elephant","thing"] | amb) as $word2 + | [$word1, $word2] | joins + | (["walked","treaded","grows"] | amb) as $word3 + | [$word2, $word3] | joins + | (["slowly","quickly"] | amb) as $word4 + | [$word3, $word4] | joins + | [$word1, $word2, $word3, $word4] diff --git a/Task/Amb/jq/amb-3.jq b/Task/Amb/jq/amb-3.jq new file mode 100644 index 0000000000..77d265fb14 --- /dev/null +++ b/Task/Amb/jq/amb-3.jq @@ -0,0 +1,7 @@ +jq -n -f amb.jq +[ + "that", + "thing", + "grows", + "slowly" +] diff --git a/Task/Amb/jq/amb-4.jq b/Task/Amb/jq/amb-4.jq new file mode 100644 index 0000000000..f325d1dc55 --- /dev/null +++ b/Task/Amb/jq/amb-4.jq @@ -0,0 +1,6 @@ +def amb(condition): .[] | select(condition); + +def joins: + (.[0][-1:]) as $left + | (.[1][0:1]) as $right + | $left == $right ; diff --git a/Task/Amb/jq/amb-5.jq b/Task/Amb/jq/amb-5.jq new file mode 100644 index 0000000000..cf3035c207 --- /dev/null +++ b/Task/Amb/jq/amb-5.jq @@ -0,0 +1,5 @@ +(["the","that","a"] | amb(true)) as $word1 + | (["frog","elephant","thing"] | amb( [$word1, .] | joins)) as $word2 + | (["walked","treaded","grows"] | amb( [$word2, .] | joins)) as $word3 + | (["slowly","quickly"] | amb( [$word3, .] | joins)) as $word4 + | [$word1, $word2,$word3, $word4] diff --git a/Task/Amicable-pairs/Crystal/amicable-pairs.crystal b/Task/Amicable-pairs/Crystal/amicable-pairs.crystal new file mode 100644 index 0000000000..c4cf270868 --- /dev/null +++ b/Task/Amicable-pairs/Crystal/amicable-pairs.crystal @@ -0,0 +1,20 @@ +MX = 524_000_000 +N = Math.sqrt(MX).to_u32 +x = Array(Int32).new(MX+1, 1) + +(2..N).each { |i| + p = i*i + x[p] += i + k = i+i+1 + (p+i..MX).step(i) { |j| + x[j] += k + k += 1 + } +} + +(4..MX).each { |m| + n = x[m] + if n < m && n != 0 && m == x[n] + puts "#{n} #{m}" + end +} diff --git a/Task/Amicable-pairs/ERRE/amicable-pairs.erre b/Task/Amicable-pairs/ERRE/amicable-pairs.erre new file mode 100644 index 0000000000..125177378c --- /dev/null +++ b/Task/Amicable-pairs/ERRE/amicable-pairs.erre @@ -0,0 +1,28 @@ +PROGRAM AMICABLE + +CONST LIMIT=20000 + +PROCEDURE SUMPROP(NUM->M) + IF NUM<2 THEN M=0 EXIT PROCEDURE + SUM=1 + ROOT=SQR(NUM) + FOR I=2 TO ROOT-1 DO + IF (NUM=I*INT(NUM/I)) THEN + SUM=SUM+I+NUM/I + END IF + IF (NUM=ROOT*INT(NUM/ROOT)) THEN + SUM=SUM+ROOT + END IF + END FOR + M=SUM +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) ! CLS + PRINT("Amicable pairs < ";LIMIT) + FOR N=1 TO LIMIT DO + SUMPROP(N->M1) + SUMPROP(M1->M2) + IF (N=M2 AND N= n (* 1.5 m)) ;; assume n/m < 1.5 + #:continue (<= n m) ;; prevent perfect numbers + #:continue (!= (sum-divisors n) m) + (cons m n))) + +(amicable 20000) + → ((220 . 284) (1184 . 1210) (2620 . 2924) (5020 . 5564) (6232 . 6368) (10744 . 10856) (12285 . 14595) (17296 . 18416)) + +(amicable 1_000_000) ;; 42 pairs + → (... (802725 . 863835) (879712 . 901424) (898216 . 980984) (947835 . 1125765) (998104 . 1043096)) diff --git a/Task/Amicable-pairs/FreeBASIC/amicable-pairs-1.freebasic b/Task/Amicable-pairs/FreeBASIC/amicable-pairs-1.freebasic new file mode 100644 index 0000000000..f5db96f44c --- /dev/null +++ b/Task/Amicable-pairs/FreeBASIC/amicable-pairs-1.freebasic @@ -0,0 +1,35 @@ +' FreeBASIC v1.05.0 win64 + +Function SumProperDivisors(number As Integer) As Integer + If number < 2 Then Return 0 + Dim sum As Integer = 0 + For i As Integer = 1 To number \ 2 + If number Mod i = 0 Then sum += i + Next + Return sum +End Function + +Dim As Integer n, f +Dim As Integer sum(19999) + +For n = 1 To 19999 + sum(n) = SumProperDivisors(n) +Next + +Print "The pairs of amicable numbers below 20,000 are :" +Print + +For n = 1 To 19998 + ' f = SumProperDivisors(n) + f = sum(n) + If f <= n OrElse f < 1 OrElse f > 19999 Then Continue For + If f = sum(n) AndAlso n = sum(f) Then + Print Using "#####"; n; + Print " and "; Using "#####"; sum(n) + End If +Next + +Print +Print "Press any key to exit the program" +Sleep +End diff --git a/Task/Amicable-pairs/FreeBASIC/amicable-pairs-2.freebasic b/Task/Amicable-pairs/FreeBASIC/amicable-pairs-2.freebasic new file mode 100644 index 0000000000..db6cb564e0 --- /dev/null +++ b/Task/Amicable-pairs/FreeBASIC/amicable-pairs-2.freebasic @@ -0,0 +1,38 @@ +' version 04-10-2016 +' compile with: fbc -s console +' replaced the function with 2 FOR NEXT loops + +#Define max 20000 ' test for pairs below max +#Define max_1 max -1 + +Dim As String u_str = String(Len(Str(max))+1,"#") +Dim As UInteger n, f +Dim Shared As UInteger sum(max_1) + +For n = 2 To max_1 + sum(n) = 1 +Next + +For n = 2 To max_1 \ 2 + For f = n * 2 To max_1 Step n + sum(f) += n + Next +Next + +Print +Print Using " The pairs of amicable numbers below" & u_str & ", are :"; max +Print + +For n = 1 To max_1 -1 + f = Sum(n) + If f <= n OrElse f > max Then Continue For + If f = sum(n) AndAlso n = sum(f) Then + Print Using u_str & " and" & u_str ; n; f + End If +Next + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print : Print " Hit any key to end program" +Sleep +End diff --git a/Task/Amicable-pairs/Futhark/amicable-pairs.futhark b/Task/Amicable-pairs/Futhark/amicable-pairs.futhark new file mode 100644 index 0000000000..717a67bf12 --- /dev/null +++ b/Task/Amicable-pairs/Futhark/amicable-pairs.futhark @@ -0,0 +1,16 @@ +fun divisors(n: int): []int = + filter (fn x => n%x == 0) (map (1+) (iota (n/2))) + +fun amicable((n: int, nd: int), (m: int, md: int)): bool = + n < m && nd == m && md == n + +fun getPair (divs: [upper](int, int)) (flat_i: int): ((int,int), (int,int)) = + let i = flat_i / upper + let j = flat_i % upper + in unsafe (divs[i], divs[j]) + +fun main(upper: int): [][2]int = + let range = map (1+) (iota upper) + let divs = zip range (map (fn n => reduce (+) 0 (divisors n)) range) + let amicable = filter amicable (map (getPair divs) (iota (upper*upper))) + in map (fn (np,mp) => [np.0, mp.0]) amicable diff --git a/Task/Amicable-pairs/GFA-Basic/amicable-pairs.gfa b/Task/Amicable-pairs/GFA-Basic/amicable-pairs.gfa new file mode 100644 index 0000000000..5e535dda5d --- /dev/null +++ b/Task/Amicable-pairs/GFA-Basic/amicable-pairs.gfa @@ -0,0 +1,41 @@ +OPENW 1 +CLEARW 1 +' +DIM f%(20001) ! sum of proper factors for each n +FOR i%=1 TO 20000 + f%(i%)=@sum_proper_divisors(i%) +NEXT i% +' look for pairs +FOR i%=1 TO 20000 + FOR j%=i%+1 TO 20000 + IF f%(i%)=j% AND i%=f%(j%) + PRINT "Amicable pair ";i%;" ";j% + ENDIF + NEXT j% +NEXT i% +' +PRINT +PRINT "-- found all amicable pairs" +~INP(2) +CLOSEW 1 +' +' Compute the sum of proper divisors of given number +' +FUNCTION sum_proper_divisors(n%) + LOCAL i%,sum%,root% + ' + IF n%>1 ! n% must be 2 or larger + sum%=1 ! start with 1 + root%=SQR(n%) ! note that root% is an integer + ' check possible factors, up to sqrt + FOR i%=2 TO root% + IF n% MOD i%=0 + sum%=sum%+i% ! i% is a factor + IF i%*i%<>n% ! check i% is not actual square root of n% + sum%=sum%+n%/i% ! so n%/i% will also be a factor + ENDIF + ENDIF + NEXT i% + ENDIF + RETURN sum% +ENDFUNC diff --git a/Task/Amicable-pairs/Nim/amicable-pairs-1.nim b/Task/Amicable-pairs/Nim/amicable-pairs-1.nim new file mode 100644 index 0000000000..16c320df5b --- /dev/null +++ b/Task/Amicable-pairs/Nim/amicable-pairs-1.nim @@ -0,0 +1,18 @@ +from math import sqrt + +const N = 524_000_000.int32 + +proc sumProperDivisors(someNum: int32, chk4less: bool): int32 = + result = 1 + let maxPD = sqrt(someNum.float).int32 + let offset = someNum mod 2 + for divNum in countup(2 + offset, maxPD, 1 + offset): + if someNum mod divNum == 0: + result += divNum + someNum div divNum + if chk4less and result >= someNum: + return 0 + +for n in countdown(N, 2): + let m = sumProperDivisors(n, true) + if m != 0 and n == sumProperDivisors(m, false): + echo $n, " ", $m diff --git a/Task/Amicable-pairs/Nim/amicable-pairs-2.nim b/Task/Amicable-pairs/Nim/amicable-pairs-2.nim new file mode 100644 index 0000000000..941822dc4b --- /dev/null +++ b/Task/Amicable-pairs/Nim/amicable-pairs-2.nim @@ -0,0 +1,17 @@ +from math import sqrt + +const N = 524_000_000.int32 +var x = newSeq[int32](N+1) + +for i in 2..sqrt(N.float).int32: + var p = i*i + x[p] += i + var j = i + i + while (p += i; p <= N): + j.inc + x[p] += j + +for m in 4..N: + let n = x[m] + 1 + if n < m and n != 0 and m == x[n] + 1: + echo n, " ", m diff --git a/Task/Amicable-pairs/Oforth/amicable-pairs.oforth b/Task/Amicable-pairs/Oforth/amicable-pairs.oforth new file mode 100644 index 0000000000..195979dd1e --- /dev/null +++ b/Task/Amicable-pairs/Oforth/amicable-pairs.oforth @@ -0,0 +1,10 @@ +Integer method: properDivs self 2 / seq filter(#[ self swap mod 0 == ]) ; + +: amicables +| i j | + ListBuffer new + 20000 loop: i [ + i properDivs sum dup ->j i <= ifTrue: [ continue ] + j properDivs sum i <> ifTrue: [ continue ] + [ i, j ] over add + ] ; diff --git a/Task/Amicable-pairs/Phix/amicable-pairs.phix b/Task/Amicable-pairs/Phix/amicable-pairs.phix new file mode 100644 index 0000000000..2e7a2f1ad0 --- /dev/null +++ b/Task/Amicable-pairs/Phix/amicable-pairs.phix @@ -0,0 +1,5 @@ +integer n +for m=1 to 20000 do + n = sum(factors(m,-1)) + if mn and amicable(m)=n + see "" + n + " and " + m + nl ok +next +see "OK" + nl + +func amicable nr + sum = 1 + for d = 2 to sqrt(nr) + if nr % d = 0 + sum = sum + d + sum = sum + nr / d ok + next + return sum diff --git a/Task/Amicable-pairs/Sidef/amicable-pairs.sidef b/Task/Amicable-pairs/Sidef/amicable-pairs.sidef new file mode 100644 index 0000000000..858becaaa7 --- /dev/null +++ b/Task/Amicable-pairs/Sidef/amicable-pairs.sidef @@ -0,0 +1,15 @@ +func propdivsum(x) { + gather { + 2.to(x.isqrt).each { |d| + if (x %% d) { + take(d) + take(x/d) if !x.is_sqr + } + } + }.sum(x > 0 ? 1 : 0) +} + +1.to(20000).each { |i| + var j = propdivsum(i) + say "#{i} #{j}" if (j>i && i==propdivsum(j)) +} diff --git a/Task/Amicable-pairs/Swift/amicable-pairs-1.swift b/Task/Amicable-pairs/Swift/amicable-pairs-1.swift new file mode 100644 index 0000000000..85b5e7f6ed --- /dev/null +++ b/Task/Amicable-pairs/Swift/amicable-pairs-1.swift @@ -0,0 +1,54 @@ +import func Darwin.sqrt + +func sqrt(x:Int) -> Int { return Int(sqrt(Double(x))) } + +func properDivs(n: Int) -> [Int] { + + if n == 1 { return [] } + + var result = [Int]() + + for div in filter (1...sqrt(n), { n % $0 == 0 }) { + + result.append(div) + + if n/div != div && n/div != n { result.append(n/div) } + } + + return sorted(result) + +} + + +func sumDivs(n:Int) -> Int { + + struct Cache { static var sum = [Int:Int]() } + + if let sum = Cache.sum[n] { return sum } + + let sum = properDivs(n).reduce(0) { $0 + $1 } + + Cache.sum[n] = sum + + return sum +} + +func amicable(n:Int, m:Int) -> Bool { + + if n == m { return false } + + if sumDivs(n) != m || sumDivs(m) != n { return false } + + return true +} + +var pairs = [(Int, Int)]() + +for n in 1 ..< 20_000 { + for m in n+1 ... 20_000 { + if amicable(n, m) { + pairs.append(n, m) + println("\(n, m)") + } + } +} diff --git a/Task/Amicable-pairs/Swift/amicable-pairs-2.swift b/Task/Amicable-pairs/Swift/amicable-pairs-2.swift new file mode 100644 index 0000000000..419c9a089b --- /dev/null +++ b/Task/Amicable-pairs/Swift/amicable-pairs-2.swift @@ -0,0 +1,44 @@ +import func Darwin.sqrt + +func sqrt(x:Int) -> Int { return Int(sqrt(Double(x))) } + +func sigma(n: Int) -> Int { + + if n == 1 { return 0 } // definition of aliquot sum + + var result = 1 + let root = sqrt(n) + + for var div = 2; div <= root; ++div { + if n % div == 0 { + result += div + n/div + } + + } + if root*root == n { result -= root } + + return (result) +} + +func amicables (upTo: Int) -> () { + + var aliquot = Array(count: upTo+1, repeatedValue: 0) + + for i in 1 ... upTo { // fill lookup array + aliquot[i] = sigma(i) + } + + for i in 1 ... upTo { + let a = aliquot[i] + if a > upTo {continue} //second part of pair out-of-bounds + + if a == i {continue} //skip perfect numbers + + if i == aliquot[a] { + print("\(i, a)") + aliquot[a] = upTo+1 //prevent second display of pair + } + } +} + +amicables(20_000) diff --git a/Task/Amicable-pairs/jq/amicable-pairs-1.jq b/Task/Amicable-pairs/jq/amicable-pairs-1.jq new file mode 100644 index 0000000000..87f1434584 --- /dev/null +++ b/Task/Amicable-pairs/jq/amicable-pairs-1.jq @@ -0,0 +1,26 @@ +# unordered +def proper_divisors: + . as $n + | if $n > 1 then 1, + (sqrt|floor as $s + | range(2; $s+1) as $i + | if ($n % $i) == 0 then $i, + (if $i * $i == $n then empty else ($n / $i) end) + else empty + end) + else empty + end; + +def addup(stream): reduce stream as $i (0; . + $i); + +def task(n): + (reduce range(0; n+1) as $n + ( []; . + [$n | addup(proper_divisors)] )) as $listing + | range(1;n+1) as $j + | range(1;$j) as $k + | if $listing[$j] == $k and $listing[$k] == $j + then "\($k) and \($j) are amicable" + else empty + end ; + +task(20000) diff --git a/Task/Amicable-pairs/jq/amicable-pairs-2.jq b/Task/Amicable-pairs/jq/amicable-pairs-2.jq new file mode 100644 index 0000000000..9aa0cb262f --- /dev/null +++ b/Task/Amicable-pairs/jq/amicable-pairs-2.jq @@ -0,0 +1,9 @@ +$ jq -c -n -f amicable_pairs.jq +220 and 284 are amicable +1184 and 1210 are amicable +2620 and 2924 are amicable +5020 and 5564 are amicable +6232 and 6368 are amicable +10744 and 10856 are amicable +12285 and 14595 are amicable +17296 and 18416 are amicable diff --git a/Task/Anagrams-Deranged-anagrams/EchoLisp/anagrams-deranged-anagrams-1.echolisp b/Task/Anagrams-Deranged-anagrams/EchoLisp/anagrams-deranged-anagrams-1.echolisp new file mode 100644 index 0000000000..82eccaa440 --- /dev/null +++ b/Task/Anagrams-Deranged-anagrams/EchoLisp/anagrams-deranged-anagrams-1.echolisp @@ -0,0 +1,31 @@ +(lib 'hash) +(lib 'struct) +(lib 'sql) +(lib 'words) + + +(define H (make-hash)) + +(define (deranged w1 w2) + (for ((a w1) (b w2)) + #:break (string=? a b) => #f + #t)) + +(define (anagrams (normal) (name) (twins)) +(for ((w *words*)) + (set! name (word-name w)) + (set! normal (list->string (list-sort stringlist name)))) + (set! twins (or (hash-ref H normal) null)) + #:continue (member name twins) + #:when (or (null? twins) (for/or ((anagram twins)) (deranged name anagram))) + (hash-set H normal (cons name twins)))) + + +(define (task (lmin 8)) +(anagrams) +(for ((lw (hash-values H))) ;; lw = list of words + #:continue (= (length lw) 1) + #:continue (< (string-length (first lw)) lmin) + (set! lmin (string-length (first lw))) + (write lmin) (for-each write lw) + (writeln))) diff --git a/Task/Anagrams-Deranged-anagrams/EchoLisp/anagrams-deranged-anagrams-2.echolisp b/Task/Anagrams-Deranged-anagrams/EchoLisp/anagrams-deranged-anagrams-2.echolisp new file mode 100644 index 0000000000..889375be12 --- /dev/null +++ b/Task/Anagrams-Deranged-anagrams/EchoLisp/anagrams-deranged-anagrams-2.echolisp @@ -0,0 +1,22 @@ +(lib 'dico.fr.no-accent) ;; 209315 words into *words* table +(task) + +[...] +13 tractionnaire contrariaient +13 ressourcement contremesures +13 saintsimonien inseminations +14 tergiversation interrogatives +14 suralimenterai mineralisateur +14 transoceaniens reconnaissante + +(lib 'dico.en ) ;; 235886 words +(task) + +[...] + +12 reaccomplish accomplisher +12 chromatician achromatinic +12 unaccumulate acutenaculum +14 charlatanistic antarchistical +15 megachiropteran cinematographer +17 misconstitutional constitutionalism diff --git a/Task/Anagrams-Deranged-anagrams/FreeBASIC/anagrams-deranged-anagrams.freebasic b/Task/Anagrams-Deranged-anagrams/FreeBASIC/anagrams-deranged-anagrams.freebasic new file mode 100644 index 0000000000..17068bf2ee --- /dev/null +++ b/Task/Anagrams-Deranged-anagrams/FreeBASIC/anagrams-deranged-anagrams.freebasic @@ -0,0 +1,135 @@ +' FB 1.05.0 Win64 + +Type IndexedWord + As String word + As Integer index +End Type + +' selection sort, quick enough for sorting small number of letters +Sub sortWord(s As String) + Dim As Integer i, j, m, n = Len(s) + For i = 0 To n - 2 + m = i + For j = i + 1 To n - 1 + If s[j] < s[m] Then m = j + Next j + If m <> i Then Swap s[i], s[m] + Next i +End Sub + +' quicksort for sorting whole dictionary of IndexedWord instances by sorted word +Sub quicksort(a() As IndexedWord, first As Integer, last As Integer) + Dim As Integer length = last - first + 1 + If length < 2 Then Return + Dim pivot As String = a(first + length\ 2).word + Dim lft As Integer = first + Dim rgt As Integer = last + While lft <= rgt + While a(lft).word < pivot + lft +=1 + Wend + While a(rgt).word > pivot + rgt -= 1 + Wend + If lft <= rgt Then + Swap a(lft), a(rgt) + lft += 1 + rgt -= 1 + End If + Wend + quicksort(a(), first, rgt) + quicksort(a(), lft, last) +End Sub + +Function isDeranged(s1 As String, s2 As String) As Boolean + For i As Integer = 0 To Len(s1) - 1 + If s1[i] = s2[i] Then Return False + Next + Return True +End Function + +Dim t As Double = timer +Dim As String w() '' array to hold actual words +Open "undict.txt" For Input As #1 +Dim count As Integer = 0 +While Not Eof(1) + count +=1 + Redim Preserve w(1 To count) + Line Input #1, w(count) +Wend +Close #1 + +Dim As IndexedWord iw(1 To count) '' array to hold sorted words and their index into w() +Dim word As String +For i As Integer = 1 To count + word = w(i) + sortWord(word) + iw(i).word = word + iw(i).index = i +Next +quickSort iw(), 1, count '' sort the IndexedWord array by sorted word + +Dim As Integer startIndex = 1, maxLength, ub +Dim As Integer maxIndex() +Dim As IndexedWord iWord = iw(1) +maxLength = 0 + +For i As Integer = 2 To count + If iWord.word = iw(i).word Then + If isDeranged(w(iword.index), w(iw(i).index)) Then + If startIndex + 1 < i Then Swap iw(i), iw(startIndex + 1) + If Len(iWord.word) > maxLength Then + maxLength = Len(iWord.word) + Erase maxIndex + ub = 1 + Redim maxIndex(1 To ub) + maxIndex(ub) = startIndex + startIndex += 2 + i = startIndex + iWord = iw(i) + ElseIf Len(iWord.word) = maxLength Then + ub += 1 + Redim Preserve maxIndex(1 To ub) + maxIndex(ub) = startIndex + startIndex += 2 + i = startIndex + iWord = iw(i) + End If + End If + ElseIf i = count Then + Exit For + Else + For j As Integer = i To count - 1 + iWord = iw(j) + If Len(iWord.word) >= maxLength Then + startIndex = j + i = startIndex + Exit For + End If + Next + End If +Next + +Print Str(count); " words in the dictionary" +Print "The deranged anagram pair(s) with the greatest length (namely"; maxLength; ") is:" +Print +Dim iws(1 To maxLength) As IndexedWord '' array to hold each deranged anagram pair +For i As Integer = 1 To UBound(maxIndex) + For j As Integer = maxIndex(i) To maxIndex(i) + 1 + iws(j - maxIndex(i) + 1) = iw(j) + Next j + If iws(1).index > iws(2).index Then swap iws(1), iws(2) '' ensure pair is in correct order + For j As Integer = 1 To 2 + Print w(iws(j).index); " "; + Next j + Print +Next i + +Print +Print "Took "; +Print Using "#.###"; timer - t; +Print " seconds on i3 @ 2.13 GHz" + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Anagrams-Deranged-anagrams/Lasso/anagrams-deranged-anagrams.lasso b/Task/Anagrams-Deranged-anagrams/Lasso/anagrams-deranged-anagrams.lasso new file mode 100644 index 0000000000..bfb2e6fc82 --- /dev/null +++ b/Task/Anagrams-Deranged-anagrams/Lasso/anagrams-deranged-anagrams.lasso @@ -0,0 +1,53 @@ +local( + anagrams = map, + words = include_url('http://www.puzzlers.org/pub/wordlists/unixdict.txt') -> split('\n'), + key, + max = 0, + wordsize, + findings = array, + derangedtest = { // this code snippet is not executed until the variable is invoked. It will return true if the compared words are a deranged anagram + local( + w1 = #1, + w2 = #2, + testresult = true + ) + + loop(#w1 -> size) => { + #w1 -> get(loop_count) == #w2 -> get(loop_count) ? #testresult = false + } + return #testresult + } +) + +// find all anagrams +with word in #words do { + #key = #word -> split('') -> sort& -> join('') + not(#anagrams >> #key) ? #anagrams -> insert(#key = array) + #anagrams -> find(#key) -> insert(#word) +} + +// step thru each set of anagrams to find deranged ones +with ana in #anagrams +let ana_size = #ana -> size +where #ana_size > 1 +do { + #wordsize = #ana -> first -> size + + if(#wordsize >= #max) => { + + loop(#ana_size - 1) => { + if(#derangedtest -> detach & invoke(#ana -> get(loop_count), #ana -> get(loop_count + 1))) => { + // we only care to save the found deranged anagram if it is longer than the previous longest one + if(#wordsize > #max) => { + #findings = array(#ana -> get(loop_count) + ', ' + #ana -> get(loop_count + 1)) + else + #findings -> insert(#ana -> get(loop_count) + ', ' + #ana -> get(loop_count + 1)) + } + #max = #wordsize + } + } + + } +} + +#findings -> join('
\n') diff --git a/Task/Anagrams-Deranged-anagrams/Phix/anagrams-deranged-anagrams.phix b/Task/Anagrams-Deranged-anagrams/Phix/anagrams-deranged-anagrams.phix new file mode 100644 index 0000000000..3a67dda042 --- /dev/null +++ b/Task/Anagrams-Deranged-anagrams/Phix/anagrams-deranged-anagrams.phix @@ -0,0 +1,49 @@ +function deranged(string word1, string word2) + if length(word1)!=length(word2) then ?9/0 end if -- sanity check + for i=1 to length(word1) do + if word1[i]==word2[i] then return 0 end if + end for + return 1 +end function + +integer fn = open("unixdict.txt","r") +sequence words = {}, anagrams = {}, last="", letters +object word +integer maxlen = 1 + + while 1 do + word = trim(gets(fn)) + if atom(word) then exit end if + if length(word) then + letters = sort(word) + words = append(words, {letters, word}) + end if + end while + close(fn) + + words = sort(words) + for i=1 to length(words) do + {letters,word} = words[i] + if letters=last then + anagrams[$] = append(anagrams[$],word) + anagrams[$][1] = length(word) + else + last = letters + anagrams = append(anagrams,{0,word}) + end if + end for + + anagrams = sort(anagrams) + puts(1,"\nLongest deranged anagrams:\n") + for i=length(anagrams) to 1 by -1 do + last = anagrams[i] + if last[1] %s\n", a[i].len, a[i], a[j]) + return true + ) + } + } + return false +} + +func main(File file) { + + file.open_r(\var fh, \var err) -> + || die "Can't open file `#{file}' for reading: #{err}\n" + + var letter_list = Hash() + + # Store anagrams in hash table by letters they contain + fh.words.each { |word| + letter_list{word.sort} := [] << word + } + + letter_list.keys \ + .grep {|k| letter_list{k}.len > 1} \ # take only ones with anagrams + .sort {|a,b| b.len <=> a.len} \ # sort by length, descending + .each {|key| + + # If we find a pair, they are the longested due to the sort before + find_deranged(letter_list{key}) && break + } +} + +main(%f'/tmp/unixdict.txt') diff --git a/Task/Anagrams/EchoLisp/anagrams-1.echolisp b/Task/Anagrams/EchoLisp/anagrams-1.echolisp new file mode 100644 index 0000000000..00447096a0 --- /dev/null +++ b/Task/Anagrams/EchoLisp/anagrams-1.echolisp @@ -0,0 +1,35 @@ +(require 'struct) +(require 'hash) +(require 'sql) +(require 'words) +(require 'dico.fr.no-accent) + + +(define mots-français (words-select #:any null 999999)) +(string-delimiter "") + +(define (string-sort str) + (list->string (list-sort stringlist str)))) + +(define (ana-sort H words) ;; bump counter for each word + (for ((w words)) + #:continue (< (string-length w) 4) + (let [(key (string-sort w))] (hash-set H key (1+ (hash-ref! H key 0)))))) + +;; input w word +;; output : list of matching words +(define (anagrams w words) + (set! w (string-sort w)) + (make-set + (for/list (( ana words)) + #:when (string=? w (string-sort ana)) + ana))) + +(define (task words) +(define H (make-hash)) + (ana-sort H words) ;; build counters key= sorted-string, value = count + (hash-get-keys H ;; extract max count values + (for/fold (hmax 0) ((h H) ) + #:when (>= (cdr h) hmax) + (cdr h)) + )) diff --git a/Task/Anagrams/EchoLisp/anagrams-2.echolisp b/Task/Anagrams/EchoLisp/anagrams-2.echolisp new file mode 100644 index 0000000000..f9908d335b --- /dev/null +++ b/Task/Anagrams/EchoLisp/anagrams-2.echolisp @@ -0,0 +1,8 @@ +(length mots-français) + → 209315 +(task mots-français) + → (aeilns acenr) ;; two winners +(anagrams "acenr" mots-français) + → { ancre caner caren carne ceran cerna encra nacre nerac rance renac } +(anagrams "aeilns" mots-français) + → { alisen enlias enlisa ensila islaen islean laines lianes salien saline selina } diff --git a/Task/Anagrams/FreeBASIC/anagrams.freebasic b/Task/Anagrams/FreeBASIC/anagrams.freebasic new file mode 100644 index 0000000000..86b64c015c --- /dev/null +++ b/Task/Anagrams/FreeBASIC/anagrams.freebasic @@ -0,0 +1,136 @@ +' FB 1.05.0 Win64 + +Type IndexedWord + As String word + As Integer index +End Type + +' selection sort, quick enough for sorting small number of letters +Sub sortWord(s As String) + Dim As Integer i, j, m, n = Len(s) + For i = 0 To n - 2 + m = i + For j = i + 1 To n - 1 + If s[j] < s[m] Then m = j + Next j + If m <> i Then Swap s[i], s[m] + Next i +End Sub + +' selection sort, quick enough for sorting small array of IndexedWord instances by index +Sub sortIndexedWord(iw() As IndexedWord) + Dim As Integer i, j, m, n = UBound(iw) + For i = 1 To n - 1 + m = i + For j = i + 1 To n + If iw(j).index < iw(m).index Then m = j + Next j + If m <> i Then Swap iw(i), iw(m) + Next i +End Sub + +' quicksort for sorting whole dictionary of IndexedWord instances by sorted word +Sub quicksort(a() As IndexedWord, first As Integer, last As Integer) + Dim As Integer length = last - first + 1 + If length < 2 Then Return + Dim pivot As String = a(first + length\ 2).word + Dim lft As Integer = first + Dim rgt As Integer = last + While lft <= rgt + While a(lft).word < pivot + lft +=1 + Wend + While a(rgt).word > pivot + rgt -= 1 + Wend + If lft <= rgt Then + Swap a(lft), a(rgt) + lft += 1 + rgt -= 1 + End If + Wend + quicksort(a(), first, rgt) + quicksort(a(), lft, last) +End Sub + +Dim t As Double = timer +Dim As String w() '' array to hold actual words +Open "undict.txt" For Input As #1 +Dim count As Integer = 0 +While Not Eof(1) + count +=1 + Redim Preserve w(1 To count) + Line Input #1, w(count) +Wend +Close #1 + +Dim As IndexedWord iw(1 To count) '' array to hold sorted words and their index into w() +Dim word As String +For i As Integer = 1 To count + word = w(i) + sortWord(word) + iw(i).word = word + iw(i).index = i +Next +quickSort iw(), 1, count '' sort the IndexedWord array by sorted word + +Dim As Integer startIndex = 1, length = 1, maxLength = 1, ub = 1 +Dim As Integer maxIndex(1 To ub) +maxIndex(ub) = 1 +word = iw(1).word + +For i As Integer = 2 To count + If word = iw(i).word Then + length += 1 + Else + If length > maxLength Then + maxLength = length + Erase maxIndex + ub = 1 + Redim maxIndex(1 To ub) + maxIndex(ub) = startIndex + ElseIf length = maxLength Then + ub += 1 + Redim Preserve maxIndex(1 To ub) + maxIndex(ub) = startIndex + End If + startIndex = i + length = 1 + word = iw(i).word + End If +Next + +If length > maxLength Then + maxLength = length + Erase maxIndex + Redim maxIndex(1 To 1) + maxIndex(1) = startIndex +ElseIf length = maxLength Then + ub += 1 + Redim Preserve maxIndex(1 To ub) + maxIndex(ub) = startIndex +End If + +Print Str(count); " words in the dictionary" +Print "The anagram set(s) with the greatest number of words (namely"; maxLength; ") is:" +Print +Dim iws(1 To maxLength) As IndexedWord '' array to hold each anagram set +For i As Integer = 1 To UBound(maxIndex) + For j As Integer = maxIndex(i) To maxIndex(i) + maxLength - 1 + iws(j - maxIndex(i) + 1) = iw(j) + Next j + sortIndexedWord iws() '' sort anagram set before displaying it + For j As Integer = 1 To maxLength + Print w(iws(j).index); " "; + Next j + Print +Next i + +Print +Print "Took "; +Print Using "#.###"; timer - t; +Print " seconds on i3 @ 2.13 GHz" + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Anagrams/FutureBasic/anagrams.futurebasic b/Task/Anagrams/FutureBasic/anagrams.futurebasic new file mode 100644 index 0000000000..c019e619fe --- /dev/null +++ b/Task/Anagrams/FutureBasic/anagrams.futurebasic @@ -0,0 +1,97 @@ +include "ConsoleWindow" + +def tab 9 + +begin globals +dim dynamic gDictionary(_maxLong) as Str255 +end globals + +local fn IsAnagram( word1 as Str31, word2 as Str31 ) as Boolean +dim as long i, j, h, q +dim as Boolean result + +if word1[0] != word2[0] then result = _false : exit fn + +for i = 0 to word1[0] + h = 0 : q = 0 + for j = 0 to word1[0] + if word1[i] == word1[j] then h++ + if word1[i] == word2[j] then q++ + next + if h != q then result = _false : exit fn +next +result = _true +end fn = result + +local fn LoadDictionaryToArray +'~'1 +dim as CFURLRef url +dim as CFArrayRef arr +dim as CFStringRef temp, cfStr +dim as CFIndex elements +dim as Handle h +dim as Str255 s +dim as long fileLen, i + +kill dynamic gDictionary +url = fn CFURLCreateWithFileSystemPath( _kCFAllocatorDefault, @"/usr/share/dict/words", _kCFURLPOSIXPathStyle, _false ) +open "i", 2, url + fileLen = lof(2, 1) + h = fn NewHandleClear( fileLen ) + if ( h ) + read file 2, [h], fileLen + cfStr = fn CFStringCreateWithBytes( _kCFAllocatorDefault, #[h], fn GetHandleSize(h), _kCFStringEncodingMacRoman, _false ) + if ( cfStr ) + arr = fn CFStringCreateArrayBySeparatingStrings( _kCFAllocatorDefault, cfStr, @"\n" ) + CFRelease( cfStr ) + elements = fn CFArrayGetCount( arr ) + for i = 0 to elements - 1 + temp = fn CFArrayGetValueAtIndex( arr, i ) + fn CFStringGetPascalString( temp, @s, 256, _kCFStringEncodingMacRoman ) + gDictionary(i) = s + next + CFRelease( arr ) + end if + fn DisposeH( h ) + end if +close #2 +CFRelease( url ) +end fn + +local fn FindAnagrams( whichWord as Str31 ) +dim as long elements, i + +print "Anagrams for "; UCase$(whichWord); ":", +elements = fn DynamicNextElement( dynamic( gDictionary ) ) +for i = 0 to elements - 1 + if ( len( gDictionary(i) ) == whichWord[0] ) + if ( fn IsAnagram( whichWord, gDictionary(i) ) == _true ) + print gDictionary(i), + end if + end if +next +print +end fn + +fn LoadDictionaryToArray + +fn FindAnagrams( "bade" ) +fn FindAnagrams( "abet" ) +fn FindAnagrams( "beast" ) +fn FindAnagrams( "tuba" ) +fn FindAnagrams( "mace" ) +fn FindAnagrams( "scare" ) +fn FindAnagrams( "marine" ) +fn FindAnagrams( "antler" ) +fn FindAnagrams( "spare" ) +fn FindAnagrams( "leading" ) +fn FindAnagrams( "alerted" ) +fn FindAnagrams( "allergy" ) +fn FindAnagrams( "research") +fn FindAnagrams( "hustle" ) +fn FindAnagrams( "oriental") +def tab 3 +print +fn FindAnagrams( "creationism" ) +fn FindAnagrams( "resistance" ) +fn FindAnagrams( "mountaineer" ) diff --git a/Task/Anagrams/Lasso/anagrams.lasso b/Task/Anagrams/Lasso/anagrams.lasso new file mode 100644 index 0000000000..ff7a56e17b --- /dev/null +++ b/Task/Anagrams/Lasso/anagrams.lasso @@ -0,0 +1,27 @@ +local( + anagrams = map, + words = include_url('http://www.puzzlers.org/pub/wordlists/unixdict.txt')->split('\n'), + key, + max = 0, + findings = array +) + +with word in #words do { + #key = #word -> split('') -> sort& -> join('') + if(not(#anagrams >> #key)) => { + #anagrams -> insert(#key = array) + } + #anagrams -> find(#key) -> insert(#word) +} +with ana in #anagrams +let ana_size = #ana -> size +do { + if(#ana_size > #max) => { + #findings = array(#ana -> join(', ')) + #max = #ana_size + else(#ana_size == #max) + #findings -> insert(#ana -> join(', ')) + } +} + +#findings -> join('
\n') diff --git a/Task/Anagrams/LiveCode/anagrams.livecode b/Task/Anagrams/LiveCode/anagrams.livecode new file mode 100644 index 0000000000..ebe452f7a7 --- /dev/null +++ b/Task/Anagrams/LiveCode/anagrams.livecode @@ -0,0 +1,39 @@ +on mouseUp + put mostCommonAnagrams(url "http://www.puzzlers.org/pub/wordlists/unixdict.txt") +end mouseUp + +function mostCommonAnagrams X + put 0 into maxCount + repeat for each word W in X + get sortChars(W) + put W & comma after A[it] + add 1 to C[it] + if C[it] >= maxCount then + if C[it] > maxCount then + put C[it] into maxCount + put char 1 to -2 of A[it] into winnerList + else + put cr & char 1 to -2 of A[it] after winnerList + end if + end if + end repeat + return winnerList +end mostCommonAnagrams + +function sortChars X + get charsToItems(X) + sort items of it + return itemsToChars(it) +end sortChars + +function charsToItems X + repeat for each char C in X + put C & comma after R + end repeat + return char 1 to -2 of R +end charsToItems + +function itemsToChars X + replace comma with empty in X + return X +end itemsToChars diff --git a/Task/Anagrams/Nim/anagrams.nim b/Task/Anagrams/Nim/anagrams.nim new file mode 100644 index 0000000000..ea90687abb --- /dev/null +++ b/Task/Anagrams/Nim/anagrams.nim @@ -0,0 +1,18 @@ +import tables, strutils, algorithm + +proc main() = + var + count = 0 + anagrams = initTable[string, seq[string]]() + + for word in "unixdict.txt".lines(): + var key = word + key.sort(cmp[char]) + anagrams.mgetOrPut(key, newSeq[string]()).add(word) + count = max(count, anagrams[key].len) + + for k, v in anagrams: + if v.len == count: + v.join(", ").echo + +main() diff --git a/Task/Anagrams/Oforth/anagrams.oforth b/Task/Anagrams/Oforth/anagrams.oforth new file mode 100644 index 0000000000..1707582529 --- /dev/null +++ b/Task/Anagrams/Oforth/anagrams.oforth @@ -0,0 +1,5 @@ +: anagrams +| m | + File new("unixdict.txt") groupBy(#sort) + dup sortBy(#[ second size]) last second size ->m + filter(#[ second size m == ]) apply(#[ second .cr ]) ; diff --git a/Task/Anagrams/Phix/anagrams.phix b/Task/Anagrams/Phix/anagrams.phix new file mode 100644 index 0000000000..a8c759d67a --- /dev/null +++ b/Task/Anagrams/Phix/anagrams.phix @@ -0,0 +1,40 @@ +integer fn = open("unixdict.txt","r") +sequence words = {}, anagrams = {}, last="", letters +object word +integer maxlen = 1 + + while 1 do + word = trim(gets(fn)) + if atom(word) then exit end if + if length(word) then + letters = sort(word) + words = append(words, {letters, word}) + end if + end while + close(fn) + + words = sort(words) + for i=1 to length(words) do + {letters,word} = words[i] + if letters=last then + anagrams[$] = append(anagrams[$],word) + if length(anagrams[$])>maxlen then + maxlen = length(anagrams[$]) + end if + else + last = letters + anagrams = append(anagrams,{word}) + end if + end for + + puts(1,"\nMost anagrams:\n") + for i=1 to length(anagrams) do + last = anagrams[i] + if length(last)=maxlen then + for j=1 to maxlen do + if j>1 then puts(1,", ") end if + puts(1,last[j]) + end for + puts(1,"\n") + end if + end for diff --git a/Task/Anagrams/Sidef/anagrams.sidef b/Task/Anagrams/Sidef/anagrams.sidef new file mode 100644 index 0000000000..ca757f4867 --- /dev/null +++ b/Task/Anagrams/Sidef/anagrams.sidef @@ -0,0 +1,10 @@ +func main(file) { + file.open_r(\var fh, \var err) -> + || die "Can't open file `#{file}' for reading: #{err}\n"; + + var vls = fh.words.group_by{.sort}.values; + var max = vls.map{.len}.max; + vls.grep{.len == max}.each{.join("\t").say}; +} + +main(%f'/tmp/unixdict.txt'); diff --git a/Task/Anagrams/Swift/anagrams.swift b/Task/Anagrams/Swift/anagrams.swift new file mode 100644 index 0000000000..8345eef64d --- /dev/null +++ b/Task/Anagrams/Swift/anagrams.swift @@ -0,0 +1,41 @@ +import Foundation + +let wordsURL = NSURL(string: "http://www.puzzlers.org/pub/wordlists/unixdict.txt")! + +let wordsstring = try NSString(contentsOfURL:wordsURL , encoding: NSUTF8StringEncoding) +let allwords = wordsstring.componentsSeparatedByString("\n") + +let words = allwords//[0..<100] // used to limit the size while testing + +extension String { + var charactersAscending : String { + return String(Array(characters).sort()) + } +} + +var charsToWords = [String:Set]() + +var biggest = 0 +var biggestlists = [Set]() + +for thisword in words { + let chars = thisword.charactersAscending + + var knownwords = charsToWords[chars] ?? Set() + knownwords.insert(thisword) + charsToWords[chars] = knownwords + + if knownwords.count > biggest { + biggest = knownwords.count + + biggestlists = [knownwords] + } + else if knownwords.count == biggest { + biggestlists.append(knownwords) + } +} + +print("Found \(biggestlists.count) sets of anagrams with \(biggest) members each") +for (i, thislist) in biggestlists.enumerate() { + print("set \(i): \(thislist.sort())") +} diff --git a/Task/Anagrams/jq/anagrams-1.jq b/Task/Anagrams/jq/anagrams-1.jq new file mode 100644 index 0000000000..6365ca6cfa --- /dev/null +++ b/Task/Anagrams/jq/anagrams-1.jq @@ -0,0 +1,11 @@ +def anagrams: + (reduce .[] as $word ( + {table: {}, max: 0}; # state + ($word | explode | sort | implode) as $hash + | .table = ( .table + { ($hash): ( .table[$hash] + [ $word ]) }) + | .max = ([ .max, ( .table[$hash] | length) ] | max ) )) + | .max as $max + | .table | .[] | select(length == $max) ; + +# The task: +split("\n") | anagrams diff --git a/Task/Anagrams/jq/anagrams-2.jq b/Task/Anagrams/jq/anagrams-2.jq new file mode 100644 index 0000000000..2c7dfd85da --- /dev/null +++ b/Task/Anagrams/jq/anagrams-2.jq @@ -0,0 +1,7 @@ +$ jq -M -s -c -R -f anagrams.jq unixdict.txt +["abel","able","bale","bela","elba"] +["alger","glare","lager","large","regal"] +["angel","angle","galen","glean","lange"] +["caret","carte","cater","crate","trace"] +["elan","lane","lean","lena","neal"] +["evil","levi","live","veil","vile"] diff --git a/Task/Animate-a-pendulum/ERRE/animate-a-pendulum.erre b/Task/Animate-a-pendulum/ERRE/animate-a-pendulum.erre new file mode 100644 index 0000000000..1f7a755de2 --- /dev/null +++ b/Task/Animate-a-pendulum/ERRE/animate-a-pendulum.erre @@ -0,0 +1,35 @@ +PROGRAM PENDULUM + +! +! for rosettacode.org +! + +!$KEY + +!$INCLUDE="PC.LIB" + +PROCEDURE PENDULUM(A,L) + PIVOTX=320 + PIVOTY=0 + BOBX=PIVOTX+L*500*SIN(a) + BOBY=PIVOTY+L*500*COS(a) + LINE(PIVOTX,PIVOTY,BOBX,BOBY,6,FALSE) + CIRCLE(BOBX+24*SIN(A),BOBY+24*COS(A),27,11) + PAUSE(0.01) + LINE(PIVOTX,PIVOTY,BOBX,BOBY,0,FALSE) + CIRCLE(BOBX+24*SIN(A),BOBY+24*COS(A),27,0) +END PROCEDURE + +BEGIN + SCREEN(9) + THETA=40*p/180 ! initial displacement + G=9.81 ! acceleration due to gravity + L=0.5 ! length of pendulum in metres + LINE(0,0,639,0,5,FALSE) + LOOP + PENDULUM(THETA,L) + ACCEL=-G*SIN(THETA)/L/100 + SPEED=SPEED+ACCEL/100 + THETA=THETA+SPEED + END LOOP +END PROGRAM diff --git a/Task/Animate-a-pendulum/Elm/animate-a-pendulum.elm b/Task/Animate-a-pendulum/Elm/animate-a-pendulum.elm new file mode 100644 index 0000000000..4bddc83abd --- /dev/null +++ b/Task/Animate-a-pendulum/Elm/animate-a-pendulum.elm @@ -0,0 +1,73 @@ +import Color exposing (..) +import Collage exposing (..) +import Element exposing (..) +import Html exposing (..) +import Time exposing (..) +import Html.App exposing (program) + +dt = 0.01 +scale = 100 + +type alias Model = + { angle : Float + , angVel : Float + , length : Float + , gravity : Float + } + +type Msg + = Tick Time + +init : (Model,Cmd Msg) +init = + ( { angle = 3 * pi / 4 + , angVel = 0.0 + , length = 2 + , gravity = -9.81 + } + , Cmd.none) + +update : Msg -> Model -> (Model, Cmd Msg) +update _ model = + let + angAcc = -1.0 * (model.gravity / model.length) * sin (model.angle) + angVel' = model.angVel + angAcc * dt + angle' = model.angle + angVel' * dt + in + ( { model + | angle = angle' + , angVel = angVel' + } + , Cmd.none ) + +view : Model -> Html Msg +view model = + let + endPoint = ( 0, scale * model.length ) + pendulum = + group + [ segment ( 0, 0 ) endPoint + |> traced { defaultLine | width = 2, color = red } + , circle 8 + |> filled blue + , ngon 3 10 + |> filled green + |> rotate (pi/2) + |> move endPoint + ] + in + toHtml <| + collage 700 500 + [ pendulum |> rotate model.angle ] + +subscriptions : Model -> Sub Msg +subscriptions _ = + Time.every (dt * second) Tick + +main = + program + { init = init + , view = view + , update = update + , subscriptions = subscriptions + } diff --git a/Task/Animate-a-pendulum/Phix/animate-a-pendulum.phix b/Task/Animate-a-pendulum/Phix/animate-a-pendulum.phix new file mode 100644 index 0000000000..a74367eb7a --- /dev/null +++ b/Task/Animate-a-pendulum/Phix/animate-a-pendulum.phix @@ -0,0 +1,68 @@ +include ..\arwen\arwen.ew +include ..\arwen\axtra.ew + +constant main = create(Window, "Animated Pendulum", 0, 0, 20, 20, 625, 690, 0), + mainDC = getPrivateDC(main), + backDC = c_func(xCreateCompatibleDC, {NULL}), -- the background + viewDC = c_func(xCreateCompatibleDC, {NULL}), -- with animation + grey = #909090 + +constant MainTimer = createTimer() + +integer dw = 0, dh = 0 -- client area width and height +atom bmBack, bmView +integer bmX = 0, bmY = 0 -- actual size of the bitmaps + +constant dt = 1E-3 +constant g = 50 + +integer sX = 0, sY = 0 -- suspension point of pendulum +integer len +atom alpha = PI/2, + omega = 0, + epsilon + +function mainHandler(integer id, integer msg, atom wParam, object lParam) +integer eX, eY -- moving end of pendulum + if msg=WM_SIZE then + {{},{},dw,dh} = getClientRect(main) + if dw>bmX or dh>bmY then + -- we need bigger bitmaps + bmBack = c_func(xCreateCompatibleBitmap, {mainDC, dw, dh}) + {} = deleteObject(selectObject(backDC,bmBack)) + -- clear the background + setPenColor(grey) + drawRectangleh(backDC, True, 0, 0, dw, dh) + bmView = c_func(xCreateCompatibleBitmap, {mainDC, dw, dh}) + {} = deleteObject(selectObject(viewDC,bmView)) + {bmX,bmY} = {dw,dh} + end if + -- new suspension point and length + sX = floor(dw/2) + sY = floor(dh/8) + len = sX-20 + elsif msg=WM_PAINT then + -- start with a fresh copy of the background + void = c_func(xBitBlt,{viewDC,0,0,dw,dh,backDC,0,0,SRCCOPY}) + eX = floor(len*sin(alpha)+sX) + eY = floor(len*cos(alpha)+sY) + drawLinesh(viewDC,{Red,{sX,sY,eX,eY},Yellow}) + drawEllipseh(viewDC,eX-5,eY-5,eX+5,eY+5) + void = c_func(xBitBlt,{mainDC,0,0,dw,dh,viewDC,0,0,SRCCOPY}) + elsif msg=WM_TIMER then + epsilon = -len*sin(alpha)*g + omega += dt*epsilon + alpha += dt*omega + repaintWindow(main) + elsif msg=WM_SHOWWINDOW then + startTimer(MainTimer,main,33) + elsif msg=WM_CHAR + and wParam=VK_ESCAPE then + closeWindow(main) + if id or object(lParam) then end if -- suppress warnings + end if + return 0 +end function +setHandler({main},routine_id("mainHandler")) + +WinMain(main, SW_NORMAL) diff --git a/Task/Animate-a-pendulum/SequenceL/animate-a-pendulum.sequencel b/Task/Animate-a-pendulum/SequenceL/animate-a-pendulum.sequencel new file mode 100644 index 0000000000..b2cfb2df26 --- /dev/null +++ b/Task/Animate-a-pendulum/SequenceL/animate-a-pendulum.sequencel @@ -0,0 +1,68 @@ +import ; +import ; +import ; + +//region Types + +Point ::= (x: int(0), y: int(0)); +Color ::= (red: int(0), green: int(0), blue: int(0)); +Image ::= (kind: char(1), iColor: Color(0), vert1: Point(0), vert2: Point(0), vert3: Point(0), center: Point(0), + radius: int(0), height: int(0), width: int(0), message: char(1), source: char(1)); +Click ::= (clicked: bool(0), clPoint: Point(0)); +Input ::= (iClick: Click(0), keys: char(1)); + +//endregion + + +//region Helpers====================================================================== +//region Constructor-Functions------------------------------------------------- +point(a(0), b(0)) := (x: a, y: b); +color(r(0), g(0), b(0)) := (red: r, green: g, blue: b); +segment(e1(0), e2(0), c(0)) := (kind: "segment", vert1: e1, vert2: e2, iColor: c); +disc(ce(0), rad(0), c(0)) := (kind: "disc", center: ce, radius: rad, iColor: c); +//endregion---------------------------------------------------------------------- + +//region Colors---------------------------------------------------------------- +dBlack := color(0, 0, 0); +dYellow := color(255, 255, 0); +//endregion---------------------------------------------------------------------- +//endregion============================================================================= + + +//=================Easel=Functions============================================= + +State ::= (angle: float(0), angleVelocity: float(0), angleAccel: float(0)); + +initialState := (angle: pi/2, angleVelocity: 0.0, angleAccel: 0.0); + +dt := 0.3; +length := 450; + +anchor := point(500, 750); + +newState(I(0), S(0)) := + let + newAngle := S.angle + newAngleVelocity * dt; + newAngleVelocity := S.angleVelocity + newAngleAccel * dt; + newAngleAccel := -9.81 / length * sin(S.angle); + in + (angle: newAngle, angleVelocity: newAngleVelocity, angleAccel: newAngleAccel); + +sounds(I(0), S(0)) := ["ding"] when I.iClick.clicked else []; + +images(S(0)) := + let + pendulum := pendulumLocation(S.angle); + in + [segment(anchor, pendulum, dBlack), + disc(pendulum, 30, dYellow), + disc(anchor, 5, dBlack)]; + +pendulumLocation(angle) := + let + x := anchor.x + round(sin(angle) * length); + y := anchor.y - round(cos(angle) * length); + in + point(x, y); + +//=============End=Easel=Functions============================================= diff --git a/Task/Animate-a-pendulum/Sidef/animate-a-pendulum.sidef b/Task/Animate-a-pendulum/Sidef/animate-a-pendulum.sidef new file mode 100644 index 0000000000..1ae6afca74 --- /dev/null +++ b/Task/Animate-a-pendulum/Sidef/animate-a-pendulum.sidef @@ -0,0 +1,61 @@ +require('Tk') + +var root = %s.new('-title' => 'Pendulum Animation') +var canvas = root.Canvas('-width' => 320, '-height' => 200) + +canvas.createLine( 0, 25, 320, 25, '-tags' => , '-width' => 2, '-fill' => :grey50) +canvas.createOval(155, 20, 165, 30, '-tags' => , '-fill' => :grey50) +canvas.createLine( 1, 1, 1, 1, '-tags' => , '-width' => 3, '-fill' => :black) +canvas.createOval( 1, 1, 2, 2, '-tags' => , '-fill' => :yellow) + +canvas.raise(:pivot) +canvas.pack('-fill' => :both, '-expand' => 1) +var(θ = 45, Δθ = 0, length = 150, homeX = 160, homeY = 25) + +func show_pendulum() { + var angle = θ.deg2rad + var x = (homeX + length*sin(angle)) + var y = (homeY + length*cos(angle)) + canvas.coords(:rod, homeX, homeY, x, y) + canvas.coords(:bob, x - 15, y - 15, x + 15, y + 15) +} + +func recompute_angle() { + var scaling = 3000/(length**2) + + # first estimate + var firstΔΔθ = (-sin(θ.deg2rad) * scaling) + var midΔθ = (Δθ + firstΔΔθ) + var midθ = ((Δθ + midΔθ)/2 + θ) + + # second estimate + var midΔΔθ = (-sin(midθ.deg2rad) * scaling) + midΔθ = ((firstΔΔθ + midΔΔθ)/2 + Δθ) + midθ = ((Δθ + midΔθ)/2 + θ) + + # again, first + midΔΔθ = (-sin(midθ.deg2rad) * scaling) + var lastΔθ = (midΔθ + midΔΔθ) + var lastθ = ((midΔθ + lastΔθ)/2 + midθ) + + # again, second + var lastΔΔθ = (-sin(lastθ.deg2rad) * scaling) + lastΔθ = ((midΔΔθ + lastΔΔθ)/2 + midΔθ) + lastθ = ((midΔθ + lastΔθ)/2 + midθ) + + # Now put the values back in our globals + Δθ = lastΔθ + θ = lastθ +} + +func animate(Ref id) { + recompute_angle() + show_pendulum() + *id = root.after(15 => { animate(id) }) +} + +show_pendulum() +var after_id = root.after(500 => { animate(\after_id) }) + +canvas.bind('' => { after_id.cancel }) +%S.MainLoop() diff --git a/Task/Animation/Ceylon/animation-1.ceylon b/Task/Animation/Ceylon/animation-1.ceylon new file mode 100644 index 0000000000..1d40713533 --- /dev/null +++ b/Task/Animation/Ceylon/animation-1.ceylon @@ -0,0 +1,4 @@ +native("jvm") +module animation "1.0.0" { + import java.desktop "8"; +} diff --git a/Task/Animation/Ceylon/animation-2.ceylon b/Task/Animation/Ceylon/animation-2.ceylon new file mode 100644 index 0000000000..35d8bb1251 --- /dev/null +++ b/Task/Animation/Ceylon/animation-2.ceylon @@ -0,0 +1,43 @@ +import javax.swing { + JFrame, + JLabel, + Timer +} +import java.awt.event { + MouseAdapter, + MouseEvent, + ActionListener, + ActionEvent +} + +shared void run() { + value initialText = "Hello World! "; + value label = JLabel(initialText); + variable value forward = true; + label.addMouseListener(object extends MouseAdapter() { + mouseClicked(MouseEvent? mouseEvent) => + forward = !forward; + }); + + Timer(1k, object satisfies ActionListener { + shared actual void actionPerformed(ActionEvent? actionEvent) { + String left; + String right; + if(forward) { + left = label.text.last?.string else "?"; + right = "".join(label.text.exceptLast); + } else { + left = label.text.rest; + right = label.text.first?.string else "?"; + } + label.text = left + right; + } + }).start(); + + value frame = JFrame(); + frame.defaultCloseOperation = JFrame.\iEXIT_ON_CLOSE; + frame.title = "Rosetta Code Animation Example"; + frame.add(label); + frame.pack(); + frame.visible = true; +} diff --git a/Task/Animation/FreeBASIC/animation.freebasic b/Task/Animation/FreeBASIC/animation.freebasic new file mode 100644 index 0000000000..9317e4af7b --- /dev/null +++ b/Task/Animation/FreeBASIC/animation.freebasic @@ -0,0 +1,34 @@ +DIM C AS STRING = "Hello World! ", SIZE AS USHORT = LEN(C) +DIM DIRECTION AS BYTE = 0 +DIM AS INTEGER X, Y, BTNS +DIM BUTHELD AS BYTE = 0 + +SCREEN 12 + +DO + LOCATE 1, 1 + PRINT C + + GETMOUSE X, Y, , BTNS + + IF BTNS <> 0 THEN + IF BUTHELD = 0 THEN 'remember if it was pressed, to not react + BUTHELD = 1 'every frame on the mouse being just held + IF (X >= 0 AND X < SIZE * 8) AND (Y >= 0 AND Y < 16) THEN + DIRECTION = 1 - DIRECTION + END IF + END IF + ELSE + BUTHELD = 0 + END IF + + IF INKEY = CHR(255) + CHR(107) THEN EXIT DO + + IF DIRECTION = 0 THEN + C = RIGHT(C, 1) + LEFT(C, SIZE - 1) + ELSE + C = RIGHT(C, SIZE - 1) + LEFT(C, 1) + END IF + + SLEEP 100, 1 +LOOP diff --git a/Task/Animation/Phix/animation.phix b/Task/Animation/Phix/animation.phix new file mode 100644 index 0000000000..dc52cd23a2 --- /dev/null +++ b/Task/Animation/Phix/animation.phix @@ -0,0 +1,33 @@ +include arwen.ew + +string hw = "Hello World! " +integer direction = 1 + +constant main = create(Window, "Animation", 0, 0, 20, 20, 300, 150, 0), + label = create(Label,hw,0,main,65,40,200,40,0), + MainTimer = createTimer() + setFont(label, "Verdana", 18, Normal) + removeStyle(main,WS_THICKFRAME+WS_MINIMIZEBOX+WS_MAXIMIZEBOX) + +function mainHandler(integer id, integer msg, atom wParam, object lParam) + if msg=WM_SHOWWINDOW then + startTimer(MainTimer,main,160) + elsif msg=WM_TIMER then + if direction then + hw = hw[$]&hw[1..-2] + else + hw = hw[2..$]&hw[1] + end if + setText(label,hw) + elsif msg=WM_LBUTTONUP then + direction = 1-direction + elsif msg=WM_CHAR + and wParam=VK_ESCAPE then + closeWindow(main) + if id or object(lParam) then end if -- suppress warnings + end if + return 0 +end function +setHandler({main},routine_id("mainHandler")) + +WinMain(main, SW_NORMAL) diff --git a/Task/Anonymous-recursion/EchoLisp/anonymous-recursion.echolisp b/Task/Anonymous-recursion/EchoLisp/anonymous-recursion.echolisp new file mode 100644 index 0000000000..831fd6010c --- /dev/null +++ b/Task/Anonymous-recursion/EchoLisp/anonymous-recursion.echolisp @@ -0,0 +1,5 @@ +(define (fib n) +(let _fib ((a 1) (b 1) (n n)) + (if + (<= n 1) a + (_fib b (+ a b) (1- n))))) diff --git a/Task/Anonymous-recursion/FreeBASIC/anonymous-recursion.freebasic b/Task/Anonymous-recursion/FreeBASIC/anonymous-recursion.freebasic new file mode 100644 index 0000000000..424f25b5f2 --- /dev/null +++ b/Task/Anonymous-recursion/FreeBASIC/anonymous-recursion.freebasic @@ -0,0 +1,42 @@ +' FB 1.05.0 Win64 + +#Lang "fblite" + +Option Gosub '' enables Gosub to be used + +' Using gosub to simulate a nested function +Function fib(n As UInteger) As UInteger + Gosub nestedFib + Exit Function + + nestedFib: + fib = IIf(n < 2, n, fib(n - 1) + fib(n - 2)) + Return +End Function + +' This function simulates (rather messily) gosub by using 2 gotos and would therefore work +' even in the default dialect +Function fib2(n As UInteger) As UInteger + Goto nestedFib + + exitFib: + Exit Function + + nestedFib: + fib2 = IIf(n < 2, n, fib2(n - 1) + fib2(n - 2)) + Goto exitFib +End Function + +For i As Integer = 1 To 12 + Print fib(i); " "; +Next + +Print + +For j As Integer = 1 To 12 + Print fib2(j); " "; +Next + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Anonymous-recursion/Lingo/anonymous-recursion-1.lingo b/Task/Anonymous-recursion/Lingo/anonymous-recursion-1.lingo new file mode 100644 index 0000000000..e4ca4287eb --- /dev/null +++ b/Task/Anonymous-recursion/Lingo/anonymous-recursion-1.lingo @@ -0,0 +1,12 @@ +on fib (n) + if n<0 then return _player.alert("negative arguments not allowed") + + -- create instance of unnamed class in memory only (does not pollute namespace) + m = new(#script) + r = RETURN + m.scriptText = "on fib (me,n)"&r&"if n<2 then return n"&r&"return me.fib(n-1)+me.fib(n-2)"&r&"end" + aux = m.script.new() + m.erase() + + return aux.fib(n) +end diff --git a/Task/Anonymous-recursion/Lingo/anonymous-recursion-2.lingo b/Task/Anonymous-recursion/Lingo/anonymous-recursion-2.lingo new file mode 100644 index 0000000000..888236577d --- /dev/null +++ b/Task/Anonymous-recursion/Lingo/anonymous-recursion-2.lingo @@ -0,0 +1,2 @@ +put fib(10) +-- 55 diff --git a/Task/Anonymous-recursion/Nim/anonymous-recursion.nim b/Task/Anonymous-recursion/Nim/anonymous-recursion.nim new file mode 100644 index 0000000000..7a9ae3bc94 --- /dev/null +++ b/Task/Anonymous-recursion/Nim/anonymous-recursion.nim @@ -0,0 +1,12 @@ +# Using scoped function fibI inside fib +proc fib(x): int = + proc fibI(n): int = + if n < 2: n else: fibI(n-2) + fibI(n-1) + if x < 0: + raise newException(ValueError, "Invalid argument") + return fibI(x) + +for i in 0..4: + echo fib(i) + +# fibI(10) # undeclared identifier 'fibI' diff --git a/Task/Anonymous-recursion/Sidef/anonymous-recursion-1.sidef b/Task/Anonymous-recursion/Sidef/anonymous-recursion-1.sidef new file mode 100644 index 0000000000..c1999f0317 --- /dev/null +++ b/Task/Anonymous-recursion/Sidef/anonymous-recursion-1.sidef @@ -0,0 +1,7 @@ +{ |i| + func (n) { + if (n < 0) { return }; + n < 2 ? n + : (__FUNC__(n-2) + __FUNC__(n-1)); + }(i).to_s.say; +} * 10; diff --git a/Task/Anonymous-recursion/Sidef/anonymous-recursion-2.sidef b/Task/Anonymous-recursion/Sidef/anonymous-recursion-2.sidef new file mode 100644 index 0000000000..eac1be8569 --- /dev/null +++ b/Task/Anonymous-recursion/Sidef/anonymous-recursion-2.sidef @@ -0,0 +1,7 @@ +{ |i| + { |n| + if (n < 0) { return }; + n < 2 ? n + : (__BLOCK__(n-2) + __BLOCK__(n-1)); + }(i).to_s.say; +} * 10; diff --git a/Task/Anonymous-recursion/Sparkling/anonymous-recursion-1.sparkling b/Task/Anonymous-recursion/Sparkling/anonymous-recursion-1.sparkling new file mode 100644 index 0000000000..b53b5b1b86 --- /dev/null +++ b/Task/Anonymous-recursion/Sparkling/anonymous-recursion-1.sparkling @@ -0,0 +1,5 @@ +function(n, f) { + return f(n, f); +}(10, function(n, f) { + return n < 2 ? 1 : f(n - 1, f) + f(n - 2, f); +}) diff --git a/Task/Anonymous-recursion/Sparkling/anonymous-recursion-2.sparkling b/Task/Anonymous-recursion/Sparkling/anonymous-recursion-2.sparkling new file mode 100644 index 0000000000..0f0ccc7c69 --- /dev/null +++ b/Task/Anonymous-recursion/Sparkling/anonymous-recursion-2.sparkling @@ -0,0 +1,2 @@ +spn:1> function(n, f) { return f(n, f); }(10, function(n, f) { return n < 2 ? 1 : f(n - 1, f) + f(n - 2, f); }) += 89 diff --git a/Task/Anonymous-recursion/Swift/anonymous-recursion-1.swift b/Task/Anonymous-recursion/Swift/anonymous-recursion-1.swift new file mode 100644 index 0000000000..3f7d46a03e --- /dev/null +++ b/Task/Anonymous-recursion/Swift/anonymous-recursion-1.swift @@ -0,0 +1,9 @@ +let fib: Int -> Int = { + func f(n: Int) -> Int { + assert(n >= 0, "fib: no negative numbers") + return n < 2 ? 1 : f(n-1) + f(n-2) + } + return f +}() + +print(fib(8)) diff --git a/Task/Anonymous-recursion/Swift/anonymous-recursion-2.swift b/Task/Anonymous-recursion/Swift/anonymous-recursion-2.swift new file mode 100644 index 0000000000..011efb7fa4 --- /dev/null +++ b/Task/Anonymous-recursion/Swift/anonymous-recursion-2.swift @@ -0,0 +1,10 @@ +let fib: Int -> Int = { + var f: (Int -> Int)! + f = { n in + assert(n >= 0, "fib: no negative numbers") + return n < 2 ? 1 : f(n-1) + f(n-2) + } + return f +}() + +println(fib(8)) diff --git a/Task/Anonymous-recursion/Swift/anonymous-recursion-3.swift b/Task/Anonymous-recursion/Swift/anonymous-recursion-3.swift new file mode 100644 index 0000000000..717a699e79 --- /dev/null +++ b/Task/Anonymous-recursion/Swift/anonymous-recursion-3.swift @@ -0,0 +1,15 @@ +struct RecursiveFunc { + let o : RecursiveFunc -> F +} + +func y(f: (A -> B) -> A -> B) -> A -> B { + let r = RecursiveFunc B> { w in f { w.o(w)($0) } } + return r.o(r) +} + +func fib(n: Int) -> Int { + assert(n >= 0, "fib: no negative numbers") + return y {f in {n in n < 2 ? 1 : f(n-1) + f(n-2)}} (n) +} + +println(fib(8)) diff --git a/Task/Anonymous-recursion/Wart/anonymous-recursion.wart b/Task/Anonymous-recursion/Wart/anonymous-recursion.wart new file mode 100644 index 0000000000..1f2d94883b --- /dev/null +++ b/Task/Anonymous-recursion/Wart/anonymous-recursion.wart @@ -0,0 +1,7 @@ +def (fib n) + if (n >= 0) + (transform n :thru (afn (n) + (if (n < 2) + n + (+ (self n-1) + (self n-2))))) diff --git a/Task/Anonymous-recursion/Wren/anonymous-recursion.wren b/Task/Anonymous-recursion/Wren/anonymous-recursion.wren new file mode 100644 index 0000000000..7afc652979 --- /dev/null +++ b/Task/Anonymous-recursion/Wren/anonymous-recursion.wren @@ -0,0 +1,12 @@ +class Fibonacci { + static compute(n) { + var fib + fib = Fn.new {|n| + if (n < 2) return n + return fib.call(n - 1) + fib.call(n - 2) + } + + if (n < 0) return null + return fib.call(n) + } +} diff --git a/Task/Anonymous-recursion/jq/anonymous-recursion-1.jq b/Task/Anonymous-recursion/jq/anonymous-recursion-1.jq new file mode 100644 index 0000000000..02faf0b0e5 --- /dev/null +++ b/Task/Anonymous-recursion/jq/anonymous-recursion-1.jq @@ -0,0 +1 @@ +0 | recurse(. + 1) diff --git a/Task/Anonymous-recursion/jq/anonymous-recursion-2.jq b/Task/Anonymous-recursion/jq/anonymous-recursion-2.jq new file mode 100644 index 0000000000..d9d6b33b99 --- /dev/null +++ b/Task/Anonymous-recursion/jq/anonymous-recursion-2.jq @@ -0,0 +1,8 @@ +def fib(n): + def aux: if . == 0 then 0 + elif . == 1 then 1 + else (. - 1 | aux) + (. - 2 | aux) + end; + if n < 0 then error("negative arguments not allowed") + else n | aux + end ; diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/FreeBASIC/append-a-record-to-the-end-of-a-text-file.freebasic b/Task/Append-a-record-to-the-end-of-a-text-file/FreeBASIC/append-a-record-to-the-end-of-a-text-file.freebasic new file mode 100644 index 0000000000..fd4fe701ef --- /dev/null +++ b/Task/Append-a-record-to-the-end-of-a-text-file/FreeBASIC/append-a-record-to-the-end-of-a-text-file.freebasic @@ -0,0 +1,86 @@ +' FB 1.05.0 Win64 + +Type Person + As String fullname + As String office + As String extension + As String homephone + As String email + Declare Constructor() + Declare Constructor(As String, As String, As String, As String, As String) + Declare Operator Cast() As String +End Type + +Constructor Person() +End Constructor + +Constructor Person(fullname As String, office As String, extension As String, _ +homephone As String, email As String) + + With This + .fullname = fullname + .office = office + .extension = extension + .homephone = homephone + .email = email + End With + +End Constructor + +Operator Person.Cast() As String + Return fullname + "," + office + "," + extension + "," + homephone + "," + email +End Operator + +Type Record + As String account + As String password + As Integer uid + As Integer gid + As Person user + As String directory + As String shell + Declare Constructor() + Declare Constructor(As String, As String, As Integer, As Integer, As Person, As String, As String) + Declare Operator Cast() As String +End Type + +Constructor Record() +End Constructor + +Constructor Record(account As String, password As String, uid As Integer, gid As Integer, user As Person, _ +directory As String, shell As String) + + With This + .account = account + .password = password + .uid = uid + .gid = gid + .user = user + .directory = directory + .shell = shell + End With + +End Constructor + +Operator Record.Cast() As String + Return account + ":" + password + ":" + Str(uid) + ":" + Str(gid) + ":" + user + ":" + directory + ":" + shell +End Operator + +Dim persons(1 To 3) As Person +persons(1) = Person("Joe Smith", "Room 1007", "(234)555-8917", "(234)555-0077", "jsmith@rosettacode.org") +persons(2) = Person("Jane Doe", "Room 1004", "(234)555-8914", "(234)555-0044", "jdoe@rosettacode.org" ) +persons(3) = Person("X Yz", "Room 1003", "(234)555-8913", "(234)555-0033", "xyz@rosettacode.org" ) + +Dim records(1 To 3) As Record +records(1) = Record("jsmith", "x", 1001, 1000, persons(1), "/home/jsmith", "/bin/bash") +records(2) = Record("jdoe", "x", 1002, 1000, persons(2), "/home/jdoe" , "/bin/bash") +records(3) = Record("xyz", "x", 1003, 1000, persons(3), "/home/xyz" , "/bin/bash") + +Open "passwd.txt" For Output As #1 +Print #1, records(1) +Print #1, records(2) +Close #1 + +Open "passwd.txt" For Append Lock Write As #1 +Print #1, records(3) +Close #1 diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/Sidef/append-a-record-to-the-end-of-a-text-file.sidef b/Task/Append-a-record-to-the-end-of-a-text-file/Sidef/append-a-record-to-the-end-of-a-text-file.sidef new file mode 100644 index 0000000000..ca7ad697f7 --- /dev/null +++ b/Task/Append-a-record-to-the-end-of-a-text-file/Sidef/append-a-record-to-the-end-of-a-text-file.sidef @@ -0,0 +1,98 @@ +define ( + RECORD_FIELDS = %w(account password UID GID GECOS directory shell), + GECOS_FIELDS = %w(fullname office extension homephone email), + RECORD_SEP = ':', + GECOS_SEP = ',', + PASSWD_FILE = 'passwd.txt', +) + +# here's our three records +var records_to_write = [ + Hash( + account => 'jsmith', + password => 'x', + UID => 1001, + GID => 1000, + GECOS => Hash( + fullname => 'John Smith', + office => 'Room 1007', + extension => '(234)555-8917', + homephone => '(234)555-0077', + email => 'jsmith@rosettacode.org', + ), + directory => '/home/jsmith', + shell => '/bin/bash', + ), + Hash( + account => 'jdoe', + password => 'x', + UID => 1002, + GID => 1000, + GECOS => Hash( + fullname => 'Jane Doe', + office => 'Room 1004', + extension => '(234)555-8914', + homephone => '(234)555-0044', + email => 'jdoe@rosettacode.org', + ), + directory => '/home/jdoe', + shell => '/bin/bash', + ), +]; + +var record_to_append = Hash( + account => 'xyz', + password => 'x', + UID => 1003, + GID => 1000, + GECOS => Hash( + fullname => 'X Yz', + office => 'Room 1003', + extension => '(234)555-8913', + homephone => '(234)555-0033', + email => 'xyz@rosettacode.org', + ), + directory => '/home/xyz', + shell => '/bin/bash', +); + +func record_to_string(rec, sep = RECORD_SEP, fields = RECORD_FIELDS) { + gather { + fields.each { |field| + var r = rec{field} \\ die "Field #{field} not found" + take(field == 'GECOS' ? record_to_string(r, GECOS_SEP, GECOS_FIELDS) + : r) + } + }.join(sep) +} + +func write_records_to_file(records, filename = PASSWD_FILE, append = false) { + File(filename).(append ? :open_a : :open_w)(\var fh, \var err) + err && die "Can't open #{filename}: #{err}"; + fh.flock(File.LOCK_EX) || die "Can't lock #{filename}: $!" + fh.seek(0, File.SEEK_END) || die "Can't seek #{filename}: $!" + records.each { |record| fh.say(record_to_string(record)) } + fh.flock(File.LOCK_UN) || die "Can't unlock #{filename}: $!" + fh.close +} + +# write two records to file +write_records_to_file(records: records_to_write); + +# append one more record to file +write_records_to_file(records: [record_to_append], append: true); + +# test + +File(PASSWD_FILE).open_r(\var fh, \var err) +err && die "Can't open file #{PASSWD_FILE}: #{err}" +var lines = fh.lines + +# There should be more than one line +assert(lines.len > 1) + +# Check the last line +assert_eq(lines[-1], 'xyz:x:1003:1000:X Yz,Room 1003,(234)555-8913,' + + '(234)555-0033,xyz@rosettacode.org:/home/xyz:/bin/bash') + +say "** Test passed!" diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/Ursa/append-a-record-to-the-end-of-a-text-file.ursa b/Task/Append-a-record-to-the-end-of-a-text-file/Ursa/append-a-record-to-the-end-of-a-text-file.ursa new file mode 100644 index 0000000000..f05d07dfc5 --- /dev/null +++ b/Task/Append-a-record-to-the-end-of-a-text-file/Ursa/append-a-record-to-the-end-of-a-text-file.ursa @@ -0,0 +1,28 @@ +# ursa appends to files by default when the out function is used + +# create new passwd in working directory +decl file f +f.create "passwd" +f.open "passwd" +out "account:password:UID:GID:fullname,office,extension,homephone,email:directory:shell" endl f +out "jsmith:x:1001:1000:Joe Smith,Room 1007,(234)555-8917,(234)555-0077,jsmith@rosettacode.org:/home/jsmith:/bin/bash" endl f +out "jdoe:x:1002:1000:Jane Doe,Room 1004,(234)555-8914,(234)555-0044,jdoe@rosettacode.org:/home/jdoe:/bin/bash" endl f +f.close + +# display the created file +f.open "passwd" +out "initial file:" endl console +while (f.hasline) + out (in string f) endl console +end while + +# append the new record +out "xyz:x:1003:1000:X Yz,Room 1003,(234)555-8913,(234)555-0033,xyz@rosettacode.org:/home/xyz:/bin/bash" endl f +f.close + +# output the new file contents +f.open "passwd" +out endl endl "file after append:" endl console +while (f.hasline) + out (in string f) endl console +end while diff --git a/Task/Apply-a-callback-to-an-array/8th/apply-a-callback-to-an-array.8th b/Task/Apply-a-callback-to-an-array/8th/apply-a-callback-to-an-array.8th new file mode 100644 index 0000000000..1cc587a706 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/8th/apply-a-callback-to-an-array.8th @@ -0,0 +1,3 @@ +[ 1 , 2, 3 ] +' n:sqr +a:map diff --git a/Task/Apply-a-callback-to-an-array/ERRE/apply-a-callback-to-an-array.erre b/Task/Apply-a-callback-to-an-array/ERRE/apply-a-callback-to-an-array.erre new file mode 100644 index 0000000000..351a050678 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/ERRE/apply-a-callback-to-an-array.erre @@ -0,0 +1,24 @@ +PROGRAM CALLBACK + +! +! for rosettacode.org +! + +DIM A[5] + +FUNCTION CBACK(X) + CBACK=2*X-1 +END FUNCTION + +PROCEDURE PROCMAP(ZETA,DUMMY(X)->OUTP) + OUTP=DUMMY(ZETA) +END PROCEDURE + +BEGIN + A[1]=1 A[2]=2 A[3]=3 A[4]=4 A[5]=5 + FOR I%=1 TO 5 DO + PROCMAP(A[I%],CBACK(X)->OUTP) + PRINT(OUTP;) + END FOR + PRINT +END PROGRAM diff --git a/Task/Apply-a-callback-to-an-array/EchoLisp/apply-a-callback-to-an-array.echolisp b/Task/Apply-a-callback-to-an-array/EchoLisp/apply-a-callback-to-an-array.echolisp new file mode 100644 index 0000000000..e6c2416fa2 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/EchoLisp/apply-a-callback-to-an-array.echolisp @@ -0,0 +1,11 @@ +(vector-map sqrt #(0 4 16 49)) + → #( 0 2 4 7) +;; or +(map exp #(0 1 2)) + → #( 1 2.718281828459045 7.38905609893065) +;; or +(for/vector ([elem #(2 3 4)] [i (in-naturals)]) (printf "v[%d] = %a" i elem) (* elem elem)) +v[0] = 2 +v[1] = 3 +v[2] = 4 + → #( 4 9 16) diff --git a/Task/Apply-a-callback-to-an-array/FreeBASIC/apply-a-callback-to-an-array.freebasic b/Task/Apply-a-callback-to-an-array/FreeBASIC/apply-a-callback-to-an-array.freebasic new file mode 100644 index 0000000000..dc748cc2a0 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/FreeBASIC/apply-a-callback-to-an-array.freebasic @@ -0,0 +1,19 @@ +' FB 1.05.0 Win64 + +Sub PrintEx(n As Integer) + Print n, n * n, n * n * n +End Sub + +Sub Proc(a() As Integer, callback As Sub(n As Integer)) + For i As Integer = LBound(a) To UBound(a) + callback(i) + Next +End Sub + +Dim a(1 To 10) As Integer = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} +Print " n", "n^2", "n^3" +Print " -", "---", "---" +Proc(a(), @PrintEx) +Print +Print "Press any key to quit the program" +Sleep diff --git a/Task/Apply-a-callback-to-an-array/FunL/apply-a-callback-to-an-array.funl b/Task/Apply-a-callback-to-an-array/FunL/apply-a-callback-to-an-array.funl new file mode 100644 index 0000000000..34fe4d4146 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/FunL/apply-a-callback-to-an-array.funl @@ -0,0 +1,3 @@ +[1, 2, 3].foreach( println ) + +[1, 2, 3].foreach( a -> println(2a) ) diff --git a/Task/Apply-a-callback-to-an-array/Lasso/apply-a-callback-to-an-array.lasso b/Task/Apply-a-callback-to-an-array/Lasso/apply-a-callback-to-an-array.lasso new file mode 100644 index 0000000000..2f0f64713c --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Lasso/apply-a-callback-to-an-array.lasso @@ -0,0 +1,12 @@ +define cube(n::integer) => #n*#n*#n + +local( + mynumbers = array(1, 2, 3, 4, 5), + mycube = array +) + +#mynumbers -> foreach => { + #mycube -> insert(cube(#1)) +} + +#mycube diff --git a/Task/Apply-a-callback-to-an-array/NGS/apply-a-callback-to-an-array.ngs b/Task/Apply-a-callback-to-an-array/NGS/apply-a-callback-to-an-array.ngs new file mode 100644 index 0000000000..e5c1342968 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/NGS/apply-a-callback-to-an-array.ngs @@ -0,0 +1,3 @@ +{ + [1, 2, 3, 4, 5].map(F(x) x*x) +} diff --git a/Task/Apply-a-callback-to-an-array/Nim/apply-a-callback-to-an-array.nim b/Task/Apply-a-callback-to-an-array/Nim/apply-a-callback-to-an-array.nim new file mode 100644 index 0000000000..5a04ac5570 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Nim/apply-a-callback-to-an-array.nim @@ -0,0 +1,2 @@ +var arr = [1,2,3,4] +arr.map proc(some: var int) = echo(some, " squared = ", some*some) diff --git a/Task/Apply-a-callback-to-an-array/Oforth/apply-a-callback-to-an-array-1.oforth b/Task/Apply-a-callback-to-an-array/Oforth/apply-a-callback-to-an-array-1.oforth new file mode 100644 index 0000000000..d3dd934fa5 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Oforth/apply-a-callback-to-an-array-1.oforth @@ -0,0 +1 @@ +0 #+ [ 1, 2, 3, 4, 5 ] apply diff --git a/Task/Apply-a-callback-to-an-array/Oforth/apply-a-callback-to-an-array-2.oforth b/Task/Apply-a-callback-to-an-array/Oforth/apply-a-callback-to-an-array-2.oforth new file mode 100644 index 0000000000..21cce1c028 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Oforth/apply-a-callback-to-an-array-2.oforth @@ -0,0 +1 @@ +#sq [ 1, 2, 3, 4, 5 ] map diff --git a/Task/Apply-a-callback-to-an-array/Phix/apply-a-callback-to-an-array.phix b/Task/Apply-a-callback-to-an-array/Phix/apply-a-callback-to-an-array.phix new file mode 100644 index 0000000000..ee5aac4062 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Phix/apply-a-callback-to-an-array.phix @@ -0,0 +1,13 @@ +function apply(integer f, sequence s) +-- apply function f to all elements of sequence s + for i = 1 to length(s) do + s[i] = call_func(f, {s[i]}) + end for + return s +end function + +function add1(integer x) + return x + 1 +end function + +? apply(routine_id("add1"),{1,2,3}) diff --git a/Task/Apply-a-callback-to-an-array/Ring/apply-a-callback-to-an-array.ring b/Task/Apply-a-callback-to-an-array/Ring/apply-a-callback-to-an-array.ring new file mode 100644 index 0000000000..fb7e2f81ce --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Ring/apply-a-callback-to-an-array.ring @@ -0,0 +1,3 @@ +for x in [1,2,3,4,5] + x = x*x +next diff --git a/Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-1.sidef b/Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-1.sidef new file mode 100644 index 0000000000..db7c7d81ea --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-1.sidef @@ -0,0 +1 @@ +func callback(i) { say i**2 }; diff --git a/Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-2.sidef b/Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-2.sidef new file mode 100644 index 0000000000..584a90a056 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-2.sidef @@ -0,0 +1 @@ +[1,2,3,4].each(callback); diff --git a/Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-3.sidef b/Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-3.sidef new file mode 100644 index 0000000000..d28f324d70 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-3.sidef @@ -0,0 +1 @@ +[1,2,3,4].each{|i| say i**2 }; diff --git a/Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-4.sidef b/Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-4.sidef new file mode 100644 index 0000000000..3d64c9e107 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Sidef/apply-a-callback-to-an-array-4.sidef @@ -0,0 +1 @@ +[1,2,3,4,5].map{|i| i**2 }; diff --git a/Task/Apply-a-callback-to-an-array/Sparkling/apply-a-callback-to-an-array-1.sparkling b/Task/Apply-a-callback-to-an-array/Sparkling/apply-a-callback-to-an-array-1.sparkling new file mode 100644 index 0000000000..fe69224db4 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Sparkling/apply-a-callback-to-an-array-1.sparkling @@ -0,0 +1,4 @@ +let numbers = { 1, 2, 3, 4 }; +foreach(numbers, function(idx, num) { + print(num); +}); diff --git a/Task/Apply-a-callback-to-an-array/Sparkling/apply-a-callback-to-an-array-2.sparkling b/Task/Apply-a-callback-to-an-array/Sparkling/apply-a-callback-to-an-array-2.sparkling new file mode 100644 index 0000000000..8e0938dd32 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Sparkling/apply-a-callback-to-an-array-2.sparkling @@ -0,0 +1,4 @@ +let dict = { "foo": 42, "bar": 13, "baz": 37 }; +let doubled = map(dict, function(key, val) { + return val * 2; +}); diff --git a/Task/Apply-a-callback-to-an-array/Swift/apply-a-callback-to-an-array.swift b/Task/Apply-a-callback-to-an-array/Swift/apply-a-callback-to-an-array.swift new file mode 100644 index 0000000000..9a6e44c7a0 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Swift/apply-a-callback-to-an-array.swift @@ -0,0 +1,13 @@ +func square(n: Int) -> Int { + return n * n +} + +let numbers = [1, 3, 5, 7] + +let squares1a = numbers.map(square) // map method on array + +let squares1b = numbers.map {x in x*x} // map method on array with anonymous function + +let squares1b = numbers.map { $0 * $0 } // map method on array with anonymous function and unnamed parameters + +let isquares1 = numbers.lazy.map(square) // lazy sequence diff --git a/Task/Apply-a-callback-to-an-array/Wart/apply-a-callback-to-an-array.wart b/Task/Apply-a-callback-to-an-array/Wart/apply-a-callback-to-an-array.wart new file mode 100644 index 0000000000..aed0d99389 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Wart/apply-a-callback-to-an-array.wart @@ -0,0 +1 @@ +map prn '(1 2 3 4 5) diff --git a/Task/Apply-a-callback-to-an-array/Wren/apply-a-callback-to-an-array.wren b/Task/Apply-a-callback-to-an-array/Wren/apply-a-callback-to-an-array.wren new file mode 100644 index 0000000000..34291c103b --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Wren/apply-a-callback-to-an-array.wren @@ -0,0 +1,4 @@ +var arr = [1, 2, 3, 4, 5] +arr = arr.map { |x| x * 2 }.toList +arr = arr.map(Fn.new {|x| x / 2}).toList +arr.each {|x| System.print(x) } diff --git a/Task/Apply-a-callback-to-an-array/jq/apply-a-callback-to-an-array-1.jq b/Task/Apply-a-callback-to-an-array/jq/apply-a-callback-to-an-array-1.jq new file mode 100644 index 0000000000..fac90f77b4 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/jq/apply-a-callback-to-an-array-1.jq @@ -0,0 +1,14 @@ +# Illustration of map/1 using the builtin filter: exp +map(exp) # exponentiate each item in the input list + +# A compound expression can be specified as the argument to map, e.g. +map( (. * .) + sqrt ) # x*x + sqrt(x) + +# The compound expression can also be a composition of filters, e.g. +map( sqrt|floor ) # the floor of the sqrt + +# Array comprehension +reduce .[] as $n ([]; . + [ exp ]) + +# Elementwise operation + [.[] + 1 ] # add 1 to each element of the input array diff --git a/Task/Apply-a-callback-to-an-array/jq/apply-a-callback-to-an-array-2.jq b/Task/Apply-a-callback-to-an-array/jq/apply-a-callback-to-an-array-2.jq new file mode 100644 index 0000000000..bc42cd2232 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/jq/apply-a-callback-to-an-array-2.jq @@ -0,0 +1,3 @@ +$ jq -c ' [.[] + 1 ]' +[0, 1 , 10] +[1,2,11] diff --git a/Task/Arbitrary-precision-integers--included-/8th/arbitrary-precision-integers--included-.8th b/Task/Arbitrary-precision-integers--included-/8th/arbitrary-precision-integers--included-.8th new file mode 100644 index 0000000000..e49f2b8aaa --- /dev/null +++ b/Task/Arbitrary-precision-integers--included-/8th/arbitrary-precision-integers--included-.8th @@ -0,0 +1,5 @@ +200000 n# +5 4 3 2 bfloat ^ ^ ^ +"%.0f" s:strfmt +dup s:len . " digits" . cr +dup 20 s:lsub . "..." . 20 s:rsub . cr diff --git a/Task/Arbitrary-precision-integers--included-/EchoLisp/arbitrary-precision-integers--included-.echolisp b/Task/Arbitrary-precision-integers--included-/EchoLisp/arbitrary-precision-integers--included-.echolisp new file mode 100644 index 0000000000..072163aa69 --- /dev/null +++ b/Task/Arbitrary-precision-integers--included-/EchoLisp/arbitrary-precision-integers--included-.echolisp @@ -0,0 +1,30 @@ +;; to save space and time, we do'nt stringify Ω = 5^4^3^2 , +;; but directly extract tail and head and number of decimal digits + +(lib 'bigint) ;; arbitrary size integers + +(define e10000 (expt 10 10000)) ;; 10^10000 + +(define (last-n big (n 20)) +(string-append "..." (number->string (modulo big (expt 10 n))))) + +(define (first-n big (n 20)) + (while (> big e10000) + (set! big (/ big e10000))) ;; cut 10000 digits at a time + (string-append (take (number->string big) n) "...")) + +;; faster than directly using (number-length big) +(define (digits big (digits 0)) + (while (> big e10000) + (set! big (/ big e10000)) + (set! digits (1+ digits))) + (+ (* digits 10000) (number-length big))) + +(define Ω (expt 5 (expt 4 (expt 3 2)))) + +(last-n Ω ) + → "...92256259918212890625" +(first-n Ω ) + → "62060698786608744707..." +(digits Ω ) + → 183231 diff --git a/Task/Arbitrary-precision-integers--included-/FreeBASIC/arbitrary-precision-integers--included-.freebasic b/Task/Arbitrary-precision-integers--included-/FreeBASIC/arbitrary-precision-integers--included-.freebasic new file mode 100644 index 0000000000..27d9e31434 --- /dev/null +++ b/Task/Arbitrary-precision-integers--included-/FreeBASIC/arbitrary-precision-integers--included-.freebasic @@ -0,0 +1,26 @@ +#Include once "gmp.bi" +Dim Shared As Zstring * 100000000 outtext + +Function Power(number As String,n As Uinteger) As String'automate precision + #define dp 3321921 + Dim As __mpf_struct _number,FloatAnswer + Dim As Ulongint ln=Len(number)*(n)*4 + If ln>dp Then ln=dp + mpf_init2(@FloatAnswer,ln) + mpf_init2(@_number,ln) + mpf_set_str(@_number,number,10) + mpf_pow_ui(@Floatanswer,@_number,n) + gmp_sprintf( @outtext,"%." & Str(n) & "Ff",@FloatAnswer ) + Var outtxt=Trim(outtext) + If Instr(outtxt,".") Then outtxt= Rtrim(outtxt,"0"):outtxt=Rtrim(outtxt,".") + Return Trim(outtxt) +End Function + +Extern gmp_version Alias "__gmp_version" As Zstring Ptr +Print "GMP version ";*gmp_version +Print + +var ans=power("5",(4^(3^2))) +Print Left(ans,20) + " ... "+Right(ans,20) +Print "Number of digits ";Len(ans) +Sleep diff --git a/Task/Arbitrary-precision-integers--included-/Hoon/arbitrary-precision-integers--included-.hoon b/Task/Arbitrary-precision-integers--included-/Hoon/arbitrary-precision-integers--included-.hoon new file mode 100644 index 0000000000..6efe2f626a --- /dev/null +++ b/Task/Arbitrary-precision-integers--included-/Hoon/arbitrary-precision-integers--included-.hoon @@ -0,0 +1,3 @@ +=+ big=(pow 5 (pow 4 (pow 3 2))) +=+ digits=(lent (skip |=(a/* ?:(=(a '.') & |)))) +[digits (div big (pow 10 (sub digits 20))) (mod big (pow 10 20))] diff --git a/Task/Arbitrary-precision-integers--included-/Lasso/arbitrary-precision-integers--included-.lasso b/Task/Arbitrary-precision-integers--included-/Lasso/arbitrary-precision-integers--included-.lasso new file mode 100644 index 0000000000..4ca667146e --- /dev/null +++ b/Task/Arbitrary-precision-integers--included-/Lasso/arbitrary-precision-integers--included-.lasso @@ -0,0 +1,15 @@ +define integer->pow(factor::integer) => { + #factor <= 0 + ? return 0 + + local(retVal) = 1 + + loop(#factor) => { #retVal *= self } + + return #retVal +} + +local(bigint) = string(5->pow(4->pow(3->pow(2)))) +#bigint->sub(1,20) + ` ... ` + #bigint->sub(#bigint->size - 19) +"\n" +`Number of digits: ` + #bigint->size diff --git a/Task/Arbitrary-precision-integers--included-/Nim/arbitrary-precision-integers--included-.nim b/Task/Arbitrary-precision-integers--included-/Nim/arbitrary-precision-integers--included-.nim new file mode 100644 index 0000000000..73c032ed08 --- /dev/null +++ b/Task/Arbitrary-precision-integers--included-/Nim/arbitrary-precision-integers--included-.nim @@ -0,0 +1,8 @@ +import bigints + +var x = 5.pow 4.pow 3.pow 2 +var s = $x + +echo s[0..19] +echo s[s.high - 19 .. s.high] +echo s.len diff --git a/Task/Arbitrary-precision-integers--included-/Oforth/arbitrary-precision-integers--included-.oforth b/Task/Arbitrary-precision-integers--included-/Oforth/arbitrary-precision-integers--included-.oforth new file mode 100644 index 0000000000..32c2440271 --- /dev/null +++ b/Task/Arbitrary-precision-integers--included-/Oforth/arbitrary-precision-integers--included-.oforth @@ -0,0 +1 @@ +5 4 3 2 pow pow pow asString dup left(20) . dup right(20) . size . diff --git a/Task/Arbitrary-precision-integers--included-/Phix/arbitrary-precision-integers--included-.phix b/Task/Arbitrary-precision-integers--included-/Phix/arbitrary-precision-integers--included-.phix new file mode 100644 index 0000000000..be09089b8a --- /dev/null +++ b/Task/Arbitrary-precision-integers--included-/Phix/arbitrary-precision-integers--included-.phix @@ -0,0 +1,11 @@ +include bigatom.e + +bigatom res +res = ba_power(3,2) +res = ba_power(4,res) +res = ba_power(5,res) + +string s = ba_sprint(res) +?length(s) +?s[1..20] +?s[-20..-1] diff --git a/Task/Arbitrary-precision-integers--included-/Sidef/arbitrary-precision-integers--included-.sidef b/Task/Arbitrary-precision-integers--included-/Sidef/arbitrary-precision-integers--included-.sidef new file mode 100644 index 0000000000..1f06a61cc6 --- /dev/null +++ b/Task/Arbitrary-precision-integers--included-/Sidef/arbitrary-precision-integers--included-.sidef @@ -0,0 +1,3 @@ +var x = 5**(4**(3**2)); +var y = x.to_s; +printf("5**4**3**2 = %s...%s and has %i digits\n", y.ft(0,19), y.ft(-20), y.len); diff --git a/Task/Arbitrary-precision-integers--included-/Ursa/arbitrary-precision-integers--included-.ursa b/Task/Arbitrary-precision-integers--included-/Ursa/arbitrary-precision-integers--included-.ursa new file mode 100644 index 0000000000..c6ade7d7d9 --- /dev/null +++ b/Task/Arbitrary-precision-integers--included-/Ursa/arbitrary-precision-integers--included-.ursa @@ -0,0 +1,26 @@ +import "unbounded_int" +decl unbounded_int x +x.set ((x.valueof 5).pow ((x.valueof 4).pow ((x.valueof 3).pow 2))) + +decl string first last xstr +set xstr (string x) + +# get the first twenty digits +decl int i +for (set i 0) (< i 20) (inc i) + set first (+ first xstr) +end for + +# get the last twenty digits +for (set i (- (size xstr) 20)) (< i (size xstr)) (inc i) + set last (+ last xstr) +end for + +out "the first and last digits of 5^(4^(3^2)) are " first "..." console +out last " (the result was " (size xstr) " digits long)" endl endl console + +if (and (and (= first "62060698786608744707") (= last "92256259918212890625")) (= (size xstr) 183231)) + out "(pass)" endl console +else + out "FAIL" endl console +end if diff --git a/Task/Arena-storage-pool/Oforth/arena-storage-pool.oforth b/Task/Arena-storage-pool/Oforth/arena-storage-pool.oforth new file mode 100644 index 0000000000..07b92ed986 --- /dev/null +++ b/Task/Arena-storage-pool/Oforth/arena-storage-pool.oforth @@ -0,0 +1,2 @@ +Object Class new: MyClass(a, b, c) +MyClass new diff --git a/Task/Arithmetic-Complex/ERRE/arithmetic-complex.erre b/Task/Arithmetic-Complex/ERRE/arithmetic-complex.erre new file mode 100644 index 0000000000..c308c6fb13 --- /dev/null +++ b/Task/Arithmetic-Complex/ERRE/arithmetic-complex.erre @@ -0,0 +1,48 @@ +PROGRAM COMPLEX_ARITH + +TYPE COMPLEX=(REAL#,IMAG#) + +DIM X:COMPLEX,Y:COMPLEX,Z:COMPLEX + +! +! complex arithmetic routines +! +DIM A:COMPLEX,B:COMPLEX,C:COMPLEX + +PROCEDURE ADD(A.,B.->C.) + C.REAL#=A.REAL#+B.REAL# + C.IMAG#=A.IMAG#+B.IMAG# +END PROCEDURE + +PROCEDURE INV(A.->B.) + LOCAL DENOM# + DENOM#=A.REAL#^2+A.IMAG#^2 + B.REAL#=A.REAL#/DENOM# + B.IMAG#=-A.IMAG#/DENOM# +END PROCEDURE + +PROCEDURE MULT(A.,B.->C.) + C.REAL#=A.REAL#*B.REAL#-A.IMAG#*B.IMAG# + C.IMAG#=A.REAL#*B.IMAG#+A.IMAG#*B.REAL# +END PROCEDURE + +PROCEDURE NEG(A.->B.) + B.REAL#=-A.REAL# + B.IMAG#=-A.IMAG# +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) !CLS + X.REAL#=1 + X.IMAG#=1 + Y.REAL#=2 + Y.IMAG#=2 + ADD(X.,Y.->Z.) + PRINT(Z.REAL#;" + ";Z.IMAG#;"i") + MULT(X.,Y.->Z.) + PRINT(Z.REAL#;" + ";Z.IMAG#;"i") + INV(X.->Z.) + PRINT(Z.REAL#;" + ";Z.IMAG#;"i") + NEG(X.->Z.) + PRINT(Z.REAL#;" + ";Z.IMAG#;"i") +END PROGRAM diff --git a/Task/Arithmetic-Complex/EchoLisp/arithmetic-complex.echolisp b/Task/Arithmetic-Complex/EchoLisp/arithmetic-complex.echolisp new file mode 100644 index 0000000000..573f2f99d7 --- /dev/null +++ b/Task/Arithmetic-Complex/EchoLisp/arithmetic-complex.echolisp @@ -0,0 +1,10 @@ +(define a 42+666i) → a +(define b 1+i) → b +(- a) → -42-666i ; negate +(+ a b) → 43+667i ; add +(* a b) → -624+708i ; multiply +(/ b) → 0.5-0.5i ; invert +(conjugate b) → 1-i +(angle b) → 0.7853981633974483 ; = PI/4 +(magnitude b) → 1.4142135623730951 ; = sqrt(2) +(exp (* I PI)) → -1+0i ; Euler = e^(I*PI) = -1 diff --git a/Task/Arithmetic-Complex/FreeBASIC/arithmetic-complex.freebasic b/Task/Arithmetic-Complex/FreeBASIC/arithmetic-complex.freebasic new file mode 100644 index 0000000000..a428a760f4 --- /dev/null +++ b/Task/Arithmetic-Complex/FreeBASIC/arithmetic-complex.freebasic @@ -0,0 +1,65 @@ +' FB 1.05.0 Win64 + +Type Complex + As Double real, imag + Declare Constructor(real As Double, imag As Double) + Declare Function invert() As Complex + Declare Function conjugate() As Complex + Declare Operator cast() As String +End Type + +Constructor Complex(real As Double, imag As Double) + This.real = real + This.imag = imag +End Constructor + +Function Complex.invert() As Complex + Dim denom As Double = real * real + imag * imag + Return Complex(real / denom, -imag / denom) +End Function + +Function Complex.conjugate() As Complex + Return Complex(real, -imag) +End Function + +Operator Complex.Cast() As String + If imag >= 0 Then + Return Str(real) + "+" + Str(imag) + "j" + End If + Return Str(real) + Str(imag) + "j" +End Operator + +Operator - (c As Complex) As Complex + Return Complex(-c.real, -c.imag) +End Operator + +Operator + (c1 As Complex, c2 As Complex) As Complex + Return Complex(c1.real + c2.real, c1.imag + c2.imag) +End Operator + +Operator - (c1 As Complex, c2 As Complex) As Complex + Return c1 + (-c2) +End Operator + +Operator * (c1 As Complex, c2 As Complex) As Complex + Return Complex(c1.real * c2.real - c1.imag * c2.imag, c1.real * c2.imag + c2.real * c1.imag) +End Operator + +Operator / (c1 As Complex, c2 As Complex) As Complex + Return c1 * c2.invert +End Operator + +Var x = Complex(1, 3) +Var y = Complex(5, 2) +Print "x = "; x +Print "y = "; y +Print "x + y = "; x + y +Print "x - y = "; x - y +Print "x * y = "; x * y +Print "x / y = "; x / y +Print "-x = "; -x +Print "1 / x = "; x.invert +Print "x* = "; x.conjugate +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Arithmetic-Complex/Futhark/arithmetic-complex.futhark b/Task/Arithmetic-Complex/Futhark/arithmetic-complex.futhark new file mode 100644 index 0000000000..de4eba7558 --- /dev/null +++ b/Task/Arithmetic-Complex/Futhark/arithmetic-complex.futhark @@ -0,0 +1,27 @@ +type complex = (f64,f64) + +fun complexAdd((a,b): complex) ((c,d): complex): complex = + (a + c, + b + d) + +fun complexMult((a,b): complex) ((c,d): complex): complex = + (a*c - b * d, + a*d + b * c) + +fun complexInv((r,i): complex): complex = + let denom = r*r + i * i + in (r / denom, + -i / denom) + +fun complexNeg((r,i): complex): complex = + (-r, -i) + +fun complexConj((r,i): complex): complex = + (r, -i) + +fun main (o: int) (a: complex) (b: complex): complex = + if o == 0 then complexAdd a b + else if o == 1 then complexMult a b + else if o == 2 then complexInv a + else if o == 3 then complexNeg a + else complexConj a diff --git a/Task/Arithmetic-Complex/LFE/arithmetic-complex-1.lfe b/Task/Arithmetic-Complex/LFE/arithmetic-complex-1.lfe new file mode 100644 index 0000000000..58e6cca992 --- /dev/null +++ b/Task/Arithmetic-Complex/LFE/arithmetic-complex-1.lfe @@ -0,0 +1,3 @@ +(defrecord complex + real + img) diff --git a/Task/Arithmetic-Complex/LFE/arithmetic-complex-2.lfe b/Task/Arithmetic-Complex/LFE/arithmetic-complex-2.lfe new file mode 100644 index 0000000000..2d598e7347 --- /dev/null +++ b/Task/Arithmetic-Complex/LFE/arithmetic-complex-2.lfe @@ -0,0 +1,17 @@ +(defun add + (((match-complex real r1 img i1) + (match-complex real r2 img i2)) + (new (+ r1 r2) (+ i1 i2)))) + +(defun mult + (((match-complex real r1 img i1) + (match-complex real r2 img i2)) + (new (- (* r1 r2) (* i1 i2)) + (+ (* r1 i2) (* r2 i1))))) + +(defun neg + (((match-complex real r img i)) + (new (* -1 r) (* -1 i)))) + +(defun inv (cmplx) + (div (conj cmplx) (modulus cmplx))) diff --git a/Task/Arithmetic-Complex/LFE/arithmetic-complex-3.lfe b/Task/Arithmetic-Complex/LFE/arithmetic-complex-3.lfe new file mode 100644 index 0000000000..b40168c5ea --- /dev/null +++ b/Task/Arithmetic-Complex/LFE/arithmetic-complex-3.lfe @@ -0,0 +1,3 @@ +(defun conj + (((match-complex real r img i)) + (new r (* -1 i)))) diff --git a/Task/Arithmetic-Complex/LFE/arithmetic-complex-4.lfe b/Task/Arithmetic-Complex/LFE/arithmetic-complex-4.lfe new file mode 100644 index 0000000000..5f5e0a45c8 --- /dev/null +++ b/Task/Arithmetic-Complex/LFE/arithmetic-complex-4.lfe @@ -0,0 +1,11 @@ +(defun new (r i) + (make-complex real r img i)) + +(defun modulus (cmplx) + (mult cmplx (conj cmplx))) + +(defun div (c1 c2) + (let* ((denom (complex-real (modulus c2))) + (c3 (mult c1 (conj c2)))) + (new (/ (complex-real c3) denom) + (/ (complex-img c3) denom))))) diff --git a/Task/Arithmetic-Complex/LFE/arithmetic-complex-5.lfe b/Task/Arithmetic-Complex/LFE/arithmetic-complex-5.lfe new file mode 100644 index 0000000000..1a41f56289 --- /dev/null +++ b/Task/Arithmetic-Complex/LFE/arithmetic-complex-5.lfe @@ -0,0 +1,11 @@ +(defun ->str + (((match-complex real r img i)) (when (>= i 0)) + (->str r i "+")) + (((match-complex real r img i)) + (->str r i ""))) + +(defun ->str (r i pos) + (io_lib:format "~p ~s~pi" `(,r ,pos ,i))) + +(defun print (cmplx) + (io:format (++ (->str cmplx) "~n"))) diff --git a/Task/Arithmetic-Complex/Nim/arithmetic-complex.nim b/Task/Arithmetic-Complex/Nim/arithmetic-complex.nim new file mode 100644 index 0000000000..93a744022b --- /dev/null +++ b/Task/Arithmetic-Complex/Nim/arithmetic-complex.nim @@ -0,0 +1,10 @@ +import complex +var a: TComplex = (1.0,1.0) +var b: TComplex = (3.1415,1.2) + +echo ("a : " & $a) +echo ("b : " & $b) +echo ("a + b: " & $(a + b)) +echo ("a * b: " & $(a * b)) +echo ("1/a : " & $(1/a)) +echo ("-a : " & $(-a)) diff --git a/Task/Arithmetic-Complex/Oforth/arithmetic-complex-1.oforth b/Task/Arithmetic-Complex/Oforth/arithmetic-complex-1.oforth new file mode 100644 index 0000000000..d487d670d5 --- /dev/null +++ b/Task/Arithmetic-Complex/Oforth/arithmetic-complex-1.oforth @@ -0,0 +1,26 @@ +Number 100 Class newPriority: Complex(re, im) + +Complex method: re @re ; +Complex method: im @im ; + +Complex method: initialize := im := re ; +Complex method: << '(' <n + Complex new(@re n /, @im neg n / ) ; + +Complex method: /(c) c self inv * ; diff --git a/Task/Arithmetic-Complex/Oforth/arithmetic-complex-2.oforth b/Task/Arithmetic-Complex/Oforth/arithmetic-complex-2.oforth new file mode 100644 index 0000000000..140589409e --- /dev/null +++ b/Task/Arithmetic-Complex/Oforth/arithmetic-complex-2.oforth @@ -0,0 +1,4 @@ +2 3.2 I * + .cr +Complex new(2, 3) 1.2 + .cr +Complex new(2, 3) 1.2 * .cr +2 Complex new(2, 3) / .cr diff --git a/Task/Arithmetic-Complex/Phix/arithmetic-complex.phix b/Task/Arithmetic-Complex/Phix/arithmetic-complex.phix new file mode 100644 index 0000000000..c4c7474ccc --- /dev/null +++ b/Task/Arithmetic-Complex/Phix/arithmetic-complex.phix @@ -0,0 +1,59 @@ +constant REAL = 1, + IMAG = 2 + +type complex(sequence s) + return length(s)=2 and atom(s[REAL]) and atom(s[IMAG]) +end type + +function add(complex a, complex b) + return sq_add(a,b) +end function + +function mult(complex a, complex b) + return {a[REAL] * b[REAL] - a[IMAG] * b[IMAG], + a[REAL] * b[IMAG] + a[IMAG] * b[REAL]} +end function + +function inv(complex a) +atom denom + denom = a[REAL] * a[REAL] + a[IMAG] * a[IMAG] + return {a[REAL] / denom, -a[IMAG] / denom} +end function + +function neg(complex a) + return sq_uminus(a) +end function + +function scomplex(complex a) +sequence s = "" +atom ar, ai + {ar, ai} = a + if ar!=0 then + s = sprintf("%g",ar) + end if + + if ai!=0 then + if ai=1 then + s &= "+i" + elsif ai=-1 then + s &= "-i" + else + s &= sprintf("%+gi",ai) + end if + end if + + if length(s)=0 then + return "0" + end if + return s +end function + +complex a, b +a = { 1.0, 1.0 } +b = { 3.14159, 1.2 } +printf(1,"a = %s\n",{scomplex(a)}) +printf(1,"b = %s\n",{scomplex(b)}) +printf(1,"a+b = %s\n",{scomplex(add(a,b))}) +printf(1,"a*b = %s\n",{scomplex(mult(a,b))}) +printf(1,"1/a = %s\n",{scomplex(inv(a))}) +printf(1,"-a = %s\n",{scomplex(neg(a))}) diff --git a/Task/Arithmetic-Complex/Sidef/arithmetic-complex.sidef b/Task/Arithmetic-Complex/Sidef/arithmetic-complex.sidef new file mode 100644 index 0000000000..830b1d93fe --- /dev/null +++ b/Task/Arithmetic-Complex/Sidef/arithmetic-complex.sidef @@ -0,0 +1,13 @@ +var a = 1:1; # Complex(1, 1) +var b = 3.14159:1.25; # Complex(3.14159, 1.25) + +[ a + b, # addition + a * b, # multiplication + -a, # negation + 1 / a, # multiplicative inverse + ~a, # complex conjugate + a.abs, # abs + a.sqrt, # sqrt + b.re, # real + b.im, # imaginary +].each { |c| say c } diff --git a/Task/Arithmetic-Complex/Swift/arithmetic-complex-1.swift b/Task/Arithmetic-Complex/Swift/arithmetic-complex-1.swift new file mode 100644 index 0000000000..ef71ce5b9b --- /dev/null +++ b/Task/Arithmetic-Complex/Swift/arithmetic-complex-1.swift @@ -0,0 +1,45 @@ +public struct Complex { + + public let real : Double + public let imaginary : Double + + public init(real inReal:Double, imaginary inImaginary:Double) { + real = inReal + imaginary = inImaginary + } + + public static var i : Complex = Complex(real:0, imaginary: 1) + public static var zero : Complex = Complex(real: 0, imaginary: 0) + + public var negate : Complex { + return Complex(real: -real, imaginary: -imaginary) + } + + public var invert : Complex { + let d = (real*real + imaginary*imaginary) + return Complex(real: real/d, imaginary: -imaginary/d) + } + + public var conjugate : Complex { + return Complex(real: real, imaginary: -imaginary) + } + +} +public func + (left: Complex, right: Complex) -> Complex { + + return Complex(real: left.real+right.real, imaginary: left.imaginary+right.imaginary) +} +public func * (left: Complex, right: Complex) -> Complex { + + return Complex(real: left.real*right.real - left.imaginary*right.imaginary, + imaginary: left.real*right.imaginary+left.imaginary*right.real) +} +public prefix func - (right:Complex) -> Complex { + return right.negate +} + +// Checking equality is almost necessary for a struct of this type to be useful +extension Complex : Equatable {} +public func == (left:Complex, right:Complex) -> Bool { + return left.real == right.real && left.imaginary == right.imaginary +} diff --git a/Task/Arithmetic-Complex/Swift/arithmetic-complex-2.swift b/Task/Arithmetic-Complex/Swift/arithmetic-complex-2.swift new file mode 100644 index 0000000000..fb95f4f8e0 --- /dev/null +++ b/Task/Arithmetic-Complex/Swift/arithmetic-complex-2.swift @@ -0,0 +1,24 @@ +extension Complex : CustomStringConvertible { + + public var description : String { + + guard real != 0 || imaginary != 0 else { return "0" } + + let rs : String = real != 0 ? "\(real)" : "" + let iS : String + let sign : String + let iSpace = real != 0 ? " " : "" + switch imaginary { + case let i where i < 0: + sign = "-" + iS = i == -1 ? "i" : "\(-i)i" + case let i where i > 0: + sign = real != 0 ? "+" : "" + iS = i == 1 ? "i" : "\(i)i" + default: + sign = "" + iS = "" + } + return "\(rs)\(iSpace)\(sign)\(iSpace)\(iS)" + } +} diff --git a/Task/Arithmetic-Complex/Swift/arithmetic-complex-3.swift b/Task/Arithmetic-Complex/Swift/arithmetic-complex-3.swift new file mode 100644 index 0000000000..7c35dca071 --- /dev/null +++ b/Task/Arithmetic-Complex/Swift/arithmetic-complex-3.swift @@ -0,0 +1,10 @@ +public func - (left:Complex, right:Complex) -> Complex { + return left + -right +} + +public func / (divident:Complex, divisor:Complex) -> Complex { + let rc = divisor.conjugate + let num = divident * rc + let den = divisor * rc + return Complex(real: num.real/den.real, imaginary: num.imaginary/den.real) +} diff --git a/Task/Arithmetic-Complex/Wortel/arithmetic-complex.wortel b/Task/Arithmetic-Complex/Wortel/arithmetic-complex.wortel new file mode 100644 index 0000000000..a86c4a0ce4 --- /dev/null +++ b/Task/Arithmetic-Complex/Wortel/arithmetic-complex.wortel @@ -0,0 +1,30 @@ +@class Complex { + &[r i] @: { + ^r || r 0 + ^i || i 0 + ^m +@sq^r @sq^i + } + add &o @new Complex[+ ^r o.r + ^i o.i] + mul &o @new Complex[-* ^r o.r * ^i o.i +* ^r o.i * ^i o.r] + neg &^ @new Complex[@-^r @-^i] + inv &^ @new Complex[/ ^r ^m / @-^i ^m] + toString &^?{ + =^i 0 "{^r}" + =^r 0 "{^i}i" + >^i 0 "{^r} + {^i}i" + "{^r} - {@-^i}i" + } +} + +@vars { + a @new Complex[5 3] + b @new Complex[4 3N] +} +@each &x !console.log x [ + "({a}) + ({b}) = {!a.add b}" + "({a}) * ({b}) = {!a.mul b}" + "-1 * ({b}) = {b.neg.}" + "({a}) - ({b}) = {!a.add b.neg.}" + "1 / ({b}) = {b.inv.}" + "({!a.mul b}) / ({b}) = {`!.mul b.inv. !a.mul b}" +] diff --git a/Task/Arithmetic-Complex/jq/arithmetic-complex-1.jq b/Task/Arithmetic-Complex/jq/arithmetic-complex-1.jq new file mode 100644 index 0000000000..8356d0976e --- /dev/null +++ b/Task/Arithmetic-Complex/jq/arithmetic-complex-1.jq @@ -0,0 +1,62 @@ +def real(z): if (z|type) == "number" then z else z[0] end; + +def imag(z): if (z|type) == "number" then 0 else z[1] end; + +def plus(x; y): + if (x|type) == "number" then + if (y|type) == "number" then [ x+y, 0 ] + else [ x + y[0], y[1]] + end + elif (y|type) == "number" then plus(y;x) + else [ x[0] + y[0], x[1] + y[1] ] + end; + +def multiply(x; y): + if (x|type) == "number" then + if (y|type) == "number" then [ x*y, 0 ] + else [x * y[0], x * y[1]] + end + elif (y|type) == "number" then multiply(y;x) + else [ x[0] * y[0] - x[1] * y[1], + x[0] * y[1] + x[1] * y[0]] + end; + +def negate(x): multiply(-1; x); + +def minus(x; y): plus(x; multiply(-1; y)); + +def conjugate(z): + if (z|type) == "number" then [z, 0] + else [z[0], -(z[1]) ] + end; + +def invert(z): + if (z|type) == "number" then [1/z, 0] + else + ( (z[0] * z[0]) + (z[1] * z[1]) ) as $d + # use "0 + ." to convert -0 back to 0 + | [ z[0]/$d, (0 + -(z[1]) / $d)] + end; + +def divide(x;y): multiply(x; invert(y)); + +def exp(z): + def expi(x): [ (x|cos), (x|sin) ]; + if (z|type) == "number" then z|exp + elif z[0] == 0 then expi(z[1]) # for efficiency + else multiply( (z[0]|exp); expi(z[1]) ) + end ; + +def test(x;y): + "x = \( x )", + "y = \( y )", + "x+y: \( plus(x;y))", + "x*y: \( multiply(x;y))", + "-x: \( negate(x))", + "1/x: \( invert(x))", + "conj(x): \( conjugate(x))", + "(x/y)*y: \( multiply( divide(x;y) ; y) )", + "e^iπ: \( exp( [0, 4 * (1|atan) ] ) )" +; + +test( [1,1]; [0,1] ) diff --git a/Task/Arithmetic-Complex/jq/arithmetic-complex-2.jq b/Task/Arithmetic-Complex/jq/arithmetic-complex-2.jq new file mode 100644 index 0000000000..9e0d424453 --- /dev/null +++ b/Task/Arithmetic-Complex/jq/arithmetic-complex-2.jq @@ -0,0 +1,10 @@ +$ jq -n -f complex.jq +"x = [1,1]" +"y = [0,1]" +"x+y: [1,2]" +"x*y: [-1,1]" +"-x: [-1,-1]" +"1/x: [0.5,-0.5]" +"conj(x): [1,-1]" +"(x/y)*y: [1,1]" +"e^iπ: [-1,1.2246467991473532e-16]" diff --git a/Task/Arithmetic-Integer/ECL/arithmetic-integer.ecl b/Task/Arithmetic-Integer/ECL/arithmetic-integer.ecl new file mode 100644 index 0000000000..08d5bd8e11 --- /dev/null +++ b/Task/Arithmetic-Integer/ECL/arithmetic-integer.ecl @@ -0,0 +1,31 @@ +ArithmeticDemo(INTEGER A,INTEGER B) := FUNCTION + ADDit := A + B; + SUBTRACTit := A - B; + MULTIPLYit := A * B; + INTDIVIDEit := A DIV B; //INTEGER DIVISION + DIVIDEit := A / B; //standard division + Remainder := A % B; + EXPit := POWER(A,B); + DS := DATASET([{A,B,'A PLUS B is:',ADDit}, + {A,B,'A MINUS B is:',SUBTRACTit}, + {A,B,'A TIMES B is:',MULTIPLYit}, + {A,B,'A INT DIVIDE BY B is:',INTDIVIDEit}, + {A,B,'REMAINDER is:',Remainder}, + {A,B,'A DIVIDE BY B is:',DIVIDEit}, + {A,B,'A RAISED TO B:',EXPit}], + {INTEGER AVal,INTEGER BVal,STRING18 valuetype,STRING val}); + + RETURN DS; + END; + +ArithmeticDemo(1,1); +ArithmeticDemo(2,2); +ArithmeticDemo(50,5); +ArithmeticDemo(10,3); +ArithmeticDemo(-1,2); + +/* NOTE:Division by zero defaults to generating a zero result (0), + rather than reporting a “divide by zero” error. + This avoids invalid or unexpected data aborting a long job. + This default behavior can be changed +*/ diff --git a/Task/Arithmetic-Integer/ERRE/arithmetic-integer.erre b/Task/Arithmetic-Integer/ERRE/arithmetic-integer.erre new file mode 100644 index 0000000000..198ff52df7 --- /dev/null +++ b/Task/Arithmetic-Integer/ERRE/arithmetic-integer.erre @@ -0,0 +1,19 @@ +PROGRAM INTEGER_ARITHMETIC + +! +! for rosettacode.org +! + +!$INTEGER + +BEGIN + INPUT("Enter a number ",A) + INPUT("Enter another number ",B) + + PRINT("Addition ";A;"+";B;"=";(A+B)) + PRINT("Subtraction ";A;"-";B;"=";(A-B)) + PRINT("Multiplication ";A;"*";B;"=";(A*B)) + PRINT("Integer division ";A;"div";B;"=";(A DIV B)) + PRINT("Remainder or modulo ";A;"mod";B;"=";(A MOD B)) + PRINT("Power ";A;"^";B;"=";(A^B)) +END PROGRAM diff --git a/Task/Arithmetic-Integer/FreeBASIC/arithmetic-integer.freebasic b/Task/Arithmetic-Integer/FreeBASIC/arithmetic-integer.freebasic new file mode 100644 index 0000000000..307a47feb3 --- /dev/null +++ b/Task/Arithmetic-Integer/FreeBASIC/arithmetic-integer.freebasic @@ -0,0 +1,16 @@ +' FB 1.05.0 Win64 + +Dim As Integer i, j +Input "Enter two integers separated by a comma"; i, j +Print i;" + "; j; " = "; i + j +Print i;" - "; j; " = "; i - j +Print i;" * "; j; " = "; i * j +Print i;" / "; j; " = "; i \ j +Print i;" % "; j; " = "; i Mod j +Print i;" ^ "; j; " = "; i ^ j +Sleep + +' Integer division (for which FB uses the '\' operator) rounds towards zero + +' Remainder (for which FB uses the Mod operator) will, if non-zero, match the sign +' of the first operand diff --git a/Task/Arithmetic-Integer/FutureBasic/arithmetic-integer.futurebasic b/Task/Arithmetic-Integer/FutureBasic/arithmetic-integer.futurebasic new file mode 100644 index 0000000000..040852e1f4 --- /dev/null +++ b/Task/Arithmetic-Integer/FutureBasic/arithmetic-integer.futurebasic @@ -0,0 +1,26 @@ +include "ConsoleWindow" + +dim as Str31 a, b +dim as long i1, i2 + +input "Enter the first integer: "; a +print +input "Enter the second integer: "; b +print : print + +i1 = val(a) : i2 = val(b) + +print " Number 1:"; i1 +print " Number 2:"; i2 +print +print " Add: "; i1; " +"; i2; " ="; i1 + i2 +print " Subtract: "; i1; " -"; i2; " ="; i1 - i2 +print " Multiply: "; i1; " *"; i2; " ="; i1 * i2 + +if i2 != 0 + print " Divide: "; i1; " /"; i2; " ="; i1 / i2 + print i1; " mod"; i2; " ="; i1 MOD i2; " remainder" + print i1; " raised to power of"; i2; " ="; i1 ^ i2 + else + print "Cannot divide by zero." +end if diff --git a/Task/Arithmetic-Integer/GEORGE/arithmetic-integer.george b/Task/Arithmetic-Integer/GEORGE/arithmetic-integer.george new file mode 100644 index 0000000000..aeb0240cb5 --- /dev/null +++ b/Task/Arithmetic-Integer/GEORGE/arithmetic-integer.george @@ -0,0 +1,7 @@ +R (m) ; +R (n) ; +m n + P; +m n - P; +m n × P; +m n div P; +m n rem P; diff --git a/Task/Arithmetic-Integer/Harbour/arithmetic-integer.harbour b/Task/Arithmetic-Integer/Harbour/arithmetic-integer.harbour new file mode 100644 index 0000000000..03facbba13 --- /dev/null +++ b/Task/Arithmetic-Integer/Harbour/arithmetic-integer.harbour @@ -0,0 +1,11 @@ +procedure Test( a, b ) + ? "a+b", a + b + ? "a-b", a - b + ? "a*b", a * b + // The quotient isn't integer, so we use the Int() function, which truncates it downward. + ? "a/b", Int( a / b ) + // Remainder: + ? "a%b", a % b + // Exponentiation is also a base arithmetic operation + ? "a**b", a ** b + return diff --git a/Task/Arithmetic-Integer/I/arithmetic-integer.i b/Task/Arithmetic-Integer/I/arithmetic-integer.i new file mode 100644 index 0000000000..9a2375993e --- /dev/null +++ b/Task/Arithmetic-Integer/I/arithmetic-integer.i @@ -0,0 +1,11 @@ +software { + var a = number(read(' ')) + var b = number(read('\n')) + + print("Sum: " , a + b) + print("Difference: " , a - b) + print("Product: " , a * b) + print("Quotient: " , a / b) + print("Modulus: " , a mod b) + print("Exponent: " , a ^ b) +} diff --git a/Task/Arithmetic-Integer/LFE/arithmetic-integer-1.lfe b/Task/Arithmetic-Integer/LFE/arithmetic-integer-1.lfe new file mode 100644 index 0000000000..1257cecab7 --- /dev/null +++ b/Task/Arithmetic-Integer/LFE/arithmetic-integer-1.lfe @@ -0,0 +1,14 @@ +(defmodule arith + (export all)) + +(defun demo-arith () + (case (: io fread '"Please enter two integers: " '"~d~d") + ((tuple 'ok (a b)) + (: io format '"~p + ~p = ~p~n" (list a b (+ a b))) + (: io format '"~p - ~p = ~p~n" (list a b (- a b))) + (: io format '"~p * ~p = ~p~n" (list a b (* a b))) + (: io format '"~p^~p = ~p~n" (list a b (: math pow a b))) + ; div truncates towards zero + (: io format '"~p div ~p = ~p~n" (list a b (div a b))) + ; rem's result takes the same sign as the first operand + (: io format '"~p rem ~p = ~p~n" (list a b (rem a b)))))) diff --git a/Task/Arithmetic-Integer/LFE/arithmetic-integer-2.lfe b/Task/Arithmetic-Integer/LFE/arithmetic-integer-2.lfe new file mode 100644 index 0000000000..236335772c --- /dev/null +++ b/Task/Arithmetic-Integer/LFE/arithmetic-integer-2.lfe @@ -0,0 +1,11 @@ +> (slurp '"arith.lfe") +#(ok arith) +> (demo-arith) +Please enter two integers: 2 8 +2 + 8 = 10 +2 - 8 = -6 +2 * 8 = 16 +2^8 = 256.0 +2 div 8 = 0 +2 rem 8 = 2 +ok diff --git a/Task/Arithmetic-Integer/Lasso/arithmetic-integer.lasso b/Task/Arithmetic-Integer/Lasso/arithmetic-integer.lasso new file mode 100644 index 0000000000..fe62ec9a03 --- /dev/null +++ b/Task/Arithmetic-Integer/Lasso/arithmetic-integer.lasso @@ -0,0 +1,8 @@ +local(a = 6, b = 4) +#a + #b // 10 +#a - #b // 2 +#a * #b // 24 +#a / #b // 1 +#a % #b // 2 +math_pow(#a,#b) // 1296 +math_pow(#b,#a) // 4096 diff --git a/Task/Arithmetic-Integer/LiveCode/arithmetic-integer-1.livecode b/Task/Arithmetic-Integer/LiveCode/arithmetic-integer-1.livecode new file mode 100644 index 0000000000..7dfb3c339e --- /dev/null +++ b/Task/Arithmetic-Integer/LiveCode/arithmetic-integer-1.livecode @@ -0,0 +1,12 @@ +ask "enter 2 numbers (comma separated)" +if it is not empty then + put item 1 of it into n1 + put item 2 of it into n2 + put sum(n1,n2) into ai["sum"] + put n1 * n2 into ai["product"] + put n1 div n2 into ai["quotient"] -- truncates + put n1 mod n2 into ai["remainder"] + put n1^n2 into ai["power"] + combine ai using comma and colon + put ai +end if diff --git a/Task/Arithmetic-Integer/LiveCode/arithmetic-integer-2.livecode b/Task/Arithmetic-Integer/LiveCode/arithmetic-integer-2.livecode new file mode 100644 index 0000000000..df0bdf14db --- /dev/null +++ b/Task/Arithmetic-Integer/LiveCode/arithmetic-integer-2.livecode @@ -0,0 +1,5 @@ +-2,4 - power:16,product:-8,quotient:0,remainder:-2,sum:2 +2,-4 - power:0.0625,product:-8,quotient:0,remainder:2,sum:-2 +-2,-4 - power:0.0625,product:8,quotient:0,remainder:-2,sum:-6 +2,4 - power:16,product:8,quotient:0,remainder:2,sum:6 +11,4 - power:14641,product:44,quotient:2,remainder:3,sum:15 diff --git a/Task/Arithmetic-Integer/Nim/arithmetic-integer.nim b/Task/Arithmetic-Integer/Nim/arithmetic-integer.nim new file mode 100644 index 0000000000..43a6b90847 --- /dev/null +++ b/Task/Arithmetic-Integer/Nim/arithmetic-integer.nim @@ -0,0 +1,22 @@ +import parseopt,strutils + +var + opt: TOptParser = initOptParser() + str = opt.cmdLineRest.split + a: int = 0 + b: int = 0 + +try: + a = parseInt(str[0]) + b = parseInt(str[1]) +except EinvalidValue: + quit("Invalid params. Two integers are expected.") + + +echo ("a : " & $a) +echo ("b : " & $b) +echo ("a + b : " & $(a+b)) +echo ("a - b : " & $(a-b)) +echo ("a * b : " & $(a*b)) +echo ("a div b: " & $(a div b)) +echo ("a mod b: " & $(a mod b)) diff --git a/Task/Arithmetic-Integer/Oforth/arithmetic-integer.oforth b/Task/Arithmetic-Integer/Oforth/arithmetic-integer.oforth new file mode 100644 index 0000000000..5323fe88cc --- /dev/null +++ b/Task/Arithmetic-Integer/Oforth/arithmetic-integer.oforth @@ -0,0 +1,7 @@ +: integers(a, b) + "a + b =" . a b + .cr + "a - b =" . a b - .cr + "a * b =" . a b * .cr + "a / b =" . a b / .cr + "a mod b =" . a b mod .cr + "a pow b =" . a b pow .cr ; diff --git a/Task/Arithmetic-Integer/PHL/arithmetic-integer.phl b/Task/Arithmetic-Integer/PHL/arithmetic-integer.phl new file mode 100644 index 0000000000..296fcc0548 --- /dev/null +++ b/Task/Arithmetic-Integer/PHL/arithmetic-integer.phl @@ -0,0 +1,19 @@ +module arith; + +extern printf; +extern scanf; + +@Integer main [ + @Pointer<@Integer> a = alloc(4); + @Pointer<@Integer> b = alloc(4); + scanf("%i %i", a, b); + + printf("a + b = %i\n", a::get + b::get); + printf("a - b = %i\n", a::get - b::get); + printf("a * b = %i\n", a::get * b::get); + printf("a / b = %i\n", a::get / b::get); + printf("a % b = %i\n", a::get % b::get); + printf("a ** b = %i\n", a::get ** b::get); + + return 0; +] diff --git a/Task/Arithmetic-Integer/Panda/arithmetic-integer.panda b/Task/Arithmetic-Integer/Panda/arithmetic-integer.panda new file mode 100644 index 0000000000..46579af8b1 --- /dev/null +++ b/Task/Arithmetic-Integer/Panda/arithmetic-integer.panda @@ -0,0 +1 @@ +a=3 b=7 func:_bbf__number_number_number =>f.name. '(' a b ')' ' => ' f(a b) nl diff --git a/Task/Arithmetic-Integer/Phix/arithmetic-integer.phix b/Task/Arithmetic-Integer/Phix/arithmetic-integer.phix new file mode 100644 index 0000000000..b67b49bae9 --- /dev/null +++ b/Task/Arithmetic-Integer/Phix/arithmetic-integer.phix @@ -0,0 +1,9 @@ +integer a = floor(prompt_number("a = ",{})) +integer b = floor(prompt_number("b = ",{})) + +printf(1,"a + b = %d\n", a+b) +printf(1,"a - b = %d\n", a-b) +printf(1,"a * b = %d\n", a*b) +printf(1,"a / b = %g\n", a/b) -- does not truncate +printf(1,"remainder(a,b) = %d\n", remainder(a,b)) -- same sign as first operand +printf(1,"power(a,b) = %g\n", power(a,b)) diff --git a/Task/Arithmetic-Integer/Ring/arithmetic-integer.ring b/Task/Arithmetic-Integer/Ring/arithmetic-integer.ring new file mode 100644 index 0000000000..f3f150d092 --- /dev/null +++ b/Task/Arithmetic-Integer/Ring/arithmetic-integer.ring @@ -0,0 +1,9 @@ +func Test a,b + see "a+b" + ( a + b ) + nl + see "a-b" + ( a - b ) + nl + see "a*b" + ( a * b ) + nl + // The quotient isn't integer, so we use the Ceil() function, which truncates it downward. + see "a/b" + Ceil( a / b ) + nl + // Remainder: + see "a%b" + ( a % b ) + nl + see "a**b" + pow(a,b ) + nl diff --git a/Task/Arithmetic-Integer/SSEM/arithmetic-integer-1.ssem b/Task/Arithmetic-Integer/SSEM/arithmetic-integer-1.ssem new file mode 100644 index 0000000000..4b2e3992db --- /dev/null +++ b/Task/Arithmetic-Integer/SSEM/arithmetic-integer-1.ssem @@ -0,0 +1,6 @@ +00101000000000100000000000000000 0. -20 to c +10100000000001100000000000000000 1. c to 5 +10100000000000100000000000000000 2. -5 to c +10101000000000010000000000000000 3. Sub. 21 +00000000000001110000000000000000 4. Stop +00000000000000000000000000000000 5. 0 diff --git a/Task/Arithmetic-Integer/SSEM/arithmetic-integer-2.ssem b/Task/Arithmetic-Integer/SSEM/arithmetic-integer-2.ssem new file mode 100644 index 0000000000..3a1072f7d2 --- /dev/null +++ b/Task/Arithmetic-Integer/SSEM/arithmetic-integer-2.ssem @@ -0,0 +1,6 @@ +00101000000000100000000000000000 0. -20 to c +10101000000000010000000000000000 1. Sub. 21 +10100000000001100000000000000000 2. c to 5 +10100000000000100000000000000000 3. -5 to c +00000000000001110000000000000000 4. Stop +00000000000000000000000000000000 5. 0 diff --git a/Task/Arithmetic-Integer/Sidef/arithmetic-integer.sidef b/Task/Arithmetic-Integer/Sidef/arithmetic-integer.sidef new file mode 100644 index 0000000000..2afab6e4b3 --- /dev/null +++ b/Task/Arithmetic-Integer/Sidef/arithmetic-integer.sidef @@ -0,0 +1,6 @@ +var a = Sys.scanln("First number: ").to_i; +var b = Sys.scanln("Second number: ").to_i; + +%w'+ - * // % ** ^ | & << >>'.each { |op| + "#{a} #{op} #{b} = #{a.$op(b)}".say; +} diff --git a/Task/Arithmetic-Integer/Ursa/arithmetic-integer.ursa b/Task/Arithmetic-Integer/Ursa/arithmetic-integer.ursa new file mode 100644 index 0000000000..26f09765b8 --- /dev/null +++ b/Task/Arithmetic-Integer/Ursa/arithmetic-integer.ursa @@ -0,0 +1,17 @@ +# +# integer arithmetic +# + +decl int x y +out "number 1: " console +set x (in int console) +out "number 2: " console +set y (in int console) + +out "\nsum:\t" (int (+ x y)) endl console +out "diff:\t" (int (- x y)) endl console +out "prod:\t" (int (* x y)) endl console +# quotient doesn't round at all, but the int function rounds up +out "quot:\t" (int (/ x y)) endl console +# mod takes the sign of x +out "mod:\t" (int (mod x y)) endl console diff --git a/Task/Arithmetic-Integer/Wart/arithmetic-integer.wart b/Task/Arithmetic-Integer/Wart/arithmetic-integer.wart new file mode 100644 index 0000000000..4a373f30eb --- /dev/null +++ b/Task/Arithmetic-Integer/Wart/arithmetic-integer.wart @@ -0,0 +1,9 @@ +a <- (read) +b <- (read) +prn "sum: " a+b +prn "difference: " a-b +prn "product: " a*b +prn "quotient: " a/b +prn "integer quotient: " (int a/b) +prn "remainder: " a%b +prn "exponent: " a^b diff --git a/Task/Arithmetic-Integer/Wren/arithmetic-integer.wren b/Task/Arithmetic-Integer/Wren/arithmetic-integer.wren new file mode 100644 index 0000000000..0de4ee94da --- /dev/null +++ b/Task/Arithmetic-Integer/Wren/arithmetic-integer.wren @@ -0,0 +1,8 @@ +import "io" for Stdin +var a = Num.fromString(Stdin.readLine()) +var b = Num.fromString(Stdin.readLine()) +System.print("sum: %(a + b)") +System.print("difference: %(a - b)") +System.print("product: %(a * b)") +System.print("integer quotient: %((a / b).floor)") +System.print("remainder: %(a % b)") diff --git a/Task/Arithmetic-Integer/XLISP/arithmetic-integer.xlisp b/Task/Arithmetic-Integer/XLISP/arithmetic-integer.xlisp new file mode 100644 index 0000000000..e1ea026405 --- /dev/null +++ b/Task/Arithmetic-Integer/XLISP/arithmetic-integer.xlisp @@ -0,0 +1,17 @@ +(DEFUN INTEGER-ARITHMETIC () + (DISPLAY "Enter two integers separated by a space.") + (NEWLINE) + (DISPLAY "> ") + (DEFINE A (READ)) + (DEFINE B (READ)) + (DISPLAY `(SUM ,(+ A B))) + (NEWLINE) + (DISPLAY `(DIFFERENCE ,(- A B))) + (NEWLINE) + (DISPLAY `(PRODUCT ,(* A B))) + (NEWLINE) + (DISPLAY `(QUOTIENT ,(QUOTIENT A B))) ; truncates towards zero + (NEWLINE) + (DISPLAY `(REMAINDER ,(REM A B))) ; takes sign of first operand + (NEWLINE) + (DISPLAY `(EXPONENTIATION ,(EXPT A B)))) diff --git a/Task/Arithmetic-Integer/jq/arithmetic-integer.jq b/Task/Arithmetic-Integer/jq/arithmetic-integer.jq new file mode 100644 index 0000000000..f044768085 --- /dev/null +++ b/Task/Arithmetic-Integer/jq/arithmetic-integer.jq @@ -0,0 +1,17 @@ +# Lines which do not have two integers are skipped: + +def arithmetic: + split(" ") | select(length > 0) | map(tonumber) + | if length > 1 then + .[0] as $a | .[1] as $b + | "For a = \($a) and b = \($b):\n" + + "a + b = \($a + $b)\n" + + "a - b = \($a - $b)\n" + + "a * b = \($a * $b)\n" + + "a/b|floor = \($a / $b | floor)\n" + + "a % b = \($a % $b)\n" + + "a | exp = \($a | exp)\n" + else empty + end ; + +arithmetic diff --git a/Task/Arithmetic-Rational/ERRE/arithmetic-rational.erre b/Task/Arithmetic-Rational/ERRE/arithmetic-rational.erre new file mode 100644 index 0000000000..41f9c81a9c --- /dev/null +++ b/Task/Arithmetic-Rational/ERRE/arithmetic-rational.erre @@ -0,0 +1,96 @@ +PROGRAM RATIONAL_ARITH + +! +! for rosettacode.org +! + +TYPE RATIONAL=(NUM,DEN) + +DIM SUM:RATIONAL,ONE:RATIONAL,KF:RATIONAL + +DIM A:RATIONAL,B:RATIONAL +PROCEDURE ABS(A.->A.) + A.NUM=ABS(A.NUM) +END PROCEDURE + +PROCEDURE NEG(A.->A.) + A.NUM=-A.NUM +END PROCEDURE + +PROCEDURE ADD(A.,B.->A.) + LOCAL T + T=A.DEN*B.DEN + A.NUM=A.NUM*B.DEN+B.NUM*A.DEN + A.DEN=T +END PROCEDURE + +PROCEDURE SUB(A.,B.->A.) + LOCAL T + T=A.DEN*B.DEN + A.NUM=A.NUM*B.DEN-B.NUM*A.DEN + A.DEN=T +END PROCEDURE + +PROCEDURE MULT(A.,B.->A.) + A.NUM*=B.NUM A.DEN*=B.DEN +END PROCEDURE + +PROCEDURE DIVIDE(A.,B.->A.) + A.NUM*=B.DEN + A.DEN*=B.NUM +END PROCEDURE + +PROCEDURE EQ(A.,B.->RES%) + RES%=A.NUM*B.DEN=B.NUM*A.DEN +END PROCEDURE + +PROCEDURE LT(A.,B.->RES%) + RES%=A.NUM*B.DENRES%) + RES%=A.NUM*B.DEN>B.NUM*A.DEN +END PROCEDURE + +PROCEDURE NE(A.,B.->RES%) + RES%=A.NUM*B.DEN<>B.NUM*A.DEN +END PROCEDURE + +PROCEDURE LE(A.,B.->RES%) + RES%=A.NUM*B.DEN<=B.NUM*A.DEN +END PROCEDURE + +PROCEDURE GE(A.,B.->RES%) + RES%=A.NUM*B.DEN>=B.NUM*A.DEN +END PROCEDURE + +PROCEDURE NORMALIZE(A.->A.) + LOCAL A,B,T + A=A.NUM B=A.DEN + WHILE B<>0 DO + T=A + A=B + B=T-B*INT(T/B) + END WHILE + A.NUM/=A A.DEN/=A + IF A.DEN<0 THEN A.NUM*=-1 A.DEN*=-1 END IF +END PROCEDURE + +BEGIN + ONE.NUM=1 ONE.DEN=1 + FOR N=2 TO 2^19-1 DO + SUM.NUM=1 SUM.DEN=N + FOR K=2 TO SQR(N) DO + IF N=K*INT(N/K) THEN + KF.NUM=1 KF.DEN=K + ADD(SUM.,KF.->SUM.) + NORMALIZE(SUM.->SUM.) + KF.DEN=INT(N/K) + ADD(SUM.,KF.->SUM.) + NORMALIZE(SUM.->SUM.) + END IF + END FOR + EQ(SUM.,ONE.->RES%) + IF RES% THEN PRINT(N;" is perfect") END IF + END FOR +END PROGRAM diff --git a/Task/Arithmetic-Rational/EchoLisp/arithmetic-rational-1.echolisp b/Task/Arithmetic-Rational/EchoLisp/arithmetic-rational-1.echolisp new file mode 100644 index 0000000000..b9dac07f8d --- /dev/null +++ b/Task/Arithmetic-Rational/EchoLisp/arithmetic-rational-1.echolisp @@ -0,0 +1,6 @@ +;; Finding perfect numbers +(define (sum/inv n) ;; look for div's in [2..sqrt(n)] and add 1/n + (for/fold (acc (/ n)) [(i (in-range 2 (sqrt n)))] + #:break (> acc 1) ; no hope + (when (zero? (modulo n i )) + (set! acc (+ acc (/ i) (/ i n)))))) diff --git a/Task/Arithmetic-Rational/EchoLisp/arithmetic-rational-2.echolisp b/Task/Arithmetic-Rational/EchoLisp/arithmetic-rational-2.echolisp new file mode 100644 index 0000000000..e5c4d33423 --- /dev/null +++ b/Task/Arithmetic-Rational/EchoLisp/arithmetic-rational-2.echolisp @@ -0,0 +1,17 @@ +;; rational operations +(+ 1/42 1/666) → 59/2331 +42/666 → 7/111 +(expt 3/4 7) → 2187/16384 ; 3/4 ^7 +(/ 6 8) → 3/4 ;; / operator → rational +(// 6 8) → 0.75 ;; // operator → float +(* 6/7 14/12) → 1 + +;; even perfect numbers (up to 100000) +(for [(i (in-range 4 100000 2))] ;; 8 seconds + (when (= (sum/inv i) 1) + (printf "🍏 🍒 🍓 %d is perfect." i))) + +🍏 🍒 🍓 6 is perfect. +🍏 🍒 🍓 28 is perfect. +🍏 🍒 🍓 496 is perfect. +🍏 🍒 🍓 8128 is perfect. diff --git a/Task/Arithmetic-Rational/Lingo/arithmetic-rational-1.lingo b/Task/Arithmetic-Rational/Lingo/arithmetic-rational-1.lingo new file mode 100644 index 0000000000..53e17cb02e --- /dev/null +++ b/Task/Arithmetic-Rational/Lingo/arithmetic-rational-1.lingo @@ -0,0 +1,46 @@ +-- parent script "Frac" +property num +property denom + +---------------------------------------- +-- @constructor +-- @param {integer} numerator +-- @param {integer} [denominator=1] +---------------------------------------- +on new (me, numerator, denominator) + if voidP(denominator) then denominator = 1 + if denominator=0 then return VOID -- rule out division by zero + g = me._gcd(numerator, denominator) + if g<>0 then + numerator = numerator/g + denominator = denominator/g + else + numerator = 0 + denominator = 1 + end if + if denominator<0 then + numerator = -numerator + denominator = -denominator + end if + me.num = numerator + me.denom = denominator + return me +end + +---------------------------------------- +-- Returns string representation "/" +-- @return {string} +---------------------------------------- +on toString (me) + return me.num&"/"&me.denom +end + +---------------------------------------- +-- +---------------------------------------- +on _gcd (me, a, b) + if a = 0 then return b + if b = 0 then return a + if a > b then return me._gcd(b, a mod b) + return me._gcd(a, b mod a) +end diff --git a/Task/Arithmetic-Rational/Lingo/arithmetic-rational-2.lingo b/Task/Arithmetic-Rational/Lingo/arithmetic-rational-2.lingo new file mode 100644 index 0000000000..a6f182b59f --- /dev/null +++ b/Task/Arithmetic-Rational/Lingo/arithmetic-rational-2.lingo @@ -0,0 +1,83 @@ +-- Frac library (movie script) + +---------------------------------------- +-- Shortcut for creating 'frac' values +-- @param {integer} numerator +-- @param {integer} denominator +-- @return {instance} +---------------------------------------- +on frac (numerator, denominator) + return script("Frac").new(numerator, denominator) +end + +---------------------------------------- +-- All functions below this comment only support 'fracs', i.e. instances +-- of the Frac Class, as arguments. An integer n is casted to frac via frac(n). +---------------------------------------- + +-- Optionally supports more than 2 arguments +on fAdd (a, b) -- ... + res = a + repeat with i = 2 to the paramCount + p = param(i) + num = res.num * p.denom + res.denom * p.num + denom = res.denom * p.denom + res = frac(num, denom) + end repeat + return res +end + +on fSub (a, b) + return frac(a.num * b.den - a.den * b.num, a.den * b.den) +end + +-- Optionally supports more than 2 arguments +on fMul (a, b) -- ... + res = a + repeat with i = 2 to the paramCount + p = param(i) + res = frac(res.num * p.num, res.denom * p.denom) + end repeat + return res +end + +on fDiv (a, b) + return frac(a.num * b.denom, a.denom * b.num) +end + +on fAbs (f) + return frac(abs(f.num), f.denom) +end + +on fNeg (f) + return frac(-f.num, f.denom) +end + +on fEQ (a, b) + diff = fSub(a, b) + return diff.num=0 +end + +on fNE (a, b) + return not fEQ (a, b) +end + +on fGT (a, b) + diff = fSub(a, b) + return diff.num>0 +end + +on fLT (a, b) + diff = fSub(a, b) + return diff.num<0 +end + +on fGE (a, b) + diff = fSub(a, b) + return diff.num>=0 +end + +on fLE (a, b) + diff = fSub(a, b) + return diff.num<=0 +end diff --git a/Task/Arithmetic-Rational/Lingo/arithmetic-rational-3.lingo b/Task/Arithmetic-Rational/Lingo/arithmetic-rational-3.lingo new file mode 100644 index 0000000000..a7762ab4d3 --- /dev/null +++ b/Task/Arithmetic-Rational/Lingo/arithmetic-rational-3.lingo @@ -0,0 +1,13 @@ +f = frac(2,3) +put f.toString() +-- "2/3" + +-- fractions are normalized on the fly +f = frac(4,6) +put f.toString() +-- "2/3" + +-- casting integer to frac +f = frac(23) +put f.toString() +-- "23/1" diff --git a/Task/Arithmetic-Rational/Lingo/arithmetic-rational-4.lingo b/Task/Arithmetic-Rational/Lingo/arithmetic-rational-4.lingo new file mode 100644 index 0000000000..1897aa51fb --- /dev/null +++ b/Task/Arithmetic-Rational/Lingo/arithmetic-rational-4.lingo @@ -0,0 +1,15 @@ +-- in some movie script +---------------------------------------- +-- Prints all perfect numbers up to n +-- @param {integer|float} n +---------------------------------------- +on findPerfects (n) + repeat with i = 2 to n + sum = frac(1, i) + cnt = sqrt(i) + repeat with fac = 2 to cnt + if i mod fac = 0 then sum = fAdd(sum, frac(1, fac), frac(fac, i)) + end repeat + if sum.denom = sum.num then put i + end repeat +end diff --git a/Task/Arithmetic-Rational/Lingo/arithmetic-rational-5.lingo b/Task/Arithmetic-Rational/Lingo/arithmetic-rational-5.lingo new file mode 100644 index 0000000000..ead4d39058 --- /dev/null +++ b/Task/Arithmetic-Rational/Lingo/arithmetic-rational-5.lingo @@ -0,0 +1,5 @@ +findPerfects(power(2, 19)) +-- 6 +-- 28 +-- 496 +-- 8128 diff --git a/Task/Arithmetic-Rational/Nim/arithmetic-rational.nim b/Task/Arithmetic-Rational/Nim/arithmetic-rational.nim new file mode 100644 index 0000000000..dc00dd222f --- /dev/null +++ b/Task/Arithmetic-Rational/Nim/arithmetic-rational.nim @@ -0,0 +1,98 @@ +import math + +proc `^`[T](base, exp: T): T = + var (base, exp) = (base, exp) + result = 1 + + while exp != 0: + if (exp and 1) != 0: + result *= base + exp = exp shr 1 + base *= base + +proc gcd[T](u, v: T): T = + if v != 0: + gcd(v, u mod v) + else: + u.abs + +proc lcm[T](a, b: T): T = + a div gcd(a, b) * b + +type Rational* = tuple[num, den: int64] + +proc fromInt*(x: SomeInteger): Rational = + result.num = x + result.den = 1 + +proc frac*(x: var Rational) = + let common = gcd(x.num, x.den) + x.num = x.num div common + x.den = x.den div common + +proc `+` *(x, y: Rational): Rational = + let common = lcm(x.den, y.den) + result.num = common div x.den * x.num + common div y.den * y.num + result.den = common + result.frac + +proc `+=` *(x: var Rational, y: Rational) = + let common = lcm(x.den, y.den) + x.num = common div x.den * x.num + common div y.den * y.num + x.den = common + x.frac + +proc `-` *(x: Rational): Rational = + result.num = -x.num + result.den = x.den + +proc `-` *(x, y: Rational): Rational = + x + -y + +proc `-=` *(x: var Rational, y: Rational) = + x += -y + +proc `*` *(x, y: Rational): Rational = + result.num = x.num * y.num + result.den = x.den * y.den + result.frac + +proc `*=` *(x: var Rational, y: Rational) = + x.num *= y.num + x.den *= y.den + x.frac + +proc reciprocal*(x: Rational): Rational = + result.num = x.den + result.den = x.num + +proc `div`*(x, y: Rational): Rational = + x * y.reciprocal + +proc toFloat*(x: Rational): float = + x.num.float / x.den.float + +proc toInt*(x: Rational): int64 = + x.num div x.den + +proc cmp*(x, y: Rational): int = + cmp x.toFloat, y.toFloat + +proc `<` *(x, y: Rational): bool = + x.toFloat < y.toFloat + +proc `<=` *(x, y: Rational): bool = + x.toFloat <= y.toFloat + +proc abs*(x: Rational): Rational = + result.num = abs x.num + result.den = abs x.den + +for candidate in 2'i64 .. <((2'i64)^19): + var sum: Rational = (1'i64, candidate) + for factor in 2'i64 .. pow(candidate.float, 0.5).int64: + if candidate mod factor == 0: + sum += (1'i64, factor) + (1'i64, candidate div factor) + if sum.den == 1: + echo "Sum of recipr. factors of ",candidate," = ",sum.num," exactly ", + if sum.num == 1: "perfect!" else: "" diff --git a/Task/Arithmetic-Rational/Phix/arithmetic-rational.phix b/Task/Arithmetic-Rational/Phix/arithmetic-rational.phix new file mode 100644 index 0000000000..7e2ad0e83e --- /dev/null +++ b/Task/Arithmetic-Rational/Phix/arithmetic-rational.phix @@ -0,0 +1,106 @@ +without warning -- (several unused routines in this code) + +constant NUM = 1, DEN = 2 + +type frac(object r) + return sequence(r) and integer(r[NUM]) and integer(r[DEN]) and length(r)=2 +end type + +function normalise(object n, atom d=0) +atom g + if sequence(n) then + {n,d} = n + end if + if d<0 then + n = -n + d = -d + end if + g = gcd(n,d) + return {n/g,d/g} +end function + +function frac_new(integer n,d=1) + return normalise(n,d) +end function + +function frac_abs(frac r) + return {abs(r[NUM]),r[DEN]} +end function + +function frac_inv(frac r) + return reverse(r) +end function + +function frac_add(frac a, frac b) +integer {an,ad} = a, + {bn,bd} = b + return normalise(an*bd+bn*ad,ad*bd) +end function + +function frac_sub(frac a, frac b) +integer {an,ad} = a, + {bn,bd} = b + return normalise(an*bd-bn*ad,ad*bd) +end function + +function frac_mul(frac a, frac b) +integer {an,ad} = a, + {bn,bd} = b + return normalise(an*bn,ad*bd) +end function + +function frac_div(frac a, frac b) +integer {an,ad} = a, + {bn,bd} = b + return normalise(an*bd,ad*bn) +end function + +function frac_eq(frac a, frac b) + return a==b +end function + +function frac_ne(frac a, frac b) + return a!=b +end function + +function frac_lt(frac a, frac b) + return frac_sub(a,b)[NUM]<0 +end function + +function frac_gt(frac a, frac b) + return frac_sub(a,b)[NUM]>0 +end function + +function frac_le(frac a, frac b) + return frac_sub(a,b)[NUM]<=0 +end function + +function frac_ge(frac a, frac b) + return frac_sub(a,b)[NUM]>=0 +end function + +function is_perfect(integer num) +frac sum = frac_new(0) +sequence f = factors(num,1) + for i=1 to length(f) do + sum = frac_add(sum,frac_new(1,f[i])) + end for + return frac_eq(sum,frac_new(2)) +end function + +procedure get_perfect_numbers() +atom t0 = time() + for i=2 to power(2,19) do + if is_perfect(i) then + printf(1,"perfect: %d\n",i) + end if + end for + printf(1,"elapsed: %3.2f seconds\n",time()-t0) + + integer pn5 = power(2,12)*(power(2,13)-1) -- 5th perfect number + if is_perfect(pn5) then + printf(1,"perfect: %d\n",pn5) + end if +end procedure + +get_perfect_numbers() diff --git a/Task/Arithmetic-evaluation/ERRE/arithmetic-evaluation.erre b/Task/Arithmetic-evaluation/ERRE/arithmetic-evaluation.erre new file mode 100644 index 0000000000..0a85872219 --- /dev/null +++ b/Task/Arithmetic-evaluation/ERRE/arithmetic-evaluation.erre @@ -0,0 +1,233 @@ +PROGRAM EVAL + +! +! arithmetic expression evaluator +! + +!$KEY + +LABEL 98,100,110 + +DIM STACK$[50] + +PROCEDURE DISEGNA_STACK + !$RCODE="LOCATE 3,1" + !$RCODE="COLOR 0,7" + PRINT(TAB(35);"S T A C K";TAB(79);) + !$RCODE="COLOR 7,0" + FOR TT=1 TO 38 DO + IF TT>=20 THEN + !$RCODE="LOCATE 3+TT-19,40" + ELSE + !$RCODE="LOCATE 3+TT,1" + END IF + IF TT=NS THEN PRINT(">";) ELSE PRINT(" ";) END IF + PRINT(RIGHT$(STR$(TT),2);"³ ";STACK$[TT];" ") + END FOR + REPEAT + GET(Z$) + UNTIL LEN(Z$)<>0 +END PROCEDURE + +PROCEDURE COMPATTA_STACK + IF NS>1 THEN + R=1 + WHILE R=NS2 THEN GOTO 100 END IF + N1#=VAL(STACK$[L-1]) N2#=VAL(STACK$[L+1]) NOP=NOP-1 + IF STACK$[L]="^" THEN + RI#=N1#^N2# + END IF + STACK$[L-1]=STR$(RI#) + N=L + WHILE N<=NS2-2 DO + STACK$[N]=STACK$[N+2] + N=N+1 + END WHILE + NS2=NS2-2 + L=NS1-1 + END IF + L=L+1 + END WHILE + + L=NS1 + WHILE L<=NS2 DO + IF STACK$[L]="*" OR STACK$[L]="/" THEN + IF L>=NS2 THEN GOTO 100 END IF + N1#=VAL(STACK$[L-1]) N2#=VAL(STACK$[L+1]) NOP=NOP-1 + IF STACK$[L]="*" THEN RI#=N1#*N2# ELSE RI#=N1#/N2# END IF + STACK$[L-1]=STR$(RI#) + N=L + WHILE N<=NS2-2 DO + STACK$[N]=STACK$[N+2] + N=N+1 + END WHILE + NS2=NS2-2 + L=NS1-1 + END IF + L=L+1 + END WHILE + + L=NS1 + WHILE L<=NS2 DO + IF STACK$[L]="+" OR STACK$[L]="-" THEN + EXIT IF L>=NS2 + N1#=VAL(STACK$[L-1]) N2#=VAL(STACK$[L+1]) NOP=NOP-1 + IF STACK$[L]="+" THEN RI#=N1#+N2# ELSE RI#=N1#-N2# END IF + STACK$[L-1]=STR$(RI#) + N=L + WHILE N<=NS2-2 DO + STACK$[N]=STACK$[N+2] + N=N+1 + END WHILE + NS2=NS2-2 + L=NS1-1 + END IF + L=L+1 + END WHILE +100: + IF NOP<2 THEN ! operator priority + DB#=VAL(STACK$[NS1]) + ELSE + IF NOP<3 THEN + DB#=VAL(STACK$[NS1+2]) + ELSE + DB#=VAL(STACK$[NS1+4]) + END IF + END IF +END PROCEDURE + +PROCEDURE SVOLGI_PAR + NPA=NPA-1 + FOR J=NS TO 1 STEP -1 DO + EXIT IF STACK$[J]="(" + END FOR + IF J=0 THEN + NS1=1 NS2=NS CALC_ARITM + NERR=7 + ELSE + FOR R=J TO NS-1 DO + STACK$[R]=STACK$[R+1] + END FOR + NS1=J NS2=NS-1 CALC_ARITM + IF NS1=2 THEN NS1=1 STACK$[1]=STACK$[2] END IF + NS=NS1 + COMPATTA_STACK + END IF +END PROCEDURE + +BEGIN + OP_LIST$="+-*/^(" + NOP=0 NPA=0 NS=1 K$="" + STACK$[1]="@" ! init stack + + PRINT(CHR$(12);) + INPUT(LINE,EXPRESSION$) + + FOR W=1 TO LEN(EXPRESSION$) DO + LOOP + CODE=ASC(MID$(EXPRESSION$,W,1)) + IF (CODE>=48 AND CODE<=57) OR CODE=46 THEN + K$=K$+CHR$(CODE) + W=W+1 IF W>LEN(EXPRESSION$) THEN GOTO 98 END IF + ELSE + EXIT IF K$="" + IF NS>1 OR (NS=1 AND STACK$[1]<>"@") THEN NS=NS+1 END IF + IF FLAG=0 THEN STACK$[NS]=K$ ELSE STACK$[NS]=STR$(VAL(K$)*FLAG) END IF + K$="" FLAG=0 + EXIT + END IF + END LOOP + IF CODE=43 THEN K$="+" END IF + IF CODE=45 THEN K$="-" END IF + IF CODE=42 THEN K$="*" END IF + IF CODE=47 THEN K$="/" END IF + IF CODE=94 THEN K$="^" END IF + + CASE CODE OF + 43,45,42,47,94-> + IF MID$(EXPRESSION$,W+1,1)="-" THEN FLAG=-1 W=W+1 END IF + IF INSTR(OP_LIST$,STACK$[NS])<>0 THEN + NERR=5 + ELSE + NS=NS+1 STACK$[NS]=K$ NOP=NOP+1 + IF NOP>=2 THEN + FOR J=NS TO 1 STEP -1 DO + IF STACK$[J]<>"(" THEN + CONTINUE FOR + END IF + IF J + + 40-> + IF NS>1 OR (NS=1 AND STACK$[1]<>"@") THEN NS=NS+1 END IF + STACK$[NS]="(" NPA=NPA+1 + IF MID$(EXPRESSION$,W+1,1)="-" THEN FLAG=-1 W=W+1 END IF + END -> + + 41-> + SVOLGI_PAR + IF NERR=7 THEN + NERR=0 NOP=0 NPA=0 NS=1 + ELSE + IF NERR=0 OR NERR=1 THEN + DB#=VAL(STACK$[NS]) + REGISTRO_X#=DB# + ELSE + NOP=0 NPA=0 NS=1 + END IF + END IF + END -> + + OTHERWISE + NERR=8 + END CASE + K$="" + DISEGNA_STACK +END FOR + +98: + IF K$<>"" THEN + IF NS>1 OR (NS=1 AND STACK$[1]<>"@") THEN NS=NS+1 END IF + IF FLAG=0 THEN STACK$[NS]=K$ ELSE STACK$[NS]=STR$(VAL(K$)*FLAG) END IF + END IF + DISEGNA_STACK + IF INSTR(OP_LIST$,STACK$[NS])<>0 THEN + NERR=6 + ELSE + WHILE NPA<>0 DO + SVOLGI_PAR + END WHILE + IF NERR<>7 THEN NS1=1 NS2=NS CALC_ARITM END IF + END IF + NS=1 NOP=0 NPA=0 + !$RCODE="LOCATE 23,1" + IF NERR>0 THEN PRINT("Internal Error #";NERR) ELSE PRINT("Value is ";DB#) END IF +END PROGRAM diff --git a/Task/Arithmetic-evaluation/FreeBASIC/arithmetic-evaluation.freebasic b/Task/Arithmetic-evaluation/FreeBASIC/arithmetic-evaluation.freebasic new file mode 100644 index 0000000000..c57ff93980 --- /dev/null +++ b/Task/Arithmetic-evaluation/FreeBASIC/arithmetic-evaluation.freebasic @@ -0,0 +1,195 @@ +'Arithmetic evaluation +' +'Create a program which parses and evaluates arithmetic expressions. +' +'Requirements +' +' * An abstract-syntax tree (AST) for the expression must be created from parsing the +' input. +' * The AST must be used in evaluation, also, so the input may not be directly evaluated +' (e.g. by calling eval or a similar language feature.) +' * The expression will be a string or list of symbols like "(1+3)*7". +' * The four symbols + - * / must be supported as binary operators with conventional +' precedence rules. +' * Precedence-control parentheses must also be supported. +' +'Standard mathematical precedence should be followed: +' +' Parentheses +' Multiplication/Division (left to right) +' Addition/Subtraction (left to right) +' +' test cases: +' 2*-3--4+-0.25 : returns -2.25 +' 1 + 2 * (3 + (4 * 5 + 6 * 7 * 8) - 9) / 10 : returns 71 + +enum + false = 0 + true = -1 +end enum + +enum Symbol + unknown_sym + minus_sym + plus_sym + lparen_sym + rparen_sym + number_sym + mul_sym + div_sym + unary_minus_sym + unary_plus_sym + done_sym + eof_sym +end enum + +type Tree + as Tree ptr leftp, rightp + op as Symbol + value as double +end type + +dim shared sym as Symbol +dim shared tokenval as double +dim shared usr_input as string + +declare function expr(byval p as integer) as Tree ptr + +function isdigit(byval ch as string) as long + return ch <> "" and Asc(ch) >= Asc("0") and Asc(ch) <= Asc("9") +end function + +sub error_msg(byval msg as string) + print msg + system +end sub + +' tokenize the input string +sub getsym() + do + if usr_input = "" then + line input usr_input + usr_input += chr(10) + endif + dim as string ch = mid(usr_input, 1, 1) ' get the next char + usr_input = mid(usr_input, 2) ' remove it from input + + sym = unknown_sym + select case ch + case " ": continue do + case chr(10), "": sym = done_sym: return + case "+": sym = plus_sym: return + case "-": sym = minus_sym: return + case "*": sym = mul_sym: return + case "/": sym = div_sym: return + case "(": sym = lparen_sym: return + case ")": sym = rparen_sym: return + case else + if isdigit(ch) then + dim s as string = "" + dim dot as integer = 0 + do + s += ch + if ch = "." then dot += 1 + ch = mid(usr_input, 1, 1) ' get the next char + usr_input = mid(usr_input, 2) ' remove it from input + loop while isdigit(ch) orelse ch = "." + if ch = "." or dot > 1 then error_msg("bogus number") + usr_input = ch + usr_input ' prepend the char to input + tokenval = val(s) + sym = number_sym + end if + return + end select + loop +end sub + +function make_node(byval op as Symbol, byval leftp as Tree ptr, byval rightp as Tree ptr) as Tree ptr + dim t as Tree ptr + + t = callocate(len(Tree)) + t->op = op + t->leftp = leftp + t->rightp = rightp + return t +end function + +function is_binary(byval op as Symbol) as integer + select case op + case mul_sym, div_sym, plus_sym, minus_sym: return true + case else: return false + end select +end function + +function prec(byval op as Symbol) as integer + select case op + case unary_minus_sym, unary_plus_sym: return 100 + case mul_sym, div_sym: return 90 + case plus_sym, minus_sym: return 80 + case else: return 0 + end select +end function + +function primary as Tree ptr + dim t as Tree ptr = 0 + + select case sym + case minus_sym, plus_sym + dim op as Symbol = sym + getsym() + t = expr(prec(unary_minus_sym)) + if op = minus_sym then return make_node(unary_minus_sym, t, 0) + if op = plus_sym then return make_node(unary_plus_sym, t, 0) + case lparen_sym + getsym() + t = expr(0) + if sym <> rparen_sym then error_msg("expecting rparen") + getsym() + return t + case number_sym + t = make_node(sym, 0, 0) + t->value = tokenval + getsym() + return t + case else: error_msg("expecting a primary") + end select +end function + +function expr(byval p as integer) as Tree ptr + dim t as Tree ptr = primary() + + while is_binary(sym) andalso prec(sym) >= p + dim t1 as Tree ptr + dim op as Symbol = sym + getsym() + t1 = expr(prec(op) + 1) + t = make_node(op, t, t1) + wend + return t +end function + +function eval(byval t as Tree ptr) as double + if t <> 0 then + select case t->op + case minus_sym: return eval(t->leftp) - eval(t->rightp) + case plus_sym: return eval(t->leftp) + eval(t->rightp) + case mul_sym: return eval(t->leftp) * eval(t->rightp) + case div_sym: return eval(t->leftp) / eval(t->rightp) + case unary_minus_sym: return -eval(t->leftp) + case unary_plus_sym: return eval(t->leftp) + case number_sym: return t->value + case else: error_msg("unexpected tree node") + end select + end if + return 0 +end function + +do + getsym() + if sym = eof_sym then exit do + if sym = done_sym then continue do + dim t as Tree ptr = expr(0) + print"> "; eval(t) + if sym = eof_sym then exit do + if sym <> done_sym then error_msg("unexpected input") +loop diff --git a/Task/Arithmetic-evaluation/Phix/arithmetic-evaluation.phix b/Task/Arithmetic-evaluation/Phix/arithmetic-evaluation.phix new file mode 100644 index 0000000000..5eb43e2884 --- /dev/null +++ b/Task/Arithmetic-evaluation/Phix/arithmetic-evaluation.phix @@ -0,0 +1,218 @@ +sequence opstack = {} -- atom elements are literals, + -- sequence elements are subexpressions + -- on completion length(opstack) should be 1 +object token + +constant op_p_p = 0 -- 1: expressions stored as op,p1,p2 + -- p_op_p -- 0: expressions stored as p1,op,p2 + -- p_p_op -- -1: expressions stored as p1,p2,op + +object op = 0 -- 0 if none, else "+", "-", "*", "/", "^", "%", or "u-" + +string s -- the expression being parsed +integer ch +integer sidx + +procedure err(string msg) + printf(1,"%s\n%s^ %s\n\nPressEnter...",{s,repeat(' ',sidx-1),msg}) + {} = wait_key() + abort(0) +end procedure + +procedure nxtch(object msg="eof") + sidx += 1 + if sidx>length(s) then + if string(msg) then err(msg) end if + ch = -1 + else + ch = s[sidx] + end if +end procedure + +procedure skipspaces() + while find(ch," \t\r\n")!=0 do nxtch(0) end while +end procedure + +procedure get_token() +atom n, fraction +integer dec + skipspaces() + if ch=-1 then token = "eof" return end if + if ch>='0' and ch<='9' then + n = ch-'0' + while 1 do + nxtch(0) + if ch<'0' or ch>'9' then exit end if + n = n*10+ch-'0' + end while + if ch='.' then + dec = 1 + fraction = 0 + while 1 do + nxtch(0) + if ch<'0' or ch>'9' then exit end if + fraction = fraction*10 + ch-'0' + dec *= 10 + end while + n += fraction/dec + end if +-- if find(ch,"eE") then -- you get the idea +-- end if + token = n + return + end if + if find(ch,"+-/*()^%")=0 then err("syntax error") end if + token = s[sidx..sidx] + nxtch(0) + return +end procedure + +procedure Match(string t) + if token!=t then err(t&" expected") end if + get_token() +end procedure + +procedure PopFactor() +object p2 = opstack[$] + if op="u-" then + if op_p_p=1 then -- op_p_p + opstack[$] = {op,0,p2} + elsif op_p_p=0 then -- p_op_p + opstack[$] = {0,op,p2} + else -- -1 -- p_p_op + opstack[$] = {0,p2,op} + end if + else + opstack = opstack[1..$-1] + if op_p_p=1 then -- op_p_p + opstack[$] = {op,opstack[$],p2} + elsif op_p_p=0 then -- p_op_p + opstack[$] = {opstack[$],op,p2} + else -- -1 -- p_p_op + opstack[$] = {opstack[$],p2,op} + end if + end if + op = 0 +end procedure + +procedure PushFactor(atom t) + if op!=0 then PopFactor() end if + opstack = append(opstack,t) +end procedure + +procedure PushOp(string t) + if op!=0 then PopFactor() end if + op = t +end procedure + +procedure Factor() + if atom(token) then + PushFactor(token) + if ch!=-1 then + get_token() + end if + elsif token="-" then + get_token() +-- Factor() + Expr(3) -- makes "-3^2" yield -9 (ie -(3^2)) not 9 (ie (-3)^2). + if op!=0 then PopFactor() end if + if integer(opstack[$]) then + opstack[$] = -opstack[$] + else + PushOp("u-") + end if + elsif token="(" then + get_token() + Expr(0) + Match(")") + elsif token="+" then -- (ignore) + nxtch() + Factor() + else + err("syntax error") + end if +end procedure + +constant {operators, + precedence, + associativity} = columnize({{"^",3,0}, + {"%",2,1}, + {"*",2,1}, + {"/",2,1}, + {"+",1,1}, + {"-",1,1}, + $}) + +procedure Expr(integer p) +-- +-- Parse an expression, using precedence climbing. +-- +-- p is the precedence level we should parse to, eg/ie +-- 4: Factor only (may as well just call Factor) +-- 3: "" and ^ +-- 2: "" and *,/,% +-- 1: "" and +,- +-- 0: full expression (effectively the same as 1) +-- obviously, parentheses override any setting of p. +-- +integer k, thisp + Factor() + while 1 do + k = find(token,operators) -- *,/,+,- + if k=0 then exit end if + thisp = precedence[k] + if thisp

5], + ['-4-3' => -7], + ['-+2+3/4' => -1.25], + ['2*3-4' => 2], + ['2*(3+4)+2/4' => 2/4 + 14], + ['2*-3--4+-0.25' => -2.25], + ['2 * (3 + (4 * 5 + (6 * 7) * 8) - 9) * 10' => 7000], +] {  + var num = evalArithmeticExp(expr); + assert_eq(num, res); + "%-45s == %10g\n".printf(expr, num); +} diff --git a/Task/Arithmetic-geometric-mean-Calculate-Pi/Phix/arithmetic-geometric-mean-calculate-pi.phix b/Task/Arithmetic-geometric-mean-Calculate-Pi/Phix/arithmetic-geometric-mean-calculate-pi.phix new file mode 100644 index 0000000000..e03a1905d1 --- /dev/null +++ b/Task/Arithmetic-geometric-mean-Calculate-Pi/Phix/arithmetic-geometric-mean-calculate-pi.phix @@ -0,0 +1,20 @@ +include bigatom.e + +{} = scale(203) +bigatom a = BA_ONE, + n = BA_ONE, + g = ba_divide(BA_ONE,ba_sqrt(2)), + z = ba_new(0.25), + half = ba_new(0.5), + x1, x2, var +for i=1 to 18 do +?i + x1 = ba_multiply(ba_add(a,g),half) + x2 = ba_sqrt(ba_multiply(a,g)) + var = ba_sub(x1,a) + z = ba_sub(z,ba_multiply(ba_multiply(var,var),n)) + n = ba_add(n,n) + a = x1 + g = x2 +end for +ba_printf(1,"%.200aB\n",ba_divide(ba_multiply(a,a),z)) diff --git a/Task/Arithmetic-geometric-mean-Calculate-Pi/Sidef/arithmetic-geometric-mean-calculate-pi.sidef b/Task/Arithmetic-geometric-mean-Calculate-Pi/Sidef/arithmetic-geometric-mean-calculate-pi.sidef new file mode 100644 index 0000000000..9659c70eec --- /dev/null +++ b/Task/Arithmetic-geometric-mean-Calculate-Pi/Sidef/arithmetic-geometric-mean-calculate-pi.sidef @@ -0,0 +1,23 @@ +func agm_pi(digits) { + var acc = (digits + 8); + + local Num!PREC = 4*digits; + + var an = 1; + var bn = sqrt(0.5); + var tn = 0.5**2; + var pn = 1; + + while (pn < acc) { + var prev_an = an; + an = (bn+an / 2); + bn = sqrt(bn * prev_an); + prev_an -= an; + tn -= (pn * prev_an**2); + pn *= 2; + } + + ((an+bn)**2 / 4*tn).to_s +} + +say agm_pi(100); diff --git a/Task/Arithmetic-geometric-mean/ERRE/arithmetic-geometric-mean.erre b/Task/Arithmetic-geometric-mean/ERRE/arithmetic-geometric-mean.erre new file mode 100644 index 0000000000..19e943c2ef --- /dev/null +++ b/Task/Arithmetic-geometric-mean/ERRE/arithmetic-geometric-mean.erre @@ -0,0 +1,21 @@ +PROGRAM AGM + +! +! for rosettacode.org +! + +!$DOUBLE + +PROCEDURE AGM(A,G->A) + LOCAL TA + REPEAT + TA=A + A=(A+G)/2 + G=SQR(TA*G) + UNTIL A=TA +END PROCEDURE + +BEGIN + AGM(1.0,1/SQR(2)->A) + PRINT(A) +END PROGRAM diff --git a/Task/Arithmetic-geometric-mean/EchoLisp/arithmetic-geometric-mean.echolisp b/Task/Arithmetic-geometric-mean/EchoLisp/arithmetic-geometric-mean.echolisp new file mode 100644 index 0000000000..3b0f9a4bf2 --- /dev/null +++ b/Task/Arithmetic-geometric-mean/EchoLisp/arithmetic-geometric-mean.echolisp @@ -0,0 +1,14 @@ +(lib 'math) + +(define (agm a g) + (if (~= a g) a + (agm (// (+ a g ) 2) (sqrt (* a g))))) + +(math-precision) + → 0.000001 ;; default +(agm 1 (/ 1 (sqrt 2))) + → 0.8472130848351929 +(math-precision 1.e-15) + → 1e-15 +(agm 1 (/ 1 (sqrt 2))) + → 0.8472130847939792 diff --git a/Task/Arithmetic-geometric-mean/FreeBASIC/arithmetic-geometric-mean.freebasic b/Task/Arithmetic-geometric-mean/FreeBASIC/arithmetic-geometric-mean.freebasic new file mode 100644 index 0000000000..6b92859e0c --- /dev/null +++ b/Task/Arithmetic-geometric-mean/FreeBASIC/arithmetic-geometric-mean.freebasic @@ -0,0 +1,26 @@ +' version 16-09-2015 +' compile with: fbc -s console + +Function agm(a As Double, g As Double) As Double + + Dim As Double t_a + + Do + t_a = (a + g) / 2 + g = Sqr(a * g) + Swap a, t_a + Loop Until a = t_a + + Return a + +End Function + +' ------=< MAIN >=------ + +Print agm(1, 1 / Sqr(2) ) + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Arithmetic-geometric-mean/Futhark/arithmetic-geometric-mean.futhark b/Task/Arithmetic-geometric-mean/Futhark/arithmetic-geometric-mean.futhark new file mode 100644 index 0000000000..ccb89b197c --- /dev/null +++ b/Task/Arithmetic-geometric-mean/Futhark/arithmetic-geometric-mean.futhark @@ -0,0 +1,6 @@ +fun agm(a: f64, g: f64): f64 = + let eps = 1.0E-16 + loop ((a,g)) = while abs(a-g) > eps do + ((a+g) / 2.0, + sqrt64 (a*g)) + in a diff --git a/Task/Arithmetic-geometric-mean/LFE/arithmetic-geometric-mean.lfe b/Task/Arithmetic-geometric-mean/LFE/arithmetic-geometric-mean.lfe new file mode 100644 index 0000000000..0231cadb99 --- /dev/null +++ b/Task/Arithmetic-geometric-mean/LFE/arithmetic-geometric-mean.lfe @@ -0,0 +1,15 @@ +(defun agm (a g) + (agm a g 1.0e-15)) + +(defun agm (a g tol) + (if (=< (- a g) tol) + a + (agm (next-a a g) + (next-g a g) + tol))) + +(defun next-a (a g) + (/ (+ a g) 2)) + +(defun next-g (a g) + (math:sqrt (* a g))) diff --git a/Task/Arithmetic-geometric-mean/LiveCode/arithmetic-geometric-mean-1.livecode b/Task/Arithmetic-geometric-mean/LiveCode/arithmetic-geometric-mean-1.livecode new file mode 100644 index 0000000000..a66c064999 --- /dev/null +++ b/Task/Arithmetic-geometric-mean/LiveCode/arithmetic-geometric-mean-1.livecode @@ -0,0 +1,13 @@ +function agm aa,g + put abs(aa-g) into absdiff + put (aa+g)/2 into aan + put sqrt(aa*g) into gn + repeat while abs(aan - gn) < absdiff + put abs(aa-g) into absdiff + put (aa+g)/2 into aan + put sqrt(aa*g) into gn + put aan into aa + put gn into g + end repeat + return aa +end agm diff --git a/Task/Arithmetic-geometric-mean/LiveCode/arithmetic-geometric-mean-2.livecode b/Task/Arithmetic-geometric-mean/LiveCode/arithmetic-geometric-mean-2.livecode new file mode 100644 index 0000000000..f1d0c4191f --- /dev/null +++ b/Task/Arithmetic-geometric-mean/LiveCode/arithmetic-geometric-mean-2.livecode @@ -0,0 +1,3 @@ +put agm(1, 1/sqrt(2)) +-- ouput +-- 0.847213 diff --git a/Task/Arithmetic-geometric-mean/Nim/arithmetic-geometric-mean-1.nim b/Task/Arithmetic-geometric-mean/Nim/arithmetic-geometric-mean-1.nim new file mode 100644 index 0000000000..dcc5f0f4ad --- /dev/null +++ b/Task/Arithmetic-geometric-mean/Nim/arithmetic-geometric-mean-1.nim @@ -0,0 +1,14 @@ +import math + +proc agm(a, g: float,delta: float = 1.0e-15): float = + var + aNew: float = 0 + aOld: float = a + gOld: float = g + while (abs(aOld - gOld) > delta): + aNew = 0.5 * (aOld + gOld) + gOld = sqrt(aOld * gOld) + aOld = aNew + result = aOld + +echo ($agm(1.0,1.0/sqrt(2))) diff --git a/Task/Arithmetic-geometric-mean/Nim/arithmetic-geometric-mean-2.nim b/Task/Arithmetic-geometric-mean/Nim/arithmetic-geometric-mean-2.nim new file mode 100644 index 0000000000..2f192cd8ca --- /dev/null +++ b/Task/Arithmetic-geometric-mean/Nim/arithmetic-geometric-mean-2.nim @@ -0,0 +1,20 @@ +from math import sqrt +from strutils import parseFloat, formatFloat, ffDecimal + +proc agm(x,y: float): tuple[resA,resG: float] = + var + a,g: array[0 .. 23,float] + + a[0] = x + g[0] = y + + for n in 1 .. 23: + a[n] = 0.5 * (a[n - 1] + g[n - 1]) + g[n] = sqrt(a[n - 1] * g[n - 1]) + + (a[23], g[23]) + +var t = agm(1, 1/sqrt(2)) + +echo("Result A: " & formatFloat(t.resA, ffDecimal, 24)) +echo("Result G: " & formatFloat(t.resG, ffDecimal, 24)) diff --git a/Task/Arithmetic-geometric-mean/Oforth/arithmetic-geometric-mean-1.oforth b/Task/Arithmetic-geometric-mean/Oforth/arithmetic-geometric-mean-1.oforth new file mode 100644 index 0000000000..cf897d86c9 --- /dev/null +++ b/Task/Arithmetic-geometric-mean/Oforth/arithmetic-geometric-mean-1.oforth @@ -0,0 +1 @@ +: agm while(2dup <>) [ 2dup + 2 / tor * sqrt ] drop ; diff --git a/Task/Arithmetic-geometric-mean/Oforth/arithmetic-geometric-mean-2.oforth b/Task/Arithmetic-geometric-mean/Oforth/arithmetic-geometric-mean-2.oforth new file mode 100644 index 0000000000..856ebf338e --- /dev/null +++ b/Task/Arithmetic-geometric-mean/Oforth/arithmetic-geometric-mean-2.oforth @@ -0,0 +1 @@ +1 2 sqrt inv agm diff --git a/Task/Arithmetic-geometric-mean/Phix/arithmetic-geometric-mean.phix b/Task/Arithmetic-geometric-mean/Phix/arithmetic-geometric-mean.phix new file mode 100644 index 0000000000..f8b0e09de9 --- /dev/null +++ b/Task/Arithmetic-geometric-mean/Phix/arithmetic-geometric-mean.phix @@ -0,0 +1,8 @@ +function agm(atom a, atom g, atom tolerance=1.0e-15) + while abs(a-g)>tolerance do + {a,g} = {(a + g)/2,sqrt(a*g)} + printf(1,"%0.15g\n",a) + end while + return a +end function +?agm(1,1/sqrt(2)) -- (rounds to 10 d.p.) diff --git a/Task/Arithmetic-geometric-mean/Potion/arithmetic-geometric-mean.potion b/Task/Arithmetic-geometric-mean/Potion/arithmetic-geometric-mean.potion new file mode 100644 index 0000000000..e756775c39 --- /dev/null +++ b/Task/Arithmetic-geometric-mean/Potion/arithmetic-geometric-mean.potion @@ -0,0 +1,17 @@ +sqrt = (x) : + xi = 1 + 7 times : + xi = (xi + x / xi) / 2 + . + xi +. + +agm = (x, y) : + 7 times : + a = (x + y) / 2 + g = sqrt(x * y) + x = a + y = g + . + x +. diff --git a/Task/Arithmetic-geometric-mean/Ring/arithmetic-geometric-mean.ring b/Task/Arithmetic-geometric-mean/Ring/arithmetic-geometric-mean.ring new file mode 100644 index 0000000000..7b3aecd3d5 --- /dev/null +++ b/Task/Arithmetic-geometric-mean/Ring/arithmetic-geometric-mean.ring @@ -0,0 +1,13 @@ +decimals(9) +see agm(1, 1/sqrt(2)) + nl +see agm(1,1/pow(2,0.5)) + nl + +func agm agm,g + while agm + an = (agm + g)/2 + gn = sqrt(agm*g) + if fabs(agm-g) <= fabs(an-gn) exit ok + agm = an + g = gn + end + return gn diff --git a/Task/Arithmetic-geometric-mean/Sidef/arithmetic-geometric-mean.sidef b/Task/Arithmetic-geometric-mean/Sidef/arithmetic-geometric-mean.sidef new file mode 100644 index 0000000000..da7db80329 --- /dev/null +++ b/Task/Arithmetic-geometric-mean/Sidef/arithmetic-geometric-mean.sidef @@ -0,0 +1,9 @@ +func agm(a, g) { + loop { + var x = [float(a+g / 2), sqrt(a*g)] + x == [a, g] && return a + x >> \(a, g) + } +} + +say agm(1, 1/sqrt(2)) diff --git a/Task/Arithmetic-geometric-mean/jq/arithmetic-geometric-mean-1.jq b/Task/Arithmetic-geometric-mean/jq/arithmetic-geometric-mean-1.jq new file mode 100644 index 0000000000..4d5df81971 --- /dev/null +++ b/Task/Arithmetic-geometric-mean/jq/arithmetic-geometric-mean-1.jq @@ -0,0 +1,9 @@ +def naive_agm(a; g; tolerance): + def abs: if . < 0 then -. else . end; + def _agm: + # state [an,gn] + if ((.[0] - .[1])|abs) > tolerance + then [add/2, ((.[0] * .[1])|sqrt)] | _agm + else . + end; + [a, g] | _agm | .[0] ; diff --git a/Task/Arithmetic-geometric-mean/jq/arithmetic-geometric-mean-2.jq b/Task/Arithmetic-geometric-mean/jq/arithmetic-geometric-mean-2.jq new file mode 100644 index 0000000000..670a910080 --- /dev/null +++ b/Task/Arithmetic-geometric-mean/jq/arithmetic-geometric-mean-2.jq @@ -0,0 +1,16 @@ +def agm(a; g; tolerance): + def abs: if . < 0 then -. else . end; + def _agm: + # state [an,gn, delta] + ((.[0] - .[1])|abs) as $delta + | if $delta == .[2] and $delta < 10e-16 then . + elif $delta > tolerance + then [ .[0:2]|add / 2, ((.[0] * .[1])|sqrt), $delta] | _agm + else . + end; + if tolerance <= 0 then error("specified tolerance must be > 0") + else [a, g, 0] | _agm | .[0] + end ; + +# Example: +agm(1; 1/(2|sqrt); 1e-100) diff --git a/Task/Array-concatenation/AntLang/array-concatenation.antlang b/Task/Array-concatenation/AntLang/array-concatenation.antlang new file mode 100644 index 0000000000..64d32e6139 --- /dev/null +++ b/Task/Array-concatenation/AntLang/array-concatenation.antlang @@ -0,0 +1,3 @@ +a:<1; <2; 3>> +b: <"Hello"; 42> +c: a,b diff --git a/Task/Array-concatenation/Apex/array-concatenation.apex b/Task/Array-concatenation/Apex/array-concatenation.apex new file mode 100644 index 0000000000..0551662a18 --- /dev/null +++ b/Task/Array-concatenation/Apex/array-concatenation.apex @@ -0,0 +1,4 @@ +List listA = new List { 'apple' }; +List listB = new List { 'banana' }; +listA.addAll(listB); +System.debug(listA); // Prints (apple, banana) diff --git a/Task/Array-concatenation/Ceylon/array-concatenation.ceylon b/Task/Array-concatenation/Ceylon/array-concatenation.ceylon new file mode 100644 index 0000000000..971bef4f1d --- /dev/null +++ b/Task/Array-concatenation/Ceylon/array-concatenation.ceylon @@ -0,0 +1,6 @@ +shared void arrayConcatenation() { + value a = Array {1, 2, 3}; + value b = Array {4, 5, 6}; + value c = concatenate(a, b); + print(c); +} diff --git a/Task/Array-concatenation/ECL/array-concatenation.ecl b/Task/Array-concatenation/ECL/array-concatenation.ecl new file mode 100644 index 0000000000..cd1479609e --- /dev/null +++ b/Task/Array-concatenation/ECL/array-concatenation.ecl @@ -0,0 +1,4 @@ + A := [1, 2, 3, 4]; + B := [5, 6, 7, 8]; + + C := A + B; diff --git a/Task/Array-concatenation/ERRE/array-concatenation.erre b/Task/Array-concatenation/ERRE/array-concatenation.erre new file mode 100644 index 0000000000..b175303cec --- /dev/null +++ b/Task/Array-concatenation/ERRE/array-concatenation.erre @@ -0,0 +1,31 @@ +PROGRAM ARRAY_CONCAT + +DIM A[5],B[5],C[10] + +! +! for rosettacode.org +! + +BEGIN + DATA(1,2,3,4,5) + DATA(6,7,8,9,0) + + FOR I=1 TO 5 DO ! read array A[.] + READ(A[I]) + END FOR + FOR I=1 TO 5 DO ! read array B[.] + READ(B[I]) + END FOR + + FOR I=1 TO 10 DO ! append B[.] to A[.] + IF I>5 THEN + C[I]=B[I-5] + ELSE + C[I]=A[I] + END IF + PRINT(C[I];) ! print single C value + END FOR + + PRINT + +END PROGRAM diff --git a/Task/Array-concatenation/EchoLisp/array-concatenation.echolisp b/Task/Array-concatenation/EchoLisp/array-concatenation.echolisp new file mode 100644 index 0000000000..0b37da134e --- /dev/null +++ b/Task/Array-concatenation/EchoLisp/array-concatenation.echolisp @@ -0,0 +1,12 @@ +;;;; VECTORS +(vector-append (make-vector 6 42) (make-vector 4 666)) + → #( 42 42 42 42 42 42 666 666 666 666) + +;;;; LISTS +(append (iota 5) (iota 6)) + → (0 1 2 3 4 0 1 2 3 4 5) + +;; NB - append may also be used with sequences (lazy lists) +(lib 'sequences) + (take (append [1 .. 7] [7 6 .. 0]) #:all) + → (1 2 3 4 5 6 7 6 5 4 3 2 1) diff --git a/Task/Array-concatenation/Elm/array-concatenation.elm b/Task/Array-concatenation/Elm/array-concatenation.elm new file mode 100644 index 0000000000..bebfc008b1 --- /dev/null +++ b/Task/Array-concatenation/Elm/array-concatenation.elm @@ -0,0 +1,19 @@ +import Element exposing (show, toHtml) -- elm-package install evancz/elm-graphics +import Html.App exposing (beginnerProgram) +import Array exposing (Array, append, initialize) + + +xs : Array Int +xs = + initialize 3 identity -- [0, 1, 2] + +ys : Array Int +ys = + initialize 3 <| (+) 3 -- [3, 4, 5] + +main = beginnerProgram { model = () + , view = \_ -> toHtml (show (append xs ys)) + , update = \_ _ -> () + } + +-- Array.fromList [0,1,2,3,4,5] diff --git a/Task/Array-concatenation/FreeBASIC/array-concatenation.freebasic b/Task/Array-concatenation/FreeBASIC/array-concatenation.freebasic new file mode 100644 index 0000000000..2f67fe40df --- /dev/null +++ b/Task/Array-concatenation/FreeBASIC/array-concatenation.freebasic @@ -0,0 +1,26 @@ +' FB 1.05.0 Win64 + +Sub ConcatArrays(a() As String, b() As String, c() As String) + Dim aSize As Integer = UBound(a) - LBound(a) + 1 + Dim bSize As Integer = UBound(b) - LBound(b) + 1 + Dim cSize As Integer = aSize + bSize + Redim c(0 To cSize - 1) + Dim i As Integer + For i = 0 To aSize - 1 + c(i) = a(LBound(a) + i) + Next + For i = 0 To bSize - 1 + c(UBound(a) + i + 1) = b(LBound(b) + i) + Next +End Sub + +Dim a(3) As String = {"The", "quick", "brown", "fox"} +Dim b(4) As String = {"jumped", "over", "the", "lazy", "dog"} +Dim c() As String +ConcatArrays(a(), b(), c()) +For i As Integer = LBound(c) To UBound(c) + Print c(i); " "; +Next +Print : Print +Print "Press any key to quit the program" +Sleep diff --git a/Task/Array-concatenation/FunL/array-concatenation.funl b/Task/Array-concatenation/FunL/array-concatenation.funl new file mode 100644 index 0000000000..02c5baaad2 --- /dev/null +++ b/Task/Array-concatenation/FunL/array-concatenation.funl @@ -0,0 +1,5 @@ +arr1 = array( [1, 2, 3] ) +arr2 = array( [4, 5, 6] ) +arr3 = array( [7, 8, 9] ) + +println( arr1 + arr2 + arr3 ) diff --git a/Task/Array-concatenation/Futhark/array-concatenation.futhark b/Task/Array-concatenation/Futhark/array-concatenation.futhark new file mode 100644 index 0000000000..5b10455351 --- /dev/null +++ b/Task/Array-concatenation/Futhark/array-concatenation.futhark @@ -0,0 +1 @@ +concat as bs cd diff --git a/Task/Array-concatenation/I/array-concatenation.i b/Task/Array-concatenation/I/array-concatenation.i new file mode 100644 index 0000000000..5c6d1f13aa --- /dev/null +++ b/Task/Array-concatenation/I/array-concatenation.i @@ -0,0 +1,6 @@ +software { + var a = [1, 2, 3] + var b = [4, 5, 6] + + print(a + b) +} diff --git a/Task/Array-concatenation/LFE/array-concatenation.lfe b/Task/Array-concatenation/LFE/array-concatenation.lfe new file mode 100644 index 0000000000..9047497ba1 --- /dev/null +++ b/Task/Array-concatenation/LFE/array-concatenation.lfe @@ -0,0 +1,4 @@ +> (++ '(1 2 3) '(4 5 6)) +(1 2 3 4 5 6) +> (: lists append '(1 2 3) '(4 5 6)) +(1 2 3 4 5 6) diff --git a/Task/Array-concatenation/Lasso/array-concatenation.lasso b/Task/Array-concatenation/Lasso/array-concatenation.lasso new file mode 100644 index 0000000000..a9732188a2 --- /dev/null +++ b/Task/Array-concatenation/Lasso/array-concatenation.lasso @@ -0,0 +1,12 @@ +local(arr1 = array(1, 2, 3)) +local(arr2 = array(4, 5, 6)) +local(arr3 = #arr1->asCopy) // make arr3 a copy of arr2 +#arr3->merge(#arr2) // concatenate 2 arrays + + +Result: + +arr1 = array(1, 2, 3) +arr2 = array(4, 5, 6) +arr3 = array(4, 5, 6) +arr3 = array(1, 2, 3, 4, 5, 6) diff --git a/Task/Array-concatenation/Lingo/array-concatenation.lingo b/Task/Array-concatenation/Lingo/array-concatenation.lingo new file mode 100644 index 0000000000..56f55c91b6 --- /dev/null +++ b/Task/Array-concatenation/Lingo/array-concatenation.lingo @@ -0,0 +1,9 @@ +a = [1,2] +b = [3,4,5] + +repeat with v in b + a.append(v) +end repeat + +put a +-- [1, 2, 3, 4, 5] diff --git a/Task/Array-concatenation/Nim/array-concatenation-1.nim b/Task/Array-concatenation/Nim/array-concatenation-1.nim new file mode 100644 index 0000000000..7b20bf0b18 --- /dev/null +++ b/Task/Array-concatenation/Nim/array-concatenation-1.nim @@ -0,0 +1,4 @@ +var + x = @[1,2,3,4,5,6] + y = @[7,8,9,10,11] + z = x & y diff --git a/Task/Array-concatenation/Nim/array-concatenation-2.nim b/Task/Array-concatenation/Nim/array-concatenation-2.nim new file mode 100644 index 0000000000..03f1186dc2 --- /dev/null +++ b/Task/Array-concatenation/Nim/array-concatenation-2.nim @@ -0,0 +1,7 @@ +var + a = [1,2,3,4,5,6] + b = [7,8,9,10,11] + c: array[11, int] + +c[0..5] = a +c[6..10] = b diff --git a/Task/Array-concatenation/Oforth/array-concatenation.oforth b/Task/Array-concatenation/Oforth/array-concatenation.oforth new file mode 100644 index 0000000000..3f2a4556fb --- /dev/null +++ b/Task/Array-concatenation/Oforth/array-concatenation.oforth @@ -0,0 +1 @@ +[1, 2, 3 ] [ 4, 5, 6, 7 ] + diff --git a/Task/Array-concatenation/Phix/array-concatenation.phix b/Task/Array-concatenation/Phix/array-concatenation.phix new file mode 100644 index 0000000000..ba146b581e --- /dev/null +++ b/Task/Array-concatenation/Phix/array-concatenation.phix @@ -0,0 +1,2 @@ +sequence s1 = {1,2,3}, s2 = {4,5,6} +? s1 & s2 diff --git a/Task/Array-concatenation/Ring/array-concatenation.ring b/Task/Array-concatenation/Ring/array-concatenation.ring new file mode 100644 index 0000000000..96ec1b2167 --- /dev/null +++ b/Task/Array-concatenation/Ring/array-concatenation.ring @@ -0,0 +1,8 @@ +arr1 = [1, 2, 3] +arr2 = [4, 5, 6] +arr3 = [7, 8, 9] +arr4 = arr1 + arr2 +see arr4 +see nl +arr5 = arr4 + arr3 +see arr5 diff --git a/Task/Array-concatenation/Sidef/array-concatenation.sidef b/Task/Array-concatenation/Sidef/array-concatenation.sidef new file mode 100644 index 0000000000..c94a262601 --- /dev/null +++ b/Task/Array-concatenation/Sidef/array-concatenation.sidef @@ -0,0 +1,3 @@ +var arr1 = [1, 2, 3]; +var arr2 = [4, 5, 6]; +var arr3 = (arr1 + arr2); # => [1, 2, 3, 4, 5, 6] diff --git a/Task/Array-concatenation/Swift/array-concatenation.swift b/Task/Array-concatenation/Swift/array-concatenation.swift new file mode 100644 index 0000000000..d98de394c5 --- /dev/null +++ b/Task/Array-concatenation/Swift/array-concatenation.swift @@ -0,0 +1,3 @@ +let array1 = [1,2,3] +let array2 = [4,5,6] +let array3 = array1 + array2 diff --git a/Task/Array-concatenation/Ursa/array-concatenation.ursa b/Task/Array-concatenation/Ursa/array-concatenation.ursa new file mode 100644 index 0000000000..12664a5ef9 --- /dev/null +++ b/Task/Array-concatenation/Ursa/array-concatenation.ursa @@ -0,0 +1,16 @@ +# create two streams (the ursa equivalent of arrays) +# a contains the numbers 1-10, b contains 11-20 +decl int<> a b +decl int i +for (set i 1) (< i 11) (inc i) + append i a +end for +for (set i 11) (< i 21) (inc i) + append i b +end for + +# append the values in b to a +append b a + +# output a to the console +out a endl console diff --git a/Task/Array-concatenation/Wart/array-concatenation.wart b/Task/Array-concatenation/Wart/array-concatenation.wart new file mode 100644 index 0000000000..d20242b97c --- /dev/null +++ b/Task/Array-concatenation/Wart/array-concatenation.wart @@ -0,0 +1,4 @@ +a <- '(1 2 3) +b <- '(4 5 6) +a+b +# => (1 2 3 4 5 6) diff --git a/Task/Array-concatenation/Wren/array-concatenation.wren b/Task/Array-concatenation/Wren/array-concatenation.wren new file mode 100644 index 0000000000..169b5adac1 --- /dev/null +++ b/Task/Array-concatenation/Wren/array-concatenation.wren @@ -0,0 +1,6 @@ +var arr1 = [1,2,3] +var arr2 = [4,5,6] +for (e in arr2) { + arr1.add(e) +} +System.print(arr1) diff --git a/Task/Array-concatenation/jq/array-concatenation.jq b/Task/Array-concatenation/jq/array-concatenation.jq new file mode 100644 index 0000000000..30e63f6f20 --- /dev/null +++ b/Task/Array-concatenation/jq/array-concatenation.jq @@ -0,0 +1,3 @@ +[1,2] + [3] + [null] # => [1,2,3,null] + +[range(1;3), 3, null] # => [1,2,3,null] diff --git a/Task/Arrays/8051-Assembly/arrays.8051 b/Task/Arrays/8051-Assembly/arrays.8051 new file mode 100644 index 0000000000..00f60e39b5 --- /dev/null +++ b/Task/Arrays/8051-Assembly/arrays.8051 @@ -0,0 +1,90 @@ +; constant array (elements are unchangeable) - the array is stored in the CODE segment +myarray db 'Array' ; db = define bytes - initializes 5 bytes with values 41, 72, 72, etc. (the ascii characters A,r,r,a,y) +myarray2 dw 'A','r','r','a','y' ; dw = define words - initializes 5 words (1 word = 2 bytes) with values 41 00 , 72 00, 72 00, etc. +; how to read index a of the array + push acc + push dph + push dpl + mov dpl,#low(myarray) ; location of array + mov dph,#high(myarray) + movc a,@a+dptr ; a = element a + mov r0, a ; r0 = element a + pop dpl + pop dph + pop acc ; a = original index again + +; array stored in internal RAM (A_START is the first register of the array, A_END is the last) +; initalise array data (with 0's) + push 0 + mov r0, #A_START +clear: + mov @r0, #0 + inc r0 + cjne r0, #A_END, clear + pop 0 +; how to read index r1 of array + push psw + mov a, #A_START + add a, r1 ; a = memory location of element r1 + push 0 + mov r0, a + mov a, @r0 ; a = element r1 + pop 0 + pop psw +; how to write value of acc into index r1 of array + push psw + push 0 + push acc + mov a, #A_START + add a, r1 + mov r0, a + pop acc + mov @r0, a ; element r1 = a + pop 0 + pop psw + +; array stored in external RAM (A_START is the first memory location of the array, LEN is the length) +; initalise array data (with 0's) + push dph + push dpl + push acc + push 0 + mov dptr, #A_START + clr a + mov r0, #LEN +clear: + movx @dptr, a + inc dptr + djnz r0, clear + pop 0 + pop acc + pop dpl + pop dph +; how to read index r1 of array + push dph + push dpl + push 0 + mov dptr, #A_START-1 + mov r0, r1 + inc r0 +loop: + inc dptr + djnz r0, loop + movx a, @dptr ; a = element r1 + pop 0 + pop dpl + pop dph +; how to write value of acc into index r1 of array + push dph + push dpl + push 0 + mov dptr, #A_START-1 + mov r0, r1 + inc r0 +loop: + inc dptr + djnz r0, loop + movx @dptr, a ; element r1 = a + pop 0 + pop dpl + pop dph diff --git a/Task/Arrays/8th/arrays.8th b/Task/Arrays/8th/arrays.8th new file mode 100644 index 0000000000..8291343779 --- /dev/null +++ b/Task/Arrays/8th/arrays.8th @@ -0,0 +1,14 @@ +[ 1 , 2 ,3 ] \ an array holding three numbers +1 a:@ \ this will be '2', the element at index 1 +drop +1 123 a:@ \ this will store the value '123' at index 1, so now +. \ will print [1,123,3] + +[1,2,3] 45 a:push +\ gives us [1,2,3,45] +\ and empty spots are filled with null: +[1,2,3] 5 15 a:! +\ gives [1,2,3,null,15] + +\ arrays don't have to be homogenous: +[1,"one", 2, "two"] diff --git a/Task/Arrays/AntLang/arrays.antlang b/Task/Arrays/AntLang/arrays.antlang new file mode 100644 index 0000000000..f8dda813f9 --- /dev/null +++ b/Task/Arrays/AntLang/arrays.antlang @@ -0,0 +1,13 @@ +/ Create an immutable sequence (array) +arr: <1;2;3> + +/ Get the head an tail part +h: head[arr] +t: tail[arr] + +/ Get everything except the last element and the last element +nl: first[arr] +l: last[arr] + +/ Get the nth element (index origin = 0) +nth:arr[n] diff --git a/Task/Arrays/Apex/arrays-1.apex b/Task/Arrays/Apex/arrays-1.apex new file mode 100644 index 0000000000..7c0b2cd072 --- /dev/null +++ b/Task/Arrays/Apex/arrays-1.apex @@ -0,0 +1,3 @@ +Integer[] array = new Integer[10]; // optionally, append a braced list of Integers like "{1, 2, 3}" +array[0] = 42; +System.debug(array[0]); // Prints 42 diff --git a/Task/Arrays/Apex/arrays-2.apex b/Task/Arrays/Apex/arrays-2.apex new file mode 100644 index 0000000000..54a643dfcb --- /dev/null +++ b/Task/Arrays/Apex/arrays-2.apex @@ -0,0 +1,4 @@ +List aList = new List (); // optionally add an initial size as an argument +aList.add(5);// appends to the end of the list +aList.add(1, 6);// assigns the element at index 1 +System.debug(list[0]); // Prints 5, alternatively you can use list.get(0) diff --git a/Task/Arrays/Axe/arrays.axe b/Task/Arrays/Axe/arrays.axe new file mode 100644 index 0000000000..5f9d9b4a67 --- /dev/null +++ b/Task/Arrays/Axe/arrays.axe @@ -0,0 +1,8 @@ +1→{L₁} +2→{L₁+1} +3→{L₁+2} +4→{L₁+3} +Disp {L₁}►Dec,i +Disp {L₁+1}►Dec,i +Disp {L₁+2}►Dec,i +Disp {L₁+3}►Dec,i diff --git a/Task/Arrays/BML/arrays.bml b/Task/Arrays/BML/arrays.bml new file mode 100644 index 0000000000..661b0a3bd1 --- /dev/null +++ b/Task/Arrays/BML/arrays.bml @@ -0,0 +1,11 @@ +% Define an array(containing the numbers 1-3) named arr in the group $ +in $ let arr hold 1 2 3 + +% Replace the value at index 0 in array to "Index 0" +set $arr index 0 to "Index 0" + +% Will display "Index 0" +display $arr index 0 + +% There is no automatic garbage collection +delete $arr diff --git a/Task/Arrays/Ceylon/arrays.ceylon b/Task/Arrays/Ceylon/arrays.ceylon new file mode 100644 index 0000000000..75f9415ea9 --- /dev/null +++ b/Task/Arrays/Ceylon/arrays.ceylon @@ -0,0 +1,20 @@ +import ceylon.collection { + + ArrayList +} + +shared void run() { + + // you can get an array from the Array.ofSize named constructor + value array = Array.ofSize(10, "hello"); + value a = array[3]; + print(a); + array[4] = "goodbye"; + print(array); + + // for a dynamic list import ceylon.collection in your module.ceylon file + value list = ArrayList(); + list.push("hello"); + list.push("hello again"); + print(list); +} diff --git a/Task/Arrays/ChucK/arrays.chuck b/Task/Arrays/ChucK/arrays.chuck new file mode 100644 index 0000000000..d289adcd35 --- /dev/null +++ b/Task/Arrays/ChucK/arrays.chuck @@ -0,0 +1,9 @@ +int array[0]; // instantiate int array +array << 1; // append item +array << 2 << 3; // append items +4 => array[3]; // assign element(4) to index(3) +5 => array.size; // resize +array.clear(); // clear elements +<<>>; // print in cosole array size +[1,2,3,4,5,6,7] @=> array; +array.popBack(); // Pop last element diff --git a/Task/Arrays/Computer-zero-Assembly/arrays-1.computer b/Task/Arrays/Computer-zero-Assembly/arrays-1.computer new file mode 100644 index 0000000000..23c40daae3 --- /dev/null +++ b/Task/Arrays/Computer-zero-Assembly/arrays-1.computer @@ -0,0 +1,31 @@ +load: LDA ary + ADD sum + STA sum + + LDA load + ADD one + STA load + + SUB end + BRZ done + + JMP load + +done: LDA sum + STP + +one: 1 +end: LDA ary+10 + +sum: 0 + +ary: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 diff --git a/Task/Arrays/Computer-zero-Assembly/arrays-2.computer b/Task/Arrays/Computer-zero-Assembly/arrays-2.computer new file mode 100644 index 0000000000..c2d0a3bd34 --- /dev/null +++ b/Task/Arrays/Computer-zero-Assembly/arrays-2.computer @@ -0,0 +1,30 @@ +load: LDA ary + BRZ done + + ADD sum + STA sum + + LDA load + ADD one + STA load + + JMP load + +done: LDA sum + STP + +one: 1 + +sum: 0 + +ary: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 0 diff --git a/Task/Arrays/FreeBASIC/arrays.freebasic b/Task/Arrays/FreeBASIC/arrays.freebasic new file mode 100644 index 0000000000..7fe8b9455c --- /dev/null +++ b/Task/Arrays/FreeBASIC/arrays.freebasic @@ -0,0 +1,82 @@ +' compile with: FBC -s console. +' compile with: FBC -s console -exx to have boundary checks. + +Dim As Integer a(5) ' from s(0) to s(5) +Dim As Integer num = 1 +Dim As String s(-num To num) ' s1(-1), s1(0) and s1(1) + +Static As UByte c(5) ' create a array with 6 elements (0 to 5) + +'dimension array and initializing it with Data +Dim d(1 To 2, 1 To 5) As Integer => {{1, 2, 3, 4, 5}, {1, 2, 3, 4, 5}} +Print " The first dimension has a lower bound of"; LBound(d);_ + " and a upper bound of"; UBound(d) +Print " The second dimension has a lower bound of"; LBound(d,2);_ + " and a upper bound of"; UBound(d,2) +Print : Print + +Dim Shared As UByte u(0 To 3) ' make a shared array of UByte with 4 elements + +Dim As UInteger pow() ' make a variable length array +' you must Dim the array before you can use ReDim +ReDim pow(num) ' pow now has 1 element +pow(num) = 10 ' lets fill it with 10 and print it +Print " The value of pow(num) = "; pow(num) + +ReDim pow(10) ' make pow a 10 element array +Print +Print " Pow now has"; UBound(pow) - LBound(pow) +1; " elements" +' the value of pow(num) is gone now +Print " The value of pow(num) = "; pow(num); ", should be 0" + +Print +For i As Integer = LBound(pow) To UBound(pow) + pow(i) = i * i + Print pow(i), +Next +Print:Print + +ReDim Preserve pow(3 To 7) +' the first five elements will be preserved, not elements 3 to 7 +Print +Print " The lower bound is now"; LBound(pow);_ + " and the upper bound is"; UBound(pow) +Print " Pow now has"; UBound(pow) - LBound(pow) +1; " elements" +Print +For i As Integer = LBound(pow) To UBound(pow) + Print pow(i), +Next +Print : Print + +'erase the variable length array +Erase pow +Print " The lower bound is now"; LBound(pow);_ + " and the upper bound is "; UBound(pow) +Print " If the lower bound is 0 and the upper bound is -1 it means," +Print " that the array has no elements, it's completely removed" +Print : Print + +'erase the fixed length array +Print " Display the contents of the array d" +For i As Integer = 1 To 2 : For j As Integer = 1 To 5 + Print d(i,j);" "; +Next : Next : Print : Print + +Erase d +Print " We have erased array d" +Print " The first dimension has a lower bound of"; LBound(d);_ + " and a upper bound of"; UBound(d) +Print " The second dimension has a lower bound of"; LBound(d,2);_ + " and a upper bound of"; UBound(d,2) +Print +For i As Integer = 1 To 2 : For j As Integer = 1 To 5 + Print d(i,j);" "; +Next : Next +Print +Print " The elements self are left untouched but there content is set to 0" + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Arrays/Futhark/arrays-1.futhark b/Task/Arrays/Futhark/arrays-1.futhark new file mode 100644 index 0000000000..b5d8bb58d9 --- /dev/null +++ b/Task/Arrays/Futhark/arrays-1.futhark @@ -0,0 +1 @@ +[1, 2, 3] diff --git a/Task/Arrays/Futhark/arrays-2.futhark b/Task/Arrays/Futhark/arrays-2.futhark new file mode 100644 index 0000000000..13658c363c --- /dev/null +++ b/Task/Arrays/Futhark/arrays-2.futhark @@ -0,0 +1,2 @@ +replicate 5 3 == [3,3,3,3,3] +iota 5 = [0,1,2,3,4] diff --git a/Task/Arrays/Futhark/arrays-3.futhark b/Task/Arrays/Futhark/arrays-3.futhark new file mode 100644 index 0000000000..c5007221b6 --- /dev/null +++ b/Task/Arrays/Futhark/arrays-3.futhark @@ -0,0 +1,3 @@ +fun update(as: *[]int, i: int, x: int): []int = + let as[i] = x + in x diff --git a/Task/Arrays/Harbour/arrays-1.harbour b/Task/Arrays/Harbour/arrays-1.harbour new file mode 100644 index 0000000000..fff55e29c3 --- /dev/null +++ b/Task/Arrays/Harbour/arrays-1.harbour @@ -0,0 +1,11 @@ + // Declare and initialize two-dimensional array + local arr1 := { { "NITEM", "N", 10, 0 }, { "CONTENT", "C", 60, 0 } } + // Create an empty array + local arr2 := {} + // Declare three-dimensional array + local arr3[ 2, 100, 3 ] + // Create an array + local arr4 := Array( 50 ) + + // Array can be dynamically resized: + arr4 := ASize( arr4, 80 ) diff --git a/Task/Arrays/Harbour/arrays-2.harbour b/Task/Arrays/Harbour/arrays-2.harbour new file mode 100644 index 0000000000..0f710c5620 --- /dev/null +++ b/Task/Arrays/Harbour/arrays-2.harbour @@ -0,0 +1,6 @@ +// Adding new item to array, its size is incremented + AAdd( arr1, { "LBASE", "L", 1, 0 } ) +// Delete the first item of arr3, The size of arr3 remains the same, all items are shifted to one position, the last item is replaced by Nil: + ADel( arr1, 1 ) +// Assigning a value to array item + arr3[ 1, 1, 1 ] := 11.4 diff --git a/Task/Arrays/Harbour/arrays-3.harbour b/Task/Arrays/Harbour/arrays-3.harbour new file mode 100644 index 0000000000..c0a304c6c3 --- /dev/null +++ b/Task/Arrays/Harbour/arrays-3.harbour @@ -0,0 +1,2 @@ + x := arr3[ 1, 10, 2 ] +// The retrieved item can be nested array, in this case it isn't copied, the pointer to it is assigned diff --git a/Task/Arrays/Harbour/arrays-4.harbour b/Task/Arrays/Harbour/arrays-4.harbour new file mode 100644 index 0000000000..bfbe043281 --- /dev/null +++ b/Task/Arrays/Harbour/arrays-4.harbour @@ -0,0 +1,7 @@ +// Fill the 20 items of array with 0, starting from 5-th item: + AFill( arr4, 0, 5, 20 ) +// Copy 10 items from arr4 to arr3[ 2 ], starting from the first position: + ACopy( arr4, arr3[ 2 ], 1, 10 ) +// Duplicate the whole or nested array: + arr5 := AClone( arr1 ) + arr6 := AClone( arr1[ 3 ] ) diff --git a/Task/Arrays/I/arrays-1.i b/Task/Arrays/I/arrays-1.i new file mode 100644 index 0000000000..50294476d4 --- /dev/null +++ b/Task/Arrays/I/arrays-1.i @@ -0,0 +1,9 @@ +software { + var a = [] + a += 2 + print(a[0]) //Outputs 2 + + a[0] = 4 + + print(a[0]) //Outputs 4 +} diff --git a/Task/Arrays/I/arrays-2.i b/Task/Arrays/I/arrays-2.i new file mode 100644 index 0000000000..ae65dbdff8 --- /dev/null +++ b/Task/Arrays/I/arrays-2.i @@ -0,0 +1,98 @@ +record aThing(a, b, c) # arbitrary object (record or class) for illustration + +procedure main() + A0 := [] # empty list + A0 := list() # empty list (default size 0) + A0 := list(0) # empty list (literal size 0) + + A1 := list(10) # 10 elements, default initializer &null + A2 := list(10, 1) # 10 elements, initialized to 1 + + # literal array construction - arbitrary dynamically typed members + A3 := [1, 2, 3, ["foo", "bar", "baz"], aThing(1, 2, 3), "the end"] + + # left-end workers + # NOTE: get() is a synonym for pop() which allows nicely-worded use of put() and get() to implement queues + # + Q := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + x := pop(A0) # x is 1 + x := get(A0) # x is 2 + push(Q,0) + # Q is now [0,3, 4, 5, 6, 7, 8, 9, 10] + + # right-end workers + x := pull(Q) # x is 10 + put(Q, 100) # Q is now [0, 3, 4, 5, 6, 7, 8, 9, 100] + + # push and put return the list they are building + # they also can have multiple arguments which work like repeated calls + + Q2 := put([],1,2,3) # Q2 is [1,2,3] + Q3 := push([],1,2,3) # Q3 is [3,2,1] + Q4 := push(put(Q2),4),0] # Q4 is [0,1,2,3,4] and so is Q2 + + # array access follows with A as the sample array + A := [10, 20, 30, 40, 50, 60, 70, 80, 90, 100] + + # get element indexed from left + x := A[1] # x is 10 + x := A[2] # x is 20 + x := A[10] # x is 100 + + # get element indexed from right + x := A[-1] # x is 100 + x := A[-2] # x is 90 + x := A[-10] # x is 10 + + # copy array to show assignment to elements + B := copy(A) + + # assign element indexed from left + B[1] := 11 + B[2] := 21 + B[10] := 101 + # B is now [11, 21, 30, 50, 60, 60, 70, 80, 90, 101] + + # assign element indexed from right - see below + B[-1] := 102 + B[-2] := 92 + B[-10] := 12 + # B is now [12, 21, 30, 50, 60, 60, 70, 80, 92, 102] + + # list slicing + # the unusual nature of the slice - returning 1 less element than might be expected + # in many languages - is best understood if you imagine indexes as pointing to BEFORE + # the item of interest. When a slice is made, the elements between the two points are + # collected. eg in the A[3 : 6] sample, it will get the elements between the [ ] marks + # + # sample list: 10 20 [30 40 50] 60 70 80 90 100 + # positive indexes: 1 2 3 4 5 6 7 8 9 10 11 + # non-positive indexes: -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 + # + # I have deliberately drawn the indexes between the positions of the values. + # The nature of this indexing brings simplicity to string operations + # + # list slicing can also use non-positive indexes to access values from the right. + # The final index of 0 shown above shows how the end of the list can be nominated + # without having to know it's length + # + # NOTE: list slices are distinct lists, so assigning to the slice + # or a member of the slice does not change the values in A + # + # Another key fact to understand: once the non-positive indexes and length-offsets are + # resolved to a simple positive index, the index pair (if two are given) are swapped + # if necessary to yield the elements between the two. + # + S := A[3 : 6] # S is [30, 40, 50] + S := A[6 : 3] # S is [30, 40, 50] not illegal or erroneous + S := A[-5 : -8] # S is [30, 40, 50] + S := A[-8 : -5] # S is [30, 40, 50] also legal and meaningful + + # list slicing with length request + S := A[3 +: 3] # S is [30, 40, 50] + S := A[6 -: 3] # S is [30, 40, 50] + S := A[-8 +: 3] # S is [30, 40, 50] + S := A[-5 -: 3] # S is [30, 40, 50] + S := A[-8 -: -3] # S is [30, 40, 50] + S := A[-5 +: -3] # S is [30, 40, 50] +end diff --git a/Task/Arrays/I/arrays-3.i b/Task/Arrays/I/arrays-3.i new file mode 100644 index 0000000000..a3a972a13f --- /dev/null +++ b/Task/Arrays/I/arrays-3.i @@ -0,0 +1,3 @@ +# Unicon provides a number of extensions +# insert and delete work on lists allowing changes in the middle +# possibly others diff --git a/Task/Arrays/LFE/arrays.lfe b/Task/Arrays/LFE/arrays.lfe new file mode 100644 index 0000000000..7e795da653 --- /dev/null +++ b/Task/Arrays/LFE/arrays.lfe @@ -0,0 +1,51 @@ +; Create a fixed-size array with entries 0-9 set to 'undefined' +> (set a0 (: array new 10)) +#(array 10 0 undefined 10) +> (: array size a0) +10 + +; Create an extendible array and set entry 17 to 'true', +; causing the array to grow automatically +> (set a1 (: array set 17 'true (: array new))) +#(array + 18 + ... +(: array size a1) +18 + +; Read back a stored value +> (: array get 17 a1) +true + +; Accessing an unset entry returns the default value +> (: array get 3 a1) +undefined + +; Accessing an entry beyond the last set entry also returns the +; default value, if the array does not have fixed size +> (: array get 18 a1) +undefined + +; "sparse" functions ignore default-valued entries +> (set a2 (: array set 4 'false a1)) +#(array + 18 + ... +> (: array sparse_to_orddict a2) +(#(4 false) #(17 true)) + +; An extendible array can be made fixed-size later +> (set a3 (: array fix a2)) +#(array + 18 + ... + +; A fixed-size array does not grow automatically and does not +; allow accesses beyond the last set entry +> (: array set 18 'true a3) +exception error: badarg + in (array set 3) + +> (: array get 18 a3) +exception error: badarg + in (array get 2) diff --git a/Task/Arrays/Lasso/arrays-1.lasso b/Task/Arrays/Lasso/arrays-1.lasso new file mode 100644 index 0000000000..3e9e63a3dc --- /dev/null +++ b/Task/Arrays/Lasso/arrays-1.lasso @@ -0,0 +1,33 @@ +// Create a new empty array +local(array1) = array + +// Create an array with 2 members (#myarray->size is 2) +local(array1) = array('ItemA','ItemB') + +// Assign a value to member [2] +#array1->get(2) = 5 + +// Retrieve a value from an array +#array1->get(2) + #array1->size // 8 + +// Merge arrays +local( + array1 = array('a','b','c'), + array2 = array('a','b','c') +) +#array1->merge(#array2) // a, b, c, a, b, c + +// Sort an array +#array1->sort // a, a, b, b, c, c + +// Remove value by index +#array1->remove(2) // a, b, b, c, c + +// Remove matching items +#array1->removeall('b') // a, c, c + +// Insert item +#array1->insert('z') // a, c, c, z + +// Insert item at specific position +#array1->insert('0',1) // 0, a, c, c, z diff --git a/Task/Arrays/Lasso/arrays-2.lasso b/Task/Arrays/Lasso/arrays-2.lasso new file mode 100644 index 0000000000..03faace747 --- /dev/null +++ b/Task/Arrays/Lasso/arrays-2.lasso @@ -0,0 +1,11 @@ +// Create a staticarray containing 5 items +local(mystaticArray) = staticarray('a','b','c','d','e') + +// Retreive an item +#mystaticArray->get(3) // c + +// Set an item +#mystaticArray->get(3) = 'changed' // a, b, changed, d, e + +// Create an empty static array with a length of 32 +local(mystaticArray) = staticarray_join(32,void) diff --git a/Task/Arrays/Lingo/arrays-1.lingo b/Task/Arrays/Lingo/arrays-1.lingo new file mode 100644 index 0000000000..d702014b6d --- /dev/null +++ b/Task/Arrays/Lingo/arrays-1.lingo @@ -0,0 +1,15 @@ +a = [1,2] -- or: a = list(1,2) +put a[2] -- or: put a.getAt(2) +-- 2 +a.append(3) +put a +-- [1, 2, 3] +a.deleteAt(2) +put a +-- [1, 3] +a[1] = 5 -- or: a.setAt(1, 5) +put a +-- [5, 3] +a.sort() +put a +-- [3, 5] diff --git a/Task/Arrays/Lingo/arrays-2.lingo b/Task/Arrays/Lingo/arrays-2.lingo new file mode 100644 index 0000000000..291925dcd5 --- /dev/null +++ b/Task/Arrays/Lingo/arrays-2.lingo @@ -0,0 +1,11 @@ +ba = bytearray(2, 255) -- initialized with size 2 and filled with 0xff +put ba +-- +ba[1] = 1 +ba[2] = 2 +ba[ba.length+1] = 3 -- dynamically increases size +put ba +-- +ba[1] = 5 +put ba +-- diff --git a/Task/Arrays/Monte/arrays-1.monte b/Task/Arrays/Monte/arrays-1.monte new file mode 100644 index 0000000000..070286da43 --- /dev/null +++ b/Task/Arrays/Monte/arrays-1.monte @@ -0,0 +1 @@ +var myArray := ['a', 'b', 'c','d'] diff --git a/Task/Arrays/Monte/arrays-2.monte b/Task/Arrays/Monte/arrays-2.monte new file mode 100644 index 0000000000..a41f0891d8 --- /dev/null +++ b/Task/Arrays/Monte/arrays-2.monte @@ -0,0 +1 @@ +traceln(myArray[0]) diff --git a/Task/Arrays/Monte/arrays-3.monte b/Task/Arrays/Monte/arrays-3.monte new file mode 100644 index 0000000000..b737b77449 --- /dev/null +++ b/Task/Arrays/Monte/arrays-3.monte @@ -0,0 +1 @@ +myArray := myArray.with(3, 'z') diff --git a/Task/Arrays/Nim/arrays.nim b/Task/Arrays/Nim/arrays.nim new file mode 100644 index 0000000000..3367079b77 --- /dev/null +++ b/Task/Arrays/Nim/arrays.nim @@ -0,0 +1,22 @@ +var # fixed size arrays + x = [1,2,3,4,5,6,7,8,9,10] # type and size automatically inferred + y: array[1..5, int] = [1,2,3,4,5] # starts at 1 instead of 0 + z: array['a'..'z', int] # indexed using characters + +x[0] = x[1] + 1 +echo x[0] +echo z['d'] + +x[7..9] = y[3..5] # copy part of array + +var # variable size sequences + a = @[1,2,3,4,5,6,7,8,9,10] + b: seq[int] = @[1,2,3,4,5] + +a[0] = a[1] + 1 +echo a[0] + +a.add(b) # append another sequence +a.add(200) # append another element +echo a.pop() # pop last item, removing and returning it +echo a diff --git a/Task/Arrays/Oforth/arrays.oforth b/Task/Arrays/Oforth/arrays.oforth new file mode 100644 index 0000000000..0c80c7d547 --- /dev/null +++ b/Task/Arrays/Oforth/arrays.oforth @@ -0,0 +1,3 @@ +[ "abd", "def", "ghi" ] at(3) println + +ListBuffer new dup addAll([1, 2, 3]) dup put(2, 8.1) println diff --git a/Task/Arrays/Phix/arrays.phix b/Task/Arrays/Phix/arrays.phix new file mode 100644 index 0000000000..4cd8a1e932 --- /dev/null +++ b/Task/Arrays/Phix/arrays.phix @@ -0,0 +1,74 @@ +-- simple one-dimensional arrays: +sequence s1 = {0.5, 1, 4.7, 9}, -- length(s1) is now 4 + s2 = repeat(0,6), -- s2 is {0,0,0,0,0,0} + s3 = tagset(5) -- s3 is {1,2,3,4,5} + + ?s1[3] -- displays 4.7 (nb 1-based indexing) + s1[3] = 0 -- replace that 4.7 + s1 &= {5,6} -- length(s1) is now 6 ({0.5,1,0,9,5,6}) + s1 = s1[2..5] -- length(s1) is now 4 ({1,0,9,5}) + s1[2..3] = {2,3,4} -- length(s1) is now 5 ({1,2,3,4,5}) + s1 = append(s1,6) -- length(s1) is now 6 ({1,2,3,4,5,6}) + s1 = prepend(s1,0) -- length(s1) is now 7 ({0,1,2,3,4,5,6}) + +-- negative subscripts can also be used, counting from the other end, eg + s2[-2..-1] = {-2,-1} -- s2 is now {0,0,0,0,-2,-1} + +-- multi dimensional arrays: +sequence y = {{{1,1},{3,3},{5,5}}, + {{0,0},{0,1},{9,1}}, + {{1,7},{1,1},{2,2}}} + -- y[2][3][1] is 9 + + y = repeat(repeat(repeat(0,2),3),3) + -- same structure, but all 0s + +-- Array of strings: +sequence s = {"Hello", "World", "Phix", "", "Last One"} + -- s[3] is "Phix" + -- s[3][2] is 'h' + +-- A Structure: +sequence employee = {{"John","Smith"}, + 45000, + 27, + 185.5} + +-- To simplify access to elements within a structure it is good programming style to define constants that name the various fields, eg: + constant SALARY = 2 + +-- Array of structures: +sequence employees = { + {{"Jane","Adams"}, 47000, 34, 135.5}, -- a[1] + {{"Bill","Jones"}, 57000, 48, 177.2}, -- a[2] + -- .... etc. + } + -- employees[2][SALARY] is 57000 + +-- A tree can be represented easily, for example after adding "b","c","a" to it you might have: +sequence tree = {{"b",3,2}, + {"c",0,0}, + {"a",0,0}} + +-- ie assuming +constant ROOT=1, VALUE=1, LEFT=2, RIGHT=3 -- then +-- tree[ROOT][VALUE] is "b" +-- tree[ROOT][LEFT] is 3, and tree[3] is the "a" +-- tree[ROOT][RIGHT] is 2, and tree[2] is the "c" + +-- The operations you might use to build such a tree (tests/loops/etc omitted) could be: + tree = {} + tree = append(tree,{"b",0,0}) + tree = append(tree,{"c",0,0}) + tree[1][RIGHT] = length(tree) + tree = append(tree,{"a",0,0}) + tree[1][LEFT] = length(tree) + +-- Finally, some tests (recall that we have already output a 4.7): +?s[3] +?tree +?tree[ROOT][VALUE] +employees = append(employees, employee) +?employees[3][SALARY] +?s1 +?s2 diff --git a/Task/Arrays/Pony/arrays.pony b/Task/Arrays/Pony/arrays.pony new file mode 100644 index 0000000000..b148ddc65a --- /dev/null +++ b/Task/Arrays/Pony/arrays.pony @@ -0,0 +1,13 @@ +var numbers = Array[I32](16) // creating array of 32-bit ints with initial allocation for 16 elements +numbers.push(10) // add value 10 to the end of array, extending the underlying memory if needed +try + let x = numbers(0) // fetch the first element of array. index starts at 0 + Fact(x == 10) // try block is needed, because both lines inside it can throw exception +end + +var other: Array[U64] = [10, 20, 30] // array literal +let s = other.size() // return the number of elements in array +try + Fact(s == 3) // size of array 'other' is 3 + other(1) = 40 // 'other' now is [10, 40, 30] +end diff --git a/Task/Arrays/Ring/arrays.ring b/Task/Arrays/Ring/arrays.ring new file mode 100644 index 0000000000..3ebb6d49bb --- /dev/null +++ b/Task/Arrays/Ring/arrays.ring @@ -0,0 +1,11 @@ +# create an array with one string in it +a = ['foo'] + +# add items +a + 1 # ["foo", 1] + +# set the value at a specific index in the array +a[1] = 2 # [2, 1] + +# retrieve an element +see a[1] diff --git a/Task/Arrays/SSEM/arrays.ssem b/Task/Arrays/SSEM/arrays.ssem new file mode 100644 index 0000000000..5d9b064bff --- /dev/null +++ b/Task/Arrays/SSEM/arrays.ssem @@ -0,0 +1,27 @@ +10101000000000100000000000000000 0. -21 to c +11101000000000010000000000000000 1. Sub. 23 +00101000000001100000000000000000 2. c to 20 +00101000000000100000000000000000 3. -20 to c +10101000000001100000000000000000 4. c to 21 +10000000000000100000000000000000 5. -1 to c +01001000000000010000000000000000 6. Sub. 18 +00101000000001100000000000000000 7. c to 20 +00101000000000100000000000000000 8. -20 to c +10000000000001100000000000000000 9. c to 1 +01101000000000010000000000000000 10. Sub. 22 +00000000000000110000000000000000 11. Test +01001000000001000000000000000000 12. Add 18 to CI +11001000000000000000000000000000 13. 19 to CI +10101000000000100000000000000000 14. -21 to c +00101000000001100000000000000000 15. c to 20 +00101000000000100000000000000000 16. -20 to c +00000000000001110000000000000000 17. Stop +10000000000000000000000000000000 18. 1 +11111111111111111111111111111111 19. -1 +00000000000000000000000000000000 20. 0 +00000000000000000000000000000000 21. 0 +11011000000000010000000000000000 22. Sub. 27 +10000000000000000000000000000000 23. 1 +01000000000000000000000000000000 24. 2 +11000000000000000000000000000000 25. 3 +00100000000000000000000000000000 26. 4 diff --git a/Task/Arrays/Sidef/arrays.sidef b/Task/Arrays/Sidef/arrays.sidef new file mode 100644 index 0000000000..c6143bc504 --- /dev/null +++ b/Task/Arrays/Sidef/arrays.sidef @@ -0,0 +1,29 @@ +# create an empty array +var arr = []; + +# push objects into the array +arr << "a"; #: ['a'] +arr.append(1,2,3); #: ['a', 1, 2, 3] + +# change an element inside the array +arr[2] = "b"; #: ['a', 1, 'b', 3] + +# set the value at a specific index in the array (with autovivification) +arr[5] = "end"; #: ['a', 1, 'b', 3, nil, 'end'] + +# resize the array +arr.resize_to(-1); #: [] + +# slice assignment +arr[0..2] = @|('a'..'c'); #: ['a', 'b', 'c'] + +# indices as arrays +var indices = [0, -1]; +arr[indices] = ("foo", "baz"); #: ['foo', 'b', 'baz'] + +# retrieve multiple elements +var *elems = arr[0, -1] +say elems #=> ['foo', 'baz'] + +# retrieve an element +say arr[-1]; #=> 'baz' diff --git a/Task/Arrays/Swift/arrays.swift b/Task/Arrays/Swift/arrays.swift new file mode 100644 index 0000000000..a33940f0ac --- /dev/null +++ b/Task/Arrays/Swift/arrays.swift @@ -0,0 +1,6 @@ +// Arrays are typed in Swift, however, using the Any object we can add any type. Swift does not support fixed length arrays +var anyArray = [Any]() +anyArray.append("foo") // Adding to an Array +anyArray.append(1) // ["foo", 1] +anyArray.removeAtIndex(1) // Remove object +anyArray[0] = "bar" // ["bar"]] diff --git a/Task/Arrays/Wren/arrays.wren b/Task/Arrays/Wren/arrays.wren new file mode 100644 index 0000000000..461591a6ea --- /dev/null +++ b/Task/Arrays/Wren/arrays.wren @@ -0,0 +1,14 @@ +var arr = [] +arr.add(1) +arr.add(2) +arr.count // 2 +arr.clear() + +arr.add(0) +arr.add(arr[0]) +arr.add(1) +arr.add(arr[-1]) // [0, 0, 1, 1] + +arr[-1] = 0 +arr.insert(-1, 0) // [0, 0, 1, 0, 0] +arr.removeAt(2) // [0, 0, 0, 0] diff --git a/Task/Arrays/XLISP/arrays.xlisp b/Task/Arrays/XLISP/arrays.xlisp new file mode 100644 index 0000000000..ccb45aeed1 --- /dev/null +++ b/Task/Arrays/XLISP/arrays.xlisp @@ -0,0 +1,24 @@ +[1] (define a (make-vector 10)) ; vector of 10 elements initialized to the empty list + +A +[2] (define b (make-vector 10 5)) ; vector of 10 elements initialized to 5 + +B +[3] (define c #(1 2 3 4 5 6 7 8 9 10)) ; vector literal + +C +[4] (vector-ref c 3) ; retrieve a value -- NB. indexed from 0 + +4 +[5] (vector-set! a 5 1) ; set a_5 to 1 + +1 +[6] (define d (make-array 5 6 7)) ; 3-dimensional array of size 5 by 6 by 7 + +D +[7] (array-set! d 1 2 3 10) ; set d_1,2,3 to 10 -- NB. still indexed from 0 + +10 +[8] (array-ref d 1 2 3) ; and get the value of d_1,2,3 + +10 diff --git a/Task/Arrays/jq/arrays.jq b/Task/Arrays/jq/arrays.jq new file mode 100644 index 0000000000..d585b64f3a --- /dev/null +++ b/Task/Arrays/jq/arrays.jq @@ -0,0 +1,36 @@ +# Create a new array with length 0 +[] + +# Create a new array of 5 nulls +[][4] = null # setting the element at offset 4 expands the array + +# Create an array having the elements 1 and 2 in that order +[1,2] + +# Create an array of integers from 0 to 10 inclusive +[ range(0; 11) ] + +# If a is an array (of any length), update it so that a[2] is 5 +a[2] = 5; + +# Append arrays a and b +a + b + +# Append an element, e, to an array a +a + [e] + +################################################## +# In the following, a is assumed to be [0,1,2,3,4] + +# It is not an error to use an out-of-range index: +a[10] # => null + +# Negative indices count backwards from after the last element: +a[-1] # => 4 + +# jq supports simple slice operations but +# only in the forward direction: +a[:1] # => [0] +a[1:] # => [1,2,3,4] +a[2:4] # => [2,3] +a[4:2] # null diff --git a/Task/Assertions/Apex/assertions-1.apex b/Task/Assertions/Apex/assertions-1.apex new file mode 100644 index 0000000000..e6f6e3d791 --- /dev/null +++ b/Task/Assertions/Apex/assertions-1.apex @@ -0,0 +1,2 @@ +String myStr = 'test; +System.assert(myStr == 'something else', 'Assertion Failed Message'); diff --git a/Task/Assertions/Apex/assertions-2.apex b/Task/Assertions/Apex/assertions-2.apex new file mode 100644 index 0000000000..33d4f9c7c3 --- /dev/null +++ b/Task/Assertions/Apex/assertions-2.apex @@ -0,0 +1,2 @@ +Integer i = 5; +System.assertEquals(6, i, 'Expected 6, received ' + i); diff --git a/Task/Assertions/Apex/assertions-3.apex b/Task/Assertions/Apex/assertions-3.apex new file mode 100644 index 0000000000..0f4a3f1dca --- /dev/null +++ b/Task/Assertions/Apex/assertions-3.apex @@ -0,0 +1,2 @@ +Integer i = 5; +System.assertNotEquals(5, i, 'Expected different value than ' + i); diff --git a/Task/Assertions/Axe/assertions.axe b/Task/Assertions/Axe/assertions.axe new file mode 100644 index 0000000000..2ae4a4d152 --- /dev/null +++ b/Task/Assertions/Axe/assertions.axe @@ -0,0 +1 @@ +A=42??Returnʳ diff --git a/Task/Assertions/ECL/assertions.ecl b/Task/Assertions/ECL/assertions.ecl new file mode 100644 index 0000000000..aa8ca44dba --- /dev/null +++ b/Task/Assertions/ECL/assertions.ecl @@ -0,0 +1 @@ +ASSERT(a = 42,'A is not 42!',FAIL); diff --git a/Task/Assertions/EchoLisp/assertions.echolisp b/Task/Assertions/EchoLisp/assertions.echolisp new file mode 100644 index 0000000000..7a4818bf17 --- /dev/null +++ b/Task/Assertions/EchoLisp/assertions.echolisp @@ -0,0 +1,9 @@ +(assert (integer? 42)) → #t ;; success returns true + +;; error and return to top level if not true; +(assert (integer? 'quarante-deux)) +⛔ error: assert : assertion failed : (#integer? 'quarante-deux) + +;; assertion with message (optional) +(assert (integer? 'quarante-deux) "☝️ expression must evaluate to the integer 42") +💥 error: ☝️ expression must evaluate to the integer 42 : assertion failed : (#integer? 'quarante-deux) diff --git a/Task/Assertions/FreeBASIC/assertions.freebasic b/Task/Assertions/FreeBASIC/assertions.freebasic new file mode 100644 index 0000000000..9795d3b854 --- /dev/null +++ b/Task/Assertions/FreeBASIC/assertions.freebasic @@ -0,0 +1,8 @@ +' FB 1.05.0 Win64 +' requires compilation with -g switch + +Dim a As Integer = 5 +Assert(a = 6) +'The rest of the code will not be executed +Print a +Sleep diff --git a/Task/Assertions/Lasso/assertions.lasso b/Task/Assertions/Lasso/assertions.lasso new file mode 100644 index 0000000000..3d9b0f547a --- /dev/null +++ b/Task/Assertions/Lasso/assertions.lasso @@ -0,0 +1,6 @@ +local(a) = 8 +fail_if( + #a != 42, + error_code_runtimeAssertion, + error_msg_runtimeAssertion + ": #a is not 42" +) diff --git a/Task/Assertions/Lingo/assertions.lingo b/Task/Assertions/Lingo/assertions.lingo new file mode 100644 index 0000000000..5b1ad2a933 --- /dev/null +++ b/Task/Assertions/Lingo/assertions.lingo @@ -0,0 +1,17 @@ +-- in a movie script +on assert (ok, message) + if not ok then + if not voidP(message) then _player.alert(message) + abort -- exits from current call stack, i.e. also from the caller function + end if +end + +-- anywhere in the code +on test + x = 42 + assert(x=42, "Assertion 'x=42' failed") + put "this shows up" + x = 23 + assert(x=42, "Assertion 'x=42' failed") + put "this will never show up" +end diff --git a/Task/Assertions/Nim/assertions.nim b/Task/Assertions/Nim/assertions.nim new file mode 100644 index 0000000000..541f20f9c9 --- /dev/null +++ b/Task/Assertions/Nim/assertions.nim @@ -0,0 +1,2 @@ +var a = 42 +assert(a == 42) diff --git a/Task/Assertions/Oforth/assertions.oforth b/Task/Assertions/Oforth/assertions.oforth new file mode 100644 index 0000000000..1575ca1313 --- /dev/null +++ b/Task/Assertions/Oforth/assertions.oforth @@ -0,0 +1,5 @@ +: testInteger(n, m) + assert: [ n isInteger ] + assert: [ n 42 == ] + + System.Out "Assertions are ok, parameters are : " << n << ", " << m << cr ; diff --git a/Task/Assertions/Phix/assertions-1.phix b/Task/Assertions/Phix/assertions-1.phix new file mode 100644 index 0000000000..b74e126c0f --- /dev/null +++ b/Task/Assertions/Phix/assertions-1.phix @@ -0,0 +1,7 @@ +type int42(object i) + return i=42 +end type + +int42 i + +i = 41 -- type-check failure diff --git a/Task/Assertions/Phix/assertions-2.phix b/Task/Assertions/Phix/assertions-2.phix new file mode 100644 index 0000000000..170487b290 --- /dev/null +++ b/Task/Assertions/Phix/assertions-2.phix @@ -0,0 +1,13 @@ +global constant DEBUG = 0 -- (or any other identifier name can be used) +global procedure assert(integer flag, string msg) + if DEBUG then + if not flag then + {} = message_box(msg,"failed assertion",MB_OK) -- or + puts(1,msg) -- , and/or + crash(msg) -- crash/ex.err report -- or + trace(1) -- start debugging + end if + end if +end function + +assert(i=42,"i is not 42!!") diff --git a/Task/Assertions/Phix/assertions-3.phix b/Task/Assertions/Phix/assertions-3.phix new file mode 100644 index 0000000000..3ff4946042 --- /dev/null +++ b/Task/Assertions/Phix/assertions-3.phix @@ -0,0 +1,2 @@ +if i!=42 then ?9/0 end if +if i!=42 then crash("i is not 42!!") end if diff --git a/Task/Assertions/Ring/assertions.ring b/Task/Assertions/Ring/assertions.ring new file mode 100644 index 0000000000..e47bc51303 --- /dev/null +++ b/Task/Assertions/Ring/assertions.ring @@ -0,0 +1,3 @@ +x = 42 +assert( x = 42 ) +assert( x = 100 ) diff --git a/Task/Assertions/Sidef/assertions.sidef b/Task/Assertions/Sidef/assertions.sidef new file mode 100644 index 0000000000..826113d16a --- /dev/null +++ b/Task/Assertions/Sidef/assertions.sidef @@ -0,0 +1,2 @@ +var num = pick(0..100); +assert_eq(num, 42); # dies when "num" is not 42 diff --git a/Task/Assertions/Swift/assertions.swift b/Task/Assertions/Swift/assertions.swift new file mode 100644 index 0000000000..57627959ca --- /dev/null +++ b/Task/Assertions/Swift/assertions.swift @@ -0,0 +1,6 @@ +var a = 5 +//...input or change a here +assert(a == 42) // aborts program when a is not 42 +assert(a == 42, "Error message") // aborts program + // when a is not 42 with "Error message" for the message + // the error message must be a static string diff --git a/Task/Associative-array-Creation/Apex/associative-array-creation-1.apex b/Task/Associative-array-Creation/Apex/associative-array-creation-1.apex new file mode 100644 index 0000000000..2d79b1db73 --- /dev/null +++ b/Task/Associative-array-Creation/Apex/associative-array-creation-1.apex @@ -0,0 +1,9 @@ +// Cannot / Do not need to instantiate the algorithm implementation (e.g, HashMap). +Map strMap = new Map(); +strMap.put('a', 'aval'); +strMap.put('b', 'bval'); + +System.assert( strMap.containsKey('a') ); +System.assertEquals( 'bval', strMap.get('b') ); +// String keys are case-sensitive +System.assert( !strMap.containsKey('A') ); diff --git a/Task/Associative-array-Creation/Apex/associative-array-creation-2.apex b/Task/Associative-array-Creation/Apex/associative-array-creation-2.apex new file mode 100644 index 0000000000..4173304650 --- /dev/null +++ b/Task/Associative-array-Creation/Apex/associative-array-creation-2.apex @@ -0,0 +1,7 @@ +Map strMap = new Map{ + 'a' => 'aval', + 'b' => 'bval' +}; + +System.assert( strMap.containsKey('a') ); +System.assertEquals( 'bval', strMap.get('b') ); diff --git a/Task/Associative-array-Creation/Ceylon/associative-array-creation.ceylon b/Task/Associative-array-Creation/Ceylon/associative-array-creation.ceylon new file mode 100644 index 0000000000..90797a27f4 --- /dev/null +++ b/Task/Associative-array-Creation/Ceylon/associative-array-creation.ceylon @@ -0,0 +1,36 @@ +import ceylon.collection { + + ArrayList, + HashMap, + naturalOrderTreeMap +} + +shared void run() { + + // the easiest way is to use the map function to create + // an immutable map + value myMap = map { + "foo" -> 5, + "bar" -> 10, + "baz" -> 15, + "foo" -> 6 // by default the first "foo" will remain + }; + + // or you can use the HashMap constructor to create + // a mutable one + value myOtherMap = HashMap { + "foo"->"bar" + }; + myOtherMap.put("baz", "baxx"); + + // there's also a sorted red/black tree map + value myTreeMap = naturalOrderTreeMap { + 1 -> "won", + 2 -> "too", + 4 -> "fore" + }; + for(num->homophone in myTreeMap) { + print("``num`` is ``homophone``"); + } + +} diff --git a/Task/Associative-array-Creation/EchoLisp/associative-array-creation.echolisp b/Task/Associative-array-Creation/EchoLisp/associative-array-creation.echolisp new file mode 100644 index 0000000000..1743774e89 --- /dev/null +++ b/Task/Associative-array-Creation/EchoLisp/associative-array-creation.echolisp @@ -0,0 +1,18 @@ +(lib 'hash) ;; needs hash.lib +(define H (make-hash)) ;; new hash table +;; keys may be symbols, numbers, strings .. +;; values may be any lisp object +(hash-set H 'simon 'antoniette) + → antoniette +(hash-set H 'antoinette 'albert) + → albert +(hash-set H "Elvis" 42) + → 42 +(hash-ref H 'Elvis) + → #f ;; not found. Elvis is not "Elvis" +(hash-ref H "Elvis") + → 42 +(hash-ref H 'simon) + → antoniette +(hash-count H) + → 3 diff --git a/Task/Associative-array-Creation/Harbour/associative-array-creation-1.harbour b/Task/Associative-array-Creation/Harbour/associative-array-creation-1.harbour new file mode 100644 index 0000000000..243fc14571 --- /dev/null +++ b/Task/Associative-array-Creation/Harbour/associative-array-creation-1.harbour @@ -0,0 +1,3 @@ +arr := { => } +arr[ 10 ] := "Val_10" +arr[ "foo" ] := "foovalue" diff --git a/Task/Associative-array-Creation/Harbour/associative-array-creation-2.harbour b/Task/Associative-array-Creation/Harbour/associative-array-creation-2.harbour new file mode 100644 index 0000000000..2d1ae01881 --- /dev/null +++ b/Task/Associative-array-Creation/Harbour/associative-array-creation-2.harbour @@ -0,0 +1,3 @@ +arr := hb_Hash( 10, "Val_10", "foo", "foovalue" ) +// or +arr := { 10 => "Val_10", "foo" => "foovalue" } diff --git a/Task/Associative-array-Creation/LFE/associative-array-creation.lfe b/Task/Associative-array-Creation/LFE/associative-array-creation.lfe new file mode 100644 index 0000000000..6a79d6a51b --- /dev/null +++ b/Task/Associative-array-Creation/LFE/associative-array-creation.lfe @@ -0,0 +1,5 @@ +(let* ((my-dict (: dict new)) + (my-dict (: dict store 'key-1 '"value 1" my-dict)) + (my-dict (: dict store 'key-2 '"value 2" my-dict))) + (: io format '"size: ~p~n" (list (: dict size my-dict))) + (: io format '"some data: ~p~n" (list (: dict fetch 'key-1 my-dict)))) diff --git a/Task/Associative-array-Creation/Lasso/associative-array-creation.lasso b/Task/Associative-array-Creation/Lasso/associative-array-creation.lasso new file mode 100644 index 0000000000..3f09055ecd --- /dev/null +++ b/Task/Associative-array-Creation/Lasso/associative-array-creation.lasso @@ -0,0 +1,38 @@ +// In Lasso associative arrays are called maps + +// Define an empty map +local(mymap = map) + +// Define a map with content +local(mymap = map( + 'one' = 'Monday', + '2' = 'Tuesday', + 3 = 'Wednesday' +)) + +// add elements to an existing map +#mymap -> insert('fourth' = 'Thursday') + +// retrieve a value from a map +#mymap -> find('2') // Tuesday +'
' +#mymap -> find(3) // Wednesday, found by the key not the position +'
' + +// Get all keys from a map +#mymap -> keys // staticarray(2, fourth, one, 3) +'
' + +// Iterate thru a map and get values +with v in #mymap do {^ + #v + '
' +^} +// Tuesday
Thursday
Monday
Wednesday
+ +// Perform actions on each value of a map +#mymap -> foreach => { + #1 -> uppercase + #1 -> reverse +} +#mymap // map(2 = YADSEUT, fourth = YADSRUHT, one = YADNOM, 3 = YADSENDEW) diff --git a/Task/Associative-array-Creation/Lingo/associative-array-creation.lingo b/Task/Associative-array-Creation/Lingo/associative-array-creation.lingo new file mode 100644 index 0000000000..d7ff7a8b49 --- /dev/null +++ b/Task/Associative-array-Creation/Lingo/associative-array-creation.lingo @@ -0,0 +1,10 @@ +props = [#key1: "value1", #key2: "value2"] + +put props[#key2] +-- "value2" +put props["key2"] +-- "value2" +put props.key2 +-- "value2" +put props.getProp(#key2) +-- "value2" diff --git a/Task/Associative-array-Creation/LiveCode/associative-array-creation-1.livecode b/Task/Associative-array-Creation/LiveCode/associative-array-creation-1.livecode new file mode 100644 index 0000000000..897c8ed6a0 --- /dev/null +++ b/Task/Associative-array-Creation/LiveCode/associative-array-creation-1.livecode @@ -0,0 +1,10 @@ +command assocArray + local tArray + put "value 1" into tArray["key 1"] + put 123 into tArray["key numbers"] + put "a,b,c" into tArray["abc"] + + put "number of elements:" && the number of elements of tArray & return & \ + "length of item 3:" && the length of tArray["abc"] & return & \ + "keys:" && the keys of tArray +end assocArray diff --git a/Task/Associative-array-Creation/LiveCode/associative-array-creation-2.livecode b/Task/Associative-array-Creation/LiveCode/associative-array-creation-2.livecode new file mode 100644 index 0000000000..66149e2bc0 --- /dev/null +++ b/Task/Associative-array-Creation/LiveCode/associative-array-creation-2.livecode @@ -0,0 +1,5 @@ +number of elements: 3 +length of item 3: 5 +keys: key numbers +abc +key 1 diff --git a/Task/Associative-array-Creation/Nim/associative-array-creation.nim b/Task/Associative-array-Creation/Nim/associative-array-creation.nim new file mode 100644 index 0000000000..641303de27 --- /dev/null +++ b/Task/Associative-array-Creation/Nim/associative-array-creation.nim @@ -0,0 +1,28 @@ +import tables + +var + hash = initTable[string, int]() # empty hash table + hash2 = {"key1": 1, "key2": 2}.toTable # hash table with two keys + hash3 = [("key1", 1), ("key2", 2)].toTable # hash table from tuple array + hash4 = @[("key1", 1), ("key2", 2)].toTable # hash table from tuple seq + value = hash2["key1"] + +hash["spam"] = 1 +hash["eggs"] = 2 +hash.add("foo", 3) + +echo "hash has ", hash.len, " elements" +echo "hash has key foo? ", hash.hasKey("foo") +echo "hash has key bar? ", hash.hasKey("bar") + +echo "iterate pairs:" # iterating over (key, value) pairs +for key, value in hash: + echo key, ": ", value + +echo "iterate keys:" # iterating over keys +for key in hash.keys: + echo key + +echo "iterate values:" # iterating over values +for key in hash.values: + echo key diff --git a/Task/Associative-array-Creation/Phix/associative-array-creation.phix b/Task/Associative-array-Creation/Phix/associative-array-creation.phix new file mode 100644 index 0000000000..455672dfc6 --- /dev/null +++ b/Task/Associative-array-Creation/Phix/associative-array-creation.phix @@ -0,0 +1,8 @@ +setd("one",1) +setd(2,"duo") +setd({3,4},{5,"six"}) +?getd("one") -- shows 1 +?getd({3,4}) -- shows {5,"six"} +?getd(2) -- shows "duo" +deld(2) +?getd(2) -- shows 0 diff --git a/Task/Associative-array-Creation/Potion/associative-array-creation.potion b/Task/Associative-array-Creation/Potion/associative-array-creation.potion new file mode 100644 index 0000000000..ee74f37eba --- /dev/null +++ b/Task/Associative-array-Creation/Potion/associative-array-creation.potion @@ -0,0 +1,8 @@ +mydictionary = (red=0xff0000, green=0x00ff00, blue=0x0000ff) + +redblue = "purple" +mydictionary put(redblue, 0xff00ff) + +255 == mydictionary("blue") +65280 == mydictionary("green") +16711935 == mydictionary("purple") diff --git a/Task/Associative-array-Creation/Sidef/associative-array-creation.sidef b/Task/Associative-array-Creation/Sidef/associative-array-creation.sidef new file mode 100644 index 0000000000..34cb21492b --- /dev/null +++ b/Task/Associative-array-Creation/Sidef/associative-array-creation.sidef @@ -0,0 +1,7 @@ +var hash = Hash.new( + key1 => 'value1', + key2 => 'value2', +); + +# Add a new key-value pair +hash{:key3} = 'value3'; diff --git a/Task/Associative-array-Creation/Swift/associative-array-creation.swift b/Task/Associative-array-Creation/Swift/associative-array-creation.swift new file mode 100644 index 0000000000..c2d8497cc3 --- /dev/null +++ b/Task/Associative-array-Creation/Swift/associative-array-creation.swift @@ -0,0 +1,13 @@ +// make an empty map +var a = [String: Int]() +// or +var b: [String: Int] = [:] + +// make an empty map with an initial capacity +var c = [String: Int](minimumCapacity: 42) + +// set a value +c["foo"] = 3 + +// make a map with a literal +var d = ["foo": 2, "bar": 42, "baz": -1] diff --git a/Task/Associative-array-Creation/Visual-FoxPro/associative-array-creation.visual b/Task/Associative-array-Creation/Visual-FoxPro/associative-array-creation.visual new file mode 100644 index 0000000000..3689e0dbca --- /dev/null +++ b/Task/Associative-array-Creation/Visual-FoxPro/associative-array-creation.visual @@ -0,0 +1,39 @@ +LOCAL loCol As Collection, k, n, o +CLEAR +*!* Example using strings +loCol = NEWOBJECT("Collection") +loCol.Add("Apples", "A") +loCol.Add("Oranges", "O") +loCol.Add("Pears", "P") +n = loCol.Count +? "Items:", n +*!* Loop through the collection +k = 1 +FOR EACH o IN loCol FOXOBJECT + ? o, loCol.GetKey(k) + k = k + 1 +ENDFOR +*!* Get an item by its key +? loCol("O") +? +*!* Example using objects +LOCAL loFruits As Collection +loFruits = NEWOBJECT("Collection") +loFruits.Add(CREATEOBJECT("fruit", "Apples"), "A") +loFruits.Add(CREATEOBJECT("fruit", "Oranges"), "O") +loFruits.Add(CREATEOBJECT("fruit", "Pears"), "P") +*!* Loop through the collection +k = 1 +FOR EACH o IN loFruits FOXOBJECT + ? o.Name, loFruits.GetKey(k) + k = k + 1 +ENDFOR +*!* Get an item name by its key +? loFruits("P").Name + + +DEFINE CLASS fruit As Custom +PROCEDURE Init(tcName As String) +THIS.Name = tcName +ENDPROC +ENDDEFINE diff --git a/Task/Associative-array-Creation/Wart/associative-array-creation.wart b/Task/Associative-array-Creation/Wart/associative-array-creation.wart new file mode 100644 index 0000000000..82b87e120e --- /dev/null +++ b/Task/Associative-array-Creation/Wart/associative-array-creation.wart @@ -0,0 +1,3 @@ +h <- (table 'a 1 'b 2) +h 'a +=> 1 diff --git a/Task/Associative-array-Creation/XLISP/associative-array-creation-1.xlisp b/Task/Associative-array-Creation/XLISP/associative-array-creation-1.xlisp new file mode 100644 index 0000000000..36a36d8c56 --- /dev/null +++ b/Task/Associative-array-Creation/XLISP/associative-array-creation-1.xlisp @@ -0,0 +1 @@ +(define starlings (make-table)) diff --git a/Task/Associative-array-Creation/XLISP/associative-array-creation-2.xlisp b/Task/Associative-array-Creation/XLISP/associative-array-creation-2.xlisp new file mode 100644 index 0000000000..62732864da --- /dev/null +++ b/Task/Associative-array-Creation/XLISP/associative-array-creation-2.xlisp @@ -0,0 +1,3 @@ +(table-set! starlings "Common starling" "Sturnus vulgaris") +(table-set! starlings "Abbot's starling" "Poeoptera femoralis") +(table-set! starlings "Cape starling" "Lamprotornis nitens") diff --git a/Task/Associative-array-Creation/XLISP/associative-array-creation-3.xlisp b/Task/Associative-array-Creation/XLISP/associative-array-creation-3.xlisp new file mode 100644 index 0000000000..6105b17044 --- /dev/null +++ b/Task/Associative-array-Creation/XLISP/associative-array-creation-3.xlisp @@ -0,0 +1 @@ +(table-ref starlings "Cape starling") diff --git a/Task/Associative-array-Creation/XLISP/associative-array-creation-4.xlisp b/Task/Associative-array-Creation/XLISP/associative-array-creation-4.xlisp new file mode 100644 index 0000000000..70463bf3d9 --- /dev/null +++ b/Task/Associative-array-Creation/XLISP/associative-array-creation-4.xlisp @@ -0,0 +1 @@ +(map-over-table-entries starlings (lambda (x y) (print (string-append x " (Linnaean name " y ")")))) diff --git a/Task/Associative-array-Creation/jq/associative-array-creation-1.jq b/Task/Associative-array-Creation/jq/associative-array-creation-1.jq new file mode 100644 index 0000000000..ed83953c9a --- /dev/null +++ b/Task/Associative-array-Creation/jq/associative-array-creation-1.jq @@ -0,0 +1,22 @@ +# An empty object: +{} + +# Its type: +{} | type +# "object" + +# An object literal: +{"a": 97, "b" : 98} + +# Programmatic object construction: +reduce ("a", "b", "c", "d") as $c ({}; . + { ($c) : ($c|explode[.0])} ) +# {"a":97,"c":99,"b":98,"d":100} + +# Same as above: +reduce range (97;101) as $i ({}; . + { ([$i]|implode) : $i }) + +# Addition of a key/value pair by assignment: +{}["A"] = 65 # in this case, the object being added to is {} + +# Alteration of the value of an existing key: +{"A": 65}["A"] = "AA" diff --git a/Task/Associative-array-Creation/jq/associative-array-creation-2.jq b/Task/Associative-array-Creation/jq/associative-array-creation-2.jq new file mode 100644 index 0000000000..cc70ab5429 --- /dev/null +++ b/Task/Associative-array-Creation/jq/associative-array-creation-2.jq @@ -0,0 +1,15 @@ +def collisionless: + if type == "object" then with_entries(.value = (.value|collisionless))|tostring + elif type == "array" then map(collisionless)|tostring + else (type[0:1] + tostring) + end; + +# WARNING: addKey(key;value) will erase any previous value associated with key +def addKey(key;value): + if type == "object" then . + { (key|collisionless): value } + else {} | addKey(key;value) + end; + +def getKey(key): .[key|collisionless]; + +def removeKey(key): delpaths( [ [key|collisionless] ] ); diff --git a/Task/Associative-array-Creation/jq/associative-array-creation-3.jq b/Task/Associative-array-Creation/jq/associative-array-creation-3.jq new file mode 100644 index 0000000000..d12ec798c5 --- /dev/null +++ b/Task/Associative-array-Creation/jq/associative-array-creation-3.jq @@ -0,0 +1 @@ +{} | addKey(1;"one") | addKey(2; "two") | removeKey(1) | getKey(2) diff --git a/Task/Associative-array-Creation/jq/associative-array-creation-4.jq b/Task/Associative-array-Creation/jq/associative-array-creation-4.jq new file mode 100644 index 0000000000..65693f7cff --- /dev/null +++ b/Task/Associative-array-Creation/jq/associative-array-creation-4.jq @@ -0,0 +1 @@ +"two" diff --git a/Task/Associative-array-Iteration/Ceylon/associative-array-iteration.ceylon b/Task/Associative-array-Iteration/Ceylon/associative-array-iteration.ceylon new file mode 100644 index 0000000000..e30e624b0f --- /dev/null +++ b/Task/Associative-array-Iteration/Ceylon/associative-array-iteration.ceylon @@ -0,0 +1,21 @@ +shared void run() { + + value myMap = map { + "foo" -> 5, + "bar" -> 10, + "baz" -> 15 + }; + + for(key in myMap.keys) { + print(key); + } + + for(item in myMap.items) { + print(item); + } + + for(key->item in myMap) { + print("``key`` maps to ``item``"); + } + +} diff --git a/Task/Associative-array-Iteration/EchoLisp/associative-array-iteration.echolisp b/Task/Associative-array-Iteration/EchoLisp/associative-array-iteration.echolisp new file mode 100644 index 0000000000..dcd1c25098 --- /dev/null +++ b/Task/Associative-array-Iteration/EchoLisp/associative-array-iteration.echolisp @@ -0,0 +1,24 @@ +(lib 'hash) ;; load hash.lib +(define H (make-hash)) +;; fill hash table +(hash-set H 'Simon 42) +(hash-set H 'Albert 666) +(hash-set H 'Antoinette 33) + +;; iterate over (key . value ) pairs +(for ([kv H]) (writeln kv)) +(Simon . 42) +(Albert . 666) +(Antoinette . 33) + +;; iterate over keys +(for ([k (hash-keys H)]) (writeln 'key-> k)) +key-> Simon +key-> Albert +key-> Antoinette + +;; iterate over values +(for ([v (hash-values H)]) (writeln 'value-> v)) +value-> 42 +value-> 666 +value-> 33 diff --git a/Task/Associative-array-Iteration/Harbour/associative-array-iteration.harbour b/Task/Associative-array-Iteration/Harbour/associative-array-iteration.harbour new file mode 100644 index 0000000000..39465740ab --- /dev/null +++ b/Task/Associative-array-Iteration/Harbour/associative-array-iteration.harbour @@ -0,0 +1,11 @@ +LOCAL arr := { 6 => 16, "eight" => 8, "eleven" => 11 } +LOCAL x + +FOR EACH x IN arr + // key, value + ? x:__enumKey(), x + // or key only + ? x:__enumKey() + // or value only + ? x +NEXT diff --git a/Task/Associative-array-Iteration/LFE/associative-array-iteration-1.lfe b/Task/Associative-array-Iteration/LFE/associative-array-iteration-1.lfe new file mode 100644 index 0000000000..6920c890d1 --- /dev/null +++ b/Task/Associative-array-Iteration/LFE/associative-array-iteration-1.lfe @@ -0,0 +1,7 @@ +(let ((data '(#(key1 "foo") #(key2 "bar"))) + (hash (: dict from_list data))) + (: dict fold + (lambda (key val accum) + (: io format '"~s: ~s~n" (list key val))) + 0 + hash)) diff --git a/Task/Associative-array-Iteration/LFE/associative-array-iteration-2.lfe b/Task/Associative-array-Iteration/LFE/associative-array-iteration-2.lfe new file mode 100644 index 0000000000..70f9e08009 --- /dev/null +++ b/Task/Associative-array-Iteration/LFE/associative-array-iteration-2.lfe @@ -0,0 +1,6 @@ +(let ((data '(#(key1 "foo") #(key2 "bar"))) + (hash (: dict from_list data))) + (: lists map + (lambda (key) + (: io format '"~s~n" (list key))) + (: dict fetch_keys hash))) diff --git a/Task/Associative-array-Iteration/Lasso/associative-array-iteration.lasso b/Task/Associative-array-Iteration/Lasso/associative-array-iteration.lasso new file mode 100644 index 0000000000..32aba5661c --- /dev/null +++ b/Task/Associative-array-Iteration/Lasso/associative-array-iteration.lasso @@ -0,0 +1,29 @@ +//iterate over associative array +//Lasso maps + local('aMap' = map('weight' = 112, + 'height' = 45, + 'name' = 'jason')) + ' Map output: \n ' + #aMap->forEachPair => {^ + //display pair, then show accessing key and value individually + #1+'\n ' + #1->first+': '+#1->second+'\n ' + ^} + //display keys and values separately + '\n' + ' Map Keys: '+#aMap->keys->join(',')+'\n' + ' Map values: '+#aMap->values->join(',')+'\n' + + //display using forEach + '\n' + ' Use ForEach to iterate Map keys: \n' + #aMap->keys->forEach => {^ + #1+'\n' + ^} + '\n' + ' Use ForEach to iterate Map values: \n' + #aMap->values->forEach => {^ + #1+'\n' + ^} + //the {^ ^} indicates that output should be printed (AutoCollect) , + // if output is not desired, just { } is used diff --git a/Task/Associative-array-Iteration/Lingo/associative-array-iteration.lingo b/Task/Associative-array-Iteration/Lingo/associative-array-iteration.lingo new file mode 100644 index 0000000000..28a5a2c43c --- /dev/null +++ b/Task/Associative-array-Iteration/Lingo/associative-array-iteration.lingo @@ -0,0 +1,11 @@ +hash = [#key1:"value1", #key2:"value2", #key3:"value3"] + +-- iterate over key-value pairs +repeat with i = 1 to hash.count + put hash.getPropAt(i) & "=" & hash[i] +end repeat + +-- iterating over values only can be written shorter +repeat with val in hash + put val +end repeat diff --git a/Task/Associative-array-Iteration/LiveCode/associative-array-iteration-1.livecode b/Task/Associative-array-Iteration/LiveCode/associative-array-iteration-1.livecode new file mode 100644 index 0000000000..8f53a80f24 --- /dev/null +++ b/Task/Associative-array-Iteration/LiveCode/associative-array-iteration-1.livecode @@ -0,0 +1,24 @@ +put 3 into fruit["apples"] +put 5 into fruit["pears"] +put 6 into fruit["oranges"] +put "none" into fruit["bananas"] + +put "Keys:" & cr & the keys of fruit & cr into tTmp +put "Values 1:" & tab after tTmp +repeat for each line tKey in the keys of fruit + put fruit[tkey] & comma after tTmp +end repeat + +-- need to copy array as combine will change variable +put fruit into fruit2 +combine fruit2 using comma +put cr & "Values2:" & tab after tTmp +repeat for each item f2val in fruit2 + put f2val & comma after tTmp +end repeat + +combine fruit using return and ":" +put cr & "Key:Values" & cr & fruit after tTmp +-- alternatively, use same loop as for values 1 with tkey && fruit[tKey] + +put tTmp diff --git a/Task/Associative-array-Iteration/LiveCode/associative-array-iteration-2.livecode b/Task/Associative-array-Iteration/LiveCode/associative-array-iteration-2.livecode new file mode 100644 index 0000000000..5914a8c56f --- /dev/null +++ b/Task/Associative-array-Iteration/LiveCode/associative-array-iteration-2.livecode @@ -0,0 +1,12 @@ +Keys: +apples +pears +oranges +bananas +Values 1: 3,5,6,none, +Values2: 3,none,6,5, +Key:Values +apples:3 +bananas:none +oranges:6 +pears:5 diff --git a/Task/Associative-array-Iteration/Nim/associative-array-iteration.nim b/Task/Associative-array-Iteration/Nim/associative-array-iteration.nim new file mode 100644 index 0000000000..052b5413d5 --- /dev/null +++ b/Task/Associative-array-Iteration/Nim/associative-array-iteration.nim @@ -0,0 +1,23 @@ +import tables + +var t: TTable[int,string] = initTable[int,string]() + +t[1] = "one" +t[2] = "two" +t[3] = "three" +t.add(4,"four") + +echo "t has " & $t.len & " elements" + +echo "has t key 4? " & $t.hasKey(4) +echo "has t key 5? " & $t.hasKey(5) + +#iterate keys +echo "key iteration:" +for k in t.keys: + echo "at[" & $k & "]=" & t[k] + +#itetate pairs +echo "pair iteration:" +for k,v in t.pairs: + echo "at[" & $k & "]=" & v diff --git a/Task/Associative-array-Iteration/Phix/associative-array-iteration-1.phix b/Task/Associative-array-Iteration/Phix/associative-array-iteration-1.phix new file mode 100644 index 0000000000..8013c48ad7 --- /dev/null +++ b/Task/Associative-array-Iteration/Phix/associative-array-iteration-1.phix @@ -0,0 +1,9 @@ +setd("one",1) +setd(2,"duo") +setd({3,4},{5,"six"}) + +function visitor(object key, object data, object /*userdata*/) + ?{key,data} + return 1 -- (continue traversal) +end function +traverse_dict(routine_id("visitor")) diff --git a/Task/Associative-array-Iteration/Phix/associative-array-iteration-2.phix b/Task/Associative-array-Iteration/Phix/associative-array-iteration-2.phix new file mode 100644 index 0000000000..b353296475 --- /dev/null +++ b/Task/Associative-array-Iteration/Phix/associative-array-iteration-2.phix @@ -0,0 +1,4 @@ +include builtins\map.e +?pairs() +?keys() +?values() diff --git a/Task/Associative-array-Iteration/Potion/associative-array-iteration.potion b/Task/Associative-array-Iteration/Potion/associative-array-iteration.potion new file mode 100644 index 0000000000..de7d5d9459 --- /dev/null +++ b/Task/Associative-array-Iteration/Potion/associative-array-iteration.potion @@ -0,0 +1,4 @@ +mydictionary = (red=0xff0000, green=0x00ff00, blue=0x0000ff) + +mydictionary each (key, val): (key, ":", val, "\n") join print. +mydictionary each (key): (key, "\n") join print. diff --git a/Task/Associative-array-Iteration/Sidef/associative-array-iteration.sidef b/Task/Associative-array-Iteration/Sidef/associative-array-iteration.sidef new file mode 100644 index 0000000000..09f5304311 --- /dev/null +++ b/Task/Associative-array-Iteration/Sidef/associative-array-iteration.sidef @@ -0,0 +1,19 @@ +var hash = Hash.new( + key1 => 'value1', + key2 => 'value2', +) + +# Iterate over key-value pairs +hash.each { |key, value| + say "#{key}: #{value}"; +} + +# Iterate only over keys +hash.keys.each { |key| + say key; +} + +# Iterate only over values +hash.values.each { |value| + say value; +} diff --git a/Task/Associative-array-Iteration/Swift/associative-array-iteration.swift b/Task/Associative-array-Iteration/Swift/associative-array-iteration.swift new file mode 100644 index 0000000000..ae4987f597 --- /dev/null +++ b/Task/Associative-array-Iteration/Swift/associative-array-iteration.swift @@ -0,0 +1,9 @@ +let myMap = [ + "hello": 13, + "world": 31, + "!" : 71 ] + +// iterating over key-value pairs: +for (key, value) in myMap { + println("key = \(key), value = \(value)") +} diff --git a/Task/Associative-array-Iteration/Wart/associative-array-iteration.wart b/Task/Associative-array-Iteration/Wart/associative-array-iteration.wart new file mode 100644 index 0000000000..fd808e1a1c --- /dev/null +++ b/Task/Associative-array-Iteration/Wart/associative-array-iteration.wart @@ -0,0 +1,3 @@ +h <- (table 'a 1 'b 2) +each (key val) table + prn key " " val diff --git a/Task/Atomic-updates/Lasso/atomic-updates.lasso b/Task/Atomic-updates/Lasso/atomic-updates.lasso new file mode 100644 index 0000000000..d5290a32f8 --- /dev/null +++ b/Task/Atomic-updates/Lasso/atomic-updates.lasso @@ -0,0 +1,76 @@ +define atomic => thread { + data + private buckets = staticarray_join(10, void), + private lock = 0 + + public onCreate => { + loop(.buckets->size) => { + .`buckets`->get(loop_count) = math_random(0, 1000) + } + } + + public buckets => .`buckets` + + public bucket(index::integer) => .`buckets`->get(#index) + + public transfer(source::integer, dest::integer, amount::integer) => { + #source == #dest + ? return + + #amount = math_min(#amount, .`buckets`->get(#source)) + .`buckets`->get(#source) -= #amount + .`buckets`->get(#dest) += #amount + } + + public numBuckets => .`buckets`->size + + public lock => { + .`lock` == 1 + ? return false + + .`lock` = 1 + return true + } + public unlock => { + .`lock` = 0 + } +} + +local(initial_total) = (with b in atomic->buckets sum #b) +local(total) = #initial_total + +// Make 2 buckets close to equal +local(_) = split_thread => { + local(bucket1) = math_random(1, atomic->numBuckets) + local(bucket2) = math_random(1, atomic->numBuckets) + local(value1) = atomic->bucket(#bucket1) + local(value2) = atomic->bucket(#bucket2) + + if(#value1 >= #value2) => { + atomic->transfer(#bucket1, #bucket2, (#value1 - #value2) / 2) + else + atomic->transfer(#bucket2, #bucket1, (#value2 - #value1) / 2) + } + + currentCapture->restart +} + +// Randomly distribute 2 buckets +local(_) = split_thread => { + local(bucket1) = math_random(1, atomic->numBuckets) + local(bucket2) = math_random(1, atomic->numBuckets) + local(value1) = atomic->bucket(#bucket1) + + atomic->transfer(#bucket1, #bucket2, math_random(1, #value1)) + + currentCapture->restart +} + +local(buckets) +while(#initial_total == #total) => { + sleep(2000) + #buckets = atomic->buckets + #total = with b in #buckets sum #b + stdoutnl(#buckets->asString + " -- total: " + #total) +} +stdoutnl(`ERROR: totals no longer match: ` + #initial_total + ', ' + #total) diff --git a/Task/Atomic-updates/Phix/atomic-updates.phix b/Task/Atomic-updates/Phix/atomic-updates.phix new file mode 100644 index 0000000000..ab372015ff --- /dev/null +++ b/Task/Atomic-updates/Phix/atomic-updates.phix @@ -0,0 +1,48 @@ +constant nBuckets = 20 +sequence buckets = tagset(nBuckets) -- {1,2,3,..,20} +constant bucket_cs = init_cs() -- critical section +atom equals = 0, rands = 0 -- operation counts +integer terminate = 0 -- control flag + +procedure mythreads(integer eq) +-- if eq then equalise else randomise +integer b1,b2,amt + while not terminate do + b1 = rand(nBuckets) + b2 = rand(nBuckets) + if b1!=b2 then -- (test not actually needed) + enter_cs(bucket_cs) + if eq then + amt = floor((buckets[b1]-buckets[b2])/2) + equals += 1 + else + amt = rand(buckets[b1]+1)-1 + rands += 1 + end if + buckets[b1] -= amt + buckets[b2] += amt + leave_cs(bucket_cs) + end if + end while + exit_thread(0) +end procedure + +procedure display() + enter_cs(bucket_cs) + ?{sum(buckets),equals,rands,buckets} + leave_cs(bucket_cs) +end procedure + +display() + +constant threads = {create_thread(routine_id("mythreads"),{1}), -- equalise + create_thread(routine_id("mythreads"),{0})} -- randomise + +constant ESC = #1B +while not find(get_key(),{ESC,'q','Q'}) do + sleep(1) + display() +end while +terminate = 1 +wait_thread(threads) +delete_cs(bucket_cs) diff --git a/Task/Average-loop-length/EchoLisp/average-loop-length.echolisp b/Task/Average-loop-length/EchoLisp/average-loop-length.echolisp new file mode 100644 index 0000000000..dd4197c5fc --- /dev/null +++ b/Task/Average-loop-length/EchoLisp/average-loop-length.echolisp @@ -0,0 +1,29 @@ +(lib 'math) ;; Σ aka (sigma f(n) nfrom nto) + +(define (f-count N (times 100000)) + (define count 0) + (for ((i times)) + + ;; new random f mapping from 0..N-1 to 0..N-1 + ;; (f n) is NOT (random N) + ;; because each call (f n) must return the same value + + (define f (build-vector N (lambda(i) (random N)))) + + (define hits (make-vector N)) + (define n 0) + (while (zero? [hits n]) + (++ count) + (vector+= hits n 1) + (set! n [f n]))) + (// count times)) + +(define (f-anal N) + (Σ (lambda(i) (// (! N) (! (- N i)) (^ N i))) 1 N)) + +(decimals 5) +(define (f-print (maxN 21)) + (for ((N (in-range 1 maxN))) + (define fc (f-count N)) + (define fa (f-anal N)) + (printf "%3d %10d %10d %10.2d %%" N fc fa (// (abs (- fa fc)) fc 0.01)))) diff --git a/Task/Average-loop-length/Nim/average-loop-length.nim b/Task/Average-loop-length/Nim/average-loop-length.nim new file mode 100644 index 0000000000..0179fe9023 --- /dev/null +++ b/Task/Average-loop-length/Nim/average-loop-length.nim @@ -0,0 +1,34 @@ +import math, strfmt +randomize() + +const + maxN = 20 + times = 1_000_000 + +proc factorial(n): float = + result = 1 + for i in 1 .. n: + result *= i.float + +proc expected(n): float = + for i in 1 .. n: + result += factorial(n) / pow(n.float, i.float) / factorial(n - i) + +proc test(n, times): int = + for i in 1 .. times: + var + x = 1 + bits = 0 + while (bits and x) == 0: + inc result + bits = bits or x + x = 1 shl random(n) + +echo " n\tavg\texp.\tdiff" +echo "-------------------------------" +for n in 1 .. maxN: + let cnt = test(n, times) + let avg = cnt.float / times + let theory = expected(n) + let diff = (avg / theory - 1) * 100 + printlnfmt "{:2} {:8.4f} {:8.4f} {:6.3f}%", n, avg, theory, diff diff --git a/Task/Average-loop-length/Phix/average-loop-length.phix b/Task/Average-loop-length/Phix/average-loop-length.phix new file mode 100644 index 0000000000..1730f198b3 --- /dev/null +++ b/Task/Average-loop-length/Phix/average-loop-length.phix @@ -0,0 +1,33 @@ +constant MAX = 20, + ITER = 1000000 + +function expected(integer n) +atom sum = 0 + for i=1 to n do + sum += factorial(n) / power(n,i) / factorial(n-i) + end for + return sum +end function + +function test(integer n) +integer count = 0, x, bits + for i=1 to ITER do + x = 1 + bits = 0 + while not and_bits(bits,x) do + count += 1 + bits = or_bits(bits,x) + x = power(2,rand(n)-1) + end while + end for + return count/ITER +end function + +atom av, ex + puts(1," n avg. exp. (error%)\n"); + puts(1,"== ====== ====== ========\n"); + for n=1 to MAX do + av = test(n) + ex = expected(n) + printf(1,"%2d %8.4f %8.4f (%5.3f%%)\n", {n,av,ex,abs(1-av/ex)*100}) + end for diff --git a/Task/Averages-Arithmetic-mean/8th/averages-arithmetic-mean.8th b/Task/Averages-Arithmetic-mean/8th/averages-arithmetic-mean.8th new file mode 100644 index 0000000000..c0fb8f22d8 --- /dev/null +++ b/Task/Averages-Arithmetic-mean/8th/averages-arithmetic-mean.8th @@ -0,0 +1,9 @@ +: avg \ a -- avg(a) + dup ' n:+ 0 a:reduce + swap a:len nip n:/ ; + +\ test: +[ 1.0, 2.3, 1.1, 5.0, 3, 2.8, 2.01, 3.14159 ] avg . cr +[ ] avg . cr +[ 10 ] avg . cr +bye diff --git a/Task/Averages-Arithmetic-mean/AntLang/averages-arithmetic-mean.antlang b/Task/Averages-Arithmetic-mean/AntLang/averages-arithmetic-mean.antlang new file mode 100644 index 0000000000..a63d353e08 --- /dev/null +++ b/Task/Averages-Arithmetic-mean/AntLang/averages-arithmetic-mean.antlang @@ -0,0 +1 @@ +avg[list] diff --git a/Task/Averages-Arithmetic-mean/ECL/averages-arithmetic-mean.ecl b/Task/Averages-Arithmetic-mean/ECL/averages-arithmetic-mean.ecl new file mode 100644 index 0000000000..963a9ab432 --- /dev/null +++ b/Task/Averages-Arithmetic-mean/ECL/averages-arithmetic-mean.ecl @@ -0,0 +1,6 @@ +AveVal(SET OF INTEGER s) := AVE(s); + +//example usage + +SetVals := [14,9,16,20,91]; +AveVal(SetVals) //returns 30.0 ; diff --git a/Task/Averages-Arithmetic-mean/EchoLisp/averages-arithmetic-mean.echolisp b/Task/Averages-Arithmetic-mean/EchoLisp/averages-arithmetic-mean.echolisp new file mode 100644 index 0000000000..4838b02b05 --- /dev/null +++ b/Task/Averages-Arithmetic-mean/EchoLisp/averages-arithmetic-mean.echolisp @@ -0,0 +1,21 @@ +(lib 'math) +(mean '(1 2 3 4)) ;; mean of a list + → 2.5 +(mean #(1 2 3 4)) ;; mean of a vector + → 2.5 + +(lib 'sequences) +(mean [1 3 .. 10]) ;; mean of a sequence + → 5 + +;; error handling +(mean 'elvis) + ⛔ error: mean : expected sequence : elvis +(mean ()) + 💣 error: mean : null is not an object +(mean #()) + 😐 warning: mean : zero-divide : empty-vector + → 0 +(mean [2 2 .. 2]) + 😁 warning: mean : zero-divide : empty-sequence + → 0 diff --git a/Task/Averages-Arithmetic-mean/FreeBASIC/averages-arithmetic-mean.freebasic b/Task/Averages-Arithmetic-mean/FreeBASIC/averages-arithmetic-mean.freebasic new file mode 100644 index 0000000000..4c8fd6d27a --- /dev/null +++ b/Task/Averages-Arithmetic-mean/FreeBASIC/averages-arithmetic-mean.freebasic @@ -0,0 +1,42 @@ +' FB 1.05.0 Win64 + +Function Mean(array() As Double) As Double + Dim length As Integer = Ubound(array) - Lbound(array) + 1 + If length = 0 Then + Return 0.0/0.0 'NaN + End If + Dim As Double sum = 0.0 + For i As Integer = LBound(array) To UBound(array) + sum += array(i) + Next + Return sum/length +End Function + +Function IsNaN(number As Double) As Boolean + Return Str(number) = "-1.#IND" ' NaN as a string in FB +End Function + +Dim As Integer n, i +Dim As Double num +Print "Sample input and output" +Print +Do + Input "How many numbers are to be input ? : ", n +Loop Until n > 0 +Dim vector(1 To N) As Double +Print +For i = 1 to n + Print " Number #"; i; " : "; + Input "", vector(i) +Next +Print +Print "Mean is"; Mean(vector()) +Print +Erase vector +num = Mean(vector()) +If IsNaN(num) Then + Print "After clearing the vector, the mean is 'NaN'" +End If +Print +Print "Press any key to quit the program" +Sleep diff --git a/Task/Averages-Arithmetic-mean/GEORGE/averages-arithmetic-mean.george b/Task/Averages-Arithmetic-mean/GEORGE/averages-arithmetic-mean.george new file mode 100644 index 0000000000..66381ad8e5 --- /dev/null +++ b/Task/Averages-Arithmetic-mean/GEORGE/averages-arithmetic-mean.george @@ -0,0 +1,7 @@ +R (n) P ; +0 +1, n rep (i) + R P + +] +n div +P diff --git a/Task/Averages-Arithmetic-mean/GFA-Basic/averages-arithmetic-mean.gfa b/Task/Averages-Arithmetic-mean/GFA-Basic/averages-arithmetic-mean.gfa new file mode 100644 index 0000000000..88641d469f --- /dev/null +++ b/Task/Averages-Arithmetic-mean/GFA-Basic/averages-arithmetic-mean.gfa @@ -0,0 +1,23 @@ +DIM a%(10) +FOR i%=0 TO 10 + a%(i%)=i%*2 + PRINT "element ";i%;" is ";a%(i%) +NEXT i% +PRINT "mean is ";@mean(a%) +' +FUNCTION mean(a%) + LOCAL i%,size%,sum + ' find size of array, + size%=DIM?(a%()) + ' return 0 for empty arrays + IF size%<=0 + RETURN 0 + ENDIF + ' find sum of all elements + sum=0 + FOR i%=0 TO size%-1 + sum=sum+a%(i%) + NEXT i% + ' mean is sum over size + RETURN sum/size% +ENDFUNC diff --git a/Task/Averages-Arithmetic-mean/Hy/averages-arithmetic-mean.hy b/Task/Averages-Arithmetic-mean/Hy/averages-arithmetic-mean.hy new file mode 100644 index 0000000000..ffc7f4ede5 --- /dev/null +++ b/Task/Averages-Arithmetic-mean/Hy/averages-arithmetic-mean.hy @@ -0,0 +1,3 @@ +(defn arithmetic-mean [xs] + (if xs + (/ (sum xs) (len xs)))) diff --git a/Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-1.lfe b/Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-1.lfe new file mode 100644 index 0000000000..6debf6514d --- /dev/null +++ b/Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-1.lfe @@ -0,0 +1,3 @@ +(defun mean (data) + (/ (lists:sum data) + (length data))) diff --git a/Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-2.lfe b/Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-2.lfe new file mode 100644 index 0000000000..fbb7ebeb32 --- /dev/null +++ b/Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-2.lfe @@ -0,0 +1,8 @@ +> (mean '(1 1)) +1.0 +> (mean '(1 2)) +1.5 +> (mean '(2 10)) +6.0 +> (mean '(6 12 18 24 30 36 42 48 54 60 66 72 78)) +42.0 diff --git a/Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-3.lfe b/Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-3.lfe new file mode 100644 index 0000000000..62382367da --- /dev/null +++ b/Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-3.lfe @@ -0,0 +1,3 @@ +(defmacro mean args + `(/ (lists:sum ,args) + ,(length args))) diff --git a/Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-4.lfe b/Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-4.lfe new file mode 100644 index 0000000000..7055a142b7 --- /dev/null +++ b/Task/Averages-Arithmetic-mean/LFE/averages-arithmetic-mean-4.lfe @@ -0,0 +1,6 @@ +> (mean 42) +42.0 +> (mean 18 66) +42.0 +> (mean 6 12 18 24 30 36 42 48 54 60 66 72 78) +42.0 diff --git a/Task/Averages-Arithmetic-mean/Lasso/averages-arithmetic-mean.lasso b/Task/Averages-Arithmetic-mean/Lasso/averages-arithmetic-mean.lasso new file mode 100644 index 0000000000..6e8c6593bc --- /dev/null +++ b/Task/Averages-Arithmetic-mean/Lasso/averages-arithmetic-mean.lasso @@ -0,0 +1,8 @@ +define average(a::array) => { + not #a->size ? return 0 + local(x = 0.0) + with i in #a do => { #x += #i } + return #x / #a->size +} + +average(array(1,2,5,17,7.4)) //6.48 diff --git a/Task/Averages-Arithmetic-mean/LiveCode/averages-arithmetic-mean.livecode b/Task/Averages-Arithmetic-mean/LiveCode/averages-arithmetic-mean.livecode new file mode 100644 index 0000000000..42cfa7d584 --- /dev/null +++ b/Task/Averages-Arithmetic-mean/LiveCode/averages-arithmetic-mean.livecode @@ -0,0 +1,2 @@ +average(1,2,3,4,5) -- 3 +average(empty) -- 0 diff --git a/Task/Averages-Arithmetic-mean/Nim/averages-arithmetic-mean.nim b/Task/Averages-Arithmetic-mean/Nim/averages-arithmetic-mean.nim new file mode 100644 index 0000000000..491cece56f --- /dev/null +++ b/Task/Averages-Arithmetic-mean/Nim/averages-arithmetic-mean.nim @@ -0,0 +1,11 @@ +import strutils + +proc mean(xs): float = + for x in xs: + result += x + result = result / float(xs.len) + +var v = @[1.0, 2.0, 2.718, 3.0, 3.142] +for i in 0..5: + echo "mean of first ", v.len, " = ", formatFloat(mean(v), precision = 0) + v.setLen(v.high) diff --git a/Task/Averages-Arithmetic-mean/Oforth/averages-arithmetic-mean.oforth b/Task/Averages-Arithmetic-mean/Oforth/averages-arithmetic-mean.oforth new file mode 100644 index 0000000000..e6f3e8827d --- /dev/null +++ b/Task/Averages-Arithmetic-mean/Oforth/averages-arithmetic-mean.oforth @@ -0,0 +1,2 @@ +[1, 2, 2.718, 3, 3.142] avg println +[ ] avg println diff --git a/Task/Averages-Arithmetic-mean/Phix/averages-arithmetic-mean.phix b/Task/Averages-Arithmetic-mean/Phix/averages-arithmetic-mean.phix new file mode 100644 index 0000000000..f4efc0a859 --- /dev/null +++ b/Task/Averages-Arithmetic-mean/Phix/averages-arithmetic-mean.phix @@ -0,0 +1,6 @@ +function mean(sequence s) + if length(s)=0 then return 0 end if + return sum(s)/length(s) +end function + +? mean({1, 2, 5, -5, -9.5, 3.14159}) diff --git a/Task/Averages-Arithmetic-mean/Ring/averages-arithmetic-mean.ring b/Task/Averages-Arithmetic-mean/Ring/averages-arithmetic-mean.ring new file mode 100644 index 0000000000..b4cd3af8fb --- /dev/null +++ b/Task/Averages-Arithmetic-mean/Ring/averages-arithmetic-mean.ring @@ -0,0 +1,9 @@ +nums = [1,2,3,4,5,6,7,8,9,10] +sum = 0 +see "Average = " + average(nums) + nl + +func average numbers + for i = 1 to len(numbers) + sum = sum + nums[i] + next + return sum/len(numbers) diff --git a/Task/Averages-Arithmetic-mean/Sidef/averages-arithmetic-mean.sidef b/Task/Averages-Arithmetic-mean/Sidef/averages-arithmetic-mean.sidef new file mode 100644 index 0000000000..cb65d428f5 --- /dev/null +++ b/Task/Averages-Arithmetic-mean/Sidef/averages-arithmetic-mean.sidef @@ -0,0 +1,10 @@ +func avg(Array list) { + list.len > 0 || return 0; + list.sum / list.len; +} + +say avg([Math.inf, Math.inf]); +say avg([3,1,4,1,5,9]); +say avg([1e+20, 3, 1, 4, 1, 5, 9, -1e+20]); +say avg([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0.11]); +say avg([10, 20, 30, 40, 50, -100, 4.7, -1100]); diff --git a/Task/Averages-Arithmetic-mean/Swift/averages-arithmetic-mean.swift b/Task/Averages-Arithmetic-mean/Swift/averages-arithmetic-mean.swift new file mode 100644 index 0000000000..d9d453741e --- /dev/null +++ b/Task/Averages-Arithmetic-mean/Swift/averages-arithmetic-mean.swift @@ -0,0 +1,6 @@ +func meanDoubles(s: [Double]) -> Double { + return s.reduce(0, +) / Double(s.count) +} +func meanInts(s: [Int]) -> Double { + return meanDoubles(s.map{Double($0)}) +} diff --git a/Task/Averages-Arithmetic-mean/Ursa/averages-arithmetic-mean.ursa b/Task/Averages-Arithmetic-mean/Ursa/averages-arithmetic-mean.ursa new file mode 100644 index 0000000000..7acabde12e --- /dev/null +++ b/Task/Averages-Arithmetic-mean/Ursa/averages-arithmetic-mean.ursa @@ -0,0 +1,11 @@ +# +# arithmetic mean +# + +decl int<> input +decl int i +for (set i 1) (< i (size args)) (inc i) + append (int args) input +end for + +out (/ (+ input) (size input)) endl console diff --git a/Task/Averages-Arithmetic-mean/Wart/averages-arithmetic-mean.wart b/Task/Averages-Arithmetic-mean/Wart/averages-arithmetic-mean.wart new file mode 100644 index 0000000000..8256f8eb08 --- /dev/null +++ b/Task/Averages-Arithmetic-mean/Wart/averages-arithmetic-mean.wart @@ -0,0 +1,2 @@ +def (mean l) + sum.l / len.l diff --git a/Task/Averages-Arithmetic-mean/Wortel/averages-arithmetic-mean.wortel b/Task/Averages-Arithmetic-mean/Wortel/averages-arithmetic-mean.wortel new file mode 100644 index 0000000000..37e1a22cfb --- /dev/null +++ b/Task/Averages-Arithmetic-mean/Wortel/averages-arithmetic-mean.wortel @@ -0,0 +1,12 @@ +@let { + ; using a fork (sum divided-by length) + mean1 @(@sum / #) + + ; using a function with a named argument + mean2 &a / @sum a #a + + [[ + !mean1 [3 1 4 1 5 9 2] + !mean2 [3 1 4 1 5 9 2] + ]] +} diff --git a/Task/Averages-Arithmetic-mean/Wren/averages-arithmetic-mean.wren b/Task/Averages-Arithmetic-mean/Wren/averages-arithmetic-mean.wren new file mode 100644 index 0000000000..f98c7c2b38 --- /dev/null +++ b/Task/Averages-Arithmetic-mean/Wren/averages-arithmetic-mean.wren @@ -0,0 +1,7 @@ +class Arithmetic { + static mean(arr) { + if (arr.count == 0) Fiber.abort("Length must be greater than zero") + return arr.reduce(Fn.new{ |x,y| x+y }) / arr.count + } +} +Arithmetic.mean([1,2,3,4,5]) // 3 diff --git a/Task/Averages-Arithmetic-mean/XLISP/averages-arithmetic-mean.xlisp b/Task/Averages-Arithmetic-mean/XLISP/averages-arithmetic-mean.xlisp new file mode 100644 index 0000000000..32294e1399 --- /dev/null +++ b/Task/Averages-Arithmetic-mean/XLISP/averages-arithmetic-mean.xlisp @@ -0,0 +1,5 @@ +(defun mean (v) + (if (= (vector-length v) 0) + nil + (let ((l (vector->list v))) + (/ (apply + l) (length l))))) diff --git a/Task/Averages-Arithmetic-mean/jq/averages-arithmetic-mean-1.jq b/Task/Averages-Arithmetic-mean/jq/averages-arithmetic-mean-1.jq new file mode 100644 index 0000000000..0eaa6dc134 --- /dev/null +++ b/Task/Averages-Arithmetic-mean/jq/averages-arithmetic-mean-1.jq @@ -0,0 +1 @@ +add/length diff --git a/Task/Averages-Arithmetic-mean/jq/averages-arithmetic-mean-2.jq b/Task/Averages-Arithmetic-mean/jq/averages-arithmetic-mean-2.jq new file mode 100644 index 0000000000..3d2b59863d --- /dev/null +++ b/Task/Averages-Arithmetic-mean/jq/averages-arithmetic-mean-2.jq @@ -0,0 +1,3 @@ +def mean: if length == 0 then null + else add/length + end; diff --git a/Task/Averages-Mean-angle/EchoLisp/averages-mean-angle.echolisp b/Task/Averages-Mean-angle/EchoLisp/averages-mean-angle.echolisp new file mode 100644 index 0000000000..aa2bc3f249 --- /dev/null +++ b/Task/Averages-Mean-angle/EchoLisp/averages-mean-angle.echolisp @@ -0,0 +1,14 @@ +(define-syntax-rule (deg->radian deg) (* deg 1/180 PI)) +(define-syntax-rule (radian->deg rad) (* 180 (/ PI) rad)) + +(define (mean-angles angles) + (radian->deg + (angle + (for/sum ((a angles)) (make-polar 1 (deg->radian a)))))) + +(mean-angles '( 350 10)) + → -0 +(mean-angles '[90 180 270 360]) + → -90 +(mean-angles '[10 20 30]) + → 20 diff --git a/Task/Averages-Mean-angle/FreeBASIC/averages-mean-angle.freebasic b/Task/Averages-Mean-angle/FreeBASIC/averages-mean-angle.freebasic new file mode 100644 index 0000000000..c2464ab94b --- /dev/null +++ b/Task/Averages-Mean-angle/FreeBASIC/averages-mean-angle.freebasic @@ -0,0 +1,25 @@ +' FB 1.05.0 Win64 + +Const PI As Double = 3.1415926535897932 + +Function MeanAngle(angles() As Double) As Double + Dim As Integer length = Ubound(angles) - Lbound(angles) + 1 + Dim As Double sinSum = 0.0 + Dim As Double cosSum = 0.0 + For i As Integer = LBound(angles) To UBound(angles) + sinSum += Sin(angles(i) * PI / 180.0) + cosSum += Cos(angles(i) * PI / 180.0) + Next + Return Atan2(sinSum / length, cosSum / length) * 180.0 / PI +End Function + +Dim As Double angles1(1 To 2) = {350, 10} +Dim As Double angles2(1 To 4) = {90, 180, 270, 360} +Dim As Double angles3(1 To 3) = {10, 20, 30} + +Print Using "Mean for angles 1 is : ####.## degrees"; MeanAngle(angles1()) +Print Using "Mean for angles 2 is : ####.## degrees"; MeanAngle(angles2()) +Print Using "Mean for angles 3 is : ####.## degrees"; MeanAngle(angles3()) +Print +Print "Press any key to quit the program" +Sleep diff --git a/Task/Averages-Mean-angle/Nim/averages-mean-angle.nim b/Task/Averages-Mean-angle/Nim/averages-mean-angle.nim new file mode 100644 index 0000000000..55635307b7 --- /dev/null +++ b/Task/Averages-Mean-angle/Nim/averages-mean-angle.nim @@ -0,0 +1,17 @@ +import math, complex + +proc rect(r, phi): Complex = (r * cos(phi), sin(phi)) +proc phase(c): float = arctan2(c.im, c.re) + +proc radians(x): float = (x * Pi) / 180.0 +proc degrees(x): float = (x * 180.0) / Pi + +proc meanAngle(deg): float = + var c: Complex + for d in deg: + c += rect(1.0, radians(d)) + degrees(phase(c / float(deg.len))) + +echo "The 1st mean angle is: ", meanAngle([350.0, 10.0]), " degrees" +echo "The 2nd mean angle is: ", meanAngle([90.0, 180.0, 270.0, 360.0]), " degrees" +echo "The 3rd mean angle is: ", meanAngle([10.0, 20.0, 30.0]), " degrees" diff --git a/Task/Averages-Mean-angle/Phix/averages-mean-angle.phix b/Task/Averages-Mean-angle/Phix/averages-mean-angle.phix new file mode 100644 index 0000000000..4f42895c3b --- /dev/null +++ b/Task/Averages-Mean-angle/Phix/averages-mean-angle.phix @@ -0,0 +1,24 @@ +function atan2(atom y, atom x) + return 2*arctan((sqrt(power(x,2)+power(y,2))-x)/y) +end function + +function MeanAngle(sequence angles) +atom x=0, y=0, ai_rad +integer l=length(angles) + + for i=1 to l do + ai_rad = angles[i]*PI/180 + x += cos(ai_rad) + y += sin(ai_rad) + end for + if abs(x)<1e-16 then return "not meaningful" end if + return sprintf("%9.5f",atan2(y,x)*180/PI) +end function + +constant AngleLists = {{350,10},{90,180,270,360},{10,20,30},{180},{0,180}} +sequence ai +for i=1 to length(AngleLists) do + ai = AngleLists[i] + printf(1,"%+16s: Mean Angle is %s\n",{sprint(ai),MeanAngle(ai)}) +end for +{} = wait_key() diff --git a/Task/Averages-Mean-angle/Sidef/averages-mean-angle.sidef b/Task/Averages-Mean-angle/Sidef/averages-mean-angle.sidef new file mode 100644 index 0000000000..e91d17e16d --- /dev/null +++ b/Task/Averages-Mean-angle/Sidef/averages-mean-angle.sidef @@ -0,0 +1,10 @@ +func mean_angle(angles) { + Math.atan2( + Math.avg(angles.map{ .deg2rad.sin }...), + Math.avg(angles.map{ .deg2rad.cos }...), + ) -> rad2deg; +} + +[[350,10], [90,180,270,360], [10,20,30]].each { |angles| + say "The mean angle of #{angles.dump} is: #{ '%.2f' % mean_angle(angles)} degrees"; +} diff --git a/Task/Averages-Mean-angle/jq/averages-mean-angle-1.jq b/Task/Averages-Mean-angle/jq/averages-mean-angle-1.jq new file mode 100644 index 0000000000..0210e2bcdb --- /dev/null +++ b/Task/Averages-Mean-angle/jq/averages-mean-angle-1.jq @@ -0,0 +1,19 @@ +def pi: 4 * (1|atan); + +def deg2rad: . * pi / 180; + +def rad2deg: if . == null then null else . * 180 / pi end; + +# Input: [x,y] (special handling of x==0) +# Output: [r, theta] where theta may be null +def to_polar: + if .[0] == 0 + then [1, if .[1] > 5e-14 then pi/2 elif .[1] < -5e-14 then -pi/2 else null end] + else [1, ((.[1]/.[0]) | atan)] + end; + +def from_polar: .[1] | [ cos, sin]; + +def abs: if . < 0 then - . else . end; + +def summation(f): map(f) | add; diff --git a/Task/Averages-Mean-angle/jq/averages-mean-angle-2.jq b/Task/Averages-Mean-angle/jq/averages-mean-angle-2.jq new file mode 100644 index 0000000000..c551d8a832 --- /dev/null +++ b/Task/Averages-Mean-angle/jq/averages-mean-angle-2.jq @@ -0,0 +1,15 @@ +# input: degrees +def mean_angle: + def round: + if . == null then null + elif . < 0 then -1 * ((- .) | round) | if . == -0 then 0 else . end + else ((. + 3e-14) | floor) as $x + | if ($x - .) | abs < 3e-14 then $x else . end + end; + + map( [1, deg2rad] | from_polar) + | [ summation(.[0]), summation(.[1]) ] + | to_polar + | .[1] + | rad2deg + | round; diff --git a/Task/Averages-Mean-angle/jq/averages-mean-angle-3.jq b/Task/Averages-Mean-angle/jq/averages-mean-angle-3.jq new file mode 100644 index 0000000000..17a0e37e25 --- /dev/null +++ b/Task/Averages-Mean-angle/jq/averages-mean-angle-3.jq @@ -0,0 +1,2 @@ +([350, 10], [90, 180, 270, 360], [10, 20, 30]) +| "The mean angle of \(.) is: \(mean_angle)" diff --git a/Task/Averages-Mean-angle/jq/averages-mean-angle-4.jq b/Task/Averages-Mean-angle/jq/averages-mean-angle-4.jq new file mode 100644 index 0000000000..66e489155e --- /dev/null +++ b/Task/Averages-Mean-angle/jq/averages-mean-angle-4.jq @@ -0,0 +1,4 @@ +jq -r -n -f Mean_angle.jq +The mean angle of [350,10] is: 0 +The mean angle of [90,180,270,360] is: null +The mean angle of [10,20,30] is: 20 diff --git a/Task/Averages-Mean-time-of-day/EchoLisp/averages-mean-time-of-day.echolisp b/Task/Averages-Mean-time-of-day/EchoLisp/averages-mean-time-of-day.echolisp new file mode 100644 index 0000000000..12c213f5d3 --- /dev/null +++ b/Task/Averages-Mean-time-of-day/EchoLisp/averages-mean-time-of-day.echolisp @@ -0,0 +1,21 @@ +;; string hh:mm:ss to radians +(define (time->radian time) + (define-values (h m s) (map string->number (string-split time ":"))) + (+ (* h (/ PI 12)) (* m (/ PI 12 60)) (* s (/ PI 12 3600)))) + +;; radians to string hh:mm;ss +(define (radian->time rad) + (when (< rad 0) (+= rad (* 2 PI))) + (define t (round (/ (* 12 3600 rad) PI))) + (define h (quotient t 3600)) + (define m (quotient (- t (* h 3600)) 60)) + (define s (- t (* 3600 h) (* 60 m))) + (string-join (map number->string (list h m s)) ":")) + +(define (mean-time times) + (radian->time + (angle + (for/sum ((t times)) (make-polar 1 (time->radian t)))))) + +(mean-time '{"23:00:17" "23:40:20" "00:12:45" "00:17:19"}) + → "23:47:43" diff --git a/Task/Averages-Mean-time-of-day/FreeBASIC/averages-mean-time-of-day.freebasic b/Task/Averages-Mean-time-of-day/FreeBASIC/averages-mean-time-of-day.freebasic new file mode 100644 index 0000000000..097b3b95a4 --- /dev/null +++ b/Task/Averages-Mean-time-of-day/FreeBASIC/averages-mean-time-of-day.freebasic @@ -0,0 +1,54 @@ +' FB 1.05.0 Win64 + +Const pi As Double = 3.1415926535897932 + +Function meanAngle(angles() As Double) As Double + Dim As Integer length = Ubound(angles) - Lbound(angles) + 1 + Dim As Double sinSum = 0.0 + Dim As Double cosSum = 0.0 + For i As Integer = LBound(angles) To UBound(angles) + sinSum += Sin(angles(i) * pi / 180.0) + cosSum += Cos(angles(i) * pi / 180.0) + Next + Return Atan2(sinSum / length, cosSum / length) * 180.0 / pi +End Function + +' time string assumed to be in format "hh:mm:ss" +Function timeToSecs(t As String) As Integer + Dim As Integer hours = Val(Left(t, 2)) + Dim As Integer mins = Val(Mid(t, 4, 2)) + Dim As Integer secs = Val(Right(t, 2)) + Return 3600 * hours + 60 * mins + secs +End Function + +' 1 second of time = 360/(24 * 3600) = 1/240th degree +Function timeToDegrees(t As String) As Double + Dim secs As Integer = timeToSecs(t) + Return secs/240.0 +End Function + +Function degreesToTime(d As Double) As String + If d < 0 Then d += 360.0 + Dim secs As Integer = d * 240.0 + Dim hours As Integer = secs \ 3600 + Dim mins As Integer = secs Mod 3600 + secs = mins Mod 60 + mins = mins \ 60 + Dim hBuffer As String = Right("0" + Str(hours), 2) + Dim mBuffer As String = Right("0" + Str(mins), 2) + Dim sBuffer As String = Right("0" + Str(secs), 2) + Return hBuffer + ":" + mBuffer + ":" + sBuffer +End Function + +Dim tm(1 To 4) As String = {"23:00:17", "23:40:20", "00:12:45", "00:17:19"} +Dim angles(1 To 4) As Double + +For i As Integer = 1 To 4 + angles(i) = timeToDegrees(tm(i)) +Next + +Dim mean As Double = meanAngle(angles()) +Print "Average time is : "; degreesToTime(mean) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Averages-Mean-time-of-day/Nim/averages-mean-time-of-day.nim b/Task/Averages-Mean-time-of-day/Nim/averages-mean-time-of-day.nim new file mode 100644 index 0000000000..7ef8c37880 --- /dev/null +++ b/Task/Averages-Mean-time-of-day/Nim/averages-mean-time-of-day.nim @@ -0,0 +1,26 @@ +import math, complex, strutils + +proc rect(r, phi): Complex = (r * cos(phi), sin(phi)) +proc phase(c): float = arctan2(c.im, c.re) + +proc radians(x): float = (x * Pi) / 180.0 +proc degrees(x): float = (x * 180.0) / Pi + +proc meanAngle(deg): float = + var c: Complex + for d in deg: + c += rect(1.0, radians(d)) + degrees(phase(c / float(deg.len))) + +proc meanTime(times): string = + const day = 24 * 60 * 60 + let + angles = times.map(proc(time: string): float = + let t = time.split(":") + (t[2].parseInt + t[1].parseInt * 60 + t[0].parseInt * 3600) * 360 / day) + ms = (angles.meanAngle * day / 360 + day) mod day + (h,m,s) = (ms.int div 3600, (ms.int mod 3600) div 60, ms.int mod 60) + + align($h, 2, '0') &":"& align($m, 2, '0') &":"& align($s, 2, '0') + +echo meanTime(["23:00:17", "23:40:20", "00:12:45", "00:17:19"]) diff --git a/Task/Averages-Mean-time-of-day/Phix/averages-mean-time-of-day.phix b/Task/Averages-Mean-time-of-day/Phix/averages-mean-time-of-day.phix new file mode 100644 index 0000000000..b50bc1c624 --- /dev/null +++ b/Task/Averages-Mean-time-of-day/Phix/averages-mean-time-of-day.phix @@ -0,0 +1,37 @@ +function atan2(atom y, atom x) + return 2*arctan((sqrt(power(x,2)+power(y,2))-x)/y) +end function + +function MeanAngle(sequence angles) +atom x=0, y=0, ai_rad +integer l=length(angles) + + for i=1 to l do + ai_rad = angles[i]*PI/180 + x += cos(ai_rad) + y += sin(ai_rad) + end for + if abs(x)<1e-16 then return "not meaningful" end if + return atan2(y,x)*180/PI +end function + +function toSecAngle(integer hours, integer minutes, integer seconds) + return ((hours*60+minutes)*60+seconds)/(24*60*60)*360 +end function + +constant Times = {toSecAngle(23,00,17), + toSecAngle(23,40,20), + toSecAngle(00,12,45), + toSecAngle(00,17,19)} + +function toHMS(object s) + if not string(s) then + if s<0 then s+=360 end if + s = 24*60*60*s/360 + s = sprintf("%02d:%02d:%02d",{floor(s/3600),floor(remainder(s,3600)/60),remainder(s,60)}) + end if + return s +end function + +printf(1,"Mean Time is %s\n",{toHMS(MeanAngle(Times))}) +{} = wait_key() diff --git a/Task/Averages-Mean-time-of-day/Sidef/averages-mean-time-of-day.sidef b/Task/Averages-Mean-time-of-day/Sidef/averages-mean-time-of-day.sidef new file mode 100644 index 0000000000..56c069e849 --- /dev/null +++ b/Task/Averages-Mean-time-of-day/Sidef/averages-mean-time-of-day.sidef @@ -0,0 +1,17 @@ +func time2deg(t) { + (var m = t.match(/^(\d\d):(\d\d):(\d\d)$/)) || die "invalid time" + var (hh,mm,ss) = m.cap.map{.to_i}... + ((hh ~~ 24.range) && (mm ~~ 60.range) && (ss ~~ 60.range)) || die "invalid time" + (hh*3600 + mm*60 + ss) * 360 / 86400 +} +  +func deg2time(d) { + var sec = ((d % 360) * 86400 / 360) + "%02d:%02d:%02d" % (sec/3600, (sec%3600)/60, sec%60) +} +  +func mean_time(times) { + deg2time(mean_angle(times.map {|t| time2deg(t)})) +} +  +say mean_time(["23:00:17", "23:40:20", "00:12:45", "00:17:19"]) diff --git a/Task/Averages-Mean-time-of-day/jq/averages-mean-time-of-day-1.jq b/Task/Averages-Mean-time-of-day/jq/averages-mean-time-of-day-1.jq new file mode 100644 index 0000000000..b563624233 --- /dev/null +++ b/Task/Averages-Mean-time-of-day/jq/averages-mean-time-of-day-1.jq @@ -0,0 +1,31 @@ +# input: array of "h:m:s" +def mean_time_of_day: + def pi: 4 * (1|atan); + def to_radians: pi * . /(12*60*60); + def from_radians: (. * 12*60*60) / pi; + + def secs2time: # produce "hh:mm:ss" string + def pad: tostring | (2 - length) * "0" + .; + "\(./60/60 % 24 | pad):\(./60 % 60 | pad):\(. % 60 | pad)"; + + def round: + if . < 0 then -1 * ((- .) | round) | if . == -0 then 0 else . end + else floor as $x + | if (. - $x) < 0.5 then $x else $x+1 end + end; + + map( split(":") + | map(tonumber) + | (.[0]*3600 + .[1]*60 + .[2]) + | to_radians ) + | (map(sin) | add) as $y + | (map(cos) | add) as $x + | if $x == 0 then (if $y > 3e-14 then pi/2 elif $y < -3e-14 then -(pi/2) else null end) + else ($y / $x) | atan + end + | if . == null then null + else from_radians + | if (.<0) then . + (24*60*60) else . end + | round + | secs2time + end ; diff --git a/Task/Averages-Mean-time-of-day/jq/averages-mean-time-of-day-2.jq b/Task/Averages-Mean-time-of-day/jq/averages-mean-time-of-day-2.jq new file mode 100644 index 0000000000..5c1a4f2613 --- /dev/null +++ b/Task/Averages-Mean-time-of-day/jq/averages-mean-time-of-day-2.jq @@ -0,0 +1,8 @@ +["0:0:0", "12:0:0" ], +["0:0:0", "24:0:0" ], +["1:0:0", "1:0:0" ], +["20:0:0", "4:0:0" ], +["20:0:0", "4:0:2" ], +["23:0:0", "23:0:0" ], +["23:00:17", "23:40:20", "00:12:45", "00:17:19"] +| mean_time_of_day diff --git a/Task/Averages-Mean-time-of-day/jq/averages-mean-time-of-day-3.jq b/Task/Averages-Mean-time-of-day/jq/averages-mean-time-of-day-3.jq new file mode 100644 index 0000000000..4ab73fdb70 --- /dev/null +++ b/Task/Averages-Mean-time-of-day/jq/averages-mean-time-of-day-3.jq @@ -0,0 +1,8 @@ +$ jq -r -n -f Mean_time_of_day.jq +null +00:00:00 +01:00:00 +00:00:00 +00:00:01 +23:00:00 +23:47:43 diff --git a/Task/Averages-Median/AntLang/averages-median.antlang b/Task/Averages-Median/AntLang/averages-median.antlang new file mode 100644 index 0000000000..116153ade1 --- /dev/null +++ b/Task/Averages-Median/AntLang/averages-median.antlang @@ -0,0 +1 @@ +median[list] diff --git a/Task/Averages-Median/ERRE/averages-median.erre b/Task/Averages-Median/ERRE/averages-median.erre new file mode 100644 index 0000000000..3071e3af26 --- /dev/null +++ b/Task/Averages-Median/ERRE/averages-median.erre @@ -0,0 +1,36 @@ +PROGRAM MEDIAN + +DIM X[10] + +PROCEDURE QUICK_SELECT + LT=0 RT=L-1 + J=LT + REPEAT + PT=X[K] + SWAP(X[K],X[RT]) + P=LT + FOR I=P TO RT-1 DO + IF X[I]=K THEN RT=P-1 END IF + UNTIL J>RT +END PROCEDURE + +PROCEDURE MEDIAN + K=INT(L/2) + QUICK_SELECT + R=X[K] + IF L-2*INT(L/2)<>0 THEN R=(R+X[K+1])/2 END IF +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) !CLS + X[0]=4.4 X[1]=2.3 X[2]=-1.7 X[3]=7.5 X[4]=6.6 X[5]=0 + X[6]=1.9 X[7]=8.2 X[8]=9.3 X[9]=4.5 X[10]=-11.7 + L=11 + MEDIAN + PRINT(R) +END PROGRAM diff --git a/Task/Averages-Median/EchoLisp/averages-median.echolisp b/Task/Averages-Median/EchoLisp/averages-median.echolisp new file mode 100644 index 0000000000..1b74fde4b1 --- /dev/null +++ b/Task/Averages-Median/EchoLisp/averages-median.echolisp @@ -0,0 +1,15 @@ +(define (median L) ;; O(n log(n)) + (set! L (vector-sort! < (list->vector L))) + (define dim (// (vector-length L) 2)) + (if (integer? dim) + (// (+ [L dim] [L (1- dim)]) 2) + [L (floor dim)])) + +(median '( 3 4 5)) + → 4 +(median '(6 5 4 3)) + → 4.5 +(median (iota 10000)) + → 4999.5 +(median (iota 10001)) + → 5000 diff --git a/Task/Averages-Median/FreeBASIC/averages-median.freebasic b/Task/Averages-Median/FreeBASIC/averages-median.freebasic new file mode 100644 index 0000000000..c41069890c --- /dev/null +++ b/Task/Averages-Median/FreeBASIC/averages-median.freebasic @@ -0,0 +1,46 @@ +' FB 1.05.0 Win64 + +Sub quicksort(a() As Double, first As Integer, last As Integer) + Dim As Integer length = last - first + 1 + If length < 2 Then Return + Dim pivot As Double = a(first + length\ 2) + Dim lft As Integer = first + Dim rgt As Integer = last + While lft <= rgt + While a(lft) < pivot + lft +=1 + Wend + While a(rgt) > pivot + rgt -= 1 + Wend + If lft <= rgt Then + Swap a(lft), a(rgt) + lft += 1 + rgt -= 1 + End If + Wend + quicksort(a(), first, rgt) + quicksort(a(), lft, last) +End Sub + +Function median(a() As Double) As Double + Dim lb As Integer = LBound(a) + Dim ub As Integer = UBound(a) + Dim length As Integer = ub - lb + 1 + If length = 0 Then Return 0.0/0.0 '' NaN + If length = 1 Then Return a(ub) + Dim mb As Integer = (lb + ub) \2 + If length Mod 2 = 1 Then Return a(mb) + Return (a(mb) + a(mb + 1))/2.0 +End Function + +Dim a(0 To 9) As Double = {4.4, 2.3, -1.7, 7.5, 6.6, 0.0, 1.9, 8.2, 9.3, 4.5} +quicksort(a(), 0, 9) +Print "Median for all 10 elements : "; median(a()) +' now get rid of final element +Dim b(0 To 8) As Double = {4.4, 2.3, -1.7, 7.5, 6.6, 0.0, 1.9, 8.2, 9.3} +quicksort(b(), 0, 8) +Print "Median for first 9 elements : "; median(b()) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Averages-Median/Lasso/averages-median.lasso b/Task/Averages-Median/Lasso/averages-median.lasso new file mode 100644 index 0000000000..0e0d79eeec --- /dev/null +++ b/Task/Averages-Median/Lasso/averages-median.lasso @@ -0,0 +1,15 @@ +define median_ext(a::array) => { + #a->sort + + if(#a->size % 2) => { + // odd numbered element array, pick middle + return #a->get(#a->size / 2 + 1) + + else + // even number elements in array + return (#a->get(#a->size / 2) + #a->get(#a->size / 2 + 1)) / 2.0 + } +} + +median_ext(array(3,2,7,6)) // 4.5 +median_ext(array(3,2,9,7,6)) // 6 diff --git a/Task/Averages-Median/LiveCode/averages-median-1.livecode b/Task/Averages-Median/LiveCode/averages-median-1.livecode new file mode 100644 index 0000000000..40df6fd75d --- /dev/null +++ b/Task/Averages-Median/LiveCode/averages-median-1.livecode @@ -0,0 +1,2 @@ +put median("4.1,5.6,7.2,1.7,9.3,4.4,3.2") & "," & median("4.1,7.2,1.7,9.3,4.4,3.2") +returns 4.4, 4.25 diff --git a/Task/Averages-Median/LiveCode/averages-median-2.livecode b/Task/Averages-Median/LiveCode/averages-median-2.livecode new file mode 100644 index 0000000000..12f008571a --- /dev/null +++ b/Task/Averages-Median/LiveCode/averages-median-2.livecode @@ -0,0 +1,24 @@ +function floor n + if n < 0 then + return (trunc(n) - 1) + else + return trunc(n) + end if +end floor + +function median2 x + local n, m + set itemdelimiter to comma + sort items of x ascending numeric + put the number of items of x into n + put floor(n / 2) into m + if n mod 2 is 0 then + return (item m of x + item (m + 1) of x) / 2 + else + return item (m + 1) of x + end if +end median2 + +returns the same as the built-in median, viz. +put median2("4.1,5.6,7.2,1.7,9.3,4.4,3.2") & "," & median2("4.1,7.2,1.7,9.3,4.4,3.2") +4.4,4.25 diff --git a/Task/Averages-Median/Nim/averages-median.nim b/Task/Averages-Median/Nim/averages-median.nim new file mode 100644 index 0000000000..a4162b6304 --- /dev/null +++ b/Task/Averages-Median/Nim/averages-median.nim @@ -0,0 +1,11 @@ +import algorithm, strutils + +proc median(xs): float = + var ys = xs + sort(ys, system.cmp[float]) + 0.5 * (ys[ys.high div 2] + ys[ys.len div 2]) + +var a = @[4.1, 5.6, 7.2, 1.7, 9.3, 4.4, 3.2] +echo formatFloat(median(a), precision = 0) +a = @[4.1, 7.2, 1.7, 9.3, 4.4, 3.2] +echo formatFloat(median(a), precision = 0) diff --git a/Task/Averages-Median/Phix/averages-median-1.phix b/Task/Averages-Median/Phix/averages-median-1.phix new file mode 100644 index 0000000000..32333743a5 --- /dev/null +++ b/Task/Averages-Median/Phix/averages-median-1.phix @@ -0,0 +1,12 @@ +function median(sequence s) +atom res=0 +integer l = length(s), k = floor((l+1)/2) + if l then + s = sort(s) + res = s[k] + if remainder(l,2)=0 then + res = (res+s[k+1])/2 + end if + end if + return res +end function diff --git a/Task/Averages-Median/Phix/averages-median-2.phix b/Task/Averages-Median/Phix/averages-median-2.phix new file mode 100644 index 0000000000..6ddce6800c --- /dev/null +++ b/Task/Averages-Median/Phix/averages-median-2.phix @@ -0,0 +1,12 @@ +function medianq(sequence s) +atom res=0, tmp +integer l = length(s), k = floor((l+1)/2) + if l then + {s,res} = quick_select(s,k) + if remainder(l,2)=0 then + {s,tmp} = quick_select(s,k+1) + res = (res+tmp)/2 + end if + end if + return res -- (or perhaps return {s,res}) +end function diff --git a/Task/Averages-Median/Ring/averages-median.ring b/Task/Averages-Median/Ring/averages-median.ring new file mode 100644 index 0000000000..848a17501c --- /dev/null +++ b/Task/Averages-Median/Ring/averages-median.ring @@ -0,0 +1,9 @@ +aList = [5,4,2,3] +see "medium : " + median(aList) + nl + +func median aray + srtd = sort(aray) + alen = len(srtd) + if alen % 2 = 0 + return (srtd[alen/2] + srtd[alen/2 + 1]) / 2.0 + else return srtd[ceil(alen/2)] ok diff --git a/Task/Averages-Median/Sidef/averages-median.sidef b/Task/Averages-Median/Sidef/averages-median.sidef new file mode 100644 index 0000000000..f82988ac9c --- /dev/null +++ b/Task/Averages-Median/Sidef/averages-median.sidef @@ -0,0 +1,5 @@ +func median(arry) { + var srtd = arry.sort; + var alen = srtd.length; + srtd[(alen-1)/2]+srtd[alen/2] / 2; +} diff --git a/Task/Averages-Median/Wortel/averages-median.wortel b/Task/Averages-Median/Wortel/averages-median.wortel new file mode 100644 index 0000000000..c6a9f6533f --- /dev/null +++ b/Task/Averages-Median/Wortel/averages-median.wortel @@ -0,0 +1,14 @@ +@let { + ; iterative + med1 &l @let {a @sort l s #a i @/s 2 ?{%%s 2 ~/ 2 +`-i 1 a `i a `i a}} + + ; tacit + med2 ^(\~/2 @sum @(^(\&![#~f #~c] \~/2 \~-1 #) @` @id) @sort) + + [[ + !med1 [4 2 5 2 1] + !med1 [4 5 2 1] + !med2 [4 2 5 2 1] + !med2 [4 5 2 1] + ]] +} diff --git a/Task/Averages-Median/jq/averages-median-1.jq b/Task/Averages-Median/jq/averages-median-1.jq new file mode 100644 index 0000000000..006fc34fc4 --- /dev/null +++ b/Task/Averages-Median/jq/averages-median-1.jq @@ -0,0 +1,10 @@ +def median: + length as $length + | sort as $s + | if $length == 0 then null + else ($length / 2 | floor) as $l2 + | if ($length % 2) == 0 then + ($s[$l2 - 1] + $s[$l2]) / 2 + else $s[$l2] + end + end ; diff --git a/Task/Averages-Median/jq/averages-median-2.jq b/Task/Averages-Median/jq/averages-median-2.jq new file mode 100644 index 0000000000..528a1d6549 --- /dev/null +++ b/Task/Averages-Median/jq/averages-median-2.jq @@ -0,0 +1,2 @@ +[4.1, 5.6, 7.2, 1.7, 9.3, 4.4, 3.2] +[4.1, 7.2, 1.7, 9.3, 4.4, 3.2] diff --git a/Task/Averages-Median/jq/averages-median-3.jq b/Task/Averages-Median/jq/averages-median-3.jq new file mode 100644 index 0000000000..5b70173338 --- /dev/null +++ b/Task/Averages-Median/jq/averages-median-3.jq @@ -0,0 +1,3 @@ +$ jq -f median.jq in.dat +4.4 +4.25 diff --git a/Task/Averages-Mode/ERRE/averages-mode.erre b/Task/Averages-Mode/ERRE/averages-mode.erre new file mode 100644 index 0000000000..7915ba0a41 --- /dev/null +++ b/Task/Averages-Mode/ERRE/averages-mode.erre @@ -0,0 +1,61 @@ +PROGRAM MODE_AVG + +!$INTEGER + +DIM A[10],B[10],Z[10] + +PROCEDURE SORT(Z[],P->Z[]) + LOCAL N,FLIPS + FLIPS=TRUE + WHILE FLIPS DO + FLIPS=FALSE + FOR N=0 TO P-1 DO + IF Z[N]>Z[N+1] THEN SWAP(Z[N],Z[N+1]) FLIPS=TRUE + END FOR + END WHILE +END PROCEDURE + +PROCEDURE CALC_MODE(Z[],P->MODES$) + LOCAL I,OCCURRENCE,MAXOCCURRENCE,OLDVAL + SORT(Z[],P->Z[]) + OCCURENCE=1 + MAXOCCURENCE=0 + OLDVAL=Z[0] + MODES$="" + FOR I=1 TO P DO + IF Z[I]=OLDVAL THEN + OCCURENCE=OCCURENCE+1 + ELSE + IF OCCURENCE>MAXOCCURENCE THEN + MAXOCCURENCE=OCCURENCE + MODES$=STR$(OLDVAL) + ELSIF OCCURENCE=MAXOCCURENCE THEN + MODES$=MODES$+STR$(OLDVAL) + ELSE + !$NULL + END IF + OCCURENCE=1 + END IF + OLDVAL=Z[I] + END FOR + !check after loop + IF OCCURENCE>MAXOCCURENCE THEN + MAXOCCURENCE=OCCURENCE + MODES$=STR$(OLDVAL) + ELSIF OCCURENCE=MAXOCCURENCE THEN + MODES$=MODES$+STR$(OLDVAL) + ELSE + !$NULL + END IF +END PROCEDURE + +BEGIN + A[]=(1,3,6,6,6,6,7,7,12,12,17) + B[]=(1,2,4,4,1) + PRINT("Modes for array A (1,3,6,6,6,6,7,7,12,12,17)";) + CALC_MODE(A[],10->MODES$) + PRINT(MODES$) + PRINT("Modes for array B (1,2,4,4,1)";) + CALC_MODE(B[],4->MODES$) + PRINT(MODES$) +END PROGRAM diff --git a/Task/Averages-Mode/EchoLisp/averages-mode.echolisp b/Task/Averages-Mode/EchoLisp/averages-mode.echolisp new file mode 100644 index 0000000000..5ef3497e2a --- /dev/null +++ b/Task/Averages-Mode/EchoLisp/averages-mode.echolisp @@ -0,0 +1,16 @@ +(define (modes L) + (define G (group* L)) ;; sorts and group equal items + (define cardmax (for/max [(g G)] (length g))) + (map first (filter (lambda(g) (= cardmax (length g))) G))) + +(modes '( a b c a d e f)) + → (a) +(modes (iota 6)) + → (0 1 2 3 4 5) +(modes '(x)) + → (x) +(modes '(🎾 🏉 ☕️ 🎾 🎲 🎯 🎺 ☕️ 🎲 🎸 🎻 🏆 ☕️ 🏁 🎾 🎲 🎻 🏉 )) + → (🎾 ☕️ 🎲) + +(modes '()) +😖️ error: group : expected list : null 🔎 'modes' diff --git a/Task/Averages-Mode/FreeBASIC/averages-mode.freebasic b/Task/Averages-Mode/FreeBASIC/averages-mode.freebasic new file mode 100644 index 0000000000..8dc6197023 --- /dev/null +++ b/Task/Averages-Mode/FreeBASIC/averages-mode.freebasic @@ -0,0 +1,66 @@ +' FB 1.05.0 Win64 + +Sub quicksort(a() As Integer, first As Integer, last As Integer) + Dim As Integer length = last - first + 1 + If length < 2 Then Return + Dim pivot As Integer = a(first + length\ 2) + Dim lft As Integer = first + Dim rgt As Integer = last + While lft <= rgt + While a(lft) < pivot + lft +=1 + Wend + While a(rgt) > pivot + rgt -= 1 + Wend + If lft <= rgt Then + Swap a(lft), a(rgt) + lft += 1 + rgt -= 1 + End If + Wend + quicksort(a(), first, rgt) + quicksort(a(), lft, last) +End Sub + +' The modal value(s) is/are stored in 'm'. +' The function returns the modal count. +Function mode(a() As Integer, m() As Integer, sorted As Boolean = false) As Integer + Dim lb As Integer = LBound(a) + Dim ub As Integer = UBound(a) + If ub = -1 Then Return 0 '' empty array + If Not sorted Then quicksort(a(), lb, ub) + Dim cValue As Integer = a(lb) + Dim cCount As Integer = 1 + Dim cMax As Integer = 0 + '' We iterate to the end of the array plus 1 to ensure the + '' final value is dealt with properly + For i As Integer = lb + 1 To ub + 1 + If i <= ub AndAlso a(i) = cValue Then + cCount += 1 + Else + If cCount > cMax Then + Erase m + Redim m(1 To 1) + m(1) = cValue + cMax = cCount + ElseIf cCount = cMax Then + Redim Preserve m(1 To UBound(m) + 1) + m(UBound(m)) = cValue + End If + If i = ub + 1 Then Exit For + cValue = a(i) + cCount = 1 + End If + Next + Return cMax +End Function + +Dim a(1 To 14) As Integer = {1, 2, 3, 1, 2, 4, 2, 5, 2, 3, 3, 1, 3, 6} +Dim m() As Integer '' to store the mode(s) +Dim mCount As Integer = mode(a(), m()) +Print "The following are the modes which occur"; mCount; " times : " +For i As Integer = LBound(m) To UBound(m) : Print m(i); " "; : Next +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Averages-Mode/Lasso/averages-mode.lasso b/Task/Averages-Mode/Lasso/averages-mode.lasso new file mode 100644 index 0000000000..fe83ade545 --- /dev/null +++ b/Task/Averages-Mode/Lasso/averages-mode.lasso @@ -0,0 +1,12 @@ +define getmode(a::array)::array => { + local(mmap = map, maxv = 0, modes = array) + // store counts + with e in #a do => { #mmap->keys >> #e ? #mmap->find(#e) += 1 | #mmap->insert(#e = 1) } + // get max value + with e in #mmap->keys do => { #mmap->find(#e) > #maxv ? #maxv = #mmap->find(#e) } + // get modes with max value + with e in #mmap->keys where #mmap->find(#e) == #maxv do => { #modes->insert(#e) } + return #modes +} +getmode(array(1,3,6,6,6,6,7,7,12,12,17)) +getmode(array(1,3,6,3,4,8,9,1,2,3,2,2)) diff --git a/Task/Averages-Mode/Nim/averages-mode.nim b/Task/Averages-Mode/Nim/averages-mode.nim new file mode 100644 index 0000000000..ae044d1de0 --- /dev/null +++ b/Task/Averages-Mode/Nim/averages-mode.nim @@ -0,0 +1,10 @@ +import tables + +proc modes[T](xs: openArray[T]): T = + var count = initCountTable[T]() + for x in xs: + count.inc(x) + largest(count).key + +echo modes(@[1,3,6,6,6,6,7,7,12,12,17]) +echo modes(@[1,1,2,4,4]) diff --git a/Task/Averages-Mode/Phix/averages-mode.phix b/Task/Averages-Mode/Phix/averages-mode.phix new file mode 100644 index 0000000000..bb394f535d --- /dev/null +++ b/Task/Averages-Mode/Phix/averages-mode.phix @@ -0,0 +1,40 @@ +function mode(sequence s) +-- returns a list of the most common values, each of which occurs the same number of times +object this +integer nxt = 1, count = 1, maxc = 1 +sequence res = {} + if length(s)!=0 then + s = sort(s) + this = s[1] + for i=2 to length(s) do + if s[i]!=this then + s[nxt] = {count,this} + nxt += 1 + this = s[i] + count = 1 + else + count += 1 + if count>maxc then + maxc = count + end if + end if + end for + s[nxt] = {count,this} + res = "" + for i=1 to nxt do + if s[i][1]=maxc then + res = append(res,s[i][2]) + end if + end for + end if + return res +end function + +?mode({1, 2, 5, -5, -9.5, 3.14159}) +?mode({ 1, "blue", 2, 7.5, 5, "green", "red", 5, 2, "blue", "white" }) +?mode({1, 2, 3, 1, 2, 4, 2, 5, 2, 3, 3, 1, 3, 6}) +?mode({.2, .7, .1, .8, .2}) +?mode({"two", 7, 1, 8, "two", 8}) +?mode("Hello there world") +?mode({}) +{} = wait_key() diff --git a/Task/Averages-Mode/Sidef/averages-mode-1.sidef b/Task/Averages-Mode/Sidef/averages-mode-1.sidef new file mode 100644 index 0000000000..ceedb684f1 --- /dev/null +++ b/Task/Averages-Mode/Sidef/averages-mode-1.sidef @@ -0,0 +1,6 @@ +func mode(array) { + var c = Hash.new; + array.each{|i| c{i} := 0 ++}; + var max = c.values.max; + c.keys.grep{|i| c{i} == max}; +} diff --git a/Task/Averages-Mode/Sidef/averages-mode-2.sidef b/Task/Averages-Mode/Sidef/averages-mode-2.sidef new file mode 100644 index 0000000000..04c17cf222 --- /dev/null +++ b/Task/Averages-Mode/Sidef/averages-mode-2.sidef @@ -0,0 +1,2 @@ +say mode([1, 3, 6, 6, 6, 6, 7, 7, 12, 12, 17]).join(' '); +say mode([1, 1, 2, 4, 4]).join(' '); diff --git a/Task/Averages-Mode/Sidef/averages-mode-3.sidef b/Task/Averages-Mode/Sidef/averages-mode-3.sidef new file mode 100644 index 0000000000..3c3aee7e1d --- /dev/null +++ b/Task/Averages-Mode/Sidef/averages-mode-3.sidef @@ -0,0 +1,3 @@ +func one_mode(arr) { + arr.max_by{|i| arr.count(i)}; +} diff --git a/Task/Averages-Mode/Wren/averages-mode.wren b/Task/Averages-Mode/Wren/averages-mode.wren new file mode 100644 index 0000000000..04315207ea --- /dev/null +++ b/Task/Averages-Mode/Wren/averages-mode.wren @@ -0,0 +1,13 @@ +class Arithmetic { + static mode(arr) { + var map = {} + for (e in arr) { + if (map[e] == null) map[e] = 0 + map[e] = map[e] + 1 + } + var max = map.values.reduce {|x, y| x > y ? x : y} + return map.keys.where {|x| map[x] == max}.toList + } +} + +System.print(Arithmetic.mode([1,2,3,4,5,5,51,2,3])) diff --git a/Task/Averages-Mode/jq/averages-mode-1.jq b/Task/Averages-Mode/jq/averages-mode-1.jq new file mode 100644 index 0000000000..cdffaf2d3c --- /dev/null +++ b/Task/Averages-Mode/jq/averages-mode-1.jq @@ -0,0 +1,19 @@ +# modes/0 produces an array of [value, count] +# in increasing order of count: +def modes: + sort | reduce .[] as $i ([]; + # state variable is an array of [value, count] + if length == 0 then [ [$i, 1] ] + elif .[-1][0] == $i then setpath([-1,1]; .[-1][1] + 1) + else . + [[$i,1]] + end ) + | sort_by( .[1] ); + +# mode/0 outputs a stream of the modal values; +# if the input array is empty, the output stream is also empty. +def mode: + if length == 0 then empty + else modes as $modes + | $modes[-1][1] as $count + | $modes[] | select( .[1] == $count) | .[0] + end; diff --git a/Task/Averages-Mode/jq/averages-mode-2.jq b/Task/Averages-Mode/jq/averages-mode-2.jq new file mode 100644 index 0000000000..b86a8efadf --- /dev/null +++ b/Task/Averages-Mode/jq/averages-mode-2.jq @@ -0,0 +1,3 @@ +[1,2,3,1,2,1] | mode # => 1 +[1,2,3,1,2,1,2] | mode # => 1 2 +[1.1, 1.2, 1.3, 1.1, 1.2, 1.1] | mode) # => 1.1 diff --git a/Task/Averages-Pythagorean-means/ERRE/averages-pythagorean-means.erre b/Task/Averages-Pythagorean-means/ERRE/averages-pythagorean-means.erre new file mode 100644 index 0000000000..aa3f8b1cff --- /dev/null +++ b/Task/Averages-Pythagorean-means/ERRE/averages-pythagorean-means.erre @@ -0,0 +1,43 @@ +PROGRAM MEANS + +DIM A[9] + +PROCEDURE ARITHMETIC_MEAN(A[]->M) + LOCAL S,I% + NEL%=UBOUND(A,1) + S=0 + FOR I%=0 TO NEL% DO + S+=A[I%] + END FOR + M=S/(NEL%+1) +END PROCEDURE + +PROCEDURE GEOMETRIC_MEAN(A[]->M) + LOCAL S,I% + NEL%=UBOUND(A,1) + S=1 + FOR I%=0 TO NEL% DO + S*=A[I%] + END FOR + M=S^(1/(NEL%+1)) +END PROCEDURE + +PROCEDURE HARMONIC_MEAN(A[]->M) + LOCAL S,I% + NEL%=UBOUND(A,1) + S=0 + FOR I%=0 TO NEL% DO + S+=1/A[I%] + END FOR + M=(NEL%+1)/S +END PROCEDURE + +BEGIN + A[]=(1,2,3,4,5,6,7,8,9,10) + ARITHMETIC_MEAN(A[]->M) + PRINT("Arithmetic mean = ";M) + GEOMETRIC_MEAN(A[]->M) + PRINT("Geometric mean = ";M) + HARMONIC_MEAN(A[]->M) + PRINT("Harmonic mean = ";M) +END PROGRAM diff --git a/Task/Averages-Pythagorean-means/EchoLisp/averages-pythagorean-means.echolisp b/Task/Averages-Pythagorean-means/EchoLisp/averages-pythagorean-means.echolisp new file mode 100644 index 0000000000..ae22b35cc5 --- /dev/null +++ b/Task/Averages-Pythagorean-means/EchoLisp/averages-pythagorean-means.echolisp @@ -0,0 +1,9 @@ +(define (A xs) (// (for/sum ((x xs)) x) (length xs))) + +(define (G xs) (expt (for/product ((x xs)) x) (// (length xs)))) + +(define (H xs) (// (length xs) (for/sum ((x xs)) (// x)))) + +(define xs (range 1 11)) +(and (>= (A xs) (G xs)) (>= (G xs) (H xs))) + → #t diff --git a/Task/Averages-Pythagorean-means/FreeBASIC/averages-pythagorean-means.freebasic b/Task/Averages-Pythagorean-means/FreeBASIC/averages-pythagorean-means.freebasic new file mode 100644 index 0000000000..947c3365d6 --- /dev/null +++ b/Task/Averages-Pythagorean-means/FreeBASIC/averages-pythagorean-means.freebasic @@ -0,0 +1,40 @@ +' FB 1.05.0 Win64 + +Function ArithmeticMean(array() As Double) As Double + Dim length As Integer = Ubound(array) - Lbound(array) + 1 + Dim As Double sum = 0.0 + For i As Integer = LBound(array) To UBound(array) + sum += array(i) + Next + Return sum/length +End Function + +Function GeometricMean(array() As Double) As Double + Dim length As Integer = Ubound(array) - Lbound(array) + 1 + Dim As Double product = 1.0 + For i As Integer = LBound(array) To UBound(array) + product *= array(i) + Next + Return product ^ (1.0 / length) +End Function + +Function HarmonicMean(array() As Double) As Double + Dim length As Integer = Ubound(array) - Lbound(array) + 1 + Dim As Double sum = 0.0 + For i As Integer = LBound(array) To UBound(array) + sum += 1.0 / array(i) + Next + Return length / sum +End Function + +Dim vector(1 To 10) As Double +For i As Integer = 1 To 10 + vector(i) = i +Next + +Print "Arithmetic mean is :"; ArithmeticMean(vector()) +Print "Geometric mean is :"; GeometricMean(vector()) +Print "Harmonic mean is :"; HarmonicMean(vector()) +Print +Print "Press any key to quit the program" +Sleep diff --git a/Task/Averages-Pythagorean-means/FunL/averages-pythagorean-means.funl b/Task/Averages-Pythagorean-means/FunL/averages-pythagorean-means.funl new file mode 100644 index 0000000000..753e5ca8d8 --- /dev/null +++ b/Task/Averages-Pythagorean-means/FunL/averages-pythagorean-means.funl @@ -0,0 +1,16 @@ +import lists.zip + +def + mean( s, 0 ) = product( s )^(1/s.length()) + mean( s, p ) = (1/s.length() sum( x^p | x <- s ))^(1/p) + +def + monotone( [_], _ ) = true + monotone( a1:a2:as, p ) = p( a1, a2 ) and monotone( a2:as, p ) + +means = [mean( 1..10, m ) | m <- [1, 0, -1]] + +for (m, l) <- zip( means, ['Arithmetic', 'Geometric', 'Harmonic'] ) + println( "$l: $m" + (if m is Rational then " or ${m.doubleValue()}" else '') ) + +println( monotone(means, (>=)) ) diff --git a/Task/Averages-Pythagorean-means/Futhark/averages-pythagorean-means.futhark b/Task/Averages-Pythagorean-means/Futhark/averages-pythagorean-means.futhark new file mode 100644 index 0000000000..480f2732b7 --- /dev/null +++ b/Task/Averages-Pythagorean-means/Futhark/averages-pythagorean-means.futhark @@ -0,0 +1,13 @@ +fun arithmetic_mean(as: [n]f64): f64 = + reduce (+) 0.0 (map (/f64(n)) as) + +fun geometric_mean(as: [n]f64): f64 = + reduce (*) 1.0 (map (**(1.0/f64(n))) as) + +fun harmonic_mean(as: [n]f64): f64 = + f64(n) / reduce (+) 0.0 (map (1.0/) as) + +fun main(as: [n]f64): (f64,f64,f64) = + (arithmetic_mean as, + geometric_mean as, + harmonic_mean as) diff --git a/Task/Averages-Pythagorean-means/Lasso/averages-pythagorean-means.lasso b/Task/Averages-Pythagorean-means/Lasso/averages-pythagorean-means.lasso new file mode 100644 index 0000000000..a52a4a4f19 --- /dev/null +++ b/Task/Averages-Pythagorean-means/Lasso/averages-pythagorean-means.lasso @@ -0,0 +1,18 @@ +define arithmetic_mean(a::staticarray)::decimal => { + //sum of the list divided by its length + return (with e in #a sum #e) / decimal(#a->size) +} +define geometric_mean(a::staticarray)::decimal => { + // The geometric mean is the nth root of the product of the list + local(prod = 1) + with e in #a do => { #prod *= #e } + return math_pow(#prod,1/decimal(#a->size)) +} +define harmonic_mean(a::staticarray)::decimal => { + // The harmonic mean is n divided by the sum of the reciprocal of each item in the list + return decimal(#a->size)/(with e in #a sum 1/decimal(#e)) +} + +arithmetic_mean(generateSeries(1,10)->asStaticArray) +geometric_mean(generateSeries(1,10)->asStaticArray) +harmonic_mean(generateSeries(1,10)->asStaticArray) diff --git a/Task/Averages-Pythagorean-means/Nim/averages-pythagorean-means.nim b/Task/Averages-Pythagorean-means/Nim/averages-pythagorean-means.nim new file mode 100644 index 0000000000..b0f1278695 --- /dev/null +++ b/Task/Averages-Pythagorean-means/Nim/averages-pythagorean-means.nim @@ -0,0 +1,25 @@ +import math, sequtils, future + +proc amean(num): float = + sum(num) / float(len(num)) + +proc gmean(num): float = + result = 1 + for n in num: result *= n + result = pow(result, 1.0 / float(num.len)) + +proc hmean(num): float = + for n in num: result += 1.0 / n + result = float(num.len) / result + +proc ameanFunctional(num: seq[float]): float = + sum(num) / float(num.len) + +proc gmeanFunctional(num: seq[float]): float = + num.foldl(a * b).pow(1.0 / float(num.len)) + +proc hmeanFunctional(num: seq[float]): float = + float(num.len) / sum(num.mapIt(float, 1.0 / it)) + +let numbers = toSeq(1..10).map((x: int) => float(x)) +echo amean(numbers), " ", gmean(numbers), " ", hmean(numbers) diff --git a/Task/Averages-Pythagorean-means/Oforth/averages-pythagorean-means.oforth b/Task/Averages-Pythagorean-means/Oforth/averages-pythagorean-means.oforth new file mode 100644 index 0000000000..c061f928b9 --- /dev/null +++ b/Task/Averages-Pythagorean-means/Oforth/averages-pythagorean-means.oforth @@ -0,0 +1,9 @@ +: A(l) l avg ; +: G(l) l prod l size inv powf ; +: H(l) l size l map(#inv) sum / ; + +: averages +| g | + "Geometric mean :" . G(10 seq) dup .cr ->g + "Arithmetic mean :" . A(10 seq) dup . g >= ifTrue: [ " ==> A >= G" .cr ] + "Harmonic mean :" . H(10 seq) dup . g <= ifTrue: [ " ==> G >= H" .cr ] ; diff --git a/Task/Averages-Pythagorean-means/Phix/averages-pythagorean-means.phix b/Task/Averages-Pythagorean-means/Phix/averages-pythagorean-means.phix new file mode 100644 index 0000000000..331ea2dac1 --- /dev/null +++ b/Task/Averages-Pythagorean-means/Phix/averages-pythagorean-means.phix @@ -0,0 +1,32 @@ +function arithmetic_mean(sequence s) + return sum(s)/length(s) +end function + +function geometric_mean(sequence s) +atom p = 1 + for i=1 to length(s) do + p *= s[i] + end for + return power(p,1/length(s)) +end function + +function harmonic_mean(sequence s) +atom rsum = 0 + for i=1 to length(s) do + rsum += 1/s[i] + end for + return length(s)/rsum +end function + +function iff(integer condition, object Tval, object Fval) + if condition then return Tval else return Fval end if +end function + +constant s = {1,2,3,4,5,6,7,8,9,10} +constant arithmetic = arithmetic_mean(s), + geometric = geometric_mean(s), + harmonic = harmonic_mean(s) +printf(1,"Arithmetic: %.10g\n", arithmetic) +printf(1,"Geometric: %.10g\n", geometric) +printf(1,"Harmonic: %.10g\n", harmonic) +printf(1,"Arithmetic>=Geometric>=Harmonic: %s\n", {iff((arithmetic>=geometric and geometric>=harmonic),"true","false")}) diff --git a/Task/Averages-Pythagorean-means/Ring/averages-pythagorean-means.ring b/Task/Averages-Pythagorean-means/Ring/averages-pythagorean-means.ring new file mode 100644 index 0000000000..b49f9745f5 --- /dev/null +++ b/Task/Averages-Pythagorean-means/Ring/averages-pythagorean-means.ring @@ -0,0 +1,29 @@ +decimals(8) +array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +see "arithmetic mean = " + arithmeticMean(array) + nl +see "geometric mean = " + geometricMean(array) + nl +see "harmonic mean = " + harmonicMean(array) + nl + +func arithmeticMean a + return summary(a) / len(a) + +func geometricMean a + b = 1 + for i = 1 to len(a) + b *= a[i] + next + return pow(b, (1/len(a))) + +func harmonicMean a + b = list(len(a)) + for nr = 1 to len(a) + b[nr] = 1/a[nr] + next + return len(a) / summary(b) + +func summary s + sum = 0 + for n = 1 to len(s) + sum += s[n] + next + return sum diff --git a/Task/Averages-Pythagorean-means/Sidef/averages-pythagorean-means-1.sidef b/Task/Averages-Pythagorean-means/Sidef/averages-pythagorean-means-1.sidef new file mode 100644 index 0000000000..9231b9c399 --- /dev/null +++ b/Task/Averages-Pythagorean-means/Sidef/averages-pythagorean-means-1.sidef @@ -0,0 +1,3 @@ +func A(a) { a.sum / a.len } +func G(a) { a.prod.root(a.len) } +func H(a) { a.len / a.map{1/_}.sum } diff --git a/Task/Averages-Pythagorean-means/Sidef/averages-pythagorean-means-2.sidef b/Task/Averages-Pythagorean-means/Sidef/averages-pythagorean-means-2.sidef new file mode 100644 index 0000000000..5e3697e0aa --- /dev/null +++ b/Task/Averages-Pythagorean-means/Sidef/averages-pythagorean-means-2.sidef @@ -0,0 +1,3 @@ +func A(a) { a«+» / a.len } +func G(a) { a«*» ** (1/a.len) } +func H(a) { a.len / (a«/«1 «+») } diff --git a/Task/Averages-Pythagorean-means/Sidef/averages-pythagorean-means-3.sidef b/Task/Averages-Pythagorean-means/Sidef/averages-pythagorean-means-3.sidef new file mode 100644 index 0000000000..dedb93bbb6 --- /dev/null +++ b/Task/Averages-Pythagorean-means/Sidef/averages-pythagorean-means-3.sidef @@ -0,0 +1,3 @@ +say("A(1,...,10) = ", A(1..10)); +say("G(1,...,10) = ", G(1..10)); +say("H(1,...,10) = ", H(1..10)); diff --git a/Task/Averages-Pythagorean-means/jq/averages-pythagorean-means.jq b/Task/Averages-Pythagorean-means/jq/averages-pythagorean-means.jq new file mode 100644 index 0000000000..cd8a6f8c2a --- /dev/null +++ b/Task/Averages-Pythagorean-means/jq/averages-pythagorean-means.jq @@ -0,0 +1,12 @@ +def amean: add/length; + +def logProduct: map(log) | add; + +def gmean: (logProduct / length) | exp; + +def hmean: length / (map(1/.) | add); + +# Tasks: + [range(1;11) ] | [amean, gmean, hmean] as $ans + | ( $ans[], + "amean > gmean > hmean => \($ans[0] > $ans[1] and $ans[1] > $ans[2] )" ) diff --git a/Task/Averages-Root-mean-square/ERRE/averages-root-mean-square.erre b/Task/Averages-Root-mean-square/ERRE/averages-root-mean-square.erre new file mode 100644 index 0000000000..bfcfda6081 --- /dev/null +++ b/Task/Averages-Root-mean-square/ERRE/averages-root-mean-square.erre @@ -0,0 +1,9 @@ +PROGRAM ROOT_MEAN_SQUARE +BEGIN + N=10 + FOR I=1 TO N DO + S=S+I*I + END FOR + X=SQR(S/N) + PRINT("Root mean square is";X) +END PROGRAM diff --git a/Task/Averages-Root-mean-square/EchoLisp/averages-root-mean-square.echolisp b/Task/Averages-Root-mean-square/EchoLisp/averages-root-mean-square.echolisp new file mode 100644 index 0000000000..05d48e13c1 --- /dev/null +++ b/Task/Averages-Root-mean-square/EchoLisp/averages-root-mean-square.echolisp @@ -0,0 +1,5 @@ +(define (rms xs) + (sqrt (// (for/sum ((x xs)) (* x x)) (length xs)))) + +(rms (range 1 11)) + → 6.2048368229954285 diff --git a/Task/Averages-Root-mean-square/FreeBASIC/averages-root-mean-square.freebasic b/Task/Averages-Root-mean-square/FreeBASIC/averages-root-mean-square.freebasic new file mode 100644 index 0000000000..335bc3176b --- /dev/null +++ b/Task/Averages-Root-mean-square/FreeBASIC/averages-root-mean-square.freebasic @@ -0,0 +1,20 @@ +' FB 1.05.0 Win64 + +Function QuadraticMean(array() As Double) As Double + Dim length As Integer = Ubound(array) - Lbound(array) + 1 + Dim As Double sum = 0.0 + For i As Integer = LBound(array) To UBound(array) + sum += array(i) * array(i) + Next + Return Sqr(sum/length) +End Function + +Dim vector(1 To 10) As Double +For i As Integer = 1 To 10 + vector(i) = i +Next + +Print "Quadratic mean (or RMS) is :"; QuadraticMean(vector()) +Print +Print "Press any key to quit the program" +Sleep diff --git a/Task/Averages-Root-mean-square/Futhark/averages-root-mean-square.futhark b/Task/Averages-Root-mean-square/Futhark/averages-root-mean-square.futhark new file mode 100644 index 0000000000..d1e296e87d --- /dev/null +++ b/Task/Averages-Root-mean-square/Futhark/averages-root-mean-square.futhark @@ -0,0 +1,2 @@ +fun main(as: [n]f64): f64 = + sqrt64 ((reduce (+) 0.0 (map (**2.0) as)) / f64(n)) diff --git a/Task/Averages-Root-mean-square/GEORGE/averages-root-mean-square.george b/Task/Averages-Root-mean-square/GEORGE/averages-root-mean-square.george new file mode 100644 index 0000000000..ba1cd2b0ee --- /dev/null +++ b/Task/Averages-Root-mean-square/GEORGE/averages-root-mean-square.george @@ -0,0 +1,9 @@ +1, 10 rep (i) + i i | (v) ; +0 + 1, 10 rep (i) + i dup mult + + ] +10 div + sqrt + print diff --git a/Task/Averages-Root-mean-square/Lasso/averages-root-mean-square.lasso b/Task/Averages-Root-mean-square/Lasso/averages-root-mean-square.lasso new file mode 100644 index 0000000000..6c9c7fec85 --- /dev/null +++ b/Task/Averages-Root-mean-square/Lasso/averages-root-mean-square.lasso @@ -0,0 +1,4 @@ +define rms(a::staticarray)::decimal => { + return math_sqrt((with n in #a sum #n*#n) / decimal(#a->size)) +} +rms(generateSeries(1,10)->asStaticArray) diff --git a/Task/Averages-Root-mean-square/Morfa/averages-root-mean-square.morfa b/Task/Averages-Root-mean-square/Morfa/averages-root-mean-square.morfa new file mode 100644 index 0000000000..2f653da452 --- /dev/null +++ b/Task/Averages-Root-mean-square/Morfa/averages-root-mean-square.morfa @@ -0,0 +1,14 @@ +import morfa.base; +import morfa.functional.base; + +template +func rms(d: TRange): float +{ + var count = 1; + return sqrt(reduce( (a: float, b: float) { count += 1; return a + b * b; }, d) / count); +} + +func main(): void +{ + println(rms(1 .. 11)); +} diff --git a/Task/Averages-Root-mean-square/Nim/averages-root-mean-square.nim b/Task/Averages-Root-mean-square/Nim/averages-root-mean-square.nim new file mode 100644 index 0000000000..670470ffcb --- /dev/null +++ b/Task/Averages-Root-mean-square/Nim/averages-root-mean-square.nim @@ -0,0 +1,8 @@ +import math + +proc qmean(num): float = + for n in num: + result += n*n + result = sqrt(result / float(num.len)) + +echo qmean([1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0]) diff --git a/Task/Averages-Root-mean-square/Oforth/averages-root-mean-square.oforth b/Task/Averages-Root-mean-square/Oforth/averages-root-mean-square.oforth new file mode 100644 index 0000000000..4ea5d1becf --- /dev/null +++ b/Task/Averages-Root-mean-square/Oforth/averages-root-mean-square.oforth @@ -0,0 +1 @@ +10 seq map(#sq) sum 10.0 / sqrt . diff --git a/Task/Averages-Root-mean-square/Phix/averages-root-mean-square.phix b/Task/Averages-Root-mean-square/Phix/averages-root-mean-square.phix new file mode 100644 index 0000000000..c31c1560e2 --- /dev/null +++ b/Task/Averages-Root-mean-square/Phix/averages-root-mean-square.phix @@ -0,0 +1,9 @@ +function rms(sequence s) +atom sqsum = 0 + for i=1 to length(s) do + sqsum += power(s[i],2) + end for + return sqrt(sqsum/length(s)) +end function + +? rms({1,2,3,4,5,6,7,8,9,10}) diff --git a/Task/Averages-Root-mean-square/Powerbuilder/averages-root-mean-square.powerbuilder b/Task/Averages-Root-mean-square/Powerbuilder/averages-root-mean-square.powerbuilder new file mode 100644 index 0000000000..9cb2aaea9a --- /dev/null +++ b/Task/Averages-Root-mean-square/Powerbuilder/averages-root-mean-square.powerbuilder @@ -0,0 +1,12 @@ +long ll_x, ll_y, ll_product +decimal ld_rms + +ll_x = 1 +ll_y = 10 +DO WHILE ll_x <= ll_y + ll_product += ll_x * ll_x + ll_x ++ +LOOP +ld_rms = Sqrt(ll_product / ll_y) + +//ld_rms value is 6.20483682299542849 diff --git a/Task/Averages-Root-mean-square/Ring/averages-root-mean-square.ring b/Task/Averages-Root-mean-square/Ring/averages-root-mean-square.ring new file mode 100644 index 0000000000..c61e32b1aa --- /dev/null +++ b/Task/Averages-Root-mean-square/Ring/averages-root-mean-square.ring @@ -0,0 +1,11 @@ +nums = [1,2,3,4,5,6,7,8,9,10] +sum = 0 +decimals(5) +see "Average = " + average(nums) + nl + +func average number + for i = 1 to len(number) + sum = sum + pow(number[i],2) + next + x = sqrt(sum / len(number)) + return x diff --git a/Task/Averages-Root-mean-square/Sidef/averages-root-mean-square.sidef b/Task/Averages-Root-mean-square/Sidef/averages-root-mean-square.sidef new file mode 100644 index 0000000000..bc1ce57f90 --- /dev/null +++ b/Task/Averages-Root-mean-square/Sidef/averages-root-mean-square.sidef @@ -0,0 +1,5 @@ +func rms(a) { + Math.sqrt(a.map{.**2}.sum / a.len); +} + +say rms(1..10); diff --git a/Task/Averages-Root-mean-square/Wortel/averages-root-mean-square.wortel b/Task/Averages-Root-mean-square/Wortel/averages-root-mean-square.wortel new file mode 100644 index 0000000000..0ab161285a --- /dev/null +++ b/Task/Averages-Root-mean-square/Wortel/averages-root-mean-square.wortel @@ -0,0 +1,12 @@ +@let { + ; using a composition and a fork (like you would do in J) + rms1 ^(@sqrt @(@sum / #) *^@sq) + + ; using a function with a named argument + rms2 &a @sqrt ~/ #a @sum !*^@sq a + + [[ + !rms1 @to 10 + !rms2 @to 10 + ]] +} diff --git a/Task/Averages-Root-mean-square/XLISP/averages-root-mean-square.xlisp b/Task/Averages-Root-mean-square/XLISP/averages-root-mean-square.xlisp new file mode 100644 index 0000000000..8eef3b4acd --- /dev/null +++ b/Task/Averages-Root-mean-square/XLISP/averages-root-mean-square.xlisp @@ -0,0 +1,16 @@ +(defun quadratic-mean (xs) + (sqrt + (/ + (apply + + (mapcar (lambda (x) (expt x 2)) xs)) + (length xs)))) + +; define a RANGE function, for testing purposes + +(defun range (x y) + (if (< x y) + (cons x (range (+ x 1) y)))) + +; test QUADRATIC-MEAN + +(print (quadratic-mean (range 1 11))) diff --git a/Task/Averages-Root-mean-square/jq/averages-root-mean-square-1.jq b/Task/Averages-Root-mean-square/jq/averages-root-mean-square-1.jq new file mode 100644 index 0000000000..6e75a34df8 --- /dev/null +++ b/Task/Averages-Root-mean-square/jq/averages-root-mean-square-1.jq @@ -0,0 +1,4 @@ +def rms: length as $length + | if $length == 0 then null + else map(. * .) | add | sqrt / $length + end ; diff --git a/Task/Averages-Root-mean-square/jq/averages-root-mean-square-2.jq b/Task/Averages-Root-mean-square/jq/averages-root-mean-square-2.jq new file mode 100644 index 0000000000..baa67a5516 --- /dev/null +++ b/Task/Averages-Root-mean-square/jq/averages-root-mean-square-2.jq @@ -0,0 +1 @@ +rms diff --git a/Task/Averages-Simple-moving-average/EchoLisp/averages-simple-moving-average.echolisp b/Task/Averages-Simple-moving-average/EchoLisp/averages-simple-moving-average.echolisp new file mode 100644 index 0000000000..2fc52af9e6 --- /dev/null +++ b/Task/Averages-Simple-moving-average/EchoLisp/averages-simple-moving-average.echolisp @@ -0,0 +1,10 @@ +(lib 'tree) ;; queues operations + + +(define (make-sma p) + (define Q (queue (gensym))) + (lambda (item) + (q-push Q item) + (when (> (queue-length Q) p) (q-pop Q)) + (// (for/sum ((x (queue->list Q))) x) (queue-length Q)))) + diff --git a/Task/Averages-Simple-moving-average/FreeBASIC/averages-simple-moving-average.freebasic b/Task/Averages-Simple-moving-average/FreeBASIC/averages-simple-moving-average.freebasic new file mode 100644 index 0000000000..31172e0475 --- /dev/null +++ b/Task/Averages-Simple-moving-average/FreeBASIC/averages-simple-moving-average.freebasic @@ -0,0 +1,46 @@ +' FB 1.05.0 Win64 + +Type FuncType As Function(As Double) As Double + +' These 'shared' variables are available to all functions defined below +Dim Shared p As UInteger +Dim Shared list() As Double + +Function sma(n As Double) As Double + Redim Preserve list(0 To UBound(list) + 1) + list(UBound(list)) = n + Dim start As Integer = 0 + Dim length As Integer = UBound(list) + 1 + If length > p Then + start = UBound(list) - p + 1 + length = p + End If + Dim sum As Double = 0.0 + For i As Integer = start To UBound(list) + sum += list(i) + Next + Return sum / length +End Function + +Function initSma(period As Uinteger) As FuncType + p = period + Erase list '' ensure the array is empty on each initialization + Return @sma +End Function + +Dim As FuncType ma = initSma(3) +Print "Period = "; p +Print +For i As Integer = 0 To 9 + Print "Add"; i; " => moving average ="; ma(i) +Next +Print +ma = initSma(5) +Print "Period = "; p +Print +For i As Integer = 9 To 0 Step -1 + Print "Add"; i; " => moving average ="; ma(i) +Next +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Averages-Simple-moving-average/Lasso/averages-simple-moving-average.lasso b/Task/Averages-Simple-moving-average/Lasso/averages-simple-moving-average.lasso new file mode 100644 index 0000000000..8e0aaa32c9 --- /dev/null +++ b/Task/Averages-Simple-moving-average/Lasso/averages-simple-moving-average.lasso @@ -0,0 +1,32 @@ +define simple_moving_average(a::array,s::integer)::decimal => { + #a->size == 0 ? return 0.00 + #s == 0 ? return 0.00 + #a->size == 1 ? return decimal(#a->first) + #s == 1 ? return decimal(#a->last) + local(na = array) + if(#a->size <= #s) => { + #na = #a + else + local(ar = #a->ascopy) + #ar->reverse + loop(#s) => { #na->insert(#ar->get(loop_count)) } + } + #s > #na->size ? #s = #na->size + return (with e in #na sum #e) / decimal(#s) +} +// tests: +'SMA 3 on array(1,2,3,4,5,5,4,3,2,1): ' +simple_moving_average(array(1,2,3,4,5,5,4,3,2,1),3) + +'\rSMA 5 on array(1,2,3,4,5,5,4,3,2,1): ' +simple_moving_average(array(1,2,3,4,5,5,4,3,2,1),5) + +'\r\rFurther example: \r' +local(mynumbers = array, sma_num = 5) +loop(10) => {^ + #mynumbers->insert(integer_random(1,100)) + #mynumbers->size + ' numbers: ' + #mynumbers + ' SMA3 is: ' + simple_moving_average(#mynumbers,3) + ', SMA5 is: ' + simple_moving_average(#mynumbers,5) + '\r' +^} diff --git a/Task/Averages-Simple-moving-average/Nim/averages-simple-moving-average.nim b/Task/Averages-Simple-moving-average/Nim/averages-simple-moving-average.nim new file mode 100644 index 0000000000..df1aee5467 --- /dev/null +++ b/Task/Averages-Simple-moving-average/Nim/averages-simple-moving-average.nim @@ -0,0 +1,28 @@ +import queues + +proc simplemovingaverage(period: int): auto = + assert period > 0 + + var + summ, n = 0.0 + values = initQueue[float]() + for i in 1..period: + values.add(0) + + proc sma(x: float): float = + values.add(x) + summ += x - values.dequeue() + n = min(n+1, float(period)) + result = summ / n + + return sma + +var sma = simplemovingaverage(3) +for i in 1..5: echo sma(float(i)) +for i in countdown(5,1): echo sma(float(i)) + +echo "" + +var sma2 = simplemovingaverage(5) +for i in 1..5: echo sma2(float(i)) +for i in countdown(5,1): echo sma2(float(i)) diff --git a/Task/Averages-Simple-moving-average/Oforth/averages-simple-moving-average-1.oforth b/Task/Averages-Simple-moving-average/Oforth/averages-simple-moving-average-1.oforth new file mode 100644 index 0000000000..22d169983c --- /dev/null +++ b/Task/Averages-Simple-moving-average/Oforth/averages-simple-moving-average-1.oforth @@ -0,0 +1,6 @@ +import: parallel + +: createSMA(period) +| ch | + Channel new [ ] over send drop ->ch + #[ ch receive + left(period) dup avg swap ch send drop ] ; diff --git a/Task/Averages-Simple-moving-average/Oforth/averages-simple-moving-average-2.oforth b/Task/Averages-Simple-moving-average/Oforth/averages-simple-moving-average-2.oforth new file mode 100644 index 0000000000..f296a67a47 --- /dev/null +++ b/Task/Averages-Simple-moving-average/Oforth/averages-simple-moving-average-2.oforth @@ -0,0 +1,7 @@ +: test +| sma3 sma5 l | + 3 createSMA -> sma3 + 5 createSMA -> sma5 + [ 1, 2, 3, 4, 5, 5, 4, 3, 2, 1 ] ->l + "SMA3" .cr l apply( #[ sma3 perform . ] ) printcr + "SMA5" .cr l apply( #[ sma5 perform . ] ) ; diff --git a/Task/Averages-Simple-moving-average/Phix/averages-simple-moving-average-1.phix b/Task/Averages-Simple-moving-average/Phix/averages-simple-moving-average-1.phix new file mode 100644 index 0000000000..d682347b7d --- /dev/null +++ b/Task/Averages-Simple-moving-average/Phix/averages-simple-moving-average-1.phix @@ -0,0 +1,50 @@ +sequence sma = {} -- {{period,history,circnxt}} (private to sma.e) +integer sma_free = 0 + +global function new_sma(integer period) +integer res + if sma_free then + res = sma_free + sma_free = sma[sma_free] + sma[res] = {period,{},0} + else + sma = append(sma,{period,{},0}) + res = length(sma) + end if + return res +end function + +global procedure add_sma(integer sidx, atom val) +integer period, circnxt +sequence history + {period,history,circnxt} = sma[sidx] + sma[sidx][2] = 0 -- (kill refcount) + if length(history)period then + circnxt = 1 + end if + sma[sidx][3] = circnxt + history[circnxt] = val + end if + sma[sidx][2] = history +end procedure + +global function get_sma_average(integer sidx) +sequence history = sma[sidx][2] +integer l = length(history) + if l=0 then return 0 end if + return sum(history)/l +end function + +global function moving_average(integer sidx, atom val) + add_sma(sidx,val) + return get_sma_average(sidx) +end function + +global procedure free_sma(integer sidx) + sma[sidx] = sma_free + sma_free = sidx +end procedure diff --git a/Task/Averages-Simple-moving-average/Phix/averages-simple-moving-average-2.phix b/Task/Averages-Simple-moving-average/Phix/averages-simple-moving-average-2.phix new file mode 100644 index 0000000000..29f51002b0 --- /dev/null +++ b/Task/Averages-Simple-moving-average/Phix/averages-simple-moving-average-2.phix @@ -0,0 +1,11 @@ +include sma.e + +constant sma3 = new_sma(3) +constant sma5 = new_sma(5) +constant s = {1,2,3,4,5,5,4,3,2,1} +integer si + +for i=1 to length(s) do + si = s[i] + printf(1,"%2g: sma3=%8g, sma5=%8g\n",{si,moving_average(sma3,si),moving_average(sma5,si)}) +end for diff --git a/Task/Averages-Simple-moving-average/Ring/averages-simple-moving-average-1.ring b/Task/Averages-Simple-moving-average/Ring/averages-simple-moving-average-1.ring new file mode 100644 index 0000000000..880a190b67 --- /dev/null +++ b/Task/Averages-Simple-moving-average/Ring/averages-simple-moving-average-1.ring @@ -0,0 +1,31 @@ +load "stdlib.ring" +decimals(8) +maxperiod = 20 +nums = newlist(maxperiod,maxperiod) +accum = list(maxperiod) +index = list(maxperiod) +window = list(maxperiod) +for i = 1 to maxperiod + index[i] = 1 + accum[i] = 0 + window[i] = 0 +next +for i = 1 to maxperiod + for j = 1 to maxperiod + nums[i][j] = 0 + next +next +for n = 1 to 5 + see "number = " + n + " sma3 = " + left((string(sma(n,3)) + " "),9) + " sma5 = " + sma(n,5) + nl +next +for n = 5 to 1 step -1 + see "number = " + n + " sma3 = " + left((string(sma(n,3)) + " "),9) + " sma5 = " + sma(n,5) + nl +next +see nl + +func sma number, period + accum[period] += number - nums[period][index[period]] + nums[period][index[period]] = number + index[period]= (index[period] + 1) % period + 1 + if window[period] period) { + sum -= list.shift + } + (sum / list.length) + } +} + +var ma3 = simple_moving_average(3); +var ma5 = simple_moving_average(5); + +[1 ..^ 6, 6 ^.. 1].map{@|_} -> each {|num| + printf("Next number = %d, SMA_3 = %.3f, SMA_5 = %.1f\n", + num, ma3.call(num), ma5.call(num)) +} diff --git a/Task/Averages-Simple-moving-average/Sidef/averages-simple-moving-average-2.sidef b/Task/Averages-Simple-moving-average/Sidef/averages-simple-moving-average-2.sidef new file mode 100644 index 0000000000..5d8393d679 --- /dev/null +++ b/Task/Averages-Simple-moving-average/Sidef/averages-simple-moving-average-2.sidef @@ -0,0 +1,19 @@ +class sma_generator(period, list=[], sum=0) { + + method SMA(number) { + list.append(number) + sum += number + if (list.len > period) { + sum -= list.shift + } + (sum / list.len) + } +} + +var ma3 = sma_generator(3) +var ma5 = sma_generator(5) + +for num in [@|(1..5), @|(1..5 -> flip)] { + printf("Next number = %d, SMA_3 = %.3f, SMA_5 = %.1f\n", + num, ma3.SMA(num), ma5.SMA(num)) +} diff --git a/Task/Balanced-brackets/Ceylon/balanced-brackets.ceylon b/Task/Balanced-brackets/Ceylon/balanced-brackets.ceylon new file mode 100644 index 0000000000..69e4e7a280 --- /dev/null +++ b/Task/Balanced-brackets/Ceylon/balanced-brackets.ceylon @@ -0,0 +1,27 @@ +import com.vasileff.ceylon.random.api { + platformRandom, + Random +} +"""Run the example code for Rosetta Code ["Balanced brackets" task] (http://rosettacode.org/wiki/Balanced_brackets).""" +shared void run() { + value rnd = platformRandom(); + for (len in (0..10)) { + value c = generate(rnd, len); + print("``c.padTrailing(20)`` - ``if (balanced(c)) then "OK" else "NOT OK" ``"); + } +} + +String generate(Random rnd, Integer count) + => if (count == 0) then "" + else let(length = 2*count, + brackets = zipEntries(rnd.integers(length).take(length), + "[]".repeat(count)) + .sort((a,b) => a.key<=>b.key) + .map(Entry.item)) + String(brackets); + +Boolean balanced(String input) + => let (value ints = { for (c in input) if (c == '[') then 1 else -1 }) + ints.filter((i) => i != 0) + .scan(0)(plus) + .every((i) => i >= 0); diff --git a/Task/Balanced-brackets/EchoLisp/balanced-brackets.echolisp b/Task/Balanced-brackets/EchoLisp/balanced-brackets.echolisp new file mode 100644 index 0000000000..6dc8e3269f --- /dev/null +++ b/Task/Balanced-brackets/EchoLisp/balanced-brackets.echolisp @@ -0,0 +1,28 @@ +(define (balance str) + (for/fold (closed 0) ((par str)) + #:break (< closed 0 ) => closed + (+ closed + (cond + ((string=? par "[") 1) + ((string=? par "]") -1) + (else 0))))) + +(define (task N) +(define str (list->string (append (make-list N "[") (make-list N "]")))) + (for ((i 10)) + (set! str (list->string (shuffle (string->list str)))) + (writeln (if (zero? (balance str)) '👍 '❌ ) str))) + +(task 4) + +❌ "[]]][[][" +❌ "]][][[[]" +❌ "][[[]]][" +👍 "[][[[]]]" +❌ "]][[][][" +❌ "][][[[]]" +👍 "[][][[]]" +❌ "]][[][[]" +❌ "[[]]][[]" +❌ "[[][]]][" + diff --git a/Task/Balanced-brackets/FreeBASIC/balanced-brackets.freebasic b/Task/Balanced-brackets/FreeBASIC/balanced-brackets.freebasic new file mode 100644 index 0000000000..13758bd3a7 --- /dev/null +++ b/Task/Balanced-brackets/FreeBASIC/balanced-brackets.freebasic @@ -0,0 +1,45 @@ +' FB 1.05.0 Win64 + +Function isBalanced(s As String) As Boolean + If s = "" Then Return True + Dim countLeft As Integer = 0 '' counts number of left brackets so far unmatched + Dim c As String + For i As Integer = 1 To Len(s) + c = Mid(s, i, 1) + If c = "[" Then + countLeft += 1 + ElseIf countLeft > 0 Then + countLeft -= 1 + Else + Return False + End If + Next + Return countLeft = 0 +End Function + +' checking examples in task description +Dim brackets(1 To 7) As String = {"", "[]", "][", "[][]", "][][", "[[][]]", "[]][[]"} +For i As Integer = 1 To 7 + Print IIf(brackets(i) <> "", brackets(i), "(empty)"); Tab(10); IIf(isBalanced(brackets(i)), "OK", "NOT OK") +Next + +' checking 7 random strings of brackets of length 8 say +Randomize +Dim r As Integer '' 0 will signify "[" and 1 will signify "]" +Dim s As String +For i As Integer = 1 To 7 + s = Space(8) + For j As Integer = 1 To 8 + r = Int(Rnd * 2) + If r = 0 Then + Mid(s, j) = "[" + Else + Mid(s, j) = "]" + End If + Next j + Print s; Tab(10); IIf(isBalanced(s), "OK", "NOT OK") +Next i + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Balanced-brackets/L++/balanced-brackets.lpp b/Task/Balanced-brackets/L++/balanced-brackets.lpp new file mode 100644 index 0000000000..ee2a99ab1e --- /dev/null +++ b/Task/Balanced-brackets/L++/balanced-brackets.lpp @@ -0,0 +1,15 @@ +(include "string") + +(defn bool balanced (std::string s) + (def bal 0) + (foreach c s + (if (== c #\[) (++ bal) + (if (== c #\]) (-- bal))) + (if (< bal 0) (return false))) + (return (== bal 0))) + +(main + (decl std::string (at tests) |{"", "[]", "[][]", "[[][]]", "][", "][][", "[]][[]"}|) + (pr std::boolalpha) + (foreach x tests + (prn x "\t" (balanced x)))) diff --git a/Task/Balanced-brackets/Lasso/balanced-brackets.lasso b/Task/Balanced-brackets/Lasso/balanced-brackets.lasso new file mode 100644 index 0000000000..f55edd97c3 --- /dev/null +++ b/Task/Balanced-brackets/Lasso/balanced-brackets.lasso @@ -0,0 +1,22 @@ +define randomparens(num::integer,open::string='[',close::string=']') => { + local(out) = array + + with i in 1 to #num do { + #out->insert(']', integer_random(1,#out->size || 1)) + #out->insert('[', integer_random(1,#out->size || 1)) + } + return #out->join +} + +define validateparens(input::string,open::string='[',close::string=']') => { + local(i) = 0 + #input->foreachcharacter => { + #1 == #open ? #i++ + #1 == #close && --#i < 0 ? return false + } + return #i == 0 ? true | false +} + +with i in 1 to 10 +let input = randomparens(#i) +select #input + ' = ' + validateparens(#input) diff --git a/Task/Balanced-brackets/Nim/balanced-brackets.nim b/Task/Balanced-brackets/Nim/balanced-brackets.nim new file mode 100644 index 0000000000..1d1f0c89e7 --- /dev/null +++ b/Task/Balanced-brackets/Nim/balanced-brackets.nim @@ -0,0 +1,30 @@ +import random +randomize() + +proc shuffle(s: var string) = + for i in countdown(s.high, 0): + swap(s[i], s[random(s.len)]) + +proc gen(n: int): string = + result = newString(2 * n) + for i in 0 .. ifTrue: [ continue ] + 1- dup 0 < ifTrue: [ drop false return ] + ] + 0 == ; + +: genBrackets(n) + "" #[ "[" "]" 2 rand 2 == ifTrue: [ swap ] rot + swap + ] times(n) ; diff --git a/Task/Balanced-brackets/Phix/balanced-brackets.phix b/Task/Balanced-brackets/Phix/balanced-brackets.phix new file mode 100644 index 0000000000..475bf1a8c7 --- /dev/null +++ b/Task/Balanced-brackets/Phix/balanced-brackets.phix @@ -0,0 +1,21 @@ +function check_brackets(sequence s) +integer level = 0 + for i=1 to length(s) do + switch s[i] + case '[': level += 1 + case ']': level -= 1 + if level<0 then exit end if + end switch + end for + return (level=0) +end function + +sequence s +constant ok = {"not ok","ok"} + +for i=1 to 10 do + for j=1 to 2 do + s = shuffle(join(repeat("[]",i-1),"")) + printf(1,"%s %s\n",{s,ok[check_brackets(s)+1]}) + end for +end for diff --git a/Task/Balanced-brackets/Ring/balanced-brackets.ring b/Task/Balanced-brackets/Ring/balanced-brackets.ring new file mode 100644 index 0000000000..160b028b48 --- /dev/null +++ b/Task/Balanced-brackets/Ring/balanced-brackets.ring @@ -0,0 +1,26 @@ +nr = 0 +while nr < 10 + nr += 1 + test=generate(random(9)+1) + see "bracket string " + test + " is " + valid(test) + nl +end + +func generate n +l = 0 r = 0 output = "" +while l Bool { + + var count = 0 + + return !str.characters.contains { ($0 == "[" ? ++count : --count) < 0 } && count == 0 + +} diff --git a/Task/Balanced-brackets/Swift/balanced-brackets-2.swift b/Task/Balanced-brackets/Swift/balanced-brackets-2.swift new file mode 100644 index 0000000000..2e09c60d99 --- /dev/null +++ b/Task/Balanced-brackets/Swift/balanced-brackets-2.swift @@ -0,0 +1,3 @@ +isBal("[[[]]]") // true + +isBal("[]][[]") // false diff --git a/Task/Balanced-brackets/Swift/balanced-brackets-3.swift b/Task/Balanced-brackets/Swift/balanced-brackets-3.swift new file mode 100644 index 0000000000..28538a7450 --- /dev/null +++ b/Task/Balanced-brackets/Swift/balanced-brackets-3.swift @@ -0,0 +1,13 @@ +func randBrack(n: Int) -> String { + + var bracks: [Character] = Array(Repeat(count: n, repeatedValue: "[")) + + for i in UInt32(n+1)...UInt32(n + n) { + + bracks.insert("]", atIndex: Int(arc4random_uniform(i))) + + } + + return String(bracks) + +} diff --git a/Task/Balanced-brackets/Swift/balanced-brackets-4.swift b/Task/Balanced-brackets/Swift/balanced-brackets-4.swift new file mode 100644 index 0000000000..a0ba0614c6 --- /dev/null +++ b/Task/Balanced-brackets/Swift/balanced-brackets-4.swift @@ -0,0 +1 @@ +randBrack(2) // "]][[" diff --git a/Task/Balanced-brackets/Swift/balanced-brackets-5.swift b/Task/Balanced-brackets/Swift/balanced-brackets-5.swift new file mode 100644 index 0000000000..d46d608857 --- /dev/null +++ b/Task/Balanced-brackets/Swift/balanced-brackets-5.swift @@ -0,0 +1,12 @@ +func randIsBal(n: Int) { + + let (bal, un) = ("", "un") + + for str in (1...n).map(randBrack) { + + print("\(str) is \(isBal(str) ? bal : un)balanced\n") + + } +} + +randIsBal(4) diff --git a/Task/Balanced-brackets/Swift/balanced-brackets-6.swift b/Task/Balanced-brackets/Swift/balanced-brackets-6.swift new file mode 100644 index 0000000000..153c171bc1 --- /dev/null +++ b/Task/Balanced-brackets/Swift/balanced-brackets-6.swift @@ -0,0 +1,7 @@ +// ][ is unbalanced +// +// ]][[ is unbalanced +// +// []][[] is unbalanced +// +// [][][[]] is balanced diff --git a/Task/Balanced-brackets/Ya/balanced-brackets.ya b/Task/Balanced-brackets/Ya/balanced-brackets.ya new file mode 100644 index 0000000000..0b3e76f880 --- /dev/null +++ b/Task/Balanced-brackets/Ya/balanced-brackets.ya @@ -0,0 +1,37 @@ +@Balanced[]s // each source must be started by specifying its file name; std extension .Ya could be ommitted and auto added by compiler + +// all types are prefixed by ` +// definition of anything new is prefixed by \, like \MakeNew_[]s and \len +// MakeNew_[]s is Ok ident in Ya: _ starts sign part of ident, which must be ended by _ or alphanum +`Char[^] \MakeNew_[]s(`Int+ \len) // `Char[^] and `Char[=] are arrays that owns their items, like it's usally in other langs; + // yet in assignment of `Char[^] to `Char[=] the allocated memory is moved from old to new owner, and old string becomes empty + // there are tabs at starts of many lines; these tabs specify what in C++ is {} blocks, just like in Python + len & 1 ==0 ! // it's a call to postfix function '!' which is an assert: len must be even + `Char[=] \r(len) // allocate new string of length len + // most statements are analogous to C++ but written starting by capital letter: For If Switch Ret + For `Char[] \eye = r; eye // // `Char[] is a simplest array of chars, which does not hold a memory used by array items; inc part of For loop is missed: it's Ok, and condition and init could also be missed + *eye++ = '['; *eye++ = '[' // fill r by "[][][]...". The only place with ; as statement delemiter: required because the statement is not started at new line. + // below is a shuffle of "[][][]..." array + For `Char[] \eye = r; ++eye // var eye is already defined, but being the same `Char[] it's Ok by using already exisiting var. ++eye is used: it allows use of eye[-1] inside + `Int+ \at = Random(eye/Length) // `Int+ is C++'s unsigned int. eye/Length: / is used for access to field, like in file path + eye[-1],eye[at] = eye[at],eye[-1] // swap using tuples; eye[-1] accesses char that is out of current array, yet it's allowed + Ret r // Ret is C's return +`Bool \AreBalanced(`Char[] \brackets) + `Int+ \extra = 0 + For ;brackets ;++brackets + Switch *brackets + '[' // it's a C++'s 'case': both 'case' and ':' are skipped being of no value; but the code for a case should be in block, which is here specifyed by tabs at next line start + ++extra + ']' + If !!extra // '!!' is `Bool not, like all other `Bool ops: && || ^^ + Ret No // No and False are C's false; Yes and True are C's true + --extra + // There is no default case, which is written as ':' - so if no case is Ok then it will fail just like if being written as on the next line + // : { 0! } // C's default: assert(0); + Ret extra == 0 +// function ala 'main' is not used: all global code from all modules are executed; so below is what typically is in ala 'main' +For `Int \n=10; n; --n + // below note that new var 'brackets' is created inside args of func call + //@Std/StdIO/ is used here to use Print function; else it maybe changed to Use @Std/StdIO at global level before this For loop + @Std/StdIO/Print(; "%s : %s\n" ;`Char[=] \brackets = MakeNew_[]s(10) /* all bracket strings are of length 10 */; AreBalanced(brackets) ? "Ok" : "bad") + // note that starting arg of Print is missed by using ';' - default arg value is allowed to use for any arg, even if next args are written diff --git a/Task/Balanced-ternary/Glagol/balanced-ternary.glagol b/Task/Balanced-ternary/Glagol/balanced-ternary.glagol new file mode 100644 index 0000000000..9824d54ccd --- /dev/null +++ b/Task/Balanced-ternary/Glagol/balanced-ternary.glagol @@ -0,0 +1,113 @@ +PROGRAM Setun+; +USES + Parameter IS "...\Departments\Exchange\" + Text IS "...\Departments\Numbers\" + Output IS "...\Departments\Exchange\"; + +VAR + AF: RANGE 10 IS SIGN; + mfpos: INT; + number: INT; + memory ACCESS TO STRUCT + cell: RANGE 20 IS INT; + size: UZKEL; + negative: BOOL + END; + +PROC Create.Memory; +BEGIN + CREATE(memory); + memory.size := 0; + memory.negative := FALSE +END Create.Memory; + +PROC Add.Memory(that: INT) +BEGIN + memory.cells[memory.size] := that; + ZOOM(memory.size) +END Add.Memory; + +PROC Invert.Memory; +VAR + zchsl: INT; + account: INT; +BEGIN + FOR cq := 0 TO memory.size DIVIDE 2 - 1 DO + zchsl := memory.cells[cq]; + memory.cells[cq] := memory.cells[memory.size-size-1]; + memory.cells[memory.size-MF-1] := zchsl + END +END Invert.Memory; + +PROC Withdraw.Memory; +VAR + account: INT; +BEGIN + FOR cq := 0 TO memory.size-1 DO + IF memory.cells[cq] < 0 THEN + Output.Append("-") + ANDIF memory.cells[cq] > 0 THEN + Output.Append("+") + ELSE Output.Append("0") END + END +END Withdraw.Memory; + +PROC Remove.Memory; +BEGIN + memory := Empty +END Remove.Memory; + +PROC Translate(number: INT) +VAR + about: INT; + s: BOOL; + PROC B.Memory(that: INT) + BEGIN + IF memory.negative THEN + IF that < 0 THEN Add.Memory(1) + ANDIF that > 0 THEN Add.Memory(1) + ELSE Add.Memory(0) END + ELSE + Add.Memory(that) + END + END B.Memory; +BEGIN + IF number < 0 THEN memory.negative := TRUE END; + number := UNIT(number) + s := FALSE; + WHILE number > 0 DO + about := number BALANCE 3; + number := number DIVIDE 3; + IF s THEN + IF about = 2 THEN B.Memory(0) ANDIF about = 1 THEN B.Memory(1) ELSE B.Memory(1) s := FALSE END + ELSE + IF about = 2 THEN B.Memory(-1) s := TRUE ELSE B.Memory(a) END + END + END; + IF s THEN B.Memory(1) END; + Invert.Memory; + Withdraw.Memory(TRUE) +END Translate; + +PROC InNumber(): INT; +VAR + MF, MN: INT; + result: INT; +BEGIN + result := 0 + pl := 1; + FOR cq := 0 TO memory.size-1 DO + ZOOM(result, memory.Cells[memory.size-cq-1] * mn); + pl := pl * 3 + END; + RETURN result; +END InNumber; + +BEGIN + Parameter.Text(1, AF); mfpos := 0; + number := Text.Whole(AF, mfpos); + Create.Memory; + Translate(number); + Output.ChTarget(" = %d.", InNumber(), 0, 0, 0); + Remove.Memory +END Setun. diff --git a/Task/Balanced-ternary/Phix/balanced-ternary-1.phix b/Task/Balanced-ternary/Phix/balanced-ternary-1.phix new file mode 100644 index 0000000000..c8a9fdbde0 --- /dev/null +++ b/Task/Balanced-ternary/Phix/balanced-ternary-1.phix @@ -0,0 +1,91 @@ +function bt2dec(string bt) +integer res = 0 + for i=1 to length(bt) do + res = 3*res+(bt[i]='+')-(bt[i]='-') + end for + return res +end function + +function negate(string bt) + for i=1 to length(bt) do + if bt[i]!='0' then + bt[i] = '+'+'-'-bt[i] + end if + end for + return bt +end function + +function dec2bt(integer n) +string res = "0" +integer neg, r + if n!=0 then + neg = n<0 + if neg then n = -n end if + res = "" + while n!=0 do + r = mod(n,3) + res = "0+-"[r+1]&res + n = floor((n+(r=2))/3) + end while + if neg then res = negate(res) end if + end if + return res +end function + +-- res,carry for a+b+carry lookup tables (not the fastest way to do it, I'm sure): +constant {tadd,addres} = columnize({{"---","0-"},{"--0","+-"},{"--+","-0"}, + {"-0-","+-"},{"-00","-0"},{"-0+","00"}, + {"-+-","-0"},{"-+0","00"},{"-++","+0"}, + {"0--","+-"},{"0-0","-0"},{"0-+","00"}, + {"00-","-0"},{"000","00"},{"00+","+0"}, + {"0+-","00"},{"0+0","+0"},{"0++","-+"}, + {"+--","-0"},{"+-0","00"},{"+-+","+0"}, + {"+0-","00"},{"+00","+0"},{"+0+","-+"}, + {"++-","+0"},{"++0","-+"},{"+++","0+"}}) + + +function bt_add(string a, string b) +integer pad = length(a)-length(b) +integer carry = '0' + if pad!=0 then + if pad<0 then + a = repeat('0',-pad)&a + else + b = repeat('0',pad)&b + end if + end if + for i=length(a) to 1 by -1 do + {a[i],carry} = addres[find(a[i]&b[i]&carry,tadd)] + end for + if carry!='0' then + a = carry&a + else + while length(a)>1 and a[1]='0' do + a = a[2..$] + end while + end if + return a +end function + +function bt_mul(string a, string b) +string pos = a, neg = negate(a), res = "0" +integer ch + for i=length(b) to 1 by -1 do + ch = b[i] + if ch='+' then + res = bt_add(res,pos) + elsif ch='-' then + res = bt_add(res,neg) + end if + pos = pos&'0' + neg = neg&'0' + end for + return res +end function + +string a = "+-0++0+", b = dec2bt(-436), c = "+-++-" + +?{bt2dec(a),bt2dec(b),bt2dec(c)} + +string res = bt_mul(a,bt_add(b,negate(c))) +?{res,bt2dec(res)} diff --git a/Task/Balanced-ternary/Phix/balanced-ternary-2.phix b/Task/Balanced-ternary/Phix/balanced-ternary-2.phix new file mode 100644 index 0000000000..e3191438a2 --- /dev/null +++ b/Task/Balanced-ternary/Phix/balanced-ternary-2.phix @@ -0,0 +1,16 @@ +atom t0 = time() +string f999 = dec2bt(1) +for i=2 to 999 do + f999 = bt_mul(f999,dec2bt(i)) +end for +string f1000 = bt_mul(f999,dec2bt(1000)) + +printf(1,"In balanced ternary, f999 has %d digits and f1000 has %d digits\n",{length(f999),length(f1000)}) + +integer count = 0 +f999 = negate(f999) +while f1000!="0" do + f1000 = bt_add(f1000,f999) + count += 1 +end while +printf(1,"It took %d subtractions to reach 0. (%3.2fs)\n",{count,time()-t0}) diff --git a/Task/Benfords-law/FreeBASIC/benfords-law.freebasic b/Task/Benfords-law/FreeBASIC/benfords-law.freebasic new file mode 100644 index 0000000000..90d6f8b2b5 --- /dev/null +++ b/Task/Benfords-law/FreeBASIC/benfords-law.freebasic @@ -0,0 +1,90 @@ +' version 27-10-2016 +' compile with: fbc -s console + +#Define max 1000 ' total number of Fibonacci numbers +#Define max_sieve 15485863 ' should give 1,000,000 + +#Include Once "gmp.bi" ' uses the GMP libary + +Dim As ZString Ptr z_str +Dim As ULong n, d +ReDim As ULong digit(1 To 9) +Dim As Double expect, found + +Dim As mpz_ptr fib1, fib2 +fib1 = Allocate(Len(__mpz_struct)) : Mpz_init_set_ui(fib1, 0) +fib2 = Allocate(Len(__mpz_struct)) : Mpz_init_set_ui(fib2, 1) + +digit(1) = 1 ' fib2 +For n = 2 To max + Swap fib1, fib2 ' fib1 = 1, fib2 = 0 + mpz_add(fib2, fib1, fib2) ' fib1 = 1, fib2 = 1 (fib1 + fib2) + z_str = mpz_get_str(0, 10, fib2) + d = Val(Left(*z_str, 1)) ' strip the 1 digit on the left off + digit(d) = digit(d) +1 +Next + +mpz_clear(fib1) : DeAllocate(fib1) +mpz_clear(fib2) : DeAllocate(fib2) + +Print +Print "First 1000 Fibonacci numbers" +Print "nr: total found expected difference" + +For d = 1 To 9 + n = digit(d) + found = n / 10 + expect = (Log(1 + 1 / d) / Log(10)) * 100 + Print Using " ## ##### ###.## % ###.## % ##.### %"; _ + d; n ; found; expect; expect - found +Next + + +ReDim digit(1 To 9) +ReDim As UByte sieve(max_sieve) + +'For d = 4 To max_sieve Step 2 +' sieve(d) = 1 +'Next +Print : Print "start sieve" +For d = 3 To sqr(max_sieve) + If sieve(d) = 0 Then + For n = d * d To max_sieve Step d * 2 + sieve(n) = 1 + Next + End If +Next + +digit(2) = 1 ' 2 + +Print "start collecting first digits" +For n = 3 To max_sieve Step 2 + If sieve(n) = 0 Then + d = Val(Left(Trim(Str(n)), 1)) + digit(d) = digit(d) +1 + End If +Next + +Dim As ulong total +For n = 1 To 9 + total = total + digit(n) +Next + +Print +Print "First";total; " primes" +Print "nr: total found expected difference" + +For d = 1 To 9 + n = digit(d) + found = n / total * 100 + expect = (Log(1 + 1 / d) / Log(10)) * 100 + Print Using " ## ######## ###.## % ###.## % ###.### %"; _ + d; n ; found; expect; expect - found +Next + + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Benfords-law/Phix/benfords-law-1.phix b/Task/Benfords-law/Phix/benfords-law-1.phix new file mode 100644 index 0000000000..457a5fa409 --- /dev/null +++ b/Task/Benfords-law/Phix/benfords-law-1.phix @@ -0,0 +1,14 @@ +procedure main(sequence s, string title) +sequence f = repeat(0,9) + for i=1 to length(s) do + f[sprint(s[i])[1]-'0'] += 1 + end for + puts(1,title) + puts(1,"Digit Observed% Predicted%\n") + for i=1 to length(f) do + printf(1," %d %9.3f %8.3f\n", {i, f[i]/length(s)*100, log10(1+1/i)*100}) + end for +end procedure +main(fib(1000),"First 1000 Fibonacci numbers\n") +main(primes(10000),"First 10000 Prime numbers\n") +main(threes(500),"First 500 powers of three\n") diff --git a/Task/Benfords-law/Phix/benfords-law-2.phix b/Task/Benfords-law/Phix/benfords-law-2.phix new file mode 100644 index 0000000000..cf89b3d84f --- /dev/null +++ b/Task/Benfords-law/Phix/benfords-law-2.phix @@ -0,0 +1,39 @@ +function fib(integer lim) +atom a=0, b=1 +sequence res = repeat(0,lim) + for i=1 to lim do + {res[i], a, b} = {b, b, b+a} + end for + return res +end function + +function primes(integer lim) +integer n = 1, k, p +sequence res = {2} + while length(res) log10); +} * 9; + +"%17s%17s\n".printf("Observed","Expected"); +{ |i| + "%d : %11s %%%15s %%\n".printf( + i, "%.2f".sprintf(100 * actuals[i - 1]), + "%.2f".sprintf(100 * expected[i - 1]), + ); +} * 9; diff --git a/Task/Benfords-law/Visual-FoxPro/benfords-law.visual b/Task/Benfords-law/Visual-FoxPro/benfords-law.visual new file mode 100644 index 0000000000..54cebaa6a5 --- /dev/null +++ b/Task/Benfords-law/Visual-FoxPro/benfords-law.visual @@ -0,0 +1,40 @@ +#DEFINE CTAB CHR(9) +#DEFINE COMMA "," +#DEFINE CRLF CHR(13) + CHR(10) +LOCAL i As Integer, n As Integer, n1 As Integer, rho As Double, c As String +n = 1000 +LOCAL ARRAY a[n,2], res[1] +CLOSE DATABASES ALL +CREATE CURSOR fibo(dig C(1)) +INDEX ON dig TAG dig COLLATE "Machine" +SET ORDER TO 0 +*!* Populate the cursor with the leading digit of the first 1000 Fibonacci numbers +a[1,1] = "1" +a[1,2] = 1 +a[2,1] = "1" +a[2,2] = 1 +FOR i = 3 TO n + a[i,2] = a[i-2,2] + a[i-1,2] + a[i,1] = LEFT(TRANSFORM(a[i,2]), 1) +ENDFOR +APPEND FROM ARRAY a FIELDS dig +CREATE CURSOR results (digit I, count I, prob B(6), expected B(6)) +INSERT INTO results ; +SELECT dig, COUNT(1), COUNT(1)/n, Pr(VAL(dig)) FROM fibo GROUP BY dig ORDER BY dig +n1 = RECCOUNT() +*!* Correlation coefficient +SELECT (n1*SUM(prob*expected) - SUM(prob)*SUM(expected))/; +(SQRT(n1*SUM(prob*prob) - SUM(prob)*SUM(prob))*SQRT(n1*SUM(expected*expected) - SUM(expected)*SUM(expected))) ; +FROM results INTO ARRAY res +rho = CAST(res[1] As B(6)) +SET SAFETY OFF +COPY TO benford.txt TYPE CSV +c = FILETOSTR("benford.txt") +*!* Replace commas with tabs +c = STRTRAN(c, COMMA, CTAB) + CRLF + "Correlation Coefficient: " + TRANSFORM(rho) +STRTOFILE(c, "benford.txt", 0) +SET SAFETY ON + +FUNCTION Pr(d As Integer) As Double +RETURN LOG10(1 + 1/d) +ENDFUNC diff --git a/Task/Benfords-law/jq/benfords-law.jq b/Task/Benfords-law/jq/benfords-law.jq new file mode 100644 index 0000000000..5281081453 --- /dev/null +++ b/Task/Benfords-law/jq/benfords-law.jq @@ -0,0 +1,107 @@ +# Generate the first n Fibonacci numbers: 1, 1, ... +# Numerical accuracy is insufficient beyond about 1450. +def fibonacci(n): + # input: [f(i-2), f(i-1), countdown] + def fib: (.[0] + .[1]) as $sum + | if .[2] <= 0 then empty + elif .[2] == 1 then $sum + else $sum, ([ .[1], $sum, .[2] - 1 ] | fib) + end; + [1, 0, n] | fib ; + +# is_prime is tailored to work with jq 1.4 +def is_prime: + if . == 2 then true + else 2 < . and . % 2 == 1 and + . as $in + | (($in + 1) | sqrt) as $m + | (((($m - 1) / 2) | floor) + 1) as $max + | reduce range(1; $max) as $i + (true; if . then ($in % ((2 * $i) + 1)) > 0 else false end) + end ; + +# primes in [m,n) +def primes(m;n): + range(m;n) | select(is_prime); + +def runs: + reduce .[] as $item + ( []; + if . == [] then [ [ $item, 1] ] + else .[length-1] as $last + | if $last[0] == $item + then (.[0:length-1] + [ [$item, $last[1] + 1] ] ) + else . + [[$item, 1]] + end + end ) ; + +# Inefficient but brief: +def histogram: sort | runs; + +def benford_probability: + tonumber + | if . > 0 then ((1 + (1 /.)) | log) / (10|log) + else 0 + end ; + +# benford takes a stream and produces an array of [ "d", observed, expected ] +def benford(stream): + [stream | tostring | .[0:1] ] | histogram as $histogram + | reduce ($histogram | .[] | .[0]) as $digit + ([]; . + [$digit, ($digit|benford_probability)] ) + | map(select(type == "number")) as $probabilities + | ([ $histogram | .[] | .[1] ] | add) as $total + | reduce range(0; $histogram|length) as $i + ([]; . + ([$histogram[$i] + [$total * $probabilities[$i]] ] ) ) ; + +# given an array of [value, observed, expected] values, +# produce the χ² statistic +def chiSquared: + reduce .[] as $triple + (0; + if $triple[2] == 0 then . + else . + ($triple[1] as $o | $triple[2] as $e | ($o - $e) | (.*.)/$e) + end) ; + +# truncate n places after the decimal point; +# return a string since it can readily be converted back to a number +def precision(n): + tostring as $s | $s | index(".") + | if . then $s[0:.+n+1] else $s end ; + +# Right-justify but do not truncate +def rjustify(n): + length as $length | if n <= $length then . else " " * (n-$length) + . end; + +# Attempt to align decimals so integer part is in a field of width n +def align(n): + index(".") as $ix + | if n < $ix then . + elif $ix then (.[0:$ix]|rjustify(n)) +.[$ix:] + else rjustify(n) + end ; + +# given an array of [value, observed, expected] values, +# produce rows of the form: value observed expected +def print_rows(prec): + .[] | map( precision(prec)|align(5) + " ") | add ; + +def report(heading; stream): + benford(stream) as $array + | heading, + " Digit Observed Expected", + ( $array | print_rows(2) ), + "", + " χ² = \( $array | chiSquared | precision(4))", + "" +; + +def task: + report("First 100 fibonacci numbers:"; fibonacci( 100) ), + report("First 1000 fibonacci numbers:"; fibonacci(1000) ), + report("Primes less than 1000:"; primes(2;1000)), + report("Primes between 1000 and 10000:"; primes(1000;10000)), + report("Primes less than 100000:"; primes(2;100000)) +; + +task diff --git a/Task/Bernoulli-numbers/Crystal/bernoulli-numbers.crystal b/Task/Bernoulli-numbers/Crystal/bernoulli-numbers.crystal new file mode 100644 index 0000000000..f932ca814f --- /dev/null +++ b/Task/Bernoulli-numbers/Crystal/bernoulli-numbers.crystal @@ -0,0 +1,62 @@ +# Taken from the 'Ada 99' project, https://marquisdegeek.com/code_ada99 + +class Fraction + def initialize(n : Int64, d : Int64) + @numerator = n + @denominator = d + end + + def numerator + @numerator + end + + def denominator + @denominator + end + + def subtract(rhs_fraction) + rhs_numerator = rhs_fraction.numerator * @denominator + rhs_denominator = rhs_fraction.denominator * @denominator + @numerator *= rhs_fraction.denominator + @denominator *= rhs_fraction.denominator + @numerator -= rhs_numerator + self.reduce + end + + def multiply(value) + @numerator *= value + end + + def reduce + gcd = gcd(@numerator, @denominator) + @numerator /= gcd + @denominator /= gcd + end + + def to_s + @numerator == 0 ? 0 : @numerator.to_s + '/' + @denominator.to_s + end +end + +def gcd(a, b) + # we need b>0 because b on its own isn't considered true + b > 0 ? gcd(b, a % b) : a +end + +def calculate_bernoulli(bern) + row = [] of Fraction + 0_i64.step(bern) do |m| + row << Fraction.new(1_i64, m + 1) + m.step(1, -1) do |j| + row[j - 1].subtract(row[j]) + row[j - 1].multiply(j) + row[j - 1].reduce + end + end + + row[0] +end + +1_i64.step(30_i64) do |bern| + puts "#{bern} : #{calculate_bernoulli(bern).to_s}" +end diff --git a/Task/Bernoulli-numbers/EchoLisp/bernoulli-numbers-1.echolisp b/Task/Bernoulli-numbers/EchoLisp/bernoulli-numbers-1.echolisp new file mode 100644 index 0000000000..a428612fec --- /dev/null +++ b/Task/Bernoulli-numbers/EchoLisp/bernoulli-numbers-1.echolisp @@ -0,0 +1,24 @@ +(lib 'bigint) ;; lerge numbers +(lib 'gloops) ;; classes + +(define-class Rational null ((a :initform #0) (b :initform #1))) +(define-method tostring (Rational) (lambda (r) (format "%50d / %d" r.a r.b))) +(define-method normalize (Rational) (lambda (r) ;; divide a and b by gcd + (let ((g (gcd r.a r.b))) + (set! r.a (/ r.a g)) (set! r.b (/ r.b g)) + (when (< r.b 0) (set! r.a ( - r.a)) (set! r.b (- r.b))) ;; denominator > 0 + r))) + +(define-method initialize (Rational) (lambda (r) (normalize r))) +(define-method add (Rational) (lambda (r n) ;; + Rational any number + (normalize (Rational (+ (* (+ #0 n) r.b) r.a) r.b)))) +(define-method add (Rational Rational) (lambda (r q) ;;; + Rational Rational + (normalize (Rational (+ (* r.a q.b) (* r.b q.a)) (* r.b q.b))))) +(define-method sub (Rational Rational) (lambda (r q) + (normalize (Rational (- (* r.a q.b) (* r.b q.a)) (* r.b q.b))))) +(define-method mul (Rational Rational) (lambda (r q) + (normalize (Rational (* r.a q.a) (* r.b q.b))))) +(define-method mul (Rational) (lambda (r n) + (normalize (Rational (* r.a (+ #0 n)) r.b )))) +(define-method div (Rational Rational) (lambda (r q) + (normalize (Rational (* r.a q.b) (* r.b q.a))))) diff --git a/Task/Bernoulli-numbers/EchoLisp/bernoulli-numbers-2.echolisp b/Task/Bernoulli-numbers/EchoLisp/bernoulli-numbers-2.echolisp new file mode 100644 index 0000000000..bfa16a2b0c --- /dev/null +++ b/Task/Bernoulli-numbers/EchoLisp/bernoulli-numbers-2.echolisp @@ -0,0 +1,47 @@ +;; Bernoulli numbers +;; http://rosettacode.org/wiki/Bernoulli_numbers +(define A (make-vector 100 0)) + +(define (B n) +(for ((m (1+ n))) ;; #1 creates a large integer + (vector-set! A m (Rational #1 (+ #1 m))) + (for ((j (in-range m 0 -1))) + (vector-set! A (1- j) + (mul (sub (vector-ref A (1- j)) (vector-ref A j)) j)))) + (vector-ref A 0)) + + (for ((b (in-range 0 62 2))) (writeln b (B b))) → + +0 1 / 1 +2 1 / 6 +4 -1 / 30 +6 1 / 42 +8 -1 / 30 +10 5 / 66 +12 -691 / 2730 +14 7 / 6 +16 -3617 / 510 +18 43867 / 798 +20 -174611 / 330 +22 854513 / 138 +24 -236364091 / 2730 +26 8553103 / 6 +28 -23749461029 / 870 +30 8615841276005 / 14322 +32 -7709321041217 / 510 +34 2577687858367 / 6 +36 -26315271553053477373 / 1919190 +38 2929993913841559 / 6 +40 -261082718496449122051 / 13530 +42 1520097643918070802691 / 1806 +44 -27833269579301024235023 / 690 +46 596451111593912163277961 / 282 +48 -5609403368997817686249127547 / 46410 +50 495057205241079648212477525 / 66 +52 -801165718135489957347924991853 / 1590 +54 29149963634884862421418123812691 / 798 +56 -2479392929313226753685415739663229 / 870 +58 84483613348880041862046775994036021 / 354 +60 -1215233140483755572040304994079820246041491 / 56786730 + +(B 1) → 1 / 2 diff --git a/Task/Bernoulli-numbers/FreeBASIC/bernoulli-numbers.freebasic b/Task/Bernoulli-numbers/FreeBASIC/bernoulli-numbers.freebasic new file mode 100644 index 0000000000..1b963e3df4 --- /dev/null +++ b/Task/Bernoulli-numbers/FreeBASIC/bernoulli-numbers.freebasic @@ -0,0 +1,54 @@ +' version 08-10-2016 +' compile with: fbc -s console +' uses gmp + +#Include Once "gmp.bi" + +#Define max 60 + +Dim As Long n +Dim As ZString Ptr gmp_str :gmp_str = Allocate(1000) ' 1000 char +Dim Shared As Mpq_ptr tmp, big_j +tmp = Allocate(Len(__mpq_struct)) :Mpq_init(tmp) +big_j = Allocate(Len(__mpq_struct)) :Mpq_init(big_j) + +Dim Shared As Mpq_ptr a(max), b(max) +For n = 0 To max + A(n) = Allocate(Len(__mpq_struct)) :Mpq_init(A(n)) + B(n) = Allocate(Len(__mpq_struct)) :Mpq_init(B(n)) +Next + +Function Bernoulli(n As Integer) As Mpq_ptr + + Dim As Long m, j + + For m = 0 To n + Mpq_set_ui(A(m), 1, m + 1) + For j = m To 1 Step - 1 + Mpq_sub(tmp, A(j - 1), A(j)) + Mpq_set_ui(big_j, j, 1) 'big_j = j + Mpq_mul(A(j - 1), big_j, tmp) + Next + Next + + Return A(0) +End Function + +' ------=< MAIN >=------ + +For n = 0 To max + Mpq_set(B(n), Bernoulli(n)) + Mpq_get_str(gmp_str, 10, B(n)) + If *gmp_str <> "0" Then + If *gmp_str = "1" Then *gmp_str = "1/1" + Print Using "B(##) = "; n; + Print Space(45 - InStr(*gmp_str, "/")); *gmp_str + End If +Next + + +' empty keyboard buffer +While Inkey <> "" :Wend +Print :Print "hit any key to end program" +Sleep +End diff --git a/Task/Bernoulli-numbers/FunL/bernoulli-numbers.funl b/Task/Bernoulli-numbers/FunL/bernoulli-numbers.funl new file mode 100644 index 0000000000..33269b88ed --- /dev/null +++ b/Task/Bernoulli-numbers/FunL/bernoulli-numbers.funl @@ -0,0 +1,6 @@ +import integers.choose + +def B( n ) = sum( 1/(k + 1)*sum((if 2|r then 1 else -1)*choose(k, r)*(r^n) | r <- 0..k) | k <- 0..n ) + +for i <- 0..60 if i == 1 or 2|i + printf( "B(%2d) = %s\n", i, B(i) ) diff --git a/Task/Bernoulli-numbers/Phix/bernoulli-numbers-1.phix b/Task/Bernoulli-numbers/Phix/bernoulli-numbers-1.phix new file mode 100644 index 0000000000..e9ae562bd9 --- /dev/null +++ b/Task/Bernoulli-numbers/Phix/bernoulli-numbers-1.phix @@ -0,0 +1,41 @@ +include builtins\bigatom.e + +constant NUM = 1, DEN = 2 + +type ba_frac(object r) + return sequence(r) and length(r)=2 and bigatom(r[NUM]) and bigatom(r[DEN]) +end type + +function ba_gcd(bigatom u, bigatom v) +bigatom t + u = ba_floor(ba_abs(u)) + v = ba_floor(ba_abs(v)) + while v!=BA_ZERO do + t = u + u = v + v = ba_remainder(t, v) + end while + return u +end function + +function ba_frac_normalise(bigatom n, bigatom d) +bigatom g + if ba_compare(d,BA_ZERO)<0 then + n = ba_sub(0,n) + d = ba_sub(0,d) + end if + g = ba_gcd(n,d) + return {ba_idivide(n,g),ba_idivide(d,g)} +end function + +function ba_frac_sub(ba_frac a, ba_frac b) +bigatom {an,ad} = a, + {bn,bd} = b + return ba_frac_normalise(ba_sub(ba_multiply(an,bd),ba_multiply(bn,ad)),ba_multiply(ad,bd)) +end function + +function ba_frac_mul(ba_frac a, ba_frac b) +bigatom {an,ad} = a, + {bn,bd} = b + return ba_frac_normalise(ba_multiply(an,bn),ba_multiply(ad,bd)) +end function diff --git a/Task/Bernoulli-numbers/Phix/bernoulli-numbers-2.phix b/Task/Bernoulli-numbers/Phix/bernoulli-numbers-2.phix new file mode 100644 index 0000000000..c4dc2bab3c --- /dev/null +++ b/Task/Bernoulli-numbers/Phix/bernoulli-numbers-2.phix @@ -0,0 +1,10 @@ +sequence a = {} +for m=0 to 60 do + a = append(a,{ba_new(1),ba_new(m+1)}) + for j=m to 1 by -1 do + a[j] = ba_frac_mul({ba_new(j),ba_new(1)},ba_frac_sub(a[j+1],a[j])) + end for + if a[1][1]!=BA_ZERO then + printf(1,"B(%2d) = %44s / %s\n",{m,ba_sprint(a[1][1]),ba_sprint(a[1][2])}) + end if +end for diff --git a/Task/Bernoulli-numbers/SPAD/bernoulli-numbers.spad b/Task/Bernoulli-numbers/SPAD/bernoulli-numbers.spad new file mode 100644 index 0000000000..215ee3086e --- /dev/null +++ b/Task/Bernoulli-numbers/SPAD/bernoulli-numbers.spad @@ -0,0 +1 @@ +for n in 0..60 | (b:=bernoulli(n)$INTHEORY; b~=0) repeat print [n,b] diff --git a/Task/Bernoulli-numbers/Sidef/bernoulli-numbers-1.sidef b/Task/Bernoulli-numbers/Sidef/bernoulli-numbers-1.sidef new file mode 100644 index 0000000000..f0fff579be --- /dev/null +++ b/Task/Bernoulli-numbers/Sidef/bernoulli-numbers-1.sidef @@ -0,0 +1,22 @@ +func bernoulli_number{}; # must be declared before first used + +func bern_helper(n, k) { + binomial(n, k) * (bernoulli_number(k) / (n - k + 1)); +} + +func bern_diff(n, k, d) { + n < k ? d : bern_diff(n, k + 1, d - bern_helper(n + 1, k)); +} + +bernoulli_number = func(n) is cached { + + n.is_one && return 1/2; + n.is_odd && return 0; + + n > 0 ? bern_diff(n - 1, 0, 1) : 1; +} + +range(0, 60).each { |i| + var num = bernoulli_number(i) || next; + printf("B(%2d) = %44s / %s\n", i, num.parts); +} diff --git a/Task/Bernoulli-numbers/Sidef/bernoulli-numbers-2.sidef b/Task/Bernoulli-numbers/Sidef/bernoulli-numbers-2.sidef new file mode 100644 index 0000000000..c7eb730784 --- /dev/null +++ b/Task/Bernoulli-numbers/Sidef/bernoulli-numbers-2.sidef @@ -0,0 +1,13 @@ +func bernoulli_print { + var a = [] + range(0, 60).each { |m| + a << (m+1 -> inv) + m.downto(1).each { |j| + (a[j-1] -= a[j]) *= j + } + a[0] || next + printf("B(%2d) = %44s / %s\n", m, a[0].parts) + } +} + +bernoulli_print() diff --git a/Task/Bernoulli-numbers/jq/bernoulli-numbers-1.jq b/Task/Bernoulli-numbers/jq/bernoulli-numbers-1.jq new file mode 100644 index 0000000000..bc826fc308 --- /dev/null +++ b/Task/Bernoulli-numbers/jq/bernoulli-numbers-1.jq @@ -0,0 +1,39 @@ +# def negate: +# def lessOrEqual(x; y): # x <= y +# def long_add(x;y): # x+y +# def long_minus(x;y): # x-y +# def long_multiply(x;y) # x*y +# def long_divide(x;y): # x/y => [q,r] +# def long_div(x;y) # integer division +# def long_mod(x;y) # % + +# In all cases, x and y must be strings + +def negate: (- tonumber) | tostring; + +def lessOrEqual(num1; num2): (num1|tonumber) <= (num2|tonumber); + +def long_add(num1; num2): ((num1|tonumber) + (num2|tonumber)) | tostring; + +def long_minus(x;y): ((num1|tonumber) - (num2|tonumber)) | tostring; + +# multiply two decimal strings, which may be signed (+ or -) +def long_multiply(num1; num2): + ((num1|tonumber) * (num2|tonumber)) | tostring; + +# return [quotient, remainder] +# 0/0 = 1; n/0 => error +def long_divide(xx;yy): # x/y => [q,r] imples x == (y * q) + r + def ld(x;y): + def abs: if . < 0 then -. else . end; + (x|abs) as $x | (y|abs) as $y + | (if (x >= 0 and y > 0) or (x < 0 and y < 0) then 1 else -1 end) as $sign + | (if x >= 0 then 1 else -1 end) as $sx + | [$sign * ($x / $y | floor), $sx * ($x % $y)]; + ld( xx|tonumber; yy|tonumber) | map(tostring); + +def long_div(x;y): + long_divide(x;y) | .[0]; + +def long_mod(x;y): + ((x|tonumber) % (y|tonumber)) | tostring; diff --git a/Task/Bernoulli-numbers/jq/bernoulli-numbers-2.jq b/Task/Bernoulli-numbers/jq/bernoulli-numbers-2.jq new file mode 100644 index 0000000000..520f9af5a4 --- /dev/null +++ b/Task/Bernoulli-numbers/jq/bernoulli-numbers-2.jq @@ -0,0 +1,54 @@ +# A fraction is represented by [numerator, denominator] in reduced form, with the sign on top + +# a and b should be BigInt; return a BigInt +def gcd(a; b): + def long_abs: . as $in | if lessOrEqual("0"; $in) then $in else negate end; + + # subfunction rgcd expects [a,b] as input + # i.e. a ~ .[0] and b ~ .[1] + def rgcd: + .[0] as $a | .[1] as $b + | if $b == "0" then $a + else [$b, long_mod($a ; $b ) ] | rgcd + end; + + a as $a | b as $b + | [$a,$b] | rgcd | long_abs ; + +def normalize: + .[0] as $p | .[1] as $q + | if $p == "0" then ["0", "1"] + elif lessOrEqual($q ; "0") then [ ($p|negate), ($q|negate)] | normalize + else gcd($p; $q) as $g + | [ long_div($p;$g), long_div($q;$g) ] + end ; + +# a and b should be fractions expressed in the form [p, q] +def add(a; b): + a as $a | b as $b + | if $a[1] == "1" and $b[1] == "1" then [ long_add($a[0]; $b[0]) , "1"] + elif $a[1] == $b[1] then [ long_add( $a[0]; $b[0]), $a[1] ] | normalize + elif $a[0] == "0" then $b + elif $b[0] == "0" then $a + else [ long_add( long_multiply($a[0]; $b[1]) ; long_multiply($b[0]; $a[1])), + long_multiply($a[1]; $b[1]) ] + | normalize + end ; + +# a and/or b may be BigInts, or [p,q] fractions +def multiply(a; b): + a as $a | b as $b + | if ($a|type) == "string" and ($b|type) == "string" then [ long_multiply($a; $b), "1"] + else + if $a|type == "string" then [ long_multiply( $a; $b[0]), $b[1] ] + elif $b|type == "string" then [ long_multiply( $b; $a[0]), $a[1] ] + else [ long_multiply( $a[0]; $b[0]), long_multiply($a[1]; $b[1]) ] + end + | normalize + end ; + +def minus(a; b): + a as $a | b as $b + | if $a == $b then ["0", "1"] + else add($a; [ ($b[0]|negate), $b[1] ] ) + end ; diff --git a/Task/Bernoulli-numbers/jq/bernoulli-numbers-3.jq b/Task/Bernoulli-numbers/jq/bernoulli-numbers-3.jq new file mode 100644 index 0000000000..129843183a --- /dev/null +++ b/Task/Bernoulli-numbers/jq/bernoulli-numbers-3.jq @@ -0,0 +1,10 @@ +# Using the algorithm in the task description: +def bernoulli(n): + reduce range(0; n+1) as $m + ( []; + .[$m] = ["1", long_add($m|tostring; "1")] # i.e. 1 / ($m+1) + | reduce ($m - range(0 ; $m)) as $j + (.; + .[$j-1] = multiply( [($j|tostring), "1"]; minus( .[$j-1] ; .[$j]) ) )) + | .[0] # (which is Bn) + ; diff --git a/Task/Bernoulli-numbers/jq/bernoulli-numbers-4.jq b/Task/Bernoulli-numbers/jq/bernoulli-numbers-4.jq new file mode 100644 index 0000000000..68c2b58035 --- /dev/null +++ b/Task/Bernoulli-numbers/jq/bernoulli-numbers-4.jq @@ -0,0 +1,2 @@ +range(0;61) +| if . % 2 == 0 or . == 1 then "\(.): \(bernoulli(.) )" else empty end diff --git a/Task/Bernoulli-numbers/jq/bernoulli-numbers-5.jq b/Task/Bernoulli-numbers/jq/bernoulli-numbers-5.jq new file mode 100644 index 0000000000..8f552dfc7c --- /dev/null +++ b/Task/Bernoulli-numbers/jq/bernoulli-numbers-5.jq @@ -0,0 +1,33 @@ +$ jq -n -r -f Bernoulli.jq +0: ["1","1"] +1: ["1","2"] +2: ["1","6"] +4: ["-1","30"] +6: ["1","42"] +8: ["-1","30"] +10: ["5","66"] +12: ["-691","2730"] +14: ["7","6"] +16: ["-3617","510"] +18: ["43867","798"] +20: ["-174611","330"] +22: ["854513","138"] +24: ["-236364091","2730"] +26: ["8553103","6"] +28: ["-23749461029","870"] +30: ["8615841276005","14322"] +32: ["-7709321041217","510"] +34: ["2577687858367","6"] +36: ["-26315271553053477373","1919190"] +38: ["2929993913841559","6"] +40: ["-261082718496449122051","13530"] +42: ["1520097643918070802691","1806"] +44: ["-27833269579301024235023","690"] +46: ["596451111593912163277961","282"] +48: ["-5609403368997817686249127547","46410"] +50: ["495057205241079648212477525","66"] +52: ["-801165718135489957347924991853","1590"] +54: ["29149963634884862421418123812691","798"] +56: ["-2479392929313226753685415739663229","870"] +58: ["84483613348880041862046775994036021","354"] +60: ["-1215233140483755572040304994079820246041491","56786730"] diff --git a/Task/Best-shuffle/Phix/best-shuffle.phix b/Task/Best-shuffle/Phix/best-shuffle.phix new file mode 100644 index 0000000000..686cd7878c --- /dev/null +++ b/Task/Best-shuffle/Phix/best-shuffle.phix @@ -0,0 +1,15 @@ +constant tests = {"abracadabra", "seesaw", "elk", "grrrrrr", "up", "a"} +string s,t + for test=1 to length(tests) do + s = tests[test] + t = shuffle(s) + for i=1 to length(t) do + for j=1 to length(t) do + if i!=j and t[i]!=s[j] and t[j]!=s[i] then + {t[i], t[j]} = {t[j], t[i]} + exit + end if + end for + end for + printf(1,"%s -> %s (%d)\n",{s,t,sum(sq_eq(t,s))}) + end for diff --git a/Task/Best-shuffle/Sidef/best-shuffle.sidef b/Task/Best-shuffle/Sidef/best-shuffle.sidef new file mode 100644 index 0000000000..2782238e66 --- /dev/null +++ b/Task/Best-shuffle/Sidef/best-shuffle.sidef @@ -0,0 +1,22 @@ +func best_shuffle(String orig) -> (String, Number) { + + var s = orig.chars + var t = s.shuffle + + s.range.each { |i| + s.range.each { |j| + if (i!=j && t[i]!=s[j] && t[j]!=s[i]) { + t[i, j] = t[j, i]; + break; + } + } + } + + var word = t.join; + (word, orig ^ word -> count("\0")); +} + +.each { |word| + var (sword, score) = best_shuffle(word) + "%-12s %12s: %d\n".printf(word, sword, score) +} diff --git a/Task/Binary-digits/8th/binary-digits.8th b/Task/Binary-digits/8th/binary-digits.8th new file mode 100644 index 0000000000..1df66b3a8e --- /dev/null +++ b/Task/Binary-digits/8th/binary-digits.8th @@ -0,0 +1,2 @@ +2 base drop +#50 . cr diff --git a/Task/Binary-digits/Axe/binary-digits.axe b/Task/Binary-digits/Axe/binary-digits.axe new file mode 100644 index 0000000000..92ca80e352 --- /dev/null +++ b/Task/Binary-digits/Axe/binary-digits.axe @@ -0,0 +1,11 @@ +Lbl BIN +.Axe supports 16-bit integers, so 16 digits are enough +L₁+16→P +0→{P} +While r₁ + P-- + {(r₁ and 1)▶Hex+3}→P + r₁/2→r₁ +End +Disp P,i +Return diff --git a/Task/Binary-digits/EchoLisp/binary-digits.echolisp b/Task/Binary-digits/EchoLisp/binary-digits.echolisp new file mode 100644 index 0000000000..54bd5a52f0 --- /dev/null +++ b/Task/Binary-digits/EchoLisp/binary-digits.echolisp @@ -0,0 +1,9 @@ +;; primitive : (number->string number [base]) - default base = 10 + +(number->string 2 2) +→ 10 + +(for-each (compose writeln (rcurry number->string 2)) '( 5 50 9000)) → +101 +110010 +10001100101000 diff --git a/Task/Binary-digits/FreeBASIC/binary-digits.freebasic b/Task/Binary-digits/FreeBASIC/binary-digits.freebasic new file mode 100644 index 0000000000..6471f07add --- /dev/null +++ b/Task/Binary-digits/FreeBASIC/binary-digits.freebasic @@ -0,0 +1,9 @@ +' FreeBASIC v1.05.0 win64 +Dim As String fmt = "#### -> &" +Print Using fmt; 5; Bin(5) +Print Using fmt; 50; Bin(50) +Print Using fmt; 9000; Bin(9000) +Print +Print "Press any key to exit the program" +Sleep +End diff --git a/Task/Binary-digits/FunL/binary-digits.funl b/Task/Binary-digits/FunL/binary-digits.funl new file mode 100644 index 0000000000..3d0cc837e6 --- /dev/null +++ b/Task/Binary-digits/FunL/binary-digits.funl @@ -0,0 +1,2 @@ +for n <- [5, 50, 9000, 9000000000] + println( n, bin(n) ) diff --git a/Task/Binary-digits/Futhark/binary-digits.futhark b/Task/Binary-digits/Futhark/binary-digits.futhark new file mode 100644 index 0000000000..daaaaceb8a --- /dev/null +++ b/Task/Binary-digits/Futhark/binary-digits.futhark @@ -0,0 +1,6 @@ +fun main(x: i32): i64 = + loop (out = 0i64) = for i < 32 do + let digit = (x >> (31-i)) & 1 + let out = (out * 10i64) + i64(digit) + in out + in out diff --git a/Task/Binary-digits/Idris/binary-digits.idris b/Task/Binary-digits/Idris/binary-digits.idris new file mode 100644 index 0000000000..c9165aeb41 --- /dev/null +++ b/Task/Binary-digits/Idris/binary-digits.idris @@ -0,0 +1,18 @@ +module Main + +binaryDigit : Integer -> Char +binaryDigit n = if (mod n 2) == 1 then '1' else '0' + +binaryString : Integer -> String +binaryString 0 = "0" +binaryString n = pack (loop n []) + where loop : Integer -> List Char -> List Char + loop 0 acc = acc + loop n acc = loop (div n 2) (binaryDigit n :: acc) + +main : IO () +main = do + putStrLn (binaryString 0) + putStrLn (binaryString 5) + putStrLn (binaryString 50) + putStrLn (binaryString 9000) diff --git a/Task/Binary-digits/LFE/binary-digits-1.lfe b/Task/Binary-digits/LFE/binary-digits-1.lfe new file mode 100644 index 0000000000..7d1dc0f174 --- /dev/null +++ b/Task/Binary-digits/LFE/binary-digits-1.lfe @@ -0,0 +1 @@ +(: io format '"~.2B~n~.2B~n~.2B~n" (list 5 50 9000)) diff --git a/Task/Binary-digits/LFE/binary-digits-2.lfe b/Task/Binary-digits/LFE/binary-digits-2.lfe new file mode 100644 index 0000000000..4546caec1c --- /dev/null +++ b/Task/Binary-digits/LFE/binary-digits-2.lfe @@ -0,0 +1,6 @@ +(: lists foreach + (lambda (x) + (: io format + '"~s~n" + (list (: erlang integer_to_list x 2)))) + (list 5 50 9000)) diff --git a/Task/Binary-digits/Nim/binary-digits.nim b/Task/Binary-digits/Nim/binary-digits.nim new file mode 100644 index 0000000000..7b48bb7aa6 --- /dev/null +++ b/Task/Binary-digits/Nim/binary-digits.nim @@ -0,0 +1,24 @@ +proc binDigits(x: BiggestInt, r: int): int = + ## Calculates how many digits `x` has when each digit covers `r` bits. + result = 1 + var y = x shr r + while y > 0: + y = y shr r + inc(result) + +proc toBin*(x: BiggestInt, len: Natural = 0): string = + ## converts `x` into its binary representation. The resulting string is + ## always `len` characters long. By default the length is determined + ## automatically. No leading ``0b`` prefix is generated. + var + mask: BiggestInt = 1 + shift: BiggestInt = 0 + len = if len == 0: binDigits(x, 1) else: len + result = newString(len) + for j in countdown(len-1, 0): + result[j] = chr(int((x and mask) shr shift) + ord('0')) + shift = shift + 1 + mask = mask shl 1 + +for i in 0..15: + echo toBin(i) diff --git a/Task/Binary-digits/Panda/binary-digits.panda b/Task/Binary-digits/Panda/binary-digits.panda new file mode 100644 index 0000000000..78fa950840 --- /dev/null +++ b/Task/Binary-digits/Panda/binary-digits.panda @@ -0,0 +1 @@ +0..15.radix:2 nl diff --git a/Task/Binary-digits/Peloton/binary-digits.peloton b/Task/Binary-digits/Peloton/binary-digits.peloton new file mode 100644 index 0000000000..9a6d13e539 --- /dev/null +++ b/Task/Binary-digits/Peloton/binary-digits.peloton @@ -0,0 +1,6 @@ +<@ defbaslit>2 + +<@ saybaslit>0 +<@ saybaslit>5 +<@ saybaslit>50 +<@ saybaslit>9000 diff --git a/Task/Binary-digits/Phix/binary-digits.phix b/Task/Binary-digits/Phix/binary-digits.phix new file mode 100644 index 0000000000..7327e4bab7 --- /dev/null +++ b/Task/Binary-digits/Phix/binary-digits.phix @@ -0,0 +1,3 @@ +printf(1,"%b\n",5) +printf(1,"%b\n",50) +printf(1,"%b\n",9000) diff --git a/Task/Binary-digits/Ring/binary-digits.ring b/Task/Binary-digits/Ring/binary-digits.ring new file mode 100644 index 0000000000..5f8c4b743a --- /dev/null +++ b/Task/Binary-digits/Ring/binary-digits.ring @@ -0,0 +1,12 @@ +see "Number to convert : " +give a +n = 0 +while pow(2,n+1) < a + n = n + 1 +end + +for i = n to 0 step -1 + x = pow(2,i) + if a >= x see 1 a = a - x + else see 0 ok +next diff --git a/Task/Binary-digits/SequenceL/binary-digits.sequencel b/Task/Binary-digits/SequenceL/binary-digits.sequencel new file mode 100644 index 0000000000..5ee547d93d --- /dev/null +++ b/Task/Binary-digits/SequenceL/binary-digits.sequencel @@ -0,0 +1,9 @@ +main := toBinaryString([5, 50, 9000]); + +toBinaryString(number(0)) := + let + val := "1" when number mod 2 = 1 else "0"; + in + toBinaryString(floor(number/2)) ++ val when floor(number/2) > 0 + else + val; diff --git a/Task/Binary-digits/Sidef/binary-digits.sidef b/Task/Binary-digits/Sidef/binary-digits.sidef new file mode 100644 index 0000000000..f1a512a661 --- /dev/null +++ b/Task/Binary-digits/Sidef/binary-digits.sidef @@ -0,0 +1,3 @@ +[5, 50, 9000].each { |n| + say n.as_bin; +} diff --git a/Task/Binary-digits/SkookumScript/binary-digits.skookum b/Task/Binary-digits/SkookumScript/binary-digits.skookum new file mode 100644 index 0000000000..f4815a4729 --- /dev/null +++ b/Task/Binary-digits/SkookumScript/binary-digits.skookum @@ -0,0 +1,3 @@ +println(5.binary) +println(50.binary) +println(9000.binary) diff --git a/Task/Binary-digits/Swift/binary-digits.swift b/Task/Binary-digits/Swift/binary-digits.swift new file mode 100644 index 0000000000..981a7395a1 --- /dev/null +++ b/Task/Binary-digits/Swift/binary-digits.swift @@ -0,0 +1,3 @@ +for num in [5, 50, 9000] { + println(String(num, radix: 2)) +} diff --git a/Task/Binary-digits/Visual-FoxPro/binary-digits.visual b/Task/Binary-digits/Visual-FoxPro/binary-digits.visual new file mode 100644 index 0000000000..46b5326186 --- /dev/null +++ b/Task/Binary-digits/Visual-FoxPro/binary-digits.visual @@ -0,0 +1,25 @@ +*!* Binary Digits +CLEAR +k = CAST(5 As I) +? NToBin(k) +k = CAST(50 As I) +? NToBin(k) +k = CAST(9000 As I) +? NToBin(k) + +FUNCTION NTOBin(n As Integer) As String +LOCAL i As Integer, b As String, v As Integer +b = "" +v = HiBit(n) +FOR i = 0 TO v + b = IIF(BITTEST(n, i), "1", "0") + b +ENDFOR +RETURN b +ENDFUNC + +FUNCTION HiBit(n As Double) As Integer +*!* Find the highest power of 2 in n +LOCAL v As Double +v = LOG(n)/LOG(2) +RETURN FLOOR(v) +ENDFUNC diff --git a/Task/Binary-digits/Wortel/binary-digits-1.wortel b/Task/Binary-digits/Wortel/binary-digits-1.wortel new file mode 100644 index 0000000000..c2ed44e083 --- /dev/null +++ b/Task/Binary-digits/Wortel/binary-digits-1.wortel @@ -0,0 +1,3 @@ +\.toString 2 +; the following function also casts the string to a number +^(@+ \.toString 2) diff --git a/Task/Binary-digits/Wortel/binary-digits-2.wortel b/Task/Binary-digits/Wortel/binary-digits-2.wortel new file mode 100644 index 0000000000..d1a07b911e --- /dev/null +++ b/Task/Binary-digits/Wortel/binary-digits-2.wortel @@ -0,0 +1 @@ +@each ^(console.log \.toString 2) [5 50 900] diff --git a/Task/Binary-digits/jq/binary-digits.jq b/Task/Binary-digits/jq/binary-digits.jq new file mode 100644 index 0000000000..00ace576c2 --- /dev/null +++ b/Task/Binary-digits/jq/binary-digits.jq @@ -0,0 +1,10 @@ +def binary_digits: + if . == 0 then "0" + else [recurse( if . == 0 then empty else ./2 | floor end ) % 2 | tostring] + | reverse + | .[1:] # remove the leading 0 + | join("") + end ; + +# The task: +(5, 50, 9000) | binary_digits diff --git a/Task/Binary-search/Axe/binary-search.axe b/Task/Binary-search/Axe/binary-search.axe new file mode 100644 index 0000000000..ba50708932 --- /dev/null +++ b/Task/Binary-search/Axe/binary-search.axe @@ -0,0 +1,16 @@ +Lbl BSEARCH +0→L +r₃-1→H +While L≤H + (L+H)/2→M + If {L+M}>r₂ + M-1→H + ElseIf {L+M} as[i] for all i < low + -- value < as[i] for all i > high + let mid = (low+high) / 2 + in if as[mid] > value + then (low, mid - 1) + else if as[mid] < value + then (mid + 1, high) + else (mid, mid-1) -- Force termination. + in low diff --git a/Task/Binary-search/Nim/binary-search-1.nim b/Task/Binary-search/Nim/binary-search-1.nim new file mode 100644 index 0000000000..da87d95250 --- /dev/null +++ b/Task/Binary-search/Nim/binary-search-1.nim @@ -0,0 +1,4 @@ +import algorithm + +let s = @[2,3,4,5,6,7,8,9,10,12,14,16,18,20,22,25,27,30] +echo binarySearch(s, 10) diff --git a/Task/Binary-search/Nim/binary-search-2.nim b/Task/Binary-search/Nim/binary-search-2.nim new file mode 100644 index 0000000000..5c54b3bfc0 --- /dev/null +++ b/Task/Binary-search/Nim/binary-search-2.nim @@ -0,0 +1,7 @@ +proc binarySearch[T](a: openArray[T], key: T): int = + var b = len(a) + while result < b: + var mid = (result + b) div 2 + if a[mid] < key: result = mid + 1 + else: b = mid + if result >= len(a) or a[result] != key: result = -1 diff --git a/Task/Binary-search/Phix/binary-search-1.phix b/Task/Binary-search/Phix/binary-search-1.phix new file mode 100644 index 0000000000..6c8719c37a --- /dev/null +++ b/Task/Binary-search/Phix/binary-search-1.phix @@ -0,0 +1,16 @@ +function binary_search(sequence s, object val, integer low, integer high) + integer mid, cmp + if high < low then + return 0 -- not found + else + mid = floor( (low + high) / 2 ) + cmp = compare(s[mid], val) + if cmp > 0 then + return binary_search(s, val, low, mid-1) + elsif cmp < 0 then + return binary_search(s, val, mid+1, high) + else + return mid + end if + end if +end function diff --git a/Task/Binary-search/Phix/binary-search-2.phix b/Task/Binary-search/Phix/binary-search-2.phix new file mode 100644 index 0000000000..4ffa8d6cb3 --- /dev/null +++ b/Task/Binary-search/Phix/binary-search-2.phix @@ -0,0 +1,17 @@ +function binary_search(sequence s, object val) + integer low, high, mid, cmp + low = 1 + high = length(s) + while low <= high do + mid = floor( (low + high) / 2 ) + cmp = compare(s[mid], val) + if cmp > 0 then + high = mid - 1 + elsif cmp < 0 then + low = mid + 1 + else + return mid + end if + end while + return 0 -- not found +end function diff --git a/Task/Binary-search/Ring/binary-search.ring b/Task/Binary-search/Ring/binary-search.ring new file mode 100644 index 0000000000..b52ffc3042 --- /dev/null +++ b/Task/Binary-search/Ring/binary-search.ring @@ -0,0 +1,20 @@ +decimals(0) +array = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70] + +find= 42 +index = where(array, find, 0, len(array)) +if index >= 0 + see "the value " + find+ " was found at index " + index +else + see "the value " + find + " was not found" +ok + +func where a, s, b, t + h = 2 + while h<(t-b) h *= 2 end + h /= 2 + while h != 0 + if (b+h)<=t if s>=a[b+h] b += h ok ok + h /= 2 + end + if s=a[b] return b-1 else return -1 ok diff --git a/Task/Binary-search/SequenceL/binary-search.sequencel b/Task/Binary-search/SequenceL/binary-search.sequencel new file mode 100644 index 0000000000..b4cde6f042 --- /dev/null +++ b/Task/Binary-search/SequenceL/binary-search.sequencel @@ -0,0 +1,11 @@ +binarySearch(A(1), value(0), low(0), high(0)) := + let + mid := low + (high - low) / 2; + in + -1 when high < low //Not Found + else + binarySearch(A, value, low, mid - 1) when A[mid] > value + else + binarySearch(A, value, mid + 1, high) when A[mid] < value + else + mid; diff --git a/Task/Binary-search/Sidef/binary-search-1.sidef b/Task/Binary-search/Sidef/binary-search-1.sidef new file mode 100644 index 0000000000..3d61581f48 --- /dev/null +++ b/Task/Binary-search/Sidef/binary-search-1.sidef @@ -0,0 +1,14 @@ +func binary_search(a, i) { + + var l = 0; + var h = a.end; + + while (l <= h) { + var mid = (h+l / 2 -> int); + a[mid] > i && (h = mid-1; next); + a[mid] < i && (l = mid+1; next); + return mid; + } + + return -1; +} diff --git a/Task/Binary-search/Sidef/binary-search-2.sidef b/Task/Binary-search/Sidef/binary-search-2.sidef new file mode 100644 index 0000000000..b85b85becc --- /dev/null +++ b/Task/Binary-search/Sidef/binary-search-2.sidef @@ -0,0 +1,13 @@ +func binary_search(arr, value, low=0, high=arr.end) { + high < low && return -1; + var middle = (high+low / 2 -> int); + + if (value < arr[middle]) { + return binary_search(arr, value, low, middle-1); + } + elsif (value > arr[middle]) { + return binary_search(arr, value, middle+1, high); + } + + return middle; +} diff --git a/Task/Binary-search/Sidef/binary-search-3.sidef b/Task/Binary-search/Sidef/binary-search-3.sidef new file mode 100644 index 0000000000..e91102edcb --- /dev/null +++ b/Task/Binary-search/Sidef/binary-search-3.sidef @@ -0,0 +1 @@ +say binary_search([34, 42, 55, 778], 55); #=> 2 diff --git a/Task/Binary-search/Swift/binary-search-1.swift b/Task/Binary-search/Swift/binary-search-1.swift new file mode 100644 index 0000000000..c7727bed1f --- /dev/null +++ b/Task/Binary-search/Swift/binary-search-1.swift @@ -0,0 +1,10 @@ +func binarySearch(xs: [T], x: T) -> Int? { + var recurse: ((Int, Int) -> Int?)! + recurse = {(low, high) in switch (low + high) / 2 { + case _ where high < low: return nil + case let mid where xs[mid] > x: return recurse(low, mid - 1) + case let mid where xs[mid] < x: return recurse(mid + 1, high) + case let mid: return mid + }} + return recurse(0, xs.count - 1) +} diff --git a/Task/Binary-search/Swift/binary-search-2.swift b/Task/Binary-search/Swift/binary-search-2.swift new file mode 100644 index 0000000000..c3c2fcfe36 --- /dev/null +++ b/Task/Binary-search/Swift/binary-search-2.swift @@ -0,0 +1,11 @@ +func binarySearch(xs: [T], x: T) -> Int? { + var (low, high) = (0, xs.count - 1) + while low <= high { + switch (low + high) / 2 { + case let mid where xs[mid] > x: high = mid - 1 + case let mid where xs[mid] < x: low = mid + 1 + case let mid: return mid + } + } + return nil +} diff --git a/Task/Binary-search/Swift/binary-search-3.swift b/Task/Binary-search/Swift/binary-search-3.swift new file mode 100644 index 0000000000..77a2318b30 --- /dev/null +++ b/Task/Binary-search/Swift/binary-search-3.swift @@ -0,0 +1,15 @@ +func testBinarySearch(n: Int) { + let odds = Array(stride(from: 1, through: n, by: 2)) + let result = flatMap(0...n) {binarySearch(odds, $0)} + assert(result == Array(0..(source: [T], transform: (T) -> U?) -> [U] { + return source.reduce([]) {(var xs, x) in if let x = transform(x) {xs.append(x)}; return xs} +} diff --git a/Task/Binary-search/Wortel/binary-search.wortel b/Task/Binary-search/Wortel/binary-search.wortel new file mode 100644 index 0000000000..745a5afd26 --- /dev/null +++ b/Task/Binary-search/Wortel/binary-search.wortel @@ -0,0 +1,24 @@ +; Recursive +@var rec &[a v l h] [ + @if < h l @return null + @var m @/ +h l 2 + @? { + > `m a v @!rec[a v l -m 1] + < `m a v @!rec[a v +1 m h] + m + } +] + +; Iterative +@var itr &[a v] [ + @vars{l 0 h #-a} + @while <= l h [ + @var m @/ +l h 2 + @iff { + > `m a v :h -m 1 + < `m a v :l +m 1 + @return m + } + ] + null +] diff --git a/Task/Binary-search/jq/binary-search-1.jq b/Task/Binary-search/jq/binary-search-1.jq new file mode 100644 index 0000000000..791e261bd8 --- /dev/null +++ b/Task/Binary-search/jq/binary-search-1.jq @@ -0,0 +1,11 @@ +def binarySearch(value): + # To avoid copying the array, simply pass in the current low and high offsets + def binarySearch(low; high): + if (high < low) then (-1 - low) + else ( (low + high) / 2 | floor) as $mid + | if (.[$mid] > value) then binarySearch(low; $mid-1) + elif (.[$mid] < value) then binarySearch($mid+1; high) + else $mid + end + end; + binarySearch(0; length-1); diff --git a/Task/Binary-search/jq/binary-search-2.jq b/Task/Binary-search/jq/binary-search-2.jq new file mode 100644 index 0000000000..596bb1907d --- /dev/null +++ b/Task/Binary-search/jq/binary-search-2.jq @@ -0,0 +1 @@ +[-1,-1.1,1,1,null,[null]] | binarySearch(1) diff --git a/Task/Binary-strings/Nim/binary-strings.nim b/Task/Binary-strings/Nim/binary-strings.nim new file mode 100644 index 0000000000..a6b541c6f4 --- /dev/null +++ b/Task/Binary-strings/Nim/binary-strings.nim @@ -0,0 +1,23 @@ +var # creation + x = "this is a string" + y = "this is another string" + z = "this is a string" + +if x == z: echo "x is z" # comparison + +z = "now this is another string too" # assignment + +y = z # copying + +if x.len == 0: echo "empty" # check if empty + +x.add('!') # append a byte + +echo x[5..8] # substring +echo x[8 .. -1] # substring + +z = x & y # join strings + +import strutils + +echo z.replace('t', 'T') # replace occurences of t with T diff --git a/Task/Binary-strings/Phix/binary-strings.phix b/Task/Binary-strings/Phix/binary-strings.phix new file mode 100644 index 0000000000..54bb136206 --- /dev/null +++ b/Task/Binary-strings/Phix/binary-strings.phix @@ -0,0 +1,24 @@ +string s = "abc" + s = x"ef bb bf" -- explicit binary string (the utf8 BOM) + s[2] = 0 + s[3] = 'z' + if s="\#EF\0z" then puts(1,"ok\n") end if +string t = s + t[1..2] = "xy" -- s remains unaltered + ?t -- "xyz" + t = "food" ?t + t[2..3] = 'e' ?t -- "feed" + t[3..2] = "ast" ?t -- "feasted" + t[3..-2] = "" ?t -- "fed" + if length(t)=0 then puts(1,"t is empty\n") end if + if t!="" then puts(1,"t is not empty\n") end if + t = "be" + t &= 't' ?t -- bet + t = 'a'&t ?t -- abet + ?t[2..3] -- be + ?substitute(t,"be","bbo") -- abbot + ?substitute(t,"be","dep") -- adept + t = substitute(t,"be","dep") -- to actually modify t + ?join({"abc","def","ghi"}) -- "abc def ghi" + ?join({"abc","def","ghi"},"") -- "abcdefghi" + ?join({"abc","def","ghi"},"\n") -- "abc\ndef\nghi" diff --git a/Task/Binary-strings/Ring/binary-strings.ring b/Task/Binary-strings/Ring/binary-strings.ring new file mode 100644 index 0000000000..6e1ceaf603 --- /dev/null +++ b/Task/Binary-strings/Ring/binary-strings.ring @@ -0,0 +1,43 @@ +# string creation +x = "hello world" + +# string destruction +x = NULL + +# string assignment with a null byte +x = "a"+char(0)+"b" +see len(x) # ==> 3 + +# string comparison +if x = "hello" + See "equal" +else + See "not equal" +ok +y = 'bc' +if strcmp(x,y) < 0 + See x + " is lexicographically less than " + y +ok + +# string cloning +xx = x +See x = xx # true, same length and content + +# check if empty +if x = NULL + See "is empty" +ok + +# append a byte +x += char(7) + +# substring +x = "hello" +x[1] = "H" +See x + nl + +# join strings +a = "hel" +b = "lo w" +c = "orld" +See a + b + c diff --git a/Task/Binary-strings/jq/binary-strings-1.jq b/Task/Binary-strings/jq/binary-strings-1.jq new file mode 100644 index 0000000000..917ad8e045 --- /dev/null +++ b/Task/Binary-strings/jq/binary-strings-1.jq @@ -0,0 +1,10 @@ +# If the input is a valid representation of a binary string +# then pass it along: +def check_binary: + . as $a + | reduce .[] as $x + ($a; + if $x | (type == "number" and . == floor + and 0 <= . and . <= 255) then $a + else error("\(.) is an invalid representation of a byte") + end ); diff --git a/Task/Binary-strings/jq/binary-strings-2.jq b/Task/Binary-strings/jq/binary-strings-2.jq new file mode 100644 index 0000000000..7659ea477a --- /dev/null +++ b/Task/Binary-strings/jq/binary-strings-2.jq @@ -0,0 +1,70 @@ +## Creation of an entity representing an empty binary string + +[] + +## Assignment + +# Unless a check is appropriate, assignment can be done in the +# usual ways, for example: + +[0] as $x # assignment to a variable, $x + +s as $x # assignment of s to a variable + +.key = s # assignment to a key in a JSON object + +# If s must be checked, these become: + +(s|check_binary) as $x + +.key = (s|check_binary) + +## Concatenation: + +str+str2 + +## Comparison + +[72,101,108,108,111] == ("Hello"|explode) # evaluates to true + +# Other jq comparison operators (!=, <, >, <=, >=) can be used as well. + +## Cloning and copying +# In jq, all entities are immutable and so the distinction between +# copying and cloning is irrelevant in jq. +# For example, consider the expression "$s[0] = 1" +# in the following: + +[0] as $s | $s[0] = 1 | $s + +# The result is [0] because the expression "$s[0] = 1" +# evaluates to [1] but does not alter $s. The value of +# $s can be changed by assignment, e.g. + +[0] as $s | $s[0] = 1 | . as $s + +## Check if an entity represents the empty binary string + +length == 0 +# or +s == [] + +## append a byte, b + +s + [b] # if the byte, b, is known to be in range +s + ([b]|check_binary) # if b is suspect + +## Extract a substring from a string + +# jq uses an index origin of 0 for both JSON arrays strings, +# so to extract the substring with indices from m to (n-1) +# inclusive, the expression s[m:n] can be used. + +# There are many other possibilities, such as s[m:], s[-1], etc. + +## Replace every occurrence of one byte, x, with +## another sequence of bytes presented as an array, a, +## of byte-valued integers: + +reduce .[] as $byte ([]; + if $byte == x then . + a else . + [$byte] end) diff --git a/Task/Bitmap-B-zier-curves-Cubic/FreeBASIC/bitmap-b-zier-curves-cubic.freebasic b/Task/Bitmap-B-zier-curves-Cubic/FreeBASIC/bitmap-b-zier-curves-cubic.freebasic new file mode 100644 index 0000000000..fd1123319f --- /dev/null +++ b/Task/Bitmap-B-zier-curves-Cubic/FreeBASIC/bitmap-b-zier-curves-cubic.freebasic @@ -0,0 +1,65 @@ +' version 01-11-2016 +' compile with: fbc -s console + +' translation from Bitmap/Bresenham's line algorithm C entry +Sub Br_line(x0 As Integer, y0 As Integer, x1 As Integer, y1 As Integer, _ + Col As UInteger = &HFFFFFF) + + Dim As Integer dx = Abs(x1 - x0), dy = Abs(y1 - y0) + Dim As Integer sx = IIf(x0 < x1, 1, -1) + Dim As Integer sy = IIf(y0 < y1, 1, -1) + Dim As Integer er = IIf(dx > dy, dx, -dy) \ 2, e2 + + Do + PSet(x0, y0), col + If (x0 = x1) And (y0 = y1) Then Exit Do + e2 = er + If e2 > -dx Then Er -= dy : x0 += sx + If e2 < dy Then Er += dx : y0 += sy + Loop + +End Sub + +' Bitmap/Bézier curves/Cubic BBC BASIC entry +Sub beziercubic(x1 As Double, y1 As Double, x2 As Double, y2 As Double, _ + x3 As Double, y3 As Double, x4 As Double, y4 As Double, _ + n As ULong, col As UInteger = &HFFFFFF) + + Type point_ + x As Integer + y As Integer + End Type + + Dim As ULong i + Dim As Double t, t1, a, b, c, d + Dim As point_ p(n) + + For i = 0 To n + t = i / n + t1 = 1 - t + a = t1 ^ 3 + b = t * t1 * t1 * 3 + c = t * t * t1 * 3 + d = t ^ 3 + p(i).x = Int(a * x1 + b * x2 + c * x3 + d * x4 + .5) + p(i).y = Int(a * y1 + b * y2 + c * y3 + d * y4 + .5) + Next + + For i = 0 To n -1 + Br_line(p(i).x, p(i).y, p(i +1).x, p(i +1).y, col) + Next + +End Sub + +' ------=< MAIN >=------ + +ScreenRes 250,250,32 ' 0,0 in top left corner + +beziercubic(160, 150, 10, 120, 30, 0, 150, 50, 20) + + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Bitmap-B-zier-curves-Cubic/Phix/bitmap-b-zier-curves-cubic.phix b/Task/Bitmap-B-zier-curves-Cubic/Phix/bitmap-b-zier-curves-cubic.phix new file mode 100644 index 0000000000..4abd1a98e4 --- /dev/null +++ b/Task/Bitmap-B-zier-curves-Cubic/Phix/bitmap-b-zier-curves-cubic.phix @@ -0,0 +1,30 @@ +function cubic_bezier(sequence img, atom x1, atom y1, atom x2, atom y2, atom x3, atom y3, atom x4, atom y4, integer colour, integer segments) +atom t, t1, a, b, c, d +sequence pts = repeat(0,segments*2) + + for i=0 to segments*2-1 by 2 do + t = i/segments + t1 = 1-t + a = power(t1,3) + b = 3*t*power(t1,2) + c = 3*power(t,2)*t1 + d = power(t,3) + pts[i+1] = floor(a*x1+b*x2+c*x3+d*x4) + pts[i+2] = floor(a*y1+b*y2+c*y3+d*y4) + end for + for i=1 to segments*2-2 by 2 do + img = bresLine(img, pts[i], pts[i+1], pts[i+2], pts[i+3], colour) + end for + return img +end function + +sequence img = new_image(300,200,black) + img = cubic_bezier(img, 0,100, 100,0, 200,200, 300,100, white, 40) + img = bresLine(img,0,100,100,0,green) + img = bresLine(img,100,0,200,200,green) + img = bresLine(img,200,200,300,100,green) + img[1][100] = red + img[100][1] = red + img[200][200] = red + img[300][100] = red + write_ppm("Bézier.ppm",img) diff --git a/Task/Bitmap-B-zier-curves-Quadratic/FreeBASIC/bitmap-b-zier-curves-quadratic.freebasic b/Task/Bitmap-B-zier-curves-Quadratic/FreeBASIC/bitmap-b-zier-curves-quadratic.freebasic new file mode 100644 index 0000000000..bea5511ac1 --- /dev/null +++ b/Task/Bitmap-B-zier-curves-Quadratic/FreeBASIC/bitmap-b-zier-curves-quadratic.freebasic @@ -0,0 +1,63 @@ +' version 01-11-2016 +' compile with: fbc -s console + +' translation from Bitmap/Bresenham's line algorithm C entry +Sub Br_line(x0 As Integer, y0 As Integer, x1 As Integer, y1 As Integer, _ + Col As UInteger = &HFFFFFF) + + Dim As Integer dx = Abs(x1 - x0), dy = Abs(y1 - y0) + Dim As Integer sx = IIf(x0 < x1, 1, -1) + Dim As Integer sy = IIf(y0 < y1, 1, -1) + Dim As Integer er = IIf(dx > dy, dx, -dy) \ 2, e2 + + Do + PSet(x0, y0), col + If (x0 = x1) And (y0 = y1) Then Exit Do + e2 = er + If e2 > -dx Then Er -= dy : x0 += sx + If e2 < dy Then Er += dx : y0 += sy + Loop + +End Sub + +' Bitmap/Bézier curves/Quadratic BBC BASIC entry +Sub bezierquad(x1 As Double, y1 As Double, x2 As Double, y2 As Double, _ + x3 As Double, y3 As Double, n As ULong, col As UInteger = &HFFFFFF) + + Type point_ + x As Integer + y As Integer + End Type + + Dim As ULong i + Dim As Double t, t1, a, b, c, d + Dim As point_ p(n) + + For i = 0 To n + t = i / n + t1 = 1 - t + a = t1 ^ 2 + b = t * t1 * 2 + c = t ^ 2 + p(i).x = Int(a * x1 + b * x2 + c * x3 + .5) + p(i).y = Int(a * y1 + b * y2 + c * y3 + .5) + Next + + For i = 0 To n -1 + Br_line(p(i).x, p(i).y, p(i +1).x, p(i +1).y, col) + Next + +End Sub + +' ------=< MAIN >=------ + +ScreenRes 250, 250, 32 ' 0,0 in top left corner + +bezierquad(10, 100, 250, 270, 150, 20, 20) + + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Bitmap-B-zier-curves-Quadratic/Phix/bitmap-b-zier-curves-quadratic.phix b/Task/Bitmap-B-zier-curves-Quadratic/Phix/bitmap-b-zier-curves-quadratic.phix new file mode 100644 index 0000000000..77fd2f04c9 --- /dev/null +++ b/Task/Bitmap-B-zier-curves-Quadratic/Phix/bitmap-b-zier-curves-quadratic.phix @@ -0,0 +1,27 @@ +function quadratic_bezier(sequence img, atom x1, atom y1, atom x2, atom y2, atom x3, atom y3, integer colour, integer segments) +atom t, t1, a, b, c +sequence pts = repeat(0,segments*2) + + for i=0 to segments*2-1 by 2 do + t = i/segments + t1 = 1-t + a = power(t1,2) + b = 2*t*t1 + c = power(t,2) + pts[i+1] = floor(a*x1+b*x2+c*x3) + pts[i+2] = floor(a*y1+b*y2+c*y3) + end for + for i=1 to segments*2-2 by 2 do + img = bresLine(img, pts[i], pts[i+1], pts[i+2], pts[i+3], colour) + end for + return img +end function + +sequence img = new_image(200,200,black) + img = quadratic_bezier(img, 0,100, 100,200, 200,0, white, 40) + img = bresLine(img,0,100,100,200,green) + img = bresLine(img,100,200,200,0,green) + img[1][100] = red + img[100][200] = red + img[200][1] = red + write_ppm("BézierQ.ppm",img) diff --git a/Task/Bitmap-Bresenhams-line-algorithm/ERRE/bitmap-bresenhams-line-algorithm.erre b/Task/Bitmap-Bresenhams-line-algorithm/ERRE/bitmap-bresenhams-line-algorithm.erre new file mode 100644 index 0000000000..032fd979f3 --- /dev/null +++ b/Task/Bitmap-Bresenhams-line-algorithm/ERRE/bitmap-bresenhams-line-algorithm.erre @@ -0,0 +1,30 @@ +PROGRAM BRESENHAM + +!$INCLUDE="PC.LIB" + +PROCEDURE BRESENHAM +! === Draw a line using graphic coordinates +! Inputs are X1, Y1, X2, Y2: Destroys value of X1, Y1 +dx=ABS(x2-x1) sx=-1 +IF x1dy THEN er=dx +er=INT(er/2) +LOOP + PSET(x1,y1,1) + EXIT IF x1=x2 AND y1=y2 + e2=er + IF e2>-dx THEN er=er-dy x1=x1+sx + IF e2 dy, dx, -dy) \ 2, e2 + + Do + PSet(x0, y0), col + If (x0 = x1) And (y0 = y1) Then Exit Do + e2 = er + If e2 > -dx Then Er -= dy : x0 += sx + If e2 < dy Then Er += dx : y0 += sy + Loop + +End Sub + +' ------=< MAIN >=------ + +Dim As Double x0, y0, x1, y1 + +ScreenRes 400, 400, 32 +WindowTitle" Press key to end demo" +Randomize Timer + +Do + Cls + For a As Integer = 1 To 20 + Br_line(Rnd*380+10, Rnd*380+10, Rnd*380+10, Rnd*380+10, Rnd*&hFFFFFF) + Next + Sleep 2000 +Loop Until InKey <> "" ' loop until a key is pressed + +End diff --git a/Task/Bitmap-Bresenhams-line-algorithm/Nim/bitmap-bresenhams-line-algorithm.nim b/Task/Bitmap-Bresenhams-line-algorithm/Nim/bitmap-bresenhams-line-algorithm.nim new file mode 100644 index 0000000000..22e54b0dc0 --- /dev/null +++ b/Task/Bitmap-Bresenhams-line-algorithm/Nim/bitmap-bresenhams-line-algorithm.nim @@ -0,0 +1,26 @@ +import math + +proc line(img: var Image, p, q: Point) = + let + dx = abs(q.x - p.x) + sx = if p.x < q.x: 1 else: -1 + dy = abs(q.y - p.y) + sy = if p.y < q.y: 1 else: -1 + + var + p = p + q = q + err = (if dx > dy: dx else: -dy) div 2 + e2 = 0 + + while true: + img[p] = Black + if p == q: + break + e2 = err + if e2 > -dx: + err -= dy + p.x += sx + if e2 < dy: + err += dx + p.y += sy diff --git a/Task/Bitmap-Bresenhams-line-algorithm/Phix/bitmap-bresenhams-line-algorithm.phix b/Task/Bitmap-Bresenhams-line-algorithm/Phix/bitmap-bresenhams-line-algorithm.phix new file mode 100644 index 0000000000..0c65ae346e --- /dev/null +++ b/Task/Bitmap-Bresenhams-line-algorithm/Phix/bitmap-bresenhams-line-algorithm.phix @@ -0,0 +1,35 @@ +function bresLine(sequence screenData, integer x0, integer y0, integer x1, integer y1, integer colour) +-- The line algorithm +integer deltaX = abs(x1-x0), + deltaY = abs(y1-y0), + stepX = iff(x0deltaY,deltaX,-deltaY), + prevle + + lineError = round(lineError/2,1) + while 1 do + if x0>=1 and x0<=length(screenData) + and y0>=1 and y0<=length(screenData[x0]) then + screenData[x0][y0] = colour + end if + if x0=x1 and y0=y1 then exit end if + prevle = lineError + if prevle>-deltaX then + lineError -= deltaY + x0 += stepX + end if + if prevle dy + x1 += sx e -= dy if e < 0 e += dx y1 += sy ok + else + y1 += sy e -= dx if e < 0 e += dy x1 += sx ok ok + end + next + + endpaint() + } + label1 { setpicture(p1) show() } diff --git a/Task/Bitmap-Bresenhams-line-algorithm/Sidef/bitmap-bresenhams-line-algorithm.sidef b/Task/Bitmap-Bresenhams-line-algorithm/Sidef/bitmap-bresenhams-line-algorithm.sidef new file mode 100644 index 0000000000..84a2bac4e2 --- /dev/null +++ b/Task/Bitmap-Bresenhams-line-algorithm/Sidef/bitmap-bresenhams-line-algorithm.sidef @@ -0,0 +1,53 @@ +func my_draw_line(img, x0, y0, x1, y1) { + + var steep = (abs(y1 - y0) > abs(x1 - x0)) + + if (steep) { + (y0, x0) = (x0, y0) + (y1, x1) = (x1, y1) + } + if (x0 > x1) { + (x1, x0) = (x0, x1) + (y1, y0) = (y0, y1) + } + + var deltax = (x1 - x0) + var deltay = abs(y1 - y0) + var error = (deltax / 2) + var y = y0 + var ystep = (y0 < y1 ? 1 : -1) + + x0.to(x1).each { |x| + img.draw_point(steep ? ((y, x)) : ((x, y))) + error -= deltay + if (error < 0) { + y += ystep + error += deltax + } + } +} + +require('Image::Imlib2') + +var img = %s'Image::Imlib2'.new(160, 160) +img.set_color(255, 255, 255, 255) # white +img.fill_rectangle(0,0,160,160) + +img.set_color(0,0,0,255) # black +my_draw_line(img, 10, 80, 80, 160) +my_draw_line(img, 80, 160, 160, 80) +my_draw_line(img, 160, 80, 80, 10) +my_draw_line(img, 80, 10, 10, 80) + +img.save("test0.png"); + +# let's try the same using its internal algo +img.set_color(255, 255, 255, 255) # white +img.fill_rectangle(0,0,160,160) +img.set_color(0,0,0,255) # black +img.draw_line(10, 80, 80, 160) +img.draw_line(80, 160, 160, 80) +img.draw_line(160, 80, 80, 10) +img.draw_line(80, 10, 10, 80) + +img.save("test1.png") diff --git a/Task/Bitmap-Bresenhams-line-algorithm/Wart/bitmap-bresenhams-line-algorithm.wart b/Task/Bitmap-Bresenhams-line-algorithm/Wart/bitmap-bresenhams-line-algorithm.wart new file mode 100644 index 0000000000..8f035dc98c --- /dev/null +++ b/Task/Bitmap-Bresenhams-line-algorithm/Wart/bitmap-bresenhams-line-algorithm.wart @@ -0,0 +1,22 @@ +# doesn't handle vertical lines +def (line x0 y0 x1 y1) + let steep ((> abs) y1-y0 x1-x0) + when steep + swap! x0 y0 + swap! x1 y1 + when (x0 > x1) + swap! x0 x1 + swap! y0 y1 + withs (deltax x1-x0 + deltay (abs y1-y0) + error deltax/2 + ystep (if (y0 < y1) 1 -1) + y y0) + for x x0 (x <= x1) ++x + if steep + plot y x + plot x y + error -= deltay + when (error < 0) + y += ystep + error += deltax diff --git a/Task/Bitmap-Flood-fill/ERRE/bitmap-flood-fill.erre b/Task/Bitmap-Flood-fill/ERRE/bitmap-flood-fill.erre new file mode 100644 index 0000000000..f893d7b9c6 --- /dev/null +++ b/Task/Bitmap-Flood-fill/ERRE/bitmap-flood-fill.erre @@ -0,0 +1,87 @@ +PROGRAM MYFILL_DEMO + +!VAR SP% + +!$INTEGER + +CONST IMAGE_WIDTH=320,IMAGE_HEIGHT=200 + +DIM STACK[6000,1] + +FUNCTION QUEUE_COUNT(X) + QUEUE_COUNT=SP +END FUNCTION + +!$INCLUDE="PC.LIB" + +PROCEDURE QUEUE_INIT + SP=0 +END PROCEDURE + +PROCEDURE QUEUE_POP(->XX,YY) + XX=STACK[SP,0] + YY=STACK[SP,1] + SP=SP-1 +END PROCEDURE + +PROCEDURE QUEUE_PUSH(XX,YY) + SP=SP+1 + STACK[SP,0]=XX + STACK[SP,1]=YY +END PROCEDURE + +PROCEDURE FLOOD_FILL(XSTART,YSTART,COLORE_PRIMA,COLORE_RIEMP) + LOCAL XEST,XWEST,YNORD,YSUD,X,Y + QUEUE_INIT + QUEUE_PUSH(XSTART,YSTART) + WHILE (QUEUE_COUNT(0)>0) DO + QUEUE_POP(->X,Y) + XWEST=X + XEST=X + + IF Y>0 THEN + YNORD=Y-1 + ELSE + YNORD=-1 + END IF + + IF YZC%) + EXIT IF NOT((XESTZC%) + EXIT IF NOT((XWEST>0) AND (ZC%=COLORE_PRIMA)) + XWEST=XWEST-1 + END LOOP + + FOR X=XWEST TO XEST DO + PSET(X,Y,COLORE_RIEMP) + POINT(X,YNORD->ZC%) + IF YNORD>=0 AND ZC%=COLORE_PRIMA THEN + QUEUE_PUSH(X,YNORD) + END IF + POINT(X,YSUD->ZC%) + IF YSUD>=0 AND ZC%=COLORE_PRIMA THEN + QUEUE_PUSH(X,YSUD) + END IF + END FOR + END WHILE +END PROCEDURE ! Flood_Fill + +BEGIN + SCREEN(1) + CIRCLE(100,100,75,2) + CIRCLE(120,120,20,2) + CIRCLE(80,80,15,2) + CIRCLE(120,80,10,2) + FLOOD_FILL(100,100,0,1) +END PROGRAM diff --git a/Task/Bitmap-Flood-fill/FreeBASIC/bitmap-flood-fill.freebasic b/Task/Bitmap-Flood-fill/FreeBASIC/bitmap-flood-fill.freebasic new file mode 100644 index 0000000000..c918a66917 --- /dev/null +++ b/Task/Bitmap-Flood-fill/FreeBASIC/bitmap-flood-fill.freebasic @@ -0,0 +1,55 @@ +' version 04-11-2016 +' compile with: fbc -s console + +' the flood_fill needs to know the boundries of the window/screen +' without them the routine start to check outside the window +' this leads to crashes (out of stack) +' the Line routine has clipping it will not draw outside the window + +Sub flood_fill(x As Integer, y As Integer, target As UInteger, fill_color As UInteger) + + Dim As Long x_max, y_max + ScreenInfo x_max, y_max + + ' 0, 0 is top left corner + If Point(x,y) <> target Then Exit Sub + + Dim As Long l = x, r = x + + While Point(l -1, y) = target AndAlso l -1 > -1 + l = l -1 + Wend + + While Point(r +1, y) = target AndAlso r +1 < x_max + r = r +1 + Wend + + Line (l,y) - (r,y), fill_color + + For x = l To r + If y +1 < y_max Then flood_fill(x, y +1, target, fill_color) + If y -1 > -1 Then flood_fill(x, y -1, target, fill_color) + Next + +End Sub + +' ------=< MAIN >=------ + +Dim As ULong i, col, x, y + +ScreenRes 400, 400, 32 +Randomize Timer + +For i As ULong = 1 To 5 + Circle(Rnd * 400 ,Rnd * 400), i * 40, Rnd * &hFFFFFF +Next + +' hit a key to end or close window +Do + x = Rnd * 400 + y = Rnd * 400 + col = Point(x, y) + flood_fill(x, y, col, Rnd * &hFFFFFF ) + Sleep 2000 + If InKey <> "" OrElse InKey = Chr(255) + "k" Then End +Loop diff --git a/Task/Bitmap-Flood-fill/Lingo/bitmap-flood-fill.lingo b/Task/Bitmap-Flood-fill/Lingo/bitmap-flood-fill.lingo new file mode 100644 index 0000000000..9c2b73f3db --- /dev/null +++ b/Task/Bitmap-Flood-fill/Lingo/bitmap-flood-fill.lingo @@ -0,0 +1 @@ +img.floodFill(x, y, rgb(r,g,b)) diff --git a/Task/Bitmap-Flood-fill/Phix/bitmap-flood-fill.phix b/Task/Bitmap-Flood-fill/Phix/bitmap-flood-fill.phix new file mode 100644 index 0000000000..4e5e02200f --- /dev/null +++ b/Task/Bitmap-Flood-fill/Phix/bitmap-flood-fill.phix @@ -0,0 +1,23 @@ +function ff(sequence img, integer x, integer y, integer colour, integer target) + if x>=1 and x<=length(img) + and y>=1 and y<=length(img[x]) + and img[x][y]=target then + img[x][y] = colour + img = ff(img,x-1,y,colour,target) + img = ff(img,x+1,y,colour,target) + img = ff(img,x,y-1,colour,target) + img = ff(img,x,y+1,colour,target) + end if + return img +end function + +function FloodFill(sequence img, integer x, integer y, integer colour) +integer target = img[x][y] + return ff(img,x,y,colour,target) +end function + +sequence img = read_ppm("Circle.ppm") + img = FloodFill(img, 200, 100, blue) + write_ppm("FloodIn.ppm",img) + img = FloodFill(img, 10, 10, green) + write_ppm("FloodOut.ppm",img) diff --git a/Task/Bitmap-Histogram/Phix/bitmap-histogram.phix b/Task/Bitmap-Histogram/Phix/bitmap-histogram.phix new file mode 100644 index 0000000000..4ff911b30a --- /dev/null +++ b/Task/Bitmap-Histogram/Phix/bitmap-histogram.phix @@ -0,0 +1,38 @@ +function to_bw(sequence image) +sequence color +integer lum +sequence hist = repeat(0,256) +integer l = 1, r = 256 +integer ltot, rtot + for i=1 to length(image) do + for j=1 to length(image[i]) do + color = sq_div(sq_and_bits(image[i][j], {#FF0000,#FF00,#FF}), + {#010000,#0100,#01}) + lum = floor(0.2126*color[1] + 0.7152*color[2] + 0.0722*color[3]) + image[i][j] = lum + hist[lum+1] += 1 + end for + end for + ltot = hist[l] + rtot = hist[r] + while l!=r do + if ltot=0 THEN + y%=y%-1 + ddy%=ddy%+2 + f%=f%+ddy% + END IF + x%=x%+1 + ddx%=ddx%+2 + f%=f%+ddx%+1 + PSET(cx%+x%,cy%+y%,1) + PSET(cx%-x%,cy%+y%,1) + PSET(cx%+x%,cy%-y%,1) + PSET(cx%-x%,cy%-y%,1) + PSET(cx%+y%,cy%+x%,1) + PSET(cx%-y%,cy%+x%,1) + PSET(cx%+y%,cy%-x%,1) + PSET(cx%-y%,cy%-x%,1) + END WHILE +END PROCEDURE + +BEGIN + SCREEN(1) + ! Draw circles + BCircle(100,100,40) + BCircle(100,100,80) +END PROGRAM diff --git a/Task/Bitmap-Midpoint-circle-algorithm/FreeBASIC/bitmap-midpoint-circle-algorithm.freebasic b/Task/Bitmap-Midpoint-circle-algorithm/FreeBASIC/bitmap-midpoint-circle-algorithm.freebasic new file mode 100644 index 0000000000..62044d4fa4 --- /dev/null +++ b/Task/Bitmap-Midpoint-circle-algorithm/FreeBASIC/bitmap-midpoint-circle-algorithm.freebasic @@ -0,0 +1,54 @@ +' version 15-10-2016 +' compile with: fbc -s gui + +' Variant with Integer-Based Arithmetic from Wikipedia page: +' Midpoint circle algorithm +Sub circle_(x0 As Integer, y0 As Integer , radius As Integer, Col As Integer) + + Dim As Integer x = radius + Dim As Integer y + ' Decision criterion divided by 2 evaluated at x=r, y=0 + Dim As Integer decisionOver2 = 1 - x + + While(x >= y) + PSet(x0 + x, y0 + y), col + PSet(x0 - x, y0 + y), col + PSet(x0 + x, y0 - y), col + PSet(x0 - x, y0 - y), col + PSet(x0 + y, y0 + x), col + PSet(x0 - y, y0 + x), col + PSet(x0 + y, y0 - x), col + PSet(x0 - y, y0 - x), col + y = y +1 + If decisionOver2 <= 0 Then + decisionOver2 += y * 2 +1 ' Change in decision criterion for y -> y +1 + Else + x = x -1 + decisionOver2 += (y - x) * 2 +1 ' Change for y -> y +1, x -> x -1 + End If + Wend + +End Sub + +' ------=< MAIN >=------ + +ScreenRes 600, 600, 32 +Dim As Integer w, h, depth +Randomize Timer + +ScreenInfo w, h + +For i As Integer = 1 To 10 + circle_(Rnd * w, Rnd * h , Rnd * 200 , Int(Rnd *&hFFFFFF)) +Next + + +'save screen to BMP file +BSave "Name.BMP", 0 + + +' empty keyboard buffer +While Inkey <> "" : Wend +WindowTitle "hit any key to end program" +Sleep +End diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Phix/bitmap-midpoint-circle-algorithm.phix b/Task/Bitmap-Midpoint-circle-algorithm/Phix/bitmap-midpoint-circle-algorithm.phix new file mode 100644 index 0000000000..cdd23de844 --- /dev/null +++ b/Task/Bitmap-Midpoint-circle-algorithm/Phix/bitmap-midpoint-circle-algorithm.phix @@ -0,0 +1,40 @@ +constant red = 0xff2020, + yellow = 0xffdf20 + +function SetPx(sequence img, atom x, atom y, integer colour) + if x>=1 and x<=length(img) + and y>=1 and y<=length(img[x]) then + img[x][y] = colour + end if + return img +end function + +function Circle(sequence img, atom x, atom y, atom r, integer colour) +atom x1 = -r, + y1 = 0, + err = 2-2*r + if r>=0 then + -- Bresenham algorithm + while 1 do + img = SetPx(img, x-x1, y+y1, colour) + img = SetPx(img, x-y1, y-x1, colour) + img = SetPx(img, x+x1, y-y1, colour) + img = SetPx(img, x+y1, y+x1, colour) + r = err + if r>x1 then + x1 += 1 + err += x1*2 + 1 + end if + if r<=y1 then + y1 += 1 + err += y1*2 + 1 + end if + if x1>=0 then exit end if + end while + end if + return img +end function + +sequence img = new_image(400,300,yellow) + img = Circle(img, 200, 150, 100, red) + write_ppm("Circle.ppm",img) diff --git a/Task/Bitmap-Read-a-PPM-file/Nim/bitmap-read-a-ppm-file.nim b/Task/Bitmap-Read-a-PPM-file/Nim/bitmap-read-a-ppm-file.nim new file mode 100644 index 0000000000..09dc4b0e50 --- /dev/null +++ b/Task/Bitmap-Read-a-PPM-file/Nim/bitmap-read-a-ppm-file.nim @@ -0,0 +1,33 @@ +import strutils + +proc readPPM(f: TFile): Image = + if f.readLine != "P6": + raise newException(E_base, "Invalid file format") + + var line = "" + while f.readLine(line): + if line[0] != '#': + break + + var parts = line.split(" ") + result = img(parseInt parts[0], parseInt parts[1]) + + if f.readLine != "255": + raise newException(E_base, "Invalid file format") + + var + arr: array[256, int8] + read = f.readBytes(arr, 0, 256) + pos = 0 + + while read != 0: + for i in 0 .. < read: + case pos mod 3 + of 0: result.pixels[pos div 3].r = arr[i].uint8 + of 1: result.pixels[pos div 3].g = arr[i].uint8 + of 2: result.pixels[pos div 3].b = arr[i].uint8 + else: discard + + inc pos + + read = f.readBytes(arr, 0, 256) diff --git a/Task/Bitmap-Read-a-PPM-file/Phix/bitmap-read-a-ppm-file.phix b/Task/Bitmap-Read-a-PPM-file/Phix/bitmap-read-a-ppm-file.phix new file mode 100644 index 0000000000..138e9e83f9 --- /dev/null +++ b/Task/Bitmap-Read-a-PPM-file/Phix/bitmap-read-a-ppm-file.phix @@ -0,0 +1,28 @@ +function read_ppm(sequence filename) +sequence image, line +integer dimx, dimy, maxcolor +atom fn = open(filename, "rb") + if fn<0 then + return -1 -- unable to open + end if + line = gets(fn) + if line!="P6\n" then + return -1 -- only ppm6 files are supported + end if + line = gets(fn) + {{dimx,dimy}} = scanf(line,"%d %d%s") + line = gets(fn) + {{maxcolor}} = scanf(line,"%d%s") + image = repeat(repeat(0,dimy),dimx) + for y=1 to dimy do + for x=1 to dimx do + image[x][y] = getc(fn)*#10000 + getc(fn)*#100 + getc(fn) + end for + end for + close(fn) + return image +end function + +sequence img = read_ppm("Lena.ppm") + img = to_gray(img) + write_ppm("LenaGray.ppm",img) diff --git a/Task/Bitmap-Write-a-PPM-file/Phix/bitmap-write-a-ppm-file-1.phix b/Task/Bitmap-Write-a-PPM-file/Phix/bitmap-write-a-ppm-file-1.phix new file mode 100644 index 0000000000..937d6753b7 --- /dev/null +++ b/Task/Bitmap-Write-a-PPM-file/Phix/bitmap-write-a-ppm-file-1.phix @@ -0,0 +1,13 @@ +constant dimx = 512, dimy = 512 +constant fn = open("first.ppm","wb") -- b - binary mode +sequence color +printf(fn, "P6\n%d %d\n255\n", {dimx,dimy}) +for y=0 to dimy-1 do + for x=0 to dimx-1 do + color = {remainder(x,256), -- red + remainder(y,256), -- green + remainder(x*y,256)} -- blue + puts(fn,color) + end for +end for +close(fn) diff --git a/Task/Bitmap-Write-a-PPM-file/Phix/bitmap-write-a-ppm-file-2.phix b/Task/Bitmap-Write-a-PPM-file/Phix/bitmap-write-a-ppm-file-2.phix new file mode 100644 index 0000000000..662c16d26b --- /dev/null +++ b/Task/Bitmap-Write-a-PPM-file/Phix/bitmap-write-a-ppm-file-2.phix @@ -0,0 +1,16 @@ +procedure write_ppm(sequence filename, sequence image) +integer fn,dimx,dimy +sequence colour_triple + fn = open(filename,"wb") + dimx = length(image) + dimy = length(image[1]) + printf(fn, "P6\n%d %d\n255\n", {dimx,dimy}) + for y = 1 to dimy do + for x = 1 to dimx do + colour_triple = sq_div(sq_and_bits(image[x][y], {#FF0000,#FF00,#FF}), + {#010000,#0100,#01}) + puts(fn, colour_triple) + end for + end for + close(fn) +end procedure diff --git a/Task/Bitmap-Write-a-PPM-file/Sidef/bitmap-write-a-ppm-file.sidef b/Task/Bitmap-Write-a-PPM-file/Sidef/bitmap-write-a-ppm-file.sidef new file mode 100644 index 0000000000..57ba20217f --- /dev/null +++ b/Task/Bitmap-Write-a-PPM-file/Sidef/bitmap-write-a-ppm-file.sidef @@ -0,0 +1,43 @@ +subset Int < Number {|n| n.is_int } +subset Uint < Int {|n| n >= 0 } +subset Uint8 < Int {|n| n ~~ ^256 } + +struct Pixel { + R < Uint8, + G < Uint8, + B < Uint8 +} + +class Bitmap(width < Uint, height < Uint) { + has data = [] + + method fill(Pixel p) { + data = (width*height -> of { Pixel(p.R, p.G, p.B) }) + } + + method setpixel(i < Uint, j < Uint, Pixel p) { + + subset WidthLimit < Uint { |n| n ~~ ^width } + subset HeightLimit < Uint { |n| n ~~ ^height } + + func (w < WidthLimit, h < HeightLimit) { + data[w*height + h] = p + }(i, j) + } + + method p6 { + "P6\n#{width} #{height}\n255\n" + + data.map {|p| [p.R, p.G, p.B].pack('C3') }.join + } +} + +var b = Bitmap(width: 125, height: 125) + +for i,j in (^b.height ~X ^b.width) { + b.setpixel(i, j, Pixel(2*i, 2*j, 255 - 2*i)) +} + +var file = File("palette.ppm") +var fh = file.open('>:raw') +fh.print(b.p6) +fh.close diff --git a/Task/Bitmap/Axe/bitmap.axe b/Task/Bitmap/Axe/bitmap.axe new file mode 100644 index 0000000000..a9ef2763b5 --- /dev/null +++ b/Task/Bitmap/Axe/bitmap.axe @@ -0,0 +1,10 @@ +Buff(768)→Pic1 +Fill(Pic1,768,255) +Pxl-Off(45,30,Pic1) + +.Display the bitmap to demonstrate +Copy(Pic1) +DispGraph +Pause 4500 + +Disp pxl-Test(50,50,Pic1)▶Dec,i diff --git a/Task/Bitmap/EchoLisp/bitmap.echolisp b/Task/Bitmap/EchoLisp/bitmap.echolisp new file mode 100644 index 0000000000..a79871517f --- /dev/null +++ b/Task/Bitmap/EchoLisp/bitmap.echolisp @@ -0,0 +1,32 @@ +(lib 'plot) +(define width 600) +(define height 400) + +(plot-size width height) ;; set image size + +(define (blue x y) (rgb 0.0 0.0 1.0)) ;; a constant function +(plot-rgb blue 1 1) ;; blue everywhere + +(lib 'types) ;; uint32 and uint8 vector types + +;; bit-map pixel access +(define bitmap (pixels->uint32-vector)) ;; screen to vector of int32 + → 240000 + +(define (pix-at x y) (vector-ref bitmap (+ x (* y width)))) +(rgb->list (pix-at 100 200)) → (0 0 255 255) ;; rgb blue + +;; writing to bitmap +(define (set-color-xy x y col) (vector-set! bitmap (+ x (* y width)) col)) + +(for* ((x 100)(y 200)) (set-color-xy x y (rgb 1 1 0))) ;; to bitmap +(vector->pixels bitmap) ;; bitmap to screen + + +;; bit-map color components (r g b a) = index (0 1 2 3) access +(define bitmap (pixels->uint8-clamped-vector)) ;; screen to vector of uint8 +(vector-length bitmap) + → 960000 +(define (blue-at-xy x y) (vector-ref bitmap (+ x 3 (* y width)))) ;; 3 = blue component +(blue-at-xy 100 200) + → 255 diff --git a/Task/Bitmap/Lingo/bitmap.lingo b/Task/Bitmap/Lingo/bitmap.lingo new file mode 100644 index 0000000000..ba6356d096 --- /dev/null +++ b/Task/Bitmap/Lingo/bitmap.lingo @@ -0,0 +1,11 @@ +-- Creates a new image object of size 640x480 pixel and 32-bit color depth +img = image(640, 480, 32) + +-- Fills image with plain red +img.fill(img.rect, rgb(255,0,0)) + +-- Gets the color value of the pixel at point (320, 240) +col = img.getPixel(320, 240) + +-- Changes the color of the pixel at point (320, 240) to black +img.setPixel(320, 240, rgb(0,0,0)) diff --git a/Task/Bitmap/Nim/bitmap.nim b/Task/Bitmap/Nim/bitmap.nim new file mode 100644 index 0000000000..c7a0318ac0 --- /dev/null +++ b/Task/Bitmap/Nim/bitmap.nim @@ -0,0 +1,61 @@ +{.experimental.} + +import unsigned + +type + Luminance = uint8 + Index = int + + Pixel = tuple + r, g, b: Luminance + + Image = object + w, h: Index + pixels: seq[Pixel] + + Point = tuple + x, y: Index + +proc px(r, g, b): Pixel = + result.r = r.uint8 + result.g = g.uint8 + result.b = b.uint8 + +proc img(w, h: int): Image = + result.w = w + result.h = h + result.pixels.newSeq(w * h) + +const + Black = px( 0, 0, 0) + White = px(255, 255, 255) + +iterator indices(img: Image): tuple[x, y: int] = + for x in 0 .. < img.w: + for y in 0 .. < img.h: + yield (x,y) + +proc `[]`(img: Image, x, y: int): Pixel = + img.pixels[y * img.w + x] + +proc `[]=`(img: var Image, x, y: int, c: Pixel) = + img.pixels[y * img.w + x] = c + +proc fill(img: var Image, color: Pixel) = + for x,y in img.indices: + img[x,y] = color + +proc print(img: Image) = + using stdout + for x,y in img.indices: + if img[x,y] == White: + write ' ' + else: + write 'H' + write "\n" + +when isMainModule: + var x = img(64, 64) + x.fill px(255,255,255) + x[1,2] = px(255, 0, 0) + x[3,4] = x[1,2] diff --git a/Task/Bitmap/Phix/bitmap.phix b/Task/Bitmap/Phix/bitmap.phix new file mode 100644 index 0000000000..c356e58d4a --- /dev/null +++ b/Task/Bitmap/Phix/bitmap.phix @@ -0,0 +1,20 @@ +-- Some colour constants: +constant black = #000000, +-- blue = #0000FF, +-- green = #00FF00, +-- red = #FF0000, + white = #FFFFFF + +-- Create new image filled with some colour +function new_image(integer width, integer height, integer fill_colour=black) + return repeat(repeat(fill_colour,height),width) +end function + +-- Usage example: +sequence image = new_image(800,600) + +-- Set pixel color: +image[400][300] = white + +-- Get pixel color +integer colour = image[400][300] -- Now colour is #FF0000 diff --git a/Task/Bitmap/SequenceL/bitmap.sequencel b/Task/Bitmap/SequenceL/bitmap.sequencel new file mode 100644 index 0000000000..5facc762fe --- /dev/null +++ b/Task/Bitmap/SequenceL/bitmap.sequencel @@ -0,0 +1,38 @@ +RGB ::= (R: int(0), G: int(0), B: int(0)); + +newBitmap: int * int -> RGB(2); +newBitmap(width, height)[y, x] := + (R: 0, G: 0, B: 0) + foreach y within 1 ... height, + x within 1 ... width; + +fill: RGB(2) * RGB -> RGB(2); +fill(bitmap(2), color)[y, x] := + color + foreach y within 1 ... size(bitmap), + x within 1 ... size(bitmap[y]); + +setColorAt: RGB(2) * int * int * RGB -> RGB(2); +setColorAt(bitmap(2), x, y, color)[Y, X] := + color when Y = y and X = x + else + bitmap[Y, X]; + +getColorAt: RGB(2) * int * int -> RGB; +getColorAt(bitmap(2), x, y) := bitmap[y, x]; + +lightGreen := (R: 51, G: 255, B: 51); +lightRed := (R: 255, G: 51, B: 51); + +main(args(2)) := + let + width := 1920; + height := 1200; + + cleanImage := newBitmap(width, height); + + filledGreen := fill(cleanImage, lightGreen); + + redCenter := setColorAt(filledGreen, width / 2, height / 2, lightRed); + in + getColorAt(redCenter, width / 2, height / 2); diff --git a/Task/Bitwise-IO/Lingo/bitwise-io-1.lingo b/Task/Bitwise-IO/Lingo/bitwise-io-1.lingo new file mode 100644 index 0000000000..c674cf9cde --- /dev/null +++ b/Task/Bitwise-IO/Lingo/bitwise-io-1.lingo @@ -0,0 +1,63 @@ +-- parent script "BitArray" + +property ancestor +property bitSize +property _pow2 + +---------------------------------------- +-- @constructor +-- @param {integer} [bSize=0] +---------------------------------------- +on new (me, bSize) + if voidP(bitSize) then bitSize=0 + me.bitSize = bSize + byteSize = bitSize/8 + (bitSize mod 8>0) + me._pow2 = [128,64,32,16,8,4,2,1] -- pow2 lookup list + me.ancestor = ByteArray(byteSize) + return me +end + +---------------------------------------- +-- Sets bit at position to . +-- @param {integer} bitPos - starts at 1, as ByteArray's native byte access functions +-- @param {boolean} bitValue +---------------------------------------- +on setBit (me, bitPos, bitValue) + bytePos = (bitPos-1)/8 + 1 + bitPos = (bitPos-1) mod 8 + 1 + if bitValue then + me[bytePos] = bitOr(me[bytePos], me._pow2[bitPos]) + else + me[bytePos] = bitAnd(me[bytePos], bitNot(me._pow2[bitPos])) + end if +end + +---------------------------------------- +-- Gets bit value at position . +-- @param {integer} bitPos - starts at 1, as ByteArray's native byte access functions +-- @return {boolean} bitValue +---------------------------------------- +on getBit (me, bitPos) + bytePos = (bitPos-1)/8 + 1 + bitPos = (bitPos-1) mod 8 + 1 + return bitAnd(me[bytePos], me._pow2[bitPos])<>0 +end + +---------------------------------------- +-- Returns all bits as string. To be in accordance with ByteArray's native toHexString(), +-- returned string is separated with SPACE (e.g. "0 1 1 0...") +-- @param {integer} [bitSizeOnly=FALSE] - if TRUE, only bits without byte-padding +-- @return {string} +---------------------------------------- +on toBinString (me, bitSizeOnly) + res = "" + repeat with i = 1 to me.length + byte = me[i] + repeat with j = 1 to 8 + put (bitAnd(byte, me._pow2[j])<>0)&" " after res + if bitSizeOnly and (i-1)*8+j=me.bitSize then exit repeat + end repeat + end repeat + delete the last char of res + return res +end diff --git a/Task/Bitwise-IO/Lingo/bitwise-io-2.lingo b/Task/Bitwise-IO/Lingo/bitwise-io-2.lingo new file mode 100644 index 0000000000..00e9729390 --- /dev/null +++ b/Task/Bitwise-IO/Lingo/bitwise-io-2.lingo @@ -0,0 +1,37 @@ +---------------------------------------- +-- @param {string} str - ASCII string +-- @return {instance} BitArray +---------------------------------------- +on crunchASCII (str) + ba = script("BitArray").new(str.length * 7) + pow2 = [64,32,16,8,4,2,1] + pos = 1 + repeat with i = 1 to str.length + n = chartonum(str.char[i]) + repeat with j = 1 to 7 + ba.setBit(pos, bitAnd(n, pow2[j])<>0) + pos = pos+1 + end repeat + end repeat + return ba +end + +---------------------------------------- +-- @param {instance} bitArray +-- @return {string} ASCII string +---------------------------------------- +on decrunchASCII (bitArray) + str = "" + pow2 = [64,32,16,8,4,2,1] + pos = 1 + cnt = bitArray.bitSize/7 + repeat with i = 1 to cnt + n = 0 + repeat with j = 1 to 7 + n = n + bitArray.getBit(pos)*pow2[j] + pos = pos+1 + end repeat + put numtochar(n) after str + end repeat + return str +end diff --git a/Task/Bitwise-IO/Lingo/bitwise-io-3.lingo b/Task/Bitwise-IO/Lingo/bitwise-io-3.lingo new file mode 100644 index 0000000000..808ec0942e --- /dev/null +++ b/Task/Bitwise-IO/Lingo/bitwise-io-3.lingo @@ -0,0 +1,11 @@ +str = "ABC" +ba = crunchASCII(str) + +put ba.toBinString() +-- "1 0 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0 0 0 1 1 0 0 0" + +put ba.toBinString(TRUE) + -- "1 0 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0 0 0 1 1" + +put decrunchASCII(ba) +-- "ABC" diff --git a/Task/Bitwise-operations/8051-Assembly/bitwise-operations.8051 b/Task/Bitwise-operations/8051-Assembly/bitwise-operations.8051 new file mode 100644 index 0000000000..9e8ca4e757 --- /dev/null +++ b/Task/Bitwise-operations/8051-Assembly/bitwise-operations.8051 @@ -0,0 +1,52 @@ +; bitwise AND +anl a, b + +; bitwise OR +orl a, b + +; bitwise XOR +xrl a, b + +; bitwise NOT +cpl a + +; left shift +inc b +rrc a +loop: +rlc a +clr c +djnz b, loop + +; right shift +inc b +rlc a +loop: +rrc a +clr c +djnz b, loop + +; arithmetic right shift +push 20 +inc b +rlc a +mov 20.0, c +loop: +rrc a +mov c, 20.0 +djnz b, loop +pop 20 + +; left rotate +inc b +rr a +loop: +rl a +djnz b, loop + +; right rotate +inc b +rl a +loop: +rr a +djnz b, loop diff --git a/Task/Bitwise-operations/Axe/bitwise-operations.axe b/Task/Bitwise-operations/Axe/bitwise-operations.axe new file mode 100644 index 0000000000..736dca5909 --- /dev/null +++ b/Task/Bitwise-operations/Axe/bitwise-operations.axe @@ -0,0 +1,9 @@ +Lbl BITS +r₁→A +r₂→B +Disp "AND:",A·B▶Dec,i +Disp "OR:",AᕀB▶Dec,i +Disp "XOR:",A▫B▶Dec,i +Disp "NOT:",not(A)ʳ▶Dec,i +.No language support for shifts or rotations +Return diff --git a/Task/Bitwise-operations/ECL/bitwise-operations.ecl b/Task/Bitwise-operations/ECL/bitwise-operations.ecl new file mode 100644 index 0000000000..bff52b93db --- /dev/null +++ b/Task/Bitwise-operations/ECL/bitwise-operations.ecl @@ -0,0 +1,29 @@ +BitwiseOperations(INTEGER A, INTEGER B) := FUNCTION + BitAND := A & B; + BitOR := A | B; + BitXOR := A ^ B; + BitNOT := BNOT A; + BitSL := A << B; + BitSR := A >> B; + DS := DATASET([{A,B,'Bitwise AND:',BitAND}, + {A,B,'Bitwise OR:',BitOR}, + {A,B,'Bitwise XOR',BitXOR}, + {A,B,'Bitwise NOT A:',BitNOT}, + {A,B,'ShiftLeft A:',BitSL}, + {A,B,'ShiftRight A:',BitSR}], + {INTEGER AVal,INTEGER BVal,STRING15 valuetype,INTEGER val}); + RETURN DS; +END; + +BitwiseOperations(255,5); +//right arithmetic shift, left and right rotate not implemented +/* + OUTPUT: + 255 5 Bitwise AND: 5 + 255 5 Bitwise OR: 255 + 255 5 Bitwise XOR 250 + 255 5 Bitwise NOT A: -256 + 255 5 ShiftLeft A: 8160 + 255 5 ShiftRight A: 7 + +*/ diff --git a/Task/Bitwise-operations/FreeBASIC/bitwise-operations.freebasic b/Task/Bitwise-operations/FreeBASIC/bitwise-operations.freebasic new file mode 100644 index 0000000000..5e1031fa62 --- /dev/null +++ b/Task/Bitwise-operations/FreeBASIC/bitwise-operations.freebasic @@ -0,0 +1,70 @@ +' FB 1.05.0 Win64 (Note the (U)Integer type is 64 bits) + +' FB doesn't have built-in logical shift right or rotation operators +' but, as they're not difficult to implement, I've done so below. + +Function lsr(x As Const Integer, y As Const Integer) As Integer + Dim As UInteger z = x + Return z Shr y +End Function + +Function rol(x As Const Integer, y As Const UInteger) As Integer + Dim z As Integer = x + Dim high As Integer + For i As Integer = 1 To y + high = Bit(z, 63) + For j As Integer = 62 To 0 Step -1 + If Bit(z, j) Then + z = BitSet(z, j + 1) + Else + z = BitReset (z, j + 1) + End If + Next j + If high Then + z = BitSet(z, 0) + Else + z = BitReset(z, 0) + End If + Next i + Return z +End Function + +Function ror(x As Const Integer, y As Const UInteger) As Integer + Dim z As Integer = x + Dim low As Integer + For i As Integer = 1 To y + low = Bit(z, 0) + For j As Integer = 1 To 63 + If Bit(z, j) Then + z = BitSet(z, j - 1) + Else + z = BitReset (z, j - 1) + End If + Next j + If low Then + z = BitSet(z, 63) + Else + z = BitReset(z, 63) + End If + Next i + Return z +End Function + +Sub bitwise(x As Integer, y As Integer) + Print "x = "; x + Print "y = "; y + Print "x AND y = "; x And y + Print "x OR y = "; x Or y + Print "x XOR y = "; x XOr y + Print "NOT x = "; Not x + Print "x SHL y = "; x Shl y + Print "x SHR y = "; x Shr y + Print "x LSR y = "; lsr(x, y) + Print "x ROL y = "; rol(x, y) + Print "x ROR y = "; ror(x, y) +End Sub + +bitwise -15, 3 +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Bitwise-operations/FutureBasic/bitwise-operations.futurebasic b/Task/Bitwise-operations/FutureBasic/bitwise-operations.futurebasic new file mode 100644 index 0000000000..c99ae7cf17 --- /dev/null +++ b/Task/Bitwise-operations/FutureBasic/bitwise-operations.futurebasic @@ -0,0 +1,29 @@ +include "ConsoleWindow" + +// Set tab width for printing +def tab 1 + +local fn rotl( b as long, n as long ) as long +end fn = ( ( 2^n * b) mod 256) or (b > 127) + +local fn rotr( b as long, n as long ) as long +end fn = (b >> n mod 32) or ( b << (32-n) mod 32) + +local fn bitwise( a as long, b as long ) +print "Input: a = "; a; " b = "; b +print +print "AND :", "a && b = ", bin$(a && b), ": "; a && b +print "NAND :", "a ^& b = ", bin$(a ^& b), ": "; a ^& b +print "OR :", "a || b = ", bin$(a || b), ": "; a || b +print "NOR :", "a ^| b = ", bin$(a ^| b), ": "; a ^| b +print "XOR :", "a ^^ b = ", bin$(a ^^ b), ": "; a ^^ b +print "NOT :", " not a = ", bin$( not a), ": "; not a +print +print "Left shift :", "a << b =", bin$(a << b), ": "; a << b +print "Right shift :", "a >> b =", bin$(a >> b), ": "; a >> b +print +print "Rotate left :", "fn rotl( a, b ) = ", bin$(fn rotl( a, b)), ": "; fn rotl( a, b ) +print "Rotate right :", "fn rotr( a, b ) = ", bin$(fn rotr( a, b )),": "; fn rotr( a, b ) +end fn + +fn bitwise( 255, 2 ) diff --git a/Task/Bitwise-operations/HPPPL/bitwise-operations.hpppl b/Task/Bitwise-operations/HPPPL/bitwise-operations.hpppl new file mode 100644 index 0000000000..e27aa5cbf8 --- /dev/null +++ b/Task/Bitwise-operations/HPPPL/bitwise-operations.hpppl @@ -0,0 +1,10 @@ +EXPORT BITOPS(a, b) +BEGIN + PRINT(BITAND(a, b)); + PRINT(BITOR(a, b)); + PRINT(BITXOR(a, b)); + PRINT(BITNOT(a)); + PRINT(BITSL(a, b)); + PRINT(BITSR(a, b)); + // HPPPL has no builtin rotates or arithmetic right shift. +END; diff --git a/Task/Bitwise-operations/LFE/bitwise-operations-1.lfe b/Task/Bitwise-operations/LFE/bitwise-operations-1.lfe new file mode 100644 index 0000000000..6fc988ceb0 --- /dev/null +++ b/Task/Bitwise-operations/LFE/bitwise-operations-1.lfe @@ -0,0 +1,25 @@ +(defun bitwise (a b) + (io:format '"~p~n" (list (band a b))) + (io:format '"~p~n" (list (bor a b))) + (io:format '"~p~n" (list (bxor a b))) + (io:format '"~p~n" (list (bnot a))) + (io:format '"~p~n" (list (bsl a b))) + (io:format '"~p~n" (list (bsr a b)))) + +(defun d2b + (x) (integer_to_list x 2)) + +(defun bitwise + ((a b 'binary) + (io:format '"(~s ~s ~s): ~s~n" + (list "band" (d2b a) (d2b b) (d2b (band a b)))) + (io:format '"(~s ~s ~s): ~s~n" + (list "bor" (d2b a) (d2b b) (d2b (bor a b)))) + (io:format '"(~s ~s ~s): ~s~n" + (list "bxor" (d2b a) (d2b b) (d2b (bxor a b)))) + (io:format '"(~s ~s): ~s~n" + (list "bnot" (d2b a) (d2b (bnot a)))) + (io:format '"(~s ~s ~s): ~s~n" + (list "bsl" (d2b a) (d2b b) (d2b (bsl a b)))) + (io:format '"(~s ~s ~s): ~s~n" + (list "bsr" (d2b a) (d2b b) (d2b (bsr a b)))))) diff --git a/Task/Bitwise-operations/LFE/bitwise-operations-2.lfe b/Task/Bitwise-operations/LFE/bitwise-operations-2.lfe new file mode 100644 index 0000000000..8d0832cc7b --- /dev/null +++ b/Task/Bitwise-operations/LFE/bitwise-operations-2.lfe @@ -0,0 +1,17 @@ +> (bitwise 255 170) +170 +255 +85 +-256 +381627307539845370001346183518875822092557105621893120 +0 +ok +> (bitwise 255 170 'binary) +(band 11111111 10101010): 10101010 +(bor 11111111 10101010): 11111111 +(bxor 11111111 10101010): 1010101 +(bnot 11111111): -100000000 +(bsl 11111111 10101010): 1111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +(bsr 11111111 10101010): 0 +ok +> diff --git a/Task/Bitwise-operations/Lingo/bitwise-operations.lingo b/Task/Bitwise-operations/Lingo/bitwise-operations.lingo new file mode 100644 index 0000000000..b11dc9d054 --- /dev/null +++ b/Task/Bitwise-operations/Lingo/bitwise-operations.lingo @@ -0,0 +1,4 @@ +put bitAND(2,7) +put bitOR(2,7) +put bitXOR(2,7) +put bitNOT(7) diff --git a/Task/Bitwise-operations/LiveCode/bitwise-operations.livecode b/Task/Bitwise-operations/LiveCode/bitwise-operations.livecode new file mode 100644 index 0000000000..65b2b8ec01 --- /dev/null +++ b/Task/Bitwise-operations/LiveCode/bitwise-operations.livecode @@ -0,0 +1,8 @@ +put "and:" && (255 bitand 2) & comma into bitops +put " or:" && (255 bitor 2) & comma after bitops +put " xor:" && (255 bitxor 2) & comma after bitops +put " not:" && (bitnot 255) after bitops +put bitops + +-- Ouput +and: 2, or: 255, xor: 253, not: 4294967040 diff --git a/Task/Bitwise-operations/Nim/bitwise-operations.nim b/Task/Bitwise-operations/Nim/bitwise-operations.nim new file mode 100644 index 0000000000..6932b12574 --- /dev/null +++ b/Task/Bitwise-operations/Nim/bitwise-operations.nim @@ -0,0 +1,7 @@ +proc bitwise(a, b) = + echo "a and b: " , a and b + echo "a or b: ", a or b + echo "a xor b: ", a xor b + echo "not a: ", not a + echo "a << b: ", a shl b + echo "a >> b: ", a shr b diff --git a/Task/Bitwise-operations/Oforth/bitwise-operations.oforth b/Task/Bitwise-operations/Oforth/bitwise-operations.oforth new file mode 100644 index 0000000000..1b75a9450c --- /dev/null +++ b/Task/Bitwise-operations/Oforth/bitwise-operations.oforth @@ -0,0 +1,6 @@ +: bitwise(a, b) + a b bitAnd println + a b bitOr println + a b bitXor println + a bitLeft(b) println + a bitRight(b) println ; diff --git a/Task/Bitwise-operations/Phix/bitwise-operations.phix b/Task/Bitwise-operations/Phix/bitwise-operations.phix new file mode 100644 index 0000000000..b4f7eef951 --- /dev/null +++ b/Task/Bitwise-operations/Phix/bitwise-operations.phix @@ -0,0 +1,88 @@ +enum SHL, SAR, SHR, ROL, ROR +function bitop(atom a, integer b, integer op) +atom res + #ilASM{ + [32] + mov eax,[a] + call :%pLoadMint + mov ecx,[b] + mov edx,[op] + cmp dl,SHL + jne @f + shl eax,cl + jmp :storeres + @@: + cmp dl,SAR + jne @f + sar eax,cl + jmp :storeres + @@: + cmp dl,SHR + jne @f + shr eax,cl + jmp :storeres + @@: + cmp dl,ROL + jne @f + rol eax,cl + jmp :storeres + @@: + cmp dl,ROR + jne @f + ror eax,cl + jmp :storeres + @@: + int3 + ::storeres + lea edi,[res] + call :%pStoreMint + [64] + mov rax,[a] + mov rcx,[b] + mov edx,[op] + cmp dl,SHL + jne @f + shl rax,cl + jmp :storeres + @@: + cmp dl,SAR + jne @f + sar rax,cl + jmp :storeres + @@: + cmp dl,SHR + jne @f + shr rax,cl + jmp :storeres + @@: + cmp dl,ROL + jne @f + rol rax,cl + jmp :storeres + @@: + cmp dl,ROR + jne @f + ror eax,cl + jmp :storeres + @@: + int3 + ::storeres + lea rdi,[res] + call :%pStoreMint + } + return res +end function + +procedure bitwise(atom a, atom b) + printf(1,"and_bits(%b,%b) = %032b\n",{a,b,and_bits(a,b)}) + printf(1," or_bits(%b,%b) = %032b\n",{a,b, or_bits(a,b)}) + printf(1,"xor_bits(%b,%b) = %032b\n",{a,b,xor_bits(a,b)}) + printf(1,"not_bits(%b) = %032b\n",{a,not_bits(a)}) + printf(1," shl(%b,%b) = %032b\n",{a,b,bitop(a,b,SHL)}) + printf(1," sar(%b,%b) = %032b\n",{a,b,bitop(a,b,SAR)}) + printf(1," shr(%b,%b) = %032b\n",{a,b,bitop(a,b,SHR)}) + printf(1," rol(%b,%b) = %032b\n",{a,b,bitop(a,b,ROL)}) + printf(1," ror(%b,%b) = %032b\n",{a,b,bitop(a,b,ROR)}) +end procedure + +bitwise(0x800000FE,7) diff --git a/Task/Bitwise-operations/Ring/bitwise-operations.ring b/Task/Bitwise-operations/Ring/bitwise-operations.ring new file mode 100644 index 0000000000..18f76b3861 --- /dev/null +++ b/Task/Bitwise-operations/Ring/bitwise-operations.ring @@ -0,0 +1,9 @@ +x = 8 +y = 2 + +see "x & y - Binary AND : " + (x & y) + nl +see "x | y - Binary OR : " + (x | y) + nl +see "x ^ y - Binary XOR : " + (x ^ y) +nl +see "~x - Binary Ones Complement : " + (~x) + nl +see "x << y - Binary Left Shift : " + (x << y) + nl +see "x >> y - Binary Right Shift : " + (x >> y) + nl diff --git a/Task/Bitwise-operations/Sidef/bitwise-operations.sidef b/Task/Bitwise-operations/Sidef/bitwise-operations.sidef new file mode 100644 index 0000000000..4e17786922 --- /dev/null +++ b/Task/Bitwise-operations/Sidef/bitwise-operations.sidef @@ -0,0 +1,15 @@ +func bitwise(a, b) { + + # Make sure they are integers + a.to_int!; + b.to_int!; + + say ('a and b : ', a & b); + say ('a or b : ', a | b); + say ('a xor b : ', a ^ b); + say ('not a : ', ~a); + say ('a << b : ', a << b); # left shift + say ('a >> b : ', a >> b); # arithmetic right shift +} + +bitwise(14,3) diff --git a/Task/Bitwise-operations/Swift/bitwise-operations.swift b/Task/Bitwise-operations/Swift/bitwise-operations.swift new file mode 100644 index 0000000000..51f4594d9e --- /dev/null +++ b/Task/Bitwise-operations/Swift/bitwise-operations.swift @@ -0,0 +1,15 @@ +func bitwise(a: Int, b: Int) { + // All bitwise operations (including shifts) + // require both operands to be the same type + println("a AND b: \(a & b)") + println("a OR b: \(a | b)") + println("a XOR b: \(a ^ b)") + println("NOT a: \(~a)") + println("a << b: \(a << b)") // left shift + // for right shifts, if the operands are unsigned, Swift performs + // a logical shift; if signed, an arithmetic shift. + println("a >> b: \(a >> b)") // arithmetic right shift + println("a lsr b: \(Int(bitPattern: UInt(bitPattern: a) >> UInt(bitPattern: b)))") // logical right shift +} + +bitwise(-15,3) diff --git a/Task/Boolean-values/8051-Assembly/boolean-values.8051 b/Task/Boolean-values/8051-Assembly/boolean-values.8051 new file mode 100644 index 0000000000..dce9588ab1 --- /dev/null +++ b/Task/Boolean-values/8051-Assembly/boolean-values.8051 @@ -0,0 +1,2 @@ +clr bit ; clears +setb bit ; sets diff --git a/Task/Boolean-values/EchoLisp/boolean-values.echolisp b/Task/Boolean-values/EchoLisp/boolean-values.echolisp new file mode 100644 index 0000000000..851d238187 --- /dev/null +++ b/Task/Boolean-values/EchoLisp/boolean-values.echolisp @@ -0,0 +1,4 @@ +(not #t) → #f +(not #f) → #t +(not null) → #f +(not 0) → #f diff --git a/Task/Boolean-values/FreeBASIC/boolean-values.freebasic b/Task/Boolean-values/FreeBASIC/boolean-values.freebasic new file mode 100644 index 0000000000..758530a724 --- /dev/null +++ b/Task/Boolean-values/FreeBASIC/boolean-values.freebasic @@ -0,0 +1,14 @@ +' FB 1.05.0 Win64 + +Dim i As Integer = 23 +Dim s As String = "False" +Dim b As Boolean +b = i +Print b +b = CBool(s) +Print b +i = b +Print i +i = CInt(true) +Print i +Sleep diff --git a/Task/Boolean-values/I/boolean-values.i b/Task/Boolean-values/I/boolean-values.i new file mode 100644 index 0000000000..bc96255651 --- /dev/null +++ b/Task/Boolean-values/I/boolean-values.i @@ -0,0 +1,14 @@ +software { + if true + print("this prints") + end + if 1 + print("this prints") + end + if false + print("this does not print") + end + if 0 + print("this does not print") + end +} diff --git a/Task/Boolean-values/Idris/boolean-values.idris b/Task/Boolean-values/Idris/boolean-values.idris new file mode 100644 index 0000000000..bb96e57dc4 --- /dev/null +++ b/Task/Boolean-values/Idris/boolean-values.idris @@ -0,0 +1,9 @@ +Idris> :doc Bool +Data type Prelude.Bool.Bool : Type + Boolean Data Type + +Constructors: + False : Bool + + + True : Bool diff --git a/Task/Boolean-values/LFE/boolean-values.lfe b/Task/Boolean-values/LFE/boolean-values.lfe new file mode 100644 index 0000000000..350275e697 --- /dev/null +++ b/Task/Boolean-values/LFE/boolean-values.lfe @@ -0,0 +1,8 @@ +> 'true +true +> 'false +false +> (or 'false 'false) +false +> (or 'false 'true) +true diff --git a/Task/Boolean-values/Lasso/boolean-values-1.lasso b/Task/Boolean-values/Lasso/boolean-values-1.lasso new file mode 100644 index 0000000000..e72f7cea1f --- /dev/null +++ b/Task/Boolean-values/Lasso/boolean-values-1.lasso @@ -0,0 +1,11 @@ +!true +// => false + +not false +// => true + +var(x = true) +$x // => true + +$x = false +$x // => false diff --git a/Task/Boolean-values/Lasso/boolean-values-2.lasso b/Task/Boolean-values/Lasso/boolean-values-2.lasso new file mode 100644 index 0000000000..9a2b126389 --- /dev/null +++ b/Task/Boolean-values/Lasso/boolean-values-2.lasso @@ -0,0 +1,7 @@ +local(x = string) +// size is 0 +#x->size ? 'yes' | 'no' + +local(x = '123fsfsd') +// size is 8 +#x->size ? 'yes' | 'no' diff --git a/Task/Boolean-values/Lingo/boolean-values.lingo b/Task/Boolean-values/Lingo/boolean-values.lingo new file mode 100644 index 0000000000..d1a19d33fc --- /dev/null +++ b/Task/Boolean-values/Lingo/boolean-values.lingo @@ -0,0 +1,6 @@ +put TRUE +-- 1 +put FALSE +-- 0 +if 23 then put "Hello" +-- "Hello" diff --git a/Task/Boolean-values/Monte/boolean-values.monte b/Task/Boolean-values/Monte/boolean-values.monte new file mode 100644 index 0000000000..4ab9e9d08b --- /dev/null +++ b/Task/Boolean-values/Monte/boolean-values.monte @@ -0,0 +1,4 @@ +def example(input :boolean): + if input: + return "Input was true!" + return "Input was false." diff --git a/Task/Boolean-values/Nim/boolean-values.nim b/Task/Boolean-values/Nim/boolean-values.nim new file mode 100644 index 0000000000..5dc47bf783 --- /dev/null +++ b/Task/Boolean-values/Nim/boolean-values.nim @@ -0,0 +1,5 @@ +if true: echo "yes" +if false: echo "no" + +# Other objects never represent true or false: +if 2: echo "compile error" diff --git a/Task/Boolean-values/Ring/boolean-values.ring b/Task/Boolean-values/Ring/boolean-values.ring new file mode 100644 index 0000000000..9b445a9b5b --- /dev/null +++ b/Task/Boolean-values/Ring/boolean-values.ring @@ -0,0 +1,5 @@ +x = True +y = False +see "x and y : " + (x and y) + nl +see "x or y : " + (x or y) + nl +see "not x : " + (not x) + nl diff --git a/Task/Boolean-values/Sidef/boolean-values-1.sidef b/Task/Boolean-values/Sidef/boolean-values-1.sidef new file mode 100644 index 0000000000..d661db48b7 --- /dev/null +++ b/Task/Boolean-values/Sidef/boolean-values-1.sidef @@ -0,0 +1,2 @@ +var t = true; +var f = false; diff --git a/Task/Boolean-values/Sidef/boolean-values-2.sidef b/Task/Boolean-values/Sidef/boolean-values-2.sidef new file mode 100644 index 0000000000..1efddf4d60 --- /dev/null +++ b/Task/Boolean-values/Sidef/boolean-values-2.sidef @@ -0,0 +1,5 @@ +if (0 || "0" || false || nil || "" || [] || :()) { + say "true" +} else { + say "false"; +} diff --git a/Task/Boolean-values/Ursa/boolean-values-1.ursa b/Task/Boolean-values/Ursa/boolean-values-1.ursa new file mode 100644 index 0000000000..87f4627aa7 --- /dev/null +++ b/Task/Boolean-values/Ursa/boolean-values-1.ursa @@ -0,0 +1 @@ +decl boolean bool diff --git a/Task/Boolean-values/Ursa/boolean-values-2.ursa b/Task/Boolean-values/Ursa/boolean-values-2.ursa new file mode 100644 index 0000000000..62ddb46b87 --- /dev/null +++ b/Task/Boolean-values/Ursa/boolean-values-2.ursa @@ -0,0 +1,3 @@ +set bool true +# same as +set bool (= 2 2) diff --git a/Task/Boolean-values/Ursa/boolean-values-3.ursa b/Task/Boolean-values/Ursa/boolean-values-3.ursa new file mode 100644 index 0000000000..31bd10e4d0 --- /dev/null +++ b/Task/Boolean-values/Ursa/boolean-values-3.ursa @@ -0,0 +1,3 @@ +set bool false +# same as +set bool (not (= 2 2)) diff --git a/Task/Box-the-compass/FreeBASIC/box-the-compass.freebasic b/Task/Box-the-compass/FreeBASIC/box-the-compass.freebasic new file mode 100644 index 0000000000..620d8ad6de --- /dev/null +++ b/Task/Box-the-compass/FreeBASIC/box-the-compass.freebasic @@ -0,0 +1,32 @@ +' version 04-11-2016 +' compile with: fbc -s console + +Dim As String names(0 To ...) = { "North", "North by east", "North-northeast", _ + "Northeast by north", "Northeast", "Northeast by east", "East-northeast", _ + "East by north", "East", "East by south", "East-southeast", _ + "Southeast by east", "Southeast", "Southeast by south", "South-southeast", _ + "South by east", "South", "South by west", "South-southwest", _ + "Southwest by south", "Southwest", "Southwest by west", "West-southwest", _ + "West by south", "West", "West by north", "West-northwest", _ + "Northwest by west", "Northwest", "Northwest by north", "North-northwest", _ + "North by west", "North" } + +Dim As Double degrees(0 To ...) = { 0, 16.87, 16.88, 33.75, 50.62, 50.63, _ + 67.5, 84.37, 84.38, 101.25, 118.12, 118.13, 135, 151.87, 151.88, 168.75, _ + 185.62, 185.63, 202.5, 219.37, 219.38, 236.25, 253.12, 253.13, 270, _ + 286.87, 286.88, 303.75, 320.62, 320.63, 337.5, 354.37, 354.38 } + +Dim As ULong i, j + +For i = LBound(degrees) To UBound(degrees) + j = Int((degrees(i) + 5.625) / 11.25) + If j > 31 Then j = j - 32 + Print Using "####.## ## "; degrees(i); j; + Print names(j) +Next + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Box-the-compass/Lasso/box-the-compass.lasso b/Task/Box-the-compass/Lasso/box-the-compass.lasso new file mode 100644 index 0000000000..7646159e5e --- /dev/null +++ b/Task/Box-the-compass/Lasso/box-the-compass.lasso @@ -0,0 +1,52 @@ +define pointsarray() => { + local(points = array) + loop(-from=0,-to=32) => { + local(heading = loop_count * 11.25) + if(loop_count % 3 == 1) => { + #heading += 5.62 + else(loop_count % 3 == 2) + #heading -= 5.62 + } + #points->insert(#heading) + } + return #points +} +define compassShort => array( + 'N','Nbe','N-ne','Nebn','Ne','Nebe','E-ne','Ebn', + 'E','Ebs','E-se','Sebe','Se','Sebs','S-se','Sbe', + 'S','Sbw','S-sw','Swbs','Sw','Swbw','W-sw','Wbs', + 'W','Wbn','W-nw','Nwbw','Nw','Nwbn','N-nw','Nbw', 'N') +define compassLong(short::string) => { + local(o = string) + with i in #short->values do => { #o->append(compassLongProcessor(#i)) } + return #o +} +define compassLongProcessor(char::string) => { + #char == 'N' ? return #char + 'orth' + #char == 'S' ? return #char + 'outh' + #char == 'E' ? return #char + 'ast' + #char == 'W' ? return #char + 'est' + #char == 'b' ? return ' by ' + #char == '-' ? return '-' +} +// test output points as decimals +//pointsarray + +// test output the array of text values +//compassShort + +// test output the long names of the text values +//with s in compassShort do => {^ compassLong(#s) + '\r' ^} + +'angle | box | compass point +--------------------------------- +' +local(counter = 0) +with p in pointsarray do => {^ + local(pformatted = #p->asString(-precision=2)) + while(#pformatted->size < 6) => { #pformatted->append(' ') } + #counter += 1 + #counter > 32 ? #counter = 1 + #pformatted + ' | ' + (#counter < 10 ? ' ') + #counter + ' | ' + compassLong(compassShort->get(#counter)) + '\r' + +^} diff --git a/Task/Box-the-compass/Nim/box-the-compass.nim b/Task/Box-the-compass/Nim/box-the-compass.nim new file mode 100644 index 0000000000..2bea7f535c --- /dev/null +++ b/Task/Box-the-compass/Nim/box-the-compass.nim @@ -0,0 +1,18 @@ +import strfmt + +const names = [ + "North", "North by east", "North-northeast", "Northeast by north", + "Northeast", "Northeast by east", "East-northeast", "East by north", + "East", "East by south", "East-southeast", "Southeast by east", + "Southeast", "Southeast by south","South-southeast", "South by east", + "South", "South by west", "South-southwest", "Southwest by south", + "Southwest", "Southwest by west", "West-southwest", "West by south", + "West", "West by north", "West-northwest", "Northwest by west", + "Northwest", "Northwest by north", "North-northwest", "North by west", "North"] + +for i in 0..32: + let j = i mod 32 + var d = float(i) * 11.25 + if i mod 3 == 1: d += 5.62 + if i mod 3 == 2: d -= 5.62 + printlnfmt "{:2} {:18} {:>6.2f}", j + 1, names[j], d diff --git a/Task/Box-the-compass/Phix/box-the-compass.phix b/Task/Box-the-compass/Phix/box-the-compass.phix new file mode 100644 index 0000000000..a6421412cb --- /dev/null +++ b/Task/Box-the-compass/Phix/box-the-compass.phix @@ -0,0 +1,48 @@ +function get225(integer d, string p1, string p2, string p4) +string p3 + p3 = p1&'-'&lower(p2) + p2 &= " by "&lower(p1) + p1 &= " by "&lower(p4) + if d then + return {p1,p3,p2} -- eg {North by east,North-northeast,Northeast by north} + else + return {p2,p3,p1} -- eg {Northeast by east,East-northeast,East by north} + end if +end function + +function get45(sequence res, integer d, string p1, string p2) +string p3 + res = append(res,p1) -- North/East/South/West + if d then + p3 = p1&lower(p2) -- Northeast/Southwest + else + p3 = p2&lower(p1) -- Southeast/Northwest + end if + res &= get225(1,p1,p3,p2) -- eg get225(1,North,Northeast,East) + -- -> {North by east,North-northeast,Northeast by north} + res = append(res,p3) -- Northeast/Southeast/Southwest/Northwest + res &= get225(0,p2,p3,p1) -- eg get225(0,East,Northeast,North) + -- -> {Northeast by east,East-northeast,East by north} + return res +end function + +function get90(sequence points) +sequence res = {} + for i=1 to length(points) do + res = get45(res,remainder(i,2),points[i],points[remainder(i,4)+1]) + end for -- ie get45(1,North,East) + -- get45(0,East,South) + -- get45(1,South,West) + -- get45(0,West,North) + return res +end function + +constant compass_points = get90({"North","East","South","West"}) + +atom test_point +integer compass_point +for i = 1 to 33 do + test_point = (i-1)*11.25 + 5.62*(remainder(i,3)-1) + compass_point = remainder(floor(test_point*32/360+0.5),32)+1 + printf(1, "%2d %-22s %6.2f\n", {compass_point, compass_points[compass_point], test_point}) +end for diff --git a/Task/Box-the-compass/Sidef/box-the-compass.sidef b/Task/Box-the-compass/Sidef/box-the-compass.sidef new file mode 100644 index 0000000000..af94563422 --- /dev/null +++ b/Task/Box-the-compass/Sidef/box-the-compass.sidef @@ -0,0 +1,15 @@ +func point (index) { + var ix = (index % 32); + if (ix & 1) { "#{point((ix + 1) & 28)} by #{point(((2 - (ix & 2)) * 4) + ix & 24)}" } + elsif (ix & 2) { "#{point((ix + 2) & 24)}-#{point((ix | 4) & 28)}" } + elsif (ix & 4) { "#{point((ix + 8) & 16)}#{point((ix | 8) & 24)}" } + else { [ix / 8] } +} + +func test_angle (ix) { ix * 11.25 + [0, 5.62, -5.62][ ix % 3 ] }; +func angle_to_point(𝜽) { (𝜽 / 360 * 32) + 0.5 -> floor }; + +for ix in range(0, 32) { + var 𝜽 = test_angle(ix); + printf(" %2d %6.2f° %s\n", ix % 32 + 1, 𝜽, point(angle_to_point(𝜽)).tc); +} diff --git a/Task/Break-OO-privacy/Nim/break-oo-privacy-1.nim b/Task/Break-OO-privacy/Nim/break-oo-privacy-1.nim new file mode 100644 index 0000000000..33229c01fa --- /dev/null +++ b/Task/Break-OO-privacy/Nim/break-oo-privacy-1.nim @@ -0,0 +1,7 @@ +type Foo* = object + a: string + b: string + c: int + +proc createFoo*(a, b, c): Foo = + Foo(a: a, b: b, c: c) diff --git a/Task/Break-OO-privacy/Nim/break-oo-privacy-2.nim b/Task/Break-OO-privacy/Nim/break-oo-privacy-2.nim new file mode 100644 index 0000000000..9deba1abe5 --- /dev/null +++ b/Task/Break-OO-privacy/Nim/break-oo-privacy-2.nim @@ -0,0 +1,3 @@ +var x = createFoo("this a", "this b", 12) + +echo x.a # compile time error diff --git a/Task/Break-OO-privacy/Nim/break-oo-privacy-3.nim b/Task/Break-OO-privacy/Nim/break-oo-privacy-3.nim new file mode 100644 index 0000000000..4c0f8d1995 --- /dev/null +++ b/Task/Break-OO-privacy/Nim/break-oo-privacy-3.nim @@ -0,0 +1 @@ +echo repr(x) diff --git a/Task/Break-OO-privacy/Nim/break-oo-privacy-4.nim b/Task/Break-OO-privacy/Nim/break-oo-privacy-4.nim new file mode 100644 index 0000000000..f169521e4b --- /dev/null +++ b/Task/Break-OO-privacy/Nim/break-oo-privacy-4.nim @@ -0,0 +1,11 @@ +import typeinfo + +for key, val in fields(toAny(x)): + echo "Key ", key + case val.kind + of akString: + echo " is a string with value: ", val.getString + of akInt..akInt64, akUint..akUint64: + echo " is an integer with value: ", val.getBiggestInt + else: + echo " is an unknown with value: ", val.repr diff --git a/Task/Break-OO-privacy/Sidef/break-oo-privacy.sidef b/Task/Break-OO-privacy/Sidef/break-oo-privacy.sidef new file mode 100644 index 0000000000..bb90a8c406 --- /dev/null +++ b/Task/Break-OO-privacy/Sidef/break-oo-privacy.sidef @@ -0,0 +1,15 @@ +class Example { + has public = "foo" + method init { + self{:private} = "secret" + } +} + +var obj = Example(); + +# Access public attributes +say obj.public; #=> "foo" +say obj{:public}; #=> "foo" + +# Access private attributes +say obj{:private}; #=> "secret" diff --git a/Task/Brownian-tree/Phix/brownian-tree.phix b/Task/Brownian-tree/Phix/brownian-tree.phix new file mode 100644 index 0000000000..5b338b9e68 --- /dev/null +++ b/Task/Brownian-tree/Phix/brownian-tree.phix @@ -0,0 +1,70 @@ +include ..\pGUI\pGUI.e + +Ihandle dlg, canvas +cdCanvas cddbuffer, cdcanvas + +function redraw_cb(Ihandle /*ih*/, integer /*posx*/, integer /*posy*/) +integer x,y,ox,oy +integer {width, height} = IupGetIntInt(canvas, "DRAWSIZE") +sequence grid = repeat(repeat(0,width),height) +integer xy = floor(width*height*0.8) +--atom t = time()+1 + grid[floor(width/2)][floor(height/2)] = 1 + cdCanvasActivate(cddbuffer) + cdCanvasClear(cddbuffer) + for i=1 to xy do + x = rand(width) y = rand(height) + ox = x oy = y + while x>=1 and x<=width + and y>=1 and y<=height do + if grid[y][x] then + grid[oy][ox] = 1 + cdCanvasPixel(cddbuffer, ox, oy, #00FF00) + exit + end if + ox = x x += rand(3)-2 + oy = y y += rand(3)-2 + end while +-- -- if making the canvas bigger/resizeable, +-- -- put this in so that you can kill it. +-- if time()>=t then +-- ?{i,xy} +-- t = time()+1 +-- end if + end for + cdCanvasFlush(cddbuffer) + return IUP_DEFAULT +end function + +function map_cb(Ihandle ih) + cdcanvas = cdCreateCanvas(CD_IUP, ih) + cddbuffer = cdCreateCanvas(CD_DBUFFER, cdcanvas) + cdCanvasSetBackground(cddbuffer, CD_WHITE) + cdCanvasSetForeground(cddbuffer, CD_RED) + return IUP_DEFAULT +end function + +function esc_close(Ihandle /*ih*/, atom c) + if c=K_ESC then return IUP_CLOSE end if + return IUP_CONTINUE +end function + +procedure main() + IupOpen("..\\pGUI\\") + + canvas = IupCanvas(NULL) + IupSetAttribute(canvas, "RASTERSIZE", "200x200") -- fixed size + IupSetCallback(canvas, "MAP_CB", Icallback("map_cb")) + + dlg = IupDialog(canvas, "RESIZE=NO") + IupSetAttribute(dlg, "TITLE", "Brownian Tree") + IupSetCallback(dlg, "K_ANY", Icallback("esc_close")) + IupSetCallback(canvas, "ACTION", Icallback("redraw_cb")) + + IupMap(dlg) + IupShowXY(dlg,IUP_CENTER,IUP_CENTER) + IupMainLoop() + IupClose() +end procedure + +main() diff --git a/Task/Bulls-and-cows-Player/Phix/bulls-and-cows-player.phix b/Task/Bulls-and-cows-Player/Phix/bulls-and-cows-player.phix new file mode 100644 index 0000000000..4f74485223 --- /dev/null +++ b/Task/Bulls-and-cows-Player/Phix/bulls-and-cows-player.phix @@ -0,0 +1,70 @@ +constant line = " +---------+-----------------------------+-------+------+\n" +constant digits = "123456789" + +function mask(integer ch) + return power(2,ch-'1') +end function + +function score(sequence guess, sequence goal) +integer bits = 0, bulls = 0, cows = 0 + for i=1 to length(guess) do + if guess[i]=goal[i] then + bulls += 1 + else + bits += mask(goal[i]) + end if + end for + for i=1 to length(guess) do + cows += (and_bits(bits,mask(guess[i]))!=0) + end for + return {bulls, cows} +end function + +sequence list = {} + +procedure pick(integer n, integer got, integer marker, sequence buf) +integer bits = 1 + if got>=n then + list = append(list,buf) + else + for i=0 to length(digits)-1 do + if not and_bits(marker,bits) then + buf[got+1] = i+'1' + pick(n, got+1, or_bits(marker,bits), buf) + end if + bits *= 2 + end for + end if +end procedure + +procedure filter_list(sequence guess, integer bulls, integer cows) +integer l = length(list), idx = 0 +sequence bc = {bulls,cows} + for i=1 to l do + if score(guess,list[i])=bc then + idx += 1 + list[idx] = list[i] + end if + end for + list = list[1..idx] +end procedure + +procedure game(sequence tgt) +integer n = length(tgt), attempt = 1, bulls = 0, cows +sequence guess + pick(n,0,0,repeat(0,n)) + while bulls grep {|n| !("#{n}" =~ /0 | (\d) .*? \1 /x) }.map{.digits}); + +# Repeatedly prompt for input until the user supplies a reasonable score. +# The regex validates the user's input and then returns two numbers. +func read_score(guess) { + loop { + "My guess: %s (from %d possibilities)\n" \ + -> printf(guess.join, candidates.len); + + if (var m = (Sys.scanln("bulls cows: ") =~ /^\h*(\d)\h*(\d)\h*$/)) { + var (bulls, cows) = m.cap.map{.to_i}...; + bulls+cows <= 4 && return(bulls, cows); + } + + say "Please specify the number of bulls and the number of cows"; + } +} + +func score_correct(a, b, bulls, cows) { + var (exact, loose) = (0, 0); + + for i in ^4 { + a[i] == b[i] ? ++exact + : (a[i]~~b && ++loose) + } + + (bulls == exact) && (cows == loose) +} + +# Pick a number, display it, get the score, and discard candidates +# that don't match the score: +loop { + var guess = candidates.pick; + var (bulls, cows) = read_score(guess); + candidates.grep!{|n| score_correct(n, guess, bulls, cows) } + candidates.len > 1 || break +} + +# Print the secret number or the error message +( + candidates.len == 1 ? ("Your secret number is: %d" % candidates[0].join) + : ("I think you made a mistake with your scoring") +)->say diff --git a/Task/Bulls-and-cows/Ceylon/bulls-and-cows.ceylon b/Task/Bulls-and-cows/Ceylon/bulls-and-cows.ceylon new file mode 100644 index 0000000000..ad4c6a1040 --- /dev/null +++ b/Task/Bulls-and-cows/Ceylon/bulls-and-cows.ceylon @@ -0,0 +1,70 @@ +import ceylon.random { + + DefaultRandom +} + +shared void run() { + + value random = DefaultRandom(); + + function generateDigits() => + random.elements(1..9).distinct.take(4).sequence(); + + function validate(String guess) { + variable value ok = true; + if(!guess.every((Character element) => element.digit)) { + print("numbers only, please"); + ok = false; + } + if('0' in guess) { + print("only 1 to 9, please"); + ok = false; + } + if(guess.distinct.shorterThan(guess.size)) { + print("no duplicates, please"); + ok = false; + } + if(guess.size != 4) { + print("4 digits please"); + ok = false; + } + return ok; + } + + function score({Integer*} target, {Integer*} guess) { + variable value bulls = 0; + variable value cows = 0; + for([a, b] in zipPairs(target, guess)) { + if(a == b) { + bulls++; + } else if(target.contains(b)) { + cows++; + } + } + return [bulls, cows]; + } + + while(true) { + value digits = generateDigits(); + print("I have chosen my four digits, please guess what they are. + Use only the digits 1 to 9 with no duplicates and enter them with no spaces. eg 1234 + Enter q or Q to quit."); + while(true) { + if(exists line = process.readLine()) { + if(line.uppercased == "Q") { + return; + } + if(validate(line)) { + value guessDigits = line.map((Character element) => parseInteger(element.string)).coalesced; + value [bulls, cows] = score(digits, guessDigits); + if(bulls == 4) { + print("You win!"); + break; + } else { + print("Bulls: ``bulls``, Cows: ``cows``"); + } + } + } + } + } +} diff --git a/Task/Bulls-and-cows/Coco/bulls-and-cows-1.coco b/Task/Bulls-and-cows/Coco/bulls-and-cows-1.coco new file mode 100644 index 0000000000..5187a60597 --- /dev/null +++ b/Task/Bulls-and-cows/Coco/bulls-and-cows-1.coco @@ -0,0 +1,4 @@ +say = print +prompt = (str) -> + putstr str + readline! ? quit! diff --git a/Task/Bulls-and-cows/Coco/bulls-and-cows-2.coco b/Task/Bulls-and-cows/Coco/bulls-and-cows-2.coco new file mode 100644 index 0000000000..dfd5c0ad34 --- /dev/null +++ b/Task/Bulls-and-cows/Coco/bulls-and-cows-2.coco @@ -0,0 +1,22 @@ +const SIZE = 4 + +secret = _.sample ['1' to '9'], SIZE + +for ever + var guess + for ever + guess := _.uniq prompt 'Enter a guess: ' + if guess.length === SIZE and not _.difference guess, ['1' to '9'] .length + break + say 'Malformed guess; try again.' + bulls = cows = 0 + for i til SIZE + if guess[i] === secret[i] + ++bulls + else if _.contains secret, guess[i] + ++cows + if bulls === SIZE + break + say "#bulls bull#{[if bulls !== 1 then 's']}, #cows cow#{[if cows !== 1 then 's']}." + +say 'A winner is you!' diff --git a/Task/Bulls-and-cows/Hy/bulls-and-cows.hy b/Task/Bulls-and-cows/Hy/bulls-and-cows.hy new file mode 100644 index 0000000000..41f690d9eb --- /dev/null +++ b/Task/Bulls-and-cows/Hy/bulls-and-cows.hy @@ -0,0 +1,26 @@ +(import random) + +(def +size+ 4) +(def +digits+ "123456789") +(def +secret+ (random.sample +digits+ +size+)) + +(while True + (while True + (setv guess (list (distinct (raw-input "Enter a guess: ")))) + (when (and + (= (len guess) +size+) + (all (map (fn [c] (in c +digits+)) guess))) + (break)) + (print "Malformed guess; try again")) + (setv bulls 0) + (setv cows 0) + (for [i (range +size+)] (cond + [(= (get guess i) (get +secret+ i)) (setv bulls (inc bulls))] + [(in (get guess i) +secret+) (setv cows (inc cows))])) + (when (= bulls +size+) + (break)) + (print (.format "{} bull{}, {} cows" + bulls (if (= bulls 1) "" "s") + cows (if (= cows 1) "" "s")))) + +(print "A winner is you!") diff --git a/Task/Bulls-and-cows/Lasso/bulls-and-cows.lasso b/Task/Bulls-and-cows/Lasso/bulls-and-cows.lasso new file mode 100644 index 0000000000..853c7ce890 --- /dev/null +++ b/Task/Bulls-and-cows/Lasso/bulls-and-cows.lasso @@ -0,0 +1,70 @@ +[ +define randomizer() => { + local(n = string) + while(#n->size < 4) => { + local(r = integer_random(1,9)->asString) + #n !>> #r ? #n->append(#r) + } + return #n +} +define cowbullchecker(n::string,a::string) => { + integer(#n) == integer(#a) ? return (:true,map('cows'=0,'bulls'=4,'choice'=#a)) + local(cowbull = map('cows'=0,'bulls'=0,'choice'=#a),'checked' = array) + loop(4) => { + if(#checked !>> integer(#a->values->get(loop_count))) => { + #checked->insert(integer(#a->values->get(loop_count))) + if(integer(#n->values->get(loop_count)) == integer(#a->values->get(loop_count))) => { + #cowbull->find('bulls') += 1 + else(#n->values >> #a->values->get(loop_count)) + #cowbull->find('cows') += 1 + } + } + } + #cowbull->find('bulls') == 4 ? return (:true,map('cows'=0,'bulls'=4,'choice'=#a)) + return (:true,#cowbull) +} +session_start('user') +session_addvar('user', 'num') +session_addvar('user', 'historic_choices') +// set up rand +var(num)->isNotA(::string) ? var(num = randomizer) +var(historic_choices)->isNotA(::array) ? var(historic_choices = array) +local(success = false) +// check answer +if(web_request->param('a')->asString->size) => { + local(success,result) = cowbullchecker($num,web_request->param('a')->asString) + $historic_choices->insert(#result) +} +if(web_request->params->asStaticArray >> 'restart') => { + $num = randomizer + $historic_choices = array +} +] +

Bulls and Cows

+

Guess the 4-digit number...

+

Your win if the guess is the same as the randomly chosen number.
+- A score of one bull is accumulated for each digit in your guess that equals the corresponding digit in the randomly chosen initial number.
+- A score of one cow is accumulated for each digit in your guess that also appears in the randomly chosen number, but in the wrong position. +

+[ +local(win = false) +if($historic_choices->size) => { + with c in $historic_choices do => {^ + '

'+#c->find('choice')+': Bulls: '+#c->find('bulls')+', Cows: '+#c->find('cows') + if(#c->find('bulls') == 4) => {^ + ' - YOU WIN!' + #win = true + ^} + '

' + ^} +} +if(not #win) => {^ +] +
+ + + Restart +
+[else + 'Restart' +^}] diff --git a/Task/Bulls-and-cows/Nim/bulls-and-cows.nim b/Task/Bulls-and-cows/Nim/bulls-and-cows.nim new file mode 100644 index 0000000000..450113a078 --- /dev/null +++ b/Task/Bulls-and-cows/Nim/bulls-and-cows.nim @@ -0,0 +1,35 @@ +import random, strutils, rdstdin +randomize() + +proc random(a: string): char = a[random(0..a.len)] + +const + digits = "123456789" + size = 4 + +var digitsSet: set[char] = {} +for d in digits: digitsSet.incl d + +var chosen = newString(size) +for i in 0..chosen.high: chosen[i] = random(digits) + +echo """I have chosen a number from $# unique digits from 1 to 9 arranged in a random order. +You need to input a $# digit, unique digit number as a guess at what I have chosen""".format(size, size) + +var guesses = 0 +while true: + inc guesses + var guess = "" + while true: + guess = readLineFromStdin("\nNext guess [$#]: ".format(guesses)).strip() + if guess.len == size and allCharsInSet(guess, digitsSet): + break + echo "Problem, try again. You need to enter $# unique digits from 1 to 9".format(size) + if guess == chosen: + echo "\nCongratulations you guessed correctly in ",guesses," attempts" + break + var bulls, cows = 0 + for i in 0 .. numbers + while(numbers size 4 <>) [ 9 rand dup numbers include ifFalse: [ numbers add ] else: [ drop ] ] + + while(true) [ + "Enter a number of 4 different digits between 1 and 9 : " print + System.Console askln ->digits + digits asInteger isNull digits size 4 <> or ifTrue: [ "Number of four digits needed" println continue ] + digits map(#asDigit) ->guess + + guess numbers zipWith(#==) occurrences(true) ->bulls + bulls 4 == ifTrue: [ "You won !" println return ] + + guess filter(#[numbers include]) size bulls - ->cows + System.Out "Bulls = " << bulls << ", cows = " << cows << cr + ] ; diff --git a/Task/Bulls-and-cows/Phix/bulls-and-cows.phix b/Task/Bulls-and-cows/Phix/bulls-and-cows.phix new file mode 100644 index 0000000000..37a97d28f2 --- /dev/null +++ b/Task/Bulls-and-cows/Phix/bulls-and-cows.phix @@ -0,0 +1,50 @@ +constant N = 4 + +function mask(integer ch) + return power(2,ch-'1') +end function + +function score(sequence guess, sequence goal) +integer bits = 0, bulls = 0, cows = 0, b + for i=1 to N do + b = goal[i] + if guess[i]=b then + bulls += 1 + else + bits += mask(b) + end if + end for + for i=1 to N do + b = mask(guess[i]) + if and_bits(bits,b)!=0 then + cows += 1 + bits -= b + end if + end for + return {bulls, cows} +end function + +procedure game() +sequence tgt = shuffle("123456789")[1..N] +integer attempt = 1, bulls = 0, cows +sequence guess + while bulls + +put crc32.toHexString(1, crc32.length) +-- "41 4f a3 39" diff --git a/Task/CRC-32/Lingo/crc-32-2.lingo b/Task/CRC-32/Lingo/crc-32-2.lingo new file mode 100644 index 0000000000..f25d1f4b8a --- /dev/null +++ b/Task/CRC-32/Lingo/crc-32-2.lingo @@ -0,0 +1,67 @@ +--**************************************************************************** +-- @desc CRC-32 Class +-- @file parent script "CRC" +-- @version 0.1 +--**************************************************************************** + +property _CRC32Table + +---------------------------------------- +-- @constructor +---------------------------------------- +on new me + + -- used for fast CRC32 calculation + me._CRC32Table = [\ + 0, 1996959894, -301047508, -1727442502, 124634137, 1886057615, -379345611, -1637575261, 249268274, 2044508324,\ + -522852066, -1747789432, 162941995, 2125561021, -407360249, -1866523247, 498536548, 1789927666, -205950648,\ + -2067906082, 450548861, 1843258603, -187386543, -2083289657, 325883990, 1684777152, -43845254, -1973040660,\ + 335633487, 1661365465, -99664541, -1928851979, 997073096, 1281953886, -715111964, -1570279054, 1006888145,\ + 1258607687, -770865667, -1526024853, 901097722, 1119000684, -608450090, -1396901568, 853044451, 1172266101,\ + -589951537, -1412350631, 651767980, 1373503546, -925412992, -1076862698, 565507253, 1454621731, -809855591,\ + -1195530993, 671266974, 1594198024, -972236366, -1324619484, 795835527, 1483230225, -1050600021, -1234817731,\ + 1994146192, 31158534, -1731059524, -271249366, 1907459465, 112637215, -1614814043, -390540237, 2013776290,\ + 251722036, -1777751922, -519137256, 2137656763, 141376813, -1855689577, -429695999, 1802195444, 476864866,\ + -2056965928, -228458418, 1812370925, 453092731, -2113342271, -183516073, 1706088902, 314042704, -1950435094,\ + -54949764, 1658658271, 366619977, -1932296973, -69972891, 1303535960, 984961486, -1547960204, -725929758,\ + 1256170817, 1037604311, -1529756563, -740887301, 1131014506, 879679996, -1385723834, -631195440, 1141124467,\ + 855842277, -1442165665, -586318647, 1342533948, 654459306, -1106571248, -921952122, 1466479909, 544179635,\ + -1184443383, -832445281, 1591671054, 702138776, -1328506846, -942167884, 1504918807, 783551873, -1212326853,\ + -1061524307, -306674912, -1698712650, 62317068, 1957810842, -355121351, -1647151185, 81470997, 1943803523,\ + -480048366, -1805370492, 225274430, 2053790376, -468791541, -1828061283, 167816743, 2097651377, -267414716,\ + -2029476910, 503444072, 1762050814, -144550051, -2140837941, 426522225, 1852507879, -19653770, -1982649376,\ + 282753626, 1742555852, -105259153, -1900089351, 397917763, 1622183637, -690576408, -1580100738, 953729732,\ + 1340076626, -776247311, -1497606297, 1068828381, 1219638859, -670225446, -1358292148, 906185462, 1090812512,\ + -547295293, -1469587627, 829329135, 1181335161, -882789492, -1134132454, 628085408, 1382605366, -871598187,\ + -1156888829, 570562233, 1426400815, -977650754, -1296233688, 733239954, 1555261956, -1026031705, -1244606671,\ + 752459403, 1541320221, -1687895376, -328994266, 1969922972, 40735498, -1677130071, -351390145, 1913087877,\ + 83908371, -1782625662, -491226604, 2075208622, 213261112, -1831694693, -438977011, 2094854071, 198958881,\ + -2032938284, -237706686, 1759359992, 534414190, -2118248755, -155638181, 1873836001, 414664567, -2012718362,\ + -15766928, 1711684554, 285281116, -1889165569, -127750551, 1634467795, 376229701, -1609899400, -686959890,\ + 1308918612, 956543938, -1486412191, -799009033, 1231636301, 1047427035, -1362007478, -640263460, 1088359270,\ + 936918000, -1447252397, -558129467, 1202900863, 817233897, -1111625188, -893730166, 1404277552, 615818150,\ + -1160759803, -841546093, 1423857449, 601450431, -1285129682, -1000256840, 1567103746, 711928724, -1274298825,\ + -1022587231, 1510334235, 755167117] + return me +end + +---------------------------------------- +-- Calculates CRC-32 checksum of string or bytearray +-- @param {bytearray|string} input +-- @return {bytearray} (4 bytes) +---------------------------------------- +on crc32 (me, input) + if stringP(input) then input = bytearray(input) + crc = -1 + len = input.length + repeat with i = 1 to len + if (crc>0) then bitShift8 = crc/256 + else bitShift8 = bitAnd(crc,2147483647)/256+8388608 + crc = bitXor(bitShift8,me._CRC32Table[bitAnd(bitXor(crc,input[i]),255)+1]) + end repeat + ba = bytearray() + ba.endian = #bigEndian + ba.writeInt32(bitXOr(crc,-1)) + ba.position = 1 + return ba +end diff --git a/Task/CRC-32/Lingo/crc-32-3.lingo b/Task/CRC-32/Lingo/crc-32-3.lingo new file mode 100644 index 0000000000..dea14e581b --- /dev/null +++ b/Task/CRC-32/Lingo/crc-32-3.lingo @@ -0,0 +1,3 @@ +cx = Xtra("Crypto").new() +put cx.cx_crc32_string("The quick brown fox jumps over the lazy dog") +-- "414fa339" diff --git a/Task/CRC-32/Nim/crc-32.nim b/Task/CRC-32/Nim/crc-32.nim new file mode 100644 index 0000000000..1f5a8399cc --- /dev/null +++ b/Task/CRC-32/Nim/crc-32.nim @@ -0,0 +1,23 @@ +import unsigned, strutils + +type TCrc32* = uint32 +const InitCrc32* = TCrc32(-1) + +proc createCrcTable(): array[0..255, TCrc32] = + for i in 0..255: + var rem = TCrc32(i) + for j in 0..7: + if (rem and 1) > 0: rem = (rem shr 1) xor TCrc32(0xedb88320) + else: rem = rem shr 1 + result[i] = rem + +# Table created at compile time +const crc32table = createCrcTable() + +proc crc32(s: string): TCrc32 = + result = InitCrc32 + for c in s: + result = (result shr 8) xor crc32table[(result and 0xff) xor ord(c)] + result = not result + +echo crc32("The quick brown fox jumps over the lazy dog").int64.toHex(8) diff --git a/Task/CRC-32/Phix/crc-32-1.phix b/Task/CRC-32/Phix/crc-32-1.phix new file mode 100644 index 0000000000..f2ef5d796b --- /dev/null +++ b/Task/CRC-32/Phix/crc-32-1.phix @@ -0,0 +1,37 @@ +sequence table +integer have_table = 0 + +procedure make_crc() +atom rem + if have_table=0 then + have_table = 1 + table = repeat(0,256) + for i=0 to 255 do + rem = i + for j=1 to 8 do + if and_bits(rem,1) then + rem = xor_bits(floor(rem/2),#EDB88320) + else + rem = floor(rem/2) + end if + if rem<0 then + rem += #100000000 + end if + end for + table[i+1] = rem + end for + end if +end procedure + +function crc32(string s) +atom crc = #FFFFFFFF + if have_table=0 then make_crc() end if + for i=1 to length(s) do + crc = xor_bits(floor(crc/#100),table[xor_bits(and_bits(crc,0xff),s[i])+1]) + if crc<0 then + crc += #100000000 + end if + end for +-- return not_bits(crc) + return and_bits(not_bits(crc),#FFFFFFFF) +end function diff --git a/Task/CRC-32/Phix/crc-32-2.phix b/Task/CRC-32/Phix/crc-32-2.phix new file mode 100644 index 0000000000..34e71dc11b --- /dev/null +++ b/Task/CRC-32/Phix/crc-32-2.phix @@ -0,0 +1,2 @@ +string s = "The quick brown fox jumps over the lazy dog" +printf(1,"The CRC of %s is %08x\n",{s,crc32(s)}) diff --git a/Task/CRC-32/Swift/crc-32.swift b/Task/CRC-32/Swift/crc-32.swift new file mode 100644 index 0000000000..f101179f5c --- /dev/null +++ b/Task/CRC-32/Swift/crc-32.swift @@ -0,0 +1,7 @@ +import Foundation + +let strData = "The quick brown fox jumps over the lazy dog".dataUsingEncoding(NSUTF8StringEncoding, + allowLossyConversion: false) +let crc = crc32(uLong(0), UnsafePointer(strData!.bytes), uInt(strData!.length)) + +println(NSString(format:"%2X", crc)) diff --git a/Task/CSV-data-manipulation/ECL/csv-data-manipulation.ecl b/Task/CSV-data-manipulation/ECL/csv-data-manipulation.ecl new file mode 100644 index 0000000000..b69c763781 --- /dev/null +++ b/Task/CSV-data-manipulation/ECL/csv-data-manipulation.ecl @@ -0,0 +1,21 @@ +// Assumes a CSV file exists and has been sprayed to a Thor cluster +MyFileLayout := RECORD +STRING Field1; +STRING Field2; +STRING Field3; +STRING Field4; +STRING Field5; +END; + +MyDataset := DATASET ('~Rosetta::myCSVFile', MyFileLayout,CSV(SEPARATOR(','))); + +MyFileLayout Appended(MyFileLayout pInput):= TRANSFORM + SELF.Field1 := pInput.Field1 +'x'; + SELF.Field2 := pInput.Field2 +'y'; + SELF.Field3 := pInput.Field3 +'z'; + SELF.Field4 := pInput.Field4 +'a'; + SELF.Field5 := pInput.Field5 +'b'; +END ; + +MyNewDataset := PROJECT(MyDataset,Appended(LEFT)); +OUTPUT(myNewDataset,,'~Rosetta::myNewCSVFile',CSV,OVERWRITE); diff --git a/Task/CSV-data-manipulation/EchoLisp/csv-data-manipulation-1.echolisp b/Task/CSV-data-manipulation/EchoLisp/csv-data-manipulation-1.echolisp new file mode 100644 index 0000000000..9afa63c6bb --- /dev/null +++ b/Task/CSV-data-manipulation/EchoLisp/csv-data-manipulation-1.echolisp @@ -0,0 +1,21 @@ +;; CSV -> LISTS +(define (csv->row line) (map (lambda(x) (or (string->number x) x)) (string-split line ","))) +(define (csv->table csv) (map csv->row (string-split csv "\n"))) + +;; LISTS -> CSV +(define (row->csv row) (string-join row ",")) +(define (table->csv header rows) + (string-join (cons (row->csv header) (for/list ((row rows)) (row->csv row))) "\n")) + + +(define (task file) + (let* + ((table (csv->table file)) + (header (first table)) + (rows (rest table))) + + (table->csv + (append header "SUM") ;; add last column + (for/list ((row rows)) (append row (apply + row)))))) + + diff --git a/Task/CSV-data-manipulation/EchoLisp/csv-data-manipulation-2.echolisp b/Task/CSV-data-manipulation/EchoLisp/csv-data-manipulation-2.echolisp new file mode 100644 index 0000000000..a7bec1d064 --- /dev/null +++ b/Task/CSV-data-manipulation/EchoLisp/csv-data-manipulation-2.echolisp @@ -0,0 +1,15 @@ +(define file.csv #<< +C1,C2,C3,C4,C5 +1,5,9,13,17 +2,6,10,14,18 +3,7,11,15,19 +4,8,12,16,20 +>>#) + +(task file.csv) + + → "C1,C2,C3,C4,C5,SUM +1,5,9,13,17,45 +2,6,10,14,18,50 +3,7,11,15,19,55 +4,8,12,16,20,60" diff --git a/Task/CSV-data-manipulation/FreeBASIC/csv-data-manipulation.freebasic b/Task/CSV-data-manipulation/FreeBASIC/csv-data-manipulation.freebasic new file mode 100644 index 0000000000..d5e83a2542 --- /dev/null +++ b/Task/CSV-data-manipulation/FreeBASIC/csv-data-manipulation.freebasic @@ -0,0 +1,20 @@ +' FB 1.05.0 Win64 + +Open "manip.csv" For Input As #1 ' existing CSV file +Open "manip2.csv" For Output As #2 ' new CSV file for writing changed data + +Dim header As String +Line Input #1, header +header += ",SUM" +Print #2, header + +Dim As Integer c1, c2, c3, c4, c5, sum + +While Not Eof(1) + Input #1, c1, c2, c3, c4, c5 + sum = c1 + c2 + c3 + c4 + c5 + Write #2, c1, c2, c3, c4, c5, sum +Wend + +Close #1 +Close #2 diff --git a/Task/CSV-data-manipulation/FunL/csv-data-manipulation.funl b/Task/CSV-data-manipulation/FunL/csv-data-manipulation.funl new file mode 100644 index 0000000000..17cee74435 --- /dev/null +++ b/Task/CSV-data-manipulation/FunL/csv-data-manipulation.funl @@ -0,0 +1,45 @@ +import io.{lines, PrintWriter} + +data Table( header, rows ) + +def read( file ) = + l = lines( file ) + + def next = vector( l.next().split(',') ) + + if l.isEmpty() then + return Table( vector(), [] ) + + header = next() + rows = seq() + + while l.hasNext() + rows += next() + + Table( header, rows.toList() ) + +def write( table, out ) = + w = if out is String then PrintWriter( out ) else out + + w.println( table.header.mkString(',') ) + + for r <- table.rows + w.println( r.mkString(',') ) + + if out is String + w.close() + +def updateRow( header, row, updates ) = + r = dict( (header(i), row(i)) | i <- 0:header.length() ) + updates( r ) + vector( r(f) | f <- header ) + +def update( table, updates ) = + Table( table.header, (updateRow(table.header, r, updates) | r <- table.rows).toList() ) + +def addColumn( table, column, updates ) = + Table( table.header + [column], (updateRow(table.header + [column], r + [null], updates) | r <- table.rows).toList() ) + +t = addColumn( read('test.csv'), 'SUM', r -> r('SUM') = sum(int(v) | (_, v) <- r if v != null) ) +write( t, 'test_out.csv' ) +write( t, System.out ) diff --git a/Task/CSV-data-manipulation/Lingo/csv-data-manipulation-1.lingo b/Task/CSV-data-manipulation/Lingo/csv-data-manipulation-1.lingo new file mode 100644 index 0000000000..a3dd6d0afb --- /dev/null +++ b/Task/CSV-data-manipulation/Lingo/csv-data-manipulation-1.lingo @@ -0,0 +1,99 @@ +---------------------------------------- +-- Simplified CSV parser (without escape character support etc.). +-- First line is interrepted as header with column names. +-- @param {string} csvStr +-- @param {string} [sep=","] - single char as string +-- @param {string} [eol=RETURN] +-- @return {propList} +---------------------------------------- +on parseSimpleCSVString (csvStr, sep, eol) + if voidP(sep) then sep="," + if voidP(eol) then eol = RETURN + lines = explode(eol, csvStr) + if lines.getLast()="" then lines.deleteAt(lines.count) + res = [:] + res[#header] = explode(sep, lines[1]) + res[#data] = [] + cnt = lines.count + repeat with i = 2 to cnt + res[#data].append(explodeBySingleChar(sep, lines[i])) + end repeat + return res +end + +---------------------------------------- +-- Simplified CSV creater (without escape character support etc.). +-- @param {propList} csvData +-- @param {string} [sep=","] +-- @param {string} [eol=RETURN] +-- @return {string} +---------------------------------------- +on createSimpleCSVString (csvData, sep, eol) + if voidP(sep) then sep="," + if voidP(eol) then eol = RETURN + res = "" + put implode(sep, csvData[#header])&eol after res + cnt = csvData[#data].count + repeat with i = 1 to cnt + put implode(sep, csvData[#data][i])&eol after res + end repeat + return res +end + +---------------------------------------- +-- Explodes string into list +-- @param {string} delim +-- @param {string} str +-- @return {list} +---------------------------------------- +on explode (delim, str) + if delim.length=1 then return explodeBySingleChar(delim, str) + l = [] + if voidP(str) then return l + dl = delim.length + repeat while true + pos = offset(delim, str) + if pos=0 then exit repeat + l.add(str.char[1..pos-1]) + delete char 1 to pos+dl-1 of str + end repeat + if pos=0 then pos = 1-dl + l.add(str.char[pos+dl..str.length]) + return l +end + +---------------------------------------- +-- Explode string into list based on single char delimiter +-- (uses Lingo's build-in 'item' support, therefor faster) +-- @param {string} delim +-- @param {string} str +-- @return {list} +---------------------------------------- +on explodeBySingleChar (delim, str) + l = [] + if voidP(str) then return l + od = _player.itemDelimiter + _player.itemDelimiter = delim + cnt = str.item.count + repeat with i = 1 to cnt + l.add(str.item[i]) + end repeat + _player.itemDelimiter = od + return l +end + +---------------------------------------- +-- Implodes list into string +-- @param {string} delim +-- @param {list} l +-- @return {string} +---------------------------------------- +on implode (delim, l) + str = "" + cnt = l.count + repeat with i = 1 to cnt + put l[i]&delim after str + end repeat + delete char (str.length-delim.length+1) to str.length of str + return str +end diff --git a/Task/CSV-data-manipulation/Lingo/csv-data-manipulation-2.lingo b/Task/CSV-data-manipulation/Lingo/csv-data-manipulation-2.lingo new file mode 100644 index 0000000000..88f70e1352 --- /dev/null +++ b/Task/CSV-data-manipulation/Lingo/csv-data-manipulation-2.lingo @@ -0,0 +1,44 @@ +sep = "," +eol = numtochar(10) + +-- load CSV string from file +fn = _movie.path & "file.csv" +fp = xtra("fileIO").new() +fp.openFile(fn, 1) +csvStr = fp.readFile() +fp.closeFile() + +-- parse CSV string into propList +csvData = parseSimpleCSVString(csvStr, sep, eol) + +-- add SUM column +csvData[#header].append("SUM") +repeat with row in csvData[#data] + sum = 0 + repeat with cell in row + sum = sum+integer(cell) + end repeat + row.append(sum) +end repeat + +-- create CSV string from updated propList +csvString = createSimpleCSVString(csvData, sep, eol) + +-- save CSV string to file +fn = _movie.path & "file.csv" +fp.openFile(fn, 2) +if not fp.status() then fp.delete() +fp.createFile(fn) +fp.openFile(fn, 2) +fp.writeString(csvString) +fp.closeFile() + +-- show the CSV string +put csvString + +-- "C1,C2,C3,C4,C5,SUM +1,5,9,13,17,45 +2,6,10,14,18,50 +3,7,11,15,19,55 +4,8,12,16,20,60 +" diff --git a/Task/CSV-data-manipulation/Nim/csv-data-manipulation.nim b/Task/CSV-data-manipulation/Nim/csv-data-manipulation.nim new file mode 100644 index 0000000000..61636bc177 --- /dev/null +++ b/Task/CSV-data-manipulation/Nim/csv-data-manipulation.nim @@ -0,0 +1,25 @@ +import strutils, streams + +let + csv = newFileStream("data.csv", fmRead) + outf = newFileStream("data-out.csv", fmWrite) + +var lineNumber = 1 + +while true: + if atEnd(csv): + break + var line = readLine(csv) + + if lineNumber == 1: + line.add(",SUM") + else: + var tmp = 0 + for n in split(line, ","): + tmp += parseInt(n) + line.add(",") + line.add($tmp) + + outf.writeLn($line) + + inc lineNumber diff --git a/Task/CSV-data-manipulation/Sidef/csv-data-manipulation-1.sidef b/Task/CSV-data-manipulation/Sidef/csv-data-manipulation-1.sidef new file mode 100644 index 0000000000..9956636bef --- /dev/null +++ b/Task/CSV-data-manipulation/Sidef/csv-data-manipulation-1.sidef @@ -0,0 +1,12 @@ +# Read +var csvfile = %f'data.csv'; +var fh = csvfile.open_r; +var header = fh.line.trim_end.split(','); +var csv = fh.lines.map { .trim_end.split(',').map{.to_num} }; +fh.close; + +# Write +var out = csvfile.open_w; +out.say([header..., 'SUM'].join(',')); +csv.each { |row| out.say([row..., row.sum].join(',')) }; +out.close; diff --git a/Task/CSV-data-manipulation/Sidef/csv-data-manipulation-2.sidef b/Task/CSV-data-manipulation/Sidef/csv-data-manipulation-2.sidef new file mode 100644 index 0000000000..0b321bd251 --- /dev/null +++ b/Task/CSV-data-manipulation/Sidef/csv-data-manipulation-2.sidef @@ -0,0 +1,24 @@ +var csv = require('Text::CSV').new( + Hash(eol => "\n") +); + +# Open +var csvfile = %f'data.csv'; +var fh = csvfile.open_r; + +# Read +var rows = []; +var header = csv.getline(fh); +while (var row = csv.getline(fh)) { + rows.append(row.map{.to_num}); +} + +# Process +header.append('SUM'); +rows.each { |row| row.append(row.sum) }; + +# Write +var out = csvfile.open_w; +[header, rows...].each { |row| + csv.print(out, row); +}; diff --git a/Task/CSV-data-manipulation/Ursa/csv-data-manipulation.ursa b/Task/CSV-data-manipulation/Ursa/csv-data-manipulation.ursa new file mode 100644 index 0000000000..a43f4b5c54 --- /dev/null +++ b/Task/CSV-data-manipulation/Ursa/csv-data-manipulation.ursa @@ -0,0 +1,42 @@ +# +# csv data manipulation +# + +# declare a string stream to hold lines +decl string<> lines + +# open the file specified on the command line, halting +# execution if they didn't enter one. it will be created if +# it doesn't exist yet +decl file f +if (< (size args) 2) + out "error: please specify a csv file" endl console + stop +end if +f.create args<1> +f.open args<1> + +# read in all lines from the file +set lines (f.readlines) + +# append sum column to header +set lines<0> (+ lines<0> ",SUM") + +# determine sums and append them +decl int i sum +for (set i 1) (< i (size lines)) (inc i) + set sum 0 + for (decl int j) (< j (size (split lines ","))) (inc j) + set sum (int (+ sum (int (split lines ",")))) + end for + set lines (+ lines (+ "," sum)) +end for + +# delete the file, then create it again +f.delete args<1> +f.create args<1> + +# output all lines to the file +for (set i 0) (< i (size lines)) (inc i) + out lines endl f +end for diff --git a/Task/CSV-data-manipulation/Visual-FoxPro/csv-data-manipulation.visual b/Task/CSV-data-manipulation/Visual-FoxPro/csv-data-manipulation.visual new file mode 100644 index 0000000000..f20a5d9e98 --- /dev/null +++ b/Task/CSV-data-manipulation/Visual-FoxPro/csv-data-manipulation.visual @@ -0,0 +1,11 @@ +CLOSE DATABASES ALL +SET SAFETY OFF +MODIFY FILE file1.csv NOEDIT +*!* Create a cursor with integer columns +CREATE CURSOR tmp1 (C1 I, C2 I, C3 I, C4 I, C5 I) +APPEND FROM file1.csv TYPE CSV +SELECT C1, C2, C3, C4, C5, C1+C2+C3+C4+C5 As sum ; +FROM tmp1 INTO CURSOR tmp2 +COPY TO file2.csv TYPE CSV +MODIFY FILE file2.csv NOEDIT IN SCREEN +SET SAFETY ON diff --git a/Task/CSV-data-manipulation/jq/csv-data-manipulation.jq b/Task/CSV-data-manipulation/jq/csv-data-manipulation.jq new file mode 100644 index 0000000000..b87fbf55ad --- /dev/null +++ b/Task/CSV-data-manipulation/jq/csv-data-manipulation.jq @@ -0,0 +1,15 @@ +# Omit empty lines +def read_csv: + split("\n") + | map(if length>0 then split(",") else empty end) ; + +# add_column(label) adds a summation column (with the given label) to +# the matrix representation of the CSV table, and assumes that all the +# entries in the body of the CSV file are, or can be converted to, +# numbers: +def add_column(label): + [.[0] + [label], + (reduce .[1:][] as $line + ([]; ($line|map(tonumber)) as $line | . + [$line + [$line|add]]))[] ] ; + +read_csv | add_column("SUM") | map(@csv)[] diff --git a/Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-1.echolisp b/Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-1.echolisp new file mode 100644 index 0000000000..a7a16c05df --- /dev/null +++ b/Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-1.echolisp @@ -0,0 +1,30 @@ +;; CSV -> LISTS +(define (csv->row line) (string-split line ",")) +(define (csv->table csv) (map csv->row (string-split csv "\n"))) + +;; LISTS->HTML +(define html 'html) +(define (emit-tag tag html-proc content ) + (if (style tag) + (push html (format "<%s style='%a'>" tag (style tag))) + (push html (format "<%s>" tag ))) + (html-proc content) + (push html (format " " tag ))) + +;; html procs : 1 tag, 1 proc +(define (h-raw content) + (push html (format "%s" content))) +(define (h-header headers) + (for ((h headers)) (emit-tag 'th h-raw h))) +(define (h-row row) + (for ((item row)) (emit-tag 'td h-raw item))) +(define (h-table table ) + (emit-tag 'tr h-header (first table)) + (for ((row (rest table))) (emit-tag 'tr h-row row))) + +(define (html-dump) (string-join (stack->list html) " ")) + +;; STYLES +(style 'td "text-align:left") +(style 'table "border-spacing: 10px;border:28px ridge orange") ;; special biblical border +(style 'th "color:blue;") diff --git a/Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-2.echolisp b/Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-2.echolisp new file mode 100644 index 0000000000..777daf9665 --- /dev/null +++ b/Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-2.echolisp @@ -0,0 +1,17 @@ +;; changed to to show that html tags inside text are correctly transmitted. +(define MontyPython #<< + Character,Speech + The multitude,The messiah! Show us the messiah! + Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away! + The multitude,Who are you? + Brians mother,I'm his mother; that's who! + The multitude,Behold his mother! Behold his mother! +>>#) + +(define (task speech) + (define table (csv->table speech)) + (stack html) + (emit-tag 'table h-table table) + (html-dump)) + +(task MontyPython) diff --git a/Task/CSV-to-HTML-translation/Nim/csv-to-html-translation.nim b/Task/CSV-to-HTML-translation/Nim/csv-to-html-translation.nim new file mode 100644 index 0000000000..10504cf702 --- /dev/null +++ b/Task/CSV-to-HTML-translation/Nim/csv-to-html-translation.nim @@ -0,0 +1,23 @@ +import cgi, strutils + +const csvtext = """Character,Speech +The multitude,The messiah! Show us the messiah! +Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away! +The multitude,Who are you? +Brians mother,I'm his mother; that's who! +The multitude,Behold his mother! Behold his mother!""" + +proc row2tr(row): string = + result = "" + let cols = xmlEncode(row).split(",") + for col in cols: + result.add ""&col&"" + result.add "" + +proc csv2html(txt): string = + result = "\n" + for row in txt.splitLines(): + result.add " "&row2tr(row)&"\n" + result.add "
" + +echo csv2html(csvtext) diff --git a/Task/CSV-to-HTML-translation/Phix/csv-to-html-translation-1.phix b/Task/CSV-to-HTML-translation/Phix/csv-to-html-translation-1.phix new file mode 100644 index 0000000000..6ab63d1683 --- /dev/null +++ b/Task/CSV-to-HTML-translation/Phix/csv-to-html-translation-1.phix @@ -0,0 +1,20 @@ +constant input = "Character,Speech\n" & + "The multitude,The messiah! Show us the messiah!\n" & + "Brians mother,Now you listen here! He's not the messiah; " & + "he's a very naughty boy! Now go away!\n" & + "The multitude,Who are you?\n" & + "Brians mother,I'm his mother; that's who!\n" & + "The multitude,Behold his mother! Behold his mother!" + +puts(1,"\n\n\n
") +for i = 1 to length(input) do + switch input[i] do + case '\n' then puts(1,"
") + case ',' then puts(1,"") + case '<' then puts(1,"<") + case '>' then puts(1,">") + case '&' then puts(1,"&") + case else puts(1,input[i]) + end switch +end for +puts(1,"
") diff --git a/Task/CSV-to-HTML-translation/Phix/csv-to-html-translation-2.phix b/Task/CSV-to-HTML-translation/Phix/csv-to-html-translation-2.phix new file mode 100644 index 0000000000..0964db10ff --- /dev/null +++ b/Task/CSV-to-HTML-translation/Phix/csv-to-html-translation-2.phix @@ -0,0 +1,8 @@ + + + + + + + +
CharacterSpeech
The multitudeThe messiah! Show us the messiah!
Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
The multitudeWho are you?
Brians motherI'm his mother; that's who!
The multitudeBehold his mother! Behold his mother!
diff --git a/Task/CSV-to-HTML-translation/Sidef/csv-to-html-translation-1.sidef b/Task/CSV-to-HTML-translation/Sidef/csv-to-html-translation-1.sidef new file mode 100644 index 0000000000..a591fd9ef7 --- /dev/null +++ b/Task/CSV-to-HTML-translation/Sidef/csv-to-html-translation-1.sidef @@ -0,0 +1,30 @@ +func escape(str) { str.trans(« & < > », « & < > ») } +func tag(t, d) { "<#{t}>#{d}" } + +func csv2html(str) { + + var template = <<'-EOT' + + + Some Text + + %s +
+ EOT + + template.sprintf(escape(str).lines.map{ |line| + tag('tr', line.split(',').map{|cell| tag('td', cell) }.join) + }.join("\n") + ) +} + +var str = <<'EOT'; +Character,Speech +The multitude,The messiah! Show us the messiah! +Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away! +The multitude,Who are you? +Brians mother,I'm his mother; that's who! +The multitude,Behold his mother! Behold his mother! +EOT + +print csv2html(str) diff --git a/Task/CSV-to-HTML-translation/Sidef/csv-to-html-translation-2.sidef b/Task/CSV-to-HTML-translation/Sidef/csv-to-html-translation-2.sidef new file mode 100644 index 0000000000..ac4dc68bd0 --- /dev/null +++ b/Task/CSV-to-HTML-translation/Sidef/csv-to-html-translation-2.sidef @@ -0,0 +1,11 @@ + + +Some Text + + + + + + + +
CharacterSpeech
The multitudeThe messiah! Show us the messiah!
Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
The multitudeWho are you?
Brians motherI'm his mother; that's who!
The multitudeBehold his mother! Behold his mother!
diff --git a/Task/CSV-to-HTML-translation/jq/csv-to-html-translation-1.jq b/Task/CSV-to-HTML-translation/jq/csv-to-html-translation-1.jq new file mode 100644 index 0000000000..25c90cf686 --- /dev/null +++ b/Task/CSV-to-HTML-translation/jq/csv-to-html-translation-1.jq @@ -0,0 +1 @@ +jq -R . csv2html.csv | jq -r -s -f csv2html.jq diff --git a/Task/CSV-to-HTML-translation/jq/csv-to-html-translation-2.jq b/Task/CSV-to-HTML-translation/jq/csv-to-html-translation-2.jq new file mode 100644 index 0000000000..3e740a9593 --- /dev/null +++ b/Task/CSV-to-HTML-translation/jq/csv-to-html-translation-2.jq @@ -0,0 +1,22 @@ +def headerrow2html: + [" "] + + (split(",") | map(" \(@html)")) + + [ " " ] +; + +def row2html: + [" "] + + (split(",") | map(" \(@html)")) + + [ " " ] +; + +def csv2html: + def rows: reduce .[] as $row + ([]; . + ($row | row2html)); + [""] + + (.[0] | headerrow2html) + + (.[1:] | rows) + + [ "
"] +; + +csv2html | .[] diff --git a/Task/CSV-to-HTML-translation/jq/csv-to-html-translation-3.jq b/Task/CSV-to-HTML-translation/jq/csv-to-html-translation-3.jq new file mode 100644 index 0000000000..1c2fc2040c --- /dev/null +++ b/Task/CSV-to-HTML-translation/jq/csv-to-html-translation-3.jq @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
CharacterSpeech
The multitudeThe messiah! Show us the messiah!
Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
The multitudeWho are you?
Brians motherI'm his mother; that's who!
The multitudeBehold his mother! Behold his mother!
diff --git a/Task/Caesar-cipher/ERRE/caesar-cipher.erre b/Task/Caesar-cipher/ERRE/caesar-cipher.erre new file mode 100644 index 0000000000..8a7c4b6184 --- /dev/null +++ b/Task/Caesar-cipher/ERRE/caesar-cipher.erre @@ -0,0 +1,29 @@ +PROGRAM CAESAR + +!$INCLUDE="PC.LIB" + +PROCEDURE CAESAR(TEXT$,KY%->CY$) + LOCAL I%,C% + FOR I%=1 TO LEN(TEXT$) DO + C%=ASC(MID$(TEXT$,I%)) + IF (C% AND $1F)>=1 AND (C% AND $1F)<=26 THEN + C%=(C% AND $E0) OR (((C% AND $1F)+KY%-1) MOD 26+1) + CHANGE(TEXT$,I%,CHR$(C%)->TEXT$) + END IF + END FOR + CY$=TEXT$ +END PROCEDURE + +BEGIN + RANDOMIZE(TIMER) + PLAINTEXT$="Pack my box with five dozen liquor jugs" + PRINT(PLAINTEXT$) + + KY%=1+INT(25*RND(1)) ! generates random between 1 and 25 + CAESAR(PLAINTEXT$,KY%->CYPHERTEXT$) + PRINT(CYPHERTEXT$) + + CAESAR(CYPHERTEXT$,26-KY%->DECYPHERED$) + PRINT(DECYPHERED$) + +END PROGRAM diff --git a/Task/Caesar-cipher/FreeBASIC/caesar-cipher.freebasic b/Task/Caesar-cipher/FreeBASIC/caesar-cipher.freebasic new file mode 100644 index 0000000000..2a84d19c00 --- /dev/null +++ b/Task/Caesar-cipher/FreeBASIC/caesar-cipher.freebasic @@ -0,0 +1,41 @@ +' FB 1.05.0 Win64 + +Sub Encrypt(s As String, key As Integer) + Dim c As Integer + For i As Integer = 0 To Len(s) + Select Case As Const s[i] + Case 65 To 90 + c = s[i] + key + If c > 90 Then c -= 26 + s[i] = c + Case 97 To 122 + c = s[i] + key + If c > 122 Then c -= 26 + s[i] = c + End Select + Next +End Sub + +Sub Decrypt(s As String, key As Integer) + Dim c As Integer + For i As Integer = 0 To Len(s) + Select Case As Const s[i] + Case 65 To 90 + c = s[i] - key + If c < 65 Then c += 26 + s[i] = c + Case 97 To 122 + c = s[i] - key + If c < 97 Then c += 26 + s[i] = c + End Select + Next +End Sub + +Dim As String s = "Bright vixens jump; dozy fowl quack." +Print "Plain text : "; s +Encrypt s, 8 +Print "Encrypted : "; s +Decrypt s, 8 +Print "Decrypted : "; s +Sleep diff --git a/Task/Caesar-cipher/GFA-Basic/caesar-cipher.gfa b/Task/Caesar-cipher/GFA-Basic/caesar-cipher.gfa new file mode 100644 index 0000000000..e2b61ed01b --- /dev/null +++ b/Task/Caesar-cipher/GFA-Basic/caesar-cipher.gfa @@ -0,0 +1,36 @@ +' +' Caesar cypher +' +OPENW 1 ! Creates a window for handling input/output +CLEARW 1 +INPUT "string to encrypt ";text$ +INPUT "encryption key ";key% +encrypted$=@encrypt$(UPPER$(text$),key%) +PRINT "Encrypted: ";encrypted$ +PRINT "Decrypted: ";@decrypt$(encrypted$,key%) +' +PRINT "(Press any key to end program.)" +~INP(2) +CLOSEW 1 +' +FUNCTION encrypt$(text$,key%) + LOCAL result$,i%,c% + result$="" + FOR i%=1 TO LEN(text$) + c%=ASC(MID$(text$,i%)) + IF c%ASC("Z") ! don't encrypt non A-Z + result$=result$+CHR$(c%) + ELSE + c%=c%+key% + IF c%>ASC("Z") + c%=c%-26 + ENDIF + result$=result$+CHR$(c%) + ENDIF + NEXT i% + RETURN result$ +ENDFUNC +' +FUNCTION decrypt$(text$,key%) + RETURN @encrypt$(text$,26-key%) +ENDFUNC diff --git a/Task/Caesar-cipher/LiveCode/caesar-cipher.livecode b/Task/Caesar-cipher/LiveCode/caesar-cipher.livecode new file mode 100644 index 0000000000..beb1e58b2b --- /dev/null +++ b/Task/Caesar-cipher/LiveCode/caesar-cipher.livecode @@ -0,0 +1,16 @@ +function caesarCipher rot phrase + local rotPhrase, lowerLetters, upperLetters + put "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" into lowerLetters + put "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" into upperLetters + repeat for each char letter in phrase + get charTonum(letter) + if it >= 65 and it <= 90 then + put char ((it + rot) - 64) of upperLetters after rotPhrase + else if it >= 97 and it <= 122 then + put char ((it + rot) - 96) of lowerLetters after rotPhrase + else + put letter after rotPhrase + end if + end repeat + return rotPhrase +end caesarCipher diff --git a/Task/Caesar-cipher/Nim/caesar-cipher.nim b/Task/Caesar-cipher/Nim/caesar-cipher.nim new file mode 100644 index 0000000000..981e1ad518 --- /dev/null +++ b/Task/Caesar-cipher/Nim/caesar-cipher.nim @@ -0,0 +1,14 @@ +import strutils + +proc caesar(s: string, k: int, decode = false): string = + var k = if decode: 26 - k else: k + result = "" + for i in toUpper(s): + if ord(i) >= 65 and ord(i) <= 90: + result.add(chr((ord(i) - 65 + k) mod 26 + 65)) + +let msg = "The quick brown fox jumped over the lazy dogs" +echo msg +let enc = caesar(msg, 11) +echo enc +echo caesar(enc, 11, decode = true) diff --git a/Task/Caesar-cipher/Oforth/caesar-cipher.oforth b/Task/Caesar-cipher/Oforth/caesar-cipher.oforth new file mode 100644 index 0000000000..1aef744942 --- /dev/null +++ b/Task/Caesar-cipher/Oforth/caesar-cipher.oforth @@ -0,0 +1,6 @@ +: ceasar(c, key) + c dup isLetter ifFalse: [ return ] + isUpper ifTrue: [ 'A' ] else: [ 'a' ] c key + over - 26 mod + ; + +: cipherE(s, key) s map(#[ key ceasar ]) charsAsString ; +: cipherD(s, key) cipherE(s, 26 key - ) ; diff --git a/Task/Caesar-cipher/Phix/caesar-cipher.phix b/Task/Caesar-cipher/Phix/caesar-cipher.phix new file mode 100644 index 0000000000..3ebce5329e --- /dev/null +++ b/Task/Caesar-cipher/Phix/caesar-cipher.phix @@ -0,0 +1,19 @@ +sequence alpha_b = repeat(0,255) + alpha_b['A'..'Z'] = 'A' + alpha_b['a'..'z'] = 'a' + +function caesar(string s, integer key) +integer ch, base + for i=1 to length(s) do + ch = s[i] + base = alpha_b[ch] + if base then + s[i] = base+remainder(ch-base+key,26) + end if + end for + return s +end function +string s = "One fine day in the middle of the night, two dead men got up to fight. \n"& + "Back to back they faced each other, drew their swords and shot each other. %^&*()[", + e = caesar(s,5), + r = caesar(e,26-5) ?e ?r diff --git a/Task/Caesar-cipher/SSEM/caesar-cipher.ssem b/Task/Caesar-cipher/SSEM/caesar-cipher.ssem new file mode 100644 index 0000000000..0daec42427 --- /dev/null +++ b/Task/Caesar-cipher/SSEM/caesar-cipher.ssem @@ -0,0 +1,19 @@ +00101000000000100000000000000000 0. -20 to c +11001000000000010000000000000000 1. Sub. 19 +10101000000001100000000000000000 2. c to 21 +10101000000000100000000000000000 3. -21 to c +00000000000000110000000000000000 4. Test +10001000000000000000000000000000 5. 17 to CI +10101000000001100000000000000000 6. c to 21 +10101000000000100000000000000000 7. -21 to c +01001000000000010000000000000000 8. Sub. 18 +10101000000001100000000000000000 9. c to 21 +10101000000000100000000000000000 10. -21 to c +00000000000001110000000000000000 11. Stop +01001000000000010000000000000000 12. Sub. 18 +00000000000000110000000000000000 13. Test +00000000000001110000000000000000 14. Stop +10101000000000100000000000000000 15. -21 to c +00000000000001110000000000000000 16. Stop +11010000000000000000000000000000 17. 11 +01011000000000000000000000000000 18. 26 diff --git a/Task/Caesar-cipher/SequenceL/caesar-cipher.sequencel b/Task/Caesar-cipher/SequenceL/caesar-cipher.sequencel new file mode 100644 index 0000000000..3e23c88d8f --- /dev/null +++ b/Task/Caesar-cipher/SequenceL/caesar-cipher.sequencel @@ -0,0 +1,32 @@ +import ; +import ; + +lowerAlphabet := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +upperAlphabet := "abcdefghijklmnopqrstuvwxyz"; + +caesarEncrypt(ch, key) := + let + correctAlphabet := + lowerAlphabet when some(ch = lowerAlphabet) + else + upperAlphabet; + + index := Sequence::firstIndexOf(correctAlphabet, ch); + + newIndex := (index + key - 1) mod 26 + 1; + in + ch when not(some(ch = lowerAlphabet) or some(ch = upperAlphabet)) + else + correctAlphabet[newIndex]; + +caesarDecrypt(ch, key) := caesarEncrypt(ch, 26 - key); + +main(args(2)) := + let + key := Conversion::stringToInt(args[2]); + encrypted := caesarEncrypt(args[1], key); + decrypted := caesarDecrypt(encrypted, key); + in + "Input: \t" ++ args[1] ++ "\n" ++ + "Encrypted:\t" ++ encrypted ++ "\n" ++ + "Decrypted:\t" ++ decrypted; diff --git a/Task/Caesar-cipher/Sidef/caesar-cipher.sidef b/Task/Caesar-cipher/Sidef/caesar-cipher.sidef new file mode 100644 index 0000000000..91a62b3dc1 --- /dev/null +++ b/Task/Caesar-cipher/Sidef/caesar-cipher.sidef @@ -0,0 +1,13 @@ +func caesar(msg, key, decode=false) { + decode && (key = (26 - key)); + msg.gsub(/([A-Z])/i, {|c| ((c.uc.ord - 65 + key) % 26) + 65 -> chr}); +}; + +var msg = 'THE FIVE BOXING WIZARDS JUMP QUICKLY'; + +var enc = caesar(msg, 10); +var dec = caesar(enc, 10, true); + +say "msg: #{msg}"; +say "enc: #{enc}"; +say "dec: #{dec}"; diff --git a/Task/Caesar-cipher/TypeScript/caesar-cipher.type b/Task/Caesar-cipher/TypeScript/caesar-cipher.type new file mode 100644 index 0000000000..2721324997 --- /dev/null +++ b/Task/Caesar-cipher/TypeScript/caesar-cipher.type @@ -0,0 +1,14 @@ +function replace(input: string, key: number) : string { + return input.replace(/([a-z])/g, + ($1) => String.fromCharCode(($1.charCodeAt(0) + key + 26 - 97) % 26 + 97) + ).replace(/([A-Z])/g, + ($1) => String.fromCharCode(($1.charCodeAt(0) + key + 26 - 65) % 26 + 65)); +} + +// test +var str = 'The five boxing wizards jump quickly'; +var encoded = replace(str, 3); +var decoded = replace(encoded, -3); + +console.log('Enciphered: ' + encoded); +console.log('Deciphered: ' + decoded); diff --git a/Task/Caesar-cipher/Ursa/caesar-cipher.ursa b/Task/Caesar-cipher/Ursa/caesar-cipher.ursa new file mode 100644 index 0000000000..0039e259da --- /dev/null +++ b/Task/Caesar-cipher/Ursa/caesar-cipher.ursa @@ -0,0 +1,28 @@ +decl string mode +while (not (or (= mode "encode") (= mode "decode"))) + out "encode/decode: " console + set mode (lower (in string console)) +end while + +decl string message +out "message: " console +set message (upper (in string console)) + +decl int key +out "key: " console +set key (in int console) +if (or (> key 26) (< key 0)) + out endl "invalid key" endl console + stop +end if + +if (= mode "decode") + set key (int (- 26 key)) +end if + +for (decl int i) (< i (size message)) (inc i) + if (and (> (ord message) 64) (< (ord message) 91)) + out (chr (int (+ (mod (int (+ (- (ord message) 65) key)) 26) 65))) console + end if +end for +out endl console diff --git a/Task/Caesar-cipher/Wortel/caesar-cipher.wortel b/Task/Caesar-cipher/Wortel/caesar-cipher.wortel new file mode 100644 index 0000000000..745df1d0ce --- /dev/null +++ b/Task/Caesar-cipher/Wortel/caesar-cipher.wortel @@ -0,0 +1,18 @@ +@let { + ; this function only replaces letters and keeps case + ceasar &[s n] !!s.replace &"[a-z]"gi &[x] [ + @vars { + t x.charCodeAt. + l ?{ + && > t 96 < t 123 97 + && > t 64 < t 91 65 + 0 + } + } + !String.fromCharCode ?{ + l +l ~% 26 -+ n t l + t + } + ] + !!ceasar "abc $%^ ABC" 10 +} diff --git a/Task/Caesar-cipher/XLISP/caesar-cipher-1.xlisp b/Task/Caesar-cipher/XLISP/caesar-cipher-1.xlisp new file mode 100644 index 0000000000..02f34734c6 --- /dev/null +++ b/Task/Caesar-cipher/XLISP/caesar-cipher-1.xlisp @@ -0,0 +1,16 @@ +(defun caesar-encode (text key) + (defun encode (ascii-code) + (defun rotate (character alphabet) + (define code (+ character key)) + (cond + ((> code (+ alphabet 25)) (- code 26)) + ((< code alphabet) (+ code 26)) + (t code))) + (cond + ((and (>= ascii-code 65) (<= ascii-code 90)) (rotate ascii-code 65)) + ((and (>= ascii-code 97) (<= ascii-code 122)) (rotate ascii-code 97)) + (t ascii-code))) + (list->string (mapcar integer->char (mapcar encode (mapcar char->integer (string->list text)))))) + +(defun caesar-decode (text key) + (caesar-encode text (- 26 key))) diff --git a/Task/Caesar-cipher/XLISP/caesar-cipher-2.xlisp b/Task/Caesar-cipher/XLISP/caesar-cipher-2.xlisp new file mode 100644 index 0000000000..7fd3af68d1 --- /dev/null +++ b/Task/Caesar-cipher/XLISP/caesar-cipher-2.xlisp @@ -0,0 +1,9 @@ +[1] (define caesar-test (caesar-encode "CAESAR: Who is it in the press that calls on me? I hear a tongue, shriller than all the music, Cry 'Caesar!' Speak; Caesar is turn'd to hear." 14)) + +CAESAR-TEST +[2] caesar-test + +"QOSGOF: Kvc wg wh wb hvs dfsgg hvoh qozzg cb as? W vsof o hcbuis, gvfwzzsf hvob ozz hvs aigwq, Qfm 'Qosgof!' Gdsoy; Qosgof wg hifb'r hc vsof." +[3] (caesar-decode caesar-test 14) + +"CAESAR: Who is it in the press that calls on me? I hear a tongue, shriller than all the music, Cry 'Caesar!' Speak; Caesar is turn'd to hear." diff --git a/Task/Calendar---for-REAL-programmers/FreeBASIC/calendar---for-real-programmers.freebasic b/Task/Calendar---for-REAL-programmers/FreeBASIC/calendar---for-real-programmers.freebasic new file mode 100644 index 0000000000..c3274505cf --- /dev/null +++ b/Task/Calendar---for-REAL-programmers/FreeBASIC/calendar---for-real-programmers.freebasic @@ -0,0 +1,97 @@ +' VERSION 16-03-2016 +' COMPILE WITH: FBC -S CONSOLE + +' TRUE/FALSE ARE BUILT-IN CONSTANTS SINCE FREEBASIC 1.04 +' BUT WE HAVE TO DEFINE THEM FOR OLDER VERSIONS. +#IFNDEF TRUE + #DEFINE FALSE 0 + #DEFINE TRUE NOT FALSE +#ENDIF + +FUNCTION WD(M AS INTEGER, D AS INTEGER, Y AS INTEGER) AS INTEGER + ' ZELLERISH + ' 0 = SUNDAY, 1 = MONDAY, 2 = TUESDAY, 3 = WEDNESDAY + ' 4 = THURSDAY, 5 = FRIDAY, 6 = SATURDAY + + IF M < 3 THEN ' IF M = 1 OR M = 2 THEN + M += 12 + Y -= 1 + END IF + RETURN (Y + (Y \ 4) - (Y \ 100) + (Y \ 400) + D + ((153 * M + 8) \ 5)) MOD 7 +END FUNCTION + +FUNCTION LEAPYEAR(Y AS INTEGER) AS INTEGER + + IF (Y MOD 4) <> 0 THEN RETURN FALSE + IF (Y MOD 100) = 0 ANDALSO (Y MOD 400) <> 0 THEN RETURN FALSE + RETURN TRUE +END FUNCTION + +' ------=< MAIN >=------ +' HARD CODED FOR 132 CHARACTERS PER LINE + +DIM AS STRING WDN = "MO TU WE TH FR SA SU" ' WEEKDAY NAMES +DIM AS STRING MO(1 TO 12) => {"JANUARY", "FEBRUARY", "MARCH", "APRIL", _ + "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", _ + "OCTOBER", "NOVEMBER", "DECEMBER"} +DIM AS STRING TMP1, TMP2, D(1 TO 12) + +DIM AS UINTEGER ML(1 TO 12) => {31,28,31,30,31,30,31,31,30,31,30,31} +DIM AS UINTEGER I, I1, J, K, Y = 1969 + +'SCREENRES 1080,600,8 + +IF LEAPYEAR(Y) = TRUE THEN ML(2) = 29 + +TMP1 = "" +FOR I = 1 TO 31 + TMP1 = TMP1 + RIGHT((" " + STR(I)), 3) +NEXT I + + +FOR I = 1 TO 12 + TMP2 = "" + J = WD(I,1, Y) + IF J = 0 THEN J = 7 + J = J - 1 + TMP2 = SPACE(J * 3) + LEFT(TMP1, ML(I) * 3) + SPACE(21) + D(I) = TMP2 +NEXT I + +PRINT +TMP1 = "INSERT YOUR SNOOPY PICTURE HERE" +PRINT SPACE((132 - LEN(TMP1)) \ 2); TMP1 +PRINT +TMP1 = STR(Y) +PRINT SPACE((132 - LEN(TMP1)) \ 2); TMP1 +PRINT + +' 6 MONTH ON A ROW +TMP2 = " " +FOR I = 1 TO 6 + TMP2 = TMP2 + WDN + IF I < 6 THEN TMP2 = TMP2 + " " +NEXT I + +FOR I = 1 TO 12 STEP 6 + TMP1 = "" + FOR J = I TO I + 4 + TMP1 = TMP1 + LEFT(SPACE((22 - LEN(MO(J))) \ 2) + MO(J) + SPACE(11), 22) + NEXT J + TMP1 = TMP1 + SPACE((22 - LEN(MO(I + 5))) \ 2) + MO(I + 5) + PRINT TMP1 + PRINT TMP2 + FOR J = 1 TO 85 STEP 21 + FOR K = I TO I + 4 + PRINT MID(D(K), J ,21); " "; + NEXT K + PRINT MID(D(I + 5), J ,21) + NEXT J + PRINT +NEXT I + +' EMPTY KEYBOARD BUFFER +WHILE INKEY <> "" : WEND +PRINT : PRINT "HIT ANY KEY TO END PROGRAM" +SLEEP +END diff --git a/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-1.phix b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-1.phix new file mode 100644 index 0000000000..da67b56dcb --- /dev/null +++ b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-1.phix @@ -0,0 +1 @@ +return repeat(' ',left)&s&repeat(' ',right) diff --git a/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-2.phix b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-2.phix new file mode 100644 index 0000000000..295c0ec9b1 --- /dev/null +++ b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-2.phix @@ -0,0 +1 @@ +return repeat(' ',left)&upper(s)&repeat(' ',right) diff --git a/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-3.phix b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-3.phix new file mode 100644 index 0000000000..eceb689391 --- /dev/null +++ b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-3.phix @@ -0,0 +1 @@ +initialSymEntry("integer", S_Type,"TI",opInt, E_none) -- #01 / 0b0001 integer diff --git a/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-4.phix b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-4.phix new file mode 100644 index 0000000000..ded00ddce7 --- /dev/null +++ b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-4.phix @@ -0,0 +1 @@ +Alias("INTEGER",symlimit) diff --git a/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-5.phix b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-5.phix new file mode 100644 index 0000000000..0ccfe7de01 --- /dev/null +++ b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-5.phix @@ -0,0 +1,4 @@ +procedure tt_stringA(sequence text, integer alias) + tt_string(text,-2) + tt[pcurr] = alias +end procedure diff --git a/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-6.phix b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-6.phix new file mode 100644 index 0000000000..dfa2785c51 --- /dev/null +++ b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-6.phix @@ -0,0 +1 @@ +global constant T_include = 596 tt_stringF("include",T_include) diff --git a/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-7.phix b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-7.phix new file mode 100644 index 0000000000..094c74dc41 --- /dev/null +++ b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-7.phix @@ -0,0 +1 @@ +tt_stringA("INCLUDE",T_include) diff --git a/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-8.phix b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-8.phix new file mode 100644 index 0000000000..0f05908769 --- /dev/null +++ b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-8.phix @@ -0,0 +1 @@ +Ch = find(Ch,escchar) diff --git a/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-9.phix b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-9.phix new file mode 100644 index 0000000000..144f9bf053 --- /dev/null +++ b/Task/Calendar---for-REAL-programmers/Phix/calendar---for-real-programmers-9.phix @@ -0,0 +1 @@ +Ch = find(lower(Ch),escchar) diff --git a/Task/Calendar---for-REAL-programmers/Sidef/calendar---for-real-programmers.sidef b/Task/Calendar---for-REAL-programmers/Sidef/calendar---for-real-programmers.sidef new file mode 100644 index 0000000000..b2dbb5ef12 --- /dev/null +++ b/Task/Calendar---for-REAL-programmers/Sidef/calendar---for-real-programmers.sidef @@ -0,0 +1,59 @@ +-> DT { ('DATE'.("\LWC") + 'TIME'.("\LWC")).("\LREQUIRE") } + +-> MONTHS_PER_COL { 6 } +-> WEEK_DAY_NAMES { } +-> MONTH_NAMES { } + +-> FMT_MONTH (YEAR, MONTH, STR="", WEEK_DAY=0) { + STR = "%11\LS\E%9\LS\E\12".("\LSPRINTF")(MONTH_NAMES()[MONTH-1],'') + STR += (WEEK_DAY_NAMES().("\LJOIN")(' ') + "\12") + + -> DATE { DT().("\LNEW")("\LYEAR" => YEAR, "\LMONTH" => MONTH) } + + WEEK_DAY = DATE().("\LDAY_OF_WEEK") + STR += ([" "] * WEEK_DAY-1 -> ("\LJOIN")(" ")) + + -> LAST_DAY { + DT().("\LLAST_DAY_OF_MONTH")( + "\LYEAR" => YEAR, "\LMONTH" => MONTH + ).("\LDAY") + } + + (DATE().("\LDAY") .. LAST_DAY()).("\LEACH")({ |DAY| + (WEEK_DAY ~~ (2..7)) && (STR += " ") + + (WEEK_DAY == 8) && ( + STR += "\12" + WEEK_DAY = 1 + ) + STR += ("%2\LD" % DAY) + ++WEEK_DAY + }) + (WEEK_DAY < 8) && (STR += " ") + STR += ([" "] * 8-WEEK_DAY -> ("\LJOIN")(" ")) + STR += "\12" +} + +-> FMT_YEAR (YEAR, STR="", MONTH_STRS=[]) { + MONTH_STRS = 12.("\LOF")({|I| FMT_MONTH(YEAR, I).("\LLINES") }) + + STR += (' '*(MONTHS_PER_COL()*10 + 2) + YEAR + "\12") + (0..11 -> ("\LBY")(MONTHS_PER_COL())).("\LEACH")({ |MONTH| + MONTH_STRS[MONTH] && ->() { + { |I| + MONTH_STRS[MONTH + I - 1] && ( + STR += MONTH_STRS[MONTH + I - 1].("\LSHIFT") + STR += ' '*2 + ) + } * MONTHS_PER_COL() + + STR += "\12" + MONTH_STRS[MONTH] && __FUNC__() + }() + STR += "\12" + }) + + STR +} + +FMT_YEAR(ARGV ? ARGV[0].("\LTO_I") : 1969).("\LPRINT") diff --git a/Task/Calendar---for-REAL-programmers/XLISP/calendar---for-real-programmers.xlisp b/Task/Calendar---for-REAL-programmers/XLISP/calendar---for-real-programmers.xlisp new file mode 100644 index 0000000000..9e9c64da31 --- /dev/null +++ b/Task/Calendar---for-REAL-programmers/XLISP/calendar---for-real-programmers.xlisp @@ -0,0 +1,36 @@ +(SETQ YR 1969) +(SETQ M #("JANUARY" "FEBRUARY" "MARCH" "APRIL" "MAY" "JUNE" "JULY" "AUGUST" "SEPTEMBER" "OCTOBER" "NOVEMBER" "DECEMBER")) +(SETQ ML #(31 28 31 30 31 30 31 31 30 31 30 31)) +(SETQ WD #("SU" "MO" "TU" "WE" "TH" "FR" "SA")) +(IF (AND (= (REM YR 4) 0) (OR (/= (REM YR 100) 0) (= (REM YR 400) 0))) (VECTOR-SET! ML 1 29)) +(SETQ D (REM (+ 1 (+ (* 5 (REM (- YR 1) 4)) (* 4 (REM (- YR 1) 100)) (* 6 (REM (- YR 1) 400)))) 7)) +(TERPRI) +(DO ((I 0 (+ I 1))) ((> I 60)) +(PRINC " ")) +(PRINC "SNOOPY CALENDAR ") +(PRINC YR) +(TERPRI) +(DO ((I 0 (+ I 1))) ((> I 11)) +(TERPRI) +(DO ((J 0 (+ J 1))) ((> J 65)) +(PRINC " ")) +(PRINC (VECTOR-REF M I)) +(TERPRI) +(PRINC " ") +(DO ((J 0 (+ J 1))) ((> J 6)) +(DO ((K 0 (+ K 1))) ((> K 14)) +(PRINC " ")) +(PRINC (VECTOR-REF WD J)) +(PRINC " ")) +(TERPRI) +(DO ((J 0 (+ J 1))) ((> J 6)) +(IF (< J D) (DO ((K 0 (+ K 1))) ((> K 18)) (PRINC " ")))) +(DO ((J 1 (+ J 1))) ((> J (VECTOR-REF ML I))) +(PRINC " ") +(IF (< J 10) (PRINC " ")) +(DO ((K 0 (+ K 1))) ((> K 14)) +(PRINC " ")) +(PRINC J) +(SETQ D (+ D 1)) +(IF (> D 6) (TERPRI)) +(IF (> D 6) (SETQ D 0)))) diff --git a/Task/Calendar/FreeBASIC/calendar.freebasic b/Task/Calendar/FreeBASIC/calendar.freebasic new file mode 100644 index 0000000000..53fd7963d0 --- /dev/null +++ b/Task/Calendar/FreeBASIC/calendar.freebasic @@ -0,0 +1,125 @@ +' version 17-02-2016 +' compile with: fbc -s console + +' TRUE/FALSE are built-in constants since FreeBASIC 1.04 +' For older versions they have to be defined. +#Ifndef TRUE + #Define FALSE 0 + #Define TRUE Not FALSE +#EndIf + +Function WD(m As Integer, d As Integer, y As Integer) As Integer + ' Zellerish + ' 0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday + ' 4 = Thursday, 5 = Friday, 6 = Saturday + + If m < 3 Then ' if m = 1 or m = 2 then + m += 12 + y -= 1 + End If + Return (y + (y \ 4) - (y \ 100) + (y \ 400) + d + ((153 * m + 8) \ 5)) Mod 7 +End Function + +Function LEAPYEAR(y As Integer) As Integer + If (y Mod 4) <> 0 Then Return FALSE + If (y Mod 100) = 0 AndAlso (y Mod 400) <> 0 Then Return FALSE + Return TRUE +End Function + +' ------=< main >=------ + +Dim As String wdn = "Mo Tu We Th Fr Sa Su" ' weekday names +Dim As String mo(1 To 12) => {"January", "February", "March", "April", _ + "May", "June", "July", "August", "September", _ + "October", "November", "December"} +Dim As String tmp1, tmp2, d(1 To 12) + +Dim As UInteger ml(1 To 12) => {31,28,31,30,31,30,31,31,30,31,30,31} +Dim As UInteger i, i1, j, k, y = 1969 +Dim As UInteger m_row = 6 + +Do + While InKey <> "" : Wend ' clear keyboard buffer + Print : Print " For wich year do want a calendar" + Print " Year must be greater then 1752" + Input " Input year (enter = 1969)";tmp1 + If tmp1 = "" Then Exit Do + i = Val(tmp1) + If i < 1752 Then + Print + Print " Can only make a calendar for a year after 1752" + Beep : Sleep 5000, 1 : Print + Else + y = i : Exit Do + End If +Loop + +Cls +Do + While InKey <> "" : Wend ' clear keyboard buffer + Print : Print " Make device choice" + Print " 132 characters Line printer, 6x2 months (Enter or 1)" + Print " 80x43 display, 3x4 months (2)" + Do + tmp1 = InKey + If tmp1 = Chr(13) Or tmp1 = "1" Then Exit Do, Do + If tmp1 = "2" Then + m_row = 3 + Exit Do, Do + End If + Loop Until tmp1 <> "" + Print : Print " Enter, 1 or 2 only" + Beep : Sleep 5000, 1 : Print +Loop +Cls + +Dim As UInteger char_line = m_row * 22 - 1 +If LEAPYEAR(y) = TRUE Then ml(2) = 29 + +tmp1 = "" +For i = 1 To 31 + tmp1 = tmp1 + Right((" " + Str(i)), 3) +Next + +For i = 1 To 12 + tmp2 = "" + j = WD(i,1, y) + If j = 0 Then j = 7 + j = j - 1 + tmp2 = Space(j * 3) + Left(tmp1, ml(i) * 3) + Space(21) + d(i) = tmp2 +Next + +Print +tmp1 = Str(y) +Print Space((char_line + (char_line And 1) - Len(tmp1)) \ 2); tmp1 +Print + +tmp2 = " " ' make the weekday names line +For i = 1 To m_row + tmp2 = tmp2 + wdn + If i < m_row Then tmp2 = tmp2 + " " +Next + +For i = 1 To 12 Step m_row + tmp1 = "" + For j = i To i + m_row -2 ' make the month names line + tmp1 = tmp1 + Left(Space((22 - Len(mo(j))) \ 2) + mo(j) + Space(21), 22) + Next + tmp1 = tmp1 + Space((22 - Len(mo(i + m_row -1))) \ 2) + mo(i + m_row -1) + Print tmp1 + Print tmp2 + For j = 1 To 85 Step 21 + For k = i To i + m_row -2 + Print Mid(d(k), j ,21); " "; + Next + Print Mid(d(i + m_row -1), j ,21) + Next + Print +Next + +' empty keyboard buffer +While InKey <> "" : Wend +'Print : Print "hit any key to end program +Sleep +End diff --git a/Task/Calendar/FutureBasic/calendar.futurebasic b/Task/Calendar/FutureBasic/calendar.futurebasic new file mode 100644 index 0000000000..d5160a7925 --- /dev/null +++ b/Task/Calendar/FutureBasic/calendar.futurebasic @@ -0,0 +1,10 @@ +include "ConsoleWindow" + +dim as Str255 a + +open "UNIX", 1,"cal 1969" + do + line input #1, a + print a + until eof(1) +close 1 diff --git a/Task/Calendar/Lingo/calendar-1.lingo b/Task/Calendar/Lingo/calendar-1.lingo new file mode 100644 index 0000000000..05158158ac --- /dev/null +++ b/Task/Calendar/Lingo/calendar-1.lingo @@ -0,0 +1,57 @@ +---------------------------------------- +-- @desc Class "Calendar" +-- @file parent script "Calendar" +---------------------------------------- +property _months +property _weekdayStr +property _refDateObj +property _year +property _calStr + +on new (me) + me._months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] + me._weekdayStr = "Mo Tu We Th Fr Sa Su" + me._refDateObj = date(1905,1,2) + return me +end + +on make (me, year) + me._year = year + me._calStr = "" + -- prefill cal string with spaces + emptyLine = bytearray(68,32).readRawString(68)&RETURN + repeat with i = 1 to 38 + put emptyLine after _calStr + end repeat + me._write (string(year), 32, 1) + repeat with i = 1 to 12 + me._writeMonth(i) + end repeat + return me._calStr +end + +on _writeMonth (me, monthNum) + xOffset = (monthNum-1) mod 3 * 24 + yOffset = (monthNum-1)/3 * 9 + 2 + pre = (20 - me._months[monthNum].length)/2 + me._write(me._months[monthNum], 1+xOffset+pre, 1+yOffset) + me._write(me._weekdayStr, 1+xOffset, 2+yOffset) + y = 3 + x = ((date(me._year, monthNum, 1) - me._refDateObj) mod 7)+1 + repeat with i = 1 to 31 + if date(me._year, monthNum, i).month<>monthNum then exit repeat + dayStr = string(i) + if i<10 then put " " before dayStr + me._write(dayStr, x*3-2+xOffset, y+yOffset) + if x=7 then + y = y+1 + x = 1 + else + x = x+1 + end if + end repeat +end + +on _write (me, str, x, y) + put str into char x to x+str.length-1 of line y of _calStr +end diff --git a/Task/Calendar/Lingo/calendar-2.lingo b/Task/Calendar/Lingo/calendar-2.lingo new file mode 100644 index 0000000000..68983c6c33 --- /dev/null +++ b/Task/Calendar/Lingo/calendar-2.lingo @@ -0,0 +1,3 @@ +calObj = script("Calendar").new() +calStr = calObj.make(1969) +put calStr diff --git a/Task/Calendar/Phix/calendar.phix b/Task/Calendar/Phix/calendar.phix new file mode 100644 index 0000000000..85eb2e4b72 --- /dev/null +++ b/Task/Calendar/Phix/calendar.phix @@ -0,0 +1,66 @@ +include builtins\timedate.e + +function centre(string s, integer width) +integer pad = width-length(s), + left = floor(pad/2), + right = pad-left + return repeat(' ',left)&s&repeat(' ',right) +end function + +function one_month(integer year, integer month) +integer dow = day_of_week(year,month,1) +sequence ldm = adjust_timedate(iff(month=12?{year+1,1,1,0,0,0,0,0} + :{year,month+1,1,0,0,0,0,0}), + timedelta(days:=-1)) +sequence res = {centre(format_timedate(ldm,"Mmmm"),20),"Su Mo Tu We Th Fr Sa"} +integer lastday = ldm[DT_DAY] +string line = repeat(' ',20) +integer p = dow*3-2 + for d=1 to lastday do + line[p..p+1] = sprintf("%2d",d) + p += 3 + if dow=7 or d=lastday then + res = append(res,line) + line = repeat(' ',20) + dow = 1 + p = 1 + else + dow += 1 + end if + end for + return res +end function + +procedure print_calendar(integer year, integer width) +sequence months = repeat(0,12) +integer wide = floor((width+2)/22) + printf(1,centre("[Spot Reserved For Snoopy]",width)&"\n") + printf(1,centre(sprintf("%d",year),width)&"\n") + for month=1 to 12 do + months[month] = one_month(year,month) + end for + for month=1 to 12 by wide do + for k=1 to 9 do -- (more than enough) + integer any = 0 + string line = "", this + for j=0 to wide-1 do + if length(line) then + line &= " " + end if + if k>length(months[month+j]) then + line &= repeat(' ',20) + else + line &= months[month+j][k] + any = 1 + end if + end for + if any=0 then exit end if + printf(1,centre(line,width)&"\n") + end for + end for +end procedure + +print_calendar(1969,80) +printf(1,join(repeat("1234567890",8),"")&"\n") +print_calendar(1969,132) +printf(1,join(repeat("1234567890",13),"")&"12\n") diff --git a/Task/Calendar/Sidef/calendar.sidef b/Task/Calendar/Sidef/calendar.sidef new file mode 100644 index 0000000000..1445acdb80 --- /dev/null +++ b/Task/Calendar/Sidef/calendar.sidef @@ -0,0 +1,52 @@ +require('DateTime') + +define months_per_col = 3 +define week_day_names = +define month_names = + +func fmt_month (year, month) { + var str = sprintf("%-20s\n", month_names[month-1]) + str += week_day_names.join(' ')+"\n" + + var dt = %s'DateTime' + var date = dt.new(year => year, month => month) + var week_day = date.day_of_week + str += ([" "] * week_day-1 -> join(" ")) + + var last_day = dt.last_day_of_month(year => year, month => month).day + for day in range(date.day, last_day) { + date = dt.new(year => year, month => month, day => day) + + str += " " if (week_day ~~ range(2,7)) + if (week_day == 8) { + str += "\n" + week_day = 1 + } + str += sprintf("%2d", day) + ++week_day + } + str += " " if (week_day < 8) + str += ([" "] * 8-week_day -> join(" ")) + str += "\n" +} + +func fmt_year (year) { + var month_strs = 12.of { |i| fmt_month(year, i).lines } + + var str = (' '*30 + year + "\n") + for month in range(0, 11, months_per_col) { + while (month_strs[month]) { + months_per_col.times { |i| + month_strs[month + i - 1] || next + str += month_strs[month + i - 1].shift + str += ' '*3 + } + str += "\n" + } + str += "\n" + } + + return str +} + +print fmt_year(ARGV.is_empty ? 1969 : ARGV[0].to_i) diff --git a/Task/Calendar/XLISP/calendar.xlisp b/Task/Calendar/XLISP/calendar.xlisp new file mode 100644 index 0000000000..20b13d633b --- /dev/null +++ b/Task/Calendar/XLISP/calendar.xlisp @@ -0,0 +1,58 @@ +(defun calendar (year) + (define months-list '(("JANUARY" 31) ("FEBRUARY" 28) ("MARCH" 31) ("APRIL" 30) ("MAY" 31) ("JUNE" 30) ("JULY" 31) ("AUGUST" 31) ("SEPTEMBER" 30) ("OCTOBER" 31) ("NOVEMBER" 30) ("DECEMBER" 31))) + (define days #(" Sunday " "Monday " "Tuesday " "Wednesday " "Thursday " "Friday " "Saturday")) + (defun gauss-algorithm (a) + (rem (+ 1 (+ (* 5 (rem (- a 1) 4)) (* 4 (rem (- a 1) 100)) (* 6 (rem (- a 1) 400)))) 7)) + (defun range (start end) + (if (<= start end) + (cons start (range (+ start 1) end)))) + (defun string-repeat (s n) + (if (= n 0) + "" + (string-append s (string-repeat s (- n 1))))) + (defun print-month (number-of-days start-day) + (defun print-days (day day-of-week end-day) + (if (= day-of-week 7) + (begin + (newline) + (define day-of-week 0))) + (display (string-repeat " " 8)) + (if (= day-of-week 0) + (display (string-repeat " " 6))) + (if (< day 10) + (display " ")) + (display day) + (display (string-repeat " " 8)) + (if (= day end-day) + (begin + (fresh-line) + (+ day-of-week 1)) + (print-days (+ day 1) (+ day-of-week 1) end-day))) + (mapcar (lambda (n) (display (vector-ref days n))) (range 0 6)) + (newline) + (display (string-repeat (string-repeat " " 18) start-day)) + (print-days 1 start-day number-of-days)) + (defun leap-yearp (y) + (and (= (mod year 4) 0) (or (/= (mod year 100) 0) (= (mod year 400) 0)))) + (define months (make-table)) + (mapcar (lambda (month) (table-set! months (car month) (cadr month))) months-list) + (if (leap-yearp year) + (table-set! months "FEBRUARY" 29)) + (defun print-calendar (calendar-months weekday) + (newline) + (newline) + (display (string-repeat " " 60)) + (display (caar calendar-months)) + (newline) + (define next-month-starts (print-month (table-ref months (caar calendar-months)) weekday)) + (if (cdr calendar-months) + (print-calendar (cdr calendar-months) next-month-starts))) + (display (string-repeat " " 60)) + (display "******** SNOOPY CALENDAR ") + (display year) + (display " ********") + (newline) + (newline) + (print-calendar months-list (gauss-algorithm year))) + +(calendar 1969) diff --git a/Task/Call-a-foreign-language-function/8th/call-a-foreign-language-function.8th b/Task/Call-a-foreign-language-function/8th/call-a-foreign-language-function.8th new file mode 100644 index 0000000000..9a8f38bc9e --- /dev/null +++ b/Task/Call-a-foreign-language-function/8th/call-a-foreign-language-function.8th @@ -0,0 +1,8 @@ +\ tell 8th what the function expects: +"ZZ" "strdup" func: strdup +"VZ" "free" func: free +\ call the external funcs +"abc" dup \ now we have two strings "abc" on the stack +strdup .s cr \ after strdup, you'll have the new (but duplicate) string on the stack +\ the ".s" will show both strings and you can see they are different items on the stack +free \ let the c library free the string diff --git a/Task/Call-a-foreign-language-function/FreeBASIC/call-a-foreign-language-function.freebasic b/Task/Call-a-foreign-language-function/FreeBASIC/call-a-foreign-language-function.freebasic new file mode 100644 index 0000000000..a9c8c4986c --- /dev/null +++ b/Task/Call-a-foreign-language-function/FreeBASIC/call-a-foreign-language-function.freebasic @@ -0,0 +1,20 @@ +' FB 1.05.0 Win64 + +'Using StrDup function in Shlwapi.dll +Dim As Any Ptr library = DyLibLoad("Shlwapi") +Dim strdup As Function (ByVal As Const ZString Ptr) As ZString Ptr +strdup = DyLibSymbol(library, "StrDupA") + +'Using LocalFree function in kernel32.dll +Dim As Any Ptr library2 = DyLibLoad("kernel32") +Dim localfree As Function (ByVal As Any Ptr) As Any Ptr +localfree = DyLibSymbol(library2, "LocalFree") + +Dim As ZString * 10 z = "duplicate" '' 10 characters including final zero byte +Dim As Zstring Ptr pcz = strdup(@z) '' pointer to the duplicate string +Print *pcz '' print duplicate string by dereferencing pointer +localfree(pcz) '' free the memory which StrDup allocated internally +pcz = 0 '' set pointer to null +DyLibFree(library) '' unload first dll +DyLibFree(library2) '' unload second fll +End diff --git a/Task/Call-a-foreign-language-function/Luck/call-a-foreign-language-function.luck b/Task/Call-a-foreign-language-function/Luck/call-a-foreign-language-function.luck new file mode 100644 index 0000000000..6f6c65e244 --- /dev/null +++ b/Task/Call-a-foreign-language-function/Luck/call-a-foreign-language-function.luck @@ -0,0 +1,7 @@ +import "stdio.h";; +import "string.h";; + +let s1:string = "Hello World!";; +let s2:char* = strdup(cstring(s1));; +puts(s2);; +free(s2 as void*) diff --git a/Task/Call-a-foreign-language-function/Nim/call-a-foreign-language-function.nim b/Task/Call-a-foreign-language-function/Nim/call-a-foreign-language-function.nim new file mode 100644 index 0000000000..a604fff047 --- /dev/null +++ b/Task/Call-a-foreign-language-function/Nim/call-a-foreign-language-function.nim @@ -0,0 +1,8 @@ +proc strcmp(a, b: cstring): cint {.importc: "strcmp", nodecl.} +echo strcmp("abc", "def") +echo strcmp("hello", "hello") + +proc printf(formatstr: cstring) {.header: "", varargs.} + +var x = "foo" +printf("Hello %d %s!\n", 12, x) diff --git a/Task/Call-a-foreign-language-function/Phix/call-a-foreign-language-function.phix b/Task/Call-a-foreign-language-function/Phix/call-a-foreign-language-function.phix new file mode 100644 index 0000000000..17df5c3945 --- /dev/null +++ b/Task/Call-a-foreign-language-function/Phix/call-a-foreign-language-function.phix @@ -0,0 +1,9 @@ +constant shlwapi = open_dll("shlwapi.dll") +constant xStrDup = define_c_func(shlwapi,"StrDupA",{C_PTR},C_PTR) +constant kernel32 = open_dll("kernel32.dll") +constant xLocalFree = define_c_func(kernel32,"LocalFree",{C_PTR},C_PTR) +constant HelloWorld = "Hello World!" + +atom pMem = c_func(xStrDup,{HelloWorld}) +?peek_string(pMem) +if c_func(xLocalFree,{pMem})!=NULL then ?9/0 end if diff --git a/Task/Call-a-foreign-language-function/Swift/call-a-foreign-language-function.swift b/Task/Call-a-foreign-language-function/Swift/call-a-foreign-language-function.swift new file mode 100644 index 0000000000..0149429857 --- /dev/null +++ b/Task/Call-a-foreign-language-function/Swift/call-a-foreign-language-function.swift @@ -0,0 +1,5 @@ +import Foundation + +let hello = "Hello, World!" +let fromC = strdup(hello) +let backToSwiftString = String.fromCString(fromC) diff --git a/Task/Call-a-function-in-a-shared-library/FreeBASIC/call-a-function-in-a-shared-library.freebasic b/Task/Call-a-function-in-a-shared-library/FreeBASIC/call-a-function-in-a-shared-library.freebasic new file mode 100644 index 0000000000..4bdc97d568 --- /dev/null +++ b/Task/Call-a-function-in-a-shared-library/FreeBASIC/call-a-function-in-a-shared-library.freebasic @@ -0,0 +1,23 @@ +' FB 1.05.0 Win64 + +' Attempt to call Beep function in Win32 API +Dim As Any Ptr library = DyLibLoad("kernel32.dll") '' load dll + +If library = 0 Then + Print "Unable to load kernel32.dll - calling built in Beep function instead" + Beep : Beep : Beep +Else + Dim beep_ As Function (ByVal As ULong, ByVal As ULong) As Long '' declare function pointer + beep_ = DyLibSymbol(library, "Beep") + If beep_ = 0 Then + Print "Unable to retrieve Beep function from kernel32.dll - calling built in Beep function instead" + Beep : Beep : Beep + Else + For i As Integer = 1 To 3 : beep_(1000, 250) : Next + End If + DyLibFree(library) '' unload library +End If + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Call-a-function-in-a-shared-library/Lingo/call-a-function-in-a-shared-library.lingo b/Task/Call-a-function-in-a-shared-library/Lingo/call-a-function-in-a-shared-library.lingo new file mode 100644 index 0000000000..b0b972ce1b --- /dev/null +++ b/Task/Call-a-function-in-a-shared-library/Lingo/call-a-function-in-a-shared-library.lingo @@ -0,0 +1,18 @@ +-- calculate CRC-32 checksum +str = "The quick brown fox jumps over the lazy dog" + +-- is shared library (in Director called "Xtra", a DLL in windows, a sharedLib in +-- OS X) available? +if ilk(xtra("Crypto"))=#xtra then + + -- use shared library + cx = xtra("Crypto").new() + crc = cx.cx_crc32_string(str) + +else + + -- otherwise use (slower) pure lingo solution + crcObj = script("CRC").new() + crc = crcObj.crc32(str) + +end if diff --git a/Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-1.nim b/Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-1.nim new file mode 100644 index 0000000000..5bbcde8b3b --- /dev/null +++ b/Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-1.nim @@ -0,0 +1,5 @@ +proc openimage(s: cstring): cint {.importc, dynlib: "./fakeimglib.so".} + +echo openimage("foo") +echo openimage("bar") +echo openimage("baz") diff --git a/Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-2.nim b/Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-2.nim new file mode 100644 index 0000000000..468a48fc06 --- /dev/null +++ b/Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-2.nim @@ -0,0 +1,8 @@ +#include +/* gcc -shared -nostartfiles fakeimglib.c -o fakeimglib.so */ +int openimage(const char *s) +{ + static int handle = 100; + fprintf(stderr, "opening %s\n", s); + return handle++; +} diff --git a/Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-3.nim b/Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-3.nim new file mode 100644 index 0000000000..0b5fb57256 --- /dev/null +++ b/Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-3.nim @@ -0,0 +1,5 @@ +proc openimage(s: string): int {.importc, dynlib: "./libfakeimg.so".} + +echo openimage("foo") +echo openimage("bar") +echo openimage("baz") diff --git a/Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-4.nim b/Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-4.nim new file mode 100644 index 0000000000..e0b78e5195 --- /dev/null +++ b/Task/Call-a-function-in-a-shared-library/Nim/call-a-function-in-a-shared-library-4.nim @@ -0,0 +1,7 @@ +# nim c --app:lib fakeimg.nim +var handle = 100 + +proc openimage*(s: string): int {.exportc, dynlib.} = + stderr.writeln "opening ", s + result = handle + inc(handle) diff --git a/Task/Call-a-function/AntLang/call-a-function-1.antlang b/Task/Call-a-function/AntLang/call-a-function-1.antlang new file mode 100644 index 0000000000..c3fbe9424f --- /dev/null +++ b/Task/Call-a-function/AntLang/call-a-function-1.antlang @@ -0,0 +1 @@ +2*2+9 diff --git a/Task/Call-a-function/AntLang/call-a-function-2.antlang b/Task/Call-a-function/AntLang/call-a-function-2.antlang new file mode 100644 index 0000000000..6aa8c2241c --- /dev/null +++ b/Task/Call-a-function/AntLang/call-a-function-2.antlang @@ -0,0 +1,3 @@ +*[2;+[2;9]] +echo["Hello!"] +time[] diff --git a/Task/Call-a-function/Axe/call-a-function-1.axe b/Task/Call-a-function/Axe/call-a-function-1.axe new file mode 100644 index 0000000000..ad2786815b --- /dev/null +++ b/Task/Call-a-function/Axe/call-a-function-1.axe @@ -0,0 +1,2 @@ +NOARG() +ARGS(1,5,42) diff --git a/Task/Call-a-function/Axe/call-a-function-2.axe b/Task/Call-a-function/Axe/call-a-function-2.axe new file mode 100644 index 0000000000..d4934ac1cb --- /dev/null +++ b/Task/Call-a-function/Axe/call-a-function-2.axe @@ -0,0 +1,3 @@ +OPARG(1,2,3,4,5,6) +OPARG(1,2,3) +OPARG() diff --git a/Task/Call-a-function/Axe/call-a-function-3.axe b/Task/Call-a-function/Axe/call-a-function-3.axe new file mode 100644 index 0000000000..2cd6c5cf47 --- /dev/null +++ b/Task/Call-a-function/Axe/call-a-function-3.axe @@ -0,0 +1,2 @@ +MATHS(2,4)→A +Disp GETSTR() diff --git a/Task/Call-a-function/Axe/call-a-function-4.axe b/Task/Call-a-function/Axe/call-a-function-4.axe new file mode 100644 index 0000000000..5427f37aab --- /dev/null +++ b/Task/Call-a-function/Axe/call-a-function-4.axe @@ -0,0 +1,2 @@ +USER() +axeFunc() diff --git a/Task/Call-a-function/I/call-a-function.i b/Task/Call-a-function/I/call-a-function.i new file mode 100644 index 0000000000..c8dcf48c77 --- /dev/null +++ b/Task/Call-a-function/I/call-a-function.i @@ -0,0 +1,5 @@ +software { + var line = read() //Calling a function with no arguments and getting a return value. + var t = text(10) //Calling a function with fixed arguments. + print(1,2,3,4,5,6,7,8,9,0,line,t) //Calling a variadic function. +} diff --git a/Task/Call-a-function/LFE/call-a-function-1.lfe b/Task/Call-a-function/LFE/call-a-function-1.lfe new file mode 100644 index 0000000000..bb85364f2b --- /dev/null +++ b/Task/Call-a-function/LFE/call-a-function-1.lfe @@ -0,0 +1,2 @@ +(defun my-func() + (: io format '"I get called with NOTHING!~n")) diff --git a/Task/Call-a-function/LFE/call-a-function-2.lfe b/Task/Call-a-function/LFE/call-a-function-2.lfe new file mode 100644 index 0000000000..0b06ae0837 --- /dev/null +++ b/Task/Call-a-function/LFE/call-a-function-2.lfe @@ -0,0 +1,3 @@ +> (my-func) +I get called with NOTHING! +ok diff --git a/Task/Call-a-function/LFE/call-a-function-3.lfe b/Task/Call-a-function/LFE/call-a-function-3.lfe new file mode 100644 index 0000000000..07d4bcffa9 --- /dev/null +++ b/Task/Call-a-function/LFE/call-a-function-3.lfe @@ -0,0 +1,2 @@ +(defun my-func(a b) + (: io format '"I got called with ~p and ~p~n" (list a b))) diff --git a/Task/Call-a-function/LFE/call-a-function-4.lfe b/Task/Call-a-function/LFE/call-a-function-4.lfe new file mode 100644 index 0000000000..44862f5544 --- /dev/null +++ b/Task/Call-a-function/LFE/call-a-function-4.lfe @@ -0,0 +1,3 @@ +> (my-func '"bread" '"cheese") +I got called with "bread" and "cheese" +ok diff --git a/Task/Call-a-function/LFE/call-a-function-5.lfe b/Task/Call-a-function/LFE/call-a-function-5.lfe new file mode 100644 index 0000000000..9dc471411c --- /dev/null +++ b/Task/Call-a-function/LFE/call-a-function-5.lfe @@ -0,0 +1,14 @@ +(defmodule args + (export all)) + +(defun my-func () + (my-func () () ())) + +(defun my-func (a) + (my-func a () ())) + +(defun my-func (a b) + (my-func a b ())) + +(defun my-func (a b c) + (: io format '"~p ~p ~p~n" (list a b c))) diff --git a/Task/Call-a-function/LFE/call-a-function-6.lfe b/Task/Call-a-function/LFE/call-a-function-6.lfe new file mode 100644 index 0000000000..9bb756728f --- /dev/null +++ b/Task/Call-a-function/LFE/call-a-function-6.lfe @@ -0,0 +1,16 @@ +> (slurp '"args.lfe") +#(ok args) +> (my-func) +[] [] [] +ok +> (my-func '"apple") +"apple" [] [] +ok +> (my-func '"apple" '"banana") +"apple" "banana" [] +ok +> (my-func '"apple" '"banana" '"cranberry") +"apple" "banana" "cranberry" +ok +> (my-func '"apple" '"banana" '"cranberry" '"bad arg") +exception error: #(unbound_func #(my-func 4)) diff --git a/Task/Call-a-function/LFE/call-a-function-7.lfe b/Task/Call-a-function/LFE/call-a-function-7.lfe new file mode 100644 index 0000000000..88f4b9031b --- /dev/null +++ b/Task/Call-a-function/LFE/call-a-function-7.lfe @@ -0,0 +1,4 @@ +... + (cond ((== count limit) (hit-limit-func arg-1 arg-2)) + ((/= count limit) (keep-going-func count))) + ... diff --git a/Task/Call-a-function/LFE/call-a-function-8.lfe b/Task/Call-a-function/LFE/call-a-function-8.lfe new file mode 100644 index 0000000000..b7a4eb1836 --- /dev/null +++ b/Task/Call-a-function/LFE/call-a-function-8.lfe @@ -0,0 +1,2 @@ +> (>= 0.5 (: math sin 0.5)) +true diff --git a/Task/Call-a-function/LFE/call-a-function-9.lfe b/Task/Call-a-function/LFE/call-a-function-9.lfe new file mode 100644 index 0000000000..afa27f6c01 --- /dev/null +++ b/Task/Call-a-function/LFE/call-a-function-9.lfe @@ -0,0 +1,2 @@ +(let ((x (: math sin 0.5))) + ...) diff --git a/Task/Call-a-function/Lingo/call-a-function-1.lingo b/Task/Call-a-function/Lingo/call-a-function-1.lingo new file mode 100644 index 0000000000..90633ef80d --- /dev/null +++ b/Task/Call-a-function/Lingo/call-a-function-1.lingo @@ -0,0 +1,3 @@ +foo() +-- or alternatively: +call(#foo, _movie) diff --git a/Task/Call-a-function/Lingo/call-a-function-10.lingo b/Task/Call-a-function/Lingo/call-a-function-10.lingo new file mode 100644 index 0000000000..da3776df1c --- /dev/null +++ b/Task/Call-a-function/Lingo/call-a-function-10.lingo @@ -0,0 +1,17 @@ +on getAllUserFunctions () + res = [] + repeat with i = 1 to _movie.castlib.count + c = _movie.castlib(i) + repeat with j = 1 to c.member.count + m = c.member[j] + if m.type<>#script then next repeat + if m.scripttype=#movie then + functions = m.script.handlers() + repeat with f in functions + res.append(f) + end repeat + end if + end repeat + end repeat + return res +end diff --git a/Task/Call-a-function/Lingo/call-a-function-11.lingo b/Task/Call-a-function/Lingo/call-a-function-11.lingo new file mode 100644 index 0000000000..8662ba60ff --- /dev/null +++ b/Task/Call-a-function/Lingo/call-a-function-11.lingo @@ -0,0 +1,2 @@ +put getAllUserFunctions() +-- [#sum, #double, #getAllUserFunctions] diff --git a/Task/Call-a-function/Lingo/call-a-function-12.lingo b/Task/Call-a-function/Lingo/call-a-function-12.lingo new file mode 100644 index 0000000000..4272649770 --- /dev/null +++ b/Task/Call-a-function/Lingo/call-a-function-12.lingo @@ -0,0 +1,6 @@ +on double (someList) + cnt = someList.count + repeat with i = 1 to cnt + someList[i] = someList[i] * 2 + end repeat +end diff --git a/Task/Call-a-function/Lingo/call-a-function-13.lingo b/Task/Call-a-function/Lingo/call-a-function-13.lingo new file mode 100644 index 0000000000..4c1b346533 --- /dev/null +++ b/Task/Call-a-function/Lingo/call-a-function-13.lingo @@ -0,0 +1,9 @@ +l = [1,2,3] +double(l) +put l +-- [2, 4, 6] + +l = [1,2,3] +double(l.duplicate()) +put l +-- [1, 2, 3] diff --git a/Task/Call-a-function/Lingo/call-a-function-2.lingo b/Task/Call-a-function/Lingo/call-a-function-2.lingo new file mode 100644 index 0000000000..23a37bb11c --- /dev/null +++ b/Task/Call-a-function/Lingo/call-a-function-2.lingo @@ -0,0 +1,3 @@ +foo(1,2,3) +-- or alternatively: +call(#foo, _movie, 1, 2, 3) diff --git a/Task/Call-a-function/Lingo/call-a-function-3.lingo b/Task/Call-a-function/Lingo/call-a-function-3.lingo new file mode 100644 index 0000000000..9682b4906d --- /dev/null +++ b/Task/Call-a-function/Lingo/call-a-function-3.lingo @@ -0,0 +1,4 @@ +on foo (a, b) + if voidP(b) then b = 1 + return a * b +end diff --git a/Task/Call-a-function/Lingo/call-a-function-4.lingo b/Task/Call-a-function/Lingo/call-a-function-4.lingo new file mode 100644 index 0000000000..d2befdcb8d --- /dev/null +++ b/Task/Call-a-function/Lingo/call-a-function-4.lingo @@ -0,0 +1,4 @@ +put foo(23, 2) +-- 46 +put foo(23) +-- 23 diff --git a/Task/Call-a-function/Lingo/call-a-function-5.lingo b/Task/Call-a-function/Lingo/call-a-function-5.lingo new file mode 100644 index 0000000000..b96bda2ee8 --- /dev/null +++ b/Task/Call-a-function/Lingo/call-a-function-5.lingo @@ -0,0 +1,7 @@ +on sum () + res = 0 + repeat with i = 1 to the paramCount + res = res + param(i) + end repeat + return res +end diff --git a/Task/Call-a-function/Lingo/call-a-function-6.lingo b/Task/Call-a-function/Lingo/call-a-function-6.lingo new file mode 100644 index 0000000000..a23677e28a --- /dev/null +++ b/Task/Call-a-function/Lingo/call-a-function-6.lingo @@ -0,0 +1,2 @@ +put sum (1,2,3) +-- 6 diff --git a/Task/Call-a-function/Lingo/call-a-function-7.lingo b/Task/Call-a-function/Lingo/call-a-function-7.lingo new file mode 100644 index 0000000000..852715d3b0 --- /dev/null +++ b/Task/Call-a-function/Lingo/call-a-function-7.lingo @@ -0,0 +1,20 @@ +---------------------------------------- +-- One of the five native iterative methods defined in ECMAScript 5 +-- @param {list} tList +-- @param {symbol} cbFunc +-- @param {object} [cbObj=_movie] +-- @return {list} +---------------------------------------- +on map (tList, cbFunc, cbObj) + if voidP(cbObj) then cbObj = _movie + res = [] + cnt = tList.count + repeat with i = 1 to cnt + res[i] = call(cbFunc, cbObj, tList[i], i, tList) + end repeat + return res +end + +on doubleInt (n) + return n*2 +end diff --git a/Task/Call-a-function/Lingo/call-a-function-8.lingo b/Task/Call-a-function/Lingo/call-a-function-8.lingo new file mode 100644 index 0000000000..09694e63d6 --- /dev/null +++ b/Task/Call-a-function/Lingo/call-a-function-8.lingo @@ -0,0 +1,3 @@ +l = [1,2,3] +put map(l, #doubleInt) +-- [2, 4, 6] diff --git a/Task/Call-a-function/Lingo/call-a-function-9.lingo b/Task/Call-a-function/Lingo/call-a-function-9.lingo new file mode 100644 index 0000000000..e73d956474 --- /dev/null +++ b/Task/Call-a-function/Lingo/call-a-function-9.lingo @@ -0,0 +1 @@ +x = foo(1,2) diff --git a/Task/Call-a-function/Luck/call-a-function.luck b/Task/Call-a-function/Luck/call-a-function.luck new file mode 100644 index 0000000000..db9a946772 --- /dev/null +++ b/Task/Call-a-function/Luck/call-a-function.luck @@ -0,0 +1,43 @@ +/* Calling a function that requires no arguments */ +f();; + +/* Calling a function with a fixed number of arguments */ +f(1,2);; + +/* Calling a function with optional arguments + Note: defining the function is cumbersome but will get easier in future versions. */ +f(1,2,new {default with x=3, y=4});; + +/* Calling a function with a variable number of arguments */ +printf("%d %d %d %d":char*,2,3,4,5);; + +/* Calling a function with named arguments + Note: may get syntax sugar in future versions */ +f(1,2,new {default with x=3, y=4});; + +/* Using a function in statement context (what?) */ +f();f();f();; + +/* Using a function in first-class context within an expression */ +[1,2,3].map(string);; + +/* Obtaining the return value of a function */ +let x:int = f();; + +/* Distinguishing built-in functions and user-defined functions */ +/* Builtin function i.e. custom calling convention: */ +(@ binop "==" l r);; +/* User defined function i.e. normal function */ +f(l)(r);; + +/* Distinguishing subroutines and functions: both are supported, but compiler is not aware of difference */ +sub();; +fun();; + +/* Stating whether arguments are passed by value or by reference */ +f(value);; /* by value */ +f(&value);; /* by pointer reference */ +f(ref(value));; /* by managed reference */ + +/* Is partial application possible and how */ +tasty_curry(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p)(q)(r)(s)(t)(u)(v)(w)(x)(y)(z);; diff --git a/Task/Call-a-function/Nim/call-a-function.nim b/Task/Call-a-function/Nim/call-a-function.nim new file mode 100644 index 0000000000..d57793a55d --- /dev/null +++ b/Task/Call-a-function/Nim/call-a-function.nim @@ -0,0 +1,43 @@ +proc no_args() = + discard +# call +no_args() + +proc fixed_args(x, y) = + echo x + echo y +# calls +fixed_args(1, 2) # x=1, y=2 +fixed_args 1, 2 # same call +1.fixed_args(2) # same call + + +proc opt_args(x=1.0) = + echo x +# calls +opt_args() # 1 +opt_args(3.141) # 3.141 + +proc var_args(v: varargs[string, `$`]) = + for x in v: echo x +# calls +var_args(1, 2, 3) # (1, 2, 3) +var_args(1, (2,3)) # (1, (2, 3)) +var_args() # () + +## Named arguments +fixed_args(y=2, x=1) # x=1, y=2 + +## As a statement +if true: + no_args() + +proc return_something(x): int = + x + 1 + +var a = return_something(2) + +## First-class within an expression +let x = return_something(19) + 10 +let y = 19.return_something() + 10 +let z = 19.return_something + 10 diff --git a/Task/Call-a-function/Oforth/call-a-function-1.oforth b/Task/Call-a-function/Oforth/call-a-function-1.oforth new file mode 100644 index 0000000000..b8115dadaf --- /dev/null +++ b/Task/Call-a-function/Oforth/call-a-function-1.oforth @@ -0,0 +1 @@ +a b c f diff --git a/Task/Call-a-function/Oforth/call-a-function-2.oforth b/Task/Call-a-function/Oforth/call-a-function-2.oforth new file mode 100644 index 0000000000..8f00e3db90 --- /dev/null +++ b/Task/Call-a-function/Oforth/call-a-function-2.oforth @@ -0,0 +1 @@ +f(a, b, c) diff --git a/Task/Call-a-function/Oforth/call-a-function-3.oforth b/Task/Call-a-function/Oforth/call-a-function-3.oforth new file mode 100644 index 0000000000..285488c1c9 --- /dev/null +++ b/Task/Call-a-function/Oforth/call-a-function-3.oforth @@ -0,0 +1,4 @@ +a b c f +a b f(c) +a f(b, c) +f(a, b, c) diff --git a/Task/Call-a-function/Oforth/call-a-function-4.oforth b/Task/Call-a-function/Oforth/call-a-function-4.oforth new file mode 100644 index 0000000000..da4ca51af2 --- /dev/null +++ b/Task/Call-a-function/Oforth/call-a-function-4.oforth @@ -0,0 +1 @@ +a b c r m diff --git a/Task/Call-a-function/Oforth/call-a-function-5.oforth b/Task/Call-a-function/Oforth/call-a-function-5.oforth new file mode 100644 index 0000000000..76d4b38d2e --- /dev/null +++ b/Task/Call-a-function/Oforth/call-a-function-5.oforth @@ -0,0 +1 @@ +r m(a, b, c) diff --git a/Task/Call-a-function/Phix/call-a-function-1.phix b/Task/Call-a-function/Phix/call-a-function-1.phix new file mode 100644 index 0000000000..2d80fa163e --- /dev/null +++ b/Task/Call-a-function/Phix/call-a-function-1.phix @@ -0,0 +1 @@ +{} = myfunction() diff --git a/Task/Call-a-function/Phix/call-a-function-2.phix b/Task/Call-a-function/Phix/call-a-function-2.phix new file mode 100644 index 0000000000..adfa8a5037 --- /dev/null +++ b/Task/Call-a-function/Phix/call-a-function-2.phix @@ -0,0 +1,4 @@ +{cities,populations} = columize(muncipalities) +{{},populations} = columize(muncipalities) -- discard result[1] +{cities,{}} = columize(muncipalities) -- discard result[2] +{cities} = columize(muncipalities) -- "" diff --git a/Task/Call-a-function/Phix/call-a-function-3.phix b/Task/Call-a-function/Phix/call-a-function-3.phix new file mode 100644 index 0000000000..e43f52fe9f --- /dev/null +++ b/Task/Call-a-function/Phix/call-a-function-3.phix @@ -0,0 +1,6 @@ +function myfunction(integer a, string b="default") + return {a,b} +end function +--? myfunction() -- illegal, compile-time error +?myfunction(1) -- displays {1,"default"} +?myfunction(2,"that") -- displays {2,"that"} diff --git a/Task/Call-a-function/Phix/call-a-function-4.phix b/Task/Call-a-function/Phix/call-a-function-4.phix new file mode 100644 index 0000000000..ddfe6ed9f0 --- /dev/null +++ b/Task/Call-a-function/Phix/call-a-function-4.phix @@ -0,0 +1,2 @@ +?myfunction(b:="then",a:=3) -- displays {3,"then"} +--?myfunction(b:="though") -- compile-time error diff --git a/Task/Call-a-function/Phix/call-a-function-5.phix b/Task/Call-a-function/Phix/call-a-function-5.phix new file mode 100644 index 0000000000..e5cefb5306 --- /dev/null +++ b/Task/Call-a-function/Phix/call-a-function-5.phix @@ -0,0 +1,2 @@ +constant integer r_my_func = routine_id("myroutine") +?call_func(r_my_func,{1}) -- displays {1,"default"} diff --git a/Task/Call-a-function/Phix/call-a-function-6.phix b/Task/Call-a-function/Phix/call-a-function-6.phix new file mode 100644 index 0000000000..52309d3d70 --- /dev/null +++ b/Task/Call-a-function/Phix/call-a-function-6.phix @@ -0,0 +1 @@ +s = append(s,item) diff --git a/Task/Call-a-function/Ring/call-a-function-1.ring b/Task/Call-a-function/Ring/call-a-function-1.ring new file mode 100644 index 0000000000..eeb75607c7 --- /dev/null +++ b/Task/Call-a-function/Ring/call-a-function-1.ring @@ -0,0 +1,3 @@ +hello() +func hello + see "Hello from function" + nl diff --git a/Task/Call-a-function/Ring/call-a-function-2.ring b/Task/Call-a-function/Ring/call-a-function-2.ring new file mode 100644 index 0000000000..78342f361f --- /dev/null +++ b/Task/Call-a-function/Ring/call-a-function-2.ring @@ -0,0 +1,3 @@ +first() second() +func first see "message from the first function" + nl +func second see "message from the second function" + nl diff --git a/Task/Call-a-function/Ring/call-a-function-3.ring b/Task/Call-a-function/Ring/call-a-function-3.ring new file mode 100644 index 0000000000..498ad5096d --- /dev/null +++ b/Task/Call-a-function/Ring/call-a-function-3.ring @@ -0,0 +1,2 @@ +sum(3,5) sum(1000,2000) +func sum x,y see x+y+nl diff --git a/Task/Call-a-function/Ring/call-a-function-4.ring b/Task/Call-a-function/Ring/call-a-function-4.ring new file mode 100644 index 0000000000..564d04c138 --- /dev/null +++ b/Task/Call-a-function/Ring/call-a-function-4.ring @@ -0,0 +1,4 @@ +# this program will print the hello world message first then execute the main function +See "Hello World!" + nl +func main + see "Message from the main function" + nl diff --git a/Task/Call-a-function/SSEM/call-a-function.ssem b/Task/Call-a-function/SSEM/call-a-function.ssem new file mode 100644 index 0000000000..22027ba81b --- /dev/null +++ b/Task/Call-a-function/SSEM/call-a-function.ssem @@ -0,0 +1,4 @@ +00110000000000100000000000000000 10. -12 to c +10110000000000000000000000000000 11. 13 to CI +11001111111111111111111111111111 12. -13 +11001000000000000000000000000000 13. 19 diff --git a/Task/Call-a-function/Sidef/call-a-function-1.sidef b/Task/Call-a-function/Sidef/call-a-function-1.sidef new file mode 100644 index 0000000000..6ede3a3662 --- /dev/null +++ b/Task/Call-a-function/Sidef/call-a-function-1.sidef @@ -0,0 +1,10 @@ +foo(); # without arguments +foo(1, 2); # with two arguments +foo(args...); # with a variable number of arguments +foo(name: 'Bar', age: 42); # with named arguments + +var f = foo; # store the function foo inside 'f' +var result = f(); # obtain the return value of a function + +var arr = [1,2,3]; +foo(arr); # the arguments are passed by object-reference diff --git a/Task/Call-a-function/Sidef/call-a-function-2.sidef b/Task/Call-a-function/Sidef/call-a-function-2.sidef new file mode 100644 index 0000000000..b978026379 --- /dev/null +++ b/Task/Call-a-function/Sidef/call-a-function-2.sidef @@ -0,0 +1,12 @@ +func curry(f, *args1) { + func (*args2) { + f(args1..., args2...); + } +} + +func add(a, b) { + a + b +} + +var adder = curry(add, 1); +say adder(3); #=>4 diff --git a/Task/Call-a-function/Swift/call-a-function.swift b/Task/Call-a-function/Swift/call-a-function.swift new file mode 100644 index 0000000000..650f53726c --- /dev/null +++ b/Task/Call-a-function/Swift/call-a-function.swift @@ -0,0 +1,35 @@ +// call a function with no args +noArgs() + +// call a function with one arg with no external name +oneArgUnnamed(1) + +// call a function with one arg with external name +oneArgNamed(arg: 1) + +// call a function with two args with no external names +twoArgsUnnamed(1, 2) + +// call a function with two args and external names +twoArgsNamed(arg1: 1, arg2: 2) + +// call a function with an optional arg +// with arg +optionalArguments(arg: 1) +// without +optionalArguments() // defaults to 0 + +// function that takes another function as arg +funcArg(noArgs) + +// variadic function +variadic(opts: "foo", "bar") + +// getting a return value +let foo = returnString() + +// getting a bunch of return values +let (foo, bar, baz) = returnSomeValues() + +// getting a bunch of return values, discarding second returned value +let (foo, _, baz) = returnSomeValues() diff --git a/Task/Call-a-function/XLISP/call-a-function.xlisp b/Task/Call-a-function/XLISP/call-a-function.xlisp new file mode 100644 index 0000000000..aa0aa2469c --- /dev/null +++ b/Task/Call-a-function/XLISP/call-a-function.xlisp @@ -0,0 +1,19 @@ +; call a function (procedure) with no arguments: +(foo) + +; call a function (procedure) with arguments: +(foo bar baz) +; the first symbol after "(" is the name of the function +; the other symbols are the arguments + +; call a function on a list of arguments formed at run time: +(apply foo bar) + +; In a REPL, the return value will be printed. +; In other contexts, it can be fed as argument into a further function: +(foo (bar baz)) +; this calls bar on the argument baz and then calls foo on the return value + +; or it can simply be discarded +(foo bar) +; nothing is done with the return value diff --git a/Task/Call-an-object-method/Apex/call-an-object-method.apex b/Task/Call-an-object-method/Apex/call-an-object-method.apex new file mode 100644 index 0000000000..03cc43e8a9 --- /dev/null +++ b/Task/Call-an-object-method/Apex/call-an-object-method.apex @@ -0,0 +1,5 @@ +// Static +MyClass.method(someParameter); + +// Instance +myInstance.method(someParameter); diff --git a/Task/Call-an-object-method/ChucK/call-an-object-method.chuck b/Task/Call-an-object-method/ChucK/call-an-object-method.chuck new file mode 100644 index 0000000000..ca6f0e7946 --- /dev/null +++ b/Task/Call-an-object-method/ChucK/call-an-object-method.chuck @@ -0,0 +1,2 @@ +MyClass myClassObject; +myClassObject.myFunction(some parameter); diff --git a/Task/Call-an-object-method/FreeBASIC/call-an-object-method.freebasic b/Task/Call-an-object-method/FreeBASIC/call-an-object-method.freebasic new file mode 100644 index 0000000000..26db418aa7 --- /dev/null +++ b/Task/Call-an-object-method/FreeBASIC/call-an-object-method.freebasic @@ -0,0 +1,24 @@ +' FB 1.05.0 Win64 + +Type MyType + Public: + Declare Sub InstanceMethod(s As String) + Declare Static Sub StaticMethod(s As String) + Private: + dummy_ As Integer ' types cannot be empty in FB +End Type + +Sub MyType.InstanceMethod(s As String) + Print s +End Sub + +Static Sub MyType.StaticMethod(s As String) + Print s +End Sub + +Dim t As MyType +t.InstanceMethod("Hello world!") +MyType.Staticmethod("Hello static world!") +Print +Print "Press any key to quit the program" +Sleep diff --git a/Task/Call-an-object-method/LFE/call-an-object-method-1.lfe b/Task/Call-an-object-method/LFE/call-an-object-method-1.lfe new file mode 100644 index 0000000000..506165c927 --- /dev/null +++ b/Task/Call-an-object-method/LFE/call-an-object-method-1.lfe @@ -0,0 +1,93 @@ +(defmodule aquarium + (export all)) + +(defun fish-class (species) + " + This is the constructor that will be used most often, only requiring that + one pass a 'species' string. + + When the children are not defined, simply use an empty list. + " + (fish-class species ())) + +(defun fish-class (species children) + " + This contructor is mostly useful as a way of abstracting out the id + generation from the larger constructor. Nothing else uses fish-class/2 + besides fish-class/1, so it's not strictly necessary. + + When the id isn't know, generate one. + " + (let* (((binary (id (size 128))) (: crypto rand_bytes 16)) + (formatted-id (car + (: io_lib format + '"~32.16.0b" (list id))))) + (fish-class species children formatted-id))) + +(defun fish-class (species children id) + " + This is the constructor used internally, once the children and fish id are + known. + " + (let ((move-verb '"swam")) + (lambda (method-name) + (case method-name + ('id + (lambda (self) id)) + ('species + (lambda (self) species)) + ('children + (lambda (self) children)) + ('info + (lambda (self) + (: io format + '"id: ~p~nspecies: ~p~nchildren: ~p~n" + (list (get-id self) + (get-species self) + (get-children self))))) + ('move + (lambda (self distance) + (: io format + '"The ~s ~s ~p feet!~n" + (list species move-verb distance)))) + ('reproduce + (lambda (self) + (let* ((child (fish-class species)) + (child-id (get-id child)) + (children-ids (: lists append + (list children (list child-id)))) + (parent-id (get-id self)) + (parent (fish-class species children-ids parent-id))) + (list parent child)))) + ('children-count + (lambda (self) + (: erlang length children))))))) + +(defun get-method (object method-name) + " + This is a generic function, used to call into the given object (class + instance). + " + (funcall object method-name)) + +; define object methods +(defun get-id (object) + (funcall (get-method object 'id) object)) + +(defun get-species (object) + (funcall (get-method object 'species) object)) + +(defun get-info (object) + (funcall (get-method object 'info) object)) + +(defun move (object distance) + (funcall (get-method object 'move) object distance)) + +(defun reproduce (object) + (funcall (get-method object 'reproduce) object)) + +(defun get-children (object) + (funcall (get-method object 'children) object)) + +(defun get-children-count (object) + (funcall (get-method object 'children-count) object)) diff --git a/Task/Call-an-object-method/LFE/call-an-object-method-2.lfe b/Task/Call-an-object-method/LFE/call-an-object-method-2.lfe new file mode 100644 index 0000000000..e7a6c85631 --- /dev/null +++ b/Task/Call-an-object-method/LFE/call-an-object-method-2.lfe @@ -0,0 +1,45 @@ +; Load the file and create a fish-class instance: + +> (slurp '"object.lfe") +#(ok object) +> (set mommy-fish (fish-class '"Carp")) +#Fun + +; Execute some of the basic methods: + +> (get-species mommy-fish) +"Carp" +> (move mommy-fish 17) +The Carp swam 17 feet! +ok +> (get-id mommy-fish) +"47eebe91a648f042fc3fb278df663de5" + +; Now let's look at "modifying" state data (e.g., children counts): + +> (get-children mommy-fish) +() +> (get-children-count mommy-fish) +0 +> (set (mommy-fish baby-fish-1) (reproduce mommy-fish)) +(#Fun #Fun) +> (get-id mommy-fish) +"47eebe91a648f042fc3fb278df663de5" +> (get-id baby-fish-1) +"fdcf35983bb496650e558a82e34c9935" +> (get-children-count mommy-fish) +1 +> (set (mommy-fish baby-fish-2) (reproduce mommy-fish)) +(#Fun #Fun) +> (get-id mommy-fish) +"47eebe91a648f042fc3fb278df663de5" +> (get-id baby-fish-2) +"3e64e5c20fb742dd88dac1032749c2fd" +> (get-children-count mommy-fish) +2 +> (get-info mommy-fish) +id: "47eebe91a648f042fc3fb278df663de5" +species: "Carp" +children: ["fdcf35983bb496650e558a82e34c9935", + "3e64e5c20fb742dd88dac1032749c2fd"] +ok diff --git a/Task/Call-an-object-method/LFE/call-an-object-method-3.lfe b/Task/Call-an-object-method/LFE/call-an-object-method-3.lfe new file mode 100644 index 0000000000..0d1925b50d --- /dev/null +++ b/Task/Call-an-object-method/LFE/call-an-object-method-3.lfe @@ -0,0 +1,101 @@ +(defmodule object + (export all)) + +(defun fish-class (species) + " + This is the constructor that will be used most often, only requiring that + one pass a 'species' string. + + When the children are not defined, simply use an empty list. + " + (fish-class species ())) + +(defun fish-class (species children) + " + This constructor is useful for two reasons: + 1) as a way of abstracting out the id generation from the + larger constructor, and + 2) spawning the 'object loop' code (fish-class/3). + " + (let* (((binary (id (size 128))) (: crypto rand_bytes 16)) + (formatted-id (car + (: io_lib format + '"~32.16.0b" (list id))))) + (spawn 'object + 'fish-class + (list species children formatted-id)))) + +(defun fish-class (species children id) + " + This function is intended to be spawned as a separate process which is + used to track the state of a fish. In particular, fish-class/2 spawns + this function (which acts as a loop, pattern matching for messages). + " + (let ((move-verb '"swam")) + (receive + ((tuple caller 'move distance) + (! caller (list species move-verb distance)) + (fish-class species children id)) + ((tuple caller 'species) + (! caller species) + (fish-class species children id)) + ((tuple caller 'children) + (! caller children) + (fish-class species children id)) + ((tuple caller 'children-count) + (! caller (length children)) + (fish-class species children id)) + ((tuple caller 'id) + (! caller id) + (fish-class species children id)) + ((tuple caller 'info) + (! caller (list id species children)) + (fish-class species children id)) + ((tuple caller 'reproduce) + (let* ((child (fish-class species)) + (child-id (get-id child)) + (children-ids (: lists append + (list children (list child-id))))) + (! caller child) + (fish-class species children-ids id)))))) + +(defun call-method (object method-name) + " + This is a generic function, used to call into the given object (class + instance). + " + (! object (tuple (self) method-name)) + (receive + (data data))) + +(defun call-method (object method-name arg) + " + Same as above, but with an additional argument. + " + (! object (tuple (self) method-name arg)) + (receive + (data data))) + +; define object methods +(defun get-id (object) + (call-method object 'id)) + +(defun get-species (object) + (call-method object 'species)) + +(defun get-info (object) + (let ((data (call-method object 'info))) + (: io format '"id: ~s~nspecies: ~s~nchildren: ~p~n" data))) + +(defun move (object distance) + (let ((data (call-method object 'move distance))) + (: io format '"The ~s ~s ~p feet!~n" data))) + +(defun reproduce (object) + (call-method object 'reproduce)) + +(defun get-children (object) + (call-method object 'children)) + +(defun get-children-count (object) + (call-method object 'children-count)) diff --git a/Task/Call-an-object-method/LFE/call-an-object-method-4.lfe b/Task/Call-an-object-method/LFE/call-an-object-method-4.lfe new file mode 100644 index 0000000000..f62bd5635e --- /dev/null +++ b/Task/Call-an-object-method/LFE/call-an-object-method-4.lfe @@ -0,0 +1,45 @@ +; Load the file and create a fish-class instance: + +> (slurp '"object.lfe") +#(ok object) +> (set mommy-fish (fish-class '"Carp")) +<0.33.0> + +; Execute some of the basic methods: + +> (get-species mommy-fish) +"Carp" +> (move mommy-fish 17) +The Carp swam 17 feet! +ok +> (get-id mommy-fish) +"47eebe91a648f042fc3fb278df663de5" + +; Now let's look at modifying state data: + +> (get-children mommy-fish) +() +> (get-children-count mommy-fish) +0 +> (set baby-fish-1 (reproduce mommy-fish)) +<0.34.0> +> (get-id mommy-fish) +"47eebe91a648f042fc3fb278df663de5" +> (get-id baby-fish-1) +"fdcf35983bb496650e558a82e34c9935" +> (get-children-count mommy-fish) +1 +> (set baby-fish-2 (reproduce mommy-fish)) +<0.35.0> +> (get-id mommy-fish) +"47eebe91a648f042fc3fb278df663de5" +> (get-id baby-fish-2) +"3e64e5c20fb742dd88dac1032749c2fd" +> (get-children-count mommy-fish) +2 +> (get-info mommy-fish) +id: 47eebe91a648f042fc3fb278df663de5 +species: Carp +children: ["fdcf35983bb496650e558a82e34c9935", + "3e64e5c20fb742dd88dac1032749c2fd"] +ok diff --git a/Task/Call-an-object-method/Lingo/call-an-object-method.lingo b/Task/Call-an-object-method/Lingo/call-an-object-method.lingo new file mode 100644 index 0000000000..399ddffe42 --- /dev/null +++ b/Task/Call-an-object-method/Lingo/call-an-object-method.lingo @@ -0,0 +1,6 @@ +-- call static method +script("MyClass").foo() + +-- call instance method +obj = script("MyClass").new() +obj.foo() diff --git a/Task/Call-an-object-method/Nim/call-an-object-method.nim b/Task/Call-an-object-method/Nim/call-an-object-method.nim new file mode 100644 index 0000000000..1bea5eaa84 --- /dev/null +++ b/Task/Call-an-object-method/Nim/call-an-object-method.nim @@ -0,0 +1,3 @@ +var x = @[1, 2, 3] +add(x, 4) +x.add(5) diff --git a/Task/Call-an-object-method/Oforth/call-an-object-method-1.oforth b/Task/Call-an-object-method/Oforth/call-an-object-method-1.oforth new file mode 100644 index 0000000000..52d9e6d813 --- /dev/null +++ b/Task/Call-an-object-method/Oforth/call-an-object-method-1.oforth @@ -0,0 +1 @@ +1.2 sqrt diff --git a/Task/Call-an-object-method/Oforth/call-an-object-method-2.oforth b/Task/Call-an-object-method/Oforth/call-an-object-method-2.oforth new file mode 100644 index 0000000000..f42f090769 --- /dev/null +++ b/Task/Call-an-object-method/Oforth/call-an-object-method-2.oforth @@ -0,0 +1 @@ +Date now diff --git a/Task/Call-an-object-method/Ring/call-an-object-method-1.ring b/Task/Call-an-object-method/Ring/call-an-object-method-1.ring new file mode 100644 index 0000000000..78b0489d59 --- /dev/null +++ b/Task/Call-an-object-method/Ring/call-an-object-method-1.ring @@ -0,0 +1,4 @@ +new point { print() } +Class Point + x = 10 y = 20 z = 30 + func print see x + nl + y + nl + z + nl diff --git a/Task/Call-an-object-method/Ring/call-an-object-method-2.ring b/Task/Call-an-object-method/Ring/call-an-object-method-2.ring new file mode 100644 index 0000000000..8d7d44530e --- /dev/null +++ b/Task/Call-an-object-method/Ring/call-an-object-method-2.ring @@ -0,0 +1,7 @@ +o1 = new System.output.console +o1.print("Hello World") + +Package System.Output + Class Console + Func Print cText + see cText + nl diff --git a/Task/Call-an-object-method/Sidef/call-an-object-method.sidef b/Task/Call-an-object-method/Sidef/call-an-object-method.sidef new file mode 100644 index 0000000000..70e3f6ef2e --- /dev/null +++ b/Task/Call-an-object-method/Sidef/call-an-object-method.sidef @@ -0,0 +1,23 @@ +class MyClass { + method foo(arg) { say arg } +} + +var arg = 42; + +# Call a class method +MyClass.foo(arg); + +# Alternatively, using an expression for the method name +MyClass.(:foo)(arg); + +# Create an instance +var instance = MyClass(); + +# Instance method +instance.foo(arg); + +# Alternatively, by using an expression for the method name +instance.(:foo)(arg); + +# Alternatively, by asking for a method +instance.method(:foo)(arg); diff --git a/Task/Call-an-object-method/Swift/call-an-object-method.swift b/Task/Call-an-object-method/Swift/call-an-object-method.swift new file mode 100644 index 0000000000..ade99a2f28 --- /dev/null +++ b/Task/Call-an-object-method/Swift/call-an-object-method.swift @@ -0,0 +1,11 @@ +// Class +MyClass.method(someParameter) +// or equivalently: +let foo = MyClass.self +foo.method(someParameter) + +// Instance +myInstance.method(someParameter) + +// Method with multiple arguments +myInstance.method(red:arg1, green:arg2, blue:arg3) diff --git a/Task/Call-an-object-method/Ursa/call-an-object-method.ursa b/Task/Call-an-object-method/Ursa/call-an-object-method.ursa new file mode 100644 index 0000000000..c1fb243821 --- /dev/null +++ b/Task/Call-an-object-method/Ursa/call-an-object-method.ursa @@ -0,0 +1,5 @@ +# create an instance of the built-in file class +decl file f + +# call the file.open method +f.open "filename.txt" diff --git a/Task/Call-an-object-method/XLISP/call-an-object-method.xlisp b/Task/Call-an-object-method/XLISP/call-an-object-method.xlisp new file mode 100644 index 0000000000..f9e3a20ef4 --- /dev/null +++ b/Task/Call-an-object-method/XLISP/call-an-object-method.xlisp @@ -0,0 +1,23 @@ +(DEFINE-CLASS MY-CLASS) + +(DEFINE-CLASS-METHOD (MY-CLASS 'DO-SOMETHING-WITH SOME-PARAMETER) + (DISPLAY "I am the class -- ") + (DISPLAY SELF) + (NEWLINE) + (DISPLAY "You sent me the parameter ") + (DISPLAY SOME-PARAMETER) + (NEWLINE)) + +(DEFINE-METHOD (MY-CLASS 'DO-SOMETHING-WITH SOME-PARAMETER) + (DISPLAY "I am an instance of the class -- ") + (DISPLAY SELF) + (NEWLINE) + (DISPLAY "You sent me the parameter ") + (DISPLAY SOME-PARAMETER) + (NEWLINE)) + +(MY-CLASS 'DO-SOMETHING-WITH 'FOO) + +(DEFINE MY-INSTANCE (MY-CLASS 'NEW)) + +(MY-INSTANCE 'DO-SOMETHING-WITH 'BAR) diff --git a/Task/Carmichael-3-strong-pseudoprimes/EchoLisp/carmichael-3-strong-pseudoprimes-1.echolisp b/Task/Carmichael-3-strong-pseudoprimes/EchoLisp/carmichael-3-strong-pseudoprimes-1.echolisp new file mode 100644 index 0000000000..8f974d6577 --- /dev/null +++ b/Task/Carmichael-3-strong-pseudoprimes/EchoLisp/carmichael-3-strong-pseudoprimes-1.echolisp @@ -0,0 +1,14 @@ +;; charmichaël numbers up to N-th prime ; 61 is 18-th prime +(define (charms (N 18) local: (h31 0) (Prime2 0) (Prime3 0)) +(for* ((Prime1 (primes N)) + (h3 (in-range 1 Prime1)) + (d (+ h3 Prime1))) + (set! h31 (+ h3 Prime1)) + #:continue (!zero? (modulo (* h31 (1- Prime1)) d)) + #:continue (!= (modulo d h3) (modulo (- (* Prime1 Prime1)) h3)) + (set! Prime2 (1+ ( * (1- Prime1) (quotient h31 d)))) + #:when (prime? Prime2) + (set! Prime3 (1+ (quotient (* Prime1 Prime2) h3))) + #:when (prime? Prime3) + #:when (= 1 (modulo (* Prime2 Prime3) (1- Prime1))) + (printf " 💥 %12d = %d x %d x %d" (* Prime1 Prime2 Prime3) Prime1 Prime2 Prime3))) diff --git a/Task/Carmichael-3-strong-pseudoprimes/EchoLisp/carmichael-3-strong-pseudoprimes-2.echolisp b/Task/Carmichael-3-strong-pseudoprimes/EchoLisp/carmichael-3-strong-pseudoprimes-2.echolisp new file mode 100644 index 0000000000..ec2c78aaa2 --- /dev/null +++ b/Task/Carmichael-3-strong-pseudoprimes/EchoLisp/carmichael-3-strong-pseudoprimes-2.echolisp @@ -0,0 +1,22 @@ +(charms 3) +💥 561 = 3 x 11 x 17 +💥 10585 = 5 x 29 x 73 +💥 2465 = 5 x 17 x 29 +💥 1105 = 5 x 13 x 17 + +(charms 18) +;; skipped .... +💥 902645857 = 47 x 3727 x 5153 +💥 2632033 = 53 x 53 x 937 +💥 17316001 = 53 x 157 x 2081 +💥 4335241 = 53 x 157 x 521 +💥 178837201 = 59 x 1451 x 2089 +💥 329769721 = 61 x 421 x 12841 +💥 60957361 = 61 x 181 x 5521 +💥 6924781 = 61 x 61 x 1861 +💥 6924781 = 61 x 61 x 1861 +💥 15247621 = 61 x 181 x 1381 +💥 99036001 = 61 x 541 x 3001 +💥 101649241 = 61 x 661 x 2521 +💥 6189121 = 61 x 241 x 421 +💥 824389441 = 61 x 3361 x 4021 diff --git a/Task/Carmichael-3-strong-pseudoprimes/FreeBASIC/carmichael-3-strong-pseudoprimes.freebasic b/Task/Carmichael-3-strong-pseudoprimes/FreeBASIC/carmichael-3-strong-pseudoprimes.freebasic new file mode 100644 index 0000000000..c1dbbde7c6 --- /dev/null +++ b/Task/Carmichael-3-strong-pseudoprimes/FreeBASIC/carmichael-3-strong-pseudoprimes.freebasic @@ -0,0 +1,59 @@ +' version 17-10-2016 +' compile with: fbc -s console + +' using a sieve for finding primes + +#Define max_sieve 10000000 ' 10^7 +ReDim Shared As Byte isprime(max_sieve) + +' translated the pseudo code to FreeBASIC +Sub carmichael3(p1 As Integer) + + If isprime(p1) = 0 Then Exit Sub + + Dim As Integer h3, d, p2, p3, t1, t2 + + For h3 = 1 To p1 -1 + t1 = (h3 + p1) * (p1 -1) + t2 = (-p1 * p1) Mod h3 + If t2 < 0 Then t2 = t2 + h3 + For d = 1 To h3 + p1 -1 + If t1 Mod d = 0 And t2 = (d Mod h3) Then + p2 = 1 + (t1 \ d) + If isprime(p2) = 0 Then Continue For + p3 = 1 + (p1 * p2 \ h3) + If isprime(p3) = 0 Or ((p2 * p3) Mod (p1 -1)) <> 1 Then Continue For + Print Using "### * #### * #####"; p1; p2; p3 + End If + Next d + Next h3 +End Sub + + +' ------=< MAIN >=------ + +Dim As UInteger i, j + +'set up sieve +For i = 3 To max_sieve Step 2 + isprime(i) = 1 +Next i + +isprime(2) = 1 +For i = 3 To Sqr(max_sieve) Step 2 + If isprime(i) = 1 Then + For j = i * i To max_sieve Step i * 2 + isprime(j) = 0 + Next j + End If +Next i + +For i = 2 To 61 + carmichael3(i) +Next i + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Carmichael-3-strong-pseudoprimes/Sidef/carmichael-3-strong-pseudoprimes.sidef b/Task/Carmichael-3-strong-pseudoprimes/Sidef/carmichael-3-strong-pseudoprimes.sidef new file mode 100644 index 0000000000..53a2160332 --- /dev/null +++ b/Task/Carmichael-3-strong-pseudoprimes/Sidef/carmichael-3-strong-pseudoprimes.sidef @@ -0,0 +1,21 @@ +func forprimes(a, b, callback) { + for (a = (a-1 -> next_prime); a <= b; a.next_prime!) { + callback(a) + } +} + +forprimes(3, 61, func(p) { + for h3 in (2 .. p-1) { + var ph3 = (p + h3) + for d in (1 .. ph3-1) { + ((-p * p) % h3) != (d % h3) && next + ((p-1) * ph3) % d && next + var q = 1+((p-1) * ph3 / d) + q.is_prime || next + var r = 1+((p*q - 1)/h3) + r.is_prime || next + (q*r) % (p-1) == 1 || next + printf("%2d x %5d x %5d = %s\n",p,q,r, p*q*r) + } + } +}) diff --git a/Task/Case-sensitivity-of-identifiers/EchoLisp/case-sensitivity-of-identifiers.echolisp b/Task/Case-sensitivity-of-identifiers/EchoLisp/case-sensitivity-of-identifiers.echolisp new file mode 100644 index 0000000000..6a1250ce66 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/EchoLisp/case-sensitivity-of-identifiers.echolisp @@ -0,0 +1,6 @@ +(define dog "Benjamin") +(define Dog "Samba") +(define DOG "Bernie") + +(printf "The three dogs are named %a, %a and %a. " dog Dog DOG) + The three dogs are named Benjamin, Samba and Bernie. diff --git a/Task/Case-sensitivity-of-identifiers/FreeBASIC/case-sensitivity-of-identifiers.freebasic b/Task/Case-sensitivity-of-identifiers/FreeBASIC/case-sensitivity-of-identifiers.freebasic new file mode 100644 index 0000000000..25e6b14226 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/FreeBASIC/case-sensitivity-of-identifiers.freebasic @@ -0,0 +1,9 @@ +' FB 1.05.0 Win64 + +' FreeBASIC is case-insensitive +Dim dog As String +dog = "Benjamin" +Dog = "Samba" +DOG = "Bernie" +Print "There is just one dog, named "; dog +Sleep diff --git a/Task/Case-sensitivity-of-identifiers/Lasso/case-sensitivity-of-identifiers-1.lasso b/Task/Case-sensitivity-of-identifiers/Lasso/case-sensitivity-of-identifiers-1.lasso new file mode 100644 index 0000000000..2e9b40c71a --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Lasso/case-sensitivity-of-identifiers-1.lasso @@ -0,0 +1,5 @@ +local(dog = 'Benjamin') +local(Dog = 'Samba') +local(DOG = 'Bernie') + +stdoutnl('There is just one dog named ' + #dog) diff --git a/Task/Case-sensitivity-of-identifiers/Lasso/case-sensitivity-of-identifiers-2.lasso b/Task/Case-sensitivity-of-identifiers/Lasso/case-sensitivity-of-identifiers-2.lasso new file mode 100644 index 0000000000..311c160815 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Lasso/case-sensitivity-of-identifiers-2.lasso @@ -0,0 +1,6 @@ +local(dogs = map( + 'dog' = 'Benjamin', + 'Dog' = 'Samba', + 'DOG' = 'Bernie' +)) +stdoutnl(#dogs -> size) diff --git a/Task/Case-sensitivity-of-identifiers/Lasso/case-sensitivity-of-identifiers-3.lasso b/Task/Case-sensitivity-of-identifiers/Lasso/case-sensitivity-of-identifiers-3.lasso new file mode 100644 index 0000000000..b59e70b37f --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Lasso/case-sensitivity-of-identifiers-3.lasso @@ -0,0 +1,9 @@ +local(dogs = map( + bytes('dog') = 'Benjamin', + bytes('Dog') = 'Samba', + bytes('DOG') = 'Bernie' +)) + +stdoutnl(#dogs -> size) + +stdoutnl(#dogs -> find(bytes('Dog'))) diff --git a/Task/Case-sensitivity-of-identifiers/NESL/case-sensitivity-of-identifiers.nesl b/Task/Case-sensitivity-of-identifiers/NESL/case-sensitivity-of-identifiers.nesl new file mode 100644 index 0000000000..09d8ce6f1f --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/NESL/case-sensitivity-of-identifiers.nesl @@ -0,0 +1,4 @@ +dog = "Benjamin"; +Dog = "Samba"; +DOG = "Bernie"; +"There is just one dog, named " ++ dog; diff --git a/Task/Case-sensitivity-of-identifiers/Nim/case-sensitivity-of-identifiers.nim b/Task/Case-sensitivity-of-identifiers/Nim/case-sensitivity-of-identifiers.nim new file mode 100644 index 0000000000..6ac96626fb --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Nim/case-sensitivity-of-identifiers.nim @@ -0,0 +1,4 @@ +var dog = "Benjamin" +Dog = "Samba" +DOG = "Bernie" +echo("There is just one dog named " & doG) diff --git a/Task/Case-sensitivity-of-identifiers/Oforth/case-sensitivity-of-identifiers.oforth b/Task/Case-sensitivity-of-identifiers/Oforth/case-sensitivity-of-identifiers.oforth new file mode 100644 index 0000000000..3ccf6a70e9 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Oforth/case-sensitivity-of-identifiers.oforth @@ -0,0 +1,8 @@ +: threeDogs +| dog Dog DOG | + + "Benjamin" ->dog + "Samba" ->Dog + "Bernie" ->DOG + + System.Out "The three dogs are named " << dog << ", " << Dog << " and " << DOG << "." << cr ; diff --git a/Task/Case-sensitivity-of-identifiers/Phix/case-sensitivity-of-identifiers.phix b/Task/Case-sensitivity-of-identifiers/Phix/case-sensitivity-of-identifiers.phix new file mode 100644 index 0000000000..b80078f853 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Phix/case-sensitivity-of-identifiers.phix @@ -0,0 +1,4 @@ +sequence dog = "Benjamin" +sequence Dog = "Samba" +sequence DOG = "Bernie" +printf( 1, "The three dogs are named %s, %s and %s\n", {dog, Dog, DOG} ) diff --git a/Task/Case-sensitivity-of-identifiers/Ring/case-sensitivity-of-identifiers.ring b/Task/Case-sensitivity-of-identifiers/Ring/case-sensitivity-of-identifiers.ring new file mode 100644 index 0000000000..bc3285617c --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Ring/case-sensitivity-of-identifiers.ring @@ -0,0 +1,5 @@ +dog = "Benjamin" +doG = "Smokey" +Dog = "Samba" +DOG = "Bernie" +see "The 4 dogs are : " + dog + ", " + doG + ", " + Dog + " and " + DOG + "." diff --git a/Task/Case-sensitivity-of-identifiers/Sidef/case-sensitivity-of-identifiers.sidef b/Task/Case-sensitivity-of-identifiers/Sidef/case-sensitivity-of-identifiers.sidef new file mode 100644 index 0000000000..f9f728444a --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Sidef/case-sensitivity-of-identifiers.sidef @@ -0,0 +1,4 @@ +var dog = 'Benjamin'; +var Dog = 'Samba'; +var DOG = 'Bernie'; +say "The three dogs are named #{dog}, #{Dog}, and #{DOG}."; diff --git a/Task/Case-sensitivity-of-identifiers/Swift/case-sensitivity-of-identifiers.swift b/Task/Case-sensitivity-of-identifiers/Swift/case-sensitivity-of-identifiers.swift new file mode 100644 index 0000000000..b027c8aadd --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Swift/case-sensitivity-of-identifiers.swift @@ -0,0 +1,4 @@ +let dog = "Benjamin" +let Dog = "Samba" +let DOG = "Bernie" +println("The three dogs are named \(dog), \(Dog), and \(DOG).") diff --git a/Task/Case-sensitivity-of-identifiers/Ursa/case-sensitivity-of-identifiers.ursa b/Task/Case-sensitivity-of-identifiers/Ursa/case-sensitivity-of-identifiers.ursa new file mode 100644 index 0000000000..0173b336e5 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Ursa/case-sensitivity-of-identifiers.ursa @@ -0,0 +1,7 @@ +> decl string dog Dog DOG +> set dog "Benjamin" +> set Dog "Samba" +> set DOG "Bernie" +> out "The three dogs are named " dog ", " Dog ", and " DOG endl console +The three dogs are named Benjamin, Samba, and Bernie +> diff --git a/Task/Case-sensitivity-of-identifiers/XLISP/case-sensitivity-of-identifiers.xlisp b/Task/Case-sensitivity-of-identifiers/XLISP/case-sensitivity-of-identifiers.xlisp new file mode 100644 index 0000000000..1ea56975e3 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/XLISP/case-sensitivity-of-identifiers.xlisp @@ -0,0 +1,4 @@ +(SETQ DOG 'BENJAMIN) +(SETQ Dog 'SAMBA) +(SETQ dog 'BERNIE) +(DISPLAY `(THERE IS JUST ONE DOG NAMED ,DOG)) diff --git a/Task/Case-sensitivity-of-identifiers/jq/case-sensitivity-of-identifiers-1.jq b/Task/Case-sensitivity-of-identifiers/jq/case-sensitivity-of-identifiers-1.jq new file mode 100644 index 0000000000..52354b1fad --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/jq/case-sensitivity-of-identifiers-1.jq @@ -0,0 +1,4 @@ +def task(dog; Dog; DOG): + "The three dogs are named \(dog), \(Dog), and \(DOG)." ; + +task("Benjamin"; "Samba"; "Bernie") diff --git a/Task/Case-sensitivity-of-identifiers/jq/case-sensitivity-of-identifiers-2.jq b/Task/Case-sensitivity-of-identifiers/jq/case-sensitivity-of-identifiers-2.jq new file mode 100644 index 0000000000..78ed47c89f --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/jq/case-sensitivity-of-identifiers-2.jq @@ -0,0 +1,2 @@ +"Benjamin" as $dog | "Samba" as $Dog | "Bernie" as $DOG + | "The three dogs are named \($dog), \($Dog), and \($DOG)." diff --git a/Task/Casting-out-nines/Nim/casting-out-nines.nim b/Task/Casting-out-nines/Nim/casting-out-nines.nim new file mode 100644 index 0000000000..21d3200d68 --- /dev/null +++ b/Task/Casting-out-nines/Nim/casting-out-nines.nim @@ -0,0 +1,23 @@ +import sequtils + +iterator castOut(base = 10, start = 1, ending = 999_999) = + var ran: seq[int] = @[] + for y in 0 .. ending: + break outer + yield k + inc x + +echo toSeq(castOut(base=16, start=1, ending=255)) diff --git a/Task/Casting-out-nines/jq/casting-out-nines-1.jq b/Task/Casting-out-nines/jq/casting-out-nines-1.jq new file mode 100644 index 0000000000..ab03fdae6a --- /dev/null +++ b/Task/Casting-out-nines/jq/casting-out-nines-1.jq @@ -0,0 +1,6 @@ +def co9: + def digits: tostring | explode | map(. - 48); # "0" is 48 + if . == 9 then 0 + elif 0 <= . and . <= 8 then . + else digits | add | co9 + end; diff --git a/Task/Casting-out-nines/jq/casting-out-nines-2.jq b/Task/Casting-out-nines/jq/casting-out-nines-2.jq new file mode 100644 index 0000000000..b1c675b9d5 --- /dev/null +++ b/Task/Casting-out-nines/jq/casting-out-nines-2.jq @@ -0,0 +1 @@ +def co9_equals_co9_squared: co9 == ((.*.)|co9); diff --git a/Task/Casting-out-nines/jq/casting-out-nines-3.jq b/Task/Casting-out-nines/jq/casting-out-nines-3.jq new file mode 100644 index 0000000000..936d5bc472 --- /dev/null +++ b/Task/Casting-out-nines/jq/casting-out-nines-3.jq @@ -0,0 +1 @@ +[range (1;101) | select( co9_equals_co9_squared ) diff --git a/Task/Casting-out-nines/jq/casting-out-nines-4.jq b/Task/Casting-out-nines/jq/casting-out-nines-4.jq new file mode 100644 index 0000000000..7b05162a7c --- /dev/null +++ b/Task/Casting-out-nines/jq/casting-out-nines-4.jq @@ -0,0 +1 @@ +[ range(1;101) | select(is_kaprekar) ] diff --git a/Task/Casting-out-nines/jq/casting-out-nines-5.jq b/Task/Casting-out-nines/jq/casting-out-nines-5.jq new file mode 100644 index 0000000000..026aa485cd --- /dev/null +++ b/Task/Casting-out-nines/jq/casting-out-nines-5.jq @@ -0,0 +1,3 @@ +def verify: + range(1; .) + | select(is_kaprekar and (co9_equals_co9_squared | not)); diff --git a/Task/Casting-out-nines/jq/casting-out-nines-6.jq b/Task/Casting-out-nines/jq/casting-out-nines-6.jq new file mode 100644 index 0000000000..abde868dda --- /dev/null +++ b/Task/Casting-out-nines/jq/casting-out-nines-6.jq @@ -0,0 +1,5 @@ +def proportion(base): + def count(stream): reduce stream as $i (0; . + 1); + . as $n + | (base - 1) as $b + | count( range(1; 1+$n) | select( . % $b == (.*.) % $b) ) / $n ; diff --git a/Task/Casting-out-nines/jq/casting-out-nines-7.jq b/Task/Casting-out-nines/jq/casting-out-nines-7.jq new file mode 100644 index 0000000000..7c666f2097 --- /dev/null +++ b/Task/Casting-out-nines/jq/casting-out-nines-7.jq @@ -0,0 +1,5 @@ +0.3 +0.27 +0.267 +0.2667 +0.26667 diff --git a/Task/Catalan-numbers-Pascals-triangle/ERRE/catalan-numbers-pascals-triangle.erre b/Task/Catalan-numbers-Pascals-triangle/ERRE/catalan-numbers-pascals-triangle.erre new file mode 100644 index 0000000000..c479b34612 --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/ERRE/catalan-numbers-pascals-triangle.erre @@ -0,0 +1,38 @@ +PROGRAM CATALAN + +!$DOUBLE + +DIM CATALAN[50] + +FUNCTION ODD(X) + ODD=FRC(X/2)<>0 +END FUNCTION + +PROCEDURE GETCATALAN(L) + LOCAL J,K,W + LOCAL DIM PASTRI[100] + + L=L*2 + PASTRI[0]=1 + J=0 + WHILE J=------ + +Dim As Integer count, row +Dim As ULongInt triangle(1 To size, 1 To size) + +pascal_triangle(size, triangle()) + +' 1 1 1 1 1 1 +' 1 2 3 4 5 6 +' 1 3 6 10 15 21 +' 1 4 10 20 35 56 +' 1 5 15 35 70 126 +' 1 6 21 56 126 252 +' The Pascal triangle is rotated 45 deg. +' to find the Catalan number we need to follow the diagonal +' for top left to bottom right +' take the number on diagonal and subtract the number in de cell +' one up and one to right +' 1 (2 - 1), 2 (6 - 4), 5 (20 - 15) ... + + +Print "The first 15 Catalan numbers are" : print +count = 1 : row = 2 +Do + Print Using "###: #########"; count; triangle(row, row) - triangle(row +1, row -1) + row = row + 1 + count = count + 1 +Loop Until count > 15 + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Catalan-numbers-Pascals-triangle/Nim/catalan-numbers-pascals-triangle.nim b/Task/Catalan-numbers-Pascals-triangle/Nim/catalan-numbers-pascals-triangle.nim new file mode 100644 index 0000000000..7da80f6b38 --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/Nim/catalan-numbers-pascals-triangle.nim @@ -0,0 +1,9 @@ +const n = 15 +var t = newSeq[int](n + 2) + +t[1] = 1 +for i in 1..n: + for j in countdown(i, 1): t[j] += t[j-1] + t[i+1] = t[i] + for j in countdown(i+1, 1): t[j] += t[j-1] + stdout.write t[i+1] - t[i], " " diff --git a/Task/Catalan-numbers-Pascals-triangle/Oforth/catalan-numbers-pascals-triangle.oforth b/Task/Catalan-numbers-Pascals-triangle/Oforth/catalan-numbers-pascals-triangle.oforth new file mode 100644 index 0000000000..e9f782c14e --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/Oforth/catalan-numbers-pascals-triangle.oforth @@ -0,0 +1,2 @@ +: pascal(n) [ 1 ] #[ dup 0 + 0 rot + zipWith(#+) ] times(n) ; +: catalan(n) pascal(n 2 * ) at(n 1+) n 1+ / ; diff --git a/Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-1.phix b/Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-1.phix new file mode 100644 index 0000000000..bdb1b093c4 --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-1.phix @@ -0,0 +1,14 @@ +constant N = 15 -- accurate to 30, nan/inf for anything over 514 (bigatom version is below). +sequence catalan = {}, -- (>=1 only) + p = repeat(1,N+1) +atom p1 +for i=1 to N do + p1 = p[1]*2 + catalan = append(catalan,p1-p[2]) + for j=1 to N-i+1 do + p1 += p[j+1] + p[j] = p1 + end for +-- ?p[1..N-i+1] +end for +?catalan diff --git a/Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-2.phix b/Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-2.phix new file mode 100644 index 0000000000..0160f60fe9 --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-2.phix @@ -0,0 +1,33 @@ +-- FreeBASIC said: +--' 1 1 1 1 1 1 +--' 1 2 3 4 5 6 +--' 1 3 6 10 15 21 +--' 1 4 10 20 35 56 +--' 1 5 15 35 70 126 +--' 1 6 21 56 126 252 +--' The Pascal triangle is rotated 45 deg. +--' to find the Catalan number we need to follow the diagonal +--' for top left to bottom right +--' take the number on diagonal and subtract the number in de cell +--' one up and one to right +--' 1 (2 - 1), 2 (6 - 4), 5 (20 - 15) ... +-- +-- The first thing that struck me was it is twice as big as it needs to be, +-- something like this would do... +-- 1 1 1 1 1 1 +-- 2 3 4 5 6 +-- 6 10 15 21 +-- 20 35 56 +-- 70 126 +-- 252 +-- It is more obvious from the upper square that the diagonal on that, which is +-- that same as column 1 on this, is twice the previous, which on the second +-- diagram is in column 2. Further, once we have calculated the value for column +-- one above, we can use it immediately to calculate the next catalan number and +-- do not need to store it. Lastly we can overwrite row 1 with row 2 etc in situ, +-- and the following shows what we need for subsequent rounds: +-- 1 1 1 1 1 +-- 3 4 5 6 +-- 10 15 21 +-- 35 56 +-- 126 (unused) diff --git a/Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-3.phix b/Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-3.phix new file mode 100644 index 0000000000..7cb9545a0e --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-3.phix @@ -0,0 +1,24 @@ +include builtins\bigatom.e + +function catalanB(integer n) -- very very fast! +sequence catalan = {}, + p = repeat(1,n+1) +bigatom p1 + if n=0 then return 1 end if + for i=1 to n do + p1 = ba_multiply(p[1],2) + catalan = append(catalan,ba_sub(p1,p[2])) + for j=1 to n-i+1 do + p1 = ba_add(p1,p[j+1]) + p[j] = p1 + end for + end for + return catalan[n] +end function + +atom t0 = time() +string sc100 = ba_sprint(catalanB(100)) +printf(1,"%d: %s (%3.2fs)\n",{100,sc100,time()-t0}) +atom t0 = time() +string sc250 = ba_sprint(catalanB(250)) +printf(1,"%d: %s (%3.2fs)\n",{250,sc250,time()-t0}) diff --git a/Task/Catalan-numbers-Pascals-triangle/Ring/catalan-numbers-pascals-triangle.ring b/Task/Catalan-numbers-Pascals-triangle/Ring/catalan-numbers-pascals-triangle.ring new file mode 100644 index 0000000000..6a5d1be87c --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/Ring/catalan-numbers-pascals-triangle.ring @@ -0,0 +1,13 @@ +n=15 +cat = list(n+2) +cat[1]=1 +for i=1 to n + for j=i+1 to 2 step -1 + cat[j]=cat[j]+cat[j-1] + next + cat[i+1]=cat[i] + for j=i+2 to 2 step -1 + cat[j]=cat[j]+cat[j-1] + next + see "" + (cat[i+1]-cat[i]) + " " +next diff --git a/Task/Catalan-numbers-Pascals-triangle/Sidef/catalan-numbers-pascals-triangle.sidef b/Task/Catalan-numbers-Pascals-triangle/Sidef/catalan-numbers-pascals-triangle.sidef new file mode 100644 index 0000000000..23f5890926 --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/Sidef/catalan-numbers-pascals-triangle.sidef @@ -0,0 +1,11 @@ +func catalan(num) { + var t = [0, 1]; + range(1, num).map { |i| + range(i, 1, -1).each {|j| t[j] += t[j-1]}; + t[i+1] = t[i]; + range(i+1, 1, -1).each {|j| t[j] += t[j-1]}; + t[i+1] - t[i]; + } +} + +say catalan(15).join(' '); diff --git a/Task/Catalan-numbers-Pascals-triangle/jq/catalan-numbers-pascals-triangle-1.jq b/Task/Catalan-numbers-Pascals-triangle/jq/catalan-numbers-pascals-triangle-1.jq new file mode 100644 index 0000000000..c532dbfb6c --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/jq/catalan-numbers-pascals-triangle-1.jq @@ -0,0 +1,7 @@ +def binomial(n; k): + if k > n / 2 then binomial(n; n-k) + else reduce range(1; k+1) as $i (1; . * (n - $i + 1) / $i) + end; + +# Direct (naive) computation using two numbers in Pascal's triangle: +def catalan_by_pascal: . as $n | binomial(2*$n; $n) - binomial(2*$n; $n-1); diff --git a/Task/Catalan-numbers-Pascals-triangle/jq/catalan-numbers-pascals-triangle-2.jq b/Task/Catalan-numbers-Pascals-triangle/jq/catalan-numbers-pascals-triangle-2.jq new file mode 100644 index 0000000000..0b291e4291 --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/jq/catalan-numbers-pascals-triangle-2.jq @@ -0,0 +1,21 @@ +$ jq -n -c -f Catalan_numbers_Pascal.jq +[0,0] +[1,1] +[2,2] +[3,5] +[4,14] +[5,42] +[6,132] +[7,429] +[8,1430] +[9,4862] +[10,16796] +[11,58786] +[12,208012] +[13,742900] +[14,2674440] +[15,9694845] +[30,3814986502092304] +[31,14544636039226880] +[510,5.491717746183512e+302] +[511,null] diff --git a/Task/Catalan-numbers/ERRE/catalan-numbers.erre b/Task/Catalan-numbers/ERRE/catalan-numbers.erre new file mode 100644 index 0000000000..cf17d3e425 --- /dev/null +++ b/Task/Catalan-numbers/ERRE/catalan-numbers.erre @@ -0,0 +1,15 @@ +PROGRAM CATALAN + +PROCEDURE CATALAN(N->RES) + RES=1 + FOR I=1 TO N DO + RES=RES*2*(2*I-1)/(I+1) + END FOR +END PROCEDURE + +BEGIN + FOR N=0 TO 15 DO + CATALAN(N->RES) + PRINT(N;"=";RES) + END FOR +END PROGRAM diff --git a/Task/Catalan-numbers/EchoLisp/catalan-numbers.echolisp b/Task/Catalan-numbers/EchoLisp/catalan-numbers.echolisp new file mode 100644 index 0000000000..65ac46bf72 --- /dev/null +++ b/Task/Catalan-numbers/EchoLisp/catalan-numbers.echolisp @@ -0,0 +1,37 @@ +(lib 'sequences) +(lib 'bigint) +(lib 'math) + +;; function definition +(define (C1 n) (/ (factorial (* n 2)) (factorial (1+ n)) (factorial n))) +(for ((i [1 .. 16])) (write (C1 i))) + → 1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845 + +;; using a recursive procedure with memoization +(define (C2 n) ;; ( Σ ...)is the same as (sigma ..) + (Σ (lambda(i) (* (C2 i) (C2 (- n i 1)))) 0 (1- n))) +(remember 'C2 #(1)) ;; first term defined here + +(for ((i [1 .. 16])) (write (C2 i))) + → 1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845 + + +;; using procrastinators = infinite sequence +(define (catalan n acc) (/ (* acc 2 (1- (* 2 n))) (1+ n))) +(define C3 (scanl catalan 1 [1 ..])) +(take C3 15) + → (1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845) + + +;; the same, using infix notation +(lib 'match) +(load 'infix.glisp) + +(define (catalan n acc) ((2 * acc * ( 2 * n - 1)) / (n + 1))) +(define C3 (scanl catalan 1 [1 ..])) + +(take C3 15) + → (1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845) +;; or +(for ((c C3) (i 15)) (write c)) + → 1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845 diff --git a/Task/Catalan-numbers/FreeBASIC/catalan-numbers.freebasic b/Task/Catalan-numbers/FreeBASIC/catalan-numbers.freebasic new file mode 100644 index 0000000000..2d85c985f5 --- /dev/null +++ b/Task/Catalan-numbers/FreeBASIC/catalan-numbers.freebasic @@ -0,0 +1,38 @@ +' FB 1.05.0 Win64 + +Function factorial(n As UInteger) As UInteger + If n = 0 Then Return 1 + Return n * factorial(n - 1) +End Function + +Function catalan1(n As UInteger) As UInteger + Dim prod As UInteger = 1 + For i As UInteger = n + 2 To 2 * n + prod *= i + Next + Return prod / factorial(n) +End Function + +Function catalan2(n As UInteger) As UInteger + If n = 0 Then Return 1 + Dim sum As UInteger = 0 + For i As UInteger = 0 To n - 1 + sum += catalan2(i) * catalan2(n - 1 - i) + Next + Return sum +End Function + +Function catalan3(n As UInteger) As UInteger + If n = 0 Then Return 1 + Return catalan3(n - 1) * 2 * (2 * n - 1) \ (n + 1) +End Function + +Print "n", "First", "Second", "Third" +Print "-", "-----", "------", "-----" +Print +For i As UInteger = 0 To 15 + Print i, catalan1(i), catalan2(i), catalan3(i) +Next +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Catalan-numbers/FunL/catalan-numbers.funl b/Task/Catalan-numbers/FunL/catalan-numbers.funl new file mode 100644 index 0000000000..a2ee6c4519 --- /dev/null +++ b/Task/Catalan-numbers/FunL/catalan-numbers.funl @@ -0,0 +1,22 @@ +import integers.choose +import util.TextTable + +def + catalan( n ) = choose( 2n, n )/(n + 1) + + catalan2( n ) = product( (n + k)/k | k <- 2..n ) + + catalan3( 0 ) = 1 + catalan3( n ) = 2*(2n - 1)/(n + 1)*catalan3( n - 1 ) + +t = TextTable() +t.header( 'n', 'definition', 'product', 'recursive' ) +t.line() + +for i <- 1..4 + t.rightAlignment( i ) + +for i <- 0..15 + t.row( i, catalan(i), catalan2(i), catalan3(i) ) + +println( t ) diff --git a/Task/Catalan-numbers/Harbour/catalan-numbers.harbour b/Task/Catalan-numbers/Harbour/catalan-numbers.harbour new file mode 100644 index 0000000000..d56e2ef948 --- /dev/null +++ b/Task/Catalan-numbers/Harbour/catalan-numbers.harbour @@ -0,0 +1,17 @@ +PROCEDURE Main() + LOCAL i + + FOR i := 0 to 15 + ? PadL( i, 2 ) + ": " + hb_StrFormat("%d", Catalan( i )) + NEXT + + RETURN + +STATIC FUNCTION Catalan( n ) + LOCAL i, nCatalan := 1 + + FOR i := 1 TO n + nCatalan := nCatalan * 2 * (2 * i - 1) / (i + 1) + NEXT + + RETURN nCatalan diff --git a/Task/Catalan-numbers/Nim/catalan-numbers.nim b/Task/Catalan-numbers/Nim/catalan-numbers.nim new file mode 100644 index 0000000000..1227a963fc --- /dev/null +++ b/Task/Catalan-numbers/Nim/catalan-numbers.nim @@ -0,0 +1,33 @@ +import strutils + +proc binomial(m, n): auto = + result = 1 + var + d = m - n + n = n + m = m + if d > n: + n = d + + while m > n: + result *= m + dec m + while d > 1 and (result mod d) == 0: + result = result div d + dec d + +proc catalan1(n): auto = + binomial(2 * n, n) div (n + 1) + +proc catalan2(n): auto = + if n == 0: + result = 1 + for i in 0 .. 0: 2 * (2 * n - 1) * catalan3(n - 1) div (1 + n) + else: 1 + +for i in 0..15: + echo align($i, 7), " ", align($catalan1(i), 7), " ", align($catalan2(i), 7), " ", align($catalan3(i), 7) diff --git a/Task/Catalan-numbers/Oforth/catalan-numbers.oforth b/Task/Catalan-numbers/Oforth/catalan-numbers.oforth new file mode 100644 index 0000000000..1fdd5cc832 --- /dev/null +++ b/Task/Catalan-numbers/Oforth/catalan-numbers.oforth @@ -0,0 +1 @@ +: catalan(n) n ifZero: [ 1 ] else: [ catalan(n 1-) 2 n * 1- * 2 * n 1+ / ] ; diff --git a/Task/Catalan-numbers/Phix/catalan-numbers.phix b/Task/Catalan-numbers/Phix/catalan-numbers.phix new file mode 100644 index 0000000000..30cdbf3688 --- /dev/null +++ b/Task/Catalan-numbers/Phix/catalan-numbers.phix @@ -0,0 +1,53 @@ +-- returns inf/-nan for n>85, and needs the rounding for n>=14, accurate to n=29 +function catalan1(integer n) + return floor(factorial(2*n)/(factorial(n+1)*factorial(n))+0.5) +end function + +-- returns inf for n>519, accurate to n=30: +function catalan2(integer n) -- NB: very slow! +atom res = not n + n -= 1 + for i=0 to n do + res += catalan2(i)*catalan2(n-i) + end for + return res +end function + +-- returns inf for n>514, accurate to n=30: +function catalan3(integer n) + if n=0 then return 1 end if + return 2*(2*n-1)/(1+n)*catalan3(n-1) +end function + +for i=0 to 15 do + printf(1,"%2d: %10d %10d %10d\n",{i,catalan1(i),catalan2(i),catalan3(i)}) +end for + +-- An explicitly memoized version of what seems to be the best, and the one that really needed it: +-- (and in fact it turned out to be faster than similarly memoized versions of 1 and 3, when atom) +-- I also converted this to use bigatoms. + +include builtins\bigatom.e + +sequence c2cache = {} + +function catalan2bc(integer n) -- very fast! +object r -- result (a bigatom) + if n<=0 then return BA_ONE end if + if n<=length(c2cache) then + r = c2cache[n] + if r!=0 then return r end if + else + c2cache &= repeat(0,n-length(c2cache)) + end if + r = BA_ZERO + for i=0 to n-1 do + r = ba_add(r,ba_multiply(catalan2bc(i),catalan2bc(n-1-i))) + end for + c2cache[n] = r + return r +end function + +atom t0 = time() -- (this last call only) +string sc100 = ba_sprint(catalan2bc(100)) +printf(1,"100: %s (%3.2fs)\n",{sc100,time()-t0}) diff --git a/Task/Catalan-numbers/Ring/catalan-numbers.ring b/Task/Catalan-numbers/Ring/catalan-numbers.ring new file mode 100644 index 0000000000..89167711c0 --- /dev/null +++ b/Task/Catalan-numbers/Ring/catalan-numbers.ring @@ -0,0 +1,8 @@ +for n = 1 to 15 + see catalan(n) + nl +next + +func catalan n + if n = 0 return 1 ok + cat = 2 * (2 * n - 1) * catalan(n - 1) / (n + 1) + return cat diff --git a/Task/Catalan-numbers/Sidef/catalan-numbers-1.sidef b/Task/Catalan-numbers/Sidef/catalan-numbers-1.sidef new file mode 100644 index 0000000000..98e6025aca --- /dev/null +++ b/Task/Catalan-numbers/Sidef/catalan-numbers-1.sidef @@ -0,0 +1,2 @@ +func f(i) { i==0 ? 1 : (i * f(i-1)) } +func c(n) { f(2*n) / f(n) / f(n+1) } diff --git a/Task/Catalan-numbers/Sidef/catalan-numbers-2.sidef b/Task/Catalan-numbers/Sidef/catalan-numbers-2.sidef new file mode 100644 index 0000000000..afaef00e98 --- /dev/null +++ b/Task/Catalan-numbers/Sidef/catalan-numbers-2.sidef @@ -0,0 +1,3 @@ +func c(n) is cached { + n == 0 ? 1 : (c(n-1) * (4 * n - 2) / (n + 1)); +} diff --git a/Task/Catalan-numbers/Sidef/catalan-numbers-3.sidef b/Task/Catalan-numbers/Sidef/catalan-numbers-3.sidef new file mode 100644 index 0000000000..442641a20c --- /dev/null +++ b/Task/Catalan-numbers/Sidef/catalan-numbers-3.sidef @@ -0,0 +1,3 @@ +15.times { |i| + say "#{i-1}\t#{c(i-1)}"; +} diff --git a/Task/Catalan-numbers/Wortel/catalan-numbers.wortel b/Task/Catalan-numbers/Wortel/catalan-numbers.wortel new file mode 100644 index 0000000000..659715ec64 --- /dev/null +++ b/Task/Catalan-numbers/Wortel/catalan-numbers.wortel @@ -0,0 +1,6 @@ +; the following number expression calculcates the nth Catalan number +#~ddiFSFmSoFSn +; which stands for: dup dup inc fac swap fac mult swap double fac swap divide +; to get the first 15 Catalan numbers we map this function over a list from 0 to 15 +!*#~ddiFSFmSoFSn @til 15 +; returns [1 1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674439.9999999995] diff --git a/Task/Catalan-numbers/jq/catalan-numbers-1.jq b/Task/Catalan-numbers/jq/catalan-numbers-1.jq new file mode 100644 index 0000000000..24e16e1371 --- /dev/null +++ b/Task/Catalan-numbers/jq/catalan-numbers-1.jq @@ -0,0 +1,5 @@ +def catalan: + if . == 0 then 1 + elif . < 0 then error("catalan is not defined on \(.)") + else (2 * (2*. - 1) * ((. - 1) | catalan)) / (. + 1) + end; diff --git a/Task/Catalan-numbers/jq/catalan-numbers-2.jq b/Task/Catalan-numbers/jq/catalan-numbers-2.jq new file mode 100644 index 0000000000..aa6ff6aecf --- /dev/null +++ b/Task/Catalan-numbers/jq/catalan-numbers-2.jq @@ -0,0 +1 @@ +(range(0; 16), 100) as $i | $i | catalan | [$i, .] diff --git a/Task/Catalan-numbers/jq/catalan-numbers-3.jq b/Task/Catalan-numbers/jq/catalan-numbers-3.jq new file mode 100644 index 0000000000..7767689f64 --- /dev/null +++ b/Task/Catalan-numbers/jq/catalan-numbers-3.jq @@ -0,0 +1,18 @@ +$ jq -M -n -c -f Catalan_numbers.jq +[0,1] +[1,1] +[2,2] +[3,5] +[4,14] +[5,42] +[6,132] +[7,429] +[8,1430] +[9,4862] +[10,16796] +[11,58786] +[12,208012] +[13,742900] +[14,2674440] +[15,9694845] +[100,8.96519947090131e+56] diff --git a/Task/Catalan-numbers/jq/catalan-numbers-4.jq b/Task/Catalan-numbers/jq/catalan-numbers-4.jq new file mode 100644 index 0000000000..95c75156dd --- /dev/null +++ b/Task/Catalan-numbers/jq/catalan-numbers-4.jq @@ -0,0 +1,8 @@ +def catalan_series(max): + def _catalan: # state: [n, catalan(n)] + if .[0] > max then empty + else ., + ((.[0] + 1) as $n | .[1] as $cp + | [$n, (2 * (2*$n - 1) * $cp) / ($n + 1) ] | _catalan) + end; + [0,1] | _catalan; diff --git a/Task/Catalan-numbers/jq/catalan-numbers-5.jq b/Task/Catalan-numbers/jq/catalan-numbers-5.jq new file mode 100644 index 0000000000..d98d7fe1c4 --- /dev/null +++ b/Task/Catalan-numbers/jq/catalan-numbers-5.jq @@ -0,0 +1 @@ +catalan_series(15) diff --git a/Task/Catalan-numbers/jq/catalan-numbers-6.jq b/Task/Catalan-numbers/jq/catalan-numbers-6.jq new file mode 100644 index 0000000000..3e5b043486 --- /dev/null +++ b/Task/Catalan-numbers/jq/catalan-numbers-6.jq @@ -0,0 +1,4 @@ + [0,1] + | recurse( if .[0] == 15 then empty + else .[1] as $c | (.[0] + 1) | [ ., (2 * (2*. - 1) * $c) / (. + 1) ] + end ) diff --git a/Task/Catamorphism/EchoLisp/catamorphism.echolisp b/Task/Catamorphism/EchoLisp/catamorphism.echolisp new file mode 100644 index 0000000000..5c4d7ea73f --- /dev/null +++ b/Task/Catamorphism/EchoLisp/catamorphism.echolisp @@ -0,0 +1,19 @@ +;; rem : the foldX family always need an initial value +;; fold left a list +(foldl + 0 (iota 10)) ;; 0 + 1 + .. + 9 + → 45 + +;; fold left a sequence +(lib 'sequences) +(foldl * 1 [ 1 .. 10]) + → 362880 ;; 10! + +;; folding left and right +(foldl / 1 ' ( 1 2 3 4)) + → 8/3 +(foldr / 1 '(1 2 3 4)) + → 3/8 + +;;scanl gives the list (or sequence) of intermediate values : +(scanl * 1 '( 1 2 3 4 5)) + → (1 1 2 6 24 120) diff --git a/Task/Catamorphism/FreeBASIC/catamorphism.freebasic b/Task/Catamorphism/FreeBASIC/catamorphism.freebasic new file mode 100644 index 0000000000..97adf99663 --- /dev/null +++ b/Task/Catamorphism/FreeBASIC/catamorphism.freebasic @@ -0,0 +1,44 @@ +' FB 1.05.0 Win64 + +Type IntFunc As Function(As Integer, As Integer) As Integer + +Function reduce(a() As Integer, f As IntFunc) As Integer + '' if array is empty or function pointer is null, return 0 say + If UBound(a) = -1 OrElse f = 0 Then Return 0 + Dim result As Integer = a(LBound(a)) + For i As Integer = LBound(a) + 1 To UBound(a) + result = f(result, a(i)) + Next + Return result +End Function + +Function add(x As Integer, y As Integer) As Integer + Return x + y +End Function + +Function subtract(x As Integer, y As Integer) As Integer + Return x - y +End Function + +Function multiply(x As Integer, y As Integer) As Integer + Return x * y +End Function + +Function max(x As Integer, y As Integer) As Integer + Return IIf(x > y, x, y) +End Function + +Function min(x As Integer, y As Integer) As Integer + Return IIf(x < y, x, y) +End Function + +Dim a(4) As Integer = {1, 2, 3, 4, 5} +Print "Sum is :"; reduce(a(), @add) +Print "Difference is :"; reduce(a(), @subtract) +Print "Product is :"; reduce(a(), @multiply) +Print "Maximum is :"; reduce(a(), @max) +Print "Minimum is :"; reduce(a(), @min) +Print "No op is :"; reduce(a(), 0) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Catamorphism/Nim/catamorphism.nim b/Task/Catamorphism/Nim/catamorphism.nim new file mode 100644 index 0000000000..064178fb17 --- /dev/null +++ b/Task/Catamorphism/Nim/catamorphism.nim @@ -0,0 +1,19 @@ +import sequtils + +block: + let + numbers = @[5, 9, 11] + addition = foldl(numbers, a + b) + substraction = foldl(numbers, a - b) + multiplication = foldl(numbers, a * b) + words = @["nim", "rod", "is", "cool"] + concatenation = foldl(words, a & b) + +block: + let + numbers = @[5, 9, 11] + addition = foldr(numbers, a + b) + substraction = foldr(numbers, a - b) + multiplication = foldr(numbers, a * b) + words = @["nim", "rod", "is", "cool"] + concatenation = foldr(words, a & b) diff --git a/Task/Catamorphism/Oforth/catamorphism.oforth b/Task/Catamorphism/Oforth/catamorphism.oforth new file mode 100644 index 0000000000..c6c187aee2 --- /dev/null +++ b/Task/Catamorphism/Oforth/catamorphism.oforth @@ -0,0 +1,2 @@ +[ 1, 2, 3, 4, 5 ] reduce(#max) +[ "abc", "def", "gfi" ] reduce(#+) diff --git a/Task/Catamorphism/Ring/catamorphism.ring b/Task/Catamorphism/Ring/catamorphism.ring new file mode 100644 index 0000000000..9b0b35d9ce --- /dev/null +++ b/Task/Catamorphism/Ring/catamorphism.ring @@ -0,0 +1,34 @@ +n = list(10) +for i = 1 to 10 + n[i] = i +next + +see " +: " + cat(10,"+") + nl+ + " -: " + cat(10,"-") + nl + + " *: " + cat(10,"*") + nl + + " /: " + cat(10,"/") + nl+ + " ^: " + cat(10,"^") + nl + + "min: " + cat(10,"min") + nl+ + "max: " + cat(10,"max") + nl+ + "avg: " + cat(10,"avg") + nl + + "cat: " + cat(10,"cat") + nl + +func cat count,op + cat = n[1] + cat2 = "" + for i = 2 to count + switch op + on "+" cat += n[i] + on "-" cat -= n[i] + on "*" cat *= n[i] + on "/" cat /= n[i] + on "^" cat ^= n[i] + on "max" cat = max(cat,n[i]) + on "min" cat = min(cat,n[i]) + on "avg" cat += n[i] + on "cat" cat2 += string(n[i]) + off + next +if op = "avg" cat = cat / count ok +if op = "cat" decimals(0) cat = string(n[1])+cat2 ok +return cat diff --git a/Task/Catamorphism/Sidef/catamorphism.sidef b/Task/Catamorphism/Sidef/catamorphism.sidef new file mode 100644 index 0000000000..9f668fdb5b --- /dev/null +++ b/Task/Catamorphism/Sidef/catamorphism.sidef @@ -0,0 +1,2 @@ +say (1..10 -> reduce('+')); +say (1..10 -> reduce{|a,b| a + b}); diff --git a/Task/Catamorphism/Wortel/catamorphism-1.wortel b/Task/Catamorphism/Wortel/catamorphism-1.wortel new file mode 100644 index 0000000000..12ea10aceb --- /dev/null +++ b/Task/Catamorphism/Wortel/catamorphism-1.wortel @@ -0,0 +1 @@ +!/ ^+ [1 2 3] ; returns 6 diff --git a/Task/Catamorphism/Wortel/catamorphism-2.wortel b/Task/Catamorphism/Wortel/catamorphism-2.wortel new file mode 100644 index 0000000000..718fe79f69 --- /dev/null +++ b/Task/Catamorphism/Wortel/catamorphism-2.wortel @@ -0,0 +1 @@ +@fold ^+ 1 [1 2 3] ; returns 7 diff --git a/Task/Character-codes/Axe/character-codes.axe b/Task/Character-codes/Axe/character-codes.axe new file mode 100644 index 0000000000..1736c0e815 --- /dev/null +++ b/Task/Character-codes/Axe/character-codes.axe @@ -0,0 +1,2 @@ +Disp 'a'▶Dec,i +Disp 97▶Char,i diff --git a/Task/Character-codes/FreeBASIC/character-codes.freebasic b/Task/Character-codes/FreeBASIC/character-codes.freebasic new file mode 100644 index 0000000000..a2793300fa --- /dev/null +++ b/Task/Character-codes/FreeBASIC/character-codes.freebasic @@ -0,0 +1,7 @@ +' FreeBASIC v1.05.0 win64 +Print "a - > "; Asc("a") +Print "98 -> "; Chr(98) +Print +Print "Press any key to exit the program" +Sleep +End diff --git a/Task/Character-codes/I/character-codes.i b/Task/Character-codes/I/character-codes.i new file mode 100644 index 0000000000..c46403f78c --- /dev/null +++ b/Task/Character-codes/I/character-codes.i @@ -0,0 +1,4 @@ +software { + print(number('a')) + print(text([97])) +} diff --git a/Task/Character-codes/LFE/character-codes-1.lfe b/Task/Character-codes/LFE/character-codes-1.lfe new file mode 100644 index 0000000000..6a32953ac5 --- /dev/null +++ b/Task/Character-codes/LFE/character-codes-1.lfe @@ -0,0 +1,2 @@ +> (list 68 111 110 39 116 32 80 97 110 105 99 46) +"Don't Panic." diff --git a/Task/Character-codes/LFE/character-codes-2.lfe b/Task/Character-codes/LFE/character-codes-2.lfe new file mode 100644 index 0000000000..721442e69f --- /dev/null +++ b/Task/Character-codes/LFE/character-codes-2.lfe @@ -0,0 +1,6 @@ +> (: io format '"~w~n" '"a") +97 +ok +> (: io format '"~p~n" (list '(97))) +"a" +ok diff --git a/Task/Character-codes/Lasso/character-codes.lasso b/Task/Character-codes/Lasso/character-codes.lasso new file mode 100644 index 0000000000..ea90198014 --- /dev/null +++ b/Task/Character-codes/Lasso/character-codes.lasso @@ -0,0 +1,4 @@ +'a'->integer +'A'->integer +97->bytes +65->bytes diff --git a/Task/Character-codes/Lingo/character-codes.lingo b/Task/Character-codes/Lingo/character-codes.lingo new file mode 100644 index 0000000000..192da8232f --- /dev/null +++ b/Task/Character-codes/Lingo/character-codes.lingo @@ -0,0 +1,7 @@ +-- returns Unicode code point (=ASCII code for ASCII characters) for character +put chartonum("a") +-- 97 + +-- returns character for Unicode code point (=ASCII code for ASCII characters) +put numtochar(934) +-- Φ diff --git a/Task/Character-codes/LiveCode/character-codes.livecode b/Task/Character-codes/LiveCode/character-codes.livecode new file mode 100644 index 0000000000..d1fcc29d2a --- /dev/null +++ b/Task/Character-codes/LiveCode/character-codes.livecode @@ -0,0 +1,2 @@ +Since 7.0.x works with unicode +put charToNum("") && numToChar(240) diff --git a/Task/Character-codes/NESL/character-codes-1.nesl b/Task/Character-codes/NESL/character-codes-1.nesl new file mode 100644 index 0000000000..62f8d64f4b --- /dev/null +++ b/Task/Character-codes/NESL/character-codes-1.nesl @@ -0,0 +1,3 @@ +char_code(`a); + +it = 97 : int diff --git a/Task/Character-codes/NESL/character-codes-2.nesl b/Task/Character-codes/NESL/character-codes-2.nesl new file mode 100644 index 0000000000..7ca16f1175 --- /dev/null +++ b/Task/Character-codes/NESL/character-codes-2.nesl @@ -0,0 +1,3 @@ +code_char(97); + +it = `a : char diff --git a/Task/Character-codes/Nim/character-codes.nim b/Task/Character-codes/Nim/character-codes.nim new file mode 100644 index 0000000000..36d9c53f8b --- /dev/null +++ b/Task/Character-codes/Nim/character-codes.nim @@ -0,0 +1,7 @@ +echo ord('a') # echoes 97 +echo chr(97) # echoes a + +import unicode + +echo int("π".runeAt(0)) # echoes 960 +echo Rune(960) # echoes π diff --git a/Task/Character-codes/Oforth/character-codes.oforth b/Task/Character-codes/Oforth/character-codes.oforth new file mode 100644 index 0000000000..13a9422cfc --- /dev/null +++ b/Task/Character-codes/Oforth/character-codes.oforth @@ -0,0 +1 @@ +'a' println diff --git a/Task/Character-codes/Phix/character-codes.phix b/Task/Character-codes/Phix/character-codes.phix new file mode 100644 index 0000000000..9d8332145c --- /dev/null +++ b/Task/Character-codes/Phix/character-codes.phix @@ -0,0 +1,2 @@ +?'A' +puts(1,65) diff --git a/Task/Character-codes/Ring/character-codes.ring b/Task/Character-codes/Ring/character-codes.ring new file mode 100644 index 0000000000..5058317e92 --- /dev/null +++ b/Task/Character-codes/Ring/character-codes.ring @@ -0,0 +1,2 @@ +see ascii("a") + nl +see char(97) + nl diff --git a/Task/Character-codes/SequenceL/character-codes.sequencel b/Task/Character-codes/SequenceL/character-codes.sequencel new file mode 100644 index 0000000000..c9e16cf94f --- /dev/null +++ b/Task/Character-codes/SequenceL/character-codes.sequencel @@ -0,0 +1,4 @@ +cmd:>asciiToInt('a') +97 +cmd:>intToAscii(97) +'a' diff --git a/Task/Character-codes/Sidef/character-codes.sidef b/Task/Character-codes/Sidef/character-codes.sidef new file mode 100644 index 0000000000..e1add7f261 --- /dev/null +++ b/Task/Character-codes/Sidef/character-codes.sidef @@ -0,0 +1,2 @@ +say 'a'.ord; # => 97 +say 97.chr; # => 'a' diff --git a/Task/Character-codes/Swift/character-codes-1.swift b/Task/Character-codes/Swift/character-codes-1.swift new file mode 100644 index 0000000000..8edbe049fc --- /dev/null +++ b/Task/Character-codes/Swift/character-codes-1.swift @@ -0,0 +1,4 @@ +let c1: UnicodeScalar = "a" +println(c1.value) // prints "97" +let c2: UnicodeScalar = "π" +println(c2.value) // prints "960" diff --git a/Task/Character-codes/Swift/character-codes-2.swift b/Task/Character-codes/Swift/character-codes-2.swift new file mode 100644 index 0000000000..7311853e31 --- /dev/null +++ b/Task/Character-codes/Swift/character-codes-2.swift @@ -0,0 +1,8 @@ +let s1 = "a" +for c in s1.unicodeScalars { + println(c.value) // prints "97" +} +let s2 = "π" +for c in s2.unicodeScalars { + println(c.value) // prints "960" +} diff --git a/Task/Character-codes/Swift/character-codes-3.swift b/Task/Character-codes/Swift/character-codes-3.swift new file mode 100644 index 0000000000..578212c3a5 --- /dev/null +++ b/Task/Character-codes/Swift/character-codes-3.swift @@ -0,0 +1,4 @@ +let i1: UInt32 = 97 +println(UnicodeScalar(i1)) // prints "a" +let i2: UInt32 = 960 +println(UnicodeScalar(i2)) // prints "π" diff --git a/Task/Character-codes/Ursa/character-codes.ursa b/Task/Character-codes/Ursa/character-codes.ursa new file mode 100644 index 0000000000..eea1f90f4d --- /dev/null +++ b/Task/Character-codes/Ursa/character-codes.ursa @@ -0,0 +1,4 @@ +# outputs the character value for 'a' +out (ord "a") endl console +# outputs the character 'a' given its value +out (chr 97) endl console diff --git a/Task/Character-codes/XLISP/character-codes.xlisp b/Task/Character-codes/XLISP/character-codes.xlisp new file mode 100644 index 0000000000..a0f57bda60 --- /dev/null +++ b/Task/Character-codes/XLISP/character-codes.xlisp @@ -0,0 +1,6 @@ +[1] (INTEGER->CHAR 97) + +#\a +[2] (CHAR->INTEGER #\a) + +97 diff --git a/Task/Character-codes/jq/character-codes-1.jq b/Task/Character-codes/jq/character-codes-1.jq new file mode 100644 index 0000000000..c30f3531ac --- /dev/null +++ b/Task/Character-codes/jq/character-codes-1.jq @@ -0,0 +1,2 @@ +"a" | explode # => [ 97 ] +[97] | implode # => "a" diff --git a/Task/Character-codes/jq/character-codes-2.jq b/Task/Character-codes/jq/character-codes-2.jq new file mode 100644 index 0000000000..8dcd4a7030 --- /dev/null +++ b/Task/Character-codes/jq/character-codes-2.jq @@ -0,0 +1 @@ +def chr: [.] | implode; diff --git a/Task/Chat-server/Nim/chat-server.nim b/Task/Chat-server/Nim/chat-server.nim new file mode 100644 index 0000000000..b2f69ecc6b --- /dev/null +++ b/Task/Chat-server/Nim/chat-server.nim @@ -0,0 +1,40 @@ +import asyncnet, asyncdispatch + +type TClient = tuple[socket: AsyncSocket, name: string] +var clients: seq[Client] = @[] + +proc sendOthers(client: Client, line: string) {.async.} = + for c in clients: + if c != client: + await c.socket.send(line & "\c\L") + +proc processClient(socket: AsyncSocket) {.async.} = + await socket.send("Please enter your name: ") + let client: Client = (socket, await socket.recvLine()) + + clients.add client + discard client.sendOthers "+++ " & client.name & " arrived +++" + + while true: + let line = await client.socket.recvLine() + if line == "": + discard client.sendOthers "--- " & client.name & " leaves ---" + break + discard client.sendOthers client.name & "> " & line + + for i,c in clients: + if c == client: + clients.del i + break + +proc serve() {.async.} = + var server = newAsyncSocket() + server.bindAddr(Port(4004)) + server.listen() + + while true: + let socket = await server.accept() + discard processClient socket + +discard serve() +runForever() diff --git a/Task/Check-Machin-like-formulas/EchoLisp/check-machin-like-formulas-1.echolisp b/Task/Check-Machin-like-formulas/EchoLisp/check-machin-like-formulas-1.echolisp new file mode 100644 index 0000000000..97f88e5f0b --- /dev/null +++ b/Task/Check-Machin-like-formulas/EchoLisp/check-machin-like-formulas-1.echolisp @@ -0,0 +1,58 @@ +(lib 'math) +(lib 'match) +(math-precision 1.e-10) + +;; formally derive (tan ..) expressions +;; copied from Racket +;; adapted and improved for performance + +(define (reduce e) +;; (set! rcount (1+ rcount)) ;; # of calls + (match e + [(? number? a) a] + [('+ (? number? a) (? number? b)) (+ a b)] + [('- (? number? a) (? number? b)) (- a b)] + [('- (? number? a)) (- a)] + [('* (? number? a) (? number? b)) (* a b)] + [('/ (? number? a) (? number? b)) (/ a b)] ; patch + + [( '+ a b) (reduce `(+ ,(reduce a) ,(reduce b)))] + [( '- a b) (reduce `(- ,(reduce a) ,(reduce b)))] + [( '- a) (reduce `(- ,(reduce a)))] + [( '* a b) (reduce `(* ,(reduce a) ,(reduce b)))] + [( '/ a b) (reduce `(/ ,(reduce a) ,(reduce b)))] + + [( 'tan ('arctan a)) (reduce a)] + [( 'tan ( '- a)) (reduce `(- (tan ,a)))] + + ;; x 100 # calls reduction : derive (tan ,a) only once + [( 'tan ( '+ a b)) + (let ((alpha (reduce `(tan ,a))) (beta (reduce `(tan ,b)))) + (reduce `(/ (+ ,alpha ,beta) (- 1 (* ,alpha ,beta)))))] + + [( 'tan ( '+ a b c ...)) (reduce `(tan (+ ,a (+ ,b ,@c))))] + + [( 'tan ( '- a b)) + (let ((alpha (reduce `(tan ,a))) (beta (reduce `(tan ,b)))) + (reduce `(/ (- ,alpha ,beta) (+ 1 (* ,alpha ,beta)))))] + + ;; add formula for (tan 2 (arctan a)) = 2 a / (1 - a^2)) + [( 'tan ( '* 2 ('arctan a))) (reduce `(/ (* 2 ,a) (- 1 (* ,a ,a))))] + [( 'tan ( '* 1 ('arctan a))) (reduce a)] ; added + + [( 'tan ( '* (? number? n) a)) + (cond [(< n 0) (reduce `(- (tan (* ,(- n) ,a))))] + [(= n 0) 0] + [(= n 1) (reduce `(tan ,a))] + [(even? n) + (let ((alpha (reduce `(tan (* ,(/ n 2) ,a))))) ;; # calls reduction + (reduce `(/ (* 2 ,alpha) (- 1 (* ,alpha ,alpha)))))] + [else (reduce `(tan (+ ,a (* ,(- n 1) ,a))))])] + )) + +(define (task) + (for ((f machins)) + (if (~= 1 (reduce f)) + (writeln '👍 f '⟾ 1 ) + (writeln '❌ f '➽ (reduce f) )))) + diff --git a/Task/Check-Machin-like-formulas/EchoLisp/check-machin-like-formulas-2.echolisp b/Task/Check-Machin-like-formulas/EchoLisp/check-machin-like-formulas-2.echolisp new file mode 100644 index 0000000000..757b8b5146 --- /dev/null +++ b/Task/Check-Machin-like-formulas/EchoLisp/check-machin-like-formulas-2.echolisp @@ -0,0 +1,42 @@ +(define machins + '((tan (+ (arctan 1/2) (arctan 1/3))) + (tan (+ (* 2 (arctan 1/3)) (arctan 1/7))) + (tan (- (* 4 (arctan 1/5)) (arctan 1/239))) + (tan (+ (* 5 (arctan 1/7)) (* 2 (arctan 3/79)))) + (tan (+ (* 5 (arctan 29/278)) (* 7 (arctan 3/79)))) + (tan (+ (arctan 1/2) (arctan 1/5) (arctan 1/8))) + (tan (+ (* 4 (arctan 1/5)) (* -1 (arctan 1/70)) (arctan 1/99))) + (tan (+ (* 5 (arctan 1/7)) (* 4 (arctan 1/53)) (* 2 (arctan 1/4443)))) + (tan (+ (* 6 (arctan 1/8)) (* 2 (arctan 1/57)) (arctan 1/239))) + (tan (+ (* 8 (arctan 1/10)) (* -1 (arctan 1/239)) (* -4 (arctan 1/515)))) + (tan (+ (* 12 (arctan 1/18)) (* 8 (arctan 1/57)) (* -5 (arctan 1/239)))) + (tan (+ (* 16 (arctan 1/21)) (* 3 (arctan 1/239)) (* 4 (arctan 3/1042)))) + (tan (+ (* 22 (arctan 1/28)) (* 2 (arctan 1/443)) (* -5 (arctan 1/1393)) (* -10 (arctan 1/11018)))) + (tan (+ (* 22 (arctan 1/38)) (* 17 (arctan 7/601)) (* 10 (arctan 7/8149)))) + (tan (+ (* 44 (arctan 1/57)) (* 7 (arctan 1/239)) (* -12 (arctan 1/682)) (* 24 (arctan 1/12943)))) + (tan (+ (* 88 (arctan 1/172)) (* 51 (arctan 1/239)) (* 32 (arctan 1/682)) + (* 44 (arctan 1/5357)) (* 68 (arctan 1/12943)))) + (tan (+ (* 88 (arctan 1/172)) (* 51 (arctan 1/239)) (* 32 (arctan 1/682)) + (* 44 (arctan 1/5357)) (* 68 (arctan 1/12944)))))) + +(task) + +👍 (tan (+ (arctan 1/2) (arctan 1/3))) ⟾ 1 +👍 (tan (+ (* 2 (arctan 1/3)) (arctan 1/7))) ⟾ 1 +👍 (tan (- (* 4 (arctan 1/5)) (arctan 1/239))) ⟾ 1 +👍 (tan (+ (* 5 (arctan 1/7)) (* 2 (arctan 3/79)))) ⟾ 1 +👍 (tan (+ (* 5 (arctan 29/278)) (* 7 (arctan 3/79)))) ⟾ 1 +👍 (tan (+ (arctan 1/2) (arctan 1/5) (arctan 1/8))) ⟾ 1 +👍 (tan (+ (* 4 (arctan 1/5)) (* -1 (arctan 1/70)) (arctan 1/99))) ⟾ 1 +👍 (tan (+ (* 5 (arctan 1/7)) (* 4 (arctan 1/53)) (* 2 (arctan 1/4443)))) ⟾ 1 +👍 (tan (+ (* 6 (arctan 1/8)) (* 2 (arctan 1/57)) (arctan 1/239))) ⟾ 1 +👍 (tan (+ (* 8 (arctan 1/10)) (* -1 (arctan 1/239)) (* -4 (arctan 1/515)))) ⟾ 1 +👍 (tan (+ (* 12 (arctan 1/18)) (* 8 (arctan 1/57)) (* -5 (arctan 1/239)))) ⟾ 1 +👍 (tan (+ (* 16 (arctan 1/21)) (* 3 (arctan 1/239)) (* 4 (arctan 3/1042)))) ⟾ 1 +👍 (tan (+ (* 22 (arctan 1/28)) (* 2 (arctan 1/443)) (* -5 (arctan 1/1393)) (* -10 (arctan 1/11018)))) ⟾ 1 +👍 (tan (+ (* 22 (arctan 1/38)) (* 17 (arctan 7/601)) (* 10 (arctan 7/8149)))) ⟾ 1 +👍 (tan (+ (* 44 (arctan 1/57)) (* 7 (arctan 1/239)) (* -12 (arctan 1/682)) (* 24 (arctan 1/12943)))) ⟾ 1 +👍 (tan (+ (* 88 (arctan 1/172)) (* 51 (arctan 1/239)) (* 32 (arctan 1/682)) + (* 44 (arctan 1/5357)) (* 68 (arctan 1/12943)))) ⟾ 1 +❌ (tan (+ (* 88 (arctan 1/172)) (* 51 (arctan 1/239)) (* 32 (arctan 1/682)) + (* 44 (arctan 1/5357)) (* 68 (arctan 1/12944)))) ➽ 0.9999991882257442 diff --git a/Task/Check-Machin-like-formulas/Sidef/check-machin-like-formulas.sidef b/Task/Check-Machin-like-formulas/Sidef/check-machin-like-formulas.sidef new file mode 100644 index 0000000000..87de673b49 --- /dev/null +++ b/Task/Check-Machin-like-formulas/Sidef/check-machin-like-formulas.sidef @@ -0,0 +1,68 @@ +var equationtext = <<'EOT' + pi/4 = arctan(1/2) + arctan(1/3) + pi/4 = 2*arctan(1/3) + arctan(1/7) + pi/4 = 4*arctan(1/5) - arctan(1/239) + pi/4 = 5*arctan(1/7) + 2*arctan(3/79) + pi/4 = 5*arctan(29/278) + 7*arctan(3/79) + pi/4 = arctan(1/2) + arctan(1/5) + arctan(1/8) + pi/4 = 4*arctan(1/5) - arctan(1/70) + arctan(1/99) + pi/4 = 5*arctan(1/7) + 4*arctan(1/53) + 2*arctan(1/4443) + pi/4 = 6*arctan(1/8) + 2*arctan(1/57) + arctan(1/239) + pi/4 = 8*arctan(1/10) - arctan(1/239) - 4*arctan(1/515) + pi/4 = 12*arctan(1/18) + 8*arctan(1/57) - 5*arctan(1/239) + pi/4 = 16*arctan(1/21) + 3*arctan(1/239) + 4*arctan(3/1042) + pi/4 = 22*arctan(1/28) + 2*arctan(1/443) - 5*arctan(1/1393) - 10*arctan(1/11018) + pi/4 = 22*arctan(1/38) + 17*arctan(7/601) + 10*arctan(7/8149) + pi/4 = 44*arctan(1/57) + 7*arctan(1/239) - 12*arctan(1/682) + 24*arctan(1/12943) + pi/4 = 88*arctan(1/172) + 51*arctan(1/239) + 32*arctan(1/682) + 44*arctan(1/5357) + 68*arctan(1/12943) + pi/4 = 88*arctan(1/172) + 51*arctan(1/239) + 32*arctan(1/682) + 44*arctan(1/5357) + 68*arctan(1/12944) +EOT + +func parse_eqn(equation) { + var eqn_re = / + ( ^ \s* pi\/4 \s* = \s* )? # LHS of equation + (?: # RHS + \s* ( [+-] )? \s* + (?: ( \d+ ) \s* \*)? + \s* arctan\( (\d+) \/ (\d+) \) + )/x + + gather { + for lhs,sign,mult,numer,denom in (equation.findall(eqn_re)) { + take([ + [+1, -1][sign == '-'] * (mult ? Num(mult) : 1), + Num(join('/', numer, denom ? denom : 1)) + ]) + } + } +} + +func tanEval((1), f) { f } + +func tanEval(coef {.is_neg}, f) { + -tanEval(-coef, f) +} + +func tanEval(coef, f) { + var ca = coef//2 + var cb = coef-ca + var (a, b) = (tanEval(ca, f), tanEval(cb, f)) + (a + b) / (1 - a*b) +} + +func tans(xs {.len == 1}) { + tanEval(xs[0]...) +} + +func tans(xs) { + var (aa, bb) = @|(xs/2) + var (a, b) = (tans(aa), tans(bb)) + (a + b) / (1 - a*b) +} + +var machins = equationtext.lines.map(parse_eqn) + +for machin,eqn in (machins ~Z equationtext.lines) { + var ans = tans(machin) + printf("%5s: %s\n", (ans == 1 ? 'OK' : 'ERROR'), eqn) +} diff --git a/Task/Check-that-file-exists/Axe/check-that-file-exists.axe b/Task/Check-that-file-exists/Axe/check-that-file-exists.axe new file mode 100644 index 0000000000..bba8c01f1a --- /dev/null +++ b/Task/Check-that-file-exists/Axe/check-that-file-exists.axe @@ -0,0 +1,5 @@ +If GetCalc("appvINPUT") + Disp "EXISTS",i +Else + Disp "DOES NOT EXIST",i +End diff --git a/Task/Check-that-file-exists/FreeBASIC/check-that-file-exists.freebasic b/Task/Check-that-file-exists/FreeBASIC/check-that-file-exists.freebasic new file mode 100644 index 0000000000..d6617a807d --- /dev/null +++ b/Task/Check-that-file-exists/FreeBASIC/check-that-file-exists.freebasic @@ -0,0 +1,38 @@ +' FB 1.05.0 Win64 + +' Enable FileExists() function to be used +#include "file.bi" + +' Use Win32 function to check if directory exists on Windows 10 +Declare Function GetFileAttributes Lib "kernel32.dll" Alias "GetFileAttributesA" _ +(ByVal lpFileName As ZString Ptr) As ULong + +Const InvalidFileAttributes As ULong = -1UL +Const FileAttributeDirectory As ULong = &H10UL + +Sub CheckFileExists(ByRef filePath As String) + If FileExists(filePath) Then + Print "'"; filePath; "' exists" + Else + Print "'"; filePath; "' does not exist" + End If +End Sub + +Sub CheckDirectoryExists(ByVal dirPath As ZString Ptr) + Dim attrib As ULong = GetFileAttributes(dirPath) + Dim dirExists As ULong = attrib <> InvalidFileAttributes AndAlso (attrib And FileAttributeDirectory) <> 0 + If dirExists Then + Print "'"; *dirPath; "' exists" + Else + Print "'"; *dirPath; "' does not exist" + End If +End Sub + +CheckFileExists(CurDir + "\input.txt") +Dim dirPath As String = CurDir + "\docs" +CheckDirectoryExists(StrPtr(dirPath)) +CheckFileExists("c:\input.txt") +CheckDirectoryExists(StrPtr("c:\docs")) +Print +Print "Press any key to quit the program" +Sleep diff --git a/Task/Check-that-file-exists/I/check-that-file-exists.i b/Task/Check-that-file-exists/I/check-that-file-exists.i new file mode 100644 index 0000000000..1fefc4f57a --- /dev/null +++ b/Task/Check-that-file-exists/I/check-that-file-exists.i @@ -0,0 +1,16 @@ +function exists(""filename) { + var file = open(filename) + issues { + print(filename+" does not exist") + return + } + print(filename+" exists") + close(file) +} + +software { + exists("input.txt") + exists("/input.txt") + exists("docs") + exists("/docs") +} diff --git a/Task/Check-that-file-exists/LFE/check-that-file-exists.lfe b/Task/Check-that-file-exists/LFE/check-that-file-exists.lfe new file mode 100644 index 0000000000..8ba037c767 --- /dev/null +++ b/Task/Check-that-file-exists/LFE/check-that-file-exists.lfe @@ -0,0 +1,8 @@ +> (: filelib is_regular '"input.txt") +false +> (: filelib is_dir '"docs") +false +> (: filelib is_regular '"/input.txt") +false +> (: filelib is_dir '"/docs")) +false diff --git a/Task/Check-that-file-exists/Lasso/check-that-file-exists.lasso b/Task/Check-that-file-exists/Lasso/check-that-file-exists.lasso new file mode 100644 index 0000000000..9ba9c74a2a --- /dev/null +++ b/Task/Check-that-file-exists/Lasso/check-that-file-exists.lasso @@ -0,0 +1,11 @@ +// local file +file_exists('input.txt') + +// local directory +file_exists('docs') + +// file in root file system (requires permissions at user OS level) +file_exists('//input.txt') + +// directory in root file system (requires permissions at user OS level) +file_exists('//docs') diff --git a/Task/Check-that-file-exists/LiveCode/check-that-file-exists-1.livecode b/Task/Check-that-file-exists/LiveCode/check-that-file-exists-1.livecode new file mode 100644 index 0000000000..b402810b16 --- /dev/null +++ b/Task/Check-that-file-exists/LiveCode/check-that-file-exists-1.livecode @@ -0,0 +1,4 @@ +there is a file "/input.txt" +there is a file "input.txt" +there is a folder "docs" +there is a file "/docs/input.txt" diff --git a/Task/Check-that-file-exists/LiveCode/check-that-file-exists-2.livecode b/Task/Check-that-file-exists/LiveCode/check-that-file-exists-2.livecode new file mode 100644 index 0000000000..cb013d6d90 --- /dev/null +++ b/Task/Check-that-file-exists/LiveCode/check-that-file-exists-2.livecode @@ -0,0 +1,2 @@ +set the defaultFolder to "docs" +there is a file "input.txt" diff --git a/Task/Check-that-file-exists/Nim/check-that-file-exists.nim b/Task/Check-that-file-exists/Nim/check-that-file-exists.nim new file mode 100644 index 0000000000..6ad86258b3 --- /dev/null +++ b/Task/Check-that-file-exists/Nim/check-that-file-exists.nim @@ -0,0 +1,6 @@ +import os + +echo existsFile "input.txt" +echo existsFile "/input.txt" +echo existsDir "docs" +echo existsDir "/docs" diff --git a/Task/Check-that-file-exists/Phix/check-that-file-exists.phix b/Task/Check-that-file-exists/Phix/check-that-file-exists.phix new file mode 100644 index 0000000000..48e9beba66 --- /dev/null +++ b/Task/Check-that-file-exists/Phix/check-that-file-exists.phix @@ -0,0 +1,18 @@ +constant fd = {"file","directory"} + +procedure check(string name) +object d = dir(name) + if sequence(d) then + d = (find('d',d[1][D_ATTRIBUTES])!=0) + printf(1,"%s %s exists.\n",{fd[1+d],name}) + else + printf(1,"%s does not exist.\n",{name}) + end if +end procedure + +check("input.txt") +check("docs") +check("/input.txt") +check("/docs") +check("/pagefile.sys") +check("/Program Files (x86)") diff --git a/Task/Check-that-file-exists/Ring/check-that-file-exists.ring b/Task/Check-that-file-exists/Ring/check-that-file-exists.ring new file mode 100644 index 0000000000..f8cb9c647a --- /dev/null +++ b/Task/Check-that-file-exists/Ring/check-that-file-exists.ring @@ -0,0 +1,4 @@ +aFile = "C:\Ring\ReadMe.txt" +see aFile +if Fexists(aFile) see " exists" + nl +else see " doesn't exist" + nl ok diff --git a/Task/Check-that-file-exists/Sidef/check-that-file-exists.sidef b/Task/Check-that-file-exists/Sidef/check-that-file-exists.sidef new file mode 100644 index 0000000000..fcc0464fb0 --- /dev/null +++ b/Task/Check-that-file-exists/Sidef/check-that-file-exists.sidef @@ -0,0 +1,7 @@ +# Here +say (Dir.cwd + %f'input.txt' -> is_file); +say (Dir.cwd + %d'docs' -> is_dir); + +# Root +say (Dir.root + %f'input.txt' -> is_file); +say (Dir.root + %d'docs' -> is_dir); diff --git a/Task/Check-that-file-exists/Ursa/check-that-file-exists.ursa b/Task/Check-that-file-exists/Ursa/check-that-file-exists.ursa new file mode 100644 index 0000000000..d256bd2be3 --- /dev/null +++ b/Task/Check-that-file-exists/Ursa/check-that-file-exists.ursa @@ -0,0 +1,9 @@ +def exists (string filename) + decl file f + try + f.open filename + return true + catch ioerror + return false + end try +end exists diff --git a/Task/Checkpoint-synchronization/Oforth/checkpoint-synchronization.oforth b/Task/Checkpoint-synchronization/Oforth/checkpoint-synchronization.oforth new file mode 100644 index 0000000000..3bbc334ad4 --- /dev/null +++ b/Task/Checkpoint-synchronization/Oforth/checkpoint-synchronization.oforth @@ -0,0 +1,23 @@ +: task(n, jobs, myChannel) + while(true) [ + System.Out "TASK " << n << " : Beginning my work..." << cr + System sleep(1000 rand) + System.Out "TASK " << n << " : Finish, sendind done and waiting for others..." << cr + jobs send($jobDone) drop + myChannel receive drop + ] ; + +: checkPoint(n, jobs, channels) + while(true) [ + #[ jobs receive drop ] times(n) + "CHECKPOINT : All jobs done, sending done to all tasks" println + channels apply(#[ send($allDone) drop ]) + ] ; + +: testCheckPoint(n) +| jobs channels i | + ListBuffer init(n, #[ Channel new ]) dup freeze ->channels + Channel new ->jobs + + #[ checkPoint(n, jobs, channels) ] & + n loop: i [ #[ task(i, jobs, channels at(i)) ] & ] ; diff --git a/Task/Chinese-remainder-theorem/EchoLisp/chinese-remainder-theorem.echolisp b/Task/Chinese-remainder-theorem/EchoLisp/chinese-remainder-theorem.echolisp new file mode 100644 index 0000000000..47179c02b8 --- /dev/null +++ b/Task/Chinese-remainder-theorem/EchoLisp/chinese-remainder-theorem.echolisp @@ -0,0 +1,8 @@ +(lib 'math) +math.lib v1.10 ® EchoLisp +Lib: math.lib loaded. + +(crt-solve '(2 3 2) '(3 5 7)) + → 23 +(crt-solve '(2 3 2) '(7 1005 15)) +💥 error: mod[i] must be co-primes : assertion failed : 1005 diff --git a/Task/Chinese-remainder-theorem/FunL/chinese-remainder-theorem.funl b/Task/Chinese-remainder-theorem/FunL/chinese-remainder-theorem.funl new file mode 100644 index 0000000000..0da301bb9b --- /dev/null +++ b/Task/Chinese-remainder-theorem/FunL/chinese-remainder-theorem.funl @@ -0,0 +1,7 @@ +import integers.modinv + +def crt( congruences ) = + N = product( n | (_, n) <- congruences ) + sum( a*modinv(N/n, n)*N/n | (a, n) <- congruences ) mod N + +println( crt([(2, 3), (3, 5), (2, 7)]) ) diff --git a/Task/Chinese-remainder-theorem/Nim/chinese-remainder-theorem.nim b/Task/Chinese-remainder-theorem/Nim/chinese-remainder-theorem.nim new file mode 100644 index 0000000000..8703cca5ad --- /dev/null +++ b/Task/Chinese-remainder-theorem/Nim/chinese-remainder-theorem.nim @@ -0,0 +1,24 @@ +proc mulInv(a0, b0): int = + var (a, b, x0) = (a0, b0, 0) + result = 1 + if b == 1: return + while a > 1: + let q = a div b + a = a mod b + swap a, b + result = result - q * x0 + swap x0, result + if result < 0: result += b0 + +proc chineseRemainder[T](n, a: T): int = + var prod = 1 + var sum = 0 + for x in n: prod *= x + + for i in 0 .. 1) { + (a, b, x0, x1) = (b, a % b, x1 - x0*int(a / b), x0); + }; + x1 < 0 ? x1+b0 : x1; +} + +func chinese_remainder(*n) { + var N = n«*»; + func (*a) { + n.range.map { |i| + var p = int(N / n[i]); + a[i] * mul_inv(p, n[i]) * p; + }.sum + } +} + +say chinese_remainder(3, 5, 7)(2, 3, 2); diff --git a/Task/Chinese-remainder-theorem/jq/chinese-remainder-theorem.jq b/Task/Chinese-remainder-theorem/jq/chinese-remainder-theorem.jq new file mode 100644 index 0000000000..0d0eadc64e --- /dev/null +++ b/Task/Chinese-remainder-theorem/jq/chinese-remainder-theorem.jq @@ -0,0 +1,31 @@ +# mul_inv(a;b) returns x where (a * x) % b == 1, or else null +def mul_inv(a; b): + + # state: [a, b, x0, x1] + def iterate: + .[0] as $a | .[1] as $b + | if $a > 1 then + if $b == 0 then null + else ($a / $b | floor) as $q + | [$b, ($a % $b), (.[3] - ($q * .[2])), .[2]] | iterate + end + else . + end ; + + if (b == 1) then 1 + else [a,b,0,1] | iterate + | if . == null then . + else .[3] | if . < 0 then . + b else . end + end + end; + +def chinese_remainder(mods; remainders): + (reduce mods[] as $i (1; . * $i)) as $prod + | reduce range(0; mods|length) as $i + (0; + ($prod/mods[$i]) as $p + | mul_inv($p; mods[$i]) as $mi + | if $mi == null then error("nogo: p=\($p) mods[\($i)]=\(mods[$i])") + else . + (remainders[$i] * $mi * $p) + end ) + | . % $prod ; diff --git a/Task/Cholesky-decomposition/Idris/cholesky-decomposition.idris b/Task/Cholesky-decomposition/Idris/cholesky-decomposition.idris new file mode 100644 index 0000000000..89ca110781 --- /dev/null +++ b/Task/Cholesky-decomposition/Idris/cholesky-decomposition.idris @@ -0,0 +1,67 @@ +module Main + +import Data.Vect + +Matrix : Nat -> Nat -> Type -> Type +Matrix m n t = Vect m (Vect n t) + + +zeros : (m : Nat) -> (n : Nat) -> Matrix m n Double +zeros m n = replicate m (replicate n 0.0) + + +indexM : (Fin m, Fin n) -> Matrix m n t -> t +indexM (i, j) a = index j (index i a) + + +replaceAtM : (Fin m, Fin n) -> t -> Matrix m n t -> Matrix m n t +replaceAtM (i, j) e a = replaceAt i (replaceAt j e (index i a)) a + + +get : Matrix m m Double -> Matrix m m Double -> (Fin m, Fin m) -> Double +get a l (i, j) {m} = if i == j then sqrt $ indexM (j, j) a - dot + else if i > j then (indexM (i, j) a - dot) / indexM (j, j) l + else 0.0 + + where + -- Obtain indicies 0 to j -1 + ks : List (Fin m) + ks = case (findIndices (\_ => True) a) of + [] => [] + (x::xs) => init (x::xs) + + dot : Double + dot = sum [(indexM (i, k) l) * (indexM (j, k) l) | k <- ks] + + +updateL : Matrix m m Double -> Matrix m m Double -> (Fin m, Fin m) -> Matrix m m Double +updateL a l idx = replaceAtM idx (get a l idx) l + + +cholesky : Matrix m m Double -> Matrix m m Double +cholesky a {m} = + foldl (\l',i => + foldl (\l'',j => updateL a l'' (i, j)) l' (js i)) + l is + where l = zeros m m + + is : List (Fin m) + is = findIndices (\_ => True) a + + js : Fin m -> List (Fin m) + js n = filter (<= n) is + + +ex1 : Matrix 3 3 Double +ex1 = cholesky [[25.0, 15.0, -5.0], [15.0, 18.0, 0.0], [-5.0, 0.0, 11.0]] + +ex2 : Matrix 4 4 Double +ex2 = cholesky [[18.0, 22.0, 54.0, 42.0], [22.0, 70.0, 86.0, 62.0], + [54.0, 86.0, 174.0, 134.0], [42.0, 62.0, 134.0, 106.0]] + +main : IO () +main = do + print ex1 + putStrLn "\n" + print ex2 + putStrLn "\n" diff --git a/Task/Cholesky-decomposition/Nim/cholesky-decomposition.nim b/Task/Cholesky-decomposition/Nim/cholesky-decomposition.nim new file mode 100644 index 0000000000..ad64241b4d --- /dev/null +++ b/Task/Cholesky-decomposition/Nim/cholesky-decomposition.nim @@ -0,0 +1,28 @@ +import math, strutils + +proc cholesky[T](a: T): T = + for i in 0 .. < a[0].len: + for j in 0 .. i: + var s = 0.0 + for k in 0 .. < j: + s += result[i][k] * result[j][k] + result[i][j] = if i == j: sqrt(a[i][i]-s) + else: (1.0 / result[j][j] * (a[i][j] - s)) + +proc `$`(a): string = + result = "" + for b in a: + for c in b: + result.add c.formatFloat(ffDecimal, 5) & " " + result.add "\n" + +let m1 = [[25.0, 15.0, -5.0], + [15.0, 18.0, 0.0], + [-5.0, 0.0, 11.0]] +echo cholesky(m1) + +let m2 = [[18.0, 22.0, 54.0, 42.0], + [22.0, 70.0, 86.0, 62.0], + [54.0, 86.0, 174.0, 134.0], + [42.0, 62.0, 134.0, 106.0]] +echo cholesky(m2) diff --git a/Task/Cholesky-decomposition/Sidef/cholesky-decomposition-1.sidef b/Task/Cholesky-decomposition/Sidef/cholesky-decomposition-1.sidef new file mode 100644 index 0000000000..166302d8f8 --- /dev/null +++ b/Task/Cholesky-decomposition/Sidef/cholesky-decomposition-1.sidef @@ -0,0 +1,13 @@ +func cholesky(matrix) { + var chol = matrix.len.of { matrix.len.of(0) } + for row in ^matrix { + for col in (0..row) { + var x = matrix[row][col] + for i in (0..col) { + x -= (chol[row][i] * chol[col][i]) + } + chol[row][col] = (row == col ? x.sqrt : x/chol[col][col]) + } + } + return chol +} diff --git a/Task/Cholesky-decomposition/Sidef/cholesky-decomposition-2.sidef b/Task/Cholesky-decomposition/Sidef/cholesky-decomposition-2.sidef new file mode 100644 index 0000000000..8a0672e08f --- /dev/null +++ b/Task/Cholesky-decomposition/Sidef/cholesky-decomposition-2.sidef @@ -0,0 +1,18 @@ +var example1 = [ [ 25, 15, -5 ], + [ 15, 18, 0 ], + [ -5, 0, 11 ] ]; + +say "Example 1:"; +cholesky(example1).each { |row| + say row.map {'%7.4f' % _}.join(' '); +} + +var example2 = [ [ 18, 22, 54, 42], + [ 22, 70, 86, 62], + [ 54, 86, 174, 134], + [ 42, 62, 134, 106] ]; + +say "\nExample 2:"; +cholesky(example2).each { |row| + say row.map {'%7.4f' % _}.join(' '); +} diff --git a/Task/Cholesky-decomposition/jq/cholesky-decomposition-1.jq b/Task/Cholesky-decomposition/jq/cholesky-decomposition-1.jq new file mode 100644 index 0000000000..65001e4089 --- /dev/null +++ b/Task/Cholesky-decomposition/jq/cholesky-decomposition-1.jq @@ -0,0 +1,38 @@ +# Create an m x n matrix + def matrix(m; n; init): + if m == 0 then [] + elif m == 1 then [range(0; n)] | map(init) + elif m > 0 then + matrix(1; n; init) as $row + | [range(0; m)] | map( $row ) + else error("matrix\(m);_;_) invalid") + end ; + +# Print a matrix neatly, each cell ideally occupying n spaces, +# but without truncation +def neatly(n): + def right: tostring | ( " " * (n-length) + .); + . as $in + | length as $length + | reduce range (0; $length) as $i + (""; . + reduce range(0; $length) as $j + (""; "\(.) \($in[$i][$j] | right )" ) + "\n" ) ; + +def is_square: + type == "array" and (map(type == "array") | all) and + length == 0 or ( (.[0]|length) as $l | map(length == $l) | all) ; + +# This implementation of is_symmetric/0 uses a helper function that circumvents +# limitations of jq 1.4: +def is_symmetric: + # [matrix, i,j, len] + def test: + if .[1] > .[3] then true + elif .[1] == .[2] then [ .[0], .[1] + 1, 0, .[3]] | test + elif .[0][.[1]][.[2]] == .[0][.[2]][.[1]] + then [ .[0], .[1], .[2]+1, .[3]] | test + else false + end; + if is_square|not then false + else [ ., 0, 0, length ] | test + end ; diff --git a/Task/Cholesky-decomposition/jq/cholesky-decomposition-2.jq b/Task/Cholesky-decomposition/jq/cholesky-decomposition-2.jq new file mode 100644 index 0000000000..49009a55d0 --- /dev/null +++ b/Task/Cholesky-decomposition/jq/cholesky-decomposition-2.jq @@ -0,0 +1,22 @@ +def cholesky_factor: + if is_symmetric then + length as $length + | . as $self + | reduce range(0; $length) as $k + ( matrix(length; length; 0); # the matrix that will hold the answer + reduce range(0; $length) as $i + (.; + if $i == $k + then (. as $lower + | reduce range(0; $k) as $j + (0; . + ($lower[$k][$j] | .*.) )) as $sum + | .[$k][$k] = (($self[$k][$k] - $sum) | sqrt) + elif $i > $k + then (. as $lower + | reduce range(0; $k) as $j + (0; . + $lower[$i][$j] * $lower[$k][$j])) as $sum + | .[$i][$k] = (($self[$k][$i] - $sum) / .[$k][$k] ) + else . + end )) + else error( "cholesky_factor: matrix is not symmetric" ) + end ; diff --git a/Task/Cholesky-decomposition/jq/cholesky-decomposition-3.jq b/Task/Cholesky-decomposition/jq/cholesky-decomposition-3.jq new file mode 100644 index 0000000000..99707a0eb6 --- /dev/null +++ b/Task/Cholesky-decomposition/jq/cholesky-decomposition-3.jq @@ -0,0 +1,4 @@ + 4.242640687119285 0 0 0 + 5.185449728701349 6.565905201197403 0 0 + 12.727922061357857 3.0460384954008553 1.6497422479090704 0 + 9.899494936611665 1.6245538642137891 1.849711005231382 1.3926212476455924 diff --git a/Task/Circles-of-given-radius-through-two-points/ERRE/circles-of-given-radius-through-two-points.erre b/Task/Circles-of-given-radius-through-two-points/ERRE/circles-of-given-radius-through-two-points.erre new file mode 100644 index 0000000000..4123369856 --- /dev/null +++ b/Task/Circles-of-given-radius-through-two-points/ERRE/circles-of-given-radius-through-two-points.erre @@ -0,0 +1,51 @@ +PROGRAM CIRCLES + +! +! for rosettacode.org +! + +PROCEDURE CIRCLE_CENTER(X1,Y1,X2,Y2,R->MSG$) + LOCAL D,W,X3,Y3 + + D=SQR((X2-X1)^2+(Y2-Y1)^2) + IF D=0 THEN + MSG$="NO CIRCLES CAN BE DRAWN, POINTS ARE IDENTICAL" + EXIT PROCEDURE + END IF + X3=(X1+X2)/2 Y3=(Y1+Y2)/2 + + W=R^2-(D/2)^2 + IF W<0 THEN + MSG$="NO SOLUTION" + EXIT PROCEDURE + END IF + CX1=X3+SQR(W)*(Y1-Y2)/D CY1=Y3+SQR(W)*(X2-X1)/D + CX2=X3-SQR(W)*(Y1-Y2)/D CY2=Y3-SQR(W)*(X2-X1)/D + IF D=R*2 THEN + MSG$="POINTS ARE OPPOSITE ENDS OF A DIAMETER CENTER = "+STR$(CX1)+","+STR$(CY1) + EXIT PROCEDURE + END IF + IF D>R*2 THEN + MSG$="POINTS ARE TOO FAR" + EXIT PROCEDURE + END IF + IF R<=0 THEN + MSG$="RADIUS IS NOT VALID" + EXIT PROCEDURE + END IF + MSG$=STR$(CX1)+","+STR$(CY1)+" & "+STR$(CX2)+","+STR$(CY2) +END PROCEDURE + +BEGIN +DATA(0.1234,0.9876,0.8765,0.2345,2.0) +DATA(0.0000,2.0000,0.0000,0.0000,1.0) +DATA(0.1234,0.9876,0.1234,0.9876,2.0) +DATA(0.1234,0.9876,0.8765,0.2345,0.5) +DATA(0.1234,0.9876,0.1234,0.9876,0.0) + +FOR I%=1 TO 5 DO + READ(PX,PY,QX,QY,RADIUS) + CIRCLE_CENTER(PX,PY,QX,QY,RADIUS->MSG$) + PRINT(MSG$) +END FOR +END PROGRAM diff --git a/Task/Circles-of-given-radius-through-two-points/Nim/circles-of-given-radius-through-two-points.nim b/Task/Circles-of-given-radius-through-two-points/Nim/circles-of-given-radius-through-two-points.nim new file mode 100644 index 0000000000..17cdf6b81f --- /dev/null +++ b/Task/Circles-of-given-radius-through-two-points/Nim/circles-of-given-radius-through-two-points.nim @@ -0,0 +1,48 @@ +import math + +type + Point = tuple[x, y: float] + Circle = tuple[x, y, r: float] + +proc circles(p1, p2: Point, r: float): tuple[c1, c2: Circle] = + if r == 0: raise newException(EInvalidValue, + "radius of zero") + if p1 == p2: raise newException(EInvalidValue, + "coincident points gives infinite number of Circles") + + # delta x, delta y between points + let (dx, dy) = (p2.x - p1.x, p2.y - p1.y) + # dist between points + let q = sqrt(dx*dx + dy*dy) + if q > 2.0*r: raise newException(EInvalidValue, + "separation of points > diameter") + + # halfway point + let p3: Point = ((p1.x+p2.x)/2, (p1.y+p2.y)/2) + # distance along the mirror line + let d = sqrt(r*r - (q/2)*(q/2)) + # One answer + result.c1 = (p3.x - d*dy/q, p3.y + d*dx/q, abs(r)) + # The other answer + result.c2 = (p3.x + d*dy/q, p3.y - d*dx/q, abs(r)) + +const tries: seq[tuple[p1, p2: Point, r: float]] = + @[((0.1234, 0.9876), (0.8765, 0.2345), 2.0), + ((0.0000, 2.0000), (0.0000, 0.0000), 1.0), + ((0.1234, 0.9876), (0.1234, 0.9876), 2.0), + ((0.1234, 0.9876), (0.8765, 0.2345), 0.5), + ((0.1234, 0.9876), (0.1234, 0.9876), 0.0)] + +for p1, p2, r in tries.items: + echo "Through points:" + echo " ", p1 + echo " ", p2 + echo " and radius ", r + echo "You can construct the following circles:" + try: + let (c1, c2) = circles(p1, p2, r) + echo " ", c1 + echo " ", c2 + except EInvalidValue: + echo " ERROR: ", getCurrentExceptionMsg() + echo "" diff --git a/Task/Circles-of-given-radius-through-two-points/Oforth/circles-of-given-radius-through-two-points.oforth b/Task/Circles-of-given-radius-through-two-points/Oforth/circles-of-given-radius-through-two-points.oforth new file mode 100644 index 0000000000..bb061ec983 --- /dev/null +++ b/Task/Circles-of-given-radius-through-two-points/Oforth/circles-of-given-radius-through-two-points.oforth @@ -0,0 +1,16 @@ +: circleCenter(x1, y1, x2, y2, r) +| d xmid ymid r1 md | + x2 x1 - sq y2 y1 - sq + sqrt -> d + x1 x2 + 2 / -> xmid + y1 y2 + 2 / -> ymid + 2 r * -> r1 + + d 0.0 == ifTrue: [ "Infinite number of circles" . return ] + d r1 == ifTrue: [ System.Out "One circle: (" << xmid << ", " << ymid << ")" << cr return ] + d r1 > ifTrue: [ "No circle" . return ] + + r sq d 2 / sq - sqrt ->md + + System.Out "C1 : (" << xmid y1 y2 - md * d / + << ", " << ymid x2 x1 - md * d / + << ")" << cr + System.Out "C2 : (" << xmid y1 y2 - md * d / - << ", " << ymid x2 x1 - md * d / - << ")" << cr +; diff --git a/Task/Circles-of-given-radius-through-two-points/Visual-FoxPro/circles-of-given-radius-through-two-points.visual b/Task/Circles-of-given-radius-through-two-points/Visual-FoxPro/circles-of-given-radius-through-two-points.visual new file mode 100644 index 0000000000..69883c9b9f --- /dev/null +++ b/Task/Circles-of-given-radius-through-two-points/Visual-FoxPro/circles-of-given-radius-through-two-points.visual @@ -0,0 +1,84 @@ +LOCAL p1 As point, p2 As point, rr As Double +CLOSE DATABASES ALL +SET FIXED ON +SET DECIMALS TO 4 +CLEAR +CREATE CURSOR circles (xc1 B(4), yc1 B(4), xc2 B(4), yc2 B(4), rad B(4)) +INSERT INTO circles VALUES (0.1234, 0.9876, 0.8765, 0.2345, 2.0) +INSERT INTO circles VALUES (0.0000, 2.0000, 0.0000, 0.0000, 1.0) +INSERT INTO circles VALUES (0.1234, 0.9876, 0.1234, 0.9876, 2.0) +INSERT INTO circles VALUES (0.1234, 0.9876, 0.8765, 0.2345, 0.5) +INSERT INTO circles VALUES (0.1234, 0.9876, 0.1234, 0.9876, 0.0) +GO TOP + +p1 = NEWOBJECT("point") +p2 = NEWOBJECT("point") +SCAN + p1.SetPoints(xc1, yc1) + p2.SetPoints(xc2, yc2) + rr = rad + GetCircles(p1, p2, rr) + ? +ENDSCAN + +SET DECIMALS TO +SET FIXED OFF + +PROCEDURE GetCircles(op1 As point, op2 As point, r As Double) +LOCAL ctr As point, half As point, lenhalf As Double, dist As Double, rot As point, c As String +ctr = NEWOBJECT("point") +half = NEWOBJECT("point") +ctr.SetPoints((op1.xc + op2.xc)/2, (op1.yc + op2.yc)/2) +half.SetPoints(op1.xc - ctr.xc, op1.yc - ctr.yc) +lenhalf = half.nLength +PrintPoints(op1, op2, r) +IF r < lenhalf + ? "Cannot solve for these parameters." + RETURN +ENDIF +IF lenhalf = 0 + ? "Points are coincident." + RETURN +ENDIF +dist = SQRT(r^2 - lenhalf^2)/lenhalf +rot = NEWOBJECT("point") +rot.SetPoints(-dist*(op1.yc - ctr.yc) + ctr.xc, dist*(op1.xc - ctr.xc) + ctr.yc) +TEXT TO c TEXTMERGE NOSHOW PRETEXT 3 + Circle 1 (<>, <>) +ENDTEXT +? c +rot.SetPoints(-(rot.xc - ctr.xc) + ctr.xc, -((rot.yc - ctr.yc)) + ctr.yc) +TEXT TO c TEXTMERGE NOSHOW PRETEXT 3 + Circle 2 (<>, <>) +ENDTEXT +? c +ENDPROC + +PROCEDURE PrintPoints(op1 As point, op2 As point, r As Double) +LOCAL lcTxt As String +TEXT TO lcTxt TEXTMERGE NOSHOW PRETEXT 3 + Points (<>,<>), (<>,<>) Radius <>. +ENDTEXT +? lcTxt +ENDPROC + +DEFINE CLASS point As Custom +xc = 0 +yc = 0 +nLength = 0 + +PROCEDURE Init +DODEFAULT() +ENDPROC + +PROCEDURE SetPoints(tnx As Double, tny As Double) +THIS.xc = tnx +THIS.yc = tny +THIS.nLength = THIS.GetLength() +ENDPROC + +FUNCTION GetLength() +RETURN SQRT(THIS.xc*THIS.xc + THIS.yc*THIS.yc) +ENDFUNC + +ENDDEFINE diff --git a/Task/Circles-of-given-radius-through-two-points/jq/circles-of-given-radius-through-two-points-1.jq b/Task/Circles-of-given-radius-through-two-points/jq/circles-of-given-radius-through-two-points-1.jq new file mode 100644 index 0000000000..151b3a3997 --- /dev/null +++ b/Task/Circles-of-given-radius-through-two-points/jq/circles-of-given-radius-through-two-points-1.jq @@ -0,0 +1,27 @@ +# circle_centers is defined here as a filter. +# Input should be an array [x1, y1, x2, y2, r] giving the co-ordinates +# of the two points and a radius. +# If there is one solution, the output is the circle center; +# if there are two solutions centered at [x1, y1] and [x2, y2], +# then the output is [x1, y1, x2, y2]; +# otherwise an explanatory string is returned. + +def circle_centers: + def sq: .*.; + def c(x3; y1; y2; r; d): x3 + ((r|sq - ((d/2)|sq)) | sqrt) * (y1-y2)/d; + + .[0] as $x1 | .[1] as $y1 | .[2] as $x2 | .[3] as $y2 | .[4] as $r + | ((($x2-$x1)|sq) + (($y2-$y1)|sq) | sqrt) as $d + | (($x1+$x2)/2) as $x3 + | (($y1+$y2)/2) as $y3 + | c($x3; $y1; $y2; $r; $d) as $cx1 + | c($y3; $x2; $x2; $r; $d) as $cy1 + | (- c(-$x3; $y1; $y2; $r; $d)) as $cx2 + | (- c(-$y3; $x2; $x2; $r; $d)) as $cy2 + | if $d == 0 and $r == 0 then [$x1, $y1] # special case + elif $d == 0 then "infinitely many circles can be drawn" + elif $d > $r*2 then "points are too far from each other" + elif 0 > $r then "radius is not valid" + elif ($cx1 and $cy1 and $cx2 and $cy2) | not then "no solution" + else [$cx1, $cy1, $cx2, $cy2 ] + end; diff --git a/Task/Circles-of-given-radius-through-two-points/jq/circles-of-given-radius-through-two-points-2.jq b/Task/Circles-of-given-radius-through-two-points/jq/circles-of-given-radius-through-two-points-2.jq new file mode 100644 index 0000000000..9bdb5533b2 --- /dev/null +++ b/Task/Circles-of-given-radius-through-two-points/jq/circles-of-given-radius-through-two-points-2.jq @@ -0,0 +1,8 @@ +( + [0.1234, 0.9876, 0.8765, 0.2345, 2], + [0.0000, 2.0000, 0.0000, 0.0000, 1], + [0.1234, 0.9876, 0.1234, 0.9876, 2], + [0.1234, 0.9876, 0.8765, 0.2345, 0.5], + [0.1234, 0.9876, 0.1234, 0.9876, 0] + ) + | "\(.) ───► \(circle_centers)" diff --git a/Task/Circles-of-given-radius-through-two-points/jq/circles-of-given-radius-through-two-points-3.jq b/Task/Circles-of-given-radius-through-two-points/jq/circles-of-given-radius-through-two-points-3.jq new file mode 100644 index 0000000000..b4a3d13687 --- /dev/null +++ b/Task/Circles-of-given-radius-through-two-points/jq/circles-of-given-radius-through-two-points-3.jq @@ -0,0 +1,7 @@ +$ jq -n -c -r -f /Users/peter/jq/circle_centers.jq + +[0.1234,0.9876,0.8765,0.2345,2] ───► [1.8631118016581893,1.974211801658189,-0.8632118016581896,-0.7521118016581892] +[0,2,0,0,1] ───► [0,1,0,1] +[0.1234,0.9876,0.1234,0.9876,2] ───► infinitely many circles can be drawn +[0.1234,0.9876,0.8765,0.2345,0.5] ───► points are too far from each other +[0.1234,0.9876,0.1234,0.9876,0] ───► [0.1234,0.9876] diff --git a/Task/Classes/Coco/classes.coco b/Task/Classes/Coco/classes.coco new file mode 100644 index 0000000000..59a06d1afa --- /dev/null +++ b/Task/Classes/Coco/classes.coco @@ -0,0 +1,15 @@ +class Rectangle + # The constructor is defined as a bare function. This + # constructor accepts one argument and automatically assigns it + # to an instance variable. + (@width) -> + + # Another instance variable. + length: 10 + + # A method. + area: -> + @width * @length + +# Instantiate the class using the 'new' operator. +rect = new Rectangle 2 diff --git a/Task/Classes/ERRE/classes.erre b/Task/Classes/ERRE/classes.erre new file mode 100644 index 0000000000..dcea4119f7 --- /dev/null +++ b/Task/Classes/ERRE/classes.erre @@ -0,0 +1,30 @@ +PROGRAM CLASS2_DEMO + +CLASS QUADRATO + + LOCAL LATO + + PROCEDURE GETLATO(L) + LATO=L + END PROCEDURE + + PROCEDURE AREA(->A) + A=LATO*LATO + END PROCEDURE + + PROCEDURE PERIMETRO(->P) + P=4*LATO + END PROCEDURE + +END CLASS + +NEW P:QUADRATO,Q:QUADRATO + +BEGIN + P_GETLATO(10) + P_AREA(->AREAP) + PRINT(AREAP) + Q_GETLATO(20) + Q_PERIMETRO(->PERIMETROQ) + PRINT(PERIMETROQ) +END PROGRAM diff --git a/Task/Classes/EchoLisp/classes-1.echolisp b/Task/Classes/EchoLisp/classes-1.echolisp new file mode 100644 index 0000000000..d75c5331da --- /dev/null +++ b/Task/Classes/EchoLisp/classes-1.echolisp @@ -0,0 +1,11 @@ +(lib 'gloops) ; load oo library + +(define-class Person null (name (age :initform 66))) +(define-method tostring (Person) (lambda (p) ( format "🚶 %a " p.name))) +(define-method mailto (Person Person) (lambda( p o) (printf "From %a to️ %a : ..." p o))) + +;; define a sub-class of Person with same methods +(define-class Writer (Person) (books)) +(define-method tostring (Writer) (lambda (w)( format "🎩 %a" w.name))) +(define-method mailto (Person Writer) + (lambda (p w) (printf " From %a (age %d). Dear writer of %a ..." p p.age w.books ))) diff --git a/Task/Classes/EchoLisp/classes-2.echolisp b/Task/Classes/EchoLisp/classes-2.echolisp new file mode 100644 index 0000000000..731c5f5c9e --- /dev/null +++ b/Task/Classes/EchoLisp/classes-2.echolisp @@ -0,0 +1,16 @@ +;; instantiate +(define simone (make-instance Person :name 'simone :age 42)) ;; slots values by name +(define antoinette (make-instance Person :name 'antoinette :age 37)) +(define albert (Person "albert" 33)) ;; quick way : slots values in order +(define simon (make-instance Writer :name "simon" :books '(my-life my-bike))) + + +(mailto simone simon) ;; method Person-Writer +(mailto simone antoinette) ;; method Person-Person +(mailto simon albert) ;; no method Writer-Person : call 'super' Person-Person +(mailto simon simon) ;; no mehod Writer-Writer : call 'super' Person-Writer + → + From 🚶 simone (age 42). Dear writer of (my-life my-bike) ... + From 🚶 simone to️ 🚶 antoinette : ... + From 🎩 simon to️ 🚶 albert : ... + From 🎩 simon (age 66). Dear writer of (my-life my-bike) ... diff --git a/Task/Classes/FreeBASIC/classes.freebasic b/Task/Classes/FreeBASIC/classes.freebasic new file mode 100644 index 0000000000..52e34057cd --- /dev/null +++ b/Task/Classes/FreeBASIC/classes.freebasic @@ -0,0 +1,27 @@ +' FB 1.05.0 Win64 + +Type MyClass + Private: + myInt_ As Integer + Public: + Declare Constructor(myInt_ As Integer) + Declare Property MyInt() As Integer + Declare Function Treble() As Integer +End Type + +Constructor MyClass(myInt_ As Integer) + This.myInt_ = myInt_ +End Constructor + +Property MyClass.MyInt() As Integer + Return myInt_ +End Property + +Function MyClass.Treble() As Integer + Return 3 * myInt_ +End Function + +Dim mc As MyClass = MyClass(24) +Print mc.MyInt, mc.Treble() +Print "Press any key to quit the program" +Sleep diff --git a/Task/Classes/LFE/classes-1.lfe b/Task/Classes/LFE/classes-1.lfe new file mode 100644 index 0000000000..fa7d236c13 --- /dev/null +++ b/Task/Classes/LFE/classes-1.lfe @@ -0,0 +1,31 @@ +(defmodule simple-object + (export all)) + +(defun fish-class (species) + " + This is the constructor used internally, once the children and fish id are + known. + " + (let ((habitat '"water")) + (lambda (method-name) + (case method-name + ('habitat + (lambda (self) habitat)) + ('species + (lambda (self) species)))))) + +(defun get-method (object method-name) + " + This is a generic function, used to call into the given object (class + instance). + " + (funcall object method-name)) + +; define object methods +(defun get-habitat (object) + "Get a variable set in the class." + (funcall (get-method object 'habitat) object)) + +(defun get-species (object) + "Get a variable passed when constructing the object." + (funcall (get-method object 'species) object)) diff --git a/Task/Classes/LFE/classes-2.lfe b/Task/Classes/LFE/classes-2.lfe new file mode 100644 index 0000000000..baaa68bf0e --- /dev/null +++ b/Task/Classes/LFE/classes-2.lfe @@ -0,0 +1,8 @@ +> (slurp '"simple-object.lfe") +#(ok simple-object) +> (set my-fish (fish-class '"Carp")) +#Fun +> (get-habitat my-fish) +"water" +> (get-species my-fish) +"Carp" diff --git a/Task/Classes/Lasso/classes.lasso b/Task/Classes/Lasso/classes.lasso new file mode 100644 index 0000000000..497fcafed6 --- /dev/null +++ b/Task/Classes/Lasso/classes.lasso @@ -0,0 +1,19 @@ +define mytype => type { + data + public id::integer = 0, + public val::string = '', + public rand::integer = 0 + + public onCreate() => { + // "onCreate" runs when instance created, populates .rand + .rand = math_random(50,1) + } + public asString() => { + return 'has a value of: "'+.val+'" and a rand number of "'+.rand+'"' + } + +} + +local(x = mytype) +#x->val = '99 Bottles of beer' +#x->asString // outputs 'has a value of: "99 Bottles of beer" and a rand number of "48"' diff --git a/Task/Classes/Lingo/classes-1.lingo b/Task/Classes/Lingo/classes-1.lingo new file mode 100644 index 0000000000..78ca8669e9 --- /dev/null +++ b/Task/Classes/Lingo/classes-1.lingo @@ -0,0 +1,19 @@ +---------------------------------------- +-- @desc Class "MyClass" +-- @file parent script "MyClass" +---------------------------------------- + +-- instance variable +property _myvar + +-- constructor +on new (me) + me._myvar = 23 + return me +end + +-- a method +on doubleAndPrint (me) + me._myvar = me._myvar * 2 + put me._myvar +end diff --git a/Task/Classes/Lingo/classes-2.lingo b/Task/Classes/Lingo/classes-2.lingo new file mode 100644 index 0000000000..bb00a2999c --- /dev/null +++ b/Task/Classes/Lingo/classes-2.lingo @@ -0,0 +1,3 @@ +foo = script("MyClass").new() +foo.doubleAndPrint() +-- 46 diff --git a/Task/Classes/Nim/classes.nim b/Task/Classes/Nim/classes.nim new file mode 100644 index 0000000000..0ef8f99e80 --- /dev/null +++ b/Task/Classes/Nim/classes.nim @@ -0,0 +1,27 @@ +type MyClass = object + name: int + +proc initMyClass(): MyClass = + result.name = 2 + +proc someMethod(m: var MyClass) = + m.name = 1 + +var mc = initMyClass() +mc.someMethod() + +type + Gender = enum male, female, other + + MyOtherClass = object + name: string + gender: Gender + age: Natural + +proc initMyOtherClass(name; gender = female; age = 50): auto = + MyOtherClass(name: name, gender: gender, age: age) + +var person1 = initMyOtherClass("Jane") +echo person1.name, " ", person1.gender, " ", person1.age # Jane female 50 +var person2 = initMyOtherClass("John", male, 23) +echo person2.name, " ", person2.gender, " ", person2.age # John male 23 diff --git a/Task/Classes/Oforth/classes-1.oforth b/Task/Classes/Oforth/classes-1.oforth new file mode 100644 index 0000000000..eba32dcc9f --- /dev/null +++ b/Task/Classes/Oforth/classes-1.oforth @@ -0,0 +1,2 @@ +Object Class new: MyClass(att) +MyClass method: initialize(v) v := att ; diff --git a/Task/Classes/Oforth/classes-2.oforth b/Task/Classes/Oforth/classes-2.oforth new file mode 100644 index 0000000000..5acf99a6e2 --- /dev/null +++ b/Task/Classes/Oforth/classes-2.oforth @@ -0,0 +1 @@ +MyClass new("some value") diff --git a/Task/Classes/PHL/classes.phl b/Task/Classes/PHL/classes.phl new file mode 100644 index 0000000000..6162ddebd0 --- /dev/null +++ b/Task/Classes/PHL/classes.phl @@ -0,0 +1,23 @@ +module classes; + +extern printf; + +class @MyClass { + field @Integer myField { get:get_myField, set:set_myField }; + + new [ + this.set_myField(2); + ] + + @Void method [ + this.set_myField(this::get_myField + 1); + ] +}; + +@Integer main [ + var obj = new @MyClass; + printf("obj.myField: %i\n", obj::get_myField); + obj::method; + printf("obj.myField: %i\n", obj::get_myField); + return 0; +] diff --git a/Task/Classes/Ring/classes-1.ring b/Task/Classes/Ring/classes-1.ring new file mode 100644 index 0000000000..c6eff9ee8e --- /dev/null +++ b/Task/Classes/Ring/classes-1.ring @@ -0,0 +1,2 @@ +New point { x=10 y=20 z=30 print() } +Class Point x y z func print see x + nl + y + nl + z + nl diff --git a/Task/Classes/Ring/classes-2.ring b/Task/Classes/Ring/classes-2.ring new file mode 100644 index 0000000000..c5e502ca11 --- /dev/null +++ b/Task/Classes/Ring/classes-2.ring @@ -0,0 +1,15 @@ +New point # create new object using the point class +{ # access the new object attributes and methods + x = 10 # set the x attribute to 10 + y = 20 # set the y attribute to 20 + z = 30 # set the z attribute to 30 + print() # call the print method +} # end of object access + + +Class Point # define the Point class + x y z # the class contains three attributes x, y & z + func print # define the print method + see x + nl + # print the x attribute + y + nl + # print the y attribute + z + nl # print the z attribute diff --git a/Task/Classes/Sidef/classes.sidef b/Task/Classes/Sidef/classes.sidef new file mode 100644 index 0000000000..751ec9d5a4 --- /dev/null +++ b/Task/Classes/Sidef/classes.sidef @@ -0,0 +1,9 @@ +class MyClass(instance_var) { + method add(num) { + instance_var += num; + } +} + +var obj = MyClass(3); # `instance_var` will be set to 3 +obj.add(5); # calls the add() method +say obj.instance_var; # prints the value of `instance_var`: 8 diff --git a/Task/Classes/Swift/classes-1.swift b/Task/Classes/Swift/classes-1.swift new file mode 100644 index 0000000000..d48f895884 --- /dev/null +++ b/Task/Classes/Swift/classes-1.swift @@ -0,0 +1,19 @@ +class MyClass{ + + // stored property + var variable : Int + + /** + * The constructor + */ + init() { + self.variable = 42 + } + + /** + * A method + */ + func someMethod() { + self.variable = 1 + } +} diff --git a/Task/Classes/Swift/classes-2.swift b/Task/Classes/Swift/classes-2.swift new file mode 100644 index 0000000000..1fa36c1a87 --- /dev/null +++ b/Task/Classes/Swift/classes-2.swift @@ -0,0 +1 @@ +MyClass() diff --git a/Task/Classes/Visual-FoxPro/classes.visual b/Task/Classes/Visual-FoxPro/classes.visual new file mode 100644 index 0000000000..228ac0dffc --- /dev/null +++ b/Task/Classes/Visual-FoxPro/classes.visual @@ -0,0 +1,28 @@ +LOCAL o1 As MyClass, o2 As MyClass +*!* Instantiate o1 +o1 = NEWOBJECT("MyClass") +o1.ShowInstance() +*!* Instantiate o2 +o2 = CREATEOBJECT("MyClass", 2) +o2.ShowInstance() + + +DEFINE CLASS MyClass As Session +*!* Custom property (protected) +PROTECTED nInstance +nInstance = 0 + +*!* Constructor +PROCEDURE Init(tnInstance As Integer) +IF VARTYPE(tnInstance) = "N" + THIS.nInstance = tnInstance +ELSE + THIS.nInstance = THIS.nInstance + 1 +ENDIF +ENDPROC + +*!* Custom Method +PROCEDURE ShowInstance +? "Instance", THIS.nInstance +ENDPROC +ENDDEFINE diff --git a/Task/Classes/XLISP/classes.xlisp b/Task/Classes/XLISP/classes.xlisp new file mode 100644 index 0000000000..348f81aa97 --- /dev/null +++ b/Task/Classes/XLISP/classes.xlisp @@ -0,0 +1,19 @@ +(DEFINE-CLASS PROGRAMMING-LANGUAGE + (INSTANCE-VARIABLES NAME YEAR)) + +(DEFINE-METHOD (PROGRAMMING-LANGUAGE 'INITIALIZE X) + (SETQ NAME X) + SELF) + +(DEFINE-METHOD (PROGRAMMING-LANGUAGE 'WAS-CREATED-IN X) + (SETQ YEAR X)) + +(DEFINE-METHOD (PROGRAMMING-LANGUAGE 'DESCRIBE) + `(THE PROGRAMMING LANGUAGE ,NAME WAS CREATED IN ,YEAR)) + +(DEFINE LISP (PROGRAMMING-LANGUAGE 'NEW 'LISP)) + +(LISP 'WAS-CREATED-IN 1958) + +(DISPLAY (LISP 'DESCRIBE)) +(NEWLINE) diff --git a/Task/Closest-pair-problem/Phix/closest-pair-problem.phix b/Task/Closest-pair-problem/Phix/closest-pair-problem.phix new file mode 100644 index 0000000000..0da6443fc3 --- /dev/null +++ b/Task/Closest-pair-problem/Phix/closest-pair-problem.phix @@ -0,0 +1,104 @@ +function bruteForceClosestPair(sequence s) +atom {x1,y1} = s[1], {x2,y2} = s[2], dx = x1-x2, dy = y1-y2, mind = dx*dx+dy*dy +sequence minp = s[1..2] + for i=1 to length(s)-1 do + {x1,y1} = s[i] + for j=i+1 to length(s) do + {x2,y2} = s[j] + dx = x1-x2 + dx = dx*dx + if dx1 equidistant pairs exist, brute and dc may well return different pairs; +-- it is only a problem if they decide to return different minimum distances.) +atom {{x1,y1},{x2,y2}} = sort(points) +printf(1,"Closest pair: {%f,%f} {%f,%f}, distance=%f (%3.2fs)\n",{x1,y2,x2,y2,d,time()-t0}) + +t0 = time() +constant X = 1, Y = 2 +sequence xP = sort(testset) + +function byY(sequence p1, p2) + return compare(p1[Y],p2[Y]) +end function +sequence yP = custom_sort(routine_id("byY"),testset) + +function distsq(sequence p1,p2) +atom {x1,y1} = p1, {x2,y2} = p2 + x1 -= x2 + y1 -= y2 + return x1*x1 + y1*y1 +end function + +function closestPair(sequence xP, yP) +-- where xP is P(1) .. P(N) sorted by x coordinate, and +-- yP is P(1) .. P(N) sorted by y coordinate (ascending order) +integer N, midN, k, nS +sequence xL, xR, yL, yR, pairL, pairR, pairMin, yS, cPair +atom xm, dL, dR, dmin, closest + + N = length(xP) + if length(yP)!=N then ?9/0 end if -- (sanity check) + if N<=3 then + return bruteForceClosestPair(xP) + end if + midN = floor(N/2) + xL = xP[1..midN] + xR = xP[midN+1..N] + xm = xP[midN][X] + yL = {} + yR = {} + for i=1 to N do + if yP[i][X]<=xm then + yL = append(yL,yP[i]) + else + yR = append(yR,yP[i]) + end if + end for + {dL, pairL} = closestPair(xL, yL) + {dR, pairR} = closestPair(xR, yR) + {dmin, pairMin} = {dR, pairR} + if dL 1.4) of jq +# Emit the first input that satisfied the condition +def until(cond; next): + def _until: + if cond then . else (next|_until) end; + _until; + +# Euclidean 2d distance +def dist(x;y): + [x[0] - y[0], x[1] - y[1]] | map(.*.) | add | sqrt; diff --git a/Task/Closest-pair-problem/jq/closest-pair-problem-2.jq b/Task/Closest-pair-problem/jq/closest-pair-problem-2.jq new file mode 100644 index 0000000000..affff3139f --- /dev/null +++ b/Task/Closest-pair-problem/jq/closest-pair-problem-2.jq @@ -0,0 +1,53 @@ +# P is an array of points, [x,y]. +# Emit the solution in the form [dist, [P1, P2]] +def bruteForceClosestPair(P): + (P|length) as $length + | if $length < 2 then null + else + reduce range(0; $length-1) as $i + ( null; + reduce range($i+1; $length) as $j + (.; + dist(P[$i]; P[$j]) as $d + | if . == null or $d < .[0] then [$d, [ P[$i], P[$j] ] ] else . end ) ) + end; + +def closest_pair: + + def abs: if . < 0 then -. else . end; + def ceil: floor as $floor + | if . == $floor then $floor else $floor + 1 end; + + # xP is an array [P(1), .. P(N)] sorted by x coordinate, and + # yP is an array [P(1), .. P(N)] sorted by y coordinate (ascending order). + # if N <= 3 then return closest points of xP using the brute-force algorithm. + def closestPair(xP; yP): + if xP|length <= 3 then bruteForceClosestPair(xP) + else + ((xP|length)/2|ceil) as $N + | xP[0:$N] as $xL + | xP[$N:] as $xR + | xP[$N-1][0] as $xm # middle + | (yP | map(select(.[0] <= $xm ))) as $yL0 # might be too long + | (yP | map(select(.[0] > $xm ))) as $yR0 # might be too short + | (if $yL0|length == $N then $yL0 else $yL0[0:$N] end) as $yL + | (if $yL0|length == $N then $yR0 else $yL0[$N:] + $yR0 end) as $yR + | closestPair($xL; $yL) as $pairL # [dL, pairL] + | closestPair($xR; $yR) as $pairR # [dR, pairR] + | (if $pairL[0] < $pairR[0] then $pairL else $pairR end) as $pair # [ dmin, pairMin] + | (yP | map(select( (($xm - .[0])|abs) < $pair[0]))) as $yS + | ($yS | length) as $nS + | $pair[0] as $dmin + | reduce range(0; $nS - 1) as $i + ( [0, $pair]; # state: [k, [d, [P1,P2]]] + .[0] = $i + 1 + | until( .[0] as $k | $k >= $nS or ($yS[$k][1] - $yS[$i][1]) >= $dmin; + .[0] as $k + | dist($yS[$k]; $yS[$i]) as $d + | if $d < .[1][0] + then [$k+1, [ $d, [$yS[$k], $yS[$i]]]] + else .[0] += 1 + end) ) + | .[1] + end; + closestPair( sort_by(.[0]); sort_by(.[1])) ; diff --git a/Task/Closest-pair-problem/jq/closest-pair-problem-3.jq b/Task/Closest-pair-problem/jq/closest-pair-problem-3.jq new file mode 100644 index 0000000000..48282c79db --- /dev/null +++ b/Task/Closest-pair-problem/jq/closest-pair-problem-3.jq @@ -0,0 +1,13 @@ +def data: + [[0.748501, 4.09624], + [3.00302, 5.26164], + [3.61878, 9.52232], + [7.46911, 4.71611], + [5.7819, 2.69367], + [2.34709, 8.74782], + [2.87169, 5.97774], + [6.33101, 0.463131], + [7.46489, 4.6268], + [1.45428, 0.087596] ]; + +data | closest_pair diff --git a/Task/Closures-Value-capture/AntLang/closures-value-capture.antlang b/Task/Closures-Value-capture/AntLang/closures-value-capture.antlang new file mode 100644 index 0000000000..3eff623f5c --- /dev/null +++ b/Task/Closures-Value-capture/AntLang/closures-value-capture.antlang @@ -0,0 +1,2 @@ +fns: {n: x; {n expt 2}} map range[10] +(8 elem fns)[] diff --git a/Task/Closures-Value-capture/Ceylon/closures-value-capture.ceylon b/Task/Closures-Value-capture/Ceylon/closures-value-capture.ceylon new file mode 100644 index 0000000000..725b844f3b --- /dev/null +++ b/Task/Closures-Value-capture/Ceylon/closures-value-capture.ceylon @@ -0,0 +1,9 @@ +shared void run() { + + //create a list of closures with a list comprehension + value closures = [for(i in 0:10) () => i ^ 2]; + + for(i->closure in closures.indexed) { + print("closure number ``i`` returns: ``closure()``"); + } +} diff --git a/Task/Closures-Value-capture/EchoLisp/closures-value-capture.echolisp b/Task/Closures-Value-capture/EchoLisp/closures-value-capture.echolisp new file mode 100644 index 0000000000..0ef4b6dabc --- /dev/null +++ b/Task/Closures-Value-capture/EchoLisp/closures-value-capture.echolisp @@ -0,0 +1,4 @@ +(define (fgen i) (lambda () (* i i))) +(define fs (for/vector ((i 10)) (fgen i))) ;; vector of 10 anonymous functions +((vector-ref fs 5)) ;; calls fs[5] + → 25 diff --git a/Task/Closures-Value-capture/FreeBASIC/closures-value-capture.freebasic b/Task/Closures-Value-capture/FreeBASIC/closures-value-capture.freebasic new file mode 100644 index 0000000000..5a27f405bb --- /dev/null +++ b/Task/Closures-Value-capture/FreeBASIC/closures-value-capture.freebasic @@ -0,0 +1,33 @@ +' FB 1.05.0 Win64 + +Type Closure + Private: + index As Integer + Public: + Declare Constructor(index As Integer = 0) + Declare Function Square As Integer +End Type + +Constructor Closure(index As Integer = 0) + This.index = index +End Constructor + +Function Closure.Square As Integer + Return index * index +End Function + +Dim a(1 To 10) As Closure + +' create Closure objects which capture their index +For i As Integer = 1 To 10 + a(i) = Closure(i) +Next + +' call the Square method on all but the last object +For i As Integer = 1 to 9 + Print a(i).Square +Next + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Closures-Value-capture/LFE/closures-value-capture-1.lfe b/Task/Closures-Value-capture/LFE/closures-value-capture-1.lfe new file mode 100644 index 0000000000..13bd0eb0af --- /dev/null +++ b/Task/Closures-Value-capture/LFE/closures-value-capture-1.lfe @@ -0,0 +1,2 @@ +> (set funcs (list-comp ((<- m (lists:seq 1 10))) + (lambda () (math:pow m 2)))) diff --git a/Task/Closures-Value-capture/LFE/closures-value-capture-2.lfe b/Task/Closures-Value-capture/LFE/closures-value-capture-2.lfe new file mode 100644 index 0000000000..f3cac8e128 --- /dev/null +++ b/Task/Closures-Value-capture/LFE/closures-value-capture-2.lfe @@ -0,0 +1,5 @@ +(#Fun #Fun + #Fun #Fun + #Fun #Fun + #Fun #Fun + #Fun #Fun) diff --git a/Task/Closures-Value-capture/LFE/closures-value-capture-3.lfe b/Task/Closures-Value-capture/LFE/closures-value-capture-3.lfe new file mode 100644 index 0000000000..c9ed6aea78 --- /dev/null +++ b/Task/Closures-Value-capture/LFE/closures-value-capture-3.lfe @@ -0,0 +1,8 @@ +> (funcall (car funcs)) +1.0 +> (funcall (cadr funcs)) +4.0 +> (funcall (cadddr funcs)) +16.0 +> (funcall (lists:nth 8 funcs)) +64.0 diff --git a/Task/Closures-Value-capture/Lingo/closures-value-capture-1.lingo b/Task/Closures-Value-capture/Lingo/closures-value-capture-1.lingo new file mode 100644 index 0000000000..4518294f36 --- /dev/null +++ b/Task/Closures-Value-capture/Lingo/closures-value-capture-1.lingo @@ -0,0 +1,24 @@ +-- parent script "CallFunction" + +property _code + +-- if the function is supposed to return something, the code must contain a line that starts with "res=" +on new (me, code) + me._code = code + return me +end + +on call (me) + ---------------------------------------- + -- If custom arguments were passed, evaluate them in the current context. + -- Note: in the code passed to the constructor they have to be referenced + -- as arg[1], arg[2], ... + arg = [] + repeat with i = 3 to the paramCount + arg[i-2] = param(i) + end repeat + ---------------------------------------- + res = VOID + do(me._code) + return res +end diff --git a/Task/Closures-Value-capture/Lingo/closures-value-capture-2.lingo b/Task/Closures-Value-capture/Lingo/closures-value-capture-2.lingo new file mode 100644 index 0000000000..f6847c4a2f --- /dev/null +++ b/Task/Closures-Value-capture/Lingo/closures-value-capture-2.lingo @@ -0,0 +1,8 @@ +funcs = [] +repeat with i = 1 to 10 + code = "res="&i&"*"&i + funcs[i] = script("CallFunction").new(code) +end repeat + +put call(funcs[3], _movie) +-- 9 diff --git a/Task/Closures-Value-capture/Lingo/closures-value-capture-3.lingo b/Task/Closures-Value-capture/Lingo/closures-value-capture-3.lingo new file mode 100644 index 0000000000..9773f72f05 --- /dev/null +++ b/Task/Closures-Value-capture/Lingo/closures-value-capture-3.lingo @@ -0,0 +1,15 @@ +funcs = [] +repeat with i = 1 to 10 + code = "" + put "res = "&i&"*"&i &RETURN after code + put "repeat with i = 1 to arg.count" &RETURN after code + put " res = res + arg[i]" &RETURN after code + put "end repeat" after code + funcs[i] = script("CallFunction").new(code) +end repeat + +put call(funcs[3], _movie, 23) +-- 32 + +put call(funcs[7], _movie, 4, 5, 6) +-- 64 diff --git a/Task/Closures-Value-capture/Nim/closures-value-capture.nim b/Task/Closures-Value-capture/Nim/closures-value-capture.nim new file mode 100644 index 0000000000..d1ddc30f68 --- /dev/null +++ b/Task/Closures-Value-capture/Nim/closures-value-capture.nim @@ -0,0 +1,9 @@ +var funcs: seq[proc(): int] = @[] + +for i in 0..9: + (proc = + let x = i + funcs.add(proc (): int = x * x))() + +for i in 0..8: + echo "func[", i, "]: ", funcs[i]() diff --git a/Task/Closures-Value-capture/Oforth/closures-value-capture.oforth b/Task/Closures-Value-capture/Oforth/closures-value-capture.oforth new file mode 100644 index 0000000000..516473f84c --- /dev/null +++ b/Task/Closures-Value-capture/Oforth/closures-value-capture.oforth @@ -0,0 +1,2 @@ +: newClosure(i) #[ i sq ] ; +10 seq map(#newClosure) at(7) perform . diff --git a/Task/Closures-Value-capture/Ring/closures-value-capture.ring b/Task/Closures-Value-capture/Ring/closures-value-capture.ring new file mode 100644 index 0000000000..c372da84d2 --- /dev/null +++ b/Task/Closures-Value-capture/Ring/closures-value-capture.ring @@ -0,0 +1,9 @@ +x = funcs(7) +see x + nl + +func funcs n + fn = list(n) + for i = 1 to n + fn[i] =i*i + next + return fn diff --git a/Task/Closures-Value-capture/Sidef/closures-value-capture-1.sidef b/Task/Closures-Value-capture/Sidef/closures-value-capture-1.sidef new file mode 100644 index 0000000000..415af77fda --- /dev/null +++ b/Task/Closures-Value-capture/Sidef/closures-value-capture-1.sidef @@ -0,0 +1,7 @@ +var f = ( + 0 ..^ 9 -> map {|i| func(j){i * j} } +); + +0 ..^ 8 -> each { |j| + say f[j](j); +} diff --git a/Task/Closures-Value-capture/Sidef/closures-value-capture-2.sidef b/Task/Closures-Value-capture/Sidef/closures-value-capture-2.sidef new file mode 100644 index 0000000000..6610323e34 --- /dev/null +++ b/Task/Closures-Value-capture/Sidef/closures-value-capture-2.sidef @@ -0,0 +1,7 @@ +var f = 10.of { |i| + func(j){i * j} +} + +9.times { |j| + say f[j-1](j); +} diff --git a/Task/Closures-Value-capture/Sparkling/closures-value-capture-1.sparkling b/Task/Closures-Value-capture/Sparkling/closures-value-capture-1.sparkling new file mode 100644 index 0000000000..b97a451175 --- /dev/null +++ b/Task/Closures-Value-capture/Sparkling/closures-value-capture-1.sparkling @@ -0,0 +1,9 @@ +var fnlist = {}; +for var i = 0; i < 10; i++ { + fnlist[i] = function() { + return i * i; + }; +} + +print(fnlist[3]()); // prints 9 +print(fnlist[5]()); // prints 25 diff --git a/Task/Closures-Value-capture/Sparkling/closures-value-capture-2.sparkling b/Task/Closures-Value-capture/Sparkling/closures-value-capture-2.sparkling new file mode 100644 index 0000000000..13cb1358a5 --- /dev/null +++ b/Task/Closures-Value-capture/Sparkling/closures-value-capture-2.sparkling @@ -0,0 +1,8 @@ +var fnlist = map(range(10), function(k, v) { + return function() { + return v * v; + }; +}); + +print(fnlist[3]()); // prints 9 +print(fnlist[5]()); // prints 25 diff --git a/Task/Closures-Value-capture/Swift/closures-value-capture-1.swift b/Task/Closures-Value-capture/Swift/closures-value-capture-1.swift new file mode 100644 index 0000000000..14fe0fbf31 --- /dev/null +++ b/Task/Closures-Value-capture/Swift/closures-value-capture-1.swift @@ -0,0 +1,5 @@ +var funcs: [() -> Int] = [] +for var i = 0; i < 10; i++ { + funcs.append({ i * i }) +} +println(funcs[3]()) // prints 100 diff --git a/Task/Closures-Value-capture/Swift/closures-value-capture-2.swift b/Task/Closures-Value-capture/Swift/closures-value-capture-2.swift new file mode 100644 index 0000000000..c4b3db115c --- /dev/null +++ b/Task/Closures-Value-capture/Swift/closures-value-capture-2.swift @@ -0,0 +1,5 @@ +var funcs: [() -> Int] = [] +for i in 0..<10 { + funcs.append({ i * i }) +} +println(funcs[3]()) // prints 9 diff --git a/Task/Closures-Value-capture/Swift/closures-value-capture-3.swift b/Task/Closures-Value-capture/Swift/closures-value-capture-3.swift new file mode 100644 index 0000000000..697db5c6dd --- /dev/null +++ b/Task/Closures-Value-capture/Swift/closures-value-capture-3.swift @@ -0,0 +1,5 @@ +var funcs: [() -> Int] = [] +for var i = 0; i < 10; i++ { + funcs.append({ [i] in i * i }) +} +println(funcs[3]()) // prints 9 diff --git a/Task/Closures-Value-capture/Swift/closures-value-capture-4.swift b/Task/Closures-Value-capture/Swift/closures-value-capture-4.swift new file mode 100644 index 0000000000..52e5dbe2f1 --- /dev/null +++ b/Task/Closures-Value-capture/Swift/closures-value-capture-4.swift @@ -0,0 +1,2 @@ +let funcs = [] + map(0..<10) {i in { i * i }} +println(funcs[3]()) // prints 9 diff --git a/Task/Collections/Apex/collections-1.apex b/Task/Collections/Apex/collections-1.apex new file mode 100644 index 0000000000..a19c84c53e --- /dev/null +++ b/Task/Collections/Apex/collections-1.apex @@ -0,0 +1,4 @@ +// Create an empty list of String +List my_list = new List(); +// Create a nested list +List>> my_list_2 = new List>>(); diff --git a/Task/Collections/Apex/collections-2.apex b/Task/Collections/Apex/collections-2.apex new file mode 100644 index 0000000000..b303005779 --- /dev/null +++ b/Task/Collections/Apex/collections-2.apex @@ -0,0 +1,6 @@ +List myList = new List(); // Define a new list +myList.add(47); // Adds a second element of value 47 to the end + // of the list +Integer i = myList.get(0); // Retrieves the element at index 0 +myList.set(0, 1); // Adds the integer 1 to the list at index 0 +myList.clear(); // Removes all elements from the list diff --git a/Task/Collections/Apex/collections-3.apex b/Task/Collections/Apex/collections-3.apex new file mode 100644 index 0000000000..bc32753e6b --- /dev/null +++ b/Task/Collections/Apex/collections-3.apex @@ -0,0 +1,3 @@ +String[] colors = new List(); +List colors = new String[1]; +colors[0] = 'Green'; diff --git a/Task/Collections/Apex/collections-4.apex b/Task/Collections/Apex/collections-4.apex new file mode 100644 index 0000000000..49190b01e4 --- /dev/null +++ b/Task/Collections/Apex/collections-4.apex @@ -0,0 +1,3 @@ +Set s1 = new Set{'a', 'b + c'}; // Defines a new set with two elements +Set s2 = new Set(s1); // Defines a new set that contains the + // elements of the set created in the previous step diff --git a/Task/Collections/Apex/collections-5.apex b/Task/Collections/Apex/collections-5.apex new file mode 100644 index 0000000000..fb3c695815 --- /dev/null +++ b/Task/Collections/Apex/collections-5.apex @@ -0,0 +1,4 @@ +Set s = new Set(); // Define a new set +s.add(1); // Add an element to the set +System.assert(s.contains(1)); // Assert that the set contains an element +s.remove(1); // Remove the element from the set diff --git a/Task/Collections/Apex/collections-6.apex b/Task/Collections/Apex/collections-6.apex new file mode 100644 index 0000000000..c4d3dc15a3 --- /dev/null +++ b/Task/Collections/Apex/collections-6.apex @@ -0,0 +1,3 @@ +Map country_currencies = new Map(); +Map> m = new Map>(); +Map MyStrings = new Map{'a' => 'b', 'c' => 'd'.toUpperCase()}; diff --git a/Task/Collections/Apex/collections-7.apex b/Task/Collections/Apex/collections-7.apex new file mode 100644 index 0000000000..9b06ae7031 --- /dev/null +++ b/Task/Collections/Apex/collections-7.apex @@ -0,0 +1,7 @@ +Map m = new Map(); // Define a new map +m.put(1, 'First entry'); // Insert a new key-value pair in the map +m.put(2, 'Second entry'); // Insert a new key-value pair in the map +System.assert(m.containsKey(1)); // Assert that the map contains a key +String value = m.get(2); // Retrieve a value, given a particular key +System.assertEquals('Second entry', value); +Set s = m.keySet(); // Return a set that contains all of the keys in the map diff --git a/Task/Collections/Axe/collections.axe b/Task/Collections/Axe/collections.axe new file mode 100644 index 0000000000..5f9d9b4a67 --- /dev/null +++ b/Task/Collections/Axe/collections.axe @@ -0,0 +1,8 @@ +1→{L₁} +2→{L₁+1} +3→{L₁+2} +4→{L₁+3} +Disp {L₁}►Dec,i +Disp {L₁+1}►Dec,i +Disp {L₁+2}►Dec,i +Disp {L₁+3}►Dec,i diff --git a/Task/Collections/EchoLisp/collections.echolisp b/Task/Collections/EchoLisp/collections.echolisp new file mode 100644 index 0000000000..91d0978d5b --- /dev/null +++ b/Task/Collections/EchoLisp/collections.echolisp @@ -0,0 +1,9 @@ +(define my-collection ' ( 🌱 ☀️ ☔️ )) +(set! my-collection (cons '🎥 my-collection)) +(set! my-collection (cons '🐧 my-collection)) +my-collection + → (🐧 🎥 🌱 ☀️ ☔️) + +;; save it +(local-put 'my-collection) + → my-collection diff --git a/Task/Collections/FreeBASIC/collections.freebasic b/Task/Collections/FreeBASIC/collections.freebasic new file mode 100644 index 0000000000..9580b0a062 --- /dev/null +++ b/Task/Collections/FreeBASIC/collections.freebasic @@ -0,0 +1,17 @@ +' FB 1.05.0 Win64 + +'create fixed size array of integers +Dim a(1 To 5) As Integer = {1, 2, 3, 4, 5} +Print a(2), a(4) + +'create empty dynamic array of doubles +Dim b() As Double +' add two elements by first redimensioning the array to hold this number of elements +Redim b(0 To 1) +b(0) = 3.5 : b(1) = 7.1 +Print b(0), b(1) + +'create 2 dimensional fixed size array of bytes +Dim c(1 To 2, 1 To 2) As Byte = {{1, 2}, {3, 4}} +Print c(1, 1), c(2,2) +Sleep diff --git a/Task/Collections/Lingo/collections.lingo b/Task/Collections/Lingo/collections.lingo new file mode 100644 index 0000000000..d8f9f1854b --- /dev/null +++ b/Task/Collections/Lingo/collections.lingo @@ -0,0 +1,13 @@ +-- list stuff +l = [1, 2] +l.add(3) +l.add(4) +put l +-- [1, 2, 3, 4] + +-- property list stuff +pl = [#foo: 1, #bar: 2] +pl[#foobar] = 3 +pl["barfoo"] = 4 +put pl +-- [#foo: 1, #bar: 2, #foobar: 3, "barfoo": 4] diff --git a/Task/Collections/Nim/collections-1.nim b/Task/Collections/Nim/collections-1.nim new file mode 100644 index 0000000000..ac491c532d --- /dev/null +++ b/Task/Collections/Nim/collections-1.nim @@ -0,0 +1,6 @@ +var a = [1,2,3,4,5,6,7,8,9] +var b: array[128, int] +b[9] = 10 +b[0..8] = a +var c: array['a'..'d', float] = [1.0, 1.1, 1.2, 1.3] +c['b'] = 10000 diff --git a/Task/Collections/Nim/collections-2.nim b/Task/Collections/Nim/collections-2.nim new file mode 100644 index 0000000000..5d0ac0bd96 --- /dev/null +++ b/Task/Collections/Nim/collections-2.nim @@ -0,0 +1,11 @@ +var d = @[1,2,3,5,6,7,8,9] +d.add(10) +d.add([11,12,13,14]) +d[0] = 0 + +var e: seq[float] = @[] +e.add(15.5) + +var f = newSeq[string]() +f.add("foo") +f.add("bar") diff --git a/Task/Collections/Nim/collections-3.nim b/Task/Collections/Nim/collections-3.nim new file mode 100644 index 0000000000..7c572018b1 --- /dev/null +++ b/Task/Collections/Nim/collections-3.nim @@ -0,0 +1,7 @@ +var g = (13, 13, 14) +g[0] = 12 + +var h: tuple[key: string, val: int] = ("foo", 100) + +# A sequence of key-val tuples: +var i = {"foo": 12, "bar": 13} diff --git a/Task/Collections/Nim/collections-4.nim b/Task/Collections/Nim/collections-4.nim new file mode 100644 index 0000000000..7504c63abd --- /dev/null +++ b/Task/Collections/Nim/collections-4.nim @@ -0,0 +1,6 @@ +var j: set[char] +j.incl('X') + +var k = {'a'..'z', '0'..'9'} + +j = j + k diff --git a/Task/Collections/Nim/collections-5.nim b/Task/Collections/Nim/collections-5.nim new file mode 100644 index 0000000000..299a68df85 --- /dev/null +++ b/Task/Collections/Nim/collections-5.nim @@ -0,0 +1,7 @@ +import tables +var l = initTable[string, int]() +l["foo"] = 12 +l["bar"] = 13 + +var m = {"foo": 12, "bar": 13}.toTable +m["baz"] = 14 diff --git a/Task/Collections/Nim/collections-6.nim b/Task/Collections/Nim/collections-6.nim new file mode 100644 index 0000000000..b35c7fbabd --- /dev/null +++ b/Task/Collections/Nim/collections-6.nim @@ -0,0 +1,6 @@ +import sets +var n = initSet[string]() +n.incl("foo") + +var o = ["foo", "bar", "baz"].toSet +o.incl("foobar") diff --git a/Task/Collections/Nim/collections-7.nim b/Task/Collections/Nim/collections-7.nim new file mode 100644 index 0000000000..b52681f88f --- /dev/null +++ b/Task/Collections/Nim/collections-7.nim @@ -0,0 +1,4 @@ +import queues +var p = initQueue[int]() +p.add(12) +p.add(13) diff --git a/Task/Collections/Oforth/collections-1.oforth b/Task/Collections/Oforth/collections-1.oforth new file mode 100644 index 0000000000..d0420f9030 --- /dev/null +++ b/Task/Collections/Oforth/collections-1.oforth @@ -0,0 +1 @@ +[ 1, 1.2, "abcd", [ 1, 2, 3 ] ] diff --git a/Task/Collections/Oforth/collections-2.oforth b/Task/Collections/Oforth/collections-2.oforth new file mode 100644 index 0000000000..a9ead919fe --- /dev/null +++ b/Task/Collections/Oforth/collections-2.oforth @@ -0,0 +1 @@ +ListBuffer new dup add(10) dup add("aaa") dup add(Date now) dup add(1.3) println diff --git a/Task/Collections/Phix/collections-1.phix b/Task/Collections/Phix/collections-1.phix new file mode 100644 index 0000000000..ce9471c389 --- /dev/null +++ b/Task/Collections/Phix/collections-1.phix @@ -0,0 +1,4 @@ +sequence collection = {} +collection = append(collection,"one") +collection = prepend(collection,2) +? collection -- {2,"one"} diff --git a/Task/Collections/Phix/collections-2.phix b/Task/Collections/Phix/collections-2.phix new file mode 100644 index 0000000000..36e1626748 --- /dev/null +++ b/Task/Collections/Phix/collections-2.phix @@ -0,0 +1,7 @@ +setd("one",0) +setd(2,0) +function visitor(object key, object /*data*/, object /*user_data*/) + ?key + return 1 +end function +traverse_dict(routine_id("visitor")) -- shows 2, "one" diff --git a/Task/Collections/Sidef/collections-1.sidef b/Task/Collections/Sidef/collections-1.sidef new file mode 100644 index 0000000000..6ec3fc9f27 --- /dev/null +++ b/Task/Collections/Sidef/collections-1.sidef @@ -0,0 +1,5 @@ +# creating an empty array and adding values +var a = [] #=> [] +a[0] = 1 #=> [1] +a[3] = "abc" #=> [1, nil, nil, "abc"] +a << 3.14 #=> [1, nil, nil, "abc", 3.14] diff --git a/Task/Collections/Sidef/collections-2.sidef b/Task/Collections/Sidef/collections-2.sidef new file mode 100644 index 0000000000..5977e1d1ff --- /dev/null +++ b/Task/Collections/Sidef/collections-2.sidef @@ -0,0 +1,5 @@ +# creating an empty hash +var h = Hash() #=> Hash() +h{:foo} = 1 #=> Hash("foo"=>1) +h{:bar} = 2.4 #=> Hash("foo"=>1, "bar"=>2.4) +h{:bar} += 3 #=> Hash("foo"=>1, "bar"=>5.4) diff --git a/Task/Collections/Sidef/collections-3.sidef b/Task/Collections/Sidef/collections-3.sidef new file mode 100644 index 0000000000..04a61bfbd6 --- /dev/null +++ b/Task/Collections/Sidef/collections-3.sidef @@ -0,0 +1,14 @@ +# create a simple pair +var p = Pair('a', 'b') +say p.first; #=> 'a' +say p.second; #=> 'b' + +# create a pair of pairs +var pair = 'foo':'bar':'baz':(); # => Pair('foo', Pair('bar', Pair('baz', nil))) + +# iterate over the values of a pair of pairs +loop { + say pair.first; #=> 'foo', 'bar', 'baz' + pair = pair.second; + pair == nil && break; +} diff --git a/Task/Collections/Sidef/collections-4.sidef b/Task/Collections/Sidef/collections-4.sidef new file mode 100644 index 0000000000..7603df485c --- /dev/null +++ b/Task/Collections/Sidef/collections-4.sidef @@ -0,0 +1,15 @@ +# creating a struct +struct Person { + String name, + Number age, + String sex +} + +var a = Person("John Smith", 41, :man) + +a.age += 1 # increment age +a.name = "Dr. #{a.name}" # update name + +say a.name #=> "Dr. John Smith" +say a.age #=> 42 +say a.sex #=> "man" diff --git a/Task/Collections/Visual-FoxPro/collections.visual b/Task/Collections/Visual-FoxPro/collections.visual new file mode 100644 index 0000000000..0104e1ae5a --- /dev/null +++ b/Task/Collections/Visual-FoxPro/collections.visual @@ -0,0 +1,22 @@ +LOCAL loColl As Collection, o, a1, a2, a3 +a1 = CREATEOBJECT("animal", "dog", 4) +a2 = CREATEOBJECT("animal", "chicken", 2) +a3 = CREATEOBJECT("animal", "snake", 0) +loColl = NEWOBJECT("Collection") +loColl.Add(a1) +loColl.Add(a2) +loColl.Add(a3) + +FOR EACH o IN loColl FOXOBJECT + ? o.Name, o.Legs +ENDFOR + +DEFINE CLASS animal As Custom +Legs = 0 + +PROCEDURE Init(tcName, tnLegs) +THIS.Name = tcName +THIS.Legs = tnLegs +ENDPROC + +ENDDEFINE diff --git a/Task/Collections/Wren/collections.wren b/Task/Collections/Wren/collections.wren new file mode 100644 index 0000000000..9a00ca730d --- /dev/null +++ b/Task/Collections/Wren/collections.wren @@ -0,0 +1,16 @@ +var list = [] // Empty Array +list = [1,2,3,4] +list.add(5) +list.clear() +list = [0] * 10 +list.count // 10 + +var map = {} +map["key"] = "value" +map[3] = 31 +map.count // 2 +map.clear() + +for (e in map.keys) { + // Do stuff +} diff --git a/Task/Collections/jq/collections-1.jq b/Task/Collections/jq/collections-1.jq new file mode 100644 index 0000000000..43227618ae --- /dev/null +++ b/Task/Collections/jq/collections-1.jq @@ -0,0 +1 @@ +{"a": 1} == {a: 1} diff --git a/Task/Collections/jq/collections-2.jq b/Task/Collections/jq/collections-2.jq new file mode 100644 index 0000000000..9da19b58b3 --- /dev/null +++ b/Task/Collections/jq/collections-2.jq @@ -0,0 +1 @@ +"a" as $key | 1 as $value | {($key): $value} diff --git a/Task/Collections/jq/collections-3.jq b/Task/Collections/jq/collections-3.jq new file mode 100644 index 0000000000..305efa8023 --- /dev/null +++ b/Task/Collections/jq/collections-3.jq @@ -0,0 +1 @@ +[0,1,2] | .[0] = 10 diff --git a/Task/Color-of-a-screen-pixel/Axe/color-of-a-screen-pixel.axe b/Task/Color-of-a-screen-pixel/Axe/color-of-a-screen-pixel.axe new file mode 100644 index 0000000000..d904d2ef8b --- /dev/null +++ b/Task/Color-of-a-screen-pixel/Axe/color-of-a-screen-pixel.axe @@ -0,0 +1 @@ +Disp pxl-Test(50,50)▶Dec,i diff --git a/Task/Color-of-a-screen-pixel/FreeBASIC/color-of-a-screen-pixel.freebasic b/Task/Color-of-a-screen-pixel/FreeBASIC/color-of-a-screen-pixel.freebasic new file mode 100644 index 0000000000..fa7b86e4d2 --- /dev/null +++ b/Task/Color-of-a-screen-pixel/FreeBASIC/color-of-a-screen-pixel.freebasic @@ -0,0 +1,13 @@ +FB 1.05.0 Win64 + +' Set an appropriate screen mode - 320 x 240 x 8bpp indexed color +ScreenRes 320, 240, 8 + +' Draw a line using color 12 (light red) +Line (20,20)-(100,100), 12 + +' Print the color of a point on the line +Print Point(20,20) '' prints 12 + +' Sleep before the program closes +Sleep diff --git a/Task/Color-of-a-screen-pixel/Lingo/color-of-a-screen-pixel.lingo b/Task/Color-of-a-screen-pixel/Lingo/color-of-a-screen-pixel.lingo new file mode 100644 index 0000000000..30fbf09bf0 --- /dev/null +++ b/Task/Color-of-a-screen-pixel/Lingo/color-of-a-screen-pixel.lingo @@ -0,0 +1,5 @@ +on getScreenPixelColor (x, y) + sx = xtra("ScrnXtra3").new() + img = sx.ScreenToImage(rect(x, y, x+1, y+1)) + return img.getPixel(0, 0) +end diff --git a/Task/Color-of-a-screen-pixel/Nim/color-of-a-screen-pixel.nim b/Task/Color-of-a-screen-pixel/Nim/color-of-a-screen-pixel.nim new file mode 100644 index 0000000000..cb86aa303c --- /dev/null +++ b/Task/Color-of-a-screen-pixel/Nim/color-of-a-screen-pixel.nim @@ -0,0 +1,10 @@ +import gtk2, gdk2, gdk2pixbuf +gtk2.nim_init() + +proc getPixelColor(x, y: int32): auto = + var p = pixbufNew(COLORSPACE_RGB, false, 8, 1, 1) + discard p.getFromDrawable(getDefaultRootWindow().Drawable, + getDefaultScreen().getSystemColormap(), x, y, 0, 0, 1, 1) + result = cast[tuple[r, g, b: uint8]](p.getPixels[]) + +echo getPixelColor(0, 0) diff --git a/Task/Color-of-a-screen-pixel/Ring/color-of-a-screen-pixel.ring b/Task/Color-of-a-screen-pixel/Ring/color-of-a-screen-pixel.ring new file mode 100644 index 0000000000..b8fac68a67 --- /dev/null +++ b/Task/Color-of-a-screen-pixel/Ring/color-of-a-screen-pixel.ring @@ -0,0 +1,35 @@ +Load "guilib.ring" +new qApp { + + win1 = new qWidget() + { + setWindowTitle("Test using Event Filter!") + setGeometry(100,100,400,400) + setmousetracking(true) + myfilter = new qallevents(win1) + myfilter.setKeyPressEvent("pWork()") + myfilter.setMouseButtonPressevent("pClick()") + myfilter.setmousemoveevent("pMove()") + + installeventfilter(myfilter) + show() + } + exec() +} + +func pWork + win1.setwindowtitle('KeyPress! : ' + myfilter.getkeycode()) + +func pClick + new qmessagebox(win1) { + setgeometry(100,100,400,100) + setwindowtitle("click event!") + settext("x : " + myfilter.getx() + + " y : " + myfilter.gety() + " button : " + + myfilter.getbutton() ) + show() + } + +func pMove + win1.setwindowtitle("Mouse Move , X : " + myfilter.getx() + + " Y : " + myfilter.gety() ) diff --git a/Task/Colour-bars-Display/FreeBASIC/colour-bars-display.freebasic b/Task/Colour-bars-Display/FreeBASIC/colour-bars-display.freebasic new file mode 100644 index 0000000000..e504d88964 --- /dev/null +++ b/Task/Colour-bars-Display/FreeBASIC/colour-bars-display.freebasic @@ -0,0 +1,21 @@ +' FB 1.05.0 Win64 + +' Draw the color bars on an 80 x 25 console using the system palette of 16 colors +' i.e. 5 columns per color +Width 80, 25 +Shell "cls" +Locate ,, 0 '' turn cursor off +For clr As UInteger = 0 To 15 + Color 0, clr + For row As Integer = 1 to 25 + For col As UInteger = 1 To 5 + Locate row, clr * 5 + 1 + Print Space(5); + Next col + Next row +Next clr + +Sleep +' restore default settings +Locate ,, 1 '' turn cursor on +Color 7, 0 '' white text on black background diff --git a/Task/Colour-bars-Display/Ring/colour-bars-display.ring b/Task/Colour-bars-Display/Ring/colour-bars-display.ring new file mode 100644 index 0000000000..88f7ad1b15 --- /dev/null +++ b/Task/Colour-bars-Display/Ring/colour-bars-display.ring @@ -0,0 +1,59 @@ +load "guilib.ring" + +new qapp + { + win1 = new qwidget() { + setwindowtitle("drawing using qpainter") + setwinicon(self,"C:\Ring\bin\image\browser.png") + setgeometry(100,100,500,600) + label1 = new qlabel(win1) { + setgeometry(10,10,400,400) + settext("") + } + new qpushbutton(win1) { + setgeometry(200,400,100,30) + settext("draw") + setclickevent("draw()") + } + show() + } + exec() + } + +func draw + p1 = new qpicture() + color = new qcolor() { + setrgb(0,0,255,255) + } + pen = new qpen() { + setcolor(color) + setwidth(1) + } + new qpainter() { + begin(p1) + setpen(pen) + + //Black, Red, Green, Blue, Magenta, Cyan, Yellow, White + + for n = 1 to 8 + color2 = new qcolor(){ + switch n + on 1 r=0 g=0 b=0 + on 2 r=255 g=0 b=0 + on 3 r=0 g=255 b=0 + on 4 r=0 g=0 b=255 + on 5 r=255 g=0 b=255 + on 6 r=0 g=255 b=255 + on 7 r=255 g=255 b=0 + on 8 r=255 g=255 b=255 + off + setrgb(r,g,b,255) + } + mybrush = new qbrush() {setstyle(1) setcolor(color2)} + setbrush(mybrush) + drawrect(n*25,25,25,70) + next + + endpaint() + } + label1 { setpicture(p1) show() } diff --git a/Task/Colour-bars-Display/Sidef/colour-bars-display.sidef b/Task/Colour-bars-Display/Sidef/colour-bars-display.sidef new file mode 100644 index 0000000000..9255cbd41a --- /dev/null +++ b/Task/Colour-bars-Display/Sidef/colour-bars-display.sidef @@ -0,0 +1,24 @@ +require('GD'); + +var colors = Hash.new( + white => [255, 255, 255], + red => [255, 0, 0], + green => [0, 255, 0], + blue => [0, 0, 255], + magenta => [255, 0, 255], + yellow => [255, 255, 0], + cyan => [0, 255, 255], + black => [0, 0, 0], + ); + +var barwidth = 160/8; +var image = %s'GD::Image'.new(160, 100); +var start = 0; + +colors.values.each { |rgb| + var paintcolor = image.colorAllocate(rgb...); + image.filledRectangle(start * barwidth, 0, start*barwidth + barwidth - 1, 99, paintcolor); + start++; +}; + +%f'colorbars.png'.open('>:raw').print(image.png); diff --git a/Task/Combinations-and-permutations/EchoLisp/combinations-and-permutations.echolisp b/Task/Combinations-and-permutations/EchoLisp/combinations-and-permutations.echolisp new file mode 100644 index 0000000000..f14383e37e --- /dev/null +++ b/Task/Combinations-and-permutations/EchoLisp/combinations-and-permutations.echolisp @@ -0,0 +1,20 @@ +;; rename native functions according to task +(define-syntax-rule (Cnk n k) (Cnp n k)) +(define-syntax-rule (Ank n k) (Anp n k)) + + +(Cnk 10 1) + → 10 +(lib 'bigint) ;; no floating point needed : use large integers + +(Cnk 100 10) + → 17310309456440 +(Cnk 1000 42) + → 297242911333923795640059429176065863139989673213703918037987737481286092000 +(Ank 10 10) + → 3628800 +(factorial 10) + → 3628800 +(Ank 666 42) + → 1029024198692120734765388598788124551227594950478035495578451793852872815678512303375588360 +1398831219998720000000000000 diff --git a/Task/Combinations-and-permutations/Nim/combinations-and-permutations.nim b/Task/Combinations-and-permutations/Nim/combinations-and-permutations.nim new file mode 100644 index 0000000000..f4f7b3697f --- /dev/null +++ b/Task/Combinations-and-permutations/Nim/combinations-and-permutations.nim @@ -0,0 +1,20 @@ +import bigints + +proc perm(n, k: int32): BigInt = + result = initBigInt 1 + var + k = n - k + n = n + while n > k: + result *= n + dec n + +proc comb(n, k: int32): BigInt = + result = perm(n, k) + var k = k + while k > 0: + result = result div k + dec k + +echo "P(1000, 969) = ", perm(1000, 969) +echo "C(1000, 969) = ", comb(1000, 969) diff --git a/Task/Combinations-and-permutations/Phix/combinations-and-permutations-1.phix b/Task/Combinations-and-permutations/Phix/combinations-and-permutations-1.phix new file mode 100644 index 0000000000..58dd718b6e --- /dev/null +++ b/Task/Combinations-and-permutations/Phix/combinations-and-permutations-1.phix @@ -0,0 +1,27 @@ +function P(integer n,k) + return factorial(n)/factorial(n-k) +end function + +function C(integer n,k) + return P(n,k)/factorial(k) +end function + +function lstirling(atom n) + if n<10 then + return lstirling(n+1)-log(n+1) + end if + return 0.5*log(2*PI*n) + n*log(n/E + 1/(12*E*n)) +end function + +function P_approx(integer n, k) + return lstirling(n)-lstirling(n-k) +end function + +function C_approx(integer n, k) + return lstirling(n)-lstirling(n-k)-lstirling(k) +end function + +function to_s(atom v) +integer e = floor(v/log(10)) + return sprintf("%.9ge%d",{power(E,v-e*log(10)),e}) +end function diff --git a/Task/Combinations-and-permutations/Phix/combinations-and-permutations-2.phix b/Task/Combinations-and-permutations/Phix/combinations-and-permutations-2.phix new file mode 100644 index 0000000000..2246eeef2b --- /dev/null +++ b/Task/Combinations-and-permutations/Phix/combinations-and-permutations-2.phix @@ -0,0 +1,22 @@ +printf(1,"=> Exact results:\n") +for n=1 to 12 do + integer p = floor(n/3) + printf(1,"P(%d,%d) = %d\n",{n,p,P(n,p)}) +end for + +for n=10 to 60 by 10 do + integer p = floor(n/3) + printf(1,"C(%d,%d) = %d\n",{n,p,C(n,p)}) +end for + +printf(1,"=> Floating point approximations:\n") +constant tests = {5, 50, 500, 1000, 5000, 15000} +for i=1 to length(tests) do + integer n=tests[i], p = floor(n/3) + printf(1,"P(%d,%d) = %s\n",{n,p,to_s(P_approx(n,p))}) +end for + +for n=100 to 1000 by 100 do + integer p = floor(n/3) + printf(1,"C(%d,%d) = %s\n",{n,p,to_s(C_approx(n,p))}) +end for diff --git a/Task/Combinations-and-permutations/Sidef/combinations-and-permutations.sidef b/Task/Combinations-and-permutations/Sidef/combinations-and-permutations.sidef new file mode 100644 index 0000000000..238eb4ac85 --- /dev/null +++ b/Task/Combinations-and-permutations/Sidef/combinations-and-permutations.sidef @@ -0,0 +1,46 @@ +func P(n, k) { n! / ((n-k)!) }; +func C(n, k) { binomial(n, k) }; + +class Logarithm(value) { + method get_value { value }; + method to_s { + var e = int(value/10.log); + "%.8fE%+d" % (exp(value - e*10.log), e); + } +} + +func lstirling(n) { + n < 10 ? (lstirling(n+1) - log(n+1)) + : (0.5*log(2*Number.pi*n) + n*log(n/Number.e + 1/(12*Number.e*n))); +} + +func P_approx(n, k) { + Logarithm((lstirling(n) - lstirling(n -k))) +} + +func C_approx(n, k) { + Logarithm((lstirling(n) - lstirling(n -k) - lstirling(k))) +} + +say "=> Exact results:"; +range(1, 12).each { |n| + var p = int(n / 3); + say "P(#{n}, #{p}) = #{P(n, p)}"; +} + +range(10, 60, 10).each { |n| + var p = int(n / 3); + say "C(#{n}, #{p}) = #{C(n, p)}"; +} + +say ''; +say "=> Floating point approximations:"; +[5, 50, 500, 1000, 5000, 15000].each { |n| + var p = int(n / 3); + say "P(#{n}, #{p}) = #{P_approx(n, p)}"; +} + +range(100, 1000, 100).each { |n| + var p = int(n / 3); + say "C(#{n}, #{p}) = #{C_approx(n, p)}"; +} diff --git a/Task/Combinations-and-permutations/jq/combinations-and-permutations.jq b/Task/Combinations-and-permutations/jq/combinations-and-permutations.jq new file mode 100644 index 0000000000..df41942f1a --- /dev/null +++ b/Task/Combinations-and-permutations/jq/combinations-and-permutations.jq @@ -0,0 +1,20 @@ +def permutation(k): . as $n + | reduce range($n-k+1; 1+$n) as $i (1; . * $i); + +def combination(k): . as $n + | if k > ($n/2) then combination($n-k) + else reduce range(0; k) as $i (1; (. * ($n - $i)) / ($i + 1)) + end; + +# natural log of n! +def log_factorial: (1+.) | tgamma | log; + +def log_permutation(k): + (log_factorial - ((.-k) | log_factorial)); + +def log_combination(k): + (log_factorial - ((. - k)|log_factorial) - (k|log_factorial)); + +def big_permutation(k): log_permutation(k) | exp; + +def big_combination(k): log_combination(k) | exp; diff --git a/Task/Combinations-with-repetitions/EchoLisp/combinations-with-repetitions.echolisp b/Task/Combinations-with-repetitions/EchoLisp/combinations-with-repetitions.echolisp new file mode 100644 index 0000000000..f394c4ab88 --- /dev/null +++ b/Task/Combinations-with-repetitions/EchoLisp/combinations-with-repetitions.echolisp @@ -0,0 +1,41 @@ +;; +;; native function : combinations/rep in list.lib +;; +(lib 'list) + +(combinations/rep '(iced jam plain) 2) + → ((iced iced) (iced jam) (iced plain) (jam jam) (jam plain) (plain plain)) + +;; +;; using a combinator iterator +;; +(lib 'sequences) + +(take (combinator/rep '(iced jam plain) 2) 8) + → ((iced iced) (iced jam) (iced plain) (jam jam) (jam plain) (plain plain)) + +;; +;; or, implementing the function +;; + +(define (comb/rep nums k) + (cond + [(null? nums) null] + [(<= k 0) null] + [(= k 1) (map list nums)] + [else + (for/fold (acc null) ((anum nums)) + (append acc + (for/list ((xs (comb/rep nums (1- k)))) + #:continue (< (first xs) anum) + (cons anum xs))))])) + +(map (curry list-permute '(iced jam plain)) (comb/rep (iota 3) 2)) + → ((iced iced) (iced jam) (iced plain) (jam jam) (jam plain) (plain plain)) + +;; +;; extra credit +;; + +(length (combinator/rep (iota 10) 3)) + → 220 diff --git a/Task/Combinations-with-repetitions/Egison/combinations-with-repetitions.egison b/Task/Combinations-with-repetitions/Egison/combinations-with-repetitions.egison new file mode 100644 index 0000000000..07143aea2e --- /dev/null +++ b/Task/Combinations-with-repetitions/Egison/combinations-with-repetitions.egison @@ -0,0 +1,6 @@ +(define $comb/rep + (lambda [$n $xs] + (match-all xs (list something) + [(loop $i [1 ,n] ...)> _) a]))) + +(test (comb/rep 2 {"iced" "jam" "plain"})) diff --git a/Task/Combinations-with-repetitions/LFE/combinations-with-repetitions-1.lfe b/Task/Combinations-with-repetitions/LFE/combinations-with-repetitions-1.lfe new file mode 100644 index 0000000000..908927106f --- /dev/null +++ b/Task/Combinations-with-repetitions/LFE/combinations-with-repetitions-1.lfe @@ -0,0 +1,9 @@ +(defun combinations + (('() _) + '()) + ((coll 1) + (lists:map #'list/1 coll)) + (((= (cons head tail) coll) n) + (++ (lc ((<- subcoll (combinations coll (- n 1)))) + (cons head subcoll)) + (combinations tail n)))) diff --git a/Task/Combinations-with-repetitions/LFE/combinations-with-repetitions-2.lfe b/Task/Combinations-with-repetitions/LFE/combinations-with-repetitions-2.lfe new file mode 100644 index 0000000000..e27f8507f1 --- /dev/null +++ b/Task/Combinations-with-repetitions/LFE/combinations-with-repetitions-2.lfe @@ -0,0 +1,9 @@ +(defun combinations + (('() _) + '()) + ((coll 1) + (lists:map #'list/1 coll)) + (((= (cons head tail) coll) n) + (++ (lists:map (lambda (subcoll) (cons head subcoll)) + (combinations coll (- n 1))) + (combinations tail n)))) diff --git a/Task/Combinations-with-repetitions/LFE/combinations-with-repetitions-3.lfe b/Task/Combinations-with-repetitions/LFE/combinations-with-repetitions-3.lfe new file mode 100644 index 0000000000..f8d9aec671 --- /dev/null +++ b/Task/Combinations-with-repetitions/LFE/combinations-with-repetitions-3.lfe @@ -0,0 +1,2 @@ +> (combinations '(iced jam plain) 2) +((iced iced) (iced jam) (iced plain) (jam jam) (jam plain) (plain plain)) diff --git a/Task/Combinations-with-repetitions/Nim/combinations-with-repetitions.nim b/Task/Combinations-with-repetitions/Nim/combinations-with-repetitions.nim new file mode 100644 index 0000000000..a2e205c02b --- /dev/null +++ b/Task/Combinations-with-repetitions/Nim/combinations-with-repetitions.nim @@ -0,0 +1,13 @@ +import future, sequtils + +proc combsReps[T](lst: seq[T], k: int): seq[seq[T]] = + if k == 0: + @[newSeq[T]()] + elif lst.len == 0: + @[] + else: + lst.combsReps(k - 1).map((x: seq[T]) => lst[0] & x) & + lst[1 .. -1].combsReps(k) + +echo(@["iced", "jam", "plain"].combsReps(2)) +echo toSeq(1..10).combsReps(3).len diff --git a/Task/Combinations-with-repetitions/Phix/combinations-with-repetitions-1.phix b/Task/Combinations-with-repetitions/Phix/combinations-with-repetitions-1.phix new file mode 100644 index 0000000000..e3bb9657e2 --- /dev/null +++ b/Task/Combinations-with-repetitions/Phix/combinations-with-repetitions-1.phix @@ -0,0 +1,11 @@ +procedure choose(sequence from, integer n, at=1, sequence res={}) + if length(res)=n then + ?res + else + for i=at to length(from) do + choose(from,n,i,append(res,from[i])) + end for + end if +end procedure + +choose({"iced","jam","plain"},2) diff --git a/Task/Combinations-with-repetitions/Phix/combinations-with-repetitions-2.phix b/Task/Combinations-with-repetitions/Phix/combinations-with-repetitions-2.phix new file mode 100644 index 0000000000..7dd4ffe9eb --- /dev/null +++ b/Task/Combinations-with-repetitions/Phix/combinations-with-repetitions-2.phix @@ -0,0 +1,11 @@ +function choices(integer from, n, at=1, taken=0) +integer count = 0 + if taken=n then return 1 end if + taken += 1 + for i=at to from do + count += choices(from,n,i,taken) + end for + return count +end function + +?choices(10,3) diff --git a/Task/Combinations-with-repetitions/Sidef/combinations-with-repetitions.sidef b/Task/Combinations-with-repetitions/Sidef/combinations-with-repetitions.sidef new file mode 100644 index 0000000000..83644880c2 --- /dev/null +++ b/Task/Combinations-with-repetitions/Sidef/combinations-with-repetitions.sidef @@ -0,0 +1,9 @@ +func p (n, a, l) { n>0 ? (l.range.map{p(n-1, a+[l[_]], l.ft(_))}) : a }; +func f (n) { n>0 ? (n * f(n - 1)) : 1 }; +func n (n, m) { f(n + m - 1) / f(n) / f(m - 1) }; + +p(2, [], %w(iced jam plain)).each { |a| + say a.map{|pair| pair.join(" ")}.join("\n"); +} + +printf("\nThere are %d ways to pick 7 out of 10\n", n(7, 10)); diff --git a/Task/Combinations-with-repetitions/Swift/combinations-with-repetitions.swift b/Task/Combinations-with-repetitions/Swift/combinations-with-repetitions.swift new file mode 100644 index 0000000000..74bbb261d8 --- /dev/null +++ b/Task/Combinations-with-repetitions/Swift/combinations-with-repetitions.swift @@ -0,0 +1,11 @@ +func combosWithRep(var objects: [T], n: Int) -> [[T]] { + if n == 0 { return [[]] } else { + var combos = [[T]]() + while let element = objects.last { + combos.appendContentsOf(combosWithRep(objects, n: n - 1).map{ $0 + [element] }) + objects.removeLast() + } + return combos + } +} +print(combosWithRep(["iced", "jam", "plain"], n: 2).map {$0.joinWithSeparator(" and ")}.joinWithSeparator("\n")) diff --git a/Task/Combinations-with-repetitions/jq/combinations-with-repetitions-1.jq b/Task/Combinations-with-repetitions/jq/combinations-with-repetitions-1.jq new file mode 100644 index 0000000000..3972206ac5 --- /dev/null +++ b/Task/Combinations-with-repetitions/jq/combinations-with-repetitions-1.jq @@ -0,0 +1,8 @@ +def pick(n): + def pick(n; m): # pick n, from m onwards + if n == 0 then [] + elif m == length then empty + elif n == 1 then (.[m:][] | [.]) + else ([.[m]] + pick(n-1; m)), pick(n; m+1) + end; + pick(n;0) ; diff --git a/Task/Combinations-with-repetitions/jq/combinations-with-repetitions-2.jq b/Task/Combinations-with-repetitions/jq/combinations-with-repetitions-2.jq new file mode 100644 index 0000000000..6c2692b448 --- /dev/null +++ b/Task/Combinations-with-repetitions/jq/combinations-with-repetitions-2.jq @@ -0,0 +1,4 @@ + "Pick 2:", + (["iced", "jam", "plain"] | pick(2)), + ([[range(0;10)] | pick(3)] | length) as $n + | "There are \($n) ways to pick 3 objects with replacement from 10." diff --git a/Task/Combinations/ERRE/combinations.erre b/Task/Combinations/ERRE/combinations.erre new file mode 100644 index 0000000000..9e5cb5b285 --- /dev/null +++ b/Task/Combinations/ERRE/combinations.erre @@ -0,0 +1,36 @@ +PROGRAM COMBINATIONS + +CONST M_MAX=3,N_MAX=5 + +DIM COMBINATION[M_MAX],STACK[100,1] + +PROCEDURE GENERATE(M) + LOCAL I + IF (M>M_MAX) THEN + FOR I=1 TO M_MAX DO + PRINT(COMBINATION[I];" ";) + END FOR + PRINT + ELSE + FOR N=1 TO N_MAX DO + IF ((M=1) OR (N>COMBINATION[M-1])) THEN + COMBINATION[M]=N + ! --- PUSH STACK ----------- + STACK[SP,0]=M STACK[SP,1]=N + SP=SP+1 + ! -------------------------- + + GENERATE(M+1) + + ! --- POP STACK ------------ + SP=SP-1 + M=STACK[SP,0] N=STACK[SP,1] + ! -------------------------- + END IF + END FOR + END IF +END PROCEDURE + +BEGIN + GENERATE(1) +END PROGRAM diff --git a/Task/Combinations/EchoLisp/combinations.echolisp b/Task/Combinations/EchoLisp/combinations.echolisp new file mode 100644 index 0000000000..1bf2def0a0 --- /dev/null +++ b/Task/Combinations/EchoLisp/combinations.echolisp @@ -0,0 +1,25 @@ +;; +;; using the native (combinations) function +(lib 'list) +(combinations (iota 5) 3) +→ ((0 1 2) (0 1 3) (0 1 4) (0 2 3) (0 2 4) (0 3 4) (1 2 3) (1 2 4) (1 3 4) (2 3 4)) +;; +;; using an iterator +;; +(lib 'sequences) +(take (combinator (iota 5) 3) #:all) +→ ((0 1 2) (0 1 3) (0 1 4) (0 2 3) (0 2 4) (0 3 4) (1 2 3) (1 2 4) (1 3 4) (2 3 4)) +;; +;; defining a function +;; +(define (combine lst p) (cond + [(null? lst) null] + [(< (length lst) p) null] + [(= (length lst) p) (list lst)] + [(= p 1) (map list lst)] + [else (append + (map cons (circular-list (first lst)) (combine (rest lst) (1- p))) + (combine (rest lst) p))])) + +(combine (iota 5) 3) + → ((0 1 2) (0 1 3) (0 1 4) (0 2 3) (0 2 4) (0 3 4) (1 2 3) (1 2 4) (1 3 4) (2 3 4)) diff --git a/Task/Combinations/Egison/combinations.egison b/Task/Combinations/Egison/combinations.egison new file mode 100644 index 0000000000..0ba596b7ce --- /dev/null +++ b/Task/Combinations/Egison/combinations.egison @@ -0,0 +1,6 @@ +(define $comb + (lambda [$n $xs] + (match-all xs (list integer) + [(loop $i [1 ,n] > _) a]))) + +(test (comb 3 (between 0 4))) diff --git a/Task/Combinations/Nim/combinations.nim b/Task/Combinations/Nim/combinations.nim new file mode 100644 index 0000000000..ce9a38a9a4 --- /dev/null +++ b/Task/Combinations/Nim/combinations.nim @@ -0,0 +1,21 @@ +iterator comb(m, n): seq[int] = + var c = newSeq[int](n) + for i in 0 .. = m - n + i: + dec i + if i < 0: break outer + inc c[i] + while i < n-1: + c[i+1] = c[i] + 1 + inc i + +for i in comb(5, 3): echo i diff --git a/Task/Combinations/Perl5i/combinations.perl5i b/Task/Combinations/Perl5i/combinations.perl5i new file mode 100644 index 0000000000..f9f6d1cfef --- /dev/null +++ b/Task/Combinations/Perl5i/combinations.perl5i @@ -0,0 +1,22 @@ +use perl5i::2; + +# ---------------------------------------- +# generate combinations of length $n consisting of characters +# from the sorted set @set, using each character once in a +# combination, with sorted strings in sorted order. +# +# Returns a list of array references, each containing one combination. +# +func combine($n, @set) { + return unless @set; + return map { [ $_ ] } @set if $n == 1; + + my ($head) = shift @set; + my @result = combine( $n-1, @set ); + for my $subarray ( @result ) { + $subarray->unshift( $head ); + } + return ( @result, combine( $n, @set ) ); +} + +say @$_ for combine( 3, ('a'..'e') ); diff --git a/Task/Combinations/Phix/combinations.phix b/Task/Combinations/Phix/combinations.phix new file mode 100644 index 0000000000..23ba9de44a --- /dev/null +++ b/Task/Combinations/Phix/combinations.phix @@ -0,0 +1,13 @@ +procedure comb(integer pool, needed, done=0, sequence chosen={}) + if needed=0 then -- got a full set + ?chosen -- (or use a routine_id, result arg, or whatever) + return + end if + if done+needed>pool then return end if -- cannot fulfil + -- get all combinations with and without the next item: + done += 1 + comb(pool,needed-1,done,append(chosen,done)) + comb(pool,needed,done,chosen) +end procedure + +comb(5,3) diff --git a/Task/Combinations/Pyret/combinations.pyret b/Task/Combinations/Pyret/combinations.pyret new file mode 100644 index 0000000000..c0542e8364 --- /dev/null +++ b/Task/Combinations/Pyret/combinations.pyret @@ -0,0 +1,101 @@ +fun combos(lst :: List, size :: Number) -> List>: + # return all subsets of lst of a certain size, + # maintaining the original ordering of the list + + # Let's handle a bunch of degenerate cases up front + # to be defensive... + if lst.length() < size: + # return an empty list if size is too big + [list:] + else if lst.length() == size: + # combos([list: 1,2,3,4]) == list[list: 1,2,3,4]] + [list: lst] + else if size == 1: + # combos(list: 5, 9]) == list[[list: 5], [list: 9]] + lst.map(lam(elem): [list: elem] end) + else: + # The main resursive step here is to consider + # all the combinations of the list that have the + # first element (aka head) and then those that don't + # don't. + cases(List) lst: + | empty => [list:] + | link(head, rest) => + # All the subsets of our list either include the + # first element of the list (aka head) or they don't. + with-head-combos = combos(rest, size - 1).map( + lam(combo): + link(head, combo) end + ) + without-head-combos = combos(rest, size) + with-head-combos._plus(without-head-combos) + end + end +where: + # define semantics for the degenerate cases, although + # maybe we should just make some of these raise errors + combos([list:], 0) is [list: [list:]] + combos([list:], 1) is [list:] + combos([list: "foo"], 1) is [list: [list: "foo"]] + combos([list: "foo"], 2) is [list:] + + # test the normal stuff + lst = [list: 1, 2, 3] + combos(lst, 1) is [list: + [list: 1], + [list: 2], + [list: 3] + ] + combos(lst, 2) is [list: + [list: 1, 2], + [list: 1, 3], + [list: 2, 3] + ] + combos(lst, 3) is [list: + [list: 1, 2, 3] + ] + + # remember the 10th row of Pascal's Triangle? :) + lst10 = [list: 1,2,3,4,5,6,7,8,9,10] + combos(lst10, 3).length() is 120 + combos(lst10, 4).length() is 210 + combos(lst10, 5).length() is 252 + combos(lst10, 6).length() is 210 + combos(lst10, 7).length() is 120 + + # more sanity checks... + for each(sublst from combos(lst10, 6)): + sublst.length() is 6 + end + + for each(sublst from combos(lst10, 9)): + sublst.length() is 9 + end +end + +fun int-combos(n :: Number, m :: Number) -> List>: + doc: "return all lists of size m containing distinct, ordered nonnegative ints < n" + lst = range(0, n) + combos(lst, m) +where: + int-combos(5, 5) is [list: [list: 0,1,2,3,4]] + int-combos(3, 2) is [list: + [list: 0, 1], + [list: 0, 2], + [list: 1, 2] + ] +end + +fun display-3-comb-5-for-rosetta-code(): + # The very concrete nature of this function is driven + # by the web page from Rosetta Code. We want to display + # output similar to the top of this page: + # + # https://rosettacode.org/wiki/Combinations + results = int-combos(5, 3) + for each(lst from results): + print(lst.join-str(" ")) + end +end + +display-3-comb-5-for-rosetta-code() diff --git a/Task/Combinations/SPAD/combinations.spad b/Task/Combinations/SPAD/combinations.spad new file mode 100644 index 0000000000..b8eab04387 --- /dev/null +++ b/Task/Combinations/SPAD/combinations.spad @@ -0,0 +1,5 @@ +[reverse subSet(5,3,i)$SGCF for i in 0..binomial(5,3)-1] + + [[0,1,2], [0,1,3], [0,2,3], [1,2,3], [0,1,4], [0,2,4], [1,2,4], [0,3,4], + [1,3,4], [2,3,4]] + Type: List(List(Integer)) diff --git a/Task/Combinations/Sidef/combinations-1.sidef b/Task/Combinations/Sidef/combinations-1.sidef new file mode 100644 index 0000000000..3b989fa581 --- /dev/null +++ b/Task/Combinations/Sidef/combinations-1.sidef @@ -0,0 +1 @@ +(@^5).combinations(3, {|c| say c }) diff --git a/Task/Combinations/Sidef/combinations-2.sidef b/Task/Combinations/Sidef/combinations-2.sidef new file mode 100644 index 0000000000..6c1ff3d3cc --- /dev/null +++ b/Task/Combinations/Sidef/combinations-2.sidef @@ -0,0 +1,17 @@ +func combine(n, set) { + + set.len || return [] + n == 1 && return set.map{[_]} + + var (head, result) + head = set.shift + result = combine(n-1, [set...]) + + for subarray in result { + subarray.prepend(head) + } + + result + combine(n, set) +} + +combine(3, @^5).each {|c| say c } diff --git a/Task/Combinations/Sidef/combinations-3.sidef b/Task/Combinations/Sidef/combinations-3.sidef new file mode 100644 index 0000000000..22755aa6ff --- /dev/null +++ b/Task/Combinations/Sidef/combinations-3.sidef @@ -0,0 +1,31 @@ +func forcomb(callback, n, k) { + + if (k == 0) { + callback([]) + return() + } + + if (k<0 || k>n || n==0) { + return() + } + + var c = @^k + + loop { + callback([c...]) + c[k-1]++ < n-1 && next + var i = k-2 + while (i>=0 && c[i]>=(n-(k-i))) { + --i + } + i < 0 && break + c[i]++ + while (++i < k) { + c[i] = c[i-1]+1 + } + } + + return() +} + +forcomb({|c| say c }, 5, 3) diff --git a/Task/Combinations/Swift/combinations.swift b/Task/Combinations/Swift/combinations.swift new file mode 100644 index 0000000000..5455e535be --- /dev/null +++ b/Task/Combinations/Swift/combinations.swift @@ -0,0 +1,20 @@ +func addCombo(prevCombo: [Int], var pivotList: [Int]) -> [([Int], [Int])] { + + return (0.. ([Int], [Int]) in + (prevCombo + [pivotList.removeAtIndex(0)], pivotList) + } +} +func combosOfLength(n: Int, m: Int) -> [[Int]] { + + return [Int](1...m) + .reduce([([Int](), [Int](0.. length or r < 0 then empty + elif r == length then . + else ( [.[0]] + (.[1:]|combination(r-1))), + ( .[1:]|combination(r)) + end; + +# select r integers from the set (0 .. n-1) +def combinations(n;r): [range(0;n)] | combination(r); diff --git a/Task/Comma-quibbling/EchoLisp/comma-quibbling.echolisp b/Task/Comma-quibbling/EchoLisp/comma-quibbling.echolisp new file mode 100644 index 0000000000..0510339a51 --- /dev/null +++ b/Task/Comma-quibbling/EchoLisp/comma-quibbling.echolisp @@ -0,0 +1,20 @@ +(lib 'match) + +(define (quibble words) + (match words + [ null "{}"] + [ (a) (format "{ %a }" a)] + [ (a b) (format "{ %a and %a }" a b)] + [( a ... b c) (format "{ %a %a and %a }" (for/string ([w a]) (string-append w ", ")) b c)] + [else 'bad-input])) + + +;; output + + (for ([t '(() ("ABC") ("ABC" "DEF") ("ABC" "DEF" "G" "H"))]) + (writeln t '----> (quibble t))) + +null ----> "{}" +("ABC") ----> "{ ABC }" +("ABC" "DEF") ----> "{ ABC and DEF }" +("ABC" "DEF" "G" "H") ----> "{ ABC, DEF, G and H }" diff --git a/Task/Comma-quibbling/FreeBASIC/comma-quibbling.freebasic b/Task/Comma-quibbling/FreeBASIC/comma-quibbling.freebasic new file mode 100644 index 0000000000..efe1520741 --- /dev/null +++ b/Task/Comma-quibbling/FreeBASIC/comma-quibbling.freebasic @@ -0,0 +1,58 @@ +' FB 1.05.0 Win64 + +Sub Split(s As String, sep As String, result() As String) + Dim As Integer i, j, count = 0 + Dim temp As String + Dim As Integer position(Len(s) + 1) + position(0) = 0 + For i = 0 To Len(s) - 1 + For j = 0 To Len(sep) - 1 + If s[i] = sep[j] Then + count += 1 + position(count) = i + 1 + End If + Next j + Next i + position(count + 1) = Len(s) + 1 + Redim result(count) + For i = 1 To count + 1 + result(i - 1) = Mid(s, position(i - 1) + 1, position(i) - position(i - 1) - 1) + Next +End Sub + +Function CommaQuibble(s As String) As String + Dim i As Integer + Dim As String result + Dim As String words() + s = Trim(s, Any "[]""") + ' Now remove internal quotes + Split s, """", words() + s = "" + For i = 0 To UBound(words) + s &= words(i) + Next + ' Now split 's' using the comma as separator + Erase words + Split s, ",", words() + ' And re-assemble the string in the desired format + result = "{" + For i = 0 To UBound(words) + If i = 0 Then + result &= words(i) + ElseIf i = UBound(words) Then + result &= " and " & words(i) + Else + result &= ", " + words(i) + EndIf + Next + Return result & "}" +End Function + +' As 3 of the strings contain embedded quotes these need to be doubled in FB +Print CommaQuibble("[]") +Print CommaQuibble("[""ABC""]") +Print CommaQuibble("[""ABC"",""DEF""]") +Print CommaQuibble("[""ABC"",""DEF"",""G"",""H""]") +Print +Print "Press any key to quit the program" +Sleep diff --git a/Task/Comma-quibbling/Lasso/comma-quibbling.lasso b/Task/Comma-quibbling/Lasso/comma-quibbling.lasso new file mode 100644 index 0000000000..9d1753ede4 --- /dev/null +++ b/Task/Comma-quibbling/Lasso/comma-quibbling.lasso @@ -0,0 +1,23 @@ +#!/usr/bin/lasso9 + +local(collection = + array( + array, + array("ABC"), + array("ABC", "DEF"), + array("ABC", "DEF", "G", "H") + ) +) + +with words in #collection do { + if(#words -> size > 1) => { + local(last = #words -> last) + #words -> removelast + stdoutnl('{' + #words -> join(', ') + ' and ' + #last'}') + else(#words -> size == 1) + stdoutnl('{' + #words -> first + '}') + else + stdoutnl('{}') + } + +} diff --git a/Task/Comma-quibbling/Nim/comma-quibbling.nim b/Task/Comma-quibbling/Nim/comma-quibbling.nim new file mode 100644 index 0000000000..9980bf833f --- /dev/null +++ b/Task/Comma-quibbling/Nim/comma-quibbling.nim @@ -0,0 +1,10 @@ +proc commaQuibble(s): string = + result = "" + for i, c in s: + if i > 0: result.add (if i < s.high: ", " else: " and ") + result.add c + result = "{" & result & "}" + +var s = @[@[], @["ABC"], @["ABC", "DEF"], @["ABC", "DEF", "G", "H"]] +for i in s: + echo commaQuibble(i) diff --git a/Task/Comma-quibbling/Oforth/comma-quibbling.oforth b/Task/Comma-quibbling/Oforth/comma-quibbling.oforth new file mode 100644 index 0000000000..1e154b9629 --- /dev/null +++ b/Task/Comma-quibbling/Oforth/comma-quibbling.oforth @@ -0,0 +1,9 @@ +: quibbing(l) -- string +| i s | + StringBuffer new "{" << + l size dup 1- ->s loop: i [ + l at(i) << + i s < ifTrue: [ ", " << continue ] + i s == ifTrue: [ " and " << ] + ] + "}" << dup freeze ; diff --git a/Task/Comma-quibbling/Sidef/comma-quibbling.sidef b/Task/Comma-quibbling/Sidef/comma-quibbling.sidef new file mode 100644 index 0000000000..a683c3d8f2 --- /dev/null +++ b/Task/Comma-quibbling/Sidef/comma-quibbling.sidef @@ -0,0 +1,7 @@ +func comma_quibbling(words) { + '{' + ([words.ft(0, -2).join(', ')]-[''] + [words.last] -> join(' and ')) + '}'; +} + +[<>, , , ].each { |w| + say comma_quibbling(w); +} diff --git a/Task/Comma-quibbling/Swift/comma-quibbling.swift b/Task/Comma-quibbling/Swift/comma-quibbling.swift new file mode 100644 index 0000000000..ea16e5b645 --- /dev/null +++ b/Task/Comma-quibbling/Swift/comma-quibbling.swift @@ -0,0 +1,23 @@ +let inputs = [[], ["ABC"], ["ABC", "DEF"], ["ABC", "DEF", "G", "H"]] + +func quibbling(var words:[String]) { + if words.count == 0 { + println("{}") + } else if words.count == 1 { + println("{\(words[0])}") + } else if words.count == 2 { + println("{\(words[0]) and \(words[1])}") + } else { + var output = "{" + while words.count != 2 { + output += words.removeAtIndex(0) + ", " + } + output += "\(words.removeAtIndex(0)) and \(words.removeAtIndex(0))}" + + println(output) + } +} + +for word in inputs { + quibbling(word) +} diff --git a/Task/Comma-quibbling/XLISP/comma-quibbling.xlisp b/Task/Comma-quibbling/XLISP/comma-quibbling.xlisp new file mode 100644 index 0000000000..3d0091314b --- /dev/null +++ b/Task/Comma-quibbling/XLISP/comma-quibbling.xlisp @@ -0,0 +1,29 @@ +(defun quibble (inputs &optional oxford-comma) + (define final + (if (and (caddr inputs) oxford-comma) + ", and " + " and " ) ) + (defun comma-quibble (words) + (cond + ((null words) "") + ((null (cdr words)) (car words)) + (t (begin + (string-append (car words) + (if (caddr words) + (string-append ", " (comma-quibble (cdr words))) + (string-append final (cadr words))) ) ) ) ) ) + (string-append "{" (comma-quibble inputs) "}") ) + +; test cases: +(print (quibble '())) ; empty list +(print (quibble '("ABC"))) +(print (quibble '("ABC" "DEF"))) +(print (quibble '("ABC" "DEF" "G" "H"))) + +(newline) + +; test cases using the Oxford comma: +(print (quibble '() t)) +(print (quibble '("ABC") t)) +(print (quibble '("ABC" "DEF") t)) +(print (quibble '("ABC" "DEF" "G" "H") t)) diff --git a/Task/Comma-quibbling/jq/comma-quibbling-1.jq b/Task/Comma-quibbling/jq/comma-quibbling-1.jq new file mode 100644 index 0000000000..f0d33964e3 --- /dev/null +++ b/Task/Comma-quibbling/jq/comma-quibbling-1.jq @@ -0,0 +1,6 @@ +def quibble: + if length == 0 then "" + elif length == 1 then .[0] + else (.[0:length-1] | join(", ")) + " and " + .[length-1] + end + | "{" + . + "}"; diff --git a/Task/Comma-quibbling/jq/comma-quibbling-2.jq b/Task/Comma-quibbling/jq/comma-quibbling-2.jq new file mode 100644 index 0000000000..cd39df4750 --- /dev/null +++ b/Task/Comma-quibbling/jq/comma-quibbling-2.jq @@ -0,0 +1 @@ +( [], ["ABC"], ["ABC", "DEF"], ["ABC", "DEF", "G", "H"]) | quibble diff --git a/Task/Comma-quibbling/jq/comma-quibbling-3.jq b/Task/Comma-quibbling/jq/comma-quibbling-3.jq new file mode 100644 index 0000000000..2874975554 --- /dev/null +++ b/Task/Comma-quibbling/jq/comma-quibbling-3.jq @@ -0,0 +1,5 @@ +jq -n -r -f Comma_quibbling.jq +{} +{ABC} +{ABC and DEF} +{ABC, DEF, G and H} diff --git a/Task/Command-line-arguments/FreeBASIC/command-line-arguments.freebasic b/Task/Command-line-arguments/FreeBASIC/command-line-arguments.freebasic new file mode 100644 index 0000000000..07fe335ccf --- /dev/null +++ b/Task/Command-line-arguments/FreeBASIC/command-line-arguments.freebasic @@ -0,0 +1,9 @@ +' FB 1.05.0 Win64 + +' Program (myprogram.exe) invoke as follows: +' myprogram -c "alpha beta" -h "gamma" + +Print "The program was invoked like this => "; Command(0) + " " + Command(-1) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Command-line-arguments/FunL/command-line-arguments.funl b/Task/Command-line-arguments/FunL/command-line-arguments.funl new file mode 100644 index 0000000000..1e15ffdbd4 --- /dev/null +++ b/Task/Command-line-arguments/FunL/command-line-arguments.funl @@ -0,0 +1 @@ +println( args ) diff --git a/Task/Command-line-arguments/Harbour/command-line-arguments.harbour b/Task/Command-line-arguments/Harbour/command-line-arguments.harbour new file mode 100644 index 0000000000..643163fe47 --- /dev/null +++ b/Task/Command-line-arguments/Harbour/command-line-arguments.harbour @@ -0,0 +1,9 @@ +PROCEDURE Main() + + LOCAL i + + FOR i := 1 TO PCount() + ? "argument", hb_ntos( i ), "=", hb_PValue( i ) + NEXT + + RETURN diff --git a/Task/Command-line-arguments/LFE/command-line-arguments-1.lfe b/Task/Command-line-arguments/LFE/command-line-arguments-1.lfe new file mode 100644 index 0000000000..39c7a2be0a --- /dev/null +++ b/Task/Command-line-arguments/LFE/command-line-arguments-1.lfe @@ -0,0 +1 @@ +$ ./bin/lfe -pa ebin/ -c "alpha beta" -h "gamma" diff --git a/Task/Command-line-arguments/LFE/command-line-arguments-2.lfe b/Task/Command-line-arguments/LFE/command-line-arguments-2.lfe new file mode 100644 index 0000000000..3243c4a0cc --- /dev/null +++ b/Task/Command-line-arguments/LFE/command-line-arguments-2.lfe @@ -0,0 +1,8 @@ +> (: init get_arguments) +(#(root ("/opt/erlang/r15b03")) + #(progname ("erl")) + #(home ("/Users/oubiwann")) + #(user ("lfe_boot")) + #(pa ("ebin/")) + #(c ("alpha beta")) + #(h ("gamma"))) diff --git a/Task/Command-line-arguments/LFE/command-line-arguments-3.lfe b/Task/Command-line-arguments/LFE/command-line-arguments-3.lfe new file mode 100644 index 0000000000..bb403f6bdc --- /dev/null +++ b/Task/Command-line-arguments/LFE/command-line-arguments-3.lfe @@ -0,0 +1,4 @@ +> (: init get_argument 'c) +#(ok (("alpha beta"))) +> (: init get_argument 'h) +#(ok (("gamma"))) diff --git a/Task/Command-line-arguments/Lasso/command-line-arguments-1.lasso b/Task/Command-line-arguments/Lasso/command-line-arguments-1.lasso new file mode 100644 index 0000000000..fd289cffe7 --- /dev/null +++ b/Task/Command-line-arguments/Lasso/command-line-arguments-1.lasso @@ -0,0 +1,5 @@ +#!/usr/bin/lasso9 + +iterate($argv) => { + stdoutnl("Argument " + loop_count + ": " + loop_value) +} diff --git a/Task/Command-line-arguments/Lasso/command-line-arguments-2.lasso b/Task/Command-line-arguments/Lasso/command-line-arguments-2.lasso new file mode 100644 index 0000000000..90eac91e8b --- /dev/null +++ b/Task/Command-line-arguments/Lasso/command-line-arguments-2.lasso @@ -0,0 +1,6 @@ +$ lasso9 arguments.lasso -c "alpha beta" -h "gamma" +Argument 1: arguments.lasso +Argument 2: -c +Argument 3: alpha beta +Argument 4: -h +Argument 5: gamma diff --git a/Task/Command-line-arguments/Lingo/command-line-arguments-1.lingo b/Task/Command-line-arguments/Lingo/command-line-arguments-1.lingo new file mode 100644 index 0000000000..3204629100 --- /dev/null +++ b/Task/Command-line-arguments/Lingo/command-line-arguments-1.lingo @@ -0,0 +1,2 @@ +put the commandline +-- "-c alpha beta -h gamma" diff --git a/Task/Command-line-arguments/Lingo/command-line-arguments-2.lingo b/Task/Command-line-arguments/Lingo/command-line-arguments-2.lingo new file mode 100644 index 0000000000..3dcdab147d --- /dev/null +++ b/Task/Command-line-arguments/Lingo/command-line-arguments-2.lingo @@ -0,0 +1,2 @@ +put getCommandLineArgs() +-- ["-c", "alpha beta", "-h", "gamma"] diff --git a/Task/Command-line-arguments/Nim/command-line-arguments.nim b/Task/Command-line-arguments/Nim/command-line-arguments.nim new file mode 100644 index 0000000000..ec403db4c5 --- /dev/null +++ b/Task/Command-line-arguments/Nim/command-line-arguments.nim @@ -0,0 +1,3 @@ +import os +let programName = paramStr(0) +let arguments = commandLineParams() diff --git a/Task/Command-line-arguments/Oforth/command-line-arguments.oforth b/Task/Command-line-arguments/Oforth/command-line-arguments.oforth new file mode 100644 index 0000000000..dfbe69728c --- /dev/null +++ b/Task/Command-line-arguments/Oforth/command-line-arguments.oforth @@ -0,0 +1 @@ +System.Args println diff --git a/Task/Command-line-arguments/Phix/command-line-arguments.phix b/Task/Command-line-arguments/Phix/command-line-arguments.phix new file mode 100644 index 0000000000..8be9087240 --- /dev/null +++ b/Task/Command-line-arguments/Phix/command-line-arguments.phix @@ -0,0 +1,13 @@ +constant cmd = command_line() +?cmd +if cmd[1]=cmd[2] then + printf(1,"Compiled executable name: %s\n",{cmd[1]}) +else + printf(1,"Interpreted (using %s) source name: %s\n",cmd[1..2]) +end if +if length(cmd)>2 then + puts(1,"Command line arguments:\n") + for i = 3 to length(cmd) do + printf(1,"#%d : %s\n",{i,cmd[i]}) + end for +end if diff --git a/Task/Command-line-arguments/Ring/command-line-arguments.ring b/Task/Command-line-arguments/Ring/command-line-arguments.ring new file mode 100644 index 0000000000..3e54db74fd --- /dev/null +++ b/Task/Command-line-arguments/Ring/command-line-arguments.ring @@ -0,0 +1,8 @@ +see copy("=",30) + nl +see "Command Line Parameters" + nl +see "Size : " + len(sysargv) + nl +see sysargv +see copy("=",30) + nl +for x = 1 to len(sysargv) + see x + nl +next diff --git a/Task/Command-line-arguments/Sidef/command-line-arguments.sidef b/Task/Command-line-arguments/Sidef/command-line-arguments.sidef new file mode 100644 index 0000000000..fecb27576f --- /dev/null +++ b/Task/Command-line-arguments/Sidef/command-line-arguments.sidef @@ -0,0 +1 @@ +say ARGV; diff --git a/Task/Command-line-arguments/Swift/command-line-arguments-1.swift b/Task/Command-line-arguments/Swift/command-line-arguments-1.swift new file mode 100644 index 0000000000..f207fbed91 --- /dev/null +++ b/Task/Command-line-arguments/Swift/command-line-arguments-1.swift @@ -0,0 +1,6 @@ +let args = Process.arguments +println("This program is named \(args[0]).") +println("There are \(args.count-1) arguments.") +for i in 1.. endl console +end for diff --git a/Task/Comments/AntLang/comments.antlang b/Task/Comments/AntLang/comments.antlang new file mode 100644 index 0000000000..f2b7a11036 --- /dev/null +++ b/Task/Comments/AntLang/comments.antlang @@ -0,0 +1 @@ +2 + 2 /This is a comment diff --git a/Task/Comments/Apex/comments.apex b/Task/Comments/Apex/comments.apex new file mode 100644 index 0000000000..d5d52254bd --- /dev/null +++ b/Task/Comments/Apex/comments.apex @@ -0,0 +1,4 @@ +System.debug ('I will execute'); // This comment is ignored. +/* + I am a large comment, completely ignored as well. +*/ diff --git a/Task/Comments/Axe/comments-1.axe b/Task/Comments/Axe/comments-1.axe new file mode 100644 index 0000000000..0c0bc6d4c0 --- /dev/null +++ b/Task/Comments/Axe/comments-1.axe @@ -0,0 +1 @@ +.This is a single-line comment diff --git a/Task/Comments/Axe/comments-2.axe b/Task/Comments/Axe/comments-2.axe new file mode 100644 index 0000000000..86a9ba5e5d --- /dev/null +++ b/Task/Comments/Axe/comments-2.axe @@ -0,0 +1,3 @@ +... +This is a multi-line comment +... diff --git a/Task/Comments/Axe/comments-3.axe b/Task/Comments/Axe/comments-3.axe new file mode 100644 index 0000000000..5cfdf8103a --- /dev/null +++ b/Task/Comments/Axe/comments-3.axe @@ -0,0 +1,3 @@ +...If 0 +This is a comment only if the condition evaluates to zero +... diff --git a/Task/Comments/Axe/comments-4.axe b/Task/Comments/Axe/comments-4.axe new file mode 100644 index 0000000000..21aa782c3b --- /dev/null +++ b/Task/Comments/Axe/comments-4.axe @@ -0,0 +1,3 @@ +...!If 1 +This is a comment only if the condition evaluates to nonzero +... diff --git a/Task/Comments/Axe/comments-5.axe b/Task/Comments/Axe/comments-5.axe new file mode 100644 index 0000000000..ab561d546e --- /dev/null +++ b/Task/Comments/Axe/comments-5.axe @@ -0,0 +1,3 @@ +...Else +This is a comment only if the previous conditional comment was executed (and vice versa) +... diff --git a/Task/Comments/ChucK/comments.chuck b/Task/Comments/ChucK/comments.chuck new file mode 100644 index 0000000000..3c6667f949 --- /dev/null +++ b/Task/Comments/ChucK/comments.chuck @@ -0,0 +1,2 @@ +<-- Not common +// Usual comment diff --git a/Task/Comments/ECL/comments-1.ecl b/Task/Comments/ECL/comments-1.ecl new file mode 100644 index 0000000000..a86ba8fc8c --- /dev/null +++ b/Task/Comments/ECL/comments-1.ecl @@ -0,0 +1 @@ +// this is a one-line comment diff --git a/Task/Comments/ECL/comments-2.ecl b/Task/Comments/ECL/comments-2.ecl new file mode 100644 index 0000000000..a406b1a0d3 --- /dev/null +++ b/Task/Comments/ECL/comments-2.ecl @@ -0,0 +1,2 @@ + /* this is a block comment - the terminator can be on the same line +or any succeeding line – everything in between is ignored */ diff --git a/Task/Comments/EDSAC-order-code/comments.edsac b/Task/Comments/EDSAC-order-code/comments.edsac new file mode 100644 index 0000000000..191ceb8eb8 --- /dev/null +++ b/Task/Comments/EDSAC-order-code/comments.edsac @@ -0,0 +1,7 @@ +[This is a comment] +[ +And so +is +this +] +[But in 1949 they wouldn't have been] diff --git a/Task/Comments/ERRE/comments.erre b/Task/Comments/ERRE/comments.erre new file mode 100644 index 0000000000..1265d80581 --- /dev/null +++ b/Task/Comments/ERRE/comments.erre @@ -0,0 +1,3 @@ +! Standard ERRE comments begin with ! and extend to the end of the line + +PRINT("this is code") ! comment after statement diff --git a/Task/Comments/EchoLisp/comments.echolisp b/Task/Comments/EchoLisp/comments.echolisp new file mode 100644 index 0000000000..667abb6232 --- /dev/null +++ b/Task/Comments/EchoLisp/comments.echolisp @@ -0,0 +1,14 @@ +666 ; this is an end-of-line comment + +#| + This is a multi-line comment + Nesting is not allowed +|# + +;; The (info [)] function associates a symbol and a comment +;; These info strings are saved in permanent memory (local storage) +;; Unicode characters may be used, as everywhere in the language + +(define mynumber 666) → mynumber +(info 'mynumber "👀 Symbols may be commented with an information string 👺") +(info 'mynumber) → displays the above inside the 'info' field. diff --git a/Task/Comments/Elm/comments.elm b/Task/Comments/Elm/comments.elm new file mode 100644 index 0000000000..34a34c32df --- /dev/null +++ b/Task/Comments/Elm/comments.elm @@ -0,0 +1,5 @@ +-- a single line comment + +{- a multiline comment + {- can be nested -} +-} diff --git a/Task/Comments/FUZE-BASIC/comments.fuze b/Task/Comments/FUZE-BASIC/comments.fuze new file mode 100644 index 0000000000..c3a7b031cf --- /dev/null +++ b/Task/Comments/FUZE-BASIC/comments.fuze @@ -0,0 +1,5 @@ +//Comment (No space required) +# Comment (Space required) +REM Comment (Space require) +PRINT "This is an inline comment."//Comment (No space required) +END diff --git a/Task/Comments/FreeBASIC/comments.freebasic b/Task/Comments/FreeBASIC/comments.freebasic new file mode 100644 index 0000000000..28bd94c704 --- /dev/null +++ b/Task/Comments/FreeBASIC/comments.freebasic @@ -0,0 +1,19 @@ +' FB 1.05.0 Win64 + +' This a single line comment + +REM This is another way of writing a single line comment + +/' + This is a + multi-line + comment +'/ + +/' + Multi-line comments + /' + can also be nested + '/ + like this +'/ diff --git a/Task/Comments/Futhark/comments.futhark b/Task/Comments/Futhark/comments.futhark new file mode 100644 index 0000000000..877f7dda3d --- /dev/null +++ b/Task/Comments/Futhark/comments.futhark @@ -0,0 +1,4 @@ +-- Single-line comment + +-- Multi-line +-- comment (yes, just several single-line comments). diff --git a/Task/Comments/Gri/comments-1.gri b/Task/Comments/Gri/comments-1.gri new file mode 100644 index 0000000000..e9e8b108bd --- /dev/null +++ b/Task/Comments/Gri/comments-1.gri @@ -0,0 +1,2 @@ +# this is a comment +show 123 # this too is a comment diff --git a/Task/Comments/Gri/comments-2.gri b/Task/Comments/Gri/comments-2.gri new file mode 100644 index 0000000000..dbc7062563 --- /dev/null +++ b/Task/Comments/Gri/comments-2.gri @@ -0,0 +1,2 @@ +// this is a comment +show 123 // this too is a comment diff --git a/Task/Comments/Lasso/comments.lasso b/Task/Comments/Lasso/comments.lasso new file mode 100644 index 0000000000..a9316c4510 --- /dev/null +++ b/Task/Comments/Lasso/comments.lasso @@ -0,0 +1,11 @@ +//This is a comment. + +/* This is also a comment. */ + +/* A multi-line +comment */ + +/* ========================== +A multi-line +comment +=========================== */ diff --git a/Task/Comments/Lily/comments-1.lily b/Task/Comments/Lily/comments-1.lily new file mode 100644 index 0000000000..c1785d9f4a --- /dev/null +++ b/Task/Comments/Lily/comments-1.lily @@ -0,0 +1 @@ +# This is a single-line comment diff --git a/Task/Comments/Lily/comments-2.lily b/Task/Comments/Lily/comments-2.lily new file mode 100644 index 0000000000..4dc8fecdac --- /dev/null +++ b/Task/Comments/Lily/comments-2.lily @@ -0,0 +1,5 @@ +#[ This +is +a +block +comment ]# diff --git a/Task/Comments/Lingo/comments.lingo b/Task/Comments/Lingo/comments.lingo new file mode 100644 index 0000000000..6066e2b117 --- /dev/null +++ b/Task/Comments/Lingo/comments.lingo @@ -0,0 +1,2 @@ +-- This is a comment. +-- This is another comment diff --git a/Task/Comments/LiveCode/comments.livecode b/Task/Comments/LiveCode/comments.livecode new file mode 100644 index 0000000000..ed6b128548 --- /dev/null +++ b/Task/Comments/LiveCode/comments.livecode @@ -0,0 +1,6 @@ +-- comment may appear anywhere on line +// comment may appear anywhere on line +# comment may appear anywhere on line +/* this is a +block comment that +may span any number of lines */ diff --git a/Task/Comments/Monte/comments.monte b/Task/Comments/Monte/comments.monte new file mode 100644 index 0000000000..59a25e8ac0 --- /dev/null +++ b/Task/Comments/Monte/comments.monte @@ -0,0 +1,5 @@ +# This comment goes to the end of the line +/** This comment is multi-line. + Yes, it starts with a two stars + and ends with only one. + These should only be used for docstrings. */ diff --git a/Task/Comments/NESL/comments.nesl b/Task/Comments/NESL/comments.nesl new file mode 100644 index 0000000000..c033a0ebbf --- /dev/null +++ b/Task/Comments/NESL/comments.nesl @@ -0,0 +1 @@ +% This is a comment. % diff --git a/Task/Comments/Nim/comments.nim b/Task/Comments/Nim/comments.nim new file mode 100644 index 0000000000..7d2baad18f --- /dev/null +++ b/Task/Comments/Nim/comments.nim @@ -0,0 +1,14 @@ +# Nim supports only single-line comments + +var x = 0 ## Documentation comments start with double hash characters. + +var y = 0 ## Comments are a proper part of the syntax and are indentation sensitive. + ## If the next line only consists of a comment piece, it must be aligned + ## either to the preceding one (documentation generator would merge these lines) +## or to the code block (starting a new comment piece). + + # any misaligned comment line (like this one) would trigger an "invalid indentation" error + +var z = 0 ## Alternatively you can end the preceding comment piece with a backslash \ + ## to reset alignment to any column you like. + ## See also http://nim-code.org/tut1.html#comments diff --git a/Task/Comments/Oforth/comments.oforth b/Task/Comments/Oforth/comments.oforth new file mode 100644 index 0000000000..08fcd4465f --- /dev/null +++ b/Task/Comments/Oforth/comments.oforth @@ -0,0 +1 @@ +// This is a comment... diff --git a/Task/Comments/Peloton/comments.peloton b/Task/Comments/Peloton/comments.peloton new file mode 100644 index 0000000000..5cee1c62b6 --- /dev/null +++ b/Task/Comments/Peloton/comments.peloton @@ -0,0 +1,3 @@ +<@ OMT>This is a +multiline +comment diff --git a/Task/Comments/Phix/comments-1.phix b/Task/Comments/Phix/comments-1.phix new file mode 100644 index 0000000000..5e7aa74e92 --- /dev/null +++ b/Task/Comments/Phix/comments-1.phix @@ -0,0 +1 @@ +-- This is a comment diff --git a/Task/Comments/Phix/comments-2.phix b/Task/Comments/Phix/comments-2.phix new file mode 100644 index 0000000000..837df9f14d --- /dev/null +++ b/Task/Comments/Phix/comments-2.phix @@ -0,0 +1,10 @@ +/* +This is a comment +procedure oldproc() + /* + This is also a comment + */ + puts(1,"kill me now") +end procedure +*/ +puts(1,"this is not a comment") diff --git a/Task/Comments/Ring/comments-1.ring b/Task/Comments/Ring/comments-1.ring new file mode 100644 index 0000000000..0fae1facca --- /dev/null +++ b/Task/Comments/Ring/comments-1.ring @@ -0,0 +1,2 @@ +//this is a single line comment +#this also a single line comment! diff --git a/Task/Comments/Ring/comments-2.ring b/Task/Comments/Ring/comments-2.ring new file mode 100644 index 0000000000..4ecc0be0b7 --- /dev/null +++ b/Task/Comments/Ring/comments-2.ring @@ -0,0 +1,4 @@ +/*This is a multi-line +comment that will be completely +ignored by the compiler/interpreter +*/ diff --git a/Task/Comments/SSEM/comments.ssem b/Task/Comments/SSEM/comments.ssem new file mode 100644 index 0000000000..e7b5ee3c92 --- /dev/null +++ b/Task/Comments/SSEM/comments.ssem @@ -0,0 +1 @@ +00101010010001000100100100001100 diff --git a/Task/Comments/Set-lang/comments.set b/Task/Comments/Set-lang/comments.set new file mode 100644 index 0000000000..a7c7159935 --- /dev/null +++ b/Task/Comments/Set-lang/comments.set @@ -0,0 +1,2 @@ +> Comments start where a > (greater than symbol) starts +set a 0 > Comments may start after a Set command diff --git a/Task/Comments/Sidef/comments-1.sidef b/Task/Comments/Sidef/comments-1.sidef new file mode 100644 index 0000000000..2369670383 --- /dev/null +++ b/Task/Comments/Sidef/comments-1.sidef @@ -0,0 +1 @@ +# this is commented diff --git a/Task/Comments/Sidef/comments-2.sidef b/Task/Comments/Sidef/comments-2.sidef new file mode 100644 index 0000000000..176aa489d3 --- /dev/null +++ b/Task/Comments/Sidef/comments-2.sidef @@ -0,0 +1 @@ +var i = 1; # this is the comment part diff --git a/Task/Comments/Sidef/comments-3.sidef b/Task/Comments/Sidef/comments-3.sidef new file mode 100644 index 0000000000..e8a3b94220 --- /dev/null +++ b/Task/Comments/Sidef/comments-3.sidef @@ -0,0 +1,2 @@ +var distance #`{in meters} = (30 #`{meters} * 100 #`{seconds}); +say distance; # prints: 3000 diff --git a/Task/Comments/Sidef/comments-4.sidef b/Task/Comments/Sidef/comments-4.sidef new file mode 100644 index 0000000000..4d634c4e3a --- /dev/null +++ b/Task/Comments/Sidef/comments-4.sidef @@ -0,0 +1,3 @@ +/* + This is a multi-line comment +*/ diff --git a/Task/Comments/Swift/comments.swift b/Task/Comments/Swift/comments.swift new file mode 100644 index 0000000000..8df0130e5f --- /dev/null +++ b/Task/Comments/Swift/comments.swift @@ -0,0 +1,10 @@ +// this is a single line comment +/* This a block comment + /* containing nested comment */ + */ + +///This is a documentation comment + +/** + This is a documentation block comment +*/ diff --git a/Task/Comments/Ursa/comments.ursa b/Task/Comments/Ursa/comments.ursa new file mode 100644 index 0000000000..9e37aae810 --- /dev/null +++ b/Task/Comments/Ursa/comments.ursa @@ -0,0 +1,2 @@ +# this is a comment +# this is another comment diff --git a/Task/Comments/Wart/comments.wart b/Task/Comments/Wart/comments.wart new file mode 100644 index 0000000000..be697a0aa5 --- /dev/null +++ b/Task/Comments/Wart/comments.wart @@ -0,0 +1 @@ +# single line comment diff --git a/Task/Comments/XLISP/comments.xlisp b/Task/Comments/XLISP/comments.xlisp new file mode 100644 index 0000000000..ed6f95860d --- /dev/null +++ b/Task/Comments/XLISP/comments.xlisp @@ -0,0 +1 @@ +; this is a comment diff --git a/Task/Comments/jq/comments.jq b/Task/Comments/jq/comments.jq new file mode 100644 index 0000000000..73f85e90ca --- /dev/null +++ b/Task/Comments/jq/comments.jq @@ -0,0 +1,2 @@ +# this is a single line comment +"Hello #world" # the first # on this line is part of the jq program diff --git a/Task/Compile-time-calculation/EchoLisp/compile-time-calculation.echolisp b/Task/Compile-time-calculation/EchoLisp/compile-time-calculation.echolisp new file mode 100644 index 0000000000..9a60cdfb4f --- /dev/null +++ b/Task/Compile-time-calculation/EchoLisp/compile-time-calculation.echolisp @@ -0,0 +1,5 @@ +(define-constant DIX! (factorial 10)) +(define-constant DIX!+1 (1+ DIX!)) + +(writeln DIX!+1) +3628801 diff --git a/Task/Compile-time-calculation/FreeBASIC/compile-time-calculation.freebasic b/Task/Compile-time-calculation/FreeBASIC/compile-time-calculation.freebasic new file mode 100644 index 0000000000..48dec34b94 --- /dev/null +++ b/Task/Compile-time-calculation/FreeBASIC/compile-time-calculation.freebasic @@ -0,0 +1,8 @@ +' FB 1.05.0 Win64 + +' Calculations can be done in a Const declaration at compile time +' provided only literals or other constant expressions are used + +Const factorial As Integer = 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 +Print factorial ' 3628800 +Sleep diff --git a/Task/Compile-time-calculation/Lingo/compile-time-calculation.lingo b/Task/Compile-time-calculation/Lingo/compile-time-calculation.lingo new file mode 100644 index 0000000000..2af1383416 --- /dev/null +++ b/Task/Compile-time-calculation/Lingo/compile-time-calculation.lingo @@ -0,0 +1,8 @@ +-- create new (movie) script at runtime +m = new(#script) + +-- the following line triggers compilation to bytecode +m.scriptText = "on fac10"&RETURN&"return "&(10*9*8*7*6*5*4*3*2)&RETURN&"end" + +put fac10() +-- 3628800 diff --git a/Task/Compile-time-calculation/Nim/compile-time-calculation-1.nim b/Task/Compile-time-calculation/Nim/compile-time-calculation-1.nim new file mode 100644 index 0000000000..4fcde79ead --- /dev/null +++ b/Task/Compile-time-calculation/Nim/compile-time-calculation-1.nim @@ -0,0 +1,7 @@ +proc fact(x: int): int = + result = 1 + for i in 2..x: + result = result * i + +const fact10 = fact(10) +echo(fact10) diff --git a/Task/Compile-time-calculation/Nim/compile-time-calculation-2.nim b/Task/Compile-time-calculation/Nim/compile-time-calculation-2.nim new file mode 100644 index 0000000000..20754dab1b --- /dev/null +++ b/Task/Compile-time-calculation/Nim/compile-time-calculation-2.nim @@ -0,0 +1,3 @@ +... +STRING_LITERAL(TMP122, "3628800", 7); +... diff --git a/Task/Compile-time-calculation/Oforth/compile-time-calculation-1.oforth b/Task/Compile-time-calculation/Oforth/compile-time-calculation-1.oforth new file mode 100644 index 0000000000..4b786194b6 --- /dev/null +++ b/Task/Compile-time-calculation/Oforth/compile-time-calculation-1.oforth @@ -0,0 +1,2 @@ +10 seq reduce(#*) Constant new: FACT10 +: newFunction FACT10 . ; diff --git a/Task/Compile-time-calculation/Oforth/compile-time-calculation-2.oforth b/Task/Compile-time-calculation/Oforth/compile-time-calculation-2.oforth new file mode 100644 index 0000000000..1a97526493 --- /dev/null +++ b/Task/Compile-time-calculation/Oforth/compile-time-calculation-2.oforth @@ -0,0 +1,4 @@ +20 seq map(#[ seq reduce(#*) ]) Constant new: ALLFACTS +: fact(n) n ifZero: [ 1 ] else: [ ALLFACTS at(n) ] ; + +ALLFACTS println diff --git a/Task/Compile-time-calculation/Phix/compile-time-calculation.phix b/Task/Compile-time-calculation/Phix/compile-time-calculation.phix new file mode 100644 index 0000000000..19b0d7de82 --- /dev/null +++ b/Task/Compile-time-calculation/Phix/compile-time-calculation.phix @@ -0,0 +1,4 @@ +integer a,b +a = 10*9*8*7*6*5*4*3*2*1 +b = factorial(10) +?{a,b} diff --git a/Task/Compile-time-calculation/Ring/compile-time-calculation.ring b/Task/Compile-time-calculation/Ring/compile-time-calculation.ring new file mode 100644 index 0000000000..e672396d98 --- /dev/null +++ b/Task/Compile-time-calculation/Ring/compile-time-calculation.ring @@ -0,0 +1,6 @@ +a = 10*9*8*7*6*5*4*3*2*1 +b = factorial(10) +see a + nl +see b + nl + +func factorial nr if nr = 1 return 1 else return nr * factorial(nr-1) ok diff --git a/Task/Compile-time-calculation/Sidef/compile-time-calculation-1.sidef b/Task/Compile-time-calculation/Sidef/compile-time-calculation-1.sidef new file mode 100644 index 0000000000..8f02dce973 --- /dev/null +++ b/Task/Compile-time-calculation/Sidef/compile-time-calculation-1.sidef @@ -0,0 +1,2 @@ +define n = (10!); +say n; diff --git a/Task/Compile-time-calculation/Sidef/compile-time-calculation-2.sidef b/Task/Compile-time-calculation/Sidef/compile-time-calculation-2.sidef new file mode 100644 index 0000000000..d2bc8520f4 --- /dev/null +++ b/Task/Compile-time-calculation/Sidef/compile-time-calculation-2.sidef @@ -0,0 +1,2 @@ +define n = (func(n){ n > 0 ? __FUNC__(n-1)*n : 1 }(10)); +say n; diff --git a/Task/Compile-time-calculation/XLISP/compile-time-calculation-1.xlisp b/Task/Compile-time-calculation/XLISP/compile-time-calculation-1.xlisp new file mode 100644 index 0000000000..8cf85a43cc --- /dev/null +++ b/Task/Compile-time-calculation/XLISP/compile-time-calculation-1.xlisp @@ -0,0 +1 @@ +(defmacro f10-at-compile-time () (* 2 3 4 5 6 7 8 9 10)) diff --git a/Task/Compile-time-calculation/XLISP/compile-time-calculation-2.xlisp b/Task/Compile-time-calculation/XLISP/compile-time-calculation-2.xlisp new file mode 100644 index 0000000000..aa15265ee6 --- /dev/null +++ b/Task/Compile-time-calculation/XLISP/compile-time-calculation-2.xlisp @@ -0,0 +1 @@ +(defmacro f10-at-run-time () '(* 2 3 4 5 6 7 8 9 10)) diff --git a/Task/Compile-time-calculation/XLISP/compile-time-calculation-3.xlisp b/Task/Compile-time-calculation/XLISP/compile-time-calculation-3.xlisp new file mode 100644 index 0000000000..b01d8cf592 --- /dev/null +++ b/Task/Compile-time-calculation/XLISP/compile-time-calculation-3.xlisp @@ -0,0 +1,6 @@ +[1] (defun test-f10-ct () (f10-at-compile-time)) + +TEST-F10-CT +[2] (defun test-f10-rt () (f10-at-run-time)) + +TEST-F10-RT diff --git a/Task/Compound-data-type/Axe/compound-data-type-1.axe b/Task/Compound-data-type/Axe/compound-data-type-1.axe new file mode 100644 index 0000000000..64f46e36b8 --- /dev/null +++ b/Task/Compound-data-type/Axe/compound-data-type-1.axe @@ -0,0 +1,5 @@ +Lbl POINT +r₂→{r₁}ʳ +r₃→{r₁+2}ʳ +r₁ +Return diff --git a/Task/Compound-data-type/Axe/compound-data-type-2.axe b/Task/Compound-data-type/Axe/compound-data-type-2.axe new file mode 100644 index 0000000000..80f43942da --- /dev/null +++ b/Task/Compound-data-type/Axe/compound-data-type-2.axe @@ -0,0 +1 @@ +POINT(L₁,5,10) diff --git a/Task/Compound-data-type/EchoLisp/compound-data-type.echolisp b/Task/Compound-data-type/EchoLisp/compound-data-type.echolisp new file mode 100644 index 0000000000..54cd431847 --- /dev/null +++ b/Task/Compound-data-type/EchoLisp/compound-data-type.echolisp @@ -0,0 +1,12 @@ +(lib 'struct) + (struct Point (x y)) + (Point 3 4) + → # (3 4) + +;; run-time type checking is possible +(lib 'types) + (struct Point (x y)) + (struct-type Point Number Number) + (Point 3 4) + (Point 3 'albert) +❌ error: #number? : type-check failure : albert → 'Point:y' diff --git a/Task/Compound-data-type/FreeBASIC/compound-data-type.freebasic b/Task/Compound-data-type/FreeBASIC/compound-data-type.freebasic new file mode 100644 index 0000000000..30f22ae8b6 --- /dev/null +++ b/Task/Compound-data-type/FreeBASIC/compound-data-type.freebasic @@ -0,0 +1,11 @@ +' FB 1.05.0 Win64 + +Type Point + As Integer x, y +End Type + +Dim p As Point = (1, 2) +Dim p2 As Point = (3, 4) +Print p.x, p.y +Print p2.x, p2.y +Sleep diff --git a/Task/Compound-data-type/LFE/compound-data-type.lfe b/Task/Compound-data-type/LFE/compound-data-type.lfe new file mode 100644 index 0000000000..532ee6c97c --- /dev/null +++ b/Task/Compound-data-type/LFE/compound-data-type.lfe @@ -0,0 +1,3 @@ +(defrecord point + x + y) diff --git a/Task/Compound-data-type/Lasso/compound-data-type.lasso b/Task/Compound-data-type/Lasso/compound-data-type.lasso new file mode 100644 index 0000000000..544245eaea --- /dev/null +++ b/Task/Compound-data-type/Lasso/compound-data-type.lasso @@ -0,0 +1,14 @@ +define Point => type { + parent pair + + public onCreate(x,y) => { + ..onCreate(#x=#y) + } + + public x => .first + public y => .second +} + +local(point) = Point(33, 42) +#point->x +#point->y diff --git a/Task/Compound-data-type/Lingo/compound-data-type-1.lingo b/Task/Compound-data-type/Lingo/compound-data-type-1.lingo new file mode 100644 index 0000000000..6a69cab486 --- /dev/null +++ b/Task/Compound-data-type/Lingo/compound-data-type-1.lingo @@ -0,0 +1,8 @@ +-- parent script "MyPoint" +property x +property y +on new (me, px, py) + me.x = px + me.y = py + return me +end diff --git a/Task/Compound-data-type/Lingo/compound-data-type-2.lingo b/Task/Compound-data-type/Lingo/compound-data-type-2.lingo new file mode 100644 index 0000000000..7bdd6b898b --- /dev/null +++ b/Task/Compound-data-type/Lingo/compound-data-type-2.lingo @@ -0,0 +1,3 @@ +p = script("MyPoint").new(23, 42) +put p.x, p.y +-- 23 42 diff --git a/Task/Compound-data-type/Lingo/compound-data-type-3.lingo b/Task/Compound-data-type/Lingo/compound-data-type-3.lingo new file mode 100644 index 0000000000..6164f9d769 --- /dev/null +++ b/Task/Compound-data-type/Lingo/compound-data-type-3.lingo @@ -0,0 +1,4 @@ +-- in some movie script +on MyPoint (x, y) + return script("MyPoint").new(x, y) +end diff --git a/Task/Compound-data-type/Lingo/compound-data-type-4.lingo b/Task/Compound-data-type/Lingo/compound-data-type-4.lingo new file mode 100644 index 0000000000..d3909600e1 --- /dev/null +++ b/Task/Compound-data-type/Lingo/compound-data-type-4.lingo @@ -0,0 +1,3 @@ +p = MyPoint(23, 42) +put p.x, p.y +-- 23 42 diff --git a/Task/Compound-data-type/Nim/compound-data-type.nim b/Task/Compound-data-type/Nim/compound-data-type.nim new file mode 100644 index 0000000000..6b72406b0f --- /dev/null +++ b/Task/Compound-data-type/Nim/compound-data-type.nim @@ -0,0 +1,4 @@ +type Point = tuple[x, y: int] + +var p: Point = (12, 13) +var p2: Point = (x: 100, y: 200) diff --git a/Task/Compound-data-type/Oforth/compound-data-type.oforth b/Task/Compound-data-type/Oforth/compound-data-type.oforth new file mode 100644 index 0000000000..db5e1624b2 --- /dev/null +++ b/Task/Compound-data-type/Oforth/compound-data-type.oforth @@ -0,0 +1 @@ +Object Class new: Point(x, y) diff --git a/Task/Compound-data-type/Phix/compound-data-type.phix b/Task/Compound-data-type/Phix/compound-data-type.phix new file mode 100644 index 0000000000..3eb85e5a7d --- /dev/null +++ b/Task/Compound-data-type/Phix/compound-data-type.phix @@ -0,0 +1,15 @@ +enum x,y +type point(object p) + return sequence(p) and length(p)=y and atom(p[x]) and atom(p[y]) +end type + +point p = {175,3.375} + +p[x] -= p[y]*20 + +puts(1,"point p is ") +?p +printf(1,"p[x]:%g, p[y]:%g\n",{p[x],p[y]}) + +p[x] = 0 -- fine +p[y] = "string" -- run-time error diff --git a/Task/Compound-data-type/Ring/compound-data-type-1.ring b/Task/Compound-data-type/Ring/compound-data-type-1.ring new file mode 100644 index 0000000000..3964a1a8c5 --- /dev/null +++ b/Task/Compound-data-type/Ring/compound-data-type-1.ring @@ -0,0 +1 @@ +see new point {x=10 y=20} class point x y diff --git a/Task/Compound-data-type/Ring/compound-data-type-2.ring b/Task/Compound-data-type/Ring/compound-data-type-2.ring new file mode 100644 index 0000000000..8c706ce650 --- /dev/null +++ b/Task/Compound-data-type/Ring/compound-data-type-2.ring @@ -0,0 +1,2 @@ +x: 10.000000 +y: 20.000000 diff --git a/Task/Compound-data-type/Shen/compound-data-type-1.shen b/Task/Compound-data-type/Shen/compound-data-type-1.shen new file mode 100644 index 0000000000..891db210dc --- /dev/null +++ b/Task/Compound-data-type/Shen/compound-data-type-1.shen @@ -0,0 +1,4 @@ +(datatype point + X : number; Y : number; + ==================== + [point X Y] : point;) diff --git a/Task/Compound-data-type/Shen/compound-data-type-2.shen b/Task/Compound-data-type/Shen/compound-data-type-2.shen new file mode 100644 index 0000000000..6a8af15772 --- /dev/null +++ b/Task/Compound-data-type/Shen/compound-data-type-2.shen @@ -0,0 +1,2 @@ +(2+) (@p 1 2) +(@p 1 2) : (number * number) diff --git a/Task/Compound-data-type/Sidef/compound-data-type.sidef b/Task/Compound-data-type/Sidef/compound-data-type.sidef new file mode 100644 index 0000000000..6db98a1acf --- /dev/null +++ b/Task/Compound-data-type/Sidef/compound-data-type.sidef @@ -0,0 +1,3 @@ +struct Point {x, y}; +var point = Point(1, 2); +say point.y; #=> 2 diff --git a/Task/Compound-data-type/Swift/compound-data-type.swift b/Task/Compound-data-type/Swift/compound-data-type.swift new file mode 100644 index 0000000000..6da9dc2e67 --- /dev/null +++ b/Task/Compound-data-type/Swift/compound-data-type.swift @@ -0,0 +1,19 @@ +// Structure +struct Point { + var x:Int + var y:Int +} + +// Tuple +typealias PointTuple = (Int, Int) + +// Class +class PointClass { + var x:Int! + var y:Int! + + init(x:Int, y:Int) { + self.x = x + self.y = y + } +} diff --git a/Task/Compound-data-type/jq/compound-data-type-1.jq b/Task/Compound-data-type/jq/compound-data-type-1.jq new file mode 100644 index 0000000000..700b7951a2 --- /dev/null +++ b/Task/Compound-data-type/jq/compound-data-type-1.jq @@ -0,0 +1 @@ +{"x":1, "y":2} diff --git a/Task/Compound-data-type/jq/compound-data-type-2.jq b/Task/Compound-data-type/jq/compound-data-type-2.jq new file mode 100644 index 0000000000..094a65be90 --- /dev/null +++ b/Task/Compound-data-type/jq/compound-data-type-2.jq @@ -0,0 +1 @@ +{"x":1, "y":2, type: "Point"} diff --git a/Task/Concurrent-computing/EchoLisp/concurrent-computing.echolisp b/Task/Concurrent-computing/EchoLisp/concurrent-computing.echolisp new file mode 100644 index 0000000000..6c72e8ec0d --- /dev/null +++ b/Task/Concurrent-computing/EchoLisp/concurrent-computing.echolisp @@ -0,0 +1,13 @@ +(lib 'tasks) ;; use the tasks library + +(define (tprint line ) ;; task definition + (writeln _TASK line) + #f ) + +(for-each task-run ;; run three // tasks + (map (curry make-task tprint) '(Enjoy Rosetta code ))) + + → + #task:id:66:running Rosetta + #task:id:67:running code + #task:id:65:running Enjoy diff --git a/Task/Concurrent-computing/FreeBASIC/concurrent-computing.freebasic b/Task/Concurrent-computing/FreeBASIC/concurrent-computing.freebasic new file mode 100644 index 0000000000..54b1bef861 --- /dev/null +++ b/Task/Concurrent-computing/FreeBASIC/concurrent-computing.freebasic @@ -0,0 +1,29 @@ +' FB 1.05.0 Win64 +' Compiled with -mt switch (to use threadsafe runtiume) +' The 'ThreadCall' functionality in FB is based internally on LibFFi (see [https://github.com/libffi/libffi/blob/master/LICENSE] for license) + +Sub thread1() + Print "Enjoy" +End Sub + +Sub thread2() + Print "Rosetta" +End Sub + +Sub thread3() + Print "Code" +End Sub + +Print "Press any key to print next batch of 3 strings or ESC to quit" +Print + +Do + Dim t1 As Any Ptr = ThreadCall thread1 + Dim t2 As Any Ptr = ThreadCall thread2 + Dim t3 As Any Ptr = ThreadCall thread3 + ThreadWait t1 + ThreadWait t2 + ThreadWait t3 + Print + Sleep +Loop While Inkey <> Chr(27) diff --git a/Task/Concurrent-computing/LFE/concurrent-computing.lfe b/Task/Concurrent-computing/LFE/concurrent-computing.lfe new file mode 100644 index 0000000000..57adb0a222 --- /dev/null +++ b/Task/Concurrent-computing/LFE/concurrent-computing.lfe @@ -0,0 +1,26 @@ +;;; +;;; This is a straight port of the Erlang version. +;;; +;;; You can run this under the LFE REPL as follows: +;;; +;;; (slurp "concurrent-computing.lfe") +;;; (start) +;;; +(defmodule concurrent-computing + (export (start 0))) + +(defun start () + (lc ((<- word '("Enjoy" "Rosetta" "Code"))) + (spawn (lambda () (say (self) word)))) + (wait 2) + 'ok) + +(defun say (pid word) + (lfe_io:format "~p~n" (list word)) + (! pid 'done)) + +(defun wait (n) + (receive + ('done (case n + (0 0) + (_n (wait (- n 1))))))) diff --git a/Task/Concurrent-computing/Nim/concurrent-computing-1.nim b/Task/Concurrent-computing/Nim/concurrent-computing-1.nim new file mode 100644 index 0000000000..466cc9b3b8 --- /dev/null +++ b/Task/Concurrent-computing/Nim/concurrent-computing-1.nim @@ -0,0 +1,10 @@ +const str = ["Enjoy", "Rosetta", "Code"] + +var thr: array[3, TThread[int32]] + +proc f(i) {.thread.} = + echo str[i] + +for i in 0..thr.high: + createThread(thr[i], f, int32(i)) +joinThreads(thr) diff --git a/Task/Concurrent-computing/Nim/concurrent-computing-2.nim b/Task/Concurrent-computing/Nim/concurrent-computing-2.nim new file mode 100644 index 0000000000..d78c399dc5 --- /dev/null +++ b/Task/Concurrent-computing/Nim/concurrent-computing-2.nim @@ -0,0 +1,4 @@ +const str = ["Enjoy", "Rosetta", "Code"] + +for i in 0||2: + echo str[i] diff --git a/Task/Concurrent-computing/Nim/concurrent-computing-3.nim b/Task/Concurrent-computing/Nim/concurrent-computing-3.nim new file mode 100644 index 0000000000..3009d246ff --- /dev/null +++ b/Task/Concurrent-computing/Nim/concurrent-computing-3.nim @@ -0,0 +1,9 @@ +import threadpool +const str = ["Enjoy", "Rosetta", "Code"] + +proc f(i) {.thread.} = + echo str[i] + +for i in 0..str.high: + spawn f(i) +sync() diff --git a/Task/Concurrent-computing/Oforth/concurrent-computing-1.oforth b/Task/Concurrent-computing/Oforth/concurrent-computing-1.oforth new file mode 100644 index 0000000000..f11c8e708c --- /dev/null +++ b/Task/Concurrent-computing/Oforth/concurrent-computing-1.oforth @@ -0,0 +1,3 @@ +#[ "Enjoy" println ] & +#[ "Rosetta" println ] & +#[ "Code" println ] & diff --git a/Task/Concurrent-computing/Oforth/concurrent-computing-2.oforth b/Task/Concurrent-computing/Oforth/concurrent-computing-2.oforth new file mode 100644 index 0000000000..413ad45b46 --- /dev/null +++ b/Task/Concurrent-computing/Oforth/concurrent-computing-2.oforth @@ -0,0 +1 @@ +[ "Enjoy", "Rosetta", "Code" ] mapParallel(#[ dup . size ]) diff --git a/Task/Concurrent-computing/Phix/concurrent-computing.phix b/Task/Concurrent-computing/Phix/concurrent-computing.phix new file mode 100644 index 0000000000..792b4f6e90 --- /dev/null +++ b/Task/Concurrent-computing/Phix/concurrent-computing.phix @@ -0,0 +1,15 @@ +procedure echo(string s) + sleep(rand(100)/100) + enter_cs() + puts(1,s) + puts(1,'\n') + leave_cs() +end procedure + +constant threads = {create_thread(routine_id("echo"),{"Enjoy"}), + create_thread(routine_id("echo"),{"Rosetta"}), + create_thread(routine_id("echo"),{"Code"})} + +wait_thread(threads) +puts(1,"done") +{} = wait_key() diff --git a/Task/Concurrent-computing/Sidef/concurrent-computing.sidef b/Task/Concurrent-computing/Sidef/concurrent-computing.sidef new file mode 100644 index 0000000000..d8ab1bbe85 --- /dev/null +++ b/Task/Concurrent-computing/Sidef/concurrent-computing.sidef @@ -0,0 +1,7 @@ +var a = + +a.map{|str| + { Sys.sleep(1.rand) + say str + }.fork +}.map{|thr| thr.wait } diff --git a/Task/Concurrent-computing/Swift/concurrent-computing.swift b/Task/Concurrent-computing/Swift/concurrent-computing.swift new file mode 100644 index 0000000000..b71094608b --- /dev/null +++ b/Task/Concurrent-computing/Swift/concurrent-computing.swift @@ -0,0 +1,11 @@ +import Foundation + +let myList = ["Enjoy", "Rosetta", "Code"] + +for word in myList { + dispatch_async(dispatch_get_global_queue(0, 0)) { + NSLog(word) + } +} + +dispatch_main() diff --git a/Task/Conditional-structures/Apex/conditional-structures-1.apex b/Task/Conditional-structures/Apex/conditional-structures-1.apex new file mode 100644 index 0000000000..e4d060d289 --- /dev/null +++ b/Task/Conditional-structures/Apex/conditional-structures-1.apex @@ -0,0 +1,7 @@ +if (s == 'Hello World') { + foo(); +} else if (s == 'Bye World') { + bar(); +} else { + deusEx(); +} diff --git a/Task/Conditional-structures/Apex/conditional-structures-2.apex b/Task/Conditional-structures/Apex/conditional-structures-2.apex new file mode 100644 index 0000000000..8a64149e62 --- /dev/null +++ b/Task/Conditional-structures/Apex/conditional-structures-2.apex @@ -0,0 +1,3 @@ +if(obj != null && obj.foo()){ + aMethod(); +} diff --git a/Task/Conditional-structures/Apex/conditional-structures-3.apex b/Task/Conditional-structures/Apex/conditional-structures-3.apex new file mode 100644 index 0000000000..5d62f3db30 --- /dev/null +++ b/Task/Conditional-structures/Apex/conditional-structures-3.apex @@ -0,0 +1,3 @@ +if(obj != null & obj.foo()){ + aMethod(); +} diff --git a/Task/Conditional-structures/Apex/conditional-structures-4.apex b/Task/Conditional-structures/Apex/conditional-structures-4.apex new file mode 100644 index 0000000000..8c8aefa03d --- /dev/null +++ b/Task/Conditional-structures/Apex/conditional-structures-4.apex @@ -0,0 +1 @@ +s == 'Hello World' ? foo() : bar(); diff --git a/Task/Conditional-structures/Axe/conditional-structures-1.axe b/Task/Conditional-structures/Axe/conditional-structures-1.axe new file mode 100644 index 0000000000..10ac67c3fd --- /dev/null +++ b/Task/Conditional-structures/Axe/conditional-structures-1.axe @@ -0,0 +1,3 @@ +If 1 + YEP() +End diff --git a/Task/Conditional-structures/Axe/conditional-structures-2.axe b/Task/Conditional-structures/Axe/conditional-structures-2.axe new file mode 100644 index 0000000000..6f79120de5 --- /dev/null +++ b/Task/Conditional-structures/Axe/conditional-structures-2.axe @@ -0,0 +1,3 @@ +!If 1 + NOPE() +End diff --git a/Task/Conditional-structures/Axe/conditional-structures-3.axe b/Task/Conditional-structures/Axe/conditional-structures-3.axe new file mode 100644 index 0000000000..ce98ebf076 --- /dev/null +++ b/Task/Conditional-structures/Axe/conditional-structures-3.axe @@ -0,0 +1,5 @@ +If 1 + YEP() +Else + NOPE() +End diff --git a/Task/Conditional-structures/Axe/conditional-structures-4.axe b/Task/Conditional-structures/Axe/conditional-structures-4.axe new file mode 100644 index 0000000000..8ae41e4f86 --- /dev/null +++ b/Task/Conditional-structures/Axe/conditional-structures-4.axe @@ -0,0 +1,7 @@ +If 1=0 + NOPE() +ElseIf 1=1 + YEP() +Else + NOPE() +End diff --git a/Task/Conditional-structures/Axe/conditional-structures-5.axe b/Task/Conditional-structures/Axe/conditional-structures-5.axe new file mode 100644 index 0000000000..8a04f80972 --- /dev/null +++ b/Task/Conditional-structures/Axe/conditional-structures-5.axe @@ -0,0 +1,7 @@ +If 1=0 + NOPE() +Else!If 1=2 + YEP() +Else + NOPE() +End diff --git a/Task/Conditional-structures/Comal/conditional-structures-1.comal b/Task/Conditional-structures/Comal/conditional-structures-1.comal new file mode 100644 index 0000000000..9c43c67956 --- /dev/null +++ b/Task/Conditional-structures/Comal/conditional-structures-1.comal @@ -0,0 +1 @@ +IF condition THEN PRINT "True" diff --git a/Task/Conditional-structures/Comal/conditional-structures-2.comal b/Task/Conditional-structures/Comal/conditional-structures-2.comal new file mode 100644 index 0000000000..25308acb1e --- /dev/null +++ b/Task/Conditional-structures/Comal/conditional-structures-2.comal @@ -0,0 +1,5 @@ +IF condition THEN + PRINT "True" +ELSE + PRINT "False" +ENDIF diff --git a/Task/Conditional-structures/Comal/conditional-structures-3.comal b/Task/Conditional-structures/Comal/conditional-structures-3.comal new file mode 100644 index 0000000000..65bd455a9c --- /dev/null +++ b/Task/Conditional-structures/Comal/conditional-structures-3.comal @@ -0,0 +1,6 @@ +IF choice=1 THEN + PRINT "One" +ELIF choice=2 THEN + PRINT "Two" +ELSE + Print "None of the above" diff --git a/Task/Conditional-structures/Comal/conditional-structures-4.comal b/Task/Conditional-structures/Comal/conditional-structures-4.comal new file mode 100644 index 0000000000..bf80d50d34 --- /dev/null +++ b/Task/Conditional-structures/Comal/conditional-structures-4.comal @@ -0,0 +1,8 @@ +CASE choice OF +WHEN 1 + PRINT "One" +WHEN 2 + PRINT "Two" +OTHERWISE + PRINT "Some other choice" +ENDCASE diff --git a/Task/Conditional-structures/FreeBASIC/conditional-structures-1.freebasic b/Task/Conditional-structures/FreeBASIC/conditional-structures-1.freebasic new file mode 100644 index 0000000000..7750fb393c --- /dev/null +++ b/Task/Conditional-structures/FreeBASIC/conditional-structures-1.freebasic @@ -0,0 +1,8 @@ +Dim a As Integer = 1 +If a = 1 Then + sub1 +ElseIf a = 2 Then + sub2 +Else + sub3 +End If diff --git a/Task/Conditional-structures/FreeBASIC/conditional-structures-2.freebasic b/Task/Conditional-structures/FreeBASIC/conditional-structures-2.freebasic new file mode 100644 index 0000000000..153217dcc0 --- /dev/null +++ b/Task/Conditional-structures/FreeBASIC/conditional-structures-2.freebasic @@ -0,0 +1,9 @@ +Dim a As Integer = 1 +Select Case a + Case 1 + sub1 + Case 2 + sub2 + Case Else + sub3 +End Select diff --git a/Task/Conditional-structures/FreeBASIC/conditional-structures-3.freebasic b/Task/Conditional-structures/FreeBASIC/conditional-structures-3.freebasic new file mode 100644 index 0000000000..4e76cc7b86 --- /dev/null +++ b/Task/Conditional-structures/FreeBASIC/conditional-structures-3.freebasic @@ -0,0 +1,2 @@ +Dim b As Boolean = True +Dim i As Integer = IIf(b, 1, 2) diff --git a/Task/Conditional-structures/FreeBASIC/conditional-structures-4.freebasic b/Task/Conditional-structures/FreeBASIC/conditional-structures-4.freebasic new file mode 100644 index 0000000000..6dc22ad45b --- /dev/null +++ b/Task/Conditional-structures/FreeBASIC/conditional-structures-4.freebasic @@ -0,0 +1,2 @@ +Dim a As Integer = 1 +On a Goto label1, label2 diff --git a/Task/Conditional-structures/FreeBASIC/conditional-structures-5.freebasic b/Task/Conditional-structures/FreeBASIC/conditional-structures-5.freebasic new file mode 100644 index 0000000000..92c8ffdc15 --- /dev/null +++ b/Task/Conditional-structures/FreeBASIC/conditional-structures-5.freebasic @@ -0,0 +1,2 @@ +Dim b As Boolean = True +If b Goto label diff --git a/Task/Conditional-structures/FreeBASIC/conditional-structures-6.freebasic b/Task/Conditional-structures/FreeBASIC/conditional-structures-6.freebasic new file mode 100644 index 0000000000..328a45cf60 --- /dev/null +++ b/Task/Conditional-structures/FreeBASIC/conditional-structures-6.freebasic @@ -0,0 +1,2 @@ +Dim a As Integer = 1 +On a Gosub label1, label2 diff --git a/Task/Conditional-structures/FreeBASIC/conditional-structures-7.freebasic b/Task/Conditional-structures/FreeBASIC/conditional-structures-7.freebasic new file mode 100644 index 0000000000..15f5b11c3a --- /dev/null +++ b/Task/Conditional-structures/FreeBASIC/conditional-structures-7.freebasic @@ -0,0 +1,8 @@ +#DEFINE WORDSIZE 16 +#IF (WORDSIZE = 16) + ' Do some some 16 bit stuff +#ELSEIF (WORDSIZE = 32) + ' Do some some 32 bit stuff +#ELSE + #ERROR WORDSIZE must be set to 16 or 32 +#ENDIF diff --git a/Task/Conditional-structures/FreeBASIC/conditional-structures-8.freebasic b/Task/Conditional-structures/FreeBASIC/conditional-structures-8.freebasic new file mode 100644 index 0000000000..4bc30ca612 --- /dev/null +++ b/Task/Conditional-structures/FreeBASIC/conditional-structures-8.freebasic @@ -0,0 +1,4 @@ +#DEFINE _DEBUG +#IFDEF _DEBUG + ' Special statements for debugging +#ENDIF diff --git a/Task/Conditional-structures/FreeBASIC/conditional-structures-9.freebasic b/Task/Conditional-structures/FreeBASIC/conditional-structures-9.freebasic new file mode 100644 index 0000000000..6694373c4e --- /dev/null +++ b/Task/Conditional-structures/FreeBASIC/conditional-structures-9.freebasic @@ -0,0 +1,3 @@ +#IFNDEF _DEBUG + #DEFINE _DEBUG +#ENDIF diff --git a/Task/Conditional-structures/Futhark/conditional-structures.futhark b/Task/Conditional-structures/Futhark/conditional-structures.futhark new file mode 100644 index 0000000000..2955aa1dd9 --- /dev/null +++ b/Task/Conditional-structures/Futhark/conditional-structures.futhark @@ -0,0 +1 @@ +if then else diff --git a/Task/Conditional-structures/HPPPL/conditional-structures-1.hpppl b/Task/Conditional-structures/HPPPL/conditional-structures-1.hpppl new file mode 100644 index 0000000000..76d2ea7f6e --- /dev/null +++ b/Task/Conditional-structures/HPPPL/conditional-structures-1.hpppl @@ -0,0 +1,5 @@ +IF X THEN + // do if X is not 0 +ELSE + // do if X is 0 +END; diff --git a/Task/Conditional-structures/HPPPL/conditional-structures-2.hpppl b/Task/Conditional-structures/HPPPL/conditional-structures-2.hpppl new file mode 100644 index 0000000000..b4f760eb59 --- /dev/null +++ b/Task/Conditional-structures/HPPPL/conditional-structures-2.hpppl @@ -0,0 +1,13 @@ +CASE + IF X == 1 THEN + // do stuff if X equals 1 + END + IF X == 2 THEN + // do stuff if X equals 1 + END + IF X == 3 THEN + // do stuff if X equals 3 + END + DEFAULT + // do other stuff +END; diff --git a/Task/Conditional-structures/Harbour/conditional-structures-1.harbour b/Task/Conditional-structures/Harbour/conditional-structures-1.harbour new file mode 100644 index 0000000000..2467ab3e84 --- /dev/null +++ b/Task/Conditional-structures/Harbour/conditional-structures-1.harbour @@ -0,0 +1,7 @@ +IF x == 1 + SomeFunc1() +ELSEIF x == 2 + SomeFunc2() +ELSE + SomeFunc() +ENDIF diff --git a/Task/Conditional-structures/Harbour/conditional-structures-2.harbour b/Task/Conditional-structures/Harbour/conditional-structures-2.harbour new file mode 100644 index 0000000000..dba421ce73 --- /dev/null +++ b/Task/Conditional-structures/Harbour/conditional-structures-2.harbour @@ -0,0 +1,8 @@ +DO CASE +CASE x == 1 + SomeFunc1() +CASE x == 2 + SomeFunc2() +OTHERWISE + SomeFunc() +ENDCASE diff --git a/Task/Conditional-structures/Harbour/conditional-structures-3.harbour b/Task/Conditional-structures/Harbour/conditional-structures-3.harbour new file mode 100644 index 0000000000..c8f9f80438 --- /dev/null +++ b/Task/Conditional-structures/Harbour/conditional-structures-3.harbour @@ -0,0 +1,10 @@ +SWITCH x +CASE 1 + SomeFunc1() + EXIT +CASE 2 + SomeFunc2() + EXIT +OTHERWISE + SomeFunc() +ENDSWITCH diff --git a/Task/Conditional-structures/I/conditional-structures.i b/Task/Conditional-structures/I/conditional-structures.i new file mode 100644 index 0000000000..c194a5045b --- /dev/null +++ b/Task/Conditional-structures/I/conditional-structures.i @@ -0,0 +1,20 @@ +software { + var a = 3 + + //This is not guaranteed to be quicker than a if-else chain. + switch a { + case 3 + print("3=3") + case 2 + print("WHAT?") + default + print("3!=2") + } + + if a != 2 + print("3!=2") + print("verified") + else + print("3=2!!!") + end +} diff --git a/Task/Conditional-structures/LC3-Assembly/conditional-structures-1.lc3 b/Task/Conditional-structures/LC3-Assembly/conditional-structures-1.lc3 new file mode 100644 index 0000000000..c6aaf7f218 --- /dev/null +++ b/Task/Conditional-structures/LC3-Assembly/conditional-structures-1.lc3 @@ -0,0 +1,10 @@ +BR or BRnzp ; unconditional branch, i.e. + ; branch if (result < 0 || result == 0 || result > 0) + ; ^ this is always true + +BRn ; branch if (result < 0) +BRz ; branch if (result == 0) +BRp ; branch if (result > 0) + + ; or any combination of these condition codes, e.g. +BRnz ; branch if (result <= 0) diff --git a/Task/Conditional-structures/LC3-Assembly/conditional-structures-2.lc3 b/Task/Conditional-structures/LC3-Assembly/conditional-structures-2.lc3 new file mode 100644 index 0000000000..33043b5d49 --- /dev/null +++ b/Task/Conditional-structures/LC3-Assembly/conditional-structures-2.lc3 @@ -0,0 +1,19 @@ +.orig x3000 +LD R1, x ; get x +LD R2, y ; get y +NOT R0, R2 ; R0 = ~y +ADD R0, R0, 1 ; R0 = -y +ADD R0, R0, R1 ; R0 = x - y +BRZ BRANCH ; if (x == y) { go to BRANCH } +LEA R0, nottaken +PUTS ; else print "Branch Not Taken!" +BR END +BRANCH +LEA R0, taken +PUTS ; print "Branch Taken!" +END HALT +x .fill 1 +y .fill 1 +taken .stringz "Branch Taken!" +nottaken .stringz "Branch Not Taken!" +.end diff --git a/Task/Conditional-structures/Monicelli/conditional-structures.monicelli b/Task/Conditional-structures/Monicelli/conditional-structures.monicelli new file mode 100644 index 0000000000..f00b9c495b --- /dev/null +++ b/Task/Conditional-structures/Monicelli/conditional-structures.monicelli @@ -0,0 +1,8 @@ +che cosè var? # switch var + minore di 0: # case var < 0 + ... + maggiore di 0: # case var > 0 + ... + o tarapia tapioco: # else (none of the previous cases) + ... +e velocità di esecuzione diff --git a/Task/Conditional-structures/Morfa/conditional-structures-1.morfa b/Task/Conditional-structures/Morfa/conditional-structures-1.morfa new file mode 100644 index 0000000000..0c4267e7d8 --- /dev/null +++ b/Task/Conditional-structures/Morfa/conditional-structures-1.morfa @@ -0,0 +1,10 @@ +if(s == "Hello World") +{ + foo(); +} +else if(s == "Bye World") + bar(); +else +{ + baz(); +} diff --git a/Task/Conditional-structures/Morfa/conditional-structures-2.morfa b/Task/Conditional-structures/Morfa/conditional-structures-2.morfa new file mode 100644 index 0000000000..a5ace0017e --- /dev/null +++ b/Task/Conditional-structures/Morfa/conditional-structures-2.morfa @@ -0,0 +1,2 @@ +if(obj isnt null and obj.foo()) + doSomething(); diff --git a/Task/Conditional-structures/Morfa/conditional-structures-3.morfa b/Task/Conditional-structures/Morfa/conditional-structures-3.morfa new file mode 100644 index 0000000000..35313296e4 --- /dev/null +++ b/Task/Conditional-structures/Morfa/conditional-structures-3.morfa @@ -0,0 +1 @@ +var t = if(s == "Hello World") foo() else bar(); diff --git a/Task/Conditional-structures/Morfa/conditional-structures-4.morfa b/Task/Conditional-structures/Morfa/conditional-structures-4.morfa new file mode 100644 index 0000000000..762694ccfb --- /dev/null +++ b/Task/Conditional-structures/Morfa/conditional-structures-4.morfa @@ -0,0 +1,11 @@ +switch (num) + { + case (0) + { /* empty case requires braces */ } + case (1) + { var one = "one"; result = one; } + case (2,3) // case may contain a nonempty list of values + result = "a few"; + default + result = "a lot"; + } diff --git a/Task/Conditional-structures/Nim/conditional-structures-1.nim b/Task/Conditional-structures/Nim/conditional-structures-1.nim new file mode 100644 index 0000000000..bf68ba6cd5 --- /dev/null +++ b/Task/Conditional-structures/Nim/conditional-structures-1.nim @@ -0,0 +1,8 @@ +if x == 0: + foo() +elif x == 1: + bar() +elif x == 2: + baz() +else: + boz() diff --git a/Task/Conditional-structures/Nim/conditional-structures-2.nim b/Task/Conditional-structures/Nim/conditional-structures-2.nim new file mode 100644 index 0000000000..1884aef0df --- /dev/null +++ b/Task/Conditional-structures/Nim/conditional-structures-2.nim @@ -0,0 +1,9 @@ +case x +of 0: + foo() +of 2,5,9: + baz() +of 10..20, 40..50: + baz() +else: # All cases must be covered + boz() diff --git a/Task/Conditional-structures/Oforth/conditional-structures-1.oforth b/Task/Conditional-structures/Oforth/conditional-structures-1.oforth new file mode 100644 index 0000000000..013e10e8a0 --- /dev/null +++ b/Task/Conditional-structures/Oforth/conditional-structures-1.oforth @@ -0,0 +1,5 @@ +aBoolean ifTrue: [ ...] +aBoolean ifFalse: [ ... ] +aObject ifNull: [ ... ] +aObject ifNotNull: [ ... ] +aObject ifZero: [ ... ] diff --git a/Task/Conditional-structures/Oforth/conditional-structures-2.oforth b/Task/Conditional-structures/Oforth/conditional-structures-2.oforth new file mode 100644 index 0000000000..8631ba20bf --- /dev/null +++ b/Task/Conditional-structures/Oforth/conditional-structures-2.oforth @@ -0,0 +1 @@ +else: [ ... ] diff --git a/Task/Conditional-structures/Oforth/conditional-structures-3.oforth b/Task/Conditional-structures/Oforth/conditional-structures-3.oforth new file mode 100644 index 0000000000..5e7b1de97d --- /dev/null +++ b/Task/Conditional-structures/Oforth/conditional-structures-3.oforth @@ -0,0 +1,4 @@ +Number virtual: sgn + self isPositive + ifTrue: [ self ==0 ifTrue: [ 0 ] else: [ 1 ] ] + else: [ -1 ] ; diff --git a/Task/Conditional-structures/PHL/conditional-structures.phl b/Task/Conditional-structures/PHL/conditional-structures.phl new file mode 100644 index 0000000000..f766749bfe --- /dev/null +++ b/Task/Conditional-structures/PHL/conditional-structures.phl @@ -0,0 +1,8 @@ +var a = 5; +if (a == 5) { + doSomething(); +} else if (a > 0) { + doSomethingElse(); +} else { + error(); +} diff --git a/Task/Conditional-structures/Ring/conditional-structures-1.ring b/Task/Conditional-structures/Ring/conditional-structures-1.ring new file mode 100644 index 0000000000..13dcfddd29 --- /dev/null +++ b/Task/Conditional-structures/Ring/conditional-structures-1.ring @@ -0,0 +1,7 @@ +If x == 1 + SomeFunc1() +But x == 2 + SomeFunc2() +Else + SomeFunc() +Ok diff --git a/Task/Conditional-structures/Ring/conditional-structures-2.ring b/Task/Conditional-structures/Ring/conditional-structures-2.ring new file mode 100644 index 0000000000..1a4666d501 --- /dev/null +++ b/Task/Conditional-structures/Ring/conditional-structures-2.ring @@ -0,0 +1,8 @@ +Switch x +On 1 + SomeFunc1() +On 2 + SomeFunc2() +Other + SomeFunc() +Off diff --git a/Task/Conditional-structures/SSEM/conditional-structures.ssem b/Task/Conditional-structures/SSEM/conditional-structures.ssem new file mode 100644 index 0000000000..81e7ee2676 --- /dev/null +++ b/Task/Conditional-structures/SSEM/conditional-structures.ssem @@ -0,0 +1,3 @@ +01010000000000100000000000000000 -10 to c +00000000000000110000000000000000 Test +01110000000000000000000000000000 14 to CI diff --git a/Task/Conditional-structures/jq/conditional-structures-1.jq b/Task/Conditional-structures/jq/conditional-structures-1.jq new file mode 100644 index 0000000000..a6d1047e64 --- /dev/null +++ b/Task/Conditional-structures/jq/conditional-structures-1.jq @@ -0,0 +1 @@ +if cond then f else g end diff --git a/Task/Conditional-structures/jq/conditional-structures-2.jq b/Task/Conditional-structures/jq/conditional-structures-2.jq new file mode 100644 index 0000000000..79ba1a8bde --- /dev/null +++ b/Task/Conditional-structures/jq/conditional-structures-2.jq @@ -0,0 +1 @@ +if cond then f elif cond1 then f1 .... else g end diff --git a/Task/Conditional-structures/jq/conditional-structures-3.jq b/Task/Conditional-structures/jq/conditional-structures-3.jq new file mode 100644 index 0000000000..1a14701f1a --- /dev/null +++ b/Task/Conditional-structures/jq/conditional-structures-3.jq @@ -0,0 +1,4 @@ +if empty then 2 else 3 end # produces no value +if 1 then 2 else 3 end # produces 2 +if [false, false] then 2 else 3 end # produces 2 +if (true, true) then 2 else 3 end # produces a stream: 2, 2 diff --git a/Task/Conditional-structures/jq/conditional-structures-4.jq b/Task/Conditional-structures/jq/conditional-structures-4.jq new file mode 100644 index 0000000000..5cd564d4e1 --- /dev/null +++ b/Task/Conditional-structures/jq/conditional-structures-4.jq @@ -0,0 +1,7 @@ +exp + | if . == true then "true" + elif . == false then "false" + elif . == null then "maybe" + elif type == "string" then . + else error("unexpected value: \(.)") + end diff --git a/Task/Conjugate-transpose/Sparkling/conjugate-transpose.sparkling b/Task/Conjugate-transpose/Sparkling/conjugate-transpose.sparkling new file mode 100644 index 0000000000..f9ce09e2c3 --- /dev/null +++ b/Task/Conjugate-transpose/Sparkling/conjugate-transpose.sparkling @@ -0,0 +1,101 @@ +# Computes conjugate transpose of M +let conjTransp = function conjTransp(M) { + return map(range(sizeof M[0]), function(row) { + return map(range(sizeof M), function(col) { + return cplx_conj(M[col][row]); + }); + }); +}; + +# Helper for cplxMatMul +let cplxVecScalarMul = function cplxVecScalarMul(A, B, row, col) { + var M = { "re": 0.0, "im": 0.0 }; + let N = sizeof A; + for (var i = 0; i < N; i++) { + let P = cplx_mul(A[row][i], B[i][col]); + M = cplx_add(M, P); + } + return M; +}; + +# Multiplies matrices A and B +# A and B are assumed to be square and of the same size, +# this condition is not checked. +let cplxMatMul = function cplxMatMul(A, B) { + var R = {}; + let N = sizeof A; + for (var row = 0; row < N; row++) { + R[row] = {}; + for (var col = 0; col < N; col++) { + R[row][col] = cplxVecScalarMul(A, B, row, col); + } + } + return R; +}; + +# Helper for creating an array representing a complex number +# given its textual representation +let _ = function makeComplex(str) { + let sep = indexof(str, "+", 1); + if sep < 0 { + sep = indexof(str, "-", 1); + } + let reStr = substrto(str, sep); + let imStr = substrfrom(str, sep); + return { "re": tofloat(reStr), "im": tofloat(imStr) }; +}; + +# Formats a complex matrix +let printCplxMat = function printCplxMat(M) { + foreach(M, function(i, row) { + foreach(row, function(j, elem) { + printf(" %.2f%+.2fi", elem.re, elem.im); + }); + print(); + }); +}; + +# A Hermitian matrix +let H = { + { _("3+0i"), _("2+1i") }, + { _("2-1i"), _("0+0i") } +}; + +# A normal matrix +let N = { + { _("1+0i"), _("1+0i"), _("0+0i") }, + { _("0+0i"), _("1+0i"), _("1+0i") }, + { _("1+0i"), _("0+0i"), _("1+0i") } +}; + +# A unitary matrix +let U = { + { _("0.70710678118+0i"), _("0.70710678118+0i"), _("0+0i") }, + { _("0-0.70710678118i"), _("0+0.70710678118i"), _("0+0i") }, + { _("0+0i"), _("0+0i"), _("0+1i") } +}; + + +print("Hermitian matrix:\nH = "); +printCplxMat(H); +print("H* = "); +printCplxMat(conjTransp(H)); +print(); + +print("Normal matrix:\nN = "); +printCplxMat(N); +print("N* = "); +printCplxMat(conjTransp(N)); +print("N* x N = "); +printCplxMat(cplxMatMul(conjTransp(N), N)); +print("N x N* = "); +printCplxMat(cplxMatMul(N, conjTransp(N))); +print(); + +print("Unitary matrix:\nU = "); +printCplxMat(U); +print("U* = "); +printCplxMat(conjTransp(U)); +print("U x U* = "); +printCplxMat(cplxMatMul(U, conjTransp(U))); +print(); diff --git a/Task/Conjugate-transpose/jq/conjugate-transpose-1.jq b/Task/Conjugate-transpose/jq/conjugate-transpose-1.jq new file mode 100644 index 0000000000..7be65357e3 --- /dev/null +++ b/Task/Conjugate-transpose/jq/conjugate-transpose-1.jq @@ -0,0 +1,6 @@ +# transpose/0 expects its input to be a rectangular matrix +# (an array of equal-length arrays): +def transpose: + if (.[0] | length) == 0 then [] + else [map(.[0])] + (map(.[1:]) | transpose) + end ; diff --git a/Task/Conjugate-transpose/jq/conjugate-transpose-2.jq b/Task/Conjugate-transpose/jq/conjugate-transpose-2.jq new file mode 100644 index 0000000000..13ac963d91 --- /dev/null +++ b/Task/Conjugate-transpose/jq/conjugate-transpose-2.jq @@ -0,0 +1,27 @@ +# x must be real or complex, and ditto for y; +# always return complex +def plus(x; y): + if (x|type) == "number" then + if (y|type) == "number" then [ x+y, 0 ] + else [ x + y[0], y[1]] + end + elif (y|type) == "number" then plus(y;x) + else [ x[0] + y[0], x[1] + y[1] ] + end; + +# x must be real or complex, and ditto for y; +# always return complex +def multiply(x; y): + if (x|type) == "number" then + if (y|type) == "number" then [ x*y, 0 ] + else [x * y[0], x * y[1]] + end + elif (y|type) == "number" then multiply(y;x) + else [ x[0] * y[0] - x[1] * y[1], x[0] * y[1] + x[1] * y[0]] + end; + +# conjugate of a real or complex number +def conjugate: + if type == "number" then [.,0] + else [.[0], -(.[1]) ] + end; diff --git a/Task/Conjugate-transpose/jq/conjugate-transpose-3.jq b/Task/Conjugate-transpose/jq/conjugate-transpose-3.jq new file mode 100644 index 0000000000..5b8a4367ca --- /dev/null +++ b/Task/Conjugate-transpose/jq/conjugate-transpose-3.jq @@ -0,0 +1,5 @@ +# a and b are arrays of real/complex numbers +def dot_product(a; b): + a as $a | b as $b + | reduce range(0;$a|length) as $i + (0; . as $s | plus($s; multiply($a[$i]; $b[$i]) )); diff --git a/Task/Conjugate-transpose/jq/conjugate-transpose-4.jq b/Task/Conjugate-transpose/jq/conjugate-transpose-4.jq new file mode 100644 index 0000000000..677cc866a7 --- /dev/null +++ b/Task/Conjugate-transpose/jq/conjugate-transpose-4.jq @@ -0,0 +1,38 @@ +# convert a matrix of mixed real/complex entries to all complex entries +def to_complex: + def toc: if type == "number" then [.,0] else . end; + map( map(toc) ); + +# simple matrix pretty-printer +def pp(wide): + def pad: tostring | (wide - length) * " " + .; + def row: reduce .[] as $x (""; . + ($x|pad)); + reduce .[] as $row (""; . + "\n\($row|row)"); + +# Matrix multiplication +# A and B should both be real/complex matrices, +# A being m by n, and B being n by p. +def matrix_multiply(A; B): + A as $A | B as $B + | ($B[0]|length) as $p + | ($B|transpose) as $BT + | reduce range(0; $A|length) as $i + ([]; reduce range(0; $p) as $j + (.; .[$i][$j] = dot_product( $A[$i]; $BT[$j] ) )) ; + +# Complex identity matrix of dimension n +def complex_identity(n): + def indicator(i;n): [range(0;n)] | map( [0,0]) | .[i] = [1,0]; + reduce range(0; n) as $i ([]; . + [indicator( $i; n )] ); + +# Approximate equality of two matrices +# Are two real/complex matrices essentially equal +# in the sense that the sum of the squared element-wise differences +# is less than or equal to epsilon? +# The two matrices must be conformal. +def approximately_equal(M; N; epsilon): + def norm: multiply(. ; conjugate ) | .[0]; + def sqdiff( x; y): plus(x; multiply(y; -1)) | norm; + reduce range(0;M|length) as $i + (0; reduce range(0; M[0]|length) as $j + (.; 0 + sqdiff( M[$i][$j]; N[$i][$j] ) ) ) <= epsilon; diff --git a/Task/Conjugate-transpose/jq/conjugate-transpose-5.jq b/Task/Conjugate-transpose/jq/conjugate-transpose-5.jq new file mode 100644 index 0000000000..0bc0d2bf62 --- /dev/null +++ b/Task/Conjugate-transpose/jq/conjugate-transpose-5.jq @@ -0,0 +1,23 @@ +# (entries may be real and/or complex) +def conjugate_transpose: + map( map(conjugate) ) | transpose; + +# A Hermitian matrix equals its own conjugate transpose +def is_hermitian: + to_complex == conjugate_transpose; + +# A matrix is normal if it commutes multiplicatively +# with its conjugate transpose +def is_normal: + . as $M + | conjugate_transpose as $H + | matrix_multiply($H; $M) == matrix_multiply($H; $M); + +# A unitary matrix (U) has its inverse equal to its conjugate transpose (T) +# i.e. U^-1 == T; NASC is I == UT == TU +def is_unitary: + . as $M + | conjugate_transpose as $H + | complex_identity(length) as $I + | approximately_equal( $I; matrix_multiply($H;$M); 1e-10) + and approximately_equal( $I ; matrix_multiply($M;$H); 1e-10) ; diff --git a/Task/Conjugate-transpose/jq/conjugate-transpose-6.jq b/Task/Conjugate-transpose/jq/conjugate-transpose-6.jq new file mode 100644 index 0000000000..8560de7cc2 --- /dev/null +++ b/Task/Conjugate-transpose/jq/conjugate-transpose-6.jq @@ -0,0 +1,29 @@ +def hermitian_example: + [ [ 3, [2,1]], + [[2,-1], 1 ] ]; + +def normal_example: + [ [1, 1, 0], + [0, 1, 1], + [1, 0, 1] ]; + +def unitary_example: + 0.707107 + | [ [ [., 0], [., 0], 0 ], + [ [0, -.], [0, .], 0 ], + [ 0, 0, [0,1] ] ]; + +def demo: + hermitian_example + | ("Hermitian example:", pp(8)), + "", + ("Its conjugate transpose is:", (to_complex | conjugate_transpose | pp(8))), + "", + "Hermitian example: \(hermitian_example | is_hermitian )", + "", + "Normal example: \(normal_example | is_normal )", + "", + "Unitary example: \(unitary_example | is_unitary)" +; + +demo diff --git a/Task/Conjugate-transpose/jq/conjugate-transpose-7.jq b/Task/Conjugate-transpose/jq/conjugate-transpose-7.jq new file mode 100644 index 0000000000..28d4ccd090 --- /dev/null +++ b/Task/Conjugate-transpose/jq/conjugate-transpose-7.jq @@ -0,0 +1,16 @@ +$ jq -r -c -n -f Conjugate_transpose.jq +Hermitian example: + + 3 [2,1] + [2,-1] 1 + +Conjugate transpose: + + [3,-0] [2,1] + [2,-1] [1,-0] + +Hermitian example: true + +Normal example: true + +Unitary example: true diff --git a/Task/Constrained-genericity/Morfa/constrained-genericity-1.morfa b/Task/Constrained-genericity/Morfa/constrained-genericity-1.morfa new file mode 100644 index 0000000000..06c3778379 --- /dev/null +++ b/Task/Constrained-genericity/Morfa/constrained-genericity-1.morfa @@ -0,0 +1,27 @@ +import morfa.type.traits; + +template < T > +alias IsEdible = HasMember< T, "eat" >; + +template < T > +if (IsEdible< T >) +struct FoodBox +{ + var food: T[]; +} + +struct Carrot +{ + func eat(): void {} +} + +struct Car {} + +func main(): void +{ + var carrotBox: FoodBox< Carrot >; // OK + carrotBox.food ~= Carrot(); // Adds a carrot + + // var carBox: FoodBox< Car >; // Not allowed + static assert( not trait(compiles, func() { var carBox: FoodBox< Car >; } )); +} diff --git a/Task/Constrained-genericity/Morfa/constrained-genericity-2.morfa b/Task/Constrained-genericity/Morfa/constrained-genericity-2.morfa new file mode 100644 index 0000000000..5361744417 --- /dev/null +++ b/Task/Constrained-genericity/Morfa/constrained-genericity-2.morfa @@ -0,0 +1,26 @@ +interface IEdible +{ + public func eat(): void; +} + +template < T > +if (IsDerivedOf< T, IEdible >) +struct FoodBox +{ + var food: T[]; +} + +class Carrot: IEdible +{ + public override func eat(): void {} +} + +class Car {} + +func main(): void +{ + var carrotBox: FoodBox< Carrot >; // OK + + // var carBox: FoodBox< Car >; // Not allowed + static assert( not trait(compiles, func() { var carBox: FoodBox< Car >; } )); +} diff --git a/Task/Constrained-genericity/Nim/constrained-genericity.nim b/Task/Constrained-genericity/Nim/constrained-genericity.nim new file mode 100644 index 0000000000..ae6dc252b6 --- /dev/null +++ b/Task/Constrained-genericity/Nim/constrained-genericity.nim @@ -0,0 +1,21 @@ +type + Eatable = generic e + eat(e) + + FoodBox[e: Eatable] = seq[e] + + Food = object + name: string + count: int + +proc eat(x: int) = echo "Eating the int: ", x +proc eat(x: Food) = echo "Eating ", x.count, " ", x.name, "s" + +var ints = FoodBox[int](@[1,2,3,4,5]) +var fs = FoodBox[Food](@[]) + +fs.add Food(name: "Hamburger", count: 3) +fs.add Food(name: "Cheeseburger", count: 5) + +for f in fs: + eat(f) diff --git a/Task/Constrained-genericity/Sidef/constrained-genericity.sidef b/Task/Constrained-genericity/Sidef/constrained-genericity.sidef new file mode 100644 index 0000000000..5dcad51ac9 --- /dev/null +++ b/Task/Constrained-genericity/Sidef/constrained-genericity.sidef @@ -0,0 +1,7 @@ +class FoodBox(*food { .all { .respond_to(:eat) } }) { } + +class Fruit { method eat { ... } } +class Apple < Fruit { } + +say FoodBox(Fruit(), Apple()).dump #=> FoodBox(food: [Fruit(), Apple()]) +say FoodBox(Apple(), "foo") #!> ERROR: class `FoodBox` !~ (Apple, String) diff --git a/Task/Constrained-genericity/Swift/constrained-genericity-1.swift b/Task/Constrained-genericity/Swift/constrained-genericity-1.swift new file mode 100644 index 0000000000..0804e77c14 --- /dev/null +++ b/Task/Constrained-genericity/Swift/constrained-genericity-1.swift @@ -0,0 +1,3 @@ +protocol Eatable { + func eat() +} diff --git a/Task/Constrained-genericity/Swift/constrained-genericity-2.swift b/Task/Constrained-genericity/Swift/constrained-genericity-2.swift new file mode 100644 index 0000000000..68408f1bd1 --- /dev/null +++ b/Task/Constrained-genericity/Swift/constrained-genericity-2.swift @@ -0,0 +1,3 @@ +struct FoodBox { + var food: [T] +} diff --git a/Task/Constrained-genericity/Swift/constrained-genericity-3.swift b/Task/Constrained-genericity/Swift/constrained-genericity-3.swift new file mode 100644 index 0000000000..7cd86a4ea0 --- /dev/null +++ b/Task/Constrained-genericity/Swift/constrained-genericity-3.swift @@ -0,0 +1,2 @@ +func foo(x: T) { } +// although in this case this is no more useful than just "func foo(x: Eatable)" diff --git a/Task/Constrained-random-points-on-a-circle/EchoLisp/constrained-random-points-on-a-circle.echolisp b/Task/Constrained-random-points-on-a-circle/EchoLisp/constrained-random-points-on-a-circle.echolisp new file mode 100644 index 0000000000..257184cc93 --- /dev/null +++ b/Task/Constrained-random-points-on-a-circle/EchoLisp/constrained-random-points-on-a-circle.echolisp @@ -0,0 +1,16 @@ +(lib 'math) +(lib 'plot) + +(define (points (n 100) (radius 10) (rmin 10) (rmax 15) (x) (y)) + (plot-clear) + (plot-x-minmax (- rmax)) + (plot-y-minmax( - rmax)) + + (for [(i n)] + (set! x (round (* (random -1) rmax))) + (set! y (round (* (random -1) rmax))) + #:when (in-interval? (pythagore x y) rmin rmax) + ;; add a little bit of randomness : dots color and radius + (plot-fill-color (hsv->rgb (random) 0.9 0.9)) + (plot-circle x y (random radius))) + (plot-edit)) diff --git a/Task/Constrained-random-points-on-a-circle/Hy/constrained-random-points-on-a-circle.hy b/Task/Constrained-random-points-on-a-circle/Hy/constrained-random-points-on-a-circle.hy new file mode 100644 index 0000000000..36f84bd4bd --- /dev/null +++ b/Task/Constrained-random-points-on-a-circle/Hy/constrained-random-points-on-a-circle.hy @@ -0,0 +1,13 @@ +(import + [math [sqrt]] + [random [choice]] + [matplotlib.pyplot :as plt]) + +(setv possible-points (list-comp (, x y) + [x (range -15 16) y (range -15 16)] + (<= 10 (sqrt (+ (** x 2) (** y 2))) 15))) + +(setv [xs ys] (apply zip (list-comp (choice possible-points) [_ (range 100)]))) + ; We can't use random.sample because that samples without replacement. +(plt.plot xs ys "bo") +(plt.show) diff --git a/Task/Constrained-random-points-on-a-circle/Nim/constrained-random-points-on-a-circle.nim b/Task/Constrained-random-points-on-a-circle/Nim/constrained-random-points-on-a-circle.nim new file mode 100644 index 0000000000..ab8cd71ec3 --- /dev/null +++ b/Task/Constrained-random-points-on-a-circle/Nim/constrained-random-points-on-a-circle.nim @@ -0,0 +1,25 @@ +import tables, math, strutils, complex +randomize() + +proc random[T](a: openarray[T]): T = + result = a[random(low(a)..len(a))] + +type Point = tuple[x, y: int] + +var world = initCountTable[Point]() + +var possiblePoints = newSeq[Point]() +for x in -15..15: + for y in -15..15: + if abs((x.float, y.float)) in 10.0..15.0: + possiblePoints.add((x,y)) + +for i in 0..100: world.inc possiblePoints.random + +for x in -15..15: + for y in -15..15: + if world[(x,y)] > 0: + stdout.write min(9, world[(x,y)]) + else: + stdout.write ' ' + echo "" diff --git a/Task/Constrained-random-points-on-a-circle/Phix/constrained-random-points-on-a-circle.phix b/Task/Constrained-random-points-on-a-circle/Phix/constrained-random-points-on-a-circle.phix new file mode 100644 index 0000000000..461e4a53f0 --- /dev/null +++ b/Task/Constrained-random-points-on-a-circle/Phix/constrained-random-points-on-a-circle.phix @@ -0,0 +1,14 @@ +sequence screen = repeat(repeat(' ',31),31) +integer x, y, count = 0 +atom r +while 1 do + x = rand(31) + y = rand(31) + r = sqrt(power(x-16,2)+power(y-16,2)) + if r>=10 and r<=15 then + screen[x][y] = 'x' + count += 1 + if count>=100 then exit end if + end if +end while +puts(1,join(screen,"\n")) diff --git a/Task/Constrained-random-points-on-a-circle/Ring/constrained-random-points-on-a-circle.ring b/Task/Constrained-random-points-on-a-circle/Ring/constrained-random-points-on-a-circle.ring new file mode 100644 index 0000000000..54df5c030c --- /dev/null +++ b/Task/Constrained-random-points-on-a-circle/Ring/constrained-random-points-on-a-circle.ring @@ -0,0 +1,44 @@ +load "guilib.ring" + +new qapp + { + win1 = new qwidget() { + setwindowtitle("drawing using qpainter") + setgeometry(100,100,500,500) + label1 = new qlabel(win1) { + setgeometry(10,10,400,400) + settext("") + } + new qpushbutton(win1) { + setgeometry(200,400,100,30) + settext("draw") + setclickevent("draw()") + } + show() + } + exec() + } + +func draw + p1 = new qpicture() + color = new qcolor() { + setrgb(0,0,255,255) + } + pen = new qpen() { + setcolor(color) + setwidth(1) + } + new qpainter() { + begin(p1) + setpen(pen) + + for i = 1 to 1000 + x = random(31)-16 + y = random(31)-16 + r = sqrt (pow(x,2) + pow(y,2)) + if r >= 10 if r <= 15 drawpoint(x*2, y*2) ok ok + next + + endpaint() + } + label1 { setpicture(p1) show() } diff --git a/Task/Constrained-random-points-on-a-circle/Sidef/constrained-random-points-on-a-circle.sidef b/Task/Constrained-random-points-on-a-circle/Sidef/constrained-random-points-on-a-circle.sidef new file mode 100644 index 0000000000..cd0f8815e7 --- /dev/null +++ b/Task/Constrained-random-points-on-a-circle/Sidef/constrained-random-points-on-a-circle.sidef @@ -0,0 +1,23 @@ +var points = []; +while (points.len < 100) { + var (x, y) = 2.of{31.rand.int - 15}...; + var r2 = (x**2 + y**2); + if ((r2 >= 100) && (r2 <= 225)) { + points.append([x, y]); + } +} + +print <<'HEAD'; +%!PS-Adobe-3.0 EPSF-3.0 +%%BoundingBox 0 0 400 400 +200 200 translate 10 10 scale +0 setlinewidth +1 0 0 setrgbcolor +0 0 10 0 360 arc stroke +0 0 15 360 0 arcn stroke +0 setgray +/pt { .1 0 360 arc fill } def +HEAD + +points.each { |pt| say "#{pt.join(' ')} pt" }; +print '%%EOF'; diff --git a/Task/Continued-fraction-Arithmetic-Construct-from-rational-number/Sidef/continued-fraction-arithmetic-construct-from-rational-number.sidef b/Task/Continued-fraction-Arithmetic-Construct-from-rational-number/Sidef/continued-fraction-arithmetic-construct-from-rational-number.sidef new file mode 100644 index 0000000000..5cdc61beb9 --- /dev/null +++ b/Task/Continued-fraction-Arithmetic-Construct-from-rational-number/Sidef/continued-fraction-arithmetic-construct-from-rational-number.sidef @@ -0,0 +1,25 @@ +func r2cf(num, den) { + func() { + den.is_zero && return() + var q = int(num/den) + (num, den) = (den, num - q*den) + return q + } +} + +func showcf(f) { + print "[" + var n = f() + print "#{n}" if defined(n) + print "; #{n}" while defined(n = f()) + print "]\n" +} + +[ + [1/2, 3/1, 23/8, 13/11, 22/7, -151/77], + [14142/10000, 141421/100000, 1414214/1000000, 14142136/10000000], + [314285714/100000000], +].each { |seq| + seq.each { |r| showcf(r2cf(r.parts)) } + print "\n" +} diff --git a/Task/Continued-fraction/Sidef/continued-fraction.sidef b/Task/Continued-fraction/Sidef/continued-fraction.sidef new file mode 100644 index 0000000000..b259a19fa1 --- /dev/null +++ b/Task/Continued-fraction/Sidef/continued-fraction.sidef @@ -0,0 +1,29 @@ +func continued_fraction(a, _, (0)) { a() } +func continued_fraction(a, b, n=100) { + a() + (b() / continued_fraction(a, b, n-1)); +} + +var f = Hash.new( + "√2" => [ + do { var n = 0; { n++ ? 2 : 1 } }, + { 1 }, + ], + "e" => [ + do { var n = 0; { n++ || 2 } }, + do { var n = 0; { n++ || 1 } }, + ], + "π" => [ + do { var n = 0; { n++ ? 6 : 3 } }, + do { var n = 0; { (2*(n++) + 1)**2 } }, + 1_000, + ], + "π/2" => [ + do { var n = 0; { 1/(n++ || 1) } }, + { 1 }, + 1_000, + ] +); + +f.each { |k,v| + printf("%3s ≈ %.9f\n", k, continued_fraction(v...)); +} diff --git a/Task/Continued-fraction/jq/continued-fraction-1.jq b/Task/Continued-fraction/jq/continued-fraction-1.jq new file mode 100644 index 0000000000..7a0845c23d --- /dev/null +++ b/Task/Continued-fraction/jq/continued-fraction-1.jq @@ -0,0 +1,25 @@ +# "first" is the first triple, +# e.g. [1,a,b]; count specifies the number of terms to use. +def continued_fraction( first; next; count ): + # input: [i, a, b]] + def cf: + if .[0] == count then 0 + else next as $ab + | .[1] + (.[2] / ($ab | cf)) + end ; + first | cf; + +# "first" and "next" are as above; +# if delta is 0 then continue until there is no detectable change. +def continued_fraction_delta(first; next; delta): + def abs: if . < 0 then -. else . end; + def cf: + # state: [n, prev] + .[0] as $n | .[1] as $prev + | continued_fraction(first; next; $n+1) as $this + | if $prev == null then [$n+1, $this] | cf + elif delta <= 0 and ($prev == $this) then $this + elif (($prev - $this)|abs) <= delta then $this + else [$n+1, $this] | cf + end; + [2,null] | cf; diff --git a/Task/Continued-fraction/jq/continued-fraction-2.jq b/Task/Continued-fraction/jq/continued-fraction-2.jq new file mode 100644 index 0000000000..7d85a3d6bb --- /dev/null +++ b/Task/Continued-fraction/jq/continued-fraction-2.jq @@ -0,0 +1,4 @@ +"Value : Direct : Continued Fraction", + "2|sqrt : \(2|sqrt) : \(continued_fraction_delta( [1,1,1]; [.[0]+1, 2, 1]; 0))", + "1|exp : \(1|exp) : \(2 + (1 / (continued_fraction_delta( [1,1,1]; [.[0]+1, .[1]+1, .[2]+1]; 0))))", + "pi : \(1|atan * 4) : \(continued_fraction_delta( [1,3,1]; .[0]+1 | [., 6, ((2*. - 1) | (.*.))]; 1e-12)) (1e-12)" diff --git a/Task/Continued-fraction/jq/continued-fraction-3.jq b/Task/Continued-fraction/jq/continued-fraction-3.jq new file mode 100644 index 0000000000..4d10d8d0b7 --- /dev/null +++ b/Task/Continued-fraction/jq/continued-fraction-3.jq @@ -0,0 +1,5 @@ +$ jq -M -n -r -f Continued_fraction.jq +Value : Direct : Continued Fraction +2|sqrt : 1.4142135623730951 : 1.4142135623730951 +1|exp : 2.718281828459045 : 2.7182818284590455 +pi : 3.141592653589793 : 3.1415926535892935 (1e-12) diff --git a/Task/Convert-decimal-number-to-rational/EchoLisp/convert-decimal-number-to-rational.echolisp b/Task/Convert-decimal-number-to-rational/EchoLisp/convert-decimal-number-to-rational.echolisp new file mode 100644 index 0000000000..606e7da185 --- /dev/null +++ b/Task/Convert-decimal-number-to-rational/EchoLisp/convert-decimal-number-to-rational.echolisp @@ -0,0 +1,27 @@ +(exact->inexact 67/74) + → 0.9054054054054054 +(inexact->exact 0.9054054054054054) + → 67/74 + +(rationalize 0.7978723404255319) + → 75/94 + +;; finding rational approximations of PI +(for ((ε (in-range -1 -15 -1))) + (writeln ( format "precision:10^%d %t PI = %d" ε + (rationalize PI (expt 10 e))))) + +"precision:10^-1 PI = 16/5" +"precision:10^-2 PI = 22/7" ;;🎩 +"precision:10^-3 PI = 201/64" +"precision:10^-4 PI = 333/106" +"precision:10^-5 PI = 355/113" ;; 🎩 🎩 +"precision:10^-6 PI = 355/113" +"precision:10^-7 PI = 75948/24175" +"precision:10^-8 PI = 100798/32085" +"precision:10^-9 PI = 103993/33102" +"precision:10^-10 PI = 312689/99532" +"precision:10^-11 PI = 833719/265381" +"precision:10^-12 PI = 4272943/1360120" +"precision:10^-13 PI = 5419351/1725033" +"precision:10^-14 PI = 58466453/18610450" diff --git a/Task/Convert-decimal-number-to-rational/FreeBASIC/convert-decimal-number-to-rational.freebasic b/Task/Convert-decimal-number-to-rational/FreeBASIC/convert-decimal-number-to-rational.freebasic new file mode 100644 index 0000000000..d55974cf0d --- /dev/null +++ b/Task/Convert-decimal-number-to-rational/FreeBASIC/convert-decimal-number-to-rational.freebasic @@ -0,0 +1,62 @@ +'' Written in FreeBASIC +'' (no error checking, limited to 64-bit signed math) +type number as longint +#define str2num vallng +#define pow10(n) clngint(10 ^ (n)) + +function gcd(a as number, b as number) as number + if a = 0 then return b + return gcd(b mod a, a) +end function + + +function parserational(n as const string) as string + dim as string whole, dec, num, denom + dim as number iwhole, idec, inum, idenom, igcd + + '' find positions of '.', '(' and ')' in code + dim as integer dpos, r1pos, r2pos + dpos = instr(n & ".", ".") + r1pos = instr(n & "(", "(") + r2pos = instr(n & ")", ")") + + '' extract sections of number (whole, decimal, repeated numerator), generate '999' denominator + whole = left(n, dpos - 1) + dec = mid(n, dpos + 1, r1pos - dpos - 1) + num = mid(n, r1pos + 1, r2pos - r1pos - 1) + denom = string(len(num), "9"): if denom = "" then denom = "1" + + '' parse sections to integer + iwhole = str2num(whole) + idec = str2num(dec) + inum = str2num(num) + idenom = str2num(denom) + + '' if whole was negative, decimal and repeated sections need to be negative too + if left(ltrim(whole), 1) = "-" then idec = -idec: inum = -inum + + '' add decimal part to repeated fraction, and scale down + inum += idec * idenom + idenom *= pow10(len(dec)) + + '' add integer part to fraction + inum += iwhole * idenom + + '' simplify fraction + igcd = abs(gcd(inum, idenom)) + if igcd <> 0 then + inum \= igcd + idenom \= igcd + end if + + return inum & " / " & idenom & " = " & (inum / idenom) + +end function + +data "0.9(054)", "0.(518)", "-.12(345)", "" +do + dim as string n + read n + if n = "" then exit do + print n & ":", parserational(n) +loop diff --git a/Task/Convert-decimal-number-to-rational/Phix/convert-decimal-number-to-rational.phix b/Task/Convert-decimal-number-to-rational/Phix/convert-decimal-number-to-rational.phix new file mode 100644 index 0000000000..8d2dbb3ddb --- /dev/null +++ b/Task/Convert-decimal-number-to-rational/Phix/convert-decimal-number-to-rational.phix @@ -0,0 +1,16 @@ +function decrat(string s) +integer nom = 0 +integer denom = 1 + if s[1..2]!="0." then ?9/0 end if + for i=3 to length(s) do + integer ch = s[i] + if ch<'0' or ch>'9' then ?9/0 end if + nom = nom*10 + ch-'0' + denom *= 10 + end for + return sq_div({nom,denom},gcd(nom,denom)) +end function + +?decrat("0.9054054") +?decrat("0.518518") +?decrat("0.75") diff --git a/Task/Convert-decimal-number-to-rational/Sidef/convert-decimal-number-to-rational-1.sidef b/Task/Convert-decimal-number-to-rational/Sidef/convert-decimal-number-to-rational-1.sidef new file mode 100644 index 0000000000..f4d8ea991b --- /dev/null +++ b/Task/Convert-decimal-number-to-rational/Sidef/convert-decimal-number-to-rational-1.sidef @@ -0,0 +1,3 @@ +'0.9054054 0.518518 0.75'.split.each { |d| + say d.num.as_rat; +} diff --git a/Task/Convert-decimal-number-to-rational/Sidef/convert-decimal-number-to-rational-2.sidef b/Task/Convert-decimal-number-to-rational/Sidef/convert-decimal-number-to-rational-2.sidef new file mode 100644 index 0000000000..aaf5071ab9 --- /dev/null +++ b/Task/Convert-decimal-number-to-rational/Sidef/convert-decimal-number-to-rational-2.sidef @@ -0,0 +1,3 @@ +say 0.9054054.as_rat; +say 0.518518.as_rat; +say 0.75.as_rat; diff --git a/Task/Conways-Game-of-Life/Axe/conways-game-of-life.axe b/Task/Conways-Game-of-Life/Axe/conways-game-of-life.axe new file mode 100644 index 0000000000..085d9dd641 --- /dev/null +++ b/Task/Conways-Game-of-Life/Axe/conways-game-of-life.axe @@ -0,0 +1,44 @@ +Full + +While getKey(0) +End + +ClrDraw +.BLINKER +Pxl-On(45,45) +Pxl-On(46,45) +Pxl-On(47,45) + +.GLIDER +Pxl-On(1,1) +Pxl-On(2,2) +Pxl-On(2,3) +Pxl-On(3,1) +Pxl-On(3,2) + +Repeat getKey(0) + DispGraph + EVOLVE() + RecallPic + ClrDrawʳ +End +Return + +Lbl EVOLVE +For(Y,0,63) + For(X,0,95) + 0→N + For(B,Y-1,Y+1) + For(A,X-1,X+1) + pxl-Test(A,B)?N++ + End + End + pxl_Test(X,Y)?N-- + If N=3??(N=2?pxl-Test(X,Y)) + Pxl-On(X,Y)ʳ + Else + Pxl-Off(X,Y)ʳ + End + End +End +Return diff --git a/Task/Conways-Game-of-Life/FunL/conways-game-of-life.funl b/Task/Conways-Game-of-Life/FunL/conways-game-of-life.funl new file mode 100644 index 0000000000..22781ac972 --- /dev/null +++ b/Task/Conways-Game-of-Life/FunL/conways-game-of-life.funl @@ -0,0 +1,89 @@ +import lists.zipWithIndex +import util.Regex + +data Rule( birth, survival ) + +val Mirek = Regex( '([0-8]+)/([0-8]+)' ) +val Golly = Regex( 'B([0-8]+)/S([0-8]+)' ) + +def decode( rule ) = + def makerule( b, s ) = Rule( [int(d) | d <- b], [int(d) | d <- s] ) + + case rule + Mirek( s, b ) -> makerule( b, s ) + Golly( b, s ) -> makerule( b, s ) + _ -> error( "unrecognized rule: $rule" ) + +def fate( state, crowding, rule ) = crowding in rule( int(state) ) + +def crowd( buffer, x, y ) = + res = 0 + + def neighbour( x, y ) = + if x >= 0 and x < N and y >= 0 and y < N + res += int( buffer(x, y) ) + + for i <- x-1..x+1 + neighbour( i, y - 1 ) + neighbour( i, y + 1 ) + + neighbour( x - 1, y ) + neighbour( x + 1, y ) + res + +def display( buffer ) = + for j <- 0:N + for i <- 0:N + print( if buffer(i, j) then '*' else '\u00b7' ) + + println() + +def generation( b1, b2, rule ) = + for i <- 0:N, j <- 0:N + b2(i, j) = fate( b1(i, j), crowd(b1, i, j), rule ) + +def pattern( p, b, x, y ) = + for (r, j) <- zipWithIndex( list(WrappedString(p).stripMargin().split('\n')).drop(1).dropRight(1) ) + for i <- 0:r.length() + b(x + i, y + j) = r(i) == '*' + +var current = 0 +val LIFE = decode( '23/3' ) +val N = 4 +val buffers = (array( N, N, (_, _) -> false ), array( N, N )) + +def reset = + for i <- 0:N, j <- 0:N + buffers(0)(i, j) = false + + current = 0 + +def iteration = + display( buffers(current) ) + generation( buffers(current), buffers(current = (current + 1)%2), LIFE ) + println( 5'-' ) + +// two patterns to be tested +blinker = ''' + | + |*** + ''' + +glider = ''' + | * + | * + |*** + ''' + +// load "blinker" pattern and run for three generations +pattern( blinker, buffers(0), 0, 0 ) + +repeat 3 + iteration() + +// clear grid, load "glider" pattern and run for five generations +reset() +pattern( glider, buffers(0), 0, 0 ) + +repeat 5 + iteration() diff --git a/Task/Conways-Game-of-Life/Futhark/conways-game-of-life.futhark b/Task/Conways-Game-of-Life/Futhark/conways-game-of-life.futhark new file mode 100644 index 0000000000..abe740a14d --- /dev/null +++ b/Task/Conways-Game-of-Life/Futhark/conways-game-of-life.futhark @@ -0,0 +1,43 @@ +fun bint(b: bool): int = if b then 1 else 0 +fun intb(x: int): bool = if x == 0 then False else True + +fun to_bool_board(board: [][]int): [][]bool = + map (fn (r: []int): []bool => map intb r) board + +fun to_int_board(board: [][]bool): [][]int = + map (fn (r: []bool): []int => map bint r) board + +fun cell_neighbors(i: int, j: int, board: [n][m]bool): int = + unsafe + let above = (i - 1) % n + let below = (i + 1) % n + let right = (j + 1) % m + let left = (j - 1) % m in + bint board[above,left] + bint board[above,j] + bint board[above,right] + + bint board[i,left] + bint board[i,right] + + bint board[below,left] + bint board[below,j] + bint board[below,right] + +fun all_neighbours(board: [n][m]bool): [n][m]int = + map (fn (i: int): []int => + map (fn (j: int): int => cell_neighbors(i,j,board)) (iota m)) + (iota n) + +fun iteration(board: [n][m]bool): [n][m]bool = + let lives = all_neighbours(board) in + zipWith (fn (lives_r: []int) (board_r: []bool): []bool => + zipWith (fn (neighbors: int) (alive: bool): bool => + if neighbors < 2 + then False + else if neighbors == 3 then True + else if alive && neighbors < 4 then True + else False) + lives_r board_r) + lives board + +fun main(int_board: [][]int, iterations: int): [][]int = + -- We accept the board as integers for convenience, and then we + -- convert to booleans here. + let board = to_bool_board int_board in + loop (board) = for i < iterations do + iteration board in + to_int_board board diff --git a/Task/Conways-Game-of-Life/Nim/conways-game-of-life.nim b/Task/Conways-Game-of-Life/Nim/conways-game-of-life.nim new file mode 100644 index 0000000000..2cf2170538 --- /dev/null +++ b/Task/Conways-Game-of-Life/Nim/conways-game-of-life.nim @@ -0,0 +1,42 @@ +import os, strutils, math + +randomize() +var w, h: int +if paramCount() >= 2: + w = parseInt(paramStr(1)) + h = parseInt(paramStr(2)) +if w <= 0: w = 30 +if h <= 0: h = 30 + +# Initialize +var univ, utmp = newSeq[seq[bool]] h +for y in 0 .. 3 //Cell Dies + else + 1 when Cells[I,J] = 1 and numNeighbors = 2 or numNeighbors = 3 //Cell lives on or is born. + else + Cells[I,J]; //No Change + + +stressTestInput(n(0))[y,x] := + 0 when not y = n / 2 + else + 1 + foreach y within 1 ... n, + x within 1 ... n; diff --git a/Task/Conways-Game-of-Life/SequenceL/conways-game-of-life-2.sequencel b/Task/Conways-Game-of-Life/SequenceL/conways-game-of-life-2.sequencel new file mode 100644 index 0000000000..5c10981d9f --- /dev/null +++ b/Task/Conways-Game-of-Life/SequenceL/conways-game-of-life-2.sequencel @@ -0,0 +1,180 @@ +#include +#include +#include +#include +#include + +#include "Cimg.h" + +#include "SL_Generated.h" + +using namespace std; +using namespace cimg_library; + +char titleBuffer[200]; + +std::string get_file_contents(const char*); + +int main(int argc, char ** argv) +{ + int cores = 0; + int maxSize = 700; + + int drawSkip = 1; + int drawWait = 0; + + string inputFile = "test"; + + if(argc > 1) + { + inputFile = argv[1]; + } + if(argc > 2) + { + cores = atoi(argv[2]); + } + + if(argc > 3) + { + maxSize = atoi(argv[3]); + } + + if(argc > 4) + { + drawSkip = atoi(argv[4]); + + if(drawSkip < 0) + { + drawWait = abs(drawSkip); + drawSkip = 1; + } + } + + sl_init(cores); + + SLTimer drawTimer; + + sprintf(titleBuffer, "Conway's Game of Life in SequenceL: %d Cores", cores); + + int width = 0; + int height = 0; + + //Read input file-------------- + Sequence> initialGrid; + + if(inputFile != "test") + { + stringstream ss(get_file_contents(inputFile.c_str())); + string stringItem; + vector elems; + char delim = ','; + + getline(ss, stringItem, delim); + width = atoi(stringItem.c_str()); + getline(ss, stringItem, delim); + height = atoi(stringItem.c_str()); + + while(getline(ss, stringItem, delim)) + { + elems.push_back(atoi(stringItem.c_str())); + } + + //Sequence Pointer Constructor---- + int gridDims[] = {height, width, 0}; + Sequence> tempGrid( (void*)&elems[0], gridDims); + initialGrid.hard_copy(tempGrid, 0); + //----------------------------- + } + else + { + width = maxSize; + height = maxSize; + sl_stressTestInput(maxSize, cores, initialGrid); + } + //-------- + + Sequence> result; + + const unsigned char black[] = {0}; + + CImg visu(width * 4, height * 4, 1, 1, 0); + CImgDisplay draw_disp(visu, titleBuffer); + cout << "Conway's Game of Life in SequenceL" << endl << "Cores: " << cores << endl; + + int generations = 0; + double compTime = 0; + double drawTime = 0; + SLTimer t; + + while(!draw_disp.is_closed()) + { + t.start(); + sl_life(initialGrid, cores, result); + generations++; + initialGrid.hard_copy(result, 0); + t.stop(); + compTime += t.getTime(); + + drawTimer.start(); + + if(drawSkip > 0 && generations % drawSkip == 0) + { + + visu.fill(255); + + for(int i = 1; i <= result.size(); i++) + { + for(int j = 1; j <= result[i].size(); j++) + { + if(result[i][j] == 1) visu.draw_circle((j-1) * 4, (i - 1) * 4, 2, black, 1); + } + } + + visu.display(draw_disp); + + int drawWidth = maxSize; + int drawHeight = maxSize; + + if(width < height) + { + drawWidth = ((double)drawHeight * ((double)width / (double)height)); + } + else + { + drawHeight = ((double)drawWidth * ((double)height / (double)width)); + } + + draw_disp.resize(drawWidth, drawHeight, false); + + draw_disp.wait(drawWait); + drawTimer.stop(); + drawTime += drawTimer.getTime(); + } + } + + cout << "Total Generations: " << generations << endl; + + cout << "Average Compute Time: " << compTime / generations << " seconds" << endl; + + cout << "Average Draw Time: " << drawTime / generations << " seconds" << endl; + + sl_done(); + + return 0; +} + +std::string get_file_contents(const char *filename) +{ + std::ifstream in(filename, std::ios::in | std::ios::binary); + if (in) + { + std::string contents; + in.seekg(0, std::ios::end); + contents.resize(in.tellg()); + in.seekg(0, std::ios::beg); + in.read(&contents[0], contents.size()); + in.close(); + return(contents); + } + throw(errno); +} diff --git a/Task/Conways-Game-of-Life/Shen/conways-game-of-life.shen b/Task/Conways-Game-of-Life/Shen/conways-game-of-life.shen new file mode 100644 index 0000000000..0d664fa2a6 --- /dev/null +++ b/Task/Conways-Game-of-Life/Shen/conways-game-of-life.shen @@ -0,0 +1,133 @@ +(tc +) + +(datatype subtype + (subtype B A); X : B; + _____________________ + X : A;) + +(datatype integer + if (integer? X) + ___________ + X: integer; + + ________________________ + (subtype integer number);) + +(datatype bit + if (< X 2) + _______ + X: bit; + + _____________________ + (subtype bit integer);) + +(datatype row + + _________ + [] : row; + + C : bit; Row : row; + =================== + [C | Row] : row;) + +(datatype universe + + ______________ + [] : universe; + + R : row; Uni : universe; + ======================== + [R | Uni] : universe;) + +(define conway-nth + \\ returns value of x from row if it exists, else 0 + { number --> row --> bit } + _ [] -> 0 + N _ -> 0 where (< N 0) + 0 [A|B] -> A + N [A|B] -> (conway-nth (- N 1) B)) + +(define row-retrieve + { number --> universe --> row } + _ [] -> [] + 0 [] -> [] + 0 [A|B] -> A + N [A|B] -> (row-retrieve (- N 1) B)) + +(define cell-retrieve + { number --> number --> universe --> bit } + X Y Universe -> (conway-nth X (row-retrieve Y Universe))) + +(define neighbors + \\ takes an X and Y, retrieves the number of neighbors + { number --> number --> universe --> number } + X Y Universe -> (let ++ (+ 1) + -- (/. X (- X 1)) + (+ (cell-retrieve (++ X) Y Universe) + (cell-retrieve (++ X) (++ Y) Universe) + (cell-retrieve (++ X) (-- Y) Universe) + (cell-retrieve (-- X) Y Universe) + (cell-retrieve (-- X) (++ Y) Universe) + (cell-retrieve (-- X) (-- Y) Universe) + (cell-retrieve X (++ Y) Universe) + (cell-retrieve X (-- Y) Universe)))) + +(define handle-alive + { number --> number --> universe --> bit } + X Y Universe -> (if (or (= (neighbors X Y Universe) 2) + (= (neighbors X Y Universe) 3)) + 1 0)) + +(define handle-dead + { number --> number --> universe --> bit } + X Y Universe -> (if (= (neighbors X Y Universe) 3) + 1 0)) + +(define next-row + \\ first argument must be a previous row, second must be 0 when + \\ first called, third must be a Y value and the final must be the + \\ current universe + { row --> number --> number --> universe --> row } + [] _ _ _ -> [] + [1|B] X Y Universe -> (cons (handle-alive X Y Universe) + (next-row B (+ X 1) Y Universe)) + [_|B] X Y Universe -> (cons (handle-dead X Y Universe) + (next-row B (+ X 1) Y Universe))) + +(define next-universe + \\ both the first and second arguments must be the same universe, + \\ the third must be 0 upon first call + { universe --> number --> universe --> universe } + [] _ _ -> [] + [Row|Rest] Y Universe -> (cons (next-row Row 0 Y Universe) + (next-universe Rest (+ Y 1) Universe))) + +(define display-row + { row --> number } + [] -> (nl) + [1|Rest] -> (do (output "* ") + (display-row Rest)) + [_|Rest] -> (do (output " ") + (display-row Rest))) + +(define display-universe + { universe --> number } + [] -> (nl 2) + [Row|Rest] -> (do (display-row Row) + (display-universe Rest))) + +(define iterate-universe + { number --> universe --> number } + 0 _ -> (nl) + N Universe -> (do (display-universe Universe) + (iterate-universe (- N 1) + (next-universe Universe 0 Universe)))) + +(iterate-universe + 10 + [[0 0 0 0 0 0] + [0 0 0 0 0 0] + [0 0 1 1 1 0] + [0 1 1 1 0 0] + [0 0 0 0 0 0] + [0 0 0 0 0 0]]) diff --git a/Task/Conways-Game-of-Life/Sidef/conways-game-of-life.sidef b/Task/Conways-Game-of-Life/Sidef/conways-game-of-life.sidef new file mode 100644 index 0000000000..b5e1a6e826 --- /dev/null +++ b/Task/Conways-Game-of-Life/Sidef/conways-game-of-life.sidef @@ -0,0 +1,36 @@ +var w = `tput cols`.to_i +var h = `tput lines`.to_i +var r = "\033[H" + +var dirs = [[-1,-1], [-1, 0], [-1, 1], [ 0,-1], + [ 0, 1], [ 1,-1], [ 1, 0], [ 1, 1]] + +var universe = h.of { w.of {1.rand < 0.1} } + +var rh = h.range +var rw = w.range + +func iterate { + var new = h.of { w.of(false) } + for i in rh { + for j in rw { + var neighbor = 0 + for y,x in (dirs.map {|dir| dir »+« [i, j] }) { + universe[y % h][x % w] && ++neighbor + neighbor > 3 && break + } + new[i][j] = (universe[i][j] + ? (neighbor==2 || neighbor==3) + : (neighbor==3)) + } + } + universe = new +} + +STDOUT.autoflush(true) + +loop { + print r + say universe.map{|row| row.map{|cell| cell ? '#' : ' '}.join }.join("\n") + iterate() +} diff --git a/Task/Conways-Game-of-Life/Wortel/conways-game-of-life-1.wortel b/Task/Conways-Game-of-Life/Wortel/conways-game-of-life-1.wortel new file mode 100644 index 0000000000..0fe04150df --- /dev/null +++ b/Task/Conways-Game-of-Life/Wortel/conways-game-of-life-1.wortel @@ -0,0 +1,24 @@ +@let { + life &m ~!* m &[a y] ~!* a &[v x] @let { + neigh @sum [ + @`-x 1 @`-y 1 m @`x @`-y 1 m @`+x 1 @`-y 1 m + @`-x 1 @`y m @`+x 1 @`y m + @`-x 1 @`+y 1 m @`x @`+y 1 m @`+x 1 @`+y 1 m + ] + @+ || = neigh 3 && v = neigh 2 + } + + blinker [ + [0 0 0 0 0] + [0 0 0 0 0] + [0 1 1 1 0] + [0 0 0 0 0] + [0 0 0 0 0] + ] + + [[ + !^life 0 blinker + !^life 1 blinker + !^life 2 blinker + ]] +} diff --git a/Task/Conways-Game-of-Life/Wortel/conways-game-of-life-2.wortel b/Task/Conways-Game-of-Life/Wortel/conways-game-of-life-2.wortel new file mode 100644 index 0000000000..e02eaaffbd --- /dev/null +++ b/Task/Conways-Game-of-Life/Wortel/conways-game-of-life-2.wortel @@ -0,0 +1,53 @@ +@let { + ; Translation of the APL game of life (http://catpad.net/michael/apl/). + life &m @let { + ; create functions that work on two matrices + makemf &f @[\@mapm @[\@mapm f ^@,] ^@,] + addm !makemf ^+ + orm !makemf ^|| + andm !makemf ^&& + eqm !makemf ^= + + ; bool matrix to number matrix + tonum *^*^@+ + + ; create a matrix of value v in the shape of matrix m + repm &[v m] @rep #m &,@rep #m.0 v + + ; move a matrix in directions by padding zeroes + movel \!*~t0j + mover \!*~i0SO + moveu &m ~, &,@rep #m.0 0 !~t m + moved &m , &,@rep #m.0 0 !~i m + + ; cache up and down + mu !moveu m + md !moved m + + ; calculate the neighbours + neigh !/addm [ + !movel mu mu !mover mu + !movel m !mover m + !movel md md !mover md + ] + + ; ((neigh = 2) AND m) OR (neigh = 3) + ; (2 neighbours AND alive) OR (3 neighbours) + !tonum !!orm !!andm m !!eqm neigh !!repm 2 m + !!eqm neigh !!repm 3 m + } + + blinker [ + [0 0 0 0 0] + [0 0 0 0 0] + [0 1 1 1 0] + [0 0 0 0 0] + [0 0 0 0 0] + ] + + [[ + !^life 0 blinker + !^life 1 blinker + !^life 2 blinker + ]] +} diff --git a/Task/Conways-Game-of-Life/jq/conways-game-of-life-1.jq b/Task/Conways-Game-of-Life/jq/conways-game-of-life-1.jq new file mode 100644 index 0000000000..0f38ed974f --- /dev/null +++ b/Task/Conways-Game-of-Life/jq/conways-game-of-life-1.jq @@ -0,0 +1,44 @@ +# Notes on the implementation: + +# 1. For efficiency, the implementation requires that the world +# has boundaries, as illustrated in the examples. +# 2. For speed, the simulation uses the exploded string. +# 3. The ASCII values of the "alive" and "empty" symbols are +# hardcoded: "." => 46; " " => 32 +# 4. To adjust the refresh rate, adjust the input to "spin". + +def lines: split("\n")|length; + +def cols: split("\n")[0]|length + 1; # allow for the newline + +# Is there a "." (46) at [x,y] relative to position i, +# assuming the width is w? +# Input is an array; result is 0 or 1 so we can easily count the total. +def isAlive(x; y; i; w): if .[i+ w*y + x] == 46 then 1 else 0 end; + +def neighborhood(i;w): + isAlive(-1; -1; i; w) + isAlive(0; -1; i; w) + isAlive(1; -1; i; w) + + isAlive(-1; 0; i; w) + isAlive(1; 0; i; w) + + isAlive(-1; 1; i; w) + isAlive(0; 1; i; w) + isAlive(1; 1; i; w) ; + +# The basic rules: +def evolve(cell; sum) : + if cell == 46 then if sum == 2 or sum == 3 then 46 else 32 end + elif cell == 32 then if sum == 3 then 46 else 32 end + else cell + end ; + +# [world, lines, cols] | next(w) => [world, lines, cols] +def next: + .[0] as $world | .[1] as $lines | .[2] as $w + | reduce range(0; $world|length) as $i + ($world; + .[$i] as $c + | if $c == 32 or $c == 46 then + # updates are "simultaneous" i.e. relative to $world, not "." + ($world | neighborhood($i; $w)) as $sum + | evolve($c; $sum) as $next + | if $c == $next then . else .[$i] = $next end + else . + end ) + | [., $lines, $w] ; diff --git a/Task/Conways-Game-of-Life/jq/conways-game-of-life-2.jq b/Task/Conways-Game-of-Life/jq/conways-game-of-life-2.jq new file mode 100644 index 0000000000..8bdc86e467 --- /dev/null +++ b/Task/Conways-Game-of-Life/jq/conways-game-of-life-2.jq @@ -0,0 +1,26 @@ +# "clear screen": +def cls: "\u001b[2J"; + +# Input: an integer; 1000 ~ 1 sec +def spin: + reduce range(1; 500 * .) as $i + (0; . + ($i|cos)*($i|cos) + ($i|sin)*($i|sin) ) + | "" ; + +# Animate n steps; +# if "sleep" is non-negative then cls and +# sleep about "sleep" ms between frames. +def animate(n; sleep): + if n == 0 then empty + else (if sleep >= 0 then cls else "" end), + (.[0]|implode), n, "\n", + (sleep|spin), + ( next|animate(n-1; sleep) ) + end ; + +# Input: a string representing the initial state +def animation(n; sleep): + [ explode, lines, cols] | animate(n; sleep) ; + +# Input: a string representing the initial state +def frames(n): animation(n; -1); diff --git a/Task/Conways-Game-of-Life/jq/conways-game-of-life-3.jq b/Task/Conways-Game-of-Life/jq/conways-game-of-life-3.jq new file mode 100644 index 0000000000..77c92336c6 --- /dev/null +++ b/Task/Conways-Game-of-Life/jq/conways-game-of-life-3.jq @@ -0,0 +1,15 @@ +def world3: +"+---+\n" + +"| |\n" + +"|...|\n" + +"| |\n" + +"+---+\n" ; + +def world11: +"+-----------+\n" + +"| |\n" + +"| .. |\n" + +"| ... |\n" + +"| .. |\n" + +"| |\n" + +"+-----------+\n" ; diff --git a/Task/Conways-Game-of-Life/jq/conways-game-of-life-4.jq b/Task/Conways-Game-of-Life/jq/conways-game-of-life-4.jq new file mode 100644 index 0000000000..4c3b17dd0c --- /dev/null +++ b/Task/Conways-Game-of-Life/jq/conways-game-of-life-4.jq @@ -0,0 +1 @@ +world3 | frames(3) diff --git a/Task/Conways-Game-of-Life/jq/conways-game-of-life-5.jq b/Task/Conways-Game-of-Life/jq/conways-game-of-life-5.jq new file mode 100644 index 0000000000..55cf25d615 --- /dev/null +++ b/Task/Conways-Game-of-Life/jq/conways-game-of-life-5.jq @@ -0,0 +1,31 @@ +$ jq -n -r -f Game_of_life.jq + ++---+ +| | +|...| +| | ++---+ + +3 + + + + ++---+ +| . | +| . | +| . | ++---+ + +2 + + + + ++---+ +| | +|...| +| | ++---+ + +1 diff --git a/Task/Conways-Game-of-Life/jq/conways-game-of-life-6.jq b/Task/Conways-Game-of-Life/jq/conways-game-of-life-6.jq new file mode 100644 index 0000000000..952434244b --- /dev/null +++ b/Task/Conways-Game-of-Life/jq/conways-game-of-life-6.jq @@ -0,0 +1,2 @@ +# Animation of 100 frames with approximately 1 second between each update: +world11 | animation(100; 1000) diff --git a/Task/Copy-a-string/Apex/copy-a-string.apex b/Task/Copy-a-string/Apex/copy-a-string.apex new file mode 100644 index 0000000000..b3d5d3de6b --- /dev/null +++ b/Task/Copy-a-string/Apex/copy-a-string.apex @@ -0,0 +1,6 @@ +String original = 'Test'; +String cloned = original; +//"original == cloned" is true + +cloned += ' more'; +//"original == cloned" is false diff --git a/Task/Copy-a-string/Axe/copy-a-string.axe b/Task/Copy-a-string/Axe/copy-a-string.axe new file mode 100644 index 0000000000..61a7a4db8d --- /dev/null +++ b/Task/Copy-a-string/Axe/copy-a-string.axe @@ -0,0 +1,10 @@ +Lbl STRCPY +r₁→S +While {r₂} + {r₂}→{r₁} + r₁++ + r₂++ +End +0→{r₁} +S +Return diff --git a/Task/Copy-a-string/Computer-zero-Assembly/copy-a-string.computer b/Task/Copy-a-string/Computer-zero-Assembly/copy-a-string.computer new file mode 100644 index 0000000000..36225fe848 --- /dev/null +++ b/Task/Copy-a-string/Computer-zero-Assembly/copy-a-string.computer @@ -0,0 +1,28 @@ +ldsrc: LDA src +stdest: STA dest + BRZ done ; 0-terminated + + LDA ldsrc + ADD one + STA ldsrc + + LDA stdest + ADD one + STA stdest + + JMP ldsrc + +done: STP + +one: 1 + +src: 82 ; ASCII + 111 + 115 + 101 + 116 + 116 + 97 + 0 + +dest: diff --git a/Task/Copy-a-string/EchoLisp/copy-a-string.echolisp b/Task/Copy-a-string/EchoLisp/copy-a-string.echolisp new file mode 100644 index 0000000000..d8b5fdf637 --- /dev/null +++ b/Task/Copy-a-string/EchoLisp/copy-a-string.echolisp @@ -0,0 +1,6 @@ +(define-syntax-rule (string-copy s) (string-append s)) ;; copy = append nothing + → #syntax:string-copy +(define s "abc") +(define t (string-copy s)) + t → "abc" +(eq? s t) → #t ;; same reference, same object diff --git a/Task/Copy-a-string/FreeBASIC/copy-a-string.freebasic b/Task/Copy-a-string/FreeBASIC/copy-a-string.freebasic new file mode 100644 index 0000000000..af3b0a751f --- /dev/null +++ b/Task/Copy-a-string/FreeBASIC/copy-a-string.freebasic @@ -0,0 +1,12 @@ +' FB 1.05.0 Win64 + +Dim s As String = "This is a string" +Dim t As String = s +' a separate copy of the string contents has been made as can be seen from the addresses +Print s, StrPtr(s) +Print t, StrPtr(t) +' to refer to the same string a pointer needs to be used +Dim u As String Ptr = @s +Print +Print *u, StrPtr(*u) +Sleep diff --git a/Task/Copy-a-string/FutureBasic/copy-a-string.futurebasic b/Task/Copy-a-string/FutureBasic/copy-a-string.futurebasic new file mode 100644 index 0000000000..c6e7132a8d --- /dev/null +++ b/Task/Copy-a-string/FutureBasic/copy-a-string.futurebasic @@ -0,0 +1,6 @@ +include "ConsoleWindow" + +dim as Str15 s, c +s = "Hello!" +c = s +print c diff --git a/Task/Copy-a-string/I/copy-a-string.i b/Task/Copy-a-string/I/copy-a-string.i new file mode 100644 index 0000000000..7a2687fc60 --- /dev/null +++ b/Task/Copy-a-string/I/copy-a-string.i @@ -0,0 +1,6 @@ +//Text is mutable. +software { + var s = "Hello" + var c = copy(s) + print(c) +} diff --git a/Task/Copy-a-string/LC3-Assembly/copy-a-string.lc3 b/Task/Copy-a-string/LC3-Assembly/copy-a-string.lc3 new file mode 100644 index 0000000000..13fa101e80 --- /dev/null +++ b/Task/Copy-a-string/LC3-Assembly/copy-a-string.lc3 @@ -0,0 +1,22 @@ + .ORIG 0x3000 + + LEA R1,SRC + LEA R2,COPY + +LOOP LDR R3,R1,0 + STR R3,R2,0 + BRZ DONE + ADD R1,R1,1 + ADD R2,R2,1 + BRNZP LOOP + +DONE LEA R0,COPY + PUTS + + HALT + +SRC .STRINGZ "What, has this thing appeared again tonight?" + +COPY .BLKW 128 + + .END diff --git a/Task/Copy-a-string/LFE/copy-a-string-1.lfe b/Task/Copy-a-string/LFE/copy-a-string-1.lfe new file mode 100644 index 0000000000..202dd1d5aa --- /dev/null +++ b/Task/Copy-a-string/LFE/copy-a-string-1.lfe @@ -0,0 +1,3 @@ +(let* ((a '"data assigned to a") + (b a)) + (: io format '"Contents of 'b': ~s~n" (list b))) diff --git a/Task/Copy-a-string/LFE/copy-a-string-2.lfe b/Task/Copy-a-string/LFE/copy-a-string-2.lfe new file mode 100644 index 0000000000..c9c18f6107 --- /dev/null +++ b/Task/Copy-a-string/LFE/copy-a-string-2.lfe @@ -0,0 +1,8 @@ +> (set a '"data") +"data" +> a +"data" +> (set b a) +"data" +> b +"data" diff --git a/Task/Copy-a-string/Lasso/copy-a-string.lasso b/Task/Copy-a-string/Lasso/copy-a-string.lasso new file mode 100644 index 0000000000..39a14eec2e --- /dev/null +++ b/Task/Copy-a-string/Lasso/copy-a-string.lasso @@ -0,0 +1,18 @@ +local(x = 'I saw a rhino!') +local(y = #x) + +#x //I saw a rhino! +'\r' +#y //I saw a rhino! + +'\r\r' +#x = 'I saw one too' +#x //I saw one too +'\r' +#y //I saw a rhino! + +'\r\r' +#y = 'it was grey.' +#x //I saw one too +'\r' +#y //it was grey. diff --git a/Task/Copy-a-string/Lingo/copy-a-string-1.lingo b/Task/Copy-a-string/Lingo/copy-a-string-1.lingo new file mode 100644 index 0000000000..f2c12c2911 --- /dev/null +++ b/Task/Copy-a-string/Lingo/copy-a-string-1.lingo @@ -0,0 +1,2 @@ +str = "Hello world!" +str2 = str diff --git a/Task/Copy-a-string/Lingo/copy-a-string-2.lingo b/Task/Copy-a-string/Lingo/copy-a-string-2.lingo new file mode 100644 index 0000000000..f24ecbeab9 --- /dev/null +++ b/Task/Copy-a-string/Lingo/copy-a-string-2.lingo @@ -0,0 +1,5 @@ +put "X" before str +put "X" after str +put "X" into char 6 of str +put str +-- "XHellX world!X" diff --git a/Task/Copy-a-string/LiveCode/copy-a-string.livecode b/Task/Copy-a-string/LiveCode/copy-a-string.livecode new file mode 100644 index 0000000000..b9f9c58306 --- /dev/null +++ b/Task/Copy-a-string/LiveCode/copy-a-string.livecode @@ -0,0 +1,3 @@ +put "foo" into bar +put bar into baz +answer bar && baz diff --git a/Task/Copy-a-string/Nim/copy-a-string.nim b/Task/Copy-a-string/Nim/copy-a-string.nim new file mode 100644 index 0000000000..cb0994c38b --- /dev/null +++ b/Task/Copy-a-string/Nim/copy-a-string.nim @@ -0,0 +1,3 @@ +var + c = "This is a string" + d = c # Copy of content into new string diff --git a/Task/Copy-a-string/Oforth/copy-a-string-1.oforth b/Task/Copy-a-string/Oforth/copy-a-string-1.oforth new file mode 100644 index 0000000000..5f1501ea03 --- /dev/null +++ b/Task/Copy-a-string/Oforth/copy-a-string-1.oforth @@ -0,0 +1 @@ +"abcde" dup diff --git a/Task/Copy-a-string/Oforth/copy-a-string-2.oforth b/Task/Copy-a-string/Oforth/copy-a-string-2.oforth new file mode 100644 index 0000000000..944e54fb99 --- /dev/null +++ b/Task/Copy-a-string/Oforth/copy-a-string-2.oforth @@ -0,0 +1 @@ +StringBuffer new "abcde" << diff --git a/Task/Copy-a-string/Phix/copy-a-string.phix b/Task/Copy-a-string/Phix/copy-a-string.phix new file mode 100644 index 0000000000..ed8d495d5e --- /dev/null +++ b/Task/Copy-a-string/Phix/copy-a-string.phix @@ -0,0 +1,5 @@ +string this = "feed" +string that = this -- (that becomes "feed", this remains "feed") +that[2..3] = "oo" -- (that becomes "food", this remains "feed") +this[1] = 'n' -- (that remains "food", this becomes "need") +?{this,that} diff --git a/Task/Copy-a-string/Ring/copy-a-string.ring b/Task/Copy-a-string/Ring/copy-a-string.ring new file mode 100644 index 0000000000..f8c2892e34 --- /dev/null +++ b/Task/Copy-a-string/Ring/copy-a-string.ring @@ -0,0 +1,2 @@ +cStr1 = "Hello!" # create original string +cStr2 = cStr1 # make new string from original diff --git a/Task/Copy-a-string/Sidef/copy-a-string.sidef b/Task/Copy-a-string/Sidef/copy-a-string.sidef new file mode 100644 index 0000000000..8e69e6281d --- /dev/null +++ b/Task/Copy-a-string/Sidef/copy-a-string.sidef @@ -0,0 +1,4 @@ +var original = "hello"; # new String object +var reference = original; # points at the original object +var copy1 = String.new(original); # creates a new String object +var copy2 = original+''; # ==//== diff --git a/Task/Copy-a-string/Swift/copy-a-string.swift b/Task/Copy-a-string/Swift/copy-a-string.swift new file mode 100644 index 0000000000..ddceda62b4 --- /dev/null +++ b/Task/Copy-a-string/Swift/copy-a-string.swift @@ -0,0 +1,2 @@ +var src = "Hello" +var dst = src diff --git a/Task/Copy-a-string/Ursa/copy-a-string.ursa b/Task/Copy-a-string/Ursa/copy-a-string.ursa new file mode 100644 index 0000000000..b17392fa91 --- /dev/null +++ b/Task/Copy-a-string/Ursa/copy-a-string.ursa @@ -0,0 +1,3 @@ +decl string a b +set a "hello" +set b a diff --git a/Task/Copy-a-string/jq/copy-a-string.jq b/Task/Copy-a-string/jq/copy-a-string.jq new file mode 100644 index 0000000000..15867773df --- /dev/null +++ b/Task/Copy-a-string/jq/copy-a-string.jq @@ -0,0 +1,8 @@ +def demo: + "abc" as $s # assignment of a string to a variable + | $s as $t # $t points to the same string as $s + | "def" as $s # This $s shadows the previous $s + | $t # $t still points to "abc" +; + +demo diff --git a/Task/Count-in-factors/EchoLisp/count-in-factors.echolisp b/Task/Count-in-factors/EchoLisp/count-in-factors.echolisp new file mode 100644 index 0000000000..b05ddbca69 --- /dev/null +++ b/Task/Count-in-factors/EchoLisp/count-in-factors.echolisp @@ -0,0 +1,3 @@ +(define (task (nfrom 2) (range 20)) + (for ((i (in-range nfrom (+ nfrom range)))) + (writeln i "=" (string-join (prime-factors i) " x ")))) diff --git a/Task/Count-in-factors/FreeBASIC/count-in-factors.freebasic b/Task/Count-in-factors/FreeBASIC/count-in-factors.freebasic new file mode 100644 index 0000000000..d41ee100c6 --- /dev/null +++ b/Task/Count-in-factors/FreeBASIC/count-in-factors.freebasic @@ -0,0 +1,38 @@ +' FB 1.05.0 Win64 + +Sub getPrimeFactors(factors() As UInteger, n As UInteger) + If n < 2 Then Return + Dim factor As UInteger = 2 + Do + If n Mod factor = 0 Then + Redim Preserve factors(0 To UBound(factors) + 1) + factors(UBound(factors)) = factor + n \= factor + If n = 1 Then Return + Else + factor += 1 + End If + Loop +End Sub + +Dim factors() As UInteger + +For i As UInteger = 1 To 20 + Print Using "##"; i; + Print " = "; + If i > 1 Then + Erase factors + getPrimeFactors factors(), i + For j As Integer = LBound(factors) To UBound(factors) + Print factors(j); + If j < UBound(factors) Then Print " x "; + Next j + Print + Else + Print i + End If +Next i + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Count-in-factors/Nim/count-in-factors.nim b/Task/Count-in-factors/Nim/count-in-factors.nim new file mode 100644 index 0000000000..75e2d5ca60 --- /dev/null +++ b/Task/Count-in-factors/Nim/count-in-factors.nim @@ -0,0 +1,39 @@ +var primes = newSeq[int]() + +proc getPrime(idx: int): int = + if idx >= primes.len: + if primes.len == 0: + primes.add 2 + primes.add 3 + + var last = primes[primes.high] + while idx >= primes.len: + last += 2 + for i, p in primes: + if p * p > last: + primes.add last + break + if last mod p == 0: + break + + return primes[idx] + +for x in 1 .. < int32.high.int: + stdout.write x, " = " + var n = x + var first = 1 + + for i in 0 .. < int32.high: + let p = getPrime(i) + while n mod p == 0: + n = n div p + if first == 0: stdout.write " x " + first = 0 + stdout.write p + + if n <= p * p: + break + + if first > 0: echo n + elif n > 1: echo " x ", n + else: echo "" diff --git a/Task/Count-in-factors/Phix/count-in-factors.phix b/Task/Count-in-factors/Phix/count-in-factors.phix new file mode 100644 index 0000000000..b758202424 --- /dev/null +++ b/Task/Count-in-factors/Phix/count-in-factors.phix @@ -0,0 +1,24 @@ +function factorise(atom n) +-- returns a list of all integer factors of n, that when multiplied together equal n +-- (adapted from the standard builtin factors(), which does not return duplicates) +sequence res = {} +integer p = 2, + step = 1, + lim = floor(sqrt(n)) + + while p<=lim do + while remainder(n,p)=0 do + res = append(res,sprintf("%d",p)) + n = n/p + if n=p then exit end if + lim = floor(sqrt(n)) + end while + p += step + step = 2 + end while + return join(append(res,sprintf("%d",n))," x ") +end function + +for i=1 to 10 do + printf(1,"%2d: %s\n",{i,factorise(i)}) +end for diff --git a/Task/Count-in-factors/Ring/count-in-factors.ring b/Task/Count-in-factors/Ring/count-in-factors.ring new file mode 100644 index 0000000000..5d4c9ea318 --- /dev/null +++ b/Task/Count-in-factors/Ring/count-in-factors.ring @@ -0,0 +1,15 @@ +for i = 1 to 20 + see "" + i + " = " + factors(i) + nl +next + +func factors n + f = "" + if n = 1 return "1" ok + p = 2 + while p <= n + if (n % p) = 0 + f += string(p) + " x " + n = n/p + else p += 1 ok + end + return left(f, len(f) - 3) diff --git a/Task/Count-in-factors/Sidef/count-in-factors.sidef b/Task/Count-in-factors/Sidef/count-in-factors.sidef new file mode 100644 index 0000000000..e5dd9feb3d --- /dev/null +++ b/Task/Count-in-factors/Sidef/count-in-factors.sidef @@ -0,0 +1,29 @@ +class Counter { + method factors(n, p=2) { + var out = []; + while (n >= p*p) { + while (n % p == 0) { + out.append(p); + n /= p; + } + p = self.next_prime(p); + } + (n > 1 || out.len.is_zero) && out.append(n); + return out; + } + + method is_prime(n) { + self.factors(n).len == 1 + } + + method next_prime(p) { + do { + p == 2 ? (p = 3) : (p+=2) + } while (!self.is_prime(p)); + return p; + } +} + +100.times { |i| + say "#{i} = #{Counter().factors(i).join(' × ')}"; +} diff --git a/Task/Count-in-octal/FreeBASIC/count-in-octal.freebasic b/Task/Count-in-octal/FreeBASIC/count-in-octal.freebasic new file mode 100644 index 0000000000..29886850b2 --- /dev/null +++ b/Task/Count-in-octal/FreeBASIC/count-in-octal.freebasic @@ -0,0 +1,10 @@ +' FB 1.05.0 Win64 + +Dim ub As UByte = 0 ' only has a range of 0 to 255 +Do + Print Oct(ub, 3) + ub += 1 +Loop Until ub = 0 ' wraps around to 0 when reaches 256 +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Count-in-octal/Futhark/count-in-octal.futhark b/Task/Count-in-octal/Futhark/count-in-octal.futhark new file mode 100644 index 0000000000..688984ee50 --- /dev/null +++ b/Task/Count-in-octal/Futhark/count-in-octal.futhark @@ -0,0 +1,9 @@ +fun octal(x: int): int = + loop ((out,mult,x) = (0,1,x)) = while x > 0 do + let digit = x % 8 + let out = out + digit * mult + in (out, mult * 10, x / 8) + in out + +fun main(n: int): [n]int = + map octal (iota n) diff --git a/Task/Count-in-octal/FutureBasic/count-in-octal.futurebasic b/Task/Count-in-octal/FutureBasic/count-in-octal.futurebasic new file mode 100644 index 0000000000..395cd9779d --- /dev/null +++ b/Task/Count-in-octal/FutureBasic/count-in-octal.futurebasic @@ -0,0 +1,8 @@ +include "ConsoleWindow +defstr word + +dim as short i + +for i = &o000000 to &o000031 // 0 to 25 in decimal + print oct$(i); " in octal ="; i +next diff --git a/Task/Count-in-octal/LFE/count-in-octal.lfe b/Task/Count-in-octal/LFE/count-in-octal.lfe new file mode 100644 index 0000000000..3a73c86dcb --- /dev/null +++ b/Task/Count-in-octal/LFE/count-in-octal.lfe @@ -0,0 +1,4 @@ +(: lists foreach + (lambda (x) + (: io format '"~p~n" (list (: erlang integer_to_list x 8)))) + (: lists seq 0 2000)) diff --git a/Task/Count-in-octal/Nim/count-in-octal.nim b/Task/Count-in-octal/Nim/count-in-octal.nim new file mode 100644 index 0000000000..65b79e7606 --- /dev/null +++ b/Task/Count-in-octal/Nim/count-in-octal.nim @@ -0,0 +1,3 @@ +import strutils +for i in 0 .. 0 + oct = w & 7 + w = floor(w / 8) + output = string(oct) + output + end + return output diff --git a/Task/Count-in-octal/Sidef/count-in-octal.sidef b/Task/Count-in-octal/Sidef/count-in-octal.sidef new file mode 100644 index 0000000000..0fcd7ac5ff --- /dev/null +++ b/Task/Count-in-octal/Sidef/count-in-octal.sidef @@ -0,0 +1,2 @@ +var i = 0; +loop { say i++.as_oct } diff --git a/Task/Count-in-octal/Sparkling/count-in-octal.sparkling b/Task/Count-in-octal/Sparkling/count-in-octal.sparkling new file mode 100644 index 0000000000..b13261b6dc --- /dev/null +++ b/Task/Count-in-octal/Sparkling/count-in-octal.sparkling @@ -0,0 +1,3 @@ +for (var i = 0; true; i++) { + printf("%o\n", i); +} diff --git a/Task/Count-in-octal/Swift/count-in-octal.swift b/Task/Count-in-octal/Swift/count-in-octal.swift new file mode 100644 index 0000000000..de350ecaf8 --- /dev/null +++ b/Task/Count-in-octal/Swift/count-in-octal.swift @@ -0,0 +1,28 @@ +import Foundation + +func octalSuccessor(value: String) -> String { + if value.isEmpty { + return "1" + } else { + let i = value.startIndex, j = value.endIndex.predecessor() + switch (value[j]) { + case "0": return value[i..= 0) { + count++; + str = str.substring(index+substrLen); + index = str.indexOf(substr); +} +System.debug('Count String : '+count); diff --git a/Task/Count-occurrences-of-a-substring/EchoLisp/count-occurrences-of-a-substring.echolisp b/Task/Count-occurrences-of-a-substring/EchoLisp/count-occurrences-of-a-substring.echolisp new file mode 100644 index 0000000000..11607088ed --- /dev/null +++ b/Task/Count-occurrences-of-a-substring/EchoLisp/count-occurrences-of-a-substring.echolisp @@ -0,0 +1,8 @@ +;; from Racket +(define count-substring + (compose length regexp-match*)) + +(count-substring "aab" "graabaabdfaabgh") ;; substring + → 3 +(count-substring "/ .e/" "Longtemps je me suis couché de bonne heure") ;; regexp + → 4 diff --git a/Task/Count-occurrences-of-a-substring/FreeBASIC/count-occurrences-of-a-substring.freebasic b/Task/Count-occurrences-of-a-substring/FreeBASIC/count-occurrences-of-a-substring.freebasic new file mode 100644 index 0000000000..7f15fe5a8c --- /dev/null +++ b/Task/Count-occurrences-of-a-substring/FreeBASIC/count-occurrences-of-a-substring.freebasic @@ -0,0 +1,20 @@ +' FB 1.05.0 Win64 + +Function countSubstring(s As String, search As String) As Integer + If s = "" OrElse search = "" Then Return 0 + Dim As Integer count = 0, length = Len(search) + For i As Integer = 1 To Len(s) + If Mid(s, i, length) = Search Then + count += 1 + i += length - 1 + End If + Next + Return count +End Function + +Print countSubstring("the three truths","th") +Print countSubstring("ababababab","abab") +Print countSubString("zzzzzzzzzzzzzzz", "z") +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Count-occurrences-of-a-substring/FunL/count-occurrences-of-a-substring.funl b/Task/Count-occurrences-of-a-substring/FunL/count-occurrences-of-a-substring.funl new file mode 100644 index 0000000000..1d26ac34de --- /dev/null +++ b/Task/Count-occurrences-of-a-substring/FunL/count-occurrences-of-a-substring.funl @@ -0,0 +1,6 @@ +import util.Regex + +def countSubstring( str, substr ) = Regex( substr ).findAllMatchIn( str ).length() + +println( countSubstring("the three truths", "th") ) +println( countSubstring("ababababab", "abab") ) diff --git a/Task/Count-occurrences-of-a-substring/Lasso/count-occurrences-of-a-substring.lasso b/Task/Count-occurrences-of-a-substring/Lasso/count-occurrences-of-a-substring.lasso new file mode 100644 index 0000000000..fd0935723a --- /dev/null +++ b/Task/Count-occurrences-of-a-substring/Lasso/count-occurrences-of-a-substring.lasso @@ -0,0 +1,26 @@ +define countSubstring(str::string, substr::string)::integer => { + local(i = 1, foundpos = -1, found = 0) + while(#i < #str->size && #foundpos != 0) => { + protect => { + handle_error => { #foundpos = 0 } + #foundpos = #str->find(#substr, -offset=#i) + } + if(#foundpos > 0) => { + #found += 1 + #i = #foundpos + #substr->size + else + #i++ + } + } + return #found +} +define countSubstring_bothways(str::string, substr::string)::integer => { + local(found = countSubstring(#str,#substr)) + #str->reverse + local(found2 = countSubstring(#str,#substr)) + #found > #found2 ? return #found | return #found2 +} +countSubstring_bothways('the three truths','th') +//3 +countSubstring_bothways('ababababab','abab') +//2 diff --git a/Task/Count-occurrences-of-a-substring/Nim/count-occurrences-of-a-substring.nim b/Task/Count-occurrences-of-a-substring/Nim/count-occurrences-of-a-substring.nim new file mode 100644 index 0000000000..b0ae519f5b --- /dev/null +++ b/Task/Count-occurrences-of-a-substring/Nim/count-occurrences-of-a-substring.nim @@ -0,0 +1,14 @@ +import strutils + +proc count(s, sub): int = + var i = 0 + while true: + i = s.find(sub, i) + if i < 0: + break + i += sub.len # i += 1 for overlapping substrings + inc result + +echo count("the three truths","th") + +echo count("ababababab","abab") diff --git a/Task/Count-occurrences-of-a-substring/Oforth/count-occurrences-of-a-substring.oforth b/Task/Count-occurrences-of-a-substring/Oforth/count-occurrences-of-a-substring.oforth new file mode 100644 index 0000000000..54d987c30b --- /dev/null +++ b/Task/Count-occurrences-of-a-substring/Oforth/count-occurrences-of-a-substring.oforth @@ -0,0 +1,3 @@ +: countSubString(s, sub) + 0 1 while(sub swap s indexOfAllFrom dup notNull) [ sub size + 1 under+ ] + drop ; diff --git a/Task/Count-occurrences-of-a-substring/Phix/count-occurrences-of-a-substring.phix b/Task/Count-occurrences-of-a-substring/Phix/count-occurrences-of-a-substring.phix new file mode 100644 index 0000000000..65e014fa46 --- /dev/null +++ b/Task/Count-occurrences-of-a-substring/Phix/count-occurrences-of-a-substring.phix @@ -0,0 +1,20 @@ +sequence tests = {{"the three truths","th"}, + {"ababababab","abab"}, + {"ababababab","aba"}, + {"ababababab","ab"}, + {"ababababab","a"}, + {"ababababab",""}} +integer start, count +string test, substring +for i=1 to length(tests) do + start = 1 + count = 0 + {test, substring} = tests[i] + while 1 do + start = match(substring,test,start) + if start=0 then exit end if + start += length(substring) + count += 1 + end while + printf(1,"The string \"%s\" occurs as a non-overlapping substring %d times in \"%s\"\n",{substring,count,test}) +end for diff --git a/Task/Count-occurrences-of-a-substring/Ring/count-occurrences-of-a-substring.ring b/Task/Count-occurrences-of-a-substring/Ring/count-occurrences-of-a-substring.ring new file mode 100644 index 0000000000..9544b80ae9 --- /dev/null +++ b/Task/Count-occurrences-of-a-substring/Ring/count-occurrences-of-a-substring.ring @@ -0,0 +1,11 @@ +aString = "Ring Welcome Ring to the Ring Ring Programming Ring Language Ring" +bString = "Ring" +see count(aString,bString) + +func count cString,dString + sum = 0 + while substr(cString,dString) > 0 + sum++ + cString = substr(cString,substr(cString,dString)+len(string(sum))) + end + return sum diff --git a/Task/Count-occurrences-of-a-substring/Sidef/count-occurrences-of-a-substring-1.sidef b/Task/Count-occurrences-of-a-substring/Sidef/count-occurrences-of-a-substring-1.sidef new file mode 100644 index 0000000000..ff80fbd60e --- /dev/null +++ b/Task/Count-occurrences-of-a-substring/Sidef/count-occurrences-of-a-substring-1.sidef @@ -0,0 +1,2 @@ +say "the three truths".count("th"); +say "ababababab".count("abab"); diff --git a/Task/Count-occurrences-of-a-substring/Sidef/count-occurrences-of-a-substring-2.sidef b/Task/Count-occurrences-of-a-substring/Sidef/count-occurrences-of-a-substring-2.sidef new file mode 100644 index 0000000000..b16f849bb0 --- /dev/null +++ b/Task/Count-occurrences-of-a-substring/Sidef/count-occurrences-of-a-substring-2.sidef @@ -0,0 +1,9 @@ +func countSubstring(s, ss) { + var re = Regex.new(ss.escape, 'g'); # 'g' for global + var counter = 0; + while (s =~ re) { ++counter }; + return counter; +} + +say countSubstring("the three truths","th"); +say countSubstring("ababababab","abab"); diff --git a/Task/Count-occurrences-of-a-substring/Wortel/count-occurrences-of-a-substring.wortel b/Task/Count-occurrences-of-a-substring/Wortel/count-occurrences-of-a-substring.wortel new file mode 100644 index 0000000000..bcff564e6f --- /dev/null +++ b/Task/Count-occurrences-of-a-substring/Wortel/count-occurrences-of-a-substring.wortel @@ -0,0 +1,8 @@ +@let { + c &[s t] #!s.match &(t)g + + [[ + !!c "the three truths" "th" + !!c "ababababab" "abab" + ]] +} diff --git a/Task/Count-occurrences-of-a-substring/jq/count-occurrences-of-a-substring-1.jq b/Task/Count-occurrences-of-a-substring/jq/count-occurrences-of-a-substring-1.jq new file mode 100644 index 0000000000..1c68d4be02 --- /dev/null +++ b/Task/Count-occurrences-of-a-substring/jq/count-occurrences-of-a-substring-1.jq @@ -0,0 +1,2 @@ +def countSubstring(sub): + [match(sub; "g")] | length; diff --git a/Task/Count-occurrences-of-a-substring/jq/count-occurrences-of-a-substring-2.jq b/Task/Count-occurrences-of-a-substring/jq/count-occurrences-of-a-substring-2.jq new file mode 100644 index 0000000000..82b80c37c5 --- /dev/null +++ b/Task/Count-occurrences-of-a-substring/jq/count-occurrences-of-a-substring-2.jq @@ -0,0 +1 @@ +"the three truths" | countSubstring("th") diff --git a/Task/Count-the-coins/Coco/count-the-coins.coco b/Task/Count-the-coins/Coco/count-the-coins.coco new file mode 100644 index 0000000000..8252a3d87f --- /dev/null +++ b/Task/Count-the-coins/Coco/count-the-coins.coco @@ -0,0 +1,8 @@ +changes = (amount, coins) -> + ways = [1].concat [0] * amount + for coin of coins + for j from coin to amount + ways[j] += ways[j - coin] + ways[amount] + +console.log changes 100, [1 5 10 25] diff --git a/Task/Count-the-coins/EchoLisp/count-the-coins-1.echolisp b/Task/Count-the-coins/EchoLisp/count-the-coins-1.echolisp new file mode 100644 index 0000000000..f0a39340be --- /dev/null +++ b/Task/Count-the-coins/EchoLisp/count-the-coins-1.echolisp @@ -0,0 +1,20 @@ +(lib 'compile) ;; for (compile) +(lib 'bigint) ;; integer results > 32 bits +(lib 'hash) ;; hash table + +;; h-table +(define Hcoins (make-hash)) + +;; the function to memoize +(define (sumways cents coins) + (+ (ways cents (cdr coins)) (ways (- cents (car coins)) coins))) + +;; accelerator : ways (cents, coins) = ways ((cents - cents % 5) , coins) +(define (ways cents coins) + (cond ((null? coins) 0) + ((negative? cents) 0) + ((zero? cents) 1) + ((eq? coins c-1) 1) ;; if coins = (1) --> 1 + (else (hash-ref! Hcoins (list (- cents (modulo cents 5)) coins) sumways)))) + +(compile 'ways) ;; speed-up things diff --git a/Task/Count-the-coins/EchoLisp/count-the-coins-2.echolisp b/Task/Count-the-coins/EchoLisp/count-the-coins-2.echolisp new file mode 100644 index 0000000000..3a3dc58a39 --- /dev/null +++ b/Task/Count-the-coins/EchoLisp/count-the-coins-2.echolisp @@ -0,0 +1,31 @@ +(define change '(25 10 5 1)) +(define c-1 (list-tail change -1)) ;; pointer to (1) +(ways 100 change) + → 242 + +(define change '(100 50 25 10 5 1)) +(define c-1 (list-tail change -1)) +(for ((i (in-range 0 200001 20000))) + (writeln i (time (ways i change)) (hash-count Hcoins))) + + +;; iterate cents = 20000, 40000, .. +;; cents ((time (msec) number-of-ways) number-of-entries-in-h-table + +20000 (350 4371565890901) 9398 +40000 (245 138204514221801) 18798 +60000 (230 1045248220992701) 28198 +80000 (255 4395748062203601) 37598 +100000 (234 13398445413854501) 46998 +120000 (230 33312577651945401) 56398 +140000 (292 71959878152476301) 65798 +160000 (736 140236576291447201) 75198 +180000 (237 252625397444858101) 84598 +200000 (240 427707562988709001) 93998 + +;; One can see that the time is linear, and the h-table size reasonably small + +change + → (100 50 25 10 5 1) +(ways 100000 change) + → 13398445413854501 diff --git a/Task/Count-the-coins/FreeBASIC/count-the-coins.freebasic b/Task/Count-the-coins/FreeBASIC/count-the-coins.freebasic new file mode 100644 index 0000000000..88e7b379f7 --- /dev/null +++ b/Task/Count-the-coins/FreeBASIC/count-the-coins.freebasic @@ -0,0 +1,66 @@ +' version 09-10-2016 +' compile with: fbc -s console + + +Function count(S() As UInteger, n As UInteger) As ULongInt + + Dim As Integer i, j + ' calculate m from array S() + Dim As UInteger m = UBound(S) - LBound(S) +1 + Dim As ULongInt x, y + + '' We need n+1 rows as the table is consturcted in bottom up manner using + '' the base case 0 value case (n = 0) + Dim As ULongInt table(n +1, m) + + '' Fill the enteries for 0 value case (n = 0) + For i = 0 To m -1 + table(0, i) = 1 + Next + + '' Fill rest of the table enteries in bottom up manner + For i = 1 To n + For j = 0 To m -1 + '' Count of solutions including S[j] + x = IIf (i >= S(j), table(i - S(j), j), 0) + '' Count of solutions excluding S[j] + y = IIf (j >= 1, table(i, j -1), 0) + ''total count + table(i, j) = x + y + Next + Next + + Return table(n, m -1) + +End Function + +' ------=< MAIN >=------ + +Dim As UInteger n +Dim As UInteger value() + +ReDim value(3) +value(0) = 1 : value(1) = 5 : value(2) = 10 : value(3) = 25 + +n = 100 +print +Print " There are "; count(value(), n); " ways to make change for $";n/100;" with 4 coins" +Print + +n = 100000 +Print " There are "; count(value(), n); " ways to make change for $";n/100;" with 4 coins" +Print + +ReDim value(5) +value(0) = 1 : value(1) = 5 : value(2) = 10 +value(3) = 25 : value(4) = 50 : value(5) = 100 + +n = 100000 +Print " There are "; count(value(), n); " ways to make change for $";n/100;" with 6 coins" +Print + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Count-the-coins/FutureBasic/count-the-coins.futurebasic b/Task/Count-the-coins/FutureBasic/count-the-coins.futurebasic new file mode 100644 index 0000000000..2144e48b2f --- /dev/null +++ b/Task/Count-the-coins/FutureBasic/count-the-coins.futurebasic @@ -0,0 +1,20 @@ +include "ConsoleWindow" + +dim as long penny, nickel, dime, quarter , count + +penny = 1 : nickel = 1 +dime = 1 : quarter = 1 + +for penny = 0 to 100 + for nickel = 0 to 20 + for dime = 0 to 10 + for quarter = 0 to 4 + if penny + nickel * 5 + dime * 10 + quarter * 25 == 100 + print penny; " pennies "; nickel;" nickels "; dime; " dimes "; quarter; " quarters" + count++ + end if + next quarter + next dime + next nickel +next penny +print count;" ways to make a dollar" diff --git a/Task/Count-the-coins/Lasso/count-the-coins.lasso b/Task/Count-the-coins/Lasso/count-the-coins.lasso new file mode 100644 index 0000000000..5d0a62729c --- /dev/null +++ b/Task/Count-the-coins/Lasso/count-the-coins.lasso @@ -0,0 +1,30 @@ +define cointcoins( + target::integer, + operands::array +) => { + + local( + targetlength = #target + 1, + operandlength = #operands -> size, + output = staticarray_join(#targetlength,0), + outerloopcount + ) + + #output -> get(1) = 1 + + loop(#operandlength) => { + #outerloopcount = loop_count + loop(#targetlength) => { + + if(loop_count >= #operands -> get(#outerloopcount) and loop_count - #operands -> get(#outerloopcount) > 0) => { + #output -> get(loop_count) += #output -> get(loop_count - #operands -> get(#outerloopcount)) + } + } + } + + return #output -> get(#targetlength) +} + +cointcoins(100, array(1,5,10,25,)) +'
' +cointcoins(100000, array(1, 5, 10, 25, 50, 100)) diff --git a/Task/Count-the-coins/Nim/count-the-coins.nim b/Task/Count-the-coins/Nim/count-the-coins.nim new file mode 100644 index 0000000000..97d3f372a2 --- /dev/null +++ b/Task/Count-the-coins/Nim/count-the-coins.nim @@ -0,0 +1,10 @@ +proc changes(amount, coins): int = + var ways = @[1] + ways.setLen(amount+1) + for coin in coins: + for j in coin..amount: + ways[j] += ways[j-coin] + ways[amount] + +echo changes(100, [1, 5, 10, 25]) +echo changes(100000, [1, 5, 10, 25, 50, 100]) diff --git a/Task/Count-the-coins/Sidef/count-the-coins.sidef b/Task/Count-the-coins/Sidef/count-the-coins.sidef new file mode 100644 index 0000000000..1ff6d90a40 --- /dev/null +++ b/Task/Count-the-coins/Sidef/count-the-coins.sidef @@ -0,0 +1,17 @@ +func cc(_) { 0 } +func cc({ .is_neg }, *_) { 0 } +func cc({ .is_zero }, *_) { 1 } + +func cc(amount, first, *rest) is cached { + cc(amount, rest...) + cc(amount - first, first, rest...); +} + +func cc_optimized(amount, *rest) { + cc(amount, rest.sort_by{|v| -v }...); +} + +var x = cc_optimized(100, 1, 5, 10, 25); +say "Ways to change $1 with common coins: #{x}"; + +var y = cc_optimized(1000 * 100, 1, 5, 10, 25, 50, 100); +say "Ways to change $1000 with addition of less common coins: #{y}"; diff --git a/Task/Count-the-coins/jq/count-the-coins.jq b/Task/Count-the-coins/jq/count-the-coins.jq new file mode 100644 index 0000000000..8bf7ae86c7 --- /dev/null +++ b/Task/Count-the-coins/jq/count-the-coins.jq @@ -0,0 +1,16 @@ +# How many ways are there to make "target" cents, given a list of coin +# denominations as input. +# The strategy is to record at total[n] the number of ways to make n cents. +def countcoins(target): + . as $coin + | reduce range(0; length) as $a + ( [1]; # there is 1 way to make 0 cents + reduce range(1; target + 1) as $b + (.; # total[] + if $b < $coin[$a] then . + else .[$b - $coin[$a]] as $count + | if $count == 0 then . + else .[$b] += $count + end + end ) ) + | .[target] ; diff --git a/Task/Create-a-file-on-magnetic-tape/Nim/create-a-file-on-magnetic-tape.nim b/Task/Create-a-file-on-magnetic-tape/Nim/create-a-file-on-magnetic-tape.nim new file mode 100644 index 0000000000..34db793810 --- /dev/null +++ b/Task/Create-a-file-on-magnetic-tape/Nim/create-a-file-on-magnetic-tape.nim @@ -0,0 +1,3 @@ +var t = open("/dev/tape", fmWrite) +t.writeln "Hi Tape!" +t.close diff --git a/Task/Create-a-file/Axe/create-a-file.axe b/Task/Create-a-file/Axe/create-a-file.axe new file mode 100644 index 0000000000..0a694398b5 --- /dev/null +++ b/Task/Create-a-file/Axe/create-a-file.axe @@ -0,0 +1 @@ +GetCalc("appvOUTPUT",0) diff --git a/Task/Create-a-file/ChucK/create-a-file.chuck b/Task/Create-a-file/ChucK/create-a-file.chuck new file mode 100644 index 0000000000..ce4e368c1a --- /dev/null +++ b/Task/Create-a-file/ChucK/create-a-file.chuck @@ -0,0 +1,2 @@ +FileIO text; +text.open("output.txt", FileIO.WRITE); diff --git a/Task/Create-a-file/ERRE/create-a-file.erre b/Task/Create-a-file/ERRE/create-a-file.erre new file mode 100644 index 0000000000..e56ffbd381 --- /dev/null +++ b/Task/Create-a-file/ERRE/create-a-file.erre @@ -0,0 +1,14 @@ +PROGRAM FILE_TEST + +!$INCLUDE="PC.LIB" + +BEGIN + + OPEN("O",#1,"output.txt") + CLOSE(1) + + OS_MKDIR("C:\RC") ! with the appropriate access rights ....... + OPEN("O",#1,"C:\RC\output.txt") + CLOSE(1) + +END PROGRAM diff --git a/Task/Create-a-file/EchoLisp/create-a-file.echolisp b/Task/Create-a-file/EchoLisp/create-a-file.echolisp new file mode 100644 index 0000000000..fc80d40f1b --- /dev/null +++ b/Task/Create-a-file/EchoLisp/create-a-file.echolisp @@ -0,0 +1,15 @@ +;; The file system is the browser local storage +;; It is divided into named stores (directories) +;; "user" is the default (home) store + +; before : list of stores +(local-stores) → ("system" "user" "words" "reader" "info" "root") + +(local-put-value "output.txt" "") → "output.txt" ; into "user" +(local-make-store "user/docs") → "user/docs" +(local-put-value "output.txt" "" "root") → "output.txt" ; into "root" +(local-make-store 'root/docs) → "root/docs" + +; after : list of stores +(local-stores 'root) → ("root" "root/docs") +(local-stores 'user) → ("user" "user/docs") diff --git a/Task/Create-a-file/FreeBASIC/create-a-file.freebasic b/Task/Create-a-file/FreeBASIC/create-a-file.freebasic new file mode 100644 index 0000000000..5462cf2618 --- /dev/null +++ b/Task/Create-a-file/FreeBASIC/create-a-file.freebasic @@ -0,0 +1,15 @@ +' FB 1.05.0 Win64 + +' create empty file and sub-directory in current directory +Open "output.txt" For Output As #1 +Close #1 +MkDir "docs" + +' create empty file and sub-directory in root directory c:\ +' creating file in root requires administrative privileges in Windows 10 +Open "c:\output.txt" For Output As #1 +Close #1 +MkDir "c:\docs" + +Print "Press any key to quit" +Sleep diff --git a/Task/Create-a-file/FunL/create-a-file.funl b/Task/Create-a-file/FunL/create-a-file.funl new file mode 100644 index 0000000000..208e778b48 --- /dev/null +++ b/Task/Create-a-file/FunL/create-a-file.funl @@ -0,0 +1,6 @@ +import io.File + +File( 'output.txt' ).createNewFile() +File( File.separator + 'output.txt' ).createNewFile() +File( 'docs' ).mkdir() +File( File.separator + 'docs' ).mkdir() diff --git a/Task/Create-a-file/I/create-a-file.i b/Task/Create-a-file/I/create-a-file.i new file mode 100644 index 0000000000..af3b738e30 --- /dev/null +++ b/Task/Create-a-file/I/create-a-file.i @@ -0,0 +1,17 @@ +function create( ""filename ) { +! var file = open(filename) + file("") + issues { + print("Failed to create "+filename) + return + } + print(filename+" created!") + close(file) +} + +software { + create("output.txt") + create("docs/") + create("/output.txt") + create("/docs/") +} diff --git a/Task/Create-a-file/LFE/create-a-file.lfe b/Task/Create-a-file/LFE/create-a-file.lfe new file mode 100644 index 0000000000..a19a84b983 --- /dev/null +++ b/Task/Create-a-file/LFE/create-a-file.lfe @@ -0,0 +1,4 @@ +(: file write_file '"output.txt" '"Some data") +(: file make_dir '"docs") +(: file write_file '"/output.txt" '"Some data") +(: file make_dir '"/docs") diff --git a/Task/Create-a-file/Lasso/create-a-file.lasso b/Task/Create-a-file/Lasso/create-a-file.lasso new file mode 100644 index 0000000000..59b29b0c7a --- /dev/null +++ b/Task/Create-a-file/Lasso/create-a-file.lasso @@ -0,0 +1,17 @@ +// create file +local(f) = file +handle => { #f->close } +#f->openWriteOnly('output.txt') + +// make directory, just like a file +local(d = dir('docs')) +#d->create + +// create file in root file system (requires permissions at user OS level) +local(f) = file +handle => { #f->close } +#f->openWriteOnly('//output.txt') + +// create directory in root file system (requires permissions at user OS level) +local(d = dir('//docs')) +#d->create diff --git a/Task/Create-a-file/Lingo/create-a-file-1.lingo b/Task/Create-a-file/Lingo/create-a-file-1.lingo new file mode 100644 index 0000000000..7c292b1c1a --- /dev/null +++ b/Task/Create-a-file/Lingo/create-a-file-1.lingo @@ -0,0 +1,3 @@ +-- note: fileIO xtra is shipped with Director, i.e. an "internal" +fp = xtra("fileIO").new() +fp.createFile("output.txt") diff --git a/Task/Create-a-file/Lingo/create-a-file-2.lingo b/Task/Create-a-file/Lingo/create-a-file-2.lingo new file mode 100644 index 0000000000..32f5e4087b --- /dev/null +++ b/Task/Create-a-file/Lingo/create-a-file-2.lingo @@ -0,0 +1,6 @@ +-- note: fileIO xtra is shipped with Director, i.e. an "internal" +pd = the last char of _movie.path -- "\" for win, ":" for mac +_player.itemDelimiter = pd +vol = _movie.path.item[1] +fp = xtra("fileIO").new() +fp.createFile(vol&pd&"output.txt") diff --git a/Task/Create-a-file/Lingo/create-a-file-3.lingo b/Task/Create-a-file/Lingo/create-a-file-3.lingo new file mode 100644 index 0000000000..163b3a6552 --- /dev/null +++ b/Task/Create-a-file/Lingo/create-a-file-3.lingo @@ -0,0 +1,3 @@ +shell_cmd("mkdir Docs") -- in cwd, both win and mac +shell_cmd("mkdir \Docs") -- win +shell_cmd("mkdir /Docs") -- mac diff --git a/Task/Create-a-file/Nim/create-a-file-1.nim b/Task/Create-a-file/Nim/create-a-file-1.nim new file mode 100644 index 0000000000..c71ef2625e --- /dev/null +++ b/Task/Create-a-file/Nim/create-a-file-1.nim @@ -0,0 +1,7 @@ +import os + +open("output.txt", fmWrite).close() +createDir("docs") + +open(DirSep & "output.txt", fmWrite).close() +createDir(DirSep & "docs") diff --git a/Task/Create-a-file/Nim/create-a-file-2.nim b/Task/Create-a-file/Nim/create-a-file-2.nim new file mode 100644 index 0000000000..365dab9ba1 --- /dev/null +++ b/Task/Create-a-file/Nim/create-a-file-2.nim @@ -0,0 +1,5 @@ +import os +const directories = ["/", "./"] +for directory in directories: + open(directory & "output.txt", fmWrite).close() + createDir(directory & "docs") diff --git a/Task/Create-a-file/Phix/create-a-file.phix b/Task/Create-a-file/Phix/create-a-file.phix new file mode 100644 index 0000000000..0d807bdf49 --- /dev/null +++ b/Task/Create-a-file/Phix/create-a-file.phix @@ -0,0 +1,15 @@ +integer fn + +-- In the current working directory +system("mkdir docs",2) +fn = open("output.txt","w") +close(fn) + +-- In the filesystem root +system("mkdir \\docs",2) +fn = open("\\output.txt","w") +if fn=-1 then + puts(1,"unable to create \\output.txt\n") +else + close(fn) +end if diff --git a/Task/Create-a-file/Ring/create-a-file.ring b/Task/Create-a-file/Ring/create-a-file.ring new file mode 100644 index 0000000000..c7a8242376 --- /dev/null +++ b/Task/Create-a-file/Ring/create-a-file.ring @@ -0,0 +1,4 @@ +system("mkdir C:\Ring\docs") +fopen("C:\Ring\docs\output.txt", "w+") +system("mkdir docs") +fopen("output.txt", "w+") diff --git a/Task/Create-a-file/Sidef/create-a-file.sidef b/Task/Create-a-file/Sidef/create-a-file.sidef new file mode 100644 index 0000000000..127ccf21eb --- /dev/null +++ b/Task/Create-a-file/Sidef/create-a-file.sidef @@ -0,0 +1,7 @@ +# Here +%f'output.txt' -> create; +%d'docs' -> create; + +# Root dir +Dir.root + %f'output.txt' -> create; +Dir.root + %d'docs' -> create; diff --git a/Task/Create-a-file/Ursa/create-a-file.ursa b/Task/Create-a-file/Ursa/create-a-file.ursa new file mode 100644 index 0000000000..9b3ec232ec --- /dev/null +++ b/Task/Create-a-file/Ursa/create-a-file.ursa @@ -0,0 +1,7 @@ +decl file f +f.create "output.txt" +f.createdir "docs" + +# in the root directory +f.create "/output.txt" +f.createdir "/docs" diff --git a/Task/Create-a-two-dimensional-array-at-runtime/ERRE/create-a-two-dimensional-array-at-runtime.erre b/Task/Create-a-two-dimensional-array-at-runtime/ERRE/create-a-two-dimensional-array-at-runtime.erre new file mode 100644 index 0000000000..642cb3dca5 --- /dev/null +++ b/Task/Create-a-two-dimensional-array-at-runtime/ERRE/create-a-two-dimensional-array-at-runtime.erre @@ -0,0 +1,12 @@ +PROGRAM DYNAMIC + +!$DYNAMIC +DIM A%[0,0] + +BEGIN + PRINT(CHR$(12);) !CLS + INPUT("Subscripts",R%,C%) + !$DIM A%[R%,C%] + A%[2,3]=6 + PRINT("Value in row";2;"and col";3;"is";A%[2,3]) +END PROGRAM diff --git a/Task/Create-a-two-dimensional-array-at-runtime/FreeBASIC/create-a-two-dimensional-array-at-runtime.freebasic b/Task/Create-a-two-dimensional-array-at-runtime/FreeBASIC/create-a-two-dimensional-array-at-runtime.freebasic new file mode 100644 index 0000000000..4b0a3d394e --- /dev/null +++ b/Task/Create-a-two-dimensional-array-at-runtime/FreeBASIC/create-a-two-dimensional-array-at-runtime.freebasic @@ -0,0 +1,11 @@ +' FB 1.05.0 Win64 + +Dim As Integer i, j +Input "Enter two positive integers, separated by a comma"; i, j +Dim a(1 To i, 1 To j) As Integer +a(i, j) = i * j +Print "a("; Str(i); ","; Str(j); ") ="; a(i, j) +Erase a +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Create-a-two-dimensional-array-at-runtime/Nim/create-a-two-dimensional-array-at-runtime.nim b/Task/Create-a-two-dimensional-array-at-runtime/Nim/create-a-two-dimensional-array-at-runtime.nim new file mode 100644 index 0000000000..6f664cddb9 --- /dev/null +++ b/Task/Create-a-two-dimensional-array-at-runtime/Nim/create-a-two-dimensional-array-at-runtime.nim @@ -0,0 +1,9 @@ +import strutils, rdstdin + +var + w = readLineFromStdin("Width: ").parseInt() + h = readLineFromStdin("Height: ").parseInt() + s = newSeq[seq[int]](h) + +for i in 0 .. < h: + s[i].newSeq(w) diff --git a/Task/Create-a-two-dimensional-array-at-runtime/Phix/create-a-two-dimensional-array-at-runtime.phix b/Task/Create-a-two-dimensional-array-at-runtime/Phix/create-a-two-dimensional-array-at-runtime.phix new file mode 100644 index 0000000000..da05a27579 --- /dev/null +++ b/Task/Create-a-two-dimensional-array-at-runtime/Phix/create-a-two-dimensional-array-at-runtime.phix @@ -0,0 +1,13 @@ +sequence array +integer height,width,i,j + +height = floor(prompt_number("Enter height: ")) +width = floor(prompt_number("Enter width: ")) + +array = repeat(repeat(0,width),height) + +i = floor(height/2+0.5) +j = floor(width/2+0.5) +array[i][j] = height + width + +printf(1,"array[%d][%d] is %d\n", {i,j,array[i][j]}) diff --git a/Task/Create-a-two-dimensional-array-at-runtime/Ring/create-a-two-dimensional-array-at-runtime.ring b/Task/Create-a-two-dimensional-array-at-runtime/Ring/create-a-two-dimensional-array-at-runtime.ring new file mode 100644 index 0000000000..8cbed048f7 --- /dev/null +++ b/Task/Create-a-two-dimensional-array-at-runtime/Ring/create-a-two-dimensional-array-at-runtime.ring @@ -0,0 +1,5 @@ +See 'Enter width : ' give width +See 'Enter height : ' give height +width=0+width height=0+height +aList = list(height) for x in aList x = list(width) next +aList[1][2] = 10 See aList[1][2] + nl diff --git a/Task/Create-a-two-dimensional-array-at-runtime/Sidef/create-a-two-dimensional-array-at-runtime.sidef b/Task/Create-a-two-dimensional-array-at-runtime/Sidef/create-a-two-dimensional-array-at-runtime.sidef new file mode 100644 index 0000000000..795a561edc --- /dev/null +++ b/Task/Create-a-two-dimensional-array-at-runtime/Sidef/create-a-two-dimensional-array-at-runtime.sidef @@ -0,0 +1,10 @@ +func make_matrix(x, y) { + y.of { x.of(0) }; +} + +var y = Sys.scanln("rows: ").to_i; +var x = Sys.scanln("cols: ").to_i; + +var matrix = make_matrix(x, y); # create the matrix +matrix[y/2][x/2] = 1; # write something inside it +say matrix; # display the matrix diff --git a/Task/Create-a-two-dimensional-array-at-runtime/Swift/create-a-two-dimensional-array-at-runtime.swift b/Task/Create-a-two-dimensional-array-at-runtime/Swift/create-a-two-dimensional-array-at-runtime.swift new file mode 100644 index 0000000000..3841a77f8b --- /dev/null +++ b/Task/Create-a-two-dimensional-array-at-runtime/Swift/create-a-two-dimensional-array-at-runtime.swift @@ -0,0 +1,19 @@ +import Foundation + +print("Enter the dimensions of the array seperated by a space (width height): ") + +let fileHandle = NSFileHandle.fileHandleWithStandardInput() +let dims = NSString(data: fileHandle.availableData, encoding: NSUTF8StringEncoding)?.componentsSeparatedByString(" ") + +if let dims = dims where dims.count == 2{ + let w = dims[0].integerValue + let h = dims[1].integerValue + + if let w = w, h = h where w > 0 && h > 0 { + var array = Array<[Int!]>(count: h, repeatedValue: Array(count: w, repeatedValue: nil)) + + array[0][0] = 2 + println(array[0][0]) + println(array) + } +} diff --git a/Task/Create-a-two-dimensional-array-at-runtime/Ursa/create-a-two-dimensional-array-at-runtime.ursa b/Task/Create-a-two-dimensional-array-at-runtime/Ursa/create-a-two-dimensional-array-at-runtime.ursa new file mode 100644 index 0000000000..d32beb4c99 --- /dev/null +++ b/Task/Create-a-two-dimensional-array-at-runtime/Ursa/create-a-two-dimensional-array-at-runtime.ursa @@ -0,0 +1,19 @@ +decl int width height +out "width: " console +set width (in int console) +out "height: " console +set height (in int console) + +decl int<><> twodstream +for (decl int i) (< i height) (inc i) + append (new int<>) twodstream +end for +for (set i 0) (< i height) (inc i) + decl int j + for (set j 0) (< j width) (inc j) + append 0 twodstream + end for +end for + +set twodstream<0><0> 5 +out twodstream<0><0> endl console diff --git a/Task/Create-a-two-dimensional-array-at-runtime/jq/create-a-two-dimensional-array-at-runtime-1.jq b/Task/Create-a-two-dimensional-array-at-runtime/jq/create-a-two-dimensional-array-at-runtime-1.jq new file mode 100644 index 0000000000..92fc7ef47c --- /dev/null +++ b/Task/Create-a-two-dimensional-array-at-runtime/jq/create-a-two-dimensional-array-at-runtime-1.jq @@ -0,0 +1,11 @@ +# A function to create an m x n matrix +# filled with the input element +def matrix(m;n): + . as $init + | ( [ range(0; n + 1) ] | map($init)) as $row + | ( [ range(0; m + 1) ] | map($row)) + ; + +# Task: create a matrix with dimensions specified by the user +# and set the [1,2] element: +(0 | matrix($m|tonumber; $n|tonumber)) | setpath([1,2]; 99) diff --git a/Task/Create-a-two-dimensional-array-at-runtime/jq/create-a-two-dimensional-array-at-runtime-2.jq b/Task/Create-a-two-dimensional-array-at-runtime/jq/create-a-two-dimensional-array-at-runtime-2.jq new file mode 100644 index 0000000000..fa98902ace --- /dev/null +++ b/Task/Create-a-two-dimensional-array-at-runtime/jq/create-a-two-dimensional-array-at-runtime-2.jq @@ -0,0 +1 @@ +[[0,0,0,0],[0,0,99,0],[0,0,0,0]] diff --git a/Task/Create-an-HTML-table/EchoLisp/create-an-html-table-1.echolisp b/Task/Create-an-HTML-table/EchoLisp/create-an-html-table-1.echolisp new file mode 100644 index 0000000000..52aa802ab4 --- /dev/null +++ b/Task/Create-an-HTML-table/EchoLisp/create-an-html-table-1.echolisp @@ -0,0 +1,26 @@ +;; styles - +(style 'td "text-align:right") +(style 'table "border-spacing: 10px;border:1px solid red") +(style 'th "color:blue;") + +;; generic html5 builder +;; pushes (proc content) +(define (emit-tag tag html-proc content ) + (if (style tag) + (push html (format "<%s style='%a'>" tag (style tag))) + (push html (format "<%s>" tag ))) + (html-proc content) + (push html (format " " tag ))) + +;; html procs : 1 tag, 1 proc +(define (h-raw content) + (push html (format "%s" content))) +(define (h-header headers) + (for ((h headers)) (emit-tag 'th h-raw h))) +(define (h-row row) + (for ((item row)) (emit-tag 'td h-raw item))) +(define (h-table table ) + (emit-tag 'tr h-header (first table)) + ;; add row-num i at head of row + (for ((i 1000)(row (rest table))) (emit-tag 'tr h-row (cons i row)))) + diff --git a/Task/Create-an-HTML-table/EchoLisp/create-an-html-table-2.echolisp b/Task/Create-an-HTML-table/EchoLisp/create-an-html-table-2.echolisp new file mode 100644 index 0000000000..5d57b9d869 --- /dev/null +++ b/Task/Create-an-HTML-table/EchoLisp/create-an-html-table-2.echolisp @@ -0,0 +1,5 @@ +(define my-table '(("" X Y Z) (-1111 111 11) (22 -222 2222) (4422 0 42) (33 333 3333) (6666 666 66))) + +(stack (define html 'html)) ;; stack of html elements +(emit-tag 'table h-table my-table) +(string-join (stack->list html) " ") diff --git a/Task/Create-an-HTML-table/Lasso/create-an-html-table.lasso b/Task/Create-an-HTML-table/Lasso/create-an-html-table.lasso new file mode 100644 index 0000000000..738052d5ac --- /dev/null +++ b/Task/Create-an-HTML-table/Lasso/create-an-html-table.lasso @@ -0,0 +1,21 @@ +define rand4dig => integer_random(9999, 1) + +local( + output = '\n' +) + +with el in (' ,X,Y,Z') -> split(',') do { + #output -> append('') +} +#output -> append('\n') + +loop(5) => { + #output -> append('\n') + loop(3) => { + #output -> append('') + } + #output -> append('\n') +} +#output -> append('
' + #el + '
' + loop_count + '' + rand4dig + '
\n') + +#output diff --git a/Task/Create-an-HTML-table/Lingo/create-an-html-table-1.lingo b/Task/Create-an-HTML-table/Lingo/create-an-html-table-1.lingo new file mode 100644 index 0000000000..d1354c6c09 --- /dev/null +++ b/Task/Create-an-HTML-table/Lingo/create-an-html-table-1.lingo @@ -0,0 +1,25 @@ +on htmlTable (data) + str = "" + + -- table head + put "" after str + repeat with cell in data[1] + put "" after str + end repeat + put "" after str + + -- table body + put "" after str + cnt = data.count + repeat with i = 2 to cnt + put "" after str + repeat with cell in data[i] + put "" after str + end repeat + put "" after str + end repeat + put "" after str + + put "
 "&cell&"
"&(i-1)&""&cell&"
" after str + return str +end diff --git a/Task/Create-an-HTML-table/Lingo/create-an-html-table-2.lingo b/Task/Create-an-HTML-table/Lingo/create-an-html-table-2.lingo new file mode 100644 index 0000000000..d554f76796 --- /dev/null +++ b/Task/Create-an-HTML-table/Lingo/create-an-html-table-2.lingo @@ -0,0 +1,12 @@ +tableData = [\ + ["X", "Y", "Z"],\ + ["1", "2", "3"],\ + ["4", "5", "6"],\ + ["7", "8", "9"]\ +] + +htmlCode = htmlTable(tableData) + +-- render the result in a text member (which only supports simple/ancient HTML) +m = new(#text) +m.text = ""&htmlCode&"" diff --git a/Task/Create-an-HTML-table/Nim/create-an-html-table.nim b/Task/Create-an-HTML-table/Nim/create-an-html-table.nim new file mode 100644 index 0000000000..8f217ba39b --- /dev/null +++ b/Task/Create-an-HTML-table/Nim/create-an-html-table.nim @@ -0,0 +1,14 @@ +import math, htmlgen +randomize() + +template randTD(): expr = td($random(1000..9999)) +proc randTR(x): auto = + tr(td($x, style="font-weight: bold"), randTD, randTD, randTD) + +echo table( + tr(th"", th"X", th"Y", th"Z"), + randTR 1, + randTR 2, + randTR 3, + randTR 4, + randTR 5) diff --git a/Task/Create-an-HTML-table/Peloton/create-an-html-table.peloton b/Task/Create-an-HTML-table/Peloton/create-an-html-table.peloton new file mode 100644 index 0000000000..45b01ab02e --- /dev/null +++ b/Task/Create-an-HTML-table/Peloton/create-an-html-table.peloton @@ -0,0 +1,17 @@ +<@ SDCLIT> + <@ DTBLIT> + <@ DTRLITLIT> + <@ DTDLITLIT>|[style]background-color:white + <@ DTD>X + <@ DTD>Y + <@ DTD>Z|[style]width:100%; background-color:brown;color:white; text-align:center + <@ ITEFORLIT>10| + <@ DTRLITCAP> + <@ DTDPOSFORLIT>...|[style]background-color:Brown; color:white; text-align:right + <@ DTDCAPLIT><@ SAYR!ILI2>1|9999|[style]width:50;text-align:right + <@ DTDCAPLIT><@ SAYR!ILI2>1|9999|[style]width:50;text-align:right + <@ DTDCAPLIT><@ SAYR!ILI2>1|9999|[style]width:50;text-align:right + |[style]background-color:white;color:black + + +|Number Table diff --git a/Task/Create-an-HTML-table/Phix/create-an-html-table-1.phix b/Task/Create-an-HTML-table/Phix/create-an-html-table-1.phix new file mode 100644 index 0000000000..58b0daa52e --- /dev/null +++ b/Task/Create-an-HTML-table/Phix/create-an-html-table-1.phix @@ -0,0 +1,14 @@ +puts(1,"\n") +puts(1," ") +for j=1 to 3 do + printf(1,"",'W'+j) +end for +puts(1,"\n") +for i=1 to 3 do + printf(1," ",i) + for j=1 to 3 do + printf(1,"",rand(10000)) + end for + puts(1,"\n") +end for +puts(1,"
%s
%d%d
") diff --git a/Task/Create-an-HTML-table/Phix/create-an-html-table-2.phix b/Task/Create-an-HTML-table/Phix/create-an-html-table-2.phix new file mode 100644 index 0000000000..2303d2b690 --- /dev/null +++ b/Task/Create-an-HTML-table/Phix/create-an-html-table-2.phix @@ -0,0 +1,7 @@ + +
+ + + + +
XYZ
1328764806510
2850019085352
3328766003953
diff --git a/Task/Create-an-HTML-table/Sidef/create-an-html-table.sidef b/Task/Create-an-HTML-table/Sidef/create-an-html-table.sidef new file mode 100644 index 0000000000..b0b74dcbbf --- /dev/null +++ b/Task/Create-an-HTML-table/Sidef/create-an-html-table.sidef @@ -0,0 +1,50 @@ +class HTML { + method _attr(Hash h) { + h.keys.sort.map {|k| %Q' #{k}="#{h{k}}"' }.join('') + } + + method _tag(Hash h, name, value) { + "<#{name}" + self._attr(h) + '>' + value + "" + } + + method table(Hash h, *data) { self._tag(h, 'table', data.join('')) } + method table(*data) { self.table(Hash(), data...) } +} + +class Table < HTML { + method th(Hash h, value) { self._tag(h, 'th', value) } + method th(value) { self.th(Hash(), value) } + + method tr(Hash h, *rows) { self._tag(h, 'tr', rows.join('')) } + method tr(*rows) { self.tr(Hash(), rows...) } + + method td(Hash h, value) { self._tag(h, 'td', value) } + method td(value) { self.td(Hash(), value) } +} + +var header = %w(  X Y Z); +var rows = 5; + +var html = HTML.new; +var table = Table.new; + +say html.table( + # attributes + Hash( + cellspacing => 4, + style => "text-align:right; border: 1px solid;" + ), + + # header + table.tr(header.map{|elem| table.th(elem)}...), + + # rows + (1..rows).map { |i| + table.tr( + table.td(:(align => 'right'), i), + (header.len - 1).of { + table.td(Hash(align => 'right'), 10000.rand.int) + }... + ) + }... +); diff --git a/Task/Create-an-HTML-table/Ursa/create-an-html-table.ursa b/Task/Create-an-HTML-table/Ursa/create-an-html-table.ursa new file mode 100644 index 0000000000..6972068095 --- /dev/null +++ b/Task/Create-an-HTML-table/Ursa/create-an-html-table.ursa @@ -0,0 +1,18 @@ +decl ursa.util.random random + +out "" endl console + +# generate header +out "" endl console + +# generate five rows +decl int i +for (set i 1) (< i 6) (inc i) + out "" console + out "" console + out "" console + out "" console + out "" endl console +end for + +out "
XYZ
" i "" (int (+ 1000 (random.getint 8999))) "" (int (+ 1000 (random.getint 8999))) "" (int (+ 1000 (random.getint 8999))) "
" endl console diff --git a/Task/Create-an-HTML-table/jq/create-an-html-table-1.jq b/Task/Create-an-HTML-table/jq/create-an-html-table-1.jq new file mode 100644 index 0000000000..109725f664 --- /dev/null +++ b/Task/Create-an-HTML-table/jq/create-an-html-table-1.jq @@ -0,0 +1,23 @@ +def html_row: + "", + " \(.[] | "\(.)")", + ""; + +def html_header: + "", + " \(html_row)", + ""; + + def html_table(header): + "", + " \(header | html_header)", + " ", + " \(.[] | html_row)", + " "; + +# Prepend the sequence number +def html_table_with_sequence(header): + length as $length + | . as $in + | [range(0;length) | [.+1] + $in[.]] | html_table(header); diff --git a/Task/Create-an-HTML-table/jq/create-an-html-table-2.jq b/Task/Create-an-HTML-table/jq/create-an-html-table-2.jq new file mode 100644 index 0000000000..124d9ecb37 --- /dev/null +++ b/Task/Create-an-HTML-table/jq/create-an-html-table-2.jq @@ -0,0 +1,7 @@ +def data: + [ [4,5,6], + [41, 51, 61], + [401, 501, 601] ]; + +# The first column has no header +data | html_table_with_sequence( ["", "X", "Y", "Z"] ) diff --git a/Task/Create-an-HTML-table/jq/create-an-html-table-3.jq b/Task/Create-an-HTML-table/jq/create-an-html-table-3.jq new file mode 100644 index 0000000000..6d156ace4d --- /dev/null +++ b/Task/Create-an-HTML-table/jq/create-an-html-table-3.jq @@ -0,0 +1,31 @@ +$ jq -r -n -f Create_an_HTML_table.jq +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Task/Create-an-object-at-a-given-address/FreeBASIC/create-an-object-at-a-given-address.freebasic b/Task/Create-an-object-at-a-given-address/FreeBASIC/create-an-object-at-a-given-address.freebasic new file mode 100644 index 0000000000..36a512eb2a --- /dev/null +++ b/Task/Create-an-object-at-a-given-address/FreeBASIC/create-an-object-at-a-given-address.freebasic @@ -0,0 +1,34 @@ +' FB 1.05.0 + +Type Person + As String name + As Integer age + Declare Constructor(name As String, age As Integer) +End Type + +Constructor Person(name As String, age As Integer) + This.name = name + This.age = age +End Constructor + +Dim ap As Any Ptr = CAllocate(SizeOf(Person)) ' allocate memory to store a Person object + +'create a Person object at the address of the memory we've just allocated + +Dim p As Person Ptr = New(ap) Person("Teresa", 60) + +'check addresses are same +Print ap, p + +'check data is not corrupt +Print p -> name, p -> age + +'call implicit destructor +p -> Destructor + +'free memory +Deallocate(ap) + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Create-an-object-at-a-given-address/Phix/create-an-object-at-a-given-address.phix b/Task/Create-an-object-at-a-given-address/Phix/create-an-object-at-a-given-address.phix new file mode 100644 index 0000000000..30dc028076 --- /dev/null +++ b/Task/Create-an-object-at-a-given-address/Phix/create-an-object-at-a-given-address.phix @@ -0,0 +1,4 @@ +poke(0x80,or_bits(peek(0x80),0x40)) +#ilASM{ mov al,[0x80] + or al,0x40 + mov [0x80],al} diff --git a/Task/Currying/EchoLisp/currying.echolisp b/Task/Currying/EchoLisp/currying.echolisp new file mode 100644 index 0000000000..5f4e66ee7f --- /dev/null +++ b/Task/Currying/EchoLisp/currying.echolisp @@ -0,0 +1,19 @@ +;; +;; curry functional definition +;; (define (curry proc . left-args) (lambda right-args (apply proc (append left-args right-args)))) +;; +;; right-curry +;; (define (rcurry proc . right-args) (lambda left-args (apply proc (append left-args right-args)))) +;; + +(define add42 (curry + 42)) +(add42 666) → 708 + +(map (curry cons 'simon) '( gallubert garfunkel et-merveilles)) + → ((simon . gallubert) (simon . garfunkel) (simon . et-merveilles)) +(map (rcurry cons 'simon) '( gallubert garfunkel et-merveilles)) + → ((gallubert . simon) (garfunkel . simon) (et-merveilles . simon)) + +;Implementation : result of currying : +(curry * 2 3 (+ 2 2)) + → (λ _#:g1004 (#apply-curry #* (2 3 4) _#:g1004)) diff --git a/Task/Currying/Eero/currying-1.eero b/Task/Currying/Eero/currying-1.eero new file mode 100644 index 0000000000..2e04ca18c3 --- /dev/null +++ b/Task/Currying/Eero/currying-1.eero @@ -0,0 +1,14 @@ +#import + +int main() + + addN := (int n) + int adder(int x) + return x + n + return adder + + add2 := addN(2) + + printf( "Result = %d\n", add2(7) ) + + return 0 diff --git a/Task/Currying/Eero/currying-2.eero b/Task/Currying/Eero/currying-2.eero new file mode 100644 index 0000000000..95a36a110a --- /dev/null +++ b/Task/Currying/Eero/currying-2.eero @@ -0,0 +1,12 @@ +#import + +int main() + + addN := (int n) + return (int x | return x + n) + + add2 := addN(2) + + printf( "Result = %d\n", add2(7) ) + + return 0 diff --git a/Task/Currying/FreeBASIC/currying.freebasic b/Task/Currying/FreeBASIC/currying.freebasic new file mode 100644 index 0000000000..f45592d14e --- /dev/null +++ b/Task/Currying/FreeBASIC/currying.freebasic @@ -0,0 +1,18 @@ +' FB 1.05.0 Win64 + +Type CurriedAdd + As Integer i + Declare Function add(As Integer) As Integer +End Type + +Function CurriedAdd.add(j As Integer) As Integer + Return i + j +End Function + +Function add (i As Integer) as CurriedAdd + Return Type(i) +End Function + +Print "3 + 4 ="; add(3).add(4) +Print "2 + 6 ="; add(2).add(6) +Sleep diff --git a/Task/Currying/LFE/currying-1.lfe b/Task/Currying/LFE/currying-1.lfe new file mode 100644 index 0000000000..bcb9bc4847 --- /dev/null +++ b/Task/Currying/LFE/currying-1.lfe @@ -0,0 +1,4 @@ +(defun curry (f arg) + (lambda (x) + (apply f + (list arg x)))) diff --git a/Task/Currying/LFE/currying-2.lfe b/Task/Currying/LFE/currying-2.lfe new file mode 100644 index 0000000000..e6232124f5 --- /dev/null +++ b/Task/Currying/LFE/currying-2.lfe @@ -0,0 +1 @@ +(funcall (curry #'+/2 10) 10) diff --git a/Task/Currying/Nim/currying-1.nim b/Task/Currying/Nim/currying-1.nim new file mode 100644 index 0000000000..eb83f2d6f2 --- /dev/null +++ b/Task/Currying/Nim/currying-1.nim @@ -0,0 +1,4 @@ +proc addN[T](n: T): auto = (proc(x: T): T = x + n) + +let add2 = addN(2) +echo add2(7) diff --git a/Task/Currying/Nim/currying-2.nim b/Task/Currying/Nim/currying-2.nim new file mode 100644 index 0000000000..7a4c83e489 --- /dev/null +++ b/Task/Currying/Nim/currying-2.nim @@ -0,0 +1,6 @@ +import future + +proc addM[T](n: T): auto = (x: T) => x + n + +let add3 = addM(3) +echo add3(7) diff --git a/Task/Currying/Oforth/currying.oforth b/Task/Currying/Oforth/currying.oforth new file mode 100644 index 0000000000..6b6f0de72d --- /dev/null +++ b/Task/Currying/Oforth/currying.oforth @@ -0,0 +1,3 @@ +2 #+ curry => 2+ +5 2+ . +7 ok diff --git a/Task/Currying/Sidef/currying-1.sidef b/Task/Currying/Sidef/currying-1.sidef new file mode 100644 index 0000000000..3795b23224 --- /dev/null +++ b/Task/Currying/Sidef/currying-1.sidef @@ -0,0 +1,2 @@ +var adder = 1.method(:add); +say adder(3); #=> 4 diff --git a/Task/Currying/Sidef/currying-2.sidef b/Task/Currying/Sidef/currying-2.sidef new file mode 100644 index 0000000000..b978026379 --- /dev/null +++ b/Task/Currying/Sidef/currying-2.sidef @@ -0,0 +1,12 @@ +func curry(f, *args1) { + func (*args2) { + f(args1..., args2...); + } +} + +func add(a, b) { + a + b +} + +var adder = curry(add, 1); +say adder(3); #=>4 diff --git a/Task/Currying/Swift/currying-1.swift b/Task/Currying/Swift/currying-1.swift new file mode 100644 index 0000000000..5b2c0e5ab3 --- /dev/null +++ b/Task/Currying/Swift/currying-1.swift @@ -0,0 +1,5 @@ +func addN(n:Int)->Int->Int { return {$0 + n} } + +var add2 = addN(2) +println(add2) // (Function) +println(add2(7)) // 9 diff --git a/Task/Currying/Swift/currying-2.swift b/Task/Currying/Swift/currying-2.swift new file mode 100644 index 0000000000..4fd9252019 --- /dev/null +++ b/Task/Currying/Swift/currying-2.swift @@ -0,0 +1,5 @@ +func addN(n:Int)(x:Int) -> Int { return x + n } + +var add2 = addN(2) +println(add2) // (Function) +println(add2(x:7)) // 9 diff --git a/Task/Currying/Swift/currying-3.swift b/Task/Currying/Swift/currying-3.swift new file mode 100644 index 0000000000..2c7890b9e7 --- /dev/null +++ b/Task/Currying/Swift/currying-3.swift @@ -0,0 +1,5 @@ +func addN(n:Int)(_ x:Int) -> Int { return x + n } + +var add2 = addN(2) +println(add2) // (Function) +println(add2(7)) // 9 diff --git a/Task/Currying/Wortel/currying.wortel b/Task/Currying/Wortel/currying.wortel new file mode 100644 index 0000000000..bcead9dc9b --- /dev/null +++ b/Task/Currying/Wortel/currying.wortel @@ -0,0 +1,20 @@ +@let { + addOne \+ 1 + subtractFrom1 \- 1 + subtract1 \~- 1 + + subtract1_2 &\- [. 1] + + add ^+ + ; partial apply to named functions + addOne_2 \add 1 + + ; testing + [[ + !addOne 5 ; returns 6 + !subtractFrom1 5 ; returns -4 + !subtract1 5 ; returns 4 + !subtract1_2 5 ; returns 4 + !addOne_2 5 ; returns 6 + ]] +} diff --git a/Task/Currying/jq/currying-1.jq b/Task/Currying/jq/currying-1.jq new file mode 100644 index 0000000000..3f4285491f --- /dev/null +++ b/Task/Currying/jq/currying-1.jq @@ -0,0 +1,3 @@ +def plus(x): . + x; + +def plus5: plus(5); diff --git a/Task/Currying/jq/currying-2.jq b/Task/Currying/jq/currying-2.jq new file mode 100644 index 0000000000..3ebe992e69 --- /dev/null +++ b/Task/Currying/jq/currying-2.jq @@ -0,0 +1 @@ +3 | plus5 diff --git a/Task/DNS-query/Lasso/dns-query-1.lasso b/Task/DNS-query/Lasso/dns-query-1.lasso new file mode 100644 index 0000000000..4bf5a2b99e --- /dev/null +++ b/Task/DNS-query/Lasso/dns-query-1.lasso @@ -0,0 +1 @@ +dns_lookup('www.kame.net', -type='A') diff --git a/Task/DNS-query/Lasso/dns-query-2.lasso b/Task/DNS-query/Lasso/dns-query-2.lasso new file mode 100644 index 0000000000..73fb82ed12 --- /dev/null +++ b/Task/DNS-query/Lasso/dns-query-2.lasso @@ -0,0 +1,13 @@ +/* NetRexx */ +options replace format comments java crossref symbols nobinary + +ir = InetAddress +addresses = InetAddress[] InetAddress.getAllByName('www.kame.net') +loop ir over addresses + if ir <= Inet4Address then do + say 'IPv4 :' ir.getHostAddress + end + if ir <= Inet6Address then do + say 'IPv6 :' ir.getHostAddress + end + end ir diff --git a/Task/DNS-query/Lasso/dns-query-3.lasso b/Task/DNS-query/Lasso/dns-query-3.lasso new file mode 100644 index 0000000000..435df1c890 --- /dev/null +++ b/Task/DNS-query/Lasso/dns-query-3.lasso @@ -0,0 +1,11 @@ +(define (dnsLookup site , ipv) + ;; captures current IPv mode + (set 'ipv (net-ipv)) + ;; IPv mode agnostic lookup + (println "IPv4: " (begin (net-ipv 4) (net-lookup site))) + (println "IPv6: " (begin (net-ipv 6) (net-lookup site))) + ;; returns newLISP to previous IPv mode + (net-ipv ipv) +) + +(dnsLookup "www.kame.net") diff --git a/Task/DNS-query/Sidef/dns-query.sidef b/Task/DNS-query/Sidef/dns-query.sidef new file mode 100644 index 0000000000..362db508d9 --- /dev/null +++ b/Task/DNS-query/Sidef/dns-query.sidef @@ -0,0 +1,8 @@ +var (err, *res) = Socket.getaddrinfo( + 'www.kame.net', 0, + Hash.new(protocol => Socket.IPPROTO_TCP) +); +err && die err; +res.each { |z| + say [Socket.getnameinfo(z{:addr}, Socket.NI_NUMERICHOST)][1]; +} diff --git a/Task/Date-format/8th/date-format.8th b/Task/Date-format/8th/date-format.8th new file mode 100644 index 0000000000..fac30ea954 --- /dev/null +++ b/Task/Date-format/8th/date-format.8th @@ -0,0 +1,4 @@ +d:new +"%Y-%M-%D" over d:format . cr +"%W, %N %D, %Y" over d:format . cr +bye diff --git a/Task/Date-format/Apex/date-format.apex b/Task/Date-format/Apex/date-format.apex new file mode 100644 index 0000000000..fc0cb64ea9 --- /dev/null +++ b/Task/Date-format/Apex/date-format.apex @@ -0,0 +1,5 @@ +Datetime dtNow = datetime.now(); +String strDt1 = dtNow.format('yyyy-MM-dd'); +String strDt2 = dtNow.format('EEEE, MMMM dd, yyyy'); +system.debug(strDt1); // "2007-11-10" +system.debug(strDt2); //"Sunday, November 10, 2007" diff --git a/Task/Date-format/FreeBASIC/date-format.freebasic b/Task/Date-format/FreeBASIC/date-format.freebasic new file mode 100644 index 0000000000..c1506f073e --- /dev/null +++ b/Task/Date-format/FreeBASIC/date-format.freebasic @@ -0,0 +1,10 @@ +' FB 1.05.0 Win64 + +#Include "vbcompat.bi" + +Dim d As Long = Now +Print "This example was created on : "; Format(d, "yyyy-mm-dd") +Print "In other words on : "; Format(d, "dddd, mmmm d, yyyy") +Print +Print "Press any key to quit the program" +Sleep diff --git a/Task/Date-format/FunL/date-format.funl b/Task/Date-format/FunL/date-format.funl new file mode 100644 index 0000000000..2b6bfd476b --- /dev/null +++ b/Task/Date-format/FunL/date-format.funl @@ -0,0 +1,2 @@ +println( format('%tF', $date) ) +println( format('%1$tA, %1$tB %1$td, %1$tY', $date) ) diff --git a/Task/Date-format/Lasso/date-format.lasso b/Task/Date-format/Lasso/date-format.lasso new file mode 100644 index 0000000000..addbb0507f --- /dev/null +++ b/Task/Date-format/Lasso/date-format.lasso @@ -0,0 +1,2 @@ +date('11/10/2007')->format('%Q') // 2007-11-10 +date('11/10/2007')->format('EEEE, MMMM d, YYYY') //Saturday, November 10, 2007 diff --git a/Task/Date-format/Nim/date-format.nim b/Task/Date-format/Nim/date-format.nim new file mode 100644 index 0000000000..261c4675d4 --- /dev/null +++ b/Task/Date-format/Nim/date-format.nim @@ -0,0 +1,5 @@ +import times + +var t = getTime().getLocalTime() +echo(t.format("yyyy-MM-dd")) +echo(t.format("dddd',' MMMM d',' yyyy")) diff --git a/Task/Date-format/Phix/date-format.phix b/Task/Date-format/Phix/date-format.phix new file mode 100644 index 0000000000..234b8c2117 --- /dev/null +++ b/Task/Date-format/Phix/date-format.phix @@ -0,0 +1,3 @@ +include builtins\timedate.e +?format_timedate(date(),"YYYY-MM-DD") +?format_timedate(date(),"Dddd, Mmmm d, YYYY") diff --git a/Task/Date-format/Ring/date-format.ring b/Task/Date-format/Ring/date-format.ring new file mode 100644 index 0000000000..2c6a94007d --- /dev/null +++ b/Task/Date-format/Ring/date-format.ring @@ -0,0 +1,26 @@ +dt = list(21) +dt[1] = "abbreviated weekday name" +dt[2] = "full weekday name" +dt[3] = "abbreviated month name" +dt[4] = "full month name" +dt[5] = "Date & Time" +dt[6] = "Day of the month" +dt[7] = "Hour (24)" +dt[8] = "Hour (12)" +dt[9] = "Day of the year" +dt[10] = "Month of the year" +dt[11] = "Minutes after hour" +dt[12] = "AM or PM" +dt[13] = "Seconds after the hour" +dt[14] = "Week of the year (sun-sat)" +dt[15] = "day of the week" +dt[16] = "date" +dt[17] = "time" +dt[18] = "year of the century" +dt[19] = "year" +dt[20] = "time zone" +dt[21] = "percent sign" + +for i=1 to 21 + see dt[i] + " : " + TimeList () [i] + nl +next diff --git a/Task/Date-format/Sidef/date-format.sidef b/Task/Date-format/Sidef/date-format.sidef new file mode 100644 index 0000000000..f4f6115b86 --- /dev/null +++ b/Task/Date-format/Sidef/date-format.sidef @@ -0,0 +1,4 @@ +var time = Time.local; +say time.ctime; +say time.strftime("%Y-%m-%d"); +say time.strftime("%A, %B %d, %Y"); diff --git a/Task/Date-format/Swift/date-format.swift b/Task/Date-format/Swift/date-format.swift new file mode 100644 index 0000000000..5021cacea0 --- /dev/null +++ b/Task/Date-format/Swift/date-format.swift @@ -0,0 +1,11 @@ +import Foundation +extension String { + func toStandardDateWithDateFormat(format: String) -> String { + let dateFormatter = NSDateFormatter() + dateFormatter.dateFormat = format + dateFormatter.dateStyle = .LongStyle + return dateFormatter.stringFromDate(dateFormatter.dateFromString(self)!) + } +} + +let date = "2015-08-28".toStandardDateWithDateFormat("yyyy-MM-dd") diff --git a/Task/Date-format/Ursa/date-format.ursa b/Task/Date-format/Ursa/date-format.ursa new file mode 100644 index 0000000000..eb7ce96da2 --- /dev/null +++ b/Task/Date-format/Ursa/date-format.ursa @@ -0,0 +1,13 @@ +cygnus/x ursa v0.78 (default, release 0) +[Oracle Corporation JVM 1.8.0_51 on Mac OS X 10.10.5 x86_64] +> import "java.util.Date" +> import "java.text.SimpleDateFormat" +> decl java.text.SimpleDateFormat sdf +> sdf.applyPattern "yyyy-MM-dd" +> decl java.util.Date d +> out (sdf.format d) endl console +2016-07-23 +> sdf.applyPattern "EEEE, MMMM dd, yyyy" +> out (sdf.format d) endl console +Saturday, July 23, 2016 +> _ diff --git a/Task/Date-format/jq/date-format.jq b/Task/Date-format/jq/date-format.jq new file mode 100644 index 0000000000..52d891e7cb --- /dev/null +++ b/Task/Date-format/jq/date-format.jq @@ -0,0 +1,3 @@ +$ jq -n 'now | (strftime("%Y-%m-%d"), strftime("%A, %B %d, %Y"))' +"2015-07-02" +"Thursday, July 02, 2015" diff --git a/Task/Date-manipulation/EchoLisp/date-manipulation.echolisp b/Task/Date-manipulation/EchoLisp/date-manipulation.echolisp new file mode 100644 index 0000000000..3cba41a9bc --- /dev/null +++ b/Task/Date-manipulation/EchoLisp/date-manipulation.echolisp @@ -0,0 +1,9 @@ +(define my-date (string->date "March 7 2009 7:30 pm EST")) + → Sun Mar 08 2009 01:30:00 GMT+0100 (CET) + +(date-add! my-date (* 12 3600)) + → Sun Mar 08 2009 13:30:00 GMT+0100 (CET) +(string->date my-date) + +(date->string my-date) + → "8/3/2009 13:30:00" ;; human localized, Paris time. diff --git a/Task/Date-manipulation/FreeBASIC/date-manipulation.freebasic b/Task/Date-manipulation/FreeBASIC/date-manipulation.freebasic new file mode 100644 index 0000000000..75b4b88a89 --- /dev/null +++ b/Task/Date-manipulation/FreeBASIC/date-manipulation.freebasic @@ -0,0 +1,86 @@ +' FB 1.05.0 Win64 + +#include "vbcompat.bi" + +Sub split (s As String, sepList As String, result() As String, removeEmpty As Boolean = False) + If s = "" OrElse sepList = "" Then + Redim result(0) + result(0) = s + Return + End If + Dim As Integer i, j, count = 0, empty = 0, length + Dim As Integer position(Len(s) + 1) + position(0) = 0 + + For i = 0 To len(s) - 1 + For j = 0 to Len(sepList) - 1 + If s[i] = sepList[j] Then + count += 1 + position(count) = i + 1 + End If + Next j + Next i + + Redim result(count) + If count = 0 Then + result(0) = s + Return + End If + + position(count + 1) = len(s) + 1 + + For i = 1 To count + 1 + length = position(i) - position(i - 1) - 1 + result(i - 1 - empty) = Mid(s, position(i - 1) + 1, length) + If removeEmpty Andalso CBool(length = 0) Then empty += 1 + Next + + If empty > 0 Then Redim Preserve result(count - empty) +End Sub + +Function parseDate(dt As String, zone As String) As Double + Dim result() As String + split dt, " ", result(), True + Dim As Long m, d, y, h, mn + Dim am As Boolean + Dim index As Integer + Select Case Lcase(result(0)) + Case "january" : m = 1 + Case "february" : m = 2 + Case "march" : m = 3 + Case "april" : m = 4 + Case "may" : m = 5 + Case "june" : m = 6 + Case "july" : m = 7 + Case "august" : m = 8 + Case "september" : m = 9 + Case "october" : m = 10 + Case "november" : m = 11 + Case "december" : m = 12 + End Select + d = ValInt(result(1)) + y = ValInt(result(2)) + result(3) = LCase(result(3)) + am = (Right(result(3), 2) = "am") + index = Instr(result(3), ":") + h = ValInt(Left(result(3), index - 1)) + If Not am Then + h = h + 12 + If h = 24 Then h = 12 + End If + mn = ValInt(Mid(result(3), index + 1, 2)) + zone = result(4) + Return DateSerial(y, m, d) + TimeSerial(h, mn, 0) +End Function + +Dim zone As String +Dim ds As Double = parseDate("March 7 2009 7:30pm EST", zone) +Print "Original Date/Time : "; Format(ds, "mmmm d yyyy h:nnam/pm ") + " " + zone +ds = DateAdd("h", 12, ds) +Print "12 hours later : "; Format(ds, "mmmm d yyyy h:nnam/pm ") + " " + zone +' add 5 hours to convert EST to UTC +ds = DateAdd("h", 5, ds) +Print "Equiv to Date/Time : "; Format(ds, "mmmm d yyyy h:nnam/pm ") + " UTC" +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Date-manipulation/FunL/date-manipulation.funl b/Task/Date-manipulation/FunL/date-manipulation.funl new file mode 100644 index 0000000000..2cc21b3f39 --- /dev/null +++ b/Task/Date-manipulation/FunL/date-manipulation.funl @@ -0,0 +1,8 @@ +import time.{TimeZone, Date, SimpleDateFormat, Hour} + +pattern = SimpleDateFormat( 'MMMM d yyyy h:mma zzz' ) +date = pattern.parse( 'March 7 2009 7:30pm EST' ) +later = Date( date.getTime() + 12 Hour ) +println( pattern.format(later) ) // Eastern Daylight Time +pattern.setTimeZone( TimeZone.getTimeZone('America/Los_Angeles') ) +println( pattern.format(later) ) // U.S. Pacific Time diff --git a/Task/Date-manipulation/Lasso/date-manipulation.lasso b/Task/Date-manipulation/Lasso/date-manipulation.lasso new file mode 100644 index 0000000000..17894bfe31 --- /dev/null +++ b/Task/Date-manipulation/Lasso/date-manipulation.lasso @@ -0,0 +1,3 @@ +local(date) = date('March 7 2009 7:30PM EST',-format='MMMM d yyyy h:mma z') +#date->add(-hour = 24) +#date->timezone = 'GMT' diff --git a/Task/Date-manipulation/Lingo/date-manipulation-1.lingo b/Task/Date-manipulation/Lingo/date-manipulation-1.lingo new file mode 100644 index 0000000000..b74c428f96 --- /dev/null +++ b/Task/Date-manipulation/Lingo/date-manipulation-1.lingo @@ -0,0 +1,35 @@ +---------------------------------------- +-- Returns string representation of given date object in YYYY-MM-DD hh:mm:ii format +-- @param {date} dateObj +-- @returns {string} +---------------------------------------- +on dateToDateTimeString (dateObj) + str = "" + s = string(dateObj.year) + if s.length<4 then put "0000".char[1..4-s.length] before s + put s after str + s = string(dateObj.month) + if s.length<2 then s = "0"&s + put s after str + s = string(dateObj.day) + if s.length<2 then put "0" before s + put s after str + sec = dateObj.seconds + s = string(sec / 3600) + sec = sec mod 3600 + if s.length<2 then put "0" before s + put s after str + s = string(sec / 60) + sec = sec mod 60 + if s.length<2 then put "0" before s + put s after str + s = string(sec) + if s.length<2 then put "0" before s + put s after str + put ":" after char 12 of str + put ":" after char 10 of str + put " " after char 8 of str + put "-" after char 6 of str + put "-" after char 4 of str + return str +end diff --git a/Task/Date-manipulation/Lingo/date-manipulation-2.lingo b/Task/Date-manipulation/Lingo/date-manipulation-2.lingo new file mode 100644 index 0000000000..7ca1fc43a2 --- /dev/null +++ b/Task/Date-manipulation/Lingo/date-manipulation-2.lingo @@ -0,0 +1,27 @@ +dateStr = "March 7 2009 7:30pm EST" + +-- parse string +month = (offset(dateStr.word[1].char[1..3], "JanFebMarAprMayJunJulAugSepOctNovDec")-1)/3 + 1 +day = integer(dateStr.word[2]) +year = integer(dateStr.word[3]) +t = dateStr.word[4] +if t.char[t.length-1..t.length]="pm" then dh = 12 +else dh = 0 +t = t.char[1..t.length-2] +_player.itemDelimiter = ":" +hour = integer(t.item[1])+dh +minute = integer(t.item[2]) +tz = dateStr.word[5] -- unused + +-- original date as date object +dateObj = date(year,month,day) +dateObj.seconds = hour*3600 + minute*60 + +-- add 12 hours +sec = dateObj.seconds + 12*3600 +newDateObj = dateObj + sec / 86400 +newDateObj.seconds = sec mod 86400 + +-- show as YYYY-MM-DD hh:mm:ii string +put dateToDateTimeString(newDateObj) +-- "2009-03-08 07:30:00" diff --git a/Task/Date-manipulation/Nim/date-manipulation.nim b/Task/Date-manipulation/Nim/date-manipulation.nim new file mode 100644 index 0000000000..f19f58a27d --- /dev/null +++ b/Task/Date-manipulation/Nim/date-manipulation.nim @@ -0,0 +1,6 @@ +import posix, times + +var ts: Ttm +discard "March 7 2009 7:30pm EST".strptime("%B %d %Y %I:%M%p %Z", ts) +ts.tmHour += 12 +echo ts.mktime diff --git a/Task/Date-manipulation/Phix/date-manipulation.phix b/Task/Date-manipulation/Phix/date-manipulation.phix new file mode 100644 index 0000000000..976ca9adfa --- /dev/null +++ b/Task/Date-manipulation/Phix/date-manipulation.phix @@ -0,0 +1,10 @@ +include builtins\timedate.e +set_timedate_formats({"Mmmm d yyyy h:mmpm tz"}) +timedate td = parse_date_string("March 7 2009 7:30pm EST") +atom twelvehours = timedelta(hours:=12) +td = adjust_timedate(td,twelvehours) +?format_timedate(td) +td = change_timezone(td,"ACDT") -- extra credit +?format_timedate(td) +td = adjust_timedate(td,timedelta(days:=31*4)) +?format_timedate(td) diff --git a/Task/Date-manipulation/Sidef/date-manipulation.sidef b/Task/Date-manipulation/Sidef/date-manipulation.sidef new file mode 100644 index 0000000000..9370d48253 --- /dev/null +++ b/Task/Date-manipulation/Sidef/date-manipulation.sidef @@ -0,0 +1,9 @@ +var dt = frequire('DateTime::Format::Strptime') + +var input = 'March 7 2009 7:30pm EST' +input.sub!('EST', 'America/New_York') + +say dt.strptime('%b %d %Y %I:%M%p %O', input) \ + .add(hours => 12) \ + .set_time_zone('America/Edmonton') \ + .format_cldr('MMMM d yyyy h:mma zzz') diff --git a/Task/Date-manipulation/jq/date-manipulation-1.jq b/Task/Date-manipulation/jq/date-manipulation-1.jq new file mode 100644 index 0000000000..e9542d89bb --- /dev/null +++ b/Task/Date-manipulation/jq/date-manipulation-1.jq @@ -0,0 +1,4 @@ +"March 7 2009 7:30pm EST" +| strptime("%B %d %Y %I:%M%p %Z") +| .[3] += 12 +| mktime | strftime("%B %d %Y %I:%M%p %Z") diff --git a/Task/Date-manipulation/jq/date-manipulation-2.jq b/Task/Date-manipulation/jq/date-manipulation-2.jq new file mode 100644 index 0000000000..8c57de89c2 --- /dev/null +++ b/Task/Date-manipulation/jq/date-manipulation-2.jq @@ -0,0 +1 @@ +"March 08 2009 07:30AM EST" diff --git a/Task/Day-of-the-week/ECL/day-of-the-week.ecl b/Task/Day-of-the-week/ECL/day-of-the-week.ecl new file mode 100644 index 0000000000..0c081c4c74 --- /dev/null +++ b/Task/Day-of-the-week/ECL/day-of-the-week.ecl @@ -0,0 +1,39 @@ +//In what years between 2008 and 2121 will the 25th of December be a Sunday? + +IMPORT STD; + +BaseYear := 2008; +EndYear := 2121; + +ChristmasDay := RECORD + UNSIGNED1 DayofWeek; + UNSIGNED2 Year; +END; + +ChristmasDay FindDate(INTEGER Ctr) := TRANSFORM + SELF.DayofWeek := (STD.Date.FromGregorianYMD((BaseYear-1) + Ctr,12,25)) % 7; //0=Sunday + SELF.Year := (BaseYear-1) + Ctr; +END; + +YearDS := DATASET(EndYear-BaseYear,FindDate(COUNTER)); +OUTPUT(YearDS(DayofWeek=0),{Year}); + +/* Outputs: + 2011 + 2016 + 2022 + 2033 + 2039 + 2044 + 2050 + 2061 + 2067 + 2072 + 2078 + 2089 + 2095 + 2101 + 2107 + 2112 + 2118 +*/ diff --git a/Task/Day-of-the-week/ERRE/day-of-the-week.erre b/Task/Day-of-the-week/ERRE/day-of-the-week.erre new file mode 100644 index 0000000000..24907c7afc --- /dev/null +++ b/Task/Day-of-the-week/ERRE/day-of-the-week.erre @@ -0,0 +1,29 @@ +PROGRAM DAY_OF_THE_WEEK + +PROCEDURE MODULO(X,Y->RES) + IF Y=0 THEN + RES=X + ELSE + RES=X-Y*INT(X/Y) + END IF +END PROCEDURE + +PROCEDURE WD(M,D,Y->RES%) + IF M=1 OR M=2 THEN + M+=12 + Y-=1 + END IF + MODULO(365*Y+INT(Y/4)-INT(Y/100)+INT(Y/400)+D+INT((153*M+8)/5),7->RES) + RES%=RES+1.0 +END PROCEDURE + +BEGIN +PRINT(CHR$(12);) ! CLS +FOR YR=2008 TO 2121 DO + WD(12,25,YR->RES%) + IF RES%=1 THEN ! day 1 is Sunday...... + PRINT("Dec";25;",";YR) + END IF +END FOR +GET(K$) +END PROGRAM diff --git a/Task/Day-of-the-week/Lasso/day-of-the-week.lasso b/Task/Day-of-the-week/Lasso/day-of-the-week.lasso new file mode 100644 index 0000000000..6bacabd648 --- /dev/null +++ b/Task/Day-of-the-week/Lasso/day-of-the-week.lasso @@ -0,0 +1,4 @@ +loop(-From=2008, -to=2121) => {^ + local(tDate = date('12/25/' + loop_count)) + #tDate->dayOfWeek == 1 ? '\r' + #tDate->format('%D') + ' is a Sunday' +^} diff --git a/Task/Day-of-the-week/Lingo/day-of-the-week.lingo b/Task/Day-of-the-week/Lingo/day-of-the-week.lingo new file mode 100644 index 0000000000..cec22057b2 --- /dev/null +++ b/Task/Day-of-the-week/Lingo/day-of-the-week.lingo @@ -0,0 +1,7 @@ +put "December 25 is a Sunday in:" +refDateObj = date(1905,1,2) +repeat with year = 2008 to 2121 + dateObj = date(year, 12, 25) + dayOfWeek = ((dateObj - refDateObj) mod 7)+1 -- 1=Monday..7=Sunday + if dayOfWeek=7 then put year +end repeat diff --git a/Task/Day-of-the-week/LiveCode/day-of-the-week-1.livecode b/Task/Day-of-the-week/LiveCode/day-of-the-week-1.livecode new file mode 100644 index 0000000000..5262b6ce6b --- /dev/null +++ b/Task/Day-of-the-week/LiveCode/day-of-the-week-1.livecode @@ -0,0 +1,13 @@ +function xmasSunday startDate endDate + convert the long date to dateitems + put it into xmasDay + put 12 into item 2 of xmasDay + put 25 into item 3 of xmasDay + repeat with i = startDate to endDate + put i into item 1 of xmasDay + convert xmasDay to dateItems + if item 7 of xmasDay is 1 then put i & comma after xmasYear + end repeat + if the last char of xmasYear is comma then delete the last char of xmasYear + return xmasYear +end xmasSunday diff --git a/Task/Day-of-the-week/LiveCode/day-of-the-week-2.livecode b/Task/Day-of-the-week/LiveCode/day-of-the-week-2.livecode new file mode 100644 index 0000000000..2a4a5eb07f --- /dev/null +++ b/Task/Day-of-the-week/LiveCode/day-of-the-week-2.livecode @@ -0,0 +1 @@ +put xmasSunday(2008,2121) diff --git a/Task/Day-of-the-week/Nim/day-of-the-week.nim b/Task/Day-of-the-week/Nim/day-of-the-week.nim new file mode 100644 index 0000000000..c18cedc54a --- /dev/null +++ b/Task/Day-of-the-week/Nim/day-of-the-week.nim @@ -0,0 +1,9 @@ +import times + +var timeinfo = getLocalTime getTime() +timeinfo.monthday = 25 +timeinfo.month = mDec +for year in 2008..2121: + timeinfo.year = year + if getLocalTime(timeInfoToTime timeinfo).weekday == dSun: + stdout.write year," " diff --git a/Task/Day-of-the-week/Oforth/day-of-the-week.oforth b/Task/Day-of-the-week/Oforth/day-of-the-week.oforth new file mode 100644 index 0000000000..9744fa670e --- /dev/null +++ b/Task/Day-of-the-week/Oforth/day-of-the-week.oforth @@ -0,0 +1,2 @@ +import: date +seqFrom(2008, 2121) filter(#[ 12 25 Date newDate dayOfWeek Date.SUNDAY == ]) . diff --git a/Task/Day-of-the-week/Peloton/day-of-the-week-1.peloton b/Task/Day-of-the-week/Peloton/day-of-the-week-1.peloton new file mode 100644 index 0000000000..238047e37b --- /dev/null +++ b/Task/Day-of-the-week/Peloton/day-of-the-week-1.peloton @@ -0,0 +1,9 @@ +<@ SAI> + <@ ITEFORLI3>2121|2008| + <@ LETVARCAP>Christmas Day|25-Dec-<@ SAYVALFOR>... + <@ TSTDOWVARLIT>Christmas Day|1 + <@ IFF> + <@ SAYCAP>Christmas Day <@ SAYVALFOR>... is a Sunday<@ SAYKEY>__Newline + + + diff --git a/Task/Day-of-the-week/Peloton/day-of-the-week-2.peloton b/Task/Day-of-the-week/Peloton/day-of-the-week-2.peloton new file mode 100644 index 0000000000..85ec282b61 --- /dev/null +++ b/Task/Day-of-the-week/Peloton/day-of-the-week-2.peloton @@ -0,0 +1,10 @@ +<# suppressimplicitoutput> + <# iterate foriteration literalstring3>2121|2008| + <# let variable capture>Christmas Day|25-Dec-<# say value foriteration>... + <# test dayofweek variable literal>Christmas Day|1 + <# if> + <# say capture>Christmas Day <# say value foriteration>... is a Sunday<# say keyword>__Newline + + + + diff --git a/Task/Day-of-the-week/Phix/day-of-the-week.phix b/Task/Day-of-the-week/Phix/day-of-the-week.phix new file mode 100644 index 0000000000..db9dbcd636 --- /dev/null +++ b/Task/Day-of-the-week/Phix/day-of-the-week.phix @@ -0,0 +1,7 @@ +sequence res = {} +for y=2008 to 2121 do + if day_of_week(y,12,25)=1 then + res = append(res,y) + end if +end for +?res diff --git a/Task/Day-of-the-week/Ring/day-of-the-week.ring b/Task/Day-of-the-week/Ring/day-of-the-week.ring new file mode 100644 index 0000000000..bacc2b8dd2 --- /dev/null +++ b/Task/Day-of-the-week/Ring/day-of-the-week.ring @@ -0,0 +1,5 @@ +for n = 2008 to 2121 + if n < 2100 leap = n - 1900 else leap = n - 1904 ok + m = (((n-1900)%7) + floor(leap/4) + 27) % 7 + if m = 4 see "25 Dec " + n + nl ok +next diff --git a/Task/Day-of-the-week/Sidef/day-of-the-week.sidef b/Task/Day-of-the-week/Sidef/day-of-the-week.sidef new file mode 100644 index 0000000000..a1fec60ad1 --- /dev/null +++ b/Task/Day-of-the-week/Sidef/day-of-the-week.sidef @@ -0,0 +1,9 @@ +var tl = frequire('Time::Local'); + +for year in (2008 ..^ 2121) { + var time = tl.timelocal(0,0,0,25,11,year); + var wd = Time.new(time).local.wday; + if (wd == 0) { + say "25 Dec #{year} is Sunday"; + } +} diff --git a/Task/Day-of-the-week/Swift/day-of-the-week.swift b/Task/Day-of-the-week/Swift/day-of-the-week.swift new file mode 100644 index 0000000000..5c6d4993ff --- /dev/null +++ b/Task/Day-of-the-week/Swift/day-of-the-week.swift @@ -0,0 +1,16 @@ +import Cocoa + +var year=2008 +let formatter=NSDateFormatter() +formatter.dateFormat = "yyyy-MM-dd" + +let gregorian:NSCalendar! = NSCalendar(calendarIdentifier: NSCalendarIdentifierGregorian) +while (year<2122){ + var date:NSDate!=formatter.dateFromString(String(year)+"-12-25") + var components=gregorian.components(NSCalendarUnit.CalendarUnitWeekday, fromDate: date) + var dayOfWeek:NSInteger=components.weekday + if(dayOfWeek==1){ + println(year) + } + year++ +} diff --git a/Task/Day-of-the-week/Wortel/day-of-the-week.wortel b/Task/Day-of-the-week/Wortel/day-of-the-week.wortel new file mode 100644 index 0000000000..c4e9b4855c --- /dev/null +++ b/Task/Day-of-the-week/Wortel/day-of-the-week.wortel @@ -0,0 +1 @@ +!-&y = 0 `.getDay. @new Date[y 11 25] @range[2008 2121] diff --git a/Task/Day-of-the-week/jq/day-of-the-week-1.jq b/Task/Day-of-the-week/jq/day-of-the-week-1.jq new file mode 100644 index 0000000000..50ff0d78b9 --- /dev/null +++ b/Task/Day-of-the-week/jq/day-of-the-week-1.jq @@ -0,0 +1,18 @@ +# Use Zeller's Congruence to determine the day of the week, given +# year, month and day as integers in the conventional way. +# If iso == "iso" or "ISO", then emit an integer in 1 -- 7 where +# 1 represents Monday, 2 Tuesday, etc; +# otherwise emit 0 for Saturday, 1 for Sunday, etc. +# +def day_of_week(year; month; day; iso): + if month == 1 or month == 2 then + [month + 12, year - 1] + else + [month, year] + end + | day + (13*(.[0] + 1)/5|floor) + + (.[1]%100) + ((.[1]%100)/4|floor) + + (.[1]/400|floor) - 2*(.[1]/100|floor) + | if iso == "iso" or iso == "ISO" then 1 + ((. + 5) % 7) + else . % 7 + end; diff --git a/Task/Day-of-the-week/jq/day-of-the-week-2.jq b/Task/Day-of-the-week/jq/day-of-the-week-2.jq new file mode 100644 index 0000000000..cef3ff1dc4 --- /dev/null +++ b/Task/Day-of-the-week/jq/day-of-the-week-2.jq @@ -0,0 +1,3 @@ +# Give the results as an array so they can +# readily be presented on a single line: +[range(2008; 2122) | select( day_of_week(.;12;25;0) == 1 )] diff --git a/Task/Deal-cards-for-FreeCell/Ceylon/deal-cards-for-freecell.ceylon b/Task/Deal-cards-for-FreeCell/Ceylon/deal-cards-for-freecell.ceylon new file mode 100644 index 0000000000..01051310dd --- /dev/null +++ b/Task/Deal-cards-for-FreeCell/Ceylon/deal-cards-for-freecell.ceylon @@ -0,0 +1,33 @@ +shared void freeCellDeal() { + + //a function that returns a random number generating function + function createRNG(variable Integer state) => + () => (state = (214_013 * state + 2_531_011) % 2^31) / 2^16; + + void deal(Integer num) { + // create an array with a list comprehension + variable value deck = Array { + for(rank in "A23456789TJQK") + for(suit in "CDHS") + "``rank````suit``" + }; + value rng = createRNG(num); + for(i in 1..52) { + value index = rng() % deck.size; + assert(exists lastIndex = deck.lastIndex); + //swap the random card with the last one + deck.swap(index, lastIndex); + //print the last one + process.write("``deck.last else "missing card"`` " ); + if(i % 8 == 0) { + print(""); + } + //and shrink the array to remove the last card + deck = deck[...lastIndex - 1]; + } + } + + deal(1); + print("\n"); + deal(617); +} diff --git a/Task/Deal-cards-for-FreeCell/ERRE/deal-cards-for-freecell.erre b/Task/Deal-cards-for-FreeCell/ERRE/deal-cards-for-freecell.erre new file mode 100644 index 0000000000..251f8926d5 --- /dev/null +++ b/Task/Deal-cards-for-FreeCell/ERRE/deal-cards-for-freecell.erre @@ -0,0 +1,50 @@ +PROGRAM FREECELL + +!$DOUBLE + +DIM CARDS%[52] + +PROCEDURE XRANDOM(SEED->XRND) + POW31=2^31 + POW16=2^16 + SEED=SEED*214013+2531011 + SEED=SEED-POW31*INT(SEED/POW31) + XRND=INT(SEED/POW16) +END PROCEDURE + +PROCEDURE DEAL(CARDS%[],GAME_NUM) + LOCAL I%,J%,S% + SEED=GAME_NUM + FOR I%=1 TO 52 DO + CARDS%[I%]=52-I% + END FOR + FOR I%=1 TO 51 DO + XRANDOM(SEED->XRND) + J%=52-XRND MOD (53-I%) + S%=CARDS%[I%] + CARDS%[I%]=CARDS%[J%] + CARDS%[J%]=S% + END FOR +END PROCEDURE + +PROCEDURE SHOW(CARDS%[]) + LOCAL INDEX% + FOR INDEX%=1 TO 52 DO + PRINT(MID$(SUITS$,CARDS%[INDEX%] MOD 4+1,1);MID$(NUMS$,CARDS%[INDEX%] DIV 4+1,1);" ";) + IF INDEX% MOD 8=0 OR INDEX%=52 THEN + PRINT + END IF + END FOR +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) + SUITS$="♣♦♥♠" + NUMS$="A23456789TJQK" + GAME_NUM=1982 ! if missing command line + IF CMDLINE$<>"" THEN GAME_NUM=VAL(CMDLINE$) END IF + SEED=1 + DEAL(CARDS%[],GAME_NUM) + PRINT("Hand ";GAME_NUM) + SHOW(CARDS%[]) +END PROGRAM diff --git a/Task/Deal-cards-for-FreeCell/FreeBASIC/deal-cards-for-freecell.freebasic b/Task/Deal-cards-for-FreeCell/FreeBASIC/deal-cards-for-freecell.freebasic new file mode 100644 index 0000000000..f547032f1f --- /dev/null +++ b/Task/Deal-cards-for-FreeCell/FreeBASIC/deal-cards-for-freecell.freebasic @@ -0,0 +1,62 @@ +' version 04-11-2016 +' compile with: fbc -s console + +' to seed ms_lcg(seed > -1) +' to get random number ms_lcg(-1) or ms_lcg() or just ms_lcg +Function ms_lcg(seed As Integer = -1) As UInteger + + Static As UInteger ms_state + + If seed <> -1 Then + ms_state = seed Mod 2 ^ 31 + Else + ms_state = (214013 * ms_state + 2531011) Mod 2 ^ 31 + End If + + Return ms_state Shr 16 + +End Function + +' ------=< MAIN >=------ + +Dim As UByte card(51) +Dim As String suit = "CDHS", value = "A23456789TJQK" +Dim As Long i, c, s, v, game = 1 +Dim As ULong game_nr(1 To 2) = { 1, 617} + +Do + + ms_lcg(game_nr(game)) ' seed generator + Print "game #"; game_nr(game) + game = game + 1 + + For i = 0 To 51 ' set up the cards + card(i) = i + Next + + For i = 51 To 0 Step -1 ' shuffle + c = ms_lcg Mod (i +1) + Swap card(i), card(c) + Next + + c = 0 + Do + For i = 0 To 7 + s = card(51 - c) Mod 4 + v = card(51 - c) \ 4 + Print Chr(value[v]); Chr(suit[s]); " "; + c = c +1 + If c > 51 Then Exit Do + Next + Print + Loop + Print : Print + +Loop Until game > UBound(game_nr) + + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Deal-cards-for-FreeCell/Nim/deal-cards-for-freecell.nim b/Task/Deal-cards-for-FreeCell/Nim/deal-cards-for-freecell.nim new file mode 100644 index 0000000000..45ff0e1ef7 --- /dev/null +++ b/Task/Deal-cards-for-FreeCell/Nim/deal-cards-for-freecell.nim @@ -0,0 +1,29 @@ +import sequtils, strutils, os + +proc randomGenerator(seed: int): iterator: int = + var seed = seed + return iterator: int = + while true: + seed = (seed.int64 * 214013 + 2531011) and int32.high + yield seed shr 16 + +proc deal(seed): seq[int] = + const nc = 52 + result = toSeq countdown(nc - 1, 0) + var rnd = randomGenerator seed + for i in 0 .. 0 ? s : 0; +} + +var pos = [120, 120, 0, 120]; +var neg = [-77, -33, -100, 190]; +var light = normalize([-12, 13, -10]); + +func draw(k, amb) { + STDOUT.binmode(':raw'); + print ("P5\n", pos[0]*2 + 3, " ", pos[1]*2 + 3, "\n255\n"); + + for y in ((pos[1] - pos[3] - 1) .. (pos[1] + pos[3] + 1)) { + var row = []; + for x in ((pos[0] - pos[3] - 1) .. (pos[0] + pos[3] + 1)) { + var hit = 0; + var hs = []; + var h = hitf(pos, x, y); + + if (!h) { hit = 0; h = [0, 0] } + elsif (!(hs = hitf(neg, x, y))) { hit = 1; hs = [0, 0] } + elsif (hs[0] > h[0]) { hit = 1 } + elsif (hs[1] > h[0]) { hit = (hs[1] > h[1] ? 0 : 2) } + else { hit = 1 }; + + var (val, v); + given(hit) { + when (0) { val = 0} + when (1) { v = [x-pos[0], y-pos[1], h[0]-pos[2]] } + default { v = [neg[0]-x, neg[1]-y, neg[2]-hs[1]] } + } + + if (v) { + v = normalize(v); + val = int((dot(v, light)**k + amb) * 255); + val = (val > 255 ? 255 : (val < 0 ? 0 : val)); + }; + row.append(val); + } + print 'C*'.pack(row...); + } +} + +draw(2, 0.2); diff --git a/Task/Deepcopy/Lasso/deepcopy.lasso b/Task/Deepcopy/Lasso/deepcopy.lasso new file mode 100644 index 0000000000..242f1e2bbe --- /dev/null +++ b/Task/Deepcopy/Lasso/deepcopy.lasso @@ -0,0 +1 @@ +local(copy) = #myobject->ascopydeep diff --git a/Task/Deepcopy/Lingo/deepcopy-1.lingo b/Task/Deepcopy/Lingo/deepcopy-1.lingo new file mode 100644 index 0000000000..35a3973ffb --- /dev/null +++ b/Task/Deepcopy/Lingo/deepcopy-1.lingo @@ -0,0 +1,19 @@ +-- Supports lists, property lists, images, script instances and scalar values (integer, float, string, symbol). +on deepcopy (var, cycleCheck) + case ilk(var) of + #list, #propList, #image: + return var.duplicate() + #instance: + if string(var) starts " 0, bar => [0,1]) + +# Add a cyclic reference +src{:baz} = src + +# Make a deep clone +var dst = src.dclone + +# The address of src +say src.object_id +say src{:baz}.object_id + +# The address of dst +say dst.object_id +say dst{:baz}.object_id diff --git a/Task/Define-a-primitive-data-type/EchoLisp/define-a-primitive-data-type.echolisp b/Task/Define-a-primitive-data-type/EchoLisp/define-a-primitive-data-type.echolisp new file mode 100644 index 0000000000..e02052c29d --- /dev/null +++ b/Task/Define-a-primitive-data-type/EchoLisp/define-a-primitive-data-type.echolisp @@ -0,0 +1,30 @@ +(require 'types) +(require 'math) + +;; type defined by a predicate +(define (one-ten? x) (in-interval? x 1 10)) +(type One-ten [Integer & one-ten?]) + +;; OR by an enumeration +(type One-ten [ 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 ]) + +;; EXPLICIT type checking +;; type-of? returns a Boolean + +(type-of? 5 One-ten) → #t +(type-of? 'Albert One-ten) → #f + +;; type-check raises an error +(type-check 6 One-ten) → #t +(type-check 88 One-ten) +⛔ error: One-ten : type-check failure : 88 → 'one-ten?' + + +;; IMPLICIT type checking +;; declare a function signature +(define (f10 x y) (+ x y)) +(signature f10 One-ten -> One-ten -> Integer) + +(f10 6 7) → 13 +(f10 42 666) +❗ error: One-ten : type-check failure : 42 → 'f10:x' diff --git a/Task/Define-a-primitive-data-type/FreeBASIC/define-a-primitive-data-type.freebasic b/Task/Define-a-primitive-data-type/FreeBASIC/define-a-primitive-data-type.freebasic new file mode 100644 index 0000000000..cbe5a62028 --- /dev/null +++ b/Task/Define-a-primitive-data-type/FreeBASIC/define-a-primitive-data-type.freebasic @@ -0,0 +1,40 @@ +' FB 1.05.0 Win64 + +Type MyInteger + Private: + Dim i_ As Integer + Public: + Declare Constructor(i_ As Integer) + Declare Property I() As Integer + Declare Operator Cast() As Integer + Declare Operator Cast() As String +End Type + +Constructor MyInteger(i_ As Integer) + If i_ < 1 Then + i_ = 1 + ElseIf i_ > 10 Then + i_ = 10 + End If + This.i_ = i_ +End Constructor + +Property MyInteger.I() As Integer + Return i_ +End Property + +Operator MyInteger.Cast() As Integer + Return i_ +End Operator + +Operator MyInteger.Cast() As String + Return Str(i_) +End Operator + +Dim i As MyInteger = 11 ' implicit constructor call; i_ automatically limited to 10 +Dim j As MyInteger = 3 ' implicit constructor call; no adjustment needed +Dim k As Integer = 4 +Print "i = "; i; " j = " ; j; " k = "; k; " j + 6 ="; j.I + 6; " j + k ="; j + k +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Define-a-primitive-data-type/Lasso/define-a-primitive-data-type.lasso b/Task/Define-a-primitive-data-type/Lasso/define-a-primitive-data-type.lasso new file mode 100644 index 0000000000..626bd6e3b1 --- /dev/null +++ b/Task/Define-a-primitive-data-type/Lasso/define-a-primitive-data-type.lasso @@ -0,0 +1,28 @@ +define dint => type { + data private value + + public oncreate(value::integer) => { + fail_if(#value < 1,#value+' less than 1 ') + fail_if(#value > 10,#value+' greater than 10') + .value = #value + } + + public +(rhs::integer) => dint(.value + #rhs) + public -(rhs::integer) => dint(.value - #rhs) + public *(rhs::integer) => dint(.value * #rhs) + public /(rhs::integer) => dint(.value / #rhs) + public %(rhs::integer) => dint(.value % #rhs) + + public asstring() => string(.value) + +} + +dint(1) // 1 +dint(10) // 10 + +dint(0) // Error: 0 less than 1 +dint(2) - 5 // Error: -3 less than 1 + +dint(11) // Error: 11 greater than 10 +dint(10) + 1 // Error: 11 greater than 10 +dint(10) * 2 // Error: 20 greater than 10 diff --git a/Task/Define-a-primitive-data-type/Nim/define-a-primitive-data-type.nim b/Task/Define-a-primitive-data-type/Nim/define-a-primitive-data-type.nim new file mode 100644 index 0000000000..61d65cbcd2 --- /dev/null +++ b/Task/Define-a-primitive-data-type/Nim/define-a-primitive-data-type.nim @@ -0,0 +1,7 @@ +var x: range[1..10] = 10 + +x = 5 + +x = x + 6 # Runtime error: Value out of range + +x = 12 # Compile error: Invalid conversion diff --git a/Task/Define-a-primitive-data-type/Phix/define-a-primitive-data-type-1.phix b/Task/Define-a-primitive-data-type/Phix/define-a-primitive-data-type-1.phix new file mode 100644 index 0000000000..db97bad0ac --- /dev/null +++ b/Task/Define-a-primitive-data-type/Phix/define-a-primitive-data-type-1.phix @@ -0,0 +1,3 @@ +type iten(integer i) + return i>=1 and i<=10 +end type diff --git a/Task/Define-a-primitive-data-type/Phix/define-a-primitive-data-type-2.phix b/Task/Define-a-primitive-data-type/Phix/define-a-primitive-data-type-2.phix new file mode 100644 index 0000000000..64e1ac0ef9 --- /dev/null +++ b/Task/Define-a-primitive-data-type/Phix/define-a-primitive-data-type-2.phix @@ -0,0 +1,2 @@ +integer i +iten i10 diff --git a/Task/Define-a-primitive-data-type/Phix/define-a-primitive-data-type-3.phix b/Task/Define-a-primitive-data-type/Phix/define-a-primitive-data-type-3.phix new file mode 100644 index 0000000000..b9963e95a9 --- /dev/null +++ b/Task/Define-a-primitive-data-type/Phix/define-a-primitive-data-type-3.phix @@ -0,0 +1,2 @@ +i = 11 -- fine +i10 = 11 -- runtime error diff --git a/Task/Define-a-primitive-data-type/Sidef/define-a-primitive-data-type.sidef b/Task/Define-a-primitive-data-type/Sidef/define-a-primitive-data-type.sidef new file mode 100644 index 0000000000..70628cf88d --- /dev/null +++ b/Task/Define-a-primitive-data-type/Sidef/define-a-primitive-data-type.sidef @@ -0,0 +1,37 @@ +subset Integer < Number { .is_int } +subset MyIntLimit < Integer { . ~~ (1 ..^ 10) } + +class MyInt(value < MyIntLimit) { + + method to_s { value.to_s } + method get_value { value.get_value } + + method ==(Number x) { value == x } + method ==(MyInt x) { value == x.value } + + method AUTOLOAD(_, name, *args) { + var results = [value.(name)(args.map {|n| Number(n) }...)] + results.map{|r| r.kind_of(Number) ? MyInt(r.int) : r}... + } +} + +# +## Example: +# +var a = MyInt(2) # creates a new object of type `MyInt` +a += 7 # adds 7 to a +say a # => 9 +say a/2 # => 4 + +var b = (a - 3) # b is of type `MyInt` +say b # => 6 + +say a.as_hex.dump # => "9" -- an hexadecimal string + +a -= 6 # a=3 +var c = (a + b) # MyInt(3) + MyInt(6) +say c # => 9 +say c.class # => MyInt + +a *= 2 # a=6 +say a+b # error: class `MyInt` does not match MyInt(12) diff --git a/Task/Define-a-primitive-data-type/Visual-FoxPro/define-a-primitive-data-type.visual b/Task/Define-a-primitive-data-type/Visual-FoxPro/define-a-primitive-data-type.visual new file mode 100644 index 0000000000..b2d8ace9a5 --- /dev/null +++ b/Task/Define-a-primitive-data-type/Visual-FoxPro/define-a-primitive-data-type.visual @@ -0,0 +1,31 @@ +LOCAL o As BoundedInt +o = NEWOBJECT("BoundedInt") +DO WHILE NOT o.lHasError + o.nValue = o.nValue + 2 && will get as far as 9. + ? o.nValue +ENDDO + +DEFINE CLASS BoundedInt As Custom +nValue = 1 && default value +lHasError = .F. + +PROCEDURE nValue_Assign(tnValue) +*!* This method will check the parameter and if +*!* it is out of bounds, the value will remain unchanged +*!* and an error generated. +tnValue = CAST(tnValue As I) +IF BETWEEN(tnValue, 1, 10) + THIS.nValue = tnValue +ELSE + ERROR "Value must be between 1 and 10." +ENDIF +ENDPROC + +PROCEDURE Error(nError, cMethod, nLine) +IF nError = 1098 + MESSAGEBOX(MESSAGE(), 0, "Error") +ELSE + DODEFAULT() +ENDIF +THIS.lHasError = .T. +ENDDEFINE diff --git a/Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-1.jq b/Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-1.jq new file mode 100644 index 0000000000..0474fa31ad --- /dev/null +++ b/Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-1.jq @@ -0,0 +1,2 @@ +def typeof: + if type == "object" and has("type") then .type else type end; diff --git a/Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-2.jq b/Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-2.jq new file mode 100644 index 0000000000..e2a1f0667b --- /dev/null +++ b/Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-2.jq @@ -0,0 +1,4 @@ +def pp: + if type == "object" and has("type") then "\(.type)::\(.value)" + else . + end; diff --git a/Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-3.jq b/Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-3.jq new file mode 100644 index 0000000000..fae6dad922 --- /dev/null +++ b/Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-3.jq @@ -0,0 +1,14 @@ +def smallint(i): i as $i + | if (i|type) == "number" and i == (i|floor) and i > 0 and i < 11 then {"type": "smallint", "value": i} + else empty + end ; + +# A convenience function to save typing: +def s(i): smallint(i); + +# To convert from the pretty-print representation back to smallint: +def tosmallint: + if type == "string" and startswith("smallint::") then + split("::") | smallint( .[1] | tonumber ) + else empty + end ; diff --git a/Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-4.jq b/Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-4.jq new file mode 100644 index 0000000000..e24fe4d030 --- /dev/null +++ b/Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-4.jq @@ -0,0 +1,5 @@ +def add(a;b): smallint(a.value + b.value); +def minus(a;b): smallint(a.value - b.value); +def times(a;b): smallint(a.value * b.value); +def mod(a;b): smallint(a.value % b.value); +def divide(a;b): smallint( (a.value / b.value) | floor ); diff --git a/Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-5.jq b/Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-5.jq new file mode 100644 index 0000000000..40fbbd34e8 --- /dev/null +++ b/Task/Define-a-primitive-data-type/jq/define-a-primitive-data-type-5.jq @@ -0,0 +1,3 @@ +s(1) < s(3) # => true +add( s(1); s(2)) | pp # "smallint::3" +add( s(6); s(6)) # (nothing) diff --git a/Task/Delegates/NGS/delegates.ngs b/Task/Delegates/NGS/delegates.ngs new file mode 100644 index 0000000000..5dd87906bd --- /dev/null +++ b/Task/Delegates/NGS/delegates.ngs @@ -0,0 +1,40 @@ +{ + type Delegator + + F init(d:Delegator) d.delegate = null + + F default_impl(d:Delegator) 'default implementation' + + F operation(d:Delegator) default_impl(d) + + F operation(d:Delegator) { + guard defined thing + guard thing is Fun + try { + d.delegate.thing() + } + catch(e:ImplNotFound) { + # Might be unrelated exception, so check and optionally rethrow + e.callable !== thing throws e + default_impl(d) + } + } + + F operation(d:Delegator) { + guard d.delegate is Null + default_impl(d) + } + + + a = Delegator() + echo(a.operation()) + + # There is no method thing(s:Str) + a.delegate = "abc" + echo(a.operation()) + + # ... now there is method thing(s:Str) + F thing(s:Str) 'delegate implementation' + echo(a.operation()) + +} diff --git a/Task/Delegates/Oforth/delegates-1.oforth b/Task/Delegates/Oforth/delegates-1.oforth new file mode 100644 index 0000000000..657aa4620c --- /dev/null +++ b/Task/Delegates/Oforth/delegates-1.oforth @@ -0,0 +1,11 @@ +Object Class new: Delegate1 + +Object Class new: Delegate2 +Delegate2 method: thing "Delegate implementation" println ; + +Object Class new: Delegator(delegate) +Delegator method: initialize := delegate ; + +Delegator method: operation + @delegate respondTo(#thing) ifTrue: [ @delegate thing return ] + "Default implementation" println ; diff --git a/Task/Delegates/Oforth/delegates-2.oforth b/Task/Delegates/Oforth/delegates-2.oforth new file mode 100644 index 0000000000..d993acbb6a --- /dev/null +++ b/Task/Delegates/Oforth/delegates-2.oforth @@ -0,0 +1,8 @@ +Delegator new(null) operation +Default implementation + +Delegator new(Delegate1 new) operation +Default implementation + +Delegator new(Delegate2 new) operation +Delegate implementation diff --git a/Task/Delegates/Swift/delegates-1.swift b/Task/Delegates/Swift/delegates-1.swift new file mode 100644 index 0000000000..f237bc22ba --- /dev/null +++ b/Task/Delegates/Swift/delegates-1.swift @@ -0,0 +1,33 @@ +import Foundation + +protocol Thingable { // prior to Swift 1.2, needs to be declared @objc + func thing() -> String +} + +class Delegator { + weak var delegate: AnyObject? + func operation() -> String { + if let f = self.delegate?.thing { + return f() + } else { + return "default implementation" + } + } +} + +class Delegate { + dynamic func thing() -> String { return "delegate implementation" } +} + +// Without a delegate: +let a = Delegator() +println(a.operation()) // prints "default implementation" + +// With a delegate that does not implement thing: +a.delegate = "A delegate may be any object" +println(a.operation()) // prints "default implementation" + +// With a delegate that implements "thing": +let d = Delegate() +a.delegate = d +println(a.operation()) // prints "delegate implementation" diff --git a/Task/Delegates/Swift/delegates-2.swift b/Task/Delegates/Swift/delegates-2.swift new file mode 100644 index 0000000000..e440cedc02 --- /dev/null +++ b/Task/Delegates/Swift/delegates-2.swift @@ -0,0 +1,27 @@ +protocol Thingable : class { + func thing() -> String +} + +class Delegator { + weak var delegate: Thingable? + func operation() -> String { + if let d = self.delegate { + return d.thing() + } else { + return "default implementation" + } + } +} + +class Delegate : Thingable { + func thing() -> String { return "delegate implementation" } +} + +// Without a delegate: +let a = Delegator() +println(a.operation()) // prints "default implementation" + +// With a delegate: +let d = Delegate() +a.delegate = d +println(a.operation()) // prints "delegate implementation" diff --git a/Task/Delete-a-file/8th/delete-a-file.8th b/Task/Delete-a-file/8th/delete-a-file.8th new file mode 100644 index 0000000000..372be5dbc4 --- /dev/null +++ b/Task/Delete-a-file/8th/delete-a-file.8th @@ -0,0 +1,4 @@ +"input.txt" f:rm drop +"/input.txt" f:rm drop +"docs" f:rmdir drop +"/docs" f:rmdir drop diff --git a/Task/Delete-a-file/Axe/delete-a-file.axe b/Task/Delete-a-file/Axe/delete-a-file.axe new file mode 100644 index 0000000000..7c95046ba7 --- /dev/null +++ b/Task/Delete-a-file/Axe/delete-a-file.axe @@ -0,0 +1 @@ +DelVar "appvINPUT" diff --git a/Task/Delete-a-file/FreeBASIC/delete-a-file.freebasic b/Task/Delete-a-file/FreeBASIC/delete-a-file.freebasic new file mode 100644 index 0000000000..b18c486b54 --- /dev/null +++ b/Task/Delete-a-file/FreeBASIC/delete-a-file.freebasic @@ -0,0 +1,15 @@ +' FB 1.05.0 Win64 + +' delete file and empty sub-directory in current directory + +Kill "input.txt" +RmDir "docs" + +' delete file and empty sub-directory in root directory c:\ +' deleting file in root requires administrative privileges in Windows 10 + +'Kill "c:\input.txt" +'RmDir "c:\docs" + +Print "Press any key to quit" +Sleep diff --git a/Task/Delete-a-file/Lasso/delete-a-file.lasso b/Task/Delete-a-file/Lasso/delete-a-file.lasso new file mode 100644 index 0000000000..9cbb24ef05 --- /dev/null +++ b/Task/Delete-a-file/Lasso/delete-a-file.lasso @@ -0,0 +1,17 @@ +// delete file +local(f = file('input.txt')) +#f->delete + +// delete directory +// directory must be empty before it can be successfully deleted. A failure is generated if the operation fails. +local(d = dir('docs')) +#d->delete + +// delete file in root file system (requires permissions at user OS level) +local(f = file('//input.txt')) +#f->delete + +// delete directory in root file system (requires permissions at user OS level) +// directory must be empty before it can be successfully deleted. A failure is generated if the operation fails. +local(d = file('//docs')) +#d->delete diff --git a/Task/Delete-a-file/Lingo/delete-a-file-1.lingo b/Task/Delete-a-file/Lingo/delete-a-file-1.lingo new file mode 100644 index 0000000000..4ddea6b863 --- /dev/null +++ b/Task/Delete-a-file/Lingo/delete-a-file-1.lingo @@ -0,0 +1,4 @@ +-- note: fileIO xtra is shipped with Director, i.e. an "internal" +fp = xtra("fileIO").new() +fp.openFile("input.txt", 0) +fp.delete() diff --git a/Task/Delete-a-file/Lingo/delete-a-file-2.lingo b/Task/Delete-a-file/Lingo/delete-a-file-2.lingo new file mode 100644 index 0000000000..9bbbd48c0e --- /dev/null +++ b/Task/Delete-a-file/Lingo/delete-a-file-2.lingo @@ -0,0 +1,7 @@ +-- note: fileIO xtra is shipped with Director, i.e. an "internal" +pd = the last char of _movie.path -- "\" for win, ":" for mac +_player.itemDelimiter = pd +vol = _movie.path.item[1] +fp = xtra("fileIO").new() +fp.openFile(vol&pd&"input.txt", 0) +fp.delete() diff --git a/Task/Delete-a-file/Lingo/delete-a-file-3.lingo b/Task/Delete-a-file/Lingo/delete-a-file-3.lingo new file mode 100644 index 0000000000..f1333395c8 --- /dev/null +++ b/Task/Delete-a-file/Lingo/delete-a-file-3.lingo @@ -0,0 +1,8 @@ +-- delete (empty) directory "docs" in cwd +bx_folder_delete("docs") + +-- delete (empty) directory "docs" in root of current volume +pd = the last char of _movie.path -- "\" for win, ":" for mac +_player.itemDelimiter = pd +vol = _movie.path.item[1] +bx_folder_delete(vol&pd&"docs") diff --git a/Task/Delete-a-file/Nim/delete-a-file.nim b/Task/Delete-a-file/Nim/delete-a-file.nim new file mode 100644 index 0000000000..23d6a846aa --- /dev/null +++ b/Task/Delete-a-file/Nim/delete-a-file.nim @@ -0,0 +1,5 @@ +import os +removeFile("input.txt") +removeFile("/input.txt") +removeDir("docs") +removeDir("/docs") diff --git a/Task/Delete-a-file/Ring/delete-a-file.ring b/Task/Delete-a-file/Ring/delete-a-file.ring new file mode 100644 index 0000000000..4fe0a6aef9 --- /dev/null +++ b/Task/Delete-a-file/Ring/delete-a-file.ring @@ -0,0 +1,2 @@ +remove("output.txt") +system("rmdir docs") diff --git a/Task/Delete-a-file/Sidef/delete-a-file.sidef b/Task/Delete-a-file/Sidef/delete-a-file.sidef new file mode 100644 index 0000000000..8cbbcf95df --- /dev/null +++ b/Task/Delete-a-file/Sidef/delete-a-file.sidef @@ -0,0 +1,7 @@ +# here +%f'input.txt' -> delete; +%d'docs' -> delete; + +# root dir +Dir.root + %f'input.txt' -> delete; +Dir.root + %d'docs' -> delete; diff --git a/Task/Delete-a-file/Ursa/delete-a-file.ursa b/Task/Delete-a-file/Ursa/delete-a-file.ursa new file mode 100644 index 0000000000..b07bb17b28 --- /dev/null +++ b/Task/Delete-a-file/Ursa/delete-a-file.ursa @@ -0,0 +1,5 @@ +decl file f +f.delete "input.txt" +f.delete "docs" +f.delete "/input.txt" +f.delete "/docs" diff --git a/Task/Detect-division-by-zero/8th/detect-division-by-zero.8th b/Task/Detect-division-by-zero/8th/detect-division-by-zero.8th new file mode 100644 index 0000000000..a175180973 --- /dev/null +++ b/Task/Detect-division-by-zero/8th/detect-division-by-zero.8th @@ -0,0 +1 @@ +1 0 n:/ Inf? . cr diff --git a/Task/Detect-division-by-zero/Ceylon/detect-division-by-zero.ceylon b/Task/Detect-division-by-zero/Ceylon/detect-division-by-zero.ceylon new file mode 100644 index 0000000000..84d4e27c3f --- /dev/null +++ b/Task/Detect-division-by-zero/Ceylon/detect-division-by-zero.ceylon @@ -0,0 +1,12 @@ +shared void run() { + + //integers divided by zero throw an exception + try { + value a = 1 / 0; + } catch (Exception e) { + e.printStackTrace(); + } + + //floats divided by zero produce infinity + print(1.0 / 0 == infinity then "division by zero!" else "not division by zero!"); +} diff --git a/Task/Detect-division-by-zero/ECL/detect-division-by-zero-1.ecl b/Task/Detect-division-by-zero/ECL/detect-division-by-zero-1.ecl new file mode 100644 index 0000000000..40ec64cfea --- /dev/null +++ b/Task/Detect-division-by-zero/ECL/detect-division-by-zero-1.ecl @@ -0,0 +1,4 @@ +DBZ(REAL8 Dividend,INTEGER8 Divisor) := Quotient/Divisor; + +#option ('divideByZero', 'zero'); +DBZ(10,0); //returns 0.0 diff --git a/Task/Detect-division-by-zero/ECL/detect-division-by-zero-2.ecl b/Task/Detect-division-by-zero/ECL/detect-division-by-zero-2.ecl new file mode 100644 index 0000000000..58405901f9 --- /dev/null +++ b/Task/Detect-division-by-zero/ECL/detect-division-by-zero-2.ecl @@ -0,0 +1,3 @@ +DBZ(REAL8 Dividend,INTEGER8 Divisor) := Quotient/Divisor; +#option ('divideByZero', 'fail'); +DBZ(10,0); //returns error message "Error: System error: -1: Division by zero (0, 0), -1," diff --git a/Task/Detect-division-by-zero/ECL/detect-division-by-zero-3.ecl b/Task/Detect-division-by-zero/ECL/detect-division-by-zero-3.ecl new file mode 100644 index 0000000000..86cfb0cdd9 --- /dev/null +++ b/Task/Detect-division-by-zero/ECL/detect-division-by-zero-3.ecl @@ -0,0 +1,9 @@ +DBZ(REAL8 Dividend,INTEGER8 Divisor) := Quotient/Divisor; +#option ('divideByZero', 'nan'); +DBZ(10,0); //returns 'nan' + +/* NOTE: This is only currently supported for real numbers. Division by zero creates a quiet NaN, + which will propogate through any real expressions it is used in. + You can use NOT ISVALID(x) to test if the value is a NaN. + Integer and decimal division by zero continue to return 0. +*/ diff --git a/Task/Detect-division-by-zero/ERRE/detect-division-by-zero.erre b/Task/Detect-division-by-zero/ERRE/detect-division-by-zero.erre new file mode 100644 index 0000000000..81224c1dd7 --- /dev/null +++ b/Task/Detect-division-by-zero/ERRE/detect-division-by-zero.erre @@ -0,0 +1,10 @@ +PROGRAM DIV_BY_ZERO + +EXCEPTION + IF ERR=11 THEN PRINT("Division by Zero") END IF +END EXCEPTION + +BEGIN + PRINT(0/3) + PRINT(3/0) +END PROGRAM diff --git a/Task/Detect-division-by-zero/FreeBASIC/detect-division-by-zero.freebasic b/Task/Detect-division-by-zero/FreeBASIC/detect-division-by-zero.freebasic new file mode 100644 index 0000000000..732bf8ae80 --- /dev/null +++ b/Task/Detect-division-by-zero/FreeBASIC/detect-division-by-zero.freebasic @@ -0,0 +1,25 @@ +' FB 1.05.0 Win64 + +Const divByZeroResult As Integer = -9223372036854775808 + +Sub CheckForDivByZero(result As Integer) + If result = divByZeroResult Then + Print "Division by Zero" + Else + Print "Division by Non-Zero" + End If +End Sub + +Dim As Integer x, y + +x = 0 : y = 0 +CheckForDivByZero(x/y) ' automatic conversion to type of parameter which is Integer +x = 1 +CheckForDivByZero(x/y) +x = -1 +CheckForDivByZero(x/y) +y = 1 +CheckForDivByZero(x/y) +Print +Print "Press any key to exit" +Sleep diff --git a/Task/Detect-division-by-zero/FutureBasic/detect-division-by-zero.futurebasic b/Task/Detect-division-by-zero/FutureBasic/detect-division-by-zero.futurebasic new file mode 100644 index 0000000000..1f6d0e277a --- /dev/null +++ b/Task/Detect-division-by-zero/FutureBasic/detect-division-by-zero.futurebasic @@ -0,0 +1,5 @@ +include "ConsoleWindow" + +on error stop +dim as long a +print a / 0 diff --git a/Task/Detect-division-by-zero/I/detect-division-by-zero.i b/Task/Detect-division-by-zero/I/detect-division-by-zero.i new file mode 100644 index 0000000000..cd290a3c0a --- /dev/null +++ b/Task/Detect-division-by-zero/I/detect-division-by-zero.i @@ -0,0 +1,14 @@ +function isdivbyzero(a, b) { + var c = a/b + if (c = 0) and (a != 0) or (a = 0) and (c >= 0) + print( a, "/", b, " is a division by zero.") + return + end + print( a, "/", b, " is not division by zero.") +} + +software { + isdivbyzero(5, 0) + isdivbyzero(5, 2) + isdivbyzero(0, 0) +} diff --git a/Task/Detect-division-by-zero/Lasso/detect-division-by-zero.lasso b/Task/Detect-division-by-zero/Lasso/detect-division-by-zero.lasso new file mode 100644 index 0000000000..6e67d6127a --- /dev/null +++ b/Task/Detect-division-by-zero/Lasso/detect-division-by-zero.lasso @@ -0,0 +1,13 @@ +define dividehandler(a,b) => { + ( + #a->isNotA(::integer) && #a->isNotA(::decimal) || + #b->isNotA(::integer) && #b->isNotA(::decimal) + ) ? return 'Error: Please supply all params as integers or decimals' + protect => { + handle_error => { return 'Error: Divide by zero' } + local(x = #a / #b) + return #x + } +} + +dividehandler(1,0) diff --git a/Task/Detect-division-by-zero/Lingo/detect-division-by-zero.lingo b/Task/Detect-division-by-zero/Lingo/detect-division-by-zero.lingo new file mode 100644 index 0000000000..8b4208783c --- /dev/null +++ b/Task/Detect-division-by-zero/Lingo/detect-division-by-zero.lingo @@ -0,0 +1,9 @@ +on div (a, b) + -- for simplicity type check of vars omitted + res = value("float(a)/b") + if voidP(res) then + _player.alert("Division by zero!") + else + return res + end if +end diff --git a/Task/Detect-division-by-zero/Nim/detect-division-by-zero.nim b/Task/Detect-division-by-zero/Nim/detect-division-by-zero.nim new file mode 100644 index 0000000000..24b7cac3e4 --- /dev/null +++ b/Task/Detect-division-by-zero/Nim/detect-division-by-zero.nim @@ -0,0 +1,12 @@ +# In debug builds division by zero exceptions are thrown by default, in release +# builds not. We can still enable them explicitly. +{.push overflowChecks: on.} +proc divCheck(x, y): bool = + try: + discard x div y + except DivByZeroError: + return true + return false +{.pop.} # Restore default check settings + +echo divCheck(2, 0) diff --git a/Task/Detect-division-by-zero/Oforth/detect-division-by-zero.oforth b/Task/Detect-division-by-zero/Oforth/detect-division-by-zero.oforth new file mode 100644 index 0000000000..939417bbc3 --- /dev/null +++ b/Task/Detect-division-by-zero/Oforth/detect-division-by-zero.oforth @@ -0,0 +1,4 @@ +: divideCheck(n) +| e | + try: e [ 128 n / ] when: [ "Zero detected..." . ] + "Leaving" println ; diff --git a/Task/Detect-division-by-zero/RPGIV/detect-division-by-zero.rpgiv b/Task/Detect-division-by-zero/RPGIV/detect-division-by-zero.rpgiv new file mode 100644 index 0000000000..1f8f3013a0 --- /dev/null +++ b/Task/Detect-division-by-zero/RPGIV/detect-division-by-zero.rpgiv @@ -0,0 +1,17 @@ + dcl-c DIVIDE_BY_ZERO 00102; + + dcl-s result zoned(5:2); + dcl-s value1 zoned(5:2); + dcl-s value2 zoned(5:2); + + value1 = 10; + value2 = 0; + + monitor; + eval(h) result = value1 / value2; // Using half rounding here for the eval result + on-error DIVIDE_BY_ZERO; + // Initialise the result to 0. Consider other messaging perhaps. + result = 0; + endmon; + + *inlr = *on; diff --git a/Task/Detect-division-by-zero/Ring/detect-division-by-zero.ring b/Task/Detect-division-by-zero/Ring/detect-division-by-zero.ring new file mode 100644 index 0000000000..e5040bf9b2 --- /dev/null +++ b/Task/Detect-division-by-zero/Ring/detect-division-by-zero.ring @@ -0,0 +1,5 @@ +Try + see 9/0 +Catch + see "Catch!" + nl + cCatchError +Done diff --git a/Task/Detect-division-by-zero/Sidef/detect-division-by-zero.sidef b/Task/Detect-division-by-zero/Sidef/detect-division-by-zero.sidef new file mode 100644 index 0000000000..964b315847 --- /dev/null +++ b/Task/Detect-division-by-zero/Sidef/detect-division-by-zero.sidef @@ -0,0 +1,13 @@ +func div(a, b){ + try { + a / b + } + catch { |_, msg| + say "tried to divide by zero" if (msg ~~ /Division by zero/) + nil + } +} + +say div(10, 2); # 5 +say div(1, 0); # inf, 1/0 constants are substituted for infinity +say div(1.c, 0.c); # nil, and prints "tried to divide by zero" (complex numbers) diff --git a/Task/Detect-division-by-zero/Ursa/detect-division-by-zero.ursa b/Task/Detect-division-by-zero/Ursa/detect-division-by-zero.ursa new file mode 100644 index 0000000000..acef0acdd6 --- /dev/null +++ b/Task/Detect-division-by-zero/Ursa/detect-division-by-zero.ursa @@ -0,0 +1,8 @@ +def div_check (int x, int y) + try + / x y + return false + catch divzeroerror + return true + end try +end diff --git a/Task/Detect-division-by-zero/jq/detect-division-by-zero-1.jq b/Task/Detect-division-by-zero/jq/detect-division-by-zero-1.jq new file mode 100644 index 0000000000..4d6b611ffd --- /dev/null +++ b/Task/Detect-division-by-zero/jq/detect-division-by-zero-1.jq @@ -0,0 +1 @@ +def div(x;y): if y==0 then error("NaN") else x/y end; diff --git a/Task/Detect-division-by-zero/jq/detect-division-by-zero-2.jq b/Task/Detect-division-by-zero/jq/detect-division-by-zero-2.jq new file mode 100644 index 0000000000..1f9ca52ba4 --- /dev/null +++ b/Task/Detect-division-by-zero/jq/detect-division-by-zero-2.jq @@ -0,0 +1 @@ +try div(3;0) catch if "NaN" then "div by 0 error detected" else . end diff --git a/Task/Determine-if-a-string-is-numeric/8th/determine-if-a-string-is-numeric.8th b/Task/Determine-if-a-string-is-numeric/8th/determine-if-a-string-is-numeric.8th new file mode 100644 index 0000000000..d279f03371 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/8th/determine-if-a-string-is-numeric.8th @@ -0,0 +1 @@ +: number? >n >kind ns:n n:= ; diff --git a/Task/Determine-if-a-string-is-numeric/Apex/determine-if-a-string-is-numeric.apex b/Task/Determine-if-a-string-is-numeric/Apex/determine-if-a-string-is-numeric.apex new file mode 100644 index 0000000000..55e8bf071a --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Apex/determine-if-a-string-is-numeric.apex @@ -0,0 +1,8 @@ +String numericString = '123456'; +String partlyNumericString = '123DMS'; +String decimalString = '123.456'; + +System.debug(numericString.isNumeric()); // this will be true +System.debug(partlyNumericString.isNumeric()); // this will be false +System.debug(decimalString.isNumeric()); // this will be false +System.debug(decimalString.remove('.').isNumeric()); // this will be true diff --git a/Task/Determine-if-a-string-is-numeric/EchoLisp/determine-if-a-string-is-numeric.echolisp b/Task/Determine-if-a-string-is-numeric/EchoLisp/determine-if-a-string-is-numeric.echolisp new file mode 100644 index 0000000000..ce30a0694e --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/EchoLisp/determine-if-a-string-is-numeric.echolisp @@ -0,0 +1,6 @@ +(string->number "albert") + → #f +(string->number -666) + → -666 +(if (string->number 666) 'YES 'NO) + → YES diff --git a/Task/Determine-if-a-string-is-numeric/FreeBASIC/determine-if-a-string-is-numeric.freebasic b/Task/Determine-if-a-string-is-numeric/FreeBASIC/determine-if-a-string-is-numeric.freebasic new file mode 100644 index 0000000000..30e213e1da --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/FreeBASIC/determine-if-a-string-is-numeric.freebasic @@ -0,0 +1,95 @@ +' FB 1.05.0 Win64 + +Dim Shared symbols(0 To 15) As UByte +For i As Integer = 48 to 57 + symbols(i - 48) = i +Next +For i As Integer = 97 to 102 + symbols(i - 87) = i +Next + +Const plus As UByte = 43 +Const minus As Ubyte = 45 +Const dot As UByte = 46 + +Function isNumeric(s As Const String, base_ As Integer = 10) As Boolean + If s = "" OrElse s = "." OrElse s = "+" OrElse s = "-" Then Return False + Err = 0 + + If base_ < 2 OrElse base_ > 16 Then + Err = 1000 + Return False + End If + + Dim t As String = LCase(s) + + If (t[0] = plus) OrElse (t[0] = minus) Then + t = Mid(t, 2) + End If + + If Left(t, 2) = "&h" Then + If base_ <> 16 Then Return False + t = Mid(t, 3) + End if + + If Left(t, 2) = "&o" Then + If base_ <> 8 Then Return False + t = Mid(t, 3) + End if + + If Left(t, 2) = "&b" Then + If base_ <> 2 Then Return False + t = Mid(t, 3) + End if + + If Len(t) = 0 Then Return False + Dim As Boolean isValid, hasDot = false + + For i As Integer = 0 To Len(t) - 1 + isValid = False + + For j As Integer = 0 To base_ - 1 + If t[i] = symbols(j) Then + isValid = True + Exit For + End If + If t[i] = dot Then + If CInt(Not hasDot) AndAlso (base_ = 10) Then + hasDot = True + IsValid = True + Exit For + End If + Return False ' either more than one dot or not base 10 + End If + Next j + + If Not isValid Then Return False + Next i + + Return True +End Function + +Dim s As String +s = "1234.056789" +Print s, " (base 10) => "; isNumeric(s) +s = "1234.56" +Print s, " (base 7) => "; isNumeric(s, 7) +s = "021101" +Print s, " (base 2) => "; isNumeric(s, 2) +s = "Dog" +Print s, " (base 16) => "; isNumeric(s, 16) +s = "Bad125" +Print s, " (base 16) => "; isNumeric(s, 16) +s = "-0177" +Print s, " (base 8) => "; isNumeric(s, 8) +s = "+123abcd.ef" +Print s, " (base 16) => "; isNumeric(s, 8) +s = "54321" +Print s, " (base 6) => "; isNumeric(s, 6) +s = "123xyz" +Print s, " (base 10) => "; isNumeric(s) +s = "xyz" +Print s, " (base 10) => "; isNumeric(s) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Determine-if-a-string-is-numeric/I/determine-if-a-string-is-numeric.i b/Task/Determine-if-a-string-is-numeric/I/determine-if-a-string-is-numeric.i new file mode 100644 index 0000000000..f44ca50611 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/I/determine-if-a-string-is-numeric.i @@ -0,0 +1,15 @@ +function numeric(""n) { + number(n) + issues { + print(n, " is not numeric!") + return + } + print(n, " is numeric :)") +} + +software { + numeric("1200") + numeric("3.14") + numeric("3/4") + numeric("abcdefg") +} diff --git a/Task/Determine-if-a-string-is-numeric/Lasso/determine-if-a-string-is-numeric-1.lasso b/Task/Determine-if-a-string-is-numeric/Lasso/determine-if-a-string-is-numeric-1.lasso new file mode 100644 index 0000000000..fa8a216417 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Lasso/determine-if-a-string-is-numeric-1.lasso @@ -0,0 +1,2 @@ +local(str='12345') +string_isNumeric(#str) // true diff --git a/Task/Determine-if-a-string-is-numeric/Lasso/determine-if-a-string-is-numeric-2.lasso b/Task/Determine-if-a-string-is-numeric/Lasso/determine-if-a-string-is-numeric-2.lasso new file mode 100644 index 0000000000..57a230fbbd --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Lasso/determine-if-a-string-is-numeric-2.lasso @@ -0,0 +1,2 @@ +'12345'->isdigit // true +'1X34Q'->isdigit // false diff --git a/Task/Determine-if-a-string-is-numeric/Nim/determine-if-a-string-is-numeric.nim b/Task/Determine-if-a-string-is-numeric/Nim/determine-if-a-string-is-numeric.nim new file mode 100644 index 0000000000..43a6412571 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Nim/determine-if-a-string-is-numeric.nim @@ -0,0 +1,10 @@ +import strutils +let s = "123" +var f: float +try: + f = parseFloat s +except EInvalidValue: + echo "not numeric" + +if s.contains AllChars - Digits: + echo "not a positive integer" diff --git a/Task/Determine-if-a-string-is-numeric/PeopleCode/determine-if-a-string-is-numeric.peoplecode b/Task/Determine-if-a-string-is-numeric/PeopleCode/determine-if-a-string-is-numeric.peoplecode new file mode 100644 index 0000000000..5d4acc0809 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/PeopleCode/determine-if-a-string-is-numeric.peoplecode @@ -0,0 +1,25 @@ +Built-In Function +Syntax + +IsNumber(Value) +Description + +Use the IsNumber function to determine if Value contains a valid numeric value. Numeric characters include sign indicators and comma and period decimal points. +To determine if a value is a number and if it's in the user's local format, use the IsUserNumber function. + +Parameters + +Value +Specify a string you want to search to determine if it is a valid number. + +Returns +A Boolean value: True if Value contains a valid numeric value, False otherwise. + +Example + +&Value = Get Field().Value; +If IsNumber(&Value) Then + /* do numeric processing */ +Else + /* do non-numeric processing */ +End-if; diff --git a/Task/Determine-if-a-string-is-numeric/Phix/determine-if-a-string-is-numeric-1.phix b/Task/Determine-if-a-string-is-numeric/Phix/determine-if-a-string-is-numeric-1.phix new file mode 100644 index 0000000000..8c38fd26ed --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Phix/determine-if-a-string-is-numeric-1.phix @@ -0,0 +1,3 @@ +function isNumber(string s) + return scanf(s,"%f")!={} +end function diff --git a/Task/Determine-if-a-string-is-numeric/Phix/determine-if-a-string-is-numeric-2.phix b/Task/Determine-if-a-string-is-numeric/Phix/determine-if-a-string-is-numeric-2.phix new file mode 100644 index 0000000000..412ecacb96 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Phix/determine-if-a-string-is-numeric-2.phix @@ -0,0 +1,10 @@ +function testset(sequence s) + for i=1 to length(s) do + s[i] = isNumber(s[i]) + end for + return s +end function +?testset({"#a","#A","0xA","0(16)A","#FF","255","0",".14",".05","-5.2","0xf","ten","1B"}) +?testset({" 12 ",trim(" 12 ")}) +?testset({"0o16","0o18"}) +?testset({"1_000","0b10101111_11110000_11110000_00110011","-0b10101","0x10.5",""," ","1.","50e"}) diff --git a/Task/Determine-if-a-string-is-numeric/Ring/determine-if-a-string-is-numeric.ring b/Task/Determine-if-a-string-is-numeric/Ring/determine-if-a-string-is-numeric.ring new file mode 100644 index 0000000000..9a9f08eccd --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Ring/determine-if-a-string-is-numeric.ring @@ -0,0 +1,2 @@ +see isdigit("0123456789") + nl + # print 1 + isdigit("0123a") # print 0 diff --git a/Task/Determine-if-a-string-is-numeric/Sidef/determine-if-a-string-is-numeric-1.sidef b/Task/Determine-if-a-string-is-numeric/Sidef/determine-if-a-string-is-numeric-1.sidef new file mode 100644 index 0000000000..9ac51a4d37 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Sidef/determine-if-a-string-is-numeric-1.sidef @@ -0,0 +1 @@ +say "0.1E-5".looks_like_number; #=> true diff --git a/Task/Determine-if-a-string-is-numeric/Sidef/determine-if-a-string-is-numeric-2.sidef b/Task/Determine-if-a-string-is-numeric/Sidef/determine-if-a-string-is-numeric-2.sidef new file mode 100644 index 0000000000..a68e335cd6 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Sidef/determine-if-a-string-is-numeric-2.sidef @@ -0,0 +1,4 @@ +func is_numeric(s) { + (s ~~ /^[+-]?+(?=\.?[0-9])[0-9_]*+(?:\.[0-9_]++)?(?:[Ee](?:[+-]?+[0-9_]+))?\z/) || + (s ~~ /^0(?:b[10_]*|x[0-9A-Fa-f_]*|[0-9_]+\b)\z/) +} diff --git a/Task/Determine-if-a-string-is-numeric/Sidef/determine-if-a-string-is-numeric-3.sidef b/Task/Determine-if-a-string-is-numeric/Sidef/determine-if-a-string-is-numeric-3.sidef new file mode 100644 index 0000000000..5b76ac82ba --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Sidef/determine-if-a-string-is-numeric-3.sidef @@ -0,0 +1,4 @@ +var strings = %w(0 0.0 -123 abc 0x10 0xABC 123a -123e3 0.1E-5 50e); +for str in strings { + say ("%9s => %s" % (str, is_numeric(str))) +} diff --git a/Task/Determine-if-a-string-is-numeric/Swift/determine-if-a-string-is-numeric-1.swift b/Task/Determine-if-a-string-is-numeric/Swift/determine-if-a-string-is-numeric-1.swift new file mode 100644 index 0000000000..8fecdda4e9 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Swift/determine-if-a-string-is-numeric-1.swift @@ -0,0 +1,3 @@ +func isNumeric(a: String) -> Bool { + return Double(a) != nil +} diff --git a/Task/Determine-if-a-string-is-numeric/Swift/determine-if-a-string-is-numeric-2.swift b/Task/Determine-if-a-string-is-numeric/Swift/determine-if-a-string-is-numeric-2.swift new file mode 100644 index 0000000000..c2d0f7f519 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Swift/determine-if-a-string-is-numeric-2.swift @@ -0,0 +1,3 @@ +func isNumeric(a: String) -> Bool { + return a.toInt() != nil +} diff --git a/Task/Determine-if-a-string-is-numeric/Ursa/determine-if-a-string-is-numeric.ursa b/Task/Determine-if-a-string-is-numeric/Ursa/determine-if-a-string-is-numeric.ursa new file mode 100644 index 0000000000..5f231110b7 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Ursa/determine-if-a-string-is-numeric.ursa @@ -0,0 +1,8 @@ +def isnum (string str) + try + double str + return true + catch valueerror + return false + end try +end isnum diff --git a/Task/Determine-if-a-string-is-numeric/XLISP/determine-if-a-string-is-numeric.xlisp b/Task/Determine-if-a-string-is-numeric/XLISP/determine-if-a-string-is-numeric.xlisp new file mode 100644 index 0000000000..48cd3df5e9 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/XLISP/determine-if-a-string-is-numeric.xlisp @@ -0,0 +1,2 @@ +(DEFUN NUMERICP (X) + (IF (STRING->NUMBER X) T)) diff --git a/Task/Determine-if-a-string-is-numeric/jq/determine-if-a-string-is-numeric-1.jq b/Task/Determine-if-a-string-is-numeric/jq/determine-if-a-string-is-numeric-1.jq new file mode 100644 index 0000000000..a10d402432 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/jq/determine-if-a-string-is-numeric-1.jq @@ -0,0 +1 @@ +try tonumber catch false diff --git a/Task/Determine-if-a-string-is-numeric/jq/determine-if-a-string-is-numeric-2.jq b/Task/Determine-if-a-string-is-numeric/jq/determine-if-a-string-is-numeric-2.jq new file mode 100644 index 0000000000..0443481dc2 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/jq/determine-if-a-string-is-numeric-2.jq @@ -0,0 +1 @@ +def is_numeric: true and try tonumber catch false; diff --git a/Task/Determine-if-only-one-instance-is-running/Lasso/determine-if-only-one-instance-is-running.lasso b/Task/Determine-if-only-one-instance-is-running/Lasso/determine-if-only-one-instance-is-running.lasso new file mode 100644 index 0000000000..6d43d51497 --- /dev/null +++ b/Task/Determine-if-only-one-instance-is-running/Lasso/determine-if-only-one-instance-is-running.lasso @@ -0,0 +1,22 @@ +#!/usr/bin/lasso9 + +local(lockfile = file('/tmp/myprocess.lockfile')) + +if(#lockfile -> exists) => { + stdoutnl('Error: App is running as of ' + #lockfile -> readstring) + abort +} + +handle => { + #lockfile -> delete +} + +stdoutnl('Starting execution') + +#lockfile -> doWithClose => { + #lockfile -> writebytes(bytes(date)) +} + +sleep(10000) + +stdoutnl('Execution done') diff --git a/Task/Determine-if-only-one-instance-is-running/Nim/determine-if-only-one-instance-is-running.nim b/Task/Determine-if-only-one-instance-is-running/Nim/determine-if-only-one-instance-is-running.nim new file mode 100644 index 0000000000..2fbd7ff0f3 --- /dev/null +++ b/Task/Determine-if-only-one-instance-is-running/Nim/determine-if-only-one-instance-is-running.nim @@ -0,0 +1,19 @@ +import os, posix + +let fn = getHomeDir() & "rosetta-code-lock" +proc ooiUnlink {.noconv.} = discard unlink fn + +proc onlyOneInstance = + var fl = TFlock(lType: F_WRLCK.cshort, lWhence: SEEK_SET.cshort) + var fd = getFileHandle fn.open fmReadWrite + if fcntl(fd, F_SETLK, addr fl) < 0: + stderr.writeln "Another instance of this program is running" + quit 1 + addQuitProc ooiUnlink + +onlyOneInstance() + +for i in countdown(10, 1): + echo i + sleep 1000 +echo "Fin!" diff --git a/Task/Determine-if-only-one-instance-is-running/Phix/determine-if-only-one-instance-is-running.phix b/Task/Determine-if-only-one-instance-is-running/Phix/determine-if-only-one-instance-is-running.phix new file mode 100644 index 0000000000..179eb8bda4 --- /dev/null +++ b/Task/Determine-if-only-one-instance-is-running/Phix/determine-if-only-one-instance-is-running.phix @@ -0,0 +1,23 @@ +include pGUI.e + +function copydata_cb(Ihandle /*ih*/, atom pCommandLine, integer size) + -- (the first instance is sent a copy of the second one's command line) + printf(1,"COPYDATA(%s, %d)\n",{peek_string(pCommandLine), size}); + return IUP_DEFAULT; +end function + +function esc_close(Ihandle /*ih*/, atom c) + return iff(c=K_ESC?IUP_CLOSE:IUP_CONTINUE) +end function + + IupOpen("../pGUI/") + IupSetGlobal("SINGLEINSTANCE", "Single") -- (must [partially] match the main window title) + if IupGetGlobal("SINGLEINSTANCE")!="" then + Ihandle dlg = IupDialog(IupVbox({IupLabel("hello")},"MARGIN=200x200")) + IupSetAttribute(dlg,"TITLE","Single Instance") + IupSetCallback(dlg, "K_ANY", Icallback("esc_close")) + IupSetCallback(dlg, "COPYDATA_CB", Icallback("copydata_cb")); + IupShow(dlg) + IupMainLoop() + end if + IupClose() diff --git a/Task/Determine-if-only-one-instance-is-running/Sidef/determine-if-only-one-instance-is-running.sidef b/Task/Determine-if-only-one-instance-is-running/Sidef/determine-if-only-one-instance-is-running.sidef new file mode 100644 index 0000000000..088e14c07d --- /dev/null +++ b/Task/Determine-if-only-one-instance-is-running/Sidef/determine-if-only-one-instance-is-running.sidef @@ -0,0 +1,12 @@ +# For this to work, you need to explicitly +# store the returned fh inside a variable. +var fh = File(__FILE__).open_r + +# Now call the flock() method on it +fh.flock(File.LOCK_EX | File.LOCK_NB) -> + || die "I'm already running!" + +# Your code here... +say "Running..." +Sys.sleep(20) +say 'Done!' diff --git a/Task/Determine-if-only-one-instance-is-running/Swift/determine-if-only-one-instance-is-running.swift b/Task/Determine-if-only-one-instance-is-running/Swift/determine-if-only-one-instance-is-running.swift new file mode 100644 index 0000000000..72cd07d8c0 --- /dev/null +++ b/Task/Determine-if-only-one-instance-is-running/Swift/determine-if-only-one-instance-is-running.swift @@ -0,0 +1,26 @@ +import Foundation + +let globalCenter = NSDistributedNotificationCenter.defaultCenter() +let time = NSDate().timeIntervalSince1970 + +globalCenter.addObserverForName("OnlyOne", object: nil, queue: NSOperationQueue.mainQueue()) {not in + if let senderTime = not.userInfo?["time"] as? NSTimeInterval where senderTime != time { + println("More than one running") + exit(0) + } else { + println("Only one") + } +} + +func send() { + globalCenter.postNotificationName("OnlyOne", object: nil, userInfo: ["time": time]) + + let waitTime = dispatch_time(DISPATCH_TIME_NOW, Int64(3 * NSEC_PER_SEC)) + + dispatch_after(waitTime, dispatch_get_main_queue()) { + send() + } +} + +send() +CFRunLoopRun() diff --git a/Task/Digital-root-Multiplicative-digital-root/Nim/digital-root-multiplicative-digital-root.nim b/Task/Digital-root-Multiplicative-digital-root/Nim/digital-root-multiplicative-digital-root.nim new file mode 100644 index 0000000000..bcd4148789 --- /dev/null +++ b/Task/Digital-root-Multiplicative-digital-root/Nim/digital-root-multiplicative-digital-root.nim @@ -0,0 +1,28 @@ +import strutils, future + +template newSeqWith(len: int, init: expr): expr = + var result {.gensym.} = newSeq[type(init)](len) + for i in 0 .. 9: + var n = 1 + for dig in $mdr[mdr.high]: + n *= parseInt($dig) + mdr.add n + (mdr.high, mdr[mdr.high]) + +for n in [123321, 7739, 893, 899998]: + echo align($n, 6)," ",mdroot(n) +echo "" + +var table = newSeqWith(10, newSeq[int]()) +for n in 0..int.high: + if table.map((x: seq[int]) => x.len).min >= 5: break + table[mdroot(n).mdr].add n + +for mp, val in table: + echo mp,": ",val[0..4] diff --git a/Task/Digital-root-Multiplicative-digital-root/Sidef/digital-root-multiplicative-digital-root.sidef b/Task/Digital-root-Multiplicative-digital-root/Sidef/digital-root-multiplicative-digital-root.sidef new file mode 100644 index 0000000000..546b4f8589 --- /dev/null +++ b/Task/Digital-root-Multiplicative-digital-root/Sidef/digital-root-multiplicative-digital-root.sidef @@ -0,0 +1,23 @@ +func mdroot(n) { + var (mdr, persist) = (n, 0) + while (mdr >= 10) { + mdr = mdr.digits.product + ++persist + } + [mdr, persist] +} + +say "Number: MDR MP\n====== === ==" +[123321, 7739, 893, 899998].each{|n| "%6d: %3d %3d\n" \ + .printf(n, mdroot(n)...) } + +var counter = Hash() + +Inf.times { |i| + var j = i-1 + counter{mdroot(j).first} := [] << j + break if counter.values.all {|v| v.len >= 5 } +} + +say "\nMDR: [n0..n4]\n=== ========" +10.times {|i| "%3d: %s\n".printf(i-1, counter{i-1}.first(5)) } diff --git a/Task/Digital-root-Multiplicative-digital-root/jq/digital-root-multiplicative-digital-root-1.jq b/Task/Digital-root-Multiplicative-digital-root/jq/digital-root-multiplicative-digital-root-1.jq new file mode 100644 index 0000000000..d16b80de42 --- /dev/null +++ b/Task/Digital-root-Multiplicative-digital-root/jq/digital-root-multiplicative-digital-root-1.jq @@ -0,0 +1,32 @@ +def do_until(condition; next): + def u: if condition then . else (next|u) end; + u; + +def mdroot(n): + def multiply: reduce .[] as $i (1; .*$i); + # state: [mdr, persist] + [n, 0] + | do_until( .[0] < 10; + [(.[0] | tostring | explode | map(.-48) | multiply), .[1] + 1] + ); + +# Produce a table with 10 rows (numbered from 0), +# showing the first n numbers having the row-number as the mdr +def tabulate(n): + # state: [answer_matrix, next_i] + def tab: + def minlength: map(length) | min; + .[0] as $matrix + | .[1] as $i + | if (.[0]|minlength) == n then .[0] + else (mdroot($i) | .[0]) as $mdr + | if $matrix[$mdr]|length < n then + ($matrix[$mdr] + [$i]) as $row + | $matrix | setpath([$mdr]; $row) + else $matrix + end + | [ ., $i + 1 ] + | tab + end; + + [[], 0] | tab; diff --git a/Task/Digital-root-Multiplicative-digital-root/jq/digital-root-multiplicative-digital-root-2.jq b/Task/Digital-root-Multiplicative-digital-root/jq/digital-root-multiplicative-digital-root-2.jq new file mode 100644 index 0000000000..71e4e00e1d --- /dev/null +++ b/Task/Digital-root-Multiplicative-digital-root/jq/digital-root-multiplicative-digital-root-2.jq @@ -0,0 +1,15 @@ +def neatly: + . as $in + | range(0;length) + | "\(.): \($in[.])"; + +def rjust(n): tostring | (n-length)*" " + .; + +# The task: +" i : [MDR, MP]", +((123321, 7739, 893, 899998) as $i + | "\($i|rjust(6)): \(mdroot($i))"), +"", +"Tabulation", +"MDR: [n0..n4]", +(tabulate(5) | neatly) diff --git a/Task/Digital-root-Multiplicative-digital-root/jq/digital-root-multiplicative-digital-root-3.jq b/Task/Digital-root-Multiplicative-digital-root/jq/digital-root-multiplicative-digital-root-3.jq new file mode 100644 index 0000000000..64b3201fe0 --- /dev/null +++ b/Task/Digital-root-Multiplicative-digital-root/jq/digital-root-multiplicative-digital-root-3.jq @@ -0,0 +1,20 @@ +$ jq -n -r -c -f mdr.jq + + i : [MDR, MP] +123321: [8,3] + 7739: [8,3] + 893: [2,3] +899998: [0,2] + +Tabulation +MDR: [n0..n4] +0: [0,10,20,25,30] +1: [1,11,111,1111,11111] +2: [2,12,21,26,34] +3: [3,13,31,113,131] +4: [4,14,22,27,39] +5: [5,15,35,51,53] +6: [6,16,23,28,32] +7: [7,17,71,117,171] +8: [8,18,24,29,36] +9: [9,19,33,91,119] diff --git a/Task/Digital-root/FreeBASIC/digital-root.freebasic b/Task/Digital-root/FreeBASIC/digital-root.freebasic new file mode 100644 index 0000000000..b9b565434f --- /dev/null +++ b/Task/Digital-root/FreeBASIC/digital-root.freebasic @@ -0,0 +1,27 @@ +' FB 1.05.0 Win64 + +Function digitalRoot(n As UInteger, ByRef ap As Integer, base_ As Integer = 10) As Integer + Dim dr As Integer + ap = 0 + Do + dr = 0 + While n > 0 + dr += n Mod base_ + n = n \ base_ + Wend + ap += 1 + n = dr + Loop until dr < base_ + Return dr +End Function + +Dim As Integer dr, ap +Dim a(3) As UInteger = {627615, 39390, 588225, 393900588225} +For i As Integer = 0 To 3 + ap = 0 + dr = digitalRoot(a(i), ap) + Print a(i), "Additive Persistence ="; ap, "Digital root ="; dr + Print +Next +Print "Press any key to quit" +Sleep diff --git a/Task/Digital-root/Nim/digital-root.nim b/Task/Digital-root/Nim/digital-root.nim new file mode 100644 index 0000000000..25b33831dd --- /dev/null +++ b/Task/Digital-root/Nim/digital-root.nim @@ -0,0 +1,14 @@ +import strutils + +proc droot(n: int64): auto = + var x = @[n] + while x[x.high] > 10: + var s = 0'i64 + for dig in $x[x.high]: + s += parseInt("" & dig) + x.add s + return (x.len - 1, x[x.high]) + +for n in [627615'i64, 39390'i64, 588225'i64, 393900588225'i64]: + let (a, d) = droot(n) + echo align($n, 12)," has additive persistance ",a," and digital root of ",d diff --git a/Task/Digital-root/Oforth/digital-root.oforth b/Task/Digital-root/Oforth/digital-root.oforth new file mode 100644 index 0000000000..13f466aa90 --- /dev/null +++ b/Task/Digital-root/Oforth/digital-root.oforth @@ -0,0 +1,4 @@ +: sumDigits(n, base) 0 while(n) [ n base /mod ->n + ] ; + +: digitalRoot(n, base) + 0 while(n 9 >) [ 1 + sumDigits(n, base) ->n ] n swap Pair new ; diff --git a/Task/Digital-root/Potion/digital-root.potion b/Task/Digital-root/Potion/digital-root.potion new file mode 100644 index 0000000000..a1fc36030d --- /dev/null +++ b/Task/Digital-root/Potion/digital-root.potion @@ -0,0 +1,17 @@ +digital = (x) : + dr = x string # Digital Root. + ap = 0 # Additive Persistence. + while (dr length > 1) : + sum = 0 + dr length times (i): sum = sum + dr(i) number integer. + dr = sum string + ap++ + . + (x, " has additive persistence ", ap, + " and digital root ", dr, ";\n") join print +. + +digital(627615) +digital(39390) +digital(588225) +digital(393900588225) diff --git a/Task/Digital-root/Ring/digital-root.ring b/Task/Digital-root/Ring/digital-root.ring new file mode 100644 index 0000000000..f726d94eaf --- /dev/null +++ b/Task/Digital-root/Ring/digital-root.ring @@ -0,0 +1,22 @@ +c = 0 +see "Digital root of 627615 is " + digitRoot(627615, 10) + " persistance is " + c + nl +see "Digital root of 39390 is " + digitRoot(39390, 10) + " persistance is " + c + nl +see "Digital root of 588225 is " + digitRoot(588225, 10) + " persistance is " + c + nl +see "Digital root of 9992 is " + digitRoot(9992, 10) + " persistance is " + c + nl + +func digitRoot n,b + c = 0 + while n >= b + c = c + 1 + n = digSum(n, b) + end + return n + +func digSum n, b + s = 0 + while n != 0 + q = floor(n / b) + s = s + n - q * b + n = q + end + return s diff --git a/Task/Digital-root/Sidef/digital-root.sidef b/Task/Digital-root/Sidef/digital-root.sidef new file mode 100644 index 0000000000..957c665942 --- /dev/null +++ b/Task/Digital-root/Sidef/digital-root.sidef @@ -0,0 +1,25 @@ +func digroot (r, base = 10) { + var root = r.base(base) + var persistence = 0 + while (root.len > 1) { + root = root.chars.map{|n| Number(n, 36) }.sum(0).base(base) + ++persistence + } + return(persistence, root) +} + +var nums = [5, 627615, 39390, 588225, 393900588225] +var bases = [2, 3, 8, 10, 16, 36] +var fmt = "%25s(%2s): persistance = %s, root = %2s\n" + +nums << (550777011503 * + 105564897893993412813307040538786690718089963180462913406682192479) + +bases.each { |b| + nums.each { |n| + var x = n.base(b) + x = 'BIG' if (x.len > 25) + fmt.printf(x, b, digroot(n, b)) + } + print "\n" +} diff --git a/Task/Digital-root/Wortel/digital-root.wortel b/Task/Digital-root/Wortel/digital-root.wortel new file mode 100644 index 0000000000..925c84ade8 --- /dev/null +++ b/Task/Digital-root/Wortel/digital-root.wortel @@ -0,0 +1,13 @@ +@let { + sumDigits ^(@sum @arr) + drootl &\@rangef [. sumDigits ^(\~>1 #@arr)] + + droot ^(@last drootl) + apers ^(#-drootl) + + [ + !console.log "[number]: [digital root] [additive persistence] [intermediate sums]" + ~@each [627615 39390 588225 393900588225] + &n !console.log "{n}: {!droot n} {!apers n} {@str !drootl n}" + ] +} diff --git a/Task/Digital-root/jq/digital-root-1.jq b/Task/Digital-root/jq/digital-root-1.jq new file mode 100644 index 0000000000..f4221dbc39 --- /dev/null +++ b/Task/Digital-root/jq/digital-root-1.jq @@ -0,0 +1,20 @@ +def do_until(condition; next): + def u: if condition then . else (next|u) end; + u; + +# n may be a decimal number or a string representing a decimal number +def digital_root(n): + # string-only version + def dr: + # state: [mdr, persist] + do_until( .[0] | length == 1; + [ (.[0] | explode | map(.-48) | add | tostring), .[1] + 1 ] + ); + [n|tostring, 0] | dr | .[0] |= tonumber; + +def neatly: + . as $in + | range(0;length) + | "\(.): \($in[.])"; + +def rjust(n): tostring | (n-length)*" " + .; diff --git a/Task/Digital-root/jq/digital-root-2.jq b/Task/Digital-root/jq/digital-root-2.jq new file mode 100644 index 0000000000..7235f8bffb --- /dev/null +++ b/Task/Digital-root/jq/digital-root-2.jq @@ -0,0 +1,8 @@ +( + " i : [DR, P]", + (961038, 923594037444, 670033, 448944221089 + ) as $i + | "\($i|rjust(12)): \(digital_root($i))" +), + "", + "digital_root(\"1\" * 100000) => \(digital_root( "1" * 100000))" diff --git a/Task/Digital-root/jq/digital-root-3.jq b/Task/Digital-root/jq/digital-root-3.jq new file mode 100644 index 0000000000..0c96a6b6bf --- /dev/null +++ b/Task/Digital-root/jq/digital-root-3.jq @@ -0,0 +1,9 @@ +$ jq -M -n -r -c -f Digital_root.jq + + i : [DR, P] + 961038: [9,2] +923594037444: [9,2] + 670033: [1,3] +448944221089: [1,3] + +digital_root("1" * 100000) => [1,2] diff --git a/Task/Dinesmans-multiple-dwelling-problem/ERRE/dinesmans-multiple-dwelling-problem.erre b/Task/Dinesmans-multiple-dwelling-problem/ERRE/dinesmans-multiple-dwelling-problem.erre new file mode 100644 index 0000000000..8d3ef60106 --- /dev/null +++ b/Task/Dinesmans-multiple-dwelling-problem/ERRE/dinesmans-multiple-dwelling-problem.erre @@ -0,0 +1,48 @@ +PROGRAM DINESMAN + +BEGIN + ! Floors are numbered 0 (ground) to 4 (top) + + ! "Baker, Cooper, Fletcher, Miller, and Smith live on different floors": + stmt1$="Baker<>Cooper AND Baker<>Fletcher AND Baker<>Miller AND "+"Baker<>Smith AND Cooper<>Fletcher AND Cooper<>Miller AND "+"Cooper<>Smith AND Fletcher<>Miller AND Fletcher<>Smith AND "+"Miller<>Smith" + + ! "Baker does not live on the top floor": + stmt2$="Baker<>4" + + ! "Cooper does not live on the bottom floor": + stmt3$="Cooper<>0" + + ! "Fletcher does not live on either the top or the bottom floor": + stmt4$="Fletcher<>0 AND Fletcher<>4" + + ! "Miller lives on a higher floor than does Cooper": + stmt5$="Miller>Cooper" + + ! "Smith does not live on a floor adjacent to Fletcher's": + stmt6$="ABS(Smith-Fletcher)<>1" + + ! "Fletcher does not live on a floor adjacent to Cooper's": + stmt7$="ABS(Fletcher-Cooper)<>1" + + FOR Baker=0 TO 4 DO + FOR Cooper=0 TO 4 DO + FOR Fletcher=0 TO 4 DO + FOR Miller=0 TO 4 DO + FOR Smith=0 TO 4 DO + IF Baker<>4 AND Cooper<>0 AND Miller>Cooper THEN + IF Fletcher<>0 AND Fletcher<>4 AND ABS(Smith-Fletcher)<>1 AND ABS(Fletcher-Cooper)<>1 THEN + IF Baker<>Cooper AND Baker<>Fletcher AND Baker<>Miller AND Baker<>Smith AND Cooper<>Fletcher AND Cooper<>Miller AND Cooper<>Smith AND Fletcher<>Miller AND Fletcher<>Smith AND Miller<>Smith THEN + PRINT("Baker lives on floor ";Baker) + PRINT("Cooper lives on floor ";Cooper) + PRINT("Fletcher lives on floor ";Fletcher) + PRINT("Miller lives on floor ";Miller) + PRINT("Smith lives on floor ";Smith) + END IF + END IF + END IF + END FOR ! Smith + END FOR ! Miller + END FOR ! Fletcher + END FOR ! Cooper + END FOR ! Baker +END PROGRAM diff --git a/Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-1.echolisp b/Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-1.echolisp new file mode 100644 index 0000000000..009a31a949 --- /dev/null +++ b/Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-1.echolisp @@ -0,0 +1,27 @@ +(require 'hash) +(require' amb) + +;; +;; Solver +;; + +(define (dwelling-puzzle context names floors H) +;; each amb calls gives a floor to a name + (for ((name names)) + (hash-set H name (amb context floors))) +;; They live on different floors. + (amb-require (distinct? (amb-choices context))) + (constraints floors H) ;; may fail and backtrack +;; result returned to amb-run + (for/list ((name names)) + (cons name (hash-ref H name))) +;; (amb-fail) is possible here to see all solutions +) + +(define (task names) + (amb-run dwelling-puzzle + (amb-make-context) + names + (iota (length names)) ;; list of floors : 0,1, .... + (make-hash)) ;; hash table : "name" -> floor + ) diff --git a/Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-2.echolisp b/Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-2.echolisp new file mode 100644 index 0000000000..ebc668f96b --- /dev/null +++ b/Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-2.echolisp @@ -0,0 +1,21 @@ +(define names '("baker" "cooper" "fletcher" "miller" "smith" )) + +(define-syntax-rule (floor name) (hash-ref H name)) +(define-syntax-rule (touch a b) (= (abs (- (hash-ref H a) (hash-ref H b))) 1)) + +(define (constraints floors H) +(define top (1- (length floors))) + ;; Baker does not live on the top floor. + (amb-require (!= (floor "baker") top)) + ;; Cooper does not live on the bottom floor. + (amb-require (!= (floor "cooper") 0)) + ;; Fletcher does not live on either the top or the bottom floor. + (amb-require (!= (floor "fletcher") top)) + (amb-require (!= (floor "fletcher") 0)) + ;; Miller lives on a higher floor than does Cooper. + (amb-require (> (floor "miller") (floor "cooper"))) + ;; Smith does not live on a floor adjacent to Fletcher's. + (amb-require (not (touch "smith" "fletcher"))) + ;; Fletcher does not live on a floor adjacent to Cooper's. + (amb-require (not (touch "fletcher" "cooper"))) +) diff --git a/Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-3.echolisp b/Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-3.echolisp new file mode 100644 index 0000000000..629c014db3 --- /dev/null +++ b/Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-3.echolisp @@ -0,0 +1,2 @@ +(task names) +→ ((baker . 2) (cooper . 1) (fletcher . 3) (miller . 4) (smith . 0)) diff --git a/Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-4.echolisp b/Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-4.echolisp new file mode 100644 index 0000000000..c083f028cf --- /dev/null +++ b/Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-4.echolisp @@ -0,0 +1,13 @@ +;; add a name/floor +(define names '("baker" "cooper" "fletcher" "miller" "smith" "antoinette")) + +(define (constraints floors H) +;; ... same as above, add the following + + ;; Antoinette does not like 💔 Smith + (amb-require (not (touch "smith" "antoinette"))) + ;; Antoinette is very close ❤️ to Cooper + (amb-require (touch "cooper" "antoinette")) + ;; Antoinette wants a prime numbered floor + (amb-require (prime? (floor "antoinette"))) +) diff --git a/Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-5.echolisp b/Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-5.echolisp new file mode 100644 index 0000000000..ffe21371f3 --- /dev/null +++ b/Task/Dinesmans-multiple-dwelling-problem/EchoLisp/dinesmans-multiple-dwelling-problem-5.echolisp @@ -0,0 +1,2 @@ +(task names) + → ((baker . 0) (cooper . 1) (fletcher . 3) (miller . 4) (smith . 5) (antoinette . 2)) diff --git a/Task/Dinesmans-multiple-dwelling-problem/Ring/dinesmans-multiple-dwelling-problem.ring b/Task/Dinesmans-multiple-dwelling-problem/Ring/dinesmans-multiple-dwelling-problem.ring new file mode 100644 index 0000000000..f9194dbe22 --- /dev/null +++ b/Task/Dinesmans-multiple-dwelling-problem/Ring/dinesmans-multiple-dwelling-problem.ring @@ -0,0 +1,28 @@ +floor1 = "return baker!=cooper and baker!=fletcher and baker!=miller and + baker!=smith and cooper!=fletcher and cooper!=miller and + cooper!=smith and fletcher!=miller and fletcher!=smith and + miller!=smith" +floor2 = "return baker!=4" +floor3 = "return cooper!=0" +floor4 = "return fletcher!=0 and fletcher!=4" +floor5 = "return miller>cooper" +floor6 = "return fabs(smith-fletcher)!=1" +floor7 = "return fabs(fletcher-cooper)!=1" +for baker = 0 to 4 + for cooper = 0 to 4 + for fletcher = 0 to 4 + for miller = 0 to 4 + for smith = 0 to 4 + if eval(floor2) if eval(floor3) if eval(floor5) + if eval(floor4) if eval(floor6) if eval(floor7) + if eval(floor1) + see "baker lives on floor " + baker + nl + see "cooper lives on floor " + cooper + nl + see "fletcher lives on floor " + fletcher + nl + see "miller lives on floor " + miller + nl + see "smith lives on floor " + smith + nl ok ok ok ok ok ok ok + next + next + next + next +next diff --git a/Task/Dinesmans-multiple-dwelling-problem/Sidef/dinesmans-multiple-dwelling-problem-1.sidef b/Task/Dinesmans-multiple-dwelling-problem/Sidef/dinesmans-multiple-dwelling-problem-1.sidef new file mode 100644 index 0000000000..4d8c94a753 --- /dev/null +++ b/Task/Dinesmans-multiple-dwelling-problem/Sidef/dinesmans-multiple-dwelling-problem-1.sidef @@ -0,0 +1,34 @@ +func dinesman(problem) { + var lines = problem.split('.'); + var names = lines.first.scan(/\b[A-Z]\w*/); + var re_names = Regex(names.join('|')); + + # Later on, search for these keywords (the word "not" is handled separately). + var words = %w(first second third fourth fifth sixth seventh eighth ninth tenth + bottom top higher lower adjacent); + var re_keywords = Regex(words.join('|')); + + # Build an array of lambda's + var predicates = lines.ft(1, lines.end-1).map{ |line| + var keywords = line.scan(re_keywords); + var (name1, name2) = line.scan(re_names)...; + + keywords.map{ |keyword| + var l = do { + given(keyword) { + when ("bottom") { ->(c) { c.first == name1 } } + when ("top") { ->(c) { c.last == name1 } } + when ("higher") { ->(c) { c.index(name1) > c.index(name2) } } + when ("lower") { ->(c) { c.index(name1) < c.index(name2) } } + when ("adjacent") { ->(c) { c.index(name1) - c.index(name2) -> abs == 1 } } + default { ->(c) { c[words.index(keyword)] == name1 } } + } + } + line ~~ /\bnot\b/ ? func(c) { l(c) -> not } : l; # handle "not" + } + }.flatten; + + names.permutations { |candidate| + predicates.all { |predicate| predicate(candidate) } && return candidate; + } +} diff --git a/Task/Dinesmans-multiple-dwelling-problem/Sidef/dinesmans-multiple-dwelling-problem-2.sidef b/Task/Dinesmans-multiple-dwelling-problem/Sidef/dinesmans-multiple-dwelling-problem-2.sidef new file mode 100644 index 0000000000..93c1c2edaf --- /dev/null +++ b/Task/Dinesmans-multiple-dwelling-problem/Sidef/dinesmans-multiple-dwelling-problem-2.sidef @@ -0,0 +1,22 @@ +var demo1 = "Abe Ben Charlie David. Abe not second top. not adjacent Ben Charlie. +David Abe adjacent. David adjacent Ben. Last line." + +var demo2 = "A B C D. A not adjacent D. not B adjacent higher C. C lower D. Last line" + +var problem1 = "Baker, Cooper, Fletcher, Miller, and Smith live on different floors of an apartment house that +contains only five floors. Baker does not live on the top floor. Cooper does not live on the bottom floor. +Fletcher does not live on either the top or the bottom floor. Miller lives on a higher floor than does Cooper. +Smith does not live on a floor adjacent to Fletcher's. Fletcher does not live on a floor adjacent to Cooper's. +Where does everyone live?" + +var problem2 = "Baker, Cooper, Fletcher, Miller, Guinan, and Smith +live on different floors of an apartment house that contains +only seven floors. Guinan does not live on either the top or the third or the fourth floor. +Baker does not live on the top floor. Cooper +does not live on the bottom floor. Fletcher does not live on +either the top or the bottom floor. Miller lives on a higher +floor than does Cooper. Smith does not live on a floor +adjacent to Fletcher's. Fletcher does not live on a floor +adjacent to Cooper's. Where does everyone live?" + +[demo1, demo2, problem1, problem2].each{|problem| say dinesman(problem).join("\n"); say '' }; diff --git a/Task/Dinesmans-multiple-dwelling-problem/Sidef/dinesmans-multiple-dwelling-problem-3.sidef b/Task/Dinesmans-multiple-dwelling-problem/Sidef/dinesmans-multiple-dwelling-problem-3.sidef new file mode 100644 index 0000000000..f61d1a3d7f --- /dev/null +++ b/Task/Dinesmans-multiple-dwelling-problem/Sidef/dinesmans-multiple-dwelling-problem-3.sidef @@ -0,0 +1,17 @@ +var names = %w(Baker Cooper Fletcher Miller Smith) + +var predicates = [ + ->(c){ :Baker != c.last }, + ->(c){ :Cooper != c.first }, + ->(c){ (:Fletcher != c.first) && (:Fletcher != c.last) }, + ->(c){ c.index(:Miller) > c.index(:Cooper) }, + ->(c){ (c.index(:Smith) - c.index(:Fletcher)).abs != 1 }, + ->(c){ (c.index(:Cooper) - c.index(:Fletcher)).abs != 1 }, +] + +names.permutations { |candidate| + if (predicates.all {|predicate| predicate(candidate) }) { + say candidate.join("\n") + break + } +} diff --git a/Task/Dinesmans-multiple-dwelling-problem/jq/dinesmans-multiple-dwelling-problem-1.jq b/Task/Dinesmans-multiple-dwelling-problem/jq/dinesmans-multiple-dwelling-problem-1.jq new file mode 100644 index 0000000000..87cb2b8f27 --- /dev/null +++ b/Task/Dinesmans-multiple-dwelling-problem/jq/dinesmans-multiple-dwelling-problem-1.jq @@ -0,0 +1,16 @@ +# Input: an array representing the apartment house, with null at a +# particular position signifying that the identity of the occupant +# there has not yet been determined. +# Output: an elaboration of the input array but including person, and +# satisfying cond, where . in cond refers to the placement of person +def resides(person; cond): + range(0;5) as $n + | if (.[$n] == null or .[$n] == person) and ($n|cond) then .[$n] = person + else empty # no elaboration is possible + end ; + +# English: +def top: 4; +def bottom: 0; +def higher(j): . > j; +def adjacent(j): (. - j) | (. == 1 or . == -1); diff --git a/Task/Dinesmans-multiple-dwelling-problem/jq/dinesmans-multiple-dwelling-problem-2.jq b/Task/Dinesmans-multiple-dwelling-problem/jq/dinesmans-multiple-dwelling-problem-2.jq new file mode 100644 index 0000000000..3828c66c26 --- /dev/null +++ b/Task/Dinesmans-multiple-dwelling-problem/jq/dinesmans-multiple-dwelling-problem-2.jq @@ -0,0 +1,9 @@ +[] +| resides("Baker"; . != top) # Baker does not live on the top floor +| resides("Cooper"; . != bottom) # Cooper does not live on the bottom floor +| resides("Fletcher"; . != top and . != bottom) # Fletcher does not live on either the top or the bottom floor. +| index("Cooper") as $Cooper +| resides("Miller"; higher( $Cooper) ) # Miller lives on a higher floor than does Cooper +| index("Fletcher") as $Fletcher +| resides("Smith"; adjacent($Fletcher) | not) # Smith does not live on a floor adjacent to Fletcher's. +| select( $Fletcher | adjacent( $Cooper ) | not ) # Fletcher does not live on a floor adjacent to Cooper's. diff --git a/Task/Dinesmans-multiple-dwelling-problem/jq/dinesmans-multiple-dwelling-problem-3.jq b/Task/Dinesmans-multiple-dwelling-problem/jq/dinesmans-multiple-dwelling-problem-3.jq new file mode 100644 index 0000000000..efc8ee3f4f --- /dev/null +++ b/Task/Dinesmans-multiple-dwelling-problem/jq/dinesmans-multiple-dwelling-problem-3.jq @@ -0,0 +1,8 @@ +$ jq -n -f Dinesman.jq +[ + "Smith", + "Cooper", + "Baker", + "Fletcher", + "Miller" +] diff --git a/Task/Dining-philosophers/EchoLisp/dining-philosophers-1.echolisp b/Task/Dining-philosophers/EchoLisp/dining-philosophers-1.echolisp new file mode 100644 index 0000000000..83fcf20cc6 --- /dev/null +++ b/Task/Dining-philosophers/EchoLisp/dining-philosophers-1.echolisp @@ -0,0 +1,39 @@ +(lib 'tasks) + +(define names #(Aristotle Kant Spinoza Marx Russell)) +(define abouts #("Wittgenstein" "the nature of the World" "Kant" "starving" + "spaghettis" "the essence of things" "Ω" "📞" "⚽️" "🍅" "🌿" + "philosophy" "💔" "👠" "rosetta code" "his to-do list" )) +(define (about) (format "thinking about %a." (vector-ref abouts (random (vector-length abouts))))) + +;; statistics +(define rounds (make-vector 5 0)) +(define (eat i) (vector-set! rounds i (1+ (vector-ref rounds i)))) + +;; forks are resources = semaphores +(define (left i) i) +(define (right i) (modulo (1+ i) 5)) +(define forks (for/vector ((i 5)) (make-semaphore 1))) +(define (fork i) (vector-ref forks i)) + +(define laquais (make-semaphore 4)) + +;; philosophers tasks +(define (philo i) +;; thinking + (writeln (vector-ref names i) (about)) + (sleep (+ 2000 (random 1000))) + (wait laquais) +;; get forks + (writeln (vector-ref names i) 'sitting) + (wait (fork (left i))) + (wait (fork (right i))) + (writeln (vector-ref names i) 'eating) + (eat i) + (sleep (+ 6000 (random 1000))) +;; put-forks + (signal (fork (left i))) + (signal (fork (right i))) + (signal laquais) + i) +(define tasks (for/vector ((i 5)) (make-task philo i))) diff --git a/Task/Dining-philosophers/EchoLisp/dining-philosophers-2.echolisp b/Task/Dining-philosophers/EchoLisp/dining-philosophers-2.echolisp new file mode 100644 index 0000000000..11891c4889 --- /dev/null +++ b/Task/Dining-philosophers/EchoLisp/dining-philosophers-2.echolisp @@ -0,0 +1,10 @@ +(define (observe dummmy) + (writeln 'observer 'rounds= rounds) + #t) +(define observer (make-task observe #t )) + +(define (dinner) + (task-run observer 5000) + (for ((t tasks)) (task-run t))) + +(dinner) diff --git a/Task/Dining-philosophers/Nim/dining-philosophers.nim b/Task/Dining-philosophers/Nim/dining-philosophers.nim new file mode 100644 index 0000000000..f083249723 --- /dev/null +++ b/Task/Dining-philosophers/Nim/dining-philosophers.nim @@ -0,0 +1,41 @@ +import threadpool, locks, math, os +randomize() + +type Philosopher = ref object + name: string + forkLeft, forkRight: int + +const + n = 5 + names = ["Aristotle", "Kant", "Spinoza", "Marx", "Russell"] + +var + forks: array[n, TLock] + phils: array[n, Philosopher] + threads: array[n, TThread[Philosopher]] + +proc run(p: Philosopher) {.thread.} = + sleep random(1 .. 10) * 500 + echo p.name, " is hungry." + + acquire forks[min(p.forkLeft, p.forkRight)] + sleep random(1 .. 5) * 500 + acquire forks[max(p.forkLeft, p.forkRight)] + + echo p.name, " starts eating." + sleep random(1 .. 10) * 500 + + echo p.name, " finishes eating and leaves to think." + + release forks[p.forkLeft] + release forks[p.forkRight] + +for i in 0 .. =60 then + doy -= 1 + end if + + dsday = remainder(doy,73)+1 + dseason = floor(doy/73+1) + if dsday=5 then + return apostle[dseason] & ", in the YOLD " & dyear + elsif dsday=50 then + return holiday[dseason] & ", in the YOLD " & dyear + end if + + dseas = seasons[dseason] + dwday = weekday[remainder(doy,5)+1] + + return sprintf("%s, day %d of %s in the YOLD %s", {dwday, dsday, dseas, dyear}) +end function diff --git a/Task/Discordian-date/Phix/discordian-date-2.phix b/Task/Discordian-date/Phix/discordian-date-2.phix new file mode 100644 index 0000000000..87f06ca658 --- /dev/null +++ b/Task/Discordian-date/Phix/discordian-date-2.phix @@ -0,0 +1,10 @@ +sequence dt = {2015,1,1,0,0,0,0,0} +include timedate.e +atom oneday = timedelta(days:=1) +set_timedate_formats({"DD/MM/YYYY: "}) +for i=1 to 5 do + ?format_timedate(dt)&discordianDate(dt) + dt = adjust_timedate(dt,oneday*72) + ?format_timedate(dt)&discordianDate(dt) + dt = adjust_timedate(dt,oneday) +end for diff --git a/Task/Discordian-date/Sidef/discordian-date.sidef b/Task/Discordian-date/Sidef/discordian-date.sidef new file mode 100644 index 0000000000..10fd4bd62c --- /dev/null +++ b/Task/Discordian-date/Sidef/discordian-date.sidef @@ -0,0 +1,31 @@ +require('Time::Piece'); + +var seasons = %w(Chaos Discord Confusion Bureaucracy The\ Aftermath); +var week_days = %w(Sweetmorn Boomtime Pungenday Prickle-Prickle Setting\ Orange); + +func ordinal (n) { + "#{n}" + (n % 100 ~~ [11,12,13] ? 'th' + :
XYZ
1456
2415161
3401501601
[n % 10]) +} + +func ddate(ymd) { + var d = %s'Time::Piece'.strptime(ymd, '%Y-%m-%d'); + var yold = "in the YOLD #{d.year + 1166}"; + + var day_of_year0 = d.day_of_year; + + if (d.is_leap_year) { + return "St. Tib's Day, #{yold}" if ([d.mon, d.mday] == [2, 29]); + day_of_year0-- if (day_of_year0 >= 60); # Compensate for St. Tib's Day + } + + var weekday = week_days[day_of_year0 % week_days.len]; + var season = seasons[day_of_year0 / 73]; + var season_day = ordinal(day_of_year0 % 73 + 1); + + return "#{weekday}, the #{season_day} day of #{season} #{yold}"; +} + +%w(2010-07-22 2012-02-28 2012-02-29 2012-03-01).each { |ymd| + say "#{ymd} is #{ddate(ymd)}" +} diff --git a/Task/Distributed-programming/LFE/distributed-programming-1.lfe b/Task/Distributed-programming/LFE/distributed-programming-1.lfe new file mode 100644 index 0000000000..b34cff7abb --- /dev/null +++ b/Task/Distributed-programming/LFE/distributed-programming-1.lfe @@ -0,0 +1,5 @@ +$ ./bin/lfe +Erlang/OTP 17 [erts-6.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] + +LFE Shell V6.2 (abort with ^G) +> diff --git a/Task/Distributed-programming/LFE/distributed-programming-2.lfe b/Task/Distributed-programming/LFE/distributed-programming-2.lfe new file mode 100644 index 0000000000..3f1e0f0369 --- /dev/null +++ b/Task/Distributed-programming/LFE/distributed-programming-2.lfe @@ -0,0 +1,19 @@ +> (defun get-server-name () + (list_to_atom (++ "exampleserver@" (element 2 (inet:gethostname))))) + +> (defun start () + (net_kernel:start `(,(get-server-name) shortnames)) + (erlang:set_cookie (node) 'rosettaexample) + (let ((pid (spawn #'listen/0))) + (register 'serverref pid) + (io:format "~p ready~n" (list (node pid))) + 'ok)) + +> (defun listen () + (receive + (`#(echo ,pid ,data) + (io:format "Got ~p from ~p~n" (list data (node pid))) + (! pid `#(hello ,data)) + (listen)) + (x + (io:format "Unexpected pattern: ~p~n" `(,x))))) diff --git a/Task/Distributed-programming/LFE/distributed-programming-3.lfe b/Task/Distributed-programming/LFE/distributed-programming-3.lfe new file mode 100644 index 0000000000..2aec919cc3 --- /dev/null +++ b/Task/Distributed-programming/LFE/distributed-programming-3.lfe @@ -0,0 +1,14 @@ +> (defun get-server-name () + (list_to_atom (++ "exampleserver@" (element 2 (inet:gethostname))))) + +> (defun send (data) + (net_kernel:start '(exampleclient shortnames)) + (erlang:set_cookie (node) 'rosettaexample) + (io:format "connecting to ~p~n" `(,(get-server-name))) + (! `#(serverref ,(get-server-name)) `#(echo ,(self) ,data)) + (receive + (`#(hello ,data) + (io:format "Received ~p~n" `(,data))) + (x + (io:format "Unexpected pattern: ~p~n" (list x)))) + 'ok) diff --git a/Task/Distributed-programming/LFE/distributed-programming-4.lfe b/Task/Distributed-programming/LFE/distributed-programming-4.lfe new file mode 100644 index 0000000000..eb912469be --- /dev/null +++ b/Task/Distributed-programming/LFE/distributed-programming-4.lfe @@ -0,0 +1,4 @@ +> (start) +exampleserver@yourhostname ready +ok +(exampleserver@yourhostname)> diff --git a/Task/Distributed-programming/LFE/distributed-programming-5.lfe b/Task/Distributed-programming/LFE/distributed-programming-5.lfe new file mode 100644 index 0000000000..08f8931fd6 --- /dev/null +++ b/Task/Distributed-programming/LFE/distributed-programming-5.lfe @@ -0,0 +1,13 @@ +> (send "hi there") +connecting to exampleserver@yourhostname +Received "hi there" +ok +(exampleclient@yourhostname)> (send 42) +connecting to exampleserver@yourhostname +Received 42 +ok +(exampleclient@yourhostname)> (send #(key value)) +connecting to exampleserver@yourhostname +Received {key,value} +ok +(exampleclient@yourhostname)> diff --git a/Task/Distributed-programming/LFE/distributed-programming-6.lfe b/Task/Distributed-programming/LFE/distributed-programming-6.lfe new file mode 100644 index 0000000000..fca5cb33d9 --- /dev/null +++ b/Task/Distributed-programming/LFE/distributed-programming-6.lfe @@ -0,0 +1,3 @@ +Got "hi there" from exampleclient@yourhostname +Got 42 from exampleclient@yourhostname +Got {key,value} from exampleclient@yourhostname diff --git a/Task/Distributed-programming/Nim/distributed-programming.nim b/Task/Distributed-programming/Nim/distributed-programming.nim new file mode 100644 index 0000000000..2394867a87 --- /dev/null +++ b/Task/Distributed-programming/Nim/distributed-programming.nim @@ -0,0 +1,42 @@ +import os, nanomsg + +proc sendMsg(s, msg) = + echo "SENDING \"",msg,"\"" + let bytes = s.send(msg.cstring, msg.len + 1, 0) + assert bytes == msg.len + 1 + +proc recvMsg(s) = + var buf: cstring + let bytes = s.recv(addr buf, MSG, 0) + if bytes > 0: + echo "RECEIVED \"",buf,"\"" + discard freemsg buf + +proc sendRecv(s, msg) = + var to: cint = 100 + discard s.setSockOpt(SOL_SOCKET, RCVTIMEO, addr to, sizeof to) + while true: + s.recvMsg + sleep 1000 + s.sendMsg msg + +proc node0(url: string) = + var s = socket(AF_SP, nanomsg.PAIR) + assert s >= 0 + let res = s.bindd url + assert res >= 0 + s.sendRecv "node0" + discard s.shutdown 0 + +proc node1(url: string) = + var s = socket(AF_SP, nanomsg.PAIR) + assert s >= 0 + let res = s.connect url + assert res >= 0 + s.sendRecv "node1" + discard s.shutdown 0 + +if paramStr(1) == "node0": + node0 paramStr(2) +elif paramStr(1) == "node1": + node1 paramStr(2) diff --git a/Task/Documentation/Gri/documentation-1.gri b/Task/Documentation/Gri/documentation-1.gri new file mode 100644 index 0000000000..6299be4b53 --- /dev/null +++ b/Task/Documentation/Gri/documentation-1.gri @@ -0,0 +1,6 @@ +`My Hello Message' +Print a greeting to the user. +This is only a short greeting. +{ + show "hello" +} diff --git a/Task/Documentation/Gri/documentation-2.gri b/Task/Documentation/Gri/documentation-2.gri new file mode 100644 index 0000000000..9e5ecc72ca --- /dev/null +++ b/Task/Documentation/Gri/documentation-2.gri @@ -0,0 +1 @@ +help My Hello Message diff --git a/Task/Documentation/Nim/documentation.nim b/Task/Documentation/Nim/documentation.nim new file mode 100644 index 0000000000..e23c7a591b --- /dev/null +++ b/Task/Documentation/Nim/documentation.nim @@ -0,0 +1,31 @@ +## Nim directly supports documentation using comments that start with two +## hashes (##). To create the documentation run ``nim doc file.nim``. +## ``nim doc2 file.nim`` is the same, but run after semantic checking, which +## allows it to process macros and output more information. +## +## These are the comments for the entire module. We can have long descriptions +## here. Syntax is reStructuredText. Only exported symbols (*) get +## documentation created for them. +## +## Here comes a code block inside our documentation: +## +## .. code-block:: nim +## var inputStrings : seq[string] +## newSeq(inputStrings, 3) +## inputStrings[0] = "The fourth" +## inputStrings[1] = "assignment" +## inputStrings[2] = "would crash" +## #inputStrings[3] = "out of bounds" + +type TPerson* = object + ## This type contains a description of a person + name: string + age: int + +var numValues*: int ## \ + ## `numValues` stores the number of values + +proc helloWorld*(times: int) = + ## A useful procedure + for i in 1..times: + echo "hello world" diff --git a/Task/Documentation/Ring/documentation.ring b/Task/Documentation/Ring/documentation.ring new file mode 100644 index 0000000000..16a9b60de5 --- /dev/null +++ b/Task/Documentation/Ring/documentation.ring @@ -0,0 +1,9 @@ +/* +Multiply two numbers +n1: an integer. +n2: an integer. +returns product of n1 and n2 + */ +see mult(3, 5) + nl +func mult n1, n2 + return n1*n2 diff --git a/Task/Documentation/Swift/documentation.swift b/Task/Documentation/Swift/documentation.swift new file mode 100644 index 0000000000..aeac32594b --- /dev/null +++ b/Task/Documentation/Swift/documentation.swift @@ -0,0 +1,9 @@ +/** + Adds two numbers + :param: a an integer. + :param: b another integer. + :returns: the sum of a and b + */ +func add(a: Int, b: Int) -> Int { + return a + b +} diff --git a/Task/Dot-product/8th/dot-product.8th b/Task/Dot-product/8th/dot-product.8th new file mode 100644 index 0000000000..646950c48c --- /dev/null +++ b/Task/Dot-product/8th/dot-product.8th @@ -0,0 +1 @@ +[1,3,-5] [4,-2,-1] ' n:* ' n:+ a:dot . cr diff --git a/Task/Dot-product/EchoLisp/dot-product.echolisp b/Task/Dot-product/EchoLisp/dot-product.echolisp new file mode 100644 index 0000000000..826862cac1 --- /dev/null +++ b/Task/Dot-product/EchoLisp/dot-product.echolisp @@ -0,0 +1,10 @@ +(define a #(1 3 -5)) +(define b #(4 -2 -1)) + +;; function definition +(define ( ⊗ a b) (for/sum ((x a)(y b)) (* x y))) +(⊗ a b) → 3 + +;; library +(lib 'math) +(dot-product a b) → 3 diff --git a/Task/Dot-product/FunL/dot-product.funl b/Task/Dot-product/FunL/dot-product.funl new file mode 100644 index 0000000000..323decd512 --- /dev/null +++ b/Task/Dot-product/FunL/dot-product.funl @@ -0,0 +1,7 @@ +import lists.zipWith + +def dot( a, b ) + | a.length() == b.length() = sum( zipWith((*), a, b) ) + | otherwise = error( "Vector sizes must match" ) + +println( dot([1, 3, -5], [4, -2, -1]) ) diff --git a/Task/Dot-product/Idris/dot-product.idris b/Task/Dot-product/Idris/dot-product.idris new file mode 100644 index 0000000000..21f20ab07b --- /dev/null +++ b/Task/Dot-product/Idris/dot-product.idris @@ -0,0 +1,9 @@ +module Main + +import Data.Vect + +dotProduct : (Num a) => Vect n a -> Vect n a -> a +dotProduct = (sum .) . zipWith (*) + +main : IO () +main = printLn $ dotProduct [1,2,3] [1,2,3] diff --git a/Task/Dot-product/LFE/dot-product.lfe b/Task/Dot-product/LFE/dot-product.lfe new file mode 100644 index 0000000000..4936a177ac --- /dev/null +++ b/Task/Dot-product/LFE/dot-product.lfe @@ -0,0 +1,3 @@ +(defun dot-product (a b) + (: lists foldl #'+/2 0 + (: lists zipwith #'*/2 a b))) diff --git a/Task/Dot-product/Nim/dot-product.nim b/Task/Dot-product/Nim/dot-product.nim new file mode 100644 index 0000000000..3090e00f11 --- /dev/null +++ b/Task/Dot-product/Nim/dot-product.nim @@ -0,0 +1,9 @@ +# Compile time error when a and b are differently sized arrays +# Runtime error when a and b are differently sized seqs +proc dotp[T](a,b: T): int = + assert a.len == b.len + for i in a.low..a.high: + result += a[i] * b[i] + +echo dotp([1,3,-5], [4,-2,-1]) +echo dotp(@[1,2,3],@[4,5,6]) diff --git a/Task/Dot-product/Oforth/dot-product.oforth b/Task/Dot-product/Oforth/dot-product.oforth new file mode 100644 index 0000000000..f01a758d1c --- /dev/null +++ b/Task/Dot-product/Oforth/dot-product.oforth @@ -0,0 +1 @@ +: dotProduct zipWith(#*) sum ; diff --git a/Task/Dot-product/Phix/dot-product.phix b/Task/Dot-product/Phix/dot-product.phix new file mode 100644 index 0000000000..c059f40be2 --- /dev/null +++ b/Task/Dot-product/Phix/dot-product.phix @@ -0,0 +1 @@ +?sum(sq_mul({1,3,-5},{4,-2,-1})) diff --git a/Task/Dot-product/Ring/dot-product.ring b/Task/Dot-product/Ring/dot-product.ring new file mode 100644 index 0000000000..c9e1c2ad4a --- /dev/null +++ b/Task/Dot-product/Ring/dot-product.ring @@ -0,0 +1,10 @@ +aVector = [2, 3, 5] +bVector = [4, 2, 1] +sum = 0 +see dotProduct(aVector, bVector) + +func dotProduct cVector, dVector + for n = 1 to len(aVector) + sum = sum + cVector[n] * dVector[n] + next + return sum diff --git a/Task/Dot-product/Sidef/dot-product.sidef b/Task/Dot-product/Sidef/dot-product.sidef new file mode 100644 index 0000000000..0cebbf4230 --- /dev/null +++ b/Task/Dot-product/Sidef/dot-product.sidef @@ -0,0 +1,4 @@ +func dot_product(a, b) { + (a »*« b)«+»; +}; +say dot_product([1,3,-5], [4,-2,-1]); # => 3 diff --git a/Task/Dot-product/Swift/dot-product.swift b/Task/Dot-product/Swift/dot-product.swift new file mode 100644 index 0000000000..c9cbed6270 --- /dev/null +++ b/Task/Dot-product/Swift/dot-product.swift @@ -0,0 +1,5 @@ +func dot(v1: [Double], v2: [Double]) -> Double { + return reduce(lazy(zip(v1, v2)).map(*), 0, +) +} + +println(dot([1, 3, -5], [4, -2, -1])) diff --git a/Task/Dot-product/Wart/dot-product.wart b/Task/Dot-product/Wart/dot-product.wart new file mode 100644 index 0000000000..2f869907bc --- /dev/null +++ b/Task/Dot-product/Wart/dot-product.wart @@ -0,0 +1,2 @@ +def (dot_product x y) + (sum+map (*) x y) diff --git a/Task/Dot-product/jq/dot-product-1.jq b/Task/Dot-product/jq/dot-product-1.jq new file mode 100644 index 0000000000..ce2c24ed7f --- /dev/null +++ b/Task/Dot-product/jq/dot-product-1.jq @@ -0,0 +1,2 @@ +def dot(x; y): + reduce range(0;x|length) as $i (0; . + x[$i] * y[$i]); diff --git a/Task/Dot-product/jq/dot-product-2.jq b/Task/Dot-product/jq/dot-product-2.jq new file mode 100644 index 0000000000..55409e796a --- /dev/null +++ b/Task/Dot-product/jq/dot-product-2.jq @@ -0,0 +1 @@ +def SIGMA( f ): reduce .[] as $o (0; . + ($o | f )) ; diff --git a/Task/Dot-product/jq/dot-product-3.jq b/Task/Dot-product/jq/dot-product-3.jq new file mode 100644 index 0000000000..88fed2fd31 --- /dev/null +++ b/Task/Dot-product/jq/dot-product-3.jq @@ -0,0 +1,4 @@ +dot( [1, 3, -5]; [4, -2, -1]) # => 3 + +[ {"x": 1, "y": 4}, {"x": 3, "y": -2}, {"x": -5, "y": -1} ] + | SIGMA( .x * .y ) # => 3 diff --git a/Task/Doubly-linked-list-Definition/Nim/doubly-linked-list-definition.nim b/Task/Doubly-linked-list-Definition/Nim/doubly-linked-list-definition.nim new file mode 100644 index 0000000000..37836ffe69 --- /dev/null +++ b/Task/Doubly-linked-list-Definition/Nim/doubly-linked-list-definition.nim @@ -0,0 +1,68 @@ +type + List[T] = object + head, tail: Node[T] + + Node[T] = ref TNode[T] + + TNode[T] = object + next, prev: Node[T] + data: T + +proc initList[T](): List[T] = discard + +proc newNode[T](data: T): Node[T] = + new(result) + result.data = data + +proc prepend[T](l: var List[T], n: Node[T]) = + n.next = l.head + if l.head != nil: l.head.prev = n + l.head = n + if l.tail == nil: l.tail = n + +proc append[T](l: var List[T], n: Node[T]) = + n.next = nil + n.prev = l.tail + if l.tail != nil: + l.tail.next = n + l.tail = n + if l.head == nil: + l.head = n + +proc insertAfter[T](l: var List[T], r, n: Node[T]) = + n.prev = r + n.next = r.next + n.next.prev = n + r.next = n + if r == l.tail: l.tail = n + +proc remove[T](l: var List[T], n: Node[T]) = + if n == l.tail: l.tail = n.prev + if n == l.head: l.head = n.next + if n.next != nil: n.next.prev = n.prev + if n.prev != nil: n.prev.next = n.next + +proc `$`[T](l: var List[T]): string = + result = "" + var n = l.head + while n != nil: + if result.len > 0: result.add(" -> ") + result.add($n.data) + n = n.next + +var l = initList[int]() +var n = newNode(12) +var m = newNode(13) +var i = newNode(14) +var j = newNode(15) +l.append(n) +l.prepend(m) +l.insertAfter(m, i) +l.prepend(j) +l.remove(m) +echo l + +var l2 = initList[string]() +l2.prepend newNode("hello") +l2.append newNode("world") +echo l2 diff --git a/Task/Doubly-linked-list-Definition/Oforth/doubly-linked-list-definition.oforth b/Task/Doubly-linked-list-Definition/Oforth/doubly-linked-list-definition.oforth new file mode 100644 index 0000000000..d6cdf3bca2 --- /dev/null +++ b/Task/Doubly-linked-list-Definition/Oforth/doubly-linked-list-definition.oforth @@ -0,0 +1,50 @@ +Object Class new: DNode(value, mutable prev, mutable next) + +DNode method: initialize := next := prev := value ; +DNode method: value @value ; +DNode method: prev @prev ; +DNode method: next @next ; +DNode method: setPrev := prev ; +DNode method: setNext := next ; +DNode method: << @value << ; + +DNode method: insertAfter(node) + node setPrev(self) + node setNext(@next) + @next ifNotNull: [ @next setPrev(node) ] + node := next ; + +// Double linked list definition +Collection Class new: DList(mutable head, mutable tail) +DList method: head @head ; +DList method: tail @tail ; + +DList method: insertFront(v) +| p | + @head ->p + DNode new(v, null, p) := head + p ifNotNull: [ p setPrev(@head) ] + @tail ifNull: [ @head := tail ] ; + +DList method: insertBack(v) +| n | + @tail ->n + DNode new(v, n, null) := tail + n ifNotNull: [ n setNext(@tail) ] + @head ifNull: [ @tail := head ] ; + +DList method: forEachNext + dup ifNull: [ drop @head ifNull: [ false ] else: [ @head @head true] return ] + next dup ifNull: [ drop false ] else: [ dup true ] ; + +DList method: forEachPrev + dup ifNull: [ drop @tail ifNull: [ false ] else: [ @tail @tail true] return ] + prev dup ifNull: [ drop false ] else: [ dup true ] ; + +: test // ( -- aDList ) +| dl dn | + DList new ->dl + dl insertFront("A") + dl insertBack("B") + dl head insertAfter(DNode new("C", null , null)) + dl ; diff --git a/Task/Doubly-linked-list-Element-definition/Axe/doubly-linked-list-element-definition.axe b/Task/Doubly-linked-list-Element-definition/Axe/doubly-linked-list-element-definition.axe new file mode 100644 index 0000000000..6e3d2f6f83 --- /dev/null +++ b/Task/Doubly-linked-list-Element-definition/Axe/doubly-linked-list-element-definition.axe @@ -0,0 +1,18 @@ +Lbl LINK +r₂→{r₁}ʳ +0→{r₁+2}ʳ +0→{r₁+4}ʳ +r₁ +Return + +Lbl NEXT +{r₁+2}ʳ +Return + +Lbl PREV +{r₁+4}ʳ +Return + +Lbl VALUE +{r₁}ʳ +Return diff --git a/Task/Doubly-linked-list-Element-definition/Nim/doubly-linked-list-element-definition.nim b/Task/Doubly-linked-list-Element-definition/Nim/doubly-linked-list-element-definition.nim new file mode 100644 index 0000000000..51f66990b6 --- /dev/null +++ b/Task/Doubly-linked-list-Element-definition/Nim/doubly-linked-list-element-definition.nim @@ -0,0 +1,6 @@ +type + Node[T] = ref TNode[T] + + TNode[T] = object + next, prev: Node[T] + data: T diff --git a/Task/Doubly-linked-list-Element-definition/Oforth/doubly-linked-list-element-definition.oforth b/Task/Doubly-linked-list-Element-definition/Oforth/doubly-linked-list-element-definition.oforth new file mode 100644 index 0000000000..b5f4c5d1e3 --- /dev/null +++ b/Task/Doubly-linked-list-Element-definition/Oforth/doubly-linked-list-element-definition.oforth @@ -0,0 +1 @@ +Object Class new: DNode(value, mutable prev, mutable next) diff --git a/Task/Doubly-linked-list-Element-definition/Sidef/doubly-linked-list-element-definition.sidef b/Task/Doubly-linked-list-Element-definition/Sidef/doubly-linked-list-element-definition.sidef new file mode 100644 index 0000000000..06a9478405 --- /dev/null +++ b/Task/Doubly-linked-list-Element-definition/Sidef/doubly-linked-list-element-definition.sidef @@ -0,0 +1,7 @@ +var node = Hash.new( + data => 'say what', + next => foo_node, + prev => bar_node, +); + +node{:next} = quux_node; # mutable diff --git a/Task/Doubly-linked-list-Element-insertion/Axe/doubly-linked-list-element-insertion.axe b/Task/Doubly-linked-list-Element-insertion/Axe/doubly-linked-list-element-insertion.axe new file mode 100644 index 0000000000..368c4de532 --- /dev/null +++ b/Task/Doubly-linked-list-Element-insertion/Axe/doubly-linked-list-element-insertion.axe @@ -0,0 +1,7 @@ +Lbl INSERT +{r₁+2}ʳ→{r₂+2}ʳ +r₁→{r₂+4}ʳ +r₂→{{r₂+2}ʳ+4}ʳ +r₂→{r₁+2}ʳ +r₁ +Return diff --git a/Task/Doubly-linked-list-Element-insertion/Nim/doubly-linked-list-element-insertion.nim b/Task/Doubly-linked-list-Element-insertion/Nim/doubly-linked-list-element-insertion.nim new file mode 100644 index 0000000000..40f2f59667 --- /dev/null +++ b/Task/Doubly-linked-list-Element-insertion/Nim/doubly-linked-list-element-insertion.nim @@ -0,0 +1,6 @@ +proc insertAfter[T](l: var List[T], r, n: Node[T]) = + n.prev = r + n.next = r.next + n.next.prev = n + r.next = n + if r == l.tail: l.tail = n diff --git a/Task/Doubly-linked-list-Element-insertion/Oforth/doubly-linked-list-element-insertion.oforth b/Task/Doubly-linked-list-Element-insertion/Oforth/doubly-linked-list-element-insertion.oforth new file mode 100644 index 0000000000..405b5c3ddf --- /dev/null +++ b/Task/Doubly-linked-list-Element-insertion/Oforth/doubly-linked-list-element-insertion.oforth @@ -0,0 +1,7 @@ +: test // ( -- aDList ) +| dl | + DList new ->dl + dl insertFront("A") + dl insertBack("B") + dl head insertAfter(DNode new("C", null , null)) + dl ; diff --git a/Task/Doubly-linked-list-Traversal/Axe/doubly-linked-list-traversal.axe b/Task/Doubly-linked-list-Traversal/Axe/doubly-linked-list-traversal.axe new file mode 100644 index 0000000000..6d73a0d651 --- /dev/null +++ b/Task/Doubly-linked-list-Traversal/Axe/doubly-linked-list-traversal.axe @@ -0,0 +1,20 @@ +LINK(L₁,1)→A +LINK(L₁+10,2)→B +LINK(L₁+50,3)→C + +INSERT(A,B) +INSERT(A,C) + +A→I +While I≠0 + Disp VALUE(I)▶Dec,i + NEXT(I)→I +End + +Disp "-----",i + +B→I +While I≠0 + Disp VALUE(I)▶Dec,i + PREV(I)→I +End diff --git a/Task/Doubly-linked-list-Traversal/Nim/doubly-linked-list-traversal.nim b/Task/Doubly-linked-list-Traversal/Nim/doubly-linked-list-traversal.nim new file mode 100644 index 0000000000..6f555b1eed --- /dev/null +++ b/Task/Doubly-linked-list-Traversal/Nim/doubly-linked-list-traversal.nim @@ -0,0 +1,80 @@ +type + List[T] = object + head, tail: Node[T] + + Node[T] = ref TNode[T] + + TNode[T] = object + next, prev: Node[T] + data: T + +proc initList[T](): List[T] = discard + +proc newNode[T](data: T): Node[T] = + new(result) + result.data = data + +proc prepend[T](l: var List[T], n: Node[T]) = + n.next = l.head + if l.head != nil: l.head.prev = n + l.head = n + if l.tail == nil: l.tail = n + +proc append[T](l: var List[T], n: Node[T]) = + n.next = nil + n.prev = l.tail + if l.tail != nil: + l.tail.next = n + l.tail = n + if l.head == nil: + l.head = n + +proc insertAfter[T](l: var List[T], r, n: Node[T]) = + n.prev = r + n.next = r.next + n.next.prev = n + r.next = n + if r == l.tail: l.tail = n + +proc remove[T](l: var List[T], n: Node[T]) = + if n == l.tail: l.tail = n.prev + if n == l.head: l.head = n.next + if n.next != nil: n.next.prev = n.prev + if n.prev != nil: n.prev.next = n.next + +proc `$`[T](l: var List[T]): string = + result = "" + var n = l.head + while n != nil: + if result.len > 0: result.add(" -> ") + result.add($n.data) + n = n.next + +iterator traverseForward[T](l: List[T]): T = + var n = l.head + while n != nil: + yield n.data + n = n.next + +iterator traverseBackward[T](l: List[T]): T = + var n = l.tail + while n != nil: + yield n.data + n = n.prev + +var l = initList[int]() +var n = newNode(12) +var m = newNode(13) +var i = newNode(14) +var j = newNode(15) +l.append(n) +l.prepend(m) +l.insertAfter(m, i) +l.prepend(j) +l.remove(m) + +for i in l.traverseForward(): + echo "> ", i + +for i in l.traverseBackward(): + echo "< ", i diff --git a/Task/Doubly-linked-list-Traversal/Oforth/doubly-linked-list-traversal.oforth b/Task/Doubly-linked-list-Traversal/Oforth/doubly-linked-list-traversal.oforth new file mode 100644 index 0000000000..f9d7f697ec --- /dev/null +++ b/Task/Doubly-linked-list-Traversal/Oforth/doubly-linked-list-traversal.oforth @@ -0,0 +1,20 @@ +DList method: forEachNext + dup ifNull: [ drop @head ifNull: [ false ] else: [ @head @head true] return ] + next dup ifNull: [ drop false ] else: [ dup true ] ; + +DList method: forEachPrev + dup ifNull: [ drop @tail ifNull: [ false ] else: [ @tail @tail true] return ] + prev dup ifNull: [ drop false ] else: [ dup true ] ; + +: test +| dl n | + DList new ->dl + dl insertFront("A") + dl insertBack("B") + dl head insertAfter(DNode new("C", null , null)) + + "Traversal (beginning to end) : " println + dl forEach: n [ n . ] + + "\nTraversal (end to beginning) : " println + dl revEach: n [ n . ] ; diff --git a/Task/Dragon-curve/ERRE/dragon-curve.erre b/Task/Dragon-curve/ERRE/dragon-curve.erre new file mode 100644 index 0000000000..88ed403292 --- /dev/null +++ b/Task/Dragon-curve/ERRE/dragon-curve.erre @@ -0,0 +1,47 @@ +PROGRAM DRAGON + +! +! for rosettacode.org +! + +!$DYNAMIC +DIM RQS[0] + +!$INCLUDE="PC.LIB" + +PROCEDURE DRAGON + IF LEVEL<=0 THEN + YN=SIN(ROTATION)*INSIZE+Y + XN=COS(ROTATION)*INSIZE+X + LINE(X,Y,XN,YN,12,FALSE) + ITER=ITER+1 + X=XN Y=YN + EXIT PROCEDURE + END IF + INSIZE=INSIZE/SQ + ROTATION=ROTATION+RQ*QPI + LEVEL=LEVEL-1 + RQS[LEVEL]=RQ + RQ=1 DRAGON + ROTATION=ROTATION-RQS[LEVEL]*QPI*2 + RQ=-1 DRAGON + RQ=RQS[LEVEL] + ROTATION=ROTATION+RQ*QPI + LEVEL=LEVEL+1 + INSIZE=INSIZE*SQ +END PROCEDURE + +BEGIN + SCREEN(9) + + LEVEL=12 INSIZE=287 ! initial values + X=200 Y=120 ! + + SQ=SQR(2) QPI=ATN(1) ! constants + ROTATION=0 ITER=0 RQ=1 ! state variables + !$DIM RQS[LEVEL] + ! stack for RQ (ROTATION coefficient) + LINE(0,0,639,349,14,TRUE) + DRAGON + GET(A$) +END PROGRAM diff --git a/Task/Dragon-curve/Elm/dragon-curve.elm b/Task/Dragon-curve/Elm/dragon-curve.elm new file mode 100644 index 0000000000..344a33ec99 --- /dev/null +++ b/Task/Dragon-curve/Elm/dragon-curve.elm @@ -0,0 +1,94 @@ +import Color exposing (..) +import Collage exposing (..) +import Element exposing (..) +import Time exposing (..) +import Html exposing (..) +import Html.App exposing (program) + + +type alias Point = (Float, Float) + +type alias Model = + { points : List Point + , level : Int + , frame : Int + } + +maxLevel = 12 +frameCount = 100 + +type Msg = Tick Time + +init : (Model,Cmd Msg) +init = ( { points = [(-200.0, -70.0), (200.0, -70.0)] + , level = 0 + , frame = 0 + } + , Cmd.none ) + +-- New point between two existing points. Offset to left or right +newPoint : Point -> Point -> Float -> Point +newPoint (x0,y0) (x1,y1) offset = + let (vx, vy) = ((x1 - x0) / 2.0, (y1 - y0) / 2.0) + (dx, dy) = (-vy * offset , vx * offset ) + in (x0 + vx + dx, y0 + vy + dy) --offset from midpoint + +-- Insert between existing points. Offset to left or right side. +newPoints : Float -> List Point -> List Point +newPoints offset points = + case points of + [] -> [] + [p0] -> [p0] + p0::p1::rest -> p0 :: newPoint p0 p1 offset :: newPoints -offset (p1::rest) + +update : Msg -> Model -> (Model, Cmd Msg) +update _ model = + let mo = if (model.level == maxLevel) + then model + else let nextFrame = model.frame + 1 + in if (nextFrame == frameCount) + then { points = newPoints 1.0 model.points + , level = model.level+1 + , frame = 0 + } + else { model | frame = nextFrame + } + in (mo, Cmd.none) + +-- break a list up into n equal sized lists. +breakupInto : Int -> List a -> List (List a) +breakupInto n ls = + let segmentCount = (List.length ls) - 1 + breakup n ls = case ls of + [] -> [] + _ -> List.take (n+1) ls :: breakup n (List.drop n ls) + in if n > segmentCount + then [ls] + else breakup (segmentCount // n) ls + +view : Model -> Html Msg +view model = + let offset = toFloat (model.frame) / toFloat frameCount + colors = [red, orange, green, blue] + in toHtml + <| layers + [ collage 700 500 + (model.points + |> newPoints offset + |> breakupInto (List.length colors) -- for coloring + |> List.map path + |> List.map2 (\color path -> traced (solid color) path ) colors ) + , show model.level + ] + +subscriptions : Model -> Sub Msg +subscriptions _ = + Time.every (5*millisecond) Tick + +main = + program + { init = init + , view = view + , update = update + , subscriptions = subscriptions + } diff --git a/Task/Dragon-curve/Gri/dragon-curve.gri b/Task/Dragon-curve/Gri/dragon-curve.gri new file mode 100644 index 0000000000..755379fd12 --- /dev/null +++ b/Task/Dragon-curve/Gri/dragon-curve.gri @@ -0,0 +1,63 @@ +`Draw Dragon [ from .x1. .y1. to .x2. .y2. [level .level.] ]' +Draw a dragon curve going from .x1. .y1. to .x2. .y2. with recursion +depth .level. + +The total number of line segments for the recursion is 2^level. +level=0 is a straight line from x1,y1 to x2,y2. + +The default for x1,y1 and x2,y2 is to draw horizontally from 0,0 +to 1,0. +{ + new .x1. .y1. .x2. .y2. .level. + .x1. = \.word3. + .y1. = \.word4. + .x2. = \.word6. + .y2. = \.word7. + .level. = \.word9. + + if {rpn \.words. 5 >=} + .x2. = 1 + .y2. = 0 + end if + if {rpn \.words. 7 >=} + .level. = 6 + end if + + if {rpn 0 .level. <=} + draw line from .x1. .y1. to .x2. .y2. + else + .level. = {rpn .level. 1 -} + + # xmid,ymid is half way between x1,y1 and x2,y2 and up at + # right angles away. + # + # xmid,ymid xmid = (x1+x2 + y2-y1)/2 + # ^ ^ ymid = (x1-x2 + y1+y2)/2 + # / . \ + # / . \ + # x1,y1 ........... x2,y2 + # + new .xmid. .ymid. + .xmid. = {rpn .x1. .x2. + .y2. .y1. - + 2 /} + .ymid. = {rpn .x1. .x2. - .y1. .y2. + + 2 /} + + # The recursion is a level-1 dragon from x1,y1 to the midpoint + # and the same from x2,y2 to the midpoint (the latter + # effectively being a revered dragon.) + # + Draw Dragon from .x1. .y1. to .xmid. .ymid. level .level. + Draw Dragon from .x2. .y2. to .xmid. .ymid. level .level. + + delete .xmid. .ymid. + end if + + delete .x1. .y1. .x2. .y2. .level. +} + +# Dragon curve from 0,0 to 1,0 extends out by 1/3 at the ends, so +# extents -0.5 to +1.5 for a bit of margin. The Y extent is the same +# size 2 to make the graph square. +set x axis -0.5 1.5 .25 +set y axis -1 1 .25 + +Draw Dragon diff --git a/Task/Dragon-curve/SequenceL/dragon-curve-1.sequencel b/Task/Dragon-curve/SequenceL/dragon-curve-1.sequencel new file mode 100644 index 0000000000..fe187b5084 --- /dev/null +++ b/Task/Dragon-curve/SequenceL/dragon-curve-1.sequencel @@ -0,0 +1,38 @@ +import ; +import ; + +initPoints := [[0,0],[1,0]]; + +f1(point(1)) := + let + matrix := [[cos(45 * (pi/180)), -sin(45 * (pi/180))], + [sin(45 * (pi/180)), cos(45 * (pi/180))]]; + in + head(transpose((1/sqrt(2)) * matmul(matrix, transpose([point])))); + +f2(point(1)) := + let + matrix := [[cos(135 * (pi/180)), -sin(135 * (pi/180))], + [sin(135 * (pi/180)), cos(135 * (pi/180))]]; + in + head(transpose((1/sqrt(2)) * matmul(matrix, transpose([point])))) + initPoints[2]; + +matmul(X(2),Y(2))[i,j] := sum(X[i,all]*Y[all,j]); + +entry(steps(0), maxX(0), maxY(0)) := + let + scaleX := maxX / 1.5; + scaleY := maxY; + + shiftX := maxX / 3.0 / 1.5; + shiftY := maxY / 3.0; + in + round(run(steps, initPoints) * [scaleX, scaleY] + [shiftX, shiftY]); + +run(steps(0), result(2)) := + let + next := f1(result) ++ f2(result); + in + result when steps <= 0 + else + run(steps - 1, next); diff --git a/Task/Dragon-curve/SequenceL/dragon-curve-2.sequencel b/Task/Dragon-curve/SequenceL/dragon-curve-2.sequencel new file mode 100644 index 0000000000..f60e233fdc --- /dev/null +++ b/Task/Dragon-curve/SequenceL/dragon-curve-2.sequencel @@ -0,0 +1,74 @@ +#include +#include +#include "SL_Generated.h" + +#include "Cimg.h" + +using namespace cimg_library; +using namespace std; + +int main(int argc, char** argv) +{ + int threads = 0; + if(argc > 1) threads = atoi(argv[1]); + Sequence< Sequence > result; + + sl_init(threads); + + int width = 500; + if(argc > 2) width = atoi(argv[2]); + int height = width; + if(argc > 3) height = atoi(argv[3]); + + CImg visu(width, height, 1, 3, 0); + CImgDisplay draw_disp(visu); + + SLTimer compTimer; + SLTimer drawTimer; + + int steps = 0; + int maxSteps = 18; + if(argc > 4) maxSteps = atoi(argv[4]); + int waitTime = 200; + if(argc > 5) waitTime = atoi(argv[5]); + bool adding = true; + while(!draw_disp.is_closed()) + { + compTimer.start(); + sl_entry(steps, width, height, threads, result); + compTimer.stop(); + + drawTimer.start(); + visu.fill(0); + + double thirdSize = ((result.size() / 2.0) / 3.0); + thirdSize = (int)thirdSize == 0 ? 1 : thirdSize; + + for(int i = 1; i <= result.size(); i+=2) + { + unsigned char shade = (unsigned char)(255 * ((((i / 2) % (int)thirdSize) / thirdSize)) + 0.5); + + unsigned char r = i / 2 <= thirdSize ? shade : 255/2; + unsigned char g = thirdSize < i / 2 && i / 2 <= thirdSize * 2 ? shade : 255/2; + unsigned char b = thirdSize * 2 < i / 2 && i / 2 <= thirdSize * 3 ? shade : 255/2; + const unsigned char color[] = {r,g,b}; + + visu.draw_line(result[i][1], result[i][2], 0, result[i + 1][1], result[i + 1][2], 0, color); + } + visu.display(draw_disp); + drawTimer.stop(); + + draw_disp.set_title("Dragon Curve in SequenceL: %d Threads | Steps: %d | CompTime: %f Seconds | Draw Time: %f Seconds", threads, steps, drawTimer.getTime(), compTimer.getTime()); + + if(adding) steps++; + else steps--; + + if(steps <= 0) adding = true; + else if(steps >= maxSteps) adding = false; + + draw_disp.wait(waitTime); + } + + sl_done(); + return 0; +} diff --git a/Task/Dragon-curve/Sidef/dragon-curve.sidef b/Task/Dragon-curve/Sidef/dragon-curve.sidef new file mode 100644 index 0000000000..69c2e4e24c --- /dev/null +++ b/Task/Dragon-curve/Sidef/dragon-curve.sidef @@ -0,0 +1,37 @@ +define halfpi = Math.pi/2; + +# Computing the dragon with a L-System +var dragon = 'FX'; +{ + dragon.gsub!('X', 'x+yF+'); + dragon.gsub!('Y', '-Fx-y'); + dragon.tr!('xy', 'XY'); +} * 10; + +# Drawing the dragon in SVG +var (x, y) = (100, 100); +var theta = 0; +var r = 2; + +print <<'EOT'; + + + +EOT + +dragon.each { |c| + given(c) { + when ('F') { + printf("\n"); + } + when ('+') { theta += halfpi } + when ('-') { theta -= halfpi } + } +} + +print ''; diff --git a/Task/Dragon-curve/jq/dragon-curve-1.jq b/Task/Dragon-curve/jq/dragon-curve-1.jq new file mode 100644 index 0000000000..bb95fa6eb6 --- /dev/null +++ b/Task/Dragon-curve/jq/dragon-curve-1.jq @@ -0,0 +1,56 @@ +# MATRIX MATH + def mult(m; v): + [ m[0][0] * v[0] + m[0][1] * v[1], + m[1][0] * v[0] + m[1][1] * v[1] ]; + + def minus(a; b): [ a[0]-b[0], a[1]-b[1] ]; + + def plus(a; b): [ a[0]+b[0], a[1]+b[1] ]; + +# SVG STUFF + # default values of stroke and stroke-width are provided + def style(obj): + { "stroke": "rgb(255, 15, 131)", "stroke-width": "2px" } as $default + | ($default + obj) as $s + | ""; + + def svg(id; width; height): + ""; + + # Turn a pair of points into an SVG path like "M1 1L2 2" (M=move to; L=line to). + def toSVGpath(a; b): + "M\(a[0]) \(a[1])L\(b[0]) \(b[1])"; + +# DRAGON MAKING + + def fractalMakeDragon(svgid; ptA; ptC; steps; left; css): + + # Make a new point, either to the left or right + def growNewPoint(ptA; ptC; left): + [[ 1/2,-1/2 ], [ 1/2, 1/2 ]] as $left + | [[ 1/2, 1/2 ], [-1/2, 1/2 ]] as $right + | plus(ptA; + mult(if left then $left else $right end; + minus(ptC; ptA))); + + def grow(ptA; ptC; steps; left): + # if we have more iterations to go... + if steps > 1 then + growNewPoint(ptA; ptC; left) as $ptB + # ... then recurse using each new line, one left, one right + | grow($ptB; ptA; steps-1; left), + grow($ptB; ptC; steps-1; left) + else + toSVGpath(ptA; ptC) + end; + + svg(svgid; "100%"; "100%"), + style(css), + "", + ""; diff --git a/Task/Dragon-curve/jq/dragon-curve-2.jq b/Task/Dragon-curve/jq/dragon-curve-2.jq new file mode 100644 index 0000000000..008e6c25d8 --- /dev/null +++ b/Task/Dragon-curve/jq/dragon-curve-2.jq @@ -0,0 +1,2 @@ +# Default values are provided for the last argument +fractalMakeDragon("roar"; [100,300]; [500,300]; 15; false; {}) diff --git a/Task/Dragon-curve/jq/dragon-curve-3.jq b/Task/Dragon-curve/jq/dragon-curve-3.jq new file mode 100644 index 0000000000..e8a16b35c1 --- /dev/null +++ b/Task/Dragon-curve/jq/dragon-curve-3.jq @@ -0,0 +1,11 @@ +$ jq -n -r -f dragon.jq + + + int) +var y = (cols/2 - 16 -> int) + +var chars = [ + "┌─┐ ╷╶─┐╶─┐╷ ╷┌─╴┌─╴╶─┐┌─┐┌─┐ ", + "│ │ │┌─┘╶─┤└─┤└─┐├─┐ │├─┤└─┤ : ", + "└─┘ ╵└─╴╶─┘ ╵╶─┘└─┘ ╵└─┘╶─┘ " + ].map {|s| s.split(3) } + +func position(i,j) { + "\e[%d;%dH"%(i, j) +} + +func indices { + var t = Time.local; + "%02d:%02d:%02d"%(t.hour, t.min, t.sec).split(1).map{|c| c.ord - '0'.ord}... +} + +loop { + print "\e[H\e[J"; + chars.range.each { |i| + print position(x + i, y); + print [chars[i][indices()]].join(' '); + } + print position(1, 1); + Sys.sleep(1); +} diff --git a/Task/Draw-a-cuboid/Nim/draw-a-cuboid.nim b/Task/Draw-a-cuboid/Nim/draw-a-cuboid.nim new file mode 100644 index 0000000000..b4835b8ccf --- /dev/null +++ b/Task/Draw-a-cuboid/Nim/draw-a-cuboid.nim @@ -0,0 +1,19 @@ +import strutils + +proc cline(n, x, y: int, cde: string) = + echo cde[0..0].align n+1, + repeatChar(9*x-1, cde[1]), + cde[0], cde[2..2].align y+1 + +proc cuboid(x, y, z: int) = + cline y+1, x, 0, "+-" + for i in 1..y: cline y-i+1, x, i-1, "/ |" + cline 0, x, y, "+-|" + for i in 0..4*z-y-3: cline 0, x, y, "| |" + cline 0, x, y, "| +" + for i in countdown(y-1, 0): cline 0, x, i, "| /" + cline 0, x, 0, "+-\n" + +cuboid 2, 3, 4 +cuboid 1, 1, 1 +cuboid 6, 2, 1 diff --git a/Task/Draw-a-cuboid/Phix/draw-a-cuboid.phix b/Task/Draw-a-cuboid/Phix/draw-a-cuboid.phix new file mode 100644 index 0000000000..0118f8f134 --- /dev/null +++ b/Task/Draw-a-cuboid/Phix/draw-a-cuboid.phix @@ -0,0 +1,76 @@ +include ..\arwen\arwen.ew +include ..\arwen\axtra.ew + +constant main = create(Window, "Draw Cuboid", 0, 0, 20, 20, 625, 690, 0), + mainDC = getPrivateDC(main), + backDC = c_func(xCreateCompatibleDC, {NULL}), -- the background + viewDC = c_func(xCreateCompatibleDC, {NULL}), -- with animation + grey = #909090 + +constant MainTimer = createTimer() + +integer dw = 0, dh = 0 -- client area width and height +atom bmBack, bmView +integer bmX = 0, bmY = 0 -- actual size of the bitmaps + +-- arrays: 3D coordinates of vertices +sequence x = {-2.0, +2.0, +2.0, -2.0, -2.0, +2.0, +2.0, -2.0}, + y = {-1.5, -1.5, +1.5, +1.5, -1.5, -1.5, +1.5, +1.5}, + z = {-1.0, -1.0, -1.0, -1.0, +1.0, +1.0, +1.0, +1.0}, + Segment = {1,2, 2,3, 3,4, 4,1, 5,6, 6,7, 7,8, 8,5, 1,5, 2,6, 3,7, 4,8} + +constant Size=50.0, Sz=0.008, Sx=-0.013 -- drawing size and tumbling speeds + +function mainHandler(integer id, integer msg, atom wParam, object lParam) +atom farthest +integer v1, v2, farv, c + if msg=WM_SIZE then + {{},{},dw,dh} = getClientRect(main) + if dw>bmX or dh>bmY then + -- we need bigger bitmaps + bmBack = c_func(xCreateCompatibleBitmap, {mainDC, dw, dh}) + {} = deleteObject(selectObject(backDC,bmBack)) + -- clear the background + setPenColor(grey) + setPenBkColor(grey) + drawRectangleh(backDC, True, 0, 0, dw, dh) + bmView = c_func(xCreateCompatibleBitmap, {mainDC, dw, dh}) + {} = deleteObject(selectObject(viewDC,bmView)) + {bmX,bmY} = {dw,dh} + end if + elsif msg=WM_PAINT then + -- start with a fresh copy of the background + void = c_func(xBitBlt,{viewDC,0,0,dw,dh,backDC,0,0,SRCCOPY}) + farthest = 0.0 -- find the farthest vertex + for i=1 to 8 do + if z[i]>farthest then farthest = z[i] farv = i end if + end for + for v=1 to 2*12 by 2 do -- for all the vertices... + v1 = Segment[v] -- get vertex number + v2 = Segment[v+1] + c = Red; setPenStyle(Solid) + if v1=farv or v2=farv then c=Blue; setPenStyle(Dash) end if + drawLinesh(viewDC,{c,{x[v1]*Size+dw/2, y[v1]*Size+dh/2, + x[v2]*Size+dw/2, y[v2]*Size+dh/2}}) + end for + void = c_func(xBitBlt,{mainDC,0,0,dw,dh,viewDC,0,0,SRCCOPY}) + elsif msg=WM_TIMER then + for i=1 to 8 do + x[i] = x[i]+y[i]*Sz -- rotate vertices in X-Y plane + y[i] = y[i]-x[i]*Sz + y[i] = y[i]+z[i]*Sx -- rotate vertices in Y-Z plane + z[i] = z[i]-y[i]*Sx + end for + repaintWindow(main) + elsif msg=WM_SHOWWINDOW then + startTimer(MainTimer,main,33) + elsif msg=WM_CHAR + and wParam=VK_ESCAPE then + closeWindow(main) + if id or object(lParam) then end if -- suppress warnings + end if + return 0 +end function +setHandler({main},routine_id("mainHandler")) + +WinMain(main, SW_NORMAL) diff --git a/Task/Draw-a-cuboid/Sidef/draw-a-cuboid-1.sidef b/Task/Draw-a-cuboid/Sidef/draw-a-cuboid-1.sidef new file mode 100644 index 0000000000..165476a320 --- /dev/null +++ b/Task/Draw-a-cuboid/Sidef/draw-a-cuboid-1.sidef @@ -0,0 +1,31 @@ +var DIR = Hash.new("-" => [1,0], "|" => [0,1], "/" => [1,1]); + +func cuboid(nx, ny, nz) { + say("cuboid %d %d %d:" % [nx, ny, nz]); + var(x, y, z) = (8*nx, 2*ny, 4*nz); + var area = []; + var line = func(n, sx, sy, c) { + var(dx, dy) = DIR{c}...; + 0..n -> each {|i| + var (xi, yi) = (sx + i*dx, sy + i*dy); + area[yi] \\= [" "]*(x+y+1); + area[yi][xi] = (area[yi][xi] == " " ? c : '+'); + }; + }; + + 0 .. nz-1 -> each {|i| line.call(x, 0, 4*i, "-")}; + 0 .. ny -> each {|i| line.call(x, 2*i, z + 2*i, "-")}; + 0 .. nx-1 -> each {|i| line.call(z, 8*i, 0, "|")}; + 0 .. ny -> each {|i| line.call(z, x + 2*i, 2*i, "|")}; + 0 .. nz-1 -> each {|i| line.call(y, x, 4*i, "/")}; + 0 .. nx -> each {|i| line.call(y, 8*i, z, "/")}; + + area.reverse.each { |line| + say line.join(''); + }; +} + +cuboid(2, 3, 4); +cuboid(1, 1, 1); +cuboid(6, 2, 1); +cuboid(2, 4, 1); diff --git a/Task/Draw-a-cuboid/Sidef/draw-a-cuboid-2.sidef b/Task/Draw-a-cuboid/Sidef/draw-a-cuboid-2.sidef new file mode 100644 index 0000000000..603418cd43 --- /dev/null +++ b/Task/Draw-a-cuboid/Sidef/draw-a-cuboid-2.sidef @@ -0,0 +1,30 @@ +func cuboid (x=1,y=1,z=1,s=' ',c='+',h='-',v='|',d='/') { + say("cuboid %d %d %d:" % (x, y, z)); + ' ' * z+1 + c + h*x + c -> say; + + { |i| + ' ' * (z - i + 1) + d + s*x + d + + (s * (i - (i > y ? i-y : 1))) + + (i - 1 == y ? c : (i > y ? d : v)) -> say + } * z; + + c + h*x + c + (s * (z < y ? z : y) + + (z < y ? v : (z == y ? c : d))) -> say; + + { |i| + v + s*x + v + (z > y + ? (i >= z ? (s*x + c) : (s * y-i + d)) + : (y - i > z + ? (s * z + v) + : (s * y-i + (y-i == z ? c : d)) + ) + ) -> say; + } * y; + + c + h*x + c -> say; +}; + +cuboid(2, 3, 4); +cuboid(1, 1, 1); +cuboid(6, 2, 1); +cuboid(2, 4, 1); diff --git a/Task/Draw-a-sphere/ERRE/draw-a-sphere.erre b/Task/Draw-a-sphere/ERRE/draw-a-sphere.erre new file mode 100644 index 0000000000..91d1eb72fe --- /dev/null +++ b/Task/Draw-a-sphere/ERRE/draw-a-sphere.erre @@ -0,0 +1,54 @@ +PROGRAM SPHERE + +CONST SHADES$=".:!*oe&#%@" + +DIM LIGHT[2],X[2],Y[2],V[2],VEC[2] + +PROCEDURE DOT(X[],Y[]->D) + D=X[0]*Y[0]+X[1]*Y[1]+X[2]*Y[2] + IF D<0 THEN D=-D ELSE D=0 END IF +END PROCEDURE + +PROCEDURE NORMALIZE(V[]->V[]) + LUNG=SQR(V[0]*V[0]+V[1]*V[1]+V[2]*V[2]) + V[0]=V[0]/LUNG + V[1]=V[1]/LUNG + V[2]=V[2]/LUNG +END PROCEDURE + +PROCEDURE PDRAW(R,K,AMBIENT) + FOR I=INT(-R) TO INT(R) DO + X=I+0.5 + FOR J=INT(-2*R) TO INT(2*R) DO + Y=J/2+0.5 + IF (X*X+Y*Y<=R*R) THEN + VEC[0]=X + VEC[1]=Y + VEC[2]=SQR(R*R-X*X-Y*Y) + NORMALIZE(VEC[]->VEC[]) + DOT(LIGHT[],VEC[]->D) + B=D^K+AMBIENT + INTENSITY%=(1-B)*(LEN(SHADES$)-1) + IF (INTENSITY%<0) THEN INTENSITY%=0 END IF + IF (INTENSITY%>=LEN(SHADES$)-1) THEN + INTENSITY%=LEN(SHADES$)-2 + END IF + PRINT(#1,MID$(SHADES$,INTENSITY%+1,1);) + ELSE + PRINT(#1,(" ");) + END IF + END FOR + PRINT(#1,) + END FOR +END PROCEDURE + +BEGIN + LIGHT[]=(30,30,-50) + OPEN("O",1,"SPHERE.PRN") + NORMALIZE(LIGHT[]->LIGHT[]) + PDRAW(10,2,0.4) + + PRINT(#1,STRING$(79,"=")) + PDRAW(20,4,0.1) + CLOSE(1) +END PROGRAM diff --git a/Task/Draw-a-sphere/FutureBasic/draw-a-sphere.futurebasic b/Task/Draw-a-sphere/FutureBasic/draw-a-sphere.futurebasic new file mode 100644 index 0000000000..35d2027912 --- /dev/null +++ b/Task/Draw-a-sphere/FutureBasic/draw-a-sphere.futurebasic @@ -0,0 +1,74 @@ +include "Tlbx agl.incl" +include "Tlbx glut.incl" + +output file "Rotating Sphere" + +local fn SphereDraw +'~'1 +begin globals +dim as double  sRotation // 'static' var +end globals + +// Speed of rotation +sRotation += 2.9 +glMatrixMode( _GLMODELVIEW ) + +glLoadIdentity() + +// Position parameters: x axis, y axis, z axis +// Set to center of screen: +glTranslated( 0.0, 0.0, 0.0 ) + +// Rotation (wobble) parameters: angle, x, y +glRotated( sRotation, -0.45, -0.8, -0.6 ) + +// Set color of sphere's wireframe +glColor3d( 1.0, 0.0, 0.3 ) + +// Set width of sphere's wireframe lines +glLineWidth( 1.5 ) + +// Apply above to GLUT's built-in sphere wireframe +// Size & frame parameters: radius, slices, stack +fn glutWireSphere( 0.8, 25, 25 ) + +end fn + +// main program +dim as GLint           attrib(2) +dim as CGrafPtr        port +dim as AGLPixelFormat  fmt +dim as AGLContext      glContext +dim as EventRecord     ev +dim as GLboolean       yesOK + +// Make a window +window 1, @"Rotating Sphere", (0,0) - (500,500) + +// Minimal setup of OpenGL +attrib(0) = _AGLRGBA +attrib(1) = _AGLDOUBLEBUFFER +attrib(2) = _AGLNONE + +fmt = fn aglChoosePixelFormat( 0, 0, attrib(0) ) +glContext = fn aglCreateContext( fmt, 0 ) +aglDestroyPixelFormat( fmt ) + +// Set the FB window as port for drawing +port = window( _wndPort ) +yesOK = fn aglSetDrawable( glContext, port ) +yesOK = fn aglSetCurrentContext( glContext ) + +// Background color: red, green, blue, alpha +glClearColor( 0.0, 0.0, 0.0, 0.0 ) + +// 60/s HandleEvents Trigger +poke long event - 8, 1 +do +// Clear window +glClear( _GLCOLORBUFFERBIT ) +// Run animation +fn SphereDraw +aglSwapBuffers( glContext ) +HandleEvents +until gFBquit diff --git a/Task/Draw-a-sphere/Lingo/draw-a-sphere.lingo b/Task/Draw-a-sphere/Lingo/draw-a-sphere.lingo new file mode 100644 index 0000000000..524e9ab7dd --- /dev/null +++ b/Task/Draw-a-sphere/Lingo/draw-a-sphere.lingo @@ -0,0 +1,16 @@ +---------------------------------------- +-- Draw a circle +-- @param {image} img +-- @param {integer} x +-- @param {integer} y +-- @param {integer} r +-- @param {integer} lineSize +-- @param {color} drawColor +---------------------------------------- +on circle (img, x, y, r, lineSize, drawColor) + props = [:] + props[#shapeType] = #oval + props[#lineSize] = lineSize + props[#color] = drawColor + img.draw(x-r, y-r, x+r, y+r, props) +end diff --git a/Task/Draw-a-sphere/Nim/draw-a-sphere.nim b/Task/Draw-a-sphere/Nim/draw-a-sphere.nim new file mode 100644 index 0000000000..6d0a5a3685 --- /dev/null +++ b/Task/Draw-a-sphere/Nim/draw-a-sphere.nim @@ -0,0 +1,31 @@ +import math + +type Point = tuple[x,y,z: float] + +const shades = ".:!*oe&#%@" + +proc normalize(x, y, z: float): Point = + let len = sqrt(x*x + y*y + z*z) + (x / len, y / len, z / len) + +proc dot(a, b: Point): float = + result = max(0, - a.x*b.x - a.y*b.y - a.z*b.z) + +let light = normalize(30.0, 30.0, -50.0) + +proc drawSphere(r, k, ambient) = + for i in -r .. r: + let x = i.float + 0.5 + for j in -2*r .. 2*r: + let y = j.float / 2.0 + 0.5 + if x*x + y*y <= float r*r: + let + v = normalize(x, y, sqrt(float(r*r) - x*x - y*y)) + b = pow(dot(light, v), k) + ambient + i = clamp(int((1.0 - b) * shades.high.float), 0, shades.high) + stdout.write shades[i] + else: stdout.write ' ' + stdout.write "\n" + +drawSphere 20, 4.0, 0.1 +drawSphere 10, 2.0, 0.4 diff --git a/Task/Draw-a-sphere/Sidef/draw-a-sphere.sidef b/Task/Draw-a-sphere/Sidef/draw-a-sphere.sidef new file mode 100644 index 0000000000..6b454adec2 --- /dev/null +++ b/Task/Draw-a-sphere/Sidef/draw-a-sphere.sidef @@ -0,0 +1,33 @@ +func normalize (vec) { vec »/» (vec »*« vec -> sum.sqrt) } +func dot (x, y) { -(x »*« y -> sum) ^max^ 0 } +  +var x = var y = 255 +x += 1 if x.is_even # must be odd +  +var light = normalize([ 3, 2, -5 ]) +var depth = 255 +  +func draw_sphere(rad, k, ambient) { + var pixels = [] + var r2 = (rad * rad) + var range = (-rad .. rad) + for x,y in (range ~X range) { + if ((var x2 = x*x) + (var y2 = y*y) < r2) { + var vector = normalize([x, y, (r2 - x2 - y2).sqrt]) + var intensity = (dot(light, vector)**k + ambient) + var pixel = (0 ^max^ (intensity*depth -> int) ^min^ depth) + pixels << pixel + } + else { + pixels << 0 + } + } + return pixels +} +  +var outfile = %f'sphere-sidef.pgm' +var out = outfile.open('>:raw') +  +out.say("P5\n#{x} #{y}\n#{depth}") # .pgm header +out.write(draw_sphere((x-1)/2, .9, .2).map{.chr}.join) +out.close diff --git a/Task/Draw-a-sphere/Swift/draw-a-sphere.swift b/Task/Draw-a-sphere/Swift/draw-a-sphere.swift new file mode 100644 index 0000000000..87369f98d9 --- /dev/null +++ b/Task/Draw-a-sphere/Swift/draw-a-sphere.swift @@ -0,0 +1,31 @@ +class Sphere: UIView{ + + override func drawRect(rect: CGRect) + { + let context = UIGraphicsGetCurrentContext() + let locations: [CGFloat] = [0.0, 1.0] + + let colors = [UIColor.whiteColor().CGColor, + UIColor.blueColor().CGColor] + + let colorspace = CGColorSpaceCreateDeviceRGB() + + let gradient = CGGradientCreateWithColors(colorspace, + colors, locations) + + var startPoint = CGPoint() + var endPoint = CGPoint() + startPoint.x = self.center.x - (self.frame.width * 0.1) + startPoint.y = self.center.y - (self.frame.width * 0.15) + endPoint.x = self.center.x + endPoint.y = self.center.y + let startRadius: CGFloat = 0 + let endRadius: CGFloat = self.frame.width * 0.38 + + CGContextDrawRadialGradient (context, gradient, startPoint, + startRadius, endPoint, endRadius, + 0) + } +} + +var s = Sphere(frame: CGRectMake(0, 0, 200, 200)) diff --git a/Task/Draw-a-sphere/jq/draw-a-sphere-1.jq b/Task/Draw-a-sphere/jq/draw-a-sphere-1.jq new file mode 100644 index 0000000000..7e6a60672c --- /dev/null +++ b/Task/Draw-a-sphere/jq/draw-a-sphere-1.jq @@ -0,0 +1,19 @@ +def svg: + "" ; + +# A radial gradient to make a circle look like a sphere. +# "colors" should be [startColor, intermediateColor, endColor] +# or null for ["white", "teal", "black"] +def sphericalGradient(id; colors): + " + + + + + + " ; + +def sphere(cx; cy; r; gradientId): + "" ; diff --git a/Task/Draw-a-sphere/jq/draw-a-sphere-2.jq b/Task/Draw-a-sphere/jq/draw-a-sphere-2.jq new file mode 100644 index 0000000000..3daa86df12 --- /dev/null +++ b/Task/Draw-a-sphere/jq/draw-a-sphere-2.jq @@ -0,0 +1,9 @@ +def draw_sphere: + svg, + "Teal sphere", + sphericalGradient("tealGradient"; null), # define the gradient to use + sphere(100;100;100; "tealGradient"), # draw a sphere using the gradient + sphere(100;300;100; "tealGradient"), # draw another sphere using the same gradient + "" ; + +draw_sphere diff --git a/Task/Draw-a-sphere/jq/draw-a-sphere-3.jq b/Task/Draw-a-sphere/jq/draw-a-sphere-3.jq new file mode 100644 index 0000000000..cb26e116fd --- /dev/null +++ b/Task/Draw-a-sphere/jq/draw-a-sphere-3.jq @@ -0,0 +1 @@ +$ jq -r -n -f spheres.jq > spheres.svg diff --git a/Task/Dutch-national-flag-problem/Lasso/dutch-national-flag-problem.lasso b/Task/Dutch-national-flag-problem/Lasso/dutch-national-flag-problem.lasso new file mode 100644 index 0000000000..89d1ad1c88 --- /dev/null +++ b/Task/Dutch-national-flag-problem/Lasso/dutch-national-flag-problem.lasso @@ -0,0 +1,16 @@ +define orderdutchflag(a) => { + local(r = array, w = array, b = array) + with i in #a do => { + match(#i) => { + case('Red') + #r->insert(#i) + case('White') + #w->insert(#i) + case('Blue') + #b->insert(#i) + } + } + return #r + #w + #b +} + +orderdutchflag(array('Red', 'Red', 'Blue', 'Blue', 'Blue', 'Red', 'Red', 'Red', 'White', 'Blue')) diff --git a/Task/Dutch-national-flag-problem/Visual-FoxPro/dutch-national-flag-problem-1.visual b/Task/Dutch-national-flag-problem/Visual-FoxPro/dutch-national-flag-problem-1.visual new file mode 100644 index 0000000000..f960586182 --- /dev/null +++ b/Task/Dutch-national-flag-problem/Visual-FoxPro/dutch-national-flag-problem-1.visual @@ -0,0 +1,34 @@ +CLOSE DATABASES ALL +LOCAL lcCollate As String, i As Integer, n As Integer +lcCollate = SET("Collate") +SET COLLATE TO "Machine" +*!* Colours table +CREATE CURSOR colours (id I UNIQUE, colour V(5)) +INSERT INTO colours VALUES (1, "Red") +INSERT INTO colours VALUES (2, "White") +INSERT INTO colours VALUES (3, "Blue") +*!* Balls table +CREATE CURSOR balls (colour I, rowid I AUTOINC) +INDEX ON colour TAG colour +SET ORDER TO 0 +*!* Make sure there is at least 1 of each colour +INSERT INTO balls (colour) VALUES(3) +INSERT INTO balls (colour) VALUES(1) +INSERT INTO balls (colour) VALUES(2) +RAND(-1) && Initialise random number generator +n = 24 +FOR i = 4 TO n + INSERT INTO balls (colour) VALUES (RanInt()) +ENDFOR +*!* Show unsorted +SELECT bb.rowid, cc.colour FROM colours cc JOIN balls bb ON cc.id = bb.colour +*!* Select by correct order +SELECT bb.rowid, cc.colour FROM colours cc JOIN balls bb ON cc.id = bb.colour ; +ORDER BY cc.id INTO CURSOR dutchflag +*!* Show sorted records +BROWSE NOMODIFY IN SCREEN +SET COLLATE TO lcCollate + +FUNCTION RanInt() As Integer +RETURN INT(3*RAND()) + 1 +ENDFUNC diff --git a/Task/Dutch-national-flag-problem/Visual-FoxPro/dutch-national-flag-problem-2.visual b/Task/Dutch-national-flag-problem/Visual-FoxPro/dutch-national-flag-problem-2.visual new file mode 100644 index 0000000000..d81cd834d3 --- /dev/null +++ b/Task/Dutch-national-flag-problem/Visual-FoxPro/dutch-national-flag-problem-2.visual @@ -0,0 +1,35 @@ +LOCAL i As Integer, n As Integer, colours As String, k As Integer +colours = "Red,White,Blue" +n = 15 +LOCAL ARRAY balls[n,2] +*!* Make sure there is at least 1 of each colour +balls[1,1] = "Blue" +balls[1,2] = 3 +balls[2,1] = "Red" +balls[2,2] = 1 +balls[3,1] = "White" +balls[3,2] = 2 +RAND(-1) && Initialise random number generator +FOR i = 4 TO n + k = RanInt() + balls[i,1] = GETWORDNUM(colours, k, ",") + balls[i,2] = k +ENDFOR +*!* Show the unsorted array +CLEAR +? "Unsorted..." +FOR i = 1 TO n + ? balls[i,1], balls[i,2] +ENDFOR +*!* Sort the array on column 2 +ASORT(balls, 2) +*!* And show it... +? +? "Sorted..." +FOR i = 1 TO n + ? balls[i,1], balls[i,2] +ENDFOR + +FUNCTION RanInt() As Integer +RETURN INT(3*RAND()) + 1 +ENDFUNC diff --git a/Task/Dynamic-variable-names/FreeBASIC/dynamic-variable-names.freebasic b/Task/Dynamic-variable-names/FreeBASIC/dynamic-variable-names.freebasic new file mode 100644 index 0000000000..6cc3d75632 --- /dev/null +++ b/Task/Dynamic-variable-names/FreeBASIC/dynamic-variable-names.freebasic @@ -0,0 +1,58 @@ +' FB 1.05.0 Win64 + +Type DynamicVariable + As String name + As String value +End Type + +Function FindVariableIndex(a() as DynamicVariable, v as String, nElements As Integer) As Integer + v = LCase(Trim(v)) + For i As Integer = 1 To nElements + If a(i).name = v Then Return i + Next + Return 0 +End Function + +Dim As Integer n, index +Dim As String v +Cls + +Do + Input "How many variables do you want to create (max 5) "; n +Loop Until n > 0 AndAlso n < 6 + +Dim a(1 To n) As DynamicVariable +Print +Print "OK, enter the variable names and their values, below" + +For i As Integer = 1 to n + Print + Print " Variable"; i + Input " Name : ", a(i).name + a(i).name = LCase(Trim(a(i).name)) ' variable names are not case sensitive in FB + If i > 0 Then + index = FindVariableIndex(a(), a(i).name, i - 1) + If index > 0 Then + Print " Sorry, you've already created a variable of that name, try again" + i -= 1 + Continue For + End If + End If + Input " Value : ", a(i).value + a(i).value = LCase(Trim(a(i).value)) +Next + +Print +Print "Press q to quit" +Do + Print + Input "Which variable do you want to inspect "; v + If v = "q" OrElse v = "Q" Then Exit Do + index = FindVariableIndex(a(), v, n) + If index = 0 Then + Print "Sorry there's no variable of that name, try again" + Else + Print "It's value is "; a(index).value + End If +Loop +End diff --git a/Task/Dynamic-variable-names/Lasso/dynamic-variable-names.lasso b/Task/Dynamic-variable-names/Lasso/dynamic-variable-names.lasso new file mode 100644 index 0000000000..b6ed6efd23 --- /dev/null +++ b/Task/Dynamic-variable-names/Lasso/dynamic-variable-names.lasso @@ -0,0 +1,7 @@ +local(thename = web_request->param('thename')->asString) +if(#thename->size) => {^ + var(#thename = math_random) + var(#thename) +else + 'Please give the variable a name!' +^} diff --git a/Task/Dynamic-variable-names/Lingo/dynamic-variable-names.lingo b/Task/Dynamic-variable-names/Lingo/dynamic-variable-names.lingo new file mode 100644 index 0000000000..3017b05955 --- /dev/null +++ b/Task/Dynamic-variable-names/Lingo/dynamic-variable-names.lingo @@ -0,0 +1,7 @@ +-- varName might contain a string that was entered by a user at runtime + +-- A new global variable with a user-defined name can be created at runtime like this: +(the globals)[varName] = 23 -- or (the globals).setProp(varName, 23) + +-- An new instance variable (object property) with a user-defined name can be created at runtime like this: +obj[varName] = 23 -- or obj.setProp(varName, 23) diff --git a/Task/Dynamic-variable-names/Oforth/dynamic-variable-names.oforth b/Task/Dynamic-variable-names/Oforth/dynamic-variable-names.oforth new file mode 100644 index 0000000000..ab6dd968f1 --- /dev/null +++ b/Task/Dynamic-variable-names/Oforth/dynamic-variable-names.oforth @@ -0,0 +1,7 @@ +: createVar(varname) + "tvar: " varname + eval ; + +"myvar" createVar + +12 myvar put +myvar at . diff --git a/Task/Dynamic-variable-names/Ring/dynamic-variable-names-1.ring b/Task/Dynamic-variable-names/Ring/dynamic-variable-names-1.ring new file mode 100644 index 0000000000..d7fbf2579b --- /dev/null +++ b/Task/Dynamic-variable-names/Ring/dynamic-variable-names-1.ring @@ -0,0 +1,2 @@ +See "Enter the variable name: " give cName eval(cName+"=10") +See "The variable name = " + cName + " and the variable value = " + eval("return "+cName) + nl diff --git a/Task/Dynamic-variable-names/Ring/dynamic-variable-names-2.ring b/Task/Dynamic-variable-names/Ring/dynamic-variable-names-2.ring new file mode 100644 index 0000000000..ffc59fad4a --- /dev/null +++ b/Task/Dynamic-variable-names/Ring/dynamic-variable-names-2.ring @@ -0,0 +1,2 @@ +Enter the variable name: test +The variable name = test and the variable value = 10 diff --git a/Task/Dynamic-variable-names/Sidef/dynamic-variable-names.sidef b/Task/Dynamic-variable-names/Sidef/dynamic-variable-names.sidef new file mode 100644 index 0000000000..518d1fbd3b --- /dev/null +++ b/Task/Dynamic-variable-names/Sidef/dynamic-variable-names.sidef @@ -0,0 +1,10 @@ +var name = read("Enter a variable name: ", String); # type in 'foo' + +class DynamicVar(name, value) { + method init { + DynamicVar.def_method(name, ->(_) { value }) + } +} + +var v = DynamicVar(name, 42); # creates a dynamic variable +say v.foo; # retrieves the value diff --git a/Task/Echo-server/LFE/echo-server.lfe b/Task/Echo-server/LFE/echo-server.lfe new file mode 100644 index 0000000000..0cee965f9c --- /dev/null +++ b/Task/Echo-server/LFE/echo-server.lfe @@ -0,0 +1,18 @@ +(defun start () + (spawn (lambda () + (let ((`#(ok ,socket) (gen_tcp:listen 12321 `(#(packet line))))) + (echo-loop socket))))) + +(defun echo-loop (socket) + (let* ((`#(ok ,conn) (gen_tcp:accept socket)) + (handler (spawn (lambda () (handle conn))))) + (lfe_io:format "Got connection: ~p~n" (list conn)) + (gen_tcp:controlling_process conn handler) + (echo-loop socket))) + +(defun handle (conn) + (receive + (`#(tcp ,conn ,data) + (gen_tcp:send conn data)) + (`#(tcp_closed ,conn) + (lfe_io:format "Connection closed: ~p~n" (list conn))))) diff --git a/Task/Echo-server/Nim/echo-server.nim b/Task/Echo-server/Nim/echo-server.nim new file mode 100644 index 0000000000..ba45ad1bed --- /dev/null +++ b/Task/Echo-server/Nim/echo-server.nim @@ -0,0 +1,18 @@ +import asyncnet, asyncdispatch + +proc processClient(client: AsyncSocket) {.async.} = + while true: + let line = await client.recvLine() + await client.send(line & "\c\L") + +proc serve() {.async.} = + var server = newAsyncSocket() + server.bindAddr(Port(12321)) + server.listen() + + while true: + let client = await server.accept() + discard processClient(client) + +discard serve() +runForever() diff --git a/Task/Element-wise-operations/Phix/element-wise-operations.phix b/Task/Element-wise-operations/Phix/element-wise-operations.phix new file mode 100644 index 0000000000..7269e3ba88 --- /dev/null +++ b/Task/Element-wise-operations/Phix/element-wise-operations.phix @@ -0,0 +1,12 @@ +constant m = {{7, 8, 7},{4, 0, 9}}, + m2 = {{4, 5, 1},{6, 2, 1}} +?{m,"+",m2,"=",sq_add(m,m2)} +?{m,"-",m2,"=",sq_sub(m,m2)} +?{m,"*",m2,"=",sq_mul(m,m2)} +?{m,"/",m2,"=",sq_div(m,m2)} +?{m,"^",m2,"=",sq_power(m,m2)} +?{m,"+ 3 =",sq_add(m,3)} +?{m,"- 3 =",sq_sub(m,3)} +?{m,"* 3 =",sq_mul(m,3)} +?{m,"/ 3 =",sq_div(m,3)} +?{m,"^ 3 =",sq_power(m,3)} diff --git a/Task/Element-wise-operations/jq/element-wise-operations-1.jq b/Task/Element-wise-operations/jq/element-wise-operations-1.jq new file mode 100644 index 0000000000..253e0e7f45 --- /dev/null +++ b/Task/Element-wise-operations/jq/element-wise-operations-1.jq @@ -0,0 +1,12 @@ +# Occurrences of .[0] in "operator" will refer to an element in self, +# and occurrences of .[1] will refer to the corresponding element in other. +def elementwise( operator; other ): + length as $rows + | if $rows == 0 then . + else . as $self + | other as $other + | ($self[0]|length) as $cols + | reduce range(0; $rows) as $i + ([]; reduce range(0; $cols) as $j + (.; .[$i][$j] = ([$self[$i][$j], $other[$i][$j]] | operator) ) ) + end ; diff --git a/Task/Element-wise-operations/jq/element-wise-operations-2.jq b/Task/Element-wise-operations/jq/element-wise-operations-2.jq new file mode 100644 index 0000000000..b38589a3e7 --- /dev/null +++ b/Task/Element-wise-operations/jq/element-wise-operations-2.jq @@ -0,0 +1,4 @@ +[[3,1,4],[1,5,9]] as $m1 | [[2,7,1],[8,2,2]] as $m2 +| ( ($m1|elementwise(.[0] + .[1]; $m2) ), + ($m1|elementwise(.[0] + 2 * .[1]; $m2) ), + ($m1|elementwise(.[0] < .[1]; $m2) ) ) diff --git a/Task/Element-wise-operations/jq/element-wise-operations-3.jq b/Task/Element-wise-operations/jq/element-wise-operations-3.jq new file mode 100644 index 0000000000..134a43e960 --- /dev/null +++ b/Task/Element-wise-operations/jq/element-wise-operations-3.jq @@ -0,0 +1,3 @@ +[[5,8,5],[9,7,11]] +[[7,15,6],[17,9,13]] +[[false,true,false],[true,false,false]] diff --git a/Task/Element-wise-operations/jq/element-wise-operations-4.jq b/Task/Element-wise-operations/jq/element-wise-operations-4.jq new file mode 100644 index 0000000000..273670815f --- /dev/null +++ b/Task/Element-wise-operations/jq/element-wise-operations-4.jq @@ -0,0 +1,23 @@ +def elementwise2( operator; other ): + def pow(i): . as $in | reduce range(0;i) as $i (1; .*$in); + def operation(x; op; y): + [x,y] | op as $op + | if $op == "+" then x+y + elif $op == "-" then x-y + elif $op == "*" then x*y + elif $op == "/" then x/y + elif $op == "%" then x%y + elif $op == "//" then x/y|floor + elif $op == "**" or $op == "^" or $op == "pow" then x|pow(y) + else $op + end; + + length as $rows + | if $rows == 0 then . + else . as $self + | other as $other + | ($self[0]|length) as $cols + | reduce range(0; $rows) as $i + ([]; reduce range(0; $cols) as $j + (.; .[$i][$j] = operation($self[$i][$j]; operator; $other[$i][$j] ) ) ) + end; diff --git a/Task/Element-wise-operations/jq/element-wise-operations-5.jq b/Task/Element-wise-operations/jq/element-wise-operations-5.jq new file mode 100644 index 0000000000..3d2544bd8d --- /dev/null +++ b/Task/Element-wise-operations/jq/element-wise-operations-5.jq @@ -0,0 +1,4 @@ +[[3,1,4],[1,5,9]] as $m1 | [[2,7,1],[8,2,2]] as $m2 + | ( ($m1|elementwise2("+"; $m2) ), + ($m1|elementwise2("//"; $m2)), + ($m1|elementwise2(.[0] < .[1]; $m2) ) ) diff --git a/Task/Element-wise-operations/jq/element-wise-operations-6.jq b/Task/Element-wise-operations/jq/element-wise-operations-6.jq new file mode 100644 index 0000000000..b14e022f9f --- /dev/null +++ b/Task/Element-wise-operations/jq/element-wise-operations-6.jq @@ -0,0 +1,3 @@ +[[5,8,5],[9,7,11]] +[[1,0,4],[0,2,4]] +[[false,true,false],[true,false,false]] diff --git a/Task/Empty-directory/FreeBASIC/empty-directory.freebasic b/Task/Empty-directory/FreeBASIC/empty-directory.freebasic new file mode 100644 index 0000000000..6dcf38d53a --- /dev/null +++ b/Task/Empty-directory/FreeBASIC/empty-directory.freebasic @@ -0,0 +1,43 @@ +' FB 1.05.0 Win64 + +#Include "dir.bi" + +Function IsDirEmpty(dirPath As String) As Boolean + Err = 0 + ' check dirPath is a valid directory + Dim As String fileName = Dir(dirPath, fbDirectory) + If Len(fileName) = 0 Then + Err = 1000 ' dirPath is not a valid path + Return False + End If + ' now check if there are any files/subdirectories in it other than . and .. + Dim fileSpec As String = dirPath + "\*.*" + Const attribMask = fbNormal Or fbHidden Or fbSystem Or fbDirectory + Dim outAttrib As UInteger + fileName = Dir(fileSpec, attribMask, outAttrib) ' get first file + Do + If fileName <> ".." AndAlso fileName <> "." Then + If Len(fileName) = 0 Then Return True + Exit Do + End If + fileName = Dir ' get next file + Loop + Return False +End Function + +Dim outAttrib As UInteger +Dim dirPath As String = "c:\freebasic\docs" ' known to be empty +Dim empty As Boolean = IsDirEmpty(dirPath) +Dim e As Long = Err +If e = 1000 Then + Print "'"; dirPath; "' is not a valid directory" + End +End If +If empty Then + Print "'"; dirPath; "' is empty" +Else + Print "'"; dirPath; "' is not empty" +End If +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Empty-directory/Lasso/empty-directory.lasso b/Task/Empty-directory/Lasso/empty-directory.lasso new file mode 100644 index 0000000000..93fe57d077 --- /dev/null +++ b/Task/Empty-directory/Lasso/empty-directory.lasso @@ -0,0 +1,3 @@ +dir('has_content') -> isEmpty +'
' +dir('no_content') -> isEmpty diff --git a/Task/Empty-directory/Lingo/empty-directory.lingo b/Task/Empty-directory/Lingo/empty-directory.lingo new file mode 100644 index 0000000000..5ea04adac7 --- /dev/null +++ b/Task/Empty-directory/Lingo/empty-directory.lingo @@ -0,0 +1,3 @@ +on isDirEmpty (dir) + return getNthFileNameInFolder(dir, 1) = EMPTY +end diff --git a/Task/Empty-directory/Nim/empty-directory.nim b/Task/Empty-directory/Nim/empty-directory.nim new file mode 100644 index 0000000000..d34a7b69c1 --- /dev/null +++ b/Task/Empty-directory/Nim/empty-directory.nim @@ -0,0 +1,7 @@ +import os, rdstdin + +var empty = true +for f in walkDir(readLineFromStdin "directory: "): + empty = false + break +echo empty diff --git a/Task/Empty-directory/Ring/empty-directory.ring b/Task/Empty-directory/Ring/empty-directory.ring new file mode 100644 index 0000000000..16b2098dc2 --- /dev/null +++ b/Task/Empty-directory/Ring/empty-directory.ring @@ -0,0 +1,3 @@ +myList = dir("C:\Ring\bin") +if len(myList) > 0 see "C:\Ring\bin is not empty" + nl +else see "C:\Ring\bin is empty" + nl ok diff --git a/Task/Empty-directory/Sidef/empty-directory-1.sidef b/Task/Empty-directory/Sidef/empty-directory-1.sidef new file mode 100644 index 0000000000..3da33f6048 --- /dev/null +++ b/Task/Empty-directory/Sidef/empty-directory-1.sidef @@ -0,0 +1 @@ +Dir.new('/my/dir').is_empty; # true, false or nil diff --git a/Task/Empty-directory/Sidef/empty-directory-2.sidef b/Task/Empty-directory/Sidef/empty-directory-2.sidef new file mode 100644 index 0000000000..89fce8ce5e --- /dev/null +++ b/Task/Empty-directory/Sidef/empty-directory-2.sidef @@ -0,0 +1,8 @@ +func is_empty(dir) { + dir.open(\var dir_h) || return nil; + dir_h.each { |file| + file ~~ ['.', '..'] && next; + return false; + }; + return true; +}; diff --git a/Task/Empty-program/8051-Assembly/empty-program.8051 b/Task/Empty-program/8051-Assembly/empty-program.8051 new file mode 100644 index 0000000000..cec36fb1d8 --- /dev/null +++ b/Task/Empty-program/8051-Assembly/empty-program.8051 @@ -0,0 +1,2 @@ +ORG RESET +jmp $ diff --git a/Task/Empty-program/Axe/empty-program.axe b/Task/Empty-program/Axe/empty-program.axe new file mode 100644 index 0000000000..eea0c81b7d --- /dev/null +++ b/Task/Empty-program/Axe/empty-program.axe @@ -0,0 +1,2 @@ +:.PRGMNAME +: diff --git a/Task/Empty-program/Computer-zero-Assembly/empty-program.computer b/Task/Empty-program/Computer-zero-Assembly/empty-program.computer new file mode 100644 index 0000000000..a8268175ec --- /dev/null +++ b/Task/Empty-program/Computer-zero-Assembly/empty-program.computer @@ -0,0 +1 @@ + STP diff --git a/Task/Empty-program/EDSAC-order-code/empty-program.edsac b/Task/Empty-program/EDSAC-order-code/empty-program.edsac new file mode 100644 index 0000000000..194e0fbe5d --- /dev/null +++ b/Task/Empty-program/EDSAC-order-code/empty-program.edsac @@ -0,0 +1,4 @@ +T64K [ set load point ] +GK [ set base address ] +ZF [ stop ] +EZPF [ begin at load point ] diff --git a/Task/Empty-program/ERRE/empty-program.erre b/Task/Empty-program/ERRE/empty-program.erre new file mode 100644 index 0000000000..f3110b96c1 --- /dev/null +++ b/Task/Empty-program/ERRE/empty-program.erre @@ -0,0 +1,3 @@ +PROGRAM EMPTY +BEGIN +END PROGRAM diff --git a/Task/Empty-program/EchoLisp/empty-program.echolisp b/Task/Empty-program/EchoLisp/empty-program.echolisp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Task/Empty-program/FreeBASIC/empty-program.freebasic b/Task/Empty-program/FreeBASIC/empty-program.freebasic new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Task/Empty-program/FunL/empty-program.funl b/Task/Empty-program/FunL/empty-program.funl new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Task/Empty-program/Futhark/empty-program.futhark b/Task/Empty-program/Futhark/empty-program.futhark new file mode 100644 index 0000000000..1325e7926a --- /dev/null +++ b/Task/Empty-program/Futhark/empty-program.futhark @@ -0,0 +1 @@ +fun main(): int = 0 diff --git a/Task/Empty-program/FutureBasic/empty-program.futurebasic b/Task/Empty-program/FutureBasic/empty-program.futurebasic new file mode 100644 index 0000000000..a6a9baf65e --- /dev/null +++ b/Task/Empty-program/FutureBasic/empty-program.futurebasic @@ -0,0 +1 @@ +end diff --git a/Task/Empty-program/I/empty-program.i b/Task/Empty-program/I/empty-program.i new file mode 100644 index 0000000000..390e6d8ea4 --- /dev/null +++ b/Task/Empty-program/I/empty-program.i @@ -0,0 +1 @@ +software{} diff --git a/Task/Empty-program/LC3-Assembly/empty-program.lc3 b/Task/Empty-program/LC3-Assembly/empty-program.lc3 new file mode 100644 index 0000000000..a77296c931 --- /dev/null +++ b/Task/Empty-program/LC3-Assembly/empty-program.lc3 @@ -0,0 +1 @@ + .END diff --git a/Task/Empty-program/Lasso/empty-program-1.lasso b/Task/Empty-program/Lasso/empty-program-1.lasso new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/Task/Empty-program/Lasso/empty-program-1.lasso @@ -0,0 +1 @@ +[] diff --git a/Task/Empty-program/Lasso/empty-program-2.lasso b/Task/Empty-program/Lasso/empty-program-2.lasso new file mode 100644 index 0000000000..53506e4a95 --- /dev/null +++ b/Task/Empty-program/Lasso/empty-program-2.lasso @@ -0,0 +1 @@ + diff --git a/Task/Empty-program/Lasso/empty-program-3.lasso b/Task/Empty-program/Lasso/empty-program-3.lasso new file mode 100644 index 0000000000..79600acdd3 --- /dev/null +++ b/Task/Empty-program/Lasso/empty-program-3.lasso @@ -0,0 +1 @@ + diff --git a/Task/Empty-program/Lingo/empty-program.lingo b/Task/Empty-program/Lingo/empty-program.lingo new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Task/Empty-program/Oforth/empty-program-1.oforth b/Task/Empty-program/Oforth/empty-program-1.oforth new file mode 100644 index 0000000000..ddd2214582 --- /dev/null +++ b/Task/Empty-program/Oforth/empty-program-1.oforth @@ -0,0 +1 @@ +oforth empty.of diff --git a/Task/Empty-program/Oforth/empty-program-2.oforth b/Task/Empty-program/Oforth/empty-program-2.oforth new file mode 100644 index 0000000000..65e54377f9 --- /dev/null +++ b/Task/Empty-program/Oforth/empty-program-2.oforth @@ -0,0 +1 @@ +oforth --P"bye" diff --git a/Task/Empty-program/OpenLisp/empty-program.openlisp b/Task/Empty-program/OpenLisp/empty-program.openlisp new file mode 100644 index 0000000000..7af496375f --- /dev/null +++ b/Task/Empty-program/OpenLisp/empty-program.openlisp @@ -0,0 +1,2 @@ +#!/openlisp/uxlisp -shell +() diff --git a/Task/Empty-program/Ring/empty-program.ring b/Task/Empty-program/Ring/empty-program.ring new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Task/Empty-program/SSEM/empty-program-1.ssem b/Task/Empty-program/SSEM/empty-program-1.ssem new file mode 100644 index 0000000000..27e62f70be --- /dev/null +++ b/Task/Empty-program/SSEM/empty-program-1.ssem @@ -0,0 +1,2 @@ +00000000000000000000000000000000 0. 0 to CI jump to store(0) + 1 +00000000000000000000000000000000 1. 0 to CI jump to store(0) + 1 diff --git a/Task/Empty-program/SSEM/empty-program-2.ssem b/Task/Empty-program/SSEM/empty-program-2.ssem new file mode 100644 index 0000000000..0f4275214b --- /dev/null +++ b/Task/Empty-program/SSEM/empty-program-2.ssem @@ -0,0 +1 @@ +00000000000001110000000000000000 0. Stop diff --git a/Task/Empty-program/Set-lang/empty-program.set b/Task/Empty-program/Set-lang/empty-program.set new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Task/Empty-program/Sidef/empty-program.sidef b/Task/Empty-program/Sidef/empty-program.sidef new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Task/Empty-program/Sparkling/empty-program.sparkling b/Task/Empty-program/Sparkling/empty-program.sparkling new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Task/Empty-program/Swift/empty-program.swift b/Task/Empty-program/Swift/empty-program.swift new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Task/Empty-program/Symsyn/empty-program.symsyn b/Task/Empty-program/Symsyn/empty-program.symsyn new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Task/Empty-program/TI-83-Hex-Assembly/empty-program.ti-83 b/Task/Empty-program/TI-83-Hex-Assembly/empty-program.ti-83 new file mode 100644 index 0000000000..77361a6ab3 --- /dev/null +++ b/Task/Empty-program/TI-83-Hex-Assembly/empty-program.ti-83 @@ -0,0 +1,2 @@ +PROGRAM:EMPTY +:AsmPrgmC9 diff --git a/Task/Empty-program/Ursa/empty-program.ursa b/Task/Empty-program/Ursa/empty-program.ursa new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Task/Empty-string/8th/empty-string-1.8th b/Task/Empty-string/8th/empty-string-1.8th new file mode 100644 index 0000000000..028de5747b --- /dev/null +++ b/Task/Empty-string/8th/empty-string-1.8th @@ -0,0 +1 @@ +"" var, str diff --git a/Task/Empty-string/8th/empty-string-2.8th b/Task/Empty-string/8th/empty-string-2.8th new file mode 100644 index 0000000000..e412f73cbe --- /dev/null +++ b/Task/Empty-string/8th/empty-string-2.8th @@ -0,0 +1 @@ +str @ s:len 0 n:= if ... then diff --git a/Task/Empty-string/Apex/empty-string.apex b/Task/Empty-string/Apex/empty-string.apex new file mode 100644 index 0000000000..0426df1e48 --- /dev/null +++ b/Task/Empty-string/Apex/empty-string.apex @@ -0,0 +1,2 @@ +String.isBlank(record.txt_Field__c); +--Returns true if the specified String is white space, empty (''), or null; otherwise, returns false. diff --git a/Task/Empty-string/Axe/empty-string.axe b/Task/Empty-string/Axe/empty-string.axe new file mode 100644 index 0000000000..a22e716d6b --- /dev/null +++ b/Task/Empty-string/Axe/empty-string.axe @@ -0,0 +1,6 @@ +""→Str1 +!If length(Str1) + Disp "EMPTY",i +Else + Disp "NOT EMPTY",i +End diff --git a/Task/Empty-string/FreeBASIC/empty-string.freebasic b/Task/Empty-string/FreeBASIC/empty-string.freebasic new file mode 100644 index 0000000000..b352eed885 --- /dev/null +++ b/Task/Empty-string/FreeBASIC/empty-string.freebasic @@ -0,0 +1,17 @@ +' FB 1.05.0 Win64 + +Sub IsEmpty(s As String) + If Len(s) = 0 Then + Print "String is empty" + Else + Print "String is not empty" + End If +End Sub + +Dim s As String ' implicitly assigned an empty string +IsEmpty(s) +Dim t As String = "" ' explicitly assigned an empty string +IsEmpty(t) +Dim u As String = "not empty" +IsEmpty(u) +Sleep diff --git a/Task/Empty-string/FutureBasic/empty-string.futurebasic b/Task/Empty-string/FutureBasic/empty-string.futurebasic new file mode 100644 index 0000000000..8ef5f38335 --- /dev/null +++ b/Task/Empty-string/FutureBasic/empty-string.futurebasic @@ -0,0 +1,13 @@ +include "ConsoleWindow" + +dim as Str255 s + +s = "" +if s == "" then print "String is empty" +if s[0] == 0 then print "String is empty" +if len(s) == 0 then print "String is empty" + +s = "Hello" +if s <> "" then print "String not empty." +if s[0] then print "String not empty." +if len(s) > 0 then print "String not empty." diff --git a/Task/Empty-string/I/empty-string.i b/Task/Empty-string/I/empty-string.i new file mode 100644 index 0000000000..b012d38f21 --- /dev/null +++ b/Task/Empty-string/I/empty-string.i @@ -0,0 +1,11 @@ +software { + var s = "" + + if len(s) = 0 + print("Empty string!") + end + + if s != "" + print("Not an empty string!") + end +} diff --git a/Task/Empty-string/LFE/empty-string.lfe b/Task/Empty-string/LFE/empty-string.lfe new file mode 100644 index 0000000000..d08206e7e1 --- /dev/null +++ b/Task/Empty-string/LFE/empty-string.lfe @@ -0,0 +1,24 @@ +> (set str "") +() +> (length str) +0 +> (=:= 0 (length str)) +true +> (=:= 0 (length "apple")) +false +> (=:= "apple" "") +false +> (=/= "apple" "") +true +> (=:= str "") +true +> (=:= "apple" '()) +false +> (=/= "apple" '()) +true +> (=:= str '()) +true +> (case str ('() 'empty) ((cons head tail) 'not-empty)) +empty +> (case "apple" ('() 'empty) ((cons head tail) 'not-empty)) +not-empty diff --git a/Task/Empty-string/Lasso/empty-string.lasso b/Task/Empty-string/Lasso/empty-string.lasso new file mode 100644 index 0000000000..9e2537dbbb --- /dev/null +++ b/Task/Empty-string/Lasso/empty-string.lasso @@ -0,0 +1,12 @@ +//Demonstrate how to assign an empty string to a variable. +local(str = string) +local(str = '') + +//Demonstrate how to check that a string is empty. +#str->size == 0 // true +not #str->size // true + +//Demonstrate how to check that a string is not empty. +local(str = 'Hello, World!') +#str->size > 0 // true +#str->size // true diff --git a/Task/Empty-string/Lingo/empty-string.lingo b/Task/Empty-string/Lingo/empty-string.lingo new file mode 100644 index 0000000000..556f4d2828 --- /dev/null +++ b/Task/Empty-string/Lingo/empty-string.lingo @@ -0,0 +1,5 @@ +str = EMPTY -- same as: str = "" +put str=EMPTY +-- 1 +put str<>EMPTY +-- 0 diff --git a/Task/Empty-string/NESL/empty-string.nesl b/Task/Empty-string/NESL/empty-string.nesl new file mode 100644 index 0000000000..77e1e3bc60 --- /dev/null +++ b/Task/Empty-string/NESL/empty-string.nesl @@ -0,0 +1,5 @@ +my_empty_string = ""; + +% To make sure it is empty, we can ask whether its length is equal to zero. % + +#my_empty_string == 0; diff --git a/Task/Empty-string/Nim/empty-string.nim b/Task/Empty-string/Nim/empty-string.nim new file mode 100644 index 0000000000..30ead37716 --- /dev/null +++ b/Task/Empty-string/Nim/empty-string.nim @@ -0,0 +1,12 @@ +var x = "" + +if x == "": + echo "empty" +if x != "": + echo "not empty" + +# Alternatively: +if x.len == 0: + echo "empty" +if x.len > 0: + echo "not empty" diff --git a/Task/Empty-string/Oforth/empty-string.oforth b/Task/Empty-string/Oforth/empty-string.oforth new file mode 100644 index 0000000000..ace5d54cb1 --- /dev/null +++ b/Task/Empty-string/Oforth/empty-string.oforth @@ -0,0 +1,2 @@ +"" isEmpty +"" isEmpty not diff --git a/Task/Empty-string/Phix/empty-string.phix b/Task/Empty-string/Phix/empty-string.phix new file mode 100644 index 0000000000..a8ed18cbf8 --- /dev/null +++ b/Task/Empty-string/Phix/empty-string.phix @@ -0,0 +1,9 @@ +string s + +s = "" -- assign an empty string + +if length(s)=0 then -- string is empty +if s="" then -- string is empty + +if length(s)!=0 then -- string is not empty +if s!="" then -- string is not empty diff --git a/Task/Empty-string/Ring/empty-string.ring b/Task/Empty-string/Ring/empty-string.ring new file mode 100644 index 0000000000..652304c60d --- /dev/null +++ b/Task/Empty-string/Ring/empty-string.ring @@ -0,0 +1,6 @@ +cStr = NULL # empty string +if cStr = NULL + see "cstr is an empty string!" + nl +else + see "cstr is not empty string!" + nl +ok diff --git a/Task/Empty-string/Sidef/empty-string-1.sidef b/Task/Empty-string/Sidef/empty-string-1.sidef new file mode 100644 index 0000000000..cae39e5a96 --- /dev/null +++ b/Task/Empty-string/Sidef/empty-string-1.sidef @@ -0,0 +1,2 @@ +var s = ""; +var s = String.new; diff --git a/Task/Empty-string/Sidef/empty-string-2.sidef b/Task/Empty-string/Sidef/empty-string-2.sidef new file mode 100644 index 0000000000..fe6e2a186e --- /dev/null +++ b/Task/Empty-string/Sidef/empty-string-2.sidef @@ -0,0 +1,5 @@ +s == ""; +s.length == 0; +s.is_empty; +s ~~ /^\z/; +s ~~ /\A\z/; diff --git a/Task/Empty-string/Sidef/empty-string-3.sidef b/Task/Empty-string/Sidef/empty-string-3.sidef new file mode 100644 index 0000000000..45f148a94d --- /dev/null +++ b/Task/Empty-string/Sidef/empty-string-3.sidef @@ -0,0 +1,4 @@ +s != ""; +s.length > 0; +s ~~ /./s; +s !~ /^\z/; diff --git a/Task/Empty-string/Swift/empty-string.swift b/Task/Empty-string/Swift/empty-string.swift new file mode 100644 index 0000000000..78454fa3ff --- /dev/null +++ b/Task/Empty-string/Swift/empty-string.swift @@ -0,0 +1,6 @@ +var s = "" +if s.isEmpty { // alternately, s == "" + println("s is empty") +} else { + println("s is not empty") +} diff --git a/Task/Empty-string/Ursa/empty-string.ursa b/Task/Empty-string/Ursa/empty-string.ursa new file mode 100644 index 0000000000..15d54cc9fd --- /dev/null +++ b/Task/Empty-string/Ursa/empty-string.ursa @@ -0,0 +1,8 @@ +decl string s +set s "" + +if (= s "") + out "empty" endl console +else + out "not empty" endl console +end if diff --git a/Task/Empty-string/jq/empty-string-1.jq b/Task/Empty-string/jq/empty-string-1.jq new file mode 100644 index 0000000000..5bf719898e --- /dev/null +++ b/Task/Empty-string/jq/empty-string-1.jq @@ -0,0 +1 @@ +"" as $x diff --git a/Task/Empty-string/jq/empty-string-2.jq b/Task/Empty-string/jq/empty-string-2.jq new file mode 100644 index 0000000000..507d36470f --- /dev/null +++ b/Task/Empty-string/jq/empty-string-2.jq @@ -0,0 +1,3 @@ +s == "" +# or: +s|length == 0 diff --git a/Task/Empty-string/jq/empty-string-3.jq b/Task/Empty-string/jq/empty-string-3.jq new file mode 100644 index 0000000000..e9c7e29dad --- /dev/null +++ b/Task/Empty-string/jq/empty-string-3.jq @@ -0,0 +1,3 @@ +s != "" +# or: +s.length != 0 # etc. diff --git a/Task/Enforced-immutability/8th/enforced-immutability.8th b/Task/Enforced-immutability/8th/enforced-immutability.8th new file mode 100644 index 0000000000..d19e8a8227 --- /dev/null +++ b/Task/Enforced-immutability/8th/enforced-immutability.8th @@ -0,0 +1 @@ +123 const var, one-two-three diff --git a/Task/Enforced-immutability/Nim/enforced-immutability.nim b/Task/Enforced-immutability/Nim/enforced-immutability.nim new file mode 100644 index 0000000000..058cc06afe --- /dev/null +++ b/Task/Enforced-immutability/Nim/enforced-immutability.nim @@ -0,0 +1,7 @@ +var x = "mutablefoo" # Mutable variable +let y = "immutablefoo" # Immutable variable, at runtime +const z = "constantfoo" # Immutable constant, at compile time + +x[0] = 'M' +y[0] = 'I' # Compile error: 'y[0]' cannot be assigned to +z[0] = 'C' # Compile error: 'z[0]' cannot be assigned to diff --git a/Task/Enforced-immutability/Oforth/enforced-immutability.oforth b/Task/Enforced-immutability/Oforth/enforced-immutability.oforth new file mode 100644 index 0000000000..d40cdf6e99 --- /dev/null +++ b/Task/Enforced-immutability/Oforth/enforced-immutability.oforth @@ -0,0 +1,12 @@ +Object Class new: MyClass(a, b) + +MyClass method: setA(value) value := a ; +MyClass method: setB(value) value := b ; + +MyClass method: initialize(v, w) self setA(v) self setB(w) ; + +MyClass new(1, 2) // OK : An immutable object +MyClass new(1, 2) setA(4) // KO : An immutable object can't be updated after initialization +MyClass new(ListBuffer new, 12) // KO : Not an immutable value. +ListBuffer new Constant new: T // KO : A constant cannot be mutable. +Channel new send(ListBuffer new) // KO : A mutable object can't be sent into a channel. diff --git a/Task/Enforced-immutability/Phix/enforced-immutability.phix b/Task/Enforced-immutability/Phix/enforced-immutability.phix new file mode 100644 index 0000000000..4cf5113cb5 --- /dev/null +++ b/Task/Enforced-immutability/Phix/enforced-immutability.phix @@ -0,0 +1,3 @@ +constant n = 1 +constant s = {1,2,3} +constant str = "immutable string" diff --git a/Task/Enforced-immutability/Sidef/enforced-immutability.sidef b/Task/Enforced-immutability/Sidef/enforced-immutability.sidef new file mode 100644 index 0000000000..4b57e89659 --- /dev/null +++ b/Task/Enforced-immutability/Sidef/enforced-immutability.sidef @@ -0,0 +1,2 @@ +define PI = 3.14159; # compile-time defined constant +const MSG = "Hello world!"; # run-time defined constant diff --git a/Task/Enforced-immutability/jq/enforced-immutability.jq b/Task/Enforced-immutability/jq/enforced-immutability.jq new file mode 100644 index 0000000000..519c390df5 --- /dev/null +++ b/Task/Enforced-immutability/jq/enforced-immutability.jq @@ -0,0 +1 @@ +["a", "b"] as $a | $a[0] = 1 as $b | $a diff --git a/Task/Entropy/EchoLisp/entropy-1.echolisp b/Task/Entropy/EchoLisp/entropy-1.echolisp new file mode 100644 index 0000000000..bed79f56de --- /dev/null +++ b/Task/Entropy/EchoLisp/entropy-1.echolisp @@ -0,0 +1,18 @@ +(lib 'hash) +;; counter: hash-table[key]++ +(define (count++ ht k ) +(hash-set ht k (1+ (hash-ref! ht k 0)))) + +(define (hi count n ) + (define pi (// count n)) + (- (* pi (log2 pi)))) + +;; (H [string|list]) → entropy (bits) +(define (H info) + (define S (if(string? info) (string->list info) info)) + (define ht (make-hash)) + (define n (length S)) + + (for ((s S)) (count++ ht s)) + (for/sum ((s (make-set S))) (hi (hash-ref ht s) n))) + diff --git a/Task/Entropy/EchoLisp/entropy-2.echolisp b/Task/Entropy/EchoLisp/entropy-2.echolisp new file mode 100644 index 0000000000..f077e74c3c --- /dev/null +++ b/Task/Entropy/EchoLisp/entropy-2.echolisp @@ -0,0 +1,12 @@ +;; by increasing entropy + +(H "🔴") → 0 +(H "🔵🔴") → 1 +(H "1223334444") → 1.8464393446710154 +(H "♖♘♗♕♔♗♘♖♙♙♙♙♙♙♙♙♙") → 2.05632607578088 +(H "EchoLisp") → 3 +(H "Longtemps je me suis couché de bonne heure") → 3.860828877124944 +(H "azertyuiopmlkjhgfdsqwxcvbn") → 4.700439718141092 +(H (for/list ((i 1000)) (random 1000))) → 9.13772704467521 +(H (for/list ((i 100_000)) (random 100_000))) → 15.777516877140766 +(H (for/list ((i 1000_000)) (random 1000_000))) → 19.104028424596976 diff --git a/Task/Entropy/FreeBASIC/entropy.freebasic b/Task/Entropy/FreeBASIC/entropy.freebasic new file mode 100644 index 0000000000..e821c2cddf --- /dev/null +++ b/Task/Entropy/FreeBASIC/entropy.freebasic @@ -0,0 +1,34 @@ +' version 25-06-2015 +' compile with: fbc -s console + +Sub calc_entropy(source As String, base_ As Integer) + + Dim As Integer i, sourcelen = Len(source), totalchar(255) + Dim As Double prop, entropy + + For i = 0 To sourcelen -1 + totalchar(source[i]) += 1 + Next + + Print "Char count" + For i = 0 To 255 + If totalchar(i) = 0 Then Continue For + Print " "; Chr(i); Using " ######"; totalchar(i) + prop = totalchar(i) / sourcelen + entropy = entropy - (prop * Log (prop) / Log(base_)) + Next + + Print : Print "The Entropy of "; Chr(34); source; Chr(34); " is"; entropy + +End Sub + +' ------=< MAIN >=------ + +calc_entropy("1223334444", 2) +Print + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Entropy/Nim/entropy.nim b/Task/Entropy/Nim/entropy.nim new file mode 100644 index 0000000000..59f0c3f66f --- /dev/null +++ b/Task/Entropy/Nim/entropy.nim @@ -0,0 +1,8 @@ +import tables, math + +proc entropy(s): float = + var t = initCountTable[char]() + for c in s: t.inc(c) + for x in t.values: result -= x/s.len * log2(x/s.len) + +echo entropy("1223334444") diff --git a/Task/Entropy/Oforth/entropy.oforth b/Task/Entropy/Oforth/entropy.oforth new file mode 100644 index 0000000000..c70ce70912 --- /dev/null +++ b/Task/Entropy/Oforth/entropy.oforth @@ -0,0 +1,8 @@ +: entropy(s) -- f +| freq sz | + s size dup ifZero: [ return ] asFloat ->sz + ListBuffer initValue(255, 0) ->freq + s apply( #[ dup freq at 1+ freq put ] ) + 0.0 freq applyIf( #[ 0 <> ], #[ sz / dup ln * - ] ) Ln2 / ; + +entropy("1223334444") . diff --git a/Task/Entropy/Sidef/entropy.sidef b/Task/Entropy/Sidef/entropy.sidef new file mode 100644 index 0000000000..f11584c869 --- /dev/null +++ b/Task/Entropy/Sidef/entropy.sidef @@ -0,0 +1,10 @@ +func entropy(s) { + var counts = Hash.new; + s.each { |c| counts{c} := 0 ++ }; + var len = s.len; + [0, counts.values.map {|count| + var freq = count/len; freq * freq.log2 }... + ]«-»; +} +  +say entropy("1223334444"); diff --git a/Task/Entropy/jq/entropy-1.jq b/Task/Entropy/jq/entropy-1.jq new file mode 100644 index 0000000000..8134d1652d --- /dev/null +++ b/Task/Entropy/jq/entropy-1.jq @@ -0,0 +1,10 @@ +# Input: an array of strings. +# Output: an object with the strings as keys, the values of which are the corresponding frequencies. +def counter: + reduce .[] as $item ( {}; .[$item] += 1 ) ; + +# entropy in bits of the input string +def entropy: + (explode | map( [.] | implode ) | counter + | [ .[] | . * log ] | add) as $sum + | ((length|log) - ($sum / length)) / (2|log) ; diff --git a/Task/Entropy/jq/entropy-2.jq b/Task/Entropy/jq/entropy-2.jq new file mode 100644 index 0000000000..7c00e4bf85 --- /dev/null +++ b/Task/Entropy/jq/entropy-2.jq @@ -0,0 +1 @@ +"1223334444" | entropy # => 1.8464393446710154 diff --git a/Task/Enumerations/FreeBASIC/enumerations.freebasic b/Task/Enumerations/FreeBASIC/enumerations.freebasic new file mode 100644 index 0000000000..f5d9c62348 --- /dev/null +++ b/Task/Enumerations/FreeBASIC/enumerations.freebasic @@ -0,0 +1,17 @@ +' FB 1.05.0 Win64 + +Enum Animals + Cat + Dog + Zebra +End Enum + +Enum Dogs + Bulldog = 1 + Terrier = 2 + WolfHound = 4 +End Enum + +Print Cat, Dog, Zebra +Print Bulldog, Terrier, WolfHound +Sleep diff --git a/Task/Enumerations/FutureBasic/enumerations.futurebasic b/Task/Enumerations/FutureBasic/enumerations.futurebasic new file mode 100644 index 0000000000..4ab1324049 --- /dev/null +++ b/Task/Enumerations/FutureBasic/enumerations.futurebasic @@ -0,0 +1,21 @@ +include "ConsoleWindow" + +begin enum 1 +_apple +_banana +_cherry +end enum + +begin enum +_appleExplicit = 10 +_bananaExplicit = 15 +_cherryExplicit = 30 +end enum + +print "_apple ="; _apple +print "_banana ="; _banana +print "_cherry ="; _cherry +print +print "_appleExplicit ="; _appleExplicit +print "_bananaExplicit ="; _bananaExplicit +print "_cherryExplicit ="; _cherryExplicit diff --git a/Task/Enumerations/Lingo/enumerations-1.lingo b/Task/Enumerations/Lingo/enumerations-1.lingo new file mode 100644 index 0000000000..eaf312acdc --- /dev/null +++ b/Task/Enumerations/Lingo/enumerations-1.lingo @@ -0,0 +1,32 @@ +-- parent script "Enumeration" + +property ancestor + +on new (me) + data = [:] + repeat with i = 2 to the paramCount + data[param(i)] = i-1 + end repeat + me.ancestor = data + return me +end + +on setAt (me) + -- do nothing +end + +on setProp (me) + -- do nothing +end + +on deleteAt (me) + -- do nothing +end + +on deleteProp (me) + -- do nothing +end + +on addProp (me) + -- do nothing +end diff --git a/Task/Enumerations/Lingo/enumerations-2.lingo b/Task/Enumerations/Lingo/enumerations-2.lingo new file mode 100644 index 0000000000..ea2a41663d --- /dev/null +++ b/Task/Enumerations/Lingo/enumerations-2.lingo @@ -0,0 +1,34 @@ +enumeration = script("Enumeration").new("APPLE", "BANANA", "CHERRY") + +put enumeration["BANANA"] +-- 2 + +-- try to change a value after construction (fails) +enumeration["BANANA"] = 666 +put enumeration["BANANA"] +-- 2 + +-- try to change a value after construction using setProp (fails) +enumeration.setProp("BANANA", 666) +put enumeration["BANANA"] +-- 2 + +-- try to delete a value after construction (fails) +enumeration.deleteAt(2) +put enumeration["BANANA"] +-- 2 + +-- try to delete a value after construction using deleteProp (fails) +enumeration.deleteProp("BANANA") +put enumeration["BANANA"] +-- 2 + +-- try to add a new value after construction (fails) +enumeration["FOO"] = 666 +put enumeration["FOO"] +-- + +-- try to add a new value after construction using addProp (fails) +enumeration.addProp("FOO", 666) +put enumeration["FOO"] +-- diff --git a/Task/Enumerations/Nim/enumerations.nim b/Task/Enumerations/Nim/enumerations.nim new file mode 100644 index 0000000000..bb5d6e8a3b --- /dev/null +++ b/Task/Enumerations/Nim/enumerations.nim @@ -0,0 +1,8 @@ +type Fruits = enum Apple, Banana, Cherry + +type Fruits = enum Apple = 0, Banana = 1, Cherry = 2 # with values + +type Fruits {.pure.} = enum Apple, Banana, Cherry # scoped enum +var i: int = Apple # error for scoped enum + +type Fruits = enum Apple = "Apple", Banana = "Banana", Cherry = "Cherry" # with string literals diff --git a/Task/Enumerations/Oforth/enumerations.oforth b/Task/Enumerations/Oforth/enumerations.oforth new file mode 100644 index 0000000000..60fd2136bd --- /dev/null +++ b/Task/Enumerations/Oforth/enumerations.oforth @@ -0,0 +1 @@ +[ $apple, $banana, $cherry ] const: Fruits diff --git a/Task/Enumerations/Phix/enumerations.phix b/Task/Enumerations/Phix/enumerations.phix new file mode 100644 index 0000000000..2e75e03900 --- /dev/null +++ b/Task/Enumerations/Phix/enumerations.phix @@ -0,0 +1,2 @@ +enum apple, banana, orange +enum apple=5, banana=10, orange=15 diff --git a/Task/Enumerations/Ring/enumerations.ring b/Task/Enumerations/Ring/enumerations.ring new file mode 100644 index 0000000000..6d0fb960e9 --- /dev/null +++ b/Task/Enumerations/Ring/enumerations.ring @@ -0,0 +1,6 @@ +apple = 0 +banana = 1 +cherry = 2 +see "apple : " + apple + nl +see "banana : " + banana + nl +see "cherry : " + cherry + nl diff --git a/Task/Enumerations/Sidef/enumerations-1.sidef b/Task/Enumerations/Sidef/enumerations-1.sidef new file mode 100644 index 0000000000..bee2c5906c --- /dev/null +++ b/Task/Enumerations/Sidef/enumerations-1.sidef @@ -0,0 +1 @@ +enum {Apple, Banana, Cherry}; # numbered 0 through 2 diff --git a/Task/Enumerations/Sidef/enumerations-2.sidef b/Task/Enumerations/Sidef/enumerations-2.sidef new file mode 100644 index 0000000000..8591347ac0 --- /dev/null +++ b/Task/Enumerations/Sidef/enumerations-2.sidef @@ -0,0 +1,6 @@ +enum { + Apple=3, + Banana, # gets the value 4 + Cherry="a", + Orange, # gets the value "b" +}; diff --git a/Task/Enumerations/Swift/enumerations.swift b/Task/Enumerations/Swift/enumerations.swift new file mode 100644 index 0000000000..6ca94876b6 --- /dev/null +++ b/Task/Enumerations/Swift/enumerations.swift @@ -0,0 +1,16 @@ +enum Fruit { + case Apple + case Banana + case Cherry +} +// or +enum Fruit { + case Apple, Banana, Cherry +} + +enum Season : Int { + case Winter = 1 + case Spring = 2 + case Summer = 3 + case Autumn = 4 +} diff --git a/Task/Enumerations/jq/enumerations.jq b/Task/Enumerations/jq/enumerations.jq new file mode 100644 index 0000000000..b2058ebad0 --- /dev/null +++ b/Task/Enumerations/jq/enumerations.jq @@ -0,0 +1,2 @@ +{"fruits" : { "apple" : null, "banana" : null, "cherry" : null } +{"fruits" : { "apple" : 0, "banana" : 1, "cherry" : 2 } diff --git a/Task/Environment-variables/FreeBASIC/environment-variables.freebasic b/Task/Environment-variables/FreeBASIC/environment-variables.freebasic new file mode 100644 index 0000000000..9fef790ab4 --- /dev/null +++ b/Task/Environment-variables/FreeBASIC/environment-variables.freebasic @@ -0,0 +1,5 @@ +' FB 1.05.0 Win64 + +Var v = Environ("SystemRoot") +Print v +Sleep diff --git a/Task/Environment-variables/FunL/environment-variables.funl b/Task/Environment-variables/FunL/environment-variables.funl new file mode 100644 index 0000000000..85a43d5e4b --- /dev/null +++ b/Task/Environment-variables/FunL/environment-variables.funl @@ -0,0 +1,3 @@ +println( System.getenv('PATH') ) +println( $home ) +println( $user ) diff --git a/Task/Environment-variables/Gri/environment-variables-1.gri b/Task/Environment-variables/Gri/environment-variables-1.gri new file mode 100644 index 0000000000..dd3d38d46e --- /dev/null +++ b/Task/Environment-variables/Gri/environment-variables-1.gri @@ -0,0 +1,2 @@ +get env \foo HOME +show "\foo" diff --git a/Task/Environment-variables/Gri/environment-variables-2.gri b/Task/Environment-variables/Gri/environment-variables-2.gri new file mode 100644 index 0000000000..9332bea60b --- /dev/null +++ b/Task/Environment-variables/Gri/environment-variables-2.gri @@ -0,0 +1 @@ +get env \foo "X Y Z" diff --git a/Task/Environment-variables/I/environment-variables.i b/Task/Environment-variables/I/environment-variables.i new file mode 100644 index 0000000000..67555438aa --- /dev/null +++ b/Task/Environment-variables/I/environment-variables.i @@ -0,0 +1,5 @@ +software { + print(load("$HOME")) + print(load("$USER")) + print(load("$PATH")) +} diff --git a/Task/Environment-variables/Lasso/environment-variables.lasso b/Task/Environment-variables/Lasso/environment-variables.lasso new file mode 100644 index 0000000000..9c68d84256 --- /dev/null +++ b/Task/Environment-variables/Lasso/environment-variables.lasso @@ -0,0 +1,15 @@ +#!/usr/bin/lasso9 + +define getenv(sysvar::string) => { + local(regexp = regexp( + -find = `(?m)^` + #sysvar + `=(.*?)$`, + -input = sys_environ -> join('\n'), + -ignorecase + )) + return #regexp ->find ? #regexp -> matchString(1) +} + +stdoutnl(getenv('HOME')) +stdoutnl(getenv('PATH')) +stdoutnl(getenv('USER')) +stdoutnl(getenv('WHAT')) diff --git a/Task/Environment-variables/Lingo/environment-variables.lingo b/Task/Environment-variables/Lingo/environment-variables.lingo new file mode 100644 index 0000000000..5c54b68f31 --- /dev/null +++ b/Task/Environment-variables/Lingo/environment-variables.lingo @@ -0,0 +1,6 @@ +sx = xtra("Shell").new() +if the platform contains "win" then + path = sx.shell_cmd("echo %PATH%").line[1] +else + path = sx.shell_cmd("echo $PATH").line[1] +end if diff --git a/Task/Environment-variables/Nim/environment-variables.nim b/Task/Environment-variables/Nim/environment-variables.nim new file mode 100644 index 0000000000..b68ba16af1 --- /dev/null +++ b/Task/Environment-variables/Nim/environment-variables.nim @@ -0,0 +1,2 @@ +import os +echo getEnv("HOME") diff --git a/Task/Environment-variables/Oforth/environment-variables.oforth b/Task/Environment-variables/Oforth/environment-variables.oforth new file mode 100644 index 0000000000..bd9065dab9 --- /dev/null +++ b/Task/Environment-variables/Oforth/environment-variables.oforth @@ -0,0 +1 @@ +System getEnv("PATH") println diff --git a/Task/Environment-variables/Phix/environment-variables.phix b/Task/Environment-variables/Phix/environment-variables.phix new file mode 100644 index 0000000000..7f27babfaa --- /dev/null +++ b/Task/Environment-variables/Phix/environment-variables.phix @@ -0,0 +1 @@ +?getenv("PATH") diff --git a/Task/Environment-variables/Ring/environment-variables.ring b/Task/Environment-variables/Ring/environment-variables.ring new file mode 100644 index 0000000000..203b04dd68 --- /dev/null +++ b/Task/Environment-variables/Ring/environment-variables.ring @@ -0,0 +1 @@ +see get("path") diff --git a/Task/Environment-variables/Sidef/environment-variables.sidef b/Task/Environment-variables/Sidef/environment-variables.sidef new file mode 100644 index 0000000000..54b2121536 --- /dev/null +++ b/Task/Environment-variables/Sidef/environment-variables.sidef @@ -0,0 +1 @@ +say ENV{'HOME'}; diff --git a/Task/Environment-variables/Ursa/environment-variables.ursa b/Task/Environment-variables/Ursa/environment-variables.ursa new file mode 100644 index 0000000000..cb3450184a --- /dev/null +++ b/Task/Environment-variables/Ursa/environment-variables.ursa @@ -0,0 +1,2 @@ +import "system" +out (system.getenv "HOME") endl console diff --git a/Task/Environment-variables/jq/environment-variables.jq b/Task/Environment-variables/jq/environment-variables.jq new file mode 100644 index 0000000000..7b00e5af3a --- /dev/null +++ b/Task/Environment-variables/jq/environment-variables.jq @@ -0,0 +1 @@ +env.HOME diff --git a/Task/Equilibrium-index/ERRE/equilibrium-index.erre b/Task/Equilibrium-index/ERRE/equilibrium-index.erre new file mode 100644 index 0000000000..1c13a2d349 --- /dev/null +++ b/Task/Equilibrium-index/ERRE/equilibrium-index.erre @@ -0,0 +1,21 @@ +PROGRAM EQUILIBRIUM + +DIM LISTA[6] + +PROCEDURE EQ(LISTA[]->RES$) + LOCAL I%,R,S,E$ + FOR I%=0 TO UBOUND(LISTA,1) DO + S+=LISTA[I%] + END FOR + FOR I%=0 TO UBOUND(LISTA,1) DO + IF R=S-R-LISTA[I%] THEN E$+=STR$(I%)+"," END IF + R+=LISTA[I%] + END FOR + RES$=LEFT$(E$,LEN(E$)-1) +END PROCEDURE + +BEGIN + LISTA[]=(-7,1,5,2,-4,3,0) + EQ(LISTA[]->RES$) + PRINT("Equilibrium indices are";RES$) +END PROGRAM diff --git a/Task/Equilibrium-index/FreeBASIC/equilibrium-index.freebasic b/Task/Equilibrium-index/FreeBASIC/equilibrium-index.freebasic new file mode 100644 index 0000000000..3d7aa73fd7 --- /dev/null +++ b/Task/Equilibrium-index/FreeBASIC/equilibrium-index.freebasic @@ -0,0 +1,36 @@ +' FB 1.05.0 Win64 + +Sub equilibriumIndices (a() As Integer, b() As Integer) + If UBound(a) = -1 Then Return '' empty array + + Dim sum As Integer = 0 + Dim count As Integer = 0 + For i As Integer = LBound(a) To UBound(a) : sum += a(i) : Next + Dim sumLeft As Integer = 0, sumRight As Integer = 0 + + For i As Integer = LBound(a) To UBound(a) + sumRight = sum - sumLeft - a(i) + If sumLeft = sumRight Then + Redim Preserve b(0 To Count) + b(count) = i + count += 1 + End If + sumLeft += a(i) + Next +End Sub + +Dim a(0 To 6) As Integer = { -7, 1, 5, 2, -4, 3, 0 } +Dim b() As Integer +equilibriumIndices a(), b() +If UBound(b) = -1 Then + Print "There are no equilibrium indices" +ElseIf UBound(b) = LBound(b) Then + Print "The only equilibrium index is : "; b(LBound(b)) +Else + Print "The equilibrium indices are : " + For i As Integer = LBound(b) To UBound(b) : Print b(i); " "; : Next +End If + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Equilibrium-index/Nim/equilibrium-index.nim b/Task/Equilibrium-index/Nim/equilibrium-index.nim new file mode 100644 index 0000000000..8f8127d6b9 --- /dev/null +++ b/Task/Equilibrium-index/Nim/equilibrium-index.nim @@ -0,0 +1,20 @@ +import math, sequtils + +iterator eqindex(data) = + var suml, ddelayed = 0 + var sumr = sum(data) + for i,d in data: + suml += ddelayed + sumr -= d + ddelayed = d + if suml == sumr: + yield i + +const d = @[@[-7, 1, 5, 2, -4, 3, 0], + @[2, 4, 6], + @[2, 9, 2], + @[1, -1, 1, -1, 1, -1, 1]] + +for data in d: + echo "d = ", data + echo "eqIndex(d) -> ", toSeq(eqindex(data)) diff --git a/Task/Equilibrium-index/Oforth/equilibrium-index.oforth b/Task/Equilibrium-index/Oforth/equilibrium-index.oforth new file mode 100644 index 0000000000..549bc37c15 --- /dev/null +++ b/Task/Equilibrium-index/Oforth/equilibrium-index.oforth @@ -0,0 +1,9 @@ +: equilibrium(l) +| ls rs i e | + 0 ->ls + l sum ->rs + ListBuffer new l size loop: i [ + l at(i) ->e + rs e - dup ->rs ls == ifTrue: [ i over add ] + ls e + ->ls + ] ; diff --git a/Task/Equilibrium-index/Phix/equilibrium-index.phix b/Task/Equilibrium-index/Phix/equilibrium-index.phix new file mode 100644 index 0000000000..b582bdd6c6 --- /dev/null +++ b/Task/Equilibrium-index/Phix/equilibrium-index.phix @@ -0,0 +1,15 @@ +function equilibrium(sequence s) +atom lower_sum = 0 +atom higher_sum = sum(s) +sequence res = {} + for i=1 to length(s) do + higher_sum -= s[i] + if lower_sum=higher_sum then + res &= i + end if + lower_sum += s[i] + end for + return res +end function + +? equilibrium({-7,1,5,2,-4,3,0}) diff --git a/Task/Equilibrium-index/Ring/equilibrium-index.ring b/Task/Equilibrium-index/Ring/equilibrium-index.ring new file mode 100644 index 0000000000..ea3058cda4 --- /dev/null +++ b/Task/Equilibrium-index/Ring/equilibrium-index.ring @@ -0,0 +1,14 @@ +list = [-7, 1, 5, 2, -4, 3, 0] +see "equilibrium indices are : " + equilibrium(list) + nl + +func equilibrium l + r = 0 s = 0 e = "" + for n = 1 to len(l) + s += l[n] + next + for i = 1 to len(l) + if r = s - r - l[i] e += string(i-1) + "," ok + r += l[i] + next + e = left(e,len(e)-1) + return e diff --git a/Task/Equilibrium-index/Sidef/equilibrium-index-1.sidef b/Task/Equilibrium-index/Sidef/equilibrium-index-1.sidef new file mode 100644 index 0000000000..649756ec87 --- /dev/null +++ b/Task/Equilibrium-index/Sidef/equilibrium-index-1.sidef @@ -0,0 +1,8 @@ +func eq_index(nums) { + var (i, sum, sums) = (0, 0, Hash.new); + nums.each { |n| + sums{2*sum + n} := [] -> append(i++); + sum += n; + } + sums{sum} \\ []; +} diff --git a/Task/Equilibrium-index/Sidef/equilibrium-index-2.sidef b/Task/Equilibrium-index/Sidef/equilibrium-index-2.sidef new file mode 100644 index 0000000000..706d91b49a --- /dev/null +++ b/Task/Equilibrium-index/Sidef/equilibrium-index-2.sidef @@ -0,0 +1,10 @@ +var indices = [ + [-7, 1, 5, 2,-4, 3, 0], + [2, 4, 6], + [2, 9, 2], + [1,-1, 1,-1, 1,-1, 1], +] + +for x in indices { + say ("%s => %s" % @|[x, eq_index(x)].map{.dump}); +} diff --git a/Task/Equilibrium-index/jq/equilibrium-index-1.jq b/Task/Equilibrium-index/jq/equilibrium-index-1.jq new file mode 100644 index 0000000000..a6e1162925 --- /dev/null +++ b/Task/Equilibrium-index/jq/equilibrium-index-1.jq @@ -0,0 +1,13 @@ +# The index origin is 0 in jq. +def equilibrium_indices: + def indices(a; mx): + def report: # [i, headsum, tailsum] + .[0] as $i + | if $i == mx then empty # all done + else .[1] as $h + | (.[2] - a[$i]) as $t + | (if $h == $t then $i else empty end), + ( [ $i + 1, $h + a[$i], $t ] | report ) + end; + [0, 0, (a|add)] | report; + . as $in | indices($in; $in|length); diff --git a/Task/Equilibrium-index/jq/equilibrium-index-2.jq b/Task/Equilibrium-index/jq/equilibrium-index-2.jq new file mode 100644 index 0000000000..0f5091e763 --- /dev/null +++ b/Task/Equilibrium-index/jq/equilibrium-index-2.jq @@ -0,0 +1 @@ +[-7, 1, 5, 2, -4, 3, 0] | equilibrium_indices diff --git a/Task/Equilibrium-index/jq/equilibrium-index-3.jq b/Task/Equilibrium-index/jq/equilibrium-index-3.jq new file mode 100644 index 0000000000..e3e5042e7c --- /dev/null +++ b/Task/Equilibrium-index/jq/equilibrium-index-3.jq @@ -0,0 +1,6 @@ +def count(g): reduce g as $i (0; .+1); + +# Create an array of length n with "init" elements: +def array(n;init): reduce range(0;n) as $i ([]; . + [0]); + +count( array(1e4;0) | equilibrium_indices ) diff --git a/Task/Ethiopian-multiplication/ERRE/ethiopian-multiplication.erre b/Task/Ethiopian-multiplication/ERRE/ethiopian-multiplication.erre new file mode 100644 index 0000000000..9ddea212ce --- /dev/null +++ b/Task/Ethiopian-multiplication/ERRE/ethiopian-multiplication.erre @@ -0,0 +1,23 @@ +PROGRAM ETHIOPIAN_MULT + +FUNCTION EVEN(A) + EVEN=(A+1) MOD 2 +END FUNCTION + +FUNCTION HALF(A) + HALF=INT(A/2) +END FUNCTION + +FUNCTION DOUBLE(A) + DOUBLE=2*A +END FUNCTION + +BEGIN + X=17 Y=34 TOT=0 + WHILE X>=1 DO + PRINT(X,) + IF EVEN(X)=0 THEN TOT=TOT+Y PRINT(Y) ELSE PRINT END IF + X=HALF(X) Y=DOUBLE(Y) + END WHILE + PRINT("=",TOT) +END PROGRAM diff --git a/Task/Ethiopian-multiplication/Nim/ethiopian-multiplication.nim b/Task/Ethiopian-multiplication/Nim/ethiopian-multiplication.nim new file mode 100644 index 0000000000..9823724490 --- /dev/null +++ b/Task/Ethiopian-multiplication/Nim/ethiopian-multiplication.nim @@ -0,0 +1,15 @@ +proc halve(x): int = x div 2 +proc double(x): int = x * 2 +proc even(x): bool = x mod 2 == 0 + +proc ethiopian(x, y): int = + var x = x + var y = y + + while x >= 1: + if not even x: + result += y + x = halve x + y = double y + +echo ethiopian(17, 34) diff --git a/Task/Ethiopian-multiplication/Oforth/ethiopian-multiplication.oforth b/Task/Ethiopian-multiplication/Oforth/ethiopian-multiplication.oforth new file mode 100644 index 0000000000..577d1c24b0 --- /dev/null +++ b/Task/Ethiopian-multiplication/Oforth/ethiopian-multiplication.oforth @@ -0,0 +1,7 @@ +: halve 2 / ; +: double 2 * ; + +: ethiopian + dup ifZero: [ nip return ] + over double over halve ethiopian + swap isEven ifTrue: [ nip ] else: [ + ] ; diff --git a/Task/Ethiopian-multiplication/Phix/ethiopian-multiplication.phix b/Task/Ethiopian-multiplication/Phix/ethiopian-multiplication.phix new file mode 100644 index 0000000000..2302997ac9 --- /dev/null +++ b/Task/Ethiopian-multiplication/Phix/ethiopian-multiplication.phix @@ -0,0 +1,23 @@ +function emHalf(integer n) + return floor(n/2) +end function + +function emDouble(integer n) + return n*2 +end function + +function emIsEven(integer n) + return (remainder(n,2)=0) +end function + +function emMultiply(integer a, integer b) +integer sum = 0 + while a!=0 do + if not emIsEven(a) then sum += b end if + a = emHalf(a) + b = emDouble(b) + end while + return sum +end function + +printf(1,"emMultiply(%d,%d) = %d\n",{17,34,emMultiply(17,34)}) diff --git a/Task/Ethiopian-multiplication/Powerbuilder/ethiopian-multiplication.powerbuilder b/Task/Ethiopian-multiplication/Powerbuilder/ethiopian-multiplication.powerbuilder new file mode 100644 index 0000000000..119c89c29a --- /dev/null +++ b/Task/Ethiopian-multiplication/Powerbuilder/ethiopian-multiplication.powerbuilder @@ -0,0 +1,28 @@ +public function boolean wf_iseven (long al_arg);return mod(al_arg, 2 ) = 0 +end function + +public function long wf_halve (long al_arg);RETURN int(al_arg / 2) +end function + +public function long wf_double (long al_arg);RETURN al_arg * 2 +end function + +public function long wf_ethiopianmultiplication (long al_multiplicand, long al_multiplier);// calculate result +long ll_product + +DO WHILE al_multiplicand >= 1 + IF wf_iseven(al_multiplicand) THEN + // do nothing + ELSE + ll_product += al_multiplier + END IF + al_multiplicand = wf_halve(al_multiplicand) + al_multiplier = wf_double(al_multiplier) +LOOP + +return ll_product +end function + +// example call +long ll_answer +ll_answer = wf_ethiopianmultiplication(17,34) diff --git a/Task/Ethiopian-multiplication/Ring/ethiopian-multiplication.ring b/Task/Ethiopian-multiplication/Ring/ethiopian-multiplication.ring new file mode 100644 index 0000000000..6762fd9bb1 --- /dev/null +++ b/Task/Ethiopian-multiplication/Ring/ethiopian-multiplication.ring @@ -0,0 +1,18 @@ +x = 17 +y = 34 +p = 0 +while x != 0 + if not even(x) + p += y + see "" + x + " " + " " + y + nl + else + see "" + x + " ---" + nl ok + x = halve(x) + y = double(y) +end +see " " + " ===" + nl +see " " + p + +func double n return (n * 2) +func halve n return floor(n / 2) +func even n return ((n & 1) = 0) diff --git a/Task/Ethiopian-multiplication/Sidef/ethiopian-multiplication.sidef b/Task/Ethiopian-multiplication/Sidef/ethiopian-multiplication.sidef new file mode 100644 index 0000000000..6f1b3e1188 --- /dev/null +++ b/Task/Ethiopian-multiplication/Sidef/ethiopian-multiplication.sidef @@ -0,0 +1,14 @@ +func double (n) { n * 2 }; +func halve (n) { int(n / 2) }; + +func ethiopic_mult(a, b) { + var r = 0; + while (a > 0) { + a.is_even || (r += b); + a = halve(a); + b = double(b); + }; + return r; +} + +say ethiopic_mult(17, 34); diff --git a/Task/Ethiopian-multiplication/Swift/ethiopian-multiplication.swift b/Task/Ethiopian-multiplication/Swift/ethiopian-multiplication.swift new file mode 100644 index 0000000000..85e48f6dd3 --- /dev/null +++ b/Task/Ethiopian-multiplication/Swift/ethiopian-multiplication.swift @@ -0,0 +1,26 @@ +import Darwin + +func ethiopian(var #int1:Int, var #int2:Int) -> Int { + var lhs = [int1], rhs = [int2] + + func isEven(#n:Int) -> Bool {return n % 2 == 0} + func double(#n:Int) -> Int {return n * 2} + func halve(#n:Int) -> Int {return n / 2} + + while int1 != 1 { + lhs.append(halve(n: int1)) + rhs.append(double(n: int2)) + int1 = halve(n: int1) + int2 = double(n: int2) + } + + var returnInt = 0 + for (a,b) in zip(lhs, rhs) { + if (!isEven(n: a)) { + returnInt += b + } + } + return returnInt +} + +println(ethiopian(int1: 17, int2: 34)) diff --git a/Task/Euler-method/Futhark/euler-method.futhark b/Task/Euler-method/Futhark/euler-method.futhark new file mode 100644 index 0000000000..b98c34cd0a --- /dev/null +++ b/Task/Euler-method/Futhark/euler-method.futhark @@ -0,0 +1,15 @@ +fun analytic(t0: f64) (time: f64): f64 = + 20.0 + (t0 - 20.0) * exp64(-0.07*time) + +fun cooling(_time: f64) (temperature: f64): f64 = + -0.07 * (temperature-20.0) + +fun main(t0: f64) (a: f64) (b: f64) (h: f64): []f64 = + let steps = int((b-a)/h) + let temps = replicate steps 0.0 + loop ((t,temps)=(t0,temps)) = for i < steps do + let x = a + f64(i) * h + let temps[i] = abs(t-analytic t0 x) + in (t + h * cooling x t, + temps) + in temps diff --git a/Task/Euler-method/Nim/euler-method.nim b/Task/Euler-method/Nim/euler-method.nim new file mode 100644 index 0000000000..6c06475f36 --- /dev/null +++ b/Task/Euler-method/Nim/euler-method.nim @@ -0,0 +1,13 @@ +import strutils + +proc euler(f: proc (x,y: float): float; y0, a, b, h: float) = + var (t,y) = (a,y0) + while t < b: + echo formatFloat(t, ffDecimal, 3), " ", formatFloat(y, ffDecimal, 3) + t += h + y += h * f(t,y) + +proc newtoncooling(time, temp): float = + -0.07 * (temp - 20) + +euler(newtoncooling, 100.0, 0.0, 100.0, 10.0) diff --git a/Task/Euler-method/Oforth/euler-method-1.oforth b/Task/Euler-method/Oforth/euler-method-1.oforth new file mode 100644 index 0000000000..44c8c14a67 --- /dev/null +++ b/Task/Euler-method/Oforth/euler-method-1.oforth @@ -0,0 +1,6 @@ +: euler(f, y, a, b, h) +| t | + a b h step: t [ + System.Out t <y + ] ; diff --git a/Task/Euler-method/Oforth/euler-method-2.oforth b/Task/Euler-method/Oforth/euler-method-2.oforth new file mode 100644 index 0000000000..be7446dc92 --- /dev/null +++ b/Task/Euler-method/Oforth/euler-method-2.oforth @@ -0,0 +1,7 @@ +: newtonCoolingLaw(t, y) + y 20 - -0.07 * ; + +: test + euler(#newtonCoolingLaw, 100.0, 0.0, 100.0, 2) + euler(#newtonCoolingLaw, 100.0, 0.0, 100.0, 5) + euler(#newtonCoolingLaw, 100.0, 0.0, 100.0, 10) ; diff --git a/Task/Euler-method/Phix/euler-method.phix b/Task/Euler-method/Phix/euler-method.phix new file mode 100644 index 0000000000..331b961f12 --- /dev/null +++ b/Task/Euler-method/Phix/euler-method.phix @@ -0,0 +1,33 @@ +constant FMT = " %7.3f" + +procedure ivp_euler(integer f, atom y, integer step, integer end_t) +integer t = 0; + + printf(1, " Step %2d: ", step); + while t<=end_t do + if remainder(t,10)==0 then printf(1, FMT, y) end if + y += step * call_func(f,{t, y}); + t += step + end while + printf(1, "\n"); +end procedure + +procedure analytic() + printf(1, " Time: "); + for t = 0 to 100 by 10 do printf(1," %7g", t) end for + printf(1, "\nAnalytic: "); + for t = 0 to 100 by 10 do + printf(1, FMT, 20 + 80 * exp(-0.07 * t)) + end for + printf(1,"\n"); +end procedure + +function cooling(atom /*t*/, atom temp) + return -0.07 * (temp - 20); +end function +constant r_cooling = routine_id("cooling") + +analytic(); +ivp_euler(r_cooling, 100, 2, 100); +ivp_euler(r_cooling, 100, 5, 100); +ivp_euler(r_cooling, 100, 10, 100); diff --git a/Task/Euler-method/Ring/euler-method.ring b/Task/Euler-method/Ring/euler-method.ring new file mode 100644 index 0000000000..8a62319459 --- /dev/null +++ b/Task/Euler-method/Ring/euler-method.ring @@ -0,0 +1,13 @@ +decimals(3) +see euler("return -0.07*(y-20)", 100, 0, 100, 2) + nl +see euler("return -0.07*(y-20)", 100, 0, 100, 5) + nl +see euler("return -0.07*(y-20)", 100, 0, 100, 10) + nl + +func euler df, y, a, b, s + t = a + while t <= b + see "" + t + " " + y + nl + y += s * eval(df) + t += s + end + return y diff --git a/Task/Euler-method/SequenceL/euler-method.sequencel b/Task/Euler-method/SequenceL/euler-method.sequencel new file mode 100644 index 0000000000..8c3703f0a3 --- /dev/null +++ b/Task/Euler-method/SequenceL/euler-method.sequencel @@ -0,0 +1,25 @@ +import ; +import ; + +T0 := 100.0; +TR := 20.0; +k := 0.07; + +main(args(2)) := + let + results[i] := euler(newtonCooling, T0, 100, stringToInt(args[i]), 0, "delta_t = " ++ args[i]); + in + delimit(results, '\n'); + +newtonCooling(t) := -k * (t - TR); + +euler: (float -> float) * float * int * int * int * char(1) -> char(1); +euler(f, y, n, h, x, output(1)) := + let + newOutput := output ++ "\n\t" ++ intToString(x) ++ "\t" ++ floatToString(y, 3); + newY := y + h * f(y); + newX := x + h; + in + output when x > n + else + euler(f, newY, n, h, newX, newOutput); diff --git a/Task/Euler-method/Sidef/euler-method.sidef b/Task/Euler-method/Sidef/euler-method.sidef new file mode 100644 index 0000000000..3083156f8c --- /dev/null +++ b/Task/Euler-method/Sidef/euler-method.sidef @@ -0,0 +1,30 @@ +func euler_method(t0, t1, k, step_size) { + var results = [[0, t0]] + for s in (step_size..100 -> by(step_size)) { + t0 -= ((t0 - t1) * k * step_size) + results << [s, t0] + } + return results; +} + +func analytical(t0, t1, k, time) { + (t0 - t1) * exp(-time * k) + t1 +} + +var (T0, T1, k) = (100, 20, .07) +var r2 = euler_method(T0, T1, k, 2).grep { _[0] %% 10 } +var r5 = euler_method(T0, T1, k, 5).grep { _[0] %% 10 } +var r10 = euler_method(T0, T1, k, 10).grep { _[0] %% 10 } + +say "Time\t 2 err(%) 5 err(%) 10 err(%) Analytic" +say "-"*76 + +r2.range.each { |i| + var an = analytical(T0, T1, k, r2[i][0]) + printf("%4d\t#{'%9.3f' * 7}\n", + r2[i][0], + r2[i][1], ( r2[i][1] / an) * 100 - 100, + r5[i][1], ( r5[i][1] / an) * 100 - 100, + r10[i][1], (r10[i][1] / an) * 100 - 100, + an) +} diff --git a/Task/Euler-method/jq/euler-method-1.jq b/Task/Euler-method/jq/euler-method-1.jq new file mode 100644 index 0000000000..4036e91460 --- /dev/null +++ b/Task/Euler-method/jq/euler-method-1.jq @@ -0,0 +1,24 @@ +# euler_method takes a filter (df), initial condition +# (x1,y1), ending x (x2), and step size as parameters; +# it emits the y values at each iteration. +# df must take [x,y] as its input. +def euler_method(df; x1; y1; x2; h): + h as $h + | [x1, y1] + | recurse( if ((.[0] < x2 and x1 < x2) or + (.[0] > x2 and x1 > x2)) then + [ (.[0] + $h), (.[1] + $h*df) ] + else empty + end ) + | .[1] ; + + +# We could now solve the task by writing for each step-size, $h +# euler_method(-0.07 * (.[1]-20); 0; 100; 100; $h) +# but for clarity, we shall define a function named "cooling": + +# [x,y] is input +def cooling: -0.07 * (.[1]-20); + +# The following solves the task: +# (2,5,10) | [., [ euler_method(cooling; 0; 100; 100; .) ] ] diff --git a/Task/Euler-method/jq/euler-method-2.jq b/Task/Euler-method/jq/euler-method-2.jq new file mode 100644 index 0000000000..cbb1cefb18 --- /dev/null +++ b/Task/Euler-method/jq/euler-method-2.jq @@ -0,0 +1,10 @@ +def euler_solution(df; x1; y1; x2; h): + def recursion(exp): reduce recurse(exp) as $x (.; $x); + h as $h + | [x1, y1] + | recursion( if ((.[0] < x2 and x1 < x2) or + (.[0] > x2 and x1 > x2)) then + [ (.[0] + $h), (.[1] + $h*df) ] + else empty + end ) + | .[1] ; diff --git a/Task/Euler-method/jq/euler-method-3.jq b/Task/Euler-method/jq/euler-method-3.jq new file mode 100644 index 0000000000..1e4406c809 --- /dev/null +++ b/Task/Euler-method/jq/euler-method-3.jq @@ -0,0 +1 @@ +(1,2,5,10,20) | [., [ euler_solution(cooling; 0; 100; 100; .) ] ] diff --git a/Task/Euler-method/jq/euler-method-4.jq b/Task/Euler-method/jq/euler-method-4.jq new file mode 100644 index 0000000000..90b73663fe --- /dev/null +++ b/Task/Euler-method/jq/euler-method-4.jq @@ -0,0 +1,6 @@ +$ jq -M -n -c -f Euler_method.jq +[1,[20.05641373347389]] +[2,[20.0424631833732]] +[5,[20.01449963666907]] +[10,[20.000472392]] +[20,[19.180799999999998]] diff --git a/Task/Evaluate-binomial-coefficients/ERRE/evaluate-binomial-coefficients.erre b/Task/Evaluate-binomial-coefficients/ERRE/evaluate-binomial-coefficients.erre new file mode 100644 index 0000000000..01617c4119 --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/ERRE/evaluate-binomial-coefficients.erre @@ -0,0 +1,27 @@ +PROGRAM BINOMIAL + +!$DOUBLE + +PROCEDURE BINOMIAL(N,K->BIN) + LOCAL R,D + R=1 D=N-K + IF D>K THEN K=D D=N-K END IF + WHILE N>K DO + R*=N + N-=1 + WHILE D>1 AND (R-D*INT(R/D))=0 DO + R/=D + D-=1 + END WHILE + END WHILE + BIN=R +END PROCEDURE + +BEGIN + BINOMIAL(5,3->BIN) + PRINT("Binomial (5,3) = ";BIN) + BINOMIAL(100,2->BIN) + PRINT("Binomial (100,2) = ";BIN) + BINOMIAL(33,17->BIN) + PRINT("Binomial (33,17) = ";BIN) +END PROGRAM diff --git a/Task/Evaluate-binomial-coefficients/FreeBASIC/evaluate-binomial-coefficients.freebasic b/Task/Evaluate-binomial-coefficients/FreeBASIC/evaluate-binomial-coefficients.freebasic new file mode 100644 index 0000000000..3284dbd3b6 --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/FreeBASIC/evaluate-binomial-coefficients.freebasic @@ -0,0 +1,31 @@ +' FB 1.05.0 Win64 + +Function factorial(n As Integer) As Integer + If n < 1 Then Return 1 + Dim product As Integer = 1 + For i As Integer = 2 To n + product *= i + Next + Return Product +End Function + +Function binomial(n As Integer, k As Integer) As Integer + If n < 0 OrElse k < 0 OrElse n <= k Then Return 1 + Dim product As Integer = 1 + For i As Integer = n - k + 1 To n + Product *= i + Next + Return product \ factorial(k) +End Function + +For n As Integer = 0 To 14 + For k As Integer = 0 To n + Print Using "####"; binomial(n, k); + Print" "; + Next k + Print +Next n + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Evaluate-binomial-coefficients/FunL/evaluate-binomial-coefficients-1.funl b/Task/Evaluate-binomial-coefficients/FunL/evaluate-binomial-coefficients-1.funl new file mode 100644 index 0000000000..3a84fa7ddb --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/FunL/evaluate-binomial-coefficients-1.funl @@ -0,0 +1,8 @@ +def + choose( n, k ) | k < 0 or k > n = 0 + choose( n, 0 ) = 1 + choose( n, n ) = 1 + choose( n, k ) = product( [(n - i)/(i + 1) | i <- 0:min( k, n - k )] ) + +println( choose(5, 3) ) +println( choose(60, 30) ) diff --git a/Task/Evaluate-binomial-coefficients/FunL/evaluate-binomial-coefficients-2.funl b/Task/Evaluate-binomial-coefficients/FunL/evaluate-binomial-coefficients-2.funl new file mode 100644 index 0000000000..75a2aa153a --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/FunL/evaluate-binomial-coefficients-2.funl @@ -0,0 +1,5 @@ +import integers.factorial + +def + binomial( n, k ) | k < 0 or k > n = 0 + binomial( n, k ) = factorial( n )/factorial( n - k )/factorial( k ) diff --git a/Task/Evaluate-binomial-coefficients/Lasso/evaluate-binomial-coefficients.lasso b/Task/Evaluate-binomial-coefficients/Lasso/evaluate-binomial-coefficients.lasso new file mode 100644 index 0000000000..e74af289f3 --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/Lasso/evaluate-binomial-coefficients.lasso @@ -0,0 +1,12 @@ +define binomial(n::integer,k::integer) => { + #k == 0 ? return 1 + local(result = 1) + loop(#k) => { + #result = #result * (#n - loop_count + 1) / loop_count + } + return #result +} +// Tests +binomial(5, 3) +binomial(5, 4) +binomial(60, 30) diff --git a/Task/Evaluate-binomial-coefficients/MINIL/evaluate-binomial-coefficients.minil b/Task/Evaluate-binomial-coefficients/MINIL/evaluate-binomial-coefficients.minil new file mode 100644 index 0000000000..f30f2b96f0 --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/MINIL/evaluate-binomial-coefficients.minil @@ -0,0 +1,33 @@ +// Number of combinations nCr +00 0E Go: ENT R0 // n +01 1E ENT R1 // r +02 2C CLR R2 +03 2A Loop: ADD1 R2 +04 0D DEC R0 +05 1D DEC R1 +06 C3 JNZ Loop +07 3C CLR R3 // for result +08 3A ADD1 R3 +09 0A Next: ADD1 R0 +0A 1A ADD1 R1 +0B 50 R5 = R0 +0C 5D DEC R5 +0D 63 R6 = R3 +0E 46 Mult: R4 = R6 +0F 3A Add: ADD1 R3 +10 4D DEC R4 +11 CF JNZ Add +12 5D DEC R5 +13 CE JNZ Mult +14 61 Divide:R6 = R1 +15 5A ADD1 R5 +16 3D Sub: DEC R3 +17 9B JZ Exact +18 6D DEC R6 +19 D6 JNZ Sub +1A 94 JZ Divide +1B 35 Exact: R3 = R5 +1C 2D DEC R2 +1D C9 JNZ Next +1E 03 R0 = R3 +1F 80 JZ Go // Display result diff --git a/Task/Evaluate-binomial-coefficients/Nim/evaluate-binomial-coefficients.nim b/Task/Evaluate-binomial-coefficients/Nim/evaluate-binomial-coefficients.nim new file mode 100644 index 0000000000..816bf281b5 --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/Nim/evaluate-binomial-coefficients.nim @@ -0,0 +1,6 @@ +proc binomialCoeff(n, k): int = + result = 1 + for i in 1..k: + result = result * (n-i+1) div i + +echo binomialCoeff(5, 3) diff --git a/Task/Evaluate-binomial-coefficients/Oforth/evaluate-binomial-coefficients.oforth b/Task/Evaluate-binomial-coefficients/Oforth/evaluate-binomial-coefficients.oforth new file mode 100644 index 0000000000..ad66662104 --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/Oforth/evaluate-binomial-coefficients.oforth @@ -0,0 +1 @@ +: binomial(n, k) | i | 1 k loop: i [ n i - 1+ * i / ] ; diff --git a/Task/Evaluate-binomial-coefficients/Ring/evaluate-binomial-coefficients.ring b/Task/Evaluate-binomial-coefficients/Ring/evaluate-binomial-coefficients.ring new file mode 100644 index 0000000000..873c9c1558 --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/Ring/evaluate-binomial-coefficients.ring @@ -0,0 +1,12 @@ +numer = 0 +binomial(5,3) +see "(5,3) binomial = " + numer + nl + +func binomial n, k + if k > n return nil ok + if k > n/2 k = n - k ok + numer = 1 + for i = 1 to k + numer = numer * ( n - i + 1 ) / i + next + return numer diff --git a/Task/Evaluate-binomial-coefficients/Sidef/evaluate-binomial-coefficients-1.sidef b/Task/Evaluate-binomial-coefficients/Sidef/evaluate-binomial-coefficients-1.sidef new file mode 100644 index 0000000000..987503f32e --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/Sidef/evaluate-binomial-coefficients-1.sidef @@ -0,0 +1,5 @@ +func binomial(n,k) { + n! / ((n-k)! * k!) +} + +say binomial(400, 200) diff --git a/Task/Evaluate-binomial-coefficients/Sidef/evaluate-binomial-coefficients-2.sidef b/Task/Evaluate-binomial-coefficients/Sidef/evaluate-binomial-coefficients-2.sidef new file mode 100644 index 0000000000..00872a6dc2 --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/Sidef/evaluate-binomial-coefficients-2.sidef @@ -0,0 +1 @@ +say 400.nok(200) diff --git a/Task/Evaluate-binomial-coefficients/jq/evaluate-binomial-coefficients.jq b/Task/Evaluate-binomial-coefficients/jq/evaluate-binomial-coefficients.jq new file mode 100644 index 0000000000..7a22b3d843 --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/jq/evaluate-binomial-coefficients.jq @@ -0,0 +1,12 @@ +# nCk assuming n >= k +def binomial(n; k): + if k > n / 2 then binomial(n; n-k) + else reduce range(1; k+1) as $i (1; . * (n - $i + 1) / $i) + end; + +def task: + .[0] as $n | .[1] as $k + | "\($n) C \($k) = \(binomial( $n; $k) )"; +; + +([5,3], [100,2], [ 33,17]) | task diff --git a/Task/Even-or-odd/8th/even-or-odd-1.8th b/Task/Even-or-odd/8th/even-or-odd-1.8th new file mode 100644 index 0000000000..978fa319d0 --- /dev/null +++ b/Task/Even-or-odd/8th/even-or-odd-1.8th @@ -0,0 +1,4 @@ +: odd? \ n -- boolean + dup 1 n:band 1 n:= ; +: even? \ n -- boolean + odd? not ; diff --git a/Task/Even-or-odd/8th/even-or-odd-2.8th b/Task/Even-or-odd/8th/even-or-odd-2.8th new file mode 100644 index 0000000000..983efd9d8a --- /dev/null +++ b/Task/Even-or-odd/8th/even-or-odd-2.8th @@ -0,0 +1,4 @@ +: even? \ n -- f + 1 n:band not ; +: odd? \ n -- f + even? not ; diff --git a/Task/Even-or-odd/AntLang/even-or-odd.antlang b/Task/Even-or-odd/AntLang/even-or-odd.antlang new file mode 100644 index 0000000000..5542b7eecf --- /dev/null +++ b/Task/Even-or-odd/AntLang/even-or-odd.antlang @@ -0,0 +1,2 @@ +odd: {x mod 2} +even: {1 - x mod 2} diff --git a/Task/Even-or-odd/Crystal/even-or-odd.crystal b/Task/Even-or-odd/Crystal/even-or-odd.crystal new file mode 100644 index 0000000000..b214424476 --- /dev/null +++ b/Task/Even-or-odd/Crystal/even-or-odd.crystal @@ -0,0 +1,30 @@ +#Using bitwise shift + def isEven_bShift(n) + n == ((n >> 1) << 1) + end + def isOdd_bShift(n) + n != ((n >> 1) << 1) + end +#Using modulo operator + def isEven_mod(n) + (n % 2) == 0 + end + def isOdd_mod(n) + (n % 2) != 0 + end +# Using bitwise "and" + def isEven_bAnd(n) + (n & 1) == 0 + end + def isOdd_bAnd(n) + (n & 1) != 0 + end + +puts isEven_bShift(7) +puts isOdd_bShift(7) + +puts isEven_mod(12) +puts isOdd_mod(12) + +puts isEven_bAnd(21) +puts isOdd_bAnd(21) diff --git a/Task/Even-or-odd/ERRE/even-or-odd.erre b/Task/Even-or-odd/ERRE/even-or-odd.erre new file mode 100644 index 0000000000..c7c8a2d1da --- /dev/null +++ b/Task/Even-or-odd/ERRE/even-or-odd.erre @@ -0,0 +1,19 @@ +PROGRAM ODD_EVEN + +! works for -2^15 <= n% < 2^15 + +FUNCTION ISODD%(N%) + ISODD%=(N% AND 1)<>0 +END FUNCTION + +! works for -2^38 <= n# <= 2^38 +FUNCTION ISODD#(N#) + ISODD#=N#<>2*INT(N#/2) +END FUNCTION + +BEGIN + IF ISODD%(14) THEN PRINT("14 is odd") ELSE PRINT("14 is even") END IF + IF ISODD%(15) THEN PRINT("15 is odd") ELSE PRINT("15 is even") END IF + IF ISODD#(9876543210) THEN PRINT("9876543210 is odd") ELSE PRINT("9876543210 is even") END IF + IF ISODD#(9876543211) THEN PRINT("9876543211 is odd") ELSE PRINT("9876543211 is even") END IF +END PROGRAM diff --git a/Task/Even-or-odd/FreeBASIC/even-or-odd.freebasic b/Task/Even-or-odd/FreeBASIC/even-or-odd.freebasic new file mode 100644 index 0000000000..79791d818a --- /dev/null +++ b/Task/Even-or-odd/FreeBASIC/even-or-odd.freebasic @@ -0,0 +1,19 @@ +' FB 1.05.0 Win64 + +Dim n As Integer + +Do + Print "Enter an integer or 0 to finish : "; + Input "", n + If n = 0 Then + Exit Do + ElseIf n Mod 2 = 0 Then + Print "Your number is even" + Print + Else + Print "Your number is odd" + Print + End if +Loop + +End diff --git a/Task/Even-or-odd/Futhark/even-or-odd.futhark b/Task/Even-or-odd/Futhark/even-or-odd.futhark new file mode 100644 index 0000000000..4d292c6605 --- /dev/null +++ b/Task/Even-or-odd/Futhark/even-or-odd.futhark @@ -0,0 +1 @@ +fun main(x: int): bool = (x & 1) == 0 diff --git a/Task/Even-or-odd/L++/even-or-odd.lpp b/Task/Even-or-odd/L++/even-or-odd.lpp new file mode 100644 index 0000000000..f3afeb798d --- /dev/null +++ b/Task/Even-or-odd/L++/even-or-odd.lpp @@ -0,0 +1 @@ +(defn bool isEven (int x) (return (% x 2))) diff --git a/Task/Even-or-odd/LC3-Assembly/even-or-odd.lc3 b/Task/Even-or-odd/LC3-Assembly/even-or-odd.lc3 new file mode 100644 index 0000000000..fbd8f51e41 --- /dev/null +++ b/Task/Even-or-odd/LC3-Assembly/even-or-odd.lc3 @@ -0,0 +1,21 @@ + .ORIG 0x3000 + + LD R0,NUM + AND R1,R0,1 + BRZ EVEN + + LEA R0,ODD + BRNZP DISP + +EVEN LEA R0,EVN + +DISP PUTS + + HALT + +NUM .FILL 0x1C + +EVN .STRINGZ "EVEN\n" +ODD .STRINGZ "ODD\n" + + .END diff --git a/Task/Even-or-odd/Lasso/even-or-odd.lasso b/Task/Even-or-odd/Lasso/even-or-odd.lasso new file mode 100644 index 0000000000..280dde7113 --- /dev/null +++ b/Task/Even-or-odd/Lasso/even-or-odd.lasso @@ -0,0 +1,5 @@ +define isoddoreven(i::integer) => { + #i % 2 ? return 'odd' + return 'even' +} +isoddoreven(12) diff --git a/Task/Even-or-odd/Lingo/even-or-odd.lingo b/Task/Even-or-odd/Lingo/even-or-odd.lingo new file mode 100644 index 0000000000..87a03b7b1d --- /dev/null +++ b/Task/Even-or-odd/Lingo/even-or-odd.lingo @@ -0,0 +1,7 @@ +on even (n) + return n mod 2 = 0 +end + +on odd (n) + return n mode 2 <> 0 +end diff --git a/Task/Even-or-odd/LiveCode/even-or-odd.livecode b/Task/Even-or-odd/LiveCode/even-or-odd.livecode new file mode 100644 index 0000000000..7110ca4838 --- /dev/null +++ b/Task/Even-or-odd/LiveCode/even-or-odd.livecode @@ -0,0 +1,7 @@ +function odd n + return (n bitand 1) = 1 +end odd + +function notEven n + return (n mod 2) = 1 +end notEven diff --git a/Task/Even-or-odd/NESL/even-or-odd.nesl b/Task/Even-or-odd/NESL/even-or-odd.nesl new file mode 100644 index 0000000000..2feb3a3ae9 --- /dev/null +++ b/Task/Even-or-odd/NESL/even-or-odd.nesl @@ -0,0 +1,4 @@ +function even(n) = mod(n, 2) == 0; + +% test the function by applying it to the first ten positive integers: % +{even(n) : n in [1:11]}; diff --git a/Task/Even-or-odd/Nim/even-or-odd.nim b/Task/Even-or-odd/Nim/even-or-odd.nim new file mode 100644 index 0000000000..d1a6d06367 --- /dev/null +++ b/Task/Even-or-odd/Nim/even-or-odd.nim @@ -0,0 +1,14 @@ +# Least signficant bit: +proc isOdd(i: int): bool = (i and 1) != 0 +proc isEven(i: int): bool = (i and 1) == 0 + +# Modulo: +proc isOdd2(i: int): bool = (i mod 2) != 0 +proc isEven2(i: int): bool = (i mod 2) == 0 + +# Bit Shifting: +proc isOdd3(n: int): bool = n != ((n shr 1) shl 1) +proc isEven3(n: int): bool = n == ((n shr 1) shl 1) + +echo isEven(1) +echo isOdd2(5) diff --git a/Task/Even-or-odd/Oforth/even-or-odd.oforth b/Task/Even-or-odd/Oforth/even-or-odd.oforth new file mode 100644 index 0000000000..f764849ba9 --- /dev/null +++ b/Task/Even-or-odd/Oforth/even-or-odd.oforth @@ -0,0 +1,2 @@ +12 isEven +12 isOdd diff --git a/Task/Even-or-odd/Phix/even-or-odd.phix b/Task/Even-or-odd/Phix/even-or-odd.phix new file mode 100644 index 0000000000..649efdd893 --- /dev/null +++ b/Task/Even-or-odd/Phix/even-or-odd.phix @@ -0,0 +1,3 @@ +for i = -5 to 5 do + ? {i, and_bits(i,1), remainder(i,2)} +end for diff --git a/Task/Even-or-odd/Ring/even-or-odd.ring b/Task/Even-or-odd/Ring/even-or-odd.ring new file mode 100644 index 0000000000..677be80387 --- /dev/null +++ b/Task/Even-or-odd/Ring/even-or-odd.ring @@ -0,0 +1,5 @@ +size = 10 +for i = 1 to size + if i % 2 = 1 see "" + i + " is odd" + nl + else see "" + i + " is even" + nl ok +next diff --git a/Task/Even-or-odd/SSEM/even-or-odd.ssem b/Task/Even-or-odd/SSEM/even-or-odd.ssem new file mode 100644 index 0000000000..ae688c9b1b --- /dev/null +++ b/Task/Even-or-odd/SSEM/even-or-odd.ssem @@ -0,0 +1,15 @@ +11110000000000100000000000000000 0. -15 to c +00000000000000110000000000000000 1. Test +11110000000001100000000000000000 2. c to 15 +11110000000000100000000000000000 3. -15 to c +00001000000001100000000000000000 4. c to 16 +00001000000000100000000000000000 5. -16 to c +01110000000000010000000000000000 6. Sub. 14 +11110000000001100000000000000000 7. c to 15 +10110000000000010000000000000000 8. Sub. 13 +00000000000000110000000000000000 9. Test +01110000000000000000000000000000 10. 14 to CI +11110000000000100000000000000000 11. -15 to c +00000000000001110000000000000000 12. Stop +10000000000000000000000000000000 13. 1 +01000000000000000000000000000000 14. 2 diff --git a/Task/Even-or-odd/SequenceL/even-or-odd.sequencel b/Task/Even-or-odd/SequenceL/even-or-odd.sequencel new file mode 100644 index 0000000000..d57c7f9d98 --- /dev/null +++ b/Task/Even-or-odd/SequenceL/even-or-odd.sequencel @@ -0,0 +1,2 @@ +even(x) := x mod 2 = 0; +odd(x) := x mod 2 = 1; diff --git a/Task/Even-or-odd/Sidef/even-or-odd-1.sidef b/Task/Even-or-odd/Sidef/even-or-odd-1.sidef new file mode 100644 index 0000000000..f098d74a26 --- /dev/null +++ b/Task/Even-or-odd/Sidef/even-or-odd-1.sidef @@ -0,0 +1,3 @@ +var n = 42; +say n.is_odd; # false +say n.is_even; # true diff --git a/Task/Even-or-odd/Sidef/even-or-odd-2.sidef b/Task/Even-or-odd/Sidef/even-or-odd-2.sidef new file mode 100644 index 0000000000..060e467340 --- /dev/null +++ b/Task/Even-or-odd/Sidef/even-or-odd-2.sidef @@ -0,0 +1,2 @@ +func is_odd(n) { n&1 == 1 }; +func is_even(n) { n&1 == 0 }; diff --git a/Task/Even-or-odd/Sidef/even-or-odd-3.sidef b/Task/Even-or-odd/Sidef/even-or-odd-3.sidef new file mode 100644 index 0000000000..9caf6954f8 --- /dev/null +++ b/Task/Even-or-odd/Sidef/even-or-odd-3.sidef @@ -0,0 +1,2 @@ +func is_odd(n) { n%2 == 1 }; +func is_even(n) { n%2 == 0 }; diff --git a/Task/Even-or-odd/Swift/even-or-odd.swift b/Task/Even-or-odd/Swift/even-or-odd.swift new file mode 100644 index 0000000000..a697ee6e29 --- /dev/null +++ b/Task/Even-or-odd/Swift/even-or-odd.swift @@ -0,0 +1,13 @@ +func isEven(n:Int) -> Bool { + + // Bitwise check + if (n & 1 != 0) { + return false + } + + // Mod check + if (n % 2 != 0) { + return false + } + return true +} diff --git a/Task/Even-or-odd/Symsyn/even-or-odd.symsyn b/Task/Even-or-odd/Symsyn/even-or-odd.symsyn new file mode 100644 index 0000000000..5bba756461 --- /dev/null +++ b/Task/Even-or-odd/Symsyn/even-or-odd.symsyn @@ -0,0 +1,6 @@ +n : 23 + + if n bit 0 + 'n is odd' [] + else + 'n is even' [] diff --git a/Task/Even-or-odd/Ursa/even-or-odd.ursa b/Task/Even-or-odd/Ursa/even-or-odd.ursa new file mode 100644 index 0000000000..b44d216e03 --- /dev/null +++ b/Task/Even-or-odd/Ursa/even-or-odd.ursa @@ -0,0 +1,7 @@ +decl int input +set input (in int console) +if (= (mod input 2) 1) + out "odd" endl console +else + out "even" endl console +end if diff --git a/Task/Even-or-odd/jq/even-or-odd-1.jq b/Task/Even-or-odd/jq/even-or-odd-1.jq new file mode 100644 index 0000000000..4e1fe54c79 --- /dev/null +++ b/Task/Even-or-odd/jq/even-or-odd-1.jq @@ -0,0 +1 @@ +def is_even: type == "number" and floor == 0 and . % 2 == 0; diff --git a/Task/Even-or-odd/jq/even-or-odd-2.jq b/Task/Even-or-odd/jq/even-or-odd-2.jq new file mode 100644 index 0000000000..097728a98a --- /dev/null +++ b/Task/Even-or-odd/jq/even-or-odd-2.jq @@ -0,0 +1 @@ +def is_odd: type == "number" and floor == 0 and . % 2 == 1; diff --git a/Task/Events/LFE/events.lfe b/Task/Events/LFE/events.lfe new file mode 100644 index 0000000000..f680bb942e --- /dev/null +++ b/Task/Events/LFE/events.lfe @@ -0,0 +1,19 @@ +(defun log (msg) + (let ((`#(,h ,m ,s) (erlang:time))) + (lfe_io:format "~2.B:~2.B:~2.B => ~s~n" `(,h ,m ,s ,msg)))) + +(defun task () + (log "Task start") + (receive + ('go 'ok)) + (log "Task resumed")) + +(defun run () + (log "Program start") + (let ((pid (spawn (lambda () (task))))) + (progn + (log "Program sleeping") + (timer:sleep 1000) + (log "Program signalling event") + (! pid 'go) + (timer:sleep 100)))) diff --git a/Task/Events/Lingo/events-1.lingo b/Task/Events/Lingo/events-1.lingo new file mode 100644 index 0000000000..c9ee70f1ef --- /dev/null +++ b/Task/Events/Lingo/events-1.lingo @@ -0,0 +1,9 @@ +-- the current window was closed +on closeWindow +... +end + +-- the left mouse button was pressed by the user +on mouseDown +... +end diff --git a/Task/Events/Lingo/events-2.lingo b/Task/Events/Lingo/events-2.lingo new file mode 100644 index 0000000000..4528c9fa53 --- /dev/null +++ b/Task/Events/Lingo/events-2.lingo @@ -0,0 +1,8 @@ +-- send event #mouseDown programmatically to sprite 1 +sendSprite(1, #mouseDown) + +-- send custom event #foo to named sprite "bar" +sendSprite("bar", #foo) + +-- send custom event #fooBar to all existing sprites +sendAllSprites(#fooBar) diff --git a/Task/Events/Lingo/events-3.lingo b/Task/Events/Lingo/events-3.lingo new file mode 100644 index 0000000000..63e3162514 --- /dev/null +++ b/Task/Events/Lingo/events-3.lingo @@ -0,0 +1,15 @@ +mx = xtra("Msg").new() + +-- send message WM_LBUTTONDOWN to a specific window identified by HWND hwnd +WM_LBUTTONDOWN = 513 +MK_LBUTTON = 1 +lParam = 65536*y + x +mx.send_msg (hwnd, WM_LBUTTONDOWN, MK_LBUTTON, lParam) + +-- listen for WM_COPYDATA and WM_MOUSEWHEEL messages sent to current application +-- window, notify Lingo callback function 'msgReceived' when such messages occur. +-- This callback function will receive hwnd, message, wParam and lParam as arguments +-- (and for WM_COPYDATA messages also the data that was sent as ByteArray). +WM_COPYDATA = 74 +WM_MOUSEWHEEL = 522 +mx.msg_listen([WM_COPYDATA, WM_MOUSEWHEEL], VOID, #msgReceived) diff --git a/Task/Events/Nim/events.nim b/Task/Events/Nim/events.nim new file mode 100644 index 0000000000..31164014bd --- /dev/null +++ b/Task/Events/Nim/events.nim @@ -0,0 +1,14 @@ +import posix + +var p: array[2, cint] +discard pipe p +if fork() > 0: + discard close p[0] + discard sleep 1 + discard p[1].write(addr p[0], 1) + var x: cint = 0 + discard wait x +else: + discard close p[1] + discard p[0].read(addr p[1], 1) + echo "received signal from pipe" diff --git a/Task/Events/Oforth/events-1.oforth b/Task/Events/Oforth/events-1.oforth new file mode 100644 index 0000000000..3530f24b2a --- /dev/null +++ b/Task/Events/Oforth/events-1.oforth @@ -0,0 +1,6 @@ +: anEvent +| ch | + Channel new ->ch + #[ ch receive "Ok, event is signaled !" println ] & + System sleep(1000) + ch send($myEvent) ; diff --git a/Task/Events/Oforth/events-2.oforth b/Task/Events/Oforth/events-2.oforth new file mode 100644 index 0000000000..4d8ff83fc8 --- /dev/null +++ b/Task/Events/Oforth/events-2.oforth @@ -0,0 +1,11 @@ +import: emitter + +: anEvent2 +| e i | + Emitter new(null) ->e + e onEvent($myEvent, #[ "Event is signaled !" println ]) + 10 loop: i [ + 1000 System sleep + $myEvent e emit + ] + e close ; diff --git a/Task/Evolutionary-algorithm/8th/evolutionary-algorithm.8th b/Task/Evolutionary-algorithm/8th/evolutionary-algorithm.8th new file mode 100644 index 0000000000..f80200030d --- /dev/null +++ b/Task/Evolutionary-algorithm/8th/evolutionary-algorithm.8th @@ -0,0 +1,94 @@ +\ RosettaCode challenge http://rosettacode.org/wiki/Evolutionary_algorithm +\ Responding to the criticism that the implementation was too directed, this +\ version does a completely random selection of chars to mutate + +var gen +\ Convert a string of valid chars into an array of char-strings: +"ABCDEFGHIJKLMNOPQRSTUVWXYZ " null s:/ var, valid-chars + +\ How many mutations each generation will handle; the larger, the slower each +\ generation but the fewer generations required: +300 var, #mutations +23 var, mutability + +: get-random-char + valid-chars @ + 27 rand-pcg n:abs swap n:mod + a:@ nip ; + +: mutate-string \ s -- s' + ( + rand-pcg mutability @ n:mod not if + drop get-random-char + then + ) s:map ; + +: mutate \ s n -- a + \ iterate 'n' times over the initial string, mutating it each time + \ save the original string, as the best of the previous generation: + >r [] over a:push swap + ( + tuck mutate-string + a:push swap + ) r> times drop ; + +\ compute Hamming distance of two strings: +: hamming \ s1 s2 -- n + 0 >r + s:len n:1- + ( + 2 pick over s:@ nip + 2 pick rot s:@ nip + n:- n:abs r> n:+ >r + ) 0 rot loop + 2drop r> ; + +var best +: fitness-check \ s a -- s t + 10000 >r + -1 best ! + ( + \ ix s ix s' + 2 pick hamming + r@ + over n:> if + rdrop >r + best ! + else + 2drop + then + ) + a:each + rdrop best @ a:@ nip ; + + +: add-random-char \ s -- s' + get-random-char s:+ ; + +\ take the target and make a random string of the same length +: initial-string \ s -- s + s:len "" swap + ' add-random-char + swap times ; + +: done? \ s1 s2 -- s1 s2 | bye + 2dup s:= if + "Done in " . gen @ . " generations" . cr ;;; + then ; + +: setup-random + rand rand rand-pcg-seed ; + +: evolve + 1 gen n:+! + \ create an array of #mutations strings mutated from the random string, drop the random + #mutations @ mutate + \ iterate over the array and pick the closest fit: + fitness-check + \ show this generation's best match: + dup . cr + \ check for end condition and continue if not done: + done? evolve ; + +"METHINKS IT IS LIKE A WEASEL" +setup-random initial-string evolve bye diff --git a/Task/Evolutionary-algorithm/Ceylon/evolutionary-algorithm.ceylon b/Task/Evolutionary-algorithm/Ceylon/evolutionary-algorithm.ceylon new file mode 100644 index 0000000000..2c501ca07d --- /dev/null +++ b/Task/Evolutionary-algorithm/Ceylon/evolutionary-algorithm.ceylon @@ -0,0 +1,49 @@ +import ceylon.random { + + DefaultRandom +} + +shared void run() { + + value mutationRate = 0.05; + value childrenPerGeneration = 100; + value target = "METHINKS IT IS LIKE A WEASEL"; + value alphabet = {' ', *('A'..'Z')}; + value random = DefaultRandom(); + + value randomLetter => random.nextElement(alphabet); + + function fitness(String a, String b) => + count {for([c1, c2] in zipPairs(a, b)) c1 == c2}; + + function mutate(String string) => + String { + for(letter in string) + if(random.nextFloat() < mutationRate) + then randomLetter + else letter + }; + + function makeCopies(String string) => + {for(i in 1..childrenPerGeneration) mutate(string)}; + + function chooseFittest(String+ children) => + children + .map((String element) => element->fitness(element, target)) + .max(increasingItem) + .key; + + variable value parent = String {for(i in 1..target.size) randomLetter}; + variable value generationCount = 0; + function display() => print("``generationCount``: ``parent``"); + + display(); + while(parent != target) { + parent = chooseFittest(parent, *makeCopies(parent)); + generationCount++; + display(); + } + + print("mutated into target in ``generationCount`` generations!"); + +} diff --git a/Task/Evolutionary-algorithm/EchoLisp/evolutionary-algorithm.echolisp b/Task/Evolutionary-algorithm/EchoLisp/evolutionary-algorithm.echolisp new file mode 100644 index 0000000000..33ebb8503a --- /dev/null +++ b/Task/Evolutionary-algorithm/EchoLisp/evolutionary-algorithm.echolisp @@ -0,0 +1,38 @@ +(require 'sequences) +(define ALPHABET (list->vector ["A" .. "Z"] )) +(vector-push ALPHABET " ") + +(define (fitness source target) ;; score >=0, best is 0 + (for/sum [(s source)(t target)] + (if (= s t) 0 1))) + +(define (mutate source rate) + (for/string [(s source)] + (if (< (random) rate) [ALPHABET (random 27)] s))) + +(define (select parent target rate copies (copy) (score)) + (define best (fitness parent target)) + (define selected parent) + (for [(i copies)] + (set! copy (mutate parent rate)) + (set! score (fitness copy target)) + (when (< score best) + (set! selected copy) + (set! best score))) + selected ) + +(define MUTATION_RATE 0.05) ;; 5% chances to change +(define COPIES 100) +(define TARGET "METHINKS IT IS LIKE A WEASEL") + +(define (task (rate MUTATION_RATE) (copies COPIES) (target TARGET) (score)) + (define parent ;; random source + (for/string + [(i (string-length target))] [ALPHABET (random 27)])) + + (for [(i (in-naturals))] + (set! score (fitness parent target)) + (writeln i parent 'score score) + #:break (zero? score) + (set! parent (select parent target rate copies)) + )) diff --git a/Task/Evolutionary-algorithm/Nim/evolutionary-algorithm.nim b/Task/Evolutionary-algorithm/Nim/evolutionary-algorithm.nim new file mode 100644 index 0000000000..cb0e20bda6 --- /dev/null +++ b/Task/Evolutionary-algorithm/Nim/evolutionary-algorithm.nim @@ -0,0 +1,34 @@ +import math, os +randomize() + +const + target = "METHINKS IT IS LIKE A WEASEL" + alphabet = " ABCDEFGHIJLKLMNOPQRSTUVWXYZ" + p = 0.05 + c = 100 + +proc random(a: string): char = a[random(a.low..a.len)] + +proc negFitness(trial): int = + for i in 0 .. parent + + 1 while ( parent target <> ) [ + ListBuffer init(C, #[ parent mutate ]) dup add(parent) + maxFor(#[ target fitness ]) dup ->parent . dup println 1+ + ] drop ; diff --git a/Task/Evolutionary-algorithm/Phix/evolutionary-algorithm.phix b/Task/Evolutionary-algorithm/Phix/evolutionary-algorithm.phix new file mode 100644 index 0000000000..152b95551b --- /dev/null +++ b/Task/Evolutionary-algorithm/Phix/evolutionary-algorithm.phix @@ -0,0 +1,36 @@ +constant target = "METHINKS IT IS LIKE A WEASEL", + AZS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ ", + C = 5000, -- children in each generation + P = 15 -- probability of mutation (1 in 15) + +function fitness(string sample, string target) + return sum(sq_eq(sample,target)) +end function + +function mutate(string s, integer n) + for i=1 to length(s) do + if rand(n)=1 then + s[i] = AZS[rand(length(AZS))] + end if + end for + return s +end function + +string parent = mutate(target,1) -- (mutate with 100% probability) +sequence samples = repeat(0,C) +integer gen = 0, best, fit, best_fit = fitness(parent,target) +while parent!=target do + printf(1,"Generation%3d: %s, fitness %3.2f%%\n", {gen, parent, (best_fit/length(target))*100}) + best_fit = -1 + for i=1 to C do + samples[i] = mutate(parent, P) + fit = fitness(samples[i], target) + if fit > best_fit then + best_fit = fit + best = i + end if + end for + parent = samples[best] + gen += 1 +end while +printf(1,"Finally, \"%s\"\n",{parent}) diff --git a/Task/Evolutionary-algorithm/Pony/evolutionary-algorithm-1.pony b/Task/Evolutionary-algorithm/Pony/evolutionary-algorithm-1.pony new file mode 100644 index 0000000000..ef45c5b88d --- /dev/null +++ b/Task/Evolutionary-algorithm/Pony/evolutionary-algorithm-1.pony @@ -0,0 +1,73 @@ +use "random" + +actor Main + let _env: Env + let _rand: MT = MT // Mersenne Twister + let _target: String = "METHINKS IT IS LIKE A WEASEL" + let _possibilities: String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ " + let _c: U16 = 100 // number of spawn per generation + let _min_mutate_rate: F64 = 0.09 + let _perfect_fitness: USize = _target.size() + var _parent: String = "" + + new create(env: Env) => + _env = env + _parent = mutate(_target, 1.0) + var iter: U64 = 0 + while not _target.eq(_parent) do + let rate: F64 = new_mutate_rate() + iter = iter + 1 + if (iter % 100) == 0 then + _env.out.write(iter.string() + ": " + _parent) + _env.out.write(", fitness: " + fitness(_parent).string()) + _env.out.print(", rate: " + rate.string()) + end + var best_spawn = "" + var best_fit: USize = 0 + var i: U16 = 0 + while i < _c do + let spawn = mutate(_parent, rate) + let spawn_fitness = fitness(spawn) + if spawn_fitness > best_fit then + best_spawn = spawn + best_fit = spawn_fitness + end + i = i + 1 + end + if best_fit > fitness(_parent) then + _parent = best_spawn + end + end + _env.out.print(_parent + ", " + iter.string()) + + fun fitness(trial: String): USize => + var ret_val: USize = 0 + var i: USize = 0 + while i < trial.size() do + try + if trial(i) == _target(i) then + ret_val = ret_val + 1 + end + end + i = i + 1 + end + ret_val + + fun new_mutate_rate(): F64 => + let perfect_fit = _perfect_fitness.f64() + ((perfect_fit - fitness(_parent).f64()) / perfect_fit) * (1.0 - _min_mutate_rate) + + fun ref mutate(parent: String box, rate: F64): String => + var ret_val = recover trn String end + for char in parent.values() do + let rnd_real: F64 = _rand.real() + if rnd_real <= rate then + let rnd_int: U64 = _rand.int(_possibilities.size().u64()) + try + ret_val.push(_possibilities(rnd_int.usize())) + end + else + ret_val.push(char) + end + end + consume ret_val diff --git a/Task/Evolutionary-algorithm/Pony/evolutionary-algorithm-2.pony b/Task/Evolutionary-algorithm/Pony/evolutionary-algorithm-2.pony new file mode 100644 index 0000000000..6b6f373b45 --- /dev/null +++ b/Task/Evolutionary-algorithm/Pony/evolutionary-algorithm-2.pony @@ -0,0 +1,115 @@ +use "random" +use "collections" + +class CreationFactory + let _desired: String + + new create(d: String) => + _desired = d + + fun apply(c: String): Creation => + Creation(c, _fitness(c)) + + fun _fitness(s: String): USize => + var f = USize(0) + for i in Range(0, s.size()) do + try + if s(i) == _desired(i) then + f = f +1 + end + end + end + f + +class val Creation + let string: String + let fitness: USize + + new val create(s: String = "", f: USize = 0) => + string = s + fitness = f + +class Mutator + embed _rand: MT = MT + let _possibilities: String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ " + let _cf: CreationFactory + + new create(cf: CreationFactory) => + _cf = cf + + fun ref apply(parent: Creation, rate: F64): Creation => + let ns = _new_string(parent.string, rate) + _cf(ns) + + fun ref _new_string(parent: String, rate: F64): String => + var mutated = recover String(parent.size()) end + for char in parent.values() do + mutated.push(_mutate_letter(char, rate)) + end + consume mutated + + fun ref _mutate_letter(current: U8, rate: F64): U8 => + if _rand.real() <= rate then + _random_letter() + else + current + end + + fun ref _random_letter(): U8 => + let ln = _rand.int(_possibilities.size().u64()).usize() + try _possibilities(ln) else ' ' end + +class Generation + let _size: USize + let _desired: Creation + let _mutator: Mutator + + new create(size: USize = 100, desired: Creation, mutator: Mutator) => + _size = size + _desired = desired + _mutator = consume mutator + + fun ref apply(parent: Creation): Creation => + var best = parent + let mutation_rate = _mutation_rate(best) + for i in Range(0, _size) do + let candidate = _mutator(best, mutation_rate) + if candidate.fitness > best.fitness then + best = candidate + end + end + best + + fun _mutation_rate(best: Creation): F64 => + let min_mutate_rate: F64 = 0.09 + + let df = _desired.fitness.f64() + let bf = best.fitness.f64() + + ((df - bf) / df) * (1.0 - min_mutate_rate) + +actor Main + new create(env: Env) => + let d = "METHINKS IT IS LIKE A WEASEL" + let cf = CreationFactory(d) + let desired = cf(d) + let mutator = Mutator(cf) + let start = mutator(desired, 1.0) + let spawn_per_generation = USize(100) + + var iterations = U64(0) + var best = start + + repeat + best = Generation(spawn_per_generation, desired, mutator)(best) + + iterations = iterations + 1 + if (iterations % 100) == 0 then + env.out.print( + iterations.string() + ": " + + best.string + ", fitness: " + best.fitness.string() + ) + end + until best.string == desired.string end + + env.out.print(best.string + ", " + iterations.string()) diff --git a/Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-1.sequencel b/Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-1.sequencel new file mode 100644 index 0000000000..836c3aba77 --- /dev/null +++ b/Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-1.sequencel @@ -0,0 +1,23 @@ +import ; + +AllowedChars := " ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + +initializeParent(randChars(1)) := AllowedChars[randChars]; + +Fitness(target(1), current(1)) := + let + fit[i] := true when target[i] = current[i]; + in + size(fit); + +Mutate(letter(0), rate(0), randRate(0), randChar(0)) := + letter when randRate > rate + else + AllowedChars[randChar]; + +evolve(target(1), parent(1), C(0), P(0), rateRands(2), charRands(2)) := + let + mutations[i] := Mutate(parent, P, rateRands[i], charRands[i]) foreach i within 1 ... C; + fitnesses := Fitness(target, mutations); + in + mutations[firstIndexOf(fitnesses, vectorMax(fitnesses))]; diff --git a/Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-2.sequencel b/Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-2.sequencel new file mode 100644 index 0000000000..3dc141f523 --- /dev/null +++ b/Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-2.sequencel @@ -0,0 +1,50 @@ +#include +#include +#include "SL_Generated.h" + +using namespace std; + +int main(int argc, char** argv) +{ + int threads = 0; + + char* targetString = "METHINKS IT IS LIKE A WEASEL"; + if(argc > 1) targetString = argv[1]; + int C = 100; + if(argc > 2) C = atoi(argv[2]); + SL_FLOAT P = 0.05; + if(argc > 3) P = atof(argv[3]); + int seed = time(NULL); + if(argc > 4) seed = atoi(argv[4]); + + int targetDims[] = {strlen(targetString), 0}; + Sequence target((void*)targetString, targetDims); + + sl_init(threads); + + Sequence parent; + Sequence newParent; + Sequence parentRands; + sl_create(seed++, 1, 27, target.size(), threads, parentRands); + sl_initializeParent(parentRands, threads, parent); + + Sequence< Sequence > charRands; + Sequence< Sequence > rateRands; + + cout << "Start:\t" << parent << endl; + for(int i = 1; !(parent == target); i++) + { + sl_create(seed++, 1, 27, C, target.size(), threads, charRands); + sl_create(seed++, 0.0, 1.0, C, target.size(), threads, rateRands); + + sl_evolve(target, parent, C, P, rateRands, charRands, threads, newParent); + parent = newParent; + + cout << "#" << i << ":\t" << parent << endl; + } + cout << "End:\t" << parent << endl; + + sl_done(); + + return 0; +} diff --git a/Task/Evolutionary-algorithm/Sidef/evolutionary-algorithm.sidef b/Task/Evolutionary-algorithm/Sidef/evolutionary-algorithm.sidef new file mode 100644 index 0000000000..1dc5d0f6f7 --- /dev/null +++ b/Task/Evolutionary-algorithm/Sidef/evolutionary-algorithm.sidef @@ -0,0 +1,13 @@ +define target = "METHINKS IT IS LIKE A WEASEL" +define mutate_chance = 0.08 +define alphabet = [('A'..'Z')..., ' '] +define C = 100 + +func fitness(str) { str.chars ~Z== target.chars -> count(true) } +func mutate(str) { str.gsub(/(.)/, {|s1| 1.rand < mutate_chance ? alphabet.pick : s1 }) } + +for ( + var (i, parent) = (0, alphabet.rand(target.len).join); + parent != target; + parent = C.of{ mutate(parent) }.max_by(fitness) +) { printf("%6d: '%s'\n", i++, parent) } diff --git a/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/EchoLisp/exceptions-catch-an-exception-thrown-in-a-nested-call.echolisp b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/EchoLisp/exceptions-catch-an-exception-thrown-in-a-nested-call.echolisp new file mode 100644 index 0000000000..11384b5211 --- /dev/null +++ b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/EchoLisp/exceptions-catch-an-exception-thrown-in-a-nested-call.echolisp @@ -0,0 +1,21 @@ +(define (foo) + (for ((i 2)) + (try + (bar i) + (catch (id message) + (if (= id 'U0) + (writeln message 'catched) + (error id "not catched")))))) + +(define (bar i) + (baz i)) + +(define (baz i) + (if (= i 0) + (throw 'U0 "U0 raised") + (throw 'U1 "U1 raised"))) + + +(foo) → + "U0 raised" catched + 👓 error: U1 not catched diff --git a/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/FreeBASIC/exceptions-catch-an-exception-thrown-in-a-nested-call.freebasic b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/FreeBASIC/exceptions-catch-an-exception-thrown-in-a-nested-call.freebasic new file mode 100644 index 0000000000..6679c06480 --- /dev/null +++ b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/FreeBASIC/exceptions-catch-an-exception-thrown-in-a-nested-call.freebasic @@ -0,0 +1,48 @@ +' FB 1.05.0 Win64 + +Enum ErrorTypes + U0 = 1000 + U1 +End Enum + +Function errorName(ex As ErrorTypes) As String + Select Case As Const ex + Case U0 + Return "U0" + Case U1 + Return "U1" + End Select +End Function + +Sub catchError(ex As ErrorTypes) + Dim e As Integer = Err '' cache the error number + If e = ex Then + Print "Error "; errorName(ex); ", number"; ex; " caught" + End If +End Sub + +Sub baz() + Static As Integer timesCalled = 0 '' persisted between procedure calls + timesCalled += 1 + If timesCalled = 1 Then + err = U0 + Else + err = U1 + End if +End Sub + +Sub bar() + baz +End Sub + +Sub foo() + bar + catchError(U0) '' not interested in U1, assumed non-fatal + bar + catchError(U0) +End Sub + +Foo +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Lasso/exceptions-catch-an-exception-thrown-in-a-nested-call.lasso b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Lasso/exceptions-catch-an-exception-thrown-in-a-nested-call.lasso new file mode 100644 index 0000000000..f54b6894f6 --- /dev/null +++ b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Lasso/exceptions-catch-an-exception-thrown-in-a-nested-call.lasso @@ -0,0 +1,40 @@ +define try(exception) => { + local( + gb = givenblock, + error + ) + handle => { + // Only relay error if it's not the specified exception + if(#error) => { + if(#error->get(2) == #exception) => { + stdoutnl('Handled exception: '+#error->get(2)) + else + stdoutnl('Throwing exception: '+#error->get(2)) + fail(:#error) + } + } + } + protect => { + handle_error => { + #error = (:error_code,error_msg,error_stack) + } + #gb() + } +} + +define foo => { + stdoutnl('foo') + try('U0') => { bar } + try('U0') => { bar } +} + +define bar => { + stdoutnl('- bar') + baz() +} + +define baz => { + stdoutnl(' - baz') + var(bazzed) ? fail('U1') | $bazzed = true + fail('U0') +} diff --git a/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Nim/exceptions-catch-an-exception-thrown-in-a-nested-call.nim b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Nim/exceptions-catch-an-exception-thrown-in-a-nested-call.nim new file mode 100644 index 0000000000..65f09cca0f --- /dev/null +++ b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Nim/exceptions-catch-an-exception-thrown-in-a-nested-call.nim @@ -0,0 +1,18 @@ +type U0 = object of Exception +type U1 = object of Exception + +proc baz(i) = + if i > 0: raise newException(U1, "Some error") + else: raise newException(U0, "Another error") + +proc bar(i) = + baz(i) + +proc foo() = + for i in 0..1: + try: + bar(i) + except U0: + echo "Function foo caught exception U0" + +foo() diff --git a/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Oforth/exceptions-catch-an-exception-thrown-in-a-nested-call.oforth b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Oforth/exceptions-catch-an-exception-thrown-in-a-nested-call.oforth new file mode 100644 index 0000000000..e68275be94 --- /dev/null +++ b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Oforth/exceptions-catch-an-exception-thrown-in-a-nested-call.oforth @@ -0,0 +1,11 @@ +Exception Class new: U0 +Exception Class new: U1 + +: baz ifZero: [ "First call" U0 throw ] else: [ "Second call" U1 throw ] ; +: bar baz ; + +: foo +| e | + try: e [ 0 bar ] when: [ e isKindOf(U0) ifTrue: [ "Catched" .cr ] else: [ e throw ] ] + try: e [ 1 bar ] when: [ e isKindOf(U0) ifTrue: [ "Catched" .cr ] else: [ e throw ] ] + "Done" . ; diff --git a/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Sidef/exceptions-catch-an-exception-thrown-in-a-nested-call.sidef b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Sidef/exceptions-catch-an-exception-thrown-in-a-nested-call.sidef new file mode 100644 index 0000000000..83f8798685 --- /dev/null +++ b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Sidef/exceptions-catch-an-exception-thrown-in-a-nested-call.sidef @@ -0,0 +1,14 @@ +func baz(i) { die "U#{i}" }; +func bar(i) { baz(i) }; + +func foo { + [0, 1].each { |i| + try { bar(i) } + catch { |_, msg| + msg ~~ /^U0/ ? say "Function foo() caught exception U0" + : die msg; # re-raise the exception + }; + } +} + +foo(); diff --git a/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Swift/exceptions-catch-an-exception-thrown-in-a-nested-call.swift b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Swift/exceptions-catch-an-exception-thrown-in-a-nested-call.swift new file mode 100644 index 0000000000..3771aeb852 --- /dev/null +++ b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Swift/exceptions-catch-an-exception-thrown-in-a-nested-call.swift @@ -0,0 +1,28 @@ +enum MyException : ErrorType { + case U0 + case U1 +} + +func foo() throws { + for i in 0 ... 1 { + do { + try bar(i) + } catch MyException.U0 { + print("Function foo caught exception U0") + } + } +} + +func bar(i: Int) throws { + try baz(i) // Nest those calls +} + +func baz(i: Int) throws { + if i == 0 { + throw MyException.U0 + } else { + throw MyException.U1 + } +} + +try foo() diff --git a/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/jq/exceptions-catch-an-exception-thrown-in-a-nested-call.jq b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/jq/exceptions-catch-an-exception-thrown-in-a-nested-call.jq new file mode 100644 index 0000000000..7bb6946f09 --- /dev/null +++ b/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/jq/exceptions-catch-an-exception-thrown-in-a-nested-call.jq @@ -0,0 +1,14 @@ +# n is assumed to be the number of times baz has been previously called: +def baz(n): + if n==0 then error("U0") + elif n==1 then error("U1") + else "Goodbye" + end; + +def bar(n): baz(n); + +def foo: + (try bar(0) catch if . == "U0" then "We caught U0" else error(.) end), + (try bar(1) catch if . == "U0" then "We caught U0" else error(.) end); + +foo diff --git a/Task/Exceptions/FreeBASIC/exceptions.freebasic b/Task/Exceptions/FreeBASIC/exceptions.freebasic new file mode 100644 index 0000000000..6b95b99737 --- /dev/null +++ b/Task/Exceptions/FreeBASIC/exceptions.freebasic @@ -0,0 +1,30 @@ +' FB 1.05.0 Win64 + +Enum ErrorType + myError = 1000 +End Enum + +Sub foo() + Err = 1000 ' raise a user-defined error +End Sub + +Sub callFoo() + foo() + Dim As Long errNo = Err ' cache Err in case it's reset by a different function + Select Case errNo + Case 0 + ' No error (system defined) + Case 1 To 17 + ' System defined runtime errors + Case myError: ' catch myError + Print "Caught myError : Error number"; errNo + Case Else + ' catch any other type of errors here + End Select + ' add any clean-up code here +End Sub + +callfoo() +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Exceptions/Lasso/exceptions.lasso b/Task/Exceptions/Lasso/exceptions.lasso new file mode 100644 index 0000000000..ba151708a4 --- /dev/null +++ b/Task/Exceptions/Lasso/exceptions.lasso @@ -0,0 +1,6 @@ +protect => { + handle_error => { + // do something else + } + fail(-1,'Oops') +} diff --git a/Task/Exceptions/Lingo/exceptions-1.lingo b/Task/Exceptions/Lingo/exceptions-1.lingo new file mode 100644 index 0000000000..7c773dd4e2 --- /dev/null +++ b/Task/Exceptions/Lingo/exceptions-1.lingo @@ -0,0 +1,19 @@ +-- parent script "ErrorHandler" + +on alertHook (me, errorType, errorMessage, alertType) + if alertType=#alert then return 0 -- ignore programmatic alerts + + -- log error in file "error.log" + fn = _movie.path&"error.log" + fp = xtra("fileIO").new() + fp.openFile(fn, 2) + if fp.status() = -37 then + fp.createFile(fn) + fp.openFile(fn, 2) + end if + fp.setPosition(fp.getLength()) + fp.writeString(_system.date() && _system.time() && errorType & ": " & errorMessage & RETURN) + fp.closeFile() + + return 1 -- continues movie playback, no error dialog +end diff --git a/Task/Exceptions/Lingo/exceptions-2.lingo b/Task/Exceptions/Lingo/exceptions-2.lingo new file mode 100644 index 0000000000..5d53fd7cdb --- /dev/null +++ b/Task/Exceptions/Lingo/exceptions-2.lingo @@ -0,0 +1,4 @@ +-- in a movie script +on prepareMovie + _player.alertHook = script("ErrorHandler") +end diff --git a/Task/Exceptions/Lingo/exceptions-3.lingo b/Task/Exceptions/Lingo/exceptions-3.lingo new file mode 100644 index 0000000000..d3f7f5f66b --- /dev/null +++ b/Task/Exceptions/Lingo/exceptions-3.lingo @@ -0,0 +1,6 @@ +-- in a movie script +-- usage: throw("Custom error 23") +on throw (msg) + _player.alertHook.alertHook("Script runtime error", msg, #script) + abort() -- exits call stack +end diff --git a/Task/Exceptions/Nim/exceptions-1.nim b/Task/Exceptions/Nim/exceptions-1.nim new file mode 100644 index 0000000000..27060ea87b --- /dev/null +++ b/Task/Exceptions/Nim/exceptions-1.nim @@ -0,0 +1 @@ +type SillyError = object of Exception diff --git a/Task/Exceptions/Nim/exceptions-2.nim b/Task/Exceptions/Nim/exceptions-2.nim new file mode 100644 index 0000000000..6fc678cee6 --- /dev/null +++ b/Task/Exceptions/Nim/exceptions-2.nim @@ -0,0 +1,2 @@ +proc spam() = + raise newException(SillyError, "Some error") diff --git a/Task/Exceptions/Nim/exceptions-3.nim b/Task/Exceptions/Nim/exceptions-3.nim new file mode 100644 index 0000000000..0838919928 --- /dev/null +++ b/Task/Exceptions/Nim/exceptions-3.nim @@ -0,0 +1,8 @@ +try: + spam() +except SillyError: + echo "Got SillyError with message: ", getCurrentExceptionMsg() +except: + echo "Got another exception" +finally: + echo "Finally" diff --git a/Task/Exceptions/Oforth/exceptions.oforth b/Task/Exceptions/Oforth/exceptions.oforth new file mode 100644 index 0000000000..0b37805a00 --- /dev/null +++ b/Task/Exceptions/Oforth/exceptions.oforth @@ -0,0 +1,7 @@ +: iwillThrowAnException "A new exception" Exception throw ; + +: iwillCatch +| e | + try: e [ iwillThrowAnException ] when: [ "Exception catched :" . e .cr ] + try: e [ 1 2 over last ] when: [ "Exception catched :" . e .cr ] + "Done" println ; diff --git a/Task/Exceptions/PHL/exceptions.phl b/Task/Exceptions/PHL/exceptions.phl new file mode 100644 index 0000000000..faf910b6a3 --- /dev/null +++ b/Task/Exceptions/PHL/exceptions.phl @@ -0,0 +1,23 @@ +module exceptions; + +extern printf; + +struct @MyException : @Exception { + +}; + +@Void func throws ex [ + throw new @MyException; +] + +@Integer main [ + try func(); + catch (e) { + if (e::getType == "MyException") { + printf("MyException thrown!\n"); + } else { + printf("Unhandled exception!\n"); + } + } + return 0; +] diff --git a/Task/Exceptions/Ring/exceptions.ring b/Task/Exceptions/Ring/exceptions.ring new file mode 100644 index 0000000000..1b22f39bfa --- /dev/null +++ b/Task/Exceptions/Ring/exceptions.ring @@ -0,0 +1,5 @@ +Try + see 1/0 +Catch + raise("Sorry we can't divide 1/0 + nl) +Done diff --git a/Task/Exceptions/Sidef/exceptions.sidef b/Task/Exceptions/Sidef/exceptions.sidef new file mode 100644 index 0000000000..1d17620d81 --- /dev/null +++ b/Task/Exceptions/Sidef/exceptions.sidef @@ -0,0 +1,11 @@ +try { + die "I'm dead!"; # throws an exception of type 'error' +} +catch { |type, msg| + say "type: #{type}"; # type: error + say "msg: #{msg}"; # msg: I'm dead! at test.sf line 2. +}; + +say "I'm alive..."; +die "Now I'm dead!"; # this line terminates the program +say "Or am I?"; # Yes, you are! diff --git a/Task/Exceptions/Swift/exceptions-1.swift b/Task/Exceptions/Swift/exceptions-1.swift new file mode 100644 index 0000000000..a8e31ab5ef --- /dev/null +++ b/Task/Exceptions/Swift/exceptions-1.swift @@ -0,0 +1,3 @@ +enum MyException : ErrorType { + case TerribleException +} diff --git a/Task/Exceptions/Swift/exceptions-2.swift b/Task/Exceptions/Swift/exceptions-2.swift new file mode 100644 index 0000000000..59619a0bda --- /dev/null +++ b/Task/Exceptions/Swift/exceptions-2.swift @@ -0,0 +1,3 @@ +func foo() throws { + throw MyException.TerribleException +} diff --git a/Task/Exceptions/Swift/exceptions-3.swift b/Task/Exceptions/Swift/exceptions-3.swift new file mode 100644 index 0000000000..5217187872 --- /dev/null +++ b/Task/Exceptions/Swift/exceptions-3.swift @@ -0,0 +1,7 @@ +do { + try foo() +} catch MyException.TerribleException { // this can be any pattern + //Catch a specific case of exception +} catch { + //Catch any exception +} diff --git a/Task/Exceptions/Ursa/exceptions-1.ursa b/Task/Exceptions/Ursa/exceptions-1.ursa new file mode 100644 index 0000000000..a0ac1f2bdd --- /dev/null +++ b/Task/Exceptions/Ursa/exceptions-1.ursa @@ -0,0 +1,6 @@ +try + invalid "this statement will fail" +catch syntaxerror + # console.err is optional here + out "caught an exception" endl console.err +end try diff --git a/Task/Exceptions/Ursa/exceptions-2.ursa b/Task/Exceptions/Ursa/exceptions-2.ursa new file mode 100644 index 0000000000..7e06fa4488 --- /dev/null +++ b/Task/Exceptions/Ursa/exceptions-2.ursa @@ -0,0 +1 @@ +throw (new ursa.exceptions.exception) diff --git a/Task/Exceptions/jq/exceptions-1.jq b/Task/Exceptions/jq/exceptions-1.jq new file mode 100644 index 0000000000..519c9f248a --- /dev/null +++ b/Task/Exceptions/jq/exceptions-1.jq @@ -0,0 +1 @@ +try FILTER catch CATCHER diff --git a/Task/Exceptions/jq/exceptions-2.jq b/Task/Exceptions/jq/exceptions-2.jq new file mode 100644 index 0000000000..e13b7d3957 --- /dev/null +++ b/Task/Exceptions/jq/exceptions-2.jq @@ -0,0 +1,14 @@ +def division(a;b): + def abs: if . < 0 then -. else . end; + if a == 0 and b == 0 then error("0/0") + elif b == 0 then error("division by 0") + elif (a|abs|log) - (b|abs|log) > 700 then error("OOB") + else a/b + end; + +def test(a;b): + try division(a;b) + catch if . == "0/0" then 0 + elif . == "division by 0" then null + else "\(.): \(a) / \(b)" + end; diff --git a/Task/Executable-library/Nim/executable-library-1.nim b/Task/Executable-library/Nim/executable-library-1.nim new file mode 100644 index 0000000000..ac4cce38f2 --- /dev/null +++ b/Task/Executable-library/Nim/executable-library-1.nim @@ -0,0 +1,20 @@ +proc hailstone*(n): auto = + result = @[n] + var n = n + while n > 1: + if (n and 1) == 1: + n = 3 * n + 1 + else: + n = n div 2 + result.add n + +when isMainModule: + let h = hailstone 27 + assert h.len == 112 and h[0..3] == @[27,82,41,124] and h[h.high-3..h.high] == @[8,4,2,1] + var m, mi = 0 + for i in 1 .. <100_000: + let n = hailstone(i).len + if n > m: + m = n + mi = i + echo "Maximum length ", m, " was found for hailstone(", mi, ") for numbers <100,000" diff --git a/Task/Executable-library/Nim/executable-library-2.nim b/Task/Executable-library/Nim/executable-library-2.nim new file mode 100644 index 0000000000..f6b36f0e4e --- /dev/null +++ b/Task/Executable-library/Nim/executable-library-2.nim @@ -0,0 +1,10 @@ +import hailstone, tables + +var t = initCountTable[int]() + +for i in 1 .. <100_000: + t.inc(hailstone(i).len) + +let (val, cnt) = t.largest() +echo "The length of hailstone sequence that is most common for" +echo "hailstone(n) where 1<=n<100000, is ", val, ". It occurs ", cnt, " times." diff --git a/Task/Executable-library/Sidef/executable-library-1.sidef b/Task/Executable-library/Sidef/executable-library-1.sidef new file mode 100644 index 0000000000..9fc471fa73 --- /dev/null +++ b/Task/Executable-library/Sidef/executable-library-1.sidef @@ -0,0 +1,26 @@ +func hailstone(n) { + gather { + while (n > 1) { + take(n) + n = (n.is_even ? n/2 : (3*n + 1)) + } + take(1) + } +} +  +if (__FILE__ == __MAIN__) { # true when not imported + var seq = hailstone(27) + say "hailstone(27) - #{seq.len} elements: #{seq.ft(0, 3)} [...] #{seq.ft(-4)}" +  + var n = 0 + var max = 0 + 100_000.times { |i| + var seq = hailstone(i) + if (seq.len > max) { + max = seq.len + n = i + } + } +  + say "Longest sequence is for #{n}: #{max}" +} diff --git a/Task/Executable-library/Sidef/executable-library-2.sidef b/Task/Executable-library/Sidef/executable-library-2.sidef new file mode 100644 index 0000000000..f95d98daca --- /dev/null +++ b/Task/Executable-library/Sidef/executable-library-2.sidef @@ -0,0 +1 @@ +$ sidef Hailstone.sm diff --git a/Task/Executable-library/Sidef/executable-library-3.sidef b/Task/Executable-library/Sidef/executable-library-3.sidef new file mode 100644 index 0000000000..517e887e0c --- /dev/null +++ b/Task/Executable-library/Sidef/executable-library-3.sidef @@ -0,0 +1,7 @@ +include Hailstone +  +var score = Hash() +100_000.times { |i| score{ Hailstone::hailstone(i).len } := 0 ++ } +  +var k = score.keys.max_by {|k| score{k} } +say "Most common length is #{k}, occurring #{score{k}} times" diff --git a/Task/Executable-library/Sidef/executable-library-4.sidef b/Task/Executable-library/Sidef/executable-library-4.sidef new file mode 100644 index 0000000000..0c0b565bfe --- /dev/null +++ b/Task/Executable-library/Sidef/executable-library-4.sidef @@ -0,0 +1 @@ +$ sidef test_hailstone.sf diff --git a/Task/Execute-Brain----/Axe/execute-brain-----1.axe b/Task/Execute-Brain----/Axe/execute-brain-----1.axe new file mode 100644 index 0000000000..8a96ac200d --- /dev/null +++ b/Task/Execute-Brain----/Axe/execute-brain-----1.axe @@ -0,0 +1,57 @@ +Lbl BF +r₁→P +r₂→I +L₁→D +Fill(D,768,0) + +While {P} + {P}→C + If C='+' + {D}++ + ElseIf C='-' + {D}-- + ElseIf C='>' + D++ + ElseIf C='<' + D-- + ElseIf C='.' + Disp {D}▶Char + ElseIf C=',' + {I}→{D} + I++ + ElseIf C='['?{D}=0 + NEXT(P)→P + ElseIf C=']' + PREV(P)→P + End + P++ +End +Return + +Lbl NEXT +r₁++ +1→S +While S + If {r₁}='[' + S++ + ElseIf {r₁}=']' + S-- + End + r₁++ +End +r₁ +Return + +Lbl PREV +r₁-- +1→S +While S + If {r₁}=']' + S++ + ElseIf {r₁}='[' + S-- + End + r₁-- +End +r₁ +Return diff --git a/Task/Execute-Brain----/Axe/execute-brain-----2.axe b/Task/Execute-Brain----/Axe/execute-brain-----2.axe new file mode 100644 index 0000000000..b1387716d5 --- /dev/null +++ b/Task/Execute-Brain----/Axe/execute-brain-----2.axe @@ -0,0 +1,2 @@ +"++++++++++++++++++++++++++++++++[>+>+<<-]>>+++++++++++++++++++++++++<<++++++++++[>>.-<.<-]"→Str1 +BF(Str1,0) diff --git a/Task/Execute-Brain----/Nim/execute-brain----.nim b/Task/Execute-Brain----/Nim/execute-brain----.nim new file mode 100644 index 0000000000..193507fd65 --- /dev/null +++ b/Task/Execute-Brain----/Nim/execute-brain----.nim @@ -0,0 +1,32 @@ +import os + +var + code = if paramCount() > 0: readFile paramStr 1 + else: readAll stdin + tape = newSeq[char]() + d = 0 + i = 0 + +proc run(skip = false): bool = + while d >= 0 and i < code.len: + if d >= tape.len: tape.add '\0' + + if code[i] == '[': + inc i + let p = i + while run(tape[d] == '\0'): i = p + elif code[i] == ']': + return tape[d] != '\0' + elif not skip: + case code[i] + of '+': inc tape[d] + of '-': dec tape[d] + of '>': inc d + of '<': dec d + of '.': stdout.write tape[d] + of ',': tape[d] = stdin.readChar + else: discard + + inc i + +discard run() diff --git a/Task/Execute-Brain----/Phix/execute-brain----.phix b/Task/Execute-Brain----/Phix/execute-brain----.phix new file mode 100644 index 0000000000..9b793b1113 --- /dev/null +++ b/Task/Execute-Brain----/Phix/execute-brain----.phix @@ -0,0 +1,52 @@ +procedure bfi(string pgm) +sequence jumptable = repeat(0,length(pgm)), + loopstack = {}, + data = repeat(0,10) -- size?? +integer skip = 0, ch, loopstart, pc, dp + -- + -- compile (pack/strip comments and link jumps) + -- + for i=1 to length(pgm) do + ch = pgm[i] + switch ch do + case '[': loopstack = append(loopstack,i-skip); + pgm[i-skip] = ch; + case ']': loopstart = loopstack[$]; + loopstack = loopstack[1..-2]; + jumptable[i-skip] = loopstart; + jumptable[loopstart] = i-skip; + fallthrough + case '+','-','<','>',',','.': pgm[i-skip] = ch; + default: skip += 1 + end switch + end for + if length(loopstack) then ?9/0 end if + pgm = pgm[1..-1-skip] + + -- + -- main execution loop + -- + pc = 1 + dp = 1 + while pc<=length(pgm) do + ch = pgm[pc] + switch ch do + case '>': dp += 1 if dp>length(data) then dp = 1 end if + case '<': dp -= 1 if dp<1 then dp = length(data) end if + case '+': data[dp] += 1 + case '-': data[dp] -= 1 + case ',': data[dp] = getc(0) + case '.': puts(1,data[dp]) + case '[': if data[dp]=0 then pc = jumptable[pc] end if + case ']': if data[dp]!=0 then pc = jumptable[pc] end if + default: ?9/0 + end switch + pc += 1 + end while +end procedure + +constant bf="++++++++[>++++[>++>++++>+++>+<<<<-]>++>->+>>+[<]<-]>>.>>.+.<.>>.<<<++.>---------.>------.<----.++++++++.>>+.>++.+++." +constant fb="++++++++[>++++[>++>++++>+++>+<<<<-]>++>->+>>+[<]<-]>>.>>.+.<.>>.<<<+++.>---.>------.++++++++.<--.>>+.>++.+++.," + +bfi(bf) +bfi(fb) diff --git a/Task/Execute-Brain----/Potion/execute-brain-----1.potion b/Task/Execute-Brain----/Potion/execute-brain-----1.potion new file mode 100644 index 0000000000..127048e2c5 --- /dev/null +++ b/Task/Execute-Brain----/Potion/execute-brain-----1.potion @@ -0,0 +1,2 @@ +>++++++++[-<+++++++++>]<.>[][<-]>+>-[+]++>++>+++[>[->+++<<+++>]<<]>-----. +>->+++..+++.>-.<<+[>[+>+]>>]<--------------.>>.+++.------.--------.>+.>+. diff --git a/Task/Execute-Brain----/Potion/execute-brain-----2.potion b/Task/Execute-Brain----/Potion/execute-brain-----2.potion new file mode 100644 index 0000000000..2f27306253 --- /dev/null +++ b/Task/Execute-Brain----/Potion/execute-brain-----2.potion @@ -0,0 +1,20 @@ +# Where `code` is a string. +bf = (code) : + tape = (0) + tape_pos = 0 + brackets = () + i = -1 + while (++i < code length) : + if (code(i) == ">"): if (++tape_pos == tape length): tape append(0).. + elsif (code(i) == "<"): tape_pos--. + elsif (code(i) == "+"): tape(tape_pos) = tape(tape_pos) + 1. + elsif (code(i) == "-"): tape(tape_pos) = tape(tape_pos) - 1. + elsif (code(i) == "."): tape(tape_pos) chr print. + elsif (code(i) == ","): tape(tape_pos) = read at(0) ord. + elsif (code(i) == "["): brackets push(i). + elsif (code(i) == "]") : + if (tape(tape_pos) == 0): brackets pop. + else: i = brackets(-1). + . + . +. diff --git a/Task/Execute-Brain----/Sidef/execute-brain----.sidef b/Task/Execute-Brain----/Sidef/execute-brain----.sidef new file mode 100644 index 0000000000..415d98c7b6 --- /dev/null +++ b/Task/Execute-Brain----/Sidef/execute-brain----.sidef @@ -0,0 +1,48 @@ +define tape_length = 50_000; +define eof_val = -1; +define unbalanced_exit_code = 1; + +var cmd = 0; +var cell = 0; +var code = []; +var loops = []; +var tape = tape_length.of(0); + +func get_input { + static input_buffer = []; + input_buffer.len || (input_buffer = ((STDIN.readline \\ return eof_val).chomp.chars.map{.ord})); + input_buffer.shift \\ eof_val; +} + +func jump { + var depth = 0; + while (depth >= 0) { + ++cmd < code.len || Sys.exit(unbalanced_exit_code); + if (code[cmd] == '[') { + ++depth; + } + elsif (code[cmd] == ']') { + --depth; + } + } +} + +var commands = Hash.new( + '>' => { ++cell }, + '<' => { --cell }, + '+' => { ++tape[cell] }, + '-' => { --tape[cell] }, + '.' => { tape[cell].chr.print }, + ',' => { tape[cell] = get_input() }, + '[' => { tape[cell] ? loops.append(cmd) : jump() }, + ']' => { cmd = (loops.pop - 1) }, +); + +STDOUT.autoflush(1); +code = ARGF.slurp.chars.grep {|c| commands.exists(c)}; +var code_len = code.len; + +while (cmd < code_len) { + commands{code[cmd]}.run; + cmd++; +} diff --git a/Task/Execute-Brain----/Swift/execute-brain----.swift b/Task/Execute-Brain----/Swift/execute-brain----.swift new file mode 100644 index 0000000000..a651576a46 --- /dev/null +++ b/Task/Execute-Brain----/Swift/execute-brain----.swift @@ -0,0 +1,129 @@ +import Foundation + +let valids = [">", "<", "+", "-", ".", ",", "[", "]"] as Set +var ip = 0 +var dp = 0 +var data = [UInt8](count: 30_000, repeatedValue: 0) + +let input = Process.arguments + +if input.count != 2 { + fatalError("Need one input file") +} + +let infile: String! + +do { + infile = try String(contentsOfFile: input[1], encoding: NSUTF8StringEncoding) ?? "" +} catch let err { + infile = "" +} + +var program = "" + +// remove invalid chars +for c in infile.characters { + if valids.contains(c) { + program += String(c) + } +} + +let numChars = program.characters.count + +if numChars == 0 { + fatalError("Error reading file") +} + +func increaseInstructionPointer() { + ip += 1 +} + +func executeInstruction(ins: Character) { + switch ins { + case ">": + dp += 1 + increaseInstructionPointer() + case "<": + dp -= 1 + increaseInstructionPointer() + case "+": + data[dp] = data[dp] &+ 1 + increaseInstructionPointer() + case "-": + data[dp] = data[dp] &- 1 + increaseInstructionPointer() + case ".": + print(Character(UnicodeScalar(data[dp])), terminator: "") + increaseInstructionPointer() + case ",": + handleIn() + increaseInstructionPointer() + case "[": + handleOpenBracket() + case "]": + handleClosedBracket() + default: + fatalError("What") + } +} + +func handleIn() { + let input = NSFileHandle.fileHandleWithStandardInput() + let bytes = input.availableData.bytes + let buf = unsafeBitCast(UnsafeBufferPointer(start: bytes, count: 1), + UnsafeBufferPointer.self) + + data[dp] = buf[0] +} + +func handleOpenBracket() { + if data[dp] == 0 { + var i = 1 + + while i > 0 { + ip += 1 + let ins = program[program.startIndex.advancedBy(ip)] + + if ins == "[" { + i += 1 + } else if ins == "]" { + i -= 1 + } + } + } else { + increaseInstructionPointer() + } +} + +func handleClosedBracket() { + if data[dp] != 0 { + var i = 1 + + while i > 0 { + ip -= 1 + let ins = program[program.startIndex.advancedBy(ip)] + + if ins == "[" { + i -= 1 + } else if ins == "]" { + i += 1 + } + } + } else { + increaseInstructionPointer() + } +} + +func tick() { + let ins = program[program.startIndex.advancedBy(ip)] + + if valids.contains(ins) { + executeInstruction(ins) + } else { + increaseInstructionPointer() + } +} + +while ip != numChars { + tick() +} diff --git a/Task/Execute-HQ9+/Ceylon/execute-hq9+.ceylon b/Task/Execute-HQ9+/Ceylon/execute-hq9+.ceylon new file mode 100644 index 0000000000..c8b74720a1 --- /dev/null +++ b/Task/Execute-HQ9+/Ceylon/execute-hq9+.ceylon @@ -0,0 +1,38 @@ +shared void run() { + + void eval(String code) { + + variable value accumulator = 0; + + for(c in code.trimmed.lowercased) { + switch(c) + case('h') { + print("Hello, world!"); + } + case('q') { + print(code); + } + case('9') { + function bottles(Integer i) => + switch(i) + case(0) "No bottles" + case(1) "One bottle" + else "``i`` bottles"; + for(i in 99..1) { + print("``bottles(i)`` of beer on the wall, + ``bottles(i)`` of beer, + take one down and pass it around, + ``bottles(i - 1)`` of beer on the wall!"); + } + } + case('+') { + accumulator++; + } + else { + print("syntax error"); + } + } + } + + eval("hq9+"); +} diff --git a/Task/Execute-HQ9+/Nim/execute-hq9+.nim b/Task/Execute-HQ9+/Nim/execute-hq9+.nim new file mode 100644 index 0000000000..9be71c092c --- /dev/null +++ b/Task/Execute-HQ9+/Nim/execute-hq9+.nim @@ -0,0 +1,31 @@ +var program = "9hHqQ+" +var i = 0 + +proc bottle(n: int): string = + case n + of 0: + result = "No more bottles" + of 1: + result = "1 bottle" + else: + result = $n & " bottles" + +proc ninetyNineBottles = + for n in countdown(99, 1): + echo bottle(n), " bottle of beer on the wall" + echo bottle(n), " bottle of beer" + echo "Take one down, pass it around" + echo bottle(n - 1), " of beer on the wall" + +for token in items(program): + case token + of 'h', 'H': + echo("Hello, world!") + of 'q', 'Q': + echo(program) + of '9': + ninetyNineBottles() + of '+': + inc(i) + else: + echo("Unknown command: ", token) diff --git a/Task/Execute-HQ9+/Phix/execute-hq9+-1.phix b/Task/Execute-HQ9+/Phix/execute-hq9+-1.phix new file mode 100644 index 0000000000..4a105a8be6 --- /dev/null +++ b/Task/Execute-HQ9+/Phix/execute-hq9+-1.phix @@ -0,0 +1,32 @@ +constant ninetynine = 99 -- (set this to 9 for testing) + +function bottles(integer count) + if count=0 then return "no more bottles" + elsif count=1 then return "1 bottle" end if + if count=-1 then count = ninetynine end if + return sprintf("%d bottles",count) +end function + +function bob(integer count) + return bottles(count)&" of beer" +end function + +function up1(string bob) +-- Capitalise sentence start (needed just the once, "no more"=>"No more") + bob[1] = upper(bob[1]) + return bob +end function + +procedure ninetyninebottles() +string this = bob(ninetynine) +string that = "Take one down, pass it around,\n" + for i=ninetynine to 0 by -1 do + puts(1,up1(this)&" on the wall,\n") + puts(1,this&".\n") + if i=0 then that = "Go to the store, buy some more,\n" + elsif i=1 then that[6..8] = "it" end if + this = bob(i-1) + puts(1,that&this&" on the wall.\n\n") + end for +-- if getc(0) then end if +end procedure diff --git a/Task/Execute-HQ9+/Phix/execute-hq9+-2.phix b/Task/Execute-HQ9+/Phix/execute-hq9+-2.phix new file mode 100644 index 0000000000..87a3f10abb --- /dev/null +++ b/Task/Execute-HQ9+/Phix/execute-hq9+-2.phix @@ -0,0 +1,13 @@ +procedure hq9(string code) +integer accumulator = 0 + for i=1 to length(code) do + switch(upper(code[i])) + case 'H': printf(1,"Hello, world!\n") + case 'Q': printf(1,"%s\n", code); + case '9': ninetyninebottles() + case '+': accumulator += 1 + end switch + end for +end procedure + +hq9("hq9+HqQ+Qq") diff --git a/Task/Execute-HQ9+/Sidef/execute-hq9+-1.sidef b/Task/Execute-HQ9+/Sidef/execute-hq9+-1.sidef new file mode 100644 index 0000000000..4a1d8d5ee0 --- /dev/null +++ b/Task/Execute-HQ9+/Sidef/execute-hq9+-1.sidef @@ -0,0 +1,31 @@ +class HQ9Interpreter { + has pointer; + has accumulator; + + func bob (beer) { + func what { "#{beer ? beer : 'No more'} bottle#{beer-1 ? 's' : ''} of beer" } + func where { 'on the wall' } + func drink { beer--; "Take one down, pass it around," } + + while (beer.is_pos) { + [[what(), where()], [what()], + [drink()], [what(), where()], []].each{.join(' ').say} + } + } + + method run (code) { + var chars = code.chars; + accumulator = 0; + pointer = 0; + while (pointer < chars.len) { + given (chars[pointer].lc) { + when ('h') { say 'Hello world!' } + when ('q') { say code } + when ('9') { bob(99) } + when ('+') { accumulator++ } + default { warn %Q(Syntax error: Unknown command "#{chars[pointer]}") } + } + pointer++; + } + } +} diff --git a/Task/Execute-HQ9+/Sidef/execute-hq9+-2.sidef b/Task/Execute-HQ9+/Sidef/execute-hq9+-2.sidef new file mode 100644 index 0000000000..41a3f41613 --- /dev/null +++ b/Task/Execute-HQ9+/Sidef/execute-hq9+-2.sidef @@ -0,0 +1,2 @@ +var hq9 = HQ9Interpreter(); +hq9.run("hHq+++Qq"); diff --git a/Task/Execute-HQ9+/Sidef/execute-hq9+-3.sidef b/Task/Execute-HQ9+/Sidef/execute-hq9+-3.sidef new file mode 100644 index 0000000000..86ce6f1ff7 --- /dev/null +++ b/Task/Execute-HQ9+/Sidef/execute-hq9+-3.sidef @@ -0,0 +1,5 @@ +var hq9 = HQ9Interpreter(); +loop { + var in = read('HQ9+>', String) \\ break; + hq9.run(in) +} diff --git a/Task/Execute-a-Markov-algorithm/EchoLisp/execute-a-markov-algorithm.echolisp b/Task/Execute-a-Markov-algorithm/EchoLisp/execute-a-markov-algorithm.echolisp new file mode 100644 index 0000000000..b98a491dae --- /dev/null +++ b/Task/Execute-a-Markov-algorithm/EchoLisp/execute-a-markov-algorithm.echolisp @@ -0,0 +1,33 @@ +;; rule := (pattern replacement [#t terminal]) + +(define-syntax-rule (pattern rule) (first rule)) +(define-syntax-rule (repl sule) (second rule)) +(define-syntax-rule (term? rule) (!empty? (cddr rule))) + +;; (alpha .beta )--> (alpha beta #t) +(define (term-rule rule) + (if (string=? (string-first (repl rule)) ".") + (list (pattern rule) (string-rest (repl rule)) #t) + rule )) + +;; returns list of rules +(define (parse-rules lines) + (map term-rule + (for/list [(line (string-split lines "\n"))] + #:continue (string=? (string-first line) "#") + (map string-trim + (string-split (string-replace line "/\\t/g" " ") " -> "))))) + +;; markov machine +(define (markov i-string rules) + (while + (for/fold (run #f) ((rule rules)) + #:when (string-index (pattern rule) i-string) + (set! i-string (string-replace i-string (pattern rule) (repl rule))) + ;;(writeln rule i-string) ;; uncomment for trace + #:break (term? rule) => #f + #:break #t => #t )) + i-string) + +(define (task i-string RS) + (markov i-string (parse-rules RS))) diff --git a/Task/Execute-a-Markov-algorithm/Swift/execute-a-markov-algorithm.swift b/Task/Execute-a-Markov-algorithm/Swift/execute-a-markov-algorithm.swift new file mode 100644 index 0000000000..d5da28d13f --- /dev/null +++ b/Task/Execute-a-Markov-algorithm/Swift/execute-a-markov-algorithm.swift @@ -0,0 +1,44 @@ +import Foundation + +func setup(ruleset: String) -> [(String, String, Bool)] { + return ruleset.componentsSeparatedByCharactersInSet(NSCharacterSet.newlineCharacterSet()) + .filter { $0.rangeOfString("^s*#", options: .RegularExpressionSearch) == nil } + .reduce([(String, String, Bool)]()) { rules, line in + let regex = try! NSRegularExpression(pattern: "^(.+)\\s+->\\s+(\\.?)(.*)$", options: .CaseInsensitive) + guard let match = regex.firstMatchInString(line, options: .Anchored, range: NSMakeRange(0, line.characters.count)) else { return rules } + return rules + [( + (line as NSString).substringWithRange(match.rangeAtIndex(1)), + (line as NSString).substringWithRange(match.rangeAtIndex(3)), + (line as NSString).substringWithRange(match.rangeAtIndex(2)) != "" + )] + } +} + +func markov(ruleset: String, var input: String) -> String { + let rules = setup(ruleset) + var terminate = false + while !terminate { + guard let i = rules.indexOf ({ + if let range = input.rangeOfString($0.0) { + input.replaceRange(range, with: $0.1) + return true + } + return false + }) else { break } + terminate = rules[i].2 + } + return input +} + + +let tests: [(ruleset: String, input: String)] = [ + ("# This rules file is extracted from Wikipedia:\n# http://en.wikipedia.org/wiki/Markov_Algorithm\nA -> apple\nB -> bag\nS -> shop\nT -> the\nthe shop -> my brother\na never used -> .terminating rule", "I bought a B of As from T S."), + ("# Slightly modified from the rules on Wikipedia\nA -> apple\nB -> bag\nS -> .shop\nT -> the\nthe shop -> my brother\na never used -> .terminating rule", "I bought a B of As from T S."), + ("# BNF Syntax testing rules\nA -> apple\nWWWW -> with\nBgage -> ->.*\nB -> bag\n->.* -> money\nW -> WW\nS -> .shop\nT -> the\nthe shop -> my brother\na never used -> .terminating rule", "I bought a B of As W my Bgage from T S."), + ("### Unary Multiplication Engine, for testing Markov Algorithm implementations\n### By Donal Fellows.\n# Unary addition engine\n_+1 -> _1+\n1+1 -> 11+\n# Pass for converting from the splitting of multiplication into ordinary\n# addition\n1! -> !1\n,! -> !+\n_! -> _\n# Unary multiplication by duplicating left side, right side times\n1*1 -> x,@y\n1x -> xX\nX, -> 1,1\nX1 -> 1X\n_x -> _X\n,x -> ,X\ny1 -> 1y\ny_ -> _\n# Next phase of applying\n1@1 -> x,@y\n1@_ -> @_\n,@_ -> !_\n++ -> +\n# Termination cleanup for addition\n_1 -> 1\n1+_ -> 1\n_+_ ->", "_1111*11111_"), + ("# Turing machine: three-state busy beaver\n#\n# state A, symbol 0 => write 1, move right, new state B\nA0 -> 1B\n# state A, symbol 1 => write 1, move left, new state C\n0A1 -> C01\n1A1 -> C11\n# state B, symbol 0 => write 1, move left, new state A\n0B0 -> A01\n1B0 -> A11\n# state B, symbol 1 => write 1, move right, new state B\nB1 -> 1B\n# state C, symbol 0 => write 1, move left, new state B\n0C0 -> B01\n1C0 -> B11\n# state C, symbol 1 => write 1, move left, halt\n0C1 -> H01\n1C1 -> H11", "000000A000000") +] + +for (index, test) in tests.enumerate() { + print("\(index + 1):", markov(test.ruleset, input: test.input)) +} diff --git a/Task/Execute-a-system-command/ERRE/execute-a-system-command-1.erre b/Task/Execute-a-system-command/ERRE/execute-a-system-command-1.erre new file mode 100644 index 0000000000..f341bf5144 --- /dev/null +++ b/Task/Execute-a-system-command/ERRE/execute-a-system-command-1.erre @@ -0,0 +1 @@ + SHELL("DIR/W") diff --git a/Task/Execute-a-system-command/ERRE/execute-a-system-command-2.erre b/Task/Execute-a-system-command/ERRE/execute-a-system-command-2.erre new file mode 100644 index 0000000000..387718d211 --- /dev/null +++ b/Task/Execute-a-system-command/ERRE/execute-a-system-command-2.erre @@ -0,0 +1,2 @@ +cmd$="DIR/W" +SHELL(cmd$) diff --git a/Task/Execute-a-system-command/FreeBASIC/execute-a-system-command.freebasic b/Task/Execute-a-system-command/FreeBASIC/execute-a-system-command.freebasic new file mode 100644 index 0000000000..be5528a1ac --- /dev/null +++ b/Task/Execute-a-system-command/FreeBASIC/execute-a-system-command.freebasic @@ -0,0 +1,4 @@ +' FB 1.05.0 Win64 + +Shell "dir" +Sleep diff --git a/Task/Execute-a-system-command/FunL/execute-a-system-command.funl b/Task/Execute-a-system-command/FunL/execute-a-system-command.funl new file mode 100644 index 0000000000..7a57963808 --- /dev/null +++ b/Task/Execute-a-system-command/FunL/execute-a-system-command.funl @@ -0,0 +1,3 @@ +import sys.execute + +execute( if $os.startsWith('Windows') then 'dir' else 'ls' ) diff --git a/Task/Execute-a-system-command/FutureBasic/execute-a-system-command.futurebasic b/Task/Execute-a-system-command/FutureBasic/execute-a-system-command.futurebasic new file mode 100644 index 0000000000..c2af16f1dd --- /dev/null +++ b/Task/Execute-a-system-command/FutureBasic/execute-a-system-command.futurebasic @@ -0,0 +1,14 @@ +include "ConsoleWindow" + +local fn DoUnixCommand( cmd as str255 ) + dim as str255 s + + open "Unix", 2, cmd + while ( not eof(2) ) + line input #2, s + print s + wend + close 2 +end fn + +fn DoUnixCommand( "ls -A" ) diff --git a/Task/Execute-a-system-command/LFE/execute-a-system-command-1.lfe b/Task/Execute-a-system-command/LFE/execute-a-system-command-1.lfe new file mode 100644 index 0000000000..1586bf25f7 --- /dev/null +++ b/Task/Execute-a-system-command/LFE/execute-a-system-command-1.lfe @@ -0,0 +1 @@ +> (os:cmd "ls -alrt") diff --git a/Task/Execute-a-system-command/LFE/execute-a-system-command-2.lfe b/Task/Execute-a-system-command/LFE/execute-a-system-command-2.lfe new file mode 100644 index 0000000000..9bc934a66f --- /dev/null +++ b/Task/Execute-a-system-command/LFE/execute-a-system-command-2.lfe @@ -0,0 +1 @@ +> (io:format (os:cmd "ls -alrt")) diff --git a/Task/Execute-a-system-command/Lasso/execute-a-system-command.lasso b/Task/Execute-a-system-command/Lasso/execute-a-system-command.lasso new file mode 100644 index 0000000000..8444d7cb47 --- /dev/null +++ b/Task/Execute-a-system-command/Lasso/execute-a-system-command.lasso @@ -0,0 +1,8 @@ +local( + path = file_forceroot, + ls = sys_process('/bin/ls', (:'-l', #path)), + lswait = #ls -> wait +) +'
'
+#ls -> read
+'
' diff --git a/Task/Execute-a-system-command/Lingo/execute-a-system-command.lingo b/Task/Execute-a-system-command/Lingo/execute-a-system-command.lingo new file mode 100644 index 0000000000..e5cb7fc13d --- /dev/null +++ b/Task/Execute-a-system-command/Lingo/execute-a-system-command.lingo @@ -0,0 +1,6 @@ +sx = xtra("Shell").new() +if the platform contains "win" then + put sx.shell_cmd("dir") +else + put sx.shell_cmd("ls") +end if diff --git a/Task/Execute-a-system-command/Nim/execute-a-system-command.nim b/Task/Execute-a-system-command/Nim/execute-a-system-command.nim new file mode 100644 index 0000000000..2002b8a2ed --- /dev/null +++ b/Task/Execute-a-system-command/Nim/execute-a-system-command.nim @@ -0,0 +1,4 @@ +import osproc + +let exitCode = execCmd "ls" +let (output, exitCode2) = execCmdEx "ls" diff --git a/Task/Execute-a-system-command/Oforth/execute-a-system-command.oforth b/Task/Execute-a-system-command/Oforth/execute-a-system-command.oforth new file mode 100644 index 0000000000..40bc8f616a --- /dev/null +++ b/Task/Execute-a-system-command/Oforth/execute-a-system-command.oforth @@ -0,0 +1 @@ +System cmd("pause") diff --git a/Task/Execute-a-system-command/Phix/execute-a-system-command.phix b/Task/Execute-a-system-command/Phix/execute-a-system-command.phix new file mode 100644 index 0000000000..c4d8534435 --- /dev/null +++ b/Task/Execute-a-system-command/Phix/execute-a-system-command.phix @@ -0,0 +1,3 @@ +string cmd = {"dir","ls"}[platform()-1] +system(cmd) +integer res = system_exec("pause",4) diff --git a/Task/Execute-a-system-command/Ring/execute-a-system-command.ring b/Task/Execute-a-system-command/Ring/execute-a-system-command.ring new file mode 100644 index 0000000000..f4c8bd6a80 --- /dev/null +++ b/Task/Execute-a-system-command/Ring/execute-a-system-command.ring @@ -0,0 +1 @@ +system("dir") diff --git a/Task/Execute-a-system-command/Sidef/execute-a-system-command.sidef b/Task/Execute-a-system-command/Sidef/execute-a-system-command.sidef new file mode 100644 index 0000000000..7ff1fa9b06 --- /dev/null +++ b/Task/Execute-a-system-command/Sidef/execute-a-system-command.sidef @@ -0,0 +1,10 @@ +# Pipe in read-only mode +%p(ls).open_r.each { |line| + print line; +}; + +var str1 = `ls`; # backtick: returns a string +var str2 = %x(ls); # ditto, alternative syntax + +Sys.system('ls'); # system: executes a command and prints the result +Sys.exec('ls'); # replaces current process with another diff --git a/Task/Execute-a-system-command/Ursa/execute-a-system-command.ursa b/Task/Execute-a-system-command/Ursa/execute-a-system-command.ursa new file mode 100644 index 0000000000..8aba145ddb --- /dev/null +++ b/Task/Execute-a-system-command/Ursa/execute-a-system-command.ursa @@ -0,0 +1,11 @@ +decl string<> arg +decl string<> output +decl iodevice iod + +append "ls" arg +set iod (ursa.util.process.start arg) +set output (iod.readlines) + +for (decl int i) (< i (size output)) (inc i) + out output endl console +end for diff --git a/Task/Execute-a-system-command/Wart/execute-a-system-command.wart b/Task/Execute-a-system-command/Wart/execute-a-system-command.wart new file mode 100644 index 0000000000..b53e17d26d --- /dev/null +++ b/Task/Execute-a-system-command/Wart/execute-a-system-command.wart @@ -0,0 +1 @@ +system "ls" diff --git a/Task/Exponentiation-operator/ERRE/exponentiation-operator.erre b/Task/Exponentiation-operator/ERRE/exponentiation-operator.erre new file mode 100644 index 0000000000..ebc3e1c70d --- /dev/null +++ b/Task/Exponentiation-operator/ERRE/exponentiation-operator.erre @@ -0,0 +1,16 @@ +PROGRAM POWER + +PROCEDURE POWER(A,B->POW) ! this routine handles only *INTEGER* powers + LOCAL FLAG% + IF B<0 THEN B=-B FLAG%=TRUE + POW=1 + FOR X=1 TO B DO + POW=POW*A + END FOR + IF FLAG% THEN POW=1/POW +END PROCEDURE + +BEGIN + POWER(11,-2->POW) PRINT(POW) + POWER(π,3->POW) PRINT(POW) +END PROGRAM diff --git a/Task/Exponentiation-operator/EchoLisp/exponentiation-operator.echolisp b/Task/Exponentiation-operator/EchoLisp/exponentiation-operator.echolisp new file mode 100644 index 0000000000..be7e61d1e5 --- /dev/null +++ b/Task/Exponentiation-operator/EchoLisp/exponentiation-operator.echolisp @@ -0,0 +1,25 @@ +;; this exponentiation function handles integer, rational or float x. +;; n is a positive or negative integer. + +(define (** x n) (cond + ((zero? n) 1) + ((< n 0) (/ (** x (- n)))) ;; x**-n = 1 / x**n + ((= n 1) x) + ((= n 0) 1) + ((odd? n) (* x (** x (1- n)))) ;; x**(2p+1) = x * x**2p + (else (let ((m (** x (/ n 2)))) (* m m))))) ;; x**2p = (x**p) * (x**p) + +(** 3 0) → 1 +(** 3 4) → 81 +(** 3 5) → 243 +(** 10 10) → 10000000000 +(** 1.3 10) → 13.785849184900007 + +(** -3 5) → -243 +(** 3 -4) → 1/81 +(** 3.7 -4) → 0.005335720890574502 +(** 2/3 7) → 128/2187 + +(lib 'bigint) +(** 666 42) → +38540524895511613165266748863173814985473295063157418576769816295283207864908351682948692085553606681763707358759878656 diff --git a/Task/Exponentiation-operator/FreeBASIC/exponentiation-operator.freebasic b/Task/Exponentiation-operator/FreeBASIC/exponentiation-operator.freebasic new file mode 100644 index 0000000000..fde90cd086 --- /dev/null +++ b/Task/Exponentiation-operator/FreeBASIC/exponentiation-operator.freebasic @@ -0,0 +1,32 @@ +' FB 1.05.0 + +' Note that 'base' is a keyword in FB, so we use 'base_' instead as a parameter + +Function Pow Overload (base_ As Double, exponent As Integer) As Double + If exponent = 0.0 Then Return 1.0 + If exponent = 1.0 Then Return base_ + If exponent < 0.0 Then Return 1.0 / Pow(base_, -exponent) + Dim power As Double = base_ + For i As Integer = 2 To exponent + power *= base_ + Next + Return power +End Function + +Function Pow Overload(base_ As Integer, exponent As Integer) As Double + Return Pow(CDbl(base_), exponent) +End Function + +' check results of these functions using FB's built in '^' operator +Print "Pow(2, 2) = "; Pow(2, 2) +Print "Pow(2.5, 2) = "; Pow(2.5, 2) +Print "Pow(2, -3) = "; Pow(2, -3) +Print "Pow(1.78, 3) = "; Pow(1.78, 3) +Print +Print "2 ^ 2 = "; 2 ^ 2 +Print "2.5 ^ 2 = "; 2.5 ^ 2 +Print "2 ^ -3 = "; 2 ^ -3 +Print "1.78 ^ 3 = "; 1.78 ^ 3 +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Exponentiation-operator/Lingo/exponentiation-operator.lingo b/Task/Exponentiation-operator/Lingo/exponentiation-operator.lingo new file mode 100644 index 0000000000..70e7bf969d --- /dev/null +++ b/Task/Exponentiation-operator/Lingo/exponentiation-operator.lingo @@ -0,0 +1,14 @@ +-- As for built-in power() function: +-- base can be either integer or float; returns float. +on pow (base, exp) + if exp=0 then return 1.0 + else if exp<0 then + exp = -exp + base = 1.0/base + end if + res = float(base) + repeat with i = 2 to exp + res = res*base + end repeat + return res +end diff --git a/Task/Exponentiation-operator/Nim/exponentiation-operator.nim b/Task/Exponentiation-operator/Nim/exponentiation-operator.nim new file mode 100644 index 0000000000..9783c8d1cb --- /dev/null +++ b/Task/Exponentiation-operator/Nim/exponentiation-operator.nim @@ -0,0 +1,23 @@ +proc `^`[T: float|int](base: T; exp: int): T = + var (base, exp) = (base, exp) + result = 1 + + if exp < 0: + when T is int: + if base * base != 1: return 0 + elif (exp and 1) == 0: return 1 + else: return base + else: + base = 1.0 / base + exp = -exp + + while exp != 0: + if (exp and 1) != 0: + result *= base + exp = exp shr 1 + base *= base + +echo "2^6 = ", 2^6 +echo "2^-6 = ", 2 ^ -6 +echo "2.71^6 = ", 2.71^6 +echo "2.71^-6 = ", 2.71 ^ -6 diff --git a/Task/Exponentiation-operator/Oforth/exponentiation-operator.oforth b/Task/Exponentiation-operator/Oforth/exponentiation-operator.oforth new file mode 100644 index 0000000000..06a8f6c4c0 --- /dev/null +++ b/Task/Exponentiation-operator/Oforth/exponentiation-operator.oforth @@ -0,0 +1,9 @@ +: powint(r, n) +| i | + 1 n abs loop: i [ r * ] + n isNegative ifTrue: [ inv ] ; + +2 3 powint println +2 powint(3) println +1.2 4 powint println +1.2 powint(4) println diff --git a/Task/Exponentiation-operator/Phix/exponentiation-operator.phix b/Task/Exponentiation-operator/Phix/exponentiation-operator.phix new file mode 100644 index 0000000000..ebb61c92b7 --- /dev/null +++ b/Task/Exponentiation-operator/Phix/exponentiation-operator.phix @@ -0,0 +1,13 @@ +function powi(atom b, integer i) +atom v=1 + b = iff(i<0 ? 1/b : b) + i = abs(i) + while i>0 do + if and_bits(i,1) then v *= b end if + b *= b + i = floor(i/2) + end while + return v +end function +?powi(-3,-5) +?power(-3,-5) diff --git a/Task/Exponentiation-operator/Ring/exponentiation-operator.ring b/Task/Exponentiation-operator/Ring/exponentiation-operator.ring new file mode 100644 index 0000000000..ef30a1176a --- /dev/null +++ b/Task/Exponentiation-operator/Ring/exponentiation-operator.ring @@ -0,0 +1,20 @@ +see "11^5 = " + ipow(11, 5) + nl +see "pi^3 = " + fpow(3.14, 3) + nl + +func ipow a, b + p2 = 1 + for i = 1 to 32 + p2 *= p2 + if b < 0 p2 *= a ok + b = b << 1 + next + return p2 + +func fpow a, b + p = 1 + for i = 1 to 32 + p *= p + if b < 0 p *= a ok + b = b << 1 + next + return p diff --git a/Task/Exponentiation-operator/Sidef/exponentiation-operator-1.sidef b/Task/Exponentiation-operator/Sidef/exponentiation-operator-1.sidef new file mode 100644 index 0000000000..bf0a2f7559 --- /dev/null +++ b/Task/Exponentiation-operator/Sidef/exponentiation-operator-1.sidef @@ -0,0 +1,20 @@ +func expon(_, {.is_zero}) { 1 } + +func expon(base, exp {.is_neg}) { + expon(1/base, -exp) +} + +func expon(base, exp {.is_int}) { + + var c = 1 + while (exp > 1) { + c *= base if exp.is_odd + base *= base + exp >>= 1 + } + + return (base * c) +} + +say expon(3, 10) +say expon(5.5, -3) diff --git a/Task/Exponentiation-operator/Sidef/exponentiation-operator-2.sidef b/Task/Exponentiation-operator/Sidef/exponentiation-operator-2.sidef new file mode 100644 index 0000000000..9e3a0ad97b --- /dev/null +++ b/Task/Exponentiation-operator/Sidef/exponentiation-operator-2.sidef @@ -0,0 +1,8 @@ +class Number { + method ⊙(exp) { + expon(self, exp) + } +} + +say (3 ⊙ 10) +say (5.5 ⊙ -3) diff --git a/Task/Exponentiation-operator/Ursa/exponentiation-operator.ursa b/Task/Exponentiation-operator/Ursa/exponentiation-operator.ursa new file mode 100644 index 0000000000..0a3e589a16 --- /dev/null +++ b/Task/Exponentiation-operator/Ursa/exponentiation-operator.ursa @@ -0,0 +1,24 @@ +# these implementations ignore negative exponents +def intpow (int m, int n) + if (< n 1) + return 1 + end if + decl int ret + set ret 1 + for () (> n 0) (dec n) + set ret (* ret m) + end for + return ret +end intpow + +def floatpow (double m, int n) + if (or (< n 1) (and (= m 0) (= n 0))) + return 1 + end if + decl int ret + set ret 1 + for () (> n 0) (dec n) + set ret (* ret m) + end for + return ret +end floatpow diff --git a/Task/Exponentiation-operator/jq/exponentiation-operator-1.jq b/Task/Exponentiation-operator/jq/exponentiation-operator-1.jq new file mode 100644 index 0000000000..4d64567ff6 --- /dev/null +++ b/Task/Exponentiation-operator/jq/exponentiation-operator-1.jq @@ -0,0 +1,15 @@ +# 0^0 => 1 +# NOTE: jq converts very large integers to floats. +# This implementation uses reduce to avoid deep recursion +def power_int(n): + if n == 0 then 1 + elif . == 0 then 0 + elif n < 0 then 1/power_int(-n) + elif ((n | floor) == n) then + ( (n % 2) | if . == 0 then 1 else -1 end ) as $sign + | if (. == -1) then $sign + elif . < 0 then (( -(.) | power_int(n) ) * $sign) + else . as $in | reduce range(1;n) as $i ($in; . * $in) + end + else error("This is a toy implementation that requires n be integral") + end ; diff --git a/Task/Exponentiation-operator/jq/exponentiation-operator-2.jq b/Task/Exponentiation-operator/jq/exponentiation-operator-2.jq new file mode 100644 index 0000000000..60162f93ea --- /dev/null +++ b/Task/Exponentiation-operator/jq/exponentiation-operator-2.jq @@ -0,0 +1,13 @@ +def demo(x;y): + x | [ power_int(y), (log*y|exp) ] ; + +demo(2; 3), +demo(2; 64), +demo(1.1; 1024), +demo(1.1; -1024) + +# Output: +[8, 7.999999999999998] +[18446744073709552000, 18446744073709525000] +[2.4328178969536854e+42, 2.4328178969536693e+42] +[4.1104597317052596e-43, 4.1104597317052874e-43] diff --git a/Task/Extend-your-language/EchoLisp/extend-your-language.echolisp b/Task/Extend-your-language/EchoLisp/extend-your-language.echolisp new file mode 100644 index 0000000000..c88b3e93df --- /dev/null +++ b/Task/Extend-your-language/EchoLisp/extend-your-language.echolisp @@ -0,0 +1,23 @@ +(define-syntax-rule + (if2 cond1 cond2 both cond1-only cond2-only none) ;; new syntax +;; will expand to : + (if cond1 + (if cond2 both cond1-only) + (if cond2 cond2-only none))) + → #syntax:if2 + +(define (num-test n) + (if2 (positive? n) (exact? n) + "positive and exact" + "positive and inexact" + "negative and exact" + "negative and inexact")) + +(num-test 3/4) + → "positive and exact" +(num-test -666) + → "negative and exact" +(num-test -666.42) + → "negative and inexact" +(num-test PI) + → "positive and inexact" diff --git a/Task/Extend-your-language/FreeBASIC/extend-your-language.freebasic b/Task/Extend-your-language/FreeBASIC/extend-your-language.freebasic new file mode 100644 index 0000000000..9a8343767e --- /dev/null +++ b/Task/Extend-your-language/FreeBASIC/extend-your-language.freebasic @@ -0,0 +1,32 @@ +' FB 1.05.0 Win64 + +#Macro If2(condition1, condition2) +#Define Else1 ElseIf CBool(condition1) Then +#Define Else2 ElseIf CBool(condition2) Then +If CBool(condition1) AndAlso CBool(condition2) Then +#Endmacro + +Sub test(a As Integer, b As Integer) + If2(a > 0, b > 0) + print "both positive" + Else1 + print "first positive" + Else2 + print "second positive" + Else + print "neither positive" + End If +End Sub + +Dim As Integer a, b +Print "a = 1, b = 1 => "; +test(1, 1) +Print "a = 1, b = 0 => "; +test(1, 0) +Print "a = 0, b = 1 => "; +test(0, 1) +Print "a = 0, b = 0 => "; +test(0, 0) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Extend-your-language/Lasso/extend-your-language-1.lasso b/Task/Extend-your-language/Lasso/extend-your-language-1.lasso new file mode 100644 index 0000000000..12a45fc754 --- /dev/null +++ b/Task/Extend-your-language/Lasso/extend-your-language-1.lasso @@ -0,0 +1,23 @@ +// Create a type to handle the captures + +define if2 => type { + data private a, private b + public oncreate(a,b) => { + .a = #a + .b = #b + thread_var_push(.type,self) + handle => { thread_var_pop(.type)} + return givenblock() + } + public ifboth => .a && .b ? givenblock() + public else1 => .a && !.b ? givenblock() + public else2 => !.a && .b ? givenblock() + public else => !.a && !.b ? givenblock() +} + +// Define methods to consider givenblocks + +define ifboth => thread_var_get(::if2)->ifboth => givenblock +define else1 => thread_var_get(::if2)->else1 => givenblock +define else2 => thread_var_get(::if2)->else2 => givenblock +define else => thread_var_get(::if2)->else => givenblock diff --git a/Task/Extend-your-language/Lasso/extend-your-language-2.lasso b/Task/Extend-your-language/Lasso/extend-your-language-2.lasso new file mode 100644 index 0000000000..964b48dca4 --- /dev/null +++ b/Task/Extend-your-language/Lasso/extend-your-language-2.lasso @@ -0,0 +1,14 @@ +if2(true,true) => { + ifboth => { + bothConditionsAreTrue + } + else1 => { + firstConditionIsTrue + } + else2 => { + secondConditionIsTrue + } + else => { + noConditionIsTrue + } +} diff --git a/Task/Extend-your-language/Morfa/extend-your-language.morfa b/Task/Extend-your-language/Morfa/extend-your-language.morfa new file mode 100644 index 0000000000..338e31fda7 --- /dev/null +++ b/Task/Extend-your-language/Morfa/extend-your-language.morfa @@ -0,0 +1,77 @@ +import morfa.base; + +// introduce 4 new operators to handle the if2 syntax +operator then { kind = infix, precedence = mul, associativity = right} +operator else1 { kind = infix, precedence = not, associativity = left } +operator else2 { kind = infix, precedence = not, associativity = left } +operator none { kind = infix, precedence = not, associativity = left } + +// function which bounds the condition expression to the if2 "actions" +public func then(condition: IF2.Condition, actionHolder: IF2): void +{ + actionHolder.actions[condition](); +} + +// functions (bound to operators) used to "build" the if2 "statement" +public func else1(bothAction: func(): void, else1Action: func(): void): IF2 +{ + return IF2([IF2.Condition.both -> bothAction, + IF2.Condition.else1 -> else1Action]); + +} +public func else2(actionHolder: IF2, action: func(): void): IF2 +{ + return checkAndAdd(actionHolder, action, IF2.Condition.else2); +} +public func none(actionHolder: IF2, action: func(): void): IF2 +{ + return checkAndAdd(actionHolder, action, IF2.Condition.none); +} + +// finally, function which combines two conditions into a "trigger" for the if2 "statement" +public func if2(condition1: bool, condition2: bool): IF2.Condition +{ + if (condition1 and condition2) + return IF2.Condition.both; + else if (condition1) + return IF2.Condition.else1; + else if (condition2) + return IF2.Condition.else2; + else + return IF2.Condition.none; +} + +// private helper function to build the IF2 structure +func checkAndAdd(actionHolder: IF2, action: func(): void, actionName: IF2.Condition): IF2 +{ + if (actionHolder.actions.contains(actionName)) + throw new Exception("action defined twice for one condition in if2"); + else + actionHolder.actions[actionName] = action; + return actionHolder; +} + +// helper structure to process the if2 "statement" +struct IF2 +{ + public enum Condition { both, else1, else2, none }; + public var actions: Dict; +} + +// usage +if2 (true, false) then func() +{ + println("both true"); +} +else1 func() +{ + println("first true"); +} +else2 func() +{ + println("second true"); +} +none func() +{ + println("none true"); +}; diff --git a/Task/Extend-your-language/Nim/extend-your-language.nim b/Task/Extend-your-language/Nim/extend-your-language.nim new file mode 100644 index 0000000000..d338f9d45d --- /dev/null +++ b/Task/Extend-your-language/Nim/extend-your-language.nim @@ -0,0 +1,62 @@ +import macros + +proc newIfElse(c, t, e): PNimNode {.compiletime.} = + result = newIfStmt((c, t)) + result.add(newNimNode(nnkElse).add(e)) + +macro if2(x, y: expr; z: stmt): stmt {.immediate.} = + var parts: array[4, PNimNode] + for i in parts.low .. parts.high: + parts[i] = newNimNode(nnkDiscardStmt).add(nil) + + assert z.kind == nnkStmtList + assert z.len <= 4 + + for i in 0 .. 1, 3 < 2: + then: + echo "1" + else1: + echo "2" + else2: + echo "3" + else3: + echo "4" + +# Missing cases are supported: +if2 2 > 1, 3 < 2: + then: + echo "1" + else2: + echo "3" + else3: + echo "4" + +# Order can be swapped: +if2 2 > 1, 3 < 2: + then: + echo "1" + else2: + echo "3" + else1: + echo "2" + else3: + echo "4" diff --git a/Task/Extend-your-language/PHL/extend-your-language.phl b/Task/Extend-your-language/PHL/extend-your-language.phl new file mode 100644 index 0000000000..dc0b3f7a8e --- /dev/null +++ b/Task/Extend-your-language/PHL/extend-your-language.phl @@ -0,0 +1,53 @@ +module stmts; + +import phl::lang::io; + +/* LinkedList --> Each element contains a condition */ +struct @ConditionalChain { + field @Boolean cond; + field @ConditionalChain next; + + @ConditionalChain init(@Boolean cond, @ConditionalChain next) [ + this::cond = cond; + this::next = next; + + return this; + ] + + /* + * If the condition is true executes the closure and returns a false element, otherwise returns the next condition + * + * Execution starts from the first element, and iterates until the right element is found. + */ + @ConditionalChain then(@Closure<@Void> closure) [ + if (isNull(next())) return new @ConditionalChain.init(false, null); + if (cond()) { + closure(); + return new @ConditionalChain.init(false, null); + } + else return next(); + ] + + /* Operators create a cool look */ + @ConditionalChain operator then(@Closure<@Void> closure) alias @ConditionalChain.then; + @ConditionalChain operator else1(@Closure<@Void> closure) alias @ConditionalChain.then; + @ConditionalChain operator else2(@Closure<@Void> closure) alias @ConditionalChain.then; + @ConditionalChain operator orElse(@Closure<@Void> closure) alias @ConditionalChain.then; +}; + +/* Returns linked list [a && b, a, b, true] */ +@ConditionalChain if2(@Boolean a, @Boolean b) [ + return new @ConditionalChain.init(a && b, new @ConditionalChain.init(a, new @ConditionalChain.init(b, new @ConditionalChain.init(true, null)))); +] + +@Void main [ + if2(false, true) then [ + println("Not this!"); + ] else1 [ + println("Not this!"); + ] else2 [ + println("This!"); + ] orElse [ + println("Not this!"); + ]; +] diff --git a/Task/Extend-your-language/Shen/extend-your-language-1.shen b/Task/Extend-your-language/Shen/extend-your-language-1.shen new file mode 100644 index 0000000000..752b812406 --- /dev/null +++ b/Task/Extend-your-language/Shen/extend-your-language-1.shen @@ -0,0 +1,5 @@ +(defmacro branch-if-macro + [branch-if Cond1 Cond2 Both Fst Snd None] -> + [if Cond1 + [if Cond2 Both Fst] + [if Cond2 Snd None]]) diff --git a/Task/Extend-your-language/Shen/extend-your-language-2.shen b/Task/Extend-your-language/Shen/extend-your-language-2.shen new file mode 100644 index 0000000000..61d7c891c9 --- /dev/null +++ b/Task/Extend-your-language/Shen/extend-your-language-2.shen @@ -0,0 +1,7 @@ +(define try + X Y -> (branch-if (integer? X) + (integer? Y) + both-ints first-int second-int neither-int)) + +(map (/. X (do (print X) (nl))) + [(try 1 2) (try 1 1.5) (try 1.5 1) (try 1.5 1.5)]) diff --git a/Task/Extend-your-language/Sidef/extend-your-language.sidef b/Task/Extend-your-language/Sidef/extend-your-language.sidef new file mode 100644 index 0000000000..01ced5c77a --- /dev/null +++ b/Task/Extend-your-language/Sidef/extend-your-language.sidef @@ -0,0 +1,36 @@ +class if2(cond1, cond2) { + method then(block) { # both true + if (cond1 && cond2) { + block.run; + } + return self; + } + method else1(block) { # first true + if (cond1 && !cond2) { + block.run; + } + return self; + } + method else2(block) { # second true + if (cond2 && !cond1) { + block.run; + } + return self; + } + method else(block) { # none true + if (!cond1 && !cond2) { + block.run; + } + return self; + } +} + +if2(false, true).then { + say "if2"; +}.else1 { + say "else1"; +}.else2 { + say "else2"; # <- this gets printed +}.else { + say "else" +} diff --git a/Task/Extensible-prime-generator/EchoLisp/extensible-prime-generator.echolisp b/Task/Extensible-prime-generator/EchoLisp/extensible-prime-generator.echolisp new file mode 100644 index 0000000000..652a58c313 --- /dev/null +++ b/Task/Extensible-prime-generator/EchoLisp/extensible-prime-generator.echolisp @@ -0,0 +1,35 @@ +; the first twenty primes +(primes 20) + → { 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 } + +; a stream to generate primes from a +(define (primes-from a) + (let ((p (next-prime a))) + (stream-cons p (primes-from p)))) + +; primes between 100,150 +(for/list ((p (primes-from 100))) #:break (> p 150) p) + → (101 103 107 109 113 127 131 137 139 149) + +; the built-in function (primes-pi )counts the number of primes < a +; count in [7700 ... 8000] +(- (primes-pi 8000) (primes-pi 7700) → 30 + +; nth-prime +(nth-prime 10000) → 104729 + +;; big ones +(lib 'bigint) +(define (p-digits n) + (printf "(next-prime %d ! ) has %d digits" n + (number-length (next-prime (factorial n ))))) + +(next-prime 0! ) has 1 digits +(next-prime 10! ) has 7 digits +(next-prime 100! ) has 158 digits +(next-prime 200! ) has 375 digits +(next-prime 300! ) has 615 digits +(next-prime 400! ) has 869 digits ;; 9400 msec (FireFox) + +; is prime (1 + 116!) ? +(prime? (1+ (factorial 116))) → #t diff --git a/Task/Extensible-prime-generator/FreeBASIC/extensible-prime-generator.freebasic b/Task/Extensible-prime-generator/FreeBASIC/extensible-prime-generator.freebasic new file mode 100644 index 0000000000..4424a74d71 --- /dev/null +++ b/Task/Extensible-prime-generator/FreeBASIC/extensible-prime-generator.freebasic @@ -0,0 +1,100 @@ +' FB 1.05.0 + +Enum SieveLimitType + number + between + countBetween +End Enum + +Sub printPrimes(low As Integer, high As Integer, slt As SieveLimitType) + If high < low OrElse low < 1 Then Return ' too small + If slt <> number AndAlso slt <> between AndAlso slt <> countBetween Then Return + If slt <> number AndAlso (low < 2 OrElse high < 2) Then Return + If slt <> number AndAlso high > 1000000000 Then Return ' too big + If slt = number AndAlso high > 50000000 Then Return ' too big + Dim As Integer n + If slt = number Then + n = 20 * high '' big enough to accomodate 50 million primes to which this procedure is limited + Else + n = high + End If + Dim a(2 To n) As Boolean '' only uses 1 byte per element + For i As Integer = 2 To n : a(i) = True : Next '' set all elements to True to start with + Dim As Integer p = 2, q + ' mark non-prime numbers by setting the corresponding array element to False + + Do + For j As Integer = p * p To n Step p + a(j) = False + Next j + ' look for next True element in array after 'p' + q = 0 + For j As Integer = p + 1 To Sqr(n) + If a(j) Then + q = j + Exit For + End If + Next j + If q = 0 Then Exit Do + p = q + Loop + + Select Case As Const slt + Case number + Dim count As Integer = 0 + For i As Integer = 2 To n + If a(i) Then + count += 1 + If count >= low AndAlso count <= high Then + Print i; " "; + End If + If count = high Then Exit Select + End If + Next + + Case between + For i As Integer = low To high + If a(i) Then + Print i; " "; + End if + Next + + Case countBetween + Dim count As Integer = 0 + For i As Integer = low To high + If a(i) Then count += 1 + Next + Print count; + + End Select + Print +End Sub + +Print "The first 20 primes are :" +Print +printPrimes(1, 20, number) +Print +Print "The primes between 100 and 150 are :" +Print +printPrimes(100, 150, between) +Print +Print "The number of primes between 7700 and 8000 is :"; +printPrimes(7700, 8000, countBetween) +Print +Print "The 10000th prime is :"; +Dim t As Double = timer +printPrimes(10000, 10000, number) +Print "Computed in "; CInt((timer - t) * 1000 + 0.5); " ms" +Print +Print "The 1000000th prime is :"; +t = timer +printPrimes(1000000, 1000000, number) +Print "Computed in ";CInt((timer - t) * 1000 + 0.5); " ms" +Print +Print "The 50000000th prime is :"; +t = timer +printPrimes(50000000, 50000000, number) +Print "Computed in ";CInt((timer - t) * 1000 + 0.5); " ms" +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Extensible-prime-generator/Ring/extensible-prime-generator.ring b/Task/Extensible-prime-generator/Ring/extensible-prime-generator.ring new file mode 100644 index 0000000000..6a69773e07 --- /dev/null +++ b/Task/Extensible-prime-generator/Ring/extensible-prime-generator.ring @@ -0,0 +1,38 @@ +see "first twenty primes : " +i = 1 +nr = 0 +while i <= 20 + nr += 1 + if isPrime(nr) see " " + nr i += 1 ok +end + +see "primes between 100 and 150 : " +for nr = 100 to 150 + if isPrime(nr) see " " + nr ok +next +see nl + +see "primes between 7,700 and 8,000 : " +i = 0 +for nr = 7700 to 8000 + if isPrime(nr) i += 1 ok +next +see i + nl + +see "The 10,000th prime : " +i = 1 +nr = 0 +while i <= 10000 + nr += 1 + if isPrime(nr) i += 1 ok +end +see nr + nl + +func isPrime n + if n <= 1 return false ok + if n <= 3 return true ok + if (n & 1) = 0 return false ok + for t = 3 to sqrt(n) step 2 + if (n % t) = 0 return false ok + next + return true diff --git a/Task/Extensible-prime-generator/Sidef/extensible-prime-generator.sidef b/Task/Extensible-prime-generator/Sidef/extensible-prime-generator.sidef new file mode 100644 index 0000000000..504fe84d67 --- /dev/null +++ b/Task/Extensible-prime-generator/Sidef/extensible-prime-generator.sidef @@ -0,0 +1,6 @@ +var nt = frequire('ntheory') + +say ("First 20: ", nt.primes(nt.nth_prime(20)).join(' ')) +say ("Between 100 and 150: ", nt.primes(100,150).join(' ')) +say (nt.prime_count(7700,8000), " primes between 7700 and 8000") +say ("10,000th prime: ", nt.nth_prime(10_000)) diff --git a/Task/Extensible-prime-generator/jq/extensible-prime-generator-1.jq b/Task/Extensible-prime-generator/jq/extensible-prime-generator-1.jq new file mode 100644 index 0000000000..1fc95d4a3a --- /dev/null +++ b/Task/Extensible-prime-generator/jq/extensible-prime-generator-1.jq @@ -0,0 +1,9 @@ +# Recent versions of jq include the following definition: +# until/2 loops until cond is satisfied, +# and emits the value satisfying the condition: +def until(cond; next): + def _until: + if cond then . else (next|_until) end; + _until; + +def count(cond): reduce .[] as $x (0; if $x|cond then .+1 else . end); diff --git a/Task/Extensible-prime-generator/jq/extensible-prime-generator-2.jq b/Task/Extensible-prime-generator/jq/extensible-prime-generator-2.jq new file mode 100644 index 0000000000..662543c811 --- /dev/null +++ b/Task/Extensible-prime-generator/jq/extensible-prime-generator-2.jq @@ -0,0 +1,33 @@ +# Is the input integer a prime? +# "previous" must be the array of sorted primes greater than 1 up to (.|sqrt) +def is_prime(previous): + . as $in + | (previous|length) as $plength + | [false, 0] # state: [found, ix] + | until( .[0] or .[1] >= $plength; + [ ($in % previous[.[1]]) == 0, .[1] + 1] ) + | .[0] | not ; + +# extend_primes expects its input to be an array consisting of +# previously found primes, in order, and extends that array: +def extend_primes: + if . == null or length == 0 then [2] + else . as $previous + | if . == [2] then [2,3] + else . + [(2 + .[length-1]) | until( is_prime($previous) ; . + 2)] + end + end; + +# If . is an integer > 0 then produce an array of . primes; +# otherwise emit an unbounded stream of primes: +def primes: + . as $n + | if type == "number" and $n > 0 then + null | until( length == $n; extend_primes ) + else [2] | recurse(extend_primes) | .[length - 1] + end; + +# Primes up to and possibly including n: +def primes_upto(n): + until( .[length-1] > n; extend_primes ) + | if .[length-1] > n then .[0:length-1] else . end; diff --git a/Task/Extensible-prime-generator/jq/extensible-prime-generator-3.jq b/Task/Extensible-prime-generator/jq/extensible-prime-generator-3.jq new file mode 100644 index 0000000000..534d2b2f58 --- /dev/null +++ b/Task/Extensible-prime-generator/jq/extensible-prime-generator-3.jq @@ -0,0 +1,9 @@ +"First 20 primes:", (20 | primes), "", + +"Primes between 100 and 150:", + (primes_upto(150) | map(select( 100 < .))), "", + +"The 10,000th prime is \( 10000 | primes | .[length - 1] )", "", + +(( primes_upto(8000) | count( . > 7700) | length) as $length + | "There are \($length) primes twixt 7700 and 8000.") diff --git a/Task/Extensible-prime-generator/jq/extensible-prime-generator-4.jq b/Task/Extensible-prime-generator/jq/extensible-prime-generator-4.jq new file mode 100644 index 0000000000..7f3fc27289 --- /dev/null +++ b/Task/Extensible-prime-generator/jq/extensible-prime-generator-4.jq @@ -0,0 +1,10 @@ +$ jq -r -c -n -f Extensible_prime_generator.jq +First 20 primes: +[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71] + +Primes between 100 and 150: +[101,103,107,109,113,127,131,137,139,149] + +The 10,000th prime is 104729 + +There are 30 primes twixt 7700 and 8000. diff --git a/Task/Extreme-floating-point-values/FreeBASIC/extreme-floating-point-values.freebasic b/Task/Extreme-floating-point-values/FreeBASIC/extreme-floating-point-values.freebasic new file mode 100644 index 0000000000..bb55f289fd --- /dev/null +++ b/Task/Extreme-floating-point-values/FreeBASIC/extreme-floating-point-values.freebasic @@ -0,0 +1,14 @@ +' FB 1.05.0 Win64 + +#Include "crt/math.bi" + +Dim inf As Double = INFINITY +Dim negInf As Double = -INFINITY +Dim notNum As Double = NAN_ +Dim negZero As Double = 1.0 / negInf + +Print inf, inf / inf +Print negInf, negInf * negInf +Print notNum, notNum + inf + negInf +Print negZero, negZero - 1 +Sleep diff --git a/Task/Extreme-floating-point-values/Nim/extreme-floating-point-values.nim b/Task/Extreme-floating-point-values/Nim/extreme-floating-point-values.nim new file mode 100644 index 0000000000..f59dcbd65c --- /dev/null +++ b/Task/Extreme-floating-point-values/Nim/extreme-floating-point-values.nim @@ -0,0 +1,12 @@ +echo 1e234 * 1e234 # inf +echo 1e234 * -1e234 # -inf +echo 1 / inf # 0 +echo inf + -inf # -nan +echo nan # nan + +echo nan == nan # false +echo 0.0 == -0.0 # true +echo 0.0 * nan # nan +echo nan * 0.0 # nan +echo 0.0 * inf # -nan +echo inf * 0.0 # -nan diff --git a/Task/Extreme-floating-point-values/Phix/extreme-floating-point-values.phix b/Task/Extreme-floating-point-values/Phix/extreme-floating-point-values.phix new file mode 100644 index 0000000000..b01f1c276b --- /dev/null +++ b/Task/Extreme-floating-point-values/Phix/extreme-floating-point-values.phix @@ -0,0 +1,20 @@ +constant inf = 1e300*1e300, -- (works on both 32 and 64 bit) + ninf = -inf, + nan = -(inf/inf), + nzero = -1/inf -- (not supported) + +printf(1," inf: %f\n",{inf}) +printf(1," ninf: %f\n",{ninf}) +printf(1," nan: %f\n",{nan}) +printf(1,"*nzero: %f\n",{nzero}) +printf(1," inf+2: %f\n",{inf+2}) +printf(1," inf+ninf: %f\n",{inf+ninf}) +printf(1," 0*inf: %f\n",{0*inf}) +printf(1," nan+1: %f\n",{nan+1}) +printf(1," nan+nan: %f\n",{nan+nan}) +printf(1," inf>1e300: %d\n",{inf>1e300}) +printf(1," ninf<1e300: %d\n",{ninf<-1e300}) +printf(1,"*nan=nan: %d\n",{nan=nan}) +printf(1," nan=42: %d\n",{nan=42}) +printf(1,"*nan<0: %d\n",{nan<0}) +printf(1," nan>0: %d\n",{nan>0}) diff --git a/Task/Extreme-floating-point-values/Sidef/extreme-floating-point-values.sidef b/Task/Extreme-floating-point-values/Sidef/extreme-floating-point-values.sidef new file mode 100644 index 0000000000..b996116385 --- /dev/null +++ b/Task/Extreme-floating-point-values/Sidef/extreme-floating-point-values.sidef @@ -0,0 +1,30 @@ +var inf = (1 / 0) #=> Inf +var nan = (0 / 0) #=> NaN + +var exprs = [ + "1.0 / 0.0", "-1.0 / 0.0", "0.0 / 0.0", "- 0.0", + "inf + 1", "5 - inf", "inf * 5", "inf / 5", "inf * 0", + "1.0 / inf", "-1.0 / inf", "inf + inf", "inf - inf", + "inf * inf", "inf / inf", "inf * 0.0", " 0 < inf", "inf == inf", + "nan + 1", "nan * 5", "nan - nan", "nan * inf", "- nan", + "nan == nan", "nan > 0", "nan < 0", "nan == 0", "0.0 == -0.0", +] + +exprs.each { |expr| + "%15s => %s\n".printf(expr, eval(expr)) +} + +say "-"*40 +say("NaN equality: ", NaN == nan) #=> true +say("Infinity equality: ", Inf == inf) #=> true +say("-Infinity equality: ", -Inf == -inf) #=> true + +say "-"*40 +say("sqrt(-1) = ", sqrt(-1)); #=> i +say("tanh(-Inf) = ", tanh(-inf)); #=> -1 +say("(-Inf)**2 = ", (-inf)**2); #=> Inf +say("(-Inf)**3 = ", (-inf)**3); #=> -Inf +say("acos(Inf) = ", acos(inf)); #=> Inf*i +say("atan(Inf) = ", atan(inf)); #=> pi/2 +say("log(-1) = ", log(-1)); #=> pi*i +say("atanh(Inf) = ", atanh(inf)); #=> -pi/2*i diff --git a/Task/Extreme-floating-point-values/Swift/extreme-floating-point-values.swift b/Task/Extreme-floating-point-values/Swift/extreme-floating-point-values.swift new file mode 100644 index 0000000000..8d9e057762 --- /dev/null +++ b/Task/Extreme-floating-point-values/Swift/extreme-floating-point-values.swift @@ -0,0 +1,12 @@ +let negInf = -1.0 / 0.0 +let inf = 1.0 / 0.0 //also Double.infinity +let nan = 0.0 / 0.0 //also Double.NaN +let negZero = -2.0 / inf + +println("Negative inf: \(negInf)") +println("Positive inf: \(inf)") +println("NaN: \(nan)") +println("Negative 0: \(negZero)") +println("inf + -inf: \(inf + negInf)") +println("0 * NaN: \(0 * nan)") +println("NaN == NaN: \(nan == nan)") diff --git a/Task/Extreme-floating-point-values/jq/extreme-floating-point-values-1.jq b/Task/Extreme-floating-point-values/jq/extreme-floating-point-values-1.jq new file mode 100644 index 0000000000..9a4d57fd71 --- /dev/null +++ b/Task/Extreme-floating-point-values/jq/extreme-floating-point-values-1.jq @@ -0,0 +1,2 @@ +0/0 #=> null +1e1000 #=> 1.7976931348623157e+308 diff --git a/Task/Extreme-floating-point-values/jq/extreme-floating-point-values-2.jq b/Task/Extreme-floating-point-values/jq/extreme-floating-point-values-2.jq new file mode 100644 index 0000000000..cff0c1b631 --- /dev/null +++ b/Task/Extreme-floating-point-values/jq/extreme-floating-point-values-2.jq @@ -0,0 +1,2 @@ +def infinite: 1e1000; +def nan: 0/0; diff --git a/Task/Extreme-floating-point-values/jq/extreme-floating-point-values-3.jq b/Task/Extreme-floating-point-values/jq/extreme-floating-point-values-3.jq new file mode 100644 index 0000000000..5856bcfdae --- /dev/null +++ b/Task/Extreme-floating-point-values/jq/extreme-floating-point-values-3.jq @@ -0,0 +1,8 @@ +-0 #=> -0 +0 == -0 # => true +infinite == infinite #=> true +infinite == -(-infinite) #=> true +(infinite + infinite) == infinite #=> true +1/infinite #=> 0 + +nan == nan #=> false # N.B. diff --git a/Task/Extreme-floating-point-values/jq/extreme-floating-point-values-4.jq b/Task/Extreme-floating-point-values/jq/extreme-floating-point-values-4.jq new file mode 100644 index 0000000000..e1b76a66c3 --- /dev/null +++ b/Task/Extreme-floating-point-values/jq/extreme-floating-point-values-4.jq @@ -0,0 +1,2 @@ +nan | isnan #=> true +infinite | isnan #=> false diff --git a/Task/Extreme-floating-point-values/jq/extreme-floating-point-values-5.jq b/Task/Extreme-floating-point-values/jq/extreme-floating-point-values-5.jq new file mode 100644 index 0000000000..db84a902e7 --- /dev/null +++ b/Task/Extreme-floating-point-values/jq/extreme-floating-point-values-5.jq @@ -0,0 +1,2 @@ +infinite as $inf | 1 / $inf #=> 0 +-0 as $z | $z #=> -0 diff --git a/Task/Factorial/AntLang/factorial.antlang b/Task/Factorial/AntLang/factorial.antlang new file mode 100644 index 0000000000..46431ae9d0 --- /dev/null +++ b/Task/Factorial/AntLang/factorial.antlang @@ -0,0 +1 @@ +factorial:{1 */ 1+range[x]} /Call: factorial[1000] diff --git a/Task/Factorial/Apex/factorial-1.apex b/Task/Factorial/Apex/factorial-1.apex new file mode 100644 index 0000000000..a857111e51 --- /dev/null +++ b/Task/Factorial/Apex/factorial-1.apex @@ -0,0 +1,11 @@ +public static long fact(final Integer n) { + if (n < 0) { + System.debug('No negative numbers'); + return 0; + } + long ans = 1; + for (Integer i = 1; i <= n; i++) { + ans *= i; + } + return ans; +} diff --git a/Task/Factorial/Apex/factorial-2.apex b/Task/Factorial/Apex/factorial-2.apex new file mode 100644 index 0000000000..87abfcf31d --- /dev/null +++ b/Task/Factorial/Apex/factorial-2.apex @@ -0,0 +1,7 @@ +public static long factRec(final Integer n) { + if (n < 0){ + System.debug('No negative numbers'); + return 0; + } + return (n < 2) ? 1 : n * fact(n - 1); +} diff --git a/Task/Factorial/Axe/factorial-1.axe b/Task/Factorial/Axe/factorial-1.axe new file mode 100644 index 0000000000..fd9f94a6fc --- /dev/null +++ b/Task/Factorial/Axe/factorial-1.axe @@ -0,0 +1,7 @@ +Lbl FACT +1→R +For(I,1,r₁) + R*I→R +End +R +Return diff --git a/Task/Factorial/Axe/factorial-2.axe b/Task/Factorial/Axe/factorial-2.axe new file mode 100644 index 0000000000..ed48b6cf10 --- /dev/null +++ b/Task/Factorial/Axe/factorial-2.axe @@ -0,0 +1,3 @@ +Lbl FACT +r₁??1,r₁*FACT(r₁-1) +Return diff --git a/Task/Factorial/Ceylon/factorial.ceylon b/Task/Factorial/Ceylon/factorial.ceylon new file mode 100644 index 0000000000..3396b5e356 --- /dev/null +++ b/Task/Factorial/Ceylon/factorial.ceylon @@ -0,0 +1,20 @@ +shared void run() { + + Integer? recursiveFactorial(Integer n) => + switch(n <=> 0) + case(smaller) null + case(equal) 1 + case(larger) if(exists f = recursiveFactorial(n - 1)) then n * f else null; + + + Integer? iterativeFactorial(Integer n) => + switch(n <=> 0) + case(smaller) null + case(equal) 1 + case(larger) (1:n).reduce(times); + + for(Integer i in 0..10) { + print("the iterative factorial of ``i`` is ``iterativeFactorial(i) else "negative"`` + and the recursive factorial of ``i`` is ``recursiveFactorial(i) else "negative"``\n"); + } +} diff --git a/Task/Factorial/ChucK/factorial-1.chuck b/Task/Factorial/ChucK/factorial-1.chuck new file mode 100644 index 0000000000..3acb171af4 --- /dev/null +++ b/Task/Factorial/ChucK/factorial-1.chuck @@ -0,0 +1,10 @@ +0 => int total; +fun int factorial(int i) +{ + if (i == 0) return 1; + else + { + i * factorial(i - 1) => total; + } + return total; +} diff --git a/Task/Factorial/ChucK/factorial-2.chuck b/Task/Factorial/ChucK/factorial-2.chuck new file mode 100644 index 0000000000..fb98291800 --- /dev/null +++ b/Task/Factorial/ChucK/factorial-2.chuck @@ -0,0 +1,10 @@ +1 => int total; +fun int factorial(int i) +{ + while(i > 0) + { + total * i => total; + 1 -=> i; + } + return total; +} diff --git a/Task/Factorial/Comal/factorial.comal b/Task/Factorial/Comal/factorial.comal new file mode 100644 index 0000000000..4d50b02927 --- /dev/null +++ b/Task/Factorial/Comal/factorial.comal @@ -0,0 +1,7 @@ + PROC Recursive(n) CLOSED + r:=1 + IF n>1 THEN + r:=n*Recursive(n-1) + ENDIF + RETURN r + ENDPROC Recursive diff --git a/Task/Factorial/Computer-zero-Assembly/factorial-1.computer b/Task/Factorial/Computer-zero-Assembly/factorial-1.computer new file mode 100644 index 0000000000..e1acee1ba3 --- /dev/null +++ b/Task/Factorial/Computer-zero-Assembly/factorial-1.computer @@ -0,0 +1,43 @@ + LDA x + BRZ done_i ; 0! = 1 + + STA i + +loop_i: LDA fact + STA n + + LDA i + SUB one + BRZ done_i + + STA j + +loop_j: LDA fact + ADD n + STA fact + + LDA j + SUB one + BRZ done_j + + STA j + JMP loop_j + +done_j: LDA i + SUB one + STA i + + JMP loop_i + +done_i: LDA fact + STP + +one: 1 + +fact: 1 + +i: 0 +j: 0 +n: 0 + +x: 5 diff --git a/Task/Factorial/Computer-zero-Assembly/factorial-2.computer b/Task/Factorial/Computer-zero-Assembly/factorial-2.computer new file mode 100644 index 0000000000..f50eb021d5 --- /dev/null +++ b/Task/Factorial/Computer-zero-Assembly/factorial-2.computer @@ -0,0 +1,15 @@ + LDA load + ADD x + STA load + +load: LDA fact + STP + +fact: 1 + 1 + 2 + 6 + 24 + 120 + +x: 5 diff --git a/Task/Factorial/ERRE/factorial-1.erre b/Task/Factorial/ERRE/factorial-1.erre new file mode 100644 index 0000000000..26c38ade35 --- /dev/null +++ b/Task/Factorial/ERRE/factorial-1.erre @@ -0,0 +1,8 @@ + PROCEDURE FACTORIAL(X%->F) + F=1 + IF X%<>0 THEN + FOR I%=X% TO 2 STEP Ä1 DO + F=F*X% + END FOR + END IF + END PROCEDURE diff --git a/Task/Factorial/ERRE/factorial-2.erre b/Task/Factorial/ERRE/factorial-2.erre new file mode 100644 index 0000000000..97e33b49ba --- /dev/null +++ b/Task/Factorial/ERRE/factorial-2.erre @@ -0,0 +1,4 @@ + PROCEDURE FACTORIAL(FACT,X%->FACT) + IF X%>1 THEN FACTORIAL(X%*FACT,X%-1->FACT) + END IF + END PROCEDURE diff --git a/Task/Factorial/EchoLisp/factorial-1.echolisp b/Task/Factorial/EchoLisp/factorial-1.echolisp new file mode 100644 index 0000000000..9a1211270e --- /dev/null +++ b/Task/Factorial/EchoLisp/factorial-1.echolisp @@ -0,0 +1,4 @@ +(define (fact n) + (for/product ((f (in-range 2 (1+ n)))) f)) +(fact 10) + → 3628800 diff --git a/Task/Factorial/EchoLisp/factorial-2.echolisp b/Task/Factorial/EchoLisp/factorial-2.echolisp new file mode 100644 index 0000000000..5a4d303f5f --- /dev/null +++ b/Task/Factorial/EchoLisp/factorial-2.echolisp @@ -0,0 +1,6 @@ +(define (fact n) + (if (zero? n) 1 + (* n (fact (1- n))))) +(remember 'fact) +(fact 10) + → 3628800 diff --git a/Task/Factorial/EchoLisp/factorial-3.echolisp b/Task/Factorial/EchoLisp/factorial-3.echolisp new file mode 100644 index 0000000000..c53826d9a0 --- /dev/null +++ b/Task/Factorial/EchoLisp/factorial-3.echolisp @@ -0,0 +1,5 @@ +(define (fact n (acc 1)) +(if (zero? n) acc + (fact (1- n) (* n acc)))) +(fact 10) + → 3628800 diff --git a/Task/Factorial/EchoLisp/factorial-4.echolisp b/Task/Factorial/EchoLisp/factorial-4.echolisp new file mode 100644 index 0000000000..26e0e0da4f --- /dev/null +++ b/Task/Factorial/EchoLisp/factorial-4.echolisp @@ -0,0 +1,2 @@ +(factorial 10) + → 3628800 diff --git a/Task/Factorial/EchoLisp/factorial-5.echolisp b/Task/Factorial/EchoLisp/factorial-5.echolisp new file mode 100644 index 0000000000..c5746b475b --- /dev/null +++ b/Task/Factorial/EchoLisp/factorial-5.echolisp @@ -0,0 +1,4 @@ +(lib 'math) +math.lib v1.13 ® EchoLisp +(gamma 11) + → 3628800.0000000005 diff --git a/Task/Factorial/Elm/factorial.elm b/Task/Factorial/Elm/factorial.elm new file mode 100644 index 0000000000..0856a97d1c --- /dev/null +++ b/Task/Factorial/Elm/factorial.elm @@ -0,0 +1,3 @@ +factorial : Int -> Int +factorial n = + if n < 1 then 1 else n*factorial(n-1) diff --git a/Task/Factorial/Ezhil/factorial.ezhil b/Task/Factorial/Ezhil/factorial.ezhil new file mode 100644 index 0000000000..6ed864be16 --- /dev/null +++ b/Task/Factorial/Ezhil/factorial.ezhil @@ -0,0 +1,9 @@ +நிரல்பாகம் fact ( n ) + @( n == 0 ) ஆனால் + பின்கொடு 1 + இல்லை + பின்கொடு n*fact( n - 1 ) + முடி +முடி + +பதிப்பி fact ( 10 ) diff --git a/Task/Factorial/FreeBASIC/factorial.freebasic b/Task/Factorial/FreeBASIC/factorial.freebasic new file mode 100644 index 0000000000..2603203641 --- /dev/null +++ b/Task/Factorial/FreeBASIC/factorial.freebasic @@ -0,0 +1,27 @@ +' FB 1.05.0 Win64 + +Function Factorial_Iterative(n As Integer) As Integer + Var result = 1 + For i As Integer = 2 To n + result *= i + Next + Return result +End Function + +Function Factorial_Recursive(n As Integer) As Integer + If n = 0 Then Return 1 + Return n * Factorial_Recursive(n - 1) +End Function + +For i As Integer = 1 To 5 + Print i; " =>"; Factorial_Iterative(i) +Next + +For i As Integer = 6 To 10 + Print Using "##"; i; + Print " =>"; Factorial_Recursive(i) +Next + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Factorial/FunL/factorial-1.funl b/Task/Factorial/FunL/factorial-1.funl new file mode 100644 index 0000000000..aa3fb5e87b --- /dev/null +++ b/Task/Factorial/FunL/factorial-1.funl @@ -0,0 +1,10 @@ +def factorial( n ) = + if n < 0 + error( 'factorial: n should be non-negative' ) + else + res = 1 + + for i <- 2..n + res *= i + + res diff --git a/Task/Factorial/FunL/factorial-2.funl b/Task/Factorial/FunL/factorial-2.funl new file mode 100644 index 0000000000..ac42375af3 --- /dev/null +++ b/Task/Factorial/FunL/factorial-2.funl @@ -0,0 +1,5 @@ +def + factorial( (0|1) ) = 1 + factorial( n ) + | n > 0 = n*factorial( n - 1 ) + | otherwise = error( 'factorial: n should be non-negative' ) diff --git a/Task/Factorial/FunL/factorial-3.funl b/Task/Factorial/FunL/factorial-3.funl new file mode 100644 index 0000000000..5beb9c419b --- /dev/null +++ b/Task/Factorial/FunL/factorial-3.funl @@ -0,0 +1,8 @@ +def factorial( n ) + | n >= 0 = + def + fact( acc, 0 ) = acc + fact( acc, n ) = fact( acc*n, n - 1 ) + + fact( 1, n ) + | otherwise = error( 'factorial: n should be non-negative' ) diff --git a/Task/Factorial/FunL/factorial-4.funl b/Task/Factorial/FunL/factorial-4.funl new file mode 100644 index 0000000000..b8134c71cd --- /dev/null +++ b/Task/Factorial/FunL/factorial-4.funl @@ -0,0 +1,3 @@ +def factorial( n ) + | n >= 0 = product( 1..n ) + | otherwise = error( 'factorial: n should be non-negative' ) diff --git a/Task/Factorial/Futhark/factorial-1.futhark b/Task/Factorial/Futhark/factorial-1.futhark new file mode 100644 index 0000000000..dcb1b93f45 --- /dev/null +++ b/Task/Factorial/Futhark/factorial-1.futhark @@ -0,0 +1,3 @@ +fun fact(n: int): int = + if n == 0 then 1 + else n * fact(n-1) diff --git a/Task/Factorial/Futhark/factorial-2.futhark b/Task/Factorial/Futhark/factorial-2.futhark new file mode 100644 index 0000000000..d8f05241c3 --- /dev/null +++ b/Task/Factorial/Futhark/factorial-2.futhark @@ -0,0 +1,4 @@ +fun fact(n: int): int = + loop (out = 1) = for i < n do + out * (i+1) + in out diff --git a/Task/Factorial/FutureBasic/factorial.futurebasic b/Task/Factorial/FutureBasic/factorial.futurebasic new file mode 100644 index 0000000000..7fdad47e9f --- /dev/null +++ b/Task/Factorial/FutureBasic/factorial.futurebasic @@ -0,0 +1,33 @@ +include "ConsoleWindow" + +local fn factorialIterative( n as long ) as double +dim as double f +dim as long i + +if ( n > 1 ) + f = 1 + for i = 2 To n + f = f * i + next i +else + f = 1 +end if +end fn = f + +local fn factorialRecursive( n as long ) as double +dim as double f + +if ( n < 2 ) + f = 1 +else + f = n * fn factorialRecursive( n -1 ) +end if +end fn = f + +dim as long i + +for i = 0 to 12 + print "Iterative:"; using "####"; i; " ="; fn factorialIterative( i ) + print "Recursive:"; using "####"; i; " ="; fn factorialRecursive( i ) + print +next i diff --git a/Task/Factorial/I/factorial.i b/Task/Factorial/I/factorial.i new file mode 100644 index 0000000000..d30cf7e00d --- /dev/null +++ b/Task/Factorial/I/factorial.i @@ -0,0 +1,18 @@ +function fact(n, acc) r { + if n = 0 + return acc + end + return fact(n-1, n*acc) +} + +function factorial(n) r { + return fact(n, 1) +} + +software { + print(factorial(0)) + print(factorial(1)) + print(factorial(2)) + print(factorial(3)) + print(factorial(22)) +} diff --git a/Task/Factorial/JOVIAL/factorial.jovial b/Task/Factorial/JOVIAL/factorial.jovial new file mode 100644 index 0000000000..8d0cf1e016 --- /dev/null +++ b/Task/Factorial/JOVIAL/factorial.jovial @@ -0,0 +1,9 @@ +PROC FACTORIAL(ARG) U; + BEGIN + ITEM ARG U; + ITEM TEMP U; + TEMP = 1; + FOR I:2 BY 1 WHILE I<=ARG; + TEMP = TEMP*I; + FACTORIAL = TEMP; + END diff --git a/Task/Factorial/Klong/factorial.klong b/Task/Factorial/Klong/factorial.klong new file mode 100644 index 0000000000..4d7e8f4f08 --- /dev/null +++ b/Task/Factorial/Klong/factorial.klong @@ -0,0 +1,2 @@ + factRecursive::{:[x>1;x*_.f(x-1);1]} + factIterative::{*/1+!x} diff --git a/Task/Factorial/LFE/factorial-1.lfe b/Task/Factorial/LFE/factorial-1.lfe new file mode 100644 index 0000000000..b94617dedb --- /dev/null +++ b/Task/Factorial/LFE/factorial-1.lfe @@ -0,0 +1,4 @@ +(defun factorial (n) + (cond + ((== n 0) 1) + ((> n 0) (* n (factorial (- n 1)))))) diff --git a/Task/Factorial/LFE/factorial-2.lfe b/Task/Factorial/LFE/factorial-2.lfe new file mode 100644 index 0000000000..c6d1d9e15b --- /dev/null +++ b/Task/Factorial/LFE/factorial-2.lfe @@ -0,0 +1,4 @@ +(defun factorial + ((n) (when (== n 0)) 1) + ((n) (when (> n 0)) + (* n (factorial (- n 1))))) diff --git a/Task/Factorial/LFE/factorial-3.lfe b/Task/Factorial/LFE/factorial-3.lfe new file mode 100644 index 0000000000..05500671aa --- /dev/null +++ b/Task/Factorial/LFE/factorial-3.lfe @@ -0,0 +1,4 @@ +(defun factorial + ((0) 1) + ((n) (when (> n 0)) + (* n (factorial (- n 1))))) diff --git a/Task/Factorial/LFE/factorial-4.lfe b/Task/Factorial/LFE/factorial-4.lfe new file mode 100644 index 0000000000..14668cd4da --- /dev/null +++ b/Task/Factorial/LFE/factorial-4.lfe @@ -0,0 +1,7 @@ +(defun factorial (n) + (factorial n 1)) + +(defun factorial + ((0 acc) acc) + ((n acc) (when (> n 0)) + (factorial (- n 1) (* n acc)))) diff --git a/Task/Factorial/LFE/factorial-5.lfe b/Task/Factorial/LFE/factorial-5.lfe new file mode 100644 index 0000000000..3b6686afc0 --- /dev/null +++ b/Task/Factorial/LFE/factorial-5.lfe @@ -0,0 +1,12 @@ +> (lists:map #'factorial/1 (lists:seq 10 20)) +(3628800 + 39916800 + 479001600 + 6227020800 + 87178291200 + 1307674368000 + 20922789888000 + 355687428096000 + 6402373705728000 + 121645100408832000 + 2432902008176640000) diff --git a/Task/Factorial/LFE/factorial-6.lfe b/Task/Factorial/LFE/factorial-6.lfe new file mode 100644 index 0000000000..19faf9d1ab --- /dev/null +++ b/Task/Factorial/LFE/factorial-6.lfe @@ -0,0 +1,16 @@ +> (lists:foreach + (lambda (x) + (io:format '"~p~n" `(,(factorial x)))) + (lists:seq 10 20)) +3628800 +39916800 +479001600 +6227020800 +87178291200 +1307674368000 +20922789888000 +355687428096000 +6402373705728000 +121645100408832000 +2432902008176640000 +ok diff --git a/Task/Factorial/Lasso/factorial-1.lasso b/Task/Factorial/Lasso/factorial-1.lasso new file mode 100644 index 0000000000..427fad8e2e --- /dev/null +++ b/Task/Factorial/Lasso/factorial-1.lasso @@ -0,0 +1,8 @@ +define factorial(n) => { + local(x = 1) + with i in generateSeries(2, #n) + do { + #x *= #i + } + return #x +} diff --git a/Task/Factorial/Lasso/factorial-2.lasso b/Task/Factorial/Lasso/factorial-2.lasso new file mode 100644 index 0000000000..18cea7152b --- /dev/null +++ b/Task/Factorial/Lasso/factorial-2.lasso @@ -0,0 +1 @@ +define factorial(n) => #n < 2 ? 1 | #n * factorial(#n - 1) diff --git a/Task/Factorial/Lingo/factorial-1.lingo b/Task/Factorial/Lingo/factorial-1.lingo new file mode 100644 index 0000000000..e3423d31a7 --- /dev/null +++ b/Task/Factorial/Lingo/factorial-1.lingo @@ -0,0 +1,4 @@ +on fact (n) + if n<=1 then return 1 + return n * fact(n-1) +end diff --git a/Task/Factorial/Lingo/factorial-2.lingo b/Task/Factorial/Lingo/factorial-2.lingo new file mode 100644 index 0000000000..c76b182bb7 --- /dev/null +++ b/Task/Factorial/Lingo/factorial-2.lingo @@ -0,0 +1,7 @@ +on fact (n) + res = 1 + repeat with i = 2 to n + res = res*i + end repeat + return res +end diff --git a/Task/Factorial/LiveCode/factorial.livecode b/Task/Factorial/LiveCode/factorial.livecode new file mode 100644 index 0000000000..d56de1ba7c --- /dev/null +++ b/Task/Factorial/LiveCode/factorial.livecode @@ -0,0 +1,32 @@ +// recursive +function factorialr n + if n < 2 then + return 1 + else + return n * factorialr(n-1) + end if +end factorialr + +// using accumulator +function factorialacc n acc + if n = 0 then + return acc + else + return factorialacc(n-1, n * acc) + end if +end factorialacc + +function factorial n + return factorialacc(n,1) +end factorial + +// iterative +function factorialit n + put 1 into f + if n > 1 then + repeat with i = 1 to n + multiply f by i + end repeat + end if + return f +end factorialit diff --git a/Task/Factorial/Maude/factorial.maude b/Task/Factorial/Maude/factorial.maude new file mode 100644 index 0000000000..50f0c8b9b6 --- /dev/null +++ b/Task/Factorial/Maude/factorial.maude @@ -0,0 +1,15 @@ +fmod FACTORIAL is + + protecting INT . + + op undefined : -> Int . + op _! : Int -> Int . + + var n : Int . + + eq 0 ! = 1 . + eq n ! = if n < 0 then undefined else n * (sd(n, 1) !) fi . + +endfm + +red 11 ! . diff --git a/Task/Factorial/MyrtleScript/factorial.myrtle b/Task/Factorial/MyrtleScript/factorial.myrtle new file mode 100644 index 0000000000..1a0ec6ef9d --- /dev/null +++ b/Task/Factorial/MyrtleScript/factorial.myrtle @@ -0,0 +1,7 @@ +func factorial args: int a : returns: int { + int factorial = a + repeat int i = (a - 1) : i == 0 : i-- { + factorial *= i + } + return factorial +} diff --git a/Task/Factorial/Nim/factorial-1.nim b/Task/Factorial/Nim/factorial-1.nim new file mode 100644 index 0000000000..bc5ab752d8 --- /dev/null +++ b/Task/Factorial/Nim/factorial-1.nim @@ -0,0 +1,3 @@ +proc factorial(x): int = + if x > 0: x * factorial(x - 1) + else: 1 diff --git a/Task/Factorial/Nim/factorial-2.nim b/Task/Factorial/Nim/factorial-2.nim new file mode 100644 index 0000000000..674f69e8f0 --- /dev/null +++ b/Task/Factorial/Nim/factorial-2.nim @@ -0,0 +1,4 @@ +proc factorial(x): int = + result = 1 + for i in 1..x+1: + result *= i diff --git a/Task/Factorial/Oforth/factorial-1.oforth b/Task/Factorial/Oforth/factorial-1.oforth new file mode 100644 index 0000000000..fee1d41078 --- /dev/null +++ b/Task/Factorial/Oforth/factorial-1.oforth @@ -0,0 +1 @@ +: fact(n) n ifZero: [ 1 ] else: [ n n 1- fact * ] ; diff --git a/Task/Factorial/Oforth/factorial-2.oforth b/Task/Factorial/Oforth/factorial-2.oforth new file mode 100644 index 0000000000..99cacae167 --- /dev/null +++ b/Task/Factorial/Oforth/factorial-2.oforth @@ -0,0 +1 @@ +: fact | i | 1 swap loop: i [ i * ] ; diff --git a/Task/Factorial/Panda/factorial.panda b/Task/Factorial/Panda/factorial.panda new file mode 100644 index 0000000000..d4e7ab930d --- /dev/null +++ b/Task/Factorial/Panda/factorial.panda @@ -0,0 +1,4 @@ +fun fac(n) type integer->integer + product{{1..n}} + +1..10.fac diff --git a/Task/Factorial/Peloton/factorial-1.peloton b/Task/Factorial/Peloton/factorial-1.peloton new file mode 100644 index 0000000000..689459dd2c --- /dev/null +++ b/Task/Factorial/Peloton/factorial-1.peloton @@ -0,0 +1 @@ +<@ SAYFCTLIT>5 diff --git a/Task/Factorial/Peloton/factorial-2.peloton b/Task/Factorial/Peloton/factorial-2.peloton new file mode 100644 index 0000000000..006917e3a4 --- /dev/null +++ b/Task/Factorial/Peloton/factorial-2.peloton @@ -0,0 +1,2 @@ +<@ DEFUDOLITLIT>FAT|__Transformer|<@ LETSCPLIT>result|1<@ ITEFORPARLIT>1|<@ ACTMULSCPPOSFOR>result|...<@ LETRESSCP>...|result +<@ SAYFATLIT>123 diff --git a/Task/Factorial/Phix/factorial.phix b/Task/Factorial/Phix/factorial.phix new file mode 100644 index 0000000000..8e8d472c5a --- /dev/null +++ b/Task/Factorial/Phix/factorial.phix @@ -0,0 +1,8 @@ +global function factorial(integer n) +atom res = 1 + while n>1 do + res *= n + n -= 1 + end while + return res +end function diff --git a/Task/Factorial/Rapira/factorial-1.rapira b/Task/Factorial/Rapira/factorial-1.rapira new file mode 100644 index 0000000000..24d8286b70 --- /dev/null +++ b/Task/Factorial/Rapira/factorial-1.rapira @@ -0,0 +1,7 @@ +Фун Факт(n) + f := 1 + для i от 1 до n + f := f * i + кц + Возврат f +Кон Фун diff --git a/Task/Factorial/Rapira/factorial-2.rapira b/Task/Factorial/Rapira/factorial-2.rapira new file mode 100644 index 0000000000..6d21075f66 --- /dev/null +++ b/Task/Factorial/Rapira/factorial-2.rapira @@ -0,0 +1,13 @@ +Фун Факт(n) + Если n = 1 + Возврат 1 + Иначе + Возврат n * Факт(n - 1) + Всё +Кон Фун + +Проц Старт() + n := ВводЦел('Введите число (n <= 12) :') + печать 'n! = ' + печать Факт(n) +Кон проц diff --git a/Task/Factorial/Ring/factorial.ring b/Task/Factorial/Ring/factorial.ring new file mode 100644 index 0000000000..1fb1d207cc --- /dev/null +++ b/Task/Factorial/Ring/factorial.ring @@ -0,0 +1,5 @@ +give n +x = fact(n) +see n + " factorial is : " + x + +func fact nr if nr = 1 return 1 else return nr * fact(nr-1) ok diff --git a/Task/Factorial/SSEM/factorial.ssem b/Task/Factorial/SSEM/factorial.ssem new file mode 100644 index 0000000000..f8a21dbc2d --- /dev/null +++ b/Task/Factorial/SSEM/factorial.ssem @@ -0,0 +1,22 @@ +11100000000000100000000000000000 0. -7 to c +10101000000000010000000000000000 1. Sub. 21 +10100000000001100000000000000000 2. c to 5 +10100000000000100000000000000000 3. -5 to c +10100000000001100000000000000000 4. c to 5 +00000000000000000000000000000000 5. generated at run time +00000000000001110000000000000000 6. Stop +00010000000000100000000000000000 7. -8 to c +11111111111111111111111111111111 8. -1 +11111111111111111111111111111111 9. -1 +01111111111111111111111111111111 10. -2 +01011111111111111111111111111111 11. -6 +00010111111111111111111111111111 12. -24 +00010001111111111111111111111111 13. -120 +00001100101111111111111111111111 14. -720 +00001010001101111111111111111111 15. -5040 +00000001010001101111111111111111 16. -40320 +00000001011011100101111111111111 17. -362880 +00000000100001010001001111111111 18. -3628800 +00000000110101110111100110111111 19. -39916800 +00000000001000001100111011000111 20. -479001600 +01010000000000000000000000000000 21. 10 diff --git a/Task/Factorial/SequenceL/factorial-1.sequencel b/Task/Factorial/SequenceL/factorial-1.sequencel new file mode 100644 index 0000000000..c425d408e0 --- /dev/null +++ b/Task/Factorial/SequenceL/factorial-1.sequencel @@ -0,0 +1 @@ +factorial(n) := product(1 ... n); diff --git a/Task/Factorial/SequenceL/factorial-2.sequencel b/Task/Factorial/SequenceL/factorial-2.sequencel new file mode 100644 index 0000000000..4b75ff3665 --- /dev/null +++ b/Task/Factorial/SequenceL/factorial-2.sequencel @@ -0,0 +1 @@ +factorials(n)[i] := product(1 ... i) foreach i within 1 ... n; diff --git a/Task/Factorial/SequenceL/factorial-3.sequencel b/Task/Factorial/SequenceL/factorial-3.sequencel new file mode 100644 index 0000000000..ba89a4bce3 --- /dev/null +++ b/Task/Factorial/SequenceL/factorial-3.sequencel @@ -0,0 +1,5 @@ +factorial: int -> int; +factorial(n) := + 1 when n <= 0 + else + n * factorial(n-1); diff --git a/Task/Factorial/SequenceL/factorial-4.sequencel b/Task/Factorial/SequenceL/factorial-4.sequencel new file mode 100644 index 0000000000..4df24abf0d --- /dev/null +++ b/Task/Factorial/SequenceL/factorial-4.sequencel @@ -0,0 +1,7 @@ +factorial(n) := + factorialHelper(1, n); + +factorialHelper(acc, n) := + acc when n <= 0 + else + factorialHelper(acc * n, n-1); diff --git a/Task/Factorial/Shen/factorial.shen b/Task/Factorial/Shen/factorial.shen new file mode 100644 index 0000000000..510d47eca3 --- /dev/null +++ b/Task/Factorial/Shen/factorial.shen @@ -0,0 +1,3 @@ +(define factorial + 0 -> 1 + X -> (* X (factorial (- X 1)))) diff --git a/Task/Factorial/Sidef/factorial.sidef b/Task/Factorial/Sidef/factorial.sidef new file mode 100644 index 0000000000..0d91366547 --- /dev/null +++ b/Task/Factorial/Sidef/factorial.sidef @@ -0,0 +1,19 @@ +# Recursive +func factorial_recursive(n) { + n == 0 ? 1 : (n * __FUNC__(n-1)); +} + +# Iterative with Array#reduce +func factorial_reduce(n) { + 1..n -> reduce('*'); +} + +# Iterative with Block#repeat +func factorial_iterative(n) { + var f = 1; + {|i| f *= i } * n; + return f; +} + +# Built-in Number#factorial: +say 5!; diff --git a/Task/Factorial/Swift/factorial-1.swift b/Task/Factorial/Swift/factorial-1.swift new file mode 100644 index 0000000000..3e18273713 --- /dev/null +++ b/Task/Factorial/Swift/factorial-1.swift @@ -0,0 +1,4 @@ +func factorial(num: Int) -> Int { + + return num < 1 ? 1 : reduce(1...num, 1, *) +} diff --git a/Task/Factorial/Swift/factorial-2.swift b/Task/Factorial/Swift/factorial-2.swift new file mode 100644 index 0000000000..8d87119921 --- /dev/null +++ b/Task/Factorial/Swift/factorial-2.swift @@ -0,0 +1,4 @@ +func factorial(num: Int) -> Int { + + return num < 1 ? 1 : num * factorial(num - 1) +} diff --git a/Task/Factorial/Ursa/factorial-1.ursa b/Task/Factorial/Ursa/factorial-1.ursa new file mode 100644 index 0000000000..ab4f2501c5 --- /dev/null +++ b/Task/Factorial/Ursa/factorial-1.ursa @@ -0,0 +1,9 @@ +def factorial (int n) + decl int result + set result 1 + decl int i + for (set i 1) (< i (+ n 1)) (inc i) + set result (* result i) + end + return result +end diff --git a/Task/Factorial/Ursa/factorial-2.ursa b/Task/Factorial/Ursa/factorial-2.ursa new file mode 100644 index 0000000000..66646d9398 --- /dev/null +++ b/Task/Factorial/Ursa/factorial-2.ursa @@ -0,0 +1,8 @@ +def factorial (int n) + decl int z + set z 1 + if (> n 1) + set z (* n (factorial (- n 1))) + end if + return z +end diff --git a/Task/Factorial/Wart/factorial-1.wart b/Task/Factorial/Wart/factorial-1.wart new file mode 100644 index 0000000000..b7d29e0d2b --- /dev/null +++ b/Task/Factorial/Wart/factorial-1.wart @@ -0,0 +1,4 @@ +def (fact n) + if (n = 0) + 1 + (n * (fact n-1)) diff --git a/Task/Factorial/Wart/factorial-2.wart b/Task/Factorial/Wart/factorial-2.wart new file mode 100644 index 0000000000..6bba4a20c0 --- /dev/null +++ b/Task/Factorial/Wart/factorial-2.wart @@ -0,0 +1,5 @@ +def (fact n) + (n * (fact n-1)) + +def (fact 0) + 1 diff --git a/Task/Factorial/Wart/factorial-3.wart b/Task/Factorial/Wart/factorial-3.wart new file mode 100644 index 0000000000..f51430b26d --- /dev/null +++ b/Task/Factorial/Wart/factorial-3.wart @@ -0,0 +1,4 @@ +def (fact n) + ret result 1 + for i 1 (i <= n) ++i + result <- result*i diff --git a/Task/Factorial/Wart/factorial-4.wart b/Task/Factorial/Wart/factorial-4.wart new file mode 100644 index 0000000000..68d3f32c55 --- /dev/null +++ b/Task/Factorial/Wart/factorial-4.wart @@ -0,0 +1,7 @@ +# a useful helper to generate all the natural numbers until n +def (nums n) + collect+for i 1 (i <= n) ++i + yield i + +def (fact n) + (reduce (*) nums.n 1) diff --git a/Task/Factorial/Wortel/factorial-1.wortel b/Task/Factorial/Wortel/factorial-1.wortel new file mode 100644 index 0000000000..50e646b386 --- /dev/null +++ b/Task/Factorial/Wortel/factorial-1.wortel @@ -0,0 +1 @@ +@fac 10 diff --git a/Task/Factorial/Wortel/factorial-2.wortel b/Task/Factorial/Wortel/factorial-2.wortel new file mode 100644 index 0000000000..9700a8422c --- /dev/null +++ b/Task/Factorial/Wortel/factorial-2.wortel @@ -0,0 +1 @@ +!#~F 10 diff --git a/Task/Factorial/Wortel/factorial-3.wortel b/Task/Factorial/Wortel/factorial-3.wortel new file mode 100644 index 0000000000..5c168055a2 --- /dev/null +++ b/Task/Factorial/Wortel/factorial-3.wortel @@ -0,0 +1,3 @@ +!/^* @to 10 +; or +@prod @to 10 diff --git a/Task/Factorial/Wortel/factorial-4.wortel b/Task/Factorial/Wortel/factorial-4.wortel new file mode 100644 index 0000000000..ad829531fe --- /dev/null +++ b/Task/Factorial/Wortel/factorial-4.wortel @@ -0,0 +1,6 @@ +~!10 &n [ + @var r 1 + @for x to n + :!*r x + r +] diff --git a/Task/Factorial/Wortel/factorial-5.wortel b/Task/Factorial/Wortel/factorial-5.wortel new file mode 100644 index 0000000000..c458b4f0f3 --- /dev/null +++ b/Task/Factorial/Wortel/factorial-5.wortel @@ -0,0 +1,14 @@ +@let { + fac &{fac n}?{ + q + #f )) + +(m-divisor 929) + → 13007 +(m-divisor 4423) + → #f + +(lib 'bigint) +(prime? (1- (expt 2 4423))) ;; 2^4423 -1 is a Mersenne prime + → #t diff --git a/Task/Factors-of-a-Mersenne-number/FreeBASIC/factors-of-a-mersenne-number.freebasic b/Task/Factors-of-a-Mersenne-number/FreeBASIC/factors-of-a-mersenne-number.freebasic new file mode 100644 index 0000000000..7cb048b28e --- /dev/null +++ b/Task/Factors-of-a-Mersenne-number/FreeBASIC/factors-of-a-mersenne-number.freebasic @@ -0,0 +1,45 @@ +' FB 1.05.0 Win64 + +Function isPrime(n As Integer) As Boolean + If n Mod 2 = 0 Then Return n = 2 + If n Mod 3 = 0 Then Return n = 3 + Dim d As Integer = 5 + While d * d <= n + If n Mod d = 0 Then Return False + d += 2 + If n Mod d = 0 Then Return False + d += 4 + Wend + Return True +End Function + +' test 929 plus all prime numbers below 100 which are known not to be Mersenne primes +Dim q(1 To 16) As Integer = {11, 23, 29, 37, 41, 43, 47, 53, 59, 67, 71, 73, 79, 83, 97, 929} +For k As Integer = 1 To 16 + If isPrime(q(k)) Then + Dim As Integer d, i, p, r = q(k) + While r > 0 : r Shl= 1 : Wend + d = 2 * q(k) + 1 + Do + i = 1 + p = r + While p <> 0 + i = (i * i) Mod d + If p < 0 Then i *= 2 + If i > d Then i -= d + p Shl= 1 + Wend + If i <> 1 Then + d += 2 * q(k) + Else + Exit Do + End If + Loop + Print "2^"; Str(q(k)); Tab(6); " - 1 = 0 (mod"; d; ")" + Else + Print Str(q(k)); " is not prime" + End If +Next +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Factors-of-a-Mersenne-number/Nim/factors-of-a-mersenne-number.nim b/Task/Factors-of-a-Mersenne-number/Nim/factors-of-a-mersenne-number.nim new file mode 100644 index 0000000000..1e50f7ec97 --- /dev/null +++ b/Task/Factors-of-a-Mersenne-number/Nim/factors-of-a-mersenne-number.nim @@ -0,0 +1,26 @@ +import math + +proc isPrime(a: int): bool = + if a == 2: return true + if a < 2 or a mod 2 == 0: return false + for i in countup(3, int sqrt(float a), 2): + if a mod i == 0: + return false + return true + +const q = 929 +if not isPrime q: quit 1 +var r = q +while r > 0: r = r shl 1 +var d = 2 * q + 1 +while true: + var i = 1 + var p = r + while p != 0: + i = (i * i) mod d + if p < 0: i *= 2 + if i > d: i -= d + p = p shl 1 + if i != 1: d += 2 * q + else: break +echo "2^",q," - 1 = 0 (mod ",d,")" diff --git a/Task/Factors-of-a-Mersenne-number/Sidef/factors-of-a-mersenne-number.sidef b/Task/Factors-of-a-Mersenne-number/Sidef/factors-of-a-mersenne-number.sidef new file mode 100644 index 0000000000..2811aac19a --- /dev/null +++ b/Task/Factors-of-a-Mersenne-number/Sidef/factors-of-a-mersenne-number.sidef @@ -0,0 +1,21 @@ +func mtest(b, p) { + var bits = b.base(2).to_i.digits + for (var sq = 1; bits; sq %= p) { + sq *= sq; + sq += sq if bits.shift.is_one + } + sq == 1 +} + +for m in (2..60 -> grep{.is_prime} + [929]) { + var f = 0 + var x = (2**m - 1) + var q + Inf.times { |k| + q = (2*k*m + 1) + q%8 ~~ [1,7] || q.is_prime || next + q*q > x || (f = mtest(m, q)) && break + } + say (f ? "M#{m} is composite with factor #{q}" + : "M#{m} is prime") +} diff --git a/Task/Factors-of-an-integer/Ceylon/factors-of-an-integer.ceylon b/Task/Factors-of-an-integer/Ceylon/factors-of-an-integer.ceylon new file mode 100644 index 0000000000..8237883f54 --- /dev/null +++ b/Task/Factors-of-an-integer/Ceylon/factors-of-an-integer.ceylon @@ -0,0 +1,8 @@ +shared void run() { + {Integer*} getFactors(Integer n) => + (1..n).filter((Integer element) => element.divides(n)); + + for(Integer i in 1..100) { + print("the factors of ``i`` are ``getFactors(i)``"); + } +} diff --git a/Task/Factors-of-an-integer/ERRE/factors-of-an-integer.erre b/Task/Factors-of-an-integer/ERRE/factors-of-an-integer.erre new file mode 100644 index 0000000000..c9a5e2e104 --- /dev/null +++ b/Task/Factors-of-an-integer/ERRE/factors-of-an-integer.erre @@ -0,0 +1,43 @@ +PROGRAM FACTORS + +!$DOUBLE + +PROCEDURE FACTORLIST(N->L$) + + LOCAL C%,I,FLIPS%,I% + LOCAL DIM L[32] + FOR I=1 TO SQR(N) DO + IF N=I*INT(N/I) THEN + L[C%]=I + C%=C%+1 + IF N<>I*I THEN + L[C%]=INT(N/I) + C%=C%+1 + END IF + END IF + END FOR + + ! BUBBLE SORT ARRAY L[] + FLIPS%=1 + WHILE FLIPS%>0 DO + FLIPS%=0 + FOR I%=0 TO C%-2 DO + IF L[I%]>L[I%+1] THEN SWAP(L[I%],L[I%+1]) FLIPS%=1 + END FOR + END WHILE + + L$="" + FOR I%=0 TO C%-1 DO + L$=L$+STR$(L[I%])+"," + END FOR + L$=LEFT$(L$,LEN(L$)-1) + +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) ! CLS + FACTORLIST(45->L$) + PRINT("The factors of 45 are ";L$) + FACTORLIST(12345->L$) + PRINT("The factors of 12345 are ";L$) +END PROGRAM diff --git a/Task/Factors-of-an-integer/EchoLisp/factors-of-an-integer-1.echolisp b/Task/Factors-of-an-integer/EchoLisp/factors-of-an-integer-1.echolisp new file mode 100644 index 0000000000..69997db2e3 --- /dev/null +++ b/Task/Factors-of-an-integer/EchoLisp/factors-of-an-integer-1.echolisp @@ -0,0 +1,18 @@ +;; ppows +;; input : a list g of grouped prime factors ( 3 3 3 ..) +;; returns (1 3 9 27 ...) + +(define (ppows g (mult 1)) + (for/fold (ppows '(1)) ((a g)) + (set! mult (* mult a)) + (cons mult ppows))) + +;; factors +;; decomp n into ((2 2 ..) ( 3 3 ..) ) prime factors groups +;; combines (1 2 4 8 ..) (1 3 9 ..) lists + +(define (factors n) + (list-sort < + (if (<= n 1) '(1) + (for/fold (divs'(1)) ((g (map ppows (group (prime-factors n))))) + (for*/list ((a divs) (b g)) (* a b)))))) diff --git a/Task/Factors-of-an-integer/EchoLisp/factors-of-an-integer-2.echolisp b/Task/Factors-of-an-integer/EchoLisp/factors-of-an-integer-2.echolisp new file mode 100644 index 0000000000..5c77e73235 --- /dev/null +++ b/Task/Factors-of-an-integer/EchoLisp/factors-of-an-integer-2.echolisp @@ -0,0 +1,10 @@ +(lib 'bigint) +(factors 666) + → (1 2 3 6 9 18 37 74 111 222 333 666) + +(length (factors 108233175859200)) + → 666 ;; 💀 + +(define huge 1200034005600070000008900000000000000000) +(time ( length (factors huge))) + → (394ms 7776) diff --git a/Task/Factors-of-an-integer/FreeBASIC/factors-of-an-integer.freebasic b/Task/Factors-of-an-integer/FreeBASIC/factors-of-an-integer.freebasic new file mode 100644 index 0000000000..496655b7b6 --- /dev/null +++ b/Task/Factors-of-an-integer/FreeBASIC/factors-of-an-integer.freebasic @@ -0,0 +1,20 @@ +' FB 1.05.0 Win64 + +Sub printFactors(n As Integer) + If n < 1 Then Return + Print n; " =>"; + For i As Integer = 1 To n / 2 + If n Mod i = 0 Then Print i; " "; + Next i + Print n +End Sub + +printFactors(11) +printFactors(21) +printFactors(32) +printFactors(45) +printFactors(67) +printFactors(96) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Factors-of-an-integer/FunL/factors-of-an-integer-1.funl b/Task/Factors-of-an-integer/FunL/factors-of-an-integer-1.funl new file mode 100644 index 0000000000..5619961b04 --- /dev/null +++ b/Task/Factors-of-an-integer/FunL/factors-of-an-integer-1.funl @@ -0,0 +1 @@ +def factors( n ) = {d | d <- 1..n if d|n} diff --git a/Task/Factors-of-an-integer/FunL/factors-of-an-integer-2.funl b/Task/Factors-of-an-integer/FunL/factors-of-an-integer-2.funl new file mode 100644 index 0000000000..0edf7caca1 --- /dev/null +++ b/Task/Factors-of-an-integer/FunL/factors-of-an-integer-2.funl @@ -0,0 +1,2 @@ +for x <- [103, 316, 519, 639, 760] + println( 'The set of factors of ' + x + ' is ' + factors(x) ) diff --git a/Task/Factors-of-an-integer/FutureBasic/factors-of-an-integer.futurebasic b/Task/Factors-of-an-integer/FutureBasic/factors-of-an-integer.futurebasic new file mode 100644 index 0000000000..32de4dfae5 --- /dev/null +++ b/Task/Factors-of-an-integer/FutureBasic/factors-of-an-integer.futurebasic @@ -0,0 +1,46 @@ +include "ConsoleWindow" + +clear local mode +local fn IntegerFactors( f as long ) as Str255 +dim as long i, s, l(100), c : c = 0 +dim as Str255 factorStr + +for i = 1 to sqr(f) + if ( f mod i == 0 ) + l(c) = i + c++ + if ( f <> i ^ 2 ) + l(c) = ( f / i ) + c++ + end if + end if +next i +s = 1 +while ( s = 1 ) +s = 0 + for i = 0 to c-1 + if l(i) > l(i+1) and l(i+1) <> 0 + swap l(i), l(i+1) + s = 1 + end if + next i +wend +for i = 0 to c-1 + if ( i < c -1 ) + factorStr = factorStr + str$(l(i)) + "," + else + factorStr = factorStr + str$(l(i)) + end if +next +end fn = factorStr + +print "Factors of 25 are:"; fn IntegerFactors( 25 ) +print "Factors of 45 are:"; fn IntegerFactors( 45 ) +print "Factors of 103 are:"; fn IntegerFactors( 103 ) +print "Factors of 760 are:"; fn IntegerFactors( 760 ) +print "Factors of 12345 are:"; fn IntegerFactors( 12345 ) +print "Factors of 32766 are:"; fn IntegerFactors( 32766 ) +print "Factors of 32767 are:"; fn IntegerFactors( 32767 ) +print "Factors of 57097 are:"; fn IntegerFactors( 57097 ) +print "Factors of 12345678 are:"; fn IntegerFactors( 12345678 ) +print "Factors of 32434243 are:"; fn IntegerFactors( 32434243 ) diff --git a/Task/Factors-of-an-integer/LFE/factors-of-an-integer-1.lfe b/Task/Factors-of-an-integer/LFE/factors-of-an-integer-1.lfe new file mode 100644 index 0000000000..af502f50cd --- /dev/null +++ b/Task/Factors-of-an-integer/LFE/factors-of-an-integer-1.lfe @@ -0,0 +1,4 @@ +(defun factors (n) + (list-comp + ((<- i (when (== 0 (rem n i))) (lists:seq 1 (trunc (/ n 2))))) + i)) diff --git a/Task/Factors-of-an-integer/LFE/factors-of-an-integer-2.lfe b/Task/Factors-of-an-integer/LFE/factors-of-an-integer-2.lfe new file mode 100644 index 0000000000..833cf13059 --- /dev/null +++ b/Task/Factors-of-an-integer/LFE/factors-of-an-integer-2.lfe @@ -0,0 +1,12 @@ +(defun factors (n) + "Tail-recursive prime factors function." + (factors n 2 '())) + +(defun factors + ((1 _ acc) (++ acc '(1))) + ((n _ acc) (when (=< n 0)) + #(error undefined)) + ((n k acc) (when (== 0 (rem n k))) + (factors (div n k) k (cons k acc))) + ((n k acc) + (factors n (+ k 1) acc))) diff --git a/Task/Factors-of-an-integer/Lingo/factors-of-an-integer-1.lingo b/Task/Factors-of-an-integer/Lingo/factors-of-an-integer-1.lingo new file mode 100644 index 0000000000..ec03b87460 --- /dev/null +++ b/Task/Factors-of-an-integer/Lingo/factors-of-an-integer-1.lingo @@ -0,0 +1,8 @@ +on factors(n) + res = [1] + repeat with i = 2 to n/2 + if n mod i = 0 then res.add(i) + end repeat + res.add(n) + return res +end diff --git a/Task/Factors-of-an-integer/Lingo/factors-of-an-integer-2.lingo b/Task/Factors-of-an-integer/Lingo/factors-of-an-integer-2.lingo new file mode 100644 index 0000000000..c467803f92 --- /dev/null +++ b/Task/Factors-of-an-integer/Lingo/factors-of-an-integer-2.lingo @@ -0,0 +1,6 @@ +put factors(45) +-- [1, 3, 5, 9, 15, 45] +put factors(53) +-- [1, 53] +put factors(64) +-- [1, 2, 4, 8, 16, 32, 64] diff --git a/Task/Factors-of-an-integer/Nim/factors-of-an-integer.nim b/Task/Factors-of-an-integer/Nim/factors-of-an-integer.nim new file mode 100644 index 0000000000..98632d3288 --- /dev/null +++ b/Task/Factors-of-an-integer/Nim/factors-of-an-integer.nim @@ -0,0 +1,15 @@ +import intsets, math, algorithm + +proc factors(n): seq[int] = + var fs = initIntSet() + for x in 1 .. int(sqrt(float(n))): + if n mod x == 0: + fs.incl(x) + fs.incl(n div x) + + result = @[] + for x in fs: + result.add(x) + sort(result, system.cmp[int]) + +echo factors(45) diff --git a/Task/Factors-of-an-integer/Oforth/factors-of-an-integer.oforth b/Task/Factors-of-an-integer/Oforth/factors-of-an-integer.oforth new file mode 100644 index 0000000000..1abdb2645d --- /dev/null +++ b/Task/Factors-of-an-integer/Oforth/factors-of-an-integer.oforth @@ -0,0 +1,3 @@ +Integer method: factors self seq filter(#[ self isMultiple ]) ; + +120 factors println diff --git a/Task/Factors-of-an-integer/Panda/factors-of-an-integer.panda b/Task/Factors-of-an-integer/Panda/factors-of-an-integer.panda new file mode 100644 index 0000000000..b3a448707c --- /dev/null +++ b/Task/Factors-of-an-integer/Panda/factors-of-an-integer.panda @@ -0,0 +1,4 @@ +fun factor(n) type integer->integer + f where n.mod(1..n=>f)==0 + +45.factor diff --git a/Task/Factors-of-an-integer/Ring/factors-of-an-integer.ring b/Task/Factors-of-an-integer/Ring/factors-of-an-integer.ring new file mode 100644 index 0000000000..a72833e59e --- /dev/null +++ b/Task/Factors-of-an-integer/Ring/factors-of-an-integer.ring @@ -0,0 +1,11 @@ +nArray = list(100) +n = 45 +j = 0 +for i = 1 to n + if n % i = 0 j = j + 1 nArray[j] = i ok +next + +see "Factors of " + n + " = " +for i = 1 to j + see "" + nArray[i] + " " +next diff --git a/Task/Factors-of-an-integer/SequenceL/factors-of-an-integer-1.sequencel b/Task/Factors-of-an-integer/SequenceL/factors-of-an-integer-1.sequencel new file mode 100644 index 0000000000..5dd9bf702f --- /dev/null +++ b/Task/Factors-of-an-integer/SequenceL/factors-of-an-integer-1.sequencel @@ -0,0 +1 @@ +Factors(num(0))[i] := i when num mod i = 0 foreach i within 1 ... num; diff --git a/Task/Factors-of-an-integer/SequenceL/factors-of-an-integer-2.sequencel b/Task/Factors-of-an-integer/SequenceL/factors-of-an-integer-2.sequencel new file mode 100644 index 0000000000..e5ce15545a --- /dev/null +++ b/Task/Factors-of-an-integer/SequenceL/factors-of-an-integer-2.sequencel @@ -0,0 +1,9 @@ +Factors(num(0)) := + let + factorPairs[i] := + [i] when i = sqrt(num) + else + [i, num/i] when num mod i = 0 + foreach i within 1 ... floor(sqrt(num)); + in + join(factorPairs); diff --git a/Task/Factors-of-an-integer/Sidef/factors-of-an-integer.sidef b/Task/Factors-of-an-integer/Sidef/factors-of-an-integer.sidef new file mode 100644 index 0000000000..1f20b7e860 --- /dev/null +++ b/Task/Factors-of-an-integer/Sidef/factors-of-an-integer.sidef @@ -0,0 +1,11 @@ +func factors(n) { + var divs = [] + range(1, n.sqrt.int).each { |d| + divs << d if n%%d + } + divs + [divs[-1]**2 == n ? divs.pop : ()] + divs.reverse.map{|d| n/d } +} + +[53, 64, 32766].each { |n| + say "factors(#{n}): #{factors(n)}" +} diff --git a/Task/Factors-of-an-integer/Swift/factors-of-an-integer-1.swift b/Task/Factors-of-an-integer/Swift/factors-of-an-integer-1.swift new file mode 100644 index 0000000000..c6095d4140 --- /dev/null +++ b/Task/Factors-of-an-integer/Swift/factors-of-an-integer-1.swift @@ -0,0 +1,4 @@ +func factors(n: Int) -> [Int] { + + return filter(1...n) { n % $0 == 0 } +} diff --git a/Task/Factors-of-an-integer/Swift/factors-of-an-integer-2.swift b/Task/Factors-of-an-integer/Swift/factors-of-an-integer-2.swift new file mode 100644 index 0000000000..fba239d09b --- /dev/null +++ b/Task/Factors-of-an-integer/Swift/factors-of-an-integer-2.swift @@ -0,0 +1,18 @@ +import func Darwin.sqrt + +func sqrt(x:Int) -> Int { return Int(sqrt(Double(x))) } + +func factors(n: Int) -> [Int] { + + var result = [Int]() + + for factor in filter (1...sqrt(n), { n % $0 == 0 }) { + + result.append(factor) + + if n/factor != factor { result.append(n/factor) } + } + + return sorted(result) + +} diff --git a/Task/Factors-of-an-integer/Swift/factors-of-an-integer-3.swift b/Task/Factors-of-an-integer/Swift/factors-of-an-integer-3.swift new file mode 100644 index 0000000000..2c35bbd199 --- /dev/null +++ b/Task/Factors-of-an-integer/Swift/factors-of-an-integer-3.swift @@ -0,0 +1,6 @@ +println(factors(4)) +println(factors(1)) +println(factors(25)) +println(factors(63)) +println(factors(19)) +println(factors(768)) diff --git a/Task/Factors-of-an-integer/Ursa/factors-of-an-integer.ursa b/Task/Factors-of-an-integer/Ursa/factors-of-an-integer.ursa new file mode 100644 index 0000000000..02c8fdb3fa --- /dev/null +++ b/Task/Factors-of-an-integer/Ursa/factors-of-an-integer.ursa @@ -0,0 +1,10 @@ +decl int n +set n (int args<1>) + +decl int i +for (set i 1) (< i (+ (/ n 2) 1)) (inc i) + if (= (mod n i) 0) + out i " " console + end if +end for +out n endl console diff --git a/Task/Factors-of-an-integer/Wortel/factors-of-an-integer.wortel b/Task/Factors-of-an-integer/Wortel/factors-of-an-integer.wortel new file mode 100644 index 0000000000..2a82e868d8 --- /dev/null +++ b/Task/Factors-of-an-integer/Wortel/factors-of-an-integer.wortel @@ -0,0 +1,9 @@ +@let { + factors1 &n !-\%%n @to n + factors_tacit @(\\%% !- @to) + [[ + !factors1 10 + !factors_tacit 100 + !factors1 720 + ]] +} diff --git a/Task/Factors-of-an-integer/jq/factors-of-an-integer.jq b/Task/Factors-of-an-integer/jq/factors-of-an-integer.jq new file mode 100644 index 0000000000..6cb74c5e3e --- /dev/null +++ b/Task/Factors-of-an-integer/jq/factors-of-an-integer.jq @@ -0,0 +1,16 @@ +# This implementation uses "sort" for tidiness +def factors: + . as $num + | reduce range(1; 1 + sqrt|floor) as $i + ([]; + if ($num % $i) == 0 then + ($num / $i) as $r + | if $i == $r then . + [$i] else . + [$i, $r] end + else . + end ) + | sort; + +def task: + (45, 53, 64) | "\(.): \(factors)" ; + +task diff --git a/Task/Fast-Fourier-transform/Crystal/fast-fourier-transform.crystal b/Task/Fast-Fourier-transform/Crystal/fast-fourier-transform.crystal new file mode 100644 index 0000000000..aee3f012ec --- /dev/null +++ b/Task/Fast-Fourier-transform/Crystal/fast-fourier-transform.crystal @@ -0,0 +1,8 @@ +def fft(x : Array(Float64)) : Array(Complex) + return [x[0].to_c] if x.size <= 1 + even = fft(Array.new(x.size / 2) { |k| x[2 * k] }) + odd = fft(Array.new(x.size / 2) { |k| x[2 * k + 1] }) + c = Array.new(x.size / 2) { |k| Complex.new(0, -2 * Math::PI * k / x.size).exp } + codd = Array.new(x.size / 2) { |k| c[k] * odd[k] } + return Array.new(x.size / 2) { |k| even[k] + codd[k] } + Array.new(x.size / 2) { |k| even[k] - codd[k] } +end diff --git a/Task/Fast-Fourier-transform/ERRE/fast-fourier-transform.erre b/Task/Fast-Fourier-transform/ERRE/fast-fourier-transform.erre new file mode 100644 index 0000000000..b9c1977111 --- /dev/null +++ b/Task/Fast-Fourier-transform/ERRE/fast-fourier-transform.erre @@ -0,0 +1,99 @@ +PROGRAM FFT + +CONST CNT=8 + +!$DYNAMIC +DIM REL[0],IMG[0],CMP[0],V[0] + +BEGIN + SIG=INT(LOG(CNT)/LOG(2)+0.9999) + REAL1=2^SIG + + REAL=REAL1-1 + REAL2=INT(REAL1/2) + REAL4=INT(REAL1/4) + REAL3=REAL4+REAL2 + +!$DIM REL[REAL1],IMG[REAL1],CMP[REAL3] + +FOR I=0 TO CNT-1 DO + READ(REL[I],IMG[I]) +END FOR + +DATA(1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0) + +SIG2=INT(SIG/2) +SIG1=SIG-SIG2 +CNT1=2^SIG1 +CNT2=2^SIG2 + +!$DIM V[CNT1-1] +V[0]=0 +DV=1 +PTR=CNT1 + +FOR J=1 TO SIG1 DO + HLFPTR=INT(PTR/2) + PT=CNT1-HLFPTR + FOR I=HLFPTR TO PT STEP PTR DO + V[I]=V[I-HLFPTR]+DV + END FOR + DV=2*DV + PTR=HLFPTR +END FOR + +K=2*π/REAL1 + +FOR X=0 TO REAL4 DO + CMP[X]=COS(K*X) + CMP[REAL2-X]=-CMP[X] + CMP[REAL2+X]=-CMP[X] +END FOR + +PRINT("FFT: BIT REVERSAL") + +FOR I=0 TO CNT1-1 DO + IP=I*CNT2 + FOR J=0 TO CNT2-1 DO + H=IP+J + G=V[J]*CNT2+V[I] + IF G>H THEN + SWAP(REL[G],REL[H]) + SWAP(IMG[G],IMG[H]) + END IF + END FOR +END FOR + +T=1 +FOR STAGE=1 TO SIG DO + PRINT("STAGE:";STAGE) + D=INT(REAL2/T) + FOR II=0 TO T-1 DO + L=D*II + LS=L+REAL4 + FOR I=0 TO D-1 DO + A=2*I*T+II + B=A+T + F1=REL[A] + F2=IMG[A] + CNT1=CMP[L]*REL[B] + CNT2=CMP[LS]*IMG[B] + CNT3=CMP[LS]*REL[B] + CNT4=CMP[L]*IMG[B] + REL[A]=F1+CNT1-CNT2 + IMG[A]=F2+CNT3+CNT4 + REL[B]=F1-CNT1+CNT2 + IMG[B]=F2-CNT3-CNT4 + END FOR + END FOR + T=2*T +END FOR + +PRINT("NUM REAL IMAG") +FOR I=0 TO REAL DO + IF ABS(REL[I])<1E-5 THEN REL[I]=0 END IF + IF ABS(IMG[I])<1E-5 THEN IMG[I]=0 END IF + PRINT(I;"";) + WRITE("##.###### ##.######";REL[I];IMG[I]) +END FOR +END PROGRAM diff --git a/Task/Fast-Fourier-transform/EchoLisp/fast-fourier-transform.echolisp b/Task/Fast-Fourier-transform/EchoLisp/fast-fourier-transform.echolisp new file mode 100644 index 0000000000..fa87f88055 --- /dev/null +++ b/Task/Fast-Fourier-transform/EchoLisp/fast-fourier-transform.echolisp @@ -0,0 +1,17 @@ +(define -∏*2 (complex 0 (* -2 PI))) + +(define (fft xs N) + (if (<= N 1) xs + (let* [ + (N/2 (/ N 2)) + (even (fft (for/vector ([i (in-range 0 N 2)]) [xs i]) N/2)) + (odd (fft (for/vector ([i (in-range 1 N 2)]) [xs i]) N/2)) + ] + (for ((k N/2)) (vector*= odd k (exp (/ (* -∏*2 k) N )))) + (vector-append (vector-map + even odd) (vector-map - even odd))))) + +(define data #( 1 1 1 1 0 0 0 0 )) + +(fft data 8) + → #( 4+0i 1-2.414213562373095i 0+0i 1-0.4142135623730949i + 0+0i 1+0.4142135623730949i 0+0i 1+2.414213562373095i) diff --git a/Task/Fast-Fourier-transform/Idris/fast-fourier-transform.idris b/Task/Fast-Fourier-transform/Idris/fast-fourier-transform.idris new file mode 100644 index 0000000000..fe4d94049b --- /dev/null +++ b/Task/Fast-Fourier-transform/Idris/fast-fourier-transform.idris @@ -0,0 +1,31 @@ +module Main + +import Data.Complex + + +concatPair : List (a, a) -> List (a) +concatPair xs with (unzip xs) + | (xs1, xs2) = xs1 ++ xs2 + +fft' : List (Complex Double) -> Nat -> Nat -> List (Complex Double) +fft' (x::xs) (S Z) _ = [x] +fft' xs n s = concatPair $ map (\(x1,x2,k) => + let eTerm = ((cis (-2 * pi * ((cast k) - 1) / (cast n))) * x2) in + (x1 + eTerm, x1 - eTerm)) $ zip3 left right [1..n `div` 2] + + where + left : List (Complex Double) + right : List (Complex Double) + left = fft' (xs) (n `div` 2) (2 * s) + right = fft' (drop s xs) (n `div` 2) (2 * s) + + +-- Recursive Cooley-Tukey with radix-2 DIT case +-- assumes no of points provided are a power of 2 +fft : List (Complex Double) -> List (Complex Double) +fft [] = [] +fft xs = fft' xs (length xs) 1 + + +main : IO() +main = traverse_ printLn $ fft [1,1,1,1,0,0,0,0] diff --git a/Task/Fast-Fourier-transform/Nim/fast-fourier-transform.nim b/Task/Fast-Fourier-transform/Nim/fast-fourier-transform.nim new file mode 100644 index 0000000000..a46f2b23bf --- /dev/null +++ b/Task/Fast-Fourier-transform/Nim/fast-fourier-transform.nim @@ -0,0 +1,26 @@ +import math, complex, strutils + +proc toComplex(x: float): TComplex = result.re = x +proc toComplex(x: TComplex): TComplex = x + +# Works with floats and complex numbers as input +proc fft[T](x: openarray[T]): seq[TComplex] = + let n = x.len + result = newSeq[TComplex]() + if n <= 1: + for v in x: result.add toComplex(v) + return + var evens, odds = newSeq[T]() + for i, v in x: + if i mod 2 == 0: evens.add v + else: odds.add v + var (even, odd) = (fft(evens), fft(odds)) + + for k in 0 .. < n div 2: + result.add(even[k] + exp((0.0, -2*pi*float(k)/float(n))) * odd[k]) + + for k in 0 .. < n div 2: + result.add(even[k] - exp((0.0, -2*pi*float(k)/float(n))) * odd[k]) + +for i in fft(@[1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0]): + echo formatFloat(abs(i), ffDecimal, 3) diff --git a/Task/Fast-Fourier-transform/SequenceL/fast-fourier-transform.sequencel b/Task/Fast-Fourier-transform/SequenceL/fast-fourier-transform.sequencel new file mode 100644 index 0000000000..b1a2edf33b --- /dev/null +++ b/Task/Fast-Fourier-transform/SequenceL/fast-fourier-transform.sequencel @@ -0,0 +1,18 @@ +import ; +import ; +import ; + +fft(x(1)) := + let + n := size(x); + + top := fft(x[range(1,n-1,2)]); + bottom := fft(x[range(2,n,2)]); + + d[i] := makeComplex(cos(2.0*pi*i/n), -sin(2.0*pi*i/n)) foreach i within 0...(n / 2 - 1); + + z := complexMultiply(d, bottom); + in + x when n <= 1 + else + complexAdd(top,z) ++ complexSubtract(top,z); diff --git a/Task/Fast-Fourier-transform/Sidef/fast-fourier-transform.sidef b/Task/Fast-Fourier-transform/Sidef/fast-fourier-transform.sidef new file mode 100644 index 0000000000..95c4c3f6d3 --- /dev/null +++ b/Task/Fast-Fourier-transform/Sidef/fast-fourier-transform.sidef @@ -0,0 +1,16 @@ +func fft(arr) { + arr.len == 1 && return arr + + var evn = fft([arr[^arr -> grep { .is_even }]]) + var odd = fft([arr[^arr -> grep { .is_odd }]]) + var twd = (Num.tau.i / arr.len) + + ^odd -> map {|n| odd[n] *= ::exp(twd * n)} + (evn »+« odd) + (evn »-« odd) +} + +var cycles = 3 +var sequence = 0..15 +var wave = sequence.map {|n| ::sin(n * Num.tau / sequence.len * cycles) } +say "wave:#{wave.map{|w| '%6.3f' % w }.join(' ')}" +say "fft: #{fft(wave).map { '%6.3f' % .abs }.join(' ')}" diff --git a/Task/Fast-Fourier-transform/jq/fast-fourier-transform-1.jq b/Task/Fast-Fourier-transform/jq/fast-fourier-transform-1.jq new file mode 100644 index 0000000000..cedbf5adaa --- /dev/null +++ b/Task/Fast-Fourier-transform/jq/fast-fourier-transform-1.jq @@ -0,0 +1,23 @@ +# multiplication of real or complex numbers +def cmult(x; y): + if (x|type) == "number" then + if (y|type) == "number" then [ x*y, 0 ] + else [x * y[0], x * y[1]] + end + elif (y|type) == "number" then cmult(y;x) + else [ x[0] * y[0] - x[1] * y[1], x[0] * y[1] + x[1] * y[0]] + end; + +def cplus(x; y): + if (x|type) == "number" then + if (y|type) == "number" then [ x+y, 0 ] + else [ x + y[0], y[1]] + end + elif (y|type) == "number" then cplus(y;x) + else [ x[0] + y[0], x[1] + y[1] ] + end; + +def cminus(x; y): cplus(x; cmult(-1; y)); + +# e(ix) = cos(x) + i sin(x) +def expi(x): [ (x|cos), (x|sin) ]; diff --git a/Task/Fast-Fourier-transform/jq/fast-fourier-transform-2.jq b/Task/Fast-Fourier-transform/jq/fast-fourier-transform-2.jq new file mode 100644 index 0000000000..00043efd2b --- /dev/null +++ b/Task/Fast-Fourier-transform/jq/fast-fourier-transform-2.jq @@ -0,0 +1,9 @@ +def fft: + length as $N + | if $N <= 1 then . + else ( [ .[ range(0; $N; 2) ] ] | fft) as $even + | ( [ .[ range(1; $N; 2) ] ] | fft) as $odd + | (1|atan * 4) as $pi + | [ range(0; $N/2) | cplus($even[.]; cmult( expi(-2*$pi*./$N); $odd[.] )) ] + + [ range(0; $N/2) | cminus($even[.]; cmult( expi(-2*$pi*./$N); $odd[.] )) ] + end; diff --git a/Task/Fast-Fourier-transform/jq/fast-fourier-transform-3.jq b/Task/Fast-Fourier-transform/jq/fast-fourier-transform-3.jq new file mode 100644 index 0000000000..ae3920945e --- /dev/null +++ b/Task/Fast-Fourier-transform/jq/fast-fourier-transform-3.jq @@ -0,0 +1 @@ +[1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0] | fft diff --git a/Task/Fibonacci-n-step-number-sequences/ERRE/fibonacci-n-step-number-sequences.erre b/Task/Fibonacci-n-step-number-sequences/ERRE/fibonacci-n-step-number-sequences.erre new file mode 100644 index 0000000000..2e13193df9 --- /dev/null +++ b/Task/Fibonacci-n-step-number-sequences/ERRE/fibonacci-n-step-number-sequences.erre @@ -0,0 +1,43 @@ +PROGRAM FIBON + +! +! for rosettacode.org +! + +DIM F[20] + +PROCEDURE FIB(TIPO$,F$) + FOR I%=0 TO 20 DO + F[I%]=0 + END FOR + B=0 + LOOP + Q=INSTR(F$,",") + B=B+1 + IF Q=0 THEN + F[B]=VAL(F$) + EXIT + ELSE + F[B]=VAL(MID$(F$,1,Q-1)) + F$=MID$(F$,Q+1) + END IF + END LOOP + + PRINT(TIPO$;" =>";) + FOR I=B TO 14+B DO + IF I<>B THEN PRINT(",";) END IF + PRINT(F[I-B+1];) + FOR J=(I-B)+1 TO I DO + F[I+1]=F[I+1]+F[J] + END FOR + END FOR + PRINT +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) ! CLS + FIB("Fibonacci","1,1") + FIB("Tribonacci","1,1,2") + FIB("Tetranacci","1,1,2,4") + FIB("Lucas","2,1") +END PROGRAM diff --git a/Task/Fibonacci-n-step-number-sequences/EchoLisp/fibonacci-n-step-number-sequences.echolisp b/Task/Fibonacci-n-step-number-sequences/EchoLisp/fibonacci-n-step-number-sequences.echolisp new file mode 100644 index 0000000000..5761c311b9 --- /dev/null +++ b/Task/Fibonacci-n-step-number-sequences/EchoLisp/fibonacci-n-step-number-sequences.echolisp @@ -0,0 +1,23 @@ +;; generate a recursive lambda() for a x-nacci +;; equip it with memoïzation +;; bind it to its name +(define (make-nacci name seed) + (define len (1+ (vector-length seed))) + (define-global name + `(lambda(n) (for/sum ((i (in-range (1- n) (- n ,len) -1))) (,name i)))) + (remember name seed) + name) + +(define nacci-family `( + (Fibonacci #(1 1)) + (Tribonacci #(1 1 2)) + (Tetranacci #(1 1 2 4)) + (Decanacci #(1 1 2 4 8 16 32 64 128 256)) + (Random-😜-nacci ,(list->vector (take 6 (shuffle (iota 100))))) + (Lucas #(2 1)))) + +(define (task naccis) + (for ((nacci naccis)) + (define-values (name seed) nacci) + (make-nacci name seed) + (printf "%s[%d] → %d" name (vector-length seed) (take name 16)))) diff --git a/Task/Fibonacci-n-step-number-sequences/FreeBASIC/fibonacci-n-step-number-sequences.freebasic b/Task/Fibonacci-n-step-number-sequences/FreeBASIC/fibonacci-n-step-number-sequences.freebasic new file mode 100644 index 0000000000..6f99917179 --- /dev/null +++ b/Task/Fibonacci-n-step-number-sequences/FreeBASIC/fibonacci-n-step-number-sequences.freebasic @@ -0,0 +1,51 @@ +' FB 1.05.0 Win64 + +' Deduces the step, n, from the length of the dynamic array passed in +' and fills it out to 'size' elements +Sub fibN (a() As Integer, size As Integer) + Dim lb As Integer = LBound(a) + Dim ub As Integer = UBound(a) + Dim length As Integer = ub - lb + 1 + If length < 2 OrElse length >= size Then Return + ub = lb + size - 1 + Redim Preserve a(lb To ub) + Dim sum As Integer + For i As Integer = lb + length to ub + sum = 0 + For j As Integer = 1 To Length + sum += a(i - j) + Next j + a(i) = sum + Next i +End Sub + +Sub printSeries(a() As Integer, name_ As String) '' name is a keyword + Print name_; " =>"; + For i As Integer = LBound(a) To UBound(a) + Print Using "####"; a(i); + Print " "; + Next + Print +End Sub + +Const size As Integer = 13 '' say +Redim a(1 To 2) As Integer +a(1) = 1 : a(2) = 1 +fibN(a(), size) +printSeries(a(), "fibonacci ") +Redim Preserve a(1 To 3) +a(3) = 2 +fibN(a(), size) +printSeries(a(), "tribonacci") +Redim Preserve a(1 To 4) +a(4) = 4 +fibN(a(), size) +printSeries(a(), "tetranacci") +erase a +Redim a(1 To 2) +a(1) = 2 : a(2) = 1 +fibN(a(), size) +printSeries(a(), "lucas ") +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Fibonacci-n-step-number-sequences/FunL/fibonacci-n-step-number-sequences.funl b/Task/Fibonacci-n-step-number-sequences/FunL/fibonacci-n-step-number-sequences.funl new file mode 100644 index 0000000000..a7842a3ac8 --- /dev/null +++ b/Task/Fibonacci-n-step-number-sequences/FunL/fibonacci-n-step-number-sequences.funl @@ -0,0 +1,31 @@ +import util.TextTable +native scala.collection.mutable.Queue + +def fibLike( init ) = + q = Queue() + + for i <- init do q.enqueue( i ) + + def fib = + q.enqueue( sum(q) ) + q.dequeue() # fib() + + 0 # fib() + +def fibN( n ) = fibLike( [1] + [2^i | i <- 0:n-1] ) + +val lucas = fibLike( [2, 1] ) + +t = TextTable() +t.header( 'k', 'Fibonacci', 'Tribonacci', 'Tetranacci', 'Lucas' ) +t.line() + +for i <- 1..5 + t.rightAlignment( i ) + +seqs = (fibN(2), fibN(3), fibN(4), lucas) + +for k <- 1..10 + t.row( ([k] + [seqs(i)(k) | i <- 0:4]).toIndexedSeq() ) + +print( t ) diff --git a/Task/Fibonacci-n-step-number-sequences/Nim/fibonacci-n-step-number-sequences.nim b/Task/Fibonacci-n-step-number-sequences/Nim/fibonacci-n-step-number-sequences.nim new file mode 100644 index 0000000000..04a2fae67c --- /dev/null +++ b/Task/Fibonacci-n-step-number-sequences/Nim/fibonacci-n-step-number-sequences.nim @@ -0,0 +1,28 @@ +import sequtils, strutils + +proc fiblike(start: seq[int]): auto = + var memo = start + proc fibber(n: int): int = + if n < memo.len: + return memo[n] + else: + var ans = 0 + for i in n-start.len .. + ", toSeq(0..14).mapIt(string, $fibber(it)).join(" "), " ..." diff --git a/Task/Fibonacci-n-step-number-sequences/Sidef/fibonacci-n-step-number-sequences.sidef b/Task/Fibonacci-n-step-number-sequences/Sidef/fibonacci-n-step-number-sequences.sidef new file mode 100644 index 0000000000..ebee6300a1 --- /dev/null +++ b/Task/Fibonacci-n-step-number-sequences/Sidef/fibonacci-n-step-number-sequences.sidef @@ -0,0 +1,13 @@ +func fib(n, xs=[1]) { + loop { + var len = xs.len + len >= 20 && break + xs.append(xs.ft(0.max(len - n)).sum) + } + return xs +} + +for i in (2..10) { + say fib(i).join(' ') +} +say fib(2, [2, 1]).join(' ') diff --git a/Task/Fibonacci-n-step-number-sequences/jq/fibonacci-n-step-number-sequences-1.jq b/Task/Fibonacci-n-step-number-sequences/jq/fibonacci-n-step-number-sequences-1.jq new file mode 100644 index 0000000000..de7efd6f36 --- /dev/null +++ b/Task/Fibonacci-n-step-number-sequences/jq/fibonacci-n-step-number-sequences-1.jq @@ -0,0 +1,15 @@ +# Input: the initial array +def nacci(arity; len): + arity as $arity | len as $len + | reduce range(length; $len) as $i + (.; + ([0, (length - $arity)] | max ) as $lower + | . + [ .[ ($lower) : length] | add] ) ; + +def fib(arity; len): + arity as $arity | len as $len + | [1,1] | nacci($arity; $arity) | nacci($arity; $len) ; + +def lucas(arity; len): + arity as $arity | len as $len + | [2,1] | nacci($arity; $arity) | nacci($arity; $len) ; diff --git a/Task/Fibonacci-n-step-number-sequences/jq/fibonacci-n-step-number-sequences-2.jq b/Task/Fibonacci-n-step-number-sequences/jq/fibonacci-n-step-number-sequences-2.jq new file mode 100644 index 0000000000..42ded4c488 --- /dev/null +++ b/Task/Fibonacci-n-step-number-sequences/jq/fibonacci-n-step-number-sequences-2.jq @@ -0,0 +1,6 @@ +def main: + (range(2; 11) | "fib(\(.)): \(fib(.; 15))"), + (range(2; 11) | "lucas(\(.)): \(lucas(.; 15))") +; + +main diff --git a/Task/Fibonacci-sequence/8th/fibonacci-sequence.8th b/Task/Fibonacci-sequence/8th/fibonacci-sequence.8th new file mode 100644 index 0000000000..fd3f32c1ea --- /dev/null +++ b/Task/Fibonacci-sequence/8th/fibonacci-sequence.8th @@ -0,0 +1,8 @@ +: fibon \ n -- fib(n) + >r 0 1 + ( tuck n:+ ) \ fib(n-2) fib(n-1) -- fib(n-1) fib(n) + r> n:1- times ; + +: fib \ n -- fib(n) + dup 1 n:= if 1 ;; then + fibon nip ; diff --git a/Task/Fibonacci-sequence/AntLang/fibonacci-sequence.antlang b/Task/Fibonacci-sequence/AntLang/fibonacci-sequence.antlang new file mode 100644 index 0000000000..45ed0e89d8 --- /dev/null +++ b/Task/Fibonacci-sequence/AntLang/fibonacci-sequence.antlang @@ -0,0 +1,4 @@ +/Sequence +fib:{<0;1> {x,}/ range[x]} +/nth +fibn:{fib[x][x]} diff --git a/Task/Fibonacci-sequence/Apex/fibonacci-sequence.apex b/Task/Fibonacci-sequence/Apex/fibonacci-sequence.apex new file mode 100644 index 0000000000..3317ff2ed2 --- /dev/null +++ b/Task/Fibonacci-sequence/Apex/fibonacci-sequence.apex @@ -0,0 +1,43 @@ +/* + author: snugsfbay + date: March 3, 2016 + description: Create a list of x numbers in the Fibonacci sequence. + - user may specify the length of the list + - enforces a minimum of 2 numbers in the sequence because any fewer is not a sequence + - enforces a maximum of 47 because further values are too large for integer data type + - Fibonacci sequence always starts with 0 and 1 by definition +*/ +public class FibNumbers{ + +final static Integer MIN = 2; //minimum length of sequence +final static Integer MAX = 47; //maximum length of sequence + +/* + description: method to create a list of numbers in the Fibonacci sequence + param: user specified integer representing length of sequence should be 2-47, inclusive. + - Sequence starts with 0 and 1 by definition so the minimum length could be as low as 2. + - For 48th number in sequence or greater, code would require a Long data type rather than an Integer. + return: list of integers in sequence. +*/ +public static List makeSeq(Integer len){ + + List fib = new List{0,1}; // initialize list with first two values + Integer i; + + if(lenMAX) { + if (len>MAX){ + len=MAX; //set length to maximum if user entered too high a value + }else{ + len=MIN; //set length to minimum if user entered too low a value or none + } + } //This could be refactored using teneray operator, but we want code coverage to be reflected for each condition + + //start with initial list size to find previous two values in the sequence, continue incrementing until list reaches user defined length + for(i=fib.size(); i stack + + // Set the parameter and call fibb + funparam[0] = a + call fibb + + // Handle the return value and restore "a" + b = funparam[0] + stack -> a + + // Save "b" while calling fibb again + b -> stack + + a-- + + // Set the parameter and call fibb + funparam[0] = a + call fibb + + // Handle the return value and restore "b" + c = funparam[0] + stack -> b + + // Sum the results + b += c + a = b + + funparam[0] = a + + break + end +end + +// vim: set syntax=c ts=4 sw=4 et: diff --git a/Task/Fibonacci-sequence/Computer-zero-Assembly/fibonacci-sequence.computer b/Task/Fibonacci-sequence/Computer-zero-Assembly/fibonacci-sequence.computer new file mode 100644 index 0000000000..c694959603 --- /dev/null +++ b/Task/Fibonacci-sequence/Computer-zero-Assembly/fibonacci-sequence.computer @@ -0,0 +1,22 @@ +loop: LDA y ; higher No. + STA temp + ADD x ; lower No. + STA y + LDA temp + STA x + + LDA count + SUB one + BRZ done + + STA count + JMP loop + +done: LDA y + STP + +one: 1 +count: 8 ; n = 10 +x: 1 +y: 1 +temp: 0 diff --git a/Task/Fibonacci-sequence/ECL/fibonacci-sequence.ecl b/Task/Fibonacci-sequence/ECL/fibonacci-sequence.ecl new file mode 100644 index 0000000000..a7fba60bfc --- /dev/null +++ b/Task/Fibonacci-sequence/ECL/fibonacci-sequence.ecl @@ -0,0 +1,29 @@ +//Calculates Fibonacci sequence up to n steps using Binet's closed form solution + + +FibFunction(UNSIGNED2 n) := FUNCTION + REAL Sqrt5 := Sqrt(5); + REAL Phi := (1+Sqrt(5))/2; + REAL Phi_Inv := 1/Phi; + UNSIGNED FibValue := ROUND( ( POWER(Phi,n)-POWER(Phi_Inv,n) ) /Sqrt5); + RETURN FibValue; + END; + + FibSeries(UNSIGNED2 n) := FUNCTION + + Fib_Layout := RECORD + UNSIGNED5 FibNum; + UNSIGNED5 FibValue; + END; + + FibSeq := DATASET(n+1, + TRANSFORM + ( Fib_Layout + , SELF.FibNum := COUNTER-1 + , SELF.FibValue := IF(SELF.FibNum<2,SELF.FibNum, FibFunction(SELF.FibNum) ) + ) + ); + + RETURN FibSeq; + + END; } diff --git a/Task/Fibonacci-sequence/EDSAC-order-code/fibonacci-sequence.edsac b/Task/Fibonacci-sequence/EDSAC-order-code/fibonacci-sequence.edsac new file mode 100644 index 0000000000..a0e9e70834 --- /dev/null +++ b/Task/Fibonacci-sequence/EDSAC-order-code/fibonacci-sequence.edsac @@ -0,0 +1,52 @@ +[ Fibonacci sequence + ================== + + A program for the EDSAC + + Calculates the nth Fibonacci + number and displays it at the + top of storage tank 3 + + The default value of n is 10 + + To calculate other Fibonacci + numbers, set the starting value + of the count to n-2 + + Works with Initial Orders 2 ] + + + T56K [ set load point ] + GK [ set theta ] + +[ Orders ] + +[ 0 ] T20@ [ a = 0 ] + A17@ [ a += y ] + U18@ [ temp = a ] + A16@ [ a += x ] + T17@ [ y = a; a = 0 ] + A18@ [ a += temp ] + T16@ [ x = a; a = 0 ] + + A19@ [ a = count ] + S15@ [ a -= 1 ] + U19@ [ count = a ] + E@ [ if a>=0 go to θ ] + + T20@ [ a = 0 ] + A17@ [ a += y ] + T96F [ C(96) = a; a = 0] + + ZF [ halt ] + +[ Data ] + +[ 15 ] P0D [ const: 1 ] +[ 16 ] P0F [ var: x = 0 ] +[ 17 ] P0D [ var: y = 1 ] +[ 18 ] P0F [ var: temp = 0 ] +[ 19 ] P4F [ var: count = 8 ] +[ 20 ] P0F [ used to clear a ] + + EZPF [ begin execution ] diff --git a/Task/Fibonacci-sequence/ERRE/fibonacci-sequence.erre b/Task/Fibonacci-sequence/ERRE/fibonacci-sequence.erre new file mode 100644 index 0000000000..9006975a74 --- /dev/null +++ b/Task/Fibonacci-sequence/ERRE/fibonacci-sequence.erre @@ -0,0 +1,27 @@ +!------------------------------------------- +! derived from my book "PROGRAMMARE IN ERRE" +! iterative solution +!------------------------------------------- + +PROGRAM FIBONACCI + +!$DOUBLE + +!VAR F1#,F2#,TEMP#,COUNT%,N% + +BEGIN !main + INPUT("Number",N%) + F1=0 + F2=1 + REPEAT + TEMP=F2 + F2=F1+F2 + F1=TEMP + COUNT%=COUNT%+1 + UNTIL COUNT%=N% + PRINT("FIB(";N%;")=";F2) + + ! Obviously a FOR loop or a WHILE loop can + ! be used to solve this problem + +END PROGRAM diff --git a/Task/Fibonacci-sequence/EchoLisp/fibonacci-sequence.echolisp b/Task/Fibonacci-sequence/EchoLisp/fibonacci-sequence.echolisp new file mode 100644 index 0000000000..19bc4c5765 --- /dev/null +++ b/Task/Fibonacci-sequence/EchoLisp/fibonacci-sequence.echolisp @@ -0,0 +1,8 @@ +(define (fib n) + (if (< n 2) n + (+ (fib (- n 2)) (fib (1- n))))) + +(remember 'fib #(0 1)) + +(for ((i 12)) (write (fib i))) +0 1 1 2 3 5 8 13 21 34 55 89 diff --git a/Task/Fibonacci-sequence/Elm/fibonacci-sequence.elm b/Task/Fibonacci-sequence/Elm/fibonacci-sequence.elm new file mode 100644 index 0000000000..76ba8b8205 --- /dev/null +++ b/Task/Fibonacci-sequence/Elm/fibonacci-sequence.elm @@ -0,0 +1,5 @@ +fibonacci : Int -> Int +fibonacci n = if n < 2 then + n + else + fibonacci(n - 2) + fibonacci(n - 1) diff --git a/Task/Fibonacci-sequence/FOCAL/fibonacci-sequence.focal b/Task/Fibonacci-sequence/FOCAL/fibonacci-sequence.focal new file mode 100644 index 0000000000..e25547ccc4 --- /dev/null +++ b/Task/Fibonacci-sequence/FOCAL/fibonacci-sequence.focal @@ -0,0 +1,11 @@ +01.10 TYPE "FIBONACCI NUMBERS" ! +01.20 ASK "N =", N +01.30 SET A=0 +01.40 SET B=1 +01.50 FOR I=2,N; DO 2.0 +01.60 TYPE "F(N) ", %8, B, ! +01.70 QUIT + +02.10 SET T=B +02.20 SET B=A+B +02.30 SET A=T diff --git a/Task/Fibonacci-sequence/FRISC-Assembly/fibonacci-sequence.frisc b/Task/Fibonacci-sequence/FRISC-Assembly/fibonacci-sequence.frisc new file mode 100644 index 0000000000..01bcb8cf77 --- /dev/null +++ b/Task/Fibonacci-sequence/FRISC-Assembly/fibonacci-sequence.frisc @@ -0,0 +1,23 @@ +FIBONACCI PUSH R1 + PUSH R2 + PUSH R3 + + MOVE 0, R1 + MOVE 1, R2 + +FIB_LOOP SUB R0, 1, R0 + JP_Z FIB_DONE + + MOVE R2, R3 + ADD R1, R2, R2 + MOVE R3, R1 + + JP FIB_LOOP + +FIB_DONE MOVE R2, R0 + + POP R3 + POP R2 + POP R1 + + RET diff --git a/Task/Fibonacci-sequence/FreeBASIC/fibonacci-sequence.freebasic b/Task/Fibonacci-sequence/FreeBASIC/fibonacci-sequence.freebasic new file mode 100644 index 0000000000..b521491c3f --- /dev/null +++ b/Task/Fibonacci-sequence/FreeBASIC/fibonacci-sequence.freebasic @@ -0,0 +1,83 @@ +'Fibonacci extended +'Freebasic version 24 Windows +Dim Shared ADDQmod(0 To 19) As Ubyte +Dim Shared ADDbool(0 To 19) As Ubyte + +For z As Integer=0 To 19 + ADDQmod(z)=(z Mod 10+48) + ADDbool(z)=(-(10<=z)) +Next z + +Function plusINT(NUM1 As String,NUM2 As String) As String + Dim As Byte flag + #macro finish() + three=Ltrim(three,"0") + If three="" Then Return "0" + If flag=1 Then Swap NUM2,NUM1 + Return three + Exit Function + #endmacro + var lenf=Len(NUM1) + var lens=Len(NUM2) + If lens>lenf Then + Swap NUM2,NUM1 + Swap lens,lenf + flag=1 + End If + + var diff=lenf-lens-Sgn(lenf-lens) + var three="0"+NUM1 + var two=String(lenf-lens,"0")+NUM2 + Dim As Integer n2 + Dim As Ubyte addup,addcarry + + addcarry=0 + + For n2=lenf-1 To diff Step -1 + addup=two[n2]+NUM1[n2]-96 + three[n2+1]=addQmod(addup+addcarry) + addcarry=addbool(addup+addcarry) + Next n2 + If addcarry=0 Then + finish() + End If + If n2=-1 Then + three[0]=addcarry+48 + finish() + End If + + For n2=n2 To 0 Step -1 + addup=two[n2]+NUM1[n2]-96 + three[n2+1]=addQmod(addup+addcarry) + addcarry=addbool(addup+addcarry) + Next n2 + three[0]=addcarry+48 + finish() +End Function + +Function fibonacci(n As Integer) As String + Dim As String sl,l,term + sl="0": l="1" + If n=1 Then Return "0" + If n=2 Then Return "1" + n=n-2 + For x As Integer= 1 To n + term=plusINT(l,sl) + sl=l + l=term + Next x + Function =term +End Function + +'============== EXAMPLE =============== +print "THE SEQUENCE TO 10:" +print +For n As Integer=1 To 10 + Print "term";n;": "; fibonacci(n) +Next n +print +print "Selected Fibonacci number" +print "Fibonacci 500" +print +print fibonacci(500) +Sleep diff --git a/Task/Fibonacci-sequence/FunL/fibonacci-sequence-1.funl b/Task/Fibonacci-sequence/FunL/fibonacci-sequence-1.funl new file mode 100644 index 0000000000..9364d7b03b --- /dev/null +++ b/Task/Fibonacci-sequence/FunL/fibonacci-sequence-1.funl @@ -0,0 +1,4 @@ +def + fib( 0 ) = 0 + fib( 1 ) = 1 + fib( n ) = fib( n - 1 ) + fib( n - 2 ) diff --git a/Task/Fibonacci-sequence/FunL/fibonacci-sequence-2.funl b/Task/Fibonacci-sequence/FunL/fibonacci-sequence-2.funl new file mode 100644 index 0000000000..83b02b4a0c --- /dev/null +++ b/Task/Fibonacci-sequence/FunL/fibonacci-sequence-2.funl @@ -0,0 +1,7 @@ +def fib( n ) = + def + _fib( 0, prev, _ ) = prev + _fib( 1, _, next ) = next + _fib( n, prev, next ) = _fib( n - 1, next, next + prev ) + + _fib( n, 0, 1 ) diff --git a/Task/Fibonacci-sequence/FunL/fibonacci-sequence-3.funl b/Task/Fibonacci-sequence/FunL/fibonacci-sequence-3.funl new file mode 100644 index 0000000000..39752cca51 --- /dev/null +++ b/Task/Fibonacci-sequence/FunL/fibonacci-sequence-3.funl @@ -0,0 +1,6 @@ +val fib = + def _fib( a, b ) = a # _fib( b, a + b ) + + _fib( 0, 1 ) + +println( fib(10000) ) diff --git a/Task/Fibonacci-sequence/FunL/fibonacci-sequence-4.funl b/Task/Fibonacci-sequence/FunL/fibonacci-sequence-4.funl new file mode 100644 index 0000000000..d461e2e439 --- /dev/null +++ b/Task/Fibonacci-sequence/FunL/fibonacci-sequence-4.funl @@ -0,0 +1,7 @@ +def fib( n ) = + a, b = 0, 1 + + for i <- 1..n + a, b = b, a+b + + a diff --git a/Task/Fibonacci-sequence/FunL/fibonacci-sequence-5.funl b/Task/Fibonacci-sequence/FunL/fibonacci-sequence-5.funl new file mode 100644 index 0000000000..8c8831221e --- /dev/null +++ b/Task/Fibonacci-sequence/FunL/fibonacci-sequence-5.funl @@ -0,0 +1,5 @@ +import math.sqrt + +def fib( n ) = + phi = (1 + sqrt( 5 ))/2 + int( (phi^n - (-phi)^-n)/sqrt(5) + .5 ) diff --git a/Task/Fibonacci-sequence/FunL/fibonacci-sequence-6.funl b/Task/Fibonacci-sequence/FunL/fibonacci-sequence-6.funl new file mode 100644 index 0000000000..2f8792a63a --- /dev/null +++ b/Task/Fibonacci-sequence/FunL/fibonacci-sequence-6.funl @@ -0,0 +1,19 @@ +def mul( a, b ) = + res = array( a.length(), b(0).length() ) + + for i <- 0:a.length(), j <- 0:b(0).length() + res( i, j ) = sum( a(i, k)*b(k, j) | k <- 0:b.length() ) + + vector( res ) + +def + pow( _, 0 ) = ((1, 0), (0, 1)) + pow( x, 1 ) = x + pow( x, n ) + | 2|n = pow( mul(x, x), n\2 ) + | otherwise = mul(x, pow( mul(x, x), (n - 1)\2 ) ) + +def fib( n ) = pow( ((0, 1), (1, 1)), n )(0, 1) + +for i <- 0..10 + println( fib(i) ) diff --git a/Task/Fibonacci-sequence/Futhark/fibonacci-sequence.futhark b/Task/Fibonacci-sequence/Futhark/fibonacci-sequence.futhark new file mode 100644 index 0000000000..ef8b4b586d --- /dev/null +++ b/Task/Fibonacci-sequence/Futhark/fibonacci-sequence.futhark @@ -0,0 +1,4 @@ +fun main(n: int): int = + loop((a,b) = (0,1)) = for _i < n do + (b, a + b) + in a diff --git a/Task/Fibonacci-sequence/FutureBasic/fibonacci-sequence.futurebasic b/Task/Fibonacci-sequence/FutureBasic/fibonacci-sequence.futurebasic new file mode 100644 index 0000000000..055fa6dbe6 --- /dev/null +++ b/Task/Fibonacci-sequence/FutureBasic/fibonacci-sequence.futurebasic @@ -0,0 +1,30 @@ +include "Tlbx Timer.incl" +include "ConsoleWindow" + +local fn Fibonacci( n as long ) as Long +begin globals +dim as long s1, s2// static +end globals + +dim as long temp + +if ( n < 2 ) + s1 = n + exit fn +else + temp = s1 + s2 + s2 = s1 + s1 = temp + exit fn +end if +end fn = s1 + +dim as long i +dim as UnsignedWide start, finish + +Microseconds( @start ) +for i = 0 to 40 +print i; ". "; fn Fibonacci(i) +next i +Microseconds( @finish ) +print "Compute time:"; (finish.lo - start.lo ) / 1000; " ms" diff --git a/Task/Fibonacci-sequence/GFA-Basic/fibonacci-sequence.gfa b/Task/Fibonacci-sequence/GFA-Basic/fibonacci-sequence.gfa new file mode 100644 index 0000000000..43a0d95a9c --- /dev/null +++ b/Task/Fibonacci-sequence/GFA-Basic/fibonacci-sequence.gfa @@ -0,0 +1,37 @@ +' +' Compute nth Fibonacci number +' +' open a window for display +OPENW 1 +CLEARW 1 +' Display some fibonacci numbers +' Fib(46) is the largest number GFA Basic can reach +' (long integers are 4 bytes) +FOR i%=0 TO 46 + PRINT "fib(";i%;")=";@fib(i%) +NEXT i% +' wait for a key press and tidy up +~INP(2) +CLOSEW 1 +' +' Function to compute nth fibonacci number +' n must be in range 0 to 46, inclusive +' +FUNCTION fib(n%) + LOCAL n0%,n1%,nn%,i% + n0%=0 + n1%=1 + SELECT n% + CASE 0 + RETURN n0% + CASE 1 + RETURN n1% + DEFAULT + FOR i%=2 TO n% + nn%=n0%+n1% + n0%=n1% + n1%=nn% + NEXT i% + RETURN nn% + ENDSELECT +ENDFUNC diff --git a/Task/Fibonacci-sequence/Harbour/fibonacci-sequence-1.harbour b/Task/Fibonacci-sequence/Harbour/fibonacci-sequence-1.harbour new file mode 100644 index 0000000000..80e7a993d2 --- /dev/null +++ b/Task/Fibonacci-sequence/Harbour/fibonacci-sequence-1.harbour @@ -0,0 +1,3 @@ +#include "harbour.ch" +Function fibb(a,b,n) +return(if(--n>0,fibb(b,a+b,n),a)) diff --git a/Task/Fibonacci-sequence/Harbour/fibonacci-sequence-2.harbour b/Task/Fibonacci-sequence/Harbour/fibonacci-sequence-2.harbour new file mode 100644 index 0000000000..6b737b746a --- /dev/null +++ b/Task/Fibonacci-sequence/Harbour/fibonacci-sequence-2.harbour @@ -0,0 +1,9 @@ +#include "harbour.ch" +Function fibb(n) + local fnow:=0, fnext:=1, tempf + while (--n>0) + tempf:=fnow+fnext + fnow:=fnext + fnext:=tempf + end while +return(fnext) diff --git a/Task/Fibonacci-sequence/Hy/fibonacci-sequence.hy b/Task/Fibonacci-sequence/Hy/fibonacci-sequence.hy new file mode 100644 index 0000000000..533cab8f53 --- /dev/null +++ b/Task/Fibonacci-sequence/Hy/fibonacci-sequence.hy @@ -0,0 +1,4 @@ +(defn fib [n] + (if (< n 2) + n + (+ (fib (- n 2)) (fib (- n 1))))) diff --git a/Task/Fibonacci-sequence/Idris/fibonacci-sequence-1.idris b/Task/Fibonacci-sequence/Idris/fibonacci-sequence-1.idris new file mode 100644 index 0000000000..339de35306 --- /dev/null +++ b/Task/Fibonacci-sequence/Idris/fibonacci-sequence-1.idris @@ -0,0 +1,5 @@ +fibAnalytic : Nat -> Double +fibAnalytic n = + floor $ ((pow goldenRatio n) - (pow (-1.0/goldenRatio) n)) / sqrt(5) + where goldenRatio : Double + goldenRatio = (1.0 + sqrt(5)) / 2.0 diff --git a/Task/Fibonacci-sequence/Idris/fibonacci-sequence-2.idris b/Task/Fibonacci-sequence/Idris/fibonacci-sequence-2.idris new file mode 100644 index 0000000000..3fb0527a4d --- /dev/null +++ b/Task/Fibonacci-sequence/Idris/fibonacci-sequence-2.idris @@ -0,0 +1,4 @@ +fibRecursive : Nat -> Nat +fibRecursive Z = Z +fibRecursive (S Z) = (S Z) +fibRecursive (S (S n)) = fibRecursive (S n) + fibRecursive n diff --git a/Task/Fibonacci-sequence/Idris/fibonacci-sequence-3.idris b/Task/Fibonacci-sequence/Idris/fibonacci-sequence-3.idris new file mode 100644 index 0000000000..ff64755ab5 --- /dev/null +++ b/Task/Fibonacci-sequence/Idris/fibonacci-sequence-3.idris @@ -0,0 +1,5 @@ +fibIterative : Nat -> Nat +fibIterative n = fibIterative' n Z (S Z) + where fibIterative' : Nat -> Nat -> Nat -> Nat + fibIterative' Z a _ = a + fibIterative' (S n) a b = fibIterative' n b (a + b) diff --git a/Task/Fibonacci-sequence/Idris/fibonacci-sequence-4.idris b/Task/Fibonacci-sequence/Idris/fibonacci-sequence-4.idris new file mode 100644 index 0000000000..770569318a --- /dev/null +++ b/Task/Fibonacci-sequence/Idris/fibonacci-sequence-4.idris @@ -0,0 +1,5 @@ +fibLazy : Lazy (List Nat) +fibLazy = 0 :: 1 :: zipWith (+) fibLazy ( + case fibLazy of + (x::xs) => xs + [] => []) diff --git a/Task/Fibonacci-sequence/L++/fibonacci-sequence.lpp b/Task/Fibonacci-sequence/L++/fibonacci-sequence.lpp new file mode 100644 index 0000000000..b77dc3a624 --- /dev/null +++ b/Task/Fibonacci-sequence/L++/fibonacci-sequence.lpp @@ -0,0 +1,2 @@ +(defn int fib (int n) (return (? (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))) +(main (prn (fib 30))) diff --git a/Task/Fibonacci-sequence/LFE/fibonacci-sequence-1.lfe b/Task/Fibonacci-sequence/LFE/fibonacci-sequence-1.lfe new file mode 100644 index 0000000000..a7a6840032 --- /dev/null +++ b/Task/Fibonacci-sequence/LFE/fibonacci-sequence-1.lfe @@ -0,0 +1,6 @@ +(defun fib + ((0) 0) + ((1) 1) + ((n) + (+ (fib (- n 1)) + (fib (- n 2))))) diff --git a/Task/Fibonacci-sequence/LFE/fibonacci-sequence-2.lfe b/Task/Fibonacci-sequence/LFE/fibonacci-sequence-2.lfe new file mode 100644 index 0000000000..70a576ff1d --- /dev/null +++ b/Task/Fibonacci-sequence/LFE/fibonacci-sequence-2.lfe @@ -0,0 +1,9 @@ +(defun fib + ((n) (when (>= n 0)) + (fib n 0 1))) + +(defun fib + ((0 result _) + result) + ((n result next) + (fib (- n 1) next (+ result next)))) diff --git a/Task/Fibonacci-sequence/Lasso/fibonacci-sequence.lasso b/Task/Fibonacci-sequence/Lasso/fibonacci-sequence.lasso new file mode 100644 index 0000000000..f16a4d6143 --- /dev/null +++ b/Task/Fibonacci-sequence/Lasso/fibonacci-sequence.lasso @@ -0,0 +1,23 @@ +define fibonacci(n::integer) => { + + #n < 1 ? return false + + local( + swap = 0, + n1 = 0, + n2 = 1 + ) + + loop(#n) => { + #swap = #n1 + #n2; + #n2 = #n1; + #n1 = #swap; + } + return #n1 + +} + +fibonacci(0) //->output false +fibonacci(1) //->output 1 +fibonacci(2) //->output 1 +fibonacci(3) //->output 2 diff --git a/Task/Fibonacci-sequence/Lingo/fibonacci-sequence-1.lingo b/Task/Fibonacci-sequence/Lingo/fibonacci-sequence-1.lingo new file mode 100644 index 0000000000..72a4688f95 --- /dev/null +++ b/Task/Fibonacci-sequence/Lingo/fibonacci-sequence-1.lingo @@ -0,0 +1,4 @@ +on fib (n) + if n<2 then return n + return fib(n-1)+fib(n-2) +end diff --git a/Task/Fibonacci-sequence/Lingo/fibonacci-sequence-2.lingo b/Task/Fibonacci-sequence/Lingo/fibonacci-sequence-2.lingo new file mode 100644 index 0000000000..46511c65cb --- /dev/null +++ b/Task/Fibonacci-sequence/Lingo/fibonacci-sequence-2.lingo @@ -0,0 +1,11 @@ +on fib (n) + if n<2 then return n + fibPrev = 0 + fib = 1 + repeat with i = 2 to n + tmp = fib + fib = fib + fibPrev + fibPrev = tmp + end repeat + return fib +end diff --git a/Task/Fibonacci-sequence/Lingo/fibonacci-sequence-3.lingo b/Task/Fibonacci-sequence/Lingo/fibonacci-sequence-3.lingo new file mode 100644 index 0000000000..529e37374d --- /dev/null +++ b/Task/Fibonacci-sequence/Lingo/fibonacci-sequence-3.lingo @@ -0,0 +1,6 @@ +on fib (n) + sqrt5 = sqrt(5.0) + p = (1+sqrt5)/2 + q = 1 - p + return integer((power(p,n)-power(q,n))/sqrt5) +end diff --git a/Task/Fibonacci-sequence/LiveCode/fibonacci-sequence.livecode b/Task/Fibonacci-sequence/LiveCode/fibonacci-sequence.livecode new file mode 100644 index 0000000000..a2baa5c0a9 --- /dev/null +++ b/Task/Fibonacci-sequence/LiveCode/fibonacci-sequence.livecode @@ -0,0 +1,20 @@ +-- Iterative, translation of the basic version. +function fibi n + put 0 into aa + put 1 into b + repeat with i = 1 to n + put aa + b into temp + put b into aa + put temp into b + end repeat + return aa +end fibi + +-- Recursive +function fibr n + if n <= 1 then + return n + else + return fibr(n-1) + fibr(n-2) + end if +end fibr diff --git a/Task/Fibonacci-sequence/Luck/fibonacci-sequence.luck b/Task/Fibonacci-sequence/Luck/fibonacci-sequence.luck new file mode 100644 index 0000000000..6bf7ad7db6 --- /dev/null +++ b/Task/Fibonacci-sequence/Luck/fibonacci-sequence.luck @@ -0,0 +1,9 @@ +function fib(x: int): int = ( + let cache = {} in + let fibc x = if x<=1 then x else ( + if x not in cache then + cache[x] = fibc(x-1) + fibc(x-2); + cache[x] + ) in fibc(x) +);; +for x in range(10) do print(fib(x)) diff --git a/Task/Fibonacci-sequence/Monicelli/fibonacci-sequence.monicelli b/Task/Fibonacci-sequence/Monicelli/fibonacci-sequence.monicelli new file mode 100644 index 0000000000..ae2d9ee103 --- /dev/null +++ b/Task/Fibonacci-sequence/Monicelli/fibonacci-sequence.monicelli @@ -0,0 +1,12 @@ +# Main +Lei ha clacsonato +voglio un nonnulla, Necchi mi porga un nonnulla +il nonnulla come se fosse brematurata la supercazzola bonaccia con il nonnulla o scherziamo? +un nonnulla a posterdati + +# Fibonacci function 'bonaccia' +blinda la supercazzola Necchi bonaccia con antani Necchi o scherziamo? che cos'è l'antani? +minore di 3: vaffanzum 1! o tarapia tapioco: voglio unchiamo, Necchi come se fosse brematurata +la supercazzola bonaccia con antani meno 1 o scherziamo? voglio duechiamo, +Necchi come se fosse brematurata la supercazzola bonaccia con antani meno 2 o scherziamo? vaffanzum +unchiamo più duechiamo! e velocità di esecuzione diff --git a/Task/Fibonacci-sequence/NESL/fibonacci-sequence.nesl b/Task/Fibonacci-sequence/NESL/fibonacci-sequence.nesl new file mode 100644 index 0000000000..41e1943341 --- /dev/null +++ b/Task/Fibonacci-sequence/NESL/fibonacci-sequence.nesl @@ -0,0 +1 @@ +function fib(n) = if n < 2 then n else fib(n - 2) + fib(n - 1); diff --git a/Task/Fibonacci-sequence/NGS/fibonacci-sequence.ngs b/Task/Fibonacci-sequence/NGS/fibonacci-sequence.ngs new file mode 100644 index 0000000000..e16999c8dc --- /dev/null +++ b/Task/Fibonacci-sequence/NGS/fibonacci-sequence.ngs @@ -0,0 +1,11 @@ +F fib(n:Int) { + n < 2 returns n + local a = 1, b = 1 + # i is automatically local because of for() + for(i=2; ilength(fcache) then + fcache = append(fcache,fibonamem(absn-1)+fibonamem(absn-2)) + if absn!=length(fcache) then ?9/0 end if + end if + if n<0 and remainder(n,2)=0 then return -fcache[absn] end if + return fcache[absn] +end function + +for i=0 to 30 do + printf(1,"%d", fibonamem(i)) + if i!=30 then puts(1,", ") end if +end for +puts(1,"\n") diff --git a/Task/Fibonacci-sequence/Phix/fibonacci-sequence-2.phix b/Task/Fibonacci-sequence/Phix/fibonacci-sequence-2.phix new file mode 100644 index 0000000000..e0f3536ae8 --- /dev/null +++ b/Task/Fibonacci-sequence/Phix/fibonacci-sequence-2.phix @@ -0,0 +1,22 @@ +include builtins\bigatom.e + +sequence fcacheba = {BA_ONE,BA_ONE} + +function fibonamemba(integer n) -- memoized, works for -ve numbers, yields bigatom +integer absn = abs(n) + if n=0 then return BA_ZERO end if + if absn>length(fcacheba) then + fcacheba = append(fcacheba,ba_add(fibonamemba(absn-1),fibonamemba(absn-2))) + if absn!=length(fcacheba) then ?9/0 end if + end if + if n<0 and remainder(n,2)=0 then return ba_sub(0,fcacheba[absn]) end if + return fcacheba[absn] +end function + +for i=0 to 30 do + ba_printf(1,"%B", fibonamemba(i)) + if i!=30 then puts(1,", ") end if +end for +puts(1,"\n") +ba_printf(1,"%B", fibonamemba(777)) +puts(1,"\n") diff --git a/Task/Fibonacci-sequence/Potion/fibonacci-sequence-1.potion b/Task/Fibonacci-sequence/Potion/fibonacci-sequence-1.potion new file mode 100644 index 0000000000..ef869da96a --- /dev/null +++ b/Task/Fibonacci-sequence/Potion/fibonacci-sequence-1.potion @@ -0,0 +1,5 @@ +recursive = (n): + if (n <= 1): 1. else: recursive (n - 1) + recursive (n - 2).. + +n = 40 +("fib(", n, ")= ", recursive (n), "\n") join print diff --git a/Task/Fibonacci-sequence/Potion/fibonacci-sequence-2.potion b/Task/Fibonacci-sequence/Potion/fibonacci-sequence-2.potion new file mode 100644 index 0000000000..6af93971bf --- /dev/null +++ b/Task/Fibonacci-sequence/Potion/fibonacci-sequence-2.potion @@ -0,0 +1,11 @@ +iterative = (n) : + curr = 0 + prev = 1 + tmp = 0 + n times: + tmp = curr + curr = curr + prev + prev = tmp + . + curr +. diff --git a/Task/Fibonacci-sequence/Potion/fibonacci-sequence-3.potion b/Task/Fibonacci-sequence/Potion/fibonacci-sequence-3.potion new file mode 100644 index 0000000000..ef47348be7 --- /dev/null +++ b/Task/Fibonacci-sequence/Potion/fibonacci-sequence-3.potion @@ -0,0 +1,20 @@ +sqr = (x): x * x. + +# Based on the fact that +# F2n = Fn(2Fn+1 - Fn) +# F2n+1 = Fn ^2 + Fn+1 ^2 +matrix = (n) : + algorithm = (n) : + "computes (Fn, Fn+1)" + if (n < 2): return ((0, 1), (1, 1)) at(n). + + # n = e + {0, 1} + q = algorithm(n / 2) # q = (Fe/2, Fe/2+1) + q = (q(0) * (2 * q(1) - q(0)), sqr(q(0)) + sqr(q(1))) # q => (Fe, Fe+1) + if (n % 2 == 1) : # q => (Fe+{0, 1}, Fe+1+{0,1}) = (Fn, Fn+1) + q = (q(1), q(1) + q(0)) + . + q + . + algorithm(n)(0) +. diff --git a/Task/Fibonacci-sequence/Potion/fibonacci-sequence-4.potion b/Task/Fibonacci-sequence/Potion/fibonacci-sequence-4.potion new file mode 100644 index 0000000000..fa84085cd6 --- /dev/null +++ b/Task/Fibonacci-sequence/Potion/fibonacci-sequence-4.potion @@ -0,0 +1,13 @@ +fibonacci = (n) : + myFavorite = matrix + if (n >= 0) : + myFavorite(n) + . else : + n = n * -1 + if (n % 2 == 1) : + myFavorite(n) + . else : + myFavorite(n) * -1 + . + . +. diff --git a/Task/Fibonacci-sequence/Ra/fibonacci-sequence.ra b/Task/Fibonacci-sequence/Ra/fibonacci-sequence.ra new file mode 100644 index 0000000000..d6ad197a64 --- /dev/null +++ b/Task/Fibonacci-sequence/Ra/fibonacci-sequence.ra @@ -0,0 +1,45 @@ +class FibonacciSequence + **Prints the nth fibonacci number** + + on start + + args := program arguments + + if args empty + print .fibonacci(8) + + else + + try + print .fibonacci(integer.parse(args[0])) + + catch FormatException + print to Console.error made !, "Input must be an integer" + exit program with error code + + catch OverflowException + print to Console.error made !, "Number too large" + exit program with error code + + define fibonacci(n as integer) as integer is shared + **Returns the nth fibonacci number** + + test + assert fibonacci(0) = 0 + assert fibonacci(1) = 1 + assert fibonacci(2) = 1 + assert fibonacci(3) = 2 + assert fibonacci(4) = 3 + assert fibonacci(5) = 5 + assert fibonacci(6) = 8 + assert fibonacci(7) = 13 + assert fibonacci(8) = 21 + + + body + a, b := 0, 1 + + for n + a, b := b, a + b + + return a diff --git a/Task/Fibonacci-sequence/Ring/fibonacci-sequence.ring b/Task/Fibonacci-sequence/Ring/fibonacci-sequence.ring new file mode 100644 index 0000000000..d06af769d3 --- /dev/null +++ b/Task/Fibonacci-sequence/Ring/fibonacci-sequence.ring @@ -0,0 +1,7 @@ +give n +x = fib(n) +see n + " Fibonacci is : " + x + +func fib nr if nr = 0 return 0 ok + if nr = 1 return 1 ok + if nr > 1 return fib(nr-1) + fib(nr-2) ok diff --git a/Task/Fibonacci-sequence/SSEM/fibonacci-sequence.ssem b/Task/Fibonacci-sequence/SSEM/fibonacci-sequence.ssem new file mode 100644 index 0000000000..bc62a9d5c5 --- /dev/null +++ b/Task/Fibonacci-sequence/SSEM/fibonacci-sequence.ssem @@ -0,0 +1,26 @@ +10101000000000100000000000000000 0. -21 to c acc = -n +01101000000001100000000000000000 1. c to 22 temp = acc +00101000000001010000000000000000 2. Sub. 20 acc -= m +10101000000001100000000000000000 3. c to 21 n = acc +10101000000000100000000000000000 4. -21 to c acc = -n +10101000000001100000000000000000 5. c to 21 n = acc +01101000000000100000000000000000 6. -22 to c acc = -temp +00101000000001100000000000000000 7. c to 20 m = acc +11101000000000100000000000000000 8. -23 to c acc = -count +00011000000001010000000000000000 9. Sub. 24 acc -= -1 +00000000000000110000000000000000 10. Test skip next if acc<0 +10011000000000000000000000000000 11. 25 to CI goto (15 + 1) +11101000000001100000000000000000 12. c to 23 count = acc +11101000000000100000000000000000 13. -23 to c acc = -count +11101000000001100000000000000000 14. c to 23 count = acc +00011000000000000000000000000000 15. 24 to CI goto (-1 + 1) +10101000000000100000000000000000 16. -21 to c acc = -n +10101000000001100000000000000000 17. c to 21 n = acc +10101000000000100000000000000000 18. -21 to c acc = -n +00000000000001110000000000000000 19. Stop +00000000000000000000000000000000 20. 0 var m = 0 +10000000000000000000000000000000 21. 1 var n = 1 +00000000000000000000000000000000 22. 0 var temp = 0 +10010000000000000000000000000000 23. 9 var count = 9 +11111111111111111111111111111111 24. -1 const -1 +11110000000000000000000000000000 25. 15 const 15 diff --git a/Task/Fibonacci-sequence/SequenceL/fibonacci-sequence-1.sequencel b/Task/Fibonacci-sequence/SequenceL/fibonacci-sequence-1.sequencel new file mode 100644 index 0000000000..6953f57002 --- /dev/null +++ b/Task/Fibonacci-sequence/SequenceL/fibonacci-sequence-1.sequencel @@ -0,0 +1,4 @@ +fibonacci(n) := + n when n < 2 + else + fibonacci(n - 1) + fibonacci(n - 2); diff --git a/Task/Fibonacci-sequence/SequenceL/fibonacci-sequence-2.sequencel b/Task/Fibonacci-sequence/SequenceL/fibonacci-sequence-2.sequencel new file mode 100644 index 0000000000..490c89a8a4 --- /dev/null +++ b/Task/Fibonacci-sequence/SequenceL/fibonacci-sequence-2.sequencel @@ -0,0 +1,8 @@ +fibonacci(n) := fibonacciHelper(0, 1, n); + +fibonacciHelper(prev, next, n) := + prev when n < 1 + else + next when n = 1 + else + fibonacciHelper(next, next + prev, n - 1); diff --git a/Task/Fibonacci-sequence/SequenceL/fibonacci-sequence-3.sequencel b/Task/Fibonacci-sequence/SequenceL/fibonacci-sequence-3.sequencel new file mode 100644 index 0000000000..9b94830856 --- /dev/null +++ b/Task/Fibonacci-sequence/SequenceL/fibonacci-sequence-3.sequencel @@ -0,0 +1,11 @@ +fibonacci(n) := fibonacciHelper([[1,0],[0,1]], n); + +fibonacciHelper(M(2), n) := + let + N := [[1,1],[1,0]]; + in + M[1,1] when n <= 1 + else + fibonacciHelper(matmul(M, N), n - 1); + +matmul(A(2), B(2)) [i,j] := sum( A[i,all] * B[all,j] ); diff --git a/Task/Fibonacci-sequence/Shen/fibonacci-sequence.shen b/Task/Fibonacci-sequence/Shen/fibonacci-sequence.shen new file mode 100644 index 0000000000..07c7a2177b --- /dev/null +++ b/Task/Fibonacci-sequence/Shen/fibonacci-sequence.shen @@ -0,0 +1,6 @@ +(define fib + 0 -> 0 + 1 -> 1 + N -> (+ (fib (+ N 1)) (fib (+ N 2))) + where (< N 0) + N -> (+ (fib (- N 1)) (fib (- N 2)))) diff --git a/Task/Fibonacci-sequence/Sidef/fibonacci-sequence-1.sidef b/Task/Fibonacci-sequence/Sidef/fibonacci-sequence-1.sidef new file mode 100644 index 0000000000..baf5b77644 --- /dev/null +++ b/Task/Fibonacci-sequence/Sidef/fibonacci-sequence-1.sidef @@ -0,0 +1,7 @@ +func fib_iter(n) { + var fib = [1, 1]; + (n - fib.len).times { + fib = [fib[-1], fib[-2] + fib[-1]] + }; + fib[-1]; +} diff --git a/Task/Fibonacci-sequence/Sidef/fibonacci-sequence-2.sidef b/Task/Fibonacci-sequence/Sidef/fibonacci-sequence-2.sidef new file mode 100644 index 0000000000..792ff3e4d5 --- /dev/null +++ b/Task/Fibonacci-sequence/Sidef/fibonacci-sequence-2.sidef @@ -0,0 +1,3 @@ +func fib_rec(n) { + n < 2 ? n : (__FUNC__(n-1) + __FUNC__(n-2)); +} diff --git a/Task/Fibonacci-sequence/Sidef/fibonacci-sequence-3.sidef b/Task/Fibonacci-sequence/Sidef/fibonacci-sequence-3.sidef new file mode 100644 index 0000000000..1971bb6323 --- /dev/null +++ b/Task/Fibonacci-sequence/Sidef/fibonacci-sequence-3.sidef @@ -0,0 +1,3 @@ +func fib_mem (n) is cached { + n < 2 ? n : (__FUNC__(n-1) + __FUNC__(n-2)); +} diff --git a/Task/Fibonacci-sequence/Sidef/fibonacci-sequence-4.sidef b/Task/Fibonacci-sequence/Sidef/fibonacci-sequence-4.sidef new file mode 100644 index 0000000000..37e8c48ae4 --- /dev/null +++ b/Task/Fibonacci-sequence/Sidef/fibonacci-sequence-4.sidef @@ -0,0 +1,5 @@ +func fib_closed(n) { + define S = (1.25.sqrt + 0.5); + define T = (-S + 1); + (S**n - T**n) / (-T + S) -> roundf(0); +} diff --git a/Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-1.skookum b/Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-1.skookum new file mode 100644 index 0000000000..b361bbed95 --- /dev/null +++ b/Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-1.skookum @@ -0,0 +1 @@ +42.fibonacci diff --git a/Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-2.skookum b/Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-2.skookum new file mode 100644 index 0000000000..d48eef7871 --- /dev/null +++ b/Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-2.skookum @@ -0,0 +1,5 @@ +// Assuming code is in Integer.fibonacci() method +() Integer + [ + if this < 2 [this] else [[this - 1].fibonacci + [this - 2].fibonacci] + ] diff --git a/Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-3.skookum b/Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-3.skookum new file mode 100644 index 0000000000..c03cca9797 --- /dev/null +++ b/Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-3.skookum @@ -0,0 +1,5 @@ +// Assuming in fibonacci(n) procedure +(Integer n) Integer + [ + if n < 2 [n] else [fibonacci(n - 1) + fibonacci(n - 2)] + ] diff --git a/Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-4.skookum b/Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-4.skookum new file mode 100644 index 0000000000..e67e562a67 --- /dev/null +++ b/Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-4.skookum @@ -0,0 +1,19 @@ +// Assuming code is in Integer.fibonacci() method +() Integer + [ + if this < 2 + [this] + else + [ + !prev: 1 + !next: 1 + 2.to_pre this + [ + !sum : prev + next + prev := next + next := sum + ] + + next + ] + ] diff --git a/Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-5.skookum b/Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-5.skookum new file mode 100644 index 0000000000..7e9d9b9ee4 --- /dev/null +++ b/Task/Fibonacci-sequence/SkookumScript/fibonacci-sequence-5.skookum @@ -0,0 +1,24 @@ +// Bind : is faster than assignment := +// loop is faster than to_pre (which uses a closure) +() Integer + [ + if this < 2 + [this] + else + [ + !prev: 1 + !next: 1 + !sum + !count: this - 2 + loop + [ + if count = 0 [exit] + count-- + sum : prev + next + prev : next + next : sum + ] + + next + ] + ] diff --git a/Task/Fibonacci-sequence/Swift/fibonacci-sequence-1.swift b/Task/Fibonacci-sequence/Swift/fibonacci-sequence-1.swift new file mode 100644 index 0000000000..1d97c1af55 --- /dev/null +++ b/Task/Fibonacci-sequence/Swift/fibonacci-sequence-1.swift @@ -0,0 +1,12 @@ +import Cocoa + +func fibonacci(n: Int) -> Int { + let square_root_of_5 = sqrt(5.0) + let p = (1 + square_root_of_5) / 2 + let q = 1 / p + return Int((pow(p,CDouble(n)) + pow(q,CDouble(n))) / square_root_of_5 + 0.5) +} + +for i in 1...30 { + println(fibonacci(i)) +} diff --git a/Task/Fibonacci-sequence/Swift/fibonacci-sequence-2.swift b/Task/Fibonacci-sequence/Swift/fibonacci-sequence-2.swift new file mode 100644 index 0000000000..e874dc2699 --- /dev/null +++ b/Task/Fibonacci-sequence/Swift/fibonacci-sequence-2.swift @@ -0,0 +1,11 @@ +func fibonacci(n: Int) -> Int { + if n < 2 { + return n + } + var fibPrev = 1 + var fib = 1 + for num in 2...n { + (fibPrev, fib) = (fib, fib + fibPrev) + } + return fib +} diff --git a/Task/Fibonacci-sequence/Swift/fibonacci-sequence-3.swift b/Task/Fibonacci-sequence/Swift/fibonacci-sequence-3.swift new file mode 100644 index 0000000000..1a094c70a0 --- /dev/null +++ b/Task/Fibonacci-sequence/Swift/fibonacci-sequence-3.swift @@ -0,0 +1,9 @@ +func fibonacci() -> SequenceOf { + return SequenceOf {() -> GeneratorOf in + var window: (UInt, UInt, UInt) = (0, 0, 1) + return GeneratorOf { + window = (window.1, window.2, window.1 + window.2) + return window.0 + } + } +} diff --git a/Task/Fibonacci-sequence/Swift/fibonacci-sequence-4.swift b/Task/Fibonacci-sequence/Swift/fibonacci-sequence-4.swift new file mode 100644 index 0000000000..b95c560a01 --- /dev/null +++ b/Task/Fibonacci-sequence/Swift/fibonacci-sequence-4.swift @@ -0,0 +1,9 @@ +func fibonacci(n: Int) -> Int { + if n < 2 { + return n + } else { + return fibonacci(n-1) + fibonacci(n-2) + } +} + +println(fibonacci(30)) diff --git a/Task/Fibonacci-sequence/Ursa/fibonacci-sequence.ursa b/Task/Fibonacci-sequence/Ursa/fibonacci-sequence.ursa new file mode 100644 index 0000000000..0bef08d178 --- /dev/null +++ b/Task/Fibonacci-sequence/Ursa/fibonacci-sequence.ursa @@ -0,0 +1,12 @@ +def fibIter (int n) + if (< n 2) + return n + end if + decl int fib fibPrev num + set fib (set fibPrev 1) + for (set num 2) (< num n) (inc num) + set fib (+ fib fibPrev) + set fibPrev (- fib fibPrev) + end for + return fib +end diff --git a/Task/Fibonacci-sequence/Wart/fibonacci-sequence-1.wart b/Task/Fibonacci-sequence/Wart/fibonacci-sequence-1.wart new file mode 100644 index 0000000000..b65cfaec3c --- /dev/null +++ b/Task/Fibonacci-sequence/Wart/fibonacci-sequence-1.wart @@ -0,0 +1,4 @@ +def (fib n) + if (n < 2) + n + (+ (fib n-1) (fib n-2)) diff --git a/Task/Fibonacci-sequence/Wart/fibonacci-sequence-2.wart b/Task/Fibonacci-sequence/Wart/fibonacci-sequence-2.wart new file mode 100644 index 0000000000..4573d8d4e7 --- /dev/null +++ b/Task/Fibonacci-sequence/Wart/fibonacci-sequence-2.wart @@ -0,0 +1,5 @@ +def (fib n) + (+ (fib n-1) (fib n-2)) + +def (fib n) :case (n < 2) + n diff --git a/Task/Fibonacci-sequence/Wart/fibonacci-sequence-3.wart b/Task/Fibonacci-sequence/Wart/fibonacci-sequence-3.wart new file mode 100644 index 0000000000..f9ce333bc2 --- /dev/null +++ b/Task/Fibonacci-sequence/Wart/fibonacci-sequence-3.wart @@ -0,0 +1,6 @@ +def (fib n saved) + # all args in wart are optional, and we expect callers to not provide saved + default saved :to (table 0 0 1 1) # pre-populate base cases + default saved.n :to + (+ (fib n-1 saved) (fib n-2 saved)) + saved.n diff --git a/Task/Fibonacci-sequence/XLISP/fibonacci-sequence-1.xlisp b/Task/Fibonacci-sequence/XLISP/fibonacci-sequence-1.xlisp new file mode 100644 index 0000000000..be6d78195b --- /dev/null +++ b/Task/Fibonacci-sequence/XLISP/fibonacci-sequence-1.xlisp @@ -0,0 +1,2 @@ +(DEFUN FIBONACCI (N) + (FLOOR (+ (/ (EXPT (/ (+ (SQRT 5) 1) 2) N) (SQRT 5)) 0.5))) diff --git a/Task/Fibonacci-sequence/XLISP/fibonacci-sequence-2.xlisp b/Task/Fibonacci-sequence/XLISP/fibonacci-sequence-2.xlisp new file mode 100644 index 0000000000..e1949ab74c --- /dev/null +++ b/Task/Fibonacci-sequence/XLISP/fibonacci-sequence-2.xlisp @@ -0,0 +1,5 @@ +(DEFUN RANGE (X Y) + (IF (<= X Y) + (CONS X (RANGE (+ X 1) Y)))) + +(PRINT (MAPCAR FIBONACCI (RANGE 1 50))) diff --git a/Task/Fibonacci-sequence/jq/fibonacci-sequence-1.jq b/Task/Fibonacci-sequence/jq/fibonacci-sequence-1.jq new file mode 100644 index 0000000000..be2aadac0f --- /dev/null +++ b/Task/Fibonacci-sequence/jq/fibonacci-sequence-1.jq @@ -0,0 +1,4 @@ +def nth_fib_naive(n): + if (n < 2) then n + else nth_fib_naive(n - 1) + nth_fib_naive(n - 2) + end; diff --git a/Task/Fibonacci-sequence/jq/fibonacci-sequence-2.jq b/Task/Fibonacci-sequence/jq/fibonacci-sequence-2.jq new file mode 100644 index 0000000000..5057502f48 --- /dev/null +++ b/Task/Fibonacci-sequence/jq/fibonacci-sequence-2.jq @@ -0,0 +1,8 @@ +def nth_fib(n): + # input: [f(i-2), f(i-1), countdown] + def fib: (.[0] + .[1]) as $sum + | .[2] as $n + | if ($n <= 0) then $sum + else [ .[1], $sum, $n - 1 ] + | fib end; + [-1, 1, n] | fib; diff --git a/Task/Fibonacci-sequence/jq/fibonacci-sequence-3.jq b/Task/Fibonacci-sequence/jq/fibonacci-sequence-3.jq new file mode 100644 index 0000000000..59cb3ea062 --- /dev/null +++ b/Task/Fibonacci-sequence/jq/fibonacci-sequence-3.jq @@ -0,0 +1 @@ +(range(0;5), 50) | [., nth_fib(.)] diff --git a/Task/Fibonacci-sequence/jq/fibonacci-sequence-4.jq b/Task/Fibonacci-sequence/jq/fibonacci-sequence-4.jq new file mode 100644 index 0000000000..829d022ebc --- /dev/null +++ b/Task/Fibonacci-sequence/jq/fibonacci-sequence-4.jq @@ -0,0 +1,6 @@ +[0,0] +[1,1] +[2,1] +[3,2] +[4,3] +[50,12586269025] diff --git a/Task/Fibonacci-sequence/jq/fibonacci-sequence-5.jq b/Task/Fibonacci-sequence/jq/fibonacci-sequence-5.jq new file mode 100644 index 0000000000..3fe4f41436 --- /dev/null +++ b/Task/Fibonacci-sequence/jq/fibonacci-sequence-5.jq @@ -0,0 +1,7 @@ +def fib_binet(n): + (5|sqrt) as $rt + | ((1 + $rt)/2) as $phi + | (($phi | log) * n | exp) as $phin + | (if 0 == (n % 2) then 1 else -1 end) as $sign + | ( ($phin - ($sign / $phin) ) / $rt ) + .5 + | floor; diff --git a/Task/Fibonacci-sequence/jq/fibonacci-sequence-6.jq b/Task/Fibonacci-sequence/jq/fibonacci-sequence-6.jq new file mode 100644 index 0000000000..ed06dab80f --- /dev/null +++ b/Task/Fibonacci-sequence/jq/fibonacci-sequence-6.jq @@ -0,0 +1,8 @@ +# Generator +def fibonacci(n): + # input: [f(i-2), f(i-1), countdown] + def fib: (.[0] + .[1]) as $sum + | if .[2] == 0 then $sum + else $sum, ([ .[1], $sum, .[2] - 1 ] | fib) + end; + [-1, 1, n] | fib; diff --git a/Task/Fibonacci-word-fractal/FreeBASIC/fibonacci-word-fractal.freebasic b/Task/Fibonacci-word-fractal/FreeBASIC/fibonacci-word-fractal.freebasic new file mode 100644 index 0000000000..beba5afbe9 --- /dev/null +++ b/Task/Fibonacci-word-fractal/FreeBASIC/fibonacci-word-fractal.freebasic @@ -0,0 +1,109 @@ +' version 23-06-2015 +' compile with: fbc -s console "filename".bas + +Dim As String fw1, fw2, fw3 +Dim As Integer a, b, d , i, n , x, y, w, h +Dim As Any Ptr img_ptr, scr_ptr + +' data for screen/buffer size +Data 1, 2, 3, 2, 2, 2, 2, 2, 7, 10, 8, 14 +Dim As Integer s(38,2) +For i = 3 To 9 + Read s(i,1) : Read s(i,2) +Next +For i = 9 To 38 Step 6 + s(i, 1) = s(i -1, 1) +2 : s(i, 2) = s(i -1, 1) + s(i -1, 2) + s(i +1, 1) = s(i, 2) +2 : s(i +1, 2) = s(i, 2) + s(i +2, 1) = s(i, 1) + s(i, 2) : s(i +2, 2) = s(i, 2) + s(i +3, 1) = s(i +1, 1 ) + s(i +2, 1) : s(i +3, 2) = s(i ,2) + s(i +4, 1) = s(i +3, 1) : s(i +4, 2) = s(i +3, 1) + 2 + s(i +5, 1) = s(i +3, 1) : s(i +5, 2) = s(i +3, 2) + s(i +4, 2) +2 +Next + +' we need to set screen in order to create image buffer in memory +Screen 21 +scr_ptr = ScreenPtr() +If (scr_ptr = 0) Then + Print "Error: graphics screen not initialized." + Sleep + End -1 +End If + +Do + Cls + Do + + Print + Print "For wich n do you want the Fibonacci Word fractal (3 to 35)." + While Inkey <> "" : fw1 = Inkey : Wend ' empty keyboard buffer + Input "Enter or a value smaller then 3 to stop: "; n + If n < 3 Then + Print : Print "Stopping." + Sleep 3000,1 + End + EndIf + If n > 35 then + Print : Print "Fractal is to big, unable to create it." + Sleep 3000,1 + Continue Do + End If + Loop Until n < 36 + + fw1 = "1" : fw2 = "0" ' construct the string + For i = 3 To n + fw3 = fw2 + fw1 + Swap fw1, fw2 ' swap pointers of fw1 and fw2 + Swap fw2, fw3 ' swap pointers of fw2 and fw3 + Next + fw1 = "" : fw3 = "" ' free up memory + + w = s(n, 1) +1 : h = s(n, 2) +1 + ' allocate memory for a buffer to hold the image + ' use 8 bits to hold the color + img_ptr = ImageCreate(w,h,0,8) + If img_ptr = 0 Then ' check if we have created a image buffer + Print "Failed to create image." + Sleep + End -1 + End If + + x = 0: y = h -1 : d = 1 ' set starting point and direction flag + PSet img_ptr, (x, y) ' set start point + For a = 1 To Len(fw2) + Select Case As Const d + Case 0 + x = x + 2 + Case 1 + y = y - 2 + Case 2 + x = x - 2 + Case 3 + y = y + 2 + End Select + Line img_ptr, -(x, y) + b = fw2[a-1] - Asc("0") + If b = 0 Then + If (a And 1) Then + d = d + 3 ' a = odd + Else + d = d + 1 ' a = even + End If + d = d And 3 + End If + Next + + If n < 24 Then ' size is smaller then screen dispay fractal + Cls + Put (5, 5),img_ptr, PSet + Else + Print + Print "Fractal is to big for display." + End If + ' saves fractal as bmp file (8 bit palette) + If n > 23 Then h = 80 + Draw String (0, h +16), "saving fractal as fibword" + Str(n) + ".bmp." + BSave "F_Word" + Str(n) + ".bmp", img_ptr + Draw String (0, h +32), "Hit any key to continue." + Sleep + ImageDestroy(img_ptr) ' free memory holding the image +Loop diff --git a/Task/Fibonacci-word-fractal/Sidef/fibonacci-word-fractal.sidef b/Task/Fibonacci-word-fractal/Sidef/fibonacci-word-fractal.sidef new file mode 100644 index 0000000000..df06089f41 --- /dev/null +++ b/Task/Fibonacci-word-fractal/Sidef/fibonacci-word-fractal.sidef @@ -0,0 +1,62 @@ +var(m=17, scale=3) = ARGV.map{.to_i}... + +(var world = Hash.new){0}{0} = 1 +var loc = Complex(0, 0) +var dir = Complex.i + +var fib = ['1', '0'] +func fib_word(n) { + fib[n] \\= (fib_word(n-1) + fib_word(n-2)) +} + +func step { + scale.times { + loc += dir + world{loc.im}{loc.re} = 1 + } +} + +func turn_left { dir *= Complex.i } +func turn_right { dir *= -Complex.i } + +var n = 1 +fib_word(m).each_char { |c| + if (c == '0') { + step() + n % 2 == 0 ? turn_left() + : turn_right() + } else { n++ } +} + +func braille_graphics(a) { + var (xlo, xhi, ylo, yhi) = +([Inf, -Inf]*2)... + + a.each_key { |y| + ylo.min!(y.to_i) + yhi.max!(y.to_i) + a{y}.each_key { |x| + xlo.min!(x.to_i) + xhi.max!(x.to_i) + } + } + + for y in (ylo .. (yhi, 4)) { + for x in (xlo .. (xhi, 2)) { + var cell = 0x2800 + + a{y+0}{x+0} && (cell += 1) + a{y+1}{x+0} && (cell += 2) + a{y+2}{x+0} && (cell += 4) + a{y+0}{x+1} && (cell += 8) + a{y+1}{x+1} && (cell += 16) + a{y+2}{x+1} && (cell += 32) + a{y+3}{x+0} && (cell += 64) + a{y+3}{x+1} && (cell += 128) + + print cell.chr + } + print "\n" + } +} + +braille_graphics(world) diff --git a/Task/Fibonacci-word/EchoLisp/fibonacci-word.echolisp b/Task/Fibonacci-word/EchoLisp/fibonacci-word.echolisp new file mode 100644 index 0000000000..d60b0f119e --- /dev/null +++ b/Task/Fibonacci-word/EchoLisp/fibonacci-word.echolisp @@ -0,0 +1,26 @@ +(lib 'struct) +(struct FW ( count0 count1 length string)) ;; a fibonacci word +(define (F-word n) ;; generator + (define a (F-word (1- n))) + (define b (F-word (- n 2))) + (FW + (+ (FW-count0 a) (FW-count0 b)) + (+ (FW-count1 a) (FW-count1 b)) + (+ (FW-length a) (FW-length b)) + (if (> n 9) "..." (string-append (FW-string a) (FW-string b))))) + +(remember 'F-word (vector 0 (FW 0 1 1 "1") (FW 1 0 1 "0"))) + +(define (entropy fw) + (define p (// (FW-count0 fw) (FW-length fw))) + (cond + ((= p 0) 0) + ((= p 1) 0) + (else (- 0 (* p (log2 p)) (* (- 1 p) (log2 (- 1 p))))))) + + +(define (task (n 38) (fw)) + (for ((i (in-range 1 n))) + (set! fw (F-word i)) + (printf "%3d %10d %24d %a" + i (FW-length fw) (entropy fw) (FW-string fw)))) diff --git a/Task/Fibonacci-word/FreeBASIC/fibonacci-word.freebasic b/Task/Fibonacci-word/FreeBASIC/fibonacci-word.freebasic new file mode 100644 index 0000000000..4483f05985 --- /dev/null +++ b/Task/Fibonacci-word/FreeBASIC/fibonacci-word.freebasic @@ -0,0 +1,61 @@ +' version 25-06-2015 +' compile with: fbc -s console + +Function calc_entropy(source As String, base_ As Integer) As Double + + Dim As Integer i, sourcelen = Len(source), totalchar(255) + Dim As Double prop, entropy + + For i = 0 To sourcelen -1 + totalchar(source[i]) += 1 + Next + + For i = 0 To 255 + If totalchar(i) = 0 Then Continue For + prop = totalchar(i) / sourcelen + entropy = entropy - (prop * Log (prop) / Log(base_)) + Next + + Return entropy + +End Function + +' ------=< MAIN >=------ + +Dim As String fw1 = "1" , fw2 = "0", fw3 +Dim As Integer i, n + +Print" N Length Entropy Word" +n = 1 +Print Using " ###";n; : Print Using " ###########"; Len(fw1); +Print Using " ##.############### "; calc_entropy(fw1,2); +Print fw1 +n = 2 +Print Using " ###";n ;: Print Using " ###########"; Len(fw2); +Print Using " ##.############### "; calc_entropy(fw2,2); +Print fw2 + + +For n = 1 To 35 + + fw1 = "1" : fw2 = "0" ' construct string + For i = 1 To n + fw3 = fw2 + fw1 + Swap fw1, fw2 ' swap pointers of fw1 and fw2 + Swap fw2, fw3 ' swap pointers of fw2 and fw3 + Next + fw1 = "" : fw3 = "" ' free up memory + + Print Using " ### ########### ##.############### "; n +2; Len(fw2);_ + calc_entropy(fw2, 2); + If Len(fw2) < 55 Then Print fw2 Else Print + +Next + +Print + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Fibonacci-word/Oforth/fibonacci-word.oforth b/Task/Fibonacci-word/Oforth/fibonacci-word.oforth new file mode 100644 index 0000000000..b28ff0f86f --- /dev/null +++ b/Task/Fibonacci-word/Oforth/fibonacci-word.oforth @@ -0,0 +1,13 @@ +: entropy(s) -- f +| freq sz | + s size dup ifZero: [ return ] asFloat ->sz + ListBuffer initValue(255, 0) ->freq + s apply( #[ dup freq at 1+ freq put ] ) + 0.0 freq applyIf( #[ 0 <> ], #[ sz / dup ln * - ] ) Ln2 / ; + + +: FWords(n) +| ws i | + ListBuffer new dup add("1") dup add("0") dup ->ws + 3 n for: i [ i 1- ws at i 2 - ws at + ws add ] + dup map(#[ dup size swap entropy Pair new]) apply(#println) ; diff --git a/Task/Fibonacci-word/Sidef/fibonacci-word.sidef b/Task/Fibonacci-word/Sidef/fibonacci-word.sidef new file mode 100644 index 0000000000..483ed12243 --- /dev/null +++ b/Task/Fibonacci-word/Sidef/fibonacci-word.sidef @@ -0,0 +1,22 @@ +func entropy(s) { + [0] + (s.chars.freq.values »/» s.len) -> reduce { |a,b| + a - b*b.log2 + } +} + +var n_max = 37 +var words = ['1', '0'] + +{ + words.append(words[-1] + words[-2]) +} * (n_max - words.len) + +say ('%3s %10s %15s %s' % ...) + +for i in ^words { + var word = words[i] + say ('%3i %10i %15.12f %s' % (i+1, + word.len, + entropy(word), + word.len<30 ? word : '')) +} diff --git a/Task/Fibonacci-word/jq/fibonacci-word-1.jq b/Task/Fibonacci-word/jq/fibonacci-word-1.jq new file mode 100644 index 0000000000..f41e925a29 --- /dev/null +++ b/Task/Fibonacci-word/jq/fibonacci-word-1.jq @@ -0,0 +1,10 @@ +# Input: an array of strings. +# Output: an object with the strings as keys, +# the values of which are the corresponding frequencies. +def counter: + reduce .[] as $item ( {}; .[$item] += 1 ) ; + +# entropy in bits of the input string +def entropy: + (explode | map( [.] | implode ) | counter | [ .[] | . * (.|log) ] | add) as $sum + | ((length|log) - ($sum / length)) / (2|log) ; diff --git a/Task/Fibonacci-word/jq/fibonacci-word-2.jq b/Task/Fibonacci-word/jq/fibonacci-word-2.jq new file mode 100644 index 0000000000..05b66c19c3 --- /dev/null +++ b/Task/Fibonacci-word/jq/fibonacci-word-2.jq @@ -0,0 +1,18 @@ +# truncate n places after the decimal point; +# return a string since it can readily be converted back to a number +def precision(n): + tostring as $s | $s | index(".") + | if . then $s[0:.+n+1] else $s end ; + +# Right-justify but do not truncate +def rjustify(n): + tostring | length as $length + | if n <= $length then . else " " * (n-$length) + . end; + +# Attempt to align decimals so integer part is in a field of width n +def align(n): + tostring | index(".") as $ix + | if n < $ix then . + elif $ix then (.[0:$ix]|rjustify(n)) +.[$ix:] + else rjustify(n) + end ; diff --git a/Task/Fibonacci-word/jq/fibonacci-word-3.jq b/Task/Fibonacci-word/jq/fibonacci-word-3.jq new file mode 100644 index 0000000000..9211b3adc8 --- /dev/null +++ b/Task/Fibonacci-word/jq/fibonacci-word-3.jq @@ -0,0 +1,23 @@ +# Generate the first n terms of the Fibonacci word sequence +# as a stream of arrays of the form [index, word] +def fibonacci_words(n): + # input: [f(i-2), f(i-1), countdown, counter] + def fib: + if .[2] == 1 then [.[3], .[0]] + else + (.[1] + .[0]) as $sum + | [ .[3], .[0]], ([ .[1], $sum, (.[2] - 1), (.[3] + 1) ] | fib) + end; + if n <= 0 then empty + else (["1", "0", n, 1] | fib) + end; + +def task(n): + fibonacci_words(n) + | .[0] as $i + | (.[1]|length) as $len + | (.[1]|entropy) as $e + | "\($i|rjustify(3)) \($len|rjustify(10)) \($e|precision(6))" +; + +task(37) diff --git a/Task/File-input-output/FreeBASIC/file-input-output.freebasic b/Task/File-input-output/FreeBASIC/file-input-output.freebasic new file mode 100644 index 0000000000..5b467569f5 --- /dev/null +++ b/Task/File-input-output/FreeBASIC/file-input-output.freebasic @@ -0,0 +1,22 @@ +' FB 1.05.0 Win64 + +/' +input.txt contains: + +The quick brown fox jumps over the lazy dog. +Empty vessels make most noise. +Too many chefs spoil the broth. +A rolling stone gathers no moss. +'/ + +Open "output.txt" For Output As #1 +Open "input.txt" For Input As #2 +Dim line_ As String ' note that line is a keyword + +While Not Eof(2) + Line Input #2, line_ + Print #1, line_ +Wend + +Close #2 +Close #1 diff --git a/Task/File-input-output/I/file-input-output.i b/Task/File-input-output/I/file-input-output.i new file mode 100644 index 0000000000..2e93584d62 --- /dev/null +++ b/Task/File-input-output/I/file-input-output.i @@ -0,0 +1,13 @@ +software { + var data = "" + var file = open("input.txt") + loop { + ! data += file(256) + issues { + break + } + } + delete("output.txt") + file = open("output.txt") + file(data) +} diff --git a/Task/File-input-output/Lingo/file-input-output-1.lingo b/Task/File-input-output/Lingo/file-input-output-1.lingo new file mode 100644 index 0000000000..df5f187fa7 --- /dev/null +++ b/Task/File-input-output/Lingo/file-input-output-1.lingo @@ -0,0 +1,34 @@ +---------------------------------------- +-- Returns file as ByteArray +-- @param {string} tFile +-- @return {byteArray|false} +---------------------------------------- +on getBytes (tFile) + fp = xtra("fileIO").new() + fp.openFile(tFile, 1) + if fp.status() then return false + data = fp.readByteArray(fp.getLength()) + fp.closeFile() + return data +end + +---------------------------------------- +-- Saves ByteArray to file +-- @param {string} tFile +-- @param {byteArray} tString +-- @return {bool} success +---------------------------------------- +on putBytes (tFile, tByteArray) + fp = xtra("fileIO").new() + fp.openFile(tFile, 2) + err = fp.status() + if not (err) then fp.delete() + else if (err and not (err = -37)) then return false + fp.createFile(tFile) + if fp.status() then return false + fp.openFile(tFile, 2) + if fp.status() then return false + fp.writeByteArray(tByteArray) + fp.closeFile() + return true +end diff --git a/Task/File-input-output/Lingo/file-input-output-2.lingo b/Task/File-input-output/Lingo/file-input-output-2.lingo new file mode 100644 index 0000000000..f1ef281a5a --- /dev/null +++ b/Task/File-input-output/Lingo/file-input-output-2.lingo @@ -0,0 +1,2 @@ +data = getBytes("input.txt") +putBytes("output.txt", data) diff --git a/Task/File-input-output/Nim/file-input-output-1.nim b/Task/File-input-output/Nim/file-input-output-1.nim new file mode 100644 index 0000000000..fa4f5b2020 --- /dev/null +++ b/Task/File-input-output/Nim/file-input-output-1.nim @@ -0,0 +1,2 @@ +import os +copyfile("input.txt", "output.txt") diff --git a/Task/File-input-output/Nim/file-input-output-2.nim b/Task/File-input-output/Nim/file-input-output-2.nim new file mode 100644 index 0000000000..11ae005d0f --- /dev/null +++ b/Task/File-input-output/Nim/file-input-output-2.nim @@ -0,0 +1,2 @@ +let x = readFile("input.txt") +writeFile("output.txt", x) diff --git a/Task/File-input-output/Nim/file-input-output-3.nim b/Task/File-input-output/Nim/file-input-output-3.nim new file mode 100644 index 0000000000..c9bdcc6a0e --- /dev/null +++ b/Task/File-input-output/Nim/file-input-output-3.nim @@ -0,0 +1,9 @@ +var + i = open("input.txt") + o = open("output.txt", fmWrite) + +for line in i.lines: + o.writeln(line) + +i.close() +o.close() diff --git a/Task/File-input-output/Nim/file-input-output-4.nim b/Task/File-input-output/Nim/file-input-output-4.nim new file mode 100644 index 0000000000..e0c7a9e926 --- /dev/null +++ b/Task/File-input-output/Nim/file-input-output-4.nim @@ -0,0 +1,12 @@ +const size = 4096 + +var + i = open("input.txt") + o = open("output.txt", fmWrite) + buf: array[size, char] + +while i.readBuffer(buf.addr, size) > 0: + discard o.writeBuffer(buf.addr, size) + +i.close() +o.close() diff --git a/Task/File-input-output/Nim/file-input-output-5.nim b/Task/File-input-output/Nim/file-input-output-5.nim new file mode 100644 index 0000000000..f46468cb77 --- /dev/null +++ b/Task/File-input-output/Nim/file-input-output-5.nim @@ -0,0 +1,11 @@ +import memfiles + +var + i = memfiles.open("input.txt") + o = system.open("output.txt", fmWrite) + +var written = o.writeBuffer(i.mem, i.size) +assert(written == i.size) + +i.close() +o.close() diff --git a/Task/File-input-output/Oforth/file-input-output-1.oforth b/Task/File-input-output/Oforth/file-input-output-1.oforth new file mode 100644 index 0000000000..5b5da5f37a --- /dev/null +++ b/Task/File-input-output/Oforth/file-input-output-1.oforth @@ -0,0 +1,7 @@ +: fcopy(in, out) +| f g | + File newMode(in, File.BINARY) dup open(File.READ) ->f + File newMode(out, File.BINARY) dup open(File.WRITE) ->g + + while(f >> dup notNull) [ g addChar ] drop + f close g close ; diff --git a/Task/File-input-output/Oforth/file-input-output-2.oforth b/Task/File-input-output/Oforth/file-input-output-2.oforth new file mode 100644 index 0000000000..027dfc250a --- /dev/null +++ b/Task/File-input-output/Oforth/file-input-output-2.oforth @@ -0,0 +1 @@ +fcopy("input.txt", "output.txt") diff --git a/Task/File-input-output/Phix/file-input-output-1.phix b/Task/File-input-output/Phix/file-input-output-1.phix new file mode 100644 index 0000000000..817a459df3 --- /dev/null +++ b/Task/File-input-output/Phix/file-input-output-1.phix @@ -0,0 +1,6 @@ +integer fn = open("input.txt","rb") +string txt = get_text(fn) + close(fn) + fn = open("output.txt","wb") + puts(fn,txt) + close(fn) diff --git a/Task/File-input-output/Phix/file-input-output-2.phix b/Task/File-input-output/Phix/file-input-output-2.phix new file mode 100644 index 0000000000..20479e5ca7 --- /dev/null +++ b/Task/File-input-output/Phix/file-input-output-2.phix @@ -0,0 +1,10 @@ +integer infn = open("input.txt","r"), + outfn = open("output.txt","w") +object line + while 1 do + line = gets(infn) + if atom(line) then exit end if + puts(outfn,line) + end while + close(infn) + close(outfn) diff --git a/Task/File-input-output/Phix/file-input-output-3.phix b/Task/File-input-output/Phix/file-input-output-3.phix new file mode 100644 index 0000000000..56c4a3340e --- /dev/null +++ b/Task/File-input-output/Phix/file-input-output-3.phix @@ -0,0 +1,10 @@ +integer byte, + infd = open("input.txt","rb"), + outfd = open("output.txt","wb") + while 1 do + byte = getc(infd) + if byte=-1 then exit end if + puts(outfd,byte) + end while + close(infd) + close(outfd) diff --git a/Task/File-input-output/Ring/file-input-output.ring b/Task/File-input-output/Ring/file-input-output.ring new file mode 100644 index 0000000000..bfdbb47cb2 --- /dev/null +++ b/Task/File-input-output/Ring/file-input-output.ring @@ -0,0 +1,19 @@ +fn1 = "ReadMe.txt" +fn2 = "ReadMe2.txt" + +fp = fopen(fn1,"r") +str = fread(fp, getFileSize(fp)) +fclose(fp) + +fp = fopen(fn2,"w") +fwrite(fp, str) +fclose(fp) +see "OK" + nl + +func getFileSize fp + c_filestart = 0 + c_fileend = 2 + fseek(fp,0,c_fileend) + nfilesize = ftell(fp) + fseek(fp,0,c_filestart) + return nfilesize diff --git a/Task/File-input-output/Sidef/file-input-output.sidef b/Task/File-input-output/Sidef/file-input-output.sidef new file mode 100644 index 0000000000..3df70f00f8 --- /dev/null +++ b/Task/File-input-output/Sidef/file-input-output.sidef @@ -0,0 +1,6 @@ +var in = %f'input.txt'.open_r; +var out = %f'output.txt'.open_w; + +in.each { |line| + out.print(line); +}; diff --git a/Task/File-input-output/Ursa/file-input-output.ursa b/Task/File-input-output/Ursa/file-input-output.ursa new file mode 100644 index 0000000000..4a32d2dfa0 --- /dev/null +++ b/Task/File-input-output/Ursa/file-input-output.ursa @@ -0,0 +1,7 @@ +decl file input output +decl string contents +input.open "input.txt" +output.create "output.txt" +output.open "output.txt" +set contents (input.readall) +out contents output diff --git a/Task/File-input-output/Wart/file-input-output.wart b/Task/File-input-output/Wart/file-input-output.wart new file mode 100644 index 0000000000..269ae0c434 --- /dev/null +++ b/Task/File-input-output/Wart/file-input-output.wart @@ -0,0 +1,4 @@ +with infile "input.txt" + with outfile "output.txt" + whilet line (read_line) + prn line diff --git a/Task/File-input-output/jq/file-input-output-1.jq b/Task/File-input-output/jq/file-input-output-1.jq new file mode 100644 index 0000000000..b201de84a6 --- /dev/null +++ b/Task/File-input-output/jq/file-input-output-1.jq @@ -0,0 +1 @@ +jq -M --raw-input --raw-output '. as $line | $line' input.txt > output.txt diff --git a/Task/File-input-output/jq/file-input-output-2.jq b/Task/File-input-output/jq/file-input-output-2.jq new file mode 100644 index 0000000000..26094eeed3 --- /dev/null +++ b/Task/File-input-output/jq/file-input-output-2.jq @@ -0,0 +1 @@ +jq -M '. as $line | $line' input.txt > output.txt diff --git a/Task/File-modification-time/FreeBASIC/file-modification-time.freebasic b/Task/File-modification-time/FreeBASIC/file-modification-time.freebasic new file mode 100644 index 0000000000..cdb7fe496f --- /dev/null +++ b/Task/File-modification-time/FreeBASIC/file-modification-time.freebasic @@ -0,0 +1,20 @@ +' FB 1.05.0 Win64 + +' This example is taken directly from the FB documentation (see [http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgFiledatetime]) + +#include "vbcompat.bi" '' to use Format function + +Dim filename As String, d As Double + +Print "Enter a filename: " +Line Input filename + +If FileExists(filename) Then + Print "File last modified: "; + d = FileDateTime( filename ) + Print Format( d, "yyyy-mm-dd hh:mm AM/PM" ) +Else + Print "File not found" +End If + +Sleep diff --git a/Task/File-modification-time/Lasso/file-modification-time.lasso b/Task/File-modification-time/Lasso/file-modification-time.lasso new file mode 100644 index 0000000000..37bf7870fd --- /dev/null +++ b/Task/File-modification-time/Lasso/file-modification-time.lasso @@ -0,0 +1,4 @@ +local(f) = file('input.txt') +handle => { #f->close } +#f->modificationDate->format('%-D %r') +// result: 12/2/2010 11:04:15 PM diff --git a/Task/File-modification-time/Nim/file-modification-time.nim b/Task/File-modification-time/Nim/file-modification-time.nim new file mode 100644 index 0000000000..6e9bb72cb4 --- /dev/null +++ b/Task/File-modification-time/Nim/file-modification-time.nim @@ -0,0 +1,16 @@ +import os, times +let accTime = getLastAccessTime("filename") +let modTime = getLastModificationTime("filename") + +import posix +var unixAccTime = Timeval(tv_sec: int(accTime)) +var unixModTime = Timeval(tv_sec: int(modTime)) + +# Set the modification time +unixModTime.tv_sec = 0 + +var times = [unixAccTime, unixModTime] +discard utimes("filename", addr(times)) + +# Set the access and modification times to the current time +discard utimes("filename", nil) diff --git a/Task/File-modification-time/Oforth/file-modification-time.oforth b/Task/File-modification-time/Oforth/file-modification-time.oforth new file mode 100644 index 0000000000..4a67fb763e --- /dev/null +++ b/Task/File-modification-time/Oforth/file-modification-time.oforth @@ -0,0 +1 @@ +File new("myfile.txt") modified diff --git a/Task/File-modification-time/Sidef/file-modification-time.sidef b/Task/File-modification-time/Sidef/file-modification-time.sidef new file mode 100644 index 0000000000..55d8060d84 --- /dev/null +++ b/Task/File-modification-time/Sidef/file-modification-time.sidef @@ -0,0 +1,6 @@ +var file = File.new(__FILE__); +say file.stat.mtime; # seconds since the epoch + +# keep atime unchanged +# set mtime to current time +file.utime(file.stat.atime, Time.now); diff --git a/Task/File-modification-time/Ursa/file-modification-time.ursa b/Task/File-modification-time/Ursa/file-modification-time.ursa new file mode 100644 index 0000000000..a0d42382d2 --- /dev/null +++ b/Task/File-modification-time/Ursa/file-modification-time.ursa @@ -0,0 +1,8 @@ +decl java.util.Date d +decl file f + +f.open "example.txt" +d.setTime (f.lastmodified) +out d endl console + +f.setlastmodified 10 diff --git a/Task/File-size/Axe/file-size.axe b/Task/File-size/Axe/file-size.axe new file mode 100644 index 0000000000..e726e7245d --- /dev/null +++ b/Task/File-size/Axe/file-size.axe @@ -0,0 +1,5 @@ +If GetCalc("appvINPUT")→I + Disp {I-2}ʳ▶Dec,i +Else + Disp "NOT FOUND",i +End diff --git a/Task/File-size/FreeBASIC/file-size.freebasic b/Task/File-size/FreeBASIC/file-size.freebasic new file mode 100644 index 0000000000..7b2295592a --- /dev/null +++ b/Task/File-size/FreeBASIC/file-size.freebasic @@ -0,0 +1,6 @@ +' FB 1.05.0 Win64 + +#include "file.bi" + +Print FileLen("input.txt"), FileLen(Environ("SystemRoot") + "\input.txt") +Sleep diff --git a/Task/File-size/Lasso/file-size.lasso b/Task/File-size/Lasso/file-size.lasso new file mode 100644 index 0000000000..2b48e2b254 --- /dev/null +++ b/Task/File-size/Lasso/file-size.lasso @@ -0,0 +1,9 @@ +// local to current directory +local(f = file('input.txt')) +handle => { #f->close } +#f->size + +// file at file system root +local(f = file('//input.txt')) +handle => { #f->close } +#f->size diff --git a/Task/File-size/Lingo/file-size.lingo b/Task/File-size/Lingo/file-size.lingo new file mode 100644 index 0000000000..72068a7fb7 --- /dev/null +++ b/Task/File-size/Lingo/file-size.lingo @@ -0,0 +1,13 @@ +---------------------------------------- +-- Returns file size +-- @param {string} filename +-- @return {integer} +---------------------------------------- +on getFileSize (filename) + fp = xtra("fileIO").new() + fp.openFile(filename, 1) + if fp.status() then return 0 + len = fp.getLength() + fp.closeFile() + return len +end diff --git a/Task/File-size/LiveCode/file-size.livecode b/Task/File-size/LiveCode/file-size.livecode new file mode 100644 index 0000000000..e29d5f60c0 --- /dev/null +++ b/Task/File-size/LiveCode/file-size.livecode @@ -0,0 +1,20 @@ +// root folder +set the defaultfolder to "/" +repeat for each line fline in (the detailed files) + if item 1 of fline is "input.txt" then + put item 2 of fline --bytes + exit repeat + end if +end repeat + +// current working dir of stack +put the effective filename of this stack into tPath +set the itemDelimiter to slash +delete last item of tPath +set the defaultfolder to tPath +repeat for each line fline in (the detailed files) + if item 1 of fline is "input.txt" then + put item 2 of fline + exit repeat + end if +end repeat diff --git a/Task/File-size/Nim/file-size.nim b/Task/File-size/Nim/file-size.nim new file mode 100644 index 0000000000..4129535d19 --- /dev/null +++ b/Task/File-size/Nim/file-size.nim @@ -0,0 +1,3 @@ +import os +echo getFileSize "input.txt" +echo getFileSize "/input.txt" diff --git a/Task/File-size/Oforth/file-size.oforth b/Task/File-size/Oforth/file-size.oforth new file mode 100644 index 0000000000..8247e7b432 --- /dev/null +++ b/Task/File-size/Oforth/file-size.oforth @@ -0,0 +1,2 @@ +File new("input.txt") size println +File new("/input.txt") size println diff --git a/Task/File-size/Phix/file-size.phix b/Task/File-size/Phix/file-size.phix new file mode 100644 index 0000000000..852210c5a4 --- /dev/null +++ b/Task/File-size/Phix/file-size.phix @@ -0,0 +1,17 @@ +function file_size(sequence file_name) +object d = dir(file_name) + if atom(d) or length(d)!=1 then return -1 end if + return d[1][D_SIZE] +end function + +procedure test(sequence file_name) +integer size = file_size(file_name) + if size<0 then + printf(1,"%s file does not exist.\n",{file_name}) + else + printf(1,"%s size is %d.\n",{file_name,size}) + end if +end procedure + +test("input.txt") -- in the current working directory +test("/input.txt") -- in the file system root diff --git a/Task/File-size/Ring/file-size.ring b/Task/File-size/Ring/file-size.ring new file mode 100644 index 0000000000..1545676b84 --- /dev/null +++ b/Task/File-size/Ring/file-size.ring @@ -0,0 +1,2 @@ +See len(read('input.txt')) + nl +see len(read('/input.txt')) + nl diff --git a/Task/File-size/Sidef/file-size.sidef b/Task/File-size/Sidef/file-size.sidef new file mode 100644 index 0000000000..80296c8b60 --- /dev/null +++ b/Task/File-size/Sidef/file-size.sidef @@ -0,0 +1,2 @@ +say (Dir.cwd + %f'input.txt' -> size); +say (Dir.root + %f'input.txt' -> size); diff --git a/Task/File-size/Ursa/file-size.ursa b/Task/File-size/Ursa/file-size.ursa new file mode 100644 index 0000000000..4502725d0b --- /dev/null +++ b/Task/File-size/Ursa/file-size.ursa @@ -0,0 +1,9 @@ +decl file f + +f.open "input.txt" +out (size f) endl console +f.close + +f.open "/input.txt" +out (size f) endl console +f.close diff --git a/Task/File-size/jq/file-size.jq b/Task/File-size/jq/file-size.jq new file mode 100644 index 0000000000..21192fc0ed --- /dev/null +++ b/Task/File-size/jq/file-size.jq @@ -0,0 +1,3 @@ +jq -Rs length input.txt + +jq -Rs length /input.txt diff --git a/Task/Filter/AntLang/filter.antlang b/Task/Filter/AntLang/filter.antlang new file mode 100644 index 0000000000..d2a375889f --- /dev/null +++ b/Task/Filter/AntLang/filter.antlang @@ -0,0 +1,2 @@ +x:range[100] +{1- x mod 2}hfilter x diff --git a/Task/Filter/Apex/filter.apex b/Task/Filter/Apex/filter.apex new file mode 100644 index 0000000000..d43a621890 --- /dev/null +++ b/Task/Filter/Apex/filter.apex @@ -0,0 +1,15 @@ +List integers = new List{1,2,3,4,5}; +Set evenIntegers = new Set(); +for(Integer i : integers) +{ + if(math.mod(i,2) == 0) + { + evenIntegers.add(i); + } +} +system.assert(evenIntegers.size() == 2, 'We should only have two even numbers in the set'); +system.assert(!evenIntegers.contains(1), '1 should not be a number in the set'); +system.assert(evenIntegers.contains(2), '2 should be a number in the set'); +system.assert(!evenIntegers.contains(3), '3 should not be a number in the set'); +system.assert(evenIntegers.contains(4), '4 should be a number in the set'); +system.assert(!evenIntegers.contains(5), '5 should not be a number in the set'); diff --git a/Task/Filter/EchoLisp/filter.echolisp b/Task/Filter/EchoLisp/filter.echolisp new file mode 100644 index 0000000000..dfee663950 --- /dev/null +++ b/Task/Filter/EchoLisp/filter.echolisp @@ -0,0 +1,16 @@ +(iota 12) → { 0 1 2 3 4 5 6 7 8 9 10 11 } + +;; lists +(filter even? (iota 12)) + → (0 2 4 6 8 10) + +;; array (non destructive) +(vector-filter even? #(1 2 3 4 5 6 7 8 9 10 11 12 13)) + → #( 2 4 6 8 10 12) + +;; sequence, infinite, lazy +(lib 'sequences) +(define evens (filter even? [0 ..])) + +(take evens 12) + → (0 2 4 6 8 10 12 14 16 18 20 22) diff --git a/Task/Filter/FreeBASIC/filter.freebasic b/Task/Filter/FreeBASIC/filter.freebasic new file mode 100644 index 0000000000..4601b04250 --- /dev/null +++ b/Task/Filter/FreeBASIC/filter.freebasic @@ -0,0 +1,63 @@ +' FB 1.05.0 Win64 + +Type FilterType As Function(As Integer) As Boolean + +Function isEven(n As Integer) As Boolean + Return n Mod 2 = 0 +End Function + +Sub filterArray(a() As Integer, b() As Integer, filter As FilterType) + If UBound(a) = -1 Then Return '' empty array + Dim count As Integer = 0 + Redim b(0 To UBound(a) - LBound(a)) + For i As Integer = LBound(a) To UBound(a) + If filter(a(i)) Then + b(count) = a(i) + count += 1 + End If + Next + + If count > 0 Then Redim Preserve b(0 To count - 1) '' trim excess elements +End Sub + +' Note that da() must be a dynamic array as static arrays can't be redimensioned +Sub filterDestructArray(da() As Integer, filter As FilterType) + If UBound(da) = -1 Then Return '' empty array + Dim count As Integer = 0 + For i As Integer = LBound(da) To UBound(da) + If i > UBound(da) - count Then Exit For + If Not filter(da(i)) Then '' remove this element by moving those still to be examined down one + For j As Integer = i + 1 To UBound(da) - count + da(j - 1) = da(j) + Next j + count += 1 + i -= 1 + End If + Next i + + If count > 0 Then + Redim Preserve da(LBound(da) To UBound(da) - count) '' trim excess elements + End If +End Sub + +Dim n As Integer = 12 +Dim a(1 To n) As Integer '' creates dynamic array as upper bound is a variable +For i As Integer = 1 To n : Read a(i) : Next +Dim b() As Integer '' array to store results +filterArray a(), b(), @isEven +Print "The even numbers are (in new array) : "; +For i As Integer = LBound(b) To UBound(b) + Print b(i); " "; +Next +Print : Print +filterDestructArray a(), @isEven +Print "The even numbers are (in original array) : "; +For i As Integer = LBound(a) To UBound(a) + Print a(i); " "; +Next +Print : Print +Print "Press any key to quit" +Sleep +End + +Data 1, 2, 3, 7, 8, 10, 11, 16, 19, 21, 22, 27 diff --git a/Task/Filter/Futhark/filter.futhark b/Task/Filter/Futhark/filter.futhark new file mode 100644 index 0000000000..83e376aeaa --- /dev/null +++ b/Task/Filter/Futhark/filter.futhark @@ -0,0 +1,2 @@ +fun main(as: []int): []int = + filter (fn x => x%2 == 0) as diff --git a/Task/Filter/Lasso/filter-1.lasso b/Task/Filter/Lasso/filter-1.lasso new file mode 100644 index 0000000000..6d629cd700 --- /dev/null +++ b/Task/Filter/Lasso/filter-1.lasso @@ -0,0 +1,3 @@ +local(original = array(1,2,3,4,5,6,7,8,9,10)) +local(evens = (with item in #original where #item % 2 == 0 select #item) -> asstaticarray) +#evens diff --git a/Task/Filter/Lasso/filter-2.lasso b/Task/Filter/Lasso/filter-2.lasso new file mode 100644 index 0000000000..f5a0160ffa --- /dev/null +++ b/Task/Filter/Lasso/filter-2.lasso @@ -0,0 +1,3 @@ +local(original = array(1,2,3,4,5,6,7,8,9,10)) +with item in #original where #item % 2 != 0 do #original ->removeall(#item) +#original diff --git a/Task/Filter/Nim/filter.nim b/Task/Filter/Nim/filter.nim new file mode 100644 index 0000000000..5076493712 --- /dev/null +++ b/Task/Filter/Nim/filter.nim @@ -0,0 +1,7 @@ +import sequtils + +let values = @[0,1,2,3,4,5,6,7,8,9] + +let evens = values.filter(proc (x: int): bool = x mod 2 == 0) + +let odds = values.filterIt(it mod 2 == 1) diff --git a/Task/Filter/Oforth/filter.oforth b/Task/Filter/Oforth/filter.oforth new file mode 100644 index 0000000000..0f1858822a --- /dev/null +++ b/Task/Filter/Oforth/filter.oforth @@ -0,0 +1 @@ +100 seq filter(#isEven) diff --git a/Task/Filter/PHL/filter.phl b/Task/Filter/PHL/filter.phl new file mode 100644 index 0000000000..d98dae442d --- /dev/null +++ b/Task/Filter/PHL/filter.phl @@ -0,0 +1,11 @@ +module var; + +extern printf; + +@Integer main [ + var arr = 1..9; + var evens = arr.filter(#(i) i % 2 == 0); + printf("%s\n", evens::str); + + return 0; +] diff --git a/Task/Filter/Peloton/filter.peloton b/Task/Filter/Peloton/filter.peloton new file mode 100644 index 0000000000..1117fe8188 --- /dev/null +++ b/Task/Filter/Peloton/filter.peloton @@ -0,0 +1,8 @@ +<@ LETCNWLSTLIT>numbers|1 2 3 4 5 6 7 8 9 10 11 12 +<@ DEFLST>evens +<@ ENULSTLIT>numbers| +<@ TSTEVEELTLST>... +<@ IFF> +<@ LETLSTELTLST>evens|... + + diff --git a/Task/Filter/Phix/filter-1.phix b/Task/Filter/Phix/filter-1.phix new file mode 100644 index 0000000000..d1c351a0b6 --- /dev/null +++ b/Task/Filter/Phix/filter-1.phix @@ -0,0 +1,9 @@ +function filternd(sequence array, integer filterid) +sequence res = {} + for i=1 to length(array) do + if call_func(filterid,{array[i]}) then + res = append(res,array[i]) + end if + end for + return res +end function diff --git a/Task/Filter/Phix/filter-2.phix b/Task/Filter/Phix/filter-2.phix new file mode 100644 index 0000000000..44d96fc43e --- /dev/null +++ b/Task/Filter/Phix/filter-2.phix @@ -0,0 +1,26 @@ +function filterd(sequence a, integer filterid) +integer l = 0 + for i=1 to length(a) do + if call_func(filterid,{a[i]}) then + l += 1 + a[l] = a[i] + end if + end for + return a[1..l] +end function + +function even(integer i) + return and_bits(i,1)=0 +end function +constant r_even = routine_id("even") + +procedure main() +sequence s = tagset(10), t + t = filterd(s,r_even) + ?s + ?t + -- automatic pass by reference occurs here for s: + s = filterd(s,r_even) + ?s +end procedure +main() diff --git a/Task/Filter/Ring/filter.ring b/Task/Filter/Ring/filter.ring new file mode 100644 index 0000000000..f0fcad0dec --- /dev/null +++ b/Task/Filter/Ring/filter.ring @@ -0,0 +1,12 @@ +aList = [1, 2, 3, 4, 5, 6] +bArray = list(3) +see evenSelect(aList) + +func evenSelect aArray +i = 0 +for n = 1 to len(aArray) + if (aArray[n] % 2) = 0 + i = i + 1 + bArray[i] = aArray[n] ok +next +return bArray diff --git a/Task/Filter/SequenceL/filter.sequencel b/Task/Filter/SequenceL/filter.sequencel new file mode 100644 index 0000000000..603802037d --- /dev/null +++ b/Task/Filter/SequenceL/filter.sequencel @@ -0,0 +1 @@ +evens(x(1))[i] := x[i] when x[i] mod 2 = 0; diff --git a/Task/Filter/Sidef/filter.sidef b/Task/Filter/Sidef/filter.sidef new file mode 100644 index 0000000000..2c1b1668c8 --- /dev/null +++ b/Task/Filter/Sidef/filter.sidef @@ -0,0 +1,9 @@ +var arr = [1,2,3,4,5]; + +# Creates a new array +var new = arr.grep {|i| i %% 2}; +say new.dump; # => [2, 4] + +# Destructive (at variable level) +arr.grep! {|i| i %% 2}; +say arr.dump; # => [2, 4] diff --git a/Task/Filter/Swift/filter.swift b/Task/Filter/Swift/filter.swift new file mode 100644 index 0000000000..e434d682f4 --- /dev/null +++ b/Task/Filter/Swift/filter.swift @@ -0,0 +1,3 @@ +let numbers = [1,2,3,4,5,6] +let even_numbers = numbers.filter { $0 % 2 == 0 } +println(even_numbers) diff --git a/Task/Filter/jq/filter-1.jq b/Task/Filter/jq/filter-1.jq new file mode 100644 index 0000000000..204f7f06a5 --- /dev/null +++ b/Task/Filter/jq/filter-1.jq @@ -0,0 +1 @@ +(1,2,3,4,5,6,7,8,9) | select(. % 2 == 0) diff --git a/Task/Filter/jq/filter-2.jq b/Task/Filter/jq/filter-2.jq new file mode 100644 index 0000000000..b5202cdf5f --- /dev/null +++ b/Task/Filter/jq/filter-2.jq @@ -0,0 +1 @@ +[range(1;10)] | map( select(. % 2 == 0) ) diff --git a/Task/Find-common-directory-path/Lasso/find-common-directory-path.lasso b/Task/Find-common-directory-path/Lasso/find-common-directory-path.lasso new file mode 100644 index 0000000000..960c68cff1 --- /dev/null +++ b/Task/Find-common-directory-path/Lasso/find-common-directory-path.lasso @@ -0,0 +1,17 @@ +#!/usr/bin/lasso9 + +local( + path1 = '/home/user1/tmp/coverage/test' -> split('/'), + path2 = '/home/user1/tmp/covert/operator' -> split('/'), + path3 = '/home/user1/tmp/coven/members' -> split('/') +) + +define commonpath(...) => { + local(shared = #rest -> get(1)) + loop(#rest -> size - 1) => { + #shared = #shared -> intersection(#rest -> get(loop_count + 1)) + } + return #shared -> join('/') +} + +stdoutnl(commonpath(#path1, #path2, #path3)) diff --git a/Task/Find-common-directory-path/Lingo/find-common-directory-path-1.lingo b/Task/Find-common-directory-path/Lingo/find-common-directory-path-1.lingo new file mode 100644 index 0000000000..6db65ef063 --- /dev/null +++ b/Task/Find-common-directory-path/Lingo/find-common-directory-path-1.lingo @@ -0,0 +1,19 @@ +on getCommonPath (pathes, sep) + _player.itemDelimiter = sep + + -- find length of shortest path (in terms of items) + commonCnt = the maxInteger + repeat with p in pathes + if p.item.countpathes[j-1].item[i] then + return pathes[1].item[1..i-1] + end if + end repeat + end repeat + return pathes[1].item[1..commonCnt] +end diff --git a/Task/Find-common-directory-path/Lingo/find-common-directory-path-2.lingo b/Task/Find-common-directory-path/Lingo/find-common-directory-path-2.lingo new file mode 100644 index 0000000000..ed9bc9a798 --- /dev/null +++ b/Task/Find-common-directory-path/Lingo/find-common-directory-path-2.lingo @@ -0,0 +1,7 @@ +pathes = [] +pathes.add("/home/user1/tmp/coverage/test") +pathes.add("/home/user1/tmp/covert/operator") +pathes.add("/home/user1/tmp/coven/members") + +put getCommonPath(pathes, "/") +-- "/home/user1/tmp" diff --git a/Task/Find-common-directory-path/Nim/find-common-directory-path.nim b/Task/Find-common-directory-path/Nim/find-common-directory-path.nim new file mode 100644 index 0000000000..ba0579de94 --- /dev/null +++ b/Task/Find-common-directory-path/Nim/find-common-directory-path.nim @@ -0,0 +1,13 @@ +import strutils + +proc commonprefix(paths: openarray[string], sep = "/"): string = + if paths.len == 0: return "" + block outer: + for i in 0..paths[0].len: + result = paths[0][0..i] + for path in paths: + if not path.startsWith(result): + break outer + result = result[0 .. /home/user1/tmp diff --git a/Task/Find-common-directory-path/jq/find-common-directory-path-1.jq b/Task/Find-common-directory-path/jq/find-common-directory-path-1.jq new file mode 100644 index 0000000000..58df5f16f3 --- /dev/null +++ b/Task/Find-common-directory-path/jq/find-common-directory-path-1.jq @@ -0,0 +1,14 @@ +# maximal_initial_subarray takes as input an array of arrays: +def maximal_initial_subarray: + (map( .[0] ) | unique) as $u + | if $u == [ null ] then [] + elif ($u|length) == 1 + then $u + ( map( .[1:] ) | maximal_initial_subarray) + else [] + end ; + +# Solution: read in the strings, convert to an array of arrays, and proceed: +def common_path(slash): + [.[] | split(slash)] | maximal_initial_subarray | join(slash) ; + +common_path("/") diff --git a/Task/Find-common-directory-path/jq/find-common-directory-path-2.jq b/Task/Find-common-directory-path/jq/find-common-directory-path-2.jq new file mode 100644 index 0000000000..8b8c712753 --- /dev/null +++ b/Task/Find-common-directory-path/jq/find-common-directory-path-2.jq @@ -0,0 +1,2 @@ +$ jq -s -f common_path.jq directories.txt +"home/user1/tmp" diff --git a/Task/Find-largest-left-truncatable-prime-in-a-given-base/Sidef/find-largest-left-truncatable-prime-in-a-given-base.sidef b/Task/Find-largest-left-truncatable-prime-in-a-given-base/Sidef/find-largest-left-truncatable-prime-in-a-given-base.sidef new file mode 100644 index 0000000000..e19120dbf7 --- /dev/null +++ b/Task/Find-largest-left-truncatable-prime-in-a-given-base/Sidef/find-largest-left-truncatable-prime-in-a-given-base.sidef @@ -0,0 +1,33 @@ +func primes(n) { + var (i, j) = (0, 0) + gather { + loop { + i = j.next_prime + i <= n || break + take(i) + j = i + } + } +} + +func lltp(n) { + var b = 1 + var best = nil + var v = primes(n-1) + + while (v) { + best = v.max + b *= n + v = gather { + v.each { |vi| + take((n-1).of { |i| i*b + vi }.grep{.is_prime}...) + } + } + } + + return best +} + +for i in (3..17) { + printf("%2d %s\n", i, lltp(i)) +} diff --git a/Task/Find-limit-of-recursion/Axe/find-limit-of-recursion.axe b/Task/Find-limit-of-recursion/Axe/find-limit-of-recursion.axe new file mode 100644 index 0000000000..c3db710d4f --- /dev/null +++ b/Task/Find-limit-of-recursion/Axe/find-limit-of-recursion.axe @@ -0,0 +1,5 @@ +RECURSE(1) +Lbl RECURSE +.Optionally, limit the number of times the argument is printed +Disp r₁▶Dec,i +RECURSE(r₁+1) diff --git a/Task/Find-limit-of-recursion/Gri/find-limit-of-recursion.gri b/Task/Find-limit-of-recursion/Gri/find-limit-of-recursion.gri new file mode 100644 index 0000000000..3bab15a76e --- /dev/null +++ b/Task/Find-limit-of-recursion/Gri/find-limit-of-recursion.gri @@ -0,0 +1,8 @@ +`Recurse' +{ + show .depth. + .depth. = {rpn .depth. 1 +} + Recurse +} +.depth. = 1 +Recurse diff --git a/Task/Find-limit-of-recursion/I/find-limit-of-recursion.i b/Task/Find-limit-of-recursion/I/find-limit-of-recursion.i new file mode 100644 index 0000000000..8d7b4df98d --- /dev/null +++ b/Task/Find-limit-of-recursion/I/find-limit-of-recursion.i @@ -0,0 +1,8 @@ +function test(counter) { + print(counter) + test(counter+1) +} + +software { + test(0) +} diff --git a/Task/Find-limit-of-recursion/Nim/find-limit-of-recursion.nim b/Task/Find-limit-of-recursion/Nim/find-limit-of-recursion.nim new file mode 100644 index 0000000000..6386022400 --- /dev/null +++ b/Task/Find-limit-of-recursion/Nim/find-limit-of-recursion.nim @@ -0,0 +1,4 @@ +proc recurse(i): int = + echo i + recurse(i+1) +echo recurse(0) diff --git a/Task/Find-limit-of-recursion/Oforth/find-limit-of-recursion.oforth b/Task/Find-limit-of-recursion/Oforth/find-limit-of-recursion.oforth new file mode 100644 index 0000000000..ae99771b4d --- /dev/null +++ b/Task/Find-limit-of-recursion/Oforth/find-limit-of-recursion.oforth @@ -0,0 +1,3 @@ +: limit 1+ dup . limit ; + +0 limit diff --git a/Task/Find-limit-of-recursion/Phix/find-limit-of-recursion.phix b/Task/Find-limit-of-recursion/Phix/find-limit-of-recursion.phix new file mode 100644 index 0000000000..fba5ab1985 --- /dev/null +++ b/Task/Find-limit-of-recursion/Phix/find-limit-of-recursion.phix @@ -0,0 +1,17 @@ +atom t1 = time()+1 + +integer depth = 0 + +procedure recurse() + if time()>t1 then + ?depth + t1 = time()+1 + end if + depth += 1 + -- only 1 of these will ever get called, of course... + recurse() + recurse() + recurse() +end procedure + +recurse() diff --git a/Task/Find-limit-of-recursion/Ring/find-limit-of-recursion.ring b/Task/Find-limit-of-recursion/Ring/find-limit-of-recursion.ring new file mode 100644 index 0000000000..dd6ed4e989 --- /dev/null +++ b/Task/Find-limit-of-recursion/Ring/find-limit-of-recursion.ring @@ -0,0 +1,5 @@ +recurse(0) + +func recurse x + see ""+ x + nl + recurse(x+1) diff --git a/Task/Find-limit-of-recursion/Sidef/find-limit-of-recursion.sidef b/Task/Find-limit-of-recursion/Sidef/find-limit-of-recursion.sidef new file mode 100644 index 0000000000..6957a205bf --- /dev/null +++ b/Task/Find-limit-of-recursion/Sidef/find-limit-of-recursion.sidef @@ -0,0 +1,6 @@ +func recurse(n) { + say n; + recurse(n+1); +} + +recurse(0); diff --git a/Task/Find-limit-of-recursion/Ursa/find-limit-of-recursion.ursa b/Task/Find-limit-of-recursion/Ursa/find-limit-of-recursion.ursa new file mode 100644 index 0000000000..0d9391b164 --- /dev/null +++ b/Task/Find-limit-of-recursion/Ursa/find-limit-of-recursion.ursa @@ -0,0 +1,9 @@ +def recurse (int counter) + try + recurse (+ counter 1) + catch recursionerror + out "the limit of recursion was " counter endl console + end try +end + +recurse 1 diff --git a/Task/Find-limit-of-recursion/jq/find-limit-of-recursion-1.jq b/Task/Find-limit-of-recursion/jq/find-limit-of-recursion-1.jq new file mode 100644 index 0000000000..c390ac4726 --- /dev/null +++ b/Task/Find-limit-of-recursion/jq/find-limit-of-recursion-1.jq @@ -0,0 +1,4 @@ +def zero_arity: + if (. % 1000000 == 0) then . else empty end, ((.+1)| zero_arity); + +1|zero_arity diff --git a/Task/Find-limit-of-recursion/jq/find-limit-of-recursion-2.jq b/Task/Find-limit-of-recursion/jq/find-limit-of-recursion-2.jq new file mode 100644 index 0000000000..d2769173cc --- /dev/null +++ b/Task/Find-limit-of-recursion/jq/find-limit-of-recursion-2.jq @@ -0,0 +1,4 @@ +def with_arity(n): + if (n % 1000 == 0) then n else empty end, with_arity(n+1); + +with_arity(1) diff --git a/Task/Find-limit-of-recursion/jq/find-limit-of-recursion-3.jq b/Task/Find-limit-of-recursion/jq/find-limit-of-recursion-3.jq new file mode 100644 index 0000000000..b69effcd68 --- /dev/null +++ b/Task/Find-limit-of-recursion/jq/find-limit-of-recursion-3.jq @@ -0,0 +1,17 @@ +# Arity 0 - without TCO: +... +23000000 # 1.62 GB +25000000 +*** error: can't allocate region +user 0m54.558s +sys 0m2.773s + +# Arity 1 - without TCO: +... +77000 # 23.4 MB +... +85000 # 23.7 MB +90000 # 25.4 MB +237000 # 47.4 MB (5h:08) +242000 # 50.0 MB (5h:14m) +# [job cancelled manually after over 5 hours] diff --git a/Task/Find-limit-of-recursion/jq/find-limit-of-recursion-4.jq b/Task/Find-limit-of-recursion/jq/find-limit-of-recursion-4.jq new file mode 100644 index 0000000000..eaf0ece784 --- /dev/null +++ b/Task/Find-limit-of-recursion/jq/find-limit-of-recursion-4.jq @@ -0,0 +1,8 @@ +$ time jq -n -f Find_limit_of_recursions.jq +... +10000000 # 360 KB +... +100000000 # 360 KB +# [job cancelled to get a timing] +user 2m0.534s +sys 0m0.329s diff --git a/Task/Find-limit-of-recursion/jq/find-limit-of-recursion-5.jq b/Task/Find-limit-of-recursion/jq/find-limit-of-recursion-5.jq new file mode 100644 index 0000000000..a6a138d928 --- /dev/null +++ b/Task/Find-limit-of-recursion/jq/find-limit-of-recursion-5.jq @@ -0,0 +1,14 @@ +... +56000 # 9.9MB +... +95000 # 14.8 MB +98000 # 15.2 MB +99000 # 15.4 MB +100000 # 15.5 MB +127000 # 37.4 MB +142000 # 37.4 MB +254000 # 74.6 MB +287000 # 74.6 MB +406000 # 74.6 MB (8h:50m) +412000 # 74.6 MB (9h:05m) +# [job cancelled manually after over 9 hours] diff --git a/Task/Find-the-last-Sunday-of-each-month/FreeBASIC/find-the-last-sunday-of-each-month.freebasic b/Task/Find-the-last-Sunday-of-each-month/FreeBASIC/find-the-last-sunday-of-each-month.freebasic new file mode 100644 index 0000000000..1ac9471107 --- /dev/null +++ b/Task/Find-the-last-Sunday-of-each-month/FreeBASIC/find-the-last-sunday-of-each-month.freebasic @@ -0,0 +1,85 @@ +' version 23-06-2015 +' compile with: fbc -s console + +#Ifndef TRUE ' define true and false for older freebasic versions + #Define FALSE 0 + #Define TRUE Not FALSE +#EndIf + +Function leapyear(Year_ As Integer) As Integer + ' from the leapyear entry + If (Year_ Mod 4) <> 0 Then Return FALSE + If (Year_ Mod 100) = 0 AndAlso (Year_ Mod 400) <> 0 Then Return FALSE + Return TRUE + +End Function + +Function wd(m As Integer, d As Integer, y As Integer) As Integer + ' Zellerish + ' 0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday + ' 4 = Thursday, 5 = Friday, 6 = Saturday + + If m < 3 Then ' If m = 1 Or m = 2 Then + m += 12 + y -= 1 + End If + Return (y + (y \ 4) - (y \ 100) + (y \ 400) + d + ((153 * m + 8) \ 5)) Mod 7 +End Function + +' ------=< MAIN >=------ + +Type month_days + m_name As String + days As UByte +End Type + +Dim As month_days arr(1 To 12) +Data "January", 31, "February", 28, "March", 31, "April", 30 +Data "May", 31, "June", 30, "July", 31, "August", 31 +Data "September", 30, "October", 31, "November", 30, "December", 31 + +Dim As Integer yr, d, i, x +Dim As String keypress + +For i = 1 To 12 + With arr(i) + Read .m_name + Read .days + End With +Next + +Do + + Do + Print "For what year do you want to find the last Sunday of the month" + Input "any number below 1800 stops program, year in YYYY format";yr + ' empty input also stops + If yr < 1800 Then + End + Else + Exit Do + End If + Loop + + Print : Print + Print "Last Sunday of the month for"; yr + + For i = 1 To 12 + d = arr(i).days + If i = 2 AndAlso leapyear(yr) = TRUE Then d = d + 1 + x = wd(i, d, yr) + d = d - x ' don't test it just do it + Print d; " "; arr(i).m_name + Next + + ' empty key buffer + While Inkey <> "" : keypress = Inkey : Wend + Print : Print + Print "Find last Sunday for a other year [Y|y], anything else stops" + keypress ="" + While keypress = "" : keypress = Inkey : Wend + If LCase(keypress) <> "y" Then Exit Do + Print : Print + +Loop +End diff --git a/Task/Find-the-last-Sunday-of-each-month/Lasso/find-the-last-sunday-of-each-month.lasso b/Task/Find-the-last-Sunday-of-each-month/Lasso/find-the-last-sunday-of-each-month.lasso new file mode 100644 index 0000000000..de027f5b0e --- /dev/null +++ b/Task/Find-the-last-Sunday-of-each-month/Lasso/find-the-last-sunday-of-each-month.lasso @@ -0,0 +1,21 @@ +local( + year = integer(web_request -> param('year') || 2013), + date = date(#year + '-1-1'), + lastsu = array, + lastday +) + +with month in generateseries(1,12) do { + #date -> day = 1 + #date -> month = #month + #lastday = #date -> month(-days) + #date -> day = #lastday + loop(7) => { + if(#date -> dayofweek == 1) => { + #lastsu -> insert(#date -> format(`dd MMMM`)) + loop_abort + } + #date -> day-- + } +} +#lastsu -> join('
') diff --git a/Task/Find-the-last-Sunday-of-each-month/LiveCode/find-the-last-sunday-of-each-month-1.livecode b/Task/Find-the-last-Sunday-of-each-month/LiveCode/find-the-last-sunday-of-each-month-1.livecode new file mode 100644 index 0000000000..47396204e1 --- /dev/null +++ b/Task/Find-the-last-Sunday-of-each-month/LiveCode/find-the-last-sunday-of-each-month-1.livecode @@ -0,0 +1,23 @@ +function lastDay yyyy, dayofweek + -- year,month num,day of month,hour in 24-hour time,minute,second,numeric day of week. + convert the long date to dateitems + put 1 into item 2 of it + put 1 into item 3 of it + put yyyy into item 1 of it + put it into startDate + convert startDate to dateItems + repeat with m = 1 to 12 + put m into item 2 of startDate + repeat with d = 20 to 31 + put d into item 3 of startDate + convert startDate to dateItems + -- 1 is Sunday through to 7 Saturday + if item 7 of startDate is dayofweek and item 1 of startDate is yyyy and item 2 of startDate is m then + put item 3 of startDate into mydays[item 2 of startDate] + end if + end repeat + end repeat + combine mydays using cr and space + sort mydays ascending numeric + return mydays +end lastDay diff --git a/Task/Find-the-last-Sunday-of-each-month/LiveCode/find-the-last-sunday-of-each-month-2.livecode b/Task/Find-the-last-Sunday-of-each-month/LiveCode/find-the-last-sunday-of-each-month-2.livecode new file mode 100644 index 0000000000..9d350e6457 --- /dev/null +++ b/Task/Find-the-last-Sunday-of-each-month/LiveCode/find-the-last-sunday-of-each-month-2.livecode @@ -0,0 +1 @@ +put lastDay(2013, 1) diff --git a/Task/Find-the-last-Sunday-of-each-month/Nim/find-the-last-sunday-of-each-month.nim b/Task/Find-the-last-Sunday-of-each-month/Nim/find-the-last-sunday-of-each-month.nim new file mode 100644 index 0000000000..890ae3eeac --- /dev/null +++ b/Task/Find-the-last-Sunday-of-each-month/Nim/find-the-last-sunday-of-each-month.nim @@ -0,0 +1,12 @@ +import times, os, strutils + +var timeinfo = getLocalTime getTime() +timeinfo.year = paramStr(1).parseInt +for month in mJan .. mDec: + timeinfo.month = month + for day in countdown(31, 1): + timeinfo.monthday = day + let t = getLocalTime(timeInfoToTime timeinfo) + if t.month == month and t.weekday == dSun: + echo t.format "yyyy-MM-dd" + break diff --git a/Task/Find-the-last-Sunday-of-each-month/Oforth/find-the-last-sunday-of-each-month.oforth b/Task/Find-the-last-Sunday-of-each-month/Oforth/find-the-last-sunday-of-each-month.oforth new file mode 100644 index 0000000000..8fb0232247 --- /dev/null +++ b/Task/Find-the-last-Sunday-of-each-month/Oforth/find-the-last-sunday-of-each-month.oforth @@ -0,0 +1,8 @@ +import: date + +: lastSunday(y) +| m | + Date.JANUARY Date.DECEMBER for: m [ + Date newDate(y, m, Date.DaysInMonth(y, m)) + while(dup dayOfWeek Date.SUNDAY <>) [ addDays(-1) ] println + ] ; diff --git a/Task/Find-the-last-Sunday-of-each-month/Phix/find-the-last-sunday-of-each-month.phix b/Task/Find-the-last-Sunday-of-each-month/Phix/find-the-last-sunday-of-each-month.phix new file mode 100644 index 0000000000..1db8f921ee --- /dev/null +++ b/Task/Find-the-last-Sunday-of-each-month/Phix/find-the-last-sunday-of-each-month.phix @@ -0,0 +1,24 @@ +include timedate.e + +constant SUNDAY=1 + +procedure showlast(integer dow, integer doy, timedate td) + td = adjust_timedate(td,timedelta(days:=doy-1)) + integer {year,month,day} = td + while day_of_week(year,month,day)!=dow do day-=1 end while + printf(1,"%4d-%02d-%02d\n",{year,month,day}) +end procedure + +procedure last_day_of_month(integer year, integer dow) +integer doy +timedate first = {year,1,1,0,0,0,0,0} + -- start by finding the 1st of the next month, less 1 + for i=1 to 11 do + doy = day_of_year(year,i+1,1)-1 + showlast(dow,doy,first) + end for + -- do December separately, as 1st would be next year + doy = day_of_year(year,12,31) + showlast(dow,doy,first) +end procedure +last_day_of_month(2013,SUNDAY) diff --git a/Task/Find-the-last-Sunday-of-each-month/Ring/find-the-last-sunday-of-each-month.ring b/Task/Find-the-last-Sunday-of-each-month/Ring/find-the-last-sunday-of-each-month.ring new file mode 100644 index 0000000000..a8f48c5e86 --- /dev/null +++ b/Task/Find-the-last-Sunday-of-each-month/Ring/find-the-last-sunday-of-each-month.ring @@ -0,0 +1,18 @@ +see "What year to calculate (yyyy) : " +give year +see "Last Sundays in " + year + " are on :" + nl +month = list(12) +mo = [4,0,0,3,5,1,3,6,2,4,0,2] +mon = [31,28,31,30,31,30,31,31,30,31,30,31] +if year < 2100 leap = year - 1900 else leap = year - 1904 ok +m = ((year-1900)%7) + floor(leap/4) % 7 +for n = 1 to 12 + month[n] = (mo[n] + m) % 7 +next +for n = 1 to 12 + for i = (mon[n] - 6) to mon[n] + x = (month[n] + i) % 7 + if n < 10 strn = "0" + string(n) else strn = string(n) ok + if x = 4 see year + "-" + strn + "-" + string(i) + nl ok + next +next diff --git a/Task/Find-the-last-Sunday-of-each-month/Sidef/find-the-last-sunday-of-each-month.sidef b/Task/Find-the-last-Sunday-of-each-month/Sidef/find-the-last-sunday-of-each-month.sidef new file mode 100644 index 0000000000..482ec36b7f --- /dev/null +++ b/Task/Find-the-last-Sunday-of-each-month/Sidef/find-the-last-sunday-of-each-month.sidef @@ -0,0 +1,15 @@ +var dt = require('DateTime'); +var (year=2016) = ARGV.map{.to_i}... + +for i in (1 .. 12) { + var date = dt.last_day_of_month( + year => year, + month => i + ); + + while (date.dow != 7) { + date = date.subtract(days => 1); + } + + say date.ymd; +} diff --git a/Task/Find-the-last-Sunday-of-each-month/jq/find-the-last-sunday-of-each-month-1.jq b/Task/Find-the-last-Sunday-of-each-month/jq/find-the-last-sunday-of-each-month-1.jq new file mode 100644 index 0000000000..5a10b6ae75 --- /dev/null +++ b/Task/Find-the-last-Sunday-of-each-month/jq/find-the-last-sunday-of-each-month-1.jq @@ -0,0 +1,26 @@ +# In case your jq does not have "until" defined: +def until(cond; next): + def _until: + if cond then . else (next|_until) end; + _until; + +# Zeller's Congruence from [[Day_of_the_week#jq]] + +# Use Zeller's Congruence to determine the day of the week, given +# year, month and day as integers in the conventional way. +# If iso == "iso" or "ISO", then emit an integer in 1 -- 7 where +# 1 represents Monday, 2 Tuesday, etc; +# otherwise emit 0 for Saturday, 1 for Sunday, etc. +# +def day_of_week(year; month; day; iso): + if month == 1 or month == 2 then + [year - 1, month + 12, day] + else + [year, month, day] + end + | .[2] + (13*(.[1] + 1)/5|floor) + + (.[0]%100) + ((.[0]%100)/4|floor) + + (.[0]/400|floor) - 2*(.[0]/100|floor) + | if iso == "iso" or iso == "ISO" then 1 + ((. + 5) % 7) + else . % 7 + end ; diff --git a/Task/Find-the-last-Sunday-of-each-month/jq/find-the-last-sunday-of-each-month-2.jq b/Task/Find-the-last-Sunday-of-each-month/jq/find-the-last-sunday-of-each-month-2.jq new file mode 100644 index 0000000000..2fdd65e3d5 --- /dev/null +++ b/Task/Find-the-last-Sunday-of-each-month/jq/find-the-last-sunday-of-each-month-2.jq @@ -0,0 +1,22 @@ +# year and month are numbered conventionally +def findLastSunday(year; month): + def isLeapYear: + year%4 == 0 and ( year%100!=0 or year%400==0 ) ; + def days: + if month == 2 then (if isLeapYear then 29 else 28 end) + else [31, 28, 31,30,31,30,31,31,30,31,30,31][month-1] + end; + year as $year + | month as $month + | days + | until( day_of_week($year; $month; .; null) == 1 ; .-1); + +# input: year +def findLastSundays: + def months: + ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + . as $year + | "YEAR: \(.)", + (range(0;12) | "\(months[.]) \(findLastSunday($year; .+1))") ; + +$year|tonumber|findLastSundays diff --git a/Task/Find-the-last-Sunday-of-each-month/jq/find-the-last-sunday-of-each-month-3.jq b/Task/Find-the-last-Sunday-of-each-month/jq/find-the-last-sunday-of-each-month-3.jq new file mode 100644 index 0000000000..cda08f89a8 --- /dev/null +++ b/Task/Find-the-last-Sunday-of-each-month/jq/find-the-last-sunday-of-each-month-3.jq @@ -0,0 +1,14 @@ +$ jq --arg year 2013 -n -r -f findLastSundays.jq +YEAR: 2013 +January 27 +February 24 +March 31 +April 28 +May 26 +June 30 +July 28 +August 25 +September 29 +October 27 +November 24 +December 29 diff --git a/Task/Find-the-missing-permutation/ERRE/find-the-missing-permutation.erre b/Task/Find-the-missing-permutation/ERRE/find-the-missing-permutation.erre new file mode 100644 index 0000000000..394926bc36 --- /dev/null +++ b/Task/Find-the-missing-permutation/ERRE/find-the-missing-permutation.erre @@ -0,0 +1,33 @@ +PROGRAM MISSING + +CONST N=4 + +DIM PERMS$[23] + +BEGIN + PRINT(CHR$(12);) ! CLS + DATA("ABCD","CABD","ACDB","DACB","BCDA","ACBD","ADCB") + DATA("CDAB","DABC","BCAD","CADB","CDBA","CBAD","ABDC","ADBC") + DATA("BDCA","DCBA","BACD","BADC","BDAC","CBDA","DBCA","DCAB") + + FOR I%=1 TO UBOUND(PERMS$,1) DO + READ(PERMS$[I%]) + END FOR + + SOL$="...." + + FOR I%=1 TO N DO + CH$=CHR$(I%+64) + COUNT%=0 + FOR Z%=1 TO N DO + COUNT%=0 + FOR J%=1 TO UBOUND(PERMS$,1) DO + IF CH$=MID$(PERMS$[J%],Z%,1) THEN COUNT%=COUNT%+1 END IF + END FOR + IF COUNT%<>6 THEN + !$RCODE="MID$(SOL$,Z%,1)=CH$" + END IF + END FOR + END FOR + PRINT("Solution is: ";SOL$) +END PROGRAM diff --git a/Task/Find-the-missing-permutation/EchoLisp/find-the-missing-permutation.echolisp b/Task/Find-the-missing-permutation/EchoLisp/find-the-missing-permutation.echolisp new file mode 100644 index 0000000000..c7bc531d40 --- /dev/null +++ b/Task/Find-the-missing-permutation/EchoLisp/find-the-missing-permutation.echolisp @@ -0,0 +1,14 @@ +;; use the obvious methos +(lib 'list) ; for (permutations) function + +;; input +(define perms ' +(ABCD CABD ACDB DACB BCDA ACBD ADCB CDAB DABC BCAD CADB CDBA CBAD ABDC ADBC BDCA DCBA BACD BADC BDAC CBDA DBCA DCAB)) + +;; generate all permutations +(define all-perms (map list->string (permutations '(A B C D)))) + → all-perms + +;; {set} substraction +(set-substract (make-set all-perms) (make-set perms)) + → { DBAC } diff --git a/Task/Find-the-missing-permutation/Nim/find-the-missing-permutation.nim b/Task/Find-the-missing-permutation/Nim/find-the-missing-permutation.nim new file mode 100644 index 0000000000..dfc6199a15 --- /dev/null +++ b/Task/Find-the-missing-permutation/Nim/find-the-missing-permutation.nim @@ -0,0 +1,19 @@ +import strutils + +proc missingPermutation(arr): string = + result = "" + if arr.len == 0: return + if arr.len == 1: return arr[0][1] & arr[0][0] + + for pos in 0 .. { 3, 1, 0, 2} +-- to chars -> { D, B, A, C} +-- (but obviously both done in one line) + +-- 2: the xor trick +r = repeat(0,4) +for i=1 to length(perms) do + r = sq_xor_bits(r,perms[i]) +end for +puts(1,r&'\n') +-- (relies on the missing chars being present an odd number of times, non-missing chars an even number of times) + +-- 3: find least frequent letters +r = " " +for i=1 to length(r) do + sequence count = repeat(0,4) + for j=1 to length(perms) do + count[perms[j][i]-'A'+1] += 1 + end for + r[i] = smallest(count,1)+'A'-1 +end for +puts(1,r&'\n') +-- (relies on the assumption that a full set would have each letter occurring the same number of times in each position) +-- (smallest(count,1) returns the index position of the smallest, rather than it's value) + +-- 4: test all permutations +for i=1 to factorial(4) do + r = permute(i,"ABCD") + if not find(r,perms) then exit end if +end for +puts(1,r&'\n') +-- (relies on brute force(!) - but this is the only method that could be made to cope with >1 omission) diff --git a/Task/Find-the-missing-permutation/Ring/find-the-missing-permutation.ring b/Task/Find-the-missing-permutation/Ring/find-the-missing-permutation.ring new file mode 100644 index 0000000000..4ed2d2bb2c --- /dev/null +++ b/Task/Find-the-missing-permutation/Ring/find-the-missing-permutation.ring @@ -0,0 +1,13 @@ +list = "ABCD CABD ACDB DACB BCDA ACBD ADCB CDAB DABC BCAD CADB CDBA CBAD ABDC ADBC BDCA DCBA BACD BADC BDAC CBDA DBCA DCAB" + +for a = ascii("A") to ascii("D") + for b = ascii("A") to ascii("D") + for c = ascii("A") to ascii("D") + for d = ascii("A") to ascii("D") + x = char(a) + char(b) + char(c)+ char(d) + if a!=b and a!=c and a!=d and b!=c and b!=d and c!=d + if substr(list,x) = 0 see x + " missing" + nl ok ok + next + next + next +next diff --git a/Task/Find-the-missing-permutation/Sidef/find-the-missing-permutation.sidef b/Task/Find-the-missing-permutation/Sidef/find-the-missing-permutation.sidef new file mode 100644 index 0000000000..f9544b7b74 --- /dev/null +++ b/Task/Find-the-missing-permutation/Sidef/find-the-missing-permutation.sidef @@ -0,0 +1,14 @@ +func check_perm(arr) { + (var hash = Hash.new).@{arr} = @[1]*arr.len; + arr.each { |s| + s.len.times { + var t = (s.substr(1) + s.substr(0, 1)); + hash.has_key(t) || return t; + } + } +} + +var perms = %w(ABCD CABD ACDB DACB BCDA ACBD ADCB CDAB DABC BCAD CADB CDBA + CBAD ABDC ADBC BDCA DCBA BACD BADC BDAC CBDA DBCA DCAB); + +say check_perm(perms); diff --git a/Task/Find-the-missing-permutation/jq/find-the-missing-permutation-1.jq b/Task/Find-the-missing-permutation/jq/find-the-missing-permutation-1.jq new file mode 100644 index 0000000000..6d57187a27 --- /dev/null +++ b/Task/Find-the-missing-permutation/jq/find-the-missing-permutation-1.jq @@ -0,0 +1,22 @@ +def transpose: + if (.[0] | length) == 0 then [] + else [map(.[0])] + (map(.[1:]) | transpose) + end ; + +# Input: an array of integers (based on the encoding of A=0, B=1, etc) +# corresponding to the occurrences in any one position of the +# letters in the list of permutations. +# Output: a tally in the form of an array recording in position i the +# parity of the number of occurrences of the letter corresponding to i. +# Example: given [0,1,0,1,2], the array of counts of 0, 1, and 2 is [2, 2, 1], +# and thus the final result is [0, 0, 1]. +def parities: + reduce .[] as $x ( []; .[$x] = (1 + .[$x]) % 2); + +# Input: an array of parity-counts, e.g. [0, 1, 0, 0] +# Output: the corresponding letter, e.g. "B". +def decode: + [index(1) + 65] | implode; + +# encode a string (e.g. "ABCD") as an array (e.g. [0,1,2,3]): +def encode_string: [explode[] - 65]; diff --git a/Task/Find-the-missing-permutation/jq/find-the-missing-permutation-2.jq b/Task/Find-the-missing-permutation/jq/find-the-missing-permutation-2.jq new file mode 100644 index 0000000000..269ac6470c --- /dev/null +++ b/Task/Find-the-missing-permutation/jq/find-the-missing-permutation-2.jq @@ -0,0 +1 @@ +map(encode_string) | transpose | map(parities | decode) | join("") diff --git a/Task/Find-the-missing-permutation/jq/find-the-missing-permutation-3.jq b/Task/Find-the-missing-permutation/jq/find-the-missing-permutation-3.jq new file mode 100644 index 0000000000..1acb2130e4 --- /dev/null +++ b/Task/Find-the-missing-permutation/jq/find-the-missing-permutation-3.jq @@ -0,0 +1,2 @@ +$ jq -R . Find_the_missing_permutation.txt | jq -s -f Find_the_missing_permutation.jq +"DBAC" diff --git a/Task/First-class-environments/EchoLisp/first-class-environments.echolisp b/Task/First-class-environments/EchoLisp/first-class-environments.echolisp new file mode 100644 index 0000000000..7a2ffecf9a --- /dev/null +++ b/Task/First-class-environments/EchoLisp/first-class-environments.echolisp @@ -0,0 +1,18 @@ +(define (bump-value) + (when (> value 1) + (set! count (1+ count)) + (set! value (if (even? value) (/ value 2) (1+ (* 3 value)))))) + +(define (env-show name envs ) +(write name) +(for ((env envs)) (write (format "%4a" (eval name env)))) +(writeln)) + +(define (task (envnum 12)) +(define envs (for/list ((i envnum)) (environment-new `((value ,(1+ i)) (count 0))))) +(env-show 'value envs) +(while + (any (curry (lambda ( n env) (!= 1 (eval n env))) 'value) envs) + (for/list ((env envs)) (eval '(bump-value) env)) + (env-show 'value envs)) +(env-show 'count envs)) diff --git a/Task/First-class-environments/Sidef/first-class-environments.sidef b/Task/First-class-environments/Sidef/first-class-environments.sidef new file mode 100644 index 0000000000..809580c76e --- /dev/null +++ b/Task/First-class-environments/Sidef/first-class-environments.sidef @@ -0,0 +1,25 @@ +func calculator({.is_one} ) { 1 } +func calculator(n {.is_even}) { n / 2 } +func calculator(n ) { 3*n + 1 } + +func succ(this {_{:value}.is_one}, _) { + return this +} + +func succ(this, get_next) { + this{:value} = get_next(this{:value}) + this{:count}++ + return this +} + +var enviornments = (1..12 -> map {|i| Hash(value => i, count => 0) }); + +while (!enviornments.map{ _{:value} }.all { .is_one }) { + say enviornments.map {|h| "%4s" % h{:value} }.join; + enviornments.range.each { |i| + enviornments[i] = succ(enviornments[i], calculator); + } +} + +say 'Counts'; +say enviornments.map{ |h| "%4s" % h{:count} }.join; diff --git a/Task/First-class-functions-Use-numbers-analogously/Oforth/first-class-functions-use-numbers-analogously.oforth b/Task/First-class-functions-Use-numbers-analogously/Oforth/first-class-functions-use-numbers-analogously.oforth new file mode 100644 index 0000000000..79799c5f35 --- /dev/null +++ b/Task/First-class-functions-Use-numbers-analogously/Oforth/first-class-functions-use-numbers-analogously.oforth @@ -0,0 +1,11 @@ +: multiplier(n1, n2) #[ n1 n2 * * ] ; + +: firstClassNum +| x xi y yi z zi | + 2.0 ->x + 0.5 ->xi + 4.0 ->y + 0.25 ->yi + x y + ->z + x y + inv ->zi + [ x, y, z ] [ xi, yi, zi ] zipWith(#multiplier) map(#[ 0.5 swap perform ] ) . ; diff --git a/Task/First-class-functions-Use-numbers-analogously/Phix/first-class-functions-use-numbers-analogously-1.phix b/Task/First-class-functions-Use-numbers-analogously/Phix/first-class-functions-use-numbers-analogously-1.phix new file mode 100644 index 0000000000..5dcbf40616 --- /dev/null +++ b/Task/First-class-functions-Use-numbers-analogously/Phix/first-class-functions-use-numbers-analogously-1.phix @@ -0,0 +1,22 @@ +sequence mtable = {} + +function multiplier(atom n1, atom n2) + mtable = append(mtable,{n1,n2}) + return length(mtable) +end function + +function call_multiplier(integer f, atom m) +atom {n1,n2} = mtable[f] + return n1*n2*m +end function + +constant x = 2, + xi = 0.5, + y = 4, + yi = 0.25, + z = x + y, + zi = 1 / ( x + y ) + +?call_multiplier(multiplier(x,xi),0.5) +?call_multiplier(multiplier(y,yi),0.5) +?call_multiplier(multiplier(z,zi),0.5) diff --git a/Task/First-class-functions-Use-numbers-analogously/Phix/first-class-functions-use-numbers-analogously-2.phix b/Task/First-class-functions-Use-numbers-analogously/Phix/first-class-functions-use-numbers-analogously-2.phix new file mode 100644 index 0000000000..3fd97454b7 --- /dev/null +++ b/Task/First-class-functions-Use-numbers-analogously/Phix/first-class-functions-use-numbers-analogously-2.phix @@ -0,0 +1,25 @@ +sequence ctable = {} + +function compose(integer f, integer g) + ctable = append(ctable,{f,g}) + return length(ctable) +end function + +function call_composite(integer f, atom x) +integer g + {f,g} = ctable[f] + return call_func(f,{call_func(g,{x})}) +end function + +function plus1(atom x) + return x+1 +end function + +function halve(atom x) + return x/2 +end function + +constant m = compose(routine_id("halve"),routine_id("plus1")) + +?call_composite(m,1) -- displays 1 +?call_composite(m,4) -- displays 2.5 diff --git a/Task/First-class-functions-Use-numbers-analogously/Sidef/first-class-functions-use-numbers-analogously.sidef b/Task/First-class-functions-Use-numbers-analogously/Sidef/first-class-functions-use-numbers-analogously.sidef new file mode 100644 index 0000000000..8d76835f0e --- /dev/null +++ b/Task/First-class-functions-Use-numbers-analogously/Sidef/first-class-functions-use-numbers-analogously.sidef @@ -0,0 +1,19 @@ +func multiplier(n1, n2) { + func (n3) { + n1 * n2 * n3; + } +} + +var x = 2.0; +var xi = 0.5; +var y = 4.0; +var yi = 0.25; +var z = (x + y); +var zi = (1 / (x + y)); + +var numbers = [x, y, z]; +var inverses = [xi, yi, zi]; + +numbers.pair_with(inverses).each { |g, f| + say multiplier(g, f)(0.5); +} diff --git a/Task/First-class-functions-Use-numbers-analogously/jq/first-class-functions-use-numbers-analogously.jq b/Task/First-class-functions-Use-numbers-analogously/jq/first-class-functions-use-numbers-analogously.jq new file mode 100644 index 0000000000..cf5e3a6c58 --- /dev/null +++ b/Task/First-class-functions-Use-numbers-analogously/jq/first-class-functions-use-numbers-analogously.jq @@ -0,0 +1,21 @@ +# Infrastructure: +# zip this and that +def zip(that): + . as $this | reduce range(0;length) as $i ([]; . + [ [$this[$i], that[$i]] ]); + +# The task: +def x: 2.0; +def xi: 0.5; +def y: 4.0; +def yi: 0.25; +def z: x + y; +def zi: 1.0 / (x + y); + +def numlist: [x,y,z]; + +def invlist: [xi, yi, zi]; + +# Input: [x,y] +def multiplier(j): .[0] * .[1] * j; + +numlist|zip(invlist) | map( multiplier(0.5) ) diff --git a/Task/First-class-functions/Ceylon/first-class-functions-1.ceylon b/Task/First-class-functions/Ceylon/first-class-functions-1.ceylon new file mode 100644 index 0000000000..d26a756797 --- /dev/null +++ b/Task/First-class-functions/Ceylon/first-class-functions-1.ceylon @@ -0,0 +1,3 @@ +module rosetta "1.0.0" { + import ceylon.numeric "1.2.1"; +} diff --git a/Task/First-class-functions/Ceylon/first-class-functions-2.ceylon b/Task/First-class-functions/Ceylon/first-class-functions-2.ceylon new file mode 100644 index 0000000000..bd351656ae --- /dev/null +++ b/Task/First-class-functions/Ceylon/first-class-functions-2.ceylon @@ -0,0 +1,17 @@ +import ceylon.numeric.float { + + sin, exp, asin, log +} + +shared void run() { + + function cube(Float x) => x ^ 3; + function cubeRoot(Float x) => x ^ (1.0 / 3.0); + + value functions = {sin, exp, cube}; + value inverses = {asin, log, cubeRoot}; + + for([func, inv] in zipPairs(functions, inverses)) { + print(compose(func, inv)(0.5)); + } +} diff --git a/Task/First-class-functions/EchoLisp/first-class-functions.echolisp b/Task/First-class-functions/EchoLisp/first-class-functions.echolisp new file mode 100644 index 0000000000..fa58d372ee --- /dev/null +++ b/Task/First-class-functions/EchoLisp/first-class-functions.echolisp @@ -0,0 +1,15 @@ +;; adapted from Racket +;; (compose f g h ... ) is a built-in defined as : +;; (define (compose f g) (λ (x) (f (g x)))) + +(define (cube x) (expt x 3)) +(define (cube-root x) (expt x (// 1 3))) +(define funlist (list sin cos cube)) +(define ifunlist (list asin acos cube-root)) + +(for ([f funlist] [i ifunlist]) + (writeln ((compose i f) 0.5))) +→ + 0.5 + 0.4999999999999999 + 0.5 diff --git a/Task/First-class-functions/Lasso/first-class-functions.lasso b/Task/First-class-functions/Lasso/first-class-functions.lasso new file mode 100644 index 0000000000..d4844ca139 --- /dev/null +++ b/Task/First-class-functions/Lasso/first-class-functions.lasso @@ -0,0 +1,30 @@ +#!/usr/bin/lasso9 + +define cube(x::decimal) => { + return #x -> pow(3.0) +} + +define cuberoot(x::decimal) => { + return #x -> pow(1.0/3.0) +} + +define compose(f, g, v) => { + return { + return #f -> detach -> invoke(#g -> detach -> invoke(#1)) + } -> detach -> invoke(#v) +} + + +local(functions = array({return #1 -> sin}, {return #1 -> cos}, {return cube(#1)})) +local(inverse = array({return #1 -> asin}, {return #1 -> acos}, {return cuberoot(#1)})) + +loop(3) + stdoutnl( + compose( + #functions -> get(loop_count), + #inverse -> get(loop_count), + 0.5 + ) + ) + +/loop diff --git a/Task/First-class-functions/Lingo/first-class-functions-1.lingo b/Task/First-class-functions/Lingo/first-class-functions-1.lingo new file mode 100644 index 0000000000..3ae8263b9f --- /dev/null +++ b/Task/First-class-functions/Lingo/first-class-functions-1.lingo @@ -0,0 +1,12 @@ +-- sin, cos and sqrt are built-in, square, asin and acos are user-defined +A = [#sin, #cos, #square] +B = [#asin, #acos, #sqrt] + +testValue = 0.5 + +repeat with i = 1 to 3 + -- for implementation details of compose() see https://www.rosettacode.org/wiki/Function_composition#Lingo + f = compose(A[i], B[i]) + res = call(f, _movie, testValue) + put res = testValue +end repeat diff --git a/Task/First-class-functions/Lingo/first-class-functions-2.lingo b/Task/First-class-functions/Lingo/first-class-functions-2.lingo new file mode 100644 index 0000000000..4ad23ac8e1 --- /dev/null +++ b/Task/First-class-functions/Lingo/first-class-functions-2.lingo @@ -0,0 +1,13 @@ +on square (x) + return x*x +end + +on asin (x) + res = atan(sqrt(x*x/(1-x*x))) + if x<0 then res = -res + return res +end + +on acos (x) + return PI/2 - asin(x) +end diff --git a/Task/First-class-functions/Nim/first-class-functions.nim b/Task/First-class-functions/Nim/first-class-functions.nim new file mode 100644 index 0000000000..6738063e71 --- /dev/null +++ b/Task/First-class-functions/Nim/first-class-functions.nim @@ -0,0 +1,27 @@ +from math import nil + +proc cube(x: float64) : float64 {.procvar.} = + math.pow(x, 3) + +proc cuberoot(x: float64) : float64 {.procvar.} = + math.pow(x, 1/3) + +proc compose[A](f: proc(x: A): A, g: proc(x: A): A) : (proc(x: A): A) = + proc c(x: A): A {.closure.} = + f(g(x)) + return c + +proc sin(x: float64) : float64 {.procvar.} = + math.sin(x) +proc asin(x: float64) : float64 {.procvar.}= + math.arcsin(x) +proc cos(x: float64) : float64 {.procvar.} = + math.cos(x) +proc acos(x: float64) : float64 {.procvar.} = + math.arccos(x) + +var fun = @[sin, cos, cube] +var inv = @[asin, acos, cuberoot] + +for i in 0..2: + echo $compose(inv[i], fun[i])(0.5) diff --git a/Task/First-class-functions/Oforth/first-class-functions.oforth b/Task/First-class-functions/Oforth/first-class-functions.oforth new file mode 100644 index 0000000000..70cea484d0 --- /dev/null +++ b/Task/First-class-functions/Oforth/first-class-functions.oforth @@ -0,0 +1,4 @@ +: compose(f, g) #[ g perform f perform ] ; + +[ #cos, #sin, #[ 3 pow ] ] [ #acos, #asin, #[ 3 inv powf ] ] zipWith(#compose) +map(#[ 0.5 swap perform ]) conform(#[ 0.5 == ]) println diff --git a/Task/First-class-functions/Phix/first-class-functions.phix b/Task/First-class-functions/Phix/first-class-functions.phix new file mode 100644 index 0000000000..3fd97454b7 --- /dev/null +++ b/Task/First-class-functions/Phix/first-class-functions.phix @@ -0,0 +1,25 @@ +sequence ctable = {} + +function compose(integer f, integer g) + ctable = append(ctable,{f,g}) + return length(ctable) +end function + +function call_composite(integer f, atom x) +integer g + {f,g} = ctable[f] + return call_func(f,{call_func(g,{x})}) +end function + +function plus1(atom x) + return x+1 +end function + +function halve(atom x) + return x/2 +end function + +constant m = compose(routine_id("halve"),routine_id("plus1")) + +?call_composite(m,1) -- displays 1 +?call_composite(m,4) -- displays 2.5 diff --git a/Task/First-class-functions/Sidef/first-class-functions.sidef b/Task/First-class-functions/Sidef/first-class-functions.sidef new file mode 100644 index 0000000000..2512c1d278 --- /dev/null +++ b/Task/First-class-functions/Sidef/first-class-functions.sidef @@ -0,0 +1,15 @@ +func compose(f,g) { + func (*args) { + f(g(args...)); + } +} + +var cube = func(a) { a.pow(3) }; +var croot = func(a) { a.root(3) }; + +var flist1 = [Math.method(:sin), Math.method(:cos), cube]; +var flist2 = [Math.method(:asin), Math.method(:acos), croot]; + +flist1.range.each { |i| + say compose(flist1[i], flist2[i])(0.5); +} diff --git a/Task/First-class-functions/Swift/first-class-functions.swift b/Task/First-class-functions/Swift/first-class-functions.swift new file mode 100644 index 0000000000..abb42d31f1 --- /dev/null +++ b/Task/First-class-functions/Swift/first-class-functions.swift @@ -0,0 +1,7 @@ +import Darwin +func compose(f: (B) -> C, g: (A) -> B) -> (A) -> C { + return { f(g($0)) } +} +let funclist = [ { (x: Double) in sin(x) }, { (x: Double) in cos(x) }, { (x: Double) in pow(x, 3) } ] +let funclisti = [ { (x: Double) in asin(x) }, { (x: Double) in acos(x) }, { (x: Double) in cbrt(x) } ] +println(map(zip(funclist, funclisti)) { f, inversef in compose(f, inversef)(0.5) }) diff --git a/Task/Five-weekends/Ceylon/five-weekends-1.ceylon b/Task/Five-weekends/Ceylon/five-weekends-1.ceylon new file mode 100644 index 0000000000..d88bfb532e --- /dev/null +++ b/Task/Five-weekends/Ceylon/five-weekends-1.ceylon @@ -0,0 +1,3 @@ +module rosetta.fiveweekends "1.0.0" { + import ceylon.time "1.2.2"; +} diff --git a/Task/Five-weekends/Ceylon/five-weekends-2.ceylon b/Task/Five-weekends/Ceylon/five-weekends-2.ceylon new file mode 100644 index 0000000000..0dedbe7fd8 --- /dev/null +++ b/Task/Five-weekends/Ceylon/five-weekends-2.ceylon @@ -0,0 +1,55 @@ +import ceylon.time { + date, + Date +} +import ceylon.time.base { + january, + december, + friday, + Month +} + +shared void run() { + [Date[],Integer[]] result = fiveWeekendsRecursive(); + + value fiveWeekendFirstOfMonths = result[0]; + Integer[] yearsWithNoFiveWeekendMonths = result[1]; + + print("# five weekend months = ``fiveWeekendFirstOfMonths.size``"); + print("# years without five weekend months = ``yearsWithNoFiveWeekendMonths.size``"); + yearsWithNoFiveWeekendMonths.each(print); +} + +[Date[], Integer[]] fiveWeekendsRecursive() + => fiveWeekendsRecursiveInner{ year = 1900; + month = january; + fiveWeekendFirstOfMonths = []; + yearsWithNoFiveWeekendMonths = []; }; + +[Date[], Integer[]] fiveWeekendsRecursiveInner(Integer year, + Month month, + Date[] fiveWeekendFirstOfMonths, + Integer[] yearsWithNoFiveWeekendMonths) { + if (year > 2100) { + return [fiveWeekendFirstOfMonths,yearsWithNoFiveWeekendMonths]; + } + + Date firstOfMonth = date{ year = year; month = month; day = 1; }; + + Boolean isFiveWeekendMonth = + (month.numberOfDays() == 31 && friday == firstOfMonth.dayOfWeek); + + Boolean hasNoFiveWeekends = + month == december && + ! isFiveWeekendMonth && + fiveWeekendFirstOfMonths.filter((date) => date.year == year).size == 0; + + return fiveWeekendsRecursiveInner(if (month == december) then year+1 else year, + if (month == december) then january else month.plusMonths(1), + if (isFiveWeekendMonth) + then fiveWeekendFirstOfMonths.withTrailing(firstOfMonth) + else fiveWeekendFirstOfMonths, + if (hasNoFiveWeekends) + then yearsWithNoFiveWeekendMonths.withTrailing(year) + else yearsWithNoFiveWeekendMonths); +} diff --git a/Task/Five-weekends/ERRE/five-weekends.erre b/Task/Five-weekends/ERRE/five-weekends.erre new file mode 100644 index 0000000000..4589786049 --- /dev/null +++ b/Task/Five-weekends/ERRE/five-weekends.erre @@ -0,0 +1,36 @@ +PROGRAM FIVE_WEEKENDS + +DIM M$[12] + +PROCEDURE MODULO(X,Y->MD) + IF Y=0 THEN + MD=X + ELSE + MD=X-Y*INT(X/Y) + END IF +END PROCEDURE + +PROCEDURE WD(M,D,Y->RES%) + IF M=1 OR M=2 THEN + M+=12 + Y-=1 + END IF + MODULO(365*Y+INT(Y/4)-INT(Y/100)+INT(Y/400)+D+INT((153*M+8)/5),7->RES) + RES%=RES+1.0 +END PROCEDURE + +BEGIN + M$[]=("","JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER") + PRINT(CHR$(12);) ! CLS + FOR YEAR=1900 TO 2100 DO + FOREACH MONTH IN (1,3,5,7,8,10,12) DO ! months with 31 days + WD(MONTH,1,YEAR->RES%) + IF RES%=6 THEN ! day #6 is Friday + PRINT(YEAR;": ";M$[MONTH]) + CNT%=CNT%+1 +! IF CNT% MOD 20=0 THEN GET(K$) END IF ! press a key for next page + END IF + END FOR + END FOR + PRINT("Total =";CNT%) +END PROGRAM diff --git a/Task/Five-weekends/FreeBASIC/five-weekends.freebasic b/Task/Five-weekends/FreeBASIC/five-weekends.freebasic new file mode 100644 index 0000000000..5b10ef54fc --- /dev/null +++ b/Task/Five-weekends/FreeBASIC/five-weekends.freebasic @@ -0,0 +1,61 @@ +' version 23-06-2015 +' compile with: fbc -s console + +Function wd(m As Integer, d As Integer, y As Integer) As Integer + ' Zellerish + ' 0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday + ' 4 = Thursday, 5 = Friday, 6 = Saturday + + If m < 3 Then ' If m = 1 Or m = 2 Then + m += 12 + y -= 1 + End If + Return (y + (y \ 4) - (y \ 100) + (y \ 400) + d + ((153 * m + 8) \ 5)) Mod 7 +End Function + +' ------=< MAIN >=------ +' only months with 31 day can have five weekends +' these months are: January, March, May, July, August, October, December +' in nr: 1, 3, 5, 7, 8, 10, 12 +' the 1e day needs to be on a friday (= 5) + +Dim As String month_names(1 To 12) => {"January","February","March",_ + "April","May","June","July","August",_ + "September","October","November","December"} +Dim As Integer m, yr, total, i, j, yr_without(200) +Dim As String answer + +For yr = 1900 To 2100 ' Gregorian calendar + answer = "" + For m = 1 To 12 Step 2 + If m = 9 Then m = 8 + If wd(m , 1 , yr) = 5 Then + answer = answer + month_names(m) + ", " + total = total + 1 + End If + Next + If answer <> "" Then + Print Using "#### | "; yr; + Print Left(answer, Len(answer) -2) ' get rid of extra " ," + Else + i = i + 1 + yr_without(i) = yr + End If +Next + +Print +Print "nr of month for 1900 to 2100 that has five weekends";total +Print +Print i;" years don't have months with five weekends" + +For j = 1 To i + Print yr_without(j); " "; + If j Mod 8 = 0 Then Print +Next +Print + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Five-weekends/Harbour/five-weekends.harbour b/Task/Five-weekends/Harbour/five-weekends.harbour new file mode 100644 index 0000000000..a0d42a7c33 --- /dev/null +++ b/Task/Five-weekends/Harbour/five-weekends.harbour @@ -0,0 +1,34 @@ +PROCEDURE Main() + LOCAL y, m, d, nFound, cNames, nTot := 0, nNotFives := 0 + LOCAL aFounds := {} + + SET DATE ANSI + + FOR y := 1900 TO 2100 + nFound := 0 ; cNames := "" + FOR m := 1 TO 12 + d := CtoD( hb_NtoS( y ) +"/" + hb_NtoS( m ) + "/1" ) + IF CDoW( d ) == "Friday" + IF DaysInMonth( m ) == 31 + nFound++ + cNames += CMonth( d ) + " " + ENDIF + ENDIF + NEXT + IF nFound > 0 + AAdd( aFounds, hb_NtoS( y ) + " : " + hb_NtoS( nFound ) + " ( " + Rtrim( cNames ) + " )" ) + nTot += nFound + ELSE + nNotFives++ + ENDIF + NEXT + ? "Total months with five weekends: " + hb_NtoS( nTot ) + ? "(see bellow the first and last five years/months with five weekends)" + ? + AEval( aFounds, { | e, n | Iif( n < 6, Qout( e ), NIL ) } ) + Qout("...") + AEval( aFounds, { | e, n | Iif( n > Len(aFounds)-5, Qout( e ), NIL ) } ) + ? + ? "Years with no five weekends months: " + hb_NtoS( nNotFives ) + + RETURN diff --git a/Task/Five-weekends/Lasso/five-weekends.lasso b/Task/Five-weekends/Lasso/five-weekends.lasso new file mode 100644 index 0000000000..3ff013c5f8 --- /dev/null +++ b/Task/Five-weekends/Lasso/five-weekends.lasso @@ -0,0 +1,52 @@ +local( + months = array(1, 3, 5, 7, 8, 10, 12), + fivemonths = array, + emptyears = array, + checkdate = date, + countyear +) + +#checkdate -> day = 1 + +loop(-from = 1900, -to = 2100) => { + + #countyear = false + + #checkdate -> year = loop_count + + with month in #months + do { + #checkdate -> month = #month + if(#checkdate -> dayofweek == 6) => { + #countyear = true + #fivemonths -> insert(#checkdate -> format(`YYYY MMM`)) + } + } + + if(not #countyear) => { + #emptyears -> insert(loop_count) + } + +} +local( + monthcount = #fivemonths -> size, + output = 'Total number of months ' + #monthcount + '
Starting five months ' +) + +loop(5) => { + #output -> append(#fivemonths -> get(loop_count) + ', ') +} + +#output -> append('
Ending five months ') + +loop(-from = #monthcount - 5, -to = #monthcount) => { + #output -> append(#fivemonths -> get(loop_count) + ', ') +} + +#output -> append('
Years with no five weekend months ' + #emptyears -> size + '
') + +with year in #emptyears do { + #output -> append(#year + ', ') +} + +#output diff --git a/Task/Five-weekends/Nim/five-weekends.nim b/Task/Five-weekends/Nim/five-weekends.nim new file mode 100644 index 0000000000..2bb54dbfd8 --- /dev/null +++ b/Task/Five-weekends/Nim/five-weekends.nim @@ -0,0 +1,18 @@ +import times + +const LongMonths = {mJan, mMar, mMay, mJul, mAug, mOct, mDec} + +var timeinfo = getLocalTime getTime() +timeinfo.monthday = 1 + +var sumNone = 0 +for year in 1900..2100: + var none = true + for month in LongMonths: + timeinfo.year = year + timeinfo.month = month + if getLocalTime(timeInfoToTime timeinfo).weekday == dFri: + echo month," ",year + none = false + if none: inc sumNone +echo "Years without a 5 weekend month: ",sumNone diff --git a/Task/Five-weekends/Oforth/five-weekends.oforth b/Task/Five-weekends/Oforth/five-weekends.oforth new file mode 100644 index 0000000000..b017b95f29 --- /dev/null +++ b/Task/Five-weekends/Oforth/five-weekends.oforth @@ -0,0 +1,12 @@ +: fiveWeekEnd(y1, y2) +| y m | + + ListBuffer new + y1 y2 for: y [ + Date.JANUARY Date.DECEMBER for: m [ + Date.DaysInMonth(y, m) 31 == + [ y, m, 01 ] asDate dayOfWeek Date.FRIDAY == and + ifTrue: [ [ y, m ] over add ] + ] + ] + dup size println dup left(5) println right(5) println ; diff --git a/Task/Five-weekends/Phix/five-weekends.phix b/Task/Five-weekends/Phix/five-weekends.phix new file mode 100644 index 0000000000..39e2dac902 --- /dev/null +++ b/Task/Five-weekends/Phix/five-weekends.phix @@ -0,0 +1,30 @@ +sequence m31 = {"January",0,"March",0,"May",0,"July","August",0,"October",0,"December"} +integer y,m, + nmonths = 0 +string months +sequence res = {}, + none = {} + +for y=1900 to 2100 do + months = "" + for m=1 to 12 do + if string(m31[m]) + and day_of_week(y,m,1)=6 then + if length(months)!=0 then months &= ", " end if + months &= m31[m] + nmonths += 1 + end if + end for + if length(months)=0 then + none = append(none,y) + else + res = append(res,sprintf("%d : %s\n",{y,months})) + end if +end for + +printf(1,"Found %d months with five full weekends\n",nmonths) +res[6..-6] = {" ...\n"} +puts(1,join(res,"")) +printf(1,"Found %d years with no month having 5 weekends:\n",{length(none)}) +none[6..-6] = {".."} +?none diff --git a/Task/Five-weekends/Ring/five-weekends.ring b/Task/Five-weekends/Ring/five-weekends.ring new file mode 100644 index 0000000000..88ce1e2cc2 --- /dev/null +++ b/Task/Five-weekends/Ring/five-weekends.ring @@ -0,0 +1,18 @@ +sum = 0 +month = list(12) +mo = [4,0,0,3,5,1,3,6,2,4,0,2] +mon = [31,28,31,30,31,30,31,31,30,31,30,31] +mont = ["January","February","March","April","May","June", + "July","August","September","October","November","December"] +for year = 1900 to 2100 + if year < 2100 leap = year - 1900 else leap = year - 1904 ok + m = ((year-1900)%7) + floor(leap/4) % 7 + oldsum = sum + for n = 1 to 12 + month[n] = (mo[n] + m) % 7 + x = (month[n] + 1) % 7 + if x = 2 and mon[n] = 31 sum += 1 see "" + year + "-" + mont[n] + nl ok + next + if sum = oldsum see "" + year + "-" + "(none)" + nl ok +next +see "Total : " + sum + nl diff --git a/Task/Five-weekends/Sidef/five-weekends.sidef b/Task/Five-weekends/Sidef/five-weekends.sidef new file mode 100644 index 0000000000..d1ddbcd0bf --- /dev/null +++ b/Task/Five-weekends/Sidef/five-weekends.sidef @@ -0,0 +1,34 @@ +require('DateTime'); + +var happymonths = []; +var workhardyears = []; +var longmonths = [1, 3, 5, 7, 8, 10, 12]; + +range(1900, 2100).each { |year| + var countmonths = 0; + longmonths.each { |month| + var dt = %s'DateTime'.new( + year => year, + month => month, + day => 1 + ); + + if (dt.day_of_week == 5) { + countmonths++; + var yearfound = dt.year; + var monthfound = dt.month_name; + happymonths.append(join(" ", yearfound, monthfound)); + } + } + + if (countmonths == 0) { + workhardyears.append(year); + } +} + +say "There are #{happymonths.len} months with 5 full weekends!"; +say "The first 5 and the last 5 of them are:"; +say happymonths.first(5).join("\n"); +say happymonths.last(5).join("\n"); +say "No long weekends in the following #{workhardyears.len} years:"; +say workhardyears.join(","); diff --git a/Task/Five-weekends/jq/five-weekends-1.jq b/Task/Five-weekends/jq/five-weekends-1.jq new file mode 100644 index 0000000000..9b9ce0a660 --- /dev/null +++ b/Task/Five-weekends/jq/five-weekends-1.jq @@ -0,0 +1,15 @@ + Use Zeller's Congruence to determine the day of the week, given +# year, month and day as integers in the conventional way. +# Emit 0 for Saturday, 1 for Sunday, etc. +# +def day_of_week(year; month; day): + if month == 1 or month == 2 then + [month + 12, year - 1] + else + [month, year] + end + | day + (13*(.[0] + 1)/5|floor) + + (.[1]%100) + ((.[1]%100)/4|floor) + + (.[1]/400|floor) - 2*(.[1]/100|floor) + | . % 7 +; diff --git a/Task/Five-weekends/jq/five-weekends-2.jq b/Task/Five-weekends/jq/five-weekends-2.jq new file mode 100644 index 0000000000..89831913ed --- /dev/null +++ b/Task/Five-weekends/jq/five-weekends-2.jq @@ -0,0 +1,25 @@ +def weekday_of_last_day_of_month(year; month): + def day_before(day): (6+day) % 7; + + if month==12 then day_before( day_of_week(year+1; 1; 1) ) + else day_before( day_of_week( year; month+1; 1 ) ) + end +; + +# The only case where the month has 5 weekends is when the last day +# of the month falls on a Sunday and the month has 31 days. +# +def five_weekends(from; to): + reduce range(from; to) as $year + ([]; reduce (1,3,5,7,8,10,12) as $month # months with 31 days + (.; + weekday_of_last_day_of_month($year; $month) as $day + | if $day == 1 then . + [[ $year, $month]] else . end )) +; + +# Input [year, month] as conventional integers; print e.g. "Jan 2001" +def pp: + def month: + ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][.-1]; + "\(.[1] | month) \(.[0])" +; diff --git a/Task/Five-weekends/jq/five-weekends-3.jq b/Task/Five-weekends/jq/five-weekends-3.jq new file mode 100644 index 0000000000..afaa0e1bb4 --- /dev/null +++ b/Task/Five-weekends/jq/five-weekends-3.jq @@ -0,0 +1,7 @@ +five_weekends(1900;2101) +| "There are \(length) months with 5 weekends from 1900 to 2100 inclusive;", + "the first and last five are as follows:", + ( .[0: 5][] | pp), + "...", + ( .[length-5: ][] | pp), + "In this period, there are \( [range(1900;2101)] - map( .[0] ) | length ) years which have no five-weekend months." diff --git a/Task/Five-weekends/jq/five-weekends-4.jq b/Task/Five-weekends/jq/five-weekends-4.jq new file mode 100644 index 0000000000..297c5bd97d --- /dev/null +++ b/Task/Five-weekends/jq/five-weekends-4.jq @@ -0,0 +1,15 @@ +$ jq -r -n -f Five_Weekends.jq +There are 201 months with 5 weekends from 1900 to 2100 inclusive; +the first and last five are as follows: +Mar 1901 +Aug 1902 +May 1903 +Jan 1904 +Jul 1904 +... +Mar 2097 +Aug 2098 +May 2099 +Jan 2100 +Oct 2100 +In this period, there are 29 years which have no five-weekend months. diff --git a/Task/FizzBuzz/8th/fizzbuzz.8th b/Task/FizzBuzz/8th/fizzbuzz.8th new file mode 100644 index 0000000000..03b62df555 --- /dev/null +++ b/Task/FizzBuzz/8th/fizzbuzz.8th @@ -0,0 +1,25 @@ +with: n + +: num? \ n f -- ) + if drop else . then ; + +\ is m mod n 0? leave the result twice on the stack +: div? \ m n -- f f + mod 0 = dup ; + +: fizz? \ n -- n f + dup 3 + div? if "Fizz" . then ; + +: buzz? \ n f -- n f + over 5 + div? if "Buzz" . then or ; + +\ print a message as appropriate for the given number: +: fizzbuzz \ n -- + fizz? buzz? num? + space ; + +\ iterate from 1 to 100: +' fizzbuzz 1 100 loop +cr bye diff --git a/Task/FizzBuzz/AntLang/fizzbuzz.antlang b/Task/FizzBuzz/AntLang/fizzbuzz.antlang new file mode 100644 index 0000000000..0cb8781adf --- /dev/null +++ b/Task/FizzBuzz/AntLang/fizzbuzz.antlang @@ -0,0 +1,3 @@ +n:{1+ x}map range[100] +s:{a:0eq x mod 3;b:0eq x mod 5;concat apply{1elem x}map{0elem x}hfilter seq[1- max[a;b];a;b]merge seq[str[x];"Fizz";"Buzz"]}map n +echo map s diff --git a/Task/FizzBuzz/Arc/fizzbuzz-1.arc b/Task/FizzBuzz/Arc/fizzbuzz-1.arc new file mode 100644 index 0000000000..4953916b63 --- /dev/null +++ b/Task/FizzBuzz/Arc/fizzbuzz-1.arc @@ -0,0 +1,6 @@ +(for n 1 100 + (prn:if + (multiple n 15) 'FizzBuzz + (multiple n 5) 'Buzz + (multiple n 3) 'Fizz + n)) diff --git a/Task/FizzBuzz/Arc/fizzbuzz-2.arc b/Task/FizzBuzz/Arc/fizzbuzz-2.arc new file mode 100644 index 0000000000..daeb738d83 --- /dev/null +++ b/Task/FizzBuzz/Arc/fizzbuzz-2.arc @@ -0,0 +1,4 @@ +(for n 1 100 + (prn:check (string (when (multiple n 3) 'Fizz) + (when (multiple n 5) 'Buzz)) + ~empty n)) ; check created string not empty, else return n diff --git a/Task/FizzBuzz/Arc/fizzbuzz-3.arc b/Task/FizzBuzz/Arc/fizzbuzz-3.arc new file mode 100644 index 0000000000..3a9a9bc95c --- /dev/null +++ b/Task/FizzBuzz/Arc/fizzbuzz-3.arc @@ -0,0 +1,6 @@ +(for n 1 100 + (prn:case (gcd n 15) + 1 n + 3 'Fizz + 5 'Buzz + 'FizzBuzz)) diff --git a/Task/FizzBuzz/Axe/fizzbuzz.axe b/Task/FizzBuzz/Axe/fizzbuzz.axe new file mode 100644 index 0000000000..91054080d1 --- /dev/null +++ b/Task/FizzBuzz/Axe/fizzbuzz.axe @@ -0,0 +1,13 @@ +For(I,1,100) +!If I^3??I^5 + Disp "FIZZBUZZ",i +Else!If I^3 + Disp "FIZZ",i +Else!If I^5 + Disp "BUZZ",i +Else + Disp I▶Dec,i +End +.Pause to allow the user to actually read the output +Pause 1000 +End diff --git a/Task/FizzBuzz/Ceylon/fizzbuzz.ceylon b/Task/FizzBuzz/Ceylon/fizzbuzz.ceylon new file mode 100644 index 0000000000..323565e677 --- /dev/null +++ b/Task/FizzBuzz/Ceylon/fizzbuzz.ceylon @@ -0,0 +1 @@ +shared void run() => {for (i in 1..100) {for (j->k in [3->"Fizz", 5->"Buzz"]) if (j.divides(i)) k}.reduce(plus) else i}.each(print); diff --git a/Task/FizzBuzz/Coco/fizzbuzz-1.coco b/Task/FizzBuzz/Coco/fizzbuzz-1.coco new file mode 100644 index 0000000000..83285be637 --- /dev/null +++ b/Task/FizzBuzz/Coco/fizzbuzz-1.coco @@ -0,0 +1,6 @@ +for i from 1 to 100 + console.log do + if i % 15 == 0 then 'FizzBuzz' + else if i % 3 == 0 then 'Fizz' + else if i % 5 == 0 then 'Buzz' + else i diff --git a/Task/FizzBuzz/Coco/fizzbuzz-2.coco b/Task/FizzBuzz/Coco/fizzbuzz-2.coco new file mode 100644 index 0000000000..eef42ad769 --- /dev/null +++ b/Task/FizzBuzz/Coco/fizzbuzz-2.coco @@ -0,0 +1,2 @@ +for i from 1 to 100 + console.log(['Fizz' unless i % 3] + ['Buzz' unless i % 5] or String(i)) diff --git a/Task/FizzBuzz/Crystal/fizzbuzz.crystal b/Task/FizzBuzz/Crystal/fizzbuzz.crystal new file mode 100644 index 0000000000..3d665a5e67 --- /dev/null +++ b/Task/FizzBuzz/Crystal/fizzbuzz.crystal @@ -0,0 +1,11 @@ +1.upto(100) do |v| + p fizz_buzz(v) +end + +def fizz_buzz(value) + word = "" + word += "fizz" if value % 3 == 0 + word += "buzz" if value % 5 == 0 + word += value.to_s if word.empty? + word +end diff --git a/Task/FizzBuzz/ECL/fizzbuzz.ecl b/Task/FizzBuzz/ECL/fizzbuzz.ecl new file mode 100644 index 0000000000..324b9b12fa --- /dev/null +++ b/Task/FizzBuzz/ECL/fizzbuzz.ecl @@ -0,0 +1,17 @@ +DataRec := RECORD + STRING s; +END; + +DataRec MakeDataRec(UNSIGNED c) := TRANSFORM + SELF.s := MAP + ( + c % 15 = 0 => 'FizzBuzz', + c % 3 = 0 => 'Fizz', + c % 5 = 0 => 'Buzz', + (STRING)c + ); +END; + +d := DATASET(100,MakeDataRec(COUNTER)); + +OUTPUT(d); diff --git a/Task/FizzBuzz/ERRE/fizzbuzz.erre b/Task/FizzBuzz/ERRE/fizzbuzz.erre new file mode 100644 index 0000000000..888d48c0ab --- /dev/null +++ b/Task/FizzBuzz/ERRE/fizzbuzz.erre @@ -0,0 +1,17 @@ +PROGRAM FIZZ_BUZZ +! +! for rosettacode.org +! +BEGIN + FOR A=1 TO 100 DO + IF A MOD 15=0 THEN + PRINT("FizzBuzz") + ELSIF A MOD 3=0 THEN + PRINT("Fizz") + ELSIF A MOD 5=0 THEN + PRINT("Buzz") + ELSE + PRINT(A) + END IF + END FOR +END PROGRAM diff --git a/Task/FizzBuzz/Eero/fizzbuzz.eero b/Task/FizzBuzz/Eero/fizzbuzz.eero new file mode 100644 index 0000000000..512f77bd60 --- /dev/null +++ b/Task/FizzBuzz/Eero/fizzbuzz.eero @@ -0,0 +1,14 @@ +#import + +int main() + autoreleasepool + + for int i in 1 .. 100 + s := '' + if i % 3 == 0 + s << 'Fizz' + if i % 5 == 0 + s << 'Buzz' + Log( '(%d) %@', i, s ) + + return 0 diff --git a/Task/FizzBuzz/Elm/fizzbuzz-1.elm b/Task/FizzBuzz/Elm/fizzbuzz-1.elm new file mode 100644 index 0000000000..aa31bbb801 --- /dev/null +++ b/Task/FizzBuzz/Elm/fizzbuzz-1.elm @@ -0,0 +1,15 @@ +import Graphics.Element exposing (show) +import List exposing (map) + +main = + map getWordForNum [1..100] |> show + +getWordForNum num = + if num % 15 == 0 then + "FizzBuzz" + else if num % 3 == 0 then + "Fizz" + else if num % 5 == 0 then + "Buzz" + else + toString num diff --git a/Task/FizzBuzz/Elm/fizzbuzz-2.elm b/Task/FizzBuzz/Elm/fizzbuzz-2.elm new file mode 100644 index 0000000000..423d1ce46b --- /dev/null +++ b/Task/FizzBuzz/Elm/fizzbuzz-2.elm @@ -0,0 +1,18 @@ +import Html exposing (text) +import List exposing (map) +import String exposing (join) + +main : Html.Html +main = + map fizzbuzz [1..100] |> join " " |> text + +fizzbuzz : Int -> String +fizzbuzz num = + let + fizz = if num % 3 == 0 then "Fizz" else "" + buzz = if num % 5 == 0 then "Buzz" else "" + in + if fizz == buzz then + toString num + else + fizz ++ buzz diff --git a/Task/FizzBuzz/FOCAL/fizzbuzz.focal b/Task/FizzBuzz/FOCAL/fizzbuzz.focal new file mode 100644 index 0000000000..d393252c35 --- /dev/null +++ b/Task/FizzBuzz/FOCAL/fizzbuzz.focal @@ -0,0 +1,16 @@ +01.10 FOR I=1,100; DO 2.0 +01.20 QUIT + +02.10 SET ZB=I/15 - FITR(I/15) +02.20 IF (ZB) 2.4, 2.3, 2.4 +02.30 TYPE "FizzBuzz" ! +02.35 RETURN +02.40 SET Z=I/3 - FITR(I/3) +02.50 IF (Z) 2.7, 2.6, 2.7 +02.60 TYPE "Fizz" ! +02.65 RETURN +02.70 SET B=I/5 - FITR(I/5) +02.80 IF (B) 2.99, 2.9, 2.99 +02.90 TYPE "Buzz" ! +02.95 RETURN +02.99 TYPE %3, I, ! diff --git a/Task/FizzBuzz/FutureBasic/fizzbuzz.futurebasic b/Task/FizzBuzz/FutureBasic/fizzbuzz.futurebasic new file mode 100644 index 0000000000..6a7531601b --- /dev/null +++ b/Task/FizzBuzz/FutureBasic/fizzbuzz.futurebasic @@ -0,0 +1,15 @@ +include "ConsoleWindow" + +dim as short fizz, buzz, i +dim as Str15 s + +for i = 1 to 100 + fizz = (i mod 3 ) + buzz = (i mod 5 ) + if (i) + if fizz + buzz == 0 then print i; ".", "FizzBuzz" : exit if + if fizz == 0 then print i; ".", "Fizz" : exit if + if buzz == 0 then print i; ".", "Buzz" : exit if + print i + end if +next i diff --git a/Task/FizzBuzz/GFA-Basic/fizzbuzz.gfa b/Task/FizzBuzz/GFA-Basic/fizzbuzz.gfa new file mode 100644 index 0000000000..da25997778 --- /dev/null +++ b/Task/FizzBuzz/GFA-Basic/fizzbuzz.gfa @@ -0,0 +1,13 @@ +' Fizz Buzz +' +FOR i%=1 TO 100 + IF i% MOD 15=0 + PRINT "FizzBuzz" + ELSE IF i% MOD 3=0 + PRINT "Fizz" + ELSE IF i% MOD 5=0 + PRINT "Buzz" + ELSE + PRINT i% + ENDIF +NEXT i% diff --git a/Task/FizzBuzz/Hoon/fizzbuzz.hoon b/Task/FizzBuzz/Hoon/fizzbuzz.hoon new file mode 100644 index 0000000000..3d3996c16a --- /dev/null +++ b/Task/FizzBuzz/Hoon/fizzbuzz.hoon @@ -0,0 +1,11 @@ +:- %say +|= [^ ~ ~] + :- %noun + %+ turn (gulf [1 101]) + |= a=@ + =+ q=[=(0 (mod a 3)) =(0 (mod a 5))] + ?+ q + [& &] "FizzBuzz" + [& |] "Fizz" + [| &] "Buzz" + == diff --git a/Task/FizzBuzz/Hy/fizzbuzz.hy b/Task/FizzBuzz/Hy/fizzbuzz.hy new file mode 100644 index 0000000000..422be6686b --- /dev/null +++ b/Task/FizzBuzz/Hy/fizzbuzz.hy @@ -0,0 +1,5 @@ +(for [i (range 1 101)] (print (cond + [(not (% i 15)) "FizzBuzz"] + [(not (% i 5)) "Buzz"] + [(not (% i 3)) "Fizz"] + [True i]))) diff --git a/Task/FizzBuzz/I/fizzbuzz.i b/Task/FizzBuzz/I/fizzbuzz.i new file mode 100644 index 0000000000..1ad71763a7 --- /dev/null +++ b/Task/FizzBuzz/I/fizzbuzz.i @@ -0,0 +1,13 @@ +software { + for i over [1,100] + if i mod 15 = 0 + print("FizzBuzz") + elseif i mod 3 = 0 + print("Fizz") + elseif i mod 5 = 0 + print("Buzz") + else + print(i) + end + end +} diff --git a/Task/FizzBuzz/Idris/fizzbuzz.idris b/Task/FizzBuzz/Idris/fizzbuzz.idris new file mode 100644 index 0000000000..344c76609d --- /dev/null +++ b/Task/FizzBuzz/Idris/fizzbuzz.idris @@ -0,0 +1,8 @@ +fizzBuzz : Nat -> String +fizzBuzz n = if (n `mod` 15) == 0 then "FizzBuzz" + else if (n `mod` 3) == 0 then "Fizz" + else if (n `mod` 5) == 0 then "Buzz" + else show n + +main : IO () +main = sequence_ $ map (putStrLn . fizzBuzz) [1..100] diff --git a/Task/FizzBuzz/Kamailio-Script/fizzbuzz.kamailio b/Task/FizzBuzz/Kamailio-Script/fizzbuzz.kamailio new file mode 100644 index 0000000000..5e9c272026 --- /dev/null +++ b/Task/FizzBuzz/Kamailio-Script/fizzbuzz.kamailio @@ -0,0 +1,20 @@ +# FizzBuzz +log_stderror=yes +loadmodule "pv" +loadmodule "xlog" + +route { + $var(i) = 1; + while ($var(i) <= 1000) { + if ($var(i) mod 15 == 0) { + xlog("FizzBuzz\n"); + } else if ($var(i) mod 5 == 0) { + xlog("Buzz\n"); + } else if ($var(i) mod 3 == 0) { + xlog("Fizz\n"); + } else { + xlog("$var(i)\n"); + } + $var(i) = $var(i) + 1; + } +} diff --git a/Task/FizzBuzz/Klong/fizzbuzz.klong b/Task/FizzBuzz/Klong/fizzbuzz.klong new file mode 100644 index 0000000000..3b29f089ab --- /dev/null +++ b/Task/FizzBuzz/Klong/fizzbuzz.klong @@ -0,0 +1,11 @@ +{[fizzy buzzy fizzybuzzy]; + fizzy::x!3; + buzzy::x!5; + fizzybuzzy::(fizzy+buzzy); + :[0=fizzybuzzy;.d("FizzBuzz") + :|0=fizzy; + .d("Fizz") + :|0=buzzy; + .d("Buzz"); + .d(x)]; + .d(" ")}'1+!100 diff --git a/Task/FizzBuzz/Lasso/fizzbuzz.lasso b/Task/FizzBuzz/Lasso/fizzbuzz.lasso new file mode 100644 index 0000000000..9502f96c72 --- /dev/null +++ b/Task/FizzBuzz/Lasso/fizzbuzz.lasso @@ -0,0 +1,2 @@ +with i in generateSeries(1, 100) +select ((#i % 3 == 0 ? 'Fizz' | '') + (#i % 5 == 0 ? 'Buzz' | '') || #i) diff --git a/Task/FizzBuzz/LiveCode/fizzbuzz.livecode b/Task/FizzBuzz/LiveCode/fizzbuzz.livecode new file mode 100644 index 0000000000..6a2c45a0f5 --- /dev/null +++ b/Task/FizzBuzz/LiveCode/fizzbuzz.livecode @@ -0,0 +1,16 @@ +repeat with i = 1 to 100 + switch + case i mod 15 = 0 + put "FizzBuzz" & cr after fizzbuzz + break + case i mod 5 = 0 + put "Buzz" & cr after fizzbuzz + break + case i mod 3 = 0 + put "Fizz" & cr after fizzbuzz + break + default + put i & cr after fizzbuzz + end switch +end repeat +put fizzbuzz diff --git a/Task/FizzBuzz/LiveScript/fizzbuzz.live b/Task/FizzBuzz/LiveScript/fizzbuzz.live new file mode 100644 index 0000000000..44b085f317 --- /dev/null +++ b/Task/FizzBuzz/LiveScript/fizzbuzz.live @@ -0,0 +1 @@ +[1 to 100] map -> [k + \zz for k, v of {Fi: 3, Bu: 5} | it % v < 1] * '' || it diff --git a/Task/FizzBuzz/Lobster/fizzbuzz.lobster b/Task/FizzBuzz/Lobster/fizzbuzz.lobster new file mode 100644 index 0000000000..e976e92674 --- /dev/null +++ b/Task/FizzBuzz/Lobster/fizzbuzz.lobster @@ -0,0 +1,6 @@ +include "std.lobster" + +forbias(100, 1) i: + fb := (i % 3 == 0 and "fizz" or "") + + (i % 5 == 0 and "buzz" or "") + print fb.length and fb or "" + i diff --git a/Task/FizzBuzz/Luck/fizzbuzz.luck b/Task/FizzBuzz/Luck/fizzbuzz.luck new file mode 100644 index 0000000000..7d2f78f28a --- /dev/null +++ b/Task/FizzBuzz/Luck/fizzbuzz.luck @@ -0,0 +1,6 @@ +for i in range(1,101) do ( + if i%15 == 0 then print("FizzBuzz") + else if i%3 == 0 then print("Fizz") + else if i%5 == 0 then print("Buzz") + else print(i) +) diff --git a/Task/FizzBuzz/Monte/fizzbuzz.monte b/Task/FizzBuzz/Monte/fizzbuzz.monte new file mode 100644 index 0000000000..7d75a294e7 --- /dev/null +++ b/Task/FizzBuzz/Monte/fizzbuzz.monte @@ -0,0 +1,13 @@ +def fizzBuzz(top): + var t := 1 + while (t < top): + if ((t % 3 == 0) || (t % 5 == 0)): + if (t % 15 == 0): + traceln(`$t FizzBuzz`) + else if (t % 3 == 0): + traceln(`$t Fizz`) + else: + traceln(`$t Buzz`) + t += 1 + +fizzBuzz(100) diff --git a/Task/FizzBuzz/MoonScript/fizzbuzz.moon b/Task/FizzBuzz/MoonScript/fizzbuzz.moon new file mode 100644 index 0000000000..f790c69e84 --- /dev/null +++ b/Task/FizzBuzz/MoonScript/fizzbuzz.moon @@ -0,0 +1,4 @@ +for i = 1,100 + print ((a) -> a == "" and i or a) table.concat { + i % 3 == 0 and "Fizz" or "" + i % 5 == 0 and "Buzz" or ""} diff --git a/Task/FizzBuzz/NewtonScript/fizzbuzz.newton b/Task/FizzBuzz/NewtonScript/fizzbuzz.newton new file mode 100644 index 0000000000..3d93d58ace --- /dev/null +++ b/Task/FizzBuzz/NewtonScript/fizzbuzz.newton @@ -0,0 +1,12 @@ +for i := 1 to 100 do +begin + if i mod 15 = 0 then + print("FizzBuzz") + else if i mod 3 = 0 then + print("Fizz") + else if i mod 5 = 0 then + print("Buzz") + else + print(i); + print("\n") +end diff --git a/Task/FizzBuzz/Nim/fizzbuzz-1.nim b/Task/FizzBuzz/Nim/fizzbuzz-1.nim new file mode 100644 index 0000000000..9566ba2377 --- /dev/null +++ b/Task/FizzBuzz/Nim/fizzbuzz-1.nim @@ -0,0 +1,9 @@ +for i in 1..100: + if i mod 15 == 0: + echo("FizzBuzz") + elif i mod 3 == 0: + echo("Fizz") + elif i mod 5 == 0: + echo("Buzz") + else: + echo(i) diff --git a/Task/FizzBuzz/Nim/fizzbuzz-2.nim b/Task/FizzBuzz/Nim/fizzbuzz-2.nim new file mode 100644 index 0000000000..21f20a4546 --- /dev/null +++ b/Task/FizzBuzz/Nim/fizzbuzz-2.nim @@ -0,0 +1,6 @@ +var messages = @["", "Fizz", "Buzz", "FizzBuzz"] +var acc = 810092048 +for i in 1..100: + var c = acc and 3 + echo(if c == 0: $i else: messages[c]) + acc = acc shr 2 or c shl 28 diff --git a/Task/FizzBuzz/Nim/fizzbuzz-3.nim b/Task/FizzBuzz/Nim/fizzbuzz-3.nim new file mode 100644 index 0000000000..a7b6f59db9 --- /dev/null +++ b/Task/FizzBuzz/Nim/fizzbuzz-3.nim @@ -0,0 +1,17 @@ +import macros +macro FizzBuzz(N): stmt = + var source = "" + for i in 1..N.intVal: + source &= "echo \"" + if i mod 15 == 0: + source &= "FizzBuzz" + elif i mod 3 == 0: + source &= "Fizz" + elif i mod 5 == 0: + source &= "Buzz" + else: + source &= $i + source &= "\"\n" + result = parseStmt(source) + +FizzBuzz(100) diff --git a/Task/FizzBuzz/Oforth/fizzbuzz.oforth b/Task/FizzBuzz/Oforth/fizzbuzz.oforth new file mode 100644 index 0000000000..51cb17f8b3 --- /dev/null +++ b/Task/FizzBuzz/Oforth/fizzbuzz.oforth @@ -0,0 +1,8 @@ +: fizzbuzz +| i | + 100 loop: i [ + null + i 3 mod ifZero: [ "Fizz" + ] + i 5 mod ifZero: [ "Buzz" + ] + dup ifNull: [ drop i ] . + ] ; diff --git a/Task/FizzBuzz/PHL/fizzbuzz.phl b/Task/FizzBuzz/PHL/fizzbuzz.phl new file mode 100644 index 0000000000..9d75e21fee --- /dev/null +++ b/Task/FizzBuzz/PHL/fizzbuzz.phl @@ -0,0 +1,22 @@ +module fizzbuzz; + +extern printf; + +@Integer main [ + var i = 1; + while (i <= 100) { + if (i % 15 == 0) + printf("FizzBuzz"); + else if (i % 3 == 0) + printf("Fizz"); + else if (i % 5 == 0) + printf("Buzz"); + else + printf("%d", i); + + printf("\n"); + i = i::inc; + } + + return 0; +] diff --git a/Task/FizzBuzz/Peloton/fizzbuzz-1.peloton b/Task/FizzBuzz/Peloton/fizzbuzz-1.peloton new file mode 100644 index 0000000000..e9073913ab --- /dev/null +++ b/Task/FizzBuzz/Peloton/fizzbuzz-1.peloton @@ -0,0 +1,9 @@ +<# DEFINE USERDEFINEDROUTINE LITERAL>__FizzBuzz|<# SUPPRESSAUTOMATICWHITESPACE> +<# TEST ISITMODULUSZERO PARAMETER LITERAL>1|3 +<# TEST ISITMODULUSZERO PARAMETER LITERAL>1|5 +<# ONLYFIRSTOFLASTTWO><# SAY LITERAL>Fizz +<# ONLYSECONDOFLASTTWO><# SAY LITERAL>Buzz +<# BOTH><# SAY LITERAL>FizzBuzz +<# NEITHER><# SAY PARAMETER>1 + +<# ITERATE FORITERATION LITERAL LITERAL>100|<# ACT USERDEFINEDROUTINE POSITION FORITERATION>__FizzBuzz|... diff --git a/Task/FizzBuzz/Peloton/fizzbuzz-2.peloton b/Task/FizzBuzz/Peloton/fizzbuzz-2.peloton new file mode 100644 index 0000000000..79cf46b79b --- /dev/null +++ b/Task/FizzBuzz/Peloton/fizzbuzz-2.peloton @@ -0,0 +1,9 @@ +<@ DEFUDRLIT>__FizzBuzz|<@ SAW> +<@ TSTMD0PARLIT>1|3 +<@ TSTMD0PARLIT>1|5 +<@ O12><@ SAYLIT>Fizz +<@ O22><@ SAYLIT>Buzz +<@ BTH><@ SAYLIT>FizzBuzz +<@ NTH><@ SAYPAR>1 + +<@ ITEFORLITLIT>100|<@ ACTUDRPOSFOR>__FizzBuzz|... diff --git a/Task/FizzBuzz/Phix/fizzbuzz.phix b/Task/FizzBuzz/Phix/fizzbuzz.phix new file mode 100644 index 0000000000..fd4c784075 --- /dev/null +++ b/Task/FizzBuzz/Phix/fizzbuzz.phix @@ -0,0 +1,4 @@ +constant x = {"%d\n","Fizz\n","Buzz\n","FizzBuzz\n"} +for i=1 to 100 do + printf(1,x[1+(remainder(i,3)=0)+2*(remainder(i,5)=0)],i) +end for diff --git a/Task/FizzBuzz/Pony/fizzbuzz.pony b/Task/FizzBuzz/Pony/fizzbuzz.pony new file mode 100644 index 0000000000..3480531ea6 --- /dev/null +++ b/Task/FizzBuzz/Pony/fizzbuzz.pony @@ -0,0 +1,18 @@ +use "collections" + +actor Main + new create(env: Env) => + for i in Range[I32](1, 100) do + env.out.print(fizzbuzz(i)) + end + + fun fizzbuzz(n: I32): String => + if (n % 15) == 0 then + "FizzBuzz" + elseif (n % 5) == 0 then + "Buzz" + elseif (n % 3) == 0 then + "Fizz" + else + n.string() + end diff --git a/Task/FizzBuzz/Potion/fizzbuzz.potion b/Task/FizzBuzz/Potion/fizzbuzz.potion new file mode 100644 index 0000000000..f58ddf0829 --- /dev/null +++ b/Task/FizzBuzz/Potion/fizzbuzz.potion @@ -0,0 +1,9 @@ +1 to 100 (a): + if (a % 15 == 0): + 'FizzBuzz'. + elsif (a % 3 == 0): + 'Fizz'. + elsif (a % 5 == 0): + 'Buzz'. + else: a. string print + "\n" print. diff --git a/Task/FizzBuzz/Pyret/fizzbuzz.pyret b/Task/FizzBuzz/Pyret/fizzbuzz.pyret new file mode 100644 index 0000000000..4816e43af5 --- /dev/null +++ b/Task/FizzBuzz/Pyret/fizzbuzz.pyret @@ -0,0 +1,20 @@ +is-positive = _ > 0 # equivalent to lam(x): x > 0 end + +fun fizzbuzz(n :: Number%(is-positive)) -> String: + doc: ```For positive input which is multiples of three return 'Fizz', for the multiples of five return 'Buzz'. + For numbers which are multiples of both three and five return 'FizzBuzz'. Otherwise, return the number itself.``` + ask: + | num-modulo(n, 15) == 0 then: "FizzBuzz" + | num-modulo(n, 3) == 0 then: "Fizz" + | num-modulo(n, 5) == 0 then: "Buzz" + | otherwise: num-to-string(n) + end +where: + fizzbuzz(1) is "1" + fizzbuzz(101) is "101" + fizzbuzz(45) is "FizzBuzz" + fizzbuzz(33) is "Fizz" + fizzbuzz(25) is "Buzz" +end + +range(1, 101).map(fizzbuzz).each(print) diff --git a/Task/FizzBuzz/Ring/fizzbuzz.ring b/Task/FizzBuzz/Ring/fizzbuzz.ring new file mode 100644 index 0000000000..9053284fa4 --- /dev/null +++ b/Task/FizzBuzz/Ring/fizzbuzz.ring @@ -0,0 +1,6 @@ +for n = 1 to 100 + if n % 15 = 0 see "" + n + " = " + "FizzBuzz"+ nl + but n % 5 = 0 see "" + n + " = " + "Buzz" + nl + but n % 3 = 0 see "" + n + " = " + "Fizz" + nl + else see "" + n + " = " + n + nl ok +next diff --git a/Task/FizzBuzz/SequenceL/fizzbuzz.sequencel b/Task/FizzBuzz/SequenceL/fizzbuzz.sequencel new file mode 100644 index 0000000000..ed0169e1b8 --- /dev/null +++ b/Task/FizzBuzz/SequenceL/fizzbuzz.sequencel @@ -0,0 +1,16 @@ +import ; +import ; + +main(args(2)) := + let + result[i] := + "FizzBuzz" when i mod 3 = 0 and i mod 5 = 0 + else + "Fizz" when i mod 3 = 0 + else + "Buzz" when i mod 5 = 0 + else + intToString(i) + foreach i within 1 ... 100; + in + delimit(result, '\n'); diff --git a/Task/FizzBuzz/Shen/fizzbuzz.shen b/Task/FizzBuzz/Shen/fizzbuzz.shen new file mode 100644 index 0000000000..16582177ca --- /dev/null +++ b/Task/FizzBuzz/Shen/fizzbuzz.shen @@ -0,0 +1,14 @@ +(define fizzbuzz + 101 -> (nl) + N -> (let divisible-by? (/. A B (integer? (/ A B))) + (cases (divisible-by? N 15) (do (output "Fizzbuzz!~%") + (fizzbuzz (+ N 1))) + (divisible-by? N 3) (do (output "Fizz!~%") + (fizzbuzz (+ N 1))) + (divisible-by? N 5) (do (output "Buzz!~%") + (fizzbuzz (+ N 1))) + true (do (output (str N)) + (nl) + (fizzbuzz (+ N 1)))))) + +(fizzbuzz 1) diff --git a/Task/FizzBuzz/Sidef/fizzbuzz-1.sidef b/Task/FizzBuzz/Sidef/fizzbuzz-1.sidef new file mode 100644 index 0000000000..e604d6c84d --- /dev/null +++ b/Task/FizzBuzz/Sidef/fizzbuzz-1.sidef @@ -0,0 +1,9 @@ +{ |i| + if (i %% 3) { + print "Fizz" + i %% 5 && print "Buzz" + print "\n" + } + elsif (i %% 5) { say "Buzz" } + else { say i } +} * 100 diff --git a/Task/FizzBuzz/Sidef/fizzbuzz-2.sidef b/Task/FizzBuzz/Sidef/fizzbuzz-2.sidef new file mode 100644 index 0000000000..1b6eb3dace --- /dev/null +++ b/Task/FizzBuzz/Sidef/fizzbuzz-2.sidef @@ -0,0 +1,6 @@ +func fizzbuzz({ _ %% 15 }) { "FizzBuzz" } +func fizzbuzz({ _ %% 5 }) { "Buzz" } +func fizzbuzz({ _ %% 3 }) { "Fizz" } +func fizzbuzz( n ) { n } + +for n in (1..100) { say fizzbuzz(n) } diff --git a/Task/FizzBuzz/Sidef/fizzbuzz-3.sidef b/Task/FizzBuzz/Sidef/fizzbuzz-3.sidef new file mode 100644 index 0000000000..e106d952ba --- /dev/null +++ b/Task/FizzBuzz/Sidef/fizzbuzz-3.sidef @@ -0,0 +1 @@ +{|i|say "#{[i%3]}#{[i%5]}"||i}*100 diff --git a/Task/FizzBuzz/SkookumScript/fizzbuzz-1.skookum b/Task/FizzBuzz/SkookumScript/fizzbuzz-1.skookum new file mode 100644 index 0000000000..207e3e5777 --- /dev/null +++ b/Task/FizzBuzz/SkookumScript/fizzbuzz-1.skookum @@ -0,0 +1,8 @@ +1.to 100 + [ + println( + if idx.mod(15) = 0 ["FizzBuzz"] + idx.mod(3) = 0 ["Fizz"] + idx.mod(5) = 0 ["Buzz"] + else [idx]) + ] diff --git a/Task/FizzBuzz/SkookumScript/fizzbuzz-2.skookum b/Task/FizzBuzz/SkookumScript/fizzbuzz-2.skookum new file mode 100644 index 0000000000..60db157a53 --- /dev/null +++ b/Task/FizzBuzz/SkookumScript/fizzbuzz-2.skookum @@ -0,0 +1,7 @@ +1.to 100 + [ + !str: "" + if idx.mod(3) = 0 [str += "Fizz"] + if idx.mod(5) = 0 [str += "Buzz"] + println(if str.empty? [idx] else [str]) + ] diff --git a/Task/FizzBuzz/SkookumScript/fizzbuzz-3.skookum b/Task/FizzBuzz/SkookumScript/fizzbuzz-3.skookum new file mode 100644 index 0000000000..aa45770124 --- /dev/null +++ b/Task/FizzBuzz/SkookumScript/fizzbuzz-3.skookum @@ -0,0 +1,6 @@ +1.to 100 + [ + !str: if idx.mod(3) = 0 ["Fizz"] else [""] + if idx.mod(5) = 0 [str += "Buzz"] + println(if str.empty? [idx] else [str]) + ] diff --git a/Task/FizzBuzz/Swift/fizzbuzz.swift b/Task/FizzBuzz/Swift/fizzbuzz.swift new file mode 100644 index 0000000000..1bd7dbfc1a --- /dev/null +++ b/Task/FizzBuzz/Swift/fizzbuzz.swift @@ -0,0 +1,12 @@ +for i in 1...100 { + switch (i % 3, i % 5) { + case (0, 0): + print("FizzBuzz") + case (0, _): + print("Fizz") + case (_, 0): + print("Buzz") + default: + print(i) + } +} diff --git a/Task/FizzBuzz/Symsyn/fizzbuzz.symsyn b/Task/FizzBuzz/Symsyn/fizzbuzz.symsyn new file mode 100644 index 0000000000..1c1a04878a --- /dev/null +++ b/Task/FizzBuzz/Symsyn/fizzbuzz.symsyn @@ -0,0 +1,22 @@ +| FizzBuzz + + 1 I + if I LE 100 + mod I 3 X + mod I 5 Y + if X EQ 0 + 'FIZZ' $S + if Y EQ 0 + + 'BUZZ' $S + endif + else + if Y EQ 0 + 'BUZZ' $S + else + ~ I $S + endif + endif + $S [] + + I + goif + endif diff --git a/Task/FizzBuzz/Ursa/fizzbuzz.ursa b/Task/FizzBuzz/Ursa/fizzbuzz.ursa new file mode 100644 index 0000000000..de0f83044e --- /dev/null +++ b/Task/FizzBuzz/Ursa/fizzbuzz.ursa @@ -0,0 +1,16 @@ +# +# fizzbuzz +# +decl int i +for (set i 1) (< i 101) (inc i) + if (= (mod i 3) 0) + out "fizz" console + end if + if (= (mod i 5) 0) + out "buzz" console + end if + if (not (or (= (mod i 3) 0) (= (mod i 5) 0))) + out i console + end if + out endl console +end for diff --git a/Task/FizzBuzz/Wart/fizzbuzz.wart b/Task/FizzBuzz/Wart/fizzbuzz.wart new file mode 100644 index 0000000000..b13bbf2820 --- /dev/null +++ b/Task/FizzBuzz/Wart/fizzbuzz.wart @@ -0,0 +1,9 @@ +for i 1 (i <= 100) ++i + prn (if (divides i 15) + "FizzBuzz" + (divides i 3) + "Fizz" + (divides i 5) + "Buzz" + :else + i) diff --git a/Task/FizzBuzz/Wortel/fizzbuzz.wortel b/Task/FizzBuzz/Wortel/fizzbuzz.wortel new file mode 100644 index 0000000000..770dbba02d --- /dev/null +++ b/Task/FizzBuzz/Wortel/fizzbuzz.wortel @@ -0,0 +1 @@ +@each &x!console.log x !*&x?{%%x 15 "FizzBuzz" %%x 5 "Buzz" %%x 3 "Fizz" x} @to 100 diff --git a/Task/FizzBuzz/XLISP/fizzbuzz.xlisp b/Task/FizzBuzz/XLISP/fizzbuzz.xlisp new file mode 100644 index 0000000000..05165ceab7 --- /dev/null +++ b/Task/FizzBuzz/XLISP/fizzbuzz.xlisp @@ -0,0 +1,13 @@ +(defun fizzbuzz () + (defun fizzb (x y) + (display (cond + ((= (mod x 3) (mod x 5) 0) "FizzBuzz") + ((= (mod x 3) 0) "Fizz") + ((= (mod x 5) 0) "Buzz") + (t x))) + (newline) + (if (< x y) + (fizzb (+ x 1) y))) + (fizzb 1 100)) + +(fizzbuzz) diff --git a/Task/FizzBuzz/XPath-2.0/fizzbuzz-1.xpath b/Task/FizzBuzz/XPath-2.0/fizzbuzz-1.xpath new file mode 100644 index 0000000000..1b68e721a5 --- /dev/null +++ b/Task/FizzBuzz/XPath-2.0/fizzbuzz-1.xpath @@ -0,0 +1,2 @@ +for $n in 1 to 100 return + concat('fizz'[not($n mod 3)], 'buzz'[not($n mod 5)], $n[$n mod 15 = (1,2,4,7,8,11,13,14)]) diff --git a/Task/FizzBuzz/XPath-2.0/fizzbuzz-2.xpath b/Task/FizzBuzz/XPath-2.0/fizzbuzz-2.xpath new file mode 100644 index 0000000000..2c6279cce2 --- /dev/null +++ b/Task/FizzBuzz/XPath-2.0/fizzbuzz-2.xpath @@ -0,0 +1,2 @@ +for $n in 1 to 100 return + ($n, 'Fizz', 'Buzz', 'FizzBuzz')[number(($n mod 3) = 0) + number(($n mod 5) = 0)*2 + 1] diff --git a/Task/FizzBuzz/jq/fizzbuzz-1.jq b/Task/FizzBuzz/jq/fizzbuzz-1.jq new file mode 100644 index 0000000000..79a1b7b9f5 --- /dev/null +++ b/Task/FizzBuzz/jq/fizzbuzz-1.jq @@ -0,0 +1,6 @@ +range(1;101) + | if . % 15 == 0 then "FizzBuzz" + elif . % 5 == 0 then "Buzz" + elif . % 3 == 0 then "Fizz" + else . + end diff --git a/Task/FizzBuzz/jq/fizzbuzz-2.jq b/Task/FizzBuzz/jq/fizzbuzz-2.jq new file mode 100644 index 0000000000..a70e3b5e3b --- /dev/null +++ b/Task/FizzBuzz/jq/fizzbuzz-2.jq @@ -0,0 +1,4 @@ +range(100) + 1 | [( + (select(. % 3 == 0) | "Fizz"), + (select(. % 5 == 0) | "Buzz") +) // tostring] | join("") diff --git a/Task/Flatten-a-list/8th/flatten-a-list.8th b/Task/Flatten-a-list/8th/flatten-a-list.8th new file mode 100644 index 0000000000..fd4f0d1e09 --- /dev/null +++ b/Task/Flatten-a-list/8th/flatten-a-list.8th @@ -0,0 +1,23 @@ +\ take a list (array) and flatten it: + +: (flatten) \ a -- a + ( + \ is it a number? + dup >kind ns:n n:= if + \ yes. so add to the list + r> swap a:push >r + else + \ it is not, so flatten it + (flatten) + then + drop + ) a:each drop ; + +: flatten \ a -- a + [] >r (flatten) r> ; + +[[1], 2, [[3,4], 5], [[[]]], [[[6]]], 7, 8, []] +dup . cr +flatten +. cr +bye diff --git a/Task/Flatten-a-list/Ceylon/flatten-a-list.ceylon b/Task/Flatten-a-list/Ceylon/flatten-a-list.ceylon new file mode 100644 index 0000000000..cfea6cb1c1 --- /dev/null +++ b/Task/Flatten-a-list/Ceylon/flatten-a-list.ceylon @@ -0,0 +1,13 @@ +shared void run() { + "Lazily flatten nested streams" + {Anything*} flatten({Anything*} stream) + => stream.flatMap((element) + => switch (element) + case (is {Anything*}) flatten(element) + else [element]); + + value list = [[1], 2, [[3,4], 5], [[[]]], [[[6]]], 7, 8, []]; + + print(list); + print(flatten(list).sequence()); +} diff --git a/Task/Flatten-a-list/EchoLisp/flatten-a-list.echolisp b/Task/Flatten-a-list/EchoLisp/flatten-a-list.echolisp new file mode 100644 index 0000000000..f7ac0cd3a7 --- /dev/null +++ b/Task/Flatten-a-list/EchoLisp/flatten-a-list.echolisp @@ -0,0 +1,26 @@ +(define (fflatten l) +(cond +[(null? l) null] +[(not (list? l)) (list l)] +[else (append (fflatten (first l)) (fflatten (rest l)))])) + +;; +(define L' [[1] 2 [[3 4] 5] [[[]]] [[[6]]] 7 8 []]) + +(fflatten L) ;; use custom function + → (1 2 3 4 5 6 7 8) +(flatten L) ;; use built-in + → (1 2 3 4 5 6 7 8) + +;; Remarks +;; null is the same as () - the empty list - +(flatten '(null null null)) + → null +(flatten '[ () () () ]) + → null +(flatten null) +❗ error: flatten : expected list : null + +;; The 'reverse' of flatten is group +(group '( 4 5 5 5 6 6 7 8 7 7 7 9)) + → ((4) (5 5 5) (6 6) (7) (8) (7 7 7) (9)) diff --git a/Task/Flatten-a-list/Elm/flatten-a-list.elm b/Task/Flatten-a-list/Elm/flatten-a-list.elm new file mode 100644 index 0000000000..8be6cead49 --- /dev/null +++ b/Task/Flatten-a-list/Elm/flatten-a-list.elm @@ -0,0 +1,27 @@ +import Graphics.Element exposing (show) + +type Tree a + = Leaf a + | Node (List (Tree a)) + +flatten : Tree a -> List a +flatten tree = + case tree of + Leaf a -> [a] + Node list -> List.concatMap flatten list + +-- [[1], 2, [[3, 4], 5], [[[]]], [[[6]]], 7, 8, []] +tree : Tree Int +tree = Node + [ Node [Leaf 1] + , Leaf 2 + , Node [Node [Leaf 3, Leaf 4], Leaf 5] + , Node [Node [Node []]] + , Node [Node [Node [Leaf 6]]] + , Leaf 7 + , Leaf 8 + , Node [] + ] + +main = + show (flatten tree) diff --git a/Task/Flatten-a-list/LFE/flatten-a-list.lfe b/Task/Flatten-a-list/LFE/flatten-a-list.lfe new file mode 100644 index 0000000000..76fd7ea128 --- /dev/null +++ b/Task/Flatten-a-list/LFE/flatten-a-list.lfe @@ -0,0 +1,2 @@ +> (: lists flatten '((1) 2 ((3 4) 5) ((())) (((6))) 7 8 ())) +(1 2 3 4 5 6 7 8) diff --git a/Task/Flatten-a-list/Lasso/flatten-a-list.lasso b/Task/Flatten-a-list/Lasso/flatten-a-list.lasso new file mode 100644 index 0000000000..3bdc65bf07 --- /dev/null +++ b/Task/Flatten-a-list/Lasso/flatten-a-list.lasso @@ -0,0 +1,6 @@ +local(original = json_deserialize('[[1], 2, [[3,4], 5], [[[]]], [[[6]]], 7, 8, []]')) + +#original +'
' +(with item in delve(#original) +select #item) -> asstaticarray diff --git a/Task/Flatten-a-list/NGS/flatten-a-list.ngs b/Task/Flatten-a-list/NGS/flatten-a-list.ngs new file mode 100644 index 0000000000..286a847b8a --- /dev/null +++ b/Task/Flatten-a-list/NGS/flatten-a-list.ngs @@ -0,0 +1,9 @@ +F flatten_r(a:Arr) + collector { + local kern + F kern(x) collect(x) + F kern(x:Arr) x.each(kern) + kern(a) + } + +echo(flatten_r([[1], 2, [[3, 4], 5], [[[]]], [[[6]]], 7, 8, []])) diff --git a/Task/Flatten-a-list/Nim/flatten-a-list.nim b/Task/Flatten-a-list/Nim/flatten-a-list.nim new file mode 100644 index 0000000000..229ef7b22d --- /dev/null +++ b/Task/Flatten-a-list/Nim/flatten-a-list.nim @@ -0,0 +1,34 @@ +type + TreeList[T] = ref TTreeList[T] + TTreeList[T] = object + case isLeaf: bool + of true: data: T + of false: list: seq[TreeList[T]] + +proc L[T](list: varargs[TreeList[T]]): TreeList[T] = + var s: seq[TreeList[T]] = @[] + for x in list: s.add x + TreeList[T](isLeaf: false, list: s) + +proc N[T](data: T): TreeList[T] = + TreeList[T](isLeaf: true, data: data) + +proc `$`[T](n: TreeList[T]): string = + if n.isLeaf: result = $n.data + else: + result = "[" + for i, x in n.list: + if i > 0: result.add ", " + result.add($x) + result.add "]" + +proc flatten[T](n: TreeList[T]): seq[T] = + if n.isLeaf: result = @[n.data] + else: + result = @[] + for x in n.list: + result.add flatten x + +var x = L(L(N 1), N 2, L(L(N 3, N 4), N 5), L(L(L[int]())), L(L(L(N 6))), N 7, N 8, L[int]()) +echo x +echo flatten(x) diff --git a/Task/Flatten-a-list/Oforth/flatten-a-list.oforth b/Task/Flatten-a-list/Oforth/flatten-a-list.oforth new file mode 100644 index 0000000000..bcf61ec90c --- /dev/null +++ b/Task/Flatten-a-list/Oforth/flatten-a-list.oforth @@ -0,0 +1 @@ +[[1], 2, [[3,4], 5], [[[]]], [[[6]]], 7, 8, []] expand println diff --git a/Task/Flatten-a-list/Phix/flatten-a-list.phix b/Task/Flatten-a-list/Phix/flatten-a-list.phix new file mode 100644 index 0000000000..d3a391ec4f --- /dev/null +++ b/Task/Flatten-a-list/Phix/flatten-a-list.phix @@ -0,0 +1 @@ +?flatten({{1},2,{{3,4},5},{{{}}},{{{6}}},7,8,{}}) diff --git a/Task/Flatten-a-list/Red/flatten-a-list.red b/Task/Flatten-a-list/Red/flatten-a-list.red new file mode 100644 index 0000000000..387d7f868f --- /dev/null +++ b/Task/Flatten-a-list/Red/flatten-a-list.red @@ -0,0 +1,6 @@ +flatten: function [ + "Flatten the block" + block [any-block!] +][ + load form block +] diff --git a/Task/Flatten-a-list/Ring/flatten-a-list.ring b/Task/Flatten-a-list/Ring/flatten-a-list.ring new file mode 100644 index 0000000000..98fe69eed7 --- /dev/null +++ b/Task/Flatten-a-list/Ring/flatten-a-list.ring @@ -0,0 +1,10 @@ +aList = "[[1], 2, [[3, 4], 5], [[[]]], [[[6]]], 7, 8, []]" +bList = "" +cList = "" +for n=1 to len(aList) + if ascii(aList[n]) >= 48 and ascii(aList[n]) <= 57 + bList = bList + ", " + aList[n] ok +next +cList = substr(bList,3,Len(bList)-2) +dList = "[" + cList + "]" +see dList + nl diff --git a/Task/Flatten-a-list/Sidef/flatten-a-list.sidef b/Task/Flatten-a-list/Sidef/flatten-a-list.sidef new file mode 100644 index 0000000000..31f873a345 --- /dev/null +++ b/Task/Flatten-a-list/Sidef/flatten-a-list.sidef @@ -0,0 +1,11 @@ +func flatten(a) { + var flat = []; + a.each { |item| + flat += (item.is_an(Array) ? flatten(item) : [item]); + }; + return flat; +} + +var arr = [[1], 2, [[3,4], 5], [[[]]], [[[6]]], 7, 8, []]; +say flatten(arr).dump; # used-defined function +say arr.flatten.dump; # built-in method for Array obj diff --git a/Task/Flatten-a-list/Swift/flatten-a-list-1.swift b/Task/Flatten-a-list/Swift/flatten-a-list-1.swift new file mode 100644 index 0000000000..e0b63315d2 --- /dev/null +++ b/Task/Flatten-a-list/Swift/flatten-a-list-1.swift @@ -0,0 +1,31 @@ +func list(s: Any...) -> [Any] { + return s +} + +func flatten(s: [Any]) -> [T] { + var r = [T]() + for e in s { + switch e { + case let a as [Any]: + r += flatten(a) + case let x as T: + r.append(x) + default: + assert(false, "value of wrong type") + } + } + return r +} + +let s = list(list(1), + 2, + list(list(3, 4), 5), + list(list(list())), + list(list(list(6))), + 7, + 8, + list() +) +println(s) +let result : [Int] = flatten(s) +println(result) diff --git a/Task/Flatten-a-list/Swift/flatten-a-list-2.swift b/Task/Flatten-a-list/Swift/flatten-a-list-2.swift new file mode 100644 index 0000000000..0a0cc2dc04 --- /dev/null +++ b/Task/Flatten-a-list/Swift/flatten-a-list-2.swift @@ -0,0 +1,29 @@ +func list(s: Any...) -> [Any] { + return s +} + +func flatten(s: [Any]) -> [T] { + return s.flatMap { + switch $0 { + case let a as [Any]: + return flatten(a) + case let x as T: + return [x] + default: + assert(false, "value of wrong type") + } + } +} + +let s = list(list(1), + 2, + list(list(3, 4), 5), + list(list(list())), + list(list(list(6))), + 7, + 8, + list() +) +println(s) +let result : [Int] = flatten(s) +println(result) diff --git a/Task/Flatten-a-list/Swift/flatten-a-list-3.swift b/Task/Flatten-a-list/Swift/flatten-a-list-3.swift new file mode 100644 index 0000000000..f3f9d30e3b --- /dev/null +++ b/Task/Flatten-a-list/Swift/flatten-a-list-3.swift @@ -0,0 +1,47 @@ +func list(s: Any...) -> [Any] +{ + return s +} + +func flatten(array: [Any]) -> [T] +{ + var result: [T] = [] + var workstack: [(array: [Any], lastIndex: Int)] = [(array, 0)] + + workstackLoop: while !workstack.isEmpty + { + for element in workstack.last!.array.suffixFrom(workstack.last!.lastIndex) + { + workstack[workstack.endIndex - 1].lastIndex++ + + if let element = element as? [Any] + { + workstack.append((element, 0)) + + continue workstackLoop + } + + result.append(element as! T) + } + + workstack.removeLast() + } + + return result +} + +let input = list(list(1), + 2, + list(list(3, 4), 5), + list(list(list())), + list(list(list(6))), + 7, + 8, + list() +) + +print(input) + +let result: [Int] = flatten(input) + +print(result) diff --git a/Task/Flatten-a-list/Wart/flatten-a-list.wart b/Task/Flatten-a-list/Wart/flatten-a-list.wart new file mode 100644 index 0000000000..ca4ef607d5 --- /dev/null +++ b/Task/Flatten-a-list/Wart/flatten-a-list.wart @@ -0,0 +1,7 @@ +def (flatten seq acc) + if no.seq + acc + ~list?.seq + (cons seq acc) + :else + (flatten car.seq (flatten cdr.seq acc)) diff --git a/Task/Flatten-a-list/jq/flatten-a-list-1.jq b/Task/Flatten-a-list/jq/flatten-a-list-1.jq new file mode 100644 index 0000000000..f563f4c00f --- /dev/null +++ b/Task/Flatten-a-list/jq/flatten-a-list-1.jq @@ -0,0 +1,6 @@ +def flatten: + reduce .[] as $i + ([]; + if $i | type == "array" then . + ($i | flatten) + else . + [$i] + end); diff --git a/Task/Flatten-a-list/jq/flatten-a-list-2.jq b/Task/Flatten-a-list/jq/flatten-a-list-2.jq new file mode 100644 index 0000000000..b5285ae77f --- /dev/null +++ b/Task/Flatten-a-list/jq/flatten-a-list-2.jq @@ -0,0 +1,2 @@ +[[1], 2, [[3,4], 5], [[[]]], [[[6]]], 7, 8, []] | flatten +[1,2,3,4,5,6,7,8] diff --git a/Task/Flipping-bits-game/Swift/flipping-bits-game.swift b/Task/Flipping-bits-game/Swift/flipping-bits-game.swift new file mode 100644 index 0000000000..e8198e6f44 --- /dev/null +++ b/Task/Flipping-bits-game/Swift/flipping-bits-game.swift @@ -0,0 +1,134 @@ +import Foundation + +struct Board: Equatable, CustomStringConvertible { + let size: Int + private var tiles: [Bool] + + init(size: Int) { + self.size = size + tiles = Array(count: size * size, repeatedValue: false) + } + + subscript(x: Int, y: Int) -> Bool { + get { + return tiles[y * size + x] + } + set { + tiles[y * size + x] = newValue + } + } + + mutating func randomize() { + for i in 0.. Bool { + return lhs.tiles == rhs.tiles +} + +class FlippingGame: CustomStringConvertible { + + var board: Board + var target: Board + var solved: Bool { return board == target } + + init(boardSize: Int) { + target = Board(size: 3) + board = Board(size: 3) + generateTarget() + } + + func generateTarget() { + target.randomize() + board = target + let size = board.size + while solved { + for _ in 0.. Bool { + print(self) + print("Flip what? ", terminator: "") + + guard + let move = readLine(stripNewline: true) + where move.characters.count == 1 + else { return false } + + var moveValid = true + + if let row = Int(move) { + board.flipRow(row - 1) + } + else if let column = move.lowercaseString.utf8.first where column < 100 && column > 96 { + board.flipColumn(numericCast(column) - 97) + } + else { + moveValid = false + } + + return moveValid + } + + var description: String { + var str = "" + print("Target: \n \(target)", toStream: &str) + print("Board: \n \(board)", toStream: &str) + + return str + } +} + +func playGame(game: FlippingGame) -> String { + game.generateTarget() + var numMoves = 0 + while !game.solved { + numMoves++ + print("Move #\(numMoves)") + while !game.getMove() {} + } + print("You win!") + print("Number of moves: \(numMoves)") + print("\n\nPlay Again? ", terminator: "") + + return readLine(stripNewline: true)!.lowercaseString +} + +let game = FlippingGame(boardSize: 3) +repeat { } while playGame(game) == "y" diff --git a/Task/Flow-control-structures/Comal/flow-control-structures-1.comal b/Task/Flow-control-structures/Comal/flow-control-structures-1.comal new file mode 100644 index 0000000000..1b73b9c4e2 --- /dev/null +++ b/Task/Flow-control-structures/Comal/flow-control-structures-1.comal @@ -0,0 +1,5 @@ +myprocedure +END // End of main program +PROC myprocedure +PRINT "Hello, this is a procedure" +ENDPROC myprocedure diff --git a/Task/Flow-control-structures/Comal/flow-control-structures-2.comal b/Task/Flow-control-structures/Comal/flow-control-structures-2.comal new file mode 100644 index 0000000000..90e4188b97 --- /dev/null +++ b/Task/Flow-control-structures/Comal/flow-control-structures-2.comal @@ -0,0 +1,5 @@ +LOOP +PRINT "I'm in a loop!" +EXIT +ENDLOOP +PRINT "But i somehow got out of it." diff --git a/Task/Flow-control-structures/Comal/flow-control-structures-3.comal b/Task/Flow-control-structures/Comal/flow-control-structures-3.comal new file mode 100644 index 0000000000..0aca9a0afe --- /dev/null +++ b/Task/Flow-control-structures/Comal/flow-control-structures-3.comal @@ -0,0 +1,6 @@ +PRINT "I'm in a loop!" +LOOP +INPUT "Do you want to exit?":answer$ +EXIT WHEN answer$="y" +ENDLOOP +PRINT "You got out of it." diff --git a/Task/Flow-control-structures/Comal/flow-control-structures-4.comal b/Task/Flow-control-structures/Comal/flow-control-structures-4.comal new file mode 100644 index 0000000000..8fd151bb2f --- /dev/null +++ b/Task/Flow-control-structures/Comal/flow-control-structures-4.comal @@ -0,0 +1,6 @@ +PRINT "Hello world" +GOTO label +PRINT "This line will never be output" +label: +PRINT "This program will end thanks to the evil GOTO statement" +END diff --git a/Task/Flow-control-structures/Nim/flow-control-structures-1.nim b/Task/Flow-control-structures/Nim/flow-control-structures-1.nim new file mode 100644 index 0000000000..93ddc7ef19 --- /dev/null +++ b/Task/Flow-control-structures/Nim/flow-control-structures-1.nim @@ -0,0 +1,5 @@ +block outer: + for i in 0..1000: + for j in 0..1000: + if i + j == 3: + break outer diff --git a/Task/Flow-control-structures/Nim/flow-control-structures-2.nim b/Task/Flow-control-structures/Nim/flow-control-structures-2.nim new file mode 100644 index 0000000000..7cc92ba2dd --- /dev/null +++ b/Task/Flow-control-structures/Nim/flow-control-structures-2.nim @@ -0,0 +1,7 @@ +var f = open "input.txt" +try: + var s = readLine f +except ReadIOEffect: + echo "An error occured!" +finally: + close f diff --git a/Task/Flow-control-structures/Oforth/flow-control-structures-1.oforth b/Task/Flow-control-structures/Oforth/flow-control-structures-1.oforth new file mode 100644 index 0000000000..bf3fdcd662 --- /dev/null +++ b/Task/Flow-control-structures/Oforth/flow-control-structures-1.oforth @@ -0,0 +1 @@ +break diff --git a/Task/Flow-control-structures/Oforth/flow-control-structures-2.oforth b/Task/Flow-control-structures/Oforth/flow-control-structures-2.oforth new file mode 100644 index 0000000000..44c5d7d65e --- /dev/null +++ b/Task/Flow-control-structures/Oforth/flow-control-structures-2.oforth @@ -0,0 +1 @@ +continue diff --git a/Task/Flow-control-structures/Oforth/flow-control-structures-3.oforth b/Task/Flow-control-structures/Oforth/flow-control-structures-3.oforth new file mode 100644 index 0000000000..b774df6592 --- /dev/null +++ b/Task/Flow-control-structures/Oforth/flow-control-structures-3.oforth @@ -0,0 +1 @@ +perform diff --git a/Task/Flow-control-structures/Phix/flow-control-structures-1.phix b/Task/Flow-control-structures/Phix/flow-control-structures-1.phix new file mode 100644 index 0000000000..2089db607f --- /dev/null +++ b/Task/Flow-control-structures/Phix/flow-control-structures-1.phix @@ -0,0 +1,3 @@ +#ilASM{ jmp :label } +... +#ilASM{ ::label } diff --git a/Task/Flow-control-structures/Phix/flow-control-structures-2.phix b/Task/Flow-control-structures/Phix/flow-control-structures-2.phix new file mode 100644 index 0000000000..1bb09790b2 --- /dev/null +++ b/Task/Flow-control-structures/Phix/flow-control-structures-2.phix @@ -0,0 +1,6 @@ +#ilASM{ call :%label } +... +#ilASM{ jmp :skip + :%label + ret + ::skip } diff --git a/Task/Flow-control-structures/Phix/flow-control-structures-3.phix b/Task/Flow-control-structures/Phix/flow-control-structures-3.phix new file mode 100644 index 0000000000..1a8ece79fe --- /dev/null +++ b/Task/Flow-control-structures/Phix/flow-control-structures-3.phix @@ -0,0 +1,6 @@ +for i=1 to 100 do + if a[i]=x then + location = i + exit + end if +end for diff --git a/Task/Flow-control-structures/Phix/flow-control-structures-4.phix b/Task/Flow-control-structures/Phix/flow-control-structures-4.phix new file mode 100644 index 0000000000..4504cd0d58 --- /dev/null +++ b/Task/Flow-control-structures/Phix/flow-control-structures-4.phix @@ -0,0 +1,4 @@ +for i=1 to 100 do + if a[i]=0 then continue end if + ... +end for diff --git a/Task/Flow-control-structures/Ring/flow-control-structures.ring b/Task/Flow-control-structures/Ring/flow-control-structures.ring new file mode 100644 index 0000000000..d6d182c23c --- /dev/null +++ b/Task/Flow-control-structures/Ring/flow-control-structures.ring @@ -0,0 +1,6 @@ +i = 1 +while true + see i + nl + if i = 10 see "Break!" exit ok + i = i + 1 +end diff --git a/Task/Flow-control-structures/SSEM/flow-control-structures-1.ssem b/Task/Flow-control-structures/SSEM/flow-control-structures-1.ssem new file mode 100644 index 0000000000..a8e7080df1 --- /dev/null +++ b/Task/Flow-control-structures/SSEM/flow-control-structures-1.ssem @@ -0,0 +1,3 @@ +00101000000000000000000000000000 20 to CI +... +01010000000000000000000000000000 20. 10 diff --git a/Task/Flow-control-structures/SSEM/flow-control-structures-2.ssem b/Task/Flow-control-structures/SSEM/flow-control-structures-2.ssem new file mode 100644 index 0000000000..3f911e50fe --- /dev/null +++ b/Task/Flow-control-structures/SSEM/flow-control-structures-2.ssem @@ -0,0 +1,3 @@ +00101000000001000000000000000000 Add 20 to CI +... +01010000000000000000000000000000 20. 10 diff --git a/Task/Floyds-triangle/ERRE/floyds-triangle.erre b/Task/Floyds-triangle/ERRE/floyds-triangle.erre new file mode 100644 index 0000000000..f93a64ea1f --- /dev/null +++ b/Task/Floyds-triangle/ERRE/floyds-triangle.erre @@ -0,0 +1,20 @@ +PROGRAM FLOYD + +! +! for rosettacode.org +! + +BEGIN + N=14 + NUM=1 + LAST=(N^2-N+2) DIV 2 + FOR ROW=1 TO N DO + FOR J=1 TO ROW DO + US$=STRING$(LEN(STR$(LAST-1+J))-1,"#") + WRITE(US$;NUM;) + PRINT(" ";) + NUM+=1 + END FOR + PRINT + END FOR +END PROGRAM diff --git a/Task/Floyds-triangle/FreeBASIC/floyds-triangle.freebasic b/Task/Floyds-triangle/FreeBASIC/floyds-triangle.freebasic new file mode 100644 index 0000000000..de9f91e9ac --- /dev/null +++ b/Task/Floyds-triangle/FreeBASIC/floyds-triangle.freebasic @@ -0,0 +1,53 @@ +' version 19-09-2015 +' compile with: fbc -s console + +Sub pascal_triangle(n As UInteger) + + Dim As UInteger a = 1, b, i, j, switch = n + 1 + Dim As String frmt, frmt_1, frmt_2 + + ' last number of the last line + i = (n * (n + 1)) \ 2 + frmt_2 = String(Len(Str(i)) + 1, "#") + ' first number of the last line + i = ((n - 1) * n) \ 2 + 1 + frmt_1 = String(Len(Str(i)) + 1, "#") + + ' we have 2 different formats strings + ' find the point where we have to make the switch + If frmt_1 <> frmt_2 Then + j = i + 1 + While Len(Str(i)) = Len(Str(J)) + j = j + 1 + Wend + switch = j - i + End If + + Print "output for "; Str(n) : Print + For i = 1 To n + frmt = frmt_1 + b = (i * (i + 1)) \ 2 + For j = a To b + ' if we have the switching point change format string + If j - a = switch Then frmt = frmt_2 + Print Using frmt; j; + Next j + Print + a = b + 1 + Next i + Print + +End Sub + +' ------=< MAIN >=------ + +pascal_triangle(5) + +pascal_triangle(14) + + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Floyds-triangle/Lasso/floyds-triangle.lasso b/Task/Floyds-triangle/Lasso/floyds-triangle.lasso new file mode 100644 index 0000000000..15ef6e1564 --- /dev/null +++ b/Task/Floyds-triangle/Lasso/floyds-triangle.lasso @@ -0,0 +1,24 @@ +define floyds_triangle(n::integer) => { + local(out = array(array(1)),comp = array, num = 1) + while(#out->size < #n) => { + local(new = array) + loop(#out->last->size + 1) => { + #num++ + #new->insert(#num) + } + #out->insert(#new) + } + local(pad = #out->last->last->asString->size) + with line in #out do => { + local(lineout = string) + with i in #line do => { + #i != #line->first ? #lineout->append(' ') + #lineout->append((' '*(#pad - #i->asString->size))+#i) + } + #comp->insert(#lineout) + } + return #comp->join('\r') +} +floyds_triangle(5) +'\r\r' +floyds_triangle(14) diff --git a/Task/Floyds-triangle/Nim/floyds-triangle.nim b/Task/Floyds-triangle/Nim/floyds-triangle.nim new file mode 100644 index 0000000000..62df764557 --- /dev/null +++ b/Task/Floyds-triangle/Nim/floyds-triangle.nim @@ -0,0 +1,24 @@ +import strutils + +proc floyd(rowcount = 5): seq[seq[int]] = + result = @[@[1]] + while result.len < rowcount: + let n = result[result.high][result.high] + 1 + var row = newSeq[int]() + for i in n .. n + result[result.high].len: + row.add i + result.add row + +proc pfloyd(rows) = + var colspace = newSeq[int]() + for n in rows[rows.high]: colspace.add(($n).len) + for row in rows: + for i, x in row: + stdout.write align($x, colspace[i])," " + echo "" + +echo floyd() + +for i in [5, 14]: + pfloyd(floyd(i)) + echo "" diff --git a/Task/Floyds-triangle/Ring/floyds-triangle.ring b/Task/Floyds-triangle/Ring/floyds-triangle.ring new file mode 100644 index 0000000000..02a5bb2e6f --- /dev/null +++ b/Task/Floyds-triangle/Ring/floyds-triangle.ring @@ -0,0 +1,9 @@ +rows = 10 +n = 0 +for r = 1 to rows + for c = 1 to r + n = n + 1 + see string(n) + " " + next + see nl +next diff --git a/Task/Floyds-triangle/Sidef/floyds-triangle.sidef b/Task/Floyds-triangle/Sidef/floyds-triangle.sidef new file mode 100644 index 0000000000..d6c984498b --- /dev/null +++ b/Task/Floyds-triangle/Sidef/floyds-triangle.sidef @@ -0,0 +1,10 @@ +func floyd(rows, n=1) { + var max = Math.range_sum(1, rows); + var widths = (max-rows .. max-1 -> map{(.+n).to_s.len}); + { |r| + say %'#{1..r -> map{|i| "%#{widths[i-1]}d" % n++}.join(" ")}'; + } * rows; +} + +floyd(5); # or: floyd(5, 88); +floyd(14); # or: floyd(14, 900); diff --git a/Task/Floyds-triangle/jq/floyds-triangle-1.jq b/Task/Floyds-triangle/jq/floyds-triangle-1.jq new file mode 100644 index 0000000000..90d2117e0b --- /dev/null +++ b/Task/Floyds-triangle/jq/floyds-triangle-1.jq @@ -0,0 +1,23 @@ +# floyd(n) creates an n-row floyd's triangle +def floyd(n): + def lpad(len): tostring | (((len - length) * " ") + .); + + # Construct an array of widths. + # Assuming N is the last integer on the last row (i.e. (n+1)*n/2), + # the last row has n entries from (1+N-n) through N: + def widths: + ((n+1)*n/2) as $N + | [range(1 + $N - n; $N + 1) | tostring | length]; + + # emit line k assuming it starts with the integer "start" + def line(start; k; widths): + reduce range(start; start+k) as $i + (""; . + ($i|lpad(widths[$i - start])) + " "); + + widths as $widths + | (reduce range(0;n) as $row + ( [0, ""]; # state: i, string + (.[0] + 1) as $i | .[1] as $string + | [ ($i + $row), + ($string + "\n" + line($i; $row + 1; $widths )) ] ) + | .[1] ) ; diff --git a/Task/Floyds-triangle/jq/floyds-triangle-2.jq b/Task/Floyds-triangle/jq/floyds-triangle-2.jq new file mode 100644 index 0000000000..c7883fad13 --- /dev/null +++ b/Task/Floyds-triangle/jq/floyds-triangle-2.jq @@ -0,0 +1 @@ +(5,14) | "floyd(\(.)): \(floyd(.))\n" diff --git a/Task/Floyds-triangle/jq/floyds-triangle-3.jq b/Task/Floyds-triangle/jq/floyds-triangle-3.jq new file mode 100644 index 0000000000..590efb3fc1 --- /dev/null +++ b/Task/Floyds-triangle/jq/floyds-triangle-3.jq @@ -0,0 +1,23 @@ +$ jq -M -r -n -f floyds_triangle.jq > floyds_triangle.out +floyd(5): + 1 + 2 3 + 4 5 6 + 7 8 9 10 +11 12 13 14 15 + +floyd(14): + 1 + 2 3 + 4 5 6 + 7 8 9 10 +11 12 13 14 15 +16 17 18 19 20 21 +22 23 24 25 26 27 28 +29 30 31 32 33 34 35 36 +37 38 39 40 41 42 43 44 45 +46 47 48 49 50 51 52 53 54 55 +56 57 58 59 60 61 62 63 64 65 66 +67 68 69 70 71 72 73 74 75 76 77 78 +79 80 81 82 83 84 85 86 87 88 89 90 91 +92 93 94 95 96 97 98 99 100 101 102 103 104 105 diff --git a/Task/Forest-fire/Ceylon/forest-fire.ceylon b/Task/Forest-fire/Ceylon/forest-fire.ceylon new file mode 100644 index 0000000000..8c97ab9bd6 --- /dev/null +++ b/Task/Forest-fire/Ceylon/forest-fire.ceylon @@ -0,0 +1,135 @@ +import ceylon.random { + + DefaultRandom +} + +class Cell of tree | empty | burning { + + shared new tree {} + shared new empty {} + shared new burning {} +} + +class Forest(Integer width, Integer height, Float f, Float p) { + + value random = DefaultRandom(); + function chance(Float probability) => random.nextFloat() < probability; + + object doubleBufferedGrid satisfies Iterable, Null> { + + function makeGrid(Cell|Cell() initialValue) => [ + for(j in 0:height) + Array { + for(i in 0:width) + switch(initialValue) + case(is Cell) initialValue + case(is Cell()) initialValue() + } + ]; + + value grids = [ + makeGrid(() => + if(chance(0.5)) + then Cell.tree + else Cell.empty), + makeGrid(Cell.empty) + ]; + + variable value firstIsFront = true; + value front => firstIsFront then grids.first else grids.last; + value back => firstIsFront then grids.last else grids.first; + + iterator() => front.iterator(); + shared Cell? get(Integer x, Integer y) => front[y]?.get(x); + shared void set(Integer x, Integer y, Cell cell) => back[y]?.set(x, cell); + shared void flip() => firstIsFront = !firstIsFront; + } + + shared void evolve() { + + function fireNearby(Integer x, Integer y) { + for(i in -1..1) { + for(j in -1..1) { + if(i == 0 && j == 0) { + continue; + } + if(exists cell = doubleBufferedGrid.get(x + i, y + j), + cell == Cell.burning) { + return true; + } + } + } + return false; + } + + for(j->row in doubleBufferedGrid.indexed) { + for(i->cell in row.indexed) { + switch(cell) + case(Cell.burning) { + doubleBufferedGrid.set(i, j, Cell.empty); + } + case(Cell.empty) { + value nextCell = chance(p) then Cell.tree else Cell.empty; + doubleBufferedGrid.set(i, j, nextCell); + } + case(Cell.tree) { + value nextCell = + fireNearby(i, j) || chance(f) + then Cell.burning + else Cell.tree; + doubleBufferedGrid.set(i, j, nextCell); + } + } + } + + doubleBufferedGrid.flip(); + } + + shared void display() { + + void drawLine() => print("-".repeat(width + 2)); + + drawLine(); + for(row in doubleBufferedGrid) { + process.write("|"); + for(cell in row) { + switch(cell) + case(Cell.empty) { + process.write(" "); + } + case(Cell.tree) { + process.write("A"); + } + case(Cell.burning) { + process.write("#"); + } + } + print("|"); + } + drawLine(); + } +} + +shared void run() { + + value forest = Forest(78, 38, 0.02, 0.03); + variable value generation = 1; + + while(true) { + + forest.display(); + forest.evolve(); + + print("Generation ``generation++`` + Press enter for next generation or q and then enter to quit"); + + value input = process.readLine(); + if(exists input) { + switch(input.trimmed) + case("q" | "Q") { + return; + } + else {} + } + } +} diff --git a/Task/Forest-fire/Nim/forest-fire.nim b/Task/Forest-fire/Nim/forest-fire.nim new file mode 100644 index 0000000000..695775db0f --- /dev/null +++ b/Task/Forest-fire/Nim/forest-fire.nim @@ -0,0 +1,56 @@ +import math, os, strutils +randomize() + +type State = enum Empty, Tree, Fire + +const + disp: array[State, string] = [" ", "\e[32m/\\\e[m", "\e[07;31m/\\\e[m"] + treeProb = 0.01 + burnProb = 0.001 + +proc chance(prob: float): bool = random(1.0) < prob + +# Set the size +var w, h: int +if paramCount() >= 2: + w = parseInt paramStr 1 + h = parseInt paramStr 2 +if w <= 0: w = 30 +if h <= 0: h = 30 + +# Iterate over fields in the universe +iterator fields(a = (0,0), b = (h-1,w-1)) = + for y in max(a[0], 0) .. min(b[0], h-1): + for x in max(a[1], 0) .. min(b[1], w-1): + yield (y,x) + +# Create a sequence with an initializer +proc newSeqWith[T](len: int, init: T): seq[T] = + result = newSeq[T] len + for i in 0 .. { + loop(2) => { + sleep(2000) + stdoutnl(#mydata) + #mydata = 'Oh, looks like I am in a new thread' + } +} + +loop(2) => { + sleep(3000) + stdoutnl(#mydata) + #mydata = 'Aha, I am still in the original thread' +} diff --git a/Task/Fork/Nim/fork.nim b/Task/Fork/Nim/fork.nim new file mode 100644 index 0000000000..47ccd91b3a --- /dev/null +++ b/Task/Fork/Nim/fork.nim @@ -0,0 +1,11 @@ +import posix + +var pid = fork() +if pid < 0: + # error forking a child +elif pid > 0: + # parent, and pid is process id of child +else: + # child + quit() +# further Parent stuff here diff --git a/Task/Fork/Phix/fork-1.phix b/Task/Fork/Phix/fork-1.phix new file mode 100644 index 0000000000..ad0916cace --- /dev/null +++ b/Task/Fork/Phix/fork-1.phix @@ -0,0 +1,8 @@ +procedure mythread() + ?"mythread" + exit_thread(0) +end procedure + +atom hThread = create_thread(routine_id("mythread"),{}) +?"main carries on" +wait_thread(hThread) diff --git a/Task/Fork/Phix/fork-2.phix b/Task/Fork/Phix/fork-2.phix new file mode 100644 index 0000000000..b02a0a48c9 --- /dev/null +++ b/Task/Fork/Phix/fork-2.phix @@ -0,0 +1 @@ +system("calc") diff --git a/Task/Fork/Sidef/fork.sidef b/Task/Fork/Sidef/fork.sidef new file mode 100644 index 0000000000..ef8178682c --- /dev/null +++ b/Task/Fork/Sidef/fork.sidef @@ -0,0 +1,3 @@ +var x = 42; +{ x += 1; say x }.fork.wait; # x is 43 here +say x; # but here is still 42 diff --git a/Task/Fork/Wart/fork.wart b/Task/Fork/Wart/fork.wart new file mode 100644 index 0000000000..1fc9d3dc07 --- /dev/null +++ b/Task/Fork/Wart/fork.wart @@ -0,0 +1,3 @@ +do (fork sleep.1 + prn.1) + prn.2 diff --git a/Task/Formal-power-series/EchoLisp/formal-power-series-1.echolisp b/Task/Formal-power-series/EchoLisp/formal-power-series-1.echolisp new file mode 100644 index 0000000000..91521dcbec --- /dev/null +++ b/Task/Formal-power-series/EchoLisp/formal-power-series-1.echolisp @@ -0,0 +1,47 @@ +(require 'math) +;; converts a finite polynomial (a_0 a_1 .. a_n) to an infinite serie (a_0 ..a_n 0 0 0 ...) +(define (poly->stream list) + (make-stream (lambda(n) (cons (if (< n (length list)) (list-ref list n) 0) (1+ n))) 0)) + +;; c = a + b , c_n = a_n + b_n +(define (s-add a b) + (make-stream (lambda (n) (cons (+ (stream-ref a n) (stream-ref b n)) (1+ n))) 0)) + +;; c = a * b , c_n = ∑ (0 ..n) a_i * b_n-i +(define (s-mul-coeff n a b) (sigma (lambda(i) (* (stream-ref a i)(stream-ref b (- n i)))) 0 n)) + +(define (s-mul a b) + (make-stream (lambda(n) (cons (s-mul-coeff n a b) (1+ n))) 0)) + +;; b = 1/a ; b_0 = 1/a_0, b_n = - ∑ (1..n) a_i * b_n-i / a_0 +(define (s-inv-coeff n a b) + (if (zero? n) (/ (stream-ref a 0)) + (- (/ (sigma (lambda(i) (* (stream-ref a i)(stream-ref b (- n i)))) 1 n) + (stream-ref a 0))))) + +;; note the self keyword which refers to b = (s-inv a) +(define (s-inv a) + (make-stream (lambda(n) (cons (s-inv-coeff n a self ) (1+ n))) 0)) + +;; b = (s-k-add k a) = k + a_0, a_1, a_2, ... +(define (s-k-add k a) + (make-stream (lambda(n) (cons + (if(zero? n) (+ k (stream-ref a 0)) (stream-ref a n)) (1+ n))) 0)) + +;; b = (s-neg a) = -a_0,-a_1, .... +(define (s-neg a) + (make-stream (lambda(n) (cons (- (stream-ref a n)) (1+ n))) 0)) + +;; b = (s-int a) = ∫ a ; b_0 = 0 by convention, b_n = a_n-1/n +(define (s-int a) + (make-stream (lambda(n) (cons (if (zero? n) 0 (/ (stream-ref a (1- n)) n)) (1+ n))) 0)) + +;; value of power serie at x, n terms +(define (s-value a x (n 20)) + (poly x (take a n))) + +;; stream-cons allows mutual delayed references +;; sin = ∫ cos +(define sin-x (stream-cons 0 (stream-rest (s-int cos-x)))) +;; cos = 1 - ∫ sin +(define cos-x (stream-cons 1 (stream-rest (s-k-add 1 (s-neg (s-int sin-x)))))) diff --git a/Task/Formal-power-series/EchoLisp/formal-power-series-2.echolisp b/Task/Formal-power-series/EchoLisp/formal-power-series-2.echolisp new file mode 100644 index 0000000000..16cf13d873 --- /dev/null +++ b/Task/Formal-power-series/EchoLisp/formal-power-series-2.echolisp @@ -0,0 +1,21 @@ +(take cos-x 16) + → (1 0 -1/2 0 1/24 0 -1/720 0 1/40320 0 -1/3628800 0 1/479001600 0 -1.1470745597729725e-11 0) +(take sin-x 16) + → (0 1 0 -1/6 0 1/120 0 -1/5040 0 1/362880 0 -1/39916800 0 1.6059043836821613e-10 0 -7.647163731819816e-13) + +;; compute (cos PI) +(s-value cos-x PI) + → -1.0000000035290808 + +;; check that 1 / (1 - x) = 1 + x + x^1 + x^2 + ... +(define fps-1 (poly->stream '( 1 -1))) +(take fps-1 13) + → (1 -1 0 0 0 0 0 0 0 0 0 0 0) + +(define inv-fps-1 (s-inv fps-1)) +(take inv-fps-1 13) + → (1 1 1 1 1 1 1 1 1 1 1 1 1) +(s-value inv-fps-1 0.5) ;; check that 1 / (1 - 0.5) = 2 + → 1.9999980926513672 +(s-value inv-fps-1 0.5 100) ;; 100 terms + → 2 diff --git a/Task/Formal-power-series/jq/formal-power-series-1.jq b/Task/Formal-power-series/jq/formal-power-series-1.jq new file mode 100644 index 0000000000..4506751cf6 --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-1.jq @@ -0,0 +1 @@ +1/(1+.) diff --git a/Task/Formal-power-series/jq/formal-power-series-10.jq b/Task/Formal-power-series/jq/formal-power-series-10.jq new file mode 100644 index 0000000000..058733b698 --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-10.jq @@ -0,0 +1 @@ +def poly(ary): ary[.] // 0; diff --git a/Task/Formal-power-series/jq/formal-power-series-11.jq b/Task/Formal-power-series/jq/formal-power-series-11.jq new file mode 100644 index 0000000000..aa715aefbd --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-11.jq @@ -0,0 +1 @@ +(poly([1,2,3]) + poly([-1,-2,-3])) diff --git a/Task/Formal-power-series/jq/formal-power-series-12.jq b/Task/Formal-power-series/jq/formal-power-series-12.jq new file mode 100644 index 0000000000..2ce57aa2d8 --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-12.jq @@ -0,0 +1,13 @@ +# Multiply two power series, s and t: +def M(s;t): + . as $i | reduce range(0; 1+$i) as $k + (0; . + ($k|s) * (($i - $k)|t)); + +# Derivative of the power series, s: +def D(s): (. + 1) as $i | $i * ($i|s); + +# Integral of the power series, s, +# with an integration constant equal to 0: +def I(s): + . as $i + | if $i == 0 then 0 else (($i-1)|s) /$i end; diff --git a/Task/Formal-power-series/jq/formal-power-series-13.jq b/Task/Formal-power-series/jq/formal-power-series-13.jq new file mode 100644 index 0000000000..bbd51f8a92 --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-13.jq @@ -0,0 +1,7 @@ +def ps_equal(s; t; k; eps): + def abs: if . < 0 then -. else . end; + reduce range(0;k) as $i + (true; + if . then ((($i|s) - ($i|t))|abs) <= eps + else . + end); diff --git a/Task/Formal-power-series/jq/formal-power-series-14.jq b/Task/Formal-power-series/jq/formal-power-series-14.jq new file mode 100644 index 0000000000..938a42b2d3 --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-14.jq @@ -0,0 +1,44 @@ +# evaluate p(x) based on the first k terms of polynomial p, where x is the input +def ps_eval(p; k): + . as $x + | reduce range(0;k) as $i + # state: [sum, x^i] + ([0, 1]; + .[1] as $xn + | ($i|p) as $coeff + | [ .[0] + $coeff * $xn, $x * $xn]) + | .[0]; + +# If |x| < 1 then ps_evaluate(x) will evaluate to p(x) with high precision +# if the coefficients of the polynomial are eventually bounded. +# +# WARNING: ps_evaluate(p) will not detect divergence and is not intended to +# produce accurate results unless the terms of p(x) are reasonably well-behaved. +# For |x| > 1, the result will be null if x^n overflows before convergence is achieved. +# +def ps_evaluate(p): + def abs: if . < 0 then -. else . end; + def eval(p;x): + # state: [i, x^i, sum of i terms, delta, prevdelta] + recurse( + .[0] as $i + | .[1] as $xi + | .[2] as $sum + | .[3] as $delta + | .[4] as $prevdelta + | if $delta < 1e-17 and $prevdelta < 1e-17 + and ( $xi < 1e-100 + or ( $sum != 0 and + (($delta/$sum) | abs) < 1e-10 and + (($prevdelta/$sum) | abs) < 1e-10) ) + then empty + else + ($xi * ($i|p)) as $newdelta + | [ $i + 1, + x*$xi, + $sum+$newdelta, + ($newdelta|abs), $delta] + end ) ; + . as $x + | [0, 1, 0, 1, 1] + | reduce eval(p; $x) as $vector (0; $vector[2]); diff --git a/Task/Formal-power-series/jq/formal-power-series-15.jq b/Task/Formal-power-series/jq/formal-power-series-15.jq new file mode 100644 index 0000000000..175e11b8ff --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-15.jq @@ -0,0 +1,11 @@ +# Utility functions: + +def abs: if . < 0 then -. else . end; + +# The power series whose only non-zero coefficient is 1 at x^i: +def ps_at(i): if . == i then 1 else 0 end; + +# Create an array consisting of the first . coefficients of the power series, p: +def ps_to_array(p): . as $in | reduce range(0;$in) as $i ([]; . + [$i|p]); + +def pi: 4 * (1|atan); diff --git a/Task/Formal-power-series/jq/formal-power-series-16.jq b/Task/Formal-power-series/jq/formal-power-series-16.jq new file mode 100644 index 0000000000..c852e9ae19 --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-16.jq @@ -0,0 +1,9 @@ +# Verify that the first 100 terms of I(cos) and of sin are the same: + +ps_equal( I(ps_cos); ps_sin; 100; 1e-15) +# => true + +# Verify that the two power series agree when evaluated at pi: + +((pi | ps_evaluate(I(ps_cos))) - (pi | ps_evaluate(ps_sin))) | abs < 1e-15 +# => true diff --git a/Task/Formal-power-series/jq/formal-power-series-17.jq b/Task/Formal-power-series/jq/formal-power-series-17.jq new file mode 100644 index 0000000000..71cf573376 --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-17.jq @@ -0,0 +1,9 @@ +# Verify that the first 100 terms of cos and (1 - I(sin)) are the same: + +ps_equal( ps_cos; ps_at(0) - I(ps_sin); 100; 1e-5) +# => true + +# Verify that the two power series agree at pi: + +((pi | ps_evaluate(ps_cos)) - (pi | ps_evaluate(ps_at(0) - I(ps_sin)))) | abs < 1e-15 +# => true diff --git a/Task/Formal-power-series/jq/formal-power-series-2.jq b/Task/Formal-power-series/jq/formal-power-series-2.jq new file mode 100644 index 0000000000..b121ef6824 --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-2.jq @@ -0,0 +1 @@ +1/factorial diff --git a/Task/Formal-power-series/jq/formal-power-series-3.jq b/Task/Formal-power-series/jq/formal-power-series-3.jq new file mode 100644 index 0000000000..2d08d8767d --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-3.jq @@ -0,0 +1,3 @@ +def factorial: + reduce range(1; . + 1) as $i + (1; . * $i); diff --git a/Task/Formal-power-series/jq/formal-power-series-4.jq b/Task/Formal-power-series/jq/formal-power-series-4.jq new file mode 100644 index 0000000000..e24f21a138 --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-4.jq @@ -0,0 +1 @@ +def ps_exp: 1/factorial; diff --git a/Task/Formal-power-series/jq/formal-power-series-5.jq b/Task/Formal-power-series/jq/formal-power-series-5.jq new file mode 100644 index 0000000000..9fe1b5d619 --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-5.jq @@ -0,0 +1 @@ +1 | ps_evaluate(ps_exp) diff --git a/Task/Formal-power-series/jq/formal-power-series-6.jq b/Task/Formal-power-series/jq/formal-power-series-6.jq new file mode 100644 index 0000000000..3ea5f621fe --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-6.jq @@ -0,0 +1 @@ +1 | ps_evaluate(1/factorial) diff --git a/Task/Formal-power-series/jq/formal-power-series-7.jq b/Task/Formal-power-series/jq/formal-power-series-7.jq new file mode 100644 index 0000000000..22f4188885 --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-7.jq @@ -0,0 +1,3 @@ +def pow(n): + . as $x | n as $n + | reduce range(0;$n) as $i (1; . * $x); diff --git a/Task/Formal-power-series/jq/formal-power-series-8.jq b/Task/Formal-power-series/jq/formal-power-series-8.jq new file mode 100644 index 0000000000..9d571dd70b --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-8.jq @@ -0,0 +1 @@ +1/pow(.) diff --git a/Task/Formal-power-series/jq/formal-power-series-9.jq b/Task/Formal-power-series/jq/formal-power-series-9.jq new file mode 100644 index 0000000000..74bf731cfd --- /dev/null +++ b/Task/Formal-power-series/jq/formal-power-series-9.jq @@ -0,0 +1,4 @@ +# ln(1+x) = x - x^2 / 2 + ... +def ln_1px: + def c: if . % 2 == 0 then -1 else 1 end; + . as $i | if $i == 0 then 0 else ($i|c) / $i end; diff --git a/Task/Formatted-numeric-output/8th/formatted-numeric-output.8th b/Task/Formatted-numeric-output/8th/formatted-numeric-output.8th new file mode 100644 index 0000000000..910134b669 --- /dev/null +++ b/Task/Formatted-numeric-output/8th/formatted-numeric-output.8th @@ -0,0 +1,2 @@ +7.125 "%09.3f" s:strfmt +. cr diff --git a/Task/Formatted-numeric-output/ERRE/formatted-numeric-output.erre b/Task/Formatted-numeric-output/ERRE/formatted-numeric-output.erre new file mode 100644 index 0000000000..e39d2beb1b --- /dev/null +++ b/Task/Formatted-numeric-output/ERRE/formatted-numeric-output.erre @@ -0,0 +1,41 @@ +PROGRAM FORMATTED + +PROCEDURE FORMATTED_PRINT(N,LENGTH,DEC_PLACES->FP$) + + LOCAL I,C$,NN$ + + FORMAT$=STRING$(LENGTH,"#")+"." + + FOR I=1 TO DEC_PLACES DO + FORMAT$=FORMAT$+"#" + END FOR + + OPEN("O",1,"FORMAT.$$$") + WRITE(#1,FORMAT$;N) + CLOSE(1) + + OPEN("I",1,"FORMAT.$$$") + INPUT(LINE,#1,N$) + CLOSE(1) + + ! add leading zeros + FOR I=1 TO LEN(N$) DO + C$=MID$(N$,I,1) + IF C$=" " OR C$="%" THEN NN$=NN$+"0" ELSE NN$=NN$+C$ + END FOR + + FP$=RIGHT$("000000000000"+NN$,LENGTH) ! chop to required length + +END PROCEDURE + +BEGIN + + PRINT(CHR$(12);) ! CLS + + FOR I=1 TO 10 DO + N=RND(1)*10^(INT(10*RND(1))-2) + FORMATTED_PRINT(N,16,5->FP$) + PRINT("Raw number =";N;TAB(30);"Using custom function =";FP$) + END FOR + +END PROGRAM diff --git a/Task/Formatted-numeric-output/FreeBASIC/formatted-numeric-output.freebasic b/Task/Formatted-numeric-output/FreeBASIC/formatted-numeric-output.freebasic new file mode 100644 index 0000000000..924fa8644e --- /dev/null +++ b/Task/Formatted-numeric-output/FreeBASIC/formatted-numeric-output.freebasic @@ -0,0 +1,7 @@ +' FB 1.05.0 Win64 + +#Include "vbcompat.bi" + +Dim s As String = Format(7.125, "00000.0##") +Print s +Sleep diff --git a/Task/Formatted-numeric-output/FutureBasic/formatted-numeric-output.futurebasic b/Task/Formatted-numeric-output/FutureBasic/formatted-numeric-output.futurebasic new file mode 100644 index 0000000000..35032b194d --- /dev/null +++ b/Task/Formatted-numeric-output/FutureBasic/formatted-numeric-output.futurebasic @@ -0,0 +1,3 @@ +include "ConsoleWindow" + +print using "0000#.###"; 7.125 diff --git a/Task/Formatted-numeric-output/Lasso/formatted-numeric-output.lasso b/Task/Formatted-numeric-output/Lasso/formatted-numeric-output.lasso new file mode 100644 index 0000000000..c4c7a2d351 --- /dev/null +++ b/Task/Formatted-numeric-output/Lasso/formatted-numeric-output.lasso @@ -0,0 +1 @@ +7.125 -> asstring(-precision = 3, -padding = 9, -padchar = '0') diff --git a/Task/Formatted-numeric-output/Nim/formatted-numeric-output.nim b/Task/Formatted-numeric-output/Nim/formatted-numeric-output.nim new file mode 100644 index 0000000000..5ecf6076ff --- /dev/null +++ b/Task/Formatted-numeric-output/Nim/formatted-numeric-output.nim @@ -0,0 +1,7 @@ +import strfmt +const r = 7.125 +echo r +echo((-r).format("9.3f")) +echo(r.format("9.3f")) +echo((-r).format("09.3f")) +echo(r.format("09.3f")) diff --git a/Task/Formatted-numeric-output/Phix/formatted-numeric-output.phix b/Task/Formatted-numeric-output/Phix/formatted-numeric-output.phix new file mode 100644 index 0000000000..65724fec69 --- /dev/null +++ b/Task/Formatted-numeric-output/Phix/formatted-numeric-output.phix @@ -0,0 +1 @@ +printf(1,"%09.3f\n",7.125) diff --git a/Task/Formatted-numeric-output/Ring/formatted-numeric-output.ring b/Task/Formatted-numeric-output/Ring/formatted-numeric-output.ring new file mode 100644 index 0000000000..bc5e420ad7 --- /dev/null +++ b/Task/Formatted-numeric-output/Ring/formatted-numeric-output.ring @@ -0,0 +1,8 @@ +decimals(3) +see fixedprint(7.125, 5) + nl + +func fixedprint num, digs + for i = 1 to digs - len(string(floor(num))) + see "0" + next + see num + nl diff --git a/Task/Formatted-numeric-output/Sidef/formatted-numeric-output-1.sidef b/Task/Formatted-numeric-output/Sidef/formatted-numeric-output-1.sidef new file mode 100644 index 0000000000..3ccf253e0e --- /dev/null +++ b/Task/Formatted-numeric-output/Sidef/formatted-numeric-output-1.sidef @@ -0,0 +1 @@ +printf("%09.3f\n", 7.125); diff --git a/Task/Formatted-numeric-output/Sidef/formatted-numeric-output-2.sidef b/Task/Formatted-numeric-output/Sidef/formatted-numeric-output-2.sidef new file mode 100644 index 0000000000..ccd8ce0c17 --- /dev/null +++ b/Task/Formatted-numeric-output/Sidef/formatted-numeric-output-2.sidef @@ -0,0 +1 @@ +say ("%09.3f" % 7.125); diff --git a/Task/Formatted-numeric-output/jq/formatted-numeric-output-1.jq b/Task/Formatted-numeric-output/jq/formatted-numeric-output-1.jq new file mode 100644 index 0000000000..673c952b0c --- /dev/null +++ b/Task/Formatted-numeric-output/jq/formatted-numeric-output-1.jq @@ -0,0 +1,15 @@ +def pp0(width): + tostring + | if width > length then (width - length) * "0" + . else . end; + +# pp(left; right) formats a decimal number to occupy +# (left+right+1) positions if possible, +# where "left" is the number of characters to the left of +# the decimal point, and similarly for "right". +def pp(left; right): + def lpad: if (left > length) then ((left - length) * "0") + . else . end; + tostring as $s + | $s + | index(".") as $ix + | ((if $ix then $s[0:$ix] else $s end) | lpad) + "." + + (if $ix then $s[$ix+1:] | .[0:right] else "" end); diff --git a/Task/Formatted-numeric-output/jq/formatted-numeric-output-2.jq b/Task/Formatted-numeric-output/jq/formatted-numeric-output-2.jq new file mode 100644 index 0000000000..d3a3347fb9 --- /dev/null +++ b/Task/Formatted-numeric-output/jq/formatted-numeric-output-2.jq @@ -0,0 +1 @@ +(1.0, 12.3, 333.333, 1e6) | pp0(10) diff --git a/Task/Formatted-numeric-output/jq/formatted-numeric-output-3.jq b/Task/Formatted-numeric-output/jq/formatted-numeric-output-3.jq new file mode 100644 index 0000000000..a0253633d0 --- /dev/null +++ b/Task/Formatted-numeric-output/jq/formatted-numeric-output-3.jq @@ -0,0 +1,4 @@ +0000000001 +00000012.3 +000333.333 +0001000000 diff --git a/Task/Formatted-numeric-output/jq/formatted-numeric-output-4.jq b/Task/Formatted-numeric-output/jq/formatted-numeric-output-4.jq new file mode 100644 index 0000000000..716f2dee2c --- /dev/null +++ b/Task/Formatted-numeric-output/jq/formatted-numeric-output-4.jq @@ -0,0 +1 @@ +(1.0, 12.3, 333.333, 1e6) | pp(4;2) diff --git a/Task/Formatted-numeric-output/jq/formatted-numeric-output-5.jq b/Task/Formatted-numeric-output/jq/formatted-numeric-output-5.jq new file mode 100644 index 0000000000..df142fb18b --- /dev/null +++ b/Task/Formatted-numeric-output/jq/formatted-numeric-output-5.jq @@ -0,0 +1,4 @@ +0001. +0012.3 +0333.33 +1000000. diff --git a/Task/Forward-difference/EchoLisp/forward-difference.echolisp b/Task/Forward-difference/EchoLisp/forward-difference.echolisp new file mode 100644 index 0000000000..c539a2f5a6 --- /dev/null +++ b/Task/Forward-difference/EchoLisp/forward-difference.echolisp @@ -0,0 +1,7 @@ +(define (Δ-1 list) +(for/list ([x (cdr list)] [y list]) (- x y))) + +(define (Δ-n n) (iterate Δ-1 n)) + +((Δ-n 9) '(90 47 58 29 22 32 55 5 55 73)) + → (-2921) diff --git a/Task/Forward-difference/Lasso/forward-difference.lasso b/Task/Forward-difference/Lasso/forward-difference.lasso new file mode 100644 index 0000000000..159cb475b0 --- /dev/null +++ b/Task/Forward-difference/Lasso/forward-difference.lasso @@ -0,0 +1,16 @@ +#!/usr/bin/lasso9 + +define forwardDiff(values, order::integer=1) => { + !#order ? return #values->asArray + local(result = array) + iterate(#values) => { + loop_count < #values->size ? + #result->insert(#values->get(loop_count+1) - #values->get(loop_count)) + } + #order > 1 ? #result = forwardDiff(#result, #order-1) + return #result +} + +local(data = (:90, 47, 58, 29, 22, 32, 55, 5, 55, 73)) +with x in generateSeries(0, #data->size-1) +do stdoutnl(#x + ': ' + forwardDiff(#data, #x)) diff --git a/Task/Forward-difference/Nim/forward-difference.nim b/Task/Forward-difference/Nim/forward-difference.nim new file mode 100644 index 0000000000..4032baa503 --- /dev/null +++ b/Task/Forward-difference/Nim/forward-difference.nim @@ -0,0 +1,13 @@ +proc dif(s): seq[int] = + result = newSeq[int](s.len-1) + for i, x in s[1..s.high]: + result[i] = x - s[i] + +proc difn(s, n): seq[int] = + if n > 0: difn(dif(s), n-1) + else: s + +const s = @[90, 47, 58, 29, 22, 32, 55, 5, 55, 73] +echo difn(s, 0) +echo difn(s, 1) +echo difn(s, 2) diff --git a/Task/Forward-difference/Oforth/forward-difference.oforth b/Task/Forward-difference/Oforth/forward-difference.oforth new file mode 100644 index 0000000000..5cfae7b1be --- /dev/null +++ b/Task/Forward-difference/Oforth/forward-difference.oforth @@ -0,0 +1,2 @@ +: forwardDiff(l) l right(l size 1 -) l zipWith(#-) ; +: forwardDiffN(n, l) l #[ forwardDiff dup println ] times(n) ; diff --git a/Task/Forward-difference/Sidef/forward-difference.sidef b/Task/Forward-difference/Sidef/forward-difference.sidef new file mode 100644 index 0000000000..5850872e23 --- /dev/null +++ b/Task/Forward-difference/Sidef/forward-difference.sidef @@ -0,0 +1,15 @@ +func dif(arr) { + gather { + range(0, arr.end-1).each { |i| + take(arr[i+1] - arr[i]); + } + } +} + +func difn(n, arr) { + n.times { arr = dif(arr) }; + arr; +} + +say dif([1, 23, 45, 678]); # => [22, 22, 633] +say difn(2, [1, 23, 45, 678]); # => [0, 611] diff --git a/Task/Forward-difference/Visual-FoxPro/forward-difference.visual b/Task/Forward-difference/Visual-FoxPro/forward-difference.visual new file mode 100644 index 0000000000..3de480a651 --- /dev/null +++ b/Task/Forward-difference/Visual-FoxPro/forward-difference.visual @@ -0,0 +1,37 @@ +#DEFINE CTAB CHR(9) +LOCAL lcList As String, i As Integer, n As Integer +n = 10 +LOCAL ARRAY aa[n] +CLEAR +lcList = "90,47,58,29,22,32,55,5,55,73" +FOR i = 1 TO n + aa[i] = VAL(GETWORDNUM(lcList, i, ",")) +ENDFOR +ShowOutput("Original", @aa) +k = n - 1 +FOR i = 1 TO n - 1 + ForwardDiff(@aa) + ShowOutput("Difference " + TRANSFORM(i), @aa) +ENDFOR + +PROCEDURE ForwardDiff(a) +LOCAL i As Integer, n As Integer +n = ALEN(a) +LOCAL ARRAY b[n-1] +FOR i = 1 TO n - 1 + b[i] = a[i+1] - a[i] +ENDFOR +DIMENSION a[n-1] +ACOPY(b, a) +ENDPROC + +PROCEDURE ShowOutput(lcLabel, zz) +LOCAL i As Integer, n As Integer, lcTxt As String +n = ALEN(zz) +lcTxt = lcLabel + ":" + CTAB +FOR i = 1 TO n + lcTxt = lcTxt + TRANSFORM(zz[i]) + CTAB +ENDFOR +lcTxt = LEFT(lcTxt, LEN(lcTxt) - 1) +? lcTxt +ENDPROC diff --git a/Task/Forward-difference/jq/forward-difference-1.jq b/Task/Forward-difference/jq/forward-difference-1.jq new file mode 100644 index 0000000000..b45121c3c8 --- /dev/null +++ b/Task/Forward-difference/jq/forward-difference-1.jq @@ -0,0 +1,8 @@ +# If n is a non-negative number and if input is +# a (possibly empty) array of numbers, +# emit an array, even if the input list is too short: +def ndiff(n): + if n==0 then . + elif n == 1 then . as $in | [range(1;length) | $in[.] - $in[.-1]] + else ndiff(1) | ndiff(n-1) + end; diff --git a/Task/Forward-difference/jq/forward-difference-2.jq b/Task/Forward-difference/jq/forward-difference-2.jq new file mode 100644 index 0000000000..8ab646bf88 --- /dev/null +++ b/Task/Forward-difference/jq/forward-difference-2.jq @@ -0,0 +1,3 @@ +def s: [90, 47, 58, 29, 22, 32, 55, 5, 55, 73]; + +range(0;12) as $i | (s|ndiff($i)) diff --git a/Task/Forward-difference/jq/forward-difference-3.jq b/Task/Forward-difference/jq/forward-difference-3.jq new file mode 100644 index 0000000000..c10a8173cf --- /dev/null +++ b/Task/Forward-difference/jq/forward-difference-3.jq @@ -0,0 +1,13 @@ +$ jq -c -n -f forward-difference.jq +[90,47,58,29,22,32,55,5,55,73] +[-43,11,-29,-7,10,23,-50,50,18] +[54,-40,22,17,13,-73,100,-32] +[-94,62,-5,-4,-86,173,-132] +[156,-67,1,-82,259,-305] +[-223,68,-83,341,-564] +[291,-151,424,-905] +[-442,575,-1329] +[1017,-1904] +[-2921] +[] +[] diff --git a/Task/Four-bit-adder/Nim/four-bit-adder.nim b/Task/Four-bit-adder/Nim/four-bit-adder.nim new file mode 100644 index 0000000000..c402dac3c4 --- /dev/null +++ b/Task/Four-bit-adder/Nim/four-bit-adder.nim @@ -0,0 +1,29 @@ +proc ha(a, b): auto = [a xor b, a and b] # sum, carry + +proc fa(a, b, ci): auto = + let a = ha(ci, a) + let b = ha(a[0], b) + [b[0], a[1] or b[1]] # sum, carry + +proc fa4(a,b): array[5, bool] = + var co,s: array[4, bool] + for i in 0..3: + let r = fa(a[i], b[i], if i > 0: co[i-1] else: false) + s[i] = r[0] + co[i] = r[1] + result[0..3] = s + result[4] = co[3] + +proc int2bus(n): array[4, bool] = + var n = n + for i in 0..result.high: + result[i] = (n and 1) == 1 + n = n shr 1 + +proc bus2int(b): int = + for i,x in b: + result += (if x: 1 else: 0) shl i + +for a in 0..7: + for b in 0..7: + assert a + b == bus2int fa4(int2bus(a), int2bus(b)) diff --git a/Task/Four-bit-adder/Sidef/four-bit-adder.sidef b/Task/Four-bit-adder/Sidef/four-bit-adder.sidef new file mode 100644 index 0000000000..c3045314e4 --- /dev/null +++ b/Task/Four-bit-adder/Sidef/four-bit-adder.sidef @@ -0,0 +1,31 @@ +func bxor(a, b) { + (~a & b) | (a & ~b) +} + +func half_adder(a, b) { + return (bxor(a, b), a & b) +} + +func full_adder(a, b, c) { + var (s1, c1) = half_adder(a, c) + var (s2, c2) = half_adder(s1, b) + return (s2, c1 | c2) +} + +func four_bit_adder(a, b) { + var (s0, c0) = full_adder(a[0], b[0], 0) + var (s1, c1) = full_adder(a[1], b[1], c0) + var (s2, c2) = full_adder(a[2], b[2], c1) + var (s3, c3) = full_adder(a[3], b[3], c2) + return ([s3,s2,s1,s0].join, c3.to_s) +} + +say " A B A B C S sum" +for a in ^16 { + for b in ^16 { + var(abin, bbin) = [a,b].map{|n| "%04b"%n->chars.reverse.map{.to_i} }... + var(s, c) = four_bit_adder(abin, bbin) + printf("%2d + %2d = %s + %s = %s %s = %2d\n", + a, b, abin.join, bbin.join, c, s, "#{c}#{s}".bin) + } +} diff --git a/Task/Four-bit-adder/jq/four-bit-adder-1.jq b/Task/Four-bit-adder/jq/four-bit-adder-1.jq new file mode 100644 index 0000000000..694244a1d0 --- /dev/null +++ b/Task/Four-bit-adder/jq/four-bit-adder-1.jq @@ -0,0 +1,42 @@ +# Start with the 'not' and 'and' building blocks. +# These allow us to construct 'nand', 'or', and 'xor', +# and so on. + +def bit_not: if . == 1 then 0 else 1 end; + +def bit_and(a; b): if a == 1 and b == 1 then 1 else 0 end; + +def bit_nand(a; b): bit_and(a; b) | bit_not; + +def bit_or(a; b): bit_nand(bit_nand(a;a); bit_nand(b;b)); + +def bit_xor(a; b): + bit_nand(bit_nand(bit_nand(a;b); a); + bit_nand(bit_nand(a;b); b)); + +def halfAdder(a; b): + { "carry": bit_and(a; b), "sum": bit_xor(a; b) }; + +def fullAdder(a; b; c): + halfAdder(a; b) as $h0 + | halfAdder($h0.sum; c) as $h1 + | {"carry": bit_or($h0.carry; $h1.carry), "sum": $h1.sum }; + +# a and b should be strings of 0s and 1s, of length no greater than 4 +def fourBitAdder(a; b): + + # pad on the left with 0s, and convert the string + # representation ("101") to an array of integers ([1,0,1]). + def pad: (4-length) * "0" + . | explode | map(. - 48); + + (a|pad) as $inA | (b|pad) as $inB + | [][3] = null # an array for storing the four results + | halfAdder($inA[3]; $inB[3]) as $pass + | .[3] = $pass.sum # store the lsb + | fullAdder($inA[2]; $inB[2]; $pass.carry) as $pass + | .[2] = $pass.sum + | fullAdder($inA[1]; $inB[1]; $pass.carry) as $pass + | .[1] = $pass.sum + | fullAdder($inA[0]; $inB[0]; $pass.carry) as $pass + | .[0] = $pass.sum + | map(tostring) | join("") ; diff --git a/Task/Four-bit-adder/jq/four-bit-adder-2.jq b/Task/Four-bit-adder/jq/four-bit-adder-2.jq new file mode 100644 index 0000000000..33dd853e3b --- /dev/null +++ b/Task/Four-bit-adder/jq/four-bit-adder-2.jq @@ -0,0 +1 @@ +fourBitAdder("0111"; "0001") diff --git a/Task/Fractal-tree/Lingo/fractal-tree-1.lingo b/Task/Fractal-tree/Lingo/fractal-tree-1.lingo new file mode 100644 index 0000000000..b80de5fde3 --- /dev/null +++ b/Task/Fractal-tree/Lingo/fractal-tree-1.lingo @@ -0,0 +1,27 @@ +---------------------------------------- +-- Creates an image of a fractal tree +-- @param {integer} width +-- @param {integer} height +-- @param {integer} fractalDepth +-- @param {integer|float} initSize +-- @param {float} spreadAngle +-- @param {float} [scaleFactor=1.0] +-- @return {image} +---------------------------------------- +on fractalTree (width, height, fractalDepth, initSize, spreadAngle, scaleFactor) + if voidP(scaleFactor) then scaleFactor = 1.0 + img = image(width, height, 24) + img.fill(img.rect, rgb(0,0,0)) + _drawTree(img, width/2, height, -PI/2, fractalDepth, initSize, spreadAngle, scaleFactor) + return img +end + +on _drawTree (img, x1, y1, angle, depth, size, spreadAngle, scaleFactor) + if (depth) then + x2 = x1 + cos(angle)*depth*size + y2 = y1 + sin(angle)*depth*size + img.draw(x1, y1, x2, y2, [#color:rgb(255,255,255)]) + _drawTree(img, x2, y2, angle-spreadAngle, depth-1, size*ScaleFactor, spreadAngle, scaleFactor) + _drawTree(img, x2, y2, angle+spreadAngle, depth-1, size*ScaleFactor, spreadAngle, scaleFactor) + end if +end diff --git a/Task/Fractal-tree/Lingo/fractal-tree-2.lingo b/Task/Fractal-tree/Lingo/fractal-tree-2.lingo new file mode 100644 index 0000000000..02042d4d69 --- /dev/null +++ b/Task/Fractal-tree/Lingo/fractal-tree-2.lingo @@ -0,0 +1,5 @@ +fractalDepth = 10 +initSize = 7.0 +spreadAngle = 35*PI/180 +scaleFactor = 0.95 +img = fractalTree(480, 380, fractalDepth, initSize, spreadAngle, scaleFactor) diff --git a/Task/Fractal-tree/Phix/fractal-tree.phix b/Task/Fractal-tree/Phix/fractal-tree.phix new file mode 100644 index 0000000000..bdb24c7102 --- /dev/null +++ b/Task/Fractal-tree/Phix/fractal-tree.phix @@ -0,0 +1,57 @@ +include ..\pGUI\pGUI.e + +Ihandle dlg, canvas +cdCanvas cddbuffer, cdcanvas + +procedure drawTree(integer level, atom angle, atom len, integer x, integer y) +integer xn = x + floor(len*cos(angle)) +integer yn = y + floor(len*sin(angle)) +integer red = 255-level*8 +integer grn = level*12+100 + cdCanvasSetForeground(cddbuffer, red*#10000 + grn*#100) + cdCanvasLineWidth(cddbuffer,floor(5-level/3)) + cdCanvasLine(cddbuffer, x, 480-y, xn, 480-yn) + if level<12 then + drawTree(level+1, angle-0.4, len*0.8, xn, yn) --left + drawTree(level+1, angle+0.1, len*0.8, xn, yn) --right + end if +end procedure + +function redraw_cb(Ihandle /*ih*/, integer /*posx*/, integer /*posy*/) + cdCanvasActivate(cddbuffer) + cdCanvasClear(cddbuffer) + drawTree(0, -PI/2.0, 80.0, 360, 460) + cdCanvasFlush(cddbuffer) + return IUP_DEFAULT +end function + +function map_cb(Ihandle ih) + cdcanvas = cdCreateCanvas(CD_IUP, ih) + cddbuffer = cdCreateCanvas(CD_DBUFFER, cdcanvas) + cdCanvasSetBackground(cddbuffer, CD_PARCHMENT) + return IUP_DEFAULT +end function + +function esc_close(Ihandle /*ih*/, atom c) + if c=K_ESC then return IUP_CLOSE end if + return IUP_CONTINUE +end function + +procedure main() + IupOpen("..\\pGUI\\") + + canvas = IupCanvas(NULL) + IupSetAttribute(canvas, "RASTERSIZE", "640x480") + IupSetCallback(canvas, "MAP_CB", Icallback("map_cb")) + IupSetCallback(canvas, "ACTION", Icallback("redraw_cb")) + + dlg = IupDialog(canvas,"RESIZE=NO") + IupSetAttribute(dlg, "TITLE", "Fractal Tree") + IupSetCallback(dlg, "K_ANY", Icallback("esc_close")) + + IupShow(dlg) + IupMainLoop() + IupClose() +end procedure + +main() diff --git a/Task/Fractal-tree/Ring/fractal-tree.ring b/Task/Fractal-tree/Ring/fractal-tree.ring new file mode 100644 index 0000000000..a8f4337f63 --- /dev/null +++ b/Task/Fractal-tree/Ring/fractal-tree.ring @@ -0,0 +1,50 @@ +load "guilib.ring" + +new qapp + { + win1 = new qwidget() { + setwindowtitle("drawing using qpainter") + setgeometry(100,100,500,500) + label1 = new qlabel(win1) { + setgeometry(10,10,400,400) + settext("") + } + draw() + show() + } + exec() + } + +func draw + p1 = new qpicture() + color = new qcolor() { + setrgb(0,0,255,255) + } + pen = new qpen() { + setcolor(color) + setwidth(1) + } + new qpainter() { + begin(p1) + setpen(pen) + + sizex = 400 + sizey = 200 + depth = 10 + + tree(self, sizex, 0, sizey/2, 90, depth) + + endpaint() + } + label1 { setpicture(p1) show() } + + func tree myObj, x1, y1, size, angle, depth + myObj{ + scale = 0.76 + spread = 25 + x2 = x1 + size * cos(angle) + y2 = y1 + size * sin(angle) + drawline(x1, y1, x2, y2) + if depth > 0 + tree(self, x2, y2, size * scale, angle - spread, depth - 1) + tree(self, x2, y2, size * scale, angle + spread, depth - 1) ok} diff --git a/Task/Fractal-tree/Sidef/fractal-tree.sidef b/Task/Fractal-tree/Sidef/fractal-tree.sidef new file mode 100644 index 0000000000..3aaaccb533 --- /dev/null +++ b/Task/Fractal-tree/Sidef/fractal-tree.sidef @@ -0,0 +1,23 @@ +func tree(img, x, y, scale=6/10, len=400, angle=270) { + + len < 1 && return() + + img.moveTo(x, y) + img.angle(angle) + img.line(len) + + var (x1, y1) = img.curPos + tree(img, x1, y1, scale, len*scale, angle+35) + tree(img, x1, y1, scale, len*scale, angle-35) +} + +require('GD::Simple') + +var (width=1000, height=1000) +var img = %s|GD::Simple|.new(width, height) +img.fgcolor('black') +img.penSize(1, 1) + +tree(img, width/2, height) + +File('tree.png').write(img.png, :raw) diff --git a/Task/Fractal-tree/Swift/fractal-tree.swift b/Task/Fractal-tree/Swift/fractal-tree.swift new file mode 100644 index 0000000000..4dc57cc4ad --- /dev/null +++ b/Task/Fractal-tree/Swift/fractal-tree.swift @@ -0,0 +1,57 @@ +import UIKit + +extension CGFloat { + func degrees_to_radians() -> CGFloat { + return CGFloat(M_PI) * self / 180.0 + } +} + +extension Double { + func degrees_to_radians() -> Double { + return Double(M_PI) * self / 180.0 + } + +} + + +class Tree: UIView { + + + func drawTree(x1: CGFloat, y1: CGFloat, angle: CGFloat, depth:Int){ + if depth == 0 { + return + } + let ang = angle.degrees_to_radians() + let x2:CGFloat = x1 + ( cos(ang) as CGFloat) * CGFloat(depth) * (self.frame.width / 60) + let y2:CGFloat = y1 + ( sin(ang) as CGFloat) * CGFloat(depth) * (self.frame.width / 60) + + let line = drawLine(x1, y1: y1, x2: x2, y2: y2) + + line.stroke() + drawTree(x2, y1: y2, angle: angle - 20, depth: depth - 1) + drawTree(x2, y1: y2, angle: angle + 20, depth: depth - 1) + } + + func drawLine(x1:CGFloat, y1:CGFloat, x2:CGFloat, y2:CGFloat) -> UIBezierPath + { + + let path = UIBezierPath() + path.moveToPoint(CGPoint(x: x1,y: y1)) + path.addLineToPoint(CGPoint(x: x2,y: y2)) + path.lineWidth = 1 + return path + } + + override func drawRect(rect: CGRect) { + + let color = UIColor(red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0) + color.set() + drawTree(self.frame.width / 2 , y1: self.frame.height * 0.8, angle: -90 , depth: 9 ) + } + + +} + + +let tree = Tree(frame: CGRectMake(0, 0, 300, 300)) +tree diff --git a/Task/Fractal-tree/TypeScript/fractal-tree.type b/Task/Fractal-tree/TypeScript/fractal-tree.type new file mode 100644 index 0000000000..929333a435 --- /dev/null +++ b/Task/Fractal-tree/TypeScript/fractal-tree.type @@ -0,0 +1,35 @@ +// Set up canvas for drawing +var canvas: HTMLCanvasElement = document.createElement('canvas') +canvas.width = 600 +canvas.height = 500 +document.body.appendChild(canvas) +var ctx: CanvasRenderingContext2D = canvas.getContext('2d') +ctx.fillStyle = '#000' +ctx.lineWidth = 1 + +// constants +const degToRad: number = Math.PI / 180.0 +const totalDepth: number = 9 + +/** Helper function that draws a line on the canvas */ +function drawLine(x1: number, y1: number, x2: number, y2: number): void { + ctx.moveTo(x1, y1) + ctx.lineTo(x2, y2) +} + +/** Draws a branch at the given point and angle and then calls itself twice */ +function drawTree(x1: number, y1: number, angle: number, depth: number): void { + if (depth !== 0) { + let x2: number = x1 + (Math.cos(angle * degToRad) * depth * 10.0) + let y2: number = y1 + (Math.sin(angle * degToRad) * depth * 10.0) + drawLine(x1, y1, x2, y2) + drawTree(x2, y2, angle - 20, depth - 1) + drawTree(x2, y2, angle + 20, depth - 1) + } +} + +// actual drawing of tree +ctx.beginPath() +drawTree(300, 500, -90, totalDepth) +ctx.closePath() +ctx.stroke() diff --git a/Task/Fractal-tree/jq/fractal-tree.jq b/Task/Fractal-tree/jq/fractal-tree.jq new file mode 100644 index 0000000000..e7d4a40edb --- /dev/null +++ b/Task/Fractal-tree/jq/fractal-tree.jq @@ -0,0 +1,38 @@ +# width and height define the outer dimensions; +# len defines the trunk size; +# scale defines the branch length relative to the trunk; +def main(width; height; len; scale): + + def PI: (1|atan)*4; + + def precision(n): + def pow(k): . as $in | reduce range(0;k) as $i (1; .*$in); + if . < 0 then - (-. | precision(n)) + else + (10|pow(n)) as $power + | (. * 10 * $power) | floor as $x | ($x % 10) as $r + | ((if $r < 5 then $x else $x + 5 end) / 10 | floor) / $power + end; + + def p2: precision(2); + + def tree(x; y; len; angle): + if len < 1 then empty + else + (x + len * (angle|cos)) as $x2 + | (y + len * (angle|sin)) as $y2 + | (if len < 10 then 1 else 2 end) as $swidth + | (if len < 10 then "blue" else "black" end) as $stroke + | "", + tree($x2; $y2; len * scale; angle + PI / 5), + tree($x2; $y2; len * scale; angle - PI / 5) + end + ; + + "", + tree(width / 2; height; len; 3 * PI / 2), + "" +; + +main(1000; 1000; 400; 6/10) diff --git a/Task/Fractran/FreeBASIC/fractran.freebasic b/Task/Fractran/FreeBASIC/fractran.freebasic new file mode 100644 index 0000000000..945ef498a6 --- /dev/null +++ b/Task/Fractran/FreeBASIC/fractran.freebasic @@ -0,0 +1,90 @@ +' version 06-07-2015 +' compile with: fbc -s console +' uses gmp + +#Include Once "gmp.bi" + +' in case the two #define's are missing from 'gmp.bi' define them now +#Ifndef mpq_numref + #Define mpq_numref(Q) (@(Q)->_mp_num) + #Define mpq_denref(Q) (@(Q)->_mp_den) +#EndIf + +Dim As String prog(0 To ...) = {"17/91", "78/85", "19/51", "23/38", "29/33",_ +"77/29", "95/23", "77/19", "1/17", "11/13", "13/11", "15/14", "15/2", "55/1"} + +Dim As UInteger i, j, c, max = UBound(prog) +Dim As Integer scanbit + +Dim As ZString Ptr gmp_str : gmp_str = Allocate(10000) +Dim As Mpq_ptr in_, out_ +in_ = Allocate(Len(__mpq_struct)) : Mpq_init(in_) +out_ = Allocate(Len(__mpq_struct)) : Mpq_init(out_) +Dim As mpz_ptr num, den +num = Allocate(Len(__mpz_struct)) : Mpz_init(num) +den = Allocate(Len(__mpz_struct)) : Mpz_init(den) + +Dim As mpq_ptr instruction(max) +For i = 0 To max + instruction(i) = Allocate(Len(__mpq_struct)) + mpq_init(instruction(i)) + mpq_set_str(instruction(i), prog(i), 10 ) +Next + +mpq_set_str(in_ ,"2",10) +i = 0 : j = 0 +Print "2"; +Do + mpq_mul(out_, instruction(i), in_) + i = i + 1 + den = mpq_denref(out_) + If mpz_cmp_ui(den, 1) = 0 Then + Mpq_get_str(gmp_str, 10, out_) + Print ", ";*gmp_str; + mpq_swap(in_, out_) + i = 0 + j = j + 1 + End If +Loop Until j > 14 + +' this one only display if the integer is 2^p, p being prime +mpq_set_str(in_ ,"2",10) +i = 0 : j = 0 : c = 0 +Print : Print : Print +Print "count iterations prime 2^prime" + +Do + mpq_mul(out_, instruction(i), in_) + i = i + 1 + j = j + 1 + den = mpq_denref(out_) + If mpz_cmp_ui(den, 1) = 0 Then + num = mpq_numref(out_) + scanbit = mpz_scan1(num, 0) + ' if scanbit = 0 then number is odd + If scanbit > 0 Then + ' return from mpz_scan1(num, scanbit+1) is -1 for power of 2 + If mpz_scan1(num, scanbit +1) = -1 Then + If c <= 20 Then Mpq_get_str(gmp_str, 10, out_) Else *gmp_str = "" + c = c + 1 + Print Using "##### ################### ######## "; c; j; scanbit; + Print *gmp_str + If InKey <> "" Then Exit Do + End If + End If + mpq_swap(in_, out_) + i = 0 + End If +Loop + +' Loop Until scanbit > 300 +' Loop Until InKey <> "" +' Loop Until scanbit > 300 Or InKey <> "" +' stopping conditions will slow down the hole loop +' loop will check for key if it's printing a result + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Fractran/Sidef/fractran.sidef b/Task/Fractran/Sidef/fractran.sidef new file mode 100644 index 0000000000..e7d21ce504 --- /dev/null +++ b/Task/Fractran/Sidef/fractran.sidef @@ -0,0 +1,28 @@ +var str ="17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1" +const FractalProgram = str.split(',').map{.to_r} #=> array of rationals + +func runner(n, callback) { + var num = 2.rat + n.times { + callback(num *= FractalProgram.find { |f| (f*num).de.is_one }) + } +} + +func prime_generator(n, callback) { + var x = 0; + runner(Math.inf, { |num| + var l = num.to_f.log2 + if (l.floor == l) { + callback(l.to_i) + ++x == n && return + } + }) +} + +STDOUT.autoflush(true) + +runner(20, {|n| print (n, ' ') }) +print "\n" + +prime_generator(20, {|n| print (n, ' ') }) +print "\n" diff --git a/Task/Function-composition/AntLang/function-composition.antlang b/Task/Function-composition/AntLang/function-composition.antlang new file mode 100644 index 0000000000..b810103cd2 --- /dev/null +++ b/Task/Function-composition/AntLang/function-composition.antlang @@ -0,0 +1,4 @@ +/Apply g to exactly one argument +compose1: {f: x; g: y; {f[g[x]]}} +/Extra: apply to multiple arguments +compose: {f: x; g: y; {f[g apply args]}} diff --git a/Task/Function-composition/EchoLisp/function-composition-1.echolisp b/Task/Function-composition/EchoLisp/function-composition-1.echolisp new file mode 100644 index 0000000000..f1a88318a6 --- /dev/null +++ b/Task/Function-composition/EchoLisp/function-composition-1.echolisp @@ -0,0 +1,16 @@ +;; By decreasing order of performance +;; 1) user definition : lambda and closure + +(define (ucompose f g ) (lambda (x) ( f ( g x)))) +(ucompose sin cos) + → (🔒 λ (_x) (f (g _x))) + +;; 2) built-in compose : lambda + +(compose sin cos) + → (λ (_#:g1002) (#apply-compose (#list #cos #sin) _#:g1002)) + +;; 3) compiled composition + +(define (sincos x) (sin (cos x))) +sincos → (λ (_x) (⭕️ #sin (#cos _x))) diff --git a/Task/Function-composition/EchoLisp/function-composition-2.echolisp b/Task/Function-composition/EchoLisp/function-composition-2.echolisp new file mode 100644 index 0000000000..e8a2230683 --- /dev/null +++ b/Task/Function-composition/EchoLisp/function-composition-2.echolisp @@ -0,0 +1,3 @@ +((ucompose sin cos) 3) → -0.8360218615377305 +((compose sin cos) 3) → -0.8360218615377305 +(sincos 3) → -0.8360218615377305 diff --git a/Task/Function-composition/FunL/function-composition.funl b/Task/Function-composition/FunL/function-composition.funl new file mode 100644 index 0000000000..5747a8ab17 --- /dev/null +++ b/Task/Function-composition/FunL/function-composition.funl @@ -0,0 +1,7 @@ +import math.{sin, asin} + +def compose( f, g ) = x -> f( g(x) ) + +sin_asin = compose( sin, asin ) + +println( sin_asin(0.5) ) diff --git a/Task/Function-composition/LFE/function-composition-1.lfe b/Task/Function-composition/LFE/function-composition-1.lfe new file mode 100644 index 0000000000..5d754d1de0 --- /dev/null +++ b/Task/Function-composition/LFE/function-composition-1.lfe @@ -0,0 +1,16 @@ +(defun compose (f g) + (lambda (x) + (funcall f + (funcall g x)))) + +(defun compose (funcs) + (lists:foldl #'compose/2 + (lambda (x) x) + funcs)) + +(defun check () + (let* ((sin-asin (compose #'math:sin/1 #'math:asin/1)) + (expected (math:sin (math:asin 0.5))) + (compose-result (funcall sin-asin 0.5))) + (io:format '"Expected answer: ~p~n" (list expected)) + (io:format '"Answer with compose: ~p~n" (list compose-result)))) diff --git a/Task/Function-composition/LFE/function-composition-2.lfe b/Task/Function-composition/LFE/function-composition-2.lfe new file mode 100644 index 0000000000..871b61030c --- /dev/null +++ b/Task/Function-composition/LFE/function-composition-2.lfe @@ -0,0 +1,13 @@ +> (funcall (compose #'math:sin/1 #'math:asin/1) + 0.5) +0.49999999999999994 +> (funcall (compose `(,#'math:sin/1 + ,#'math:asin/1 + ,(lambda (x) (+ x 1)))) + 0.5) +1.5 +> (check) +Expected answer: 0.49999999999999994 +Answer with compose: 0.49999999999999994 +ok +> diff --git a/Task/Function-composition/Lingo/function-composition-1.lingo b/Task/Function-composition/Lingo/function-composition-1.lingo new file mode 100644 index 0000000000..72222f96a7 --- /dev/null +++ b/Task/Function-composition/Lingo/function-composition-1.lingo @@ -0,0 +1,10 @@ +-- in some movie script +---------------------------------------- +-- Composes 2 call-functions, returns a new call-function +-- @param {symbol|instance} f +-- @param {symbol|instance} g +-- @return {instance} +---------------------------------------- +on compose (f, g) + return script("Composer").new(f, g) +end diff --git a/Task/Function-composition/Lingo/function-composition-2.lingo b/Task/Function-composition/Lingo/function-composition-2.lingo new file mode 100644 index 0000000000..ba8af48fad --- /dev/null +++ b/Task/Function-composition/Lingo/function-composition-2.lingo @@ -0,0 +1,34 @@ +-- parent script "Composer" + +property _f +property _g + +---------------------------------------- +-- @constructor +-- @param {symbol|instance} f +-- @param {symbol|instance} g +---------------------------------------- +on new (me, f, g) + me._f = f + me._g = g + return me +end + +on call (me) + if ilk(me._g)=#instance then + cmd = "_movie.call(#call,me._g,VOID" + else + cmd = "_movie.call(me._g,_movie" + end if + a = [] -- local args list + repeat with i = 1 to the paramCount-2 + a[i] = param(i+2) + put ",a["&i&"]" after cmd + end repeat + put ")" after cmd + if ilk(me._f)=#instance then + return _movie.call(#call, me._f, VOID, value(cmd)) + else + return _movie.call(me._f, _movie, value(cmd)) + end if +end diff --git a/Task/Function-composition/Lingo/function-composition-3.lingo b/Task/Function-composition/Lingo/function-composition-3.lingo new file mode 100644 index 0000000000..741fc9aff0 --- /dev/null +++ b/Task/Function-composition/Lingo/function-composition-3.lingo @@ -0,0 +1,16 @@ +-- compose new function based on built-in function 'sin' and user-defined function 'asin' +f1 = compose(#asin, #sin) +put call(f1, _movie, 0.5) +-- 0.5000 + +-- compose new function based on previously composed function 'f1' and user-defined function 'double' +f2 = compose(#double, f1) +put call(f2, _movie, 0.5) +-- 1.0000 + +-- compose new function based on 2 composed functions +f1 = compose(#asin, #sin) +f2 = compose(#double, #triple) +f3 = compose(f2, f1) +put call(f3, _movie, 0.5) +-- 3.0000 diff --git a/Task/Function-composition/Lingo/function-composition-4.lingo b/Task/Function-composition/Lingo/function-composition-4.lingo new file mode 100644 index 0000000000..6efb8a411e --- /dev/null +++ b/Task/Function-composition/Lingo/function-composition-4.lingo @@ -0,0 +1,14 @@ +-- in some movie script +on asin (x) + res = atan(sqrt(x*x/(1-x*x))) + if x<0 then res = -res + return res +end + +on double (x) + return x*2 +end + +on triple (x) + return x*3 +end diff --git a/Task/Function-composition/Nim/function-composition.nim b/Task/Function-composition/Nim/function-composition.nim new file mode 100644 index 0000000000..be2d29eb07 --- /dev/null +++ b/Task/Function-composition/Nim/function-composition.nim @@ -0,0 +1,9 @@ +import future + +proc compose[A,B,C](f: A -> B, g: B -> C): A -> C = (x: A) => f(g(x)) + +proc plustwo(x: int): int = x + 2 +proc minustwo(x: int): int = x - 2 + +var plusminustwo = compose(plustwo, minustwo) +echo plusminustwo(10) diff --git a/Task/Function-composition/Oforth/function-composition-1.oforth b/Task/Function-composition/Oforth/function-composition-1.oforth new file mode 100644 index 0000000000..e86a8f2184 --- /dev/null +++ b/Task/Function-composition/Oforth/function-composition-1.oforth @@ -0,0 +1 @@ +g f diff --git a/Task/Function-composition/Oforth/function-composition-2.oforth b/Task/Function-composition/Oforth/function-composition-2.oforth new file mode 100644 index 0000000000..f44c50b4a9 --- /dev/null +++ b/Task/Function-composition/Oforth/function-composition-2.oforth @@ -0,0 +1 @@ +: compose(f, g) #[ g perform f perform ] ; diff --git a/Task/Function-composition/Oforth/function-composition-3.oforth b/Task/Function-composition/Oforth/function-composition-3.oforth new file mode 100644 index 0000000000..138e0c0fa4 --- /dev/null +++ b/Task/Function-composition/Oforth/function-composition-3.oforth @@ -0,0 +1,2 @@ +1.2 compose(#asin, #sin) perform +[ 1, 2, 3, 4, 5 ] compose(#[ map(#sqrt) ], #[ filter(#isEven) ]) perform diff --git a/Task/Function-composition/Phix/function-composition.phix b/Task/Function-composition/Phix/function-composition.phix new file mode 100644 index 0000000000..3fd97454b7 --- /dev/null +++ b/Task/Function-composition/Phix/function-composition.phix @@ -0,0 +1,25 @@ +sequence ctable = {} + +function compose(integer f, integer g) + ctable = append(ctable,{f,g}) + return length(ctable) +end function + +function call_composite(integer f, atom x) +integer g + {f,g} = ctable[f] + return call_func(f,{call_func(g,{x})}) +end function + +function plus1(atom x) + return x+1 +end function + +function halve(atom x) + return x/2 +end function + +constant m = compose(routine_id("halve"),routine_id("plus1")) + +?call_composite(m,1) -- displays 1 +?call_composite(m,4) -- displays 2.5 diff --git a/Task/Function-composition/Sidef/function-composition.sidef b/Task/Function-composition/Sidef/function-composition.sidef new file mode 100644 index 0000000000..d3b91dfed1 --- /dev/null +++ b/Task/Function-composition/Sidef/function-composition.sidef @@ -0,0 +1,5 @@ +func compose(f, g) { + func(x) { f(g(x)) }; +}; +var fg = compose(func(x){Math.sin(x)}, func(x){Math.cos(x)}); +say fg(0.5); # => 0.7691963548410084218525147580510688880995 diff --git a/Task/Function-composition/Swift/function-composition.swift b/Task/Function-composition/Swift/function-composition.swift new file mode 100644 index 0000000000..31ff7e8a84 --- /dev/null +++ b/Task/Function-composition/Swift/function-composition.swift @@ -0,0 +1,6 @@ +func compose(f: (B) -> C, g: (A) -> B) -> (A) -> C { + return { f(g($0)) } +} + +let sin_asin = compose(sin, asin) +println(sin_asin(0.5)) diff --git a/Task/Function-composition/Wortel/function-composition-1.wortel b/Task/Function-composition/Wortel/function-composition-1.wortel new file mode 100644 index 0000000000..83d146d3a4 --- /dev/null +++ b/Task/Function-composition/Wortel/function-composition-1.wortel @@ -0,0 +1 @@ +! @[f g] x ; f(g(x)) diff --git a/Task/Function-composition/Wortel/function-composition-2.wortel b/Task/Function-composition/Wortel/function-composition-2.wortel new file mode 100644 index 0000000000..80bc092e06 --- /dev/null +++ b/Task/Function-composition/Wortel/function-composition-2.wortel @@ -0,0 +1 @@ +! ^(f g) x ; f(g(x)) diff --git a/Task/Function-composition/Wortel/function-composition-3.wortel b/Task/Function-composition/Wortel/function-composition-3.wortel new file mode 100644 index 0000000000..bf48f95e2f --- /dev/null +++ b/Task/Function-composition/Wortel/function-composition-3.wortel @@ -0,0 +1 @@ +@var compose &[f g] &x !f!g x diff --git a/Task/Function-composition/jq/function-composition.jq b/Task/Function-composition/jq/function-composition.jq new file mode 100644 index 0000000000..d685f00a61 --- /dev/null +++ b/Task/Function-composition/jq/function-composition.jq @@ -0,0 +1,2 @@ +# apply g first and then f +def compose(f; g): g | f; diff --git a/Task/Function-definition/8051-Assembly/function-definition.8051 b/Task/Function-definition/8051-Assembly/function-definition.8051 new file mode 100644 index 0000000000..34c6417896 --- /dev/null +++ b/Task/Function-definition/8051-Assembly/function-definition.8051 @@ -0,0 +1,12 @@ +ORG RESET +mov a, #100 +mov b, #10 +call multiply +; at this point, the result of 100*10 = 1000 = 03e8h is stored in registers a and b +; a = e8 +; b = 03 +jmp $ + +multiply: +mul ab +ret diff --git a/Task/Function-definition/AntLang/function-definition-1.antlang b/Task/Function-definition/AntLang/function-definition-1.antlang new file mode 100644 index 0000000000..4f58efc449 --- /dev/null +++ b/Task/Function-definition/AntLang/function-definition-1.antlang @@ -0,0 +1,2 @@ +multiply: * /`*' is a normal function +multiply: {x * y} diff --git a/Task/Function-definition/AntLang/function-definition-2.antlang b/Task/Function-definition/AntLang/function-definition-2.antlang new file mode 100644 index 0000000000..443cd4597c --- /dev/null +++ b/Task/Function-definition/AntLang/function-definition-2.antlang @@ -0,0 +1 @@ +{expr-or-def1; expr-or-def2; ..; return-expr} diff --git a/Task/Function-definition/Axe/function-definition.axe b/Task/Function-definition/Axe/function-definition.axe new file mode 100644 index 0000000000..a2588134bc --- /dev/null +++ b/Task/Function-definition/Axe/function-definition.axe @@ -0,0 +1,3 @@ +Lbl MULT +r₁*r₂ +Return diff --git a/Task/Function-definition/ChucK/function-definition.chuck b/Task/Function-definition/ChucK/function-definition.chuck new file mode 100644 index 0000000000..431e14d3dc --- /dev/null +++ b/Task/Function-definition/ChucK/function-definition.chuck @@ -0,0 +1,6 @@ +fun float multiply (float a, float b) +{ + return a * b; +} +// uncomment next line and change values to test +//<<< multiply(16,4) >>>; diff --git a/Task/Function-definition/Coco/function-definition-1.coco b/Task/Function-definition/Coco/function-definition-1.coco new file mode 100644 index 0000000000..1fc469dcde --- /dev/null +++ b/Task/Function-definition/Coco/function-definition-1.coco @@ -0,0 +1 @@ +multiply = -> @@0 * @@1 diff --git a/Task/Function-definition/Coco/function-definition-2.coco b/Task/Function-definition/Coco/function-definition-2.coco new file mode 100644 index 0000000000..1d7d25079f --- /dev/null +++ b/Task/Function-definition/Coco/function-definition-2.coco @@ -0,0 +1 @@ +double = -> 2 * it diff --git a/Task/Function-definition/EchoLisp/function-definition.echolisp b/Task/Function-definition/EchoLisp/function-definition.echolisp new file mode 100644 index 0000000000..448cf447d0 --- /dev/null +++ b/Task/Function-definition/EchoLisp/function-definition.echolisp @@ -0,0 +1,25 @@ +(define (multiply a b) (* a b)) → multiply ;; (1) +(multiply 1/3 666) → 222 + +;; a function is a lambda definition : +multiply + → (λ (_a _b) (#* _a _b)) + +;; The following is the same as (1) : +(define multiply (lambda(a b) (* a b))) +multiply + → (🔒 λ (_a _b) (#* _a _b)) ;; a closure + + +;; a function may be compiled +(lib 'compile) +(compile 'multiply "-float-verbose") + → +💡 [0] compiling _🔶_multiply ((#* _a _b)) +;; object code (javascript) : +var ref,top = _blocks[_topblock]; +/* */return ( +/* */(_stack[top] *_stack[1 + top]) +/* */); + +multiply → (λ (_a _b) (#🔶_multiply)) ;; compiled function diff --git a/Task/Function-definition/FreeBASIC/function-definition-1.freebasic b/Task/Function-definition/FreeBASIC/function-definition-1.freebasic new file mode 100644 index 0000000000..677953f8cf --- /dev/null +++ b/Task/Function-definition/FreeBASIC/function-definition-1.freebasic @@ -0,0 +1,5 @@ +' FB 1.05.0 Win64 + +Function multiply(d1 As Double, d2 As Double) As Double + Return d1 * d2 +End Function diff --git a/Task/Function-definition/FreeBASIC/function-definition-2.freebasic b/Task/Function-definition/FreeBASIC/function-definition-2.freebasic new file mode 100644 index 0000000000..1ca7042a15 --- /dev/null +++ b/Task/Function-definition/FreeBASIC/function-definition-2.freebasic @@ -0,0 +1 @@ +#Define multiply(d1, d2) (d1) * (d2) diff --git a/Task/Function-definition/Futhark/function-definition.futhark b/Task/Function-definition/Futhark/function-definition.futhark new file mode 100644 index 0000000000..24633a9146 --- /dev/null +++ b/Task/Function-definition/Futhark/function-definition.futhark @@ -0,0 +1 @@ +fun multiply(x: int, y: int): int = x * y diff --git a/Task/Function-definition/FutureBasic/function-definition.futurebasic b/Task/Function-definition/FutureBasic/function-definition.futurebasic new file mode 100644 index 0000000000..137caf0cb2 --- /dev/null +++ b/Task/Function-definition/FutureBasic/function-definition.futurebasic @@ -0,0 +1,6 @@ +include "ConsoleWindow" + +local fn multiply( a as long, b as long ) as long +end fn = a * b + +print fn multiply( 3, 9 ) diff --git a/Task/Function-definition/LFE/function-definition.lfe b/Task/Function-definition/LFE/function-definition.lfe new file mode 100644 index 0000000000..c1ef24314f --- /dev/null +++ b/Task/Function-definition/LFE/function-definition.lfe @@ -0,0 +1,2 @@ +(defun mutiply (a b) + (* a b)) diff --git a/Task/Function-definition/Lasso/function-definition-1.lasso b/Task/Function-definition/Lasso/function-definition-1.lasso new file mode 100644 index 0000000000..985b2641fe --- /dev/null +++ b/Task/Function-definition/Lasso/function-definition-1.lasso @@ -0,0 +1,3 @@ +define multiply(a,b) => { + return #a * #b +} diff --git a/Task/Function-definition/Lasso/function-definition-2.lasso b/Task/Function-definition/Lasso/function-definition-2.lasso new file mode 100644 index 0000000000..12e5bb2ce3 --- /dev/null +++ b/Task/Function-definition/Lasso/function-definition-2.lasso @@ -0,0 +1 @@ +define multiply(a,b) => #a * #b diff --git a/Task/Function-definition/Lasso/function-definition-3.lasso b/Task/Function-definition/Lasso/function-definition-3.lasso new file mode 100644 index 0000000000..a4ac91b155 --- /dev/null +++ b/Task/Function-definition/Lasso/function-definition-3.lasso @@ -0,0 +1,6 @@ +// Signatures that convert second input to match first input +define multiply(a::integer,b::any) => #a * integer(#b) +define multiply(a::decimal,b::any) => #a * decimal(#b) + +// Catch all signature +define multiply(a::any,b::any) => decimal(#a) * decimal(#b) diff --git a/Task/Function-definition/Lily/function-definition.lily b/Task/Function-definition/Lily/function-definition.lily new file mode 100644 index 0000000000..97c1a3ef3f --- /dev/null +++ b/Task/Function-definition/Lily/function-definition.lily @@ -0,0 +1,4 @@ +define multiply(a: Integer, b: Integer): Integer +{ + return a * b +} diff --git a/Task/Function-definition/Lingo/function-definition.lingo b/Task/Function-definition/Lingo/function-definition.lingo new file mode 100644 index 0000000000..c70441f993 --- /dev/null +++ b/Task/Function-definition/Lingo/function-definition.lingo @@ -0,0 +1,3 @@ +on multiply (a, b) + return a * b +end diff --git a/Task/Function-definition/LiveCode/function-definition.livecode b/Task/Function-definition/LiveCode/function-definition.livecode new file mode 100644 index 0000000000..a488c3924e --- /dev/null +++ b/Task/Function-definition/LiveCode/function-definition.livecode @@ -0,0 +1,5 @@ +function multiplyy n1 n2 + return n1 * n2 +end multiplyy + +put multiplyy(2,5) -- = 10 diff --git a/Task/Function-definition/NESL/function-definition.nesl b/Task/Function-definition/NESL/function-definition.nesl new file mode 100644 index 0000000000..a893030fa7 --- /dev/null +++ b/Task/Function-definition/NESL/function-definition.nesl @@ -0,0 +1 @@ +function multiply(x, y) = x * y; diff --git a/Task/Function-definition/Nim/function-definition-1.nim b/Task/Function-definition/Nim/function-definition-1.nim new file mode 100644 index 0000000000..e7b62db71b --- /dev/null +++ b/Task/Function-definition/Nim/function-definition-1.nim @@ -0,0 +1,2 @@ +proc multiply(a, b: Int): Int = + result = a * b diff --git a/Task/Function-definition/Nim/function-definition-2.nim b/Task/Function-definition/Nim/function-definition-2.nim new file mode 100644 index 0000000000..508013d357 --- /dev/null +++ b/Task/Function-definition/Nim/function-definition-2.nim @@ -0,0 +1,2 @@ +proc multiply(a, b: Int): Int = + return a * b diff --git a/Task/Function-definition/Nim/function-definition-3.nim b/Task/Function-definition/Nim/function-definition-3.nim new file mode 100644 index 0000000000..8ade8d4313 --- /dev/null +++ b/Task/Function-definition/Nim/function-definition-3.nim @@ -0,0 +1 @@ +proc multiply(a, b: Int): Int = a * b diff --git a/Task/Function-definition/Oforth/function-definition-1.oforth b/Task/Function-definition/Oforth/function-definition-1.oforth new file mode 100644 index 0000000000..159d66340c --- /dev/null +++ b/Task/Function-definition/Oforth/function-definition-1.oforth @@ -0,0 +1 @@ +: multiply * ; diff --git a/Task/Function-definition/Oforth/function-definition-2.oforth b/Task/Function-definition/Oforth/function-definition-2.oforth new file mode 100644 index 0000000000..26621659a7 --- /dev/null +++ b/Task/Function-definition/Oforth/function-definition-2.oforth @@ -0,0 +1 @@ +: multiply2(a, b) a b * ; diff --git a/Task/Function-definition/PHL/function-definition.phl b/Task/Function-definition/PHL/function-definition.phl new file mode 100644 index 0000000000..36e1959c15 --- /dev/null +++ b/Task/Function-definition/PHL/function-definition.phl @@ -0,0 +1,3 @@ +@Integer multiply(@Integer a, @Integer b) [ + return a * b; +] diff --git a/Task/Function-definition/Phix/function-definition.phix b/Task/Function-definition/Phix/function-definition.phix new file mode 100644 index 0000000000..cb16268254 --- /dev/null +++ b/Task/Function-definition/Phix/function-definition.phix @@ -0,0 +1,3 @@ +function multiply(atom a, atom b) + return a*b +end function diff --git a/Task/Function-definition/Picat/function-definition.picat b/Task/Function-definition/Picat/function-definition.picat new file mode 100644 index 0000000000..3d99f65f99 --- /dev/null +++ b/Task/Function-definition/Picat/function-definition.picat @@ -0,0 +1 @@ +multiply(A, B) = A*B. diff --git a/Task/Function-definition/Ring/function-definition.ring b/Task/Function-definition/Ring/function-definition.ring new file mode 100644 index 0000000000..27d4f750b2 --- /dev/null +++ b/Task/Function-definition/Ring/function-definition.ring @@ -0,0 +1 @@ +func multiply x,y return x*y diff --git a/Task/Function-definition/SSEM/function-definition-1.ssem b/Task/Function-definition/SSEM/function-definition-1.ssem new file mode 100644 index 0000000000..8135de1437 --- /dev/null +++ b/Task/Function-definition/SSEM/function-definition-1.ssem @@ -0,0 +1,5 @@ +01000000000000100000000000000000 0. -2 to c +00100000000000000000000000000000 1. 4 to CI +01111111111111111111111111111111 2. -2 +00000000000001110000000000000000 3. Stop +11100000000000000000000000000000 4. 7 diff --git a/Task/Function-definition/SSEM/function-definition-2.ssem b/Task/Function-definition/SSEM/function-definition-2.ssem new file mode 100644 index 0000000000..45878f7f66 --- /dev/null +++ b/Task/Function-definition/SSEM/function-definition-2.ssem @@ -0,0 +1,26 @@ +00010000000000000000000000000000 6. 8 +11100000000000000000000000000000 7. 7 +11111000000001100000000000000000 8. c to 31 +01100000000000100000000000000000 9. -6 to c +01111000000001100000000000000000 10. c to 30 +01111000000000100000000000000000 11. -30 to c +01111000000001100000000000000000 12. c to 30 +11100000000000100000000000000000 13. -7 to c +11100000000001100000000000000000 14. c to 7 +11100000000000100000000000000000 15. -7 to c +00111000000000010000000000000000 16. Sub. 28 +11100000000001100000000000000000 17. c to 7 +00111000000000010000000000000000 18. Sub. 28 +00000000000000110000000000000000 19. Test +00111000000001000000000000000000 20. Add 28 to CI +11111000000000000000000000000000 21. 31 to CI +01100000000000100000000000000000 22. -6 to c +01111000000000010000000000000000 23. Sub. 30 +01100000000001100000000000000000 24. c to 6 +01100000000000100000000000000000 25. -6 to c +01100000000001100000000000000000 26. c to 6 +10111000000000000000000000000000 27. 29 to CI +10000000000000000000000000000000 28. 1 +00110000000000000000000000000000 29. 12 +00000000000000000000000000000000 30. 0 +00000000000000000000000000000000 31. 0 diff --git a/Task/Function-definition/Sidef/function-definition.sidef b/Task/Function-definition/Sidef/function-definition.sidef new file mode 100644 index 0000000000..536bc6e0fb --- /dev/null +++ b/Task/Function-definition/Sidef/function-definition.sidef @@ -0,0 +1,3 @@ +func multiply(a, b) { + a * b; +} diff --git a/Task/Function-definition/Swift/function-definition.swift b/Task/Function-definition/Swift/function-definition.swift new file mode 100644 index 0000000000..43b29e9269 --- /dev/null +++ b/Task/Function-definition/Swift/function-definition.swift @@ -0,0 +1,3 @@ +func multiply(a: Double, b: Double) -> Double { + return a * b +} diff --git a/Task/Function-definition/Ursa/function-definition.ursa b/Task/Function-definition/Ursa/function-definition.ursa new file mode 100644 index 0000000000..8ebdf0f444 --- /dev/null +++ b/Task/Function-definition/Ursa/function-definition.ursa @@ -0,0 +1,4 @@ +# multiply is a built-in in ursa, so the function is called mult instead +def mult (int a, int b) + return (* a b) +end diff --git a/Task/Function-definition/Wart/function-definition-1.wart b/Task/Function-definition/Wart/function-definition-1.wart new file mode 100644 index 0000000000..a1b414e175 --- /dev/null +++ b/Task/Function-definition/Wart/function-definition-1.wart @@ -0,0 +1,2 @@ +def (multiply a b) + a*b diff --git a/Task/Function-definition/Wart/function-definition-2.wart b/Task/Function-definition/Wart/function-definition-2.wart new file mode 100644 index 0000000000..f0ebfbd998 --- /dev/null +++ b/Task/Function-definition/Wart/function-definition-2.wart @@ -0,0 +1,2 @@ +(multiply 3 4) +=> 12 diff --git a/Task/Function-definition/Wart/function-definition-3.wart b/Task/Function-definition/Wart/function-definition-3.wart new file mode 100644 index 0000000000..4a8a164f86 --- /dev/null +++ b/Task/Function-definition/Wart/function-definition-3.wart @@ -0,0 +1,2 @@ +(multiply 3 :a 4) # arg order doesn't matter here, but try subtract instead +=> 12 diff --git a/Task/Function-definition/Wart/function-definition-4.wart b/Task/Function-definition/Wart/function-definition-4.wart new file mode 100644 index 0000000000..f78feadfcf --- /dev/null +++ b/Task/Function-definition/Wart/function-definition-4.wart @@ -0,0 +1,2 @@ +def (multiply a b|by) + (* a b) diff --git a/Task/Function-definition/Wart/function-definition-5.wart b/Task/Function-definition/Wart/function-definition-5.wart new file mode 100644 index 0000000000..f09b95d5ca --- /dev/null +++ b/Task/Function-definition/Wart/function-definition-5.wart @@ -0,0 +1,2 @@ +multiply 3 :by 4 +=> 12 diff --git a/Task/Function-definition/XLISP/function-definition-1.xlisp b/Task/Function-definition/XLISP/function-definition-1.xlisp new file mode 100644 index 0000000000..78a39b41c8 --- /dev/null +++ b/Task/Function-definition/XLISP/function-definition-1.xlisp @@ -0,0 +1,2 @@ +(defun multiply (x y) + (* x y)) diff --git a/Task/Function-definition/XLISP/function-definition-2.xlisp b/Task/Function-definition/XLISP/function-definition-2.xlisp new file mode 100644 index 0000000000..48efb3e8ca --- /dev/null +++ b/Task/Function-definition/XLISP/function-definition-2.xlisp @@ -0,0 +1,2 @@ +(define (multiply x y) + (* x y)) diff --git a/Task/Function-definition/XLISP/function-definition-3.xlisp b/Task/Function-definition/XLISP/function-definition-3.xlisp new file mode 100644 index 0000000000..243225d865 --- /dev/null +++ b/Task/Function-definition/XLISP/function-definition-3.xlisp @@ -0,0 +1,2 @@ +(define multiply + (lambda (x y) (* x y))) diff --git a/Task/Function-definition/jq/function-definition-1.jq b/Task/Function-definition/jq/function-definition-1.jq new file mode 100644 index 0000000000..aea6539a42 --- /dev/null +++ b/Task/Function-definition/jq/function-definition-1.jq @@ -0,0 +1 @@ +def multiply(a; b): a*b; diff --git a/Task/Function-definition/jq/function-definition-2.jq b/Task/Function-definition/jq/function-definition-2.jq new file mode 100644 index 0000000000..8dc01429b8 --- /dev/null +++ b/Task/Function-definition/jq/function-definition-2.jq @@ -0,0 +1,2 @@ +# 2 | generate(. * .) will generate 2, 4, 16, 256, ... +def generate(f): def r: ., (f | r); r; diff --git a/Task/Function-definition/jq/function-definition-3.jq b/Task/Function-definition/jq/function-definition-3.jq new file mode 100644 index 0000000000..f84e39c663 --- /dev/null +++ b/Task/Function-definition/jq/function-definition-3.jq @@ -0,0 +1 @@ +def summation(f): reduce .[] as $x (0; . + ($x|f)); diff --git a/Task/Function-definition/jq/function-definition-4.jq b/Task/Function-definition/jq/function-definition-4.jq new file mode 100644 index 0000000000..545168e77d --- /dev/null +++ b/Task/Function-definition/jq/function-definition-4.jq @@ -0,0 +1 @@ +summation( .h * .w) diff --git a/Task/Function-frequency/LiveCode/function-frequency-1.livecode b/Task/Function-frequency/LiveCode/function-frequency-1.livecode new file mode 100644 index 0000000000..f82e5bc279 --- /dev/null +++ b/Task/Function-frequency/LiveCode/function-frequency-1.livecode @@ -0,0 +1,29 @@ +function handlerNames pScript + put pScript into pScriptCopy + filter pScript with regex pattern "^(on|function).*" + -- add in the built-in commands & functions + put the commandNames & the functionnames into cmdfunc + repeat for each line builtin in cmdfunc + put 0 into handlers[builtin] + end repeat + + -- add user defined handlers, remove this section of you do not want your own functions included + repeat with x = 1 to the number of lines of pScript + put word 2 of line x of pScript into handlername + put 0 into handlers[handlername] + end repeat + + -- count handlers used + repeat with x = 1 to the number of lines of pScriptCopy + repeat for each key k in handlers + if k is among the tokens of line x of pScriptCopy then + add 1 to handlers[k] + end if + end repeat + end repeat + + combine handlers using cr and space + sort lines of handlers descending by word 2 of each + put line 1 to 10 of handlers into handlers + return handlers +end handlerNames diff --git a/Task/Function-frequency/LiveCode/function-frequency-2.livecode b/Task/Function-frequency/LiveCode/function-frequency-2.livecode new file mode 100644 index 0000000000..eadd88da4b --- /dev/null +++ b/Task/Function-frequency/LiveCode/function-frequency-2.livecode @@ -0,0 +1 @@ +put handlerNames(the script of this stack & cr & the script of this card & cr & the script of me) diff --git a/Task/Function-frequency/LiveCode/function-frequency-3.livecode b/Task/Function-frequency/LiveCode/function-frequency-3.livecode new file mode 100644 index 0000000000..aff233a3b3 --- /dev/null +++ b/Task/Function-frequency/LiveCode/function-frequency-3.livecode @@ -0,0 +1,10 @@ +if 8 +put 8 +return 8 +function 7 +factorialacc 4 -- user def function for other rosetta task +factorialr 3 -- user def function for other rosetta task +handlerNames 3 +factorial 2 -- user def function for other rosetta task +factorialit 2 -- user def function for other rosetta task +mouseUp 2 diff --git a/Task/Function-frequency/Sidef/function-frequency.sidef b/Task/Function-frequency/Sidef/function-frequency.sidef new file mode 100644 index 0000000000..000bc54e16 --- /dev/null +++ b/Task/Function-frequency/Sidef/function-frequency.sidef @@ -0,0 +1,19 @@ +var program = <<'EOT' +func foo { } +func bar { } + +foo(); foo(); foo() +bar(); bar(); +EOT + +var parser = Parser.new # initialize a new parser +parser.parse_script( code => program ) # parse the code + +var data = Perl.to_sidef(parser{:vars}{:main}).flatten + +data.sort_by { |v| -v{:count} }.first(10).each { |entry| + if (entry{:type} == :func) { + say ("Function `#{entry{:name}}` (declared at line", + " #{entry{:line}}) is used #{entry{:count}} times") + } +} diff --git a/Task/Function-prototype/FreeBASIC/function-prototype.freebasic b/Task/Function-prototype/FreeBASIC/function-prototype.freebasic new file mode 100644 index 0000000000..40077dd2f4 --- /dev/null +++ b/Task/Function-prototype/FreeBASIC/function-prototype.freebasic @@ -0,0 +1,37 @@ +' FB 1.05.0 Win64 + +' The position regarding prototypes is broadly similar to that of the C language in that functions, +' sub-routines or operators (unless they have already been fully defined) must be declared before they can be used. +' This is usually done near the top of a file or in a separate header file which is then 'included'. + +' Parameter names are optional in declarations. When calling functions, using parameter names +' (as opposed to identifying arguments by position) is not supported. + +Type MyType ' needed for operator declaration + i As Integer +End Type + +Declare Function noArgs() As Integer ' function with no argument that returns an integer +Declare Function twoArgs(As Integer, As Integer) As Integer ' function with two arguments that returns an integer +Declare Function atLeastOneArg CDecl(As Integer, ...) As Integer ' one mandatory integer argument followed by varargs +Declare Function optionalArg(As Integer = 0) As Integer ' function with a (single) optional argument with default value +Declare Sub noArgs2() ' sub-routine with no argument +Declare Operator + (As MyType, As MyType) As MyType ' operator declaration (no hidden 'This' parameter for MyType) + + +' FreeBASIC also supports object-oriented programming and here all constructors, destructors, +' methods (function or sub), properties and operators (having a hidden 'This' parameter) must be +' declared within a user defined type and then defined afterwards. + + +Type MyType2 + Public: + Declare Constructor(As Integer) + Declare Destructor() + Declare Sub MySub() + Declare Function MyFunction(As Integer) As Integer + Declare Property MyProperty As Integer + Declare Operator Cast() As String + Private: + i As Integer +End Type diff --git a/Task/Function-prototype/Luck/function-prototype.luck b/Task/Function-prototype/Luck/function-prototype.luck new file mode 100644 index 0000000000..d3568ee0b8 --- /dev/null +++ b/Task/Function-prototype/Luck/function-prototype.luck @@ -0,0 +1,8 @@ +function noargs(): int = ? ;; +function twoargs(x:int, y:int): int = ? ;; + +/* underscore means ignore and is not bound to lexical scope */ +function twoargs(_:bool, _:bool): int = ? ;; + +function anyargs(xs: ...): int = ? ;; +function plusargs(x:int, xs: ...): int = ? ;; diff --git a/Task/Function-prototype/Nim/function-prototype.nim b/Task/Function-prototype/Nim/function-prototype.nim new file mode 100644 index 0000000000..a56225f1eb --- /dev/null +++ b/Task/Function-prototype/Nim/function-prototype.nim @@ -0,0 +1,17 @@ +# Procedure declarations. All are named +proc noargs(): int +proc twoargs(a, b: int): int +proc anyargs(x: varargs[int]): int +proc optargs(a, b: int = 10): int + +# Usage +discard noargs() +discard twoargs(1,2) +discard anyargs(1,2,3,4,5,6,7,8) +discard optargs(5) + +# Procedure definitions +proc noargs(): int = echo "noargs" +proc twoargs(a, b: int): int = echo "twoargs" +proc anyargs(x: varargs[int]): int = echo "anyargs" +proc optargs(a: int, b = 10): int = echo "optargs" diff --git a/Task/Function-prototype/Oforth/function-prototype.oforth b/Task/Function-prototype/Oforth/function-prototype.oforth new file mode 100644 index 0000000000..19825f50a2 --- /dev/null +++ b/Task/Function-prototype/Oforth/function-prototype.oforth @@ -0,0 +1 @@ +Method new: myMethod diff --git a/Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-1.freebasic b/Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-1.freebasic new file mode 100644 index 0000000000..e43aba7bf3 --- /dev/null +++ b/Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-1.freebasic @@ -0,0 +1,19 @@ +' FB 1.05.0 Win64 + +' Using SystemParametersInfo function in Win32 API +Dim As Any Ptr library = DyLibLoad("user32") +Dim Shared SystemParametersInfo As Function (ByVal As ULong, ByVal As ULong, ByVal As Any Ptr, ByVal As ULong) As Long +SystemParametersInfo = DyLibSymbol(library, "SystemParametersInfoA") + +Type Rect + As Long left, top, right, bottom +End Type + +#Define SPI_GETWORKAREA &H30 +Dim r As Rect +SystemParametersInfo(SPI_GETWORKAREA, 0, @r, 0) +DyLibFree(library) +Print "Maximum usable desktop area : W" ; r.right - r.left; " x H"; r.bottom - r.top; " pixels" +Print +Print "Press any key to quit" +Sleep diff --git a/Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-2.freebasic b/Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-2.freebasic new file mode 100644 index 0000000000..8079f1ca5c --- /dev/null +++ b/Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-2.freebasic @@ -0,0 +1,2 @@ +FMain.Maximized = True +FMain.Visible = False ' The form can be invisible diff --git a/Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-3.freebasic b/Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-3.freebasic new file mode 100644 index 0000000000..b9a1b98527 --- /dev/null +++ b/Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-3.freebasic @@ -0,0 +1,7 @@ +PUBLIC SUB _new() + +END + +PUBLIC SUB Form_Open() + +END diff --git a/Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-4.freebasic b/Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-4.freebasic new file mode 100644 index 0000000000..62c047491e --- /dev/null +++ b/Task/GUI-Maximum-window-dimensions/FreeBASIC/gui-maximum-window-dimensions-4.freebasic @@ -0,0 +1,3 @@ +PUBLIC SUB Form_Resize() + PRINT "The maximum window size that can be used without scrolling is "; FMain.Width; " x "; FMain.Height +END diff --git a/Task/GUI-Maximum-window-dimensions/Lingo/gui-maximum-window-dimensions.lingo b/Task/GUI-Maximum-window-dimensions/Lingo/gui-maximum-window-dimensions.lingo new file mode 100644 index 0000000000..fac30ba844 --- /dev/null +++ b/Task/GUI-Maximum-window-dimensions/Lingo/gui-maximum-window-dimensions.lingo @@ -0,0 +1,2 @@ +put _system.desktopRectList +-- [rect(0, 0, 1360, 768), rect(1360, 0, 2960, 1024)] diff --git a/Task/GUI-Maximum-window-dimensions/Nim/gui-maximum-window-dimensions-1.nim b/Task/GUI-Maximum-window-dimensions/Nim/gui-maximum-window-dimensions-1.nim new file mode 100644 index 0000000000..e6f18e02bf --- /dev/null +++ b/Task/GUI-Maximum-window-dimensions/Nim/gui-maximum-window-dimensions-1.nim @@ -0,0 +1,7 @@ +import + gtk2, gdk2 + +nim_init() +var w = gdk2.screen_width() +var h = gdk2.screen_height() +echo("WxH=",w,"x",h) diff --git a/Task/GUI-Maximum-window-dimensions/Nim/gui-maximum-window-dimensions-2.nim b/Task/GUI-Maximum-window-dimensions/Nim/gui-maximum-window-dimensions-2.nim new file mode 100644 index 0000000000..9d2cd86ba7 --- /dev/null +++ b/Task/GUI-Maximum-window-dimensions/Nim/gui-maximum-window-dimensions-2.nim @@ -0,0 +1,22 @@ +import + iup + +# assumes you have the iup .dll or .so installed + +discard iup.open(nil,nil) + +var scrnFullSize = GetGlobal("FULLSIZE") +var scrnSize = GetGlobal("SCREENSIZE") +var scrnMInfo = GetGlobal("MONITORSINFO") +var scrnVScreen = GetGlobal("VIRTUALSCREEN") + +var dlg = Dialog(nil) +SetAttribute(dlg, "SIZE", "FULL") +var scrnXSize = GetAttribute(dlg,"MAXSIZE") + +echo scrnFullSize, "\n", scrnSize, "\n", scrnMInfo, "\n", scrnVScreen, "\n", scrnXSize + +discard iup.Alarm("Screen client size", scrnFullSize ,"Ok",nil, nil) + +#discard iup.mainloop() +iup.close() diff --git a/Task/GUI-Maximum-window-dimensions/Ring/gui-maximum-window-dimensions.ring b/Task/GUI-Maximum-window-dimensions/Ring/gui-maximum-window-dimensions.ring new file mode 100644 index 0000000000..6702de3ada --- /dev/null +++ b/Task/GUI-Maximum-window-dimensions/Ring/gui-maximum-window-dimensions.ring @@ -0,0 +1,11 @@ +load "guilib.ring" +new qApp { + win1 = new qWidget() { + new qPushButton(win1) { + resize(200,200) + settext("Info") + setclickevent(' win1{ setwindowtitle("Width: " + width() + " Height : " + height() ) }') + } + showMaximized()} + exec() + } diff --git a/Task/GUI-Maximum-window-dimensions/Sidef/gui-maximum-window-dimensions.sidef b/Task/GUI-Maximum-window-dimensions/Sidef/gui-maximum-window-dimensions.sidef new file mode 100644 index 0000000000..c46fbdc705 --- /dev/null +++ b/Task/GUI-Maximum-window-dimensions/Sidef/gui-maximum-window-dimensions.sidef @@ -0,0 +1,8 @@ +require('Tk') + +func max_window_size() -> (Number, Number) { + %s'MainWindow'.new.maxsize; +} + +var (width, height) = max_window_size(); +say (width, 'x', height); diff --git a/Task/GUI-component-interaction/FreeBASIC/gui-component-interaction.freebasic b/Task/GUI-component-interaction/FreeBASIC/gui-component-interaction.freebasic new file mode 100644 index 0000000000..8784f8e29c --- /dev/null +++ b/Task/GUI-component-interaction/FreeBASIC/gui-component-interaction.freebasic @@ -0,0 +1,41 @@ +#Include "windows.bi" + +Dim As HWND Window_Main, Edit_Number, Button_Inc, Button_Rnd +Dim As MSG msg +Dim As Integer n +Dim As String text + +'Create a window with an input field and two buttons: +Window_Main = CreateWindow("#32770", "GUI Component Interaction", WS_OVERLAPPEDWINDOW Or WS_VISIBLE, 100, 100, 250, 200, 0, 0, 0, 0) +Var Static_Number = CreateWindow("STATIC", "Value:", WS_VISIBLE Or WS_CHILD, 10, 10, 100, 20, Window_Main, 0, 0, 0) +Edit_Number = CreateWindow("EDIT", "0", WS_BORDER Or WS_VISIBLE Or WS_CHILD Or ES_AUTOHSCROLL Or ES_Number, 110, 10, 100, 20, Window_Main, 0, 0, 0) +Button_Inc = CreateWindow("BUTTON", "Increment", WS_VISIBLE Or WS_CHILD, 110, 40, 100, 20, Window_Main, 0, 0, 0) +Button_Rnd = CreateWindow("BUTTON", "Random", WS_VISIBLE Or WS_CHILD, 110, 70, 100, 20, Window_Main, 0, 0, 0) + +'Windows message loop: +While GetMessage(@msg, Window_Main, 0, 0) + TranslateMessage(@msg) + DispatchMessage(@msg) + Select Case msg.hwnd + Case Button_Inc + If msg.message = WM_LBUTTONDOWN Then + 'Increment value: + text = Space(GetWindowTextLength(Edit_Number) + 1) 'Buffer for the text + GetWindowText(Edit_Number, text, Len(text)) + n = Val(text) + SetWindowText(Edit_Number, Str(n + 1)) + End If + Case Button_Rnd + If msg.message = WM_LBUTTONDOWN THEN + 'Random value (max. 100000): + If MessageBox(0, "Set input field to random value?", "Please confirm", MB_ICONQUESTION Or MB_YESNO) = IDYES Then + n = 100000 * RND + SetWindowText(Edit_Number, Str(n)) + End If + End If + Case Window_Main + If msg.message = WM_COMMAND Then End + End Select +Wend + +End diff --git a/Task/GUI-component-interaction/Nim/gui-component-interaction-1.nim b/Task/GUI-component-interaction/Nim/gui-component-interaction-1.nim new file mode 100644 index 0000000000..f3580dd16d --- /dev/null +++ b/Task/GUI-component-interaction/Nim/gui-component-interaction-1.nim @@ -0,0 +1,71 @@ +import + gtk2, gdk2, glib2, strutils, math + +import + gtk2, gdk2, glib2, strutils, math + +var valu: int = 0 +var chngd_txt_hndler: gulong = 0 + +proc thisDestroy(widget: PWidget, data: Pgpointer) {.cdecl.} = + main_quit() + +randomize() +nim_init() +var win = window_new(gtk2.WINDOW_TOPLEVEL) +var content = vbox_new(true,10) +var hbox1 = hbox_new(true,10) +var hbox2 = hbox_new(false,1) +var lbl = label_new("Value:") +var entry_fld = entry_new() +entry_fld.set_text("0") +var btn_quit = button_new("Quit") +var btn_inc = button_new("Increment") +var btn_rnd = button_new("Random") +add(hbox2,lbl) +add(hbox2,entry_fld) +add(hbox1,btn_inc) +add(hbox1,btn_rnd) +pack_start(content, hbox2, true, true, 0) +pack_start(content, hbox1, true, true, 0) +pack_start(content, btn_quit, true, true, 0) +set_border_width(win, 5) +add(win, content) + +proc on_question_clicked: bool = + var dialog = win.message_dialog_new(0, MESSAGE_QUESTION, + BUTTONS_YES_NO, "Use a Random number?") + var response = dialog.run() + if response == RESPONSE_YES: + result = true + elif response == RESPONSE_NO: + result = false + dialog.destroy() + +proc thisInc(widget: PWidget, data: Pgpointer){.cdecl.} = + inc(valu) + entry_fld.set_text($valu) + +proc thisRnd(widget: PWidget, data: Pgpointer){.cdecl.} = + if on_question_clicked(): + valu = random(20) + entry_fld.set_text($valu) + +proc thisTextChanged(widget: PWidget, data: Pgpointer) {.cdecl.} = + #signal_handler_block(entry_fld, chngd_txt_hndler) + try: + valu = parseInt($entry_fld.get_text()) + except EInvalidValue: + valu = 0 + entry_fld.set_text($valu) + #signal_handler_unblock(entry_fld, chngd_txt_hndler) + #signal_emit_stop(entry_fld, signal_lookup("changed",TYPE_EDITABLE()),0) + +discard signal_connect(win, "destroy", SIGNAL_FUNC(thisDestroy), nil) +discard signal_connect(btn_quit, "clicked", SIGNAL_FUNC(thisDestroy), nil) +discard signal_connect(btn_inc, "clicked", SIGNAL_FUNC(thisInc), nil) +discard signal_connect(btn_rnd, "clicked", SIGNAL_FUNC(thisRnd), nil) +chngd_txt_hndler = signal_connect(entry_fld, "changed", SIGNAL_FUNC(thisTextChanged), nil) + +win.show_all() +main() diff --git a/Task/GUI-component-interaction/Nim/gui-component-interaction-2.nim b/Task/GUI-component-interaction/Nim/gui-component-interaction-2.nim new file mode 100644 index 0000000000..ed2f4c0d32 --- /dev/null +++ b/Task/GUI-component-interaction/Nim/gui-component-interaction-2.nim @@ -0,0 +1,63 @@ +import + iup, strutils, math + +# assumes you have the iup .dll or .so installed + +randomize() +discard iup.open(nil,nil) + + +var lbl = Label("Value:") +setAttribute(lbl,"PADDING","2x2") + +var valu = Text(nil) +SetAttribute(valu, "PADDING", "2x2") +SetAttribute(valu, "VALUE", "0") + +proc toCB(fp: proc): ICallback = + return cast[ICallback](fp) + +# Click handler for Click button +proc incClick(ih:PIhandle): cint {.cdecl.} = + var s: string = $(GetAttribute(valu,"VALUE")) + var x: int = 0 + try: + x = 1 + parseInt(s) + except: + x = 1 # default to 1 if non-numeric entry + setAttribute(valu,"VALUE", $x) + return IUP_DEFAULT + +# Click handler for Random button +proc randClick(ih:PIhandle): cint {.cdecl.} = + if Iup.Alarm("Random Value?", "Set value to a random numer < 100 ?","Yes","No",nil) == 1: + setAttribute(valu,"VALUE", $random(100)) + return IUP_DEFAULT + +# Key handler to check for Esc pressed +proc key_cb(ih:PIhandle, c: cint):cint {.cdecl.} = + #echo c + if (c == Iup.K_esc) and (Iup.Alarm("Exit?", "Had enough?","Yes","Keep going",nil) == 1): + return IUP_CLOSE # Exit application + return IUP_CONTINUE + + +var txtBox = Hbox(lbl, valu, nil) +SetAttribute(txtBox, "MARGIN", "10x10") + +var incBtn = Button("&Increment", "") +var randBtn = Button("&Randomize", "") +var btnBox = Vbox(incBtn, randBtn, nil) +SetAttribute(btnBox, "MARGIN", "5x5") + +var contents = Hbox(txtBox, btnBox, nil) +SetAttribute(contents, "MARGIN", "2x2") + +discard setCallback(incBtn,"ACTION", toCB(incClick)) +discard setCallback(randBtn,"ACTION", toCB(randClick)) +discard setCallback(contents,"K_ANY", toCB(key_cb)) + +var dlg = Dialog(contents) +discard dlg.show() +discard mainloop() +iup.close() diff --git a/Task/GUI-component-interaction/Phix/gui-component-interaction.phix b/Task/GUI-component-interaction/Phix/gui-component-interaction.phix new file mode 100644 index 0000000000..729eee898a --- /dev/null +++ b/Task/GUI-component-interaction/Phix/gui-component-interaction.phix @@ -0,0 +1,37 @@ +include pGUI.e + +Ihandle txt, increment, random, hbx, vbx, dlg + +function action_cb(Ihandle /*ih*/, integer ch) + if not find(ch,"0123456789-") then return IUP_IGNORE end if + return IUP_CONTINUE +end function + +function increment_cb(Ihandle /*ih*/) + integer v = IupGetInt(txt,"VALUE")+1 + IupSetInt(txt,"VALUE",v) + return IUP_CONTINUE +end function + +function random_cb(Ihandle /*ih*/) + if IupAlarm("Confirm","Replace wth random value?","Yes","No")=1 then + IupSetInt(txt,"VALUE",rand(1000)) + end if + return IUP_CONTINUE +end function + +function esc_close(Ihandle /*ih*/, atom c) + return iff(c=K_ESC?IUP_CLOSE:IUP_CONTINUE) +end function + + IupOpen("../pGUI/") + txt = IupText(Icallback("action_cb"),"EXPAND=YES") + increment = IupButton("increment",Icallback("increment_cb")) + random = IupButton("random",Icallback("random_cb")) + hbx = IupHbox({increment,random},"MARGIN=0x10, GAP=20") + vbx = IupVbox({txt,hbx},"MARGIN=40x20") + dlg = IupDialog(vbx) + IupSetCallback(dlg, "K_ANY", Icallback("esc_close")) + IupShow(dlg) + IupMainLoop() + IupClose() diff --git a/Task/GUI-component-interaction/Ring/gui-component-interaction.ring b/Task/GUI-component-interaction/Ring/gui-component-interaction.ring new file mode 100644 index 0000000000..ff9087a055 --- /dev/null +++ b/Task/GUI-component-interaction/Ring/gui-component-interaction.ring @@ -0,0 +1,31 @@ +Load "guilib.ring" + +MyApp = New qApp { + num = 0 + win1 = new qWidget() { + setwindowtitle("Hello World") + setGeometry(100,100,370,250) + + btn1 = new qpushbutton(win1) { + setGeometry(200,200,100,30) + settext("Random") + setclickevent("Rand()")} + + btn2 = new qpushbutton(win1) { + setGeometry(50,200,100,30) + settext("Increment") + setclickevent("Increment()")} + + lineedit1 = new qlineedit(win1) { + setGeometry(10,100,350,30)} + show()} +exec()} + +func Rand + num = string(random(10000)) + lineedit1.settext(num) + +func Increment + lineedit1{ num = text()} + num = string(number(num)+1) + lineedit1.settext(num) diff --git a/Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-1.livecode b/Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-1.livecode new file mode 100644 index 0000000000..436355f306 --- /dev/null +++ b/Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-1.livecode @@ -0,0 +1,18 @@ +command enableButtons v + switch + case v <= 0 + put 0 into fld "Field1" + set the enabled of btn "Button1" to true + set the enabled of btn "Button2" to false + break + case v >= 10 + put 10 into fld "Field1" + set the enabled of btn "Button1" to false + set the enabled of btn "Button2" to true + break + default + set the enabled of btn "Button1" to true + set the enabled of btn "Button2" to true + put v into fld "Field1" + end switch +end enableButtons diff --git a/Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-2.livecode b/Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-2.livecode new file mode 100644 index 0000000000..01a3543286 --- /dev/null +++ b/Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-2.livecode @@ -0,0 +1,5 @@ +on mouseUp + put field "Field1" into x + add 1 to x + enableButtons x +end mouseUp diff --git a/Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-3.livecode b/Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-3.livecode new file mode 100644 index 0000000000..e298050384 --- /dev/null +++ b/Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-3.livecode @@ -0,0 +1,5 @@ +on mouseUp + put field "Field1" into x + subtract 1 from x + enableButtons x +end mouseUp diff --git a/Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-4.livecode b/Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-4.livecode new file mode 100644 index 0000000000..30411a325c --- /dev/null +++ b/Task/GUI-enabling-disabling-of-controls/LiveCode/gui-enabling-disabling-of-controls-4.livecode @@ -0,0 +1,9 @@ +on rawKeyDown k + if numToChar(k) is among the items of "1,2,3,4,5,6,7,8,9,0" then + if (numToChar(k) + the text of me) <= 10 then + enableButtons (numToChar(k) + the text of me) + end if + else if k = 65288 then + pass rawKeyDown + end if +end rawKeyDown diff --git a/Task/GUI-enabling-disabling-of-controls/Nim/gui-enabling-disabling-of-controls-1.nim b/Task/GUI-enabling-disabling-of-controls/Nim/gui-enabling-disabling-of-controls-1.nim new file mode 100644 index 0000000000..fd3d5797d7 --- /dev/null +++ b/Task/GUI-enabling-disabling-of-controls/Nim/gui-enabling-disabling-of-controls-1.nim @@ -0,0 +1,68 @@ +import + gtk2, strutils, glib2 + +var valu: int = 0 +var chngd_txt_hndler: gulong = 0 + +proc thisCheckBtns # forward declaration + +proc thisDestroy(widget: pWidget, data: pgpointer){.cdecl.} = + main_quit() + +nim_init() +var window = window_new(gtk2.WINDOW_TOPLEVEL) +var content = vbox_new(TRUE,10) +var hbox1 = hbox_new(TRUE,10) +var entry_fld = entry_new() +entry_fld.set_text("0") +var btn_quit = button_new("Quit") +var btn_inc = button_new("Increment") +var btn_dec = button_new("Decrement") +add(hbox1,btn_inc) +add(hbox1,btn_dec) +pack_start(content, entry_fld, TRUE, TRUE, 0) +pack_start(content, hbox1, TRUE, TRUE, 0) +pack_start(content, btn_quit, TRUE, TRUE, 0) +set_border_width(Window, 5) +add(window, content) + +proc thisInc(widget: pWidget, data: pgpointer){.cdecl.} = + inc(valu) + entry_fld.set_text($valu) + thisCheckBtns() + +proc thisDec(widget: pWidget, data: pgpointer){.cdecl.} = + dec(valu) + entry_fld.set_text($valu) + thisCheckBtns() + +proc thisTextChanged(widget: pWidget, data: pgpointer) {.cdecl.} = + #signal_handler_block(entry_fld, chngd_txt_hndler) + try: + valu = parseInt($entry_fld.get_text()) + except EInvalidValue: + valu = 0 + entry_fld.set_text($valu) + #signal_handler_unblock(entry_fld, chngd_txt_hndler) + #signal_emit_stop(entry_fld, signal_lookup("changed",TYPE_EDITABLE()),0) + thisCheckBtns() + +proc thisCheckBtns = + set_sensitive(btn_inc, valu < 10) + set_sensitive(btn_dec, valu > 0) + set_sensitive(entry_fld, valu == 0) + +discard signal_connect(window, "destroy", + SIGNAL_FUNC(thisDestroy), nil) +discard signal_connect(btn_quit, "clicked", + SIGNAL_FUNC(thisDestroy), nil) +discard signal_connect(btn_inc, "clicked", + SIGNAL_FUNC(thisInc), nil) +discard signal_connect(btn_dec, "clicked", + SIGNAL_FUNC(thisDec), nil) +chngd_txt_hndler = signal_connect(entry_fld, "changed", + SIGNAL_FUNC(thisTextChanged), nil) + +show_all(window) +thisCheckBtns() +main() diff --git a/Task/GUI-enabling-disabling-of-controls/Nim/gui-enabling-disabling-of-controls-2.nim b/Task/GUI-enabling-disabling-of-controls/Nim/gui-enabling-disabling-of-controls-2.nim new file mode 100644 index 0000000000..d7073f65cd --- /dev/null +++ b/Task/GUI-enabling-disabling-of-controls/Nim/gui-enabling-disabling-of-controls-2.nim @@ -0,0 +1,93 @@ +import + iup, strutils, math + +# assumes you have the iup .dll or .so installed + +randomize() +discard iup.open(nil,nil) + + +var lbl = Label("Value:") +setAttribute(lbl,"PADDING","2x2") + +var valu = Text(nil) +SetAtt(nil, valu, "PADDING", "2x2", "VALUE", "0", nil) + +var txtBox = Hbox(lbl, valu, nil) +SetAttribute(txtBox, "MARGIN", "10x10") + +var incBtn = Button("+1", "") +var decBtn = Button("-1", "") +SetAttribute(incBtn,"RASTERSIZE","25x25") +SetAttribute(decBtn,"RASTERSIZE","25x25") +var btnBox = Vbox(incBtn, decBtn, nil) +SetAttribute(btnBox, "MARGIN", "5x5") + + +proc toCB(fp: proc): ICallback = + return cast[ICallback](fp) + +proc setValuState(value: int) = + if value == 0: + SetAttribute(valu, "ACTIVE", $(true)) + else: + SetAttribute(valu, "ACTIVE", $(false)) + +proc setBtnsState(value: int) = + if value <= 0: + SetAttribute(decBtn,"ACTIVE", $(false)) + SetAtt(nil, incBtn,"ACTIVE", $(true), "FOCUS", $(true), nil) + elif value >= 10: + SetAttribute(incBtn,"ACTIVE", $(false)) + SetAtt(nil, decBtn,"ACTIVE", $(true), "FOCUS", $(true), nil) + else: + SetAttribute(decBtn,"ACTIVE", $(true)) + SetAttribute(incBtn,"ACTIVE", $(true)) + + +# Click handler for Click button +proc incClick(ih:PIhandle): cint {.cdecl.} = + var s: string = $(GetAttribute(valu,"VALUE")) + var x: int = 0 + try: + x = 1 + parseInt(s) + except: + x = 1 # default to 1 if non-numeric entry + setAttribute(valu,"VALUE", $x) + setValuState(x) + setBtnsState(x) + return IUP_DEFAULT + +# Click handler for Decrement button +proc decClick(ih:PIhandle): cint {.cdecl.} = + var s: string = $(GetAttribute(valu,"VALUE")) + var x: int = 0 + try: + x = -1 + parseInt(s) + except: + x = 1 # default to 1 if non-numeric entry + setAttribute(valu,"VALUE", $x) + setValuState(x) + setBtnsState(x) + return IUP_DEFAULT + +# Key handler to check for Esc pressed +proc key_cb(ih:PIhandle, c: cint):cint {.cdecl.} = + #echo c + if (c == Iup.K_esc) and (Iup.Alarm("Exit?", "Had enough?","Yes","Keep going",nil) == 1): + return IUP_CLOSE # Exit application + return IUP_CONTINUE + +var contents = Hbox(txtBox, btnBox, nil) +SetAttribute(contents, "MARGIN", "5x5") + +discard setCallback(incBtn,"ACTION", toCB(incClick)) +discard setCallback(decBtn,"ACTION", toCB(decClick)) +discard setCallback(contents,"K_ANY", toCB(key_cb)) + +var dlg = Dialog(contents) +SetAtt(nil, dlg, "TITLE","GUI Interaction", "SIZE","200x75", nil) + +discard dlg.show() +discard mainloop() +iup.close() diff --git a/Task/GUI-enabling-disabling-of-controls/Phix/gui-enabling-disabling-of-controls.phix b/Task/GUI-enabling-disabling-of-controls/Phix/gui-enabling-disabling-of-controls.phix new file mode 100644 index 0000000000..17e26dddeb --- /dev/null +++ b/Task/GUI-enabling-disabling-of-controls/Phix/gui-enabling-disabling-of-controls.phix @@ -0,0 +1,39 @@ +include pGUI.e + +Ihandle txt, inc, dec, hbx, vbx, dlg + +function activate(integer v) + IupSetInt(txt,"VALUE",v) + IupSetAttribute(inc,"ACTIVE",iff(v<10,"YES":"NO")) + IupSetAttribute(dec,"ACTIVE",iff(v>0,"YES":"NO")) + IupSetAttribute(txt,"ACTIVE",iff(v=0,"YES":"NO")) + return IUP_CONTINUE +end function + +function valuechanged_cb(Ihandle /*ih*/) + return activate(IupGetInt(txt,"VALUE")) +end function + +function inc_cb(Ihandle /*ih*/) + return activate(IupGetInt(txt,"VALUE")+1) +end function + +function dec_cb(Ihandle /*ih*/) + return activate(IupGetInt(txt,"VALUE")-1) +end function + +function esc_close(Ihandle /*ih*/, atom c) + return iff(c=K_ESC?IUP_CLOSE:IUP_CONTINUE) +end function + + IupOpen("../pGUI/") + txt = IupText("VALUECHANGED_CB",Icallback("valuechanged_cb"),"FILTER=NUMBER, EXPAND=YES") + inc = IupButton("increment",Icallback("inc_cb")) + dec = IupButton("decrement",Icallback("dec_cb"),"ACTIVE=NO") + hbx = IupHbox({inc,dec},"MARGIN=0x10, GAP=20") + vbx = IupVbox({txt,hbx},"MARGIN=40x20") + dlg = IupDialog(vbx) + IupSetCallback(dlg, "K_ANY", Icallback("esc_close")) + IupShow(dlg) + IupMainLoop() + IupClose() diff --git a/Task/GUI-enabling-disabling-of-controls/Ring/gui-enabling-disabling-of-controls.ring b/Task/GUI-enabling-disabling-of-controls/Ring/gui-enabling-disabling-of-controls.ring new file mode 100644 index 0000000000..0fe431b8cb --- /dev/null +++ b/Task/GUI-enabling-disabling-of-controls/Ring/gui-enabling-disabling-of-controls.ring @@ -0,0 +1,35 @@ +Load "guilib.ring" + +MyApp = New qApp { + num = 0 + win1 = new qWidget() { + setwindowtitle("Hello World") + setGeometry(100,100,370,250) + + btn1 = new qpushbutton(win1) { + setGeometry(50,200,100,30) + settext("Increment") + setclickevent("Increment()")} + + btn2 = new qpushbutton(win1) { + setGeometry(200,200,100,30) + settext("Decrement") + setclickevent("Decrement()")} + + lineedit1 = new qlineedit(win1) { + setGeometry(10,100,350,30) + settext("0")} + show()} +exec()} + +func Increment + lineedit1{ num = text()} + num = string(number(num)+1) + lineedit1.settext(num) + if number(num)>9 btn1.setDisabled(True) ok + +func Decrement + lineedit1{ num = text()} + num = string(number(num)-1) + lineedit1.settext(num) + if number(num)<0 btn2.setDisabled(True) ok diff --git a/Task/Galton-box-animation/Elm/galton-box-animation.elm b/Task/Galton-box-animation/Elm/galton-box-animation.elm new file mode 100644 index 0000000000..1a723c2979 --- /dev/null +++ b/Task/Galton-box-animation/Elm/galton-box-animation.elm @@ -0,0 +1,210 @@ +import Html.App exposing (program) +import Time exposing (Time, every, millisecond) +import Color exposing (Color, black, red, blue, green) +import Collage exposing (collage) +import Collage exposing (collage,polygon, filled, move, Form, circle) +import Element exposing (toHtml) +import Html exposing (Attribute, Html, text, div, input, button) +import Html.Attributes as A exposing (type', min, placeholder, value, style, disabled) +import Html.Events exposing (onInput, targetValue, onClick) +import Dict exposing (Dict, get, insert) +import String exposing (toInt) +import Result exposing (withDefault) +import Random.Pcg as Random exposing (Seed, bool, initialSeed, independentSeed, step, map) + +width = 500 +height = 600 +hscale = 10.0 +vscale = hscale * 2 +margin = 30 +levelCount = 12 +radius = hscale/ 2.0 + +type State = InBox Int Int Seed | Falling Int Float Float Float | Landed Int Float + +type Coin = Coin State Color + +colorCycle : Int -> Color +colorCycle i = + case i % 3 of + 0 -> red + 1 -> blue + _ -> green + +initCoin : Int -> Seed -> Coin +initCoin indx seed = Coin (InBox 0 0 seed) (colorCycle indx) + +drawCoin : Coin -> Form +drawCoin (Coin state color) = + let dropLevel = toFloat (height//2 - margin) + (level, shift, distance) = + case state of + InBox level shift seed -> (level, shift, 0) + Falling shift distance _ _-> (levelCount, shift, distance) + Landed shift distance -> (levelCount, shift, distance) + position = + ( hscale * toFloat shift + , dropLevel - vscale * (toFloat level) - distance + radius / 2.0) + + in radius |> circle |> filled color |> move position + +drawGaltonBox : List Form +drawGaltonBox = + let levels = [0..levelCount-1] + + -- doubles : + -- [0,2,4,6,8...] + doubles = List.map (\n -> 2 * n) levels + + -- sequences : + -- [[0], [0,2], [0,2,4], [0,2,4,6], [0,2,4,6,8],...] + sequences = case List.tail (List.scanl (::) [] (doubles)) of + Nothing -> [] + Just ls -> ls + + -- galtonCoords : + -- [ (0,0), + -- (-1,1), (1,1), + -- (-2,2), (0,2), (2,2), + -- (-3,3), (-1,3), (1,3), (3,3), + -- (-4,4), (-2,4), (0,4), (2,4), (4,4), ...] + galtonCoords = + List.map2 + (\ls level -> List.map (\n -> (n - level, level)) ls) + sequences + levels + |> List.concat + + peg = polygon [(0,0), (-4, -8), (4, -8)] |> filled black + + apex = toFloat (height//2 - margin) + + in List.map (\(x,y) -> move (hscale*toFloat x, apex - vscale*toFloat y) peg) galtonCoords + +coinsInBin : Int -> Dict Int Int -> Int +coinsInBin binNumber bins = + case get binNumber bins of + Nothing -> 0 + Just n -> n + +addToBins : Int -> Dict Int Int -> Dict Int Int +addToBins binNumber bins = + insert binNumber (coinsInBin binNumber bins + 1) bins + +updateCoin : (Coin, Dict Int Int) -> (Coin, Dict Int Int) +updateCoin (Coin state color as coin, bins) = + case state of + InBox level shift seed -> + let deltaShift = map (\b -> if b then 1 else -1) bool + (delta, newSeed) = step deltaShift seed + newShift = shift+delta + newLevel = (level)+1 + in if (newLevel < levelCount) then + (Coin (InBox newLevel newShift newSeed) color, bins) + else -- transition to falling + let maxDrop = toFloat (height - 2 * margin) - toFloat (levelCount) * vscale + floor = maxDrop - toFloat (coinsInBin newShift bins) * (radius*2 + 1) + in (Coin (Falling newShift -((vscale)/2.0) 10 floor) color, addToBins newShift bins) + + Falling shift distance velocity floor -> + let newDistance = distance + velocity + in if (newDistance < floor) then + (Coin (Falling shift newDistance (velocity + 1) floor) color, bins) + else -- transtion to landed + (Coin (Landed shift floor) color, bins) + + Landed _ _ -> (coin, bins) -- unchanged + +type alias Model = + { coins : List Coin + , bins : Dict Int Int + , count : Int + , started : Bool + , seedInitialized : Bool + , seed : Seed + } + +init : (Model, Cmd Msg) +init = + ( { coins = [] + , bins = Dict.empty + , count = 0 + , started = False + , seedInitialized = False + , seed = initialSeed 45 -- This will not get used. Actual seed used is time dependent and set when the first coin drops. + }, Cmd.none) + +type Msg = Drop Time | Tick Time | SetCount String | Go + +update : Msg -> Model -> (Model, Cmd Msg) +update action model = + case action of + Go -> + ({model | started = model.count > 0}, Cmd.none) + + SetCount countString -> + ({ model | count = toInt countString |> withDefault 0 }, Cmd.none) + + Drop t -> + if (model.started && model.count > 0) then + let newcount = model.count - 1 + seed' = if model.seedInitialized then model.seed else initialSeed (truncate t) + (seed'', coinSeed) = step independentSeed seed' + in ({ model + | coins = initCoin (truncate t) coinSeed :: model.coins + , count = newcount + , started = newcount > 0 + , seedInitialized = True + , seed = seed''}, Cmd.none) + else + (model, Cmd.none) + + Tick _ -> + -- foldr to execute update, append to coins, replace bins + let (updatedCoins, updatedBins) = + List.foldr (\coin (coinList, bins) -> + let (updatedCoin, updatedBins) = updateCoin (coin, bins) + in (updatedCoin :: coinList, updatedBins)) + ([], model.bins) + model.coins + in ({ model | coins = updatedCoins, bins = updatedBins}, Cmd.none) + +view : Model -> Html Msg +view model = + div [] + [ input + [ placeholder "How many?" + , let showString = if model.count > 0 then model.count |> toString else "" + in value showString + , onInput SetCount + , disabled model.started + , style [ ("height", "20px") ] + , type' "number" + , A.min "1" + ] + [] + + , button + [ onClick Go + , disabled model.started + , style [ ("height", "20px") ] + ] + [ Html.text "GO!" ] + + , let coinForms = (List.map (drawCoin) model.coins) + in collage width height (coinForms ++ drawGaltonBox) |> toHtml + ] + +subscriptions model = + Sub.batch + [ every (40*millisecond) Tick + , every (200*millisecond) Drop + ] + +main = + program + { init = init + , view = view + , update = update + , subscriptions = subscriptions + } diff --git a/Task/Gamma-function/FreeBASIC/gamma-function.freebasic b/Task/Gamma-function/FreeBASIC/gamma-function.freebasic new file mode 100644 index 0000000000..f7f44481a9 --- /dev/null +++ b/Task/Gamma-function/FreeBASIC/gamma-function.freebasic @@ -0,0 +1,47 @@ +' FB 1.05.0 Win64 + +Const pi = 3.1415926535897932 +Const e = 2.7182818284590452 + +Function gammaStirling (x As Double) As Double + Return Sqr(2.0 * pi / x) * ((x / e) ^ x) +End Function + +Function gammaLanczos (x As Double) As Double + Dim p(0 To 8) As Double = _ + { _ + 0.99999999999980993, _ + 676.5203681218851, _ + -1259.1392167224028, _ + 771.32342877765313, _ + -176.61502916214059, _ + 12.507343278686905, _ + -0.13857109526572012, _ + 9.9843695780195716e-6, _ + 1.5056327351493116e-7 _ + } + + Dim As Integer g = 7 + If x < 0.5 Then Return pi / (Sin(pi * x) * gammaLanczos(1-x)) + x -= 1 + Dim a As Double = p(0) + Dim t As Double = x + g + 0.5 + + For i As Integer = 1 To 7 + a += p(i) / (x + i) + Next + + Return Sqr(2.0 * pi) * (t ^ (x + 0.5)) * Exp(-t) * a +End Function + +Print " x", " Stirling",, " Lanczos" +Print +For i As Integer = 1 To 20 + Dim As Double d = i / 10.0 + Print Using "#.##"; d; + Print , Using "#.###############"; gammaStirling(d); + Print , Using "#.###############"; gammaLanczos(d) +Next +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Gamma-function/Nim/gamma-function.nim b/Task/Gamma-function/Nim/gamma-function.nim new file mode 100644 index 0000000000..da044af04d --- /dev/null +++ b/Task/Gamma-function/Nim/gamma-function.nim @@ -0,0 +1,21 @@ +const a = [ + 1.00000000000000000000, 0.57721566490153286061, -0.65587807152025388108, +-0.04200263503409523553, 0.16653861138229148950, -0.04219773455554433675, +-0.00962197152787697356, 0.00721894324666309954, -0.00116516759185906511, +-0.00021524167411495097, 0.00012805028238811619, -0.00002013485478078824, +-0.00000125049348214267, 0.00000113302723198170, -0.00000020563384169776, + 0.00000000611609510448, 0.00000000500200764447, -0.00000000118127457049, + 0.00000000010434267117, 0.00000000000778226344, -0.00000000000369680562, + 0.00000000000051003703, -0.00000000000002058326, -0.00000000000000534812, + 0.00000000000000122678, -0.00000000000000011813, 0.00000000000000000119, + 0.00000000000000000141, -0.00000000000000000023, 0.00000000000000000002 ] + +proc gamma(x): float = + let y = x.float - 1.0 + result = a[a.high] + for n in countdown(high(a) - 1, low(a)): + result = result * y + a[n] + result = 1.0 / result + +for i in 1..10: + echo gamma(i.float / 3.0) diff --git a/Task/Gamma-function/Oforth/gamma-function.oforth b/Task/Gamma-function/Oforth/gamma-function.oforth new file mode 100644 index 0000000000..84c44c3ebd --- /dev/null +++ b/Task/Gamma-function/Oforth/gamma-function.oforth @@ -0,0 +1,17 @@ +import: math + +[ + 676.5203681218851, -1259.1392167224028, 771.32342877765313, + -176.61502916214059, 12.507343278686905, -0.13857109526572012, + 9.9843695780195716e-6, 1.5056327351493116e-7 +] const: Gamma.Lanczos + +: gamma(z) +| i t | + z 0.5 < ifTrue: [ Pi dup z * sin 1.0 z - gamma * / return ] + z 1.0 - ->z + 0.99999999999980993 Gamma.Lanczos size loop: i [ i Gamma.Lanczos at z i + / + ] + z Gamma.Lanczos size + 0.5 - ->t + 2 Pi * sqrt * + t z 0.5 + powf * + t neg exp * ; diff --git a/Task/Gamma-function/Ring/gamma-function.ring b/Task/Gamma-function/Ring/gamma-function.ring new file mode 100644 index 0000000000..4c396e569c --- /dev/null +++ b/Task/Gamma-function/Ring/gamma-function.ring @@ -0,0 +1,18 @@ +decimals(3) +gamma = 0.577 +coeff = -0.655 +quad = -0.042 +qui = 0.166 +set = -0.042 + +for i=1 to 10 + see gammafunc(i / 3.0) + nl +next + +func recigamma z + return z + gamma * pow(z,2) + coeff * pow(z,3) + quad * pow(z,4) + qui * pow(z,5) + set * pow(z,6) + +func gammafunc z + if z = 1 return 1 + but fabs(z) <= 0.5 return 1 / recigamma(z) + else return (z - 1) * gammafunc(z-1) ok diff --git a/Task/Gamma-function/Sidef/gamma-function-1.sidef b/Task/Gamma-function/Sidef/gamma-function-1.sidef new file mode 100644 index 0000000000..b8691abecc --- /dev/null +++ b/Task/Gamma-function/Sidef/gamma-function-1.sidef @@ -0,0 +1,19 @@ +var a = [ 1.00000_00000_00000_00000, 0.57721_56649_01532_86061, -0.65587_80715_20253_88108, + -0.04200_26350_34095_23553, 0.16653_86113_82291_48950, -0.04219_77345_55544_33675, + -0.00962_19715_27876_97356, 0.00721_89432_46663_09954, -0.00116_51675_91859_06511, + -0.00021_52416_74114_95097, 0.00012_80502_82388_11619, -0.00002_01348_54780_78824, + -0.00000_12504_93482_14267, 0.00000_11330_27231_98170, -0.00000_02056_33841_69776, + 0.00000_00061_16095_10448, 0.00000_00050_02007_64447, -0.00000_00011_81274_57049, + 0.00000_00001_04342_67117, 0.00000_00000_07782_26344, -0.00000_00000_03696_80562, + 0.00000_00000_00510_03703, -0.00000_00000_00020_58326, -0.00000_00000_00005_34812, + 0.00000_00000_00001_22678, -0.00000_00000_00000_11813, 0.00000_00000_00000_00119, + 0.00000_00000_00000_00141, -0.00000_00000_00000_00023, 0.00000_00000_00000_00002 ]; + +func gamma(x) { + var y = (x - 1); + 1 / a.reverse.reduce {|sum, an| sum*y + an}; +} + +for i in 1..10 { + say ("%.14e" % gamma(i/3)); +} diff --git a/Task/Gamma-function/Sidef/gamma-function-2.sidef b/Task/Gamma-function/Sidef/gamma-function-2.sidef new file mode 100644 index 0000000000..bbc613c99f --- /dev/null +++ b/Task/Gamma-function/Sidef/gamma-function-2.sidef @@ -0,0 +1,38 @@ +func gamma(z) { + var epsilon = 0.0000001 + func withinepsilon(x) { + abs(x - abs(x)) <= epsilon + } + + var p = [ + 676.5203681218851, -1259.1392167224028, + 771.32342877765313, -176.61502916214059, + 12.507343278686905, -0.13857109526572012, + 9.9843695780195716e-6, 1.5056327351493116e-7, + ] + + var result; + z = Complex(z) + const pi = Complex.pi + + if (z.real < 0.5) { + result = (pi / (sin(pi * z) * gamma(Complex(1) - z))) + } + else { + z -= 1 + var x = 0.99999999999980993 + + p.each_kv { |i, v| + x += v/(z + i + 1) + } + + var t = (z + p.len - 0.5) + result = (sqrt(pi*2) * t**(z+0.5) * exp(-t) * x) + } + + withinepsilon(result.im) ? result.real : result +} + +for i in 1..10 { + say ("%.14e" % gamma(i/3)); +} diff --git a/Task/Gamma-function/Sidef/gamma-function-3.sidef b/Task/Gamma-function/Sidef/gamma-function-3.sidef new file mode 100644 index 0000000000..c3be5093dd --- /dev/null +++ b/Task/Gamma-function/Sidef/gamma-function-3.sidef @@ -0,0 +1,11 @@ +define e = Math.e; +define pi = Math.pi; + +func Γ(t) { + t < 20 ? (__FUNC__(t + 1) / t) + : (Math.sqrt(2*pi*t) * Math.pow(t/e + 1/(12*e*t), t) / t); +} + +for i in 1..10 { + say ("%.14e" % Γ(i/3)); +} diff --git a/Task/Gamma-function/Visual-FoxPro/gamma-function.visual b/Task/Gamma-function/Visual-FoxPro/gamma-function.visual new file mode 100644 index 0000000000..2901f13b1e --- /dev/null +++ b/Task/Gamma-function/Visual-FoxPro/gamma-function.visual @@ -0,0 +1,60 @@ +LOCAL i As Integer, x As Double, o As lanczos +CLOSE DATABASES ALL +CLEAR +CREATE CURSOR results (ZVal B(1), GamVal B(15)) +INDEX ON zval TAG ZVal COLLATE "Machine" +SET ORDER TO 0 +o = CREATEOBJECT("lanczos") +FOR i = 1 TO 20 +x = i/10 + INSERT INTO results VALUES (x, o.Gamma(x)) +ENDFOR +UPDATE results SET GamVal = ROUND(GamVal, 0) WHERE ZVal = INT(ZVal) +*!* This just creates the output text - it is not part of the algorithm +DO cursor2txt.prg WITH "results", .T. + +DEFINE CLASS lanczos As Session +#DEFINE FPF 5.5 +#DEFINE HALF 0.5 +#DEFINE PY PI() +DIMENSION LanCoeff[7] +nSize = 0 + +PROCEDURE Init +DODEFAULT() +WITH THIS + .LanCoeff[1] = 1.000000000190015 + .LanCoeff[2] = 76.18009172947146 + .LanCoeff[3] = -86.50532032941677 + .LanCoeff[4] = 24.01409824083091 + .LanCoeff[5] = -1.231739572450155 + .LanCoeff[6] = 0.0012086509738662 + .LanCoeff[7] = -0.000005395239385 + .nSize = ALEN(.LanCoeff) +ENDWITH +ENDPROC + +FUNCTION Gamma(z) +RETURN EXP(THIS.LogGamma(z)) +ENDFUNC + +FUNCTION LogGamma(z) +LOCAL a As Double, b As Double, i As Integer, j As Integer, lg As Double +IF z < 0.5 + lg = LOG(PY/SIN(PY*z)) - THIS.LogGamma(1 - z) +ELSE + WITH THIS + z = z - 1 + b = z + FPF + a = .LanCoeff[1] + FOR i = 2 TO .nSize + j = i - 1 + a = a + .LanCoeff[i]/(z + j) + ENDFOR + lg = (LOG(SQRT(2*PY)) + LOG(a) - b) + LOG(b)*(z + HALF) + ENDWITH +ENDIF +RETURN lg +ENDFUNC + +ENDDEFINE diff --git a/Task/Gamma-function/jq/gamma-function-1.jq b/Task/Gamma-function/jq/gamma-function-1.jq new file mode 100644 index 0000000000..45aa3d3ca6 --- /dev/null +++ b/Task/Gamma-function/jq/gamma-function-1.jq @@ -0,0 +1,16 @@ +def gamma: + [ + 1.00000000000000000000, 0.57721566490153286061, -0.65587807152025388108, -0.04200263503409523553, + 0.16653861138229148950, -0.04219773455554433675, -0.00962197152787697356, 0.00721894324666309954, + -0.00116516759185906511, -0.00021524167411495097, 0.00012805028238811619, -0.00002013485478078824, + -0.00000125049348214267, 0.00000113302723198170, -0.00000020563384169776, 0.00000000611609510448, + 0.00000000500200764447, -0.00000000118127457049, 0.00000000010434267117, 0.00000000000778226344, + -0.00000000000369680562, 0.00000000000051003703, -0.00000000000002058326, -0.00000000000000534812, + 0.00000000000000122678, -0.00000000000000011813, 0.00000000000000000119, 0.00000000000000000141, + -0.00000000000000000023, 0.00000000000000000002 + ] as $a + | (. - 1) as $y + | ($a|length) as $n + | reduce range(2; 1+$n) as $an + ($a[$n-1]; (. * $y) + $a[$n - $an]) + | 1 / . ; diff --git a/Task/Gamma-function/jq/gamma-function-2.jq b/Task/Gamma-function/jq/gamma-function-2.jq new file mode 100644 index 0000000000..3b90e7018a --- /dev/null +++ b/Task/Gamma-function/jq/gamma-function-2.jq @@ -0,0 +1,16 @@ +# for reals, but easily extended to complex values +def gamma_by_lanczos: + def pow(x): if x == 0 then 1 elif x == 1 then . else x * log | exp end; + . as $x + | ((1|atan) * 4) as $pi + | if $x < 0.5 then $pi / ((($pi * $x) | sin) * ((1-$x)|gamma_by_lanczos )) + else + [ 0.99999999999980993, 676.5203681218851, -1259.1392167224028, + 771.32342877765313, -176.61502916214059, 12.507343278686905, + -0.13857109526572012, 9.9843695780195716e-6, 1.5056327351493116e-7] as $p + | ($x - 1) as $x + | ($x + 7.5) as $t + | reduce range(1; $p|length) as $i + ($p[0]; . + ($p[$i]/($x + $i) )) + * ((2*$pi) | sqrt) * ($t | pow($x+0.5)) * ((-$t)|exp) + end; diff --git a/Task/Gamma-function/jq/gamma-function-3.jq b/Task/Gamma-function/jq/gamma-function-3.jq new file mode 100644 index 0000000000..92e02a3790 --- /dev/null +++ b/Task/Gamma-function/jq/gamma-function-3.jq @@ -0,0 +1,5 @@ +def gamma_by_stirling: + def pow(x): if x == 0 then 1 elif x == 1 then . else x * log | exp end; + ((1|atan) * 8) as $twopi + | . as $x + | (($twopi/$x) | sqrt) * ( ($x / (1|exp)) | pow($x)); diff --git a/Task/Gamma-function/jq/gamma-function-4.jq b/Task/Gamma-function/jq/gamma-function-4.jq new file mode 100644 index 0000000000..8be91b4b84 --- /dev/null +++ b/Task/Gamma-function/jq/gamma-function-4.jq @@ -0,0 +1,6 @@ +def pad(n): tostring | . + (n - length) * " "; + +" i: gamma lanczos tgamma", +(range(1;11) + | . / 3.0 + | "\(pad(18)): \(gamma|pad(18)) : \(gamma_by_lanczos|pad(18)) : \(tgamma)") diff --git a/Task/Gamma-function/jq/gamma-function-5.jq b/Task/Gamma-function/jq/gamma-function-5.jq new file mode 100644 index 0000000000..944aaa07e0 --- /dev/null +++ b/Task/Gamma-function/jq/gamma-function-5.jq @@ -0,0 +1,12 @@ +$ jq -M -r -n -f Gamma_function_Stirling.jq + i: gamma lanczos tgamma +0.3333333333333333: 2.6789385347077483 : 2.6789385347077483 : 2.678938534707748 +0.6666666666666666: 1.3541179394264005 : 1.3541179394263998 : 1.3541179394264005 +1 : 1 : 0.9999999999999998 : 1 +1.3333333333333333: 0.8929795115692493 : 0.8929795115692494 : 0.8929795115692493 +1.6666666666666667: 0.9027452929509336 : 0.9027452929509342 : 0.9027452929509336 +2 : 1 : 1.0000000000000002 : 1 +2.3333333333333335: 1.190639348758999 : 1.1906393487589995 : 1.190639348758999 +2.6666666666666665: 1.5045754882515399 : 1.5045754882515576 : 1.5045754882515558 +3 : 1.9999999999939684 : 2.0000000000000013 : 2 +3.3333333333333335: 2.778158479338573 : 2.778158480437665 : 2.7781584804376647 diff --git a/Task/Gaussian-elimination/Sidef/gaussian-elimination.sidef b/Task/Gaussian-elimination/Sidef/gaussian-elimination.sidef new file mode 100644 index 0000000000..cd39875188 --- /dev/null +++ b/Task/Gaussian-elimination/Sidef/gaussian-elimination.sidef @@ -0,0 +1,11 @@ +var Matrix = require('Math::Matrix'); + +var a = Matrix.new([0,1,0], + [0,0,1], + [2,0,1]); + +var b = Matrix.new([1], + [2], + [4]); + +a.concat(b).solve.print; diff --git a/Task/Generate-Chess960-starting-position/EchoLisp/generate-chess960-starting-position.echolisp b/Task/Generate-Chess960-starting-position/EchoLisp/generate-chess960-starting-position.echolisp new file mode 100644 index 0000000000..2f4286d38b --- /dev/null +++ b/Task/Generate-Chess960-starting-position/EchoLisp/generate-chess960-starting-position.echolisp @@ -0,0 +1,15 @@ +(define-values (K Q R B N) (iota 5)) +(define *pos* (list R N B Q K B N R)) ;; standard starter + +;; check opposite color bishops, and King between rooks +(define (legal-pos p) + (and + (> (list-index K p) (list-index R p)) + (> (list-index K (reverse p)) (list-index R (reverse p))) + (even? (+ (list-index B p) (list-index B (reverse p)))))) + +;; random shuffle current position until a legal one is found +(define (c960) + (set! *pos* (shuffle *pos*)) + (if (legal-pos *pos*) + (map unicode-piece *pos*) (c960))) diff --git a/Task/Generate-lower-case-ASCII-alphabet/8th/generate-lower-case-ascii-alphabet.8th b/Task/Generate-lower-case-ASCII-alphabet/8th/generate-lower-case-ascii-alphabet.8th new file mode 100644 index 0000000000..dbcdead320 --- /dev/null +++ b/Task/Generate-lower-case-ASCII-alphabet/8th/generate-lower-case-ascii-alphabet.8th @@ -0,0 +1,2 @@ +"" ( 'a n:+ s:+ ) 0 25 loop +. cr diff --git a/Task/Generate-lower-case-ASCII-alphabet/EchoLisp/generate-lower-case-ascii-alphabet.echolisp b/Task/Generate-lower-case-ASCII-alphabet/EchoLisp/generate-lower-case-ascii-alphabet.echolisp new file mode 100644 index 0000000000..efe48ede90 --- /dev/null +++ b/Task/Generate-lower-case-ASCII-alphabet/EchoLisp/generate-lower-case-ascii-alphabet.echolisp @@ -0,0 +1,14 @@ +;; 1) +(define \a (first (string->unicode "a"))) +(for/list ((i 25)) (unicode->string (+ i \a))) + → (a b c d e f g h i j k l m n o p q r s t u v w x y) + +;;2) using a sequence +(lib 'sequences) + +(take ["a" .. "z"] 26) + → (a b c d e f g h i j k l m n o p q r s t u v w x y z) + +; or +(for/string ((letter ["a" .. "z"])) letter) + → abcdefghijklmnopqrstuvwxyz diff --git a/Task/Generate-lower-case-ASCII-alphabet/FreeBASIC/generate-lower-case-ascii-alphabet.freebasic b/Task/Generate-lower-case-ASCII-alphabet/FreeBASIC/generate-lower-case-ascii-alphabet.freebasic new file mode 100644 index 0000000000..42b4faa3d5 --- /dev/null +++ b/Task/Generate-lower-case-ASCII-alphabet/FreeBASIC/generate-lower-case-ascii-alphabet.freebasic @@ -0,0 +1,14 @@ +' FB 1.05.0 Win64 + +' Create a string buffer to store the alphabet plus a final null byte +Dim alphabet As Zstring * 27 + +' ASCII codes for letters a to z are 97 to 122 respectively +For i As Integer = 0 To 25 + alphabet[i] = i + 97 +Next + +Print alphabet +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Generate-lower-case-ASCII-alphabet/LC3-Assembly/generate-lower-case-ascii-alphabet.lc3 b/Task/Generate-lower-case-ASCII-alphabet/LC3-Assembly/generate-lower-case-ascii-alphabet.lc3 new file mode 100644 index 0000000000..b65d4c0410 --- /dev/null +++ b/Task/Generate-lower-case-ASCII-alphabet/LC3-Assembly/generate-lower-case-ascii-alphabet.lc3 @@ -0,0 +1,15 @@ + .ORIG 0x3000 + + LD R0,ASCIIa + LD R1,ASCIIz + NOT R1,R1 + +LOOP OUT + ADD R0,R0,1 + ADD R2,R0,R1 + BRN LOOP + + HALT + +ASCIIa .FILL 0x61 +ASCIIz .FILL 0x7A diff --git a/Task/Generate-lower-case-ASCII-alphabet/Lingo/generate-lower-case-ascii-alphabet.lingo b/Task/Generate-lower-case-ASCII-alphabet/Lingo/generate-lower-case-ascii-alphabet.lingo new file mode 100644 index 0000000000..84e21392aa --- /dev/null +++ b/Task/Generate-lower-case-ASCII-alphabet/Lingo/generate-lower-case-ascii-alphabet.lingo @@ -0,0 +1,6 @@ +alphabet = [] +repeat with i = 97 to 122 + alphabet.add(numtochar(i)) +end repeat +put alphabet +-- ["a", "b", "c", ... , "x", "y", "z"] diff --git a/Task/Generate-lower-case-ASCII-alphabet/NESL/generate-lower-case-ascii-alphabet.nesl b/Task/Generate-lower-case-ASCII-alphabet/NESL/generate-lower-case-ascii-alphabet.nesl new file mode 100644 index 0000000000..d499abcddb --- /dev/null +++ b/Task/Generate-lower-case-ASCII-alphabet/NESL/generate-lower-case-ascii-alphabet.nesl @@ -0,0 +1 @@ +lower_case_ascii = {code_char(c) : c in [97:123]}; diff --git a/Task/Generate-lower-case-ASCII-alphabet/Nim/generate-lower-case-ascii-alphabet.nim b/Task/Generate-lower-case-ASCII-alphabet/Nim/generate-lower-case-ascii-alphabet.nim new file mode 100644 index 0000000000..e6f402c131 --- /dev/null +++ b/Task/Generate-lower-case-ASCII-alphabet/Nim/generate-lower-case-ascii-alphabet.nim @@ -0,0 +1,20 @@ +# A slice just contains the first and last value +let alpha: Slice[char] = 'a'..'z' +echo alpha # (a: a, b: z) + +# but can be used to check if a character is in it: +echo 'f' in alpha # true +echo 'G' in alpha # false + +# A set contains all elements as a bitvector: +let alphaSet: set[char] = {'a'..'z'} +echo alphaSet # {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z} +echo 'f' in alphaSet # true +var someChars = {'a','f','g'} +echo someChars <= alphaSet # true + +import sequtils +# A sequence: +let alphaSeq = toSeq 'a'..'z' +echo alphaSeq # @[a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z] +echo alphaSeq[10] # k diff --git a/Task/Generate-lower-case-ASCII-alphabet/Oforth/generate-lower-case-ascii-alphabet-1.oforth b/Task/Generate-lower-case-ASCII-alphabet/Oforth/generate-lower-case-ascii-alphabet-1.oforth new file mode 100644 index 0000000000..26bf1c4445 --- /dev/null +++ b/Task/Generate-lower-case-ASCII-alphabet/Oforth/generate-lower-case-ascii-alphabet-1.oforth @@ -0,0 +1 @@ +'a' 'z' seqFrom diff --git a/Task/Generate-lower-case-ASCII-alphabet/Oforth/generate-lower-case-ascii-alphabet-2.oforth b/Task/Generate-lower-case-ASCII-alphabet/Oforth/generate-lower-case-ascii-alphabet-2.oforth new file mode 100644 index 0000000000..ef043a960f --- /dev/null +++ b/Task/Generate-lower-case-ASCII-alphabet/Oforth/generate-lower-case-ascii-alphabet-2.oforth @@ -0,0 +1 @@ +StringBuffer new 'a' 'z' seqFrom apply(#<char x)))) + s)) + (add-chars 97 122 "")) diff --git a/Task/Generate-lower-case-ASCII-alphabet/jq/generate-lower-case-ascii-alphabet.jq b/Task/Generate-lower-case-ASCII-alphabet/jq/generate-lower-case-ascii-alphabet.jq new file mode 100644 index 0000000000..d9a3366d05 --- /dev/null +++ b/Task/Generate-lower-case-ASCII-alphabet/jq/generate-lower-case-ascii-alphabet.jq @@ -0,0 +1 @@ +"az" | explode | [range( .[0]; 1+.[1] )] | implode' diff --git a/Task/Generator-Exponential/EchoLisp/generator-exponential.echolisp b/Task/Generator-Exponential/EchoLisp/generator-exponential.echolisp new file mode 100644 index 0000000000..fa2463b783 --- /dev/null +++ b/Task/Generator-Exponential/EchoLisp/generator-exponential.echolisp @@ -0,0 +1,36 @@ +(lib 'tasks) ;; for make-generator + +;; generator of generators +(define (gen-power power) + (make-generator + (lambda(n) (yield (expt n power)) (1+ n)) 1)) + +(define powers-2 (gen-power 2)) +(define powers-3 (gen-power 3)) + +(take powers-3 10) + → (1 8 27 64 125 216 343 512 729 1000) + +;; generators substraction +;; input : two generators ga, gb - Sequences must be increasing +;; output : new generator = ga sequence minus gb sequence + +(define (gen-substract ga gb) + (define (substract b (a)) + (set! a (next ga)) + (while (>= a b) ; avance b until > a + (when (= a b) (set! a (next ga))) + (set! b (next gb))) + (yield a) + b ) ;; b := next state + (make-generator substract (next gb))) + +;; application +(define task (gen-substract (gen-power 2) (gen-power 3))) + +(drop task 20) +(take task 10) + → (529 576 625 676 784 841 900 961 1024 1089) + +; inspect +task → #generator:state: 1331 diff --git a/Task/Generator-Exponential/FunL/generator-exponential.funl b/Task/Generator-Exponential/FunL/generator-exponential.funl new file mode 100644 index 0000000000..710ec2de3f --- /dev/null +++ b/Task/Generator-Exponential/FunL/generator-exponential.funl @@ -0,0 +1,8 @@ +def powers( m ) = map( (^ m), 0.. ) + +def + filtered( s@sh:_, ch:ct ) | sh > ch = filtered( s, ct ) + filtered( sh:st, c@ch:_ ) | sh < ch = sh # filtered( st, c ) + filtered( _:st, c ) = filtered( st, c ) + +println( filtered(powers(2), powers(3)).drop(20).take(10) ) diff --git a/Task/Generator-Exponential/Nim/generator-exponential.nim b/Task/Generator-Exponential/Nim/generator-exponential.nim new file mode 100644 index 0000000000..5d2c7d0533 --- /dev/null +++ b/Task/Generator-Exponential/Nim/generator-exponential.nim @@ -0,0 +1,40 @@ +proc `^`*(base: int, exp: int): int = + var (base, exp) = (base, exp) + result = 1 + + while exp != 0: + if (exp and 1) != 0: + result *= base + exp = exp shr 1 + base *= base + +proc next(s): int = + for n in s(): return n + +proc powers(m): auto = + iterator it(): int{.closure.} = + for n in 0 .. f: + f = next(s2) + continue + elif v < f: + yield v + v = next(s1) + +var + squares = powers(2) + cubes = powers(3) + i = 1 +for x in filtered(squares, cubes): + if i > 20: + echo x + if i >= 30: + break + inc i diff --git a/Task/Generator-Exponential/Sidef/generator-exponential.sidef b/Task/Generator-Exponential/Sidef/generator-exponential.sidef new file mode 100644 index 0000000000..0199939d34 --- /dev/null +++ b/Task/Generator-Exponential/Sidef/generator-exponential.sidef @@ -0,0 +1,28 @@ +func gen_pow(m) { + var e = 0; + func { e++ ** m }; +} + +func gen_filter(g1, g2) { + var v2 = g2.run; + func { + loop { + var v1 = g1.run; + while (v1 > v2) { v2 = g2.run }; + v1 == v2 || return v1; + } + } +} + +# Create generators. +var squares = gen_pow(2); +var cubes = gen_pow(3); +var squares_without_cubes = gen_filter(squares, cubes); + +# Drop 20 values. +20.times { squares_without_cubes() }; + +# Print 10 values. +var answer = []; +10.times { answer.append(squares_without_cubes()) }; +say answer; diff --git a/Task/Generator-Exponential/Swift/generator-exponential.swift b/Task/Generator-Exponential/Swift/generator-exponential.swift new file mode 100644 index 0000000000..4c7da3ca76 --- /dev/null +++ b/Task/Generator-Exponential/Swift/generator-exponential.swift @@ -0,0 +1,47 @@ +func powGen(m: Int) -> GeneratorOf { + let power = Double(m) + var cur: Double = 0 + return GeneratorOf { Int(pow(cur++, power)) } +} + +var squares = powGen(2) +var cubes = powGen(3) + +var nCube = cubes.next() + +var filteredSqs = GeneratorOf { + for var nSq = squares.next() ;; nCube = cubes.next() { + if nCube > nSq { + return nSq + } else if nCube == nSq { + nSq = squares.next() + } + } +} + +extension GeneratorOf { + func drop(n: Int) -> GeneratorOf { + var g = self + for _ in 0.. GeneratorOf { + var (i, g) = (0, self) + return GeneratorOf{++i > n ? nil : g.next()} + } +} + +for num in filteredSqs.drop(20).take(10) { + print(num) +} + +//529 +//576 +//625 +//676 +//784 +//841 +//900 +//961 +//1024 +//1089 diff --git a/Task/Generator-Exponential/jq/generator-exponential-1.jq b/Task/Generator-Exponential/jq/generator-exponential-1.jq new file mode 100644 index 0000000000..3454c8fd67 --- /dev/null +++ b/Task/Generator-Exponential/jq/generator-exponential-1.jq @@ -0,0 +1,5 @@ +# Compute self^m where m is a non-negative integer: +def pow(m): . as $in | reduce range(0;m) as $i (1; .*$in); + +# state: [i, i^m] +def next_power(m): .[0] + 1 | [., pow(m) ]; diff --git a/Task/Generator-Exponential/jq/generator-exponential-2.jq b/Task/Generator-Exponential/jq/generator-exponential-2.jq new file mode 100644 index 0000000000..ce7591841f --- /dev/null +++ b/Task/Generator-Exponential/jq/generator-exponential-2.jq @@ -0,0 +1,7 @@ +# skip m states, and return the next state +def skip(m; next): + if m <= 0 then . else next | skip(m-1; next) end; + +# emit m states including the initial state +def emit(m; next): + if m <= 0 then empty else ., (next | emit(m-1; next)) end; diff --git a/Task/Generator-Exponential/jq/generator-exponential-3.jq b/Task/Generator-Exponential/jq/generator-exponential-3.jq new file mode 100644 index 0000000000..a177e58b31 --- /dev/null +++ b/Task/Generator-Exponential/jq/generator-exponential-3.jq @@ -0,0 +1,5 @@ +# Generate the first 4 values in the sequence i^2: +[0,0] | emit(4; next_power(2)) | .[1] + +# Generate all the values in the sequence i^3 less than 100: +[0,0] | recurse(next_power(3) | if .[1] < 100 then . else empty end) | .[1] diff --git a/Task/Generator-Exponential/jq/generator-exponential-4.jq b/Task/Generator-Exponential/jq/generator-exponential-4.jq new file mode 100644 index 0000000000..203c29a6ae --- /dev/null +++ b/Task/Generator-Exponential/jq/generator-exponential-4.jq @@ -0,0 +1,27 @@ +# Infrastructure: +def last(f): reduce f as $i (null; $i); + +# emit the last value that satisfies condition, or null +def while(condition; next): + def w: if condition then ., (next|w) else empty end; + last(w); + +# Powers of m1 that are not also powers of m2. +# filtered_next_power(m1;m2) produces [[i, i^m1], [j, j^m1]] where i^m1 +# is not a power of m2 and j^m2 < i^m1 +# +def filtered_next_power(m1; m2): + if . then . else [[0,0],[0,0]] end + | (.[0] | next_power(m1)) as $next1 + | (.[1] | while( .[1] <= $next1[1]; next_power(m2))) as $next2 + | if $next1[1] == $next2[1] + then [$next1, $next2] | filtered_next_power(m1;m2) + else [$next1, $next2] + end ; + +# Emit ten powers of 2 that are NOT powers of 3, +# skipping the first 20 integers satisfying the condition, including 0. +filtered_next_power(2;3) + | skip(20; filtered_next_power(2;3)) + | emit(10; filtered_next_power(2;3)) + | .[0][1] diff --git a/Task/Generator-Exponential/jq/generator-exponential-5.jq b/Task/Generator-Exponential/jq/generator-exponential-5.jq new file mode 100644 index 0000000000..16ef8c05c7 --- /dev/null +++ b/Task/Generator-Exponential/jq/generator-exponential-5.jq @@ -0,0 +1,11 @@ +$ jq -n -f generators.jq +529 +576 +625 +676 +784 +841 +900 +961 +1024 +1089 diff --git a/Task/Generic-swap/8th/generic-swap-1.8th b/Task/Generic-swap/8th/generic-swap-1.8th new file mode 100644 index 0000000000..c57f82380d --- /dev/null +++ b/Task/Generic-swap/8th/generic-swap-1.8th @@ -0,0 +1 @@ +swap diff --git a/Task/Generic-swap/8th/generic-swap-2.8th b/Task/Generic-swap/8th/generic-swap-2.8th new file mode 100644 index 0000000000..993f4ab7ed --- /dev/null +++ b/Task/Generic-swap/8th/generic-swap-2.8th @@ -0,0 +1 @@ +dup @ -rot ! diff --git a/Task/Generic-swap/Arc/generic-swap.arc b/Task/Generic-swap/Arc/generic-swap.arc new file mode 100644 index 0000000000..2bb54c1b7d --- /dev/null +++ b/Task/Generic-swap/Arc/generic-swap.arc @@ -0,0 +1,10 @@ +(mac myswap (a b) + (w/uniq gx + `(let ,gx a + (= a b) + (= b ,gx)))) + +(with (a 1 + b 2) + (myswap a b) + (prn "a:" a #\Newline "b:" b)) diff --git a/Task/Generic-swap/Axe/generic-swap.axe b/Task/Generic-swap/Axe/generic-swap.axe new file mode 100644 index 0000000000..9c34ab83c8 --- /dev/null +++ b/Task/Generic-swap/Axe/generic-swap.axe @@ -0,0 +1 @@ +Exch(°A,°B,2) diff --git a/Task/Generic-swap/EchoLisp/generic-swap.echolisp b/Task/Generic-swap/EchoLisp/generic-swap.echolisp new file mode 100644 index 0000000000..7441a8f330 --- /dev/null +++ b/Task/Generic-swap/EchoLisp/generic-swap.echolisp @@ -0,0 +1,20 @@ +;; 1) +;; a macro will do it, as shown in Racket (same syntax) +(define-syntax-rule (swap a b) + (let ([tmp a]) + (set! a b) + (set! b tmp))) + +(define A 666) +(define B "simon") +(swap A B) +A → "simon" +B → 666 + +;; 2) +;; The list-swap! function allows to swap two items inside a list, regardless of their types +;; This physically alters the list + +(define L ' ( 1 2 3 4 🎩 )) +(list-swap! L 1 ' 🎩 ) + → (🎩 2 3 4 1) diff --git a/Task/Generic-swap/FreeBASIC/generic-swap.freebasic b/Task/Generic-swap/FreeBASIC/generic-swap.freebasic new file mode 100644 index 0000000000..1c9a85be1d --- /dev/null +++ b/Task/Generic-swap/FreeBASIC/generic-swap.freebasic @@ -0,0 +1,26 @@ +' FB 1.05.0 +#Macro Declare_Swap(T) +Sub Swap_##T(ByRef t1 As T, ByRef t2 As T) + Dim temp As T = t2 + t2 = t1 + t1 = temp +End Sub +#EndMacro + +Dim As Integer i, j +i = 1 : j = 2 + +Declare_Swap(Integer) ' expands the macro +Swap_Integer(i, j) +Print i, j + +Dim As String s, t +s = "Hello" : t = "World" + +Declare_Swap(String) +Swap_String(s, t) +Print s, t + +Print +Print "Press any key to exit" +Sleep diff --git a/Task/Generic-swap/FutureBasic/generic-swap.futurebasic b/Task/Generic-swap/FutureBasic/generic-swap.futurebasic new file mode 100644 index 0000000000..d9d135bbf4 --- /dev/null +++ b/Task/Generic-swap/FutureBasic/generic-swap.futurebasic @@ -0,0 +1,22 @@ +include "ConsoleWindow" + +dim as long i, j +dim as double x, y +dim as Str15 a, b + +i = 1059 : j = 62 +print i, j +swap i, j +print i, j +print + +x = 1.23 : y = 4.56 +print x, y +swap x, y +print x, y +print + +a = "Hello" : b = "World!" +print a, b +swap a, b +print a, b diff --git a/Task/Generic-swap/Gri/generic-swap-1.gri b/Task/Generic-swap/Gri/generic-swap-1.gri new file mode 100644 index 0000000000..e18b3cf189 --- /dev/null +++ b/Task/Generic-swap/Gri/generic-swap-1.gri @@ -0,0 +1,15 @@ +`Swap Vars &.a. &.b.' +{ + new .temp. + .temp. = \.word2. + \.word2. = \.word3. + \.word3. = .temp. + delete .temp. +} + +.foo. = 123 +.bar. = 456 +Swap Vars &.foo. &.bar. + +show .foo. " " .bar. +# prints "456 123" diff --git a/Task/Generic-swap/Gri/generic-swap-2.gri b/Task/Generic-swap/Gri/generic-swap-2.gri new file mode 100644 index 0000000000..bd017da458 --- /dev/null +++ b/Task/Generic-swap/Gri/generic-swap-2.gri @@ -0,0 +1,15 @@ +`Swap Syns &\a &\b' +{ + new \temp + \temp = "\.word2." + \.word2. = "\.word3." + \.word3. = "\temp" + delete \temp +} + +\quux = "one" +\xyzzy = "two" +Swap Syns &\quux &\xyzzy + +show "\quux \xyzzy" +# prints "two one" diff --git a/Task/Generic-swap/Lasso/generic-swap-1.lasso b/Task/Generic-swap/Lasso/generic-swap-1.lasso new file mode 100644 index 0000000000..76028d89ca --- /dev/null +++ b/Task/Generic-swap/Lasso/generic-swap-1.lasso @@ -0,0 +1,8 @@ +define swap(a, b) => (: #b, #a) + +local(a) = 'foo' +local(b) = 42 + +local(a,b) = swap(#a, #b) +stdoutnl(#a) +stdoutnl(#b) diff --git a/Task/Generic-swap/Lasso/generic-swap-2.lasso b/Task/Generic-swap/Lasso/generic-swap-2.lasso new file mode 100644 index 0000000000..00db9835c8 --- /dev/null +++ b/Task/Generic-swap/Lasso/generic-swap-2.lasso @@ -0,0 +1,5 @@ +local(a) = 'hair' +local(b) = 'moose' +local(a,b) = (: #b, #a) +stdoutnl(#a) +stdoutnl(#b) diff --git a/Task/Generic-swap/Lingo/generic-swap-1.lingo b/Task/Generic-swap/Lingo/generic-swap-1.lingo new file mode 100644 index 0000000000..c8d4bf7f00 --- /dev/null +++ b/Task/Generic-swap/Lingo/generic-swap-1.lingo @@ -0,0 +1,3 @@ +on swap (x, y) + return "tmp="&x&RETURN&x&"="&y&RETURN&y&"=tmp" +end diff --git a/Task/Generic-swap/Lingo/generic-swap-2.lingo b/Task/Generic-swap/Lingo/generic-swap-2.lingo new file mode 100644 index 0000000000..d9c6c00e63 --- /dev/null +++ b/Task/Generic-swap/Lingo/generic-swap-2.lingo @@ -0,0 +1,5 @@ +x = 1 +y = 2 +do(swap("x","y")) +put x, y +-- 2 1 diff --git a/Task/Generic-swap/LiveCode/generic-swap.livecode b/Task/Generic-swap/LiveCode/generic-swap.livecode new file mode 100644 index 0000000000..1671ddac09 --- /dev/null +++ b/Task/Generic-swap/LiveCode/generic-swap.livecode @@ -0,0 +1,10 @@ +put "first" into a1 +put "last" into b2 +swap a1,b2 +put a1 && b2 + +command swap @p1, @p2 + put p2 into p3 + put p1 into p2 + put p3 into p1 +end swap diff --git a/Task/Generic-swap/Nim/generic-swap.nim b/Task/Generic-swap/Nim/generic-swap.nim new file mode 100644 index 0000000000..0a57ac0104 --- /dev/null +++ b/Task/Generic-swap/Nim/generic-swap.nim @@ -0,0 +1 @@ +swap(a, b) diff --git a/Task/Generic-swap/Oforth/generic-swap.oforth b/Task/Generic-swap/Oforth/generic-swap.oforth new file mode 100644 index 0000000000..c57f82380d --- /dev/null +++ b/Task/Generic-swap/Oforth/generic-swap.oforth @@ -0,0 +1 @@ +swap diff --git a/Task/Generic-swap/Phix/generic-swap.phix b/Task/Generic-swap/Phix/generic-swap.phix new file mode 100644 index 0000000000..ff7b68c603 --- /dev/null +++ b/Task/Generic-swap/Phix/generic-swap.phix @@ -0,0 +1 @@ +{a,b} = {b,a} diff --git a/Task/Generic-swap/Ring/generic-swap.ring b/Task/Generic-swap/Ring/generic-swap.ring new file mode 100644 index 0000000000..41b38c38ae --- /dev/null +++ b/Task/Generic-swap/Ring/generic-swap.ring @@ -0,0 +1,7 @@ +a = 1 +b = 2 +temp = a +a = b +b = temp +see "a = " + a + nl +see "b = " + b + nl diff --git a/Task/Generic-swap/Sidef/generic-swap-1.sidef b/Task/Generic-swap/Sidef/generic-swap-1.sidef new file mode 100644 index 0000000000..3e2ed356e8 --- /dev/null +++ b/Task/Generic-swap/Sidef/generic-swap-1.sidef @@ -0,0 +1,5 @@ +func swap(Ref a, Ref b) { + var tmp = *a; + *a = *b; + *b = tmp; +} diff --git a/Task/Generic-swap/Sidef/generic-swap-2.sidef b/Task/Generic-swap/Sidef/generic-swap-2.sidef new file mode 100644 index 0000000000..f75139f0c9 --- /dev/null +++ b/Task/Generic-swap/Sidef/generic-swap-2.sidef @@ -0,0 +1,3 @@ +func swap(Ref a, Ref b) { + (*a, *b) = (*b, *a); +} diff --git a/Task/Generic-swap/Sidef/generic-swap-3.sidef b/Task/Generic-swap/Sidef/generic-swap-3.sidef new file mode 100644 index 0000000000..373e042639 --- /dev/null +++ b/Task/Generic-swap/Sidef/generic-swap-3.sidef @@ -0,0 +1,3 @@ +func swap(Ref a, Ref b) { + [*a, *b] » (b, a); +} diff --git a/Task/Generic-swap/Sidef/generic-swap-4.sidef b/Task/Generic-swap/Sidef/generic-swap-4.sidef new file mode 100644 index 0000000000..aad54a045e --- /dev/null +++ b/Task/Generic-swap/Sidef/generic-swap-4.sidef @@ -0,0 +1,2 @@ +var (x, y) = (1, 2); +swap(\x, \y); diff --git a/Task/Generic-swap/Swift/generic-swap.swift b/Task/Generic-swap/Swift/generic-swap.swift new file mode 100644 index 0000000000..b67783f266 --- /dev/null +++ b/Task/Generic-swap/Swift/generic-swap.swift @@ -0,0 +1,3 @@ +func swap(inout a: T, inout b: T) { + (a, b) = (b, a) +} diff --git a/Task/Generic-swap/Visual-FoxPro/generic-swap.visual b/Task/Generic-swap/Visual-FoxPro/generic-swap.visual new file mode 100644 index 0000000000..ea24751a0b --- /dev/null +++ b/Task/Generic-swap/Visual-FoxPro/generic-swap.visual @@ -0,0 +1,15 @@ + *!* Swap two variables + LOCAL a, b + a = 1 + b = "Hallo" + ? a, b + *!* Pass a and b by reference + Swap(@a, @b) + ? a, b + +PROCEDURE Swap(v1, v2) +LOCAL dum +dum = v1 +v1 = v2 +v2 = dum +ENDPROC diff --git a/Task/Generic-swap/Wart/generic-swap-1.wart b/Task/Generic-swap/Wart/generic-swap-1.wart new file mode 100644 index 0000000000..c6ae9798ae --- /dev/null +++ b/Task/Generic-swap/Wart/generic-swap-1.wart @@ -0,0 +1 @@ +(swap! x y) diff --git a/Task/Generic-swap/Wart/generic-swap-2.wart b/Task/Generic-swap/Wart/generic-swap-2.wart new file mode 100644 index 0000000000..3bfeae0c03 --- /dev/null +++ b/Task/Generic-swap/Wart/generic-swap-2.wart @@ -0,0 +1,2 @@ +let (x y) (list y x) + ... diff --git a/Task/Generic-swap/jq/generic-swap-1.jq b/Task/Generic-swap/jq/generic-swap-1.jq new file mode 100644 index 0000000000..caf53e505b --- /dev/null +++ b/Task/Generic-swap/jq/generic-swap-1.jq @@ -0,0 +1 @@ +jq -n '1 as $a | 2 as $b | $a as $tmp | $b as $a | $tmp as $b | [$a,$b]' diff --git a/Task/Generic-swap/jq/generic-swap-2.jq b/Task/Generic-swap/jq/generic-swap-2.jq new file mode 100644 index 0000000000..3ddc7c0f63 --- /dev/null +++ b/Task/Generic-swap/jq/generic-swap-2.jq @@ -0,0 +1 @@ +reverse diff --git a/Task/Generic-swap/jq/generic-swap-3.jq b/Task/Generic-swap/jq/generic-swap-3.jq new file mode 100644 index 0000000000..45b2d1808a --- /dev/null +++ b/Task/Generic-swap/jq/generic-swap-3.jq @@ -0,0 +1 @@ +def swap(i;j): .[i] as $t | .[i] = .[j] | .[j] = $t; diff --git a/Task/Globally-replace-text-in-several-files/Lasso/globally-replace-text-in-several-files.lasso b/Task/Globally-replace-text-in-several-files/Lasso/globally-replace-text-in-several-files.lasso new file mode 100644 index 0000000000..53036dae1b --- /dev/null +++ b/Task/Globally-replace-text-in-several-files/Lasso/globally-replace-text-in-several-files.lasso @@ -0,0 +1,14 @@ +#!/usr/bin/lasso9 + +local(files = array('f1.txt', 'f2.txt')) + +with filename in #files +let file = file(#filename) +let content = #file -> readbytes +do { + #file -> dowithclose => { + #content -> replace('Goodbye London!', 'Hello New York!') + #file -> opentruncate + #file -> writebytes(#content) + } +} diff --git a/Task/Globally-replace-text-in-several-files/Nim/globally-replace-text-in-several-files.nim b/Task/Globally-replace-text-in-several-files/Nim/globally-replace-text-in-several-files.nim new file mode 100644 index 0000000000..004d19d80b --- /dev/null +++ b/Task/Globally-replace-text-in-several-files/Nim/globally-replace-text-in-several-files.nim @@ -0,0 +1,7 @@ +import strutils + +var fr = "Goodbye London!" +var to = "Hello, New York!" + +for fn in ["a.txt", "b.txt", "c.txt"]: + fn.writeFile fn.readFile.replace(fr, to) diff --git a/Task/Globally-replace-text-in-several-files/Ring/globally-replace-text-in-several-files.ring b/Task/Globally-replace-text-in-several-files/Ring/globally-replace-text-in-several-files.ring new file mode 100644 index 0000000000..bdbf31c351 --- /dev/null +++ b/Task/Globally-replace-text-in-several-files/Ring/globally-replace-text-in-several-files.ring @@ -0,0 +1,20 @@ +filenames = ["ReadMe.txt", "ReadMe2.txt"] + +for fn in filenames + fp = fopen(fn,"r") + str = fread(fp,getFileSize(fp)) + str = substr(str, "Greetings", "Hello") + fclose(fp) + + fp = fopen(fn,"w") + fwrite(fp, str) + fclose(fp) +next + +func getFileSize fp + C_FILESTART = 0 + C_FILEEND = 2 + fseek(fp,0,C_FILEEND) + nFileSize = ftell(fp) + fseek(fp,0,C_FILESTART) + return nFileSize diff --git a/Task/Globally-replace-text-in-several-files/Sidef/globally-replace-text-in-several-files.sidef b/Task/Globally-replace-text-in-several-files/Sidef/globally-replace-text-in-several-files.sidef new file mode 100644 index 0000000000..90a7f91c94 --- /dev/null +++ b/Task/Globally-replace-text-in-several-files/Sidef/globally-replace-text-in-several-files.sidef @@ -0,0 +1,11 @@ +var files = %w( + a.txt + b.txt + c.txt + ); + +files.map{.to_file}.each { |file| + say file.edit { |line| + line.gsub("Goodbye London!", "Hello New York!"); + }; +} diff --git a/Task/Gray-code/Nim/gray-code-1.nim b/Task/Gray-code/Nim/gray-code-1.nim new file mode 100644 index 0000000000..b33ea7ee2e --- /dev/null +++ b/Task/Gray-code/Nim/gray-code-1.nim @@ -0,0 +1,9 @@ +proc grayEncode(n): auto = + n xor (n shr 1) + +proc grayDecode(n): auto = + result = n + var t = n + while t > 0: + t = t shr 1 + result = result xor t diff --git a/Task/Gray-code/Nim/gray-code-2.nim b/Task/Gray-code/Nim/gray-code-2.nim new file mode 100644 index 0000000000..574bfdbf9d --- /dev/null +++ b/Task/Gray-code/Nim/gray-code-2.nim @@ -0,0 +1,4 @@ +import strutils + +for i in 0 .. 32: + echo i, " => ", toBin(grayEncode(i), 6), " => ", grayDecode(grayEncode(i)) diff --git a/Task/Gray-code/Phix/gray-code.phix b/Task/Gray-code/Phix/gray-code.phix new file mode 100644 index 0000000000..2b051a7f53 --- /dev/null +++ b/Task/Gray-code/Phix/gray-code.phix @@ -0,0 +1,21 @@ +function gray_encode(integer n) + return xor_bits(n,floor(n/2)) +end function + +function gray_decode(integer n) +integer r = 0 + while n>0 do + r = xor_bits(r,n) + n = floor(n/2) + end while + return r +end function + +integer e,d +puts(1," N Binary Gray Decoded\n"& + "== ===== ===== =======\n") +for i=0 to 31 do + e = gray_encode(i) + d = gray_decode(e) + printf(1,"%2d %05b %05b %2d\n",{i,i,e,d}) +end for diff --git a/Task/Gray-code/Sidef/gray-code.sidef b/Task/Gray-code/Sidef/gray-code.sidef new file mode 100644 index 0000000000..9cad9c2366 --- /dev/null +++ b/Task/Gray-code/Sidef/gray-code.sidef @@ -0,0 +1,14 @@ +func bin2gray(n) { + n ^ (n >> 1); +} + +func gray2bin(num) { + var bin = num; + while (num >>= 1) { bin ^= num }; + return bin; +} + +0..31 -> each { |i| + var gr = bin2gray(i); + printf("%d\t%b\t%b\t%b\n", i, i, gr, gray2bin(gr)); +} diff --git a/Task/Grayscale-image/Lingo/grayscale-image.lingo b/Task/Grayscale-image/Lingo/grayscale-image.lingo new file mode 100644 index 0000000000..5f4e636179 --- /dev/null +++ b/Task/Grayscale-image/Lingo/grayscale-image.lingo @@ -0,0 +1,19 @@ +on rgbToGrayscaleImageFast (img) + res = image(img.width, img.height, 8) + res.paletteRef = #grayScale + res.copyPixels(img, img.rect, img.rect) + return res +end + +on rgbToGrayscaleImageCustom (img) + res = image(img.width, img.height, 8) + res.paletteRef = #grayScale + repeat with x = 0 to img.width-1 + repeat with y = 0 to img.height-1 + c = img.getPixel(x,y) + n = c.red*0.2126 + c.green*0.7152 + c.blue*0.0722 + res.setPixel(x,y, color(256-n)) + end repeat + end repeat + return res +end diff --git a/Task/Grayscale-image/Phix/grayscale-image.phix b/Task/Grayscale-image/Phix/grayscale-image.phix new file mode 100644 index 0000000000..dca97b42e3 --- /dev/null +++ b/Task/Grayscale-image/Phix/grayscale-image.phix @@ -0,0 +1,15 @@ +function to_gray(sequence image) +sequence color + for i=1 to length(image) do + for j=1 to length(image[i]) do + -- unpack color triple + color = sq_div(sq_and_bits(image[i][j], {#FF0000,#FF00,#FF}), + {#010000,#0100,#01}) + image[i][j] = floor(0.2126*color[1] + 0.7152*color[2] + 0.0722*color[3])*#010101 + end for + end for + return image +end function + +sequence img = read_ppm("Lena.ppm") + img = to_gray(img) diff --git a/Task/Grayscale-image/Sidef/grayscale-image.sidef b/Task/Grayscale-image/Sidef/grayscale-image.sidef new file mode 100644 index 0000000000..db1b5a5383 --- /dev/null +++ b/Task/Grayscale-image/Sidef/grayscale-image.sidef @@ -0,0 +1,19 @@ +require('Image::Imlib2') + +func tograyscale(img) { + var (width, height) = (img.width, img.height) + var gimg = %s'Image::Imlib2'.new(width, height) + for y,x in (^height ~X ^width) { + var (r, g, b) = img.query_pixel(x, y) + var gray = int(0.2126*r + 0.7152*g + 0.0722*b) + gimg.set_color(gray, gray, gray, 255) + gimg.draw_point(x, y) + } + return gimg +} + +var (input='input.png', output='output.png') = ARGV... +var image = %s'Image::Imlib2'.load(input) +var gscale = tograyscale(image) +gscale.set_quality(80) +gscale.save(output) diff --git a/Task/Greatest-common-divisor/8th/greatest-common-divisor.8th b/Task/Greatest-common-divisor/8th/greatest-common-divisor.8th new file mode 100644 index 0000000000..8ad72af907 --- /dev/null +++ b/Task/Greatest-common-divisor/8th/greatest-common-divisor.8th @@ -0,0 +1,14 @@ +: gcd \ a b -- gcd + dup 0 n:= if drop ;; then + tuck \ b a b + n:mod \ b a-mod-b + recurse ; + +: demo \ a b -- + 2dup "GCD of " . . " and " . . " = " . gcd . ; + +100 5 demo cr + 5 100 demo cr + 7 23 demo cr + +bye diff --git a/Task/Greatest-common-divisor/AntLang/greatest-common-divisor-1.antlang b/Task/Greatest-common-divisor/AntLang/greatest-common-divisor-1.antlang new file mode 100644 index 0000000000..b6140bda4d --- /dev/null +++ b/Task/Greatest-common-divisor/AntLang/greatest-common-divisor-1.antlang @@ -0,0 +1 @@ +gcd[33; 77] diff --git a/Task/Greatest-common-divisor/AntLang/greatest-common-divisor-2.antlang b/Task/Greatest-common-divisor/AntLang/greatest-common-divisor-2.antlang new file mode 100644 index 0000000000..1e06629e8b --- /dev/null +++ b/Task/Greatest-common-divisor/AntLang/greatest-common-divisor-2.antlang @@ -0,0 +1,2 @@ +/Unoptimized version +gcd':{a:x;b:y;last[{(0 eq a mod x) min (0 eq b mod x)} hfilter {1 + x} map range[a max b]]} diff --git a/Task/Greatest-common-divisor/AntLang/greatest-common-divisor-3.antlang b/Task/Greatest-common-divisor/AntLang/greatest-common-divisor-3.antlang new file mode 100644 index 0000000000..63fb49c6e7 --- /dev/null +++ b/Task/Greatest-common-divisor/AntLang/greatest-common-divisor-3.antlang @@ -0,0 +1,12 @@ +-- gcd :: Int -> Int -> Int +on gcd(a, b) + if b ≠ 0 then + gcd(b, a mod b) + else + if a < 0 then + -a + else + a + end if + end if +end gcd diff --git a/Task/Greatest-common-divisor/AntLang/greatest-common-divisor-4.antlang b/Task/Greatest-common-divisor/AntLang/greatest-common-divisor-4.antlang new file mode 100644 index 0000000000..9a23e36738 --- /dev/null +++ b/Task/Greatest-common-divisor/AntLang/greatest-common-divisor-4.antlang @@ -0,0 +1,8 @@ +0 A = ABS(INT(A)) +1 B = ABS(INT(B)) +2 GCD = A * NOT NOT B +3 FOR B = B + A * NOT B TO 0 STEP 0 +4 A = GCD +5 GCD = B +6 B = A - INT (A / GCD) * GCD +7 NEXT B diff --git a/Task/Greatest-common-divisor/Axe/greatest-common-divisor.axe b/Task/Greatest-common-divisor/Axe/greatest-common-divisor.axe new file mode 100644 index 0000000000..0dbcf3c791 --- /dev/null +++ b/Task/Greatest-common-divisor/Axe/greatest-common-divisor.axe @@ -0,0 +1,8 @@ +Lbl GCD +r₁→A +r₂→B +!If B + A + Return +End +GCD(B,A^B) diff --git a/Task/Greatest-common-divisor/ERRE/greatest-common-divisor.erre b/Task/Greatest-common-divisor/ERRE/greatest-common-divisor.erre new file mode 100644 index 0000000000..19f24a3e59 --- /dev/null +++ b/Task/Greatest-common-divisor/ERRE/greatest-common-divisor.erre @@ -0,0 +1,21 @@ +PROGRAM EUCLIDE +! calculate G.C.D. between two integer numbers +! using Euclidean algorithm + +!VAR J%,K%,MCD%,A%,B% + +BEGIN + PRINT(CHR$(12);"Input two numbers : ";) !CHR$(147) in C-64 version + INPUT(J%,K%) + A%=J% B%=K% + WHILE A%<>B% DO + IF A%>B% + THEN + A%=A%-B% + ELSE + B%=B%-A% + END IF + END WHILE + MCD%=A% + PRINT("G.C.D. between";J%;"and";K%;"is";MCD%) +END PROGRAM diff --git a/Task/Greatest-common-divisor/Ezhil/greatest-common-divisor.ezhil b/Task/Greatest-common-divisor/Ezhil/greatest-common-divisor.ezhil new file mode 100644 index 0000000000..ae91b8b2b3 --- /dev/null +++ b/Task/Greatest-common-divisor/Ezhil/greatest-common-divisor.ezhil @@ -0,0 +1,60 @@ +## இந்த நிரல் இரு எண்களுக்கு இடையிலான மீச்சிறு பொது மடங்கு (LCM), மீப்பெரு பொது வகுத்தி (GCD) என்ன என்று கணக்கிடும் + +நிரல்பாகம் மீபொவ(எண்1, எண்2) + + @(எண்1 == எண்2) ஆனால் + + ## இரு எண்களும் சமம் என்பதால், அந்த எண்ணேதான் அதன் மீபொவ + + பின்கொடு எண்1 + + @(எண்1 > எண்2) இல்லைஆனால் + + சிறியது = எண்2 + பெரியது = எண்1 + + இல்லை + + சிறியது = எண்1 + பெரியது = எண்2 + + முடி + + மீதம் = பெரியது % சிறியது + + @(மீதம் == 0) ஆனால் + + ## பெரிய எண்ணில் சிறிய எண் மீதமின்றி வகுபடுவதால், சிறிய எண்தான் மீப்பெரு பொதுவகுத்தியாக இருக்கமுடியும் + + பின்கொடு சிறியது + + இல்லை + + தொடக்கம் = சிறியது - 1 + + நிறைவு = 1 + + @(எண் = தொடக்கம், எண் >= நிறைவு, எண் = எண் - 1) ஆக + + மீதம்1 = சிறியது % எண் + + மீதம்2 = பெரியது % எண் + + ## இரு எண்களையும் மீதமின்றி வகுக்கக்கூடிய பெரிய எண்ணைக் கண்டறிகிறோம் + + @((மீதம்1 == 0) && (மீதம்2 == 0)) ஆனால் + + பின்கொடு எண் + + முடி + + முடி + + முடி + +முடி + +அ = int(உள்ளீடு("ஓர் எண்ணைத் தாருங்கள் ")) +ஆ = int(உள்ளீடு("இன்னோர் எண்ணைத் தாருங்கள் ")) + +பதிப்பி "நீங்கள் தந்த இரு எண்களின் மீபொவ (மீப்பெரு பொது வகுத்தி, GCD) = ", மீபொவ(அ, ஆ) diff --git a/Task/Greatest-common-divisor/FreeBASIC/greatest-common-divisor.freebasic b/Task/Greatest-common-divisor/FreeBASIC/greatest-common-divisor.freebasic new file mode 100644 index 0000000000..d47d1cc17c --- /dev/null +++ b/Task/Greatest-common-divisor/FreeBASIC/greatest-common-divisor.freebasic @@ -0,0 +1,30 @@ +' version 17-06-2015 +' compile with: fbc -s console + +Function gcd(x As ULongInt, y As ULongInt) As ULongInt + + Dim As ULongInt t + + While y + t = y + y = x Mod y + x = t + Wend + + Return x + +End Function + +' ------=< MAIN >=------ + +Dim As ULongInt a = 111111111111111 +Dim As ULongInt b = 11111 + +Print : Print "GCD(";a;", ";b;") = "; gcd(a, b) +Print : Print "GCD(";a;", 111) = "; gcd(a, 111) + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Greatest-common-divisor/FunL/greatest-common-divisor-1.funl b/Task/Greatest-common-divisor/FunL/greatest-common-divisor-1.funl new file mode 100644 index 0000000000..d78f6e49b1 --- /dev/null +++ b/Task/Greatest-common-divisor/FunL/greatest-common-divisor-1.funl @@ -0,0 +1,8 @@ +def + gcd( 0, 0 ) = error( 'integers.gcd: gcd( 0, 0 ) is undefined' ) + gcd( a, b ) = + def + _gcd( a, 0 ) = a + _gcd( a, b ) = _gcd( b, a%b ) + + _gcd( abs(a), abs(b) ) diff --git a/Task/Greatest-common-divisor/FunL/greatest-common-divisor-2.funl b/Task/Greatest-common-divisor/FunL/greatest-common-divisor-2.funl new file mode 100644 index 0000000000..be3cb5fc2b --- /dev/null +++ b/Task/Greatest-common-divisor/FunL/greatest-common-divisor-2.funl @@ -0,0 +1,9 @@ +local fn gcd( a as long, b as long ) +dim as long result + +if ( b != 0 ) + result = fn gcd( b, a mod b) +else + result = abs(a) +end if +end fn = result diff --git a/Task/Greatest-common-divisor/FunL/greatest-common-divisor-3.funl b/Task/Greatest-common-divisor/FunL/greatest-common-divisor-3.funl new file mode 100644 index 0000000000..c4243cbd50 --- /dev/null +++ b/Task/Greatest-common-divisor/FunL/greatest-common-divisor-3.funl @@ -0,0 +1,19 @@ +# Built-in +GcdInt(35, 42); +# 7 + +# Euclidean algorithm +GcdInteger := function(a, b) + local c; + a := AbsInt(a); + b := AbsInt(b); + while b > 0 do + c := a; + a := b; + b := RemInt(c, b); + od; + return a; +end; + +GcdInteger(35, 42); +# 7 diff --git a/Task/Greatest-common-divisor/GFA-Basic/greatest-common-divisor.gfa b/Task/Greatest-common-divisor/GFA-Basic/greatest-common-divisor.gfa new file mode 100644 index 0000000000..c01e5bce3f --- /dev/null +++ b/Task/Greatest-common-divisor/GFA-Basic/greatest-common-divisor.gfa @@ -0,0 +1,20 @@ +' +' Greatest Common Divisor +' +a%=24 +b%=112 +PRINT "GCD of ";a%;" and ";b%;" is ";@gcd(a%,b%) +' +' Function computes gcd +' +FUNCTION gcd(a%,b%) + LOCAL t% + ' + WHILE b%<>0 + t%=a% + a%=b% + b%=t% MOD b% + WEND + ' + RETURN ABS(a%) +ENDFUNC diff --git a/Task/Greatest-common-divisor/LFE/greatest-common-divisor.lfe b/Task/Greatest-common-divisor/LFE/greatest-common-divisor.lfe new file mode 100644 index 0000000000..2d0bb4c883 --- /dev/null +++ b/Task/Greatest-common-divisor/LFE/greatest-common-divisor.lfe @@ -0,0 +1,4 @@ +> (defun gcd + "Get the greatest common divisor." + ((a 0) a) + ((a b) (gcd b (rem a b)))) diff --git a/Task/Greatest-common-divisor/LiveCode/greatest-common-divisor.livecode b/Task/Greatest-common-divisor/LiveCode/greatest-common-divisor.livecode new file mode 100644 index 0000000000..5c9f2292aa --- /dev/null +++ b/Task/Greatest-common-divisor/LiveCode/greatest-common-divisor.livecode @@ -0,0 +1,8 @@ +function gcd x,y + repeat until y = 0 + put x mod y into z + put y into x + put z into y + end repeat + return x +end gcd diff --git a/Task/Greatest-common-divisor/Luck/greatest-common-divisor.luck b/Task/Greatest-common-divisor/Luck/greatest-common-divisor.luck new file mode 100644 index 0000000000..12540ec1f0 --- /dev/null +++ b/Task/Greatest-common-divisor/Luck/greatest-common-divisor.luck @@ -0,0 +1,6 @@ +function gcd(a: int, b: int): int = ( + if a==0 then b + else if b==0 then a + else if a>b then gcd(b, a % b) + else gcd(a, b % a) +) diff --git a/Task/Greatest-common-divisor/MINIL/greatest-common-divisor.minil b/Task/Greatest-common-divisor/MINIL/greatest-common-divisor.minil new file mode 100644 index 0000000000..de234faef3 --- /dev/null +++ b/Task/Greatest-common-divisor/MINIL/greatest-common-divisor.minil @@ -0,0 +1,14 @@ +// Greatest common divisor +00 0E GCD: ENT R0 +01 1E ENT R1 +02 21 Again: R2 = R1 +03 10 Loop: R1 = R0 +04 02 R0 = R2 +05 2D Minus: DEC R2 +06 8A JZ Stop +07 1D DEC R1 +08 C5 JNZ Minus +09 83 JZ Loop +0A 1D Stop: DEC R1 +0B C2 JNZ Again +0C 80 JZ GCD // Display GCD in R0 diff --git a/Task/Greatest-common-divisor/Nim/greatest-common-divisor-1.nim b/Task/Greatest-common-divisor/Nim/greatest-common-divisor-1.nim new file mode 100644 index 0000000000..d142fd38b0 --- /dev/null +++ b/Task/Greatest-common-divisor/Nim/greatest-common-divisor-1.nim @@ -0,0 +1,5 @@ +proc gcd_recursive(u, v: int64): int64 = + if u %% v != 0: + result = gcd_recursive(v, u %% v) + else: + result = v diff --git a/Task/Greatest-common-divisor/Nim/greatest-common-divisor-2.nim b/Task/Greatest-common-divisor/Nim/greatest-common-divisor-2.nim new file mode 100644 index 0000000000..d4eacdbfe8 --- /dev/null +++ b/Task/Greatest-common-divisor/Nim/greatest-common-divisor-2.nim @@ -0,0 +1,9 @@ +proc gcd_iterative(u1, v1: int64): int64 = + var t: int64 = 0 + var u = u1 + var v = v1 + while v != 0: + t = u + u = v + v = t %% v + result = abs(u) diff --git a/Task/Greatest-common-divisor/Nim/greatest-common-divisor-3.nim b/Task/Greatest-common-divisor/Nim/greatest-common-divisor-3.nim new file mode 100644 index 0000000000..c6eb2b88b1 --- /dev/null +++ b/Task/Greatest-common-divisor/Nim/greatest-common-divisor-3.nim @@ -0,0 +1,35 @@ +proc gcd_binary(u1, v1: int64): int64 = + var t, k: int64 + var u = u1 + var v = v1 + u = abs(u) + v = abs(v) + if u < v: + t = u + u = v + v = t + if v == 0: + result = u + else: + k = 1 + while (u %% 2 == 0) and (v %% 2 == 0): + u = u shl 1 + v = v shl 1 + k = k shr 1 + if (u %% 2) == 0: + t = u + else: + t = -v + while t != 0: + while (t %% 2) == 0: + t = t div 2 + if t > 0: + u = t + else: + v = -t + t = u - v + result = u * k + +echo ("GCD(", 49865, ", ", 69811, "): ", gcd_iterative(49865, 69811), " (iterative)") +echo ("GCD(", 49865, ", ", 69811, "): ", gcd_recursive(49865, 69811), " (recursive)") +echo ("GCD(", 49865, ", ", 69811, "): ", gcd_binary (49865, 69811), " (binary)") diff --git a/Task/Greatest-common-divisor/Oforth/greatest-common-divisor-1.oforth b/Task/Greatest-common-divisor/Oforth/greatest-common-divisor-1.oforth new file mode 100644 index 0000000000..ae67a9452f --- /dev/null +++ b/Task/Greatest-common-divisor/Oforth/greatest-common-divisor-1.oforth @@ -0,0 +1 @@ +128 96 gcd diff --git a/Task/Greatest-common-divisor/Oforth/greatest-common-divisor-2.oforth b/Task/Greatest-common-divisor/Oforth/greatest-common-divisor-2.oforth new file mode 100644 index 0000000000..d508b62be6 --- /dev/null +++ b/Task/Greatest-common-divisor/Oforth/greatest-common-divisor-2.oforth @@ -0,0 +1 @@ +Integer method: gcd self while ( dup ) [ tuck mod ] drop ; diff --git a/Task/Greatest-common-divisor/Phix/greatest-common-divisor.phix b/Task/Greatest-common-divisor/Phix/greatest-common-divisor.phix new file mode 100644 index 0000000000..fe88aa890c --- /dev/null +++ b/Task/Greatest-common-divisor/Phix/greatest-common-divisor.phix @@ -0,0 +1,20 @@ +function gcd(object u, atom v=0) +atom t + if sequence(u) then + v = u[1] -- (for the typecheck) + t = floor(abs(v)) + for i=2 to length(u) do + v = u[i] -- (for the typecheck) + t = gcd(t,v) + end for + return t + end if + u = floor(abs(u)) + v = floor(abs(v)) + while v do + t = u + u = v + v = remainder(t, v) + end while + return u +end function diff --git a/Task/Greatest-common-divisor/Ring/greatest-common-divisor.ring b/Task/Greatest-common-divisor/Ring/greatest-common-divisor.ring new file mode 100644 index 0000000000..16f4f3551f --- /dev/null +++ b/Task/Greatest-common-divisor/Ring/greatest-common-divisor.ring @@ -0,0 +1,8 @@ +see gcd (24, 32) +func gcd gcd, b + while b + c = gcd + gcd = b + b = c % b + end + return gcd diff --git a/Task/Greatest-common-divisor/SequenceL/greatest-common-divisor.sequencel b/Task/Greatest-common-divisor/SequenceL/greatest-common-divisor.sequencel new file mode 100644 index 0000000000..fdc831e66a --- /dev/null +++ b/Task/Greatest-common-divisor/SequenceL/greatest-common-divisor.sequencel @@ -0,0 +1,4 @@ +gcd(a, b) := + a when b = 0 + else + gcd(b, a mod b); diff --git a/Task/Greatest-common-divisor/Sidef/greatest-common-divisor-1.sidef b/Task/Greatest-common-divisor/Sidef/greatest-common-divisor-1.sidef new file mode 100644 index 0000000000..1ae4e8fd3d --- /dev/null +++ b/Task/Greatest-common-divisor/Sidef/greatest-common-divisor-1.sidef @@ -0,0 +1,2 @@ +var arr = [100, 1_000, 10_000, 20]; +say Math.gcd(arr...); diff --git a/Task/Greatest-common-divisor/Sidef/greatest-common-divisor-2.sidef b/Task/Greatest-common-divisor/Sidef/greatest-common-divisor-2.sidef new file mode 100644 index 0000000000..59e06c842d --- /dev/null +++ b/Task/Greatest-common-divisor/Sidef/greatest-common-divisor-2.sidef @@ -0,0 +1,3 @@ +func gcd(a, b) { + b.is_zero ? a.abs : gcd(b, a % b); +} diff --git a/Task/Greatest-common-divisor/Sparkling/greatest-common-divisor.sparkling b/Task/Greatest-common-divisor/Sparkling/greatest-common-divisor.sparkling new file mode 100644 index 0000000000..a9948e74d5 --- /dev/null +++ b/Task/Greatest-common-divisor/Sparkling/greatest-common-divisor.sparkling @@ -0,0 +1,33 @@ +function factors(n) { + var f = {}; + + for var i = 2; n > 1; i++ { + while n % i == 0 { + n /= i; + f[i] = f[i] != nil ? f[i] + 1 : 1; + } + } + + return f; +} + +function GCD(n, k) { + let f1 = factors(n); + let f2 = factors(k); + + let fs = map(f1, function(factor, multiplicity) { + let m = f2[factor]; + return m == nil ? 0 : min(m, multiplicity); + }); + + let rfs = {}; + foreach(fs, function(k, v) { + rfs[sizeof rfs] = pow(k, v); + }); + + return reduce(rfs, 1, function(x, y) { return x * y; }); +} + +function LCM(n, k) { + return n * k / GCD(n, k); +} diff --git a/Task/Greatest-common-divisor/Swift/greatest-common-divisor.swift b/Task/Greatest-common-divisor/Swift/greatest-common-divisor.swift new file mode 100644 index 0000000000..6061407791 --- /dev/null +++ b/Task/Greatest-common-divisor/Swift/greatest-common-divisor.swift @@ -0,0 +1,36 @@ +// Iterative + +func gcd(var a: Int, var b: Int) -> Int { + + a = abs(a); b = abs(b) + + if (b > a) { swap(&a, &b) } + + while (b > 0) { (a, b) = (b, a % b) } + + return a +} + +// Recursive + +func gcdr (var a: Int, var b: Int) -> Int { + + a = abs(a); b = abs(b) + + if (b > a) { swap(&a, &b) } + + return gcd_rec(a,b) +} + + +private func gcd_rec(a: Int, b: Int) -> Int { + + return b == 0 ? a : gcd_rec(b, a % b) +} + + +for (a,b) in [(1,1), (100, -10), (10, -100), (-36, -17), (27, 18), (30, -42)] { + + println("Iterative: GCD of \(a) and \(b) is \(gcd(a, b))") + println("Recursive: GCD of \(a) and \(b) is \(gcdr(a, b))") +} diff --git a/Task/Greatest-common-divisor/TypeScript/greatest-common-divisor-1.type b/Task/Greatest-common-divisor/TypeScript/greatest-common-divisor-1.type new file mode 100644 index 0000000000..790332929f --- /dev/null +++ b/Task/Greatest-common-divisor/TypeScript/greatest-common-divisor-1.type @@ -0,0 +1,17 @@ +function gcd(a: number, b: number) { + a = Math.abs(a); + b = Math.abs(b); + + if (b > a) { + let temp = a; + a = b; + b = temp; + } + + while (true) { + a %= b; + if (a === 0) { return b; } + b %= a; + if (b === 0) { return a; } + } +} diff --git a/Task/Greatest-common-divisor/TypeScript/greatest-common-divisor-2.type b/Task/Greatest-common-divisor/TypeScript/greatest-common-divisor-2.type new file mode 100644 index 0000000000..99ee01665e --- /dev/null +++ b/Task/Greatest-common-divisor/TypeScript/greatest-common-divisor-2.type @@ -0,0 +1,3 @@ +function gcd_rec(a: number, b: number) { + return b ? gcd_rec(b, a % b) : Math.abs(a); +} diff --git a/Task/Greatest-common-divisor/Ursa/greatest-common-divisor.ursa b/Task/Greatest-common-divisor/Ursa/greatest-common-divisor.ursa new file mode 100644 index 0000000000..cab0334428 --- /dev/null +++ b/Task/Greatest-common-divisor/Ursa/greatest-common-divisor.ursa @@ -0,0 +1,2 @@ +import "math" +out (gcd 40902 24140) endl console diff --git a/Task/Greatest-common-divisor/Wortel/greatest-common-divisor-1.wortel b/Task/Greatest-common-divisor/Wortel/greatest-common-divisor-1.wortel new file mode 100644 index 0000000000..f5eb17cb3d --- /dev/null +++ b/Task/Greatest-common-divisor/Wortel/greatest-common-divisor-1.wortel @@ -0,0 +1 @@ +@gcd a b diff --git a/Task/Greatest-common-divisor/Wortel/greatest-common-divisor-2.wortel b/Task/Greatest-common-divisor/Wortel/greatest-common-divisor-2.wortel new file mode 100644 index 0000000000..c285c0dad1 --- /dev/null +++ b/Task/Greatest-common-divisor/Wortel/greatest-common-divisor-2.wortel @@ -0,0 +1 @@ +!#~kg a b diff --git a/Task/Greatest-common-divisor/Wortel/greatest-common-divisor-3.wortel b/Task/Greatest-common-divisor/Wortel/greatest-common-divisor-3.wortel new file mode 100644 index 0000000000..31c7f22411 --- /dev/null +++ b/Task/Greatest-common-divisor/Wortel/greatest-common-divisor-3.wortel @@ -0,0 +1 @@ +&[a b] [@vars[t] @while b @:{t b b %a b a t} a] diff --git a/Task/Greatest-common-divisor/Wortel/greatest-common-divisor-4.wortel b/Task/Greatest-common-divisor/Wortel/greatest-common-divisor-4.wortel new file mode 100644 index 0000000000..de6bfea043 --- /dev/null +++ b/Task/Greatest-common-divisor/Wortel/greatest-common-divisor-4.wortel @@ -0,0 +1 @@ +&{gcd a b} ?{b !!gcd b %a b @abs a} diff --git a/Task/Greatest-common-divisor/jq/greatest-common-divisor-1.jq b/Task/Greatest-common-divisor/jq/greatest-common-divisor-1.jq new file mode 100644 index 0000000000..32c6a94e4c --- /dev/null +++ b/Task/Greatest-common-divisor/jq/greatest-common-divisor-1.jq @@ -0,0 +1,4 @@ +def recursive_gcd(a; b): + if b == 0 then a + else recursive_gcd(b; a % b) + end ; diff --git a/Task/Greatest-common-divisor/jq/greatest-common-divisor-2.jq b/Task/Greatest-common-divisor/jq/greatest-common-divisor-2.jq new file mode 100644 index 0000000000..8423b1c9cd --- /dev/null +++ b/Task/Greatest-common-divisor/jq/greatest-common-divisor-2.jq @@ -0,0 +1,7 @@ +def gcd(a; b): + # The subfunction expects [a,b] as input + # i.e. a ~ .[0] and b ~ .[1] + def rgcd: if .[1] == 0 then .[0] + else [.[1], .[0] % .[1]] | rgcd + end; + [a,b] | rgcd ; diff --git a/Task/Greatest-element-of-a-list/8th/greatest-element-of-a-list.8th b/Task/Greatest-element-of-a-list/8th/greatest-element-of-a-list.8th new file mode 100644 index 0000000000..6c982646bb --- /dev/null +++ b/Task/Greatest-element-of-a-list/8th/greatest-element-of-a-list.8th @@ -0,0 +1 @@ +[ 1.0, 2.3, 1.1, 5.0, 3, 2.8, 2.01, 3.14159 ] ' n:max 0 a:reduce . cr diff --git a/Task/Greatest-element-of-a-list/AntLang/greatest-element-of-a-list.antlang b/Task/Greatest-element-of-a-list/AntLang/greatest-element-of-a-list.antlang new file mode 100644 index 0000000000..aefa84d480 --- /dev/null +++ b/Task/Greatest-element-of-a-list/AntLang/greatest-element-of-a-list.antlang @@ -0,0 +1 @@ +max|range[10] diff --git a/Task/Greatest-element-of-a-list/Axe/greatest-element-of-a-list.axe b/Task/Greatest-element-of-a-list/Axe/greatest-element-of-a-list.axe new file mode 100644 index 0000000000..61f25f3746 --- /dev/null +++ b/Task/Greatest-element-of-a-list/Axe/greatest-element-of-a-list.axe @@ -0,0 +1,7 @@ +Lbl MAX +0→M +While {r₁} + {r₁}>M?{r₁}→M +End +M +Return diff --git a/Task/Greatest-element-of-a-list/ECL/greatest-element-of-a-list.ecl b/Task/Greatest-element-of-a-list/ECL/greatest-element-of-a-list.ecl new file mode 100644 index 0000000000..25ba540487 --- /dev/null +++ b/Task/Greatest-element-of-a-list/ECL/greatest-element-of-a-list.ecl @@ -0,0 +1,6 @@ +MaxVal(SET OF INTEGER s) := MAX(s); + +//example usage + +SetVals := [4,8,16,2,1]; +MaxVal(SetVals) //returns 16; diff --git a/Task/Greatest-element-of-a-list/ERRE/greatest-element-of-a-list.erre b/Task/Greatest-element-of-a-list/ERRE/greatest-element-of-a-list.erre new file mode 100644 index 0000000000..2213399e57 --- /dev/null +++ b/Task/Greatest-element-of-a-list/ERRE/greatest-element-of-a-list.erre @@ -0,0 +1,24 @@ +PROGRAM MAXLIST + +! +! for rosettacode.org +! + +! VAR L$,EL$,CH$,I%,MAX + +BEGIN + PRINT(CHR$(12);) ! CLS + INPUT("Lista",L$) + L$=L$+CHR$(32) + MAX=-1.7E+38 + FOR I%=1 TO LEN(L$) DO + CH$=MID$(L$,I%,1) + IF CH$<>CHR$(32) THEN ! blank is separator + EL$=EL$+CH$ + ELSE + IF VAL(EL$)>MAX THEN MAX=VAL(EL$) END IF + EL$="" + END IF + END FOR + PRINT("Max list element is";MAX) +END PROGRAM diff --git a/Task/Greatest-element-of-a-list/EchoLisp/greatest-element-of-a-list.echolisp b/Task/Greatest-element-of-a-list/EchoLisp/greatest-element-of-a-list.echolisp new file mode 100644 index 0000000000..2a231ccbe4 --- /dev/null +++ b/Task/Greatest-element-of-a-list/EchoLisp/greatest-element-of-a-list.echolisp @@ -0,0 +1,6 @@ +;; a random length list of random values +(define L (map random (make-list (random 50) 100))) → L +L → (24 60 83 8 24 60 31 97 96 65 9 41 64 24 22 57 73 17 6 28 77 58 18 13 27 22 41 69 85) + +;; find max +(apply max L) → 97 diff --git a/Task/Greatest-element-of-a-list/FreeBASIC/greatest-element-of-a-list.freebasic b/Task/Greatest-element-of-a-list/FreeBASIC/greatest-element-of-a-list.freebasic new file mode 100644 index 0000000000..0ea9027046 --- /dev/null +++ b/Task/Greatest-element-of-a-list/FreeBASIC/greatest-element-of-a-list.freebasic @@ -0,0 +1,24 @@ +' FB 1.05.0 Win64 + +Function MaxElement(a() As Double) As Double + Dim max As Double = a(LBound(a)) + For i As Integer = LBound(a) + 1 To UBound(a) + If a(i) > max Then max = a(i) + Next + Return max +End Function + +Dim As Integer i, n +Input "How many values are to be input "; n +If n < 1 Then End +Dim a(1 To n) As Double +For i = 1 To n + Print " Value"; i; " : "; + Input "", a(i) +Next +Dim max As Double = MaxElement(a()) +Print +Print "The greatest value is"; max +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Greatest-element-of-a-list/FunL/greatest-element-of-a-list-1.funl b/Task/Greatest-element-of-a-list/FunL/greatest-element-of-a-list-1.funl new file mode 100644 index 0000000000..2cda9eac62 --- /dev/null +++ b/Task/Greatest-element-of-a-list/FunL/greatest-element-of-a-list-1.funl @@ -0,0 +1 @@ +println( max([1,2,3,-1,0]) ) diff --git a/Task/Greatest-element-of-a-list/FunL/greatest-element-of-a-list-2.funl b/Task/Greatest-element-of-a-list/FunL/greatest-element-of-a-list-2.funl new file mode 100644 index 0000000000..1a2427ec26 --- /dev/null +++ b/Task/Greatest-element-of-a-list/FunL/greatest-element-of-a-list-2.funl @@ -0,0 +1,12 @@ +def + maximum( xs ) = + def + max( a, b ) = if a <= b then b else a + + foldl( f, z, [] ) = z + foldl( f, z, x:xs ) = foldl( f, f(z, x), xs ) + + foldl1( f, x:xs ) = foldl( f, x, xs ) + foldl1( _, [] ) = error( "foldl1: empty list" ) + + foldl1( max, xs ) diff --git a/Task/Greatest-element-of-a-list/Hoon/greatest-element-of-a-list.hoon b/Task/Greatest-element-of-a-list/Hoon/greatest-element-of-a-list.hoon new file mode 100644 index 0000000000..662a16ffa2 --- /dev/null +++ b/Task/Greatest-element-of-a-list/Hoon/greatest-element-of-a-list.hoon @@ -0,0 +1,4 @@ +:- %say +|= [^ [a=(list ,@) ~] ~] +:- %noun + (snag 0 (sort a gte)) diff --git a/Task/Greatest-element-of-a-list/Klong/greatest-element-of-a-list.klong b/Task/Greatest-element-of-a-list/Klong/greatest-element-of-a-list.klong new file mode 100644 index 0000000000..421082a54e --- /dev/null +++ b/Task/Greatest-element-of-a-list/Klong/greatest-element-of-a-list.klong @@ -0,0 +1,4 @@ +list::[ 1.0 2.3 1.1 5.0 3 2.8 2.01 3.14159 77 ] +|/list +|/ [ 1.0 2.3 1.1 5.0 3 2.8 2.01 3.14159 66 ] +|/ 1.0,2.3,1.1,5.0,3,2.8,2.01,3.14159,55 diff --git a/Task/Greatest-element-of-a-list/LFE/greatest-element-of-a-list.lfe b/Task/Greatest-element-of-a-list/LFE/greatest-element-of-a-list.lfe new file mode 100644 index 0000000000..3e2a464d5e --- /dev/null +++ b/Task/Greatest-element-of-a-list/LFE/greatest-element-of-a-list.lfe @@ -0,0 +1,2 @@ +>(: lists max '[9 4 3 8 5]) +9 diff --git a/Task/Greatest-element-of-a-list/Lasso/greatest-element-of-a-list.lasso b/Task/Greatest-element-of-a-list/Lasso/greatest-element-of-a-list.lasso new file mode 100644 index 0000000000..8fa1aaf5e5 --- /dev/null +++ b/Task/Greatest-element-of-a-list/Lasso/greatest-element-of-a-list.lasso @@ -0,0 +1,6 @@ +define greatest(a::array) => { + return (#a->sort&)->last +} + +local(x = array(556,1,7344,4,7,52,22,55,88,122,55,99,1222,578)) +greatest(#x) diff --git a/Task/Greatest-element-of-a-list/Lingo/greatest-element-of-a-list.lingo b/Task/Greatest-element-of-a-list/Lingo/greatest-element-of-a-list.lingo new file mode 100644 index 0000000000..b0592dd204 --- /dev/null +++ b/Task/Greatest-element-of-a-list/Lingo/greatest-element-of-a-list.lingo @@ -0,0 +1,3 @@ +l = [1,7,5] +put max(l) +-- 7 diff --git a/Task/Greatest-element-of-a-list/LiveCode/greatest-element-of-a-list-1.livecode b/Task/Greatest-element-of-a-list/LiveCode/greatest-element-of-a-list-1.livecode new file mode 100644 index 0000000000..24a6e02656 --- /dev/null +++ b/Task/Greatest-element-of-a-list/LiveCode/greatest-element-of-a-list-1.livecode @@ -0,0 +1 @@ +put max(2,3,6,7,4,1) diff --git a/Task/Greatest-element-of-a-list/LiveCode/greatest-element-of-a-list-2.livecode b/Task/Greatest-element-of-a-list/LiveCode/greatest-element-of-a-list-2.livecode new file mode 100644 index 0000000000..eff24ade55 --- /dev/null +++ b/Task/Greatest-element-of-a-list/LiveCode/greatest-element-of-a-list-2.livecode @@ -0,0 +1,13 @@ +function max2 lst + local maxNum + put item 1 of lst into maxNum + repeat with n = 1 to the number of items of lst + if item n of lst > maxNum then + put item n of lst into maxNum + end if + end repeat + return maxNum +end max2 +on mouseUp + answer max2("1,2,5,6,7,4,3,2") +end mouseUp diff --git a/Task/Greatest-element-of-a-list/Nim/greatest-element-of-a-list.nim b/Task/Greatest-element-of-a-list/Nim/greatest-element-of-a-list.nim new file mode 100644 index 0000000000..534cbd12fc --- /dev/null +++ b/Task/Greatest-element-of-a-list/Nim/greatest-element-of-a-list.nim @@ -0,0 +1 @@ +echo max([2,3,4,5,6,1]) diff --git a/Task/Greatest-element-of-a-list/Oforth/greatest-element-of-a-list.oforth b/Task/Greatest-element-of-a-list/Oforth/greatest-element-of-a-list.oforth new file mode 100644 index 0000000000..2d9e3ac20e --- /dev/null +++ b/Task/Greatest-element-of-a-list/Oforth/greatest-element-of-a-list.oforth @@ -0,0 +1 @@ +[1, 2.3, 5.6, 1, 3, 4 ] reduce(#max) diff --git a/Task/Greatest-element-of-a-list/Phix/greatest-element-of-a-list.phix b/Task/Greatest-element-of-a-list/Phix/greatest-element-of-a-list.phix new file mode 100644 index 0000000000..cb3c154481 --- /dev/null +++ b/Task/Greatest-element-of-a-list/Phix/greatest-element-of-a-list.phix @@ -0,0 +1,2 @@ +?max({1,1234,62,234,12,34,6}) +?max({"ant", "antelope", "dog", "cat", "cow", "wolf", "wolverine", "aardvark"}) diff --git a/Task/Greatest-element-of-a-list/Ring/greatest-element-of-a-list.ring b/Task/Greatest-element-of-a-list/Ring/greatest-element-of-a-list.ring new file mode 100644 index 0000000000..7f6d0dd981 --- /dev/null +++ b/Task/Greatest-element-of-a-list/Ring/greatest-element-of-a-list.ring @@ -0,0 +1,2 @@ +aList = [1,2,4,5,10,6,7,8,9] +see max(aList) diff --git a/Task/Greatest-element-of-a-list/Sidef/greatest-element-of-a-list.sidef b/Task/Greatest-element-of-a-list/Sidef/greatest-element-of-a-list.sidef new file mode 100644 index 0000000000..387f605c24 --- /dev/null +++ b/Task/Greatest-element-of-a-list/Sidef/greatest-element-of-a-list.sidef @@ -0,0 +1 @@ +values.max; diff --git a/Task/Greatest-element-of-a-list/Swift/greatest-element-of-a-list-1.swift b/Task/Greatest-element-of-a-list/Swift/greatest-element-of-a-list-1.swift new file mode 100644 index 0000000000..5813f3966c --- /dev/null +++ b/Task/Greatest-element-of-a-list/Swift/greatest-element-of-a-list-1.swift @@ -0,0 +1,3 @@ +if let x = [4,3,5,9,2,3].maxElement() { + print(x) // prints 9 +} diff --git a/Task/Greatest-element-of-a-list/Swift/greatest-element-of-a-list-2.swift b/Task/Greatest-element-of-a-list/Swift/greatest-element-of-a-list-2.swift new file mode 100644 index 0000000000..915afa654b --- /dev/null +++ b/Task/Greatest-element-of-a-list/Swift/greatest-element-of-a-list-2.swift @@ -0,0 +1,2 @@ +let x = maxElement([4,3,5,9,2,3]) +println(x) // prints 9 diff --git a/Task/Greatest-element-of-a-list/Ursa/greatest-element-of-a-list.ursa b/Task/Greatest-element-of-a-list/Ursa/greatest-element-of-a-list.ursa new file mode 100644 index 0000000000..73b201c41f --- /dev/null +++ b/Task/Greatest-element-of-a-list/Ursa/greatest-element-of-a-list.ursa @@ -0,0 +1,12 @@ +def max (int<> list) + decl int max i + set max list<0> + + for (set i 1) (< i (- (size list) 1)) (inc i) + if (> list max) + set max list + end if + end for + + return max +end max diff --git a/Task/Greatest-element-of-a-list/Wart/greatest-element-of-a-list.wart b/Task/Greatest-element-of-a-list/Wart/greatest-element-of-a-list.wart new file mode 100644 index 0000000000..b038983842 --- /dev/null +++ b/Task/Greatest-element-of-a-list/Wart/greatest-element-of-a-list.wart @@ -0,0 +1,9 @@ +def (best f seq) + if seq + ret winner car.seq + each elem cdr.seq + if (f elem winner) + winner <- elem + +def (max ... args) + (best (>) args) diff --git a/Task/Greatest-element-of-a-list/Wortel/greatest-element-of-a-list.wortel b/Task/Greatest-element-of-a-list/Wortel/greatest-element-of-a-list.wortel new file mode 100644 index 0000000000..760dd4c9cf --- /dev/null +++ b/Task/Greatest-element-of-a-list/Wortel/greatest-element-of-a-list.wortel @@ -0,0 +1 @@ +@maxl [1 6 4 6 4 8 6 3] ; returns 8 diff --git a/Task/Greatest-element-of-a-list/jq/greatest-element-of-a-list-1.jq b/Task/Greatest-element-of-a-list/jq/greatest-element-of-a-list-1.jq new file mode 100644 index 0000000000..2d3ee0b3f5 --- /dev/null +++ b/Task/Greatest-element-of-a-list/jq/greatest-element-of-a-list-1.jq @@ -0,0 +1,3 @@ +[1, 3, 1.0] | max # => 3 + +[ {"a": 1}, {"a":3}, {"a":1.0}] | max # => {"a": 3} diff --git a/Task/Greatest-element-of-a-list/jq/greatest-element-of-a-list-2.jq b/Task/Greatest-element-of-a-list/jq/greatest-element-of-a-list-2.jq new file mode 100644 index 0000000000..a5acf0e604 --- /dev/null +++ b/Task/Greatest-element-of-a-list/jq/greatest-element-of-a-list-2.jq @@ -0,0 +1 @@ +reduce s as $x (null; if $x > . then $x else . end) diff --git a/Task/Greatest-subsequential-sum/ERRE/greatest-subsequential-sum.erre b/Task/Greatest-subsequential-sum/ERRE/greatest-subsequential-sum.erre new file mode 100644 index 0000000000..1e8161eb44 --- /dev/null +++ b/Task/Greatest-subsequential-sum/ERRE/greatest-subsequential-sum.erre @@ -0,0 +1,67 @@ +PROGRAM MAX_SUM + +DIM A%[11],B%[10],C%[4] + +!$DYNAMIC +DIM P%[0] + +PROCEDURE MAX_SUBSEQUENCE(P%[],N%->A$) + LOCAL A%,B%,I%,J%,M%,S% + A%=1 + FOR I%=0 TO N% DO + S%=0 + FOR J%=I% TO N% DO + S%+=P%[J%] + IF S%>M% THEN + M%=S% + A%=I% + B%=J% + END IF + END FOR + END FOR + IF A%>B% THEN A$="[]" EXIT PROCEDURE END IF + A$="[" + FOR I%=A% TO B% DO + A$+=STR$(P%[I%])+"," + END FOR + A$=LEFT$(A$,LEN(A$)-1)+"]" +END PROCEDURE + +PROCEDURE SHOW_ARRAY(P%[],N%->A$) + LOCAL I% + A$="[" + FOR I%=0 TO N% DO + A$+=STR$(P%[I%])+"," + END FOR + A$=LEFT$(A$,LEN(A$)-1)+"]" +END PROCEDURE + +BEGIN + + A%[]=(0,1,2,-3,3,-1,0,-4,0,-1,-4,2) + N%=UBOUND(A%,1) + !$DIM P%[N%] + SHOW_ARRAY(A%[],N%->A$) + PRINT(A$;" -> ";) + MAX_SUBSEQUENCE(A%[],N%->A$) + PRINT(A$) + !$ERASE P% + + B%[]=(-1,-2,3,5,6,-2,-1,4,-4,2,-1) + N%=UBOUND(B%,1) + !$DIM P%[N%] + SHOW_ARRAY(B%[],N%->A$) + PRINT(A$;" -> ";) + MAX_SUBSEQUENCE(B%[],N%->A$) + PRINT(A$) + !$ERASE P% + + C%[]=(-1,-2,-3,-4,-5) + N%=UBOUND(C%,1) + !$DIM P%[N%] + SHOW_ARRAY(C%[],N%->A$) + PRINT(A$;" -> ";) + MAX_SUBSEQUENCE(C%[],N%->A$) + PRINT(A$) + !$ERASE P% +END PROGRAM diff --git a/Task/Greatest-subsequential-sum/EchoLisp/greatest-subsequential-sum.echolisp b/Task/Greatest-subsequential-sum/EchoLisp/greatest-subsequential-sum.echolisp new file mode 100644 index 0000000000..2ac149665c --- /dev/null +++ b/Task/Greatest-subsequential-sum/EchoLisp/greatest-subsequential-sum.echolisp @@ -0,0 +1,35 @@ +(lib 'struct) +(struct result (score starter)) + +;; the score of i in sequence ( .. i j ...) is max (i , i + score (j)) +;; to compute score of (a b .. x y z) : +;; start with score(z) and compute scores of y , z , ..c, b , a. +;; this is O(n) + +;; return value of sub-sequence +(define (max-max L into: result) +(define value + (if + (empty? L) -Infinity + (max (first L) (+ (first L) (max-max (cdr L) result ))))) + + (when (> value (result-score result)) + (set-result-score! result value) ;; remember best score + (set-result-starter! result L)) ;; and its location + value) + +;; return (best-score (best sequence)) +(define (max-seq L) + (define best (result -Infinity null)) + (max-max L into: best) + (define score (result-score best)) + + (list score + (for/list (( n (result-starter best))) + #:break (zero? score) + (set! score (- score n)) + n))) + +(define L '(-1 -2 3 5 6 -2 -1 4 -4 2 -1)) +(max-seq L) + → (15 (3 5 6 -2 -1 4)) diff --git a/Task/Greatest-subsequential-sum/FreeBASIC/greatest-subsequential-sum.freebasic b/Task/Greatest-subsequential-sum/FreeBASIC/greatest-subsequential-sum.freebasic new file mode 100644 index 0000000000..85654975cd --- /dev/null +++ b/Task/Greatest-subsequential-sum/FreeBASIC/greatest-subsequential-sum.freebasic @@ -0,0 +1,36 @@ +' FB 1.05.0 Win64 + +Dim As Integer seq(10) = {-1 , -2 , 3 , 5 , 6 , -2 , -1 , 4 , -4 , 2 , -1} +Dim As Integer i, j, sum, maxSum, first, last + +maxSum = 0 + +For i = LBound(seq) To UBound(seq) + sum = 0 + For j = i To UBound(seq) + ' only proper sub-sequences are considered + If i = LBound(seq) AndAlso j = UBound(seq) Then Exit For + sum += seq(j) + If sum > maxSum Then + maxSum = sum + first = i + last = j + End If + Next j +Next i + +If maxSum > 0 Then + Print "Maximum subsequence is from indices"; first; " to"; last + Print "Elements are : "; + For i = first To last + Print seq(i); " "; + Next + Print + Print "Sum is"; maxSum +Else + Print "Maximum subsequence is the empty sequence which has a sum of 0" +End If + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Greatest-subsequential-sum/Nim/greatest-subsequential-sum.nim b/Task/Greatest-subsequential-sum/Nim/greatest-subsequential-sum.nim new file mode 100644 index 0000000000..bf0bae68f2 --- /dev/null +++ b/Task/Greatest-subsequential-sum/Nim/greatest-subsequential-sum.nim @@ -0,0 +1,7 @@ +proc maxsum(s): int = + var maxendinghere = 0 + for x in s: + maxendinghere = max(maxendinghere + x, 0) + result = max(result, maxendinghere) + +echo maxsum(@[-1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1]) diff --git a/Task/Greatest-subsequential-sum/Phix/greatest-subsequential-sum.phix b/Task/Greatest-subsequential-sum/Phix/greatest-subsequential-sum.phix new file mode 100644 index 0000000000..93381d130e --- /dev/null +++ b/Task/Greatest-subsequential-sum/Phix/greatest-subsequential-sum.phix @@ -0,0 +1,16 @@ +function maxSubseq(sequence s) +integer this, maxsum = 0, first = 1, last = 0 + for i=1 to length(s) do + this = 0 + for j=i to length(s) do + this += s[j] + if this>maxsum then + {maxsum,first,last} = {this,i,j} + end if + end for + end for + return s[first..last] +end function +? maxSubseq({-1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1}) +? maxSubseq({}) +? maxSubseq({-1, -5, -3}) diff --git a/Task/Greatest-subsequential-sum/Potion/greatest-subsequential-sum.potion b/Task/Greatest-subsequential-sum/Potion/greatest-subsequential-sum.potion new file mode 100644 index 0000000000..1cb2aa9de5 --- /dev/null +++ b/Task/Greatest-subsequential-sum/Potion/greatest-subsequential-sum.potion @@ -0,0 +1,30 @@ +gss = (lst) : + # Find discrete integral + integral = (0) + accum = 0 + lst each (n): accum = accum + n, integral append(accum). + # Check integral[b + 1] - integral[a] for all 0 <= a <= b < N + max = -1 + max_a = 0 + max_b = 0 + lst length times (b) : + b times (a) : + if (integral(b + 1) - integral(a) > max) : + max = integral(b + 1) - integral(a) + max_a = a + max_b = b + . + . + . + # Print the results + if (max >= 0) : + (lst slice(max_a, max_b) join(" + "), " = ", max, "\n") join print + . + else : + "No subsequence larger than 0\n" print + . +. + +gss((-1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1)) +gss((-1, -2, -3, -4, -5)) +gss((7,-6, -8, 5, -2, -6, 7, 4, 8, -9, -3, 2, 6, -4, -6)) diff --git a/Task/Greatest-subsequential-sum/Sidef/greatest-subsequential-sum.sidef b/Task/Greatest-subsequential-sum/Sidef/greatest-subsequential-sum.sidef new file mode 100644 index 0000000000..b77d67e5c2 --- /dev/null +++ b/Task/Greatest-subsequential-sum/Sidef/greatest-subsequential-sum.sidef @@ -0,0 +1,19 @@ +func maxsubseq(*a) { + var (start, end, sum, maxsum) = (-1, -1, 0, 0); + a.each_kv { |i, x| + sum += x; + if (maxsum < sum) { + maxsum = sum; + end = i; + } + elsif (sum < 0) { + sum = 0; + start = i; + } + }; + a.ft(start+1, end); +} + +say maxsubseq(-1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1); +say maxsubseq(-2, -2, -1, 3, 5, 6, -1, 4, -4, 2, -1); +say maxsubseq(-2, -2, -1, -3, -5, -6, -1, -4, -4, -2, -1); diff --git a/Task/Greatest-subsequential-sum/jq/greatest-subsequential-sum-1.jq b/Task/Greatest-subsequential-sum/jq/greatest-subsequential-sum-1.jq new file mode 100644 index 0000000000..7c6cbff7ae --- /dev/null +++ b/Task/Greatest-subsequential-sum/jq/greatest-subsequential-sum-1.jq @@ -0,0 +1,11 @@ +def subarray_sum: + . as $arr + | reduce range(0; length) as $i + ( {"first": length, "last": 0, "curr": 0, "curr_first": 0, "max": 0}; + $arr[$i] as $e + | (.curr + $e) as $curr + | . + (if $e > $curr then {"curr": $e, "curr_first": $i} else {"curr": $curr} end) + | if .curr > .max then . + {"max": $curr, "first": .curr_first, "last": $i} + else . + end) + | [ .max, $arr[ .first : (1 + .last)] ]; diff --git a/Task/Greatest-subsequential-sum/jq/greatest-subsequential-sum-2.jq b/Task/Greatest-subsequential-sum/jq/greatest-subsequential-sum-2.jq new file mode 100644 index 0000000000..3bd978a4e3 --- /dev/null +++ b/Task/Greatest-subsequential-sum/jq/greatest-subsequential-sum-2.jq @@ -0,0 +1 @@ +[1, 2, 3, 4, 5, -8, -9, -20, 40, 25, -5] | subarray_sum diff --git a/Task/Greatest-subsequential-sum/jq/greatest-subsequential-sum-3.jq b/Task/Greatest-subsequential-sum/jq/greatest-subsequential-sum-3.jq new file mode 100644 index 0000000000..60acbb1640 --- /dev/null +++ b/Task/Greatest-subsequential-sum/jq/greatest-subsequential-sum-3.jq @@ -0,0 +1,2 @@ +$ jq -c -n -f Greatest_subsequential_sum.jq +[65,[40,25]] diff --git a/Task/Guess-the-number-With-feedback--player-/Ceylon/guess-the-number-with-feedback--player-.ceylon b/Task/Guess-the-number-With-feedback--player-/Ceylon/guess-the-number-with-feedback--player-.ceylon new file mode 100644 index 0000000000..63219cc353 --- /dev/null +++ b/Task/Guess-the-number-With-feedback--player-/Ceylon/guess-the-number-with-feedback--player-.ceylon @@ -0,0 +1,39 @@ +shared void run() { + while(true) { + variable value low = 1; + variable value high = 10; + variable value attempts = 1; + print("Please choose a number between ``low`` and ``high``. + Press enter when ready."); + process.readLine(); + while(true) { + if(low > high) { + print("Something is wrong. I give up."); + break; + } + variable value guess = (low + high) / 2; + print("Is ``guess`` (e)qual, (h)igher or (l)ower to your number? + (enter q to quit)"); + value answer = process.readLine()?.trimmed?.lowercased; + switch(answer) + case("e") { + print("I got it in only ``attempts`` ``attempts == 1 then "try" else "tries"``!"); + break; + } + case("h") { + high = guess - 1; + attempts++; + } + case("l") { + low = guess + 1; + attempts++; + } + case("q") { + return; + } + else { + print("Please enter an e, h, l or q"); + } + } + } +} diff --git a/Task/Guess-the-number-With-feedback--player-/FreeBASIC/guess-the-number-with-feedback--player-.freebasic b/Task/Guess-the-number-With-feedback--player-/FreeBASIC/guess-the-number-with-feedback--player-.freebasic new file mode 100644 index 0000000000..29eae2550f --- /dev/null +++ b/Task/Guess-the-number-With-feedback--player-/FreeBASIC/guess-the-number-with-feedback--player-.freebasic @@ -0,0 +1,32 @@ +' FB 1.05.0 Win64 + +Dim hle As String +Dim lowest As Integer = 1 +Dim highest As Integer = 20 +Dim guess As Integer = 10 +Print "Please choose a number between 1 and 20 but don't tell me what it is yet" +Print +Do + Print "My guess is"; guess + Do + Input "Is this higher/lower or equal to your chosen number h/l/e : "; hle + hle = LCase(hle) + If hle = "l" AndAlso guess = highest Then + Print "It can't be more than"; highest; ", try again" + hle = "i" '' invalid + ElseIf hle = "h" AndAlso guess = lowest Then + Print "It can't be less than"; lowest; ", try again" + hle = "i" + End If + Loop Until hle = "h" OrElse hle = "l" OrElse hle = "e" + If hle = "e" Then + Print "Good, thanks for playing the gaame with me!" + Exit Do + ElseIf hle = "h" Then + If highest > guess - 1 Then highest = guess - 1 + Else + If lowest < guess + 1 Then lowest = guess + 1 + End If + guess = (lowest + highest)\2 +Loop +End diff --git a/Task/Guess-the-number-With-feedback--player-/Lasso/guess-the-number-with-feedback--player-.lasso b/Task/Guess-the-number-With-feedback--player-/Lasso/guess-the-number-with-feedback--player-.lasso new file mode 100644 index 0000000000..043d856693 --- /dev/null +++ b/Task/Guess-the-number-With-feedback--player-/Lasso/guess-the-number-with-feedback--player-.lasso @@ -0,0 +1,50 @@ +#!/usr/bin/lasso9 + +local( + mini=0, + maxi=100, + status = false, + count = 0, + response, + guess +) + +stdoutnl('Think of a number between ' + #mini + ' and ' + #maxi + ' +Each time I guess indicate if I was to high (H), to low (L) or just right (R).') + + +while(not #status) => { + + if(not(#mini <= #maxi)) => { + + stdout('I think you are trying to cheat me. I will not play anymore.') + #status = true + + else + + #guess = ((#maxi - #mini) /2 ) + #mini + + stdout('You are thinking on ' + #guess + ' ') + #response = null + + // the following bits wait until the terminal gives you back a line of input + while(not #response or #response -> size == 0) => { + #response = file_stdin -> readSomeBytes(1024, 1000) + } + #response -> replace(bytes('\n'), bytes('')) + + match(string(#response)) => { + case('L') + #mini = #guess + 1 + #count++ + case('H') + #maxi = #guess - 1 + #count++ + case('R') + stdout('Am I smart or smart! I guessed it in ' + #count ' tries!') + #status = true + case() + stdout('Are you having issues reading instructions? ') + } + } +} diff --git a/Task/Guess-the-number-With-feedback--player-/Nim/guess-the-number-with-feedback--player-.nim b/Task/Guess-the-number-With-feedback--player-/Nim/guess-the-number-with-feedback--player-.nim new file mode 100644 index 0000000000..af8cefc49a --- /dev/null +++ b/Task/Guess-the-number-With-feedback--player-/Nim/guess-the-number-with-feedback--player-.nim @@ -0,0 +1,29 @@ +import rdstdin, strutils + +let oRange = 1..10 +var iRange = oRange + +echo """Think of a number between $# and $# and wait for me to guess it. +On every guess of mine you should state whether the guess was +too high, too low, or equal to your number by typing h, l, or =""".format(iRange.a, iRange.b) + +var i = 0 +while true: + inc i + let guess = (iRange.a + iRange.b) div 2 + let txt = readLineFromStdin("Guess $# is: $#. The score for which is (h,l,=): " + .format(i, guess)) + + case txt + of "h": iRange.b = guess - 1 + of "l": iRange.a = guess + 1 + of "=": + echo " Ye-Haw!!" + break + else: echo " I don't understand your input of '%s'?".format(txt) + + if iRange.a > iRange.b or iRange.a < oRange.a or iRange.b > oRange.b: + echo "Please check your scoring as I cannot find the value" + break + +echo "Thanks for keeping score." diff --git a/Task/Guess-the-number-With-feedback--player-/Phix/guess-the-number-with-feedback--player-.phix b/Task/Guess-the-number-With-feedback--player-/Phix/guess-the-number-with-feedback--player-.phix new file mode 100644 index 0000000000..468631e549 --- /dev/null +++ b/Task/Guess-the-number-With-feedback--player-/Phix/guess-the-number-with-feedback--player-.phix @@ -0,0 +1,22 @@ +integer Min=0, Max=100, Guess, Response +printf(1,"Think of a number between %d and %d.\n",{Min,Max}) +while 1 do + Guess = floor((Max+Min)/2) + printf(1,"My guess is %d, is this too high, too low, or correct? (H/L/C)", Guess) + Response = lower(wait_key()) + puts(1,"\n") + if Response='h' then + Max = Guess-1 + elsif Response='l' then + Min = Guess+1 + elsif Response='c' then + puts(1,"I did it!\n") + exit + else + puts(1,"I do not understand that...\n") + end if + if Max> Think of a number between #{min} and #{max} and I'll guess it!\n +Press when are you ready... +EOT +  +STDIN.readline; +  +loop { + print <<-EOT.chomp + \n=>> My guess is: #{guess} Is your number higher, lower, or equal? (h/l/e) + >#{' '} + EOT +  + ++tries; + given (STDIN.readline) { + case (max <= min) { + say "\nI give up..."; + break; + } + when (/^h/i) { + min = guess+1; + } + when (/^l/i) { + max = guess; + } + when (/^e/i) { + say "\nI knew it! It took me only #{tries} tries."; + break; + } + default { + say "error: invalid score"; + next; + } + } +  + guess = (min+max / 2 -> int); +} diff --git a/Task/Guess-the-number-With-feedback--player-/Swift/guess-the-number-with-feedback--player-.swift b/Task/Guess-the-number-With-feedback--player-/Swift/guess-the-number-with-feedback--player-.swift new file mode 100644 index 0000000000..73e91a4e68 --- /dev/null +++ b/Task/Guess-the-number-With-feedback--player-/Swift/guess-the-number-with-feedback--player-.swift @@ -0,0 +1,48 @@ +import Cocoa + +var found = false +let fh = NSFileHandle.fileHandleWithStandardInput() +println("Enter an integer between 1 and 100 for me to guess: ") +let data = fh.availableData +var num:Int! +var low = 0.0 +var high = 100.0 +var lastGuess:Double! + + +if let numFromData = NSString(data: data, encoding: NSUTF8StringEncoding)?.intValue { + num = Int(numFromData) +} + +func guess() -> Double? { + if (high - low == 1) { + println("I can't guess it. I think you cheated."); + return nil + } + + return floor((low + high) / 2) +} + +while (!found) { + if let guess = guess() { + lastGuess = guess + + } else { + break + } + println("My guess is: \(Int(lastGuess))") + println("How was my guess? Enter \"higher\" if it was higher, \"lower\" if it was lower, and \"correct\" if I got it") + let data = fh.availableData + let str = NSString(data: data, encoding: NSUTF8StringEncoding) + if (str == nil) { + continue + } + if (str! == "correct\n") { + found = true + println("I did it!") + } else if (str! == "higher\n") { + low = lastGuess + } else if (str! == "lower\n") { + high = lastGuess + } +} diff --git a/Task/Guess-the-number-With-feedback/Ceylon/guess-the-number-with-feedback.ceylon b/Task/Guess-the-number-With-feedback/Ceylon/guess-the-number-with-feedback.ceylon new file mode 100644 index 0000000000..912eb9bdbb --- /dev/null +++ b/Task/Guess-the-number-With-feedback/Ceylon/guess-the-number-with-feedback.ceylon @@ -0,0 +1,37 @@ +import ceylon.random { + DefaultRandom +} + +shared void run() { + value random = DefaultRandom(); + value range = 1..10; + while(true) { + value chosen = random.nextElement(range); + print("I have chosen a number between ``range.first`` and ``range.last``. + What is your guess?"); + while(true) { + if(exists line = process.readLine()) { + value guess = Integer.parse(line.trimmed); + + if(is ParseException guess) { + print(guess.message); + continue; + } + + switch(guess <=> chosen) + case (larger) { + print("Too high!"); + } + case (smaller) { + print("Too low!"); + } + case (equal) { + print("You got it!"); + break; + } + } else { + print("Please enter a number!"); + } + } + } +} diff --git a/Task/Guess-the-number-With-feedback/EchoLisp/guess-the-number-with-feedback.echolisp b/Task/Guess-the-number-With-feedback/EchoLisp/guess-the-number-with-feedback.echolisp new file mode 100644 index 0000000000..48aaa3f1f2 --- /dev/null +++ b/Task/Guess-the-number-With-feedback/EchoLisp/guess-the-number-with-feedback.echolisp @@ -0,0 +1,17 @@ +;;(read ) prompts the user with a default value using the browser dialog box. +;; we play sounds to make this look like an arcade game +(lib 'web) ; (play-sound) is defined in web.lib + +(define (guess-feed (msg " 🔮 Enter a number in [0...100], -1 to stop.") (n (random 100)) (user 0)) + (set! user (read user msg)) + (play-sound 'ko) + (unless (eq? n user ) ; user is the last user answer + (guess-feed + (cond ;; adapt prompt according to condition + ((not (integer? user)) "❌ Please, enter an integer") + (( < user 0) (error "🌵 - It was:" n)) ; exit to top level + ((> n user) "Too low ...") + ((< n user) "Too high ...")) + n user)) + (play-sound 'ok ) + " 🔮 Well played!! 🍒 🍇 🍓") diff --git a/Task/Guess-the-number-With-feedback/FreeBASIC/guess-the-number-with-feedback.freebasic b/Task/Guess-the-number-With-feedback/FreeBASIC/guess-the-number-with-feedback.freebasic new file mode 100644 index 0000000000..23f54109d0 --- /dev/null +++ b/Task/Guess-the-number-With-feedback/FreeBASIC/guess-the-number-with-feedback.freebasic @@ -0,0 +1,22 @@ +' FB 1.05.0 Win64 + +Randomize +Dim n As Integer = Int(Rnd * 20) + 1 +Dim guess As Integer + +Print "Guess which number I've chosen in the range 1 to 20" +Print +Do + Input " Your guess : "; guess + If guess > n AndAlso guess <= 20 Then + Print "Your guess is higher than the chosen number, try again " + ElseIf guess = n Then + Print "Correct, well guessed!" + Exit Do + ElseIf guess < n AndAlso guess >= 1 Then + Print "Your guess is lower than the chosen number, try again" + Else + Print "Your guess is inappropriate, try again" + End If +Loop +End diff --git a/Task/Guess-the-number-With-feedback/LFE/guess-the-number-with-feedback-1.lfe b/Task/Guess-the-number-With-feedback/LFE/guess-the-number-with-feedback-1.lfe new file mode 100644 index 0000000000..f04f1809cb --- /dev/null +++ b/Task/Guess-the-number-With-feedback/LFE/guess-the-number-with-feedback-1.lfe @@ -0,0 +1,21 @@ +(defmodule guessing-game + (export (main 0))) + +(defun get-player-guess () + (let (((tuple 'ok (list guessed)) (: io fread '"Guess number: " '"~d"))) + guessed)) + +(defun check-guess (answer guessed) + (cond + ((== answer guessed) + (: io format '"Well-guessed!!~n")) + ((/= answer guessed) + (if (> answer guessed) (: io format '"Your guess is too low.~n")) + (if (< answer guessed) (: io format '"Your guess is too high.~n")) + (check-guess answer (get-player-guess))))) + +(defun main () + (: io format '"Guess the number I have chosen, between 1 and 10.~n") + (check-guess + (: random uniform 10) + (get-player-guess))) diff --git a/Task/Guess-the-number-With-feedback/LFE/guess-the-number-with-feedback-2.lfe b/Task/Guess-the-number-With-feedback/LFE/guess-the-number-with-feedback-2.lfe new file mode 100644 index 0000000000..ec60b6350e --- /dev/null +++ b/Task/Guess-the-number-With-feedback/LFE/guess-the-number-with-feedback-2.lfe @@ -0,0 +1,14 @@ +> (slurp '"guessing-game.lfe") +#(ok guessing-game) +> (main) +Guess the number I have chosen, between 1 and 10. +Guess number: 10 +Your guess is too high. +Guess number: 1 +Your guess is too low. +Guess number: 5 +Your guess is too low. +Guess number: 7 +Well-guessed!! +ok +> diff --git a/Task/Guess-the-number-With-feedback/Lasso/guess-the-number-with-feedback.lasso b/Task/Guess-the-number-With-feedback/Lasso/guess-the-number-with-feedback.lasso new file mode 100644 index 0000000000..8db405eed3 --- /dev/null +++ b/Task/Guess-the-number-With-feedback/Lasso/guess-the-number-with-feedback.lasso @@ -0,0 +1,33 @@ +#!/usr/bin/lasso9 + +local( + lower = integer_random(10, 1), + higher = integer_random(100, 20), + number = integer_random(#higher, #lower), + status = false, + guess +) + +// prompt for a number +stdout('Guess a number: ') + +while(not #status) => { + #guess = null + + // the following bits wait until the terminal gives you back a line of input + while(not #guess or #guess -> size == 0) => { + #guess = file_stdin -> readSomeBytes(1024, 1000) + } + #guess = integer(#guess) + + if(not (range(#guess, #lower, #higher) == #guess)) => { + stdout('Input not of correct type or range. Guess a number: ') + else(#guess > #number) + stdout('That was to high, try again! ') + else(#guess < #number) + stdout('That was to low, try again! ') + else(#guess == #number) + stdout('Well guessed!') + #status = true + } +} diff --git a/Task/Guess-the-number-With-feedback/LiveCode/guess-the-number-with-feedback-1.livecode b/Task/Guess-the-number-With-feedback/LiveCode/guess-the-number-with-feedback-1.livecode new file mode 100644 index 0000000000..8eb4900aa1 --- /dev/null +++ b/Task/Guess-the-number-With-feedback/LiveCode/guess-the-number-with-feedback-1.livecode @@ -0,0 +1,29 @@ +command guessTheNumber lowN highN + local tNumber, tguess, tmin, tmax + if lowN is empty or lowN < 1 then + put 1 into tmin + else + put lowN into tmin + end if + if highN is empty then + put 10 into tmax + else + put highN into tmax + end if + put random(tmax - tmin + 1) + tmin - 1 into tNumber + repeat until tguess is tNumber + ask question "Please enter a number between" && tmin && "and" && tmax titled "Guess the number" + if it is not empty then + put it into tguess + if tguess is tNumber then + answer "Well guessed!" + else if tguess < tNumber then + answer "too low" + else + answer "too high" + end if + else + exit repeat + end if + end repeat +end guessTheNumber diff --git a/Task/Guess-the-number-With-feedback/LiveCode/guess-the-number-with-feedback-2.livecode b/Task/Guess-the-number-With-feedback/LiveCode/guess-the-number-with-feedback-2.livecode new file mode 100644 index 0000000000..567b6085de --- /dev/null +++ b/Task/Guess-the-number-With-feedback/LiveCode/guess-the-number-with-feedback-2.livecode @@ -0,0 +1,4 @@ +command testGuessNumber + guessTheNumber --defaults to 1-10 + guessTheNumber 9,12 +end testGuessNumber diff --git a/Task/Guess-the-number-With-feedback/Nim/guess-the-number-with-feedback.nim b/Task/Guess-the-number-With-feedback/Nim/guess-the-number-with-feedback.nim new file mode 100644 index 0000000000..405f1fe1a5 --- /dev/null +++ b/Task/Guess-the-number-With-feedback/Nim/guess-the-number-with-feedback.nim @@ -0,0 +1,22 @@ +import random, rdstdin, strutils + +randomize() + +let iRange = 1..100 + +echo "Guess my target number that is between ", iRange.a, " and ", iRange.b, " (inclusive)." +let target = random(iRange) +var answer, i = 0 +while answer != target: + inc i + let txt = readLineFromStdin("Your guess " & $i & ": ") + try: answer = parseInt(txt) + except ValueError: + echo " I don't understand your input of '", txt, "'" + continue + if answer < iRange.a or answer > iRange.b: echo " Out of range!" + elif answer < target: echo " Too low." + elif answer > target: echo " Too high." + else: echo " Ye-Haw!!" + +echo "Thanks for playing." diff --git a/Task/Guess-the-number-With-feedback/Oforth/guess-the-number-with-feedback.oforth b/Task/Guess-the-number-With-feedback/Oforth/guess-the-number-with-feedback.oforth new file mode 100644 index 0000000000..e502fbf7f8 --- /dev/null +++ b/Task/Guess-the-number-With-feedback/Oforth/guess-the-number-with-feedback.oforth @@ -0,0 +1,11 @@ +import: console + +: guessNumber(a, b) +| n g | + b a - rand a + 1- ->n + begin + "Guess a number between" . a . "and" . b . ":" . + while(System.Console askln asInteger dup -> g isNull) [ "Not a number " println ] + g n == ifTrue: [ "You found it !" .cr return ] + g n < ifTrue: [ "Less" ] else: [ "Greater" ] . "than the target" .cr + again ; diff --git a/Task/Guess-the-number-With-feedback/Phix/guess-the-number-with-feedback.phix b/Task/Guess-the-number-With-feedback/Phix/guess-the-number-with-feedback.phix new file mode 100644 index 0000000000..f4298551b2 --- /dev/null +++ b/Task/Guess-the-number-With-feedback/Phix/guess-the-number-with-feedback.phix @@ -0,0 +1,9 @@ +constant lower_limit = 0, upper_limit = 100 +integer secret = rand(upper_limit-(lower_limit-1))+lower_limit-1 +printf(1,"Guess the number between %d and %d: ", lower_limit & upper_limit) +while 1 do + integer guess = prompt_number("", lower_limit & upper_limit) + if guess=secret then exit end if + printf(1,"Your guess is too %s.\nTry again: ",{iff(guess>secret?"high":"low")}) +end while +puts(1,"You got it!\n") diff --git a/Task/Guess-the-number-With-feedback/Ring/guess-the-number-with-feedback.ring b/Task/Guess-the-number-With-feedback/Ring/guess-the-number-with-feedback.ring new file mode 100644 index 0000000000..fe59cb286e --- /dev/null +++ b/Task/Guess-the-number-With-feedback/Ring/guess-the-number-with-feedback.ring @@ -0,0 +1,31 @@ +fr = 1 t0 = 10 +while true +see "Hey There, +======================== +I'm thinking of a number between " + fr + " and " + t0 + ", Can you guess it?? +Guess :> " +give x +n = nrandom(fr,t0) +if x = n see " + + Congratulations :D + +***************************************************** + ** Your guess was right You Are Genius :D ** +***************************************************** + + +" +exit +else +see "Oops its not true, you were just few steps" +if x > n see " up :)" else see " down :)" ok +see copy(nl,3) +ok +end + +func nRandom s,e +while true +d = random(e) +if d >= s return d ok +end diff --git a/Task/Guess-the-number-With-feedback/Sidef/guess-the-number-with-feedback.sidef b/Task/Guess-the-number-With-feedback/Sidef/guess-the-number-with-feedback.sidef new file mode 100644 index 0000000000..88493fea64 --- /dev/null +++ b/Task/Guess-the-number-With-feedback/Sidef/guess-the-number-with-feedback.sidef @@ -0,0 +1,10 @@ +var number = rand(1..10); +say "Guess the number between 1 and 10"; + +loop { + given(var n = Sys.scanln("> ").to_i) { + when (number) { say "You guessed it."; break } + case (n < number) { say "Too low" } + default { say "Too high" } + } +} diff --git a/Task/Guess-the-number-With-feedback/Sparkling/guess-the-number-with-feedback.sparkling b/Task/Guess-the-number-With-feedback/Sparkling/guess-the-number-with-feedback.sparkling new file mode 100644 index 0000000000..b9c4fbdc26 --- /dev/null +++ b/Task/Guess-the-number-With-feedback/Sparkling/guess-the-number-with-feedback.sparkling @@ -0,0 +1,27 @@ +printf("Lower bound: "); +let lowerBound = toint(getline()); + +printf("Upper bound: "); +let upperBound = toint(getline()); + +assert(upperBound > lowerBound, "upper bound must be greater than lower bound"); + +seed(time()); +let n = floor(random() * (upperBound - lowerBound) + lowerBound); +var guess; + +print(); + +while true { + printf("Your guess: "); + guess = toint(getline()); + + if guess < n { + print("too low"); + } else if guess > n { + print("too high"); + } else { + print("You guessed it!"); + break; + } +} diff --git a/Task/Guess-the-number-With-feedback/Swift/guess-the-number-with-feedback.swift b/Task/Guess-the-number-With-feedback/Swift/guess-the-number-with-feedback.swift new file mode 100644 index 0000000000..e683f878c7 --- /dev/null +++ b/Task/Guess-the-number-With-feedback/Swift/guess-the-number-with-feedback.swift @@ -0,0 +1,23 @@ +import Cocoa + +var found = false + +let randomNum = Int(arc4random_uniform(100) + 1) + +println("Guess a number between 1 and 100\n") + +while (!found) { + var fh = NSFileHandle.fileHandleWithStandardInput() + + println("Enter a number: ") + let data = fh.availableData + let str = NSString(data: data, encoding: NSUTF8StringEncoding) + if (str?.integerValue == randomNum) { + found = true + println("Well guessed!") + } else if (str?.integerValue < randomNum) { + println("Good try but the number is more than that!") + } else if (str?.integerValue > randomNum) { + println("Good try but the number is less than that!") + } +} diff --git a/Task/Guess-the-number-With-feedback/Ursa/guess-the-number-with-feedback.ursa b/Task/Guess-the-number-With-feedback/Ursa/guess-the-number-with-feedback.ursa new file mode 100644 index 0000000000..2c864b2f2f --- /dev/null +++ b/Task/Guess-the-number-With-feedback/Ursa/guess-the-number-with-feedback.ursa @@ -0,0 +1,30 @@ +decl int high low +set low 0 +set high 100 + +out "Guess a number between " low " and " high "." endl endl console +decl int target answer i +decl ursa.util.random random +set target (int (+ 1 (+ low (random.getint (int (- high low)))))) +while (not (= answer target)) + inc i + out "Your guess(" i "): " console + set answer (in int console) + + if (or (< answer low) (> answer high)) + out " Out of range!" endl console + continue + end if + if (= answer target) + out " Ye-Haw!!" endl console + continue + end if + if (< answer target) + out " Too low." endl console + end if + if (> answer target) + out " Too high." endl console + end if +end while + +out endl "Thanks for playing." endl console diff --git a/Task/Guess-the-number-With-feedback/XLISP/guess-the-number-with-feedback.xlisp b/Task/Guess-the-number-With-feedback/XLISP/guess-the-number-with-feedback.xlisp new file mode 100644 index 0000000000..653885377e --- /dev/null +++ b/Task/Guess-the-number-With-feedback/XLISP/guess-the-number-with-feedback.xlisp @@ -0,0 +1,26 @@ +(defun guessing-game (a b) + ; minimum and maximum, to be supplied by the user + (defun prompt () + (display "What is your guess? ") + (define guess (read)) + (if (eq guess n) ; EQ, unlike =, won't blow up + ; if GUESS isn't a number + (display "Well guessed!") + (begin + (display + (cond + ((not (integer? guess)) "Come on, that isn't even an integer") + ((or (< guess a) (> guess b)) "Now you k n o w it won't be that") + ((< guess n) "Too low") + ((> guess n) "Too high"))) + (display "! Try again...") + (newline) + (prompt)))) + (define n (+ (random (- (+ b 1) a)) a)) + (display "I have thought of an integer between ") + (display a) + (display " and ") + (display b) + (display ". Try to guess it!") + (newline) + (prompt)) diff --git a/Task/Guess-the-number/ERRE/guess-the-number.erre b/Task/Guess-the-number/ERRE/guess-the-number.erre new file mode 100644 index 0000000000..f2e4499ea5 --- /dev/null +++ b/Task/Guess-the-number/ERRE/guess-the-number.erre @@ -0,0 +1,29 @@ +PROGRAM GUESS_NUMBER + +! +! for rosettacode.org +! + +BEGIN + + RANDOMIZE(TIMER) + N=0 + R=INT(RND(1)*100+1) ! RND function gives a random number from 0 to 1 + G=0 + C$="" + + WHILE G<>R DO + INPUT("Pick a number between 1 and 100";G) + IF G=R THEN + PRINT("You got it!") + N+=1 + PRINT("It took";N;"tries to pick the right Number.") + ELSIF G (slurp '"guessing-game.lfe") +#(ok guessing-game) +> (main) +Guess the number I have chosen, between 1 and 10. +Guess number: 10 +Guess number: 5 +Well-guessed!! +ok diff --git a/Task/Guess-the-number/Lasso/guess-the-number-1.lasso b/Task/Guess-the-number/Lasso/guess-the-number-1.lasso new file mode 100644 index 0000000000..51a7931946 --- /dev/null +++ b/Task/Guess-the-number/Lasso/guess-the-number-1.lasso @@ -0,0 +1,28 @@ +local( + number = integer_random(10, 1), + status = false, + guess +) + +// prompt for a number +stdout('Guess a number between 1 and 10: ') + +while(not #status) => { + #guess = null + + // the following bits wait until the terminal gives you back a line of input + while(not #guess or #guess -> size == 0) => { + #guess = file_stdin -> readSomeBytes(1024, 1000) + } + #guess = integer(#guess) + + if(not (range(#guess, 1, 10) == #guess)) => { + stdout('Input not of correct type or range. Guess a number between 1 and 10: ') + else(#guess == #number) + stdout('Well guessed!') + #status = true + else + stdout('You guessed wrong number. Guess a number between 1 and 10: ') + } + +} diff --git a/Task/Guess-the-number/Lasso/guess-the-number-2.lasso b/Task/Guess-the-number/Lasso/guess-the-number-2.lasso new file mode 100644 index 0000000000..e2f87d92f1 --- /dev/null +++ b/Task/Guess-the-number/Lasso/guess-the-number-2.lasso @@ -0,0 +1,41 @@ + param('number') or integer_random(10, 1)), + status = false, + guess = web_request -> param('guess'), + _guess = integer(#guess), + message = 'Guess a number between 1 and 10' +) + + + +if(#guess) => { + if(not (range(#_guess, 1, 10) == #_guess)) => { + #Message = 'Input not of correct type or range. Guess a number between 1 and 10' + else(#_guess == #number) + #Message = 'Well guessed!' + #status = true + else + #Message = 'You guessed wrong number. Guess a number between 1 and 10' + } +} + + +?> + + + Guess the number - Rosetta Code + + +

[#message]

+[if(not #status)] +
+
+ + + +
+[/if] + + diff --git a/Task/Guess-the-number/LiveCode/guess-the-number.livecode b/Task/Guess-the-number/LiveCode/guess-the-number.livecode new file mode 100644 index 0000000000..3c32c1bc19 --- /dev/null +++ b/Task/Guess-the-number/LiveCode/guess-the-number.livecode @@ -0,0 +1,15 @@ +command guessTheNumber + local tNumber, tguess + put random(10) into tNumber + repeat until tguess is tNumber + ask question "Please enter a number between 1 and 10" titled "Guess the number" + if it is not empty then + put it into tguess + if tguess is tNumber then + answer "Well guessed!" + end if + else + exit repeat + end if + end repeat +end guessTheNumber diff --git a/Task/Guess-the-number/Nim/guess-the-number.nim b/Task/Guess-the-number/Nim/guess-the-number.nim new file mode 100644 index 0000000000..4ddc36ad9f --- /dev/null +++ b/Task/Guess-the-number/Nim/guess-the-number.nim @@ -0,0 +1,13 @@ +import strutils, math + +randomize() +var chosen = 1 + random(10) +echo "I have thought of a number. Try to guess it!" + +var guess = parseInt(readLine(stdin)) + +while guess != chosen: + echo "Your guess was wrong. Try again!" + guess = parseInt(readLine(stdin)) + +echo "Well guessed!" diff --git a/Task/Guess-the-number/Oforth/guess-the-number.oforth b/Task/Guess-the-number/Oforth/guess-the-number.oforth new file mode 100644 index 0000000000..3a49fd41ea --- /dev/null +++ b/Task/Guess-the-number/Oforth/guess-the-number.oforth @@ -0,0 +1,5 @@ +import: console + +: guess + 10 rand doWhile: [ "Guess :" . System.Console askln asInteger over <> ] + drop "Well guessed!" . ; diff --git a/Task/Guess-the-number/Phix/guess-the-number.phix b/Task/Guess-the-number/Phix/guess-the-number.phix new file mode 100644 index 0000000000..e4fd958041 --- /dev/null +++ b/Task/Guess-the-number/Phix/guess-the-number.phix @@ -0,0 +1,7 @@ +integer secret = rand(10) +puts(1,"Guess the number between 1 and 10: ") +while 1 do + if prompt_number("",{1,10})=secret then exit end if + puts(1,"Your guess was wrong.\nTry again: ") +end while +puts(1,"You got it!\n") diff --git a/Task/Guess-the-number/RPL/guess-the-number.rpl b/Task/Guess-the-number/RPL/guess-the-number.rpl new file mode 100644 index 0000000000..f3c7de29c9 --- /dev/null +++ b/Task/Guess-the-number/RPL/guess-the-number.rpl @@ -0,0 +1,31 @@ +DIR + INITIALIZE + << { C G R } PURGE RAND 10 * 1 + IP 'R' STO GUESSING + >> + GUESSING + << "Pick a number between 1 and 10." "" INPUT OBJ-> 'G' STO + IF + G R == + THEN + CLLCD "You got it!" 1 DISP 7 FREEZE 0 WAIT CLLCD CONTINUE + ELSE + IF + G R < + THEN + CLLCD "Try a larger number." 1 DISP 7 FREEZE 0 WAIT GUESSING + ELSE + CLLCD "Try a smaller number." 1 DISP 7 FREEZE 0 WAIT GUESSING + END + END + >> + CONTINUE + << "Do you want to continue? (0/1)" "" INPUT OBJ-> 'C' STO + IF + C 1 == + THEN + INITIALIZE + ELSE + CLEAR + END + >> +END diff --git a/Task/Guess-the-number/Ring/guess-the-number.ring b/Task/Guess-the-number/Ring/guess-the-number.ring new file mode 100644 index 0000000000..755c0d5cd1 --- /dev/null +++ b/Task/Guess-the-number/Ring/guess-the-number.ring @@ -0,0 +1,17 @@ +while true +see "Hey There, +======================== +I'm thinking of a number between 0 and 10, Can you guess it?? +Guess :> " +give x +n = random(10) +if x = n see " +********************************************** + ** Thats right You Are Genius :D ** +********************************************** +" +exit +else +see "Oops its not true, Try again please :)" + copy(nl,3) +ok +end diff --git a/Task/Guess-the-number/Sidef/guess-the-number.sidef b/Task/Guess-the-number/Sidef/guess-the-number.sidef new file mode 100644 index 0000000000..6ddc1c6702 --- /dev/null +++ b/Task/Guess-the-number/Sidef/guess-the-number.sidef @@ -0,0 +1,6 @@ +var n = 10.rand(1).int; +print 'Guess the number: '; +while (n != read(Number).int) { + print 'Wrong! Guess again: ' +} +say 'Well guessed!'; diff --git a/Task/Guess-the-number/Swift/guess-the-number.swift b/Task/Guess-the-number/Swift/guess-the-number.swift new file mode 100644 index 0000000000..e4326deb32 --- /dev/null +++ b/Task/Guess-the-number/Swift/guess-the-number.swift @@ -0,0 +1,17 @@ +import Cocoa + +var found = false +let randomNum = Int(arc4random_uniform(10) + 1) + +println("Guess a number between 1 and 10\n") +while (!found) { + var fh = NSFileHandle.fileHandleWithStandardInput() + + println("Enter a number: ") + let data = fh.availableData + var str = NSString(data: data, encoding: NSUTF8StringEncoding) + if (str?.integerValue == randomNum) { + found = true + println("Well guessed!") + } +} diff --git a/Task/Guess-the-number/Ursa/guess-the-number.ursa b/Task/Guess-the-number/Ursa/guess-the-number.ursa new file mode 100644 index 0000000000..d8e60bf33c --- /dev/null +++ b/Task/Guess-the-number/Ursa/guess-the-number.ursa @@ -0,0 +1,12 @@ +# Simple number guessing game + +decl ursa.util.random random +decl int target guess + +set target (int (+ 1 (random.getint 9))) +out "Guess a number between 1 and 10." endl console +while (not (= target guess)) + set guess (in int console) +end while + +out "That's right!" endl console diff --git a/Task/Guess-the-number/Wortel/guess-the-number.wortel b/Task/Guess-the-number/Wortel/guess-the-number.wortel new file mode 100644 index 0000000000..f32a67e10a --- /dev/null +++ b/Task/Guess-the-number/Wortel/guess-the-number.wortel @@ -0,0 +1,9 @@ +@let { + num 10Wc + guess 0 + [ + @while != guess num + :guess !prompt "Guess the number between 1 and 10 inclusive" + !alert "Congratulations!\nThe number was {num}." + ] +} diff --git a/Task/Guess-the-number/XLISP/guess-the-number.xlisp b/Task/Guess-the-number/XLISP/guess-the-number.xlisp new file mode 100644 index 0000000000..731086a30b --- /dev/null +++ b/Task/Guess-the-number/XLISP/guess-the-number.xlisp @@ -0,0 +1,14 @@ +(defun guessing-game () + (defun prompt () + (display "What is your guess? ") + (define guess (read)) + (if (= guess n) + (display "Well guessed!") + (begin + (display "No...") + (newline) + (prompt)))) + (define n (+ (random 10) 1)) + (display "I have thought of a number between 1 and 10. Try to guess it!") + (newline) + (prompt)) diff --git a/Task/HTTP/8th/http.8th b/Task/HTTP/8th/http.8th new file mode 100644 index 0000000000..8bc813aa58 --- /dev/null +++ b/Task/HTTP/8th/http.8th @@ -0,0 +1 @@ +"http://www.rosettacode.org" net:get drop >s . diff --git a/Task/HTTP/EchoLisp/http.echolisp b/Task/HTTP/EchoLisp/http.echolisp new file mode 100644 index 0000000000..f01d436bbe --- /dev/null +++ b/Task/HTTP/EchoLisp/http.echolisp @@ -0,0 +1,4 @@ +;; asynchronous call back definition +(define (success name text) (writeln 'Loaded name) (writeln text)) +;; +(file->string success "http://www.google.com") diff --git a/Task/HTTP/LFE/http-1.lfe b/Task/HTTP/LFE/http-1.lfe new file mode 100644 index 0000000000..781ea4d7f4 --- /dev/null +++ b/Task/HTTP/LFE/http-1.lfe @@ -0,0 +1,6 @@ +(: inets start) +(case (: httpc request '"http://lfe.github.io") + ((tuple 'ok result) + (: io format '"Result: ~p" (list result))) + ((tuple 'error reason) + (: io format '"Error: ~p~n" (list reason)))) diff --git a/Task/HTTP/LFE/http-2.lfe b/Task/HTTP/LFE/http-2.lfe new file mode 100644 index 0000000000..18f2e1b246 --- /dev/null +++ b/Task/HTTP/LFE/http-2.lfe @@ -0,0 +1,13 @@ +(: inets start) +(let* ((method 'get) + (url '"http://lfe.github.io") + (headers ()) + (request-data (tuple url headers)) + (http-options ()) + (request-options (list (tuple 'sync 'false)))) + (: httpc request method request-data http-options request-options) + (receive + ((tuple 'http (tuple request-id (tuple 'error reason))) + (: io format '"Error: ~p~n" (list reason))) + ((tuple 'http (tuple request-id result)) + (: io format '"Result: ~p~n" (list result)))))) diff --git a/Task/HTTP/Lasso/http.lasso b/Task/HTTP/Lasso/http.lasso new file mode 100644 index 0000000000..be8a61b61a --- /dev/null +++ b/Task/HTTP/Lasso/http.lasso @@ -0,0 +1,10 @@ +// using include_url wrapper: +include_url('http://rosettacode.org/index.html') + +// one line curl +curl('http://rosettacode.org/index')->result->asString + +// using curl for more complex operations and feedback +local(x = curl('http://rosettacode.org/index')) +local(y = #x->result) +#y->asString diff --git a/Task/HTTP/Lingo/http-1.lingo b/Task/HTTP/Lingo/http-1.lingo new file mode 100644 index 0000000000..8ce977db03 --- /dev/null +++ b/Task/HTTP/Lingo/http-1.lingo @@ -0,0 +1,30 @@ +property _netID +property _cbHandler +property _cbTarget + +---------------------------------------- +-- Simple HTTP GET request +-- @param {string} url +-- @param {symbol} cbHandler +-- @param {object} [cbTarget=_movie] +---------------------------------------- +on new (me, url, cbHandler, cbTarget) + if voidP(cbTarget) then cbTarget = _movie + me._netID = getNetText(url) + me._cbHandler = cbHandler + me._cbTarget = cbTarget + _movie.actorList.add(me) + return me +end + +---------------------------------------- +-- @callback +---------------------------------------- +on stepFrame (me) + if netDone(me._netID) then + res = netTextResult(me._netID) + err = netError(me._netID) + _movie.actorList.deleteOne(me) + call(me._cbHandler, me._cbTarget, res, err) + end if +end diff --git a/Task/HTTP/Lingo/http-2.lingo b/Task/HTTP/Lingo/http-2.lingo new file mode 100644 index 0000000000..e51e6beffd --- /dev/null +++ b/Task/HTTP/Lingo/http-2.lingo @@ -0,0 +1,17 @@ +---------------------------------------- +-- +---------------------------------------- +on getAdobeHomePage () + script("SimpleHttpGet").new("http://www.adobe.com/", #printResult) +end + +---------------------------------------- +-- @callback +---------------------------------------- +on printResult (res, err) + if err="OK" then + put res + else + put "Network Error:" && err + end if +end diff --git a/Task/HTTP/Lingo/http-3.lingo b/Task/HTTP/Lingo/http-3.lingo new file mode 100644 index 0000000000..581457d5b6 --- /dev/null +++ b/Task/HTTP/Lingo/http-3.lingo @@ -0,0 +1,3 @@ +getAdobeHomePage() +-- " +... diff --git a/Task/HTTP/LiveCode/http-1.livecode b/Task/HTTP/LiveCode/http-1.livecode new file mode 100644 index 0000000000..8e4aa14bb4 --- /dev/null +++ b/Task/HTTP/LiveCode/http-1.livecode @@ -0,0 +1,3 @@ +put true into libURLFollowHttpRedirects +get URL "http://httpbin.org/html" +put it diff --git a/Task/HTTP/LiveCode/http-2.livecode b/Task/HTTP/LiveCode/http-2.livecode new file mode 100644 index 0000000000..c3b2881290 --- /dev/null +++ b/Task/HTTP/LiveCode/http-2.livecode @@ -0,0 +1,7 @@ +on myUrlDownloadFinished + answer "Download Complete" with "Okay" +end myUrlDownloadFinished + +command getWebResource + load URL "http://httpbin.org/html" with message "myUrlDownloadFinished" +end getWebResource diff --git a/Task/HTTP/Nim/http.nim b/Task/HTTP/Nim/http.nim new file mode 100644 index 0000000000..0e4fa4ce54 --- /dev/null +++ b/Task/HTTP/Nim/http.nim @@ -0,0 +1,3 @@ +import httpclient + +echo getContent "http://rosettacode.org" diff --git a/Task/HTTP/Peloton/http-1.peloton b/Task/HTTP/Peloton/http-1.peloton new file mode 100644 index 0000000000..8183050b74 --- /dev/null +++ b/Task/HTTP/Peloton/http-1.peloton @@ -0,0 +1 @@ +<@ SAYURLLIT>http://rosettacode.org/wiki/Main_Page diff --git a/Task/HTTP/Peloton/http-2.peloton b/Task/HTTP/Peloton/http-2.peloton new file mode 100644 index 0000000000..727442c3c8 --- /dev/null +++ b/Task/HTTP/Peloton/http-2.peloton @@ -0,0 +1 @@ +<# SAY URLSOURCE LITERAL>http://rosettacode.org/wiki/Main_Page diff --git a/Task/HTTP/Ring/http.ring b/Task/HTTP/Ring/http.ring new file mode 100644 index 0000000000..8a119e540c --- /dev/null +++ b/Task/HTTP/Ring/http.ring @@ -0,0 +1 @@ +See download("http://rosettacode.org") diff --git a/Task/HTTP/Sidef/http.sidef b/Task/HTTP/Sidef/http.sidef new file mode 100644 index 0000000000..467928aabe --- /dev/null +++ b/Task/HTTP/Sidef/http.sidef @@ -0,0 +1,13 @@ +func get(url) { + var lwp = ( + try { require('LWP::UserAgent') } + catch { warn "'LWP::UserAgent' is not installed!"; return } + ); + var ua = lwp.new(agent => 'Mozilla/5.0'); + if (var resp = ua.get(url); resp.is_success) { + return resp.decoded_content; + }; + return; +} + +print get("http://rosettacode.org"); diff --git a/Task/HTTP/Swift/http.swift b/Task/HTTP/Swift/http.swift new file mode 100644 index 0000000000..fbfa4e3006 --- /dev/null +++ b/Task/HTTP/Swift/http.swift @@ -0,0 +1,15 @@ +import Foundation + +let request = NSURLRequest(URL: NSURL(string: "http://rosettacode.org/")!) + +// Using trailing closure +NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue()) {res, data, err in + + // data is binary + if (data != nil) { + let string = NSString(data: data!, encoding: NSUTF8StringEncoding) + println(string) + } +} + +CFRunLoopRun() // dispatch diff --git a/Task/HTTPS-Authenticated/Lasso/https-authenticated.lasso b/Task/HTTPS-Authenticated/Lasso/https-authenticated.lasso new file mode 100644 index 0000000000..233c75627e --- /dev/null +++ b/Task/HTTPS-Authenticated/Lasso/https-authenticated.lasso @@ -0,0 +1,5 @@ +local(username = 'hello',password = 'world') +local(x = curl('https://sourceforge.net')) +#x->set(CURLOPT_USERPWD, #username + ':' + #password) +local(y = #x->result) +#y->asString diff --git a/Task/HTTPS-Authenticated/LiveCode/https-authenticated-1.livecode b/Task/HTTPS-Authenticated/LiveCode/https-authenticated-1.livecode new file mode 100644 index 0000000000..1bc644712f --- /dev/null +++ b/Task/HTTPS-Authenticated/LiveCode/https-authenticated-1.livecode @@ -0,0 +1,6 @@ +command getAuthWebResource + libURLFollowHttpRedirects true + libURLSetSSLVerification true + put URL "https://user:passwd@example.basicauth.com/" into response + put response +end getAuthWebResource diff --git a/Task/HTTPS-Authenticated/LiveCode/https-authenticated-2.livecode b/Task/HTTPS-Authenticated/LiveCode/https-authenticated-2.livecode new file mode 100644 index 0000000000..fb0165b51b --- /dev/null +++ b/Task/HTTPS-Authenticated/LiveCode/https-authenticated-2.livecode @@ -0,0 +1,7 @@ +command getAuthWebResource + libURLFollowHttpRedirects true + libURLSetSSLVerification true + set the httpHeaders to "Authorization: Basic " && base64Encode("user:passwd") + put URL "https://example.basicauth.com" into response + put response +end getAuthWebResource diff --git a/Task/HTTPS-Authenticated/Sidef/https-authenticated.sidef b/Task/HTTPS-Authenticated/Sidef/https-authenticated.sidef new file mode 100644 index 0000000000..dd561cab76 --- /dev/null +++ b/Task/HTTPS-Authenticated/Sidef/https-authenticated.sidef @@ -0,0 +1,14 @@ +require('WWW::Mechanize') + +var mech = %s'WWW::Mechanize'.new( + cookie_jar => Hash.new, + agent => 'Mozilla/5.0', +) + +mech.get('https://login.yahoo.com/') +mech.submit_form( + form_id => 'mbr-login-form', # form id + fields => Hash.new( + 'login' => 'XXXXXX', + 'passwd' => 'YYYYYY', +)) diff --git a/Task/HTTPS-Client-authenticated/Lasso/https-client-authenticated.lasso b/Task/HTTPS-Client-authenticated/Lasso/https-client-authenticated.lasso new file mode 100644 index 0000000000..6b7ae0dcd0 --- /dev/null +++ b/Task/HTTPS-Client-authenticated/Lasso/https-client-authenticated.lasso @@ -0,0 +1,5 @@ +local(sslcert = file('myCert.pem')) +local(x = curl('https://sourceforge.net')) +#x->set(CURLOPT_SSLCERT, #sslcert->readstring) +#sslcert->close +#x->result->asString diff --git a/Task/HTTPS/EchoLisp/https.echolisp b/Task/HTTPS/EchoLisp/https.echolisp new file mode 100644 index 0000000000..dfe37f45be --- /dev/null +++ b/Task/HTTPS/EchoLisp/https.echolisp @@ -0,0 +1,4 @@ +;; asynchronous call back definition +(define (success name text) (writeln 'Loaded name) (writeln text)) +;; +(file->string success "https:/sourceforge.net") diff --git a/Task/HTTPS/Lasso/https.lasso b/Task/HTTPS/Lasso/https.lasso new file mode 100644 index 0000000000..b0d8b0042f --- /dev/null +++ b/Task/HTTPS/Lasso/https.lasso @@ -0,0 +1,3 @@ +local(x = curl('https://sourceforge.net')) +local(y = #x->result) +#y->asString diff --git a/Task/HTTPS/Lingo/https-1.lingo b/Task/HTTPS/Lingo/https-1.lingo new file mode 100644 index 0000000000..b158d4be7f --- /dev/null +++ b/Task/HTTPS/Lingo/https-1.lingo @@ -0,0 +1,10 @@ +ch = xtra("Curl").new() +CURLOPT_URL = 10002 +ch.setOption(CURLOPT_URL, "https://sourceforge.net") +res = ch.exec(1) +if integerP(res) then + put "Error:" && curl_error(res) +else + put "Result:" && res.readRawString(res.length) +end if +-- "Result: ..." diff --git a/Task/HTTPS/Lingo/https-2.lingo b/Task/HTTPS/Lingo/https-2.lingo new file mode 100644 index 0000000000..91e61912bf --- /dev/null +++ b/Task/HTTPS/Lingo/https-2.lingo @@ -0,0 +1,2 @@ +sx = xtra("Shell").new() +put sx.shell_cmd("curl https://sourceforge.net") diff --git a/Task/HTTPS/LiveCode/https-1.livecode b/Task/HTTPS/LiveCode/https-1.livecode new file mode 100644 index 0000000000..958a86c17c --- /dev/null +++ b/Task/HTTPS/LiveCode/https-1.livecode @@ -0,0 +1,2 @@ +libURLSetSSLVerification true --check cert +get URL "https://sourceforge.net/" diff --git a/Task/HTTPS/LiveCode/https-2.livecode b/Task/HTTPS/LiveCode/https-2.livecode new file mode 100644 index 0000000000..357918ebe6 --- /dev/null +++ b/Task/HTTPS/LiveCode/https-2.livecode @@ -0,0 +1,10 @@ +on myUrlDownloadFinished + get URL "https://sourceforge.net/" -- this will now fetch a locally cached copy + put it +end myUrlDownloadFinished + +command getWebResource + libURLFollowHttpRedirects true + libURLSetSSLVerification true --check cert + load URL "https://sourceforge.net/" with message "myUrlDownloadFinished" +end getWebResource diff --git a/Task/HTTPS/Nim/https.nim b/Task/HTTPS/Nim/https.nim new file mode 100644 index 0000000000..703744b70e --- /dev/null +++ b/Task/HTTPS/Nim/https.nim @@ -0,0 +1,3 @@ +import httpclient + +echo getContent "https://sourceforge.net" diff --git a/Task/HTTPS/Ring/https.ring b/Task/HTTPS/Ring/https.ring new file mode 100644 index 0000000000..6a262c562b --- /dev/null +++ b/Task/HTTPS/Ring/https.ring @@ -0,0 +1,2 @@ +cStr= download("http://sourceforge.net/") +see cStr + nl diff --git a/Task/HTTPS/Sidef/https.sidef b/Task/HTTPS/Sidef/https.sidef new file mode 100644 index 0000000000..aab3e6fb1d --- /dev/null +++ b/Task/HTTPS/Sidef/https.sidef @@ -0,0 +1,11 @@ +var lwp = require('LWP::UserAgent'); # LWP::Protocol::https is needed +var url = 'https://rosettacode.org'; + +var ua = lwp.new( + agent => 'Mozilla/5.0', + ssl_opts => Hash.new(verify_hostname => 1), +); + +var resp = ua.get(url); +resp.is_success || die "Failed to GET #{url.dump}: #{resp.status_line}"; +print resp.decoded_content; diff --git a/Task/HTTPS/Swift/https.swift b/Task/HTTPS/Swift/https.swift new file mode 100644 index 0000000000..5e1b1adbb4 --- /dev/null +++ b/Task/HTTPS/Swift/https.swift @@ -0,0 +1,15 @@ +import Foundation + +// With https +let request = NSURLRequest(URL: NSURL(string: "https://sourceforge.net")!) + +NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue()) {res, data, err in // callback + + // data is binary + if (data != nil) { + let string = NSString(data: data!, encoding: NSUTF8StringEncoding) + println(string) + } +} + +CFRunLoopRun() // dispatch diff --git a/Task/Hailstone-sequence/Ceylon/hailstone-sequence.ceylon b/Task/Hailstone-sequence/Ceylon/hailstone-sequence.ceylon new file mode 100644 index 0000000000..70a60a148f --- /dev/null +++ b/Task/Hailstone-sequence/Ceylon/hailstone-sequence.ceylon @@ -0,0 +1,23 @@ +shared void run() { + + {Integer*} hailstone(variable Integer n) { + variable [Integer*] stones = [n]; + while(n != 1) { + n = if(n.even) then n / 2 else 3 * n + 1; + stones = stones.append([n]); + } + return stones; + } + + value hs27 = hailstone(27); + print("hailstone sequence for 27 is ``hs27.take(3)``...``hs27.skip(hs27.size - 3).take(3)`` with length ``hs27.size``"); + + variable value longest = hailstone(1); + for(i in 2..100k - 1) { + value current = hailstone(i); + if(current.size > longest.size) { + longest = current; + } + } + print("the longest sequence under 100,000 starts with ``longest.first else "what?"`` and has length ``longest.size``"); +} diff --git a/Task/Hailstone-sequence/ERRE/hailstone-sequence.erre b/Task/Hailstone-sequence/ERRE/hailstone-sequence.erre new file mode 100644 index 0000000000..6ff38aed1a --- /dev/null +++ b/Task/Hailstone-sequence/ERRE/hailstone-sequence.erre @@ -0,0 +1,30 @@ +PROGRAM ULAM + +!$DOUBLE + +PROCEDURE HAILSTONE(X,PRT%->COUNT) + COUNT=1 + IF PRT% THEN PRINT(X,) END IF + REPEAT + IF X/2<>INT(X/2) THEN + X=X*3+1 + ELSE + X=X/2 + END IF + IF PRT% THEN PRINT(X,) END IF + COUNT=COUNT+1 + UNTIL X=1 + IF PRT% THEN PRINT END IF +END PROCEDURE + +BEGIN + HAILSTONE(27,TRUE->COUNT) + PRINT("Sequence length for 27:";COUNT) + MAX_COUNT=2 + NMAX=2 + FOR I=3 TO 100000 DO + HAILSTONE(I,FALSE->COUNT) + IF COUNT>MAX_COUNT THEN NMAX=I MAX_COUNT=COUNT END IF + END FOR + PRINT("Max. number is";NMAX;" with";MAX_COUNT;"elements") +END PROGRAM diff --git a/Task/Hailstone-sequence/EchoLisp/hailstone-sequence-1.echolisp b/Task/Hailstone-sequence/EchoLisp/hailstone-sequence-1.echolisp new file mode 100644 index 0000000000..b3a62bab01 --- /dev/null +++ b/Task/Hailstone-sequence/EchoLisp/hailstone-sequence-1.echolisp @@ -0,0 +1,28 @@ +(lib 'hash) +(lib 'sequences) +(lib 'compile) + +(define (hailstone n) +(when (> n 1) + (if (even? n) (/ n 2) (1+ (* n 3))))) + +(define H (make-hash)) + +;; (iterator/f seed f) returns seed, (f seed) (f(f seed)) ... + +(define (hlength seed) + (define collatz (iterator/f hailstone seed)) + (or + (hash-ref H seed) ;; known ? + (hash-set H seed + (for ((i (in-naturals)) (h collatz)) + ;; add length of subsequence if already known + #:break (hash-ref H h) => (+ i (hash-ref H h)) + (1+ i))))) + +(define (task (nmax 100000)) + (for ((n [1 .. nmax])) (hlength n)) ;; fill hash table + + (define hmaxlength (apply max (hash-values H))) + (define hmaxseed (hash-get-key H hmaxlength)) + (writeln 'maxlength= hmaxlength 'for hmaxseed)) diff --git a/Task/Hailstone-sequence/EchoLisp/hailstone-sequence-2.echolisp b/Task/Hailstone-sequence/EchoLisp/hailstone-sequence-2.echolisp new file mode 100644 index 0000000000..0a5e6781fb --- /dev/null +++ b/Task/Hailstone-sequence/EchoLisp/hailstone-sequence-2.echolisp @@ -0,0 +1,32 @@ +(define H27 (iterator/f hailstone 27)) +(take H27 6) + → (27 82 41 124 62 31) +(length H27) + → 112 +(list-tail (take H27 112) -6) + → (5 16 8 4 2 1) + +(task) +maxlength= 351 for 77031 + +;; more ... +(lib 'bigint) + +(task 200000) + maxlength= 383 for 156159 +(task 300000) + maxlength= 443 for 230631 +(task 400000) + maxlength= 443 for 230631 +(task 500000) + maxlength= 449 for 410011 +(task 600000) + maxlength= 470 for 511935 +(task 700000) + maxlength= 509 for 626331 +(task 800000) + maxlength= 509 for 626331 +(task 900000) + maxlength= 525 for 837799 +(task 1000000) + maxlength= 525 for 837799 diff --git a/Task/Hailstone-sequence/Ezhil/hailstone-sequence.ezhil b/Task/Hailstone-sequence/Ezhil/hailstone-sequence.ezhil new file mode 100644 index 0000000000..dc00b77809 --- /dev/null +++ b/Task/Hailstone-sequence/Ezhil/hailstone-sequence.ezhil @@ -0,0 +1,20 @@ +நிரல்பாகம் hailstone ( எண் ) + பதிப்பி "=> ",எண் #hailstone seq + @( எண் == 1 ) ஆனால் + பின்கொடு எண் + முடி + + @( (எண்%2) == 1 ) ஆனால் + hailstone( 3*எண் + 1) + இல்லை + hailstone( எண்/2 ) + முடி +முடி + + +எண்கள் = [5,17,19,23,37] +@(எண்கள் இல் இவ்வெண்) ஒவ்வொன்றாக + பதிப்பி "****** calculating hailstone seq for ",இவ்வெண்," *********" + hailstone( இவ்வெண் ) + பதிப்பி "**********************************************" +முடி diff --git a/Task/Hailstone-sequence/FunL/hailstone-sequence.funl b/Task/Hailstone-sequence/FunL/hailstone-sequence.funl new file mode 100644 index 0000000000..f98a88cb2c --- /dev/null +++ b/Task/Hailstone-sequence/FunL/hailstone-sequence.funl @@ -0,0 +1,11 @@ +def + hailstone( 1 ) = [1] + hailstone( n ) = n # hailstone( if 2|n then n/2 else n*3 + 1 ) + +if _name_ == '-main-' + h27 = hailstone( 27 ) + assert( h27.length() == 112 and h27.startsWith([27, 82, 41, 124]) and h27.endsWith([8, 4, 2, 1]) ) + + val (n, len) = maxBy( snd, [(i, hailstone( i ).length()) | i <- 1:100000] ) + + println( n, len ) diff --git a/Task/Hailstone-sequence/Futhark/hailstone-sequence.futhark b/Task/Hailstone-sequence/Futhark/hailstone-sequence.futhark new file mode 100644 index 0000000000..b96d23c881 --- /dev/null +++ b/Task/Hailstone-sequence/Futhark/hailstone-sequence.futhark @@ -0,0 +1,32 @@ +fun hailstone_step(x: int): int = + if (x % 2) == 0 + then x/2 + else (3*x) + 1 + +fun hailstone_seq(x: int): []int = + let capacity = 100 + let i = 1 + let steps = replicate capacity (-1) + let steps[0] = x + loop ((capacity,i,steps,x)) = while x != 1 do + let (steps, capacity) = + if i == capacity then + (concat steps (replicate capacity (-1)), + capacity * 2) + else (steps, capacity) + let x = hailstone_step x + let steps[i] = x + in (capacity, i+1, steps, x) + in (split i steps).0 + +fun hailstone_len(x: int): int = + let i = 1 + loop ((i,x)) = while x != 1 do + (i+1, hailstone_step x) + in i + +fun max (x: int) (y: int): int = if x < y then y else x + +fun main (x: int) (n: int): ([]int, int) = + (hailstone_seq x, + reduce max 0 (map hailstone_len (map (1+) (iota (n-1))))) diff --git a/Task/Hailstone-sequence/Lasso/hailstone-sequence.lasso b/Task/Hailstone-sequence/Lasso/hailstone-sequence.lasso new file mode 100644 index 0000000000..638720bd59 --- /dev/null +++ b/Task/Hailstone-sequence/Lasso/hailstone-sequence.lasso @@ -0,0 +1,32 @@ +[ + define_tag("hailstone", -required="n", -type="integer", -copy); + local("sequence") = array(#n); + while(#n != 1); + ((#n % 2) == 0) ? #n = (#n / 2) | #n = (#n * 3 + 1); + #sequence->insert(#n); + /while; + return(#sequence); + /define_tag; + + local("result"); + #result = hailstone(27); + while(#result->size > 8); + #result->remove(5); + /while; + #result->insert("...",5); + + "Hailstone sequence for n = 27 -> { " + #result->join(", ") + " }"; + + local("longest_sequence") = 0; + local("longest_index") = 0; + loop(-from=1, -to=100000); + local("length") = hailstone(loop_count)->size; + if(#length > #longest_sequence); + #longest_index = loop_count; + #longest_sequence = #length; + /if; + /loop; + + "
"; + "Number with the longest sequence under 100,000: " #longest_index + ", with " + #longest_sequence + " elements."; +] diff --git a/Task/Hailstone-sequence/Lingo/hailstone-sequence-1.lingo b/Task/Hailstone-sequence/Lingo/hailstone-sequence-1.lingo new file mode 100644 index 0000000000..5dea069515 --- /dev/null +++ b/Task/Hailstone-sequence/Lingo/hailstone-sequence-1.lingo @@ -0,0 +1,14 @@ +on hailstone (n, sequenceList) + len = 1 + repeat while n<>1 + if listP(sequenceList) then sequenceList.add(n) + if n mod 2 = 0 then + n = n / 2 + else + n = 3 * n + 1 + end if + len = len + 1 + end repeat + if listP(sequenceList) then sequenceList.add(n) + return len +end diff --git a/Task/Hailstone-sequence/Lingo/hailstone-sequence-2.lingo b/Task/Hailstone-sequence/Lingo/hailstone-sequence-2.lingo new file mode 100644 index 0000000000..ab292b9e9b --- /dev/null +++ b/Task/Hailstone-sequence/Lingo/hailstone-sequence-2.lingo @@ -0,0 +1,16 @@ +sequenceList = [] +hailstone(27, sequenceList) +put sequenceList +-- [27, 82, 41, 124, ... , 8, 4, 2, 1] + +n = 0 +maxLen = 0 +repeat with i = 1 to 99999 + len = hailstone(i) + if len>maxLen then + n = i + maxLen = len + end if +end repeat +put n, maxLen +-- 77031 351 diff --git a/Task/Hailstone-sequence/Nim/hailstone-sequence.nim b/Task/Hailstone-sequence/Nim/hailstone-sequence.nim new file mode 100644 index 0000000000..f6817f28c7 --- /dev/null +++ b/Task/Hailstone-sequence/Nim/hailstone-sequence.nim @@ -0,0 +1,19 @@ +proc hailstone(n): auto = + result = @[n] + var n = n + while n > 1: + if (n and 1) == 1: + n = 3 * n + 1 + else: + n = n div 2 + result.add n + +let h = hailstone 27 +assert h.len == 112 and h[0..3] == @[27,82,41,124] and h[h.high-3..h.high] == @[8,4,2,1] +var m, mi = 0 +for i in 1 .. <100_000: + let n = hailstone(i).len + if n > m: + m = n + mi = i +echo "Maximum length ", m, " was found for hailstone(", mi, ") for numbers <100,000" diff --git a/Task/Hailstone-sequence/Oforth/hailstone-sequence.oforth b/Task/Hailstone-sequence/Oforth/hailstone-sequence.oforth new file mode 100644 index 0000000000..f2a172ce6f --- /dev/null +++ b/Task/Hailstone-sequence/Oforth/hailstone-sequence.oforth @@ -0,0 +1,8 @@ +: hailstone // n -- [n] +| l | + ListBuffer new ->l + while(dup 1 <>) [ dup l add dup isEven ifTrue: [ 2 / ] else: [ 3 * 1+ ] ] + l add l dup freeze ; + +hailstone(27) dup size println dup left(4) println right(4) println +100000 seq map(#[ dup hailstone size swap Pair new ]) reduce(#maxKey) println diff --git a/Task/Hailstone-sequence/Phix/hailstone-sequence.phix b/Task/Hailstone-sequence/Phix/hailstone-sequence.phix new file mode 100644 index 0000000000..e55fc8bfc2 --- /dev/null +++ b/Task/Hailstone-sequence/Phix/hailstone-sequence.phix @@ -0,0 +1,43 @@ +function hailstone(atom n) +sequence s = {n} + while n!=1 do + if remainder(n,2)=0 then + n /= 2 + else + n = 3*n+1 + end if + s &= n + end while + return s +end function + +function hailstone_count(atom n) +integer count = 1 + while n!=1 do + if remainder(n,2)=0 then + n /= 2 + else + n = 3*n+1 + end if + count += 1 + end while + return count +end function + +sequence s = hailstone(27) +integer ls = length(s) +s[5..-5] = {".."} +puts(1,"hailstone(27) = ") +? s +printf(1,"length = %d\n\n",ls) + +integer hmax = 1, imax = 1,count +for i=2 to 1e5-1 do + count = hailstone_count(i) + if count>hmax then + hmax = count + imax = i + end if +end for + +printf(1,"The longest hailstone sequence under 100,000 is %d with %d elements.\n",{imax,hmax}) diff --git a/Task/Hailstone-sequence/Ring/hailstone-sequence.ring b/Task/Hailstone-sequence/Ring/hailstone-sequence.ring new file mode 100644 index 0000000000..261cae3606 --- /dev/null +++ b/Task/Hailstone-sequence/Ring/hailstone-sequence.ring @@ -0,0 +1,20 @@ +size = 27 +aList = [] +hailstone(size) + +func hailstone n + add(aList,n) + while n != 1 + if n % 2 = 0 n = n / 2 + else n = 3 * n + 1 ok + add(aList, n) + end + see "first 4 elements : " + for i = 1 to 4 + see "" + aList[i] + " " + next + see nl + see "last 4 elements : " + for i = len(aList) - 3 to len(aList) + see "" + aList[i] + " " + next diff --git a/Task/Hailstone-sequence/Sidef/hailstone-sequence.sidef b/Task/Hailstone-sequence/Sidef/hailstone-sequence.sidef new file mode 100644 index 0000000000..4979c2768b --- /dev/null +++ b/Task/Hailstone-sequence/Sidef/hailstone-sequence.sidef @@ -0,0 +1,24 @@ +func hailstone (n) { + var sequence = [n]; + while (n > 1) { + sequence.append( + n.is_even ? n.div!(2) + : n.mul!(3).add!(1) + ); + } + return(sequence); +} + +# The hailstone sequence for the number 27 +var arr = hailstone(var nr = 27); +say "#{nr}: #{arr.first(4).to_s} ... #{arr.last(4).to_s} (#{arr.len})"; + +# The longest hailstone sequence for a number less than 100,000 +var h = [0, 0]; +99_999.times { |i| + (var l = hailstone(i).len) > h[1] && ( + h = [i, l]; + ); +} + +printf("%d: (%d)\n", h...); diff --git a/Task/Hailstone-sequence/Swift/hailstone-sequence.swift b/Task/Hailstone-sequence/Swift/hailstone-sequence.swift new file mode 100644 index 0000000000..ed1a730368 --- /dev/null +++ b/Task/Hailstone-sequence/Swift/hailstone-sequence.swift @@ -0,0 +1,34 @@ +func hailstone(var n:Int) -> [Int] { + + var arr = [n] + + while n != 1 { + + if n % 2 == 0 { + n /= 2 + } else { + n = (3 * n) + 1 + } + + arr.append(n) + } + + return arr +} + +let n = hailstone(27) + +println("hailstone(27): \(n[0...3]) ... \(n[n.count-4...n.count-1]) for a count of \(n.count).") + +var longest = (n: 1, len: 1) + +for i in 1...100_000 { + + let new = hailstone(i) + + if new.count > longest.len { + longest = (i, new.count) + } +} + +println("Longest sequence for numbers under 100,000 is with \(longest.n). Which has \(longest.len) items.") diff --git a/Task/Hailstone-sequence/Ursa/hailstone-sequence.ursa b/Task/Hailstone-sequence/Ursa/hailstone-sequence.ursa new file mode 100644 index 0000000000..b241fa6612 --- /dev/null +++ b/Task/Hailstone-sequence/Ursa/hailstone-sequence.ursa @@ -0,0 +1,15 @@ +import "math" + +def hailstone (int n) + decl int<> seq + while (> n 1) + append n seq + if (= (mod n 2) 0) + set n (floor (/ n 2)) + else + set n (int (+ (* 3 n) 1)) + end if + end while + append n seq + return seq +end hailstone diff --git a/Task/Hailstone-sequence/jq/hailstone-sequence-1.jq b/Task/Hailstone-sequence/jq/hailstone-sequence-1.jq new file mode 100644 index 0000000000..c14dd95e1d --- /dev/null +++ b/Task/Hailstone-sequence/jq/hailstone-sequence-1.jq @@ -0,0 +1,16 @@ +# Generate the hailstone sequence as a stream to save space (and time) when counting +def hailstone: + recurse( if . > 1 then + if . % 2 == 0 then ./2|floor else 3*. + 1 end + else empty + end ); + +def count(g): reduce g as $i (0; .+1); + +# return [i, length] for the first maximal-length hailstone sequence where i is in [1 .. n] +def max_hailstone(n): + # state: [i, length] + reduce range(1; n+1) as $i + ([0,0]; + ($i | count(hailstone)) as $l + | if $l > .[1] then [$i, $l] else . end); diff --git a/Task/Hailstone-sequence/jq/hailstone-sequence-2.jq b/Task/Hailstone-sequence/jq/hailstone-sequence-2.jq new file mode 100644 index 0000000000..c6b0fe55d9 --- /dev/null +++ b/Task/Hailstone-sequence/jq/hailstone-sequence-2.jq @@ -0,0 +1,7 @@ +[27|hailstone] as $h +| "[27|hailstone]|length is \($h|length)", + "The first four numbers: \($h[0:4])", + "The last four numbers: \($h|.[length-4:length])", + "", + max_hailstone(100000) as $m + | "Maximum length for n|hailstone for n in 1..100000 is \($m[1]) (n == \($m[0]))" diff --git a/Task/Hailstone-sequence/jq/hailstone-sequence-3.jq b/Task/Hailstone-sequence/jq/hailstone-sequence-3.jq new file mode 100644 index 0000000000..a5c6a0d931 --- /dev/null +++ b/Task/Hailstone-sequence/jq/hailstone-sequence-3.jq @@ -0,0 +1,6 @@ +$ jq -M -r -n -f hailstone.jq +[27|hailstone]|length is 112 +The first four numbers: [27,82,41,124] +The last four numbers: [8,4,2,1] + +Maximum length for n|hailstone for n in 1..100000 is 351 (n == 77031) diff --git a/Task/Hamming-numbers/ERRE/hamming-numbers.erre b/Task/Hamming-numbers/ERRE/hamming-numbers.erre new file mode 100644 index 0000000000..8ee9b1b26b --- /dev/null +++ b/Task/Hamming-numbers/ERRE/hamming-numbers.erre @@ -0,0 +1,30 @@ +PROGRAM HAMMING + +!$DOUBLE + +DIM H[2000] + +PROCEDURE HAMMING(L%->RES) + LOCAL I%,J%,K%,N%,M,X2,X3,X5 + H[0]=1 + X2=2 X3=3 X5=5 + FOR N%=1 TO L%-1 DO + M=X2 + IF M>X3 THEN M=X3 END IF + IF M>X5 THEN M=X5 END IF + H[N%]=M + IF M=X2 THEN I%+=1 X2=2*H[I%] END IF + IF M=X3 THEN J%+=1 X3=3*H[J%] END IF + IF M=X5 THEN K%+=1 X5=5*H[K%] END IF + END FOR + RES=H[L%-1] +END PROCEDURE + +BEGIN + FOR H%=1 TO 20 DO + HAMMING(H%->RES) + PRINT("H(";H%;")=";RES) + END FOR + HAMMING(1691->RES) + PRINT("H(1691)=";RES) +END PROGRAM diff --git a/Task/Hamming-numbers/FreeBASIC/hamming-numbers.freebasic b/Task/Hamming-numbers/FreeBASIC/hamming-numbers.freebasic new file mode 100644 index 0000000000..8326ab540e --- /dev/null +++ b/Task/Hamming-numbers/FreeBASIC/hamming-numbers.freebasic @@ -0,0 +1,45 @@ +' FB 1.05.0 Win64 + +' The biggest integer which FB supports natively is 8 bytes so unable +' to calculate 1 millionth Hamming number without using an external +' "bigint" library such as GMP + +Function min(x As Integer, y As Integer) As Integer + Return IIf(x < y, x, y) +End Function + +Function hamming(n As Integer) As Integer + Dim h(1 To n) As Integer + h(1) = 1 + Dim As Integer i = 1, j = 1, k = 1 + Dim As Integer x2 = 2, x3 = 3, x5 = 5 + + For m As Integer = 2 To n + h(m) = min(x2, min(x3, x5)) + If h(m) = x2 Then + i += 1 + x2 = 2 * h(i) + End If + If h(m) = x3 Then + j += 1 + x3 = 3 * h(j) + End if + If h(m) = x5 Then + k += 1 + x5 = 5 * h(k) + End If + Next + + Return h(n) +End Function + +Print "The first 20 Hamming numbers are :" +For i As Integer = 1 To 20 + Print hamming(i); " "; +Next +Print : Print +Print "The 1691st hamming number is :" +Print hamming(1691) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Hamming-numbers/FunL/hamming-numbers-1.funl b/Task/Hamming-numbers/FunL/hamming-numbers-1.funl new file mode 100644 index 0000000000..23332ef22b --- /dev/null +++ b/Task/Hamming-numbers/FunL/hamming-numbers-1.funl @@ -0,0 +1,25 @@ +native scala.collection.mutable.Queue + +val hamming = + q2 = Queue() + q3 = Queue() + q5 = Queue() + + def enqueue( n ) = + q2.enqueue( n*2 ) + q3.enqueue( n*3 ) + q5.enqueue( n*5 ) + + def stream = + val n = min( min(q2.head(), q3.head()), q5.head() ) + + if q2.head() == n then q2.dequeue() + if q3.head() == n then q3.dequeue() + if q5.head() == n then q5.dequeue() + + enqueue( n ) + n # stream() + + for q <- [q2, q3, q5] do q.enqueue( 1 ) + + stream() diff --git a/Task/Hamming-numbers/FunL/hamming-numbers-2.funl b/Task/Hamming-numbers/FunL/hamming-numbers-2.funl new file mode 100644 index 0000000000..553f150a4c --- /dev/null +++ b/Task/Hamming-numbers/FunL/hamming-numbers-2.funl @@ -0,0 +1,11 @@ +val hamming = 1 # merge( map((2*), hamming), merge(map((3*), hamming), map((5*), hamming)) ) + +def + merge( inx@x:_, iny@y:_ ) + | x < y = x # merge( inx.tail(), iny ) + | x > y = y # merge( inx, iny.tail() ) + | otherwise = merge( inx, iny.tail() ) + +println( hamming.take(20) ) +println( hamming(1690) ) +println( hamming(2000) ) diff --git a/Task/Hamming-numbers/Nim/hamming-numbers-1.nim b/Task/Hamming-numbers/Nim/hamming-numbers-1.nim new file mode 100644 index 0000000000..9ee71cf918 --- /dev/null +++ b/Task/Hamming-numbers/Nim/hamming-numbers-1.nim @@ -0,0 +1,30 @@ +import bigints, math + +proc hamming(limit: int): BigInt = + var + h = newSeq[BigInt](limit) + x2 = initBigInt(2) + x3 = initBigInt(3) + x5 = initBigInt(5) + i, j, k = 0 + for i in 0..h.high: h[i] = initBigInt(1) + + for n in 1 .. < limit: + h[n] = min(x2, x3, x5) + if x2 == h[n]: + inc i + x2 = h[i] * 2 + if x3 == h[n]: + inc j + x3 = h[j] * 3 + if x5 == h[n]: + inc k + x5 = h[k] * 5 + + result = h[h.high] + +for i in 1 .. 20: + write stdout, hamming(i), " " +echo "" +echo hamming(1691) +echo hamming(1_000_000) diff --git a/Task/Hamming-numbers/Nim/hamming-numbers-2.nim b/Task/Hamming-numbers/Nim/hamming-numbers-2.nim new file mode 100644 index 0000000000..33f0ada318 --- /dev/null +++ b/Task/Hamming-numbers/Nim/hamming-numbers-2.nim @@ -0,0 +1,39 @@ +import bigints, times + +proc hamming(limit: int): BigInt = + doAssert limit > 0 + var + h = newSeq[BigInt](limit) + x2 = initBigInt(2) + x3 = initBigInt(3) + x5 = initBigInt(5) + i, j, k = 0 + h[0] = initBigInt 1 + + # BigInt comparisons are expensive, reduce them... + proc min3(x, y, z: BigInt): (int, BigInt) = + let (cs, r1) = if y == z: (0x6, y) + elif y < z: (2, y) else: (4, z) + if x == r1: (cs or 1, x) + elif x < r1: (1, x) else: (cs, r1) + + for n in 1 .. < limit: + let (cs, e1) = min3(x2, x3, x5) + h[n] = e1 + if (cs and 1) != 0: i += 1; x2 = h[i] * 2 + if (cs and 2) != 0: j += 1; x3 = h[j] * 3 + if (cs and 4) != 0: k += 1; x5 = h[k] * 5 + + h[h.high] + +for i in 1 .. 20: + write stdout, hamming(i), " " +echo "" +echo hamming(1691) + +let strt = epochTime() +let rslt = hamming(1_000_000) +let stop = epochTime() + +echo rslt +echo "This last took ", (stop - strt)*1000, " milliseconds." diff --git a/Task/Hamming-numbers/Nim/hamming-numbers-3.nim b/Task/Hamming-numbers/Nim/hamming-numbers-3.nim new file mode 100644 index 0000000000..87d4668800 --- /dev/null +++ b/Task/Hamming-numbers/Nim/hamming-numbers-3.nim @@ -0,0 +1,64 @@ +import bigints, math, sequtils, algorithm, times + +iterator func_hamming() : BigInt = + type Thunk[T] = proc(): T {.closure.} + type Lazy[T] = ref object of RootObj # tuple[val: T, thnk: Thunk[T]] + val: T + thnk: Thunk[T] + proc force[T](me: var Lazy[T]): T = # not thread-safe; needs lock on thunk + if me.thnk != nil: me.val = me.thnk(); me.thnk = nil + me.val + type LazyList[T] = ref object of RootObj # tuple[hd: T, tl: Lazy[LazyList[T]]] + hd: T + tl: Lazy[LazyList[T]] + type Mytype = LazyList[BigInt] + proc merge(x, y: Mytype): Mytype = + let xh = x.hd; let yh = y.hd + if xh < yh: + let mthnk = proc(): Mytype = merge x.tl.force, y + let mlzy = Lazy[Mytype](thnk: mthnk) + Mytype(hd: xh, tl: mlzy) + else: + let mthnk = proc(): Mytype = merge x, y.tl.force + let mlzy = Lazy[Mytype](thnk: mthnk) + Mytype(hd: yh, tl: mlzy) + proc smult(m: int32, s: Mytype): Mytype = + proc smults(ss: Mytype): Mytype = + let mthnk = proc(): Mytype = ss.tl.force.smults + let mlzy = Lazy[Mytype](thnk: mthnk) + Mytype(hd: ss.hd * m, tl: mlzy) + s.smults + proc u(s: Mytype, n: int32): Mytype = + var r: Mytype + let mthnk = proc(): Mytype = r + let mlzy = Lazy[Mytype](thnk: mthnk) + let frst = Mytype(hd: initBigInt 1, tl: mlzy) + if s == nil: r = smult(n, frst) else: r = merge(s, smult(n, frst)) + r + var hmg: Mytype = nil + for p in [5i32, 3i32, 2i32]: hmg = u(hmg, p) + yield initBigInt 1 + while true: # loop almost forever + yield initBigInt hmg.hd + hmg = hmg.tl.force + +var cnt = 1 +for h in func_hamming(): + if cnt > 20: break + write stdout, h, " "; cnt += 1 +echo "" +cnt = 1 +for h in func_hamming(): + if cnt < 1691: cnt += 1; continue + else: echo h; break + +let strt = epochTime() +var rslt: BigInt +cnt = 1 +for h in func_hamming(): + if cnt < 1000000: cnt += 1; continue + else: rslt = h; break +let stop = epochTime() + +echo rslt +echo "This last took ", (stop - strt)*1000, " milliseconds." diff --git a/Task/Hamming-numbers/Nim/hamming-numbers-4.nim b/Task/Hamming-numbers/Nim/hamming-numbers-4.nim new file mode 100644 index 0000000000..04911969c9 --- /dev/null +++ b/Task/Hamming-numbers/Nim/hamming-numbers-4.nim @@ -0,0 +1,39 @@ +import bigints, math, sequtils, times + +iterator nodups_hamming(): BigInt = + var + m = newSeq[BigInt](1) # give it two values so doubling size works + h = newSeq[BigInt](1) # reasonably size + x5 = initBigInt 5 + mrg = initBigInt 3 + x53 = initBigInt 9 # already advanced one step + x532 = initBigInt 2 + ih, jm, i, j = 0 + + yield initBigInt 1 # trivial case of 1 + while true: + let cph = h.len # move in-place to avoid allocation + if i >= cph div 2: # move in-place to avoid allocation + var s = i; var d = 0 + while s < ih: shallowCopy(h[d], h[s]); s += 1; d += 1 + ih -= i; i = 0 + if i >= cph div 2: moveMem(h[0].unsafeAddr, + h[i].unsafeAddr, + (ih - i) * h[i].sizeof); ih -= i; i = 0 + if ih >= cph: h.setLen(2 * cph) + if x532 < mrg: h[ih] = x532; x532 = h[i] * 2; i += 1 + else: + h[ih] = mrg + let cpm = m.len + if j >= cpm div 2: # move in-place to avoid allocation + var s = j; var d = 0 + while s < jm: shallowCopy(m[d], m[s]); s += 1; d += 1 + jm -= j; j = 0 + if jm >= cpm: m.setLen(2 * cpm) + if x53 < x5: mrg = x53; x53 = m[j] * 3; j += 1 + else: mrg = x5; x5 = x5 * 5 + m[jm] = mrg + jm += 1 + ih += 1 + + yield h[ih - 1] diff --git a/Task/Hamming-numbers/Nim/hamming-numbers-5.nim b/Task/Hamming-numbers/Nim/hamming-numbers-5.nim new file mode 100644 index 0000000000..036e59388a --- /dev/null +++ b/Task/Hamming-numbers/Nim/hamming-numbers-5.nim @@ -0,0 +1,94 @@ +import bigints, math, sequtils, times + +proc convertTrival2BigInt(tpl: (uint32, uint32, uint32)): BigInt = + result = initBigInt 1 + let (x, y, z) = tpl + for _ in 1 .. x: result *= 2 + for _ in 1 .. y: result *= 3 + for _ in 1 .. z: result *= 5 + +iterator log_nodups_hamming(): (uint32, uint32, uint32) = + let lb3 = 3.0f64.log2; let lb5 = 5.0f64.log2 + type Logrep = (float64, (uint32, uint32, uint32)) + proc `<`(me: Logrep, othr: Logrep): bool = + let (lme, _) = me; let (lothr, _) = othr + lme < lothr + proc mul2(me: Logrep): Logrep = + let (lr, tpl) = me; let (x2, x3, x5) = tpl + (lr + 1.0f64, (x2 + 1, x3, x5)) + proc mul3(me: Logrep): Logrep = + let (lr, tpl) = me; let (x2, x3, x5) = tpl + (lr + lb3, (x2, x3 + 1, x5)) + proc mul5(me: Logrep): Logrep = + let (lr, tpl) = me; let (x2, x3, x5) = tpl + (lr + lb5, (x2, x3, x5 + 1)) + + let one: Logrep = (0.0f64, (0u32, 0u32, 0u32)) + var + m = newSeq[Logrep](1) # give it two values so doubling size works + h = newSeq[Logrep](1) # reasonably size + x5 = one.mul5 # initBigInt 5 + mrg = one.mul3 # initBigInt 3 + x53 = one.mul3().mul3 # initBigInt 9 # already advanced one step + x532 = one.mul2 # initBigInt 2 + ih, jm, i, j = 0 + + yield (0u32, 0u32, 0u32) + while true: + let cph = h.len # move in-place to avoid allocation + if i >= cph div 2: # move in-place to avoid allocation + var s = i; var d = 0 + while s < ih: shallowCopy(h[d], h[s]); s += 1; d += 1 + ih -= i; i = 0 + if ih >= cph: h.setLen(2 * cph) + if x532 < mrg: h[ih] = x532; x532 = h[i].mul2; i += 1 + else: + h[ih] = mrg + let cpm = m.len + if j >= cpm div 2: # move in-place to avoid allocation + var s = j; var d = 0 + while s < jm: shallowCopy(m[d], m[s]); s += 1; d += 1 + jm -= j; j = 0 + if jm >= cpm: m.setLen(2 * cpm) + if x53 < x5: mrg = x53; x53 = m[j].mul3; j += 1 + else: mrg = x5; x5 = x5.mul5 + m[jm] = mrg + jm += 1 + ih += 1 + + let (_, rslt) = h[ih - 1] + yield rslt + +var cnt = 1 +for h in log_nodups_hamming(): + if cnt > 20: break + write stdout, h.convertTrival2BigInt, " "; cnt += 1 +echo "" +cnt = 1 +for h in log_nodups_hamming(): + if cnt < 1691: cnt += 1; continue + else: echo h.convertTrival2BigInt; break + +let strt = epochTime() +var rslt: (uint32, uint32, uint32) +cnt = 1 +for h in log_nodups_hamming(): + if cnt < 1000000: cnt += 1; continue + else: rslt = h; break # """ +let stop = epochTime() + +let (x2, x3, x5) = rslt +writeLine stdout, "2^", x2, " + 3^", x3, " + 5^", x5 +let lgrslt = (x2.float64 + x3.float64 * 3.0f64.log2 + + x5.float64 * 5.0f64.log2) * 2.0f64.log10 +let (whl, frac) = lgrslt.splitDecimal +echo "Approximately: ", 10.0f64.pow(frac), "E+", whl.uint64 +let brslt = rslt.convertTrival2BigInt() +let s = brslt.to_string +let ls = s.len +echo "Number of digits: ", ls +if ls <= 2000: + for i in countup(0, ls - 1, 100): + if i + 100 < ls: echo s[i .. i + 99] + else: echo s[i .. ls - 1] +echo "This last took ", (stop - strt)*1000, " milliseconds." diff --git a/Task/Hamming-numbers/Nim/hamming-numbers-6.nim b/Task/Hamming-numbers/Nim/hamming-numbers-6.nim new file mode 100644 index 0000000000..9d26b25af2 --- /dev/null +++ b/Task/Hamming-numbers/Nim/hamming-numbers-6.nim @@ -0,0 +1,72 @@ +import bigints, math, sequtils, algorithm, times + +proc convertTrival2BigInt(tpl: (uint32, uint32, uint32)): BigInt = + result = initBigInt 1 + let (x, y, z) = tpl + for _ in 1 .. x: result *= 2 + for _ in 1 .. y: result *= 3 + for _ in 1 .. z: result *= 5 + +proc nth_hamming(n: uint64): (uint32, uint32, uint32) = + doAssert n > 0u64 + if n < 2: return (0u32, 0u32, 0u32) # trivial case for 1 + + type Logrep = (float64, (uint32, uint32, uint32)) + + let + lb3 = 3.0f64.log2 + lb5 = 5.0f64.log2 + fctr = 6.0f64 * lb3 * lb5 + crctn = 30.0f64.sqrt().log2 # log base 2 of sqrt 30 + lgest = (fctr * n.float64).pow(1.0f64/3.0f64) - crctn # from WP formula + frctn = if n < 1000000000: 0.509f64 else: 0.105f64 + lghi = (fctr * (n.float64 + frctn * lgest)).pow(1.0f64/3.0f64) - crctn + lglo = 2.0f64 * lgest - lghi # and a lower limit of the upper "band" + var count = 0u64 # need to use extended precision, might go over + var bnd = newSeq[Logrep](1) # give itone value so doubling size works + let klmt = uint32(lghi / lb5) + 1 + for k in 0 .. < klmt: # i, j, k values can be just u32 values + let p = k.float64 * lb5 + let jlmt = uint32((lghi - p) / lb3) + 1 + for j in 0 .. < jlmt: + let q = p + j.float64 * lb3 + let ir = lghi - q + let lg = q + ir.floor # current log value (estimated) + count += ir.uint64 + 1; + if lg >= lglo: + bnd.add((lg, (ir.uint32, j, k))) + if n > count: raise newException(Exception, "nth_hamming: band high estimate is too low!") + let ndx = (count - n).int + if ndx >= bnd.len: raise newException(Exception, "nth_hamming: band low estimate is too high!") + bnd.sort((proc (a, b: Logrep): int = # sort decreasing order + let (la, _) = a; let (lb, _) = b + la.cmp lb), SortOrder.Descending) + + let (_, rslt) = bnd[ndx] + rslt + +for _ in 1 .. 20: + write stdout, nth_hamming(i.uint64).convertTrival2BigInt, " " +echo "" +echo nth_hamming(1691).convertTrival2BigInt + +let strt = epochTime() +let rslt = nth_hamming(1_000_000u64) +let stop = epochTime() + +let (x2, x3, x5) = rslt +writeLine stdout, "2^", x2, " + 3^", x3, " + 5^", x5 +let lgrslt = (x2.float64 + x3.float64 * 3.0f64.log2 + + x5.float64 * 5.0f64.log2) * 2.0f64.log10 +let (whl, frac) = lgrslt.splitDecimal +echo "Approximately: ", 10.0f64.pow(frac), "E+", whl.uint64 +let brslt = rslt.convertTrival2BigInt() +let s = brslt.to_string +let ls = s.len +echo "Number of digits: ", ls +if ls <= 2000: + for i in countup(0, ls - 1, 100): + if i + 100 < ls: echo s[i .. i + 99] + else: echo s[i .. ls - 1] + +echo "This last took ", (stop - strt)*1000, " milliseconds." diff --git a/Task/Hamming-numbers/Ring/hamming-numbers.ring b/Task/Hamming-numbers/Ring/hamming-numbers.ring new file mode 100644 index 0000000000..4729e09580 --- /dev/null +++ b/Task/Hamming-numbers/Ring/hamming-numbers.ring @@ -0,0 +1,20 @@ +see "h(1) = 1" + nl +for nr = 1 to 19 + see "h(" + (nr+1) + ") = " + hamming(nr) + nl +next +see "h(1691) = " + hamming(1690) + nl +see nl + +func hamming limit + h = list(1690) + h[1] =1 + x2 = 2 x3 = 3 x5 =5 + i = 0 j = 0 k =0 + for n =1 to limit + h[n] = min(x2, min(x3, x5)) + if x2 = h[n] i = i +1 x2 =2 *h[i] ok + if x3 = h[n] j = j +1 x3 =3 *h[j] ok + if x5 = h[n] k = k +1 x5 =5 *h[k] ok + next + hamming = h[limit] + return hamming diff --git a/Task/Hamming-numbers/Sidef/hamming-numbers.sidef b/Task/Hamming-numbers/Sidef/hamming-numbers.sidef new file mode 100644 index 0000000000..2ee979457c --- /dev/null +++ b/Task/Hamming-numbers/Sidef/hamming-numbers.sidef @@ -0,0 +1,21 @@ +func ham_gen { + var s = [[1], [1], [1]]; + var m = [2, 3, 5]; + + func { + var n = [s[0][0], s[1][0], s[2][0]].min; + for i in (0..2) { + s[i].shift if (s[i][0] == n); + s[i].append(n * m[i]); + } + return n + } +} + +var h = ham_gen(); + +var i = 20; +say i.of { h() }.join(' '); + +range(i+1, 1691-1).each { h() } +say h(); diff --git a/Task/Hamming-numbers/jq/hamming-numbers-1.jq b/Task/Hamming-numbers/jq/hamming-numbers-1.jq new file mode 100644 index 0000000000..28b0f773ea --- /dev/null +++ b/Task/Hamming-numbers/jq/hamming-numbers-1.jq @@ -0,0 +1,46 @@ +# Return the index in the input array of the min_by(f) value +def index_min_by(f): + . as $in + | if length == 0 then null + else .[0] as $first + | reduce range(0; length) as $i + ([0, $first, ($first|f)]; # state: [ix; min; f|min] + ($in[$i]|f) as $v + | if $v < .[2] then [ $i, $in[$i], $v ] else . end) + | .[0] + end; + +# Emit n Hamming numbers if n>0; the nth if n<0 +def hamming(n): + + # input: [twos, threes, fives] of which at least one is assumed to be non-empty + # output: the index of the array holding the min of the firsts + def next: map( .[0] ) | index_min_by(.); + + # input: [value, [twos, threes, fives] ....] + # ix is the index in [twos, threes, fives] of the array to be popped + # output: [popped, updated_arrays ...] + def pop(ix): + .[1] as $triple + | setpath([0]; $triple[ix][0]) + | setpath([1,ix]; $triple[ix][1:]); + + # input: [x, [twos, threes, fives], count] + # push value*2 to twos, value*3 to threes, value*5 to fives and increment count + def push(v): + [.[0], [.[1][0] + [2*v], .[1][1] + [3*v], .[1][2] + [5*v]], .[2] + 1]; + + # _hamming is the workhorse + # input: [previous, [twos, threes, fives], count] + def _hamming: + .[0] as $previous + | if (n > 0 and .[2] == n) or (n<0 and .[2] == -n) then $previous + else (.[1]|next) as $ix # $ix cannot be null + | pop($ix) + | .[0] as $next + | (if $next == $previous then empty elif n>=0 then $previous else empty end), + (if $next == $previous then . else push($next) end | _hamming) + end; + [1, [[2],[3],[5]], 1] | _hamming; + +. as $n | hamming($n) diff --git a/Task/Hamming-numbers/jq/hamming-numbers-2.jq b/Task/Hamming-numbers/jq/hamming-numbers-2.jq new file mode 100644 index 0000000000..8d09831b49 --- /dev/null +++ b/Task/Hamming-numbers/jq/hamming-numbers-2.jq @@ -0,0 +1,11 @@ +# First twenty: +hamming(20) +# See elsewhere for output + +# 1691st Hamming number: +hamming(-1691) +# => 2125764000 + +# Millionth: +hamming(-1000000) +# => 1.926511252902403e+44 diff --git a/Task/Hamming-numbers/jq/hamming-numbers-3.jq b/Task/Hamming-numbers/jq/hamming-numbers-3.jq new file mode 100644 index 0000000000..c4bbe49a8b --- /dev/null +++ b/Task/Hamming-numbers/jq/hamming-numbers-3.jq @@ -0,0 +1,61 @@ +# The log (base e) of a Hamming triple: +def ln_hamming: + if length != 3 then error("ln_hamming: \(.)") else . end + | (.[0] * (2|log)) + (.[1] * (3|log)) + (.[2] * (5|log)); + +# The numeric value of a Hamming triple: +def hamming_tof: ln_hamming | exp; + +def hamming_toi: + def pow(n): . as $in | reduce range(0;n) as $i (1; . * $in); + . as $in | (2|pow($in[0])) * (3|pow($in[1])) * (5|pow($in[2])); + +# Return the index in the input array of the min_by(f) value +def index_min_by(f): + . as $in + | if length == 0 then null + else .[0] as $first + | reduce range(0; length) as $i + ([0, $first, ($first|f)]; # state: [ix; min; f|min] + ($in[$i]|f) as $v + | if $v < .[2] then [ $i, $in[$i], $v ] else . end) + | .[0] + end; + +# Emit n Hamming numbers (as triples) if n>0; the nth if n<0; otherwise indefinitely. +def hamming(n): + + # n must be 2, 3 or 5 + def hamming_times(n): n as $n + | if $n==2 then .[0] += 1 elif $n==3 then .[1] += 1 else .[2] += 1 end; + + # input: [twos, threes, fives] of which at least one is assumed to be non-empty + # output: the index of the array holding the min of the firsts + def next: map( .[0] ) | index_min_by( ln_hamming ); + + # input: [value, [twos, threes, fives] ....] + # ix is the index in [twos, threes, fives] of the array to be popped + # output: [popped, updated_arrays ...] + def pop(ix): + .[1] as $triple + | setpath([0]; $triple[ix][0]) + | setpath([1,ix]; $triple[ix][1:]); + + # input: [x, [twos, threes, fives], count] + # push value*2 to twos, value*3 to threes, value*5 to fives and increment count + def push(v): + [.[0], [.[1][0] + [v|hamming_times(2)], .[1][1] + [v|hamming_times(3)], + .[1][2] + [v|hamming_times(5)]], .[2] + 1]; + + # _hamming is the workhorse + # input: [previous, [twos, threes, fives], count] + def _hamming: + .[0] as $previous + | if (n > 0 and .[2] == n) or (n<0 and .[2] == -n) then $previous + else (.[1]|next) as $ix # $ix cannot be null + | pop($ix) + | .[0] as $next + | (if $next == $previous then empty elif n>=0 then $previous else empty end), + (if $next == $previous then . else push($next) end | _hamming) + end; + [[0,0,0], [ [[1,0,0]] ,[[0,1,0]], [[0,0,1]] ], 1] | _hamming; diff --git a/Task/Hamming-numbers/jq/hamming-numbers-4.jq b/Task/Hamming-numbers/jq/hamming-numbers-4.jq new file mode 100644 index 0000000000..7a54389f53 --- /dev/null +++ b/Task/Hamming-numbers/jq/hamming-numbers-4.jq @@ -0,0 +1,11 @@ +# The first twenty Hamming numbers as integers: +hamming(-20) | hamming_toi +# => (see elsewhere) + +# 1691st as a Hamming triple: +hamming(-1691) +# => [5,12,3] + +# The millionth: +hamming(-1000000) +# => [55,47,64] diff --git a/Task/Handle-a-signal/Nim/handle-a-signal-1.nim b/Task/Handle-a-signal/Nim/handle-a-signal-1.nim new file mode 100644 index 0000000000..1c46125b56 --- /dev/null +++ b/Task/Handle-a-signal/Nim/handle-a-signal-1.nim @@ -0,0 +1,13 @@ +import times, os, strutils + +let t = epochTime() + +proc handler() {.noconv.} = + echo "Program has run for ", formatFloat(epochTime() - t, precision = 0), " seconds." + quit 0 + +setControlCHook(handler) + +for n in 1 .. 0 + digit = n Mod 10 + sum += digit * digit + n \= 10 + Wend + If sum = 1 Then Return True + ub = UBound(prevSums) + If ub > -1 Then + For i As Integer = 0 To ub + If sum = prevSums(i) Then Return False + Next + End If + ub += 1 + Redim Preserve prevSums(0 To ub) + prevSums(ub) = sum + n = sum + sum = 0 + Loop +End Function + +Dim As Integer n = 1, count = 0 + +Print "The first 8 happy numbers are : " +Print +While count < 8 + If isHappy(n) Then + count += 1 + Print count;" =>"; n + End If + n += 1 +Wend +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Happy-numbers/Harbour/happy-numbers.harbour b/Task/Happy-numbers/Harbour/happy-numbers.harbour new file mode 100644 index 0000000000..37ce119d2e --- /dev/null +++ b/Task/Happy-numbers/Harbour/happy-numbers.harbour @@ -0,0 +1,33 @@ +PROCEDURE Main() + LOCAL i := 8, nH := 0 + + ? hb_StrFormat( "The first %d happy numbers are:", i ) + ? + + WHILE i > 0 + IF IsHappy( ++nH ) + ?? hb_NtoS( nH ) + " " + --i + ENDIF + END + + RETURN + +STATIC FUNCTION IsHappy( nNumber ) + STATIC aUnhappy := {} + LOCAL nDigit, nSum := 0, cNumber := hb_NtoS( nNumber ) + + FOR EACH nDigit IN cNumber + nSum += Val( nDigit ) ^ 2 + NEXT + + IF nSum == 1 + aUnhappy := {} + RETURN .T. + ELSEIF AScan( aUnhappy, nSum ) > 0 + RETURN .F. + ENDIF + + AAdd( aUnhappy, nSum ) + + RETURN IsHappy( nSum ) diff --git a/Task/Happy-numbers/Lasso/happy-numbers-1.lasso b/Task/Happy-numbers/Lasso/happy-numbers-1.lasso new file mode 100644 index 0000000000..7f39445a2d --- /dev/null +++ b/Task/Happy-numbers/Lasso/happy-numbers-1.lasso @@ -0,0 +1,15 @@ +#!/usr/bin/lasso9 + +define isHappy(n::integer) => { + local(past = set) + while(#n != 1) => { + #n = with i in string(#n)->values sum math_pow(integer(#i), 2) + #past->contains(#n) ? return false | #past->insert(#n) + } + return true +} + +with x in generateSeries(1, 500) + where isHappy(#x) + take 8 +select #x diff --git a/Task/Happy-numbers/Lasso/happy-numbers-2.lasso b/Task/Happy-numbers/Lasso/happy-numbers-2.lasso new file mode 100644 index 0000000000..cca0d5c33e --- /dev/null +++ b/Task/Happy-numbers/Lasso/happy-numbers-2.lasso @@ -0,0 +1 @@ +1, 7, 10, 13, 19, 23, 28, 31 diff --git a/Task/Happy-numbers/Nim/happy-numbers.nim b/Task/Happy-numbers/Nim/happy-numbers.nim new file mode 100644 index 0000000000..536185e9c7 --- /dev/null +++ b/Task/Happy-numbers/Nim/happy-numbers.nim @@ -0,0 +1,20 @@ +import intsets + +proc happy(n: int): bool = + var + n = n + past = initIntSet() + while n != 1: + let s = $n + n = 0 + for c in s: + let i = ord(c) - ord('0') + n += i * i + if n in past: + return false + past.incl(n) + return true + +for x in 0..31: + if happy(x): + echo x diff --git a/Task/Happy-numbers/Oforth/happy-numbers.oforth b/Task/Happy-numbers/Oforth/happy-numbers.oforth new file mode 100644 index 0000000000..eacdd5a94c --- /dev/null +++ b/Task/Happy-numbers/Oforth/happy-numbers.oforth @@ -0,0 +1,16 @@ +: isHappy(n) +| cycle | + ListBuffer new ->cycle + + while(n 1 <>) [ + cycle include(n) ifTrue: [ false return ] + cycle add(n) + 0 n asString apply(#[ asDigit sq + ]) ->n + ] + true ; + +: happyNum(N) +| numbers | + ListBuffer new ->numbers + 1 while(numbers size N <>) [ dup isHappy ifTrue: [ dup numbers add ] 1+ ] + numbers println ; diff --git a/Task/Happy-numbers/Phix/happy-numbers.phix b/Task/Happy-numbers/Phix/happy-numbers.phix new file mode 100644 index 0000000000..5e8205bc96 --- /dev/null +++ b/Task/Happy-numbers/Phix/happy-numbers.phix @@ -0,0 +1,27 @@ +function is_happy(integer n) +sequence seen = {} +integer k + while n>1 do + seen &= n + k = 0 + while n>0 do + k += power(remainder(n,10),2) + n = floor(n/10) + end while + n = k + if find(n,seen) then + return 0 + end if + end while + return 1 +end function + +integer n = 1 +sequence s = {} +while length(s)<8 do + if is_happy(n) then + s &= n + end if + n += 1 +end while +?s diff --git a/Task/Happy-numbers/Potion/happy-numbers.potion b/Task/Happy-numbers/Potion/happy-numbers.potion new file mode 100644 index 0000000000..4fe65c2aad --- /dev/null +++ b/Task/Happy-numbers/Potion/happy-numbers.potion @@ -0,0 +1,20 @@ +sqr = (n): n * n. + +isHappy = (n) : + loop : + if (n == 1): return true. + if (n == 4): return false. + sum = 0 + n = n string + n length times (i): sum = sum + sqr(n(i) number integer). + n = sum + . +. + +firstEight = () +i = 0 +while (firstEight length < 8) : + i++ + if (isHappy(i)): firstEight append(i). +. +firstEight string print diff --git a/Task/Happy-numbers/Ring/happy-numbers.ring b/Task/Happy-numbers/Ring/happy-numbers.ring new file mode 100644 index 0000000000..dd06d3b9f0 --- /dev/null +++ b/Task/Happy-numbers/Ring/happy-numbers.ring @@ -0,0 +1,24 @@ +n = 1 +found = 0 + +While found < 8 + If IsHappy(n) + found += 1 + see string(found) + " : " + string(n) + nl + ok + n += 1 +End + +Func IsHappy n + cache = [] + While n != 1 + Add(cache,n) + t = 0 + strn = string(n) + for e in strn + t += pow(number(e),2) + next + n = t + If find(cache,n) Return False ok + End + Return True diff --git a/Task/Happy-numbers/SequenceL/happy-numbers.sequencel b/Task/Happy-numbers/SequenceL/happy-numbers.sequencel new file mode 100644 index 0000000000..009c753736 --- /dev/null +++ b/Task/Happy-numbers/SequenceL/happy-numbers.sequencel @@ -0,0 +1,27 @@ +import ; +import ; + +main(argv(2)) := findHappys(stringToInt(head(argv))); + +findHappys(count) := findHappysHelper(count, 1, []); + +findHappysHelper(count, n, happys(1)) := + happys when size(happys) = count + else + findHappysHelper(count, n + 1, happys ++ [n]) when isHappy(n) + else + findHappysHelper(count, n + 1, happys); + +isHappy(n) := isHappyHelper(n, []); + +isHappyHelper(n, cache(1)) := + let + digits[i] := (n / integerPower(10, i - 1)) mod 10 + foreach i within 1 ... ceiling(log(10, n + 1)); + newN := sum(integerPower(digits, 2)); + in + false when some(n = cache) + else + true when n = 1 + else + isHappyHelper(newN, cache ++ [n]); diff --git a/Task/Happy-numbers/Sidef/happy-numbers.sidef b/Task/Happy-numbers/Sidef/happy-numbers.sidef new file mode 100644 index 0000000000..5022711514 --- /dev/null +++ b/Task/Happy-numbers/Sidef/happy-numbers.sidef @@ -0,0 +1,15 @@ +func happy(n) is cached { + static seen = Hash() + + return true if n.is_one + return false if seen.has_key(n) + + seen{n} = 1 + happy(n.digits »**» 2 -> sum) +} + +var count = 0; +Inf.times { |i| + happy(i) ? say i : next + ++count == 8 && break +} diff --git a/Task/Happy-numbers/Swift/happy-numbers.swift b/Task/Happy-numbers/Swift/happy-numbers.swift new file mode 100644 index 0000000000..c18ace95a8 --- /dev/null +++ b/Task/Happy-numbers/Swift/happy-numbers.swift @@ -0,0 +1,25 @@ +func isHappyNumber(var n:Int) -> Bool { + var cycle = [Int]() + + while n != 1 && !cycle.contains(n) { + cycle.append(n) + var m = 0 + while n > 0 { + let d = n % 10 + m += d * d + n = (n - d) / 10 + } + n = m + } + return n == 1 +} + +var found = 0 +var count = 0 +while found != 8 { + if isHappyNumber(count) { + print(count) + found++ + } + count++ +} diff --git a/Task/Happy-numbers/jq/happy-numbers-1.jq b/Task/Happy-numbers/jq/happy-numbers-1.jq new file mode 100644 index 0000000000..eb1fc35741 --- /dev/null +++ b/Task/Happy-numbers/jq/happy-numbers-1.jq @@ -0,0 +1,15 @@ +def is_happy_number: + def next: tostring | explode | map( (. - 48) | .*.) | add; + def last(g): reduce g as $i (null; $i); + # state: either 1 or [i, o] + # where o is an an object with the previously encountered numbers as keys + def loop: + recurse( if . == 1 then empty # all done + elif .[0] == 1 then 1 # emit 1 + else (.[0]| next) as $n + | if $n == 1 then 1 + elif .[1]|has($n|tostring) then empty + else [$n, (.[1] + {($n|tostring):true}) ] + end + end ); + 1 == last( [.,{}] | loop ); diff --git a/Task/Happy-numbers/jq/happy-numbers-2.jq b/Task/Happy-numbers/jq/happy-numbers-2.jq new file mode 100644 index 0000000000..d502cee592 --- /dev/null +++ b/Task/Happy-numbers/jq/happy-numbers-2.jq @@ -0,0 +1,12 @@ +# Set n to -1 to continue indefinitely: +def happy(n): + def subtask: # state: [i, found] + if .[1] == n then empty + else .[0] as $n + | if ($n | is_happy_number) then $n, ([ $n+1, .[1]+1 ] | subtask) + else (.[0] += 1) | subtask + end + end; + [0,0] | subtask; + +happy($n|tonumber) diff --git a/Task/Happy-numbers/jq/happy-numbers-3.jq b/Task/Happy-numbers/jq/happy-numbers-3.jq new file mode 100644 index 0000000000..73e13441bd --- /dev/null +++ b/Task/Happy-numbers/jq/happy-numbers-3.jq @@ -0,0 +1,9 @@ +$ jq --arg n 8 -n -f happy.jq +1 +7 +10 +13 +19 +23 +28 +31 diff --git a/Task/Harshad-or-Niven-series/EchoLisp/harshad-or-niven-series.echolisp b/Task/Harshad-or-Niven-series/EchoLisp/harshad-or-niven-series.echolisp new file mode 100644 index 0000000000..23e53dbbb2 --- /dev/null +++ b/Task/Harshad-or-Niven-series/EchoLisp/harshad-or-niven-series.echolisp @@ -0,0 +1,14 @@ +(define (harsh? n) + (zero? (modulo n + (apply + (map string->number (string->list (number->string n))))))) + +(harsh? 42) + → #t + +(define H (stream-filter harsh? (in-naturals 1))) + +(take H 20) + → (1 2 3 4 5 6 7 8 9 10 12 18 20 21 24 27 30 36 40 42) + +(for ((n H)) #:break (> n 1000) => n) + → 1002 diff --git a/Task/Harshad-or-Niven-series/FreeBASIC/harshad-or-niven-series.freebasic b/Task/Harshad-or-Niven-series/FreeBASIC/harshad-or-niven-series.freebasic new file mode 100644 index 0000000000..a62c9aa355 --- /dev/null +++ b/Task/Harshad-or-Niven-series/FreeBASIC/harshad-or-niven-series.freebasic @@ -0,0 +1,44 @@ +' FB 1.05.0 Win64 + +Function sumDigits(n As Integer) As Integer + If n < 0 Then Return 0 + Dim sum As Integer + While n > 0 + sum += n Mod 10 + n \= 10 + Wend + Return sum +End Function + +Function isHarshad(n As Integer) As Boolean + Return n Mod sumDigits(n) = 0 +End Function + +Print "The first 20 Harshad or Niven numbers are :" +Dim count As Integer = 0 +Dim i As Integer = 1 + +Do + If isHarshad(i) Then + Print i; " "; + Count += 1 + If count = 20 Then Exit Do + End If + i += 1 +Loop + +Print : Print +Print "The first such number above 1000 is :" +i = 1001 + +Do + If isHarshad(i) Then + Print i; " " + Exit Do + End If + i += 1 +Loop + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Harshad-or-Niven-series/MLite/harshad-or-niven-series.mlite b/Task/Harshad-or-Niven-series/MLite/harshad-or-niven-series.mlite new file mode 100644 index 0000000000..e60a3306a9 --- /dev/null +++ b/Task/Harshad-or-Niven-series/MLite/harshad-or-niven-series.mlite @@ -0,0 +1,27 @@ +fun sumdigits + (0, n) = n + | (m, n) = sumdigits (m div 10, m rem 10) + n + | n = sumdigits (n div 10, n rem 10) + +fun is_harshad n = (n rem (sumdigits n) = 0) + +fun next_harshad_after + (n, ~1) = if is_harshad n then + n + else + next_harshad_after (n + 1, ~1) + | n = next_harshad_after (n + 1, ~1) + +fun harshad + (max, _, count > max, accum) = rev accum + | (max, here, count, accum) = + if is_harshad here then + harshad (max, here + 1, count + 1, here :: accum) + else + harshad (max, here + 1, count, accum) + | max = harshad (max, 1, 1, []) + +; + +print "first twenty harshad numbers = "; println ` harshad 20; +print "first harshad number after 1000 = "; println ` next_harshad_after 1000; diff --git a/Task/Harshad-or-Niven-series/Nim/harshad-or-niven-series.nim b/Task/Harshad-or-Niven-series/Nim/harshad-or-niven-series.nim new file mode 100644 index 0000000000..43acce0d87 --- /dev/null +++ b/Task/Harshad-or-Niven-series/Nim/harshad-or-niven-series.nim @@ -0,0 +1,27 @@ +import strutils + +proc slice[T](iter: iterator(): T {.closure.}, sl): seq[T] = + var result {.gensym.}: seq[int64] = @[] + var i = 0 + for n in iter(): + if i > sl.b: + break + if i >= sl.a: + result.add(n) + inc i + result + +iterator harshad(): int64 {.closure.} = + for n in 1 .. < int64.high: + var sum = 0 + for ch in string($n): + sum += parseInt("" & ch) + if n mod sum == 0: + yield n + +echo harshad.slice 0 .. <20 + +for n in harshad(): + if n > 1000: + echo n + break diff --git a/Task/Harshad-or-Niven-series/Oforth/harshad-or-niven-series.oforth b/Task/Harshad-or-Niven-series/Oforth/harshad-or-niven-series.oforth new file mode 100644 index 0000000000..5c7ad2eea2 --- /dev/null +++ b/Task/Harshad-or-Niven-series/Oforth/harshad-or-niven-series.oforth @@ -0,0 +1,4 @@ +: sumDigits(n) 0 while(n) [ n 10 /mod ->n + ] ; +: isHarshad dup sumDigits mod 0 == ; + +1100 seq filter(#isHarshad) dup left(20) println dup filter(#[ 1000 > ]) first println diff --git a/Task/Harshad-or-Niven-series/Ring/harshad-or-niven-series.ring b/Task/Harshad-or-Niven-series/Ring/harshad-or-niven-series.ring new file mode 100644 index 0000000000..dc2a2c456f --- /dev/null +++ b/Task/Harshad-or-Niven-series/Ring/harshad-or-niven-series.ring @@ -0,0 +1,17 @@ +i = 1 +count = 0 +while true + sum = 0 + if niven(i) = 1 + if count < 20 see "" + i + " is a Niven number" + nl count +=1 ok + if i > 1000 see "" + i + " is a Niven number" exit ok ok + i + =1 +end + +func niven nr + nrString = string(nr) + for j = 1 to len(nrString) + sum = sum + number(nrString[j]) + next + niv = ((nr % sum) = 0) + return niv diff --git a/Task/Harshad-or-Niven-series/Sidef/harshad-or-niven-series.sidef b/Task/Harshad-or-Niven-series/Sidef/harshad-or-niven-series.sidef new file mode 100644 index 0000000000..0e33a76a77 --- /dev/null +++ b/Task/Harshad-or-Niven-series/Sidef/harshad-or-niven-series.sidef @@ -0,0 +1,17 @@ +func harshad() { + var n = 0; + { + ++n while !(n %% n.digits.sum); + n; + } +} + +var iter = harshad(); +say 20.of { iter.run }; + +var n; +do { + n = iter.run +} while (n <= 1000); + +say n; diff --git a/Task/Harshad-or-Niven-series/Visual-FoxPro/harshad-or-niven-series.visual b/Task/Harshad-or-Niven-series/Visual-FoxPro/harshad-or-niven-series.visual new file mode 100644 index 0000000000..5fce7085b3 --- /dev/null +++ b/Task/Harshad-or-Niven-series/Visual-FoxPro/harshad-or-niven-series.visual @@ -0,0 +1,29 @@ +LOCAL lnCount As Integer, k As Integer +CLEAR +lnCount = 0 +k = 0 +*!* First 20 numbers +? "First 20 numbers:" +DO WHILE lnCount < 20 + k = k + 1 + IF Harshad(k) + lnCount = lnCount + 1 + ? lnCount, k + ENDIF +ENDDO +*!* First such number > 1000 +k = 1001 +DO WHILE NOT Harshad(k) + k = k + 1 +ENDDO +? "First such number > 1000", k + +FUNCTION Harshad(n As Integer) As Boolean +LOCAL cn As String, d As Integer, i As Integer +cn = TRANSFORM(n) +d = 0 +FOR i = 1 TO LEN(cn) + d = d + VAL(SUBSTR(cn, i, 1)) +ENDFOR +RETURN n % d = 0 +ENDFUNC diff --git a/Task/Harshad-or-Niven-series/jq/harshad-or-niven-series.jq b/Task/Harshad-or-Niven-series/jq/harshad-or-niven-series.jq new file mode 100644 index 0000000000..ef0bd8acb0 --- /dev/null +++ b/Task/Harshad-or-Niven-series/jq/harshad-or-niven-series.jq @@ -0,0 +1,27 @@ +def is_harshad: + def digits: tostring | [explode[] | ([.]| implode) | tonumber]; + if . >= 1 then (. % (digits|add)) == 0 + else false + end ; + +# produce a stream of n Harshad numbers +def harshads(n): + # [candidate, count] + def _harshads: + if .[0]|is_harshad then .[0], ([.[0]+1, .[1]-1]| _harshads) + elif .[1] > 0 then [.[0]+1, .[1]] | _harshads + else empty + end; + [1, n] | _harshads ; + +# First Harshad greater than n where n >= 0 +def harshad_greater_than(n): + # input: next candidate + def _harshad: + if is_harshad then . + else .+1 | _harshad + end; + (n+1) | _harshad ; + +# Task: +[ harshads(20), "...", harshad_greater_than(1000)] diff --git a/Task/Hash-from-two-arrays/Ceylon/hash-from-two-arrays.ceylon b/Task/Hash-from-two-arrays/Ceylon/hash-from-two-arrays.ceylon new file mode 100644 index 0000000000..7ae1e27cee --- /dev/null +++ b/Task/Hash-from-two-arrays/Ceylon/hash-from-two-arrays.ceylon @@ -0,0 +1,5 @@ +shared void run() { + value keys = [1, 2, 3]; + value items = ['a', 'b', 'c']; + value hash = map(zipEntries(keys, items)); +} diff --git a/Task/Hash-from-two-arrays/Coco/hash-from-two-arrays.coco b/Task/Hash-from-two-arrays/Coco/hash-from-two-arrays.coco new file mode 100644 index 0000000000..5c90f3a10a --- /dev/null +++ b/Task/Hash-from-two-arrays/Coco/hash-from-two-arrays.coco @@ -0,0 +1,5 @@ +keys = <[apple banana orange grape]> +values = <[red yellow orange purple]> + +object = new + @[keys[i]] = values[i] for i til keys.length diff --git a/Task/Hash-from-two-arrays/EchoLisp/hash-from-two-arrays.echolisp b/Task/Hash-from-two-arrays/EchoLisp/hash-from-two-arrays.echolisp new file mode 100644 index 0000000000..66ac696986 --- /dev/null +++ b/Task/Hash-from-two-arrays/EchoLisp/hash-from-two-arrays.echolisp @@ -0,0 +1,10 @@ +(lib 'hash) + +(define H (make-hash)) +(define keys '(elvis simon antoinette)) +(define kvalues '("the king" "gallubert" "de gabolde d'Audan")) + +(list->hash (map cons keys kvalues) H) + → #hash:3 +(hash-ref H 'elvis) + → "the king" diff --git a/Task/Hash-from-two-arrays/Harbour/hash-from-two-arrays.harbour b/Task/Hash-from-two-arrays/Harbour/hash-from-two-arrays.harbour new file mode 100644 index 0000000000..15712b8209 --- /dev/null +++ b/Task/Hash-from-two-arrays/Harbour/hash-from-two-arrays.harbour @@ -0,0 +1,7 @@ +LOCAL arr1 := { 6, "eight" }, arr2 := { 16, 8 } +LOCAL hash := { => } +LOCAL i, j + +FOR EACH i, j IN arr1, arr2 + hash[ i ] := j +NEXT diff --git a/Task/Hash-from-two-arrays/LFE/hash-from-two-arrays.lfe b/Task/Hash-from-two-arrays/LFE/hash-from-two-arrays.lfe new file mode 100644 index 0000000000..dbd89bafab --- /dev/null +++ b/Task/Hash-from-two-arrays/LFE/hash-from-two-arrays.lfe @@ -0,0 +1,6 @@ +(let* ((keys (list 'foo 'bar 'baz)) + (vals (list '"foo data" '"bar data" '"baz data")) + (tuples (: lists zipwith + (lambda (a b) (tuple a b)) keys vals)) + (my-dict (: dict from_list tuples))) + (: io format '"fetched data: ~p~n" (list (: dict fetch 'baz my-dict)))) diff --git a/Task/Hash-from-two-arrays/Lasso/hash-from-two-arrays.lasso b/Task/Hash-from-two-arrays/Lasso/hash-from-two-arrays.lasso new file mode 100644 index 0000000000..481a085e1c --- /dev/null +++ b/Task/Hash-from-two-arrays/Lasso/hash-from-two-arrays.lasso @@ -0,0 +1,11 @@ +local( + array1 = array('a', 'b', 'c'), + array2 = array(1, 2, 3), + hash = map +) + +loop(#array1 -> size) => { + #hash -> insert(#array1 -> get(loop_count) = #array2 -> get(loop_count)) +} + +#hash diff --git a/Task/Hash-from-two-arrays/Lingo/hash-from-two-arrays.lingo b/Task/Hash-from-two-arrays/Lingo/hash-from-two-arrays.lingo new file mode 100644 index 0000000000..1837137fb5 --- /dev/null +++ b/Task/Hash-from-two-arrays/Lingo/hash-from-two-arrays.lingo @@ -0,0 +1,11 @@ +keys = ["a","b","c"] +values = [1,2,3] + +props = [:] +cnt = keys.count +repeat with i = 1 to cnt + props[keys[i]] = values[i] +end repeat + +put props +-- ["a": 1, "b": 2, "c": 3] diff --git a/Task/Hash-from-two-arrays/LiveCode/hash-from-two-arrays.livecode b/Task/Hash-from-two-arrays/LiveCode/hash-from-two-arrays.livecode new file mode 100644 index 0000000000..22e03cfddb --- /dev/null +++ b/Task/Hash-from-two-arrays/LiveCode/hash-from-two-arrays.livecode @@ -0,0 +1,12 @@ +put "a,b,c" into list1 +put 10,20,30 into list2 +split list1 using comma +split list2 using comma +repeat with i=1 to the number of elements of list1 + put list2[i] into list3[list1[i]] +end repeat +combine list3 using comma and colon +put list3 + +-- ouput +-- a:10,b:20,c:30 diff --git a/Task/Hash-from-two-arrays/Nim/hash-from-two-arrays.nim b/Task/Hash-from-two-arrays/Nim/hash-from-two-arrays.nim new file mode 100644 index 0000000000..275449588a --- /dev/null +++ b/Task/Hash-from-two-arrays/Nim/hash-from-two-arrays.nim @@ -0,0 +1,6 @@ +import tables, sequtils + +let keys = @['a','b','c'] +let values = @[1, 2, 3] + +let table = toTable zip(keys, values) diff --git a/Task/Hash-from-two-arrays/Sidef/hash-from-two-arrays.sidef b/Task/Hash-from-two-arrays/Sidef/hash-from-two-arrays.sidef new file mode 100644 index 0000000000..aae17d08a6 --- /dev/null +++ b/Task/Hash-from-two-arrays/Sidef/hash-from-two-arrays.sidef @@ -0,0 +1,6 @@ +var keys = %w(a b c) +var vals = [1, 2, 3] + +var hash = Hash() +hash{keys...} = vals... +say hash diff --git a/Task/Hash-from-two-arrays/Sparkling/hash-from-two-arrays.sparkling b/Task/Hash-from-two-arrays/Sparkling/hash-from-two-arrays.sparkling new file mode 100644 index 0000000000..d99b159227 --- /dev/null +++ b/Task/Hash-from-two-arrays/Sparkling/hash-from-two-arrays.sparkling @@ -0,0 +1,6 @@ +let keys = { "foo", "bar", "baz" }; +let vals = { 13, 37, 42 }; +var hash = {}; +for var i = 0; i < sizeof keys; i++ { + hash[keys[i]] = vals[i]; +} diff --git a/Task/Hash-from-two-arrays/Swift/hash-from-two-arrays.swift b/Task/Hash-from-two-arrays/Swift/hash-from-two-arrays.swift new file mode 100644 index 0000000000..7c2d9c7107 --- /dev/null +++ b/Task/Hash-from-two-arrays/Swift/hash-from-two-arrays.swift @@ -0,0 +1,6 @@ +let keys = ["a","b","c"] +let vals = [1,2,3] +var hash = [String: Int]() +for (key, val) in zip(keys, vals) { + hash[key] = val +} diff --git a/Task/Hash-from-two-arrays/Wortel/hash-from-two-arrays-1.wortel b/Task/Hash-from-two-arrays/Wortel/hash-from-two-arrays-1.wortel new file mode 100644 index 0000000000..e92f2004f5 --- /dev/null +++ b/Task/Hash-from-two-arrays/Wortel/hash-from-two-arrays-1.wortel @@ -0,0 +1 @@ +@hash ["a" "b" "c"] [1 2 3] ; returns {a 1 b 2 c 3} diff --git a/Task/Hash-from-two-arrays/Wortel/hash-from-two-arrays-2.wortel b/Task/Hash-from-two-arrays/Wortel/hash-from-two-arrays-2.wortel new file mode 100644 index 0000000000..31d00ccc6a --- /dev/null +++ b/Task/Hash-from-two-arrays/Wortel/hash-from-two-arrays-2.wortel @@ -0,0 +1 @@ +^(@obj @zip) diff --git a/Task/Hash-from-two-arrays/Wortel/hash-from-two-arrays-3.wortel b/Task/Hash-from-two-arrays/Wortel/hash-from-two-arrays-3.wortel new file mode 100644 index 0000000000..5dcdda34a3 --- /dev/null +++ b/Task/Hash-from-two-arrays/Wortel/hash-from-two-arrays-3.wortel @@ -0,0 +1,4 @@ +@let { + hash ^(@obj @zip) + !!hash ["a" "b" "c"] [1 2 3] +} diff --git a/Task/Hash-from-two-arrays/jq/hash-from-two-arrays-1.jq b/Task/Hash-from-two-arrays/jq/hash-from-two-arrays-1.jq new file mode 100644 index 0000000000..1ae9260903 --- /dev/null +++ b/Task/Hash-from-two-arrays/jq/hash-from-two-arrays-1.jq @@ -0,0 +1,12 @@ +# hash(keys) creates a JSON object with the given keys as keys +# and values taken from the input array in turn. +# "keys" must be an array of strings. +# The input array may be of any length and have values of any type, +# but only the first (keys|length) values will be used; +# the input will in effect be padded with nulls if required. +def hash(keys): + . as $values + | reduce range(0; keys|length) as $i + ( {}; . + { (keys[$i]) : $values[$i] }); + +[1,2,3] | hash( ["a","b","c"] ) diff --git a/Task/Hash-from-two-arrays/jq/hash-from-two-arrays-2.jq b/Task/Hash-from-two-arrays/jq/hash-from-two-arrays-2.jq new file mode 100644 index 0000000000..091c96279d --- /dev/null +++ b/Task/Hash-from-two-arrays/jq/hash-from-two-arrays-2.jq @@ -0,0 +1,6 @@ +jq -n -f Hash_from_two_arrays.jq +{ + "a": 1, + "b": 2, + "c": 3 +} diff --git a/Task/Hash-from-two-arrays/jq/hash-from-two-arrays-3.jq b/Task/Hash-from-two-arrays/jq/hash-from-two-arrays-3.jq new file mode 100644 index 0000000000..f13f58bcf1 --- /dev/null +++ b/Task/Hash-from-two-arrays/jq/hash-from-two-arrays-3.jq @@ -0,0 +1,5 @@ +{ + "1": 10, + "2": 20, + "3": 30 +} diff --git a/Task/Hash-join/ECL/hash-join.ecl b/Task/Hash-join/ECL/hash-join.ecl new file mode 100644 index 0000000000..8e04817772 --- /dev/null +++ b/Task/Hash-join/ECL/hash-join.ecl @@ -0,0 +1,33 @@ +LeftRec := RECORD + UNSIGNED1 Age; + STRING6 Name; +END; + +LeftFile := DATASET([{27,'Jonah'},{18,'Alan'},{28,'Glory'},{18,'Popeye'},{28,'Alan'}],LeftRec); + +RightRec := RECORD + STRING6 Name; + STRING7 Nemesis; +END; + +RightFile := DATASET([{'Jonah','Whales'},{'Jonah','Spiders'},{'Alan','Ghosts'},{'Alan','Zombies'},{'Glory','Buffy'}], + RightRec); + +HashJoin := JOIN(LeftFile,RightFile,Left.Name = RIGHT.Name,HASH); + +HashJoin; + + +//The HASH JOIN is built-in to the ECL JOIN by using the HASH JOIN Flag + +/* +OUTPUT: +Age Name Nemesis +18 Alan Ghosts +18 Alan Zombies +28 Alan Ghosts +28 Alan Zombies +28 Glory Buffy +27 Jonah Whales +27 Jonah Spiders +*/ diff --git a/Task/Hash-join/EchoLisp/hash-join-1.echolisp b/Task/Hash-join/EchoLisp/hash-join-1.echolisp new file mode 100644 index 0000000000..0bef0c02bf --- /dev/null +++ b/Task/Hash-join/EchoLisp/hash-join-1.echolisp @@ -0,0 +1,27 @@ +(define ages '((27 "Jonah") (18 "Alan") (28 "Glory") (18 "Popeye") (28 "Alan"))) +(define nemesis '(("Jonah" "Whales") ("Jonah" "Spiders") ("Alan" "Ghosts") ("Alan" "Zombies") ("Glory" "Buffy"))) + +;; table: table name +;; source : input list +;; key-proc : procedure returning the join value ('name' in this task) + +(define (table-hash table source key-proc ) +(local-make-store table) +(for ((r source)) + (local-put-value + (key-proc r) + (append (list r) (local-get-value (key-proc r) table)) table))) + +;; build the two tables +(define-syntax-rule (second record) (cadr record)) +(define (key-name-age record) (second record)) +(table-hash 'AGES ages key-name-age) + +(define (key-nemesis-name record) (first record)) +(table-hash 'NEMESIS nemesis key-nemesis-name) + +;; join +(for* ((k (local-keys 'AGES)) + (a (local-get-value k 'AGES)) + (n (local-get-value k 'NEMESIS))) + (writeln a n)) diff --git a/Task/Hash-join/EchoLisp/hash-join-2.echolisp b/Task/Hash-join/EchoLisp/hash-join-2.echolisp new file mode 100644 index 0000000000..457efb90ea --- /dev/null +++ b/Task/Hash-join/EchoLisp/hash-join-2.echolisp @@ -0,0 +1,7 @@ +(28 "Alan") ("Alan" "Zombies") +(28 "Alan") ("Alan" "Ghosts") +(18 "Alan") ("Alan" "Zombies") +(18 "Alan") ("Alan" "Ghosts") +(28 "Glory") ("Glory" "Buffy") +(27 "Jonah") ("Jonah" "Spiders") +(27 "Jonah") ("Jonah" "Whales") diff --git a/Task/Hash-join/LFE/hash-join-1.lfe b/Task/Hash-join/LFE/hash-join-1.lfe new file mode 100644 index 0000000000..8f5ef068d7 --- /dev/null +++ b/Task/Hash-join/LFE/hash-join-1.lfe @@ -0,0 +1,23 @@ +(defun hash (column table) + (lists:foldl + (lambda (x acc) + (orddict:append (proplists:get_value column x) x acc)) + '() + table)) + +(defun get-hash (col hash-table) + (proplists:get_value + (proplists:get_value col r) + hashed)) + +(defun merge (row-1 row-2) + (orddict:merge + (lambda (k v1 v2) v2) + (lists:sort row-1) + (lists:sort row-2))) + +(defun hash-join (table-1 col-1 table-2 col-2) + (let ((hashed (hash col-1 table-1))) + (lc ((<- r table-2)) + (lc ((<- s (get-hash col-2 hashed))) + (merge r s))))) diff --git a/Task/Hash-join/LFE/hash-join-2.lfe b/Task/Hash-join/LFE/hash-join-2.lfe new file mode 100644 index 0000000000..77340b1854 --- /dev/null +++ b/Task/Hash-join/LFE/hash-join-2.lfe @@ -0,0 +1,11 @@ +> (set ss '((#(age 27) #(name "Jonah")) + (#(age 18) #(name "Alan")) + (#(age 28) #(name "Glory")) + (#(age 18) #(name "Popeye")) + (#(age 28) #(name "Alan")))) + +> (set rs '((#(nemesis "Whales") #(name "Jonah")) + (#(nemesis "Spiders") #(name "Jonah")) + (#(nemesis "Ghosts") #(name "Alan")) + (#(nemesis "Zombies") #(name "Alan")) + (#(nemesis "Buffy") #(name "Glory")))) diff --git a/Task/Hash-join/LFE/hash-join-3.lfe b/Task/Hash-join/LFE/hash-join-3.lfe new file mode 100644 index 0000000000..2526e805ff --- /dev/null +++ b/Task/Hash-join/LFE/hash-join-3.lfe @@ -0,0 +1,8 @@ +> (hash-join ss 'name rs 'name) +(((#(age 27) #(name "Jonah") #(nemesis "Whales"))) + ((#(age 27) #(name "Jonah") #(nemesis "Spiders"))) + ((#(age 18) #(name "Alan") #(nemesis "Ghosts")) + (#(age 28) #(name "Alan") #(nemesis "Ghosts"))) + ((#(age 18) #(name "Alan") #(nemesis "Zombies")) + (#(age 28) #(name "Alan") #(nemesis "Zombies"))) + ((#(age 28) #(name "Glory") #(nemesis "Buffy")))) diff --git a/Task/Hash-join/Ring/hash-join.ring b/Task/Hash-join/Ring/hash-join.ring new file mode 100644 index 0000000000..2ba7b0e4a6 --- /dev/null +++ b/Task/Hash-join/Ring/hash-join.ring @@ -0,0 +1,42 @@ +Table1 = [[27, "Jonah"], [18, "Alan"], [28, "Glory"], [18, "Popeye"], [28, "Alan"]] +Table2 = [["Jonah", "Whales"], ["Jonah", "Spiders"], ["Alan", "Ghosts"], ["Alan", "Zombies"], ["Glory", "Buffy"]] +hTable = [] +Qtable = [] + +for a in table1 + h = hashing(a[2]) + add(htable,[h , a]) +next + +for b in table2 + h = hashing(b[1]) + for sh in htable + if sh[1] = h + add(qtable, sh[2] + b[2]) + ok + next +next + +print(qtable) + +#===============End of Execution========= + +func print lst +see "--------------------------------------------------- +Age | Name || Name | Nemesis +--------------------------------------------------- +" +for l in lst + see string(l[1]) + char(9) + "| " + l[2] + copy(char(9),2) + "|| " + l[2] + " " + char(9) + "| " + l[3] + nl +next + +func Hashing str +r = 0 +if len(str) > 4 + r = (ascii(str[1]) + ascii(str[len(str)]) + ascii(str[ceil(len(str) * 0.25)]) + ascii(str[ceil(len(str) * 0.75)])) +else + for s in str + r += ascii(s) + next +ok +return r diff --git a/Task/Hash-join/Sidef/hash-join.sidef b/Task/Hash-join/Sidef/hash-join.sidef new file mode 100644 index 0000000000..a6b958aac4 --- /dev/null +++ b/Task/Hash-join/Sidef/hash-join.sidef @@ -0,0 +1,30 @@ +func hashJoin(table1, index1, table2, index2) { + var a = [] + var h = Hash() + + # hash phase + table1.each { |s| + h{s[index1]} := [] << s + } + + # join phase + table2.each { |r| + a += h{r[index2]}.map{[_,r]} + } + + return a +} + +var t1 = [[27, "Jonah"], + [18, "Alan"], + [28, "Glory"], + [18, "Popeye"], + [28, "Alan"]] + +var t2 = [["Jonah", "Whales"], + ["Jonah", "Spiders"], + ["Alan", "Ghosts"], + ["Alan", "Zombies"], + ["Glory", "Buffy"]] + +hashJoin(t1, 1, t2, 0).each { .say } diff --git a/Task/Hash-join/Visual-FoxPro/hash-join.visual b/Task/Hash-join/Visual-FoxPro/hash-join.visual new file mode 100644 index 0000000000..c7f856b97d --- /dev/null +++ b/Task/Hash-join/Visual-FoxPro/hash-join.visual @@ -0,0 +1,54 @@ +LOCAL i As Integer, n As Integer +CLOSE DATABASES ALL +*!* Create and populate the hash tables +CREATE CURSOR people_ids(id I, used L DEFAULT .F.) +INDEX ON id TAG id COLLATE "Machine" +INDEX ON used TAG used BINARY COLLATE "Machine" +SET ORDER TO 0 +CREATE CURSOR nem_ids(id I, used L DEFAULT .F.) +INDEX ON id TAG id COLLATE "Machine" +INDEX ON used TAG used BINARY COLLATE "Machine" +SET ORDER TO 0 +n = 100 +FOR i = 1 TO n + INSERT INTO people_ids (id) VALUES (i) + INSERT INTO nem_ids (id) VALUES (i) +ENDFOR + +CREATE CURSOR people (age I, name V(16), id I) +INDEX ON id TAG id COLLATE "Machine" +INDEX ON name TAG name COLLATE "Machine" +SET ORDER TO 0 +INSERT INTO people (age, name) VALUES (27, "Jonah") +INSERT INTO people (age, name) VALUES (18, "Alan") +INSERT INTO people (age, name) VALUES (28, "Glory") +INSERT INTO people (age, name) VALUES (18, "Popeye") +INSERT INTO people (age, name) VALUES (28, "Alan") +REPLACE id WITH HashMe("people_ids") ALL + +*!* The plural of nemesis is nemeses +CREATE CURSOR nemeses (name V(16), nemesis V(16), p_id I, id I) +INDEX ON id TAG id COLLATE "Machine" +INDEX ON p_id TAG p_id COLLATE "Machine" +INDEX ON name TAG name COLLATE "Machine" +SET ORDER TO 0 + +INSERT INTO nemeses (name, nemesis) VALUES ("Jonah", "Whales") +INSERT INTO nemeses (name, nemesis) VALUES ("Jonah", "Spiders") +INSERT INTO nemeses (name, nemesis) VALUES ("Alan", "Ghosts") +INSERT INTO nemeses (name, nemesis) VALUES ("Alan", "Zombies") +INSERT INTO nemeses (name, nemesis) VALUES ("Glory", "Buffy") +REPLACE id WITH HashMe("nem_ids") ALL +UPDATE nemeses SET p_id = people.id FROM people ; +WHERE nemeses.name = people.name + +*!* Show the join +SELECT pe.age, pe.name, ne.nemesis FROM people pe ; +JOIN nemeses ne ON pe.id = ne.p_id TO FILE "hashjoin.txt" + +FUNCTION HashMe(cTable As String) As Integer +LOCAL ARRAY a[1] +SELECT MIN(id) FROM (cTable) WHERE NOT used INTO ARRAY a +UPDATE (cTable) SET used = .T. WHERE id = a[1] +RETURN a[1] +ENDFUNC diff --git a/Task/Hash-join/jq/hash-join-1.jq b/Task/Hash-join/jq/hash-join-1.jq new file mode 100644 index 0000000000..9361b253d0 --- /dev/null +++ b/Task/Hash-join/jq/hash-join-1.jq @@ -0,0 +1,35 @@ +# hashJoin(table1; key1; table2; key2) expects the two tables to be +# arrays, either of JSON objects, or of arrays. + +# In the first case, that is, if the table's rows are represented as +# objects, then key1 should be the key of the join column of table1, +# and similarly for key2; if the join columns have different names, +# then they will both be included in the resultant objects. + +# In the second case, that is, if the rows are arrays, then the +# 0-based indices of the join columns should be specified, and the +# rows are simply pasted together, resulting in duplication of the +# join columns. +# +def hashJoin(table1; key1; table2; key2): + # collision-free hash function: + def h: + if type == "object" then with_entries(.value = (.value|h)) | tostring + elif type == "array" then map(h)|tostring + else (type[0:1]+tostring) + end; + + # hash phase: + reduce table1[] as $row + ({}; + ($row[key1]|h) as $key + | . + { ($key): (.[$key] + [$row]) } ) + | . as $hash + # join phase + | reduce table2[] as $row + ([]; + ($row[key2]|h) as $key + | if $hash|has($key) then + reduce $hash[$key][] as $r (.; . + [ $row + $r ] ) + else . end) +; diff --git a/Task/Hash-join/jq/hash-join-2.jq b/Task/Hash-join/jq/hash-join-2.jq new file mode 100644 index 0000000000..cfe26aa48d --- /dev/null +++ b/Task/Hash-join/jq/hash-join-2.jq @@ -0,0 +1,39 @@ +def table1: + [ {"age": 27, "name": "Jonah"}, + {"age": 18, "name": "Alan"}, + {"age": 28, "name": "Glory"}, + {"age": 18, "name": "Popeye"}, + {"age": 28, "name": "Alan"} ] +; + +def table2: + [ {"name": "Jonah", "nemesis": "Whales"}, + {"name": "Jonah", "nemesis": "Spiders"}, + {"name": "Alan", "nemesis": "Ghosts"}, + {"name": "Alan", "nemesis": "Zombies"}, + {"name": "Glory", "nemesis": "Buffy"} ] +; + +def table1a: + [[27, "Jonah"], + [18, "Alan"], + [28, "Glory"], + [18, "Popeye"], + [28, "Alan"] ] +; + +def table2a: + [["Jonah", "Whales"], + ["Jonah", "Spiders"], + ["Alan", "Ghosts"], + ["Alan", "Zombies"], + ["Glory", "Buffy"], + ["Holmes", "Moriarty"] ] +; + +def pp: + reduce .[] as $row (""; . + "\n" + ($row|tostring)); + +( hashJoin(table1; "name"; table2; "name"), + hashJoin(table1a; 1; table2a; 0) +) | pp diff --git a/Task/Hash-join/jq/hash-join-3.jq b/Task/Hash-join/jq/hash-join-3.jq new file mode 100644 index 0000000000..42aa83578e --- /dev/null +++ b/Task/Hash-join/jq/hash-join-3.jq @@ -0,0 +1,13 @@ +$ jq -c -r -n -f HashJoin.jq + +{"age":27,"name":"Jonah","nemesis":"Whales"} +{"age":27,"name":"Jonah","nemesis":"Spiders"} +{"age":28,"name":"Alan","nemesis":"Ghosts"} +{"age":28,"name":"Alan","nemesis":"Zombies"} +{"age":28,"name":"Glory","nemesis":"Buffy"} + +[27,"Jonah","Jonah","Whales"] +[27,"Jonah","Jonah","Spiders"] +[28,"Alan","Alan","Ghosts"] +[28,"Alan","Alan","Zombies"] +[28,"Glory","Glory","Buffy"] diff --git a/Task/Hash-join/jq/hash-join-4.jq b/Task/Hash-join/jq/hash-join-4.jq new file mode 100644 index 0000000000..dcefa645eb --- /dev/null +++ b/Task/Hash-join/jq/hash-join-4.jq @@ -0,0 +1,27 @@ +# The tables should be arrays of arrays; +# index1 and index2 should be the 0-based indices of the join columns. +# +def hashJoinArrays(table1; index1; table2; index2): + # collision-free hash function: + def h: + if type == "object" then with_entries(.value = (.value|h)) | tostring + elif type == "array" then map(h)|tostring + else (type[0:1]+tostring) + end; + + # hash phase: + reduce table1[] as $row + ({}; + ($row[index1]|h) as $key + | . + (.[$key] += [ $row ]) ) + | . as $hash + # join phase + | reduce table2[] as $row + ([]; + ($row[index2]|h) as $key + | if $hash|has($key) then + reduce $hash[$key][] as $r + (.; + . + [ $r + $row[0:index2] + $row[index2+1:] ] ) + else . end) +; diff --git a/Task/Hash-join/jq/hash-join-5.jq b/Task/Hash-join/jq/hash-join-5.jq new file mode 100644 index 0000000000..ba5c156d83 --- /dev/null +++ b/Task/Hash-join/jq/hash-join-5.jq @@ -0,0 +1 @@ +hashJoinArrays(table1; 1; table2; 0) | pp diff --git a/Task/Hash-join/jq/hash-join-6.jq b/Task/Hash-join/jq/hash-join-6.jq new file mode 100644 index 0000000000..ad7969b94e --- /dev/null +++ b/Task/Hash-join/jq/hash-join-6.jq @@ -0,0 +1,7 @@ +$ jq -c -r -n -f HashJoinArrays.jq + +[27,"Jonah","Whales"] +[27,"Jonah","Spiders"] +[28,"Alan","Ghosts"] +[28,"Alan","Zombies"] +[28,"Glory","Buffy"] diff --git a/Task/Haversine-formula/ERRE/haversine-formula.erre b/Task/Haversine-formula/ERRE/haversine-formula.erre new file mode 100644 index 0000000000..4e3e385ef4 --- /dev/null +++ b/Task/Haversine-formula/ERRE/haversine-formula.erre @@ -0,0 +1,31 @@ +% Implemented by Claudio Larini + +PROGRAM HAVERSINE_DEMO + +!$DOUBLE + +CONST DIAMETER=12745.6 + +FUNCTION DEG2RAD(X) + DEG2RAD=X*π/180 +END FUNCTION + +FUNCTION RAD2DEG(X) + RAD2DEG=X*180/π +END FUNCTION + +PROCEDURE HAVERSINE_DIST(TH1,PH1,TH2,PH2->RES) + LOCAL DX,DY,DZ + PH1=DEG2RAD(PH1-PH2) + TH1=DEG2RAD(TH1) + TH2=DEG2RAD(TH2) + DZ=SIN(TH1)-SIN(TH2) + DX=COS(PH1)*COS(TH1)-COS(TH2) + DY=SIN(PH1)*COS(TH1) + RES=ASN(SQR(DX^2+DY^2+DZ^2)/2)*DIAMETER +END PROCEDURE + +BEGIN + HAVERSINE_DIST(36.12,-86.67,33.94,-118.4->RES) + PRINT("HAVERSINE DISTANCE: ";RES;" KM.") +END PROGRAM diff --git a/Task/Haversine-formula/FreeBASIC/haversine-formula.freebasic b/Task/Haversine-formula/FreeBASIC/haversine-formula.freebasic new file mode 100644 index 0000000000..9273f7275f --- /dev/null +++ b/Task/Haversine-formula/FreeBASIC/haversine-formula.freebasic @@ -0,0 +1,36 @@ +' version 09-10-2016 +' compile with: fbc -s console + +' Nashville International Airport (BNA) in Nashville, TN, USA, +' N 36°07.2', W 86°40.2' (36.12, -86.67) +' Los Angeles International Airport (LAX) in Los Angeles, CA, USA, +' N 33°56.4', W 118°24.0' (33.94, -118.40). +' 6372.8 km is an approximation of the radius of the average circumference + +#Define Pi Atn(1) * 4 ' define Pi = 3.1415.. +#Define deg2rad Pi / 180 ' define deg to rad 0.01745.. +#Define earth_radius 6372.8 ' earth radius in km. + +Function Haversine(lat1 As Double, long1 As Double, lat2 As Double, _ + long2 As Double , radius As Double) As Double + + Dim As Double d_long = deg2rad * (long1 - long2) + Dim As Double theta1 = deg2rad * lat1 + Dim As Double theta2 = deg2rad * lat2 + Dim As Double dx = Cos(d_long) * Cos(theta1) - Cos(theta2) + Dim As Double dy = Sin(d_long) * Cos(theta1) + Dim As Double dz = Sin(theta1) - Sin(theta2) + Return Asin(Sqr(dx*dx + dy*dy + dz*dz) / 2) * radius * 2 + +End Function + +Print +Print " Haversine distance between BNA and LAX = "; _ + Haversine(36.12, -86.67, 33.94, -118.4, earth_radius); " km." + + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Haversine-formula/FunL/haversine-formula.funl b/Task/Haversine-formula/FunL/haversine-formula.funl new file mode 100644 index 0000000000..96780b47b1 --- /dev/null +++ b/Task/Haversine-formula/FunL/haversine-formula.funl @@ -0,0 +1,12 @@ +import math.* + +def haversin( theta ) = (1 - cos( theta ))/2 + +def radians( deg ) = deg Pi/180 + +def haversine( (lat1, lon1), (lat2, lon2) ) = + R = 6372.8 + h = haversin( radians(lat2 - lat1) ) + cos( radians(lat1) ) cos( radians(lat2) ) haversin( radians(lon2 - lon1) ) + 2R asin( sqrt(h) ) + +println( haversine((36.12, -86.67), (33.94, -118.40)) ) diff --git a/Task/Haversine-formula/FutureBasic/haversine-formula.futurebasic b/Task/Haversine-formula/FutureBasic/haversine-formula.futurebasic new file mode 100644 index 0000000000..e2c29f23a2 --- /dev/null +++ b/Task/Haversine-formula/FutureBasic/haversine-formula.futurebasic @@ -0,0 +1,23 @@ +include "ConsoleWindow" + +local fn Haversine( lat1 as double, lon1 as double, lat2 as double, lon2 as double, miles as ^double, kilometers as ^double ) +dim as double deg2rad, dLat, dLon, a, c, earth_radius_miles, earth_radius_kilometers + +earth_radius_miles = 3959.0 // Radius of the Earth in miles +earth_radius_kilometers = 6372.8 // Radius of the Earth in kilometers +deg2rad = Pi / 180 // Pi is predefined in FutureBasic + +dLat = deg2rad * ( lat2 - lat1 ) +dLon = deg2rad * ( lon2 - lon1 ) +a = sin( dLat / 2 ) * sin( dLat / 2 ) + cos( deg2rad * lat1 ) * cos( deg2rad * lat2 ) * sin( dLon / 2 ) * sin( dLon / 2 ) +c = 2 * asin( sqr(a) ) + +miles.nil# = earth_radius_miles * c +kilometers.nil# = earth_radius_kilometers * c +end fn + +dim as double miles, kilometers +fn Haversine( 36.12, -86.67, 33.94, -118.4, @miles, @kilometers ) + +print "Distance in miles between BNA and LAX: "; using "####.####"; miles; " miles." +print "Distance in kilometers between BNA LAX: "; using "####.####"; kilometers; " km." diff --git a/Task/Haversine-formula/Idris/haversine-formula.idris b/Task/Haversine-formula/Idris/haversine-formula.idris new file mode 100644 index 0000000000..f798423cc9 --- /dev/null +++ b/Task/Haversine-formula/Idris/haversine-formula.idris @@ -0,0 +1,40 @@ +module Main + +-- The haversine of an angle. +hsin : Double -> Double +hsin t = let u = sin (t/2) in u*u + +-- The distance between two points, given by latitude and longtitude, on a +-- circle. The points are specified in radians. +distRad : Double -> (Double, Double) -> (Double, Double) -> Double +distRad radius (lat1, lng1) (lat2, lng2) = + let hlat = hsin (lat2 - lat1) + hlng = hsin (lng2 - lng1) + root = sqrt (hlat + cos lat1 * cos lat2 * hlng) + in 2 * radius * asin (min 1.0 root) + +-- The distance between two points, given by latitude and longtitude, on a +-- circle. The points are specified in degrees. +distDeg : Double -> (Double, Double) -> (Double, Double) -> Double +distDeg radius p1 p2 = distRad radius (deg2rad p1) (deg2rad p2) + where + d2r : Double -> Double + d2r t = t * pi / 180 + deg2rad (t, u) = (d2r t, d2r u) + +-- The approximate distance, in kilometers, between two points on Earth. +-- The latitude and longtitude are assumed to be in degrees. +earthDist : (Double, Double) -> (Double, Double) -> Double +earthDist = distDeg 6372.8 + +main : IO () +main = putStrLn $ "The distance between BNA and LAX is about " ++ show (floor dst) ++ " km." + where + bna : (Double, Double) + bna = (36.12, -86.67) + + lax : (Double, Double) + lax = (33.94, -118.40) + + dst : Double + dst = earthDist bna lax diff --git a/Task/Haversine-formula/LiveCode/haversine-formula-1.livecode b/Task/Haversine-formula/LiveCode/haversine-formula-1.livecode new file mode 100644 index 0000000000..7023c4223e --- /dev/null +++ b/Task/Haversine-formula/LiveCode/haversine-formula-1.livecode @@ -0,0 +1,27 @@ +function radians n + return n * (3.1415926 / 180) +end radians + +function haversine lat1, lng1, lat2, lng2 + local radiusEarth + local lat3, lng3 + local lat1Rad, lat2Rad, lat3Rad + local lngRad1, lngRad2, lngRad3 + local haver + put 6372.8 into radiusEarth + put (lat2 - lat1) into lat3 + put (lng2 - lng1) into lng3 + put radians(lat1) into lat1Rad + put radians(lat2) into lat2Rad + put radians(lat3) into lat3Rad + put radians(lng1) into lngRad1 + put radians(lng2) into lngRad2 + put radians(lng3) into lngRad3 + + put (sin(lat3Rad/2.0)^2) + (cos(lat1Rad)) \ + * (cos(lat2Rad)) \ + * (sin(lngRad3/2.0)^2) \ + into haver  + return (radiusEarth * (2.0 * asin(sqrt(haver)))) + +end haversine diff --git a/Task/Haversine-formula/LiveCode/haversine-formula-2.livecode b/Task/Haversine-formula/LiveCode/haversine-formula-2.livecode new file mode 100644 index 0000000000..716087059b --- /dev/null +++ b/Task/Haversine-formula/LiveCode/haversine-formula-2.livecode @@ -0,0 +1,2 @@ +haversine(36.12, -86.67, 33.94, -118.40) +2887.259923 diff --git a/Task/Haversine-formula/Nim/haversine-formula.nim b/Task/Haversine-formula/Nim/haversine-formula.nim new file mode 100644 index 0000000000..395feb7738 --- /dev/null +++ b/Task/Haversine-formula/Nim/haversine-formula.nim @@ -0,0 +1,18 @@ +import math + +proc radians(x): float = x * Pi / 180 + +proc haversine(lat1, lon1, lat2, lon2): float = + const r = 6372.8 # Earth radius in kilometers + let + dLat = radians(lat2 - lat1) + dLon = radians(lon2 - lon1) + lat1 = radians(lat1) + lat2 = radians(lat2) + + a = sin(dLat/2)*sin(dLat/2) + cos(lat1)*cos(lat2)*sin(dLon/2)*sin(dLon/2) + c = 2*arcsin(sqrt(a)) + + result = r * c + +echo haversine(36.12, -86.67, 33.94, -118.40) diff --git a/Task/Haversine-formula/Oforth/haversine-formula.oforth b/Task/Haversine-formula/Oforth/haversine-formula.oforth new file mode 100644 index 0000000000..47bcbdaa32 --- /dev/null +++ b/Task/Haversine-formula/Oforth/haversine-formula.oforth @@ -0,0 +1,12 @@ +import: math + +: haversine(lat1, lon1, lat2, lon2) +| lat lon | + + lat2 lat1 - asRadian ->lat + lon2 lon1 - asRadian ->lon + + lon 2 / sin sq lat1 asRadian cos * lat2 asRadian cos * + lat 2 / sin sq + sqrt asin 2 * 6372.8 * ; + +haversine(36.12, -86.67, 33.94, -118.40) println diff --git a/Task/Haversine-formula/Ring/haversine-formula.ring b/Task/Haversine-formula/Ring/haversine-formula.ring new file mode 100644 index 0000000000..31310ca2b6 --- /dev/null +++ b/Task/Haversine-formula/Ring/haversine-formula.ring @@ -0,0 +1,15 @@ +decimals(8) +see haversine(36.12, -86.67, 33.94, -118.4) + nl + +func haversine x1, y1, x2, y2 + r=0.01745 + x1= x1*r + x2= x2*r + y1= y1*r + y2= y2*r + dy = y2-y1 + dx = x2-x1 + a = pow(sin(dx/2),2) + cos(x1) * cos(x2) * pow(sin(dy/2),2) + c = 2 * asin(sqrt(a)) + d = 6372.8 * c + return d diff --git a/Task/Haversine-formula/Sidef/haversine-formula.sidef b/Task/Haversine-formula/Sidef/haversine-formula.sidef new file mode 100644 index 0000000000..738d7f814e --- /dev/null +++ b/Task/Haversine-formula/Sidef/haversine-formula.sidef @@ -0,0 +1,29 @@ +class EarthPoint(lat, lon) { + + const earth_radius = 6371; # mean earth radius + const radian_ratio = Math.pi/180; + + # accessors for radians + method latR { self.lat * radian_ratio }; + method lonR { self.lon * radian_ratio }; + + method haversine_dist(EarthPoint p) { + var arc = EarthPoint( + self.lat - p.lat, + self.lon - p.lon, + ); + + var a = Math.sum( + (arc.latR / 2).sin**2, + (arc.lonR / 2).sin**2 * + self.latR.cos * p.latR.cos + ) + + earth_radius * a.sqrt.asin * 2; + } +} + +var BNA = EarthPoint.new(lat: 36.12, lon: -86.67); +var LAX = EarthPoint.new(lat: 33.94, lon: -118.4); + +say BNA.haversine_dist(LAX); # => 2886.44444283798329974715782394574672 diff --git a/Task/Haversine-formula/Swift/haversine-formula.swift b/Task/Haversine-formula/Swift/haversine-formula.swift new file mode 100644 index 0000000000..9b696fe015 --- /dev/null +++ b/Task/Haversine-formula/Swift/haversine-formula.swift @@ -0,0 +1,18 @@ +import Foundation + +func haversine(lat1:Double, lon1:Double, lat2:Double, lon2:Double) -> Double { + let lat1rad = lat1 * M_PI/180 + let lon1rad = lon1 * M_PI/180 + let lat2rad = lat2 * M_PI/180 + let lon2rad = lon2 * M_PI/180 + + let dLat = lat2rad - lat1rad + let dLon = lon2rad - lon1rad + let a = sin(dLat/2) * sin(dLat/2) + sin(dLon/2) * sin(dLon/2) * cos(lat1rad) * cos(lat2rad) + let c = 2 * asin(sqrt(a)) + let R = 6372.8 + + return R * c +} + +println(haversine(36.12, -86.67, 33.94, -118.40)) diff --git a/Task/Haversine-formula/jq/haversine-formula.jq b/Task/Haversine-formula/jq/haversine-formula.jq new file mode 100644 index 0000000000..a8c2aab9d6 --- /dev/null +++ b/Task/Haversine-formula/jq/haversine-formula.jq @@ -0,0 +1,9 @@ +def haversine(lat1;lon1; lat2;lon2): + def radians: . * (1|atan)/45; + def sind: radians|sin; + def cosd: radians|cos; + def sq: . * .; + + (((lat2 - lat1)/2) | sind | sq) as $dlat + | (((lon2 - lon1)/2) | sind | sq) as $dlon + | 2 * 6372.8 * (( $dlat + (lat1|cosd) * (lat2|cosd) * $dlon ) | sqrt | asin) ; diff --git a/Task/Hello-world-Graphical/Axe/hello-world-graphical.axe b/Task/Hello-world-Graphical/Axe/hello-world-graphical.axe new file mode 100644 index 0000000000..f4f91f4161 --- /dev/null +++ b/Task/Hello-world-Graphical/Axe/hello-world-graphical.axe @@ -0,0 +1,3 @@ +ClrHome +Text(0,0,"Goodbye, world!") +Pause 5000 diff --git a/Task/Hello-world-Graphical/BML/hello-world-graphical.bml b/Task/Hello-world-Graphical/BML/hello-world-graphical.bml new file mode 100644 index 0000000000..7cb740ddb0 --- /dev/null +++ b/Task/Hello-world-Graphical/BML/hello-world-graphical.bml @@ -0,0 +1 @@ +msgbox Goodbye, World! diff --git a/Task/Hello-world-Graphical/EchoLisp/hello-world-graphical.echolisp b/Task/Hello-world-Graphical/EchoLisp/hello-world-graphical.echolisp new file mode 100644 index 0000000000..79b903149f --- /dev/null +++ b/Task/Hello-world-Graphical/EchoLisp/hello-world-graphical.echolisp @@ -0,0 +1 @@ +(alert "Good bye, world!") diff --git a/Task/Hello-world-Graphical/FreeBASIC/hello-world-graphical.freebasic b/Task/Hello-world-Graphical/FreeBASIC/hello-world-graphical.freebasic new file mode 100644 index 0000000000..e059003621 --- /dev/null +++ b/Task/Hello-world-Graphical/FreeBASIC/hello-world-graphical.freebasic @@ -0,0 +1,16 @@ +'FreeBASIC Hello-fb0.bas May 2015 + +Screen 0 'open text window +Print "Hello world" + +Print "Enter any key to go the graphics screen" +sleep + +screen 18 'Screen 18 Resolution 640x480 with at least 256 colors +locate 10,10 +Print "Hello world!" + +locate 20,10 +Print "Enter any key to exit" +sleep +End diff --git a/Task/Hello-world-Graphical/FunL/hello-world-graphical.funl b/Task/Hello-world-Graphical/FunL/hello-world-graphical.funl new file mode 100644 index 0000000000..8ae4b029e7 --- /dev/null +++ b/Task/Hello-world-Graphical/FunL/hello-world-graphical.funl @@ -0,0 +1,17 @@ +native javax.swing.{SwingUtilities, JPanel, JLabel, JFrame} +native java.awt.Font + +def createAndShowGUI( msg ) = + f = JFrame() + f.setTitle( msg ) + f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ) + p = JPanel() + l = JLabel( msg ) + l.setFont( Font.decode(Font.SERIF + ' 150') ) + p.add( l ) + f.add( p ) + f.pack() + f.setResizable( false ) + f.setVisible( true ) + +SwingUtilities.invokeLater( createAndShowGUI.runnable('Goodbye, World!') ) diff --git a/Task/Hello-world-Graphical/HPPPL/hello-world-graphical-1.hpppl b/Task/Hello-world-Graphical/HPPPL/hello-world-graphical-1.hpppl new file mode 100644 index 0000000000..bc9f24ca8c --- /dev/null +++ b/Task/Hello-world-Graphical/HPPPL/hello-world-graphical-1.hpppl @@ -0,0 +1 @@ +MSGBOX("Goodbye, World!"); diff --git a/Task/Hello-world-Graphical/HPPPL/hello-world-graphical-2.hpppl b/Task/Hello-world-Graphical/HPPPL/hello-world-graphical-2.hpppl new file mode 100644 index 0000000000..f6d8aff269 --- /dev/null +++ b/Task/Hello-world-Graphical/HPPPL/hello-world-graphical-2.hpppl @@ -0,0 +1,3 @@ +RECT(); +TEXTOUT_P("Goodbye, World!", GROBW_P(G0)/4, GROBH_P(G0)/4, 7); +WAIT(-1); diff --git a/Task/Hello-world-Graphical/Harbour/hello-world-graphical.harbour b/Task/Hello-world-Graphical/Harbour/hello-world-graphical.harbour new file mode 100644 index 0000000000..b91eb0d7c4 --- /dev/null +++ b/Task/Hello-world-Graphical/Harbour/hello-world-graphical.harbour @@ -0,0 +1,2 @@ +PROCEDURE Main() + RETURN wapi_MessageBox(,"Goodbye, World!","") diff --git a/Task/Hello-world-Graphical/I/hello-world-graphical-1.i b/Task/Hello-world-Graphical/I/hello-world-graphical-1.i new file mode 100644 index 0000000000..01b85ab21a --- /dev/null +++ b/Task/Hello-world-Graphical/I/hello-world-graphical-1.i @@ -0,0 +1,3 @@ +gui { + Goodbye, World! +} diff --git a/Task/Hello-world-Graphical/I/hello-world-graphical-2.i b/Task/Hello-world-Graphical/I/hello-world-graphical-2.i new file mode 100644 index 0000000000..6343cb20aa --- /dev/null +++ b/Task/Hello-world-Graphical/I/hello-world-graphical-2.i @@ -0,0 +1,6 @@ +link graphics +procedure main() + WOpen("size=100,20") | stop("No window") + WWrites("Goodbye, World!") + WDone() +end diff --git a/Task/Hello-world-Graphical/I/hello-world-graphical-3.i b/Task/Hello-world-Graphical/I/hello-world-graphical-3.i new file mode 100644 index 0000000000..fce8c59d05 --- /dev/null +++ b/Task/Hello-world-Graphical/I/hello-world-graphical-3.i @@ -0,0 +1,21 @@ +import gui +$include "guih.icn" + +class WindowApp : Dialog () + + # -- automatically called when the dialog is created + method component_setup () + # add 'hello world' label + label := Label("label=Hello world","pos=0,0") + add (label) + + # make sure we respond to close event + connect(self, "dispose", CLOSE_BUTTON_EVENT) + end +end + +# create and show the window +procedure main () + w := WindowApp () + w.show_modal () +end diff --git a/Task/Hello-world-Graphical/Lasso/hello-world-graphical.lasso b/Task/Hello-world-Graphical/Lasso/hello-world-graphical.lasso new file mode 100644 index 0000000000..27cce06ce5 --- /dev/null +++ b/Task/Hello-world-Graphical/Lasso/hello-world-graphical.lasso @@ -0,0 +1 @@ +sys_process('/usr/bin/osascript', (: '-e', 'display dialog "Goodbye, World!"'))->wait diff --git a/Task/Hello-world-Graphical/Lingo/hello-world-graphical-1.lingo b/Task/Hello-world-Graphical/Lingo/hello-world-graphical-1.lingo new file mode 100644 index 0000000000..4a02180501 --- /dev/null +++ b/Task/Hello-world-Graphical/Lingo/hello-world-graphical-1.lingo @@ -0,0 +1 @@ +_player.alert("Goodbye, World!") diff --git a/Task/Hello-world-Graphical/Lingo/hello-world-graphical-2.lingo b/Task/Hello-world-Graphical/Lingo/hello-world-graphical-2.lingo new file mode 100644 index 0000000000..0895ec0db3 --- /dev/null +++ b/Task/Hello-world-Graphical/Lingo/hello-world-graphical-2.lingo @@ -0,0 +1,15 @@ +-- create a field +m = new(#field) +m.rect = rect(0,0,320,240) +m.alignment = "center" +m.fontsize = 24 +m.fontStyle = "bold" +m.text = "Goodbye, World!" + +-- create sprite, assign field +_movie.puppetSprite(1, TRUE) +sprite(1).member = m +sprite(1).loc = point(0,105) + +-- force immediate update +_movie.updateStage() diff --git a/Task/Hello-world-Graphical/LiveCode/hello-world-graphical-1.livecode b/Task/Hello-world-Graphical/LiveCode/hello-world-graphical-1.livecode new file mode 100644 index 0000000000..2bbe20df47 --- /dev/null +++ b/Task/Hello-world-Graphical/LiveCode/hello-world-graphical-1.livecode @@ -0,0 +1 @@ +answer "Goodbye, World!" diff --git a/Task/Hello-world-Graphical/LiveCode/hello-world-graphical-2.livecode b/Task/Hello-world-Graphical/LiveCode/hello-world-graphical-2.livecode new file mode 100644 index 0000000000..2081b8b6d0 --- /dev/null +++ b/Task/Hello-world-Graphical/LiveCode/hello-world-graphical-2.livecode @@ -0,0 +1 @@ +answer warning "Goodbye, World!" with "Goodbye, World!" titled "Goodbye, World!" diff --git a/Task/Hello-world-Graphical/Lobster/hello-world-graphical.lobster b/Task/Hello-world-Graphical/Lobster/hello-world-graphical.lobster new file mode 100644 index 0000000000..316046574b --- /dev/null +++ b/Task/Hello-world-Graphical/Lobster/hello-world-graphical.lobster @@ -0,0 +1,7 @@ +gl_window("graphical hello world", 800, 600) +gl_setfontname("data/fonts/Droid_Sans/DroidSans.ttf") +gl_setfontsize(30) + +while gl_frame(): + gl_clear([ 0.0, 0.0, 0.0, 1.0 ]) + gl_text("Goodbye, World!") diff --git a/Task/Hello-world-Graphical/Nim/hello-world-graphical-1.nim b/Task/Hello-world-Graphical/Nim/hello-world-graphical-1.nim new file mode 100644 index 0000000000..607a5c0372 --- /dev/null +++ b/Task/Hello-world-Graphical/Nim/hello-world-graphical-1.nim @@ -0,0 +1,4 @@ +import dialogs, gtk2 +gtk2.nim_init() + +info(nil, "Hello World") diff --git a/Task/Hello-world-Graphical/Nim/hello-world-graphical-2.nim b/Task/Hello-world-Graphical/Nim/hello-world-graphical-2.nim new file mode 100644 index 0000000000..4a44ae767f --- /dev/null +++ b/Task/Hello-world-Graphical/Nim/hello-world-graphical-2.nim @@ -0,0 +1,5 @@ +import iup + +discard iup.open(nil, nil) +message("Hello", "Hello World") +close() diff --git a/Task/Hello-world-Graphical/Phix/hello-world-graphical.phix b/Task/Hello-world-Graphical/Phix/hello-world-graphical.phix new file mode 100644 index 0000000000..2eb60c7ea3 --- /dev/null +++ b/Task/Hello-world-Graphical/Phix/hello-world-graphical.phix @@ -0,0 +1,4 @@ +include pGUI.e +IupOpen("demo/pGUI/") +IupMessage("Bye","Goodbye, World!") +IupClose() diff --git a/Task/Hello-world-Graphical/Ring/hello-world-graphical.ring b/Task/Hello-world-Graphical/Ring/hello-world-graphical.ring new file mode 100644 index 0000000000..caf9986bbf --- /dev/null +++ b/Task/Hello-world-Graphical/Ring/hello-world-graphical.ring @@ -0,0 +1,8 @@ +Load "guilib.ring" +New qApp { + new qWidget() { + setwindowtitle("Hello World") + show() + } + exec() +} diff --git a/Task/Hello-world-Graphical/SSEM/hello-world-graphical.ssem b/Task/Hello-world-Graphical/SSEM/hello-world-graphical.ssem new file mode 100644 index 0000000000..f75a87e536 --- /dev/null +++ b/Task/Hello-world-Graphical/SSEM/hello-world-graphical.ssem @@ -0,0 +1,18 @@ +01100000000001110000000000000000 +10000000000001010000000000000000 +10011101110111011101010111000000 +10010101010101010101010101000000 +10010101010101010101010111000000 +10011101110111011100110100000010 +10000000000000000000010011000010 +10011000000000000000100000000100 +01101000000000000001000000000000 +00000000000000000000000000000000 +00000000000000000000000000000000 +00100100100000000010000100100000 +00100100100000000010000100100000 +00100100101110111010011100100000 +00100100101010100010010100100000 +00100100101010100010010100000000 +00100100101110100011011100100000 +00011011000000000000000000000000 diff --git a/Task/Hello-world-Graphical/Sidef/hello-world-graphical-1.sidef b/Task/Hello-world-Graphical/Sidef/hello-world-graphical-1.sidef new file mode 100644 index 0000000000..e388971e3b --- /dev/null +++ b/Task/Hello-world-Graphical/Sidef/hello-world-graphical-1.sidef @@ -0,0 +1,7 @@ +var tk = require('Tk'); +var main = %s'MainWindow'.new; +main.Button( + '-text' => 'Goodbye, World!', + '-command' => 'exit', +).pack; +tk.MainLoop; diff --git a/Task/Hello-world-Graphical/Sidef/hello-world-graphical-2.sidef b/Task/Hello-world-Graphical/Sidef/hello-world-graphical-2.sidef new file mode 100644 index 0000000000..8ac4bb48f7 --- /dev/null +++ b/Task/Hello-world-Graphical/Sidef/hello-world-graphical-2.sidef @@ -0,0 +1,12 @@ +var gtk2 = require('Gtk2') -> init; + +var window = %s'Gtk2::Window'.new; +var label = %s'Gtk2::Label'.new('Goodbye, World!'); + +window.set_title('Goodbye, World!'); +window.signal_connect(destroy => func(*_){ gtk2.main_quit }); + +window.add(label); +window.show_all; + +gtk2.main; diff --git a/Task/Hello-world-Graphical/Swift/hello-world-graphical.swift b/Task/Hello-world-Graphical/Swift/hello-world-graphical.swift new file mode 100644 index 0000000000..ec7ee48d36 --- /dev/null +++ b/Task/Hello-world-Graphical/Swift/hello-world-graphical.swift @@ -0,0 +1,5 @@ +import Cocoa + +let alert = NSAlert() +alert.messageText = "Goodbye, World!" +alert.runModal() diff --git a/Task/Hello-world-Graphical/Visual-FoxPro/hello-world-graphical.visual b/Task/Hello-world-Graphical/Visual-FoxPro/hello-world-graphical.visual new file mode 100644 index 0000000000..9bf15e8480 --- /dev/null +++ b/Task/Hello-world-Graphical/Visual-FoxPro/hello-world-graphical.visual @@ -0,0 +1,5 @@ +* Version 1: +MESSAGEBOX("Goodbye, World!") + +* Version 2: +? "Goodbye, World!" diff --git a/Task/Hello-world-Graphical/jq/hello-world-graphical-1.jq b/Task/Hello-world-Graphical/jq/hello-world-graphical-1.jq new file mode 100644 index 0000000000..cf68cad38b --- /dev/null +++ b/Task/Hello-world-Graphical/jq/hello-world-graphical-1.jq @@ -0,0 +1,35 @@ +# Convert a JSON object to a string suitable for use as a CSS style value +# e.g: "font-size: 40px; text-align: center;" (without the quotation marks) +def to_s: + reduce to_entries[] as $pair (""; . + "\($pair.key): \($pair.value); "); + +# Defaults: 100%, 100% +def svg(width; height): + ""; + +# Defaults: +# id: "linearGradient" +# color1: rgb(0,0,0) +# color2: rgb(255,255,255) +def linearGradient(id; color1; color2): + " + + + + + "; + +# input: the text string +# "style" should be a JSON object (see for example the default ($dstyle)); +# the style actually used is (default + style), i.e. whatever is specified in "style" wins. +# Defaults: +# x: 0 +# y: 0 +def text(x; y; style): + . as $in + | {"font-size": "40px", "text-align": "center", "text-anchor": "left", "fill": "black"} as $dstyle + | (($dstyle + style) | to_s) as $style + | " + \(.)", + ""; diff --git a/Task/Hello-world-Graphical/jq/hello-world-graphical-2.jq b/Task/Hello-world-Graphical/jq/hello-world-graphical-2.jq new file mode 100644 index 0000000000..443f57ce29 --- /dev/null +++ b/Task/Hello-world-Graphical/jq/hello-world-graphical-2.jq @@ -0,0 +1,7 @@ +def task: + svg(null;null), # use the defaults + linearGradient("gradient"; "rgb(255,255,0)"; "rgb(255,0,0)"), # define "gradient" + ("Goodbye, World!" | text(10; 50; {"fill": "url(#gradient)"})), # notice how the default for "fill" is overridden + ""; + +task diff --git a/Task/Hello-world-Line-printer/ERRE/hello-world-line-printer.erre b/Task/Hello-world-Line-printer/ERRE/hello-world-line-printer.erre new file mode 100644 index 0000000000..8f780a48f5 --- /dev/null +++ b/Task/Hello-world-Line-printer/ERRE/hello-world-line-printer.erre @@ -0,0 +1,7 @@ +! Hello World in ERRE language +PROGRAM HELLO +BEGIN + !$REDIR + PRINT("Hello World !") + !$NOREDIR +END PROGRAM diff --git a/Task/Hello-world-Line-printer/EchoLisp/hello-world-line-printer.echolisp b/Task/Hello-world-Line-printer/EchoLisp/hello-world-line-printer.echolisp new file mode 100644 index 0000000000..481f18ae39 --- /dev/null +++ b/Task/Hello-world-Line-printer/EchoLisp/hello-world-line-printer.echolisp @@ -0,0 +1,3 @@ +(printer-font "Courier") ;; change printer font +(printer-page "ROSETTA CODE") ;; starts a new page with nice header +(printer-writeln "Hello World!") ;; prints new line (not seen on stdout) diff --git a/Task/Hello-world-Line-printer/FreeBASIC/hello-world-line-printer.freebasic b/Task/Hello-world-Line-printer/FreeBASIC/hello-world-line-printer.freebasic new file mode 100644 index 0000000000..fdb1ddf8ee --- /dev/null +++ b/Task/Hello-world-Line-printer/FreeBASIC/hello-world-line-printer.freebasic @@ -0,0 +1,5 @@ +' FB 1.05.0 Win64 + +Open Lpt "Lpt:" As #1 '' prints to default printer +Print #1, "Hello World!" +Close #1 diff --git a/Task/Hello-world-Line-printer/Harbour/hello-world-line-printer.harbour b/Task/Hello-world-Line-printer/Harbour/hello-world-line-printer.harbour new file mode 100644 index 0000000000..15743f2137 --- /dev/null +++ b/Task/Hello-world-Line-printer/Harbour/hello-world-line-printer.harbour @@ -0,0 +1,5 @@ +SET PRINT ON +SET CONSOLE OFF +? "Hello World!" +SET PRINT OFF +SET CONSOLE ON diff --git a/Task/Hello-world-Line-printer/Lasso/hello-world-line-printer.lasso b/Task/Hello-world-Line-printer/Lasso/hello-world-line-printer.lasso new file mode 100644 index 0000000000..3d9de1c5a0 --- /dev/null +++ b/Task/Hello-world-Line-printer/Lasso/hello-world-line-printer.lasso @@ -0,0 +1 @@ +File_Write: '/dev/lp0', 'Hello world', -FileOverWrite; diff --git a/Task/Hello-world-Line-printer/Nim/hello-world-line-printer.nim b/Task/Hello-world-Line-printer/Nim/hello-world-line-printer.nim new file mode 100644 index 0000000000..d675c8e627 --- /dev/null +++ b/Task/Hello-world-Line-printer/Nim/hello-world-line-printer.nim @@ -0,0 +1,3 @@ +var lp = open("/dev/lp0", fmWrite) +lp.writeln "Hello World" +lp.close() diff --git a/Task/Hello-world-Line-printer/Oforth/hello-world-line-printer.oforth b/Task/Hello-world-Line-printer/Oforth/hello-world-line-printer.oforth new file mode 100644 index 0000000000..bdd8a5e559 --- /dev/null +++ b/Task/Hello-world-Line-printer/Oforth/hello-world-line-printer.oforth @@ -0,0 +1 @@ +File new("/dev/lp0") dup open(File.WRITE) "Hello world\n" << close diff --git a/Task/Hello-world-Line-printer/Phix/hello-world-line-printer.phix b/Task/Hello-world-Line-printer/Phix/hello-world-line-printer.phix new file mode 100644 index 0000000000..39aa6903b3 --- /dev/null +++ b/Task/Hello-world-Line-printer/Phix/hello-world-line-printer.phix @@ -0,0 +1,9 @@ +integer fn = open(iff(platform()=WIN32?"PRN":"/dev/lp0"),"w") +if fn=-1 then + puts(1,"some error") +else + puts(fn,"Hello World!") + close(fn) + puts(1,"success!") +end if +{} = wait_key() diff --git a/Task/Hello-world-Line-printer/Ring/hello-world-line-printer.ring b/Task/Hello-world-Line-printer/Ring/hello-world-line-printer.ring new file mode 100644 index 0000000000..5cdd3904c4 --- /dev/null +++ b/Task/Hello-world-Line-printer/Ring/hello-world-line-printer.ring @@ -0,0 +1 @@ + lp = fopen("/dev/lp0","w") fputs(lp,"Hello world!") fclose(lp) diff --git a/Task/Hello-world-Line-printer/Sidef/hello-world-line-printer.sidef b/Task/Hello-world-Line-printer/Sidef/hello-world-line-printer.sidef new file mode 100644 index 0000000000..55376fe8b2 --- /dev/null +++ b/Task/Hello-world-Line-printer/Sidef/hello-world-line-printer.sidef @@ -0,0 +1,3 @@ +Sys.open(\var fh, '>', '/dev/lp0') + && fh.println("Hello World!") + && fh.close; diff --git a/Task/Hello-world-Line-printer/Swift/hello-world-line-printer.swift b/Task/Hello-world-Line-printer/Swift/hello-world-line-printer.swift new file mode 100644 index 0000000000..2d0cdd9be4 --- /dev/null +++ b/Task/Hello-world-Line-printer/Swift/hello-world-line-printer.swift @@ -0,0 +1,7 @@ +import Foundation + +let out = NSOutputStream(toFileAtPath: "/dev/lp0", append: true) +let data = "Hello, World!".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false) +out?.open() +out?.write(UnsafePointer(data!.bytes), maxLength: data!.length) +out?.close() diff --git a/Task/Hello-world-Newbie/Axe/hello-world-newbie.axe b/Task/Hello-world-Newbie/Axe/hello-world-newbie.axe new file mode 100644 index 0000000000..12168bd301 --- /dev/null +++ b/Task/Hello-world-Newbie/Axe/hello-world-newbie.axe @@ -0,0 +1,3 @@ +PROGRAM:MYPROGRM +:.HELLO +:Disp "HELLO, WORLD!",i diff --git a/Task/Hello-world-Newbie/EchoLisp/hello-world-newbie-1.echolisp b/Task/Hello-world-Newbie/EchoLisp/hello-world-newbie-1.echolisp new file mode 100644 index 0000000000..2272a0ba2e --- /dev/null +++ b/Task/Hello-world-Newbie/EchoLisp/hello-world-newbie-1.echolisp @@ -0,0 +1,7 @@ +;; This is a comment +;; Type in the following -uncommented- line in the input text area, and press [RETURN] +;; or click onto the "Eval" button +;; Auto-completion : You will notice that after "(di" , EchoLisp proposes "(display" : +;; Press the [TAB] key to accept + +(display "Hello, World" "color:blue") diff --git a/Task/Hello-world-Newbie/EchoLisp/hello-world-newbie-2.echolisp b/Task/Hello-world-Newbie/EchoLisp/hello-world-newbie-2.echolisp new file mode 100644 index 0000000000..6d5728deba --- /dev/null +++ b/Task/Hello-world-Newbie/EchoLisp/hello-world-newbie-2.echolisp @@ -0,0 +1,21 @@ +;; usage give the syntax(es) for a function call +;; "usage" abbreviation is "us" +(us display) → 📗 (display object css-style-string) (display object) + +;; help opens the reference manual at the right place, in a browser tab +;; "help" abbreviation is "?" +(? display) → [http://www.echolalie.org/echolisp/help.html#display] + +;; searching +;; (apropos name) displays the list of functions about 'name' +;; "apropos" abbreviation is "ap" +;; 'special' forms (you will learn that later) are flagged with 👀 +;; 1:2 is the number or arguments. min 1, max 2 +(ap list) → #(👀 for*/list:2:n 👀 for/list:2:n alist?:1 circular-list:1:n list->stack:2 + list->vector:1 list-index:2 list-ref:2 list-sort:2 list-tail:2 list:1:n list?:1 + maplist:2 set-plist!:2 stack->list:1 stream->list:1:2 string->list:1 sublist:3 + symbol-plist:1 vector->list:1 ) + +;; Or you can press the "Help" button. +;; Lost in the reference manual ? +;; Just type-in a letter, and you will go to the alphabetical index. diff --git a/Task/Hello-world-Newbie/FutureBasic/hello-world-newbie.futurebasic b/Task/Hello-world-Newbie/FutureBasic/hello-world-newbie.futurebasic new file mode 100644 index 0000000000..ee0bd75c2e --- /dev/null +++ b/Task/Hello-world-Newbie/FutureBasic/hello-world-newbie.futurebasic @@ -0,0 +1,3 @@ +include "ConsoleWindow + +print"Goodbye, World!" diff --git a/Task/Hello-world-Newbie/Monte/hello-world-newbie.monte b/Task/Hello-world-Newbie/Monte/hello-world-newbie.monte new file mode 100644 index 0000000000..ace84f6242 --- /dev/null +++ b/Task/Hello-world-Newbie/Monte/hello-world-newbie.monte @@ -0,0 +1,3 @@ +def sayHello(): + traceln("Hello World") +sayHello() diff --git a/Task/Hello-world-Newbie/Oforth/hello-world-newbie-1.oforth b/Task/Hello-world-Newbie/Oforth/hello-world-newbie-1.oforth new file mode 100644 index 0000000000..074245447f --- /dev/null +++ b/Task/Hello-world-Newbie/Oforth/hello-world-newbie-1.oforth @@ -0,0 +1 @@ +"Hello world!" println diff --git a/Task/Hello-world-Newbie/Oforth/hello-world-newbie-2.oforth b/Task/Hello-world-Newbie/Oforth/hello-world-newbie-2.oforth new file mode 100644 index 0000000000..6dc92027e3 --- /dev/null +++ b/Task/Hello-world-Newbie/Oforth/hello-world-newbie-2.oforth @@ -0,0 +1 @@ +oforth hello.of diff --git a/Task/Hello-world-Newbie/Oforth/hello-world-newbie-3.oforth b/Task/Hello-world-Newbie/Oforth/hello-world-newbie-3.oforth new file mode 100644 index 0000000000..9cfcda5154 --- /dev/null +++ b/Task/Hello-world-Newbie/Oforth/hello-world-newbie-3.oforth @@ -0,0 +1 @@ +oforth --P"\"Hello world!\n\" println" diff --git a/Task/Hello-world-Newbie/Pare/hello-world-newbie-1.pare b/Task/Hello-world-Newbie/Pare/hello-world-newbie-1.pare new file mode 100644 index 0000000000..a566b8af2a --- /dev/null +++ b/Task/Hello-world-Newbie/Pare/hello-world-newbie-1.pare @@ -0,0 +1 @@ +(print "hello world") diff --git a/Task/Hello-world-Newbie/Pare/hello-world-newbie-2.pare b/Task/Hello-world-Newbie/Pare/hello-world-newbie-2.pare new file mode 100644 index 0000000000..d326c50312 --- /dev/null +++ b/Task/Hello-world-Newbie/Pare/hello-world-newbie-2.pare @@ -0,0 +1 @@ +perl pare hello.l diff --git a/Task/Hello-world-Newbie/Ra/hello-world-newbie.ra b/Task/Hello-world-Newbie/Ra/hello-world-newbie.ra new file mode 100644 index 0000000000..9ce5a6d63a --- /dev/null +++ b/Task/Hello-world-Newbie/Ra/hello-world-newbie.ra @@ -0,0 +1,6 @@ +class HelloWorld + **Prints "Goodbye, World!"** + + on start + + print "Goodbye, World!" diff --git a/Task/Hello-world-Newbie/Ring/hello-world-newbie.ring b/Task/Hello-world-Newbie/Ring/hello-world-newbie.ring new file mode 100644 index 0000000000..eb66601739 --- /dev/null +++ b/Task/Hello-world-Newbie/Ring/hello-world-newbie.ring @@ -0,0 +1,4 @@ +sayHello() + +func sayHello + see "Hello World" + nl diff --git a/Task/Hello-world-Newbie/Robotic/hello-world-newbie.robotic b/Task/Hello-world-Newbie/Robotic/hello-world-newbie.robotic new file mode 100644 index 0000000000..d0c2499897 --- /dev/null +++ b/Task/Hello-world-Newbie/Robotic/hello-world-newbie.robotic @@ -0,0 +1,2 @@ +* "Hello world!" +end diff --git a/Task/Hello-world-Newbie/TI-83-Hex-Assembly/hello-world-newbie.ti-83 b/Task/Hello-world-Newbie/TI-83-Hex-Assembly/hello-world-newbie.ti-83 new file mode 100644 index 0000000000..2c460ec5e2 --- /dev/null +++ b/Task/Hello-world-Newbie/TI-83-Hex-Assembly/hello-world-newbie.ti-83 @@ -0,0 +1,7 @@ +PROGRAM:HELLO +:AsmPrgm +:219F9D +:EF0A45 +:EF2E45 +:C9 +:48656C6C6F2C20576F726C642100 diff --git a/Task/Hello-world-Newbie/jq/hello-world-newbie-1.jq b/Task/Hello-world-Newbie/jq/hello-world-newbie-1.jq new file mode 100644 index 0000000000..6cb970b49a --- /dev/null +++ b/Task/Hello-world-Newbie/jq/hello-world-newbie-1.jq @@ -0,0 +1,3 @@ +$ echo '"Hello world!"' | jq . + +C:\ echo "Hello world!" | jq . diff --git a/Task/Hello-world-Newbie/jq/hello-world-newbie-2.jq b/Task/Hello-world-Newbie/jq/hello-world-newbie-2.jq new file mode 100644 index 0000000000..7b4af2b562 --- /dev/null +++ b/Task/Hello-world-Newbie/jq/hello-world-newbie-2.jq @@ -0,0 +1 @@ +curl -Ss http://hello.world.com | jq . diff --git a/Task/Hello-world-Newbie/jq/hello-world-newbie-3.jq b/Task/Hello-world-Newbie/jq/hello-world-newbie-3.jq new file mode 100644 index 0000000000..8790be5592 --- /dev/null +++ b/Task/Hello-world-Newbie/jq/hello-world-newbie-3.jq @@ -0,0 +1,5 @@ +$ echo '"Hello world!"' > hello.txt +$ jq . hello.txt + +C:\ echo "Hello world!" > hello.txt +C:\ jq . hello.txt diff --git a/Task/Hello-world-Newbie/jq/hello-world-newbie-4.jq b/Task/Hello-world-Newbie/jq/hello-world-newbie-4.jq new file mode 100644 index 0000000000..97423f3bf0 --- /dev/null +++ b/Task/Hello-world-Newbie/jq/hello-world-newbie-4.jq @@ -0,0 +1,3 @@ +$ jq -n '"Hello world!"' + +C:\ jq -n "Hello world! diff --git a/Task/Hello-world-Newbie/jq/hello-world-newbie-5.jq b/Task/Hello-world-Newbie/jq/hello-world-newbie-5.jq new file mode 100644 index 0000000000..a44178db6c --- /dev/null +++ b/Task/Hello-world-Newbie/jq/hello-world-newbie-5.jq @@ -0,0 +1 @@ + jq -n -f hello.txt . diff --git a/Task/Hello-world-Newbie/jq/hello-world-newbie-6.jq b/Task/Hello-world-Newbie/jq/hello-world-newbie-6.jq new file mode 100644 index 0000000000..afc9cdffbe --- /dev/null +++ b/Task/Hello-world-Newbie/jq/hello-world-newbie-6.jq @@ -0,0 +1,7 @@ +def binary_digits: + if . == 0 then 0 + else [recurse( if . == 0 then empty else ./2 | floor end ) % 2 | tostring] + | reverse + | .[1:] # remove the leading 0 + | join("") + end ; diff --git a/Task/Hello-world-Newline-omission/Axe/hello-world-newline-omission.axe b/Task/Hello-world-Newline-omission/Axe/hello-world-newline-omission.axe new file mode 100644 index 0000000000..bf62a219b6 --- /dev/null +++ b/Task/Hello-world-Newline-omission/Axe/hello-world-newline-omission.axe @@ -0,0 +1 @@ +Disp "Goodbye, World!" diff --git a/Task/Hello-world-Newline-omission/ERRE/hello-world-newline-omission.erre b/Task/Hello-world-Newline-omission/ERRE/hello-world-newline-omission.erre new file mode 100644 index 0000000000..677197c7ab --- /dev/null +++ b/Task/Hello-world-Newline-omission/ERRE/hello-world-newline-omission.erre @@ -0,0 +1,3 @@ +....... +PRINT("Goodbye, World!";) +....... diff --git a/Task/Hello-world-Newline-omission/EchoLisp/hello-world-newline-omission.echolisp b/Task/Hello-world-Newline-omission/EchoLisp/hello-world-newline-omission.echolisp new file mode 100644 index 0000000000..c1b169ff3b --- /dev/null +++ b/Task/Hello-world-Newline-omission/EchoLisp/hello-world-newline-omission.echolisp @@ -0,0 +1,3 @@ +(begin + (write "GoodBye, World") + (write "Next on same line")) diff --git a/Task/Hello-world-Newline-omission/FOCAL/hello-world-newline-omission.focal b/Task/Hello-world-Newline-omission/FOCAL/hello-world-newline-omission.focal new file mode 100644 index 0000000000..9c5fe28844 --- /dev/null +++ b/Task/Hello-world-Newline-omission/FOCAL/hello-world-newline-omission.focal @@ -0,0 +1 @@ +TYPE "Goodbye, World!" diff --git a/Task/Hello-world-Newline-omission/FreeBASIC/hello-world-newline-omission.freebasic b/Task/Hello-world-Newline-omission/FreeBASIC/hello-world-newline-omission.freebasic new file mode 100644 index 0000000000..7c2c782e21 --- /dev/null +++ b/Task/Hello-world-Newline-omission/FreeBASIC/hello-world-newline-omission.freebasic @@ -0,0 +1,4 @@ +' FB 1.05.0 Win64 + +Print "Goodbye, World!"; '' the trailing semi-colon suppresses the new line +Sleep diff --git a/Task/Hello-world-Newline-omission/Harbour/hello-world-newline-omission.harbour b/Task/Hello-world-Newline-omission/Harbour/hello-world-newline-omission.harbour new file mode 100644 index 0000000000..cda5ee3005 --- /dev/null +++ b/Task/Hello-world-Newline-omission/Harbour/hello-world-newline-omission.harbour @@ -0,0 +1,3 @@ +?? "Goodbye, world" +or +QQout( "Goodbye, world" ) diff --git a/Task/Hello-world-Newline-omission/Jack/hello-world-newline-omission.jack b/Task/Hello-world-Newline-omission/Jack/hello-world-newline-omission.jack new file mode 100644 index 0000000000..11f175ca34 --- /dev/null +++ b/Task/Hello-world-Newline-omission/Jack/hello-world-newline-omission.jack @@ -0,0 +1,6 @@ +class Main { + function void main () { + do Output.printString("Goodbye, World!");und + return; + } +} diff --git a/Task/Hello-world-Newline-omission/LFE/hello-world-newline-omission.lfe b/Task/Hello-world-Newline-omission/LFE/hello-world-newline-omission.lfe new file mode 100644 index 0000000000..a3b8315b54 --- /dev/null +++ b/Task/Hello-world-Newline-omission/LFE/hello-world-newline-omission.lfe @@ -0,0 +1 @@ +(io:format "Goodbye, World") diff --git a/Task/Hello-world-Newline-omission/Lasso/hello-world-newline-omission.lasso b/Task/Hello-world-Newline-omission/Lasso/hello-world-newline-omission.lasso new file mode 100644 index 0000000000..5726bbb6dc --- /dev/null +++ b/Task/Hello-world-Newline-omission/Lasso/hello-world-newline-omission.lasso @@ -0,0 +1 @@ +stdout("Goodbye, World!") diff --git a/Task/Hello-world-Newline-omission/Nim/hello-world-newline-omission.nim b/Task/Hello-world-Newline-omission/Nim/hello-world-newline-omission.nim new file mode 100644 index 0000000000..48db0e1e4d --- /dev/null +++ b/Task/Hello-world-Newline-omission/Nim/hello-world-newline-omission.nim @@ -0,0 +1 @@ +stdout.write "Goodbye, World!" diff --git a/Task/Hello-world-Newline-omission/Oforth/hello-world-newline-omission.oforth b/Task/Hello-world-Newline-omission/Oforth/hello-world-newline-omission.oforth new file mode 100644 index 0000000000..26e70906de --- /dev/null +++ b/Task/Hello-world-Newline-omission/Oforth/hello-world-newline-omission.oforth @@ -0,0 +1 @@ +"Goodbye, World!" print diff --git a/Task/Hello-world-Newline-omission/PHL/hello-world-newline-omission.phl b/Task/Hello-world-Newline-omission/PHL/hello-world-newline-omission.phl new file mode 100644 index 0000000000..91acd12c36 --- /dev/null +++ b/Task/Hello-world-Newline-omission/PHL/hello-world-newline-omission.phl @@ -0,0 +1,7 @@ +module helloworld_noln; +extern printf; + +@Integer main [ + printf("Goodbye, World!"); + return 0; +] diff --git a/Task/Hello-world-Newline-omission/Phix/hello-world-newline-omission.phix b/Task/Hello-world-Newline-omission/Phix/hello-world-newline-omission.phix new file mode 100644 index 0000000000..563d809d42 --- /dev/null +++ b/Task/Hello-world-Newline-omission/Phix/hello-world-newline-omission.phix @@ -0,0 +1 @@ +puts(1,"Goodbye, World!") diff --git a/Task/Hello-world-Newline-omission/Pict/hello-world-newline-omission.pict b/Task/Hello-world-Newline-omission/Pict/hello-world-newline-omission.pict new file mode 100644 index 0000000000..700c6f9c81 --- /dev/null +++ b/Task/Hello-world-Newline-omission/Pict/hello-world-newline-omission.pict @@ -0,0 +1 @@ +(pr "Hello World!"); diff --git a/Task/Hello-world-Newline-omission/Ra/hello-world-newline-omission.ra b/Task/Hello-world-Newline-omission/Ra/hello-world-newline-omission.ra new file mode 100644 index 0000000000..4a534291e4 --- /dev/null +++ b/Task/Hello-world-Newline-omission/Ra/hello-world-newline-omission.ra @@ -0,0 +1,6 @@ +class HelloWorld + **Prints "Goodbye, World!" without a new line** + + on start + + print "Goodbye, World!" without new line diff --git a/Task/Hello-world-Newline-omission/Red/hello-world-newline-omission.red b/Task/Hello-world-Newline-omission/Red/hello-world-newline-omission.red new file mode 100644 index 0000000000..c79081c4ad --- /dev/null +++ b/Task/Hello-world-Newline-omission/Red/hello-world-newline-omission.red @@ -0,0 +1 @@ +prin "Goodbye, World!" diff --git a/Task/Hello-world-Newline-omission/Ring/hello-world-newline-omission.ring b/Task/Hello-world-Newline-omission/Ring/hello-world-newline-omission.ring new file mode 100644 index 0000000000..bf0e5c9707 --- /dev/null +++ b/Task/Hello-world-Newline-omission/Ring/hello-world-newline-omission.ring @@ -0,0 +1 @@ +see "Goodbye, World!" diff --git a/Task/Hello-world-Newline-omission/Sidef/hello-world-newline-omission-1.sidef b/Task/Hello-world-Newline-omission/Sidef/hello-world-newline-omission-1.sidef new file mode 100644 index 0000000000..06eb32599c --- /dev/null +++ b/Task/Hello-world-Newline-omission/Sidef/hello-world-newline-omission-1.sidef @@ -0,0 +1 @@ +print "Goodbye, World!"; diff --git a/Task/Hello-world-Newline-omission/Sidef/hello-world-newline-omission-2.sidef b/Task/Hello-world-Newline-omission/Sidef/hello-world-newline-omission-2.sidef new file mode 100644 index 0000000000..3a2a561af8 --- /dev/null +++ b/Task/Hello-world-Newline-omission/Sidef/hello-world-newline-omission-2.sidef @@ -0,0 +1 @@ +"%s".printf("Goodbye, World!"); diff --git a/Task/Hello-world-Newline-omission/Swift/hello-world-newline-omission-1.swift b/Task/Hello-world-Newline-omission/Swift/hello-world-newline-omission-1.swift new file mode 100644 index 0000000000..3285503661 --- /dev/null +++ b/Task/Hello-world-Newline-omission/Swift/hello-world-newline-omission-1.swift @@ -0,0 +1 @@ +print("Goodbye, World!", terminator: "") diff --git a/Task/Hello-world-Newline-omission/Swift/hello-world-newline-omission-2.swift b/Task/Hello-world-Newline-omission/Swift/hello-world-newline-omission-2.swift new file mode 100644 index 0000000000..b4f3181031 --- /dev/null +++ b/Task/Hello-world-Newline-omission/Swift/hello-world-newline-omission-2.swift @@ -0,0 +1 @@ +print("Goodbye, World!") diff --git a/Task/Hello-world-Newline-omission/Ursa/hello-world-newline-omission.ursa b/Task/Hello-world-Newline-omission/Ursa/hello-world-newline-omission.ursa new file mode 100644 index 0000000000..c89cfd3240 --- /dev/null +++ b/Task/Hello-world-Newline-omission/Ursa/hello-world-newline-omission.ursa @@ -0,0 +1 @@ +out "goodbye world!" console diff --git a/Task/Hello-world-Newline-omission/Wren/hello-world-newline-omission.wren b/Task/Hello-world-Newline-omission/Wren/hello-world-newline-omission.wren new file mode 100644 index 0000000000..84d8669a9c --- /dev/null +++ b/Task/Hello-world-Newline-omission/Wren/hello-world-newline-omission.wren @@ -0,0 +1 @@ +System.write("Goodbye, World!") diff --git a/Task/Hello-world-Newline-omission/XLISP/hello-world-newline-omission-1.xlisp b/Task/Hello-world-Newline-omission/XLISP/hello-world-newline-omission-1.xlisp new file mode 100644 index 0000000000..45077c3429 --- /dev/null +++ b/Task/Hello-world-Newline-omission/XLISP/hello-world-newline-omission-1.xlisp @@ -0,0 +1 @@ +(display "Goodbye, World!") diff --git a/Task/Hello-world-Newline-omission/XLISP/hello-world-newline-omission-2.xlisp b/Task/Hello-world-Newline-omission/XLISP/hello-world-newline-omission-2.xlisp new file mode 100644 index 0000000000..e8c634f681 --- /dev/null +++ b/Task/Hello-world-Newline-omission/XLISP/hello-world-newline-omission-2.xlisp @@ -0,0 +1 @@ +(princ "Goodbye, World!") diff --git a/Task/Hello-world-Newline-omission/jq/hello-world-newline-omission-1.jq b/Task/Hello-world-Newline-omission/jq/hello-world-newline-omission-1.jq new file mode 100644 index 0000000000..188f0a238d --- /dev/null +++ b/Task/Hello-world-Newline-omission/jq/hello-world-newline-omission-1.jq @@ -0,0 +1,2 @@ +$ jq -n -j '"Goodbye, World!"' +Goodbye, World!$ diff --git a/Task/Hello-world-Newline-omission/jq/hello-world-newline-omission-2.jq b/Task/Hello-world-Newline-omission/jq/hello-world-newline-omission-2.jq new file mode 100644 index 0000000000..1b1878f408 --- /dev/null +++ b/Task/Hello-world-Newline-omission/jq/hello-world-newline-omission-2.jq @@ -0,0 +1,2 @@ +$ echo '"Goodbye, World!"' | jq -j +Goodbye, World!$ diff --git a/Task/Hello-world-Standard-error/FreeBASIC/hello-world-standard-error.freebasic b/Task/Hello-world-Standard-error/FreeBASIC/hello-world-standard-error.freebasic new file mode 100644 index 0000000000..f62c979d77 --- /dev/null +++ b/Task/Hello-world-Standard-error/FreeBASIC/hello-world-standard-error.freebasic @@ -0,0 +1,6 @@ +' FB 1.05.0 Win64 + +Open Err As #1 +Print #1, "Goodbye World!" +Close #1 +Sleep diff --git a/Task/Hello-world-Standard-error/Lasso/hello-world-standard-error.lasso b/Task/Hello-world-Standard-error/Lasso/hello-world-standard-error.lasso new file mode 100644 index 0000000000..db554e6236 --- /dev/null +++ b/Task/Hello-world-Standard-error/Lasso/hello-world-standard-error.lasso @@ -0,0 +1,5 @@ +define stderr(s::string) => { + file_stderr->writeBytes(#s->asBytes) +} + +stderr('Goodbye, World!') diff --git a/Task/Hello-world-Standard-error/Lingo/hello-world-standard-error-1.lingo b/Task/Hello-world-Standard-error/Lingo/hello-world-standard-error-1.lingo new file mode 100644 index 0000000000..016e2a2b99 --- /dev/null +++ b/Task/Hello-world-Standard-error/Lingo/hello-world-standard-error-1.lingo @@ -0,0 +1,5 @@ +-- print to standard error +stdErr("Goodbye, World!", TRUE) + +-- print to the Windows debug console (shown in realtime e.g. in Systernal's DebugView) +dbgPrint("Goodbye, World!") diff --git a/Task/Hello-world-Standard-error/Lingo/hello-world-standard-error-2.lingo b/Task/Hello-world-Standard-error/Lingo/hello-world-standard-error-2.lingo new file mode 100644 index 0000000000..a33dd3bef4 --- /dev/null +++ b/Task/Hello-world-Standard-error/Lingo/hello-world-standard-error-2.lingo @@ -0,0 +1,7 @@ +sx = xtra("Shell").new() + +-- print to standard error +sx.shell_cmd("echo Goodbye, World!>&2") + +-- print to system.log (shown in realtime e.g. in Konsole.app) +sx.shell_cmd("logger Goodbye, World!") diff --git a/Task/Hello-world-Standard-error/Nim/hello-world-standard-error.nim b/Task/Hello-world-Standard-error/Nim/hello-world-standard-error.nim new file mode 100644 index 0000000000..9c59733cc2 --- /dev/null +++ b/Task/Hello-world-Standard-error/Nim/hello-world-standard-error.nim @@ -0,0 +1 @@ +stderr.writeln "Hello World" diff --git a/Task/Hello-world-Standard-error/Oforth/hello-world-standard-error.oforth b/Task/Hello-world-Standard-error/Oforth/hello-world-standard-error.oforth new file mode 100644 index 0000000000..18f90f03e4 --- /dev/null +++ b/Task/Hello-world-Standard-error/Oforth/hello-world-standard-error.oforth @@ -0,0 +1 @@ +System.Err "Goodbye, World!" << cr diff --git a/Task/Hello-world-Standard-error/Phix/hello-world-standard-error.phix b/Task/Hello-world-Standard-error/Phix/hello-world-standard-error.phix new file mode 100644 index 0000000000..63c99f2e39 --- /dev/null +++ b/Task/Hello-world-Standard-error/Phix/hello-world-standard-error.phix @@ -0,0 +1 @@ +puts(2,"Goodbye, World!\n") diff --git a/Task/Hello-world-Standard-error/Ra/hello-world-standard-error.ra b/Task/Hello-world-Standard-error/Ra/hello-world-standard-error.ra new file mode 100644 index 0000000000..7272ba7762 --- /dev/null +++ b/Task/Hello-world-Standard-error/Ra/hello-world-standard-error.ra @@ -0,0 +1,6 @@ +class HelloWorld + **Prints "Goodbye, World!" to standard error** + + on start + + print to Console.error made !, "Goodbye, World!" diff --git a/Task/Hello-world-Standard-error/Ring/hello-world-standard-error.ring b/Task/Hello-world-Standard-error/Ring/hello-world-standard-error.ring new file mode 100644 index 0000000000..17eb295164 --- /dev/null +++ b/Task/Hello-world-Standard-error/Ring/hello-world-standard-error.ring @@ -0,0 +1 @@ +fputs(stderr,"Goodbye, World!") diff --git a/Task/Hello-world-Standard-error/Sidef/hello-world-standard-error.sidef b/Task/Hello-world-Standard-error/Sidef/hello-world-standard-error.sidef new file mode 100644 index 0000000000..117337ad0b --- /dev/null +++ b/Task/Hello-world-Standard-error/Sidef/hello-world-standard-error.sidef @@ -0,0 +1 @@ +STDERR.println("Goodbye, World!"); diff --git a/Task/Hello-world-Standard-error/Swift/hello-world-standard-error.swift b/Task/Hello-world-Standard-error/Swift/hello-world-standard-error.swift new file mode 100644 index 0000000000..69e4e57784 --- /dev/null +++ b/Task/Hello-world-Standard-error/Swift/hello-world-standard-error.swift @@ -0,0 +1,11 @@ +import Foundation + +let out = NSOutputStream(toFileAtPath: "/dev/stderr", append: true) +let err = "Goodbye, World!".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false) +out?.open() +let success = out?.write(UnsafePointer(err!.bytes), maxLength: err!.length) +out?.close() + +if let bytes = success { + println("\nWrote \(bytes) bytes") +} diff --git a/Task/Hello-world-Standard-error/Ursa/hello-world-standard-error.ursa b/Task/Hello-world-Standard-error/Ursa/hello-world-standard-error.ursa new file mode 100644 index 0000000000..918638c614 --- /dev/null +++ b/Task/Hello-world-Standard-error/Ursa/hello-world-standard-error.ursa @@ -0,0 +1 @@ +out "goodbye, world!" endl console.err diff --git a/Task/Hello-world-Standard-error/XLISP/hello-world-standard-error.xlisp b/Task/Hello-world-Standard-error/XLISP/hello-world-standard-error.xlisp new file mode 100644 index 0000000000..bfda8ff87c --- /dev/null +++ b/Task/Hello-world-Standard-error/XLISP/hello-world-standard-error.xlisp @@ -0,0 +1 @@ +(DISPLAY "Goodbye, World!" *ERROR-OUTPUT*) diff --git a/Task/Hello-world-Standard-error/jq/hello-world-standard-error.jq b/Task/Hello-world-Standard-error/jq/hello-world-standard-error.jq new file mode 100644 index 0000000000..728aca0368 --- /dev/null +++ b/Task/Hello-world-Standard-error/jq/hello-world-standard-error.jq @@ -0,0 +1 @@ +error("Goodbye, World!") diff --git a/Task/Hello-world-Text/8th/hello-world-text.8th b/Task/Hello-world-Text/8th/hello-world-text.8th new file mode 100644 index 0000000000..9768d0939a --- /dev/null +++ b/Task/Hello-world-Text/8th/hello-world-text.8th @@ -0,0 +1 @@ +"Hello world!\n" . bye diff --git a/Task/Hello-world-Text/AntLang/hello-world-text.antlang b/Task/Hello-world-Text/AntLang/hello-world-text.antlang new file mode 100644 index 0000000000..4e80667d9e --- /dev/null +++ b/Task/Hello-world-Text/AntLang/hello-world-text.antlang @@ -0,0 +1 @@ +echo["Hello, World!"] diff --git a/Task/Hello-world-Text/Apricot/hello-world-text.apricot b/Task/Hello-world-Text/Apricot/hello-world-text.apricot new file mode 100644 index 0000000000..9699323f34 --- /dev/null +++ b/Task/Hello-world-Text/Apricot/hello-world-text.apricot @@ -0,0 +1 @@ +(puts "Hello world!") diff --git a/Task/Hello-world-Text/AutoLISP/hello-world-text.autolisp b/Task/Hello-world-Text/AutoLISP/hello-world-text.autolisp new file mode 100644 index 0000000000..6de21c351d --- /dev/null +++ b/Task/Hello-world-Text/AutoLISP/hello-world-text.autolisp @@ -0,0 +1 @@ +(printc "Hello World!") diff --git a/Task/Hello-world-Text/Axe/hello-world-text.axe b/Task/Hello-world-Text/Axe/hello-world-text.axe new file mode 100644 index 0000000000..e8a4691a38 --- /dev/null +++ b/Task/Hello-world-Text/Axe/hello-world-text.axe @@ -0,0 +1 @@ +Disp "Hello world!",i diff --git a/Task/Hello-world-Text/BML/hello-world-text.bml b/Task/Hello-world-Text/BML/hello-world-text.bml new file mode 100644 index 0000000000..74b23f46df --- /dev/null +++ b/Task/Hello-world-Text/BML/hello-world-text.bml @@ -0,0 +1 @@ +display "Hello world!" diff --git a/Task/Hello-world-Text/Battlestar/hello-world-text.battlestar b/Task/Hello-world-Text/Battlestar/hello-world-text.battlestar new file mode 100644 index 0000000000..07c5e776ff --- /dev/null +++ b/Task/Hello-world-Text/Battlestar/hello-world-text.battlestar @@ -0,0 +1,3 @@ +const hello = "Hello world!\n" + +print(hello) diff --git a/Task/Hello-world-Text/ChucK/hello-world-text.chuck b/Task/Hello-world-Text/ChucK/hello-world-text.chuck new file mode 100644 index 0000000000..e89f899149 --- /dev/null +++ b/Task/Hello-world-Text/ChucK/hello-world-text.chuck @@ -0,0 +1 @@ +<<< "Hello world!">>>; diff --git a/Task/Hello-world-Text/Comal/hello-world-text.comal b/Task/Hello-world-Text/Comal/hello-world-text.comal new file mode 100644 index 0000000000..386f4e4cc6 --- /dev/null +++ b/Task/Hello-world-Text/Comal/hello-world-text.comal @@ -0,0 +1 @@ +PRINT "Hello world!" diff --git a/Task/Hello-world-Text/Crystal/hello-world-text.crystal b/Task/Hello-world-Text/Crystal/hello-world-text.crystal new file mode 100644 index 0000000000..08b85bf458 --- /dev/null +++ b/Task/Hello-world-Text/Crystal/hello-world-text.crystal @@ -0,0 +1 @@ +puts "Hello world!" diff --git a/Task/Hello-world-Text/DDNC/hello-world-text.ddnc b/Task/Hello-world-Text/DDNC/hello-world-text.ddnc new file mode 100644 index 0000000000..2283948546 --- /dev/null +++ b/Task/Hello-world-Text/DDNC/hello-world-text.ddnc @@ -0,0 +1,29 @@ +0 111 10 +0 15 11 +0 15 12 +0 31 13 +0 47 14 +0 59 15 +0 125 16 +0 3 17 +0 0 18 +0 63 19 +0 15 20 +0 12 21 +0 36 22 +0 31 23 +0 17 24 + +0 500 3 +0 10 2 +0 15 5 + +60 4 +2 2 1 +80 1 +72 3 +30 2 +31 5 +62 5 +61 4 +64 diff --git a/Task/Hello-world-Text/DIV-Games-Studio/hello-world-text.div b/Task/Hello-world-Text/DIV-Games-Studio/hello-world-text.div new file mode 100644 index 0000000000..9f8ba9dc4f --- /dev/null +++ b/Task/Hello-world-Text/DIV-Games-Studio/hello-world-text.div @@ -0,0 +1,9 @@ +PROGRAM HELLOWORLD; + +BEGIN + + WRITE_TEXT(0,160,100,4,"HELLO WORLD!"); + LOOP + FRAME; + END +END diff --git a/Task/Hello-world-Text/ECL/hello-world-text.ecl b/Task/Hello-world-Text/ECL/hello-world-text.ecl new file mode 100644 index 0000000000..7d1a36ac37 --- /dev/null +++ b/Task/Hello-world-Text/ECL/hello-world-text.ecl @@ -0,0 +1 @@ +OUTPUT('Hello world!'); diff --git a/Task/Hello-world-Text/EDSAC-order-code/hello-world-text.edsac b/Task/Hello-world-Text/EDSAC-order-code/hello-world-text.edsac new file mode 100644 index 0000000000..a501ea5d62 --- /dev/null +++ b/Task/Hello-world-Text/EDSAC-order-code/hello-world-text.edsac @@ -0,0 +1,33 @@ +[ Print HELLO WORLD ] +[ A program for the EDSAC ] +[ Works with Initial Orders 2 ] + +T64K [ Set load point: address 64 ] +GK [ Set base address ] +O13@ [ Each O order outputs one ] +O14@ [ character. The numerical ] +O15@ [ parameter gives the offset ] +O16@ [ (from the base address) where ] +O17@ [ the character to print is ] +O18@ [ stored ] +O19@ +O20@ +O21@ +O22@ +O23@ +O24@ +ZF [ Stop ] +*F [ Shift to print letters ] +HF [ Character literals ] +EF +LF +LF +OF +!F [ Space character ] +WF +OF +RF +LF +DF +EZPF [ Start program beginning at + the load point ] diff --git a/Task/Hello-world-Text/ERRE/hello-world-text.erre b/Task/Hello-world-Text/ERRE/hello-world-text.erre new file mode 100644 index 0000000000..4b56548e73 --- /dev/null +++ b/Task/Hello-world-Text/ERRE/hello-world-text.erre @@ -0,0 +1,5 @@ +! Hello World in ERRE language +PROGRAM HELLO +BEGIN + PRINT("Hello world!") +END PROGRAM diff --git a/Task/Hello-world-Text/EchoLisp/hello-world-text.echolisp b/Task/Hello-world-Text/EchoLisp/hello-world-text.echolisp new file mode 100644 index 0000000000..ac87232e62 --- /dev/null +++ b/Task/Hello-world-Text/EchoLisp/hello-world-text.echolisp @@ -0,0 +1 @@ +(display "Hello world!" "color:blue") diff --git a/Task/Hello-world-Text/Egison/hello-world-text.egison b/Task/Hello-world-Text/Egison/hello-world-text.egison new file mode 100644 index 0000000000..c12b260032 --- /dev/null +++ b/Task/Hello-world-Text/Egison/hello-world-text.egison @@ -0,0 +1,3 @@ +(define $main + (lambda [$argv] + (write-string "Hello world!\n"))) diff --git a/Task/Hello-world-Text/Elm/hello-world-text.elm b/Task/Hello-world-Text/Elm/hello-world-text.elm new file mode 100644 index 0000000000..e7ef07fbca --- /dev/null +++ b/Task/Hello-world-Text/Elm/hello-world-text.elm @@ -0,0 +1 @@ +main = text "Goodbye World!" diff --git a/Task/Hello-world-Text/FOCAL/hello-world-text.focal b/Task/Hello-world-Text/FOCAL/hello-world-text.focal new file mode 100644 index 0000000000..f95a88075c --- /dev/null +++ b/Task/Hello-world-Text/FOCAL/hello-world-text.focal @@ -0,0 +1 @@ +TYPE "Hello, world" ! diff --git a/Task/Hello-world-Text/FUZE-BASIC/hello-world-text.fuze b/Task/Hello-world-Text/FUZE-BASIC/hello-world-text.fuze new file mode 100644 index 0000000000..386f4e4cc6 --- /dev/null +++ b/Task/Hello-world-Text/FUZE-BASIC/hello-world-text.fuze @@ -0,0 +1 @@ +PRINT "Hello world!" diff --git a/Task/Hello-world-Text/FreeBASIC/hello-world-text.freebasic b/Task/Hello-world-Text/FreeBASIC/hello-world-text.freebasic new file mode 100644 index 0000000000..5c68c94fb3 --- /dev/null +++ b/Task/Hello-world-Text/FreeBASIC/hello-world-text.freebasic @@ -0,0 +1,16 @@ +'FreeBASIC Hello-fb0.bas May 2015 +' +Screen 0 'open text window +Print "Hello world" + +Print "Enter any key to go the graphics screen" +sleep + +screen 18 'Screen 18 Resolution 640x480 with at least 256 colors +locate 10,10 +Print "Hello world!" + +locate 20,10 +Print "Enter any key to exit" +sleep +End diff --git a/Task/Hello-world-Text/FunL/hello-world-text.funl b/Task/Hello-world-Text/FunL/hello-world-text.funl new file mode 100644 index 0000000000..45518562c1 --- /dev/null +++ b/Task/Hello-world-Text/FunL/hello-world-text.funl @@ -0,0 +1 @@ +println( 'Hello world!' ) diff --git a/Task/Hello-world-Text/GFA-Basic/hello-world-text.gfa b/Task/Hello-world-Text/GFA-Basic/hello-world-text.gfa new file mode 100644 index 0000000000..9e5807f8b1 --- /dev/null +++ b/Task/Hello-world-Text/GFA-Basic/hello-world-text.gfa @@ -0,0 +1 @@ +PRINT "Hello World" diff --git a/Task/Hello-world-Text/HPPPL/hello-world-text.hpppl b/Task/Hello-world-Text/HPPPL/hello-world-text.hpppl new file mode 100644 index 0000000000..eb5a42f18e --- /dev/null +++ b/Task/Hello-world-Text/HPPPL/hello-world-text.hpppl @@ -0,0 +1 @@ +PRINT("Hello world!"); diff --git a/Task/Hello-world-Text/Hack/hello-world-text.hack b/Task/Hello-world-Text/Hack/hello-world-text.hack new file mode 100644 index 0000000000..b6bb264609 --- /dev/null +++ b/Task/Hello-world-Text/Hack/hello-world-text.hack @@ -0,0 +1 @@ + diff --git a/Task/Hello-world-Text/Harbour/hello-world-text.harbour b/Task/Hello-world-Text/Harbour/hello-world-text.harbour new file mode 100644 index 0000000000..4e54ed208b --- /dev/null +++ b/Task/Hello-world-Text/Harbour/hello-world-text.harbour @@ -0,0 +1 @@ +? "Hello world!" diff --git a/Task/Hello-world-Text/Hoon/hello-world-text.hoon b/Task/Hello-world-Text/Hoon/hello-world-text.hoon new file mode 100644 index 0000000000..7ec8885a73 --- /dev/null +++ b/Task/Hello-world-Text/Hoon/hello-world-text.hoon @@ -0,0 +1 @@ +~& "Hello world!" ~ diff --git a/Task/Hello-world-Text/Hy/hello-world-text.hy b/Task/Hello-world-Text/Hy/hello-world-text.hy new file mode 100644 index 0000000000..d441299f14 --- /dev/null +++ b/Task/Hello-world-Text/Hy/hello-world-text.hy @@ -0,0 +1 @@ +(print "Hello world!") diff --git a/Task/Hello-world-Text/I/hello-world-text.i b/Task/Hello-world-Text/I/hello-world-text.i new file mode 100644 index 0000000000..716ca6122c --- /dev/null +++ b/Task/Hello-world-Text/I/hello-world-text.i @@ -0,0 +1,3 @@ +software { + print("Hello World!") +} diff --git a/Task/Hello-world-Text/Jack/hello-world-text.jack b/Task/Hello-world-Text/Jack/hello-world-text.jack new file mode 100644 index 0000000000..d7331f9695 --- /dev/null +++ b/Task/Hello-world-Text/Jack/hello-world-text.jack @@ -0,0 +1,7 @@ +class Main { + function void main () { + do Output.printString("Hello world!"); + do Output.println(); + return; + } +} diff --git a/Task/Hello-world-Text/Kitten/hello-world-text.kitten b/Task/Hello-world-Text/Kitten/hello-world-text.kitten new file mode 100644 index 0000000000..5ae566045f --- /dev/null +++ b/Task/Hello-world-Text/Kitten/hello-world-text.kitten @@ -0,0 +1 @@ +"Hello world!" say diff --git a/Task/Hello-world-Text/LC3-Assembly/hello-world-text-1.lc3 b/Task/Hello-world-Text/LC3-Assembly/hello-world-text-1.lc3 new file mode 100644 index 0000000000..cacd644488 --- /dev/null +++ b/Task/Hello-world-Text/LC3-Assembly/hello-world-text-1.lc3 @@ -0,0 +1,6 @@ +.orig x3000 +LEA R0, hello ; R0 = &hello +TRAP x22 ; PUTS (print char array at addr in R0) +HALT +hello .stringz "Hello World!" +.end diff --git a/Task/Hello-world-Text/LC3-Assembly/hello-world-text-2.lc3 b/Task/Hello-world-Text/LC3-Assembly/hello-world-text-2.lc3 new file mode 100644 index 0000000000..279611d9ab --- /dev/null +++ b/Task/Hello-world-Text/LC3-Assembly/hello-world-text-2.lc3 @@ -0,0 +1,10 @@ +.orig x3000 +LEA R1, hello ; R1 = &hello +TOP LDR R0, R1, #0 ; R0 = R1[0] +BRz END ; if R0 is string terminator (x0000) go to END +TRAP x21 ; else OUT (write char in R0) +ADD R1, R1, #1 ; increment R1 +BR TOP ; go to TOP +END HALT +hello .stringz "Hello World!" +.end diff --git a/Task/Hello-world-Text/LFE/hello-world-text.lfe b/Task/Hello-world-Text/LFE/hello-world-text.lfe new file mode 100644 index 0000000000..c5e4f80c34 --- /dev/null +++ b/Task/Hello-world-Text/LFE/hello-world-text.lfe @@ -0,0 +1 @@ +(: io format '"Hello world!~n") diff --git a/Task/Hello-world-Text/Lasso/hello-world-text.lasso b/Task/Hello-world-Text/Lasso/hello-world-text.lasso new file mode 100644 index 0000000000..adb9840044 --- /dev/null +++ b/Task/Hello-world-Text/Lasso/hello-world-text.lasso @@ -0,0 +1 @@ +'Hello world!' diff --git a/Task/Hello-world-Text/Lily/hello-world-text-1.lily b/Task/Hello-world-Text/Lily/hello-world-text-1.lily new file mode 100644 index 0000000000..f1a18139c8 --- /dev/null +++ b/Task/Hello-world-Text/Lily/hello-world-text-1.lily @@ -0,0 +1 @@ +print("Hello world!") diff --git a/Task/Hello-world-Text/Lily/hello-world-text-2.lily b/Task/Hello-world-Text/Lily/hello-world-text-2.lily new file mode 100644 index 0000000000..38b8c817a8 --- /dev/null +++ b/Task/Hello-world-Text/Lily/hello-world-text-2.lily @@ -0,0 +1 @@ +stdout.print("Hello world!\n") diff --git a/Task/Hello-world-Text/Lingo/hello-world-text-1.lingo b/Task/Hello-world-Text/Lingo/hello-world-text-1.lingo new file mode 100644 index 0000000000..e098dc6705 --- /dev/null +++ b/Task/Hello-world-Text/Lingo/hello-world-text-1.lingo @@ -0,0 +1 @@ +put "Hello world!" diff --git a/Task/Hello-world-Text/Lingo/hello-world-text-2.lingo b/Task/Hello-world-Text/Lingo/hello-world-text-2.lingo new file mode 100644 index 0000000000..863336cdec --- /dev/null +++ b/Task/Hello-world-Text/Lingo/hello-world-text-2.lingo @@ -0,0 +1 @@ +trace("Hello world!") diff --git a/Task/Hello-world-Text/LiveCode/hello-world-text-1.livecode b/Task/Hello-world-Text/LiveCode/hello-world-text-1.livecode new file mode 100644 index 0000000000..2fafb14d32 --- /dev/null +++ b/Task/Hello-world-Text/LiveCode/hello-world-text-1.livecode @@ -0,0 +1,3 @@ +#! /usr/local/bin/livecode-server +set the outputLineEndings to "lf" +put "Hello world!" & return diff --git a/Task/Hello-world-Text/LiveCode/hello-world-text-2.livecode b/Task/Hello-world-Text/LiveCode/hello-world-text-2.livecode new file mode 100644 index 0000000000..c4991de102 --- /dev/null +++ b/Task/Hello-world-Text/LiveCode/hello-world-text-2.livecode @@ -0,0 +1 @@ +write "Hello world!" & return to stdout diff --git a/Task/Hello-world-Text/Lobster/hello-world-text.lobster b/Task/Hello-world-Text/Lobster/hello-world-text.lobster new file mode 100644 index 0000000000..ed708ec5fb --- /dev/null +++ b/Task/Hello-world-Text/Lobster/hello-world-text.lobster @@ -0,0 +1 @@ +print "Hello world!" diff --git a/Task/Hello-world-Text/Malbolge/hello-world-text-1.malbolge b/Task/Hello-world-Text/Malbolge/hello-world-text-1.malbolge new file mode 100644 index 0000000000..fdd5ea0be9 --- /dev/null +++ b/Task/Hello-world-Text/Malbolge/hello-world-text-1.malbolge @@ -0,0 +1,2 @@ +('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}= diff --git a/Task/Hello-world-Text/Malbolge/hello-world-text-2.malbolge b/Task/Hello-world-Text/Malbolge/hello-world-text-2.malbolge new file mode 100644 index 0000000000..cfa8f2aa1b --- /dev/null +++ b/Task/Hello-world-Text/Malbolge/hello-world-text-2.malbolge @@ -0,0 +1 @@ +(=<`#9]~6ZY32Vx/4Rs+0No-&Jk)"Fh}|Bcy?`=*z]Kw%oG4UUS0/@-ejc(:'8dc diff --git a/Task/Hello-world-Text/Maude/hello-world-text.maude b/Task/Hello-world-Text/Maude/hello-world-text.maude new file mode 100644 index 0000000000..1317214b08 --- /dev/null +++ b/Task/Hello-world-Text/Maude/hello-world-text.maude @@ -0,0 +1,11 @@ +fmod BYE-WORLD is + + protecting STRING . + + op sayBye : -> String . + + eq sayBye = "Hello world!" . + +endfm + +red sayBye . diff --git a/Task/Hello-world-Text/Morfa/hello-world-text.morfa b/Task/Hello-world-Text/Morfa/hello-world-text.morfa new file mode 100644 index 0000000000..a3173ed819 --- /dev/null +++ b/Task/Hello-world-Text/Morfa/hello-world-text.morfa @@ -0,0 +1,5 @@ +import morfa.io.print; +func main(): void +{ + println("Hello world!"); +} diff --git a/Task/Hello-world-Text/MyrtleScript/hello-world-text.myrtle b/Task/Hello-world-Text/MyrtleScript/hello-world-text.myrtle new file mode 100644 index 0000000000..4560535edf --- /dev/null +++ b/Task/Hello-world-Text/MyrtleScript/hello-world-text.myrtle @@ -0,0 +1,5 @@ +script HelloWorld { + func main returns: int { + print("Hello World!") + } +} diff --git a/Task/Hello-world-Text/Nim/hello-world-text.nim b/Task/Hello-world-Text/Nim/hello-world-text.nim new file mode 100644 index 0000000000..1460bc2a01 --- /dev/null +++ b/Task/Hello-world-Text/Nim/hello-world-text.nim @@ -0,0 +1 @@ +echo("Hello world!") diff --git a/Task/Hello-world-Text/Nit/hello-world-text.nit b/Task/Hello-world-Text/Nit/hello-world-text.nit new file mode 100644 index 0000000000..ed708ec5fb --- /dev/null +++ b/Task/Hello-world-Text/Nit/hello-world-text.nit @@ -0,0 +1 @@ +print "Hello world!" diff --git a/Task/Hello-world-Text/Oforth/hello-world-text.oforth b/Task/Hello-world-Text/Oforth/hello-world-text.oforth new file mode 100644 index 0000000000..074245447f --- /dev/null +++ b/Task/Hello-world-Text/Oforth/hello-world-text.oforth @@ -0,0 +1 @@ +"Hello world!" println diff --git a/Task/Hello-world-Text/OpenLisp/hello-world-text.openlisp b/Task/Hello-world-Text/OpenLisp/hello-world-text.openlisp new file mode 100644 index 0000000000..675edcf998 --- /dev/null +++ b/Task/Hello-world-Text/OpenLisp/hello-world-text.openlisp @@ -0,0 +1,3 @@ +#!/openlisp/uxlisp -shell +(format t "Hello world!~%") +(print "Hello world!") diff --git a/Task/Hello-world-Text/PHL/hello-world-text.phl b/Task/Hello-world-Text/PHL/hello-world-text.phl new file mode 100644 index 0000000000..23e6561b81 --- /dev/null +++ b/Task/Hello-world-Text/PHL/hello-world-text.phl @@ -0,0 +1,7 @@ +module helloworld; +extern printf; + +@Integer main [ + printf("Hello world!"); + return 0; +] diff --git a/Task/Hello-world-Text/Phix/hello-world-text.phix b/Task/Hello-world-Text/Phix/hello-world-text.phix new file mode 100644 index 0000000000..99c2263e7c --- /dev/null +++ b/Task/Hello-world-Text/Phix/hello-world-text.phix @@ -0,0 +1 @@ +puts(1,"Hello world!") diff --git a/Task/Hello-world-Text/Pict/hello-world-text-1.pict b/Task/Hello-world-Text/Pict/hello-world-text-1.pict new file mode 100644 index 0000000000..6c7a0bddfe --- /dev/null +++ b/Task/Hello-world-Text/Pict/hello-world-text-1.pict @@ -0,0 +1 @@ +(prNL "Hello World!"); diff --git a/Task/Hello-world-Text/Pict/hello-world-text-2.pict b/Task/Hello-world-Text/Pict/hello-world-text-2.pict new file mode 100644 index 0000000000..dd859241c5 --- /dev/null +++ b/Task/Hello-world-Text/Pict/hello-world-text-2.pict @@ -0,0 +1,3 @@ +new done: ^[] +run ( prNL!["Hello World!" (rchan done)] + | done?_ = () ) diff --git a/Task/Hello-world-Text/Pony/hello-world-text.pony b/Task/Hello-world-Text/Pony/hello-world-text.pony new file mode 100644 index 0000000000..581d78cef5 --- /dev/null +++ b/Task/Hello-world-Text/Pony/hello-world-text.pony @@ -0,0 +1,3 @@ +actor Main + new create(env: Env) => + env.out.print("Hello world!") diff --git a/Task/Hello-world-Text/Potion/hello-world-text.potion b/Task/Hello-world-Text/Potion/hello-world-text.potion new file mode 100644 index 0000000000..8d765f1cb7 --- /dev/null +++ b/Task/Hello-world-Text/Potion/hello-world-text.potion @@ -0,0 +1 @@ +"Hello world!\n" print diff --git a/Task/Hello-world-Text/Ra/hello-world-text.ra b/Task/Hello-world-Text/Ra/hello-world-text.ra new file mode 100644 index 0000000000..9e0420984d --- /dev/null +++ b/Task/Hello-world-Text/Ra/hello-world-text.ra @@ -0,0 +1,6 @@ +class HelloWorld + **Prints "Hello world!"** + + on start + + print "Hello world!" diff --git a/Task/Hello-world-Text/Ring/hello-world-text.ring b/Task/Hello-world-Text/Ring/hello-world-text.ring new file mode 100644 index 0000000000..0c04155d8a --- /dev/null +++ b/Task/Hello-world-Text/Ring/hello-world-text.ring @@ -0,0 +1 @@ +See "Hello world!" diff --git a/Task/Hello-world-Text/Set-lang/hello-world-text.set b/Task/Hello-world-Text/Set-lang/hello-world-text.set new file mode 100644 index 0000000000..d0cbf965d8 --- /dev/null +++ b/Task/Hello-world-Text/Set-lang/hello-world-text.set @@ -0,0 +1,12 @@ +set ! H +set ! E +set ! L +set ! L +set ! O +set ! 32 +set ! W +set ! O +set ! R +set ! L +set ! D +set ! 33 diff --git a/Task/Hello-world-Text/Shen/hello-world-text.shen b/Task/Hello-world-Text/Shen/hello-world-text.shen new file mode 100644 index 0000000000..822dd1fd7b --- /dev/null +++ b/Task/Hello-world-Text/Shen/hello-world-text.shen @@ -0,0 +1 @@ +(output "Hello world!~%") diff --git a/Task/Hello-world-Text/Sidef/hello-world-text.sidef b/Task/Hello-world-Text/Sidef/hello-world-text.sidef new file mode 100644 index 0000000000..0fae49d8d0 --- /dev/null +++ b/Task/Hello-world-Text/Sidef/hello-world-text.sidef @@ -0,0 +1 @@ +„Hello world!”.say; diff --git a/Task/Hello-world-Text/SkookumScript/hello-world-text-1.skookum b/Task/Hello-world-Text/SkookumScript/hello-world-text-1.skookum new file mode 100644 index 0000000000..f1a18139c8 --- /dev/null +++ b/Task/Hello-world-Text/SkookumScript/hello-world-text-1.skookum @@ -0,0 +1 @@ +print("Hello world!") diff --git a/Task/Hello-world-Text/SkookumScript/hello-world-text-2.skookum b/Task/Hello-world-Text/SkookumScript/hello-world-text-2.skookum new file mode 100644 index 0000000000..6ccebb9abe --- /dev/null +++ b/Task/Hello-world-Text/SkookumScript/hello-world-text-2.skookum @@ -0,0 +1 @@ +"Hello world!" diff --git a/Task/Hello-world-Text/SmileBASIC/hello-world-text.smilebasic b/Task/Hello-world-Text/SmileBASIC/hello-world-text.smilebasic new file mode 100644 index 0000000000..386f4e4cc6 --- /dev/null +++ b/Task/Hello-world-Text/SmileBASIC/hello-world-text.smilebasic @@ -0,0 +1 @@ +PRINT "Hello world!" diff --git a/Task/Hello-world-Text/SoneKing-Assembly/hello-world-text.soneking b/Task/Hello-world-Text/SoneKing-Assembly/hello-world-text.soneking new file mode 100644 index 0000000000..a34ff0feea --- /dev/null +++ b/Task/Hello-world-Text/SoneKing-Assembly/hello-world-text.soneking @@ -0,0 +1,8 @@ +extern print + +dv Msg Goodbye,World! + +mov eax Msg +push +call print +pop diff --git a/Task/Hello-world-Text/Sparkling/hello-world-text.sparkling b/Task/Hello-world-Text/Sparkling/hello-world-text.sparkling new file mode 100644 index 0000000000..defc677327 --- /dev/null +++ b/Task/Hello-world-Text/Sparkling/hello-world-text.sparkling @@ -0,0 +1 @@ +print("Hello world!"); diff --git a/Task/Hello-world-Text/Swift/hello-world-text-1.swift b/Task/Hello-world-Text/Swift/hello-world-text-1.swift new file mode 100644 index 0000000000..f1a18139c8 --- /dev/null +++ b/Task/Hello-world-Text/Swift/hello-world-text-1.swift @@ -0,0 +1 @@ +print("Hello world!") diff --git a/Task/Hello-world-Text/Swift/hello-world-text-2.swift b/Task/Hello-world-Text/Swift/hello-world-text-2.swift new file mode 100644 index 0000000000..50095f70c5 --- /dev/null +++ b/Task/Hello-world-Text/Swift/hello-world-text-2.swift @@ -0,0 +1 @@ +println("Hello world!") diff --git a/Task/Hello-world-Text/Symsyn/hello-world-text.symsyn b/Task/Hello-world-Text/Symsyn/hello-world-text.symsyn new file mode 100644 index 0000000000..ed6bd8c9ad --- /dev/null +++ b/Task/Hello-world-Text/Symsyn/hello-world-text.symsyn @@ -0,0 +1 @@ + 'hello world' [] diff --git a/Task/Hello-world-Text/Terra/hello-world-text.terra b/Task/Hello-world-Text/Terra/hello-world-text.terra new file mode 100644 index 0000000000..ac7392d989 --- /dev/null +++ b/Task/Hello-world-Text/Terra/hello-world-text.terra @@ -0,0 +1,6 @@ +C = terralib.includec("stdio.h") + +terra hello(argc : int, argv : &rawstring) + C.printf("Hello world!\n") + return 0 +end diff --git a/Task/Hello-world-Text/TestML/hello-world-text.testml b/Task/Hello-world-Text/TestML/hello-world-text.testml new file mode 100644 index 0000000000..a735c67cda --- /dev/null +++ b/Task/Hello-world-Text/TestML/hello-world-text.testml @@ -0,0 +1,2 @@ +%TestML 0.1.0 +Print("Hello world!") diff --git a/Task/Hello-world-Text/Uniface/hello-world-text.uniface b/Task/Hello-world-Text/Uniface/hello-world-text.uniface new file mode 100644 index 0000000000..4f70f4e14d --- /dev/null +++ b/Task/Hello-world-Text/Uniface/hello-world-text.uniface @@ -0,0 +1 @@ +message "Hello world!" diff --git a/Task/Hello-world-Text/Ursa/hello-world-text.ursa b/Task/Hello-world-Text/Ursa/hello-world-text.ursa new file mode 100644 index 0000000000..aaef1ee0d7 --- /dev/null +++ b/Task/Hello-world-Text/Ursa/hello-world-text.ursa @@ -0,0 +1 @@ +out "hello world!" endl console diff --git a/Task/Hello-world-Text/Wart/hello-world-text.wart b/Task/Hello-world-Text/Wart/hello-world-text.wart new file mode 100644 index 0000000000..572413a59c --- /dev/null +++ b/Task/Hello-world-Text/Wart/hello-world-text.wart @@ -0,0 +1 @@ +prn "Hello world!" diff --git a/Task/Hello-world-Text/Wolfram-Language/hello-world-text.wolfram b/Task/Hello-world-Text/Wolfram-Language/hello-world-text.wolfram new file mode 100644 index 0000000000..5c09770df6 --- /dev/null +++ b/Task/Hello-world-Text/Wolfram-Language/hello-world-text.wolfram @@ -0,0 +1 @@ +Print["Hello world!"] diff --git a/Task/Hello-world-Text/Wren/hello-world-text.wren b/Task/Hello-world-Text/Wren/hello-world-text.wren new file mode 100644 index 0000000000..08cf1b3d28 --- /dev/null +++ b/Task/Hello-world-Text/Wren/hello-world-text.wren @@ -0,0 +1 @@ +System.print("Hello world!") diff --git a/Task/Hello-world-Text/XLISP/hello-world-text.xlisp b/Task/Hello-world-Text/XLISP/hello-world-text.xlisp new file mode 100644 index 0000000000..1e6ad14974 --- /dev/null +++ b/Task/Hello-world-Text/XLISP/hello-world-text.xlisp @@ -0,0 +1,2 @@ +(DISPLAY "Hello world!") +(NEWLINE) diff --git a/Task/Hello-world-Text/jq/hello-world-text.jq b/Task/Hello-world-Text/jq/hello-world-text.jq new file mode 100644 index 0000000000..6ccebb9abe --- /dev/null +++ b/Task/Hello-world-Text/jq/hello-world-text.jq @@ -0,0 +1 @@ +"Hello world!" diff --git a/Task/Hello-world-Web-server/AntLang/hello-world-web-server-1.antlang b/Task/Hello-world-Web-server/AntLang/hello-world-web-server-1.antlang new file mode 100644 index 0000000000..fd1e454b5d --- /dev/null +++ b/Task/Hello-world-Web-server/AntLang/hello-world-web-server-1.antlang @@ -0,0 +1 @@ +serv: httprun[8080; {"HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n\r\nGoodbye, World!"}] diff --git a/Task/Hello-world-Web-server/AntLang/hello-world-web-server-2.antlang b/Task/Hello-world-Web-server/AntLang/hello-world-web-server-2.antlang new file mode 100644 index 0000000000..f3d4f7c494 --- /dev/null +++ b/Task/Hello-world-Web-server/AntLang/hello-world-web-server-2.antlang @@ -0,0 +1,2 @@ +load["handlers.ant"] +serv: httprun[8080; {httpwrap["Goodbye, World!"]}] diff --git a/Task/Hello-world-Web-server/AntLang/hello-world-web-server-3.antlang b/Task/Hello-world-Web-server/AntLang/hello-world-web-server-3.antlang new file mode 100644 index 0000000000..6b21b1c8f1 --- /dev/null +++ b/Task/Hello-world-Web-server/AntLang/hello-world-web-server-3.antlang @@ -0,0 +1 @@ +kill[serv] diff --git a/Task/Hello-world-Web-server/FunL/hello-world-web-server.funl b/Task/Hello-world-Web-server/FunL/hello-world-web-server.funl new file mode 100644 index 0000000000..5d6d7cfc7d --- /dev/null +++ b/Task/Hello-world-Web-server/FunL/hello-world-web-server.funl @@ -0,0 +1,13 @@ +native java.io.PrintWriter +native java.net.ServerSocket + +val port = 8080 +val listener = ServerSocket( port ) + +printf( 'Listening at port %1$d\n', port ) + +forever + socket = listener.accept() + PrintWriter( socket.getOutputStream(), true ).println( 'hello world' ) + socket.shutdownOutput() + socket.close() diff --git a/Task/Hello-world-Web-server/Lasso/hello-world-web-server.lasso b/Task/Hello-world-Web-server/Lasso/hello-world-web-server.lasso new file mode 100644 index 0000000000..70ef623bb2 --- /dev/null +++ b/Task/Hello-world-Web-server/Lasso/hello-world-web-server.lasso @@ -0,0 +1,20 @@ +local(server) = net_tcp +handle => { #server->close } +#server->bind(8080) & listen & forEachAccept => { + local(con) = #1 + + split_thread => { + handle => { #con->close } + local(request) = '' + // Read in the request in chunks until you have it all + { + #request->append(#con->readSomeBytes(8096)) + not #request->contains('\r\n\r\n')? currentCapture->restart + }() + + local(response) = 'HTTP/1.1 200 OK\r\n\ + Content-Type: text/html; charset=UTF-8\r\n\r\n\ + Goodbye, World!' + #con->writeBytes(bytes(#response)) + } +} diff --git a/Task/Hello-world-Web-server/Nim/hello-world-web-server.nim b/Task/Hello-world-Web-server/Nim/hello-world-web-server.nim new file mode 100644 index 0000000000..cd65f1ec4c --- /dev/null +++ b/Task/Hello-world-Web-server/Nim/hello-world-web-server.nim @@ -0,0 +1,7 @@ +import asynchttpserver, asyncdispatch + +proc cb(req: Request) {.async.} = + await req.respond(Http200, "Hello, World!") + +asyncCheck newAsyncHttpServer().serve(Port(8080), cb) +runForever() diff --git a/Task/Hello-world-Web-server/Panda/hello-world-web-server.panda b/Task/Hello-world-Web-server/Panda/hello-world-web-server.panda new file mode 100644 index 0000000000..7207a98e85 --- /dev/null +++ b/Task/Hello-world-Web-server/Panda/hello-world-web-server.panda @@ -0,0 +1 @@ +8080.port.listen.say("Hello world!") diff --git a/Task/Hello-world-Web-server/Ring/hello-world-web-server.ring b/Task/Hello-world-Web-server/Ring/hello-world-web-server.ring new file mode 100644 index 0000000000..2d39df52c5 --- /dev/null +++ b/Task/Hello-world-Web-server/Ring/hello-world-web-server.ring @@ -0,0 +1,57 @@ +Load "guilib.ring" + +cResponse = "HTTP/1.1 200 OK\r\n" + + "Content-Type: text/html\r\n\r\n" + + "Goodbye, world!" + + "Goodbye, world!" + +cResponse = substr(cResponse,"\r\n",char(13)+char(10)) + +new qApp { + oServer = new Server { Server() } + exec() +} + +Class Server + + win1 lineedit1 + oTcpServer oTcpClient + cOutput = "" + + func server + + win1 = new qwidget() + + lineedit1 = new qtextedit(win1) { + setGeometry(150,50,200,300) + } + + win1 { + setwindowtitle("Server") + setgeometry(450,100,400,400) + show() + } + + oTcpServer = new qTcpServer(win1) { + setNewConnectionEvent("oServer.pNewConnection()") + oHostAddress = new qHostAddress() + oHostAddress.SetAddress("127.0.0.1") + listen(oHostAddress,8080) + } + cOutput = "Server Started" + nl + + "listen to port 8080" + nl + + lineedit1.settext(cOutput) + + Func pNewConnection + + oTcpClient = oTcpServer.nextPendingConnection() + while not oTcpClient.waitForReadyRead(100) end + cOutput += "Accept Connection" + nl + lineedit1.settext(cOutput) + oTcpClient { + write(cResponse,len(cResponse)) + flush() + waitforbyteswritten(300000) + close() + } diff --git a/Task/Hello-world-Web-server/Sidef/hello-world-web-server-1.sidef b/Task/Hello-world-Web-server/Sidef/hello-world-web-server-1.sidef new file mode 100644 index 0000000000..125d363383 --- /dev/null +++ b/Task/Hello-world-Web-server/Sidef/hello-world-web-server-1.sidef @@ -0,0 +1,24 @@ +var port = 8080; +var protocol = Socket.getprotobyname("tcp"); +  +var sock = (Socket.open(Socket.PF_INET, Socket.SOCK_STREAM, protocol) || die "couldn't open a socket: #{$!}"); + # PF_INET to indicate that this socket will connect to the internet domain + # SOCK_STREAM indicates a TCP stream, SOCK_DGRAM would indicate UDP communication +  +sock.setsockopt(Socket.SOL_SOCKET, Socket.SO_REUSEADDR, 1) || die "couldn't set socket options: #{$!}"; + # SOL_SOCKET to indicate that we are setting an option on the socket instead of the protocol + # mark the socket reusable +  +sock.bind(Socket.sockaddr_in(port, Socket.INADDR_ANY)) || die "couldn't bind socket to port #{port}: #{$!}"; + # bind our socket to $port, allowing any IP to connect +  +sock.listen(Socket.SOMAXCONN) || die "couldn't listen to port #{port}: #{$!}"; + # start listening for incoming connections +  +while (var client = sock.accept) { + client.print ("HTTP/1.1 200 OK\r\n" + + "Content-Type: text/html; charset=UTF-8\r\n\r\n" + + "Goodbye, world!" + + "Goodbye, world!\r\n"); + client.close; +} diff --git a/Task/Hello-world-Web-server/Sidef/hello-world-web-server-2.sidef b/Task/Hello-world-Web-server/Sidef/hello-world-web-server-2.sidef new file mode 100644 index 0000000000..6051954e43 --- /dev/null +++ b/Task/Hello-world-Web-server/Sidef/hello-world-web-server-2.sidef @@ -0,0 +1,14 @@ +var inet = require('IO::Socket::INET'); + +var sock = inet.new( LocalAddr => "127.0.0.1:8080", + Listen => 1, + Reuse => 1, + ); + +while (var client = sock.accept) { + client.print ("HTTP/1.1 200 OK\r\n" + + "Content-Type: text/html; charset=UTF-8\r\n\r\n" + + "Goodbye, world!" + + "Goodbye, world!\r\n"); + client.close; +} diff --git a/Task/Hello-world-Web-server/Wart/hello-world-web-server.wart b/Task/Hello-world-Web-server/Wart/hello-world-web-server.wart new file mode 100644 index 0000000000..a88d658da6 --- /dev/null +++ b/Task/Hello-world-Web-server/Wart/hello-world-web-server.wart @@ -0,0 +1,7 @@ +with server_socket socket :port 4000 + accepting client :from socket + making stdout outfile+fd.client + prn "HTTP/1.0 200 OK" + prn "Content-type: text/plain" + prn "" + prn "Hello, world!" diff --git a/Task/Here-document/8th/here-document.8th b/Task/Here-document/8th/here-document.8th new file mode 100644 index 0000000000..cbf2cf140e --- /dev/null +++ b/Task/Here-document/8th/here-document.8th @@ -0,0 +1,4 @@ +quote * +Hi + there +* . diff --git a/Task/Here-document/Lingo/here-document-1.lingo b/Task/Here-document/Lingo/here-document-1.lingo new file mode 100644 index 0000000000..278a1c2ec7 --- /dev/null +++ b/Task/Here-document/Lingo/here-document-1.lingo @@ -0,0 +1,5 @@ +str = "This is the first line.\ +This is the second line.\ +This ""E&"line""E&" contains quotes." + +put str diff --git a/Task/Here-document/Lingo/here-document-2.lingo b/Task/Here-document/Lingo/here-document-2.lingo new file mode 100644 index 0000000000..e88bd9cff3 --- /dev/null +++ b/Task/Here-document/Lingo/here-document-2.lingo @@ -0,0 +1,2 @@ +str = member("my long text").text +put str diff --git a/Task/Here-document/Nim/here-document.nim b/Task/Here-document/Nim/here-document.nim new file mode 100644 index 0000000000..87104b5d7c --- /dev/null +++ b/Task/Here-document/Nim/here-document.nim @@ -0,0 +1,4 @@ +echo """Usage: thingy [OPTIONS] + -h Display this usage message + -H hostname Hostname to connect to +""" diff --git a/Task/Here-document/Phix/here-document.phix b/Task/Here-document/Phix/here-document.phix new file mode 100644 index 0000000000..eb95161f00 --- /dev/null +++ b/Task/Here-document/Phix/here-document.phix @@ -0,0 +1,38 @@ +string ts1 = """ +this +"string"\thing""" + +string ts2 = """this +"string"\thing""" + +string ts3 = """ +_____________this + "string"\thing""" + +string ts4 = ` +this +"string"\thing` + +string ts5 = `this +"string"\thing` + +string ts6 = ` +_____________this + "string"\thing` + +string ts7 = "this\n\"string\"\\thing" + +constant tests={ts1,ts2,ts3,ts4,ts5,ts6,ts7} +for i=1 to length(tests) do + for j=1 to length(tests) do + if tests[i]!=tests[j] then crash("error") end if + end for +end for +printf(1,""" +____________Everything + (all %d tests) + works + just + file.""",length(tests)) +printf(1,"""`""") +printf(1,`"""`) diff --git a/Task/Here-document/Ring/here-document.ring b/Task/Here-document/Ring/here-document.ring new file mode 100644 index 0000000000..ee3d2cdbef --- /dev/null +++ b/Task/Here-document/Ring/here-document.ring @@ -0,0 +1,11 @@ +text =" +<<'FOO' +Now + is + the + time + for + all + good mem +to come to the aid of their country." +see text + nl diff --git a/Task/Here-document/SequenceL/here-document.sequencel b/Task/Here-document/SequenceL/here-document.sequencel new file mode 100644 index 0000000000..382bb33924 --- /dev/null +++ b/Task/Here-document/SequenceL/here-document.sequencel @@ -0,0 +1,9 @@ +main := +"In SequenceL +strings are +multiline +by default. +'All' non-\" +characters are +valid for inclusion +in a string."; diff --git a/Task/Here-document/Sidef/here-document-1.sidef b/Task/Here-document/Sidef/here-document-1.sidef new file mode 100644 index 0000000000..f606c8fff5 --- /dev/null +++ b/Task/Here-document/Sidef/here-document-1.sidef @@ -0,0 +1,4 @@ +var text = <<"EOF"; +a = #{1+2} +b = #{3+4} +EOF diff --git a/Task/Here-document/Sidef/here-document-2.sidef b/Task/Here-document/Sidef/here-document-2.sidef new file mode 100644 index 0000000000..b8bf8a8336 --- /dev/null +++ b/Task/Here-document/Sidef/here-document-2.sidef @@ -0,0 +1,5 @@ +var x = <<'FOO'; +No +#{interpolation} +here +FOO diff --git a/Task/Here-document/Sidef/here-document-3.sidef b/Task/Here-document/Sidef/here-document-3.sidef new file mode 100644 index 0000000000..ee17e2f225 --- /dev/null +++ b/Task/Here-document/Sidef/here-document-3.sidef @@ -0,0 +1,4 @@ +say (<MCD%) + WHILE J%<>K% DO + IF J%>K% THEN + J%=J%-K% + ELSE + K%=K%-J% + END IF + END WHILE + MCD%=J% +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) !CLS + FOR C%=1 TO 200 DO + FOR B%=1 TO C% DO + FOR A%=1 TO B% DO + S#=(A%+B%+C%)/2# + AREA#=S#*(S#-A%)*(S#-B%)*(S#-C%) + IF AREA#>0 THEN + AREA#=SQR(AREA#) + IF AREA#=INT(AREA#) THEN + GCD(B%,C%->RES%) + GCD(A%,RES%->RES%) + IF RES%=1 THEN + COUNT%=COUNT%+1 + LISTA%[COUNT%,0]=A% LISTA%[COUNT%,1]=B% LISTA%[COUNT%,2]=C% + LISTA%[COUNT%,3]=2*S# LISTA%[COUNT%,4]=AREA# + END IF + END IF + END IF + END FOR + END FOR +END FOR + +PRINT("Number of triangles:";COUNT%) + +! sorting array +FLIPS%=TRUE +WHILE FLIPS% DO + FLIPS%=FALSE + FOR I%=1 TO COUNT%-1 DO + IF LISTA%[I%,4]>LISTA%[I%+1,4] THEN + FOR K%=0 TO 4 DO + SWAP(LISTA%[I%,K%],LISTA%[I%+1,K%]) + END FOR + FLIPS%=TRUE + END IF + END FOR +END WHILE + +! first ten +FOR I%=1 TO 10 DO + PRINT(#1,LISTA%[I%,0],LISTA%[I%,1],LISTA%[I%,2],LISTA%[I%,3],LISTA%[I%,4]) +END FOR +PRINT + +! triangle with area=210 +FOR I%=1 TO COUNT% DO + IF LISTA%[I%,4]=210 THEN + PRINT(LISTA%[I%,0],LISTA%[I%,1],LISTA%[I%,2],LISTA%[I%,3],LISTA%[I%,4]) + END IF +END FOR +END PROGRAM diff --git a/Task/Heronian-triangles/EchoLisp/heronian-triangles.echolisp b/Task/Heronian-triangles/EchoLisp/heronian-triangles.echolisp new file mode 100644 index 0000000000..a9356574da --- /dev/null +++ b/Task/Heronian-triangles/EchoLisp/heronian-triangles.echolisp @@ -0,0 +1,25 @@ +;; returns quintuple (A s a b c) +;; or #f if not hero +(define (hero a b c (s 0) (A 0)) + (when + (= 1 (gcd a b c)) + (set! s (// (+ a b c) 2)) + (set! A (* s (- s a)(- s b)(- s c))) + (when (square? A) + (list (sqrt A) (* s 2) c b a)))) + +;; all heroes a,b,c < sidemax +;; sorted by A|s|c & a <=b <= c +(define (heroes (sidemax 201)) + (list-sort/fields 3 + (for*/list ((a (in-range 1 sidemax)) (b (in-range a sidemax)) (c (in-range b sidemax))) + #:continue (<= (+ a b) c) ;; triangle inequality must hold !! cut search + #:continue (not (hero a b c)) + (hero a b c)))) + +(define (print-hero h) + (printf "A: %6d s: %6d sides: %dx%dx%d" + (list-ref h 0) (list-ref h 1) + (list-ref h 2)(list-ref h 3) (list-ref h 4))) +(define (print-laurels H) + (writeln '🌿🌿 (length H) 'heroes '🌿🌿)) diff --git a/Task/Heronian-triangles/FreeBASIC/heronian-triangles.freebasic b/Task/Heronian-triangles/FreeBASIC/heronian-triangles.freebasic new file mode 100644 index 0000000000..9a06141776 --- /dev/null +++ b/Task/Heronian-triangles/FreeBASIC/heronian-triangles.freebasic @@ -0,0 +1,147 @@ +' version 02-05-2016 +' compile with: fbc -s console + +#Macro header + Print + Print " a b c s area" + Print "-----------------------------------" +#EndMacro + +Type triangle + Dim As UInteger a + Dim As UInteger b + Dim As UInteger c + Dim As UInteger s + Dim As UInteger area +End Type + +Function gcd(x As UInteger, y As UInteger) As UInteger + + Dim As UInteger t + + While y + t = y + y = x Mod y + x = t + Wend + + Return x + +End Function + +Function Heronian_triangles(a_max As UInteger, b_max As UInteger, _ + c_max As UInteger, result() As triangle) As UInteger + + Dim As UInteger a, b, c + Dim As UInteger s, sqroot, total, temp + + For a = 1 To a_max + For b = a To b_max + ' make sure that a + b + c is even + For c = b + (a And 1) To c_max Step 2 + ' to form a triangle a + b must be greater then c + If (a + b) <= c Then Exit For + ' check if a, b and c have a common divisor + If (gcd(c, b) <> 1 And gcd(c, a) <> 1) Then + Continue For + End If + s = (a + b + c) \ 2 + temp = s * (s - a) * (s - b) * (s - c) + sqroot = Sqr(temp) + If (sqroot * sqroot) = temp Then + total += 1 + With result(total) + .a = a + .b = b + .c = c + .s = s + .area = sqroot + End With + End If + Next + Next + Next + + Return total + +End Function + + +Sub sort_tri(result() As triangle, total As UInteger) + ' shell sort + ' sort order: area, s, c + + Dim As UInteger x, y, inc, done + + inc = total + Do + inc = IIf(inc > 1, inc \ 2, 1) + Do + done = 0 + For x = 1 To total - inc + y = x + inc + If result(x).area > result(y).area Then + Swap result(x), result(y) + done = 1 + Else + If result(x).area = result(y).area Then + If result(x).s > result(y).s Then + Swap result(x), result(y) + done = 1 + Else + If result(x).s = result(y).s Then + If result(x).c > result(y).c Then + Swap result(x), result(y) + done = 1 + End If + End If + End If + End If + End If + Next + Loop Until done = 0 + Loop Until inc = 1 + +End Sub + + +' ------=< MAIN >=------ + +ReDim result(1 To 1000) As triangle +Dim As UInteger x, y, total + +total = Heronian_triangles(200, 200, 200, result() ) + +' trim the array by removing empty entries +ReDim Preserve result(1 To total ) As triangle + +sort_tri(result(), total) + +Print "There are ";total;" Heronian triangles with sides <= 200" +Print + +Print "First ten sorted entries" +header ' print header +For x = 1 To IIf(total > 9, 10, total) + With result(x) + Print Using " #####"; .a; .b; .c; .s; .area + End With +Next +Print +Print + +Print "Entries with a area = 210" +header ' print header +For x = 1 To UBound(result) + With result(x) + If .area = 210 Then + Print Using " #####"; .a; .b; .c; .s; .area + End If + End With +Next + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Heronian-triangles/FutureBasic/heronian-triangles.futurebasic b/Task/Heronian-triangles/FutureBasic/heronian-triangles.futurebasic new file mode 100644 index 0000000000..36af35eae2 --- /dev/null +++ b/Task/Heronian-triangles/FutureBasic/heronian-triangles.futurebasic @@ -0,0 +1,86 @@ +include "ConsoleWindow" + +// Set width of tabs +def tab 10 + +local fn gcd( a as long, b as long ) +dim as long result + +if ( b != 0 ) + result = fn gcd( b, a mod b) +else + result = abs(a) +end if +end fn = result + +begin globals +dim as long triangleInfo( 600, 4 ) +end globals + +local fn CalculateHeronianTriangles( numberToCheck as long ) as long +dim as long c, b, a, result, count : count = 0 +dim as double s, area + +for c = 1 to numberToCheck + for b = 1 to c + for a = 1 to b + s = ( a + b + c ) / 2 + area = s * ( s - a ) * ( s - b ) * ( s - c ) + if area > 0 + area = sqr( area ) + if area = int( area ) + result = fn gcd( b, c ) + result = fn gcd( a, result ) + if result == 1 + count++ + triangleInfo( count, 0 ) = a + triangleInfo( count, 1 ) = b + triangleInfo( count, 2 ) = c + triangleInfo( count, 3 ) = 2 * s + triangleInfo( count, 4 ) = area + end if + end if + end if + next + next +next +end fn = count + +dim as long i, k, count + +count = fn CalculateHeronianTriangles( 200 ) + +print +print "Number of triangles:"; count +print +print "---------------------------------------------" +print "Side A", "Side B", "Side C", "Perimeter", "Area" +print "---------------------------------------------" + +// Sort array +dim as Boolean flips : flips = _true +while ( flips = _true ) + flips = _false + for i = 1 to count - 1 + if triangleInfo( i, 4 ) > triangleInfo( i + 1, 4 ) + for k = 0 to 4 + swap triangleInfo( i, k ), triangleInfo( i + 1, k ) + next + flips = _true + end if + next +wend + +// Find first 10 heronian triangles +for i = 1 to 10 + print triangleInfo( i, 0 ), triangleInfo( i, 1 ), triangleInfo( i, 2 ), triangleInfo( i, 3 ), triangleInfo( i, 4 ) +next +print +print "Triangles with an area of 210:" +print +// Search for triangle with area of 210 +for i = 1 to count + if triangleInfo( i, 4 ) == 210 + print triangleInfo( i, 0 ), triangleInfo( i, 1 ), triangleInfo( i, 2 ), triangleInfo( i, 3 ), triangleInfo( i, 4 ) + end if +next diff --git a/Task/Heronian-triangles/Nim/heronian-triangles.nim b/Task/Heronian-triangles/Nim/heronian-triangles.nim new file mode 100644 index 0000000000..4be9a159d9 --- /dev/null +++ b/Task/Heronian-triangles/Nim/heronian-triangles.nim @@ -0,0 +1,60 @@ +import math, algorithm, strfmt, sequtils + +type + HeronianTriangle = tuple + a: int + b: int + c: int + s: float + A: int + +proc `$` (t: HeronianTriangle): string = + fmt("{:3d}, {:3d}, {:3d}\t{:7.3f}\t{:3d}", t.a, t.b, t.c, t.s, t.A) + +proc hero(a:int, b:int, c:int): tuple[s, A: float] = + let s: float = (a + b + c) / 2 + result = (s, sqrt( s * (s - float(a)) * (s - float(b)) * (s - float(c)) )) + +proc isHeronianTriangle(x: float): bool = ceil(x) == x and x.toInt > 0 + +proc gcd(x: int, y: int): int = + var + (dividend, divisor) = if x > y: (x, y) else: (y, x) + remainder = dividend mod divisor + + while remainder != 0: + dividend = divisor + divisor = remainder + remainder = dividend mod divisor + result = divisor + + +var list = newSeq[HeronianTriangle]() +const max = 200 + +for c in 1..max: + for b in 1..c: + for a in 1..b: + let (s, A) = hero(a, b, c) + if isHeronianTriangle(A) and gcd(a, gcd(b, c)) == 1: + let t:HeronianTriangle = (a, b, c, s, A.toInt) + list.add(t) + +echo "Numbers of Heronian Triangle : ", list.len + +list.sort do (x, y: HeronianTriangle) -> int: + result = cmp(x.A, y.A) + if result == 0: + result = cmp(x.s, y.s) + if result == 0: + result = cmp(max(x.a, x.b, x.c), max(y.a, y.b, y.c)) + +echo "Ten first Heronian triangle ordered : " +echo "Sides Perimeter Area" +for t in list[0 .. <10]: + echo t + +echo "Heronian triangle ordered with Area 210 : " +echo "Sides Perimeter Area" +for t in list.filter(proc (x: HeronianTriangle): bool = x.A == 210): + echo t diff --git a/Task/Heronian-triangles/Phix/heronian-triangles.phix b/Task/Heronian-triangles/Phix/heronian-triangles.phix new file mode 100644 index 0000000000..634bb1225c --- /dev/null +++ b/Task/Heronian-triangles/Phix/heronian-triangles.phix @@ -0,0 +1,38 @@ +function heroArea(integer a, b, c) +atom s = (a+b+c)/2 + return sqrt(s*(s-a)*(s-b)*(s-c)) +end function + +function hero(atom h) + return remainder(h,1)=0 and h>0 +end function + +sequence list = {} +integer tries = 0 + for a=1 to 200 do + for b=1 to a do + for c=1 to b do + tries += 1 + if gcd({a,b,c})=1 then + atom hArea = heroArea(a,b,c) + if hero(hArea) then + list = append(list,{hArea,a+b+c,a,b,c}) + end if + end if + end for + end for + end for + list = sort(list) + printf(1,"Primitive Heronian triangles with sides up to 200: %d (of %,d tested)\n\n",{length(list),tries}) + printf(1,"First 10 ordered by area/perimeter/sides:\n") + printf(1,"area perimeter sides") + for i=1 to 10 do + printf(1,"\n%4d %3d %dx%dx%d",list[i]) + end for + printf(1,"\n\narea = 210:\n") + printf(1,"area perimeter sides") + for i=1 to length(list) do + if list[i][1]=210 then + printf(1,"\n%4d %3d %dx%dx%d",list[i]) + end if + end for diff --git a/Task/Heronian-triangles/Ring/heronian-triangles.ring b/Task/Heronian-triangles/Ring/heronian-triangles.ring new file mode 100644 index 0000000000..3e3c7269f9 --- /dev/null +++ b/Task/Heronian-triangles/Ring/heronian-triangles.ring @@ -0,0 +1,29 @@ +size = 20 +number = 0 +see " a b c area perimeter" + nl +for i = 1 to size + for j = i + 1 to size + for k = j + 1 to size + perim = (i + j + k) / 2 + heronian = sqrt(perim*(perim - i)*(perim - j)*(perim-k)) + if heronian = floor(heronian) + if gcd(gcd(i, j),k) = 1 + if i + j > k and i + k > j and j + k > i + number += 1 + if number <= 20 + if len(string(i)) = 1 stri = " " + string(i) else stri = string(i) ok + if len(string(j)) = 1 strj = " " + string(j) else strj = string(j) ok + if len(string(k)) = 1 strk = " " + string(k) else strk = string(k) ok + if len(string(heronian)) = 1 her = " " + string(heronian) else her = string(heronian) ok + see stri + " "+ strj + " "+ strk + " " + her + " " + perim*2 + nl ok ok ok ok + next + next +next + +func gcd gcd, b + while b + c = gcd + gcd = b + b = c % b + end + return gcd diff --git a/Task/Heronian-triangles/Sidef/heronian-triangles.sidef b/Task/Heronian-triangles/Sidef/heronian-triangles.sidef new file mode 100644 index 0000000000..1cf987b60f --- /dev/null +++ b/Task/Heronian-triangles/Sidef/heronian-triangles.sidef @@ -0,0 +1,48 @@ +class Triangle(a, b, c) { + + has (sides, perimeter, area) + + method init { + sides = [a, b, c].sort + perimeter = [a, b, c].sum + var s = (perimeter / 2) + area = sqrt(s * (s - a) * (s - b) * (s - c)) + } + + method is_valid(a,b,c) { + var (short, middle, long) = [a, b, c].sort...; + (short + middle) > long + } + + method is_heronian { + area == area.to_i + } + + method <=>(other) { + [area, perimeter, sides] <=> [other.area, other.perimeter, other.sides] + } + + method to_s { + "%-11s%6d%8.1f" % (sides.join('x'), perimeter, area) + } +} + +var (max, area) = (200, 210) +var prim_triangles = [] + +for a in (1..max) { + for b in (a..max) { + for c in (b..max) { + next if (Math.gcd(a, b, c) > 1) + prim_triangles << Triangle(a, b, c) if Triangle.is_valid(a, b, c) + } + } +} + +var sorted = prim_triangles.grep{.is_heronian}.sort + +say "Primitive heronian triangles with sides upto #{max}: #{sorted.size}" +say "\nsides perim. area" +say sorted.first(10).join("\n") +say "\nTriangles with an area of: #{area}" +sorted.each{|tr| say tr if (tr.area == area)} diff --git a/Task/Heronian-triangles/Swift/heronian-triangles.swift b/Task/Heronian-triangles/Swift/heronian-triangles.swift new file mode 100644 index 0000000000..366efaec8a --- /dev/null +++ b/Task/Heronian-triangles/Swift/heronian-triangles.swift @@ -0,0 +1,54 @@ +import Foundation + +typealias PrimitiveHeronianTriangle = (s1:Int, s2:Int, s3:Int, p:Int, a:Int) + +func heronianArea(side1 s1:Int, side2 s2:Int, side3 s3:Int) -> Int? { + let d1 = Double(s1) + let d2 = Double(s2) + let d3 = Double(s3) + + let s = (d1 + d2 + d3) / 2.0 + let a = sqrt(s * (s - d1) * (s - d2) * (s - d3)) + + if a % 1 != 0 || a <= 0 { + return nil + } else { + return Int(a) + } +} + +func gcd(a:Int, b:Int) -> Int { + if b != 0 { + return gcd(b, a % b) + } else { + return abs(a) + } +} + +var triangles = [PrimitiveHeronianTriangle]() + +for s1 in 1...200 { + for s2 in 1...s1 { + for s3 in 1...s2 { + if gcd(s1, gcd(s2, s3)) == 1, let a = heronianArea(side1: s1, side2: s2, side3: s3) { + triangles.append((s3, s2, s1, s1 + s2 + s3, a)) + } + } + } +} + +sort(&triangles) {t1, t2 in + if t1.a < t2.a || t1.a == t2.a && t1.p < t2.p { + return true + } else { + return false + } +} + +println("Number of primitive Heronian triangles with sides up to 200: \(triangles.count)\n") +println("First ten sorted by area, then perimeter, then maximum side:\n") +println("Sides\t\t\tPerimeter\tArea") + +for t in triangles[0...9] { + println("\(t.s1)\t\(t.s2)\t\(t.s3)\t\t\(t.p)\t\t\(t.a)") +} diff --git a/Task/Heronian-triangles/jq/heronian-triangles-1.jq b/Task/Heronian-triangles/jq/heronian-triangles-1.jq new file mode 100644 index 0000000000..0286ae5fc1 --- /dev/null +++ b/Task/Heronian-triangles/jq/heronian-triangles-1.jq @@ -0,0 +1,40 @@ +# input should be an array of the lengths of the sides +def hero: + (add/2) as $s + | ($s*($s - .[0])*($s - .[1])*($s - .[2])) as $a2 + | if $a2 > 0 then ($a2 | sqrt) else 0 end; + +def is_heronian: + hero as $h + | $h > 0 and ($h|floor) == $h; + +def gcd3(x; y; z): + # subfunction expects [a,b] as input + def rgcd: + if .[1] == 0 then .[0] + else [.[1], .[0] % .[1]] | rgcd + end; + [ ([x,y] | rgcd), z ] | rgcd; + +def task(maxside): + def rjust(width): tostring | " " * (width - length) + .; + + [ range(1; maxside+1) as $c + | range(1; $c+1) as $b + | range(1; $b+1) as $a + | if ($a + $b) > $c and gcd3($a; $b; $c) == 1 + then [$a,$b,$c] | if is_heronian then . else empty end + else empty + end ] + + # sort by increasing area, perimeter, then sides + | sort_by( [ hero, add, .[2] ] ) + | "The number of primitive Heronian triangles with sides up to \(maxside): \(length)", + "The first ten when ordered by increasing area, then perimeter, then maximum sides:", + " perimeter area", + (.[0:10][] | "\(rjust(11)) \(add | rjust(3)) \(hero | rjust(4))" ), + "All those with area 210, ordered as previously:", + " perimeter area", + ( .[] | select( hero == 210 ) | "\(rjust(11)) \(add|rjust(3)) \(hero|rjust(4))" ) ; + +task(200) diff --git a/Task/Heronian-triangles/jq/heronian-triangles-2.jq b/Task/Heronian-triangles/jq/heronian-triangles-2.jq new file mode 100644 index 0000000000..217d02e3e0 --- /dev/null +++ b/Task/Heronian-triangles/jq/heronian-triangles-2.jq @@ -0,0 +1,22 @@ +$ time jq -n -r -f heronian.jq +The number of primitive Heronian triangles with sides up to 200: 517 +The first ten when ordered by increasing area, then perimeter, then maximum sides: + perimeter area + [3,4,5] 12 6 + [5,5,6] 16 12 + [5,5,8] 18 12 + [4,13,15] 32 24 + [5,12,13] 30 30 + [9,10,17] 36 36 + [3,25,26] 54 36 + [7,15,20] 42 42 + [10,13,13] 36 60 + [8,15,17] 40 60 +All those with area 210, ordered as previously: + perimeter area + [17,25,28] 70 210 + [20,21,29] 70 210 + [12,35,37] 84 210 + [17,28,39] 84 210 + [7,65,68] 140 210 +[3,148,149] 300 210 diff --git a/Task/Hickerson-series-of-almost-integers/FreeBASIC/hickerson-series-of-almost-integers.freebasic b/Task/Hickerson-series-of-almost-integers/FreeBASIC/hickerson-series-of-almost-integers.freebasic new file mode 100644 index 0000000000..14209bd58f --- /dev/null +++ b/Task/Hickerson-series-of-almost-integers/FreeBASIC/hickerson-series-of-almost-integers.freebasic @@ -0,0 +1,86 @@ +' version 08-10-2016 +' compile with: fbc -s gui + +#Include Once "gmp.bi" + +#Macro init_float_size (big_float ,size) + Dim As Mpf_ptr big_float = Allocate( Len( __mpf_struct)) + Mpf_init2( big_float,size) +#EndMacro + +#Macro mpf_remove(big_float) + Mpf_clear(big_float) + DeAllocate (big_float) +#EndMacro + +Screen 20 + +init_float_size(tmp,1024) +init_float_size(ln2,1024) +init_float_size(pow_ln2,2048) +init_float_size(answer,2048) + +Dim As UInteger n, num +Dim As String st +Dim As ZString Ptr text +text = Allocate (1500) ' size 1500 char. + +' need to calculate ln(2) + +' x 1 1 1 1 +' ln --- = - + ------ + ------ ... + ------ +' x-1 x 2x^2 3x^3 nx^n + +Mpf_set_ui(answer, 1) +Mpf_div_ui(answer, answer, 2) ' answer = 1/2 + +For n = 2 To 1024 + Mpf_set_ui(tmp, 2) ' tmp = x = 2 + Mpf_pow_ui(tmp, tmp, n) ' tmp = x ^ n + Mpf_mul_ui(tmp, tmp, n) ' tmp = n * (x ^ n) + Mpf_ui_div(tmp, 1, tmp) ' tmp = 1 / (n * (x ^ n)) + Mpf_add(answer, answer, tmp) ' answer += tmp +Next + +/' remove this line if you want to print ln(2) +Gmp_sprintf(text,!"ln(2) =\t %2.100Ff ", answer) +Print *text +Print +'/ + +Mpf_set_ui(tmp, 1) +Mpf_set(ln2, answer ) +Mpf_set(pow_ln2, ln2) + +Print +For n = 1 To 40 + Mpf_mul_ui(tmp, tmp, n) ' n! + Mpf_mul(pow_ln2, pow_ln2, ln2) ' ln(2)^(n+1) + Mpf_div_ui(answer, tmp , 2) ' / 2 + Mpf_div(answer, answer, pow_ln2) ' / ln(2)^(n+1) + Gmp_sprintf(text,!"h(%i) =\t %65.5Ff ",n, answer) + st = *text + num = st[InStr(st,".")] ' get the first character after the "." + If num = Asc("0") Or num = Asc("9") Then + Color 10 + Print st;" is a almost integer" + Color 15 + Else + Color 12 + Print st;" not close enough" + Color 15 + End If +Next + +mpf_remove(answer) 'cleanup +mpf_remove(pow_ln2) +mpf_remove(ln2) +mpf_remove(tmp) +DeAllocate (text) + + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Hickerson-series-of-almost-integers/Ring/hickerson-series-of-almost-integers.ring b/Task/Hickerson-series-of-almost-integers/Ring/hickerson-series-of-almost-integers.ring new file mode 100644 index 0000000000..5e2a813955 --- /dev/null +++ b/Task/Hickerson-series-of-almost-integers/Ring/hickerson-series-of-almost-integers.ring @@ -0,0 +1,24 @@ +n = 12 +hick = 0 +decimals(8) + +for i = 1 to n + see "h(" + string(i) + ") = " + see "" + hickersonSeries(i) + " " + if nearly(hick) = 1 see "nearly integer" + nl + else see "not nearly integer" + nl ok +next + +func hickersonSeries nr + hick = fact(nr) / (2 * pow(log(2), nr+1)) + return hick + +func fact nr if nr = 1 return 1 else return nr * fact(nr-1) ok + +func nearly nr + strNr = string(nr) + sub = substr(strNr,".") + sub2 = substr(strNr,sub+1,1) + if (sub2 = "0" or sub2="9") return 1 + else return 0 ok + return sub diff --git a/Task/Hickerson-series-of-almost-integers/Sidef/hickerson-series-of-almost-integers.sidef b/Task/Hickerson-series-of-almost-integers/Sidef/hickerson-series-of-almost-integers.sidef new file mode 100644 index 0000000000..24f977f3c6 --- /dev/null +++ b/Task/Hickerson-series-of-almost-integers/Sidef/hickerson-series-of-almost-integers.sidef @@ -0,0 +1,8 @@ +func h(n) { + n! / (2 * Math.pow(2.log, n+1)); +} + +17.times { |n| + "h(%2d) = %22s is%s almost an integer.\n".printf( + n, var hn = h(n).roundf(-3), hn.to_s ~~ /\.[09]/ ? '' : ' NOT'); +} diff --git a/Task/Hickerson-series-of-almost-integers/jq/hickerson-series-of-almost-integers-1.jq b/Task/Hickerson-series-of-almost-integers/jq/hickerson-series-of-almost-integers-1.jq new file mode 100644 index 0000000000..33ecc9c1f1 --- /dev/null +++ b/Task/Hickerson-series-of-almost-integers/jq/hickerson-series-of-almost-integers-1.jq @@ -0,0 +1,25 @@ +def hickerson: + . as $n + | (2|log) as $log2 + | reduce range(1;$n+1) as $i ( 0.5/$log2; . * $i / $log2) ; + +def precise: + (. - 0.05) as $x | . != ($x + 0.1) ; + +def almost_an_integer: + tostring + | index(".") as $ix + | if $ix == null then true + else .[$ix+1:$ix+2] | (. == "9" or . == "0") + end ; + +range(1;18) + | . as $i + | hickerson + | if precise then + if almost_an_integer + then "hickerson(\($i)) is \(.) -- almost an integer" + else "hickerson(\($i)) is \(.)" + end + else "insufficient precision for hickerson(\($i))" + end diff --git a/Task/Hickerson-series-of-almost-integers/jq/hickerson-series-of-almost-integers-2.jq b/Task/Hickerson-series-of-almost-integers/jq/hickerson-series-of-almost-integers-2.jq new file mode 100644 index 0000000000..ba1d711052 --- /dev/null +++ b/Task/Hickerson-series-of-almost-integers/jq/hickerson-series-of-almost-integers-2.jq @@ -0,0 +1,18 @@ +$ jq -M -r -n -f Hickerson_series.jq +hickerson(1) is 1.0406844905028039 -- almost an integer +hickerson(2) is 3.0027807071569055 -- almost an integer +hickerson(3) is 12.996290505276967 -- almost an integer +hickerson(4) is 74.9987354476616 -- almost an integer +hickerson(5) is 541.0015185164235 -- almost an integer +hickerson(6) is 4683.001247262258 -- almost an integer +hickerson(7) is 47292.99873131463 -- almost an integer +hickerson(8) is 545834.9979074852 -- almost an integer +hickerson(9) is 7087261.001622899 -- almost an integer +hickerson(10) is 102247563.00527105 -- almost an integer +hickerson(11) is 1622632572.9975502 -- almost an integer +hickerson(12) is 28091567594.98158 -- almost an integer +hickerson(13) is 526858348381.00134 -- almost an integer +hickerson(14) is 10641342970443.086 -- almost an integer +hickerson(15) is 230283190977853.06 -- almost an integer +insufficient precision for hickerson(16) +insufficient precision for hickerson(17) diff --git a/Task/Higher-order-functions/8th/higher-order-functions.8th b/Task/Higher-order-functions/8th/higher-order-functions.8th new file mode 100644 index 0000000000..0cd8b12d32 --- /dev/null +++ b/Task/Higher-order-functions/8th/higher-order-functions.8th @@ -0,0 +1,6 @@ +: pass-me + "I was passed\n" . ; +: passer + w:exec ; +\ pass 'pass-me' to 'passer' +' pass-me passer diff --git a/Task/Higher-order-functions/AntLang/higher-order-functions.antlang b/Task/Higher-order-functions/AntLang/higher-order-functions.antlang new file mode 100644 index 0000000000..c3f79dc90e --- /dev/null +++ b/Task/Higher-order-functions/AntLang/higher-order-functions.antlang @@ -0,0 +1,2 @@ +twice:{x[x[y]]} +echo twice "Hello!" diff --git a/Task/Higher-order-functions/ECL/higher-order-functions.ecl b/Task/Higher-order-functions/ECL/higher-order-functions.ecl new file mode 100644 index 0000000000..c9710ab470 --- /dev/null +++ b/Task/Higher-order-functions/ECL/higher-order-functions.ecl @@ -0,0 +1,51 @@ +//a Function prototype: +INTEGER actionPrototype(INTEGER v1, INTEGER v2) := 0; + +INTEGER aveValues(INTEGER v1, INTEGER v2) := (v1 + v2) DIV 2; +INTEGER addValues(INTEGER v1, INTEGER v2) := v1 + v2; +INTEGER multiValues(INTEGER v1, INTEGER v2) := v1 * v2; + +//a Function prototype using a function prototype: +INTEGER applyPrototype(INTEGER v1, actionPrototype actionFunc) := 0; + +//using the Function prototype and a default value: +INTEGER applyValue2(INTEGER v1, + actionPrototype actionFunc = aveValues) := + actionFunc(v1, v1+1)*2; + +//Defining the Function parameter inline, witha default value: +INTEGER applyValue4(INTEGER v1, + INTEGER actionFunc(INTEGER v1,INTEGER v2) = aveValues) + := actionFunc(v1, v1+1)*4; +INTEGER doApplyValue(INTEGER v1, + INTEGER actionFunc(INTEGER v1, INTEGER v2)) + := applyValue2(v1+1, actionFunc); + +//producing simple results: +OUTPUT(applyValue2(1)); // 2 +OUTPUT(applyValue2(2)); // 4 +OUTPUT(applyValue2(1, addValues)); // 6 +OUTPUT(applyValue2(2, addValues)); // 10 +OUTPUT(applyValue2(1, multiValues)); // 4 +OUTPUT(applyValue2(2, multiValues)); // 12 +OUTPUT(doApplyValue(1, multiValues)); // 12 +OUTPUT(doApplyValue(2, multiValues)); // 24 + + + +//A definition taking function parameters which themselves +//have parameters that are functions... + +STRING doMany(INTEGER v1, + INTEGER firstAction(INTEGER v1, + INTEGER actionFunc(INTEGER v1,INTEGER v2)), + INTEGER secondAction(INTEGER v1, + INTEGER actionFunc(INTEGER v1,INTEGER v2)), + INTEGER actionFunc(INTEGER v1,INTEGER v2)) + := (STRING)firstAction(v1, actionFunc) + ':' + (STRING)secondaction(v1, actionFunc); + +OUTPUT(doMany(1, applyValue2, applyValue4, addValues)); + // produces "6:12" + +OUTPUT(doMany(2, applyValue4, applyValue2,multiValues)); + // produces "24:12" diff --git a/Task/Higher-order-functions/ERRE/higher-order-functions.erre b/Task/Higher-order-functions/ERRE/higher-order-functions.erre new file mode 100644 index 0000000000..b8e931b578 --- /dev/null +++ b/Task/Higher-order-functions/ERRE/higher-order-functions.erre @@ -0,0 +1,13 @@ +PROGRAM FUNC_PASS + + FUNCTION ONE(X,Y) + ONE=(X+Y)^2 + END FUNCTION + + FUNCTION TWO(X,Y) + TWO=ONE(X,Y)+1 + END FUNCTION + +BEGIN + PRINT(TWO(10,11)) +END PROGRAM diff --git a/Task/Higher-order-functions/FreeBASIC/higher-order-functions.freebasic b/Task/Higher-order-functions/FreeBASIC/higher-order-functions.freebasic new file mode 100644 index 0000000000..4f00d084d2 --- /dev/null +++ b/Task/Higher-order-functions/FreeBASIC/higher-order-functions.freebasic @@ -0,0 +1,23 @@ +' FB 1.05.0 Win64 + +Function square(n As Integer) As Integer + Return n * n +End Function + +Function cube(n As Integer) As Integer + Return n * n * n +End Function + +Sub doCalcs(from As Integer, upTo As Integer, title As String, func As Function(As Integer) As Integer) + Print title; " -> "; + For i As Integer = from To upTo + Print Using "#####"; func(i); + Next + Print +End Sub + +doCalcs 1, 10, "Squares", @square +doCalcs 1, 10, "Cubes ", @cube +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Higher-order-functions/FutureBasic/higher-order-functions.futurebasic b/Task/Higher-order-functions/FutureBasic/higher-order-functions.futurebasic new file mode 100644 index 0000000000..075b7c6d3a --- /dev/null +++ b/Task/Higher-order-functions/FutureBasic/higher-order-functions.futurebasic @@ -0,0 +1,10 @@ +include "ConsoleWindow" + +dim as pointer functionOneAddress + +def fn FunctionOne( x as long, y as long ) as long = (x + y) ^ 2 +functionOneAddress = @fn FunctionOne + +def fn FunctionTwo( x as long, y as long ) using functionOneAddress + +print fn FunctionTwo( 12, 12 ) diff --git a/Task/Higher-order-functions/Lily/higher-order-functions.lily b/Task/Higher-order-functions/Lily/higher-order-functions.lily new file mode 100644 index 0000000000..483a0360a2 --- /dev/null +++ b/Task/Higher-order-functions/Lily/higher-order-functions.lily @@ -0,0 +1,26 @@ +define square(x: Integer): Integer +{ + return x * x +} + +var l = [1, 2, 3] # Inferred type: List[Integer]. + +# Transform using a user-defined function. +print(l.map(square)) # [1, 4, 9] + +# Using a built-in method this time. +print(l.map(Integer.to_s)) # ["1", "2", "3"] + +# Using a lambda (with the type of 'x' properly inferred). +print(l.map{|x| (x + 1).to_s()}) # ["2", "3", "4"] + +# In reverse order using F#-styled pipes. +Boolean.to_i |> [true, false].map |> print + +define apply[A, B](value: A, f: Function(A => B)): B +{ + return f(value) +} + +# Calling user-defined transformation. +print(apply("123", String.parse_i)) # Some(123) diff --git a/Task/Higher-order-functions/Lingo/higher-order-functions-1.lingo b/Task/Higher-order-functions/Lingo/higher-order-functions-1.lingo new file mode 100644 index 0000000000..6cec99fba1 --- /dev/null +++ b/Task/Higher-order-functions/Lingo/higher-order-functions-1.lingo @@ -0,0 +1,17 @@ +-- in some movie script +---------------------------------------- +-- Runs provided function on all elements of the provided list, returns results as new list +-- @param {list} tList +-- @param {symbol} cbFunc +-- @param {object} [cbObj=_movie] +-- @return {list} +---------------------------------------- +on map (tList, cbFunc, cbObj) + if voidP(cbObj) then cbObj = _movie + res = [] + cnt = tList.count + repeat with i = 1 to cnt + res[i] = call(cbFunc, cbObj, tList[i]) + end repeat + return res +end diff --git a/Task/Higher-order-functions/Lingo/higher-order-functions-2.lingo b/Task/Higher-order-functions/Lingo/higher-order-functions-2.lingo new file mode 100644 index 0000000000..d347632b28 --- /dev/null +++ b/Task/Higher-order-functions/Lingo/higher-order-functions-2.lingo @@ -0,0 +1,7 @@ +l = [1, 2, 3] + +-- passes the built-in function 'sin' (which is a method of the _movie object) as argument to map +res = map(l, #sin) + +put res +-- [0.8415, 0.9093, 0.1411] diff --git a/Task/Higher-order-functions/Luck/higher-order-functions.luck b/Task/Higher-order-functions/Luck/higher-order-functions.luck new file mode 100644 index 0000000000..9e9da61342 --- /dev/null +++ b/Task/Higher-order-functions/Luck/higher-order-functions.luck @@ -0,0 +1,5 @@ +function lambda_true(x: 'a)(y: 'a): 'a = x;; +function lambda_false(x: 'a)(y: 'a): 'a = y;; +function lambda_if(c:'a -> 'a -> 'a )(t: 'a)(f: 'a): 'a = c(t)(f);; + +print( lambda_if(lambda_true)("condition was true")("condition was false") );; diff --git a/Task/Higher-order-functions/Morfa/higher-order-functions.morfa b/Task/Higher-order-functions/Morfa/higher-order-functions.morfa new file mode 100644 index 0000000000..21f4577571 --- /dev/null +++ b/Task/Higher-order-functions/Morfa/higher-order-functions.morfa @@ -0,0 +1,12 @@ +func g(a: int, b: int, f: func(int,int): int): int +{ + return f(a, b); +} + +import morfa.base; + +func main(): void +{ + println("Add: ", g(2, 3, func(a: int, b: int) { return a + b; })); + println("Multiply: ", g(2, 3, func(a: int, b: int) { return a * b; })); +} diff --git a/Task/Higher-order-functions/Nim/higher-order-functions.nim b/Task/Higher-order-functions/Nim/higher-order-functions.nim new file mode 100644 index 0000000000..70a5f81d91 --- /dev/null +++ b/Task/Higher-order-functions/Nim/higher-order-functions.nim @@ -0,0 +1,7 @@ +proc first(fn: proc): auto = + return fn() + +proc second(): string = + return "second" + +echo first(second) diff --git a/Task/Higher-order-functions/Oforth/higher-order-functions.oforth b/Task/Higher-order-functions/Oforth/higher-order-functions.oforth new file mode 100644 index 0000000000..cb4f9c1ea4 --- /dev/null +++ b/Task/Higher-order-functions/Oforth/higher-order-functions.oforth @@ -0,0 +1 @@ +[1, 2, 3, 4, 5 ] map(#1+) diff --git a/Task/Higher-order-functions/Phix/higher-order-functions.phix b/Task/Higher-order-functions/Phix/higher-order-functions.phix new file mode 100644 index 0000000000..f88b3fb30b --- /dev/null +++ b/Task/Higher-order-functions/Phix/higher-order-functions.phix @@ -0,0 +1,9 @@ +procedure use(integer fi, integer a, integer b) + print(1,call_func(fi,{a,b})) +end procedure + +function add(integer a, integer b) + return a + b +end function + +use(routine_id("add"),23,45) diff --git a/Task/Higher-order-functions/Sidef/higher-order-functions.sidef b/Task/Higher-order-functions/Sidef/higher-order-functions.sidef new file mode 100644 index 0000000000..cde76f8254 --- /dev/null +++ b/Task/Higher-order-functions/Sidef/higher-order-functions.sidef @@ -0,0 +1,10 @@ +func first(f) { + return f(); +} + +func second { + return "second"; +} + +say first(second); # => "second" +say first(func { "third" }); # => "third" diff --git a/Task/Higher-order-functions/Sparkling/higher-order-functions.sparkling b/Task/Higher-order-functions/Sparkling/higher-order-functions.sparkling new file mode 100644 index 0000000000..994de43fa7 --- /dev/null +++ b/Task/Higher-order-functions/Sparkling/higher-order-functions.sparkling @@ -0,0 +1,6 @@ +function call_me(func, arg) { + return func(arg); +} + +let answer = call_me(function(x) { return 6 * x; }, 7); +print(answer); diff --git a/Task/Higher-order-functions/Swift/higher-order-functions-1.swift b/Task/Higher-order-functions/Swift/higher-order-functions-1.swift new file mode 100644 index 0000000000..874b419efe --- /dev/null +++ b/Task/Higher-order-functions/Swift/higher-order-functions-1.swift @@ -0,0 +1,3 @@ +func func1(f: String->String) -> String { return f("a string") } +func func2(s: String) -> String { return "func2 called with " + s } +println(func1(func2)) // prints "func2 called with a string" diff --git a/Task/Higher-order-functions/Swift/higher-order-functions-2.swift b/Task/Higher-order-functions/Swift/higher-order-functions-2.swift new file mode 100644 index 0000000000..d01a897ce7 --- /dev/null +++ b/Task/Higher-order-functions/Swift/higher-order-functions-2.swift @@ -0,0 +1,2 @@ +func func3(f: (Int,Int)->T) -> T { return f(1, 2) } +println(func3 {(x, y) in x + y}) // prints "3" diff --git a/Task/Higher-order-functions/Ursa/higher-order-functions.ursa b/Task/Higher-order-functions/Ursa/higher-order-functions.ursa new file mode 100644 index 0000000000..c9c4e3e929 --- /dev/null +++ b/Task/Higher-order-functions/Ursa/higher-order-functions.ursa @@ -0,0 +1,10 @@ +def first (function f) + return (f) +end + +def second () + return "second" +end + +out (first second) endl console +# "second" is output to the console diff --git a/Task/Higher-order-functions/jq/higher-order-functions-1.jq b/Task/Higher-order-functions/jq/higher-order-functions-1.jq new file mode 100644 index 0000000000..9dca6bd416 --- /dev/null +++ b/Task/Higher-order-functions/jq/higher-order-functions-1.jq @@ -0,0 +1,8 @@ +def foo( filter ): + ("world" | filter) as $str + | "hello \($str)" ; + +# blue is defined here as a filter that adds blue to its input: +def blue: "blue \(.)"; + +foo( blue ) # prints "hello blue world" diff --git a/Task/Higher-order-functions/jq/higher-order-functions-2.jq b/Task/Higher-order-functions/jq/higher-order-functions-2.jq new file mode 100644 index 0000000000..184d141e78 --- /dev/null +++ b/Task/Higher-order-functions/jq/higher-order-functions-2.jq @@ -0,0 +1,3 @@ +def g(f; x; y): [x,y] | f; + +g(add; 2; 3) # => 5 diff --git a/Task/Higher-order-functions/jq/higher-order-functions-3.jq b/Task/Higher-order-functions/jq/higher-order-functions-3.jq new file mode 100644 index 0000000000..8e82abec64 --- /dev/null +++ b/Task/Higher-order-functions/jq/higher-order-functions-3.jq @@ -0,0 +1,4 @@ +def is_even: + if floor == . then (. % 2) == 0 + else error("is_even expects its input to be an integer") + end; diff --git a/Task/Higher-order-functions/jq/higher-order-functions-4.jq b/Task/Higher-order-functions/jq/higher-order-functions-4.jq new file mode 100644 index 0000000000..97f67f2010 --- /dev/null +++ b/Task/Higher-order-functions/jq/higher-order-functions-4.jq @@ -0,0 +1,26 @@ +# Are all integers between 1 and 5 even? +# For this example, we will use all/2 even +# though it requires a release of jq after jq 1.4; +# we do so to highlight the fact that all/2 +# terminates the generator once the condition is satisfied: +all( range(1;6); is_even ) +false + +# Display the even integers in the given range: +range(1;6) | select(is_even) +2 +4 + +# Evaluate is_even for each integer in an array +[range(1;6)] | map(is_even) +[false, true, false, true, false] + +# Note that in jq, there is actually no need to call +# a higher-order function in cases like this. +# For example one can simply write: +range(1;6) | is_even +false +true +false +true +false diff --git a/Task/History-variables/EchoLisp/history-variables.echolisp b/Task/History-variables/EchoLisp/history-variables.echolisp new file mode 100644 index 0000000000..692015161a --- /dev/null +++ b/Task/History-variables/EchoLisp/history-variables.echolisp @@ -0,0 +1,22 @@ +(define-syntax-rule (make-h-var name) (define name (stack (gensym)))) +(define-syntax-rule (h-get name) (stack-top name)) +(define-syntax-rule (h-set name value) (push name value)) +(define-syntax-rule (h-undo name) + (begin + (pop name) + (when ( stack-empty? name) (error "no more values" 'name)) + (stack-top name))) + +(define-syntax-rule (h-values name) (stack->list name)) +;; usage +(make-h-var x)→ x + +(h-set x 42) → 42 +(h-set x 666)→ 666 +(h-set x 'elvis)→ elvis +(h-values x) → (42 666 elvis) ;; historized values + +(h-get x) → elvis +(h-undo x)→ 666 +(h-undo x) → 42 +(h-undo x) → ❌ error: no more values x diff --git a/Task/History-variables/Peloton/history-variables-1.peloton b/Task/History-variables/Peloton/history-variables-1.peloton new file mode 100644 index 0000000000..6b41a128ad --- /dev/null +++ b/Task/History-variables/Peloton/history-variables-1.peloton @@ -0,0 +1,11 @@ +Turn history on <@ DEFHST>__on +Notify Protium we are interested in the variable mv +<@ DEFHST>mv +Assign a value: <@ LETVARLIT>mv|first value<@ SAYVAR>mv +Reassign the value: <@ LETVARLIT>mv|second value<@ SAYVAR>mv +Reassign the value: <@ LETVARLIT>mv|third value<@ SAYVAR>mv +Dump history <@ SAYDMPHSTVAR>mv +Current value: <@ SAYVAR>mv +Undo once: <@ ACTUNDVAR>mv<@ SAYVAR>mv +Undo twice: <@ ACTUNDVAR>mv<@ SAYVAR>mv +Turn history off <@ DEFHST>__off diff --git a/Task/History-variables/Peloton/history-variables-2.peloton b/Task/History-variables/Peloton/history-variables-2.peloton new file mode 100644 index 0000000000..8838f81f41 --- /dev/null +++ b/Task/History-variables/Peloton/history-variables-2.peloton @@ -0,0 +1,11 @@ +Turn history on <# 定义变量史>__on +Notify Protium we are interested in the variable mv +<# 定义变量史>mv +Assign a value: <# 指定变量字串>mv|first value<# 显示变量>mv +Reassign the value: <# 指定变量字串>mv|second value<# 显示变量>mv +Reassign the value: <# 指定变量字串>mv|third value<# 显示变量>mv +Dump history <# 显示全内容变量史变量>mv +Current value: <# 显示变量>mv +Undo once: <# 运行撤消变量>mv<# 显示变量>mv +Undo twice: <# 运行撤消变量>mv<# 显示变量>mv +Turn history off <# 定义变量史>__off diff --git a/Task/History-variables/Sidef/history-variables.sidef b/Task/History-variables/Sidef/history-variables.sidef new file mode 100644 index 0000000000..da18f6b561 --- /dev/null +++ b/Task/History-variables/Sidef/history-variables.sidef @@ -0,0 +1,28 @@ +class HistoryVar(v) { + + has history = [] + has variable = v + + method ≔(value) { + history << variable + variable = value + } + + method to_s { + "#{variable}" + } + + method AUTOLOAD(_, name, *args) { + variable.(name)(args...) + } +} + +var foo = HistoryVar(0) + +foo ≔ 1 +foo ≔ 2 +foo ≔ foo+3 +foo ≔ 42 + +say "History: #{foo.history}" +say "Current value: #{foo}" diff --git a/Task/History-variables/Swift/history-variables-1.swift b/Task/History-variables/Swift/history-variables-1.swift new file mode 100644 index 0000000000..46a730839a --- /dev/null +++ b/Task/History-variables/Swift/history-variables-1.swift @@ -0,0 +1,11 @@ +var historyOfHistory = [Int]() +var history:Int = 0 { + willSet { + historyOfHistory.append(history) + } +} + +history = 2 +history = 3 +history = 4 +println(historyOfHistory) diff --git a/Task/History-variables/Swift/history-variables-2.swift b/Task/History-variables/Swift/history-variables-2.swift new file mode 100644 index 0000000000..03e2376d0c --- /dev/null +++ b/Task/History-variables/Swift/history-variables-2.swift @@ -0,0 +1,38 @@ +struct History { + + private var _history = [T]() + var history : [T] { + return _history + } + + var now : T { + return history.last! + } + + init(_ firstValue:T) { + _history = [firstValue] + } + + mutating func set(newValue:T) { + _history.append(newValue) + } + + mutating func undo() -> T { + guard _history.count > 1 else { return _history.first! } + _history.removeLast() + return _history.last! + } +} + +var h = History("First") +h.set("Next") +h.set("Then") +h.set("Finally") +h.history // output ["First", "Next", "Then", "Finally"] + +h.now // outputs "Finally" +h.undo() // outputs "Then" +h.undo() // outputs "Next" +h.undo() // outputs "First" +h.undo() // outputs "First", since it can't roll back any further +h.undo() // outputs "First" diff --git a/Task/Hofstadter-Conway-$10,000-sequence/EchoLisp/hofstadter-conway-$10,000-sequence.echolisp b/Task/Hofstadter-Conway-$10,000-sequence/EchoLisp/hofstadter-conway-$10,000-sequence.echolisp new file mode 100644 index 0000000000..b9e051ff97 --- /dev/null +++ b/Task/Hofstadter-Conway-$10,000-sequence/EchoLisp/hofstadter-conway-$10,000-sequence.echolisp @@ -0,0 +1,28 @@ +(decimals 4) +(cache-size 2000000) + +(define (a n) + (+ (a (a (1- n))) (a (- n (a (1- n)))))) + +(remember 'a #(0 1 1)) ;; memoize + +;; prints max a(n)/n in [2**i 2**i+1] intervals +;; return Mallows number checked up to 2**20 +(define (task (maxv) (start 1) (end 2) (v) (mrange 0)) + (for ((i (in-range 1 21))) + (set! maxv 0) + + (for ((n (in-range start end))) + (set! v (// (a n) n)) + #:when (> v maxv) + (set! maxv v)) + (when (and (zero? mrange) (< maxv 0.55)) (set! mrange end)) + + (printf "[%d .. %d] → max a(n)/n: %d " start end maxv) + (set! start end) + (set! end (* start 2))) + +;; mallows + (for ((n (in-range mrange 2 -1))) + #:break (> (// (a n) n) 0.55) => n ) + ) diff --git a/Task/Hofstadter-Conway-$10,000-sequence/FutureBasic/hofstadter-conway-$10,000-sequence.futurebasic b/Task/Hofstadter-Conway-$10,000-sequence/FutureBasic/hofstadter-conway-$10,000-sequence.futurebasic new file mode 100644 index 0000000000..7230d6721b --- /dev/null +++ b/Task/Hofstadter-Conway-$10,000-sequence/FutureBasic/hofstadter-conway-$10,000-sequence.futurebasic @@ -0,0 +1,46 @@ +include "ConsoleWindow" + +// Set width of tab +def tab 9 + +dim as long Mallows, n, pow2, p2, pPos, uprLim +dim as double p +print + +// Adjust array elements depending on size of sequence +_maxArrayElements = 1200000 + +input "Enter upper limit between 1 and 20 (Enter 20 gives 2^20): "; uprLim + +dim as double r +dim as long a( _maxArrayElements ) + +if uprLim < 1 or uprLim > 20 then uprLim = 20 + +a(1) = 1 +a(2) = 1 +pow2 = 2 +p2 = 2 ^ pow2 +p = 0.5 +pPos = 0 + +print + +for n = 3 to 2 ^ uprLim + a(n) = a( a( n-1 ) ) + a( n-a( n-1 ) ) + r = a(n) / n + if r >= 0.55 then Mallows = n + if r > p + p = r + pPos = n + end if + + if n == p2 + print "Maximum of a(n)/n between", " 2^"; pow2-1; " and 2^"; pow2," is "; p;, " at n = "; pPos + pow2 = pow2 + 1 + p2 = 2 ^ pow2 + p = 0.5 + end if +next +print +print "Dr. Mallow's winning number is:"; Mallows diff --git a/Task/Hofstadter-Conway-$10,000-sequence/Nim/hofstadter-conway-$10,000-sequence.nim b/Task/Hofstadter-Conway-$10,000-sequence/Nim/hofstadter-conway-$10,000-sequence.nim new file mode 100644 index 0000000000..c90f24d8b3 --- /dev/null +++ b/Task/Hofstadter-Conway-$10,000-sequence/Nim/hofstadter-conway-$10,000-sequence.nim @@ -0,0 +1,21 @@ +import strutils + +const last = 1 shl 20 + +var aList: array[last + 1, int] +aList[0..2] = [-50_000, 1, 1] +var + v = aList[2] + k1 = 2 + lg2 = 1 + aMax = 0.0 + +for n in 3..last: + v = aList[v] + aList[n-v] + aList[n] = v + aMax = max(aMax, v.float / n.float) + if (k1 and n) == 0: + echo "Maximum between 2^$# and 2^$# was $#".format(lg2, lg2+1, aMax) + aMax = 0 + inc lg2 + k1 = n diff --git a/Task/Hofstadter-Conway-$10,000-sequence/Oforth/hofstadter-conway-$10,000-sequence.oforth b/Task/Hofstadter-Conway-$10,000-sequence/Oforth/hofstadter-conway-$10,000-sequence.oforth new file mode 100644 index 0000000000..1905b4a993 --- /dev/null +++ b/Task/Hofstadter-Conway-$10,000-sequence/Oforth/hofstadter-conway-$10,000-sequence.oforth @@ -0,0 +1,18 @@ +: hofstadter(n) +| l i | + ListBuffer newSize(n) dup add(1) dup add(1) ->l + n 2 - loop: i [ l at(l last) l at(l size l last - 1+ ) + l add ] + l dup freeze ; + +: hofTask +| h m i | + 2 20 pow ->m + hofstadter(m) m seq zipWith(#[ tuck asFloat / swap Pair new ]) ->h + + 19 loop: i [ + i . "^2 ==>" . + h extract(2 i pow , 2 i 1+ pow) reduce(#maxKey) println + ] + + "Mallows number ==>" . h reverse detect(#[ first 0.55 >= ], true) println +; diff --git a/Task/Hofstadter-Conway-$10,000-sequence/Ring/hofstadter-conway-$10,000-sequence.ring b/Task/Hofstadter-Conway-$10,000-sequence/Ring/hofstadter-conway-$10,000-sequence.ring new file mode 100644 index 0000000000..9a5aa6ae43 --- /dev/null +++ b/Task/Hofstadter-Conway-$10,000-sequence/Ring/hofstadter-conway-$10,000-sequence.ring @@ -0,0 +1,21 @@ +decimals(9) +size = 15 +a = list(pow(2,size)) +a[1]=1 +a[2]=1 +power=2 +p2=pow(2,power) +peak=0.5 +peakpos=0 +for n=3 to pow(2,size) + a[n]=a[a[n-1]]+a[n-a[n-1]] + r=a[n]/n + if r>=0.55 mallows=n ok + if r>peak peak=r peakpos=n ok + if n=p2 + see "maximum between 2^" + (power - 1) + " and 2^" + power + " is " + peak + " at n=" + peakpos + nl + power += 1 + p2=pow(2,power) + peak=0.5 ok +next +see "mallows number is : " + mallows + nl diff --git a/Task/Hofstadter-Conway-$10,000-sequence/Sidef/hofstadter-conway-$10,000-sequence.sidef b/Task/Hofstadter-Conway-$10,000-sequence/Sidef/hofstadter-conway-$10,000-sequence.sidef new file mode 100644 index 0000000000..10b4fe21f8 --- /dev/null +++ b/Task/Hofstadter-Conway-$10,000-sequence/Sidef/hofstadter-conway-$10,000-sequence.sidef @@ -0,0 +1,25 @@ +class HofstadterConway10000 { + has sequence = [nil, 1, 1] + + method term(n {.is_pos}) { + var a = sequence + a.len .. n -> each {|i| a[i] = a[a[i-1]]+a[i-a[i-1]] } + a[n] + } +} + +var hc = HofstadterConway10000() + +var mallows = nil +for i in (1..19) { + var j = i+1 + var (max_n, max_v) = (-1, -1) + for n in (1< max_v) + mallows = n if (v >= 0.55) + } + say ("maximum between 2^%2d and 2^%2d occurs at%7d: %.8f" % (i, j, max_n, max_v)) +} + +say "the mallows number is #{mallows}" diff --git a/Task/Hofstadter-Conway-$10,000-sequence/Swift/hofstadter-conway-$10,000-sequence.swift b/Task/Hofstadter-Conway-$10,000-sequence/Swift/hofstadter-conway-$10,000-sequence.swift new file mode 100644 index 0000000000..e5414925fd --- /dev/null +++ b/Task/Hofstadter-Conway-$10,000-sequence/Swift/hofstadter-conway-$10,000-sequence.swift @@ -0,0 +1,29 @@ +func doSqnc(m:Int) { + var aList = [Int](count: m + 1, repeatedValue: 0) + var k1 = 2 + var lg2 = 1 + var amax:Double = 0 + aList[0] = 1 + aList[1] = 1 + + var v = aList[2] + + for n in 2...m { + let add = aList[v] + aList[n - v] + aList[n] = add + v = aList[n] + + if amax < Double(v) * 1.0 / Double(n) { + amax = Double(v) * 1.0 / Double(n) + } + + if (k1 & n == 0) { + println("Maximum between 2^\(lg2) and 2^\(lg2 + 1) was \(amax)") + amax = 0 + lg2++ + } + k1 = n + } +} + +doSqnc(1 << 20) diff --git a/Task/Hofstadter-Figure-Figure-sequences/EchoLisp/hofstadter-figure-figure-sequences-1.echolisp b/Task/Hofstadter-Figure-Figure-sequences/EchoLisp/hofstadter-figure-figure-sequences-1.echolisp new file mode 100644 index 0000000000..a43d616013 --- /dev/null +++ b/Task/Hofstadter-Figure-Figure-sequences/EchoLisp/hofstadter-figure-figure-sequences-1.echolisp @@ -0,0 +1,11 @@ +(define (FFR n) + (+ (FFR (1- n)) (FFS (1- n)))) + +(define (FFS n) + (define next (1+ (FFS (1- n)))) + (for ((k (in-naturals next))) + #:break (not (vector-search* k (cache 'FFR))) => k + )) + +(remember 'FFR #(0 1)) ;; init cache +(remember 'FFS #(0 2)) diff --git a/Task/Hofstadter-Figure-Figure-sequences/EchoLisp/hofstadter-figure-figure-sequences-2.echolisp b/Task/Hofstadter-Figure-Figure-sequences/EchoLisp/hofstadter-figure-figure-sequences-2.echolisp new file mode 100644 index 0000000000..fd15688163 --- /dev/null +++ b/Task/Hofstadter-Figure-Figure-sequences/EchoLisp/hofstadter-figure-figure-sequences-2.echolisp @@ -0,0 +1,8 @@ +(define-macro m-range [a .. b] (range a (1+ b))) + +(map FFR [1 .. 10]) + → (1 3 7 12 18 26 35 45 56 69) + +;; checking +(equal? [1 .. 1000] (list-sort < (append (map FFR [1 .. 40]) (map FFS [1 .. 960])))) + → #t diff --git a/Task/Hofstadter-Figure-Figure-sequences/Nim/hofstadter-figure-figure-sequences.nim b/Task/Hofstadter-Figure-Figure-sequences/Nim/hofstadter-figure-figure-sequences.nim new file mode 100644 index 0000000000..7c359f6d79 --- /dev/null +++ b/Task/Hofstadter-Figure-Figure-sequences/Nim/hofstadter-figure-figure-sequences.nim @@ -0,0 +1,33 @@ +var cr = @[1] +var cs = @[2] + +proc extendRS = + let x = cr[cr.high] + cs[cr.high] + cr.add x + for y in cs[cs.high] + 1 .. 0 + while n > cr.len: extendRS() + cr[n - 1] + +proc ffs(n): int = + assert n > 0 + while n > cs.len: extendRS() + cs[n - 1] + +for i in 1..10: stdout.write ffr i," " +echo "" + +var bin: array[1..1000, int] +for i in 1..40: inc bin[ffr i] +for i in 1..960: inc bin[ffs i] +var all = true +for x in bin: + if x != 1: + all = false + break + +if all: echo "All Integers 1..1000 found OK" +else: echo "All Integers 1..1000 NOT found only once: ERROR" diff --git a/Task/Hofstadter-Figure-Figure-sequences/Oforth/hofstadter-figure-figure-sequences.oforth b/Task/Hofstadter-Figure-Figure-sequences/Oforth/hofstadter-figure-figure-sequences.oforth new file mode 100644 index 0000000000..0f15b782cc --- /dev/null +++ b/Task/Hofstadter-Figure-Figure-sequences/Oforth/hofstadter-figure-figure-sequences.oforth @@ -0,0 +1,21 @@ +tvar: R +ListBuffer new 1 over add R put + +tvar: S +ListBuffer new 2 over add S put + +: buildnext +| r s current i | + R at ->r + S at ->s + r last r size s at + dup ->current r add + s last 1+ current 1- for: i [ i s add ] + current 1+ s add ; + +: ffr(n) + while ( R at size n < ) [ buildnext ] + n R at at ; + +: ffs(n) + while ( S at size n < ) [ buildnext ] + n S at at ; diff --git a/Task/Hofstadter-Figure-Figure-sequences/Sidef/hofstadter-figure-figure-sequences.sidef b/Task/Hofstadter-Figure-Figure-sequences/Sidef/hofstadter-figure-figure-sequences.sidef new file mode 100644 index 0000000000..ce099194fd --- /dev/null +++ b/Task/Hofstadter-Figure-Figure-sequences/Sidef/hofstadter-figure-figure-sequences.sidef @@ -0,0 +1,35 @@ +var r = [nil, 1] +var s = [nil, 2] + +func ffsr(n) { + while(r.end < n) { + r << s[r.end]+r[-1]; + s << [(s[-1]+1 .. r[-1]-1)..., r[-1]+1].grep{ s[-1] < _ }... + } + return n; +} + +func ffr(n) { r[ffsr(n)] } +func ffs(n) { s[ffsr(n)] } + +printf(" i: R(i) S(i)\n"); +printf("==============\n"); +10.of { |i| + printf("%3d: %3d %3d\n", i, ffr(i), ffs(i)) +} +printf("\nR(40)=%3d S(960)=%3d R(41)=%3d\n", ffr(40), ffs(960), ffr(41)); + +var seen = Hash() + +40.of { |i| seen{ffr(i)} := 0 ++ } +960.of { |i| seen{ffs(i)} := 0 ++ } + +if (seen.count {|k,v| (k.to_i >= 1) && (k.to_i <= 1000) && (v == 1) } == 1000) { + say "All occured exactly once."; +} +else { + var missed = (1..1000 -> grep { !seen.has_key(_) }) + var dupped = seen.grep { |_, v| v > 1 }.keys.sort; + say "These were missed: #{missed}"; + say "These were duplicated: #{dupped}"; +} diff --git a/Task/Hofstadter-Q-sequence/ERRE/hofstadter-q-sequence.erre b/Task/Hofstadter-Q-sequence/ERRE/hofstadter-q-sequence.erre new file mode 100644 index 0000000000..7e03bda76d --- /dev/null +++ b/Task/Hofstadter-Q-sequence/ERRE/hofstadter-q-sequence.erre @@ -0,0 +1,35 @@ +PROGRAM HOFSTADER_Q + +! +! for rosettacode.org +! + +DIM Q%[10000] + +PROCEDURE QSEQUENCE(Q,FLAG%->SEQ$) +! if FLAG% is true accumulate sequence in SEQ$ +! (attention to string var lenght=255) +! otherwise calculate values in Q%[] only + + LOCAL N + Q%[1]=1 + Q%[2]=1 + SEQ$="1 1" + IF NOT FLAG% THEN Q=NUM END IF + FOR N=3 TO Q DO + Q%[N]=Q%[N-Q%[N-1]]+Q%[N-Q%[N-2]] + IF FLAG% THEN SEQ$=SEQ$+STR$(Q%[N]) END IF + END FOR +END PROCEDURE + +BEGIN + NUM=10000 + QSEQUENCE(10,TRUE->SEQ$) + PRINT("Q-sequence(1..10) : ";SEQ$) + QSEQUENCE(1000,FALSE->SEQ$) + PRINT("1000th number of Q sequence : ";Q%[1000]) + FOR N=2 TO NUM DO + IF Q%[N]q + 0 3 100000 for: i [ + q add(q at(i q at(i 1-) -) q at(i q at(i 2 -) -) +) + q at(i) q at(i 1-) < ifTrue: [ 1+ ] + ] + q left(10) println q at(1000) println println ; diff --git a/Task/Hofstadter-Q-sequence/Ring/hofstadter-q-sequence.ring b/Task/Hofstadter-Q-sequence/Ring/hofstadter-q-sequence.ring new file mode 100644 index 0000000000..7ac3fc92c6 --- /dev/null +++ b/Task/Hofstadter-Q-sequence/Ring/hofstadter-q-sequence.ring @@ -0,0 +1,8 @@ +n = 20 +aList = list(n) +aList[1] = 1 +aList[2] = 1 +for i = 1 to n + if i >= 3 aList[i] = ( aList[i - aList[i-1]] + aList[i - aList[i-2]] ) ok + if i <= 20 see "n = " + string(i) + " : "+ aList[i] + nl ok +next diff --git a/Task/Hofstadter-Q-sequence/Sidef/hofstadter-q-sequence-1.sidef b/Task/Hofstadter-Q-sequence/Sidef/hofstadter-q-sequence-1.sidef new file mode 100644 index 0000000000..6d5da09d2e --- /dev/null +++ b/Task/Hofstadter-Q-sequence/Sidef/hofstadter-q-sequence-1.sidef @@ -0,0 +1,8 @@ +func Q(n) is cached { + n <= 2 ? 1 + : Q(n - Q(n-1))+Q(n-Q(n-2)) +} + +say "First 10 terms: #{10.of {|n| Q(n) }.dump }" +say "Term 1000: #{Q(1000)}" +say "Terms less than preceding in first 100k: #{2..100000->count{|i|Q(i)count{|i|Q[i] 1 + aq[2] = 1 +ENDIF +k = 0 +FOR i = 3 TO n + aq[i] = aq[i - aq[i-1]] + aq[i-aq[i-2]] + IF aq(i) < aq(i-1) + k = k + 1 + ENDIF +ENDFOR +RETURN aq[n] +ENDFUNC diff --git a/Task/Hofstadter-Q-sequence/jq/hofstadter-q-sequence-1.jq b/Task/Hofstadter-Q-sequence/jq/hofstadter-q-sequence-1.jq new file mode 100644 index 0000000000..1f345bcc18 --- /dev/null +++ b/Task/Hofstadter-Q-sequence/jq/hofstadter-q-sequence-1.jq @@ -0,0 +1,28 @@ +# For n>=2, Q(n) = Q(n - Q(n-1)) + Q(n - Q(n-2)) +def Q: + def Q(n): + n as $n + | (if . == null then [1,1,1] else . end) as $q + | if $q[$n] != null then $q + else + $q | Q($n-1) as $q1 + | $q1 | Q($n-2) as $q2 + | $q2 | Q($n - $q2[$n - 1]) as $q3 # Q(n - Q(n-1)) + | $q3 | Q($n - $q3[$n - 2]) as $q4 # Q(n - Q(n-2)) + | ($q4[$n - $q4[$n-1]] + $q4[$n - $q4[$n -2]]) as $ans + | $q4 | setpath( [$n]; $ans) + end ; + + . as $n | null | Q($n) | .[$n]; + +# count the number of times Q(i) > Q(i+1) for 0 < i < n +def flips(n): + (reduce range(3; n) as $n + ([1,1,1]; . + [ .[$n - .[$n-1]] + .[$n - .[$n - 2 ]] ] )) as $q + | reduce range(0; n) as $i + (0; . + (if $q[$i] > $q[$i + 1] then 1 else 0 end)) ; + +# The three tasks: +((range(0;11), 1000) | "Q(\(.)) = \( . | Q)"), + +(100000 | "flips(\(.)) = \(flips(.))") diff --git a/Task/Hofstadter-Q-sequence/jq/hofstadter-q-sequence-2.jq b/Task/Hofstadter-Q-sequence/jq/hofstadter-q-sequence-2.jq new file mode 100644 index 0000000000..2c4c838b33 --- /dev/null +++ b/Task/Hofstadter-Q-sequence/jq/hofstadter-q-sequence-2.jq @@ -0,0 +1,20 @@ +$ uname -a +Darwin Mac-mini 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64 +$ time jq -r -n -f hofstadter.jq +Q(0) = 1 +Q(1) = 1 +Q(2) = 1 +Q(3) = 2 +Q(4) = 3 +Q(5) = 3 +Q(6) = 4 +Q(7) = 5 +Q(8) = 5 +Q(9) = 6 +Q(10) = 6 +Q(1000) = 502 +flips(100000) = 49798 + +real 0m0.562s +user 0m0.541s +sys 0m0.011s diff --git a/Task/Holidays-related-to-Easter/Sidef/holidays-related-to-easter.sidef b/Task/Holidays-related-to-Easter/Sidef/holidays-related-to-easter.sidef new file mode 100644 index 0000000000..5e6d435b40 --- /dev/null +++ b/Task/Holidays-related-to-Easter/Sidef/holidays-related-to-easter.sidef @@ -0,0 +1,44 @@ +require('Date::Calc'); + +var abbr = < Nil Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec >; + +var holidays = [ + [Easter => 0], + [Ascension => 39], + [Pentecost => 49], + [Trinity => 56], + [Corpus => 60], +]; + +func easter(year) { + var ay = (year % 19); + var by = int(year / 100); + var cy = (year % 100); + var dy = int(by / 4); + var ey = (by % 4); + var fy = int((by + 8) / 25); + var gy = int((by - fy + 1) / 3); + var hy = ((19*ay + by - dy - gy + 15) % 30); + var iy = int(cy / 4); + var ky = (cy % 4); + var ly = ((32 + 2*ey + 2*iy - hy - ky) % 7); + var md = (hy + ly - 7*int((ay + 11*hy + 22*ly) / 451) + 114); + var month = int(md / 31); + var day = (md % 31 + 1); + return(month, day); +} + +func cholidays(year) { + var (emon, eday) = easter(year); + printf("%4s: ", year); + say gather { + holidays.each { |holiday| + var (_, mo, da) = %S'Date::Calc'.Add_Delta_Days(year, emon, eday, holiday[1]); + take("#{holiday[0]}: #{'%02d' % da} #{abbr[mo]}") + } + }.join(', '); +} + +[400..(2100, 100), 2010..2020, 2100].flatten.each { |year| + cholidays(year); +} diff --git a/Task/Honeycombs/Phix/honeycombs.phix b/Task/Honeycombs/Phix/honeycombs.phix new file mode 100644 index 0000000000..3d31e729cf --- /dev/null +++ b/Task/Honeycombs/Phix/honeycombs.phix @@ -0,0 +1,191 @@ +include ..\arwen\arwen.ew +include ..\arwen\axtra.ew + +constant N = 5, -- columns + M = 4, -- rows + cLetter = Yellow, -- initial colour(!) + cChosen = Purple, + cPlayr2 = Purple, -- (2 player if!=c_Chosen) + cHover = White, + cLines = Black, + cSelect = Black, -- (text/list of selected letters) + cBackgnd = #EFF8FA, + letters = shuffle("ABCDEFGHIJKLMNOPQRSTUVWXYZ")[1..N*M] +sequence fonts -- list of {width,handle}, see set_font() +string chosen = "" + +constant main = create(Window, "honeycomb", 0, 0, 20, 20, 520, 540, 0), + mainDC = getPrivateDC(main), + viewDC = c_func(xCreateCompatibleDC, {NULL}), + pSize = allocate_Point() + +integer ls, -- length of a single side + dx, dy, -- bounding rectangle of a sloping side + ox, oy, -- offsets needed to center things + lw -- line width (10% of ls, tweaked) + +-- The total bounding rectange of a completed N by M honeycomb is N*(ls+dx)+dx by (2*M+1)*dy. +-- However, as space for the chosen letters, pretend there is an extra row at the bottom. +-- Use that to determine the best ls, and hence dx and dy, as the window is resized. + +constant cos60 = cos(2*PI*60/360), -- dx = ls*cos60 (cos60=0.5) + sin60 = sin(2*PI*60/360) -- dy = ls*sin60 + +function font_info(integer size) +atom hFont = createFontForDC(viewDC, "Calibri", size, Bold) + {} = selectObject(viewDC,hFont) + {} = c_func(xGetTextExtentPoint32,{viewDC,"W",1,pSize}) + return {peek4u(pSize),hFont} +end function +fonts = {font_info(1)} + +procedure set_font(atom ls) + while length(fonts)<=200 -- (arbitrary limit) + and fonts[$][1]mxb) + end if + hy = floor((gy+remainder(hx,2))/2) + end if + return {hx,hy} +end function + +integer dw = 0, dh = 0 -- client area width and height +atom bmView +integer vwX = 0, vwY = 0 -- actual size of the view bitmap + +function mainHandler(integer id, integer msg, atom wParam, object lParam) +integer ch + + if msg=WM_SIZE then + {{},{},dw,dh} = getClientRect(main) + if dw>vwX or dh>vwY then + -- we need a bigger bitmap + bmView = c_func(xCreateCompatibleBitmap, {mainDC, dw, dh}) + {} = deleteObject(selectObject(viewDC,bmView)) + {vwX,vwY} = {dw,dh} + end if + -- width = N*(ls+dx)+dx = ls*(N*(1+cos60)+cos60), + -- height = (2*M+3)*dy = ls*(2*M+3)*sin60, pick whichever fits: + ls = min(floor((dw-10)/(N*(1+cos60)+cos60)), + floor((dh-20)/((2*M+3)*sin60))) + dx = floor(ls*cos60) -- (same as ls/2) + dy = floor(ls*sin60) + ox = floor((dw-((N*(ls+dx))+dx))/2) + oy = floor((dh-((2*M+3)*dy))/2) + lw = floor((ls-10)/10)+1 + setPenWidth(lw) + set_font(ls) + elsif msg=WM_PAINT then + setPenColor(cBackgnd) + drawRectangleh(viewDC, True, 0, 0, dw, dh) + for x=1 to N do + for y=1 to M do + drawHexagon(x,y) + end for + end for + -- text/list of selected letters goes where (M+2)th row would: + setPenColor(cSelect) + wPuts2(viewDC,ox+dx+5,oy+(2*M+1)*dy+10,chosen) + -- I needed this to get xy_to_hex() working: +-- for i=1 to 400 do +-- for j=1 to 400 do +-- if xy_to_hex({i,j})={1,1} then +-- drawRectangleh(viewDC, True, i, j, i+1, j+1) +-- end if +-- end for +-- end for + void = c_func(xBitBlt,{mainDC,0,0,dw,dh,viewDC,0,0,SRCCOPY}) + elsif msg=WM_CHAR then + if wParam=VK_ESCAPE then + closeWindow(main) + if id then end if -- suppress warnings +-- elsif wParam='!' then +-- ?9/0 + else + ch = upper(wParam) + if find(ch,letters) and not find(ch,chosen) then + chosen &= ch + repaintWindow(main) + end if + end if + elsif msg=WM_MOUSEMOVE then + {mx,my} = xy_to_hex(lParam) + repaintWindow(main) + elsif msg = WM_LBUTTONDOWN then + {mx,my} = xy_to_hex(lParam) + if mx>=1 and mx<=N + and my>=1 and my<=M then + ch = letters[(my-1)*N+mx] + if find(ch,letters) and not find(ch,chosen) then + chosen &= ch + repaintWindow(main) + end if + end if + elsif msg=WM_GETMINMAXINFO then + -- below this, things stop working... + poke4(lParam+MINMAXINFO_ptMinTrackSize,{188,250}) + end if + return 0 +end function +setHandler(main,routine_id("mainHandler")) + +WinMain(main, SW_NORMAL) diff --git a/Task/Honeycombs/Sidef/honeycombs.sidef b/Task/Honeycombs/Sidef/honeycombs.sidef new file mode 100644 index 0000000000..c46b473a87 --- /dev/null +++ b/Task/Honeycombs/Sidef/honeycombs.sidef @@ -0,0 +1,84 @@ +require('Tk') + +class Honeycombs( + Number size = 36, + Array letters = @('A' .. 'Z').shuffle.first(20), +) { + + define tk = %S + has changed = Hash() + + func altitude(n) { + sqrt(3/4) * n + } + + method polygon_coordinates(x, y, size) { + var alt = altitude(size) + return (x - size, y, + x - size/2, y - alt, + x + size/2, y - alt, + x + size, y, + x + size/2, y + alt, + x - size/2, y + alt, + ); + } + + method change(canvas, id, letter_id) { + return { + canvas.itemconfigure(id, '-fill' => 'magenta') + canvas.itemconfigure(letter_id, '-fill' => 'black') + changed{id} = true + + if (20 == changed.len) { + say "All letters pressed." + canvas.MainWindow.after(10, { tk.exit }) + } + } + } + + method comb(canvas, fromx, fromy, size, count) { + for x,y in ( + RangeNum(fromx, 3*count*size - 1, 3*size) ~X + RangeNum(fromy, 7.5*size - 1, 2*altitude(size)) + ) { + var id = canvas.createPolygon( + self.polygon_coordinates(x, y, size), + '-outline' => 'black', + '-fill' => 'yellow', + '-width' => 2, + ) + var letter = letters.shift + var letter_id = canvas.createText(x, y, + '-fill' => 'red', + '-text' => letter, + '-font' => "{sans} #{size * 0.9}", + ) + canvas.MainWindow.bind('all', letter.lc, + self.change(canvas, id, letter_id)) + [id, letter_id].each { |b| + canvas.bind(b, '', + self.change(canvas, id, letter_id)) + } + } + } + + method display(title) { + fork { + var mw = %s'MainWindow'.new('-title' => title) + var canvas = mw.Canvas('-width' => 8*size, + '-height' => 8*size).pack + + self.comb(canvas, size, size, size, 3) + self.comb(canvas, size * 2.5, size + altitude(size), size, 2) + + var btn = mw.Button('-text' => 'Quit', + '-underline' => 0, + '-command' => { tk.exit }, + ).pack + mw.bind('', { btn.invoke }) + tk.MainLoop() + } + } +} + +Honeycombs().display(title: 'Honeycombs') diff --git a/Task/Horizontal-sundial-calculations/ERRE/horizontal-sundial-calculations.erre b/Task/Horizontal-sundial-calculations/ERRE/horizontal-sundial-calculations.erre new file mode 100644 index 0000000000..78409c65e4 --- /dev/null +++ b/Task/Horizontal-sundial-calculations/ERRE/horizontal-sundial-calculations.erre @@ -0,0 +1,28 @@ +PROGRAM SUN_DIAL + +FUNCTION RAD(X) + RAD=X*π/180 +END FUNCTION + +FUNCTION DEG(X) + DEG=X*180/π +END FUNCTION + +BEGIN + + INPUT("Enter latitude (degrees) : ",latitude) + INPUT("Enter longitude (degrees) : ",longitude) + INPUT("Enter legal meridian (degrees): ",meridian) + + PRINT + PRINT(" Time Sun hour angle Dial hour line angle") + PRINT("---------------------------------------------") + + FOR HOUR=6 TO 18 DO + HRA=15*HOUR-LONGITUDE+MERIDIAN-180 + HLA=DEG(ATN(SIN(RAD(LATITUDE))*TAN(RAD(HRA)))) + IF ABS(HRA)>90 THEN HLA+=180*SGN(HRA*LATITUDE) END IF + WRITE("##.## ####.### ####.###";HOUR;HRA;HLA) + END FOR + +END PROGRAM diff --git a/Task/Horizontal-sundial-calculations/FutureBasic/horizontal-sundial-calculations.futurebasic b/Task/Horizontal-sundial-calculations/FutureBasic/horizontal-sundial-calculations.futurebasic new file mode 100644 index 0000000000..9411ddfd2f --- /dev/null +++ b/Task/Horizontal-sundial-calculations/FutureBasic/horizontal-sundial-calculations.futurebasic @@ -0,0 +1,26 @@ +include "ConsoleWindow" + +local fn rad2deg( theta as double ) as double +end fn = theta * 180 / pi + +local fn deg2rad( theta as double ) as double +end fn = theta * pi / 180 + +local fn SolarHourAngle( latitude as double, longitude as double, meridian as double ) +dim as long hour +dim as double hra, hla, time +dim as Str15 ap + +print "Latitude = "; latitude; chr$(13); "Longitude = "; longitude; chr$(13); "Meridian = "; meridian +print : print "sine of latitude: "; sin(latitude * pi / 180 ); chr$(13); " diff longitude: "; longitude - meridian +print : print "Time", "Sun hour angle", "Dial hour line angle" +for hour = 6 to 18 +hra = ( 15 * hour ) - longitude + meridian - 180 +hla = fn rad2deg( atn( sin( fn deg2rad( latitude ) ) * tan( fn deg2rad( hra ) ))) +if abs( hra ) > 90 then hla = hla + 180 * sgn( hra * latitude ) +if hour > 12 then time = hour - 12 : ap = " a.m." else time = hour : ap = " p.m." +print using "##"; time; ap, using "####.##"; hra, using "####.###"; hla +next hour +end fn + +fn SolarHourAngle( -4.95, -150.5, -150.0 ) diff --git a/Task/Horizontal-sundial-calculations/LiveCode/horizontal-sundial-calculations.livecode b/Task/Horizontal-sundial-calculations/LiveCode/horizontal-sundial-calculations.livecode new file mode 100644 index 0000000000..49ff712fcc --- /dev/null +++ b/Task/Horizontal-sundial-calculations/LiveCode/horizontal-sundial-calculations.livecode @@ -0,0 +1,28 @@ +on mouseUp + ask "Enter lng,lat,meridian" + if it is empty then exit mouseup + // -150.5, -4.95, -150.0 + put item 1 of it into longitude + put item 2 of it into latitude + put item 3 of it into meridian + + repeat with hour = 6 TO 18 + put 15 *hour - longitude + meridian - 180 into hra + put rad2deg(atan(sin(deg2rad(latitude)) * tan(deg2rad(hra)))) into hla + if abs(hra) > 90 then put hla + 180 * sgn(hra *latitude) into hla + put hour && hra && hla & cr after sunhours + end repeat + put sunhours +end mouseUp + +function rad2deg theta + return theta * (180 / pi) +end rad2deg + +function deg2rad theta + return theta * (pi / 180) +end deg2rad + +function sgn x + if x >0 then return 1 else return -1 +end sgn diff --git a/Task/Horizontal-sundial-calculations/Nim/horizontal-sundial-calculations.nim b/Task/Horizontal-sundial-calculations/Nim/horizontal-sundial-calculations.nim new file mode 100644 index 0000000000..352694b477 --- /dev/null +++ b/Task/Horizontal-sundial-calculations/Nim/horizontal-sundial-calculations.nim @@ -0,0 +1,20 @@ +import rdstdin, strutils, math, strfmt + +proc radians(x): float = x * Pi / 180 +proc degrees(x): float = x * 180 / Pi + +let lat = parseFloat readLineFromStdin "Enter latitude => " +let lng = parseFloat readLineFromStdin "Enter longitude => " +let med = parseFloat readLineFromStdin "Enter legal meridian => " +echo "" + +let slat = sin radians lat +echo " sine of latitude: {:.3f}".fmt(slat) +echo " diff longitude: {:.3f}".fmt(lng-med) +echo "" +echo "Hour, sun hour angle, dial hour line angle from 6am to 6pm" + +for h in -6..6: + let hra = float(15 * h) - lng + med + let hla = degrees arctan(slat * tan radians hra) + echo "HR={:3d}; HRA={:7.3f}; HLA={:7.3f}".fmt(h, hra, hla) diff --git a/Task/Horizontal-sundial-calculations/Phix/horizontal-sundial-calculations.phix b/Task/Horizontal-sundial-calculations/Phix/horizontal-sundial-calculations.phix new file mode 100644 index 0000000000..34275755f7 --- /dev/null +++ b/Task/Horizontal-sundial-calculations/Phix/horizontal-sundial-calculations.phix @@ -0,0 +1,32 @@ +atom lat = prompt_number("Enter Latitude: ",{}) +atom lng = prompt_number("Enter Longitude: ",{}) +atom lm = prompt_number("Enter Legal Meridian: ",{}) +puts(1,'\n') + +atom ha, hla + +function Deg2Rad(atom degrees) + return degrees * PI / 180 +end function + +function Rad2Deg(atom radians) + return radians * 180 / PI +end function + +function atan2(atom y, atom x) + return 2*arctan((sqrt(power(x,2)+power(y,2)) - x)/y) +end function + +atom s_lat = sin(Deg2Rad(lat)) + +puts(1,"Hour, Sun Hour Angle, Dial Hour Line Angle\n") + +for hour = -6 to 6 do + ha = hour * 15 - lng + lm + atom s = sin(Deg2Rad(ha)) + atom c = cos(Deg2Rad(ha)) + hla = Rad2Deg(atan2(s_lat*s,c)) + printf(1,"%3d %7.3f %7.3f\n",{hour+12,ha,hla}) +end for + +{} = wait_key() diff --git a/Task/Horizontal-sundial-calculations/Sidef/horizontal-sundial-calculations.sidef b/Task/Horizontal-sundial-calculations/Sidef/horizontal-sundial-calculations.sidef new file mode 100644 index 0000000000..38d6e23b84 --- /dev/null +++ b/Task/Horizontal-sundial-calculations/Sidef/horizontal-sundial-calculations.sidef @@ -0,0 +1,23 @@ +var latitude = read('Enter latitude => ', Number); +var longitude = read('Enter longitude => ', Number); +var meridian = read('Enter legal meridian => ', Number); + +var lat_sin = Math.sin(Math.deg2rad(latitude)); +var offset = (meridian - longitude); + +say('Sine of latitude: ', "%.4f" % lat_sin); +say('Longitude offset: ', offset); +say('=' * 48); +say(' Hour : Sun hour angle° : Dial hour line angle°'); + +for hour in range(-6, 6) { + var sun_deg = (15*hour + offset); + var line_deg = Math.rad2deg( + Math.atan2( + Math.sin(Math.deg2rad(sun_deg)) * lat_sin, + Math.cos(Math.deg2rad(sun_deg)) + ) + ) + printf("%2d %s %7.3f %7.3f\n", + (hour + 12) % 12 || 12, (hour < 0 ? 'AM' : 'PM'), sun_deg, line_deg); +} diff --git a/Task/Horners-rule-for-polynomial-evaluation/ERRE/horners-rule-for-polynomial-evaluation.erre b/Task/Horners-rule-for-polynomial-evaluation/ERRE/horners-rule-for-polynomial-evaluation.erre new file mode 100644 index 0000000000..166287b6a1 --- /dev/null +++ b/Task/Horners-rule-for-polynomial-evaluation/ERRE/horners-rule-for-polynomial-evaluation.erre @@ -0,0 +1,21 @@ +PROGRAM HORNER + +! 2 3 +! polynomial is -19+7x-4x +6x +! + +DIM C[3] + +PROCEDURE HORNER(C[],X->RES) + LOCAL I%,V + FOR I%=UBOUND(C,1) TO 0 STEP -1 DO + V=V*X+C[I%] + END FOR + RES=V +END PROCEDURE + +BEGIN + C[]=(-19,7,-4,6) + HORNER(C[],3->RES) + PRINT(RES) +END PROGRAM diff --git a/Task/Horners-rule-for-polynomial-evaluation/EchoLisp/horners-rule-for-polynomial-evaluation-1.echolisp b/Task/Horners-rule-for-polynomial-evaluation/EchoLisp/horners-rule-for-polynomial-evaluation-1.echolisp new file mode 100644 index 0000000000..51f7bfbc4a --- /dev/null +++ b/Task/Horners-rule-for-polynomial-evaluation/EchoLisp/horners-rule-for-polynomial-evaluation-1.echolisp @@ -0,0 +1,4 @@ +(define (horner x poly) +(foldr (lambda (coeff acc) (+ coeff (* acc x))) 0 poly)) + +(horner 3 '(-19 7 -4 6)) → 128 diff --git a/Task/Horners-rule-for-polynomial-evaluation/EchoLisp/horners-rule-for-polynomial-evaluation-2.echolisp b/Task/Horners-rule-for-polynomial-evaluation/EchoLisp/horners-rule-for-polynomial-evaluation-2.echolisp new file mode 100644 index 0000000000..ed8cce7573 --- /dev/null +++ b/Task/Horners-rule-for-polynomial-evaluation/EchoLisp/horners-rule-for-polynomial-evaluation-2.echolisp @@ -0,0 +1,6 @@ +(lib 'math) +Lib: math.lib loaded. + +(define P '(-19 7 -4 6)) +(poly->string 'x P) → 6x^3 -4x^2 +7x -19 +(poly 3 P) → 128 diff --git a/Task/Horners-rule-for-polynomial-evaluation/FunL/horners-rule-for-polynomial-evaluation.funl b/Task/Horners-rule-for-polynomial-evaluation/FunL/horners-rule-for-polynomial-evaluation.funl new file mode 100644 index 0000000000..ac383055b7 --- /dev/null +++ b/Task/Horners-rule-for-polynomial-evaluation/FunL/horners-rule-for-polynomial-evaluation.funl @@ -0,0 +1,5 @@ +import lists.foldr + +def horner( poly, x ) = foldr( \a, b -> a + b*x, 0, poly ) + +println( horner([-19, 7, -4, 6], 3) ) diff --git a/Task/Horners-rule-for-polynomial-evaluation/Nim/horners-rule-for-polynomial-evaluation.nim b/Task/Horners-rule-for-polynomial-evaluation/Nim/horners-rule-for-polynomial-evaluation.nim new file mode 100644 index 0000000000..11ab4fb3df --- /dev/null +++ b/Task/Horners-rule-for-polynomial-evaluation/Nim/horners-rule-for-polynomial-evaluation.nim @@ -0,0 +1,9 @@ +iterator reversed(x) = + for i in countdown(x.high, x.low): + yield x[i] + +proc horner(coeffs, x): int = + for c in reversed(coeffs): + result = result * x + c + +echo horner([-19, 7, -4, 6], 3) diff --git a/Task/Horners-rule-for-polynomial-evaluation/Potion/horners-rule-for-polynomial-evaluation.potion b/Task/Horners-rule-for-polynomial-evaluation/Potion/horners-rule-for-polynomial-evaluation.potion new file mode 100644 index 0000000000..c24f416f45 --- /dev/null +++ b/Task/Horners-rule-for-polynomial-evaluation/Potion/horners-rule-for-polynomial-evaluation.potion @@ -0,0 +1,9 @@ +horner = (x, coef) : + result = 0 + coef reverse each (a) : + result = (result * x) + a + . + result +. + +horner(3, (-19, 7, -4, 6)) print diff --git a/Task/Horners-rule-for-polynomial-evaluation/Ring/horners-rule-for-polynomial-evaluation.ring b/Task/Horners-rule-for-polynomial-evaluation/Ring/horners-rule-for-polynomial-evaluation.ring new file mode 100644 index 0000000000..9ec4c4e9a3 --- /dev/null +++ b/Task/Horners-rule-for-polynomial-evaluation/Ring/horners-rule-for-polynomial-evaluation.ring @@ -0,0 +1,12 @@ +coefficients = [-19, 7, -4, 6] +see "x = 3" + nl + +"degree = 3" + nl + +"equation = 6*x^3-4*x^2+7*x-19" + nl + +"result = " + horner(coefficients, 3) + nl + +func horner coeffs, x +w = 0 +for n = len(coeffs) to 1 step -1 + w = w * x + coeffs[n] +next +return w diff --git a/Task/Horners-rule-for-polynomial-evaluation/Sidef/horners-rule-for-polynomial-evaluation-1.sidef b/Task/Horners-rule-for-polynomial-evaluation/Sidef/horners-rule-for-polynomial-evaluation-1.sidef new file mode 100644 index 0000000000..f3f445b879 --- /dev/null +++ b/Task/Horners-rule-for-polynomial-evaluation/Sidef/horners-rule-for-polynomial-evaluation-1.sidef @@ -0,0 +1,5 @@ +func horner(coeff, x) { + coeff.reverse.reduce { |a,b| a*x + b }; +} + +say horner([-19, 7, -4, 6], 3); # => 128 diff --git a/Task/Horners-rule-for-polynomial-evaluation/Sidef/horners-rule-for-polynomial-evaluation-2.sidef b/Task/Horners-rule-for-polynomial-evaluation/Sidef/horners-rule-for-polynomial-evaluation-2.sidef new file mode 100644 index 0000000000..549b9a4a94 --- /dev/null +++ b/Task/Horners-rule-for-polynomial-evaluation/Sidef/horners-rule-for-polynomial-evaluation-2.sidef @@ -0,0 +1,6 @@ +func horner(coeff, x) { + coeff.len > 0 + && (coeff[0] + x*horner(coeff.ft(1), x)); +} + +say horner([-19, 7, -4, 6], 3); # => 128 diff --git a/Task/Horners-rule-for-polynomial-evaluation/Swift/horners-rule-for-polynomial-evaluation.swift b/Task/Horners-rule-for-polynomial-evaluation/Swift/horners-rule-for-polynomial-evaluation.swift new file mode 100644 index 0000000000..d7d6f94315 --- /dev/null +++ b/Task/Horners-rule-for-polynomial-evaluation/Swift/horners-rule-for-polynomial-evaluation.swift @@ -0,0 +1,5 @@ +func horner(coefs: [Double], x: Double) -> Double { + return reduce(lazy(coefs).reverse(), 0) { $0 * x + $1 } +} + +println(horner([-19, 7, -4, 6], 3)) diff --git a/Task/Horners-rule-for-polynomial-evaluation/Visual-FoxPro/horners-rule-for-polynomial-evaluation-1.visual b/Task/Horners-rule-for-polynomial-evaluation/Visual-FoxPro/horners-rule-for-polynomial-evaluation-1.visual new file mode 100644 index 0000000000..530522cb45 --- /dev/null +++ b/Task/Horners-rule-for-polynomial-evaluation/Visual-FoxPro/horners-rule-for-polynomial-evaluation-1.visual @@ -0,0 +1,19 @@ +LOCAL x As Double +LOCAL ARRAY aCoeffs[1] +CLEAR +CREATE CURSOR coeffs (c1 I, c2 I, c3 I, c4 I) +INSERT INTO coeffs VALUES (-19,7,-4,6) +SCATTER TO aCoeffs +x = VAL(INPUTBOX("Value of x:", "Value")) +? EvalPoly(@aCoeffs, x) +USE IN coeffs + +FUNCTION EvalPoly(c, x As Double) As Double +LOCAL s As Double, k As Integer, n As Integer +n = ALEN(c) +s = 0 +FOR k = n TO 1 STEP -1 + s = s*x + c[k] +ENDFOR +RETURN s +ENDFUNC diff --git a/Task/Horners-rule-for-polynomial-evaluation/Visual-FoxPro/horners-rule-for-polynomial-evaluation-2.visual b/Task/Horners-rule-for-polynomial-evaluation/Visual-FoxPro/horners-rule-for-polynomial-evaluation-2.visual new file mode 100644 index 0000000000..942309c706 --- /dev/null +++ b/Task/Horners-rule-for-polynomial-evaluation/Visual-FoxPro/horners-rule-for-polynomial-evaluation-2.visual @@ -0,0 +1,18 @@ +LOCAL x As Double +LOCAL ARRAY aCoeffs[1] +CLEAR +CREATE CURSOR tmp (c1 I, c2 I, c3 I, c4 I) +INSERT INTO tmp VALUES (6,-4,7,-19) +SCATTER TO aCoeffs +x = VAL(INPUTBOX("Value of x:", "Value")) +? EvalPolyDesc(@aCoeffs, x) +USE IN tmp + +FUNCTION EvalPolyDesc(c, x As Double) As Double +LOCAL s As Double, e +s = 0 +FOR EACH e IN c FOXOBJECT + s = s*x + e +ENDFOR +RETURN s +ENDFUNC diff --git a/Task/Host-introspection/FreeBASIC/host-introspection.freebasic b/Task/Host-introspection/FreeBASIC/host-introspection.freebasic new file mode 100644 index 0000000000..516ffab8d4 --- /dev/null +++ b/Task/Host-introspection/FreeBASIC/host-introspection.freebasic @@ -0,0 +1,17 @@ +' FB 1.05.0 Win64 (so little endian, 8 byte word size, expected) + +' uses intrinsic defines, set by the compiler + +#Ifdef __FB_64BIT__ + Print "Host has an 8 byte word size" +#Else + Print "Host has a 4 byte word size" +#EndIf + +#Ifdef __FB_BIGENDIAN__ + Print "Host is big endian" +#Else + Print "Host is little endian" +#EndIf + +Sleep diff --git a/Task/Host-introspection/Nim/host-introspection.nim b/Task/Host-introspection/Nim/host-introspection.nim new file mode 100644 index 0000000000..f0e5ad5095 --- /dev/null +++ b/Task/Host-introspection/Nim/host-introspection.nim @@ -0,0 +1,3 @@ +import math +echo cpuEndian +echo round(log2(float(int.high))) + 1 diff --git a/Task/Hostname/Arc/hostname.arc b/Task/Hostname/Arc/hostname.arc new file mode 100644 index 0000000000..3107c599c8 --- /dev/null +++ b/Task/Hostname/Arc/hostname.arc @@ -0,0 +1 @@ +(system "hostname -f") diff --git a/Task/Hostname/FreeBASIC/hostname.freebasic b/Task/Hostname/FreeBASIC/hostname.freebasic new file mode 100644 index 0000000000..99f7920b74 --- /dev/null +++ b/Task/Hostname/FreeBASIC/hostname.freebasic @@ -0,0 +1,13 @@ +' FB 1.05.0 Win64 + +' On Windows 10, the command line utility HOSTNAME.EXE prints the 'hostname' to the console. +' We can execute this remotely and read from its 'stdin' stream as follows: + +Dim As String hostname +Open Pipe "hostname" For Input As #1 +Input #1, hostname +Close #1 +Print hostname +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Hostname/Harbour/hostname.harbour b/Task/Hostname/Harbour/hostname.harbour new file mode 100644 index 0000000000..5a1be7680a --- /dev/null +++ b/Task/Hostname/Harbour/hostname.harbour @@ -0,0 +1 @@ +? NetName() diff --git a/Task/Hostname/LFE/hostname.lfe b/Task/Hostname/LFE/hostname.lfe new file mode 100644 index 0000000000..e7c871c5de --- /dev/null +++ b/Task/Hostname/LFE/hostname.lfe @@ -0,0 +1 @@ +(net_adm:localhost) diff --git a/Task/Hostname/Lasso/hostname-1.lasso b/Task/Hostname/Lasso/hostname-1.lasso new file mode 100644 index 0000000000..58bda1cfd9 --- /dev/null +++ b/Task/Hostname/Lasso/hostname-1.lasso @@ -0,0 +1 @@ +[web_request->httpHost] diff --git a/Task/Hostname/Lasso/hostname-2.lasso b/Task/Hostname/Lasso/hostname-2.lasso new file mode 100644 index 0000000000..c963274d3e --- /dev/null +++ b/Task/Hostname/Lasso/hostname-2.lasso @@ -0,0 +1,35 @@ +define host_name => thread { + + data + public initiated::date, // when the thread was initiated. Most likely at Lasso server startup + private hostname::string // as reported by the servers hostname + + public onCreate() => { + .reset + } + + public reset() => { + if(lasso_version(-lassoplatform) >> 'Win') => { + protect => { + local(process = sys_process('cmd',(:'hostname.exe'))) + #process -> wait + .hostname = string(#process -> readstring) -> trim& + #process -> close + } + else + protect => { + local(process = sys_process('/bin/hostname')) + #process -> wait + .hostname = string(#process -> readstring) -> trim& + #process -> close + } + } + .initiated = date(date -> format(`yyyyMMddHHmmss`)) // need to set format to get rid of nasty hidden fractions of seconds + .hostname -> size == 0 ? .hostname = 'undefined' + } + + public asString() => .hostname + +} + +host_name diff --git a/Task/Hostname/Lingo/hostname.lingo b/Task/Hostname/Lingo/hostname.lingo new file mode 100644 index 0000000000..b589fa9f3e --- /dev/null +++ b/Task/Hostname/Lingo/hostname.lingo @@ -0,0 +1,6 @@ +sx = xtra("Shell").new() +if the platform contains "win" then + hostname = sx.shell_cmd("hostname", ["eol":RETURN]).line[1] -- win 7 or later +else + hostname = sx.shell_cmd("hostname", RETURN).line[1] +end if diff --git a/Task/Hostname/LiveCode/hostname.livecode b/Task/Hostname/LiveCode/hostname.livecode new file mode 100644 index 0000000000..62a35afeb5 --- /dev/null +++ b/Task/Hostname/LiveCode/hostname.livecode @@ -0,0 +1 @@ +answer the hostName diff --git a/Task/Hostname/Nim/hostname.nim b/Task/Hostname/Nim/hostname.nim new file mode 100644 index 0000000000..5fc9bdeacd --- /dev/null +++ b/Task/Hostname/Nim/hostname.nim @@ -0,0 +1,5 @@ +import posix +const size = 64 +var s = cstring(newString(size)) +discard s.getHostname(size) +echo s diff --git a/Task/Hostname/Sidef/hostname-1.sidef b/Task/Hostname/Sidef/hostname-1.sidef new file mode 100644 index 0000000000..63e2a9cf9a --- /dev/null +++ b/Task/Hostname/Sidef/hostname-1.sidef @@ -0,0 +1,2 @@ +var sys = frequire('Sys::Hostname'); +var host = sys.hostname; diff --git a/Task/Hostname/Sidef/hostname-2.sidef b/Task/Hostname/Sidef/hostname-2.sidef new file mode 100644 index 0000000000..79109abe4b --- /dev/null +++ b/Task/Hostname/Sidef/hostname-2.sidef @@ -0,0 +1 @@ +var host = `hostname`.chomp; diff --git a/Task/Hostname/Swift/hostname.swift b/Task/Hostname/Swift/hostname.swift new file mode 100644 index 0000000000..6ab57b12a8 --- /dev/null +++ b/Task/Hostname/Swift/hostname.swift @@ -0,0 +1 @@ +print(ProcessInfo.processInfo.hostName) diff --git a/Task/Hostname/Ursa/hostname.ursa b/Task/Hostname/Ursa/hostname.ursa new file mode 100644 index 0000000000..961d716b91 --- /dev/null +++ b/Task/Hostname/Ursa/hostname.ursa @@ -0,0 +1 @@ +out (ursa.net.localhost.name) endl console diff --git a/Task/Hough-transform/SequenceL/hough-transform-1.sequencel b/Task/Hough-transform/SequenceL/hough-transform-1.sequencel new file mode 100644 index 0000000000..ff7423eda7 --- /dev/null +++ b/Task/Hough-transform/SequenceL/hough-transform-1.sequencel @@ -0,0 +1,45 @@ +import ; +import ; + +hough: int(2) * int * int * int -> int(2); +hough(image(2), thetaAxisSize, rAxisSize, minContrast) := + let + initialResult[r,theta] := 0 foreach r within 1 ... rAxisSize, theta within 1 ... thetaAxisSize; + + result := houghHelper(image, minContrast, 1, 1, initialResult); + + max := vectorMax(vectorMax(result)); + in + 255 - min(round((result * 255 / max)), 255); + +houghHelper(image(2), minContrast, x, y, result(2)) := + let + thetaAxisSize := size(head(result)); + rAxisSize := size(result); + + width := size(head(image)); + height := size(image); + maxRadius := ceiling(sqrt(width^2 + height^2)); + halfRAxisSize := rAxisSize / 2; + + rs[theta] := round((cos(theta) * x + sin(theta) * y) * halfRAxisSize / maxRadius) + halfRAxisSize + foreach theta within (0 ... (thetaAxisSize-1)) * pi / thetaAxisSize; + + newResult[r,theta] := result[r,theta] + 1 when rs[theta] = r-1 else result[r,theta]; + + nextResult := result when not checkContrast(image, x, y, minContrast) else newResult; + + nextX := 1 when x = width else x + 1; + nextY := y + 1 when x = width else y; + in + nextResult when x = width and y = height + else + houghHelper(image, minContrast, nextX, nextY, nextResult); + +checkContrast(image(2), x, y, minContrast) := + let + neighbors[i,j] := image[i,j] when i > 0 and i < size(image) and j > 0 and j < size(image[i]) + foreach i within y-1 ... y+1, + j within x-1 ... x+1; + in + some(some(abs(image[y,x] - neighbors) >= minContrast)); diff --git a/Task/Hough-transform/SequenceL/hough-transform-2.sequencel b/Task/Hough-transform/SequenceL/hough-transform-2.sequencel new file mode 100644 index 0000000000..fb10514443 --- /dev/null +++ b/Task/Hough-transform/SequenceL/hough-transform-2.sequencel @@ -0,0 +1,39 @@ +#include "SL_Generated.h" +#include "CImg.h" + +using namespace cimg_library; + +int main( int argc, char** argv ) +{ + string fileName = "Pentagon.bmp"; + if(argc > 1) fileName = argv[1]; + int thetaAxisSize = 640; if(argc > 2) thetaAxisSize = atoi(argv[2]); + int rAxisSize = 480; if(argc > 3) rAxisSize = atoi(argv[3]); + int minContrast = 64; if(argc > 4) minContrast = atoi(argv[4]); + int threads = 0; if(argc > 5) threads = atoi(argv[5]); + char titleBuffer[200]; + SLTimer t; + + CImg image(fileName.c_str()); + int imageDimensions[] = {image.height(), image.width(), 0}; + Sequence > imageSeq((void*) image.data(), imageDimensions); + Sequence< Sequence > result; + + sl_init(threads); + + t.start(); + sl_hough(imageSeq, thetaAxisSize, rAxisSize, minContrast, threads, result); + t.stop(); + + CImg resultImage(result[1].size(), result.size()); + for(int y = 0; y < result.size(); y++) + for(int x = 0; x < result[y+1].size(); x++) + resultImage(x,result.size() - 1 - y) = result[y+1][x+1]; + + sprintf(titleBuffer, "SequenceL Hough Transformation: %d X %d Image to %d X %d Result | %d Cores | Processed in %f sec\0", + image.width(), image.height(), resultImage.width(), resultImage.height(), threads, t.getTime()); + resultImage.display(titleBuffer); + + sl_done(); + return 0; +} diff --git a/Task/Hough-transform/Sidef/hough-transform.sidef b/Task/Hough-transform/Sidef/hough-transform.sidef new file mode 100644 index 0000000000..e46ebf948a --- /dev/null +++ b/Task/Hough-transform/Sidef/hough-transform.sidef @@ -0,0 +1,36 @@ +require('Imager') + +func hough(im, width=460, height=360) { + + height = 2*floor(height / 2) + + var xsize = im.getwidth + var ysize = im.getheight + + var ht = %s|Imager|.new(xsize => width, ysize => height) + var canvas = height.of { width.of(255) } + + ht.box(filled => true, color => 'white') + + var rmax = hypot(xsize, ysize) + var dr = 2*(rmax / height) + var dth = (Num.pi / width) + + for y,x in (^ysize ~X ^xsize) { + var col = im.getpixel(x => x, y => y) + var (r,g,b) = col.rgba + (r==255 && g==255 && b==255) && next + for k in ^width { + var th = dth*k + var r = (x*cos(th) + y*sin(th)) + var iry = (height/2 + int(r/dr + 0.5)) + ht.setpixel(x => k, y => iry, color => 3.of(--canvas[iry][k])) + } + } + + return ht +} + +var img = %s|Imager|.new(file => 'Pentagon.png') +var ht = hough(img) +ht.write(file => 'Hough transform.png') diff --git a/Task/Huffman-coding/Nim/huffman-coding.nim b/Task/Huffman-coding/Nim/huffman-coding.nim new file mode 100644 index 0000000000..7993791a5c --- /dev/null +++ b/Task/Huffman-coding/Nim/huffman-coding.nim @@ -0,0 +1,75 @@ +import tables, seqUtils + +const sampleString = "this is an example for huffman encoding" + +type + # Following range can be changed to produce Huffman codes on arbitrary alphabet (e.g. ternary codes) + CodeSymbol = range[0..1] + HuffCode = seq[CodeSymbol] + Node = ref object + f: int + parent: Node + case isLeaf: bool + of true: + c: char + else: + childs: array[CodeSymbol, Node] + +proc `<`(a: Node, b: Node): bool = + # For min operator + a.f < b.f + +proc `$`(hc: HuffCode): string = + result = "" + for symbol in hc: + result &= $symbol + +proc freeChildList(tree: seq[Node], parent: Node = nil): seq[Node] = + # Constructs a sequence of nodes which can be adopted + # Optional parent parameter can be set to ensure node will not adopt itself + result = @[] + for node in tree: + if node.parent == nil and node != parent: + result.add(node) + +proc connect(parent: Node, child: Node) = + # Only call this proc when sure that parent has a free child slot + child.parent = parent + parent.f += child.f + for i in parent.childs.low..parent.childs.high: + if parent.childs[i] == nil: + parent.childs[i] = child + return + +proc generateCodes(codes: TableRef[char, HuffCode], currentNode: Node, currentCode: HuffCode = @[]) = + if currentNode.isLeaf: + let key = currentNode.c + codes[key] = currentCode + return + for i in currentNode.childs.low..currentNode.childs.high: + if currentNode.childs[i] != nil: + let newCode = currentCode & i + generateCodes(codes, currentNode.childs[i], newCode) + +proc buildTree(frequencies: CountTable[char]): seq[Node] = + result = newSeq[Node](frequencies.len) + for i in result.low..result.high: + let key = toSeq(frequencies.keys)[i] + result[i] = Node(f: frequencies[key], isLeaf: true, c: key) + while result.freeChildList.len > 1: + let currentNode = new Node + result.add(currentNode) + for c in currentNode.childs: + currentNode.connect(min(result.freeChildList(currentNode))) + if result.freeChildList.len <= 1: + break + +var sampleFrequencies = initCountTable[char]() +for c in sampleString: + sampleFrequencies.inc(c) +let + tree = buildTree(sampleFrequencies) + root = tree.freeChildList[0] +var huffCodes = newTable[char, HuffCode]() +generateCodes(huffCodes, root) +echo huffCodes diff --git a/Task/Huffman-coding/Sidef/huffman-coding.sidef b/Task/Huffman-coding/Sidef/huffman-coding.sidef new file mode 100644 index 0000000000..c199665466 --- /dev/null +++ b/Task/Huffman-coding/Sidef/huffman-coding.sidef @@ -0,0 +1,54 @@ +func walk(n, s, h) { + if (n.contains(:a)) { + h{n{:a}} = s + say "#{n{:a}}: #{s}" + return nil + } + walk(n{:0}, s+'0', h) + walk(n{:1}, s+'1', h) +} + +func make_tree(text) { + var letters = Hash() + text.each { |c| letters{c} := 0 ++ } + var nodes = letters.keys.map { |l| + Hash(a => l, freq => letters{l}) + } + + var n = Hash() + while (nodes.sort_by!{|c| c{:freq} }.len > 1) { + n = Hash(:0 => nodes.shift, :1 => nodes.shift) + n{:freq} = (n{:0}{:freq} + n{:1}{:freq}) + nodes.append(n) + } + + walk(n, "", n{:tree} = Hash()) + return n +} + +func encode(s, t) { + t = t{:tree} + s.chars.map{|c| t{c} }.join +} + +func decode (enc, tree) { + var n = tree + var out = "" + + enc.each {|bit| + n = n{bit} + if (n.contains(:a)) { + out += n{:a} + n = tree + } + } + + return out +} + +var text = "this is an example for huffman encoding" +var tree = make_tree(text) +var enc = encode(text, tree) + +say enc +say decode(enc, tree) diff --git a/Task/Huffman-coding/Swift/huffman-coding.swift b/Task/Huffman-coding/Swift/huffman-coding.swift new file mode 100644 index 0000000000..7d6510e3d7 --- /dev/null +++ b/Task/Huffman-coding/Swift/huffman-coding.swift @@ -0,0 +1,66 @@ +enum HuffmanTree { + case Leaf(T) + indirect case Node(HuffmanTree, HuffmanTree) + + func printCodes(prefix: String) { + switch(self) { + case let .Leaf(c): + print("\(c)\t\(prefix)") + case let .Node(l, r): + l.printCodes(prefix + "0") + r.printCodes(prefix + "1") + } + } +} + +func buildTree(freqs: [(T, Int)]) -> HuffmanTree { + assert(freqs.count > 0, "must contain at least one character") + // leaves sorted by increasing frequency + let leaves : [(Int, HuffmanTree)] = freqs.sort { (p1, p2) in p1.1 < p2.1 }.map { (x, w) in (w, .Leaf(x)) } + // nodes sorted by increasing frequency + var nodes = [(Int, HuffmanTree)]() + // iterate through leaves and nodes in order of increasing frequency + for var i = 0, j = 0; ; { + assert(i < leaves.count || j < nodes.count) + // get subtree of least frequency + var e1 : (Int, HuffmanTree) + if j == nodes.count || i < leaves.count && leaves[i].0 < nodes[j].0 { + e1 = leaves[i] + i++ + } else { + e1 = nodes[j] + j++ + } + + // if there's no subtrees left, then that one was the answer + if i == leaves.count && j == nodes.count { + return e1.1 + } + + // get next subtree of least frequency + var e2 : (Int, HuffmanTree) + if j == nodes.count || i < leaves.count && leaves[i].0 < nodes[j].0 { + e2 = leaves[i] + i++ + } else { + e2 = nodes[j] + j++ + } + // create node from two subtrees + nodes.append((e1.0 + e2.0, .Node(e1.1, e2.1))) + } +} + +func getFreqs(seq: S) -> [(S.Generator.Element, Int)] { + var freqs : [S.Generator.Element : Int] = [:] + for c in seq { + freqs[c] = (freqs[c] ?? 0) + 1 + } + return Array(freqs) +} + +let str = "this is an example for huffman encoding" +let charFreqs = getFreqs(str.characters) +let tree = buildTree(charFreqs) +print("Symbol\tHuffman code") +tree.printCodes("") diff --git a/Task/I-before-E-except-after-C/Coco/i-before-e-except-after-c.coco b/Task/I-before-E-except-after-C/Coco/i-before-e-except-after-c.coco new file mode 100644 index 0000000000..3192e81aac --- /dev/null +++ b/Task/I-before-E-except-after-C/Coco/i-before-e-except-after-c.coco @@ -0,0 +1,13 @@ +ie-npc = ei-npc = ie-pc = ei-pc = 0 +for word of dict.toLowerCase!.match /\S+/g + ++ie-npc if /(^|[^c])ie/.test word + ++ei-npc if /(^|[^c])ei/.test word + ++ie-pc if word.indexOf('cie') > -1 + ++ei-pc if word.indexOf('cei') > -1 + +p1 = ie-npc > 2 * ei-npc +p2 = ei-pc > 2 * ie-pc + +console.log '(1) is%s plausible.', if p1 then '' else ' not' +console.log '(2) is%s plausible.', if p2 then '' else ' not' +console.log 'The whole phrase is%s plausible.', if p1 and p2 then '' else ' not' diff --git a/Task/I-before-E-except-after-C/FreeBASIC/i-before-e-except-after-c.freebasic b/Task/I-before-E-except-after-C/FreeBASIC/i-before-e-except-after-c.freebasic new file mode 100644 index 0000000000..f75b145cc4 --- /dev/null +++ b/Task/I-before-E-except-after-C/FreeBASIC/i-before-e-except-after-c.freebasic @@ -0,0 +1,50 @@ +Function getfile(file As String) As String + Dim As Integer F = Freefile + Dim As String text,intext + Open file For Input As #F + Line Input #F,text + While Not Eof(F) + Line Input #F,intext + text=text+Chr(10)+intext + Wend + close #F + Return text +End Function + +Function TALLY(instring As String,PartString As String) As Integer + Dim count As Integer + var lens2=Len(PartString) + Dim As String s=instring + Dim As Integer position=Instr(s,PartString) + If position=0 Then Return 0 + While position>0 + count=count+1 + position=Instr(position+Lens2,s,PartString) + Wend + Function=count + End Function + +Dim As String myfile="unixdict.txt" + +Dim As String wordlist= getfile(myfile) +wordlist=lcase(wordlist) + +print +print "The number of words in unixdict.txt ",TALLY(wordlist,chr(10))+1 +print +dim as integer cei=TALLY(wordlist,"cei") +print "Instances of cei",cei +dim as integer cie=TALLY(wordlist,"cie") +print "Instances of cie",cie +print +dim as integer ei=TALLY(wordlist,"ei") +print "Instances of *ei, where * is not c",ei-cei +dim as integer ie=TALLY(wordlist,"ie") +print "Instances of *ie, where * is not c",ie-cie +print +print "Conclusion:" +print "ie is plausible when not preceeded by c, the ratio is ";(ie-cie)/(ei-cei) +print "ei is not plausible when preceeded by c, the ratio is ";cei/cie +print "So, the idea is not plausible." + +Sleep diff --git a/Task/I-before-E-except-after-C/Lasso/i-before-e-except-after-c.lasso b/Task/I-before-E-except-after-C/Lasso/i-before-e-except-after-c.lasso new file mode 100644 index 0000000000..1173eb4d6e --- /dev/null +++ b/Task/I-before-E-except-after-C/Lasso/i-before-e-except-after-c.lasso @@ -0,0 +1,33 @@ +local(cie,cei,ie,ei) = (:0,0,0,0) + +local(match_ie) = regExp(`[^c]ie`) +local(match_ei) = regExp(`[^c]ei`) + +with word in include_url(`http://www.puzzlers.org/pub/wordlists/unixdict.txt`)->asString->split("\n") +where #word >> `ie` or #word >> `ei` +do { + #word >> `cie` + ? #cie++ + #word >> `cei` + ? #cei++ + + #match_ie->reset(-input=#word, -ignoreCase)&find + ? #ie++ + #match_ei->reset(-input=#word, -ignoreCase)&find + ? #ei++ +} + +local(ie_plausible) = (#ie >= (2 * #ei)) +local(cei_plausible) = (#cei >= (2 * #cie)) + +stdoutnl( + `The rule "I before E when not preceded by C" is ` + + (#ie_plausible ? '' | 'NOT-') + `PLAUSIBLE. There were ` + + #ie + ` examples and ` + #ei + ` counter-examples.` +) +stdoutnl( + `The rule "E before I when preceded by C" is ` + + (#cei_plausible ? `` | `NOT-`) + `PLAUSIBLE. There were ` + + #cei + ` examples and ` + #cie + ` counter-examples.` +) +stdoutnl(`Overall the rule is ` + (#ie_plausible and #cei_plausible ? `` | `NOT-`) + `PLAUSIBLE`) diff --git a/Task/I-before-E-except-after-C/Swift/i-before-e-except-after-c.swift b/Task/I-before-E-except-after-C/Swift/i-before-e-except-after-c.swift new file mode 100644 index 0000000000..166e571e46 --- /dev/null +++ b/Task/I-before-E-except-after-C/Swift/i-before-e-except-after-c.swift @@ -0,0 +1,55 @@ +import Foundation + +let request = NSURLRequest(URL: NSURL(string: "http://www.puzzlers.org/pub/wordlists/unixdict.txt")!) + +NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue()) {res, data, err in + if (data != nil) { + if let fileAsString = NSString(data: data, encoding: NSUTF8StringEncoding) { + var firstCase = false + var secondCase = false + var cie = 0 + var cei = 0 + var not_c_ie = 0 + var not_c_ei = 0 + let words = fileAsString.componentsSeparatedByString("\n") + for word in words { + var wordRegex = RegexMutable(word as String) + if (wordRegex["cie"]) { + cie++ + } + if (wordRegex["cei"]) { + cei++ + } + if (wordRegex["(^ie|[^c]ie)"].matches().count != 0) { + not_c_ie++ + } + if (wordRegex["(^ei|[^c]ei)"].matches().count != 0) { + not_c_ei++ + } + } + + + if (not_c_ie > not_c_ei * 2) { + println("I before E when not preceded by C is plausable") + firstCase = true + } else { + println("I before E when not preceded by C is not plausable") + } + + if (cei > cie * 2) { + secondCase = true + println("E before I when preceded by C is plausable") + } else { + println("E before I when preceded by C is not plausable") + } + + if (firstCase && secondCase) { + println("I before E except after C is plausible") + } else { + println("I before E except after C is not plausible") + } + } + } +} + +CFRunLoopRun() diff --git a/Task/I-before-E-except-after-C/jq/i-before-e-except-after-c-1.jq b/Task/I-before-E-except-after-C/jq/i-before-e-except-after-c-1.jq new file mode 100644 index 0000000000..9a027875d4 --- /dev/null +++ b/Task/I-before-E-except-after-C/jq/i-before-e-except-after-c-1.jq @@ -0,0 +1,35 @@ +def plausibility_ratio: 2; + +# scan/2 produces a stream of matches but the first match of a segment (e.g. cie) +# blocks further matches with that segment, and therefore if scan produces "ie", +# it was NOT preceded by "c". +def dictionary: + reduce .[] as $word + ( {}; + reduce ($word | scan("ie|ei|cie|cei")) as $found ( .; .[$found] += 1 )); + +def rules: + { "I before E when not preceded by C": ["ie", "ei"], + "E before I when preceded by C": ["cei", "cie"] + }; + +# Round to nearest integer or else "round-up" +def round: + if . < 0 then (-1 * ((- .) | round) | if . == -0 then 0 else . end) + else floor as $x | if (. - $x) < 0.5 then $x else $x+1 end + end; + +def assess: + (split("\n") | dictionary) as $dictionary + | rules as $rules + | ($rules | keys[]) as $key + | $rules[$key] as $fragments + | $dictionary[$fragments[0]] as $x + | $dictionary[$fragments[1]] as $y + | ($x / $y) as $ratio + | (if $ratio > plausibility_ratio then "plausible" + else "implausible" end) as $plausibility + | " -- the rule \"\($key)\" is \($plausibility) + as ratio = \($x)/\($y) ~ \($ratio * 100 |round)%" ; + +"Using the problematic criterion specified in the task requirements:", assess diff --git a/Task/I-before-E-except-after-C/jq/i-before-e-except-after-c-2.jq b/Task/I-before-E-except-after-C/jq/i-before-e-except-after-c-2.jq new file mode 100644 index 0000000000..ab5d39f24a --- /dev/null +++ b/Task/I-before-E-except-after-C/jq/i-before-e-except-after-c-2.jq @@ -0,0 +1,6 @@ +$ jq -s -R -r -f I_before_E_except_after_C.jq unixdict.txt +Using the problematic criterion specified in the task requirements: + -- the rule "E before I when preceded by C" is implausible + as ratio = 13/24 ~ 54% + -- the rule "I before E when not preceded by C" is plausible + as ratio = 464/217 ~ 214% diff --git a/Task/IBAN/FreeBASIC/iban.freebasic b/Task/IBAN/FreeBASIC/iban.freebasic new file mode 100644 index 0000000000..06e953cd18 --- /dev/null +++ b/Task/IBAN/FreeBASIC/iban.freebasic @@ -0,0 +1,72 @@ +' FB 1.05.0 Win64 + +' List updated to release 72, 25 November 2016, of IBAN Registry (75 countries) +Dim Shared countryCodes As String +countryCodes = _ + "AD24 AE23 AL28 AT20 AZ28 BA20 BE16 BG22 BH22 BR29 BY28 CH21 CR22 CY28 CZ24 DE22 " _ + "DK18 DO28 EE20 ES24 FI18 FO18 FR27 GB22 GE22 GI23 GL18 GR27 GT28 HR21 HU28 IE22 " _ + "IL23 IQ23 IS26 IT27 JO30 KW30 KZ20 LB28 LC32 LI21 LT20 LU20 LV21 MC27 MD24 ME22 " _ + "MK19 MR27 MT31 MU30 NL18 NO15 PK24 PL28 PS29 PT25 QA29 RO24 RS22 SA24 SC31 SE24 " _ + "SI19 SK24 SM27 ST25 SV28 TL23 TN24 TR26 UA29 VG24 XK20" + +Function checkCountryCode(cc As String) As Boolean + Return Instr(countryCodes, cc) +End Function + +' To avoid having to use the GMP library, a piece-wise calculation is used +Function mod97(s As String) As UInteger + Dim r As UInteger = ValULng(Left(s, 9)) Mod 97 + Dim start As UInteger = 10 + While start < Len(s) + r = ValULng(r & Mid(s, start, 7)) Mod 97 + start += 7 + Wend + Return r +End Function + +Function validateIban(iban As Const String) As Boolean + ' remove spaces from IBAN + Dim s As String = iban + Dim count As Integer = 0 + For i As Integer = 0 To Len(s) - 1 + If s[i] = 32 Then + For j As Integer = i + 1 To Len(s) - 1 + s[j - 1] = s[j] + Next + count += 1 + End If + If i = Len(s) - 1 - count Then Exit For + Next i + If count > 0 Then + s[Len(s) - count] = 0 + Dim p As UInteger Ptr = CPtr(UInteger Ptr, @s) + *(p + 1) = Len(s) - count ''change length of string in descriptor + End If + + ' check country code + Dim isValid As Boolean = checkCountryCode(Left(s, 2) + Str(Len(s))) + If Not isValid Then Return False + + ' move first 4 characters to end + s = Mid(s, 5) + Left(s, 4) + + ' replace A to Z with numbers 10 To 35 + For i As Integer = Len(s) To 1 Step -1 + If s[i - 1] >= 65 AndAlso s[i - 1] <= 90 Then + s = Left(s, i - 1) + Str(s[i - 1] - 55) + Mid(s, i + 1) + End If + Next + + ' do mod97 calculation + Return mod97(s) = 1 '' remainder needs to be 1 for validity +End Function + +Dim As String ibans(1 To 2) = {"GB82 WEST 1234 5698 7654 32", "GB82 TEST 1234 5698 7654 32"} +For i As Integer = 1 To 2 + Dim isValid As Boolean = validateIban(ibans(i)) + Print ibans(i); IIf(isValid, " : may be valid", " : is not valid") +Next + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/IBAN/Nim/iban.nim b/Task/IBAN/Nim/iban.nim new file mode 100644 index 0000000000..be1cc73094 --- /dev/null +++ b/Task/IBAN/Nim/iban.nim @@ -0,0 +1,34 @@ +import tables, strutils, re, bigints + +let countryLen = toTable({ + "AL": 28, "AD": 24, "AT": 20, "AZ": 28, "BE": 16, "BH": 22, "BA": 20, "BR": 29, + "BG": 22, "CR": 21, "HR": 21, "CY": 28, "CZ": 24, "DK": 18, "DO": 28, "EE": 20, + "FO": 18, "FI": 18, "FR": 27, "GE": 22, "DE": 22, "GI": 23, "GR": 27, "GL": 18, + "GT": 28, "HU": 28, "IS": 26, "IE": 22, "IL": 23, "IT": 27, "KZ": 20, "KW": 30, + "LV": 21, "LB": 28, "LI": 21, "LT": 20, "LU": 20, "MK": 19, "MT": 31, "MR": 27, + "MU": 30, "MC": 27, "MD": 24, "ME": 22, "NL": 18, "NO": 15, "PK": 24, "PS": 29, + "PL": 28, "PT": 25, "RO": 24, "SM": 27, "SA": 24, "RS": 22, "SK": 24, "SI": 19, + "ES": 24, "SE": 24, "CH": 21, "TN": 24, "TR": 26, "AE": 23, "GB": 22, "VG": 24}) + +proc validIban(iban: string): bool = + # Ensure upper alphanumeric input + var iban = iban.replace(" ","").replace("\t","") + if not iban.match(re"^[\dA-Z]+$"): + return false + + # Validate country code against expected length + if iban.len != countryLen[iban[0..1]]: + return false + + # Shift and convert + iban = iban[4..iban.high] & iban[0..3] + var digits = "" + for ch in iban: + case ch + of '0'..'9': digits.add($(ch.ord - '0'.ord)) + of 'A'..'Z': digits.add($(ch.ord - 'A'.ord + 10)) + else: discard + result = initBigInt(digits) mod 97 == 1 + +for account in ["GB82 WEST 1234 5698 7654 32", "GB82 TEST 1234 5698 7654 32"]: + echo account, " validation is: ", validIban account diff --git a/Task/IBAN/Sidef/iban.sidef b/Task/IBAN/Sidef/iban.sidef new file mode 100644 index 0000000000..b2101eed51 --- /dev/null +++ b/Task/IBAN/Sidef/iban.sidef @@ -0,0 +1,31 @@ +func valid_iban(iban) { + static len = Hash.new( + AD=>24, AE=>23, AL=>28, AO=>25, AT=>20, AZ=>28, BA=>20, BE=>16, BF=>27, + BG=>22, BH=>22, BI=>16, BJ=>28, BR=>29, CG=>27, CH=>21, CI=>28, CM=>27, + CR=>21, CV=>25, CY=>28, CZ=>24, DE=>22, DK=>18, DO=>28, DZ=>24, EE=>20, + EG=>27, ES=>24, FI=>18, FO=>18, FR=>27, GA=>27, GB=>22, GE=>22, GI=>23, + GL=>18, GR=>27, GT=>28, HR=>21, HU=>28, IE=>22, IL=>23, IR=>26, IS=>26, + IT=>27, JO=>30, KW=>30, KZ=>20, LB=>28, LI=>21, LT=>20, LU=>20, LV=>21, + MC=>27, MD=>24, ME=>22, MG=>27, MK=>19, ML=>28, MR=>27, MT=>31, MU=>30, + MZ=>25, NL=>18, NO=>15, PK=>24, PL=>28, PS=>29, PT=>25, QA=>29, RO=>24, + RS=>22, SA=>24, SE=>24, SI=>19, SK=>24, SM=>27, SN=>28, TN=>24, TR=>26, + UA=>29, VG=>24, + ); + + # Ensure upper alphanumeric input. + iban -= /\s+/g; + iban.uc! ~~ /^[0-9A-Z]+\z/ || return false; + + # Validate country code against expected length. + var cc = iban.substr(0, 2); + iban.len == len{cc} || return false; + + # Shift and convert. + iban.sub!(/(.{4})(.+)/, {|a,b| b+a}); + iban.gsub!(/([A-Z])/, {|a| a.ord - 55}); + + iban.to_i % 97 == 1; +} + +say valid_iban("GB82 WEST 1234 5698 7654 32"); #=> true +say valid_iban("GB82 TEST 1234 5698 7654 32"); #=> false diff --git a/Task/IBAN/jq/iban-1.jq b/Task/IBAN/jq/iban-1.jq new file mode 100644 index 0000000000..e38ad948a8 --- /dev/null +++ b/Task/IBAN/jq/iban-1.jq @@ -0,0 +1,8 @@ +# strip the input string of spaces and tabs: +gsub("[ \t]";"") +# check the string is ALPHAnumeric +| test("^[A-Z0-9]+$") + # check its length is as determined by the country code: + and length == $lengths[.[0:2]] + # check the mod 97 criterion: + and ( (.[4:] + .[0:4]) | letters2digits | remainder) == 1 diff --git a/Task/IBAN/jq/iban-2.jq b/Task/IBAN/jq/iban-2.jq new file mode 100644 index 0000000000..cf6e00c5f0 --- /dev/null +++ b/Task/IBAN/jq/iban-2.jq @@ -0,0 +1,38 @@ +def letters2digits: + 65 as $A | 90 as $Z + | ($A - 10) as $ten + | explode + | map( if $A <= . and . <= $Z + then (. - $ten) | tostring + else [.] | implode + end ) + | join(""); + +# jq currently does not have unlimited-precision integer arithmetic +# and so we define a special-purpose "mod 97" filter: +# input: a string representing a decimal +# output: its remainder modulo 97 as a number +def remainder: + if length < 15 then (.|tonumber) % 97 + else (.[0:14] | remainder | tostring) as $r1 + | ($r1 + .[14:]) | remainder + end; + +def is_valid_iban: + { + "AL": 28, "AD": 24, "AT": 20, "AZ": 28, "BE": 16, "BH": 22, "BA": 20, "BR": 29, + "BG": 22, "CR": 21, "HR": 21, "CY": 28, "CZ": 24, "DK": 18, "DO": 28, "EE": 20, + "FO": 18, "FI": 18, "FR": 27, "GE": 22, "DE": 22, "GI": 23, "GR": 27, "GL": 18, + "GT": 28, "HU": 28, "IS": 26, "IE": 22, "IL": 23, "IT": 27, "KZ": 20, "KW": 30, + "LV": 21, "LB": 28, "LI": 21, "LT": 20, "LU": 20, "MK": 19, "MT": 31, "MR": 27, + "MU": 30, "MC": 27, "MD": 24, "ME": 22, "NL": 18, "NO": 15, "PK": 24, "PS": 29, + "PL": 28, "PT": 25, "RO": 24, "SM": 27, "SA": 24, "RS": 22, "SK": 24, "SI": 19, + "ES": 24, "SE": 24, "CH": 21, "TN": 24, "TR": 26, "AE": 23, "GB": 22, "VG": 24 + } as $lengths + # Ignore spaces and tabs, and check input is ALPHAnumeric: + | gsub("[ \t]";"") + | test("^[A-Z0-9]+$") + # Validate country code against expected length: + and length == $lengths[.[0:2]] + # Shift and convert: + and ( (.[4:] + .[0:4]) | letters2digits | remainder) == 1 ; diff --git a/Task/IBAN/jq/iban-3.jq b/Task/IBAN/jq/iban-3.jq new file mode 100644 index 0000000000..af97380ef6 --- /dev/null +++ b/Task/IBAN/jq/iban-3.jq @@ -0,0 +1,2 @@ +"GB82 WEST 1234 5698 7654 32" | is_valid_iban #=> true +"GB82 TEST 1234 5698 7654 32" | is_valid_iban #=> false diff --git a/Task/Identity-matrix/ERRE/identity-matrix.erre b/Task/Identity-matrix/ERRE/identity-matrix.erre new file mode 100644 index 0000000000..e2cd7b395e --- /dev/null +++ b/Task/Identity-matrix/ERRE/identity-matrix.erre @@ -0,0 +1,20 @@ +PROGRAM IDENTITY + +!$DYNAMIC +DIM A[0,0] + +BEGIN + PRINT(CHR$(12);) ! CLS + INPUT("Matrix size",N%) + !$DIM A[N%,N%] + FOR I%=1 TO N% DO + A[I%,I%]=1 + END FOR +! print matrix + FOR I%=1 TO N% DO + FOR J%=1 TO N% DO + WRITE("###";A[I%,J%];) + END FOR + PRINT + END FOR +END PROGRAM diff --git a/Task/Identity-matrix/FreeBASIC/identity-matrix.freebasic b/Task/Identity-matrix/FreeBASIC/identity-matrix.freebasic new file mode 100644 index 0000000000..2ba6ebb1be --- /dev/null +++ b/Task/Identity-matrix/FreeBASIC/identity-matrix.freebasic @@ -0,0 +1,32 @@ +' FB 1.05.0 Win64 + +Dim As Integer n + +Do + Input "Enter size of matrix "; n +Loop Until n > 0 + +Dim identity(1 To n, 1 To n) As Integer '' all zero by default + +' enter 1s in diagonal elements +For i As Integer = 1 To n + identity(i, i) = 1 +Next + +' print identity matrix if n < 40 +Print + +If n < 40 Then + For i As Integer = 1 To n + For j As Integer = 1 To n + Print identity(i, j); + Next j + Print + Next i +Else + Print "Matrix is too big to display on 80 column console" +End If + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Identity-matrix/FunL/identity-matrix.funl b/Task/Identity-matrix/FunL/identity-matrix.funl new file mode 100644 index 0000000000..3b9ce56b29 --- /dev/null +++ b/Task/Identity-matrix/FunL/identity-matrix.funl @@ -0,0 +1,3 @@ +def identity( n ) = vector( n, n, \r, c -> if r == c then 1 else 0 ) + +println( identity(3) ) diff --git a/Task/Identity-matrix/LFE/identity-matrix-1.lfe b/Task/Identity-matrix/LFE/identity-matrix-1.lfe new file mode 100644 index 0000000000..b9c5fb651c --- /dev/null +++ b/Task/Identity-matrix/LFE/identity-matrix-1.lfe @@ -0,0 +1,8 @@ +(defun identity + ((`(,m ,n)) + (identity m n)) + ((m) + (identity m m))) + +(defun identity (m n) + (lists:duplicate m (lists:duplicate n 1))) diff --git a/Task/Identity-matrix/LFE/identity-matrix-2.lfe b/Task/Identity-matrix/LFE/identity-matrix-2.lfe new file mode 100644 index 0000000000..eb74fea861 --- /dev/null +++ b/Task/Identity-matrix/LFE/identity-matrix-2.lfe @@ -0,0 +1,6 @@ +> (identity 3) +((1 1 1) (1 1 1) (1 1 1)) +> (identity 3 3) +((1 1 1) (1 1 1) (1 1 1)) +> (identity '(3 3)) +((1 1 1) (1 1 1) (1 1 1)) diff --git a/Task/Identity-matrix/Nim/identity-matrix.nim b/Task/Identity-matrix/Nim/identity-matrix.nim new file mode 100644 index 0000000000..701e76ef25 --- /dev/null +++ b/Task/Identity-matrix/Nim/identity-matrix.nim @@ -0,0 +1,5 @@ +proc identityMatrix(n): auto = + result = newSeq[seq[int]](n) + for i in 0 .. < result.len: + result[i] = newSeq[int](n) + result[i][i] = 1 diff --git a/Task/Identity-matrix/Ring/identity-matrix.ring b/Task/Identity-matrix/Ring/identity-matrix.ring new file mode 100644 index 0000000000..bd686a8a64 --- /dev/null +++ b/Task/Identity-matrix/Ring/identity-matrix.ring @@ -0,0 +1,25 @@ +size = 5 +im = newlist(size, size) +identityMatrix(size, im) +for r = 1 to size + for c = 1 to size + see im[r][c] + next + see nl +next + +func identityMatrix s, m + m = newlist(s, s) + for i = 1 to s + m[i][i] = 1 + next + return m + +func newlist x, y + if isstring(x) x=0+x ok + if isstring(y) y=0+y ok + alist = list(x) + for t in alist + t = list(y) + next + return alist diff --git a/Task/Identity-matrix/Sidef/identity-matrix.sidef b/Task/Identity-matrix/Sidef/identity-matrix.sidef new file mode 100644 index 0000000000..cd73f9e22f --- /dev/null +++ b/Task/Identity-matrix/Sidef/identity-matrix.sidef @@ -0,0 +1,12 @@ +func identity_matrix(n) { + 1..n -> map { |i| + 1..n -> map {|j| j == i ? 1 : 0 } + } +} + +(ARGV.len ? ARGV.map{.to_i} : [4, 5, 6]) -> each { |n| + say "\n#{n}:"; + identity_matrix(n).each { |row| + say row.join(' '); + } +} diff --git a/Task/Identity-matrix/Sparkling/identity-matrix.sparkling b/Task/Identity-matrix/Sparkling/identity-matrix.sparkling new file mode 100644 index 0000000000..ea0381bc1b --- /dev/null +++ b/Task/Identity-matrix/Sparkling/identity-matrix.sparkling @@ -0,0 +1,7 @@ +function unitMatrix(n) { + return map(range(n), function(k1, v1) { + return map(range(n), function(k2, v2) { + return v2 == v1 ? 1 : 0; + }); + }); +} diff --git a/Task/Identity-matrix/Wortel/identity-matrix.wortel b/Task/Identity-matrix/Wortel/identity-matrix.wortel new file mode 100644 index 0000000000..0ac2f5f308 --- /dev/null +++ b/Task/Identity-matrix/Wortel/identity-matrix.wortel @@ -0,0 +1,5 @@ +@let { + im ^(%^\@table ^(@+ =) @to) + + !im 4 +} diff --git a/Task/Identity-matrix/jq/identity-matrix-1.jq b/Task/Identity-matrix/jq/identity-matrix-1.jq new file mode 100644 index 0000000000..7cbba1ebbb --- /dev/null +++ b/Task/Identity-matrix/jq/identity-matrix-1.jq @@ -0,0 +1,3 @@ +def identity(n): + [range(0;n) | 0] as $row + | reduce range(0;n) as $i ([]; . + [ $row | .[$i] = 1 ] ); diff --git a/Task/Identity-matrix/jq/identity-matrix-2.jq b/Task/Identity-matrix/jq/identity-matrix-2.jq new file mode 100644 index 0000000000..bbdf197cb9 --- /dev/null +++ b/Task/Identity-matrix/jq/identity-matrix-2.jq @@ -0,0 +1 @@ +identity(4) diff --git a/Task/Identity-matrix/jq/identity-matrix-3.jq b/Task/Identity-matrix/jq/identity-matrix-3.jq new file mode 100644 index 0000000000..c8050789f9 --- /dev/null +++ b/Task/Identity-matrix/jq/identity-matrix-3.jq @@ -0,0 +1,3 @@ +def identity(n): + reduce range(0;n) as $i + (0 | matrix(n;n); .[$i][$i] = 1); diff --git a/Task/Image-noise/Axe/image-noise.axe b/Task/Image-noise/Axe/image-noise.axe new file mode 100644 index 0000000000..b0d00bc841 --- /dev/null +++ b/Task/Image-noise/Axe/image-noise.axe @@ -0,0 +1,43 @@ +.Enable 15 MHz full speed mode +Full +.Disable memory access delays (adds 1 FPS) +Fullʳ + +.Flush key presses +While getKey(0) +End + +.Setup +0→F +0→N +Fix 5 +fnInt(FPS,6) + +Repeat getKey(0) + NOISE() + F++ + .Reset the FPS counter before it overflows + F>606?0→F→N + Text(0,0,F*108/N▶Dec) + DispGraph +End + +.Clean up +LnRegʳ +Fix 4 +Return + +.Draws random noise to the buffer +Lbl NOISE +ClrDraw +For(I,0,5) + For(J,0,63) + rand→{J*12+(I*2)+L₆}ʳ + End +End +Return + +.Increments the tick counter +Lbl FPS +N++ +Return diff --git a/Task/Include-a-file/AntLang/include-a-file.antlang b/Task/Include-a-file/AntLang/include-a-file.antlang new file mode 100644 index 0000000000..c80f637eac --- /dev/null +++ b/Task/Include-a-file/AntLang/include-a-file.antlang @@ -0,0 +1 @@ +load["script.ant"] diff --git a/Task/Include-a-file/Axe/include-a-file.axe b/Task/Include-a-file/Axe/include-a-file.axe new file mode 100644 index 0000000000..e0274d7b1a --- /dev/null +++ b/Task/Include-a-file/Axe/include-a-file.axe @@ -0,0 +1 @@ +prgmOTHER diff --git a/Task/Include-a-file/ChucK/include-a-file.chuck b/Task/Include-a-file/ChucK/include-a-file.chuck new file mode 100644 index 0000000000..b86a8453f8 --- /dev/null +++ b/Task/Include-a-file/ChucK/include-a-file.chuck @@ -0,0 +1 @@ +Machine.add(me.dir() + "/MyOwnClassesDefinitions.ck"); diff --git a/Task/Include-a-file/FreeBASIC/include-a-file-1.freebasic b/Task/Include-a-file/FreeBASIC/include-a-file-1.freebasic new file mode 100644 index 0000000000..9cee96f5da --- /dev/null +++ b/Task/Include-a-file/FreeBASIC/include-a-file-1.freebasic @@ -0,0 +1,10 @@ +' person.bi file +Type Person + name As String + age As UInteger + Declare Operator Cast() As String +End Type + +Operator Person.Cast() As String + Return "[" + This.name + ", " + Str(This.age) + "]" +End Operator diff --git a/Task/Include-a-file/FreeBASIC/include-a-file-2.freebasic b/Task/Include-a-file/FreeBASIC/include-a-file-2.freebasic new file mode 100644 index 0000000000..8d67d66b9e --- /dev/null +++ b/Task/Include-a-file/FreeBASIC/include-a-file-2.freebasic @@ -0,0 +1,12 @@ +' FB 1.05.0 Win 64 + +' main.bas file +#include "person.bi" + +Dim person1 As Person +person1.name = "Methuselah" +person1.age = 969 +Print person1 +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Include-a-file/FutureBasic/include-a-file.futurebasic b/Task/Include-a-file/FutureBasic/include-a-file.futurebasic new file mode 100644 index 0000000000..014d3e82f5 --- /dev/null +++ b/Task/Include-a-file/FutureBasic/include-a-file.futurebasic @@ -0,0 +1,5 @@ +include resources "SomeImage.png" +include resources "SomeMovie.mpeg" +include resources "SomeSound.aiff" +include resources "SomeIcon.icns" +include resources "Info.plist" //Custom preference file to replace FB's generic app preferences diff --git a/Task/Include-a-file/Harbour/include-a-file.harbour b/Task/Include-a-file/Harbour/include-a-file.harbour new file mode 100644 index 0000000000..b08479f4c9 --- /dev/null +++ b/Task/Include-a-file/Harbour/include-a-file.harbour @@ -0,0 +1 @@ +#include "inkey.ch" diff --git a/Task/Include-a-file/Lasso/include-a-file.lasso b/Task/Include-a-file/Lasso/include-a-file.lasso new file mode 100644 index 0000000000..a27493e717 --- /dev/null +++ b/Task/Include-a-file/Lasso/include-a-file.lasso @@ -0,0 +1 @@ +include('myfile.lasso') diff --git a/Task/Include-a-file/Lingo/include-a-file.lingo b/Task/Include-a-file/Lingo/include-a-file.lingo new file mode 100644 index 0000000000..be90a61002 --- /dev/null +++ b/Task/Include-a-file/Lingo/include-a-file.lingo @@ -0,0 +1,13 @@ +-- load Lingo code from file +fp = xtra("fileIO").new() +fp.openFile(_movie.path&"someinclude.ls", 1) +code = fp.readFile() +fp.closeFile() + +-- create new script member, assign loaded code +m = new(#script) +m.name = "someinclude" +m.scriptText = code + +-- use it instantly in the current script (i.e. the script that contained the above include code) +script("someinclude").foo() diff --git a/Task/Include-a-file/Nim/include-a-file.nim b/Task/Include-a-file/Nim/include-a-file.nim new file mode 100644 index 0000000000..2b3f4da187 --- /dev/null +++ b/Task/Include-a-file/Nim/include-a-file.nim @@ -0,0 +1,4 @@ +import someModule +import strutils except parseInt +import strutils as su, sequtils as qu # su.x works +import lib.pure.strutils, lib/pure/os, "lib/pure/times" # still strutils.x diff --git a/Task/Include-a-file/Oforth/include-a-file-1.oforth b/Task/Include-a-file/Oforth/include-a-file-1.oforth new file mode 100644 index 0000000000..64bda33b6b --- /dev/null +++ b/Task/Include-a-file/Oforth/include-a-file-1.oforth @@ -0,0 +1 @@ +"filename" load diff --git a/Task/Include-a-file/Oforth/include-a-file-2.oforth b/Task/Include-a-file/Oforth/include-a-file-2.oforth new file mode 100644 index 0000000000..3b99d3c9a3 --- /dev/null +++ b/Task/Include-a-file/Oforth/include-a-file-2.oforth @@ -0,0 +1 @@ +import: pack diff --git a/Task/Include-a-file/Phix/include-a-file.phix b/Task/Include-a-file/Phix/include-a-file.phix new file mode 100644 index 0000000000..489c51318d --- /dev/null +++ b/Task/Include-a-file/Phix/include-a-file.phix @@ -0,0 +1 @@ +include arwen.ew diff --git a/Task/Include-a-file/Ring/include-a-file.ring b/Task/Include-a-file/Ring/include-a-file.ring new file mode 100644 index 0000000000..d30a38dded --- /dev/null +++ b/Task/Include-a-file/Ring/include-a-file.ring @@ -0,0 +1 @@ +Load 'file.ring' diff --git a/Task/Include-a-file/Sidef/include-a-file-1.sidef b/Task/Include-a-file/Sidef/include-a-file-1.sidef new file mode 100644 index 0000000000..9b27e775be --- /dev/null +++ b/Task/Include-a-file/Sidef/include-a-file-1.sidef @@ -0,0 +1 @@ +include 'file.sf'; diff --git a/Task/Include-a-file/Sidef/include-a-file-2.sidef b/Task/Include-a-file/Sidef/include-a-file-2.sidef new file mode 100644 index 0000000000..84c2cdda03 --- /dev/null +++ b/Task/Include-a-file/Sidef/include-a-file-2.sidef @@ -0,0 +1,2 @@ +include Some::Name; +# variables are available here as: Some::Name::var_name diff --git a/Task/Include-a-file/Ursa/include-a-file.ursa b/Task/Include-a-file/Ursa/include-a-file.ursa new file mode 100644 index 0000000000..5b1b67f501 --- /dev/null +++ b/Task/Include-a-file/Ursa/include-a-file.ursa @@ -0,0 +1 @@ +import "filename.u" diff --git a/Task/Include-a-file/jq/include-a-file-1.jq b/Task/Include-a-file/jq/include-a-file-1.jq new file mode 100644 index 0000000000..4c97a7bd5f --- /dev/null +++ b/Task/Include-a-file/jq/include-a-file-1.jq @@ -0,0 +1,3 @@ +include "gort"; + +hello diff --git a/Task/Include-a-file/jq/include-a-file-2.jq b/Task/Include-a-file/jq/include-a-file-2.jq new file mode 100644 index 0000000000..6a282621f1 --- /dev/null +++ b/Task/Include-a-file/jq/include-a-file-2.jq @@ -0,0 +1 @@ +def hello: "Klaatu barada nikto"; diff --git a/Task/Include-a-file/jq/include-a-file-3.jq b/Task/Include-a-file/jq/include-a-file-3.jq new file mode 100644 index 0000000000..6ac693b716 --- /dev/null +++ b/Task/Include-a-file/jq/include-a-file-3.jq @@ -0,0 +1,2 @@ +$ jq -n -c -f Include_a_file.jq +Klaatu barada nikto. diff --git a/Task/Increment-a-numerical-string/Apex/increment-a-numerical-string.apex b/Task/Increment-a-numerical-string/Apex/increment-a-numerical-string.apex new file mode 100644 index 0000000000..8ea35f2905 --- /dev/null +++ b/Task/Increment-a-numerical-string/Apex/increment-a-numerical-string.apex @@ -0,0 +1,3 @@ +string count = '12345'; +count = String.valueOf(integer.valueOf(count)+1); +system.debug('Incremental Value : '+count); diff --git a/Task/Increment-a-numerical-string/Ceylon/increment-a-numerical-string.ceylon b/Task/Increment-a-numerical-string/Ceylon/increment-a-numerical-string.ceylon new file mode 100644 index 0000000000..f0430cb027 --- /dev/null +++ b/Task/Increment-a-numerical-string/Ceylon/increment-a-numerical-string.ceylon @@ -0,0 +1,18 @@ +shared void run() { + + "Increments a numeric string by 1. Returns a float or integer depending on the string. + Returns null if the string isn't a number." + function inc(String string) => + if(exists integer = parseInteger(string)) then integer + 1 + else if(exists float = parseFloat(string)) then float + 1.0 + else null; + + value a = "1"; + print(a); + value b = inc(a); + print(b); + value c = "1.0"; + print(c); + value d = inc(c); + print(d); +} diff --git a/Task/Increment-a-numerical-string/ERRE/increment-a-numerical-string.erre b/Task/Increment-a-numerical-string/ERRE/increment-a-numerical-string.erre new file mode 100644 index 0000000000..f8bd2fc693 --- /dev/null +++ b/Task/Increment-a-numerical-string/ERRE/increment-a-numerical-string.erre @@ -0,0 +1,4 @@ + .................... + s$="12345" + s$=STR$(VAL(s$)+1) + .................... diff --git a/Task/Increment-a-numerical-string/EchoLisp/increment-a-numerical-string.echolisp b/Task/Increment-a-numerical-string/EchoLisp/increment-a-numerical-string.echolisp new file mode 100644 index 0000000000..bdd16bec5c --- /dev/null +++ b/Task/Increment-a-numerical-string/EchoLisp/increment-a-numerical-string.echolisp @@ -0,0 +1,2 @@ +(number->string (1+ (string->number "665"))) + → "666" diff --git a/Task/Increment-a-numerical-string/Eero/increment-a-numerical-string.eero b/Task/Increment-a-numerical-string/Eero/increment-a-numerical-string.eero new file mode 100644 index 0000000000..7466ba7319 --- /dev/null +++ b/Task/Increment-a-numerical-string/Eero/increment-a-numerical-string.eero @@ -0,0 +1,9 @@ +#import + +int main() + + i := (int)'123' + 1 + s := @(i).description + + Log( '%@', s ) + return 0 diff --git a/Task/Increment-a-numerical-string/FreeBASIC/increment-a-numerical-string.freebasic b/Task/Increment-a-numerical-string/FreeBASIC/increment-a-numerical-string.freebasic new file mode 100644 index 0000000000..1ba928b727 --- /dev/null +++ b/Task/Increment-a-numerical-string/FreeBASIC/increment-a-numerical-string.freebasic @@ -0,0 +1,15 @@ +' FB 1.05.0 Win64 + +Function Increment (num As String) As String + Dim d As Double = Val(num) + Return Str(d + 1.0) +End Function + +Dim num(5) As String = {"1", "5", "81", "123.45", "777.77", "1000"} +For i As Integer = 0 To 5 + Print num(i); " + 1", " = "; Increment(num(i)) +Next + +Print +Print "Press any key to exit" +Sleep diff --git a/Task/Increment-a-numerical-string/FutureBasic/increment-a-numerical-string.futurebasic b/Task/Increment-a-numerical-string/FutureBasic/increment-a-numerical-string.futurebasic new file mode 100644 index 0000000000..026428407c --- /dev/null +++ b/Task/Increment-a-numerical-string/FutureBasic/increment-a-numerical-string.futurebasic @@ -0,0 +1,18 @@ +include "ConsoleWindow" + +dim as Str255 numStr +dim as long numeric, i + +numStr = "12345" +numeric = val(numStr) +numeric++ +numStr = str$(numeric) +print numStr + +print + +for i = 0 to 10 + numeric++ + numStr = str$( numeric ) + print numStr +next diff --git a/Task/Increment-a-numerical-string/Lasso/increment-a-numerical-string.lasso b/Task/Increment-a-numerical-string/Lasso/increment-a-numerical-string.lasso new file mode 100644 index 0000000000..7d6ed8545b --- /dev/null +++ b/Task/Increment-a-numerical-string/Lasso/increment-a-numerical-string.lasso @@ -0,0 +1 @@ +(integer('123') + 1) -> asstring diff --git a/Task/Increment-a-numerical-string/Lingo/increment-a-numerical-string.lingo b/Task/Increment-a-numerical-string/Lingo/increment-a-numerical-string.lingo new file mode 100644 index 0000000000..a0d220c8f9 --- /dev/null +++ b/Task/Increment-a-numerical-string/Lingo/increment-a-numerical-string.lingo @@ -0,0 +1,2 @@ +put integer("123")+1 +-- 124 diff --git a/Task/Increment-a-numerical-string/LiveCode/increment-a-numerical-string.livecode b/Task/Increment-a-numerical-string/LiveCode/increment-a-numerical-string.livecode new file mode 100644 index 0000000000..b05b6883b3 --- /dev/null +++ b/Task/Increment-a-numerical-string/LiveCode/increment-a-numerical-string.livecode @@ -0,0 +1,4 @@ +put "0" & "1234" into myString -- I think this will result in an internal string representation +add 1 to myString -- automatically converts to a number +put "The number is:" && myString +-- outputs "The number is: 1235" diff --git a/Task/Increment-a-numerical-string/Nim/increment-a-numerical-string.nim b/Task/Increment-a-numerical-string/Nim/increment-a-numerical-string.nim new file mode 100644 index 0000000000..dcd544ec22 --- /dev/null +++ b/Task/Increment-a-numerical-string/Nim/increment-a-numerical-string.nim @@ -0,0 +1,2 @@ +import strutils +let next = $(parseInt("123") + 1) diff --git a/Task/Increment-a-numerical-string/Oforth/increment-a-numerical-string.oforth b/Task/Increment-a-numerical-string/Oforth/increment-a-numerical-string.oforth new file mode 100644 index 0000000000..954bce46b2 --- /dev/null +++ b/Task/Increment-a-numerical-string/Oforth/increment-a-numerical-string.oforth @@ -0,0 +1,2 @@ +"999" 1 + println +"999" asInteger 1 + asString println diff --git a/Task/Increment-a-numerical-string/Phix/increment-a-numerical-string.phix b/Task/Increment-a-numerical-string/Phix/increment-a-numerical-string.phix new file mode 100644 index 0000000000..6a2f17162e --- /dev/null +++ b/Task/Increment-a-numerical-string/Phix/increment-a-numerical-string.phix @@ -0,0 +1,2 @@ +integer {{n}} = scanf("2047","%d") +printf(1,"%d\n",{n+1}) diff --git a/Task/Increment-a-numerical-string/Ring/increment-a-numerical-string.ring b/Task/Increment-a-numerical-string/Ring/increment-a-numerical-string.ring new file mode 100644 index 0000000000..f6d824f7ce --- /dev/null +++ b/Task/Increment-a-numerical-string/Ring/increment-a-numerical-string.ring @@ -0,0 +1 @@ +x = "1234" See 1+x # print 1235 diff --git a/Task/Increment-a-numerical-string/Sidef/increment-a-numerical-string.sidef b/Task/Increment-a-numerical-string/Sidef/increment-a-numerical-string.sidef new file mode 100644 index 0000000000..3112021b9a --- /dev/null +++ b/Task/Increment-a-numerical-string/Sidef/increment-a-numerical-string.sidef @@ -0,0 +1,2 @@ +say '1234'.inc; #=> '1235' +say '99'.inc; #=> '100' diff --git a/Task/Increment-a-numerical-string/Sparkling/increment-a-numerical-string.sparkling b/Task/Increment-a-numerical-string/Sparkling/increment-a-numerical-string.sparkling new file mode 100644 index 0000000000..2c7671d3cc --- /dev/null +++ b/Task/Increment-a-numerical-string/Sparkling/increment-a-numerical-string.sparkling @@ -0,0 +1,6 @@ +function numStrIncmt(s) { + return fmtstr("%d", toint(s) + 1); +} + +spn:1> numStrIncmt("12345") += 12346 diff --git a/Task/Increment-a-numerical-string/Swift/increment-a-numerical-string-1.swift b/Task/Increment-a-numerical-string/Swift/increment-a-numerical-string-1.swift new file mode 100644 index 0000000000..e91136150c --- /dev/null +++ b/Task/Increment-a-numerical-string/Swift/increment-a-numerical-string-1.swift @@ -0,0 +1,4 @@ +let s = "1234" +if let x = Int(s) { + print("\(x + 1)") +} diff --git a/Task/Increment-a-numerical-string/Swift/increment-a-numerical-string-2.swift b/Task/Increment-a-numerical-string/Swift/increment-a-numerical-string-2.swift new file mode 100644 index 0000000000..4c32efb43c --- /dev/null +++ b/Task/Increment-a-numerical-string/Swift/increment-a-numerical-string-2.swift @@ -0,0 +1,4 @@ +let s = "1234" +if let x = s.toInt() { + println("\(x + 1)") +} diff --git a/Task/Increment-a-numerical-string/Ursa/increment-a-numerical-string.ursa b/Task/Increment-a-numerical-string/Ursa/increment-a-numerical-string.ursa new file mode 100644 index 0000000000..14725cd36d --- /dev/null +++ b/Task/Increment-a-numerical-string/Ursa/increment-a-numerical-string.ursa @@ -0,0 +1,3 @@ +decl string num +set num "123" +set num (int (+ (int num) 1)) diff --git a/Task/Increment-a-numerical-string/XLISP/increment-a-numerical-string.xlisp b/Task/Increment-a-numerical-string/XLISP/increment-a-numerical-string.xlisp new file mode 100644 index 0000000000..5cfdf83059 --- /dev/null +++ b/Task/Increment-a-numerical-string/XLISP/increment-a-numerical-string.xlisp @@ -0,0 +1,2 @@ +(DEFUN INCREMENT-STRING (X) + (NUMBER->STRING (+ (STRING->NUMBER X) 1))) diff --git a/Task/Increment-a-numerical-string/jq/increment-a-numerical-string-1.jq b/Task/Increment-a-numerical-string/jq/increment-a-numerical-string-1.jq new file mode 100644 index 0000000000..e848cdf19d --- /dev/null +++ b/Task/Increment-a-numerical-string/jq/increment-a-numerical-string-1.jq @@ -0,0 +1 @@ +$ jq -n -M -s 'map(tonumber) | add' input.txt diff --git a/Task/Increment-a-numerical-string/jq/increment-a-numerical-string-2.jq b/Task/Increment-a-numerical-string/jq/increment-a-numerical-string-2.jq new file mode 100644 index 0000000000..47d60ad8ac --- /dev/null +++ b/Task/Increment-a-numerical-string/jq/increment-a-numerical-string-2.jq @@ -0,0 +1,18 @@ +# This function assumes its string arguments represent non-negative decimal integers. +def long_add(num1; num2): + if (num1|length) < (num2|length) then long_add(num2; num1) + else (num1 | explode | map(.-48) | reverse) as $a1 + | (num2 | explode | map(.-48) | reverse) as $a2 + | reduce range(0; num1|length) as $ix + ($a2; # result + ( $a1[$ix] + .[$ix] ) as $r + | if $r > 9 # carrying + then + .[$ix + 1] = ($r / 10 | floor) + + (if $ix + 1 >= length then 0 else .[$ix + 1] end ) + | .[$ix] = $r - ( $r / 10 | floor ) * 10 + else + .[$ix] = $r + end ) + | reverse | map(.+48) | implode + end ; diff --git a/Task/Increment-a-numerical-string/jq/increment-a-numerical-string-3.jq b/Task/Increment-a-numerical-string/jq/increment-a-numerical-string-3.jq new file mode 100644 index 0000000000..d851ea1643 --- /dev/null +++ b/Task/Increment-a-numerical-string/jq/increment-a-numerical-string-3.jq @@ -0,0 +1 @@ +long_add("9" * 100; "1") diff --git a/Task/Infinity/ERRE/infinity.erre b/Task/Infinity/ERRE/infinity.erre new file mode 100644 index 0000000000..62ade99ac9 --- /dev/null +++ b/Task/Infinity/ERRE/infinity.erre @@ -0,0 +1,15 @@ +PROGRAM INFINITY + +EXCEPTION + PRINT("INFINITY") + ESCI%=TRUE +END EXCEPTION + +BEGIN + ESCI%=FALSE + K=1 + WHILE 2^K>0 DO + EXIT IF ESCI% + K+=1 + END WHILE +END PROGRAM diff --git a/Task/Infinity/FreeBASIC/infinity.freebasic b/Task/Infinity/FreeBASIC/infinity.freebasic new file mode 100644 index 0000000000..8e76b7b873 --- /dev/null +++ b/Task/Infinity/FreeBASIC/infinity.freebasic @@ -0,0 +1,8 @@ +' FB 1.05.0 Win64 + +#Include "crt/math.bi" +#Print Typeof(1.5) ' Prints DOUBLE at compile time + +Dim d As Typeof(1.5) = INFINITY +Print d; " (String representation of Positive Infinity)" +Sleep diff --git a/Task/Infinity/Lasso/infinity.lasso b/Task/Infinity/Lasso/infinity.lasso new file mode 100644 index 0000000000..f653b1e425 --- /dev/null +++ b/Task/Infinity/Lasso/infinity.lasso @@ -0,0 +1,3 @@ +infinity +'
' +infinity -> type diff --git a/Task/Infinity/Lingo/infinity.lingo b/Task/Infinity/Lingo/infinity.lingo new file mode 100644 index 0000000000..cf45b6bdf1 --- /dev/null +++ b/Task/Infinity/Lingo/infinity.lingo @@ -0,0 +1,7 @@ +x = (1-power(2, -53)) * power(2, 1023) * 2 +put ilk(x), x +-- #float 1.79769313486232e308 + +x = (1-power(2, -53)) * power(2, 1023) * 3 +put ilk(x), x, -x +-- #float INF -INF diff --git a/Task/Infinity/Nim/infinity-1.nim b/Task/Infinity/Nim/infinity-1.nim new file mode 100644 index 0000000000..8484d062f5 --- /dev/null +++ b/Task/Infinity/Nim/infinity-1.nim @@ -0,0 +1 @@ +inf diff --git a/Task/Infinity/Nim/infinity-2.nim b/Task/Infinity/Nim/infinity-2.nim new file mode 100644 index 0000000000..c6e6286ea4 --- /dev/null +++ b/Task/Infinity/Nim/infinity-2.nim @@ -0,0 +1,2 @@ +var f = inf +echo f diff --git a/Task/Infinity/Oforth/infinity.oforth b/Task/Infinity/Oforth/infinity.oforth new file mode 100644 index 0000000000..f7307d48d7 --- /dev/null +++ b/Task/Infinity/Oforth/infinity.oforth @@ -0,0 +1 @@ +10 1000.0 powf dup println dup neg println 1 swap / println diff --git a/Task/Infinity/Phix/infinity.phix b/Task/Infinity/Phix/infinity.phix new file mode 100644 index 0000000000..46718f26e3 --- /dev/null +++ b/Task/Infinity/Phix/infinity.phix @@ -0,0 +1,2 @@ +constant infinity = 1e300*1e300 +? infinity diff --git a/Task/Infinity/Sidef/infinity.sidef b/Task/Infinity/Sidef/infinity.sidef new file mode 100644 index 0000000000..8f39def219 --- /dev/null +++ b/Task/Infinity/Sidef/infinity.sidef @@ -0,0 +1,11 @@ +var a = 1.5/0; # inf +say a.is_inf; # true +say a.is_pos; # true + +var b = -1.5/0; # -inf +say b.is_inf; # true +say b.is_neg; # true + +var inf = Math.inf; +var ninf = -Math.inf; +say (inf == -ninf); # true diff --git a/Task/Infinity/Swift/infinity-1.swift b/Task/Infinity/Swift/infinity-1.swift new file mode 100644 index 0000000000..76d90e58fc --- /dev/null +++ b/Task/Infinity/Swift/infinity-1.swift @@ -0,0 +1,2 @@ +let inf = Double.infinity +inf.isInfinite //true diff --git a/Task/Infinity/Swift/infinity-2.swift b/Task/Infinity/Swift/infinity-2.swift new file mode 100644 index 0000000000..fc3da1a4bb --- /dev/null +++ b/Task/Infinity/Swift/infinity-2.swift @@ -0,0 +1,3 @@ +func getInf() -> Double { + return Double.infinity +} diff --git a/Task/Infinity/Ursa/infinity.ursa b/Task/Infinity/Ursa/infinity.ursa new file mode 100644 index 0000000000..dd8ae845c4 --- /dev/null +++ b/Task/Infinity/Ursa/infinity.ursa @@ -0,0 +1,2 @@ +decl double d +set d Infinity diff --git a/Task/Infinity/jq/infinity-1.jq b/Task/Infinity/jq/infinity-1.jq new file mode 100644 index 0000000000..a0ec080269 --- /dev/null +++ b/Task/Infinity/jq/infinity-1.jq @@ -0,0 +1 @@ +def infinite: 1e1000; diff --git a/Task/Infinity/jq/infinity-2.jq b/Task/Infinity/jq/infinity-2.jq new file mode 100644 index 0000000000..5117e0f8ee --- /dev/null +++ b/Task/Infinity/jq/infinity-2.jq @@ -0,0 +1 @@ +def isinfinite: . == infinite; diff --git a/Task/Inheritance-Multiple/FreeBASIC/inheritance-multiple.freebasic b/Task/Inheritance-Multiple/FreeBASIC/inheritance-multiple.freebasic new file mode 100644 index 0000000000..e1450d4b1f --- /dev/null +++ b/Task/Inheritance-Multiple/FreeBASIC/inheritance-multiple.freebasic @@ -0,0 +1,18 @@ +' FB 1.05.0 Win64 + +' FB does not currently support multiple inheritance. Composition has to be used instead if one wants +' to (effectively) inherit from more than one class. In some cases, this might arguably be a better +' solution anyway. + +Type Camera Extends Object ' if virtual methods etc needed + ' ... +End Type + +Type Phone Extends Object + ' ... +End Type + +Type CameraPhone Extends Phone ' single inheritance + cam As Camera ' using composition here + ' other stuff +End Type diff --git a/Task/Inheritance-Multiple/Lasso/inheritance-multiple.lasso b/Task/Inheritance-Multiple/Lasso/inheritance-multiple.lasso new file mode 100644 index 0000000000..b519aa2701 --- /dev/null +++ b/Task/Inheritance-Multiple/Lasso/inheritance-multiple.lasso @@ -0,0 +1,37 @@ +define trait_camera => trait { + require zoomfactor + + provide has_zoom() => { + return .zoomfactor > 0 + } + +} + +define trait_mobilephone => trait { + require brand + + provide is_smart() => { + return .brand == 'Apple' + } + +} + +define cameraphone => type { + + trait { + import trait_camera, trait_mobilephone + } + + data public zoomfactor::integer = 0, + public brand::string + +} + +local(mydevice = cameraphone) + +#mydevice -> brand = 'Apple' +#mydevice -> zoomfactor = 0 + +#mydevice -> has_zoom +'
' +#mydevice -> is_smart diff --git a/Task/Inheritance-Multiple/Lingo/inheritance-multiple-1.lingo b/Task/Inheritance-Multiple/Lingo/inheritance-multiple-1.lingo new file mode 100644 index 0000000000..6b565467e8 --- /dev/null +++ b/Task/Inheritance-Multiple/Lingo/inheritance-multiple-1.lingo @@ -0,0 +1,11 @@ +-- parent script "Camera" +property resolution + +on new (me) + me.resolution = "1024x768" + return me +end + +on snap (me) + put "SNAP!" +end diff --git a/Task/Inheritance-Multiple/Lingo/inheritance-multiple-2.lingo b/Task/Inheritance-Multiple/Lingo/inheritance-multiple-2.lingo new file mode 100644 index 0000000000..e0fedcbd64 --- /dev/null +++ b/Task/Inheritance-Multiple/Lingo/inheritance-multiple-2.lingo @@ -0,0 +1,13 @@ +-- parent script "MobilePhone" +property ringtone + +on new (me) + me.ringtone = "Bell" + return me +end + +on ring (me, n) + repeat with i = 1 to n + put "RING!!!" + end repeat +end diff --git a/Task/Inheritance-Multiple/Lingo/inheritance-multiple-3.lingo b/Task/Inheritance-Multiple/Lingo/inheritance-multiple-3.lingo new file mode 100644 index 0000000000..5b353a4fb5 --- /dev/null +++ b/Task/Inheritance-Multiple/Lingo/inheritance-multiple-3.lingo @@ -0,0 +1,15 @@ +-- parent script "CameraPhone" +property ancestor + +on new (me) + c = script("Camera").new() + mp = script("MobilePhone").new() + + -- make the Camera instance a parent of the MobilePhone instance + mp.setProp(#ancestor, c) + + -- make the MobilePhone instance a parent of this CameraPhone instance + me.ancestor = mp + + return me +end diff --git a/Task/Inheritance-Multiple/Lingo/inheritance-multiple-4.lingo b/Task/Inheritance-Multiple/Lingo/inheritance-multiple-4.lingo new file mode 100644 index 0000000000..650243357d --- /dev/null +++ b/Task/Inheritance-Multiple/Lingo/inheritance-multiple-4.lingo @@ -0,0 +1,15 @@ +cp = script("CameraPhone").new() + +cp.snap() +-- "SNAP!" + +cp.ring(3) +-- "RING!!!" +-- "RING!!!" +-- "RING!!!" + +put cp.resolution +-- "1024x768" + +put cp.ringtone +-- "Bell" diff --git a/Task/Inheritance-Multiple/Oforth/inheritance-multiple.oforth b/Task/Inheritance-Multiple/Oforth/inheritance-multiple.oforth new file mode 100644 index 0000000000..3282c995cc --- /dev/null +++ b/Task/Inheritance-Multiple/Oforth/inheritance-multiple.oforth @@ -0,0 +1,6 @@ +Property new: Camera +Property new: MobilePhone + +Object Class new: CameraPhone +CameraPhone is: Camera +CameraPhone is: MobilePhone diff --git a/Task/Inheritance-Multiple/Sidef/inheritance-multiple.sidef b/Task/Inheritance-Multiple/Sidef/inheritance-multiple.sidef new file mode 100644 index 0000000000..ba8e4965b6 --- /dev/null +++ b/Task/Inheritance-Multiple/Sidef/inheritance-multiple.sidef @@ -0,0 +1,3 @@ +class Camera {}; +class MobilePhone {}; +class CameraPhone << Camera, MobilePhone {}; diff --git a/Task/Inheritance-Multiple/Swift/inheritance-multiple.swift b/Task/Inheritance-Multiple/Swift/inheritance-multiple.swift new file mode 100644 index 0000000000..e74bb6c313 --- /dev/null +++ b/Task/Inheritance-Multiple/Swift/inheritance-multiple.swift @@ -0,0 +1,11 @@ +protocol Camera { + +} + +protocol Phone { + +} + +class CameraPhone: Camera, Phone { + +} diff --git a/Task/Inheritance-Single/ChucK/inheritance-single-1.chuck b/Task/Inheritance-Single/ChucK/inheritance-single-1.chuck new file mode 100644 index 0000000000..4591276d5a --- /dev/null +++ b/Task/Inheritance-Single/ChucK/inheritance-single-1.chuck @@ -0,0 +1,3 @@ +public class Drums{ + //functions go here... +} diff --git a/Task/Inheritance-Single/ChucK/inheritance-single-2.chuck b/Task/Inheritance-Single/ChucK/inheritance-single-2.chuck new file mode 100644 index 0000000000..b23fab7309 --- /dev/null +++ b/Task/Inheritance-Single/ChucK/inheritance-single-2.chuck @@ -0,0 +1,3 @@ +public class LatinKit extends Drums{ + //functions go here... +} diff --git a/Task/Inheritance-Single/ChucK/inheritance-single-3.chuck b/Task/Inheritance-Single/ChucK/inheritance-single-3.chuck new file mode 100644 index 0000000000..87730d0974 --- /dev/null +++ b/Task/Inheritance-Single/ChucK/inheritance-single-3.chuck @@ -0,0 +1,3 @@ +public class ElectronicKit extends Drums{ + //functions go here... +} diff --git a/Task/Inheritance-Single/ChucK/inheritance-single-4.chuck b/Task/Inheritance-Single/ChucK/inheritance-single-4.chuck new file mode 100644 index 0000000000..0169cbe14e --- /dev/null +++ b/Task/Inheritance-Single/ChucK/inheritance-single-4.chuck @@ -0,0 +1,3 @@ +public class Congas extends LatinKit{ + //functions go here... +} diff --git a/Task/Inheritance-Single/ChucK/inheritance-single-5.chuck b/Task/Inheritance-Single/ChucK/inheritance-single-5.chuck new file mode 100644 index 0000000000..7bb0dca290 --- /dev/null +++ b/Task/Inheritance-Single/ChucK/inheritance-single-5.chuck @@ -0,0 +1,3 @@ +public class TechnoDrums extends ElectronicKit{ + //functions go here... +} diff --git a/Task/Inheritance-Single/Coco/inheritance-single-1.coco b/Task/Inheritance-Single/Coco/inheritance-single-1.coco new file mode 100644 index 0000000000..1439e24d69 --- /dev/null +++ b/Task/Inheritance-Single/Coco/inheritance-single-1.coco @@ -0,0 +1,5 @@ +class Animal +class Cat extends Animal +class Dog extends Animal +class Lab extends Dog +class Collie extends Dog diff --git a/Task/Inheritance-Single/Coco/inheritance-single-2.coco b/Task/Inheritance-Single/Coco/inheritance-single-2.coco new file mode 100644 index 0000000000..edc2a44f51 --- /dev/null +++ b/Task/Inheritance-Single/Coco/inheritance-single-2.coco @@ -0,0 +1,28 @@ +class Animal + + (@name) -> + + move: (meters) -> + alert @name + " moved #{meters}m." + +class Snake extends Animal + + -> super ... + + move: -> + alert 'Slithering...' + super 5 + +class Horse extends Animal + + -> super ... + + move: -> + alert 'Galloping...' + super 45 + +sam = new Snake 'Sammy the Python' +tom = new Horse 'Tommy the Palomino' + +sam.move! +tom.move! diff --git a/Task/Inheritance-Single/Comal/inheritance-single-1.comal b/Task/Inheritance-Single/Comal/inheritance-single-1.comal new file mode 100644 index 0000000000..494bcac421 --- /dev/null +++ b/Task/Inheritance-Single/Comal/inheritance-single-1.comal @@ -0,0 +1,33 @@ + STRUC Animal + DIM Species$ OF 20 + ENDSTRUC Animal + + STRUC Dog + INHERIT Animal + DIM Race$ OF 20 + FUNC New CONSTRUCTOR + Species$="Dog" + ENDFUNC New + ENDSTRUC Dog + + STRUC Cat + INHERIT Animal + DIM Race$ OF 20 + FUNC New CONSTRUCTOR + Species$="Cat" + ENDFUNC New + ENDSTRUC Cat + + STRUC Lab + INHERIT Dog + FUNC New CONSTRUCTOR + Race$:="Lab" + ENDFUNC New + ENDSTRUC Lab + + STRUC Collie + INHERIT Dog + FUNC New CONSTRUCTOR + Race$:="Collie" + ENDFUNC New + ENDSTRUC Collie diff --git a/Task/Inheritance-Single/Comal/inheritance-single-2.comal b/Task/Inheritance-Single/Comal/inheritance-single-2.comal new file mode 100644 index 0000000000..f4423f698c --- /dev/null +++ b/Task/Inheritance-Single/Comal/inheritance-single-2.comal @@ -0,0 +1,5 @@ +(defclass animal () ()) +(defclass dog (animal) ()) +(defclass lab (dog) ()) +(defclass collie (dog) ()) +(defclass cat (animal) ()) diff --git a/Task/Inheritance-Single/Comal/inheritance-single-3.comal b/Task/Inheritance-Single/Comal/inheritance-single-3.comal new file mode 100644 index 0000000000..ee36c1b13c --- /dev/null +++ b/Task/Inheritance-Single/Comal/inheritance-single-3.comal @@ -0,0 +1,5 @@ +(defstruct animal) +(defstruct (dog (:include animal))) +(defstruct (lab (:include dog))) +(defstruct (collie (:include dog))) +(defstruct (cat (:include animal))) diff --git a/Task/Inheritance-Single/Comal/inheritance-single-4.comal b/Task/Inheritance-Single/Comal/inheritance-single-4.comal new file mode 100644 index 0000000000..3aaad97e94 --- /dev/null +++ b/Task/Inheritance-Single/Comal/inheritance-single-4.comal @@ -0,0 +1,9 @@ +;;; ASN.1 serialization logic specialized for animal class +(defmethod serialize-to-asn-1 ((a animal)) + #| ... |# + ) + + ;;; casually introduce the method over strings too; no relation to animal +(defmethod serialize-to-asn-1 ((s string)) + #| ... #| + ) diff --git a/Task/Inheritance-Single/Comal/inheritance-single-5.comal b/Task/Inheritance-Single/Comal/inheritance-single-5.comal new file mode 100644 index 0000000000..56f63c247a --- /dev/null +++ b/Task/Inheritance-Single/Comal/inheritance-single-5.comal @@ -0,0 +1,6 @@ + TYPE + Animal = ABSTRACT RECORD (* *) END; + Cat = RECORD (Animal) (* *) END; (* final record (cannot be extended) - by default *) + Dog = EXTENSIBLE RECORD (Animal) (* *) END; (* extensible record *) + Lab = RECORD (Dog) (* *) END; + Collie = RECORD (Dog) (* *) END; diff --git a/Task/Inheritance-Single/FreeBASIC/inheritance-single.freebasic b/Task/Inheritance-Single/FreeBASIC/inheritance-single.freebasic new file mode 100644 index 0000000000..6f0023dc07 --- /dev/null +++ b/Task/Inheritance-Single/FreeBASIC/inheritance-single.freebasic @@ -0,0 +1,21 @@ +' FB 1.05.0 Win64 + +Type Animal Extends Object ' to enable virtual methods etc. if needed + ' ... +End Type + +Type Dog Extends Animal + ' ... +End Type + +Type Cat Extends Animal + ' ... +End Type + +Type Lab Extends Dog + ' ... +End Type + +Type Collie Extends Dog + ' ... +End Type diff --git a/Task/Inheritance-Single/Lasso/inheritance-single.lasso b/Task/Inheritance-Single/Lasso/inheritance-single.lasso new file mode 100644 index 0000000000..d1590f4021 --- /dev/null +++ b/Task/Inheritance-Single/Lasso/inheritance-single.lasso @@ -0,0 +1,24 @@ +define animal => type { + data public gender::string +} + +define dog => type { + parent animal +} + +define cat => type { + parent animal +} + +define collie => type { + parent dog +} + +define lab => type { + parent dog +} + +local(myanimal = lab) + +#myanimal -> gender = 'Male' +#myanimal -> gender diff --git a/Task/Inheritance-Single/Lingo/inheritance-single-1.lingo b/Task/Inheritance-Single/Lingo/inheritance-single-1.lingo new file mode 100644 index 0000000000..a9812d19b4 --- /dev/null +++ b/Task/Inheritance-Single/Lingo/inheritance-single-1.lingo @@ -0,0 +1,2 @@ +-- parent script "Animal" +-- ... diff --git a/Task/Inheritance-Single/Lingo/inheritance-single-2.lingo b/Task/Inheritance-Single/Lingo/inheritance-single-2.lingo new file mode 100644 index 0000000000..4f7044e6bd --- /dev/null +++ b/Task/Inheritance-Single/Lingo/inheritance-single-2.lingo @@ -0,0 +1,7 @@ +-- parent script "Dog" +property ancestor + +on new (me) + me.ancestor = script("Animal").new() + return me +end diff --git a/Task/Inheritance-Single/Lingo/inheritance-single-3.lingo b/Task/Inheritance-Single/Lingo/inheritance-single-3.lingo new file mode 100644 index 0000000000..cba8cb51f7 --- /dev/null +++ b/Task/Inheritance-Single/Lingo/inheritance-single-3.lingo @@ -0,0 +1,7 @@ +-- parent script "Cat" +property ancestor + +on new (me) + me.ancestor = script("Animal").new() + return me +end diff --git a/Task/Inheritance-Single/Lingo/inheritance-single-4.lingo b/Task/Inheritance-Single/Lingo/inheritance-single-4.lingo new file mode 100644 index 0000000000..564e77fd72 --- /dev/null +++ b/Task/Inheritance-Single/Lingo/inheritance-single-4.lingo @@ -0,0 +1,7 @@ +-- parent script "Lab" +property ancestor + +on new (me) + me.ancestor = script("Dog").new() + return me +end diff --git a/Task/Inheritance-Single/Lingo/inheritance-single-5.lingo b/Task/Inheritance-Single/Lingo/inheritance-single-5.lingo new file mode 100644 index 0000000000..006e54bd8d --- /dev/null +++ b/Task/Inheritance-Single/Lingo/inheritance-single-5.lingo @@ -0,0 +1,7 @@ +-- parent script "Collie" +property ancestor + +on new (me) + me.ancestor = script("Dog").new() + return me +end diff --git a/Task/Inheritance-Single/Nim/inheritance-single.nim b/Task/Inheritance-Single/Nim/inheritance-single.nim new file mode 100644 index 0000000000..a23ea526d0 --- /dev/null +++ b/Task/Inheritance-Single/Nim/inheritance-single.nim @@ -0,0 +1,6 @@ +type + Animal = object of RootObj + Dog = object of Animal + Cat = object of Animal + Lab = object of Dog + Collie = object of Dog diff --git a/Task/Inheritance-Single/Oforth/inheritance-single.oforth b/Task/Inheritance-Single/Oforth/inheritance-single.oforth new file mode 100644 index 0000000000..71d2124021 --- /dev/null +++ b/Task/Inheritance-Single/Oforth/inheritance-single.oforth @@ -0,0 +1,5 @@ +Object Class new: Animal +Animal Class new: Cat +Animal Class new: Dog +Dog Class new: Lab +Dog Class new: Collie diff --git a/Task/Inheritance-Single/Ring/inheritance-single.ring b/Task/Inheritance-Single/Ring/inheritance-single.ring new file mode 100644 index 0000000000..5c41d196e0 --- /dev/null +++ b/Task/Inheritance-Single/Ring/inheritance-single.ring @@ -0,0 +1,5 @@ +Class Animal +Class Dog from Animal +Class Cat from Animal +Class Lab from Dog +Class Collie from Dog diff --git a/Task/Inheritance-Single/Sidef/inheritance-single.sidef b/Task/Inheritance-Single/Sidef/inheritance-single.sidef new file mode 100644 index 0000000000..8f6ead4501 --- /dev/null +++ b/Task/Inheritance-Single/Sidef/inheritance-single.sidef @@ -0,0 +1,5 @@ +class Animal {}; +class Dog << Animal {}; +class Cat << Animal {}; +class Lab << Dog {}; +class Collie << Dog {}; diff --git a/Task/Inheritance-Single/Swift/inheritance-single.swift b/Task/Inheritance-Single/Swift/inheritance-single.swift new file mode 100644 index 0000000000..3c6ab0fd79 --- /dev/null +++ b/Task/Inheritance-Single/Swift/inheritance-single.swift @@ -0,0 +1,19 @@ +class Animal { + // ... +} + +class Dog : Animal { + // ... +} + +class Lab : Dog { + // ... +} + +class Collie : Dog { + // ... +} + +class Cat : Animal { + // ... +} diff --git a/Task/Inheritance-Single/XLISP/inheritance-single-1.xlisp b/Task/Inheritance-Single/XLISP/inheritance-single-1.xlisp new file mode 100644 index 0000000000..c90836e8ff --- /dev/null +++ b/Task/Inheritance-Single/XLISP/inheritance-single-1.xlisp @@ -0,0 +1,13 @@ +(define-class animal) + +(define-class dog + (super-class animal)) + +(define-class cat + (super-class animal)) + +(define-class collie + (super-class dog)) + +(define-class lab + (super-class dog)) diff --git a/Task/Inheritance-Single/XLISP/inheritance-single-2.xlisp b/Task/Inheritance-Single/XLISP/inheritance-single-2.xlisp new file mode 100644 index 0000000000..0fd6aabca8 --- /dev/null +++ b/Task/Inheritance-Single/XLISP/inheritance-single-2.xlisp @@ -0,0 +1,21 @@ +[1] (cat 'superclass) + +# +[2] (collie 'superclass) + +# +[3] (animal 'superclass) + +# +[4] (dog 'show) + +Object is #, Class is # +Instance variables: + NAME = DOG + MESSAGES = () + IVARS = () + CVARS = # + SUPERCLASS = # + IVARCNT = 0 + IVARTOTAL = 0 +# diff --git a/Task/Input-loop/FreeBASIC/input-loop.freebasic b/Task/Input-loop/FreeBASIC/input-loop.freebasic new file mode 100644 index 0000000000..519c9dba3a --- /dev/null +++ b/Task/Input-loop/FreeBASIC/input-loop.freebasic @@ -0,0 +1,14 @@ +' FB 1.05.0 Win64 + +Dim line_ As String ' line is a keyword +Open "input.txt" For Input As #1 + +While Not Eof(1) + Input #1, line_ + Print line_ ' echo to the console +Wend + +Close #1 +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Input-loop/FutureBasic/input-loop.futurebasic b/Task/Input-loop/FutureBasic/input-loop.futurebasic new file mode 100644 index 0000000000..7358f2e902 --- /dev/null +++ b/Task/Input-loop/FutureBasic/input-loop.futurebasic @@ -0,0 +1,27 @@ +include "ConsoleWindow" + +local fn ReadTextFile +dim as CFURLRef fileRef +dim as Handle h +dim as CFStringRef cfStr : cfStr = NULL +dim as long fileLen + +if ( files$( _CFURLRefOpen, "TEXT", "Select text file...", @fileRef ) ) + open "i", 2, fileRef + fileLen = lof( 2, 1 ) + h = fn NewHandleClear( fileLen ) + if ( h ) + read file 2, [h], fileLen + close #2 + cfStr = fn CFStringCreateWithBytes( _kCFAllocatorDefault, #[h], fn GetHandleSize(h), _kCFStringEncodingMacRoman, _false ) + fn DisposeH( h ) + end if +else +// User canceled +end if + +fn HIViewSetText( sConsoleHITextView, cfStr ) +CFRelease( cfStr ) +end fn + +fn ReadTextFile diff --git a/Task/Input-loop/Lasso/input-loop.lasso b/Task/Input-loop/Lasso/input-loop.lasso new file mode 100644 index 0000000000..2d96423c2f --- /dev/null +++ b/Task/Input-loop/Lasso/input-loop.lasso @@ -0,0 +1,10 @@ +local( + myfile = file('//path/to/file.txt'), + textresult = array +) + +#myfile -> foreachline => { + #textresult -> insert(#1) +} + +#textresult -> join('
') diff --git a/Task/Input-loop/Nim/input-loop.nim b/Task/Input-loop/Nim/input-loop.nim new file mode 100644 index 0000000000..e3d32a5f0b --- /dev/null +++ b/Task/Input-loop/Nim/input-loop.nim @@ -0,0 +1,4 @@ +var i = open("input.txt") +for line in i.lines: + discard # process line +i.close() diff --git a/Task/Input-loop/Oforth/input-loop.oforth b/Task/Input-loop/Oforth/input-loop.oforth new file mode 100644 index 0000000000..0820dfec94 --- /dev/null +++ b/Task/Input-loop/Oforth/input-loop.oforth @@ -0,0 +1 @@ +: readFile(filename) File new(filename) apply(#println) ; diff --git a/Task/Input-loop/Ring/input-loop.ring b/Task/Input-loop/Ring/input-loop.ring new file mode 100644 index 0000000000..38a720c26c --- /dev/null +++ b/Task/Input-loop/Ring/input-loop.ring @@ -0,0 +1,9 @@ +fp = fopen("C:\Ring\ReadMe.txt","r") + +r = fgetc(fp) +while isstring(r) + r = fgetc(fp) + if r = char(10) see nl + else see r ok +end +fclose(fp) diff --git a/Task/Input-loop/Sidef/input-loop.sidef b/Task/Input-loop/Sidef/input-loop.sidef new file mode 100644 index 0000000000..956b8a0903 --- /dev/null +++ b/Task/Input-loop/Sidef/input-loop.sidef @@ -0,0 +1,8 @@ +var file = File(__FILE__) +file.open_r(\var fh, \var err) || die "#{file}: #{err}" + +fh.each { |line| # iterates the lines of the fh + line.each_word { |word| # iterates the words of the line + say word + } +} diff --git a/Task/Input-loop/Sparkling/input-loop.sparkling b/Task/Input-loop/Sparkling/input-loop.sparkling new file mode 100644 index 0000000000..d254eb3e31 --- /dev/null +++ b/Task/Input-loop/Sparkling/input-loop.sparkling @@ -0,0 +1,4 @@ +var line; +while (line = getline()) != nil { + print(line); +} diff --git a/Task/Input-loop/Ursa/input-loop.ursa b/Task/Input-loop/Ursa/input-loop.ursa new file mode 100644 index 0000000000..4a756a199f --- /dev/null +++ b/Task/Input-loop/Ursa/input-loop.ursa @@ -0,0 +1,5 @@ +decl file f +f.open "filename.txt" +while (f.hasnext) + out (in string f) endl console +end while diff --git a/Task/Input-loop/jq/input-loop-1.jq b/Task/Input-loop/jq/input-loop-1.jq new file mode 100644 index 0000000000..43df325b88 --- /dev/null +++ b/Task/Input-loop/jq/input-loop-1.jq @@ -0,0 +1 @@ +jq -r -R . FILENAME diff --git a/Task/Input-loop/jq/input-loop-2.jq b/Task/Input-loop/jq/input-loop-2.jq new file mode 100644 index 0000000000..192bef1b67 --- /dev/null +++ b/Task/Input-loop/jq/input-loop-2.jq @@ -0,0 +1 @@ +jq . FILENAME diff --git a/Task/Integer-comparison/8051-Assembly/integer-comparison.8051 b/Task/Integer-comparison/8051-Assembly/integer-comparison.8051 new file mode 100644 index 0000000000..63943cb4f4 --- /dev/null +++ b/Task/Integer-comparison/8051-Assembly/integer-comparison.8051 @@ -0,0 +1,17 @@ +compare: + push psw + cjne a, b, clt + ; a == b + ; implement code here + jmp compare_ +clt: + jc lt + ; a > b + ; implement code here + jmp compare_ +lt: + ; a < b + ; implement code here +compare_: + pop psw + ret diff --git a/Task/Integer-comparison/8th/integer-comparison.8th b/Task/Integer-comparison/8th/integer-comparison.8th new file mode 100644 index 0000000000..8b6a151f56 --- /dev/null +++ b/Task/Integer-comparison/8th/integer-comparison.8th @@ -0,0 +1,4 @@ +: compare \ n m -- + 2dup n:= if "They are equal" . cr then + 2dup n:< if "First less than second" . cr then + n:> if "First greater than second" . cr then ; diff --git a/Task/Integer-comparison/Axe/integer-comparison.axe b/Task/Integer-comparison/Axe/integer-comparison.axe new file mode 100644 index 0000000000..17f3518918 --- /dev/null +++ b/Task/Integer-comparison/Axe/integer-comparison.axe @@ -0,0 +1,11 @@ +Lbl FUNC +If r₁r₂ + Disp "GREATER THAN",i +End +Return diff --git a/Task/Integer-comparison/ChucK/integer-comparison.chuck b/Task/Integer-comparison/ChucK/integer-comparison.chuck new file mode 100644 index 0000000000..4d9d8433fa --- /dev/null +++ b/Task/Integer-comparison/ChucK/integer-comparison.chuck @@ -0,0 +1,8 @@ +fun void intComparison (int one, int two) +{ + if(one < two) <<< one, " is less than ", two >>>; + if(one == two) <<< one, " is equal than ", two >>>; + if(one > two) <<< one, " is greater than ", two >>>; +} +// uncomment next line and change values to test +// intComparison (2,4); diff --git a/Task/Integer-comparison/Computer-zero-Assembly/integer-comparison.computer b/Task/Integer-comparison/Computer-zero-Assembly/integer-comparison.computer new file mode 100644 index 0000000000..ba451bd8be --- /dev/null +++ b/Task/Integer-comparison/Computer-zero-Assembly/integer-comparison.computer @@ -0,0 +1,28 @@ +start: STP ; get input + +x: NOP +y: NOP + + LDA x + SUB y + BRZ start ; x=y, A=0 + +loop: LDA x + SUB one + BRZ xy + STA y + + JMP loop + +x>y: LDA one ; A := 1 + JMP start + +x B; + STRING ResultText := CASE (Result,1 => 'is greater than', 0 => 'is equal to','is less than'); + RETURN A + ' ' + TRIM(ResultText) + ' ' + B; +END; + +CompareThem(1,2); //Shows "1 is less than 2" +CompareThem(2,2); //Shows "2 is equal to 2" +CompareThem(2,1); //Shows "2 is greater than 1" diff --git a/Task/Integer-comparison/EDSAC-order-code/integer-comparison.edsac b/Task/Integer-comparison/EDSAC-order-code/integer-comparison.edsac new file mode 100644 index 0000000000..3f2ae214f9 --- /dev/null +++ b/Task/Integer-comparison/EDSAC-order-code/integer-comparison.edsac @@ -0,0 +1,55 @@ +[ Integer comparison + ================== + + A program for the EDSAC + + Illustrates the use of the E + (branch on accumulator sign + bit clear) and G (branch on + accumulator sign bit set) + orders + + The integers to be tested, x + and y, should be stored in + addresses 13@ and 14@ + + Output: the program causes the + machine to print + '+' if x > y, + '=' if x = y, + '-' if x < y. + + Works with Initial Orders 2 ] + + T56K [ load point ] + GK [ base address ] + + O15@ [ figure shift ] + + A13@ [ a = x ] + S14@ [ a -= y ] + G10@ [ if a<0 go to 10 ] + + S12@ [ a -= 1 ] + E8@ [ if a>=0 go to 8 ] + + O17@ [ write '=' ] + ZF [ halt ] + +[ 8 ] O16@ [ write '+' ] + ZF [ halt ] + +[ 10 ] O18@ [ write '-' ] + ZF [ halt ] + +[ 12 ] P0D [ const: 1 ] + +[ 13 ] P16D [ x = 37 ] +[ 14 ] P14F [ y = 28 ] + +[ 15 ] #F [ figure shift ] +[ 16 ] ZF [ + character ] +[ 17 ] VF [ = character ] +[ 18 ] AF [ - character ] + + EZPF [ begin execution ] diff --git a/Task/Integer-comparison/FreeBASIC/integer-comparison.freebasic b/Task/Integer-comparison/FreeBASIC/integer-comparison.freebasic new file mode 100644 index 0000000000..36c92a8876 --- /dev/null +++ b/Task/Integer-comparison/FreeBASIC/integer-comparison.freebasic @@ -0,0 +1,20 @@ +' FB 1.05.0 Win64 + +Dim As Integer x, y +Input "Please enter two integers, separated by a comma : ", x , y + +If x < y Then + Print x; " is less than "; y +End If + +If x = y Then + Print x; " is equal to "; y +End If + +If x > y Then + Print x; " is greater than "; y +End If + +Print +Print "Press any key to exit" +Sleep diff --git a/Task/Integer-comparison/FunL/integer-comparison.funl b/Task/Integer-comparison/FunL/integer-comparison.funl new file mode 100644 index 0000000000..0c6e02df24 --- /dev/null +++ b/Task/Integer-comparison/FunL/integer-comparison.funl @@ -0,0 +1,8 @@ +import console.readInt + +a = readInt() +b = readInt() + +val (_, c) = [((<), 'less than'), ((==), 'equal to'), ((>), 'greater than')].find( (compare, _) -> compare(a, b) ).get() + +println( "$a is $c $b." ) diff --git a/Task/Integer-comparison/FutureBasic/integer-comparison.futurebasic b/Task/Integer-comparison/FutureBasic/integer-comparison.futurebasic new file mode 100644 index 0000000000..3d1df1f527 --- /dev/null +++ b/Task/Integer-comparison/FutureBasic/integer-comparison.futurebasic @@ -0,0 +1,9 @@ +include "ConsoleWindow" + +dim as long n1, n2 + +input "Enter two numbers (separated by a comma) to compare: "; n1, n2 + +if n1 < n2 then print : print n1; " is less than"; n2 +if n1 > n2 then print : print n1; " is greater than"; n2 +if n1 == n2 then print : print n1; " equals"; n2 diff --git a/Task/Integer-comparison/Harbour/integer-comparison.harbour b/Task/Integer-comparison/Harbour/integer-comparison.harbour new file mode 100644 index 0000000000..1b04161ca6 --- /dev/null +++ b/Task/Integer-comparison/Harbour/integer-comparison.harbour @@ -0,0 +1,11 @@ +PROCEDURE Compare( a, b ) + + IF a < b + ? "A is less than B" + ELSEIF a > b + ? "A is more than B" + ELSE + ? "A equals B" + ENDIF + + RETURN diff --git a/Task/Integer-comparison/Lasso/integer-comparison.lasso b/Task/Integer-comparison/Lasso/integer-comparison.lasso new file mode 100644 index 0000000000..b8d639bf16 --- /dev/null +++ b/Task/Integer-comparison/Lasso/integer-comparison.lasso @@ -0,0 +1,10 @@ +local( + number1 = integer(web_request -> param('number1')), + number2 = integer(web_request -> param('number2')) +) + +#number1 < #number2 ? 'Number 1 is less than Number 2' | 'Number 1 is not less than Number 2' +'
' +#number1 == #number2 ? 'Number 1 is the same as Number 2' | 'Number 1 is not the same as Number 2' +'
' +#number1 > #number2 ? 'Number 1 is greater than Number 2' | 'Number 1 is not greater than Number 2' diff --git a/Task/Integer-comparison/Lingo/integer-comparison.lingo b/Task/Integer-comparison/Lingo/integer-comparison.lingo new file mode 100644 index 0000000000..b4d1b4161d --- /dev/null +++ b/Task/Integer-comparison/Lingo/integer-comparison.lingo @@ -0,0 +1,5 @@ +on compare (a, b) + if a < b then put a&" is less than "&b + if a = b then put a&" is equal to "&b + if a > b then put a&" is greater than "&b +end diff --git a/Task/Integer-comparison/LiveCode/integer-comparison.livecode b/Task/Integer-comparison/LiveCode/integer-comparison.livecode new file mode 100644 index 0000000000..a0016f9e2d --- /dev/null +++ b/Task/Integer-comparison/LiveCode/integer-comparison.livecode @@ -0,0 +1,20 @@ +ask question "Enter 2 numbers (comma separated)" with empty titled "Enter 2 numbers" +if it is not empty then + put item 1 of it into num1 + put item 2 of it into num2 + if isnumber(num1) and isnumber(num2) then + if num1 < num2 then answer num1 && "is less than" && num2 + if num1 is num2 then answer num1 && "is equal to" && num2 + if num1 > num2 then answer num1 && "is greater than" && num2 + + -- alternative is to use switch case construct + switch + case (num1 < num2) + answer num1 && "is less! than" && num2; break + case (num1 > num2) + answer num1 && "is greater! than" && num2; break + case (num1 = num2) + answer num1 && "equal! to" && num2 + end switch + end if +end if diff --git a/Task/Integer-comparison/Nim/integer-comparison.nim b/Task/Integer-comparison/Nim/integer-comparison.nim new file mode 100644 index 0000000000..fd3d16b1ff --- /dev/null +++ b/Task/Integer-comparison/Nim/integer-comparison.nim @@ -0,0 +1,10 @@ +import rdstdin, strutils +var a = parseInt(readLineFromStdin "Enter value of a: ") +var b = parseInt(readLineFromStdin "Enter value of b: ") + +if a < b: + echo "a is less than b" +elif a > b: + echo "a is greater than b" +elif a == b: + echo "a is equal to b" diff --git a/Task/Integer-comparison/Oforth/integer-comparison.oforth b/Task/Integer-comparison/Oforth/integer-comparison.oforth new file mode 100644 index 0000000000..4ac003fda9 --- /dev/null +++ b/Task/Integer-comparison/Oforth/integer-comparison.oforth @@ -0,0 +1,10 @@ +import: console + +: cmpInt +| a b | + doWhile: [ System.Console askln asInteger dup ->a isNull ] + doWhile: [ System.Console askln asInteger dup ->b isNull ] + + a b < ifTrue: [ System.Out a << " is less than " << b << cr ] + a b == ifTrue: [ System.Out a << " is equal to " << b << cr ] + a b > ifTrue: [ System.Out a << " is greater than " << b << cr ] ; diff --git a/Task/Integer-comparison/PHL/integer-comparison.phl b/Task/Integer-comparison/PHL/integer-comparison.phl new file mode 100644 index 0000000000..32007563ed --- /dev/null +++ b/Task/Integer-comparison/PHL/integer-comparison.phl @@ -0,0 +1,21 @@ +module intergertest; + +extern printf; +extern scanf; + +@Integer main [ + var a = 0; + var b = 0; + scanf("%i %i", ref (a), ref (b)); + + if (a < b) + printf("%i is less than %i\n", a::get, b::get); + + if (a == b) + printf("%i is equal to %i\n", a::get, b::get); + + if (a > b) + printf("%i is greater than %i\n", a::get, b::get); + + return 0; +] diff --git a/Task/Integer-comparison/Phix/integer-comparison.phix b/Task/Integer-comparison/Phix/integer-comparison.phix new file mode 100644 index 0000000000..bf365dcc7b --- /dev/null +++ b/Task/Integer-comparison/Phix/integer-comparison.phix @@ -0,0 +1,12 @@ +atom a = prompt_number("first number:",{}), + b = prompt_number("second number:",{}) + +printf(1,"%g is ",a) +if a < b then + puts(1,"less than") +elsif a = b then + puts(1,"equal to") +elsif a > b then + puts(1,"greater than") +end if +printf(1," %g",b) diff --git a/Task/Integer-comparison/Ring/integer-comparison.ring b/Task/Integer-comparison/Ring/integer-comparison.ring new file mode 100644 index 0000000000..acb1b3965c --- /dev/null +++ b/Task/Integer-comparison/Ring/integer-comparison.ring @@ -0,0 +1,8 @@ +Func Compare a,b + if a < b + See "A is less than B" + but a > b + See "A is more than B" + else + See "A equals B" + ok diff --git a/Task/Integer-comparison/SSEM/integer-comparison.ssem b/Task/Integer-comparison/SSEM/integer-comparison.ssem new file mode 100644 index 0000000000..99b0d381f2 --- /dev/null +++ b/Task/Integer-comparison/SSEM/integer-comparison.ssem @@ -0,0 +1,21 @@ +10101000000000100000000000000000 0. -21 to c +10101000000001100000000000000000 1. c to 21 +10101000000000100000000000000000 2. -21 to c +01101000000000010000000000000000 3. Sub. 22 +00000000000000110000000000000000 4. Test +00001000000001000000000000000000 5. Add 16 to CI +00101000000000000000000000000000 6. 20 to CI +00001000000000010000000000000000 7. Sub. 16 +00000000000000110000000000000000 8. Test +11001000000000000000000000000000 9. 19 to CI +10001000000000100000000000000000 10. -17 to c +00000000000001110000000000000000 11. Stop +01001000000000100000000000000000 12. -18 to c +00000000000001110000000000000000 13. Stop +00001000000000100000000000000000 14. -16 to c +00000000000001110000000000000000 15. Stop +10000000000000000000000000000000 16. 1 +00000000000000000000000000000000 17. 0 +11111111111111111111111111111111 18. -1 +11010000000000000000000000000000 19. 11 +10110000000000000000000000000000 20. 13 diff --git a/Task/Integer-comparison/Sidef/integer-comparison.sidef b/Task/Integer-comparison/Sidef/integer-comparison.sidef new file mode 100644 index 0000000000..c9ed33e019 --- /dev/null +++ b/Task/Integer-comparison/Sidef/integer-comparison.sidef @@ -0,0 +1,12 @@ +var a = read("a: ", Number); +var b = read("b: ", Number); + +if (a < b) { + say 'Lower'; +} +elsif (a == b) { + say 'Equal'; +} +elsif (a > b) { + say 'Greater'; +} diff --git a/Task/Integer-comparison/Sparkling/integer-comparison.sparkling b/Task/Integer-comparison/Sparkling/integer-comparison.sparkling new file mode 100644 index 0000000000..074ec04d3c --- /dev/null +++ b/Task/Integer-comparison/Sparkling/integer-comparison.sparkling @@ -0,0 +1,10 @@ +let a = 13, b = 37; +if a < b { + print("a < b"); +} else if a > b { + print("a > b"); +} else if a == b { + print("a == b"); +} else { + print("either a or b or both are NaN"); +} diff --git a/Task/Integer-comparison/Swift/integer-comparison.swift b/Task/Integer-comparison/Swift/integer-comparison.swift new file mode 100644 index 0000000000..3f3e15b5f2 --- /dev/null +++ b/Task/Integer-comparison/Swift/integer-comparison.swift @@ -0,0 +1,17 @@ +import Cocoa + +var input = NSFileHandle.fileHandleWithStandardInput() + +println("Enter two integers separated by a space: ") + +let data = input.availableData +let stringArray = NSString(data: data, encoding: NSUTF8StringEncoding)?.componentsSeparatedByString(" ") +var a:Int! +var b:Int! +if (stringArray?.count == 2) { + a = stringArray![0].integerValue + b = stringArray![1].integerValue +} +if (a==b) {println("\(a) equals \(b)")} +if (a < b) {println("\(a) is less than \(b)")} +if (a > b) {println("\(a) is greater than \(b)")} diff --git a/Task/Integer-comparison/Ursa/integer-comparison.ursa b/Task/Integer-comparison/Ursa/integer-comparison.ursa new file mode 100644 index 0000000000..8235c1e0db --- /dev/null +++ b/Task/Integer-comparison/Ursa/integer-comparison.ursa @@ -0,0 +1,15 @@ +decl int first second +out "enter first integer: " console +set first (in int console) +out "enter second integer: " console +set second (in int console) + +if (= first second) + out "the two integers are equal" endl console +end if +if (< first second) + out first " is less than " second endl console +end if +if (> first second) + out first " is greater than " second endl console +end if diff --git a/Task/Integer-comparison/Wart/integer-comparison.wart b/Task/Integer-comparison/Wart/integer-comparison.wart new file mode 100644 index 0000000000..34a615f3fc --- /dev/null +++ b/Task/Integer-comparison/Wart/integer-comparison.wart @@ -0,0 +1,8 @@ +a <- (read) +a <- (read) +prn (if (a < b) + : "a is less than b" + (a > b) + : "a is greater than b" + :else + : "a equals b") diff --git a/Task/Integer-comparison/XLISP/integer-comparison.xlisp b/Task/Integer-comparison/XLISP/integer-comparison.xlisp new file mode 100644 index 0000000000..97fc08bc44 --- /dev/null +++ b/Task/Integer-comparison/XLISP/integer-comparison.xlisp @@ -0,0 +1,10 @@ +(DEFUN COMPARE-INTEGERS () + (DISPLAY "Enter two integers separated by a space.") + (NEWLINE) + (DISPLAY "> ") + (DEFINE A (READ)) + (DEFINE B (READ)) + (COND + ((> A B) (DISPLAY "The first number is larger.")) + ((= A B) (DISPLAY "They are equal.")) + ((< A B) (DISPLAY "The first number is smaller.")))) diff --git a/Task/Integer-comparison/jq/integer-comparison-1.jq b/Task/Integer-comparison/jq/integer-comparison-1.jq new file mode 100644 index 0000000000..8e7ee6c060 --- /dev/null +++ b/Task/Integer-comparison/jq/integer-comparison-1.jq @@ -0,0 +1,16 @@ +# compare/0 compares the first two items if they are numbers, +# otherwise an "uncomparable" message is emitted. + +def compare: + def english: + if .[0] < .[1] then "less than" + elif .[0] == .[1] then "equal to" + else "greater than" + end; + if (.[0]|type) == "number" and (.[1]|type) == "number" then + "\(.[0]) is \(english) \(.[1])" + else + "\(.[0]) is uncomparable to \(.[1])" + end ; + +compare diff --git a/Task/Integer-comparison/jq/integer-comparison-2.jq b/Task/Integer-comparison/jq/integer-comparison-2.jq new file mode 100644 index 0000000000..bb401fda78 --- /dev/null +++ b/Task/Integer-comparison/jq/integer-comparison-2.jq @@ -0,0 +1,7 @@ +$ jq -s -r -f Integer_comparison.jq +1 2 +1 is less than 2 + +$ jq -s -r -f Integer_comparison.jq +1 "a" +1 is uncomparable to a diff --git a/Task/Integer-overflow/Axe/integer-overflow.axe b/Task/Integer-overflow/Axe/integer-overflow.axe new file mode 100644 index 0000000000..dea3d773a4 --- /dev/null +++ b/Task/Integer-overflow/Axe/integer-overflow.axe @@ -0,0 +1,4 @@ +Disp -65535▶Dec,i +Disp 40000+40000▶Dec,i +Disp 32767-65535▶Dec,i +Disp 257*257▶Dec,i diff --git a/Task/Integer-overflow/Computer-zero-Assembly/integer-overflow.computer b/Task/Integer-overflow/Computer-zero-Assembly/integer-overflow.computer new file mode 100644 index 0000000000..7b25b5f565 --- /dev/null +++ b/Task/Integer-overflow/Computer-zero-Assembly/integer-overflow.computer @@ -0,0 +1,7 @@ + LDA ff + ADD one + +... + +ff: 255 +one: 1 diff --git a/Task/Integer-overflow/FreeBASIC/integer-overflow.freebasic b/Task/Integer-overflow/FreeBASIC/integer-overflow.freebasic new file mode 100644 index 0000000000..29391e8f80 --- /dev/null +++ b/Task/Integer-overflow/FreeBASIC/integer-overflow.freebasic @@ -0,0 +1,48 @@ +' FB 1.05.0 Win64 + +' The suffixes L, LL, UL and ULL are added to the numbers to make it +' clear to the compiler that they are to be treated as: +' signed 4 byte, signed 8 byte, unsigned 4 byte and unsigned 8 byte +' integers, respectively. + +' Integer types in FB are freely convertible to each other. +' In general if the result of a computation would otherwise overflow +' it is converted to a higher integer type. + +' Consequently, although the calculations are the same as the C example, +' the results for the 32-bit integers are arithmetically correct (and different +' therefore from the C results) because they are converted to 8 byte integers. + +' However, as 8 byte integers are the largest integral type, no higher conversions are +' possible and so the results 'wrap round'. The 64-bit results are therefore the +' same as the C examples except the one where the compiler warns that there is an overflow +' which, frankly, I don't understand. + +Print "Signed 32-bit:" +Print -(-2147483647L-1L) +Print 2000000000L + 2000000000L +Print -2147483647L - 2147483647L +Print 46341L * 46341L +Print (-2147483647L-1L) \ -1L +Print +Print "Signed 64-bit:" +Print -(-9223372036854775807LL-1LL) +Print 5000000000000000000LL + 5000000000000000000LL +Print -9223372036854775807LL - 9223372036854775807LL +Print 3037000500LL * 3037000500LL +Print (-9223372036854775807LL - 1LL) \ -1LL ' compiler warning : Overflow in constant conversion +Print +Print "Unsigned 32-bit:" +Print -4294967295UL +Print 3000000000UL + 3000000000UL +Print 2147483647UL - 4294967295UL +Print 65537UL * 65537UL +Print +Print "Unsigned 64-bit:" +Print -18446744073709551615ULL ' compiler warning : Implicit conversion +Print 10000000000000000000ULL + 10000000000000000000ULL +Print 9223372036854775807ULL - 18446744073709551615ULL +Print 4294967296ULL * 4294967296ULL +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Integer-overflow/Lingo/integer-overflow.lingo b/Task/Integer-overflow/Lingo/integer-overflow.lingo new file mode 100644 index 0000000000..3a08509f9f --- /dev/null +++ b/Task/Integer-overflow/Lingo/integer-overflow.lingo @@ -0,0 +1,14 @@ +put -(-2147483647-1) +-- -2147483648 + +put 2000000000 + 2000000000 +-- -294967296 + +put -2147483647 - 2147483647 +-- 2 + +put 46341 * 46341 +-- -2147479015 + +put (-2147483647-1) / -1 +--> crashes Director (jeez!) diff --git a/Task/Integer-overflow/Phix/integer-overflow.phix b/Task/Integer-overflow/Phix/integer-overflow.phix new file mode 100644 index 0000000000..0b3d9b40e5 --- /dev/null +++ b/Task/Integer-overflow/Phix/integer-overflow.phix @@ -0,0 +1 @@ +integer i = 1000000000 + 1000000000 diff --git a/Task/Integer-overflow/Sidef/integer-overflow.sidef b/Task/Integer-overflow/Sidef/integer-overflow.sidef new file mode 100644 index 0000000000..fbcef0fd2d --- /dev/null +++ b/Task/Integer-overflow/Sidef/integer-overflow.sidef @@ -0,0 +1,2 @@ +var (a, b, c) = (9223372036854775807, 5000000000000000000, 3037000500); +[-(-a - 1), b + b, -a - a, c * c, (-a - 1)/-1].each { say _ }; diff --git a/Task/Integer-overflow/Swift/integer-overflow.swift b/Task/Integer-overflow/Swift/integer-overflow.swift new file mode 100644 index 0000000000..3469790bd0 --- /dev/null +++ b/Task/Integer-overflow/Swift/integer-overflow.swift @@ -0,0 +1,52 @@ +// By default, all overflows in Swift result in a runtime exception, which is always fatal +// However, you can opt-in to overflow behavior with the overflow operators and continue with wrong results + +var int32:Int32 +var int64:Int64 +var uInt32:UInt32 +var uInt64:UInt64 + +println("signed 32-bit int:") +int32 = -1 &* (-2147483647 - 1) +println(int32) +int32 = 2000000000 &+ 2000000000 +println(int32) +int32 = -2147483647 &- 2147483647 +println(int32) +int32 = 46341 &* 46341 +println(int32) +int32 = (-2147483647-1) &/ -1 +println(int32) +println() + +println("signed 64-bit int:") +int64 = -1 &* (-9223372036854775807 - 1) +println(int64) +int64 = 5000000000000000000&+5000000000000000000 +println(int64) +int64 = -9223372036854775807 &- 9223372036854775807 +println(int64) +int64 = 3037000500 &* 3037000500 +println(int64) +int64 = (-9223372036854775807-1) &/ -1 +println(int64) +println() + +println("unsigned 32-bit int:") +println("-4294967295 is caught as a compile time error") +uInt32 = 3000000000 &+ 3000000000 +println(uInt32) +uInt32 = 2147483647 &- 4294967295 +println(uInt32) +uInt32 = 65537 &* 65537 +println(uInt32) +println() + +println("unsigned 64-bit int:") +println("-18446744073709551615 is caught as a compile time error") +uInt64 = 10000000000000000000 &+ 10000000000000000000 +println(uInt64) +uInt64 = 9223372036854775807 &- 18446744073709551615 +println(uInt64) +uInt64 = 4294967296 &* 4294967296 +println(uInt64) diff --git a/Task/Integer-sequence/Axe/integer-sequence.axe b/Task/Integer-sequence/Axe/integer-sequence.axe new file mode 100644 index 0000000000..e4178efba2 --- /dev/null +++ b/Task/Integer-sequence/Axe/integer-sequence.axe @@ -0,0 +1,7 @@ +While getKey(0) +End +0→I +Repeat getKey(0) + Disp I▶Dec,i + I++ +EndIf I=0 diff --git a/Task/Integer-sequence/ChucK/integer-sequence.chuck b/Task/Integer-sequence/ChucK/integer-sequence.chuck new file mode 100644 index 0000000000..ddd37bd12b --- /dev/null +++ b/Task/Integer-sequence/ChucK/integer-sequence.chuck @@ -0,0 +1,4 @@ +for(1 => int i; i < Math.INT_MAX; i ++) +{ + <<< i >>>; +} diff --git a/Task/Integer-sequence/Computer-zero-Assembly/integer-sequence.computer b/Task/Integer-sequence/Computer-zero-Assembly/integer-sequence.computer new file mode 100644 index 0000000000..6c5e00104d --- /dev/null +++ b/Task/Integer-sequence/Computer-zero-Assembly/integer-sequence.computer @@ -0,0 +1,3 @@ +start: ADD one + JMP start +one: 1 diff --git a/Task/Integer-sequence/EDSAC-order-code/integer-sequence.edsac b/Task/Integer-sequence/EDSAC-order-code/integer-sequence.edsac new file mode 100644 index 0000000000..2aa997ac7b --- /dev/null +++ b/Task/Integer-sequence/EDSAC-order-code/integer-sequence.edsac @@ -0,0 +1,22 @@ +[ Integer sequence + ================ + + A program for the EDSAC + + Displays integers 1,2,3... + in binary form in the first + word of storage tank 2 + until stopped + + Works with Initial Orders 2 ] + +T56K [ set load point ] +GK [ set base address ] + +A3@ [ increment accumulator ] +U64F [ copy accumulator to 64 ] +E@ [ jump to base address ] + +P0D [ constant: 1 ] + +EZPF [ begin at load point ] diff --git a/Task/Integer-sequence/ERRE/integer-sequence.erre b/Task/Integer-sequence/ERRE/integer-sequence.erre new file mode 100644 index 0000000000..8a12336db0 --- /dev/null +++ b/Task/Integer-sequence/ERRE/integer-sequence.erre @@ -0,0 +1,7 @@ +............. +A%=0 +LOOP + A%=A%+1 + PRINT(A%;) +END LOOP +............. diff --git a/Task/Integer-sequence/EchoLisp/integer-sequence.echolisp b/Task/Integer-sequence/EchoLisp/integer-sequence.echolisp new file mode 100644 index 0000000000..2354ff14f8 --- /dev/null +++ b/Task/Integer-sequence/EchoLisp/integer-sequence.echolisp @@ -0,0 +1,2 @@ +(lib 'bigint) ;; arbitrary length integers +(for ((n (in-naturals))) (writeln n)) diff --git a/Task/Integer-sequence/FreeBASIC/integer-sequence.freebasic b/Task/Integer-sequence/FreeBASIC/integer-sequence.freebasic new file mode 100644 index 0000000000..14e2a25e7e --- /dev/null +++ b/Task/Integer-sequence/FreeBASIC/integer-sequence.freebasic @@ -0,0 +1,14 @@ +' FB 1.05.0 Win64 + +' FB does not natively support arbitrarily large integers though support can be added +' by using an external library such as GMP. For now we will just use an unsigned long integer. + +Print "Press Ctrl + C to stop the program at any time" +Dim i As Long = 1 + +Do + Print i + i += 1 +Loop Until i = 0 ' will wrap back to 0 when it reaches 4,294,967,296 + +Sleep diff --git a/Task/Integer-sequence/FunL/integer-sequence.funl b/Task/Integer-sequence/FunL/integer-sequence.funl new file mode 100644 index 0000000000..004a5af723 --- /dev/null +++ b/Task/Integer-sequence/FunL/integer-sequence.funl @@ -0,0 +1 @@ +for i <- 1.. do println( i ) diff --git a/Task/Integer-sequence/Futhark/integer-sequence.futhark b/Task/Integer-sequence/Futhark/integer-sequence.futhark new file mode 100644 index 0000000000..c830df5322 --- /dev/null +++ b/Task/Integer-sequence/Futhark/integer-sequence.futhark @@ -0,0 +1 @@ +fun main(n: int): [n]int = iota n diff --git a/Task/Integer-sequence/Lasso/integer-sequence.lasso b/Task/Integer-sequence/Lasso/integer-sequence.lasso new file mode 100644 index 0000000000..984b52e4ba --- /dev/null +++ b/Task/Integer-sequence/Lasso/integer-sequence.lasso @@ -0,0 +1,6 @@ +local(number = 1) +while(#number > 0) => {^ + #number++ + ' ' + //#number > 100 ? #number = -2 // uncomment this row if you want to halt the run after proving concept +^} diff --git a/Task/Integer-sequence/Lingo/integer-sequence-1.lingo b/Task/Integer-sequence/Lingo/integer-sequence-1.lingo new file mode 100644 index 0000000000..bd267b876a --- /dev/null +++ b/Task/Integer-sequence/Lingo/integer-sequence-1.lingo @@ -0,0 +1,5 @@ +i = 1 +repeat while i>0 + put i + i = i+1 +end repeat diff --git a/Task/Integer-sequence/Lingo/integer-sequence-2.lingo b/Task/Integer-sequence/Lingo/integer-sequence-2.lingo new file mode 100644 index 0000000000..22dc8779b8 --- /dev/null +++ b/Task/Integer-sequence/Lingo/integer-sequence-2.lingo @@ -0,0 +1,2 @@ +put the maxInteger +-- 2147483647 diff --git a/Task/Integer-sequence/Lingo/integer-sequence-3.lingo b/Task/Integer-sequence/Lingo/integer-sequence-3.lingo new file mode 100644 index 0000000000..7f554e909d --- /dev/null +++ b/Task/Integer-sequence/Lingo/integer-sequence-3.lingo @@ -0,0 +1,4 @@ +put the maxInteger+1 +-- -2147483648 +put the maxInteger+2 +-- -2147483647 diff --git a/Task/Integer-sequence/Lingo/integer-sequence-4.lingo b/Task/Integer-sequence/Lingo/integer-sequence-4.lingo new file mode 100644 index 0000000000..9a4d5cf918 --- /dev/null +++ b/Task/Integer-sequence/Lingo/integer-sequence-4.lingo @@ -0,0 +1,17 @@ +the floatPrecision = 0 -- forces floats to be printed without fractional digits + +put float(the maxInteger)+1 +-- 2147483648 + +-- max. whole value that can be stored as 8-byte-float precisely +maxFloat = power(2,53) -- 9007199254740992.0 + +i = 1.0 +repeat while i<=maxFloat + put i + i = i+1 +end repeat +-- 1 +-- 2 +-- 3 +-- ... diff --git a/Task/Integer-sequence/Nim/integer-sequence-1.nim b/Task/Integer-sequence/Nim/integer-sequence-1.nim new file mode 100644 index 0000000000..457128a5a8 --- /dev/null +++ b/Task/Integer-sequence/Nim/integer-sequence-1.nim @@ -0,0 +1,4 @@ +var i:int64 = 0 +while true: + inc i + echo i diff --git a/Task/Integer-sequence/Nim/integer-sequence-2.nim b/Task/Integer-sequence/Nim/integer-sequence-2.nim new file mode 100644 index 0000000000..4539422b7b --- /dev/null +++ b/Task/Integer-sequence/Nim/integer-sequence-2.nim @@ -0,0 +1,6 @@ +import bigints + +var i = 0.initBigInt +while true: + i += 1 + echo i diff --git a/Task/Integer-sequence/Oforth/integer-sequence.oforth b/Task/Integer-sequence/Oforth/integer-sequence.oforth new file mode 100644 index 0000000000..82e3ea79c3 --- /dev/null +++ b/Task/Integer-sequence/Oforth/integer-sequence.oforth @@ -0,0 +1 @@ +: integers 1 while( true ) [ dup . 1+ ] ; diff --git a/Task/Integer-sequence/Phix/integer-sequence-1.phix b/Task/Integer-sequence/Phix/integer-sequence-1.phix new file mode 100644 index 0000000000..3ac7efce2a --- /dev/null +++ b/Task/Integer-sequence/Phix/integer-sequence-1.phix @@ -0,0 +1,5 @@ +integer i = 0 +while 1 do + ?i + i += 1 +end while diff --git a/Task/Integer-sequence/Phix/integer-sequence-2.phix b/Task/Integer-sequence/Phix/integer-sequence-2.phix new file mode 100644 index 0000000000..80dbe71ff5 --- /dev/null +++ b/Task/Integer-sequence/Phix/integer-sequence-2.phix @@ -0,0 +1,5 @@ +atom a = 0 +while 1 do + ?a + a += 1 +end while diff --git a/Task/Integer-sequence/Phix/integer-sequence-3.phix b/Task/Integer-sequence/Phix/integer-sequence-3.phix new file mode 100644 index 0000000000..3ef3ffc2ff --- /dev/null +++ b/Task/Integer-sequence/Phix/integer-sequence-3.phix @@ -0,0 +1,6 @@ +include bigatom.e +bigatom b = ba_new(0) +while 1 do + ba_printf(1,"%B\n",b) + b = ba_add(b,1) +end while diff --git a/Task/Integer-sequence/Ring/integer-sequence.ring b/Task/Integer-sequence/Ring/integer-sequence.ring new file mode 100644 index 0000000000..c31f978373 --- /dev/null +++ b/Task/Integer-sequence/Ring/integer-sequence.ring @@ -0,0 +1,17 @@ +size = 10 + +for n = 1 to size + see n + nl +next +see nl + +for n in [1:size] + see n + nl +next +see nl + +i = n +while n <= size + see n + nl + n = n + 1 +end diff --git a/Task/Integer-sequence/SSEM/integer-sequence.ssem b/Task/Integer-sequence/SSEM/integer-sequence.ssem new file mode 100644 index 0000000000..6045434098 --- /dev/null +++ b/Task/Integer-sequence/SSEM/integer-sequence.ssem @@ -0,0 +1,3 @@ +01000000000000010000000000000000 0. Sub. 2 acc -= -1 +01000000000000000000000000000000 1. 2 to CI goto -1 + 1 +11111111111111111111111111111111 2. -1 diff --git a/Task/Integer-sequence/Sidef/integer-sequence.sidef b/Task/Integer-sequence/Sidef/integer-sequence.sidef new file mode 100644 index 0000000000..35b95992fe --- /dev/null +++ b/Task/Integer-sequence/Sidef/integer-sequence.sidef @@ -0,0 +1 @@ +{|i| say i } * Math.inf; diff --git a/Task/Integer-sequence/Swift/integer-sequence.swift b/Task/Integer-sequence/Swift/integer-sequence.swift new file mode 100644 index 0000000000..d5e1f7c2ea --- /dev/null +++ b/Task/Integer-sequence/Swift/integer-sequence.swift @@ -0,0 +1,4 @@ +var i = 0 +while true { + println(i++) +} diff --git a/Task/Integer-sequence/Ursa/integer-sequence.ursa b/Task/Integer-sequence/Ursa/integer-sequence.ursa new file mode 100644 index 0000000000..5c6abdd352 --- /dev/null +++ b/Task/Integer-sequence/Ursa/integer-sequence.ursa @@ -0,0 +1,11 @@ +# +# integer sequence +# + +# declare an int and loop until it overflows +decl int i +set i 1 +while true + out i endl console + inc i +end while diff --git a/Task/Integer-sequence/jq/integer-sequence-1.jq b/Task/Integer-sequence/jq/integer-sequence-1.jq new file mode 100644 index 0000000000..66b3bcd40c --- /dev/null +++ b/Task/Integer-sequence/jq/integer-sequence-1.jq @@ -0,0 +1,2 @@ +def iota: ., (. + 1 | iota); +0 | iota diff --git a/Task/Integer-sequence/jq/integer-sequence-2.jq b/Task/Integer-sequence/jq/integer-sequence-2.jq new file mode 100644 index 0000000000..75004d0a70 --- /dev/null +++ b/Task/Integer-sequence/jq/integer-sequence-2.jq @@ -0,0 +1 @@ +0 | while(true;. + 1) diff --git a/Task/Integer-sequence/jq/integer-sequence-3.jq b/Task/Integer-sequence/jq/integer-sequence-3.jq new file mode 100644 index 0000000000..02faf0b0e5 --- /dev/null +++ b/Task/Integer-sequence/jq/integer-sequence-3.jq @@ -0,0 +1 @@ +0 | recurse(. + 1) diff --git a/Task/Interactive-programming/EchoLisp/interactive-programming.echolisp b/Task/Interactive-programming/EchoLisp/interactive-programming.echolisp new file mode 100644 index 0000000000..a5cd815376 --- /dev/null +++ b/Task/Interactive-programming/EchoLisp/interactive-programming.echolisp @@ -0,0 +1,19 @@ +;; screen copy of the REPL +;; note that the &i variables remember expression evaluation, and may be used in other expressions + +EchoLisp - 2.16.2 +📗 local-db: db.version: 3 +(define ( f s1 s2 s3) (string-append s1 s3 s3 s2)) +[0]→ f +(f "Rosetta" "Code" ":") +[1]→ "Rosetta::Code" +(+ 4 8) +[2]→ 12 +(* 4 8) +[3]→ 32 +(* &2 &3) +[4]→ 384 +(f &1 &1 ":") +[5]→ "Rosetta::Code::Rosetta::Code" + +;; etc. diff --git a/Task/Interactive-programming/FreeBASIC/interactive-programming.freebasic b/Task/Interactive-programming/FreeBASIC/interactive-programming.freebasic new file mode 100644 index 0000000000..aeb055a8fd --- /dev/null +++ b/Task/Interactive-programming/FreeBASIC/interactive-programming.freebasic @@ -0,0 +1,8 @@ +' FB 1.05.0 Win64 + +Dim As String s1, s2, sep +Input "First string "; s1 +Input "Second string "; s2 +Input "Separator "; sep +Print : Print s1 + sep + sep + s2 +Sleep diff --git a/Task/Interactive-programming/Lasso/interactive-programming.lasso b/Task/Interactive-programming/Lasso/interactive-programming.lasso new file mode 100644 index 0000000000..2b2aba9735 --- /dev/null +++ b/Task/Interactive-programming/Lasso/interactive-programming.lasso @@ -0,0 +1,43 @@ +#!/usr/bin/lasso9 + +// filename: interactive_demo + +define concatenate_with_delimiter( + string1::string, + string2::string, + delimiter::string + +) => #string1 + (#delimiter*2) + #string2 + +define read_input(prompt::string) => { + + local(string) + + // display prompt + stdout(#prompt) + // the following bits wait until the terminal gives you back a line of input + while(not #string or #string -> size == 0) => { + #string = file_stdin -> readsomebytes(1024, 1000) + } + #string -> replace(bytes('\n'), bytes('')) + + return #string -> asstring +} + +local( + string1, + string2, + delimiter +) + +// get first string +#string1 = read_input('Enter the first string: ') + +// get second string +#string2 = read_input('Enter the second string: ') + +// get delimiter +#delimiter = read_input('Enter the delimiter: ') + +// deliver the result +stdoutnl(concatenate_with_delimiter(#string1, #string2, #delimiter)) diff --git a/Task/Interactive-programming/Lingo/interactive-programming.lingo b/Task/Interactive-programming/Lingo/interactive-programming.lingo new file mode 100644 index 0000000000..87320b7a06 --- /dev/null +++ b/Task/Interactive-programming/Lingo/interactive-programming.lingo @@ -0,0 +1,4 @@ +> m=new(#script) +> m.scripttext="on conc(a,b,c)"&RETURN&"return a&c&c&b"&RETURN&"end" +> put conc("Rosetta", "Code", ":") +-- "Rosetta::Code" diff --git a/Task/Interactive-programming/Oforth/interactive-programming-1.oforth b/Task/Interactive-programming/Oforth/interactive-programming-1.oforth new file mode 100644 index 0000000000..413f17acec --- /dev/null +++ b/Task/Interactive-programming/Oforth/interactive-programming-1.oforth @@ -0,0 +1 @@ +oforth --i diff --git a/Task/Interactive-programming/Oforth/interactive-programming-2.oforth b/Task/Interactive-programming/Oforth/interactive-programming-2.oforth new file mode 100644 index 0000000000..f33e54696a --- /dev/null +++ b/Task/Interactive-programming/Oforth/interactive-programming-2.oforth @@ -0,0 +1,8 @@ +: x(a, b, sep) a sep + sep + b + ; +ok +>x("Rosetta", "Code", ":") +ok +>.s +[1] (String) Rosetta::Code +ok +> diff --git a/Task/Interactive-programming/Oforth/interactive-programming-3.oforth b/Task/Interactive-programming/Oforth/interactive-programming-3.oforth new file mode 100644 index 0000000000..1943317698 --- /dev/null +++ b/Task/Interactive-programming/Oforth/interactive-programming-3.oforth @@ -0,0 +1,6 @@ + > : x dup rot + + + ; +ok +> "Rosetta" "Code" ";" x .s +[1] (String) Rosetta::Code +ok +> diff --git a/Task/Interactive-programming/Ring/interactive-programming.ring b/Task/Interactive-programming/Ring/interactive-programming.ring new file mode 100644 index 0000000000..e05519a9fb --- /dev/null +++ b/Task/Interactive-programming/Ring/interactive-programming.ring @@ -0,0 +1,4 @@ +r = "Rosetta" +c = "Code" +s = ":" +see r+s+s+c diff --git a/Task/Interactive-programming/Sidef/interactive-programming.sidef b/Task/Interactive-programming/Sidef/interactive-programming.sidef new file mode 100644 index 0000000000..d139b701f4 --- /dev/null +++ b/Task/Interactive-programming/Sidef/interactive-programming.sidef @@ -0,0 +1,6 @@ +$ sidef -i +>>> func f(s1, s2, sep) { s1 + sep*2 + s2 }; +f +>>> f('Rosetta', 'Code', ':') +"Rosetta::Code" +>>> diff --git a/Task/Interactive-programming/Ursa/interactive-programming.ursa b/Task/Interactive-programming/Ursa/interactive-programming.ursa new file mode 100644 index 0000000000..0154223a8d --- /dev/null +++ b/Task/Interactive-programming/Ursa/interactive-programming.ursa @@ -0,0 +1,9 @@ +$ java -jar ursa.jar +cygnus/x ursa v0.76 (default, release 1) +[Oracle Corporation JVM 1.8.0_91 on Linux 3.16.0-4-686-pae i386] +> def f (string s1, string s2, string sep) +.. return (+ s1 sep sep s2) +..end +> out (f "Rosetta" "Code" ":") endl console +Rosetta::Code +> _ diff --git a/Task/Interactive-programming/XLISP/interactive-programming.xlisp b/Task/Interactive-programming/XLISP/interactive-programming.xlisp new file mode 100644 index 0000000000..aa9a37a4ca --- /dev/null +++ b/Task/Interactive-programming/XLISP/interactive-programming.xlisp @@ -0,0 +1,9 @@ +XLISP 3.3, September 6, 2002 Copyright (c) 1984-2002, by David Betz +[1] (defun f (a b sep) + (string-append a sep sep b)) + +F +[2] (f "Rosetta" "Code" ":") + +"Rosetta::Code" +[3] diff --git a/Task/Introspection/EchoLisp/introspection.echolisp b/Task/Introspection/EchoLisp/introspection.echolisp new file mode 100644 index 0000000000..b6adf335eb --- /dev/null +++ b/Task/Introspection/EchoLisp/introspection.echolisp @@ -0,0 +1,26 @@ +(version) +→ EchoLisp - 2.50.3 + 📗 local-db: db.version: 3 + +(when (< (version) 2.6) + (writeln "Please reload EchoLisp : CTRL-F5, CMD-R or other...") + (exit)) + +(if (and (bound? 'bloop) (bound? 'abs) (procedure? abs)) + (abs bloop) 'NOT-HERE) + → NOT-HERE + +(define bloop -777) + → bloop +(if (and (bound? 'bloop) (bound? 'abs) (procedure? abs)) (abs bloop) 'NOT-HERE) + → 777 + +(for/sum ((kv (environment-bindings user-initial-environment ))) + #:when (integer? (second kv)) + (writeln kv) + (second kv)) + + ("bloop" -777) + ("gee" 555) + ("buzz" 333) + → 111 ;; sum diff --git a/Task/Introspection/Lasso/introspection-1.lasso b/Task/Introspection/Lasso/introspection-1.lasso new file mode 100644 index 0000000000..767f081289 --- /dev/null +++ b/Task/Introspection/Lasso/introspection-1.lasso @@ -0,0 +1,5 @@ +var(bloob = -26) + +decimal(lasso_version(-lassoversion)) < 9.2 ? abort + +var_defined('bloob') and $bloob -> isa(::integer) and lasso_tagexists('math_abs') ? math_abs($bloob) diff --git a/Task/Introspection/Lasso/introspection-2.lasso b/Task/Introspection/Lasso/introspection-2.lasso new file mode 100644 index 0000000000..bb5d11fbb4 --- /dev/null +++ b/Task/Introspection/Lasso/introspection-2.lasso @@ -0,0 +1,15 @@ +var( + bloob = -26, + positive = 450 +) + +local(total = integer) + +with v in var_keys +// Lasso creates a number of thread variables that all start with an underscore. We don't want those +where not(string(#v) -> beginswith('_')) and var(#v) -> isa(::integer) +do { + #total += var(#v) +} + +#total diff --git a/Task/Introspection/Lingo/introspection-1.lingo b/Task/Introspection/Lingo/introspection-1.lingo new file mode 100644 index 0000000000..82bd46a138 --- /dev/null +++ b/Task/Introspection/Lingo/introspection-1.lingo @@ -0,0 +1,5 @@ +put _player.productVersion +-- "11.5.9" + +_player.itemDelimiter="." +if integer(_player.productVersion.item[1])<11 then _player.quit() diff --git a/Task/Introspection/Lingo/introspection-2.lingo b/Task/Introspection/Lingo/introspection-2.lingo new file mode 100644 index 0000000000..de557bd045 --- /dev/null +++ b/Task/Introspection/Lingo/introspection-2.lingo @@ -0,0 +1,6 @@ +-- check existance of bloop in local scope +bloopExists = not voidP(value("bloop")) +-- or for global scope: +-- bloopExists = not voidP(_global.bloop) +absExists = value("abs(1)")=1 +if bloopExists and absExists then put abs(bloop) -- or abs(_global.bloop) diff --git a/Task/Introspection/Lingo/introspection-3.lingo b/Task/Introspection/Lingo/introspection-3.lingo new file mode 100644 index 0000000000..748ab01447 --- /dev/null +++ b/Task/Introspection/Lingo/introspection-3.lingo @@ -0,0 +1,10 @@ +cnt = 0 +sum = 0 +repeat with v in the globals + if integerP(v) then + cnt = cnt + 1 + sum = sum + v + end if +end repeat +put cnt +put sum diff --git a/Task/Introspection/Nim/introspection.nim b/Task/Introspection/Nim/introspection.nim new file mode 100644 index 0000000000..a34457795d --- /dev/null +++ b/Task/Introspection/Nim/introspection.nim @@ -0,0 +1,6 @@ +echo NimVersion + +var bloop = -12 + +when compiles abs(bloop): + echo abs(bloop) diff --git a/Task/Introspection/Oforth/introspection.oforth b/Task/Introspection/Oforth/introspection.oforth new file mode 100644 index 0000000000..775be4d069 --- /dev/null +++ b/Task/Introspection/Oforth/introspection.oforth @@ -0,0 +1,12 @@ +: bloopAbs +| bl m | + System.VERSION println + + Word find("bloop") ->bl + bl isA(Constant) ifFalse: [ "bloop constant does not exist" println return ] + + "abs" asMethod ->m + m ifNull: [ "abs method does not exist" println return ] + + System.Out "bloop value is : " << bl value << cr + System.Out "bloop abs is : " << bl value m perform << cr ; diff --git a/Task/Inverted-index/EchoLisp/inverted-index-1.echolisp b/Task/Inverted-index/EchoLisp/inverted-index-1.echolisp new file mode 100644 index 0000000000..01fbaea1e1 --- /dev/null +++ b/Task/Inverted-index/EchoLisp/inverted-index-1.echolisp @@ -0,0 +1,23 @@ +;; set of input files +(define FILES {T0.txt T1.txt T2.txt}) +;; store name for permanent inverted index +(define INVERT "INVERTED-INDEX") + +;; get text for each file, and call (action filename text) +(define (map-files action files) + (for ((file files)) + (file->string action file))) + +;; create store +(local-make-store INVERT) + +; invert-word : word -> set of files +(define (invert-word word file store) + (local-put-value word + (make-set (cons file (local-get-value word store))) store)) + +; parse file text and invert each word +(define (invert-text file text) + (writeln 'Inverting file text) + (let ((text (text-parse text))) + (for ((word text)) (invert-word (string-downcase word) file INVERT)))) diff --git a/Task/Inverted-index/EchoLisp/inverted-index-2.echolisp b/Task/Inverted-index/EchoLisp/inverted-index-2.echolisp new file mode 100644 index 0000000000..e023d28ede --- /dev/null +++ b/Task/Inverted-index/EchoLisp/inverted-index-2.echolisp @@ -0,0 +1,11 @@ +;; usage : (inverted-search w1 w2 ..) +(define-syntax-rule (inverted-search w ...) + (and-get-invert (quote w ))) + +;; intersects all sets referenced by words +;; returns the intersection +(define (and-get-invert words) + (foldl + (lambda(word res) + (set-intersect res (local-get-value word INVERT))) + FILES words)) diff --git a/Task/Inverted-index/EchoLisp/inverted-index-3.echolisp b/Task/Inverted-index/EchoLisp/inverted-index-3.echolisp new file mode 100644 index 0000000000..963722ac1e --- /dev/null +++ b/Task/Inverted-index/EchoLisp/inverted-index-3.echolisp @@ -0,0 +1,9 @@ +(map-files invert-text FILES) +(inverted-search is it) +[0]→ { T0.txt T1.txt T2.txt } +(inverted-search is banana) +[1]→ { T2.txt } +(inverted-search is what) +[2]→ { T0.txt T1.txt } +(inverted-search boule) +[3]→ null diff --git a/Task/Inverted-index/Phix/inverted-index.phix b/Task/Inverted-index/Phix/inverted-index.phix new file mode 100644 index 0000000000..717682b98e --- /dev/null +++ b/Task/Inverted-index/Phix/inverted-index.phix @@ -0,0 +1,81 @@ +integer word_count = 0 +sequence filenames = {} + +function is_ascii(string txt) + for i=1 to length(txt) do + integer ch = txt[i] + if ch='\0' or ch>=#7F then return 0 end if + end for + return 1 +end function + +procedure add_words(string name, sequence words) + filenames = append(filenames,name) + integer fn = length(filenames) + for i=1 to length(words) do + string word = words[i] + if word[1]>='a' -- skip numbers + and word[1]<='z' then + integer node = getd_index(word) + if node=0 then -- not present + setd(word,{fn}) + word_count += 1 + else + sequence val = getd_by_index(node) + if find(fn,val)=0 then + setd(word,append(val,fn)) + end if + end if + end if + end for +end procedure + +procedure load_directory() +sequence d = dir(".") + for i=1 to length(d) do + if not find('d',d[i][D_ATTRIBUTES]) -- skip directories + and d[i][D_SIZE]<1024*1024*1024 then -- and files > 1GB + string name = d[i][D_NAME] + integer fn = open(name,"rb") + string txt = lower(get_text(fn)) + close(fn) + if is_ascii(txt) then -- skip any bitmaps etc + sequence words = split_any(txt,"\0\r\n\t !\"#$%&\'()*+,-./:;<=>?@[\\]^`{|}~",0,1) + add_words(name,words) + end if + end if + end for +end procedure + +function lookup(sequence words) +sequence files = {} -- indexes to filenames + for i=1 to length(words) do + string word = words[i] + integer node = getd_index(word) + if node=0 then return {} end if + sequence val = getd_by_index(node) + if i=1 then + files = val + else + for j=length(files) to 1 by -1 do + if not find(files[j],val) then + files[j..j] = {} + end if + end for + if length(files)=0 then return {} end if + end if + end for + for i=1 to length(files) do + files[i] = filenames[files[i]] + end for + return files +end function + +load_directory() +?word_count +?lookup({"load_directory"}) -- should only be this file +?lookup({"dir"}) -- currently two use this +?lookup({"lower"}) -- currently four use this +?lookup({"lower","dir"}) -- currently two use both +?lookup({"dir","lower"}) -- should be the same two +?lookup({"ban"&"anafish"}) -- should be none ({}) diff --git a/Task/Inverted-index/jq/inverted-index-1.jq b/Task/Inverted-index/jq/inverted-index-1.jq new file mode 100644 index 0000000000..58ad9d2d5e --- /dev/null +++ b/Task/Inverted-index/jq/inverted-index-1.jq @@ -0,0 +1,18 @@ +# Given an array of [ doc, array_of_distinct_words ] +# construct a lookup table: { word: array_of_docs } +def inverted_index: + reduce .[] as $pair + ({}; + $pair[0] as $doc + | reduce $pair[1][] as $word + (.; .[$word] += [$doc])); + +def search(words): + def overlap(that): . as $this + | reduce that[] as $item ([]; if $this|index($item) then . + [$item] else . end); + + . as $dict + | if (words|length) == 0 then [] + else reduce words[1:][] as $word + ( $dict[words[0]]; overlap( $dict[$word] ) ) + end ; diff --git a/Task/Inverted-index/jq/inverted-index-2.jq b/Task/Inverted-index/jq/inverted-index-2.jq new file mode 100644 index 0000000000..c046bdb8bf --- /dev/null +++ b/Task/Inverted-index/jq/inverted-index-2.jq @@ -0,0 +1,8 @@ +def prompt_search: + "Enter a string or an array of strings to search for, quoting each string, or 0 to exit:", + ( (input | if type == "array" then . elif type == "string" then [.] + else empty + end) as $in + | search($in), prompt_search ) ; + +$in | inverted_index | prompt_search diff --git a/Task/Inverted-index/jq/inverted-index-3.jq b/Task/Inverted-index/jq/inverted-index-3.jq new file mode 100644 index 0000000000..c678023d25 --- /dev/null +++ b/Task/Inverted-index/jq/inverted-index-3.jq @@ -0,0 +1,10 @@ +$ jq -r -c -n --argfile in <(jq -R 'split(" ") | select(length>0) | [input_filename, unique]' T?.txt) -f Inverted_index.jq +Enter a string or an array of strings to search for, quoting each string, or 0 to exit: +"is" +["T0.txt","T1.txt","T2.txt"] +Enter a string or an array of strings to search for, quoting each string, or 0 to exit: +["is", "banana"] +["T2.txt"] +Enter a string or an array of strings to search for, quoting each string, or 0 to exit: +0 +$ diff --git a/Task/Inverted-syntax/EchoLisp/inverted-syntax.echolisp b/Task/Inverted-syntax/EchoLisp/inverted-syntax.echolisp new file mode 100644 index 0000000000..3cfcf39793 --- /dev/null +++ b/Task/Inverted-syntax/EchoLisp/inverted-syntax.echolisp @@ -0,0 +1,23 @@ +;; use reader macros to transform (a OP b) into (OP b a) + +(lib 'match) +(define-macro invert-= (a <- b) (set! b a)) +(define-macro invert-IF (a 'IF b) (when b a)) + +(define raining #f) + +(#t <- raining) +raining + → #t +('umbrella-need IF raining) + → umbrella-need + +(#f <- raining) +('umbrella-need IF raining) + → #f + +;; debug mode +(debug 3) +('umbrella-need IF raining) +💡 [0] invert-IF → ('umbrella-need IF raining) +compiled :: (#when raining 'umbrella-need) diff --git a/Task/Inverted-syntax/FreeBASIC/inverted-syntax.freebasic b/Task/Inverted-syntax/FreeBASIC/inverted-syntax.freebasic new file mode 100644 index 0000000000..eff72bfe9c --- /dev/null +++ b/Task/Inverted-syntax/FreeBASIC/inverted-syntax.freebasic @@ -0,0 +1,13 @@ +' FB 1.05.0 Win64 + +#Define ThenIf(a, b) If b Then a +#Define InvertAssign(a, b) b = a + +Dim As Boolean needUmbrella = False, raining = True +ThenIf(needUmbrella = True, raining = True) +Print "needUmbrella = "; needUmbrella + +Dim As Integer b = 0, a = 3 +InvertAssign(a, b) +Print "b is"; b +Sleep diff --git a/Task/Inverted-syntax/Sidef/inverted-syntax.sidef b/Task/Inverted-syntax/Sidef/inverted-syntax.sidef new file mode 100644 index 0000000000..989a21bf10 --- /dev/null +++ b/Task/Inverted-syntax/Sidef/inverted-syntax.sidef @@ -0,0 +1,8 @@ +# Inverted syntax with assignment +var raining = true; +[false]»(\var needumbrella); + +# Inverted syntax with conditional expressions +if (raining==true) {needumbrella=true}; +{needumbrella=true} -> if (raining==true); +(needumbrella=true) if (raining==true); diff --git a/Task/Inverted-syntax/Swift/inverted-syntax.swift b/Task/Inverted-syntax/Swift/inverted-syntax.swift new file mode 100644 index 0000000000..5d3f56fd92 --- /dev/null +++ b/Task/Inverted-syntax/Swift/inverted-syntax.swift @@ -0,0 +1,29 @@ +infix operator ~= {} +infix operator ! {} + +func ~=(lhs:Int, inout rhs:Int) { + rhs = lhs +} + +func !(lhs:(() -> Void), rhs:Bool) { + if (rhs) { + lhs() + } +} + +// Traditional assignment +var a = 0 + +// Inverted using a custom operator +20 ~= a + +let raining = true +let tornado = true +var needUmbrella = false +var stayInside = false + +// Traditional conditional expression +if raining {needUmbrella = true} + +// Inverted using a custom operator +_ = {stayInside = true} ! tornado diff --git a/Task/Inverted-syntax/Wortel/inverted-syntax.wortel b/Task/Inverted-syntax/Wortel/inverted-syntax.wortel new file mode 100644 index 0000000000..a1052df01b --- /dev/null +++ b/Task/Inverted-syntax/Wortel/inverted-syntax.wortel @@ -0,0 +1,8 @@ +; a = expr +:a expr +; expr = a +~:expr a +; if cond expr +@if cond expr +; if expr cond +~@if expr cond diff --git a/Task/Inverted-syntax/jq/inverted-syntax-1.jq b/Task/Inverted-syntax/jq/inverted-syntax-1.jq new file mode 100644 index 0000000000..360eddc84e --- /dev/null +++ b/Task/Inverted-syntax/jq/inverted-syntax-1.jq @@ -0,0 +1 @@ +v as $x diff --git a/Task/Inverted-syntax/jq/inverted-syntax-2.jq b/Task/Inverted-syntax/jq/inverted-syntax-2.jq new file mode 100644 index 0000000000..f6a7cdfbf9 --- /dev/null +++ b/Task/Inverted-syntax/jq/inverted-syntax-2.jq @@ -0,0 +1,2 @@ +o["a"] = 2 +# or equivalently: o.a = 2 diff --git a/Task/Iterated-digits-squaring/Ceylon/iterated-digits-squaring.ceylon b/Task/Iterated-digits-squaring/Ceylon/iterated-digits-squaring.ceylon new file mode 100644 index 0000000000..e384ba4397 --- /dev/null +++ b/Task/Iterated-digits-squaring/Ceylon/iterated-digits-squaring.ceylon @@ -0,0 +1,28 @@ +shared void run() { + + function digitsSquaredSum(variable Integer n) { + variable value total = 0; + while(n > 0) { + total += (n % 10) ^ 2; + n /= 10; + } + return total; + } + + function lastSum(variable Integer n) { + while(true) { + n = digitsSquaredSum(n); + if(n == 89 || n == 1) { + return n; + } + } + } + + variable value eightyNines = 0; + for(i in 1..100M - 1) { + if(lastSum(i) == 89) { + eightyNines++; + } + } + print(eightyNines); +} diff --git a/Task/Iterated-digits-squaring/ERRE/iterated-digits-squaring.erre b/Task/Iterated-digits-squaring/ERRE/iterated-digits-squaring.erre new file mode 100644 index 0000000000..bd52a9994d --- /dev/null +++ b/Task/Iterated-digits-squaring/ERRE/iterated-digits-squaring.erre @@ -0,0 +1,18 @@ +PROGRAM ITERATION + +BEGIN + PRINT(CHR$(12);) ! CLS + INPUT(N) + LOOP + N$=MID$(STR$(N),2) + S=0 + FOR I=1 TO LEN(N$) DO + A=VAL(MID$(N$,I,1)) + S=S+A*A + END FOR + IF S=89 OR S=1 THEN PRINT(S;) EXIT END IF + PRINT(S;) + N=S + END LOOP + PRINT +END PROGRAM diff --git a/Task/Iterated-digits-squaring/FreeBASIC/iterated-digits-squaring.freebasic b/Task/Iterated-digits-squaring/FreeBASIC/iterated-digits-squaring.freebasic new file mode 100644 index 0000000000..59e72d4a28 --- /dev/null +++ b/Task/Iterated-digits-squaring/FreeBASIC/iterated-digits-squaring.freebasic @@ -0,0 +1,47 @@ +' FB 1.05.0 Win64 + +' similar to C Language (first approach) +' timing for i3 @ 2.13 GHz + +Function endsWith89(n As Integer) As Boolean + Dim As Integer digit, sum = 0 + Do + While n > 0 + digit = n Mod 10 + sum += digit * digit + n \= 10 + Wend + If sum = 89 Then Return True + If sum = 1 Then Return False + n = sum + sum = 0 + Loop +End Function + +Dim As Double start = timer +Dim sums(0 To 8 * 81) As UInteger +sums(0) = 1 +sums(1) = 0 +Dim s As Integer +For n As Integer = 1 To 8 + For i As Integer = n * 81 To 1 Step -1 + For j As Integer = 1 To 9 + s = j * j + If s > i Then Exit For + sums(i) += sums(i - s) + Next j + Next i + + If n = 8 Then + Dim As UInteger count89 = 0 + For i As Integer = 1 To n * 81 + If Not endsWith89(i) Then Continue For + count89 += sums(i) + Next i + Print "There are";count89; " numbers from 1 to 100 million ending with 89" + End If +Next +Print "Elapsed milliseconds ="; Int((timer - start) * 1000 + 0.5) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Iterated-digits-squaring/Oforth/iterated-digits-squaring.oforth b/Task/Iterated-digits-squaring/Oforth/iterated-digits-squaring.oforth new file mode 100644 index 0000000000..657f9483f2 --- /dev/null +++ b/Task/Iterated-digits-squaring/Oforth/iterated-digits-squaring.oforth @@ -0,0 +1,7 @@ +: sq_digits(n) + while (n 1 <> n 89 <> and ) [ + 0 while(n) [ n 10 /mod ->n dup * + ] + ->n + ] n ; + +: iterDigits | i | 0 100000000 loop: i [ i sq_digits 89 &= + ] . ; diff --git a/Task/Iterated-digits-squaring/Ring/iterated-digits-squaring.ring b/Task/Iterated-digits-squaring/Ring/iterated-digits-squaring.ring new file mode 100644 index 0000000000..fe6b622a7c --- /dev/null +++ b/Task/Iterated-digits-squaring/Ring/iterated-digits-squaring.ring @@ -0,0 +1,10 @@ +nr = 1000 +num = 0 +for n = 1 to nr + sum = 0 + for m = 1 to len(string(n)) + sum += pow(number(substr(string(n),m,1)),2) + if sum = 89 num += 1 see "" + n + " " + sum + nl ok + next +next +see "Total under 1000 is : " + num + nl diff --git a/Task/Iterated-digits-squaring/jq/iterated-digits-squaring-1.jq b/Task/Iterated-digits-squaring/jq/iterated-digits-squaring-1.jq new file mode 100644 index 0000000000..b958bf7641 --- /dev/null +++ b/Task/Iterated-digits-squaring/jq/iterated-digits-squaring-1.jq @@ -0,0 +1,23 @@ +def factorial: reduce range(2;.+1) as $i (1; . * $i); + +# Pick n items (with replacement) from the input array, +# but only consider distinct combinations: +def pick(n): + def pick(n; m): # pick n, from m onwards + if n == 0 then [] + elif m == length then empty + elif n == 1 then (.[m:][] | [.]) + else ([.[m]] + pick(n-1; m)), pick(n; m+1) + end; + pick(n;0) ; + +# Given any array, produce an array of [item, count] pairs for each run. +def runs: + reduce .[] as $item + ( []; + if . == [] then [ [ $item, 1] ] + else .[length-1] as $last + | if $last[0] == $item then (.[0:length-1] + [ [$item, $last[1] + 1] ] ) + else . + [[$item, 1]] + end + end ) ; diff --git a/Task/Iterated-digits-squaring/jq/iterated-digits-squaring-2.jq b/Task/Iterated-digits-squaring/jq/iterated-digits-squaring-2.jq new file mode 100644 index 0000000000..c2d7cbe6cc --- /dev/null +++ b/Task/Iterated-digits-squaring/jq/iterated-digits-squaring-2.jq @@ -0,0 +1,28 @@ +def terminus: + # sum of the squared digits + def ssdigits: tostring | explode | map(. - 48 | .*.) | add; + + if . == 1 or . == 89 then . + else ssdigits | terminus + end; + +# Count the number of integers i in [1... 10^D] with terminus equal to 89. +def task(D): + # The max sum of squares is D*81 so return an array that will instantly + # reveal whether n|terminus is 89: + def cache: + reduce range(1; D*81+1) as $d ([false]; . + [$d|terminus == 89]); + + # Compute n / (i1! * i2! * ... ) for the given combination, + # which is assumed to be in order: + def combinations(n): + runs | map( .[1] | factorial) | reduce .[] as $i (n; ./$i); + + cache as $cache + | (D|factorial) as $Dfactorial + | reduce ([range(0;10)] | pick(D)) as $digits + (0; + ($digits | map(.*.) | add) as $ss + | if $cache[$ss] then . + ($digits|combinations($Dfactorial)) + else . + end) ; diff --git a/Task/Iterated-digits-squaring/jq/iterated-digits-squaring-3.jq b/Task/Iterated-digits-squaring/jq/iterated-digits-squaring-3.jq new file mode 100644 index 0000000000..aeb587387d --- /dev/null +++ b/Task/Iterated-digits-squaring/jq/iterated-digits-squaring-3.jq @@ -0,0 +1 @@ +task(8) diff --git a/Task/Iterated-digits-squaring/jq/iterated-digits-squaring-4.jq b/Task/Iterated-digits-squaring/jq/iterated-digits-squaring-4.jq new file mode 100644 index 0000000000..56f27fb585 --- /dev/null +++ b/Task/Iterated-digits-squaring/jq/iterated-digits-squaring-4.jq @@ -0,0 +1,10 @@ +$ jq -M -n -f Iterated_digits_squaring_using_pick.jq +85744333 + +# Using jq>1.4: +# user 0m2.595s +# sys 0m0.010s + +# Using jq 1.4: +# user 0m3.942s +# sys 0m0.009s diff --git a/Task/JSON/AntLang/json.antlang b/Task/JSON/AntLang/json.antlang new file mode 100644 index 0000000000..458edcaa71 --- /dev/null +++ b/Task/JSON/AntLang/json.antlang @@ -0,0 +1 @@ +json:{[data]catch[eval[,|{[y]catch[{":" = "="; "[" = "<"; "]" = ">"; "," = ";"}[y];{x};{[]y}]}'("""("(\\.|[^\\"])*"|\-?[0-9]+(\.[0-9]+)?|\{|\}|\[|\]|\:|\,)"""~data)["strings"]];{x};{error["Invalid JSON"]}]} diff --git a/Task/JSON/Apex/json.apex b/Task/JSON/Apex/json.apex new file mode 100644 index 0000000000..0d197b2c84 --- /dev/null +++ b/Task/JSON/Apex/json.apex @@ -0,0 +1,14 @@ +class TestClass{ + String foo {get;set;} + Integer bar {get;set;} +} + +TestClass testObj = new TestClass(); +testObj.foo = 'ABC'; +testObj.bar = 123; + +String serializedString = JSON.serialize(testObj); +TestClass deserializedObject = (TestClass)JSON.deserialize(serializedString, TestClass.class); + +//"testObj.foo == deserializedObject.foo" is true +//"testObj.bar == deserializedObject.bar" is true diff --git a/Task/JSON/EchoLisp/json.echolisp b/Task/JSON/EchoLisp/json.echolisp new file mode 100644 index 0000000000..9ddbe643e7 --- /dev/null +++ b/Task/JSON/EchoLisp/json.echolisp @@ -0,0 +1,34 @@ +;; JSON standard types : strings, numbers, and arrays (vectors) +(export-json #(6 7 8 9)) → "[6,7,8,9]" +(export-json #("alpha" "beta" "gamma")) → "["alpha","beta","gamma"]" + +(json-import "[6,7,8,9]") → #( 6 7 8 9) +(json-import #<< ["alpha","beta","gamma"] >>#) → #( "alpha" "beta" "gamma") + +;; EchoLisp types : dates, rational, complex, big int +(export-json 3/4) → "{"_instanceof":"Rational","a":3,"b":4}" +(json-import #<< {"_instanceof":"Rational","a":666,"b":42} >>#) → 111/7 + +;; Symbols +(export-json 'Simon-Gallubert) → "{"_instanceof":"Symbol","name":"Simon-Gallubert"}" +(json-import #<< {"_instanceof":"Symbol","name":"Antoinette-de-Gabolde"} >>#) + → Antoinette-de-Gabolde + +;; Lists +(define my-list + (export-json '( 43 4 5 ( 6 7 ( 8 9 ))))) + → "{"_instanceof":"List" ,"array":[43,4,5,{"_instanceof":"List", + "array":[6,7,{"_instanceof":"List", + "array":[8,9],"circular":false}],"circular":false}],"circular":false}" + +(json-import my-list) → (43 4 5 (6 7 (8 9))) + +;; Structures +(struct Person (name pict)) → #struct:Person [name pict] +(define antoinette (Person "antoinette" "👰")) → # (antoinette 👰) + +(export-json antoinette) → + "{"_instanceof":"Struct", "struct":"Person","id":17,"fields":["antoinette","👰"]}" +(json-import + #<< {"_instanceof":"Struct","struct":"Person","id":18,"fields":["simon","🎩"]} >>#) + → # (simon 🎩) diff --git a/Task/JSON/FunL/json-1.funl b/Task/JSON/FunL/json-1.funl new file mode 100644 index 0000000000..4ffa26d3d1 --- /dev/null +++ b/Task/JSON/FunL/json-1.funl @@ -0,0 +1 @@ +println( eval('{ "foo": 1, "bar": [10, "apples"] }') ) diff --git a/Task/JSON/FunL/json-2.funl b/Task/JSON/FunL/json-2.funl new file mode 100644 index 0000000000..4959434745 --- /dev/null +++ b/Task/JSON/FunL/json-2.funl @@ -0,0 +1,3 @@ +import json.* + +DefaultJSONWriter.write( JSONReader({'ints', 'bigInts'}).fromString('{ "foo": 1, "bar": [10, "apples"] }') ) diff --git a/Task/JSON/Harbour/json-1.harbour b/Task/JSON/Harbour/json-1.harbour new file mode 100644 index 0000000000..d90a744cd5 --- /dev/null +++ b/Task/JSON/Harbour/json-1.harbour @@ -0,0 +1,2 @@ +LOCAL arr +hb_jsonDecode( '[101,[26,"Test1"],18,false]', @arr ) diff --git a/Task/JSON/Harbour/json-2.harbour b/Task/JSON/Harbour/json-2.harbour new file mode 100644 index 0000000000..3b4111c87a --- /dev/null +++ b/Task/JSON/Harbour/json-2.harbour @@ -0,0 +1,4 @@ +LOCAL arr := { 101, { 18, "Test1" }, 18, .F. } +? hb_jsonEncode( arr ) +// The output is: +// [101,[26,"Test1"],18,false] diff --git a/Task/JSON/Hoon/json.hoon b/Task/JSON/Hoon/json.hoon new file mode 100644 index 0000000000..3a21a1fcbb --- /dev/null +++ b/Task/JSON/Hoon/json.hoon @@ -0,0 +1,15 @@ +:- %say +|= [^ [in=@tas ~] ~] +:- %noun + =+ obj=(need (poja in)) :: try parse to json + =+ typ=$:(name=@tas age=@ud) :: datastructure + =+ spec=(ot name/so age/ni ~):jo :: parsing spec + ?. ?=([%o *] obj) :: isnt an object? + ~ + =+ ^= o + %. %. (spec obj) :: parse with spec + need :: panic if failed + ,typ :: cast to type + =. age.o +(age.o) :: increment its age... + %: crip %: pojo :: pretty-print result + (jobe [%name s/name.o] [%age n/(crip )] ~) :: convert back to json diff --git a/Task/JSON/LFE/json-1.lfe b/Task/JSON/LFE/json-1.lfe new file mode 100644 index 0000000000..c9897cb404 --- /dev/null +++ b/Task/JSON/LFE/json-1.lfe @@ -0,0 +1 @@ +(: jiffy encode (list 1 2 3 '"apple" 'true 3.14)) diff --git a/Task/JSON/LFE/json-2.lfe b/Task/JSON/LFE/json-2.lfe new file mode 100644 index 0000000000..c1539c0540 --- /dev/null +++ b/Task/JSON/LFE/json-2.lfe @@ -0,0 +1,2 @@ +(: erlang binary_to_list + (: jiffy encode (list 1 2 3 '"apple" 'true 3.14))) diff --git a/Task/JSON/LFE/json-3.lfe b/Task/JSON/LFE/json-3.lfe new file mode 100644 index 0000000000..86d7503a51 --- /dev/null +++ b/Task/JSON/LFE/json-3.lfe @@ -0,0 +1 @@ +(: jiffy decode '"[1,2,3,[97,112,112,108,101],true,3.14]") diff --git a/Task/JSON/LFE/json-4.lfe b/Task/JSON/LFE/json-4.lfe new file mode 100644 index 0000000000..1169822fd5 --- /dev/null +++ b/Task/JSON/LFE/json-4.lfe @@ -0,0 +1 @@ +(: jiffy decode '"{\"foo\": [1, 2, 3]}") diff --git a/Task/JSON/LFE/json-5.lfe b/Task/JSON/LFE/json-5.lfe new file mode 100644 index 0000000000..12838e8a9f --- /dev/null +++ b/Task/JSON/LFE/json-5.lfe @@ -0,0 +1,3 @@ +(let (((tuple (list (tuple key value))) + (: jiffy decode '"{\"foo\": [1, 2, 3]}"))) + (: io format '"~p: ~p~n" (list key value))) diff --git a/Task/JSON/Lasso/json.lasso b/Task/JSON/Lasso/json.lasso new file mode 100644 index 0000000000..18ab9e2c71 --- /dev/null +++ b/Task/JSON/Lasso/json.lasso @@ -0,0 +1,35 @@ +// Javascript objects are represented by maps in Lasso +local(mymap = map( + 'success' = true, + 'numeric' = 11, + 'string' = 'Eleven' +)) + +json_serialize(#mymap) // {"numeric": 11,"string": "Eleven","success": true} +'
' + +// Javascript arrays are represented by arrays +local(opendays = array( + 'Monday', + 'Tuesday' +)) + +local(closeddays = array( + 'Wednesday', + 'Thursday', + 'Friday' +)) + +json_serialize(#opendays) // ["Monday", "Tuesday"] +'
' +json_serialize(#closeddays) // ["Wednesday", "Thursday", "Friday"] +'
' + +#mymap -> insert('Open' = #opendays) +#mymap -> insert('Closed' = #closeddays) + +local(myjson = json_serialize(#mymap)) +#myjson // {"Closed": ["Wednesday", "Thursday", "Friday"],"numeric": 11,"Open": ["Monday", "Tuesday"],"string": "Eleven","success": true} +'
' + +json_deserialize(#myjson) // map(Closed = array(Wednesday, Thursday, Friday), numeric = 11, Open = array(Monday, Tuesday), string = Eleven, success = true) diff --git a/Task/JSON/Lingo/json-1.lingo b/Task/JSON/Lingo/json-1.lingo new file mode 100644 index 0000000000..d2724ee3c9 --- /dev/null +++ b/Task/JSON/Lingo/json-1.lingo @@ -0,0 +1,45 @@ +//-------------------------------------- +// Simple (unsafe) JSON decoder based on eval() +// @param {string} json +// @return {any} +//-------------------------------------- +function json_decode (json){ + var o; + eval('o='+json); + return _json_decode_val(o); +} + +function _json_decode_val (o){ + if (o==null) return undefined; + switch(typeof(o)){ + case "object": + if (o instanceof Array){ + var v = list(); + var cnt = o.length; + for (i=0;i, "Hello": "world!"], ] +put data_decoded +-- [42, 3.1416, [2, 4, #fooBar, "apples", "bananas", "cherries"], ["foo": 1, #bar: , "Hello": "world!"], ] diff --git a/Task/JSON/Nim/json.nim b/Task/JSON/Nim/json.nim new file mode 100644 index 0000000000..5748cffe28 --- /dev/null +++ b/Task/JSON/Nim/json.nim @@ -0,0 +1,8 @@ +import json + +var data = parseJson("""{ "foo": 1, "bar": [10, "apples"] }""") +echo data["foo"] +echo data["bar"] + +var js = %[%{"name": %"John", "age": %30}, %{"name": %"Susan", "age": %31}] +echo js diff --git a/Task/JSON/Oforth/json.oforth b/Task/JSON/Oforth/json.oforth new file mode 100644 index 0000000000..3e477c3a0d --- /dev/null +++ b/Task/JSON/Oforth/json.oforth @@ -0,0 +1,10 @@ +>{"parents":["Otmar Gutmann", "Silvio Mazzola"], "name":"Pingu", "born":1986} .s +[1] (Json) {"parents" : ["Otmar Gutmann", "Silvio Mazzola"], "name" : "Pingu", "born" : 1986 } +ok +>asString .s +[1] (String) {"parents" : ["Otmar Gutmann", "Silvio Mazzola"], "name" : "Pingu", "born" :1986 } +ok +>perform .s +[1] (Json) {"parents" : ["Otmar Gutmann", "Silvio Mazzola"], "name" : "Pingu", "born" : 1986 } +ok +> diff --git a/Task/JSON/Sidef/json.sidef b/Task/JSON/Sidef/json.sidef new file mode 100644 index 0000000000..a0474dcdbc --- /dev/null +++ b/Task/JSON/Sidef/json.sidef @@ -0,0 +1,5 @@ +var json = require('JSON').new; +var data = json.decode('{"blue": [1, 2], "ocean": "water"}'); +say data; +data{:ocean} = Hash.new(water => %w[fishy salty]); +say json.encode(data); diff --git a/Task/JSON/Swift/json.swift b/Task/JSON/Swift/json.swift new file mode 100644 index 0000000000..0691b8933c --- /dev/null +++ b/Task/JSON/Swift/json.swift @@ -0,0 +1,19 @@ +import Foundation + +let jsonString = "{ \"foo\": 1, \"bar\": [10, \"apples\"] }" +if let jsonData = jsonString.dataUsingEncoding(NSUTF8StringEncoding) { + if let jsonObject : AnyObject = NSJSONSerialization.JSONObjectWithData(jsonData, options: .AllowFragments, error: nil) { + println("NSDictionary: \(jsonObject)") + } +} + +let obj = [ + "foo": [1, "Orange"], + "bar": 1 +] + +if let objData = NSJSONSerialization.dataWithJSONObject(obj, options: .PrettyPrinted, error: nil) { + if let jsonString2 = NSString(data: objData, encoding: NSUTF8StringEncoding) { + println("JSON: \(jsonString2)") + } +} diff --git a/Task/JSON/jq/json-1.jq b/Task/JSON/jq/json-1.jq new file mode 100644 index 0000000000..52e0402fe1 --- /dev/null +++ b/Task/JSON/jq/json-1.jq @@ -0,0 +1 @@ + . diff --git a/Task/JSON/jq/json-2.jq b/Task/JSON/jq/json-2.jq new file mode 100644 index 0000000000..dbdce36a88 --- /dev/null +++ b/Task/JSON/jq/json-2.jq @@ -0,0 +1 @@ +jq -c . data.json diff --git a/Task/JSON/jq/json-3.jq b/Task/JSON/jq/json-3.jq new file mode 100644 index 0000000000..f31dee2fd3 --- /dev/null +++ b/Task/JSON/jq/json-3.jq @@ -0,0 +1 @@ +jq tostring data.json diff --git a/Task/Jensens-Device/Nim/jensens-device.nim b/Task/Jensens-Device/Nim/jensens-device.nim new file mode 100644 index 0000000000..55212854f1 --- /dev/null +++ b/Task/Jensens-Device/Nim/jensens-device.nim @@ -0,0 +1,9 @@ +var i: int + +proc harmonicSum(i: var int, lo, hi, term): float = + i = lo + while i <= hi: + result += term() + inc i + +echo harmonicSum(i, 1, 100, proc: float = 1.0 / float(i)) diff --git a/Task/Jensens-Device/Oforth/jensens-device.oforth b/Task/Jensens-Device/Oforth/jensens-device.oforth new file mode 100644 index 0000000000..1d35f26b50 --- /dev/null +++ b/Task/Jensens-Device/Oforth/jensens-device.oforth @@ -0,0 +1 @@ +: mysum(lo, hi, term) | i | 0 lo hi for: i [ i term perform + ] ; diff --git a/Task/Jensens-Device/Sidef/jensens-device.sidef b/Task/Jensens-Device/Sidef/jensens-device.sidef new file mode 100644 index 0000000000..1a35f982df --- /dev/null +++ b/Task/Jensens-Device/Sidef/jensens-device.sidef @@ -0,0 +1,9 @@ +var i; +func sum (i, lo, hi, term) { + var temp = 0; + for (*i = lo; *i <= hi; (*i)++) { + temp += term.run; + }; + return temp; +}; +say sum(\i, 1, 100, { 1 / i }); diff --git a/Task/Jensens-Device/Swift/jensens-device.swift b/Task/Jensens-Device/Swift/jensens-device.swift new file mode 100644 index 0000000000..249a29b8f2 --- /dev/null +++ b/Task/Jensens-Device/Swift/jensens-device.swift @@ -0,0 +1,11 @@ +var i = 42 // initial value doesn't matter + +func sum(inout i: Int, lo: Int, hi: Int, @autoclosure term: () -> Double) -> Double { + var result = 0.0 + for i = lo; i <= hi; i++ { + result += term() + } + return result +} + +println(sum(&i, 1, 100, 1 / Double(i))) diff --git a/Task/Jensens-Device/jq/jensens-device.jq b/Task/Jensens-Device/jq/jensens-device.jq new file mode 100644 index 0000000000..af6e3644fc --- /dev/null +++ b/Task/Jensens-Device/jq/jensens-device.jq @@ -0,0 +1,5 @@ +def sum(lo; hi; term): + reduce range(lo; hi+1) as $i (0; . + ($i|term)); + +# The task: +sum(1;100;1/.) diff --git a/Task/Josephus-problem/ERRE/josephus-problem.erre b/Task/Josephus-problem/ERRE/josephus-problem.erre new file mode 100644 index 0000000000..775f67bca0 --- /dev/null +++ b/Task/Josephus-problem/ERRE/josephus-problem.erre @@ -0,0 +1,53 @@ +PROGRAM JOSEPHUS + +! +! for rosettacode.org +! + +!$INTEGER + +DIM DEAD[100] + +PROCEDURE MAIN(N,K,S->ERRORS) +! n - number of prisoners +! k - kill every k'th prisoner +! s - number of survivors + LOCAL KILLED$,SURVIVED$,FOUND,P,NN,I + ERRORS=0 + FOR I=0 TO 100 DO + DEAD[I]=0 + END FOR ! prepare array + PRINT("N=";N,"K=";K,"S=";S) ! show arguments + IF S>N THEN PRINT("S>N";) ERRORS+=1 END IF + IF K<=0 THEN PRINT("K<=0";) ERRORS+=1 END IF + IF ERRORS>0 THEN EXIT PROCEDURE END IF + NN=N ! wrap around boundary + P=-1 ! start here + WHILE N<>S DO ! until survivor count is met + FOUND=0 ! start looking + WHILE FOUND<>K DO ! until we have the k-th prisoner + P+=1 + IF P=NN THEN P=0 END IF ! wrap around + IF DEAD[P]<>1 THEN + FOUND+=1 + END IF ! if prisoner is alive increment found + END WHILE + DEAD[P]=1 ! kill the unlucky one + KILLED$=KILLED$+STR$(P) ! build killed list + N-=1 ! reduce size of circle + END WHILE + FOR I=0 TO NN-1 DO + IF DEAD[I]<>1 THEN + SURVIVED$=SURVIVED$+STR$(I) ! build survivor list + END IF + END FOR + PRINT("Killed:";KILLED$) + PRINT("Survived:";SURVIVED$) +END PROCEDURE + +BEGIN + ERRORS=0 + MAIN(5,2,1->ERRORS) + MAIN(41,3,1->ERRORS) + MAIN(41,3,3->ERRORS) +END PROGRAM diff --git a/Task/Josephus-problem/EchoLisp/josephus-problem-1.echolisp b/Task/Josephus-problem/EchoLisp/josephus-problem-1.echolisp new file mode 100644 index 0000000000..05da0be46a --- /dev/null +++ b/Task/Josephus-problem/EchoLisp/josephus-problem-1.echolisp @@ -0,0 +1,13 @@ +;; input +(define N 41) +(define K 3) +(define prisoners (apply circular-list (iota N))) +(define last-one prisoners) ; current position + +;; kill returns current position = last killed +(define (kill lst skip) +(cond + ((eq? (mark? lst) '🔫 )(kill (cdr lst) skip)) ;; dead ? goto next + ((zero? skip) (mark lst '🔫)) ;; all skipped ? kill + (else (mark lst '😥 ) ;; relieved face + (kill (cdr lst ) (1- skip))))) ;; skip 1 and goto next diff --git a/Task/Josephus-problem/EchoLisp/josephus-problem-2.echolisp b/Task/Josephus-problem/EchoLisp/josephus-problem-2.echolisp new file mode 100644 index 0000000000..426e552485 --- /dev/null +++ b/Task/Josephus-problem/EchoLisp/josephus-problem-2.echolisp @@ -0,0 +1,22 @@ +;; kill N-1 + (for ((i (1- N) )) (set! last-one (kill last-one (1- K)))) +;; look at prisoners +prisoners +→ ( 🔄 🔫 0 🔫 1 🔫 2 🔫 3 🔫 4 🔫 5 🔫 6 🔫 7 🔫 8 🔫 9 🔫 10 🔫 11 🔫 12 🔫 13 🔫 14 🔫 15 🔫 16 + 🔫 17 🔫 18 🔫 19 🔫 20 🔫 21 🔫 22 🔫 23 🔫 24 🔫 25 🔫 26 🔫 27 🔫 28 🔫 29 😥 30 🔫 31 🔫 32 + 🔫 33 🔫 34 🔫 35 🔫 36 🔫 37 🔫 38 🔫 39 🔫 40 🔫 0 🔫 1 … ∞) + +;; #30 seems happy +;; kill last +(set! last-one (kill last-one (1- K))) +last-one + → ( 🔫 30 🔫 31 🔫 32 …🔃 ) ;; #30 was the last + +;; extra : we want more survivors +(define SURVIVORS 3) +(for ((i (- N SURVIVORS) )) (set! last-one (kill last-one (1- K)))) + +prisoners +→ ( 🔄 🔫 0 🔫 1 🔫 2 🔫 3 🔫 4 🔫 5 🔫 6 🔫 7 🔫 8 🔫 9 🔫 10 🔫 11 🔫 12 🔫 13 🔫 14 😥 15 🔫 16 + 🔫 17 🔫 18 🔫 19 🔫 20 🔫 21 🔫 22 🔫 23 🔫 24 🔫 25 🔫 26 🔫 27 🔫 28 🔫 29 😥 30 🔫 31 🔫 32 + 🔫 33 😥 34 🔫 35 🔫 36 🔫 37 🔫 38 🔫 39 🔫 40 🔫 0 🔫 1 🔫 0 … ∞) diff --git a/Task/Josephus-problem/Nim/josephus-problem.nim b/Task/Josephus-problem/Nim/josephus-problem.nim new file mode 100644 index 0000000000..311e6d6aed --- /dev/null +++ b/Task/Josephus-problem/Nim/josephus-problem.nim @@ -0,0 +1,20 @@ +import sequtils, strutils, future + +proc j(n, k): string = + var + p = toSeq(0 .. < n) + i = 0 + s = newSeq[int]() + + while p.len > 0: + i = (i + k - 1) mod p.len + s.add p[i] + system.delete(p, i) + + result = "Prisoner killing order: " + result.add s.map((x: int) => $x).join(", ") + result.add ".\nSurvivor: " + result.add($s[s.high]) + +echo j(5,2) +echo j(41,3) diff --git a/Task/Josephus-problem/Oforth/josephus-problem.oforth b/Task/Josephus-problem/Oforth/josephus-problem.oforth new file mode 100644 index 0000000000..418b773c79 --- /dev/null +++ b/Task/Josephus-problem/Oforth/josephus-problem.oforth @@ -0,0 +1,12 @@ +: josephus(n, k) +| prisoners killed i | + n seq asListBuffer ->prisoners + ListBuffer newSize(n) ->killed + + 0 n 1- loop: i [ + k 1- + prisoners size mod dup 1+ prisoners removeAt + killed add + ] drop + + System.Out "Killed : " << killed << "\nSurvivor : " << prisoners << cr +; diff --git a/Task/Josephus-problem/Sidef/josephus-problem-1.sidef b/Task/Josephus-problem/Sidef/josephus-problem-1.sidef new file mode 100644 index 0000000000..71faf839d2 --- /dev/null +++ b/Task/Josephus-problem/Sidef/josephus-problem-1.sidef @@ -0,0 +1,7 @@ +func josephus(n, k) { + var prisoners = @^n + while (prisoners.len > 1) { + prisoners.rotate!(k - 1).shift + } + return prisoners[0] +} diff --git a/Task/Josephus-problem/Sidef/josephus-problem-2.sidef b/Task/Josephus-problem/Sidef/josephus-problem-2.sidef new file mode 100644 index 0000000000..cd788f762a --- /dev/null +++ b/Task/Josephus-problem/Sidef/josephus-problem-2.sidef @@ -0,0 +1,3 @@ +func josephus(n, k) { + n == 1 ? 0 : ((__FUNC__(n-1, k) + k) % n) +}; diff --git a/Task/Josephus-problem/Sidef/josephus-problem-3.sidef b/Task/Josephus-problem/Sidef/josephus-problem-3.sidef new file mode 100644 index 0000000000..40fb69ab12 --- /dev/null +++ b/Task/Josephus-problem/Sidef/josephus-problem-3.sidef @@ -0,0 +1,2 @@ +var survivor = josephus(41, 3); +say "Prisoner #{survivor} survived."; diff --git a/Task/Josephus-problem/Swift/josephus-problem.swift b/Task/Josephus-problem/Swift/josephus-problem.swift new file mode 100644 index 0000000000..71e4064e57 --- /dev/null +++ b/Task/Josephus-problem/Swift/josephus-problem.swift @@ -0,0 +1,45 @@ +class Josephus { + + class func lineUp(#numberOfPeople:Int) -> [Int] { + var people = [Int]() + for (var i = 0; i < numberOfPeople; i++) { + people.append(i) + } + return people + } + + class func execute(#numberOfPeople:Int, spacing:Int) -> Int { + var killIndex = 0 + var people = self.lineUp(numberOfPeople: numberOfPeople) + + println("Prisoners executed in order:") + while (people.count > 1) { + killIndex = (killIndex + spacing - 1) % people.count + executeAndRemove(&people, killIndex: killIndex) + } + println() + return people[0] + } + + class func executeAndRemove(inout people:[Int], killIndex:Int) { + print("\(people[killIndex]) ") + people.removeAtIndex(killIndex) + } + + class func execucteAllButM(#numberOfPeople:Int, spacing:Int, save:Int) -> [Int] { + var killIndex = 0 + var people = self.lineUp(numberOfPeople: numberOfPeople) + + println("Prisoners executed in order:") + while (people.count > save) { + killIndex = (killIndex + spacing - 1) % people.count + executeAndRemove(&people, killIndex: killIndex) + } + println() + return people + } +} + +println("Josephus is number: \(Josephus.execute(numberOfPeople: 41, spacing: 3))") +println() +println("Survivors: \(Josephus.execucteAllButM(numberOfPeople: 41, spacing: 3, save: 3))") diff --git a/Task/Josephus-problem/jq/josephus-problem-1.jq b/Task/Josephus-problem/jq/josephus-problem-1.jq new file mode 100644 index 0000000000..47b4847c35 --- /dev/null +++ b/Task/Josephus-problem/jq/josephus-problem-1.jq @@ -0,0 +1,12 @@ +# A control structure, for convenience: +# as soon as "condition" is true, then emit . and stop: +def do_until(condition; next): + def u: if condition then . else (next|u) end; + u; + +# n is the initial number; every k-th prisoner is removed until m remain. +# Solution by simulation +def josephus(n;k;m): + reduce range(0;n) as $i ([]; . + [$i]) # Number the prisoners from 0 to (n-1) + | do_until( length < k or length <= m; .[k:] + .[0:k-1] ) + | do_until( length <= m; (k % length) as $i | .[$i:] + .[0:$i-1] ); diff --git a/Task/Josephus-problem/jq/josephus-problem-2.jq b/Task/Josephus-problem/jq/josephus-problem-2.jq new file mode 100644 index 0000000000..cedcbcb394 --- /dev/null +++ b/Task/Josephus-problem/jq/josephus-problem-2.jq @@ -0,0 +1,5 @@ +def task(n;k;m): + "Survivors for n=\(n), k=\(k), m=\(m): \( josephus(n;k;m) )"; + +task(41;3;1), +task(23482; 3343; 3) diff --git a/Task/Jump-anywhere/Computer-zero-Assembly/jump-anywhere.computer b/Task/Jump-anywhere/Computer-zero-Assembly/jump-anywhere.computer new file mode 100644 index 0000000000..9205c37dcb --- /dev/null +++ b/Task/Jump-anywhere/Computer-zero-Assembly/jump-anywhere.computer @@ -0,0 +1,5 @@ + LDA goto + SUB somewhere + ADD somewhereElse + STA goto +goto: JMP somewhere diff --git a/Task/Jump-anywhere/ERRE/jump-anywhere.erre b/Task/Jump-anywhere/ERRE/jump-anywhere.erre new file mode 100644 index 0000000000..81a3a8d864 --- /dev/null +++ b/Task/Jump-anywhere/ERRE/jump-anywhere.erre @@ -0,0 +1,19 @@ +PROGRAM GOTO_ERR + +LABEL 99,100 + +PROCEDURE P1 + INPUT(I) + IF I=0 THEN GOTO 99 END IF +END PROCEDURE + +PROCEDURE P2 +99: PRINT("I'm in procdedure P2") +END PROCEDURE + +BEGIN +100: + INPUT(J) + IF J=1 THEN GOTO 99 END IF + IF J<>0 THEN GOTO 100 END IF +END PROGRAM diff --git a/Task/Jump-anywhere/FreeBASIC/jump-anywhere.freebasic b/Task/Jump-anywhere/FreeBASIC/jump-anywhere.freebasic new file mode 100644 index 0000000000..30e2a44b09 --- /dev/null +++ b/Task/Jump-anywhere/FreeBASIC/jump-anywhere.freebasic @@ -0,0 +1,50 @@ +' FB 1.05.0 Win64 + +' compiled with -lang fb (the default) and -e switches + +Sub MySub() + Goto localLabel + Dim a As Integer = 10 '' compiler warning that this variable definition is being skipped + localLabel: + Print "localLabel reached" + Print "a = "; a '' prints garbage as 'a' is uninitialized +End Sub + +Sub MySub2() + On Error Goto handler + Open "zzz.zz" For Input As #1 '' this file doesn't exist! + On Error Goto 0 '' turns off error handling + End + + handler: + Dim e As Integer = Err '' cache error number before printing message + Print "Error number"; e; " occurred - file not found" +End Sub + +Sub MySub3() + Dim b As Integer = 2 + On b Goto label1, label2 '' jumps to label2 + + label1: + Print "Label1 reached" + Return '' premature return from Sub + + label2: + Print "Label2 reached" +End Sub + +Sub MySub4() + Dim c As Integer = 3 + If c = 3 Goto localLabel2 '' better to use If ... Then Goto ... in new code + Print "This won't be seen" + localLabel2: + Print "localLabel2 reached" +End Sub + +MySub +MySub2 +MySub3 +MySub4 +Print +Print "Pres any key to quit" +Print diff --git a/Task/Jump-anywhere/FutureBasic/jump-anywhere.futurebasic b/Task/Jump-anywhere/FutureBasic/jump-anywhere.futurebasic new file mode 100644 index 0000000000..72760bd47b --- /dev/null +++ b/Task/Jump-anywhere/FutureBasic/jump-anywhere.futurebasic @@ -0,0 +1,20 @@ +include "ConsoleWindow" + +print "First line." +gosub "sub1" +print "Fifth line." +goto "Almost over" +"sub1" +print "Second line." +gosub "sub2" +print "Fourth line." +return +"Almost over" +print "We're just about done..." +goto "Outa here" +"sub2" +print "Third line." +return +"Outa here" +print "... with goto and gosub, thankfully." +end diff --git a/Task/Jump-anywhere/Lingo/jump-anywhere-1.lingo b/Task/Jump-anywhere/Lingo/jump-anywhere-1.lingo new file mode 100644 index 0000000000..4b96c7b6df --- /dev/null +++ b/Task/Jump-anywhere/Lingo/jump-anywhere-1.lingo @@ -0,0 +1,8 @@ +on foo + abort() +end + +on bar () + foo() + put "This will never be printed" +end diff --git a/Task/Jump-anywhere/Lingo/jump-anywhere-2.lingo b/Task/Jump-anywhere/Lingo/jump-anywhere-2.lingo new file mode 100644 index 0000000000..d4702974b3 --- /dev/null +++ b/Task/Jump-anywhere/Lingo/jump-anywhere-2.lingo @@ -0,0 +1,12 @@ +on testPlayDone () + + -- Start some asynchronous process (like e.g. a HTTP request). + -- The result might be saved in some global variable, e.g. in _global.result + startAsyncProcess() + + -- pauses execution of current function + play(_movie.frame) + + -- The following will be executed only after 'play done' was called in the asynchronous process code + put "Done. The asynchronous process returned the result:" && _global.result +end diff --git a/Task/Jump-anywhere/Nim/jump-anywhere.nim b/Task/Jump-anywhere/Nim/jump-anywhere.nim new file mode 100644 index 0000000000..93ddc7ef19 --- /dev/null +++ b/Task/Jump-anywhere/Nim/jump-anywhere.nim @@ -0,0 +1,5 @@ +block outer: + for i in 0..1000: + for j in 0..1000: + if i + j == 3: + break outer diff --git a/Task/Jump-anywhere/Phix/jump-anywhere-1.phix b/Task/Jump-anywhere/Phix/jump-anywhere-1.phix new file mode 100644 index 0000000000..5d0f7699fd --- /dev/null +++ b/Task/Jump-anywhere/Phix/jump-anywhere-1.phix @@ -0,0 +1,3 @@ +#ilASM{ jmp :%somelabel } + ... +#ilASM{ :%somelabel } diff --git a/Task/Jump-anywhere/Phix/jump-anywhere-2.phix b/Task/Jump-anywhere/Phix/jump-anywhere-2.phix new file mode 100644 index 0000000000..126cb6c576 --- /dev/null +++ b/Task/Jump-anywhere/Phix/jump-anywhere-2.phix @@ -0,0 +1,3 @@ +#ilASM{ jmp :local + ... + ::local } diff --git a/Task/Jump-anywhere/Phix/jump-anywhere-3.phix b/Task/Jump-anywhere/Phix/jump-anywhere-3.phix new file mode 100644 index 0000000000..7f152434a3 --- /dev/null +++ b/Task/Jump-anywhere/Phix/jump-anywhere-3.phix @@ -0,0 +1,5 @@ +#ilASM{ jmp @f + ... + @@: + ... + jle @b } diff --git a/Task/Jump-anywhere/Phix/jump-anywhere-4.phix b/Task/Jump-anywhere/Phix/jump-anywhere-4.phix new file mode 100644 index 0000000000..f3f09d8a2e --- /dev/null +++ b/Task/Jump-anywhere/Phix/jump-anywhere-4.phix @@ -0,0 +1,14 @@ +#ilASM{ call :!optlbl + [32] + pop eax + [64] + pop rax + [] + ... + :!optlbl + [32] + push dword[esp] + [64] + push qword[rsp] + [] + ret } diff --git a/Task/Jump-anywhere/Phix/jump-anywhere-5.phix b/Task/Jump-anywhere/Phix/jump-anywhere-5.phix new file mode 100644 index 0000000000..fef73cbca3 --- /dev/null +++ b/Task/Jump-anywhere/Phix/jump-anywhere-5.phix @@ -0,0 +1 @@ +#ilASM{ :>init } diff --git a/Task/Jump-anywhere/SSEM/jump-anywhere-1.ssem b/Task/Jump-anywhere/SSEM/jump-anywhere-1.ssem new file mode 100644 index 0000000000..427be9a362 --- /dev/null +++ b/Task/Jump-anywhere/SSEM/jump-anywhere-1.ssem @@ -0,0 +1,2 @@ +10000000000000000000000000000000 0. 1 to CI +11001000000000000000000000000000 1. 19 diff --git a/Task/Jump-anywhere/SSEM/jump-anywhere-2.ssem b/Task/Jump-anywhere/SSEM/jump-anywhere-2.ssem new file mode 100644 index 0000000000..ca8f0e827c --- /dev/null +++ b/Task/Jump-anywhere/SSEM/jump-anywhere-2.ssem @@ -0,0 +1,2 @@ +10000000000001000000000000000000 0. Add 1 to CI +00100000000000000000000000000000 1. 4 diff --git a/Task/Jump-anywhere/jq/jump-anywhere-1.jq b/Task/Jump-anywhere/jq/jump-anywhere-1.jq new file mode 100644 index 0000000000..05c37e3e9b --- /dev/null +++ b/Task/Jump-anywhere/jq/jump-anywhere-1.jq @@ -0,0 +1 @@ +label $out | ... break $out ... diff --git a/Task/Jump-anywhere/jq/jump-anywhere-2.jq b/Task/Jump-anywhere/jq/jump-anywhere-2.jq new file mode 100644 index 0000000000..6229e6b668 --- /dev/null +++ b/Task/Jump-anywhere/jq/jump-anywhere-2.jq @@ -0,0 +1 @@ +label $out | 1e7 | while(true; .+1) | if (1/.) | . == sin then (., break $out) else empty end diff --git a/Task/Jump-anywhere/jq/jump-anywhere-3.jq b/Task/Jump-anywhere/jq/jump-anywhere-3.jq new file mode 100644 index 0000000000..f0d041b447 --- /dev/null +++ b/Task/Jump-anywhere/jq/jump-anywhere-3.jq @@ -0,0 +1 @@ +1e7 | until(1/. | . == sin; .+1) diff --git a/Task/K-d-tree/Sidef/k-d-tree.sidef b/Task/K-d-tree/Sidef/k-d-tree.sidef new file mode 100644 index 0000000000..83592f6045 --- /dev/null +++ b/Task/K-d-tree/Sidef/k-d-tree.sidef @@ -0,0 +1,126 @@ +struct Kd_node { + d, + split, + left, + right, +} + +struct Orthotope { + min, + max, +} + +class Kd_tree(n, bounds) { + + method init { + n = self.nk2(0, n); + } + + method nk2(split, e) { + return(nil) if (e.len <= 0); + var exset = e.sort_by { _[split] } + var m = (exset.len // 2); + var d = exset[m]; + while ((m+1 < exset.len) && (exset[m+1][split] == d[split])) { + ++m; + } + + var s2 = ((split + 1) % d.len); # cycle coordinates + Kd_node(d: d, split :split, + left: self.nk2(s2, exset.first(m)), + right: self.nk2(s2, exset.last(m-1))); + } +} + +struct T3 { + nearest, + dist_sqd = Inf, + nodes_visited = 0, +} + +func find_nearest(k, t, p) { + func nn(kd, target, hr, max_dist_sqd) { + kd || return T3(nearest: [0]*k); + + var nodes_visited = 1; + var s = kd.split; + var pivot = kd.d; + var left_hr = Orthotope(hr.min, hr.max); + var right_hr = Orthotope(hr.min, hr.max); + left_hr.max[s] = pivot[s]; + right_hr.min[s] = pivot[s]; + + var nearer_kd; + var further_kd; + var nearer_hr; + var further_hr; + if (target[s] <= pivot[s]) { + (nearer_kd, nearer_hr) = (kd.left, left_hr); + (further_kd, further_hr) = (kd.right, right_hr); + } + else { + (nearer_kd, nearer_hr) = (kd.right, right_hr); + (further_kd, further_hr) = (kd.left, left_hr); + } + + var n1 = nn(nearer_kd, target, nearer_hr, max_dist_sqd); + var nearest = n1.nearest; + var dist_sqd = n1.dist_sqd; + nodes_visited += n1.nodes_visited; + + if (dist_sqd < max_dist_sqd) { + max_dist_sqd = dist_sqd; + } + var d = (pivot[s] - target[s] -> sqr); + if (d > max_dist_sqd) { + return T3(nearest: nearest, dist_sqd: dist_sqd, nodes_visited: nodes_visited); + } + d = (pivot ~Z- target »sqr»() «+»); + if (d < dist_sqd) { + nearest = pivot; + dist_sqd = d; + max_dist_sqd = dist_sqd; + } + + var n2 = nn(further_kd, target, further_hr, max_dist_sqd); + nodes_visited += n2.nodes_visited; + if (n2.dist_sqd < dist_sqd) { + nearest = n2.nearest; + dist_sqd = n2.dist_sqd; + } + + T3(nearest: nearest, dist_sqd: dist_sqd, nodes_visited: nodes_visited); + } + + return nn(t.n, p, t.bounds, Inf); +} + +func show_nearest(k, heading, kd, p) { + print <<"-END" + #{heading}: + Point: [#{p.join(',')}] + END + var n = find_nearest(k, kd, p); + print <<"-END" + Nearest neighbor: [#{n.nearest.join(',')}] + Distance: #{sqrt(n.dist_sqd)} + Nodes visited: #{n.nodes_visited()} + + END +} + +func random_point(k) { k.of { 1.rand } } +func random_points(k, n) { n.of { random_point(k) } } + +var kd1 = Kd_tree([[2, 3],[5, 4],[9, 6],[4, 7],[8, 1],[7, 2]], + Orthotope(min: [0, 0], max: [10, 10])); +show_nearest(2, "Wikipedia example data", kd1, [9, 2]); + +var N = 1000 +var t0 = Time.micro +var kd2 = Kd_tree(random_points(3, N), Orthotope(min: [0,0,0], max: [1,1,1])) + +var t1 = Time.micro +show_nearest(2, + "k-d tree with #{N} random 3D points (generation time: #{t1 - t0}s)", + kd2, random_point(3)) diff --git a/Task/Kaprekar-numbers/FreeBASIC/kaprekar-numbers.freebasic b/Task/Kaprekar-numbers/FreeBASIC/kaprekar-numbers.freebasic new file mode 100644 index 0000000000..d2aaec279c --- /dev/null +++ b/Task/Kaprekar-numbers/FreeBASIC/kaprekar-numbers.freebasic @@ -0,0 +1,65 @@ +' version 04-12-2016 +' compile with: fbc -s console + +' define true and false for older versions +#Ifndef TRUE +#Define FALSE 0 +#Define TRUE Not FALSE +#EndIf + +#Define max 1000000 ' maximum for number to be tested + +Function kaprekar(n As ULong) As ULong + + If n = 1 Then Return TRUE + + Dim As ULong x, p1, p2 + Dim As ULongInt sq = CLngInt(n) * n + Dim As String sq_str = Str(sq) + Dim As ULong l = Len(sq_str) + + ' decrease the lenght l for every "0" + ' at the end of the string + For x = l -1 To 1 Step -1 + If sq_str[x] = Asc("0") Then + l = l -1 + Else + Exit For + End If + Next + + For x = 1 To l -1 + p2 = Val(Mid(sq_str, x +1)) + If p2 > n Then + Continue For + End If + p1 = Val(Left(sq_str, x)) + If p1 > n Then Return FALSE ' p1 > n leave + If (p1 + p2) = n Then Return TRUE + Next + +End Function + +' ------=< MAIN >=------ + +Dim As ULong n, count + +Print "Kaprekar numbers below 10000" + +For n = 1 To max -1 + If kaprekar(n) = TRUE Then + count = count + 1 + If n < 10000 Then + Print count, n + End If + End If +Next + +Print +Print count;" numbers below "; Str(max);" are Kaprekar numbers" + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Kaprekar-numbers/Nim/kaprekar-numbers.nim b/Task/Kaprekar-numbers/Nim/kaprekar-numbers.nim new file mode 100644 index 0000000000..5911d1c1af --- /dev/null +++ b/Task/Kaprekar-numbers/Nim/kaprekar-numbers.nim @@ -0,0 +1,12 @@ +import strutils, sequtils + +proc k(n): bool = + let n2 = $(n.in64 * n) + for i in 0 .. 0: parseBiggestInt n2[0 .. 0 and a + b == n: + return true + +echo toSeq(1..10_000).filter(k) +echo len toSeq(1..1_000_000).filter(k) diff --git a/Task/Kaprekar-numbers/Ring/kaprekar-numbers.ring b/Task/Kaprekar-numbers/Ring/kaprekar-numbers.ring new file mode 100644 index 0000000000..f4eb62efef --- /dev/null +++ b/Task/Kaprekar-numbers/Ring/kaprekar-numbers.ring @@ -0,0 +1,18 @@ +nr = 0 +for i = 1 to 200 + if kaprekar(i) + nr += 1 + if i < 201 see "" + nr + " : " + i + nl ok ok +next +see "total kaprekar numbers under 200 = " + nr + nl + +func kaprekar n + s = pow(n,2) + x = floor(log(s)) + 1 + t = pow(10,x) + while true + t /= 10 + if t<=n exit ok + if s-n = floor(s/t)*(t-1) n = true ok + end + return (n = 1) diff --git a/Task/Kaprekar-numbers/Sidef/kaprekar-numbers.sidef b/Task/Kaprekar-numbers/Sidef/kaprekar-numbers.sidef new file mode 100644 index 0000000000..583a7012dd --- /dev/null +++ b/Task/Kaprekar-numbers/Sidef/kaprekar-numbers.sidef @@ -0,0 +1,19 @@ +require('ntheory') +var kap = Hash() + +15.times { |n| + var np = (10**n - 1) + %S.fordivisors({ |d| + var dp = np//d + if (gcd(d, dp) == 1) { + kap{ dp == 1 ? d : d.invmod(dp)*d } := 0 ++ + } + }, np) +} + +var nums = kap.keys.map{.to_n}.sort + +for n in (6 .. 14) { + var np = (10**n - 1) + printf("Kaprekar numbers <= 10^%2d: %5d\n", n, nums.count_by { .<= np }) +} diff --git a/Task/Kaprekar-numbers/Wortel/kaprekar-numbers.wortel b/Task/Kaprekar-numbers/Wortel/kaprekar-numbers.wortel new file mode 100644 index 0000000000..a3b69dc66d --- /dev/null +++ b/Task/Kaprekar-numbers/Wortel/kaprekar-numbers.wortel @@ -0,0 +1,19 @@ +@let { + isKap &n [ + @var s +'' *n n + @for i til +1/#s 2 [ + @vars { + fn @+!!s.slice 0 i + sn @+!s.slice i + } + @if =0 sn @break + @if =n +fn sn @return [fn sn] + ] + false + ] + + ~[ + !console.log "Kaprekar numbers below 10000: {!-isKap @to 1TK}" + !console.log "Number of Kaprekar numbers below 1000000: {#!-isKap @to 1M}" + ] +} diff --git a/Task/Kaprekar-numbers/jq/kaprekar-numbers-1.jq b/Task/Kaprekar-numbers/jq/kaprekar-numbers-1.jq new file mode 100644 index 0000000000..856673f27a --- /dev/null +++ b/Task/Kaprekar-numbers/jq/kaprekar-numbers-1.jq @@ -0,0 +1,32 @@ +# Is the input integer a Kaprekar integer? +def is_kaprekar: + # The helper function acts like a loop: + # input is [n, number, str] + # where n is the position to be considered next, + # number is the integer under consideration, + # and str is the string representing number*number + def _try: + .[0] as $n | .[1] as $number | .[2] as $str + | if $n >= ($str|length) then null + else ($str[0:$n] | tonumber) as $left + | ($str[$n:] | tonumber) as $right + | if $left > $number then null + elif $right == 0 then null + elif ($left + $right) == $number then $n + else [($n + 1), $number, $str] | _try + end + end; + . as $in + | if . == 1 then true + elif . < 1 then false + else null != ([1, $in, ($in*$in|tostring)] | _try) + end ; + +# Useful for counting how many times the condition is satisfied: +def count(generator; condition): + reduce generator as $i (0; if ($i|condition ) then .+1 else . end); + +def task: + [ range(1;10000) | select( is_kaprekar ) ], + count( range(1;1000000); is_kaprekar ) +; diff --git a/Task/Kaprekar-numbers/jq/kaprekar-numbers-2.jq b/Task/Kaprekar-numbers/jq/kaprekar-numbers-2.jq new file mode 100644 index 0000000000..a6885bae03 --- /dev/null +++ b/Task/Kaprekar-numbers/jq/kaprekar-numbers-2.jq @@ -0,0 +1,3 @@ +$ jq -n -c -f is_kaprekar.jq +[1,9,45,55,99,297,703,999,2223,2728,4879,4950,5050,5292,7272,7777,9999] +54 diff --git a/Task/Keyboard-input-Flush-the-keyboard-buffer/Axe/keyboard-input-flush-the-keyboard-buffer.axe b/Task/Keyboard-input-Flush-the-keyboard-buffer/Axe/keyboard-input-flush-the-keyboard-buffer.axe new file mode 100644 index 0000000000..30b383b6a3 --- /dev/null +++ b/Task/Keyboard-input-Flush-the-keyboard-buffer/Axe/keyboard-input-flush-the-keyboard-buffer.axe @@ -0,0 +1,2 @@ +While getKey(0) +End diff --git a/Task/Keyboard-input-Flush-the-keyboard-buffer/ERRE/keyboard-input-flush-the-keyboard-buffer.erre b/Task/Keyboard-input-Flush-the-keyboard-buffer/ERRE/keyboard-input-flush-the-keyboard-buffer.erre new file mode 100644 index 0000000000..83a30d1ac0 --- /dev/null +++ b/Task/Keyboard-input-Flush-the-keyboard-buffer/ERRE/keyboard-input-flush-the-keyboard-buffer.erre @@ -0,0 +1,6 @@ +!$KEY +.......... +REPEAT + GET(K$) +UNTIL K$="" +.......... diff --git a/Task/Keyboard-input-Flush-the-keyboard-buffer/FreeBASIC/keyboard-input-flush-the-keyboard-buffer.freebasic b/Task/Keyboard-input-Flush-the-keyboard-buffer/FreeBASIC/keyboard-input-flush-the-keyboard-buffer.freebasic new file mode 100644 index 0000000000..d34a40f7d0 --- /dev/null +++ b/Task/Keyboard-input-Flush-the-keyboard-buffer/FreeBASIC/keyboard-input-flush-the-keyboard-buffer.freebasic @@ -0,0 +1,6 @@ +' FB 1.05.0 Win64 + +' Get characters from the keyboard buffer until there are none left +While Inkey <> "" : Wend +Print "Keyboard buffer flushed" +Sleep diff --git a/Task/Keyboard-input-Flush-the-keyboard-buffer/Nim/keyboard-input-flush-the-keyboard-buffer.nim b/Task/Keyboard-input-Flush-the-keyboard-buffer/Nim/keyboard-input-flush-the-keyboard-buffer.nim new file mode 100644 index 0000000000..f9c49b22bd --- /dev/null +++ b/Task/Keyboard-input-Flush-the-keyboard-buffer/Nim/keyboard-input-flush-the-keyboard-buffer.nim @@ -0,0 +1,4 @@ +const TCIFLUSH: cint = 0 +proc tcflush(fd, queue_selector: cint): cint {.header: "termios.h".} + +discard tcflush(cint(getFileHandle(stdin)), TCIFLUSH) diff --git a/Task/Keyboard-input-Flush-the-keyboard-buffer/Oforth/keyboard-input-flush-the-keyboard-buffer.oforth b/Task/Keyboard-input-Flush-the-keyboard-buffer/Oforth/keyboard-input-flush-the-keyboard-buffer.oforth new file mode 100644 index 0000000000..8fdcd39b02 --- /dev/null +++ b/Task/Keyboard-input-Flush-the-keyboard-buffer/Oforth/keyboard-input-flush-the-keyboard-buffer.oforth @@ -0,0 +1,3 @@ +import: console + +System.Console flush diff --git a/Task/Keyboard-input-Flush-the-keyboard-buffer/Phix/keyboard-input-flush-the-keyboard-buffer.phix b/Task/Keyboard-input-Flush-the-keyboard-buffer/Phix/keyboard-input-flush-the-keyboard-buffer.phix new file mode 100644 index 0000000000..f50b58ccd1 --- /dev/null +++ b/Task/Keyboard-input-Flush-the-keyboard-buffer/Phix/keyboard-input-flush-the-keyboard-buffer.phix @@ -0,0 +1 @@ +while get_key()!=-1 do end while diff --git a/Task/Keyboard-input-Flush-the-keyboard-buffer/Sidef/keyboard-input-flush-the-keyboard-buffer.sidef b/Task/Keyboard-input-Flush-the-keyboard-buffer/Sidef/keyboard-input-flush-the-keyboard-buffer.sidef new file mode 100644 index 0000000000..c51660da99 --- /dev/null +++ b/Task/Keyboard-input-Flush-the-keyboard-buffer/Sidef/keyboard-input-flush-the-keyboard-buffer.sidef @@ -0,0 +1,17 @@ +var k = frequire('Term::ReadKey'); + +k.ReadMode('restore'); # Flush the keyboard and returns input stream to initial state +# ReadMode 0; # Numerical equivalent of keyboard restore (move comment marker to use instead) + +# A more complete example for use in keyboard handler programming. +# We should also check we are being used in an interactive context (not done here). + +k.ReadMode('cbreak'); + +# Flush the keyboard in terminal character break mode +while (k.ReadKey(-1) != nil) { + # Do nothing +} + +# Don't forget to restore the readmode, when we are finished using the keyboard +k.ReadMode('restore'); diff --git a/Task/Keyboard-input-Keypress-check/Axe/keyboard-input-keypress-check.axe b/Task/Keyboard-input-Keypress-check/Axe/keyboard-input-keypress-check.axe new file mode 100644 index 0000000000..887a597ac6 --- /dev/null +++ b/Task/Keyboard-input-Keypress-check/Axe/keyboard-input-keypress-check.axe @@ -0,0 +1 @@ +getKey→K diff --git a/Task/Keyboard-input-Keypress-check/ERRE/keyboard-input-keypress-check.erre b/Task/Keyboard-input-Keypress-check/ERRE/keyboard-input-keypress-check.erre new file mode 100644 index 0000000000..01f61d9f6c --- /dev/null +++ b/Task/Keyboard-input-Keypress-check/ERRE/keyboard-input-keypress-check.erre @@ -0,0 +1,4 @@ +!$KEY +......... +GET(K$) +......... diff --git a/Task/Keyboard-input-Keypress-check/FreeBASIC/keyboard-input-keypress-check.freebasic b/Task/Keyboard-input-Keypress-check/FreeBASIC/keyboard-input-keypress-check.freebasic new file mode 100644 index 0000000000..a71d4a50cb --- /dev/null +++ b/Task/Keyboard-input-Keypress-check/FreeBASIC/keyboard-input-keypress-check.freebasic @@ -0,0 +1,14 @@ +' FB 1.05.0 Win64 + +Dim k As String +Do + k = Inkey +Loop Until k <> "" + +If Len(k) = 1 Then + Print "The key pressed was "; k; " (ascii "; Asc(k); ")" +Else + Print "An extended key was pressed" +End If + +Sleep diff --git a/Task/Keyboard-input-Keypress-check/Lingo/keyboard-input-keypress-check.lingo b/Task/Keyboard-input-Keypress-check/Lingo/keyboard-input-keypress-check.lingo new file mode 100644 index 0000000000..d0813e9ed3 --- /dev/null +++ b/Task/Keyboard-input-Keypress-check/Lingo/keyboard-input-keypress-check.lingo @@ -0,0 +1,7 @@ +-- in some movie script + +-- event handler +on keyDown + pressedKey = _key.key + put "A key was pressed:" && pressedKey +end diff --git a/Task/Keyboard-input-Keypress-check/LiveCode/keyboard-input-keypress-check-1.livecode b/Task/Keyboard-input-Keypress-check/LiveCode/keyboard-input-keypress-check-1.livecode new file mode 100644 index 0000000000..c71c3c177b --- /dev/null +++ b/Task/Keyboard-input-Keypress-check/LiveCode/keyboard-input-keypress-check-1.livecode @@ -0,0 +1,10 @@ +repeat 100 times +-- exit loop if "." or the escapeKey is pressed + if 46 is in the keysDown or 65307 is in the keysdown then + answer "exiting" + exit repeat + else + -- do stuff + wait 200 millisec + end if +end repeat diff --git a/Task/Keyboard-input-Keypress-check/LiveCode/keyboard-input-keypress-check-2.livecode b/Task/Keyboard-input-Keypress-check/LiveCode/keyboard-input-keypress-check-2.livecode new file mode 100644 index 0000000000..8c89dc9a17 --- /dev/null +++ b/Task/Keyboard-input-Keypress-check/LiveCode/keyboard-input-keypress-check-2.livecode @@ -0,0 +1,4 @@ +on keyDown k +-- do stuff, keycode is held in k +if k is not 46 then pass keyDown // will be trapped if "." is pressed, others will be passed on through the message path +end keyDown diff --git a/Task/Keyboard-input-Keypress-check/Oforth/keyboard-input-keypress-check-1.oforth b/Task/Keyboard-input-Keypress-check/Oforth/keyboard-input-keypress-check-1.oforth new file mode 100644 index 0000000000..19c84e0b06 --- /dev/null +++ b/Task/Keyboard-input-Keypress-check/Oforth/keyboard-input-keypress-check-1.oforth @@ -0,0 +1,7 @@ +import: console + +: checkKey +| key | + System.Console receiveTimeout(2000000) ->key // Wait a key pressed for 2 seconds + key ifNotNull: [ System.Out "Key pressed : " << key << cr ] + "Done" println ; diff --git a/Task/Keyboard-input-Keypress-check/Oforth/keyboard-input-keypress-check-2.oforth b/Task/Keyboard-input-Keypress-check/Oforth/keyboard-input-keypress-check-2.oforth new file mode 100644 index 0000000000..159c2d34e2 --- /dev/null +++ b/Task/Keyboard-input-Keypress-check/Oforth/keyboard-input-keypress-check-2.oforth @@ -0,0 +1,3 @@ +System.Console receive ->key // Wait until a key is pressed ( = receiveTimeout(null) ) +System.Console receiveChar ->aChar // Wait until a character is pressed. All other keys are ignored +System.Console receiveTimeout(0) ->key // Check if a key is pressed and return immediatly diff --git a/Task/Keyboard-input-Keypress-check/Phix/keyboard-input-keypress-check.phix b/Task/Keyboard-input-Keypress-check/Phix/keyboard-input-keypress-check.phix new file mode 100644 index 0000000000..137ebbc6e3 --- /dev/null +++ b/Task/Keyboard-input-Keypress-check/Phix/keyboard-input-keypress-check.phix @@ -0,0 +1 @@ +integer key = get_key() -- if key was not pressed get_key() returns -1 diff --git a/Task/Keyboard-input-Keypress-check/Ring/keyboard-input-keypress-check.ring b/Task/Keyboard-input-Keypress-check/Ring/keyboard-input-keypress-check.ring new file mode 100644 index 0000000000..3c48ee6456 --- /dev/null +++ b/Task/Keyboard-input-Keypress-check/Ring/keyboard-input-keypress-check.ring @@ -0,0 +1,2 @@ +if getchar() see "A key was pressed" + nl +else see "No key was pressed" + nl ok diff --git a/Task/Keyboard-input-Obtain-a-Y-or-N-response/8th/keyboard-input-obtain-a-y-or-n-response.8th b/Task/Keyboard-input-Obtain-a-Y-or-N-response/8th/keyboard-input-obtain-a-y-or-n-response.8th new file mode 100644 index 0000000000..a873b99a1e --- /dev/null +++ b/Task/Keyboard-input-Obtain-a-Y-or-N-response/8th/keyboard-input-obtain-a-y-or-n-response.8th @@ -0,0 +1,10 @@ +\ get a yes or no response from the keyboard +: yes-no + con:key $20 bor + dup 'y n:= if ;; then + dup 'n n:= if ;; then + drop yes-no ; +: no? 'n n:= if "No" else "Yes" then . ; + +"Yes or no? " con:print yes-no no? +cr bye diff --git a/Task/Keyboard-input-Obtain-a-Y-or-N-response/Axe/keyboard-input-obtain-a-y-or-n-response.axe b/Task/Keyboard-input-Obtain-a-Y-or-N-response/Axe/keyboard-input-obtain-a-y-or-n-response.axe new file mode 100644 index 0000000000..3049e2d88e --- /dev/null +++ b/Task/Keyboard-input-Obtain-a-Y-or-N-response/Axe/keyboard-input-obtain-a-y-or-n-response.axe @@ -0,0 +1,12 @@ +While getKey(0) +End + +While 1 +If getKey(15) + Disp "N",i + Return +ElseIf getKey(54) + Disp "Y",i + Return +End +End diff --git a/Task/Keyboard-input-Obtain-a-Y-or-N-response/ERRE/keyboard-input-obtain-a-y-or-n-response.erre b/Task/Keyboard-input-Obtain-a-Y-or-N-response/ERRE/keyboard-input-obtain-a-y-or-n-response.erre new file mode 100644 index 0000000000..709ce832dc --- /dev/null +++ b/Task/Keyboard-input-Obtain-a-Y-or-N-response/ERRE/keyboard-input-obtain-a-y-or-n-response.erre @@ -0,0 +1,22 @@ +!$KEY +................ +! flush the keyboard buffer +! -------------------------------- +! you can use POKE(198,0) in C-64 +! ERRE version +! -------------------------------- +REPEAT + GET(K$) +UNTIL K$="" + +PRINT("Press Y or N to continue") +REPEAT + GET(K$) +UNTIL INSTR("YyNn",K$)<>0 +! +! with C-64 you must write a line like +! UNTIL K$="Y" OR K$="N" +! + +PRINT("The response was ";K$) +................. diff --git a/Task/Keyboard-input-Obtain-a-Y-or-N-response/Elm/keyboard-input-obtain-a-y-or-n-response.elm b/Task/Keyboard-input-Obtain-a-Y-or-N-response/Elm/keyboard-input-obtain-a-y-or-n-response.elm new file mode 100644 index 0000000000..0e17b2e66b --- /dev/null +++ b/Task/Keyboard-input-Obtain-a-Y-or-N-response/Elm/keyboard-input-obtain-a-y-or-n-response.elm @@ -0,0 +1,28 @@ +import Char +import Graphics.Element exposing (Element, empty, show) +import Keyboard + + +view : Int -> Element +view keyCode = + let + char = + Char.fromCode keyCode + + showChar = + toString >> ((++) "The last (y/n) key pressed was: ") >> show + in + case char of + 'n' -> + showChar char + + 'y' -> + showChar char + + _ -> + empty + + +main : Signal Element +main = + Signal.map view Keyboard.presses diff --git a/Task/Keyboard-input-Obtain-a-Y-or-N-response/FreeBASIC/keyboard-input-obtain-a-y-or-n-response.freebasic b/Task/Keyboard-input-Obtain-a-Y-or-N-response/FreeBASIC/keyboard-input-obtain-a-y-or-n-response.freebasic new file mode 100644 index 0000000000..a5cf924140 --- /dev/null +++ b/Task/Keyboard-input-Obtain-a-Y-or-N-response/FreeBASIC/keyboard-input-obtain-a-y-or-n-response.freebasic @@ -0,0 +1,18 @@ +' FB 1.05.0 Win64 + +While InKey <> "" : Wend '' flush keyboard buffer +Print "Do you want to continue y/n : "; +Dim answer As String + +Do + answer = LCase(Inkey) +Loop Until answer = "y" OrElse answer = "n" + +Print answer '' echo response to console +If answer = "y" Then + Print "OK, continuing" +Else + Print "OK, finishing" +End If + +Sleep diff --git a/Task/Keyboard-input-Obtain-a-Y-or-N-response/FutureBasic/keyboard-input-obtain-a-y-or-n-response.futurebasic b/Task/Keyboard-input-Obtain-a-Y-or-N-response/FutureBasic/keyboard-input-obtain-a-y-or-n-response.futurebasic new file mode 100644 index 0000000000..d5e3fb40e1 --- /dev/null +++ b/Task/Keyboard-input-Obtain-a-Y-or-N-response/FutureBasic/keyboard-input-obtain-a-y-or-n-response.futurebasic @@ -0,0 +1,23 @@ +local fn DoDialog +dim as long ev, id + +ev = dialog(0) +id = dialog(ev) + +select case( ev ) + case _wndClose : end + case _evKey + select id + // Trap upper and lower case Y and N + case 78, 110 : cls : print "No " + case 89, 121 : cls : print "Yes" + end select + end select +end fn + +on dialog fn DoDialog + +window 1, @"Yes-No", (0,0)-(150,80), _docNoGrow +text _applFont, 14, _boldBit% + +RunApplicationEventLoop() diff --git a/Task/Keyboard-input-Obtain-a-Y-or-N-response/LiveCode/keyboard-input-obtain-a-y-or-n-response.livecode b/Task/Keyboard-input-Obtain-a-Y-or-N-response/LiveCode/keyboard-input-obtain-a-y-or-n-response.livecode new file mode 100644 index 0000000000..5bcbaea153 --- /dev/null +++ b/Task/Keyboard-input-Obtain-a-Y-or-N-response/LiveCode/keyboard-input-obtain-a-y-or-n-response.livecode @@ -0,0 +1,8 @@ +on KeyDown k + if toUpper(k) is among the items of "Y,N" then + answer "Thanks for your response" + else + answer "You need to enter Y or N" + end if + put empty into me +end KeyDown diff --git a/Task/Keyboard-input-Obtain-a-Y-or-N-response/Oforth/keyboard-input-obtain-a-y-or-n-response.oforth b/Task/Keyboard-input-Obtain-a-Y-or-N-response/Oforth/keyboard-input-obtain-a-y-or-n-response.oforth new file mode 100644 index 0000000000..39f09e9d79 --- /dev/null +++ b/Task/Keyboard-input-Obtain-a-Y-or-N-response/Oforth/keyboard-input-obtain-a-y-or-n-response.oforth @@ -0,0 +1,10 @@ +import: console + +: YorN +| c | + System.Console flush + doWhile: [ + System.Console receiveChar toUpper ->c + c 'Y' <> c 'N' <> and + ] + c ; diff --git a/Task/Keyboard-input-Obtain-a-Y-or-N-response/Phix/keyboard-input-obtain-a-y-or-n-response.phix b/Task/Keyboard-input-Obtain-a-Y-or-N-response/Phix/keyboard-input-obtain-a-y-or-n-response.phix new file mode 100644 index 0000000000..739faf1f1e --- /dev/null +++ b/Task/Keyboard-input-Obtain-a-Y-or-N-response/Phix/keyboard-input-obtain-a-y-or-n-response.phix @@ -0,0 +1,12 @@ +integer key + +while get_key()!=-1 do end while -- flush + +puts(1,"Your answer? (Y/N)") + +while 1 do + key = upper(get_key()) + if find(key,"YN") then exit end if +end while + +printf(1,"\nYour response was %s\n",key) diff --git a/Task/Keyboard-input-Obtain-a-Y-or-N-response/Ring/keyboard-input-obtain-a-y-or-n-response.ring b/Task/Keyboard-input-Obtain-a-Y-or-N-response/Ring/keyboard-input-obtain-a-y-or-n-response.ring new file mode 100644 index 0000000000..c358b1ed9c --- /dev/null +++ b/Task/Keyboard-input-Obtain-a-Y-or-N-response/Ring/keyboard-input-obtain-a-y-or-n-response.ring @@ -0,0 +1,6 @@ +while true + give c + if c = "Y" see "You said yes!" + nl + but c = "N" see "You said no!" + nl + else see "Try again!" + nl ok +end diff --git a/Task/Keyboard-input-Obtain-a-Y-or-N-response/Sidef/keyboard-input-obtain-a-y-or-n-response.sidef b/Task/Keyboard-input-Obtain-a-Y-or-N-response/Sidef/keyboard-input-obtain-a-y-or-n-response.sidef new file mode 100644 index 0000000000..f511818f46 --- /dev/null +++ b/Task/Keyboard-input-Obtain-a-Y-or-N-response/Sidef/keyboard-input-obtain-a-y-or-n-response.sidef @@ -0,0 +1,17 @@ +func prompt_yn { + static rk = frequire('Term::ReadKey'); + rk.ReadMode(4); # change to raw input mode + + var key = ''; + while (key !~ /[yn]/i) { + while (rk.ReadKey(-1) != nil) {}; # discard any previous input + print "Type Y/N: "; + say (key = rk.ReadKey(0)); # read a single character + } + + rk.ReadMode(0); # reset the terminal to normal mode + return key.uc; +} + +var key = prompt_yn(); +say "You typed: #{key}"; diff --git a/Task/Keyboard-macros/EchoLisp/keyboard-macros.echolisp b/Task/Keyboard-macros/EchoLisp/keyboard-macros.echolisp new file mode 100644 index 0000000000..86b3f7d0b6 --- /dev/null +++ b/Task/Keyboard-macros/EchoLisp/keyboard-macros.echolisp @@ -0,0 +1,16 @@ +;; see initial bindings : GREEK DICTIONARY +(meta-keys) → (("0" "❌") ("1" "❗️") ("2" "❓") ("3" "✔️") ("4" "⛔️") ("5" "✅") ("6" "🚩") ("7" "⌚️") +("8" "🏁") ("9" "😜") ("a" "α") ("b" "β") ("g" "γ") ("d" "δ") ("e" "ε") ("z" "ζ") ("h" "η") ("t" "τ") +("i" "ι") ("k" "κ") ("l" "λ") ("m" "μ") ("n" "ν") ("x" "ξ") ("q" "ο") ("p" "π") ("r" "ρ") ("w" "ς") +("s" "σ") ("u" "υ") ("f" "φ") ("c" "χ") ("y" "ψ") ("o" "ω") ("A" "Α") ("B" "Β") ("G" "Γ") ("D" "Δ") +("E" "Ε") ("Z" "Ζ") ("H" "Η") ("T" "Τ") ("I" "Ι") ("K" "Κ") ("L" "Λ") ("M" "Μ") ("N" "Ν") ("X" "Ξ") ("Q" "Ο") ("P" "Π") ("R" "Ρ") ("S" "Σ") ("U" "Υ") ("F" "Φ") ("C" "Χ") ("Y" "Ψ") ("O" "Ω")) + +;; define modifier to use : Control key +(define-modifier-key "ctrl") + +;; type : ctrl-R, ctrl-O, ... + - ΡΩΣΕΤΤΑ + +;; custom bindings +(meta-key "A" "Antoinette") ; string +(meta-key "H" "(begin (writeln 'HELLO) (date 'today))") ; function call diff --git a/Task/Knapsack-problem-0-1/Ceylon/knapsack-problem-0-1-1.ceylon b/Task/Knapsack-problem-0-1/Ceylon/knapsack-problem-0-1-1.ceylon new file mode 100644 index 0000000000..08ac7d3fd4 --- /dev/null +++ b/Task/Knapsack-problem-0-1/Ceylon/knapsack-problem-0-1-1.ceylon @@ -0,0 +1,2 @@ +module knapsack "1.0.0" { +} diff --git a/Task/Knapsack-problem-0-1/Ceylon/knapsack-problem-0-1-2.ceylon b/Task/Knapsack-problem-0-1/Ceylon/knapsack-problem-0-1-2.ceylon new file mode 100644 index 0000000000..d4c8d6249f --- /dev/null +++ b/Task/Knapsack-problem-0-1/Ceylon/knapsack-problem-0-1-2.ceylon @@ -0,0 +1,82 @@ +shared void run() { + value knapsack = pack(items, empty(400)); + + print(knapsack); +} + +class Item(name,weight,theValue) { + String name; + shared Integer weight; + shared Float theValue; + + shared actual String string = "item(``name``, ``weight``, ``theValue``)"; +} + +class Knapsack(items,theValue,weight,available) { + shared Item[] items; + shared Float theValue; + shared Integer weight; + shared Integer available; + + shared Boolean canAccept(Item item) + => item.weight <= available; + + String itemsString = items.fold("")((total, remaining) => "``total``\t\n``remaining.string``" ); + + shared actual String string = "Total value: ``theValue``\nTotal weight: ``weight``\nItems:\n``itemsString``"; +} + +Knapsack empty(Integer capacity) + => Knapsack([], 0.0, 0, capacity); + + +Item[] items = + [ + Item("map", 9, 150.0), + Item("compass", 13, 35.0), + Item("water", 153, 200.0), + Item("sandwich", 50, 160.0), + Item("glucose", 15, 60.0), + Item("tin", 68, 45.0), + Item("banana", 27, 60.0), + Item("apple", 39, 40.0), + Item("cheese", 23, 30.0), + Item("beer", 52, 10.0), + Item("cream", 11, 70.0), + Item("camera", 32, 30.0), + Item("tshirt", 24, 15.0), + Item("trousers", 48, 10.0), + Item("umbrella", 73, 40.0), + Item("trousers", 42, 70.0), + Item("overclothes", 43, 75.0), + Item("notecase", 22, 80.0), + Item("sunglasses", 7, 20.0), + Item("towel", 18, 12.0), + Item("socks", 4, 50.0), + Item("book", 30, 10.0) + ]; + + +Knapsack add(Item item, Knapsack knapsack) + => Knapsack { items = knapsack.items.withTrailing(item); + theValue = knapsack.theValue + item.theValue; + weight = knapsack.weight + item.weight; + available = knapsack.available - item.weight; }; + +Float rating(Item item) => item.theValue / item.weight.float; + +Knapsack pack(Item[] items, Knapsack knapsack) + // Sort the items by decreasing rating, that is, value divided by weight + => let (itemsSorted = + items.group(rating) + .sort(byDecreasing((Float->[Item+] entry) => entry.key)) + .map(Entry.item) + .flatMap((element) => element) + .sequence()) + + packRecursive(itemsSorted,knapsack); + +Knapsack packRecursive(Item[] sortedItems, Knapsack knapsack) + => if (exists firstItem=sortedItems.first, knapsack.canAccept(firstItem)) + then packRecursive(sortedItems.rest, add(firstItem,knapsack)) + else knapsack; diff --git a/Task/Knapsack-problem-0-1/EchoLisp/knapsack-problem-0-1-1.echolisp b/Task/Knapsack-problem-0-1/EchoLisp/knapsack-problem-0-1-1.echolisp new file mode 100644 index 0000000000..068bd50c77 --- /dev/null +++ b/Task/Knapsack-problem-0-1/EchoLisp/knapsack-problem-0-1-1.echolisp @@ -0,0 +1,34 @@ +(require 'struct) +(require 'hash) +(require 'sql) + +(define H (make-hash)) +(define T (make-table (struct goodies (name poids valeur )))) +(define-syntax-rule (name i) (table-xref T i 0)) +(define-syntax-rule (poids i) (table-xref T i 1)) +(define-syntax-rule (valeur i) (table-xref T i 2)) + +;; make an unique hash-key from (i rest) +(define (t-idx i r) (string-append i "|" r)) +;; retrieve best score for item i, remaining r availbble weight +(define (t-get i r) (or (hash-ref H (t-idx i r)) 0)) + +;; compute best score (i), assuming best (i-1 rest) is known +(define (score i restant) + (if (< i 0) 0 + (hash-ref! H (t-idx i restant) + (if ( >= restant (poids i)) + (max + (score (1- i) restant) + (+ (score (1- i) (- restant (poids i))) (valeur i))) + (score (1- i) restant))))) + +;; compute best scores, starting from last item +(define (task W) + (define restant W) + (define N (1- (table-count T))) + (writeln 'total-value (score N W)) + (for/list ((i (in-range N -1 -1))) + #:continue (= (t-get i restant) (t-get (1- i) restant)) + (set! restant (- restant (poids i))) + (name i))) diff --git a/Task/Knapsack-problem-0-1/EchoLisp/knapsack-problem-0-1-2.echolisp b/Task/Knapsack-problem-0-1/EchoLisp/knapsack-problem-0-1-2.echolisp new file mode 100644 index 0000000000..22a6a510c7 --- /dev/null +++ b/Task/Knapsack-problem-0-1/EchoLisp/knapsack-problem-0-1-2.echolisp @@ -0,0 +1,20 @@ +;; init table +(define goodies + '((map 9 150) ; 9 is weight, 150 is value + (compass 13 35) (water 153 200) (sandwich 50 160) + (glucose 15 60) (tin 68 45)(banana 27 60) (apple 39 40) + (fromage 23 30) (beer 52 10) (🌞-suntan-cream 11 70) (camera 32 30) + (T-shirt 24 15) (pantalons 48 10) (umbrella 73 40) + (☔️-trousers 42 70) (☔️-overclothes 43 75) (note-case 22 80) + (🌞-sun-glasses 7 20) (towel 18 12) (socks 4 50) (book 30 10))) +(list->table goodies T) + + +(task 400) +total-value 1030 + → (socks 🌞-sun-glasses note-case ☔️-overclothes ☔️-trousers 🌞-suntan-cream banana + glucose sandwich water compass map) + + +(length (hash-keys H)) + → 4939 ;; number of entries "i | weight" in hash table diff --git a/Task/Knapsack-problem-0-1/FutureBasic/knapsack-problem-0-1.futurebasic b/Task/Knapsack-problem-0-1/FutureBasic/knapsack-problem-0-1.futurebasic new file mode 100644 index 0000000000..cf4b0751f1 --- /dev/null +++ b/Task/Knapsack-problem-0-1/FutureBasic/knapsack-problem-0-1.futurebasic @@ -0,0 +1,153 @@ +output file "Knapsack Problem Solution" + +include "ConsoleWindow" + +def tab 20 + +_numberOfObjects = 21 +_weightOfKnapsack = 400 + +dim as short n : n = _numberOfObjects /* The number of objects available to pack */ +dim as Str31 s(_numberOfObjects) /* The names of available objects */ +dim as short c(_numberOfObjects) /* The *COST* of the ith object i.e. how much weight you must carry to pack the object */ +dim as short v(_numberOfObjects) /* The *VALUE* of the ith object i.e. on a scale of 1 to 200, how important is it that the object included */ +dim as short W : W = _weightOfKnapsack /* The maximum weight your knapsack will carry in ounces*/ + +s(0) = "map" +s(1) = "compass" +s(2) = "water" +s(3) = "sandwich" +s(4) = "glucose" +s(5) = "tin" +s(6) = "banana" +s(7) = "apple" +s(8) = "cheese" +s(9) = "beer" +s(10) = "suntan cream" +s(11) = "camera" +s(12) = "T-shirt" +s(13) = "trousers" +s(14) = "umbrella" +s(15) = "waterproof pants" +s(16) = "raincoat" +s(17) = "note-case" +s(18) = "sunglasses" +s(19) = "towel" +s(20) = "socks" +s(21) = "socks" + +c(0) = 9 +c(1) = 13 +c(2) = 153 +c(3) = 50 +c(4) = 15 +c(5) = 68 +c(6) = 27 +c(7) = 39 +c(8) = 23 +c(9) = 52 +c(10) = 11 +c(11) = 32 +c(12) = 24 +c(13) = 48 +c(14) = 73 +c(15) = 42 +c(16) = 43 +c(17) = 22 +c(18) = 7 +c(19) = 18 +c(20) = 4 +c(21) = 30 + +v(0) = 150 +v(1) = 35 +v(2) = 200 +v(3) = 160 +v(4) = 60 +v(5) = 45 +v(6) = 60 +v(7) = 40 +v(8) = 30 +v(9) = 10 +v(10) = 70 +v(11) = 30 +v(12) = 15 +v(13) = 10 +v(14) = 40 +v(15) = 70 +v(16) = 75 +v(17) = 80 +v(18) = 20 +v(19) = 12 +v(20) = 50 +v(21) = 10 + + +local fn FillKnapsack +dim as short cur_w +dim as double tot_v : tot_v = 0 +dim as short i, maxi, finalWeight : finalWeight = 0 +dim as short finalValue : finalValue = 0 +dim as short used(_numberOfObjects) + +for i = 0 to n + used(i) = 0 +next + +cur_w = W +while cur_w > -1 + + maxi = -1 + + BeginCCode + for ( i = 0; i < n; ++i) + if ((used[i] == 0) && ((maxi == -1) || ((float)v[i]/c[i] > (float)v[maxi]/c[maxi]))) + maxi = i; + EndC + + used(maxi) = 1 + cur_w -= c(maxi) + tot_v += v(maxi) + + if (cur_w >= 0) + print s(maxi), c(maxi), v(maxi) + + finalWeight = finalWeight + c(maxi) + finalValue = finalValue + v(maxi) + + else + print + print "Add"; int( ( (double)cur_w/c(maxi) * 100 ) +100 ); "% more of "; s(maxi); " into the knapsack to fill remaining space." + + tot_v -= v(maxi) + tot_v += (1 + (double )cur_w/c(maxi)) * v(maxi) + end if +wend + +print +print "Filled the bag with objects whose total value is"; finalValue; "." +print "Total weight of packed objects is"; finalWeight; " ounces." + +end fn + +dim as short i, totalValue, totalWeight + +print +print "Available Items", "Weight in ounces", "Value (Scale of 1 to 200)" +for i = 0 to _numberOfObjects + print s(i), c(i), v(i) + totalValue += v(i) + totalWeight += c(i) +next + +print +print "Total capacity of knapsack:"; W; " ounces"; "." +print "Total value of all"; _numberOfObjects; " objects:"; totalValue; "." +print "Total weight of all"; _numberOfObjects; " objects:"; totalWeight; " ounces." +print +print +print "Most optimal packing considering weight and value:" +print +print "Item", "Weight", "Value" + +fn FillKnapsack diff --git a/Task/Knapsack-problem-0-1/Sidef/knapsack-problem-0-1.sidef b/Task/Knapsack-problem-0-1/Sidef/knapsack-problem-0-1.sidef new file mode 100644 index 0000000000..f3bd3bf7a1 --- /dev/null +++ b/Task/Knapsack-problem-0-1/Sidef/knapsack-problem-0-1.sidef @@ -0,0 +1,70 @@ +var raw = <<'TABLE' +map, 9, 150 +compass, 13, 35 +water, 153, 200 +sandwich, 50, 160 +glucose, 15, 60 +tin, 68, 45 +banana, 27, 60 +apple, 39, 40 +cheese, 23, 30 +beer, 52, 10 +suntancream, 11, 70 +camera, 32, 30 +T-shirt, 24, 15 +trousers, 48, 10 +umbrella, 73, 40 +waterproof trousers, 42, 70 +waterproof overclothes, 43, 75 +note-case, 22, 80 +sunglasses, 7, 20 +towel, 18, 12 +socks, 4, 50 +book, 30, 10 +TABLE + +struct KnapsackItem { + String name, + Number weight, + Number value, +} + +var items = [] +raw.each_line{ |row| + var fields = row.split(/\s*,\s*/) + items << KnapsackItem( + name: fields[0], + weight: fields[1].to_n, + value: fields[2].to_n, + ) +} + +var max_weight = 400 +var p = [ + items.len.of { [[0, []], max_weight.of(nil)...] }..., + max_weight.inc.of {[0, []]} +] + +func optimal(i, w) { + if (!defined p[i][w]) { + var item = items[i]; + if (item.weight > w) { + p[i][w] = optimal(i.dec, w) + } + else { + var x = optimal(i.dec, w) + var y = optimal(i.dec, w - item.weight) + + if (x[0] > (y[0] + item.value)) { + p[i][w] = x; + } + else { + p[i][w] = [y[0] + item.value, [y[1]..., item.name]] + } + } + } + return p[i][w] +} + +var sol = optimal(items.end, max_weight) +say "#{sol[0]}: #{sol[1]}" diff --git a/Task/Knapsack-problem-0-1/jq/knapsack-problem-0-1-1.jq b/Task/Knapsack-problem-0-1/jq/knapsack-problem-0-1-1.jq new file mode 100644 index 0000000000..7d0b9a0b79 --- /dev/null +++ b/Task/Knapsack-problem-0-1/jq/knapsack-problem-0-1-1.jq @@ -0,0 +1,25 @@ +# Input should be the array of objects giving name, weight and value. +# Because of the way addition is defined on null and because of the +# way setpath works, there is no need to initialize the matrix m in +# detail. +def dynamic_knapsack(W): + . as $objects + | length as $n + | reduce range(1; $n+1) as $i # i is the number of items + # state: m[i][j] is an array of [value, array_of_object_names] + (null; # see above remark about initialization of m + $objects[$i-1] as $o + | reduce range(0; W+1) as $j + ( .; + if $o.weight <= $j then + .[$i-1][$j][0] as $v1 # option 1: do not add this object + | (.[$i-1][$j - $o.weight][0] + $o.value) as $v2 # option 2: add it + | (if $v1 > $v2 then + [$v1, .[$i-1][$j][1]] # do not add this object + else [$v2, .[$i-1][$j - $o.weight][1]+[$o.name]] # add it + end) as $mx + | .[$i][$j] = $mx + else + .[$i][$j] = .[$i-1][$j] + end)) + | .[$n][W]; diff --git a/Task/Knapsack-problem-0-1/jq/knapsack-problem-0-1-2.jq b/Task/Knapsack-problem-0-1/jq/knapsack-problem-0-1-2.jq new file mode 100644 index 0000000000..346617c31a --- /dev/null +++ b/Task/Knapsack-problem-0-1/jq/knapsack-problem-0-1-2.jq @@ -0,0 +1,26 @@ +def objects: [ + {name: "map", "weight": 9, "value": 150}, + {name: "compass", "weight": 13, "value": 35}, + {name: "water", "weight": 153, "value": 200}, + {name: "sandwich", "weight": 50, "value": 160}, + {name: "glucose", "weight": 15, "value": 60}, + {name: "tin", "weight": 68, "value": 45}, + {name: "banana", "weight": 27, "value": 60}, + {name: "apple", "weight": 39, "value": 40}, + {name: "cheese", "weight": 23, "value": 30}, + {name: "beer", "weight": 52, "value": 10}, + {name: "suntancream", "weight": 11, "value": 70}, + {name: "camera", "weight": 32, "value": 30}, + {name: "T-shirt", "weight": 24, "value": 15}, + {name: "trousers", "weight": 48, "value": 10}, + {name: "umbrella", "weight": 73, "value": 40}, + {name: "waterproof trousers", "weight": 42, "value": 70}, + {name: "waterproof overclothes", "weight": 43, "value": 75}, + {name: "note-case", "weight": 22, "value": 80}, + {name: "sunglasses", "weight": 7, "value": 20}, + {name: "towel", "weight": 18, "value": 12}, + {name: "socks", "weight": 4, "value": 50}, + {name: "book", "weight": 30, "value": 10} +]; + +objects | dynamic_knapsack(400)[] diff --git a/Task/Knapsack-problem-0-1/jq/knapsack-problem-0-1-3.jq b/Task/Knapsack-problem-0-1/jq/knapsack-problem-0-1-3.jq new file mode 100644 index 0000000000..d0c900738f --- /dev/null +++ b/Task/Knapsack-problem-0-1/jq/knapsack-problem-0-1-3.jq @@ -0,0 +1,3 @@ +$jq -M -c -n -f knapsack.jq +1030 +["map","compass","water","sandwich","glucose","banana","suntancream","waterproof trousers","waterproof overclothes","note-case","sunglasses","socks"] diff --git a/Task/Knapsack-problem-Bounded/EchoLisp/knapsack-problem-bounded-1.echolisp b/Task/Knapsack-problem-Bounded/EchoLisp/knapsack-problem-bounded-1.echolisp new file mode 100644 index 0000000000..e197ac1e63 --- /dev/null +++ b/Task/Knapsack-problem-Bounded/EchoLisp/knapsack-problem-bounded-1.echolisp @@ -0,0 +1,54 @@ +(lib 'struct) +(lib 'sql) +(lib 'hash) + +(define H (make-hash)) +(define T (make-table (struct goodies (name poids valeur qty)))) +(define IDX (make-vector 0)) + + +;; convert to 0/1 PB +;; transorm vector [1 2 3 4 (n-max 3) 5 (n-max 2) 6 .. ] +;; into vector of repeated indices : [1 2 3 4 4 4 5 5 6 ... ] + +(define (make-01 T) + (for ((record T) (i (in-naturals))) + (for ((j (in-range 0 (goodies-qty record)))) + (vector-push IDX i))) + IDX) + +(define-syntax-rule (name i) (table-xref T (vector-ref IDX i) 0)) +(define-syntax-rule (poids i) (table-xref T (vector-ref IDX i) 1)) +(define-syntax-rule (valeur i) (table-xref T (vector-ref IDX i) 2)) + +;; +;; code identical to 0/1 problem +;; + +;; make an unique hash-key from (i rest) +(define (t-idx i r) (string-append i "|" r)) +;; retrieve best core for item i, remaining r availbble weight +(define (t-get i r) (or (hash-ref H (t-idx i r)) 0)) + +;; compute best score (i), assuming best (i-1 rest) is known +(define (score i restant) + (if (< i 0) 0 + (hash-ref! H (t-idx i restant) + (if ( >= restant (poids i)) + (max + (score (1- i) restant) + (+ (score (1- i) (- restant (poids i))) (valeur i))) + (score (1- i) restant)) ;; else not enough + ))) + +;; compute best scores, starting from last item +(define (task W) + (define restant W) + (make-01 T) + (define N (1- (vector-length IDX))) + (writeln 'total-value (score N W)) + (group + (for/list ((i (in-range N -1 -1))) + #:continue (= (t-get i restant) (t-get (1- i) restant)) + (set! restant (- restant (poids i))) + (name i)))) diff --git a/Task/Knapsack-problem-Bounded/EchoLisp/knapsack-problem-bounded-2.echolisp b/Task/Knapsack-problem-Bounded/EchoLisp/knapsack-problem-bounded-2.echolisp new file mode 100644 index 0000000000..a46f2a7f73 --- /dev/null +++ b/Task/Knapsack-problem-Bounded/EchoLisp/knapsack-problem-bounded-2.echolisp @@ -0,0 +1,19 @@ +(define goodies + '((map 9 150 1) (compass 13 35 1)(water 153 200 3) + (sandwich 50 60 2)(🍰-glucose 15 60 2)(tin 68 45 3) + (🍌-banana 27 60 3)(🍎-apple 39 40 3)(cheese 23 30 1) + (beer 52 10 3)(🌞-suntan-cream 11 70 1)(camera 32 30 1) + (t-shirt 24 15 2)(trousers 48 10 2)(umbrella 73 40 1) + (☔️-trousers 42 70 1)(☔️--overcoat 43 75 1)(note-case 22 80 1) + (🌞-sunglasses 7 20 1)(towel 18 12 2)(socks 4 50 1) + (book 30 10 2))) + +(list->table goodies T) + +(task 400) +total-value 1010 + → ((socks) (🌞-sunglasses) (note-case) (☔️--overcoat) (🌞-suntan-cream) (cheese) + (🍌-banana 🍌-banana 🍌-banana) (🍰-glucose 🍰-glucose) (water) (compass) (map)) + +(length (hash-keys H)) + → 10827 ;; # of entries in cache diff --git a/Task/Knapsack-problem-Bounded/Sidef/knapsack-problem-bounded.sidef b/Task/Knapsack-problem-Bounded/Sidef/knapsack-problem-bounded.sidef new file mode 100644 index 0000000000..b1dc375477 --- /dev/null +++ b/Task/Knapsack-problem-Bounded/Sidef/knapsack-problem-bounded.sidef @@ -0,0 +1,67 @@ +var raw = <<'TABLE' +map 9 150 1 +compass 13 35 1 +water 153 200 2 +sandwich 50 60 2 +glucose 15 60 2 +tin 68 45 3 +banana 27 60 3 +apple 39 40 3 +cheese 23 30 1 +beer 52 10 1 +suntancream 11 70 1 +camera 32 30 1 +T-shirt 24 15 2 +trousers 48 10 2 +umbrella 73 40 1 +w_trousers 42 70 1 +w_overcoat 43 75 1 +note-case 22 80 1 +sunglasses 7 20 1 +towel 18 12 2 +socks 4 50 1 +book 30 10 2 +TABLE + +struct KnapsackItem { + String name, + Number weight, + Number value, + Number quant, +} + +var items = [] +raw.each_line{ |row| + var fields = row.words; + items << KnapsackItem( + name: fields[0], + weight: fields[1].to_n, + value: fields[2].to_n, + quant: fields[3].to_n, + ) +} + +func pick(weight, pos) is cached { + + if (pos.is_neg || weight.is_neg || weight.is_zero) { + return (0, 0, []) + } + + var (bv=0, bi=0, bw=0, bp=[]) + var item = items[pos]; + + for i in range(0, item.quant) { + break if (i*item.weight > weight) + var (v, w, p) = pick(weight - i*item.weight, pos.dec) + next if ((v += i*item.value) <= bv) + (bv, bi, bw, bp) = (v, i, w, p) + } + + (bv, bw + bi*item.weight, [bp..., bi]) +} + +var (v, w, p) = pick(400, items.end) +p.range.each { |i| + say "#{p[i]} of #{items[i].name}" if p[i].is_pos +} +say "Value: #{v}; Weight: #{w}" diff --git a/Task/Knapsack-problem-Continuous/EchoLisp/knapsack-problem-continuous.echolisp b/Task/Knapsack-problem-Continuous/EchoLisp/knapsack-problem-continuous.echolisp new file mode 100644 index 0000000000..2cf95731bb --- /dev/null +++ b/Task/Knapsack-problem-Continuous/EchoLisp/knapsack-problem-continuous.echolisp @@ -0,0 +1,36 @@ +(lib 'struct) +(lib 'sql) ;; for table + +(define T (make-table (struct meal (name poids price)))) + +(define meals + '((🐂-beef 3.8 36) + (🍖-pork 5.4 43) + (🍗-ham 3.6 90) + (🐪-greaves 2.4 45) + (flitch 4.0 30) + (brawn 2.5 56) + (welt 3.7 67) + (🐃--salami 3.0 95) + (🐖-sausage 5.9 98))) + +(list->table meals T) +;; sort table according to best price/poids ratio +(define (price/poids a b ) + (- (// (* (meal-price b) (meal-poids a)) (meal-price a) (meal-poids b)) 1)) +(table-sort T price/poids) + +(define-syntax-rule (name i) (table-xref T i 0)) +(define-syntax-rule (poids i) (table-xref T i 1)) + +;; shop : add items in basket, in order, until W exhausted +(define (shop W ) + (for/list ((i (table-count T))) + #:break (<= W 0) + (begin0 + (cons (name i) (if (<= (poids i) W) 'all W)) + (set! W (- W (poids i)))))) + +;; output +(shop 15) + → ((🐃--salami . all) (🍗-ham . all) (brawn . all) (🐪-greaves . all) (welt . 3.5)) diff --git a/Task/Knapsack-problem-Continuous/Oforth/knapsack-problem-continuous.oforth b/Task/Knapsack-problem-Continuous/Oforth/knapsack-problem-continuous.oforth new file mode 100644 index 0000000000..b903dd54a5 --- /dev/null +++ b/Task/Knapsack-problem-Continuous/Oforth/knapsack-problem-continuous.oforth @@ -0,0 +1,18 @@ +[ + [ "beef", 3.8, 36 ], [ "pork", 5.4, 43 ], [ "ham", 3.6, 90 ], + [ "greaves", 2.4, 45 ], [ "flitch", 4.0, 30 ], [ "brawn", 2.5, 56 ], + [ "welt", 3.7, 67 ], [ "salami", 3.0, 95 ], [ "sausage", 5.9, 98 ] +] const: Items + +: rob +| item value | + 0.0 ->value + 15.0 #[ dup second swap third / ] Items sortBy forEach: item [ + dup 0.0 == ifTrue: [ return ] + dup item second >= ifTrue: [ + "Taking" . item first . " :" . item second dup .cr - + item third value + ->value continue + ] + "And part of" . item first . " :" . dup .cr + item third * item second / value + "Total value :" . .cr break + ] ; diff --git a/Task/Knapsack-problem-Continuous/Sidef/knapsack-problem-continuous.sidef b/Task/Knapsack-problem-Continuous/Sidef/knapsack-problem-continuous.sidef new file mode 100644 index 0000000000..16ecb72e63 --- /dev/null +++ b/Task/Knapsack-problem-Continuous/Sidef/knapsack-problem-continuous.sidef @@ -0,0 +1,30 @@ +var items = +[ + [:beef, 3.8, 36], + [:pork, 5.4, 43], + [:ham, 3.6, 90], + [:greaves, 2.4, 45], + [:flitch, 4.0, 30], + [:brawn, 2.5, 56], + [:welt, 3.7, 67], + [:salami, 3.0, 95], + [:sausage, 5.9, 98], +].sort {|a,b| b[2]/b[1] <=> a[2]/a[1] } + +var (limit, value) = (15, 0); +print "Item Fraction Weight Value\n"; + +items.each { |item| + var ratio = (item[1] > limit ? limit/item[1] : 1); + value += item[2]*ratio; + limit -= item[1]; + if (ratio == 1) { + printf("%-8s %4s %7.2f %6.2f\n", item[0], 'all', item[1], item[2]); + } + else { + printf("%-8s %-4.2f %7.2f %6.2f\n", item[0], ratio, item[1]*ratio, item[2]*ratio); + break; + } +} + +say "#{'-'*28}\ntotal value: #{'%.14g' % value }" diff --git a/Task/Knapsack-problem-Continuous/jq/knapsack-problem-continuous-1.jq b/Task/Knapsack-problem-Continuous/jq/knapsack-problem-continuous-1.jq new file mode 100644 index 0000000000..b9034ab8f6 --- /dev/null +++ b/Task/Knapsack-problem-Continuous/jq/knapsack-problem-continuous-1.jq @@ -0,0 +1,22 @@ +# continuous_knapsack(W) expects the input to be +# an array of objects {"name": _, "weight": _, "value": _} +# where "value" is the value of the given weight of the object. + +def continuous_knapsack(W): + map( .price = (if .weight > 0 then (.value/.weight) else 0 end) ) + | sort_by( .price ) + | reverse + | reduce .[] as $item + # state: [array, capacity] + ([[], W]; + .[1] as $c + | if $c <= 0 then . + else ( [$item.weight, $c] | min) as $min + | [.[0] + [ $item | (.weight = $min) | .value = (.price * $min)], + ($c - $min) ] + end) + | .[1] as $remainder + | .[0] + | (.[] | {name, weight}), + "Total value: \( map(.value) | add)", + "Total weight: \(W - $remainder)" ; diff --git a/Task/Knapsack-problem-Continuous/jq/knapsack-problem-continuous-2.jq b/Task/Knapsack-problem-Continuous/jq/knapsack-problem-continuous-2.jq new file mode 100644 index 0000000000..41cf9d8c17 --- /dev/null +++ b/Task/Knapsack-problem-Continuous/jq/knapsack-problem-continuous-2.jq @@ -0,0 +1,12 @@ +def items: [ + { "name": "beef", "weight": 3.8, "value": 36}, + { "name": "pork", "weight": 5.4, "value": 43}, + { "name": "ham", "weight": 3.6, "value": 90}, + { "name": "greaves", "weight": 2.4, "value": 45}, + { "name": "flitch", "weight": 4.0, "value": 30}, + { "name": "brawn", "weight": 2.5, "value": 56}, + { "name": "welt", "weight": 3.7, "value": 67}, + { "name": "salami", "weight": 3.0, "value": 95}, + { "name": "sausage", "weight": 5.9, "value": 98} ]; + +items | continuous_knapsack(15) diff --git a/Task/Knapsack-problem-Continuous/jq/knapsack-problem-continuous-3.jq b/Task/Knapsack-problem-Continuous/jq/knapsack-problem-continuous-3.jq new file mode 100644 index 0000000000..50a93efb12 --- /dev/null +++ b/Task/Knapsack-problem-Continuous/jq/knapsack-problem-continuous-3.jq @@ -0,0 +1,8 @@ +$ jq -r -c -n -f knapsack_continuous.jq +{"name":"salami","weight":3} +{"name":"ham","weight":3.6} +{"name":"brawn","weight":2.5} +{"name":"greaves","weight":2.4} +{"name":"welt","weight":3.5000000000000004} +Total value: 349.3783783783784 +Total weight: 15 diff --git a/Task/Knapsack-problem-Unbounded/EchoLisp/knapsack-problem-unbounded.echolisp b/Task/Knapsack-problem-Unbounded/EchoLisp/knapsack-problem-unbounded.echolisp new file mode 100644 index 0000000000..85abdcd71c --- /dev/null +++ b/Task/Knapsack-problem-Unbounded/EchoLisp/knapsack-problem-unbounded.echolisp @@ -0,0 +1,70 @@ +(require 'struct) +(require 'hash) +(require 'sql) + +(define H null) ;; cache +(define T (make-table (struct goodies (name valeur poids volume )))) +(define-syntax-rule (name i) (table-xref T i 0)) +(define-syntax-rule (valeur i) (table-xref T i 1)) +(define-syntax-rule (poids i) (table-xref T i 2)) +(define-syntax-rule (volume i) (table-xref T i 3)) + + +(define goodies + '(("🍁-panacea" 3000 300 25) + ("🌵-ichor" 1800 200 15) + ("⭐️-gold" 2500 2000 2))) + +(list->table goodies T) + +;; i = item index, p= remaining weight, v = remaining volume + +;; make an unique hash-key from (i p v) +(define (t-key i p v) (string-append i "|" p "|" v)) + +;; retrieve best core for item i +;; returns ( score . quantity) + +(define (t-get i p v) + (if ( < i 0) (cons 0 0) + (hash-ref H (t-key i p v )))) ;; may be #f + +;; compute best quantity.score (i), assuming best (i-1 p v) is known +(define (score-qty i p v (q) (score)(smax)(qmax)) + (or + (t-get i p v) ;; already known + (begin + (set! q (min (quotient p (poids i)) (quotient v (volume i)))) ;; max possible q + (set! smax -Infinity) + ( for ((k (1+ q))) ;; try all legal quantities + (set! score (+ + (first (score-qty (1- i) (- p (* k (poids i))) (- v (* k (volume i))))) + (* k (valeur i)))) + #:continue (< score smax) + (set! smax score) + (set! qmax k)) + (hash-set H (t-key i p v) (cons smax qmax))))) + + +;; compute best scores, starting from last item +(define (task P V) + (define N (1- (table-count T))) + (define qty 0) + (set! H (make-hash)) + (writeln 'total-value (first (score-qty N P V))) + + (for/list ((i (in-range N -1 -1))) + (set! qty (rest (t-get i P V))) + #:continue (= qty 0) + (begin0 + (cons (name i) (t-get i P V)) + (set! P (- P (* (poids i) qty))) + (set! V (- V (* (volume i) qty)))))) + +;; output +(task 25000 250) +total-value 54500 + → (("⭐️-gold" 54500 . 11) ("🌵-ichor" 27000 . 15)) + +(length (hash-keys H)) ;; # entries in cache + → 218 diff --git a/Task/Knapsack-problem-Unbounded/Sidef/knapsack-problem-unbounded.sidef b/Task/Knapsack-problem-Unbounded/Sidef/knapsack-problem-unbounded.sidef new file mode 100644 index 0000000000..a556e4375e --- /dev/null +++ b/Task/Knapsack-problem-Unbounded/Sidef/knapsack-problem-unbounded.sidef @@ -0,0 +1,65 @@ +struct KnapsackItem { + Number volume, + Number weight, + Number value, + String name, +} + +var items = [ + KnapsackItem(25, 3, 3000, "panacea") + KnapsackItem(15, 2, 1800, "ichor" ) + KnapsackItem( 2, 20, 2500, "gold" ) +] + +var ( + max_weight = 250, + max_vol = 250, + vsc = 1000, + wsc = 10 +) + +func solve(i, w, v) is cached { + return [0, []] if i.is_neg; + + var x = solve(i.dec, w, v); + + var (w1, v1); + Inf.times { |t| + var item = items[i]; + break if ((w1 = (w - t*item.weight)).is_neg) + break if ((v1 = (v - t*item.volume)).is_neg) + + var y = solve(i.dec, w1, v1); + if ((var tmp = (y[0] + t*item.value)) > x[0]) { + x = [tmp, [y[1]..., [i, t]]]; + } + } + + return x +} + +var x = solve(items.end, max_weight, max_vol) + +print <<"EOT" +Max value #{x[0]}, with: + Item Qty Weight Vol Value +#{"-" * 50} +EOT + +var (wtot=0, vtot=0); +x[1].each { |s| + var item = items[s[0]]; + " #{item.name}:\t% 3d % 8d% 8g% 8d\n".printf( + s[1], + item.weight * s[1] / wsc, + item.volume * s[1] / vsc, + item.value * s[1] + ); + wtot += (item.weight * s[1]); + vtot += (item.volume * s[1]); +} + +print <<"EOT" +#{"-" * 50} + Total:\t #{"%8d%8g%8d" % (wtot/wsc, vtot/vsc, x[0])} +EOT diff --git a/Task/Knights-tour/ERRE/knights-tour.erre b/Task/Knights-tour/ERRE/knights-tour.erre new file mode 100644 index 0000000000..349dbc9b35 --- /dev/null +++ b/Task/Knights-tour/ERRE/knights-tour.erre @@ -0,0 +1,209 @@ +! ********************************************************************** +! * * +! * IL GIRO DEL CAVALLO - come collocare un cavallo su di una * +! * scacchiera n*n passando una sola volta * +! * per ogni casella. * +! * * +! ********************************************************************** +! ---------------------------------------------------------------------- +! Inizializzazione dei parametri +! ---------------------------------------------------------------------- + +PROGRAM KNIGHT + +!$INTEGER +!$KEY + +DIM H[25,25],A[8],B[8],P0[8],P1[8] + +!$INCLUDE="PC.LIB" + +PROCEDURE INIT_SCACCHIERA +! ********************************************************************** +! * Routine di inizializzazione scacchiera * +! ********************************************************************** + FOR I1=1 TO 8 DO + U=X+A[I1] V=Y+B[I1] + IF (U>0 AND U<=N) AND (V>0 AND V<=N) THEN + H[U,V]=H[U,V]-1 + END IF + END FOR +END PROCEDURE + +PROCEDURE MOSTRA_SCACCHIERA +! ********************************************************************* +! * Routine di visualizzazione della scacchiera * +! ********************************************************************* + LOCATE(5,1) COLOR(0,7) PRINT(" Mossa num.";NMOS) COLOR(7,0) + L2=N + FOR I2=1 TO N DO + PRINT + FOR L1=1 TO N DO + IF H[L1,L2]>0 THEN COLOR(15,0) END IF + WRITE("####";H[L1,L2];) + COLOR(7,0) + END FOR + L2=L2-1 + END FOR +END PROCEDURE + +PROCEDURE AGGIORNA_SCACCHIERA +! ********************************************************************* +! * Routine di Aggiornamento Scacchiera * +! ********************************************************************* + B=1 + FOR I1=1 TO 8 DO + U=X+A[I1] V=Y+B[I1] + IF (U>0 AND U<=N) AND (V>0 AND V<=N) THEN + IF H[U,V]<=0 THEN + H[U,V]=H[U,V]+1 B=0 + END IF + END IF + END FOR + IF B=1 THEN Q1=0 END IF +END PROCEDURE + +PROCEDURE MOSSA_MAX_PESO +! ********************************************************************* +! * Cerca la prossima mossa con il massimo peso * +! ********************************************************************* + M1=0 RO=1 + FOR W=1 TO 8 DO + U=Z1+A[W] V=Z2+B[W] + IF (U>0 AND U<=N) AND (V>0 AND V<=N) THEN + IF H[U,V]<=0 AND H[U,V]<=M1 THEN + IF H[U,V]=M1 THEN + RO=RO+1 P0[RO]=W + ELSE + M1=H[U,V] Q1=1 T1=U T2=V RO=1 P0[1]=W + END IF + END IF + END IF + END FOR +END PROCEDURE + +PROCEDURE MOSSA_MIN_PESO +! ********************************************************************* +! * Cerca la prossima mossa con il minimo peso * +! ********************************************************************* + M1=-9 RO=1 + FOR W=1 TO 8 DO + U=Z1+A[W] V=Z2+B[W] + IF (U>0 AND U<=N) AND (V>0 AND V<=N) THEN + IF H[U,V]<=0 AND H[U,V]>=M1 THEN + IF H[U,V]=M1 THEN + RO=RO+1 P0[RO]=W + ELSE + M1=H[U,V] Q1=1 T1=U T2=V RO=1 P0[1]=W + END IF + END IF + END IF + END FOR +END PROCEDURE + +BEGIN + A[1]=1 A[2]=2 A[3]=2 A[4]=1 + A[5]=-1 A[6]=-2 A[7]=-2 A[8]=-1 + B[1]=2 B[2]=1 B[3]=-1 B[4]=-2 + B[5]=-2 B[6]=-1 B[7]=1 B[8]=2 + + CLS + PRINT(" *** LA GALOPPATA DEL CAVALIERE ***") + PRINT + PRINT("Inserire la dimensione della scacchiera (max. 25)";) + INPUT(N) + PRINT("Inserire la caselle di partenza (x,y) ";) + INPUT(X1,Y1) + NMOS=1 A1=1 N1=N*N ESCAPE=FALSE +! ---------------------------------------------------------------------- +! Set della scacchiera +! ---------------------------------------------------------------------- + WHILE NOT ESCAPE DO + FOR I=1 TO N DO + FOR J=1 TO N DO + H[I,J]=0 + END FOR + END FOR + FOR I=1 TO N DO + FOR J=1 TO N DO + X=I Y=J + INIT_SCACCHIERA + END FOR + END FOR + +! ---------------------------------------------------------------------- +! Effettua la prima mossa +! ---------------------------------------------------------------------- + X=X1 Y=Y1 H[X,Y]=1 L=2 + AGGIORNA_SCACCHIERA + Q1=1 Q2=1 +! ----------------------------------------------------------------------- +! Trova la prossima mossa +! ----------------------------------------------------------------------- + WHILE Q1<>0 AND Q2<>0 DO + Q1=0 Z1=X Z2=Y + MOSSA_MIN_PESO + IF RO<=1 THEN + C1=T1 C2=T2 + ELSE +! ------------------------------------------------------------------------ +! Esamina tutti i vincoli +! ------------------------------------------------------------------------ + FOR K=1 TO RO DO + P1[K]=P0[K] + END FOR + R1=RO + IF A1=1 THEN M2=-9 ELSE M2=0 END IF + FOR K=1 TO R1 DO + F1=P1[K] Z1=X+A[F1] Z2=Y+B[F1] + IF A1=1 THEN + MOSSA_MAX_PESO + IF M1<=M2 THEN + !$NULL + ELSE + M2=M1 C1=Z1 C2=Z2 + END IF + ELSE + MOSSA_MIN_PESO + IF M1>=M2 THEN + !$NULL + ELSE + M2=M1 C1=Z1 C2=Z2 + END IF + END IF + END FOR +! ------------------------------------------------------------------------ +! Prossima mossa trovata:aggiorna la scacchiera +! ------------------------------------------------------------------------ + END IF + IF Q1<>0 THEN + X=C1 Y=C2 H[X,Y]=L + AGGIORNA_SCACCHIERA + IF L=N1 THEN Q2=0 END IF + END IF + L=L+1 + MOSTRA_SCACCHIERA + NMOS=NMOS+1 + END WHILE +! ------------------------------------------------------------------------ +! La ricerca è terminata: visualizza i risultati +! ------------------------------------------------------------------------ + PRINT PRINT + IF Q2<>1 THEN + PRINT("*** Trovata la soluzione! ***") + MOSTRA_SCACCHIERA + ESCAPE=TRUE + ELSE + IF A1=0 THEN + PRINT("Nessuna soluzione.") + ESCAPE=TRUE + ELSE + BEEP + A1=0 + END IF + END IF + END WHILE + REPEAT + GET(A$) + UNTIL A$<>"" +END PROGRAM diff --git a/Task/Knights-tour/EchoLisp/knights-tour-1.echolisp b/Task/Knights-tour/EchoLisp/knights-tour-1.echolisp new file mode 100644 index 0000000000..5f918e2b64 --- /dev/null +++ b/Task/Knights-tour/EchoLisp/knights-tour-1.echolisp @@ -0,0 +1,68 @@ +(require 'plot) +(define *knight-moves* + '((2 . 1)(2 . -1 ) (1 . -2) (-1 . -2 )(-2 . -1) (-2 . 1) (-1 . 2) (1 . 2))) +(define *hit-squares* null) +(define *legal-moves* null) +(define *tries* 0) + +(define (square x y n ) (+ y (* x n))) +(define (dim n) (1- (* n n))) ; n^2 - 1 + +;; check legal knight move from sq +;; return null or (list destination-square) + +(define (legal-disp n sq k-move) + (let ((x (+ (quotient sq n) (first k-move))) + (y (+ (modulo sq n) (rest k-move)))) + (if (and (>= x 0) (< x n) (>= y 0) (< y n)) + (list (square x y n)) null))) + + ;; list of legal destination squares from sq + (define (legal-moves sq k-moves n ) + (if (null? k-moves) null + (append (legal-moves sq (rest k-moves) n) (legal-disp n sq (first k-moves))))) + +;; square freedom = number of destination squares not already reached +(define (freedom sq) + (for/sum ((dest (vector-ref *legal-moves* sq))) + (if (vector-ref *hit-squares* dest) 0 1))) + +;; The chess adage" A knight on the rim is dim" is false here : +;; choose to move to square with smallest freedom : Warnsdorf's rule +(define (square-sort a b) + (< (freedom a) (freedom b))) + +;; knight tour engine +(define (play sq step starter last-one wants-open) +(set! *tries* (1+ *tries*)) + (vector-set! *hit-squares* sq step) ;; flag used square + (if (= step last-one) (throw 'HIT last-one)) ;; stop on first path found + + (when (or wants-open ;; cut search iff closed path + (and (< step last-one) (> (freedom starter) 0))) ;; this ensures a closed path + + (for ((target (list-sort square-sort (vector-ref *legal-moves* sq)))) + (unless (vector-ref *hit-squares* target) + (play target (1+ step) starter last-one wants-open)))) + (vector-set! *hit-squares* sq #f)) ;; unflag used square + +(define (show-steps n wants-open) + (string-delimiter "") + (if wants-open + (printf "♘-tour: %d tries." *tries*) + (printf "♞-closed-tour: %d tries." *tries*)) + (for ((x n)) + (writeln) + (for((y n)) + (write (string-pad-right (vector-ref *hit-squares* (square x y n)) 4))))) + + +(define (k-tour (n 8) (starter 0) (wants-open #t)) +(set! *hit-squares* (make-vector (* n n) #f)) +;; build vector of legal moves for squares 0..n^2-1 +(set! *legal-moves* + (build-vector (* n n) (lambda(sq) (legal-moves sq *knight-moves* n)))) +(set! *tries* 0) ; counter + (try + (play starter 0 starter (dim n) wants-open) + (catch (hit mess) (show-steps n wants-open)))) diff --git a/Task/Knights-tour/EchoLisp/knights-tour-2.echolisp b/Task/Knights-tour/EchoLisp/knights-tour-2.echolisp new file mode 100644 index 0000000000..afaccd1405 --- /dev/null +++ b/Task/Knights-tour/EchoLisp/knights-tour-2.echolisp @@ -0,0 +1,33 @@ +(k-tour 8 0 #f) +♞-closed-tour: 66 tries. +0 47 14 31 62 27 12 29 +15 32 63 54 13 30 57 26 +48 1 46 61 56 59 28 11 +33 16 55 50 53 44 25 58 +2 49 42 45 60 51 10 39 +17 34 19 52 43 40 7 24 +20 3 36 41 22 5 38 9 +35 18 21 4 37 8 23 6 + +(k-tour 20 57) +♘-tour: 400 tries. +31 34 29 104 209 36 215 300 211 38 213 354 343 40 345 386 383 42 1 388 +28 103 32 35 216 299 210 37 214 335 342 39 346 385 382 41 390 387 396 43 +33 30 105 208 201 308 301 336 323 212 353 340 355 344 391 384 395 0 389 2 +102 27 202 219 298 217 322 309 334 341 356 347 358 351 376 381 378 399 44 397 +203 106 207 200 307 228 311 302 337 324 339 352 373 364 379 392 375 394 3 368 +26 101 220 229 218 297 304 321 310 333 348 357 350 359 374 377 380 367 398 45 +107 204 199 206 227 306 231 312 303 338 325 330 363 372 365 328 393 254 369 4 +100 25 122 221 230 233 296 305 320 313 332 349 326 329 360 371 366 251 46 253 +121 108 205 198 145 226 237 232 295 286 319 314 331 362 327 316 255 370 5 178 +24 99 144 123 222 129 234 279 236 281 294 289 318 315 256 361 250 179 252 47 +109 120 111 130 197 146 225 238 285 278 287 272 293 290 317 180 257 162 177 6 +98 23 124 143 128 223 276 235 280 239 282 291 288 265 270 249 176 181 48 161 +115 110 119 112 131 196 147 224 277 284 273 266 271 292 245 258 163 174 7 58 +22 97 114 125 142 127 140 275 194 267 240 283 264 269 248 175 182 59 160 49 +87 116 95 118 113 132 195 148 187 274 263 268 191 244 259 246 173 164 57 8 +96 21 88 133 126 141 150 139 262 193 190 241 260 247 172 183 60 159 50 65 +77 86 117 94 89 138 135 188 149 186 261 192 171 184 243 156 165 64 9 56 +20 81 78 85 134 93 90 151 136 189 170 185 242 155 166 61 158 53 66 51 +79 76 83 18 91 74 137 16 169 72 153 14 167 70 157 12 63 68 55 10 +82 19 80 75 84 17 92 73 152 15 168 71 154 13 62 69 54 11 52 67 diff --git a/Task/Knights-tour/EchoLisp/knights-tour-3.echolisp b/Task/Knights-tour/EchoLisp/knights-tour-3.echolisp new file mode 100644 index 0000000000..9605f9c45b --- /dev/null +++ b/Task/Knights-tour/EchoLisp/knights-tour-3.echolisp @@ -0,0 +1,9 @@ +(define (step-color x y n last-one) + (letrec ((sq (square (floor x) (floor y) n)) + (step (vector-ref *hit-squares* sq) n n)) + (cond ((= 0 step) (rgb 1 0 0)) ;; red starter + ((= last-one step) (rgb 0 1 0)) ;; green end + (else (gray (// step n n)))))) + +(define ( k-plot n) + (plot-rgb (lambda (x y) (step-color x y n (dim n))) (- n epsilon) (- n epsilon))) diff --git a/Task/Knights-tour/Elm/knights-tour.elm b/Task/Knights-tour/Elm/knights-tour.elm new file mode 100644 index 0000000000..94053638a4 --- /dev/null +++ b/Task/Knights-tour/Elm/knights-tour.elm @@ -0,0 +1,133 @@ +import List exposing (concatMap, foldl, head,member,filter,length,minimum,concat,map,map2,tail) +import List.Extra exposing (minimumBy, andThen) +import String exposing (join) +import Html as H +import Html.Attributes as HA +import Html.App exposing (program) +import Time exposing (Time,every, second) +import Svg exposing (rect, line, svg, g) +import Svg.Events exposing (onClick) +import Svg.Attributes exposing (version, viewBox, x, y, x1, y1, x2, y2, fill, style, width, height) + +w = 450 +h = 450 +rowCount=20 +colCount=20 +dt = 0.03 + +type alias Cell = (Int, Int) + +type alias Model = + { path : List Cell + , board : List Cell + } + +type Msg = NoOp | Tick Time | SetStart Cell + +init : (Model,Cmd Msg) +init = + let board = [0..rowCount-1] `andThen` \r -> + [0..colCount-1] `andThen` \c -> + [(r, c)] + path = [] + in (Model path board, Cmd.none) + +view : Model -> H.Html Msg +view model = + let + showChecker row col = + rect [ x <| toString col + , y <| toString row + , width "1" + , height "1" + , fill <| if (row + col) % 2 == 0 then "blue" else "grey" + , onClick <| SetStart (row, col) + ] + [] + + showMove (row0,col0) (row1,col1) = + line [ x1 <| toString ((toFloat col0) + 0.5) + , y1 <| toString ((toFloat row0) + 0.5) + , x2 <| toString ((toFloat col1) + 0.5) + , y2 <| toString ((toFloat row1) + 0.5) + , style "stroke:yellow;stroke-width:0.05" + ] + [] + + render model = + let checkers = model.board `andThen` \(r,c) -> + [showChecker r c] + moves = case List.tail model.path of + Nothing -> [] + Just tl -> List.map2 showMove model.path tl + in checkers ++ moves + + unvisited = length model.board - length model.path + + center = HA.style [ ( "text-align", "center") ] + + in + H.div + [] + [ H.h2 [center] [H.text "Knight's Tour"] + , H.h2 [center] [H.text <| "Unvisited count : " ++ toString unvisited ] + , H.h2 [center] [H.text "(pick a square)"] + , H.div + [center] + [ svg + [ version "1.1" + , width (toString w) + , height (toString h) + , viewBox (join " " + [ toString 0 + , toString 0 + , toString colCount + , toString rowCount ]) + ] + [ g [] <| render model] + ] + ] + +nextMoves : Model -> Cell -> List Cell +nextMoves model (stRow,stCol) = + let c = [ 1, 2, -1, -2] + + km = c `andThen` \cRow -> + c `andThen` \cCol -> + if abs(cRow) == abs(cCol) then [] else [(cRow,cCol)] + + jumps = List.map (\(kmRow,kmCol) -> (kmRow + stRow, kmCol + stCol)) km + + in List.filter (\j -> List.member j model.board && not (List.member j model.path) ) jumps + +bestMove : Model -> Maybe Cell +bestMove model = + case List.head (model.path) of + Nothing -> Nothing + Just mph -> minimumBy (List.length << nextMoves model) (nextMoves model mph) + +update : Msg -> Model -> (Model, Cmd Msg) +update msg model = + let mo = case msg of + SetStart start -> + {model | path = [start]} + Tick t -> + case model.path of + [] -> model + _ -> case bestMove model of + Nothing -> model + Just best -> {model | path = best::model.path } + NoOp -> model + in (mo, Cmd.none) + +subscriptions : Model -> Sub Msg +subscriptions _ = + Time.every (dt * second) Tick + +main = + program + { init = init + , view = view + , update = update + , subscriptions = subscriptions + } diff --git a/Task/Knights-tour/Phix/knights-tour.phix b/Task/Knights-tour/Phix/knights-tour.phix new file mode 100644 index 0000000000..5ae992750b --- /dev/null +++ b/Task/Knights-tour/Phix/knights-tour.phix @@ -0,0 +1,86 @@ +constant size = 8 +constant nchars = length(sprintf(" %d",size*size)) +constant fmt = sprintf(" %%%dd",nchars-1) +constant blank = repeat(' ',nchars) + +-- to simplify output, each square is nchars +sequence board = repeat(repeat(' ',size*nchars),size) +-- keep current counts, immediately backtrack if any hit 0 +-- (in line with the above, we only use every nth entry) +sequence warnsdorffs = repeat(repeat(0,size*nchars),size) + +constant ROW = 1, COL = 2 +constant moves = {{-1,-2},{-2,-1},{-2,1},{-1,2},{1,2},{2,1},{2,-1},{1,-2}} + +function onboard(integer row, integer col) + return row>=1 and row<=size and col>=nchars and col<=nchars*size +end function + +procedure init_warnsdorffs() +integer nrow,ncol + for row=1 to size do + for col=nchars to nchars*size by nchars do + for move=1 to length(moves) do + nrow = row+moves[move][ROW] + ncol = col+moves[move][COL]*nchars + if onboard(nrow,ncol) then + warnsdorffs[row][col] += 1 + end if + end for + end for + end for +end procedure + +atom t0 = time() +integer tries = 0 +atom t1 = time()+1 +function solve(integer row, integer col, integer n) +integer nrow, ncol +if time()>t1 then + ?{row,floor(col/nchars),n,tries} + puts(1,join(board,"\n")) + t1 = time()+1 +-- if wait_key()='!' then ?9/0 end if +end if + tries+= 1 + if n>size*size then return 1 end if + sequence wmoves = {} + for move=1 to length(moves) do + nrow = row+moves[move][ROW] + ncol = col+moves[move][COL]*nchars + if onboard(nrow,ncol) + and board[nrow][ncol]=' ' then + wmoves = append(wmoves,{warnsdorffs[nrow][ncol],nrow,ncol}) + end if + end for + wmoves = sort(wmoves) + -- avoid creating orphans + if length(wmoves)<2 or wmoves[2][1]>1 then + for m=1 to length(wmoves) do + {?,nrow,ncol} = wmoves[m] + warnsdorffs[nrow][ncol] -= 1 + end for + for m=1 to length(wmoves) do + {?,nrow,ncol} = wmoves[m] + board[nrow][ncol-nchars+1..ncol] = sprintf(fmt,n) + if solve(nrow,ncol,n+1) then return 1 end if + board[nrow][ncol-nchars+1..ncol] = blank + end for + for m=1 to length(wmoves) do + {?,nrow,ncol} = wmoves[m] + warnsdorffs[nrow][ncol] += 1 + end for + end if + return 0 +end function + +init_warnsdorffs() +board[1][nchars] = '1' +if solve(1,nchars,2) then + puts(1,join(board,"\n")) + printf(1,"\nsolution found in %d tries (%3.2fs)\n",{tries,time()-t0}) +else + puts(1,"no solutions found\n") +end if + +{} = wait_key() diff --git a/Task/Knights-tour/Sidef/knights-tour.sidef b/Task/Knights-tour/Sidef/knights-tour.sidef new file mode 100644 index 0000000000..9622676d84 --- /dev/null +++ b/Task/Knights-tour/Sidef/knights-tour.sidef @@ -0,0 +1,61 @@ +var board = [] +var I = 8 +var J = 8 +var F = (I*J > 99 ? '%3d' : '%2d') + +var (i, j) = (I.irand, J.irand) + +func from_algebraic(square) { + if (var match = square.match(/^([a-z])([0-9])\z/)) { + return(I - Num(match[1]), match[0].ord - 'a'.ord) + } + die "Invalid block square: #{square}" +} + +func possible_moves(i,j) { + gather { + for ni,nj in [ + [i-2,j-1], [i-2,j+1], [i-1,j-2], [i-1,j+2], + [i+1,j-2], [i+1,j+2], [i+2,j-1], [i+2,j+1], + ] { + if ((ni ~~ ^I) && (nj ~~ ^J) && !board[ni][nj]) { + take([ni, nj]) + } + } + } +} + +func to_algebraic(i,j) { + ('a'.ord + j).chr + Str(I - i) +} + +if (ARGV[0]) { + (i, j) = from_algebraic(ARGV[0]) +} + +var moves = [] +for move in (1 .. I*J) { + moves << to_algebraic(i, j) + board[i][j] = move + var min = [9] + for target in possible_moves(i, j) { + var (ni, nj) = target... + var nxt = possible_moves(ni, nj).len + if (nxt < min[0]) { + min = [nxt, ni, nj] + } + } + + (i, j) = min[1,2] +} + +say (moves/4 -> map { .join(', ') }.join("\n") + "\n") + +for i in ^I { + for j in ^J { + (i%2 == j%2) && print "\e[7m" + F.printf(board[i][j]) + print "\e[0m" + } + print "\n" +} diff --git a/Task/Knuth-shuffle/ERRE/knuth-shuffle.erre b/Task/Knuth-shuffle/ERRE/knuth-shuffle.erre new file mode 100644 index 0000000000..e039fe161a --- /dev/null +++ b/Task/Knuth-shuffle/ERRE/knuth-shuffle.erre @@ -0,0 +1,19 @@ +PROGRAM KNUTH_SHUFFLE + +CONST CARDS%=52 + +DIM PACK%[CARDS%] + +BEGIN + RANDOMIZE(TIMER) + FOR I%=1 TO CARDS% DO + PACK%[I%]=I% + END FOR + FOR N%=CARDS% TO 2 STEP -1 DO + SWAP(PACK%[N%],PACK%[1+INT(N%*RND(1))]) + END FOR + FOR I%=1 TO CARDS% DO + PRINT(PACK%[I%];) + END FOR + PRINT +END PROGRAM diff --git a/Task/Knuth-shuffle/EchoLisp/knuth-shuffle.echolisp b/Task/Knuth-shuffle/EchoLisp/knuth-shuffle.echolisp new file mode 100644 index 0000000000..513d21672a --- /dev/null +++ b/Task/Knuth-shuffle/EchoLisp/knuth-shuffle.echolisp @@ -0,0 +1,29 @@ +Remark- The native '''shuffle''' function implementation in EchoLisp has been replaced by this one. + Thx Rosetta Code. +(lib 'list) ;; for list-permute + +;; use "inside-out" algorithm, no swapping needed. +;; returns a random permutation vector of [0 .. n-1] +(define (rpv n (j)) +(define v (make-vector n)) + (for [(i n)] + (set! j (random (1+ i))) + (when (!= i j) (vector-set! v i [v j])) + (vector-set! v j i)) + v) + +;; apply to any kind of list +(define (k-shuffle list) + (list-permute list (vector->list (rpv (length list))))) + +;; out +(k-shuffle (iota 17)) + → (16 7 11 10 0 9 15 12 13 8 4 2 14 3 6 5 1) + +(k-shuffle +'(adrien 🎸 alexandre 🚂 antoine 🍼 ben 📚 georges 📷 julie 🎥 marine 🐼 nathalie 🍕 )) + → (marine alexandre 🎥 julie 🎸 ben 🍼 nathalie 📚 georges 🚂 antoine adrien 🐼 📷 🍕) + +(shuffle ;; native +'(adrien 🎸 alexandre 🚂 antoine 🍼 ben 📚 georges 📷 julie 🎥 marine 🐼 nathalie 🍕 )) + → (antoine 🎥 🚂 marine adrien nathalie 🍼 🍕 ben 🐼 julie 📷 📚 🎸 alexandre georges) diff --git a/Task/Knuth-shuffle/FreeBASIC/knuth-shuffle.freebasic b/Task/Knuth-shuffle/FreeBASIC/knuth-shuffle.freebasic new file mode 100644 index 0000000000..e8ef42b129 --- /dev/null +++ b/Task/Knuth-shuffle/FreeBASIC/knuth-shuffle.freebasic @@ -0,0 +1,77 @@ +' version 22-10-2016 +' compile with: fbc -s console +' for boundry checks on array's compile with: fbc -s console -exx + +' sort from lower bound to the highter bound +' array's can have subscript range from -2147483648 to +2147483647 + +Sub knuth_down(a() As Long) + + Dim As Long lb = LBound(a) + Dim As ULong n = UBound(a) - lb +1 + Dim As ULong i, j + + Randomize Timer + + For i = n -1 To 1 Step -1 + j =Fix(Rnd * (i +1)) ' 0 <= j <= i + Swap a(lb + i), a(lb + j) + Next + +End Sub + +Sub knuth_up(a() As Long) + + Dim As Long lb = LBound(a) + Dim As ULong n = UBound(a) - lb +1 + Dim As ULong i, j + + Randomize Timer + + For i = 0 To n -2 + j = Fix(Rnd * (n - i) + i) ' 0 <= j < n-i, + i ==> i <= j < n + Swap a(lb + i), a(lb + j) + Next + +End Sub + +' ------=< MAIN >=------ + +Dim As Long i +Dim As Long array(1 To 52), array2(-7 To 7) + +For i = 1 To 52 : array(i) = i : Next + +Print "Starting array" +For i = 1 To 52 + Print Using " ###";array(i); +Next : Print : Print + +knuth_down(array()) + +Print "After Knuth shuffle downwards" +For i = 1 To 52 + Print Using " ###";array(i); +Next : Print : Print + +For i = LBound(array2) To UBound(array2) + array2(i) = i - LBound(array2) + 1 +Next + +Print "Starting array, first index <> 0 " +For i = LBound(array2) To UBound(array2) + Print Using " ##";array2(i); +Next : Print : Print + +knuth_up(array2()) +Print "After Knuth shuffle upwards" +For i = LBound(array2) To UBound(array2) + Print Using " ##";array2(i); +Next : Print : Print + + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Knuth-shuffle/FunL/knuth-shuffle.funl b/Task/Knuth-shuffle/FunL/knuth-shuffle.funl new file mode 100644 index 0000000000..2d5dfb2a74 --- /dev/null +++ b/Task/Knuth-shuffle/FunL/knuth-shuffle.funl @@ -0,0 +1,9 @@ +def shuffle( a ) = + res = array( a ) + n = a.length() + + for i <- 0:n + r = rnd( i:n ) + res(i), res(r) = res(r), res(i) + + res.toList() diff --git a/Task/Knuth-shuffle/Lasso/knuth-shuffle.lasso b/Task/Knuth-shuffle/Lasso/knuth-shuffle.lasso new file mode 100644 index 0000000000..4510b77975 --- /dev/null +++ b/Task/Knuth-shuffle/Lasso/knuth-shuffle.lasso @@ -0,0 +1,20 @@ +define staticarray->swap(p1::integer,p2::integer) => { + fail_if( + #p1 < 1 or #p2 < 1 or + #p1 > .size or #p2 > .size, + 'invalid parameters' + ) + #p1 == #p2 + ? return + + local(tmp) = .get(#p2) + .get(#p2) = .get(#p1) + .get(#p1) = #tmp +} +define staticarray->knuthShuffle => { + loop(-from=.size, -to=2, -by=-1) => { + .swap(math_random(1, loop_count), loop_count) + } +} + +(1 to 10)->asStaticArray->knuthShuffle&asString diff --git a/Task/Knuth-shuffle/Nim/knuth-shuffle.nim b/Task/Knuth-shuffle/Nim/knuth-shuffle.nim new file mode 100644 index 0000000000..3635af108e --- /dev/null +++ b/Task/Knuth-shuffle/Nim/knuth-shuffle.nim @@ -0,0 +1,11 @@ +import math +randomize() + +proc shuffle[T](x: var seq[T]) = + for i in countdown(x.high, 0): + let j = random(i + 1) + swap(x[i], x[j]) + +var x = @[0,1,2,3,4,5,6,7,8,9] +shuffle(x) +echo x diff --git a/Task/Knuth-shuffle/Oforth/knuth-shuffle.oforth b/Task/Knuth-shuffle/Oforth/knuth-shuffle.oforth new file mode 100644 index 0000000000..0ecd1d61b3 --- /dev/null +++ b/Task/Knuth-shuffle/Oforth/knuth-shuffle.oforth @@ -0,0 +1,5 @@ +Indexable method: shuffle +| s i l | + self asListBuffer ->l + self size dup ->s 1- loop: i [ s i - rand i + i l swapValues ] + l dup freeze ; diff --git a/Task/Knuth-shuffle/Phix/knuth-shuffle.phix b/Task/Knuth-shuffle/Phix/knuth-shuffle.phix new file mode 100644 index 0000000000..f35f0b7b8d --- /dev/null +++ b/Task/Knuth-shuffle/Phix/knuth-shuffle.phix @@ -0,0 +1,8 @@ +sequence cards = tagset(52) +puts(1,"Before: ") ?cards +for i=52 to 1 by -1 do + integer r = rand(i) + {cards[r],cards[i]} = {cards[i],cards[r]} +end for +puts(1,"After: ") ?cards +puts(1,"Sorted: ") ?sort(cards) diff --git a/Task/Knuth-shuffle/Ring/knuth-shuffle.ring b/Task/Knuth-shuffle/Ring/knuth-shuffle.ring new file mode 100644 index 0000000000..3e2decffd5 --- /dev/null +++ b/Task/Knuth-shuffle/Ring/knuth-shuffle.ring @@ -0,0 +1,16 @@ +a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +shuffle(a) +for n = 1 to len(a) + see "" + a[n] + " " +next + +func shuffle t + n = len(t) + while n > 1 + k = random(n-1)+1 + temp = t[n] + t[n] = t[k] + t[k] = temp + n = n - 1 + end + return t diff --git a/Task/Knuth-shuffle/Sidef/knuth-shuffle.sidef b/Task/Knuth-shuffle/Sidef/knuth-shuffle.sidef new file mode 100644 index 0000000000..103cbe6c14 --- /dev/null +++ b/Task/Knuth-shuffle/Sidef/knuth-shuffle.sidef @@ -0,0 +1,11 @@ +func shuffle(a) { + + { |n| + var k = (n+1 -> irand); + k == n || (a[k, n] = a[n, k]); + } * a.end; + + return a; +} + +say shuffle(@(1..10)); diff --git a/Task/Knuth-shuffle/Swift/knuth-shuffle-1.swift b/Task/Knuth-shuffle/Swift/knuth-shuffle-1.swift new file mode 100644 index 0000000000..5cbaf2efe2 --- /dev/null +++ b/Task/Knuth-shuffle/Swift/knuth-shuffle-1.swift @@ -0,0 +1,20 @@ +import func Darwin.arc4random_uniform + +extension Array { + + func shuffle() -> Array { + + var result = self; result.shuffleInPlace(); return result + } + + mutating func shuffleInPlace() { + + for i in 1 ..< count { swap(&self[i], &self[Int(arc4random_uniform(UInt32(i+1)))]) } + } + +} + +// Swift 2.0: +print([1, 2, 3, 4, 5, 6, 7, 8, 9, 10].shuffle()) +// Swift 1.x: +//println([1, 2, 3, 4, 5, 6, 7, 8, 9, 10].shuffle()) diff --git a/Task/Knuth-shuffle/Swift/knuth-shuffle-2.swift b/Task/Knuth-shuffle/Swift/knuth-shuffle-2.swift new file mode 100644 index 0000000000..cc33b0cd0f --- /dev/null +++ b/Task/Knuth-shuffle/Swift/knuth-shuffle-2.swift @@ -0,0 +1,31 @@ +import func Darwin.arc4random_uniform + +func shuffleInPlace(inout collection: T) { + + let i0 = collection.startIndex + + for i in i0.successor() ..< collection.endIndex { + + let j = i0.advancedBy(numericCast( + arc4random_uniform(numericCast( + i0.distanceTo() + )+1) + )) + + swap(&collection[i], &collection[j]) + } +} + +func shuffle(collection: T) -> T { + + var result = collection + + shuffleInPlace(&result) + + return result +} + +// Swift 2.0: +print(shuffle([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])) +// Swift 1.x: +//println(shuffle([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])) diff --git a/Task/Knuth-shuffle/Swift/knuth-shuffle-3.swift b/Task/Knuth-shuffle/Swift/knuth-shuffle-3.swift new file mode 100644 index 0000000000..7548fe8c95 --- /dev/null +++ b/Task/Knuth-shuffle/Swift/knuth-shuffle-3.swift @@ -0,0 +1,50 @@ +import func Darwin.arc4random_uniform + +// Define a protocol for shuffling: + +protocol Shufflable { + + @warn_unused_result (mutable_variant="shuffleInPlace") + func shuffle() -> Self + + mutating func shuffleInPlace() + +} + +// Provide a generalized implementation of the shuffling protocol for any mutable collection with random-access index: + +extension Shufflable where Self: MutableCollectionType, Self.Index: RandomAccessIndexType { + + func shuffle() -> Self { + + var result = self + + result.shuffleInPlace() + + return result + } + + mutating func shuffleInPlace() { + + let i0 = startIndex + + for i in i0+1 ..< endIndex { + + let j = i0.advancedBy(numericCast( + arc4random_uniform(numericCast( + i0.distanceTo(i) + )+1) + )) + + swap(&self[i], &self[j]) + } + } + +} + +// Declare Array's conformance to Shufflable: + +extension Array: Shufflable + { /* Implementation provided by Shufflable protocol extension */ } + +print([1, 2, 3, 4, 5, 6, 7, 8, 9, 10].shuffle()) diff --git a/Task/Knuths-algorithm-S/Sidef/knuths-algorithm-s.sidef b/Task/Knuths-algorithm-S/Sidef/knuths-algorithm-s.sidef new file mode 100644 index 0000000000..e197a82aa4 --- /dev/null +++ b/Task/Knuths-algorithm-S/Sidef/knuths-algorithm-s.sidef @@ -0,0 +1,29 @@ +func s_of_n_creator(n) { + var i = 0 + var sample = [] + { |item| + if (++i <= n) { + sample << item; + } + elsif (i.rand < n) { + sample[n.rand] = item; + } + sample; + } +} + +var items = 0..9; +var bin = []; + +100000.times { + var s_of_n = s_of_n_creator(3); + var sample = [] + for item in items { + sample = s_of_n(item); + } + for s in sample { + bin[s] := 0 ++; + } +} + +say bin; diff --git a/Task/Knuths-algorithm-S/Swift/knuths-algorithm-s.swift b/Task/Knuths-algorithm-S/Swift/knuths-algorithm-s.swift new file mode 100644 index 0000000000..3b8248750c --- /dev/null +++ b/Task/Knuths-algorithm-S/Swift/knuths-algorithm-s.swift @@ -0,0 +1,28 @@ +import Darwin + +func s_of_n_creator(n: Int) -> T -> [T] { + var sample = [T]() + var i = 0 + return {(item: T) in + i++ + if (i <= n) { + sample.append(item) + } else if (Int(arc4random_uniform(UInt32(i))) < n) { + sample[Int(arc4random_uniform(UInt32(n)))] = item + } + return sample + } +} + +var bin = [Int](count:10, repeatedValue:0) +for trial in 0..<100000 { + let s_of_n: Int -> [Int] = s_of_n_creator(3) + var sample: [Int] = [] + for i in 0..<10 { + sample = s_of_n(i) + } + for s in sample { + bin[s]++ + } +} +println(bin) diff --git a/Task/LU-decomposition/EchoLisp/lu-decomposition.echolisp b/Task/LU-decomposition/EchoLisp/lu-decomposition.echolisp new file mode 100644 index 0000000000..44cc8c58ee --- /dev/null +++ b/Task/LU-decomposition/EchoLisp/lu-decomposition.echolisp @@ -0,0 +1,38 @@ +(lib 'matrix) ;; the matrix library provides LU-decomposition +(decimals 5) + +(define A (list->array' (1 3 5 2 4 7 1 1 0 ) 3 3)) +(define PLU (matrix-lu-decompose A)) ;; -> list of three matrices, P, Lower, Upper + +(array-print (first PLU)) +0 1 0 +1 0 0 +0 0 1 +(array-print (second PLU)) +1 0 0 +0.5 1 0 +0.5 -1 1 +(array-print (caddr PLU)) +2 4 7 +0 1 1.5 +0 0 -2 + +(define A (list->array '(11 9 24 2 1 5 2 6 3 17 18 1 2 5 7 1 ) 4 4)) +(define PLU (matrix-lu-decompose A)) ;; -> list of three matrices, P, Lower, Upper +(array-print (first PLU)) +1 0 0 0 +0 0 1 0 +0 1 0 0 +0 0 0 1 + +(array-print (second PLU)) +1 0 0 0 +0.27273 1 0 0 +0.09091 0.2875 1 0 +0.18182 0.23125 0.0036 1 + +(array-print (caddr PLU)) +11 9 24 2 +0 14.54545 11.45455 0.45455 +0 0 -3.475 5.6875 +0 0 0 0.51079 diff --git a/Task/LU-decomposition/Idris/lu-decomposition.idris b/Task/LU-decomposition/Idris/lu-decomposition.idris new file mode 100644 index 0000000000..ec77bdc732 --- /dev/null +++ b/Task/LU-decomposition/Idris/lu-decomposition.idris @@ -0,0 +1,155 @@ +module Main + +import Data.Vect + +Matrix : Nat -> Nat -> Type -> Type +Matrix m n t = Vect m (Vect n t) + +-- Creates list from 0 to n (not including n) +upTo : (m : Nat) -> Vect m (Fin m) +upTo Z = [] +upTo (S n) = 0 :: (map FS (upTo n)) + +-- Creates list from 0 to n-1 (not including n-1) +upToM1 : (m : Nat) -> (sz ** Vect sz (Fin m)) +upToM1 m = case (upTo m) of + (y::ys) => (_ ** init(y::ys)) + [] => (_ ** []) + +-- Creates list from i to n (not including n) +fromUpTo : {n : Nat} -> Fin n -> (sz ** Vect sz (Fin n)) +fromUpTo {n} m = filter (>= m) (upTo n) + +-- Creates list from i+1 to n (not including n) +fromUpTo1 : {n : Nat} -> Fin n -> (sz ** Vect sz (Fin n)) +fromUpTo1 {n} m with (fromUpTo m) + | (_ ** xs) = case xs of + (y::ys) => (_ ** ys) + [] => (_ ** []) + + +-- Create Zero Matrix of size m by n +zeros : (m : Nat) -> (n : Nat) -> Matrix m n Double +zeros m n = replicate m (replicate n 0.0) + +replaceAtM : (Fin m, Fin n) -> t -> Matrix m n t -> Matrix m n t +replaceAtM (i, j) e a = replaceAt i (replaceAt j e (index i a)) a + +-- Create Identity Matrix of size m by m +eye : (m : Nat) -> Matrix m m Double +eye m = map create1Vec (upTo m) + where + set1 : Vect m Double -> Fin m -> Vect m Double + set1 a n = replaceAt n 1.0 a + + create1Vec : Fin m -> Vect m Double + create1Vec n = set1 (replicate m 0.0) n + + +indexM : (Fin m, Fin n) -> Matrix m n t -> t +indexM (i, j) a = index j (index i a) + + +-- Obtain index for the row containing the +-- largest absolute value for the given column +colAbsMaxIndex : Fin m -> Fin m -> Matrix m m Double -> Fin m +colAbsMaxIndex startRow col a {m} with (fromUpTo startRow) + | (_ ** xs) = + snd $ foldl (\(absMax, idx), curIdx => + let curAbsVal = abs(indexM (curIdx, col) a) in + if (curAbsVal > absMax) + then (curAbsVal, curIdx) + else (absMax, idx) + ) (0.0, startRow) xs + + +-- Swaps two rows in a given matrix +swapRows : Fin m -> Fin m -> Matrix m n t -> Matrix m n t +swapRows r1 r2 a = replaceAt r2 tempRow $ replaceAt r1 (index r2 a) a + where tempRow = index r1 a + + +-- Swaps two individual values in a matrix +swapValues : (Fin m, Fin m) -> (Fin m, Fin m) -> Matrix m m Double -> Matrix m m Double +swapValues (i1, j1) (i2, j2) m = replaceAtM (i2, j2) v1 $ replaceAtM (i1, j1) v2 m + where + v1 = indexM (i1, j1) m + v2 = indexM (i2, j2) m + +-- Perform row Swap on Lower Triangular Matrix +lSwapRow : Fin m -> Fin m -> Matrix m m Double -> Matrix m m Double +lSwapRow row1 row2 l {m} with (filter (< row1) (upTo m)) + | (_ ** xs) = foldl (\l',col => swapValues (row1, col) (row2, col) l') l xs + + +rowSwap : Fin m -> (Matrix m m Double, Matrix m m Double, Matrix m m Double) -> + (Matrix m m Double, Matrix m m Double, Matrix m m Double) +rowSwap col (l,u,p) = (lSwapRow col row l, swapRows col row u, swapRows col row p) + where row = colAbsMaxIndex col col u + + +calc : (Fin m) -> (Fin m) -> (Matrix m m Double, Matrix m m Double) -> + (Matrix m m Double, Matrix m m Double) +calc i j (l, u) {m} = (l', u') + where + l' : Matrix m m Double + l' = replaceAtM (j, i) ((indexM (j, i) u) / indexM (i, i) u) l + + u'' : (Fin m) -> (Matrix m m Double) -> (Matrix m m Double) + u'' k u = replaceAtM (j, k) ((indexM (j, k) u) - + ((indexM (j, i) l') * (indexM (i, k) u))) u + + u' : (Matrix m m Double) + u' with (fromUpTo i) | (_ ** xs) = foldl (\curU, idx => u'' idx curU) u xs + + +-- Perform a single iteration of the algorithm for the given column +iteration : Fin m -> (Matrix m m Double, Matrix m m Double, Matrix m m Double) -> + (Matrix m m Double, Matrix m m Double, Matrix m m Double) +iteration i lup {m} = iterate' (rowSwap i lup) + + where + modify : (Matrix m m Double, Matrix m m Double) -> + (Matrix m m Double, Matrix m m Double) + modify lu with (fromUpTo1 i) | (_ ** xs) = + foldl (\lu',j => calc i j lu') lu xs + + iterate' : (Matrix m m Double, Matrix m m Double, Matrix m m Double) -> + (Matrix m m Double, Matrix m m Double, Matrix m m Double) + iterate' (l, u, p) with (modify (l, u)) | (l', u') = (l', u', p) + + +-- Generate L, U, P matricies from a given square matrix. +-- Where L * U = A, and P is the permutation matrix +luDecompose : Matrix m m Double -> (Matrix m m Double, Matrix m m Double, Matrix m m Double) +luDecompose a {m} with (upToM1 m) + | (_ ** xs) = foldl (\lup,idx => iteration idx lup) (eye m,a,eye m) xs + + + +ex1 : (Matrix 3 3 Double, Matrix 3 3 Double, Matrix 3 3 Double) +ex1 = luDecompose [[1, 3, 5], [2, 4, 7], [1, 1, 0]] + +ex2 : (Matrix 4 4 Double, Matrix 4 4 Double, Matrix 4 4 Double) +ex2 = luDecompose [[11, 9, 24, 2], [1, 5, 2, 6], [3, 17, 18, 1], [2, 5, 7, 1]] + +printEx : (Matrix n n Double, Matrix n n Double, Matrix n n Double) -> IO () +printEx (l, u, p) = do + putStr "l:" + print l + putStrLn "\n" + + putStr "u:" + print u + putStrLn "\n" + + putStr "p:" + print p + putStrLn "\n" + +main : IO() +main = do + putStrLn "Solution 1:" + printEx ex1 + putStrLn "Solution 2:" + printEx ex2 diff --git a/Task/LU-decomposition/Sidef/lu-decomposition.sidef b/Task/LU-decomposition/Sidef/lu-decomposition.sidef new file mode 100644 index 0000000000..e8f0b08591 --- /dev/null +++ b/Task/LU-decomposition/Sidef/lu-decomposition.sidef @@ -0,0 +1,74 @@ +func is_square(m) { m.all { .len == m.len } } +func matrix_zero(n, m=n) { m.of { n.of(0) } } +func matrix_ident(n) { n.of {|i| [(i-1).of(0)..., 1, (n-i).of(0)...] } } + +func pivotize(m) { + var size = m.len + var id = matrix_ident(size) + for i in ^size { + var max = m[i][i] + var row = i + for j in range(i, size-1) { + if (m[j][i] > max) { + max = m[j][i] + row = j + } + } + if (row != i) { + id.swap(row, i) + } + } + return id +} + +func mmult(a, b) { + var p = [] + for r,c in (^a ~X ^b[0]) { + for i in ^b { + p[r][c] := 0 += (a[r][i] * b[i][c]) + } + } + return p +} + +func lu(a) { + is_square(a) || die "Defined only for square matrices!"; + var n = a.len + var P = pivotize(a) + var Aʼ = mmult(P, a) + var L = matrix_ident(n) + var U = matrix_zero(n) + for i,j in (^n ~X ^n) { + if (j >= i) { + U[i][j] = (Aʼ[i][j] - (^i->map { U[_][j] * L[i][_] }.sum(0))) + } else { + L[i][j] = ((Aʼ[i][j] - (^j->map { U[_][j] * L[i][_] }.sum(0))) / U[j][j]) + } + } + return [P, Aʼ, L, U] +} + +func say_it(message, array) { + say "\n#{message}" + array.each { |row| + say row.map{"%7s" % .as_rat}.join(' ') + } +} + +var t = [[ + %n(1 3 5), + %n(2 4 7), + %n(1 1 0), +],[ + %n(11 9 24 2), + %n( 1 5 2 6), + %n( 3 17 18 1), + %n( 2 5 7 1), +]] + +t.each { |test| + say_it('A Matrix', test); + for a in (['P Matrix', 'Aʼ Matrix', 'L Matrix', 'U Matrix'] ~Z lu(test)) { + say_it(a[0], a[1]) + } +} diff --git a/Task/LU-decomposition/jq/lu-decomposition-1.jq b/Task/LU-decomposition/jq/lu-decomposition-1.jq new file mode 100644 index 0000000000..54046d52f4 --- /dev/null +++ b/Task/LU-decomposition/jq/lu-decomposition-1.jq @@ -0,0 +1,45 @@ +# Create an m x n matrix +def matrix(m; n; init): + if m == 0 then [] + elif m == 1 then [range(0;n)] | map(init) + elif m > 0 then + matrix(1;n;init) as $row + | [range(0;m)] | map( $row ) + else error("matrix\(m);_;_) invalid") + end ; + +def I(n): matrix(n;n;0) as $m + | reduce range(0;n) as $i ($m; . | setpath( [$i,$i]; 1)); + +def dot_product(a; b): + reduce range(0;a|length) as $i (0; . + (a[$i] * b[$i]) ); + +# transpose/0 expects its input to be a rectangular matrix +def transpose: + if (.[0] | length) == 0 then [] + else [map(.[0])] + (map(.[1:]) | transpose) + end ; + +# A and B should both be numeric matrices, A being m by n, and B being n by p. +def multiply(A; B): + (B[0]|length) as $p + | (B|transpose) as $BT + | reduce range(0; A|length) as $i + ([]; + reduce range(0; $p) as $j + (.; + .[$i][$j] = dot_product( A[$i]; $BT[$j] ) )); + +def swap_rows(i;j): + if i == j then . + else .[i] as $i | .[i] = .[j] | .[j] = $i + end ; + +# Print a matrix neatly, each cell occupying n spaces, but without truncation +def neatly(n): + def right: tostring | ( " " * (n-length) + .); + . as $in + | length as $length + | reduce range (0;$length) as $i + (""; . + reduce range(0;$length) as $j + (""; "\(.) \($in[$i][$j] | right )" ) + "\n" ) ; diff --git a/Task/LU-decomposition/jq/lu-decomposition-2.jq b/Task/LU-decomposition/jq/lu-decomposition-2.jq new file mode 100644 index 0000000000..e411c10d06 --- /dev/null +++ b/Task/LU-decomposition/jq/lu-decomposition-2.jq @@ -0,0 +1,42 @@ +# Create the pivot matrix for the input matrix. +# Use "range(0;$n) as $i" to handle ill-conditioned cases. +def pivotize: + def abs: if .<0 then -. else . end; + length as $n + | . as $m + | reduce range(0;$n) as $j + (I($n); + # state: [row; max] + (reduce range(0; $n) as $i + ([$j, $m[$j][$j]|abs ]; + ($m[$i][$j]|abs) as $a + | if $a > .[1] then [ $i, $a ] else . end) | .[0]) as $row + | swap_rows( $j; $row) + ) ; + +# Decompose the input nxn matrix A by PA=LU and return [L, U, P]. +def lup: + def div(i;j): + if j == 0 then if i==0 then 0 else error("\(i)/0") end + else i/j + end; + . as $A + | length as $n + | I($n) as $L # matrix($n; $n; 0.0) as $L + | matrix($n; $n; 0.0) as $U + | ($A|pivotize) as $P + | multiply($P;$A) as $A2 + # state: [L, U] + | reduce range(0; $n) as $i ( [$L, $U]; + reduce range(0; $n) as $j (.; + .[0] as $L + | .[1] as $U + | if ($j >= $i) then + (reduce range(0;$i) as $k (0; . + ($U[$k][$j] * $L[$i][$k] ))) as $s1 + | [$L, ($U| setpath([$i,$j]; ($A2[$i][$j] - $s1))) ] + else + (reduce range(0;$j) as $k (0; . + ($U[$k][$j] * $L[$i][$k]))) as $s2 + | [ ($L | setpath([$i,$j]; div(($A2[$i][$j] - $s2) ; $U[$j][$j] ))), $U ] + end )) + | . + [ $P ] +; diff --git a/Task/LU-decomposition/jq/lu-decomposition-3.jq b/Task/LU-decomposition/jq/lu-decomposition-3.jq new file mode 100644 index 0000000000..776142c7d0 --- /dev/null +++ b/Task/LU-decomposition/jq/lu-decomposition-3.jq @@ -0,0 +1,2 @@ +def a: [[1, 3, 5], [2, 4, 7], [1, 1, 0]]; +a | lup[] | neatly(4) diff --git a/Task/LU-decomposition/jq/lu-decomposition-4.jq b/Task/LU-decomposition/jq/lu-decomposition-4.jq new file mode 100644 index 0000000000..ae6fa7ecc2 --- /dev/null +++ b/Task/LU-decomposition/jq/lu-decomposition-4.jq @@ -0,0 +1,12 @@ + $ /usr/local/bin/jq -M -n -r -f LU.jq + 1 0 0 + 0.5 1 0 + 0.5 -1 1 + + 2 4 7 + 0 1 1.5 + 0 0 -2 + + 0 1 0 + 1 0 0 + 0 0 1 diff --git a/Task/LU-decomposition/jq/lu-decomposition-5.jq b/Task/LU-decomposition/jq/lu-decomposition-5.jq new file mode 100644 index 0000000000..34b862fcd6 --- /dev/null +++ b/Task/LU-decomposition/jq/lu-decomposition-5.jq @@ -0,0 +1,2 @@ +def b: [[11,9,24,2],[1,5,2,6],[3,17,18,1],[2,5,7,1]]; +b | lup[] | neatly(21) diff --git a/Task/LU-decomposition/jq/lu-decomposition-6.jq b/Task/LU-decomposition/jq/lu-decomposition-6.jq new file mode 100644 index 0000000000..8ffd5f91a8 --- /dev/null +++ b/Task/LU-decomposition/jq/lu-decomposition-6.jq @@ -0,0 +1,15 @@ +$ /usr/local/bin/jq -M -n -r -f LU.jq + 1 0 0 0 + 0.2727272727272727 1 0 0 + 0.09090909090909091 0.2875 1 0 + 0.18181818181818182 0.23124999999999996 0.0035971223021580693 1 + + 11 9 24 2 + 0 14.545454545454547 11.454545454545455 0.4545454545454546 + 0 0 -3.4749999999999996 5.6875 + 0 0 0 0.510791366906476 + + 1 0 0 0 + 0 0 1 0 + 0 1 0 0 + 0 0 0 1 diff --git a/Task/LU-decomposition/jq/lu-decomposition-7.jq b/Task/LU-decomposition/jq/lu-decomposition-7.jq new file mode 100644 index 0000000000..20c64a275b --- /dev/null +++ b/Task/LU-decomposition/jq/lu-decomposition-7.jq @@ -0,0 +1,12 @@ +# A|lup|verify(A) should be true +def verify(A): + .[0] as $L | .[1] as $U | .[2] as $P + | multiply($P; A) == multiply($L; $U); + +def A: + [[1, 1, 1, 1], + [1, 1, -1, -1], + [1, -1, 0, 0], + [0, 0, 1, -1]]; + +A|lup|verify(A) diff --git a/Task/LZW-compression/Nim/lzw-compression.nim b/Task/LZW-compression/Nim/lzw-compression.nim new file mode 100644 index 0000000000..98d8613bc9 --- /dev/null +++ b/Task/LZW-compression/Nim/lzw-compression.nim @@ -0,0 +1,63 @@ +import tables + +proc compress*(uncompressed: string): seq[int] = + ## build the dictionary + var dictionary = initTable[string, int]() + for i in 0..255: + dictionary.add($char(i), i) + + var w: string = newString(0) + var compressed = newSeq[int]() + + for c in uncompressed: + var wc = w & c + if(dictionary.hasKey(wc)): + w = wc + else: + # writes w to output + compressed.add(dictionary[w]) + # wc is a new sequence; add it to the dictionary + dictionary.add(wc, dictionary.len) + w = $c + + # write remaining output if necessary + if(w != nil): + compressed.add(dictionary[w]) + + result = compressed + +proc decompress*(compressed: var seq[int]): string = + # build the dictionary + var dictionary = initTable[int, string]() + for i in 0..255: + dictionary.add(i, $char(i)) + + var w: string = dictionary[compressed[0]] + + compressed.delete(0) + + var decompressed = w + + for k in compressed: + var entry: string = newString(0) + if(dictionary.hasKey(k)): + entry = dictionary[k] + elif(k == dictionary.len): + entry = w & w[0] + else: + raise newException(ValueError, "Bad compressed k: " & $k) + + decompressed &= entry + + # new sequence; add it to the dictionary + dictionary.add(dictionary.len, w & entry[0]) + + w = entry + + result = decompressed + +when isMainModule: + var compressed = compress("TOBEORNOTTOBEORTOBEORNOT") + echo compressed + var decompressed = decompress(compressed) + echo decompressed diff --git a/Task/LZW-compression/Sidef/lzw-compression.sidef b/Task/LZW-compression/Sidef/lzw-compression.sidef new file mode 100644 index 0000000000..3034e7a657 --- /dev/null +++ b/Task/LZW-compression/Sidef/lzw-compression.sidef @@ -0,0 +1,72 @@ +# Compress a string to a list of output symbols. +func compress(String uncompressed) -> Array { +  + # Build the dictionary. + var dict_size = 256 + var dictionary = Hash() +  + for i in range(dict_size) { + dictionary{i.chr} = i.chr + } +  + var w = '' + var result = [] + uncompressed.each { |c| + var wc = w+c + if (dictionary.exists(wc)) { + w = wc + } else { + result << dictionary{w} + # Add wc to the dictionary. + dictionary{wc} = dict_size + dict_size++ + w = c + } + } +  + # Output the code for w. + if (w != '') { + result << dictionary{w} + } +  + return result +} +  +# Decompress a list of output ks to a string. +func decompress(Array compressed) -> String { +  + # Build the dictionary. + var dict_size = 256 + var dictionary = Hash() +  + for i in range(dict_size) { + dictionary{i.chr} = i.chr + } +  + var w = compressed.shift + var result = w + compressed.each { |k| + var entry = nil + if (dictionary.exists(k)) { + entry = dictionary{k} + } elsif (k == dict_size) { + entry = w+w.first + } else { + die "Bad compressed k: #{k}" + } + result += entry +  + # Add w+entry[0] to the dictionary. + dictionary{dict_size} = w+entry.first + dict_size++ +  + w = entry + } + return result +} +  +# How to use: +var compressed = compress('TOBEORNOTTOBEORTOBEORNOT') +say compressed.join(' ') +var decompressed = decompress(compressed) +say decompressed diff --git a/Task/LZW-compression/Swift/lzw-compression.swift b/Task/LZW-compression/Swift/lzw-compression.swift new file mode 100644 index 0000000000..2fd88a2dc6 --- /dev/null +++ b/Task/LZW-compression/Swift/lzw-compression.swift @@ -0,0 +1,62 @@ +class LZW { + class func compress(uncompressed:String) -> [Int] { + var dict = [String : Int]() + + for i in 0 ..< 256 { + let s = String(UnicodeScalar(i)) + dict[s] = i + } + + var dictSize = 256 + var w = "" + var result = [Int]() + for c in uncompressed { + let wc = w + String(c) + if dict[wc] != nil { + w = wc + } else { + result.append(dict[w]!) + dict[wc] = dictSize++ + w = String(c) + } + } + + if w != "" { + result.append(dict[w]!) + } + return result + } + + class func decompress(compressed:[Int]) -> String? { + var dict = [Int : String]() + + for i in 0 ..< 256 { + dict[i] = String(UnicodeScalar(i)) + } + + var dictSize = 256 + var w = String(UnicodeScalar(compressed[0])) + var result = w + for k in compressed[1 ..< compressed.count] { + let entry : String + if let x = dict[k] { + entry = x + } else if k == dictSize { + entry = w + String(first(w)!) + } else { + return nil + } + + result += entry + dict[dictSize++] = w + String(first(entry)!) + w = entry + } + return result + } +} + +let comp = LZW.compress("TOBEORNOTTOBEORTOBEORNOT") +println(comp) +if let decomp = LZW.decompress(comp) { + println(decomp) +} diff --git a/Task/LZW-compression/jq/lzw-compression-1.jq b/Task/LZW-compression/jq/lzw-compression-1.jq new file mode 100644 index 0000000000..7772811fb8 --- /dev/null +++ b/Task/LZW-compression/jq/lzw-compression-1.jq @@ -0,0 +1,46 @@ +# LZW compression/decompression for strings +def lzw_compress: + def decode: [.] | implode; + # Build the dictionary: + 256 as $dictSize + | (reduce range(0; $dictSize) as $i ({}; .[ $i | decode ] = $i)) as $dictionary + | reduce explode[] as $i + ( [$dictionary, $dictSize, "", []]; # state: [dictionary, dictSize, w, result] + .[0] as $dictionary + | .[1] as $dictSize + | .[2] as $w + | ($i | decode) as $c + | ($w + $c ) as $wc + | if $dictionary[$wc] then .[2] = $wc + else + .[2] = $c # w = c + | .[3] += [$dictionary[$w]] # result += dictionary[w] + | .[0][$wc] = $dictSize # Add wc to the dictionary + | .[1] += 1 # dictSize ++ + end + ) + # Output the code for w unless w == "": + | if .[2] == "" then .[3] + else .[3] + [.[0][.[2]]] + end +; + +def lzw_decompress: + def decode: [.] | implode; + # Build the dictionary - an array of strings + 256 as $dictSize + | (reduce range(0; $dictSize) as $i ([]; .[ $i ] = ($i|decode))) as $dictionary + | (.[0]|decode) as $w + | reduce .[1:][] as $k + ( [ $dictionary, $dictSize, $w, $w]; # state: [dictionary, dictSize, w, result] + .[0][$k] as $entry + | (if $entry then $entry + elif $k == .[1] then .[2] + .[2][0:1] + else error("lzw_decompress: k=\($k)") + end) as $entry + | .[3] += $entry # result += entry + | .[0][.[1]] = .[2] + $entry[0:1] # dictionary[dictSize] = w + entry.charAt(0); + | .[1] += 1 # dictSize++ + | .[2] = $entry # w = entry + ) | .[3] +; diff --git a/Task/LZW-compression/jq/lzw-compression-2.jq b/Task/LZW-compression/jq/lzw-compression-2.jq new file mode 100644 index 0000000000..28027d9d69 --- /dev/null +++ b/Task/LZW-compression/jq/lzw-compression-2.jq @@ -0,0 +1 @@ +"TOBEORNOTTOBEORTOBEORNOT" | lzw_compress| lzw_decompress diff --git a/Task/Langtons-ant/EchoLisp/langtons-ant.echolisp b/Task/Langtons-ant/EchoLisp/langtons-ant.echolisp new file mode 100644 index 0000000000..27ceaf1a25 --- /dev/null +++ b/Task/Langtons-ant/EchoLisp/langtons-ant.echolisp @@ -0,0 +1,59 @@ +(lib 'plot) +(lib 'types) + +(define (move iter x dir constant: plane turns cmax width xmax (cidx 0)) + (while (> iter 0) + ;; get color index of current square + (set! cidx (vector-ref plane x)) + + ;; turn + (if (vector-ref turns cidx) + (set! dir (if (= dir 3) 0 (1+ dir))) ;; right is #t + (set! dir (if (= dir 0) 3 (1- dir)))) + + ;; rotate colors + (set! cidx (if (= cidx cmax) 0 (1+ cidx))) + (vector-set! plane x cidx) + + ;; move + ;; x = v + h*width for a pixel at (h,v) + (set! x + (cond + ((= dir 0) (1+ x)) + ((= dir 1) (+ x width)) + ((= dir 2) (1- x)) + ((= dir 3) (- x width)))) + + (when (or (< x 0) (>= x xmax)) (set! iter -666)) ;; out of bounds + (set! iter (1- iter))) + iter) + +;; a color table of 16 colors +(define colors + (list 0 (rgb 1 1 1) (rgb 1 0 0) (rgb 0 1 0) (rgb 0 0 1) (rgb 1 1 0) (rgb 1 0 1) (rgb 0 1 1))) +(define colors (list->vector (append colors colors))) + +;; transform color index into rgb color, using colors table. +(define (colorize plane xmax) + (for ((x xmax)) + (vector-set! plane x (vector-ref colors (vector-ref plane x)))) + (vector->pixels plane) + xmax ) + +;; ant's patterns +(define turns #(#t #t #f #f #f #t #f #f #f #t #t #t)) ;; RRLLLRLLLRRR +;;(define turns #(#t #t #f #f #f #t #t #f)) ; RRLLLRRL +;;(define turns #(#t #f)) ; RL : basic ant + +(define (ant (iter 100000)) + (plot-clear) + (define width (first (pixels-dim))) ;; plane dimensions + (define height (rest (pixels-dim))) + (define plane (pixels->uint32-vector)) + (define x (+ (quotient width 2) (* width (quotient height 2)))) ;; middle of plane + (define xmax (* width height)) + + (move iter x 0 plane turns (1- (vector-length turns)) width xmax) + (colorize plane xmax)) + +(ant) ;; run diff --git a/Task/Langtons-ant/Elm/langtons-ant.elm b/Task/Langtons-ant/Elm/langtons-ant.elm new file mode 100644 index 0000000000..f10ad27d03 --- /dev/null +++ b/Task/Langtons-ant/Elm/langtons-ant.elm @@ -0,0 +1,132 @@ +import Maybe as M +import Matrix +import Time exposing (Time, every, second) +import List exposing (..) +import String exposing (join) +import Html exposing (div, h1, text) +import Html.App exposing (program) +import Svg +import Svg.Attributes exposing (version, viewBox, cx, cy, r, x, y, x1, y1, x2, y2, fill,style, width, height, preserveAspectRatio) + +w = 700 +h = 700 +dt = 0.0001 + +type Direction = North | West | South | East + +type alias Model = + { rows : Int + , cols : Int + , boxes : Matrix.Matrix Bool + , location : Matrix.Location + , direction : Direction + } + +initModel : Int -> Int -> Model +initModel cols rows = + { rows = rows + , cols = cols + , boxes = Matrix.matrix rows cols (\location -> False) + , location = (rows//2,cols//2) + , direction = North + } + +view model = + let + borderLineStyle = style "stroke:black;stroke-width:0.3" + + x1Min = x1 <| toString 0 + y1Min = y1 <| toString 0 + x1Max = x1 <| toString model.cols + y1Max = y1 <| toString model.rows + x2Min = x2 <| toString 0 + y2Min = y2 <| toString 0 + x2Max = x2 <| toString model.cols + y2Max = y2 <| toString model.rows + + borders = [ Svg.line [ x1Min, y1Min, x2Max, y2Min, borderLineStyle ] [] + , Svg.line [ x1Max, y1Min, x2Max, y2Max, borderLineStyle ] [] + , Svg.line [ x1Max, y1Max, x2Min, y2Max, borderLineStyle ] [] + , Svg.line [ x1Min, y1Max, x2Min, y2Min, borderLineStyle ] [] + ] + + circleInBox (row,col) color = + Svg.circle [ r "0.25" + , fill (color) + , cx (toString (toFloat col + 0.5)) + , cy (toString (toFloat row + 0.5)) + ] [] + + showUnvisited location box = + if box then [circleInBox location "black" ] + else [] + + unvisited = model.boxes + |> Matrix.mapWithLocation showUnvisited + |> Matrix.flatten + |> concat + + maze = [ Svg.g [] <| borders ++ unvisited ] + + in + div + [] + [ h1 [] [text "Langton's Ant"] + , Svg.svg + [ version "1.1" + , width (toString w) + , height (toString h) + , viewBox (join " " + [ 0 |> toString + , 0 |> toString + , model.cols |> toString + , model.rows |> toString ]) + ] + maze + ] + +updateModel : Model -> Model +updateModel model = + let current = model.location + inBox = snd current >= 0 && snd current < model.cols + && fst current >= 0 && fst current < model.rows + in if not inBox then + model + else + let currentValue = Matrix.get current model.boxes |> M.withDefault False + + dir = case (model.direction, currentValue) of + (North, True) -> East + (East, True) -> South + (South, True) -> West + (West, True) -> North + + (North, False) -> West + (East, False) -> North + (South, False) -> East + (West, False) -> South + + next = case dir of + North -> (fst current+1, snd current) + South -> (fst current-1, snd current) + East -> (fst current, snd current+1) + West -> (fst current, snd current-1) + + boxes = Matrix.set current (not currentValue) model.boxes + + in {model | boxes=boxes, location=next, direction=dir} + +type Msg = Tick Time + +subscriptions model = every (dt * second) Tick + +main = + let + update msg model = (updateModel model, Cmd.none) + init = (initModel 100 100 , Cmd.none) + in program + { init = init + , view = view + , update = update + , subscriptions = subscriptions + } diff --git a/Task/Langtons-ant/FreeBASIC/langtons-ant.freebasic b/Task/Langtons-ant/FreeBASIC/langtons-ant.freebasic new file mode 100644 index 0000000000..d13a0b14ab --- /dev/null +++ b/Task/Langtons-ant/FreeBASIC/langtons-ant.freebasic @@ -0,0 +1,65 @@ +' version 16-10-2016 +' compile with: fbc -s gui + +' a cell size of 4 x 4 pixels is used +' In FreeBASIC the 0,0 is the top left corner + +ScreenRes 400,400,8 ' give a 100 by 100 field +Dim As UByte Ptr p = ScreenPtr +If p = 0 Then End ' p does not point to screen + +Palette 0, 0, 0, 0 ' index 0 = black +Palette 255, 255, 255, 255 ' index 225 = white + +Line (0, 0) - (799, 799), 255, bf ' draw box and fill it with white color + +Dim As Integer count, offset, x = 199, y = 199 +Dim As UByte col ' = color +' direction, 0 = up, 1 = right, 2 = down, 3 = left +Dim As UByte d ' d = 0, looking up + +Do + offset = x + y * 400 + col = p[offset] + + If col = 0 Then + d = (d -1) And 3 + Else + d = (d +1) And 3 + EndIf + + col = col Xor 255 ' flip the color + + ScreenLock ' don't update screen while we are drawing + + ' draw a 4*4 block and paint it with palette color [0 | 255] + Line (x, y) - (x +3, y -3), col, bf + + ScreenUnLock ' allow screen update's + + 'Sleep 100 ' slow the program down if needed + + ' true = 0, false = -1 + If (d And 1) = 1 Then + x = x + (d = 1) * 4 - (d = 3) * 4 + Else + y = y - (d = 0) * 4 + (d = 2) * 4 + End If + + count += 1 + ' update step count window title bar + WindowTitle "Langton's ant step: " + Str(count) + + ' has user clicked on close window "X" then end program + If InKey = Chr(255) + "k" Then End + +Loop Until x < 1 Or x > 398 Or y < 1 Or y > 398 + +' display total count in window title bar +WindowTitle "Langton's ant has left the field in " + Str(count) + " steps" + +' empty keyboard buffer +While InKey <> "" : Wend +'Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Langtons-ant/GFA-Basic/langtons-ant.gfa b/Task/Langtons-ant/GFA-Basic/langtons-ant.gfa new file mode 100644 index 0000000000..ff6194a30f --- /dev/null +++ b/Task/Langtons-ant/GFA-Basic/langtons-ant.gfa @@ -0,0 +1,93 @@ +' +' Langton's ant +' +' World is a global boolean array, 100x100 in size +width%=100 +height%=100 +DIM world!(width%,height%) +ARRAYFILL world!(),FALSE +' Time in world +time%=0 +' Ant is represented by a global three-element array +' holding: x, y, direction [0=north,1=west,2=south,3=east] +DIM ant%(3) +' +@setup_ant +@run_ant +@display_world +' +' Displays the world to file "langton.out": . for false, # for true +' +PROCEDURE display_world + LOCAL i%,j% + OPEN "o",#1,"langton.out" + PRINT #1,"Time in world: ";time%;" ticks" + FOR i%=0 TO width%-1 + FOR j%=0 TO height%-1 + IF world!(i%,j%) + PRINT #1,"#"; + ELSE + PRINT #1,"."; + ENDIF + NEXT j% + PRINT #1,"" + NEXT i% + CLOSE #1 +RETURN +' +' Set up the ant to start at (50,50) facing north +' +PROCEDURE setup_ant + ant%(0)=50 + ant%(1)=50 + ant%(2)=0 +RETURN +' +' check if ant position is within world's bounds +' +FUNCTION ant_in_world + RETURN ant%(0)>=0 AND ant%(0)=0 AND ant%(1)=1 and aX<=100 + and aY>=1 and aY<=100 do + gXY = grid[aX][aY] + grid[aX][aY] = 67-gXY -- ' '<=>'#', aka 32<->35 + angle = mod(angle+2*gXY+3,4) -- +/-1, ie 0,1,2,3 -> 1,2,3,0 or 3,0,1,2 + aX += dX[angle+1] + aY += dX[4-angle] +end while + +puts(1,join(grid,"\n")) diff --git a/Task/Langtons-ant/Ring/langtons-ant.ring b/Task/Langtons-ant/Ring/langtons-ant.ring new file mode 100644 index 0000000000..a983a4ce9f --- /dev/null +++ b/Task/Langtons-ant/Ring/langtons-ant.ring @@ -0,0 +1,55 @@ +load "guilib.ring" +load "stdlib.ring" + +new qapp + { + win1 = new qwidget() { + setwindowtitle("drawing using qpainter") + setgeometry(100,100,500,500) + label1 = new qlabel(win1) { + setgeometry(10,10,400,400) + settext("") + } + new qpushbutton(win1) { + setgeometry(200,400,100,30) + settext("draw") + setclickevent("draw()") + } + show() + } + exec() + } + +func draw + p1 = new qpicture() + color = new qcolor() { + setrgb(0,0,255,255) + } + pen = new qpen() { + setcolor(color) + setwidth(1) + } + new qpainter() { + begin(p1) + setpen(pen) + + fieldsize=100 + field = newlist(fieldsize,fieldsize) + x=fieldsize/2 + y=fieldsize/2 + d=0 + while x<=fieldsize and x>=0 and y<=fieldsize and y>=0 + if field[x][y]=0 field[x][y]=1 d-=1 else field[x][y]=0 d+=1 ok + drawpoint(x*2, y*2) + d=(d+4) % 4 + switch d + on 0 y+=1 + on 1 x+=1 + on 2 y-=1 + on 3 x-=1 + off + end + + endpaint() + } + label1 { setpicture(p1) show() } diff --git a/Task/Langtons-ant/Sidef/langtons-ant.sidef b/Task/Langtons-ant/Sidef/langtons-ant.sidef new file mode 100644 index 0000000000..c5100aa550 --- /dev/null +++ b/Task/Langtons-ant/Sidef/langtons-ant.sidef @@ -0,0 +1,24 @@ +define dirs = [[1,0], [0,-1], [-1,0], [0,1]] +define size = 100 + +enum |White, Black| +var plane = size.of { size.of (White) } + +var (x, y) = @|([size/2 -> int]*2) +var dir = dirs.len.irand + +var moves = 0 +loop { + (x >= 0) && (y >= 0) && (x < size) && (y < size) || break + + given(plane[x][y]) { + when (White) { dir--; plane[x][y] = Black } + when (Black) { dir++; plane[x][y] = White } + } + + ++moves + [\x, \y]:dirs[dir %= dirs.len] -> each {|a,b| *a += b } +} + +say "Out of bounds after #{moves} moves at (#{x}, #{y})" +plane.map{.map {|square| square == Black ? '#' : '.' }}.each{.join.say} diff --git a/Task/Langtons-ant/Swift/langtons-ant.swift b/Task/Langtons-ant/Swift/langtons-ant.swift new file mode 100644 index 0000000000..e494be2ccc --- /dev/null +++ b/Task/Langtons-ant/Swift/langtons-ant.swift @@ -0,0 +1,73 @@ +import Foundation + +let WIDTH = 100 +let HEIGHT = 100 + +struct Point { + var x:Int + var y:Int +} + +enum Direction: Int { + case North = 0, East, West, South +} + +class Langton { + let leftTurn = [Direction.West, Direction.North, Direction.South, Direction.East] + let rightTurn = [Direction.East, Direction.South, Direction.North, Direction.West] + let xInc = [0, 1,-1, 0] + let yInc = [-1, 0, 0, 1] + var isBlack:[[Bool]] + var origin:Point + var antPosition = Point(x:0, y:0) + var outOfBounds = false + var antDirection = Direction.East + + init(width:Int, height:Int) { + self.origin = Point(x:width / 2, y:height / 2) + self.isBlack = Array(count: width, repeatedValue: Array(count: height, repeatedValue: false)) + } + + func moveAnt() { + self.antPosition.x += xInc[self.antDirection.rawValue] + self.antPosition.y += yInc[self.antDirection.rawValue] + } + + func step() -> Point { + if self.outOfBounds { + println("Ant tried to move while out of bounds.") + exit(0) + } + + var ptCur = Point(x:self.antPosition.x + self.origin.x, y:self.antPosition.y + self.origin.y) + let black = self.isBlack[ptCur.x][ptCur.y] + let direction = self.antDirection.rawValue + + self.antDirection = (black ? self.leftTurn : self.rightTurn)[direction] + + self.isBlack[ptCur.x][ptCur.y] = !self.isBlack[ptCur.x][ptCur.y] + + self.moveAnt() + ptCur = Point(x:self.antPosition.x + self.origin.x, y:self.antPosition.y + self.origin.y) + self.outOfBounds = + ptCur.x < 0 || + ptCur.x >= self.isBlack.count || + ptCur.y < 0 || + ptCur.y >= self.isBlack[0].count + + return self.antPosition + } +} + + +let ant = Langton(width: WIDTH, height: HEIGHT) +while !ant.outOfBounds { + ant.step() +} + +for row in 0 ..< WIDTH { + for col in 0 ..< HEIGHT { + print(ant.isBlack[col][row] ? "#" : " ") + } + println() +} diff --git a/Task/Langtons-ant/jq/langtons-ant.jq b/Task/Langtons-ant/jq/langtons-ant.jq new file mode 100644 index 0000000000..7faee1d468 --- /dev/null +++ b/Task/Langtons-ant/jq/langtons-ant.jq @@ -0,0 +1,58 @@ +def matrix(m; n; init): + if m == 0 then [range(0;n)] | map(init) + elif m > 0 then [range(0;m)][ range(0;m) ] = matrix(0;n;init) + else error("matrix\(m);_;_) invalid") + end; + +def printout: + . as $grid + | ($grid|length) as $height + | ($grid[0]|length) as $width + | reduce range(0;$height) as $i ("\u001BH"; + . + reduce range(0;$width) as $j ("\n"; + . + if $grid[$i][$j] then " " else "#" end ) ); + + +def langtons_ant(grid_size): + + def flip(ant): + # Flip the color of the current square + .[ant[0]][ant[1]] = (.[ant[0]][ant[1]] | not) + ; + + # input/output: the ant's state: [x, y, direction] + # where direction is one of (0,1,2,3) + def move(grid): + # If the cell is black, it changes to white and the ant turns left; + # If the cell is white, it changes to black and the ant turns right; + (if grid[.[0]][.[1]] then 1 else 3 end) as $turn + | .[2] = ((.[2] + $turn) % 4) + | if .[2] == 0 then .[0] += 1 + elif .[2] == 1 then .[1] += 1 + elif .[2] == 2 then .[0] += -1 + else .[1] += -1 + end + ; + + # state: [ant, grid] + def iterate: + .[0] as $ant | .[1] as $grid + # exit if the ant is outside the grid + | if $ant[0] < 1 or $ant[0] > grid_size + or $ant[1] < 1 or $ant[1] > grid_size + then [ $ant, $grid ] + else + ($grid | flip($ant)) as $grid + | ($ant | move($grid)) as $ant + | [$ant, $grid] | iterate + end + ; + + ((grid_size/2) | floor | [ ., ., 0]) as $ant + | matrix(grid_size; grid_size; true) as $grid + | [$ant, $grid] | iterate + | .[1] + | printout +; + +langtons_ant(100) diff --git a/Task/Largest-int-from-concatenated-ints/Ceylon/largest-int-from-concatenated-ints.ceylon b/Task/Largest-int-from-concatenated-ints/Ceylon/largest-int-from-concatenated-ints.ceylon new file mode 100644 index 0000000000..45afd7d4f4 --- /dev/null +++ b/Task/Largest-int-from-concatenated-ints/Ceylon/largest-int-from-concatenated-ints.ceylon @@ -0,0 +1,15 @@ +shared void run2() { + + function intConcatenationComparer(Integer x, Integer y) { + assert(exists xy = parseInteger(x.string + y.string), + exists yx = parseInteger(y.string + x.string)); + return yx <=> xy; + } + + function biggestConcatenation(Integer* ints) => "".join(ints.sort(intConcatenationComparer)); + + value test1 = {1, 34, 3, 98, 9, 76, 45, 4}; + value test2 = {54, 546, 548, 60}; + + print("``biggestConcatenation(*test1)`` and ``biggestConcatenation(*test2)``"); +} diff --git a/Task/Largest-int-from-concatenated-ints/Nim/largest-int-from-concatenated-ints.nim b/Task/Largest-int-from-concatenated-ints/Nim/largest-int-from-concatenated-ints.nim new file mode 100644 index 0000000000..e0964772a1 --- /dev/null +++ b/Task/Largest-int-from-concatenated-ints/Nim/largest-int-from-concatenated-ints.nim @@ -0,0 +1,9 @@ +import algorithm, sequtils, strutils, future + +proc maxNum(x: seq[int]): string = + var c = x.mapIt(string, $it) + c.sort((x, y) => cmp(y&x, x&y)) + c.join() + +echo maxNum(@[1, 34, 3, 98, 9, 76, 45, 4]) +echo maxNum(@[54, 546, 548, 60]) diff --git a/Task/Largest-int-from-concatenated-ints/Oforth/largest-int-from-concatenated-ints.oforth b/Task/Largest-int-from-concatenated-ints/Oforth/largest-int-from-concatenated-ints.oforth new file mode 100644 index 0000000000..b7e85d1e48 --- /dev/null +++ b/Task/Largest-int-from-concatenated-ints/Oforth/largest-int-from-concatenated-ints.oforth @@ -0,0 +1 @@ +: largestInt map(#asString) sortWith(#[ 2dup + -rot swap + > ]) sum asInteger ; diff --git a/Task/Largest-int-from-concatenated-ints/Phix/largest-int-from-concatenated-ints.phix b/Task/Largest-int-from-concatenated-ints/Phix/largest-int-from-concatenated-ints.phix new file mode 100644 index 0000000000..ad0b75df2b --- /dev/null +++ b/Task/Largest-int-from-concatenated-ints/Phix/largest-int-from-concatenated-ints.phix @@ -0,0 +1,14 @@ +function catcmp(string a, string b) + return compare(b&a,a&b) +end function + +function method2(sequence s) + for i=1 to length(s) do + s[i] = sprintf("%d",s[i]) + end for + s = custom_sort(routine_id("catcmp"),s) + return join(s,"") +end function + +? method2({1,34,3,98,9,76,45,4}) +? method2({54,546,548,60}) diff --git a/Task/Largest-int-from-concatenated-ints/Ring/largest-int-from-concatenated-ints.ring b/Task/Largest-int-from-concatenated-ints/Ring/largest-int-from-concatenated-ints.ring new file mode 100644 index 0000000000..780fe7ae7e --- /dev/null +++ b/Task/Largest-int-from-concatenated-ints/Ring/largest-int-from-concatenated-ints.ring @@ -0,0 +1,24 @@ +nums=[1,34,3,98,9,76,45,4] +see largestInt(8) + nl +nums=[54,546,548,60] +see largestInt(4) + nl + +func largestInt len +l = "" +sorted = false +while not sorted + sorted=true + for i=1 to len-1 + a=string(nums[i]) + b=string(nums[i+1]) + if a+b "#{x}#{y}" }; +} + +[[54, 546, 548, 60], [1, 34, 3, 98, 9, 76, 45, 4]].each { |c| + say maxnum(c).join.to_num; +} diff --git a/Task/Largest-int-from-concatenated-ints/jq/largest-int-from-concatenated-ints-1.jq b/Task/Largest-int-from-concatenated-ints/jq/largest-int-from-concatenated-ints-1.jq new file mode 100644 index 0000000000..e3dc52c31a --- /dev/null +++ b/Task/Largest-int-from-concatenated-ints/jq/largest-int-from-concatenated-ints-1.jq @@ -0,0 +1,13 @@ +def largest_int: + + def pad(n): . + (n - length) * .[length-1:]; + + map(tostring) + | (map(length) | max) as $max + | map([., pad($max)]) + | sort_by( .[1] ) + | map( .[0] ) | reverse | join("") ; + +# Examples: +([1, 34, 3, 98, 9, 76, 45, 4], + [54, 546, 548, 60]) | largest_int diff --git a/Task/Largest-int-from-concatenated-ints/jq/largest-int-from-concatenated-ints-2.jq b/Task/Largest-int-from-concatenated-ints/jq/largest-int-from-concatenated-ints-2.jq new file mode 100644 index 0000000000..73d58afe88 --- /dev/null +++ b/Task/Largest-int-from-concatenated-ints/jq/largest-int-from-concatenated-ints-2.jq @@ -0,0 +1,4 @@ +def largest_int: + map(tostring) + | quicksort( .[0] + .[1] < .[1] + .[0] ) + | reverse | join("") ; diff --git a/Task/Last-Friday-of-each-month/Elm/last-friday-of-each-month.elm b/Task/Last-Friday-of-each-month/Elm/last-friday-of-each-month.elm new file mode 100644 index 0000000000..3b8f9b3763 --- /dev/null +++ b/Task/Last-Friday-of-each-month/Elm/last-friday-of-each-month.elm @@ -0,0 +1,67 @@ +import Html exposing (Html, Attribute, text, div, input) +import Html.App exposing (beginnerProgram) +import Html.Attributes exposing (placeholder, value, style) +import Html.Events exposing (onInput) +import String exposing (toInt) +import Maybe exposing (withDefault) +import List exposing (map, map2) +import List.Extra exposing (scanl1) + +type Msg = SetYear String + +lastFridays : Int -> List Int +lastFridays year = + let isLeap = (year % 400) == 0 || ( (year % 4) == 0 && (year % 100) /= 0 ) + daysInMonth = [31, if isLeap then 29 else 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] + y = year-1 + in scanl1 (+) daysInMonth + |> map2 (\len day -> len - (day + 2 + y + y//4 - y//100 + y//400) % 7) daysInMonth + +lastFridayStrings : String -> List String +lastFridayStrings yearString = + let months= ["January ", "February ", "March ", "April ", "May ", "June ", "July ", "August ", "September ", "October ", "November ", "December "] + errString = "Only years after 1752 are valid." + in case toInt yearString of + Ok year -> + if (year < 1753) + then [errString] + else lastFridays year + |> map2 (\m d -> m ++ toString d ++ ", " ++ toString year) months + Err _ -> + [errString] + +view : String -> Html Msg +view yearString = + div [] + ([ input + [ placeholder "Enter a year." + , value yearString + , onInput SetYear + , myStyle + ] + [] + ] ++ (lastFridayStrings yearString + |> map (\date -> div [ myStyle ] [ text date ]) )) + +myStyle : Attribute Msg +myStyle = + style + [ ("width", "100%") + , ("height", "20px") + , ("padding", "5px 0 0 5px") + , ("font-size", "1em") + , ("text-align", "left") + ] + +update : Msg -> String -> String +update msg _ = + case msg of + SetYear yearString -> yearString + + +main = + beginnerProgram + { model = "" + , view = view + , update = update + } diff --git a/Task/Last-Friday-of-each-month/FreeBASIC/last-friday-of-each-month.freebasic b/Task/Last-Friday-of-each-month/FreeBASIC/last-friday-of-each-month.freebasic new file mode 100644 index 0000000000..271fc197d7 --- /dev/null +++ b/Task/Last-Friday-of-each-month/FreeBASIC/last-friday-of-each-month.freebasic @@ -0,0 +1,85 @@ +' version 23-06-2015 +' compile with: fbc -s console + +#Ifndef TRUE ' define true and false for older freebasic versions + #Define FALSE 0 + #Define TRUE Not FALSE +#EndIf + +Function leapyear(Year_ As Integer) As Integer + ' from the leapyear entry + If (Year_ Mod 4) <> 0 Then Return FALSE + If (Year_ Mod 100) = 0 AndAlso (Year_ Mod 400) <> 0 Then Return FALSE + Return TRUE + +End Function + +Function wd(m As Integer, d As Integer, y As Integer) As Integer + ' Zellerish + ' 0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday + ' 4 = Thursday, 5 = Friday, 6 = Saturday + + If m < 3 Then ' If m = 1 Or m = 2 Then + m += 12 + y -= 1 + End If + Return (y + (y \ 4) - (y \ 100) + (y \ 400) + d + ((153 * m + 8) \ 5)) Mod 7 +End Function + +' ------=< MAIN >=------ + +Type month_days + m_name As String + days As UByte +End Type + +Dim As month_days arr(1 To 12) +Data "January", 31, "February", 28, "March", 31, "April", 30 +Data "May", 31, "June", 30, "July", 31, "August", 31 +Data "September", 30, "October", 31, "November", 30, "December", 31 + +Dim As Integer yr, d, i, x +Dim As String keypress + +For i = 1 To 12 + With arr(i) + Read .m_name + Read .days + End With +Next + +Do + + Do + Print "For what year do you want to find the last Friday of the month" + Input "any number below 1800 stops program, year in YYYY format";yr + ' empty input also stops + If yr < 1800 Then + End + Else + Exit Do + End If + Loop + + Print : Print + Print "Last Friday of the month for"; yr + + For i = 1 To 12 + d = arr(i).days + If i = 2 AndAlso leapyear(yr) = TRUE Then d = d + 1 + x = wd(i, d, yr) + If x <> 5 Then d = d - IIf(x > 5, x - 5, x + 2) + Print d; " "; arr(i).m_name + Next + + ' empty key buffer + While InKey <> "" : keypress = InKey : Wend + Print : Print + Print "Find last Friday for a other year [Y|y], anything else stops" + keypress ="" + While keypress = "" : keypress = InKey : Wend + If LCase(keypress) <> "y" Then Exit Do + Print : Print + +Loop +End diff --git a/Task/Last-Friday-of-each-month/Lasso/last-friday-of-each-month.lasso b/Task/Last-Friday-of-each-month/Lasso/last-friday-of-each-month.lasso new file mode 100644 index 0000000000..6ade12eb36 --- /dev/null +++ b/Task/Last-Friday-of-each-month/Lasso/last-friday-of-each-month.lasso @@ -0,0 +1,24 @@ +define isLeapYear(y::integer) => { + #y % 400 == 0 ? return true + #y % 100 == 0 ? return false + #y % 4 == 0 ? return true + return false +} +define fridays(y::integer) => { + local(out = array) + loop(12) => { + local(last = 28) + loop_count == 2 && isLeapYear(#y) ? #last = 29 + array(4,6,9,11) >> loop_count ? #last == 30 + #last == 28 && loop_count != 2 ? #last = 31 + local(start = date(-year=#y,-month=loop_count,-day=#last)) + while(#start->dayofweek != 6) => { + #start->subtract(-day=1) + } + #out->insert(#start) + } + return #out +} +with f in fridays(2012) do => {^ + #f->format('%Q') + '\r' +^} diff --git a/Task/Last-Friday-of-each-month/LiveCode/last-friday-of-each-month-1.livecode b/Task/Last-Friday-of-each-month/LiveCode/last-friday-of-each-month-1.livecode new file mode 100644 index 0000000000..3d1167c20f --- /dev/null +++ b/Task/Last-Friday-of-each-month/LiveCode/last-friday-of-each-month-1.livecode @@ -0,0 +1,23 @@ +function lastFriday yyyy + -- year,month num,day of month,hour in 24-hour time,minute,second,numeric day of week. + convert the long date to dateitems + put 1 into item 2 of it + put 1 into item 3 of it + put yyyy into item 1 of it + put it into startDate + convert startDate to dateItems + repeat with m = 1 to 12 + put m into item 2 of startDate + repeat with d = 20 to 31 + put d into item 3 of startDate + convert startDate to dateItems + -- 6 is friday + if item 7 of startDate is 6 and item 1 of startDate is yyyy and item 2 of startDate is m then + put item 3 of startDate into fridays[item 2 of startDate] + end if + end repeat + end repeat + combine fridays using cr and space + sort fridays ascending numeric + return fridays +end lastFriday diff --git a/Task/Last-Friday-of-each-month/LiveCode/last-friday-of-each-month-2.livecode b/Task/Last-Friday-of-each-month/LiveCode/last-friday-of-each-month-2.livecode new file mode 100644 index 0000000000..280f7c10f4 --- /dev/null +++ b/Task/Last-Friday-of-each-month/LiveCode/last-friday-of-each-month-2.livecode @@ -0,0 +1 @@ +put lastFriday("2012") diff --git a/Task/Last-Friday-of-each-month/LiveCode/last-friday-of-each-month-3.livecode b/Task/Last-Friday-of-each-month/LiveCode/last-friday-of-each-month-3.livecode new file mode 100644 index 0000000000..556dfffe28 --- /dev/null +++ b/Task/Last-Friday-of-each-month/LiveCode/last-friday-of-each-month-3.livecode @@ -0,0 +1,12 @@ +1 27 +2 24 +3 30 +4 27 +5 25 +6 29 +7 27 +8 31 +9 28 +10 26 +11 30 +12 28 diff --git a/Task/Last-Friday-of-each-month/Nim/last-friday-of-each-month.nim b/Task/Last-Friday-of-each-month/Nim/last-friday-of-each-month.nim new file mode 100644 index 0000000000..a95e1f2095 --- /dev/null +++ b/Task/Last-Friday-of-each-month/Nim/last-friday-of-each-month.nim @@ -0,0 +1,12 @@ +import times, os, strutils + +var timeinfo = getLocalTime getTime() +timeinfo.year = paramStr(1).parseInt +for month in mJan .. mDec: + timeinfo.month = month + for day in countdown(31, 1): + timeinfo.monthday = day + let t = getLocalTime(timeInfoToTime timeinfo) + if t.month == month and t.weekday == dFri: + echo t.format "yyyy-MM-dd" + break diff --git a/Task/Last-Friday-of-each-month/Oforth/last-friday-of-each-month.oforth b/Task/Last-Friday-of-each-month/Oforth/last-friday-of-each-month.oforth new file mode 100644 index 0000000000..6083b4e3b2 --- /dev/null +++ b/Task/Last-Friday-of-each-month/Oforth/last-friday-of-each-month.oforth @@ -0,0 +1,9 @@ +import: date + +: lastFridays(y) +| m | + Date.JANUARY Date.DECEMBER for: m [ + Date newDate(y, m, Date.DaysInMonth(y, m)) + while(dup dayOfWeek Date.FRIDAY <>) [ addDays(-1) ] + println + ] ; diff --git a/Task/Last-Friday-of-each-month/Phix/last-friday-of-each-month.phix b/Task/Last-Friday-of-each-month/Phix/last-friday-of-each-month.phix new file mode 100644 index 0000000000..a02152aa08 --- /dev/null +++ b/Task/Last-Friday-of-each-month/Phix/last-friday-of-each-month.phix @@ -0,0 +1,24 @@ +include timedate.e + +constant FRIDAY=6 + +procedure showlast(integer dow, integer doy, timedate td) + td = adjust_timedate(td,timedelta(days:=doy-1)) + integer {year,month,day} = td + while day_of_week(year,month,day)!=dow do day-=1 end while + printf(1,"%4d-%02d-%02d\n",{year,month,day}) +end procedure + +procedure last_day_of_month(integer year, integer dow) +integer doy +timedate first = {year,1,1,0,0,0,0,0} + -- start by finding the 1st of the next month, less 1 + for i=1 to 11 do + doy = day_of_year(year,i+1,1)-1 + showlast(dow,doy,first) + end for + -- do December separately, as 1st would be next year + doy = day_of_year(year,12,31) + showlast(dow,doy,first) +end procedure +last_day_of_month(2012,FRIDAY) diff --git a/Task/Last-Friday-of-each-month/Ring/last-friday-of-each-month.ring b/Task/Last-Friday-of-each-month/Ring/last-friday-of-each-month.ring new file mode 100644 index 0000000000..0622f595d9 --- /dev/null +++ b/Task/Last-Friday-of-each-month/Ring/last-friday-of-each-month.ring @@ -0,0 +1,20 @@ +see "What year to calculate (yyyy) : " +give year +see "Last Friday in " + year + " are on :" + nl +month = list(12) +mo = [4,0,0,3,5,1,3,6,2,4,0,2] +mon = [31,28,31,30,31,30,31,31,30,31,30,31] +if year < 2100 leap = year - 1900 else leap = year - 1904 ok +m = ((year-1900)%7) + floor(leap/4) % 7 +for n = 1 to 12 + month[n] = (mo[n] + m) % 7 +next +for n = 1 to 12 + for i = (mon[n] - 6) to mon[n] + if year%4 = 0 and n<3 + x = (month[n] + i) % 7 - 1 + else x = (month[n] + i) % 7 ok + if n < 10 strn = "0" + string(n) else strn = string(n) ok + if x = 2 see year + "-" + strn + "-" + string(i) + nl ok + next +next diff --git a/Task/Last-Friday-of-each-month/Sidef/last-friday-of-each-month.sidef b/Task/Last-Friday-of-each-month/Sidef/last-friday-of-each-month.sidef new file mode 100644 index 0000000000..43a4937190 --- /dev/null +++ b/Task/Last-Friday-of-each-month/Sidef/last-friday-of-each-month.sidef @@ -0,0 +1,10 @@ +require('DateTime'); +var (year=2015) = ARGV»to_i»()...; + +range(1, 12).each { |month| + var dt = %s'DateTime'.last_day_of_month(year => year, month => month); + while (dt.day_of_week != 5) { + dt.subtract(days => 1); + }; + say dt.ymd; +} diff --git a/Task/Last-Friday-of-each-month/Visual-FoxPro/last-friday-of-each-month.visual b/Task/Last-Friday-of-each-month/Visual-FoxPro/last-friday-of-each-month.visual new file mode 100644 index 0000000000..4e07c2fa9f --- /dev/null +++ b/Task/Last-Friday-of-each-month/Visual-FoxPro/last-friday-of-each-month.visual @@ -0,0 +1,34 @@ +*!* OOP implementaion +LOCAL lnYear As Integer, oCalc As fricalc +CLEAR +lnYear = VAL(INPUTBOX("Year", "Year")) +oCalc = NEWOBJECT("fricalc") +oCalc.LastFriday(lnYear) + +DEFINE CLASS fricalc As Session +DataSession = 2 && Private + +PROCEDURE Init +*!* These date settings are private to this class +SET DATE YMD +SET CENTURY ON +SET MARK TO "-" +ENDPROC + +FUNCTION LastFriday(tnYear As Integer) As VOID +LOCAL i As Integer, ldDate As Date +CLEAR +? "Last Fridays in the year " + TRANSFORM(tnYear) +FOR i = 1 TO 12 + ldDate = DATE(tnYear, i, 1) && 1st of month + ldDate = GOMONTH(ldDate, 1) - 1 && last day of month + *!* Use the built in function to return the day of the week + *!* 6 is Friday + DO WHILE DOW(ldDate) # 6 + ldDate = ldDate - 1 + ENDDO + ? ldDate +ENDFOR +ENDFUNC + +ENDDEFINE diff --git a/Task/Last-Friday-of-each-month/jq/last-friday-of-each-month-1.jq b/Task/Last-Friday-of-each-month/jq/last-friday-of-each-month-1.jq new file mode 100644 index 0000000000..707a4f19bd --- /dev/null +++ b/Task/Last-Friday-of-each-month/jq/last-friday-of-each-month-1.jq @@ -0,0 +1,27 @@ +# In case your jq does not have "until" defined: + +def until(cond; next): + def _until: + if cond then . else (next|_until) end; + _until; + +# Zeller's Congruence is from [[Day_of_the_week#jq]] + +# Use Zeller's Congruence to determine the day of the week, given +# year, month and day as integers in the conventional way. +# If iso == "iso" or "ISO", then emit an integer in 1 -- 7 where +# 1 represents Monday, 2 Tuesday, etc; +# otherwise emit 0 for Saturday, 1 for Sunday, etc. +# +def day_of_week(year; month; day; iso): + if month == 1 or month == 2 then + [year - 1, month + 12, day] + else + [year, month, day] + end + | .[2] + (13*(.[1] + 1)/5|floor) + + (.[0]%100) + ((.[0]%100)/4|floor) + + (.[0]/400|floor) - 2*(.[0]/100|floor) + | if iso == "iso" or iso == "ISO" then 1 + ((. + 5) % 7) + else . % 7 + end ; diff --git a/Task/Last-Friday-of-each-month/jq/last-friday-of-each-month-2.jq b/Task/Last-Friday-of-each-month/jq/last-friday-of-each-month-2.jq new file mode 100644 index 0000000000..2f3d8a2d3b --- /dev/null +++ b/Task/Last-Friday-of-each-month/jq/last-friday-of-each-month-2.jq @@ -0,0 +1,22 @@ +# year and month are numbered conventionally +def findLastFriday(year; month): + def isLeapYear: + year%4 == 0 and ( year%100!=0 or year%400==0 ) ; + def days: + if month == 2 then (if isLeapYear then 29 else 28 end) + else [31, 28, 31,30,31,30,31,31,30,31,30,31][month-1] + end; + year as $year + | month as $month + | days + | until( day_of_week($year; $month; .; null) == 6 ; .-1); + +# input: year +def findLastFridays: + def months: + ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + . as $year + | "YEAR: \(.)", + (range(0;12) | "\(months[.]) \(findLastFriday($year; .+1))") ; + +$year|tonumber|findLastFridays diff --git a/Task/Last-Friday-of-each-month/jq/last-friday-of-each-month-3.jq b/Task/Last-Friday-of-each-month/jq/last-friday-of-each-month-3.jq new file mode 100644 index 0000000000..b59e2306b2 --- /dev/null +++ b/Task/Last-Friday-of-each-month/jq/last-friday-of-each-month-3.jq @@ -0,0 +1,14 @@ +$ jq --arg year 2012 -n -r -f findLastFridays.jq +YEAR: 2012 +January 27 +February 24 +March 30 +April 27 +May 25 +June 29 +July 27 +August 31 +September 28 +October 26 +November 30 +December 28 diff --git a/Task/Last-letter-first-letter/Phix/last-letter-first-letter.phix b/Task/Last-letter-first-letter/Phix/last-letter-first-letter.phix new file mode 100644 index 0000000000..f851bfba09 --- /dev/null +++ b/Task/Last-letter-first-letter/Phix/last-letter-first-letter.phix @@ -0,0 +1,77 @@ +constant words = {"audino","bagon","baltoy","banette","bidoof","braviary","bronzor","carracosta","charmeleon","cresselia","croagunk", + "darmanitan","deino","emboar","emolga","exeggcute","gabite","girafarig","gulpin","haxorus","heatmor","heatran", + "ivysaur","jellicent","jumpluff","kangaskhan","kricketune","landorus","ledyba","loudred","lumineon","lunatone", + "machamp","magnezone","mamoswine","nosepass","petilil","pidgeotto","pikachu","pinsir","poliwrath","poochyena", + "porygon2","porygonz","registeel","relicanth","remoraid","rufflet","sableye","scolipede","scrafty","seaking", + "sealeo","silcoon","simisear","snivy","snorlax","spoink","starly","tirtouga","trapinch","treecko","tyrogue", + "vigoroth","vulpix","wailord","wartortle","whismur","wingull","yamask"} + +function word_chains() +sequence first = repeat(0,256), -- start of chains for a given letter + -- first['a']=1, first['b']=2, first['c']=8, etc. + snext = repeat(0,length(words)) -- chains of words starting with the same letter + -- a: snext[1]=0, b: snext[2..7]={3,4,5,6,7,0}, etc. + for i=1 to length(words) do + integer ch = words[i][1] + if first[ch]=0 then + first[ch] = i + end if + for j=i+1 to length(words) do + if words[j][1]=ch then + snext[i] = j + exit + end if + end for + end for + return {first,snext} +end function + +constant {first,snext} = word_chains() + +-- maintain words already taken as a linked list: +integer tstart +sequence taken = repeat(0,length(words)) -- 0=no, -1=end of chain, +ve=next + +-- and keep a copy of the best for later +integer bstart +sequence best +integer maxn = 0 +integer count + +procedure try(integer ch, integer last, integer n) + integer next = first[ch] + while next!=0 do + if taken[next]=0 then + taken[last] = next + taken[next] = -1 + try(words[next][$],next,n+1) + taken[last] = -1 + taken[next] = 0 + end if + next = snext[next] + end while + if n>maxn then + bstart = tstart + best = taken + maxn = n + count = 1 + elsif n=maxn then + count += 1 + end if +end procedure + +atom t0=time() + +for i=1 to length(words) do + tstart = i + taken[i] = -1 + try(words[i][$],i,1) + taken[i] = 0 +end for + +printf(1,"Runtime: %2.3f seconds. Max length:%d, found %d of such, one of which is:\n",{time()-t0,maxn,count}) +while 1 do + printf(1,"%s ",words[bstart]) + bstart = best[bstart] + if bstart=-1 then exit end if +end while diff --git a/Task/Last-letter-first-letter/jq/last-letter-first-letter-1.jq b/Task/Last-letter-first-letter/jq/last-letter-first-letter-1.jq new file mode 100644 index 0000000000..76b52c00b9 --- /dev/null +++ b/Task/Last-letter-first-letter/jq/last-letter-first-letter-1.jq @@ -0,0 +1,7 @@ +# convert a list of unique words to a dictionary +def dictionary: + reduce .[] as $word ({}; .[$word[0:1]] += [$word]) ; + +# remove "word" from the input dictionary assuming the key is already there: +def remove(word): + .[word[0:1]] -= [word]; diff --git a/Task/Last-letter-first-letter/jq/last-letter-first-letter-2.jq b/Task/Last-letter-first-letter/jq/last-letter-first-letter-2.jq new file mode 100644 index 0000000000..badbef3b05 --- /dev/null +++ b/Task/Last-letter-first-letter/jq/last-letter-first-letter-2.jq @@ -0,0 +1,41 @@ +# left-right admissibility +def admissible: + .[0][-1:] == .[1][0:1]; + +# input: [word, dictionary_of_available_words_excluding_word] +# output: a (possibly empty) stream of admissible values: [next_word, updated_dictionary], +# where next_word can follow the given word. +def next: + .[0] as $word + | if $word == null then empty + else .[1] as $dictionary + | $word[-1:] as $last + | (($dictionary[$last] // []) | .[]) as $next + | [ $next, ($dictionary | remove($next)) ] + end ; + +# Produce an array representing a thread starting at "word": +# Input: [word, dictionary_of_available_words] +def thread: + if .[1] == [] then [ .[0] ] + else (next // null) as $next + | [.[0]] + (if $next then ($next | thread) else [] end) + end ; + +# Input: list of words +# Output: [ maximal_length, maximal_thread] +def maximal: + def maximum(start): + . as $dictionary + | reduce ( [start, ($dictionary | remove(start))] | thread ) as $thread + ([0, null]; + ($thread|length) as $l + | if $l > .[0] then [$l, $thread] else . end ); + + dictionary as $dictionary + | reduce .[] as $name + ( [0,null]; + ($dictionary | maximum($name)) as $ans + # If your jq does not include "debug", simply remove or comment-out the following line: + | ([$name, $ans[0]] | debug) as $debug + | if $ans[0] > .[0] then $ans else . end ); diff --git a/Task/Last-letter-first-letter/jq/last-letter-first-letter-3.jq b/Task/Last-letter-first-letter/jq/last-letter-first-letter-3.jq new file mode 100644 index 0000000000..d6ec431c96 --- /dev/null +++ b/Task/Last-letter-first-letter/jq/last-letter-first-letter-3.jq @@ -0,0 +1,17 @@ +def names: + ["audino", "bagon", "baltoy", "banette", + "bidoof", "braviary", "bronzor", "carracosta", "charmeleon", + "cresselia", "croagunk", "darmanitan", "deino", "emboar", + "emolga", "exeggcute", "gabite", "girafarig", "gulpin", + "haxorus", "heatmor", "heatran", "ivysaur", "jellicent", + "jumpluff", "kangaskhan", "kricketune", "landorus", "ledyba", + "loudred", "lumineon", "lunatone", "machamp", "magnezone", + "mamoswine", "nosepass", "petilil", "pidgeotto", "pikachu", + "pinsir", "poliwrath", "poochyena", "porygon2", "porygonz", + "registeel", "relicanth", "remoraid", "rufflet", "sableye", + "scolipede", "scrafty", "seaking", "sealeo", "silcoon", + "simisear", "snivy", "snorlax", "spoink", "starly", "tirtouga", + "trapinch", "treecko", "tyrogue", "vigoroth", "vulpix", + "wailord", "wartortle", "whismur", "wingull", "yamask" ] ; + +names | maximal diff --git a/Task/Last-letter-first-letter/jq/last-letter-first-letter-4.jq b/Task/Last-letter-first-letter/jq/last-letter-first-letter-4.jq new file mode 100644 index 0000000000..5d9a7ffa1a --- /dev/null +++ b/Task/Last-letter-first-letter/jq/last-letter-first-letter-4.jq @@ -0,0 +1,99 @@ +$ jq -n -f Last_letter-first_letter.jq +["DEBUG:",["audino",1]] +["DEBUG:",["bagon",20]] +["DEBUG:",["baltoy",21]] +["DEBUG:",["banette",20]] +["DEBUG:",["bidoof",1]] +["DEBUG:",["braviary",21]] +["DEBUG:",["bronzor",22]] +["DEBUG:",["carracosta",2]] +["DEBUG:",["charmeleon",20]] +["DEBUG:",["cresselia",2]] +["DEBUG:",["croagunk",21]] +["DEBUG:",["darmanitan",20]] +["DEBUG:",["deino",1]] +["DEBUG:",["emboar",19]] +["DEBUG:",["emolga",2]] +["DEBUG:",["exeggcute",19]] +["DEBUG:",["gabite",20]] +["DEBUG:",["girafarig",20]] +["DEBUG:",["gulpin",20]] +["DEBUG:",["haxorus",20]] +["DEBUG:",["heatmor",20]] +["DEBUG:",["heatran",20]] +["DEBUG:",["ivysaur",22]] +["DEBUG:",["jellicent",21]] +["DEBUG:",["jumpluff",1]] +["DEBUG:",["kangaskhan",20]] +["DEBUG:",["kricketune",20]] +["DEBUG:",["landorus",21]] +["DEBUG:",["ledyba",2]] +["DEBUG:",["loudred",21]] +["DEBUG:",["lumineon",20]] +["DEBUG:",["lunatone",20]] +["DEBUG:",["machamp",23]] +["DEBUG:",["magnezone",20]] +["DEBUG:",["mamoswine",20]] +["DEBUG:",["nosepass",19]] +["DEBUG:",["petilil",22]] +["DEBUG:",["pidgeotto",1]] +["DEBUG:",["pikachu",1]] +["DEBUG:",["pinsir",22]] +["DEBUG:",["poliwrath",21]] +["DEBUG:",["poochyena",2]] +["DEBUG:",["porygon2",1]] +["DEBUG:",["porygonz",1]] +["DEBUG:",["registeel",21]] +["DEBUG:",["relicanth",21]] +["DEBUG:",["remoraid",21]] +["DEBUG:",["rufflet",21]] +["DEBUG:",["sableye",20]] +["DEBUG:",["scolipede",20]] +["DEBUG:",["scrafty",21]] +["DEBUG:",["seaking",21]] +["DEBUG:",["sealeo",1]] +["DEBUG:",["silcoon",20]] +["DEBUG:",["simisear",21]] +["DEBUG:",["snivy",21]] +["DEBUG:",["snorlax",1]] +["DEBUG:",["spoink",21]] +["DEBUG:",["starly",21]] +["DEBUG:",["tirtouga",2]] +["DEBUG:",["trapinch",20]] +["DEBUG:",["treecko",1]] +["DEBUG:",["tyrogue",20]] +["DEBUG:",["vigoroth",21]] +["DEBUG:",["vulpix",1]] +["DEBUG:",["wailord",21]] +["DEBUG:",["wartortle",20]] +["DEBUG:",["whismur",22]] +["DEBUG:",["wingull",22]] +["DEBUG:",["yamask",20]] +[ + 23, + [ + "machamp", + "petilil", + "landorus", + "scrafty", + "yamask", + "kricketune", + "emboar", + "registeel", + "loudred", + "darmanitan", + "nosepass", + "simisear", + "relicanth", + "heatmor", + "rufflet", + "trapinch", + "haxorus", + "seaking", + "girafarig", + "gabite", + "exeggcute", + "emolga", + "audino" + ] +] diff --git a/Task/Leap-year/ERRE/leap-year.erre b/Task/Leap-year/ERRE/leap-year.erre new file mode 100644 index 0000000000..23bdd4a893 --- /dev/null +++ b/Task/Leap-year/ERRE/leap-year.erre @@ -0,0 +1,17 @@ +PROGRAM LEAP_YEAR + +FUNCTION LEAP(YR%) + LEAP=(YR% MOD 4=0) AND ((YR% MOD 400=0) OR (YR% MOD 100<>0)) +END FUNCTION + +BEGIN + LOOP + INPUT("Enter a year: ",year%) + EXIT IF YEAR%=0 + IF LEAP(year%) THEN + PRINT(year%;" is a leap year") + ELSE + PRINT(year%;" is not a leap year") + END IF + END LOOP +END PROGRAM diff --git a/Task/Leap-year/FreeBASIC/leap-year.freebasic b/Task/Leap-year/FreeBASIC/leap-year.freebasic new file mode 100644 index 0000000000..3712cdaeb2 --- /dev/null +++ b/Task/Leap-year/FreeBASIC/leap-year.freebasic @@ -0,0 +1,42 @@ +' version 23-06-2015 +' compile with: fbc -s console + +#Ifndef TRUE ' define true and false for older freebasic versions + #Define FALSE 0 + #Define TRUE Not FALSE +#EndIf + +Function leapyear(Year_ As Integer) As Integer + + If (Year_ Mod 4) <> 0 Then Return FALSE + If (Year_ Mod 100) = 0 AndAlso (Year_ Mod 400) <> 0 Then Return FALSE + Return TRUE + +End Function + +' ------=< MAIN >=------ + +' year is a FreeBASIC keyword +Dim As Integer Year_ + +For Year_ = 1800 To 2900 Step 100 + Print Year_; IIf(leapyear(Year_), " is a leap year", " is not a leap year") +Next + +Print : Print + +For Year_ = 2012 To 2031 + Print Year_; + If leapyear(Year_) = TRUE Then + Print " = leap", + Else + Print " = no", + End If + If year_ Mod 4 = 3 Then Print ' lf/cr +Next + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Leap-year/FutureBasic/leap-year.futurebasic b/Task/Leap-year/FutureBasic/leap-year.futurebasic new file mode 100644 index 0000000000..c50a6158be --- /dev/null +++ b/Task/Leap-year/FutureBasic/leap-year.futurebasic @@ -0,0 +1,50 @@ +include "ConsoleWindow" + +// In-line C function to generate random number in range +BeginCFunction +long randomInRange( long min, long max ) { +int i = (arc4random()%(max-min+1))+min; +return (long)i; +} +EndC +toolbox fn randomInRange( long min, long max ) = long + +// Leap year test function +local fn LeapYear( year as long ) as Boolean +dim as Boolean result : result = _false + +if year mod 400 == 0 then result = _true : exit fn +if year mod 100 == 0 then result = _false : exit fn +if year mod 4 == 0 then result = _true : exit fn +if year mod 4 != 0 then result = _false : exit fn +end fn = result + +dim as long i, y, knownLeapYear(10) + +// Array of known leap years from 1980 through 2020 for control +knownLeapYear(0) = 1980 : knownLeapYear(1) = 1984 : knownLeapYear(2) = 1988 +knownLeapYear(3) = 1992 : knownLeapYear(4) = 1996 : knownLeapYear(5) = 2000 +knownLeapYear(6) = 2004 : knownLeapYear(7) = 2008 : knownLeapYear(8) = 2012 +knownLeapYear(9) = 2016 : knownLeapYear(10) = 2020 + +print "Known leap years:" +for i = 0 to 9 + if ( fn LeapYear( knownLeapYear(i) ) == _true ) + print knownLeapYear(i); " is a leap year." +else + print knownLeapYear(i); " is a not leap year." + end if +next + +print + +// Random years from 1980 to 2020 to test +print "Check random years:" +for i = 0 to 20 + y = fn randomInRange( 1980, 2020 ) + if ( fn LeapYear( y ) == _true ) + print y; " is a leap year." + else + print y; " is a not leap year." + end if +next diff --git a/Task/Leap-year/Harbour/leap-year.harbour b/Task/Leap-year/Harbour/leap-year.harbour new file mode 100644 index 0000000000..dd4480d3c5 --- /dev/null +++ b/Task/Leap-year/Harbour/leap-year.harbour @@ -0,0 +1,2 @@ +FUNCTION IsLeapYear( nYear ) + RETURN iif( nYear % 100 == 0, nYear % 400 == 0, nYear % 4 == 0 ) diff --git a/Task/Leap-year/Hy/leap-year.hy b/Task/Leap-year/Hy/leap-year.hy new file mode 100644 index 0000000000..3c23b4e29b --- /dev/null +++ b/Task/Leap-year/Hy/leap-year.hy @@ -0,0 +1,6 @@ +(defn leap? [y] + (and + (= (% y 4) 0) + (or + (!= (% y 100) 0) + (= (% y 400) 0)))) diff --git a/Task/Leap-year/Lasso/leap-year.lasso b/Task/Leap-year/Lasso/leap-year.lasso new file mode 100644 index 0000000000..ac29068271 --- /dev/null +++ b/Task/Leap-year/Lasso/leap-year.lasso @@ -0,0 +1,11 @@ +define isLeapYear(y::integer) => { + #y % 400 == 0 ? return true + #y % 100 == 0 ? return false + #y % 4 == 0 ? return true + return false +} + +with test in array(2012,2016,1933,1900,1999,2000) do => {^ + isLeapYear(#test) + '\r' +^} diff --git a/Task/Leap-year/Lingo/leap-year.lingo b/Task/Leap-year/Lingo/leap-year.lingo new file mode 100644 index 0000000000..62a8067e77 --- /dev/null +++ b/Task/Leap-year/Lingo/leap-year.lingo @@ -0,0 +1,3 @@ +on isLeapYear (year) + return date(year, 2, 29).month=2 +end diff --git a/Task/Leap-year/LiveCode/leap-year.livecode b/Task/Leap-year/LiveCode/leap-year.livecode new file mode 100644 index 0000000000..1dcc20dc2b --- /dev/null +++ b/Task/Leap-year/LiveCode/leap-year.livecode @@ -0,0 +1,18 @@ +function isLeapYear year + return (year MOD 4 is 0) AND ((year MOD 400 is 0) OR (year MOD 100 is not 0)) +end isLeapYear + +command testLeapYear + set itemDelimiter to comma + put "1900,1994,1996,1997,2000" into years + repeat for each item y in years + put y && "is" && isLeapYear(y) && return after tyears + end repeat + put tyears +end testLeapYear + +1900 is false +1994 is false +1996 is true +1997 is false +2000 is true diff --git a/Task/Leap-year/Nim/leap-year.nim b/Task/Leap-year/Nim/leap-year.nim new file mode 100644 index 0000000000..66192cec40 --- /dev/null +++ b/Task/Leap-year/Nim/leap-year.nim @@ -0,0 +1,12 @@ +import times +let year = 1980 +echo isLeapYear(year) + +# or + +proc isLeapYear2(year): bool = + if year mod 100 == 0: + year mod 400 == 0 + else: year mod 4 == 0 + +echo isLeapYear2(year) diff --git a/Task/Leap-year/Oforth/leap-year.oforth b/Task/Leap-year/Oforth/leap-year.oforth new file mode 100644 index 0000000000..8e889275ec --- /dev/null +++ b/Task/Leap-year/Oforth/leap-year.oforth @@ -0,0 +1 @@ +Date.IsLeapYear(2000) diff --git a/Task/Leap-year/Phix/leap-year.phix b/Task/Leap-year/Phix/leap-year.phix new file mode 100644 index 0000000000..1d9508da25 --- /dev/null +++ b/Task/Leap-year/Phix/leap-year.phix @@ -0,0 +1,3 @@ +global function is_leap_year(integer y) + return remainder(y,4)=0 and (remainder(y,100)!=0 or remainder(y,400)=0) +end function diff --git a/Task/Leap-year/Ring/leap-year.ring b/Task/Leap-year/Ring/leap-year.ring new file mode 100644 index 0000000000..1f7f26a7fd --- /dev/null +++ b/Task/Leap-year/Ring/leap-year.ring @@ -0,0 +1,10 @@ +give year +leap = isLeapYear(year) +if leap true see year + " is leap year." +else see year + " is not leap year." ok + +Func isLeapYear year + if (year % 400) = 0 return true + but (year % 100) = 0 return false + but (year % 4) = 0 return true + else return false ok diff --git a/Task/Leap-year/Sidef/leap-year-1.sidef b/Task/Leap-year/Sidef/leap-year-1.sidef new file mode 100644 index 0000000000..03db5c260b --- /dev/null +++ b/Task/Leap-year/Sidef/leap-year-1.sidef @@ -0,0 +1,6 @@ +func isleap(year) { + if (year %% 100) { + return (year %% 400); + } + return (year %% 4); +} diff --git a/Task/Leap-year/Sidef/leap-year-2.sidef b/Task/Leap-year/Sidef/leap-year-2.sidef new file mode 100644 index 0000000000..1dc8d67fd1 --- /dev/null +++ b/Task/Leap-year/Sidef/leap-year-2.sidef @@ -0,0 +1 @@ +func isleap(year) { year %% 100 ? (year %% 400) : (year %% 4) }; diff --git a/Task/Leap-year/Swift/leap-year.swift b/Task/Leap-year/Swift/leap-year.swift new file mode 100644 index 0000000000..4096a0f288 --- /dev/null +++ b/Task/Leap-year/Swift/leap-year.swift @@ -0,0 +1,6 @@ +func isLeapYear(year:Int) -> Bool { + return (year % 100 == 0) ? (year % 400 == 0) : (year % 4 == 0) +} + +println(isLeapYear(2000)) +println(isLeapYear(2011)) diff --git a/Task/Leap-year/Ursa/leap-year.ursa b/Task/Leap-year/Ursa/leap-year.ursa new file mode 100644 index 0000000000..b47560445e --- /dev/null +++ b/Task/Leap-year/Ursa/leap-year.ursa @@ -0,0 +1,11 @@ +decl int year +set year (int args<1>) +if (= (mod year 4) 0) + if (and (= (mod year 100) 0) (not (= (mod year 400) 0))) + out year " is not a leap year" endl console + else + out year " is a leap year" endl console + end if +else + out year " is not a leap year" endl console +end if diff --git a/Task/Leap-year/Wortel/leap-year.wortel b/Task/Leap-year/Wortel/leap-year.wortel new file mode 100644 index 0000000000..3efc16fe0c --- /dev/null +++ b/Task/Leap-year/Wortel/leap-year.wortel @@ -0,0 +1,4 @@ +@let { + isLeapYear !?{\~%%1H \~%%4H \~%%4} + !-isLeapYear @range[1900 2000] +} diff --git a/Task/Leap-year/XLISP/leap-year.xlisp b/Task/Leap-year/XLISP/leap-year.xlisp new file mode 100644 index 0000000000..4b490b7685 --- /dev/null +++ b/Task/Leap-year/XLISP/leap-year.xlisp @@ -0,0 +1,5 @@ +(DEFUN LEAP-YEARP (YEAR) + (AND (= (MOD YEAR 4) 0) (OR (/= (MOD YEAR 100) 0) (= (MOD YEAR 400) 0)))) + +; Test the function +(DISPLAY (MAPCAR LEAP-YEARP '(1600 1640 1800 1928 1979 1990 2000 2004 2005 2016))) diff --git a/Task/Leap-year/jq/leap-year-1.jq b/Task/Leap-year/jq/leap-year-1.jq new file mode 100644 index 0000000000..0b5a0b527d --- /dev/null +++ b/Task/Leap-year/jq/leap-year-1.jq @@ -0,0 +1,2 @@ +def leap: + . as $y | ($y%4) == 0 and ($y < 1582 or ($y%400) == 0 or ($y%100) != 0); diff --git a/Task/Leap-year/jq/leap-year-2.jq b/Task/Leap-year/jq/leap-year-2.jq new file mode 100644 index 0000000000..0e325f5a14 --- /dev/null +++ b/Task/Leap-year/jq/leap-year-2.jq @@ -0,0 +1,7 @@ +def assert(value; f): + value as $value + | ($value|f) | if . then empty else error("assertion violation: \($value) => \(.)") end; + +((2400, 2012, 2000, 1600, 1500, 1400) | assert(.; leap)), + +((2100, 2014, 1900, 1800, 1700, 1499) | assert(.; leap|not)) diff --git a/Task/Least-common-multiple/8th/least-common-multiple.8th b/Task/Least-common-multiple/8th/least-common-multiple.8th new file mode 100644 index 0000000000..e2f2a1197f --- /dev/null +++ b/Task/Least-common-multiple/8th/least-common-multiple.8th @@ -0,0 +1,25 @@ +: gcd \ a b -- gcd + dup 0 n:= if drop ;; then + tuck \ b a b + n:mod \ b a-mod-b + recurse ; + +: lcm \ m n + 2dup \ m n m n + n:* \ m n m*n + n:abs \ m n abs(m*n) + -rot \ abs(m*n) m n + gcd \ abs(m*n) gcd(m.n) + n:/mod \ abs / gcd + nip \ abs div gcd +; + +: demo \ n m -- + 2dup "LCM of " . . " and " . . " = " . lcm . ; + +12 18 demo cr +-6 14 demo cr +35 0 demo cr + + +bye diff --git a/Task/Least-common-multiple/ERRE/least-common-multiple.erre b/Task/Least-common-multiple/ERRE/least-common-multiple.erre new file mode 100644 index 0000000000..3dd4a00bb2 --- /dev/null +++ b/Task/Least-common-multiple/ERRE/least-common-multiple.erre @@ -0,0 +1,30 @@ +PROGRAM LCM + +PROCEDURE GCD(A,B->GCD) + LOCAL C + WHILE B DO + C=A + A=B + B=C MOD B + END WHILE + GCD=ABS(A) +END PROCEDURE + +PROCEDURE LCM(M,N->LCM) + IF M=0 OR N=0 THEN + LCM=0 + EXIT PROCEDURE + ELSE + GCD(M,N->GCD) + LCM=ABS(M*N)/GCD + END IF +END PROCEDURE + +BEGIN + LCM(18,12->LCM) + PRINT("LCM of 18 AND 12 =";LCM) + LCM(14,-6->LCM) + PRINT("LCM of 14 AND -6 =";LCM) + LCM(0,35->LCM) + PRINT("LCM of 0 AND 35 =";LCM) +END PROGRAM diff --git a/Task/Least-common-multiple/EchoLisp/least-common-multiple.echolisp b/Task/Least-common-multiple/EchoLisp/least-common-multiple.echolisp new file mode 100644 index 0000000000..66050e920d --- /dev/null +++ b/Task/Least-common-multiple/EchoLisp/least-common-multiple.echolisp @@ -0,0 +1,6 @@ +(lcm 0 9) → 0 +(lcm 444 888)→ 888 +(lcm 888 999) → 7992 + +(define (lcm* list) (foldl lcm (first list) list)) → lcm* +(lcm* '(444 888 999)) → 7992 diff --git a/Task/Least-common-multiple/Ezhil/least-common-multiple.ezhil b/Task/Least-common-multiple/Ezhil/least-common-multiple.ezhil new file mode 100644 index 0000000000..5cd050f35c --- /dev/null +++ b/Task/Least-common-multiple/Ezhil/least-common-multiple.ezhil @@ -0,0 +1,56 @@ +## இந்த நிரல் இரு எண்களுக்கு இடையிலான மீச்சிறு பொது மடங்கு (LCM), மீப்பெரு பொது வகுத்தி (GCD) என்ன என்று கணக்கிடும் + +நிரல்பாகம் மீபொம(எண்1, எண்2) + + @(எண்1 == எண்2) ஆனால் + + ## இரு எண்களும் சமம் என்பதால், மீபொம அந்த எண்ணேதான் + + பின்கொடு எண்1 + + @(எண்1 > எண்2) இல்லைஆனால் + + சிறியது = எண்2 + பெரியது = எண்1 + + இல்லை + + சிறியது = எண்1 + பெரியது = எண்2 + + முடி + + மீதம் = பெரியது % சிறியது + + @(மீதம் == 0) ஆனால் + + ## பெரிய எண்ணில் சிறிய எண் மீதமின்றி வகுபடுவதால், பெரிய எண்தான் மீபொம + + பின்கொடு பெரியது + + இல்லை + + தொடக்கம் = பெரியது + 1 + நிறைவு = சிறியது * பெரியது + + @(எண் = தொடக்கம், எண் <= நிறைவு, எண் = எண் + 1) ஆக + + ## ஒவ்வோர் எண்ணாக எடுத்துக்கொண்டு தரப்பட்ட இரு எண்களாலும் வகுத்துப் பார்க்கின்றோம். முதலாவதாக இரண்டாலும் மீதமின்றி வகுபடும் எண்தான் மீபொம + + மீதம்1 = எண் % சிறியது + மீதம்2 = எண் % பெரியது + + @((மீதம்1 == 0) && (மீதம்2 == 0)) ஆனால் + பின்கொடு எண் + முடி + + முடி + + முடி + +முடி + +அ = int(உள்ளீடு("ஓர் எண்ணைத் தாருங்கள் ")) +ஆ = int(உள்ளீடு("இன்னோர் எண்ணைத் தாருங்கள் ")) + +பதிப்பி "நீங்கள் தந்த இரு எண்களின் மீபொம (மீச்சிறு பொது மடங்கு, LCM) = ", மீபொம(அ, ஆ) diff --git a/Task/Least-common-multiple/FreeBASIC/least-common-multiple.freebasic b/Task/Least-common-multiple/FreeBASIC/least-common-multiple.freebasic new file mode 100644 index 0000000000..90502b2d56 --- /dev/null +++ b/Task/Least-common-multiple/FreeBASIC/least-common-multiple.freebasic @@ -0,0 +1,18 @@ +' FB 1.05.0 Win64 + +Function lcm (m As Integer, n As Integer) As Integer + If m = 0 OrElse n = 0 Then Return 0 + If m < n Then Swap m, n '' to minimize iterations needed + Var count = 0 + Do + count +=1 + Loop Until (m * count) Mod n = 0 + Return m * count +End Function + +Print "lcm(12, 18) ="; lcm(12, 18) +Print "lcm(15, 12) ="; lcm(15, 12) +Print "lcm(10, 14) ="; lcm(10, 14) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Least-common-multiple/FunL/least-common-multiple.funl b/Task/Least-common-multiple/FunL/least-common-multiple.funl new file mode 100644 index 0000000000..99e532f018 --- /dev/null +++ b/Task/Least-common-multiple/FunL/least-common-multiple.funl @@ -0,0 +1,4 @@ +def + lcm( _, 0 ) = 0 + lcm( 0, _ ) = 0 + lcm( x, y ) = abs( (x\gcd(x, y)) y ) diff --git a/Task/Least-common-multiple/Lasso/least-common-multiple.lasso b/Task/Least-common-multiple/Lasso/least-common-multiple.lasso new file mode 100644 index 0000000000..879be7b611 --- /dev/null +++ b/Task/Least-common-multiple/Lasso/least-common-multiple.lasso @@ -0,0 +1,19 @@ +define gcd(a,b) => { + while(#b != 0) => { + local(t = #b) + #b = #a % #b + #a = #t + } + return #a +} +define lcm(m,n) => { + #m == 0 || #n == 0 ? return 0 + local(r = (#m * #n) / decimal(gcd(#m, #n))) + return integer(#r)->abs +} + +lcm(-6, 14) +lcm(2, 0) +lcm(12, 18) +lcm(12, 22) +lcm(7, 31) diff --git a/Task/Least-common-multiple/Nim/least-common-multiple.nim b/Task/Least-common-multiple/Nim/least-common-multiple.nim new file mode 100644 index 0000000000..2c02c8bb35 --- /dev/null +++ b/Task/Least-common-multiple/Nim/least-common-multiple.nim @@ -0,0 +1,15 @@ +proc gcd(u, v): auto = + var + t = 0 + u = u + v = v + while v != 0: + t = u + u = v + v = t %% v + abs(u) + +proc lcm(a, b): auto = abs(a * b) div gcd(a, b) + +echo lcm(12, 18) +echo lcm(-6, 14) diff --git a/Task/Least-common-multiple/Oforth/least-common-multiple.oforth b/Task/Least-common-multiple/Oforth/least-common-multiple.oforth new file mode 100644 index 0000000000..5ddfc0996e --- /dev/null +++ b/Task/Least-common-multiple/Oforth/least-common-multiple.oforth @@ -0,0 +1 @@ +12 18 lcm diff --git a/Task/Least-common-multiple/Phix/least-common-multiple.phix b/Task/Least-common-multiple/Phix/least-common-multiple.phix new file mode 100644 index 0000000000..6a19e4ef85 --- /dev/null +++ b/Task/Least-common-multiple/Phix/least-common-multiple.phix @@ -0,0 +1,3 @@ +function lcm(integer m, integer n) + return m / gcd(m, n) * n +end function diff --git a/Task/Least-common-multiple/Ring/least-common-multiple.ring b/Task/Least-common-multiple/Ring/least-common-multiple.ring new file mode 100644 index 0000000000..8982f9d45b --- /dev/null +++ b/Task/Least-common-multiple/Ring/least-common-multiple.ring @@ -0,0 +1,13 @@ +see lcm(24,36) + +func lcm m,n + lcm = m*n / gcd(m,n) + return lcm + +func gcd gcd, b + while b + c = gcd + gcd = b + b = c % b + end + return gcd diff --git a/Task/Least-common-multiple/Sidef/least-common-multiple-1.sidef b/Task/Least-common-multiple/Sidef/least-common-multiple-1.sidef new file mode 100644 index 0000000000..fad5145ab4 --- /dev/null +++ b/Task/Least-common-multiple/Sidef/least-common-multiple-1.sidef @@ -0,0 +1 @@ +say Math.lcm(1001, 221) diff --git a/Task/Least-common-multiple/Sidef/least-common-multiple-2.sidef b/Task/Least-common-multiple/Sidef/least-common-multiple-2.sidef new file mode 100644 index 0000000000..66d65c3f54 --- /dev/null +++ b/Task/Least-common-multiple/Sidef/least-common-multiple-2.sidef @@ -0,0 +1,10 @@ +func gcd(a, b) { + while (a) { (a, b) = (b % a, a) } + return b +} + +func lcm(a, b) { + (a && b) ? (a / gcd(a, b) * b) : 0 +} + +say lcm(1001, 221) diff --git a/Task/Least-common-multiple/Sparkling/least-common-multiple.sparkling b/Task/Least-common-multiple/Sparkling/least-common-multiple.sparkling new file mode 100644 index 0000000000..a9948e74d5 --- /dev/null +++ b/Task/Least-common-multiple/Sparkling/least-common-multiple.sparkling @@ -0,0 +1,33 @@ +function factors(n) { + var f = {}; + + for var i = 2; n > 1; i++ { + while n % i == 0 { + n /= i; + f[i] = f[i] != nil ? f[i] + 1 : 1; + } + } + + return f; +} + +function GCD(n, k) { + let f1 = factors(n); + let f2 = factors(k); + + let fs = map(f1, function(factor, multiplicity) { + let m = f2[factor]; + return m == nil ? 0 : min(m, multiplicity); + }); + + let rfs = {}; + foreach(fs, function(k, v) { + rfs[sizeof rfs] = pow(k, v); + }); + + return reduce(rfs, 1, function(x, y) { return x * y; }); +} + +function LCM(n, k) { + return n * k / GCD(n, k); +} diff --git a/Task/Least-common-multiple/Swift/least-common-multiple.swift b/Task/Least-common-multiple/Swift/least-common-multiple.swift new file mode 100644 index 0000000000..00463e44b9 --- /dev/null +++ b/Task/Least-common-multiple/Swift/least-common-multiple.swift @@ -0,0 +1,3 @@ +func lcm(a:Int, b:Int) -> Int { + return abs(a * b) / gcd_rec(a, b) +} diff --git a/Task/Least-common-multiple/Ursa/least-common-multiple.ursa b/Task/Least-common-multiple/Ursa/least-common-multiple.ursa new file mode 100644 index 0000000000..811e6e9ec5 --- /dev/null +++ b/Task/Least-common-multiple/Ursa/least-common-multiple.ursa @@ -0,0 +1,2 @@ +import "math" +out (lcm 12 18) endl console diff --git a/Task/Least-common-multiple/Wortel/least-common-multiple-1.wortel b/Task/Least-common-multiple/Wortel/least-common-multiple-1.wortel new file mode 100644 index 0000000000..89247ccbea --- /dev/null +++ b/Task/Least-common-multiple/Wortel/least-common-multiple-1.wortel @@ -0,0 +1 @@ +@lcm a b diff --git a/Task/Least-common-multiple/Wortel/least-common-multiple-2.wortel b/Task/Least-common-multiple/Wortel/least-common-multiple-2.wortel new file mode 100644 index 0000000000..79793d349a --- /dev/null +++ b/Task/Least-common-multiple/Wortel/least-common-multiple-2.wortel @@ -0,0 +1 @@ +!#~km a b diff --git a/Task/Least-common-multiple/Wortel/least-common-multiple-3.wortel b/Task/Least-common-multiple/Wortel/least-common-multiple-3.wortel new file mode 100644 index 0000000000..a11c22c966 --- /dev/null +++ b/Task/Least-common-multiple/Wortel/least-common-multiple-3.wortel @@ -0,0 +1 @@ +&[a b] *b /a @gcd a b diff --git a/Task/Least-common-multiple/jq/least-common-multiple.jq b/Task/Least-common-multiple/jq/least-common-multiple.jq new file mode 100644 index 0000000000..00b1008569 --- /dev/null +++ b/Task/Least-common-multiple/jq/least-common-multiple.jq @@ -0,0 +1,6 @@ +# Define the helper function to take advantage of jq's tail-recursion optimization +def lcm(m; n): + def _lcm: + # state is [m, n, i] + if (.[2] % .[1]) == 0 then .[2] else (.[0:2] + [.[2] + m]) | _lcm end; + [m, n, m] | _lcm; diff --git a/Task/Left-factorials/EchoLisp/left-factorials-1.echolisp b/Task/Left-factorials/EchoLisp/left-factorials-1.echolisp new file mode 100644 index 0000000000..b748d78d78 --- /dev/null +++ b/Task/Left-factorials/EchoLisp/left-factorials-1.echolisp @@ -0,0 +1,5 @@ +(lib 'bigint) +(define (!n n) + (if (zero? n) 0 + (+ (!n (1- n)) (factorial (1- n))))) +(remember '!n) diff --git a/Task/Left-factorials/EchoLisp/left-factorials-2.echolisp b/Task/Left-factorials/EchoLisp/left-factorials-2.echolisp new file mode 100644 index 0000000000..76fda115b2 --- /dev/null +++ b/Task/Left-factorials/EchoLisp/left-factorials-2.echolisp @@ -0,0 +1,38 @@ +(for ((n 11)) (printf "!n(%d) = %d" n (!n n))) +(for ((n (in-range 20 120 10))) (printf "!n(%d) = %d" n (!n n))) +!n(0) = 0 +!n(1) = 1 +!n(2) = 2 +!n(3) = 4 +!n(4) = 10 +!n(5) = 34 +!n(6) = 154 +!n(7) = 874 +!n(8) = 5914 +!n(9) = 46234 +!n(10) = 409114 +!n(20) = 128425485935180314 +!n(30) = 9157958657951075573395300940314 +!n(40) = 20935051082417771847631371547939998232420940314 +!n(50) = 620960027832821612639424806694551108812720525606160920420940314 +!n(60) = 141074930726669571000530822087000522211656242116439949000980378746128920420940314 +!n(70) = 173639511802987526699717162409282876065556519849603157850853034644815111221599509216528920420940314 +!n(80) = 906089587987695346534516804650290637694024830011956365184327674619752094289696314882008531991840922336528920420940314 +!n(90) = 16695570072624210767034167688394623360733515163575864136345910335924039962404869510225723072235842668787507993136908442336528920420940314 +!n(100) = 942786239765826579160595268206839381354754349601050974345395410407078230249590414458830117442618180732911203520208889371641659121356556442336528920420940314 +!n(110) = 145722981061585297004706728001906071948635199234860720988658042536179281328615541936083296163475394237524337422204397431927131629058103519228197429698252556442336528920420940314 + +; Compute !n : 5 seconds +(for ((n (in-range 1000 10001 500))) (!n n) (writeln n)) +; Display results : 12 seconds +(for ((n (in-range 1000 10001 1000))) (printf "Digits of !n(%d) = %d" n (number-length (!n n)))) +Digits of !n(1000) = 2565 +Digits of !n(2000) = 5733 +Digits of !n(3000) = 9128 +Digits of !n(4000) = 12670 +Digits of !n(5000) = 16322 +Digits of !n(6000) = 20062 +Digits of !n(7000) = 23875 +Digits of !n(8000) = 27749 +Digits of !n(9000) = 31678 +Digits of !n(10000) = 35656 diff --git a/Task/Left-factorials/Nim/left-factorials.nim b/Task/Left-factorials/Nim/left-factorials.nim new file mode 100644 index 0000000000..1562c86b9f --- /dev/null +++ b/Task/Left-factorials/Nim/left-factorials.nim @@ -0,0 +1,26 @@ +import iterutils, bigints + +proc lfact: iterator: BigInt = + result = iterator: BigInt = + yield 0.initBigInt + var + fact = 1.initBigInt + sum = 0.initBigInt + n = 1.initBigInt + while true: + sum += fact + fact *= n + n += 1 + yield sum + +echo "first 11:\n " +for i in lfact().slice(last = 10): + echo " ", i + +echo "20 through 110 (inclusive) by tens:" +for i in lfact().slice(20, 110, 10): + echo " ", i + +echo "Digits in 1,000 through 10,000 (inclusive) by thousands:" +for i in lfact().slice(1_000, 10_000, 1_000): + echo " ", ($i).len diff --git a/Task/Left-factorials/Oforth/left-factorials.oforth b/Task/Left-factorials/Oforth/left-factorials.oforth new file mode 100644 index 0000000000..ce044481d5 --- /dev/null +++ b/Task/Left-factorials/Oforth/left-factorials.oforth @@ -0,0 +1 @@ +: leftFact | i | 0 1 rot loop: i [ tuck + swap i * ] drop ; diff --git a/Task/Left-factorials/Ring/left-factorials.ring b/Task/Left-factorials/Ring/left-factorials.ring new file mode 100644 index 0000000000..be232efadd --- /dev/null +++ b/Task/Left-factorials/Ring/left-factorials.ring @@ -0,0 +1,15 @@ +a = leftFact(0,10,1) +see "" + a + nl + +func leftFact f,t,s + see "------ From " + f + " --To -> " + t +" Step " + s + " -------" + nl + for i = f to t step s + leftFact = 1 + fct = 1 + for j = 1 to i - 1 + fct = fct * j + leftFact = leftFact + fct + next + if i >= 1000 see "" + i + " " + len(string(leftFact)) + " digits" + nl + else see "" + i + " " + leftFact + nl ok + next diff --git a/Task/Left-factorials/Sidef/left-factorials-1.sidef b/Task/Left-factorials/Sidef/left-factorials-1.sidef new file mode 100644 index 0000000000..12e86562d8 --- /dev/null +++ b/Task/Left-factorials/Sidef/left-factorials-1.sidef @@ -0,0 +1,3 @@ +func left_fact(k) { + ^k -> map {|n| n! } -> sum(0) +} diff --git a/Task/Left-factorials/Sidef/left-factorials-2.sidef b/Task/Left-factorials/Sidef/left-factorials-2.sidef new file mode 100644 index 0000000000..29c6c5ee4a --- /dev/null +++ b/Task/Left-factorials/Sidef/left-factorials-2.sidef @@ -0,0 +1,3 @@ +func left_fact(k) { + ^k -> reduce { |a,b| a + b! } + 1 +} diff --git a/Task/Left-factorials/Sidef/left-factorials-3.sidef b/Task/Left-factorials/Sidef/left-factorials-3.sidef new file mode 100644 index 0000000000..b13c9f57e5 --- /dev/null +++ b/Task/Left-factorials/Sidef/left-factorials-3.sidef @@ -0,0 +1,18 @@ +func left_fact(n) { + static cached = 0 + static factorial = 1 + static leftfact = 0 +  + if (n < cached) { + cached = 0 + factorial = 1 + leftfact = 0 + } +  + while (n > cached) { + leftfact += factorial + factorial *= ++cached + } +  + leftfact +} diff --git a/Task/Left-factorials/Sidef/left-factorials-4.sidef b/Task/Left-factorials/Sidef/left-factorials-4.sidef new file mode 100644 index 0000000000..9ff53fae06 --- /dev/null +++ b/Task/Left-factorials/Sidef/left-factorials-4.sidef @@ -0,0 +1,9 @@ +for r in [range(0, 10), range(20, 110).by(10)] { + for i in r { + printf("!%d = %s\n", i, left_fact(i)); + } +} + +for i in range(1000, 10000).by(1000) { + printf("!%d has %d digits.\n", i, left_fact(i).len); +} diff --git a/Task/Left-factorials/jq/left-factorials-1.jq b/Task/Left-factorials/jq/left-factorials-1.jq new file mode 100644 index 0000000000..dfa8c03390 --- /dev/null +++ b/Task/Left-factorials/jq/left-factorials-1.jq @@ -0,0 +1,5 @@ +def left_factorial: + reduce range(1; .+1) as $i + # state: [i!, !i] + ([1,0]; .[1] += .[0] | .[0] *= $i) + | .[1]; diff --git a/Task/Left-factorials/jq/left-factorials-2.jq b/Task/Left-factorials/jq/left-factorials-2.jq new file mode 100644 index 0000000000..678265d450 --- /dev/null +++ b/Task/Left-factorials/jq/left-factorials-2.jq @@ -0,0 +1,21 @@ +import "BigInt" as BigInt; + +# integer input +def long_left_factorial: + reduce range(1; .+1) as $i + # state: [i!, !i] + ( ["1", "0"]; + .[1] = BigInt::long_add(.[0]; .[1]) + | .[0] = BigInt::long_multiply(.[0]; $i | tostring) ) + | .[1]; + +# input and gap should be integers +def long_left_factorial_lengths(gap): + reduce range(1; .+1) as $i + # state: [i!, !i, gap] + (["1", "0", []]; + .[1] = BigInt::long_add(.[0]; .[1]) + | .[0] = BigInt::long_multiply(.[0]; $i|tostring) + | (.[1] | tostring | length) as $lf + | if $i % gap == 0 then .[2] += [[$i, $lf]] else . end) + | .[2]; diff --git a/Task/Left-factorials/jq/left-factorials-3.jq b/Task/Left-factorials/jq/left-factorials-3.jq new file mode 100644 index 0000000000..dea5ba0ec4 --- /dev/null +++ b/Task/Left-factorials/jq/left-factorials-3.jq @@ -0,0 +1,3 @@ +((range(0;11), (range(2; 12) * 10)) | "\(.): \(long_left_factorial)"), + +(10000 | long_left_factorial_lengths(1000) | .[] | "\(.[0]): length is \(.[1])") diff --git a/Task/Left-factorials/jq/left-factorials-4.jq b/Task/Left-factorials/jq/left-factorials-4.jq new file mode 100644 index 0000000000..c755d7f291 --- /dev/null +++ b/Task/Left-factorials/jq/left-factorials-4.jq @@ -0,0 +1,32 @@ +$ jq -r -n -L . -f Long_left_factorial.jq +0: 0 +1: 1 +2: 2 +3: 4 +4: 10 +5: 34 +6: 154 +7: 874 +8: 5914 +9: 46234 +10: 409114 +20: 128425485935180314 +30: 9157958657951075573395300940314 +40: 20935051082417771847631371547939998232420940314 +50: 620960027832821612639424806694551108812720525606160920420940314 +60: 141074930726669571000530822087000522211656242116439949000980378746128920420940314 +70: 173639511802987526699717162409282876065556519849603157850853034644815111221599509216528920420940314 +80: 906089587987695346534516804650290637694024830011956365184327674619752094289696314882008531991840922336528920420940314 +90: 16695570072624210767034167688394623360733515163575864136345910335924039962404869510225723072235842668787507993136908442336528920420940314 +100: 942786239765826579160595268206839381354754349601050974345395410407078230249590414458830117442618180732911203520208889371641659121356556442336528920420940314 +110: 145722981061585297004706728001906071948635199234860720988658042536179281328615541936083296163475394237524337422204397431927131629058103519228197429698252556442336528920420940314 +1000: length is 2565 +2000: length is 5733 +3000: length is 9128 +4000: length is 12670 +5000: length is 16322 +6000: length is 20062 +7000: length is 23875 +8000: length is 27749 +9000: length is 31678 +10000: length is 35656 diff --git a/Task/Letter-frequency/ERRE/letter-frequency.erre b/Task/Letter-frequency/ERRE/letter-frequency.erre new file mode 100644 index 0000000000..bc07d3724e --- /dev/null +++ b/Task/Letter-frequency/ERRE/letter-frequency.erre @@ -0,0 +1,25 @@ +PROGRAM LETTER + +DIM CNT[255] + +BEGIN + + OPEN("I",1,"f:\errev30\erre.hlp") + + REPEAT + GET(#1,A$) + L%=LEN(A$) + IF L%>0 THEN + FOR I%=1 TO L% DO + A%=ASC(MID$(A$,I%)) + CNT[A%]+=1 + END FOR + END IF + UNTIL EOF(1) + CLOSE(1) + + FOR C%=$41 TO $5A DO + PRINT(CHR$(C%);CHR$(C%+32);": ";CNT[C%]+CNT[C%+32]) + END FOR + +END PROGRAM diff --git a/Task/Letter-frequency/EchoLisp/letter-frequency-1.echolisp b/Task/Letter-frequency/EchoLisp/letter-frequency-1.echolisp new file mode 100644 index 0000000000..2f78a8640f --- /dev/null +++ b/Task/Letter-frequency/EchoLisp/letter-frequency-1.echolisp @@ -0,0 +1,11 @@ +;; bump count when letter added +(define (hash-counter hash key ) + ;; (set! key (string-downcase key)) - if ignore case wanted + (putprop hash (1+ (or (getprop hash key) 0 )) key)) + +;; apply to exploded string +;; and sort result +(define (hash-compare a b) ( < (first a) (first b))) +(define (count-letters hash string) + (map (curry hash-counter hash) (string->list string)) + (list-sort hash-compare (symbol-plist hash))) diff --git a/Task/Letter-frequency/EchoLisp/letter-frequency-2.echolisp b/Task/Letter-frequency/EchoLisp/letter-frequency-2.echolisp new file mode 100644 index 0000000000..2bed393191 --- /dev/null +++ b/Task/Letter-frequency/EchoLisp/letter-frequency-2.echolisp @@ -0,0 +1,24 @@ +(define (file-stats file string) + (set-plist! 'file-stats null) ; reset counters + (writeln (count-letters 'file-stats string)) + (writeln "Total letters:" (string-length string)) + (writeln "Total lines:" (getprop 'file-stats "#\\newline"))) + +; frequency for 'help.html' file +(file->string file-stats) ; browser 'open' dialog + +➛ help.html -> string +➛ (( 28918) (! 138) (# 1035) (#\newline 4539) (#\tab 409) ($ 7) (% 24) (& 136) (' 1643) ((3577) () 3583) (* 233) + (+ 303) (, 599) (- 3164) (. 1454) (/ 5388) (0 1567) (1 1769) (2 1258) (3 857) (4 1872) (5 453) (6 581) (7 344) + (8 337) (9 411) (: 1235) (; 647) (< 9951) (= 1834) (> 10255) (? 392) (@ 11) (A 166) (B 92) (C 144) (D 72) (E 224) + (F 52) (G 35) (H 42) (I 193) (J 31) (K 36) (L 196) (M 82) (N 94) (O 132) (P 192) (Q 27) (R 56) (S 220) (T 226) (U 37) + (V 51) (W 28) (X 6) (Y 38) (Z 2) ([ 237) (\ 12) (] 215) (^ 28) (_ 107) (` 7) (a 8420) (b 4437) (c 3879) (d 4201) + (e 11905) (f 2989) (g 2068) (h 3856) (i 11313) (j 334) (k 653) (l 5748) (m 3048) (n 7020) (o 7207) (p 3585) (q 249) + (r 8312) (s 8284) (t 8704) (u 3833) (v 1135) (w 861) (x 1172) (y 1451) (z 268) ({ 123) (| 62) (} 123) (~ 7) (§ 1) (© 1) + (« 1) (» 1) (É 2) (à 18) (â 3) (ç 3) (è 6) (é 53) (î 1) (ö 9) (û 1) (œ 1) (ε 2) (λ 12) (μ 1) (ο 2) (ς 1) + (τ 1) (а 1) (д 1) (е 1) (з 1) (л 1) (м 1) (н 1) (я 3) (ἄ 1) (— 2) (“ 2) (” 2) (… 184) (→ 465) (∅ 57) (∈ 4) (∏ 1) + (∑ 2) (∘ 6) (√ 4)(∞ 12) (∫ 2) (⌚ 2) (⌛ 1) (⏳ 4) (☕ 1) (♠ 7) (♡ 2) (♢ 2) (♣ 6) (♤ 2) (♥ 8) (♦ 8) + (♧ 2) (⚁ 1) (⚃ 2) (⚪ 1) (⛔ 1) (✋ 1) (❄ 1) (❅ 1) (❆ 1) (❇ 1) (❈ 1) (❉ 1) (❊ 1) (❋ 1) (❌ 3) (❍ 1) + (❎ 1) (❗ 1) (➛ 900) (➰ 1) (⭕ 2) ... ) +➛ Total letters: 212631 +➛ Total lines: 4539 diff --git a/Task/Letter-frequency/FreeBASIC/letter-frequency.freebasic b/Task/Letter-frequency/FreeBASIC/letter-frequency.freebasic new file mode 100644 index 0000000000..4caa043e31 --- /dev/null +++ b/Task/Letter-frequency/FreeBASIC/letter-frequency.freebasic @@ -0,0 +1,28 @@ +' FB 1.05.0 Win64 + +Dim a(65 to 90) As Integer ' array to hold frequency of each letter, all elements zero initially +Dim fileName As String = "input.txt" +Dim s As String +Dim i As Integer +Open fileName For Input As #1 + +While Not Eof(1) + Line Input #1, s + s = UCase(s) + For i = 0 To Len(s) - 1 + a(s[i]) += 1 + Next +Wend + +Close #1 + +Print "The frequency of each letter in the file "; fileName; " is as follows:" +Print +For i = 65 To 90 + If a(i) > 0 Then + Print Chr(i); " : "; a(i) + End If +Next +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Letter-frequency/Harbour/letter-frequency.harbour b/Task/Letter-frequency/Harbour/letter-frequency.harbour new file mode 100644 index 0000000000..d376d872f4 --- /dev/null +++ b/Task/Letter-frequency/Harbour/letter-frequency.harbour @@ -0,0 +1,24 @@ +PROCEDURE Main() + LOCAL s := hb_MemoRead( Left( __FILE__ , At( ".", __FILE__ )) +"prg") + LOCAL c, n, i + LOCAL a := {} + + FOR EACH c IN s + IF Asc( c ) > 31 + AAdd( a, c ) + ENDIF + NEXT + a := ASort( a ) + i := 1 + WHILE i <= Len( a ) + c := a[i] ; n := 1 + i++ + IF i < Len(a) .AND. c == a[i] + WHILE c == a[i] + n++ ; i++ + END + ENDIF + ?? "'" + c + "'" + "=" + hb_NtoS( n ) + " " + END + + RETURN diff --git a/Task/Letter-frequency/Lasso/letter-frequency.lasso b/Task/Letter-frequency/Lasso/letter-frequency.lasso new file mode 100644 index 0000000000..16cd86e79f --- /dev/null +++ b/Task/Letter-frequency/Lasso/letter-frequency.lasso @@ -0,0 +1,24 @@ +local( + str = 'Hello world!', + freq = map +) +// as a loop. arguably quicker than query expression +loop(#str->size) => { + #freq->keys !>> #str->get(loop_count) ? + #freq->insert(#str->get(loop_count) = #str->values->find(#str->get(loop_count))->size) +} + +// or +local( + str = 'Hello world!', + freq = map +) +// as query expression, less code +with i in #str->values where #freq->keys !>> #i do => { + #freq->insert(#i = #str->values->find(#i)->size) +} + +// output #freq +with elem in #freq->keys do => {^ + '"'+#elem+'": '+#freq->find(#elem)+'\r' +^} diff --git a/Task/Letter-frequency/Nim/letter-frequency.nim b/Task/Letter-frequency/Nim/letter-frequency.nim new file mode 100644 index 0000000000..c76f97f381 --- /dev/null +++ b/Task/Letter-frequency/Nim/letter-frequency.nim @@ -0,0 +1,8 @@ +import tables, os + +var t = initCountTable[char]() +var f = open(paramStr(1)) +for l in f.lines: + for c in l: + t.inc(c) +echo t diff --git a/Task/Letter-frequency/Phix/letter-frequency.phix b/Task/Letter-frequency/Phix/letter-frequency.phix new file mode 100644 index 0000000000..57692edd53 --- /dev/null +++ b/Task/Letter-frequency/Phix/letter-frequency.phix @@ -0,0 +1,17 @@ +sequence lc = repeat(0,#7E) +integer fn = open(command_line()[$],"rb"), ch +while 1 do + ch = getc(fn) + if ch=-1 then exit end if + if ch>=' ' and ch<#7F then + lc[ch] += 1 + end if +end while +close(fn) + +for i=' ' to #7E do + if lc[i]!=0 then + printf(1,"'%c': %d%s",{i,lc[i],iff(mod(i,32)=31?'\n':'\t')}) + end if +end for +{} = wait_key() diff --git a/Task/Letter-frequency/Ring/letter-frequency.ring b/Task/Letter-frequency/Ring/letter-frequency.ring new file mode 100644 index 0000000000..6dcab7e9a2 --- /dev/null +++ b/Task/Letter-frequency/Ring/letter-frequency.ring @@ -0,0 +1,14 @@ +textData = read("C:\Ring\ReadMe.txt") +ln =len(textData) +charCount = list(255) +totCount = 0 + +for i =1 to ln + char = ascii(substr(textData,i,1)) + charCount[char] = charCount[char] + 1 + if char > 31 totCount = totCount + 1 ok +next + +for i = 32 to 255 + if charCount[i] > 0 see char(i) + " = " + charCount[i] + " " + (charCount[i]/totCount)*100 + " %" + nl ok +next diff --git a/Task/Letter-frequency/Sidef/letter-frequency.sidef b/Task/Letter-frequency/Sidef/letter-frequency.sidef new file mode 100644 index 0000000000..4490da0c67 --- /dev/null +++ b/Task/Letter-frequency/Sidef/letter-frequency.sidef @@ -0,0 +1,9 @@ +func letter_frequency(File file) { + file.read.chars.grep{.match(/[[:alpha:]]/)} \ + .group_by {|letter| letter.downcase} \ + .map_val {|_, val| val.len} \ + .sort_by {|_, val| -val} +} + +var top = letter_frequency(File(__FILE__)) +top.each{|pair| say "#{pair[0]}: #{pair[1]}"} diff --git a/Task/Letter-frequency/jq/letter-frequency-1.jq b/Task/Letter-frequency/jq/letter-frequency-1.jq new file mode 100644 index 0000000000..884ae194ca --- /dev/null +++ b/Task/Letter-frequency/jq/letter-frequency-1.jq @@ -0,0 +1,9 @@ +# Input: an array of strings. +# Output: an object with the strings as keys, +# the values of which are the corresponding frequencies. +def counter: + reduce .[] as $item ( {}; .[$item] += 1 ) ; + +# For neatness we sort the keys: +explode | map( [.] | implode ) | counter | . as $counter + | keys | sort[] | [., $counter[.] ] diff --git a/Task/Letter-frequency/jq/letter-frequency-2.jq b/Task/Letter-frequency/jq/letter-frequency-2.jq new file mode 100644 index 0000000000..d958ae6ba7 --- /dev/null +++ b/Task/Letter-frequency/jq/letter-frequency-2.jq @@ -0,0 +1 @@ +jq -s -R -c -f Letter_frequency.jq somefile.txt diff --git a/Task/Levenshtein-distance/Arc/levenshtein-distance.arc b/Task/Levenshtein-distance/Arc/levenshtein-distance.arc new file mode 100644 index 0000000000..34e975d120 --- /dev/null +++ b/Task/Levenshtein-distance/Arc/levenshtein-distance.arc @@ -0,0 +1,16 @@ +(def levenshtein (str1 str2) + (withs l1 len.str1 + l2 len.str2 + row range0:inc.l1 + + (times j l2 + (let next list.j + (times i l1 + (push + (inc:min + car.next + ((if (is str1.i str2.j) dec id) car.row) + (car:zap cdr row)) + next)) + (= row nrev.next))) + row.l1)) diff --git a/Task/Levenshtein-distance/ERRE/levenshtein-distance.erre b/Task/Levenshtein-distance/ERRE/levenshtein-distance.erre new file mode 100644 index 0000000000..8433bff4a3 --- /dev/null +++ b/Task/Levenshtein-distance/ERRE/levenshtein-distance.erre @@ -0,0 +1,43 @@ +PROGRAM LEVENSHTEIN + +!$DYNAMIC + DIM D%[0,0] + +PROCEDURE LEVENSHTEIN(S$,T$->RES%) + LOCAL I%,J%,M% + FOR I%=0 TO LEN(S$) DO + D%[I%,0]=I% + END FOR + FOR J%=0 TO LEN(T$) DO + D%[0,J%]=J% + END FOR + FOR J%=1 TO LEN(T$) DO + FOR I%=1 TO LEN(S$) DO + IF MID$(S$,I%,1)=MID$(T$,J%,1) THEN + D%[I%,J%]=D%[I%-1,J%-1] + ELSE + M%=D%[I%-1,J%-1] + IF D%[I%,J%-1] '";T$;"' has distance ";) + !$DIM D%[LEN(S$),LEN(T$)] + LEVENSHTEIN(S$,T$->RES%) + PRINT(RES%) + !$ERASE D% + + S$="rosettacode" T$="raisethysword" + PRINT("'";S$;"' -> '";T$;"' has distance ";) + !$DIM D%[LEN(S$),LEN(T$)] + LEVENSHTEIN(S$,T$->RES%) + PRINT(RES%) + !$ERASE D% +END PROGRAM diff --git a/Task/Levenshtein-distance/EchoLisp/levenshtein-distance.echolisp b/Task/Levenshtein-distance/EchoLisp/levenshtein-distance.echolisp new file mode 100644 index 0000000000..1dc2e39fea --- /dev/null +++ b/Task/Levenshtein-distance/EchoLisp/levenshtein-distance.echolisp @@ -0,0 +1,28 @@ +;; Recursive version adapted from Clojure +;; Added necessary memoization + +(define (levenshtein str1 str2 (cost 0) (rest1 0) (rest2 0) (key null)) +(set! key (string-append str1 "|" str2)) +(if (get 'mem key) ;; memoized ? + (get 'mem key) +;; else memoize +(putprop 'mem + (let [(len1 (string-length str1)) + (len2 (string-length str2))] + (cond ((zero? len1) len2) + ((zero? len2) len1) + (else + (set! cost (if (= (string-first str1) (string-first str2)) 0 1)) + (set! rest1 (string-rest str1)) + (set! rest2 (string-rest str2)) + (min (1+ (levenshtein rest1 str2)) + (1+ (levenshtein str1 rest2)) + (+ cost + (levenshtein rest1 rest2 )))))) + key))) + +;; 😛 127 calls with memoization +;; 😰 29737 calls without memoization +(levenshtein "kitten" "sitting") → 3 + +(levenshtein "rosettacode" "raisethysword") → 8 diff --git a/Task/Levenshtein-distance/FreeBASIC/levenshtein-distance.freebasic b/Task/Levenshtein-distance/FreeBASIC/levenshtein-distance.freebasic new file mode 100644 index 0000000000..726b9c535a --- /dev/null +++ b/Task/Levenshtein-distance/FreeBASIC/levenshtein-distance.freebasic @@ -0,0 +1,49 @@ +' FB 1.05.0 Win64 + +' Uses the "iterative with two matrix rows" algorithm +' referred to in the Wikipedia article. + +Function min(x As Integer, y As Integer) As Integer + Return IIf(x < y, x, y) +End Function + +Function levenshtein(s As String, t As String) As Integer + ' degenerate cases + If s = t Then Return 0 + If s = "" Then Return Len(t) + If t = "" Then Return Len(s) + + ' create two integer arrays of distances + Dim v0(0 To Len(t)) As Integer '' previous + Dim v1(0 To Len(t)) As Integer '' current + + ' initialize v0 + For i As Integer = 0 To Len(t) + v0(i) = i + Next + + Dim cost As Integer + For i As Integer = 0 To Len(s) - 1 + ' calculate v1 from v0 + v1(0) = i + 1 + + For j As Integer = 0 To Len(t) - 1 + cost = IIf(s[i] = t[j], 0, 1) + v1(j + 1) = min(v1(j) + 1, min(v0(j + 1) + 1, v0(j) + cost)) + Next j + + ' copy v1 to v0 for next iteration + For j As Integer = 0 To Len(t) + v0(j) = v1(j) + Next j + Next i + + Return v1(Len(t)) +End Function + +Print "'kitten' to 'sitting' => "; levenshtein("kitten", "sitting") +Print "'rosettacode' to 'raisethysword' => "; levenshtein("rosettacode", "raisethysword") +Print "'sleep' to 'fleeting' => "; levenshtein("sleep", "fleeting") +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Levenshtein-distance/FutureBasic/levenshtein-distance.futurebasic b/Task/Levenshtein-distance/FutureBasic/levenshtein-distance.futurebasic new file mode 100644 index 0000000000..7c0e6f6031 --- /dev/null +++ b/Task/Levenshtein-distance/FutureBasic/levenshtein-distance.futurebasic @@ -0,0 +1,49 @@ +include "ConsoleWindow" + +local fn LevenshteinDistance( aStr as Str255, bStr as Str255 ) as long +dim as long m, n, i, j, min, k, l +dim as long distance( 255, 255 ) + +m = len(aStr) +n = len(bStr) + +for i = 0 to m + distance( i, 0 ) = i +next + +for j = 0 to n + distance( 0, j ) = j +next + +for j = 1 to n + for i = 1 to m + if mid$( aStr, i, 1 ) == mid$( bStr, j, 1 ) + distance( i, j ) = distance( i-1, j-1 ) + else + min = distance( i-1, j ) + 1 + k = distance( i, j - 1 ) + 1 + l = distance( i-1, j-1 ) + 1 + if k < min then min = k + if l < min then min = l + distance( i, j ) = min + end if + next +next +end fn = distance( m, n ) + +dim as long i +dim as Str255 testStr( 5, 2 ) + +testStr( 0, 0 ) = "kitten" : testStr( 0, 1 ) = "sitting" +testStr( 1, 0 ) = "rosettacode" : testStr( 1, 1 ) = "raisethysword" +testStr( 2, 0 ) = "Saturday" : testStr( 2, 1 ) = "Sunday" +testStr( 3, 0 ) = "FutureBasic" : testStr( 3, 1 ) = "FutureBasic" +testStr( 4, 0 ) = "here's a bunch of words" +testStr( 4, 1 ) = "to wring out this code" + +for i = 0 to 4 + print "1st string = "; testStr( i, 0 ) + print "2nd string = "; testStr( i, 1 ) + print "Levenshtein distance ="; fn LevenshteinDistance( testStr( i, 0 ), testStr( i, 1 ) ) + print +next diff --git a/Task/Levenshtein-distance/LFE/levenshtein-distance-1.lfe b/Task/Levenshtein-distance/LFE/levenshtein-distance-1.lfe new file mode 100644 index 0000000000..f02a5b7643 --- /dev/null +++ b/Task/Levenshtein-distance/LFE/levenshtein-distance-1.lfe @@ -0,0 +1,13 @@ +(defun levenshtein-simple + (('() str) + (length str)) + ((str '()) + (length str)) + (((cons a str1) (cons b str2)) (when (== a b)) + (levenshtein-simple str1 str2)) + (((= (cons _ str1-tail) str1) (= (cons _ str2-tail) str2)) + (+ 1 (lists:min + (list + (levenshtein-simple str1 str2-tail) + (levenshtein-simple str1-tail str2) + (levenshtein-simple str1-tail str2-tail)))))) diff --git a/Task/Levenshtein-distance/LFE/levenshtein-distance-2.lfe b/Task/Levenshtein-distance/LFE/levenshtein-distance-2.lfe new file mode 100644 index 0000000000..9a403e8e10 --- /dev/null +++ b/Task/Levenshtein-distance/LFE/levenshtein-distance-2.lfe @@ -0,0 +1,8 @@ +> (levenshtein-simple "a" "a") +0 +> (levenshtein-simple "a" "") +1 +> (levenshtein-simple "" "a") +1 +> (levenshtein-simple "kitten" "sitting") +3 diff --git a/Task/Levenshtein-distance/LFE/levenshtein-distance-3.lfe b/Task/Levenshtein-distance/LFE/levenshtein-distance-3.lfe new file mode 100644 index 0000000000..33835564b9 --- /dev/null +++ b/Task/Levenshtein-distance/LFE/levenshtein-distance-3.lfe @@ -0,0 +1,26 @@ +(defun levenshtein-distance (str1 str2) + (let (((tuple distance _) (levenshtein-distance + str1 str2 (dict:new)))) + distance)) + +(defun levenshtein-distance + (((= '() str1) str2 cache) + (tuple (length str2) + (dict:store (tuple str1 str2) + (length str2) + cache))) + ((str1 (= '() str2) cache) + (tuple (length str1) + (dict:store (tuple str1 str2) + (length str1) + cache))) + (((cons a str1) (cons b str2) cache) (when (== a b)) + (levenshtein-distance str1 str2 cache)) + (((= (cons _ str1-tail) str1) (= (cons _ str2-tail) str2) cache) + (case (dict:is_key (tuple str1 str2) cache) + ('true (tuple (dict:fetch (tuple str1 str2) cache) cache)) + ('false (let* (((tuple l1 c1) (levenshtein-distance str1 str2-tail cache)) + ((tuple l2 c2) (levenshtein-distance str1-tail str2 c1)) + ((tuple l3 c3) (levenshtein-distance str1-tail str2-tail c2)) + (len (+ 1 (lists:min (list l1 l2 l3))))) + (tuple len (dict:store (tuple str1 str2) len c3))))))) diff --git a/Task/Levenshtein-distance/LFE/levenshtein-distance-4.lfe b/Task/Levenshtein-distance/LFE/levenshtein-distance-4.lfe new file mode 100644 index 0000000000..41572eee5f --- /dev/null +++ b/Task/Levenshtein-distance/LFE/levenshtein-distance-4.lfe @@ -0,0 +1,10 @@ +> (levenshtein-distance "a" "a") +0 +> (levenshtein-distance "a" "") +1 +> (levenshtein-distance "" "a") +1 +> (levenshtein-distance "kitten" "sitting") +3 +> (levenshtein-distance "rosettacode" "raisethysword") +8 diff --git a/Task/Levenshtein-distance/Nim/levenshtein-distance.nim b/Task/Levenshtein-distance/Nim/levenshtein-distance.nim new file mode 100644 index 0000000000..f3f76354a2 --- /dev/null +++ b/Task/Levenshtein-distance/Nim/levenshtein-distance.nim @@ -0,0 +1,24 @@ +import sequtils + +proc levenshteinDistance(s1, s2): int = + var (s1, s2) = (s1, s2) + + if s1.len > s2.len: + swap s1, s2 + + var distances = toSeq(0..s1.len) + + for i2, c2 in s2: + var newDistances = @[i2+1] + for i1, c1 in s1: + if c1 == c2: + newDistances.add(distances[i1]) + else: + newDistances.add(1 + min(distances[i1], distances[i1+1], + newDistances[newDistances.high])) + + distances = newDistances + result = distances[distances.high] + +echo levenshteinDistance("kitten","sitting") +echo levenshteinDistance("rosettacode","raisethysword") diff --git a/Task/Levenshtein-distance/Phix/levenshtein-distance.phix b/Task/Levenshtein-distance/Phix/levenshtein-distance.phix new file mode 100644 index 0000000000..899a088f7f --- /dev/null +++ b/Task/Levenshtein-distance/Phix/levenshtein-distance.phix @@ -0,0 +1,35 @@ +function levenshtein(sequence s1, sequence s2) +integer n = length(s1)+1, + m = length(s2)+1 +sequence d + + if n=1 then + return m-1 + elsif m=1 then + return n-1 + end if + + d = repeat(repeat(0, m), n) + for i=1 to n do + d[i][1] = i-1 + end for + + for j=1 to m do + d[1][j] = j-1 + end for + + for i=2 to n do + for j=2 to m do + d[i][j] = min({ + d[i-1][j]+1, + d[i][j-1]+1, + d[i-1][j-1]+(s1[i-1]!=s2[j-1]) + }) + end for + end for + + return d[n][m] +end function + +?levenshtein("kitten", "sitting") +?levenshtein("rosettacode", "raisethysword") diff --git a/Task/Levenshtein-distance/Sidef/levenshtein-distance-1.sidef b/Task/Levenshtein-distance/Sidef/levenshtein-distance-1.sidef new file mode 100644 index 0000000000..95cbd3f08f --- /dev/null +++ b/Task/Levenshtein-distance/Sidef/levenshtein-distance-1.sidef @@ -0,0 +1,15 @@ +func lev(s, t) is cached { + + s.is_empty && return t.len; + t.is_empty && return s.len; + + var s1 = s.ft(1); + var t1 = t.ft(1); + + s[0] == t[0] ? __FUNC__(s1, t1) + : 1+[ + __FUNC__(s1, t1), + __FUNC__(s, t1), + __FUNC__(s1, t ) + ].min; +} diff --git a/Task/Levenshtein-distance/Sidef/levenshtein-distance-2.sidef b/Task/Levenshtein-distance/Sidef/levenshtein-distance-2.sidef new file mode 100644 index 0000000000..5467d05314 --- /dev/null +++ b/Task/Levenshtein-distance/Sidef/levenshtein-distance-2.sidef @@ -0,0 +1,11 @@ +func lev(s, t) { + var d = [@(0 .. t.len), s.len.of {[_]}...] + for i,j in (^s ~X ^t) { + d[i+1][j+1] = ( + s[i] == t[j] + ? d[i][j] + : 1+Math.min(d[i][j+1], d[i+1][j], d[i][j]) + ) + } + d[-1][-1] +} diff --git a/Task/Levenshtein-distance/Sidef/levenshtein-distance-3.sidef b/Task/Levenshtein-distance/Sidef/levenshtein-distance-3.sidef new file mode 100644 index 0000000000..ff389e59fa --- /dev/null +++ b/Task/Levenshtein-distance/Sidef/levenshtein-distance-3.sidef @@ -0,0 +1,2 @@ +say lev(%c'kitten', %c'sitting'); # prints: 3 +say lev(%c'rosettacode', %c'raisethysword'); # prints: 8 diff --git a/Task/Levenshtein-distance/Swift/levenshtein-distance-1.swift b/Task/Levenshtein-distance/Swift/levenshtein-distance-1.swift new file mode 100644 index 0000000000..0ee9918d38 --- /dev/null +++ b/Task/Levenshtein-distance/Swift/levenshtein-distance-1.swift @@ -0,0 +1,15 @@ +func levDis(w1: String, w2: String) -> Int { + + let (t, s) = (w1.characters, w2.characters) + + let empty = Repeat(count: s.count, repeatedValue: 0) + var mat = [[Int](0...s.count)] + (1...t.count).map{[$0] + empty} + + for (i, tLett) in t.enumerate() { + for (j, sLett) in s.enumerate() { + mat[i + 1][j + 1] = tLett == sLett ? + mat[i][j] : min(mat[i][j], mat[i][j + 1], mat[i + 1][j]).successor() + } + } + return mat.last!.last! +} diff --git a/Task/Levenshtein-distance/Swift/levenshtein-distance-2.swift b/Task/Levenshtein-distance/Swift/levenshtein-distance-2.swift new file mode 100644 index 0000000000..04c7bc885f --- /dev/null +++ b/Task/Levenshtein-distance/Swift/levenshtein-distance-2.swift @@ -0,0 +1,16 @@ +func levDis(w1: String, w2: String) -> Int { + + let (t, s) = (w1.characters, w2.characters) + + let empty = Repeat(count: s.count, repeatedValue: 0) + var last = [Int](0...s.count) + + for (i, tLett) in t.enumerate() { + var cur = [i + 1] + empty + for (j, sLett) in s.enumerate() { + cur[j + 1] = tLett == sLett ? last[j] : min(last[j], last[j + 1], cur[j]).successor() + } + last = cur + } + return last.last! +} diff --git a/Task/Levenshtein-distance/jq/levenshtein-distance-1.jq b/Task/Levenshtein-distance/jq/levenshtein-distance-1.jq new file mode 100644 index 0000000000..a17b686475 --- /dev/null +++ b/Task/Levenshtein-distance/jq/levenshtein-distance-1.jq @@ -0,0 +1,51 @@ +# lookup the distance between s and t in the nested cache, +# which uses basic properties of the Levenshtein distance to save space: +def lookup(s;t): + if (s == t) then 0 + elif (s|length) == 0 then (t|length) + elif (t|length) == 0 then (s|length) + elif (s|length) > (t|length) then + .[t] as $t | if $t then $t[s] else null end + else .[s] as $s | if $s then $s[t] else null end + end ; + +# output is the updated cache; +# basic properties of the Levenshtein distance are used to save space: +def store(s;t;value): + if (s == t) then . + else (s|length) as $s | (t|length) as $t + | if $s == 0 or $t == 0 then . + elif $s < $t then .[s][t] = value + elif $t < $s then .[t][s] = value + else (.[s][t] = value) | (.[t][s] = value) + end + end ; + +# Input is a cache of nested objects; output is [distance, cache] +def ld(s1; s2): + + # emit [distance, cache] + # input: cache + def cached_ld(s;t): + lookup(s;t) as $check + | if $check then [ $check, . ] + else ld(s;t) + end + ; + + # If either string is empty, + # then distance is insertion of the other's characters. + if (s1|length) == 0 then [(s2|length), .] + elif (s2|length) == 0 then [(s1|length), .] + elif (s1[0:1] == s2[0:1]) then + cached_ld(s1[1:]; s2[1:]) + else + cached_ld(s1[1:]; s2) as $a + | ($a[1] | cached_ld(s1; s2[1:])) as $b + | ($b[1] | cached_ld(s1[1:]; s2[1:])) as $c + | [$a[0], $b[0], $c[0]] | (min + 1) as $d + | [$d, ($c[1] | store(s1;s2;$d)) ] + end ; + +def levenshteinDistance(s;t): + s as $s | t as $t | {} | ld($s;$t) | .[0]; diff --git a/Task/Levenshtein-distance/jq/levenshtein-distance-2.jq b/Task/Levenshtein-distance/jq/levenshtein-distance-2.jq new file mode 100644 index 0000000000..589e5e736a --- /dev/null +++ b/Task/Levenshtein-distance/jq/levenshtein-distance-2.jq @@ -0,0 +1,8 @@ +def demo: + "levenshteinDistance between \(.[0]) and \(.[1]) is \( levenshteinDistance(.[0]; .[1]) )"; + +(["kitten", "sitting"] | demo), +(["rosettacode","raisethysword"] | demo), +(["edocattesor", "drowsyhtesiar"] | demo), +(["this_algorithm_is_similar_to", + "Damerau-Levenshtein_distance"] | demo) diff --git a/Task/Linear-congruential-generator/ERRE/linear-congruential-generator.erre b/Task/Linear-congruential-generator/ERRE/linear-congruential-generator.erre new file mode 100644 index 0000000000..ceb401a4e9 --- /dev/null +++ b/Task/Linear-congruential-generator/ERRE/linear-congruential-generator.erre @@ -0,0 +1,34 @@ +PROGRAM RNG + +!$DOUBLE + +DIM CARDS%[52] + +PROCEDURE XRANDOM(SEED->XRND) + POW31=2^31 + POW16=2^16 + SEED=SEED*214013+2531011 + SEED=SEED-POW31*INT(SEED/POW31) + XRND=INT(SEED/POW16) +END PROCEDURE + +PROCEDURE YRANDOM(SEED->YRND) + POW31=2^31 + SEED=SEED*1103515245+12345 + SEED=SEED-POW31*INT(SEED/POW31) + YRND=SEED +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) + SEED=0 PRINT("BSD:") + FOR I%=1 TO 10 DO + YRANDOM(SEED->YRND) + PRINT(TAB(10);YRND) + END FOR + SEED=0 PRINT("MSD:") + FOR I%=1 TO 10 DO + XRANDOM(SEED->XRND) + PRINT(TAB(10);XRND) + END FOR +END PROGRAM diff --git a/Task/Linear-congruential-generator/FreeBASIC/linear-congruential-generator.freebasic b/Task/Linear-congruential-generator/FreeBASIC/linear-congruential-generator.freebasic new file mode 100644 index 0000000000..8a26c4c140 --- /dev/null +++ b/Task/Linear-congruential-generator/FreeBASIC/linear-congruential-generator.freebasic @@ -0,0 +1,57 @@ +' version 04-11-2016 +' compile with: fbc -s console + +' to seed BSD_lcg(seed > -1) +' to get random number BSD_lcg(-1) or BSD_lcg() or just BSD_lcg +Function BSD_lcg(seed As UInteger = -1) As UInteger + + Static As UInteger bsd_state + + If seed <> -1 Then + bsd_state = seed Mod 2 ^ 31 + Else + bsd_state = (1103515245 * bsd_state + 12345) Mod 2 ^ 31 + End If + + Return bsd_state + +End Function + +' to seed ms_lcg(seed > -1) +' to get random number ms_lcg(-1) or ms_lcg() or just ms_lcg +Function ms_lcg(seed As Integer = -1) As UInteger + + Static As UInteger ms_state + + If seed <> -1 Then + ms_state = seed Mod 2 ^ 31 + Else + ms_state = (214013 * ms_state + 2531011) Mod 2 ^ 31 + End If + + Return ms_state Shr 16 + +End Function + +' ------=< MAIN >=------ + +Dim As Long i + +Print "MS generator" +' ms_lcg(0) ' state = 0 at the start of the program +For i = 1 To 10 + Print Using "###########"; ms_lcg +Next + +Print +Print "BSD generator" +' BSD_lcg(0) ' state = 0 at the start of the program +For i = 1 To 10 + Print Using "###########"; BSD_lcg +Next + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Linear-congruential-generator/Nim/linear-congruential-generator.nim b/Task/Linear-congruential-generator/Nim/linear-congruential-generator.nim new file mode 100644 index 0000000000..a50dbf2ae4 --- /dev/null +++ b/Task/Linear-congruential-generator/Nim/linear-congruential-generator.nim @@ -0,0 +1,13 @@ +proc bsdRand(seed: int): iterator: int = + var seed = seed + result = iterator: int = + while true: + seed = (1103515245 * seed + 12345) and 0x7fffffff + yield seed + +proc msvcrtRand(seed: int): iterator: int = + var seed = seed + result = iterator: int = + while true: + seed = (214013 * seed + 2531011) and 0x7fffffff + yield seed diff --git a/Task/Linear-congruential-generator/Oforth/linear-congruential-generator.oforth b/Task/Linear-congruential-generator/Oforth/linear-congruential-generator.oforth new file mode 100644 index 0000000000..18862d3fb4 --- /dev/null +++ b/Task/Linear-congruential-generator/Oforth/linear-congruential-generator.oforth @@ -0,0 +1,4 @@ +: genLCG(a, c, m, seed) +| ch | + Channel newSize(1) dup send(seed) drop ->ch + #[ ch receive a * c + m mod dup ch send drop ] ; diff --git a/Task/Linear-congruential-generator/Sidef/linear-congruential-generator.sidef b/Task/Linear-congruential-generator/Sidef/linear-congruential-generator.sidef new file mode 100644 index 0000000000..cf038cff4c --- /dev/null +++ b/Task/Linear-congruential-generator/Sidef/linear-congruential-generator.sidef @@ -0,0 +1,30 @@ +module LCG { + + # Creates a linear congruential generator and remembers the initial seed. + class Common(r) { + has seed = r + } + + # LCG::Berkeley generates 31-bit integers using the same formula + # as BSD rand(). + class Berkeley < Common { + method rand { + self.r = ((1103515245 * self.r + 12345) & 0x7fff_ffff); + } + } + + # LCG::Microsoft generates 15-bit integers using the same formula + # as rand() from the Microsoft C Runtime. + class Microsoft < Common { + method rand { + self.r = ((214013 * self.r + 2531011) & 0x7fff_ffff); + self.r >> 16; + } + } +} + +var lcg1 = LCG::Berkeley(1) +say 5.of { lcg1.rand } + +var lcg2 = LCG::Microsoft(1) +say 5.of { lcg2.rand } diff --git a/Task/Linear-congruential-generator/Sparkling/linear-congruential-generator-1.sparkling b/Task/Linear-congruential-generator/Sparkling/linear-congruential-generator-1.sparkling new file mode 100644 index 0000000000..65f5168e06 --- /dev/null +++ b/Task/Linear-congruential-generator/Sparkling/linear-congruential-generator-1.sparkling @@ -0,0 +1,20 @@ +var states = { + "BSD": 0, + "MS": 0 +}; + +function BSD_seed(n) { + states.BSD = n; +} + +function BSD_rand() { + return states.BSD = (1103515245 * states.BSD + 12345) % (1 << 31); +} + +function Microsoft_seed(n) { + states.MS = n; +} + +function Microsoft_rand() { + return (states.MS = (214013 * states.MS + 2531011) % (1 << 31)) % (1 << 15); +} diff --git a/Task/Linear-congruential-generator/Sparkling/linear-congruential-generator-2.sparkling b/Task/Linear-congruential-generator/Sparkling/linear-congruential-generator-2.sparkling new file mode 100644 index 0000000000..d78424dc28 --- /dev/null +++ b/Task/Linear-congruential-generator/Sparkling/linear-congruential-generator-2.sparkling @@ -0,0 +1,22 @@ +spn:8> Microsoft_seed(0); +spn:9> Microsoft_rand() += 7875 +spn:10> Microsoft_rand() += 3706 +spn:11> Microsoft_rand() += 23381 +spn:12> Microsoft_rand() += 8388 +spn:13> Microsoft_rand() += 19575 +spn:14> BSD_seed(0); +spn:15> BSD_rand() += 12345 +spn:16> BSD_rand() += 1406932606 +spn:17> BSD_rand() += 654583775 +spn:18> BSD_rand() += 1449466924 +spn:19> BSD_rand() += 229283573 diff --git a/Task/Linear-congruential-generator/Swift/linear-congruential-generator.swift b/Task/Linear-congruential-generator/Swift/linear-congruential-generator.swift new file mode 100644 index 0000000000..6de262c186 --- /dev/null +++ b/Task/Linear-congruential-generator/Swift/linear-congruential-generator.swift @@ -0,0 +1,47 @@ +import Cocoa + +class LinearCongruntialGenerator { + + var state = 0 //seed of 0 by default + let a, c, m, shift: Int + + //we will use microsoft random by default + init() { + self.a = 214013 + self.c = 2531011 + self.m = Int(pow(2.0, 31.0)) //2^31 or 2147483648 + self.shift = 16 + } + + init(a: Int, c: Int, m: Int, shift: Int) { + self.a = a + self.c = c + self.m = m //2^31 or 2147483648 + self.shift = shift + } + + func seed(seed: Int) -> Void { + state = seed; + } + + func random() -> Int { + state = (a * state + c) % m + return state >> shift + } +} + +let microsoftLinearCongruntialGenerator = LinearCongruntialGenerator() +let BSDLinearCongruntialGenerator = LinearCongruntialGenerator(a: 1103515245, c: 12345, m: 2147483648, shift: 0) + +print("Microsft Rand:") +for(var i = 0; i < 10; i++) +{ + print(microsoftLinearCongruntialGenerator.random()) +} + +print("") //new line for readability +print("BSD Rand:") +for(var i = 0; i < 10; i++) +{ + print(BSDLinearCongruntialGenerator.random()) +} diff --git a/Task/Linear-congruential-generator/jq/linear-congruential-generator-1.jq b/Task/Linear-congruential-generator/jq/linear-congruential-generator-1.jq new file mode 100644 index 0000000000..d0a5f468ec --- /dev/null +++ b/Task/Linear-congruential-generator/jq/linear-congruential-generator-1.jq @@ -0,0 +1,14 @@ +# 15-bit integers generated using the same formula as rand() +# from the Microsoft C Runtime. +# Input: [ count, state, rand ] +def next_rand_Microsoft: + .[0] as $count | .[1] as $state + | ( (214013 * $state) + 2531011) % 2147483648 # mod 2^31 + | [$count+1 , ., (. / 65536 | floor) ]; + +# Generate the first n pseudo-random numbers: +def rand_Microsoft(seed; n): + [0,seed] + | next_rand_Microsoft # the seed is not so random + | recurse(if .[0] < n then next_rand_Microsoft else empty end) + | .[2]; diff --git a/Task/Linear-congruential-generator/jq/linear-congruential-generator-2.jq b/Task/Linear-congruential-generator/jq/linear-congruential-generator-2.jq new file mode 100644 index 0000000000..1d946edbe5 --- /dev/null +++ b/Task/Linear-congruential-generator/jq/linear-congruential-generator-2.jq @@ -0,0 +1,5 @@ +41 +18467 +6334 +26500 +19169 diff --git a/Task/Linear-congruential-generator/jq/linear-congruential-generator-3.jq b/Task/Linear-congruential-generator/jq/linear-congruential-generator-3.jq new file mode 100644 index 0000000000..76101e393f --- /dev/null +++ b/Task/Linear-congruential-generator/jq/linear-congruential-generator-3.jq @@ -0,0 +1,14 @@ +# BSD rand() +# Input: [count, previous] +def next_rand_berkeley: + long_multiply("1103515245" ; .[1]|tostring) as $lm + | long_add( $lm; "12345") as $la + # mod 2^31 + | [.[0] + 1, (long_mod( $la; "2147483648") | tonumber) ]; + +# Generate n values +def rand_berkeley(seed; n): + [0, seed] + | next_rand_berkeley # skip the seed itself + | recurse(if .[0] < n then next_rand_berkeley else empty end) + | .[1]; diff --git a/Task/Linear-congruential-generator/jq/linear-congruential-generator-4.jq b/Task/Linear-congruential-generator/jq/linear-congruential-generator-4.jq new file mode 100644 index 0000000000..a8bf65b4c7 --- /dev/null +++ b/Task/Linear-congruential-generator/jq/linear-congruential-generator-4.jq @@ -0,0 +1,5 @@ +1103527590 +377401575 +662824084 +1147902781 +2035015474 diff --git a/Task/List-comprehensions/EchoLisp/list-comprehensions.echolisp b/Task/List-comprehensions/EchoLisp/list-comprehensions.echolisp new file mode 100644 index 0000000000..5079a13b84 --- /dev/null +++ b/Task/List-comprehensions/EchoLisp/list-comprehensions.echolisp @@ -0,0 +1,8 @@ +;; copied from Racket + +(for*/list ([x (in-range 1 21)] +[y (in-range x 21)] +[z (in-range y 21)]) +#:when (= (+ (* x x) (* y y)) (* z z)) +(list x y z)) + → ((3 4 5) (5 12 13) (6 8 10) (8 15 17) (9 12 15) (12 16 20)) diff --git a/Task/List-comprehensions/FunL/list-comprehensions.funl b/Task/List-comprehensions/FunL/list-comprehensions.funl new file mode 100644 index 0000000000..2aef43de64 --- /dev/null +++ b/Task/List-comprehensions/FunL/list-comprehensions.funl @@ -0,0 +1,3 @@ +def triples( n ) = [(a, b, c) | a <- 1..n-2, b <- a+1..n-1, c <- b+1..n if a^2 + b^2 == c^2] + +println( triples(20) ) diff --git a/Task/List-comprehensions/Lasso/list-comprehensions-1.lasso b/Task/List-comprehensions/Lasso/list-comprehensions-1.lasso new file mode 100644 index 0000000000..67c4e54e43 --- /dev/null +++ b/Task/List-comprehensions/Lasso/list-comprehensions-1.lasso @@ -0,0 +1,11 @@ +#!/usr/bin/lasso9 + +local(n = 20) +local(triples = + with x in generateSeries(1, #n), + y in generateSeries(#x, #n), + z in generateSeries(#y, #n) + where #x*#x + #y*#y == #z*#z + select (:#x, #y, #z) +) +#triples->join('\n') diff --git a/Task/List-comprehensions/Lasso/list-comprehensions-2.lasso b/Task/List-comprehensions/Lasso/list-comprehensions-2.lasso new file mode 100644 index 0000000000..87f8bf6b98 --- /dev/null +++ b/Task/List-comprehensions/Lasso/list-comprehensions-2.lasso @@ -0,0 +1,6 @@ +staticarray(3, 4, 5) +staticarray(5, 12, 13) +staticarray(6, 8, 10) +staticarray(8, 15, 17) +staticarray(9, 12, 15) +staticarray(12, 16, 20) diff --git a/Task/List-comprehensions/Nim/list-comprehensions.nim b/Task/List-comprehensions/Nim/list-comprehensions.nim new file mode 100644 index 0000000000..abd6add1e2 --- /dev/null +++ b/Task/List-comprehensions/Nim/list-comprehensions.nim @@ -0,0 +1,50 @@ +import macros + +type ListComprehension = object +var lc*: ListComprehension + +macro `[]`*(lc: ListComprehension, x, t): expr = + expectLen(x, 3) + expectKind(x, nnkInfix) + expectKind(x[0], nnkIdent) + assert($x[0].ident == "|") + + result = newCall( + newDotExpr( + newIdentNode("result"), + newIdentNode("add")), + x[1]) + + for i in countdown(x[2].len-1, 0): + let y = x[2][i] + expectKind(y, nnkInfix) + expectMinLen(y, 1) + if y[0].kind == nnkIdent and $y[0].ident == "<-": + expectLen(y, 3) + result = newNimNode(nnkForStmt).add(y[1], y[2], result) + else: + result = newIfStmt((y, result)) + + result = newNimNode(nnkCall).add( + newNimNode(nnkPar).add( + newNimNode(nnkLambda).add( + newEmptyNode(), + newEmptyNode(), + newEmptyNode(), + newNimNode(nnkFormalParams).add( + newNimNode(nnkBracketExpr).add( + newIdentNode("seq"), + t)), + newEmptyNode(), + newEmptyNode(), + newStmtList( + newAssignment( + newIdentNode("result"), + newNimNode(nnkPrefix).add( + newIdentNode("@"), + newNimNode(nnkBracket))), + result)))) + +const n = 20 +echo lc[(x,y,z) | (x <- 1..n, y <- x..n, z <- y..n, x*x + y*y == z*z), + tuple[a,b,c: int]] diff --git a/Task/List-comprehensions/Ring/list-comprehensions.ring b/Task/List-comprehensions/Ring/list-comprehensions.ring new file mode 100644 index 0000000000..0b1cd3acb1 --- /dev/null +++ b/Task/List-comprehensions/Ring/list-comprehensions.ring @@ -0,0 +1,8 @@ +for x = 1 to 20 + for y = x to 20 + for z = y to 20 + if pow(x,2) + pow(y,2) = pow(z,2) + see "[" + x + "," + y + "," + z + "]" + nl ok + next + next +next diff --git a/Task/List-comprehensions/Sidef/list-comprehensions.sidef b/Task/List-comprehensions/Sidef/list-comprehensions.sidef new file mode 100644 index 0000000000..576ae30a54 --- /dev/null +++ b/Task/List-comprehensions/Sidef/list-comprehensions.sidef @@ -0,0 +1,10 @@ +var n = 20 +say gather { + for x in (1 .. n) { + for y in (x .. n) { + for z in (y .. n) { + take([x,y,z]) if (x*x + y*y == z*z) + } + } + } +} diff --git a/Task/List-comprehensions/jq/list-comprehensions-1.jq b/Task/List-comprehensions/jq/list-comprehensions-1.jq new file mode 100644 index 0000000000..8edfacafc6 --- /dev/null +++ b/Task/List-comprehensions/jq/list-comprehensions-1.jq @@ -0,0 +1,4 @@ +def triples(n): + range(1;n+1) as $x | range($x;n+1) as $y | range($y;n+1) as $z + | select($x*$x + $y*$y == $z*$z) + | [$x, $y, $z] ; diff --git a/Task/List-comprehensions/jq/list-comprehensions-2.jq b/Task/List-comprehensions/jq/list-comprehensions-2.jq new file mode 100644 index 0000000000..7a21f4d2e5 --- /dev/null +++ b/Task/List-comprehensions/jq/list-comprehensions-2.jq @@ -0,0 +1,10 @@ +# listof( stream; criterion) constructs an array of those +# elements in the stream that satisfy the criterion +def listof( stream; criterion): [ stream|select(criterion) ]; + +def listof_triples(n): + listof( range(1;n+1) as $x | range($x;n+1) as $y | range($y;n+1) as $z + | [$x, $y, $z]; + .[0] * .[0] + .[1] * .[1] == .[2] * .[2] ) ; + +listof_triples(20) diff --git a/Task/Literals-Floating-point/Axe/literals-floating-point-1.axe b/Task/Literals-Floating-point/Axe/literals-floating-point-1.axe new file mode 100644 index 0000000000..2b0209e58d --- /dev/null +++ b/Task/Literals-Floating-point/Axe/literals-floating-point-1.axe @@ -0,0 +1,2 @@ +123→float{L₁} +float{L₁}→I diff --git a/Task/Literals-Floating-point/Axe/literals-floating-point-2.axe b/Task/Literals-Floating-point/Axe/literals-floating-point-2.axe new file mode 100644 index 0000000000..976cc9ec66 --- /dev/null +++ b/Task/Literals-Floating-point/Axe/literals-floating-point-2.axe @@ -0,0 +1 @@ +12.25→A diff --git a/Task/Literals-Floating-point/FreeBASIC/literals-floating-point.freebasic b/Task/Literals-Floating-point/FreeBASIC/literals-floating-point.freebasic new file mode 100644 index 0000000000..2c962278e9 --- /dev/null +++ b/Task/Literals-Floating-point/FreeBASIC/literals-floating-point.freebasic @@ -0,0 +1,14 @@ +' FB 1.05.0 Win64 (default dialect) + +Dim a As Double = 123.456 +Dim b As Double = -123.0 +Dim c As Double = -123.0d +Dim d As Double = -123e +Dim e As Double = 743.1e+13 +Dim f As Double = 743.1D-13 +Dim g As Double = 743.1E13 +Dim h As Single = 743D! Rem ! overrides D +Dim i As Single = 3.1! +Dim j As Single = -123.456e-7f +Dim k As Double = 0# +Dim l As Double = 3.141592653589e3# diff --git a/Task/Literals-Floating-point/Lasso/literals-floating-point.lasso b/Task/Literals-Floating-point/Lasso/literals-floating-point.lasso new file mode 100644 index 0000000000..668d408fcb --- /dev/null +++ b/Task/Literals-Floating-point/Lasso/literals-floating-point.lasso @@ -0,0 +1,6 @@ +0.0 +0.1 +-0.1 +1.2e3 +1.3e+3 +1.2e-3 diff --git a/Task/Literals-Floating-point/Lingo/literals-floating-point.lingo b/Task/Literals-Floating-point/Lingo/literals-floating-point.lingo new file mode 100644 index 0000000000..a4f55370d6 --- /dev/null +++ b/Task/Literals-Floating-point/Lingo/literals-floating-point.lingo @@ -0,0 +1,23 @@ +put 0.23 +-- 0.2300 + +-- activate higher printing precision +the floatPrecision = 8 + +put -.23 +-- -0.23000000 + +put 9.00719925474099e15 +-- 9.00719925474099e15 + +-- result is NOT a float +put 2/3 +-- 0 + +-- casting integer to float +put float(2)/3 +-- 0.66666667 + +-- casting string to float +put float("0.23") +-- 0.23000000 diff --git a/Task/Literals-Floating-point/Nim/literals-floating-point.nim b/Task/Literals-Floating-point/Nim/literals-floating-point.nim new file mode 100644 index 0000000000..fda4feb898 --- /dev/null +++ b/Task/Literals-Floating-point/Nim/literals-floating-point.nim @@ -0,0 +1,12 @@ +var x: float +x = 2.3 +x = 2.0 +x = 0.3 +x = 123_456_789.000_000_1 +x = 2e10 +x = 2.5e10 +x = 2.523_123E10 +x = 5.2e-10 + +var y = 2'f32 # Automatically a float32 +var z = 2'f64 # Automatically a float64 diff --git a/Task/Literals-Floating-point/Oforth/literals-floating-point.oforth b/Task/Literals-Floating-point/Oforth/literals-floating-point.oforth new file mode 100644 index 0000000000..d5667e2b5a --- /dev/null +++ b/Task/Literals-Floating-point/Oforth/literals-floating-point.oforth @@ -0,0 +1,5 @@ +3.14 +1.0e-12 +0.13 +1000.0 +.22 diff --git a/Task/Literals-Floating-point/Phix/literals-floating-point.phix b/Task/Literals-Floating-point/Phix/literals-floating-point.phix new file mode 100644 index 0000000000..411a726792 --- /dev/null +++ b/Task/Literals-Floating-point/Phix/literals-floating-point.phix @@ -0,0 +1,7 @@ +?1e+12 -- (same as 1e12) +?1e-12 +?5 -- (same as 5.0) +--?1. -- (illegal, use 1 or 1.0) +?.1 -- (same as 0.1) +?1/3 -- 0.333333 +printf(1,"%g %G\n",1e-30) diff --git a/Task/Literals-Floating-point/Sidef/literals-floating-point.sidef b/Task/Literals-Floating-point/Sidef/literals-floating-point.sidef new file mode 100644 index 0000000000..1074c680d8 --- /dev/null +++ b/Task/Literals-Floating-point/Sidef/literals-floating-point.sidef @@ -0,0 +1,4 @@ +say 1.234; +say .1234; +say 1234e-5; +say 12.34e5; diff --git a/Task/Literals-Floating-point/Swift/literals-floating-point.swift b/Task/Literals-Floating-point/Swift/literals-floating-point.swift new file mode 100644 index 0000000000..0f1c09b4db --- /dev/null +++ b/Task/Literals-Floating-point/Swift/literals-floating-point.swift @@ -0,0 +1,9 @@ +let double = 1.0 as Double // Double precision +let float = 1.0 as Float // Single precision +let scientific = 1.0E-12 + +// Swift does not feature type coercion for explicit type declaration +let sum = double + float // Error + +let div = 1.1 / 2 // Double +let div1 = 1 / 2 // 0 diff --git a/Task/Literals-Floating-point/Ursa/literals-floating-point.ursa b/Task/Literals-Floating-point/Ursa/literals-floating-point.ursa new file mode 100644 index 0000000000..fa48bc9a76 --- /dev/null +++ b/Task/Literals-Floating-point/Ursa/literals-floating-point.ursa @@ -0,0 +1,11 @@ +1. +1.0 +2432311.7567374 +1.234E-10 +1.234e-10 +758832d +728832f +1.0f +758832D +728832F +1.0F diff --git a/Task/Literals-Floating-point/jq/literals-floating-point.jq b/Task/Literals-Floating-point/jq/literals-floating-point.jq new file mode 100644 index 0000000000..86a4223596 --- /dev/null +++ b/Task/Literals-Floating-point/jq/literals-floating-point.jq @@ -0,0 +1,7 @@ +1.0 => 1 +1.2 => 1.2 +1e10 => 10000000000 +1e100 => 1e+100 +1e1234 => 1.7976931348623157e+308 +.1 => 0.1 +.1e1 => 1 diff --git a/Task/Literals-Integer/Axe/literals-integer.axe b/Task/Literals-Integer/Axe/literals-integer.axe new file mode 100644 index 0000000000..cc236f0fe1 --- /dev/null +++ b/Task/Literals-Integer/Axe/literals-integer.axe @@ -0,0 +1,3 @@ +123 +ᴇFACE +π101010 diff --git a/Task/Literals-Integer/Comal/literals-integer.comal b/Task/Literals-Integer/Comal/literals-integer.comal new file mode 100644 index 0000000000..be955ce52b --- /dev/null +++ b/Task/Literals-Integer/Comal/literals-integer.comal @@ -0,0 +1,2 @@ +IF 37=$25 THEN PRINT "True" +IF 37=%00100101 THEN PRINT "True" diff --git a/Task/Literals-Integer/ERRE/literals-integer.erre b/Task/Literals-Integer/ERRE/literals-integer.erre new file mode 100644 index 0000000000..d5920153de --- /dev/null +++ b/Task/Literals-Integer/ERRE/literals-integer.erre @@ -0,0 +1,4 @@ +PRINT(17) +PRINT(&21) +PRINT($11) +PRINT(%1001) diff --git a/Task/Literals-Integer/FreeBASIC/literals-integer.freebasic b/Task/Literals-Integer/FreeBASIC/literals-integer.freebasic new file mode 100644 index 0000000000..32fd40f1a4 --- /dev/null +++ b/Task/Literals-Integer/FreeBASIC/literals-integer.freebasic @@ -0,0 +1,20 @@ +' FB 1.05.0 Win64 + +' The following all print 64 to the console + +' integer literals of unspecified type - actual type is inferred from size or context (8, 16, 32 or 64 bit signed/unsigned) +Print 64 '' Decimal literal +Print &H40 '' Hexadecimal literal +Print &O100 '' Octal Literal +Print &B1000000 '' Binary literal + +' integer literals of specific types +' Integer type is 4 bytes on 32 bit and 8 bytes on 64 bit platform +Print 64% '' Decimal signed 4/8 byte integer (Integer) +Print 64L '' Decimal signed 4 byte integer (Long) +Print 64& '' Decimal signed 4 byte integer (Long) - alternative suffix +Print 64LL '' Decimal unsigned 4 byte integer (ULong) +Print 64LL '' Decimal signed 8 byte integer (LongInt) +Print 64ULL '' Decimal unsigned 8 byte integer (ULongInt) + +Sleep diff --git a/Task/Literals-Integer/FutureBasic/literals-integer.futurebasic b/Task/Literals-Integer/FutureBasic/literals-integer.futurebasic new file mode 100644 index 0000000000..76b0b159c8 --- /dev/null +++ b/Task/Literals-Integer/FutureBasic/literals-integer.futurebasic @@ -0,0 +1,9 @@ +include "ConsoleWindow" + +def tab 2 + +print " Decimal 100:", 100 +print " Hexadecimal &h64:", &h64, hex$(100) +print " Octal &o144:", &o144, oct$(100) +print " Binary &x1100100:", &x1100100, bin$(100) + diff --git a/Task/Literals-Integer/Harbour/literals-integer.harbour b/Task/Literals-Integer/Harbour/literals-integer.harbour new file mode 100644 index 0000000000..4358b3e15a --- /dev/null +++ b/Task/Literals-Integer/Harbour/literals-integer.harbour @@ -0,0 +1 @@ +? 0x1f diff --git a/Task/Literals-Integer/Lasso/literals-integer.lasso b/Task/Literals-Integer/Lasso/literals-integer.lasso new file mode 100644 index 0000000000..d290ebc982 --- /dev/null +++ b/Task/Literals-Integer/Lasso/literals-integer.lasso @@ -0,0 +1,2 @@ +42 +0x2a diff --git a/Task/Literals-Integer/LiveCode/literals-integer.livecode b/Task/Literals-Integer/LiveCode/literals-integer.livecode new file mode 100644 index 0000000000..112adb6d80 --- /dev/null +++ b/Task/Literals-Integer/LiveCode/literals-integer.livecode @@ -0,0 +1 @@ +put 0x1 + 0xff diff --git a/Task/Literals-Integer/Nim/literals-integer.nim b/Task/Literals-Integer/Nim/literals-integer.nim new file mode 100644 index 0000000000..0b5727d581 --- /dev/null +++ b/Task/Literals-Integer/Nim/literals-integer.nim @@ -0,0 +1,20 @@ +var x: int +x = 0b1011010111 +x = 0b10_1101_0111 +x = 0o1327 +x = 0o13_27 +x = 727 +x = 727_000_000 +x = 0x2d7 +x = 0x2d7_2d7 + +# Literals of specific size: +var a = -127'i8 # 8 bit Integer +var b = -128'i16 +var c = -129'i32 +var d = -129'i64 +var e = 126'u # Unsigned Integer +var f = 127'u8 # 8 bit uint +var g = 128'u16 +var h = 129'u32 +var i = 130'u64 diff --git a/Task/Literals-Integer/Phix/literals-integer.phix b/Task/Literals-Integer/Phix/literals-integer.phix new file mode 100644 index 0000000000..220e46490c --- /dev/null +++ b/Task/Literals-Integer/Phix/literals-integer.phix @@ -0,0 +1 @@ +?{65,#41,'A',scanf("55","%d"),0o10,0(7)11} diff --git a/Task/Literals-Integer/Sidef/literals-integer.sidef b/Task/Literals-Integer/Sidef/literals-integer.sidef new file mode 100644 index 0000000000..add8766acb --- /dev/null +++ b/Task/Literals-Integer/Sidef/literals-integer.sidef @@ -0,0 +1,4 @@ +say 255; +say 0xff; +say 0377; +say 0b1111_1111; diff --git a/Task/Literals-Integer/Swift/literals-integer.swift b/Task/Literals-Integer/Swift/literals-integer.swift new file mode 100644 index 0000000000..ab67bef633 --- /dev/null +++ b/Task/Literals-Integer/Swift/literals-integer.swift @@ -0,0 +1,3 @@ +let hex = 0x2F // Hexadecimal +let bin = 0b101111 // Binary +let oct = 0o57 // Octal diff --git a/Task/Literals-Integer/Ursa/literals-integer.ursa b/Task/Literals-Integer/Ursa/literals-integer.ursa new file mode 100644 index 0000000000..5992db4a49 --- /dev/null +++ b/Task/Literals-Integer/Ursa/literals-integer.ursa @@ -0,0 +1,3 @@ +decl int i +set i 123 +set i -456 diff --git a/Task/Literals-String/Axe/literals-string-1.axe b/Task/Literals-String/Axe/literals-string-1.axe new file mode 100644 index 0000000000..30dfe4aef7 --- /dev/null +++ b/Task/Literals-String/Axe/literals-string-1.axe @@ -0,0 +1 @@ +'A' diff --git a/Task/Literals-String/Axe/literals-string-2.axe b/Task/Literals-String/Axe/literals-string-2.axe new file mode 100644 index 0000000000..8d277c1419 --- /dev/null +++ b/Task/Literals-String/Axe/literals-string-2.axe @@ -0,0 +1 @@ +"ABC" diff --git a/Task/Literals-String/Lasso/literals-string-1.lasso b/Task/Literals-String/Lasso/literals-string-1.lasso new file mode 100644 index 0000000000..edf4aed141 --- /dev/null +++ b/Task/Literals-String/Lasso/literals-string-1.lasso @@ -0,0 +1,2 @@ +'I\'m a 2" string\n' +"I'm a 2\" string\n" diff --git a/Task/Literals-String/Lasso/literals-string-2.lasso b/Task/Literals-String/Lasso/literals-string-2.lasso new file mode 100644 index 0000000000..63c1d59359 --- /dev/null +++ b/Task/Literals-String/Lasso/literals-string-2.lasso @@ -0,0 +1 @@ +`I'm also a 2" string\n` diff --git a/Task/Literals-String/Lingo/literals-string-1.lingo b/Task/Literals-String/Lingo/literals-string-1.lingo new file mode 100644 index 0000000000..7002d97b45 --- /dev/null +++ b/Task/Literals-String/Lingo/literals-string-1.lingo @@ -0,0 +1,3 @@ +str = "Hello ""E&"world!""E +put str +-- "Hello "world!"" diff --git a/Task/Literals-String/Lingo/literals-string-2.lingo b/Task/Literals-String/Lingo/literals-string-2.lingo new file mode 100644 index 0000000000..06577b00e0 --- /dev/null +++ b/Task/Literals-String/Lingo/literals-string-2.lingo @@ -0,0 +1,3 @@ +str = "This is the first line.\ +This is the second line.\ +This is the third line." diff --git a/Task/Literals-String/Lingo/literals-string-3.lingo b/Task/Literals-String/Lingo/literals-string-3.lingo new file mode 100644 index 0000000000..fd89d35aba --- /dev/null +++ b/Task/Literals-String/Lingo/literals-string-3.lingo @@ -0,0 +1,6 @@ +template = QUOTE&"Milliseconds since last reboot: ""E&"&_system.milliseconds" + +-- expand template in current context +str = value(template) +put str +-- "Milliseconds since last reboot: 20077664" diff --git a/Task/Literals-String/LiveCode/literals-string.livecode b/Task/Literals-String/LiveCode/literals-string.livecode new file mode 100644 index 0000000000..8436129715 --- /dev/null +++ b/Task/Literals-String/LiveCode/literals-string.livecode @@ -0,0 +1,5 @@ +put "Literal string" -- Literal string +put char 1 of "Literal string" -- L +put char 1 to 7 of "Literal string" -- Literal +put word 1 of "Literal string" -- Literal +put quote & "string" & quote -- "string" diff --git a/Task/Literals-String/Nim/literals-string.nim b/Task/Literals-String/Nim/literals-string.nim new file mode 100644 index 0000000000..d388ac53dd --- /dev/null +++ b/Task/Literals-String/Nim/literals-string.nim @@ -0,0 +1,7 @@ +var c = 'c' +var s = "foobar" +var l = """foobar +and even +more test here""" + +var f = r"C:\texts\text.txt" # Raw string diff --git a/Task/Literals-String/Oforth/literals-string.oforth b/Task/Literals-String/Oforth/literals-string.oforth new file mode 100644 index 0000000000..fa77817d9d --- /dev/null +++ b/Task/Literals-String/Oforth/literals-string.oforth @@ -0,0 +1,5 @@ +'a' +'\'' +"abcd" +"ab\ncd" +"ab\" and \" cd" diff --git a/Task/Literals-String/Phix/literals-string-1.phix b/Task/Literals-String/Phix/literals-string-1.phix new file mode 100644 index 0000000000..7a01dd9c31 --- /dev/null +++ b/Task/Literals-String/Phix/literals-string-1.phix @@ -0,0 +1 @@ +constant UPPERCASEJ = 'J' -- equivalent to 74 diff --git a/Task/Literals-String/Phix/literals-string-2.phix b/Task/Literals-String/Phix/literals-string-2.phix new file mode 100644 index 0000000000..c07b4a1013 --- /dev/null +++ b/Task/Literals-String/Phix/literals-string-2.phix @@ -0,0 +1,2 @@ +constant hw = "Hello World!", + mt = "" -- empty string diff --git a/Task/Literals-String/Phix/literals-string-3.phix b/Task/Literals-String/Phix/literals-string-3.phix new file mode 100644 index 0000000000..9558130b8d --- /dev/null +++ b/Task/Literals-String/Phix/literals-string-3.phix @@ -0,0 +1 @@ +s = "日本語" diff --git a/Task/Literals-String/Phix/literals-string-4.phix b/Task/Literals-String/Phix/literals-string-4.phix new file mode 100644 index 0000000000..60673e0566 --- /dev/null +++ b/Task/Literals-String/Phix/literals-string-4.phix @@ -0,0 +1,4 @@ +string s = "food" + s[2..3] = 'e' -- s is now "feed" (replace all) + s[2..2] = "east" -- s is now "feasted" (replace substring) + s[2..5] = "" -- s is now "fed" diff --git a/Task/Literals-String/Phix/literals-string-5.phix b/Task/Literals-String/Phix/literals-string-5.phix new file mode 100644 index 0000000000..0c5db26e8e --- /dev/null +++ b/Task/Literals-String/Phix/literals-string-5.phix @@ -0,0 +1,12 @@ +ts = """ +this +string\thing""" + +ts = """ +_____this + string\thing""" + +ts = 'this +string\thing' + +ts = "this\nstring\\thing" diff --git a/Task/Literals-String/Phix/literals-string-6.phix b/Task/Literals-String/Phix/literals-string-6.phix new file mode 100644 index 0000000000..d437c9b794 --- /dev/null +++ b/Task/Literals-String/Phix/literals-string-6.phix @@ -0,0 +1 @@ +?x"68 65 6c 6c 6f"; -- displays "hello" diff --git a/Task/Literals-String/Ring/literals-string.ring b/Task/Literals-String/Ring/literals-string.ring new file mode 100644 index 0000000000..e453a249e7 --- /dev/null +++ b/Task/Literals-String/Ring/literals-string.ring @@ -0,0 +1 @@ +see 'This is a "quoted string"' diff --git a/Task/Literals-String/Sidef/literals-string-1.sidef b/Task/Literals-String/Sidef/literals-string-1.sidef new file mode 100644 index 0000000000..c411eef584 --- /dev/null +++ b/Task/Literals-String/Sidef/literals-string-1.sidef @@ -0,0 +1,4 @@ +'single quotes with \'embedded quote\' and \\backslash'; +‚unicode single quoted’; +%q(not interpolating with (nested) parentheses +and newline); diff --git a/Task/Literals-String/Sidef/literals-string-2.sidef b/Task/Literals-String/Sidef/literals-string-2.sidef new file mode 100644 index 0000000000..38fef9b0db --- /dev/null +++ b/Task/Literals-String/Sidef/literals-string-2.sidef @@ -0,0 +1,4 @@ +var a = 42; +"double \Uquotes\E with \"embedded quote\"\nnewline and variable interpolation: #{a} % 10 = #{a % 10}"; +„same as above”; +%Q(same as above); diff --git a/Task/Literals-String/Sidef/literals-string-3.sidef b/Task/Literals-String/Sidef/literals-string-3.sidef new file mode 100644 index 0000000000..8a97390b41 --- /dev/null +++ b/Task/Literals-String/Sidef/literals-string-3.sidef @@ -0,0 +1,13 @@ +print <2,1=1); //Boolean expressions are also valid here diff --git a/Task/Logical-operations/FreeBASIC/logical-operations.freebasic b/Task/Logical-operations/FreeBASIC/logical-operations.freebasic new file mode 100644 index 0000000000..192ae15742 --- /dev/null +++ b/Task/Logical-operations/FreeBASIC/logical-operations.freebasic @@ -0,0 +1,27 @@ +' FB 1.05.0 Win64 + +Sub logicalDemo(b1 As Boolean, b2 As Boolean) + Print "b1 = "; b1 + Print "b2 = "; b2 + Print "b1 And b2 = "; b1 And b2 + Print "b1 Or b2 = "; b1 Or b2 + Print "b1 XOr b2 = "; b1 Xor b2 + Print "b1 Eqv b2 = "; b1 Eqv b2 + Print "b1 Imp b2 = "; b1 Imp b2 + Print "Not b1 = "; Not b1 + Print "b1 AndAlso b2 = "; b1 AndAlso b2 + Print "b1 OrElse b2 = "; b1 OrElse b2 + Print +End Sub + +Dim b1 As Boolean = True +Dim b2 As Boolean = True +logicalDemo b1, b2 +b2 = False +logicalDemo b1, b2 +b1 = False +logicalDemo b1, b2 +b2 = True +logicalDemo b1, b2 +Print "Press any key to quit" +Sleep diff --git a/Task/Logical-operations/FunL/logical-operations.funl b/Task/Logical-operations/FunL/logical-operations.funl new file mode 100644 index 0000000000..188b6edf61 --- /dev/null +++ b/Task/Logical-operations/FunL/logical-operations.funl @@ -0,0 +1,8 @@ +def logical( a, b ) = println( """ +a and b = ${a and b} +a or b = ${a or b} +not a = ${not a} +a xor b = ${a xor b} +""" ) + +for i <- [false, true], j <- [false, true] do logical( i, j ) diff --git a/Task/Logical-operations/FutureBasic/logical-operations.futurebasic b/Task/Logical-operations/FutureBasic/logical-operations.futurebasic new file mode 100644 index 0000000000..1f1f48a3f1 --- /dev/null +++ b/Task/Logical-operations/FutureBasic/logical-operations.futurebasic @@ -0,0 +1,23 @@ +include "ConsoleWindow" + +def tab 6 + +dim as long a, b + +print "In FB the Boolean constants _true = 1, _false = 0" +print string$( 39, "-" ) +print " a", " b", "and", "or", "xor", "nand", "nor" +print string$( 39, "-" ) +a = _false: b = _false: print a, b, a and b, a or b, a xor b, a nand b, a nor b +a = _false: b = _true: print a, b, a and b, a or b, a xor b, a nand b, a nor b +a = _true: b = _false: print a, b, a and b, a or b, a xor b, a nand b, a nor b +a = _true: b = _true: print a, b, a and b, a or b, a xor b, a nand b, a nor b +print +print "FB also has shorthand operator expressions: +print string$( 39, "-" ) +print " a", " b", "&&", "||", "^^", "^&", "^|" +print string$( 39, "-" ) +a = _false: b = _false: print a, b, a && b, a || b, a ^^ b, a ^& b, a ^| b +a = _false: b = _true: print a, b, a && b, a || b, a ^^ b, a ^& b, a ^| b +a = _true: b = _false: print a, b, a && b, a || b, a ^^ b, a ^& b, a ^| b +a = _true: b = _true: print a, b, a && b, a || b, a ^^ b, a ^& b, a ^| b diff --git a/Task/Logical-operations/Harbour/logical-operations.harbour b/Task/Logical-operations/Harbour/logical-operations.harbour new file mode 100644 index 0000000000..0228b1b951 --- /dev/null +++ b/Task/Logical-operations/Harbour/logical-operations.harbour @@ -0,0 +1,6 @@ +PROCEDURE Foo( a, b ) + // a and b was defined as .F. (false) or .T. (true) + ? a .AND. b + ? a .OR. b + ? ! a, ! b + RETURN diff --git a/Task/Logical-operations/Lasso/logical-operations.lasso b/Task/Logical-operations/Lasso/logical-operations.lasso new file mode 100644 index 0000000000..6103654951 --- /dev/null +++ b/Task/Logical-operations/Lasso/logical-operations.lasso @@ -0,0 +1,15 @@ +// br is just for formatting output here +define br => '\r' + +// define vars +local(a = true, b = false) + +// boolean comparators. +// note, not including comparison operators which would return boolean results +'a AND b: ' + (#a && #b) +br +'a OR b: ' + (#a || #b) +br +'NOT a: ' + !#a +br +'NOT a (using not): ' + not #a diff --git a/Task/Logical-operations/LiveCode/logical-operations-1.livecode b/Task/Logical-operations/LiveCode/logical-operations-1.livecode new file mode 100644 index 0000000000..2af4258a9b --- /dev/null +++ b/Task/Logical-operations/LiveCode/logical-operations-1.livecode @@ -0,0 +1,7 @@ +function boolOps p1, p2 + local boolOpsResult + put p1 && "AND" && p2 && "=" && merge("[[p1 and p2]]") & cr after boolOpsResult + put p1 && "OR" && p2 && "=" && merge("[[p1 or p2]]") & cr after boolOpsResult + put "NOT" && p1 && "=" && merge("[[not p1]]") & cr after boolOpsResult + return boolOpsResult +end boolOps diff --git a/Task/Logical-operations/LiveCode/logical-operations-2.livecode b/Task/Logical-operations/LiveCode/logical-operations-2.livecode new file mode 100644 index 0000000000..6c00ca7697 --- /dev/null +++ b/Task/Logical-operations/LiveCode/logical-operations-2.livecode @@ -0,0 +1,22 @@ +repeat for each item bop in "true,false" + put boolops(bop, bop) & cr after bopResult + put boolops(bop, not bop) & cr after bopResult +end repeat +put bopResult + +-- results +true AND true = true +true OR true = true +NOT true = false + +true AND false = false +true OR false = true +NOT true = false + +false AND false = false +false OR false = false +NOT false = true + +false AND true = false +false OR true = true +NOT false = true diff --git a/Task/Logical-operations/Nim/logical-operations.nim b/Task/Logical-operations/Nim/logical-operations.nim new file mode 100644 index 0000000000..9a111e0eec --- /dev/null +++ b/Task/Logical-operations/Nim/logical-operations.nim @@ -0,0 +1,5 @@ +proc logic(a, b) = + echo "a and b: ", a and b + echo "a or b: ", a or b + echo "not a: ", not a + echo "a xor b: ", a xor b diff --git a/Task/Logical-operations/Oforth/logical-operations.oforth b/Task/Logical-operations/Oforth/logical-operations.oforth new file mode 100644 index 0000000000..777af630ce --- /dev/null +++ b/Task/Logical-operations/Oforth/logical-operations.oforth @@ -0,0 +1,5 @@ +: logical(b1, b2) + System.Out "and = " << b1 b2 and << cr + System.Out "or = " << b1 b2 or << cr + System.Out "xor = " << b1 b2 xor << cr + System.Out "not = " << b1 not << cr ; diff --git a/Task/Logical-operations/Phix/logical-operations-1.phix b/Task/Logical-operations/Phix/logical-operations-1.phix new file mode 100644 index 0000000000..e999aee8d8 --- /dev/null +++ b/Task/Logical-operations/Phix/logical-operations-1.phix @@ -0,0 +1,25 @@ +--constant TRUE = (1=1), -- 1 internally \ now pre- +-- FALSE = not TRUE -- 0 internally / defined +type boolean(object b) + return integer(b) and find(b,{TRUE,FALSE})!=0 +end type + +function logicop(boolean a, boolean b) + return {a, b, a and b, a or b, not a, a xor b, a=b, a!=b} +end function + +function TF(sequence tf) +boolean tfi + for i=1 to length(tf) do + tfi = tf[i] + tf[i] = iff(tfi?'T','F') + end for + return tf +end function + +printf(1," a b and or not xor = !=\n") +for a=FALSE to TRUE do -- nb: TRUE to FALSE would need a "by -1". + for b=FALSE to TRUE do + printf(1,"%2c %2c %c %c %c %c %c %c\n",TF(logicop(a,b))) + end for +end for diff --git a/Task/Logical-operations/Phix/logical-operations-2.phix b/Task/Logical-operations/Phix/logical-operations-2.phix new file mode 100644 index 0000000000..6f57898506 --- /dev/null +++ b/Task/Logical-operations/Phix/logical-operations-2.phix @@ -0,0 +1,10 @@ +function logiicop(integer a, integer b) + return {a, b, a and b, a or b, not a, a xor b, a=b, a!=b} +end function + +printf(1," a b and or not xor = !=\n") +for a=0 to 1 do + for b=0 to 1 do + printf(1,"%2d %2d %d %d %d %d %d %d\n",logiicop(a,b)) + end for +end for diff --git a/Task/Logical-operations/Ring/logical-operations.ring b/Task/Logical-operations/Ring/logical-operations.ring new file mode 100644 index 0000000000..d12ffddcbe --- /dev/null +++ b/Task/Logical-operations/Ring/logical-operations.ring @@ -0,0 +1,6 @@ +x = true +y = false + +see "x and y = " + (x and y) + nl +see "x or y = " + (x or y) + nl +see "not x = " + (not x) + nl diff --git a/Task/Logical-operations/Sidef/logical-operations.sidef b/Task/Logical-operations/Sidef/logical-operations.sidef new file mode 100644 index 0000000000..045427375e --- /dev/null +++ b/Task/Logical-operations/Sidef/logical-operations.sidef @@ -0,0 +1,8 @@ +func logic(a, b) { + say ("a and b: ", a && b); + say ("a or b: ", a || b); + say ("a xor b: ", a ^ b); + say (" not a: ", !a); +} + +logic(false, true); diff --git a/Task/Logical-operations/SkookumScript/logical-operations-1.skookum b/Task/Logical-operations/SkookumScript/logical-operations-1.skookum new file mode 100644 index 0000000000..3f8dc4da6e --- /dev/null +++ b/Task/Logical-operations/SkookumScript/logical-operations-1.skookum @@ -0,0 +1,11 @@ +!logic: + (a? b?) + [ + println("a and b: " a and b) + println("a or b: " a or b) + println("not a: " not a) + println("a xor b: " a xor b) + println("a nand b: " a nand b) + println("a nor b: " a nor b) + println("a not xor b: " a nxor b) + ] diff --git a/Task/Logical-operations/SkookumScript/logical-operations-2.skookum b/Task/Logical-operations/SkookumScript/logical-operations-2.skookum new file mode 100644 index 0000000000..e9a4805156 --- /dev/null +++ b/Task/Logical-operations/SkookumScript/logical-operations-2.skookum @@ -0,0 +1 @@ +logic(true false) diff --git a/Task/Logical-operations/Swift/logical-operations.swift b/Task/Logical-operations/Swift/logical-operations.swift new file mode 100644 index 0000000000..762ba1ebb6 --- /dev/null +++ b/Task/Logical-operations/Swift/logical-operations.swift @@ -0,0 +1,5 @@ +func logic(a: Bool, b: Bool) { + println("a AND b: \(a && b)"); + println("a OR b: \(a || b)"); + println("NOT a: \(!a)"); +} diff --git a/Task/Logical-operations/XLISP/logical-operations.xlisp b/Task/Logical-operations/XLISP/logical-operations.xlisp new file mode 100644 index 0000000000..1162a73b3f --- /dev/null +++ b/Task/Logical-operations/XLISP/logical-operations.xlisp @@ -0,0 +1,4 @@ +(defun logical-functions (a b) + (print `(a and b = ,(and a b))) + (print `(a or b = ,(or a b))) + (print `(not a = ,(not a))) ) diff --git a/Task/Logical-operations/jq/logical-operations-1.jq b/Task/Logical-operations/jq/logical-operations-1.jq new file mode 100644 index 0000000000..f8989d2e2f --- /dev/null +++ b/Task/Logical-operations/jq/logical-operations-1.jq @@ -0,0 +1,5 @@ +def logic(a; b): + "\(a) and \(b) => \(a and b)", + "\(a) or \(b) => \(a or b)", + "\(a) | not => \(a | not)", + "if \(a) then true else false end => \(if a then true else false end)" ; diff --git a/Task/Logical-operations/jq/logical-operations-2.jq b/Task/Logical-operations/jq/logical-operations-2.jq new file mode 100644 index 0000000000..3cbb6ff028 --- /dev/null +++ b/Task/Logical-operations/jq/logical-operations-2.jq @@ -0,0 +1,3 @@ + (false, null, []) as $a +| (false, null, {}) as $b +| logic( $a; $b ) diff --git a/Task/Logical-operations/jq/logical-operations-3.jq b/Task/Logical-operations/jq/logical-operations-3.jq new file mode 100644 index 0000000000..0b2f83f1ed --- /dev/null +++ b/Task/Logical-operations/jq/logical-operations-3.jq @@ -0,0 +1,37 @@ +$ jq -n -r -f logical_operations.jq +false and false => false +false or false => false +false | not => true +if false then true else false end => false +false and null => false +false or null => false +false | not => true +if false then true else false end => false +false and {} => false +false or {} => true +false | not => true +if false then true else false end => false +null and false => false +null or false => false +null | not => true +if null then true else false end => false +null and null => false +null or null => false +null | not => true +if null then true else false end => false +null and {} => false +null or {} => true +null | not => true +if null then true else false end => false +[] and false => false +[] or false => true +[] | not => false +if [] then true else false end => true +[] and null => false +[] or null => true +[] | not => false +if [] then true else false end => true +[] and {} => true +[] or {} => true +[] | not => false +if [] then true else false end => true diff --git a/Task/Long-multiplication/EchoLisp/long-multiplication.echolisp b/Task/Long-multiplication/EchoLisp/long-multiplication.echolisp new file mode 100644 index 0000000000..d6a6e7a8aa --- /dev/null +++ b/Task/Long-multiplication/EchoLisp/long-multiplication.echolisp @@ -0,0 +1,39 @@ +(lib 'math) ;; for poly multiplication + +;; convert string of decimal digits to polynomial +;; "1234" → x^3 +2x^2 +3x +4 +;; least-significant digit first +(define (string->long N) + (reverse (map string->number (string->list N)))) + +;; convert polynomial to string +(define (long->string N) +(if (pair? N) + (string-append (number->string (first N)) (long->string (rest N))) "")) + +;; convert poly coefficients to base 10 +(define (poly->10 P (carry 0)) +(append + (for/list ((coeff P)) + (set! coeff (+ carry coeff )) + (set! carry (quotient coeff 10)) ;; new carry + (modulo coeff 10)) + (if(zero? carry) null (list carry)))) ;; remove leading 0 if any + +;; long multiplication +;; convert input - strings of decimal digits - to polynomials +;; perform poly multiplication in base 10 +;; convert result to string of decimal digits + +(define (long-mul A B ) + (long->string (reverse (poly->10 (poly-mul (string->long A) (string->long B)))))) + +(define two-64 "18446744073709551616") +(long-mul two-64 two-64) + → "340282366920938463463374607431768211456" + +;; check it +(lib 'bigint) +Lib: bigint.lib loaded. +(expt 2 128) + → 340282366920938463463374607431768211456 diff --git a/Task/Long-multiplication/Nim/long-multiplication.nim b/Task/Long-multiplication/Nim/long-multiplication.nim new file mode 100644 index 0000000000..6cfc0d2bc3 --- /dev/null +++ b/Task/Long-multiplication/Nim/long-multiplication.nim @@ -0,0 +1,41 @@ +import strutils + +proc ti(a): int = ord(a) - ord('0') + +proc longmulti(a, b: string): string = + var + i, j, n, carry, la, lb = 0 + k = false + + # either is zero, return "0" + if a == "0" or b == "0": + return "0" + + # see if either a or b is negative + if a[0] == '-': + i = 1; k = not k + if b[0] == '-': + j = 1; k = not k + + # if yes, prepend minus sign if needed and skip the sign + if i > 0 or j > 0: + result = if k: "-" else: "" + result.add longmulti(a[i..a.high], b[j..b.high]) + return + + result = repeatChar(a.len + b.len, '0') + + for i in countdown(a.high, 0): + var carry = 0 + var k = i + b.len + for j in countdown(b.high, 0): + let n = ti(a[i]) * ti(b[j]) + ti(result[k]) + carry + carry = n div 10 + result[k] = chr(n mod 10 + ord('0')) + dec k + result[k] = chr(ord(result[k]) + carry) + + if result[0] == '0': + result[0..result.high-1] = result[1..result.high] + +echo longmulti("-18446744073709551616", "-18446744073709551616") diff --git a/Task/Long-multiplication/Oforth/long-multiplication.oforth b/Task/Long-multiplication/Oforth/long-multiplication.oforth new file mode 100644 index 0000000000..7a315622b4 --- /dev/null +++ b/Task/Long-multiplication/Oforth/long-multiplication.oforth @@ -0,0 +1,28 @@ +Number Class new: Natural(v) + +Natural method: initialize := v ; +Natural method: _v @v ; + +Natural classMethod: newValues super new ; +Natural classMethod: newFrom asList self newValues ; + +Natural method: *(n) +| v i j l x k | + n _v ->v + ListBuffer initValue(@v size v size + 1+, 0) ->l + + v size loop: i [ + i v at dup ->x 0 ifEq: [ continue ] + 0 @v size loop: j [ + i j + 1- ->k + j @v at x * + l at(k) + 1000000000 /mod k rot l put + ] + k 1+ swap l put + ] + while(l last 0 == l size 0 <> and) [ l removeLast drop ] + l dup freeze Natural newValues ; + +Natural method: << +| i | + @v last << + @v size 1 - loop: i [ @v at(@v size i -) <base then + c[i+1] += floor(ci/base) -- carry + c[i] = remainder(ci,base) + end if + end for + + if c[$]=0 then + c = c[1..$-1] + end if + return c +end function + +function atom_to_bcd9(atom a) +sequence s = {} + while a>0 do + s = append(s,remainder(a,base)) + a = floor(a/base) + end while + return s +end function + +function bcd9_to_str(sequence a) +string s = sprintf("%d",a[$]) + for i=length(a)-1 to 1 by -1 do + s &= sprintf("%09d",a[i]) + end for + -- (might want to trim leading 0s here) + return s +end function + +sequence a, b, c + +a = atom_to_bcd9(power(2,32)) +printf(1,"a is %s\n",{bcd9_to_str(a)}) + +b = bcd9_mult(a,a) +printf(1,"a*a is %s\n",{bcd9_to_str(b)}) + +c = bcd9_mult(b,b) +printf(1,"a*a*a*a is %s\n",{bcd9_to_str(c)}) diff --git a/Task/Long-multiplication/Sidef/long-multiplication-1.sidef b/Task/Long-multiplication/Sidef/long-multiplication-1.sidef new file mode 100644 index 0000000000..23b45036f3 --- /dev/null +++ b/Task/Long-multiplication/Sidef/long-multiplication-1.sidef @@ -0,0 +1 @@ +say (2**64 * 2**64); diff --git a/Task/Long-multiplication/Sidef/long-multiplication-2.sidef b/Task/Long-multiplication/Sidef/long-multiplication-2.sidef new file mode 100644 index 0000000000..51bc885534 --- /dev/null +++ b/Task/Long-multiplication/Sidef/long-multiplication-2.sidef @@ -0,0 +1,37 @@ +func add_with_carry(result, addend, addendpos) { + loop { + while (result.len < addendpos+1) { + result.append(0); + }; + var addend_digits = (addend.to_i + result[addendpos].to_i -> to_chars); + result[addendpos] = addend_digits.pop; + addend_digits.len > 0 || break; + addend = addend_digits.pop; + addendpos++; + } +} + +func longhand_multiplication(multiplicand, multiplier) { + + var result = []; + var multiplicand_offset = 0; + + multiplicand.reverse.each { |multiplicand_digit| + var multiplier_offset = multiplicand_offset; + multiplier.reverse.each { |multiplier_digit| + var multiplication_result = (multiplicand_digit.to_i * multiplier_digit.to_i -> to_s); + + var addend_offset = multiplier_offset; + multiplication_result.reverse.each { |result_digit_addend| + add_with_carry(result, result_digit_addend, addend_offset); + addend_offset++; + }; + multiplier_offset++; + }; + multiplicand_offset++; + }; + + return result.join.reverse; +} + +say longhand_multiplication('18446744073709551616', '18446744073709551616'); diff --git a/Task/Long-multiplication/Sidef/long-multiplication-3.sidef b/Task/Long-multiplication/Sidef/long-multiplication-3.sidef new file mode 100644 index 0000000000..e051a52771 --- /dev/null +++ b/Task/Long-multiplication/Sidef/long-multiplication-3.sidef @@ -0,0 +1,50 @@ +func long_multiplication(String a, String b) -> String { + + if (a.len < b.len) { + (a, b) = (b, a) + } + + '0' ~~ [a, b] && return '0' + + var x = a.reverse.chars.map{.to_n} + var y = b.reverse.chars.map{.to_n} + + var xlen = x.end + var ylen = y.end + + var mem = 0 + var map = y.len.of { [] } + + for j in ^y { + for i in ^x { + var n = (x[i]*y[j] + mem) + var(d, m) = n.divmod(10) + if (i == xlen) { + map[j] << (m, d) + mem = 0; + } + else { + map[j] << m + mem = d + } + } + + var n = (ylen - j) + n > 0 && map[j].append(n.of(0)...) + var m = (ylen - n) + m > 0 && map[j].prepend(m.of(0)...) + } + + var result = [] + var mrange = ^map + var end = (xlen + ylen + 2) + + for i in ^end { + var n = (mrange.map {|j| map[j][i] }.sum + mem) + (mem, result[result.end+1]) = n.divmod(10) + } + + result.join.reverse -= /^0+/ +} + +say long_multiplication('18446744073709551616', '18446744073709551616') diff --git a/Task/Long-multiplication/jq/long-multiplication-1.jq b/Task/Long-multiplication/jq/long-multiplication-1.jq new file mode 100644 index 0000000000..e05fe81812 --- /dev/null +++ b/Task/Long-multiplication/jq/long-multiplication-1.jq @@ -0,0 +1,46 @@ +# multiply two decimal strings, which may be signed (+ or -) +def long_multiply(num1; num2): + + def stripsign: + .[0:1] as $a + | if $a == "-" then [ -1, .[1:]] + elif $a == "+" then [ 1, .[1:]] + else [1, .] + end; + + def adjustsign(sign): + if sign == 1 then . else "-" + . end; + + # mult/2 assumes neither argument has a sign + def mult(num1;num2): + (num1 | explode | map(.-48) | reverse) as $a1 + | (num2 | explode | map(.-48) | reverse) as $a2 + | reduce range(0; num1|length) as $i1 + ([]; # result + reduce range(0; num2|length) as $i2 (.; + ($i1 + $i2) as $ix + | ( $a1[$i1] * $a2[$i2] + + (if $ix >= length then 0 + else .[$ix] + end) ) as $r + | if $r > 9 # carrying + then + .[$ix + 1] = ($r / 10 | floor) + + (if $ix + 1 >= length then 0 + else .[$ix + 1] + end) + | .[$ix] = $r - ( $r / 10 | floor ) * 10 + else + .[$ix] = $r + end + ) + ) + | reverse | map(.+48) | implode; + + (num1|stripsign) as $a1 + | (num2|stripsign) as $a2 + | if $a1[1] == "0" or $a2[1] == "0" then "0" + elif $a1[1] == "1" then $a2[1]|adjustsign( $a1[0] * $a2[0] ) + elif $a2[1] == "1" then $a1[1]|adjustsign( $a1[0] * $a2[0] ) + else mult($a1[1]; $a2[1]) | adjustsign( $a1[0] * $a2[0] ) + end; diff --git a/Task/Long-multiplication/jq/long-multiplication-2.jq b/Task/Long-multiplication/jq/long-multiplication-2.jq new file mode 100644 index 0000000000..79aebd619d --- /dev/null +++ b/Task/Long-multiplication/jq/long-multiplication-2.jq @@ -0,0 +1,18 @@ +# Emit (input)^i where input and i are non-negative decimal integers, +# represented as numbers and/or strings. +def long_power(i): + def power(i): + tostring as $self + | (i|tostring) as $i + | if $i == "0" then "1" + elif $i == "1" then $self + elif $self == "0" then "0" + else reduce range(1;i) as $_ ( $self; long_multiply(.; $self) ) + end; + + (i|tonumber) as $i + | if $i < 4 then power($i) + else ($i|sqrt|floor) as $j + | ($i - $j*$j) as $k + | long_multiply( power($j) | power($j) ; power($k) ) + end ; diff --git a/Task/Long-multiplication/jq/long-multiplication-3.jq b/Task/Long-multiplication/jq/long-multiplication-3.jq new file mode 100644 index 0000000000..cf1190fbc2 --- /dev/null +++ b/Task/Long-multiplication/jq/long-multiplication-3.jq @@ -0,0 +1 @@ + 2 | long_power(64) | long_multiply(.;.) diff --git a/Task/Longest-common-subsequence/Egison/longest-common-subsequence-1.egison b/Task/Longest-common-subsequence/Egison/longest-common-subsequence-1.egison new file mode 100644 index 0000000000..0cb291d94c --- /dev/null +++ b/Task/Longest-common-subsequence/Egison/longest-common-subsequence-1.egison @@ -0,0 +1,8 @@ +(define $common-seqs + (lambda [$xs $ys] + (match-all [xs ys] [(list char) (list char)] + [[(loop $i [1 $n] > _) + (loop $i [1 ,n] > _)] + (map (lambda [$i] c_i) (between 1 n))]))) + +(define $lcs (compose common-seqs rac)) diff --git a/Task/Longest-common-subsequence/Egison/longest-common-subsequence-2.egison b/Task/Longest-common-subsequence/Egison/longest-common-subsequence-2.egison new file mode 100644 index 0000000000..d6b7c8f0b9 --- /dev/null +++ b/Task/Longest-common-subsequence/Egison/longest-common-subsequence-2.egison @@ -0,0 +1,2 @@ +> (lcs "thisisatest" "testing123testing")) +"tsitest" diff --git a/Task/Longest-common-subsequence/Nim/longest-common-subsequence-1.nim b/Task/Longest-common-subsequence/Nim/longest-common-subsequence-1.nim new file mode 100644 index 0000000000..3e50b2a386 --- /dev/null +++ b/Task/Longest-common-subsequence/Nim/longest-common-subsequence-1.nim @@ -0,0 +1,13 @@ +proc lcs(x, y): string = + if x == "" or y == "": + return "" + + if x[0] == y[0]: + return x[0] & lcs(x[1..x.high], y[1..y.high]) + + let a = lcs(x, y[1..y.high]) + let b = lcs(x[1..x.high], y) + result = if a.len > b.len: a else: b + +echo lcs("1234", "1224533324") +echo lcs("thisisatest", "testing123testing") diff --git a/Task/Longest-common-subsequence/Nim/longest-common-subsequence-2.nim b/Task/Longest-common-subsequence/Nim/longest-common-subsequence-2.nim new file mode 100644 index 0000000000..bec0427401 --- /dev/null +++ b/Task/Longest-common-subsequence/Nim/longest-common-subsequence-2.nim @@ -0,0 +1,28 @@ +proc lcs(a, b): string = + var ls = newSeq[seq[int]] a.len+1 + for i in 0 .. a.len: + ls[i].newSeq b.len+1 + + for i, x in a: + for j, y in b: + if x == y: + ls[i+1][j+1] = ls[i][j] + 1 + else: + ls[i+1][j+1] = max(ls[i+1][j], ls[i][j+1]) + + result = "" + var x = a.len + var y = b.len + while x > 0 and y > 0: + if ls[x][y] == ls[x-1][y]: + dec x + elif ls[x][y] == ls[x][y-1]: + dec y + else: + assert a[x-1] == b[y-1] + result = a[x-1] & result + dec x + dec y + +echo lcs("1234", "1224533324") +echo lcs("thisisatest", "testing123testing") diff --git a/Task/Longest-common-subsequence/Ring/longest-common-subsequence.ring b/Task/Longest-common-subsequence/Ring/longest-common-subsequence.ring new file mode 100644 index 0000000000..bfb1482716 --- /dev/null +++ b/Task/Longest-common-subsequence/Ring/longest-common-subsequence.ring @@ -0,0 +1,16 @@ +see longest("1267834", "1224533324") + nl + +func longest a, b + if a = "" or b = "" return "" ok + if right(a, 1) = right(b, 1) + lcs = longest(left(a, len(a) - 1), left(b, len(b) - 1)) + right(a, 1) + return lcs + else + x1 = longest(a, left(b, len(b) - 1)) + x2 = longest(left(a, len(a) - 1), b) + if len(x1) > len(x2) + lcs = x1 + return lcs + else + lcs = x2 + return lcs ok ok diff --git a/Task/Longest-common-subsequence/Sidef/longest-common-subsequence.sidef b/Task/Longest-common-subsequence/Sidef/longest-common-subsequence.sidef new file mode 100644 index 0000000000..7e947eb97b --- /dev/null +++ b/Task/Longest-common-subsequence/Sidef/longest-common-subsequence.sidef @@ -0,0 +1,16 @@ +func lcs(xstr, ystr) is cached { + + xstr.is_empty && return xstr; + ystr.is_empty && return ystr; + + var(x, xs, y, ys) = (xstr.ft(0,0), xstr.ft(1), + ystr.ft(0,0), ystr.ft(1)); + + if (x == y) { + x + lcs(xs, ys) + } else { + [lcs(xstr, ys), lcs(xs, ystr)].max_by { .len }; + } +} + +say lcs("thisisatest", "testing123testing"); diff --git a/Task/Longest-common-subsequence/Swift/longest-common-subsequence-1.swift b/Task/Longest-common-subsequence/Swift/longest-common-subsequence-1.swift new file mode 100644 index 0000000000..005a088288 --- /dev/null +++ b/Task/Longest-common-subsequence/Swift/longest-common-subsequence-1.swift @@ -0,0 +1,16 @@ +func rlcs(s1:String, _ s2:String) -> String { + let x = s1.characters.count + let y = s2.characters.count + + if x == 0 || y == 0 { + return "" + } else if s1[s1.startIndex.advancedBy(x - 1)] == s2[s2.startIndex.advancedBy(y - 1)] { + return rlcs(s1[s1.startIndex.. ystr.characters.count ? xstr : ystr + } +} diff --git a/Task/Longest-common-subsequence/Swift/longest-common-subsequence-2.swift b/Task/Longest-common-subsequence/Swift/longest-common-subsequence-2.swift new file mode 100644 index 0000000000..bff59a2da8 --- /dev/null +++ b/Task/Longest-common-subsequence/Swift/longest-common-subsequence-2.swift @@ -0,0 +1,31 @@ +func lcs(s1:String, _ s2:String) -> String { + var x = s1.characters.count + var y = s2.characters.count + var lens = Array(count: x + 1, repeatedValue: + Array(count: y + 1, repeatedValue: 0)) + var returnStr = "" + + for i in 0.. ($two|length) then $one else $two end + end + end; diff --git a/Task/Longest-common-subsequence/jq/longest-common-subsequence-2.jq b/Task/Longest-common-subsequence/jq/longest-common-subsequence-2.jq new file mode 100644 index 0000000000..692a31fd4f --- /dev/null +++ b/Task/Longest-common-subsequence/jq/longest-common-subsequence-2.jq @@ -0,0 +1,2 @@ +lcs("1234"; "1224533324"), +lcs("thisisatest"; "testing123testing") diff --git a/Task/Longest-common-subsequence/jq/longest-common-subsequence-3.jq b/Task/Longest-common-subsequence/jq/longest-common-subsequence-3.jq new file mode 100644 index 0000000000..b75315f4f8 --- /dev/null +++ b/Task/Longest-common-subsequence/jq/longest-common-subsequence-3.jq @@ -0,0 +1,3 @@ +# jq -n -f lcs-recursive.jq +"1234" +"tsitest" diff --git a/Task/Longest-increasing-subsequence/Sidef/longest-increasing-subsequence-1.sidef b/Task/Longest-increasing-subsequence/Sidef/longest-increasing-subsequence-1.sidef new file mode 100644 index 0000000000..bfe65221a3 --- /dev/null +++ b/Task/Longest-increasing-subsequence/Sidef/longest-increasing-subsequence-1.sidef @@ -0,0 +1,16 @@ +func lis(a) { + var l = a.len.of { [] } + l[0] << a[0] + for i in (1..a.end) { + for j in ^i { + if ((a[j] < a[i]) && (l[i].len < l[j].len+1)) { + l[i] = [l[j]...] + } + } + l[i] << a[i] + } + l.max_by { .len } +} + +say lis(%i<3 2 6 4 5 1>) +say lis(%i<0 8 4 12 2 10 6 14 1 9 5 13 3 11 7 15>) diff --git a/Task/Longest-increasing-subsequence/Sidef/longest-increasing-subsequence-2.sidef b/Task/Longest-increasing-subsequence/Sidef/longest-increasing-subsequence-2.sidef new file mode 100644 index 0000000000..9c2a29cece --- /dev/null +++ b/Task/Longest-increasing-subsequence/Sidef/longest-increasing-subsequence-2.sidef @@ -0,0 +1,27 @@ +func lis(deck) { + var pileTops = [] + deck.each { |x| + var low = 0; + var high = pileTops.end + while (low <= high) { + var mid = ((low + high) // 2) + if (pileTops[mid]{:val} >= x) { + high = mid-1 + } else { + low = mid+1 + } + } + var i = low + var node = Hash(val => x) + node{:back} = pileTops[i-1] if (i != 0) + pileTops[i] = node + } + var result = [] + for (var node = pileTops[-1]; node; node = node{:back}) { + result << node{:val} + } + result.reverse +} + +say lis(%i<3 2 6 4 5 1>) +say lis(%i<0 8 4 12 2 10 6 14 1 9 5 13 3 11 7 15>) diff --git a/Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-1.jq b/Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-1.jq new file mode 100644 index 0000000000..21981e8be5 --- /dev/null +++ b/Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-1.jq @@ -0,0 +1,17 @@ +def until(cond; update): + def _until: + if cond then . else (update | _until) end; + try _until catch if .== "break" then empty else . end; + +# binary search for insertion point +def bsearch(target): + . as $in + | [0, length-1] # [low, high] + | until(.[0] > .[1]; + .[0] as $low | .[1] as $high + | ($low + ($high - $low) / 2 | floor) as $mid + | if $in[$mid] >= target + then .[1] = $mid - 1 + else .[0] = $mid + 1 + end ) + | .[0]; diff --git a/Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-2.jq b/Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-2.jq new file mode 100644 index 0000000000..5cc63c9161 --- /dev/null +++ b/Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-2.jq @@ -0,0 +1,18 @@ +def lis: + + # Helper function: + # given a stream, produce an array of the items in reverse order: + def reverse(stream): reduce stream as $i ([]; [$i] + .); + + # put the items into increasing piles using the structure: + # NODE = {"val": value, "back": NODE} + reduce .[] as $x + ( []; # array of NODE + # binary search for the appropriate pile + (map(.val) | bsearch($x)) as $i + | setpath([$i]; + {"val": $x, + "back": (if $i > 0 then .[$i-1] else null end) }) + ) + | .[length - 1] + | reverse( recurse(.back) | .val ) ; diff --git a/Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-3.jq b/Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-3.jq new file mode 100644 index 0000000000..67f4170ace --- /dev/null +++ b/Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-3.jq @@ -0,0 +1,3 @@ +( [3,2,6,4,5,1], + [0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15] +) | lis diff --git a/Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-4.jq b/Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-4.jq new file mode 100644 index 0000000000..5904063823 --- /dev/null +++ b/Task/Longest-increasing-subsequence/jq/longest-increasing-subsequence-4.jq @@ -0,0 +1,3 @@ +$ jq -c -n -f lis.jq +[2,4,5] +[0,2,6,9,11,15] diff --git a/Task/Longest-string-challenge/Phix/longest-string-challenge-1.phix b/Task/Longest-string-challenge/Phix/longest-string-challenge-1.phix new file mode 100644 index 0000000000..6ad632478f --- /dev/null +++ b/Task/Longest-string-challenge/Phix/longest-string-challenge-1.phix @@ -0,0 +1,23 @@ +integer fn = open(command_line()[2],"r") -- (reading the source file) + +function allx(string line) + line[1..-1] = 'x' + return line +end function + +function longest(string mask) +object line = gets(fn) +string newmask + if atom(line) then return mask end if + newmask = allx(line) + if not match(mask,newmask) then return longest(mask) end if + mask = longest(newmask) + if match(mask,newmask) then + puts(1,line) + end if + return mask +end function + +?longest("x") + +close(fn) diff --git a/Task/Longest-string-challenge/Phix/longest-string-challenge-2.phix b/Task/Longest-string-challenge/Phix/longest-string-challenge-2.phix new file mode 100644 index 0000000000..a08bd342e2 --- /dev/null +++ b/Task/Longest-string-challenge/Phix/longest-string-challenge-2.phix @@ -0,0 +1,12 @@ +function longest(integer l) +object line = gets(fn) + if line=-1 then return l end if + if l>length(line) then return longest(l) end if + l = longest(length(line)) + if l=length(line) then + puts(1,line) + end if + return l +end function + +?longest(0) diff --git a/Task/Longest-string-challenge/Sidef/longest-string-challenge.sidef b/Task/Longest-string-challenge/Sidef/longest-string-challenge.sidef new file mode 100644 index 0000000000..227b9f6775 --- /dev/null +++ b/Task/Longest-string-challenge/Sidef/longest-string-challenge.sidef @@ -0,0 +1,9 @@ +var l = ''; # Sample longest string seen. +var a = ''; # Accumulator to save longest strings. + +STDIN.each { |n| + n.substr(l.len) ? (a = n; l = n) + : (!l.substr(n.len) && a.concat!(n)); +} + +print a; diff --git a/Task/Look-and-say-sequence/ERRE/look-and-say-sequence.erre b/Task/Look-and-say-sequence/ERRE/look-and-say-sequence.erre new file mode 100644 index 0000000000..7b2e324588 --- /dev/null +++ b/Task/Look-and-say-sequence/ERRE/look-and-say-sequence.erre @@ -0,0 +1,24 @@ +PROGRAM LOOK + +PROCEDURE LOOK_AND_SAY(N$->N$) + LOCAL I%,J%,C$,O$ + I%=1 + REPEAT + C$=MID$(N$,I%,1) + J%=I%+1 + WHILE MID$(N$,J%,1)=C$ DO + J%+=1 + END WHILE + O$+=MID$(STR$(J%-I%),2)+C$ + I%=J% + UNTIL I%>LEN(N$) + N$=O$ +END PROCEDURE + +BEGIN + NUMBER$="1" + FOR I%=1 TO 10 DO + LOOK_AND_SAY(NUMBER$->NUMBER$) + PRINT(NUMBER$) + END FOR +END PROGRAM diff --git a/Task/Look-and-say-sequence/EchoLisp/look-and-say-sequence-1.echolisp b/Task/Look-and-say-sequence/EchoLisp/look-and-say-sequence-1.echolisp new file mode 100644 index 0000000000..7865b36bb8 --- /dev/null +++ b/Task/Look-and-say-sequence/EchoLisp/look-and-say-sequence-1.echolisp @@ -0,0 +1,12 @@ +(lib 'math) ;; for (number->list) = explode function +(lib 'list) ;; (group) + +(define (next L) + (for/fold (acc null) ((g (group L))) + (append acc (list (length g) (first g))))) + + +(define (task n starter) +(for/fold (L (number->list starter)) ((i n)) + (writeln (list->string L)) + (next L))) diff --git a/Task/Look-and-say-sequence/EchoLisp/look-and-say-sequence-2.echolisp b/Task/Look-and-say-sequence/EchoLisp/look-and-say-sequence-2.echolisp new file mode 100644 index 0000000000..9312de31f7 --- /dev/null +++ b/Task/Look-and-say-sequence/EchoLisp/look-and-say-sequence-2.echolisp @@ -0,0 +1,11 @@ +(task 10 1) +1 +11 +21 +1211 +111221 +312211 +13112221 +1113213211 +31131211131221 +13211311123113112211 diff --git a/Task/Look-and-say-sequence/Lasso/look-and-say-sequence.lasso b/Task/Look-and-say-sequence/Lasso/look-and-say-sequence.lasso new file mode 100644 index 0000000000..2c4bbe754a --- /dev/null +++ b/Task/Look-and-say-sequence/Lasso/look-and-say-sequence.lasso @@ -0,0 +1,28 @@ +define rle(str::string)::string => { + local(orig = #str->values->asCopy,newi=array, newc=array, compiled=string) + while(#orig->size) => { + if(not #newi->size) => { + #newi->insert(1) + #newc->insert(#orig->first) + #orig->remove(1) + else + if(#orig->first == #newc->last) => { + #newi->get(#newi->size) += 1 + else + #newi->insert(1) + #newc->insert(#orig->first) + } + #orig->remove(1) + } + } + loop(#newi->size) => { + #compiled->append(#newi->get(loop_count)+#newc->get(loop_count)) + } + return #compiled +} +define las(n::integer,run::integer) => { + local(str = #n->asString) + loop(#run) => { #str = rle(#str) } + return #str +} +loop(15) => {^ las(1,loop_count) + '\r' ^} diff --git a/Task/Look-and-say-sequence/LiveCode/look-and-say-sequence.livecode b/Task/Look-and-say-sequence/LiveCode/look-and-say-sequence.livecode new file mode 100644 index 0000000000..d00c84d99a --- /dev/null +++ b/Task/Look-and-say-sequence/LiveCode/look-and-say-sequence.livecode @@ -0,0 +1,21 @@ +function lookAndSay S + put 0 into C + put char 1 of S into lastChar + repeat with i = 2 to length(S) + add 1 to C + if char i of S is lastChar then next repeat + put C & lastChar after R + put 0 into C + put char i of S into lastChar + end repeat + return R & C + 1 & lastChar +end lookAndSay + +on demoLookAndSay + put 1 into x + repeat 10 + put x & cr after message + put lookAndSay(x) into x + end repeat + put x after message +end demoLookAndSay diff --git a/Task/Look-and-say-sequence/Oforth/look-and-say-sequence.oforth b/Task/Look-and-say-sequence/Oforth/look-and-say-sequence.oforth new file mode 100644 index 0000000000..f63e2087bd --- /dev/null +++ b/Task/Look-and-say-sequence/Oforth/look-and-say-sequence.oforth @@ -0,0 +1 @@ +: lookAndSay(n) [ 1 ] n #[ dup .cr group map([#size, #first]) ] times ; diff --git a/Task/Look-and-say-sequence/Ring/look-and-say-sequence.ring b/Task/Look-and-say-sequence/Ring/look-and-say-sequence.ring new file mode 100644 index 0000000000..dffe1d644f --- /dev/null +++ b/Task/Look-and-say-sequence/Ring/look-and-say-sequence.ring @@ -0,0 +1,19 @@ +number = "1" +for nr = 1 to 10 + number = lookSay(number) + see number + nl +next + +func lookSay n + i = 0 j = 0 c="" o="" + i = 1 + while i <= len(n) + c = substr(n,i,1) + j = i + 1 + while substr(n,j,1) = c + j += 1 + end + o += string(j-i) + c + i = j + end + return o diff --git a/Task/Look-and-say-sequence/Sidef/look-and-say-sequence.sidef b/Task/Look-and-say-sequence/Sidef/look-and-say-sequence.sidef new file mode 100644 index 0000000000..7dad49d841 --- /dev/null +++ b/Task/Look-and-say-sequence/Sidef/look-and-say-sequence.sidef @@ -0,0 +1,9 @@ +func lookandsay(str) { + str.gsub(/((.)\2*)/, {|a,b| a.len.to_s + b }); +} + +var num = "1"; +{ + say num; + num = lookandsay(num); +} * 10; diff --git a/Task/Look-and-say-sequence/jq/look-and-say-sequence.jq b/Task/Look-and-say-sequence/jq/look-and-say-sequence.jq new file mode 100644 index 0000000000..9db6b060df --- /dev/null +++ b/Task/Look-and-say-sequence/jq/look-and-say-sequence.jq @@ -0,0 +1,15 @@ +def look_and_say: + def head(c; n): if .[n:n+1] == c then head(c; n+1) else n end; + tostring + | if length == 0 then "" + else head(.[0:1]; 1) as $len + | .[0:$len] as $head + | ($len | tostring) + $head[0:1] + (.[$len:] | look_and_say) + end ; + +# look and say n times +def look_and_say(n): + if n == 0 then empty + else look_and_say as $lns + | $lns, ($lns|look_and_say(n-1)) + end ; diff --git a/Task/Loop-over-multiple-arrays-simultaneously/Axe/loop-over-multiple-arrays-simultaneously.axe b/Task/Loop-over-multiple-arrays-simultaneously/Axe/loop-over-multiple-arrays-simultaneously.axe new file mode 100644 index 0000000000..99fd40b596 --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/Axe/loop-over-multiple-arrays-simultaneously.axe @@ -0,0 +1,12 @@ +'a'→{L₁} +'b'→{L₁+1} +'c'→{L₁+2} +'A'→{L₂} +'B'→{L₂+1} +'C'→{L₂+2} +1→{L₃} +2→{L₃+1} +3→{L₃+2} +For(I,0,2) +Disp {L₁+I}►Char,{L₂+I}►Char,{L₃+I}►Dec,i +End diff --git a/Task/Loop-over-multiple-arrays-simultaneously/EchoLisp/loop-over-multiple-arrays-simultaneously.echolisp b/Task/Loop-over-multiple-arrays-simultaneously/EchoLisp/loop-over-multiple-arrays-simultaneously.echolisp new file mode 100644 index 0000000000..322b3db9be --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/EchoLisp/loop-over-multiple-arrays-simultaneously.echolisp @@ -0,0 +1,14 @@ +;; looping over different sequences : infinite stream, string, list and vector +;; loop stops as soon a one sequence ends. +;; the (iota 6) = ( 0 1 2 3 4 5) sequence will stop first. + + +(for ((i (in-naturals 1000)) (j "ABCDEFGHIJK") (k (iota 6)) (m #(o p q r s t u v w))) + (writeln i j k m)) + +1000 "A" 0 o +1001 "B" 1 p +1002 "C" 2 q +1003 "D" 3 r +1004 "E" 4 s +1005 "F" 5 t diff --git a/Task/Loop-over-multiple-arrays-simultaneously/FreeBASIC/loop-over-multiple-arrays-simultaneously.freebasic b/Task/Loop-over-multiple-arrays-simultaneously/FreeBASIC/loop-over-multiple-arrays-simultaneously.freebasic new file mode 100644 index 0000000000..d8a60d9d14 --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/FreeBASIC/loop-over-multiple-arrays-simultaneously.freebasic @@ -0,0 +1,29 @@ +' FB 1.05.0 Win64 + +Function min(x As Integer, y As Integer) As Integer + Return IIf(x < y, x, y) +End Function + +Dim arr1(1 To 3) As String = {"a", "b", "c"} +Dim arr2(1 To 3) As String = {"A", "B", "C"} +Dim arr3(1 To 3) As Integer = {1, 2, 3} + +For i As Integer = 1 To 3 + Print arr1(i) & arr2(i) & arr3(i) +Next + +Print + +' For arrays of different lengths we would need to iterate up to the mimimm length of all 3 in order +' to get a contribution from each one. For example: + +Dim arr4(1 To 4) As String = {"A", "B", "C", "D"} +Dim arr5(1 To 2) As Integer = {1, 2} + +Dim ub As Integer = min(UBound(arr1), min(UBound(arr4), UBound(arr5))) +For i As Integer = 1 To ub + Print arr1(i) & arr2(i) & arr3(i) +Next + +Print +Sleep diff --git a/Task/Loop-over-multiple-arrays-simultaneously/FunL/loop-over-multiple-arrays-simultaneously.funl b/Task/Loop-over-multiple-arrays-simultaneously/FunL/loop-over-multiple-arrays-simultaneously.funl new file mode 100644 index 0000000000..24528007c5 --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/FunL/loop-over-multiple-arrays-simultaneously.funl @@ -0,0 +1,4 @@ +import lists.zip3 + +for x <- zip3( ['a', 'b', 'c'], ['A', 'B', 'C'], [1, 2, 3] ) + println( x.mkString() ) diff --git a/Task/Loop-over-multiple-arrays-simultaneously/LFE/loop-over-multiple-arrays-simultaneously.lfe b/Task/Loop-over-multiple-arrays-simultaneously/LFE/loop-over-multiple-arrays-simultaneously.lfe new file mode 100644 index 0000000000..14d40581d2 --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/LFE/loop-over-multiple-arrays-simultaneously.lfe @@ -0,0 +1,6 @@ +(lists:zipwith3 + (lambda (i j k) + (io:format "~s~s~p~n" `(,i ,j ,k))) + '(a b c) + '(A B C) + '(1 2 3)) diff --git a/Task/Loop-over-multiple-arrays-simultaneously/LiveCode/loop-over-multiple-arrays-simultaneously-1.livecode b/Task/Loop-over-multiple-arrays-simultaneously/LiveCode/loop-over-multiple-arrays-simultaneously-1.livecode new file mode 100644 index 0000000000..7d6a545803 --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/LiveCode/loop-over-multiple-arrays-simultaneously-1.livecode @@ -0,0 +1,16 @@ +command loopArrays + local lowA, uppA, nums, z + put "a,b,c" into lowA + put "A,B,C" into uppA + put "1,2,3" into nums + + split lowA by comma + split uppA by comma + split nums by comma + + repeat with n = 1 to the number of elements of lowA + put lowA[n] & uppA[n] & nums[n] & return after z + end repeat + put z + +end loopArrays diff --git a/Task/Loop-over-multiple-arrays-simultaneously/LiveCode/loop-over-multiple-arrays-simultaneously-2.livecode b/Task/Loop-over-multiple-arrays-simultaneously/LiveCode/loop-over-multiple-arrays-simultaneously-2.livecode new file mode 100644 index 0000000000..d617590a29 --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/LiveCode/loop-over-multiple-arrays-simultaneously-2.livecode @@ -0,0 +1,13 @@ +command loopDelimitedList + local lowA, uppA, nums, z + put "a,b,c" into lowA + put "A,B,C" into uppA + put "1,2,3" into nums + + repeat with n = 1 to the number of items of lowA + put item n of lowA & item n of uppA & item n of nums +& return after z + end repeat + put z + +end loopDelimitedList diff --git a/Task/Loop-over-multiple-arrays-simultaneously/Nim/loop-over-multiple-arrays-simultaneously.nim b/Task/Loop-over-multiple-arrays-simultaneously/Nim/loop-over-multiple-arrays-simultaneously.nim new file mode 100644 index 0000000000..066c732089 --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/Nim/loop-over-multiple-arrays-simultaneously.nim @@ -0,0 +1,7 @@ +let + a = @['a','b','c'] + b = @["A","B","C"] + c = @[1,2,3] + +for i in 0..2: + echo a[i], b[i], c[i] diff --git a/Task/Loop-over-multiple-arrays-simultaneously/Oforth/loop-over-multiple-arrays-simultaneously.oforth b/Task/Loop-over-multiple-arrays-simultaneously/Oforth/loop-over-multiple-arrays-simultaneously.oforth new file mode 100644 index 0000000000..5147d2b4cf --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/Oforth/loop-over-multiple-arrays-simultaneously.oforth @@ -0,0 +1,2 @@ +[ "a", "b", "c" ] [ "A", "B", "C" ] [ 1, 2, 3 ] +zipAll(3) apply(#[ apply(#print) printcr ]) diff --git a/Task/Loop-over-multiple-arrays-simultaneously/Phix/loop-over-multiple-arrays-simultaneously.phix b/Task/Loop-over-multiple-arrays-simultaneously/Phix/loop-over-multiple-arrays-simultaneously.phix new file mode 100644 index 0000000000..f6c45e02d8 --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/Phix/loop-over-multiple-arrays-simultaneously.phix @@ -0,0 +1,7 @@ +procedure print3(sequence a, b, c) + for i=1 to min({length(a),length(b),length(c)}) do + printf(1, "%s%s%g\n", {a[i], b[i], c[i]}) + end for +end procedure + +print3("abc","ABC",{1, 2, 3}) diff --git a/Task/Loop-over-multiple-arrays-simultaneously/Ring/loop-over-multiple-arrays-simultaneously.ring b/Task/Loop-over-multiple-arrays-simultaneously/Ring/loop-over-multiple-arrays-simultaneously.ring new file mode 100644 index 0000000000..4826894658 --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/Ring/loop-over-multiple-arrays-simultaneously.ring @@ -0,0 +1,7 @@ +array1 = ["a", "b", "c"] +array2 = ["A", "B", "C"] +array3 = [1, 2, 3] + +for n = 1 to 3 + see array1[n] + array2[n] + array3[n] + nl +next diff --git a/Task/Loop-over-multiple-arrays-simultaneously/Sidef/loop-over-multiple-arrays-simultaneously.sidef b/Task/Loop-over-multiple-arrays-simultaneously/Sidef/loop-over-multiple-arrays-simultaneously.sidef new file mode 100644 index 0000000000..b339a883cd --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/Sidef/loop-over-multiple-arrays-simultaneously.sidef @@ -0,0 +1,3 @@ +MultiArray.new(%w(a b c),%w(A B C),%w(1 2 3)).each { |i,j,k| + say (i, j, k); +} diff --git a/Task/Loop-over-multiple-arrays-simultaneously/Swift/loop-over-multiple-arrays-simultaneously.swift b/Task/Loop-over-multiple-arrays-simultaneously/Swift/loop-over-multiple-arrays-simultaneously.swift new file mode 100644 index 0000000000..775b95a61b --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/Swift/loop-over-multiple-arrays-simultaneously.swift @@ -0,0 +1,7 @@ +let a1 = ["a", "b", "c"] +let a2 = ["A", "B", "C"] +let a3 = [1, 2, 3] + +for i in 0 ..< a1.count { + println("\(a1[i])\(a2[i])\(a3[i])") +} diff --git a/Task/Loop-over-multiple-arrays-simultaneously/Ursa/loop-over-multiple-arrays-simultaneously.ursa b/Task/Loop-over-multiple-arrays-simultaneously/Ursa/loop-over-multiple-arrays-simultaneously.ursa new file mode 100644 index 0000000000..c278e1125f --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/Ursa/loop-over-multiple-arrays-simultaneously.ursa @@ -0,0 +1,11 @@ +> decl string<> a b c +> append (split "abc" "") a +> append (split "ABC" "") b +> append (split "123" "") c +> for (decl int i) (< i (size a)) (inc i) +.. out a b c endl console +..end +aA1 +bB2 +cC3 +> _ diff --git a/Task/Loop-over-multiple-arrays-simultaneously/Visual-FoxPro/loop-over-multiple-arrays-simultaneously.visual b/Task/Loop-over-multiple-arrays-simultaneously/Visual-FoxPro/loop-over-multiple-arrays-simultaneously.visual new file mode 100644 index 0000000000..097e6cb0ef --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/Visual-FoxPro/loop-over-multiple-arrays-simultaneously.visual @@ -0,0 +1,36 @@ +LOCAL i As Integer, n As Integer, c As String +LOCAL ARRAY a1[3], a2[3], a3[4], a[3] +*!* Populate the arrays and store the array lengths in a +a1[1] = "a" +a1[2] = "b" +a1[3] = "c" +a[1] = ALEN(a1) +a2[1] = "A" +a2[2] = "B" +a2[3] = "C" +a[2] = ALEN(a2) +a3[1] = "1" +a3[2] = "2" +a3[3] = "3" +a3[4] = "4" +a[3] = ALEN(a3) +*!* Find the maximum length of the arrays +*!* In this case, 4 +n = MAX(a[1], a[2], a[3]) +? "Simple Loop" +FOR i = 1 TO n + c = "" + c = c + IIF(i <= a[1], a1[i], "#") + c = c + IIF(i <= a[2], a2[i], "#") + c = c + IIF(i <= a[3], a3[i], "#") + ? c +ENDFOR +*!* Solution using a cursor +CREATE CURSOR tmp (c1 C(1), c2 C(1), c3 C(1), c4 C(3)) +INSERT INTO tmp (c1, c2, c3) VALUES ("a", "A", "1") +INSERT INTO tmp (c1, c2, c3) VALUES ("b", "B", "2") +INSERT INTO tmp (c1, c2, c3) VALUES ("c", "C", "3") +INSERT INTO tmp (c1, c2, c3) VALUES ("#", "#", "4") +REPLACE c4 WITH c1 + c2 + c3 ALL +? "Solution using a cursor" +LIST OFF FIELDS c4 diff --git a/Task/Loop-over-multiple-arrays-simultaneously/Wart/loop-over-multiple-arrays-simultaneously.wart b/Task/Loop-over-multiple-arrays-simultaneously/Wart/loop-over-multiple-arrays-simultaneously.wart new file mode 100644 index 0000000000..864ae2b329 --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/Wart/loop-over-multiple-arrays-simultaneously.wart @@ -0,0 +1,2 @@ +each (x X n) (zip '(a b c) '(A B C) '(1 2 3)) + prn x X n diff --git a/Task/Loop-over-multiple-arrays-simultaneously/jq/loop-over-multiple-arrays-simultaneously-1.jq b/Task/Loop-over-multiple-arrays-simultaneously/jq/loop-over-multiple-arrays-simultaneously-1.jq new file mode 100644 index 0000000000..eae0168b55 --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/jq/loop-over-multiple-arrays-simultaneously-1.jq @@ -0,0 +1,5 @@ +# zip/0 emits [] if input is []. + +def zip: + . as $in + | [range(0; $in[0]|length) as $i | $in | map( .[$i] ) ]; diff --git a/Task/Loop-over-multiple-arrays-simultaneously/jq/loop-over-multiple-arrays-simultaneously-2.jq b/Task/Loop-over-multiple-arrays-simultaneously/jq/loop-over-multiple-arrays-simultaneously-2.jq new file mode 100644 index 0000000000..7f0aab2de6 --- /dev/null +++ b/Task/Loop-over-multiple-arrays-simultaneously/jq/loop-over-multiple-arrays-simultaneously-2.jq @@ -0,0 +1,8 @@ +# transpose a possibly jagged matrix +def transpose: + if . == [] then [] + else (.[1:] | transpose) as $t + | .[0] as $row + | reduce range(0; [($t|length), (.[0]|length)] | max) as $i + ([]; . + [ [ $row[$i] ] + $t[$i] ]) + end; diff --git a/Task/Loops-Break/Axe/loops-break.axe b/Task/Loops-Break/Axe/loops-break.axe new file mode 100644 index 0000000000..5a7f6ec94f --- /dev/null +++ b/Task/Loops-Break/Axe/loops-break.axe @@ -0,0 +1,7 @@ +While 1 + rand^20→A + Disp A▶Dec + ReturnIf A=10 + rand^20→B + Disp B▶Dec,i +End diff --git a/Task/Loops-Break/ERRE/loops-break.erre b/Task/Loops-Break/ERRE/loops-break.erre new file mode 100644 index 0000000000..20e03d3c51 --- /dev/null +++ b/Task/Loops-Break/ERRE/loops-break.erre @@ -0,0 +1,6 @@ +LOOP + A=INT(RND(1)*20) + PRINT(A) + IF A=10 THEN EXIT LOOP END IF !EXIT FOR works the same inside FOR loops + PRINT(INT(RND(1)*20)) +END LOOP diff --git a/Task/Loops-Break/FreeBASIC/loops-break.freebasic b/Task/Loops-Break/FreeBASIC/loops-break.freebasic new file mode 100644 index 0000000000..c532428307 --- /dev/null +++ b/Task/Loops-Break/FreeBASIC/loops-break.freebasic @@ -0,0 +1,16 @@ +' FB 1.05.0 Win64 + +Dim i As Integer +Randomize +Do + i = Int(Rnd * 20) + Print Using "##"; i; + Print " "; + If i = 10 Then Exit Do + i = Int(Rnd * 20) + Print Using "##"; i; + Print" "; +Loop + +Print +Sleep diff --git a/Task/Loops-Break/FutureBasic/loops-break.futurebasic b/Task/Loops-Break/FutureBasic/loops-break.futurebasic new file mode 100644 index 0000000000..60ccca4968 --- /dev/null +++ b/Task/Loops-Break/FutureBasic/loops-break.futurebasic @@ -0,0 +1,8 @@ +include "ConsoleWindow" +randomize +dim as short stopGo, goOn + +while ( stopGo != 10 ) + stopGo = rnd(19) : print "stopGo ="; stopGo, + goOn = rnd(19) : print "goOn ="; goOn +wend diff --git a/Task/Loops-Break/Harbour/loops-break.harbour b/Task/Loops-Break/Harbour/loops-break.harbour new file mode 100644 index 0000000000..71b0545c8b --- /dev/null +++ b/Task/Loops-Break/Harbour/loops-break.harbour @@ -0,0 +1,13 @@ +PROCEDURE Loop() + + LOCAL n + + DO WHILE .T. + ? n := hb_RandomInt( 0, 19 ) + IF n == 10 + EXIT + ENDIF + ? hb_RandomInt( 0, 19 ) + ENDDO + + RETURN diff --git a/Task/Loops-Break/Lasso/loops-break.lasso b/Task/Loops-Break/Lasso/loops-break.lasso new file mode 100644 index 0000000000..1888c2b558 --- /dev/null +++ b/Task/Loops-Break/Lasso/loops-break.lasso @@ -0,0 +1,7 @@ +local(x = 0) +while(#x != 10) => {^ + #x = integer_random(19,0) + #x + #x == 10 ? loop_abort + ', '+integer_random(19,0)+'\r' +^} diff --git a/Task/Loops-Break/Lingo/loops-break.lingo b/Task/Loops-Break/Lingo/loops-break.lingo new file mode 100644 index 0000000000..7ff5c35e0a --- /dev/null +++ b/Task/Loops-Break/Lingo/loops-break.lingo @@ -0,0 +1,6 @@ +repeat while TRUE + n = random(20)-1 + put n + if n = 10 then exit repeat + put random(20)-1 +end repeat diff --git a/Task/Loops-Break/LiveCode/loops-break.livecode b/Task/Loops-Break/LiveCode/loops-break.livecode new file mode 100644 index 0000000000..5c761548a5 --- /dev/null +++ b/Task/Loops-Break/LiveCode/loops-break.livecode @@ -0,0 +1,8 @@ +command loopForeverRandom + repeat forever + put random(20) - 1 into tRand + put tRand + if tRand is 10 then exit repeat + put random(20) - 1 + end repeat +end loopForeverRandom diff --git a/Task/Loops-Break/Nim/loops-break.nim b/Task/Loops-Break/Nim/loops-break.nim new file mode 100644 index 0000000000..e5d8c3489c --- /dev/null +++ b/Task/Loops-Break/Nim/loops-break.nim @@ -0,0 +1,9 @@ +import math + +while true: + let a = random(20) + echo a + if a == 10: + break + let b = random(20) + echo b diff --git a/Task/Loops-Break/Oforth/loops-break.oforth b/Task/Loops-Break/Oforth/loops-break.oforth new file mode 100644 index 0000000000..75d16b2f98 --- /dev/null +++ b/Task/Loops-Break/Oforth/loops-break.oforth @@ -0,0 +1,5 @@ +while(true) [ + 19 rand dup print ":" print + 10 == ifTrue: [ break ] + 19 rand print " " print + ] diff --git a/Task/Loops-Break/Phix/loops-break.phix b/Task/Loops-Break/Phix/loops-break.phix new file mode 100644 index 0000000000..427422b92e --- /dev/null +++ b/Task/Loops-Break/Phix/loops-break.phix @@ -0,0 +1,7 @@ +integer i +while 1 do + i = rand(20)-1 + printf(1, "%g ", {i}) + if i=10 then exit end if + printf(1, "%g\n", {rand(20)-1}) +end while diff --git a/Task/Loops-Break/Ring/loops-break.ring b/Task/Loops-Break/Ring/loops-break.ring new file mode 100644 index 0000000000..26ab2c1475 --- /dev/null +++ b/Task/Loops-Break/Ring/loops-break.ring @@ -0,0 +1,5 @@ +while true + a = random(20) + see a + nl + if a = 10 exit ok +end diff --git a/Task/Loops-Break/Sidef/loops-break.sidef b/Task/Loops-Break/Sidef/loops-break.sidef new file mode 100644 index 0000000000..975e22cfef --- /dev/null +++ b/Task/Loops-Break/Sidef/loops-break.sidef @@ -0,0 +1,6 @@ +var lim = 20; +loop { + say (var n = lim.rand.int); + n == 10 && break; + say lim.rand.int; +} diff --git a/Task/Loops-Break/Swift/loops-break.swift b/Task/Loops-Break/Swift/loops-break.swift new file mode 100644 index 0000000000..ed23e114a1 --- /dev/null +++ b/Task/Loops-Break/Swift/loops-break.swift @@ -0,0 +1,11 @@ +while true +{ + let a = Int(arc4random()) % (20) + print("a: \(a)",terminator: " ") + if (a == 10) + { + break + } + let b = Int(arc4random()) % (20) + print("b: \(b)") +} diff --git a/Task/Loops-Break/Ursa/loops-break.ursa b/Task/Loops-Break/Ursa/loops-break.ursa new file mode 100644 index 0000000000..464026d0eb --- /dev/null +++ b/Task/Loops-Break/Ursa/loops-break.ursa @@ -0,0 +1,11 @@ +decl ursa.util.random r +decl int a b +while true + set a (r.getint 19) + out a endl console + if (= a 10) + break + end while + set b (r.getint 19) + out b endl console +end while diff --git a/Task/Loops-Continue/ERRE/loops-continue.erre b/Task/Loops-Continue/ERRE/loops-continue.erre new file mode 100644 index 0000000000..6f9ee113d1 --- /dev/null +++ b/Task/Loops-Continue/ERRE/loops-continue.erre @@ -0,0 +1,10 @@ +FOR I=1 TO 10 DO + PRINT(I;CHR$(29);) ! printing a numeric value leaves a blank after it + ! chr$(29) delete it..... + IF I MOD 5=0 THEN + PRINT + CONTINUE FOR + END IF + PRINT(",";) +END FOR +PRINT diff --git a/Task/Loops-Continue/FreeBASIC/loops-continue.freebasic b/Task/Loops-Continue/FreeBASIC/loops-continue.freebasic new file mode 100644 index 0000000000..e262e7b616 --- /dev/null +++ b/Task/Loops-Continue/FreeBASIC/loops-continue.freebasic @@ -0,0 +1,12 @@ +' FB 1.05.0 Win64 +For i As Integer = 1 To 10 + Print Str(i); + If i Mod 5 = 0 Then + Print + Continue For + End If + Print ", "; +Next + +Print +Sleep diff --git a/Task/Loops-Continue/Lasso/loops-continue.lasso b/Task/Loops-Continue/Lasso/loops-continue.lasso new file mode 100644 index 0000000000..51bf265b8c --- /dev/null +++ b/Task/Loops-Continue/Lasso/loops-continue.lasso @@ -0,0 +1,6 @@ +loop(10) => {^ + loop_count + loop_count % 5 ? ', ' | '\r' + loop_count < 100 ? loop_continue + 'Hello, World!' // never gets executed +^} diff --git a/Task/Loops-Continue/Lingo/loops-continue.lingo b/Task/Loops-Continue/Lingo/loops-continue.lingo new file mode 100644 index 0000000000..601b1d9bdc --- /dev/null +++ b/Task/Loops-Continue/Lingo/loops-continue.lingo @@ -0,0 +1,10 @@ +str = "" +repeat with i = 1 to 10 + put i after str + if i mod 5 = 0 then + put RETURN after str + next repeat + end if + put ", " after str +end repeat +put str diff --git a/Task/Loops-Continue/LiveCode/loops-continue.livecode b/Task/Loops-Continue/LiveCode/loops-continue.livecode new file mode 100644 index 0000000000..67983dbbcc --- /dev/null +++ b/Task/Loops-Continue/LiveCode/loops-continue.livecode @@ -0,0 +1,5 @@ +repeat with n = 1 to 10 + put n + if n is 5 then put return + if n < 10 and n is not 5 then put "," +end repeat diff --git a/Task/Loops-Continue/Nim/loops-continue.nim b/Task/Loops-Continue/Nim/loops-continue.nim new file mode 100644 index 0000000000..83a2d8d908 --- /dev/null +++ b/Task/Loops-Continue/Nim/loops-continue.nim @@ -0,0 +1,5 @@ +for i in 1..10: + if i mod 5 == 0: + echo i + continue + stdout.write i, "," diff --git a/Task/Loops-Continue/Oforth/loops-continue.oforth b/Task/Loops-Continue/Oforth/loops-continue.oforth new file mode 100644 index 0000000000..fb478823b8 --- /dev/null +++ b/Task/Loops-Continue/Oforth/loops-continue.oforth @@ -0,0 +1,6 @@ +: loopCont +| i | + 10 loop: i [ + i dup print 5 mod ifZero: [ printcr continue ] + "," . + ] ; diff --git a/Task/Loops-Continue/Phix/loops-continue.phix b/Task/Loops-Continue/Phix/loops-continue.phix new file mode 100644 index 0000000000..a901a6d556 --- /dev/null +++ b/Task/Loops-Continue/Phix/loops-continue.phix @@ -0,0 +1,9 @@ +for i=1 to 10 do + printf(1,"%d", i) + if remainder(i,5)=0 then + printf(1, "\n") + continue + end if + printf(1,", ") +end for +{} = wait_key() diff --git a/Task/Loops-Continue/Ring/loops-continue.ring b/Task/Loops-Continue/Ring/loops-continue.ring new file mode 100644 index 0000000000..ca3bc36889 --- /dev/null +++ b/Task/Loops-Continue/Ring/loops-continue.ring @@ -0,0 +1,8 @@ +for i = 1 TO 10 + see i + if i % 5 = 0 + see nl + loop + ok + see ", " +next diff --git a/Task/Loops-Continue/Sidef/loops-continue.sidef b/Task/Loops-Continue/Sidef/loops-continue.sidef new file mode 100644 index 0000000000..fab340c818 --- /dev/null +++ b/Task/Loops-Continue/Sidef/loops-continue.sidef @@ -0,0 +1,8 @@ +for i in (1..10) { + print i + if (i %% 5) { + print "\n" + next + } + print ', ' +} diff --git a/Task/Loops-Continue/Swift/loops-continue.swift b/Task/Loops-Continue/Swift/loops-continue.swift new file mode 100644 index 0000000000..0340187411 --- /dev/null +++ b/Task/Loops-Continue/Swift/loops-continue.swift @@ -0,0 +1,8 @@ +for i in 1...10 { + print(i) + if i%5 == 0 { + println() + continue + } + print(", ") +} diff --git a/Task/Loops-Continue/Ursa/loops-continue.ursa b/Task/Loops-Continue/Ursa/loops-continue.ursa new file mode 100644 index 0000000000..483d6e8ff1 --- /dev/null +++ b/Task/Loops-Continue/Ursa/loops-continue.ursa @@ -0,0 +1,8 @@ +decl int i +for (set i 1) (< i 11) (inc i) + if (= (mod i 5) 0) + out i endl console + continue + end if + out i ", " console +end for diff --git a/Task/Loops-Continue/jq/loops-continue.jq b/Task/Loops-Continue/jq/loops-continue.jq new file mode 100644 index 0000000000..7f3da13509 --- /dev/null +++ b/Task/Loops-Continue/jq/loops-continue.jq @@ -0,0 +1,2 @@ +reduce range(1;11) as $i + (""; . + "\($i)" + (if $i % 5 == 0 then "\n" else ", " end)) diff --git a/Task/Loops-Do-while/Axe/loops-do-while.axe b/Task/Loops-Do-while/Axe/loops-do-while.axe new file mode 100644 index 0000000000..c8a50ae277 --- /dev/null +++ b/Task/Loops-Do-while/Axe/loops-do-while.axe @@ -0,0 +1,5 @@ +0→A +While 1 + A++ + Disp A▶Dec,i +End!If A^6 diff --git a/Task/Loops-Do-while/ChucK/loops-do-while.chuck b/Task/Loops-Do-while/ChucK/loops-do-while.chuck new file mode 100644 index 0000000000..134b57e078 --- /dev/null +++ b/Task/Loops-Do-while/ChucK/loops-do-while.chuck @@ -0,0 +1,7 @@ +0 => int value; +do +{ + value++; + <<>>; +} +while(value % 6 != 0); diff --git a/Task/Loops-Do-while/Coco/loops-do-while.coco b/Task/Loops-Do-while/Coco/loops-do-while.coco new file mode 100644 index 0000000000..5292a88d12 --- /dev/null +++ b/Task/Loops-Do-while/Coco/loops-do-while.coco @@ -0,0 +1,4 @@ +v = 0 +do + console.log ++v +while v % 6 diff --git a/Task/Loops-Do-while/ERRE/loops-do-while.erre b/Task/Loops-Do-while/ERRE/loops-do-while.erre new file mode 100644 index 0000000000..fd9c26e8b7 --- /dev/null +++ b/Task/Loops-Do-while/ERRE/loops-do-while.erre @@ -0,0 +1,5 @@ +A=0 +REPEAT + A=A+1 + PRINT(A) +UNTIL A MOD 6=0 !UNTIL A-6*INT(A/6)=0 for C-64 diff --git a/Task/Loops-Do-while/FreeBASIC/loops-do-while.freebasic b/Task/Loops-Do-while/FreeBASIC/loops-do-while.freebasic new file mode 100644 index 0000000000..fb54be5947 --- /dev/null +++ b/Task/Loops-Do-while/FreeBASIC/loops-do-while.freebasic @@ -0,0 +1,9 @@ +' FB 1.05. 0 Win64 + +Dim i As Integer = 0 +Do + i += 1 + Print i; " "; +Loop While i Mod 6 <> 0 +Print +Sleep diff --git a/Task/Loops-Do-while/FutureBasic/loops-do-while.futurebasic b/Task/Loops-Do-while/FutureBasic/loops-do-while.futurebasic new file mode 100644 index 0000000000..f3e5d43257 --- /dev/null +++ b/Task/Loops-Do-while/FutureBasic/loops-do-while.futurebasic @@ -0,0 +1,8 @@ +include "ConsoleWindow" + +dim as long i + +do + i++ + print i +until ( i mod 6 == 0 ) diff --git a/Task/Loops-Do-while/Harbour/loops-do-while.harbour b/Task/Loops-Do-while/Harbour/loops-do-while.harbour new file mode 100644 index 0000000000..c2fb59e3c4 --- /dev/null +++ b/Task/Loops-Do-while/Harbour/loops-do-while.harbour @@ -0,0 +1,8 @@ +LOCAL n := 0 + +DO WHILE .T. + ? ++n + IF n % 6 == 0 + EXIT + ENDIF +ENDDO diff --git a/Task/Loops-Do-while/Lasso/loops-do-while.lasso b/Task/Loops-Do-while/Lasso/loops-do-while.lasso new file mode 100644 index 0000000000..e8fcbcce8f --- /dev/null +++ b/Task/Loops-Do-while/Lasso/loops-do-while.lasso @@ -0,0 +1,5 @@ +local(x = 0) +while(#x % 6 > 0 || #x == 0) => {^ + ++#x + '\r' // for formatting +^} diff --git a/Task/Loops-Do-while/Lingo/loops-do-while.lingo b/Task/Loops-Do-while/Lingo/loops-do-while.lingo new file mode 100644 index 0000000000..3d3b0273e3 --- /dev/null +++ b/Task/Loops-Do-while/Lingo/loops-do-while.lingo @@ -0,0 +1,6 @@ +i = 0 +repeat while TRUE + i = i+1 + put i + if i mod 6 = 0 then exit repeat +end diff --git a/Task/Loops-Do-while/LiveCode/loops-do-while.livecode b/Task/Loops-Do-while/LiveCode/loops-do-while.livecode new file mode 100644 index 0000000000..12269279ef --- /dev/null +++ b/Task/Loops-Do-while/LiveCode/loops-do-while.livecode @@ -0,0 +1,4 @@ +repeat while n mod 6 is not 0 or n is 0 + add 1 to n + put n +end repeat diff --git a/Task/Loops-Do-while/Monicelli/loops-do-while.monicelli b/Task/Loops-Do-while/Monicelli/loops-do-while.monicelli new file mode 100644 index 0000000000..0f65243457 --- /dev/null +++ b/Task/Loops-Do-while/Monicelli/loops-do-while.monicelli @@ -0,0 +1,3 @@ +stuzzica + ... # loop body +e brematura anche, se # exit if is false diff --git a/Task/Loops-Do-while/Nim/loops-do-while.nim b/Task/Loops-Do-while/Nim/loops-do-while.nim new file mode 100644 index 0000000000..279db83be2 --- /dev/null +++ b/Task/Loops-Do-while/Nim/loops-do-while.nim @@ -0,0 +1,9 @@ +template doWhile(a: expr, b: stmt): stmt = + b + while a: + b + +var val = 1 +doWhile val mod 6 != 0: + val += 1 + echo val diff --git a/Task/Loops-Do-while/Oforth/loops-do-while.oforth b/Task/Loops-Do-while/Oforth/loops-do-while.oforth new file mode 100644 index 0000000000..32faa40867 --- /dev/null +++ b/Task/Loops-Do-while/Oforth/loops-do-while.oforth @@ -0,0 +1 @@ +0 doWhile: [ 1+ dup . dup 6 rem 0 <> ] drop diff --git a/Task/Loops-Do-while/PHL/loops-do-while.phl b/Task/Loops-Do-while/PHL/loops-do-while.phl new file mode 100644 index 0000000000..3f6989d12d --- /dev/null +++ b/Task/Loops-Do-while/PHL/loops-do-while.phl @@ -0,0 +1,5 @@ +var i = 0; +do { + i = i::inc; + printf("%i\n", i); +} while (i%6 != 0); diff --git a/Task/Loops-Do-while/Phix/loops-do-while.phix b/Task/Loops-Do-while/Phix/loops-do-while.phix new file mode 100644 index 0000000000..ceecb57b34 --- /dev/null +++ b/Task/Loops-Do-while/Phix/loops-do-while.phix @@ -0,0 +1,6 @@ +integer x = 0 +while 1 do + x += 1 + ?x + if mod(x,6)=0 then exit end if +end while diff --git a/Task/Loops-Do-while/Ring/loops-do-while.ring b/Task/Loops-Do-while/Ring/loops-do-while.ring new file mode 100644 index 0000000000..7be9fef6d0 --- /dev/null +++ b/Task/Loops-Do-while/Ring/loops-do-while.ring @@ -0,0 +1,5 @@ + n = 0 + While True + n++ See n + nl + if n % 6 = 0 exit ok + end diff --git a/Task/Loops-Do-while/Sidef/loops-do-while.sidef b/Task/Loops-Do-while/Sidef/loops-do-while.sidef new file mode 100644 index 0000000000..e288d26805 --- /dev/null +++ b/Task/Loops-Do-while/Sidef/loops-do-while.sidef @@ -0,0 +1,4 @@ +var value = 0; +do { + say ++value; +} while (value % 6); diff --git a/Task/Loops-Do-while/Sparkling/loops-do-while.sparkling b/Task/Loops-Do-while/Sparkling/loops-do-while.sparkling new file mode 100644 index 0000000000..46c9f448bf --- /dev/null +++ b/Task/Loops-Do-while/Sparkling/loops-do-while.sparkling @@ -0,0 +1,4 @@ +var i = 0; +do { + print(++i); +} while (i % 6 != 0); diff --git a/Task/Loops-Do-while/Swift/loops-do-while-1.swift b/Task/Loops-Do-while/Swift/loops-do-while-1.swift new file mode 100644 index 0000000000..2e5e325811 --- /dev/null +++ b/Task/Loops-Do-while/Swift/loops-do-while-1.swift @@ -0,0 +1,5 @@ +var val = 0 +repeat { + val++ + print(val) +} while val % 6 != 0 diff --git a/Task/Loops-Do-while/Swift/loops-do-while-2.swift b/Task/Loops-Do-while/Swift/loops-do-while-2.swift new file mode 100644 index 0000000000..c13dc5b761 --- /dev/null +++ b/Task/Loops-Do-while/Swift/loops-do-while-2.swift @@ -0,0 +1,5 @@ +var val = 0 +do { + val++ + println(val) +} while val % 6 != 0 diff --git a/Task/Loops-Do-while/jq/loops-do-while-1.jq b/Task/Loops-Do-while/jq/loops-do-while-1.jq new file mode 100644 index 0000000000..2aa410c633 --- /dev/null +++ b/Task/Loops-Do-while/jq/loops-do-while-1.jq @@ -0,0 +1,4 @@ +# Perform the action, then check the condition, etc +def do_while( action; condition ): + def w: action | if (condition | not) then empty else ., w end; + w; diff --git a/Task/Loops-Do-while/jq/loops-do-while-2.jq b/Task/Loops-Do-while/jq/loops-do-while-2.jq new file mode 100644 index 0000000000..997267c8a7 --- /dev/null +++ b/Task/Loops-Do-while/jq/loops-do-while-2.jq @@ -0,0 +1 @@ +0 | do_while( .+1; . % 6 != 0 ) diff --git a/Task/Loops-Downward-for/Axe/loops-downward-for.axe b/Task/Loops-Downward-for/Axe/loops-downward-for.axe new file mode 100644 index 0000000000..be3324c87e --- /dev/null +++ b/Task/Loops-Downward-for/Axe/loops-downward-for.axe @@ -0,0 +1,3 @@ +For(I,0,10) + Disp 10-I▶Dec,i +End diff --git a/Task/Loops-Downward-for/Ceylon/loops-downward-for.ceylon b/Task/Loops-Downward-for/Ceylon/loops-downward-for.ceylon new file mode 100644 index 0000000000..09d1ee5774 --- /dev/null +++ b/Task/Loops-Downward-for/Ceylon/loops-downward-for.ceylon @@ -0,0 +1,3 @@ +for (i in 10..0) { + print(i); +} diff --git a/Task/Loops-Downward-for/ERRE/loops-downward-for.erre b/Task/Loops-Downward-for/ERRE/loops-downward-for.erre new file mode 100644 index 0000000000..870433cf42 --- /dev/null +++ b/Task/Loops-Downward-for/ERRE/loops-downward-for.erre @@ -0,0 +1,3 @@ + FOR I%=10 TO 0 STEP -1 DO + PRINT(I%) + END FOR diff --git a/Task/Loops-Downward-for/EchoLisp/loops-downward-for.echolisp b/Task/Loops-Downward-for/EchoLisp/loops-downward-for.echolisp new file mode 100644 index 0000000000..6706371869 --- /dev/null +++ b/Task/Loops-Downward-for/EchoLisp/loops-downward-for.echolisp @@ -0,0 +1,3 @@ +(for ((longtemps-je-me-suis-couché-de-bonne-heure (in-range 10 -1 -1))) + (write longtemps-je-me-suis-couché-de-bonne-heure)) + → 10 9 8 7 6 5 4 3 2 1 0 diff --git a/Task/Loops-Downward-for/FreeBASIC/loops-downward-for.freebasic b/Task/Loops-Downward-for/FreeBASIC/loops-downward-for.freebasic new file mode 100644 index 0000000000..a49002c428 --- /dev/null +++ b/Task/Loops-Downward-for/FreeBASIC/loops-downward-for.freebasic @@ -0,0 +1,7 @@ +' FB 1.05.0 Win64 + +For i As Integer = 10 To 0 Step -1 + Print i; " "; +Next +Print +Sleep diff --git a/Task/Loops-Downward-for/FutureBasic/loops-downward-for.futurebasic b/Task/Loops-Downward-for/FutureBasic/loops-downward-for.futurebasic new file mode 100644 index 0000000000..1f21e07d0a --- /dev/null +++ b/Task/Loops-Downward-for/FutureBasic/loops-downward-for.futurebasic @@ -0,0 +1,7 @@ +include "ConsoleWindow" + +dim as long i + +for i = 10 to 0 step -1 +print i +next diff --git a/Task/Loops-Downward-for/Harbour/loops-downward-for.harbour b/Task/Loops-Downward-for/Harbour/loops-downward-for.harbour new file mode 100644 index 0000000000..4c6c27a6e8 --- /dev/null +++ b/Task/Loops-Downward-for/Harbour/loops-downward-for.harbour @@ -0,0 +1,3 @@ +FOR i := 10 TO 0 STEP -1 + ? i +NEXT diff --git a/Task/Loops-Downward-for/Lasso/loops-downward-for.lasso b/Task/Loops-Downward-for/Lasso/loops-downward-for.lasso new file mode 100644 index 0000000000..05763a0c58 --- /dev/null +++ b/Task/Loops-Downward-for/Lasso/loops-downward-for.lasso @@ -0,0 +1 @@ +loop(-from=10, -to=0, -by=-1) => {^ loop_count + ' ' ^} diff --git a/Task/Loops-Downward-for/Lingo/loops-downward-for.lingo b/Task/Loops-Downward-for/Lingo/loops-downward-for.lingo new file mode 100644 index 0000000000..2e14b5a2d5 --- /dev/null +++ b/Task/Loops-Downward-for/Lingo/loops-downward-for.lingo @@ -0,0 +1,3 @@ +repeat with i = 10 down to 0 + put i +end repeat diff --git a/Task/Loops-Downward-for/LiveCode/loops-downward-for-1.livecode b/Task/Loops-Downward-for/LiveCode/loops-downward-for-1.livecode new file mode 100644 index 0000000000..2baeabe783 --- /dev/null +++ b/Task/Loops-Downward-for/LiveCode/loops-downward-for-1.livecode @@ -0,0 +1,5 @@ +local x=10 +repeat for 10 times + put x & return + add -1 to x +end repeat diff --git a/Task/Loops-Downward-for/LiveCode/loops-downward-for-2.livecode b/Task/Loops-Downward-for/LiveCode/loops-downward-for-2.livecode new file mode 100644 index 0000000000..e2d9d06f58 --- /dev/null +++ b/Task/Loops-Downward-for/LiveCode/loops-downward-for-2.livecode @@ -0,0 +1,3 @@ +repeat with n=10 down to 1 + put n +end repeat diff --git a/Task/Loops-Downward-for/Nim/loops-downward-for.nim b/Task/Loops-Downward-for/Nim/loops-downward-for.nim new file mode 100644 index 0000000000..2a4e402612 --- /dev/null +++ b/Task/Loops-Downward-for/Nim/loops-downward-for.nim @@ -0,0 +1 @@ +for x in countdown(10,0): echo(x) diff --git a/Task/Loops-Downward-for/Oforth/loops-downward-for.oforth b/Task/Loops-Downward-for/Oforth/loops-downward-for.oforth new file mode 100644 index 0000000000..b05bf3f3c7 --- /dev/null +++ b/Task/Loops-Downward-for/Oforth/loops-downward-for.oforth @@ -0,0 +1 @@ +10 0 -1 step: i [ i println ] diff --git a/Task/Loops-Downward-for/Peloton/loops-downward-for-1.peloton b/Task/Loops-Downward-for/Peloton/loops-downward-for-1.peloton new file mode 100644 index 0000000000..c926a0dc0b --- /dev/null +++ b/Task/Loops-Downward-for/Peloton/loops-downward-for-1.peloton @@ -0,0 +1 @@ +<@ ITEFORLITLITLITLIT>0|<@ SAYVALFOR>...|10|-1 diff --git a/Task/Loops-Downward-for/Peloton/loops-downward-for-2.peloton b/Task/Loops-Downward-for/Peloton/loops-downward-for-2.peloton new file mode 100644 index 0000000000..467d672d5d --- /dev/null +++ b/Task/Loops-Downward-for/Peloton/loops-downward-for-2.peloton @@ -0,0 +1 @@ +<# 迭代迭代次数字串字串字串字串>0|<# 显示值迭代次数>...|10|-1 diff --git a/Task/Loops-Downward-for/Phix/loops-downward-for.phix b/Task/Loops-Downward-for/Phix/loops-downward-for.phix new file mode 100644 index 0000000000..af4a741c0f --- /dev/null +++ b/Task/Loops-Downward-for/Phix/loops-downward-for.phix @@ -0,0 +1,3 @@ +for i=10 to 0 by -1 do + ?i +end for diff --git a/Task/Loops-Downward-for/Ring/loops-downward-for.ring b/Task/Loops-Downward-for/Ring/loops-downward-for.ring new file mode 100644 index 0000000000..2cb7620484 --- /dev/null +++ b/Task/Loops-Downward-for/Ring/loops-downward-for.ring @@ -0,0 +1 @@ +for i = 10 to 0 step -1 see i + nl next diff --git a/Task/Loops-Downward-for/SSEM/loops-downward-for.ssem b/Task/Loops-Downward-for/SSEM/loops-downward-for.ssem new file mode 100644 index 0000000000..bbcff90424 --- /dev/null +++ b/Task/Loops-Downward-for/SSEM/loops-downward-for.ssem @@ -0,0 +1,19 @@ +10001000000000100000000000000000 0. -17 to c +11001000000001100000000000000000 1. c to 19 +11001000000000100000000000000000 2. -19 to c +01001000000000010000000000000000 3. Sub. 18 +00010000000001100000000000000000 4. c to 8 +01001000000000100000000000000000 5. -18 to c +11001000000001100000000000000000 6. c to 19 +11001000000000100000000000000000 7. -19 to c +00000000000000000000000000000000 8. generated at run time +11110000000000010000000000000000 9. Sub. 15 +01001000000001100000000000000000 10. c to 18 +11110000000000010000000000000000 11. Sub. 15 +00000000000000110000000000000000 12. Test +00001000000000000000000000000000 13. 16 to CI +00000000000001110000000000000000 14. Stop +10000000000000000000000000000000 15. 1 +11111111111111111111111111111111 16. -1 +00000100000001100000000000000000 17. c to 32 +01010000000000000000000000000000 18. 10 diff --git a/Task/Loops-Downward-for/Sidef/loops-downward-for-1.sidef b/Task/Loops-Downward-for/Sidef/loops-downward-for-1.sidef new file mode 100644 index 0000000000..88ec633505 --- /dev/null +++ b/Task/Loops-Downward-for/Sidef/loops-downward-for-1.sidef @@ -0,0 +1,3 @@ +for (var i = 10; i >= 0; i--) { + say i +} diff --git a/Task/Loops-Downward-for/Sidef/loops-downward-for-2.sidef b/Task/Loops-Downward-for/Sidef/loops-downward-for-2.sidef new file mode 100644 index 0000000000..47294929cd --- /dev/null +++ b/Task/Loops-Downward-for/Sidef/loops-downward-for-2.sidef @@ -0,0 +1,3 @@ +for i in (11 ^.. 0) { + say i +} diff --git a/Task/Loops-Downward-for/Sidef/loops-downward-for-3.sidef b/Task/Loops-Downward-for/Sidef/loops-downward-for-3.sidef new file mode 100644 index 0000000000..997a47965b --- /dev/null +++ b/Task/Loops-Downward-for/Sidef/loops-downward-for-3.sidef @@ -0,0 +1,3 @@ +10.downto(0).each { |i| + say i +} diff --git a/Task/Loops-Downward-for/Sparkling/loops-downward-for.sparkling b/Task/Loops-Downward-for/Sparkling/loops-downward-for.sparkling new file mode 100644 index 0000000000..5df6cd5b44 --- /dev/null +++ b/Task/Loops-Downward-for/Sparkling/loops-downward-for.sparkling @@ -0,0 +1,3 @@ +for var i = 10; i >= 0; i-- { + print(i); +} diff --git a/Task/Loops-Downward-for/Swift/loops-downward-for-1.swift b/Task/Loops-Downward-for/Swift/loops-downward-for-1.swift new file mode 100644 index 0000000000..cc802ea392 --- /dev/null +++ b/Task/Loops-Downward-for/Swift/loops-downward-for-1.swift @@ -0,0 +1,3 @@ +for i in stride(from: 10, through: 0, by: -1) { + println(i) +} diff --git a/Task/Loops-Downward-for/Swift/loops-downward-for-2.swift b/Task/Loops-Downward-for/Swift/loops-downward-for-2.swift new file mode 100644 index 0000000000..87cdaf9978 --- /dev/null +++ b/Task/Loops-Downward-for/Swift/loops-downward-for-2.swift @@ -0,0 +1,3 @@ +for i in lazy(0...10).reverse() { + println(i) +} diff --git a/Task/Loops-Downward-for/Swift/loops-downward-for-3.swift b/Task/Loops-Downward-for/Swift/loops-downward-for-3.swift new file mode 100644 index 0000000000..14fdb66d46 --- /dev/null +++ b/Task/Loops-Downward-for/Swift/loops-downward-for-3.swift @@ -0,0 +1,3 @@ +for i in reverse(0 ... 10) { + println(i) +} diff --git a/Task/Loops-Downward-for/Swift/loops-downward-for-4.swift b/Task/Loops-Downward-for/Swift/loops-downward-for-4.swift new file mode 100644 index 0000000000..97c4ca321d --- /dev/null +++ b/Task/Loops-Downward-for/Swift/loops-downward-for-4.swift @@ -0,0 +1,3 @@ +for var i = 10; i >= 0; i-- { + println(i) +} diff --git a/Task/Loops-Downward-for/Swift/loops-downward-for-5.swift b/Task/Loops-Downward-for/Swift/loops-downward-for-5.swift new file mode 100644 index 0000000000..773b06fd95 --- /dev/null +++ b/Task/Loops-Downward-for/Swift/loops-downward-for-5.swift @@ -0,0 +1,3 @@ +for i in (0...10).reversed() { + print(i) +} diff --git a/Task/Loops-Downward-for/Ursa/loops-downward-for.ursa b/Task/Loops-Downward-for/Ursa/loops-downward-for.ursa new file mode 100644 index 0000000000..21a8077b64 --- /dev/null +++ b/Task/Loops-Downward-for/Ursa/loops-downward-for.ursa @@ -0,0 +1,4 @@ +decl int i +for (set i 10) (> i -1) (dec i) + out i endl console +end for diff --git a/Task/Loops-Downward-for/Wart/loops-downward-for.wart b/Task/Loops-Downward-for/Wart/loops-downward-for.wart new file mode 100644 index 0000000000..d73a6a120d --- /dev/null +++ b/Task/Loops-Downward-for/Wart/loops-downward-for.wart @@ -0,0 +1,2 @@ +for i 10 (i >= 0) --i + prn i diff --git a/Task/Loops-Downward-for/jq/loops-downward-for.jq b/Task/Loops-Downward-for/jq/loops-downward-for.jq new file mode 100644 index 0000000000..dc0ffe36fa --- /dev/null +++ b/Task/Loops-Downward-for/jq/loops-downward-for.jq @@ -0,0 +1 @@ +range(10;-1;-1) diff --git a/Task/Loops-For-with-a-specified-step/Axe/loops-for-with-a-specified-step.axe b/Task/Loops-For-with-a-specified-step/Axe/loops-for-with-a-specified-step.axe new file mode 100644 index 0000000000..57f43cc2fe --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Axe/loops-for-with-a-specified-step.axe @@ -0,0 +1,4 @@ +For(I,0,10) + Disp I▶Dec,i + I++ +End diff --git a/Task/Loops-For-with-a-specified-step/Ceylon/loops-for-with-a-specified-step.ceylon b/Task/Loops-For-with-a-specified-step/Ceylon/loops-for-with-a-specified-step.ceylon new file mode 100644 index 0000000000..8269ad61e9 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Ceylon/loops-for-with-a-specified-step.ceylon @@ -0,0 +1,7 @@ +shared void run() { + + for(i in (2..8).by(2)) { + process.write("``i`` "); + } + print("who do we appreciate?"); +} diff --git a/Task/Loops-For-with-a-specified-step/ChucK/loops-for-with-a-specified-step-1.chuck b/Task/Loops-For-with-a-specified-step/ChucK/loops-for-with-a-specified-step-1.chuck new file mode 100644 index 0000000000..c79448d7f6 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/ChucK/loops-for-with-a-specified-step-1.chuck @@ -0,0 +1,7 @@ +SinOsc s => dac; + +for (0 => int i; i < 2000; 5 +=> i ) +{ + i => s.freq; + 100::ms => now; +} diff --git a/Task/Loops-For-with-a-specified-step/ChucK/loops-for-with-a-specified-step-2.chuck b/Task/Loops-For-with-a-specified-step/ChucK/loops-for-with-a-specified-step-2.chuck new file mode 100644 index 0000000000..0caa1b5ebb --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/ChucK/loops-for-with-a-specified-step-2.chuck @@ -0,0 +1,4 @@ +for (0 => int i; i < 2000; 5 +=> i ) +{ + <<< i >>>; +} diff --git a/Task/Loops-For-with-a-specified-step/ERRE/loops-for-with-a-specified-step.erre b/Task/Loops-For-with-a-specified-step/ERRE/loops-for-with-a-specified-step.erre new file mode 100644 index 0000000000..c02f84036d --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/ERRE/loops-for-with-a-specified-step.erre @@ -0,0 +1,3 @@ + FOR N=2 TO 8 STEP 1.5 DO + PRINT(N) + END FOR diff --git a/Task/Loops-For-with-a-specified-step/EchoLisp/loops-for-with-a-specified-step.echolisp b/Task/Loops-For-with-a-specified-step/EchoLisp/loops-for-with-a-specified-step.echolisp new file mode 100644 index 0000000000..5f5305575d --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/EchoLisp/loops-for-with-a-specified-step.echolisp @@ -0,0 +1,8 @@ +(for ((i (in-range 0 15 2))) (write i)) + 0 2 4 6 8 10 12 14 + +(for ((q (in-range 0 15 14/8))) (write q)) + 0 7/4 7/2 21/4 7 35/4 21/2 49/4 14 + +(for ((x (in-range 0 15 PI))) (write x)) + 0 3.141592653589793 6.283185307179586 9.42477796076938 12.566370614359172 diff --git a/Task/Loops-For-with-a-specified-step/FOCAL/loops-for-with-a-specified-step.focal b/Task/Loops-For-with-a-specified-step/FOCAL/loops-for-with-a-specified-step.focal new file mode 100644 index 0000000000..1a026285b2 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/FOCAL/loops-for-with-a-specified-step.focal @@ -0,0 +1 @@ +FOR I = 1,3,10; TYPE I, ! diff --git a/Task/Loops-For-with-a-specified-step/FreeBASIC/loops-for-with-a-specified-step.freebasic b/Task/Loops-For-with-a-specified-step/FreeBASIC/loops-for-with-a-specified-step.freebasic new file mode 100644 index 0000000000..2a86ad8446 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/FreeBASIC/loops-for-with-a-specified-step.freebasic @@ -0,0 +1,7 @@ +' FB 1.05.0 Win64 + +For i As Integer = 1 To 21 Step 2 + Print i; " "; +Next +Print +Sleep diff --git a/Task/Loops-For-with-a-specified-step/FutureBasic/loops-for-with-a-specified-step.futurebasic b/Task/Loops-For-with-a-specified-step/FutureBasic/loops-for-with-a-specified-step.futurebasic new file mode 100644 index 0000000000..faa79e7121 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/FutureBasic/loops-for-with-a-specified-step.futurebasic @@ -0,0 +1,15 @@ +include "ConsoleWindow" + +dim as Str15 s(11) +dim as long i + +s(0) = "Somewhere" +s(2) = " over" +s(4) = " the" +s(6) = " rainbow" + chr$(13) +s(8) = "Bluebirds" +s(10) = " fly." + +for i = 0 to 10 step 2 +print s(i); +next diff --git a/Task/Loops-For-with-a-specified-step/Lasso/loops-for-with-a-specified-step.lasso b/Task/Loops-For-with-a-specified-step/Lasso/loops-for-with-a-specified-step.lasso new file mode 100644 index 0000000000..833f6547eb --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Lasso/loops-for-with-a-specified-step.lasso @@ -0,0 +1,4 @@ +loop(-to=100, -from=1, -by=2) => {^ + loop_count + '\r' // for formatting +^} diff --git a/Task/Loops-For-with-a-specified-step/Lingo/loops-for-with-a-specified-step.lingo b/Task/Loops-For-with-a-specified-step/Lingo/loops-for-with-a-specified-step.lingo new file mode 100644 index 0000000000..552c3f9d59 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Lingo/loops-for-with-a-specified-step.lingo @@ -0,0 +1,5 @@ +step = 3 +repeat with i = 0 to 10 + put i + i = i + (step-1) +end repeat diff --git a/Task/Loops-For-with-a-specified-step/LiveCode/loops-for-with-a-specified-step-1.livecode b/Task/Loops-For-with-a-specified-step/LiveCode/loops-for-with-a-specified-step-1.livecode new file mode 100644 index 0000000000..5836bdaf5a --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/LiveCode/loops-for-with-a-specified-step-1.livecode @@ -0,0 +1,5 @@ +repeat with n = 0 to 10 step 2 + put n after loopn + if n is not 10 then put comma after loopn +end repeat +put loopn diff --git a/Task/Loops-For-with-a-specified-step/LiveCode/loops-for-with-a-specified-step-2.livecode b/Task/Loops-For-with-a-specified-step/LiveCode/loops-for-with-a-specified-step-2.livecode new file mode 100644 index 0000000000..b1f52db3cb --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/LiveCode/loops-for-with-a-specified-step-2.livecode @@ -0,0 +1 @@ +0,2,4,6,8,10 diff --git a/Task/Loops-For-with-a-specified-step/Nim/loops-for-with-a-specified-step.nim b/Task/Loops-For-with-a-specified-step/Nim/loops-for-with-a-specified-step.nim new file mode 100644 index 0000000000..c823c31597 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Nim/loops-for-with-a-specified-step.nim @@ -0,0 +1 @@ +for x in countdown(10,0,3): echo(x) diff --git a/Task/Loops-For-with-a-specified-step/Oforth/loops-for-with-a-specified-step.oforth b/Task/Loops-For-with-a-specified-step/Oforth/loops-for-with-a-specified-step.oforth new file mode 100644 index 0000000000..8e6320eabd --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Oforth/loops-for-with-a-specified-step.oforth @@ -0,0 +1 @@ + 1 100 2 step: i [ i println ] diff --git a/Task/Loops-For-with-a-specified-step/Panda/loops-for-with-a-specified-step.panda b/Task/Loops-For-with-a-specified-step/Panda/loops-for-with-a-specified-step.panda new file mode 100644 index 0000000000..f191cc5031 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Panda/loops-for-with-a-specified-step.panda @@ -0,0 +1,6 @@ +fun for(from,to,step) type integer,integer,integer->integer + t=to.minus(from).divide(step) + 0..t.times(step).plus(from) + /test it for(1 6 2) -> 1 3 5 + +for(1 3 5) diff --git a/Task/Loops-For-with-a-specified-step/Phix/loops-for-with-a-specified-step.phix b/Task/Loops-For-with-a-specified-step/Phix/loops-for-with-a-specified-step.phix new file mode 100644 index 0000000000..f9ce778d81 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Phix/loops-for-with-a-specified-step.phix @@ -0,0 +1,4 @@ +for i=2 to 8 by 2 do + printf(1,"%d, ",i) +end for +printf(1,"who do we appreciate?\n") diff --git a/Task/Loops-For-with-a-specified-step/Ring/loops-for-with-a-specified-step-1.ring b/Task/Loops-For-with-a-specified-step/Ring/loops-for-with-a-specified-step-1.ring new file mode 100644 index 0000000000..1249296ca5 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Ring/loops-for-with-a-specified-step-1.ring @@ -0,0 +1 @@ +for i = 0 to 10 step 2 see i + nl next diff --git a/Task/Loops-For-with-a-specified-step/Ring/loops-for-with-a-specified-step-2.ring b/Task/Loops-For-with-a-specified-step/Ring/loops-for-with-a-specified-step-2.ring new file mode 100644 index 0000000000..bcad11c2db --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Ring/loops-for-with-a-specified-step-2.ring @@ -0,0 +1 @@ +for i = 0 to 10 step 0.5 see i + nl next diff --git a/Task/Loops-For-with-a-specified-step/SSEM/loops-for-with-a-specified-step.ssem b/Task/Loops-For-with-a-specified-step/SSEM/loops-for-with-a-specified-step.ssem new file mode 100644 index 0000000000..fc2ca1c2f0 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/SSEM/loops-for-with-a-specified-step.ssem @@ -0,0 +1,25 @@ +10101000000000100000000000000000 0. -21 to c +00101000000001100000000000000000 1. c to 20 +00101000000000100000000000000000 2. -20 to c +01101000000000010000000000000000 3. Sub. 22 +10101000000001100000000000000000 4. c to 21 +00000000000000110000000000000000 5. Test +01001000000001000000000000000000 6. Add 18 to CI +00011000000000000000000000000000 7. 24 to CI +11101000000000100000000000000000 8. -23 to CI +01001000000000010000000000000000 9. Sub. 18 +00101000000001100000000000000000 10. c to 20 +00101000000000100000000000000000 11. -20 to c +11101000000001100000000000000000 12. c to 23 +11001000000000000000000000000000 13. 19 to CI +11101000000000100000000000000000 14. -23 to c +00101000000001100000000000000000 15. c to 20 +00101000000000100000000000000000 16. -20 to c +00000000000001110000000000000000 17. Stop +10000000000000000000000000000000 18. 1 +11111111111111111111111111111111 19. -1 +00000000000000000000000000000000 20. 0 +11000001100000000000000000000000 21. 387 +10100000000000000000000000000000 22. 5 +00000000000000000000000000000000 23. 0 +10110000000000000000000000000000 24. 13 diff --git a/Task/Loops-For-with-a-specified-step/Sidef/loops-for-with-a-specified-step-1.sidef b/Task/Loops-For-with-a-specified-step/Sidef/loops-for-with-a-specified-step-1.sidef new file mode 100644 index 0000000000..0c861c2621 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Sidef/loops-for-with-a-specified-step-1.sidef @@ -0,0 +1,3 @@ +for (var i = 2; i <= 8; i += 2) { + say i +} diff --git a/Task/Loops-For-with-a-specified-step/Sidef/loops-for-with-a-specified-step-2.sidef b/Task/Loops-For-with-a-specified-step/Sidef/loops-for-with-a-specified-step-2.sidef new file mode 100644 index 0000000000..cb72aef0db --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Sidef/loops-for-with-a-specified-step-2.sidef @@ -0,0 +1,3 @@ +for i in (2 .. (8, 2)) { + say i +} diff --git a/Task/Loops-For-with-a-specified-step/Sidef/loops-for-with-a-specified-step-3.sidef b/Task/Loops-For-with-a-specified-step/Sidef/loops-for-with-a-specified-step-3.sidef new file mode 100644 index 0000000000..ee77d3d90c --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Sidef/loops-for-with-a-specified-step-3.sidef @@ -0,0 +1,3 @@ +2.to(8).by(2).each { |i| + say i +} diff --git a/Task/Loops-For-with-a-specified-step/Swift/loops-for-with-a-specified-step-1.swift b/Task/Loops-For-with-a-specified-step/Swift/loops-for-with-a-specified-step-1.swift new file mode 100644 index 0000000000..87ef22762d --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Swift/loops-for-with-a-specified-step-1.swift @@ -0,0 +1,3 @@ +for i in 1.stride(to: 10, by: 2) { + print(i) +} diff --git a/Task/Loops-For-with-a-specified-step/Swift/loops-for-with-a-specified-step-2.swift b/Task/Loops-For-with-a-specified-step/Swift/loops-for-with-a-specified-step-2.swift new file mode 100644 index 0000000000..21283d85d7 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Swift/loops-for-with-a-specified-step-2.swift @@ -0,0 +1,3 @@ +for var i = 1; i < 10; i += 2 { + print(i) +} diff --git a/Task/Loops-For-with-a-specified-step/Ursa/loops-for-with-a-specified-step.ursa b/Task/Loops-For-with-a-specified-step/Ursa/loops-for-with-a-specified-step.ursa new file mode 100644 index 0000000000..e30a32b119 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Ursa/loops-for-with-a-specified-step.ursa @@ -0,0 +1,5 @@ +decl int i +for (set i 2) (< i 9) (set i (int (+ i 2))) + out i ", " console +end for +out "who do we appreciate?" endl console diff --git a/Task/Loops-For-with-a-specified-step/Wart/loops-for-with-a-specified-step.wart b/Task/Loops-For-with-a-specified-step/Wart/loops-for-with-a-specified-step.wart new file mode 100644 index 0000000000..9787716983 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/Wart/loops-for-with-a-specified-step.wart @@ -0,0 +1,2 @@ +for i 2 (i <= 8) (i <- i+2) + prn i diff --git a/Task/Loops-For-with-a-specified-step/jq/loops-for-with-a-specified-step-1.jq b/Task/Loops-For-with-a-specified-step/jq/loops-for-with-a-specified-step-1.jq new file mode 100644 index 0000000000..d695b82eff --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/jq/loops-for-with-a-specified-step-1.jq @@ -0,0 +1,4 @@ +# If your version of jq does not have range/3, use this: +def range(m;n;step): range(0; ((n-m)/step) ) | m + (. * step); + +range(2;9;2) diff --git a/Task/Loops-For-with-a-specified-step/jq/loops-for-with-a-specified-step-2.jq b/Task/Loops-For-with-a-specified-step/jq/loops-for-with-a-specified-step-2.jq new file mode 100644 index 0000000000..3177c124e3 --- /dev/null +++ b/Task/Loops-For-with-a-specified-step/jq/loops-for-with-a-specified-step-2.jq @@ -0,0 +1,3 @@ +reduce range(2;9;2) as $i + (""; . + "\($i), ") + + "whom do we appreciate?" diff --git a/Task/Loops-For/8th/loops-for.8th b/Task/Loops-For/8th/loops-for.8th new file mode 100644 index 0000000000..708867a9c7 --- /dev/null +++ b/Task/Loops-For/8th/loops-for.8th @@ -0,0 +1 @@ +( ( '* putc ) swap times cr ) 1 5 loop diff --git a/Task/Loops-For/Apex/loops-for.apex b/Task/Loops-For/Apex/loops-for.apex new file mode 100644 index 0000000000..139694286c --- /dev/null +++ b/Task/Loops-For/Apex/loops-for.apex @@ -0,0 +1,21 @@ +for (Integer i = 0; i < 5; i++) { + String line = ''; + + for (Integer j = 0; j < i; j++) { + line += '*'; + } + + System.debug(line); +} + +List lines = new List { + '*', + '**', + '***', + '****', + '*****' +}; + +for (String line : lines) { + System.debug(line); +} diff --git a/Task/Loops-For/Axe/loops-for.axe b/Task/Loops-For/Axe/loops-for.axe new file mode 100644 index 0000000000..58789e94e1 --- /dev/null +++ b/Task/Loops-For/Axe/loops-for.axe @@ -0,0 +1,6 @@ +ClrHome +For(I,1,5) +For(J,1,I) +Output(J,I,"*") +End +End diff --git a/Task/Loops-For/Ceylon/loops-for.ceylon b/Task/Loops-For/Ceylon/loops-for.ceylon new file mode 100644 index 0000000000..b13edbb204 --- /dev/null +++ b/Task/Loops-For/Ceylon/loops-for.ceylon @@ -0,0 +1,9 @@ +shared void run() { + + for(i in 1..5) { + for(j in 1..i) { + process.write("*"); + } + print(""); + } +} diff --git a/Task/Loops-For/EDSAC-order-code/loops-for.edsac b/Task/Loops-For/EDSAC-order-code/loops-for.edsac new file mode 100644 index 0000000000..0179cdb04f --- /dev/null +++ b/Task/Loops-For/EDSAC-order-code/loops-for.edsac @@ -0,0 +1,50 @@ +[ Loops + ===== + + A program for the EDSAC + + Demonstrates nested loops + and printer output + + Works with Initial Orders 2 ] + + + + T56K [ set load point ] + GK [ set theta ] + + O21@ [ figure shift ] + +[ 1 ] T24@ [ a = 0 ] + A19@ [ a = i ] + +[ 3 ] T20@ [ j = a; a = 0 ] + O22@ [ write character ] + A20@ [ a = j ] + S17@ [ a -= 1 ] + U20@ [ j = a ] + E3@ [ if a>=0 go to 3 ] + + O23@ [ write line feed ] + T24@ [ a = 0 ] + A19@ [ a = i ] + A17@ [ a += 1 ] + U19@ [ i = a ] + S18@ [ a -= 5 ] + G1@ [ if a<0 go to 1 ] + + ZF [ halt ] + +[ 17 ] P0D [ const: 1 ] +[ 18 ] P2D [ const: 5 ] + +[ 19 ] P0F [ var: i ] +[ 20 ] P0F [ var: j ] + +[ 21 ] #F [ figure shift ] +[ 22 ] ZF [ '+' character ] +[ 23 ] &F [ line feed ] + +[ 24 ] P0F [ used to clear a ] + + EZPF [ begin execution ] diff --git a/Task/Loops-For/ERRE/loops-for.erre b/Task/Loops-For/ERRE/loops-for.erre new file mode 100644 index 0000000000..dabb6006f7 --- /dev/null +++ b/Task/Loops-For/ERRE/loops-for.erre @@ -0,0 +1,6 @@ +FOR I=1 TO 5 DO + FOR J=1 TO I DO + PRINT("*";) + END FOR + PRINT +END FOR diff --git a/Task/Loops-For/FOCAL/loops-for.focal b/Task/Loops-For/FOCAL/loops-for.focal new file mode 100644 index 0000000000..1e00d9394d --- /dev/null +++ b/Task/Loops-For/FOCAL/loops-for.focal @@ -0,0 +1,4 @@ +01.10 FOR I=1,4; DO 2.0 + +02.10 FOR J=1,I; TYPE "*" +02.20 TYPE ! diff --git a/Task/Loops-For/FreeBASIC/loops-for.freebasic b/Task/Loops-For/FreeBASIC/loops-for.freebasic new file mode 100644 index 0000000000..473ed660c6 --- /dev/null +++ b/Task/Loops-For/FreeBASIC/loops-for.freebasic @@ -0,0 +1,10 @@ +' FB 1.05.0 Win64 + +For i As Integer = 1 To 5 + For j As Integer = 1 To i + Print "*"; + Next + Print +Next + +Sleep diff --git a/Task/Loops-For/Futhark/loops-for.futhark b/Task/Loops-For/Futhark/loops-for.futhark new file mode 100644 index 0000000000..66c7f492f8 --- /dev/null +++ b/Task/Loops-For/Futhark/loops-for.futhark @@ -0,0 +1,7 @@ +fun main(n: int): [n]int = + loop (a = replicate n 0) = for i < n do + (loop (s = 0) = for j < i+1 do + s + j + let a[i] = s + in a) + in a diff --git a/Task/Loops-For/Hack/loops-for.hack b/Task/Loops-For/Hack/loops-for.hack new file mode 100644 index 0000000000..ef16fd4deb --- /dev/null +++ b/Task/Loops-For/Hack/loops-for.hack @@ -0,0 +1,7 @@ +for($i = 0; $i < 5; $i++) { + for($j = 0; $j <= $i; $j++) { + echo '*'; + } + + echo '\n'; +} diff --git a/Task/Loops-For/LC3-Assembly/loops-for.lc3 b/Task/Loops-For/LC3-Assembly/loops-for.lc3 new file mode 100644 index 0000000000..17125249b8 --- /dev/null +++ b/Task/Loops-For/LC3-Assembly/loops-for.lc3 @@ -0,0 +1,31 @@ + .ORIG 0x3000 + + AND R1,R1,0 + ADD R1,R1,1 + AND R5,R5,0 + ADD R5,R5,5 + NOT R5,R5 + +LOOPI LD R0,STAR + AND R2,R2,0 + ADD R3,R1,0 + +LOOPJ OUT + ADD R2,R2,1 + NOT R4,R2 + ADD R4,R3,R4 + BRZP LOOPJ + + LD R0,LF + OUT + + ADD R1,R1,1 + ADD R4,R1,R5 + BRN LOOPI + + HALT + +STAR .FILL 0x2A +LF .FILL 0x0A + + .END diff --git a/Task/Loops-For/Lasso/loops-for.lasso b/Task/Loops-For/Lasso/loops-for.lasso new file mode 100644 index 0000000000..48196c418e --- /dev/null +++ b/Task/Loops-For/Lasso/loops-for.lasso @@ -0,0 +1,4 @@ +loop(5) => {^ + loop(loop_count) => {^ '*' ^} + '\r' +^} diff --git a/Task/Loops-For/Lingo/loops-for.lingo b/Task/Loops-For/Lingo/loops-for.lingo new file mode 100644 index 0000000000..7368e3ad52 --- /dev/null +++ b/Task/Loops-For/Lingo/loops-for.lingo @@ -0,0 +1,7 @@ +repeat with i = 1 to 5 + str = "" + repeat with j = 1 to i + put "*" after str + end repeat + put str +end repeat diff --git a/Task/Loops-For/LiveCode/loops-for.livecode b/Task/Loops-For/LiveCode/loops-for.livecode new file mode 100644 index 0000000000..33081a78e4 --- /dev/null +++ b/Task/Loops-For/LiveCode/loops-for.livecode @@ -0,0 +1,8 @@ +put 0 into n +repeat for 5 times + add 1 to n + repeat for n times + put "*" + end repeat + put return +end repeat diff --git a/Task/Loops-For/Morfa/loops-for.morfa b/Task/Loops-For/Morfa/loops-for.morfa new file mode 100644 index 0000000000..2e363503cc --- /dev/null +++ b/Task/Loops-For/Morfa/loops-for.morfa @@ -0,0 +1,10 @@ +import morfa.base; + +for (i in 0..5) +{ + for (j in 0..i+1) + { + print("*"); + } + println(""); +} diff --git a/Task/Loops-For/Nim/loops-for.nim b/Task/Loops-For/Nim/loops-for.nim new file mode 100644 index 0000000000..486e917262 --- /dev/null +++ b/Task/Loops-For/Nim/loops-for.nim @@ -0,0 +1,4 @@ +for i in 1..5: + for i in 1..i: + stdout.write("*") + echo("") diff --git a/Task/Loops-For/Oforth/loops-for.oforth b/Task/Loops-For/Oforth/loops-for.oforth new file mode 100644 index 0000000000..d0597cba33 --- /dev/null +++ b/Task/Loops-For/Oforth/loops-for.oforth @@ -0,0 +1,5 @@ +: loopFor(n) +| i j | + n loop: i [ + i loop: j [ "*" print ] + printcr ; diff --git a/Task/Loops-For/Phix/loops-for.phix b/Task/Loops-For/Phix/loops-for.phix new file mode 100644 index 0000000000..56181edd2b --- /dev/null +++ b/Task/Loops-For/Phix/loops-for.phix @@ -0,0 +1,6 @@ +for i=1 to 5 do + for j=1 to i do + puts(1,"*") + end for + puts(1,"\n") +end for diff --git a/Task/Loops-For/Ring/loops-for-1.ring b/Task/Loops-For/Ring/loops-for-1.ring new file mode 100644 index 0000000000..cf11a12e16 --- /dev/null +++ b/Task/Loops-For/Ring/loops-for-1.ring @@ -0,0 +1 @@ +for i = 1 to 5 for x = 1 to i see "*" next see nl next diff --git a/Task/Loops-For/Ring/loops-for-2.ring b/Task/Loops-For/Ring/loops-for-2.ring new file mode 100644 index 0000000000..3e7cb4ee87 --- /dev/null +++ b/Task/Loops-For/Ring/loops-for-2.ring @@ -0,0 +1,6 @@ +for i = 1 to 5 + for x = 1 to i + see "*" + next + see nl +next diff --git a/Task/Loops-For/Sidef/loops-for-1.sidef b/Task/Loops-For/Sidef/loops-for-1.sidef new file mode 100644 index 0000000000..bae39a13f1 --- /dev/null +++ b/Task/Loops-For/Sidef/loops-for-1.sidef @@ -0,0 +1,6 @@ +for (var i = 1; i <= 5; i++) { + for (var j = 1; j <= i; j++) { + print '*' + } + print "\n" +} diff --git a/Task/Loops-For/Sidef/loops-for-2.sidef b/Task/Loops-For/Sidef/loops-for-2.sidef new file mode 100644 index 0000000000..f732244ab9 --- /dev/null +++ b/Task/Loops-For/Sidef/loops-for-2.sidef @@ -0,0 +1,4 @@ +for (1..5) { |i| + for (1..i) { print '*' } + print "\n" +} diff --git a/Task/Loops-For/Sidef/loops-for-3.sidef b/Task/Loops-For/Sidef/loops-for-3.sidef new file mode 100644 index 0000000000..5f881404bf --- /dev/null +++ b/Task/Loops-For/Sidef/loops-for-3.sidef @@ -0,0 +1,4 @@ +for i in (1..5) { + for j in (1..i) { print '*' } + print "\n" +} diff --git a/Task/Loops-For/Sidef/loops-for-4.sidef b/Task/Loops-For/Sidef/loops-for-4.sidef new file mode 100644 index 0000000000..da4a8b8752 --- /dev/null +++ b/Task/Loops-For/Sidef/loops-for-4.sidef @@ -0,0 +1,4 @@ +5.times { |i| + i.times { print '*' } + print "\n" +} diff --git a/Task/Loops-For/Sparkling/loops-for.sparkling b/Task/Loops-For/Sparkling/loops-for.sparkling new file mode 100644 index 0000000000..1258ca0ea2 --- /dev/null +++ b/Task/Loops-For/Sparkling/loops-for.sparkling @@ -0,0 +1,7 @@ +for (var row = 1; row <= 5; row++) { + for (var col = 1; col <= row; col++) { + printf("*"); + } + + print(); +} diff --git a/Task/Loops-For/Swift/loops-for-1.swift b/Task/Loops-For/Swift/loops-for-1.swift new file mode 100644 index 0000000000..122b6de864 --- /dev/null +++ b/Task/Loops-For/Swift/loops-for-1.swift @@ -0,0 +1,6 @@ +for i in 1...5 { + for j in 1...i { + print("*") + } + println() +} diff --git a/Task/Loops-For/Swift/loops-for-2.swift b/Task/Loops-For/Swift/loops-for-2.swift new file mode 100644 index 0000000000..a46923e291 --- /dev/null +++ b/Task/Loops-For/Swift/loops-for-2.swift @@ -0,0 +1,6 @@ +for i in 1..<6 { + for j in 1.. I 5)) + (DO ((J 0 (+ J 1))) ((= J I)) + (DISPLAY "*")) + (NEWLINE)) diff --git a/Task/Loops-For/jq/loops-for.jq b/Task/Loops-For/jq/loops-for.jq new file mode 100644 index 0000000000..e933cbd4ff --- /dev/null +++ b/Task/Loops-For/jq/loops-for.jq @@ -0,0 +1,13 @@ +# Single-string version using explicit nested loops: +def demo(m): + reduce range(0;m) as $i + (""; reduce range(0;$i) as $j + (.; . + "*" ) + "\n" ) ; + +# Stream of strings: +def demo2(m): + range(1;m) + | reduce range(0;.) as $j (""; . + "*"); + +# Variation of demo2 using an implicit inner loop: +def demo3(m): range(1;m) | "*" * . ; diff --git a/Task/Loops-Foreach/Apex/loops-foreach.apex b/Task/Loops-Foreach/Apex/loops-foreach.apex new file mode 100644 index 0000000000..73941d0b54 --- /dev/null +++ b/Task/Loops-Foreach/Apex/loops-foreach.apex @@ -0,0 +1,5 @@ +Integer[] myInts = new Integer[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + +for (Integer i : myInts) { + System.debug(i); +} diff --git a/Task/Loops-Foreach/ERRE/loops-foreach.erre b/Task/Loops-Foreach/ERRE/loops-foreach.erre new file mode 100644 index 0000000000..c9caf7f973 --- /dev/null +++ b/Task/Loops-Foreach/ERRE/loops-foreach.erre @@ -0,0 +1,4 @@ + FOR INDEX$=("The","quick","brown","fox","jumps","over","the","lazy","dog.") DO + PRINT(INDEX$;" ";) + END FOR + PRINT diff --git a/Task/Loops-Foreach/EchoLisp/loops-foreach.echolisp b/Task/Loops-Foreach/EchoLisp/loops-foreach.echolisp new file mode 100644 index 0000000000..b7e3a6c60a --- /dev/null +++ b/Task/Loops-Foreach/EchoLisp/loops-foreach.echolisp @@ -0,0 +1,13 @@ +(define my-list '( albert simon antoinette)) +(for ((h my-list)) (write h)) + albert simon antoinette + +(define my-vector #(55 66 soixante-dix-sept)) +(for (( u my-vector)) (write u)) + 55 66 soixante-dix-sept + +(define my-string "Longtemps") +(for ((une-lettre my-string)) (write une-lettre)) + "L" "o" "n" "g" "t" "e" "m" "p" "s" + +;; etc ... for other collections like Streams, Hashes, Graphs, ... diff --git a/Task/Loops-Foreach/FreeBASIC/loops-foreach.freebasic b/Task/Loops-Foreach/FreeBASIC/loops-foreach.freebasic new file mode 100644 index 0000000000..39197242e4 --- /dev/null +++ b/Task/Loops-Foreach/FreeBASIC/loops-foreach.freebasic @@ -0,0 +1,18 @@ +' FB 1.05.0 + +' FreeBASIC doesn't have a foreach loop but it's easy to manufacture one using macros + +#Macro ForEach(I, A) +For _i as integer = LBound(A) To UBound(A) +#Define I (A(_i)) +#EndMacro + +#Define In , + +Dim a(-5 To 5) As Integer = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} +ForEach(i in a) + Print i; " "; +Next + +Print +Sleep diff --git a/Task/Loops-Foreach/LFE/loops-foreach.lfe b/Task/Loops-Foreach/LFE/loops-foreach.lfe new file mode 100644 index 0000000000..02a17e93ac --- /dev/null +++ b/Task/Loops-Foreach/LFE/loops-foreach.lfe @@ -0,0 +1,4 @@ +(lists:foreach + (lambda (x) + (io:format "item: ~p~n" (list x))) + (lists:seq 1 10)) diff --git a/Task/Loops-Foreach/Lasso/loops-foreach-1.lasso b/Task/Loops-Foreach/Lasso/loops-foreach-1.lasso new file mode 100644 index 0000000000..3b1fbe5332 --- /dev/null +++ b/Task/Loops-Foreach/Lasso/loops-foreach-1.lasso @@ -0,0 +1 @@ +array(1,2,3) => foreach { stdoutnl(#1) } diff --git a/Task/Loops-Foreach/Lasso/loops-foreach-2.lasso b/Task/Loops-Foreach/Lasso/loops-foreach-2.lasso new file mode 100644 index 0000000000..5803930911 --- /dev/null +++ b/Task/Loops-Foreach/Lasso/loops-foreach-2.lasso @@ -0,0 +1 @@ +with i in array(1,2,3) do { stdoutnl(#i) } diff --git a/Task/Loops-Foreach/Lingo/loops-foreach-1.lingo b/Task/Loops-Foreach/Lingo/loops-foreach-1.lingo new file mode 100644 index 0000000000..df99c8bf20 --- /dev/null +++ b/Task/Loops-Foreach/Lingo/loops-foreach-1.lingo @@ -0,0 +1,4 @@ +days = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"] +repeat with day in days + put day +end repeat diff --git a/Task/Loops-Foreach/Lingo/loops-foreach-2.lingo b/Task/Loops-Foreach/Lingo/loops-foreach-2.lingo new file mode 100644 index 0000000000..fca7c66e1e --- /dev/null +++ b/Task/Loops-Foreach/Lingo/loops-foreach-2.lingo @@ -0,0 +1,13 @@ +---------------------------------------- +-- One of the five native iterative methods defined in ECMAScript 5 +-- @param {list} tList +-- @param {symbol} cbFunc +-- @param {object} [cbObj=_movie] +---------------------------------------- +on forEach (tList, cbFunc, cbObj) + if voidP(cbObj) then cbObj = _movie + cnt = tList.count + repeat with i = 1 to cnt + call(cbFunc, cbObj, tList[i], i, tList) + end repeat +end diff --git a/Task/Loops-Foreach/Lingo/loops-foreach-3.lingo b/Task/Loops-Foreach/Lingo/loops-foreach-3.lingo new file mode 100644 index 0000000000..5a4a507099 --- /dev/null +++ b/Task/Loops-Foreach/Lingo/loops-foreach-3.lingo @@ -0,0 +1,2 @@ +days = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"] +forEach(days, #alert, _player) diff --git a/Task/Loops-Foreach/LiveCode/loops-foreach.livecode b/Task/Loops-Foreach/LiveCode/loops-foreach.livecode new file mode 100644 index 0000000000..3fc8dc52f3 --- /dev/null +++ b/Task/Loops-Foreach/LiveCode/loops-foreach.livecode @@ -0,0 +1,4 @@ +repeat for each item x in "red, green, blue" + put x & cr + --wait 100 millisec -- req'd if you want to see in the LC Message Box (akin to repl) +end repeat diff --git a/Task/Loops-Foreach/Nim/loops-foreach.nim b/Task/Loops-Foreach/Nim/loops-foreach.nim new file mode 100644 index 0000000000..c5b0e2d1fd --- /dev/null +++ b/Task/Loops-Foreach/Nim/loops-foreach.nim @@ -0,0 +1,6 @@ +var list: seq[string] = @[] +list.add("lorem") +list.add("ipsum") +list.add("dolor") +for i in items(list): + echo(i) diff --git a/Task/Loops-Foreach/Oforth/loops-foreach-1.oforth b/Task/Loops-Foreach/Oforth/loops-foreach-1.oforth new file mode 100644 index 0000000000..c3d9d0c181 --- /dev/null +++ b/Task/Loops-Foreach/Oforth/loops-foreach-1.oforth @@ -0,0 +1 @@ +: printMonths | m | Date.Months forEach: m [ m . ] ; diff --git a/Task/Loops-Foreach/Oforth/loops-foreach-2.oforth b/Task/Loops-Foreach/Oforth/loops-foreach-2.oforth new file mode 100644 index 0000000000..3c5e7e32d0 --- /dev/null +++ b/Task/Loops-Foreach/Oforth/loops-foreach-2.oforth @@ -0,0 +1 @@ +#. Date.Months apply diff --git a/Task/Loops-Foreach/PHL/loops-foreach.phl b/Task/Loops-Foreach/PHL/loops-foreach.phl new file mode 100644 index 0000000000..64fd91d93b --- /dev/null +++ b/Task/Loops-Foreach/PHL/loops-foreach.phl @@ -0,0 +1,5 @@ +var numbers = 1..10; + +numbers each # (number) [ + printf("%i\n", number); +]; diff --git a/Task/Loops-Foreach/Phix/loops-foreach.phix b/Task/Loops-Foreach/Phix/loops-foreach.phix new file mode 100644 index 0000000000..e3c1fc4242 --- /dev/null +++ b/Task/Loops-Foreach/Phix/loops-foreach.phix @@ -0,0 +1,4 @@ +sequence s = {-2,"field",3.14159268979,{"this","that"}} +for i=1 to length(s) do + ?s[i] +end for diff --git a/Task/Loops-Foreach/Ring/loops-foreach.ring b/Task/Loops-Foreach/Ring/loops-foreach.ring new file mode 100644 index 0000000000..83ee38eb7b --- /dev/null +++ b/Task/Loops-Foreach/Ring/loops-foreach.ring @@ -0,0 +1,4 @@ +aList = "Welcome to the Ring Programming Language" +for n in aList + see n + nl +next diff --git a/Task/Loops-Foreach/Sidef/loops-foreach-1.sidef b/Task/Loops-Foreach/Sidef/loops-foreach-1.sidef new file mode 100644 index 0000000000..6e04caac41 --- /dev/null +++ b/Task/Loops-Foreach/Sidef/loops-foreach-1.sidef @@ -0,0 +1,3 @@ +foreach [1,2,3] { |i| + say i +} diff --git a/Task/Loops-Foreach/Sidef/loops-foreach-2.sidef b/Task/Loops-Foreach/Sidef/loops-foreach-2.sidef new file mode 100644 index 0000000000..443e13d4ff --- /dev/null +++ b/Task/Loops-Foreach/Sidef/loops-foreach-2.sidef @@ -0,0 +1,3 @@ +for i in [1,2,3] { + say i +} diff --git a/Task/Loops-Foreach/Sidef/loops-foreach-3.sidef b/Task/Loops-Foreach/Sidef/loops-foreach-3.sidef new file mode 100644 index 0000000000..a6c5de7f1d --- /dev/null +++ b/Task/Loops-Foreach/Sidef/loops-foreach-3.sidef @@ -0,0 +1,3 @@ +[1,2,3].each { |i| + say i +} diff --git a/Task/Loops-Foreach/Sparkling/loops-foreach.sparkling b/Task/Loops-Foreach/Sparkling/loops-foreach.sparkling new file mode 100644 index 0000000000..dc385a5924 --- /dev/null +++ b/Task/Loops-Foreach/Sparkling/loops-foreach.sparkling @@ -0,0 +1,4 @@ +let hash = { "foo": 42, "bar": 1337, "baz": "qux" }; +foreach(hash, function(key, val) { + print(key, " -> ", val); +}); diff --git a/Task/Loops-Foreach/Swift/loops-foreach-1.swift b/Task/Loops-Foreach/Swift/loops-foreach-1.swift new file mode 100644 index 0000000000..e838a9f22d --- /dev/null +++ b/Task/Loops-Foreach/Swift/loops-foreach-1.swift @@ -0,0 +1,3 @@ +for i in [1,2,3] { + print(i) +} diff --git a/Task/Loops-Foreach/Swift/loops-foreach-2.swift b/Task/Loops-Foreach/Swift/loops-foreach-2.swift new file mode 100644 index 0000000000..5bea04daf4 --- /dev/null +++ b/Task/Loops-Foreach/Swift/loops-foreach-2.swift @@ -0,0 +1,3 @@ +[1,2,3].forEach { + print($0) +} diff --git a/Task/Loops-Foreach/Wart/loops-foreach.wart b/Task/Loops-Foreach/Wart/loops-foreach.wart new file mode 100644 index 0000000000..6d226338ee --- /dev/null +++ b/Task/Loops-Foreach/Wart/loops-foreach.wart @@ -0,0 +1,2 @@ +each x '(1 2 3) + prn x diff --git a/Task/Loops-Foreach/XLISP/loops-foreach.xlisp b/Task/Loops-Foreach/XLISP/loops-foreach.xlisp new file mode 100644 index 0000000000..b8ef279e3d --- /dev/null +++ b/Task/Loops-Foreach/XLISP/loops-foreach.xlisp @@ -0,0 +1 @@ +(FOR-EACH PRINT '(CYRUS CAMBYSES DARIUS XERXES ARTAXERXES)) diff --git a/Task/Loops-Foreach/jq/loops-foreach-1.jq b/Task/Loops-Foreach/jq/loops-foreach-1.jq new file mode 100644 index 0000000000..80ffb2529e --- /dev/null +++ b/Task/Loops-Foreach/jq/loops-foreach-1.jq @@ -0,0 +1 @@ +def example: [1,2]; diff --git a/Task/Loops-Foreach/jq/loops-foreach-2.jq b/Task/Loops-Foreach/jq/loops-foreach-2.jq new file mode 100644 index 0000000000..b3ecce247e --- /dev/null +++ b/Task/Loops-Foreach/jq/loops-foreach-2.jq @@ -0,0 +1,2 @@ +example | .[] +# or equivalently: example[] diff --git a/Task/Loops-Foreach/jq/loops-foreach-3.jq b/Task/Loops-Foreach/jq/loops-foreach-3.jq new file mode 100644 index 0000000000..495495fa2d --- /dev/null +++ b/Task/Loops-Foreach/jq/loops-foreach-3.jq @@ -0,0 +1,2 @@ +{"a":1, "b":2} | .[] +# or equivalently: {"a":1, "b":2}[] diff --git a/Task/Loops-Foreach/jq/loops-foreach-4.jq b/Task/Loops-Foreach/jq/loops-foreach-4.jq new file mode 100644 index 0000000000..1986c79679 --- /dev/null +++ b/Task/Loops-Foreach/jq/loops-foreach-4.jq @@ -0,0 +1 @@ +example | . as $a | range(0; length) | $a[.] diff --git a/Task/Loops-Foreach/jq/loops-foreach-5.jq b/Task/Loops-Foreach/jq/loops-foreach-5.jq new file mode 100644 index 0000000000..270de773a2 --- /dev/null +++ b/Task/Loops-Foreach/jq/loops-foreach-5.jq @@ -0,0 +1 @@ + {"a":1, "b":2} | . as $o | keys | map( [., $o[.]] ) diff --git a/Task/Loops-Foreach/jq/loops-foreach-6.jq b/Task/Loops-Foreach/jq/loops-foreach-6.jq new file mode 100644 index 0000000000..94c0567717 --- /dev/null +++ b/Task/Loops-Foreach/jq/loops-foreach-6.jq @@ -0,0 +1,3 @@ +"abc" | . as $s | range(0;length) | $s[.:.+1] + +"abc" | explode | map( [.]|implode) | .[] diff --git a/Task/Loops-Infinite/8th/loops-infinite-1.8th b/Task/Loops-Infinite/8th/loops-infinite-1.8th new file mode 100644 index 0000000000..a0eac46ac5 --- /dev/null +++ b/Task/Loops-Infinite/8th/loops-infinite-1.8th @@ -0,0 +1 @@ +: inf "SPAM\n" . recurse ; diff --git a/Task/Loops-Infinite/8th/loops-infinite-2.8th b/Task/Loops-Infinite/8th/loops-infinite-2.8th new file mode 100644 index 0000000000..9d0d10faae --- /dev/null +++ b/Task/Loops-Infinite/8th/loops-infinite-2.8th @@ -0,0 +1 @@ +: inf repeat "SPAM\n" . again ; diff --git a/Task/Loops-Infinite/Axe/loops-infinite.axe b/Task/Loops-Infinite/Axe/loops-infinite.axe new file mode 100644 index 0000000000..9123926a0f --- /dev/null +++ b/Task/Loops-Infinite/Axe/loops-infinite.axe @@ -0,0 +1,3 @@ +While 1 + Disp "SPAM",i +End diff --git a/Task/Loops-Infinite/ChucK/loops-infinite.chuck b/Task/Loops-Infinite/ChucK/loops-infinite.chuck new file mode 100644 index 0000000000..a2d7cd139d --- /dev/null +++ b/Task/Loops-Infinite/ChucK/loops-infinite.chuck @@ -0,0 +1 @@ +while(true) <<<"SPAM">>>; diff --git a/Task/Loops-Infinite/Comal/loops-infinite.comal b/Task/Loops-Infinite/Comal/loops-infinite.comal new file mode 100644 index 0000000000..27d40282e8 --- /dev/null +++ b/Task/Loops-Infinite/Comal/loops-infinite.comal @@ -0,0 +1,3 @@ +LOOP + PRINT "SPAM" +ENDLOOP diff --git a/Task/Loops-Infinite/ERRE/loops-infinite.erre b/Task/Loops-Infinite/ERRE/loops-infinite.erre new file mode 100644 index 0000000000..69fcc448f7 --- /dev/null +++ b/Task/Loops-Infinite/ERRE/loops-infinite.erre @@ -0,0 +1,3 @@ +LOOP + PRINT("SPAM") +END LOOP diff --git a/Task/Loops-Infinite/FreeBASIC/loops-infinite.freebasic b/Task/Loops-Infinite/FreeBASIC/loops-infinite.freebasic new file mode 100644 index 0000000000..19b1f5f2c9 --- /dev/null +++ b/Task/Loops-Infinite/FreeBASIC/loops-infinite.freebasic @@ -0,0 +1,5 @@ +' FB 1.05.0 + +Do + Print "SPAM" +Loop diff --git a/Task/Loops-Infinite/FutureBasic/loops-infinite.futurebasic b/Task/Loops-Infinite/FutureBasic/loops-infinite.futurebasic new file mode 100644 index 0000000000..c5471c8c50 --- /dev/null +++ b/Task/Loops-Infinite/FutureBasic/loops-infinite.futurebasic @@ -0,0 +1,5 @@ +include "ConsoleWindow" + +while 1 +print "Spam" +wend diff --git a/Task/Loops-Infinite/Lasso/loops-infinite.lasso b/Task/Loops-Infinite/Lasso/loops-infinite.lasso new file mode 100644 index 0000000000..68a3bdba53 --- /dev/null +++ b/Task/Loops-Infinite/Lasso/loops-infinite.lasso @@ -0,0 +1,4 @@ +// not wise to run this! +while(1 > 0) => {^ + 'SPAM\r' +^} diff --git a/Task/Loops-Infinite/Lily/loops-infinite.lily b/Task/Loops-Infinite/Lily/loops-infinite.lily new file mode 100644 index 0000000000..5c545fa584 --- /dev/null +++ b/Task/Loops-Infinite/Lily/loops-infinite.lily @@ -0,0 +1 @@ +while 1: print("SPAM") diff --git a/Task/Loops-Infinite/Lingo/loops-infinite.lingo b/Task/Loops-Infinite/Lingo/loops-infinite.lingo new file mode 100644 index 0000000000..59d6ea1fd9 --- /dev/null +++ b/Task/Loops-Infinite/Lingo/loops-infinite.lingo @@ -0,0 +1,3 @@ +repeat while TRUE + put "SPAM" +end repeat diff --git a/Task/Loops-Infinite/LiveCode/loops-infinite.livecode b/Task/Loops-Infinite/LiveCode/loops-infinite.livecode new file mode 100644 index 0000000000..2fb349ca48 --- /dev/null +++ b/Task/Loops-Infinite/LiveCode/loops-infinite.livecode @@ -0,0 +1,3 @@ +repeat forever + put "SPAM" & return +end repeat diff --git a/Task/Loops-Infinite/Monte/loops-infinite.monte b/Task/Loops-Infinite/Monte/loops-infinite.monte new file mode 100644 index 0000000000..dadba41baf --- /dev/null +++ b/Task/Loops-Infinite/Monte/loops-infinite.monte @@ -0,0 +1,2 @@ +while (true): + traceln("SPAM") diff --git a/Task/Loops-Infinite/Nim/loops-infinite.nim b/Task/Loops-Infinite/Nim/loops-infinite.nim new file mode 100644 index 0000000000..e74017d58b --- /dev/null +++ b/Task/Loops-Infinite/Nim/loops-infinite.nim @@ -0,0 +1,2 @@ +while true: + echo "SPAM" diff --git a/Task/Loops-Infinite/Oforth/loops-infinite.oforth b/Task/Loops-Infinite/Oforth/loops-infinite.oforth new file mode 100644 index 0000000000..3d92aabb25 --- /dev/null +++ b/Task/Loops-Infinite/Oforth/loops-infinite.oforth @@ -0,0 +1 @@ +begin "SPAM" . again diff --git a/Task/Loops-Infinite/Phix/loops-infinite.phix b/Task/Loops-Infinite/Phix/loops-infinite.phix new file mode 100644 index 0000000000..dc9446741a --- /dev/null +++ b/Task/Loops-Infinite/Phix/loops-infinite.phix @@ -0,0 +1,3 @@ +while 1 do + puts(1,"SPAM\n") +end while diff --git a/Task/Loops-Infinite/Ring/loops-infinite.ring b/Task/Loops-Infinite/Ring/loops-infinite.ring new file mode 100644 index 0000000000..f665ddc562 --- /dev/null +++ b/Task/Loops-Infinite/Ring/loops-infinite.ring @@ -0,0 +1,3 @@ +while true + see "Spam" +end diff --git a/Task/Loops-Infinite/Sidef/loops-infinite.sidef b/Task/Loops-Infinite/Sidef/loops-infinite.sidef new file mode 100644 index 0000000000..ba843a4bf5 --- /dev/null +++ b/Task/Loops-Infinite/Sidef/loops-infinite.sidef @@ -0,0 +1 @@ +loop { say "SPAM!" }; diff --git a/Task/Loops-Infinite/Sparkling/loops-infinite-1.sparkling b/Task/Loops-Infinite/Sparkling/loops-infinite-1.sparkling new file mode 100644 index 0000000000..f6bb3d25cb --- /dev/null +++ b/Task/Loops-Infinite/Sparkling/loops-infinite-1.sparkling @@ -0,0 +1,3 @@ +while true { + print("SPAM"); +} diff --git a/Task/Loops-Infinite/Sparkling/loops-infinite-2.sparkling b/Task/Loops-Infinite/Sparkling/loops-infinite-2.sparkling new file mode 100644 index 0000000000..88d67a3d68 --- /dev/null +++ b/Task/Loops-Infinite/Sparkling/loops-infinite-2.sparkling @@ -0,0 +1,3 @@ +do { + print("SPAM"); +} while true; diff --git a/Task/Loops-Infinite/Sparkling/loops-infinite-3.sparkling b/Task/Loops-Infinite/Sparkling/loops-infinite-3.sparkling new file mode 100644 index 0000000000..5cc52fd68a --- /dev/null +++ b/Task/Loops-Infinite/Sparkling/loops-infinite-3.sparkling @@ -0,0 +1,3 @@ +for var b = true; b; b = true { + printf("SPAM\n"); +} diff --git a/Task/Loops-Infinite/Swift/loops-infinite.swift b/Task/Loops-Infinite/Swift/loops-infinite.swift new file mode 100644 index 0000000000..d8694a31eb --- /dev/null +++ b/Task/Loops-Infinite/Swift/loops-infinite.swift @@ -0,0 +1,3 @@ +while true { + println("SPAM") +} diff --git a/Task/Loops-Infinite/Ursa/loops-infinite.ursa b/Task/Loops-Infinite/Ursa/loops-infinite.ursa new file mode 100644 index 0000000000..0324b69a56 --- /dev/null +++ b/Task/Loops-Infinite/Ursa/loops-infinite.ursa @@ -0,0 +1,3 @@ +while true + out "SPAM" endl console +end while diff --git a/Task/Loops-Infinite/Wart/loops-infinite.wart b/Task/Loops-Infinite/Wart/loops-infinite.wart new file mode 100644 index 0000000000..74fbf0937f --- /dev/null +++ b/Task/Loops-Infinite/Wart/loops-infinite.wart @@ -0,0 +1,2 @@ +repeat :forever + prn "spam" diff --git a/Task/Loops-Infinite/jq/loops-infinite.jq b/Task/Loops-Infinite/jq/loops-infinite.jq new file mode 100644 index 0000000000..847be26345 --- /dev/null +++ b/Task/Loops-Infinite/jq/loops-infinite.jq @@ -0,0 +1 @@ +recurse("SPAM") diff --git a/Task/Loops-N-plus-one-half/Axe/loops-n-plus-one-half.axe b/Task/Loops-N-plus-one-half/Axe/loops-n-plus-one-half.axe new file mode 100644 index 0000000000..e4b5f3f4d1 --- /dev/null +++ b/Task/Loops-N-plus-one-half/Axe/loops-n-plus-one-half.axe @@ -0,0 +1,8 @@ +For(I,1,10) + Disp I▶Dec + If I=10 + Disp i + Else + Disp "," + End +End diff --git a/Task/Loops-N-plus-one-half/ERRE/loops-n-plus-one-half.erre b/Task/Loops-N-plus-one-half/ERRE/loops-n-plus-one-half.erre new file mode 100644 index 0000000000..2d5e996fb0 --- /dev/null +++ b/Task/Loops-N-plus-one-half/ERRE/loops-n-plus-one-half.erre @@ -0,0 +1,5 @@ +FOR I=1 TO 10 DO + PRINT(I;) + EXIT IF I=10 + PRINT(", ";) +END FOR diff --git a/Task/Loops-N-plus-one-half/EchoLisp/loops-n-plus-one-half.echolisp b/Task/Loops-N-plus-one-half/EchoLisp/loops-n-plus-one-half.echolisp new file mode 100644 index 0000000000..b0563bda35 --- /dev/null +++ b/Task/Loops-N-plus-one-half/EchoLisp/loops-n-plus-one-half.echolisp @@ -0,0 +1,9 @@ +(string-delimiter "") + +(for ((i (in-range 1 11))) (write i) #:break (= i 10) (write ",")) + → 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 + +;; or + +(string-join (range 1 11) ",") + → 1,2,3,4,5,6,7,8,9,10 diff --git a/Task/Loops-N-plus-one-half/FreeBASIC/loops-n-plus-one-half.freebasic b/Task/Loops-N-plus-one-half/FreeBASIC/loops-n-plus-one-half.freebasic new file mode 100644 index 0000000000..e5a258f523 --- /dev/null +++ b/Task/Loops-N-plus-one-half/FreeBASIC/loops-n-plus-one-half.freebasic @@ -0,0 +1,9 @@ +' FB 1.05.0 Win64 + +For i As Integer = 1 To 10 + Print Str(i); + If i < 10 Then Print ", "; +Next + +Print +Sleep diff --git a/Task/Loops-N-plus-one-half/FutureBasic/loops-n-plus-one-half.futurebasic b/Task/Loops-N-plus-one-half/FutureBasic/loops-n-plus-one-half.futurebasic new file mode 100644 index 0000000000..64c5ce185a --- /dev/null +++ b/Task/Loops-N-plus-one-half/FutureBasic/loops-n-plus-one-half.futurebasic @@ -0,0 +1,9 @@ +include "ConsoleWindow" + +dim as long i, num : num = 10 + +for i = 1 to num +print i; +if i = num then exit for +print ","; +next i diff --git a/Task/Loops-N-plus-one-half/Lasso/loops-n-plus-one-half.lasso b/Task/Loops-N-plus-one-half/Lasso/loops-n-plus-one-half.lasso new file mode 100644 index 0000000000..bcb315cd13 --- /dev/null +++ b/Task/Loops-N-plus-one-half/Lasso/loops-n-plus-one-half.lasso @@ -0,0 +1,7 @@ +local(out) = '' +loop(10) => { + #out->append(loop_count) + loop_count == 10 ? loop_abort + #out->append(', ') +} +#out diff --git a/Task/Loops-N-plus-one-half/LiveCode/loops-n-plus-one-half.livecode b/Task/Loops-N-plus-one-half/LiveCode/loops-n-plus-one-half.livecode new file mode 100644 index 0000000000..adcdf5ee51 --- /dev/null +++ b/Task/Loops-N-plus-one-half/LiveCode/loops-n-plus-one-half.livecode @@ -0,0 +1,5 @@ +repeat with n = 1 to 10 + put n after loopn + if n is not 10 then put comma after loopn +end repeat +put loopn diff --git a/Task/Loops-N-plus-one-half/Nim/loops-n-plus-one-half.nim b/Task/Loops-N-plus-one-half/Nim/loops-n-plus-one-half.nim new file mode 100644 index 0000000000..7f16e37a13 --- /dev/null +++ b/Task/Loops-N-plus-one-half/Nim/loops-n-plus-one-half.nim @@ -0,0 +1,7 @@ +var s = "" + +for i in 1..10: + if s.len > 0: s.add(", ") + s.add($i) + +echo s diff --git a/Task/Loops-N-plus-one-half/Oforth/loops-n-plus-one-half.oforth b/Task/Loops-N-plus-one-half/Oforth/loops-n-plus-one-half.oforth new file mode 100644 index 0000000000..4d53b4a302 --- /dev/null +++ b/Task/Loops-N-plus-one-half/Oforth/loops-n-plus-one-half.oforth @@ -0,0 +1,3 @@ +: loopn +| i | + 10 loop: i [ i dup print 10 ifEq: [ break ] "," . ] printcr ; diff --git a/Task/Loops-N-plus-one-half/Panda/loops-n-plus-one-half.panda b/Task/Loops-N-plus-one-half/Panda/loops-n-plus-one-half.panda new file mode 100644 index 0000000000..32d16e030c --- /dev/null +++ b/Task/Loops-N-plus-one-half/Panda/loops-n-plus-one-half.panda @@ -0,0 +1 @@ +array{{1..10}}.join(',') diff --git a/Task/Loops-N-plus-one-half/Peloton/loops-n-plus-one-half.peloton b/Task/Loops-N-plus-one-half/Peloton/loops-n-plus-one-half.peloton new file mode 100644 index 0000000000..d088fa8ebd --- /dev/null +++ b/Task/Loops-N-plus-one-half/Peloton/loops-n-plus-one-half.peloton @@ -0,0 +1 @@ +<@ FORLITLIT>10|<@ SAYPOSFOR>...<@ ABF>, diff --git a/Task/Loops-N-plus-one-half/Phix/loops-n-plus-one-half.phix b/Task/Loops-N-plus-one-half/Phix/loops-n-plus-one-half.phix new file mode 100644 index 0000000000..15735559be --- /dev/null +++ b/Task/Loops-N-plus-one-half/Phix/loops-n-plus-one-half.phix @@ -0,0 +1,5 @@ +for i=1 to 10 do + printf(1,"%d",i) + if i=10 then exit end if + printf(1,", ") +end for diff --git a/Task/Loops-N-plus-one-half/Ring/loops-n-plus-one-half.ring b/Task/Loops-N-plus-one-half/Ring/loops-n-plus-one-half.ring new file mode 100644 index 0000000000..64a4f0483b --- /dev/null +++ b/Task/Loops-N-plus-one-half/Ring/loops-n-plus-one-half.ring @@ -0,0 +1 @@ +for x = 1 to 10 see x if x=10 exit ok see ", " next see nl diff --git a/Task/Loops-N-plus-one-half/Sidef/loops-n-plus-one-half.sidef b/Task/Loops-N-plus-one-half/Sidef/loops-n-plus-one-half.sidef new file mode 100644 index 0000000000..2e084f14dc --- /dev/null +++ b/Task/Loops-N-plus-one-half/Sidef/loops-n-plus-one-half.sidef @@ -0,0 +1,7 @@ +for (1..10) { |i| + print i; + i == 10 && break; + print ', '; +} + +print "\n"; diff --git a/Task/Loops-N-plus-one-half/Swift/loops-n-plus-one-half-1.swift b/Task/Loops-N-plus-one-half/Swift/loops-n-plus-one-half-1.swift new file mode 100644 index 0000000000..43916e8ad7 --- /dev/null +++ b/Task/Loops-N-plus-one-half/Swift/loops-n-plus-one-half-1.swift @@ -0,0 +1,8 @@ +for var i = 1; ; i++ { + print(i) + if i == 10 { + println() + break + } + print(", ") +} diff --git a/Task/Loops-N-plus-one-half/Swift/loops-n-plus-one-half-2.swift b/Task/Loops-N-plus-one-half/Swift/loops-n-plus-one-half-2.swift new file mode 100644 index 0000000000..f1361e8ad0 --- /dev/null +++ b/Task/Loops-N-plus-one-half/Swift/loops-n-plus-one-half-2.swift @@ -0,0 +1,4 @@ +for i in 1...10 { + + print(i, terminator: i == 10 ? "\n" : ", ") +} diff --git a/Task/Loops-N-plus-one-half/Swift/loops-n-plus-one-half-3.swift b/Task/Loops-N-plus-one-half/Swift/loops-n-plus-one-half-3.swift new file mode 100644 index 0000000000..071b7f02bf --- /dev/null +++ b/Task/Loops-N-plus-one-half/Swift/loops-n-plus-one-half-3.swift @@ -0,0 +1,8 @@ +for var i = 1; ; i++ { + print(i, terminator: "") + if i == 10 { + print("") + break + } + print(", ", terminator: "") +} diff --git a/Task/Loops-N-plus-one-half/Ursa/loops-n-plus-one-half.ursa b/Task/Loops-N-plus-one-half/Ursa/loops-n-plus-one-half.ursa new file mode 100644 index 0000000000..393374d37f --- /dev/null +++ b/Task/Loops-N-plus-one-half/Ursa/loops-n-plus-one-half.ursa @@ -0,0 +1,9 @@ +decl int i +for (set i 1) (< i 11) (inc i) + out i console + if (= i 10) + break + end if + out ", " console +end for +out endl console diff --git a/Task/Loops-N-plus-one-half/Wart/loops-n-plus-one-half.wart b/Task/Loops-N-plus-one-half/Wart/loops-n-plus-one-half.wart new file mode 100644 index 0000000000..93a42f01fa --- /dev/null +++ b/Task/Loops-N-plus-one-half/Wart/loops-n-plus-one-half.wart @@ -0,0 +1,5 @@ +for i 1 (i <= 10) ++i + pr i + if (i < 10) + pr ", " +(prn) diff --git a/Task/Loops-N-plus-one-half/jq/loops-n-plus-one-half.jq b/Task/Loops-N-plus-one-half/jq/loops-n-plus-one-half.jq new file mode 100644 index 0000000000..9d70492afd --- /dev/null +++ b/Task/Loops-N-plus-one-half/jq/loops-n-plus-one-half.jq @@ -0,0 +1,9 @@ +One approach is to construct the answer incrementally: +def loop_plus_half(m;n): + if mforeach => { + #1->foreach => { + stdoutnl(#1) + #1 == 20 ? return + } +} diff --git a/Task/Loops-Nested/Lingo/loops-nested.lingo b/Task/Loops-Nested/Lingo/loops-nested.lingo new file mode 100644 index 0000000000..e8a249fb2e --- /dev/null +++ b/Task/Loops-Nested/Lingo/loops-nested.lingo @@ -0,0 +1,18 @@ +-- create two-dimensional array with random numbers +a = [] +repeat with i = 1 to 20 + a[i] = [] + repeat with j = 1 to 20 + a[i][j] = random(20) + end repeat +end repeat + +-- iterate over rows and columns, print value, exit both loops if it's 20 +repeat with i = 1 to 20 + repeat with j = 1 to 20 + v = a[i][j] + put v + if v=20 then exit repeat + end repeat + if v=20 then exit repeat +end repeat diff --git a/Task/Loops-Nested/LiveCode/loops-nested.livecode b/Task/Loops-Nested/LiveCode/loops-nested.livecode new file mode 100644 index 0000000000..6f7d664d35 --- /dev/null +++ b/Task/Loops-Nested/LiveCode/loops-nested.livecode @@ -0,0 +1,21 @@ +repeat with i = 1 to 10 + repeat with j = 1 to 10 + put random(20) into aNums[i,j] + end repeat +end repeat + +repeat with i = 1 to 10 + repeat with j = 1 to 10 + if aNums[i,j] = 20 then + put true into exitLoop + exit repeat + end if + end repeat + if exitLoop then exit repeat +end repeat + +if exitLoop then + put "20 found in" && i & comma & j +else + put "20 not found" +end if diff --git a/Task/Loops-Nested/Nim/loops-nested.nim b/Task/Loops-Nested/Nim/loops-nested.nim new file mode 100644 index 0000000000..494af921e2 --- /dev/null +++ b/Task/Loops-Nested/Nim/loops-nested.nim @@ -0,0 +1,24 @@ +import math, strutils + +const arrSize = 10 + +var a: array[0..arrSize-1, array[0..arrSize-1, int]] +var s: string = "" + +randomize() # different results each time this runs + +for i in 0 .. arrSize-1: + for j in countup(0,arrSize-1): + a[i][j] = random(20)+1 + +block outer: + for i in countup(0,arrSize-1): + for j in 0 .. arrSize-1: + if a[i][j] < 10: + s.add(" ") + addf(s,"$#",$a[i][j]) + if a[i][j] == 20: + break outer + s.add(", ") + s.add("\n") +echo(s) diff --git a/Task/Loops-Nested/Phix/loops-nested-1.phix b/Task/Loops-Nested/Phix/loops-nested-1.phix new file mode 100644 index 0000000000..bfbfacebef --- /dev/null +++ b/Task/Loops-Nested/Phix/loops-nested-1.phix @@ -0,0 +1,14 @@ +constant s = sq_rand(repeat(repeat(20,20),20)) +integer found = 0 +for i=1 to 20 do + for j=1 to 20 do + printf(1,"%d",s[i][j]) + if s[i][j]=20 then + found = 1 + exit + end if + printf(1,", ") + end for + printf(1,"\n") + if found then exit end if +end for diff --git a/Task/Loops-Nested/Phix/loops-nested-2.phix b/Task/Loops-Nested/Phix/loops-nested-2.phix new file mode 100644 index 0000000000..0d4268f141 --- /dev/null +++ b/Task/Loops-Nested/Phix/loops-nested-2.phix @@ -0,0 +1,12 @@ +procedure till20() + for i=1 to 20 do + for j=1 to 20 do + printf(1,"%d",s[i][j]) + if s[i][j]=20 then return end if + printf(1,", ") + end for + printf(1,"\n") + end for +end procedure +till20() +printf(1,"\n") diff --git a/Task/Loops-Nested/Phix/loops-nested-3.phix b/Task/Loops-Nested/Phix/loops-nested-3.phix new file mode 100644 index 0000000000..add7a61fac --- /dev/null +++ b/Task/Loops-Nested/Phix/loops-nested-3.phix @@ -0,0 +1,10 @@ +for i=1 to 20 do + for j=1 to 20 do + printf(1,"%d",s[i][j]) + if s[i][j]=20 then #ilASM{jmp :%done} end if + printf(1,", ") + end for + printf(1,"\n") +end for +#ilASM{:%done} +printf(1,"\n") diff --git a/Task/Loops-Nested/Ring/loops-nested.ring b/Task/Loops-Nested/Ring/loops-nested.ring new file mode 100644 index 0000000000..903af521c6 --- /dev/null +++ b/Task/Loops-Nested/Ring/loops-nested.ring @@ -0,0 +1,23 @@ +size = 5 +array = newlist(size,size) +for row = 1 to size + for col = 1 to size + array[row][col] = random(19) + 1 + next +next + +for row = 1 to size + for col = 1 to size + see "row " + row + " col " + col + "value : " + array[row][col] + nl + if array[row][col] = 20 exit for row ok + next +next + +func newlist x, y + if isstring(x) x=0+x ok + if isstring(y) y=0+y ok + aList = list(x) + for t in aList + t = list(y) + next + return aList diff --git a/Task/Loops-Nested/Sidef/loops-nested.sidef b/Task/Loops-Nested/Sidef/loops-nested.sidef new file mode 100644 index 0000000000..ac33f745f9 --- /dev/null +++ b/Task/Loops-Nested/Sidef/loops-nested.sidef @@ -0,0 +1,11 @@ +var arr = 10.of{ 10.of{ 20.irand + 1 } } + +for row in arr { + for num in row { + "%3d".printf(num); + num == 20 && goto :OUT + } + print "\n" +} @:OUT + +print "\n" diff --git a/Task/Loops-Nested/Swift/loops-nested.swift b/Task/Loops-Nested/Swift/loops-nested.swift new file mode 100644 index 0000000000..407ceb2719 --- /dev/null +++ b/Task/Loops-Nested/Swift/loops-nested.swift @@ -0,0 +1,9 @@ +let array = [[2, 12, 10, 4], [18, 11, 20, 2]] + +loop: for row in array { + for element in row { + println(" \(element)") + if element == 20 { break loop } + } +} +print("done") diff --git a/Task/Loops-While/Axe/loops-while.axe b/Task/Loops-While/Axe/loops-while.axe new file mode 100644 index 0000000000..876cc39ea9 --- /dev/null +++ b/Task/Loops-While/Axe/loops-while.axe @@ -0,0 +1,5 @@ +1024→A +While A>0 + Disp A▶Dec,i + A/2→A +End diff --git a/Task/Loops-While/ChucK/loops-while.chuck b/Task/Loops-While/ChucK/loops-while.chuck new file mode 100644 index 0000000000..609241da38 --- /dev/null +++ b/Task/Loops-While/ChucK/loops-while.chuck @@ -0,0 +1,7 @@ +1024 => int value; + +while(value > 0) +{ + <<>>; + value / 2 => value; +} diff --git a/Task/Loops-While/ERRE/loops-while.erre b/Task/Loops-While/ERRE/loops-while.erre new file mode 100644 index 0000000000..617c417820 --- /dev/null +++ b/Task/Loops-While/ERRE/loops-while.erre @@ -0,0 +1,5 @@ + I%=1024 + WHILE I%>0 DO ! you can leave out >0 + PRINT(I%) + I%=I% DIV 2 ! I%=INT(I%/2) for C-64 version + END WHILE diff --git a/Task/Loops-While/EchoLisp/loops-while.echolisp b/Task/Loops-While/EchoLisp/loops-while.echolisp new file mode 100644 index 0000000000..e54d0e8f7c --- /dev/null +++ b/Task/Loops-While/EchoLisp/loops-while.echolisp @@ -0,0 +1,3 @@ +(set! n 1024) +(while (> n 0) (write n) (set! n (quotient n 2))) +1024 512 256 128 64 32 16 8 4 2 1 diff --git a/Task/Loops-While/FreeBASIC/loops-while.freebasic b/Task/Loops-While/FreeBASIC/loops-while.freebasic new file mode 100644 index 0000000000..26d9381f4b --- /dev/null +++ b/Task/Loops-While/FreeBASIC/loops-while.freebasic @@ -0,0 +1,10 @@ +' FB 1.05.0 Win64 + +Dim i As Integer = 1024 + +While i > 0 + Print i + i Shr= 1 +Wend + +Sleep diff --git a/Task/Loops-While/FutureBasic/loops-while.futurebasic b/Task/Loops-While/FutureBasic/loops-while.futurebasic new file mode 100644 index 0000000000..21f87dd95c --- /dev/null +++ b/Task/Loops-While/FutureBasic/loops-while.futurebasic @@ -0,0 +1,8 @@ +include "ConsoleWindow" + +dim as long i : i = 1024 + +while i > 0 +print i +i = int( i / 2 ) +wend diff --git a/Task/Loops-While/Lasso/loops-while.lasso b/Task/Loops-While/Lasso/loops-while.lasso new file mode 100644 index 0000000000..9d51e026f5 --- /dev/null +++ b/Task/Loops-While/Lasso/loops-while.lasso @@ -0,0 +1,5 @@ +local(i = 1024) +while(#i > 0) => {^ + #i + '\r' + #i /= 2 +^} diff --git a/Task/Loops-While/Lingo/loops-while.lingo b/Task/Loops-While/Lingo/loops-while.lingo new file mode 100644 index 0000000000..9f350f37e2 --- /dev/null +++ b/Task/Loops-While/Lingo/loops-while.lingo @@ -0,0 +1,5 @@ +n = 1024 +repeat while n>0 + put n + n = n/2 -- integer division implicitely returns floor: 1/2 -> 0 +end repeat diff --git a/Task/Loops-While/LiveCode/loops-while.livecode b/Task/Loops-While/LiveCode/loops-while.livecode new file mode 100644 index 0000000000..c970f5d3f7 --- /dev/null +++ b/Task/Loops-While/LiveCode/loops-while.livecode @@ -0,0 +1,5 @@ +put 1024 into n +repeat while n > 0 + put n & cr + divide n by 2 +end repeat diff --git a/Task/Loops-While/Monte/loops-while.monte b/Task/Loops-While/Monte/loops-while.monte new file mode 100644 index 0000000000..c397771c93 --- /dev/null +++ b/Task/Loops-While/Monte/loops-while.monte @@ -0,0 +1,4 @@ +var i := 1024 +while (i > 0): + traceln(i) + i //= 2 diff --git a/Task/Loops-While/Morfa/loops-while.morfa b/Task/Loops-While/Morfa/loops-while.morfa new file mode 100644 index 0000000000..65e82a08a5 --- /dev/null +++ b/Task/Loops-While/Morfa/loops-while.morfa @@ -0,0 +1,8 @@ +import morfa.io.print; + +var i = 1024; +while(i > 0) +{ + println(i); + i /= 2; +} diff --git a/Task/Loops-While/Nim/loops-while.nim b/Task/Loops-While/Nim/loops-while.nim new file mode 100644 index 0000000000..05ad450a8b --- /dev/null +++ b/Task/Loops-While/Nim/loops-while.nim @@ -0,0 +1,4 @@ +var n: int = 1024 +while n > 0: + echo(n) + n = n div 2 diff --git a/Task/Loops-While/Oforth/loops-while.oforth b/Task/Loops-While/Oforth/loops-while.oforth new file mode 100644 index 0000000000..4a76e9a5af --- /dev/null +++ b/Task/Loops-While/Oforth/loops-while.oforth @@ -0,0 +1 @@ +1024 while ( dup ) [ dup println 2 / ] diff --git a/Task/Loops-While/PHL/loops-while.phl b/Task/Loops-While/PHL/loops-while.phl new file mode 100644 index 0000000000..92e8d8d7e9 --- /dev/null +++ b/Task/Loops-While/PHL/loops-while.phl @@ -0,0 +1,5 @@ +var i = 1024; +while (i > 0) { + printf("%i\n", i); + i = i/2; +} diff --git a/Task/Loops-While/Panda/loops-while.panda b/Task/Loops-While/Panda/loops-while.panda new file mode 100644 index 0000000000..258afbe5c9 --- /dev/null +++ b/Task/Loops-While/Panda/loops-while.panda @@ -0,0 +1,2 @@ +fun half(a) type integer->integer a.divide(2) +1024.trans(func:half).gt(0) nl diff --git a/Task/Loops-While/PeopleCode/loops-while.peoplecode b/Task/Loops-While/PeopleCode/loops-while.peoplecode new file mode 100644 index 0000000000..2fe46df6b9 --- /dev/null +++ b/Task/Loops-While/PeopleCode/loops-while.peoplecode @@ -0,0 +1,9 @@ +Local string &CRLF; +Local number &LoopNumber; +&LoopNumber = 1024; +&CRLF = Char(10) | Char(13); + +While &LoopNumber > 0; + WinMessage(&LoopNumber | &CRLF); + &LoopNumber = &LoopNumber / 2; +End-While; diff --git a/Task/Loops-While/Phix/loops-while.phix b/Task/Loops-While/Phix/loops-while.phix new file mode 100644 index 0000000000..5abf8d8fc3 --- /dev/null +++ b/Task/Loops-While/Phix/loops-while.phix @@ -0,0 +1,5 @@ +integer i = 1024 +while i!=0 do + ?i + i = floor(i/2) -- (see note) +end while diff --git a/Task/Loops-While/Ring/loops-while.ring b/Task/Loops-While/Ring/loops-while.ring new file mode 100644 index 0000000000..9e85d70c70 --- /dev/null +++ b/Task/Loops-While/Ring/loops-while.ring @@ -0,0 +1,5 @@ +i = 1024 +while i > 0 + see i + nl + i = floor(i / 2) +end diff --git a/Task/Loops-While/Sidef/loops-while.sidef b/Task/Loops-While/Sidef/loops-while.sidef new file mode 100644 index 0000000000..eec3e01c66 --- /dev/null +++ b/Task/Loops-While/Sidef/loops-while.sidef @@ -0,0 +1,5 @@ +var i = 1024 +while (i > 0) { + say i + i //= 2 +} diff --git a/Task/Loops-While/Sparkling/loops-while.sparkling b/Task/Loops-While/Sparkling/loops-while.sparkling new file mode 100644 index 0000000000..2d222e8ab7 --- /dev/null +++ b/Task/Loops-While/Sparkling/loops-while.sparkling @@ -0,0 +1,5 @@ +var i = 1024; +while i > 0 { + print(i); + i /= 2; +} diff --git a/Task/Loops-While/Swift/loops-while.swift b/Task/Loops-While/Swift/loops-while.swift new file mode 100644 index 0000000000..74ee462d28 --- /dev/null +++ b/Task/Loops-While/Swift/loops-while.swift @@ -0,0 +1,5 @@ +var i = 1024 +while i > 0 { + println(i) + i /= 2 +} diff --git a/Task/Loops-While/Uniface/loops-while.uniface b/Task/Loops-While/Uniface/loops-while.uniface new file mode 100644 index 0000000000..db43e62ca2 --- /dev/null +++ b/Task/Loops-While/Uniface/loops-while.uniface @@ -0,0 +1,9 @@ +variables + numeric I +endvariables + +I = 1024 +while (I > 0) + putmess I + I = (I/2)[trunc] +endwhile diff --git a/Task/Loops-While/Ursa/loops-while.ursa b/Task/Loops-While/Ursa/loops-while.ursa new file mode 100644 index 0000000000..bb2032b161 --- /dev/null +++ b/Task/Loops-While/Ursa/loops-while.ursa @@ -0,0 +1,7 @@ +decl int n +set n 1024 + +while (> n 0) + out n endl console + set n (int (/ n 2)) +end while diff --git a/Task/Loops-While/Wart/loops-while.wart b/Task/Loops-While/Wart/loops-while.wart new file mode 100644 index 0000000000..891d4ef3f2 --- /dev/null +++ b/Task/Loops-While/Wart/loops-while.wart @@ -0,0 +1,4 @@ +i <- 1024 +while (i > 0) + prn i + i <- (int i/2) diff --git a/Task/Loops-While/XLISP/loops-while.xlisp b/Task/Loops-While/XLISP/loops-while.xlisp new file mode 100644 index 0000000000..4972e1552d --- /dev/null +++ b/Task/Loops-While/XLISP/loops-while.xlisp @@ -0,0 +1,5 @@ +(DEFINE I 1024) + +(WHILE (>= I 1) + (PRINT I) + (DEFINE I (/ I 2))) diff --git a/Task/Loops-While/jq/loops-while-1.jq b/Task/Loops-While/jq/loops-while-1.jq new file mode 100644 index 0000000000..84b4a9753d --- /dev/null +++ b/Task/Loops-While/jq/loops-while-1.jq @@ -0,0 +1,2 @@ +# To avoid printing 0, test if the input is greater than 1 +1024 | recurse( if . > 1 then ./2 | floor else empty end) diff --git a/Task/Loops-While/jq/loops-while-2.jq b/Task/Loops-While/jq/loops-while-2.jq new file mode 100644 index 0000000000..a7af33b261 --- /dev/null +++ b/Task/Loops-While/jq/loops-while-2.jq @@ -0,0 +1 @@ +1024 | recurse( ./2 | floor; . > 0) diff --git a/Task/Loops-While/jq/loops-while-3.jq b/Task/Loops-While/jq/loops-while-3.jq new file mode 100644 index 0000000000..a31bbd36e8 --- /dev/null +++ b/Task/Loops-While/jq/loops-while-3.jq @@ -0,0 +1,2 @@ +def task: if . > 0 then ., (./2 | floor | task) else empty end; +1024|task diff --git a/Task/Loops-While/jq/loops-while-4.jq b/Task/Loops-While/jq/loops-while-4.jq new file mode 100644 index 0000000000..b3944c60e1 --- /dev/null +++ b/Task/Loops-While/jq/loops-while-4.jq @@ -0,0 +1,3 @@ +def while(cond; update): + def _while: if cond then ., (update | _while) else empty end; + _while; diff --git a/Task/Loops-While/jq/loops-while-5.jq b/Task/Loops-While/jq/loops-while-5.jq new file mode 100644 index 0000000000..3821086ccd --- /dev/null +++ b/Task/Loops-While/jq/loops-while-5.jq @@ -0,0 +1 @@ +1024|while(. > 0; ./2|floor) diff --git a/Task/Lucas-Lehmer-test/ERRE/lucas-lehmer-test.erre b/Task/Lucas-Lehmer-test/ERRE/lucas-lehmer-test.erre new file mode 100644 index 0000000000..b4ba0e551f --- /dev/null +++ b/Task/Lucas-Lehmer-test/ERRE/lucas-lehmer-test.erre @@ -0,0 +1,24 @@ +PROGRAM LL_TEST + +!$DOUBLE + +PROCEDURE LUCAS_LEHMER(P%->RES) + LOCAL I%,MP,SN + IF P%=2 THEN RES%=TRUE EXIT PROCEDURE END IF + IF (P% AND 1)=0 THEN RES%=FALSE EXIT PROCEDURE END IF + MP=2^P%-1 + SN=4 + FOR I%=3 TO P% DO + SN=SN^2-2 + SN-=(MP*INT(SN/MP)) + END FOR + RES%=(SN=0) +END PROCEDURE + +BEGIN + PRINT("Mersenne Primes:") + FOR P%=2 TO 23 DO + LUCAS_LEHMER(P%->RES%) + IF RES% THEN PRINT("M";P%) END IF + END FOR +END PROGRAM diff --git a/Task/Lucas-Lehmer-test/EchoLisp/lucas-lehmer-test.echolisp b/Task/Lucas-Lehmer-test/EchoLisp/lucas-lehmer-test.echolisp new file mode 100644 index 0000000000..9cf10616c0 --- /dev/null +++ b/Task/Lucas-Lehmer-test/EchoLisp/lucas-lehmer-test.echolisp @@ -0,0 +1,19 @@ +(require 'bigint) +(define (mersenne-prime? odd-prime: p) + (define mp (1- (expt 2 p))) + (define s #4) + (for [(i (in-range 3 (1+ p)))] + (set! s (% (- (* s s) 2) mp))) + (when (zero? s) (printf "M%d" p))) + +;; run it in the background +(require 'tasks) +(define LP (primes 10000)) ; list of candidate primes + +(define (mp-task LP) + (mersenne-prime? (first LP)) + (rest LP)) ;; return next state + +(task-run (make-task mp-task LP)) + +→ M3 M5 M7 M13 M17 M19 M31 M61 M89 M107 M127 M521 M607 M1279 M2203 M2281 diff --git a/Task/Lucas-Lehmer-test/FreeBASIC/lucas-lehmer-test-1.freebasic b/Task/Lucas-Lehmer-test/FreeBASIC/lucas-lehmer-test-1.freebasic new file mode 100644 index 0000000000..3066fb65fb --- /dev/null +++ b/Task/Lucas-Lehmer-test/FreeBASIC/lucas-lehmer-test-1.freebasic @@ -0,0 +1,53 @@ +' version 18-09-2015 +' compile with: fbc -s console + +#Ifndef TRUE ' define true and false for older freebasic versions + #Define FALSE 0 + #Define TRUE Not FALSE +#EndIf + +Function mul_mod(a As ULongInt, b As ULongInt, modulus As ULongInt) As ULongInt + ' returns a * b mod modulus + + Dim As ULongInt x , y = a ' a mod modulus, but a is already smaller then modulus + + While b > 0 + If (b And 1) = 1 Then + x = (x + y) Mod modulus + End If + y = (y Shl 1) Mod modulus + b = b Shr 1 + Wend + Return x + +End Function + +Function LLT(p As UInteger) As Integer + + Dim As ULongInt s = 4, m = 1 + m = m Shl p : m = m - 1 ' m = 2 ^ p - 1 + + For i As Integer = 2 To p - 1 + s = mul_mod(s, s, m) - 2 + Next + + If s = 0 Then Return TRUE Else Return FALSE + +End Function + +' ------=< MAIN >=------ + +Dim As UInteger p + +Print +' M2 can not be tested, we start with 3 +for p = 3 To 63 + If LLT(p) = TRUE Then Print " M";Str(p); +Next + +Print +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Lucas-Lehmer-test/FreeBASIC/lucas-lehmer-test-2.freebasic b/Task/Lucas-Lehmer-test/FreeBASIC/lucas-lehmer-test-2.freebasic new file mode 100644 index 0000000000..fbb933efe4 --- /dev/null +++ b/Task/Lucas-Lehmer-test/FreeBASIC/lucas-lehmer-test-2.freebasic @@ -0,0 +1,82 @@ +' version 18-09-2015 +' compile with: fbc -s console + +#Include Once "gmp.bi" + +#Macro init_big_int (a) + Dim As Mpz_ptr a = Allocate( Len(__mpz_struct)) + Mpz_init(a) +#EndMacro + +' ------=< MAIN >=------ + +Const As UInteger max = 12000 ' 230 sec., 10000 about 125 sec. + +Dim As UInteger p, x +Dim As Byte sieve(max) + +Dim As String buffer = Space(Len(Str(max))+1) + +init_big_int(m) +init_big_int(s) +init_big_int(r) + +' sieve to find the primes +' remove even numbers except 2 +For p = 4 To Sqr(max) Step 2 + sieve(p) = 1 +Next + +For p = 3 To Sqr(max) Step 2 + For x = p * p To max Step p * 2 + sieve(x) = 1 + Next +Next + +' exception: the test will not work for p = 2 + +For p = 3 To max Step 2 ' odd numbers only + + If sieve(p) = 1 Then Continue For + + Mpz_set_ui(s, 4) ' s(0) = 4 + Mpz_set_ui(m, 1) ' set m to 1 + Mpz_mul_2exp(m, m, p) ' m = m shl p = 2 ^ p + Mpz_sub_ui(m, m, 1) ' m = m - 1 = 2 ^ p - 1 + + For x = 2 To p - 1 + Mpz_mul(s, s, s) ' s = s * s + Mpz_sub_ui(s, s, 2) ' s = s - 2 + ' Mpz_fdiv_r(s, s, m) ' s = s mod m + If Mpz_sgn(s) < 0 Then + Mpz_add(s, s ,m) + Else + Mpz_tdiv_r_2exp(r, s, p) + Mpz_tdiv_q_2exp(s, s, p) + Mpz_add(s, s, r) + End If + If (Mpz_cmp(s, m) >= 0) Then Mpz_sub(s, s, m) + Next + + 'If Mpz_cmp_ui(s, 0) = 0 Then + ' LSet buffer = Str(p) + ' Print "M"; buffer; " is prime" + 'End If + If Mpz_cmp_ui(s, 0) = 0 Then + Print "M";Str(p), + End If +Next +Print + +Mpz_clear (m) ' cleanup +DeAllocate(m) +Mpz_clear (s) +DeAllocate(s) +Mpz_clear (r) +DeAllocate(r) + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Lucas-Lehmer-test/FunL/lucas-lehmer-test.funl b/Task/Lucas-Lehmer-test/FunL/lucas-lehmer-test.funl new file mode 100644 index 0000000000..8c6d451794 --- /dev/null +++ b/Task/Lucas-Lehmer-test/FunL/lucas-lehmer-test.funl @@ -0,0 +1,15 @@ +def mersenne( p ) = + if p == 2 then return true + + var s = 4 + var M = 2^p - 1 + + repeat p - 2 + s = (s*s - 2) mod M + + s == 0 + +import integers.primes + +for p <- primes().filter( mersenne ).take( 20 ) + println( 'M' + p ) diff --git a/Task/Lucas-Lehmer-test/Nim/lucas-lehmer-test.nim b/Task/Lucas-Lehmer-test/Nim/lucas-lehmer-test.nim new file mode 100644 index 0000000000..a4f205a8e9 --- /dev/null +++ b/Task/Lucas-Lehmer-test/Nim/lucas-lehmer-test.nim @@ -0,0 +1,24 @@ +import math + +proc isPrime(a: int): bool = + if a == 2: return true + if a < 2 or a mod 2 == 0: return false + for i in countup(3, int sqrt(float a), 2): + if a mod i == 0: + return false + return true + +proc isMersennePrime(p: int): bool = + if p == 2: return true + let mp = (1'i64 shl p) - 1 + var s = 4'i64 + for i in 3 .. p: + s = (s * s - 2) mod mp + result = s == 0 + +let upb = int((log2 float int64.high) / 2) +echo " Mersenne primes:" +for p in 2 .. upb: + if isPrime(p) and isMersennePrime(p): + stdout.write " M",p +echo "" diff --git a/Task/Lucas-Lehmer-test/RPL/lucas-lehmer-test.rpl b/Task/Lucas-Lehmer-test/RPL/lucas-lehmer-test.rpl new file mode 100644 index 0000000000..ab28ff99cd --- /dev/null +++ b/Task/Lucas-Lehmer-test/RPL/lucas-lehmer-test.rpl @@ -0,0 +1,7 @@ +%%HP: T(3)A(R)F(.); ; ASCII transfer header +\<< DUP LN DUP \pi * 4 SWAP / 1 + UNROT / * IP 2 { 2 } ROT 2 SWAP ; input n; n := Int(n/ln(n)*(1 + 4/(pi*ln(n)))), p:=2; (n ~ number of primes less then n, pi used here only as a convenience), 2 is assumed to be the 1st elemente in the list + START SWAP NEXTPRIME DUP UNROT DUP 2 SWAP ^ 1 - 4 PICK3 2 - 1 SWAP ; for i := 2 to n, p := nextprime; s := 4; m := 2^p - 1; + START SQ 2 - OVER MOD ; for j := 1 to p - 2; s := s^2 mod m; + NEXT NIP NOT { + } { DROP } IFTE ; next j; if s = 0 then add p to the list else discard p; + NEXT NIP ; next i; +\>> diff --git a/Task/Lucas-Lehmer-test/Ring/lucas-lehmer-test.ring b/Task/Lucas-Lehmer-test/Ring/lucas-lehmer-test.ring new file mode 100644 index 0000000000..0af79bd8a5 --- /dev/null +++ b/Task/Lucas-Lehmer-test/Ring/lucas-lehmer-test.ring @@ -0,0 +1,16 @@ +see "Mersenne Primes :" + nl +for p = 2 to 18 + if lucasLehmer(p) see "M" + p + nl ok +next + +func lucasLehmer p + i = 0 mp = 0 sn = 0 + if p = 2 return true ok + if (p and 1) = 0 return false ok + mp = pow(2,p) - 1 + sn = 4 + for i = 3 to p + sn = pow(sn,2) - 2 + sn -= (mp * floor(sn / mp)) + next + return (sn=0) diff --git a/Task/Lucas-Lehmer-test/Sidef/lucas-lehmer-test.sidef b/Task/Lucas-Lehmer-test/Sidef/lucas-lehmer-test.sidef new file mode 100644 index 0000000000..5d7ad4843d --- /dev/null +++ b/Task/Lucas-Lehmer-test/Sidef/lucas-lehmer-test.sidef @@ -0,0 +1,16 @@ +func is_mersenne_prime(p) { + p == 2 && return(true); + var s = 4 + var mp = (2**p - 1) + (p-2).times { + s = (s.expmod(2, mp) - 2) + s < 0 && (s += mp) + } + s == 0 +} + +Inf.times { |n| + n.is_prime -> + && is_mersenne_prime(n) -> + && say "M#{n}" +} diff --git a/Task/Ludic-numbers/FreeBASIC/ludic-numbers.freebasic b/Task/Ludic-numbers/FreeBASIC/ludic-numbers.freebasic new file mode 100644 index 0000000000..7ebb219eac --- /dev/null +++ b/Task/Ludic-numbers/FreeBASIC/ludic-numbers.freebasic @@ -0,0 +1,106 @@ +' FB 1.05.0 Win64 + +' As it would be too expensive to actually remove elements from the array +' we instead set an element to 0 if it has been removed. + +Sub ludic(n As Integer, lu() As Integer) + If n < 1 Then Return + Redim lu(1 To n) + lu(1) = 1 + If n = 1 Then Return + Dim As Integer count = 1, count2 + Dim As Integer i, j, k = 1 + Dim As Integer ub = 22000 '' big enough to deal with up to 2005 ludic numbers + Dim a(2 To ub) As Integer + For i = 2 To ub : a(i) = i : Next + + Do + k += 1 + + For i = k to ub + If a(i) > 0 Then + count += 1 + lu(count) = a(i) + If n = count Then Return + a(i) = 0 + k = i + Exit For + End If + Next + + count2 = 0 + j = k + 1 + + While j <= ub + If a(j) > 0 Then + count2 +=1 + If count2 = k Then + a(j) = 0 + count2 = 0 + End If + End If + j += 1 + Wend + Loop + +End Sub + +Dim i As Integer +Dim lu() As Integer +ludic(2005, lu()) +Print "The first 25 Ludic numbers are :" +For i = 1 To 25 + Print Using "###"; lu(i); + Print " "; +Next +Print + +Dim As Integer Count = 0 +For i = 1 To 1000 + If lu(i) <= 1000 Then + count += 1 + Else + Exit For + End If +Next +Print +Print "There are"; count; " Ludic numbers <= 1000" +Print + +Print "The 2000th to 2005th Ludics are :" +For i = 2000 To 2005 + Print lu(i); " "; +Next +Print : Print + +Print "The Ludic triplets below 250 are : " +Dim As Integer j, k, ldc +Dim b As Boolean +For i = 1 To 248 + ldc = lu(i) + If ldc >= 244 Then Exit For + b = False + For j = i + 1 To 249 + If lu(j) = ldc + 2 Then + b = True + k = j + Exit For + ElseIf lu(j) > ldc + 2 Then + Exit For + End If + Next j + If b = False Then Continue For + For j = k + 1 To 250 + If lu(j) = ldc + 6 Then + Print "("; Str(ldc); ","; ldc + 2; ","; ldc + 6; ")" + Exit For + ElseIf lu(j) > ldc + 6 Then + Exit For + End If + Next j +Next i +Erase lu +Print + +Print "Press any key to quit" +Sleep diff --git a/Task/Ludic-numbers/Oforth/ludic-numbers.oforth b/Task/Ludic-numbers/Oforth/ludic-numbers.oforth new file mode 100644 index 0000000000..c9d39a1c8e --- /dev/null +++ b/Task/Ludic-numbers/Oforth/ludic-numbers.oforth @@ -0,0 +1,23 @@ +: ludic(n) +| ludics l p | + ListBuffer newSize(n) seqFrom(2, n) over addAll ->l + ListBuffer newSize(n) dup add(1) dup ->ludics + + while(l notEmpty) [ + l removeFirst dup ludics add ->p + l size p / p * while(dup 1 > ) [ dup l removeAt drop p - ] drop + ] ; + +: ludics +| l i | + ludic(22000) ->l + "First 25 : " print l left(25) println + "Below 1000 : " print l filter(#[ 1000 < ]) size println + "2000 to 2005 : " print l extract(2000, 2005) println + + 250 loop: i [ + l include(i) ifFalse: [ continue ] + l include(i 2 +) ifFalse: [ continue ] + l include(i 6 +) ifFalse: [ continue ] + i print ", " print i 2 + print ", " print i 6 + println + ] ; diff --git a/Task/Ludic-numbers/Sidef/ludic-numbers.sidef b/Task/Ludic-numbers/Sidef/ludic-numbers.sidef new file mode 100644 index 0000000000..a901cf102e --- /dev/null +++ b/Task/Ludic-numbers/Sidef/ludic-numbers.sidef @@ -0,0 +1,24 @@ +func ludics_upto(nmax=100000) { + Enumerator({ |collect| + collect(1) + var arr = @(2..nmax) + while (arr) { + collect(var n = arr[0]) + arr.range.by(n).each {|i| arr[i] = nil} + arr.compact! + } + }) +} + +func ludics_first(n) { + ludics_upto(n * n.log2).first(n) +} + +say("First 25 Ludic numbers: ", ludics_first(25).join(' ')) +say("Ludics below 1000: ", ludics_upto(1000).len) +say("Ludic numbers 2000 to 2005: ", ludics_first(2005).last(6).join(' ')) + +var a = ludics_upto(250).to_a +say("Ludic triples below 250: ", a.grep{|x| a.contains_all([x+2, x+6]) } \ + .map {|x| '(' + [x, x+2, x+6].join(' ') + ')' } \ + .join(' ')) diff --git a/Task/Luhn-test-of-credit-card-numbers/Ceylon/luhn-test-of-credit-card-numbers.ceylon b/Task/Luhn-test-of-credit-card-numbers/Ceylon/luhn-test-of-credit-card-numbers.ceylon new file mode 100644 index 0000000000..53248c8037 --- /dev/null +++ b/Task/Luhn-test-of-credit-card-numbers/Ceylon/luhn-test-of-credit-card-numbers.ceylon @@ -0,0 +1,27 @@ +shared void run() { + value numbers = "49927398716 + 49927398717 + 1234567812345678 + 1234567812345670"; + for(number in numbers.lines) { + print("``number`` passes? ``luhn(number)``"); + } +} + +shared Boolean luhn(String number) { + value digits = number + .reversed + .map(Character.string) + .map(parseInteger) + .coalesced; + value s1 = sum {0, *digits.by(2)}; + value s2 = sum { + 0, + *digits + .skip(1) + .by(2) + .map(curry(times)(2)) + .map((Integer element) => element / 10 + element % 10) + }; + return (s1 + s2) % 10 == 0; +} diff --git a/Task/Luhn-test-of-credit-card-numbers/EchoLisp/luhn-test-of-credit-card-numbers.echolisp b/Task/Luhn-test-of-credit-card-numbers/EchoLisp/luhn-test-of-credit-card-numbers.echolisp new file mode 100644 index 0000000000..a2dae952de --- /dev/null +++ b/Task/Luhn-test-of-credit-card-numbers/EchoLisp/luhn-test-of-credit-card-numbers.echolisp @@ -0,0 +1,16 @@ +;; value for 'even' numbers +(define (even-val n) (if (> n 4) (+ n n -9) (+ n n))) + +;;Luhn test +;; input : a string of decimal digits +;; output #t or #f +(define (valid nums (odd #f )) + (let ((nums (map string->number (reverse (string->list nums))))) + (= 0 (modulo + (for/sum ((n nums)) (set! odd (not odd)) (if odd n (even-val n))) + 10)))) + +(valid "49927398716") → #t +(valid "1234567812345670") → #t +(valid "1234567812345678") → #f +(valid "49927398717") → #f diff --git a/Task/Luhn-test-of-credit-card-numbers/FreeBASIC/luhn-test-of-credit-card-numbers.freebasic b/Task/Luhn-test-of-credit-card-numbers/FreeBASIC/luhn-test-of-credit-card-numbers.freebasic new file mode 100644 index 0000000000..59222467ed --- /dev/null +++ b/Task/Luhn-test-of-credit-card-numbers/FreeBASIC/luhn-test-of-credit-card-numbers.freebasic @@ -0,0 +1,58 @@ +' version 05-07-2015 +' compile with: fbc -s console + +#Ifndef TRUE ' define true and false for older freebasic versions + #Define FALSE 0 + #Define TRUE Not FALSE +#EndIf + +Function luhntest(cardnr As String) As Integer + + cardnr = Trim(cardnr) ' we don't want spaces + Dim As String reverse_nr = cardnr + Dim As Integer i, j, s1, s2, l = Len(cardnr) - 1 + + ' reverse string + For i = 0 To l + reverse_nr[i] = cardnr[l - i] + Next + ' sum odd numbers + For i = 0 To l Step 2 + s1 = s1 + (reverse_nr[i] - Asc("0")) + Next + ' sum even numbers + For i = 1 To l Step 2 + j = reverse_nr[i] - Asc("0") + j = j * 2 + If j > 9 Then j = j Mod 10 + 1 + s2 = s2 + j + Next + + If (s1 + s2) Mod 10 = 0 Then + Return TRUE + Else + Return FALSE + End If + +End Function + +' ------=< MAIN >=------ + +Dim As String input_nr(1 To ...) = {"49927398716", "49927398717",_ + "1234567812345678", "1234567812345670"} +Dim As Integer a + +Print "Task test number 49927398716 should be TRUE, report back as "; +Print IIf(luhntest("49927398716" ) = TRUE, "TRUE", "FALSE") +Print : Print + +Print "test card nr:" +For a = 1 To UBound(input_nr) + Print input_nr(a); " = "; IIf(luhntest(input_nr(a)) = TRUE, "TRUE", "FALSE") +Next + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Luhn-test-of-credit-card-numbers/FunL/luhn-test-of-credit-card-numbers.funl b/Task/Luhn-test-of-credit-card-numbers/FunL/luhn-test-of-credit-card-numbers.funl new file mode 100644 index 0000000000..7fb3a7a477 --- /dev/null +++ b/Task/Luhn-test-of-credit-card-numbers/FunL/luhn-test-of-credit-card-numbers.funl @@ -0,0 +1,12 @@ +def luhn_checksum( card_number ) = + def digits_of( n ) = [int(d) | d <- n.toString()] + + digits = digits_of( card_number ).reverse() + odd_digits = digits(0:digits.length():2) + even_digits = digits(1:digits.length():2) + (sum( odd_digits ) + sum( sum(digits_of(d*2)) | d <- even_digits )) mod 10 + +def is_luhn_valid( card_number ) = luhn_checksum( card_number ) == 0 + +for n <- [49927398716, 49927398717, 1234567812345678, 1234567812345670] + println( n + ' is ' + (if is_luhn_valid(n) then 'valid' else 'invalid') ) diff --git a/Task/Luhn-test-of-credit-card-numbers/Lasso/luhn-test-of-credit-card-numbers.lasso b/Task/Luhn-test-of-credit-card-numbers/Lasso/luhn-test-of-credit-card-numbers.lasso new file mode 100644 index 0000000000..b6e65fd062 --- /dev/null +++ b/Task/Luhn-test-of-credit-card-numbers/Lasso/luhn-test-of-credit-card-numbers.lasso @@ -0,0 +1,24 @@ +#!/usr/bin/lasso9 + +define luhn_check(number) => { + local( + rev = #number->asString, + checksum = 0 + ) + #rev->reverse + iterate(#rev, local(digit)) => { + if((loop_count % 2) == 0) => { + #checksum += (2 * integer(#digit)) + integer(#digit) >= 5 ? #checksum -= 9 + else + #checksum += integer(#digit) + } + } + (#checksum % 10) != 0 ? return false + return true +} + +stdoutnl(luhn_check(49927398716)) // true +stdoutnl(luhn_check(49927398717)) // false +stdoutnl(luhn_check(1234567812345678)) // false +stdoutnl(luhn_check(1234567812345670)) // true diff --git a/Task/Luhn-test-of-credit-card-numbers/LiveCode/luhn-test-of-credit-card-numbers.livecode b/Task/Luhn-test-of-credit-card-numbers/LiveCode/luhn-test-of-credit-card-numbers.livecode new file mode 100644 index 0000000000..b85bd9c71f --- /dev/null +++ b/Task/Luhn-test-of-credit-card-numbers/LiveCode/luhn-test-of-credit-card-numbers.livecode @@ -0,0 +1,24 @@ +function LuhnTest cc + local s1,evens, s2 + repeat with n = 1 to len(cc) + if n mod 2 is not 0 then + add (char -n of cc) to s1 + else + put (char -n of cc) * 2 into evens + if evens > 9 then subtract 9 from evens + add evens to s2 + end if + end repeat + return the last char of (s1 + s2) is 0 +end LuhnTest + +-- test +repeat for each item ccno in "49927398716,49927398717,1234567812345678,1234567812345670" + put ccno && LuhnTest(ccno) & cr after luhncheck +end repeat +put luhncheck + +49927398716 true +49927398717 false +1234567812345678 false +1234567812345670 true diff --git a/Task/Luhn-test-of-credit-card-numbers/Nim/luhn-test-of-credit-card-numbers.nim b/Task/Luhn-test-of-credit-card-numbers/Nim/luhn-test-of-credit-card-numbers.nim new file mode 100644 index 0000000000..4273e972b8 --- /dev/null +++ b/Task/Luhn-test-of-credit-card-numbers/Nim/luhn-test-of-credit-card-numbers.nim @@ -0,0 +1,12 @@ +proc luhn(cc): bool = + const m = [0,2,4,6,8,1,3,5,7,9] + var sum = 0 + var odd = true + for i in countdown(cc.high, 0): + let digit = ord(cc[i]) - ord('0') + sum += (if odd: digit else: m[digit]) + odd = not odd + sum mod 10 == 0 + +for cc in ["49927398716", "49927398717", "1234567812345678", "1234567812345670"]: + echo cc," ",luhn(cc) diff --git a/Task/Luhn-test-of-credit-card-numbers/Oforth/luhn-test-of-credit-card-numbers.oforth b/Task/Luhn-test-of-credit-card-numbers/Oforth/luhn-test-of-credit-card-numbers.oforth new file mode 100644 index 0000000000..73a6b22d28 --- /dev/null +++ b/Task/Luhn-test-of-credit-card-numbers/Oforth/luhn-test-of-credit-card-numbers.oforth @@ -0,0 +1,8 @@ +: luhnTest(n) +| s i | + n asString reverse ->s + 0 s size loop: i [ + i s at asDigit + i isEven ifTrue: [ 2 * dup 10 >= ifTrue: [ 9 - ] ] + + ] + 10 mod ==0 ; diff --git a/Task/Luhn-test-of-credit-card-numbers/Phix/luhn-test-of-credit-card-numbers.phix b/Task/Luhn-test-of-credit-card-numbers/Phix/luhn-test-of-credit-card-numbers.phix new file mode 100644 index 0000000000..16f2f483d7 --- /dev/null +++ b/Task/Luhn-test-of-credit-card-numbers/Phix/luhn-test-of-credit-card-numbers.phix @@ -0,0 +1,17 @@ +function Luhn(string st) +integer s=0, d + for i=1 to length(st) do + d = st[i]-'0' + s += iff(mod(i,2)?d,d*2-(d>4)*9) + end for + return remainder(s,10)=0 +end function + +procedure test(string s) + printf(1,"%20s : %s\n",{s,iff(Luhn(reverse(s))?"OK":"FAIL")}) +end procedure + +test("49927398716") +test("49927398717") +test("1234567812345678") +test("1234567812345670") diff --git a/Task/Luhn-test-of-credit-card-numbers/Ring/luhn-test-of-credit-card-numbers.ring b/Task/Luhn-test-of-credit-card-numbers/Ring/luhn-test-of-credit-card-numbers.ring new file mode 100644 index 0000000000..62c783a5dc --- /dev/null +++ b/Task/Luhn-test-of-credit-card-numbers/Ring/luhn-test-of-credit-card-numbers.ring @@ -0,0 +1,19 @@ +cardnumber = [49927398716, 49927398717] +decimals(0) + +for cards = 1 to len(cardnumber) + if luhn(cardnumber[cards]) + see "card number " + cardnumber[cards] + " is valid" + nl + else see "card number " + cardnumber[cards] + " is invalid" + nl ok +next + +func luhn card + s = 0 + ln = len(string(card)) + for i = 1 to ln + n = number(substr(string(card), ln-i+1, 1)) + if (i & 1) s += n + nl + else n *= 2 + s += (n % 10) + floor(n/ 10) ok + next + return (s % 10) = 0 diff --git a/Task/Luhn-test-of-credit-card-numbers/Sidef/luhn-test-of-credit-card-numbers.sidef b/Task/Luhn-test-of-credit-card-numbers/Sidef/luhn-test-of-credit-card-numbers.sidef new file mode 100644 index 0000000000..9de3418a5d --- /dev/null +++ b/Task/Luhn-test-of-credit-card-numbers/Sidef/luhn-test-of-credit-card-numbers.sidef @@ -0,0 +1,14 @@ +func luhn (n) { + var chars = n.digits.reverse; + var (i, sum) = (0, 0); + static a = (0..9 -> map {|j| (2*j / 10 -> int) + (2*j % 10 -> int) }); + chars.each { |j| + sum += (i++.is_odd ? a[j] : j); + } + return (sum % 10 == 0); +} + +# Test and display +[49927398716, 49927398717, 1234567812345678, 1234567812345670].each { |n| + say [n, luhn(n)]; +} diff --git a/Task/Luhn-test-of-credit-card-numbers/Swift/luhn-test-of-credit-card-numbers.swift b/Task/Luhn-test-of-credit-card-numbers/Swift/luhn-test-of-credit-card-numbers.swift new file mode 100644 index 0000000000..90c7e386b7 --- /dev/null +++ b/Task/Luhn-test-of-credit-card-numbers/Swift/luhn-test-of-credit-card-numbers.swift @@ -0,0 +1,12 @@ +func lunhCheck(number : String) -> Bool +{ + let reversedInts = number.characters.reverse().map { Int(String($0)) } + return reversedInts.enumerate().reduce(0, combine: {(sum, val) in + let odd = val.index % 2 == 1 + return sum + (odd ? (val.element! == 9 ? 9 : (val.element! * 2) % 9) : val.element!) + }) % 10 == 0 +} + + +lunhCheck("49927398716") // true +lunhCheck("49927398717") // false diff --git a/Task/Luhn-test-of-credit-card-numbers/Xojo/luhn-test-of-credit-card-numbers.xojo b/Task/Luhn-test-of-credit-card-numbers/Xojo/luhn-test-of-credit-card-numbers.xojo new file mode 100644 index 0000000000..51fddb89c5 --- /dev/null +++ b/Task/Luhn-test-of-credit-card-numbers/Xojo/luhn-test-of-credit-card-numbers.xojo @@ -0,0 +1,35 @@ +Public Function Modulus10(digits As String) as String + // + // Confirm the digits are really, well, digits + // + + dim validator as new RegEx + validator.SearchPattern = "\A\d+\z" + if validator.Search( digits ) is nil then + // + // Raise an exception or something + // + end if + + static doublingTable() as string = array( "0", "2", "4", "6", "8", "1", "3", "5", "7", "9" ) + + dim digitArr() as string = digits.Split( "" ) + for i as integer = digitArr.Ubound downto 0 step 2 + digitArr( i ) = doublingTable( digitArr( i ).Val ) + next + + dim sum as integer + for each digit as string in digitArr + sum = sum + digit.Val + next + + dim check as integer = ( sum * 9 ) mod 10 + return str( check ) +End Function + +Public Function ValidateMod10(digits As String) as Boolean + dim checkDigit as string = digits.Right( 1 ) + digits = digits.Left( digits.Len - 1 ) + + return Modulus10( digits ) = checkDigit +End Function diff --git a/Task/Luhn-test-of-credit-card-numbers/jq/luhn-test-of-credit-card-numbers-1.jq b/Task/Luhn-test-of-credit-card-numbers/jq/luhn-test-of-credit-card-numbers-1.jq new file mode 100644 index 0000000000..eae365776e --- /dev/null +++ b/Task/Luhn-test-of-credit-card-numbers/jq/luhn-test-of-credit-card-numbers-1.jq @@ -0,0 +1,12 @@ +def luhn: + def odds: . as $in | reduce range(0; length) as $i + ([]; if ($i % 2) == 0 then . + [$in[$i]] else . end); + def evens: . as $in | reduce range(1; length) as $i + ([]; if ($i % 2) == 1 then . + [$in[$i]] else . end); + def digits: map([.]|implode|tonumber); + def sumdigits: tostring | explode | digits | add; + + (tostring | explode | reverse ) as $reverse + | ($reverse | odds | digits | add) as $s1 + | ($reverse | evens | digits | map(. * 2 | sumdigits) | add) as $s2 + | 0 == ($s1 + $s2) % 10 ; diff --git a/Task/Luhn-test-of-credit-card-numbers/jq/luhn-test-of-credit-card-numbers-2.jq b/Task/Luhn-test-of-credit-card-numbers/jq/luhn-test-of-credit-card-numbers-2.jq new file mode 100644 index 0000000000..8ea924edd4 --- /dev/null +++ b/Task/Luhn-test-of-credit-card-numbers/jq/luhn-test-of-credit-card-numbers-2.jq @@ -0,0 +1,5 @@ + ( 49927398716, + 49927398717, + 1234567812345678, + 1234567812345670 + ) | "\(.) => \(luhn)"; diff --git a/Task/MD4/FreeBASIC/md4.freebasic b/Task/MD4/FreeBASIC/md4.freebasic new file mode 100644 index 0000000000..f74009dcb9 --- /dev/null +++ b/Task/MD4/FreeBASIC/md4.freebasic @@ -0,0 +1,152 @@ +' version 19-10-2016 +' translation of the (pseudo) code in RFC 1320 +' compile with: fbc -s console + +Function MD4(test_str As String) As String + + Dim As String message = test_str ' string are passed as ByRef + + ' some macro's + #Macro F(X, Y, Z) + (((X) And (Y)) Or ((Not(X)) And (Z))) + #EndMacro + + #Macro G(X, Y, Z) + (((X) And (Y)) Or (((X) And (Z)) Or ((Y) And (Z)))) + #EndMacro + + #Macro H(X, Y, Z) + ((X) Xor (Y) Xor (Z)) + #EndMacro + + ' a little piece of inline asm to do a rotate left on a 32bit variable + #Macro ROtate_Left(x, n) ' rotate left + Asm + rol dword Ptr [x], n + End Asm + #EndMacro + + ' #Macro ROtate_left(x, n) + ' x = x Shl n + x Shr (32 - n) + ' #EndMacro + + Dim As Long i + Dim As String answer, s1 + + Dim As ULongInt l = Len(message) + ' set the first bit after the message to 1 + message = message + Chr(1 Shl 7) + ' add one char to the length + Dim As ULong padding = 64 - ((l +1) Mod (512 \ 8)) ' 512 \ 8 = 64 char. + + ' check if we have enough room for inserting the length + If padding < 8 Then padding = padding + 64 + + message = message + String(padding, Chr(0)) ' adjust length + Dim As ULong l1 = Len(message) ' new length + + l = l * 8 ' orignal length in bits + ' create ubyte ptr to point to l ( = length in bits) + Dim As UByte Ptr ub_ptr = Cast(UByte Ptr, @l) + + For i = 0 To 7 'copy length of message to the last 8 bytes + message[l1 -8 + i] = ub_ptr[i] + Next + + ' unsigned 32bit integers only + Dim As UInteger<32> AA, A = &H67452301 + Dim As UInteger<32> BB, B = &Hefcdab89 + Dim As UInteger<32> CC, C = &H98badcfe + Dim As UInteger<32> DD, D = &H10325476 + + For i = 0 To (l1 -1) \ 64 ' split into 64 byte block + + AA = A : BB = B : CC = C : DD = D + + ' x point to 64 byte block inside the string message + Dim As UInteger<32> Ptr x = Cast(UInteger<32> Ptr, @message[i*64]) + + ' round 1 + A = A + F(B, C, D) + x[ 0] : ROtate_Left(A, 3) + D = D + F(A, B, C) + x[ 1] : ROtate_Left(D, 7) + C = C + F(D, A, B) + x[ 2] : ROtate_Left(C, 11) + B = B + F(C, D, A) + x[ 3] : ROtate_Left(B, 19) + A = A + F(B, C, D) + x[ 4] : ROtate_Left(A, 3) + D = D + F(A, B, C) + x[ 5] : ROtate_Left(D, 7) + C = C + F(D, A, B) + x[ 6] : ROtate_Left(C, 11) + B = B + F(C, D, A) + x[ 7] : ROtate_Left(B, 19) + A = A + F(B, C, D) + x[ 8] : ROtate_Left(A, 3) + D = D + F(A, B, C) + x[ 9] : ROtate_Left(D, 7) + C = C + F(D, A, B) + x[10] : ROtate_Left(C, 11) + B = B + F(C, D, A) + x[11] : ROtate_Left(B, 19) + A = A + F(B, C, D) + x[12] : ROtate_Left(A, 3) + D = D + F(A, B, C) + x[13] : ROtate_Left(D, 7) + C = C + F(D, A, B) + x[14] : ROtate_Left(C, 11) + B = B + F(C, D, A) + x[15] : ROtate_Left(B, 19) + + ' round 2 + A = A + G(B, C, D) + x[ 0] + &H5A827999 : ROtate_Left(A, 3) + D = D + G(A, B, C) + x[ 4] + &H5A827999 : ROtate_Left(D, 5) + C = C + G(D, A, B) + x[ 8] + &H5A827999 : ROtate_Left(C, 9) + B = B + G(C, D, A) + x[12] + &H5A827999 : ROtate_Left(B, 13) + A = A + G(B, C, D) + x[ 1] + &H5A827999 : ROtate_Left(A, 3) + D = D + G(A, B, C) + x[ 5] + &H5A827999 : ROtate_Left(D, 5) + C = C + G(D, A, B) + x[ 9] + &H5A827999 : ROtate_Left(C, 9) + B = B + G(C, D, A) + x[13] + &H5A827999 : ROtate_Left(B, 13) + A = A + G(B, C, D) + x[ 2] + &H5A827999 : ROtate_Left(A, 3) + D = D + G(A, B, C) + x[ 6] + &H5A827999 : ROtate_Left(D, 5) + C = C + G(D, A, B) + x[10] + &H5A827999 : ROtate_Left(C, 9) + B = B + G(C, D, A) + x[14] + &H5A827999 : ROtate_Left(B, 13) + A = A + G(B, C, D) + x[ 3] + &H5A827999 : ROtate_Left(A, 3) + D = D + G(A, B, C) + x[ 7] + &H5A827999 : ROtate_Left(D, 5) + C = C + G(D, A, B) + x[11] + &H5A827999 : ROtate_Left(C, 9) + B = B + G(C, D, A) + x[15] + &H5A827999 : ROtate_Left(B, 13) + + ' round 3 + A = A + H(B, C, D) + x[ 0] + &H6ED9EBA1 : ROtate_Left(A, 3) + D = D + H(A, B, C) + x[ 8] + &H6ED9EBA1 : ROtate_Left(D, 9) + C = C + H(D, A, B) + x[ 4] + &H6ED9EBA1 : ROtate_Left(C, 11) + B = B + H(C, D, A) + x[12] + &H6ED9EBA1 : ROtate_Left(B, 15) + A = A + H(B, C, D) + x[ 2] + &H6ED9EBA1 : ROtate_Left(A, 3) + D = D + H(A, B, C) + x[10] + &H6ED9EBA1 : ROtate_Left(D, 9) + C = C + H(D, A, B) + x[ 6] + &H6ED9EBA1 : ROtate_Left(C, 11) + B = B + H(C, D, A) + x[14] + &H6ED9EBA1 : ROtate_Left(B, 15) + A = A + H(B, C, D) + x[ 1] + &H6ED9EBA1 : ROtate_Left(A, 3) + D = D + H(A, B, C) + x[ 9] + &H6ED9EBA1 : ROtate_Left(D, 9) + C = C + H(D, A, B) + x[ 5] + &H6ED9EBA1 : ROtate_Left(C, 11) + B = B + H(C, D, A) + x[13] + &H6ED9EBA1 : ROtate_Left(B, 15) + A = A + H(B, C, D) + x[ 3] + &H6ED9EBA1 : ROtate_Left(A, 3) + D = D + H(A, B, C) + x[11] + &H6ED9EBA1 : ROtate_Left(D, 9) + C = C + H(D, A, B) + x[ 7] + &H6ED9EBA1 : ROtate_Left(C, 11) + B = B + H(C, D, A) + x[15] + &H6ED9EBA1 : ROtate_Left(B, 15) + + A += AA : B += BB : C += CC : D += DD + + Next + + ' convert A, B, C and D in hex, then add low order first + s1 = Hex(A, 8) + For i = 7 To 1 Step -2 : answer +=Mid(s1, i, 2) : Next + s1 = Hex(B, 8) + For i = 7 To 1 Step -2 : answer +=Mid(s1, i, 2) : Next + s1 = Hex(C, 8) + For i = 7 To 1 Step -2 : answer +=Mid(s1, i, 2) : Next + s1 = Hex(D, 8) + For i = 7 To 1 Step -2 : answer +=Mid(s1, i, 2) : Next + +Return LCase(answer) + +End Function + +' ------=< MAIN >=------ + +Dim As String test = "Rosetta Code" +Print +Print test; " => "; MD4(test) + + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/MD4/Lasso/md4.lasso b/Task/MD4/Lasso/md4.lasso new file mode 100644 index 0000000000..176d127ccd --- /dev/null +++ b/Task/MD4/Lasso/md4.lasso @@ -0,0 +1 @@ +cipher_digest('Rosetta Code', -digest='MD4')->encodeHex->asString diff --git a/Task/MD4/Nim/md4.nim b/Task/MD4/Nim/md4.nim new file mode 100644 index 0000000000..d62e44fda5 --- /dev/null +++ b/Task/MD4/Nim/md4.nim @@ -0,0 +1,13 @@ +import strutils + +const MD4Len = 16 + +proc MD4(d: cstring, n: culong, md: cstring = nil): cstring {.cdecl, dynlib: "libssl.so", importc.} + +proc MD4(s: string): string = + result = "" + var s = MD4(s.cstring, s.len.culong) + for i in 0 .. < MD4Len: + result.add s[i].BiggestInt.toHex(2).toLower + +echo MD4("Rosetta Code") diff --git a/Task/MD4/Sidef/md4.sidef b/Task/MD4/Sidef/md4.sidef new file mode 100644 index 0000000000..74f4c106f6 --- /dev/null +++ b/Task/MD4/Sidef/md4.sidef @@ -0,0 +1,2 @@ +var digest = frequire('Digest::MD4'); +say digest.md4_hex('Rosetta Code'); diff --git a/Task/MD5-Implementation/FreeBASIC/md5-implementation.freebasic b/Task/MD5-Implementation/FreeBASIC/md5-implementation.freebasic new file mode 100644 index 0000000000..9cb7f4716c --- /dev/null +++ b/Task/MD5-Implementation/FreeBASIC/md5-implementation.freebasic @@ -0,0 +1,150 @@ +' version 19-10-2016 +' MD5 from the Wikipedia page "MD5" +' compile with: fbc -s console + +' macro for a rotate left +#Macro ROtate_Left (x, n) ' rotate left + (x) = (x) Shl (n) + (x) Shr (32 - (n)) +#EndMacro + +Function MD5(test_str As String) As String + + Dim As String message = test_str ' strings are passed as ByRef's + + Dim As UByte sx, s(0 To ...) = { 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, _ + 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, _ + 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, _ + 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21 } + + Dim As UInteger<32> K(0 To ...) = { &Hd76aa478, &He8c7b756, &H242070db, _ + &Hc1bdceee, &Hf57c0faf, &H4787c62a, &Ha8304613, &Hfd469501, &H698098d8, _ + &H8b44f7af, &Hffff5bb1, &H895cd7be, &H6b901122, &Hfd987193, &Ha679438e, _ + &H49b40821, &Hf61e2562, &Hc040b340, &H265e5a51, &He9b6c7aa, &Hd62f105d, _ + &H02441453, &Hd8a1e681, &He7d3fbc8, &H21e1cde6, &Hc33707d6, &Hf4d50d87, _ + &H455a14ed, &Ha9e3e905, &Hfcefa3f8, &H676f02d9, &H8d2a4c8a, &Hfffa3942, _ + &H8771f681, &H6d9d6122, &Hfde5380c, &Ha4beea44, &H4bdecfa9, &Hf6bb4b60, _ + &Hbebfbc70, &H289b7ec6, &Heaa127fa, &Hd4ef3085, &H04881d05, &Hd9d4d039, _ + &He6db99e5, &H1fa27cf8, &Hc4ac5665, &Hf4292244, &H432aff97, &Hab9423a7, _ + &Hfc93a039, &H655b59c3, &H8f0ccc92, &Hffeff47d, &H85845dd1, &H6fa87e4f, _ + &Hfe2ce6e0, &Ha3014314, &H4e0811a1, &Hf7537e82, &Hbd3af235, &H2ad7d2bb, _ + &Heb86d391 } + + ' Initialize variables + Dim As UInteger<32> A, a0 = &H67452301 + Dim As UInteger<32> B, b0 = &Hefcdab89 + Dim As UInteger<32> C, c0 = &H98badcfe + Dim As UInteger<32> D, d0 = &H10325476 + Dim As UInteger<32> dtemp, F, g, temp + + Dim As Long i, j + + Dim As ULongInt l = Len(message) + ' set the first bit after the message to 1 + message = message + Chr(1 Shl 7) + ' add one char to the length + Dim As ULong padding = 64 - ((l +1) Mod (512 \ 8)) ' 512 \ 8 = 64 char. + + ' check if we have enough room for inserting the length + If padding < 8 Then padding = padding + 64 + + message = message + String(padding, Chr(0)) ' adjust length + Dim As ULong l1 = Len(message) ' new length + + l = l * 8 ' orignal length in bits + ' create ubyte ptr to point to l ( = length in bits) + Dim As UByte Ptr ub_ptr = Cast(UByte Ptr, @l) + + For i = 0 To 7 'copy length of message to the last 8 bytes + message[l1 -8 + i] = ub_ptr[i] + Next + + For j = 0 To (l1 -1) \ 64 ' split into block of 64 bytes + + A = a0 : B = b0 : C = c0 : D = d0 + + ' break chunk into 16 32bit uinteger + Dim As UInteger<32> Ptr M = Cast(UInteger<32> Ptr, @message[j * 64]) + + For i = 0 To 63 + Select Case As Const i + Case 0 To 15 + F = (B And C) Or ((Not B) And D) + g = i + Case 16 To 31 + F = (B And D) Or (C And (Not D)) + g = (i * 5 +1) Mod 16 + Case 32 To 47 + F = (B Xor C Xor D) + g = (i * 3 +5) Mod 16 + Case 48 To 63 + F = C Xor (B Or (Not D)) + g = (i * 7) Mod 16 + End Select + dtemp = D + D = C + C = B + temp = A + F + K(i)+ M[g] : ROtate_left(temp, s(i)) + B = B + temp + A = dtemp + Next + + a0 += A : b0 += B : c0 += C : d0 += D + + Next + + Dim As String answer + ' convert a0, b0, c0 and d0 in hex, then add, low order first + Dim As String s1 = Hex(a0, 8) + For i = 7 To 1 Step -2 : answer +=Mid(s1, i, 2) : Next + s1 = Hex(b0, 8) + For i = 7 To 1 Step -2 : answer +=Mid(s1, i, 2) : Next + s1 = Hex(c0, 8) + For i = 7 To 1 Step -2 : answer +=Mid(s1, i, 2) : Next + s1 = Hex(d0, 8) + For i = 7 To 1 Step -2 : answer +=Mid(s1, i, 2) : Next + +Return LCase(answer) + +End Function + + +' ------=< MAIN >=------ + +Dim As String test, hash, md5_hash +Dim As ULong i + +For i = 1 To 7 + Read hash, test + md5_hash = MD5(test) + + Print + Print test + Print hash + Print md5_hash; + + If hash = md5_hash Then + Print " PASS" + Else + Print " FAIL" + Beep + End If + +Next + +' testdata +Data "d41d8cd98f00b204e9800998ecf8427e", "" +Data "0cc175b9c0f1b6a831c399e269772661", "a" +Data "900150983cd24fb0d6963f7d28e17f72", "abc" +Data "f96b697d7cb7938d525a2f31aaf161d0", "message digest" +Data "c3fcd3d76192e4007dfb496cca67e13b", "abcdefghijklmnopqrstuvwxyz" +Data "d174ab98d277d9f5a5611c2c9f419d9f" +Data "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" +Data "57edf4a22be3c955ac49da2e2107b67a" +Data "123456789012345678901234567890123456789012345678901234567890" _ + + "12345678901234567890" + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/MD5-Implementation/Phix/md5-implementation.phix b/Task/MD5-Implementation/Phix/md5-implementation.phix new file mode 100644 index 0000000000..57c1bbbed2 --- /dev/null +++ b/Task/MD5-Implementation/Phix/md5-implementation.phix @@ -0,0 +1,143 @@ +function uxor(atom data1,atom data2) +atom result = xor_bits(data1,data2) + if result<0 then result += #100000000 end if + return result +end function + +function uor(atom data1,atom data2) +atom result = or_bits(data1,data2) + if result<0 then result += #100000000 end if + return result +end function + +function r32(atom a) + return remainder(a,#100000000) +end function + +function rol(atom word,integer bits) +-- left rotate the bits of a 32-bit number by the specified number of bits + return r32(word*power(2,bits))+floor(word/power(2,32-bits)) +end function + +constant K = +{#d76aa478, #e8c7b756, #242070db, #c1bdceee, #f57c0faf, #4787c62a, #a8304613, #fd469501, + #698098d8, #8b44f7af, #ffff5bb1, #895cd7be, #6b901122, #fd987193, #a679438e, #49b40821, + #f61e2562, #c040b340, #265e5a51, #e9b6c7aa, #d62f105d, #02441453, #d8a1e681, #e7d3fbc8, + #21e1cde6, #c33707d6, #f4d50d87, #455a14ed, #a9e3e905, #fcefa3f8, #676f02d9, #8d2a4c8a, + #fffa3942, #8771f681, #6d9d6122, #fde5380c, #a4beea44, #4bdecfa9, #f6bb4b60, #bebfbc70, + #289b7ec6, #eaa127fa, #d4ef3085, #04881d05, #d9d4d039, #e6db99e5, #1fa27cf8, #c4ac5665, + #f4292244, #432aff97, #ab9423a7, #fc93a039, #655b59c3, #8f0ccc92, #ffeff47d, #85845dd1, + #6fa87e4f, #fe2ce6e0, #a3014314, #4e0811a1, #f7537e82, #bd3af235, #2ad7d2bb, #eb86d391} + +constant m_block = {1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, + 2, 7,12, 1, 6,11,16, 5,10,15, 4, 9,14, 3, 8,13, + 6, 9,12,15, 2, 5, 8,11,14, 1, 4, 7,10,13,16, 3, + 1, 8,15, 6,13, 4,11, 2, 9,16, 7,14, 5,12, 3,10} + +constant c_words = {#67452301,#efcdab89,#98badcfe,#10325476} + +sequence words + +function divide_in_words(sequence message) +-- Divides the string into words (32-bit numbers) +sequence res + res = repeat(0,length(message)/4) + for word=1 to length(message)/4 do + res[word] = bytes_to_int(message[word*4-3..word*4]) + end for + return res +end function + +procedure process_block(sequence block) +-- Updates the words according to the contents of the block +atom a,b,c,d + + block = divide_in_words(block) + + a = words[1] + b = words[2] + c = words[3] + d = words[4] + + -- Round 1 + for step=1 to 16 by 4 do + a = r32(b+rol(r32(a+block[m_block[step ]]+K[step ]+uor(and_bits(b,c),and_bits(not_bits(b),d))), 7)) + d = r32(a+rol(r32(d+block[m_block[step+1]]+K[step+1]+uor(and_bits(a,b),and_bits(not_bits(a),c))),12)) + c = r32(d+rol(r32(c+block[m_block[step+2]]+K[step+2]+uor(and_bits(d,a),and_bits(not_bits(d),b))),17)) + b = r32(c+rol(r32(b+block[m_block[step+3]]+K[step+3]+uor(and_bits(c,d),and_bits(not_bits(c),a))),22)) + end for + + -- Round 2 + for step=17 to 32 by 4 do + a = r32(b+rol(r32(a+block[m_block[step ]]+K[step ]+uor(and_bits(b,d),and_bits(c,not_bits(d)))), 5)) + d = r32(a+rol(r32(d+block[m_block[step+1]]+K[step+1]+uor(and_bits(a,c),and_bits(b,not_bits(c)))), 9)) + c = r32(d+rol(r32(c+block[m_block[step+2]]+K[step+2]+uor(and_bits(d,b),and_bits(a,not_bits(b)))),14)) + b = r32(c+rol(r32(b+block[m_block[step+3]]+K[step+3]+uor(and_bits(c,a),and_bits(d,not_bits(a)))),20)) + end for + + -- Round 3 + for step=33 to 48 by 4 do + a = r32(b+rol(r32(a+block[m_block[step ]]+K[step ]+uxor(b,xor_bits(c,d))), 4)) + d = r32(a+rol(r32(d+block[m_block[step+1]]+K[step+1]+uxor(a,xor_bits(b,c))),11)) + c = r32(d+rol(r32(c+block[m_block[step+2]]+K[step+2]+uxor(d,xor_bits(a,b))),16)) + b = r32(c+rol(r32(b+block[m_block[step+3]]+K[step+3]+uxor(c,xor_bits(d,a))),23)) + end for + + -- Round 4 + for step=49 to 64 by 4 do + a = r32(b+rol(r32(a+block[m_block[step ]]+K[step ]+uxor(c,or_bits(b,not_bits(d)))), 6)) + d = r32(a+rol(r32(d+block[m_block[step+1]]+K[step+1]+uxor(b,or_bits(a,not_bits(c)))),10)) + c = r32(d+rol(r32(c+block[m_block[step+2]]+K[step+2]+uxor(a,or_bits(d,not_bits(b)))),15)) + b = r32(c+rol(r32(b+block[m_block[step+3]]+K[step+3]+uxor(d,or_bits(c,not_bits(a)))),21)) + end for + + -- Update the words + words[1] = r32(words[1]+a) + words[2] = r32(words[2]+b) + words[3] = r32(words[3]+c) + words[4] = r32(words[4]+d) +end procedure + +function pad_message(sequence message) +-- Add bytes to the end of the message so it can be divided +-- in an exact number of 64-byte blocks. +integer bytes_to_add + bytes_to_add = 64-remainder(length(message)+9,64) + if bytes_to_add=64 then bytes_to_add = 0 end if + + message = messageP&repeat(0,bytes_to_add)& + int_to_bytes(length(message)*8)&{0,0,0,0} + + return message +end function + + +function md5(sequence message) +-- Given a string, returns a 16-byte hash of it. + + words = c_words -- Initialize the H words + + message = pad_message(message) -- Add bytes to the message + + -- Process each 64-byte block + for block=1 to length(message) by 64 do + process_block(message[block..block+63]) + end for + + -- Convert hash into bytes + return int_to_bytes(words[1])& -- Return the hash + int_to_bytes(words[2])& + int_to_bytes(words[3])& + int_to_bytes(words[4]) + +end function + +constant fmt = "0x%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X\n" + +printf(1,fmt,md5("")) +printf(1,fmt,md5("a")) +printf(1,fmt,md5("abc")) +printf(1,fmt,md5("message digest")) +printf(1,fmt,md5("abcdefghijklmnopqrstuvwxyz")) +printf(1,fmt,md5("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")) +printf(1,fmt,md5("12345678901234567890123456789012345678901234567890123456789012345678901234567890")) diff --git a/Task/MD5-Implementation/Sidef/md5-implementation.sidef b/Task/MD5-Implementation/Sidef/md5-implementation.sidef new file mode 100644 index 0000000000..454c934c0a --- /dev/null +++ b/Task/MD5-Implementation/Sidef/md5-implementation.sidef @@ -0,0 +1,109 @@ +class MD5(String msg) { + + method init { + msg = msg.bytes + } + + const FGHI = [ + {|a,b,c| (a & b) | (~a & c) }, + {|a,b,c| (a & c) | (b & ~c) }, + {|a,b,c| (a ^ b ^ c) }, + {|a,b,c| (b ^ (a | ~c)) }, + ] + + const S = [ + [7, 12, 17, 22] * 4, + [5, 9, 14, 20] * 4, + [4, 11, 16, 23] * 4, + [6, 10, 15, 21] * 4, + ].flat + + const T = 64.of {|i| floor(abs(sin(i)) * 1<<32) } + + const K = [ + ^16 -> map {|n| n }, + ^16 -> map {|n| (5*n + 1) % 16 }, + ^16 -> map {|n| (3*n + 5) % 16 }, + ^16 -> map {|n| (7*n ) % 16 }, + ].flat + + func radix(Number b, Array a) { + ^a -> map {|i| b**i * a[i] }.sum(0) + } + + func little_endian(Number w, Number n, Array v) { + var step1 = (^n »*» w) + var step2 = (v ~X>> step1) + step2 »%» (1 << w) + } + + func block(Number a, Number b) { (a + b) & 0xffffffff } + func srble(Number a, Number n) { (a << n) & 0xffffffff | (a >> (32-n)) } + + func md5_pad(msg) { + var bits = 8*msg.len + var padded = [msg..., 128, [0] * (-(floor(bits / 8) + 1 + 8) % 64)].flat + + gather { + padded.each_slice(4, {|a| + take(radix(256, a)) + }) + take(little_endian(32, 2, [bits])) + }.flat + } + + func md5_block(Array H, Array X) { + var (A, B, C, D) = H... + + for i in ^64 { + (A, B, C, D) = (D, + block(B, srble( + block( + block( + block(A, FGHI[floor(i / 16)](B, C, D)), T[i] + ), X[K[i]] + ), S[i]) + ), B, C) + } + + for k,v in ([A, B, C, D].pairs) { + H[k] = block(H[k], v) + } + + return H + } + + method md5_hex { + self.md5.map {|n| '%02x' % n }.join + } + + method md5 { + var M = md5_pad(msg) + var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476] + + for i in (range(0, M.end, 16)) { + md5_block(H, M.ft(i, i+15)) + } + + little_endian(8, 4, H) + } +} + +var tests = [ + ['d41d8cd98f00b204e9800998ecf8427e', ''], + ['0cc175b9c0f1b6a831c399e269772661', 'a'], + ['900150983cd24fb0d6963f7d28e17f72', 'abc'], + ['f96b697d7cb7938d525a2f31aaf161d0', 'message digest'], + ['c3fcd3d76192e4007dfb496cca67e13b', 'abcdefghijklmnopqrstuvwxyz'], + ['d174ab98d277d9f5a5611c2c9f419d9f', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'], + ['57edf4a22be3c955ac49da2e2107b67a', '12345678901234567890123456789012345678901234567890123456789012345678901234567890'], +] + +for md5,msg in tests { + var hash = MD5(msg).md5_hex + say "#{hash} : #{msg}" + + if (hash != md5) { + say "\tHowever, that is incorrect (expected: #{md5})" + } +} diff --git a/Task/MD5-Implementation/Swift/md5-implementation-1.swift b/Task/MD5-Implementation/Swift/md5-implementation-1.swift new file mode 100644 index 0000000000..5559fe9c62 --- /dev/null +++ b/Task/MD5-Implementation/Swift/md5-implementation-1.swift @@ -0,0 +1,126 @@ + import Foundation + public class MD5 { + /** specifies the per-round shift amounts */ + private let s: [UInt32] = [7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, + 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, + 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, + 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21] + + /** binary integer part of the sines of integers (Radians) */ + private let K: [UInt32] = (0 ..< 64).map { UInt32(0x100000000 * abs(sin(Double($0 + 1)))) } + + let a0: UInt32 = 0x67452301 + let b0: UInt32 = 0xefcdab89 + let c0: UInt32 = 0x98badcfe + let d0: UInt32 = 0x10325476 + + private var message: NSData + + //MARK: Public + + public init(_ message: NSData) { + self.message = message + } + + public func calculate() -> NSData? { + var tmpMessage: NSMutableData = NSMutableData(data: message) + let wordSize = sizeof(UInt32) + + var aa = a0 + var bb = b0 + var cc = c0 + var dd = d0 + + // Step 1. Append Padding Bits + tmpMessage.appendBytes([0x80]) // append one bit (Byte with one bit) to message + + // append "0" bit until message length in bits ≡ 448 (mod 512) + while tmpMessage.length % 64 != 56 { + tmpMessage.appendBytes([0x00]) + } + + // Step 2. Append Length a 64-bit representation of lengthInBits + var lengthInBits = (message.length * 8) + var lengthBytes = lengthInBits.bytes(64 / 8) + tmpMessage.appendBytes(reverse(lengthBytes)); + + // Process the message in successive 512-bit chunks: + let chunkSizeBytes = 512 / 8 + var leftMessageBytes = tmpMessage.length + for var i = 0; i < tmpMessage.length; i = i + chunkSizeBytes, leftMessageBytes -= chunkSizeBytes { + let chunk = tmpMessage.subdataWithRange(NSRange(location: i, length: min(chunkSizeBytes,leftMessageBytes))) + + // break chunk into sixteen 32-bit words M[j], 0 ≤ j ≤ 15 + // println("wordSize \(wordSize)"); + var M:[UInt32] = [UInt32](count: 16, repeatedValue: 0) + for x in 0.. NSData? + { + return MD5(message).calculate(); + } + + //MARK: Private + private func rotateLeft(x:UInt32, _ n:UInt32) -> UInt32 { + return (x &<< n) | (x &>> (32 - n)) + } + } diff --git a/Task/MD5-Implementation/Swift/md5-implementation-2.swift b/Task/MD5-Implementation/Swift/md5-implementation-2.swift new file mode 100644 index 0000000000..25f76ebec5 --- /dev/null +++ b/Task/MD5-Implementation/Swift/md5-implementation-2.swift @@ -0,0 +1,83 @@ +import Foundation + +let shift : [UInt32] = [7, 12, 17, 22, 5, 9, 14, 20, 4, 11, 16, 23, 6, 10, 15, 21] +let table: [UInt32] = (0 ..< 64).map { UInt32(0x100000000 * abs(sin(Double($0 + 1)))) } + +func md5(var message: [UInt8]) -> [UInt8] { + var messageLenBits = UInt64(message.count) * 8 + message.append(0x80) + while message.count % 64 != 56 { + message.append(0) + } + + var lengthBytes = [UInt8](count: 8, repeatedValue: 0) + UnsafeMutablePointer(lengthBytes).memory = messageLenBits.littleEndian + message += lengthBytes + + var a : UInt32 = 0x67452301 + var b : UInt32 = 0xEFCDAB89 + var c : UInt32 = 0x98BADCFE + var d : UInt32 = 0x10325476 + for chunkOffset in stride(from: 0, to: message.count, by: 64) { + let chunk = UnsafePointer(UnsafePointer(message) + chunkOffset) + let originalA = a + let originalB = b + let originalC = c + let originalD = d + for j in 0 ..< 64 { + var f : UInt32 = 0 + var bufferIndex = j + let round = j >> 4 + switch round { + case 0: + f = (b & c) | (~b & d) + case 1: + f = (b & d) | (c & ~d) + bufferIndex = (bufferIndex*5 + 1) & 0x0F + case 2: + f = b ^ c ^ d + bufferIndex = (bufferIndex*3 + 5) & 0x0F + case 3: + f = c ^ (b | ~d) + bufferIndex = (bufferIndex * 7) & 0x0F + default: + assert(false) + } + let sa = shift[(round<<2)|(j&3)] + let tmp = a &+ f &+ UInt32(littleEndian: chunk[bufferIndex]) &+ table[j] + a = d + d = c + c = b + b = b &+ (tmp << sa | tmp >> (32-sa)) + } + a = a &+ originalA + b = b &+ originalB + c = c &+ originalC + d = d &+ originalD + } + + var result = [UInt8](count: 16, repeatedValue: 0) + for (i, n) in enumerate([a, b, c, d]) { + UnsafeMutablePointer(result)[i] = n.littleEndian + } + return result +} + +func toHexString(bytes: [UInt8]) -> String { + return "".join(bytes.map { String(format:"%02x", $0) }) +} + +for (hashCode, string) in [ + ("d41d8cd98f00b204e9800998ecf8427e", ""), + ("0cc175b9c0f1b6a831c399e269772661", "a"), + ("900150983cd24fb0d6963f7d28e17f72", "abc"), + ("f96b697d7cb7938d525a2f31aaf161d0", "message digest"), + ("c3fcd3d76192e4007dfb496cca67e13b", "abcdefghijklmnopqrstuvwxyz"), + ("d174ab98d277d9f5a5611c2c9f419d9f", + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"), + ("57edf4a22be3c955ac49da2e2107b67a", "12345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890")] { + println(hashCode) + println(toHexString(md5(Array(string.utf8)))) + println() +} diff --git a/Task/MD5/8th/md5.8th b/Task/MD5/8th/md5.8th new file mode 100644 index 0000000000..ea803383b6 --- /dev/null +++ b/Task/MD5/8th/md5.8th @@ -0,0 +1,2 @@ +"md5" cr:hash! "Some text" cr:hash cr:hash>s +. cr bye diff --git a/Task/MD5/Futhark/md5.futhark b/Task/MD5/Futhark/md5.futhark new file mode 100644 index 0000000000..9d98391947 --- /dev/null +++ b/Task/MD5/Futhark/md5.futhark @@ -0,0 +1,75 @@ +type md5 = (u32, u32, u32, u32) + +fun rs(): [64]u32 = + map u32 + ([ 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, + 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, + 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, + 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21 ]) + +fun ks(): [64]u32 = + map u32 + ([ 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee , + 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501 , + 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be , + 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821 , + 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa , + 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8 , + 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed , + 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a , + 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c , + 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70 , + 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05 , + 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665 , + 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039 , + 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1 , + 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1 , + 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 ]) + +fun md5(ms: [n][16]u32): md5 = + let a0 = u32(0x67452301) + let b0 = u32(0xefcdab89) + let c0 = u32(0x98badcfe) + let d0 = u32(0x10325476) + loop ((a0,b0,c0,d0)) = for i < n do + let (a,b,c,d) = md5_chunk (a0,b0,c0,d0) ms[i] + in (a0+a, b0+b, c0+c, d0+d) + in (a0,b0,c0,d0) + +fun rotate_left(x: u32, c: u32): u32 = (x << c) | (x >> (32u32 - c)) + +fun bytes(x: u32): [4]u8 = [u8(x), + u8(x/0x100u32), + u8(x/0x10000u32), + u8(x/0x1000000u32)] + +fun unbytes(bs: [4]u8): u32 = + u32(bs[0]) + + u32(bs[1]) * 0x100u32 + + u32(bs[2]) * 0x10000u32 + + u32(bs[3]) * 0x1000000u32 + +fun unbytes_block(block: [64]u8): [16]u32 = + map unbytes (reshape (16,4) block) + +fun main(ms: [n]u8): [16]u8 = + let padding = 64 - (n % 64) + let n_padded = n + padding + let ms_padded = concat ms (bytes 0x80u32) (replicate (padding-12) 0x0u8) (bytes (u32(n*8))) ([0u8,0u8,0u8,0u8]) + let (a,b,c,d) = md5 (map unbytes_block (reshape (n_padded / 64, 64) ms_padded)) + in reshape 16 (map bytes ([a,b,c,d])) + +-- Process 512 bits of the input. +fun md5_chunk ((a0,b0,c0,d0): md5) (m: [16]u32): md5 = + loop ((a,b,c,d) = (a0,b0,c0,d0)) = for i < 64 do + let (f,g) = + if i < 16 then ((b & c) | ((~b) & d), + i) + else if i < 32 then ((d & b) | ((~d) & c), + i32((5u32*u32(i) + 1u32) % 16u32)) + else if i < 48 then (b ^ c ^ d, + i32((3u32*u32(i) + 5u32) % 16u32)) + else (c ^ (b | (~d)), + i32((7u32*u32(i)) % 16u32)) + in (d, b + rotate_left(a + f + (ks())[i] + m[g], (rs())[i]), b, c) + in (a,b,c,d) diff --git a/Task/MD5/Lasso/md5-1.lasso b/Task/MD5/Lasso/md5-1.lasso new file mode 100644 index 0000000000..a7c6d835bc --- /dev/null +++ b/Task/MD5/Lasso/md5-1.lasso @@ -0,0 +1,2 @@ +Encrypt_MD5('Welcome all Rhinos!') +//80ba88ee2600e9e9b36e739458c39ebd diff --git a/Task/MD5/Lasso/md5-2.lasso b/Task/MD5/Lasso/md5-2.lasso new file mode 100644 index 0000000000..63994258df --- /dev/null +++ b/Task/MD5/Lasso/md5-2.lasso @@ -0,0 +1,12 @@ +local(test = map( + 'a' = '0cc175b9c0f1b6a831c399e269772661', + 'abc' = '900150983cd24fb0d6963f7d28e17f72', + 'message digest' = 'f96b697d7cb7938d525a2f31aaf161d0', + 'abcdefghijklmnopqrstuvwxyz' = 'c3fcd3d76192e4007dfb496cca67e13b', + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' = 'd174ab98d277d9f5a5611c2c9f419d9f', + '12345678901234567890123456789012345678901234567890123456789012345678901234567890' = '57edf4a22be3c955ac49da2e2107b67a' + ) +) +with a in #test->keys do => {^ + 'testing: "'+#a+'": '+(Encrypt_MD5(#a)->asBytes == #test->find(#a)->asBytes)+'\r' +^} diff --git a/Task/MD5/Lingo/md5-1.lingo b/Task/MD5/Lingo/md5-1.lingo new file mode 100644 index 0000000000..1ab1a18fcb --- /dev/null +++ b/Task/MD5/Lingo/md5-1.lingo @@ -0,0 +1 @@ +put cx_md5_string(str) diff --git a/Task/MD5/Lingo/md5-2.lingo b/Task/MD5/Lingo/md5-2.lingo new file mode 100644 index 0000000000..fe35ad7dc8 --- /dev/null +++ b/Task/MD5/Lingo/md5-2.lingo @@ -0,0 +1,282 @@ +---------------------------------------- +-- Calculates MD5 hash of string or bytearray +-- @param {bytearray|string} input +-- @return {bytearray} (16 bytes) +---------------------------------------- +on md5 (input) + if stringP(input) then input = bytearray(input) + + -- Convert string to list of little-endian words... + t_iLen = input.length * 8 + t_iCnt = (t_iLen + 64) / 512 * 16 + 16 + + -- Create list, fill with zeros... + x = [] + x.SetAt(t_iCnt, 0) + + t_fArr = [1, 256, 65536, 16777216] + i = 0 + j = 0 + repeat while i < t_iLen + j = j + 1 + t_iNext = i / 32 + 1 + t_iTemp = bitAnd(input[i/8+1], 255) * t_fArr[j] + x[t_iNext] = bitOr(x[t_iNext], t_iTemp) + i = i + 8 + j = j mod 4 + end repeat + + -- Append padding... + t_iNext = t_iLen / 32 + 1 + x[t_iNext] = bitOr(x[t_iNext], 128 * t_fArr[j + 1]) + x[(t_iLen + 64) / 512 * 16 + 15] = t_iLen + + -- Actual algorithm starts here... + + a = 1732584193 + b = -271733879 + c = -1732584194 + d = 271733878 + i = 1 + + t_iWrap = the maxInteger + 1 + t_iCount = x.count + 1 + + repeat while i < t_iCount + + olda = a + oldb = b + oldc = c + oldd = d + + -- Round(1) -- + n = bitOr(bitAnd(b, c), bitAnd(bitNot(b), d)) + a + x[i] - 680876936 + if(n < 0) then a = bitOr(n * 128, bitOr((n + t_iWrap) / 33554432, 64)) + b + else a = bitOr(n * 128, n / 33554432) + b + n = bitOr(bitAnd(a, b), bitAnd(bitNot(a), c)) + d + x[i + 1] - 389564586 + if(n < 0) then d = bitOr(n * 4096, bitOr((n + t_iWrap) / 1048576, 2048)) + a + else d = bitOr(n * 4096, n / 1048576) + a + n = bitOr(bitAnd(d, a), bitAnd(bitNot(d), b)) + c + x[i + 2] + 606105819 + if(n < 0) then c = bitOr(n * 131072, bitOr((n + t_iWrap) / 32768, 65536)) + d + else c = bitOr(n * 131072, n / 32768) + d + n = bitOr(bitAnd(c, d), bitAnd(bitNot(c), a)) + b + x[i + 3] - 1044525330 + if(n < 0) then b = bitOr(n * 4194304, bitOr((n + t_iWrap) / 1024, 2097152)) + c + else b = bitOr(n * 4194304, n / 1024) + c + n = bitOr(bitAnd(b, c), bitAnd(bitNot(b), d)) + a + x[i + 4] - 176418897 + if(n < 0) then a = bitOr(n * 128, bitOr((n + t_iWrap) / 33554432, 64)) + b + else a = bitOr(n * 128, n / 33554432) + b + n = bitOr(bitAnd(a, b), bitAnd(bitNot(a), c)) + d + x[i + 5] + 1200080426 + if(n < 0) then d = bitOr(n * 4096, bitOr((n + t_iWrap) / 1048576, 2048)) + a + else d = bitOr(n * 4096, n / 1048576) + a + n = bitOr(bitAnd(d, a), bitAnd(bitNot(d), b)) + c + x[i + 6] - 1473231341 + if(n < 0) then c = bitOr(n * 131072, bitOr((n + t_iWrap) / 32768, 65536)) + d + else c = bitOr(n * 131072, n / 32768) + d + n = bitOr(bitAnd(c, d), bitAnd(bitNot(c), a)) + b + x[i + 7] - 45705983 + if(n < 0) then b = bitOr(n * 4194304, bitOr((n + t_iWrap) / 1024, 2097152)) + c + else b = bitOr(n * 4194304, n / 1024) + c + n = bitOr(bitAnd(b, c), bitAnd(bitNot(b), d)) + a + x[i + 8] + 1770035416 + if(n < 0) then a = bitOr(n * 128, bitOr((n + t_iWrap) / 33554432, 64)) + b + else a = bitOr(n * 128, n / 33554432) + b + n = bitOr(bitAnd(a, b), bitAnd(bitNot(a), c)) + d + x[i + 9] - 1958414417 + if(n < 0) then d = bitOr(n * 4096, bitOr((n + t_iWrap) / 1048576, 2048)) + a + else d = bitOr(n * 4096, n / 1048576) + a + n = bitOr(bitAnd(d, a), bitAnd(bitNot(d), b)) + c + x[i + 10] - 42063 + if(n < 0) then c = bitOr(n * 131072, bitOr((n + t_iWrap) / 32768, 65536)) + d + else c = bitOr(n * 131072, n / 32768) + d + n = bitOr(bitAnd(c, d), bitAnd(bitNot(c), a)) + b + x[i + 11] - 1990404162 + if(n < 0) then b = bitOr(n * 4194304, bitOr((n + t_iWrap) / 1024, 2097152)) + c + else b = bitOr(n * 4194304, n / 1024) + c + n = bitOr(bitAnd(b, c), bitAnd(bitNot(b), d)) + a + x[i + 12] + 1804603682 + if(n < 0) then a = bitOr(n * 128, bitOr((n + t_iWrap) / 33554432, 64)) + b + else a = bitOr(n * 128, n / 33554432) + b + n = bitOr(bitAnd(a, b), bitAnd(bitNot(a), c)) + d + x[i + 13] - 40341101 + if(n < 0) then d = bitOr(n * 4096, bitOr((n + t_iWrap) / 1048576, 2048)) + a + else d = bitOr(n * 4096, n / 1048576) + a + n = bitOr(bitAnd(d, a), bitAnd(bitNot(d), b)) + c + x[i + 14] - 1502002290 + if(n < 0) then c = bitOr(n * 131072, bitOr((n + t_iWrap) / 32768, 65536)) + d + else c = bitOr(n * 131072, n / 32768) + d + n = bitOr(bitAnd(c, d), bitAnd(bitNot(c), a)) + b + x[i + 15] + 1236535329 + if(n < 0) then b = bitOr(n * 4194304, bitOr((n + t_iWrap) / 1024, 2097152)) + c + else b = bitOr(n * 4194304, n / 1024) + c + + -- Round(2) -- + n = bitOr(bitAnd(b, d), bitAnd(c, bitNot(d))) + a + x[i + 1] - 165796510 + if(n < 0) then a = bitOr(n * 32, bitOr((n + t_iWrap) / 134217728, 16)) + b + else a = bitOr(n * 32, n / 134217728) + b + n = bitOr(bitAnd(a, c), bitAnd(b, bitNot(c))) + d + x[i + 6] - 1069501632 + if(n < 0) then d = bitOr(n * 512, bitOr((n + t_iWrap) / 8388608, 256)) + a + else d = bitOr(n * 512, n / 8388608) + a + n = bitOr(bitAnd(d, b), bitAnd(a, bitNot(b))) + c + x[i + 11] + 643717713 + if(n < 0) then c = bitOr(n * 16384, bitOr((n + t_iWrap) / 262144, 8192)) + d + else c = bitOr(n * 16384, n / 262144) + d + n = bitOr(bitAnd(c, a), bitAnd(d, bitNot(a))) + b + x[i] - 373897302 + if(n < 0) then b = bitOr(n * 1048576, bitOr((n + t_iWrap) / 4096, 524288)) + c + else b = bitOr(n * 1048576, n / 4096) + c + n = bitOr(bitAnd(b, d), bitAnd(c, bitNot(d))) + a + x[i + 5] - 701558691 + if(n < 0) then a = bitOr(n * 32, bitOr((n + t_iWrap) / 134217728, 16)) + b + else a = bitOr(n * 32, n / 134217728) + b + n = bitOr(bitAnd(a, c), bitAnd(b, bitNot(c))) + d + x[i + 10] + 38016083 + if(n < 0) then d = bitOr(n * 512, bitOr((n + t_iWrap) / 8388608, 256)) + a + else d = bitOr(n * 512, n / 8388608) + a + n = bitOr(bitAnd(d, b), bitAnd(a, bitNot(b))) + c + x[i + 15] - 660478335 + if(n < 0) then c = bitOr(n * 16384, bitOr((n + t_iWrap) / 262144, 8192)) + d + else c = bitOr(n * 16384, n / 262144) + d + n = bitOr(bitAnd(c, a), bitAnd(d, bitNot(a))) + b + x[i + 4] - 405537848 + if(n < 0) then b = bitOr(n * 1048576, bitOr((n + t_iWrap) / 4096, 524288)) + c + else b = bitOr(n * 1048576, n / 4096) + c + n = bitOr(bitAnd(b, d), bitAnd(c, bitNot(d))) + a + x[i + 9] + 568446438 + if(n < 0) then a = bitOr(n * 32, bitOr((n + t_iWrap) / 134217728, 16)) + b + else a = bitOr(n * 32, n / 134217728) + b + n = bitOr(bitAnd(a, c), bitAnd(b, bitNot(c))) + d + x[i + 14] - 1019803690 + if(n < 0) then d = bitOr(n * 512, bitOr((n + t_iWrap) / 8388608, 256)) + a + else d = bitOr(n * 512, n / 8388608) + a + n = bitOr(bitAnd(d, b), bitAnd(a, bitNot(b))) + c + x[i + 3] - 187363961 + if(n < 0) then c = bitOr(n * 16384, bitOr((n + t_iWrap) / 262144, 8192)) + d + else c = bitOr(n * 16384, n / 262144) + d + n = bitOr(bitAnd(c, a), bitAnd(d, bitNot(a))) + b + x[i + 8] + 1163531501 + if(n < 0) then b = bitOr(n * 1048576, bitOr((n + t_iWrap) / 4096, 524288)) + c + else b = bitOr(n * 1048576, n / 4096) + c + n = bitOr(bitAnd(b, d), bitAnd(c, bitNot(d))) + a + x[i + 13] - 1444681467 + if(n < 0) then a = bitOr(n * 32, bitOr((n + t_iWrap) / 134217728, 16)) + b + else a = bitOr(n * 32, n / 134217728) + b + n = bitOr(bitAnd(a, c), bitAnd(b, bitNot(c))) + d + x[i + 2] - 51403784 + if(n < 0) then d = bitOr(n * 512, bitOr((n + t_iWrap) / 8388608, 256)) + a + else d = bitOr(n * 512, n / 8388608) + a + n = bitOr(bitAnd(d, b), bitAnd(a, bitNot(b))) + c + x[i + 7] + 1735328473 + if(n < 0) then c = bitOr(n * 16384, bitOr((n + t_iWrap) / 262144, 8192)) + d + else c = bitOr(n * 16384, n / 262144) + d + n = bitOr(bitAnd(c, a), bitAnd(d, bitNot(a))) + b + x[i + 12] - 1926607734 + if(n < 0) then b = bitOr(n * 1048576, bitOr((n + t_iWrap) / 4096, 524288)) + c + else b = bitOr(n * 1048576, n / 4096) + c + + -- Round(3) -- + n = bitXor(bitXor(b, c), d) + a + x[i + 5] - 378558 + if(n < 0) then a = bitOr(n * 16, bitOr((n + t_iWrap) / 268435456, 8)) + b + else a = bitOr(n * 16, n / 268435456) + b + n = bitXor(bitXor(a, b), c) + d + x[i + 8] - 2022574463 + if(n < 0) then d = bitOr(n * 2048, bitOr((n + t_iWrap) / 2097152, 1024)) + a + else d = bitOr(n * 2048, n / 2097152) + a + n = bitXor(bitXor(d, a), b) + c + x[i + 11] + 1839030562 + if(n < 0) then c = bitOr(n * 65536, bitOr((n + t_iWrap) / 65536, 32768)) + d + else c = bitOr(n * 65536, n / 65536) + d + n = bitXor(bitXor(c, d), a) + b + x[i + 14] - 35309556 + if(n < 0) then b = bitOr(n * 8388608, bitOr((n + t_iWrap) / 512, 4194304)) + c + else b = bitOr(n * 8388608, n / 512) + c + n = bitXor(bitXor(b, c), d) + a + x[i + 1] - 1530992060 + if(n < 0) then a = bitOr(n * 16, bitOr((n + t_iWrap) / 268435456, 8)) + b + else a = bitOr(n * 16, n / 268435456) + b + n = bitXor(bitXor(a, b), c) + d + x[i + 4] + 1272893353 + if(n < 0) then d = bitOr(n * 2048, bitOr((n + t_iWrap) / 2097152, 1024)) + a + else d = bitOr(n * 2048, n / 2097152) + a + n = bitXor(bitXor(d, a), b) + c + x[i + 7] - 155497632 + if(n < 0) then c = bitOr(n * 65536, bitOr((n + t_iWrap) / 65536, 32768)) + d + else c = bitOr(n * 65536, n / 65536) + d + n = bitXor(bitXor(c, d), a) + b + x[i + 10] - 1094730640 + if(n < 0) then b = bitOr(n * 8388608, bitOr((n + t_iWrap) / 512, 4194304)) + c + else b = bitOr(n * 8388608, n / 512) + c + n = bitXor(bitXor(b, c), d) + a + x[i + 13] + 681279174 + if(n < 0) then a = bitOr(n * 16, bitOr((n + t_iWrap) / 268435456, 8)) + b + else a = bitOr(n * 16, n / 268435456) + b + n = bitXor(bitXor(a, b), c) + d + x[i] - 358537222 + if(n < 0) then d = bitOr(n * 2048, bitOr((n + t_iWrap) / 2097152, 1024)) + a + else d = bitOr(n * 2048, n / 2097152) + a + n = bitXor(bitXor(d, a), b) + c + x[i + 3] - 722521979 + if(n < 0) then c = bitOr(n * 65536, bitOr((n + t_iWrap) / 65536, 32768)) + d + else c = bitOr(n * 65536, n / 65536) + d + n = bitXor(bitXor(c, d), a) + b + x[i + 6] + 76029189 + if(n < 0) then b = bitOr(n * 8388608, bitOr((n + t_iWrap) / 512, 4194304)) + c + else b = bitOr(n * 8388608, n / 512) + c + n = bitXor(bitXor(b, c), d) + a + x[i + 9] - 640364487 + if(n < 0) then a = bitOr(n * 16, bitOr((n + t_iWrap) / 268435456, 8)) + b + else a = bitOr(n * 16, n / 268435456) + b + n = bitXor(bitXor(a, b), c) + d + x[i + 12] - 421815835 + if(n < 0) then d = bitOr(n * 2048, bitOr((n + t_iWrap) / 2097152, 1024)) + a + else d = bitOr(n * 2048, n / 2097152) + a + n = bitXor(bitXor(d, a), b) + c + x[i + 15] + 530742520 + if(n < 0) then c = bitOr(n * 65536, bitOr((n + t_iWrap) / 65536, 32768)) + d + else c = bitOr(n * 65536, n / 65536) + d + n = bitXor(bitXor(c, d), a) + b + x[i + 2] - 995338651 + if(n < 0) then b = bitOr(n * 8388608, bitOr((n + t_iWrap) / 512, 4194304)) + c + else b = bitOr(n * 8388608, n / 512) + c + + -- Round(4) -- + n = bitXor(c, bitOr(b, bitNot(d))) + a + x[i] - 198630844 + if(n < 0) then a = bitOr(n * 64, bitOr((n + t_iWrap) / 67108864, 32)) + b + else a = bitOr(n * 64, n / 67108864) + b + n = bitXor(b, bitOr(a, bitNot(c))) + d + x[i + 7] + 1126891415 + if(n < 0) then d = bitOr(n * 1024, bitOr((n + t_iWrap) / 4194304, 512)) + a + else d = bitOr(n * 1024, n / 4194304) + a + n = bitXor(a, bitOr(d, bitNot(b))) + c + x[i + 14] - 1416354905 + if(n < 0) then c = bitOr(n * 32768, bitOr((n + t_iWrap) / 131072, 16384)) + d + else c = bitOr(n * 32768, n / 131072) + d + n = bitXor(d, bitOr(c, bitNot(a))) + b + x[i + 5] - 57434055 + if(n < 0) then b = bitOr(n * 2097152, bitOr((n + t_iWrap) / 2048, 1048576)) + c + else b = bitOr(n * 2097152, n / 2048) + c + n = bitXor(c, bitOr(b, bitNot(d))) + a + x[i + 12] + 1700485571 + if(n < 0) then a = bitOr(n * 64, bitOr((n + t_iWrap) / 67108864, 32)) + b + else a = bitOr(n * 64, n / 67108864) + b + n = bitXor(b, bitOr(a, bitNot(c))) + d + x[i + 3] - 1894986606 + if(n < 0) then d = bitOr(n * 1024, bitOr((n + t_iWrap) / 4194304, 512)) + a + else d = bitOr(n * 1024, n / 4194304) + a + n = bitXor(a, bitOr(d, bitNot(b))) + c + x[i + 10] - 1051523 + if(n < 0) then c = bitOr(n * 32768, bitOr((n + t_iWrap) / 131072, 16384)) + d + else c = bitOr(n * 32768, n / 131072) + d + n = bitXor(d, bitOr(c, bitNot(a))) + b + x[i + 1] - 2054922799 + if(n < 0) then b = bitOr(n * 2097152, bitOr((n + t_iWrap) / 2048, 1048576)) + c + else b = bitOr(n * 2097152, n / 2048) + c + n = bitXor(c, bitOr(b, bitNot(d))) + a + x[i + 8] + 1873313359 + if(n < 0) then a = bitOr(n * 64, bitOr((n + t_iWrap) / 67108864, 32)) + b + else a = bitOr(n * 64, n / 67108864) + b + n = bitXor(b, bitOr(a, bitNot(c))) + d + x[i + 15] - 30611744 + if(n < 0) then d = bitOr(n * 1024, bitOr((n + t_iWrap) / 4194304, 512)) + a + else d = bitOr(n * 1024, n / 4194304) + a + n = bitXor(a, bitOr(d, bitNot(b))) + c + x[i + 6] - 1560198380 + if(n < 0) then c = bitOr(n * 32768, bitOr((n + t_iWrap) / 131072, 16384)) + d + else c = bitOr(n * 32768, n / 131072) + d + n = bitXor(d, bitOr(c, bitNot(a))) + b + x[i + 13] + 1309151649 + if(n < 0) then b = bitOr(n * 2097152, bitOr((n + t_iWrap) / 2048, 1048576)) + c + else b = bitOr(n * 2097152, n / 2048) + c + n = bitXor(c, bitOr(b, bitNot(d))) + a + x[i + 4] - 145523070 + if(n < 0) then a = bitOr(n * 64, bitOr((n + t_iWrap) / 67108864, 32)) + b + else a = bitOr(n * 64, n / 67108864) + b + n = bitXor(b, bitOr(a, bitNot(c))) + d + x[i + 11] - 1120210379 + if(n < 0) then d = bitOr(n * 1024, bitOr((n + t_iWrap) / 4194304, 512)) + a + else d = bitOr(n * 1024, n / 4194304) + a + n = bitXor(a, bitOr(d, bitNot(b))) + c + x[i + 2] + 718787259 + if(n < 0) then c = bitOr(n * 32768, bitOr((n + t_iWrap) / 131072, 16384)) + d + else c = bitOr(n * 32768, n / 131072) + d + n = bitXor(d, bitOr(c, bitNot(a))) + b + x[i + 9] - 343485551 + if(n < 0) then b = bitOr(n * 2097152, bitOr((n + t_iWrap) / 2048, 1048576)) + c + else b = bitOr(n * 2097152, n / 2048) + c + + a = a + olda + b = b + oldb + c = c + oldc + d = d + oldd + i = i + 16 + + end repeat + + t_iArr = [a, b, c, d] + + ba = bytearray() + p = 1 + repeat with i in t_iArr + if(i > 0) then + repeat with n = 1 to 4 + ba[p] = (i mod 256) + i = i / 256 + p = p+1 + end repeat + else + i = bitNot(i) + repeat with n = 1 to 4 + ba[p] = 255-(i mod 256) + i = i / 256 + p = p+1 + end repeat + end if + end repeat + ba.position = 1 + return ba +end diff --git a/Task/MD5/LiveCode/md5-1.livecode b/Task/MD5/LiveCode/md5-1.livecode new file mode 100644 index 0000000000..e8dac93619 --- /dev/null +++ b/Task/MD5/LiveCode/md5-1.livecode @@ -0,0 +1,6 @@ +function md5sum hashtext + local md5, mdhex + put md5Digest(hashtext) into md5 + get binaryDecode("H*",md5,mdhex) + return mdhex +end md5sum diff --git a/Task/MD5/LiveCode/md5-2.livecode b/Task/MD5/LiveCode/md5-2.livecode new file mode 100644 index 0000000000..593e1c93cd --- /dev/null +++ b/Task/MD5/LiveCode/md5-2.livecode @@ -0,0 +1,24 @@ +command md5testsuite + // rfc1321 MD5 test suite: + local md5 + put md5sum("") is "d41d8cd98f00b204e9800998ecf8427e" into md5["empty"] + put md5sum("a") is "0cc175b9c0f1b6a831c399e269772661" into md5["a"] + put md5sum("abc") is "900150983cd24fb0d6963f7d28e17f72" into md5["abc"] + put md5sum("message digest") is "f96b697d7cb7938d525a2f31aaf161d0" into md5["message digest"] + put md5sum("abcdefghijklmnopqrstuvwxyz") is "c3fcd3d76192e4007dfb496cca67e13b" \ + into md5["abclower"] + put md5sum("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") \ + is "d174ab98d277d9f5a5611c2c9f419d9f" into md5["abcupper"] + put md5sum("12345678901234567890123456789012345678901234567890123456789012345678901234567890")\ + is "57edf4a22be3c955ac49da2e2107b67a" into md5["123"] + + repeat for each line n in the keys of md5 + if md5[n] is not true then + put "err" & tab & n & return after results + exit repeat + else + put "ok" & tab & n & return after results + end if + end repeat + put results +end md5testsuite diff --git a/Task/MD5/Nim/md5.nim b/Task/MD5/Nim/md5.nim new file mode 100644 index 0000000000..891b104bba --- /dev/null +++ b/Task/MD5/Nim/md5.nim @@ -0,0 +1,3 @@ +import md5 + +echo toMD5("The quick brown fox jumped over the lazy dog's back") diff --git a/Task/MD5/Ring/md5.ring b/Task/MD5/Ring/md5.ring new file mode 100644 index 0000000000..ccd93aeb5b --- /dev/null +++ b/Task/MD5/Ring/md5.ring @@ -0,0 +1,2 @@ +See MD5("my string!") + nl +# output : a83a049fbe50cf7334caa86bf16a3520 diff --git a/Task/MD5/Sidef/md5-1.sidef b/Task/MD5/Sidef/md5-1.sidef new file mode 100644 index 0000000000..1be2410a7a --- /dev/null +++ b/Task/MD5/Sidef/md5-1.sidef @@ -0,0 +1,2 @@ +var digest = frequire('Digest::MD5'); +say digest.md5_hex("The quick brown fox jumped over the lazy dog's back"); diff --git a/Task/MD5/Sidef/md5-2.sidef b/Task/MD5/Sidef/md5-2.sidef new file mode 100644 index 0000000000..9025dbd3fb --- /dev/null +++ b/Task/MD5/Sidef/md5-2.sidef @@ -0,0 +1,3 @@ +var md5 = require('Digest::MD5').new; +md5.add("The quick brown fox jumped over the lazy dog's back"); +say md5.hexdigest; diff --git a/Task/Machine-code/Nim/machine-code.nim b/Task/Machine-code/Nim/machine-code.nim new file mode 100644 index 0000000000..d1e2602bc6 --- /dev/null +++ b/Task/Machine-code/Nim/machine-code.nim @@ -0,0 +1,29 @@ +import posix + +when defined(macosx) or defined(bsd): + const MAP_ANONYMOUS = 0x1000 +elif defined(solaris): + const MAP_ANONYMOUS = 0x100 +else: + var + MAP_ANONYMOUS {.importc: "MAP_ANONYMOUS", header: "".}: cint + +proc test(a, b: cint): cint = + # mov EAX, [ESP+4] + # add EAX, [ESP+8] + var code = [0x8B'u8, 0x44, 0x24, 0x4, 0x3, 0x44, 0x24, 0x8, 0xC3] + + # create executable buffer + var buf = mmap(nil, sizeof(code), PROT_READ or PROT_WRITE or PROT_EXEC, + MAP_PRIVATE or MAP_ANONYMOUS, -1, 0) + + # copy code to buffer + copyMem(addr buf, addr code[0], sizeof(code)) + + # run code + {.emit: "`result` = ((int (*) (int, int))&`buf`)(`a`,`b`);".} + + # free buffer + discard munmap(buf, sizeof(code)) + +echo test(7, 12) diff --git a/Task/Machine-code/Phix/machine-code-1.phix b/Task/Machine-code/Phix/machine-code-1.phix new file mode 100644 index 0000000000..4ba9c34dcd --- /dev/null +++ b/Task/Machine-code/Phix/machine-code-1.phix @@ -0,0 +1,5 @@ +atom mem = allocate(9) +poke(mem,{#8B,#44,#24,#04,#03,#44,#24,#08,#C3}) +constant mfunc = define_c_func({},mem,{C_INT,C_INT},C_INT) +?c_func(mfunc,{12,7}) +free(mem) diff --git a/Task/Machine-code/Phix/machine-code-2.phix b/Task/Machine-code/Phix/machine-code-2.phix new file mode 100644 index 0000000000..82ac19f8a7 --- /dev/null +++ b/Task/Machine-code/Phix/machine-code-2.phix @@ -0,0 +1,12 @@ +atom mem = allocate(9) +poke(mem,{#8B,#44,#24,#04,#03,#44,#24,#08,#C3}) +integer res +#ilASM{ mov eax,[mem] + call :%pLoadMint -- (in case mem>#3FFFFFFF) + push 12 + push 7 + call eax + add esp,8 + mov [res],eax } +?res +free(mem) diff --git a/Task/Mad-Libs/Nim/mad-libs.nim b/Task/Mad-Libs/Nim/mad-libs.nim new file mode 100644 index 0000000000..a37f4edec2 --- /dev/null +++ b/Task/Mad-Libs/Nim/mad-libs.nim @@ -0,0 +1,16 @@ +import rdstdin, re, algorithm, sequtils, strutils + +#let templ = readLineFromStdin "Enter your story: " +const templ = """ went for a walk in the park. +found a . decided to take it home.""" + +echo "The story template is:\n", templ +var fields = templ.findAll re"<[^>]+>" +fields.sort(cmp) +fields = deduplicate fields +let values = readLineFromStdin("\nInput a comma-separated list of words to replace the following items\n " & fields.join(",") & ": ").split(",") + +var story = templ +for f,v in zip(fields, values).items: + story = story.replace(f, v) +echo "\nThe story becomes:\n\n", story diff --git a/Task/Mad-Libs/Oforth/mad-libs.oforth b/Task/Mad-Libs/Oforth/mad-libs.oforth new file mode 100644 index 0000000000..1549e532b4 --- /dev/null +++ b/Task/Mad-Libs/Oforth/mad-libs.oforth @@ -0,0 +1,11 @@ +: madlibs +| story i word | + + "" while(System.Console askln dup notEmpty) [ + ] drop ->story + + while(story indexOf('<') dup ->i notNull) [ + story extract(i, story indexOfFrom('>', i)) ->word + story replaceAll(word, "Word for" . word . System.Console askln) ->story + ] + + "Your story :" . story println ; diff --git a/Task/Mad-Libs/Ring/mad-libs.ring b/Task/Mad-Libs/Ring/mad-libs.ring new file mode 100644 index 0000000000..afd996341b --- /dev/null +++ b/Task/Mad-Libs/Ring/mad-libs.ring @@ -0,0 +1,13 @@ +temp=" went for a walk in the park. found a . decided to take it home." +k = substr(temp,"<") +while k + replace = substr(temp,k,substr(temp,">")-k + 1) + see "replace:" + replace + " with: " + give with + while k + temp = left(temp,k-1) + with + substr(temp,k + len(replace)) + k = substr(temp,replace) + end + k = substr(temp,"<") +end +see temp + nl diff --git a/Task/Mad-Libs/Sidef/mad-libs.sidef b/Task/Mad-Libs/Sidef/mad-libs.sidef new file mode 100644 index 0000000000..b17bb20f85 --- /dev/null +++ b/Task/Mad-Libs/Sidef/mad-libs.sidef @@ -0,0 +1,13 @@ +var story = ARGF.slurp; + +var blanks = Hash.new; +while (var m = /<(.*?)>/.gmatch(story)) { + blanks.append(m[0]); +} + +blanks.keys.sort.each { |blank| + var replacement = Sys.scanln("#{blank}: "); + blanks{blank} = replacement; +} + +print story.gsub(/<(.*?)>/, {|s1| blanks{s1} }); diff --git a/Task/Magic-squares-of-odd-order/ERRE/magic-squares-of-odd-order.erre b/Task/Magic-squares-of-odd-order/ERRE/magic-squares-of-odd-order.erre new file mode 100644 index 0000000000..86b02062e1 --- /dev/null +++ b/Task/Magic-squares-of-odd-order/ERRE/magic-squares-of-odd-order.erre @@ -0,0 +1,93 @@ +PROGRAM MAGIC_SQUARE + +!$INTEGER + +PROCEDURE Magicsq(size,filename$) + +LOCAL DIM sq[25,25] ! array to hold square + +IF (size AND 1)=0 OR size<3 THEN + PRINT PRINT(CHR$(7)) ! beep + PRINT("error: size is not odd or size is smaller then 3") + PAUSE(3) + EXIT PROCEDURE +END IF + +! filename$ <> "" then save magic square in a file +! filename$ can contain directory name +! if filename$ exist it will be overwriten, no error checking + +! start in the middle of the first row + nr=1 x=size-(size DIV 2) y=1 + max=size*size + +! create format string for using + frmt$=STRING$(LEN(STR$(max)),"#") + +! main loop for creating magic square + REPEAT + IF sq[x,y]=0 THEN + sq[x,y]=nr + IF nr MOD size=0 THEN + y=y+1 + ELSE + x=x+1 + y=y-1 + END IF + nr=nr+1 + END IF + IF x>size THEN + x=1 + WHILE sq[x,y]<>0 DO + x=x+1 + END WHILE + END IF + IF y<1 THEN + y=size + WHILE sq[x,y]<>0 DO + y=y-1 + END WHILE + END IF + UNTIL nr>max + +! printing square's bigger than 19 result in a wrapping of the line + PRINT("Odd magic square size:";size;"*";size) + PRINT("The magic sum =";((max+1) DIV 2)*size) + PRINT + + FOR y=1 TO size DO + FOR x=1 TO size DO + WRITE(frmt$;sq[x,y];) + END FOR + PRINT + END FOR + + ! output magic square to a file with the name provided + IF filename$<>"" THEN + OPEN("O",1,filename$) + PRINT(#1,"Odd magic square size:";size;" *";size) + PRINT(#1,"The magic sum =";((max+1) DIV 2)*size) + PRINT(#1,) + + FOR y=1 TO size DO + FOR x=1 TO size DO + WRITE(#1,frmt$;sq[x,y];) + END FOR + PRINT(#1,) + END FOR + END IF + CLOSE(1) + +END PROCEDURE + +BEGIN +PRINT(CHR$(12);) ! CLS +Magicsq(5,"") +Magicsq(11,"") +!---------------------------------------------------- +! the next line will also print the square to a file +! called 'magic_square_19txt' +!---------------------------------------------------- +Magicsq(19,"msq_19.txt") + +END PROGRAM diff --git a/Task/Magic-squares-of-odd-order/EchoLisp/magic-squares-of-odd-order.echolisp b/Task/Magic-squares-of-odd-order/EchoLisp/magic-squares-of-odd-order.echolisp new file mode 100644 index 0000000000..84b1fcda8a --- /dev/null +++ b/Task/Magic-squares-of-odd-order/EchoLisp/magic-squares-of-odd-order.echolisp @@ -0,0 +1,31 @@ +(lib 'matrix) + +;; compute next i,j = f(move,i,j) +(define-syntax-rule (path imove jmove) +(begin (set! i (imove i n)) (set! j (jmove j n)))) + +;; We define the ordinary and break moves +;; (1 , -1), (0, 1) King's move +(define (inext i n) (modulo (1+ i) n)) +(define (jnext j n) (modulo (1- j) n)) +(define (ibreak i n) i) +(define (jbreak j n) (modulo (1+ j) n)) + +(define (make-ms n) + (define n2+1 (1+ (* n n))) + (define ms (make-array n n)) + (define i (quotient n 2)) + (define j 0) + (array-set! ms i j 1) + + (for ((ns (in-range 2 n2+1))) + (if (zero? (array-ref ms (inext i n ) (jnext j n ))) + (path inext jnext) ;; ordinary move if empty target + (path ibreak jbreak)) ;; else break move + + (if (zero? (array-ref ms i j)) + (array-set! ms i j ns) + (error ns "illegal path")) + ) + (writeln 'order n 'magic-number (/ ( * n n2+1) 2)) + (array-print ms)) diff --git a/Task/Magic-squares-of-odd-order/FreeBASIC/magic-squares-of-odd-order.freebasic b/Task/Magic-squares-of-odd-order/FreeBASIC/magic-squares-of-odd-order.freebasic new file mode 100644 index 0000000000..3aca1196fe --- /dev/null +++ b/Task/Magic-squares-of-odd-order/FreeBASIC/magic-squares-of-odd-order.freebasic @@ -0,0 +1,94 @@ +' version 23-06-2015 +' compile with: fbc -s console + +Sub magicsq(size As Integer, filename As String ="") + + If (size And 1) = 0 Or size < 3 Then + Print : Beep ' alert + Print "error: size is not odd or size is smaller then 3" + Sleep 3000,1 'wait 3 seconds, ignore key press + Exit Sub + End If + + ' filename <> "" then save magic square in a file + ' filename can contain directory name + ' if filename exist it will be overwriten, no error checking + + Dim As Integer sq(size,size) ' array to hold square + ' start in the middle of the first row + Dim As Integer nr = 1, x = size - (size \ 2), y = 1 + Dim As Integer max = size * size + ' create format string for using + Dim As String frmt = String(Len(Str(max)) +1, "#") + + ' main loop for creating magic square + Do + If sq(x, y) = 0 Then + sq(x, y) = nr + If nr Mod size = 0 Then + y += 1 + Else + x += 1 + y -= 1 + End If + nr += 1 + End If + If x > size Then + x = 1 + Do While sq(x,y) <> 0 + x += 1 + Loop + End If + If y < 1 Then + y = size + Do While sq(x,y) <> 0 + y -= 1 + Loop + EndIf + Loop Until nr > max + + ' printing square's bigger than 19 result in a wrapping of the line + Print "Odd magic square size:"; size; " *"; size + Print "The magic sum ="; ((max +1) \ 2) * size + Print + + For y = 1 To size + For x = 1 To size + Print Using frmt; sq(x,y); + Next + Print + Next + print + + ' output magic square to a file with the name provided + If filename <> "" Then + nr = FreeFile + Open filename For Output As #nr + Print #nr, "Odd magic square size:"; size; " *"; size + Print #nr, "The magic sum ="; ((max +1) \ 2) * size + Print #nr, + + For y = 1 To size + For x = 1 To size + Print #nr, Using frmt; sq(x,y); + Next + Print #nr, + Next + End If + Close + +End Sub + +' ------=< MAIN >=------ + +magicsq(5) +magicsq(11) +' the next line will also print the square to a file called: magic_square_19.txt +magicsq(19, "magic_square_19.txt") + + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Magic-squares-of-odd-order/Nim/magic-squares-of-odd-order.nim b/Task/Magic-squares-of-odd-order/Nim/magic-squares-of-odd-order.nim new file mode 100644 index 0000000000..2dc5edd005 --- /dev/null +++ b/Task/Magic-squares-of-odd-order/Nim/magic-squares-of-odd-order.nim @@ -0,0 +1,24 @@ +import strutils + +proc `^`*(base: int, exp: int): int = + var (base, exp) = (base, exp) + result = 1 + + while exp != 0: + if (exp and 1) != 0: + result *= base + exp = exp shr 1 + base *= base + +proc magic(n) = + for row in 1 .. n: + for col in 1 .. n: + let cell = (n * ((row + col - 1 + n div 2) mod n) + + ((row + 2 * col - 2) mod n) + 1) + stdout.write align($cell, len($(n^2)))," " + echo "" + echo "\nAll sum to magic number ", ((n * n + 1) * n div 2) + +for n in [5, 3, 7]: + echo "\nOrder ",n,"\n=======" + magic(n) diff --git a/Task/Magic-squares-of-odd-order/Oforth/magic-squares-of-odd-order.oforth b/Task/Magic-squares-of-odd-order/Oforth/magic-squares-of-odd-order.oforth new file mode 100644 index 0000000000..7369b46520 --- /dev/null +++ b/Task/Magic-squares-of-odd-order/Oforth/magic-squares-of-odd-order.oforth @@ -0,0 +1,12 @@ +: magicSquare(n) +| i j wd | + n sq log asInteger 1+ ->wd + n loop: i [ + n loop: j [ + i j + 1- n 2 / + n mod n * + i j + j + 2 - n mod 1 + + + System.Out swap < typeof(k) + b = ->() { k -= 1; a(k, b, x1, x2, x3, x4) } + k <= 0 ? x4.call + x5.call : b.call +end + +puts a(10, -> {1}, -> {-1}, -> {-1}, -> {1}, -> {0}) diff --git a/Task/Man-or-boy-test/EchoLisp/man-or-boy-test.echolisp b/Task/Man-or-boy-test/EchoLisp/man-or-boy-test.echolisp new file mode 100644 index 0000000000..10d7aa0949 --- /dev/null +++ b/Task/Man-or-boy-test/EchoLisp/man-or-boy-test.echolisp @@ -0,0 +1,16 @@ +;; copied from Scheme +(define (A k x1 x2 x3 x4 x5) + (define (B) + (set! k (- k 1)) + (A k B x1 x2 x3 x4)) + (if (<= k 0) + (+ (x4) (x5)) + (B))) + +(A 10 (lambda () 1) (lambda () -1) (lambda () -1) (lambda () 1) (lambda () 0)) + → -67 +(A 13 (lambda () 1) (lambda () -1) (lambda () -1) (lambda () 1) (lambda () 0)) + → -642 +(A 14 ..) +❗ InternalError : too much recursion - JS internal error (please, report it)- + → stack overflow using FireFox diff --git a/Task/Man-or-boy-test/Nim/man-or-boy-test.nim b/Task/Man-or-boy-test/Nim/man-or-boy-test.nim new file mode 100644 index 0000000000..a680025658 --- /dev/null +++ b/Task/Man-or-boy-test/Nim/man-or-boy-test.nim @@ -0,0 +1,11 @@ +import future + +proc a(k: int; x1, x2, x3, x4, x5: proc(): int): int = + var k = k + proc b(): int = + dec k + a(k, b, x1, x2, x3, x4) + if k <= 0: x4() + x5() + else: b() + +echo a(10, () => 1, () => -1, () => -1, () => 1, () => 0) diff --git a/Task/Man-or-boy-test/Sidef/man-or-boy-test-1.sidef b/Task/Man-or-boy-test/Sidef/man-or-boy-test-1.sidef new file mode 100644 index 0000000000..0b799fe142 --- /dev/null +++ b/Task/Man-or-boy-test/Sidef/man-or-boy-test-1.sidef @@ -0,0 +1,5 @@ +func a(k, x1, x2, x3, x4, x5) { + func b { a(--k, b, x1, x2, x3, x4) }; + k <= 0 ? (x4() + x5()) : b(); +} +say a(10, ->{1}, ->{-1}, ->{-1}, ->{1}, ->{0}); #=> -67 diff --git a/Task/Man-or-boy-test/Sidef/man-or-boy-test-2.sidef b/Task/Man-or-boy-test/Sidef/man-or-boy-test-2.sidef new file mode 100644 index 0000000000..414c222bea --- /dev/null +++ b/Task/Man-or-boy-test/Sidef/man-or-boy-test-2.sidef @@ -0,0 +1,5 @@ +func a(k, x1, x2, x3, x4, x5) { + k <= 0 ? (x4() + x5()) + : func b { a(--k, b, x1, x2, x3, x4) }(); +} +say a(10, ->{1}, ->{-1}, ->{-1}, ->{1}, ->{0}); #=> -67 diff --git a/Task/Man-or-boy-test/Sidef/man-or-boy-test-3.sidef b/Task/Man-or-boy-test/Sidef/man-or-boy-test-3.sidef new file mode 100644 index 0000000000..00ca4853b0 --- /dev/null +++ b/Task/Man-or-boy-test/Sidef/man-or-boy-test-3.sidef @@ -0,0 +1,9 @@ +class MOB { + method a(k, x1, x2, x3, x4, x5) { + func b { self.a(--k, b, x1, x2, x3, x4) }; + k <= 0 ? (x4() + x5()) : b(); + } +} + +var obj = MOB(); +say obj.a(10, ->{1}, ->{-1}, ->{-1}, ->{1}, ->{0}); diff --git a/Task/Man-or-boy-test/Sparkling/man-or-boy-test.sparkling b/Task/Man-or-boy-test/Sparkling/man-or-boy-test.sparkling new file mode 100644 index 0000000000..2c3c304ca0 --- /dev/null +++ b/Task/Man-or-boy-test/Sparkling/man-or-boy-test.sparkling @@ -0,0 +1,16 @@ +function a(k, x1, x2, x3, x4, x5) { + let kk = { "k": k.k }; + let b = function b() { + kk.k--; + return a(kk, b, x1, x2, x3, x4); + }; + return kk.k <= 0 ? x4() + x5() : b(); +} + +function x(n) { + return function () { + return n; + }; +} + +print(a({ "k": 10 }, x(1), x(-1), x(-1), x(1), x(0))); diff --git a/Task/Man-or-boy-test/Swift/man-or-boy-test-1.swift b/Task/Man-or-boy-test/Swift/man-or-boy-test-1.swift new file mode 100644 index 0000000000..3b524dc0df --- /dev/null +++ b/Task/Man-or-boy-test/Swift/man-or-boy-test-1.swift @@ -0,0 +1,14 @@ +func A(k: Int, _ x1: () -> Int, _ x2: () -> Int, _ x3: () -> Int, _ x4: () -> Int, _ x5: () -> Int) -> Int { + var k1 = k + func B() -> Int { + k1-=1 + return A(k1, B, x1, x2, x3, x4) + } + if k1 <= 0 { + return x4() + x5() + } else { + return B() + } +} + +print(A(10, {1}, {-1}, {-1}, {1}, {0})) diff --git a/Task/Man-or-boy-test/Swift/man-or-boy-test-2.swift b/Task/Man-or-boy-test/Swift/man-or-boy-test-2.swift new file mode 100644 index 0000000000..89aabe3c7e --- /dev/null +++ b/Task/Man-or-boy-test/Swift/man-or-boy-test-2.swift @@ -0,0 +1,14 @@ +func A(var k: Int, x1: () -> Int, x2: () -> Int, x3: () -> Int, x4: () -> Int, x5: () -> Int) -> Int { + var B: (() -> Int)! + B = { + k-- + return A(k, B, x1, x2, x3, x4) + } + if k <= 0 { + return x4() + x5() + } else { + return B() + } +} + +println(A(10, {1}, {-1}, {-1}, {1}, {0})) diff --git a/Task/Mandelbrot-set/ERRE/mandelbrot-set.erre b/Task/Mandelbrot-set/ERRE/mandelbrot-set.erre new file mode 100644 index 0000000000..6e3eccfdc1 --- /dev/null +++ b/Task/Mandelbrot-set/ERRE/mandelbrot-set.erre @@ -0,0 +1,36 @@ +PROGRAM MANDELBROT + +!$KEY +!$INCLUDE="PC.LIB" + +BEGIN + +SCREEN(7) +GR_WINDOW(-2,1.5,2,-1.5) +FOR X0=-2 TO 2 STEP 0.01 DO + FOR Y0=-1.5 TO 1.5 STEP 0.01 DO + X=0 + Y=0 + + ITERATION=0 + MAX_ITERATION=223 + + WHILE (X*X+Y*Y<=(2*2) AND ITERATIONMAX_ITERATION THEN + C=ITERATION + ELSE + C=0 + END IF + + PSET(X0,Y0,C) + END FOR +END FOR +END PROGRAM diff --git a/Task/Mandelbrot-set/EchoLisp/mandelbrot-set.echolisp b/Task/Mandelbrot-set/EchoLisp/mandelbrot-set.echolisp new file mode 100644 index 0000000000..a5813bc07e --- /dev/null +++ b/Task/Mandelbrot-set/EchoLisp/mandelbrot-set.echolisp @@ -0,0 +1,11 @@ +(lib 'math) ;; fractal function +(lib 'plot) + +;; (fractal z zc n) iterates z := z^2 + c, n times +;; 100 iterations +(define (mset z) (if (= Infinity (fractal 0 z 100)) Infinity z)) + +;; plot function argument inside square (-2 -2), (2,2) +(plot-z-arg mset -2 -2) + +;; result here [http://www.echolalie.org/echolisp/help.html#fractal] diff --git a/Task/Mandelbrot-set/Futhark/mandelbrot-set.futhark b/Task/Mandelbrot-set/Futhark/mandelbrot-set.futhark new file mode 100644 index 0000000000..91ef19856a --- /dev/null +++ b/Task/Mandelbrot-set/Futhark/mandelbrot-set.futhark @@ -0,0 +1,40 @@ +default(f32) + +type complex = (f32, f32) + +fun dot(c: complex): f32 = + let (r, i) = c + in r * r + i * i + +fun multComplex(x: complex, y: complex): complex = + let (a, b) = x + let (c, d) = y + in (a*c - b * d, + a*d + b * c) + +fun addComplex(x: complex, y: complex): complex = + let (a, b) = x + let (c, d) = y + in (a + c, + b + d) + +fun divergence(depth: int, c0: complex): int = + loop ((c, i) = (c0, 0)) = while i < depth && dot(c) < 4.0 do + (addComplex(c0, multComplex(c, c)), + i + 1) + in i + +fun mandelbrot(screenX: int, screenY: int, depth: int, view: (f32,f32,f32,f32)): [screenX][screenY]int = + let (xmin, ymin, xmax, ymax) = view + let sizex = xmax - xmin + let sizey = ymax - ymin + in map (fn (x: int): [screenY]int => + map (fn (y: int): int => + let c0 = (xmin + (f32(x) * sizex) / f32(screenX), + ymin + (f32(y) * sizey) / f32(screenY)) + in divergence(depth, c0)) + (iota screenY)) + (iota screenX) + +fun main(screenX: int, screenY: int, depth: int, xmin: f32, ymin: f32, xmax: f32, ymax: f32): [screenX][screenY]int = + mandelbrot(screenX, screenY, depth, (xmin, ymin, xmax, ymax)) diff --git a/Task/Mandelbrot-set/GLSL/mandelbrot-set.glsl b/Task/Mandelbrot-set/GLSL/mandelbrot-set.glsl new file mode 100644 index 0000000000..6d32d5016f --- /dev/null +++ b/Task/Mandelbrot-set/GLSL/mandelbrot-set.glsl @@ -0,0 +1,32 @@ +void main(void) +{ + vec2 uv = gl_FragCoord.xy / iResolution.xy; + float scale = iResolution.y / iResolution.x; + uv=((uv-0.5)*5.5); + uv.y*=scale; + uv.y+=0.0; + uv.x-=0.5; + + + vec2 z = vec2(0.0, 0.0); + vec3 c = vec3(0.0, 0.0, 0.0); + float v; + + for(int i=0;(i<170);i++) + { + + if(((z.x*z.x+z.y*z.y) >= 4.0)) break; + z = vec2(z.x*z.x - z.y*z.y, 2.0*z.y*z.x) + uv; + + + if((z.x*z.x+z.y*z.y) >= 2.0) + { + c.b=float(i)/20.0; + c.r=sin((float(i)/5.0)); + } + + } + + + gl_FragColor = vec4(c,1.0); +} diff --git a/Task/Mandelbrot-set/Lasso/mandelbrot-set.lasso b/Task/Mandelbrot-set/Lasso/mandelbrot-set.lasso new file mode 100644 index 0000000000..f9dcd32cee --- /dev/null +++ b/Task/Mandelbrot-set/Lasso/mandelbrot-set.lasso @@ -0,0 +1,51 @@ +define mandelbrotBailout => 16 +define mandelbrotMaxIterations => 1000 + +define mandelbrotIterate(x, y) => { + local(cr = #y - 0.5, + ci = #x, + zi = 0.0, + zr = 0.0, + i = 0, + temp, zr2, zi2) + + { + ++#i; + #temp = #zr * #zi + #zr2 = #zr * #zr + #zi2 = #zi * #zi + + #zi2 + #zr2 > mandelbrotBailout? + return #i + #i > mandelbrotMaxIterations? + return 0 + + #zr = #zr2 - #zi2 + #cr + #zi = #temp + #temp + #ci + + currentCapture->restart + }() +} + +define mandelbrotTest() => { + local(x, y = -39.0) + { + stdout('\n') + #x = -39.0 + { + mandelbrotIterate(#x / 40.0, #y / 40.0) == 0? + stdout('*') + | stdout(' '); + ++#x + #x <= 39.0? + currentCapture->restart + }(); + ++#y + + #y <= 39.0? + currentCapture->restart + }() + stdout('\n') +} + +mandelbrotTest diff --git a/Task/Mandelbrot-set/Nim/mandelbrot-set.nim b/Task/Mandelbrot-set/Nim/mandelbrot-set.nim new file mode 100644 index 0000000000..2a86b231cc --- /dev/null +++ b/Task/Mandelbrot-set/Nim/mandelbrot-set.nim @@ -0,0 +1,20 @@ +import complex + +proc mandelbrot(a): Complex = + for i in 0 .. <50: + result = result * result + a + +iterator stepIt(start, step, iterations) = + for i in 0 .. iterations: + yield start + float(i) * step + +var rows = "" +for y in stepIt(1.0, -0.05, 41): + for x in stepIt(-2.0, 0.0315, 80): + if abs(mandelbrot((x,y))) < 2: + rows.add('*') + else: + rows.add(' ') + rows.add("\n") + +echo rows diff --git a/Task/Mandelbrot-set/Phix/mandelbrot-set-1.phix b/Task/Mandelbrot-set/Phix/mandelbrot-set-1.phix new file mode 100644 index 0000000000..90dc62b8c8 --- /dev/null +++ b/Task/Mandelbrot-set/Phix/mandelbrot-set-1.phix @@ -0,0 +1,25 @@ +-- +-- Mandlebrot set in ascii art demo. +-- +constant b=" .:,;!/>)|&IH%*#" +atom r, i, c, C, z, Z, t, k + for y=30 to 0 by -1 do + C = y*0.1-1.5 + puts(1,'\n') + for x=0 to 74 do + c = x*0.04-2 + z = 0 + Z = 0 + r = c + i = C + k = 0 + while k<112 do + t = z*z-Z*Z+r + Z = 2*z*Z+i + z = t + if z*z+Z*Z>10 then exit end if + k += 1 + end while + puts(1,b[remainder(k,16)+1]) + end for + end for diff --git a/Task/Mandelbrot-set/Phix/mandelbrot-set-2.phix b/Task/Mandelbrot-set/Phix/mandelbrot-set-2.phix new file mode 100644 index 0000000000..e72e69297a --- /dev/null +++ b/Task/Mandelbrot-set/Phix/mandelbrot-set-2.phix @@ -0,0 +1,241 @@ +include arwen.ew +include ..\arwen\dib256.ew + +constant HelpText = "Left-click drag with the mouse to move the image.\n"& + " (the image is currently only redrawn on mouseup).\n"& + "Right-click-drag with the mouse to select a region to zoom in to.\n"& + "Use the mousewheel to zoom in and out (nb: can be slow).\n"& + "Press F2 to select iterations, higher==more detail but slower.\n"& + "Resize the window as you please, but note that going fullscreen, \n"& + "especially at high iteration, may mean a quite long draw time.\n"& + "Press Escape to close the window." + +procedure Help() + void = messageBox("Mandelbrot Set",HelpText,MB_OK) +end procedure + +integer cWidth = 520 -- client area width +integer cHeight = 480 -- client area height + +constant Main = create(Window, "Mandelbrot Set", 0, 0, 50, 50, cWidth+16, cHeight+38, 0), + mainHwnd = getHwnd(Main), + mainDC = getPrivateDC(Main), + + mIter = create(Menu, "", 0, 0, 0,0,0,0,0), + iterHwnd = getHwnd(mIter), + mIter50 = create(MenuItem,"50 (fast, low detail)", 0, mIter, 0,0,0,0,0), + mIter100 = create(MenuItem,"100 (default)", 0, mIter, 0,0,0,0,0), + mIter500 = create(MenuItem,"500", 0, mIter, 0,0,0,0,0), + mIter1000 = create(MenuItem,"1000 (slow, high detail)",0, mIter, 0,0,0,0,0), + m50to1000 = {mIter50,mIter100,mIter500,mIter1000}, + i50to1000 = { 50, 100, 500, 1000} + +integer mainDib = 0 + +constant whitePen = c_func(xCreatePen, {0,1,BrightWhite}) +constant NULL_BRUSH = 5, + NullBrushID = c_func(xGetStockObject,{NULL_BRUSH}) + +atom t0 +integer iter +atom x0, y0 -- top-left coords to draw +atom scale -- controls width/zoom + +procedure init() + x0 = -2 + y0 = -1.25 + scale = 2.5/cHeight + iter = 100 + void = c_func(xSelectObject,{mainDC,whitePen}) + void = c_func(xSelectObject,{mainDC,NullBrushID}) +end procedure +init() + +function in_set(atom x, atom y) +atom u,t + if x>-0.75 then + u = x-0.25 + t = u*u+y*y + return ((2*t+u)*(2*t+u)>t) + else + return ((x+1)*(x+1)+y*y)>0.0625 + end if +end function + +function pixel_colour(atom x0, atom y0, integer iter) +integer count = 1 +atom x = 0, y = 0 + while (count<=iter) and (x*x+y*y<4) do + count += 1 + {x,y} = {x*x-y*y+x0,2*x*y+y0} + end while + if count<=iter then return count end if + return 0 +end function + +procedure mandel(atom x0, atom y0, atom scale) +atom x,y +integer c + t0 = time() + y = y0 + for yi=1 to cHeight do + x = x0 + for xi=1 to cWidth do + c = 0 -- default to black + if in_set(x,y) then + c = pixel_colour(x,y,iter) + end if + setDibPixel(mainDib, xi, yi, c) + x += scale + end for + y += scale + end for +end procedure + +integer firsttime = 1 +integer drawBox = 0 +integer drawTime = 0 + +procedure newDib() +sequence pal + + if mainDib!=0 then + {} = deleteDib(mainDib) + end if + mainDib = createDib(cWidth, cHeight) + pal = repeat({0,0,0},256) + for i=2 to 256 do + pal[i][1] = i*5 + pal[i][2] = 0 + pal[i][3] = i*10 + end for + setDibPalette(mainDib, 1, pal) + mandel(x0,y0,scale) + drawTime = 2 +end procedure + +procedure reDraw() + setText(Main,"Please Wait...") + mandel(x0,y0,scale) + drawTime = 2 + repaintWindow(Main,False) +end procedure + +procedure zoom(integer z) + while z do + if z>0 then + scale /= 1.1 + z -= 1 + else + scale *= 1.1 + z += 1 + end if + end while + reDraw() +end procedure + +integer dx=0,dy=0 -- mouse down coords +integer mx=0,my=0 -- mouse move/up coords + +function mainHandler(integer id, integer msg, atom wParam, object lParam) +integer x, y -- scratch vars +atom scale10 + + if msg=WM_SIZE then -- (also activate/firsttime) + {{},{},x,y} = getClientRect(Main) + if firsttime or cWidth!=x or cHeight!=y then + scale *= cWidth/x + {cWidth, cHeight} = {x,y} + newDib() + firsttime = 0 + end if + elsif msg=WM_PAINT then + copyDib(mainDC, 0, 0, mainDib) + if drawBox then + void = c_func(xRectangle, {mainDC, dx, dy, mx, my}) + end if + if drawTime then + if drawTime=2 then + setText(Main,sprintf("Mandelbrot Set [generated in %gs]",time()-t0)) + else + setText(Main,"Mandelbrot Set") + end if + drawTime -= 1 + end if + elsif msg=WM_CHAR then + if wParam=VK_ESCAPE then + closeWindow(Main) + elsif wParam='+' then zoom(+1) + elsif wParam='-' then zoom(-1) + end if + elsif msg=WM_LBUTTONDOWN + or msg=WM_RBUTTONDOWN then + {dx,dy} = lParam + elsif msg=WM_MOUSEMOVE then + if and_bits(wParam,MK_LBUTTON) then + {mx,my} = lParam + -- minus dx,dy (see WM_LBUTTONUP) + -- DEV maybe a timer to redraw, but probably too slow... + -- (this is where we need a background worker thread, + -- ideally one we can direct to abandon what it is + -- currently doing and start work on new x,y instead) + elsif and_bits(wParam,MK_RBUTTON) then + {mx,my} = lParam + drawBox = 1 + repaintWindow(Main,False) + end if + elsif msg=WM_MOUSEWHEEL then + wParam = floor(wParam/#10000) + if wParam>=#8000 then -- sign bit set + wParam-=#10000 + end if + wParam = floor(wParam/120) -- (gives +/-1, usually) + zoom(wParam) + elsif msg=WM_LBUTTONUP then + {mx,my} = lParam + drawBox = 0 + x0 += (dx-mx)*scale + y0 += (dy-my)*scale + reDraw() + elsif msg=WM_RBUTTONUP then + {mx,my} = lParam + drawBox = 0 + if mx!=dx and my!=dy then + x0 += min(mx,dx)*scale + y0 += min(my,dy)*scale + scale *= (abs(mx-dx))/cHeight + reDraw() + end if + elsif msg=WM_KEYDOWN then + if wParam=VK_F1 then + Help() + elsif wParam=VK_F2 then + {x,y} = getWindowRect(Main) + void = c_func(xTrackPopupMenu, {iterHwnd,TPM_LEFTALIGN,x+20,y+40,0,mainHwnd,NULL}) + elsif find(wParam,{VK_UP,VK_DOWN,VK_LEFT,VK_RIGHT}) then + drawBox = 0 + scale10 = scale*10 + if wParam=VK_UP then + y0 += scale10 + elsif wParam=VK_DOWN then + y0 -= scale10 + elsif wParam=VK_LEFT then + x0 += scale10 + elsif wParam=VK_RIGHT then + x0 -= scale10 + end if + reDraw() + end if + elsif msg=WM_COMMAND then + id = find(id,m50to1000) + if id!=0 then + iter = i50to1000[id] + reDraw() + end if + end if + return 0 +end function +setHandler({Main,mIter50,mIter100,mIter500,mIter1000}, routine_id("mainHandler")) + +WinMain(Main,SW_NORMAL) +void = deleteDib(0) diff --git a/Task/Mandelbrot-set/Ring/mandelbrot-set.ring b/Task/Mandelbrot-set/Ring/mandelbrot-set.ring new file mode 100644 index 0000000000..268a6f07c8 --- /dev/null +++ b/Task/Mandelbrot-set/Ring/mandelbrot-set.ring @@ -0,0 +1,53 @@ +load "guilib.ring" + +new qapp + { + win1 = new qwidget() { + setwindowtitle("drawing using qpainter") + setgeometry(100,100,500,500) + label1 = new qlabel(win1) { + setgeometry(10,10,400,400) + settext("") + } + new qpushbutton(win1) { + setgeometry(200,400,100,30) + settext("draw") + setclickevent("draw()") + } + show() + } + exec() + } + +func draw + p1 = new qpicture() + color = new qcolor() { + setrgb(0,0,255,255) + } + pen = new qpen() { + setcolor(color) + setwidth(1) + } + new qpainter() { + begin(p1) + setpen(pen) + + x1=300 y1=250 + i1=-1 i2=1 r1=-2 r2=1 + s1=(r2-r1)/x1 s2=(i2-i1)/y1 + for y=0 to y1 + i3=i1+s2*y + for x=0 to x1 + r3=r1+s1*x z1=r3 z2=i3 + for n=0 to 30 + a=z1*z1 b=z2*z2 + if a+b>4 exit ok + z2=2*z1*z2+i3 z1=a-b+r3 + next + if n != 31 drawpoint(x,y) ok + next + next + + endpaint() + } + label1 { setpicture(p1) show() } diff --git a/Task/Mandelbrot-set/SequenceL/mandelbrot-set-1.sequencel b/Task/Mandelbrot-set/SequenceL/mandelbrot-set-1.sequencel new file mode 100644 index 0000000000..9e94afeb72 --- /dev/null +++ b/Task/Mandelbrot-set/SequenceL/mandelbrot-set-1.sequencel @@ -0,0 +1,88 @@ +import ; +import ; +import ; + +COLOR_STRUCT ::= (R: int(0), G: int(0), B: int(0)); +rgb(r(0), g(0), b(0)) := (R: r, G: g, B: b); + +RESULT_STRUCT ::= (FinalValue: Complex(0), Iterations: int(0)); +makeResult(val(0), iters(0)) := (FinalValue: val, Iterations: iters); + +zSquaredOperation(startingNum(0), currentNum(0)) := + complexAdd(startingNum, complexMultiply(currentNum, currentNum)); + +zSquared(minX(0), maxX(0), resolutionX(0), minY(0), maxY(0), resolutionY(0), maxMagnitude(0), maxIters(0))[Y,X] := + let + stepX := (maxX - minX) / resolutionX; + stepY := (maxY - minY) / resolutionY; + + currentX := X * stepX + minX; + currentY := Y * stepY + minY; + + in + operateUntil(zSquaredOperation, makeComplex(currentX, currentY), makeComplex(currentX, currentY), maxMagnitude, 0, maxIters) + foreach Y within 0 ... (resolutionY - 1), + X within 0 ... (resolutionX - 1); + +operateUntil(operation(0), startingNum(0), currentNum(0), maxMagnitude(0), currentIters(0), maxIters(0)) := + let + operated := operation(startingNum, currentNum); + in + makeResult(currentNum, maxIters) when currentIters >= maxIters + else + makeResult(currentNum, currentIters) when complexMagnitude(currentNum) >= maxMagnitude + else + operateUntil(operation, startingNum, operated, maxMagnitude, currentIters + 1, maxIters); + +//region Smooth Coloring + +COLOR_COUNT := size(colorSelections); + +colorRange := range(0, 255, 1); + +colors := + let + first[i] := rgb(0, 0, i) foreach i within colorRange; + second[i] := rgb(i, i, 255) foreach i within colorRange; + third[i] := rgb(255, 255, i) foreach i within reverse(colorRange); + fourth[i] := rgb(255, i, 0) foreach i within reverse(colorRange); + fifth[i] := rgb(i, 0, 0) foreach i within reverse(colorRange); + + red[i] := rgb(i, 0, 0) foreach i within colorRange; + redR[i] := rgb(i, 0, 0) foreach i within reverse(colorRange); + green[i] := rgb(0, i, 0) foreach i within colorRange; + greenR[i] :=rgb(0, i, 0) foreach i within reverse(colorRange); + blue[i] := rgb(0, 0, i) foreach i within colorRange; + blueR[i] := rgb(0, 0, i) foreach i within reverse(colorRange); + + in + //red ++ redR ++ green ++ greenR ++ blue ++ blueR; + first ++ second ++ third ++ fourth ++ fifth; + //first ++ fourth; + +colorSelections := range(1, size(colors), 30); + +getSmoothColorings(zSquaredResult(2), maxIters(0))[Y,X] := + let + current := zSquaredResult[Y,X]; + + zn := complexMagnitude(current.FinalValue); + nu := ln(ln(zn) / ln(2)) / ln(2); + + result := abs(current.Iterations + 1 - nu); + + index := floor(result); + rem := result - index; + + color1 := colorSelections[(index mod COLOR_COUNT) + 1]; + color2 := colorSelections[((index + 1) mod COLOR_COUNT) + 1]; + in + rgb(0, 0, 0) when current.Iterations = maxIters + else + colors[color1] when color2 < color1 + else + colors[floor(linearInterpolate(color1, color2, rem))]; + +linearInterpolate(v0(0), v1(0), t(0)) := (1 - t) * v0 + t * v1; + +//endregion diff --git a/Task/Mandelbrot-set/SequenceL/mandelbrot-set-2.sequencel b/Task/Mandelbrot-set/SequenceL/mandelbrot-set-2.sequencel new file mode 100644 index 0000000000..cf9f14301f --- /dev/null +++ b/Task/Mandelbrot-set/SequenceL/mandelbrot-set-2.sequencel @@ -0,0 +1,103 @@ +#include "SL_Generated.h" +#include "../../../ThirdParty/CImg/CImg.h" + +using namespace std; +using namespace cimg_library; + +int main(int argc, char ** argv) +{ + int cores = 0; + + Sequence > computeResult; + Sequence > colorResult; + + sl_init(cores); + + int maxIters = 1000; + int imageWidth = 1920; + int imageHeight = 1200; + double maxMag = 256; + + double xmin = -2.5; + double xmax = 1.0; + double ymin = -1.0; + double ymax = 1.0; + + CImg visu(imageWidth, imageHeight, 1, 3); + CImgDisplay draw_disp(visu, "Mandelbrot Fractal in SequenceL"); + + bool redraw = true; + + SLTimer t; + + double computeTime; + double colorTime; + double renderTime; + + while(!draw_disp.is_closed()) + { + if(redraw) + { + redraw = false; + + t.start(); + sl_zSquared(xmin, xmax, imageWidth, ymin, ymax, imageHeight, maxMag, maxIters, cores, computeResult); + t.stop(); + computeTime = t.getTime(); + + t.start(); + sl_getSmoothColorings(computeResult, maxIters, cores, colorResult); + t.stop(); + colorTime = t.getTime(); + + t.start(); + + visu.fill(0); + for(int i = 1; i <= colorResult.size(); i++) + { + for(int j = 1; j <= colorResult[i].size(); j++) + { + visu(j-1,i-1,0,0) = colorResult[i][j].R; + visu(j-1,i-1,0,1) = colorResult[i][j].G; + visu(j-1,i-1,0,2) = colorResult[i][j].B; + } + } + visu.display(draw_disp); + + t.stop(); + + renderTime = t.getTime(); + + draw_disp.set_title("X:[%f, %f] Y:[%f, %f] | Mandelbrot Fractal in SequenceL | Compute Time: %f | Color Time: %f | Render Time: %f | Total FPS: %f", xmin, xmax, ymin, ymax, cores, computeTime, colorTime, renderTime, 1 / (computeTime + colorTime + renderTime)); + } + + draw_disp.wait(); + + double xdiff = (xmax - xmin); + double ydiff = (ymax - ymin); + + double xcenter = ((1.0 * draw_disp.mouse_x()) / imageWidth) * xdiff + xmin; + double ycenter = ((1.0 * draw_disp.mouse_y()) / imageHeight) * ydiff + ymin; + + if(draw_disp.button()&1) + { + redraw = true; + xmin = xcenter - (xdiff / 4); + xmax = xcenter + (xdiff / 4); + ymin = ycenter - (ydiff / 4); + ymax = ycenter + (ydiff / 4); + } + else if(draw_disp.button()&2) + { + redraw = true; + xmin = xcenter - xdiff; + xmax = xcenter + xdiff; + ymin = ycenter - ydiff; + ymax = ycenter + ydiff; + } + } + + sl_done(); + + return 0; +} diff --git a/Task/Mandelbrot-set/Sidef/mandelbrot-set.sidef b/Task/Mandelbrot-set/Sidef/mandelbrot-set.sidef new file mode 100644 index 0000000000..2ad952cee4 --- /dev/null +++ b/Task/Mandelbrot-set/Sidef/mandelbrot-set.sidef @@ -0,0 +1,14 @@ +func mandelbrot(z) { + var c = z; + { z = (z*z + c); + z.abs > 2 && return true; + } * 20; + return false; +} + +1 ^.. (-1, 0.05) -> each { |y| + -2 ..^ (0.5, 0.0315) -> each { |x| + print(mandelbrot(y.i + x) ? ' ' : '#'); + } + print "\n"; +} diff --git a/Task/Mandelbrot-set/jq/mandelbrot-set-1.jq b/Task/Mandelbrot-set/jq/mandelbrot-set-1.jq new file mode 100644 index 0000000000..cd593fca0f --- /dev/null +++ b/Task/Mandelbrot-set/jq/mandelbrot-set-1.jq @@ -0,0 +1,14 @@ +# SVG STUFF + def svg(id; width; height): + ""; + + def pixel(x;y;r;g;b;a): + ""; + +# "UNTIL" + # As soon as "condition" is true, then emit . and stop: + def do_until(condition; next): + def u: if condition then . else (next|u) end; + u; diff --git a/Task/Mandelbrot-set/jq/mandelbrot-set-2.jq b/Task/Mandelbrot-set/jq/mandelbrot-set-2.jq new file mode 100644 index 0000000000..affab44be4 --- /dev/null +++ b/Task/Mandelbrot-set/jq/mandelbrot-set-2.jq @@ -0,0 +1,40 @@ +def Mandeliter( cx; cy; maxiter ): + # [i, x, y, x^2+y^2] + [ maxiter, 0.0, 0.0, 0.0 ] + | do_until( .[0] == 0 or .[3] > 4; + .[1] as $x | .[2] as $y + | ($x * $y) as $xy + | ($x * $x) as $xx + | ($y * $y) as $yy + | [ (.[0] - 1), # i + ($xx - $yy + cx), # x + ($xy + $xy + cy), # y + ($xx+$yy) # xx+yy + ] ) + | maxiter - .[0]; + +# width and height should be specified as the number of pixels. +# obj == { xmin: _, xmax: _, ymin: _, ymax: _ } +def Mandelbrot( obj; width; height; iterations ): + def pixies: + range(0; width) as $ix + | (obj.xmin + ((obj.xmax - obj.xmin) * $ix / (width - 1))) as $x + | range(0; height) as $iy + | (obj.ymin + ((obj.ymax - obj.ymin) * $iy / (height - 1))) as $y + | Mandeliter( $x; $y; iterations ) as $i + | if $i == iterations then + pixel($ix; $iy; 0; 0; 0; 255) + else + (3 * ($i|log)/((iterations - 1.0)|log)) as $c # redness + | if $c < 1 then + pixel($ix;$iy; 255*$c; 0; 0; 255) + elif $c < 2 then + pixel($ix;$iy; 255; 255*($c-1); 0; 255) + else + pixel($ix;$iy; 255; 255; 255*($c-2); 255) + end + end; + + svg("mandelbrot"; "100%"; "100%"), + pixies, + ""; diff --git a/Task/Mandelbrot-set/jq/mandelbrot-set-3.jq b/Task/Mandelbrot-set/jq/mandelbrot-set-3.jq new file mode 100644 index 0000000000..d199e1d5ea --- /dev/null +++ b/Task/Mandelbrot-set/jq/mandelbrot-set-3.jq @@ -0,0 +1 @@ + Mandelbrot( {"xmin": -2, "xmax": 1, "ymin": -1, "ymax":1}; 900; 600; 1000 ) diff --git a/Task/Map-range/ERRE/map-range.erre b/Task/Map-range/ERRE/map-range.erre new file mode 100644 index 0000000000..797833ee4a --- /dev/null +++ b/Task/Map-range/ERRE/map-range.erre @@ -0,0 +1,11 @@ +PROGRAM RANGE + +BEGIN + AL=0 AH=10 + BL=-1 BH=0 + FOR N=0 TO 10 DO + RANGE=BL+(N-AL)*(BH-BL)/(AH-AL) + WRITE("### maps to ##.##";N;RANGE) +! PRINT(N;" maps to ";RANGE) + END FOR +END PROGRAM diff --git a/Task/Map-range/EchoLisp/map-range.echolisp b/Task/Map-range/EchoLisp/map-range.echolisp new file mode 100644 index 0000000000..0ed7de1768 --- /dev/null +++ b/Task/Map-range/EchoLisp/map-range.echolisp @@ -0,0 +1,30 @@ +(lib 'plot) ;; interpolation functions +(lib 'compile) + +;; rational version +(define (q-map-range x xmin xmax ymin ymax) (+ ymin (/ ( * (- x xmin) (- ymax ymin)) (- xmax xmin)))) + +;; float version +(define (map-range x xmin xmax ymin ymax) (+ ymin (// ( * (- x xmin) (- ymax ymin)) (- xmax xmin)))) +; accelerate it +(compile 'map-range "-vf") + +(q-map-range 4 0 10 -1 0) + → -3/5 +(map-range 4 0 10 -1 0) + → -0.6 +(linear 4 0 10 -1 0) ;; native + → -0.6 + +(for [(x (in-range 0 10))] (writeln x (q-map-range x 0 10 -1 0) (map-range x 0 10 -1 0))) + +0 -1 -1 +1 -9/10 -0.9 +2 -4/5 -0.8 +3 -7/10 -0.7 +4 -3/5 -0.6 +5 -1/2 -0.5 +6 -2/5 -0.4 +7 -3/10 -0.3 +8 -1/5 -0.2 +9 -1/10 -0.1 diff --git a/Task/Map-range/Lasso/map-range.lasso b/Task/Map-range/Lasso/map-range.lasso new file mode 100644 index 0000000000..16b3de78b1 --- /dev/null +++ b/Task/Map-range/Lasso/map-range.lasso @@ -0,0 +1,15 @@ +define map_range( + a1, + a2, + b1, + b2, + number +) => (decimal(#b1) + (decimal(#number) - decimal(#a1)) * (decimal(#b2) - decimal(#b1)) / (decimal(#a2) - decimal(#a1))) -> asstring(-Precision = 1) + +with number in generateSeries(1,10) do {^ + #number + ': ' + map_range( 0, 10, -1, 0, #number) + '
' + +^}' diff --git a/Task/Map-range/Nim/map-range.nim b/Task/Map-range/Nim/map-range.nim new file mode 100644 index 0000000000..82573ea474 --- /dev/null +++ b/Task/Map-range/Nim/map-range.nim @@ -0,0 +1,10 @@ +import strutils + +type FloatRange = tuple[s,e: float] + +proc mapRange(a,b: FloatRange, s): float = + b.s + (s - a.s) * (b.e - b.s) / (a.e - a.s) + +for i in 0..10: + let m = mapRange((0.0,10.0), (-1.0, 0.0), float(i)) + echo i, " maps to ", formatFloat(m, precision = 0) diff --git a/Task/Map-range/Oforth/map-range.oforth b/Task/Map-range/Oforth/map-range.oforth new file mode 100644 index 0000000000..82db95a183 --- /dev/null +++ b/Task/Map-range/Oforth/map-range.oforth @@ -0,0 +1,3 @@ +: mapRange(p1, p2, s) + s p1 first - p2 second p2 first - * p1 second p1 first - asFloat / + p2 first + ; diff --git a/Task/Map-range/Phix/map-range.phix b/Task/Map-range/Phix/map-range.phix new file mode 100644 index 0000000000..ef4a606c68 --- /dev/null +++ b/Task/Map-range/Phix/map-range.phix @@ -0,0 +1,7 @@ +function MapRange(atom s, a1, a2, b1, b2) + return b1+(s-a1)*(b2-b1)/(a2-a1) +end function + +for i=0 to 10 by 2 do + printf(1,"%2d : %g\n",{i,MapRange(i,0,10,-1,0)}) +end for diff --git a/Task/Map-range/Sidef/map-range.sidef b/Task/Map-range/Sidef/map-range.sidef new file mode 100644 index 0000000000..e5ecd68758 --- /dev/null +++ b/Task/Map-range/Sidef/map-range.sidef @@ -0,0 +1,11 @@ +func map_range(a, b, x) { + var (a1, a2, b1, b2) = (a.bounds, b.bounds); + x-a1 * b2-b1 / a2-a1 + b1; +} + +var a = 0..10; +var b = -1..0; + +for x in a { + say "#{x} maps to #{map_range(a, b, x)}"; +} diff --git a/Task/Map-range/jq/map-range-1.jq b/Task/Map-range/jq/map-range-1.jq new file mode 100644 index 0000000000..90d9d3835f --- /dev/null +++ b/Task/Map-range/jq/map-range-1.jq @@ -0,0 +1,5 @@ +# The input is the value to be mapped. +# The ranges, a and b, should each be an array defining the +# left-most and right-most points of the range. +def maprange(a; b): + b[0] + (((. - a[0]) * (b[1] - b[0])) / (a[1] - a[0])) ; diff --git a/Task/Map-range/jq/map-range-2.jq b/Task/Map-range/jq/map-range-2.jq new file mode 100644 index 0000000000..faa65841a2 --- /dev/null +++ b/Task/Map-range/jq/map-range-2.jq @@ -0,0 +1 @@ +range(0;11) | maprange([0,10]; [-1, 0]) diff --git a/Task/Map-range/jq/map-range-3.jq b/Task/Map-range/jq/map-range-3.jq new file mode 100644 index 0000000000..8accd5fbf8 --- /dev/null +++ b/Task/Map-range/jq/map-range-3.jq @@ -0,0 +1,5 @@ +def maprange_array(a; b): + def _helper(a0; b0; factor): b0 + (. - a0) * factor; + + a[0] as $a | b[0] as $b | ((b[1] - b[0]) / (a[1] - a[0])) as $factor + | map(_helper( $a; $b; $factor) ); diff --git a/Task/Matrix-arithmetic/EchoLisp/matrix-arithmetic.echolisp b/Task/Matrix-arithmetic/EchoLisp/matrix-arithmetic.echolisp new file mode 100644 index 0000000000..0de2522790 --- /dev/null +++ b/Task/Matrix-arithmetic/EchoLisp/matrix-arithmetic.echolisp @@ -0,0 +1,27 @@ +(lib 'list) +(lib 'matrix) + +;; adapted from Racket +(define (permanent M) + (let (( n (matrix-row-num M))) + (for/sum ([σ (in-permutations n)]) + (for/product ([i n] [σi σ]) + (array-ref M i σi))))) + +;; output +(define A (list->array '(1 2 3 4) 2 2)) +(array-print A) + 1 2 + 3 4 +(determinant A) → -2 +(permanent A) → 10 + +(define M (list->array (iota 25) 5 5)) +(array-print M) + 0 1 2 3 4 + 5 6 7 8 9 + 10 11 12 13 14 + 15 16 17 18 19 + 20 21 22 23 24 +(determinant M) → 0 +(permanent M) → 6778800 diff --git a/Task/Matrix-arithmetic/FunL/matrix-arithmetic-1.funl b/Task/Matrix-arithmetic/FunL/matrix-arithmetic-1.funl new file mode 100644 index 0000000000..872cd464a9 --- /dev/null +++ b/Task/Matrix-arithmetic/FunL/matrix-arithmetic-1.funl @@ -0,0 +1,5 @@ +def sgn( p ) = product( (if s(0) < s(1) xor i(0) < i(1) then -1 else 1) | (s, i) <- p.combinations(2).zip( (0:p.length()).combinations(2) ) ) + +def perm( m ) = sum( product(m(i, sigma(i)) | i <- 0:m.length()) | sigma <- (0:m.length()).permutations() ) + +def det( m ) = sum( sgn(sigma)*product(m(i, sigma(i)) | i <- 0:m.length()) | sigma <- (0:m.length()).permutations() ) diff --git a/Task/Matrix-arithmetic/FunL/matrix-arithmetic-2.funl b/Task/Matrix-arithmetic/FunL/matrix-arithmetic-2.funl new file mode 100644 index 0000000000..643926b73c --- /dev/null +++ b/Task/Matrix-arithmetic/FunL/matrix-arithmetic-2.funl @@ -0,0 +1,7 @@ +def perm( m ) + | m.length() == 1 and m(0).length() == 1 = m(0, 0) + | otherwise = sum( m(i, 0)*perm(m(0:i, 1:m.length()) + m(i+1:m.length(), 1:m.length())) | i <- 0:m.length() ) + +def det( m ) + | m.length() == 1 and m(0).length() == 1 = m(0, 0) + | otherwise = sum( (-1)^i*m(i, 0)*det(m(0:i, 1:m.length()) + m(i+1:m.length(), 1:m.length())) | i <- 0:m.length() ) diff --git a/Task/Matrix-arithmetic/FunL/matrix-arithmetic-3.funl b/Task/Matrix-arithmetic/FunL/matrix-arithmetic-3.funl new file mode 100644 index 0000000000..d0aa34ed75 --- /dev/null +++ b/Task/Matrix-arithmetic/FunL/matrix-arithmetic-3.funl @@ -0,0 +1,18 @@ +matrices = [ + ( (1, 2), + (3, 4)), + ( (-2, 2, -3), + (-1, 1, 3), + ( 2, 0, -1)), + ( ( 1, 2, 3, 4), + ( 4, 5, 6, 7), + ( 7, 8, 9, 10), + (10, 11, 12, 13)), + ( ( 0, 1, 2, 3, 4), + ( 5, 6, 7, 8, 9), + (10, 11, 12, 13, 14), + (15, 16, 17, 18, 19), + (20, 21, 22, 23, 24)) ] + +for m <- matrices + println( m, 'perm: ' + perm(m), 'det: ' + det(m) ) diff --git a/Task/Matrix-arithmetic/Nim/matrix-arithmetic.nim b/Task/Matrix-arithmetic/Nim/matrix-arithmetic.nim new file mode 100644 index 0000000000..df12d4fa15 --- /dev/null +++ b/Task/Matrix-arithmetic/Nim/matrix-arithmetic.nim @@ -0,0 +1,37 @@ +import sequtils, permutationsswap + +type Matrix[M,N: static[int]] = array[M, array[N, float]] + +proc det[M,N](a: Matrix[M,N]): float = + let n = toSeq 0..a.high + for sigma, sign in n.permutations: + var x = sign.float + for i in n: x *= a[i][sigma[i]] + result += x + +proc perm[M,N](a: Matrix[M,N]): float = + let n = toSeq 0..a.high + for sigma, sign in n.permutations: + var x = 1.0 + for i in n: x *= a[i][sigma[i]] + result += x + +const + a = [ [1.0, 2.0] + , [3.0, 4.0] + ] + b = [ [ 1.0, 2, 3, 4] + , [ 4.0, 5, 6, 7] + , [ 7.0, 8, 9, 10] + , [10.0, 11, 12, 13] + ] + c = [ [ 0.0, 1, 2, 3, 4] + , [ 5.0, 6, 7, 8, 9] + , [10.0, 11, 12, 13, 14] + , [15.0, 16, 17, 18, 19] + , [20.0, 21, 22, 23, 24] + ] + +echo "perm: ", a.perm, " det: ", a.det +echo "perm: ", b.perm, " det: ", b.det +echo "perm: ", c.perm, " det: ", c.det diff --git a/Task/Matrix-arithmetic/SPAD/matrix-arithmetic.spad b/Task/Matrix-arithmetic/SPAD/matrix-arithmetic.spad new file mode 100644 index 0000000000..be1b230e26 --- /dev/null +++ b/Task/Matrix-arithmetic/SPAD/matrix-arithmetic.spad @@ -0,0 +1,16 @@ +(1) -> M:=matrix [[2, 9, 4], [7, 5, 3], [6, 1, 8]] + + +2 9 4+ + | | + (1) |7 5 3| + | | + +6 1 8+ + Type: Matrix(Integer) +(2) -> determinant M + + (2) - 360 + Type: Integer +(3) -> permanent M + + (3) 900 + Type: PositiveInteger diff --git a/Task/Matrix-arithmetic/jq/matrix-arithmetic-1.jq b/Task/Matrix-arithmetic/jq/matrix-arithmetic-1.jq new file mode 100644 index 0000000000..0fb7c697cc --- /dev/null +++ b/Task/Matrix-arithmetic/jq/matrix-arithmetic-1.jq @@ -0,0 +1,18 @@ +# Eliminate row i and row j +def except(i;j): + reduce del(.[i])[] as $row ([]; . + [$row | del(.[j]) ] ); + +def det: + def parity(i): if i % 2 == 0 then 1 else -1 end; + if length == 1 and (.[0] | length) == 1 then .[0][0] + else . as $m + | reduce range(0; length) as $i + (0; . + parity($i) * $m[0][$i] * ( $m | except(0;$i) | det) ) + end ; + +def perm: + if length == 1 and (.[0] | length) == 1 then .[0][0] + else . as $m + | reduce range(0; length) as $i + (0; . + $m[0][$i] * ( $m | except(0;$i) | perm) ) + end ; diff --git a/Task/Matrix-arithmetic/jq/matrix-arithmetic-2.jq b/Task/Matrix-arithmetic/jq/matrix-arithmetic-2.jq new file mode 100644 index 0000000000..8e87a415f7 --- /dev/null +++ b/Task/Matrix-arithmetic/jq/matrix-arithmetic-2.jq @@ -0,0 +1,22 @@ +def matrices: + [ [1, 2], + [3, 4]], + + [ [-2, 2, -3], + [-1, 1, 3], + [ 2, 0, -1]], + + [ [ 1, 2, 3, 4], + [ 4, 5, 6, 7], + [ 7, 8, 9, 10], + [10, 11, 12, 13]], + + [ [ 0, 1, 2, 3, 4], + [ 5, 6, 7, 8, 9], + [10, 11, 12, 13, 14], + [15, 16, 17, 18, 19], + [20, 21, 22, 23, 24]] +; + +"Determinants: ", (matrices | det), +"Permanents: ", (matrices | perm) diff --git a/Task/Matrix-arithmetic/jq/matrix-arithmetic-3.jq b/Task/Matrix-arithmetic/jq/matrix-arithmetic-3.jq new file mode 100644 index 0000000000..1ad112d9e0 --- /dev/null +++ b/Task/Matrix-arithmetic/jq/matrix-arithmetic-3.jq @@ -0,0 +1,11 @@ +$ jq -n -r -f Matrix_arithmetic.jq +Determinants: +-2 +18 +0 +0 +Permanents: +10 +10 +29556 +6778800 diff --git a/Task/Matrix-arithmetic/jq/matrix-arithmetic-4.jq b/Task/Matrix-arithmetic/jq/matrix-arithmetic-4.jq new file mode 100644 index 0000000000..0a8839f903 --- /dev/null +++ b/Task/Matrix-arithmetic/jq/matrix-arithmetic-4.jq @@ -0,0 +1,8 @@ +# Requires lup/0 +def det: + def product_diagonal: + . as $m | reduce range(0;length) as $i (1; . * $m[$i][$i]); + def tidy: if . == -0 then 0 else . end; + lup + | (.[0]|product_diagonal) as $l + | if $l == 0 then 0 else $l * (.[1]|product_diagonal) | tidy end ; diff --git a/Task/Matrix-arithmetic/jq/matrix-arithmetic-5.jq b/Task/Matrix-arithmetic/jq/matrix-arithmetic-5.jq new file mode 100644 index 0000000000..672c5be77a --- /dev/null +++ b/Task/Matrix-arithmetic/jq/matrix-arithmetic-5.jq @@ -0,0 +1 @@ +matrices | det diff --git a/Task/Matrix-exponentiation-operator/ERRE/matrix-exponentiation-operator.erre b/Task/Matrix-exponentiation-operator/ERRE/matrix-exponentiation-operator.erre new file mode 100644 index 0000000000..a56928b2f4 --- /dev/null +++ b/Task/Matrix-exponentiation-operator/ERRE/matrix-exponentiation-operator.erre @@ -0,0 +1,53 @@ +PROGRAM MAT_PROD + +!$MATRIX + +!----------------- +! calculate A[]^N +!----------------- + +CONST ORDER=1 + +DIM A[1,1],B[1,1],ANS[1,1] + +BEGIN + +DATA(3,2,2,1) +DATA(10) ! integer power only + +FOR I=0 TO ORDER DO + FOR J=0 TO ORDER DO + READ(A[I,J]) + END FOR +END FOR + +READ(M) N=M-1 + +IF N=0 THEN ! A[]^0=matrice identit… + for I=0 TO ORDER DO + B[I,I]=1 + END FOR + ELSE + B[]=A[] + FOR Z=1 TO N DO + ANS[]=0 + FOR I=0 TO ORDER DO + FOR J=0 TO ORDER DO + FOR K=0 TO ORDER DO + ANS[I,J]=ANS[I,J]+(A[I,K]*B[K,J]) + END FOR + END FOR + END FOR + B[]=ANS[] + END FOR +END IF + +! print answer + FOR I=0 TO ORDER DO + FOR J=0 TO ORDER DO + PRINT(B[I,J],) + END FOR + PRINT + END FOR + +END PROGRAM diff --git a/Task/Matrix-exponentiation-operator/SPAD/matrix-exponentiation-operator.spad b/Task/Matrix-exponentiation-operator/SPAD/matrix-exponentiation-operator.spad new file mode 100644 index 0000000000..a5218c5c09 --- /dev/null +++ b/Task/Matrix-exponentiation-operator/SPAD/matrix-exponentiation-operator.spad @@ -0,0 +1,24 @@ +(1) -> A:=matrix [[0,-%i],[%i,0]] + + +0 - %i+ + (1) | | + +%i 0 + + Type: Matrix(Complex(Integer)) +(2) -> A^4 + + +1 0+ + (2) | | + +0 1+ + Type: Matrix(Complex(Integer)) +(3) -> A^(-1) + + +0 - %i+ + (3) | | + +%i 0 + + Type: Matrix(Fraction(Complex(Integer))) +(4) -> inverse A + + +0 - %i+ + (4) | | + +%i 0 + + Type: Union(Matrix(Fraction(Complex(Integer))),...) diff --git a/Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-1.jq b/Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-1.jq new file mode 100644 index 0000000000..d7bd585bbd --- /dev/null +++ b/Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-1.jq @@ -0,0 +1,24 @@ +# produce an array of length n that is 1 at i and 0 elsewhere +def indicator(i;n): [range(0;n) | 0] | .[i] = 1; + +# Identity matrix: +def identity(n): reduce range(0;n) as $i ([]; . + [indicator( $i; n )] ); + +def direct_matrix_exp(n): + . as $in + | if n == 0 then identity($in|length) + else reduce range(1;n) as $i ($in; . as $m | multiply($m; $in)) + end; + +def matrix_exp(n): + if n < 4 then direct_matrix_exp(n) + else . as $in + | ((n|2)|floor) as $m + | matrix_exp($m) as $ans + | multiply($ans;$ans) as $ans + | (n - (2 * $m) ) as $residue + | if $residue == 0 then $ans + else matrix_exp($residue) as $residue + | multiply($ans; $residue ) + end + end; diff --git a/Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-2.jq b/Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-2.jq new file mode 100644 index 0000000000..6190436989 --- /dev/null +++ b/Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-2.jq @@ -0,0 +1,10 @@ +def pi: 4 * (1|atan); + +def rotation_matrix(theta): + [[(theta|cos), (theta|sin)], [-(theta|sin), (theta|cos)]]; + +def demo_matrix_exp(n): + rotation_matrix( pi / 4 ) | matrix_exp(n) ; + +def demo_direct_matrix_exp(n): + rotation_matrix( pi / 4 ) | direct_matrix_exp(n) ; diff --git a/Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-3.jq b/Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-3.jq new file mode 100644 index 0000000000..1e52985b88 --- /dev/null +++ b/Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-3.jq @@ -0,0 +1,5 @@ +# For demo_matrix_exp(10000) +$ time jq -n -c -f Matrix-exponentiation_operator.rc +[[1,-1.1102230246251565e-12],[1.1102230246251565e-12,1]] +user 0m0.490s +sys 0m0.008s diff --git a/Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-4.jq b/Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-4.jq new file mode 100644 index 0000000000..73c5049a08 --- /dev/null +++ b/Task/Matrix-exponentiation-operator/jq/matrix-exponentiation-operator-4.jq @@ -0,0 +1,5 @@ +# For demo_direct_matrix_exp(10000) +$ time jq -n -c -f Matrix-exponentiation_operator.rc +[[1,-7.849831895612169e-13],[7.849831895612169e-13,1]] +user 0m0.625s +sys 0m0.006s diff --git a/Task/Matrix-multiplication/ERRE/matrix-multiplication.erre b/Task/Matrix-multiplication/ERRE/matrix-multiplication.erre new file mode 100644 index 0000000000..8e5578699e --- /dev/null +++ b/Task/Matrix-multiplication/ERRE/matrix-multiplication.erre @@ -0,0 +1,37 @@ +PROGRAM MAT_PROD + +DIM A[3,1],B[1,2],ANS[3,2] + +BEGIN + +DATA(1,2,3,4,5,6,7,8) +DATA(1,2,3,4,5,6) + +FOR I=0 TO 3 DO + FOR J=0 TO 1 DO + READ(A[I,J]) + END FOR +END FOR + +FOR I=0 TO 1 DO + FOR J=0 TO 2 DO + READ(B[I,J]) + END FOR +END FOR + +FOR I=0 TO UBOUND(ANS,1) DO + FOR J=0 TO UBOUND(ANS,2) DO + FOR K=0 TO UBOUND(A,2) DO + ANS[I,J]=ANS[I,J]+(A[I,K]*B[K,J]) + END FOR + END FOR +END FOR +! print answer + FOR I=0 TO UBOUND(ANS,1) DO + FOR J=0 TO UBOUND(ANS,2) DO + PRINT(ANS[I,J],) + END FOR + PRINT + END FOR + +END PROGRAM diff --git a/Task/Matrix-multiplication/Futhark/matrix-multiplication.futhark b/Task/Matrix-multiplication/Futhark/matrix-multiplication.futhark new file mode 100644 index 0000000000..902662e71c --- /dev/null +++ b/Task/Matrix-multiplication/Futhark/matrix-multiplication.futhark @@ -0,0 +1,4 @@ +fun main(x: [n][m]int, y: [m][p]int): [n][p]int = + map (fn xr => map (fn yc => reduce (+) 0 (zipWith (*) xr yc)) + (transpose y)) + x diff --git a/Task/Matrix-multiplication/Idris/matrix-multiplication.idris b/Task/Matrix-multiplication/Idris/matrix-multiplication.idris new file mode 100644 index 0000000000..5d9ceaf1fd --- /dev/null +++ b/Task/Matrix-multiplication/Idris/matrix-multiplication.idris @@ -0,0 +1,14 @@ +import Data.Vect + +Matrix : Nat -> Nat -> Type -> Type +Matrix m n t = Vect m (Vect n t) + +multiply : Num t => Matrix m1 n t -> Matrix n m2 t -> Matrix m1 m2 t +multiply a b = multiply' a (transpose b) + where + dot : Num t => Vect n t -> Vect n t -> t + dot v1 v2 = sum $ map (\(s1, s2) => (s1 * s2)) (zip v1 v2) + + multiply' : Num t => Matrix m1 n t -> Matrix m2 n t -> Matrix m1 m2 t + multiply' (a::as) b = map (dot a) b :: multiply' as b + multiply' [] _ = [] diff --git a/Task/Matrix-multiplication/LFE/matrix-multiplication-1.lfe b/Task/Matrix-multiplication/LFE/matrix-multiplication-1.lfe new file mode 100644 index 0000000000..4a2526cede --- /dev/null +++ b/Task/Matrix-multiplication/LFE/matrix-multiplication-1.lfe @@ -0,0 +1,7 @@ +(defun matrix* (matrix-1 matrix-2) + (list-comp + ((<- a matrix-1)) + (list-comp + ((<- b (transpose matrix-2))) + (lists:foldl #'+/2 0 + (lists:zipwith #'*/2 a b))))) diff --git a/Task/Matrix-multiplication/LFE/matrix-multiplication-2.lfe b/Task/Matrix-multiplication/LFE/matrix-multiplication-2.lfe new file mode 100644 index 0000000000..ddfe62de87 --- /dev/null +++ b/Task/Matrix-multiplication/LFE/matrix-multiplication-2.lfe @@ -0,0 +1,9 @@ +> (set ma '((1 2) + (3 4) + (5 6) + (7 8))) +((1 2) (3 4) (5 6) (7 8)) +> (set mb (transpose ma)) +((1 3 5 7) (2 4 6 8)) +> (matrix* ma mb) +((5 11 17 23) (11 25 39 53) (17 39 61 83) (23 53 83 113)) diff --git a/Task/Matrix-multiplication/Nim/matrix-multiplication.nim b/Task/Matrix-multiplication/Nim/matrix-multiplication.nim new file mode 100644 index 0000000000..eea9141834 --- /dev/null +++ b/Task/Matrix-multiplication/Nim/matrix-multiplication.nim @@ -0,0 +1,31 @@ +import strfmt + +type Matrix[M,N: static[int]] = array[M, array[N, float]] + +let a = [[1.0, 1.0, 1.0, 1.0], + [2.0, 4.0, 8.0, 16.0], + [3.0, 9.0, 27.0, 81.0], + [4.0, 16.0, 64.0, 256.0]] + +let b = [[ 4.0 , -3.0 , 4/3.0, -1/4.0 ], + [-13/3.0, 19/4.0, -7/3.0, 11/24.0], + [ 3/2.0, -2.0 , 7/6.0, -1/4.0 ], + [ -1/6.0, 1/4.0, -1/6.0, 1/24.0]] + +proc `$`(m: Matrix): string = + result = "([" + for r in m: + if result.len > 2: result.add "]\n [" + for val in r: result.add val.format("8.2f") + result.add "])" + +proc `*`[M,P,N](a: Matrix[M,P]; b: Matrix[P,N]): Matrix[M,N] = + for i in result.low .. result.high: + for j in result[0].low .. result[0].high: + for k in a[0].low .. a[0].high: + result[i][j] += a[i][k] * b[k][j] + +echo a +echo b +echo a * b +echo b * a diff --git a/Task/Matrix-multiplication/Phix/matrix-multiplication.phix b/Task/Matrix-multiplication/Phix/matrix-multiplication.phix new file mode 100644 index 0000000000..9ab380bfa6 --- /dev/null +++ b/Task/Matrix-multiplication/Phix/matrix-multiplication.phix @@ -0,0 +1,16 @@ +function matrix_mul(sequence a, sequence b) +sequence c + if length(a[1]) != length(b) then + return 0 + else + c = repeat(repeat(0,length(b[1])),length(a)) + for i=1 to length(a) do + for j=1 to length(b[1]) do + for k=1 to length(a[1]) do + c[i][j] += a[i][k]*b[k][j] + end for + end for + end for + return c + end if +end function diff --git a/Task/Matrix-multiplication/Ring/matrix-multiplication.ring b/Task/Matrix-multiplication/Ring/matrix-multiplication.ring new file mode 100644 index 0000000000..033c9ecdcd --- /dev/null +++ b/Task/Matrix-multiplication/Ring/matrix-multiplication.ring @@ -0,0 +1,18 @@ +load "stdlib.ring" +n = 3 +C = newlist(n,n) +A = [[1,2,3], [4,5,6], [7,8,9]] +B = [[1,0,0], [0,1,0], [0,0,1]] +for i = 1 to n + for j = 1 to n + for k = 1 to n + C[i][k] += A[i][j] * B[j][k] + next + next +next +for i = 1 to n + for j = 1 to n + see C[i][j] + " " + next + see nl +next diff --git a/Task/Matrix-multiplication/SPAD/matrix-multiplication.spad b/Task/Matrix-multiplication/SPAD/matrix-multiplication.spad new file mode 100644 index 0000000000..fb1eb68ce4 --- /dev/null +++ b/Task/Matrix-multiplication/SPAD/matrix-multiplication.spad @@ -0,0 +1,26 @@ +(1) -> A:=matrix [[1,2],[3,4],[5,6],[7,8]] + + +1 2+ + | | + |3 4| + (1) | | + |5 6| + | | + +7 8+ + Type: Matrix(Integer) +(2) -> B:=matrix [[1,2,3],[4,5,6]] + + +1 2 3+ + (2) | | + +4 5 6+ + Type: Matrix(Integer) +(3) -> A*B + + +9 12 15+ + | | + |19 26 33| + (3) | | + |29 40 51| + | | + +39 54 69+ + Type: Matrix(Integer) diff --git a/Task/Matrix-multiplication/SequenceL/matrix-multiplication-1.sequencel b/Task/Matrix-multiplication/SequenceL/matrix-multiplication-1.sequencel new file mode 100644 index 0000000000..fb91883df3 --- /dev/null +++ b/Task/Matrix-multiplication/SequenceL/matrix-multiplication-1.sequencel @@ -0,0 +1,12 @@ +matmul(A(2), B(2)) [i,j] := + let k := 1...size(B); + in sum( A[i,k] * B[k,j] ); + +//Example Use +a := [[1, 2], + [3, 4]]; + +b := [[-3, -8, 3], + [-2, 1, 4]]; + +test := matmul(a, b); diff --git a/Task/Matrix-multiplication/SequenceL/matrix-multiplication-2.sequencel b/Task/Matrix-multiplication/SequenceL/matrix-multiplication-2.sequencel new file mode 100644 index 0000000000..ca6b8c7a26 --- /dev/null +++ b/Task/Matrix-multiplication/SequenceL/matrix-multiplication-2.sequencel @@ -0,0 +1 @@ +matmul(A(2), B(2)) [i,j] := sum( A[i,all] * B[all,j] ); diff --git a/Task/Matrix-multiplication/Sidef/matrix-multiplication.sidef b/Task/Matrix-multiplication/Sidef/matrix-multiplication.sidef new file mode 100644 index 0000000000..1f0882be84 --- /dev/null +++ b/Task/Matrix-multiplication/Sidef/matrix-multiplication.sidef @@ -0,0 +1,27 @@ +func matrix_multi(a, b) { + var m = [[]] + for r in ^a { + for c in ^b[0] { + for i in ^b { + m[r][c] := 0 += (a[r][i] * b[i][c]) + } + } + } + return m +} +  +var a = [ + [1, 2], + [3, 4], + [5, 6], + [7, 8] + ] +  +var b = [ + [1, 2, 3], + [4, 5, 6] + ] +  +for line in matrix_multi(a, b) { + say line.map{|i|'%3d' % i }.join(', ') +} diff --git a/Task/Matrix-multiplication/Visual-FoxPro/matrix-multiplication.visual b/Task/Matrix-multiplication/Visual-FoxPro/matrix-multiplication.visual new file mode 100644 index 0000000000..d300da3ab1 --- /dev/null +++ b/Task/Matrix-multiplication/Visual-FoxPro/matrix-multiplication.visual @@ -0,0 +1,42 @@ +LOCAL ARRAY a[4,2], b[2,3], c[4,3] +CLOSE DATABASES ALL +*!* The arrays could be created directly but I prefer to do this: +CREATE CURSOR mat1 (c1 I, c2 I) +CREATE CURSOR mat2 (c1 I, c2 I, c3 I) +*!* Since matrix multiplication of integer arrays +*!* involves only multiplication and addition, +*!* the result will contain integers +CREATE CURSOR result (c1 I, c2 I, c3 I) +INSERT INTO mat1 VALUES (1, 2) +INSERT INTO mat1 VALUES (3, 4) +INSERT INTO mat1 VALUES (5, 6) +INSERT INTO mat1 VALUES (7, 8) +SELECT * FROM mat1 INTO ARRAY a + +INSERT INTO mat2 VALUES (1, 2, 3) +INSERT INTO mat2 VALUES (4, 5, 6) +SELECT * FROM mat2 INTO ARRAY b +STORE 0 TO c +MatMult(@a,@b,@c) +SELECT result +APPEND FROM ARRAY c +BROWSE + + +PROCEDURE MatMult(aa, bb, cc) +LOCAL n As Integer, m As Integer, p As Integer, i As Integer, j As Integer, k As Integer +IF ALEN(aa,2) = ALEN(bb,1) + n = ALEN(aa,2) + m = ALEN(aa,1) + p = ALEN(bb,2) + FOR i = 1 TO m + FOR j = 1 TO p + FOR k = 1 TO n + cc[i,j] = cc[i,j] + aa[i,k]*bb[k,j] + ENDFOR + ENDFOR + ENDFOR +ELSE + ? "Invalid dimensions" +ENDIF +ENDPROC diff --git a/Task/Matrix-multiplication/jq/matrix-multiplication.jq b/Task/Matrix-multiplication/jq/matrix-multiplication.jq new file mode 100644 index 0000000000..fd6c6de0ed --- /dev/null +++ b/Task/Matrix-multiplication/jq/matrix-multiplication.jq @@ -0,0 +1,18 @@ +def dot_product(a; b): + a as $a | b as $b + | reduce range(0;$a|length) as $i (0; . + ($a[$i] * $b[$i]) ); + +# transpose/0 expects its input to be a rectangular matrix (an array of equal-length arrays) +def transpose: + if (.[0] | length) == 0 then [] + else [map(.[0])] + (map(.[1:]) | transpose) + end ; + +# A and B should both be numeric matrices, A being m by n, and B being n by p. +def multiply(A; B): + A as $A | B as $B + | ($B[0]|length) as $p + | ($B|transpose) as $BT + | reduce range(0; $A|length) as $i + ([]; reduce range(0; $p) as $j + (.; .[$i][$j] = dot_product( $A[$i]; $BT[$j] ) )) ; diff --git a/Task/Matrix-transposition/EchoLisp/matrix-transposition.echolisp b/Task/Matrix-transposition/EchoLisp/matrix-transposition.echolisp new file mode 100644 index 0000000000..3a3d499451 --- /dev/null +++ b/Task/Matrix-transposition/EchoLisp/matrix-transposition.echolisp @@ -0,0 +1,10 @@ +(lib 'matrix) + +(define M (list->array (iota 6) 3 2)) +(array-print M) + 0 1 + 2 3 + 4 5 +(array-print (matrix-transpose M)) + 0 2 4 + 1 3 5 diff --git a/Task/Matrix-transposition/Idris/matrix-transposition.idris b/Task/Matrix-transposition/Idris/matrix-transposition.idris new file mode 100644 index 0000000000..0ba081e69b --- /dev/null +++ b/Task/Matrix-transposition/Idris/matrix-transposition.idris @@ -0,0 +1,2 @@ +Idris> transpose [[1,2],[3,4],[5,6]] +[[1, 3, 5], [2, 4, 6]] : List (List Integer) diff --git a/Task/Matrix-transposition/LFE/matrix-transposition-1.lfe b/Task/Matrix-transposition/LFE/matrix-transposition-1.lfe new file mode 100644 index 0000000000..c38255d81a --- /dev/null +++ b/Task/Matrix-transposition/LFE/matrix-transposition-1.lfe @@ -0,0 +1,13 @@ +(defun transpose (matrix) + (transpose matrix '())) + +(defun transpose (matrix acc) + (cond + ((lists:any + (lambda (x) (== x '())) + matrix) + acc) + ('true + (let ((heads (lists:map #'car/1 matrix)) + (tails (lists:map #'cdr/1 matrix))) + (transpose tails (++ acc `(,heads))))))) diff --git a/Task/Matrix-transposition/LFE/matrix-transposition-2.lfe b/Task/Matrix-transposition/LFE/matrix-transposition-2.lfe new file mode 100644 index 0000000000..13cf299364 --- /dev/null +++ b/Task/Matrix-transposition/LFE/matrix-transposition-2.lfe @@ -0,0 +1,8 @@ +> (transpose '((1 2 3) + (4 5 6) + (7 8 9) + (10 11 12) + (13 14 15) + (16 17 18))) +((1 4 7 10 13 16) (2 5 8 11 14 17) (3 6 9 12 15 18)) +> diff --git a/Task/Matrix-transposition/Nim/matrix-transposition-1.nim b/Task/Matrix-transposition/Nim/matrix-transposition-1.nim new file mode 100644 index 0000000000..b65be65bd6 --- /dev/null +++ b/Task/Matrix-transposition/Nim/matrix-transposition-1.nim @@ -0,0 +1,13 @@ +proc transpose[X, Y; T](s: array[Y, array[X, T]]): array[X, array[Y, T]] = + for i in low(X)..high(X): + for j in low(Y)..high(Y): + result[i][j] = s[j][i] + +let b = [[ 0, 1, 2, 3, 4], + [ 5, 6, 7, 8, 9], + [ 1, 0, 0, 0,42]] +let c = transpose(b) +for r in c: + for i in r: + stdout.write i, " " + echo "" diff --git a/Task/Matrix-transposition/Nim/matrix-transposition-2.nim b/Task/Matrix-transposition/Nim/matrix-transposition-2.nim new file mode 100644 index 0000000000..2cd5a2212a --- /dev/null +++ b/Task/Matrix-transposition/Nim/matrix-transposition-2.nim @@ -0,0 +1,11 @@ +proc transpose[T](s: seq[seq[T]]): seq[seq[T]] = + result = newSeq[seq[T]](s[0].len) + for i in 0 .. < s[0].len: + result[i] = newSeq[T](s.len) + for j in 0 .. < s.len: + result[i][j] = s[j][i] + +let a = @[@[ 0, 1, 2, 3, 4], + @[ 5, 6, 7, 8, 9], + @[ 1, 0, 0, 0,42]] +echo transpose(a) diff --git a/Task/Matrix-transposition/Phix/matrix-transposition.phix b/Task/Matrix-transposition/Phix/matrix-transposition.phix new file mode 100644 index 0000000000..9cdd099afb --- /dev/null +++ b/Task/Matrix-transposition/Phix/matrix-transposition.phix @@ -0,0 +1,9 @@ +function transpose(sequence in) +sequence out = repeat(repeat(0,length(in)),length(in[1])) + for n=1 to length(in) do + for m=1 to length(in[1]) do + out[m][n] = in[n][m] + end for + end for + return out +end function diff --git a/Task/Matrix-transposition/Ring/matrix-transposition.ring b/Task/Matrix-transposition/Ring/matrix-transposition.ring new file mode 100644 index 0000000000..4850820b17 --- /dev/null +++ b/Task/Matrix-transposition/Ring/matrix-transposition.ring @@ -0,0 +1,10 @@ +load "stdlib.ring" +transpose = newlist(5,4) +matrix = [[78,19,30,12,36], [49,10,65,42,50], [30,93,24,78,10], [39,68,27,64,29]] +for i = 1 to 5 + for j = 1 to 4 + transpose[i][j] = matrix[j][i] + see "" + transpose[i][j] + " " + next + see nl +next diff --git a/Task/Matrix-transposition/SPAD/matrix-transposition.spad b/Task/Matrix-transposition/SPAD/matrix-transposition.spad new file mode 100644 index 0000000000..cab809d343 --- /dev/null +++ b/Task/Matrix-transposition/SPAD/matrix-transposition.spad @@ -0,0 +1,24 @@ +(1) -> originalMatrix := matrix [[1, 1, 1, 1],[2, 4, 8, 16], _ + [3, 9, 27, 81],[4, 16, 64, 256], _ + [5, 25, 125, 625]] + + +1 1 1 1 + + | | + |2 4 8 16 | + | | + (1) |3 9 27 81 | + | | + |4 16 64 256| + | | + +5 25 125 625+ + Type: Matrix(Integer) +(2) -> transposedMatrix := transpose(originalMatrix) + + +1 2 3 4 5 + + | | + |1 4 9 16 25 | + (2) | | + |1 8 27 64 125| + | | + +1 16 81 256 625+ + Type: Matrix(Integer) diff --git a/Task/Matrix-transposition/Sidef/matrix-transposition.sidef b/Task/Matrix-transposition/Sidef/matrix-transposition.sidef new file mode 100644 index 0000000000..f70d6bc6d0 --- /dev/null +++ b/Task/Matrix-transposition/Sidef/matrix-transposition.sidef @@ -0,0 +1,15 @@ +func transpose(matrix) { + matrix[0].range.map{|i| matrix.map{_[i]}}; +}; + +var m = [ + [1, 1, 1, 1], + [2, 4, 8, 16], + [3, 9, 27, 81], + [4, 16, 64, 256], + [5, 25, 125, 625], +]; + +transpose(m).each { |row| + "%5d" * row.len -> printlnf(row...); +} diff --git a/Task/Matrix-transposition/Sparkling/matrix-transposition.sparkling b/Task/Matrix-transposition/Sparkling/matrix-transposition.sparkling new file mode 100644 index 0000000000..86e1a3cd96 --- /dev/null +++ b/Task/Matrix-transposition/Sparkling/matrix-transposition.sparkling @@ -0,0 +1,7 @@ +function transpose(A) { + return map(range(sizeof A), function(k, idx) { + return map(A, function(k, row) { + return row[idx]; + }); + }); +} diff --git a/Task/Matrix-transposition/Wortel/matrix-transposition.wortel b/Task/Matrix-transposition/Wortel/matrix-transposition.wortel new file mode 100644 index 0000000000..a05db3420b --- /dev/null +++ b/Task/Matrix-transposition/Wortel/matrix-transposition.wortel @@ -0,0 +1 @@ +@zipm [[1 2 3] [4 5 6] [7 8 9]] diff --git a/Task/Matrix-transposition/jq/matrix-transposition.jq b/Task/Matrix-transposition/jq/matrix-transposition.jq new file mode 100644 index 0000000000..1266c41c00 --- /dev/null +++ b/Task/Matrix-transposition/jq/matrix-transposition.jq @@ -0,0 +1,4 @@ +def transpose: + if (.[0] | length) == 0 then [] + else [map(.[0])] + (map(.[1:]) | transpose) + end ; diff --git a/Task/Maximum-triangle-path-sum/ERRE/maximum-triangle-path-sum.erre b/Task/Maximum-triangle-path-sum/ERRE/maximum-triangle-path-sum.erre new file mode 100644 index 0000000000..cfb86996ac --- /dev/null +++ b/Task/Maximum-triangle-path-sum/ERRE/maximum-triangle-path-sum.erre @@ -0,0 +1,56 @@ +PROGRAM TRIANGLE_PATH + +CONST ROW=18 + +DIM TRI[200] + +! +! for rosettacode,org +! + +FUNCTION MAX(X,Y) + MAX=-X*(X>=Y)-Y*(X=------ + +Dim As String ln +Dim As Integer matrix(1 To 20, 1 To 20) +Dim As Integer x = 1, y, s1, s2, size + +Do + Read ln + ln = Trim(ln) + If ln = "END" Then Exit Do + For y = 1 To x + matrix(x, y) = Val(Left(ln, 2)) + ln = Mid(ln, 4) + Next + x += 1 + size += 1 +Loop + +For x = size - 1 To 1 Step - 1 + For y = 1 To x + s1 = matrix(x + 1, y) + s2 = matrix(x + 1, y + 1) + If s1 > s2 Then + matrix(x, y) += s1 + Else + matrix(x, y) += s2 + End If + Next +Next + +Print +Print " maximum triangle path sum ="; matrix(1, 1) + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Maximum-triangle-path-sum/Nim/maximum-triangle-path-sum.nim b/Task/Maximum-triangle-path-sum/Nim/maximum-triangle-path-sum.nim new file mode 100644 index 0000000000..08c89dbfe1 --- /dev/null +++ b/Task/Maximum-triangle-path-sum/Nim/maximum-triangle-path-sum.nim @@ -0,0 +1,30 @@ +import strutils, future + +proc solve(tri): int = + var tri = tri + while tri.len > 1: + let t0 = tri.pop + for i, t in tri[tri.high]: tri[tri.high][i] = max(t0[i], t0[i+1]) + t + tri[0][0] + +const data = """ + 55 + 94 48 + 95 30 96 + 77 71 26 67 + 97 13 76 38 45 + 07 36 79 16 37 68 + 48 07 09 18 70 26 06 + 18 72 79 46 59 79 29 90 + 20 76 87 11 32 07 07 49 18 + 27 83 58 35 71 11 25 57 29 85 + 14 64 36 96 27 11 58 56 92 18 55 + 02 90 03 60 48 49 41 46 33 36 47 23 + 92 50 48 02 36 59 42 79 72 20 82 77 42 + 56 78 38 80 39 75 02 71 66 66 01 03 55 72 + 44 25 67 84 71 67 11 61 40 57 58 89 40 56 36 + 85 32 25 85 57 48 84 35 47 62 17 01 01 99 89 52 + 06 71 28 75 94 48 37 10 23 51 06 48 53 18 74 98 15 +27 02 92 23 08 71 76 84 15 52 92 63 81 10 44 10 69 93""" + +echo solve data.splitLines.map((x: string) => x.split.map parseInt) diff --git a/Task/Maximum-triangle-path-sum/Sidef/maximum-triangle-path-sum-1.sidef b/Task/Maximum-triangle-path-sum/Sidef/maximum-triangle-path-sum-1.sidef new file mode 100644 index 0000000000..8aef040332 --- /dev/null +++ b/Task/Maximum-triangle-path-sum/Sidef/maximum-triangle-path-sum-1.sidef @@ -0,0 +1,12 @@ +var sum = [0] + +ARGF.each { |line| + var x = line.words.map{.to_n} + sum = [ + x.first + sum.first, + 1 ..^ x.end -> map{|i| x[i] + [sum[i-1, i]].max}..., + x.last + sum.last, + ] +} + +say sum.max diff --git a/Task/Maximum-triangle-path-sum/Sidef/maximum-triangle-path-sum-2.sidef b/Task/Maximum-triangle-path-sum/Sidef/maximum-triangle-path-sum-2.sidef new file mode 100644 index 0000000000..c97843602e --- /dev/null +++ b/Task/Maximum-triangle-path-sum/Sidef/maximum-triangle-path-sum-2.sidef @@ -0,0 +1,8 @@ +var triangle = ARGF.slurp.lines.map{.words.map{.to_n}} +  +func max_value(i=0, j=0) is cached { + i == triangle.len && return 0 + triangle[i][j] + [max_value(i+1, j), max_value(i+1, j+1)].max +} +  +say max_value() diff --git a/Task/Maximum-triangle-path-sum/jq/maximum-triangle-path-sum.jq b/Task/Maximum-triangle-path-sum/jq/maximum-triangle-path-sum.jq new file mode 100644 index 0000000000..c08182c35e --- /dev/null +++ b/Task/Maximum-triangle-path-sum/jq/maximum-triangle-path-sum.jq @@ -0,0 +1,12 @@ +# Usage: TRIANGLE | solve +def solve: + + # update(next) updates the input row of maxima: + def update(next): + . as $maxima + | [ range(0; next|length) + | next[.] + ([$maxima[.], $maxima[. + 1]] | max) ]; + + . as $in + | reduce range(length -2; -1; -1) as $i + ($in[-1]; update( $in[$i] ) ) ; diff --git a/Task/Maze-generation/Elm/maze-generation.elm b/Task/Maze-generation/Elm/maze-generation.elm new file mode 100644 index 0000000000..067f3bffc0 --- /dev/null +++ b/Task/Maze-generation/Elm/maze-generation.elm @@ -0,0 +1,249 @@ +import Maybe as M +import Result as R +import Matrix +import Mouse +import Random exposing (Seed) +import Matrix.Random +import Time exposing (Time, every, second) +import Set exposing (Set, fromList) +import List exposing (..) +import String exposing (join) +import Html exposing (Html, br, input, h1, h2, text, div, button) +import Html.Events as HE +import Html.Attributes as HA +import Html.App exposing (program) +import Json.Decode as JD +import Svg +import Svg.Attributes exposing (version, viewBox, cx, cy, r, x, y, x1, y1, x2, y2, fill,points, style, width, height, preserveAspectRatio) + +minSide = 10 +maxSide = 40 +w = 700 +h = 700 +dt = 0.001 + +type alias Direction = Int +down = 0 +right = 1 + +type alias Door = (Matrix.Location, Direction) + +type State = Initial | Generating | Generated | Solved + +type alias Model = + { rows : Int + , cols : Int + , animate : Bool + , boxes : Matrix.Matrix Bool + , doors : Set Door + , current : List Matrix.Location + , state : State + , seedStarter : Int + , seed : Seed + } + +initdoors : Int -> Int -> Set Door +initdoors rows cols = + let + pairs la lb = List.concatMap (\at -> List.map ((,) at) lb) la + downs = pairs (pairs [0..rows-2] [0..cols-1]) [down] + rights = pairs (pairs [0..rows-1] [0..cols-2]) [right] + in downs ++ rights |> fromList + +initModel : Int -> Int -> Bool -> State -> Int -> Model +initModel rows cols animate state starter = + let rowGenerator = Random.int 0 (rows-1) + colGenerator = Random.int 0 (cols-1) + locationGenerator = Random.pair rowGenerator colGenerator + (c, s)= Random.step locationGenerator (Random.initialSeed starter) + in { rows = rows + , cols = cols + , animate = animate + , boxes = Matrix.matrix rows cols (\location -> state == Generating && location == c) + , doors = initdoors rows cols + , current = if state == Generating then [c] else [] + , state = state + , seedStarter = starter -- updated every Tick until maze generated. + , seed = s + } + +view model = + let + borderLineStyle = style "stroke:green;stroke-width:0.3" + wallLineStyle = style "stroke:green;stroke-width:0.1" + + x1Min = x1 <| toString 0 + y1Min = y1 <| toString 0 + x1Max = x1 <| toString model.cols + y1Max = y1 <| toString model.rows + x2Min = x2 <| toString 0 + y2Min = y2 <| toString 0 + x2Max = x2 <| toString model.cols + y2Max = y2 <| toString model.rows + + borders = [ Svg.line [ x1Min, y1Min, x2Max, y2Min, borderLineStyle ] [] + , Svg.line [ x1Max, y1Min, x2Max, y2Max, borderLineStyle ] [] + , Svg.line [ x1Max, y1Max, x2Min, y2Max, borderLineStyle ] [] + , Svg.line [ x1Min, y1Max, x2Min, y2Min, borderLineStyle ] [] + ] + + doorToLine door = + let (deltaX1, deltaY1) = if (snd door == right) then (1,0) else (0,1) + (row, column) = fst door + in Svg.line [ x1 <| toString (column + deltaX1) + , y1 <| toString (row + deltaY1) + , x2 <| toString (column + 1) + , y2 <| toString (row + 1) + , wallLineStyle ] [] + + doors = (List.map doorToLine <| Set.toList model.doors ) + + circleInBox (row,col) color = + Svg.circle [ r "0.25" + , fill (color) + , cx (toString (toFloat col + 0.5)) + , cy (toString (toFloat row + 0.5)) + ] [] + + showUnvisited location box = + if box then [] else [ circleInBox location "yellow" ] + + unvisited = model.boxes + |> Matrix.mapWithLocation showUnvisited + |> Matrix.flatten + |> concat + + current = + case head model.current of + Nothing -> [] + Just c -> [circleInBox c "black"] + + maze = + if model.animate || model.state /= Generating + then [ Svg.g [] <| doors ++ borders ++ unvisited ++ current ] + else [ Svg.g [] <| borders ] + in + div + [] + [ h2 [centerTitle] [text "Maze Generator"] + , div + [floatLeft] + ( slider "rows" minSide maxSide model.rows SetRows + ++ [ br [] [] ] + + ++ slider "cols" minSide maxSide model.cols SetCols + ++ [ br [] [] ] + + ++ checkbox "Animate" model.animate SetAnimate + ++ [ br [] [] ] + + ++ [ button + [ HE.onClick Generate ] + [ text "Generate"] + ] ) + , div + [floatLeft] + [ Svg.svg + [ version "1.1" + , width (toString w) + , height (toString h) + , viewBox (join " " + [ 0 |> toString + , 0 |> toString + , model.cols |> toString + , model.rows |> toString ]) + ] + maze + ] + ] + +checkbox label checked msg = + [ input + [ HA.type' "checkbox" + , HA.checked checked + , HE.on "change" (JD.map msg HE.targetChecked) + ] + [] + , text label + ] + +slider name min max current msg = + [ input + [ HA.value (if current >= min then current |> toString else "") + , HE.on "input" (JD.map msg HE.targetValue ) + , HA.type' "range" + , HA.min <| toString min + , HA.max <| toString max + ] + [] + , text <| name ++ "=" ++ (current |> toString) + ] + +floatLeft = HA.style [ ("float", "left") ] +centerTitle = HA.style [ ( "text-align", "center") ] + +unvisitedNeighbors : Model -> Matrix.Location -> List Matrix.Location +unvisitedNeighbors model (row,col) = + [(row, col-1), (row-1, col), (row, col+1), (row+1, col)] + |> List.filter (\l -> fst l >= 0 && snd l >= 0 && fst l < model.rows && snd l < model.cols) + |> List.filter (\l -> (Matrix.get l model.boxes) |> M.withDefault False |> not) + +updateModel' : Model -> Int -> Model +updateModel' model t = + case head model.current of + Nothing -> {model | state = Generated, seedStarter = t } + Just prev -> + let neighbors = unvisitedNeighbors model prev + in if (length neighbors) > 0 then + let (neighborIndex, seed) = Random.step (Random.int 0 (length neighbors-1)) model.seed + next = head (drop neighborIndex neighbors) |> M.withDefault (0,0) + boxes = Matrix.set next True model.boxes + dir = if fst prev == fst next then right else down + doorCell = if ( (dir == down) && (fst prev < fst next)) + || (dir == right ) && (snd prev < snd next) then prev else next + doors = Set.remove (doorCell, dir) model.doors + in {model | boxes=boxes, doors=doors, current=next :: model.current, seed=seed, seedStarter = t} + else + let tailCurrent = tail model.current |> M.withDefault [] + in updateModel' {model | current = tailCurrent} t + +updateModel : Msg -> Model -> Model +updateModel msg model = + let stringToCellCount s = + let v' = String.toInt s |> R.withDefault minSide + in if v' < minSide then minSide else v' + in case msg of + Tick tf -> + let t = truncate tf + in + if (model.state == Generating) then updateModel' model t + else { model | seedStarter = t } + + Generate -> + initModel model.rows model.cols model.animate Generating model.seedStarter + + SetRows countString -> + initModel (stringToCellCount countString) model.cols model.animate Initial model.seedStarter + + SetCols countString -> + initModel model.rows (stringToCellCount countString) model.animate Initial model.seedStarter + + SetAnimate b -> + { model | animate = b } + + NoOp -> model + +type Msg = NoOp | Tick Time | Generate | SetRows String | SetCols String | SetAnimate Bool + +subscriptions model = every (dt * second) Tick + +main = + let + update msg model = (updateModel msg model, Cmd.none) + init = (initModel 21 36 False Initial 0, Cmd.none) + in program + { init = init + , view = view + , update = update + , subscriptions = subscriptions + } diff --git a/Task/Maze-generation/FreeBASIC/maze-generation.freebasic b/Task/Maze-generation/FreeBASIC/maze-generation.freebasic new file mode 100644 index 0000000000..8580f79e03 --- /dev/null +++ b/Task/Maze-generation/FreeBASIC/maze-generation.freebasic @@ -0,0 +1,130 @@ +' version 04-12-2016 +' compile with: fbc -s console +' when generating a big maze it's possible to run out of stack space +' increase stack with the -t xxxx (xxxx is the amount you want in Kbytes) + +ReDim Shared As String d() ' directions +ReDim Shared As ULong c() ' cell's + +Sub cell(x As ULong, y As ULong, s As ULong) + + Dim As ULong x1, y1, di_n + c(x,y) = 1 ' mark as visited + + Do + Dim As String di = d(x, y) + Dim As Long l = Len(di) -1 + If l < 0 Then Exit Sub ' no directions left then exit + di_n = di[l] ' get direction + If l = 0 Then + d(x,y) = "" + Else + d(x,y) = Left(di,l) + End If + + Select Case di_n ' 0,0 is upper left corner + Case Asc("N") + x1 = x : y1 = y -1 + Case Asc("E") + x1 = x +1 : y1 = y + Case Asc("S") + x1 = x : y1 = y +1 + Case Asc("W") + x1 = x -1 : y1 = y + End Select + + If c(x1,y1) <> 0 Then Continue Do + + Select Case di_n ' 0,0 is upper left corner + Case Asc("N") + Line (x * s +1 , y * s) - ((x +1) * s -1, y * s),0 + Case Asc("E") + Line (x1 * s, y * s +1) - (x1 * s, (y +1) * s -1),0 + Case Asc("S") + Line (x * s +1, y1 * s) - ((x +1) * s -1, y1 * s),0 + Case Asc("W") + Line (x * s , y * s +1) - (x * s, (y +1) * s -1),0 + End Select + + cell(x1, y1, s) + Loop + +End Sub + +Sub gen_maze(w As ULong, h As ULong, s As ULong) + + ReDim d(w, h) + ReDim c(w, h) + Dim As ULong x, y, r, i + Dim As String di + + d(0, 0) = "SE" ' cornes + d(0, h -1) ="NE" + d(w -1, 0) ="SW" + d(w -1, h -1) ="NW" + + For x = 1 To w -2 ' sides + d(x,0) = "EWS" + d(x,h -1) = "NEW" + Next + + For y = 1 To h -2 + d(0, y) = "NSE" + d(w -1, y) ="NSW" + Next + + For x = 0 To w -1 ' shuffle directions + For y = 0 To h -1 + di = d(x,y) + If di = "" Then di = "NEWS" + i = Len(di) + Do + r = Fix(Rnd * i) + i = i - 1 + Swap di[r], di[i] + Loop Until i = 0 + d(x,y) = di + Next + Next + + ScreenRes w * s +1, h * s +1, 8 + ' draw the grid + For x = 0 To w + Line (x * s, 0) - (x * s, h * s), 2 ' green color + Next + + For y = 0 To h + Line(0, y * s) - (w* s, y * s),2 + Next + ' choice the start cell + x = Fix(Rnd * w) + y = Fix(Rnd * h) + + cell(x, y, s) + +End Sub + +' ------=< MAIN >=------ + +Randomize Timer + +Dim As ULong t + +Do + ' gen_maxe(width, height, cell size) + gen_maze(30, 30, 20) + WindowTitle " S to save, N for next maze, other key to stop" + Do + Var key = Inkey + key = UCase(key) + If key = "S" Then + t = t +1 + BSave("maze" + Str(t) + ".bmp"), 0 + key = "" + End If + If key = "N" Then Continue Do, Do + If key <> "" Then Exit Do, Do + Loop +Loop + +End diff --git a/Task/Maze-generation/Nim/maze-generation.nim b/Task/Maze-generation/Nim/maze-generation.nim new file mode 100644 index 0000000000..097bf5f564 --- /dev/null +++ b/Task/Maze-generation/Nim/maze-generation.nim @@ -0,0 +1,37 @@ +import math, sequtils, strutils +randomize() + +template newSeqWith(len: int, init: expr): expr = + var result {.gensym.} = newSeq[type(init)](len) + for i in 0 .. map {([true] * w) + [false]} + [[false] * w+1]) +var ver = (1..h -> map {["| "] * w }) +var hor = (0..h -> map {["+--"] * w }) + +func walk(x, y) { + cell[y][x] = false; + avail-- > 0 || return; # no more bottles, er, cells + + var d = [[-1, 0], [0, 1], [1, 0], [0, -1]] + while (!d.is_empty) { + var i = d.pop_rand + var (x1, y1) = (x + i[0], y + i[1]) + + cell[y1][x1] || next + + if (x == x1) { hor[[y1, y].max][x] = '+ ' } + if (y == y1) { ver[y][[x1, x].max] = ' ' } + walk(x1, y1) + } +} + +walk(w.rand.int, h.rand.int) # generate + +for i in (0 .. h) { + say (hor[i].join('') + '+') + if (i < h) { + say (ver[i].join('') + '|') + } +} diff --git a/Task/Maze-generation/Swift/maze-generation.swift b/Task/Maze-generation/Swift/maze-generation.swift new file mode 100644 index 0000000000..aad22146fb --- /dev/null +++ b/Task/Maze-generation/Swift/maze-generation.swift @@ -0,0 +1,109 @@ +import Foundation + +class Direction { + var vect:(Int, Int, Int) + var bit:Int { + let (bit, dx, dy) = vect + return bit + } + + var dx:Int { + let (bit, dx, dy) = vect + return dx + } + + var dy:Int { + let (bit, dx, dy) = vect + return dy + } + + var opposite:Direction { + switch (vect) { + case (1, 0, -1): + return Direction(bit: 2, dx: 0, dy: 1) + case (2, 0, 1): + return Direction(bit: 1, dx: 0, dy: -1) + case (4, 1, 0): + return Direction(bit: 8, dx: -1, dy: 0) + case (8, -1, 0): + return Direction(bit: 4, dx: 1, dy: 0) + default: + return Direction(bit: 0, dx: 0, dy: 0) + } + } + + init(bit:Int, dx:Int, dy:Int) { + self.vect = (bit, dx, dy) + } +} + +let N = Direction(bit: 1, dx: 0, dy: -1) +let S = Direction(bit: 2, dx: 0, dy: 1) +let E = Direction(bit: 4, dx: 1, dy: 0) +let W = Direction(bit: 8, dx: -1, dy: 0) + +class MazeGenerator { + let x:Int! + let y:Int! + var maze:[[Int]]! + + init(_ x:Int, _ y:Int) { + self.x = x + self.y = y + var col = [Int](count: y, repeatedValue: 0) + self.maze = [[Int]](count: x, repeatedValue: col) + generateMaze(0, 0) + } + + func display() { + for i in 0.. Bool { + return (v >= 0) && (v < upper) + } +} + +let x = 10 +let y = 10 +let maze = MazeGenerator(x, y) +maze.display() diff --git a/Task/Memory-allocation/Axe/memory-allocation.axe b/Task/Memory-allocation/Axe/memory-allocation.axe new file mode 100644 index 0000000000..5d88be37fa --- /dev/null +++ b/Task/Memory-allocation/Axe/memory-allocation.axe @@ -0,0 +1,2 @@ +Buff(100)→Str1 +.Str1 points to a 100-byte memory region allocated at compile time diff --git a/Task/Memory-allocation/Lingo/memory-allocation.lingo b/Task/Memory-allocation/Lingo/memory-allocation.lingo new file mode 100644 index 0000000000..3fb8f57275 --- /dev/null +++ b/Task/Memory-allocation/Lingo/memory-allocation.lingo @@ -0,0 +1,6 @@ +-- Create a ByteArray of 100 Kb (pre-filled with 0 bytes) +ba = byteArray(102400) + +-- Lingo uses garbage-collection, so allocated memory is released when no more references exist. +-- For the above variable ba, this can be achieved by calling: +ba = VOID diff --git a/Task/Memory-allocation/Nim/memory-allocation.nim b/Task/Memory-allocation/Nim/memory-allocation.nim new file mode 100644 index 0000000000..bf082498d1 --- /dev/null +++ b/Task/Memory-allocation/Nim/memory-allocation.nim @@ -0,0 +1,7 @@ +# Allocate thread local heap memory +var a = alloc(1000) +dealloc(a) + +# Allocate memory block on shared heap +var b = allocShared(1000) +deallocShared(b) diff --git a/Task/Memory-allocation/Phix/memory-allocation.phix b/Task/Memory-allocation/Phix/memory-allocation.phix new file mode 100644 index 0000000000..30edd37ff9 --- /dev/null +++ b/Task/Memory-allocation/Phix/memory-allocation.phix @@ -0,0 +1,5 @@ +atom addr = allocate(512) -- limit is 1,610,612,728 bytes on 32-bit systems +... +free(addr) +atom addr2 = allocate(512,1) -- automatically freed when addr2 drops out of scope or re-assigned +atom addr3 = allocate_string("a string",1) -- automatically freed when addr3 drops out of scope or re-assigned diff --git a/Task/Memory-allocation/Ring/memory-allocation.ring b/Task/Memory-allocation/Ring/memory-allocation.ring new file mode 100644 index 0000000000..0976d9f4c3 --- /dev/null +++ b/Task/Memory-allocation/Ring/memory-allocation.ring @@ -0,0 +1,2 @@ +cVar = " " # create variable contains string of 5 bytes +cVar = NULL # destroy the 5 bytes string ! diff --git a/Task/Memory-layout-of-a-data-structure/FreeBASIC/memory-layout-of-a-data-structure.freebasic b/Task/Memory-layout-of-a-data-structure/FreeBASIC/memory-layout-of-a-data-structure.freebasic new file mode 100644 index 0000000000..54e6469b07 --- /dev/null +++ b/Task/Memory-layout-of-a-data-structure/FreeBASIC/memory-layout-of-a-data-structure.freebasic @@ -0,0 +1,17 @@ +' FB 1.05.0 Win64 + +' using bit fields +Type RS232_Pin9 + carrierDetect : 1 As UByte + receivedData : 1 As UByte + transmittedData : 1 As UByte + dataTerminalReady : 1 As UByte + signalGround : 1 As UByte + dataSetReady : 1 As UByte + requestToSend : 1 As UByte + clearToSend : 1 As UByte + ringIndicator : 1 As UByte +End Type + +Print SizeOf(RS232_Pin9) '' 2 bytes +Sleep diff --git a/Task/Memory-layout-of-a-data-structure/Nim/memory-layout-of-a-data-structure.nim b/Task/Memory-layout-of-a-data-structure/Nim/memory-layout-of-a-data-structure.nim new file mode 100644 index 0000000000..05a1fe05c1 --- /dev/null +++ b/Task/Memory-layout-of-a-data-structure/Nim/memory-layout-of-a-data-structure.nim @@ -0,0 +1,19 @@ +type + rs232Data = enum + carrierDetect, + receivedData, + transmittedData, + dataTerminalReady, + signalGround, + dataSetReady, + requestToSend, + clearToSend, + ringIndicator + +# Bit vector of 9 bits +var bv = {carrierDetect, signalGround, ringIndicator} +echo cast[uint16](bv) # Conversion of bitvector to 2 bytes for writing + +let readValue: uint16 = 123 +bv = cast[set[rs232Data]](readValue) # Conversion of a read value to bitvector +echo bv diff --git a/Task/Menu/Axe/menu.axe b/Task/Menu/Axe/menu.axe new file mode 100644 index 0000000000..ebd3ebad0b --- /dev/null +++ b/Task/Menu/Axe/menu.axe @@ -0,0 +1,15 @@ +"FEE FIE"→Str1 +"HUFF AND PUFF"→Str2 +"MIRROR MIRROR"→Str3 +"TICK TOCK"→Str4 +For(I,1,4) + Disp I▶Hex+3,":",strGet(Str1,I-1),i +End +Disp "NUMBER? " +input→A +{A}-'0'→N +If N<1 or N>4 + Disp "BAD NUMBER",i + Return +End +Disp strGet(Str1,N-1),i diff --git a/Task/Menu/Ceylon/menu.ceylon b/Task/Menu/Ceylon/menu.ceylon new file mode 100644 index 0000000000..1400af4fd9 --- /dev/null +++ b/Task/Menu/Ceylon/menu.ceylon @@ -0,0 +1,22 @@ +"Run the module `menu`." +shared void run() { + value selection = menu("fee fie", "huff And puff", "mirror mirror", "tick tock"); + print(selection); +} + +String menu(String* strings) { + if(strings.empty) { + return ""; + } + value entries = map(zipEntries(1..strings.size, strings)); + while(true) { + for(index->string in entries) { + print("``index``) ``string``"); + } + process.write("> "); + value input = process.readLine(); + if(exists input, exists int = parseInteger(input), exists string = entries[int]) { + return string; + } + } +} diff --git a/Task/Menu/ERRE/menu.erre b/Task/Menu/ERRE/menu.erre new file mode 100644 index 0000000000..73a2f0058c --- /dev/null +++ b/Task/Menu/ERRE/menu.erre @@ -0,0 +1,16 @@ +PROCEDURE Selection(choices$[],prompt$->sel$) + IF UBOUND(choices$,1)-LBOUND(choices$,1)=0 THEN + sel$="" + EXIT PROCEDURE + END IF + ret$="" + REPEAT + FOR i=LBOUND(choices$,1) TO UBOUND(choices$,1) DO + PRINT(i;": ";choices$[i]) + END FOR + PRINT(prompt$;) + INPUT(index) + IF index<=UBOUND(choices$,1) AND index>=LBOUND(choices$,1) THEN ret$=choices$[index] END IF + UNTIL ret$<>"" + sel$=ret$ +END PROCEDURE diff --git a/Task/Menu/Nim/menu.nim b/Task/Menu/Nim/menu.nim new file mode 100644 index 0000000000..889cddf89c --- /dev/null +++ b/Task/Menu/Nim/menu.nim @@ -0,0 +1,22 @@ +import strutils, rdstdin + +proc menu(xs) = + for i,x in xs: echo " ",i,") ",x + +proc ok(reply, count): bool = + try: + let n = parseInt(reply) + return 0 <= n and n < count + except: return false + +proc selector(xs, prompt): string = + if xs.len == 0: return "" + var reply = "-1" + while not ok(reply, xs.len): + menu(xs) + reply = readLineFromStdin(prompt).strip() + return xs[parseInt(reply)] + +const xs = ["fee fie", "huff and puff", "mirror mirror", "tick tock"] +let item = selector(xs, "Which is from the three pigs: ") +echo "You chose: ", item diff --git a/Task/Menu/Phix/menu.phix b/Task/Menu/Phix/menu.phix new file mode 100644 index 0000000000..ae59fd6231 --- /dev/null +++ b/Task/Menu/Phix/menu.phix @@ -0,0 +1,23 @@ +function menu_select(sequence items, object prompt) +sequence res +integer nres + if length(items)=0 then return 0 end if + while 1 do + for i = 1 to length(items) do + printf(1,"%d) %s\n",{i,items[i]}) + end for + + puts(1,iff(atom(prompt)?"Choice?":prompt)) + res = scanf(trim(gets(0)),"%d") + puts(1,"\n") + if length(res)=1 then + nres = res[1][1] + if nres>0 and nres<=length(items) then exit end if + end if + end while + return nres +end function + +constant items = {"fee fie", "huff and puff", "mirror mirror", "tick tock"} +integer n = menu_select(items,"Which is from the three pigs? ") +printf(1,"You chose %d(%s).\n",{n,items[n]}) diff --git a/Task/Menu/Ring/menu.ring b/Task/Menu/Ring/menu.ring new file mode 100644 index 0000000000..79c233dc52 --- /dev/null +++ b/Task/Menu/Ring/menu.ring @@ -0,0 +1,19 @@ +aList = ["fee fie", "huff and puff", "mirror mirror", "tick tock"] +selected = menu(aList, "please make a selection: ") +see "" + selected + nl + +func menu aList, prompt + ndex = 1 + while index>0 and index<=len(aList) + for index = 1 to len(aList) + if aList[index]!="" see "" + index + " : " + aList[index] + " " ok + next + see nl + see prompt + give select + index = number(select) + see "" + aList[index] + nl + if select!=string(index) index = -1 ok + if index>=0 if index<=len(aList) if aList[index]="" index = -1 ok ok ok + end + return aList[index] diff --git a/Task/Menu/Sidef/menu.sidef b/Task/Menu/Sidef/menu.sidef new file mode 100644 index 0000000000..4901bd2669 --- /dev/null +++ b/Task/Menu/Sidef/menu.sidef @@ -0,0 +1,17 @@ +func menu (prompt, arr) { + arr.len > 0 || return '' + loop { + for i in ^arr { + say " #{i}: #{arr[i]}" + } + var n = Sys.scanln(prompt) \\ return() + n ~~ /^[0-9]+\z/ ? Num(n) : next + arr.exists(n) && return arr[n] + } +} + +var list = ['fee fie', 'huff and puff', 'mirror mirror', 'tick tock'] +var prompt = 'Please choose an item number: ' + +var answer = menu(prompt, list) +say "You choose: #{answer}" diff --git a/Task/Menu/Ursa/menu.ursa b/Task/Menu/Ursa/menu.ursa new file mode 100644 index 0000000000..f5102b990a --- /dev/null +++ b/Task/Menu/Ursa/menu.ursa @@ -0,0 +1,37 @@ +def _menu (string<> items) + for (decl int i) (< i (size items)) (inc i) + out " " i ") " items endl console + end for +end _menu + +def _ok (string reply, int itemcount) + try + decl int n + set n (int reply) + return (and (or (> n 0) (= n 0)) (< n itemcount)) + catch + return false + end try +end _ok + +def selector (string<> items, string prompt) + # Prompt to select an item from the items + if (= (size items) 0) + return "" + end if + decl int itemcount reply + set reply -1 + set itemcount (size items) + while (not (_ok reply itemcount)) + _menu items + out prompt console + set reply (in int console) + end while + return items<(int reply)> +end selector + +decl string<> items +append "fee fie" "huff and puff" "mirror mirror" "tick tock" items +decl string item +set item (selector items "Which is from the three pigs: ") +out "You chose: " item endl console diff --git a/Task/Menu/jq/menu-1.jq b/Task/Menu/jq/menu-1.jq new file mode 100644 index 0000000000..4e8ab1af3d --- /dev/null +++ b/Task/Menu/jq/menu-1.jq @@ -0,0 +1,19 @@ +def choice: + def read(prompt; max): + def __read__: + prompt, + ( input as $input + | if ($input|type) == "number" and 0 < $input and $input <= max then $input + else __read__ + end); + __read__; + + if length == 0 then "" + else + . as $in + | ("Enter your choice:\n" + + (reduce range(0; length) as $i (""; . + "\($i + 1): \($in[$i])\n")) ) as $prompt + | read($prompt; length) as $read + | if ($read|type) == "string" then $read + else "Thank you for selecting \($in[$read-1])" end + end ; diff --git a/Task/Menu/jq/menu-2.jq b/Task/Menu/jq/menu-2.jq new file mode 100644 index 0000000000..4515f2fe87 --- /dev/null +++ b/Task/Menu/jq/menu-2.jq @@ -0,0 +1 @@ +["fee fie", "huff and puff", "mirror mirror", "tick tock"] | choice diff --git a/Task/Menu/jq/menu-3.jq b/Task/Menu/jq/menu-3.jq new file mode 100644 index 0000000000..5b59bcab5e --- /dev/null +++ b/Task/Menu/jq/menu-3.jq @@ -0,0 +1,16 @@ +$ jq -n -r -f Menu.jq +Enter your choice: +1: fee fie +2: huff and puff +3: mirror mirror +4: tick tock + +5 +Enter your choice: +1: fee fie +2: huff and puff +3: mirror mirror +4: tick tock + +1 +Thank you for selecting fee fie diff --git a/Task/Metaprogramming/FreeBASIC/metaprogramming.freebasic b/Task/Metaprogramming/FreeBASIC/metaprogramming.freebasic new file mode 100644 index 0000000000..dad5db4790 --- /dev/null +++ b/Task/Metaprogramming/FreeBASIC/metaprogramming.freebasic @@ -0,0 +1,16 @@ +' FB 1.05.0 Win64 + +#Macro ForAll(C, S) +For _i as integer = 0 To Len(s) +#Define C (Chr(s[_i])) +#EndMacro + +#Define In , + +Dim s As String = "Rosetta" +ForAll(c in s) + Print c; " "; +Next + +Print +Sleep diff --git a/Task/Metaprogramming/Lingo/metaprogramming.lingo b/Task/Metaprogramming/Lingo/metaprogramming.lingo new file mode 100644 index 0000000000..eb6474f2ad --- /dev/null +++ b/Task/Metaprogramming/Lingo/metaprogramming.lingo @@ -0,0 +1,3 @@ +r = RETURN +str = "on halt"&r&"--do nothing"&r&"end" +new(#script).scripttext = str diff --git a/Task/Metaprogramming/Nim/metaprogramming-1.nim b/Task/Metaprogramming/Nim/metaprogramming-1.nim new file mode 100644 index 0000000000..474335b20a --- /dev/null +++ b/Task/Metaprogramming/Nim/metaprogramming-1.nim @@ -0,0 +1,11 @@ +proc `^`*[T: SomeInteger](base: T, exp: T): T = + var (base, exp) = (base, exp) + result = 1 + + while exp != 0: + if (exp and 1) != 0: + result *= base + exp = exp shr 1 + base *= base + +echo 2 ^ 10 # 1024 diff --git a/Task/Metaprogramming/Nim/metaprogramming-2.nim b/Task/Metaprogramming/Nim/metaprogramming-2.nim new file mode 100644 index 0000000000..07e8529e76 --- /dev/null +++ b/Task/Metaprogramming/Nim/metaprogramming-2.nim @@ -0,0 +1,6 @@ +when defined windows: + echo "Call some Windows specific functions here" +elif defined linux: + echo "Call some Linux specific functions here" +else: + echo "Code for the other platforms" diff --git a/Task/Metaprogramming/Nim/metaprogramming-3.nim b/Task/Metaprogramming/Nim/metaprogramming-3.nim new file mode 100644 index 0000000000..41879a9a66 --- /dev/null +++ b/Task/Metaprogramming/Nim/metaprogramming-3.nim @@ -0,0 +1,2 @@ +static: + echo "Hello Compile time world: ", 2 ^ 10 diff --git a/Task/Metaprogramming/Nim/metaprogramming-4.nim b/Task/Metaprogramming/Nim/metaprogramming-4.nim new file mode 100644 index 0000000000..39161aa438 --- /dev/null +++ b/Task/Metaprogramming/Nim/metaprogramming-4.nim @@ -0,0 +1 @@ +const x = 2 ^ 10 diff --git a/Task/Metaprogramming/Nim/metaprogramming-5.nim b/Task/Metaprogramming/Nim/metaprogramming-5.nim new file mode 100644 index 0000000000..83dc032bdc --- /dev/null +++ b/Task/Metaprogramming/Nim/metaprogramming-5.nim @@ -0,0 +1,14 @@ +import os + +const debug = false + +proc expensive: string = + sleep(milsecs = 100) + result = "That was difficult" + +proc log(msg: string) = + if debug: + echo msg + +for i in 1..10: + log expensive() diff --git a/Task/Metaprogramming/Nim/metaprogramming-6.nim b/Task/Metaprogramming/Nim/metaprogramming-6.nim new file mode 100644 index 0000000000..b3226c2a20 --- /dev/null +++ b/Task/Metaprogramming/Nim/metaprogramming-6.nim @@ -0,0 +1,6 @@ +template log(msg: string) = + if debug: + echo msg + +for i in 1..10: + log expensive() diff --git a/Task/Metaprogramming/Nim/metaprogramming-7.nim b/Task/Metaprogramming/Nim/metaprogramming-7.nim new file mode 100644 index 0000000000..d5fcd84467 --- /dev/null +++ b/Task/Metaprogramming/Nim/metaprogramming-7.nim @@ -0,0 +1,7 @@ +template times(x: expr, y: stmt): stmt = + for i in 1..x: + y + +10.times: # or times 10: + echo "hi" + echo "bye" diff --git a/Task/Metaprogramming/Nim/metaprogramming-8.nim b/Task/Metaprogramming/Nim/metaprogramming-8.nim new file mode 100644 index 0000000000..5e61343221 --- /dev/null +++ b/Task/Metaprogramming/Nim/metaprogramming-8.nim @@ -0,0 +1,15 @@ +template optLog1{a and a}(a): auto = a +template optLog2{a and (b or (not b))}(a,b): auto = a +template optLog3{a and not a}(a: int): auto = 0 + +var + x = 12 + s = x and x + # Hint: optLog1(x) --> ’x’ [Pattern] + + r = (x and x) and ((s or s) or (not (s or s))) + # Hint: optLog2(x and x, s or s) --> ’x and x’ [Pattern] + # Hint: optLog1(x) --> ’x’ [Pattern] + + q = (s and not x) and not (s and not x) + # Hint: optLog3(s and not x) --> ’0’ [Pattern] diff --git a/Task/Metaprogramming/Nim/metaprogramming-9.nim b/Task/Metaprogramming/Nim/metaprogramming-9.nim new file mode 100644 index 0000000000..d5f3e6c29b --- /dev/null +++ b/Task/Metaprogramming/Nim/metaprogramming-9.nim @@ -0,0 +1,13 @@ +import macros + +dumpTree: + if x: + if y: + p0 + else: + p1 + else: + if y: + p2 + else: + p3 diff --git a/Task/Metaprogramming/Ring/metaprogramming-1.ring b/Task/Metaprogramming/Ring/metaprogramming-1.ring new file mode 100644 index 0000000000..664991adc5 --- /dev/null +++ b/Task/Metaprogramming/Ring/metaprogramming-1.ring @@ -0,0 +1,5 @@ +o1 = new point { x=10 y=20 z=30 } +addmethod(o1,"print", func { see x + nl + y + nl + z + nl } ) +o1.print() +Class point + x y z diff --git a/Task/Metaprogramming/Ring/metaprogramming-2.ring b/Task/Metaprogramming/Ring/metaprogramming-2.ring new file mode 100644 index 0000000000..cfcdfeaeba --- /dev/null +++ b/Task/Metaprogramming/Ring/metaprogramming-2.ring @@ -0,0 +1,44 @@ +New App +{ + I want window + The window title = "hello world" +} + +Class App + + func geti + if nIwantwindow = 0 + nIwantwindow++ + ok + + func getwant + if nIwantwindow = 1 + nIwantwindow++ + ok + + func getwindow + if nIwantwindow = 2 + nIwantwindow= 0 + see "Instruction : I want window" + nl + ok + if nWindowTitle = 0 + nWindowTitle++ + ok + + func settitle cValue + if nWindowTitle = 1 + nWindowTitle=0 + see "Instruction : Window Title = " + cValue + nl + ok + + private + + # Attributes for the instruction I want window + i want window + nIwantwindow = 0 + # Attributes for the instruction Window title + # Here we don't define the window attribute again + title + nWindowTitle = 0 + # Keywords to ignore, just give them any value + the=0 diff --git a/Task/Metaprogramming/Shen/metaprogramming-1.shen b/Task/Metaprogramming/Shen/metaprogramming-1.shen new file mode 100644 index 0000000000..4f6f621994 --- /dev/null +++ b/Task/Metaprogramming/Shen/metaprogramming-1.shen @@ -0,0 +1,8 @@ +(define make-list + [A|D] -> [cons (make-list A) (make-list D)] + X -> X) + +(defmacro info-macro + [info Exp] -> [output "~A: ~A~%" (make-list Exp) Exp]) + +(info (* 5 6)) \\ outputs [* 5 6]: 30 diff --git a/Task/Metaprogramming/Shen/metaprogramming-2.shen b/Task/Metaprogramming/Shen/metaprogramming-2.shen new file mode 100644 index 0000000000..bcc85dedef --- /dev/null +++ b/Task/Metaprogramming/Shen/metaprogramming-2.shen @@ -0,0 +1,7 @@ +(0-) (defmacro +-macro + [A + B] -> [+ A B]) +macro ++-macro + +(1-) (1 + (* 2 3)) +7 diff --git a/Task/Metaprogramming/Shen/metaprogramming-3.shen b/Task/Metaprogramming/Shen/metaprogramming-3.shen new file mode 100644 index 0000000000..30cfef3979 --- /dev/null +++ b/Task/Metaprogramming/Shen/metaprogramming-3.shen @@ -0,0 +1,14 @@ +(2-) (tc +) +true + +(3+) (+ 1 2 3) +6 : number + +(4+) + ++ : (number --> (number --> number)) + +(5-) (tc -) +false + +(6-) (macroexpand [+ 1 2 3]) +[+ 1 [+ 2 3]] diff --git a/Task/Metaprogramming/Sidef/metaprogramming-1.sidef b/Task/Metaprogramming/Sidef/metaprogramming-1.sidef new file mode 100644 index 0000000000..729c1f1836 --- /dev/null +++ b/Task/Metaprogramming/Sidef/metaprogramming-1.sidef @@ -0,0 +1,7 @@ +class Number { + method ⊕(arg) { + self + arg + } +} + +say (21 ⊕ 42) diff --git a/Task/Metaprogramming/Sidef/metaprogramming-2.sidef b/Task/Metaprogramming/Sidef/metaprogramming-2.sidef new file mode 100644 index 0000000000..2611bd29b1 --- /dev/null +++ b/Task/Metaprogramming/Sidef/metaprogramming-2.sidef @@ -0,0 +1,20 @@ +var colors = Hash( + 'black' => "000", + 'red' => "f00", + 'green' => "0f0", + 'yellow' => "ff0", + 'blue' => "00f", + 'magenta' => "f0f", + 'cyan' => "0ff", + 'white' => "fff", + ) + +colors.each { |color, code| + String.def_method("in_#{color}", func (self) { + '' + self + '' + }) +} + +say "blue".in_blue; +say "red".in_red; +say "white".in_white; diff --git a/Task/Metered-concurrency/EchoLisp/metered-concurrency.echolisp b/Task/Metered-concurrency/EchoLisp/metered-concurrency.echolisp new file mode 100644 index 0000000000..9a39a51ce2 --- /dev/null +++ b/Task/Metered-concurrency/EchoLisp/metered-concurrency.echolisp @@ -0,0 +1,13 @@ +(require 'tasks) ;; tasks library + +(define (task id) + (wait S) ;; acquire, p-op + (printf "task %d acquires semaphore @ %a" id (date->time-string (current-date))) + (sleep 2000) + (signal S) ;; release, v-op + id) + +(define S (make-semaphore 4)) ;; semaphore with init count 4 + +;; run 10 // tasks +(for ([i 10]) (task-run (make-task task i ) (random 500))) diff --git a/Task/Metered-concurrency/Oforth/metered-concurrency-1.oforth b/Task/Metered-concurrency/Oforth/metered-concurrency-1.oforth new file mode 100644 index 0000000000..f085a33f07 --- /dev/null +++ b/Task/Metered-concurrency/Oforth/metered-concurrency-1.oforth @@ -0,0 +1,10 @@ +import: parallel + +Object Class new: Semaphore(ch) + +Semaphore method: initialize(n) + Channel newSize(n) dup := ch + #[ 1 over send drop ] times(n) drop ; + +Semaphore method: acquire @ch receive drop ; +Semaphore method: release 1 @ch send drop ; diff --git a/Task/Metered-concurrency/Oforth/metered-concurrency-2.oforth b/Task/Metered-concurrency/Oforth/metered-concurrency-2.oforth new file mode 100644 index 0000000000..50b53f23cc --- /dev/null +++ b/Task/Metered-concurrency/Oforth/metered-concurrency-2.oforth @@ -0,0 +1,11 @@ +: mytask(s) + while( true ) [ + s acquire "Semaphore acquired" .cr + 2000 sleep + s release "Semaphore released" .cr + ] ; + +: test(n) +| s i | + Semaphore new(n) ->s + 10 loop: i [ #[ s mytask ] & ] ; diff --git a/Task/Metronome/EchoLisp/metronome.echolisp b/Task/Metronome/EchoLisp/metronome.echolisp new file mode 100644 index 0000000000..1b9fc4b1e7 --- /dev/null +++ b/Task/Metronome/EchoLisp/metronome.echolisp @@ -0,0 +1,6 @@ +;; available preloaded sounds are : ok, ko, tick, tack, woosh, beep, digit . +(lib 'timer) + +(define (metronome) (blink) (play-sound 'tack)) +(at-every 1000 'metronome) ;; every 1000 msec +;; CTRL-C to stop diff --git a/Task/Middle-three-digits/ERRE/middle-three-digits.erre b/Task/Middle-three-digits/ERRE/middle-three-digits.erre new file mode 100644 index 0000000000..053f4c86ae --- /dev/null +++ b/Task/Middle-three-digits/ERRE/middle-three-digits.erre @@ -0,0 +1,44 @@ +PROGRAM MIDDLE + +!$DOUBLE + +FUNCTION LUNG(N) + LUNG=LEN(STR$(INT(ABS(N))))+1 +END FUNCTION + +FUNCTION NCNT(N) + NCNT=VAL(MID$(STR$(INT(ABS(N))),(LUNG(N)-1)/2,3)) +END FUNCTION + +FUNCTION EVEN(N) + EVEN=INT(N/2)=N/2 +END FUNCTION + +PROCEDURE NUMBER_EXAM(N->R$) + R$="" LG%=LUNG(N)-2 + IF EVEN(LG%) THEN R$="?EVEN," END IF + IF LG%<3 THEN + R$=R$+"ONLY"+STR$(LG%)+" DIGIT" + IF LG%=1 THEN + R$=R$+"S" + END IF + END IF + IF RIGHT$(R$,1)="," THEN R$=LEFT$(R$,LEN(R$)-1) EXIT PROCEDURE END IF + IF LEFT$(R$,1)="?" THEN EXIT PROCEDURE END IF + IF R$<>"" THEN R$="?"+R$ EXIT PROCEDURE END IF + R$=STR$(NCNT(N)) + IF LEFT$(R$,1)=" " THEN R$=MID$(R$,2) END IF + IF LEN(R$)=1 THEN R$="00"+R$ END IF + IF LEN(R$)=2 THEN R$="0"+R$ END IF +END PROCEDURE + +BEGIN + DATA(123,12345,1234567,987654321,10001,-10001,-123,-100,100,-12345) + DATA(1,2,-1,-10,2002,-2002,0) + FOR I%=1 TO 17 DO + READ(N) + PRINT(N;" ",) + NUMBER_EXAM(N->R$) + PRINT(R$) + END FOR +END PROGRAM diff --git a/Task/Middle-three-digits/FreeBASIC/middle-three-digits.freebasic b/Task/Middle-three-digits/FreeBASIC/middle-three-digits.freebasic new file mode 100644 index 0000000000..df6a119c0d --- /dev/null +++ b/Task/Middle-three-digits/FreeBASIC/middle-three-digits.freebasic @@ -0,0 +1,32 @@ +' FB 1.05.0 Win64 + +Function middleThreeDigits (n As Integer) As String + If n < 0 Then n = -n + If n < 100 Then Return "" '' error code + If n < 1000 Then Return Str(n) + If n < 10000 Then Return "" + Dim ns As String = Str(n) + If Len(ns) Mod 2 = 0 Then Return "" '' need to have an odd number of digits for there to be 3 middle + Return Mid(ns, Len(ns) \ 2, 3) +End Function + +Dim a(1 To 16) As Integer => _ +{123, 12345, 1234567, 987654321, 10001, -10001, -123, -100, 100, -123451, 2, -1, -10, 2002, -2002, 0} + +Dim As Integer i +Dim As String result + +Print "The 3 middle digits of the following numbers are : " +Print +For i = 1 To 16 + result = middleThreeDigits(a(i)) + Print a(i), " => "; + If result <> "" Then + Print result + Else + Print "Error: does not have 3 middle digits" + End If +Next +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Middle-three-digits/Klong/middle-three-digits.klong b/Task/Middle-three-digits/Klong/middle-three-digits.klong new file mode 100644 index 0000000000..c0ceb22ff2 --- /dev/null +++ b/Task/Middle-three-digits/Klong/middle-three-digits.klong @@ -0,0 +1,4 @@ +items::[123 12345 1234567 987654321 10001 -10001 -123 -100 100 -12345 1 2 -1 -10 2002 -2002 0] + +mid3::{[d k];:[3>k::#$#x;"small":|0=k!2;"even";(-d)_(d::_(k%2)-1)_$#x]} +.p(mid3'items) diff --git a/Task/Middle-three-digits/Lasso/middle-three-digits.lasso b/Task/Middle-three-digits/Lasso/middle-three-digits.lasso new file mode 100644 index 0000000000..28fc99d6fc --- /dev/null +++ b/Task/Middle-three-digits/Lasso/middle-three-digits.lasso @@ -0,0 +1,22 @@ +define middlethree(value::integer) => { + local( + pos_value = math_abs(#value), + stringvalue = #pos_value -> asstring, + intlength = #stringvalue -> size, + middle = integer((#intlength + 1) / 2), + prefix = string(#value) -> padleading(15)& + ': ' + ) + + #intlength < 3 ? return #prefix + 'Error: too few digits' + not(#intlength % 2) ? return #prefix + 'Error: even number of digits' + + return #prefix + #stringvalue -> sub(#middle -1, 3) + +} +'
'
+with number in array(123, 12345, 1234567, 987654321, 10001, -10001, -123, -100, 100, -12345, 1, 2, -1, -10, 2002, -2002, 0) do {^
+
+	middlethree(#number)
+	'
' +^} +'
' diff --git a/Task/Middle-three-digits/Nim/middle-three-digits.nim b/Task/Middle-three-digits/Nim/middle-three-digits.nim new file mode 100644 index 0000000000..f3abdea870 --- /dev/null +++ b/Task/Middle-three-digits/Nim/middle-three-digits.nim @@ -0,0 +1,16 @@ +import math + +proc middleThreeDigits(i): auto = + var s = $abs(i) + if s.len < 3 or s.len mod 2 == 0: + raise newException(ValueError, "Need odd and >= 3 digits") + let mid = s.len div 2 + return s[mid-1..mid+1] + +const passing = @[123, 12345, 1234567, 987654321, 10001, -10001, -123, -100, 100, -12345] +const failing = @[1, 2, -1, -10, 2002, -2002, 0] + +for i in passing & failing: + var answer = try: middleThreeDigits(i) + except ValueError: getCurrentExceptionMsg() + echo "middleThreeDigits(",i,") returned: ",answer diff --git a/Task/Middle-three-digits/Oforth/middle-three-digits.oforth b/Task/Middle-three-digits/Oforth/middle-three-digits.oforth new file mode 100644 index 0000000000..2fc5b6d17f --- /dev/null +++ b/Task/Middle-three-digits/Oforth/middle-three-digits.oforth @@ -0,0 +1,6 @@ +: middle3 +| s sz | + abs asString dup ->s size ->sz + sz 3 < ifTrue: [ "Too short" println return ] + sz isEven ifTrue: [ "Not odd number of digits" println return ] + sz 3 - 2 / 1+ dup 2 + s extract ; diff --git a/Task/Middle-three-digits/Ring/middle-three-digits.ring b/Task/Middle-three-digits/Ring/middle-three-digits.ring new file mode 100644 index 0000000000..f8557ecf20 --- /dev/null +++ b/Task/Middle-three-digits/Ring/middle-three-digits.ring @@ -0,0 +1,10 @@ +n = 1234567 +middle(n) + +func middle nr + mnr = floor(len(string(nr))/2) + lennr = len(string(nr)) + if lennr = 3 see "" + nr + nl + but lennr < 3 see "Number must have at least three digits" + but lennr%2=0 see "Number must have an odd number of digits" + else cnr = substr(string(nr),mnr,3) see cnr + nl ok diff --git a/Task/Middle-three-digits/Sidef/middle-three-digits.sidef b/Task/Middle-three-digits/Sidef/middle-three-digits.sidef new file mode 100644 index 0000000000..a70f125e1c --- /dev/null +++ b/Task/Middle-three-digits/Sidef/middle-three-digits.sidef @@ -0,0 +1,16 @@ +func middle_three(n) { + var l = n.len; + if (l < 3) { + "#{n} is too short" + } elsif (l.is_even) { + "#{n} has an even number of digits" + } else { + "The three middle digits of #{n} are: " + n.digits.ft(l-3 / 2, l/2 + 1).join + } +} + +var nums = %n( + 123 12345 1234567 987654321 10001 -10001 -123 -100 100 -12345 + 1 2 -1 -10 2002 -2002 0 +); +nums.each { say middle_three(_) }; diff --git a/Task/Middle-three-digits/Wart/middle-three-digits.wart b/Task/Middle-three-digits/Wart/middle-three-digits.wart new file mode 100644 index 0000000000..d23c17607e --- /dev/null +++ b/Task/Middle-three-digits/Wart/middle-three-digits.wart @@ -0,0 +1,7 @@ +def (mid3 n) + withs (digits (with outstring # itoa + (pr abs.n)) + max len.digits + mid (int max/2)) + if (and odd?.max (max >= 3)) + (digits mid-1 mid+2) diff --git a/Task/Middle-three-digits/jq/middle-three-digits-1.jq b/Task/Middle-three-digits/jq/middle-three-digits-1.jq new file mode 100644 index 0000000000..84ca055677 --- /dev/null +++ b/Task/Middle-three-digits/jq/middle-three-digits-1.jq @@ -0,0 +1,10 @@ +def middle3: + if . < 0 then -. else . end + | tostring as $s + | ($s | length) as $n + | if $n<3 or ($n % 2) == 0 then "invalid length: \($n)" + else (($n - 1) / 2) as $n | $s[$n - 1 : $n + 2] + end ; + +(123, 12345, 1234567, 987654321, 10001, -10001, -123, -100, 100, -12345, 1, 2, -1, -10, 2002, -2002, 0) + | "\(.) => \( .|middle3 )" diff --git a/Task/Middle-three-digits/jq/middle-three-digits-2.jq b/Task/Middle-three-digits/jq/middle-three-digits-2.jq new file mode 100644 index 0000000000..156a6f986f --- /dev/null +++ b/Task/Middle-three-digits/jq/middle-three-digits-2.jq @@ -0,0 +1,18 @@ + $ jq -r -n -f Middle_three_digits.jq +123 => 123 +12345 => 234 +1234567 => 345 +987654321 => 654 +10001 => 000 +-10001 => 000 +-123 => 123 +-100 => 100 +100 => 100 +-12345 => 234 +1 => invalid length: 1 +2 => invalid length: 1 +-1 => invalid length: 1 +-10 => invalid length: 2 +2002 => invalid length: 4 +-2002 => invalid length: 4 +0 => invalid length: 1 diff --git a/Task/Modular-exponentiation/EchoLisp/modular-exponentiation.echolisp b/Task/Modular-exponentiation/EchoLisp/modular-exponentiation.echolisp new file mode 100644 index 0000000000..4cddaaf1ff --- /dev/null +++ b/Task/Modular-exponentiation/EchoLisp/modular-exponentiation.echolisp @@ -0,0 +1,22 @@ +(lib 'bigint) + +(define a 2988348162058574136915891421498819466320163312926952423791023078876139) +(define b 2351399303373464486466122544523690094744975233415544072992656881240319) +(define m 1e40) + +(powmod a b m) + → 1527229998585248450016808958343740453059 + +;; powmod is a native function +;; it could be defined as follows : + +(define (xpowmod base exp mod) + (define result 1) + (while ( !zero? exp) + (when (odd? exp) (set! result (% (* result base) mod))) + (/= exp 2) + (set! base (% (* base base) mod))) +result) + +(xpowmod a b m) + → 1527229998585248450016808958343740453059 diff --git a/Task/Modular-exponentiation/Nim/modular-exponentiation.nim b/Task/Modular-exponentiation/Nim/modular-exponentiation.nim new file mode 100644 index 0000000000..bbf982a1c5 --- /dev/null +++ b/Task/Modular-exponentiation/Nim/modular-exponentiation.nim @@ -0,0 +1,18 @@ +import bigints + +proc powmod(b, e, m: BigInt): BigInt = + assert e >= 0 + var e = e + var b = b + result = initBigInt(1) + while e > 0: + if e mod 2 == 1: + result = (result * b) mod m + e = e div 2 + b = (b.pow 2) mod m + +var + a = initBigInt("2988348162058574136915891421498819466320163312926952423791023078876139") + b = initBigInt("2351399303373464486466122544523690094744975233415544072992656881240319") + +echo powmod(a, b, 10.pow 40) diff --git a/Task/Modular-exponentiation/Oforth/modular-exponentiation.oforth b/Task/Modular-exponentiation/Oforth/modular-exponentiation.oforth new file mode 100644 index 0000000000..159347025b --- /dev/null +++ b/Task/Modular-exponentiation/Oforth/modular-exponentiation.oforth @@ -0,0 +1,6 @@ +: powmod(base, exponent, modulus) + 1 exponent dup ifZero: [ return ] + while ( dup 0 > ) [ + dup isEven ifFalse: [ swap base * modulus mod swap ] + 2 / base sq modulus mod ->base + ] drop ; diff --git a/Task/Modular-exponentiation/Sidef/modular-exponentiation-1.sidef b/Task/Modular-exponentiation/Sidef/modular-exponentiation-1.sidef new file mode 100644 index 0000000000..fcf7baf3f2 --- /dev/null +++ b/Task/Modular-exponentiation/Sidef/modular-exponentiation-1.sidef @@ -0,0 +1,4 @@ +say expmod( + 2988348162058574136915891421498819466320163312926952423791023078876139, + 2351399303373464486466122544523690094744975233415544072992656881240319, + 10**40) diff --git a/Task/Modular-exponentiation/Sidef/modular-exponentiation-2.sidef b/Task/Modular-exponentiation/Sidef/modular-exponentiation-2.sidef new file mode 100644 index 0000000000..b15637a9b5 --- /dev/null +++ b/Task/Modular-exponentiation/Sidef/modular-exponentiation-2.sidef @@ -0,0 +1,8 @@ +func expmod(a, b, n) { + var c = 1 + do { + (c *= a) %= n if b.is_odd + (a *= a) %= n + } while (b //= 2) + c +} diff --git a/Task/Modular-inverse/8th/modular-inverse.8th b/Task/Modular-inverse/8th/modular-inverse.8th new file mode 100644 index 0000000000..e716057c89 --- /dev/null +++ b/Task/Modular-inverse/8th/modular-inverse.8th @@ -0,0 +1,24 @@ +\ return "extended gcd" of a and b; The result satisfies the equation: +\ a*x + b*y = gcd(a,b) +: n:xgcd \ a b -- gcd x y + dup 0 n:= if + 1 swap \ -- a 1 0 + else + tuck n:/mod + -rot recurse + tuck 4 roll + n:* n:neg n:+ + then ; + +\ Return modular inverse of n modulo mod, or null if it doesn't exist (n and mod +\ not coprime): +: n:invmod \ n mod -- invmod + dup >r + n:xgcd rot 1 n:= not if + 2drop null + else + drop dup 0 n:< if r@ n:+ then + then + rdrop ; + +42 2017 n:invmod . cr bye diff --git a/Task/Modular-inverse/ERRE/modular-inverse.erre b/Task/Modular-inverse/ERRE/modular-inverse.erre new file mode 100644 index 0000000000..84a854b230 --- /dev/null +++ b/Task/Modular-inverse/ERRE/modular-inverse.erre @@ -0,0 +1,26 @@ +PROGRAM MOD_INV + +!$INTEGER + +PROCEDURE MUL_INV(A,B->T) + LOCAL NT,R,NR,Q,TMP + IF B<0 THEN B=-B + IF A<0 THEN A=B-(-A MOD B) + T=0 NT=1 R=B NR=A MOD B + WHILE NR<>0 DO + Q=R DIV NR + TMP=NT NT=T-Q*NT T=TMP + TMP=NR NR=R-Q*NR R=TMP + END WHILE + IF (R>1) THEN T=-1 EXIT PROCEDURE ! NO INVERSE + IF (T<0) THEN T+=B +END PROCEDURE + + +BEGIN + MUL_INV(42,2017->T) PRINT(T) + MUL_INV(40,1->T) PRINT(T) + MUL_INV(52,-217->T) PRINT(T) ! pari semantics for negative modulus + MUL_INV(-486,217->T) PRINT(T) + MUL_INV(40,2018->T) PRINT(T) +END PROGRAM diff --git a/Task/Modular-inverse/EchoLisp/modular-inverse.echolisp b/Task/Modular-inverse/EchoLisp/modular-inverse.echolisp new file mode 100644 index 0000000000..19c6f68ffe --- /dev/null +++ b/Task/Modular-inverse/EchoLisp/modular-inverse.echolisp @@ -0,0 +1,10 @@ +(lib 'math) ;; for egcd = extended gcd + +(define (mod-inv x m) + (define-values (g inv q) (egcd x m)) + (unless (= 1 g) (error 'not-coprimes (list x m) )) + (if (< inv 0) (+ m inv) inv)) + +(mod-inv 42 2017) → 1969 +(mod-inv 42 666) +🔴 error: not-coprimes (42 666) diff --git a/Task/Modular-inverse/FunL/modular-inverse.funl b/Task/Modular-inverse/FunL/modular-inverse.funl new file mode 100644 index 0000000000..ac6469f61e --- /dev/null +++ b/Task/Modular-inverse/FunL/modular-inverse.funl @@ -0,0 +1,12 @@ +import integers.egcd + +def modinv( a, m ) = + val (g, x, _) = egcd( a, m ) + + if g != 1 then error( a + ' and ' + m + ' not coprime' ) + + val res = x % m + + if res < 0 then res + m else res + +println( modinv(42, 2017) ) diff --git a/Task/Modular-inverse/Nim/modular-inverse.nim b/Task/Modular-inverse/Nim/modular-inverse.nim new file mode 100644 index 0000000000..fb56f97f56 --- /dev/null +++ b/Task/Modular-inverse/Nim/modular-inverse.nim @@ -0,0 +1,13 @@ +proc mulInv(a0, b0): int = + var (a, b, x0) = (a0, b0, 0) + result = 1 + if b == 1: return + while a > 1: + let q = a div b + a = a mod b + swap a, b + result = result - q * x0 + swap x0, result + if result < 0: result += b0 + +echo mulInv(42, 2017) diff --git a/Task/Modular-inverse/Oforth/modular-inverse.oforth b/Task/Modular-inverse/Oforth/modular-inverse.oforth new file mode 100644 index 0000000000..cbf61a4d57 --- /dev/null +++ b/Task/Modular-inverse/Oforth/modular-inverse.oforth @@ -0,0 +1,22 @@ +// euclid ( a b -- u v r ) +// Return r = gcd(a, b) and (u, v) / r = au + bv + +: euclid(a, b) +| q u u1 v v1 | + + b 0 < ifTrue: [ b neg ->b ] + a 0 < ifTrue: [ b a neg b mod - ->a ] + + 1 dup ->u ->v1 + 0 dup ->v ->u1 + + while(b) [ + b a b /mod ->q ->b ->a + u1 u u1 q * - ->u1 ->u + v1 v v1 q * - ->v1 ->v + ] + u v a ; + +: invmod(a, modulus) + a modulus euclid 1 == ifFalse: [ drop drop null return ] + drop dup 0 < ifTrue: [ modulus + ] ; diff --git a/Task/Modular-inverse/Ring/modular-inverse.ring b/Task/Modular-inverse/Ring/modular-inverse.ring new file mode 100644 index 0000000000..5a8725f774 --- /dev/null +++ b/Task/Modular-inverse/Ring/modular-inverse.ring @@ -0,0 +1,18 @@ +see "42 %! 2017 = " + multInv(42, 2017) + nl + +func multInv a,b + b0 = b + x0 = 0 + multInv = 1 + if b = 1 return 0 ok + while a > 1 + q = floor(a / b) + t = b + b = a % b + a = t + t = x0 + x0 = multInv - q * x0 + multInv = t + end + if multInv < 0 multInv = multInv + b0 ok + return multInv diff --git a/Task/Modular-inverse/Sidef/modular-inverse-1.sidef b/Task/Modular-inverse/Sidef/modular-inverse-1.sidef new file mode 100644 index 0000000000..2216d649f6 --- /dev/null +++ b/Task/Modular-inverse/Sidef/modular-inverse-1.sidef @@ -0,0 +1 @@ +say 42.modinv(2017) diff --git a/Task/Modular-inverse/Sidef/modular-inverse-2.sidef b/Task/Modular-inverse/Sidef/modular-inverse-2.sidef new file mode 100644 index 0000000000..5c72cf9497 --- /dev/null +++ b/Task/Modular-inverse/Sidef/modular-inverse-2.sidef @@ -0,0 +1,13 @@ +func invmod(a, n) { + var (t, nt, r, nr) = (0, 1, n, a % n) + while (nr != 0) { + var quot = int((r - (r % nr)) / nr); + (nt, t) = (t - quot*nt, nt); + (nr, r) = (r - quot*nr, nr); + } + r > 1 && return() + t < 0 && (t += n) + t +} + +say invmod(42, 2017) diff --git a/Task/Monte-Carlo-methods/ERRE/monte-carlo-methods.erre b/Task/Monte-Carlo-methods/ERRE/monte-carlo-methods.erre new file mode 100644 index 0000000000..13209a6fc7 --- /dev/null +++ b/Task/Monte-Carlo-methods/ERRE/monte-carlo-methods.erre @@ -0,0 +1,24 @@ +PROGRAM RANDOM_PI + +! +! for rosettacode.org +! + +!$DOUBLE + +PROCEDURE MONTECARLO(T->RES) + LOCAL I,N + FOR I=1 TO T DO + IF RND(1)^2+RND(1)^2<1 THEN N+=1 END IF + END FOR + RES=4*N/T +END PROCEDURE + +BEGIN + RANDOMIZE(TIMER) ! init rnd number generator + MONTECARLO(1000->RES) PRINT(RES) + MONTECARLO(10000->RES) PRINT(RES) + MONTECARLO(100000->RES) PRINT(RES) + MONTECARLO(1000000->RES) PRINT(RES) + MONTECARLO(10000000->RES) PRINT(RES) +END PROGRAM diff --git a/Task/Monte-Carlo-methods/FreeBASIC/monte-carlo-methods.freebasic b/Task/Monte-Carlo-methods/FreeBASIC/monte-carlo-methods.freebasic new file mode 100644 index 0000000000..eaa6aa765b --- /dev/null +++ b/Task/Monte-Carlo-methods/FreeBASIC/monte-carlo-methods.freebasic @@ -0,0 +1,33 @@ +' version 23-10-2016 +' compile with: fbc -s console + +Randomize Timer 'seed the random function + +Dim As Double x, y, pi, error_ +Dim As UInteger m = 10, n, n_start, n_stop = m, p + +Print +Print " Mumber of throws Ratio (Pi) Error" +Print + +Do + For n = n_start To n_stop -1 + x = Rnd + y = Rnd + If (x * x + y * y) <= 1 Then p = p +1 + Next + Print Using " ############, "; m ; + pi = p * 4 / m + error_ = 3.141592653589793238462643383280 - pi + Print RTrim(Str(pi),"0");Tab(35); Using "##.#############"; error_ + m = m * 10 + n_start = n_stop + n_stop = m +Loop Until m > 1000000000 ' 1,000,000,000 + + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Monte-Carlo-methods/Futhark/monte-carlo-methods.futhark b/Task/Monte-Carlo-methods/Futhark/monte-carlo-methods.futhark new file mode 100644 index 0000000000..7bde2173a1 --- /dev/null +++ b/Task/Monte-Carlo-methods/Futhark/monte-carlo-methods.futhark @@ -0,0 +1,46 @@ +default(f32) + +fun dirvcts(): [2][30]int = + [ + [ + 536870912, 268435456, 134217728, 67108864, 33554432, 16777216, 8388608, 4194304, 2097152, 1048576, 524288, 262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1 + ], + [ + 536870912, 805306368, 671088640, 1006632960, 570425344, 855638016, 713031680, 1069547520, 538968064, 808452096, 673710080, 1010565120, 572653568, 858980352, 715816960, 1073725440, 536879104, 805318656, 671098880, 1006648320, 570434048, 855651072, 713042560, 1069563840, 538976288, 808464432, 673720360, 1010580540, 572662306, 858993459 + ] + ] + + +fun grayCode(x: int): int = (x >> 1) ^ x + +---------------------------------------- +--- Sobol Generator +---------------------------------------- +fun testBit(n: int, ind: int): bool = + let t = (1 << ind) in (n & t) == t + +fun xorInds(n: int) (dir_vs: [num_bits]int): int = + let reldv_vals = zipWith (fn dv i => + if testBit(grayCode n,i) + then dv else 0) + dir_vs (iota num_bits) + in reduce (^) 0 reldv_vals + +fun sobolIndI (dir_vs: [m][num_bits]int, n: int): [m]int = + map (xorInds n) dir_vs + +fun sobolIndR(dir_vs: [m][num_bits]int) (n: int ): [m]f32 = + let divisor = 2.0 ** f32(num_bits) + let arri = sobolIndI( dir_vs, n ) + in map (fn (x: int): f32 => f32(x) / divisor) arri + +fun main(n: int): f32 = + let rand_nums = map (sobolIndR (dirvcts())) (iota n) + let dists = map (fn xy => + let (x,y) = (xy[0],xy[1]) in sqrt32(x*x + y*y)) + rand_nums + + let bs = map (fn d => if d <= 1.0f32 then 1 else 0) dists + + let inside = reduce (+) 0 bs + in 4.0f32*f32(inside)/f32(n) diff --git a/Task/Monte-Carlo-methods/Nim/monte-carlo-methods.nim b/Task/Monte-Carlo-methods/Nim/monte-carlo-methods.nim new file mode 100644 index 0000000000..d661f90109 --- /dev/null +++ b/Task/Monte-Carlo-methods/Nim/monte-carlo-methods.nim @@ -0,0 +1,12 @@ +import math +randomize() + +proc pi(nthrows): float = + var inside = 0 + for i in 1..int64(nthrows): + if hypot(random(1.0), random(1.0)) < 1: + inc inside + return float(4 * inside) / nthrows + +for n in [10e4, 10e6, 10e7, 10e8]: + echo pi(n) diff --git a/Task/Monte-Carlo-methods/Ring/monte-carlo-methods.ring b/Task/Monte-Carlo-methods/Ring/monte-carlo-methods.ring new file mode 100644 index 0000000000..bf559d0f67 --- /dev/null +++ b/Task/Monte-Carlo-methods/Ring/monte-carlo-methods.ring @@ -0,0 +1,12 @@ +decimals(8) +see "monteCarlo(1000) = " + monteCarlo(1000) + nl +see "monteCarlo(10000) = " + monteCarlo(10000) + nl +see "monteCarlo(100000) = " + monteCarlo(100000) + nl + +func monteCarlo t + n=0 + for i = 1 to t + if sqrt(pow(random(1),2) + pow(random(1),2)) <= 1 n += 1 ok + next + t = (4 * n) / t + return t diff --git a/Task/Monte-Carlo-methods/Swift/monte-carlo-methods.swift b/Task/Monte-Carlo-methods/Swift/monte-carlo-methods.swift new file mode 100644 index 0000000000..067538e329 --- /dev/null +++ b/Task/Monte-Carlo-methods/Swift/monte-carlo-methods.swift @@ -0,0 +1,26 @@ +import Foundation + +func mcpi(sampleSize size:Int) -> Double { + var x = 0 as Double + var y = 0 as Double + var m = 0 as Double + + for i in 0..hash (string->json morse-alphabet))) + +;; translates a string into morse string +;; use "|" as letters separator +(define (string->morse str morse) +(apply append (map string->list + (for/list [(a (string-diacritics str))] + (string-append + (or (hash-ref morse (string-upcase a)) "?") "|"))))) + +(define (play-morse) + (when EMIT ;; else return #f which stops (at-every) + (case (first EMIT) + ((".") (play-sound 'digit) (write "dot")) + (("-") (play-sound 'tick) (write "dash")) + (else (writeln) (blink))) + (set! EMIT (rest EMIT)))) diff --git a/Task/Morse-code/FreeBASIC/morse-code.freebasic b/Task/Morse-code/FreeBASIC/morse-code.freebasic new file mode 100644 index 0000000000..332dd02c2e --- /dev/null +++ b/Task/Morse-code/FreeBASIC/morse-code.freebasic @@ -0,0 +1,76 @@ +' FB 1.05.0 Win64 + +' Using Beep function in Win32 API +Dim As Any Ptr library = DyLibLoad("kernel32") +Dim Shared beep_ As Function (ByVal As ULong, ByVal As ULong) As Long +beep_ = DyLibSymbol(library, "Beep") + +Sub playMorse(m As String) + For i As Integer = 0 To Len(m) - 1 + If m[i] = 46 Then '' ascii code for dot + beep_(1000, 250) + Else '' must be ascii code for dash (45) + beep_(1000, 750) + End If + Sleep 50 + Next + Sleep 150 +End Sub + +Dim morse(0 To 35) As String => _ +{ _ + ".-", _ '' a + "-...", _ '' b + "-.-.", _ '' c + "-..", _ '' d + ".", _ '' e + "..-.", _ '' f + "--.", _ '' g + "....", _ '' h + "..", _ '' i + ".---", _ '' j + "-.-", _ '' k + ".-..", _ '' l + "--", _ '' m + "-.", _ '' n + "---", _ '' o + ".--.", _ '' p + "--.-", _ '' q + ".-.", _ '' r + "...", _ '' s + "-", _ '' t + "..-", _ '' u + "...-", _ '' v + ".--", _ '' w + "-..-", _ '' x + "-.--", _ '' y + "--..", _ '' z + "-----", _ '' 0 + ".----", _ '' 1 + "..---", _ '' 2 + "...--", _ '' 3 + "....-", _ '' 4 + ".....", _ '' 5 + "-....", _ '' 6 + "--...", _ '' 7 + "---..", _ '' 8 + "----." _ '' 9 +} + +Dim s As String = "The quick brown fox" +For i As Integer = 0 To Len(s) -1 + Select Case As Const s[i] + Case 65 To 90 '' A - Z + playMorse(morse(s[i] - 65)) + Case 97 To 122 '' a - z + playMorse(morse(s[i] - 97)) + Case 48 To 57 '' 0 - 9 + playMorse(morse(s[i] - 22)) + Case Else + '' ignore any other character + Sleep 250 + End Select +Next + +DyLibFree(library) +End diff --git a/Task/Morse-code/Phix/morse-code.phix b/Task/Morse-code/Phix/morse-code.phix new file mode 100644 index 0000000000..fda23ede1d --- /dev/null +++ b/Task/Morse-code/Phix/morse-code.phix @@ -0,0 +1,97 @@ +sequence morse = repeat(0,255) + +procedure setMorse(sequence data) +-- data is a list of strings, first char of each is the letter to encode, +-- with the rest being the actual morse code for that letter, eg "S..." + for i=1 to length(data) do + morse[data[i][1]] = data[i][2..$] -- eg morse['S'] = "..." + end for +end procedure + +setMorse({"0-----","1.----","2..---","3...--","4....-","5.....","6-....","7--...","8---..","9----.", + "A.-","B-...","C-.-.","D-..","E.","F..-.","G--.","H....","I..","J.---","K-.-","L.-..","M--", + "N-.","O---","P.--.","Q--.-","R.-.","S...","T-","U..-","V...-","W.--","X-..-","Y-.--","Z--..", + "!-.-.--","\".-..-.","$...-..-",":---...",";-.-.-.","=-...-","?..--..","@.--.-.","_..--.-", + "&.-...","'.----.","(-.--.",")-.--.-","+.-.-.",",--..--","--....-","..-.-.-","/-..-.", + " "}) + + morse['a'..'z'] = morse['A'..'Z'] + morse['['] = morse['('] + morse[']'] = morse[')'] + +constant EOM = ".-.-." + +constant frequency = 1280, -- (in Hz, 37..32767) + dit = 200, -- (in milliseconds) + dah = 3*dit, -- "" + lettergap = 2*dit/1000, -- (in seconds) + wordgap = 4*dit/1000 -- "" + +atom xBeep = 0 + +procedure beep(integer duration) + if platform()=WIN32 then + if xBeep=0 then + atom kernel32 = open_dll("kernel32.dll") + xBeep = define_c_proc(kernel32, "Beep", {C_INT,C_INT}) + end if + c_proc(xBeep,{frequency,duration}) + end if +end procedure + +procedure playAndRebuild(string line) +-- line should only contain '.'/'-'/' ', like the example below +string rebuilt = "" +integer start = 1 +integer ch + if length(line)=0 then + line = "... --- ... - .. - .- -. .. -.-. " + puts(1,line) + end if + for i=1 to length(line) do + ch = line[i] + if ch=' ' then + ch = find(line[start..i-1],morse) + if ch!=0 then + rebuilt &= ch + start = i+1 + if ch=' ' then + sleep(wordgap) + else + sleep(lettergap) + end if + end if + elsif ch='.' then + beep(dit) + elsif ch='-' then + beep(dah) + end if + end for + puts(1,rebuilt) + puts(1,"\n") +end procedure + +procedure main() +integer key +object code +string line = "" + + puts(1,"enter text, return to play/rebuild, escape to quit\n") + while 1 do + key = wait_key() + if key = 27 then exit end if -- escape + if key = 13 then -- return + playAndRebuild(line) + line = "" + else + code = morse[key] + if string(code) then + code &= ' ' + puts(1,code) + line &= code + end if + end if + end while + puts(1,EOM) +end procedure +main() diff --git a/Task/Morse-code/Ursa/morse-code.ursa b/Task/Morse-code/Ursa/morse-code.ursa new file mode 100644 index 0000000000..3e20ea16c5 --- /dev/null +++ b/Task/Morse-code/Ursa/morse-code.ursa @@ -0,0 +1,97 @@ +decl ursa.util.sound snd +decl string<> chars +decl string<> morse + +append "!" "\"" "$" "'" "(" ")" "+" chars +append "---." ".-..-." "...-..-" ".----." "-.--." "-.--.-" ".-.-." morse +append "," "-" "." "/" "0" "1" "2" chars +append "--..--" "-....-" ".-.-.-" "-..-." "-----" ".----" "..---" morse +append "3" "4" "5" "6" "7" "8" "9" chars +append "...--" "....-" "....." "-...." "--..." "---.." "----." morse +append ":" ";" "=" "?" "@" "A" "B" chars +append "---..." "-.-.-." "-...-" "..--.." ".--.-." ".-" "-..." morse +append "C" "D" "E" "F" "G" "H" "I" "J" "K" chars +append "-.-." "-." "." "..-." "--." "...." ".." ".---" "-.-" morse +append "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" chars +append ".-.." "--" "-." "---" ".--." "--.-" ".-." "..." "-" "..-" morse +append "V" "W" "X" "Y" "Z" "[" "]" "_" chars +append "...-" ".--" "-..-" "-.--" "--.." "-.--." "-.--.-" "..--.-" morse + +decl int e f chargap wordgap +# element time in ms. one dot is on for e then off for e +set e 50 +# tone frequency in hertz +set f 1280 +# time between characters of a word (in units of e) +set chargap 1 +# time between words (in units of e) +set wordgap 7 + + +def gap (int n) + sleep (* n e) +end gap +decl function off +set off gap + + +def on (int n) + snd.beep f (/ (* n e) 1000) +end on + + +def dot () + on 1 + off 1 +end dot + + +def dash () + on 3 + off 1 +end dash + + +def bloop (int n) + snd.beep (/ f 2) (/ (* n e) 1000) +end bloop + + +def encode_morse (string text) + decl string<> words + set words (split (upper (trim text)) " ") + decl int i j k + for () (< i (size words)) (inc i) + for (set j 0) (< j (size words)) (inc j) + decl int loc + set loc (locate words chars) + if (= loc -1) + bloop 3 + else + for (set k 0) (< k (size morse)) (inc k) + if (= morse "-") + dash + elif (= morse ".") + dot + else + bloop 3 + end if + end for + end if + gap chargap + end for + gap wordgap + end for +end encode_morse + + +# --- uncomment this block to output the source of this file as morse +# decl file src +# src.open args<0> +# encode_morse (src.readall) + + +while true + out "A string to change into morse: " console + encode_morse (in string console) +end while diff --git a/Task/Mouse-position/ERRE/mouse-position.erre b/Task/Mouse-position/ERRE/mouse-position.erre new file mode 100644 index 0000000000..1683d63239 --- /dev/null +++ b/Task/Mouse-position/ERRE/mouse-position.erre @@ -0,0 +1,79 @@ +! +! MOUSE WITH 'MOUSE.LIB' LIBRARY +! + +PROGRAM MOUSE + +!$KEY + +!$INCLUDE="PC.LIB" + +!$INCLUDE="MOUSE.LIB" + +PROCEDURE GETMONITORTYPE(->MONITOR$) + !$RCODE="DEF SEG=0" + STATUS=PEEK($463) + !$RCODE="DEF SEG" + MONITOR$="" + IF STATUS=$B4 THEN + !$RCODE="STATUS=(INP(&H3BA) AND &H80)" + FOR DELAYLOOP=1 TO 30000 DO + !$RCODE="XX=((INP(&H3BA) AND &H80)<>STATUS)" + IF XX THEN MONITOR$="HERC" END IF + END FOR + IF MONITOR$="" THEN MONITOR$="MONO" END IF + ELSE + REGAX%=$1A00 + EXECUTEASM($10) + IF (REGAX% AND $FF)=$1A THEN + MONITOR$="VGA" + ELSE + REGAX%=$1200 REGBX%=$10 + EXECUTEASM($10) + IF (REGBX% AND $FF)=$10 THEN + MONITOR$="CGA" + ELSE + MONITOR$="EGA" + END IF + END IF + END IF +END PROCEDURE + +BEGIN + INITASM + GETMONITORTYPE(->MONITOR$) + COLOR(7,0) + CLS + LOCATE(1,50) PRINT("MONITOR TYPE ";MONITOR$) + MOUSE_RESETANDSTATUS(->STATUS,BUTTONS) + IF STATUS<>-1 THEN + BEEP + CLS + PRINT("MOUSE DRIVER NOT INSTALLED OR MOUSE NOT FOUND") + REPEAT + GET(IN$) + UNTIL IN$<>"" + ELSE + MOUSE_SETEXTCURSOR + MOUSE_SETCURSORLIMITS(8,199,0,639) + MOUSE_SETSENSITIVITY(30,30,50) + MOUSE_SHOWCURSOR + REPEAT + OLDX=X OLDY=Y + MOUSE_GETCURSORPOSITION(->X,Y,LEFT%,RIGHT%,BOTH%,MIDDLE%) + GET(IN$) + COLOR(15,0) + LOCATE(1,2) + PRINT("X =";INT(X/8)+1;" Y =";INT(Y/8)+1;" ";) + IF LEFT% THEN LOCATE(1,37) COLOR(10,0) PRINT("LEFT";) END IF + IF RIGHT% THEN LOCATE(1,37) COLOR(12,0) PRINT("RIGHT";) END IF + IF MIDDLE% THEN LOCATE(1,37) COLOR(14,0) PRINT("MIDDLE";) END IF + IF NOT RIGHT% AND NOT LEFT% AND NOT MIDDLE% THEN + LOCATE(1,37) PRINT(" ";) + END IF + IF NOT (X=OLDX AND Y=OLDY) THEN MOUSE_SHOWCURSOR END IF + UNTIL IN$=CHR$(27) + END IF + MOUSE_HIDECURSOR + CLS +END PROGRAM diff --git a/Task/Mouse-position/EchoLisp/mouse-position.echolisp b/Task/Mouse-position/EchoLisp/mouse-position.echolisp new file mode 100644 index 0000000000..f4d71da4c8 --- /dev/null +++ b/Task/Mouse-position/EchoLisp/mouse-position.echolisp @@ -0,0 +1,7 @@ +(lib 'plot) +(plot-x-minmax 10) ; set logical dimensions of plotting area +(plot-y-minmax 100) + → (("x" 0 10) ("y" 0 100)) +;; press ESC to see the canvas +;; the mouse position is displayed as , for example, [ x: 5.6 y : 88.7] +;; 0 <= x <= 10, 0 <= y <= 100 diff --git a/Task/Mouse-position/Elm/mouse-position.elm b/Task/Mouse-position/Elm/mouse-position.elm new file mode 100644 index 0000000000..7cd61e54f5 --- /dev/null +++ b/Task/Mouse-position/Elm/mouse-position.elm @@ -0,0 +1,7 @@ +import Graphics.Element exposing (Element, show) +import Mouse + + +main : Signal Element +main = + Signal.map show Mouse.position diff --git a/Task/Mouse-position/Lingo/mouse-position.lingo b/Task/Mouse-position/Lingo/mouse-position.lingo new file mode 100644 index 0000000000..9c8d3dc326 --- /dev/null +++ b/Task/Mouse-position/Lingo/mouse-position.lingo @@ -0,0 +1,2 @@ +put _mouse.mouseLoc +-- point(310, 199) diff --git a/Task/Mouse-position/Ring/mouse-position.ring b/Task/Mouse-position/Ring/mouse-position.ring new file mode 100644 index 0000000000..ee920d4ea1 --- /dev/null +++ b/Task/Mouse-position/Ring/mouse-position.ring @@ -0,0 +1,62 @@ +Load "guilib.ring" + +lPress = false +nX = 0 +nY = 0 + +new qApp { + + win1 = new qWidget() + { + + setWindowTitle("Move this label!") + setGeometry(100,100,400,400) + setstylesheet("background-color:white;") + + Label1 = new qLabel(Win1){ + setGeometry(100,100,200,50) + setText("Welcome") + setstylesheet("font-size: 30pt") + myfilter = new qallevents(label1) + myfilter.setEnterevent("pEnter()") + myfilter.setLeaveevent("pLeave()") + myfilter.setMouseButtonPressEvent("pPress()") + myfilter.setMouseButtonReleaseEvent("pRelease()") myfilter.setMouseMoveEvent("pMove()") + installeventfilter(myfilter) + } + + show() + } + + exec() +} + +Func pEnter + Label1.setStyleSheet("background-color: purple; color:white;font-size: 30pt;") + +Func pLeave + Label1.setStyleSheet("background-color: white; color:black;font-size: 30pt;") + +Func pPress + lPress = True + nX = myfilter.getglobalx() + ny = myfilter.getglobaly() + +Func pRelease + lPress = False + pEnter() + +Func pMove + nX2 = myfilter.getglobalx() + ny2 = myfilter.getglobaly() + ndiffx = nX2 - nX + ndiffy = nY2 - nY + if lPress + Label1 { + move(x()+ndiffx,y()+ndiffy) + setStyleSheet("background-color: Green; + color:white;font-size: 30pt;") + nX = nX2 + ny = nY2 + } + ok diff --git a/Task/Move-to-front-algorithm/Sidef/move-to-front-algorithm-1.sidef b/Task/Move-to-front-algorithm/Sidef/move-to-front-algorithm-1.sidef new file mode 100644 index 0000000000..91bcbec22b --- /dev/null +++ b/Task/Move-to-front-algorithm/Sidef/move-to-front-algorithm-1.sidef @@ -0,0 +1,25 @@ +func encode(str) { + var table = ('a'..'z' -> join); + str.chars.map { |c| + var s = ''; + table.sub!(Regex('(.*?)' + c), {|s1| s=s1; c + s1}); + s.len; + } +} + +func decode(nums) { + var table = ('a'..'z' -> join); + nums.map { |n| + var s = ''; + table.sub!(Regex('(.{' + n + '})(.)'), {|s1, s2| s=s2; s2 + s1}); + s; + }.join; +} + +%w(broood bananaaa hiphophiphop).each { |test| + var encoded = encode(test); + say "#{test}: #{encoded}"; + var decoded = decode(encoded); + print "in" if (decoded != test); + say "correctly decoded to #{decoded}"; +} diff --git a/Task/Move-to-front-algorithm/Sidef/move-to-front-algorithm-2.sidef b/Task/Move-to-front-algorithm/Sidef/move-to-front-algorithm-2.sidef new file mode 100644 index 0000000000..3e86aa9c70 --- /dev/null +++ b/Task/Move-to-front-algorithm/Sidef/move-to-front-algorithm-2.sidef @@ -0,0 +1,36 @@ +module MoveToFront { + + define ABC = @("a".."z") + + func m2f(ar,i) { + [ar.delete_index(i)] + ar + } + + func encode(str) { + var ar = ABC+[] + gather { + str.each_char { |char| + take(var i = ar.index(char)) + ar = m2f(ar, i); + } + } + } + + func decode(indices) { + var ar = ABC+[] + gather { + indices.each { |i| + take ar[i]; + ar = m2f(ar, i) + } + }.join + } +} + +%w(broood bananaaa hiphophiphop).each { |test| + var encoded = MoveToFront::encode(test); + say "#{test}: #{encoded}"; + var decoded = MoveToFront::decode(encoded); + print "in" if (decoded != test); + say "correctly decoded to #{decoded}"; +} diff --git a/Task/Move-to-front-algorithm/jq/move-to-front-algorithm-1.jq b/Task/Move-to-front-algorithm/jq/move-to-front-algorithm-1.jq new file mode 100644 index 0000000000..6f6dcdbc4f --- /dev/null +++ b/Task/Move-to-front-algorithm/jq/move-to-front-algorithm-1.jq @@ -0,0 +1,19 @@ +# Input is the string to be encoded, st is the initial symbol table (an array) +# Output: the encoded string (an array) +def m2f_encode(st): + reduce explode[] as $ch + ( [ [], st]; # state: [ans, st] + (.[1]|index($ch)) as $ix + | .[1] as $st + | [ (.[0] + [ $ix ]), [$st[$ix]] + $st[0:$ix] + $st[$ix+1:] ] ) + | .[0]; + +# Input should be the encoded string (an array) +# and st should be the initial symbol table (an array) +def m2f_decode(st): + reduce .[] as $ix + ( [ [], st]; # state: [ans, st] + .[1] as $st + | [ (.[0] + [ $st[$ix] ]), [$st[$ix]] + $st[0:$ix] + $st[$ix+1:] ] ) + | .[0] + | implode; diff --git a/Task/Move-to-front-algorithm/jq/move-to-front-algorithm-2.jq b/Task/Move-to-front-algorithm/jq/move-to-front-algorithm-2.jq new file mode 100644 index 0000000000..cd05262f43 --- /dev/null +++ b/Task/Move-to-front-algorithm/jq/move-to-front-algorithm-2.jq @@ -0,0 +1,9 @@ +("abcdefghijklmnopqrstuvwxyz" | explode) as $ST + | ("broood", "bananaaa", "hiphophiphop") + | . as $string + | m2f_encode($ST) + | . as $encoded + | m2f_decode($ST) as $decoded + | if $string == $decoded then "\($string) => \($encoded) => \($decoded)" + else "INTERNAL ERROR: encoding of \($string) => \($encoded) => \($decoded)" + end diff --git a/Task/Move-to-front-algorithm/jq/move-to-front-algorithm-3.jq b/Task/Move-to-front-algorithm/jq/move-to-front-algorithm-3.jq new file mode 100644 index 0000000000..d91b7e77ee --- /dev/null +++ b/Task/Move-to-front-algorithm/jq/move-to-front-algorithm-3.jq @@ -0,0 +1,4 @@ +$ jq -r -n -f move_to_front.jq +broood => [1,17,15,0,0,5] => broood +bananaaa => [1,1,13,1,1,1,0,0] => bananaaa +hiphophiphop => [7,8,15,2,15,2,2,3,2,2,3,2] => hiphophiphop diff --git a/Task/Multifactorial/ERRE/multifactorial.erre b/Task/Multifactorial/ERRE/multifactorial.erre new file mode 100644 index 0000000000..b760b08093 --- /dev/null +++ b/Task/Multifactorial/ERRE/multifactorial.erre @@ -0,0 +1,28 @@ +PROGRAM MULTIFACTORIAL + +PROCEDURE MULTI_FACT(NUM,DEG->MF) + RESULT=NUM + N=NUM + IF N=0 THEN + MF=1 + EXIT PROCEDURE + END IF + LOOP + N-=DEG + EXIT IF N<=0 + RESULT*=N + END LOOP + MF=RESULT +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) + FOR DEG=1 TO 10 DO + PRINT("Degree";DEG;":";) + FOR NUM=1 TO 10 DO + MULTI_FACT(NUM,DEG->MF) + PRINT(MF;) + END FOR + PRINT + END FOR +END PROGRAM diff --git a/Task/Multifactorial/FreeBASIC/multifactorial.freebasic b/Task/Multifactorial/FreeBASIC/multifactorial.freebasic new file mode 100644 index 0000000000..4d8a17cd0c --- /dev/null +++ b/Task/Multifactorial/FreeBASIC/multifactorial.freebasic @@ -0,0 +1,22 @@ +' FB 1.05.0 Win64 + +Function multiFactorial (n As UInteger, degree As Integer) As UInteger + If n < 2 Then Return 1 + Var result = n + For i As Integer = n - degree To 2 Step -degree + result *= i + Next + Return result +End Function + +For degree As Integer = 1 To 5 + Print "Degree"; degree; " => "; + For n As Integer = 1 To 10 + Print multiFactorial(n, degree); " "; + Next n + Print +Next degree + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Multifactorial/FunL/multifactorial.funl b/Task/Multifactorial/FunL/multifactorial.funl new file mode 100644 index 0000000000..4227bfb46c --- /dev/null +++ b/Task/Multifactorial/FunL/multifactorial.funl @@ -0,0 +1,4 @@ +def multifactorial( n, d ) = product( n..1 by -d ) + +for d <- 1..5 + println( d, [multifactorial(i, d) | i <- 1..10] )) diff --git a/Task/Multifactorial/Nim/multifactorial.nim b/Task/Multifactorial/Nim/multifactorial.nim new file mode 100644 index 0000000000..d8c02e7f35 --- /dev/null +++ b/Task/Multifactorial/Nim/multifactorial.nim @@ -0,0 +1,16 @@ +# Recursive +proc multifact(n, deg): int = + result = (if n <= deg: n else: n * multifact(n - deg, deg)) + +# Iterative +proc multifactI(n, deg): int = + result = n + var n = n + while n >= deg + 1: + result *= n - deg + n -= deg + +for i in 1..5: + stdout.write "\nDegree ", i, ": " + for j in 1..10: + stdout.write multifactI(j, i), " " diff --git a/Task/Multifactorial/Oforth/multifactorial.oforth b/Task/Multifactorial/Oforth/multifactorial.oforth new file mode 100644 index 0000000000..f1967239bf --- /dev/null +++ b/Task/Multifactorial/Oforth/multifactorial.oforth @@ -0,0 +1,5 @@ +: multifact(n, deg) 1 while( n 0 > ) [ n * n deg - ->n ] ; + +: printMulti +| i | + 5 loop: i [ System.Out i << " : " << 10 seq map(#[ i multifact]) << cr ] ; diff --git a/Task/Multifactorial/Ring/multifactorial.ring b/Task/Multifactorial/Ring/multifactorial.ring new file mode 100644 index 0000000000..6d5c5cdaa9 --- /dev/null +++ b/Task/Multifactorial/Ring/multifactorial.ring @@ -0,0 +1,16 @@ +see "Degree " + "|" + " Multifactorials 1 to 10" + nl +see copy("-", 52) + nl +for d = 1 to 5 + see "" + d + " " + "| " + for n = 1 to 10 + see "" + multiFact(n, d) + " " + next + see nl +next + +func multiFact n, degree + fact = 1 + for i = n to 2 step -degree + fact = fact * i + next + return fact diff --git a/Task/Multifactorial/Sidef/multifactorial.sidef b/Task/Multifactorial/Sidef/multifactorial.sidef new file mode 100644 index 0000000000..9f6eb256ee --- /dev/null +++ b/Task/Multifactorial/Sidef/multifactorial.sidef @@ -0,0 +1,7 @@ +func mfact(s, n) { + n > 0 ? (n * mfact(s, n-s)) : 1 +} +  +10.times { |s| + say "step=#{s}: #{1..10 -> map {|n| mfact(s, n)}.join(' ')}" +} diff --git a/Task/Multifactorial/Wortel/multifactorial.wortel b/Task/Multifactorial/Wortel/multifactorial.wortel new file mode 100644 index 0000000000..3e7cfe7060 --- /dev/null +++ b/Task/Multifactorial/Wortel/multifactorial.wortel @@ -0,0 +1,10 @@ +@let { + facd &[d n]?{<= n d n @prod@range[n 1 @-d]} + ; tacit implementation + facdt ^(!?(/^> .1 ^(@prod @range ~1jdtShj &^!(@- @id))) @,) + ; recursive + facdrec &[n d] ?{<= n d n *n !!facdrec -n d d} + ; output + l @to 10 + ~@each @to 5 &n !console.log "Degree {n}: {@join @s !*\facd n l}" +} diff --git a/Task/Multifactorial/jq/multifactorial-1.jq b/Task/Multifactorial/jq/multifactorial-1.jq new file mode 100644 index 0000000000..633037f4e3 --- /dev/null +++ b/Task/Multifactorial/jq/multifactorial-1.jq @@ -0,0 +1,6 @@ +# Input: n +# Output: n * (n - d) * (n - 2d) ... +def multifactorial(d): + . as $n + | ($n / d | floor) as $k + | reduce ($n - (d * range(0; $k))) as $i (1; . * $i); diff --git a/Task/Multifactorial/jq/multifactorial-2.jq b/Task/Multifactorial/jq/multifactorial-2.jq new file mode 100644 index 0000000000..53f087e4cd --- /dev/null +++ b/Task/Multifactorial/jq/multifactorial-2.jq @@ -0,0 +1,6 @@ +# Print out a d-by-n table of multifactorials neatly: +def table(d; n): + def lpad(i): tostring | (i - length) * " " + .; + def pp(stream): reduce stream as $i (""; . + ($i | lpad(8))); + + range(1; d+1) as $d | "Degree \($d): \( pp(range(1; n+1) | multifactorial($d)) )"; diff --git a/Task/Multifactorial/jq/multifactorial-3.jq b/Task/Multifactorial/jq/multifactorial-3.jq new file mode 100644 index 0000000000..94647fdb32 --- /dev/null +++ b/Task/Multifactorial/jq/multifactorial-3.jq @@ -0,0 +1 @@ +table(5; 10) diff --git a/Task/Multifactorial/jq/multifactorial-4.jq b/Task/Multifactorial/jq/multifactorial-4.jq new file mode 100644 index 0000000000..68235410db --- /dev/null +++ b/Task/Multifactorial/jq/multifactorial-4.jq @@ -0,0 +1,6 @@ +$ jq -n -r -f Multifactorial.jq +Degree 1: 1 2 6 24 120 720 5040 40320 362880 3628800 +Degree 2: 1 2 3 8 15 48 105 384 945 3840 +Degree 3: 1 1 3 4 5 18 28 40 162 280 +Degree 4: 1 1 1 4 5 6 7 32 45 60 +Degree 5: 1 1 1 1 5 6 7 8 9 50 diff --git a/Task/Multiple-distinct-objects/EchoLisp/multiple-distinct-objects.echolisp b/Task/Multiple-distinct-objects/EchoLisp/multiple-distinct-objects.echolisp new file mode 100644 index 0000000000..d7e0e02846 --- /dev/null +++ b/Task/Multiple-distinct-objects/EchoLisp/multiple-distinct-objects.echolisp @@ -0,0 +1,15 @@ +;; wrong - make-vector is evaluated one time - same vector + +(define L (make-list 3 (make-vector 4))) +L → (#(0 0 0 0) #(0 0 0 0) #(0 0 0 0)) +(vector-set! (first L ) 1 '🔴) ;; sets the 'first' vector + +L → (#(0 🔴 0 0) #(0 🔴 0 0) #(0 🔴 0 0)) + +;; right - three different vectors + +(define L(map make-vector (make-list 3 4))) +L → (#(0 0 0 0) #(0 0 0 0) #(0 0 0 0)) +(vector-set! (first L ) 1 '🔵) ;; sets the first vector + +L → (#(0 🔵 0 0) #(0 0 0 0) #(0 0 0 0)) ;; OK diff --git a/Task/Multiple-distinct-objects/NGS/multiple-distinct-objects-1.ngs b/Task/Multiple-distinct-objects/NGS/multiple-distinct-objects-1.ngs new file mode 100644 index 0000000000..6843fc34b5 --- /dev/null +++ b/Task/Multiple-distinct-objects/NGS/multiple-distinct-objects-1.ngs @@ -0,0 +1 @@ +{ [foo()] * n } diff --git a/Task/Multiple-distinct-objects/NGS/multiple-distinct-objects-2.ngs b/Task/Multiple-distinct-objects/NGS/multiple-distinct-objects-2.ngs new file mode 100644 index 0000000000..4fefd9753d --- /dev/null +++ b/Task/Multiple-distinct-objects/NGS/multiple-distinct-objects-2.ngs @@ -0,0 +1 @@ +{ foo * n } diff --git a/Task/Multiple-distinct-objects/Nim/multiple-distinct-objects-1.nim b/Task/Multiple-distinct-objects/Nim/multiple-distinct-objects-1.nim new file mode 100644 index 0000000000..3549c935c6 --- /dev/null +++ b/Task/Multiple-distinct-objects/Nim/multiple-distinct-objects-1.nim @@ -0,0 +1,7 @@ +proc foo(): string = + echo "Foo()" + "mystring" + +let n = 100 +var ws = newSeq[string](n) +for i in 0 .. 0 + END FOR + IF I%=M+1 THEN + PRINT("SINGULAR MATRIX !") + !$STOP + END IF + FOR K%=0 TO M+1 DO + SWAP(A[J%,K%],A[I%,K%]) + END FOR + Y=1/A[J%,J%] + FOR K%=0 TO M+1 DO + A[J%,K%]=Y*A[J%,K%] + END FOR + FOR I%=0 TO M DO + IF I%<>J% THEN + Y=-A[I%,J%] + FOR K%=0 TO M+1 DO + A[I%,K%]=A[I%,K%]+Y*A[J%,K%] + END FOR + END IF + END FOR + END FOR + PRINT + + PRINT("SOLUTIONS") PRINT + FOR I%=0 TO M DO + PRINT("c";I%;"=";) + WRITE("#####.#######";A[I%,M+1]) + END FOR + +END PROGRAM diff --git a/Task/Multiple-regression/Hy/multiple-regression.hy b/Task/Multiple-regression/Hy/multiple-regression.hy new file mode 100644 index 0000000000..c715562cee --- /dev/null +++ b/Task/Multiple-regression/Hy/multiple-regression.hy @@ -0,0 +1,13 @@ +(import + [numpy [ones column-stack]] + [numpy.random [randn]] + [numpy.linalg [lstsq]]) + +(setv n 1000) +(setv x1 (randn n)) +(setv x2 (randn n)) +(setv y (+ 3 (* 1 x1) (* -2 x2) (* .25 x1 x2) (randn n))) + +(print (first (lstsq + (column-stack (, (ones n) x1 x2 (* x1 x2))) + y))) diff --git a/Task/Multiplication-tables/Axe/multiplication-tables.axe b/Task/Multiplication-tables/Axe/multiplication-tables.axe new file mode 100644 index 0000000000..4325b228b5 --- /dev/null +++ b/Task/Multiplication-tables/Axe/multiplication-tables.axe @@ -0,0 +1,18 @@ +Fix 5 +ClrDraw +For(I,1,10) + Text(I-1*9,0,I▶Dec) + Text(91,I*7+1,I▶Dec) +End + +For(J,1,8) + For(I,J,10) + Text(I-1*9,J*7+1,I*J▶Dec) + End +End + +HLine(7) +VLine(89) +DispGraph +getKeyʳ +Fix 4 diff --git a/Task/Multiplication-tables/EchoLisp/multiplication-tables.echolisp b/Task/Multiplication-tables/EchoLisp/multiplication-tables.echolisp new file mode 100644 index 0000000000..1356e60786 --- /dev/null +++ b/Task/Multiplication-tables/EchoLisp/multiplication-tables.echolisp @@ -0,0 +1,11 @@ +(lib 'matrix) + +(define (mtable i j) + (cond + ((and (zero? i) (zero? j)) "😅") + ((= i 0) j) + ((= j 0) i) + ((>= j i ) (* i j )) + (else " "))) + +(array-print (build-array 13 13 mtable)) diff --git a/Task/Multiplication-tables/FreeBASIC/multiplication-tables.freebasic b/Task/Multiplication-tables/FreeBASIC/multiplication-tables.freebasic new file mode 100644 index 0000000000..46baaab572 --- /dev/null +++ b/Task/Multiplication-tables/FreeBASIC/multiplication-tables.freebasic @@ -0,0 +1,22 @@ +' FB 1.05.0 Win64 + +Print " X|"; +For i As Integer = 1 To 12 + Print Using "####"; i; +Next + +Print +Print "---+"; String(48, "-") + +For i As Integer = 1 To 12 + Print Using "###"; i; + Print"|"; Spc(4 * (i - 1)); + For j As Integer = i To 12 + Print Using "####"; i * j; + Next j + Print +Next i + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Multiplication-tables/Lasso/multiplication-tables.lasso b/Task/Multiplication-tables/Lasso/multiplication-tables.lasso new file mode 100644 index 0000000000..cb6c4c4686 --- /dev/null +++ b/Task/Multiplication-tables/Lasso/multiplication-tables.lasso @@ -0,0 +1,29 @@ +define printTimesTables(max::integer) => { + local(result) = `` + local(padSize) = string(#max*#max)->size + 1 + + // Print header row + #result->append((' ' * #padSize) + '|') + loop(#max) => { + #result->append(loop_count->asString(-padding=#padSize)) + } + #result->append("\n" + (`-` * #padSize) + '+' + (`-` * (#padSize * #max))) + + with left in 1 to #max do { + // left column + #result->append("\n" + #left->asString(-padding=#padSize) + '|') + + // Table results + with right in 1 to #max do { + #result->append( + #right < #left + ? ' ' * #padSize + | (#left * #right)->asString(-padding=#padSize) + ) + } + } + + return #result +} + +printTimesTables(12) diff --git a/Task/Multiplication-tables/Nim/multiplication-tables.nim b/Task/Multiplication-tables/Nim/multiplication-tables.nim new file mode 100644 index 0000000000..b6083587f5 --- /dev/null +++ b/Task/Multiplication-tables/Nim/multiplication-tables.nim @@ -0,0 +1,12 @@ +import strfmt + +const n = 12 + +for j in 1..n: + stdout.write "{:3d}{:s}".fmt(j, if n-j>0: " " else: "\n") +for j in 0..n: + stdout.write if n-j>0: "----" else: "+\n" +for i in 1..n: + for j in 1..n: + stdout.write if j= t1 see fsize(t1*t2,nSize) else see copy(" ", nSize) ok next + see nl + next +func fsize x,n return string(x) + copy(" ",n-len(string(x))) diff --git a/Task/Multiplication-tables/Ring/multiplication-tables-2.ring b/Task/Multiplication-tables/Ring/multiplication-tables-2.ring new file mode 100644 index 0000000000..4f749770c2 --- /dev/null +++ b/Task/Multiplication-tables/Ring/multiplication-tables-2.ring @@ -0,0 +1,14 @@ + | 1 2 3 4 5 6 7 8 9 10 11 12 +----+------------------------------------------------- +1 | 1 2 3 4 5 6 7 8 9 10 11 12 +2 | 4 6 8 10 12 14 16 18 20 22 24 +3 | 9 12 15 18 21 24 27 30 33 36 +4 | 16 20 24 28 32 36 40 44 48 +5 | 25 30 35 40 45 50 55 60 +6 | 36 42 48 54 60 66 72 +7 | 49 56 63 70 77 84 +8 | 64 72 80 88 96 +9 | 81 90 99 108 +10 | 100 110 120 +11 | 121 132 +12 | 144 diff --git a/Task/Multiplication-tables/Sidef/multiplication-tables.sidef b/Task/Multiplication-tables/Sidef/multiplication-tables.sidef new file mode 100644 index 0000000000..7f336181d2 --- /dev/null +++ b/Task/Multiplication-tables/Sidef/multiplication-tables.sidef @@ -0,0 +1,13 @@ +var max = 12; +var width = (max**2 -> len+1); + +func fmt_row(*items) { + items.map { |s| "%*s" % (width, s) }.join(''); +} + +say fmt_row('x┃', (1..max)...); +say "#{'━' * (width - 1)}╋#{'━' * (max * width)}"; + +max.times { |i| + say fmt_row("#{i}┃", (1..max).map {|j| i <= j ? i*j : ''}...); +}; diff --git a/Task/Multiplicative-order/EchoLisp/multiplicative-order.echolisp b/Task/Multiplicative-order/EchoLisp/multiplicative-order.echolisp new file mode 100644 index 0000000000..c3e680343f --- /dev/null +++ b/Task/Multiplicative-order/EchoLisp/multiplicative-order.echolisp @@ -0,0 +1,32 @@ +(require 'bigint) + +;; factor-exp returns a list ((p k) ..) : a = p1^k1 * p2^k2 .. +(define (factor-exp a) + (map (lambda (g) (list (first g) (length g))) + (group* (prime-factors a)))) + +;; copied from Ruby +(define (_mult_order a p k (x)) + (define pk (expt p k)) + (define t (* (1- p) (expt p (1- k)))) + (define r 1) + (for [((q e) (factor-exp t))] + (set! x (powmod a (/ t (expt q e)) pk)) + (while (!= x 1) + (*= r q) + (set! x (powmod x q pk)))) + r) + +(define (order a m) + "multiplicative order : (order a m) → n : a^n = 1 (mod m)" + (assert (= 1 (gcd a m)) "a and m must be coprimes") + (define mopks (for/list [((p k) (factor-exp m))] (_mult_order a p k))) + (for/fold (n 1) ((mopk mopks)) (lcm n mopk))) + +;; results +order 37 1000) + → 100 +(order (+ (expt 10 100) 1) 7919) + → 3959 +(order (+ (expt 10 1000) 1) 15485863) + → 15485862 diff --git a/Task/Multisplit/FreeBASIC/multisplit.freebasic b/Task/Multisplit/FreeBASIC/multisplit.freebasic new file mode 100644 index 0000000000..730a9ea8b0 --- /dev/null +++ b/Task/Multisplit/FreeBASIC/multisplit.freebasic @@ -0,0 +1,74 @@ +' FB 1.05.0 Win64 + +Sub Split(s As String, sepList() As String, result() As String, removeEmpty As Boolean = False, showSepInfo As Boolean = False) + If s = "" OrElse UBound(sepList) = -1 Then + Redim result(0) + result(0) = s + Return + End If + Dim As Integer i = 0, j, count = 0, empty = 0, length + Dim As Integer position(len(s) + 1) + Dim As Integer sepIndex(1 To len(s)) + Dim As Integer sepLength(len(s)) + position(0) = 0 : sepLength(0) = 1 + + While i < Len(s) + For j = lbound(sepList) To ubound(sepList) + length = len(sepList(j)) + If length = 0 Then Continue For '' ignore blank separators + If mid(s, i + 1, length) = sepList(j) Then + count += 1 + position(count) = i + 1 + sepIndex(count) = j + sepLength(count) = length + i += length - 1 + Exit For + End If + Next j + i += 1 + Wend + + Redim result(count) + If count = 0 Then + If showSepInfo Then + Print "No delimiters were found" : Print + End If + result(0) = s + Return + End If + position(count + 1) = len(s) + 1 + + For i = 1 To count + 1 + length = position(i) - position(i - 1) - sepLength(i - 1) + result(i - 1 - empty) = Mid(s, position(i - 1) + sepLength(i - 1), length) + If removeEmpty AndAlso cbool(length = 0) Then empty += 1 + Next + + If empty > 0 Then Redim Preserve result(count - empty) + + If showSepInfo Then + Print "The 1-based indices of the delimiters found are : " + Print + For x As Integer = 1 To count + Print "At index"; position(x), sepList(sepIndex(x)) + Next + Print + End If +End Sub + + +Dim s As String = "a!===b=!=c" +Print "The string to be split is : "; s +Print +Dim a() As String '' to hold results +Dim b(1 To 3) As String = {"==", "!=", "="} '' separators to be used in order of priority (highest first) +split s, b(), a(), False, True '' show separator info +Print "The sub-strings are : " +Print +For i As integer = 0 To ubound(a) + Print Using "##"; i + 1; + Print " : "; a(i) +Next +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Multisplit/Nim/multisplit.nim b/Task/Multisplit/Nim/multisplit.nim new file mode 100644 index 0000000000..5e1cf438f5 --- /dev/null +++ b/Task/Multisplit/Nim/multisplit.nim @@ -0,0 +1,19 @@ +import strutils + +iterator tokenize(text, sep): tuple[token: string, isSep: bool] = + var i, lastMatch = 0 + while i < text.len: + for j, s in sep: + if text[i..text.high].startsWith s: + if i > lastMatch: yield (text[lastMatch .. lastMatch: yield (text[lastMatch .. 1 then peeloff(delims[1:]) + else [ .[0:1], .[1:]] + end ; + +# multisplit_parse(delims) produces an intermediate parse. +# Input must be of the parse form: [ string, [ delim ], ... ] +# Output is of the same form. +def multisplit_parse(delims): + if (delims|length) == 0 or length == 0 then . + else + .[length-1] as $last + | .[0:length-1] as $butlast + | if ($last|type) == "array" then . # all done + elif $last == "" then . + else + ($last | peeloff(delims)) as $p # [ peeledoff, next ] + | $p[0] as $peeledoff + | $p[1] as $next + | if ($next|length) > 0 + then $butlast + [$peeledoff] + ([$next]|multisplit_parse(delims)) + else $butlast + $p + end + end + end ; + +def multisplit(delims): + [.] | multisplit_parse(delims) + # insert "" between delimiters, compress strings, remove trailing "" if any + | reduce .[] as $x ([]; + if length == 0 then [ $x ] + elif ($x|type) == "array" + then if (.[length-1]|type) == "array" then . + ["", $x] + else . + [$x] + end + elif .[length-1]|type == "string" + then .[0:length-1] + [ .[length-1] + $x ] + else . + [$x] + end ) ; diff --git a/Task/Munching-squares/EchoLisp/munching-squares.echolisp b/Task/Munching-squares/EchoLisp/munching-squares.echolisp new file mode 100644 index 0000000000..6101422e82 --- /dev/null +++ b/Task/Munching-squares/EchoLisp/munching-squares.echolisp @@ -0,0 +1,16 @@ +(lib 'types) +(lib 'plot) +(plot-size 512 512) ;; for example + +;; use m = 16, 32, 44, .. to change the definition (number of losanges) +(define (plot-munch (m 256)) + (define PIX (pixels->int32-vector)) ;; get canvas image + (define (pcolor x y) ;; color at (x,y) + (hsv->rgb + (// (bitwise-xor (modulo x m) (modulo y m)) m) + 0.9 + 0.9)) + (pixels-map pcolor PIX) + (vector->pixels PIX)) ;; draw canvas image + +(plot-much) ;; ESC to see tge drawing diff --git a/Task/Munching-squares/FreeBASIC/munching-squares.freebasic b/Task/Munching-squares/FreeBASIC/munching-squares.freebasic new file mode 100644 index 0000000000..a147409881 --- /dev/null +++ b/Task/Munching-squares/FreeBASIC/munching-squares.freebasic @@ -0,0 +1,21 @@ +' version 03-11-2016 +' compile with: fbc -s gui + +Dim As ULong x, y, r, w = 256 + +ScreenRes w, w, 32 + +For x = 0 To w -1 + For y = 0 To w -1 + r =(x Xor y) And 255 + PSet(x, y), RGB(r, r , r) ' gray scale + ' PSet(x, y), RGB(r, 255 - r, 0) ' red + green + ' PSet(x, y), RGB(r, 0, 0) ' red + Next +Next + +' empty keyboard buffer +While Inkey <> "" : Wend +WindowTitle "Close window or hit any key to end program" +Sleep +End diff --git a/Task/Munching-squares/GLSL/munching-squares.glsl b/Task/Munching-squares/GLSL/munching-squares.glsl new file mode 100644 index 0000000000..992d40ee4c --- /dev/null +++ b/Task/Munching-squares/GLSL/munching-squares.glsl @@ -0,0 +1,43 @@ +vec3 color; +float c,p; +vec2 b; + +void main(void) +{ + vec2 uv = gl_FragCoord.xy / iResolution.xy; + float scale = iResolution.x / iResolution.y; + uv = uv-0.5; + uv.y/=scale; + + b = uv*256.0+256.0; + c = 0.0; + + + for(float i=16.0;i>=1.0;i-=1.0) + { + p = pow(2.0,i); + + if((p < b.x) ^^ + (p < b.y)) + { + c += p; + } + + if(p < b.x) + { + b.x -= p; + } + + if(p < b.y) + { + b.y -= p; + } + + } + + c=mod(c/128.0,1.0); + + color = vec3(sin(c+uv.x*cos(uv.y*1.2)), tan(c+uv.y-0.3)*1.1, cos(c-uv.y+0.9)); + + gl_FragColor = vec4(color,1.0); +} diff --git a/Task/Munching-squares/Sidef/munching-squares.sidef b/Task/Munching-squares/Sidef/munching-squares.sidef new file mode 100644 index 0000000000..ca416b6801 --- /dev/null +++ b/Task/Munching-squares/Sidef/munching-squares.sidef @@ -0,0 +1,10 @@ +require('GD') + +var img = %s.new(256, 256, 1) + +for y,x in (^256 ~X ^256) { + var color = img.colorAllocate((255 - x - y).abs, (255-x)^y, x^(255-y)) + img.setPixel(x, y, color) +} + +File('xor.png').write(img.png, :raw) diff --git a/Task/Munching-squares/jq/munching-squares-1.jq b/Task/Munching-squares/jq/munching-squares-1.jq new file mode 100644 index 0000000000..729e4d533c --- /dev/null +++ b/Task/Munching-squares/jq/munching-squares-1.jq @@ -0,0 +1 @@ +jq -n -r -f Munching_squares.jq > Munching_squares.svg diff --git a/Task/Munching-squares/jq/munching-squares-2.jq b/Task/Munching-squares/jq/munching-squares-2.jq new file mode 100644 index 0000000000..98bc4f3a8a --- /dev/null +++ b/Task/Munching-squares/jq/munching-squares-2.jq @@ -0,0 +1,23 @@ +# Convert the input integer to an array of bits with lsb first +def integer_to_lsb: + [recurse(if . > 0 then ./2|floor else empty end) | . % 2] ; + +# input array of bits (with lsb first) is converted to an integer +def lsb_to_integer: + reduce .[] as $bit + # state: [power, ans] + ([1,0]; (.[0] * 2) as $b | [$b, .[1] + (.[0] * $bit)]) + | .[1]; + +def xor(x;y): + def lxor(a;b): # a and/or b may be null + if a == 1 then if b==1 then 0 else 1 end + elif b==1 then if a==1 then 0 else 1 end + else 0 + end; + (x|integer_to_lsb) as $s + | (y|integer_to_lsb) as $t + | ([$s|length, $t|length] | max) as $length + | reduce range(0;$length) as $i + ([]; . + [ lxor($s[$i]; $t[$i]) ] ) + | lsb_to_integer; diff --git a/Task/Munching-squares/jq/munching-squares-3.jq b/Task/Munching-squares/jq/munching-squares-3.jq new file mode 100644 index 0000000000..5adcf067b2 --- /dev/null +++ b/Task/Munching-squares/jq/munching-squares-3.jq @@ -0,0 +1,11 @@ +def rgb2rgb: + def p: (. + 0.5) | floor; # to nearest integer + "rgb(\(.red|p),\(.green|p),\(.blue|p))"; + +def svg(width; height): + ""; + +def pixel(x; y; color): + (color | if type == "string" then . else rgb2rgb end) as $c + | ""; diff --git a/Task/Munching-squares/jq/munching-squares-4.jq b/Task/Munching-squares/jq/munching-squares-4.jq new file mode 100644 index 0000000000..c7ede3782a --- /dev/null +++ b/Task/Munching-squares/jq/munching-squares-4.jq @@ -0,0 +1,17 @@ +# rgb is a JSON object: { "red": _, "green": _, "blue": _} + +def xor_pattern(width; height; rgb1; rgb2): + # create colour table + 256 as $size + | (reduce range(0;$size) as $i + ([]; . + [ + {"red": (rgb1.red + (rgb2.red - rgb1.red) * $i / $size), + "green": (rgb1.green + (rgb2.green - rgb1.green) * $i / $size), + "blue": (rgb1.blue + (rgb2.blue - rgb1.blue) * $i / $size) }]) + ) as $colours + # create the image + | svg(width; height), + ( (range(0;width) as $x + | range(0;height) as $y + | pixel($x; $y; $colours[ xor($x; $y) % $size] ) ) ), + "" ; diff --git a/Task/Munching-squares/jq/munching-squares-5.jq b/Task/Munching-squares/jq/munching-squares-5.jq new file mode 100644 index 0000000000..fcbe68fd20 --- /dev/null +++ b/Task/Munching-squares/jq/munching-squares-5.jq @@ -0,0 +1,5 @@ +def black: { "red": 0, "green": 0, "blue": 0}; +def red: black + { "red": 255 }; +def yellow: red + { "green": 255 }; + +xor_pattern(384; 384; red; yellow) diff --git a/Task/Mutual-recursion/Ceylon/mutual-recursion.ceylon b/Task/Mutual-recursion/Ceylon/mutual-recursion.ceylon new file mode 100644 index 0000000000..73b096c1c0 --- /dev/null +++ b/Task/Mutual-recursion/Ceylon/mutual-recursion.ceylon @@ -0,0 +1,14 @@ +Integer f(Integer n) + => if (n > 0) + then n - m(f(n-1)) + else 1; + +Integer m(Integer n) + => if (n > 0) + then n - f(m(n-1)) + else 0; + +shared void run() { + printAll((0:20).map(f)); + printAll((0:20).map(m)); +} diff --git a/Task/Mutual-recursion/FreeBASIC/mutual-recursion.freebasic b/Task/Mutual-recursion/FreeBASIC/mutual-recursion.freebasic new file mode 100644 index 0000000000..baadcda1c0 --- /dev/null +++ b/Task/Mutual-recursion/FreeBASIC/mutual-recursion.freebasic @@ -0,0 +1,33 @@ +' FB 1.05.0 Win64 + +' Need forward declaration of M as it's used +' by F before its defined +Declare Function M(n As Integer) As Integer + +Function F(n As Integer) As Integer + If n = 0 Then + Return 1 + End If + Return n - M(F(n - 1)) +End Function + +Function M(n As Integer) As Integer + If n = 0 Then + Return 0 + End If + Return n - F(M(n - 1)) +End Function + +Dim As Integer n = 24 +Print "n :"; +For i As Integer = 0 to n : Print Using "###"; i; : Next +Print +Print String(78, "-") +Print "F :"; +For i As Integer = 0 To n : Print Using "###"; F(i); : Next +Print +Print "M :"; +For i As Integer = 0 To n : Print Using "###"; M(i); : Next +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Mutual-recursion/Idris/mutual-recursion.idris b/Task/Mutual-recursion/Idris/mutual-recursion.idris new file mode 100644 index 0000000000..fea5c225f3 --- /dev/null +++ b/Task/Mutual-recursion/Idris/mutual-recursion.idris @@ -0,0 +1,9 @@ +mutual { + F : Nat -> Nat + F Z = (S Z) + F (S n) = (S n) `minus` M(F(n)) + + M : Nat -> Nat + M Z = Z + M (S n) = (S n) `minus` F(M(n)) +} diff --git a/Task/Mutual-recursion/LibreOffice-Basic/mutual-recursion.libreoffice b/Task/Mutual-recursion/LibreOffice-Basic/mutual-recursion.libreoffice new file mode 100644 index 0000000000..a0448958cb --- /dev/null +++ b/Task/Mutual-recursion/LibreOffice-Basic/mutual-recursion.libreoffice @@ -0,0 +1,94 @@ +'// LibreOffice Basic Implementation of Hofstadter Female-Male sequences + +'// Utility functions +sub setfont(strfont) + ThisComponent.getCurrentController.getViewCursor.charFontName = strfont +end sub + +sub newline + oVC = thisComponent.getCurrentController.getViewCursor + oText = oVC.text + oText.insertControlCharacter(oVC, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False) +end sub + +sub out(sString) + oVC = ThisComponent.getCurrentController.getViewCursor + oText = oVC.text + oText.insertString(oVC, sString, false) +end sub + +sub outln(optional sString) + if not ismissing (sString) then out(sString) + newline +end sub + +function intformat(n as integer,nlen as integer) as string + dim nstr as string + nstr = CStr(n) + while len(nstr) < nlen + nstr = " " & nstr + wend + intformat = nstr +end function + +'// Hofstadter Female-Male function definitions +function F(n as long) as long + if n = 0 Then + F = 1 + elseif n > 0 Then + F = n - M(F(n - 1)) + endif +end function + +function M(n) + if n = 0 Then + M = 0 + elseif n > 0 Then + M = n - F(M(n - 1)) + endif +end function + +'// Hofstadter Female Male sequence demo routine +sub Hofstadter_Female_Male_Demo + '// Introductory Text + setfont("LM Roman 10") + outln("Rosetta Code Hofstadter Female and Male Sequence Challenge") + outln + out("Two functions are said to be mutually recursive if the first calls the second,") + outln(" and in turn the second calls the first.") + out("Write two mutually recursive functions that compute members of the Hofstadter") + outln(" Female and Male sequences defined as:") + outln + setfont("LM Mono Slanted 10") + outln(chr(9)+"F(0) = 1 ; M(0)=0") + outln(chr(9)+"F(n) = n - M(F(n-1)), n > 0") + outln(chr(9)+"M(n) = n - F(M(n-1)), n > 0") + outln + '// Sequence Generation + const nmax as long = 20 + dim n as long + setfont("LM Mono 10") + out("n = " + for n = 0 to nmax + out(" " + intformat(n, 2)) + next n + outln + out("F(n) = " + for n = 0 to nmax + out(" " + intformat(F(n),2)) + next n + outln + out("M(n) = " + for n = 0 to nmax + out(" " + intformat(M(n), 2)) + next n + outln + +end sub + +------------------------------ +Output +------------------------------ +n = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 +F(n) = 1 1 2 2 3 3 4 5 5 6 6 7 8 8 9 9 10 11 11 12 13 +M(n) = 0 0 1 2 2 3 4 4 5 6 6 7 7 8 9 9 10 11 11 12 12 diff --git a/Task/Mutual-recursion/Nim/mutual-recursion.nim b/Task/Mutual-recursion/Nim/mutual-recursion.nim new file mode 100644 index 0000000000..b08fdf154c --- /dev/null +++ b/Task/Mutual-recursion/Nim/mutual-recursion.nim @@ -0,0 +1,13 @@ +proc m(n): int + +proc f(n): int = + if n == 0: 1 + else: n - m(f(n-1)) + +proc m(n): int = + if n == 0: 0 + else: n - f(m(n-1)) + +for i in 1 .. 10: + echo f(i) + echo m(i) diff --git a/Task/Mutual-recursion/Oforth/mutual-recursion.oforth b/Task/Mutual-recursion/Oforth/mutual-recursion.oforth new file mode 100644 index 0000000000..544d9f9c80 --- /dev/null +++ b/Task/Mutual-recursion/Oforth/mutual-recursion.oforth @@ -0,0 +1,12 @@ +Method new: M + +Integer method: F + self 0 == ifTrue: [ 1 return ] + self self 1 - F M - ; + +Integer method: M + self 0 == ifTrue: [ 0 return ] + self self 1 - M F - ; + +0 20 seqFrom map(#F) println +0 20 seqFrom map(#M) println diff --git a/Task/Mutual-recursion/Phix/mutual-recursion-1.phix b/Task/Mutual-recursion/Phix/mutual-recursion-1.phix new file mode 100644 index 0000000000..571ed29597 --- /dev/null +++ b/Task/Mutual-recursion/Phix/mutual-recursion-1.phix @@ -0,0 +1,15 @@ +function F(integer n) + return iff(n?n-M(F(n-1)):1) +end function + +function M(integer n) + return iff(n?n-F(M(n-1)):0) +end function + +for i=0 to 20 do + printf(1," %d",F(i)) +end for +printf(1,"\n") +for i=0 to 20 do + printf(1," %d",M(i)) +end for diff --git a/Task/Mutual-recursion/Phix/mutual-recursion-2.phix b/Task/Mutual-recursion/Phix/mutual-recursion-2.phix new file mode 100644 index 0000000000..c7be3c74d3 --- /dev/null +++ b/Task/Mutual-recursion/Phix/mutual-recursion-2.phix @@ -0,0 +1,2 @@ +forward function F(integer n) +forward function M(integer n) diff --git a/Task/Mutual-recursion/Ring/mutual-recursion.ring b/Task/Mutual-recursion/Ring/mutual-recursion.ring new file mode 100644 index 0000000000..9ec08c3711 --- /dev/null +++ b/Task/Mutual-recursion/Ring/mutual-recursion.ring @@ -0,0 +1,19 @@ +see "F sequence : " +for i = 0 to 20 + see "" + f(i) + " " +next +see nl +see "M sequence : " +for i = 0 to 20 + see "" + m(i) + " " +next + +func f n + fr = 1 + if n != 0 fr = n - m(f(n - 1)) ok + return fr + +func m n + mr = 0 + if n != 0 mr = n - f(m(n - 1)) ok + return mr diff --git a/Task/Mutual-recursion/Sidef/mutual-recursion.sidef b/Task/Mutual-recursion/Sidef/mutual-recursion.sidef new file mode 100644 index 0000000000..13f361449e --- /dev/null +++ b/Task/Mutual-recursion/Sidef/mutual-recursion.sidef @@ -0,0 +1,9 @@ +func F(){}; +func M(){}; + +F = func(n) { n > 0 ? (n - M(F(n-1))) : 1 }; +M = func(n) { n > 0 ? (n - F(M(n-1))) : 0 }; + +[F, M].each { |seq| + (0..19).map {|i| seq.call(i)}.join(' ').say; +} diff --git a/Task/Mutual-recursion/Swift/mutual-recursion.swift b/Task/Mutual-recursion/Swift/mutual-recursion.swift new file mode 100644 index 0000000000..23247079aa --- /dev/null +++ b/Task/Mutual-recursion/Swift/mutual-recursion.swift @@ -0,0 +1,16 @@ +func F(n: Int) -> Int { + return n == 0 ? 1 : n - M(F(n-1)) +} + +func M(n: Int) -> Int { + return n == 0 ? 0 : n - F(M(n-1)) +} + +for i in 0..20 { + print("\(F(i)) ") +} +println() +for i in 0..20 { + print("\(M(i)) ") +} +println() diff --git a/Task/Mutual-recursion/jq/mutual-recursion-1.jq b/Task/Mutual-recursion/jq/mutual-recursion-1.jq new file mode 100644 index 0000000000..d8bf50bd1a --- /dev/null +++ b/Task/Mutual-recursion/jq/mutual-recursion-1.jq @@ -0,0 +1,4 @@ +def F: 0; # declare required signature + +def M: if . == 0 then 0 else . - ((. - 1) | M | F) end; +def F: if . == 0 then 1 else . - ((. - 1) | F | M) end; diff --git a/Task/Mutual-recursion/jq/mutual-recursion-2.jq b/Task/Mutual-recursion/jq/mutual-recursion-2.jq new file mode 100644 index 0000000000..53f091e941 --- /dev/null +++ b/Task/Mutual-recursion/jq/mutual-recursion-2.jq @@ -0,0 +1,2 @@ +[range(0;20) | F], +[range(0;20) | M] diff --git a/Task/Mutual-recursion/jq/mutual-recursion-3.jq b/Task/Mutual-recursion/jq/mutual-recursion-3.jq new file mode 100644 index 0000000000..ac2b189944 --- /dev/null +++ b/Task/Mutual-recursion/jq/mutual-recursion-3.jq @@ -0,0 +1,4 @@ +$ jq -n -c -f Mutual_recursion.jq + +[1,1,2,2,3,3,4,5,5,6,6,7,8,8,9,9,10,11,11,12] +[0,0,1,2,2,3,4,4,5,6,6,7,7,8,9,9,10,11,11,12] diff --git a/Task/N-queens-problem/Arc/n-queens-problem.arc b/Task/N-queens-problem/Arc/n-queens-problem.arc new file mode 100644 index 0000000000..78f9a56830 --- /dev/null +++ b/Task/N-queens-problem/Arc/n-queens-problem.arc @@ -0,0 +1,20 @@ +(def nqueens (n (o queens)) + (if (< len.queens n) + (let row (if queens (+ 1 queens.0.0) 0) + (each col (range 0 (- n 1)) + (let new-queens (cons (list row col) queens) + (if (no conflicts.new-queens) + (nqueens n new-queens))))) + (prn queens))) + +; check if the first queen in 'queens' lies on the same column or diagonal as +; any of the others +(def conflicts (queens) + (let (curr . rest) queens + (or (let curr-column curr.1 + (some curr-column (map [_ 1] rest))) ; columns + (some [diagonal-match curr _] rest)))) + +(def diagonal-match (curr other) + (is (abs (- curr.0 other.0)) + (abs (- curr.1 other.1)))) diff --git a/Task/N-queens-problem/ERRE/n-queens-problem.erre b/Task/N-queens-problem/ERRE/n-queens-problem.erre new file mode 100644 index 0000000000..aefe6efe99 --- /dev/null +++ b/Task/N-queens-problem/ERRE/n-queens-problem.erre @@ -0,0 +1,84 @@ +!------------------------------------------------ +! QUEENS.R : solve queens problem on a NxN board +!------------------------------------------------ + +PROGRAM QUEENS + +DIM COL%[15] + +BEGIN + MAXSIZE%=15 + PRINT(TAB(25);" --- PROBLEMA DELLE REGINE --- ") + PRINT + PRINT("Board dimension ";) + INPUT(N%) + PRINT + IF (N%<1 OR N%>MAXSIZE%) + THEN + PRINT("Illegal dimension!!") + ELSE + FOR CURCOLNBR%=1 TO N% + COL%[CURCOLNBR%]=0 + END FOR + CURCOLNBR%=1 + WHILE CURCOLNBR%>0 DO + PLACEDAQUEEN%=FALSE + I%=COL%[CURCOLNBR%]+1 + WHILE (I%<=N%) AND NOT PLACEDAQUEEN% DO + PLACEDAQUEEN%=TRUE + J%=1 + WHILE PLACEDAQUEEN% AND (J%I% + J%=J%+1 + END WHILE + IF PLACEDAQUEEN% + THEN + DIAGNBR%=I%+CURCOLNBR% + J%=1 + WHILE PLACEDAQUEEN% AND (J%DIAGNBR% + J%=J%+1 + END WHILE + ELSE + END IF + IF PLACEDAQUEEN% + THEN + DIAGNBR%=I%-CURCOLNBR% + J%=1 + WHILE PLACEDAQUEEN% AND (J%DIAGNBR% + J%=J%+1 + END WHILE + ELSE + END IF + IF NOT PLACEDAQUEEN% + THEN + I%=I%+1 + ELSE + COL%[CURCOLNBR%]=I% + END IF + END WHILE + IF NOT PLACEDAQUEEN% + THEN + COL%[CURCOLNBR%]=0 + CURCOLNBR%=CURCOLNBR%-1 + ELSE + IF CURCOLNBR%=N% + THEN + NSOL%=NSOL%+1 + PRINT("Soluzione";NSOL%;":";) + FOR I%=1 TO N% + PRINT(COL%[I%];) + END FOR + PRINT + ELSE + CURCOLNBR%=CURCOLNBR%+1 + END IF + END IF + END WHILE + PRINT("Search completed") + REPEAT + GET(CH$) + UNTIL CH$<>"" + END IF +END PROGRAM diff --git a/Task/N-queens-problem/EchoLisp/n-queens-problem.echolisp b/Task/N-queens-problem/EchoLisp/n-queens-problem.echolisp new file mode 100644 index 0000000000..a25e56ad29 --- /dev/null +++ b/Task/N-queens-problem/EchoLisp/n-queens-problem.echolisp @@ -0,0 +1,57 @@ +;; square num is i + j*N +(define-syntax-rule (sq i j) (+ i (* j N))) + +;; compute diag number for each square +(define (do-diag1 i0 j0 dnum into: dnum1 N) ;; ++i and ++j diags + (for [(i (in-range i0 N)) (j (in-range j0 N))] + ;;(writeln i j 'diag1 dnum) + (vector-set! dnum1 (sq i j) dnum))) + +(define (do-diag2 i0 j0 dnum into: dnum2 N) ;; --i and ++j diags + (for [(i (in-range i0 -1 -1)) (j (in-range j0 N))] + ;; (writeln i j 'diag2 dnum) + (vector-set! dnum2 (sq i j) dnum))) + +(define (init-diags dnum1 dnum2 N) + (define dnum 0) + (for ((j N)) (do-diag1 0 j dnum dnum1 N) (++ dnum)) + (for ((i (in-range 1 N))) + (do-diag1 i 0 dnum dnum1 N) (++ dnum)) + (set! dnum 0) + (for ((j N)) (do-diag2 (1- N) j dnum dnum2 N) (++ dnum)) + (for ((i (1- N))) (do-diag2 i 0 dnum dnum2 N) (++ dnum))) +;; end boring diags part + +(define (q-search i N col diag1 diag2 dnum1 dnum2 &hits (ns)) +(cond +[(= i N) (set-box! &hits (1+ (unbox &hits))) ] ;; (writeln 'HIT col) + [else + + (for ((j N)) + (set! ns (sq i j)) + #:continue (or [col j] [diag1 [dnum1 ns]] [diag2 [dnum2 ns]]) + (vector-set! col j i) ;; move + (vector-set! diag1 [dnum1 ns] #t) ;; flag busy diagonal + (vector-set! diag2 [dnum2 ns] #t) + (q-search (1+ i) N col diag1 diag2 dnum1 dnum2 &hits) + (vector-set! col j #f) ;; unmove + (vector-set! diag1 [dnum1 ns] #f) + (vector-set! diag2 [dnum2 ns] #f)) + ])) + +(define (q-count (N 8)) + (define dnum1 (make-vector (* N N))) + (define dnum2 (make-vector (* N N ))) + (init-diags dnum1 dnum2 N) + + (define diag1 (make-vector (* 2 N) #f)) ; busy diag's + (define diag2 (make-vector (* 2 N) #f)) + (define col (make-vector N #f)) + (define &hits (box 0)) + + + (q-search 0 N col diag1 diag2 dnum1 dnum2 &hits) + (unbox &hits)) + +(define (task up-to-n) + (for ((i up-to-n)) (writeln i ' ♕ (q-count i) 'solutions))) diff --git a/Task/N-queens-problem/Nim/n-queens-problem.nim b/Task/N-queens-problem/Nim/n-queens-problem.nim new file mode 100644 index 0000000000..c0c0c043b5 --- /dev/null +++ b/Task/N-queens-problem/Nim/n-queens-problem.nim @@ -0,0 +1,25 @@ +const boardSize = 8 + +proc underAttack(col, queens): bool = + if col in queens: return true + for i, x in queens: + if abs(col - x) == queens.len - i: + return true + return false + +proc solve(n): auto = + result = newSeq[seq[int]]() + result.add(@[]) + var newSolutions = newSeq[seq[int]]() + for row in 1..n: + for solution in result: + for i in 1..boardSize: + if not underAttack(i, solution): + newSolutions.add(solution & i) + swap result, newSolutions + newSolutions.setLen(0) + +for answer in solve(boardSize): + for i, x in answer: + if i > 0: stdout.write ", " + stdout.write "(",i,", ",x,")" diff --git a/Task/N-queens-problem/Sparkling/n-queens-problem.sparkling b/Task/N-queens-problem/Sparkling/n-queens-problem.sparkling new file mode 100644 index 0000000000..ee5374f4c9 --- /dev/null +++ b/Task/N-queens-problem/Sparkling/n-queens-problem.sparkling @@ -0,0 +1,54 @@ +let print_table = function (pos) { + pos.foreach(function (_, i) { + stdout.printf(" %c", 'a' + i); + }); + + stdout.write("\n"); + + pos.foreach(function (col, row) { + stdout.printf("%d", row + 1); + stdout.printf("%s #\n", range(col).reduce("", function (s, t) { + return s .. " "; + })); + }); + + stdout.write("\n\n"); +}; + +let threatens = function (row_a, col_a, row_b, col_b) { + return row_a == row_b + or col_a == col_b + or abs(row_a - row_b) == abs(col_a - col_b); +}; + +let good = function(pos, end_idx) { + return pos.all(function (col_a, row_a) { + return range(row_a + 1, end_idx).all(function (row_b) { + let col_b = pos[row_b]; + return not threatens(row_a, col_a, row_b, col_b); + }); + }); +}; + +// Returns number of solutions +let n_queens = function (pos, index) { + if index >= pos.length { + if good(pos, index) { + print_table(pos); + return 1; + } + + return 0; + } + + if not good(pos, index) { + return 0; + } + + return pos.map(function (_, col) { + pos[index] = col; + return n_queens(pos, index + 1); + }).reduce(0, function (a, b) { return a + b; }); +}; + +stdout.printf("%d solutions\n", n_queens(range(8), 0)); diff --git a/Task/N-queens-problem/jq/n-queens-problem-1.jq b/Task/N-queens-problem/jq/n-queens-problem-1.jq new file mode 100644 index 0000000000..ce72d4c495 --- /dev/null +++ b/Task/N-queens-problem/jq/n-queens-problem-1.jq @@ -0,0 +1,25 @@ +def single_solution_queens(n): + def q: "♛"; + def init(k): reduce range(0;k) as $i ([]; . + ["."]); + def matrix(k): init(k) as $row | reduce range(0;k) as $i ([]; . + [$row]); + def place(stream; i; j): + # jq indexing is based on offsets but we are using the 1-based formulae: + reduce stream as $s (.; setpath([-1+($s|i), -1+($s|j)]; q) ); + def even(k): + if ((k-2) % 6) != 0 then + place( range(1; 1+(k/2)); .; 2*. ) + | place( range(1; 1+(k/2)); (k/2) + .; 2*. -1 ) + else place( range(1; 1+(k/2)); .; 1 + ((2*. + (k/2) - 3) % k)) + | place( range(1; 1+(n/2)); n + 1 - .; n - ((2*. + (n/2) - 3) % n)) + end; + + matrix(n) # the chess board + | if (n % 2) == 0 then even(n) + else even(n-1) | .[n-1][n-1] = q + end; + +# Example: +def pp: reduce .[] as $row + (""; reduce $row[] as $x (.; . + $x) + "\n"); + +single_solution_queens(8) | pp diff --git a/Task/N-queens-problem/jq/n-queens-problem-2.jq b/Task/N-queens-problem/jq/n-queens-problem-2.jq new file mode 100644 index 0000000000..251e1596f1 --- /dev/null +++ b/Task/N-queens-problem/jq/n-queens-problem-2.jq @@ -0,0 +1,8 @@ +...♛.... +.....♛.. +.......♛ +.♛...... +......♛. +♛....... +..♛..... +....♛... diff --git a/Task/N-queens-problem/jq/n-queens-problem-3.jq b/Task/N-queens-problem/jq/n-queens-problem-3.jq new file mode 100644 index 0000000000..d50b0921cd --- /dev/null +++ b/Task/N-queens-problem/jq/n-queens-problem-3.jq @@ -0,0 +1,13 @@ +# permutations of 0 .. (n-1) +def permutations(n): + # Given a single array, generate a stream by inserting n at different positions: + def insert(m;n): + if m >= 0 then (.[0:m] + [n] + .[m:]), insert(m-1;n) else empty end; + + if n==0 then [] + elif n == 1 then [1] + else + permutations(n-1) | insert(n-1; n) + end; + +def count(g): reduce g as $i (0; .+1); diff --git a/Task/N-queens-problem/jq/n-queens-problem-4.jq b/Task/N-queens-problem/jq/n-queens-problem-4.jq new file mode 100644 index 0000000000..3882a38423 --- /dev/null +++ b/Task/N-queens-problem/jq/n-queens-problem-4.jq @@ -0,0 +1,16 @@ +def queens(n): + def sums: + . as $board + | [ range(0;length) | . + $board[.]] + | unique | length; + + def differences: + . as $board + | [ range(0;length) | . - $board[.]] + | unique | length; + + def allowable: + length as $n + | sums == $n and differences == $n; + + count( permutations(n) | select(allowable) ); diff --git a/Task/N-queens-problem/jq/n-queens-problem-5.jq b/Task/N-queens-problem/jq/n-queens-problem-5.jq new file mode 100644 index 0000000000..5d48f12d6e --- /dev/null +++ b/Task/N-queens-problem/jq/n-queens-problem-5.jq @@ -0,0 +1 @@ +queens(8) diff --git a/Task/Named-parameters/Lasso/named-parameters.lasso b/Task/Named-parameters/Lasso/named-parameters.lasso new file mode 100644 index 0000000000..edb03b7317 --- /dev/null +++ b/Task/Named-parameters/Lasso/named-parameters.lasso @@ -0,0 +1,16 @@ +define mymethod( + -first::integer, // with no default value the param is required + -second::integer, + -delimiter::string = ':' // when given a default value the param becomes optional +) => #first + #delimiter + #second + +mymethod( + -first = 54, + -second = 45 +) +'
' +mymethod( + -second = 45, // named params can be given in any order + -first = 54, + -delimiter = '#' +) diff --git a/Task/Named-parameters/Lingo/named-parameters.lingo b/Task/Named-parameters/Lingo/named-parameters.lingo new file mode 100644 index 0000000000..b2030d26ff --- /dev/null +++ b/Task/Named-parameters/Lingo/named-parameters.lingo @@ -0,0 +1,22 @@ +-- accepts either 3 integers or a single property list +on foo (arg1, arg2, arg3) + if ilk(arg1)=#propList then + args = arg1 + arg1 = args[#arg1] + arg2 = args[#arg2] + arg3 = args[#arg3] + end if + put "arg1="&arg1 + put "arg2="&arg2 + put "arg3="&arg3 +end + +foo(1,2) -- 3rd argument omitted +-- "arg1=1" +-- "arg2=2" +-- "arg3=" + +foo([#arg3:3]) -- only 3rd argument specified +-- "arg1=" +-- "arg2=" +-- "arg3=3" diff --git a/Task/Named-parameters/Nim/named-parameters.nim b/Task/Named-parameters/Nim/named-parameters.nim new file mode 100644 index 0000000000..df93087b3a --- /dev/null +++ b/Task/Named-parameters/Nim/named-parameters.nim @@ -0,0 +1,4 @@ +proc subtract(x, y): auto = x - y + +echo subtract(5, 3) # used as positional parameters +echo subtract(y = 3, x = 5) # used as named parameters diff --git a/Task/Named-parameters/Phix/named-parameters.phix b/Task/Named-parameters/Phix/named-parameters.phix new file mode 100644 index 0000000000..c435db6611 --- /dev/null +++ b/Task/Named-parameters/Phix/named-parameters.phix @@ -0,0 +1,9 @@ +global function timedelta(atom weeks=0, atom days=0, atom hours=0, atom minutes=0, atom seconds=0, atom milliseconds=0, atom microseconds=0) +-- can be invoked as: +constant fourdays = timedelta(days:=4) +-- fourdays = timedelta(0,4) -- equivalent +-- **NB** a plain '=' is a very different thing +constant oneday = timedelta(days=1) -- equivalent to timedelta([weeks:=]iff((equal(days,1)?true:false)) + -- - with an error if no local variable days exists. +constant shift = timedelta(hours:=hours) -- perfectly valid (param hours:=local hours) +-- timedelta(0,hours:=15,3) -- illegal (it is not clear whether you meant days:=3 or minutes:=3) diff --git a/Task/Named-parameters/Sidef/named-parameters.sidef b/Task/Named-parameters/Sidef/named-parameters.sidef new file mode 100644 index 0000000000..a4cf9f03bb --- /dev/null +++ b/Task/Named-parameters/Sidef/named-parameters.sidef @@ -0,0 +1,6 @@ +func example(foo: 0, bar: 1, grill: "pork chops") { + say "foo is #{foo}, bar is #{bar}, and grill is #{grill}"; +} + +# Note that :foo is omitted and :grill precedes :bar +example(grill: "lamb kebab", bar: 3.14); diff --git a/Task/Named-parameters/Swift/named-parameters-1.swift b/Task/Named-parameters/Swift/named-parameters-1.swift new file mode 100644 index 0000000000..52f357e6df --- /dev/null +++ b/Task/Named-parameters/Swift/named-parameters-1.swift @@ -0,0 +1,4 @@ +func isGreater(x x:Int, thanY y:Int) -> Bool { + return x > y +} +assert(isGreater(x: 5, thanY: 10) == false) diff --git a/Task/Named-parameters/Swift/named-parameters-2.swift b/Task/Named-parameters/Swift/named-parameters-2.swift new file mode 100644 index 0000000000..a6c9c9fa4c --- /dev/null +++ b/Task/Named-parameters/Swift/named-parameters-2.swift @@ -0,0 +1,4 @@ +func isGreater(x:Int, _ y:Int) -> Bool { + return x > y +} +assert(isGreater(5, 10) == false) diff --git a/Task/Named-parameters/jq/named-parameters-1.jq b/Task/Named-parameters/jq/named-parameters-1.jq new file mode 100644 index 0000000000..5d44ad05ac --- /dev/null +++ b/Task/Named-parameters/jq/named-parameters-1.jq @@ -0,0 +1,7 @@ +def formatName(obj): + ({ "name": "?"} + obj) as $obj # the default default value is null + | ($obj|.name) as $name + | ($obj|.first) as $first + | if ($first == null) then $name + else $name + ", " + $first + end; diff --git a/Task/Named-parameters/jq/named-parameters-2.jq b/Task/Named-parameters/jq/named-parameters-2.jq new file mode 100644 index 0000000000..104bcab240 --- /dev/null +++ b/Task/Named-parameters/jq/named-parameters-2.jq @@ -0,0 +1,9 @@ +formatName({"first": "George", "name": "Eliot"}) + +formatName({"name": "Eliot", "first": "George"}) + +formatName({"name": "Eliot"}) + +formatName({"first": "George"}) + +formatName({}) diff --git a/Task/Narcissist/Sidef/narcissist.sidef b/Task/Narcissist/Sidef/narcissist.sidef new file mode 100644 index 0000000000..1d0bf66bf5 --- /dev/null +++ b/Task/Narcissist/Sidef/narcissist.sidef @@ -0,0 +1 @@ +say (File.new(__FILE__).open_r.slurp == ARGF.slurp); diff --git a/Task/Narcissistic-decimal-number/ERRE/narcissistic-decimal-number.erre b/Task/Narcissistic-decimal-number/ERRE/narcissistic-decimal-number.erre new file mode 100644 index 0000000000..83a0fbd082 --- /dev/null +++ b/Task/Narcissistic-decimal-number/ERRE/narcissistic-decimal-number.erre @@ -0,0 +1,22 @@ +PROGRAM NARCISISTIC + +!$DOUBLE + +BEGIN + N=0 + LOOP + LENG=LEN(MID$(STR$(N),2)) + SUM=0 + FOR I=1 TO LENG DO + C$=MID$(STR$(N),2) + C=VAL(MID$(C$,I,1)) + SUM+=C^LENG + END FOR + IF N=SUM THEN + PRINT(N;) + COUNT=COUNT+1 + EXIT IF COUNT=25 + END IF + N=N+1 + END LOOP +END PROGRAM diff --git a/Task/Narcissistic-decimal-number/FreeBASIC/narcissistic-decimal-number-1.freebasic b/Task/Narcissistic-decimal-number/FreeBASIC/narcissistic-decimal-number-1.freebasic new file mode 100644 index 0000000000..f2a60e272f --- /dev/null +++ b/Task/Narcissistic-decimal-number/FreeBASIC/narcissistic-decimal-number-1.freebasic @@ -0,0 +1,61 @@ +' normal version: 17-06-2015 +' compile with: fbc -s console +' can go up to 19 digits (ulongint is 64bit), above 19 overflow will occur + +Dim As Integer n, n0, n1, n2, n3, n4, n5, n6, n7, n8, n9, a, b +Dim As Integer d() +Dim As ULongInt d2pow(0 To 9) = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} +Dim As ULongInt x +Dim As String str_x + +For n = 1 To 7 + For n9 = n To 0 Step -1 + For n8 = n-n9 To 0 Step -1 + For n7 = n-n9-n8 To 0 Step -1 + For n6 = n-n9-n8-n7 To 0 Step -1 + For n5 = n-n9-n8-n7-n6 To 0 Step -1 + For n4 = n-n9-n8-n7-n6-n5 To 0 Step -1 + For n3 = n-n9-n8-n7-n6-n5-n4 To 0 Step -1 + For n2 = n-n9-n8-n7-n6-n5-n4-n3 To 0 Step -1 + For n1 = n-n9-n8-n7-n6-n5-n4-n3-n2 To 0 Step -1 + n0 = n-n9-n8-n7-n6-n5-n4-n3-n2-n1 + + x = n1*d2pow(1) + n2*d2pow(2) + n3*d2pow(3) + n4*d2pow(4) + n5*d2pow(5)_ + + n6*d2pow(6) + n7*d2pow(7) + n8*d2pow(8) + n9*d2pow(9) + + str_x = Str(x) + If Len(str_x) = n Then + + ReDim d(10) + For a = 0 To n-1 + d(Str_x[a]- Asc("0")) += 1 + Next a + + If n0 = d(0) AndAlso n1 = d(1) AndAlso n2 = d(2) AndAlso n3 = d(3)_ + AndAlso n4 = d(4) AndAlso n5 = d(5) AndAlso n6 = d(6)_ + AndAlso n7 = d(7) AndAlso n8 = d(8) AndAlso n9 = d(9) Then + Print x + End If + End If + + Next n1 + Next n2 + Next n3 + Next n4 + Next n5 + Next n6 + Next n7 + Next n8 + Next n9 + + For a As Integer = 2 To 9 + d2pow(a) = d2pow(a) * a + Next a + +Next n + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Narcissistic-decimal-number/FreeBASIC/narcissistic-decimal-number-2.freebasic b/Task/Narcissistic-decimal-number/FreeBASIC/narcissistic-decimal-number-2.freebasic new file mode 100644 index 0000000000..04996a4aff --- /dev/null +++ b/Task/Narcissistic-decimal-number/FreeBASIC/narcissistic-decimal-number-2.freebasic @@ -0,0 +1,103 @@ +' gmp version: 17-06-2015 +' uses gmp +' compile with: fbc -s console + +#Include Once "gmp.bi" +' change the number after max for the maximum n-digits you want (2 to 61) +#Define max 61 + +Dim As Integer n, n0, n1, n2, n3, n4, n5, n6, n7, n8, n9 +Dim As Integer i, j +Dim As UInteger d() +Dim As ZString Ptr gmp_str +gmp_str = Allocate(100) + +' create gmp integer array, +Dim d2pow(9, max) As Mpz_ptr +' initialize array and set start value, +For i = 0 To 9 + For j = 0 To max + d2pow(i, j) = Allocate(Len(__mpz_struct)) : Mpz_init(d2pow(i, j)) + Next j +Next i + +' gmp integers for to hold intermediate result +Dim As Mpz_ptr x1 = Allocate(Len(__mpz_struct)) : Mpz_init(x1) +Dim As Mpz_ptr x2 = Allocate(Len(__mpz_struct)) : Mpz_init(x2) +Dim As Mpz_ptr x3 = Allocate(Len(__mpz_struct)) : Mpz_init(x3) +Dim As Mpz_ptr x4 = Allocate(Len(__mpz_struct)) : Mpz_init(x4) +Dim As Mpz_ptr x5 = Allocate(Len(__mpz_struct)) : Mpz_init(x5) +Dim As Mpz_ptr x6 = Allocate(Len(__mpz_struct)) : Mpz_init(x6) +Dim As Mpz_ptr x7 = Allocate(Len(__mpz_struct)) : Mpz_init(x7) +Dim As Mpz_ptr x8 = Allocate(Len(__mpz_struct)) : Mpz_init(x8) + +For n = 1 To max + + For i = 1 To 9 + 'Mpz_set_ui(d2pow(i,0), 0) + Mpz_ui_pow_ui(d2pow(i,1), i, n) + For j = 2 To n + Mpz_mul_ui(d2pow(i, j), d2pow(i, 1), j) + Next j + Next i + + For n9 = n To 0 Step -1 + For n8 = n-n9 To 0 Step -1 + Mpz_add(x8, d2pow(9, n9), d2pow(8, n8)) + For n7 = n-n9-n8 To 0 Step -1 + Mpz_add(x7, x8, d2pow(7, n7)) + For n6 = n-n9-n8-n7 To 0 Step -1 + Mpz_add(x6, x7, d2pow(6, n6)) + For n5 = n-n9-n8-n7-n6 To 0 Step -1 + Mpz_add(x5, x6, d2pow(5, n5)) + For n4 = n-n9-n8-n7-n6-n5 To 0 Step -1 + Mpz_add(x4, x5, d2pow(4, n4)) + For n3 = n-n9-n8-n7-n6-n5-n4 To 0 Step -1 + Mpz_add(x3, x4, d2pow(3, n3)) + For n2 = n-n9-n8-n7-n6-n5-n4-n3 To 0 Step -1 + Mpz_add(x2, x3, d2pow(2, n2)) + For n1 = n-n9-n8-n7-n6-n5-n4-n3-n2 To 0 Step -1 + Mpz_add_ui(x1, x2, n1) + n0 = n-n9-n8-n7-n6-n5-n4-n3-n2-n1 + + Mpz_get_str(gmp_str, 10, x1) + + If Len(*gmp_str) = n Then + ReDim d(10) + + For i = 0 To n-1 + d(gmp_str[i] - Asc("0")) += 1 + Next i + + If n9 = d(9) AndAlso n8 = d(8) AndAlso n7 = d(7) AndAlso n6 = d(6)_ + AndAlso n5 = d(5) AndAlso n4 = d(4) AndAlso n3 = d(3)_ + AndAlso n2 = d(2) AndAlso n1 = d(1) AndAlso n0 = d(0) Then + Print *gmp_str + End If + ElseIf Len(*gmp_str) < n Then + ' all for next loops have a negative step value + ' if len(str_x) becomes smaller then n it's time to try the next n value + ' GoTo label1 ' old school BASIC + ' prefered FreeBASIC style + Exit For, For, For, For, For, For, For, For, For + ' leave n1, n2, n3, n4, n5, n6, n7, n8, n9 loop + ' and continue's after next n9 + End If + + Next n1 + Next n2 + Next n3 + Next n4 + Next n5 + Next n6 + Next n7 + Next n8 + Next n9 + ' label1: +Next n + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Narcissistic-decimal-number/FunL/narcissistic-decimal-number.funl b/Task/Narcissistic-decimal-number/FunL/narcissistic-decimal-number.funl new file mode 100644 index 0000000000..4e692e828f --- /dev/null +++ b/Task/Narcissistic-decimal-number/FunL/narcissistic-decimal-number.funl @@ -0,0 +1,20 @@ +def narcissistic( start ) = + power = 1 + powers = array( 0..9 ) + + def narc( n ) = + num = n.toString() + m = num.length() + + if power != m + power = m + powers( 0..9 ) = [i^m | i <- 0..9] + + if n == sum( powers(int(d)) | d <- num ) + n # narc( n + 1 ) + else + narc( n + 1 ) + + narc( start ) + +println( narcissistic(0).take(25) ) diff --git a/Task/Narcissistic-decimal-number/Oforth/narcissistic-decimal-number.oforth b/Task/Narcissistic-decimal-number/Oforth/narcissistic-decimal-number.oforth new file mode 100644 index 0000000000..849e755a3a --- /dev/null +++ b/Task/Narcissistic-decimal-number/Oforth/narcissistic-decimal-number.oforth @@ -0,0 +1,9 @@ +: isNarcissistic(n) +| i m | + n 0 while( n ) [ n 10 /mod ->n swap 1 + ] ->m + 0 m loop: i [ swap m pow + ] == ; + +: genNarcissistic(n) +| l | + ListBuffer new dup ->l + 0 while(l size n <>) [ dup isNarcissistic ifTrue: [ dup l add ] 1 + ] drop ; diff --git a/Task/Narcissistic-decimal-number/Ring/narcissistic-decimal-number.ring b/Task/Narcissistic-decimal-number/Ring/narcissistic-decimal-number.ring new file mode 100644 index 0000000000..c1518fcb6e --- /dev/null +++ b/Task/Narcissistic-decimal-number/Ring/narcissistic-decimal-number.ring @@ -0,0 +1,20 @@ +n = 0 +count = 0 +size = 15 +while count != size + m = isNarc(n) + if m=1 see "" + n + " is narcisstic" + nl + count = count + 1 ok + n = n + 1 +end + +func isNarc n + m = len(string(n)) + sum = 0 + digit = 0 + for pos = 1 to m + digit = number(substr(string(n), pos, 1)) + sum = sum + pow(digit,m) + next + nr = (sum = n) + return nr diff --git a/Task/Narcissistic-decimal-number/Sidef/narcissistic-decimal-number.sidef b/Task/Narcissistic-decimal-number/Sidef/narcissistic-decimal-number.sidef new file mode 100644 index 0000000000..959a17410b --- /dev/null +++ b/Task/Narcissistic-decimal-number/Sidef/narcissistic-decimal-number.sidef @@ -0,0 +1,11 @@ +func is_narcissistic(n) { + n.digits »**» n.len -> sum(0) == n +} + +var count = 0 +for i in (0..^Inf) { + if (is_narcissistic(i)) { + say "#{++count}\t#{i}" + break if (count == 25) + } +} diff --git a/Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-1.jq b/Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-1.jq new file mode 100644 index 0000000000..6ff3cf00f6 --- /dev/null +++ b/Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-1.jq @@ -0,0 +1,7 @@ +def is_narcissistic: + def digits: tostring | explode[] | [.] | implode | tonumber; + def pow(n): . as $x | reduce range(0;n) as $i (1; . * $x); + + (tostring | length) as $len + | . == reduce digits as $d (0; . + ($d | pow($len)) ) + end; diff --git a/Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-2.jq b/Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-2.jq new file mode 100644 index 0000000000..71db2585aa --- /dev/null +++ b/Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-2.jq @@ -0,0 +1,8 @@ +# Input: [i, [0^i, 1^i, 2^i, ..., 9^i]] +# Output: [j, [0^j, 1^j, 2^j, ..., 9^j]] +# provided j is i or (i+1) +def powers(j): + if .[0] == j then . + else .[0] += 1 + | reduce range(0;10) as $k (.; .[1][$k] *= $k) + end; diff --git a/Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-3.jq b/Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-3.jq new file mode 100644 index 0000000000..15265c6d8a --- /dev/null +++ b/Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-3.jq @@ -0,0 +1,8 @@ +# Input: [n, [i, [0^i, 1^i, 2^i,...]]] where i is the number of digits in n. +def is_narcissistic: + def digits: tostring | explode[] | [.] | implode | tonumber; + .[1][1] as $powers + | .[0] + | if . < 0 then false + else . == reduce digits as $d (0; . + $powers[$d] ) + end; diff --git a/Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-4.jq b/Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-4.jq new file mode 100644 index 0000000000..f1db37776d --- /dev/null +++ b/Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-4.jq @@ -0,0 +1,23 @@ +# If your jq has "while", then feel free to omit the following definition: +def while(cond; update): + def _while: if cond then ., (update | _while) else empty end; + _while; + +# The first k narcissistic numbers, beginning with 0: +def narcissistic(k): + # State: [n, is_narcissistic, count, [len, [0^len, 1^len, ...]]] + # where len is the number of digits in n. + [0, true, 1, [1, [range(0;10)]]] + | while( .[2] <= k; + .[3] as $powers + | (.[0]+1) as $n + | ($n | tostring | length) as $len + | ($powers | powers($len)) as $powersprime + | if [$n, $powersprime] | is_narcissistic + then [$n, true, .[2] + 1, $powersprime] + else [$n, false, .[2], $powersprime ] + end ) + | select(.[1]) + | "\(.[2]): \(.[0])" ; + +narcissistic(25) diff --git a/Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-5.jq b/Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-5.jq new file mode 100644 index 0000000000..cb78943f9c --- /dev/null +++ b/Task/Narcissistic-decimal-number/jq/narcissistic-decimal-number-5.jq @@ -0,0 +1,26 @@ +jq -r -n -f Narcissitic_decimal_number.jq +1: 0 +2: 1 +3: 2 +4: 3 +5: 4 +6: 5 +7: 6 +8: 7 +9: 8 +10: 9 +11: 153 +12: 370 +13: 371 +14: 407 +15: 1634 +16: 8208 +17: 9474 +18: 54748 +19: 92727 +20: 93084 +21: 548834 +22: 1741725 +23: 4210818 +24: 9800817 +25: 9926315 diff --git a/Task/Natural-sorting/Sidef/natural-sorting-1.sidef b/Task/Natural-sorting/Sidef/natural-sorting-1.sidef new file mode 100644 index 0000000000..94297ca7ce --- /dev/null +++ b/Task/Natural-sorting/Sidef/natural-sorting-1.sidef @@ -0,0 +1,26 @@ +class String { + # Sort groups of digits in number order. Sort by order of magnitude then lexically. + -> naturally { self.lc.gsub(/(\d+)/, {|s1| "0" + s1.len.chr + s1 }) + "\x0" + self }; + + # Collapse multiple ws characters to a single. + -> collapse { self.gsub(/(\s)\1+/, {|s1| s1 }) }; + + # Convert all ws characters to a space. + -> normalize { self.gsub(/(\s)/, ' ') }; + + # Ignore common leading articles for title sorts + -> title { self.sub(/^(?:a|an|the)\b\s*/i, '') }; + + # Decompose ISO-Latin1 glyphs to their base character. + -> latin1_decompose { + static tr = Hash.new(%w( + Æ AE æ ae Þ TH þ th Ð TH ð th ß ss À A Á A  A à A Ä A Å A à a á a + â a ã a ä a å a Ç C ç c È E É E Ê E Ë E è e é e ê e ë e Ì I Í I Î + I Ï I ì i í i î i ï i Ò O Ó O Ô O Õ O Ö O Ø O ò o ó o ô o õ o ö o + ø o Ñ N ñ n Ù U Ú U Û U Ü U ù u ú u û u ü u Ý Y ÿ y ý y + )...); + + var re = Regex.new('(' + tr.keys.join('|') + ')'); + self.gsub(re, {|s1| tr{s1} }); + } +} diff --git a/Task/Natural-sorting/Sidef/natural-sorting-2.sidef b/Task/Natural-sorting/Sidef/natural-sorting-2.sidef new file mode 100644 index 0000000000..6f44edc298 --- /dev/null +++ b/Task/Natural-sorting/Sidef/natural-sorting-2.sidef @@ -0,0 +1,74 @@ +var tests = [ + [ + "Task 1a\nSort while ignoring leading spaces.", + [ + 'ignore leading spaces: 1', ' ignore leading spaces: 4', + ' ignore leading spaces: 3', ' ignore leading spaces: 2' + ], + { .trim } # builtin method. + ], + [ + "Task 1b\nSort while ignoring multiple adjacent spaces.", + [ + 'ignore m.a.s spaces: 3', 'ignore m.a.s spaces: 1', + 'ignore m.a.s spaces: 4', 'ignore m.a.s spaces: 2' + ], + { .collapse } + ], + [ + "Task 2\nSort with all white space normalized to regular spaces.", + [ + "Normalized\tspaces: 4", "Normalized\xa0spaces: 1", + "Normalized\x20spaces: 2", "Normalized\nspaces: 3" + ], + { .normalize } + ], + [ + "Task 3\nSort case independently.", + [ + 'caSE INDEPENDENT: 3', 'casE INDEPENDENT: 2', + 'cASE INDEPENDENT: 4', 'case INDEPENDENT: 1' + ], + { .lc } # builtin method + ], + [ + "Task 4\nSort groups of digits in natural number order.", + %w(Foo100bar99baz0.txt foo100bar10baz0.txt foo1000bar99baz10.txt + foo1000bar99baz9.txt 201st 32nd 3rd 144th 17th 2 95), + { .naturally } + ], + [ + "Task 5 ( mixed with 1, 2, 3 & 4 )\n" + + "Sort titles, normalize white space, collapse multiple spaces to\n" + + "single, trim leading white space, ignore common leading articles\n" + + 'and sort digit groups in natural order.', + [ + 'The Wind in the Willows 8', ' The 39 Steps 3', + 'The 7th Seal 1', 'Wanda 6', + 'A Fish Called Wanda 5', ' The Wind and the Lion 7', + 'Any Which Way But Loose 4', '12 Monkeys 2' + ], + { .normalize.collapse.trim.title.naturally } + ], + [ + "Task 6, 7, 8\nMap letters in Latin1 that have accents or decompose to two\n" + + 'characters to their base characters for sorting.', + %w(apple Ball bald car Card above Æon æon aether + niño nina e-mail Évian evoke außen autumn), + { .latin1_decompose.naturally } + ] +]; + +tests.each { |case| + var code = case.pop; + var array = case.pop; + say case.pop+"\n"; + + say "Standard Sort:\n"; + array.sort.each { .say }; + + say "\nNatural Sort:\n"; + array.sort_by(code).each { .say }; + + say "\n#{'*' * 40}\n"; +} diff --git a/Task/Natural-sorting/jq/natural-sorting-1.jq b/Task/Natural-sorting/jq/natural-sorting-1.jq new file mode 100644 index 0000000000..122e8c0be8 --- /dev/null +++ b/Task/Natural-sorting/jq/natural-sorting-1.jq @@ -0,0 +1,58 @@ +def splitup: + def tidy: if .[0] == "" then .[1:] else . end | if .[length-1] == "" then .[0:length-1] else . end ; + + # a and b are assumed to be arrays: + def alternate(a;b): + reduce range(0; [a,b] | map(length) | max) as $i ([]; . + [a[$i], b[$i]]); + + ([splits("[0-9]+")] | tidy) as $a + | ([splits("[^0-9]+")] | tidy | map(tonumber)) as $n + | (test("^[0-9]")) as $nfirst + | if $nfirst then alternate($n; $a) else alternate($a; $n) end ; + +# The following implementation of tr is more general than needed here, but the generality +# makes for adaptability. +# x and y should both be strings defining a character-by-character translation, like Unix/Linux "tr". +# if y is shorter than x, then y will in effect be padded with y's last character. +# The input may be a string or an exploded string (i.e. an array); +# the output will have the same type as the input. +def tr(x;y): + type as $type + | (x | explode) as $xe + | (y | explode) as $ye + | $ye[-1] as $last + | if $type == "string" then explode else . end + | map( . as $n | ($xe|index($n)) as $i | if $i then $ye[$i]//$last else . end) + | if $type == "string" then implode else . end; + +# NOTE: the order in which the filters are applied is consequential! +def natural_sort: + def naturally: + gsub("\\p{M}"; "") # combining characters (accents, umlauts, enclosures, etc) + | tr("ÀÁÂÃÄÅàáâãäåÇçÈÉÊËèéêëÌÍÎÏìíîïÒÓÔÕÖØòóôõöøÑñÙÚÛÜùúûüÝÿý"; + "AAAAAAaaaaaaCcEEEEeeeeIIIIiiiiOOOOOOooooooNnUUUUuuuuYyy") + # Ligatures: + | gsub("Æ"; "AE") + | gsub("æ"; "ae") + | gsub("\u0132"; "IJ") # IJ + | gsub("\u0133"; "ij") # ij + | gsub("\u0152"; "Oe") # Œ + | gsub("\u0153"; "oe") # œ + | gsub("ffl"; "ffl") + | gsub("ffi"; "ffi") + | gsub("fi" ; "fi") + | gsub("ff" ; "ff") + | gsub("fl" ; "fl") + # Illustrative replacements: + | gsub("ß" ; "ss") # German scharfes S + | gsub("ſ|ʒ"; "s") # LATIN SMALL LETTER LONG S and LATIN SMALL LETTER EZH + + | ascii_downcase + | gsub("\\p{Cc}+";" ") # control characters + | gsub("^(the|a|an) "; "") # leading the/a/an (as words) + | gsub("\\s+"; " ") # whitespace + | sub("^ *";"") # leading whitespace + | sub(" *$";"") # trailing whitespace + | splitup # embedded integers + ; + sort_by(naturally); diff --git a/Task/Natural-sorting/jq/natural-sorting-2.jq b/Task/Natural-sorting/jq/natural-sorting-2.jq new file mode 100644 index 0000000000..65b0209ba4 --- /dev/null +++ b/Task/Natural-sorting/jq/natural-sorting-2.jq @@ -0,0 +1 @@ +if type == "string" then "", . else natural_sort end diff --git a/Task/Natural-sorting/jq/natural-sorting-3.jq b/Task/Natural-sorting/jq/natural-sorting-3.jq new file mode 100644 index 0000000000..b52d680b81 --- /dev/null +++ b/Task/Natural-sorting/jq/natural-sorting-3.jq @@ -0,0 +1,51 @@ +jq -r -f Natural_sorting.jq Natural_sorting.json + +# Ignoring leading spaces +[ + " ignore leading spaces: 2+0", + " ignore leading spaces: 2+1", + " ignore leading spaces: 2-1", + "ignore leading spaces: 2-2" +] + +# Ignoring multiple adjacent spaces (m.a.s) +[ + "ignore m.a.s spaces: 2+0", + "ignore m.a.s spaces: 2+1", + "ignore m.a.s spaces: 2-1", + "ignore m.a.s spaces: 2-2" +] + +# Equivalent whitespace characters +[ + "Equiv.\u000bspaces: 3+0", + "Equiv.\nspaces: 3+1", + "Equiv.\tspaces: 3+2", + "Equiv.\fspaces: 3-1", + "Equiv.\rspaces: 3-2", + "Equiv. spaces: 3-3" +] + +# Case Indepenent sort +[ + "casE INDEPENENT: 3+0", + "case INDEPENENT: 3+1", + "caSE INDEPENENT: 3-1", + "cASE INDEPENENT: 3-2" +] + +# Numeric fields as numerics +[ + "foo100bar10baz0.txt", + "foo100bar99baz0.txt", + "foo1000bar99baz9.txt", + "foo1000bar99baz10.txt" +] + +# Title sorts +[ + "The 39 steps", + "The 40th step more", + "Wanda", + "The Wind in the Willows" +] diff --git a/Task/Non-continuous-subsequences/Nim/non-continuous-subsequences.nim b/Task/Non-continuous-subsequences/Nim/non-continuous-subsequences.nim new file mode 100644 index 0000000000..6354b5515d --- /dev/null +++ b/Task/Non-continuous-subsequences/Nim/non-continuous-subsequences.nim @@ -0,0 +1,19 @@ +import sequtils + +proc ncsub[T](se: seq[T], s = 0): seq[seq[T]] = + result = @[] + if se.len > 0: + let + x = se[0..0] + xs = se[1 .. -1] + p2 = s mod 2 + p1 = (s + 1) mod 2 + for ys in ncsub(xs, s + p1): + result.add(x & ys) + result.add(ncsub(xs, s + p2)) + elif s >= 3: + result.add(@[]) + +echo "ncsub(", toSeq 1.. 3, ") = ", ncsub(toSeq 1..3) +echo "ncsub(", toSeq 1.. 4, ") = ", ncsub(toSeq 1..4) +echo "ncsub(", toSeq 1.. 5, ") = ", ncsub(toSeq 1..5) diff --git a/Task/Non-continuous-subsequences/Sidef/non-continuous-subsequences.sidef b/Task/Non-continuous-subsequences/Sidef/non-continuous-subsequences.sidef new file mode 100644 index 0000000000..ed3146de34 --- /dev/null +++ b/Task/Non-continuous-subsequences/Sidef/non-continuous-subsequences.sidef @@ -0,0 +1,18 @@ +func non_continuous(min, max, subseq=[], has_gap=false) { + + static current = []; + + range(min, max).each { |i| + current.push(i); + has_gap && subseq.append([current...]); + i < max && non_continuous(i.inc, max, subseq, has_gap); + current.pop; + has_gap = current.len; + } + + subseq; +} + +say non_continuous(1, 3); +say non_continuous(1, 4); +say non_continuous("a", "d"); diff --git a/Task/Non-continuous-subsequences/jq/non-continuous-subsequences-1.jq b/Task/Non-continuous-subsequences/jq/non-continuous-subsequences-1.jq new file mode 100644 index 0000000000..55be58936e --- /dev/null +++ b/Task/Non-continuous-subsequences/jq/non-continuous-subsequences-1.jq @@ -0,0 +1,16 @@ +# Generate a stream of subsets of the input array +def subsets: + if length == 0 then [] + else .[0] as $first + | (.[1:] | subsets) + | ., ([$first] + .) + end ; + +# Generate a stream of non-continuous indices in the range 0 <= i < . +def non_continuous_indices: + [range(0;.)] | subsets + | select(length > 1 and length != 1 + .[length-1] - .[0]) ; + +def non_continuous_subsequences: + (length | non_continuous_indices) as $ix + | [.[ $ix[] ]] ; diff --git a/Task/Non-continuous-subsequences/jq/non-continuous-subsequences-2.jq b/Task/Non-continuous-subsequences/jq/non-continuous-subsequences-2.jq new file mode 100644 index 0000000000..3ffb6fa77a --- /dev/null +++ b/Task/Non-continuous-subsequences/jq/non-continuous-subsequences-2.jq @@ -0,0 +1,3 @@ +def count(f): reduce f as $i (0; . + 1); + +count( [range(0;20)] | non_continuous_subsequences) diff --git a/Task/Non-decimal-radices-Convert/FreeBASIC/non-decimal-radices-convert.freebasic b/Task/Non-decimal-radices-Convert/FreeBASIC/non-decimal-radices-convert.freebasic new file mode 100644 index 0000000000..7fdc05a3a1 --- /dev/null +++ b/Task/Non-decimal-radices-Convert/FreeBASIC/non-decimal-radices-convert.freebasic @@ -0,0 +1,56 @@ +' FB 1.05.0 Win64 + +Function min(x As Integer, y As Integer) As Integer + Return IIf(x < y, x, y) +End Function + +Function convertToBase (n As UInteger, b As UInteger) As String + If n < 2 OrElse b < 2 OrElse b = 10 OrElse b > 36 Then Return Str(n) + Dim result As String = "" + Dim digit As Integer + While n > 0 + digit = n Mod b + If digit < 10 Then + result = digit & result + Else + result = Chr(digit + 87) + result + End If + n \= b + Wend + Return result +End Function + +Function convertToDecimal (s As Const String, b As UInteger) As UInteger + If b < 2 OrElse b > 36 Then Return 0 + Dim t As String = LCase(s) + Dim result As UInteger = 0 + Dim digit As Integer + Dim multiplier As Integer = 1 + For i As Integer = Len(t) - 1 To 0 Step - 1 + digit = -1 + If t[i] >= 48 AndAlso t[i] <= min(57, 47 + b) Then + digit = t[i] - 48 + ElseIf b > 10 AndAlso t[i] >= 97 AndAlso t[i] <= min(122, 87 + b) Then + digit = t[i] - 87 + End If + If digit = -1 Then Return 0 '' invalid digit present + If digit > 0 Then result += multiplier * digit + multiplier *= b + Next + Return result +End Function + +Dim s As String + +For b As UInteger = 2 To 36 + Print "36 base "; + Print Using "##"; b; + s = ConvertToBase(36, b) + Print " = "; s; Tab(21); " -> base "; + Print Using "##"; b; + Print " = "; convertToDecimal(s, b) +Next + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Non-decimal-radices-Convert/FunL/non-decimal-radices-convert-1.funl b/Task/Non-decimal-radices-Convert/FunL/non-decimal-radices-convert-1.funl new file mode 100644 index 0000000000..7831aeb4e9 --- /dev/null +++ b/Task/Non-decimal-radices-Convert/FunL/non-decimal-radices-convert-1.funl @@ -0,0 +1 @@ +$stdout = int( '1a', 16 ) diff --git a/Task/Non-decimal-radices-Convert/FunL/non-decimal-radices-convert-2.funl b/Task/Non-decimal-radices-Convert/FunL/non-decimal-radices-convert-2.funl new file mode 100644 index 0000000000..0da0d26e20 --- /dev/null +++ b/Task/Non-decimal-radices-Convert/FunL/non-decimal-radices-convert-2.funl @@ -0,0 +1 @@ +$stdout = str( 26, 16 ) diff --git a/Task/Non-decimal-radices-Convert/LFE/non-decimal-radices-convert.lfe b/Task/Non-decimal-radices-Convert/LFE/non-decimal-radices-convert.lfe new file mode 100644 index 0000000000..9f7c53d622 --- /dev/null +++ b/Task/Non-decimal-radices-Convert/LFE/non-decimal-radices-convert.lfe @@ -0,0 +1,12 @@ +> (: erlang list_to_integer '"1a" 16) +26 +> #x1a +26 +> (: erlang integer_to_list 26 16) +"1A" +> (: erlang list_to_integer '"101110111000" 2) +3000 +> #b101110111000 +3000 +> (: erlang integer_to_list 3000 2) +"101110111000" diff --git a/Task/Non-decimal-radices-Convert/Nim/non-decimal-radices-convert.nim b/Task/Non-decimal-radices-Convert/Nim/non-decimal-radices-convert.nim new file mode 100644 index 0000000000..f364399ed3 --- /dev/null +++ b/Task/Non-decimal-radices-Convert/Nim/non-decimal-radices-convert.nim @@ -0,0 +1,33 @@ +import strutils + +proc reverse(a: string): string = + result = newString(a.len) + for i, c in a: + result[a.high - i] = c + +const digits = "0123456789abcdefghijklmnopqrstuvwxyz" + +proc toBase[T](num: T, base: range[2..36]): string = + if num == 0: return "0" + result = "" + if num < 0: result.add '-' + var tmp = abs(num) + var s = "" + while tmp > 0: + s.add digits[int(tmp mod base)] + tmp = tmp div base + result.add s.reverse + +proc fromBase(str: string, base: range[2..36]): BiggestInt = + var str = str + let first = if str[0] == '-': 1 else: 0 + + for i in first .. str.high: + let c = str[i].toLower + assert c in digits[0 .. 0 do + c = remainder(i,base) + if c<10 then + c += '0' + else + c += 'a'-10 + end if + s = prepend(s,c) + i = floor(i/base) + end while + + if length(s) = 0 then + s = "0" + end if + + return s +end function + +function from_base(string s, integer base) +integer res = 0, c + for i=1 to length(s) do + c = s[i] + if c>='0' and c<='9' then + c -= '0' + else + c -= 'a'-10 + end if + res = res*base+c + end for + return res +end function + +?to_base(256,16) +?from_base("100",16) diff --git a/Task/Non-decimal-radices-Convert/Sidef/non-decimal-radices-convert-1.sidef b/Task/Non-decimal-radices-Convert/Sidef/non-decimal-radices-convert-1.sidef new file mode 100644 index 0000000000..678dbd9b42 --- /dev/null +++ b/Task/Non-decimal-radices-Convert/Sidef/non-decimal-radices-convert-1.sidef @@ -0,0 +1,2 @@ +say 60272032366.base(36) # convert number to string +say Number("rosetta", 36) # convert string to number diff --git a/Task/Non-decimal-radices-Convert/Sidef/non-decimal-radices-convert-2.sidef b/Task/Non-decimal-radices-Convert/Sidef/non-decimal-radices-convert-2.sidef new file mode 100644 index 0000000000..fdf8e2be8f --- /dev/null +++ b/Task/Non-decimal-radices-Convert/Sidef/non-decimal-radices-convert-2.sidef @@ -0,0 +1,20 @@ +static to = [@|'0'..'9', @|'a'..'z'] +static from = Hash(to.pairs.map{@|_}.flip...) + +func base_to(n, b) { + var s = "" + while (n) { + s += to[n % b] + n //= b + } + s.reverse +} + +func base_from(n, b) { + var t = 0 + n.each { |c| t = (b*t + from{c}) } + t +} + +say base_from("rosetta", 36) # string to number +say base_to(60272032366, 36) # number to string diff --git a/Task/Non-decimal-radices-Convert/Swift/non-decimal-radices-convert-1.swift b/Task/Non-decimal-radices-Convert/Swift/non-decimal-radices-convert-1.swift new file mode 100644 index 0000000000..60a9d09fbc --- /dev/null +++ b/Task/Non-decimal-radices-Convert/Swift/non-decimal-radices-convert-1.swift @@ -0,0 +1 @@ +println(String(26, radix: 16)) // prints "1a" diff --git a/Task/Non-decimal-radices-Convert/Swift/non-decimal-radices-convert-2.swift b/Task/Non-decimal-radices-Convert/Swift/non-decimal-radices-convert-2.swift new file mode 100644 index 0000000000..c1726014e0 --- /dev/null +++ b/Task/Non-decimal-radices-Convert/Swift/non-decimal-radices-convert-2.swift @@ -0,0 +1,6 @@ +import Darwin +func string2int(s: String, radix: Int) -> Int { + return strtol(s, nil, Int32(radix)) + // there is also strtoul() for UInt, and strtoll() and strtoull() for Int64 and UInt64, respectively +} +println(string2int("1a", 16)) // prints "26" diff --git a/Task/Non-decimal-radices-Convert/jq/non-decimal-radices-convert-1.jq b/Task/Non-decimal-radices-Convert/jq/non-decimal-radices-convert-1.jq new file mode 100644 index 0000000000..38708e77c1 --- /dev/null +++ b/Task/Non-decimal-radices-Convert/jq/non-decimal-radices-convert-1.jq @@ -0,0 +1,22 @@ +# Convert the input integer to a string in the specified base (2 to 36 inclusive) +def convert(base): + def stream: + recurse(if . > 0 then ./base|floor else empty end) | . % base ; + if . == 0 then "0" + else [stream] | reverse | .[1:] + | if base < 10 then map(tostring) | join("") + elif base <= 36 then map(if . < 10 then 48 + . else . + 87 end) | implode + else error("base too large") + end + end; + +# input string is converted from "base" to an integer, wihtin limits +# of the underlying arithmetic operations, and without error-checking: +def to_i(base): + explode + | reverse + | map(if . > 96 then . - 87 else . - 48 end) # "a" ~ 97 => 10 ~ 87 + | reduce .[] as $c + # state: [power, ans] + ([1,0]; (.[0] * base) as $b | [$b, .[1] + (.[0] * $c)]) + | .[1]; diff --git a/Task/Non-decimal-radices-Convert/jq/non-decimal-radices-convert-2.jq b/Task/Non-decimal-radices-Convert/jq/non-decimal-radices-convert-2.jq new file mode 100644 index 0000000000..cc174d6a38 --- /dev/null +++ b/Task/Non-decimal-radices-Convert/jq/non-decimal-radices-convert-2.jq @@ -0,0 +1,3 @@ +(255 | convert(16)), + ("ff" | to_i(16)), + ("10" | to_i(10)) diff --git a/Task/Non-decimal-radices-Input/FreeBASIC/non-decimal-radices-input.freebasic b/Task/Non-decimal-radices-Input/FreeBASIC/non-decimal-radices-input.freebasic new file mode 100644 index 0000000000..8fcd2924e9 --- /dev/null +++ b/Task/Non-decimal-radices-Input/FreeBASIC/non-decimal-radices-input.freebasic @@ -0,0 +1,8 @@ +' FB 1.05.0 Win64 + +Dim s(1 To 4) As String = {"&H1a", "26", "&O32", "&B11010"} '' 26 in various bases +For i As Integer = 1 To 4 + Print s(i); Tab(9); "="; CInt(s(i)) +Next + +Sleep diff --git a/Task/Non-decimal-radices-Input/Nim/non-decimal-radices-input.nim b/Task/Non-decimal-radices-Input/Nim/non-decimal-radices-input.nim new file mode 100644 index 0000000000..bd4fc02f62 --- /dev/null +++ b/Task/Non-decimal-radices-Input/Nim/non-decimal-radices-input.nim @@ -0,0 +1,9 @@ +import strutils + +echo parseInt "10" # 10 + +echo parseHexInt "0x10" # 16 +echo parseHexInt "10" # 16 + +echo parseOctInt "0o120" # 80 +echo parseOctInt "120" # 80 diff --git a/Task/Non-decimal-radices-Input/Phix/non-decimal-radices-input.phix b/Task/Non-decimal-radices-Input/Phix/non-decimal-radices-input.phix new file mode 100644 index 0000000000..e49a8ec195 --- /dev/null +++ b/Task/Non-decimal-radices-Input/Phix/non-decimal-radices-input.phix @@ -0,0 +1,6 @@ +?scanf("1234","%d") +?scanf("0b10101010","%d") +?scanf("#ABCD","%d") +?scanf("#FFFFFFFF","%f") +?scanf("0xFFFFFFFF","%f") +?scanf("0o377","%o") diff --git a/Task/Non-decimal-radices-Input/Ring/non-decimal-radices-input.ring b/Task/Non-decimal-radices-Input/Ring/non-decimal-radices-input.ring new file mode 100644 index 0000000000..ec27f33ba7 --- /dev/null +++ b/Task/Non-decimal-radices-Input/Ring/non-decimal-radices-input.ring @@ -0,0 +1,3 @@ +see number("0") + nl +see number("123456789") + nl +see number("-987654321") + nl diff --git a/Task/Non-decimal-radices-Input/Sidef/non-decimal-radices-input.sidef b/Task/Non-decimal-radices-Input/Sidef/non-decimal-radices-input.sidef new file mode 100644 index 0000000000..c709e09de5 --- /dev/null +++ b/Task/Non-decimal-radices-Input/Sidef/non-decimal-radices-input.sidef @@ -0,0 +1,15 @@ +var dec = '0123459'; +var hex_noprefix = 'abcf123'; +var hex_withprefix = '0xabcf123'; +var oct_noprefix = '7651'; +var oct_withprefix = '07651'; +var bin_noprefix = '101011001'; +var bin_withprefix = '0b101011001'; + +say dec.num; # => 123459 +say hex_noprefix.hex; # => 180154659 +say hex_withprefix.hex; # => 180154659 +say oct_noprefix.oct; # => 4009 +say oct_withprefix.oct; # => 4009 +say bin_noprefix.bin; # => 345 +say bin_withprefix.bin; # => 345 diff --git a/Task/Non-decimal-radices-Output/FreeBASIC/non-decimal-radices-output.freebasic b/Task/Non-decimal-radices-Output/FreeBASIC/non-decimal-radices-output.freebasic new file mode 100644 index 0000000000..7b3a3e043f --- /dev/null +++ b/Task/Non-decimal-radices-Output/FreeBASIC/non-decimal-radices-output.freebasic @@ -0,0 +1,10 @@ +' FB 1.05.0 Win64 + +Dim ui(1 To 4) As UInteger = {10, 26, 52, 100} +Print "Decimal Hex Octal Binary" +Print "======= ======== ======= ======" +For i As Integer = 1 To 4 + Print Str(ui(i)); Tab(12); Hex(ui(i)); Tab(23); Oct(ui(i)); Tab(31); Bin(ui(i)) +Next + +Sleep diff --git a/Task/Non-decimal-radices-Output/Nim/non-decimal-radices-output.nim b/Task/Non-decimal-radices-Output/Nim/non-decimal-radices-output.nim new file mode 100644 index 0000000000..fc325c7cd7 --- /dev/null +++ b/Task/Non-decimal-radices-Output/Nim/non-decimal-radices-output.nim @@ -0,0 +1,4 @@ +import strutils + +for i in 0..33: + echo toBin(i, 6)," ",toOct(i, 3)," ",align($i,2)," ",toHex(i,2) diff --git a/Task/Non-decimal-radices-Output/Phix/non-decimal-radices-output.phix b/Task/Non-decimal-radices-Output/Phix/non-decimal-radices-output.phix new file mode 100644 index 0000000000..a00f209127 --- /dev/null +++ b/Task/Non-decimal-radices-Output/Phix/non-decimal-radices-output.phix @@ -0,0 +1,3 @@ +for i=1 to 33 do + printf(1,"decimal:%6d hex:%6x HEX:%6X octal:%6o binary:%6b\n",{i,i,i}) +end for diff --git a/Task/Non-decimal-radices-Output/Sidef/non-decimal-radices-output.sidef b/Task/Non-decimal-radices-Output/Sidef/non-decimal-radices-output.sidef new file mode 100644 index 0000000000..6b6a4ae611 --- /dev/null +++ b/Task/Non-decimal-radices-Output/Sidef/non-decimal-radices-output.sidef @@ -0,0 +1,3 @@ +range(0, 33).each { |n| + printf(" %6b %3o %2d %2X\n", ([n]*4)...); +} diff --git a/Task/Nth-root/FutureBasic/nth-root.futurebasic b/Task/Nth-root/FutureBasic/nth-root.futurebasic new file mode 100644 index 0000000000..fa3824470c --- /dev/null +++ b/Task/Nth-root/FutureBasic/nth-root.futurebasic @@ -0,0 +1,22 @@ +include "ConsoleWindow" + +def tab 8 + +local fn NthRoot( root as long, a as long, precision as double ) as double +dim as double x0, x1 + +x0 = a : x1 = a /root +while ( abs( x1 - x0 ) > precision ) +x0 = x1 +x1 = ( ( root -1.0 ) * x1 + a / x1 ^ ( root -1.0 ) ) /root +wend +end fn = x1 + +print " 125th Root of 5643 Precision .001", using "#.###############"; fn NthRoot( 125, 5642, 0.001 ) +print " 125th Root of 5643 Precision .001", using "#.###############"; fn NthRoot( 125, 5642, 0.001 ) +print " 125th Root of 5643 Precision .00001", using "#.###############"; fn NthRoot( 125, 5642, 0.00001 ) +print " Cube Root of 27 Precision .00001", using "#.###############"; fn NthRoot( 3, 27, 0.00001 ) +print "Square Root of 2 Precision .00001", using "#.###############"; fn NthRoot( 2, 2, 0.00001 ) +print "Square Root of 2 Precision .00001", using "#.###############"; sqr(2) // Processor floating point calc deviation +print " 10th Root of 1024 Precision .00001", using "#.###############"; fn NthRoot( 10, 1024, 0.00001 ) +print " 5th Root of 34 Precision .00001", using "#.###############"; fn NthRoot( 5, 34, 0.00001 ) diff --git a/Task/Nth-root/Lingo/nth-root-1.lingo b/Task/Nth-root/Lingo/nth-root-1.lingo new file mode 100644 index 0000000000..71c1f6e4d5 --- /dev/null +++ b/Task/Nth-root/Lingo/nth-root-1.lingo @@ -0,0 +1,3 @@ +on nthRoot (x, root) + return power(x, 1.0/root) +end diff --git a/Task/Nth-root/Lingo/nth-root-2.lingo b/Task/Nth-root/Lingo/nth-root-2.lingo new file mode 100644 index 0000000000..77f5e5b27c --- /dev/null +++ b/Task/Nth-root/Lingo/nth-root-2.lingo @@ -0,0 +1,3 @@ +the floatPrecision = 8 -- only about display/string cast of floats +put nthRoot(4, 4) +-- 1.41421356 diff --git a/Task/Nth-root/Nim/nth-root.nim b/Task/Nth-root/Nim/nth-root.nim new file mode 100644 index 0000000000..4d23b0509a --- /dev/null +++ b/Task/Nth-root/Nim/nth-root.nim @@ -0,0 +1,13 @@ +import math + +proc nthroot(a, n): float = + var n = float(n) + result = a + var x = a / n + while abs(result-x) > 10e-15: + x = result + result = (1.0/n) * (((n-1)*x) + (a / pow(x, n-1))) + +echo nthroot(34.0, 5) +echo nthroot(42.0, 10) +echo nthroot(5.0, 2) diff --git a/Task/Nth-root/Oforth/nth-root.oforth b/Task/Nth-root/Oforth/nth-root.oforth new file mode 100644 index 0000000000..84d1f6174f --- /dev/null +++ b/Task/Nth-root/Oforth/nth-root.oforth @@ -0,0 +1,2 @@ +Float method: nthroot(n) + 1.0 doWhile: [ self over n 1 - pow / over - n / tuck + swap 0.0 <> ] ; diff --git a/Task/Nth-root/Ring/nth-root.ring b/Task/Nth-root/Ring/nth-root.ring new file mode 100644 index 0000000000..685cbad0ac --- /dev/null +++ b/Task/Nth-root/Ring/nth-root.ring @@ -0,0 +1,12 @@ +decimals(12) +see "cube root of 5 is : " + root(3, 5, 0) + nl + +func root n, a, d +y = 0 x = a / n +while fabs (x - y) > d + y = ((n - 1)*x + a/pow(x,(n-1))) / n + temp = x + x = y + y = temp +end +return x diff --git a/Task/Nth-root/Sidef/nth-root-1.sidef b/Task/Nth-root/Sidef/nth-root-1.sidef new file mode 100644 index 0000000000..4450d9ba21 --- /dev/null +++ b/Task/Nth-root/Sidef/nth-root-1.sidef @@ -0,0 +1,11 @@ +func nthroot(n, a, precision=1e-5) { + var x = 1; + var prev = 0; + while ((prev-x).abs > precision) { + prev = x; + x = (((n-1)*prev + a/(prev**(n-1))) / n); + }; + return x; +} + +say nthroot(5, 34); # => 2.024397458501034082599817835297912829678 diff --git a/Task/Nth-root/Sidef/nth-root-2.sidef b/Task/Nth-root/Sidef/nth-root-2.sidef new file mode 100644 index 0000000000..38b6df9118 --- /dev/null +++ b/Task/Nth-root/Sidef/nth-root-2.sidef @@ -0,0 +1,6 @@ +func nthroot_fast(n, a, precision=1e-5) { + { a = nthroot(2, a, precision) } * int(n-1); + a ** (2**int(n-1) / n); +} + +say nthroot_fast(5, 34, 1e-64); # => 2.024397458499885042510817245541937419115 diff --git a/Task/Nth-root/jq/nth-root-1.jq b/Task/Nth-root/jq/nth-root-1.jq new file mode 100644 index 0000000000..fa1c82841b --- /dev/null +++ b/Task/Nth-root/jq/nth-root-1.jq @@ -0,0 +1,31 @@ +# An iterative algorithm for finding: self ^ (1/n) to the given +# absolute precision if "precision" > 0, or to within the precision +# allowed by IEEE 754 64-bit numbers. + +# The following implementation handles underflow caused by poor estimates. +def iterative_nth_root(n; precision): + def abs: if . < 0 then -. else . end; + def sq: .*.; + def pow(p): . as $in | reduce range(0;p) as $i (1; . * $in); + def _iterate: # state: [A, x1, x2, prevdelta] + .[0] as $A | .[1] as $x1 | .[2] as $x2 | .[3] as $prevdelta + | ( $x2 | pow(n-1)) as $power + | if $power <= 2.155094094640383e-309 + then [$A, $x1, ($x1 + $x2)/2, n] | _iterate + else (((n-1)*$x2 + ($A/$power))/n) as $x1 + | (($x1 - $x2)|abs) as $delta + | if (precision == 0 and $delta == $prevdelta and $delta < 1e-15) + or (precision > 0 and $delta <= precision) or $delta == 0 then $x1 + else [$A, $x2, $x1, $delta] | _iterate + end + end + ; + if n == 1 then . + elif . == 0 then 0 + elif . < 0 then error("iterative_nth_root: input \(.) < 0") + elif n != (n|floor) then error("iterative_nth_root: argument \(n) is not an integer") + elif n == 0 then error("iterative_nth_root(0): domain error") + elif n < 0 then 1/iterative_nth_root(-n; precision) + else [., ., (./n), n, 0] | _iterate + end +; diff --git a/Task/Nth-root/jq/nth-root-2.jq b/Task/Nth-root/jq/nth-root-2.jq new file mode 100644 index 0000000000..5ec17bafff --- /dev/null +++ b/Task/Nth-root/jq/nth-root-2.jq @@ -0,0 +1,10 @@ +def demo(x): + def nth_root(n): log / n | exp; + def lpad(n): tostring | (n - length) * " " + .; + . as $in + | "\(x)^(1/\(lpad(5))): \(x|nth_root($in)|lpad(18)) vs \(x|iterative_nth_root($in; 1e-10)|lpad(18)) vs \(x|iterative_nth_root($in; 0))" +; + +# 5^m for various values of n: +"5^(1/ n): builtin precision=1e-10 precision=0", +( (1,-5,-3,-1,1,3,5,1000,10000) | demo(5)) diff --git a/Task/Nth-root/jq/nth-root-3.jq b/Task/Nth-root/jq/nth-root-3.jq new file mode 100644 index 0000000000..a8b9a165ba --- /dev/null +++ b/Task/Nth-root/jq/nth-root-3.jq @@ -0,0 +1,11 @@ +$ jq -n -r -f nth_root_machine_precision.jq +5^(1/ n): builtin precision=1e-10 precision=0 +5^(1/ 1): 4.999999999999999 vs 5 vs 5 +5^(1/ -5): 0.7247796636776955 vs 0.7247796636776956 vs 0.7247796636776955 +5^(1/ -3): 0.5848035476425733 vs 0.5848035476425731 vs 0.5848035476425731 +5^(1/ -1): 0.2 vs 0.2 vs 0.2 +5^(1/ 1): 4.999999999999999 vs 5 vs 5 +5^(1/ 3): 1.709975946676697 vs 1.709975946676697 vs 1.709975946676697 +5^(1/ 5): 1.3797296614612147 vs 1.3797296614612147 vs 1.379729661461215 +5^(1/ 1000): 1.0016107337527294 vs 1.0016107337527294 vs 1.0016107337527294 +5^(1/10000): 1.0001609567433902 vs 1.0001609567433902 vs 1.0001609567433902 diff --git a/Task/Nth/ERRE/nth.erre b/Task/Nth/ERRE/nth.erre new file mode 100644 index 0000000000..ad02bba6b1 --- /dev/null +++ b/Task/Nth/ERRE/nth.erre @@ -0,0 +1,23 @@ +PROGRAM NTH_SOLVE + +! +! for rosettacode.org +! + +PROCEDURE NTH(S%,E%) + LOCAL I%,SUFF$ + FOR I%=S% TO E% DO + SUFF$="th" + IF I% MOD 10=1 AND I% MOD 100<>11 THEN SUFF$="st" END IF + IF I% MOD 10=2 AND I% MOD 100<>12 THEN SUFF$="nd" END IF + IF I% MOD 10=3 AND I% MOD 100<>13 THEN SUFF$="rd" END IF + PRINT(STR$(I%)+SUFF$+" ";) + END FOR + PRINT +END PROCEDURE + +BEGIN + NTH(0,25) + NTH(250,265) + NTH(1000,1025) +END PROGRAM diff --git a/Task/Nth/FreeBASIC/nth.freebasic b/Task/Nth/FreeBASIC/nth.freebasic new file mode 100644 index 0000000000..23f4f56d9c --- /dev/null +++ b/Task/Nth/FreeBASIC/nth.freebasic @@ -0,0 +1,39 @@ +' FB 1.05.0 Win64 + +' Apostrophes NOT used as incorrect English + +Function ordinal(n As UInteger) As String + Dim ns As String = Str(n) + Select Case Right(ns, 1) + Case "0", "4" To "9" + Return ns + "th" + Case "1" + If Right(ns, 2) = "11" Then Return ns + "th" + Return ns + "st" + Case "2" + If Right(ns, 2) = "12" Then Return ns + "th" + Return ns + "nd" + Case "3" + If Right(ns, 2) = "13" Then Return ns + "th" + Return ns + "rd" + End Select +End Function + +Dim i As Integer +For i = 0 To 25 + Print ordinal(i); " "; +Next +Print : Print + +For i = 250 To 265 + Print ordinal(i); " "; +Next +Print : Print + +For i = 1000 To 1025 + Print ordinal(i); " "; +Next +Print : Print + +Print "Press any key to quit" +Sleep diff --git a/Task/Nth/Nim/nth.nim b/Task/Nth/Nim/nth.nim new file mode 100644 index 0000000000..047f489c30 --- /dev/null +++ b/Task/Nth/Nim/nth.nim @@ -0,0 +1,9 @@ +const suffix = ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"] + +proc nth(n): string = + $n & "'" & (if n mod 100 <= 10 or n mod 100 > 20: suffix[n mod 10] else: "th") + +for j in countup(0, 1000, 250): + for i in j..j+24: + stdout.write nth(i), " " + echo "" diff --git a/Task/Nth/Oforth/nth.oforth b/Task/Nth/Oforth/nth.oforth new file mode 100644 index 0000000000..6df1bc0310 --- /dev/null +++ b/Task/Nth/Oforth/nth.oforth @@ -0,0 +1,7 @@ +: nth(n) +| r | + n "th" over 10 mod ->r + r 1 == ifTrue: [ n 100 mod 11 == ifFalse: [ drop "st" ] ] + r 2 == ifTrue: [ n 100 mod 12 == ifFalse: [ drop "nd" ] ] + r 3 == ifTrue: [ n 100 mod 13 == ifFalse: [ drop "rd" ] ] + + ; diff --git a/Task/Nth/Ring/nth.ring b/Task/Nth/Ring/nth.ring new file mode 100644 index 0000000000..894f363b51 --- /dev/null +++ b/Task/Nth/Ring/nth.ring @@ -0,0 +1,15 @@ +for nr = 0 to 25 + see Nth(nr) + Nth(nr + 250) + Nth(nr + 1000) + nl +next + +func getSuffix n + lastTwo = n % 100 + lastOne = n % 10 + if lastTwo > 3 and lastTwo < 21 "th" ok + if lastOne = 1 return "st" ok + if lastOne = 2 return "nd" ok + if lastOne = 3 return "rd" ok + return "th" + +func Nth n + return "" + n + "'" + getSuffix(n) + " " diff --git a/Task/Nth/Set-lang/nth.set b/Task/Nth/Set-lang/nth.set new file mode 100644 index 0000000000..0ee88d480c --- /dev/null +++ b/Task/Nth/Set-lang/nth.set @@ -0,0 +1,21 @@ +set o 49 +set t 50 +set h 51 +set n ! +set ! n +set ! 39 +[n=o] set ? 13 +[n=t] set ? 16 +[n=h] set ? 19 +set ! T +set ! H +set ? 21 +set ! S +set ! T +set ? 21 +set ! N +set ! D +set ? 12 +set ! R +set ! D +> EOF diff --git a/Task/Nth/Sidef/nth.sidef b/Task/Nth/Sidef/nth.sidef new file mode 100644 index 0000000000..11259976b2 --- /dev/null +++ b/Task/Nth/Sidef/nth.sidef @@ -0,0 +1,8 @@ +func nth(n) { + static irregulars = Hash.new(<1 ˢᵗ 2 ⁿᵈ 3 ʳᵈ 11 ᵗʰ 12 ᵗʰ 13 ᵗʰ>...); + n.to_s + (irregulars{n % 100} \\ irregulars{n % 10} \\ 'ᵗʰ'); +} + +[range(0, 25), range(250, 265), range(1000, 1025)].each { |r| + say r.map {|n| nth(n) }.join(" "); +} diff --git a/Task/Nth/Swift/nth.swift b/Task/Nth/Swift/nth.swift new file mode 100644 index 0000000000..b6e30d9a75 --- /dev/null +++ b/Task/Nth/Swift/nth.swift @@ -0,0 +1,29 @@ +func addSuffix(n:Int) -> String { + if n % 100 / 10 == 1 { + return "th" + } + + switch n % 10 { + case 1: + return "st" + case 2: + return "nd" + case 3: + return "rd" + default: + return "th" + } +} + +for i in 0...25 { + print("\(i)\(addSuffix(i)) ") +} +println() +for i in 250...265 { + print("\(i)\(addSuffix(i)) ") +} +println() +for i in 1000...1025 { + print("\(i)\(addSuffix(i)) ") +} +println() diff --git a/Task/Nth/XLISP/nth.xlisp b/Task/Nth/XLISP/nth.xlisp new file mode 100644 index 0000000000..6b2c1189c2 --- /dev/null +++ b/Task/Nth/XLISP/nth.xlisp @@ -0,0 +1,20 @@ +(DEFUN NTH (N) + (COND + ((AND (> (MOD N 100) 3) (< (MOD N 100) 21)) `(,N TH)) + ((= (MOD N 10) 1) `(,N ST)) + ((= (MOD N 10) 2) `(,N ND)) + ((= (MOD N 10) 3) `(,N RD)) + (T `(,N TH)))) + +(DEFUN RANGE (X Y) + (IF (<= X Y) + (CONS X (RANGE (+ X 1) Y)))) + +(DEFUN TEST-NTH () + (DISPLAY (MAPCAR NTH (RANGE 1 25))) + (NEWLINE) + (DISPLAY (MAPCAR NTH (RANGE 250 265))) + (NEWLINE) + (DISPLAY (MAPCAR NTH (RANGE 1000 1025)))) + +(TEST-NTH) diff --git a/Task/Nth/jq/nth.jq b/Task/Nth/jq/nth.jq new file mode 100644 index 0000000000..db6f99010b --- /dev/null +++ b/Task/Nth/jq/nth.jq @@ -0,0 +1,17 @@ +# ordinalize an integer input, positive or negative +def ordinalize: + (if . < 0 then -(.) else . end) as $num + | ($num % 100) as $small + | (if 11 <= $small and $small <= 13 then "th" + else + ( $num % 10) + | (if . == 1 then "st" + elif . == 2 then "nd" + elif . == 3 then "rd" + else "th" + end) + end) as $ordinal + | "\(.)\($ordinal)" ; + +([range(-5; -1)], [range(0;26)], [range(250;266)], [range(1000;1026)]) + | map(ordinalize) diff --git a/Task/Null-object/8th/null-object.8th b/Task/Null-object/8th/null-object.8th new file mode 100644 index 0000000000..7821c61fbb --- /dev/null +++ b/Task/Null-object/8th/null-object.8th @@ -0,0 +1 @@ +null? if "item was null" . then diff --git a/Task/Null-object/Axe/null-object.axe b/Task/Null-object/Axe/null-object.axe new file mode 100644 index 0000000000..f34b8c5ce4 --- /dev/null +++ b/Task/Null-object/Axe/null-object.axe @@ -0,0 +1,3 @@ +If P=0 + Disp "NULL PTR",i +End diff --git a/Task/Null-object/EchoLisp/null-object.echolisp b/Task/Null-object/EchoLisp/null-object.echolisp new file mode 100644 index 0000000000..242306a08b --- /dev/null +++ b/Task/Null-object/EchoLisp/null-object.echolisp @@ -0,0 +1,15 @@ +null → null +() → null +(null? 3) → #f +(!null? 4) → #t +(null? null) → #t + +;; careful - null is not false : +(if null 'OUI 'NON) → OUI + +;; usual usage : recursion on lists until (null? list) +(define (f list) + (when (!null? list) + (write (first list)) (f (rest list)))) + +(f '( a b c)) → a b c diff --git a/Task/Null-object/FreeBASIC/null-object.freebasic b/Task/Null-object/FreeBASIC/null-object.freebasic new file mode 100644 index 0000000000..1945a91ec6 --- /dev/null +++ b/Task/Null-object/FreeBASIC/null-object.freebasic @@ -0,0 +1,20 @@ +'FB 1.05.0 Win64 + +' FreeBASIC does not have a NULL keyword but it's possible to create one using a macro + +#Define NULL CPtr(Any Ptr, 0) '' Any Ptr is implicitly convertible to pointers of other types + +Type Dog + name As String + age As Integer +End Type + +Dim d As Dog Ptr = New Dog +d->Name = "Rover" +d->Age = 5 +Print d->Name, d->Age +Delete d +d = NULL '' guard against 'd' being used accidentally in future + +' in practice many FB developers would simply have written: d = 0 above +Sleep diff --git a/Task/Null-object/Lasso/null-object.lasso b/Task/Null-object/Lasso/null-object.lasso new file mode 100644 index 0000000000..d3bceaccaf --- /dev/null +++ b/Task/Null-object/Lasso/null-object.lasso @@ -0,0 +1,18 @@ +local(x = string, y = null) +#x->isA(::null) +// 0 (false) + +#y->isA(::null) +// 1 (true) + +#x == null +// false + +#y == null +//true + +#x->type == 'null' +// false + +#y->type == 'null' +//true diff --git a/Task/Null-object/Lily/null-object.lily b/Task/Null-object/Lily/null-object.lily new file mode 100644 index 0000000000..4eef32a6c7 --- /dev/null +++ b/Task/Null-object/Lily/null-object.lily @@ -0,0 +1,21 @@ +enum class Option[A] { + Some(A) + None +} + +# Only variables of class Option can be assigned to None. + +# Type: Option[integer] +var v = Some(10) + +# Valid: v is an Option, and any Option can be assigned to None +v = None + +# Invalid! v is an Option[integer], not just a plain integer. +v = 10 + +# Type: integer +var w = 10 + +# Invalid! Likewise, w is an integer, not an Option. +w = None diff --git a/Task/Null-object/Lingo/null-object.lingo b/Task/Null-object/Lingo/null-object.lingo new file mode 100644 index 0000000000..0a1f843e5c --- /dev/null +++ b/Task/Null-object/Lingo/null-object.lingo @@ -0,0 +1,12 @@ +put _global.doesNotExist +-- + +put voidP(_global.doesNotExist) +-- 1 + +x = VOID +put x +-- + +put voidP(x) +-- 1 diff --git a/Task/Null-object/Nim/null-object.nim b/Task/Null-object/Nim/null-object.nim new file mode 100644 index 0000000000..1ce2daf6c0 --- /dev/null +++ b/Task/Null-object/Nim/null-object.nim @@ -0,0 +1,3 @@ +var s: string = nil + +var ns: string not nil = nil # Compile time error diff --git a/Task/Null-object/Oforth/null-object.oforth b/Task/Null-object/Oforth/null-object.oforth new file mode 100644 index 0000000000..1556232e8f --- /dev/null +++ b/Task/Null-object/Oforth/null-object.oforth @@ -0,0 +1,3 @@ +null isNull +"abcd" isNull +: testNull { | a | a ifNull: [ "Variable value is null" println ] ; diff --git a/Task/Null-object/PHL/null-object.phl b/Task/Null-object/PHL/null-object.phl new file mode 100644 index 0000000000..71dbf9c8e2 --- /dev/null +++ b/Task/Null-object/PHL/null-object.phl @@ -0,0 +1 @@ +if (obj == null) printf("obj is null!\n"); diff --git a/Task/Null-object/Phix/null-object.phix b/Task/Null-object/Phix/null-object.phix new file mode 100644 index 0000000000..74386ecfcd --- /dev/null +++ b/Task/Null-object/Phix/null-object.phix @@ -0,0 +1,17 @@ +type nullableString(object o) + return string(o) or o=NULL +end type +nullableString s +s = "hello" +s = NULL +--s = 1 -- error +--s = {1,2,3} -- error + +type nullableSequence(object o) + return sequence(o) or o=NULL +end type +nullableSequence q +q = {1,2,3} +q = "string" -- fine (strings are a subset of sequences) +q = NULL +--q = 1 -- error diff --git a/Task/Null-object/Ring/null-object.ring b/Task/Null-object/Ring/null-object.ring new file mode 100644 index 0000000000..12a82ee52d --- /dev/null +++ b/Task/Null-object/Ring/null-object.ring @@ -0,0 +1,5 @@ +see isnull(5) + nl + # print 0 +isnull("hello") + nl + # print 0 +isnull([1,3,5]) + nl + # print 0 +isnull("") + nl + # print 1 +isnull("NULL") # print 1 diff --git a/Task/Null-object/Sidef/null-object-1.sidef b/Task/Null-object/Sidef/null-object-1.sidef new file mode 100644 index 0000000000..d7fecc7862 --- /dev/null +++ b/Task/Null-object/Sidef/null-object-1.sidef @@ -0,0 +1,3 @@ +var undefined; # initialized with an implicit nil +say undefined==nil; # true +say defined(nil) # false diff --git a/Task/Null-object/Sidef/null-object-2.sidef b/Task/Null-object/Sidef/null-object-2.sidef new file mode 100644 index 0000000000..afba9fc1ca --- /dev/null +++ b/Task/Null-object/Sidef/null-object-2.sidef @@ -0,0 +1,3 @@ +var null_obj = null; # initialize with a null value +say null_obj.is_a(null); # true +say defined(null_obj); # true diff --git a/Task/Null-object/Swift/null-object-1.swift b/Task/Null-object/Swift/null-object-1.swift new file mode 100644 index 0000000000..fa34a63c18 --- /dev/null +++ b/Task/Null-object/Swift/null-object-1.swift @@ -0,0 +1,2 @@ +var opt : Int? = nil // use "nil" to represent no value +opt = 5 // or simply assign a value to the optional type diff --git a/Task/Null-object/Swift/null-object-2.swift b/Task/Null-object/Swift/null-object-2.swift new file mode 100644 index 0000000000..f7b4ff2437 --- /dev/null +++ b/Task/Null-object/Swift/null-object-2.swift @@ -0,0 +1,5 @@ +if let v = opt { + println("There is some value: \(v)") +} else { + println("There is no value") +} diff --git a/Task/Null-object/Ursa/null-object.ursa b/Task/Null-object/Ursa/null-object.ursa new file mode 100644 index 0000000000..644443a91b --- /dev/null +++ b/Task/Null-object/Ursa/null-object.ursa @@ -0,0 +1,9 @@ +# the type at declaration doesn't matter +decl int x + +set x null +if (= x null) + out "x is null" endl console +else + out "x is not null" endl console +end if diff --git a/Task/Null-object/Wart/null-object.wart b/Task/Null-object/Wart/null-object.wart new file mode 100644 index 0000000000..8797ce3a32 --- /dev/null +++ b/Task/Null-object/Wart/null-object.wart @@ -0,0 +1 @@ +(not nil) diff --git a/Task/Null-object/jq/null-object.jq b/Task/Null-object/jq/null-object.jq new file mode 100644 index 0000000000..ccf586cb6a --- /dev/null +++ b/Task/Null-object/jq/null-object.jq @@ -0,0 +1,11 @@ +null|type # => "null" + +null == false # => false + +null == null # => true + +empty|type # => # i.e. nothing (as in, nada) + +empty == empty # => # niente + +empty == "black hole" # => # Ничего diff --git a/Task/Number-names/Nim/number-names.nim b/Task/Number-names/Nim/number-names.nim new file mode 100644 index 0000000000..18a0011a5a --- /dev/null +++ b/Task/Number-names/Nim/number-names.nim @@ -0,0 +1,74 @@ +import strutils, algorithm + +const + tens = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", + "eighty", "ninety"] + small = ["zero", "one", "two", "three", "four", "five", "six", "seven", + "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", + "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"] + huge = ["", "", "million", "billion", "trillion", "quadrillion", + "quintillion", "sextillion", "septillion", "octillion", "nonillion", + "decillion"] + +proc spellInteger(n: int64): string + +proc nonzero(c: string, n: int, connect=""): string = + if n == 0: "" else: connect & c & spellInteger(n) + +proc lastAnd(num): string = + var num = num + if "," in num: + let pos = num.rfind(",") + var (pre, last) = + if pos >= 0: (num[0 .. pos-1], num[pos+1 .. num.high]) + else: ("", num) + if " and " notin last: + last = " and" & last + num = [pre, ",", last].join() + return num + +proc big(e, n): string = + if e == 0: + spellInteger(n) + elif e == 1: + spellInteger(n) & " thousand" + else: + spellInteger(n) & " " & huge[e] + +iterator base1000Rev(n): int = + var n = n + while n != 0: + let r = n mod 1000 + n = n div 1000 + yield r + +proc spellInteger(n: int64): string = + if n < 0: + "minus " & spellInteger(-n) + elif n < 20: + small[int(n)] + elif n < 100: + let a = n div 10 + let b = n mod 10 + tens[int(a)] & nonzero("-", b) + elif n < 1000: + let a = n div 100 + let b = n mod 100 + small[int(a)] & " hundred" & nonzero(" ", b, " and") + else: + var sq = newSeq[string]() + var e = 0 + for x in base1000Rev(n): + if x > 0: + sq.add big(e, x) + inc e + reverse sq + lastAnd(sq.join(", ")) + +for n in [0, -3, 5, -7, 11, -13, 17, -19, 23, -29]: + echo align($n, 4)," -> ",spellInteger(n) + +var n = 201021002001 +while n != 0: + echo align($n, 14)," -> ",spellInteger(n) + n = n div -10 diff --git a/Task/Number-names/Phix/number-names.phix b/Task/Number-names/Phix/number-names.phix new file mode 100644 index 0000000000..12e4bbc17d --- /dev/null +++ b/Task/Number-names/Phix/number-names.phix @@ -0,0 +1,104 @@ +constant twenties = {"zero","one","two","three","four","five","six","seven","eight","nine","ten", + "eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"} + +function Twenty(integer N) + return twenties[mod(N,20)+1] +end function + +constant decades = {"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"} + +function Decade(integer N) + return decades[mod(N,10)-1] +end function + +function Hundred(integer N) + if N<20 then + return Twenty(N) + elsif mod(N,10)=0 then + return Decade(mod(floor(N/10),10)) + end if + return Decade(floor(N/10)) & '-' & Twenty(mod(N,10)) +end function + +function Thousand(integer N, string withand) + if N<100 then + return withand & Hundred (N); + elsif mod(N,100)=0 then + return withand & Twenty(floor(N/100))&" hundred" + end if + return Twenty(floor(N/100)) & " hundred and " & Hundred(mod(N,100)) +end function + +constant orders = {{power(10,12),"trillion"}, + {power(10,9),"billion"}, + {power(10,6),"million"}, + {power(10,3),"thousand"}} + +function Triplet(atom N) +atom Order, High, Low +string Name, res = "" +integer n + for i=1 to length(orders) do + {Order,Name} = orders[i] + High = floor(N/Order) + Low = mod(N,Order) + if High!=0 then + res &= Thousand(High,"")&' '&Name + end if + N = Low + if Low=0 then exit end if + if length(res) and High!=0 then + res &= ", " + end if + end for + if N!=0 or res="" then + res &= Thousand(floor(N),iff(res=""?"":"and ")) + N = abs(mod(N,1)) + if N>1e-6 then + res &= " point" + for i=1 to 10 do + n = floor(N*10.0000001) + res &= ' '&twenties[n+1] + N = N*10-n + if abs(N)<1e-6 then exit end if + end for + end if + end if + return res +end function + +function spell(atom N) +string res = "" + if N<0 then + res = "minus " + N = -N + end if + res &= Triplet(N) + return res +end function + +constant Samples = {99, 300, 310, 417,1_501, 12_609, 200000000000100, 999999999999999, + -123456787654321,102003000400005,1020030004,102003,102,1,0,-1,-99, + -1501,1234,12.34,10000001.2,1E-3,-2.7182818} + +function smartp(atom N) +string res + if N=floor(N) then return sprintf("%d",N) end if + res = sprintf("%18.8f",N) + if find('.',res) then + res = trim_tail(res,"0") + end if + return res +end function + +atom si +for i=1 to length(Samples) do + si = Samples[i] + printf(1,"%18s %s\n",{smartp(si),spell(si)}) +end for + +si = 201021002001 +while si!=0 do + printf(1,"%18s %s\n",{smartp(si),spell(si)}) + si = trunc(si/-10) +end while diff --git a/Task/Number-names/Ring/number-names.ring b/Task/Number-names/Ring/number-names.ring new file mode 100644 index 0000000000..1d98895b10 --- /dev/null +++ b/Task/Number-names/Ring/number-names.ring @@ -0,0 +1,75 @@ +OneList=["zero", "one", "two", "three", "four", + "five", "six", "seven", "eight", "nine", + "ten", "eleven", "twelve", "thirteen", "fourteen", + "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"] +tenList=["" , "" , "twenty", "thirty", "fourty", + "fifty", "sixty", "seventy", "eighty", "ninety"] + +millionStr="Million" +thousandStr="Thousand" +hundredStr="Hundred" +andStr="And" +pointStr=" Point " + +while true + see "enter number to convert:" + give theNumber + + pointSplited=splitString(theNumber,".") + fraction=0 + + useFr=false + if len(pointSplited) >=1 theNumber=pointSplited[1] ok + if len(pointSplited) >=2 useFr=true fraction=pointSplited[2] ok + pointSplited=null + + see getName(number(theNumber)) + if useFr=true see pointStr + getName(number(fraction)) ok + see nl +end + +func getName num +rtn=null +if num=0 + rtn += OneList[floor(num+1)] + return rtn +ok +if num<0 + return "minus " + getName(fabs(num)) +ok +if num>= 1000000 + rtn += getName(num / 1000000) +" "+ millionStr + num%=1000000 +ok +if num>=1000 + if len(rtn)>0 rtn += ", " ok + + rtn += getName(num / 1000)+ " " + thousandStr + num%=1000 +ok + +if num >=100 +if len(rtn)>0 rtn += ", " ok + rtn += OneList[floor((num / 100)+1)] + " " + hundredStr + num%=100 +ok + +if num=0 + return rtn + +ok +if len(rtn)>0 rtn += " " + andStr + " " ok +if(num>=20) + + rtn += tenList[floor((num / 10)+1)] + num%=10 +ok +if num=0 + return rtn +ok +if len(rtn)>0 rtn += " " ok +rtn += OneList[num+1] +return rtn + +func splitString str,chr + for i in str if strcmp(i,chr)=0 i=nl ok next + return str2list(str) diff --git a/Task/Number-names/SequenceL/number-names.sequencel b/Task/Number-names/SequenceL/number-names.sequencel new file mode 100644 index 0000000000..5f9c0c3d7c --- /dev/null +++ b/Task/Number-names/SequenceL/number-names.sequencel @@ -0,0 +1,61 @@ +import ; +import ; +import ; +import ; + +main(argv(2)) := delimit(numberToEnglish(stringToInt(argv)), '\n'); + +ones := ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]; +teens := ["eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]; +tens := ["ten", "twenty", "thrity", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]; + +magnitudes := ["", "thousand", "million", "billion", "trillion"]; + +numberToEnglish(num(0)) := + let + triplets[i] := + (num / integerPower(1000, i - 1)) mod 1000 + foreach i within 1 ... ceiling(log(1000, num + 1)); + + englishtTriplets[j] := numberToEnglishHelper(triplets[j]); + + partials[j] := + englishtTriplets[j] ++ magnitudes[j] ++ ", " when size(englishtTriplets[j]) > 0 + foreach j within reverse(1 ... size(triplets)); + in + "zero" when num = 0 + else + "negative " ++ numberToEnglish(-num) when num < 0 + else + trim(allButLast(trim(join(partials)))); + + +numberToEnglishHelper(num(0)) := + let + onesPlace := num mod 10; + tensPlace := (num mod 100) / 10; + hundredsPlace := (num mod 1000) / 100; + + onesWord := "ten " when tensPlace = 1 and onesPlace = 0 + else + "" when onesPlace = 0 + else + teens[onesPlace] ++ " " when tensPlace = 1 + else + ones[onesPlace] ++ " "; + + tensWord := "" when tensPlace = 0 or tensPlace = 1 + else + tens[tensPlace] ++ " " when onesPlace = 0 + else + tens[tensPlace] ++ "-"; + + hundredsWord := "" when hundredsPlace = 0 + else + ones[hundredsPlace] ++ " hundred "; + + andWord := "" when hundredsPlace = 0 or (tensPlace = 0 and onesPlace = 0) else "and "; + + + in + hundredsWord ++ andWord ++ tensWord ++ onesWord; diff --git a/Task/Number-names/Sidef/number-names.sidef b/Task/Number-names/Sidef/number-names.sidef new file mode 100644 index 0000000000..f2c1bcf5a8 --- /dev/null +++ b/Task/Number-names/Sidef/number-names.sidef @@ -0,0 +1,2 @@ +var l = frequire('Lingua::EN::Numbers'); +say l.num2en(123456789); diff --git a/Task/Number-names/jq/number-names-1.jq b/Task/Number-names/jq/number-names-1.jq new file mode 100644 index 0000000000..6d3a753b59 --- /dev/null +++ b/Task/Number-names/jq/number-names-1.jq @@ -0,0 +1,61 @@ +# Adapted from the go version. +# Tested with jq 1.4 +# +# say/0 as defined here supports positive and negative integers within +# the range of accuracy of jq, or up to the quintillions, whichever is +# less. As of jq version 1.4, jq's integer accuracy is about 10^16. + +def say: + + # subfunction zillions recursively handles the thousands, + # millions, billions, etc. + # input: the number + # i: which "illion" to use + # sx: the string so far + # output: the updated string + def zillions(i; sx): + ["thousand", "million", "billion", + "trillion", "quadrillion", "quintillion"] as $illions + | if . == 0 then sx + else (. / 1000 | floor) + | (. % 1000) as $p + | zillions(i + 1; + if $p > 0 then + (($p | say) + " " + $illions[i]) as $ix + | if sx != "" then $ix + ", " + sx + else $ix + end + else sx + end) + end + ; + + [ "", "one", "two", "three", "four", "five", "six", "seven", + "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", + "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"] as $small + | ["ones", "ten", "twenty", "thirty", "forty", + "fifty", "sixty", "seventy", "eighty", "ninety"] as $tens + + | if . == 0 then "zero" + elif . < 0 then "minus " + (-(.) | say) + elif . < 20 then $small[.] + elif . < 100 then + $tens[./10|floor] as $t + | (. % 10) + | if . > 0 then ($t + " " + $small[.]) else $t end + elif . < 1000 then + ($small[./100|floor] + " hundred") as $h + | (. % 100) + | if . > 0 then $h + " and " + (say) else $h end + else + # Handle values larger than 1000 by considering + # the rightmost three digits separately from the rest: + ((. % 1000) + | if . == 0 then "" + elif . < 100 then "and " + say + else say + end ) as $sx + | zillions(0; $sx) + end ; + +say diff --git a/Task/Number-names/jq/number-names-2.jq b/Task/Number-names/jq/number-names-2.jq new file mode 100644 index 0000000000..9579b26a47 --- /dev/null +++ b/Task/Number-names/jq/number-names-2.jq @@ -0,0 +1,16 @@ +0 +"zero" +-0 +"zero" +111 +"one hundred and eleven" +1230000 +"one million, two hundred and thirty thousand" +123456 +"one hundred and twenty three thousand, four hundred and fifty six" +123456789 +"one hundred and twenty three million, four hundred and fifty six thousand, seven hundred and eighty nine" +-123000000123 +"minus one hundred and twenty three billion, one hundred and twenty three" +12345678912345678 +"twelve quadrillion, three hundred and forty five trillion, six hundred and seventy eight billion, nine hundred and twelve million, three hundred and forty five thousand, six hundred and seventy eight" diff --git a/Task/Number-reversal-game/Nim/number-reversal-game.nim b/Task/Number-reversal-game/Nim/number-reversal-game.nim new file mode 100644 index 0000000000..bfcc75eb2d --- /dev/null +++ b/Task/Number-reversal-game/Nim/number-reversal-game.nim @@ -0,0 +1,41 @@ +import math, rdstdin, strutils, algorithm +randomize() + +proc shuffle[T](x: var seq[T]) = + for i in countdown(x.high, 0): + let j = random(i + 1) + swap(x[i], x[j]) + +proc isSorted[T](s: openarray[T]): bool = + var last = low(T) + for c in s: + if c < last: + return false + last = c + return true + +proc toString[T](s: openarray[T]): string = + result = "" + for i, x in s: + if i > 0: + result.add " " + result.add($x) + +echo """number reversal game + Given a jumbled list of the numbers 1 to 9 + Show the list. + Ask the player how many digits from the left to reverse. + Reverse those digits then ask again. + until all the digits end up in ascending order.""" + +var data = @[1,2,3,4,5,6,7,8,9] +var trials = 0 +while isSorted data: + shuffle data +while not isSorted data: + inc trials + var flip = parseInt readLineFromStdin( + "#" & $trials & ": List: '" & toString(data) & "' Flip how many?: ") + reverse(data, 0, flip - 1) + +echo "You took ", trials, " attempts to put the digits in order!" diff --git a/Task/Number-reversal-game/Oforth/number-reversal-game.oforth b/Task/Number-reversal-game/Oforth/number-reversal-game.oforth new file mode 100644 index 0000000000..58c16f1229 --- /dev/null +++ b/Task/Number-reversal-game/Oforth/number-reversal-game.oforth @@ -0,0 +1,16 @@ +import: console + +: reversalGame +| l n | + doWhile: [ + ListBuffer new ->l + while(l size 9 <>) [ 9 rand dup l include ifFalse: [ l add ] else: [ drop ] ] + l sort l == + ] + + 0 while(l sort l <>) [ + System.Out "List is " << l << " ==> how many digits from left to reverse : " <- + System.Console askln asInteger dup ifNull: [ drop continue ] ->n + 1+ l left(n) reverse l right(l size n -) + ->l + ] + "You won ! Your score is :" . println ; diff --git a/Task/Number-reversal-game/Phix/number-reversal-game.phix b/Task/Number-reversal-game/Phix/number-reversal-game.phix new file mode 100644 index 0000000000..3dfc911c1a --- /dev/null +++ b/Task/Number-reversal-game/Phix/number-reversal-game.phix @@ -0,0 +1,22 @@ +puts(1,"Given a jumbled list of the numbers 1 to 9,\n") +puts(1,"you must select how many digits from the left to reverse.\n") +puts(1,"Your goal is to get the digits in order with 1 on the left and 9 on the right.\n") + +constant inums = tagset(9) +sequence nums +integer turns = 0, flip + +while 1 do + nums = shuffle(inums) + if nums!=inums then exit end if +end while + +while 1 do + printf(1,"%2d : %d %d %d %d %d %d %d %d %d ",turns&nums) + if nums=inums then exit end if + flip = prompt_number(" -- How many numbers should be flipped? ",{1,9}) + nums[1..flip] = reverse(nums[1..flip]) + turns += 1 +end while + +printf(1,"\nYou took %d turns to put the digits in order.", turns) diff --git a/Task/Number-reversal-game/Sidef/number-reversal-game.sidef b/Task/Number-reversal-game/Sidef/number-reversal-game.sidef new file mode 100644 index 0000000000..ddceea0bf7 --- /dev/null +++ b/Task/Number-reversal-game/Sidef/number-reversal-game.sidef @@ -0,0 +1,11 @@ +var turn = 0; +var jumble = @(1..9).bshuffle; # best-shuffle + +for (turn; jumble != 1..9; ++turn) { + printf("%2d: %s - Flip how many digits ? ", turn, jumble.join(' ')); + var d = read(Number) \\ break; + jumble[0 .. d-1] = [jumble[0 .. d-1]].reverse...; +} + +print " #{jumble.join(' ')}\n"; +print "You won in #{turn} turns.\n"; diff --git a/Task/Numerical-integration-Gauss-Legendre-Quadrature/Sidef/numerical-integration-gauss-legendre-quadrature.sidef b/Task/Numerical-integration-Gauss-Legendre-Quadrature/Sidef/numerical-integration-gauss-legendre-quadrature.sidef new file mode 100644 index 0000000000..da6244cf3d --- /dev/null +++ b/Task/Numerical-integration-Gauss-Legendre-Quadrature/Sidef/numerical-integration-gauss-legendre-quadrature.sidef @@ -0,0 +1,58 @@ +func legendre_pair((1), x) { (x, 1) } +func legendre_pair( n, x) { + var (m1, m2) = legendre_pair(n - 1, x); + var u = (1 - 1/n); + ((1 + u)*x*m1 - u*m2, m1); +} + +func legendre((0), _) { 1 } +func legendre( n, x) { [legendre_pair(n, x)][0] } + +func legendre_prime({ .is_zero }, _) { 0 } +func legendre_prime({ .is_one }, _) { 1 } + +func legendre_prime(n, x) { + var (m0, m1) = legendre_pair(n, x); + (m1 - x*m0) * n / (1 - x**2); +} + +func approximate_legendre_root(n, k) { + # Approximation due to Francesco Tricomi + var t = ((4*k - 1) / (4*n + 2)); + (1 - ((n - 1)/(8 * n**3))) * (Num.pi * t -> cos); +} + +func newton_raphson(f, f_prime, r, eps = 2e-16) { + while (var dr = float(-f(r) / f_prime(r)) -> abs >= eps) { + r += dr; + } + return r; +} + +func legendre_root(n, k) { + newton_raphson(legendre.method(:call, n), legendre_prime.method(:call, n), + approximate_legendre_root(n, k)); +} + +func weight(n, r) { 2 / ((1 - r**2) * legendre_prime(n, r)**2) } + +func nodes(n) { + gather { + take(Pair(0, weight(n, 0))) if n.is_odd; + (n >> 1).times { |i| + var r = legendre_root(n, i); + var w = weight(n, r); + take(Pair(r, w), Pair(-r, w)); + } + } +} + +func quadrature(n, f, a, b, nds = nodes(n)) { + func scale(x) { (x*(b - a) + a + b) / 2 } + (b - a) / 2 * nds.map{ .second * f(scale(.first)) }.sum +} + +[(5..10)..., 20].each { |i| + printf("Gauss-Legendre %2d-point quadrature ∫₋₃⁺³ exp(x) dx ≈ %.15f\n", + i, quadrature(i, {.exp}, -3, +3)) +} diff --git a/Task/Numerical-integration/FreeBASIC/numerical-integration.freebasic b/Task/Numerical-integration/FreeBASIC/numerical-integration.freebasic new file mode 100644 index 0000000000..9dc6fde600 --- /dev/null +++ b/Task/Numerical-integration/FreeBASIC/numerical-integration.freebasic @@ -0,0 +1,125 @@ +' version 17-09-2015 +' compile with: fbc -s console + +#Define screen_width 1024 +#Define screen_height 256 +ScreenRes screen_width, screen_height, 8 +Width screen_width\8, screen_height\16 + +Function f1(x As Double) As Double + Return x^3 +End Function + +Function f2(x As Double) As Double + Return 1/x +End Function + +Function f3(x As Double) As Double + Return x +End Function + +Function leftrect(a As Double, b As Double, n As Double, _ +ByVal f As Function (ByVal As Double) As Double) As Double + + Dim As Double sum, x = a, h = (b - a) / n + + For i As UInteger = 1 To n + sum = sum + h * f(x) + x = x + h + Next + + leftrect = sum +End Function + +Function rightrect(a As Double, b As Double, n As Double, _ +ByVal f As Function (ByVal As Double) As Double) As Double + + Dim As Double sum, x = a, h = (b - a) / n + + For i As UInteger = 1 To n + x = x + h + sum = sum + h * f(x) + Next + + rightrect = sum +End Function + +Function midrect(a As Double, b As Double, n As Double, _ +ByVal f As Function (ByVal As Double) As Double) As Double + + Dim As Double sum, h = (b - a) / n, x = a + h / 2 + + For i As UInteger = 1 To n + sum = sum + h * f(x) + x = x + h + Next + + midrect = sum +End Function + +Function trap(a As Double, b As Double, n As Double, _ +ByVal f As Function (ByVal As Double) As Double) As Double + + Dim As Double x = a, h = (b - a) / n + Dim As Double sum = h * (f(a) + f(b)) / 2 + + For i As UInteger = 1 To n -1 + x = x + h + sum = sum + h * f(x) + Next + + trap = sum +End Function + +Function simpson(a As Double, b As Double, n As Double, _ +ByVal f As Function (ByVal As Double) As Double) As Double + + Dim As UInteger i + Dim As Double sum1, sum2 + Dim As Double h = (b - a) / n + + For i = 0 To n -1 + sum1 = sum1 + f(a + h * i + h / 2) + Next i + + For i = 1 To n -1 + sum2 = sum2 + f(a + h * i) + Next i + + simpson = h / 6 * (f(a) + f(b) + 4 * sum1 + 2 * sum2) +End Function + +' ------=< main >=------ + +Dim As Double y +Dim As String frmt = " ##.##########" + +Print +Print "function range steps leftrect midrect " + _ + "rightrect trap simpson " + +Print "f(x) = x^3 0 - 1 100"; +Print Using frmt; leftrect(0, 1, 100, @f1); midrect(0, 1, 100, @f1); _ +rightrect(0, 1, 100, @f1); trap(0, 1, 100, @f1); simpson(0, 1, 100, @f1) + +Print "f(x) = 1/x 1 - 100 1000"; +Print Using frmt; leftrect(1, 100, 1000, @f2); midrect(1, 100, 1000, @f2); _ + rightrect(1, 100, 1000, @f2); trap(1, 100, 1000, @f2); _ + simpson(1, 100, 1000, @f2) + +frmt = " #########.###" +Print "f(x) = x 0 - 5000 5000000"; +Print Using frmt; leftrect(0, 5000, 5000000, @f3); midrect(0, 5000, 5000000, @f3); _ + rightrect(0, 5000, 5000000, @f3); trap(0, 5000, 5000000, @f3); _ + simpson(0, 5000, 5000000, @f3) + +Print "f(x) = x 0 - 6000 6000000"; +Print Using frmt; leftrect(0, 6000, 6000000, @f3); midrect(0, 6000, 6000000, @f3); _ + rightrect(0, 6000, 6000000, @f3); trap(0, 6000, 6000000, @f3); _ + simpson(0, 6000, 6000000, @f3) + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Numerical-integration/Nim/numerical-integration.nim b/Task/Numerical-integration/Nim/numerical-integration.nim new file mode 100644 index 0000000000..b6b8d38c7f --- /dev/null +++ b/Task/Numerical-integration/Nim/numerical-integration.nim @@ -0,0 +1,45 @@ +type Function = proc(x: float): float +type Rule = proc(f: Function; x, h: float): float + +proc leftRect(f: Function; x, h: float): float = + f(x) + +proc midRect(f: Function; x, h: float): float = + f(x + h/2.0) + +proc rightRect(f: Function; x, h: float): float = + f(x + h) + +proc trapezium(f: Function; x, h: float): float = + (f(x) + f(x+h)) / 2.0 + +proc simpson(f: Function, x, h: float): float = + (f(x) + 4.0*f(x+h/2.0) + f(x+h)) / 6.0 + +proc cube(x: float): float = + x * x *x + +proc reciprocal(x: float): float = + 1.0 / x + +proc identity(x: float): float = + x + +proc integrate(f: Function; a, b: float; steps: int; meth: Rule): float = + let h = (b-a) / float(steps) + for i in 0 .. ; +import ; + +integrateLeft(f, a, b, n) := + let + h := (b - a) / n; + vals[x] := f(x) foreach x within (0 ... (n-1)) * h + a; + in + h * sum(vals); + +integrateRight(f, a, b, n) := + let + h := (b - a) / n; + vals[x] := f(x+h) foreach x within (0 ... (n-1)) * h + a; + in + h * sum(vals); + +integrateMidpoint(f, a, b, n) := + let + h := (b - a) / n; + vals[x] := f(x+h/2.0) foreach x within (0 ... (n-1)) * h + a; + in + h * sum(vals); + +integrateTrapezium(f, a, b, n) := + let + h := (b - a) / n; + vals[i] := 2.0 * f(a + i * h) foreach i within 1 ... n-1; + in + h * (sum(vals) + f(a) + f(b)) / 2.0; + +integrateSimpsons(f, a, b, n) := + let + h := (b - a) / n; + vals1[i] := f(a + h * i + h / 2.0) foreach i within 0 ... n-1; + vals2[i] := f(a + h * i) foreach i within 1 ... n-1; + in + h / 6.0 * (f(a) + f(b) + 4.0 * sum(vals1) + 2.0 * sum(vals2)); + +xCubed(x) := x^3; +xInverse(x) := 1/x; +identity(x) := x; + +tests[method] := + [method(xCubed, 0.0, 1.0, 100), + method(xInverse, 1.0, 100.0, 1000), + method(identity, 0.0, 5000.0, 5000000), + method(identity, 0.0, 6000.0, 6000000)] + foreach method within [integrateLeft, integrateRight, integrateMidpoint, integrateTrapezium, integrateSimpsons]; + +//String manipulation for ouput display. +main := + let + heading := [["Func", "Range\t", "L-Rect\t", "R-Rect\t", "M-Rect\t", "Trapezium", "Simpson"]]; + ranges := [["0 - 1\t", "1 - 100\t", "0 - 5000", "0 - 6000"]]; + funcs := [["x^3", "1/x", "x", "x"]]; + in + delimit(delimit(heading ++ transpose(funcs ++ ranges ++ trimEndZeroes(floatToString(tests, 8))), '\t'), '\n'); + +trimEndZeroes(x(1)) := x when size(x) = 0 else x when x[size(x)] /= '0' else trimEndZeroes(x[1...size(x)-1]); diff --git a/Task/Numerical-integration/Sidef/numerical-integration.sidef b/Task/Numerical-integration/Sidef/numerical-integration.sidef new file mode 100644 index 0000000000..17952bff55 --- /dev/null +++ b/Task/Numerical-integration/Sidef/numerical-integration.sidef @@ -0,0 +1,54 @@ +func sum(f, start, from, to) { + var s = 0; + RangeNum(start, to, from-start).each { |i| + s += f(i); + } + return s +} + +func leftrect(f, a, b, n) { + var h = ((b - a) / n); + h * sum(f, a, a+h, b-h); +} + +func rightrect(f, a, b, n) { + var h = ((b - a) / n); + h * sum(f, a+h, a + 2*h, b); +} + +func midrect(f, a, b, n) { + var h = ((b - a) / n); + h * sum(f, a + h/2, a + h + h/2, b - h/2) +} + +func trapez(f, a, b, n) { + var h = ((b - a) / n); + h/2 * (f(a) + f(b) + sum({ f(_)*2 }, a+h, a + 2*h, b-h)); +} + +func simpsons(f, a, b, n) { + var h = ((b - a) / n); + var h2 = h/2; + + var sum1 = f(a + h2); + var sum2 = 0; + + sum({|i| sum1 += f(i + h2); sum2 += f(i); 0 }, a+h, a+h+h, b-h); + h/6 * (f(a) + f(b) + 4*sum1 + 2*sum2); +} + +func tryem(label, f, a, b, n, exact) { + say "\n#{label}\n in [#{a}..#{b}] / #{n}"; + + say(' exact result: ', exact); + say(' rectangle method left: ', leftrect(f, a, b, n)); + say(' rectangle method right: ', rightrect(f, a, b, n)); + say(' rectangle method mid: ', midrect(f, a, b, n)); + say('composite trapezoidal rule: ', trapez(f, a, b, n)); + say(' quadratic simpsons rule: ', simpsons(f, a, b, n)); +} + +tryem('x^3', { _ ** 3 }, 0, 1, 100, 0.25); +tryem('1/x', { 1 / _ }, 1, 100, 1000, log(100)); +tryem('x', { _ }, 0, 5_000, 5_000_000, 12_500_000); +tryem('x', { _ }, 0, 6_000, 6_000_000, 18_000_000); diff --git a/Task/Object-serialization/EchoLisp/object-serialization-1.echolisp b/Task/Object-serialization/EchoLisp/object-serialization-1.echolisp new file mode 100644 index 0000000000..62c373d399 --- /dev/null +++ b/Task/Object-serialization/EchoLisp/object-serialization-1.echolisp @@ -0,0 +1,31 @@ +(define (person->string self) (format "%a : person." (person-name self))) +(define (writer->string self) (format "%a: writer of %a." + (person-name self) + (writer-books self))) +(define (father->string self) (format "%a: father of %a." + (person-name self) + (map person-name (father-children self)))) + +; 'classes' definition, with inheritance. +; a writer is a person, too. +(struct person (name) #:tostring person->string) +(struct writer person (books) #:tostring writer->string) +(struct father person (children) #:tostring father->string) + +(define simon (writer "Simon" '(my-life my-wife my-bike))) +(define elvis (person "Elvis")) +(define papa (father "papa" (list simon elvis))) + +(local-put-value 'simon simon "objects.dat") +📕 local-db: local-put:unknown store : "objects.dat" +;; forgot to create the store. Create it : +(local-make-store "objects.dat") → "objects.dat" + +(local-put-value 'simon simon "objects.dat") +(local-put-value 'elvis elvis "objects.dat") +(local-put-value 'papa papa "objects.dat") + +;; inspect +simon → Simon: writer of (my-life my-wife my-bike). +papa → papa: father of (Simon Elvis). +elvis → Elvis : person. diff --git a/Task/Object-serialization/EchoLisp/object-serialization-2.echolisp b/Task/Object-serialization/EchoLisp/object-serialization-2.echolisp new file mode 100644 index 0000000000..7c07d1034a --- /dev/null +++ b/Task/Object-serialization/EchoLisp/object-serialization-2.echolisp @@ -0,0 +1,28 @@ +;; reboot (close the browser window) +; inspect objects.dat : +(local-keys 'objects.dat) → ("elvis" "papa" "simon") + +(define simon (local-get-value 'simon "objects.dat")) +(define elvis (local-get-value 'elvis "objects.dat")) +(define papa (local-get-value 'papa "objects.dat")) + +; data are restored +simon → Simon: writer of (my-life my-wife my-bike). +papa → papa: father of (Simon Elvis). + +;; check if references (pointers) are restored +(set-writer-name! simon "Antoinette") → "Antoinette" +simon→ Antoinette: writer of (my-life my-wife my-bike). + +;; inspect +papa → papa: father of (Antoinette Elvis). ; YES 😳 ! + +;; - Self-referencing (EchoLisp version 2.11) +;; add 'papa' to the chidren of 'papa' - whatever this means - and print it : +(set-father-children! papa (list simon papa elvis)) +papa → papa: father of (Antoinette papa Elvis). + +; save/restore +(local-put-value 'papa papa "objects.dat") +(define papa (local-get-value 'papa "objects.dat")) +papa → papa: father of (Antoinette papa Elvis). diff --git a/Task/Odd-word-problem/EchoLisp/odd-word-problem-1.echolisp b/Task/Odd-word-problem/EchoLisp/odd-word-problem-1.echolisp new file mode 100644 index 0000000000..733994538c --- /dev/null +++ b/Task/Odd-word-problem/EchoLisp/odd-word-problem-1.echolisp @@ -0,0 +1,30 @@ +(lib 'sequences) +(define input-stream null) +(define output-stream "") + +;;--------------------------- +;; character I/O simulation +;; -------------------------- +(define (read-char) (next input-stream)) ;; #f if EOF +(define (write-char c) (when c (set! output-stream (string-append output-stream c)))) + +(define (init-streams sentence) + (set! input-stream (procrastinator sentence)) + (set! output-stream "")) + +;;--------------------------------- +;; task , using read-char/write-char +;;---------------------------------- + +(define (flop) ; reverses, and returns first non-alpha after word, or EOF + (define c (read-char)) + (if (string-alphabetic? c) (begin0 (flop) (write-char c)) c)) + +(define (flip) + (define c (read-char)) + (if (string-alphabetic? c) (begin (write-char c) (flip)) c)) + +(define (task sentence) + (init-streams sentence) + (while (and (write-char (flip)) (write-char (flop)))) + output-stream ) diff --git a/Task/Odd-word-problem/EchoLisp/odd-word-problem-2.echolisp b/Task/Odd-word-problem/EchoLisp/odd-word-problem-2.echolisp new file mode 100644 index 0000000000..1618c23050 --- /dev/null +++ b/Task/Odd-word-problem/EchoLisp/odd-word-problem-2.echolisp @@ -0,0 +1,5 @@ +(task "what,is,the;meaning,of:life.") + → "what,si,the;gninaem,of:efil." +; check diacritical +(task "Longtemps,je me suis couché,héhé,hôhô,de bonne heure.") + → "Longtemps,ej me sius couché,éhéh,hôhô,ed bonne erueh." diff --git a/Task/Odd-word-problem/Lasso/odd-word-problem.lasso b/Task/Odd-word-problem/Lasso/odd-word-problem.lasso new file mode 100644 index 0000000000..420076ddfc --- /dev/null +++ b/Task/Odd-word-problem/Lasso/odd-word-problem.lasso @@ -0,0 +1,54 @@ +define odd_word_processor(str::string) => { + local( + isodd = false, + pos = 1, + invpos = 1, + lastpos = 1 + ) + while(#str->get(#pos) != '.' && #pos <= #str->size) => { + if(not #str->isAlpha(#pos)) => { + not #isodd ? #isodd = true | #isodd = false + } + if(#isodd) => { + #lastpos = 1 + #invpos = 1 + while(#str->isAlpha(#pos+#lastpos) && #pos+#lastpos <= #str->size) => { + #lastpos++ + } + 'odd lastpos: '+#lastpos+'\r' + local(maxpos = #pos+#lastpos-1) + while(#invpos < (#lastpos+1)/2) => { + local(i,o,ipos,opos) + #ipos = #pos+#invpos + #opos = #pos+(#lastpos-#invpos) + #i = #str->get(#ipos) + #o = #str->get(#opos) + + //'switching '+#i+' and '+#o+'\r' + + //'insert '+#o+' at '+(#ipos)+'\r' + #str = string_insert(#str,-position=(#ipos),-text=#o) + + //'remove redundant pos '+(#ipos+1)+'\r' + #str->remove(#ipos+1,1) + + //'insert '+#i+' at '+(#opos)+'\r' + #str = string_insert(#str,-position=(#opos),-text=#i) + + //'remove redundant pos '+(#opos+1)+'\r' + #str->remove(#opos+1,1) + + #invpos++ + } + #pos += #lastpos - 1 + } + //#str->get(#pos) + #isodd + '\r' + #pos += 1 + } + return #str +} + +'orig:\rwhat,is,the;meaning,of:life.\r' +'new:\r' +odd_word_processor('what,is,the;meaning,of:life.') +'\rShould have:\rwhat,si,the;gninaem,of:efil.' diff --git a/Task/Odd-word-problem/Nim/odd-word-problem.nim b/Task/Odd-word-problem/Nim/odd-word-problem.nim new file mode 100644 index 0000000000..338bee36da --- /dev/null +++ b/Task/Odd-word-problem/Nim/odd-word-problem.nim @@ -0,0 +1,28 @@ +import os, unicode, future + +proc nothing(): bool{.closure.} = false + +proc odd(prev = nothing): bool = + let a = stdin.readChar() + if not isAlpha(Rune(ord(a))): + discard prev() + stdout.write(a) + return a != '.' + + # delay action until later, in the shape of a closure + proc clos(): bool = + stdout.write(a) + prev() + + return odd(clos) + +proc even(): bool = + while true: + let c = stdin.readChar() + stdout.write(c) + if not isAlpha(Rune(ord(c))): + return c != '.' + +var e = false +while (if e: odd() else: even()): + e = not e diff --git a/Task/Odd-word-problem/Sidef/odd-word-problem.sidef b/Task/Odd-word-problem/Sidef/odd-word-problem.sidef new file mode 100644 index 0000000000..65a7f781fd --- /dev/null +++ b/Task/Odd-word-problem/Sidef/odd-word-problem.sidef @@ -0,0 +1,24 @@ +func rev { + (var c = STDIN.getc) \\ return() + if (c ~~ /^[a-z]\z/i) { + var r = rev() + print c + return r + } + return c +} + +var (n=0, l=false) +while (defined(var c = STDIN.getc)) { + var w = (c ~~ /^[a-z]\z/i) + ++n if (w && !l) + l = w + if (n & 1) { + print c + } else { + var r = rev() + print(c, r) + n = 0 + l = false + } +} diff --git a/Task/Old-lady-swallowed-a-fly/Nim/old-lady-swallowed-a-fly.nim b/Task/Old-lady-swallowed-a-fly/Nim/old-lady-swallowed-a-fly.nim new file mode 100644 index 0000000000..0d9063911b --- /dev/null +++ b/Task/Old-lady-swallowed-a-fly/Nim/old-lady-swallowed-a-fly.nim @@ -0,0 +1,17 @@ +import zlib, base64 + +const b64 = """ +eNrtVE1rwzAMvedXaKdeRn7ENrb21rHCzmrs1m49K9gOJv9+cko/HBcGg0LHcpOfnq2np0QL +2FuKgBbICDAoeoiKwEc0hqIUgLAxfV0tQJCdhQM7qh68kheswKeBt5ROYetTemYMCC3rii// +WMS3WkhXVyuFAaLT261JuBWwu4iDbvYp1tYzHVS68VEIObwFgaDB0KizuFs38aSdqKv3TgcJ +uPYdn2B1opwIpeKE53qPftxRd88Y6uoVbdPzWxznrQ3ZUi3DudQ/bcELbevqM32iCIrj3IIh +W6plOJf6L6xaajZjzqW/qAsKIvITBGs9Nm3glboZzkVP5l6Y+0bHLnedD0CttIyrpEU5Kv7N +Mz3XkPBc/TSN3yxGiqMiipHRekycK0ZwMhM8jerGC9zuZaoTho3kMKSfJjLaF8v8wLzmXMqM +zJvGew/jnZPzclA08yAkikegDTTUMfzwDXBcwoE=""" + +proc uncompress*(source: string, destLen: var int): string = + result = newString(destLen) + discard uncompress(result.cstring, addr destLen, source.cstring, source.len) + +var length = 10_000 +echo b64.decode.uncompress length diff --git a/Task/Old-lady-swallowed-a-fly/Phix/old-lady-swallowed-a-fly.phix b/Task/Old-lady-swallowed-a-fly/Phix/old-lady-swallowed-a-fly.phix new file mode 100644 index 0000000000..5a55fd0995 --- /dev/null +++ b/Task/Old-lady-swallowed-a-fly/Phix/old-lady-swallowed-a-fly.phix @@ -0,0 +1,27 @@ +sequence lines = {"Perhaps she'll die!\n"}, animals = {} + +procedure swallow(string animal, second_line, integer permanent_second_line=TRUE) + printf(1,"There was an old lady who swallowed a %s,\n%s\n",{animal,second_line}) + if length(animals)!=0 then + lines = prepend(lines,sprintf("She swallowed the %s to catch the %s,\n",{animal,animals[$]})) + end if + printf(1,"%s\n",{join(lines,"")}) + if permanent_second_line then + lines = prepend(lines,second_line&"\n") + end if + animals = append(animals,animal) +end procedure + +procedure swallow_all(sequence all) + for i=1 to length(all) do + string {animal,line2} = all[i] + swallow(animal, sprintf("%s, %s a %s;",{line2,iff(animal="cow"?"she swallowed":"to swallow"),animal}), FALSE); + end for +end procedure + +swallow("fly", "But I don't know why she swallowed the fly,"); +swallow("spider", "That wriggled and jiggled and tickled inside her;"); +swallow_all({{"bird", "Quite absurd"},{"cat", "Fancy that"},{"dog", "What a hog"}, + {"pig", "Her mouth was so big"},{"goat","She just opened her throat"}, + {"cow", "I don't know how"},{"donkey", "It was rather wonky"}}) +printf(1, "There was an old lady who swallowed a horse ...\nShe's dead, of course!") diff --git a/Task/Old-lady-swallowed-a-fly/Sidef/old-lady-swallowed-a-fly.sidef b/Task/Old-lady-swallowed-a-fly/Sidef/old-lady-swallowed-a-fly.sidef new file mode 100644 index 0000000000..978fd2e5ce --- /dev/null +++ b/Task/Old-lady-swallowed-a-fly/Sidef/old-lady-swallowed-a-fly.sidef @@ -0,0 +1,28 @@ +var victims = [ + :fly: " I don't know why S—", + :spider: " That wriggled and jiggled and tickled inside her.", + :bird: " How absurd, T!", + :cat: " Fancy that, S!", + :dog: " What a hog, T!", + :goat: " She just opened her throat, and in walked the goat!", + :cow: " I don't know how S!", + :horse: " She's dead, of course...", +]; + +var history = ["I guess she'll die...\n"]; + +victims.each { |pair| + var (victim, verse) = pair...; + say "There was an old lady who swallowed a #{victim}..."; + + verse.sub!(/\bS\b/, "she swallowed the #{victim}"); + verse.sub!(/\bT\b/, "to swallow a #{victim}!"); + + say verse; + verse ~~ /dead/ && break; + + history[0].sub!(/^X/, "She swallowed the #{victim}"); + history.each{.say}; + history.len < 5 && history.unshift(verse); + history.unshift("X to catch the #{victim},"); +}; diff --git a/Task/Old-lady-swallowed-a-fly/Ursa/old-lady-swallowed-a-fly.ursa b/Task/Old-lady-swallowed-a-fly/Ursa/old-lady-swallowed-a-fly.ursa new file mode 100644 index 0000000000..347d126162 --- /dev/null +++ b/Task/Old-lady-swallowed-a-fly/Ursa/old-lady-swallowed-a-fly.ursa @@ -0,0 +1,26 @@ +decl string<> reason creatures comments +append "She swallowed the " " to catch the " reason +append "fly" "spider" "bird" "cat" "dog" "goat" "cow" "horse" creatures +append "I don't know why she swallowed that fly.\nPerhaps she'll die\n" comments +append "That wiggled and jiggled and tickled inside her" comments +append "How absurd, to swallow a bird" comments +append "Imagine that. She swallowed a cat" comments +append "What a hog to swallow a dog" comments +append "She just opened her throat and swallowed that goat" comments +append "I don't know how she swallowed that cow" comments +append "She's dead of course" comments + +decl int max +set max (size creatures) +for (decl int i) (< i max) (inc i) + out "There was an old lady who swallowed a " creatures endl console + out comments endl console + decl int j + for (set j i) (and (> j 0) (< i (- max 1))) (dec j) + out reason<0> creatures reason<1> creatures<(int (- j 1))> endl console + if (= j 1) + out comments<(int (- j 1))> endl console + end if + end for +end for +in string console diff --git a/Task/One-dimensional-cellular-automata/8th/one-dimensional-cellular-automata.8th b/Task/One-dimensional-cellular-automata/8th/one-dimensional-cellular-automata.8th new file mode 100644 index 0000000000..db7967fc45 --- /dev/null +++ b/Task/One-dimensional-cellular-automata/8th/one-dimensional-cellular-automata.8th @@ -0,0 +1,31 @@ +\ one-dimensional automaton + +\ direct map of input state to output state: +{ + " " : 32, + " #" : 32, + " # " : 32, + " ##" : 35, + "# " : 32, + "# #" : 35, + "## " : 35, + "###" : 32, +} var, lifemap + +: transition \ s ix (r:s') -- (r:s') + >r dup r@ n:1- 3 s:slice + lifemap @ swap caseof + r> swap r@ -rot s:! >r ; + +\ run over 'state' and generate new state +: gen \ s -- s' + clone >r + dup s:len 2 n:- + ' transition 1 rot loop + drop r> ; + +: life \ s -- s' + dup . cr gen ; + +" ### ## # # # # # " ' life 10 times +bye diff --git a/Task/One-dimensional-cellular-automata/Ceylon/one-dimensional-cellular-automata.ceylon b/Task/One-dimensional-cellular-automata/Ceylon/one-dimensional-cellular-automata.ceylon new file mode 100644 index 0000000000..5f7a841054 --- /dev/null +++ b/Task/One-dimensional-cellular-automata/Ceylon/one-dimensional-cellular-automata.ceylon @@ -0,0 +1,45 @@ +shared void run() { + + class Automata1D({Cell*} data, Cell alive, Cell dead) + given Cell satisfies Object { + + assert(data.every((Cell element) => element == alive || element == dead)); + + value imaginaryFirstCell = data.first else dead; + value imaginaryLastCell = data.last else dead; + + value cells = Array {*data.rest.exceptLast}; + + function isAlive(Cell c) => c == alive; + function flipped(Cell c) => c == alive then dead else alive; + + shared Boolean evolve() { + value buffer = Array { + *cells.indexed.map((Integer->Cell element) { + value index->cell = element; + value left = cells[index - 1] else imaginaryFirstCell; + value right = cells[index + 1] else imaginaryLastCell; + if(isAlive(left) && isAlive(right)) { + return flipped(cell); + } + if(isAlive(cell) && !isAlive(left) && !isAlive(right)) { + return dead; + } + return cell; + } + )}; + value changed = buffer != cells; + buffer.copyTo(cells); + return changed; + } + + string => imaginaryFirstCell.string + "".join(cells) + imaginaryLastCell.string; + } + + value automata = Automata1D("_###_##_#_#_#_#__#__", '#', '_'); + variable value generation = 0; + print("generation ``generation`` ``automata``"); + while(automata.evolve() && generation < 10) { + print("generation ``++generation`` ``automata``"); + } +} diff --git a/Task/One-dimensional-cellular-automata/ERRE/one-dimensional-cellular-automata.erre b/Task/One-dimensional-cellular-automata/ERRE/one-dimensional-cellular-automata.erre new file mode 100644 index 0000000000..7776c392e6 --- /dev/null +++ b/Task/One-dimensional-cellular-automata/ERRE/one-dimensional-cellular-automata.erre @@ -0,0 +1,33 @@ +PROGRAM ONEDIM_AUTOMATA + +! for rosettacode.org +! + +!VAR I,J,N,W,K + +!$DYNAMIC +DIM X[0],X2[0] + +BEGIN + + DATA(20,0,1,1,1,0,1,1,0,1,0,1,0,1,0,1,0,0,1,0,0) + + PRINT(CHR$(12);) + N=20 ! number of generation required + READ(W) + !$DIM X[W+1],X2[W+1] + FOR I=1 TO W DO + READ(X[I]) + END FOR + FOR K=1 TO N DO + PRINT("Generation";K;TAB(16);) + FOR J=1 TO W DO + IF X[J]=1 THEN PRINT("#";) ELSE PRINT("_";) END IF + IF X[J-1]+X[J]+X[J+1]=2 THEN X2[J]=1 ELSE X2[J]=0 END IF + END FOR + PRINT + FOR J=1 TO W DO + X[J]=X2[J] + END FOR + END FOR +END PROGRAM diff --git a/Task/One-dimensional-cellular-automata/Elm/one-dimensional-cellular-automata.elm b/Task/One-dimensional-cellular-automata/Elm/one-dimensional-cellular-automata.elm new file mode 100644 index 0000000000..26724c08ac --- /dev/null +++ b/Task/One-dimensional-cellular-automata/Elm/one-dimensional-cellular-automata.elm @@ -0,0 +1,90 @@ +import Maybe exposing (withDefault) +import List exposing (length, tail, reverse, concat, head, append, map3) +import Html exposing (Html, div, h1, text) +import String exposing (join) +import Svg exposing (svg) +import Svg.Attributes exposing (version, width, height, viewBox,cx,cy, fill, r) +import Html.App exposing (program) +import Random exposing (step, initialSeed, bool, list) +import Matrix exposing (fromList, mapWithLocation, flatten) -- chendrix/elm-matrix +import Time exposing (Time, second, every) + +type alias Model = { history : List (List Bool) + , cols : Int + , rows : Int + } + +view : Model -> Html Msg +view model = + let + circleInBox (row,col) value = + if value + then [ Svg.circle [ r "0.3" + , fill ("purple") + , cx (toString (toFloat col + 0.5)) + , cy (toString (toFloat row + 0.5)) + ] + [] + ] + else [] + + showHistory model = + model.history + |> reverse + |> fromList + |> mapWithLocation circleInBox + |> flatten + |> concat + in + div [] + [ h1 [] [text "One Dimensional Cellular Automata"] + , svg [ version "1.1" + , width "700" + , height "700" + , viewBox (join " " + [ 0 |> toString + , 0 |> toString + , model.cols |> toString + , model.rows |> toString + ] + ) + ] + (showHistory model) + ] + +update : Msg -> Model -> (Model, Cmd Msg) +update msg model = + if length model.history == model.rows + then (model, Cmd.none) + else + let s1 = model.history |> head |> withDefault [] + s0 = False :: s1 + s2 = append (tail s1 |> withDefault []) [False] + + gen d0 d1 d2 = + case (d0,d1,d2) of + (False, True, True) -> True + ( True, False, True) -> True + ( True, True, False) -> True + _ -> False + + updatedHistory = map3 gen s0 s1 s2 :: model.history + updatedModel = {model | history = updatedHistory} + in (updatedModel, Cmd.none) + + +init : Int -> (Model, Cmd Msg) +init n = + let gen1 = fst (step (list n bool) (initialSeed 34)) + in ({ history = [gen1], rows = n, cols= n }, Cmd.none) + +type Msg = Tick Time + +subscriptions model = every (0.2 * second) Tick + +main = program + { init = init 40 + , view = view + , update = update + , subscriptions = subscriptions + } diff --git a/Task/One-dimensional-cellular-automata/GFA-Basic/one-dimensional-cellular-automata.gfa b/Task/One-dimensional-cellular-automata/GFA-Basic/one-dimensional-cellular-automata.gfa new file mode 100644 index 0000000000..f6de1cbffe --- /dev/null +++ b/Task/One-dimensional-cellular-automata/GFA-Basic/one-dimensional-cellular-automata.gfa @@ -0,0 +1,113 @@ +' +' One Dimensional Cellular Automaton +' +start$="01110110101010100100" +max_cycles%=20 ! give a maximum depth +' +' Global variables hold the world, with two rows +' world! is set up with 2 extra cells width, so there is a FALSE on either side +' cur% gives the row for current world, +' new% gives the row for the next world. +' +size%=LEN(start$) +DIM world!(size%+2,2) +cur%=0 +new%=1 +clock%=0 +' +@setup_world(start$) +OPENW 1 +CLEARW 1 +DO + @display_world + @update_world + EXIT IF @same_state + clock%=clock%+1 + EXIT IF clock%>max_cycles% ! safety net +LOOP +~INP(2) +CLOSEW 1 +' +' parse given string to set up initial states in world +' -- assumes world! is of correct size +' +PROCEDURE setup_world(defn$) + LOCAL i% + ' clear out the array + ARRAYFILL world!(),FALSE + ' for each 1 in string, set cell to true + FOR i%=1 TO LEN(defn$) + IF MID$(defn$,i%,1)="1" + world!(i%,0)=TRUE + ENDIF + NEXT i% + ' set references to cur and new + cur%=0 + new%=1 +RETURN +' +' Display the world +' +PROCEDURE display_world + LOCAL i% + FOR i%=1 TO size% + IF world!(i%,cur%) + PRINT "#"; + ELSE + PRINT "."; + ENDIF + NEXT i% + PRINT "" +RETURN +' +' Create new version of world +' +PROCEDURE update_world + LOCAL i% + FOR i%=1 TO size% + world!(i%,new%)=@new_state(@get_value(i%)) + NEXT i% + ' reverse cur/new + cur%=1-cur% + new%=1-new% +RETURN +' +' Test if cur/new states are the same +' +FUNCTION same_state + LOCAL i% + FOR i%=1 TO size% + IF world!(i%,cur%)<>world!(i%,new%) + RETURN FALSE + ENDIF + NEXT i% + RETURN TRUE +ENDFUNC +' +' Return new state of cell given value +' +FUNCTION new_state(value%) + SELECT value% + CASE 0,1,2,4,7 + RETURN FALSE + CASE 3,5,6 + RETURN TRUE + ENDSELECT +ENDFUNC +' +' Compute value for cell + neighbours +' +FUNCTION get_value(cell%) + LOCAL result% + result%=0 + IF world!(cell%-1,cur%) + result%=result%+4 + ENDIF + IF world!(cell%,cur%) + result%=result%+2 + ENDIF + IF world!(cell%+1,cur%) + result%=result%+1 + ENDIF + RETURN result% +ENDFUNC diff --git a/Task/One-dimensional-cellular-automata/Nim/one-dimensional-cellular-automata-1.nim b/Task/One-dimensional-cellular-automata/Nim/one-dimensional-cellular-automata-1.nim new file mode 100644 index 0000000000..ef2639f28e --- /dev/null +++ b/Task/One-dimensional-cellular-automata/Nim/one-dimensional-cellular-automata-1.nim @@ -0,0 +1,68 @@ +import math +randomize() + +type + TBoolArray = array[0..30, bool] # an array that is indexed with 0..10 + TSymbols = tuple[on: char , off: char] + +const + num_turns = 20 + symbols:TSymbols = ('#','_') + +proc `==` (x:TBoolArray,y:TBoolArray): bool = + if len(x) != len(y): + return False + for i in 0..(len(x)-1): + if x[i] != y[i]: + return False + return True + +proc count_neighbours(map:TBoolArray , tile:int):int = + result = 0 + if tile != len(map)-1 and map[tile+1]: + result += 1 + if tile != 0 and map[tile-1]: + result += 1 + +proc print_map(map:TBoolArray, symbols:TSymbols) = + for i in map: + if i: + write(stdout,symbols[0]) + else: + write(stdout,symbols[1]) + write(stdout,"\n") + +proc random_map(): TBoolArray = + var map = [False,False,False,False,False,False,False,False,False,False,False, + False,False,False,False,False,False,False,False,False,False,False, + False,False,False,False,False,False,False,False,False] + for i in 0..(len(map)-1): + map[i] = bool(random(2)) + return map + +proc fixed_map(): TBoolArray = + var map = [False,True,True,True,False,True,True,False,True,False,True, + False,True,False,True,False,False,True,False,False,False,False, + False,False,False,False,False,False,False,False,False] + return map + +#make the map +var map:TBoolArray +#map = random_map() # uncomment for random start +map = fixed_map() +print_map(map,symbols) +for i in 0..num_turns: + var new_map = map + for j in 0..(len(map)-1): + if map[j]: + if count_neighbours(map, j) == 2 or + count_neighbours(map, j) == 0: + new_map[j] = False + else: + if count_neighbours(map, j) == 2: + new_map[j] = True + if new_map == map: + print_map(map,symbols) + break + map = new_map + print_map(map,symbols) diff --git a/Task/One-dimensional-cellular-automata/Nim/one-dimensional-cellular-automata-2.nim b/Task/One-dimensional-cellular-automata/Nim/one-dimensional-cellular-automata-2.nim new file mode 100644 index 0000000000..7b502630ca --- /dev/null +++ b/Task/One-dimensional-cellular-automata/Nim/one-dimensional-cellular-automata-2.nim @@ -0,0 +1,26 @@ +const + s_init: string = "_###_##_#_#_#_#__#__" + arrLen: int = 20 + +var q0: string = s_init & repeatChar(arrLen-20,'_') +var q1: string = q0 + +proc life(s:string): char = + var str: string = s + if len(normalize(str)) == 2: # normalize eliminates underscores + return '#' + return '_' + +proc evolve(q: string): string = + result = repeatChar(arrLen,'_') + #result[0] = '_' + for i in 1 .. q.len-1: + result[i] = life(substr(q & '_',i-1,i+1)) + +echo(q1) +q1 = evolve(q0) +echo(q1) +while q1 != q0: + q0 = q1 + q1 = evolve(q0) + echo(q1) diff --git a/Task/One-dimensional-cellular-automata/Oforth/one-dimensional-cellular-automata.oforth b/Task/One-dimensional-cellular-automata/Oforth/one-dimensional-cellular-automata.oforth new file mode 100644 index 0000000000..210524e00c --- /dev/null +++ b/Task/One-dimensional-cellular-automata/Oforth/one-dimensional-cellular-automata.oforth @@ -0,0 +1,11 @@ +: nextGen(l) +| i | + StringBuffer new + l size loop: i [ + l at( i 1- ) '#' == + l at( i 1+ ) '#' == + + l at( i ) '#' == + + 2 == ifTrue: [ '#' ] else: [ '_' ] over add + ] ; + +: gen(l, n) l dup println #[ nextGen dup println ] times(n) ; diff --git a/Task/One-dimensional-cellular-automata/Phix/one-dimensional-cellular-automata-1.phix b/Task/One-dimensional-cellular-automata/Phix/one-dimensional-cellular-automata-1.phix new file mode 100644 index 0000000000..f6f468ead1 --- /dev/null +++ b/Task/One-dimensional-cellular-automata/Phix/one-dimensional-cellular-automata-1.phix @@ -0,0 +1,17 @@ +string s = "_###_##_#_#_#_#__#__" +integer prev='_', curr, toggled = 1 + +while 1 do + ?s + for i=2 to length(s)-1 do + curr = s[i] + if prev=s[i+1] + and (curr='#' or prev='#') then + s[i] = 130-curr + toggled = 1 + end if + prev = curr + end for + if not toggled then ?s exit end if + toggled = 0 +end while diff --git a/Task/One-dimensional-cellular-automata/Phix/one-dimensional-cellular-automata-2.phix b/Task/One-dimensional-cellular-automata/Phix/one-dimensional-cellular-automata-2.phix new file mode 100644 index 0000000000..e605b8cde9 --- /dev/null +++ b/Task/One-dimensional-cellular-automata/Phix/one-dimensional-cellular-automata-2.phix @@ -0,0 +1,13 @@ +string s = "________________________#________________________" +integer prev='_', curr, toggled = 1 + +for limit=1 to 24 do + ?s + for i=2 to length(s)-1 do + curr = s[i] + if (prev=s[i+1]) = (curr='#') then + s[i] = 130-curr + end if + prev = curr + end for +end for diff --git a/Task/One-dimensional-cellular-automata/Sidef/one-dimensional-cellular-automata-1.sidef b/Task/One-dimensional-cellular-automata/Sidef/one-dimensional-cellular-automata-1.sidef new file mode 100644 index 0000000000..1a9b32eb33 --- /dev/null +++ b/Task/One-dimensional-cellular-automata/Sidef/one-dimensional-cellular-automata-1.sidef @@ -0,0 +1,10 @@ +var seq = "_###_##_#_#_#_#__#__"; +var x = ''; + +loop { + seq.tr!('01', '_#'); + say seq; + seq.tr!('_#', '01'); + seq.gsub!(/(?<=(.))(.)(?=(.))/, {|s1,s2,s3| s1 == s3 ? (s1 ? 1-s2 : 0) : s2}); + (x != seq) && (x = seq) || break; +} diff --git a/Task/One-dimensional-cellular-automata/Sidef/one-dimensional-cellular-automata-2.sidef b/Task/One-dimensional-cellular-automata/Sidef/one-dimensional-cellular-automata-2.sidef new file mode 100644 index 0000000000..0b83f49a4b --- /dev/null +++ b/Task/One-dimensional-cellular-automata/Sidef/one-dimensional-cellular-automata-2.sidef @@ -0,0 +1,33 @@ +class Automaton(rule, cells) { + + method init { + rule = sprintf("%08b", rule).chars.map{.to_i}.reverse; + } + + method next { + var previous = cells.map{_}; + var len = previous.len; + cells[] = rule[ + previous.range.map { |i| + 4*previous[i-1 % len] + + 2*previous[i] + + previous[i+1 % len] + }... + ] + } + + method to_s { + cells.map { _ ? '#' : ' ' }.join; + } +} + +var size = 10; +var auto = Automaton( + rule: 104, + cells: [(size/2).of(0)..., 111011010101.digits..., (size/2).of(0)...], +); + +size.times { + say "|#{auto}|"; + auto.next; +} diff --git a/Task/One-dimensional-cellular-automata/Wart/one-dimensional-cellular-automata-1.wart b/Task/One-dimensional-cellular-automata/Wart/one-dimensional-cellular-automata-1.wart new file mode 100644 index 0000000000..5053bd3486 --- /dev/null +++ b/Task/One-dimensional-cellular-automata/Wart/one-dimensional-cellular-automata-1.wart @@ -0,0 +1,17 @@ +def (gens n l) + prn l + repeat n + zap! gen l + prn l + +def (gen l) + with (a nil b nil c l.0) + collect nil # won't insert paren without second token + each x cdr.l + shift! a b c x + yield (next a b c) + yield (next b c nil) + +def (next a b c) # next state of b given neighbors a and c + if (and a c) not.b + (or a c) b diff --git a/Task/One-dimensional-cellular-automata/Wart/one-dimensional-cellular-automata-2.wart b/Task/One-dimensional-cellular-automata/Wart/one-dimensional-cellular-automata-2.wart new file mode 100644 index 0000000000..89234b824e --- /dev/null +++ b/Task/One-dimensional-cellular-automata/Wart/one-dimensional-cellular-automata-2.wart @@ -0,0 +1,32 @@ +def (uca l) # new datatype: unidim CA + (tag uca (list l len.l)) + +def (len l) :case (isa uca l) # how to compute its length + rep.l.1 + +defcoerce uca list # converting it to list + (fn(_) rep._.0) + +def (pr l) :case (isa uca l) # how to print it + each x l # transparently coerces to a list for iterating over + pr (if x "#" "_") + +# (l i) returns ith cell when l is a uca, and nil when i is out-of-bounds +defcall uca (l i) + if (0 <= i < len.l) + rep.l.0.i + +def (gens n l) + prn l + repeat n + zap! gen l + prn l + +def (gen l) + uca+collect+for i 0 (i < len.l) ++i + yield (next (l i-1) l.i (l i+1)) + +# next state of b, given neighbors a and c +def (next a b c) + if (and a c) not.b + (or a c) b diff --git a/Task/One-dimensional-cellular-automata/jq/one-dimensional-cellular-automata-1.jq b/Task/One-dimensional-cellular-automata/jq/one-dimensional-cellular-automata-1.jq new file mode 100644 index 0000000000..69e40a777c --- /dev/null +++ b/Task/One-dimensional-cellular-automata/jq/one-dimensional-cellular-automata-1.jq @@ -0,0 +1,22 @@ +# The 1-d cellular automaton: +def next: + # Conveniently, jq treats null as 0 when it comes to addition + # so there is no need to fiddle with the boundaries + . as $old + | reduce range(0; length) as $i + ([]; + ($old[$i-1] + $old[$i+1]) as $s + | if $s == 0 then .[$i] = 0 + elif $s == 1 then .[$i] = (if $old[$i] == 1 then 1 else 0 end) + else .[$i] = (if $old[$i] == 1 then 0 else 1 end) + end); + + +# pretty-print an array: +def pp: reduce .[] as $i (""; . + (if $i == 0 then " " else "*" end)); + +# continue until quiescence: +def go: recurse(. as $prev | next | if . == $prev then empty else . end) | pp; + +# Example: +[0,1,1,1,0,1,1,0,1,0,1,0,1,0,1,0,0,1,0,0] | go diff --git a/Task/One-dimensional-cellular-automata/jq/one-dimensional-cellular-automata-2.jq b/Task/One-dimensional-cellular-automata/jq/one-dimensional-cellular-automata-2.jq new file mode 100644 index 0000000000..beef50746b --- /dev/null +++ b/Task/One-dimensional-cellular-automata/jq/one-dimensional-cellular-automata-2.jq @@ -0,0 +1,10 @@ +$ jq -c -r -n -f One-dimensional_cellular_automata.jq + *** ** * * * * * + * ***** * * * + ** ** * * + ** *** * + ** * ** + ** *** + ** * * + ** * + ** diff --git a/Task/One-of-n-lines-in-a-file/ERRE/one-of-n-lines-in-a-file.erre b/Task/One-of-n-lines-in-a-file/ERRE/one-of-n-lines-in-a-file.erre new file mode 100644 index 0000000000..1790469847 --- /dev/null +++ b/Task/One-of-n-lines-in-a-file/ERRE/one-of-n-lines-in-a-file.erre @@ -0,0 +1,23 @@ +PROGRAM ONE_OF_N + +DIM CNT[10] + +PROCEDURE ONE_OF_N(N->L) + LOCAL I + FOR I=1 TO N DO + IF RND(1)<=1.0/I THEN L=I END IF + END FOR +END PROCEDURE + +BEGIN + N=10 + RANDOMIZE(TIMER) ! init + FOR TEST=1 TO 1000000 DO + ONE_OF_N(N->L) + CNT[L]+=1 + END FOR + FOR I=1 TO N DO + PRINT(CNT[I];) + END FOR + PRINT +END PROGRAM diff --git a/Task/One-of-n-lines-in-a-file/Nim/one-of-n-lines-in-a-file.nim b/Task/One-of-n-lines-in-a-file/Nim/one-of-n-lines-in-a-file.nim new file mode 100644 index 0000000000..68c6e50716 --- /dev/null +++ b/Task/One-of-n-lines-in-a-file/Nim/one-of-n-lines-in-a-file.nim @@ -0,0 +1,16 @@ +import math +randomize() + +proc oneOfN(n: int): int = + result = 0 + for x in 0 .. 0: + for i in 1..trials: + inc result[oneOfN(n)] + +echo oneOfNTest() diff --git a/Task/One-of-n-lines-in-a-file/Phix/one-of-n-lines-in-a-file.phix b/Task/One-of-n-lines-in-a-file/Phix/one-of-n-lines-in-a-file.phix new file mode 100644 index 0000000000..789d1c8fd7 --- /dev/null +++ b/Task/One-of-n-lines-in-a-file/Phix/one-of-n-lines-in-a-file.phix @@ -0,0 +1,15 @@ +function one_of_n(integer n) +integer line_num = 1 + for i=2 to n do + if rnd()<1/i then + line_num = i + end if + end for + return line_num +end function + +sequence counts = repeat(0,10) + for i=1 to 1000000 do + counts[one_of_n(10)] += 1 + end for + ?counts diff --git a/Task/One-of-n-lines-in-a-file/Ring/one-of-n-lines-in-a-file.ring b/Task/One-of-n-lines-in-a-file/Ring/one-of-n-lines-in-a-file.ring new file mode 100644 index 0000000000..6ed3924c53 --- /dev/null +++ b/Task/One-of-n-lines-in-a-file/Ring/one-of-n-lines-in-a-file.ring @@ -0,0 +1,14 @@ +cnt = list(10) +for nr = 1 to 10000 + cnt[oneofn(10)] += 1 +next +for m = 1 to 10 + see "" + m + " : " + cnt[m] + nl +next +see nl + +func oneofn n +for i = 1 to n + if random(1) <= 1/i d = i ok +next +return d diff --git a/Task/One-of-n-lines-in-a-file/Sidef/one-of-n-lines-in-a-file.sidef b/Task/One-of-n-lines-in-a-file/Sidef/one-of-n-lines-in-a-file.sidef new file mode 100644 index 0000000000..67ccb494ab --- /dev/null +++ b/Task/One-of-n-lines-in-a-file/Sidef/one-of-n-lines-in-a-file.sidef @@ -0,0 +1,17 @@ +func one_of_n(n) { + var choice + n.times { |i| + choice = i if (1 > i.rand) + } + choice - 1 +} + +func one_of_n_test(n = 10, trials = 1_000_000) { + var bins = [] + trials.times { + bins[one_of_n(n)] := 0 ++ + } + bins +} + +say one_of_n_test() diff --git a/Task/One-of-n-lines-in-a-file/Swift/one-of-n-lines-in-a-file.swift b/Task/One-of-n-lines-in-a-file/Swift/one-of-n-lines-in-a-file.swift new file mode 100644 index 0000000000..5af9f715be --- /dev/null +++ b/Task/One-of-n-lines-in-a-file/Swift/one-of-n-lines-in-a-file.swift @@ -0,0 +1,16 @@ +func one_of_n(n: Int) -> Int { + var result = 1 + for i in 2...n { + if arc4random_uniform(UInt32(i)) < 1 { + result = i + } + } + return result +} + +var counts = [0,0,0,0,0,0,0,0,0,0] +for _ in 1..1_000_000 { + counts[one_of_n(10)-1]++ +} + +println(counts) diff --git a/Task/OpenGL/Nim/opengl.nim b/Task/OpenGL/Nim/opengl.nim new file mode 100644 index 0000000000..61c06a201e --- /dev/null +++ b/Task/OpenGL/Nim/opengl.nim @@ -0,0 +1,39 @@ +import opengl, glut + +proc paint() {.cdecl.} = + glClearColor(0.3,0.3,0.3,0.0) + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) + + glShadeModel(GL_SMOOTH) + + glLoadIdentity() + glTranslatef(-15.0, -15.0, 0.0) + + glBegin(GL_TRIANGLES) + glColor3f(1.0, 0.0, 0.0) + glVertex2f(0.0, 0.0) + glColor3f(0.0, 1.0, 0.0) + glVertex2f(30.0, 0.0) + glColor3f(0.0, 0.0, 1.0) + glVertex2f(0.0, 30.0) + glEnd() + + glFlush() + +proc reshape(width, height) {.cdecl.} = + glViewport(0, 0, width, height) + glMatrixMode(GL_PROJECTION) + glLoadIdentity() + glOrtho(-30.0, 30.0, -30.0, 30.0, -30.0, 30.0) + glMatrixMode(GL_MODELVIEW) + +enableAutoGlErrorCheck(false) +loadExtensions() +glutInit() +glutInitWindowSize(640, 480) +discard glutCreateWindow("Triangle") + +glutDisplayFunc(paint) +glutReshapeFunc(reshape) + +glutMainLoop() diff --git a/Task/OpenGL/Phix/opengl-1.phix b/Task/OpenGL/Phix/opengl-1.phix new file mode 100644 index 0000000000..840753a22d --- /dev/null +++ b/Task/OpenGL/Phix/opengl-1.phix @@ -0,0 +1,35 @@ +include demo\Arwen32dibdemo\a32dpoly.ew + +a32Dib0 screen_dib = 0 +integer dx = 0, dy = 0, dw = 0, dh = 0 + +constant win = create(Window, "Arwen32Dib bitmap shaded triangle demo", 0, 0, Default, Default, 480, 300, 0) + +function winHandler(integer id, integer msg, atom wParam, object lParam) +sequence rect + if id or object(lParam) then end if -- suppress warnings + if msg=WM_PAINT then + if sequence(screen_dib) then + clearDib(screen_dib, {0, 0, 0}) + drawShadedPolygonToDib(screen_dib, {{dx, dy}, {dx, dh-dy}, {dw-dx, dh-dy}}, {{255, 0, 0}, {0, 0, 255}, {0, 255, 0}}) + drawDib(win, screen_dib, 0, 0, 0, 0, screen_dib[DibWidth]-1, screen_dib[DibHeight]-1) + end if + elsif msg=WM_SIZE then + rect = getClientRect(win) + dw = rect[3] + dh = rect[4] + dx = floor(dw/4)+1 + dy = floor(dh/4)+1 + if sequence(screen_dib) then killDib(screen_dib) end if + screen_dib = newDib(dw, dh) + elsif msg=WM_CHAR + and wParam=VK_ESCAPE then + closeWindow(win) + end if + return 0 +end function +setHandler(win, routine_id("winHandler")) + +WinMain(win, SW_NORMAL) + +if sequence(screen_dib) then killDib(screen_dib) end if diff --git a/Task/OpenGL/Phix/opengl-2.phix b/Task/OpenGL/Phix/opengl-2.phix new file mode 100644 index 0000000000..5cafa85f20 --- /dev/null +++ b/Task/OpenGL/Phix/opengl-2.phix @@ -0,0 +1,57 @@ +include pGUI.e +include opengl.e + +function resize_cb(Ihandle /*ih*/, integer width, integer height) + glViewport(0, 0, width, height) + glMatrixMode(GL_PROJECTION) + glLoadIdentity() + glOrtho(-30.0, 30.0, -30.0, 30.0, -30.0, 30.0) + glMatrixMode(GL_MODELVIEW) + return IUP_DEFAULT +end function + +function action(Ihandle /*ih*/) + + glClearColor(0.3,0.3,0.3,0.0) + glClear(GL_COLOR_BUFFER_BIT+GL_DEPTH_BUFFER_BIT) + + glShadeModel(GL_SMOOTH) + + glLoadIdentity() + glTranslate(-15.0, -15.0, 0.0) + + glBegin(GL_TRIANGLES) + glColor(1.0, 0.0, 0.0) + glVertex(0.0, 0.0) + glColor(0.0, 1.0, 0.0) + glVertex(30.0, 0.0) + glColor(0.0, 0.0, 1.0) + glVertex(0.0, 30.0) + glEnd() + + glFlush() + + return IUP_DEFAULT +end function + +Ihandle dialog, canvas + +function map_cb(Ihandle /*ih*/) + IupGLMakeCurrent(canvas) + integer {width, height} = IupGetIntInt(dialog, "RASTERSIZE") + {} = resize_cb(dialog, width, height) + return IUP_DEFAULT +end function + +IupOpen() +IupGLCanvasOpen() + +canvas = IupGLCanvas(Icallback("action"), "RASTERSIZE=640x480") +IupSetCallback(canvas, "RESIZE_CB", Icallback("resize_cb")) + +dialog = IupDialog(canvas, "MAP_CB", Icallback("map_cb"), "TITLE=Triangle, SHRINK=YES") + +IupShow(dialog) +IupMainLoop() +IupDestroy(dialog) +IupClose() diff --git a/Task/Operator-precedence/Ring/operator-precedence.ring b/Task/Operator-precedence/Ring/operator-precedence.ring new file mode 100644 index 0000000000..6aa714e0e0 --- /dev/null +++ b/Task/Operator-precedence/Ring/operator-precedence.ring @@ -0,0 +1,21 @@ +The next table present operators from higher precedence (Evaluated first) to lower precedence. + +Operator +. [] () {} +- ~ :Literal [list items] +++ - - +Start:End +* / % ++ - +<< >> +& +| ^ +< > <= >= += != +not +and or +Assignment = += -= *= /= %=>>= <<= &= ^= |= + +Example: + +See 3+5*4 # prints 23 diff --git a/Task/Operator-precedence/Sidef/operator-precedence.sidef b/Task/Operator-precedence/Sidef/operator-precedence.sidef new file mode 100644 index 0000000000..aba64718ba --- /dev/null +++ b/Task/Operator-precedence/Sidef/operator-precedence.sidef @@ -0,0 +1 @@ +1+2 * 3+4 # means: (1+2) * (3+4) diff --git a/Task/Optional-parameters/Lasso/optional-parameters.lasso b/Task/Optional-parameters/Lasso/optional-parameters.lasso new file mode 100644 index 0000000000..b70d9e8e11 --- /dev/null +++ b/Task/Optional-parameters/Lasso/optional-parameters.lasso @@ -0,0 +1,33 @@ +define sortarray( // params are set by position + items::array, // required param + ordering::string = 'lexicographic', // optional param + column::integer = 1, + reverse::boolean = false +) => { + // sorting process + local(sorteditems = array) + // Lasso has no build in method to sort an array of arrays by position in the contained arrays + // But a method could be built for it + return #sorteditems +} + +define sortarray( + -items::array, // required param + -ordering::string = 'lexicographic', // optional param + -column::integer = 1, + -reverse::boolean = false +) => sortarray(#items, #ordering, #column, #reverse) + +local(items = array( + array(10, 'red', 'Volvo'), + array(15, 'gren', 'Ford'), + array(48, 'yellow', 'Kia'), + array(12, 'black', 'Holden'), + array(19, 'brown', 'Fiat'), + array(8, 'pink', 'Batmobile'), + array(74, 'orange', 'Bicycle') +)) + +sortarray(-items = #items, -reverse) + +sortarray(#items) diff --git a/Task/Optional-parameters/Nim/optional-parameters.nim b/Task/Optional-parameters/Nim/optional-parameters.nim new file mode 100644 index 0000000000..0b1cdc7fa2 --- /dev/null +++ b/Task/Optional-parameters/Nim/optional-parameters.nim @@ -0,0 +1,22 @@ +import algorithm, strutils, future + +proc printTable(a) = + for row in a: + for x in row: stdout.write x, repeatChar(4 - x.len) + echo "" + echo "" + +proc sortTable(a: seq[seq[string]], column = 0, reverse = false, + ordering: (proc(a,b: string): int) = system.cmp) : seq[seq[string]] = + let order = if reverse: Descending else: Ascending + result = a + result.sort(proc(x,y:seq[string]):int = ordering(x[column],y[column]), order) + +const data = @[@["a", "b", "c"], @["", "q", "z"], @["zap", "zip", "Zot"]] + +printTable data +printTable sortTable(data) +printTable sortTable(data, column = 2) +printTable sortTable(data, column = 1) +printTable sortTable(data, column = 1, reverse = true) +printTable sortTable(data, ordering = (a,b) => cmp[int](b.len,a.len)) diff --git a/Task/Optional-parameters/Phix/optional-parameters-1.phix b/Task/Optional-parameters/Phix/optional-parameters-1.phix new file mode 100644 index 0000000000..381f45d105 --- /dev/null +++ b/Task/Optional-parameters/Phix/optional-parameters-1.phix @@ -0,0 +1,6 @@ +function increment(integer i, integer inc=1) + return i+inc +end function + +?increment(5) -- shows 6 +?increment(5,2) -- shows 7 diff --git a/Task/Optional-parameters/Phix/optional-parameters-2.phix b/Task/Optional-parameters/Phix/optional-parameters-2.phix new file mode 100644 index 0000000000..98813cf925 --- /dev/null +++ b/Task/Optional-parameters/Phix/optional-parameters-2.phix @@ -0,0 +1 @@ +printf(1,"%d records sorted in %3.2s\n",{records,time()-t0}) diff --git a/Task/Optional-parameters/Phix/optional-parameters-3.phix b/Task/Optional-parameters/Phix/optional-parameters-3.phix new file mode 100644 index 0000000000..4975fad31f --- /dev/null +++ b/Task/Optional-parameters/Phix/optional-parameters-3.phix @@ -0,0 +1,22 @@ +integer sortcol = 0 +integer sortdir = 1 + +function by_column(integer i, integer j) + return sortdir*compare(data[i][sortcol],data[j][sortcol]) +end function + +sequence tags = tagset(table_size) -- {1,2,..table_size} + +function click_cb(Ihandle self, integer l, integer c, atom pStatus) +string sortc +... + sortc = sprintf("SORTSIGN%d",c) + sortdir = iff(IupGetAttribute(self,sortc)="DOWN"?-1:1) + IupSetAttribute(self,sortc,iff(sortdir=-1?"UP":"DOWN")) + sortcol = c + tags = custom_sort(routine_id("by_column"),tags) + +function value_cb(Ihandle /*self*/, integer l, integer c) + l = tags[l] + return data[l][c] +end function diff --git a/Task/Optional-parameters/Sidef/optional-parameters-1.sidef b/Task/Optional-parameters/Sidef/optional-parameters-1.sidef new file mode 100644 index 0000000000..aa61f7b121 --- /dev/null +++ b/Task/Optional-parameters/Sidef/optional-parameters-1.sidef @@ -0,0 +1,16 @@ +func table_sort(table, ordering: '<=>', column: 0, reverse: false) { + if (reverse) { + table.sort {|a,b| b[column].$ordering(a[column])} + } else { + table.sort {|a,b| a[column].$ordering(b[column])} + } +} + +# Quick example: +var table = [ + ["Ottowa", "Canada"], + ["Washington", "USA"], + ["Mexico City", "Mexico"], +]; + +say table_sort(table, column: 1); diff --git a/Task/Optional-parameters/Sidef/optional-parameters-2.sidef b/Task/Optional-parameters/Sidef/optional-parameters-2.sidef new file mode 100644 index 0000000000..40fd56586e --- /dev/null +++ b/Task/Optional-parameters/Sidef/optional-parameters-2.sidef @@ -0,0 +1,9 @@ +class String { + method my_sort(arg) { + (self.len <=> arg.len) -> + || (self.lc <=> arg.lc) -> + || (self <=> arg) + } +} + +say table_sort(table, column: 1, ordering: 'my_sort'); diff --git a/Task/Optional-parameters/Swift/optional-parameters.swift b/Task/Optional-parameters/Swift/optional-parameters.swift new file mode 100644 index 0000000000..152cc670cf --- /dev/null +++ b/Task/Optional-parameters/Swift/optional-parameters.swift @@ -0,0 +1,5 @@ +enum SortOrder { case kOrdNone, kOrdLex, kOrdByAddress, kOrdNumeric } + +func sortTable(table: [[String]], less: (String,String)->Bool = (<), column: Int = 0, reversed: Bool = false) { + // . . . Actual sort goes here . . . +} diff --git a/Task/Optional-parameters/jq/optional-parameters-1.jq b/Task/Optional-parameters/jq/optional-parameters-1.jq new file mode 100644 index 0000000000..c7ca12d912 --- /dev/null +++ b/Task/Optional-parameters/jq/optional-parameters-1.jq @@ -0,0 +1,3 @@ +def bar: 2 *.; + +def foo: {"a": bar}; diff --git a/Task/Optional-parameters/jq/optional-parameters-2.jq b/Task/Optional-parameters/jq/optional-parameters-2.jq new file mode 100644 index 0000000000..c717685aee --- /dev/null +++ b/Task/Optional-parameters/jq/optional-parameters-2.jq @@ -0,0 +1 @@ +def less_than_or_equal: .[0] <= .[1]; diff --git a/Task/Optional-parameters/jq/optional-parameters-3.jq b/Task/Optional-parameters/jq/optional-parameters-3.jq new file mode 100644 index 0000000000..57f08502c4 --- /dev/null +++ b/Task/Optional-parameters/jq/optional-parameters-3.jq @@ -0,0 +1,9 @@ +def sorter(options): + sort_table( if (options|has("ordering")) then options.ordering + else less_than_or_equal + end; + options.column or 0; + options.reverse or false ); + +# If jq > 1.4 is being used, we may also define: +def sorter: sorter({}); diff --git a/Task/Optional-parameters/jq/optional-parameters-4.jq b/Task/Optional-parameters/jq/optional-parameters-4.jq new file mode 100644 index 0000000000..f494951b7c --- /dev/null +++ b/Task/Optional-parameters/jq/optional-parameters-4.jq @@ -0,0 +1,6 @@ +[1,2] | sorter({ "reverse": true, "ordering": less_than_or_equal } ) + +[1,2] | sorter({ "reverse": true }) + +# If sorter/0 has also been defined: +[1,2] | sorter diff --git a/Task/Order-disjoint-list-items/EchoLisp/order-disjoint-list-items.echolisp b/Task/Order-disjoint-list-items/EchoLisp/order-disjoint-list-items.echolisp new file mode 100644 index 0000000000..1c9dc0cca7 --- /dev/null +++ b/Task/Order-disjoint-list-items/EchoLisp/order-disjoint-list-items.echolisp @@ -0,0 +1,30 @@ +(lib 'list) ;; for list-delete + +(define dataM +'((the cat sat on the mat) +(the cat sat on the mat) +(A B C A B C A B C) +(A B C A B D A B E) +(A B) +(A B) +(A B B A))) + +(define orderM +'((mat cat) +(cat mat) +(C A C A) +(E A D A) +(B) +(B A) +(B A))) + +(define (order-disjoint M N) +(define R (append N null)) ;; tmp copy of N : delete w when used + (for/list [(w M)] + (if + (not (member w R)) w ;; output as is + (begin0 + (first N) ;; replacer + (set! N (rest N)) + (set! R (list-delete R w)))))) + diff --git a/Task/Order-disjoint-list-items/Phix/order-disjoint-list-items.phix b/Task/Order-disjoint-list-items/Phix/order-disjoint-list-items.phix new file mode 100644 index 0000000000..80c89bc4e8 --- /dev/null +++ b/Task/Order-disjoint-list-items/Phix/order-disjoint-list-items.phix @@ -0,0 +1,45 @@ +function order_disjoint(sequence m, sequence n) +integer rlen = length(n) +sequence rdis = repeat(0,rlen) + for i=1 to rlen do + object e = n[i] + integer j = find(e,m) + while j!=0 and find(j,rdis) do + j = find(e,m,j+1) + end while + rdis[i] = j + end for + rdis = sort(rdis) + while rlen and rdis[1]=0 do + rdis = rdis[2..$] + rlen -= 1 + end while + for i=1 to rlen do + m[rdis[i]]=n[i] + end for + return join(m) +end function + +sequence tests = {{"the cat sat on the mat","mat cat"}, + {"the cat sat on the mat","cat mat"}, + {"A B C A B C A B C","C A C A"}, + {"A B C A B D A B E","E A D A"}, + {"A B","B"}, + {"A B","B A"}, + {"A B B A","B A"}, + {"",""}, + {"A","A"}, + {"A B",""}, + {"A B B A","A B"}, + {"A B A B","A B"}, + {"A B A B","B A B A"}, + {"A B C C B A","A C A C"}, + {"A B C C B A","C A C A"}, + {"A X","Y A"}, + {"A X","Y A X"}, + {"A X","Y X A"}} + +for i=1 to length(tests) do + string {m,n} = tests[i] + printf(1,"\"%s\",\"%s\" => \"%s\"\n",{m,n,order_disjoint(split(m),split(n))}) +end for diff --git a/Task/Order-disjoint-list-items/Sidef/order-disjoint-list-items.sidef b/Task/Order-disjoint-list-items/Sidef/order-disjoint-list-items.sidef new file mode 100644 index 0000000000..34f7e040a7 --- /dev/null +++ b/Task/Order-disjoint-list-items/Sidef/order-disjoint-list-items.sidef @@ -0,0 +1,18 @@ +func dsort(m, n) { + var h = Hash() + n.each {|item| h{item} := 0 ++ } + m.map {|item| h{item} := 0 -- > 0 ? n.shift : item} +} + +<<'EOT'.lines.each { |line| + the cat sat on the mat | mat cat + the cat sat on the mat | cat mat + A B C A B C A B C | C A C A + A B C A B D A B E | E A D A + A B | B + A B | B A + A B B A | B A +EOT + var (a, b) = line.split('|').map{.words}... + say "#{a.to_s} | #{b.to_s} -> #{dsort(a.clone, b.clone).to_s}" +} diff --git a/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-1.jq b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-1.jq new file mode 100644 index 0000000000..139311b401 --- /dev/null +++ b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-1.jq @@ -0,0 +1,15 @@ +def disjoint_order(N): + # The helper function, indices, ensures that successive occurrences + # of a particular value in N are matched by successive occurrences + # in the input on the assumption that null is not initially in the input. + def indices: + . as $in + | reduce range(0; N|length) as $i + # state: [ array, indices ] + ( [$in, []]; + (.[0] | index(N[$i])) as $ix | .[0][$ix] = null | .[1] += [$ix]) + | .[1]; + + . as $in + | (indices | sort) as $sorted + | reduce range(0; N|length) as $i ($in; .[$sorted[$i]] = N[$i] ) ; diff --git a/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-2.jq b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-2.jq new file mode 100644 index 0000000000..5998246b3b --- /dev/null +++ b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-2.jq @@ -0,0 +1,2 @@ +["the", "cat", "sat", "on", "the", "mat"] | indices( ["mat", "cat"] ) +#=> ["the","mat","sat","on","the","cat"] diff --git a/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-3.jq b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-3.jq new file mode 100644 index 0000000000..49f9d3b027 --- /dev/null +++ b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-3.jq @@ -0,0 +1,2 @@ +["the", "cat", "sat", "on", "the", "mat"] | disjoint_order( ["cat", "mat"] ) +#=> ["the","cat","sat","on","the","mat"] diff --git a/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-4.jq b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-4.jq new file mode 100644 index 0000000000..b46bec4543 --- /dev/null +++ b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-4.jq @@ -0,0 +1,2 @@ +["A", "B", "C", "A", "B", "C", "A", "B", "C"] | disjoint_order( ["C", "A", "C", "A"] ) +#=> ["C","B","A","C","B","A","A","B","C"] diff --git a/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-5.jq b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-5.jq new file mode 100644 index 0000000000..eb81081fbb --- /dev/null +++ b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-5.jq @@ -0,0 +1,2 @@ +["A", "B", "C", "A", "B", "D", "A", "B", "E"] | disjoint_order( ["E", "A", "D", "A"] ) +#=> ["E","B","C","A","B","D","A","B","A"] diff --git a/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-6.jq b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-6.jq new file mode 100644 index 0000000000..a9f19b1f55 --- /dev/null +++ b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-6.jq @@ -0,0 +1,2 @@ +["A", "B"] | disjoint_order( ["B"] ) +#=> ["A","B"] diff --git a/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-7.jq b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-7.jq new file mode 100644 index 0000000000..bba8f546af --- /dev/null +++ b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-7.jq @@ -0,0 +1,2 @@ +["A", "B"] | disjoint_order( ["B", "A"] ) +#=> ["B","A"] diff --git a/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-8.jq b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-8.jq new file mode 100644 index 0000000000..02b104d1a5 --- /dev/null +++ b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-8.jq @@ -0,0 +1,2 @@ +["A", "B", "B", "A"] | disjoint_order( ["B", "A"] ) +#=> ["B","A","B","A"] diff --git a/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-9.jq b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-9.jq new file mode 100644 index 0000000000..f3505d06f1 --- /dev/null +++ b/Task/Order-disjoint-list-items/jq/order-disjoint-list-items-9.jq @@ -0,0 +1,2 @@ +["X", "X", "Y"] | disjoint_order(["X"]) +#=> [X, X, Y] diff --git a/Task/Order-two-numerical-lists/Lasso/order-two-numerical-lists.lasso b/Task/Order-two-numerical-lists/Lasso/order-two-numerical-lists.lasso new file mode 100644 index 0000000000..e68766b28e --- /dev/null +++ b/Task/Order-two-numerical-lists/Lasso/order-two-numerical-lists.lasso @@ -0,0 +1,11 @@ +local( + first = array(1,2,1,3,2), + second = array(1,2,0,4,4,0,0,0), +) +#first < #second + +local( + first = array(1,1,1,3,2), + second = array(1,2,0,4,4,0,0,0), +) +#first < #second diff --git a/Task/Order-two-numerical-lists/Nim/order-two-numerical-lists.nim b/Task/Order-two-numerical-lists/Nim/order-two-numerical-lists.nim new file mode 100644 index 0000000000..061c855e96 --- /dev/null +++ b/Task/Order-two-numerical-lists/Nim/order-two-numerical-lists.nim @@ -0,0 +1,7 @@ +proc `<`[T](a, b: openarray[T]): bool = + for i in 0 .. min(a.len, b.len): + if a[i] < b[i]: return true + if a[i] > b[i]: return false + return a.len < b.len + +echo([1,2,1,3,2] < [1,2,0,4,4,0,0,0]) diff --git a/Task/Order-two-numerical-lists/Ring/order-two-numerical-lists.ring b/Task/Order-two-numerical-lists/Ring/order-two-numerical-lists.ring new file mode 100644 index 0000000000..44c434aca1 --- /dev/null +++ b/Task/Order-two-numerical-lists/Ring/order-two-numerical-lists.ring @@ -0,0 +1,19 @@ +list1 = "1, 2, 1, 5, 2" +list2 = "5, 2, 1, 5, 2, 2" +list3 = "1, 2, 3, 4, 5" +list4 = "1, 2, 3, 4, 5" + +if order(list1, list2) = 0 see "list1=list2" + nl +but order(list1, list2) < 0 see "list1list2" + nl ok + +if order(list2, list3) = 0 see "list2=list3" + nl +but order(list2, list3) < 0 see "list2list3" + nl ok + +if order(list3, list4) = 0 see "list3=list4" + nl +but order(list3, list4) < 0 see "list3list4" + nl ok + +func order alist, blist + return strcmp(alist, blist) diff --git a/Task/Order-two-numerical-lists/Sidef/order-two-numerical-lists.sidef b/Task/Order-two-numerical-lists/Sidef/order-two-numerical-lists.sidef new file mode 100644 index 0000000000..92db987de0 --- /dev/null +++ b/Task/Order-two-numerical-lists/Sidef/order-two-numerical-lists.sidef @@ -0,0 +1,14 @@ +func ordered(a, b) { + (a <=> b) < 0 +} + +for p in [ + Pair([1,2,4], [1,2,4]), + Pair([1,2,4], [1,2] ), + Pair([1,2], [1,2,4]), +] { + var a = p.first + var b = p.second + var before = ordered(a, b) + say "#{a} comes before #{b} : #{before}" +} diff --git a/Task/Order-two-numerical-lists/Swift/order-two-numerical-lists.swift b/Task/Order-two-numerical-lists/Swift/order-two-numerical-lists.swift new file mode 100644 index 0000000000..03cc33824c --- /dev/null +++ b/Task/Order-two-numerical-lists/Swift/order-two-numerical-lists.swift @@ -0,0 +1,3 @@ +let a = [1,2,1,3,2] +let b = [1,2,0,4,4,0,0,0] +println(lexicographicalCompare(a, b)) // this is "less than" diff --git a/Task/Order-two-numerical-lists/Wart/order-two-numerical-lists.wart b/Task/Order-two-numerical-lists/Wart/order-two-numerical-lists.wart new file mode 100644 index 0000000000..0fc91454a9 --- /dev/null +++ b/Task/Order-two-numerical-lists/Wart/order-two-numerical-lists.wart @@ -0,0 +1,9 @@ +def (a < b) :case (or list?.a list?.b) + if not.b + nil + not.a + b + (car.a = car.b) + (cdr.a < cdr.b) + :else + (car.a < car.b) diff --git a/Task/Order-two-numerical-lists/jq/order-two-numerical-lists.jq b/Task/Order-two-numerical-lists/jq/order-two-numerical-lists.jq new file mode 100644 index 0000000000..aefffd1b6a --- /dev/null +++ b/Task/Order-two-numerical-lists/jq/order-two-numerical-lists.jq @@ -0,0 +1,3 @@ +[1,2,3] < [1,2,3,4] # => true +[1,2,3] < [1,2,4] # => true +[1,2,3] < [1,2,3] # => false diff --git a/Task/Ordered-Partitions/EchoLisp/ordered-partitions.echolisp b/Task/Ordered-Partitions/EchoLisp/ordered-partitions.echolisp new file mode 100644 index 0000000000..7fab9855eb --- /dev/null +++ b/Task/Ordered-Partitions/EchoLisp/ordered-partitions.echolisp @@ -0,0 +1,25 @@ +(lib 'list) ;; (combinations L k) + +;; add a combination to each partition in ps +(define (pproduct c ps) (for/list ((x ps)) (cons c x))) + +;; apply to any type of set S +;; ns is list of cardinals for each partition +;; for all combinations Ci of n objects from S +;; set S <- LS minus Ci , set n <- next n , and recurse + +(define (_partitions S ns ) + (cond + ([empty? (rest ns)] (list (combinations S (first ns)))) + (else + (for/fold (parts null) + ([c (combinations S (first ns))]) + (append + parts + (pproduct c (_partitions (set-substract S c) (rest ns)))))))) + +;; task : S = ( 0 , 1 ... n-1) args = ns +(define (partitions . args) + (for-each + writeln + (_partitions (range 1 (1+ (apply + args))) args ))) diff --git a/Task/Ordered-Partitions/Sidef/ordered-partitions.sidef b/Task/Ordered-Partitions/Sidef/ordered-partitions.sidef new file mode 100644 index 0000000000..bc2aaf64a2 --- /dev/null +++ b/Task/Ordered-Partitions/Sidef/ordered-partitions.sidef @@ -0,0 +1,20 @@ +func part(_, {.is_empty}) { [[]] } +func partitions({.is_empty}) { [[]] } + +func part(s, args) { + gather { + s.combinations(args[0], { |c| + part(s - c, args.ft(1)).each{|r| take([c] + r) } + }) + } +} + +func partitions(args) { + part(@(1..args.sum), args) +} + +[[],[0,0,0],[1,1,1],[2,0,2]].each { |test_case| + say "partitions #{test_case}:" + partitions(test_case).each{|part| say part } + print "\n" +} diff --git a/Task/Ordered-Partitions/jq/ordered-partitions-1.jq b/Task/Ordered-Partitions/jq/ordered-partitions-1.jq new file mode 100644 index 0000000000..877e832b9e --- /dev/null +++ b/Task/Ordered-Partitions/jq/ordered-partitions-1.jq @@ -0,0 +1,20 @@ +# Generate a stream of the distinct combinations of r items taken from the input array. +def combination(r): + if r > length or r < 0 then empty + elif r == length then . + else ( [.[0]] + (.[1:]|combination(r-1))), + ( .[1:]|combination(r)) + end; + +# Input: a mask, that is, an array of lengths. +# Output: a stream of the distinct partitions defined by the mask. +def partition: + + # partition an array of entities, s, according to a mask presented as input: + def p(s): + if length == 0 then [] + else . as $mask + | (s | combination($mask[0])) as $c + | [$c] + ($mask[1:] | p(s - $c)) + end; + . as $mask | p( [range(1; 1 + ($mask|add))] ); diff --git a/Task/Ordered-Partitions/jq/ordered-partitions-2.jq b/Task/Ordered-Partitions/jq/ordered-partitions-2.jq new file mode 100644 index 0000000000..7bb0556d5a --- /dev/null +++ b/Task/Ordered-Partitions/jq/ordered-partitions-2.jq @@ -0,0 +1,3 @@ +([],[0,0,0],[1,1,1],[2,0,2]) + | . as $test_case + | "partitions \($test_case):" , ($test_case | partition), "" diff --git a/Task/Ordered-Partitions/jq/ordered-partitions-3.jq b/Task/Ordered-Partitions/jq/ordered-partitions-3.jq new file mode 100644 index 0000000000..07a447670e --- /dev/null +++ b/Task/Ordered-Partitions/jq/ordered-partitions-3.jq @@ -0,0 +1,23 @@ +$ jq -M -n -c -r -f Ordered_partitions.jq + +partitions []: +[] + +partitions [0,0,0]: +[[],[],[]] + +partitions [1,1,1]: +[[1],[2],[3]] +[[1],[3],[2]] +[[2],[1],[3]] +[[2],[3],[1]] +[[3],[1],[2]] +[[3],[2],[1]] + +partitions [2,0,2]: +[[1,2],[],[3,4]] +[[1,3],[],[2,4]] +[[1,4],[],[2,3]] +[[2,3],[],[1,4]] +[[2,4],[],[1,3]] +[[3,4],[],[1,2]] diff --git a/Task/Ordered-words/EchoLisp/ordered-words.echolisp b/Task/Ordered-words/EchoLisp/ordered-words.echolisp new file mode 100644 index 0000000000..c9418930d4 --- /dev/null +++ b/Task/Ordered-words/EchoLisp/ordered-words.echolisp @@ -0,0 +1,26 @@ +(define (ordered? str) + (for/and ([i (in-range 1 (string-length str))]) + (string-ci<=? (string-ref str (1- i)) (string-ref str i)))) + +(define (ordre words) +(define wl 0) +(define s 's) + (for/fold (len 0) ((w words)) + (set! wl (string-length w)) + #:continue (< wl len) + #:when (ordered? w) + #:continue (and (= len wl) (push s w)) + (push (stack s) w) ;; start a new list of length wl + wl) + (stack->list s)) + +;; output +(load 'unixdict) +(ordre (text-parse unixdict)) + → (abbott accent accept access accost almost bellow billow biopsy chilly choosy choppy effort floppy glossy knotty) + +;; with the dictionaries provided with EchoLisp +;; french + → (accentué) ;; ordered, longest, and ... self-reference +;; english + → (Adelops alloquy beefily begorry billowy egilops) diff --git a/Task/Ordered-words/FreeBASIC/ordered-words.freebasic b/Task/Ordered-words/FreeBASIC/ordered-words.freebasic new file mode 100644 index 0000000000..75ee04f919 --- /dev/null +++ b/Task/Ordered-words/FreeBASIC/ordered-words.freebasic @@ -0,0 +1,42 @@ +' FB 1.05.0 Win64 + +Function isOrdered(s As Const String) As Boolean + If Len(s) <= 1 Then Return True + For i As Integer = 1 To Len(s) - 1 + If s[i] < s[i - 1] Then Return False + Next + Return True +End Function + +Dim words() As String +Dim word As String +Dim maxLength As Integer = 0 +Dim count As Integer = 0 +Open "undict.txt" For Input As #1 +While Not Eof(1) + Line Input #1, word + If isOrdered(word) Then + If Len(word) = maxLength Then + Redim Preserve words(0 To count) + words(count) = word + count += 1 + ElseIf Len(word) > maxLength Then + Erase words + maxLength = Len(word) + Redim words(0 To 0) + words(0) = word + count = 1 + End If + End If +Wend + +Close #1 + +Print "The ordered words with the longest length ("; Str(maxLength); ") in undict.txt are :" +Print +For i As Integer = 0 To UBound(words) + Print words(i) +Next +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Ordered-words/Lasso/ordered-words.lasso b/Task/Ordered-words/Lasso/ordered-words.lasso new file mode 100644 index 0000000000..a8ddd5e803 --- /dev/null +++ b/Task/Ordered-words/Lasso/ordered-words.lasso @@ -0,0 +1,18 @@ +local(f = file('unixdict.txt'), words = array, ordered = array, maxleng = 0) +#f->dowithclose => { + #f->foreachLine => { + #words->insert(#1) + } +} +with w in #words +do => { + local(tosort = #w->asString->values) + #tosort->sort + if(#w->asString == #tosort->join('')) => { + #ordered->insert(#w->asString) + #w->asString->size > #maxleng ? #maxleng = #w->asString->size + } +} +with w in #ordered +where #w->size == #maxleng +do => {^ #w + '\r' ^} diff --git a/Task/Ordered-words/Lingo/ordered-words.lingo b/Task/Ordered-words/Lingo/ordered-words.lingo new file mode 100644 index 0000000000..9cab6f6e74 --- /dev/null +++ b/Task/Ordered-words/Lingo/ordered-words.lingo @@ -0,0 +1,27 @@ +-- Contents of unixdict.txt passed as string +on printLongestOrderedWords (words) + res = [] + maxlen = 0 + _player.itemDelimiter = numtochar(10) + cnt = words.item.count + repeat with i = 1 to cnt + w = words.item[i] + len = w.length + ordered = TRUE + repeat with j = 2 to len + if chartonum(w.char[j-1])>chartonum(w.char[j]) then + ordered = FALSE + exit repeat + end if + end repeat + if ordered then + if len > maxlen then + res = [w] + maxlen = len + else if len = maxlen then + res.add(w) + end if + end if + end repeat + put res +end diff --git a/Task/Ordered-words/Nim/ordered-words.nim b/Task/Ordered-words/Nim/ordered-words.nim new file mode 100644 index 0000000000..252e2721ae --- /dev/null +++ b/Task/Ordered-words/Nim/ordered-words.nim @@ -0,0 +1,21 @@ +import httpclient, strutils + +proc isSorted(s): bool = + var last = low(char) + for c in s: + if c < last: + return false + last = c + return true + +const url = "http://www.puzzlers.org/pub/wordlists/unixdict.txt" +var mx = 0 +var words: seq[string] = @[] + +for word in getContent(url).split(): + if word.len >= mx and isSorted(word): + if word.len > mx: + words = @[] + mx = word.len + words.add(word) +echo words.join(" ") diff --git a/Task/Ordered-words/Oforth/ordered-words.oforth b/Task/Ordered-words/Oforth/ordered-words.oforth new file mode 100644 index 0000000000..cffa2afa43 --- /dev/null +++ b/Task/Ordered-words/Oforth/ordered-words.oforth @@ -0,0 +1,9 @@ +: longWords +| w longest l s | + 0 ->longest + File new("unixdict.txt") forEach: w [ + w size dup ->s longest < ifTrue: [ continue ] + w sort w == ifFalse: [ continue ] + s longest > ifTrue: [ s ->longest ListBuffer new ->l ] + l add(w) + ] l ; diff --git a/Task/Ordered-words/Phix/ordered-words.phix b/Task/Ordered-words/Phix/ordered-words.phix new file mode 100644 index 0000000000..87597209cd --- /dev/null +++ b/Task/Ordered-words/Phix/ordered-words.phix @@ -0,0 +1,34 @@ +type ordered(sequence s) + for i=1 to length(s)-1 do + -- assume all items in the sequence are atoms + if s[i]>s[i+1] then + return 0 + end if + end for + return 1 +end type + +integer maxlen +sequence words +object word +constant fn = open("demo\\unixdict.txt","r") +maxlen = -1 + +while 1 do + word = gets(fn) + if atom(word) then + exit + end if + word = trim(word) + if length(word)>=maxlen and ordered(lower(word)) then + if length(word)>maxlen then + maxlen = length(word) + words = {} + end if + words = append(words,word) + end if +end while + +close(fn) + +?words diff --git a/Task/Ordered-words/Ring/ordered-words.ring b/Task/Ordered-words/Ring/ordered-words.ring new file mode 100644 index 0000000000..4b695df85c --- /dev/null +++ b/Task/Ordered-words/Ring/ordered-words.ring @@ -0,0 +1,37 @@ +fn = "C:\Ring\unixdict.txt" + +fp = fopen(fn,"r") +str = fread(fp, getFileSize(fp)) +str = substr(str, windowsnl(), nl) +clist = str2list(str) +fclose(fp) +dlist = [] + +for m = 1 to len(clist) + flag = 1 + for n = 1 to len(clist[m])-1 + if ascii(clist[m][n+1]) < ascii(clist[m][n]) + flag=0 exit ok + next + if flag = 1 + add(dlist, clist[m]) ok +next + +nr = 0 +for m = 1 to len(dlist) + if len(dlist[m]) > nr + nr = len(dlist[m]) ok +next + +for n = 1 to len(dlist) + if len(dlist[n]) = nr + see dlist[n] + nl ok +next + +func getFileSize fp + c_filestart = 0 + c_fileend = 2 + fseek(fp,0,c_fileend) + nfilesize = ftell(fp) + fseek(fp,0,c_filestart) + return nfilesize diff --git a/Task/Ordered-words/Sidef/ordered-words.sidef b/Task/Ordered-words/Sidef/ordered-words.sidef new file mode 100644 index 0000000000..8a786eb690 --- /dev/null +++ b/Task/Ordered-words/Sidef/ordered-words.sidef @@ -0,0 +1,14 @@ +var words = [[]] +var file = %f'unixdict.txt' + +file.open_r(\var fh, \var err) -> + || die "Can't open file #{file}: $#{err}" + +fh.each { |line| + line.trim! + if (line == line.sort) { + words[line.length] := [] << line + } +} + +say words[-1].join(' ') diff --git a/Task/Ordered-words/Swift/ordered-words.swift b/Task/Ordered-words/Swift/ordered-words.swift new file mode 100644 index 0000000000..6c2e82baab --- /dev/null +++ b/Task/Ordered-words/Swift/ordered-words.swift @@ -0,0 +1,28 @@ +import Foundation + +guard + let url = NSURL(string: "http://www.puzzlers.org/pub/wordlists/unixdict.txt"), + let input = try? NSString(contentsOfURL: url,encoding: NSUTF8StringEncoding) as String + else { exit(EXIT_FAILURE) } + +let words = input.componentsSeparatedByCharactersInSet(NSCharacterSet.newlineCharacterSet()) +let group: ([Int: [String]], String) -> [Int: [String]] = { + var d = $0; let g = d[$1.characters.count] ?? [] + d[$1.characters.count] = g + [$1] + return d +} +let ordered: ([String], String) -> [String] = { + guard String($1.characters.sort()) == $1 else { return $0 } + return $0 + [$1] +} + +let groups = words + .reduce([String](), combine: ordered) + .reduce([Int: [String]](), combine: group) + +guard + let maxLength = groups.keys.maxElement(), + let maxLengthGroup = groups[maxLength] + else { exit(EXIT_FAILURE) } + +maxLengthGroup.forEach { print($0) } diff --git a/Task/Ordered-words/jq/ordered-words.jq b/Task/Ordered-words/jq/ordered-words.jq new file mode 100644 index 0000000000..d082e91f4d --- /dev/null +++ b/Task/Ordered-words/jq/ordered-words.jq @@ -0,0 +1,14 @@ +def is_sorted: + if length <= 1 then true + else .[0] <= .[1] and (.[1:] | is_sorted) + end; + +def longest_ordered_words: + # avoid string manipulation: + def is_ordered: explode | is_sorted; + map(select(is_ordered)) + | (map(length)|max) as $max + | map( select(length == $max) ); + + +split("\n") | longest_ordered_words diff --git a/Task/Palindrome-detection/EchoLisp/palindrome-detection.echolisp b/Task/Palindrome-detection/EchoLisp/palindrome-detection.echolisp new file mode 100644 index 0000000000..8ae49d0036 --- /dev/null +++ b/Task/Palindrome-detection/EchoLisp/palindrome-detection.echolisp @@ -0,0 +1,8 @@ +;; returns #t or #f +(define (palindrome? string) +(equal? (string->list string) (reverse (string->list string)))) + +;; to strip spaces, use the following +;;(define (palindrome? string) +;;(let ((string (string-replace string "/\ /" "" "g"))) +;;(equal? (string->list string) (reverse (string->list string))))) diff --git a/Task/Palindrome-detection/Elm/palindrome-detection.elm b/Task/Palindrome-detection/Elm/palindrome-detection.elm new file mode 100644 index 0000000000..71ba0a67c2 --- /dev/null +++ b/Task/Palindrome-detection/Elm/palindrome-detection.elm @@ -0,0 +1,45 @@ +import String exposing (reverse, length) +import Html exposing (Html, Attribute, text, div, input) +import Html.Attributes exposing (placeholder, value, style) +import Html.Events exposing (on, targetValue) +import Html.App exposing (beginnerProgram) + +-- The following function (copied from Haskell) satisfies the +-- rosettacode task description. +is_palindrome x = x == reverse x + +-- The remainder of the code demonstrates the use of the function +-- in a complete Elm program. +main = beginnerProgram { model = "" , view = view , update = update } + +update newStr oldStr = newStr + +view : String -> Html String +view candidate = + div [] + ([ input + [ placeholder "Enter a string to check." + , value candidate + , on "input" targetValue + , myStyle + ] + [] + ] ++ + [ let testResult = + is_palindrome candidate + + statement = + if testResult then "PALINDROME!" else "not a palindrome" + + in div [ myStyle] [text statement] + ]) + +myStyle : Attribute msg +myStyle = + style + [ ("width", "100%") + , ("height", "20px") + , ("padding", "5px 0 0 5px") + , ("font-size", "1em") + , ("text-align", "left") + ] diff --git a/Task/Palindrome-detection/FreeBASIC/palindrome-detection.freebasic b/Task/Palindrome-detection/FreeBASIC/palindrome-detection.freebasic new file mode 100644 index 0000000000..fe4a1767b8 --- /dev/null +++ b/Task/Palindrome-detection/FreeBASIC/palindrome-detection.freebasic @@ -0,0 +1,76 @@ +' version 20-06-2015 +' compile with: fbc -s console "filename".bas + +#Ifndef TRUE ' define true and false for older freebasic versions + #Define FALSE 0 + #Define TRUE Not FALSE +#EndIf + +Function reverse(norm As String) As Integer + + Dim As String rev + Dim As Integer i, l = Len(norm) -1 + + rev = norm + For i = 0 To l + rev[l-i] = norm[i] + Next + + If norm = rev Then + Return TRUE + Else + Return FALSE + End If + +End Function + +Function cleanup(in As String, action As String = "") As String + ' action = "" do nothing, [l|L] = convert to lowercase, + ' [s|S] = strip spaces, [p|P] = strip punctuation. + If action = "" Then Return in + + Dim As Integer i, p_, s_ + Dim As String ch + + action = LCase(action) + For i = 1 To Len(action) + ch = Mid(action, i, 1) + If ch = "l" Then in = LCase(in) + If ch = "p" Then + p_ = 1 + ElseIf ch = "s" Then + s_ = 1 + End If + Next + + If p_ = 0 And s_ = 0 Then Return in + + Dim As String unwanted, clean + + If s_ = 1 Then unwanted = " " + If p_ = 1 Then unwanted = unwanted + "`~!@#$%^&*()-=_+[]{}\|;:',.<>/?" + + For i = 1 To Len(in) + ch = Mid(in, i, 1) + If InStr(unwanted, ch) = 0 Then clean = clean + ch + Next + + Return clean + +End Function + +' ------=< MAIN >=------ + +Dim As String test = "In girum imus nocte et consumimur igni" +'IIf ( cond, true, false ), true and false must be of the same type (num, string, UDT) +Print +Print " reverse(test) = "; IIf(reverse(test) = FALSE, "FALSE", "TRUE") +Print " reverse(cleanup(test,""l"")) = "; IIf(reverse(cleanup(test,"l")) = FALSE, "FALSE", "TRUE") +Print " reverse(cleanup(test,""ls"")) = "; IIf(reverse(cleanup(test,"ls")) = FALSE, "FALSE", "TRUE") +Print "reverse(cleanup(test,""PLS"")) = "; IIf(reverse(cleanup(test,"PLS")) = FALSE, "FALSE", "TRUE") + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print : Print "Hit any key to end program" +Sleep +End diff --git a/Task/Palindrome-detection/Lasso/palindrome-detection.lasso b/Task/Palindrome-detection/Lasso/palindrome-detection.lasso new file mode 100644 index 0000000000..a8a203c7e6 --- /dev/null +++ b/Task/Palindrome-detection/Lasso/palindrome-detection.lasso @@ -0,0 +1,16 @@ +define ispalindrome(text::string) => { + + local(_text = string(#text)) // need to make copy to get rid of reference issues + + #_text -> replace(regexp(`(?:$|\W)+`), -ignorecase) + + local(reversed = string(#_text)) + #reversed -> reverse + + return #_text == #reversed +} + +ispalindrome('Tätatät') // works with high ascii +ispalindrome('Hello World') + +ispalindrome('A man, a plan, a canoe, pasta, heros, rajahs, a coloratura, maps, snipe, percale, macaroni, a gag, a banana bag, a tan, a tag, a banana bag again (or a camel), a crepe, pins, Spam, a rut, a Rolo, cash, a jar, sore hats, a peon, a canal – Panama!') diff --git a/Task/Palindrome-detection/LiveCode/palindrome-detection.livecode b/Task/Palindrome-detection/LiveCode/palindrome-detection.livecode new file mode 100644 index 0000000000..1a471c071b --- /dev/null +++ b/Task/Palindrome-detection/LiveCode/palindrome-detection.livecode @@ -0,0 +1,16 @@ +function palindrome txt exact + if exact is empty or exact is not false then + set caseSensitive to true --default is false + else + replace space with empty in txt + put lower(txt) into txt + end if + return txt is reverse(txt) +end palindrome + +function reverse str + repeat with i = the length of str down to 1 + put byte i of str after revstr + end repeat + return revstr +end reverse diff --git a/Task/Palindrome-detection/Nim/palindrome-detection.nim b/Task/Palindrome-detection/Nim/palindrome-detection.nim new file mode 100644 index 0000000000..9199caee0a --- /dev/null +++ b/Task/Palindrome-detection/Nim/palindrome-detection.nim @@ -0,0 +1,9 @@ +proc reverse(s): string = + result = newString(s.len) + for i,c in s: + result[s.high - i] = c + +proc isPalindrome(s): bool = + s == reverse(s) + +echo isPalindrome("FoobooF") diff --git a/Task/Palindrome-detection/Oforth/palindrome-detection.oforth b/Task/Palindrome-detection/Oforth/palindrome-detection.oforth new file mode 100644 index 0000000000..74eabebea1 --- /dev/null +++ b/Task/Palindrome-detection/Oforth/palindrome-detection.oforth @@ -0,0 +1 @@ +String method: isPalindrome self reverse self == ; diff --git a/Task/Palindrome-detection/Phix/palindrome-detection.phix b/Task/Palindrome-detection/Phix/palindrome-detection.phix new file mode 100644 index 0000000000..0606f5b298 --- /dev/null +++ b/Task/Palindrome-detection/Phix/palindrome-detection.phix @@ -0,0 +1,5 @@ +function is_palindrome(sequence s) + return s==reverse(s) +end function + +?is_palindrome(lower(substitute("In girum imus nocte et consumimur igni"," ",""))) -- prints 1 diff --git a/Task/Palindrome-detection/Potion/palindrome-detection.potion b/Task/Palindrome-detection/Potion/palindrome-detection.potion new file mode 100644 index 0000000000..64a418bd9c --- /dev/null +++ b/Task/Palindrome-detection/Potion/palindrome-detection.potion @@ -0,0 +1,11 @@ +# The readable recursive version +palindrome_i = (s, b, e): + if (e <= b): true. + elsif (s ord(b) != s ord(e)): false. + else: palindrome_i(s, b+1, e-1). +. + +palindrome = (s): + palindrome_i(s, 0, s length - 1). + +palindrome(argv(1)) diff --git a/Task/Palindrome-detection/Ring/palindrome-detection.ring b/Task/Palindrome-detection/Ring/palindrome-detection.ring new file mode 100644 index 0000000000..b48afe8543 --- /dev/null +++ b/Task/Palindrome-detection/Ring/palindrome-detection.ring @@ -0,0 +1,8 @@ +aString = "radar" +bString = "" +for i=len(aString) to 1 step -1 + bString = bString + aString[i] +next +see aString +if aString = bString see " is a palindrome." + nl +else see " is not a palindrome" + nl ok diff --git a/Task/Palindrome-detection/SequenceL/palindrome-detection-1.sequencel b/Task/Palindrome-detection/SequenceL/palindrome-detection-1.sequencel new file mode 100644 index 0000000000..4c366ab2b5 --- /dev/null +++ b/Task/Palindrome-detection/SequenceL/palindrome-detection-1.sequencel @@ -0,0 +1,3 @@ +import ; + +isPalindrome(string(1)) := equalList(string, reverse(string)); diff --git a/Task/Palindrome-detection/SequenceL/palindrome-detection-2.sequencel b/Task/Palindrome-detection/SequenceL/palindrome-detection-2.sequencel new file mode 100644 index 0000000000..24ec5ce199 --- /dev/null +++ b/Task/Palindrome-detection/SequenceL/palindrome-detection-2.sequencel @@ -0,0 +1,5 @@ +isPalindrome(string(1)) := + let + compares[i] := string[i] = string[size(string) - (i - 1)] foreach i within 1 ... (size(string) / 2); + in + all(compares); diff --git a/Task/Palindrome-detection/Sidef/palindrome-detection-1.sidef b/Task/Palindrome-detection/Sidef/palindrome-detection-1.sidef new file mode 100644 index 0000000000..cb6b3230b9 --- /dev/null +++ b/Task/Palindrome-detection/Sidef/palindrome-detection-1.sidef @@ -0,0 +1 @@ +say "noon".is_palindrome; # true diff --git a/Task/Palindrome-detection/Sidef/palindrome-detection-2.sidef b/Task/Palindrome-detection/Sidef/palindrome-detection-2.sidef new file mode 100644 index 0000000000..987cf3a6f3 --- /dev/null +++ b/Task/Palindrome-detection/Sidef/palindrome-detection-2.sidef @@ -0,0 +1,3 @@ +func palindrome(s) { + s == s.reverse +} diff --git a/Task/Palindrome-detection/Sidef/palindrome-detection-3.sidef b/Task/Palindrome-detection/Sidef/palindrome-detection-3.sidef new file mode 100644 index 0000000000..9e2c472599 --- /dev/null +++ b/Task/Palindrome-detection/Sidef/palindrome-detection-3.sidef @@ -0,0 +1,11 @@ +func palindrome(s) { + if (s.len <= 1) { + true + } + elsif (s.first != s.last) { + false + } + else { + __FUNC__(s.ft(1, -2)) + } +} diff --git a/Task/Palindrome-detection/Swift/palindrome-detection-1.swift b/Task/Palindrome-detection/Swift/palindrome-detection-1.swift new file mode 100644 index 0000000000..b8116d883d --- /dev/null +++ b/Task/Palindrome-detection/Swift/palindrome-detection-1.swift @@ -0,0 +1,19 @@ +import Foundation + +// Allow for easy character checking +extension String { + subscript (i: Int) -> String { + return String(Array(self)[i]) + } +} + +func isPalindrome(str:String) -> Bool { + if (count(str) == 0 || count(str) == 1) { + return true + } + let removeRange = Range(start: advance(str.startIndex, 1), end: advance(str.endIndex, -1)) + if (str[0] == str[count(str) - 1]) { + return isPalindrome(str.substringWithRange(removeRange)) + } + return false +} diff --git a/Task/Palindrome-detection/Swift/palindrome-detection-2.swift b/Task/Palindrome-detection/Swift/palindrome-detection-2.swift new file mode 100644 index 0000000000..4166055f2d --- /dev/null +++ b/Task/Palindrome-detection/Swift/palindrome-detection-2.swift @@ -0,0 +1,5 @@ +func isPal(str: String) -> Bool { + let c = str.characters + return lazy(c).reverse() + .startsWith(c[c.startIndex...advance(c.startIndex, c.count / 2)]) +} diff --git a/Task/Palindrome-detection/Wortel/palindrome-detection.wortel b/Task/Palindrome-detection/Wortel/palindrome-detection.wortel new file mode 100644 index 0000000000..c48f09356e --- /dev/null +++ b/Task/Palindrome-detection/Wortel/palindrome-detection.wortel @@ -0,0 +1,13 @@ +@let { + ; Using a hook + pal1 @(= @rev) + ; Function with argument + pal2 &s = s @rev s + ; for inexact palindromes + pal3 ^(@(= @rev) .toLowerCase. &\@replace[&"\s+"g ""]) + [[ + !pal1 "abcba" + !pal2 "abcbac" + !pal3 "In girum imus nocte et consumimur igni" + ]] +} diff --git a/Task/Palindrome-detection/jq/palindrome-detection.jq b/Task/Palindrome-detection/jq/palindrome-detection.jq new file mode 100644 index 0000000000..a7356cae73 --- /dev/null +++ b/Task/Palindrome-detection/jq/palindrome-detection.jq @@ -0,0 +1 @@ +def palindrome: explode as $in | ($in|reverse) == $in; diff --git a/Task/Pangram-checker/Ceylon/pangram-checker.ceylon b/Task/Pangram-checker/Ceylon/pangram-checker.ceylon new file mode 100644 index 0000000000..343d8ffe9d --- /dev/null +++ b/Task/Pangram-checker/Ceylon/pangram-checker.ceylon @@ -0,0 +1,17 @@ +shared void run() { + + function pangram(String sentence) => + let(alphabet = set('a'..'z'), + letters = set(sentence.lowercased.filter(alphabet.contains))) + letters == alphabet; + + value sentences = [ + "The quick brown fox jumps over the lazy dog", + """Watch "Jeopardy!", Alex Trebek's fun TV quiz game.""", + "Pack my box with five dozen liquor jugs.", + "blah blah blah" + ]; + for(sentence in sentences) { + print("\"``sentence``\" is a pangram? ``pangram(sentence)``"); + } +} diff --git a/Task/Pangram-checker/FreeBASIC/pangram-checker.freebasic b/Task/Pangram-checker/FreeBASIC/pangram-checker.freebasic new file mode 100644 index 0000000000..476e8b5a64 --- /dev/null +++ b/Task/Pangram-checker/FreeBASIC/pangram-checker.freebasic @@ -0,0 +1,27 @@ +' FB 1.05.0 Win64 + +Function isPangram(s As Const String) As Boolean + Dim As Integer length = Len(s) + If length < 26 Then Return False + Dim p As String = LCase(s) + For i As Integer = 97 To 122 + If Instr(p, Chr(i)) = 0 Then Return False + Next + Return True +End Function + +Dim s(1 To 3) As String = _ +{ _ + "The quick brown fox jumps over the lazy dog", _ + "abbdefghijklmnopqrstuVwxYz", _ '' no c! + "How vexingly quick daft zebras jump!" _ +} + +For i As Integer = 1 To 3: + Print "'"; s(i); "' is "; IIf(isPangram(s(i)), "a", "not a"); " pangram" + Print +Next + +Print +Print "Press nay key to quit" +Sleep diff --git a/Task/Pangram-checker/Nim/pangram-checker.nim b/Task/Pangram-checker/Nim/pangram-checker.nim new file mode 100644 index 0000000000..b2985fe34c --- /dev/null +++ b/Task/Pangram-checker/Nim/pangram-checker.nim @@ -0,0 +1,8 @@ +import rdstdin + +proc isPangram(sentence; alphabet = {'a'..'z'}): bool = + var sentset: set[char] = {} + for c in sentence: sentset.incl c + alphabet <= sentset + +echo isPangram(readLineFromStdin "Sentence: ") diff --git a/Task/Pangram-checker/Ring/pangram-checker.ring b/Task/Pangram-checker/Ring/pangram-checker.ring new file mode 100644 index 0000000000..2bbded3520 --- /dev/null +++ b/Task/Pangram-checker/Ring/pangram-checker.ring @@ -0,0 +1,15 @@ +pangram = 0 +s = "The quick brown fox jumps over the lazy dog." +see "" + pangram(s) + " " + s + nl + +s = "My dog has fleas." +see "" + pangram(s) + " " + s + nl + +func pangram str + str = lower(str) + for i = ascii("a") to ascii("z") + bool = substr(str, char(i)) > 0 + pangram = pangram + bool + next + pan = (pangram = 26) + return pan diff --git a/Task/Pangram-checker/Sidef/pangram-checker.sidef b/Task/Pangram-checker/Sidef/pangram-checker.sidef new file mode 100644 index 0000000000..fcd3c0435a --- /dev/null +++ b/Task/Pangram-checker/Sidef/pangram-checker.sidef @@ -0,0 +1,14 @@ +define Eng = 'a'..'z'; +define Hex = 'a'..'f'; +define Cyr = %w(а б в г д е ж з и й к л м н о п р с т у ф х ц ч ш щ ъ ы ь э ю я ё); + +func pangram(str, alpha=Eng) { + var lstr = str.lc; + alpha.all {|c| lstr.contains(c) }; +} + +say pangram("The quick brown fox jumps over the lazy dog."); +say pangram("My dog has fleas."); +say pangram("My dog has fleas.", Hex); +say pangram("My dog backs fleas.", Hex); +say pangram("Съешь же ещё этих мягких французских булок, да выпей чаю", Cyr); diff --git a/Task/Pangram-checker/Swift/pangram-checker-1.swift b/Task/Pangram-checker/Swift/pangram-checker-1.swift new file mode 100644 index 0000000000..91055ecd59 --- /dev/null +++ b/Task/Pangram-checker/Swift/pangram-checker-1.swift @@ -0,0 +1,16 @@ +import Foundation + +let str = "the quick brown fox jumps over the lazy dog" + +func isPangram(str:String) -> Bool { + let stringArray = Array(str.lowercaseString) + for char in "abcdefghijklmnopqrstuvwxyz" { + if (find(stringArray, char) == nil) { + return false + } + } + return true +} + +isPangram(str) // True +isPangram("Test string") // False diff --git a/Task/Pangram-checker/Swift/pangram-checker-2.swift b/Task/Pangram-checker/Swift/pangram-checker-2.swift new file mode 100644 index 0000000000..610f541d60 --- /dev/null +++ b/Task/Pangram-checker/Swift/pangram-checker-2.swift @@ -0,0 +1,4 @@ +func isPangram(str: String) -> Bool { + let (char, alph) = (Set(str.characters), "abcdefghijklmnopqrstuvwxyz".characters) + return !alph.contains {!char.contains($0)} +} diff --git a/Task/Pangram-checker/jq/pangram-checker.jq b/Task/Pangram-checker/jq/pangram-checker.jq new file mode 100644 index 0000000000..6d62656bc5 --- /dev/null +++ b/Task/Pangram-checker/jq/pangram-checker.jq @@ -0,0 +1,11 @@ +def is_pangram: + explode + | map( if 65 <= . and . <= 90 then . + 32 # uppercase + elif 97 <= . and . <= 122 then . # lowercase + else empty + end ) + | unique + | length == 26; + +# Example: +"The quick brown fox jumps over the lazy dog" | is_pangram diff --git a/Task/Paraffins/Nim/paraffins.nim b/Task/Paraffins/Nim/paraffins.nim new file mode 100644 index 0000000000..8919060217 --- /dev/null +++ b/Task/Paraffins/Nim/paraffins.nim @@ -0,0 +1,41 @@ +import bigints + +const + nMax: int32 = 250 + nBranches = 4 + +var rooted, unrooted: array[nMax + 1, BigInt] +rooted[0..1] = [1.initBigInt, 1.initBigInt] +unrooted[0..1] = [1.initBigInt, 1.initBigInt] +for i in 2 .. nMax: + rooted[i] = 0.initBigInt + unrooted[i] = 0.initBigInt + +proc choose(m, k): BigInt = + result = m + if k == 1: return + for i in 1 .. < k: + result = result * (m + i) div (i + 1) + +proc tree(br, n, l, sum: int32, cnt: BigInt) = + var s: int32 = 0 + for b in br + 1 .. nBranches: + s = sum + (b - br) * n + if s > nMax: return + + let c = choose(rooted[n], b - br) * cnt + + if l * 2 < s: unrooted[s] += c + if b == nBranches: return + rooted[s] += c + for m in countdown(n-1, 1): + tree b, m, l, s, c + +proc bicenter(s) = + if (s and 1) == 0: + unrooted[s] += rooted[s div 2] * (rooted[s div 2] + 1) div 2 + +for n in 1 .. nMax: + tree 0, n, n, 1, 1.initBigInt + n.bicenter + echo n, ": ", unrooted[n] diff --git a/Task/Paraffins/jq/paraffins-1.jq b/Task/Paraffins/jq/paraffins-1.jq new file mode 100644 index 0000000000..d01d617bd2 --- /dev/null +++ b/Task/Paraffins/jq/paraffins-1.jq @@ -0,0 +1,65 @@ +def MAX_N: 500; # imprecision begins at 46 +def BRANCH: 4; + +# state: [unrooted, ra] +# tree(br; n; l; sum; cnt) where initially: l=n, sum=1 and cnt=1 +def tree(br; n; l; sum; cnt): + + # The inner function is used to implement the range(b+1; BRANCH) loop + # as there are early exits. + # On completion, _tree returns [unrooted, ra] + def _tree: # state [ (b, c, sum), (unrooted, ra)] + if length != 5 then error("_tree input has length \(length)") else . end + | .[0] as $b | .[1] as $c | .[2] as $sum | .[3] as $unrooted | .[4] as $ra + | if $b > BRANCH then [$unrooted, $ra] + else + ($sum + n) as $sum + | if $sum >= MAX_N or + # prevent unneeded long math + ( l * 2 >= $sum and $b >= BRANCH) then [$unrooted, $ra] # return + else (if $b == br + 1 then $ra[n] * cnt + else ($c * ($ra[n] + (($b - br - 1)))) / ($b - br) | floor + end) as $c + | (if l * 2 < $sum then ($unrooted | .[$sum] += $c) + else $unrooted end) as $unrooted + | if $b >= BRANCH then [$b+1, $c, $sum, $unrooted, $ra] | _tree # next + else [$unrooted, ($ra | .[$sum] += $c) ] + | reduce range(1; n) as $m (.; tree($b; $m; l; $sum; $c)) + | ([$b + 1, $c, $sum] + .) | _tree + end + end + end + ; + + # start by incrementing b, and prepending values for (b,c,sum) + ([br+1, cnt, sum] + .) | _tree +; + +# input and output: [unrooted, ra] +def bicenter(s): + if s % 2 == 1 then . + else + .[1][s / 2] as $aux + | .[0][s] += ($aux * ($aux + 1)) / 2 # 2 divides odd*even + end +; + +def array(n;init): [][n-1] = init | map(init); + +def ra: array( MAX_N; 0) | .[0] = 1 | .[1] = 1; + +def unrooted: ra; + +# See below for a simpler implementation using "foreach" +def paraffins: + # range(1; MAX_N) + def _paraffins(n): + if n >= MAX_N then empty + else tree(0; n; n; 1; 1) | bicenter(n) + | [n, .[0][n]], # output + _paraffins(n+1) + end; + [unrooted, ra] | _paraffins(1) +; + +paraffins diff --git a/Task/Paraffins/jq/paraffins-2.jq b/Task/Paraffins/jq/paraffins-2.jq new file mode 100644 index 0000000000..18cf5e8efe --- /dev/null +++ b/Task/Paraffins/jq/paraffins-2.jq @@ -0,0 +1,7 @@ +def paraffins: + foreach range(1; MAX_N) as $n + ( [unrooted, ra]; + tree(0; $n; $n; 1; 1) | bicenter($n); + [$n, .[0][$n]] + ) +; diff --git a/Task/Parallel-calculations/Oforth/parallel-calculations.oforth b/Task/Parallel-calculations/Oforth/parallel-calculations.oforth new file mode 100644 index 0000000000..335dbf603b --- /dev/null +++ b/Task/Parallel-calculations/Oforth/parallel-calculations.oforth @@ -0,0 +1,3 @@ +import: parallel + +: largeMinFactor dup mapParallel(#factors) zip maxFor(#[ second first ]) ; diff --git a/Task/Parallel-calculations/SequenceL/parallel-calculations-1.sequencel b/Task/Parallel-calculations/SequenceL/parallel-calculations-1.sequencel new file mode 100644 index 0000000000..6e5c5f3808 --- /dev/null +++ b/Task/Parallel-calculations/SequenceL/parallel-calculations-1.sequencel @@ -0,0 +1,13 @@ +import ; +import ; +import ; + +main(args(2)) := + let + inputs := stringToInt(args); + factored := primeFactorization(inputs); + minFactors := vectorMin(factored); + + indexOfMax := firstIndexOf(minFactors, vectorMax(minFactors)); + in + "Number " ++ intToString(inputs[indexOfMax]) ++ " has largest minimal factor:\n" ++ delimit(intToString(factored[indexOfMax]), ' '); diff --git a/Task/Parallel-calculations/SequenceL/parallel-calculations-2.sequencel b/Task/Parallel-calculations/SequenceL/parallel-calculations-2.sequencel new file mode 100644 index 0000000000..2c982dce49 --- /dev/null +++ b/Task/Parallel-calculations/SequenceL/parallel-calculations-2.sequencel @@ -0,0 +1 @@ +factored := primeFactorization(inputs); diff --git a/Task/Parallel-calculations/Sidef/parallel-calculations.sidef b/Task/Parallel-calculations/Sidef/parallel-calculations.sidef new file mode 100644 index 0000000000..7125277ab8 --- /dev/null +++ b/Task/Parallel-calculations/Sidef/parallel-calculations.sidef @@ -0,0 +1,5 @@ +var nums = [1275792312878611, 12345678915808973, + 1578070919762253, 14700694496703910,]; + +var factors = nums.map {|n| prime_factors.ffork(n) }.map { .wait } +say ((nums ~Z factors)->max_by {|m| m[1][0] }) diff --git a/Task/Parametric-polymorphism/Ceylon/parametric-polymorphism.ceylon b/Task/Parametric-polymorphism/Ceylon/parametric-polymorphism.ceylon new file mode 100644 index 0000000000..abfe58fff7 --- /dev/null +++ b/Task/Parametric-polymorphism/Ceylon/parametric-polymorphism.ceylon @@ -0,0 +1,31 @@ +class BinaryTree(shared Data data, shared BinaryTree? left = null, shared BinaryTree? right = null) { + + shared BinaryTree myMap(NewData f(Data d)) => + BinaryTree { + data = f(data); + left = left?.myMap(f); + right = right?.myMap(f); + }; +} + +shared void run() { + + value tree1 = BinaryTree { + data = 3; + left = BinaryTree { + data = 4; + }; + right = BinaryTree { + data = 5; + left = BinaryTree { + data = 6; + }; + }; + }; + + tree1.myMap(print); + print(""); + + value tree2 = tree1.myMap((x) => x * 333.33); + tree2.myMap(print); +} diff --git a/Task/Parametric-polymorphism/Nim/parametric-polymorphism.nim b/Task/Parametric-polymorphism/Nim/parametric-polymorphism.nim new file mode 100644 index 0000000000..47cf3ea586 --- /dev/null +++ b/Task/Parametric-polymorphism/Nim/parametric-polymorphism.nim @@ -0,0 +1,3 @@ +type Tree[T] = ref object + value: T + left, right: Tree[T] diff --git a/Task/Parametric-polymorphism/Swift/parametric-polymorphism-1.swift b/Task/Parametric-polymorphism/Swift/parametric-polymorphism-1.swift new file mode 100644 index 0000000000..41a3a1b9bc --- /dev/null +++ b/Task/Parametric-polymorphism/Swift/parametric-polymorphism-1.swift @@ -0,0 +1,11 @@ +class Tree { + var value: T? + var left: Tree? + var right: Tree? + + func replaceAll(value: T?) { + self.value = value + left?.replaceAll(value) + right?.replaceAll(value) + } +} diff --git a/Task/Parametric-polymorphism/Swift/parametric-polymorphism-2.swift b/Task/Parametric-polymorphism/Swift/parametric-polymorphism-2.swift new file mode 100644 index 0000000000..7fc4b133a6 --- /dev/null +++ b/Task/Parametric-polymorphism/Swift/parametric-polymorphism-2.swift @@ -0,0 +1,11 @@ +enum Tree { + case Empty + indirect case Node(T, Tree, Tree) + + func map(f : T -> U) -> Tree { + switch(self) { + case .Empty : return .Empty + case let .Node(x, l, r): return .Node(f(x), l.map(f), r.map(f)) + } + } +} diff --git a/Task/Parametrized-SQL-statement/8th/parametrized-sql-statement.8th b/Task/Parametrized-SQL-statement/8th/parametrized-sql-statement.8th new file mode 100644 index 0000000000..6c6a19b80f --- /dev/null +++ b/Task/Parametrized-SQL-statement/8th/parametrized-sql-statement.8th @@ -0,0 +1,13 @@ +\ assuming the var 'db' contains an opened database with a schema matching the problem: +db @ +"UPDATE players SET name=?1,score=?2,active=?3 WHERE jerseyNum=?4" +db:prepare var, stmt + +\ bind values to the statement: +stmt @ 1 "Smith, Steve" db:bind + 2 42 db:bind + 3 true db:bind + 4 99 db:bind + +\ execute the query +db @ swap db:exec diff --git a/Task/Parsing-RPN-calculator-algorithm/Ceylon/parsing-rpn-calculator-algorithm.ceylon b/Task/Parsing-RPN-calculator-algorithm/Ceylon/parsing-rpn-calculator-algorithm.ceylon new file mode 100644 index 0000000000..0fcfed2d9f --- /dev/null +++ b/Task/Parsing-RPN-calculator-algorithm/Ceylon/parsing-rpn-calculator-algorithm.ceylon @@ -0,0 +1,44 @@ +import ceylon.collection { + + ArrayList +} + +shared void run() { + + value ops = map { + "+" -> plus, + "*" -> times, + "-" -> ((Float a, Float b) => a - b), + "/" -> ((Float a, Float b) => a / b), + "^" -> ((Float a, Float b) => a ^ b) + }; + + void printTableRow(String|Float token, String description, {Float*} stack) { + print("``token.string.padTrailing(8)````description.padTrailing(30)````stack``"); + } + + function calculate(String input) { + + value stack = ArrayList(); + value tokens = input.split().map((String element) + => if(ops.keys.contains(element)) then element else parseFloat(element)); + + print("Token Operation Stack"); + + for(token in tokens.coalesced) { + if(is Float token) { + stack.push(token); + printTableRow(token, "push", stack); + } else if(exists op = ops[token], exists first = stack.pop(), exists second = stack.pop()) { + value result = op(second, first); + stack.push(result); + printTableRow(token, "perform ``token`` on ``formatFloat(second, 1, 1)`` and ``formatFloat(first, 1, 1)``", stack); + } else { + throw Exception("bad syntax"); + } + } + return stack.pop(); + } + + print(calculate("3 4 2 * 1 5 - 2 3 ^ ^ / +")); +} diff --git a/Task/Parsing-RPN-calculator-algorithm/EchoLisp/parsing-rpn-calculator-algorithm.echolisp b/Task/Parsing-RPN-calculator-algorithm/EchoLisp/parsing-rpn-calculator-algorithm.echolisp new file mode 100644 index 0000000000..4dfc0637f0 --- /dev/null +++ b/Task/Parsing-RPN-calculator-algorithm/EchoLisp/parsing-rpn-calculator-algorithm.echolisp @@ -0,0 +1,28 @@ +;; RPN (postfix) evaluator + +(lib 'hash) + +(define OPS (make-hash)) +(hash-set OPS "^" expt) +(hash-set OPS "*" *) +(hash-set OPS "/" //) ;; float divide +(hash-set OPS "+" +) +(hash-set OPS "-" -) + +(define (op? op) (hash-ref OPS op)) + +;; algorithm : https://en.wikipedia.org/wiki/Reverse_Polish_notation#Postfix_algorithm + +(define (calculator rpn S) + (for ((token rpn)) + (if (op? token) + (let [(op2 (pop S)) (op1 (pop S))] + (unless (and op1 op2) (error "cannot calculate expression at:" token)) + (push S ((op? token) op1 op2)) + (writeln op1 token op2 "→" (stack-top S))) + (push S (string->number token)))) + (pop S)) + +(define (task rpn) + (define S (stack 'S)) + (calculator (text-parse rpn) S )) diff --git a/Task/Parsing-RPN-calculator-algorithm/FunL/parsing-rpn-calculator-algorithm.funl b/Task/Parsing-RPN-calculator-algorithm/FunL/parsing-rpn-calculator-algorithm.funl new file mode 100644 index 0000000000..1d3b4fc37f --- /dev/null +++ b/Task/Parsing-RPN-calculator-algorithm/FunL/parsing-rpn-calculator-algorithm.funl @@ -0,0 +1,19 @@ +def evaluate( expr ) = + stack = [] + + for token <- expr.split( '''\s+''' ) + case number( token ) + Some( n ) -> + stack = n : stack + println( "push $token: ${stack.reversed()}" ) + None -> + case {'+': (+), '-': (-), '*': (*), '/': (/), '^': (^)}.>get( token ) + Some( op ) -> + stack = op( stack.tail().head(), stack.head() ) : stack.tail().tail() + println( "perform $token: ${stack.reversed()}" ) + None -> error( "unrecognized operator '$token'" ) + + stack.head() + +res = evaluate( '3 4 2 * 1 5 - 2 3 ^ ^ / +' ) +println( res + (if res is Integer then '' else " or ${float(res)}") ) diff --git a/Task/Parsing-RPN-calculator-algorithm/Nim/parsing-rpn-calculator-algorithm.nim b/Task/Parsing-RPN-calculator-algorithm/Nim/parsing-rpn-calculator-algorithm.nim new file mode 100644 index 0000000000..ef0a0d9b63 --- /dev/null +++ b/Task/Parsing-RPN-calculator-algorithm/Nim/parsing-rpn-calculator-algorithm.nim @@ -0,0 +1,72 @@ +import math, rdstdin, strutils, tables + +type Stack = seq[float] + +proc lalign(s, x): string = + s & repeatChar(x - s.len, ' ') + +proc opPow(s: var Stack) = + let b = s.pop + let a = s.pop + s.add a.pow b + +proc opMul(s: var Stack) = + let b = s.pop + let a = s.pop + s.add a * b + +proc opDiv(s: var Stack) = + let b = s.pop + let a = s.pop + s.add a / b + +proc opAdd(s: var Stack) = + let b = s.pop + let a = s.pop + s.add a + b + +proc opSub(s: var Stack) = + let b = s.pop + let a = s.pop + s.add a - b + +proc opNum(s: var Stack, num) = s.add num + +let ops = toTable({"^": opPow, + "*": opMul, + "/": opDiv, + "+": opAdd, + "-": opSub}) + +proc getInput(inp = ""): seq[string] = + var inp = inp + if inp.len == 0: + inp = readLineFromStdin "Expression: " + result = inp.strip.split + +proc rpnCalc(tokens): auto = + var s: Stack = @[] + result = @[@["TOKEN","ACTION","STACK"]] + for token in tokens: + var action = "" + if ops.hasKey token: + action = "Apply op to top of stack" + ops[token](s) + else: + action = "Push num onto top of stack" + s.opNum token.parseFloat + result.add(@[token, action, s.map(proc (x: float): string = $x).join(" ")]) + +let rpn = "3 4 2 * 1 5 - 2 3 ^ ^ / +" +echo "For RPN expression: ", rpn +let rp = rpnCalc rpn.getInput + +var maxColWidths = newSeq[int](rp[0].len) +for i in 0 .. rp[0].high: + for x in rp: + maxColWidths[i] = max(maxColWidths[i], x[i].len) + +for x in rp: + for i, y in x: + stdout.write y.lalign(maxColWidths[i]), " " + echo "" diff --git a/Task/Parsing-RPN-calculator-algorithm/Oforth/parsing-rpn-calculator-algorithm-1.oforth b/Task/Parsing-RPN-calculator-algorithm/Oforth/parsing-rpn-calculator-algorithm-1.oforth new file mode 100644 index 0000000000..8c1d2ec21a --- /dev/null +++ b/Task/Parsing-RPN-calculator-algorithm/Oforth/parsing-rpn-calculator-algorithm-1.oforth @@ -0,0 +1 @@ +"3 4 2 * 1 5 - 2 3 ^ ^ / +" eval println diff --git a/Task/Parsing-RPN-calculator-algorithm/Oforth/parsing-rpn-calculator-algorithm-2.oforth b/Task/Parsing-RPN-calculator-algorithm/Oforth/parsing-rpn-calculator-algorithm-2.oforth new file mode 100644 index 0000000000..16b224d42e --- /dev/null +++ b/Task/Parsing-RPN-calculator-algorithm/Oforth/parsing-rpn-calculator-algorithm-2.oforth @@ -0,0 +1,3 @@ +: rpn(s) { s words apply(#[ eval .l ]) } + +rpn("3 4 2 * 1 5 - 2 3 ^ ^ / +") diff --git a/Task/Parsing-RPN-calculator-algorithm/Phix/parsing-rpn-calculator-algorithm.phix b/Task/Parsing-RPN-calculator-algorithm/Phix/parsing-rpn-calculator-algorithm.phix new file mode 100644 index 0000000000..a892def520 --- /dev/null +++ b/Task/Parsing-RPN-calculator-algorithm/Phix/parsing-rpn-calculator-algorithm.phix @@ -0,0 +1,17 @@ +procedure evalRPN(string s) +sequence stack = {} +sequence ops = split(s) + for i=1 to length(ops) do + string op = ops[i] + switch op + case "+": stack[-2] = stack[-2]+stack[-1]; stack = stack[1..-2] + case "-": stack[-2] = stack[-2]-stack[-1]; stack = stack[1..-2] + case "*": stack[-2] = stack[-2]*stack[-1]; stack = stack[1..-2] + case "/": stack[-2] = stack[-2]/stack[-1]; stack = stack[1..-2] + case "^": stack[-2] = power(stack[-2],stack[-1]); stack = stack[1..-2] + default : stack = append(stack,scanf(op,"%d")[1][1]) + end switch + ?{op,stack} + end for +end procedure +evalRPN("3 4 2 * 1 5 - 2 3 ^ ^ / +") diff --git a/Task/Parsing-RPN-calculator-algorithm/Sidef/parsing-rpn-calculator-algorithm.sidef b/Task/Parsing-RPN-calculator-algorithm/Sidef/parsing-rpn-calculator-algorithm.sidef new file mode 100644 index 0000000000..f718f32967 --- /dev/null +++ b/Task/Parsing-RPN-calculator-algorithm/Sidef/parsing-rpn-calculator-algorithm.sidef @@ -0,0 +1,33 @@ +var proggie = '3 4 2 * 1 5 - 2 3 ^ ^ / +'; + +class RPN(arr=[]) { + + method binop(op) { + var x = arr.pop + var y = arr.pop + arr << y.(op)(x) + } + + method run(p) { + p.each_word { |w| + say "#{w} (#{arr})"; + given (w) { + when (/\d/) { + arr << w.to_f + } + when (<+ - * />) { + self.binop(w) + } + when ('^') { + self.binop('**') + } + default { + die "#{w} is bogus" + } + } + } + say arr[0] + } +} + +RPN.new.run(proggie); diff --git a/Task/Parsing-RPN-calculator-algorithm/Swift/parsing-rpn-calculator-algorithm.swift b/Task/Parsing-RPN-calculator-algorithm/Swift/parsing-rpn-calculator-algorithm.swift new file mode 100644 index 0000000000..b409033807 --- /dev/null +++ b/Task/Parsing-RPN-calculator-algorithm/Swift/parsing-rpn-calculator-algorithm.swift @@ -0,0 +1,58 @@ +let opa = [ + "^": (prec: 4, rAssoc: true), + "*": (prec: 3, rAssoc: false), + "/": (prec: 3, rAssoc: false), + "+": (prec: 2, rAssoc: false), + "-": (prec: 2, rAssoc: false), +] + +func rpn(tokens: [String]) -> [String] { + var rpn : [String] = [] + var stack : [String] = [] // holds operators and left parenthesis + + for tok in tokens { + switch tok { + case "(": + stack += [tok] // push "(" to stack + case ")": + while !stack.isEmpty { + let op = stack.removeLast() // pop item from stack + if op == "(" { + break // discard "(" + } else { + rpn += [op] // add operator to result + } + } + default: + if let o1 = opa[tok] { // token is an operator? + for op in stack.reverse() { + if let o2 = opa[op] { + if !(o1.prec > o2.prec || (o1.prec == o2.prec && o1.rAssoc)) { + // top item is an operator that needs to come off + rpn += [stack.removeLast()] // pop and add it to the result + continue + } + } + break + } + + stack += [tok] // push operator (the new one) to stack + } else { // token is not an operator + rpn += [tok] // add operand to result + } + } + } + + return rpn + stack.reverse() +} + +func parseInfix(e: String) -> String { + let tokens = e.characters.split{ $0 == " " }.map(String.init) + return rpn(tokens).joinWithSeparator(" ") +} + +var input : String + +input = "3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3" +"infix: \(input)" +"postfix: \(parseInfix(input))" diff --git a/Task/Parsing-RPN-to-infix-conversion/EchoLisp/parsing-rpn-to-infix-conversion.echolisp b/Task/Parsing-RPN-to-infix-conversion/EchoLisp/parsing-rpn-to-infix-conversion.echolisp new file mode 100644 index 0000000000..db70ab25bf --- /dev/null +++ b/Task/Parsing-RPN-to-infix-conversion/EchoLisp/parsing-rpn-to-infix-conversion.echolisp @@ -0,0 +1,60 @@ +(require 'hash) +(string-delimiter "") + +(define (^ a b ) (expt a b)) ;; add this not-native function +(define-syntax-rule (r-assoc? op) (= op "^")) +(define-syntax-rule (l-assoc? op) (not ( = op "^" ))) +(define PRECEDENCES (list->hash + '(("+" . 2) ("-" . 2) ("*" . 3) ("/" . 3) ("//" . 3) ("^" . 4)) + (make-hash))) + +;; RPN vector or list -> infix tree -> (a op (b op c) d) .. +(define (rpn->infix rpn) +(define S (stack 'S)) + (for ((token rpn)) + (if (procedure? token) + (let [(op2 (pop S)) (op1 (pop S))] + (unless (and op1 op2) (error "cannot translate expression" rpn)) + (push S (list op1 token op2)) + ) + (push S token )) + (writeln 'token (string token) 'stack (stack->list S))) + (begin0 + (pop S) ;; return (top S) + (unless (stack-empty? S) (error "ill-formed rpn" rpn))) + ) + +;; a node tree is (left op right) or a number +(define-syntax-id _.left (first _)) ; mynode.left expands to (first mynode) +(define-syntax-id _.right (third _)) +(define-syntax-id _.op (string (second _ ))) +(define-syntax-rule (precedence node) (hash-ref PRECEDENCES (string (second node)))) + +(define (left-par? node) ; does lhs needs ( lhs ) ? + (cond + [(number? node.left) #f] + [(< (precedence node.left) (precedence node)) #t] + [(and + (r-assoc? node.op) + (= (precedence node.left) (precedence node))) #t] + [else #f])) + +(define (right-par? node) + (cond + [(number? node.right) #f] + [(< (precedence node.right) (precedence node)) #t] + [(and + (l-assoc? node.op) + (= (precedence node.right) (precedence node))) #t] + [else #f])) + +;; infix tree -> char string +(define (infix->string node) + (cond + [(number? node) (string node)] + [else (let + [(lhs (infix->string node.left)) + (rhs (infix->string node.right))] + (when (left-par? node) (set! lhs (string-append "(" lhs ")"))) + (when (right-par? node) (set! rhs (string-append "(" rhs ")"))) + (string-append lhs " " node.op " " rhs))])) diff --git a/Task/Parsing-RPN-to-infix-conversion/Nim/parsing-rpn-to-infix-conversion.nim b/Task/Parsing-RPN-to-infix-conversion/Nim/parsing-rpn-to-infix-conversion.nim new file mode 100644 index 0000000000..da4e169144 --- /dev/null +++ b/Task/Parsing-RPN-to-infix-conversion/Nim/parsing-rpn-to-infix-conversion.nim @@ -0,0 +1,45 @@ +import tables, strutils + +const nPrec = 9 + +let ops: Table[string, tuple[prec: int, rAssoc: bool]] = + { "^": (4, true) + , "*": (3, false) + , "/": (3, false) + , "+": (2, false) + , "-": (2, false) + }.toTable + +proc parseRPN(e: string) = + echo "postfix: ", e + var stack = newSeq[tuple[prec: int, expr: string]]() + + for tok in e.split: + echo "Token: ", tok + if ops.hasKey tok: + let op = ops[tok] + let rhs = stack.pop + var lhs = stack.pop + + if lhs.prec < op.prec or (lhs.prec == op.prec and op.rAssoc): + lhs.expr = "(" & lhs.expr & ")" + + lhs.expr.add " " & tok & " " + + if rhs.prec < op.prec or (rhs.prec == op.prec and not op.rAssoc): + lhs.expr.add "(" & rhs.expr & ")" + else: + lhs.expr.add rhs.expr + + lhs.prec = op.prec + stack.add lhs + else: + stack.add((nPrec, tok)) + + for f in stack: + echo " ", f.prec, " ", f.expr + + echo "infix: ", stack[0].expr + +for test in ["3 4 2 * 1 5 - 2 3 ^ ^ / +", "1 2 + 3 4 + ^ 5 6 + ^"]: + test.parseRPN diff --git a/Task/Parsing-RPN-to-infix-conversion/Phix/parsing-rpn-to-infix-conversion.phix b/Task/Parsing-RPN-to-infix-conversion/Phix/parsing-rpn-to-infix-conversion.phix new file mode 100644 index 0000000000..943ec88773 --- /dev/null +++ b/Task/Parsing-RPN-to-infix-conversion/Phix/parsing-rpn-to-infix-conversion.phix @@ -0,0 +1,71 @@ +integer show_workings = 1 + +constant operators = {"^","*","/","+","-"}, + precedence = { 4, 3, 3, 2, 2 }, + rassoc = {'r', 0 ,'l', 0 ,'l'} + +procedure parseRPN(string expr, string expected) +sequence stack = {} +sequence ops = split(expr) +string lhs, rhs +integer lprec,rprec + printf(1,"Postfix input: %-30s%s", {expr,iff(show_workings?'\n':'\t')}) + if length(ops)=0 then ?"error" return end if + for i=1 to length(ops) do + string op = ops[i] + integer k = find(op,operators) + if k=0 then + stack = append(stack,{9,op}) + else + if length(stack)<2 then ?"error" return end if + {rprec,rhs} = stack[$]; stack = stack[1..$-1] + {lprec,lhs} = stack[$] + integer prec = precedence[k] + integer assoc = rassoc[k] + if lprec) { stack << [3, [p(x,3), w, p(y,3)].join(' ')] } + when (<+ ->) { stack << [2, [p(x,2), w, p(y,2)].join(' ')] } + } + say stack; + } + }; + '-'*17 -> say; + stack.map{_[1]}; +} + +var tests = [ + '3 4 2 * 1 5 - 2 3 ^ ^ / +', + '1 2 + 3 4 + ^ 5 6 + ^', +]; + +tests.each { say rpm_to_infix(_).join(' ') } diff --git a/Task/Parsing-Shunting-yard-algorithm/Ceylon/parsing-shunting-yard-algorithm.ceylon b/Task/Parsing-Shunting-yard-algorithm/Ceylon/parsing-shunting-yard-algorithm.ceylon new file mode 100644 index 0000000000..e654e13443 --- /dev/null +++ b/Task/Parsing-Shunting-yard-algorithm/Ceylon/parsing-shunting-yard-algorithm.ceylon @@ -0,0 +1,106 @@ +import ceylon.collection { + + ArrayList +} + +abstract class Token(String|Integer data) of IntegerLiteral | Operator | leftParen | rightParen { + string => data.string; +} +class IntegerLiteral(shared Integer integer) extends Token(integer) {} +class Operator extends Token { + + shared Integer precedence; + shared Boolean rightAssoc; + + shared new plus extends Token("+") { + precedence = 2; + rightAssoc = false; + } + shared new minus extends Token("-") { + precedence = 2; + rightAssoc = false; + } + shared new times extends Token("*") { + precedence = 3; + rightAssoc = false; + } + shared new divides extends Token("/") { + precedence = 3; + rightAssoc = false; + } + shared new power extends Token("^") { + precedence = 4; + rightAssoc = true; + } + + shared Boolean below(Operator other) => + !rightAssoc && precedence <= other.precedence || rightAssoc && precedence < other.precedence; +} +object leftParen extends Token("(") {} +object rightParen extends Token(")") {} + + +shared void run() { + + function shunt(String input) { + + function tokenize(String input) => + input.split().map((String element) => + switch(element.trimmed) + case("(") leftParen + case(")") rightParen + case("+") Operator.plus + case("-") Operator.minus + case("*") Operator.times + case("/") Operator.divides + case("^") Operator.power + else IntegerLiteral(parseInteger(element) else 0)); // no error handling + + value outputQueue = ArrayList(); + value operatorStack = ArrayList(); + + void report(String action) { + print("``action.padTrailing(22)`` | ``" ".join(outputQueue).padTrailing(25)`` | ``" ".join(operatorStack).padTrailing(10)``"); + } + + print("input is ``input``\n"); + print("Action | Output Queue | Operators' Stack + -----------------------|---------------------------|-----------------"); + + for(token in tokenize(input)) { + switch(token) + case(is IntegerLiteral) { + outputQueue.offer(token); + report("``token`` from input to queue"); + } + case(leftParen) { + operatorStack.push(token); + report("``token`` from input to stack"); + } + case(rightParen){ + while(exists top = operatorStack.pop(), top != leftParen) { + outputQueue.offer(top); + report("``top`` from stack to queue"); + } + } + case(is Operator) { + while(exists top = operatorStack.top, is Operator top, token.below(top)) { + operatorStack.pop(); + outputQueue.offer(top); + report("``top`` from stack to queue"); + } + operatorStack.push(token); + report("``token`` from input to stack"); + } + } + while(exists top = operatorStack.pop()) { + outputQueue.offer(top); + report("``top`` from stack to queue"); + } + return " ".join(outputQueue); + } + + value rpn = shunt("3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3"); + assert(rpn == "3 4 2 * 1 5 - 2 3 ^ ^ / +"); + print("\nthe result is ``rpn``"); +} diff --git a/Task/Parsing-Shunting-yard-algorithm/EchoLisp/parsing-shunting-yard-algorithm.echolisp b/Task/Parsing-Shunting-yard-algorithm/EchoLisp/parsing-shunting-yard-algorithm.echolisp new file mode 100644 index 0000000000..8f1eb2e851 --- /dev/null +++ b/Task/Parsing-Shunting-yard-algorithm/EchoLisp/parsing-shunting-yard-algorithm.echolisp @@ -0,0 +1,52 @@ +(require 'hash) +(require 'tree) + +(define OPS (make-hash)) +(hash-set OPS "^" '( 4 #f)) ;; right assoc +(hash-set OPS "*" '( 3 #t)) ;; left assoc +(hash-set OPS "/" '( 3 #t)) +(hash-set OPS "+" '( 2 #t)) +(hash-set OPS "-" '( 2 #t)) + +;; helpers +(define (is-right-par? token) (string=? token ")")) +(define (is-left-par? token) (string=? token "(")) +(define (is-num? op) (not (hash-ref OPS op))) ;; crude +(define (is-op? op) (hash-ref OPS op)) +(define (is-left? op) (second (hash-ref OPS op))) +(define (is-right? op) (not (is-left? op))) +(define (op-prec op) (first (hash-ref OPS op))) + +;; Wikipedia algorithm, translated as it is + +(define (shunt tokens S Q) + (for ((token tokens)) + (writeln "S: " (stack->list S) "Q: " (queue->list Q) "token: "token) + (cond + [(is-left-par? token) (push S token) ] + [(is-right-par? token) + (while (and (stack-top S) (not (is-left-par? (stack-top S)))) + (q-push Q ( pop S))) + (when (stack-empty? S) (error 'misplaced-parenthesis "()" )) + (pop S)] ; // left par + + [(is-op? token) + (while (and + (is-op? (stack-top S)) + (or + (and (is-left? token) (<= (op-prec token) (op-prec (stack-top S)))) + (and (is-right? token) (< (op-prec token) (op-prec (stack-top S)))))) + (q-push Q (pop S))) + (push S token)] + + [(is-num? token) (q-push Q token)] + [else (error 'bad-token token)])) ; for + (while (stack-top S) (q-push Q (pop S)))) + +(string-delimiter "") +(define (task infix) + (define S (stack 'S)) + (define Q (queue 'Q)) + (shunt (text-parse infix) S Q) + (writeln 'infix infix) + (writeln 'RPN (queue->list Q))) diff --git a/Task/Parsing-Shunting-yard-algorithm/Phix/parsing-shunting-yard-algorithm.phix b/Task/Parsing-Shunting-yard-algorithm/Phix/parsing-shunting-yard-algorithm.phix new file mode 100644 index 0000000000..6b847c7ece --- /dev/null +++ b/Task/Parsing-Shunting-yard-algorithm/Phix/parsing-shunting-yard-algorithm.phix @@ -0,0 +1,82 @@ +integer show_workings = 1 + +constant operators = {"^","*","/","+","-"}, + precedence = { 4, 3, 3, 2, 2 } + +procedure shunting_yard(string infix, string rpn) +string res = "", sep = "", top +sequence stack = {} +--sequence ops = split(infix) -- (only works if () properly spaced) +sequence ops = split(substitute_all(infix,{"(",")"},{" ( "," ) "}),' ',0,1) + printf(1,"Infix input: %-30s%s", {infix,iff(show_workings?'\n':'\t')}) + for i=1 to length(ops) do + string op = ops[i] + if op="(" then + stack = append(stack,op) + elsif op=")" then + while 1 do + top = stack[$] + stack = stack[1..$-1] + if top="(" then exit end if + res &= sep&top + sep = " " + end while + else + integer k = find(op,operators) + if k!=0 then + integer prec = precedence[k] + while length(stack) do + top = stack[$] + k = find(top,operators) + if k=0 or prec>precedence[k] + or (top="^" and prec=precedence[k]) then + exit + end if + stack = stack[1..$-1] + res &= sep&top + sep = " " + end while + stack = append(stack,op) + else + res &= sep&op + sep = " " + end if + end if + if show_workings then + ?{op,stack,res} + end if + end for + for i=length(stack) to 1 by -1 do + string op = stack[i] + res &= sep&op + sep = " " + end for + printf(1,"result: %-22s [%s]\n", {res,iff(res=rpn?"ok","**ERROR**")}) +end procedure + +shunting_yard("3 + 4 * 2 / (1 - 5) ^ 2 ^ 3","3 4 2 * 1 5 - 2 3 ^ ^ / +") +show_workings = 0 +shunting_yard("((1 + 2) ^ (3 + 4)) ^ (5 + 6)","1 2 + 3 4 + ^ 5 6 + ^") +shunting_yard("(1 + 2) ^ (3 + 4) ^ (5 + 6)","1 2 + 3 4 + 5 6 + ^ ^") +shunting_yard("((3 ^ 4) ^ 2 ^ 9) ^ 2 ^ 5","3 4 ^ 2 9 ^ ^ 2 5 ^ ^") +shunting_yard("(1 + 4) * (5 + 3) * 2 * 3","1 4 + 5 3 + * 2 * 3 *") +shunting_yard("1 * 2 * 3 * 4","1 2 * 3 * 4 *") +shunting_yard("1 + 2 + 3 + 4","1 2 + 3 + 4 +") +shunting_yard("(1 + 2) ^ (3 + 4)","1 2 + 3 4 + ^") +shunting_yard("(5 ^ 6) ^ 7","5 6 ^ 7 ^") +shunting_yard("5 ^ 4 ^ 3 ^ 2","5 4 3 2 ^ ^ ^") +shunting_yard("1 + 2 + 3","1 2 + 3 +") +shunting_yard("1 ^ 2 ^ 3","1 2 3 ^ ^") +shunting_yard("(1 ^ 2) ^ 3","1 2 ^ 3 ^") +shunting_yard("1 - 1 + 3","1 1 - 3 +") +shunting_yard("3 + 1 - 1","3 1 + 1 -") +shunting_yard("1 - (2 + 3)","1 2 3 + -") +shunting_yard("4 + 3 + 2","4 3 + 2 +") +shunting_yard("5 + 4 + 3 + 2","5 4 + 3 + 2 +") +shunting_yard("5 * 4 * 3 * 2","5 4 * 3 * 2 *") +shunting_yard("5 + 4 - (3 + 2)","5 4 + 3 2 + -") +shunting_yard("3 - 4 * 5","3 4 5 * -") +shunting_yard("3 * (4 - 5)","3 4 5 - *") +shunting_yard("(3 - 4) * 5","3 4 - 5 *") +shunting_yard("4 * 2 + 1 - 5","4 2 * 1 + 5 -") +shunting_yard("4 * 2 / (1 - 5) ^ 2","4 2 * 1 5 - 2 ^ /") diff --git a/Task/Parsing-Shunting-yard-algorithm/Sidef/parsing-shunting-yard-algorithm.sidef b/Task/Parsing-Shunting-yard-algorithm/Sidef/parsing-shunting-yard-algorithm.sidef new file mode 100644 index 0000000000..411d074441 --- /dev/null +++ b/Task/Parsing-Shunting-yard-algorithm/Sidef/parsing-shunting-yard-algorithm.sidef @@ -0,0 +1,50 @@ +var prec = Hash( + '^' => 4, + '*' => 3, + '/' => 3, + '+' => 2, + '-' => 2, + '(' => 1, +); + +var assoc = Hash( + '^' => 'right', + '*' => 'left', + '/' => 'left', + '+' => 'left', + '-' => 'left', +); + +func shunting_yard(prog) { + var inp = prog.words; + var ops = []; + var res = []; + + func report (op) { printf("%25s %-7s %10s %s\n", res.join(' '), ops.join(' '), op, inp.join(' ')) } + func shift (t) { report( "shift #{t}"); ops << t } + func reduce (t) { report("reduce #{t}"); res << t } + + while (inp) { + given(var t = inp.shift) { + when (/\d/) { reduce(t) } + when ('(') { shift(t) } + when (')') { var x; while (ops && (x = ops.pop) && (x != '(')) { reduce(x) } } + default { + var newprec = prec{t}; + while (ops) { + var oldprec = prec{ops[-1]}; + + break if (newprec > oldprec) + break if ((newprec == oldprec) && (assoc{t} == 'right')) + + reduce(ops.pop); + } + shift(t); + } + } + } + while (ops) { reduce(ops.pop) } + return res +} + +say shunting_yard('3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3').join(' '); diff --git a/Task/Parsing-Shunting-yard-algorithm/Swift/parsing-shunting-yard-algorithm.swift b/Task/Parsing-Shunting-yard-algorithm/Swift/parsing-shunting-yard-algorithm.swift new file mode 100644 index 0000000000..236a348b30 --- /dev/null +++ b/Task/Parsing-Shunting-yard-algorithm/Swift/parsing-shunting-yard-algorithm.swift @@ -0,0 +1,175 @@ +import Foundation + +// Using arrays for both stack and queue +struct Stack { + private(set) var elements = [T]() + var isEmpty: Bool { return elements.isEmpty } + + mutating func push(newElement: T) { + elements.append(newElement) + } + + mutating func pop() -> T { + return elements.removeLast() + } + + func top() -> T? { + return elements.last + } +} + +struct Queue { + private(set) var elements = [T]() + var isEmpty: Bool { return elements.isEmpty } + + mutating func enqueue(newElement: T) { + elements.append(newElement) + } + + mutating func dequeue() -> T { + return elements.removeFirst() + } +} + +enum Associativity { case Left, Right } + +// Define abstract interface, which can be used to restrict Set extension +protocol OperatorType: Comparable, Hashable { + var name: String { get } + var precedence: Int { get } + var associativity: Associativity { get } +} + +struct Operator: OperatorType { + let name: String + let precedence: Int + let associativity: Associativity + // same operator names are not allowed + var hashValue: Int { return "\(name)".hashValue } + + init(_ name: String, _ precedence: Int, _ associativity: Associativity) { + self.name = name; self.precedence = precedence; self.associativity = associativity + } +} + +func ==(x: Operator, y: Operator) -> Bool { + // same operator names are not allowed + return x.name == y.name +} + +func <(x: Operator, y: Operator) -> Bool { + // compare operators by their precedence and associavity + return (x.associativity == .Left && x.precedence == y.precedence) || x.precedence < y.precedence +} + +extension Set where Element: OperatorType { + func contains(op: String?) -> Bool { + guard let operatorName = op else { return false } + return contains { $0.name == operatorName } + } + + subscript (operatorName: String) -> Element? { + get { + return filter { $0.name == operatorName }.first + } + } +} + +// Convenience +extension String { + var isNumber: Bool { return Double(self) != nil } +} + +struct ShuntingYard { + enum Error: ErrorType { + case MismatchedParenthesis(String) + case UnrecognizedToken(String) + } + + static func parse(input: String, operators: Set) throws -> String { + var stack = Stack() + var output = Queue() + let tokens = input.componentsSeparatedByString(" ") + + for token in tokens { + // Wikipedia: if token is a number add it to the output queue + if token.isNumber { + output.enqueue(token) + } + // Wikipedia: else if token is a operator: + else if operators.contains(token) { + // Wikipedia: while there is a operator on top of the stack and has lower precedence than current operator (token) + while operators.contains(stack.top()) && hasLowerPrecedence(token, stack.top()!, operators) { + // Wikipedia: pop it off to the output queue + output.enqueue(stack.pop()) + } + // Wikipedia: push current operator (token) onto the operator stack + stack.push(token) + } + // Wikipedia: If the token is a left parenthesis, then push it onto the stack. + else if token == "(" { + stack.push(token) + } + // Wikipedia: If the token is a right parenthesis: + else if token == ")" { + // Wikipedia: Until the token at the top of the stack is a left parenthesis + while !stack.isEmpty && stack.top() != "(" { + // Wikipedia: pop operators off the stack onto the output queue. + output.enqueue(stack.pop()) + } + + // If the stack runs out, than there are mismatched parentheses. + if stack.isEmpty { + throw Error.MismatchedParenthesis(input) + } + + // Wikipedia: Pop the left parenthesis from the stack, but not onto the output queue. + stack.pop() + } + // if token is not number, operator or a parenthesis, then is not recognized + else { + throw Error.UnrecognizedToken(token) + } + } + + // Wikipedia: When there are no more tokens to read: + + // Wikipedia: While there are still operator tokens in the stack: + while operators.contains(stack.top()) { + // Wikipedia: Pop the operator onto the output queue. + output.enqueue(stack.pop()) + } + + // Wikipedia: If the operator token on the top of the stack is a parenthesis, then there are mismatched parentheses + // Note: Assume that all operators has been poped onto the output queue. + if stack.isEmpty == false { + throw Error.MismatchedParenthesis(input) + } + + return output.elements.joinWithSeparator(" ") + } + + static private func containsOperator(stack: Stack, _ operators: [String: NSDictionary]) -> Bool { + guard stack.isEmpty == false else { return false } + // Is there a matching operator in the operators set? + return operators[stack.top()!] != nil ? true : false + } + + static private func hasLowerPrecedence(x: String, _ y: String, _ operators: Set) -> Bool { + guard let first = operators[x], let second = operators[y] else { return false } + return first < second + } +} + +let input = "3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3" +let operators: Set = [ + Operator("^", 4, .Right), + Operator("*", 3, .Left), + Operator("/", 3, .Left), + Operator("+", 2, .Left), + Operator("-", 2, .Left) +] +let output = try! ShuntingYard.parse(input, operators: operators) + +print("input: \(input)") +print("output: \(output)") diff --git a/Task/Partial-function-application/Ceylon/partial-function-application.ceylon b/Task/Partial-function-application/Ceylon/partial-function-application.ceylon new file mode 100644 index 0000000000..8c1ae28f39 --- /dev/null +++ b/Task/Partial-function-application/Ceylon/partial-function-application.ceylon @@ -0,0 +1,17 @@ +shared void run() { + + function fs(Integer f(Integer n), {Integer*} s) => s.map(f); + + function f1(Integer n) => n * 2; + function f2(Integer n) => n ^ 2; + + value fsCurried = curry(fs); + value fsf1 = fsCurried(f1); + value fsf2 = fsCurried(f2); + + value ints = 0..3; + print("fsf1(``ints``) is ``fsf1(ints)`` and fsf2(``ints``) is ``fsf2(ints)``"); + + value evens = (2..8).by(2); + print("fsf1(``evens``) is ``fsf1(evens)`` and fsf2(``evens``) is ``fsf2(evens)``"); +} diff --git a/Task/Partial-function-application/Egison/partial-function-application-1.egison b/Task/Partial-function-application/Egison/partial-function-application-1.egison new file mode 100644 index 0000000000..daafdcc040 --- /dev/null +++ b/Task/Partial-function-application/Egison/partial-function-application-1.egison @@ -0,0 +1,12 @@ +(define $fs (map $1 $2)) + +(define $f1 (* $ 2)) +(define $f2 (power $ 2)) + +(define $fsf1 (fs f1 $)) +(define $fsf2 (fs f2 $)) + +(test (fsf1 {0 1 2 3})) +(test (fsf2 {0 1 2 3})) +(test (fsf1 {2 4 6 8})) +(test (fsf2 {2 4 6 8})) diff --git a/Task/Partial-function-application/Egison/partial-function-application-2.egison b/Task/Partial-function-application/Egison/partial-function-application-2.egison new file mode 100644 index 0000000000..57e20bc826 --- /dev/null +++ b/Task/Partial-function-application/Egison/partial-function-application-2.egison @@ -0,0 +1,4 @@ +{0 2 4 6} +{0 1 4 9} +{4 8 12 16} +{4 16 36 64} diff --git a/Task/Partial-function-application/FunL/partial-function-application.funl b/Task/Partial-function-application/FunL/partial-function-application.funl new file mode 100644 index 0000000000..55f2de855a --- /dev/null +++ b/Task/Partial-function-application/FunL/partial-function-application.funl @@ -0,0 +1,11 @@ +fs = map +f1 = (* 2) +f2 = (^ 2) + +fsf1 = fs.curry( f1 ) +fsf2 = fs.curry( f2 ) + +println( fsf1(0..3) ) +println( fsf2(0..3) ) +println( fsf1(2..8 by 2) ) +println( fsf2(2..8 by 2) ) diff --git a/Task/Partial-function-application/LFE/partial-function-application-1.lfe b/Task/Partial-function-application/LFE/partial-function-application-1.lfe new file mode 100644 index 0000000000..d9ae49b402 --- /dev/null +++ b/Task/Partial-function-application/LFE/partial-function-application-1.lfe @@ -0,0 +1,20 @@ +(defun partial + "The partial function is arity 2 where the first parameter must be a + function and the second parameter may either be a single item or a list of + items. + + When funcall is called against the result of the partial call, a second + parameter is applied to the partial function. This parameter too may be + either a single item or a list of items." + ((func args-1) (when (is_list args-1)) + (match-lambda + ((args-2) (when (is_list args-2)) + (apply func (++ args-1 args-2))) + ((arg-2) + (apply func (++ args-1 `(,arg-2)))))) + ((func arg-1) + (match-lambda + ((args-2) (when (is_list args-2)) + (apply func (++ `(,arg-1) args-2))) + ((arg-2) + (funcall func arg-1 arg-2))))) diff --git a/Task/Partial-function-application/LFE/partial-function-application-2.lfe b/Task/Partial-function-application/LFE/partial-function-application-2.lfe new file mode 100644 index 0000000000..b17a3f47e6 --- /dev/null +++ b/Task/Partial-function-application/LFE/partial-function-application-2.lfe @@ -0,0 +1,17 @@ +(defun fs (f s) (lists:map f s)) +(defun f1 (i) (* i 2)) +(defun f2 (i) (math:pow i 2)) + +(set fsf1 (partial #'fs/2 #'f1/1)) +(set fsf2 (partial #'fs/2 #'f2/1)) +(set seq1 '((0 1 2 3))) +(set seq2 '((2 4 6 8))) + +> (funcall fsf1 seq1) +(0 2 4 6) +> (funcall fsf2 seq1) +(0.0 1.0 4.0 9.0) +> (funcall fsf1 seq2) +(4 8 12 16) +> (funcall fsf2 seq2) +(4.0 16.0 36.0 64.0) diff --git a/Task/Partial-function-application/Oforth/partial-function-application.oforth b/Task/Partial-function-application/Oforth/partial-function-application.oforth new file mode 100644 index 0000000000..4daa465a98 --- /dev/null +++ b/Task/Partial-function-application/Oforth/partial-function-application.oforth @@ -0,0 +1,6 @@ +: fs(s, f) f s map ; +: f1 2 * ; +: f2 sq ; + +#f1 #fs curry => fsf1 +#f2 #fs curry => fsf2 diff --git a/Task/Partial-function-application/Sidef/partial-function-application.sidef b/Task/Partial-function-application/Sidef/partial-function-application.sidef new file mode 100644 index 0000000000..73aefb9f7b --- /dev/null +++ b/Task/Partial-function-application/Sidef/partial-function-application.sidef @@ -0,0 +1,19 @@ +func fs(f) { + func(*args) { + args.map {f(_)} + } +} + +func double(n) { n * 2 }; +func square(n) { n ** 2 }; + +var fs_double = fs(double); +var fs_square = fs(square); + +var s = (0 .. 3); +say "fs_double(#{s}): #{fs_double(s...)}"; +say "fs_square(#{s}): #{fs_square(s...)}"; + +s = [2, 4, 6, 8]; +say "fs_double(#{s}): #{fs_double(s...)}"; +say "fs_square(#{s}): #{fs_square(s...)}"; diff --git a/Task/Pascals-triangle-Puzzle/Nim/pascals-triangle-puzzle.nim b/Task/Pascals-triangle-Puzzle/Nim/pascals-triangle-puzzle.nim new file mode 100644 index 0000000000..15f13f8ea1 --- /dev/null +++ b/Task/Pascals-triangle-Puzzle/Nim/pascals-triangle-puzzle.nim @@ -0,0 +1,66 @@ +import math, strutils + +var B_X, B_Y, B_Z : int = 0 + +type + Block_Value = object + Known : int + X, Y, Z : int + +let + X: Block_Value = Block_Value(Known:0, X:1, Y:0, Z:0) + Y: Block_Value = Block_Value(Known:0, X:0, Y:1, Z:0) + Z: Block_Value = Block_Value(Known:0, X:0, Y:0, Z:1) + +proc Add (L : var Block_Value, R : Block_Value) = + # Symbolically adds one block to another + L.Known = L.Known + R.Known + L.X = L.X + R.X - R.Z # Z is excluded as n(Y - X - Z) = 0 + L.Y = L.Y + R.Y + R.Z + +proc Add (L: var Block_Value, R: int) = + # Symbolically adds a value to the block + L.Known = L.Known + R + +proc Image (N : Block_Value): string = + # The block value, when X,Y,Z are known + result = $(N.Known + N.X * B_X + N.Y * B_Y + N.Z * B_Z) + +proc Solve_2x2 (A11: int, A12:int, B1:int, A21:int, A22:int, B2: int) = + # Don't care about things, supposing an integer solution exists + if A22 == 0: + B_X = toInt(B2 / A21) + B_Y = toInt((B1 - (A11*B_X)) / A12) + else: + B_X = toInt((B1*A22 - B2*A12) / (A11*A22 - A21*A12)) + B_Y = toInt((B1 - A11*B_X) / A12) + B_Z = B_Y - B_X + +var B : array [1..5, array[1..5, Block_Value]] # The lower triangle contains blocks + +# The bottom blocks +Add(B[5][1],X) +Add(B[5][2],11) +Add(B[5][3],Y) +Add(B[5][4],4) +Add(B[5][5],Z) + +# Upward run +for Row in countdown(4,1): + for Column in 1 .. Row: + Add (B[Row][Column], B[Row + 1][Column]) + Add (B[Row][Column], B[Row + 1][Column + 1]) + +# Now have known blocks 40=[3][1], 151=[1][1] and Y=X+Z to determine X,Y,Z +Solve_2x2( B[1][1].X, + B[1][1].Y, + 151 - B[1][1].Known, + B[3][1].X, + B[3][1].Y, + 40 - B[3][1].Known) + +#Print the results +for Row in 1..5: + writeln(stdout,"") + for Column in 1..Row: + write(stdout, Image(B[Row][Column]), " ") diff --git a/Task/Pascals-triangle-Puzzle/Sidef/pascals-triangle-puzzle.sidef b/Task/Pascals-triangle-Puzzle/Sidef/pascals-triangle-puzzle.sidef new file mode 100644 index 0000000000..a432d99477 --- /dev/null +++ b/Task/Pascals-triangle-Puzzle/Sidef/pascals-triangle-puzzle.sidef @@ -0,0 +1,47 @@ +# set up triangle +var rows = 5; +var tri = rows.of {|i| i.of { Hash(x => 0, z => 0, v => 0, rhs => nil) } } +tri[0][0]{:rhs} = 151; +tri[2][0]{:rhs} = 40; +tri[4][0]{:x} = 1; +tri[4][1]{:v} = 11; +tri[4][2]{:x} = 1; +tri[4][2]{:z} = 1; +tri[4][3]{:v} = 4; +tri[4][4]{:z} = 1; + +# aggregate from bottom to top +for row in (tri.end -> downto(1)) { + for col in (tri[row-1].range) { + [:x, :z, :v].each { |key| + tri[row-1][col]{key} = (tri[row][col]{key} + tri[row][col+1]{key}) + } + } +} + +# find equations +var eqn = gather { + for r in tri { + for c in r { + take([c{:x}, c{:z}, c{:rhs} - c{:v}]) if defined(c{:rhs}) + } + } +} + +# print equations +say "Equations:"; +say " x + z = y"; +for x,z,y in eqn { say "#{x}x + #{z}z = #{y}" } + +# solve +var f = (eqn[0][1] / eqn[1][1]); +for i in (0..2) { eqn[0][i] -= (f * eqn[1][i]) } +f = (eqn[1][0] / eqn[0][0]); +for i in (0..2) { eqn[1][i] -= (f * eqn[0][i]) } + +# print solution +say "Solution:"; +var x = (eqn[0][2] / eqn[0][0]); +var z = (eqn[1][2] / eqn[1][1]); +var y = (x + z); +say "x=#{x}, y=#{y}, z=#{z}"; diff --git a/Task/Pascals-triangle/8th/pascals-triangle-1.8th b/Task/Pascals-triangle/8th/pascals-triangle-1.8th new file mode 100644 index 0000000000..a0cf18118b --- /dev/null +++ b/Task/Pascals-triangle/8th/pascals-triangle-1.8th @@ -0,0 +1,15 @@ +\ print the array +: .arr \ a -- a + ( . space ) a:each ; + +: pasc \ a -- + \ print the row + .arr cr + dup + \ create two rows from the first, one with a leading the other with a trailing 0 + [0] 0 a:insert swap 0 a:push + \ add the arrays together to make the new one + ' n:+ a:op ; + +\ print the first 16 rows: +[1] ' pasc 16 times diff --git a/Task/Pascals-triangle/8th/pascals-triangle-2.8th b/Task/Pascals-triangle/8th/pascals-triangle-2.8th new file mode 100644 index 0000000000..7fa59d9ef4 --- /dev/null +++ b/Task/Pascals-triangle/8th/pascals-triangle-2.8th @@ -0,0 +1,21 @@ +: ratio \ m n -- num denom + tuck n:- n:1+ swap ; + +\ one item in the row: n m +: pascitem \ n m -- n + r@ swap + ratio + n:*/ n:round int + dup . space ; + +\ One row of Pascal's triangle +: pascline \ n -- + >r 1 int dup . space + ' pascitem + 1 r@ loop rdrop drop cr ; + +\ Calculate the first 'n' rows of Pascal's triangle: +: pasc \ n + ' pascline 0 rot loop cr ; + +15 pasc diff --git a/Task/Pascals-triangle/ERRE/pascals-triangle.erre b/Task/Pascals-triangle/ERRE/pascals-triangle.erre new file mode 100644 index 0000000000..41f4a8ce5a --- /dev/null +++ b/Task/Pascals-triangle/ERRE/pascals-triangle.erre @@ -0,0 +1,17 @@ +PROGRAM PASCAL_TRIANGLE + +PROCEDURE PASCAL(R%) + LOCAL I%,C%,K% + FOR I%=0 TO R%-1 DO + C%=1 + FOR K%=0 TO I% DO + WRITE("###";C%;) + C%=(C%*(I%-K%)) DIV (K%+1) + END FOR + PRINT + END FOR +END PROCEDURE + +BEGIN + PASCAL(9) +END PROGRAM diff --git a/Task/Pascals-triangle/FreeBASIC/pascals-triangle.freebasic b/Task/Pascals-triangle/FreeBASIC/pascals-triangle.freebasic new file mode 100644 index 0000000000..70efe231f3 --- /dev/null +++ b/Task/Pascals-triangle/FreeBASIC/pascals-triangle.freebasic @@ -0,0 +1,37 @@ +' FB 1.05.0 Win64 + +Sub pascalTriangle(n As UInteger) + If n = 0 Then Return + Dim prevRow(1 To n) As UInteger + Dim currRow(1 To n) As UInteger + Dim start(1 To n) As UInteger ''stores starting column for each row + start(n) = 1 + For i As Integer = n - 1 To 1 Step -1 + start(i) = start(i + 1) + 3 + Next + prevRow(1) = 1 + Print Tab(start(1)); + Print 1U + For i As UInteger = 2 To n + For j As UInteger = 1 To i + If j = 1 Then + Print Tab(start(i)); "1"; + currRow(1) = 1 + ElseIf j = i Then + Print " 1" + currRow(i) = 1 + Else + currRow(j) = prevRow(j - 1) + prevRow(j) + Print Using "######"; currRow(j); " "; + End If + Next j + For j As UInteger = 1 To i + prevRow(j) = currRow(j) + Next j + Next i +End Sub + +pascalTriangle(14) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Pascals-triangle/FunL/pascals-triangle-1.funl b/Task/Pascals-triangle/FunL/pascals-triangle-1.funl new file mode 100644 index 0000000000..69667ab418 --- /dev/null +++ b/Task/Pascals-triangle/FunL/pascals-triangle-1.funl @@ -0,0 +1,5 @@ +import lists.zip + +def + pascal( 1 ) = [1] + pascal( n ) = [1] + map( (a, b) -> a + b, zip(pascal(n-1), pascal(n-1).tail()) ) + [1] diff --git a/Task/Pascals-triangle/FunL/pascals-triangle-2.funl b/Task/Pascals-triangle/FunL/pascals-triangle-2.funl new file mode 100644 index 0000000000..abd343f9b8 --- /dev/null +++ b/Task/Pascals-triangle/FunL/pascals-triangle-2.funl @@ -0,0 +1,3 @@ +import integers.choose + +def pascal( n ) = [choose( n - 1, k ) | k <- 0..n-1] diff --git a/Task/Pascals-triangle/FunL/pascals-triangle-3.funl b/Task/Pascals-triangle/FunL/pascals-triangle-3.funl new file mode 100644 index 0000000000..0062ee7924 --- /dev/null +++ b/Task/Pascals-triangle/FunL/pascals-triangle-3.funl @@ -0,0 +1,11 @@ +def triangle( height ) = + width = max( map(a -> a.toString().length(), pascal(height)) ) + + if 2|width + width++ + + for n <- 1..height + print( ' '*((width + 1)\2)*(height - n) ) + println( map(a -> format('%' + width + 'd ', a), pascal(n)).mkString() ) + +triangle( 10 ) diff --git a/Task/Pascals-triangle/Nim/pascals-triangle.nim b/Task/Pascals-triangle/Nim/pascals-triangle.nim new file mode 100644 index 0000000000..22fee7c1e2 --- /dev/null +++ b/Task/Pascals-triangle/Nim/pascals-triangle.nim @@ -0,0 +1,9 @@ +import sequtils + +proc pascal(n: int) = + var row = @[1] + for r in 1..n: + echo row + row = zip(row & @[0], @[0] & row).mapIt(int, it[0] + it[1]) + +pascal(10) diff --git a/Task/Pascals-triangle/Oforth/pascals-triangle.oforth b/Task/Pascals-triangle/Oforth/pascals-triangle.oforth new file mode 100644 index 0000000000..e2ddce0cb3 --- /dev/null +++ b/Task/Pascals-triangle/Oforth/pascals-triangle.oforth @@ -0,0 +1 @@ +: pascal(n) [ 1 ] #[ dup println dup 0 + 0 rot + zipWith(#+) ] times(n) drop ; diff --git a/Task/Pascals-triangle/Phix/pascals-triangle.phix b/Task/Pascals-triangle/Phix/pascals-triangle.phix new file mode 100644 index 0000000000..99b3b28ea9 --- /dev/null +++ b/Task/Pascals-triangle/Phix/pascals-triangle.phix @@ -0,0 +1,12 @@ +sequence row = {} +for m = 1 to 13 do + row = row & 1 + for n=length(row)-1 to 2 by -1 do + row[n] += row[n-1] + end for + printf(1,repeat(' ',(13-m)*2)) + for i=1 to length(row) do + printf(1," %3d",row[i]) + end for + puts(1,'\n') +end for diff --git a/Task/Pascals-triangle/Potion/pascals-triangle.potion b/Task/Pascals-triangle/Potion/pascals-triangle.potion new file mode 100644 index 0000000000..06cde87a16 --- /dev/null +++ b/Task/Pascals-triangle/Potion/pascals-triangle.potion @@ -0,0 +1,18 @@ +printpascal = (n) : + if (n < 1) : + 1 print + (1) + . else : + prev = printpascal(n - 1) + prev append(0) + curr = (1) + n times (i): + curr append(prev(i) + prev(i + 1)) + . + "\n" print + curr join(", ") print + curr + . +. + +printpascal(read number integer) diff --git a/Task/Pascals-triangle/Ring/pascals-triangle.ring b/Task/Pascals-triangle/Ring/pascals-triangle.ring new file mode 100644 index 0000000000..5b03b4adac --- /dev/null +++ b/Task/Pascals-triangle/Ring/pascals-triangle.ring @@ -0,0 +1,10 @@ +row = 5 +for i = 0 to row - 1 + col = 1 + see left(" ",row-i) + for k = 0 to i + see "" + col + " " + col = col*(i-k)/(k+1) + next + see nl +next diff --git a/Task/Pascals-triangle/Sidef/pascals-triangle.sidef b/Task/Pascals-triangle/Sidef/pascals-triangle.sidef new file mode 100644 index 0000000000..2796f00d46 --- /dev/null +++ b/Task/Pascals-triangle/Sidef/pascals-triangle.sidef @@ -0,0 +1,9 @@ +func pascal(rows) { + var row = [1]; + { | n| + say row.join(' '); + row = [1, 0..(n-2).map {|i| row[i] + row[i+1] }..., 1]; + } * rows; +} + +pascal(10); diff --git a/Task/Pascals-triangle/jq/pascals-triangle-1.jq b/Task/Pascals-triangle/jq/pascals-triangle-1.jq new file mode 100644 index 0000000000..94a85fffe2 --- /dev/null +++ b/Task/Pascals-triangle/jq/pascals-triangle-1.jq @@ -0,0 +1,11 @@ +# pascal(n) for n>=0; pascal(0) emits an empty stream. +def pascal(n): + def _pascal: # input: the previous row + . as $in + | ., + if length >= n then empty + else + reduce range(0;length-1) as $i + ([1]; . + [ $in[$i] + $in[$i + 1] ]) + [1] | _pascal + end; + if n <= 0 then empty else [1] | _pascal end ; diff --git a/Task/Pascals-triangle/jq/pascals-triangle-2.jq b/Task/Pascals-triangle/jq/pascals-triangle-2.jq new file mode 100644 index 0000000000..81a738503f --- /dev/null +++ b/Task/Pascals-triangle/jq/pascals-triangle-2.jq @@ -0,0 +1,6 @@ +$ jq -c -n -f pascal_triangle.jq +[1] +[1,1] +[1,2,1] +[1,3,3,1] +[1,4,6,4,1] diff --git a/Task/Pascals-triangle/jq/pascals-triangle-3.jq b/Task/Pascals-triangle/jq/pascals-triangle-3.jq new file mode 100644 index 0000000000..ce7b0d5536 --- /dev/null +++ b/Task/Pascals-triangle/jq/pascals-triangle-3.jq @@ -0,0 +1,9 @@ +def pascal(n): + if n <= 0 then empty + else [1] + | recurse( if length >= n then empty + else . as $in + | reduce range(0;length-1) as $i + ([1]; . + [ $in[$i] + $in[$i + 1] ]) + [1] + end) + end; diff --git a/Task/Pattern-matching/EchoLisp/pattern-matching-1.echolisp b/Task/Pattern-matching/EchoLisp/pattern-matching-1.echolisp new file mode 100644 index 0000000000..57441cec5b --- /dev/null +++ b/Task/Pattern-matching/EchoLisp/pattern-matching-1.echolisp @@ -0,0 +1,27 @@ +;; code adapted from Racket and Common Lisp +;; Illustrates matching on structures +(require 'match) +(require 'struct) + + +(define (N-tostring n) (format "%s %d" (N-color n) (N-value n))) +(struct N (color left value right) #:tostring N-tostring) + +(define (balance t) + (match t + [(N '⚫️ (N '🔴 (N '🔴 a x b) y c) z d) (N '🔴 (N '⚫️ a x b) y (N '⚫️ c z d))] + [(N '⚫️ (N '🔴 a x (N '🔴 b y c)) z d) (N '🔴 (N '⚫️ a x b) y (N '⚫️ c z d))] + [(N '⚫️ a x (N '🔴 (N '🔴 b y c) z d)) (N '🔴 (N '⚫️ a x b) y (N '⚫️ c z d))] + [(N '⚫️ a x (N '🔴 b y (N '🔴 c z d))) (N '🔴 (N '⚫️ a x b) y (N '⚫️ c z d))] + [else t])) + + (define (ins value: x tree: t) + (match t + ['empty (N '🔴 'empty x 'empty)] + [(N c l v r) (cond [(< x v) (balance (N c (ins x l) v r))] + [(> x v) (balance (N c l v (ins x r)))] + [else t])])) + + (define (insert value: x tree: s) + (match (ins x s) [(N _ l v r) (N '⚫️ l v r)])) + diff --git a/Task/Pattern-matching/EchoLisp/pattern-matching-2.echolisp b/Task/Pattern-matching/EchoLisp/pattern-matching-2.echolisp new file mode 100644 index 0000000000..69bd1ecee4 --- /dev/null +++ b/Task/Pattern-matching/EchoLisp/pattern-matching-2.echolisp @@ -0,0 +1,8 @@ +(define (t-show n (depth 0)) + (when (!eq? 'empty n) + (t-show (N-left n) (+ 12 depth)) + (writeln (string-pad-left (format "%s" n ) depth)) + (t-show (N-right n) (+ 12 depth)))) + +(define T (for/fold [t 'empty] ([i 32]) (insert (random 100) t))) +(t-show T) diff --git a/Task/Pattern-matching/Swift/pattern-matching.swift b/Task/Pattern-matching/Swift/pattern-matching.swift new file mode 100644 index 0000000000..877cb86004 --- /dev/null +++ b/Task/Pattern-matching/Swift/pattern-matching.swift @@ -0,0 +1,37 @@ +enum Color { case R, B } +enum Tree
{ + case E + indirect case T(Color, Tree, A, Tree) +} + +func balance(input: (Color, Tree, A, Tree)) -> Tree { + switch input { + case let (.B, .T(.R, .T(.R,a,x,b), y, c), z, d): return .T(.R, .T(.B,a,x,b), y, .T(.B,c,z,d)) + case let (.B, .T(.R, a, x, .T(.R,b,y,c)), z, d): return .T(.R, .T(.B,a,x,b), y, .T(.B,c,z,d)) + case let (.B, a, x, .T(.R, .T(.R,b,y,c), z, d)): return .T(.R, .T(.B,a,x,b), y, .T(.B,c,z,d)) + case let (.B, a, x, .T(.R, b, y, .T(.R,c,z,d))): return .T(.R, .T(.B,a,x,b), y, .T(.B,c,z,d)) + case let (col, a, x, b) : return .T(col, a, x, b) + } +} + +func insert(x: A, s: Tree) -> Tree { + func ins(s: Tree) -> Tree { + switch s { + case .E : return .T(.R,.E,x,.E) + case let .T(col,a,y,b): + if x < y { + return balance((col, ins(a), y, b)) + } else if x > y { + return balance((col, a, y, ins(b))) + } else { + return s + } + } + } + switch ins(s) { + case let .T(_,a,y,b): return .T(.B,a,y,b) + case .E: + assert(false) + return .E + } +} diff --git a/Task/Percentage-difference-between-images/Sidef/percentage-difference-between-images.sidef b/Task/Percentage-difference-between-images/Sidef/percentage-difference-between-images.sidef new file mode 100644 index 0000000000..f138f35ca5 --- /dev/null +++ b/Task/Percentage-difference-between-images/Sidef/percentage-difference-between-images.sidef @@ -0,0 +1,38 @@ +require('Imager') + +func img_diff(a, b) { + + func from_file(name) { + %s|Imager|.new(file => name) + } + + func size(img) { + (img.getwidth, img.getheight) + } + + func pixel_diff(p1, p2) { + [p1.rgba] »-« [p2.rgba] -> map { .abs }.sum + } + + func read_pixel(img, x, y) { + img.getpixel(x => x, y => y) + } + + var(img1, img2) = (from_file(a), from_file(b)) + + var(w1, h1) = size(img1) + var(w2, h2) = size(img2) + + if ((w1 != w2) || (h1 != h2)) { + return nil + } + + var sum = 0 + for y,x in (^h1 ~X ^w1) { + sum += pixel_diff(read_pixel(img1, x, y), read_pixel(img2, x, y)) + } + + sum / (w1 * h1 * 255 * 3) +} + +say 100*img_diff('Lenna50.jpg', 'Lenna100.jpg') diff --git a/Task/Percolation-Mean-cluster-density/EchoLisp/percolation-mean-cluster-density.echolisp b/Task/Percolation-Mean-cluster-density/EchoLisp/percolation-mean-cluster-density.echolisp new file mode 100644 index 0000000000..981ef65e25 --- /dev/null +++ b/Task/Percolation-Mean-cluster-density/EchoLisp/percolation-mean-cluster-density.echolisp @@ -0,0 +1,37 @@ +(define-constant BLACK (rgb 0 0 0.6)) +(define-constant WHITE -1) +;; sets pixels to clusterize to WHITE +;; returns bit-map vector +(define (init-C n p ) + (plot-size n n) + (define C (pixels->int32-vector )) ;; get canvas bit-map + (pixels-map (lambda (x y) (if (< (random) p) WHITE BLACK )) C) + C ) + +;; random color for new cluster +(define (new-color) + (hsv->rgb (random) 0.9 0.9)) + +;; make-region predicate +(define (in-cluster C x y) + (= (pixel-ref C x y) WHITE)) + +;; paint all adjacents to (x0,y0) with new color +(define (make-cluster C x0 y0) + (pixel-set! C x0 y0 (new-color)) + (make-region in-cluster C x0 y0)) + +;; task +(define (make-clusters (n 400) (p 0.5)) + (define Cn 0) + (define C null) + (for ((t 5)) ;; 5 iterations + (plot-clear) + (set! C (init-C n p)) + (for* ((x0 n) (y0 n)) + #:when (= (pixel-ref C x0 y0) WHITE) + (set! Cn (1+ Cn)) + (make-cluster C x0 y0))) + + (writeln 'n n 'Cn Cn 'density (// Cn (* n n) 5) ) + (vector->pixels C)) ;; to screen diff --git a/Task/Percolation-Mean-run-density/EchoLisp/percolation-mean-run-density.echolisp b/Task/Percolation-Mean-run-density/EchoLisp/percolation-mean-run-density.echolisp new file mode 100644 index 0000000000..3aeb087edc --- /dev/null +++ b/Task/Percolation-Mean-run-density/EchoLisp/percolation-mean-run-density.echolisp @@ -0,0 +1,22 @@ +;; count 1-runs - The vector is not stored +(define (runs p n) +(define ct 0) +(define run-1 #t) + (for ([i n]) + (if (< (random) p) + (set! run-1 #t) ;; 0 case + (begin ;; 1 case + (when run-1 (set! ct (1+ ct))) + (set! run-1 #f)))) + (// ct n)) + +;; mean of t counts +(define (truns p (n 1000 ) (t 1000)) + (// (for/sum ([i t]) (runs p n)) t)) + +(define (task) + (for ([p (in-range 0.1 1.0 0.2)]) + (writeln) + (writeln '🔸 'p p 'Kp (* p (- 1 p))) + (for ([n '(10 100 1000)]) + (printf "\t-- n %5d → %d" n (truns p n))))) diff --git a/Task/Percolation-Mean-run-density/Sidef/percolation-mean-run-density.sidef b/Task/Percolation-Mean-run-density/Sidef/percolation-mean-run-density.sidef new file mode 100644 index 0000000000..b768f72192 --- /dev/null +++ b/Task/Percolation-Mean-run-density/Sidef/percolation-mean-run-density.sidef @@ -0,0 +1,13 @@ +func R(n,p) { + n.of { 1.rand < p ? 1 : 0}.sum; +} + +const t = 100; +say ('t=', t); + +range(.1, .9, .2).each { |p| + printf("p= %f, K(p)= %f\n", p, p*(1-p)); + [10, 100, 1000].each { |n| + printf (" R(n, p)= %f\n", t.of { R(n, p) }.sum/n / t); + } +} diff --git a/Task/Perfect-numbers/ERRE/perfect-numbers.erre b/Task/Perfect-numbers/ERRE/perfect-numbers.erre new file mode 100644 index 0000000000..c77fa4dd86 --- /dev/null +++ b/Task/Perfect-numbers/ERRE/perfect-numbers.erre @@ -0,0 +1,19 @@ +PROGRAM PERFECT + +PROCEDURE PERFECT(N%->OK%) + LOCAL I%,S% + S%=1 + FOR I%=2 TO SQR(N%)-1 DO + IF N% MOD I%=0 THEN S%+=I%+N% DIV I% + END FOR + IF I%=SQR(N%) THEN S%+=I% + OK%=(N%=S%) +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) ! CLS + FOR N%=2 TO 10000 STEP 2 DO + PERFECT(N%->OK%) + IF OK% THEN PRINT(N%) + END FOR +END PROGRAM diff --git a/Task/Perfect-numbers/FreeBASIC/perfect-numbers.freebasic b/Task/Perfect-numbers/FreeBASIC/perfect-numbers.freebasic new file mode 100644 index 0000000000..c85a1da6ac --- /dev/null +++ b/Task/Perfect-numbers/FreeBASIC/perfect-numbers.freebasic @@ -0,0 +1,24 @@ +' FB 1.05.0 Win64 + +Function isPerfect(n As Integer) As Boolean + If n < 2 Then Return False + If n Mod 2 = 1 Then Return False '' we can assume odd numbers are not perfect + Dim As Integer sum = 1, q + For i As Integer = 2 To Sqr(n) + If n Mod i = 0 Then + sum += i + q = n \ i + If q > i Then sum += q + End If + Next + Return n = sum +End Function + +Print "The first 5 perfect numbers are : " +For i As Integer = 2 To 33550336 + If isPerfect(i) Then Print i; " "; +Next + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Perfect-numbers/FunL/perfect-numbers.funl b/Task/Perfect-numbers/FunL/perfect-numbers.funl new file mode 100644 index 0000000000..78a3606141 --- /dev/null +++ b/Task/Perfect-numbers/FunL/perfect-numbers.funl @@ -0,0 +1,3 @@ +def perfect( n ) = sum( d | d <- 1..n if d|n ) == 2n + +println( (1..500).filter(perfect) ) diff --git a/Task/Perfect-numbers/Lasso/perfect-numbers-1.lasso b/Task/Perfect-numbers/Lasso/perfect-numbers-1.lasso new file mode 100644 index 0000000000..75d5226e7e --- /dev/null +++ b/Task/Perfect-numbers/Lasso/perfect-numbers-1.lasso @@ -0,0 +1,15 @@ +#!/usr/bin/lasso9 + +define isPerfect(n::integer) => { + #n < 2 ? return false + return #n == ( + with i in generateSeries(1, math_floor(math_sqrt(#n)) + 1) + where #n % #i == 0 + let q = #n / #i + sum (#q > #i ? (#i == 1 ? 1 | #q + #i) | 0) + ) +} + +with x in generateSeries(1, 10000) + where isPerfect(#x) +select #x diff --git a/Task/Perfect-numbers/Lasso/perfect-numbers-2.lasso b/Task/Perfect-numbers/Lasso/perfect-numbers-2.lasso new file mode 100644 index 0000000000..c7d6aece0f --- /dev/null +++ b/Task/Perfect-numbers/Lasso/perfect-numbers-2.lasso @@ -0,0 +1 @@ +6, 28, 496, 8128 diff --git a/Task/Perfect-numbers/Lingo/perfect-numbers.lingo b/Task/Perfect-numbers/Lingo/perfect-numbers.lingo new file mode 100644 index 0000000000..c4df1d8f99 --- /dev/null +++ b/Task/Perfect-numbers/Lingo/perfect-numbers.lingo @@ -0,0 +1,8 @@ +on isPercect (n) + sum = 1 + cnt = n/2 + repeat with i = 2 to cnt + if n mod i = 0 then sum = sum + i + end repeat + return sum=n +end diff --git a/Task/Perfect-numbers/Nim/perfect-numbers.nim b/Task/Perfect-numbers/Nim/perfect-numbers.nim new file mode 100644 index 0000000000..d1d51d595c --- /dev/null +++ b/Task/Perfect-numbers/Nim/perfect-numbers.nim @@ -0,0 +1,12 @@ +import math + +proc isPerfect(n: int): bool = + var sum: int = 1 + for i in 2 .. <(n.toFloat.sqrt+1).toInt: + if n mod i == 0: + sum += (i + n div i) + return (n == sum) + +for i in 2..10_000: + if isPerfect(i): + echo(i) diff --git a/Task/Perfect-numbers/Oforth/perfect-numbers.oforth b/Task/Perfect-numbers/Oforth/perfect-numbers.oforth new file mode 100644 index 0000000000..f6782b3554 --- /dev/null +++ b/Task/Perfect-numbers/Oforth/perfect-numbers.oforth @@ -0,0 +1 @@ +: isPerfect(n) | i | 0 n 2 / loop: i [ n i mod ifZero: [ i + ] ] n == ; diff --git a/Task/Perfect-numbers/Phix/perfect-numbers.phix b/Task/Perfect-numbers/Phix/perfect-numbers.phix new file mode 100644 index 0000000000..63888d3004 --- /dev/null +++ b/Task/Perfect-numbers/Phix/perfect-numbers.phix @@ -0,0 +1,7 @@ +function is_perfect(integer n) + return sum(factors(n,-1))=n +end function + +for i=2 to 100000 do + if is_perfect(i) then ?i end if +end for diff --git a/Task/Perfect-numbers/Ring/perfect-numbers.ring b/Task/Perfect-numbers/Ring/perfect-numbers.ring new file mode 100644 index 0000000000..05416616e9 --- /dev/null +++ b/Task/Perfect-numbers/Ring/perfect-numbers.ring @@ -0,0 +1,11 @@ +for i = 1 to 10000 + if perfect(i) see i + nl ok +next + +func perfect n + sum = 0 + for i = 1 to n - 1 + if n % i = 0 sum = sum + i ok + next +if sum = n return 1 else return 0 ok +return sum diff --git a/Task/Perfect-numbers/Sidef/perfect-numbers-1.sidef b/Task/Perfect-numbers/Sidef/perfect-numbers-1.sidef new file mode 100644 index 0000000000..c659585b82 --- /dev/null +++ b/Task/Perfect-numbers/Sidef/perfect-numbers-1.sidef @@ -0,0 +1,11 @@ +func is_perfect(n) { + var sum = 0; + for i in (1 ..^ n) { + i.divides(n) && (sum += i); + } + sum == n; +} + +10000.times { |i| + is_perfect(i) && say i; +} diff --git a/Task/Perfect-numbers/Sidef/perfect-numbers-2.sidef b/Task/Perfect-numbers/Sidef/perfect-numbers-2.sidef new file mode 100644 index 0000000000..7e816db311 --- /dev/null +++ b/Task/Perfect-numbers/Sidef/perfect-numbers-2.sidef @@ -0,0 +1,14 @@ +func is_even_perfect(n) { + + var square = (8*n + 1) + square.is_sqr || return false + + var tp = ((square.isqrt + 1) / 2) + tp.is_pow || return false + + (tp-1).is_prime ? true : false +} + +for i in range(0, 10000, 2) { + is_even_perfect(i) && say i +} diff --git a/Task/Perfect-numbers/Swift/perfect-numbers.swift b/Task/Perfect-numbers/Swift/perfect-numbers.swift new file mode 100644 index 0000000000..8b3b82f485 --- /dev/null +++ b/Task/Perfect-numbers/Swift/perfect-numbers.swift @@ -0,0 +1,15 @@ +func perfect(n:Int) -> Bool { + var sum = 0 + for i in 1.. length or r < 0 then empty + elif r == length then . + else ( [.[0]] + (.[1:]|combination(r-1))), + ( .[1:]|combination(r)) + end; diff --git a/Task/Permutation-test/jq/permutation-test-2.jq b/Task/Permutation-test/jq/permutation-test-2.jq new file mode 100644 index 0000000000..c1330f74dd --- /dev/null +++ b/Task/Permutation-test/jq/permutation-test-2.jq @@ -0,0 +1,26 @@ +# a and b should be arrays: +def permutationTest(a; b): + + def normalize(a;b): # mainly to avoid having to compute $sumab + (a|add) as $sa + | (b|add) as $sb + | (($sa + $sb)/((a|length) + (b|length))) as $avg + | [(a | map(.-$avg)), (b | map(.-$avg))]; + + # avg(a) - avg(b) (assuming ab==a+b and avg(ab) is 0) + def statistic(ab; a): + (a | add) as $suma + # (ab|add) should be 0, by normalization + | ($suma / (a|length)) + + ($suma / ((ab|length) - (a|length))); + + normalize(a;b) + | (a + b) as $ab # pooled observations + | .[0] as $a | .[1] as $b + | statistic($ab; $a) as $t_observed # observed difference in means + | reduce ($ab|combination($a|length)) as $perm # for each combination... + ([0,0]; # state: [under,count] + if statistic($ab; $perm) <= $t_observed then .[0] += 1 else . end + | .[1] += 1 ) + | .[0] * 100.0 / .[1] # under/count +; diff --git a/Task/Permutation-test/jq/permutation-test-3.jq b/Task/Permutation-test/jq/permutation-test-3.jq new file mode 100644 index 0000000000..7785b8aa12 --- /dev/null +++ b/Task/Permutation-test/jq/permutation-test-3.jq @@ -0,0 +1,5 @@ +def treatmentGroup: [85, 88, 75, 66, 25, 29, 83, 39, 97]; +def controlGroup: [68, 41, 10, 49, 16, 65, 32, 92, 28, 98]; + +permutationTest(treatmentGroup; controlGroup) as $under +| "% under=\($under)", "% over=\(100 - $under)" diff --git a/Task/Permutations-Derangements/EchoLisp/permutations-derangements-1.echolisp b/Task/Permutations-Derangements/EchoLisp/permutations-derangements-1.echolisp new file mode 100644 index 0000000000..6a34d434af --- /dev/null +++ b/Task/Permutations-Derangements/EchoLisp/permutations-derangements-1.echolisp @@ -0,0 +1,19 @@ +(lib 'list) ;; in-permutations +(lib 'bigint) + +;; generates derangements by filtering out permutations +(define (derangement? nums) ;; predicate + (for/and ((n nums) (i (length nums))) (!= n i))) + +(define (derangements n) + (for/list ((p (in-permutations n))) #:when (derangement? p) p)) + +(define (count-derangements n) + (for/sum ((p (in-permutations n))) #:when (derangement? p) 1)) + +;; +;; !n = (n - 1) (!(n-1) + !(n-2)) + +(define (!n n) + (* (1- n) (+ (!n (1- n)) (!n (- n 2))))) +(remember '!n #(1 0)) diff --git a/Task/Permutations-Derangements/EchoLisp/permutations-derangements-2.echolisp b/Task/Permutations-Derangements/EchoLisp/permutations-derangements-2.echolisp new file mode 100644 index 0000000000..a4df9f770d --- /dev/null +++ b/Task/Permutations-Derangements/EchoLisp/permutations-derangements-2.echolisp @@ -0,0 +1,20 @@ +(derangements 4) + → ((3 0 1 2) (2 0 3 1) (2 3 0 1) (3 2 0 1) (3 2 1 0) (2 3 1 0) (1 2 3 0) (1 3 0 2) (1 0 3 2)) + +;; generated versus computed + +(for ((i 10)) (writeln i '| (count-derangements i) (!n i))) + +0 | 1 1 +1 | 0 0 +2 | 1 1 +3 | 2 2 +4 | 9 9 +5 | 44 44 +6 | 265 265 +7 | 1854 1854 +8 | 14833 14833 +9 | 133496 133496 + +(!n 20) + → 895014631192902121 diff --git a/Task/Permutations-Derangements/jq/permutations-derangements-1.jq b/Task/Permutations-Derangements/jq/permutations-derangements-1.jq new file mode 100644 index 0000000000..83d85368dc --- /dev/null +++ b/Task/Permutations-Derangements/jq/permutations-derangements-1.jq @@ -0,0 +1,24 @@ +def derangements: + + # In order to reference the original array conveniently, define _derangements(ary): + def _derangements(ary): + # We cannot put the i-th element in the i-th place: + def deranged: # state: [i, available] + .[0] as $i | .[1] as $in + | if $i == (ary|length) then [] + else + ($in[] | select (. != ary[$i])) as $j + | [$j] + ([$i+1, ($in - [$j])] | deranged) + end + ; + [0,ary]|deranged; + . as $in | _derangements($in); + +def subfact: + if . == 0 then 1 + elif . == 1 then 0 + else (.-1) * (((.-1)|subfact) + ((.-2)|subfact)) + end; + +# Avoid creating an array just to count the items in a stream: +def count(g): reduce g as $i (0; . + 1); diff --git a/Task/Permutations-Derangements/jq/permutations-derangements-2.jq b/Task/Permutations-Derangements/jq/permutations-derangements-2.jq new file mode 100644 index 0000000000..ed95a3f135 --- /dev/null +++ b/Task/Permutations-Derangements/jq/permutations-derangements-2.jq @@ -0,0 +1,7 @@ + "Derangements:", + ([range(1;5)] | derangements), + "", + "Counted vs Computed Derangments:", + (range(1;10) as $i | "\($i): \(count( [range(0;$i)] | derangements)) vs \($i|subfact)"), + "", + "Computed approximation to !20 (15 significant digits): \(20|subfact)" diff --git a/Task/Permutations-Derangements/jq/permutations-derangements-3.jq b/Task/Permutations-Derangements/jq/permutations-derangements-3.jq new file mode 100644 index 0000000000..bcef5ff414 --- /dev/null +++ b/Task/Permutations-Derangements/jq/permutations-derangements-3.jq @@ -0,0 +1,26 @@ +$ jq -n -c -r -f derangements.jq +jq -n -c -r -f derangements.jq + +Derangements: +[2,1,4,3] +[2,3,4,1] +[2,4,1,3] +[3,1,4,2] +[3,4,1,2] +[3,4,2,1] +[4,1,2,3] +[4,3,1,2] +[4,3,2,1] + +Counted vs Computed Derangments: +1: 0 vs 0 +2: 1 vs 1 +3: 2 vs 2 +4: 9 vs 9 +5: 44 vs 44 +6: 265 vs 265 +7: 1854 vs 1854 +8: 14833 vs 14833 +9: 133496 vs 133496 + +Computed approximation to !20 (15 significant digits): 895014631192902000 diff --git a/Task/Permutations-by-swapping/EchoLisp/permutations-by-swapping.echolisp b/Task/Permutations-by-swapping/EchoLisp/permutations-by-swapping.echolisp new file mode 100644 index 0000000000..25e0693e55 --- /dev/null +++ b/Task/Permutations-by-swapping/EchoLisp/permutations-by-swapping.echolisp @@ -0,0 +1,29 @@ +(lib 'list) + +(for/fold (sign 1) ((σ (in-permutations 4)) (count 100)) + (printf "perm: %a count:%4d sign:%4d" σ count sign) (* sign -1)) + +perm: (0 1 2 3) count: 0 sign: 1 +perm: (0 1 3 2) count: 1 sign: -1 +perm: (0 3 1 2) count: 2 sign: 1 +perm: (3 0 1 2) count: 3 sign: -1 +perm: (3 0 2 1) count: 4 sign: 1 +perm: (0 3 2 1) count: 5 sign: -1 +perm: (0 2 3 1) count: 6 sign: 1 +perm: (0 2 1 3) count: 7 sign: -1 +perm: (2 0 1 3) count: 8 sign: 1 +perm: (2 0 3 1) count: 9 sign: -1 +perm: (2 3 0 1) count: 10 sign: 1 +perm: (3 2 0 1) count: 11 sign: -1 +perm: (3 2 1 0) count: 12 sign: 1 +perm: (2 3 1 0) count: 13 sign: -1 +perm: (2 1 3 0) count: 14 sign: 1 +perm: (2 1 0 3) count: 15 sign: -1 +perm: (1 2 0 3) count: 16 sign: 1 +perm: (1 2 3 0) count: 17 sign: -1 +perm: (1 3 2 0) count: 18 sign: 1 +perm: (3 1 2 0) count: 19 sign: -1 +perm: (3 1 0 2) count: 20 sign: 1 +perm: (1 3 0 2) count: 21 sign: -1 +perm: (1 0 3 2) count: 22 sign: 1 +perm: (1 0 2 3) count: 23 sign: -1 diff --git a/Task/Permutations-by-swapping/Nim/permutations-by-swapping.nim b/Task/Permutations-by-swapping/Nim/permutations-by-swapping.nim new file mode 100644 index 0000000000..c9f8654acc --- /dev/null +++ b/Task/Permutations-by-swapping/Nim/permutations-by-swapping.nim @@ -0,0 +1,34 @@ +# iterative Boothroyd method +iterator permutations*[T](ys: openarray[T]): tuple[perm: seq[T], sign: int] = + var + d = 1 + c = newSeq[int](ys.len) + xs = newSeq[T](ys.len) + sign = 1 + + for i, y in ys: xs[i] = y + yield (xs, sign) + + block outter: + while true: + while d > 1: + dec d + c[d] = 0 + while c[d] >= d: + inc d + if d >= ys.len: break outter + + let i = if (d and 1) == 1: c[d] else: 0 + swap xs[i], xs[d] + sign *= -1 + yield (xs, sign) + inc c[d] + +if isMainModule: + for i in permutations([0,1,2]): + echo i + + echo "" + + for i in permutations([0,1,2,3]): + echo i diff --git a/Task/Permutations-by-swapping/Sidef/permutations-by-swapping.sidef b/Task/Permutations-by-swapping/Sidef/permutations-by-swapping.sidef new file mode 100644 index 0000000000..e9272b2aa8 --- /dev/null +++ b/Task/Permutations-by-swapping/Sidef/permutations-by-swapping.sidef @@ -0,0 +1,22 @@ +func perms(n) { + var perms = [[+1]] + n.times { |x| + var sign = -1; + perms = gather { + for s,*p in perms { + var r = (0 .. p.len); + take((s < 0 ? r : r.flip).map {|i| + [sign *= -1, p[0..i-1], x, p[i..p.end]] + }...) + } + } + } + perms; +} + +var n = 4; +for p in perms(n) { + var s = p.shift + s > 0 && (s = '+1') + say "#{p} => #{s}" +} diff --git a/Task/Permutations-by-swapping/jq/permutations-by-swapping-1.jq b/Task/Permutations-by-swapping/jq/permutations-by-swapping-1.jq new file mode 100644 index 0000000000..c35620ab34 --- /dev/null +++ b/Task/Permutations-by-swapping/jq/permutations-by-swapping-1.jq @@ -0,0 +1,45 @@ +# The helper function, _recurse, is tail-recursive and therefore in +# versions of jq with TCO (tail call optimization) there is no +# overhead associated with the recursion. + +def permutations: + def abs: if . < 0 then -. else . end; + def sign: if . < 0 then -1 elif . == 0 then 0 else 1 end; + def swap(i;j): .[i] as $i | .[i] = .[j] | .[j] = $i; + + # input: [ parity, extendedPermutation] + def _recurse: + .[0] as $s | .[1] as $p | (($p | length) -1) as $n + | [ $s, ($p[1:] | map(abs)) ], + (reduce range(2; $n+1) as $i + (0; + if $p[$i] < 0 and -($p[$i]) > ($p[$i-1]|abs) and -($p[$i]) > ($p[.]|abs) + then $i + else . + end)) as $k + | (reduce range(1; $n) as $i + ($k; + if $p[$i] > 0 and $p[$i] > ($p[$i+1]|abs) and $p[$i] > ($p[.]|abs) + then $i + else . + end)) as $k + | if $k == 0 then empty + else (reduce range(1; $n) as $i + ($p; + if (.[$i]|abs) > (.[$k]|abs) then .[$i] *= -1 + else . + end )) as $p + | ($k + ($p[$k]|sign)) as $i + | ($p | swap($i; $k)) as $p + | [ -($s), $p ] | _recurse + end ; + + . as $in + | length as $n + | (reduce range(0; $n+1) as $i ([]; . + [ -$i ])) as $p + # recurse state: [$s, $p] + | [ 1, $p] | _recurse + | .[1] as $p + | .[1] = reduce range(0; $n) as $i ([]; . + [$in[$p[$i] - 1]]) ; + +def count(stream): reduce stream as $x (0; .+1); diff --git a/Task/Permutations-by-swapping/jq/permutations-by-swapping-2.jq b/Task/Permutations-by-swapping/jq/permutations-by-swapping-2.jq new file mode 100644 index 0000000000..d4eaced7df --- /dev/null +++ b/Task/Permutations-by-swapping/jq/permutations-by-swapping-2.jq @@ -0,0 +1,2 @@ +(["a", "b", "c"] | permutations), +"There are \(count( [range(1;6)] | permutations )) permutations of 5 items." diff --git a/Task/Permutations-by-swapping/jq/permutations-by-swapping-3.jq b/Task/Permutations-by-swapping/jq/permutations-by-swapping-3.jq new file mode 100644 index 0000000000..de14f5ab94 --- /dev/null +++ b/Task/Permutations-by-swapping/jq/permutations-by-swapping-3.jq @@ -0,0 +1,9 @@ +$ jq -c -n -f Permutations_by_swapping.jq +[1,["a","b","c"]] +[-1,["a","c","b"]] +[1,["c","a","b"]] +[-1,["c","b","a"]] +[1,["b","c","a"]] +[-1,["b","a","c"]] + +"There are 32 permutations of 5 items." diff --git a/Task/Permutations/LFE/permutations-1.lfe b/Task/Permutations/LFE/permutations-1.lfe new file mode 100644 index 0000000000..e183aee117 --- /dev/null +++ b/Task/Permutations/LFE/permutations-1.lfe @@ -0,0 +1,7 @@ +(defun permute + (('()) + '(())) + ((l) + (lc ((<- x l) + (<- y (permute (-- l `(,x))))) + (cons x y)))) diff --git a/Task/Permutations/LFE/permutations-2.lfe b/Task/Permutations/LFE/permutations-2.lfe new file mode 100644 index 0000000000..01bb7ecdea --- /dev/null +++ b/Task/Permutations/LFE/permutations-2.lfe @@ -0,0 +1,2 @@ +> (permute '(1 2 3)) +((1 2 3) (1 3 2) (2 1 3) (2 3 1) (3 1 2) (3 2 1)) diff --git a/Task/Permutations/Nim/permutations.nim b/Task/Permutations/Nim/permutations.nim new file mode 100644 index 0000000000..80e393a4af --- /dev/null +++ b/Task/Permutations/Nim/permutations.nim @@ -0,0 +1,28 @@ +# iterative Boothroyd method +iterator permutations[T](ys: openarray[T]): seq[T] = + var + d = 1 + c = newSeq[int](ys.len) + xs = newSeq[T](ys.len) + + for i, y in ys: xs[i] = y + yield xs + + block outer: + while true: + while d > 1: + dec d + c[d] = 0 + while c[d] >= d: + inc d + if d >= ys.len: break outer + + let i = if (d and 1) == 1: c[d] else: 0 + swap xs[i], xs[d] + yield xs + inc c[d] + +var x = @[1,2,3] + +for i in permutations(x): + echo i diff --git a/Task/Permutations/Phix/permutations-1.phix b/Task/Permutations/Phix/permutations-1.phix new file mode 100644 index 0000000000..06043c125c --- /dev/null +++ b/Task/Permutations/Phix/permutations-1.phix @@ -0,0 +1,17 @@ +global function permute(integer n, sequence set) +-- +-- return the nth permute of the given set. +-- n should be an integer in the range 1 to factorial(length(set)) +-- +sequence res +integer w + n -= 1 + res = set + for i=length(set) to 1 by -1 do + w = remainder(n,i)+1 + res[i] = set[w] + set[w] = set[i] + n = floor(n/i) + end for + return res +end function diff --git a/Task/Permutations/Phix/permutations-2.phix b/Task/Permutations/Phix/permutations-2.phix new file mode 100644 index 0000000000..65682aaf68 --- /dev/null +++ b/Task/Permutations/Phix/permutations-2.phix @@ -0,0 +1,8 @@ +function permutes(sequence set) +sequence res = repeat(0,factorial(length(set))) + for i=1 to length(res) do + res[i] = permute(i,set) + end for + return res +end function +?permutes("abcd") diff --git a/Task/Permutations/Ring/permutations.ring b/Task/Permutations/Ring/permutations.ring new file mode 100644 index 0000000000..f87efd74cd --- /dev/null +++ b/Task/Permutations/Ring/permutations.ring @@ -0,0 +1,35 @@ +list = [1, 2, 3, 4] +for perm = 1 to 24 + for i = 1 to len(list) + see list[i] + " " + next + see nl + nextPermutation(list) +next + +func nextPermutation a + elementcount = len(a) + if elementcount < 1 then return ok + pos = elementcount-1 + while a[pos] >= a[pos+1] + pos -= 1 + if pos <= 0 permutationReverse(a, 1, elementcount) + return ok + end + last = elementcount + while a[last] <= a[pos] + last -= 1 + end + temp = a[pos] + a[pos] = a[last] + a[last] = temp + permutationReverse(a, pos+1, elementcount) + + func permutationReverse a, first, last + while first < last + temp = a[first] + a[first] = a[last] + a[last] = temp + first += 1 + last -= 1 + end diff --git a/Task/Permutations/Sidef/permutations-1.sidef b/Task/Permutations/Sidef/permutations-1.sidef new file mode 100644 index 0000000000..a6ed8f2ce8 --- /dev/null +++ b/Task/Permutations/Sidef/permutations-1.sidef @@ -0,0 +1,3 @@ +[0,1,2].permutations { |p| + say p +} diff --git a/Task/Permutations/Sidef/permutations-2.sidef b/Task/Permutations/Sidef/permutations-2.sidef new file mode 100644 index 0000000000..4a7fb305d3 --- /dev/null +++ b/Task/Permutations/Sidef/permutations-2.sidef @@ -0,0 +1,21 @@ +func forperm(callback, n) { + var idx = @^n + + loop { + callback([idx...]) + + var p = n-1 + while (idx[p-1] > idx[p]) {--p} + p == 0 && return() + + var d = p + idx += idx.splice(p).reverse + + while (idx[p-1] > idx[d]) {++d} + idx.swap(p-1, d) + } + + return() +} + +forperm({|p| say p }, 3) diff --git a/Task/Permutations/Sidef/permutations-3.sidef b/Task/Permutations/Sidef/permutations-3.sidef new file mode 100644 index 0000000000..81d0f2bc59 --- /dev/null +++ b/Task/Permutations/Sidef/permutations-3.sidef @@ -0,0 +1,11 @@ +func permutations(callback, set, perm=[]) { + set.is_empty && callback(perm) + for i in ^set { + __FUNC__(callback, [ + set[(0 ..^ i)..., (i+1 ..^ set.len)...] + ], [perm..., set[i]]) + } + return() +} + +permutations({|p| say p }, [0,1,2]) diff --git a/Task/Permutations/Swift/permutations.swift b/Task/Permutations/Swift/permutations.swift new file mode 100644 index 0000000000..fd64ff693b --- /dev/null +++ b/Task/Permutations/Swift/permutations.swift @@ -0,0 +1,15 @@ +func perms(var ar: [T]) -> [[T]] { + return heaps(&ar, ar.count) +} + +func heaps(inout ar: [T], n: Int) -> [[T]] { + return n == 1 ? [ar] : + Swift.reduce(0.. 0 + sum += number Mod 2 + number \= 2 + Wend + Return sum +End Function + +Function IsPrime(number As Integer) As Boolean + If number <= 1 Then + Return false + ElseIf number <= 3 Then + Return true + ElseIf number Mod 2 = 0 OrElse number Mod 3 = 0 Then + Return false + End If + Var i = 5 + While i * i <= number + If number Mod i = 0 OrElse number Mod (i + 2) = 0 Then + Return false + End If + i += 6 + Wend + Return True +End Function + +Function IsPernicious(number As Integer) As Boolean + Dim popCount As Integer = SumBinaryDigits(number) + Return IsPrime(popCount) +End Function + +Dim As Integer n = 1, count = 0 +Print "The following are the first 25 pernicious numbers :" +Print + +Do + If IsPernicious(n) Then + Print Using "###"; n; + count += 1 + End If + n += 1 +Loop Until count = 25 + +Print : Print +Print "The pernicious numbers between 888,888,877 and 888,888,888 inclusive are :" +Print +For n = 888888877 To 888888888 + If IsPernicious(n) Then Print Using "##########"; n; +Next +Print : Print +Print "Press any key to exit the program" +Sleep +End diff --git a/Task/Pernicious-numbers/Nim/pernicious-numbers.nim b/Task/Pernicious-numbers/Nim/pernicious-numbers.nim new file mode 100644 index 0000000000..9018b92c4a --- /dev/null +++ b/Task/Pernicious-numbers/Nim/pernicious-numbers.nim @@ -0,0 +1,30 @@ +import strutils + +proc count(s: string, sub: char): int = + var i = 0 + while true: + i = s.find(sub, i) + if i < 0: + break + inc i + inc result + +proc popcount(n): int = n.toBin(64).count('1') + +const primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61} + +var p = newSeq[int]() +var i = 0 +while p.len < 25: + if popcount(i) in primes: p.add i + inc i + +echo p + +p = @[] +i = 888_888_877 +while i <= 888_888_888: + if popcount(i) in primes: p.add i + inc i + +echo p diff --git a/Task/Pernicious-numbers/Panda/pernicious-numbers.panda b/Task/Pernicious-numbers/Panda/pernicious-numbers.panda new file mode 100644 index 0000000000..c4c3af1092 --- /dev/null +++ b/Task/Pernicious-numbers/Panda/pernicious-numbers.panda @@ -0,0 +1,7 @@ +fun prime(a) type integer->integer + a where count{{a.factor}}==2 +fun pernisc(a) type integer->integer + a where sum{{a.radix:2 .char.integer}}.integer.prime + +1..36.pernisc +888888877..888888888.pernisc diff --git a/Task/Pernicious-numbers/Sidef/pernicious-numbers.sidef b/Task/Pernicious-numbers/Sidef/pernicious-numbers.sidef new file mode 100644 index 0000000000..9d318c1f69 --- /dev/null +++ b/Task/Pernicious-numbers/Sidef/pernicious-numbers.sidef @@ -0,0 +1,21 @@ +func is_pernicious(n) { + var c = 2693408940; # primes < 32 as set bits + while (n > 0) { c >>= 1; n &= (n - 1) } + c & 1; +} + +var (i, *p) = 0; +while (p.len < 25) { + p << i if is_pernicious(i); + ++i; +} + +say p.join(' '); + +var (i, *p) = 888888877; +while (i < 888888888) { + p << i if is_pernicious(i); + ++i; +} + +say p.join(' '); diff --git a/Task/Pernicious-numbers/Symsyn/pernicious-numbers.symsyn b/Task/Pernicious-numbers/Symsyn/pernicious-numbers.symsyn new file mode 100644 index 0000000000..1962d98971 --- /dev/null +++ b/Task/Pernicious-numbers/Symsyn/pernicious-numbers.symsyn @@ -0,0 +1,74 @@ +primes : 0b0010100000100000100010100010000010100000100010100010100010101100 + +| the first 25 pernicious numbers + + + $T | clear string + num_pn | set to zero + 2 n | start at 2 + 5 hi_bit + if num_pn LT 25 + call popcount | count ones + if primes bit pop_cnt | if pop_cnt bit of bit vector primes is one + + num_pn | inc number of pernicious numbers + ~ n $S | convert to decimal string + + ' ' $S | pad a space + + $S $T | add to string $T + endif + + pop_cnt | next number (odd) has one more bit than previous (even) + + n | next number + if primes bit pop_cnt + + num_pn + ~ n $S + + ' ' $S + + $S $T + endif + + n + goif | go back to if + endif + $T [] | display numbers + + + +| pernicious numbers in range 888888877 .. 888888888 + + $T | clear string + num_pn | set to zero + 888888876 n | start at 888888876 + 29 hi_bit + if n LE 888888888 + call popcount | count ones + if primes bit pop_cnt | if pop_cnt bit of bit vector primes is one + + num_pn | inc number of pernicious numbers + ~ n $S | convert to decimal string + + ' ' $S | pad a space + + $S $T | add to string $T + endif + + pop_cnt | next number (odd) has one more bit than previous (even) + + n | next number + if primes bit pop_cnt + + num_pn + ~ n $S + + ' ' $S + + $S $T + endif + + n + goif | go back to if + endif + $T [] | display numbers + + stop + + + +popcount | count ones in bit field + pop_cnt | pop_cnt to zero + 1 bit_num | only count even numbers so skip bit 0 + if bit_num LE hi_bit + if n bit bit_num + + pop_cnt + endif + + bit_num + goif + endif + return diff --git a/Task/Pernicious-numbers/Wortel/pernicious-numbers-1.wortel b/Task/Pernicious-numbers/Wortel/pernicious-numbers-1.wortel new file mode 100644 index 0000000000..3b3f1b201b --- /dev/null +++ b/Task/Pernicious-numbers/Wortel/pernicious-numbers-1.wortel @@ -0,0 +1 @@ +:ispernum ^(@isPrime \@count \=1 @arr &\`![.toString 2]) diff --git a/Task/Pernicious-numbers/Wortel/pernicious-numbers-2.wortel b/Task/Pernicious-numbers/Wortel/pernicious-numbers-2.wortel new file mode 100644 index 0000000000..51d95e2773 --- /dev/null +++ b/Task/Pernicious-numbers/Wortel/pernicious-numbers-2.wortel @@ -0,0 +1,2 @@ +!-ispernum 1..36 ; returns [3 5 6 7 9 10 11 12 13 14 17 18 19 20 21 22 24 25 26 28 31 33 34 35 36] +!-ispernum 888888877..888888888 ; returns [888888877 888888878 888888880 888888883 888888885 888888886] diff --git a/Task/Pernicious-numbers/jq/pernicious-numbers.jq b/Task/Pernicious-numbers/jq/pernicious-numbers.jq new file mode 100644 index 0000000000..3c8fc8c615 --- /dev/null +++ b/Task/Pernicious-numbers/jq/pernicious-numbers.jq @@ -0,0 +1,37 @@ +# is_prime is designed to work with jq 1.4 +def is_prime: + if . == 2 then true + else 2 < . and . % 2 == 1 and + . as $in + | (($in + 1) | sqrt) as $m + | (((($m - 1) / 2) | floor) + 1) as $max + | reduce range(1; $max) as $i + (true; if . then ($in % ((2 * $i) + 1)) > 0 else false end) + end; + +def popcount: + def bin: recurse( if . == 0 then empty else ./2 | floor end ) % 2; + [bin] | add; + +def is_pernicious: popcount | is_prime; + +# Emit a stream of "count" pernicious numbers greater than +# or equal to m: +def pernicious(m; count): + if count > 0 then + if m | is_pernicious then m, pernicious(m+1; count -1) + else pernicious(m+1; count) + end + else empty + end; + +def task: + # display the first 25 pernicious numbers: + [ pernicious(1;25) ], + + # display all pernicious numbers between + # 888,888,877 and 888,888,888 (inclusive). + [ range(888888877; 888888889) | select( is_pernicious ) ] +; + +task diff --git a/Task/Phrase-reversals/EchoLisp/phrase-reversals.echolisp b/Task/Phrase-reversals/EchoLisp/phrase-reversals.echolisp new file mode 100644 index 0000000000..4359af84f4 --- /dev/null +++ b/Task/Phrase-reversals/EchoLisp/phrase-reversals.echolisp @@ -0,0 +1,14 @@ +(define (string-reverse string) + (list->string (reverse (string->list string)))) + +(define (task str) + (for-each writeln (list + (string-reverse str) + (string-join (map string-reverse (string-split str ))) + (string-join (reverse (string-split str )))))) + + +(task "rosetta code phrase reversal") + "lasrever esarhp edoc attesor" + "attesor edoc esarhp lasrever" + "reversal phrase code rosetta" diff --git a/Task/Phrase-reversals/FreeBASIC/phrase-reversals.freebasic b/Task/Phrase-reversals/FreeBASIC/phrase-reversals.freebasic new file mode 100644 index 0000000000..7b0077b920 --- /dev/null +++ b/Task/Phrase-reversals/FreeBASIC/phrase-reversals.freebasic @@ -0,0 +1,64 @@ +' FB 1.05.0 Win64 + +Sub split (s As Const String, sepList As Const String, result() As String) + If s = "" OrElse sepList = "" Then + Redim result(0) + result(0) = s + Return + End If + Dim As Integer i, j, count = 0, empty = 0, length + Dim As Integer position(Len(s) + 1) + position(0) = 0 + + For i = 0 To len(s) - 1 + For j = 0 to Len(sepList) - 1 + If s[i] = sepList[j] Then + count += 1 + position(count) = i + 1 + End If + Next j + Next i + + Redim result(count) + If count = 0 Then + result(0) = s + Return + End If + + position(count + 1) = len(s) + 1 + + For i = 1 To count + 1 + length = position(i) - position(i - 1) - 1 + result(i - 1) = Mid(s, position(i - 1) + 1, length) + Next +End Sub + +Function reverse(s As Const String) As String + If s = "" Then Return "" + Dim t As String = s + Dim length As Integer = Len(t) + For i As Integer = 0 to length\2 - 1 + Swap t[i], t[length - 1 - i] + Next + Return t +End Function + +Dim s As String = "rosetta code phrase reversal" +Dim a() As String +Dim sepList As String = " " + +Print "Original string => "; s +Print "Reversed string => "; reverse(s) +Print "Reversed words => "; +split s, sepList, a() +For i As Integer = LBound(a) To UBound(a) + Print reverse(a(i)); " "; +Next +Print +Print "Reversed order => "; +For i As Integer = UBound(a) To LBound(a) Step -1 + Print a(i); " "; +Next +Print : Print +Print "Press any key to quit" +Sleep diff --git a/Task/Phrase-reversals/Oforth/phrase-reversals.oforth b/Task/Phrase-reversals/Oforth/phrase-reversals.oforth new file mode 100644 index 0000000000..15d23e306c --- /dev/null +++ b/Task/Phrase-reversals/Oforth/phrase-reversals.oforth @@ -0,0 +1,3 @@ +"rosetta code phrase reversal" reverse println +"rosetta code phrase reversal" words map(#reverse) unwords println +"rosetta code phrase reversal" words reverse unwords println diff --git a/Task/Phrase-reversals/Phix/phrase-reversals.phix b/Task/Phrase-reversals/Phix/phrase-reversals.phix new file mode 100644 index 0000000000..cf799e649a --- /dev/null +++ b/Task/Phrase-reversals/Phix/phrase-reversals.phix @@ -0,0 +1,8 @@ +constant test="rosetta code phrase reversal" +?reverse(test) +sequence words = split(reverse(test)) +for i=1 to length(words) do + words[i] = reverse(words[i]) +end for +?join(words) +?join(reverse(words)) diff --git a/Task/Phrase-reversals/Ring/phrase-reversals.ring b/Task/Phrase-reversals/Ring/phrase-reversals.ring new file mode 100644 index 0000000000..ab65fc22ba --- /dev/null +++ b/Task/Phrase-reversals/Ring/phrase-reversals.ring @@ -0,0 +1,9 @@ +aString = "Welcome to the Ring Language" +bString = "" +see reverseString(aString) + +func reverseString cString + for i= len(cString) to 1 step -1 + bString = bString + cString[i] + next + return bString diff --git a/Task/Phrase-reversals/Sidef/phrase-reversals.sidef b/Task/Phrase-reversals/Sidef/phrase-reversals.sidef new file mode 100644 index 0000000000..41428aa9aa --- /dev/null +++ b/Task/Phrase-reversals/Sidef/phrase-reversals.sidef @@ -0,0 +1,5 @@ +var str = "rosetta code phrase reversal"; + +say str.reverse; # reversed string +say str.words.map{.reverse}.join(' '); # words reversed +say str.words.reverse.join(' '); # word order reversed diff --git a/Task/Phrase-reversals/jq/phrase-reversals.jq b/Task/Phrase-reversals/jq/phrase-reversals.jq new file mode 100644 index 0000000000..03472fc2ba --- /dev/null +++ b/Task/Phrase-reversals/jq/phrase-reversals.jq @@ -0,0 +1,8 @@ +def reverse_string: explode | reverse | implode; + +"rosetta code phrase reversal" +| split(" ") as $words +| "0. input: \(.)", + "1. string reversed: \(reverse_string)", + "2. each word reversed: \($words | map(reverse_string) | join(" "))", + "3. word-order reversed: \($words | reverse | join(" "))" diff --git a/Task/Pi/FunL/pi.funl b/Task/Pi/FunL/pi.funl new file mode 100644 index 0000000000..4c9734c163 --- /dev/null +++ b/Task/Pi/FunL/pi.funl @@ -0,0 +1,20 @@ +def compute_pi = + def g( q, r, t, k, n, l ) = + if 4*q + r - t < n*t + n # g( 10*q, 10*(r - n*t), t, k, (10*(3*q + r))\t - 10*n, l ) + else + g( q*k, (2*q + r)*l, t*l, k + 1, (q*(7*k + 2) + r*l)\(t*l), l + 2 ) + + g( 1, 0, 1, 1, 3, 3 ) + +if _name_ == '-main-' + print( compute_pi().head() + '.' ) + + if args.isEmpty() + for d <- compute_pi().tail() + print( d ) + else + for d <- compute_pi().tail().take( int(args(0)) ) + print( d ) + + println() diff --git a/Task/Pi/FutureBasic/pi.futurebasic b/Task/Pi/FutureBasic/pi.futurebasic new file mode 100644 index 0000000000..523647a6d1 --- /dev/null +++ b/Task/Pi/FutureBasic/pi.futurebasic @@ -0,0 +1,169 @@ +include "ConsoleWindow" + +dim as long kf, ks +xref mf(_maxLong - 1) as long +xref ms(_maxLong - 1) as long +dim as long cnt, n, temp, nd +dim as long col, col1 +dim as long lloc, stor(50) + +end globals + +local mode +local fn FmtStr( nn as long, s as Str255 ) as Str255 +dim l as long +dim as Str255 f +l = s[0] +select case + case ( nn => l ) + f = string$( nn-l, 32 ) + s + case ( -nn > l) + f = s + string$( -nn-l, 32 ) + case else + f = s + end select +end fn = f + + +local mode +local fn FmtInt( nn as long, s as Str255 ) as Str255 +if ( left$( s, 1 ) = " " ) then s = mid$( s, 2 ) +end fn = fn FmtStr( nn, s ) + + +local fn yprint( m as long ) +if ( cnt < n ) + col++ + if ( col == 11 ) + col = 1 + col1++ + long if ( col1 == 6 ) + col1 = 0 + print + print fn FmtInt( 4, str$( m mod 10) ); + else + print fn FmtInt( 3, str$ (m mod 10) ); + end if + else + print mid$( str$( m ), 2 ) ; + end if + cnt++ +end if +end fn + + +local fn xprint( m as long) +dim as long ii, wk, wk1 + +if ( m < 8 ) + ii = 1 + while ( ii <= lloc ) + fn yprint( stor(ii) ) + ii++ + wend +lloc = 0 +else + if ( m > 9 ) + wk = m / 10 + m = m mod 10 + wk1 = lloc + while ( wk1 >= 1 ) + wk += stor(wk1) + stor(wk1) = wk mod 10 + wk = wk/10 + wk1-- + wend + end if +end if +lloc++ +stor(lloc) = m +end fn + + +local mode +local fn shift( l1 as ^long, l2 as ^long, lp as long, lmod as long ) +dim as long k + +if ( l2.nil& > 0 ) + k = ( l2.nil& ) / lmod +else + k = -( -l2.nil& / lmod ) - 1 +end if +l2.nil& = l2.nil& - k*lmod +l1.nil& = l1.nil& + k*lp +end fn + + +local fn Main( nDig as long ) +dim as long i + +n = nDig +stor(0) = 0 + +mf = fn malloc( ( n + 10 ) * sizeof(long) ) +if ( 0 == mf ) then stop "Out of memory" + +ms = fn malloc( ( n + 10 ) * sizeof(long) ) +if ( 0 == ms ) then stop "Out of memory" + +print : print "Approximation of π to"; n; " digits" + +cnt = 0 +kf = 25 +ks = 57121 +mf(1) = 1 + +i = 2 +while ( i <= n ) + mf(i) = -16 + mf(i + 1) = 16 + i += 2 +wend + +i = 1 +while ( i <= n ) + ms(i) = -4 + ms(i + 1) = 4 + i += 2 +wend + +print : print " 3."; + +while ( cnt < n ) + i = 0 + i++ + while ( i <= n - cnt ) + mf(i) = mf(i) * 10 + ms(i) = ms(i) * 10 + i++ + wend + + i = ( n - cnt + 1 ) + i-- + while ( i >= 2 ) + temp = 2 * i - 1 + fn shift( @mf(i - 1), @mf(i), temp - 2, temp * kf ) + fn shift( @ms(i - 1), @ms(i), temp - 2, temp * ks ) + i-- + wend + +nd = 0 + +fn shift( @nd, @mf(1), 1, 5 ) +fn shift( @nd, @ms(1), 1, 239 ) +fn xprint( nd ) + +wend + +print : print "Done" +fn free( ms ) +fn free( mf ) +end fn + + +dim as unsigned long ticks +ticks = fn TickCount() +// Here we specify the number of decimal places +fn Main( 4000 ) +ticks = fn TickCount() - ticks +print "Elapsed time:" str$( ticks ) " ticks diff --git a/Task/Pi/Lasso/pi.lasso b/Task/Pi/Lasso/pi.lasso new file mode 100644 index 0000000000..842ce58573 --- /dev/null +++ b/Task/Pi/Lasso/pi.lasso @@ -0,0 +1,31 @@ +#!/usr/bin/lasso9 + +define generatePi => { + yield currentCapture + + local(r = array(), i, k, b, d, c = 0, x) + with i in generateSeries(1, 2800) + do #r->insert(2000) + with k in generateSeries(2800, 1, -14) + do { + #d = 0 + #i = #k + while(true) => { + #d += #r->get(#i) * 10000 + #b = 2 * #i - 1 + #r->get(#i) = #d % #b + #d /= #b + #i-- + !#i ? loop_abort + #d *= #i + } + #x = (#c + #d / 10000) + yield (#k == 2800 ? ((#x * 0.001)->asstring(-precision = 3)) | #x->asstring(-padding=4, -padChar='0')) + #c = #d % 10000 + } +} + +local(pi_digits) = generatePi +loop(200) => { + stdout(#pi_digits()) +} diff --git a/Task/Pi/Nim/pi.nim b/Task/Pi/Nim/pi.nim new file mode 100644 index 0000000000..94cbccf79d --- /dev/null +++ b/Task/Pi/Nim/pi.nim @@ -0,0 +1,50 @@ +import strutils, unsigned, bigints + +var + tmp1, tmp2, tmp3, acc, k, dd = initBigInt(0) + den, num, k2 = initBigInt(1) + +proc extractDigit(): int32 = + if num > acc: + return -1 + + tmp3 = num shl 1 + tmp3 += num + tmp3 += acc + tmp2 = tmp3 mod den + tmp1 = tmp3 div den + tmp2 += num + + if tmp2 >= den: + return -1 + + result = int32(tmp1.limbs[0]) + +proc eliminateDigit(d: int32) = + acc -= den * d + acc *= 10 + num *= 10 + +proc nextTerm() = + k += 1 + k2 += 2 + tmp1 = num shl 1 + acc += tmp1 + acc *= k2 + den *= k2 + num *= k + +var i = 0 + +while true: + var d: int32 = -1 + while d < 0: + nextTerm() + d = extractDigit() + + stdout.write chr(ord('0') + d) + inc i + if i == 40: + echo "" + i = 0 + eliminateDigit d diff --git a/Task/Pi/Oforth/pi.oforth b/Task/Pi/Oforth/pi.oforth new file mode 100644 index 0000000000..338b5b6089 --- /dev/null +++ b/Task/Pi/Oforth/pi.oforth @@ -0,0 +1,20 @@ +: calcPiDigits +| q r t k n l | + 1 ->q 0 ->r 1 ->t 1 ->k 3 ->n 3 -> l + + while( true ) [ + 4 q * r + t - n t * < ifTrue: [ + n print + r n t * - 10 * + 3 q * r + 10 * t / n 10 * - ->n ->r + q 10 * ->q + ] + else: [ + 2 q * r + l * + 7 k * q * 2 + r l * + t l * / ->n ->r + k q * ->q + t l * ->t + l 2 + ->l + k 1+ ->k + ] + ] ; diff --git a/Task/Pi/Phix/pi.phix b/Task/Pi/Phix/pi.phix new file mode 100644 index 0000000000..3d79871c79 --- /dev/null +++ b/Task/Pi/Phix/pi.phix @@ -0,0 +1,5 @@ +integer a,b,c,d,e,g sequence f a=10000 f=repeat(floor(a/5) +,8401) c=8400 e=0 while c>0 do g=2*c d=0 b=c while b>0 do +d+=f[b]*a g-=1 f[b]=remainder(d, g) d=floor(d/g) g-=1 b-=1 +if b!=0 then d*=b end if end while printf(1,"%04d",e+floor +(d/a)) c-=14 e = remainder(d,a) end while diff --git a/Task/Pi/Sidef/pi.sidef b/Task/Pi/Sidef/pi.sidef new file mode 100644 index 0000000000..04e7e0a169 --- /dev/null +++ b/Task/Pi/Sidef/pi.sidef @@ -0,0 +1,26 @@ +func pi(callback) { + var (q, r, t, k, n, l) = (1, 0, 1, 1, 3, 3); + loop { + if ((4*q + r - t) < n*t) { + callback(n); + static _dot = callback('.'); + var nr = 10*(r-n*t); + n = (int((10*(3*q + r)) / t) - 10*n); + q *= 10; + r = nr; + } + else { + var nr = ((2*q + r) * l); + var nn = int((q*(7*k + 2) + r*l) / (t*l)); + q *= k; + t *= l; + l += 2; + k += 1; + n = nn; + r = nr; + } + } +} + +STDOUT.autoflush(1); +pi(func(digit){ print digit }); diff --git a/Task/Pi/jq/pi-1.jq b/Task/Pi/jq/pi-1.jq new file mode 100644 index 0000000000..442fc6a3d1 --- /dev/null +++ b/Task/Pi/jq/pi-1.jq @@ -0,0 +1,59 @@ +# The Gibbons spigot, in the mold of the [[#Groovy]] and ython]] programs shown on this page. +# The "bigint" functions +needed are: long_minus long_add long_multiply long_div + +def pi_spigot: + + # S is the sixtuple: + # q r t k n l + # 0 1 2 3 4 5 + + def long_lt(x;y): if x == y then false else lessOrEqual(x;y) end; + + def check: + long_lt(long_minus(long_add(long_multiply("4"; .[0]); .[1]) ; .[2]); + long_multiply(.[4]; .[2])); + + # state: [d, S] where digit is null or a digit ready to be printed + def next: + .[1] as $S + | $S[0] as $q | $S[1] as $r | $S[2] as $t | $S[3] as $k | $S[4] as $n | $S[5] as $l + | if $S|check + then [$n, + [long_multiply("10"; $q), + long_multiply("10"; long_minus($r; long_multiply($n;$t))), + $t, + $k, + long_minus( long_div(long_multiply("10";long_add(long_multiply("3"; $q); $r)); $t ); + long_multiply("10";$n)), + $l ]] + else [null, + [long_multiply($q;$k), + long_multiply( long_add(long_multiply("2";$q); $r); $l), + long_multiply($t;$l), + long_add($k; "1"), + long_div( long_add(long_multiply($q; long_add(long_multiply("7";$k); "2")) ; long_multiply($r;$l)); + long_multiply($t;$l) ), + long_add($l; "2") ]] + end; + + # Input: input to the filter "nextstate" + # Output: [count, space, digit] for successive digits produced by "nextstate" + def decorate( nextstate ): + + # For efficiency it is important that the recursive + # function have arity 0 and be tail-recursive: + def count: + .[0] as $count + | .[1] as $state + | $state[0] as $value + | ($state[1] | map(length) | add) as $space + | (if $value then [$count, $space, $value] else empty end), + ( [if $value then $count+1 else $count end, ($state | nextstate)] | count); + [0, .] | count; + + # q=1, r=0, t=1, k=1, n=3, l=3 + [null, ["1", "0", "1", "1", "3", "3"]] | decorate(next) +; + +pi_spigot diff --git a/Task/Pi/jq/pi-2.jq b/Task/Pi/jq/pi-2.jq new file mode 100644 index 0000000000..bbbedd869d --- /dev/null +++ b/Task/Pi/jq/pi-2.jq @@ -0,0 +1,305 @@ +$ jq -M -n -c -f pi.bigint.jq +[0,9,"3"] +[1,14,"1"] +[2,29,"4"] +[3,36,"1"] +[4,51,"5"] +[5,69,"9"] +[6,80,"2"] +[7,95,"6"] +[8,115,"5"] +[9,125,"3"] +[10,142,"5"] +[11,167,"8"] +[12,181,"9"] +[13,197,"7"] +[14,226,"9"] +[15,245,"3"] +[16,263,"2"] +[17,276,"3"] +[18,300,"8"] +[19,320,"4"] +[20,350,"6"] +[21,363,"2"] +[22,383,"6"] +[23,408,"4"] +[24,429,"3"] +[25,442,"3"] +[26,475,"8"] +[27,502,"3"] +[28,510,"2"] +[29,531,"7"] +[30,563,"9"] +[31,611,"5"] +[32,613,"0"] +[33,628,"2"] +[34,649,"8"] +[35,676,"8"] +[36,711,"4"] +[37,720,"1"] +[38,748,"9"] +[39,783,"7"] +[40,792,"1"] +[41,814,"6"] +[42,849,"9"] +[43,870,"3"] +[44,886,"9"] +[45,923,"9"] +[46,939,"3"] +[47,967,"7"] +[48,1004,"5"] +[49,1041,"1"] +[50,1043,"0"] +[51,1059,"5"] +[52,1103,"8"] +[53,1133,"2"] +[54,1135,"0"] +[55,1165,"9"] +[56,1195,"7"] +[57,1212,"4"] +[58,1242,"9"] +[59,1273,"4"] +[60,1297,"4"] +[61,1313,"5"] +[62,1358,"9"] +[63,1375,"2"] +[64,1421,"3"] +[65,1423,"0"] +[66,1447,"7"] +[67,1493,"8"] +[68,1501,"1"] +[69,1533,"6"] +[70,1579,"4"] +[71,1581,"0"] +[72,1613,"6"] +[73,1630,"2"] +[74,1662,"8"] +[75,1701,"6"] +[76,1733,"2"] +[77,1735,"0"] +[78,1781,"8"] +[79,1792,"9"] +[80,1816,"9"] +[81,1849,"8"] +[82,1889,"6"] +[83,1898,"2"] +[84,1961,"8"] +[85,1963,"0"] +[86,1988,"3"] +[87,2013,"4"] +[88,2054,"8"] +[89,2071,"2"] +[90,2104,"5"] +[91,2129,"3"] +[92,2162,"4"] +[93,2195,"2"] +[94,2220,"1"] +[95,2230,"1"] +[96,2287,"7"] +[97,2289,"0"] +[98,2314,"6"] +[99,2340,"7"] +[100,2373,"9"] +[101,2414,"8"] +[102,2448,"2"] +[103,2458,"1"] +[104,2484,"4"] +[105,2534,"8"] +[106,2536,"0"] +[107,2569,"8"] +[108,2602,"6"] +[109,2645,"5"] +[110,2662,"1"] +[111,2696,"3"] +[112,2707,"2"] +[113,2756,"8"] +[114,2775,"2"] +[115,2825,"3"] +[116,2827,"0"] +[117,2853,"6"] +[118,2887,"6"] +[119,2914,"4"] +[120,2964,"7"] +[121,2966,"0"] +[122,3008,"9"] +[123,3027,"3"] +[124,3061,"8"] +[125,3088,"4"] +[126,3114,"4"] +[127,3165,"6"] +[128,3167,"0"] +[129,3202,"9"] +[130,3237,"5"] +[131,3287,"5"] +[132,3289,"0"] +[133,3316,"5"] +[134,3360,"8"] +[135,3387,"2"] +[136,3414,"2"] +[137,3456,"3"] +[138,3466,"1"] +[139,3510,"7"] +[140,3529,"2"] +[141,3564,"5"] +[142,3583,"3"] +[143,3610,"5"] +[144,3653,"9"] +[145,3697,"4"] +[146,3699,"0"] +[147,3752,"8"] +[148,3770,"1"] +[149,3789,"2"] +[150,3825,"8"] +[151,3852,"4"] +[152,3905,"8"] +[153,3933,"1"] +[154,3960,"1"] +[155,3970,"1"] +[156,4006,"7"] +[157,4033,"4"] +[158,4102,"5"] +[159,4104,"0"] +[160,4124,"2"] +[161,4159,"8"] +[162,4203,"4"] +[163,4248,"1"] +[164,4250,"0"] +[165,4269,"2"] +[166,4348,"7"] +[167,4350,"0"] +[168,4361,"1"] +[169,4405,"9"] +[170,4424,"3"] +[171,4460,"8"] +[172,4497,"5"] +[173,4542,"2"] +[174,4569,"1"] +[175,4605,"1"] +[176,4607,"0"] +[177,4644,"5"] +[178,4672,"5"] +[179,4691,"5"] +[180,4727,"9"] +[181,4764,"6"] +[182,4792,"4"] +[183,4820,"4"] +[184,4865,"6"] +[185,4893,"2"] +[186,4913,"2"] +[187,4949,"9"] +[188,4968,"4"] +[189,5005,"8"] +[190,5042,"9"] +[191,5070,"5"] +[192,5098,"4"] +[193,5144,"9"] +[194,5198,"3"] +[195,5200,"0"] +[196,5219,"3"] +[197,5266,"8"] +[198,5276,"1"] +[199,5313,"9"] +[200,5350,"6"] +[201,5387,"4"] +[202,5416,"4"] +[203,5435,"2"] +[204,5471,"8"] +[205,5526,"8"] +[206,5556,"1"] +[207,5558,"0"] +[208,5594,"9"] +[209,5632,"7"] +[210,5660,"5"] +[211,5689,"6"] +[212,5726,"6"] +[213,5746,"5"] +[214,5792,"9"] +[215,5821,"3"] +[216,5849,"3"] +[217,5887,"4"] +[218,5906,"4"] +[219,5961,"6"] +[220,5981,"1"] +[221,6002,"2"] +[222,6038,"8"] +[223,6068,"4"] +[224,6096,"7"] +[225,6134,"5"] +[226,6163,"6"] +[227,6191,"4"] +[228,6238,"8"] +[229,6267,"2"] +[230,6296,"3"] +[231,6316,"3"] +[232,6344,"7"] +[233,6383,"8"] +[234,6411,"6"] +[235,6440,"7"] +[236,6487,"8"] +[237,6525,"3"] +[238,6545,"1"] +[239,6574,"6"] +[240,6621,"5"] +[241,6641,"2"] +[242,6688,"7"] +[243,6717,"1"] +[244,6782,"2"] +[245,6784,"0"] +[246,6795,"1"] +[247,6852,"9"] +[248,6854,"0"] +[249,6910,"9"] +[250,6929,"1"] +[251,6959,"4"] +[252,6988,"5"] +[253,7027,"6"] +[254,7046,"4"] +[255,7085,"8"] +[256,7115,"5"] +[257,7153,"6"] +[258,7181,"6"] +[259,7229,"9"] +[260,7258,"2"] +[261,7288,"3"] +[262,7317,"4"] +[263,7383,"6"] +[264,7385,"0"] +[265,7415,"3"] +[266,7435,"4"] +[267,7474,"8"] +[268,7530,"6"] +[269,7569,"1"] +[270,7571,"0"] +[271,7609,"4"] +[272,7639,"5"] +[273,7678,"4"] +[274,7716,"3"] +[275,7736,"2"] +[276,7766,"6"] +[277,7805,"6"] +[278,7826,"4"] +[279,7873,"8"] +[280,7912,"2"] +[281,7933,"1"] +[282,7971,"3"] +[283,7991,"3"] +[284,8030,"9"] +[285,8060,"3"] +[286,8118,"6"] +[287,8120,"0"] +[288,8168,"7"] +[289,8189,"2"] +[290,8264,"6"] +[291,8266,"0"] +[292,8287,"2"] +[293,8317,"4"] +[294,8374,"9"] +[295,8395,"1"] +[296,8443,"4"] +[297,8464,"1"] +[298,8485,"2"] +[299,8524,"7"] +[300,8544,"3"] +[301,8593,"7"] +[302,8623,"2"] +... diff --git a/Task/Pick-random-element/Ceylon/pick-random-element.ceylon b/Task/Pick-random-element/Ceylon/pick-random-element.ceylon new file mode 100644 index 0000000000..0fe8eff39b --- /dev/null +++ b/Task/Pick-random-element/Ceylon/pick-random-element.ceylon @@ -0,0 +1,10 @@ +import ceylon.random { + + DefaultRandom +} + +shared void run() { + value random = DefaultRandom(); + value element = random.nextElement([1, 2, 3, 4, 5, 6]); + print(element); +} diff --git a/Task/Pick-random-element/EchoLisp/pick-random-element.echolisp b/Task/Pick-random-element/EchoLisp/pick-random-element.echolisp new file mode 100644 index 0000000000..d760a8c713 --- /dev/null +++ b/Task/Pick-random-element/EchoLisp/pick-random-element.echolisp @@ -0,0 +1,4 @@ +(define (pick-random list) + (list-ref list (random (length list)))) +(pick-random (iota 1000)) → 667 +(pick-random (iota 1000)) → 179 diff --git a/Task/Pick-random-element/FreeBASIC/pick-random-element.freebasic b/Task/Pick-random-element/FreeBASIC/pick-random-element.freebasic new file mode 100644 index 0000000000..e463239f82 --- /dev/null +++ b/Task/Pick-random-element/FreeBASIC/pick-random-element.freebasic @@ -0,0 +1,12 @@ +' FB 1.05.0 Win64 + +Dim a(0 To 9) As String = {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"} + +Randomize +Dim randInt As Integer + +For i As Integer = 1 To 5 + randInt = Int(Rnd * 10) + Print a(randInt) +Next +Sleep diff --git a/Task/Pick-random-element/Lasso/pick-random-element.lasso b/Task/Pick-random-element/Lasso/pick-random-element.lasso new file mode 100644 index 0000000000..9598bc49b2 --- /dev/null +++ b/Task/Pick-random-element/Lasso/pick-random-element.lasso @@ -0,0 +1,5 @@ +local( + my array = array('one', 'two', 3) +) + +#myarray -> get(integer_random(#myarray -> size, 1)) diff --git a/Task/Pick-random-element/LiveCode/pick-random-element.livecode b/Task/Pick-random-element/LiveCode/pick-random-element.livecode new file mode 100644 index 0000000000..3b459c6962 --- /dev/null +++ b/Task/Pick-random-element/LiveCode/pick-random-element.livecode @@ -0,0 +1,2 @@ +put "Apple,Banana,Peach,Apricot,Pear" into fruits +put item (random(the number of items of fruits)) of fruits diff --git a/Task/Pick-random-element/Nim/pick-random-element.nim b/Task/Pick-random-element/Nim/pick-random-element.nim new file mode 100644 index 0000000000..1f0418618f --- /dev/null +++ b/Task/Pick-random-element/Nim/pick-random-element.nim @@ -0,0 +1,14 @@ +import math +randomize() + +proc random[T](a: openarray[T]): T = + a[random(a.low..a.len)] + +let ls = @["foo", "bar", "baz"] +echo ls.random() + +var xs: array[10..14, string] +for i in 10..14: + xs[i] = "foo: " & $i + +echo xs.random() diff --git a/Task/Pick-random-element/Oforth/pick-random-element.oforth b/Task/Pick-random-element/Oforth/pick-random-element.oforth new file mode 100644 index 0000000000..46a51ca97b --- /dev/null +++ b/Task/Pick-random-element/Oforth/pick-random-element.oforth @@ -0,0 +1 @@ +: pickRand(l) l size rand l at ; diff --git a/Task/Pick-random-element/Phix/pick-random-element.phix b/Task/Pick-random-element/Phix/pick-random-element.phix new file mode 100644 index 0000000000..9cb0daf9df --- /dev/null +++ b/Task/Pick-random-element/Phix/pick-random-element.phix @@ -0,0 +1,2 @@ +constant s = {'a','b','c'} +puts(1,s[rand(length(s))]) diff --git a/Task/Pick-random-element/Ring/pick-random-element.ring b/Task/Pick-random-element/Ring/pick-random-element.ring new file mode 100644 index 0000000000..7d039c384d --- /dev/null +++ b/Task/Pick-random-element/Ring/pick-random-element.ring @@ -0,0 +1,7 @@ +aList = "abcdefghij" +for i = 1 to 10 + letter = random(10) + if letter > 0 + see aList[letter] + nl + ok +next diff --git a/Task/Pick-random-element/Sidef/pick-random-element.sidef b/Task/Pick-random-element/Sidef/pick-random-element.sidef new file mode 100644 index 0000000000..d524c192d2 --- /dev/null +++ b/Task/Pick-random-element/Sidef/pick-random-element.sidef @@ -0,0 +1,3 @@ +var arr = %w(north east south west); +say arr.rand; +say arr.rand(2).dump; diff --git a/Task/Pick-random-element/Swift/pick-random-element.swift b/Task/Pick-random-element/Swift/pick-random-element.swift new file mode 100644 index 0000000000..aa48275ffb --- /dev/null +++ b/Task/Pick-random-element/Swift/pick-random-element.swift @@ -0,0 +1,4 @@ +import Darwin + +let myList = [1, 2, 4, 5, 62, 234, 1, -1] +print(myList[Int(arc4random_uniform(UInt32(myList.count)))]) diff --git a/Task/Pick-random-element/Ursa/pick-random-element.ursa b/Task/Pick-random-element/Ursa/pick-random-element.ursa new file mode 100644 index 0000000000..29c82b552c --- /dev/null +++ b/Task/Pick-random-element/Ursa/pick-random-element.ursa @@ -0,0 +1,6 @@ +# generate a stream (ursa equivalent of a list) +decl string<> str +append "these" "are" "some" "values" str + +decl ursa.util.random r +out str<(r.getint (size str))> endl console diff --git a/Task/Pig-the-dice-game-Player/Sidef/pig-the-dice-game-player.sidef b/Task/Pig-the-dice-game-Player/Sidef/pig-the-dice-game-player.sidef new file mode 100644 index 0000000000..e7aa296e65 --- /dev/null +++ b/Task/Pig-the-dice-game-Player/Sidef/pig-the-dice-game-player.sidef @@ -0,0 +1,60 @@ +var (games=100) = ARGV.map{.to_i}... + +define DIE = 1..6; +define GOAL = 100; + +class Player(score=0, ante=0, rolls=0, strategy={false}) { + method turn { + rolls = 0; + ante = 0; + loop { + rolls++; + given (var roll = DIE.rand) { + when (1) { + ante = 0; + break; + } + case (roll > 1) { + ante += roll; + } + } + ((score + ante >= GOAL) || strategy) && break; + } + score += ante; + } +} + +var players = []; + +# default, go-for-broke, always roll again +players[0] = Player.new; + +# try to roll 5 times but no more per turn +players[1] = Player.new( strategy: { players[1].rolls >= 5 } ); + +# try to accumulate at least 20 points per turn +players[2] = Player.new( strategy: { players[2].ante > 20 } ); + +# random but 90% chance of rolling again +players[3] = Player.new( strategy: { 1.rand < 0.1 } ); + +# random but more conservative as approaches goal +players[4] = Player.new( strategy: { 1.rand < ((GOAL - players[4].score) * 0.6 / GOAL) } ); + +var wins = [0]*players.len; + +games.times { + var player = -1; + loop { + player++; + var p = players[player % players.len]; + p.turn; + p.score >= GOAL && break; + } + wins[player % players.len]++; + players.map{.score}.join("\t").say; + players.each { |p| p.score = 0 }; +} + +say "\nSCORES: for #{games} games"; +say wins.join("\t"); diff --git a/Task/Play-recorded-sounds/Ring/play-recorded-sounds.ring b/Task/Play-recorded-sounds/Ring/play-recorded-sounds.ring new file mode 100644 index 0000000000..141497d1c7 --- /dev/null +++ b/Task/Play-recorded-sounds/Ring/play-recorded-sounds.ring @@ -0,0 +1,117 @@ +Load "guilib.ring" +new qapp { + q1=NULL q2=NULL + win1 = new qwidget() { + setwindowtitle("play sound!") show() + setgeometry(100,100,400,400) + } + new qpushbutton(win1) { + setgeometry(50,50,100,30) + settext("play1") + setclickevent("playmusic1()") + show() + } + new qpushbutton(win1) { + setgeometry(200,50,100,30) + settext("play2") + setclickevent("playmusic2()") + show() + } + new qpushbutton(win1) { + setgeometry(50,100,100,30) + settext("pause1") + setclickevent("pauseplay1()") + show() + } + new qpushbutton(win1) { + setgeometry(200,100,100,30) + settext("pause2") + setclickevent("pauseplay2()") + show() + } + new qpushbutton(win1) { + setgeometry(50,150,100,30) + settext("stop1") + setclickevent("stopplay1()") + show() + } + new qpushbutton(win1) { + setgeometry(200,150,100,30) + settext("stop2") + setclickevent("stopplay2()") + show() + } + lineedit1 = new qlineedit(win1) { + setGeometry(50,200,100,30) + settext("50") + show() + } + lineedit2 = new qlineedit(win1) { + setGeometry(200,200,100,30) + settext("50") + show() + } + new qpushbutton(win1) { + setgeometry(50,250,100,30) + settext("volume1") + setclickevent("volume1()") + show() + } + new qpushbutton(win1) { + setgeometry(200,250,100,30) + settext("volume2") + setclickevent("volume2()") + show() + } + new qpushbutton(win1) { + setgeometry(50,300,100,30) + settext("mute1") + setclickevent("mute1()") + show() + } + new qpushbutton(win1) { + setgeometry(200,300,100,30) + settext("mute2") + setclickevent("mute2()") + show() + } + exec() + } + +func playmusic1 + q1 = new qmediaplayer(win1) { + setmedia(new qurl("music1.wav")) + setvolume(50) play() + } + +func playmusic2 + q2 = new qmediaplayer(win1) { + setmedia(new qurl("music2.wav")) + setvolume(50) play() + } + +func pauseplay1 + q1.pause() + +func pauseplay2 + q2.pause() + +func stopplay1 + q1.stop() + +func stopplay2 + q2.stop() + +func volume1 + lineedit1 { vol1 = text() } + q1 {setvolume(number(vol1))} + +func volume2 + lineedit2 { vol2 = text() } + q2 {setvolume(number(vol2))} + +func mute1 + q1.setmuted(true) + +func mute2 + q2.setmuted(true) diff --git a/Task/Play-recorded-sounds/Swift/play-recorded-sounds.swift b/Task/Play-recorded-sounds/Swift/play-recorded-sounds.swift new file mode 100644 index 0000000000..95843cc53b --- /dev/null +++ b/Task/Play-recorded-sounds/Swift/play-recorded-sounds.swift @@ -0,0 +1,78 @@ +import AVFoundation + +// This example uses AVAudioPlayer for playback. +// AVAudioPlayer is the player Apple recommends for playback, since it suitable for songs +// and offers control over numerous playback parameters. +// It can play any type that is natively supported by OSX or iOS + +class PlayerControl: NSObject, AVAudioPlayerDelegate { + let player1:AVAudioPlayer! + let player2:AVAudioPlayer! + var playedBoth = false + var volume:Float { + get { + return player1.volume + } + + set { + player1.volume = newValue + player2.volume = newValue + } + } + + init(player1:AVAudioPlayer, player2:AVAudioPlayer) { + super.init() + self.player1 = player1 + self.player2 = player2 + self.player1.delegate = self + self.player2.delegate = self + } + + func loop() { + player1.numberOfLoops = 1 + player1.play() + + let time = Int64((Double(player1.duration) + 2.0) * Double(NSEC_PER_SEC)) + + dispatch_after(dispatch_time(0, time), dispatch_get_main_queue()) {[weak self] in + println("Stopping track") + self?.player1.stop() + exit(0) + } + } + + func playBoth() { + player1.play() + player2.play() + } + + func audioPlayerDidFinishPlaying(player:AVAudioPlayer!, successfully flag:Bool) { + if player === player2 && !playedBoth { + playBoth() + playedBoth = true + } else if player === player2 && playedBoth { + loop() + } + } +} + +let url1 = NSURL(string: "file:///file1.mp3") +let url2 = NSURL(string: "file:///file2.mp3") + +var err:NSError? +let player1 = AVAudioPlayer(contentsOfURL: url1, error: &err) +let player2 = AVAudioPlayer(contentsOfURL: url2, error: &err) + +let player = PlayerControl(player1: player1, player2: player2) + +// Setting the volume +player.volume = 0.5 + +// Play track 2 +// When this track finishes it will play both of them +// by calling the audioPlayerDidFinishPlaying delegate method +// Once both tracks finish playing, it will then loop the first track twice +// stopping the track after 2 seconds of the second play +player.player2.play() + +CFRunLoopRun() diff --git a/Task/Playing-cards/Ceylon/playing-cards.ceylon b/Task/Playing-cards/Ceylon/playing-cards.ceylon new file mode 100644 index 0000000000..48184902de --- /dev/null +++ b/Task/Playing-cards/Ceylon/playing-cards.ceylon @@ -0,0 +1,81 @@ +import com.vasileff.ceylon.random.api { ... } + +"""Run the example code for Rosetta Code ["Playing cards" task] (http://rosettacode.org/wiki/Playing_cards).""" +shared void run() { + variable value deck = Deck(); + print("New deck (``deck.size`` cards): ``deck`` + "); + + deck = deck.shuffle(); + print("Shuffeled deck (``deck.size`` cards): ``deck`` + "); + + print("Deal three hands: "); + for (i in 1..3) { + value [hand, _deck] = deck.deal(); + print("- Dealt ``hand.size`` cards to hand ``i`` : ``join(hand)``"); + deck = _deck; + } + + print(" + Deck (``deck.size`` cards) after dealing three hands: ``deck``"); + +} + +abstract class Suit() of clubs | hearts | spades | diamonds {} + +object clubs extends Suit() { string = "♣"; } +object hearts extends Suit() { string = "♥"; } +object spades extends Suit() { string = "♠"; } +object diamonds extends Suit() { string = "♦"; } + +abstract class Pip() of two | three | four | five | six | seven | eight | nine | ten | jack | queen | king | ace {} +object two extends Pip() { string = "2"; } +object three extends Pip() { string = "3"; } +object four extends Pip() { string = "4"; } +object five extends Pip() { string = "5"; } +object six extends Pip() { string = "6"; } +object seven extends Pip() { string = "7"; } +object eight extends Pip() { string = "8"; } +object nine extends Pip() { string = "9"; } +object ten extends Pip() { string = "10"; } +object jack extends Pip() { string = "J"; } +object queen extends Pip() { string = "Q"; } +object king extends Pip() { string = "K"; } +object ace extends Pip() { string = "A"; } + +class Card(shared Pip pip, shared Suit suit) { + string = "``pip`` of ``suit``"; +} + + +String join(Card[] cards) => ", ".join { *cards }; + +class Deck (cards = [ for (suit in `Suit`.caseValues) for (pip in `Pip`.caseValues) Card(pip, suit) ]) { + shared Card[] cards; + + shared Deck shuffle(Random rnd = platformRandom()) + => if (nonempty cards) + then Deck( [*randomize(cards, rnd)] ) + else this; + + shared Integer size => cards.size; + + shared Boolean empty => cards.empty; + + string => if (size > 13) + then "\n " + "\n ". join { *cards.partition(13).map((cards) => join(cards)) } + else join(cards); + + shared [Card[], Deck] deal(Integer handSize = 5) { + if (handSize >= cards.size) { + return [cards, Deck([])]; + } + else { + return [ + cards.initial(handSize), + Deck(cards.skip(handSize).sequence()) + ]; + } + } +} diff --git a/Task/Playing-cards/Nim/playing-cards.nim b/Task/Playing-cards/Nim/playing-cards.nim new file mode 100644 index 0000000000..bfe6d18779 --- /dev/null +++ b/Task/Playing-cards/Nim/playing-cards.nim @@ -0,0 +1,43 @@ +import math +randomize() + +proc shuffle[T](x: var seq[T]) = + for i in countdown(x.high, 0): + let j = random(i + 1) + swap(x[i], x[j]) + +type + Suit = enum ♥, ♦, ♣, ♠ + + Pip = enum c02, c03, c04, c05, c06, c07, c08, c09, c10, cQu, cKi, cAs + + Card = object + pip: Pip + suit: Suit + + Deck = object + cards: seq[Card] + +proc `$`(c: Card): string = $c.pip & $c.suit + +proc initDeck(): Deck = + result = Deck(cards: @[]) + for suit in Suit: + for pip in Pip: + result.cards.add Card(pip: pip, suit: suit) + +proc `$`(d: Deck): string = $d.cards + +proc shuffle(d: var Deck) = shuffle(d.cards) + +proc deal(d: var Deck): Card = + d.shuffle() + d.cards.pop() + +var d = initDeck() +echo "40 cards from a deck:" +for i in 0..4: + for j in 0..7: + stdout.write($d.deal(), " ") + echo "" +echo "The remaining cards are: ", $d diff --git a/Task/Playing-cards/Ring/playing-cards.ring b/Task/Playing-cards/Ring/playing-cards.ring new file mode 100644 index 0000000000..d86e485253 --- /dev/null +++ b/Task/Playing-cards/Ring/playing-cards.ring @@ -0,0 +1,245 @@ +Load "guilib.ring" + +nScale = 1 + +app1 = new qApp + +mypic = new QPixmap("cards.jpg") + +mypic2 = mypic.copy(0,(124*4)+1,79,124) +Player1EatPic = mypic.copy(80,(124*4)+1,79,124) +Player2EatPic= mypic.copy(160,(124*4)+1,79,124) + +aMyCards = [] +aMyValues = [] +for x1 = 0 to 3 + for y1 = 0 to 12 + temppic = mypic.copy((79*y1)+1,(124*x1)+1,79,124) + aMyCards + temppic + aMyValues + (y1+1) + next +next + +nPlayer1Score = 0 nPlayer2Score=0 + +do + Page1 = new Game + Page1.Start() +again Page1.lnewgame + +mypic.delete() +mypic2.delete() +Player1EatPic.delete() +Player2EatPic.delete() + +for t in aMyCards + t.delete() +next + +func gui_setbtnpixmap pBtn,pPixmap + pBtn { + setIcon(new qicon(pPixmap.scaled(width(),height(),0,0))) + setIconSize(new QSize(width(),height())) + } + +Class Game + + nCardsCount = 10 + win1 layout1 label1 label2 layout2 layout3 aBtns aBtns2 + aCards nRole=1 aStatus = list(nCardsCount) aStatus2 = aStatus + aValues aStatusValues = aStatus aStatusValues2 = aStatus + Player1EatPic Player2EatPic + lnewgame = false + nDelayEat = 0.5 + nDelayNewGame = 1 + + func start + + win1 = new qWidget() { + setwindowtitle("Five") + setstylesheet("background-color: White") + showfullscreen() + } + + layout1 = new qvboxlayout() + + label1 = new qlabel(win1) { + settext("Player (1) - Score : " + nPlayer1Score) + setalignment(Qt_AlignHCenter | Qt_AlignVCenter) + setstylesheet("color: White; background-color: Purple; + font-size:20pt") + setfixedheight(200) + } + + closebtn = new qpushbutton(win1) { + settext("Close Application") + setstylesheet("font-size: 18px ; color : white ; + background-color: black ;") + setclickevent("Page1.win1.close()") + } + + aCards = aMyCards + aValues = aMyValues + + layout2 = new qhboxlayout() + + aBtns = [] + + for x = 1 to nCardsCount + aBtns + new qpushbutton(win1) + aBtns[x].setfixedwidth(79*nScale) + aBtns[x].setfixedheight(124*nScale) + gui_setbtnpixmap(aBtns[x],mypic2) + layout2.addwidget(aBtns[x]) + aBtns[x].setclickevent("Page1.Player1click("+x+")") + next + + layout1.addwidget(label1) + layout1.addlayout(layout2) + + label2 = new qlabel(win1) { + settext("Player (2) - Score : " + nPlayer2Score) + setalignment(Qt_AlignHCenter | Qt_AlignVCenter) + setstylesheet("color: white; background-color: red; + font-size:20pt") + setfixedheight(200) + } + + layout3 = new qhboxlayout() + + aBtns2 = [] + for x = 1 to nCardsCount + aBtns2 + new qpushbutton(win1) + aBtns2[x].setfixedwidth(79*nScale) + aBtns2[x].setfixedheight(124*nScale) + gui_setbtnpixmap(aBtns2[x],mypic2) + layout3.addwidget(aBtns2[x]) + aBtns2[x].setclickevent("Page1.Player2click("+x+")") + next + + layout1.addwidget(label2) + layout1.addlayout(layout3) + layout1.addwidget(closebtn) + + win1.setlayout(layout1) + + app1.exec() + + Func Player1Click x + if nRole = 1 and aStatus[x] = 0 + nPos = ((random(100)+clock())%(len(aCards)-1)) + 1 + gui_setbtnpixmap(aBtns[x],aCards[nPos]) + del(aCards,nPos) + nRole = 2 + aStatus[x] = 1 + aStatusValues[x] = aValues[nPos] + del(aValues,nPos) + Player1Eat(x,aStatusValues[x]) + checknewgame() + ok + + Func Player2Click x + if nRole = 2 and aStatus2[x] = 0 + nPos = ((random(100)+clock())%(len(aCards)-1)) + 1 + gui_setbtnpixmap(aBtns2[x],aCards[nPos]) + del(aCards,nPos) + nRole = 1 + aStatus2[x] = 1 + aStatusValues2[x] = aValues[nPos] + del(aValues,nPos) + Player2Eat(x,aStatusValues2[x]) + checknewgame() + ok + + Func Player1Eat nPos,nValue + + app1.processEvents() + + delay(nDelayEat) + lEat = false + for x = 1 to nCardsCount + if aStatus2[x] = 1 and (aStatusValues2[x] = nValue or nValue=5) + aStatus2[x] = 2 + gui_setbtnpixmap(aBtns2[x],Player1EatPic) + lEat = True + nPlayer1Score++ + ok + if (x != nPos) and (aStatus[x] = 1) and + (aStatusValues[x] = nValue or nValue=5) + aStatus[x] = 2 + gui_setbtnpixmap(aBtns[x],Player1EatPic) + lEat = True + nPlayer1Score++ + ok + next + if lEat + nPlayer1Score++ + gui_setbtnpixmap(aBtns[nPos],Player1EatPic) + aStatus[nPos] = 2 + label1.settext("Player (1) - Score : " + nPlayer1Score) + ok + + Func Player2Eat nPos,nValue + + app1.processEvents() + + delay(nDelayEat) + lEat = false + for x = 1 to nCardsCount + if aStatus[x] = 1 and (aStatusValues[x] = nValue or nValue = 5) + aStatus[x] = 2 + gui_setbtnpixmap(aBtns[x],Player2EatPic) + lEat = True + nPlayer2Score++ + ok + + if (x != nPos) and (aStatus2[x] = 1) and + (aStatusValues2[x] = nValue or nValue=5 ) + aStatus2[x] = 2 + gui_setbtnpixmap(aBtns2[x],Player2EatPic) + lEat = True + nPlayer2Score++ + ok + next + if lEat + nPlayer2Score++ + gui_setbtnpixmap(aBtns2[nPos],Player2EatPic) + aStatus2[nPos] = 2 + label2.settext("Player (2) - Score : " + nPlayer2Score) + ok + + Func checknewgame + if isnewgame() + lnewgame = true + + if nPlayer1Score > nPlayer2Score + label1.settext("Player (1) Wins!!!") + ok + if nPlayer2Score > nPlayer1Score + label2.settext("Player (2) Wins!!!") + ok + + app1.processEvents() + delay(nDelayNewGame) + + win1.delete() + app1.quit() + ok + + Func isnewgame + for t in aStatus + if t = 0 + return false + ok + next + for t in aStatus2 + if t = 0 + return false + ok + next + return true + + Func delay x + nTime = x * 1000 + oTest = new qTest + oTest.qsleep(nTime) diff --git a/Task/Playing-cards/Sidef/playing-cards.sidef b/Task/Playing-cards/Sidef/playing-cards.sidef new file mode 100644 index 0000000000..4c1cc47d59 --- /dev/null +++ b/Task/Playing-cards/Sidef/playing-cards.sidef @@ -0,0 +1,31 @@ +define Pip = ; +define Suit = <♦ ♣ ♥ ♠>; + +class Card(pip, suit) { + method to_s { pip + suit } +} + +class Deck(cards=[]) { + + method init { + cards = gather { + Pip.each { |p| Suit.each { |s| take(Card(p, s)) } } + } + } + + method shuffle { + cards.shuffle!; + } + + method deal { cards.shift }; + method to_s { cards.join(" ") }; +} + +var d = Deck(); +say "Deck: #{d}"; + +var top = d.deal; +say "Top card: #{top}"; + +d.shuffle; +say "Deck, shuffled: #{d}"; diff --git a/Task/Playing-cards/Swift/playing-cards.swift b/Task/Playing-cards/Swift/playing-cards.swift new file mode 100644 index 0000000000..5af67dfc9b --- /dev/null +++ b/Task/Playing-cards/Swift/playing-cards.swift @@ -0,0 +1,182 @@ +import Foundation + +// extend any Indexed collection to be able to shuffle (see http://stackoverflow.com/questions/24026510/how-do-i-shuffle-an-array-in-swift) +extension CollectionType where Index == Int { + /// Return a copy of `self` with its elements shuffled + func shuffle() -> [Generator.Element] { + var list = Array(self) + list.shuffleInPlace() + return list + } +} + +extension MutableCollectionType where Index == Int { + /// Shuffle the elements of `self` in-place. + mutating func shuffleInPlace() { + // empty and single-element collections don't shuffle + if count < 2 { return } + + for i in 0.. 10 + } + + var color : CardColor { + return suit.color + } +} +extension Card : Equatable {} +func == (l:Card, r:Card) -> Bool { + return l.pip == r.pip && + l.suit == r.suit +} +extension Card : CustomStringConvertible { + var description : String { + return "\(pip) of \(suit)" + } +} + + +struct Deck { + var cards : [Card] + + var count : Int { + return cards.count + } + + init(shuffling:Bool=true) { + var startcards = [Card]() + for suit in (Suit.Hearts.rawValue...Suit.Clubs.rawValue) { + for pip in (Pip.Ace.rawValue...Pip.King.rawValue) { + startcards.append(Card(pip: Pip(rawValue: pip)!, suit: Suit(rawValue: suit)!)) + } + } + cards = startcards + + if shuffling { + shuffle() + } + } + + mutating func shuffle() { + cards.shuffleInPlace() + } + + mutating func deal() -> Card { + let out = cards.removeFirst() + return out + } + +} +extension Deck : CustomStringConvertible { + var description : String { + return "\(count) cards: \(cards.description)" + } +} + + + +// test some cards +let kh = Card(pip: .King, suit: .Hearts) +let ad = Card(pip: .Ace, suit: .Diamonds) +let tc = Card(pip: .Two, suit: .Clubs) +let fc = Card(pip: Pip(rawValue:4)!, suit: .Spades) + + +// create an unshuffled deck +var efg = Deck(shuffling: false) + + +// create a shuffled deck and print its contents +var d = Deck() +print(d) + +// deal three cards +d.deal() +d.deal() +d.deal() +d + +// deal a couple more cards and check their color +let c = d.deal() +c.color + +let cc = d.deal() +cc.color + +// deal out the rest of the deck, leaving just one card +while d.count > 1 { + d.deal() +} +d + +// test equality of a couple cards +if kh == Card(pip: Pip.King, suit: Suit.Clubs) { + let a = true +} +else { + let a = false +} + +kh != Card(pip: Pip.King, suit: Suit.Clubs) +kh.isFaceCard +fc.isFaceCard diff --git a/Task/Plot-coordinate-pairs/EchoLisp/plot-coordinate-pairs.echolisp b/Task/Plot-coordinate-pairs/EchoLisp/plot-coordinate-pairs.echolisp new file mode 100644 index 0000000000..fd56ac9388 --- /dev/null +++ b/Task/Plot-coordinate-pairs/EchoLisp/plot-coordinate-pairs.echolisp @@ -0,0 +1,9 @@ +(lib 'plot) + +(define ys #(2.7 2.8 31.4 38.1 58.0 76.2 100.5 130.0 149.3 180.0) ) +(define (f n) [ys n]) + +(plot-sequence f 9) + → (("x:auto" 0 9) ("y:auto" 2 198)) +(plot-grid 1 20) +(plot-text " Rosetta plot coordinate pairs" 0 10 "white") diff --git a/Task/Plot-coordinate-pairs/Sidef/plot-coordinate-pairs.sidef b/Task/Plot-coordinate-pairs/Sidef/plot-coordinate-pairs.sidef new file mode 100644 index 0000000000..f6bd66bbdd --- /dev/null +++ b/Task/Plot-coordinate-pairs/Sidef/plot-coordinate-pairs.sidef @@ -0,0 +1,12 @@ +require('GD::Graph::points') + +var data = [ + [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], + [2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0], +] + +var graph = %s'GD::Graph::points'.new(400, 300) +var gd = graph.plot(data) + +var format = 'png' +File("qsort-range.#{format}").write(gd.(format), :raw) diff --git a/Task/Plot-coordinate-pairs/jq/plot-coordinate-pairs-1.jq b/Task/Plot-coordinate-pairs/jq/plot-coordinate-pairs-1.jq new file mode 100644 index 0000000000..888e561b67 --- /dev/null +++ b/Task/Plot-coordinate-pairs/jq/plot-coordinate-pairs-1.jq @@ -0,0 +1 @@ +jq -n -M -r -f plot.jq | R CMD BATCH plot.R diff --git a/Task/Plot-coordinate-pairs/jq/plot-coordinate-pairs-2.jq b/Task/Plot-coordinate-pairs/jq/plot-coordinate-pairs-2.jq new file mode 100644 index 0000000000..f3ca56d661 --- /dev/null +++ b/Task/Plot-coordinate-pairs/jq/plot-coordinate-pairs-2.jq @@ -0,0 +1,20 @@ +# NOTE: This definition of transpose can be omitted +# if your version of jq includes transpose as a builtin. +# +# transpose a possibly jagged matrix, quickly; +# rows are padded with nulls so the result is always rectangular. +def transpose: + if . == [] then [] + else . as $in + | (map(length) | max) as $max + | length as $length + | reduce range(0; $max) as $j + ([]; . + [reduce range(0;$length) as $i ([]; . + [ $in[$i][$j] ] )] ) + end; + +def x: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; +def y: [2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0]; + +def plot(x;y): "A,B", ( [x,y] | transpose | map( @csv ) | .[]); + +plot(x;y) diff --git a/Task/Plot-coordinate-pairs/jq/plot-coordinate-pairs-3.jq b/Task/Plot-coordinate-pairs/jq/plot-coordinate-pairs-3.jq new file mode 100644 index 0000000000..dd3f17f33b --- /dev/null +++ b/Task/Plot-coordinate-pairs/jq/plot-coordinate-pairs-3.jq @@ -0,0 +1,8 @@ +mydata <- read.table( file("stdin"), header=TRUE, sep=",") + +x = mydata$A # x-axis +y = mydata$B # y-axis +plot(x, y, # plot the variables + main="Scatterplot Example", + xlab="x-axis label", # x-axis label + ylab="y-axis label" ) # y-axis label diff --git a/Task/Pointers-and-references/EchoLisp/pointers-and-references.echolisp b/Task/Pointers-and-references/EchoLisp/pointers-and-references.echolisp new file mode 100644 index 0000000000..4da770a417 --- /dev/null +++ b/Task/Pointers-and-references/EchoLisp/pointers-and-references.echolisp @@ -0,0 +1,13 @@ +(define B (box 42)) + → B ;; box reference +(unbox B) + → 42 ;; box contents + +;; sets new value for box contents +(define ( change-by-ref abox avalue) + (set-box! abox avalue) ) + +(change-by-ref B 666) + → #[box 666] +(unbox B) + → 666 diff --git a/Task/Pointers-and-references/FreeBASIC/pointers-and-references.freebasic b/Task/Pointers-and-references/FreeBASIC/pointers-and-references.freebasic new file mode 100644 index 0000000000..2dde21b4d5 --- /dev/null +++ b/Task/Pointers-and-references/FreeBASIC/pointers-and-references.freebasic @@ -0,0 +1,47 @@ +' FB 1.05.0 Win64 + +Type Cat + name As String + age As Integer +End Type + +Type CatInfoType As Sub (As Cat Ptr) + +Sub printCatInfo(c As Cat Ptr) + Print "Name "; c->name, "Age"; c-> age + Print +End Sub + +' create Cat object on heap and store a pointer to it +Dim c As Cat Ptr = New Cat + +' set fields using the pointer and the "crow's foot" operator +c->name = "Fluffy" +c->age = 9 + +' print them out through a procedure pointer +Dim cit As CatInfoType = ProcPtr(printCatInfo) +cit(c) + +Delete c +c = 0 + +Dim i As Integer = 3 +' create an integer pointer variable and set it to the address of 'i' +Dim pi As Integer Ptr = @i + +'change the variable through the pointer +*pi = 4 + +'print out the result +print "i ="; *pi + +'create a reference to the variable i +Dim ByRef As Integer j = i + +' set j (and hence i) to a new value +j = 5 + +' print them out +Print "i ="; i, "j ="; j +Sleep diff --git a/Task/Pointers-and-references/Nim/pointers-and-references-1.nim b/Task/Pointers-and-references/Nim/pointers-and-references-1.nim new file mode 100644 index 0000000000..1267c623ed --- /dev/null +++ b/Task/Pointers-and-references/Nim/pointers-and-references-1.nim @@ -0,0 +1,5 @@ +type Foo = ref object + x, y: float + +var f: Foo +new f diff --git a/Task/Pointers-and-references/Nim/pointers-and-references-2.nim b/Task/Pointers-and-references/Nim/pointers-and-references-2.nim new file mode 100644 index 0000000000..e371af2da7 --- /dev/null +++ b/Task/Pointers-and-references/Nim/pointers-and-references-2.nim @@ -0,0 +1 @@ +echo f[] diff --git a/Task/Pointers-and-references/Nim/pointers-and-references-3.nim b/Task/Pointers-and-references/Nim/pointers-and-references-3.nim new file mode 100644 index 0000000000..58eb7db2dc --- /dev/null +++ b/Task/Pointers-and-references/Nim/pointers-and-references-3.nim @@ -0,0 +1,4 @@ +echo f[].x +f[].y = 12 +echo f.y +f.x = 13.5 diff --git a/Task/Pointers-and-references/Nim/pointers-and-references-4.nim b/Task/Pointers-and-references/Nim/pointers-and-references-4.nim new file mode 100644 index 0000000000..54968e5c4f --- /dev/null +++ b/Task/Pointers-and-references/Nim/pointers-and-references-4.nim @@ -0,0 +1,2 @@ +var x = 3 +var p = addr x diff --git a/Task/Pointers-and-references/Nim/pointers-and-references-5.nim b/Task/Pointers-and-references/Nim/pointers-and-references-5.nim new file mode 100644 index 0000000000..9da2a2faa7 --- /dev/null +++ b/Task/Pointers-and-references/Nim/pointers-and-references-5.nim @@ -0,0 +1,2 @@ +echo p[] +p[] = 42 diff --git a/Task/Pointers-and-references/Nim/pointers-and-references-6.nim b/Task/Pointers-and-references/Nim/pointers-and-references-6.nim new file mode 100644 index 0000000000..c7c8652aa4 --- /dev/null +++ b/Task/Pointers-and-references/Nim/pointers-and-references-6.nim @@ -0,0 +1,2 @@ +var y = 12 +p = addr y diff --git a/Task/Pointers-and-references/Nim/pointers-and-references-7.nim b/Task/Pointers-and-references/Nim/pointers-and-references-7.nim new file mode 100644 index 0000000000..7eb47bbe2d --- /dev/null +++ b/Task/Pointers-and-references/Nim/pointers-and-references-7.nim @@ -0,0 +1 @@ +p = nil diff --git a/Task/Pointers-and-references/Sidef/pointers-and-references.sidef b/Task/Pointers-and-references/Sidef/pointers-and-references.sidef new file mode 100644 index 0000000000..44ddd6dd72 --- /dev/null +++ b/Task/Pointers-and-references/Sidef/pointers-and-references.sidef @@ -0,0 +1,7 @@ +func assign2ref(ref, value) { + *ref = value; +} + +var x = 10; +assign2ref(\x, 20); +say x; # x is now 20 diff --git a/Task/Polymorphic-copy/EchoLisp/polymorphic-copy.echolisp b/Task/Polymorphic-copy/EchoLisp/polymorphic-copy.echolisp new file mode 100644 index 0000000000..03eac441d9 --- /dev/null +++ b/Task/Polymorphic-copy/EchoLisp/polymorphic-copy.echolisp @@ -0,0 +1,24 @@ +(lib 'types) +(lib 'struct) + +(struct T (integer:x)) ;; super class +(struct S T (integer:y)) ;; sub class +(struct K (T:box)) ;; container class, box must be of type T, or derived + +(define k-source (K (S 33 42))) +(define k-copy (copy k-source)) + +k-source + → # (# (33 42)) ;; new container, with a S in box +k-copy + → # (# (33 42)) ;; copied S type + +(set-S-y! (K-box k-source) 666) ;; modify k-source.box.y + +k-source + → # (# (33 666)) ;; modified +k-copy + → # (# (33 42)) ;; unmodified + +(K "string-inside") ;; trying to put a string in the container box +😡 error: T : type-check failure : string-inside → 'K:box' diff --git a/Task/Polymorphic-copy/Nim/polymorphic-copy.nim b/Task/Polymorphic-copy/Nim/polymorphic-copy.nim new file mode 100644 index 0000000000..d197b40813 --- /dev/null +++ b/Task/Polymorphic-copy/Nim/polymorphic-copy.nim @@ -0,0 +1,37 @@ +type + T = ref object of TObject + myValue: string + S1 = ref object of T + S2 = ref object of T + +method speak(x: T) = echo "T Hello ", x.myValue +method speak(x: S1) = echo "S1 Meow ", x.myValue +method speak(x: S2) = echo "S2 Woof ", x.myValue + +echo "creating initial objects of types S1, S2, and T" +var a = S1(myValue: "Green") +a.speak +var b = S2(myValue: "Blue") +b.speak +var u = T(myValue: "Blue") +u.speak + +echo "Making copy of a as u, colors and types should match" +u.deepCopy(a) +u.speak +a.speak + +echo "Assigning new color to u, A's color should be unchanged." +u.myValue = "Orange" +u.speak +a.speak + +echo "Assigning u to reference same object as b, colors and types should match" +u = b +u.speak +b.speak + +echo "Assigning new color to u. Since u,b references same object b's color changes as well" +u.myValue = "Yellow" +u.speak +b.speak diff --git a/Task/Polymorphic-copy/Sidef/polymorphic-copy.sidef b/Task/Polymorphic-copy/Sidef/polymorphic-copy.sidef new file mode 100644 index 0000000000..93d185fc14 --- /dev/null +++ b/Task/Polymorphic-copy/Sidef/polymorphic-copy.sidef @@ -0,0 +1,22 @@ +class T(value) { + method display { + say value; + } +} + +class S(value) < T { + method display { + say value; + } +} + +var obj1 = T("T"); +var obj2 = S("S"); +var obj3 = obj2.dclone; # make a deep clone of obj2 + +obj1.value = "foo"; # change the value of obj1 +obj2.value = "bar"; # change the value of obj2 + +obj1.display; # prints "foo" +obj2.display; # prints "bar" +obj3.display; # prints "S" diff --git a/Task/Polymorphic-copy/Swift/polymorphic-copy.swift b/Task/Polymorphic-copy/Swift/polymorphic-copy.swift new file mode 100644 index 0000000000..986e317b79 --- /dev/null +++ b/Task/Polymorphic-copy/Swift/polymorphic-copy.swift @@ -0,0 +1,24 @@ +class T { + required init() { } // constructor used in polymorphic initialization must be "required" + func identify() { + println("I am a genuine T") + } + func copy() -> T { + let newObj : T = self.dynamicType() // call an appropriate constructor here + // then copy data into newObj as appropriate here + // make sure to use "self.dynamicType(...)" and + // not "T(...)" to make it polymorphic + return newObj + } +} + +class S : T { + override func identify() { + println("I am an S") + } +} + +let original : T = S() +let another : T = original.copy() +println(original === another) // prints "false" (i.e. they are different objects) +another.identify() // prints "I am an S" diff --git a/Task/Polymorphism/EchoLisp/polymorphism.echolisp b/Task/Polymorphism/EchoLisp/polymorphism.echolisp new file mode 100644 index 0000000000..28ffedea79 --- /dev/null +++ b/Task/Polymorphism/EchoLisp/polymorphism.echolisp @@ -0,0 +1,42 @@ +(struct Point ((real:x 0) (real:y 0))) +(struct Circle ((real:x 0) (real:y 0) (real:r 1))) + +(define-method (print Point:p) (printf "📌 [%d %d]" p.x p.y)) +(define-method (print Circle:c) (printf "⭕️ center:[%d %d] radius:%d" c.x c.y c.r)) + +(print (Point 5 6)) + → 📌 [5 6] +(print (Circle 2 3 4)) + → ⭕️ center:[2 3] radius:4 + +;; Accessors : +;; (Point-x p), (Point-y p) or p.x, p.y +;; (Circle-x c), c.x , etc. +;; Setters : +;; (set-Point-x! p value), (set-Circle-r! c value) etc. + +;; Constructors +;; (Point) (Point x) (Point x y) +;; (Circle) (circle x) (Circle x y) (Circle x y r) + +;;Copy +(print (copy (Circle 3 3 ))) + → ⭕️ center:[3 3] radius:1 + +;;Assignment (to a variable) +(define my-point (Point 7 8)) + +;;Destructor : none. Points and Circles are garbage collected. + +;;Type checking +(Point "here" "there") + 💣 error: Real : type-check failure : here → 'Point:x' + +;;Initializer procedure +(struct Circle ((x 0) (y 0) (r 1) d) #:initialize circle-init) +(define (circle-init Circle:c) (set-Circle-d! c (* 2 PI c.r))) +(define-method (print Circle:c) + (printf "⭕️ center:[%d %d] radius:%d diameter:%d" c.x c.y c.r c.d)) + +(print (Circle 0 0 10)) + → ⭕️ center:[0 0] radius:10 diameter:62.83185307179586 diff --git a/Task/Polymorphism/Nim/polymorphism.nim b/Task/Polymorphism/Nim/polymorphism.nim new file mode 100644 index 0000000000..4ef2502cfc --- /dev/null +++ b/Task/Polymorphism/Nim/polymorphism.nim @@ -0,0 +1,35 @@ +type + Point = object + x, y: float + + Circle = object + center: Point + radius: float + +# Constructors +proc createPoint(x, y = 0.0): Point = + result.x = x + result.y = y + +proc createCircle(x, y = 0.0, radius = 1.0): Circle = + result.center.x = x + result.center.y = y + result.radius = radius + +var p1 = createPoint() +echo "p1: ", p1 # We use the default $ operator for printing +var p2 = createPoint(3, 4.2) +var p3 = createPoint(x = 2) +var p4 = createPoint(y = 2.5) + +p2 = p4 +p3 = createPoint() + +var c1 = createCircle() +echo "c1: ", c1 +var c2 = createCircle(2, 0.5, 4.2) +var c3 = createCircle(x = 2.1, y = 2) +var c4 = createCircle(radius = 10) + +c1.center.x = 12 +c1.radius = 5.2 diff --git a/Task/Polymorphism/Oforth/polymorphism-1.oforth b/Task/Polymorphism/Oforth/polymorphism-1.oforth new file mode 100644 index 0000000000..5dded9bc81 --- /dev/null +++ b/Task/Polymorphism/Oforth/polymorphism-1.oforth @@ -0,0 +1,14 @@ +Object Class new: Point(x, y) +Point method: initialize(x, y) x := x y := y ; +Point method: _x @x ; +Point method: _y @y ; +Point method: << "(" << @x << ", " << @y << ")" << ; + +Object Class new: Circle(x, y, r) +Circle method: initialize(x, y, r) x := x y := y r := r ; +Circle method: _x @x ; +Circle method: _y @y ; +Circle method: _r @r ; +Circle method: << "(" << @x << ", " << @y << ", " << @r << ")" << ; + +Circle classMethod: newFromPoint(aPoint, r) self new(aPoint _x, aPoint _y, r) ; diff --git a/Task/Polymorphism/Oforth/polymorphism-2.oforth b/Task/Polymorphism/Oforth/polymorphism-2.oforth new file mode 100644 index 0000000000..e3056e1568 --- /dev/null +++ b/Task/Polymorphism/Oforth/polymorphism-2.oforth @@ -0,0 +1,9 @@ +: testPoly +| p c | + Point new(3, 4) ->p + p println + System.Out "Attributes of this point are : " << p _x << " and " << p _y << cr + Circle new(5, 6, 7.1) ->c + c println + System.Out "Attributes of this circle are : " << c _x << ", " << c _y << " and " << c _r << cr + Circle newFromPoint(p, 2) println ; diff --git a/Task/Polymorphism/Phix/polymorphism.phix b/Task/Polymorphism/Phix/polymorphism.phix new file mode 100644 index 0000000000..a5523960a3 --- /dev/null +++ b/Task/Polymorphism/Phix/polymorphism.phix @@ -0,0 +1,24 @@ +type point(object o) + return sequence(o) and length(o)=2 and atom(o[1]) and atom(o[2]) +end type + +function new_point(atom x=0, atom y=0) + return {x,y} +end function + +type circle(object o) + return sequence(o) and length(o)=2 and point(o[1]) and atom(o[2]) +end type + +function new_circle(object x=0, atom y=0, atom r=0) + if point(x) then + r = y -- assume r got passed in y + return {x,r} -- {point,r} + end if + return {{x,y},r} +end function + +point p = new_point(4,5) +circle c = new_circle(p,6) +?p +?c diff --git a/Task/Polymorphism/Sidef/polymorphism-1.sidef b/Task/Polymorphism/Sidef/polymorphism-1.sidef new file mode 100644 index 0000000000..06ab8e27d5 --- /dev/null +++ b/Task/Polymorphism/Sidef/polymorphism-1.sidef @@ -0,0 +1,15 @@ +class Point(x=0, y=0) { + +} + +class Circle(x=0, y=0, r=0) { + +} + +func pp(Point obj) { + say "Point at #{obj.x},#{obj.y}"; +} + +func pp(Circle obj) { + say "Circle at #{obj.x},#{obj.y} with radius #{obj.r}"; +} diff --git a/Task/Polymorphism/Sidef/polymorphism-2.sidef b/Task/Polymorphism/Sidef/polymorphism-2.sidef new file mode 100644 index 0000000000..c3a056a5f6 --- /dev/null +++ b/Task/Polymorphism/Sidef/polymorphism-2.sidef @@ -0,0 +1,12 @@ +pp(Point.new); # => Point at 0,0 +var p = Point(1, 2); # create a point +pp(p); # => Point at 1,2 +say p.x; # => 1 +p.y += 1; # add one to y +pp(p); # => Point at 1,3 + +var c = Circle(4,5,6); # create a circle +var d = c.clone; # make a clone of it +d.r = 7.5; # and change the radius to 7.5 +pp(c); # => Circle at 4,5 with radius 6 +pp(d); # => Circle at 4,5 with radius 7.5 diff --git a/Task/Polymorphism/Swift/polymorphism.swift b/Task/Polymorphism/Swift/polymorphism.swift new file mode 100644 index 0000000000..c670b85018 --- /dev/null +++ b/Task/Polymorphism/Swift/polymorphism.swift @@ -0,0 +1,46 @@ +class RCPoint : Printable { + var x: Int + var y: Int + init(x: Int = 0, y: Int = 0) { + self.x = x + self.y = y + } + convenience init(p: RCPoint) { + self.init(x:p.x, y:p.y) + } + var description: String { + return "" + } +} + +class RCCircle : RCPoint { + var r: Int + init(p: RCPoint, r: Int = 0) { + self.r = r + super.init(x:p.x, y:p.y) + } + init(x: Int = 0, y: Int = 0, r: Int = 0) { + self.r = r + super.init(x:x, y:y) + } + convenience init(c: RCCircle) { + self.init(x:c.x, y:c.y, r:c.r) + } + override var description: String { + return "" + } +} + +println(RCPoint()) +println(RCPoint(x:3)) +println(RCPoint(x:3, y:4)) +println(RCCircle()) +println(RCCircle(x:3)) +println(RCCircle(x:3, y:4)) +println(RCCircle(x:3, y:4, r:7)) +let p = RCPoint(x:1, y:2) +println(RCCircle(p:p)) +println(RCCircle(p:p, r:7)) +println(p.x) // 1 +p.x = 8 +println(p.x) // 8 diff --git a/Task/Polymorphism/Wollok/polymorphism.wollok b/Task/Polymorphism/Wollok/polymorphism.wollok new file mode 100644 index 0000000000..e730dbc678 --- /dev/null +++ b/Task/Polymorphism/Wollok/polymorphism.wollok @@ -0,0 +1,43 @@ +class Point { + var x + var y + new(ax, ay) { + this.x = ax + this.y = ay + } + new(point) { + this(point.x, point.y) + } + method getX() { return x } + method setX(newX) { x = newX } + + method getY() { return y } + method setY(newY) { y = newY } + + method print() { + console.println("Point") + } +} + +class Circle extends Point { + var r + + new() { this(0,0,0) } + new(point, aR) { super(point) ; r = aR } + new(aX, aY, aR) { super(aX, aY); r = aR } + + method getR() { return r } + method setR(newR) { r = newR } + + method print() { + console.println("Circle") + } + +} + +program polymorphism { + val p = new Point() + val c = new Circle() + p.print() + c.print() +} diff --git a/Task/Polynomial-long-division/Sidef/polynomial-long-division-1.sidef b/Task/Polynomial-long-division/Sidef/polynomial-long-division-1.sidef new file mode 100644 index 0000000000..9a4b655323 --- /dev/null +++ b/Task/Polynomial-long-division/Sidef/polynomial-long-division-1.sidef @@ -0,0 +1,20 @@ +func poly_long_div(rn, rd) { + + var n = rn.map{_} + var gd = rd.len + + if (n.len >= gd) { + return(gather { + while (n.len >= gd) { + var piv = n[0]/rd[0] + take(piv) + 0.to(n.len.min(gd)-1).each { |i| + n[i] -= (rd[i] * piv) + } + n.shift + } + }, n) + } + + return([0], rn) +} diff --git a/Task/Polynomial-long-division/Sidef/polynomial-long-division-2.sidef b/Task/Polynomial-long-division/Sidef/polynomial-long-division-2.sidef new file mode 100644 index 0000000000..60bc71aaa1 --- /dev/null +++ b/Task/Polynomial-long-division/Sidef/polynomial-long-division-2.sidef @@ -0,0 +1,22 @@ +func poly_print(c) { + var l = c.len + c.each_kv {|i, n| + print n + print("x^", (l - i - 1), " + ") if (i < l-1) + } + print "\n"; +} + +var poly = [ + Pair([1,-12,0,-42], [1, -3]), + Pair([1,-12,0,-42], [1,1,-3]), + Pair( [1,3,2], [1,1]), + Pair( [1,-4,6,5,3], [1,2,1]), +] + +poly.each { |pair| + var (q, r) = poly_long_div(pair.first, pair.second) + poly_print(q) + poly_print(r) + print "\n" +} diff --git a/Task/Polynomial-regression/FreeBASIC/polynomial-regression.freebasic b/Task/Polynomial-regression/FreeBASIC/polynomial-regression.freebasic new file mode 100644 index 0000000000..5ce726a103 --- /dev/null +++ b/Task/Polynomial-regression/FreeBASIC/polynomial-regression.freebasic @@ -0,0 +1,78 @@ +Sub GaussJordan(matrix() As Double,rhs() As Double,ans() As Double) + Dim As Integer n=Ubound(matrix,1) + Redim ans(0):Redim ans(1 To n) + Dim As Double b(1 To n,1 To n),r(1 To n) + For c As Integer=1 To n 'take copies + r(c)=rhs(c) + For d As Integer=1 To n + b(c,d)=matrix(c,d) + Next d + Next c + #macro pivot(num) + For p1 As Integer = num To n - 1 + For p2 As Integer = p1 + 1 To n + If Abs(b(p1,num)) "; + Print Using "#.##"; rescale(d); + Print " "; + If i Mod 5 = 0 Then Print +Next + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Price-fraction/Nim/price-fraction.nim b/Task/Price-fraction/Nim/price-fraction.nim new file mode 100644 index 0000000000..0bbfe319b7 --- /dev/null +++ b/Task/Price-fraction/Nim/price-fraction.nim @@ -0,0 +1,32 @@ +import strutils, math + +const + pricemap: array[0 .. 19, int] = [10,18,26,32,38,44,50,54,58,62,66,70,74,78,82,86,90,94,98,100] + +# outputs an int (=>float*100) +proc floatToPrice100(f: float): int = + # indx: 0.1-0.05->0, 0.06-0.10->1, 0.11-0.15->2, ..... + var valu: int = toInt(f*100) + if valu == 0: + result = 10 + else: + dec(valu) + # inc indx every 5 of valu, so value of 1..100 translates to indx of 0..19 + var indx: int = 2*int(valu/10)+int((valu%%10)/5) + result = pricemap[indx] + +# str representation of an int (that is a representation of a float price) +proc price100ToStr(p: int): string = + if p < 10: + result = "0.0" & $p + if p < 100: + result = "0." & $p + else: + result = "1.00" + +randomize() +var i: int = 0 + +for x in 0 .. 10: + i = random(101) + echo("Price for ", i.price100ToStr(), ", is: ", float(i/100).floatToPrice100().price100ToStr()) diff --git a/Task/Price-fraction/Oforth/price-fraction.oforth b/Task/Price-fraction/Oforth/price-fraction.oforth new file mode 100644 index 0000000000..78d76729eb --- /dev/null +++ b/Task/Price-fraction/Oforth/price-fraction.oforth @@ -0,0 +1,7 @@ +[.06, .11, .16, .21, .26, .31, .36, .41, .46, .51, .56, .61, .66, .71, .76, .81, .86, .91, .96, 1.01] const: IN +[.10, .18, .26, .32, .38, .44, .50, .54, .58, .62, .66, .70, .74, .78, .82, .86, .90, .94, .98, 1.00] const: OUT + +: priceFraction(f) +| i | + IN size loop: i [ f IN at(i) < ifTrue: [ OUT at(i) return ] ] + null ; diff --git a/Task/Price-fraction/Phix/price-fraction.phix b/Task/Price-fraction/Phix/price-fraction.phix new file mode 100644 index 0000000000..73ff998003 --- /dev/null +++ b/Task/Price-fraction/Phix/price-fraction.phix @@ -0,0 +1,43 @@ +constant TBL=split(""" +>= 0.00 < 0.06 := 0.10 +>= 0.06 < 0.11 := 0.18 +>= 0.11 < 0.16 := 0.26 +>= 0.16 < 0.21 := 0.32 +>= 0.21 < 0.26 := 0.38 +>= 0.26 < 0.31 := 0.44 +>= 0.31 < 0.36 := 0.50 +>= 0.36 < 0.41 := 0.54 +>= 0.41 < 0.46 := 0.58 +>= 0.46 < 0.51 := 0.62 +>= 0.51 < 0.56 := 0.66 +>= 0.56 < 0.61 := 0.70 +>= 0.61 < 0.66 := 0.74 +>= 0.66 < 0.71 := 0.78 +>= 0.71 < 0.76 := 0.82 +>= 0.76 < 0.81 := 0.86 +>= 0.81 < 0.86 := 0.90 +>= 0.86 < 0.91 := 0.94 +>= 0.91 < 0.96 := 0.98 +>= 0.96 < 1.01 := 1.00""",'\n') + +sequence limits = {0}, + prices = {-1} +atom lt,price +for i=1 to length(TBL) do + {{?,lt,price}} = scanf(TBL[i],">= %.2f < %.2f := %.2f") + limits = append(limits,lt) + prices = append(prices,price) +end for + +function price_fix(atom p) + for i=1 to length(limits) do + if p= 0.00 < 0.06 := 0.10 +>= 0.06 < 0.11 := 0.18 +>= 0.11 < 0.16 := 0.26 +>= 0.16 < 0.21 := 0.32 +>= 0.21 < 0.26 := 0.38 +>= 0.26 < 0.31 := 0.44 +>= 0.31 < 0.36 := 0.50 +>= 0.36 < 0.41 := 0.54 +>= 0.41 < 0.46 := 0.58 +>= 0.46 < 0.51 := 0.62 +>= 0.51 < 0.56 := 0.66 +>= 0.56 < 0.61 := 0.70 +>= 0.61 < 0.66 := 0.74 +>= 0.66 < 0.71 := 0.78 +>= 0.71 < 0.76 := 0.82 +>= 0.76 < 0.81 := 0.86 +>= 0.81 < 0.86 := 0.90 +>= 0.86 < 0.91 := 0.94 +>= 0.91 < 0.96 := 0.98 +>= 0.96 < 1.01 := 1.00 +EOT + +func price(money) { + table.each { |row| + (row[0] <= money) -> + && (row[1] > money) -> + && return row[2]; + } + die "Out of range"; +} + +for n in %n(0.3793 0.4425 0.0746 0.6918 0.2993 0.5486 0.7848 0.9383 0.2292) { + say price(n); +} diff --git a/Task/Price-fraction/jq/price-fraction-1.jq b/Task/Price-fraction/jq/price-fraction-1.jq new file mode 100644 index 0000000000..ffae2385d7 --- /dev/null +++ b/Task/Price-fraction/jq/price-fraction-1.jq @@ -0,0 +1,5 @@ +def getScaleFactor: + ["0.10","0.18","0.26","0.32","0.38","0.44","0.50","0.54", + "0.58","0.62","0.66","0.70","0.74","0.78","0.82","0.86", + "0.90","0.94","0.98","1.00"] as $values + | $values[ (. * 100 - 1) / 5 | floor ] ; diff --git a/Task/Price-fraction/jq/price-fraction-2.jq b/Task/Price-fraction/jq/price-fraction-2.jq new file mode 100644 index 0000000000..264a19e30e --- /dev/null +++ b/Task/Price-fraction/jq/price-fraction-2.jq @@ -0,0 +1,5 @@ +def test: + (range(0;10) | "0.0\(.) -> \( 0.01 * . | getScaleFactor)"), + (range(10;100) | "0.\(.) -> \( 0.01 * . | getScaleFactor)"); + +test diff --git a/Task/Primality-by-trial-division/ERRE/primality-by-trial-division.erre b/Task/Primality-by-trial-division/ERRE/primality-by-trial-division.erre new file mode 100644 index 0000000000..78018d617a --- /dev/null +++ b/Task/Primality-by-trial-division/ERRE/primality-by-trial-division.erre @@ -0,0 +1,21 @@ +PROGRAM PRIME_TRIAL + +PROCEDURE ISPRIME(N%->OK%) + LOCAL T% + IF N%<=1 THEN OK%=FALSE EXIT PROCEDURE END IF + IF N%<=3 THEN OK%=TRUE EXIT PROCEDURE END IF + IF (N% AND 1)=0 THEN OK%=FALSE EXIT PROCEDURE END IF + FOR T%=3 TO SQR(N%) STEP 2 DO + IF N% MOD T%=0 THEN OK%=FALSE EXIT PROCEDURE END IF + END FOR + OK%=TRUE +END PROCEDURE + +BEGIN + + FOR I%=1 TO 100 DO + ISPRIME(I%->OK%) + IF OK% THEN PRINT(i%;"is prime") END IF + END FOR + +END PROGRAM diff --git a/Task/Primality-by-trial-division/EchoLisp/primality-by-trial-division.echolisp b/Task/Primality-by-trial-division/EchoLisp/primality-by-trial-division.echolisp new file mode 100644 index 0000000000..79bc7b0ca4 --- /dev/null +++ b/Task/Primality-by-trial-division/EchoLisp/primality-by-trial-division.echolisp @@ -0,0 +1,28 @@ +(lib 'sequences) + +;; Try divisors iff n = 2k + 1 +(define (is-prime? p) + (cond + [(< p 2) #f] + [(zero? (modulo p 2)) (= p 2)] + [else + (for/and ((d [3 5 .. (1+ (sqrt p))] )) (!zero? (modulo p d)))])) + +(filter is-prime? (range 1 100)) + → (2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97) + +;; Improve performance , try divisors iff n = 6k+1 or n = 6k+5 +(define (is-prime? p) + (cond + [(< p 2) #f] + [(zero? (modulo p 2)) (= p 2)] + [(zero? (modulo p 3)) (= p 3)] + [(zero? (modulo p 5)) (= p 5)] + [else ;; step 6 : try divisors 6n+1 or 6n+5 + (for ((d [7 13 .. (1+ (sqrt p))] )) + #:break (zero? (modulo p d)) => #f + #:break (zero? (modulo p (+ d 4))) => #f + #t )])) + +(filter is-prime? (range 1 100)) + → (2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97) diff --git a/Task/Primality-by-trial-division/FreeBASIC/primality-by-trial-division.freebasic b/Task/Primality-by-trial-division/FreeBASIC/primality-by-trial-division.freebasic new file mode 100644 index 0000000000..363652c5df --- /dev/null +++ b/Task/Primality-by-trial-division/FreeBASIC/primality-by-trial-division.freebasic @@ -0,0 +1,23 @@ +' FB 1.05.0 Win64 + +Function isPrime(n As Integer) As Boolean + If n < 2 Then Return False + If n = 2 Then Return True + If n Mod 2 = 0 Then Return False + Dim limit As Integer = Sqr(n) + For i As Integer = 3 To limit Step 2 + If n Mod i = 0 Then Return False + Next + Return True +End Function + +' To test this works, print all primes under 100 +For i As Integer = 1 To 99 + If isPrime(i) Then + Print Str(i); " "; + End If +Next + +Print : Print +Print "Press any key to quit" +Sleep diff --git a/Task/Primality-by-trial-division/FunL/primality-by-trial-division.funl b/Task/Primality-by-trial-division/FunL/primality-by-trial-division.funl new file mode 100644 index 0000000000..557864d879 --- /dev/null +++ b/Task/Primality-by-trial-division/FunL/primality-by-trial-division.funl @@ -0,0 +1,9 @@ +import math.sqrt + +def + isPrime( 2 ) = true + isPrime( n ) + | n < 3 or 2|n = false + | otherwise = (3..int(sqrt(n)) by 2).forall( (/|n) ) + +(10^10..10^10+50).filter( isPrime ).foreach( println ) diff --git a/Task/Primality-by-trial-division/FutureBasic/primality-by-trial-division.futurebasic b/Task/Primality-by-trial-division/FutureBasic/primality-by-trial-division.futurebasic new file mode 100644 index 0000000000..f4e89153ad --- /dev/null +++ b/Task/Primality-by-trial-division/FutureBasic/primality-by-trial-division.futurebasic @@ -0,0 +1,26 @@ +include "ConsoleWindow" + +def tab 6 + +local fn isPrime( n as long ) as Boolean +dim as long i +dim as Boolean result + +if n < 2 then result = _false : exit fn +if n = 2 then result = _true : exit fn +if n mod 2 == 0 then result = _false : exit fn +result = _true +for i = 3 to int( n^.5 ) step 2 + if n mod i == 0 then result = _false : exit fn +next i +end fn = result + +dim as long i, j + +print "Prime numbers between 0 and 1000:" +for i = 0 to 1000 + if ( fn isPrime(i) != _false ) + print i, : j++ + if j mod 10 == 0 then print + end if +next diff --git a/Task/Primality-by-trial-division/Nim/primality-by-trial-division.nim b/Task/Primality-by-trial-division/Nim/primality-by-trial-division.nim new file mode 100644 index 0000000000..7e8cfa7351 --- /dev/null +++ b/Task/Primality-by-trial-division/Nim/primality-by-trial-division.nim @@ -0,0 +1,29 @@ +import sequtils, math + +proc prime(a: int): bool = + if a == 2: return true + if a < 2 or a mod 2 == 0: return false + for i in countup(3, sqrt(a.float).int, 2): + if a mod i == 0: + return false + return true + +template any(sequence, operation: expr): expr = + var result {.gensym.}: bool = false + for i in 0 .. integer + p.gt(1) where q=p.sqrt NO(p.mod(2..q)==0) + +1..100.prime diff --git a/Task/Primality-by-trial-division/Phix/primality-by-trial-division.phix b/Task/Primality-by-trial-division/Phix/primality-by-trial-division.phix new file mode 100644 index 0000000000..b63d4ca402 --- /dev/null +++ b/Task/Primality-by-trial-division/Phix/primality-by-trial-division.phix @@ -0,0 +1,11 @@ +function is_prime(integer n) + if n<2 then return 0 end if + if n=2 then return 1 end if + if remainder(n,2)=0 then return 0 end if + for i=3 to floor(sqrt(n)) by 2 do + if remainder(n,i)=0 then + return 0 + end if + end for + return 1 +end function diff --git a/Task/Primality-by-trial-division/Ring/primality-by-trial-division.ring b/Task/Primality-by-trial-division/Ring/primality-by-trial-division.ring new file mode 100644 index 0000000000..74f20dc429 --- /dev/null +++ b/Task/Primality-by-trial-division/Ring/primality-by-trial-division.ring @@ -0,0 +1,12 @@ +give n +flag = isPrime(n) +if flag = 1 see n + " is a prime number" +else see n + " is not a prime number" ok + +func isPrime num + if (num <= 1) return 0 ok + if (num % 2 = 0 and num != 2) return 0 ok + for i = 3 to floor(num / 2) -1 step 2 + if (num % i = 0) return 0 ok + next + return 1 diff --git a/Task/Primality-by-trial-division/Sidef/primality-by-trial-division.sidef b/Task/Primality-by-trial-division/Sidef/primality-by-trial-division.sidef new file mode 100644 index 0000000000..07f8c6e2eb --- /dev/null +++ b/Task/Primality-by-trial-division/Sidef/primality-by-trial-division.sidef @@ -0,0 +1,7 @@ +func is_prime(a) { + given (a) { + when (2) { true } + case (a <= 1 || a.is_even) { false } + default { 3 .. a.isqrt -> any { .divides(a) } -> not } + } +} diff --git a/Task/Primality-by-trial-division/Swift/primality-by-trial-division.swift b/Task/Primality-by-trial-division/Swift/primality-by-trial-division.swift new file mode 100644 index 0000000000..e5ab460c5f --- /dev/null +++ b/Task/Primality-by-trial-division/Swift/primality-by-trial-division.swift @@ -0,0 +1,17 @@ +import Foundation + +extension Int { + func isPrime() -> Bool { + + switch self { + case let x where x < 2: + return false + case 2: + return true + default: + return + self % 2 != 0 && + !stride(from: 3, through: Int(sqrt(Double(self))), by: 2).contains {self % $0 == 0} + } + } +} diff --git a/Task/Prime-decomposition/Commodore-BASIC/prime-decomposition.commodore b/Task/Prime-decomposition/Commodore-BASIC/prime-decomposition.commodore new file mode 100644 index 0000000000..2c8dd990ab --- /dev/null +++ b/Task/Prime-decomposition/Commodore-BASIC/prime-decomposition.commodore @@ -0,0 +1,17 @@ +9000 REM ----- function generate +9010 REM in ... i ... number +9020 REM out ... pf() ... factors +9030 REM mod ... ca ... pf candidate +9040 pf(0)=0 : ca=2 : REM special case +9050 IF i=1 THEN RETURN +9060 IF INT(i/ca)*ca=i THEN GOSUB 9200 : GOTO 9050 +9070 FOR ca=3 TO INT( SQR(i)) STEP 2 +9080 IF i=1 THEN RETURN +9090 IF INT(i/ca)*ca=i THEN GOSUB 9200 : GOTO 9080 +9100 NEXT +9110 IF i>1 THEN ca=i : GOSUB 9200 +9120 RETURN +9200 pf(0)=pf(0)+1 +9210 pf(pf(0))=ca +9220 i=i/ca +9230 RETURN diff --git a/Task/Prime-decomposition/ERRE/prime-decomposition.erre b/Task/Prime-decomposition/ERRE/prime-decomposition.erre new file mode 100644 index 0000000000..5eea0dc84f --- /dev/null +++ b/Task/Prime-decomposition/ERRE/prime-decomposition.erre @@ -0,0 +1,49 @@ +PROGRAM DECOMPOSE + + +! +! for rosettacode.org +! + +!VAR NUM,J + +DIM PF[100] + +PROCEDURE STORE_FACTOR + PF[0]=PF[0]+1 + PF[PF[0]]=CA + I=I/CA +END PROCEDURE + +PROCEDURE DECOMP(I) + PF[0]=0 CA=2 ! special case + LOOP + IF I=1 THEN EXIT PROCEDURE END IF + EXIT IF INT(I/CA)*CA<>I + STORE_FACTOR + END LOOP + FOR CA=3 TO INT(SQR(I)) STEP 2 DO + LOOP + IF I=1 THEN EXIT PROCEDURE END IF + EXIT IF INT(I/CA)*CA<>I + STORE_FACTOR + END LOOP + END FOR + IF I>1 THEN CA=I STORE_FACTOR END IF +END PROCEDURE + +BEGIN + ! ----- function generate + ! in ... I ... number + ! out ... PF[] ... factors + ! PF[0] ... # of factors + ! mod ... CA ... pr.fact. candidate + PRINT(CHR$(12);) !CLS + INPUT("Numero ",NUM) + DECOMP(NUM) + PRINT(NUM;"=";) + FOR J=1 TO PF[0] DO + PRINT(PF[J];) + END FOR + PRINT +END PROGRAM diff --git a/Task/Prime-decomposition/EchoLisp/prime-decomposition.echolisp b/Task/Prime-decomposition/EchoLisp/prime-decomposition.echolisp new file mode 100644 index 0000000000..308aa69185 --- /dev/null +++ b/Task/Prime-decomposition/EchoLisp/prime-decomposition.echolisp @@ -0,0 +1,10 @@ +(prime-factors 1024) + → (2 2 2 2 2 2 2 2 2 2) + +(lib 'bigint) +;; 2^59 - 1 +(prime-factors (1- (expt 2 59))) + → (179951 3203431780337) + +(prime-factors 100000000000000000037) + → (31 821 66590107 59004541) diff --git a/Task/Prime-decomposition/Ezhil/prime-decomposition.ezhil b/Task/Prime-decomposition/Ezhil/prime-decomposition.ezhil new file mode 100644 index 0000000000..0dba23563d --- /dev/null +++ b/Task/Prime-decomposition/Ezhil/prime-decomposition.ezhil @@ -0,0 +1,143 @@ +## இந்த நிரல் தரப்பட்ட எண்ணின் பகாஎண் கூறுகளைக் கண்டறியும் + +நிரல்பாகம் பகாஎண்ணா(எண்1) + + ## இந்த நிரல்பாகம் தரப்பட்ட எண் பகு எண்ணா அல்லது பகா எண்ணா என்று கண்டறிந்து சொல்லும் + ## பகுஎண் என்றால் 0 திரும்பத் தரப்படும் + ## பகாஎண் என்றால் 1 திரும்பத் தரப்படும் + + @(எண்1 < 0) ஆனால் + + ## எதிர்மறை எண்களை நேராக்குதல் + + எண்1 = எண்1 * (-1) + + முடி + + @(எண்1 < 2) ஆனால் + + ## பூஜ்ஜியம், ஒன்று ஆகியவை பகா எண்கள் அல்ல + + பின்கொடு 0 + + முடி + + @(எண்1 == 2) ஆனால் + + ## இரண்டு என்ற எண் ஒரு பகா எண் + + பின்கொடு 1 + + முடி + + மீதம் = எண்1%2 + + @(மீதம் == 0) ஆனால் + + ## இரட்டைப்படை எண், ஆகவே, இது பகா எண் அல்ல + + பின்கொடு 0 + + முடி + + எண்1வர்க்கமூலம் = எண்1^0.5 + + @(எண்2 = 3, எண்2 <= எண்1வர்க்கமூலம், எண்2 = எண்2 + 2) ஆக + + மீதம்1 = எண்1%எண்2 + + @(மீதம்1 == 0) ஆனால் + + ## ஏதேனும் ஓர் எண்ணால் முழுமையாக வகுபட்டுவிட்டது, ஆகவே அது பகா எண் அல்ல + + பின்கொடு 0 + + முடி + + முடி + + பின்கொடு 1 + +முடி + +நிரல்பாகம் பகுத்தெடு(எண்1) + + ## இந்த எண் தரப்பட்ட எண்ணின் பகா எண் கூறுகளைக் கண்டறிந்து பட்டியல் இடும் + + கூறுகள் = பட்டியல்() + + @(எண்1 < 0) ஆனால் + + ## எதிர்மறை எண்களை நேராக்குதல் + + எண்1 = எண்1 * (-1) + + முடி + + @(எண்1 <= 1) ஆனால் + + ## ஒன்று அல்லது அதற்குக் குறைவான எண்களுக்குப் பகா எண் விகிதம் கண்டறியமுடியாது + + பின்கொடு கூறுகள் + + முடி + + @(பகாஎண்ணா(எண்1) == 1) ஆனால் + + ## தரப்பட்ட எண்ணே பகா எண்ணாக அமைந்துவிட்டால், அதற்கு அதுவே பகாஎண் கூறு ஆகும் + + பின்இணை(கூறுகள், எண்1) + பின்கொடு கூறுகள் + + முடி + + தாற்காலிகஎண் = எண்1 + + எண்2 = 2 + + @(எண்2 <= தாற்காலிகஎண்) வரை + + விடை1 = பகாஎண்ணா(எண்2) + மீண்டும்தொடங்கு = 0 + + @(விடை1 == 1) ஆனால் + + விடை2 = தாற்காலிகஎண்%எண்2 + + @(விடை2 == 0) ஆனால் + + ## பகா எண்ணால் முழுமையாக வகுபட்டுள்ளது, அதனைப் பட்டியலில் இணைக்கிறோம் + + பின்இணை(கூறுகள், எண்2) + தாற்காலிகஎண் = தாற்காலிகஎண்/எண்2 + + ## மீண்டும் இரண்டில் தொடங்கி இதே கணக்கிடுதலைத் தொடரவேண்டும் + + எண்2 = 2 + மீண்டும்தொடங்கு = 1 + + முடி + + முடி + + @(மீண்டும்தொடங்கு == 0) ஆனால் + + ## அடுத்த எண்ணைத் தேர்ந்தெடுத்துக் கணக்கிடுதலைத் தொடரவேண்டும் + + எண்2 = எண்2 + 1 + + முடி + + முடி + + பின்கொடு கூறுகள் + +முடி + +அ = int(உள்ளீடு("உங்களுக்குப் பிடித்த ஓர் எண்ணைத் தாருங்கள்: ")) + +பகாஎண்கூறுகள் = பட்டியல்() + +பகாஎண்கூறுகள் = பகுத்தெடு(அ) + +பதிப்பி "நீங்கள் தந்த எண்ணின் பகா எண் கூறுகள் இவை: ", பகாஎண்கூறுகள் diff --git a/Task/Prime-decomposition/FreeBASIC/prime-decomposition.freebasic b/Task/Prime-decomposition/FreeBASIC/prime-decomposition.freebasic new file mode 100644 index 0000000000..10695172ee --- /dev/null +++ b/Task/Prime-decomposition/FreeBASIC/prime-decomposition.freebasic @@ -0,0 +1,53 @@ +' FB 1.05.0 Win64 + +Function isPrime(n As Integer) As Boolean + If n Mod 2 = 0 Then Return n = 2 + If n Mod 3 = 0 Then Return n = 3 + Dim d As Integer = 5 + While d * d <= n + If n Mod d = 0 Then Return False + d += 2 + If n Mod d = 0 Then Return False + d += 4 + Wend + Return True +End Function + +Sub getPrimeFactors(factors() As UInteger, n As UInteger) + If n < 2 Then Return + If isPrime(n) Then + Redim factors(0 To 0) + factors(0) = n + Return + End If + Dim factor As UInteger = 2 + Do + If n Mod factor = 0 Then + Redim Preserve factors(0 To UBound(factors) + 1) + factors(UBound(factors)) = factor + n \= factor + If n = 1 Then Return + If isPrime(n) Then factor = n + Else + factor += 1 + End If + Loop +End Sub + +Dim factors() As UInteger +Dim primes(1 To 17) As UInteger = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59} +Dim n As UInteger +For i As UInteger = 1 To 17 + Erase factors + n = 1 Shl primes(i) - 1 + getPrimeFactors factors(), n + Print "2^";Str(primes(i)); Tab(5); " - 1 = "; Str(n); Tab(30);" => "; + For j As UInteger = LBound(factors) To UBound(factors) + Print factors(j); + If j < UBound(factors) Then Print " x "; + Next j + Print +Next i +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Prime-decomposition/LFE/prime-decomposition.lfe b/Task/Prime-decomposition/LFE/prime-decomposition.lfe new file mode 100644 index 0000000000..fe46a9db59 --- /dev/null +++ b/Task/Prime-decomposition/LFE/prime-decomposition.lfe @@ -0,0 +1,10 @@ +(defun factors (n) + (factors n 2 '())) + +(defun factors + ((1 _ acc) + acc) + ((n k acc) (when (== 0 (rem n k))) + (factors (div n k) k (cons k acc))) + ((n k acc) + (factors n (+ k 1) acc))) diff --git a/Task/Prime-decomposition/Lingo/prime-decomposition-1.lingo b/Task/Prime-decomposition/Lingo/prime-decomposition-1.lingo new file mode 100644 index 0000000000..7e49e201b8 --- /dev/null +++ b/Task/Prime-decomposition/Lingo/prime-decomposition-1.lingo @@ -0,0 +1,23 @@ +-- Returns list of prime factors for given number. +-- To overcome the limits of integers (signed 32-bit in Lingo), +-- the number can be specified as float (which works up to 2^53). +-- For the same reason, values in returned list are floats, not integers. +on getPrimeFactors (n) + f = [] + f.sort() + c = sqrt(n) + i = 1.0 + repeat while TRUE + i=i+1 + if i>c then exit repeat + check = n/i + if bitOr(check,0)=check then + f.add(i) + n = check + c = sqrt(n) + i = 1.0 + end if + end repeat + f.add(n) + return f +end diff --git a/Task/Prime-decomposition/Lingo/prime-decomposition-2.lingo b/Task/Prime-decomposition/Lingo/prime-decomposition-2.lingo new file mode 100644 index 0000000000..c780a4fb0d --- /dev/null +++ b/Task/Prime-decomposition/Lingo/prime-decomposition-2.lingo @@ -0,0 +1,11 @@ +put getPrimeFactors(12) +-- [2.0000, 2.0000, 3.0000] + +-- print floats without fractional digits +the floatPrecision=0 + +put getPrimeFactors(12) +-- [2, 2, 3] + +put getPrimeFactors(1125899906842623.0) +-- [3, 251, 601, 4051, 614141] diff --git a/Task/Prime-decomposition/Nim/prime-decomposition.nim b/Task/Prime-decomposition/Nim/prime-decomposition.nim new file mode 100644 index 0000000000..6c407c1f2a --- /dev/null +++ b/Task/Prime-decomposition/Nim/prime-decomposition.nim @@ -0,0 +1,47 @@ +import strutils, math, sequtils, times + +proc getStep(n: int64) : int64 {.inline.} = + result = 1 + n*4 - int64(n /% 2)*2 + +proc primeFac(n: int64): seq[int64] = + var res: seq[int64] = @[] + var maxq = int64(floor(sqrt(float(n)))) + var d = 1 + var q: int64 = (n %% 2) and 2 or 3 # either 2 or 3, alternating + while (q <= maxq) and ((n %% q) != 0): + q = getStep(d) + d += 1 + if q <= maxq: + var q1: seq[int64] = primeFac(n /% q) + var q2: seq[int64] = primeFac(q) + res = concat(q2, q1, res) + else: + res.add(n) + result = res + +var is_prime: seq[Bool] = @[] +is_prime.add(False) +is_prime.add(False) + +iterator primes(limit: int): int = + for n in high(is_prime) .. limit+2: is_prime.add(True) + for n in 2 .. limit + 1: + if is_prime[n]: + yield n + for i in countup((n *% n), limit+1, n): # start at ``n`` squared + try: + is_prime[i] = False + except EInvalidIndex: break + +# Example: calculate factors of Mersenne numbers to M59 # + +for m in primes(59): + var p = int64(pow(2.0,float(m)) - 1) + write(stdout,"2**$1-1 = $2, with factors: " % [$m, $p] ) + var start = cpuTime() + var f = primeFac(p) + for factor in f: + write(stdout, factor) + write(stdout, ", ") + FlushFile(stdout) + writeln(stdout, "=> $#ms" % $int(1000*(cpuTime()-start)) ) diff --git a/Task/Prime-decomposition/Oforth/prime-decomposition.oforth b/Task/Prime-decomposition/Oforth/prime-decomposition.oforth new file mode 100644 index 0000000000..f72afbfa29 --- /dev/null +++ b/Task/Prime-decomposition/Oforth/prime-decomposition.oforth @@ -0,0 +1,14 @@ +: factors(n) // ( aInteger -- aList ) +| k p | + ListBuffer new + 2 ->k + n nsqrt ->p + while( k p <= ) [ + n k /mod swap ifZero: [ + dup ->n nsqrt ->p + k over add continue + ] + drop k 1+ ->k + ] + n 1 > ifTrue: [ n over add ] + dup freeze ; diff --git a/Task/Prime-decomposition/Ring/prime-decomposition.ring b/Task/Prime-decomposition/Ring/prime-decomposition.ring new file mode 100644 index 0000000000..f6ddafa019 --- /dev/null +++ b/Task/Prime-decomposition/Ring/prime-decomposition.ring @@ -0,0 +1,20 @@ +prime = 18705 +decomp(prime) + +func decomp nr +x = "" +for i = 1 to nr + if isPrime(i) and nr % i = 0 + x = x + string(i) + " * " ok + if i = nr + x2 = substr(x,1,(len(x)-2)) + see string(nr) + " = " + x2 + nl ok +next + +func isPrime num + if (num <= 1) return 0 ok + if (num % 2 = 0) return 0 ok + for i = 3 to floor(num / 2) -1 step 2 + if (num % i = 0) return 0 ok + next + return 1 diff --git a/Task/Prime-decomposition/SPAD/prime-decomposition.spad b/Task/Prime-decomposition/SPAD/prime-decomposition.spad new file mode 100644 index 0000000000..e0e28b0e6e --- /dev/null +++ b/Task/Prime-decomposition/SPAD/prime-decomposition.spad @@ -0,0 +1,9 @@ +(1) -> factor 102400 + + 12 2 + (1) 2 5 + Type: Factored(Integer) +(2) -> factor 23193931893819371 + + (2) 83 3469 71341 1129153 + Type: Factored(Integer) diff --git a/Task/Prime-decomposition/SequenceL/prime-decomposition-1.sequencel b/Task/Prime-decomposition/SequenceL/prime-decomposition-1.sequencel new file mode 100644 index 0000000000..3acde90926 --- /dev/null +++ b/Task/Prime-decomposition/SequenceL/prime-decomposition-1.sequencel @@ -0,0 +1,11 @@ +isPrime(n) := n = 2 or (n > 1 and none(n mod ([2]++((1...floor(sqrt(n)/2))*2+1)) = 0)); + +primeFactorization(num) := primeFactorizationHelp(num, []); + +primeFactorizationHelp(num, current(1)) := + let + primeFactors[i] := i when num mod i = 0 and isPrime(i) foreach i within 2 ... num; + in + current when size(primeFactors) = 0 + else + primeFactorizationHelp(num / product(primeFactors), current ++ primeFactors); diff --git a/Task/Prime-decomposition/SequenceL/prime-decomposition-2.sequencel b/Task/Prime-decomposition/SequenceL/prime-decomposition-2.sequencel new file mode 100644 index 0000000000..b6e502ca69 --- /dev/null +++ b/Task/Prime-decomposition/SequenceL/prime-decomposition-2.sequencel @@ -0,0 +1,8 @@ +primeFactorization(num) := primeFactorizationHelp(num, 2, []); + +primeFactorizationHelp(num, divisor, factors(1)) := + factors when num <= 1 + else + primeFactorizationHelp(num, divisor + 1, factors) when num mod divisor /= 0 + else + primeFactorizationHelp(num / divisor, divisor, factors ++ [divisor]); diff --git a/Task/Prime-decomposition/Sidef/prime-decomposition-1.sidef b/Task/Prime-decomposition/Sidef/prime-decomposition-1.sidef new file mode 100644 index 0000000000..958ff17ca0 --- /dev/null +++ b/Task/Prime-decomposition/Sidef/prime-decomposition-1.sidef @@ -0,0 +1,4 @@ +require('ntheory') +func prime_factors(n) { + [%S.factor(n.to_s)] +} diff --git a/Task/Prime-decomposition/Sidef/prime-decomposition-2.sidef b/Task/Prime-decomposition/Sidef/prime-decomposition-2.sidef new file mode 100644 index 0000000000..855ed5d951 --- /dev/null +++ b/Task/Prime-decomposition/Sidef/prime-decomposition-2.sidef @@ -0,0 +1,18 @@ +func prime_factors(n) { + var p = 3; + var out = []; + return out if (n < 1); + while (!(n & 1)) { + n >>= 1; + out << 2; + } + while ((n > 1) && (p*p <= n)) { + while (n %% p) { + n /= p; + out << p; + } + p += 2; + } + out << n if (n > 1); + return out; +} diff --git a/Task/Prime-decomposition/Sidef/prime-decomposition-3.sidef b/Task/Prime-decomposition/Sidef/prime-decomposition-3.sidef new file mode 100644 index 0000000000..a1175bde94 --- /dev/null +++ b/Task/Prime-decomposition/Sidef/prime-decomposition-3.sidef @@ -0,0 +1 @@ +say prime_factors(536870911); diff --git a/Task/Prime-decomposition/jq/prime-decomposition-1.jq b/Task/Prime-decomposition/jq/prime-decomposition-1.jq new file mode 100644 index 0000000000..e85d575035 --- /dev/null +++ b/Task/Prime-decomposition/jq/prime-decomposition-1.jq @@ -0,0 +1,14 @@ +def factors: + . as $in + | [2, $in, false] + | recurse( .[0] as $p |.[1] as $q | .[2] as $valid | .[3] as $s + | if $q == 1 then empty + elif $q % $p == 0 then [$p, $q/$p, true] + elif $p == 2 then [3, $q, false, $s] + else + ($s // ($q | sqrt)) as $s + | if $p + 2 <= $s then [$p + 2, $q, false, $s] + else [$q, 1, true] + end + end ) + | if .[2] then .[0] else empty end ; diff --git a/Task/Prime-decomposition/jq/prime-decomposition-2.jq b/Task/Prime-decomposition/jq/prime-decomposition-2.jq new file mode 100644 index 0000000000..0332672da8 --- /dev/null +++ b/Task/Prime-decomposition/jq/prime-decomposition-2.jq @@ -0,0 +1,7 @@ +[9007199254740992 | factors] | length +#=> 53 + +# 2**29-1 = 536870911 +[ 536870911 | factors ] + +#=> [233,1103,2089] diff --git a/Task/Priority-queue/EchoLisp/priority-queue.echolisp b/Task/Priority-queue/EchoLisp/priority-queue.echolisp new file mode 100644 index 0000000000..86faf58152 --- /dev/null +++ b/Task/Priority-queue/EchoLisp/priority-queue.echolisp @@ -0,0 +1,18 @@ +(lib 'tree) +(define tasks (make-bin-tree 3 "Clear drains")) +(bin-tree-insert tasks 2 "Tax return") +(bin-tree-insert tasks 5 "Make tea") +(bin-tree-insert tasks 1 "Solve RC tasks") +(bin-tree-insert tasks 4 "Feed 🐡") + +(bin-tree-pop-first tasks) → (1 . "Solve RC tasks") +(bin-tree-pop-first tasks) → (2 . "Tax return") +(bin-tree-pop-first tasks) → (3 . "Clear drains") +(bin-tree-pop-first tasks) → (4 . "Feed 🐡") +(bin-tree-pop-first tasks) → (5 . "Make tea") +(bin-tree-pop-first tasks) → null + +;; similarly +(bin-tree-pop-last tasks) → (5 . "Make tea") +(bin-tree-pop-last tasks) → (4 . "Feed 🐡") +; etc. diff --git a/Task/Priority-queue/FunL/priority-queue.funl b/Task/Priority-queue/FunL/priority-queue.funl new file mode 100644 index 0000000000..fe1299f333 --- /dev/null +++ b/Task/Priority-queue/FunL/priority-queue.funl @@ -0,0 +1,22 @@ +import util.ordering +native scala.collection.mutable.PriorityQueue + +data Task( priority, description ) + +def comparator( Task(a, _), Task(b, _) ) + | a > b = -1 + | a < b = 1 + | otherwise = 0 + +q = PriorityQueue( ordering(comparator) ) + +q.enqueue( + Task(3, 'Clear drains'), + Task(4, 'Feed cat'), + Task(5, 'Make tea'), + Task(1, 'Solve RC tasks'), + Task(2, 'Tax return') + ) + +while not q.isEmpty() + println( q.dequeue() ) diff --git a/Task/Priority-queue/Lasso/priority-queue.lasso b/Task/Priority-queue/Lasso/priority-queue.lasso new file mode 100644 index 0000000000..a74d5532a7 --- /dev/null +++ b/Task/Priority-queue/Lasso/priority-queue.lasso @@ -0,0 +1,59 @@ +define priorityQueue => type { + data + store = map, + cur_priority = void + + public push(priority::integer, value) => { + local(store) = .`store`->find(#priority) + + if(#store->isA(::array)) => { + #store->insert(#value) + return + } + .`store`->insert(#priority=array(#value)) + + .`cur_priority`->isA(::void) or #priority < .`cur_priority` + ? .`cur_priority` = #priority + } + + public pop => { + .`cur_priority` == void + ? return void + + local(store) = .`store`->find(.`cur_priority`) + local(retVal) = #store->first + + #store->removeFirst&size > 0 + ? return #retVal + + // Need to find next priority + .`store`->remove(.`cur_priority`) + + if(.`store`->size == 0) => { + .`cur_priority` = void + else + // There are better / faster ways to do this + // The keys are actually already sorted, but the order of + // storage in a map is not actually defined, can't rely on it + .`cur_priority` = .`store`->keys->asArray->sort&first + } + + return #retVal + } + + public isEmpty => (.`store`->size == 0) + +} + +local(test) = priorityQueue + +#test->push(2,`e`) +#test->push(1,`H`) +#test->push(5,`o`) +#test->push(2,`l`) +#test->push(5,`!`) +#test->push(4,`l`) + +while(not #test->isEmpty) => { + stdout(#test->pop) +} diff --git a/Task/Priority-queue/Nim/priority-queue-1.nim b/Task/Priority-queue/Nim/priority-queue-1.nim new file mode 100644 index 0000000000..0a3d135e31 --- /dev/null +++ b/Task/Priority-queue/Nim/priority-queue-1.nim @@ -0,0 +1,60 @@ +type + PriElem[T] = tuple + data: T + pri: int + + PriQueue[T] = object + buf: seq[PriElem[T]] + count: int + +# first element not used to simplify indices +proc initPriQueue[T](initialSize = 4): PriQueue[T] = + result.buf.newSeq(initialSize) + result.buf.setLen(1) + result.count = 0 + +proc add[T](q: var PriQueue[T], data: T, pri: int) = + var n = q.buf.len + var m = n div 2 + q.buf.setLen(n + 1) + + # append at end, then up heap + while m > 0 and pri < q.buf[m].pri: + q.buf[n] = q.buf[m] + n = m + m = m div 2 + + q.buf[n] = (data, pri) + q.count = q.buf.len - 1 + +proc pop[T](q: var PriQueue[T]): PriElem[T] = + assert q.buf.len > 1 + result = q.buf[1] + + var qn = q.buf.len - 1 + var n = 1 + var m = 2 + while m < qn: + if m + 1 < qn and q.buf[m].pri > q.buf[m+1].pri: + inc m + + if q.buf[qn].pri <= q.buf[m].pri: + break + + q.buf[n] = q.buf[m] + n = m + m = m * 2 + + q.buf[n] = q.buf[qn] + q.buf.setLen(q.buf.len - 1) + q.count = q.buf.len - 1 + +var p = initPriQueue[string]() +p.add("Clear drains", 3) +p.add("Feed cat", 4) +p.add("Make tea", 5) +p.add("Solve RC tasks", 1) +p.add("Tax return", 2) + +while p.count > 0: + echo p.pop() diff --git a/Task/Priority-queue/Nim/priority-queue-2.nim b/Task/Priority-queue/Nim/priority-queue-2.nim new file mode 100644 index 0000000000..cd816c9b06 --- /dev/null +++ b/Task/Priority-queue/Nim/priority-queue-2.nim @@ -0,0 +1,18 @@ +import tables + +var + pq = initTable[int, string]() + +proc main() = + pq.add(3, "Clear drains") + pq.add(4, "Feed cat") + pq.add(5, "Make tea") + pq.add(1, "Solve RC tasks") + pq.add(2, "Tax return") + + for i in countUp(1,5): + if pq.hasKey(i): + echo i, ": ", pq[i] + pq.del(i) + +main() diff --git a/Task/Priority-queue/Sidef/priority-queue.sidef b/Task/Priority-queue/Sidef/priority-queue.sidef new file mode 100644 index 0000000000..2213a1d048 --- /dev/null +++ b/Task/Priority-queue/Sidef/priority-queue.sidef @@ -0,0 +1,30 @@ +class PriorityQueue { + has tasks = [] + + method insert (Number priority { _ >= 0 }, task) { + for n in range(tasks.len, priority) { + tasks[n] = [] + } + tasks[priority].append(task) + } + + method get { tasks.first { !.is_empty } -> shift } + method is_empty { tasks.all { .is_empty } } +} + +var pq = PriorityQueue() + +[ + [3, 'Clear drains'], + [4, 'Feed cat'], + [5, 'Make tea'], + [9, 'Sleep'], + [3, 'Check email'], + [1, 'Solve RC tasks'], + [9, 'Exercise'], + [2, 'Do taxes'], +].each { |pair| + pq.insert(pair...) +} + +say pq.get while !pq.is_empty diff --git a/Task/Priority-queue/Swift/priority-queue.swift b/Task/Priority-queue/Swift/priority-queue.swift new file mode 100644 index 0000000000..0f4358983a --- /dev/null +++ b/Task/Priority-queue/Swift/priority-queue.swift @@ -0,0 +1,56 @@ +class Task : Comparable, CustomStringConvertible { + var priority : Int + var name: String + init(priority: Int, name: String) { + self.priority = priority + self.name = name + } + var description: String { + return "\(priority), \(name)" + } +} +func ==(t1: Task, t2: Task) -> Bool { + return t1.priority == t2.priority +} +func <(t1: Task, t2: Task) -> Bool { + return t1.priority < t2.priority +} + +struct TaskPriorityQueue { + let heap : CFBinaryHeapRef = { + var callBacks = CFBinaryHeapCallBacks(version: 0, retain: { + UnsafePointer(Unmanaged.fromOpaque(COpaquePointer($1)).retain().toOpaque()) + }, release: { + Unmanaged.fromOpaque(COpaquePointer($1)).release() + }, copyDescription: nil, compare: { (ptr1, ptr2, _) in + let t1 : Task = Unmanaged.fromOpaque(COpaquePointer(ptr1)).takeUnretainedValue() + let t2 : Task = Unmanaged.fromOpaque(COpaquePointer(ptr2)).takeUnretainedValue() + return t1 == t2 ? CFComparisonResult.CompareEqualTo : t1 < t2 ? CFComparisonResult.CompareLessThan : CFComparisonResult.CompareGreaterThan + }) + return CFBinaryHeapCreate(nil, 0, &callBacks, nil) + }() + var count : Int { return CFBinaryHeapGetCount(heap) } + mutating func push(t: Task) { + CFBinaryHeapAddValue(heap, UnsafePointer(Unmanaged.passUnretained(t).toOpaque())) + } + func peek() -> Task { + return Unmanaged.fromOpaque(COpaquePointer(CFBinaryHeapGetMinimum(heap))).takeUnretainedValue() + } + mutating func pop() -> Task { + let result = Unmanaged.fromOpaque(COpaquePointer(CFBinaryHeapGetMinimum(heap))).takeUnretainedValue() + CFBinaryHeapRemoveMinimumValue(heap) + return result + } +} + +var pq = TaskPriorityQueue() + +pq.push(Task(priority: 3, name: "Clear drains")) +pq.push(Task(priority: 4, name: "Feed cat")) +pq.push(Task(priority: 5, name: "Make tea")) +pq.push(Task(priority: 1, name: "Solve RC tasks")) +pq.push(Task(priority: 2, name: "Tax return")) + +while pq.count != 0 { + print(pq.pop()) +} diff --git a/Task/Priority-queue/jq/priority-queue-1.jq b/Task/Priority-queue/jq/priority-queue-1.jq new file mode 100644 index 0000000000..ae455e423e --- /dev/null +++ b/Task/Priority-queue/jq/priority-queue-1.jq @@ -0,0 +1,49 @@ +# In the following, pq stands for "priority queue". + +# Add an item with the given priority (an integer, +# or a string representing an integer) +# Input: a pq +def pq_add(priority; item): + (priority|tostring) as $p + | if .priorities|index($p) then + if (.[$p] | index(item)) then . else .[$p] += [item] end + else .[$p] = [item] | .priorities = (.priorities + [$p] | sort) + end ; + +# emit [ item, pq ] +# Input: a pq +def pq_pop: + .priorities as $keys + | if ($keys|length) == 0 then [ null, . ] + else + if (.[$keys[0]] | length) == 1 + then .priorities = .priorities[1:] + else . + end + | [ (.[$keys[0]])[0], (.[$keys[0]] = .[$keys[0]][1:]) ] + end ; + +# Emit the item that would be popped, or null if there is none +# Input: a pq +def pq_peep: + .priorities as $keys + | if ($keys|length) == 0 then null + else (.[$keys[0]])[0] + end ; + +# Add a bunch of tasks, presented as an array of arrays +# Input: a pq +def pq_add_tasks(list): + reduce list[] as $pair (.; . + pq_add( $pair[0]; $pair[1]) ) ; + +# Pop all the tasks, producing a stream +# Input: a pq +def pq_pop_tasks: + pq_pop as $pair + | if $pair[0] == null then empty + else $pair[0], ( $pair[1] | pq_pop_tasks ) + end ; + +# Input: a bunch of tasks, presented as an array of arrays +def prioritize: + . as $list | {} | pq_add_tasks($list) | pq_pop_tasks ; diff --git a/Task/Priority-queue/jq/priority-queue-2.jq b/Task/Priority-queue/jq/priority-queue-2.jq new file mode 100644 index 0000000000..4da304b4c6 --- /dev/null +++ b/Task/Priority-queue/jq/priority-queue-2.jq @@ -0,0 +1,6 @@ +[ [3, "Clear drains"], + [4, "Feed cat"], + [5, "Make tea"], + [1, "Solve RC tasks"], + [2, "Tax return"] + ] | prioritize diff --git a/Task/Probabilistic-choice/ERRE/probabilistic-choice.erre b/Task/Probabilistic-choice/ERRE/probabilistic-choice.erre new file mode 100644 index 0000000000..24e2c8a98e --- /dev/null +++ b/Task/Probabilistic-choice/ERRE/probabilistic-choice.erre @@ -0,0 +1,35 @@ +PROGRAM PROB_CHOICE + + DIM ITEM$[7],PROB[7],CNT[7] + +BEGIN + ITEM$[]=("aleph","beth","gimel","daleth","he","waw","zayin","heth") + + PROB[0]=1/5.0 PROB[1]=1/6.0 PROB[2]=1/7.0 PROB[3]=1/8.0 + PROB[4]=1/9.0 PROB[5]=1/10.0 PROB[6]=1/11.0 PROB[7]=1759/27720 + SUM=0 + FOR I%=0 TO UBOUND(PROB,1) DO + SUM=SUM+PROB[I%] + END FOR + + IF ABS(SUM-1)>1E-6 THEN + PRINT("Probabilities don't sum to 1") + ELSE + FOR TRIAL=1 TO 1E6 DO + R=RND(1) + P=0 + FOR I%=0 TO UBOUND(PROB,1) DO + P+=PROB[I%] + IF R

Lasso is awesome, you should try it!

', + -attachments = '/path/to/myFile.txt' +) + +// simple usage +// sends plan text email +email_send( + -host = 'mail.example.com', + -username = 'user.name', + -password = 'secure_password', + -to = 'joe@average.com', + -from = 'lasso@example.com', + -subject = 'Lasso is awesome', + -body = 'Lasso is awesome, you should try it!' +) diff --git a/Task/Send-email/Lingo/send-email.lingo b/Task/Send-email/Lingo/send-email.lingo new file mode 100644 index 0000000000..abe45b9766 --- /dev/null +++ b/Task/Send-email/Lingo/send-email.lingo @@ -0,0 +1,53 @@ +---------------------------------------- +-- Sends email via SMTP using senditquiet.exe (15 KB) +-- @param {string} fromAddr +-- @param {string} toAddr - multiple addresses separated with ; +-- @param {string} subject +-- @param {string} message - use "\n" for line breaks +-- @param {string} [cc=VOID] - optional; multiple addresses separated with ; +-- @param {string} [bcc=VOID] - optional; multiple addresses separated with ; +-- @param {propList} [serverProps=VOID] - optional; allows to overwrite default settings +-- @return {bool} success +---------------------------------------- +on sendEmail (fromAddr, toAddr, subject, message, cc, bcc, serverProps) + + sx = xtra("Shell").new() + + -- senditquiet.exe in folder "bin" relative to current movie + sx.shell_setcurrentdir(_movie.path&"bin") + + -- defaults + host = "smtp.gmail.com" + protocol = "ssl" + port = 587 + user = "johndoe" + pass = "foobar" + + -- if propList 'serverProps' was passed, overwrite defaults + if ilk(serverProps)=#propList then + repeat with i = 1 to serverProps.count + do(serverProps.getPropAt(i)&"=""E&serverProps[i]"E) + end repeat + end if + + cmd = "senditquiet" + put " -s "&host after cmd + put " -protocol "&protocol after cmd + put " -port "&port after cmd + put " -u "&user after cmd + put " -p "&pass after cmd + + put " -f ""E&fromAddr"E after cmd + put " -t ""E&toAddr"E after cmd + put " -subject ""E&subject"E after cmd + put " -body ""E&message"E after cmd + + -- optional args + if not voidP(cc) then put " -cc ""E&cc"E after cmd + if not voidP(bcc) then put " -bcc ""E&bcc"E after cmd + + put " 1>nul 2>nul & if errorlevel 1 echo ERROR" after cmd + + res = sx.shell_cmd(cmd) + return not(res contains "ERROR") +end diff --git a/Task/Send-email/LiveCode/send-email.livecode b/Task/Send-email/LiveCode/send-email.livecode new file mode 100644 index 0000000000..d3aefa3810 --- /dev/null +++ b/Task/Send-email/LiveCode/send-email.livecode @@ -0,0 +1 @@ +revMail "help@example.com",,"Help!",field "Message" diff --git a/Task/Send-email/Nim/send-email.nim b/Task/Send-email/Nim/send-email.nim new file mode 100644 index 0000000000..7f1f95243b --- /dev/null +++ b/Task/Send-email/Nim/send-email.nim @@ -0,0 +1,17 @@ +import smtp, net + +proc sendMail(fromAddr: string; toAddrs, ccAddrs: seq[string]; + subject, message, login, password: string; + server = "smtp.gmail.com"; port = Port 465; ssl = true) = + var msg = createMessage(subject, message, toAddrs, ccAddrs) + var s = connect(server, port, ssl, debug = true) + s.auth(login, password) + s.sendmail(fromAddr, toAddrs, $msg) + +sendMail(fromAddr = "nim@gmail.com", + toAddrs = @["someone@example.com"], + ccAddrs = @[], + subject = "Hi from Nim", + message = "Nim says hi!\nAnd bye again!", + login = "nim@gmail.com", + password = "XXXXXX") diff --git a/Task/Send-email/Ring/send-email.ring b/Task/Send-email/Ring/send-email.ring new file mode 100644 index 0000000000..8b3c95685a --- /dev/null +++ b/Task/Send-email/Ring/send-email.ring @@ -0,0 +1,15 @@ +See "Send email..." + nl +sendemail("smtp://smtp.gmail.com", + "calmosoft@gmail.com", + "password", + "calmosoft@gmail.com", + "calmosoft@gmail.com", + "calmosoft@gmail.com", + "Sending email from Ring", + "Hello + How are you? + Are you fine? + Thank you! + Greetings, + CalmoSoft") +see "Done.." + nl diff --git a/Task/Sequence-of-non-squares/EchoLisp/sequence-of-non-squares.echolisp b/Task/Sequence-of-non-squares/EchoLisp/sequence-of-non-squares.echolisp new file mode 100644 index 0000000000..4aa09c9b9e --- /dev/null +++ b/Task/Sequence-of-non-squares/EchoLisp/sequence-of-non-squares.echolisp @@ -0,0 +1,9 @@ +(lib 'sequences) + +(define (a n) (+ n (floor (+ 0.5 (sqrt n))))) +(define A000037 (iterator/n a 1)) + +(take A000037 22) + → (2 3 5 6 7 8 10 11 12 13 14 15 17 18 19 20 21 22 23 24 26 27) +(filter square? (take A000037 1000000)) + → null diff --git a/Task/Sequence-of-non-squares/FreeBASIC/sequence-of-non-squares.freebasic b/Task/Sequence-of-non-squares/FreeBASIC/sequence-of-non-squares.freebasic new file mode 100644 index 0000000000..084b1c3de7 --- /dev/null +++ b/Task/Sequence-of-non-squares/FreeBASIC/sequence-of-non-squares.freebasic @@ -0,0 +1,33 @@ +' FB 1.05.0 Win64 + +Function nonSquare (n As UInteger) As UInteger + Return CUInt(n + Int(0.5 + Sqr(n))) +End Function + +Function isSquare (n As UInteger) As Boolean + Dim As UInteger r = CUInt(Sqr(n)) + Return n = r * r +End Function + +Print "The first 22 numbers generated by the sequence are :" +For i As Integer = 1 To 22 + Print nonSquare(i); " "; +Next + +Print : Print + +' Test numbers generated for n less than a million to see if they're squares + +For i As UInteger = 1 To 999999 + If isSquare(nonSquare(i)) Then + Print "The number generated by the sequence for n ="; i; " is square!" + Goto finish + End If +Next + +Print "None of the numbers generated by the sequence for n < 1000000 are square" + +finish: +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Sequence-of-non-squares/Nim/sequence-of-non-squares.nim b/Task/Sequence-of-non-squares/Nim/sequence-of-non-squares.nim new file mode 100644 index 0000000000..cfc997a2b4 --- /dev/null +++ b/Task/Sequence-of-non-squares/Nim/sequence-of-non-squares.nim @@ -0,0 +1,15 @@ +import math + +proc nosqr(n): seq[int] = + result = @[] + for i in 1..n: + result.add(i + round(sqrt(float(i)))) + +proc issqr(n): bool = + let sqr = sqrt(float(n)) + let err = abs(sqr - float(round(sqr))) + err < 1e-7 + +echo nosqr(22) +for i in nosqr(1_000_000): + assert(not issqr(i)) diff --git a/Task/Sequence-of-non-squares/Oforth/sequence-of-non-squares.oforth b/Task/Sequence-of-non-squares/Oforth/sequence-of-non-squares.oforth new file mode 100644 index 0000000000..4bb08755d6 --- /dev/null +++ b/Task/Sequence-of-non-squares/Oforth/sequence-of-non-squares.oforth @@ -0,0 +1,3 @@ +22 seq map(#[ dup sqrt 0.5 + floor + ]) println + +1000000 seq map(#[ dup sqrt 0.5 + floor + ]) conform(#[ sqrt dup floor <>]) println diff --git a/Task/Sequence-of-non-squares/Phix/sequence-of-non-squares.phix b/Task/Sequence-of-non-squares/Phix/sequence-of-non-squares.phix new file mode 100644 index 0000000000..d201859a85 --- /dev/null +++ b/Task/Sequence-of-non-squares/Phix/sequence-of-non-squares.phix @@ -0,0 +1,19 @@ +sequence s = repeat(0,22) +for n=1 to length(s) do + s[n] = n + floor(1/2 + sqrt(n)) +end for +?s +integer nxt = 2, snxt = nxt*nxt, k +for n=1 to 1000000 do + k = n + floor(1/2 + sqrt(n)) + if k>snxt then +-- printf(1,"%d didn't occur\n",snxt) + nxt += 1 + snxt = nxt*nxt + end if + if k=snxt then + puts(1,"error!!\n") + end if +end for +puts(1,"none found ") +?{nxt,snxt} diff --git a/Task/Sequence-of-non-squares/Ring/sequence-of-non-squares.ring b/Task/Sequence-of-non-squares/Ring/sequence-of-non-squares.ring new file mode 100644 index 0000000000..c4f36534ea --- /dev/null +++ b/Task/Sequence-of-non-squares/Ring/sequence-of-non-squares.ring @@ -0,0 +1,5 @@ +for n=1 to 22 + x = n + floor(1/2 + sqrt(n)) + see "" + x + " " +next +see nl diff --git a/Task/Sequence-of-non-squares/Sidef/sequence-of-non-squares.sidef b/Task/Sequence-of-non-squares/Sidef/sequence-of-non-squares.sidef new file mode 100644 index 0000000000..189d4db20f --- /dev/null +++ b/Task/Sequence-of-non-squares/Sidef/sequence-of-non-squares.sidef @@ -0,0 +1,8 @@ +func nonsqr(n) { 0.5 + n.sqrt -> floor + n } +22.of {|i| nonsqr(i)}.join(' ').say + +{ |i| + if (nonsqr(i).is_sqr) { + die "Found a square in the sequence: #{i}" + } +} * 1e6 diff --git a/Task/Sequence-of-non-squares/XLISP/sequence-of-non-squares.xlisp b/Task/Sequence-of-non-squares/XLISP/sequence-of-non-squares.xlisp new file mode 100644 index 0000000000..60415070c4 --- /dev/null +++ b/Task/Sequence-of-non-squares/XLISP/sequence-of-non-squares.xlisp @@ -0,0 +1,21 @@ +(defun non-square (n) + (+ n (floor (+ 0.5 (sqrt n))))) + +(defun range (x y) + (if (< x y) + (cons x (range (+ x 1) y)))) + +(defun squarep (x) + (= x (expt (floor (sqrt x)) 2))) + +(defun count-squares (x y) + (define squares 0) + (if (squarep (non-square x)) + (define squares (+ squares 1))) + (if (= x y) + squares + (count-squares (+ x 1) y))) + +(print (mapcar non-square (range 1 23))) + +(print `(number of squares for values less than 1000000 = ,(count-squares 1 1000000))) diff --git a/Task/Sequence-of-non-squares/jq/sequence-of-non-squares-1.jq b/Task/Sequence-of-non-squares/jq/sequence-of-non-squares-1.jq new file mode 100644 index 0000000000..2e085fde69 --- /dev/null +++ b/Task/Sequence-of-non-squares/jq/sequence-of-non-squares-1.jq @@ -0,0 +1,8 @@ +def A000037: . + (0.5 + sqrt | floor); + +def is_square: sqrt | . == floor; + +"For n up to and including 22:", + (range(1;23) | A000037), +"Check for squares for n up to 1e6:", + (range(1;1e6+1) | A000037 | select( is_square )) diff --git a/Task/Sequence-of-non-squares/jq/sequence-of-non-squares-2.jq b/Task/Sequence-of-non-squares/jq/sequence-of-non-squares-2.jq new file mode 100644 index 0000000000..70fa334ffe --- /dev/null +++ b/Task/Sequence-of-non-squares/jq/sequence-of-non-squares-2.jq @@ -0,0 +1,26 @@ +$ jq -n -r -f sequence_of_non-squares.jq +For n up to and including 22: +2 +3 +5 +6 +7 +8 +10 +11 +12 +13 +14 +15 +17 +18 +19 +20 +21 +22 +23 +24 +26 +27 +Check for squares for n up to 1e6: +$ diff --git a/Task/Sequence-of-primes-by-Trial-Division/ERRE/sequence-of-primes-by-trial-division.erre b/Task/Sequence-of-primes-by-Trial-Division/ERRE/sequence-of-primes-by-trial-division.erre new file mode 100644 index 0000000000..547418d75e --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/ERRE/sequence-of-primes-by-trial-division.erre @@ -0,0 +1,15 @@ +PROGRAM PRIME_GENERATOR + +!$DOUBLE + +BEGIN + PRINT(CHR$(12);) !CLS + N=1 + LOOP + N+=1 + FOR F=2 TO N DO + IF F=N THEN PRINT(N;) EXIT END IF + EXIT IF N=F*INT(N/F) + END FOR + END LOOP +END PROGRAM diff --git a/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-1.echolisp b/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-1.echolisp new file mode 100644 index 0000000000..da14af6c1f --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-1.echolisp @@ -0,0 +1,9 @@ +(lib 'sequences) +(define (is-prime? p) + (cond + [(< p 2) #f] + [(zero? (modulo p 2)) (= p 2)] + [else + (for/and ((d [3 5 .. (1+ (sqrt p))] )) (!zero? (modulo p d)))])) + +(is-prime? 101) → #t diff --git a/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-2.echolisp b/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-2.echolisp new file mode 100644 index 0000000000..ed6feac191 --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-2.echolisp @@ -0,0 +1,2 @@ +(filter is-prime? (range 1 100)) + → (2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97) diff --git a/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-3.echolisp b/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-3.echolisp new file mode 100644 index 0000000000..4027753526 --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-3.echolisp @@ -0,0 +1,5 @@ +(define f-primes (filter is-prime? [2 .. ])) + → # 👓 filter: #sequence [2 3 .. Infinity[ + +(take f-primes 25) + → (2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97) diff --git a/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-4.echolisp b/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-4.echolisp new file mode 100644 index 0000000000..1793fd62dd --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-4.echolisp @@ -0,0 +1,9 @@ +(define (s-next-prime n) ;; n odd + (for ((p [n (+ n 2) .. ] )) + #:break (is-prime? p) => (cons p (+ p 2)))) + +(define s-primes (stream-cons 2 (make-stream s-next-prime 3))) + + +(take s-primes 25) + → (2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97) diff --git a/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-5.echolisp b/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-5.echolisp new file mode 100644 index 0000000000..6898dccb82 --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-5.echolisp @@ -0,0 +1,10 @@ +(define (g-next-prime n) + (define next + (for ((p [n .. ] )) #:break (is-prime? p) => p )) + (yield next) + (1+ next)) + +(define g-primes (make-generator g-next-prime 2)) + +(take g-primes 25) + → (2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97) diff --git a/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-6.echolisp b/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-6.echolisp new file mode 100644 index 0000000000..361c398198 --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/EchoLisp/sequence-of-primes-by-trial-division-6.echolisp @@ -0,0 +1,22 @@ +(lib 'tasks) +(lib 'bigint) + +(define (t-next-prime n) + (define next + (for ((p [n .. ] )) #:break (is-prime? p) => p )) + (writeln next) ;; or whatever action here + (1+ next)) ;; unbounded : return #f to stop or CTRL-C + + + +(define t-primes (make-task t-next-prime 1_000_000_000_000)) + +(task-run t-primes) + → #task:id:95:running +1000000000039 +1000000000061 +1000000000063 +1000000000091 +1000000000121 +1000000000163 +*stopped* diff --git a/Task/Sequence-of-primes-by-Trial-Division/FreeBASIC/sequence-of-primes-by-trial-division.freebasic b/Task/Sequence-of-primes-by-Trial-Division/FreeBASIC/sequence-of-primes-by-trial-division.freebasic new file mode 100644 index 0000000000..667852893e --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/FreeBASIC/sequence-of-primes-by-trial-division.freebasic @@ -0,0 +1,23 @@ +' FB 1.05.0 Win64 + +Function isPrime(n As Integer) As Boolean + If n < 2 Then Return False + If n = 2 Then Return True + If n Mod 2 = 0 Then Return False + Dim limit As Integer = Sqr(n) + For i As Integer = 3 To limit Step 2 + If n Mod i = 0 Then Return False + Next + Return True +End Function + +' Print all primes from 101 to 999 +For i As Integer = 101 To 999 + If isPrime(i) Then + Print Str(i); " "; + End If +Next + +Print : Print +Print "Press any key to quit" +Sleep diff --git a/Task/Sequence-of-primes-by-Trial-Division/Oforth/sequence-of-primes-by-trial-division.oforth b/Task/Sequence-of-primes-by-Trial-Division/Oforth/sequence-of-primes-by-trial-division.oforth new file mode 100644 index 0000000000..d4767f356f --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/Oforth/sequence-of-primes-by-trial-division.oforth @@ -0,0 +1 @@ +: primeSeq(n) n seq filter(#isPrime) ; diff --git a/Task/Sequence-of-primes-by-Trial-Division/Ring/sequence-of-primes-by-trial-division.ring b/Task/Sequence-of-primes-by-Trial-Division/Ring/sequence-of-primes-by-trial-division.ring new file mode 100644 index 0000000000..f8ea0c33ec --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/Ring/sequence-of-primes-by-trial-division.ring @@ -0,0 +1,13 @@ +for i = 1 to 100 + if isPrime(i) see "" + i + " " ok +next +see nl + +func isPrime n + if n < 2 return false ok + if n < 4 return true ok + if n % 2 = 0 return false ok + for d = 3 to sqrt(n) step 2 + if n % d = 0 return false ok + next + return true diff --git a/Task/Sequence-of-primes-by-Trial-Division/Sidef/sequence-of-primes-by-trial-division.sidef b/Task/Sequence-of-primes-by-Trial-Division/Sidef/sequence-of-primes-by-trial-division.sidef new file mode 100644 index 0000000000..7d1e7bdb97 --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/Sidef/sequence-of-primes-by-trial-division.sidef @@ -0,0 +1,12 @@ +func prime_seq(amount, callback) { + var (counter, number) = (0, 0); + while (counter < amount) { + if (is_prime(number)) { + callback(number); + ++counter; + } + ++number; + } +} + +prime_seq(100, {|p| say p}); # prints the first 100 primes diff --git a/Task/Sequence-of-primes-by-Trial-Division/Swift/sequence-of-primes-by-trial-division-1.swift b/Task/Sequence-of-primes-by-Trial-Division/Swift/sequence-of-primes-by-trial-division-1.swift new file mode 100644 index 0000000000..3c9584a7f8 --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/Swift/sequence-of-primes-by-trial-division-1.swift @@ -0,0 +1,23 @@ +import Foundation + +extension SequenceType { + func takeWhile(include: Generator.Element -> Bool) -> AnyGenerator { + var g = self.generate() + return anyGenerator { g.next().flatMap{include($0) ? $0 : nil }} + } +} + +var pastPrimes = [2] + +var primes = anyGenerator { + _ -> Int? in + defer { + pastPrimes.append(pastPrimes.last!) + let c = pastPrimes.count - 1 + for p in anyGenerator({++pastPrimes[c]}) { + let lim = Int(sqrt(Double(p))) + if (!pastPrimes.takeWhile{$0 <= lim}.contains{p % $0 == 0}) { break } + } + } + return pastPrimes.last +} diff --git a/Task/Sequence-of-primes-by-Trial-Division/Swift/sequence-of-primes-by-trial-division-2.swift b/Task/Sequence-of-primes-by-Trial-Division/Swift/sequence-of-primes-by-trial-division-2.swift new file mode 100644 index 0000000000..d624d3c1eb --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/Swift/sequence-of-primes-by-trial-division-2.swift @@ -0,0 +1,21 @@ +var primes = [2] + +func trialPrimes(_ max:Int){ +// fill array 'primes' with primes <= max, 1s for small values like 400_000 + var cand = 3 + while cand <= max { + for p in primes { + if cand % p == 0 { + break + } + if p*p > cand { + primes.append(cand) + break + } + } + cand += 2 + } +} + +trialPrimes(100) +print(primes) diff --git a/Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-1.jq b/Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-1.jq new file mode 100644 index 0000000000..b9817ba76c --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-1.jq @@ -0,0 +1,7 @@ +# Produce a (possibly empty) stream of primes in the range [m,n], i.e. m <= p <= n +def primes(m; n): + ([m,2] | max) as $m + | if $m > n then empty + elif $m == 2 then 2, primes(3;n) + else (1 + (2 * range($m/2 | floor; (n + 1) /2 | floor))) | select( is_prime ) + end; diff --git a/Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-2.jq b/Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-2.jq new file mode 100644 index 0000000000..98bf0a8aa2 --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-2.jq @@ -0,0 +1 @@ +primes(0;10) diff --git a/Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-3.jq b/Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-3.jq new file mode 100644 index 0000000000..bdd130d109 --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-3.jq @@ -0,0 +1,4 @@ +2 +3 +5 +7 diff --git a/Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-4.jq b/Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-4.jq new file mode 100644 index 0000000000..9c7c2d4b53 --- /dev/null +++ b/Task/Sequence-of-primes-by-Trial-Division/jq/sequence-of-primes-by-trial-division-4.jq @@ -0,0 +1 @@ +[primes(50;99)] diff --git a/Task/Set-consolidation/EchoLisp/set-consolidation.echolisp b/Task/Set-consolidation/EchoLisp/set-consolidation.echolisp new file mode 100644 index 0000000000..acf957a24a --- /dev/null +++ b/Task/Set-consolidation/EchoLisp/set-consolidation.echolisp @@ -0,0 +1,24 @@ +;; utility : make a set of sets from a list +(define (make-set* s) + (or (when (list? s) (make-set (map make-set* s))) s)) + +;; union of all sets which intersect - O(n^2) +(define (make-big ss) +(make-set + (for/list ((u ss)) + (for/fold (big u) ((v ss)) #:when (set-intersect? big v) (set-union big v))))) + +;; remove sets which are subset of another one - O(n^2) +(define (remove-small ss) + (for/list ((keep ss)) + #:when (for/and ((v ss)) #:continue (set-equal? keep v) (not (set-subset? v keep))) + keep)) + +(define (consolidate ss) (make-set (remove-small (make-big ss)))) + +(define S (make-set* ' ((h i k) ( a b) ( b c) (c d) ( f g h)))) + → { { a b } { b c } { c d } { f g h } { h i k } } + +(consolidate S) + → { { a b c d } { f g h i k } } + diff --git a/Task/Set-consolidation/Egison/set-consolidation-1.egison b/Task/Set-consolidation/Egison/set-consolidation-1.egison new file mode 100644 index 0000000000..3f88174a11 --- /dev/null +++ b/Task/Set-consolidation/Egison/set-consolidation-1.egison @@ -0,0 +1,10 @@ +(define $consolidate + (lambda [$xss] + (match xss (multiset (set char)) + {[ + + $rss>> + (consolidate {(unique/m char {m @xs @ys}) @rss})] + [_ xss]}))) + +(test (consolidate {{'H' 'I' 'K'} {'A' 'B'} {'C' 'D'} {'D' 'B'} {'F' 'G' 'H'}})) diff --git a/Task/Set-consolidation/Egison/set-consolidation-2.egison b/Task/Set-consolidation/Egison/set-consolidation-2.egison new file mode 100644 index 0000000000..8a9082e20e --- /dev/null +++ b/Task/Set-consolidation/Egison/set-consolidation-2.egison @@ -0,0 +1 @@ +{"DBAC" "HIKFG"} diff --git a/Task/Set-consolidation/Sidef/set-consolidation.sidef b/Task/Set-consolidation/Sidef/set-consolidation.sidef new file mode 100644 index 0000000000..685ba42610 --- /dev/null +++ b/Task/Set-consolidation/Sidef/set-consolidation.sidef @@ -0,0 +1,25 @@ +func consolidate() { [] } +func consolidate(this, *those) { + gather { + consolidate(those...).each { |that| + if (this & that) { this |= that } + else { take that } + } + take this; + } +} + +enum |A="A", B, C, D, _E, F, G, H, I, _J, K|; + +func format(ss) { + ss.map{ '(' + .join(' ') + ')' }.join(' ') +} + +[ + [[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]] +].each { |ss| + say (format(ss), "\n\t==> ", format(consolidate(ss...))); +} diff --git a/Task/Set-consolidation/jq/set-consolidation-1.jq b/Task/Set-consolidation/jq/set-consolidation-1.jq new file mode 100644 index 0000000000..9bab7de316 --- /dev/null +++ b/Task/Set-consolidation/jq/set-consolidation-1.jq @@ -0,0 +1,7 @@ +def to_set: unique; + +def union(A; B): (A + B) | unique; + +# boolean +def intersect(A;B): + reduce A[] as $x (false; if . then . else (B|index($x)) end) | not | not; diff --git a/Task/Set-consolidation/jq/set-consolidation-2.jq b/Task/Set-consolidation/jq/set-consolidation-2.jq new file mode 100644 index 0000000000..ad928c001d --- /dev/null +++ b/Task/Set-consolidation/jq/set-consolidation-2.jq @@ -0,0 +1,30 @@ +# Input: [i, j, sets] with i < j +# Return [i,j] for a pair that can be combined, else null +def combinable: + .[0] as $i | .[1] as $j | .[2] as $sets + | ($sets|length) as $length + | if intersect($sets[$i]; $sets[$j]) then [$i, $j] + elif $i < $j - 1 then (.[0] += 1 | combinable) + elif $j < $length - 1 then [0, $j+1, $sets] | combinable + else null + end; + +# Given an array of arrays, remove the i-th and j-th elements, +# and add their union: +def update(i;j): + if i > j then update(j;i) + elif i == j then del(.[i]) + else + union(.[i]; .[j]) as $c + | union(del(.[j]) | del(.[i]); [$c]) + end; + +# Input: a set of sets +def consolidate: + if length <= 1 then . + else + ([0, 1, .] | combinable) as $c + | if $c then update($c[0]; $c[1]) | consolidate + else . + end + end; diff --git a/Task/Set-consolidation/jq/set-consolidation-3.jq b/Task/Set-consolidation/jq/set-consolidation-3.jq new file mode 100644 index 0000000000..5c1be2676d --- /dev/null +++ b/Task/Set-consolidation/jq/set-consolidation-3.jq @@ -0,0 +1,11 @@ +def tests: + [["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"]] +; + +def test: + tests | to_set | consolidate; + +test diff --git a/Task/Set-consolidation/jq/set-consolidation-4.jq b/Task/Set-consolidation/jq/set-consolidation-4.jq new file mode 100644 index 0000000000..d2a3c55053 --- /dev/null +++ b/Task/Set-consolidation/jq/set-consolidation-4.jq @@ -0,0 +1,5 @@ +$ jq -c -n -f Set_consolidation.rc +[["A","B"],["C","D"]] +[["A","B","D"]] +[["A","B","C","D"]] +[["A","B","C","D"],["F","G","H","I","K"]] diff --git a/Task/Set-of-real-numbers/EchoLisp/set-of-real-numbers-1.echolisp b/Task/Set-of-real-numbers/EchoLisp/set-of-real-numbers-1.echolisp new file mode 100644 index 0000000000..763b4de4f6 --- /dev/null +++ b/Task/Set-of-real-numbers/EchoLisp/set-of-real-numbers-1.echolisp @@ -0,0 +1,24 @@ +(lib 'match) ;; reader-infix macros + +(reader-infix '∈ ) +(reader-infix '∩ ) +(reader-infix '∪ ) +(reader-infix '⊖ ) ;; set difference + +(define-syntax-rule (∈ x a) (a x)) +(define-syntax-rule (∩ a b) (lambda(x) (and ( a x) (b x)))) +(define-syntax-rule (∪ a b) (lambda(x) (or ( a x) (b x)))) +(define-syntax-rule (⊖ a b) (lambda(x) (and ( a x) (not (b x))))) + +;; predicates to define common sets +(define (∅ x) #f) ;; the empty set predicate +(define (Z x) (integer? x)) +(define (N x) (and (Z x) (>= x 0))) +(define (Q x) (rational? x)) +(define (ℜ x) #t) + +;; predicates to define convex sets +(define (⟦...⟧ a b)(lambda(x) (and (>= x a) (<= x b)))) +(define (⟦...⟦ a b)(lambda(x) (and (>= x a) (< x b)))) +(define (⟧...⟧ a b)(lambda(x) (and (> x a) (<= x b)))) +(define (⟧...⟦ a b)(lambda(x) (and (> x a) (< x b)))) diff --git a/Task/Set-of-real-numbers/EchoLisp/set-of-real-numbers-2.echolisp b/Task/Set-of-real-numbers/EchoLisp/set-of-real-numbers-2.echolisp new file mode 100644 index 0000000000..acf2d95728 --- /dev/null +++ b/Task/Set-of-real-numbers/EchoLisp/set-of-real-numbers-2.echolisp @@ -0,0 +1,39 @@ +;; The following applies to convex sets ⟧...⟦ Cx, +;; and families F of disjoint convex sets. +;; Cx are implemented as vectors [lo, hi] + + (define-syntax-id _.lo [_ 0]) + (define-syntax-id _.hi [_ 1]) + + ;; Cx-ops + (define (Cx-new lo hi) (if (< lo hi) (vector lo hi) Cx-empty)) + (define (Cx-empty? A) (>= A.lo A.hi)) + (define Cx-empty #(+Infinity -Infinity)) + (define (Cx-inter A B) (Cx-new (max A.lo B.lo) (min A.hi B.hi))) + (define (Cx-measure A) (if (< A.lo A.hi) (- A.hi A.lo) 0)) + + ;; Families ops + (define (CF-measure FA) (for/sum ((A FA)) (Cx-measure A))) ;; because disjoint + ;; intersection of two families + (define (CF-inter FA FB) (for*/list ((A FA)(B FB)) (Cx-inter A B))) + ;; measure of FA/FB = m(FA) - m (FA ∩ FB) + (define (CF-measure-FA/FB FA FB) + (- (CF-measure FA) (CF-measure (CF-inter FA FB)))) + +;; Application : +;; FA = {x | 0 < x < 10 and |sin(π x²)| > 1/2 } + (define FA + (for/list ((n 100)) + (Cx-new (sqrt (+ n (// 6))) (sqrt (+ n (// 5 6)))))) + +;; FB = {x | 0 < x < 10 and |sin(π x)| > 1/2 } + (define FB + (for/list ((n 10)) + (Cx-new (+ n (// 6)) (+ n (// 5 6))))) + +→ (#(0.1667 0.8333) #(1.1667 1.8333) #(2.1667 2.8333) + #(3.1667 3.8333) #(4.1667 4.8333) #(5.1667 5.8333) + #(6.1667 6.8333) #(7.1667 7.8333) #(8.1667 8.8333) #(9.1667 9.8333)) + + (CF-measure-FA/FB FA FB) + → 2.075864841184666 diff --git a/Task/Set-puzzle/EchoLisp/set-puzzle.echolisp b/Task/Set-puzzle/EchoLisp/set-puzzle.echolisp new file mode 100644 index 0000000000..5fbd53e5b5 --- /dev/null +++ b/Task/Set-puzzle/EchoLisp/set-puzzle.echolisp @@ -0,0 +1,49 @@ +(require 'list) + +;; a card is a vector [id color number symb shading], 0 <= id < 81 +(define (make-deck (id -1)) +(for*/vector( + [ color '(red green purple)] + [ number '(one two three)] + [ symb '( oval squiggle diamond)] + [ shading '(solid open striped)]) (++ id) (vector id color number symb shading))) +(define DECK (make-deck)) + +;; pre-generate 531441 ordered triples, among which 6561 are winners +(define TRIPLES (make-vector (* 81 81 81))) +(define (make-triples ) + (for* ((i 81)(j 81)(k 81)) + (vector-set! TRIPLES (+ i (* 81 j) (* 6561 k)) + (check-set [DECK i] [DECK j] [DECK k])))) + +;; a deal is a list of cards id's. +(define (show-deal deal) + (for ((card deal)) (writeln [DECK card])) + (for ((set (combinations deal 3))) + (when + (check-set [DECK (first set)] [DECK (second set)][DECK (third set)]) + (writeln 'winner set)))) + +;; rules of game here +(define (check-set cards: a b c) + (for ((i (in-range 1 5))) ;; each feature + #:continue (and (= [a i] [b i]) (= [a i] [c i])) + #:continue (and (!= [a i] [b i]) (!= [a i] [c i]) (!= [b i][c i])) + #:break #t => #f )) + +;; sets = list of triples (card-id card-id card-id) +(define (count-sets sets ) + (for/sum ((s sets)) + (if [TRIPLES ( + (first s) (* 81 (second s)) (* 6561 (third s)))] + 1 0))) + + +;; task +(make-triples) + +(define (play (n 9) (cmax 4) (sets) (deal)) + (while #t + (set! deal (take (shuffle (iota 81)) n)) + (set! sets (combinations deal 3)) + #:break (= (count-sets sets) cmax) => (show-deal deal) + )) diff --git a/Task/Set/Apex/set.apex b/Task/Set/Apex/set.apex new file mode 100644 index 0000000000..4f75476be2 --- /dev/null +++ b/Task/Set/Apex/set.apex @@ -0,0 +1,29 @@ +public class MySetController{ + public Set strSet {get; private set; } + public Set idSet {get; private set; } + + public MySetController(){ + //Initialize to an already known collection. Results in a set of abc,def. + this.strSet = new Set{'abc','abc','def'}; + + //Initialize to empty set and add in entries. + this.strSet = new Set(); + this.strSet.add('abc'); + this.strSet.add('def'); + this.strSet.add('abc'); + //Results in {'abc','def'} + + //You can also get a set from a map in Apex. In this case, the account ids are fetched from a SOQL query. + Map accountMap = new Map([Select Id,Name From Account Limit 10]); + Set accountIds = accountMap.keySet(); + + //If you have a set, you can also use it with the bind variable syntax in SOQL: + List accounts = [Select Name From Account Where Id in :accountIds]; + + //Like other collections in Apex, you can use a for loop to iterate over sets: + for(Id accountId : accountIds){ + Account a = accountMap.get(accountId); + //Do account stuffs here. + } + } +} diff --git a/Task/Set/EchoLisp/set.echolisp b/Task/Set/EchoLisp/set.echolisp new file mode 100644 index 0000000000..ff47c9a886 --- /dev/null +++ b/Task/Set/EchoLisp/set.echolisp @@ -0,0 +1,33 @@ +; use { } to read a set +(define A { 1 2 3 4 3 5 5}) → { 1 2 3 4 5 } ; duplicates are removed from a set +; or use make-set to make a set from a list +(define B (make-set ' ( 3 4 5 6 7 8 8))) → { 3 4 5 6 7 8 } +(set-intersect A B) → { 3 4 5 } +(set-intersect? A B) → #t ; predicate +(set-union A B) → { 1 2 3 4 5 6 7 8 } +(set-substract A B) → { 1 2 } +(set-sym-diff A B) → { 1 2 6 7 8 } ; ∆ symmetric difference +(set-equal? A B) → #f +(set-equal? { a b c} { c b a}) → #t ; order is unimportant +(set-subset? A B) → #f ; B in A or B = A +(set-subset? A { 3 4 }) → #t +(member 4 A) → (4 5) ; same as #t : true +(member 9 A) → #f + +; check basic equalities +(set-equal? A (set-union (set-intersect A B) (set-substract A B))) → #t +(set-equal? (set-union A B) (set-union (set-sym-diff A B) (set-intersect A B))) → #t + +; × : cartesian product of two sets : all pairs (a . b) , a in A, b in B +; returns a list (not a set) +(define A { albert simon}) +(define B { antoinette ornella marylin}) + +(set-product A B) +→ ((albert . antoinette) (albert . marylin) (albert . ornella) (simon . antoinette) (simon . marylin) (simon . ornella)) + +; sets elements may be sets +{ { a b c} {c b a } { a b d}} → { { a b c } { a b d } } ; duplicate removed + +; A few functions return sets : +(primes 10) → { 2 3 5 7 11 13 17 19 23 29 } diff --git a/Task/Set/FunL/set.funl b/Task/Set/FunL/set.funl new file mode 100644 index 0000000000..81ee5520f8 --- /dev/null +++ b/Task/Set/FunL/set.funl @@ -0,0 +1,23 @@ +A = {1, 2, 3} +B = {3, 4, 5} +C = {1, 2, 3, 4, 5} +D = {2, 1, 3} + +println( '2 is in A: ' + (2 in A) ) +println( '4 is in A: ' + (4 in A) ) +println( 'A union B: ' + A.union(B) ) +println( 'A intersect B: ' + A.intersect(B) ) +println( 'A difference B: ' + A.diff(B) ) +println( 'A subset of B: ' + A.subsetOf(B) ) +println( 'A subset of B: ' + A.subsetOf(C) ) +println( 'A equal B: ' + (A == B) ) +println( 'A equal D: ' + (A == D) ) + +S = set( A ) + +println( 'S (mutable version of A): ' + S ) +S.add( 4 ) +println( 'S with 4 added: ' + S ) +println( 'S subset of C: ' + S.subsetOf(C) ) +S.remove( 1 ) +println( 'S after 1 removed: ' + S ) diff --git a/Task/Set/LFE/set.lfe b/Task/Set/LFE/set.lfe new file mode 100644 index 0000000000..ee1a42b352 --- /dev/null +++ b/Task/Set/LFE/set.lfe @@ -0,0 +1,28 @@ +> (set set-1 (sets:new)) +#(set 0 16 16 8 80 48 ...) +> (set set-2 (sets:add_element 'a set-1)) +#(set 1 16 16 8 80 48 ...) +> (set set-3 (sets:from_list '(a b))) +#(set 2 16 16 8 80 48 ...) +> (sets:is_element 'a set-2) +true +> (set union (sets:union set-2 set-3)) +#(set 2 16 16 8 80 48 ...) +> (sets:to_list union) +(a b) +> (set intersect (sets:intersection set-2 set-3)) +#(set 1 16 16 8 80 48 ...) +> (sets:to_list intersect) +(a) +> (set subtr (sets:subtract set-3 set-2)) +#(set 1 16 16 8 80 48 ...) +> (sets:to_list subtr) +(b) +> (sets:is_subset set-2 set-3) +true +> (=:= set-2 set-3) +false +> (set set-4 (sets:add_element 'b set-2)) +#(set 2 16 16 8 80 48 ...) +> (=:= set-3 set-4) +true diff --git a/Task/Set/Lasso/set.lasso b/Task/Set/Lasso/set.lasso new file mode 100644 index 0000000000..9c8f8bd8e8 --- /dev/null +++ b/Task/Set/Lasso/set.lasso @@ -0,0 +1,25 @@ +// Extend set type +define set->issubsetof(p::set) => .intersection(#p)->size == .size +define set->oncompare(p::set) => .intersection(#p)->size - .size + +// Set creation +local(set1) = set('j','k','l','m','n') +local(set2) = set('m','n','o','p','q') + +//Test m ∈ S -- "m is an element in set S" +#set1 >> 'm' + +// A ∪ B -- union; a set of all elements either in set A or in set B. +#set1->union(#set2) + +//A ∩ B -- intersection; a set of all elements in both set A and set B. +#set1->intersection(#set2) + +//A ∖ B -- difference; a set of all elements in set A, except those in set B. +#set1->difference(#set2) + +//A ⊆ B -- subset; true if every element in set A is also in set B. +#set1->issubsetof(#set2) + +//A = B -- equality; true if every element of set A is in set B and vice-versa. +#set1 == #set2 diff --git a/Task/Set/Nim/set.nim b/Task/Set/Nim/set.nim new file mode 100644 index 0000000000..c6bcb7747e --- /dev/null +++ b/Task/Set/Nim/set.nim @@ -0,0 +1,19 @@ +var # creation + s = {0,3,5,10} + t = {3..20, 50..55} + +if 5 in s: echo "5 is in!" # element test + +var + c = s + t # union + d = s * t # intersection + e = s - t # difference + +if s <= t: echo "s ⊆ t" # subset + +if s <= t: echo "s ⊂ t" # strong subset + +if s == t: echo "s = s" # equality + +s.incl(4) # add 4 to set +s.excl(5) # remove 5 from set diff --git a/Task/Set/Sidef/set-1.sidef b/Task/Set/Sidef/set-1.sidef new file mode 100644 index 0000000000..3290e0565e --- /dev/null +++ b/Task/Set/Sidef/set-1.sidef @@ -0,0 +1,65 @@ +class Set(*set) { + + method init { + var elems = set; + set = Hash.new; + elems.each { |e| self += e } + } + + method +(elem) { + set{elem} = elem; + self; + } + + method del(elem) { + set.delete(elem); + } + + method has(elem) { + set.has_key(elem); + } + + method ∪(Set that) { + Set(set.values..., that.values...); + } + + method ∩(Set that) { + Set(set.keys.grep{ |k| k ∈ that } \ + .map { |k| set{k} }...); + } + + method ∖(Set that) { + Set(set.keys.grep{|k| !(k ∈ that) } \ + .map {|k| set{k} }...); + } + + method ^(Set that) { + var d = ((self ∖ that) ∪ (that ∖ self)); + Set(d.values...); + } + + method count { set.len } + + method ≡(Set that) { + (self ∖ that -> count.is_zero) && (that ∖ self -> count.is_zero); + } + + method values { set.values } + + method ⊆(Set that) { + that.set.keys.each { |k| + k ∈ self || return false; + } + return true; + } + + method to_s { + "Set{" + set.values.map{|e| "#{e}"}.sort.join(', ') + "}" + } +} + +class Object { + method ∈(Set set) { + set.has(self); + } +} diff --git a/Task/Set/Sidef/set-2.sidef b/Task/Set/Sidef/set-2.sidef new file mode 100644 index 0000000000..4c2f4b982c --- /dev/null +++ b/Task/Set/Sidef/set-2.sidef @@ -0,0 +1,22 @@ +var x = Set(1, 2, 3); +5..7 -> each { |i| x += i }; + +var y = Set(1, 2, 4, x); + +say "set x is: #{x}"; +say "set y is: #{y}"; + +[1,2,3,4,x].each { |elem| + say ("#{elem} is ", elem ∈ y ? '' : 'not', " in y"); +} + +var (w, z); +say ("union: ", x ∪ y); +say ("intersect: ", x ∩ y); +say ("z = x ∖ y = ", z = (x ∖ y) ); +say ("y is ", x ⊆ y ? "" : "not ", "a subset of x"); +say ("z is ", x ⊆ z ? "" : "not ", "a subset of x"); +say ("z = (x ∪ y) ∖ (x ∩ y) = ", z = ((x ∪ y) ∖ (x ∩ y))); +say ("w = x ^ y = ", w = (x ^ y)); +say ("w is ", w ≡ z ? "" : "not ", "equal to z"); +say ("w is ", w ≡ x ? "" : "not ", "equal to x"); diff --git a/Task/Set/Swift/set.swift b/Task/Set/Swift/set.swift new file mode 100644 index 0000000000..c1332c80ef --- /dev/null +++ b/Task/Set/Swift/set.swift @@ -0,0 +1,27 @@ +var s1 : Set = [1, 2, 3, 4] +let s2 : Set = [3, 4, 5, 6] +println(s1.union(s2)) // union; prints "[5, 6, 2, 3, 1, 4]" +println(s1.intersect(s2)) // intersection; prints "[3, 4]" +println(s1.subtract(s2)) // difference; prints "[2, 1]" +println(s1.isSubsetOf(s1)) // subset; prints "true" +println(Set([3, 1]).isSubsetOf(s1)) // subset; prints "true" +println(s1.isStrictSubsetOf(s1)) // proper subset; prints "false" +println(Set([3, 1]).isStrictSubsetOf(s1)) // proper subset; prints "true" +println(Set([3, 2, 4, 1]) == s1) // equality; prints "true" +println(s1 == s2) // equality; prints "false" +println(s1.contains(2)) // membership; prints "true" +println(Set([1, 2, 3, 4]).isSupersetOf(s1)) // superset; prints "true" +println(Set([1, 2, 3, 4]).isStrictSupersetOf(s1)) // proper superset; prints "false" +println(Set([1, 2, 3, 4, 5]).isStrictSupersetOf(s1)) // proper superset; prints "true" +println(s1.exclusiveOr(s2)) // symmetric difference; prints "[5, 6, 2, 1]" +println(s1.count) // cardinality; prints "4" +s1.insert(99) // mutability +println(s1) // prints "[99, 2, 3, 1, 4]" +s1.remove(99) // mutability +println(s1) // prints "[2, 3, 1, 4]" +s1.unionInPlace(s2) // mutability +println(s1) // prints "[5, 6, 2, 3, 1, 4]" +s1.subtractInPlace(s2) // mutability +println(s1) // prints "[2, 1]" +s1.exclusiveOrInPlace(s2) // mutability +println(s1) // prints "[5, 6, 2, 3, 1, 4]" diff --git a/Task/Set/jq/set-1.jq b/Task/Set/jq/set-1.jq new file mode 100644 index 0000000000..aa5856199e --- /dev/null +++ b/Task/Set/jq/set-1.jq @@ -0,0 +1,2 @@ +{"a":true, "b":true } == {"b":true, "a":true}. +{"a":true} + {"b":true } == { "a":true, "b":true} diff --git a/Task/Set/jq/set-10.jq b/Task/Set/jq/set-10.jq new file mode 100644 index 0000000000..8d8cb865c6 --- /dev/null +++ b/Task/Set/jq/set-10.jq @@ -0,0 +1,19 @@ +# If A and B are sets, then A-B is emitted +def difference(A;B): + (A|length) as $al + | (B|length) as $bl + | if $al == 0 then [] elif $bl == 0 then A + else + reduce range(0; $al + $bl) as $k + ( [0, 0, []]; + .[0] as $i | .[1] as $j + | if $i < $al and $j < $bl then + if A[$i] == B[$j] then [ $i+1, $j+1, .[2] ] + elif A[$i] < B[$j] then [ $i+1, $j, .[2] + [A[$i]] ] + else [ $i , $j+1, .[2] ] + end + elif $i < $al then [ $i+1, $j, .[2] + [A[$i]] ] + else . + end + ) | .[2] + end ; diff --git a/Task/Set/jq/set-11.jq b/Task/Set/jq/set-11.jq new file mode 100644 index 0000000000..10f8ce91c0 --- /dev/null +++ b/Task/Set/jq/set-11.jq @@ -0,0 +1,22 @@ +# merge input array with array x by comparing the heads of the arrays in turn; +# if both arrays are sorted, the result will be sorted: +def merge(x): + length as $length + | (x|length) as $xl + | if $length == 0 then x + elif $xl == 0 then . + else + . as $in + | reduce range(0; $xl + $length) as $z + # state [ix, xix, ans] + ( [0, 0, []]; + if .[0] < $length and ((.[1] < $xl and $in[.[0]] <= x[.[1]]) or .[1] == $xl) + then [(.[0] + 1), .[1], (.[2] + [$in[.[0]]]) ] + else [.[0], (.[1] + 1), (.[2] + [x[.[1]]]) ] + end + ) | .[2] + end ; + +def union(A;B): + A|merge(B) + | reduce .[] as $m ([]; if length == 0 or .[length-1] != $m then . + [$m] else . end); diff --git a/Task/Set/jq/set-12.jq b/Task/Set/jq/set-12.jq new file mode 100644 index 0000000000..2690e5e221 --- /dev/null +++ b/Task/Set/jq/set-12.jq @@ -0,0 +1,10 @@ +def subset(A;B): + # TCO + def _subset: + if .[0]|length == 0 then true + elif .[1]|length == 0 then false + elif .[0][0] == .[1][0] then [.[0][1:], .[1][1:]] | _subset + elif .[0][0] < .[1][0] then false + else [ .[0], .[1][1:] ] | _subset + end; + [A,B] | _subset; diff --git a/Task/Set/jq/set-13.jq b/Task/Set/jq/set-13.jq new file mode 100644 index 0000000000..21b588588b --- /dev/null +++ b/Task/Set/jq/set-13.jq @@ -0,0 +1,11 @@ +def intersect: + .[0] as $A | .[1] as $B + | ($A|length) as $al + | ($B|length) as $bl + | if $al == 0 or $bl == 0 then false + else + ($B | bsearch($A[0])) as $b + | if $b >= 0 then true + else [$A[1:], $B[- (1 + $b) :]] | intersect + end + end; diff --git a/Task/Set/jq/set-2.jq b/Task/Set/jq/set-2.jq new file mode 100644 index 0000000000..803887159a --- /dev/null +++ b/Task/Set/jq/set-2.jq @@ -0,0 +1,2 @@ +def is_stringset: + . as $in | type == "object" and reduce keys[] as $key (true; . and $in[$key] == true); diff --git a/Task/Set/jq/set-3.jq b/Task/Set/jq/set-3.jq new file mode 100644 index 0000000000..4eaf07b384 --- /dev/null +++ b/Task/Set/jq/set-3.jq @@ -0,0 +1 @@ +T | has(m) diff --git a/Task/Set/jq/set-4.jq b/Task/Set/jq/set-4.jq new file mode 100644 index 0000000000..ff25beba1d --- /dev/null +++ b/Task/Set/jq/set-4.jq @@ -0,0 +1,4 @@ +# Set-intersection: A ∩ B +def stringset_intersection(A;B): + reduce (A|keys)[] as $k + ({}; if (B|has($k)) then . + {($k):true} else . end); diff --git a/Task/Set/jq/set-5.jq b/Task/Set/jq/set-5.jq new file mode 100644 index 0000000000..f8c01e7a74 --- /dev/null +++ b/Task/Set/jq/set-5.jq @@ -0,0 +1,4 @@ +# stringset_difference: A \ B +def stringset_difference(A;B): + reduce (A|keys)[] as $k + ({}; if (B|has($k)) then . else . + {($k):true} end); diff --git a/Task/Set/jq/set-6.jq b/Task/Set/jq/set-6.jq new file mode 100644 index 0000000000..1bf7f6af2f --- /dev/null +++ b/Task/Set/jq/set-6.jq @@ -0,0 +1,4 @@ +# A ⊆ B iff string_subset(A;B) +def stringset_subset(A;B): + reduce (A|keys)[] as $k + (true; . and (B|has($k))); diff --git a/Task/Set/jq/set-7.jq b/Task/Set/jq/set-7.jq new file mode 100644 index 0000000000..930cda36c1 --- /dev/null +++ b/Task/Set/jq/set-7.jq @@ -0,0 +1,5 @@ +def is_set: + . as $in + | type == "array" and + reduce range(0;length-1) as $i + (true; if . then $in[$i] < $in[$i+1] else false end); diff --git a/Task/Set/jq/set-8.jq b/Task/Set/jq/set-8.jq new file mode 100644 index 0000000000..884b197e80 --- /dev/null +++ b/Task/Set/jq/set-8.jq @@ -0,0 +1 @@ +def is_member(m): bsearch(m) > -1; diff --git a/Task/Set/jq/set-9.jq b/Task/Set/jq/set-9.jq new file mode 100644 index 0000000000..66832b29a8 --- /dev/null +++ b/Task/Set/jq/set-9.jq @@ -0,0 +1,18 @@ +# If A and B are sets, then intersection(A;B) emits their intersection: +def intersection(A;B): + (A|length) as $al + | (B|length) as $bl + | if $al == 0 or $bl == 0 then [] + else + reduce range(0; $al + $bl) as $k + ( [0, 0, []]; + .[0] as $i | .[1] as $j + | if $i < $al and $j < $bl then + if A[$i] == B[$j] then [ $i+1 , $j+1, .[2] + [A[$i]]] + elif A[$i] < B[$j] then [ $i+1 , $j, .[2] ] + else [ $i , $j+1, .[2] ] + end + else . + end + ) | .[2] + end ; diff --git a/Task/Seven-sided-dice-from-five-sided-dice/Sidef/seven-sided-dice-from-five-sided-dice.sidef b/Task/Seven-sided-dice-from-five-sided-dice/Sidef/seven-sided-dice-from-five-sided-dice.sidef new file mode 100644 index 0000000000..d06fec790d --- /dev/null +++ b/Task/Seven-sided-dice-from-five-sided-dice/Sidef/seven-sided-dice-from-five-sided-dice.sidef @@ -0,0 +1,16 @@ +func dice5 { 1 + 5.rand.int } + +func dice7 { + loop { + var d7 = ((5*dice5() + dice5() - 6) % 8); + d7 && return d7; + } +} + +var count7 = Hash.new; + +var n = 1e6; +n.times { count7{dice7()} := 0 ++ } +count7.keys.sort.each { |k| + printf("%s: %5.2f%%\n", k, 100*(count7{k}/n * 7 - 1)); +} diff --git a/Task/Shell-one-liner/FreeBASIC/shell-one-liner.freebasic b/Task/Shell-one-liner/FreeBASIC/shell-one-liner.freebasic new file mode 100644 index 0000000000..1722c5cda9 --- /dev/null +++ b/Task/Shell-one-liner/FreeBASIC/shell-one-liner.freebasic @@ -0,0 +1,4 @@ +' FB 1.05.0 Win64 + +Shell "echo For i As Integer = 1 To 10 : Print i : Next > zzz.bas && fbc zzz.bas && zzz" +Sleep diff --git a/Task/Shell-one-liner/FutureBasic/shell-one-liner.futurebasic b/Task/Shell-one-liner/FutureBasic/shell-one-liner.futurebasic new file mode 100644 index 0000000000..21778ceee5 --- /dev/null +++ b/Task/Shell-one-liner/FutureBasic/shell-one-liner.futurebasic @@ -0,0 +1 @@ +include "ConsoleWindow":dim a$:open "Unix",1,"cal 10 2018":do:line input #1,a$:print a$:until eof(1):close 1 diff --git a/Task/Shell-one-liner/Lasso/shell-one-liner-1.lasso b/Task/Shell-one-liner/Lasso/shell-one-liner-1.lasso new file mode 100644 index 0000000000..143012a69a --- /dev/null +++ b/Task/Shell-one-liner/Lasso/shell-one-liner-1.lasso @@ -0,0 +1 @@ +echo " 'The date and time is: ' + date " | lasso9 -- diff --git a/Task/Shell-one-liner/Lasso/shell-one-liner-2.lasso b/Task/Shell-one-liner/Lasso/shell-one-liner-2.lasso new file mode 100644 index 0000000000..980f6810d7 --- /dev/null +++ b/Task/Shell-one-liner/Lasso/shell-one-liner-2.lasso @@ -0,0 +1 @@ +$ lasso9 -s " 'The date and time is: ' + date " diff --git a/Task/Shell-one-liner/Oforth/shell-one-liner.oforth b/Task/Shell-one-liner/Oforth/shell-one-liner.oforth new file mode 100644 index 0000000000..775872bddd --- /dev/null +++ b/Task/Shell-one-liner/Oforth/shell-one-liner.oforth @@ -0,0 +1 @@ +oforth --P"1000 seq map(#sqrt) sum print" diff --git a/Task/Shell-one-liner/Ring/shell-one-liner.ring b/Task/Shell-one-liner/Ring/shell-one-liner.ring new file mode 100644 index 0000000000..cb8486b414 --- /dev/null +++ b/Task/Shell-one-liner/Ring/shell-one-liner.ring @@ -0,0 +1 @@ +see "Hello World!" + nl diff --git a/Task/Shell-one-liner/Sidef/shell-one-liner.sidef b/Task/Shell-one-liner/Sidef/shell-one-liner.sidef new file mode 100644 index 0000000000..ab79aae7cd --- /dev/null +++ b/Task/Shell-one-liner/Sidef/shell-one-liner.sidef @@ -0,0 +1 @@ +% sidef -E "say 'hello'" diff --git a/Task/Shell-one-liner/Wart/shell-one-liner.wart b/Task/Shell-one-liner/Wart/shell-one-liner.wart new file mode 100644 index 0000000000..65dfdc3e7b --- /dev/null +++ b/Task/Shell-one-liner/Wart/shell-one-liner.wart @@ -0,0 +1 @@ +echo "prn 34" |wart diff --git a/Task/Shell-one-liner/jq/shell-one-liner.jq b/Task/Shell-one-liner/jq/shell-one-liner.jq new file mode 100644 index 0000000000..4d363a0794 --- /dev/null +++ b/Task/Shell-one-liner/jq/shell-one-liner.jq @@ -0,0 +1,2 @@ +$ jq -M -n 1+1 +2 diff --git a/Task/Short-circuit-evaluation/Axe/short-circuit-evaluation.axe b/Task/Short-circuit-evaluation/Axe/short-circuit-evaluation.axe new file mode 100644 index 0000000000..bdf79376d0 --- /dev/null +++ b/Task/Short-circuit-evaluation/Axe/short-circuit-evaluation.axe @@ -0,0 +1,22 @@ +TEST(0,0) +TEST(0,1) +TEST(1,0) +TEST(1,1) +Return + +Lbl TEST +r₁→X +r₂→Y +Disp X▶Hex+3," and ",Y▶Hex+3," = ",(A(X)?B(Y))▶Hex+3,i +Disp X▶Hex+3," or ",Y▶Hex+3," = ",(A(X)??B(Y))▶Hex+3,i +.Wait for keypress +getKeyʳ +Return + +Lbl A +r₁ +Return + +Lbl B +r₁ +Return diff --git a/Task/Short-circuit-evaluation/FreeBASIC/short-circuit-evaluation.freebasic b/Task/Short-circuit-evaluation/FreeBASIC/short-circuit-evaluation.freebasic new file mode 100644 index 0000000000..93a7ea7cd9 --- /dev/null +++ b/Task/Short-circuit-evaluation/FreeBASIC/short-circuit-evaluation.freebasic @@ -0,0 +1,29 @@ +' FB 1.05.0 Win64 + +Function a(p As Boolean) As Boolean + Print "a() called" + Return p +End Function + +Function b(p As Boolean) As Boolean + Print "b() called" + Return p +End Function + +Dim As Boolean i, j, x, y +i = False +j = True +Print "Without short-circuit evaluation :" +Print +x = a(i) And b(j) +y = a(i) Or b(j) +Print "x = "; x; " y = "; y +Print +Print "With short-circuit evaluation :" +Print +x = a(i) AndAlso b(j) '' b(j) not called as a(i) = false and so x must be false +y = a(i) OrElse b(j) '' b(j) still called as can't determine y unless it is +Print "x = "; x; " y = "; y +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Short-circuit-evaluation/LiveCode/short-circuit-evaluation.livecode b/Task/Short-circuit-evaluation/LiveCode/short-circuit-evaluation.livecode new file mode 100644 index 0000000000..e73402f9d2 --- /dev/null +++ b/Task/Short-circuit-evaluation/LiveCode/short-circuit-evaluation.livecode @@ -0,0 +1,23 @@ +function aa bool + global outcome + put "aa called with" && bool & cr after outcome + return bool +end aa +function b bool + global outcome + put "b called with" && bool & cr after outcome + return bool +end b + +on mouseUp + global outcome + put empty into outcome + repeat for each item op in "and,or" + repeat for each item x in "true,false" + put merge("[[aa(x)]] [[op]] [[b(x)]]") & cr after outcome + put merge("[[aa(x)]] [[op]] [[b(not x)]]") & cr after outcome + end repeat + put cr after outcome + end repeat + put outcome +end mouseUp diff --git a/Task/Short-circuit-evaluation/Nim/short-circuit-evaluation.nim b/Task/Short-circuit-evaluation/Nim/short-circuit-evaluation.nim new file mode 100644 index 0000000000..3f252aaf41 --- /dev/null +++ b/Task/Short-circuit-evaluation/Nim/short-circuit-evaluation.nim @@ -0,0 +1,10 @@ +proc a(x): bool = + echo "a called" + result = x +proc b(x): bool = + echo "b called" + result = x + +let x = a(false) and b(true) # echoes "a called" + +let y = a(true) or b(true) # echoes "a called" diff --git a/Task/Short-circuit-evaluation/Phix/short-circuit-evaluation.phix b/Task/Short-circuit-evaluation/Phix/short-circuit-evaluation.phix new file mode 100644 index 0000000000..25d00b4001 --- /dev/null +++ b/Task/Short-circuit-evaluation/Phix/short-circuit-evaluation.phix @@ -0,0 +1,23 @@ +function a(integer i) + printf(1,"a ") + return i +end function + +function b(integer i) + printf(1,"b ") + return i +end function + +for z=0 to 1 do + for i=0 to 1 do + for j=0 to 1 do + if z then + printf(1,"a(%d) and b(%d) ",{i,j}) + printf(1," => %d\n",a(i) and b(j)) + else + printf(1,"a(%d) or b(%d) ",{i,j}) + printf(1," => %d\n",a(i) or b(j)) + end if + end for + end for +end for diff --git a/Task/Short-circuit-evaluation/Sidef/short-circuit-evaluation.sidef b/Task/Short-circuit-evaluation/Sidef/short-circuit-evaluation.sidef new file mode 100644 index 0000000000..fe66378401 --- /dev/null +++ b/Task/Short-circuit-evaluation/Sidef/short-circuit-evaluation.sidef @@ -0,0 +1,16 @@ +func a(bool) { print 'A'; return bool } +func b(bool) { print 'B'; return bool } +  +# Test-driver +func test() { + for op in ['&&', '||'] { + for x,y in [[1,1],[1,0],[0,1],[0,0]] { + "a(%s) %s b(%s): ".printf(x, op, y) + eval "a(Bool(x)) #{op} b(Bool(y))" + print "\n" + } + } +} +  +# Test and display +test() diff --git a/Task/Short-circuit-evaluation/Swift/short-circuit-evaluation.swift b/Task/Short-circuit-evaluation/Swift/short-circuit-evaluation.swift new file mode 100644 index 0000000000..cc37eed6f2 --- /dev/null +++ b/Task/Short-circuit-evaluation/Swift/short-circuit-evaluation.swift @@ -0,0 +1,26 @@ +func a(v: Bool) -> Bool { + print("a") + return v +} + +func b(v: Bool) -> Bool { + print("b") + return v +} + +func test(i: Bool, j: Bool) { + println("Testing a(\(i)) && b(\(j))") + print("Trace: ") + println("\nResult: \(a(i) && b(j))") + + println("Testing a(\(i)) || b(\(j))") + print("Trace: ") + println("\nResult: \(a(i) || b(j))") + + println() +} + +test(false, false) +test(false, true) +test(true, false) +test(true, true) diff --git a/Task/Short-circuit-evaluation/Visual-FoxPro/short-circuit-evaluation.visual b/Task/Short-circuit-evaluation/Visual-FoxPro/short-circuit-evaluation.visual new file mode 100644 index 0000000000..865ce253e7 --- /dev/null +++ b/Task/Short-circuit-evaluation/Visual-FoxPro/short-circuit-evaluation.visual @@ -0,0 +1,34 @@ +*!* Visual FoxPro natively supports short circuit evaluation +CLEAR +CREATE CURSOR funceval(arg1 L, arg2 L, operation V(3), result L, calls V(10)) +*!* Conjunction +INSERT INTO funceval (arg1, arg2, operation) VALUES (.F., .F., "AND") +REPLACE result WITH (a(arg1) AND b(arg2)) +INSERT INTO funceval (arg1, arg2, operation) VALUES (.F., .T., "AND") +REPLACE result WITH (a(arg1) AND b(arg2)) +INSERT INTO funceval (arg1, arg2, operation) VALUES (.T., .F., "AND") +REPLACE result WITH (a(arg1) AND b(arg2)) +INSERT INTO funceval (arg1, arg2, operation) VALUES (.T., .T., "AND") +REPLACE result WITH (a(arg1) AND b(arg2)) +*!* Disjunction +INSERT INTO funceval (arg1, arg2, operation) VALUES (.F., .F., "OR") +REPLACE result WITH (a(arg1) OR b(arg2)) +INSERT INTO funceval (arg1, arg2, operation) VALUES (.F., .T., "OR") +REPLACE result WITH (a(arg1) OR b(arg2)) +INSERT INTO funceval (arg1, arg2, operation) VALUES (.T., .F., "OR") +REPLACE result WITH (a(arg1) OR b(arg2)) +INSERT INTO funceval (arg1, arg2, operation) VALUES (.T., .T., "OR") +REPLACE result WITH (a(arg1) OR b(arg2)) +GO TOP + +_VFP.DataToClip("funceval", 8, 3) + +FUNCTION a(v As Boolean) As Boolean +REPLACE calls WITH "a()" +RETURN v +ENDFUNC + +FUNCTION b(v As Boolean) As Boolean +REPLACE calls WITH calls + ", b()" +RETURN v +ENDFUNC diff --git a/Task/Short-circuit-evaluation/jq/short-circuit-evaluation-1.jq b/Task/Short-circuit-evaluation/jq/short-circuit-evaluation-1.jq new file mode 100644 index 0000000000..e1115ff786 --- /dev/null +++ b/Task/Short-circuit-evaluation/jq/short-circuit-evaluation-1.jq @@ -0,0 +1,8 @@ +def a(x): " a(\(x))" | stderr | x; + +def b(y): " b(\(y))" | stderr | y; + +"and:", (a(true) and b(true)), +"or:", (a(true) or b(true)), +"and:", (a(false) and b(true)), +"or:", (a(false) or b(true)) diff --git a/Task/Short-circuit-evaluation/jq/short-circuit-evaluation-2.jq b/Task/Short-circuit-evaluation/jq/short-circuit-evaluation-2.jq new file mode 100644 index 0000000000..208bacae7a --- /dev/null +++ b/Task/Short-circuit-evaluation/jq/short-circuit-evaluation-2.jq @@ -0,0 +1,15 @@ +$ jq -r -n -f Short-circuit-evaluation.jq +and: +" a(true)" +" b(true)" +true +or: +" a(true)" +true +and: +" a(false)" +false +or: +" a(false)" +" b(true)" +true diff --git a/Task/Show-the-epoch/FreeBASIC/show-the-epoch.freebasic b/Task/Show-the-epoch/FreeBASIC/show-the-epoch.freebasic new file mode 100644 index 0000000000..b9b479748f --- /dev/null +++ b/Task/Show-the-epoch/FreeBASIC/show-the-epoch.freebasic @@ -0,0 +1,16 @@ +' FB 1.05.0 Win64 + +#Include "vbcompat.bi" + +' The first argument to the Format function is a date serial +' and so the first statement below displays the epoch. + +Dim f As String = "mmmm d, yyyy hh:mm:ss" +Print Format( 0 , f) '' epoch +Print Format( 0.5, f) '' noon on the same day +Print Format(-0.5, f) '' noon on the previous day +Print Format(1000000, f) '' one million days after the epoch +Print Format(-80000, f) '' eighty thousand days before the epoch +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Show-the-epoch/FutureBasic/show-the-epoch.futurebasic b/Task/Show-the-epoch/FutureBasic/show-the-epoch.futurebasic new file mode 100644 index 0000000000..e5ecd34d73 --- /dev/null +++ b/Task/Show-the-epoch/FutureBasic/show-the-epoch.futurebasic @@ -0,0 +1,15 @@ +include "ConsoleWindow" + +print date$ +print date$("d MMM yyyy") +print date$("EEE, MMM d, yyyy") +print date$("MMMM d, yyyy ") +print date$("MMMM d, yyyy G") +print "This is day ";date$("D");" of the year" +print +print time$ +print time$("hh:mm:ss") +print time$("h:mm a") +print time$("h:mm a zzz") +print +print time$("h:mm a ZZZZ "); date$("MMMM d, yyyy G") diff --git a/Task/Show-the-epoch/Lasso/show-the-epoch.lasso b/Task/Show-the-epoch/Lasso/show-the-epoch.lasso new file mode 100644 index 0000000000..d793b8a4af --- /dev/null +++ b/Task/Show-the-epoch/Lasso/show-the-epoch.lasso @@ -0,0 +1,2 @@ +date(0.00) +date(0) diff --git a/Task/Show-the-epoch/LiveCode/show-the-epoch.livecode b/Task/Show-the-epoch/LiveCode/show-the-epoch.livecode new file mode 100644 index 0000000000..cf3cfc1a24 --- /dev/null +++ b/Task/Show-the-epoch/LiveCode/show-the-epoch.livecode @@ -0,0 +1,6 @@ +put 0 into somedate +convert somedate to internet date +put somedate + +-- output GMT (localised) +-- Thu, 1 Jan 1970 10:00:00 +1000 diff --git a/Task/Show-the-epoch/Nim/show-the-epoch.nim b/Task/Show-the-epoch/Nim/show-the-epoch.nim new file mode 100644 index 0000000000..6e0e8744bf --- /dev/null +++ b/Task/Show-the-epoch/Nim/show-the-epoch.nim @@ -0,0 +1,3 @@ +import times + +echo getGMTime(fromSeconds(0)) diff --git a/Task/Show-the-epoch/Oforth/show-the-epoch.oforth b/Task/Show-the-epoch/Oforth/show-the-epoch.oforth new file mode 100644 index 0000000000..b133ea1743 --- /dev/null +++ b/Task/Show-the-epoch/Oforth/show-the-epoch.oforth @@ -0,0 +1,3 @@ +import: date + +0 asDateUTC println diff --git a/Task/Show-the-epoch/Ring/show-the-epoch.ring b/Task/Show-the-epoch/Ring/show-the-epoch.ring new file mode 100644 index 0000000000..cafdf96448 --- /dev/null +++ b/Task/Show-the-epoch/Ring/show-the-epoch.ring @@ -0,0 +1,14 @@ +load "guilib.ring" + +New qApp { + win1 = new qMainWindow() { + setwindowtitle("Using QDateEdit") + setGeometry(100,100,250,100) + oDate = new qdateedit(win1) { + setGeometry(20,40,220,30) + oDate.minimumDate() + } + show() + } + exec() + } diff --git a/Task/Show-the-epoch/Sidef/show-the-epoch.sidef b/Task/Show-the-epoch/Sidef/show-the-epoch.sidef new file mode 100644 index 0000000000..0f8102bdeb --- /dev/null +++ b/Task/Show-the-epoch/Sidef/show-the-epoch.sidef @@ -0,0 +1 @@ +say Time.new(0).gmtime.ctime; diff --git a/Task/Show-the-epoch/jq/show-the-epoch-1.jq b/Task/Show-the-epoch/jq/show-the-epoch-1.jq new file mode 100644 index 0000000000..2295479e0e --- /dev/null +++ b/Task/Show-the-epoch/jq/show-the-epoch-1.jq @@ -0,0 +1 @@ +0 | todate diff --git a/Task/Show-the-epoch/jq/show-the-epoch-2.jq b/Task/Show-the-epoch/jq/show-the-epoch-2.jq new file mode 100644 index 0000000000..f4b9bbe427 --- /dev/null +++ b/Task/Show-the-epoch/jq/show-the-epoch-2.jq @@ -0,0 +1 @@ +"1970-01-01T00:00:00Z" diff --git a/Task/Sierpinski-carpet/ERRE/sierpinski-carpet.erre b/Task/Sierpinski-carpet/ERRE/sierpinski-carpet.erre new file mode 100644 index 0000000000..2390324f50 --- /dev/null +++ b/Task/Sierpinski-carpet/ERRE/sierpinski-carpet.erre @@ -0,0 +1,30 @@ +PROGRAM SIERP_CARPET + +! for rosettacode.org + +!$INTEGER + +BEGIN + OPEN("O",1,"OUT.PRN") + PRINT(CHR$(12);) !CLS + DEPTH=3 + DIMM=1 + + FOR I=0 TO DEPTH-1 DO + DIMM=DIMM*3 + END FOR + + FOR I=0 TO DIMM-1 DO + FOR J=0 TO DIMM-1 DO + D=DIMM DIV 3 + REPEAT + EXIT IF ((I MOD (D*3)) DIV D=1 AND (J MOD (D*3)) DIV D=1) + D=D DIV 3 + UNTIL NOT(D>0) + IF D>0 THEN PRINT(#1," ";) ELSE PRINT(#1,"##";) END IF + END FOR + PRINT(#1,) + END FOR + ! PRINT(#1,CHR$(12);) for printer only! + CLOSE(1) +END PROGRAM diff --git a/Task/Sierpinski-carpet/Nim/sierpinski-carpet.nim b/Task/Sierpinski-carpet/Nim/sierpinski-carpet.nim new file mode 100644 index 0000000000..3a07517b96 --- /dev/null +++ b/Task/Sierpinski-carpet/Nim/sierpinski-carpet.nim @@ -0,0 +1,32 @@ +proc `^`*(base: int, exp: int): int = + var (base, exp) = (base, exp) + result = 1 + + while exp != 0: + if (exp and 1) != 0: + result *= base + exp = exp shr 1 + base *= base + +proc inCarpet(x, y): bool = + var x = x + var y = y + while true: + if x == 0 or y == 0: + return true + if x mod 3 == 1 and y mod 3 == 1: + return false + + x = x div 3 + y = y div 3 + +proc carpet(n) = + for i in 0 .. <(3^n): + for j in 0 .. <(3^n): + if inCarpet(i, j): + stdout.write "* " + else: + stdout.write " " + echo "" + +carpet(3) diff --git a/Task/Sierpinski-carpet/Oforth/sierpinski-carpet.oforth b/Task/Sierpinski-carpet/Oforth/sierpinski-carpet.oforth new file mode 100644 index 0000000000..b39e790ccd --- /dev/null +++ b/Task/Sierpinski-carpet/Oforth/sierpinski-carpet.oforth @@ -0,0 +1,15 @@ +: carpet(n) +| dim i j k | + 3 n pow ->dim + + 0 dim 1 - for: i [ + 0 dim 1 - for: j [ + dim 3 / ->k + while(k) [ + i k 3 * mod k / 1 == j k 3 * mod k / 1 == and ifTrue: [ break ] + k 3 / ->k + ] + k ifTrue: [ " " ] else: [ "#" ] print + ] + printcr + ] ; diff --git a/Task/Sierpinski-carpet/Phix/sierpinski-carpet.phix b/Task/Sierpinski-carpet/Phix/sierpinski-carpet.phix new file mode 100644 index 0000000000..94a3aaa165 --- /dev/null +++ b/Task/Sierpinski-carpet/Phix/sierpinski-carpet.phix @@ -0,0 +1,19 @@ +constant order = 4 + +function InCarpet(atom x, atom y) + while x!=0 and y!=0 do + if floor(mod(x,3))=1 and floor(mod(y,3))=1 then + return ' ' + end if + x /= 3 + y /= 3 + end while + return '#' +end function + +for i=0 to power(3,order)-1 do + for j=0 to power(3,order)-1 do + puts(1,InCarpet(i,j)) + end for + puts(1,'\n') +end for diff --git a/Task/Sierpinski-carpet/Ring/sierpinski-carpet.ring b/Task/Sierpinski-carpet/Ring/sierpinski-carpet.ring new file mode 100644 index 0000000000..1fde3b7a55 --- /dev/null +++ b/Task/Sierpinski-carpet/Ring/sierpinski-carpet.ring @@ -0,0 +1,56 @@ +load "guilib.ring" + +new qapp + { + win1 = new qwidget() { + etwindowtitle("drawing using qpainter") + setgeometry(100,100,500,500) + label1 = new qlabel(win1) { + setgeometry(10,10,400,400) + settext("") + } + new qpushbutton(win1) { + setgeometry(200,450,100,30) + settext("draw") + setclickevent("draw()") + } + show() + } + exec() + } + +func draw + p1 = new qpicture() + color = new qcolor() { + setrgb(0,0,255,255) + } + pen = new qpen() { + setcolor(color) + setwidth(1) + } + new qpainter() { + begin(p1) + setpen(pen) + + order = 3 + side = pow(3,order) + for y = 0 to side-1 + for x = 0 to side-1 + if carpet(self,x,y) + drawpoint(x*16,y*16+15) + drawpoint(x*16+1,y*16+16) + drawpoint(x*16+2,y*16+17) ok + next + next + + endpaint() + } + label1 { setpicture(p1) show() } + + func carpet myObj,x,y + myObj{while x!=0 and y!=0 + if x % 3 = 1 if y % 3 = 1 return false ok ok + x = floor(x/3) + y = floor(y/3) + end + return true} diff --git a/Task/Sierpinski-carpet/Sidef/sierpinski-carpet.sidef b/Task/Sierpinski-carpet/Sidef/sierpinski-carpet.sidef new file mode 100644 index 0000000000..04fff3e635 --- /dev/null +++ b/Task/Sierpinski-carpet/Sidef/sierpinski-carpet.sidef @@ -0,0 +1,7 @@ +var c = ['##'] +3.times { + c = (c.map{|x| x * 3 } + + c.map{|x| x + ' '*x.len + x } + + c.map{|x| x * 3 }) +} +say c.join("\n") diff --git a/Task/Sierpinski-carpet/Swift/sierpinski-carpet.swift b/Task/Sierpinski-carpet/Swift/sierpinski-carpet.swift new file mode 100644 index 0000000000..e16a645fca --- /dev/null +++ b/Task/Sierpinski-carpet/Swift/sierpinski-carpet.swift @@ -0,0 +1,17 @@ +import Foundation +func sierpinski_carpet(n:Int) -> String { + func middle(str:String) -> String { + let spacer = str.stringByReplacingOccurrencesOfString("#", withString:" ", options:nil, range:nil) + return str + spacer + str + } + + var carpet = ["#"] + for i in 1...n { + let a = carpet.map{$0 + $0 + $0} + let b = carpet.map(middle) + carpet = a + b + a + } + return "\n".join(carpet) +} + +println(sierpinski_carpet(3)) diff --git a/Task/Sierpinski-carpet/jq/sierpinski-carpet-1.jq b/Task/Sierpinski-carpet/jq/sierpinski-carpet-1.jq new file mode 100644 index 0000000000..88c7ad00d9 --- /dev/null +++ b/Task/Sierpinski-carpet/jq/sierpinski-carpet-1.jq @@ -0,0 +1,18 @@ +def inCarpet(x; y): + x as $x | y as $y | + if $x == -1 or $y == -1 then "\n" + elif $x == 0 or $y == 0 then "*" + elif ($x % 3) == 1 and ($y % 3) == 1 then " " + else inCarpet($x/3 | floor; $y/3 | floor) + end; + +def ipow(n): + . as $in | reduce range(0;n) as $i (1; . * $in); + +def carpet(n): + (3|ipow(n)) as $power + | [ inCarpet( range(0; $power) ; range(0; $power), -1 )] + | join("") ; + + +carpet(3) diff --git a/Task/Sierpinski-carpet/jq/sierpinski-carpet-2.jq b/Task/Sierpinski-carpet/jq/sierpinski-carpet-2.jq new file mode 100644 index 0000000000..79bdae70d2 --- /dev/null +++ b/Task/Sierpinski-carpet/jq/sierpinski-carpet-2.jq @@ -0,0 +1 @@ +jq -n -r -c -f sierpinski.jq diff --git a/Task/Sierpinski-triangle-Graphical/ERRE/sierpinski-triangle-graphical.erre b/Task/Sierpinski-triangle-Graphical/ERRE/sierpinski-triangle-graphical.erre new file mode 100644 index 0000000000..4f3e4e981c --- /dev/null +++ b/Task/Sierpinski-triangle-Graphical/ERRE/sierpinski-triangle-graphical.erre @@ -0,0 +1,16 @@ +PROGRAM SIERPINSKY + +!$INCLUDE="PC.LIB" + +BEGIN + ORDER%=8 + SIZE%=2^ORDER% + SCREEN(9) + GR_WINDOW(0,0,520,520) + FOR Y%=0 TO SIZE%-1 DO + FOR X%=0 TO SIZE%-1 DO + IF (X% AND Y%)=0 THEN PSET(X%*2,Y%*2,2) END IF + END FOR + END FOR + GET(K$) +END PROGRAM diff --git a/Task/Sierpinski-triangle-Graphical/FreeBASIC/sierpinski-triangle-graphical.freebasic b/Task/Sierpinski-triangle-Graphical/FreeBASIC/sierpinski-triangle-graphical.freebasic new file mode 100644 index 0000000000..fa1ba2819a --- /dev/null +++ b/Task/Sierpinski-triangle-Graphical/FreeBASIC/sierpinski-triangle-graphical.freebasic @@ -0,0 +1,24 @@ +' version 06-07-2015 +' compile with: fbc -s console or with: fbc -s gui + +#Define black 0 +#Define white RGB(255,255,255) + +Dim As Integer x, y +Dim As Integer order = 9 +Dim As Integer size = 2 ^ order + +ScreenRes size, size, 32 +Line (0,0) - (size -1, size -1), black, bf + +For y = 0 To size -1 + For x = 0 To size -1 + If (x And y) = 0 Then PSet(x, y) ' ,white + Next +Next + +' empty keyboard buffer +While Inkey <> "" : Wend +WindowTitle "Hit any key to end program" +Sleep +End diff --git a/Task/Sierpinski-triangle-Graphical/Ring/sierpinski-triangle-graphical.ring b/Task/Sierpinski-triangle-Graphical/Ring/sierpinski-triangle-graphical.ring new file mode 100644 index 0000000000..4884f44aeb --- /dev/null +++ b/Task/Sierpinski-triangle-Graphical/Ring/sierpinski-triangle-graphical.ring @@ -0,0 +1,44 @@ +load "guilib.ring" + +new qapp + { + win1 = new qwidget() { + setwindowtitle("drawing using qpainter") + setgeometry(100,100,500,500) + label1 = new qlabel(win1) { + setgeometry(10,10,400,400) + settext("") + } + new qpushbutton(win1) { + setgeometry(200,400,100,30) + settext("draw") + setclickevent("draw()") + } + show() + } + exec() + } + +func draw + p1 = new qpicture() + color = new qcolor() { + setrgb(0,0,255,255) + } + pen = new qpen() { + setcolor(color) + setwidth(1) + } + new qpainter() { + begin(p1) + setpen(pen) + + order = 7 + size = pow(2,order) + for y = 0 to size-1 + for x = 0 to size-1 + if (x & y)=0 drawpoint(x*2,y*2) ok + next + next + endpaint() + } + label1 { setpicture(p1) show() } diff --git a/Task/Sierpinski-triangle-Graphical/Sidef/sierpinski-triangle-graphical.sidef b/Task/Sierpinski-triangle-Graphical/Sidef/sierpinski-triangle-graphical.sidef new file mode 100644 index 0000000000..94ebd65123 --- /dev/null +++ b/Task/Sierpinski-triangle-Graphical/Sidef/sierpinski-triangle-graphical.sidef @@ -0,0 +1,35 @@ +func sierpinski_triangle(n) -> Array { + var triangle = ['*'] + { |i| + var sp = (' ' * Math.pow(2, i-1)); + triangle = (triangle.map {|x| sp + x + sp} + + triangle.map {|x| x + ' ' + x}) + } * n + triangle +} + +class Array { + method to_png(scale=1, bgcolor='white', fgcolor='black') { + + static gd = require('GD::Simple') + var width = self.max_by{.len}.len + self.map!{|r| "%-#{width}s" % r} + + var img = gd.new(width * scale, self.len * scale) + + for i in ^self { + for j in RangeNum(i*scale, i*scale + scale) { + img.moveTo(0, j) + for line in (self[i].scan(/(\s+|\S+)/)) { + img.fgcolor(line.contains(/\S/) ? fgcolor : bgcolor) + img.line(scale * line.len) + } + } + } + img.png + } +} + +var triangle = sierpinski_triangle(8) +var raw_png = triangle.to_png(bgcolor:'black', fgcolor:'red') +File('triangle.png').write(raw_png, :raw) diff --git a/Task/Sierpinski-triangle/Elm/sierpinski-triangle.elm b/Task/Sierpinski-triangle/Elm/sierpinski-triangle.elm new file mode 100644 index 0000000000..8b3628f3d5 --- /dev/null +++ b/Task/Sierpinski-triangle/Elm/sierpinski-triangle.elm @@ -0,0 +1,52 @@ +import String exposing (..) +import Html exposing (..) +import Html.Attributes as A exposing (..) +import Html.Events exposing (..) +import Html.App exposing (beginnerProgram) +import Result exposing (..) + +sierpinski : Int -> List String +sierpinski n = + let down n = sierpinski (n - 1) + space n = repeat (2 ^ (n - 1)) " " + in case n of + 0 -> ["*"] + _ -> List.map ((\st -> space n ++ st) << (\st -> st ++ space n)) (down n) + ++ List.map (join " " << List.repeat 2) (down n) + +main = beginnerProgram { model = "4", view = view, update = update } + +update newStr oldStr = newStr + +view : String -> Html String +view levelString = + div [] + ([ Html.form + [] + [ label [ myStyle ] [ text "Level: "] + , input + [ placeholder "triangle level." + , value levelString + , on "input" targetValue + , type' "number" + , A.min "0" + , myStyle + ] + [] + ] + ] ++ + [ pre [] (levelString + |> toInt + |> withDefault 0 + |> sierpinski + |> List.map (\s -> div [] [text s])) + ]) + +myStyle : Attribute msg +myStyle = + style + [ ("height", "20px") + , ("padding", "5px 0 0 5px") + , ("font-size", "1em") + , ("text-align", "left") + ] diff --git a/Task/Sierpinski-triangle/Nim/sierpinski-triangle.nim b/Task/Sierpinski-triangle/Nim/sierpinski-triangle.nim new file mode 100644 index 0000000000..0983084215 --- /dev/null +++ b/Task/Sierpinski-triangle/Nim/sierpinski-triangle.nim @@ -0,0 +1,11 @@ +const size = 1 shl 4 - 1 + +for y in countdown(size, 0): + for i in 0 .. String { + get { + var array = Array(self) + var charAtIndex = array[index] + return String(charAtIndex) + } + + set(newValue) { + var asChar = Character(newValue) + var array = Array(self) + array[index] = asChar + self = String(array) + } + } +} + +func triangle(var n:Int) { + n = 1 << n + var line = "" + var t = "" + var u = "" + + for (var i = 0; i <= 2 * n; i++) { + line += " " + } + + line[n] = "*" + + for (var i = 0; i < n; i++) { + println(line) + u = "*" + for (var j = n - i; j < n + i + 1; j++) { + t = line[j-1] == line[j + 1] ? " " : "*" + line[j - 1] = u + u = t + } + line[n + i] = t + line[n + i + 1] = "*" + } +} diff --git a/Task/Sieve-of-Eratosthenes/68000-Assembly/sieve-of-eratosthenes.68000 b/Task/Sieve-of-Eratosthenes/68000-Assembly/sieve-of-eratosthenes.68000 new file mode 100644 index 0000000000..133857dcab --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/68000-Assembly/sieve-of-eratosthenes.68000 @@ -0,0 +1,255 @@ +*----------------------------------------------------------- +* Title : BitSieve +* Written by : G. A. Tippery +* Date : 2014-Feb-24, 2013-Dec-22 +* Description: Prime number sieve +*----------------------------------------------------------- + ORG $1000 + +** ---- Generic macros ---- ** +PUSH MACRO + MOVE.L \1,-(SP) + ENDM + +POP MACRO + MOVE.L (SP)+,\1 + ENDM + +DROP MACRO + ADDQ #4,SP + ENDM + +PUTS MACRO + ** Print a null-terminated string w/o CRLF ** + ** Usage: PUTS stringaddress + ** Returns with D0, A1 modified + MOVEQ #14,D0 ; task number 14 (display null string) + LEA \1,A1 ; address of string + TRAP #15 ; display it + ENDM + +GETN MACRO + MOVEQ #4,D0 ; Read a number from the keyboard into D1.L. + TRAP #15 + ENDM + +** ---- Application-specific macros ---- ** + +val MACRO ; Used by bit sieve. Converts bit address to the number it represents. + ADD.L \1,\1 ; double it because odd numbers are omitted + ADDQ #3,\1 ; add offset because initial primes (1, 2) are omitted + ENDM + +* ** ================================================================================ ** +* ** Integer square root routine, bisection method ** +* ** IN: D0, should be 0 n) { // inverse function of sqrt is square + MOVE.L D3,D4 + MULU D4,D4 ; guess^2 + CMP.L D0,D4 + BLS .else +* b = guess; + MOVE.L D3,D2 + BRA .endif +* } else { +.else: +* a = guess; + MOVE.L D3,D1 +* } //if +.endif: +* } while ((b-a) > 1); ; Same as until (b-a)<=1 or until (a-b)>=1 + MOVE.L D2,D4 + SUB.L D1,D4 ; b-a + UNTIL.L D4 #1 DO.S +* return (a) ; Result is in D1 +* } //LongSqrt() + MOVEM.L (SP)+,D2-D4 ; restore saved registers + RTS +* +* ** ================================================================================ ** + + +** ======================================================================= ** +* +** Prime-number Sieve of Eratosthenes routine using a big bit field for flags ** +* Enter with D0 = size of sieve (bit array) +* Prints found primes 10 per line +* Returns # prime found in D6 +* +* Register usage: +* +* D0 == n +* D1 == prime +* D2 == sqroot +* D3 == PIndex +* D4 == CIndex +* D5 == MaxIndex +* D6 == PCount +* +* A0 == PMtx[0] +* +* On return, all registers above except D0 are modified. Could add MOVEMs to save and restore D2-D6/A0. +* + +** ------------------------ ** + +GetBit: ** sub-part of Sieve subroutine ** + ** Entry: bit # is on TOS + ** Exit: A6 holds the byte number, D7 holds the bit number within the byte + ** Note: Input param is still on TOS after return. Could have passed via a register, but + ** wanted to practice with stack. :) +* + MOVE.L (4,SP),D7 ; get value from (pre-call) TOS + ASR.L #3,D7 ; /8 + MOVEA D7,A6 ; byte # + MOVE.L (4,SP),D7 ; get value from (pre-call) TOS + AND.L #$7,D7 ; bit # + RTS + +** ------------------------ ** + +Sieve: + MOVE D0,D5 + SUBQ #1,D5 + JSR SquareRoot ; sqrt D0 => D1 + MOVE.L D1,D2 + LEA PArray,A0 + CLR.L D3 +* +PrimeLoop: + MOVE.L D3,D1 + val D1 + MOVE.L D3,D4 + ADD.L D1,D4 +* +CxLoop: ; Goes through array marking multiples of d1 as composite numbers + CMP.L D5,D4 + BHI ExitCx + PUSH D4 ; set D7 as bit # and A6 as byte pointer for D4'th bit of array + JSR GetBit + DROP + BSET D7,0(A0,A6.L) ; set bit to mark as composite number + ADD.L D1,D4 ; next number to mark + BRA CxLoop +ExitCx: + CLR.L D1 ; Clear new-prime-found flag + ADDQ #1,D3 ; Start just past last prime found +PxLoop: ; Searches for next unmarked (not composite) number + CMP.L D2,D3 ; no point searching past where first unmarked multiple would be past end of array + BHI ExitPx ; if past end of array + TST.L D1 + BNE ExitPx ; if flag set, new prime found + PUSH D3 ; check D3'th bit flag + JSR GetBit ; sets D7 as bit # and A6 as byte pointer + DROP ; drop TOS + BTST D7,0(A0,A6.L) ; read bit flag + BNE IsSet ; If already tagged as composite + MOVEQ #-1,D1 ; Set flag that we've found a new prime +IsSet: + ADDQ #1,D3 ; next PIndex + BRA PxLoop +ExitPx: + SUBQ #1,D3 ; back up PIndex + TST.L D1 ; Did we find a new prime #? + BNE PrimeLoop ; If another prime # found, go process it +* + ; fall through to print routine + +** ------------------------ ** + +* Print primes found +* +* D4 == Column count +* +* Print header and assumed primes (#1, #2) + PUTS Header ; Print string @ Header, no CR/LF + MOVEQ #2,D6 ; Start counter at 2 because #1 and #2 are assumed primes + MOVEQ #2,D4 +* + MOVEQ #0,D3 +PrintLoop: + CMP.L D5,D3 + BHS ExitPL + PUSH D3 + JSR GetBit ; sets D7 as bit # and A6 as byte pointer + DROP ; drop TOS + BTST D7,0(A0,A6.L) + BNE NotPrime +* printf(" %6d", val(PIndex) + MOVE.L D3,D1 + val D1 + AND.L #$0000FFFF,D1 + MOVEQ #6,D2 + MOVEQ #20,D0 ; display signed RJ + TRAP #15 + ADDQ #1,D4 + ADDQ #1,D6 +* *** Display formatting *** +* if((PCount % 10) == 0) printf("\n"); + CMP #10,D4 + BLO NoLF + PUTS CRLF + MOVEQ #0,D4 +NoLF: +NotPrime: + ADDQ #1,D3 + BRA PrintLoop +ExitPL: + RTS + +** ======================================================================= ** + +N EQU 5000 ; *** Size of boolean (bit) array *** +SizeInBytes EQU (N+7)/8 +* +START: ; first instruction of program + MOVE.L #N,D0 ; # to test + JSR Sieve +* printf("\n %d prime numbers found.\n", D6); *** + PUTS Summary1,A1 + MOVE #3,D0 ; Display signed number in D1.L in decimal in smallest field. + MOVE.W D6,D1 + TRAP #15 + PUTS Summary2,A1 + + SIMHALT ; halt simulator + +** ======================================================================= ** + +* Variables and constants here + + ORG $2000 +CR EQU 13 +LF EQU 10 +CRLF DC.B CR,LF,$00 + +PArray: DCB.B SizeInBytes,0 + +Header: DC.B CR,LF,LF,' Primes',CR,LF,' ======',CR,LF + DC.B ' 1 2',$00 + +Summary1: DC.B CR,LF,' ',$00 +Summary2: DC.B ' prime numbers found.',CR,LF,$00 + + END START ; last line of source diff --git a/Task/Sieve-of-Eratosthenes/ERRE/sieve-of-eratosthenes.erre b/Task/Sieve-of-Eratosthenes/ERRE/sieve-of-eratosthenes.erre new file mode 100644 index 0000000000..b3551ee760 --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/ERRE/sieve-of-eratosthenes.erre @@ -0,0 +1,29 @@ +PROGRAM SIEVE_ORG + ! -------------------------------------------------- + ! Eratosthenes Sieve Prime Number Program in BASIC + ! (da 3 a SIZE*2) from Byte September 1981 + !--------------------------------------------------- + CONST SIZE%=8190 + + DIM FLAGS%[SIZE%] + +BEGIN + PRINT("Only 1 iteration") + COUNT%=0 + FOR I%=0 TO SIZE% DO + IF FLAGS%[I%]=TRUE THEN + !$NULL + ELSE + PRIME%=I%+I%+3 + K%=I%+PRIME% + WHILE NOT (K%>SIZE%) DO + FLAGS%[K%]=TRUE + K%=K%+PRIME% + END WHILE + PRINT(PRIME%;) + COUNT%=COUNT%+1 + END IF + END FOR + PRINT + PRINT(COUNT%;" PRIMES") +END PROGRAM diff --git a/Task/Sieve-of-Eratosthenes/EchoLisp/sieve-of-eratosthenes-1.echolisp b/Task/Sieve-of-Eratosthenes/EchoLisp/sieve-of-eratosthenes-1.echolisp new file mode 100644 index 0000000000..3690fdd902 --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/EchoLisp/sieve-of-eratosthenes-1.echolisp @@ -0,0 +1,30 @@ +(require 'types) ;; bit-vector + +;; converts sieve->list for integers in [nmin .. nmax[ +(define (s-range sieve nmin nmax (base 0)) + (for/list ([ i (in-range nmin nmax)]) #:when (bit-vector-ref sieve i) (+ i base))) + +;; next prime in sieve > p, or #f +(define (s-next-prime sieve p ) ;; + (bit-vector-scan-1 sieve (1+ p))) + + +;; returns a bit-vector - sieve- all numbers in [0..n[ +(define (eratosthenes n) + (define primes (make-bit-vector-1 n )) + (bit-vector-set! primes 0 #f) + (bit-vector-set! primes 1 #f) + (for ([p (1+ (sqrt n))]) + #:when (bit-vector-ref primes p) + (for ([j (in-range (* p p) n p)]) + (bit-vector-set! primes j #f))) + primes) + +(define s-primes (eratosthenes 10_000_000)) + +(s-range s-primes 0 100) + → (2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97) +(s-range s-primes 1_000_000 1_000_100) + → (1000003 1000033 1000037 1000039 1000081 1000099) +(s-next-prime s-primes 9_000_000) + → 9000011 diff --git a/Task/Sieve-of-Eratosthenes/EchoLisp/sieve-of-eratosthenes-2.echolisp b/Task/Sieve-of-Eratosthenes/EchoLisp/sieve-of-eratosthenes-2.echolisp new file mode 100644 index 0000000000..a7a90f945c --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/EchoLisp/sieve-of-eratosthenes-2.echolisp @@ -0,0 +1,34 @@ +;; ref : http://research.cs.wisc.edu/techreports/1990/TR909.pdf +;; delta multiple of sqrt(n) +;; segment is [left .. left+delta-1] + + +(define (segmented sieve left delta (p 2) (first 0)) + (define segment (make-bit-vector-1 delta)) + (define right (+ left (1- delta))) + (define pmax (sqrt right)) + (while p + #:break (> p pmax) + (set! first (+ left (modulo (- p (modulo left p)) p ))) + + (for [(q (in-range first (1+ right) p))] + (bit-vector-set! segment (- q left) #f)) + (set! p (bit-vector-scan-1 sieve (1+ p)))) + segment) + +(define (seg-range nmin delta) + (s-range (segmented s-primes nmin delta) 0 delta nmin)) + + +(seg-range 10_000_000_000 1000) ;; 15 milli-sec + + → (10000000019 10000000033 10000000061 10000000069 10000000097 10000000103 10000000121 + 10000000141 10000000147 10000000207 10000000259 10000000277 10000000279 10000000319 + 10000000343 10000000391 10000000403 10000000469 10000000501 10000000537 10000000583 + 10000000589 10000000597 10000000601 10000000631 10000000643 10000000649 10000000667 + 10000000679 10000000711 10000000723 10000000741 10000000753 10000000793 10000000799 + 10000000807 10000000877 10000000883 10000000889 10000000949 10000000963 10000000991 + 10000000993 10000000999) + +;; 8 msec using the native (prime?) function +(for/list ((p (in-range 1_000_000_000 1_000_001_000))) #:when (prime? p) p) diff --git a/Task/Sieve-of-Eratosthenes/EchoLisp/sieve-of-eratosthenes-3.echolisp b/Task/Sieve-of-Eratosthenes/EchoLisp/sieve-of-eratosthenes-3.echolisp new file mode 100644 index 0000000000..f96803128c --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/EchoLisp/sieve-of-eratosthenes-3.echolisp @@ -0,0 +1,17 @@ +;; 2x3 wheel +(define (weratosthenes n) + (define primes (make-bit-vector n )) ;; everybody to #f (false) + (bit-vector-set! primes 2 #t) + (bit-vector-set! primes 3 #t) + (bit-vector-set! primes 5 #t) + + (for ([i (in-range 6 n 6) ]) ;; set candidate primes + (bit-vector-set! primes (1+ i) #t) + (bit-vector-set! primes (+ i 5) #t) + ) + + (for ([p (in-range 5 (1+ (sqrt n)) 2 ) ]) + #:when (bit-vector-ref primes p) + (for ([j (in-range (* p p) n p)]) + (bit-vector-set! primes j #f))) + primes) diff --git a/Task/Sieve-of-Eratosthenes/FreeBASIC/sieve-of-eratosthenes.freebasic b/Task/Sieve-of-Eratosthenes/FreeBASIC/sieve-of-eratosthenes.freebasic new file mode 100644 index 0000000000..8cafc4ffcb --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/FreeBASIC/sieve-of-eratosthenes.freebasic @@ -0,0 +1,39 @@ +' FB 1.05.0 + +Sub sieve(n As Integer) + If n < 2 Then Return + Dim a(2 To n) As Integer + For i As Integer = 2 To n : a(i) = i : Next + Dim As Integer p = 2, q + ' mark non-prime numbers by setting the corresponding array element to 0 + Do + For j As Integer = p * p To n Step p + a(j) = 0 + Next j + ' look for next non-zero element in array after 'p' + q = 0 + For j As Integer = p + 1 To Sqr(n) + If a(j) <> 0 Then + q = j + Exit For + End If + Next j + If q = 0 Then Exit Do + p = q + Loop + + ' print the non-zero numbers remaining i.e. the primes + For i As Integer = 2 To n + If a(i) <> 0 Then + Print Using "####"; a(i); + End If + Next + Print +End Sub + +Print "The primes up to 1000 are :" +Print +sieve(1000) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Sieve-of-Eratosthenes/FutureBasic/sieve-of-eratosthenes.futurebasic b/Task/Sieve-of-Eratosthenes/FutureBasic/sieve-of-eratosthenes.futurebasic new file mode 100644 index 0000000000..47f092f520 --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/FutureBasic/sieve-of-eratosthenes.futurebasic @@ -0,0 +1,19 @@ +include "ConsoleWindow" + +begin globals +dim dynamic gPrimes(1) as Boolean +end globals + +local fn SieveOfEratosthenes( n as long ) +dim as long i, j + +for i = 2 to n + for j = i * i to n step i + gPrimes(j) = _true + next + if gPrimes(i) = 0 then print i; +next i +kill gPrimes +end fn + +fn SieveOfEratosthenes( 100 ) diff --git a/Task/Sieve-of-Eratosthenes/JOVIAL/sieve-of-eratosthenes.jovial b/Task/Sieve-of-Eratosthenes/JOVIAL/sieve-of-eratosthenes.jovial new file mode 100644 index 0000000000..351115d625 --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/JOVIAL/sieve-of-eratosthenes.jovial @@ -0,0 +1,53 @@ +START +FILE MYOUTPUT ... $ ''Insufficient information to complete this declaration'' +PROC SIEVEE $ + '' define the sieve data structure '' + ARRAY CANDIDATES 1000 B $ + FOR I =0,1,999 $ + BEGIN + '' everything is potentially prime until proven otherwise '' + CANDIDATES($I$) = 1$ + END + '' Neither 1 nor 0 is prime, so flag them off '' + CANDIDATES($0$) = 0$ + CANDIDATES($1$) = 0$ + '' start the sieve with the integer 0 '' + FOR I = 0$ + BEGIN + IF I GE 1000$ + GOTO DONE$ + '' advance to the next un-crossed out number. '' + '' this number must be a prime '' +NEXTI. IF I LS 1000 AND Candidates($I$) EQ 0 $ + BEGIN + I = I + 1 $ + GOTO NEXTI $ + END + '' insure against running off the end of the data structure '' + IF I LT 1000 $ + BEGIN + '' cross out all multiples of the prime, starting with 2*p. '' + FOR J=2 $ + FOR K=0 $ + BEGIN + K = J * I $ + IF K GT 999 $ + GOTO ADV $ + CANDIDATES($K$) = 0 $ + J = J + 1 $ + END + '' advance to the next candidate '' +ADV. I = I + 1 $ + END + END + '' all uncrossed-out numbers are prime (and only those numbers) '' + '' print all primes '' +DONE. OPEN OUTPUT MYOUTPUT $ + FOR I=0,1,999$ + BEGIN + IF CANDIDATES($I$) NQ 0$ + BEGIN + OUTPUT MYOUTPUT I $ + END + END +TERM$ diff --git a/Task/Sieve-of-Eratosthenes/LiveCode/sieve-of-eratosthenes-1.livecode b/Task/Sieve-of-Eratosthenes/LiveCode/sieve-of-eratosthenes-1.livecode new file mode 100644 index 0000000000..83e0308966 --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/LiveCode/sieve-of-eratosthenes-1.livecode @@ -0,0 +1,22 @@ +function sieveE int + set itemdel to comma + local sieve + repeat with i = 2 to int + put i into sieve[i] + end repeat + put 2 into n + repeat while n < int + repeat with p = n to int step n + if p = n then + next repeat + else + put empty into sieve[p] + end if + end repeat + add 1 to n + end repeat + combine sieve with comma + filter items of sieve without empty + sort items of sieve ascending numeric + return sieve +end sieveE diff --git a/Task/Sieve-of-Eratosthenes/LiveCode/sieve-of-eratosthenes-2.livecode b/Task/Sieve-of-Eratosthenes/LiveCode/sieve-of-eratosthenes-2.livecode new file mode 100644 index 0000000000..24f63da073 --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/LiveCode/sieve-of-eratosthenes-2.livecode @@ -0,0 +1,2 @@ +put sieveE(121) +-- 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113 diff --git a/Task/Sieve-of-Eratosthenes/Nim/sieve-of-eratosthenes-1.nim b/Task/Sieve-of-Eratosthenes/Nim/sieve-of-eratosthenes-1.nim new file mode 100644 index 0000000000..6e604754e8 --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/Nim/sieve-of-eratosthenes-1.nim @@ -0,0 +1,23 @@ +import math + +iterator iprimes_upto(limit: int): int = + let sqrtlmt = int(sqrt float64(limit)) + var is_cmpsts = newSeq[bool](limit + 1) + is_cmpsts[0] = true; is_cmpsts[1] = true + for n in 2 .. sqrtlmt: # cull to square root of limit + if not is_cmpsts[n]: # if prime -> cull its composites + for i in countup((n *% n), limit+1, n): # start at ``n`` squared + is_cmpsts[i] = true + for n in 2 .. limit: # separate iteration over results + if not is_cmpsts[n]: + yield n + +echo("Primes are:") +for x in iprimes_upto(100): + write(stdout, x, " ") +echo "" + +var count = 0 +for p in iprimes_upto(1000000): + count += 1 +writeLine stdout, "There are ", count, " primes up to 1000000." diff --git a/Task/Sieve-of-Eratosthenes/Nim/sieve-of-eratosthenes-2.nim b/Task/Sieve-of-Eratosthenes/Nim/sieve-of-eratosthenes-2.nim new file mode 100644 index 0000000000..cad0bade6d --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/Nim/sieve-of-eratosthenes-2.nim @@ -0,0 +1,13 @@ +iterator isoe_upto(top: uint): uint = + let topndx = int((top - 3) div 2) + let sqrtndx = (int(sqrt float64(top)) - 3) div 2 + var cmpsts = newSeq[uint32](topndx div 32 + 1) + for i in 0 .. sqrtndx: # cull composites for primes + if (cmpsts[i shr 5] and (1u32 shl (i and 31))) == 0: + let p = i + i + 3 + for j in countup((p * p - 3) div 2, topndx, p): + cmpsts[j shr 5] = cmpsts[j shr 5] or (1u32 shl (j and 31)) + yield 2 # separate culling above and iteration here + for i in 0 .. topndx: + if (cmpsts[i shr 5] and (1u32 shl (i and 31))) == 0: + yield uint(i + i + 3) diff --git a/Task/Sieve-of-Eratosthenes/Oforth/sieve-of-eratosthenes.oforth b/Task/Sieve-of-Eratosthenes/Oforth/sieve-of-eratosthenes.oforth new file mode 100644 index 0000000000..190c6c428c --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/Oforth/sieve-of-eratosthenes.oforth @@ -0,0 +1,7 @@ +: eratosthenes(n) +| i j | + ListBuffer newSize(n) dup add(null) seqFrom(2, n) over addAll + 2 n sqrt asInteger for: i [ + dup at(i) ifNotNull: [ i sq n i step: j [ dup put(j, null) ] ] + ] + filter(#notNull) ; diff --git a/Task/Sieve-of-Eratosthenes/Phix/sieve-of-eratosthenes.phix b/Task/Sieve-of-Eratosthenes/Phix/sieve-of-eratosthenes.phix new file mode 100644 index 0000000000..a4dfccb624 --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/Phix/sieve-of-eratosthenes.phix @@ -0,0 +1,16 @@ +constant limit = 1000 +sequence primes = {} +sequence flags = repeat(1, limit) +for i=2 to floor(sqrt(limit)) do + if flags[i] then + for k=i*i to limit by i do + flags[k] = 0 + end for + end if +end for +for i=2 to limit do + if flags[i] then + primes &= i + end if +end for +? primes diff --git a/Task/Sieve-of-Eratosthenes/Ring/sieve-of-eratosthenes.ring b/Task/Sieve-of-Eratosthenes/Ring/sieve-of-eratosthenes.ring new file mode 100644 index 0000000000..e0e14c9e2f --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/Ring/sieve-of-eratosthenes.ring @@ -0,0 +1,8 @@ +limit = 100 +sieve = list(limit) +for i = 2 to limit + for k = i*i to limit step i + sieve[k] = 1 + next + if sieve[i] = 0 see "" + i + " " ok +next diff --git a/Task/Sieve-of-Eratosthenes/Sidef/sieve-of-eratosthenes.sidef b/Task/Sieve-of-Eratosthenes/Sidef/sieve-of-eratosthenes.sidef new file mode 100644 index 0000000000..8b37f24517 --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/Sidef/sieve-of-eratosthenes.sidef @@ -0,0 +1,15 @@ +func sieve(limit) { + var sieve_arr = [false, false, [true]*(limit-1)...] + gather { + sieve_arr.each_kv { |number, is_prime| + if (is_prime) { + take(number) + number.sqr.to(limit).by(number).each { |i| + sieve_arr[i] = false + } + } + } + } +} + +say sieve(100).join(",") diff --git a/Task/Sieve-of-Eratosthenes/Swift/sieve-of-eratosthenes.swift b/Task/Sieve-of-Eratosthenes/Swift/sieve-of-eratosthenes.swift new file mode 100644 index 0000000000..e0fb549ff1 --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/Swift/sieve-of-eratosthenes.swift @@ -0,0 +1,21 @@ +import Foundation + +func primes(n: Int) -> AnyGenerator { + + var (seive, i) = ([Int](0.. 1 + def erase(i): + if .[i] then reduce range(2; (1 + length) / i) as $j (.; .[i * $j] = false) + else . + end; + + (. + 1) as $n + | (($n|sqrt) / 2) as $s + | [null, null, range(2; $n)] + | reduce (2, 1 + (2 * range(1; $s))) as $i (.; erase($i)) + | map(select(.)); diff --git a/Task/Sieve-of-Eratosthenes/jq/sieve-of-eratosthenes-2.jq b/Task/Sieve-of-Eratosthenes/jq/sieve-of-eratosthenes-2.jq new file mode 100644 index 0000000000..e8a088c1f5 --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/jq/sieve-of-eratosthenes-2.jq @@ -0,0 +1 @@ +100 | eratosthenes diff --git a/Task/Sieve-of-Eratosthenes/jq/sieve-of-eratosthenes-3.jq b/Task/Sieve-of-Eratosthenes/jq/sieve-of-eratosthenes-3.jq new file mode 100644 index 0000000000..a75d4e1089 --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/jq/sieve-of-eratosthenes-3.jq @@ -0,0 +1 @@ +1e7 | eratosthenes | length diff --git a/Task/Simple-database/Phix/simple-database.phix b/Task/Simple-database/Phix/simple-database.phix new file mode 100644 index 0000000000..7f77d9aa95 --- /dev/null +++ b/Task/Simple-database/Phix/simple-database.phix @@ -0,0 +1,99 @@ +-- +-- demo\rosetta\Simple_db.exw +-- ========================== +-- +include timedate.e + +constant filename = getenv(iff(platform()=WINDOWS?"APPDATA":"HOME"))&"/simple_db.csv" + +procedure add(sequence cmd) + if length(cmd)=0 + or length(cmd)>2 then + printf(1,"usage: add name [cat]\n") + else + string name = cmd[1] + string cat = iff(length(cmd)=2?cmd[2]:"none") + string datestr = format_timedate(date(),"YYYY/MM/DD h:mmpm") + integer fn = open(filename,"a") + printf(fn,"%s,%s,%s\n",{name,cat,datestr}) + close(fn) + end if +end procedure + +procedure last(sequence cmd) + integer fn = open(filename,"r") + if fn=-1 then + puts(1,"file not found\n") + return + end if + integer lc = length(cmd) + string last = iff(lc?"\n":"\n") + while 1 do + object line = gets(fn) + if atom(line) then exit end if + if lc=0 or split(line,',')[2]=cmd[1] then + last = line + end if + end while + puts(1,last) + close(fn) +end procedure + +sequence dates + +function by_date(integer d1, integer d2) + return compare(dates[d1],dates[d2]) +end function +constant r_by_date = routine_id("by_date") + +procedure sort_by_date() +-- (simple_db.csv should be edited manually to prove the date sort works) + integer fn = open(filename,"r") + if fn=-1 then + puts(1,"file not found\n") + return + end if + sequence lines = {} + dates = {} + while 1 do + object line = gets(fn) + if atom(line) then exit end if + lines = append(lines,line) + dates = append(dates,split(line,',')[3]) + end while + close(fn) + sequence tags = custom_sort(r_by_date,tagset(length(lines))) + for i=1 to length(tags) do + puts(1,lines[tags[i]]) + end for +end procedure + +procedure process(sequence cmd) + switch cmd[1] do + case "add": add(cmd[2..$]) + case "last": last(cmd[2..$]) + case "sort": sort_by_date() + default: printf(1,"unknown command: %s\n",{cmd[1]}) + end switch +end procedure + +constant helptext = """ +p demo\rosetta\Simple_db -- interactive mode, commands as below +p demo\rosetta\Simple_db add name [cat] -- add entry +p demo\rosetta\Simple_db last [cat] -- show last entry [in specified category] +p demo\rosetta\Simple_db sort -- show full list sorted by date +""" +sequence cl = command_line() + if length(cl)<3 then + -- interactive mode + puts(1,helptext) + while 1 do + puts(1,">") + object line = trim(gets(0)) + if atom(line) or length(line)=0 then exit end if + puts(1,"\n") + process(split(line)) + end while + else + process(cl[3..$]) + end if diff --git a/Task/Simple-database/ToffeeScript/simple-database.toffee b/Task/Simple-database/ToffeeScript/simple-database.toffee new file mode 100644 index 0000000000..39b58b9122 --- /dev/null +++ b/Task/Simple-database/ToffeeScript/simple-database.toffee @@ -0,0 +1,85 @@ +#!/usr/local/bin/toffee + +prog = require 'commander' +fs = require 'fs-extra' + +if not fs.exists! 'data.json' + fs.outputJson! 'data.json', {} + +prog + .command('add [date]') + .description('Add a new entry') + .option('-n ', 'notes') + .option('-t ', 'tags') + .action addentry + +prog + .command('latest') + .description('Print the latest entry') + .action latest + +prog + .command('catlatest') + .description('Print the latest entry for each category') + .action catlatestout + +prog + .command('list') + .description('Print all entries sorted by date') + .action bydate + + +addentry = (name, category, dt, options) -> + if dt? then dat = new Date(dt) else dat = new Date() + update = + name: name + category: category + tags: options?.T + notes: options?.N + date: dat.getTime() + e, data = fs.readJson! 'data.json' + if not data[category]? + data[category] = [] + data[category].push update + fs.outputJson 'data.json', data + +byDateNew = (a, b) -> + if a.datea.date then return -1 + return 0 + +catlatest = (cb) -> + e, data = fs.readJson! 'data.json' + ret = [] + for cat, list of data + list.sort byDateNew + ret.push list[0] + cb ret + +printFormatted = (entry) -> + tmp = entry.date + entry.date = new Date(entry.date).toDateString() + console.log entry + entry.date = tmp + +latest = -> + newpercat = catlatest! + newpercat.sort byDateNew + printFormatted newpercat[0] + +catlatestout = -> + items = catlatest! + for item in items + printFormatted item + +bydate = -> + e, data = fs.readJson! 'data.json' + entries = [] + for cat, list of data + for item in list + entries.push item + entries.sort byDateNew + for entry in entries + printFormatted entry + +prog.parse process.argv diff --git a/Task/Simple-windowed-application/B4J/simple-windowed-application-1.b4j b/Task/Simple-windowed-application/B4J/simple-windowed-application-1.b4j new file mode 100644 index 0000000000..ccd44176fd --- /dev/null +++ b/Task/Simple-windowed-application/B4J/simple-windowed-application-1.b4j @@ -0,0 +1,33 @@ +#Region Project Attributes + #MainFormWidth: 593 + #MainFormHeight: 179 +#End Region + +Sub Process_Globals + Private fx As JFX + Private MainForm As Form + Private btnClickMe As Button + Private lblClickCounter As Label + Private nClicks As Int = 0 + Private aPlurals() As Object = Array As Object(Array As String("has","click"),Array As String("have","clicks")) +End Sub + +Sub AppStart (Form1 As Form, Args() As String) + MainForm = Form1 + MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file. + MainForm.Show +End Sub + +Sub btnClickMe_Action + nClicks = nClicks + 1 + Dim aPlural() As Object = aPlurals(IIF(nClicks=1,0,1)) + lblClickCounter.Text = "There " & aPlural(0) & " been " & (nClicks) & " " & aPlural(1) & " so far." +End Sub + +Sub IIF(test As Boolean, trueVal As Object, falseVal As Object) As Object + If test Then + Return trueVal + Else + Return falseVal + End If +End Sub diff --git a/Task/Simple-windowed-application/B4J/simple-windowed-application-2.b4j b/Task/Simple-windowed-application/B4J/simple-windowed-application-2.b4j new file mode 100644 index 0000000000..d91abac1a9 --- /dev/null +++ b/Task/Simple-windowed-application/B4J/simple-windowed-application-2.b4j @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Task/Simple-windowed-application/EchoLisp/simple-windowed-application.echolisp b/Task/Simple-windowed-application/EchoLisp/simple-windowed-application.echolisp new file mode 100644 index 0000000000..cacc35cb07 --- /dev/null +++ b/Task/Simple-windowed-application/EchoLisp/simple-windowed-application.echolisp @@ -0,0 +1,22 @@ +(define (ui-add-button text) ;; helper + (define b (ui-create-element "button" '((type "button")))) + (ui-set-html b text) + (ui-add b)) + +(define (panel ) + (ui-clear) + (define *clicks* 0) + (define text (ui-create-element "span" '((style "font-weight:bold")))) + (ui-add text) + (ui-set-html text "No click yet") + + (define btn (ui-add-button "Click-me")) + (define (count-clicks elem) + (++ *clicks*) + (ui-set-html text *clicks*)) + (ui-on-click btn count-clicks) + + (stdout-hide #t) + (stdin-hide #t)) ;; end panel definition + +(panel) diff --git a/Task/Simple-windowed-application/FreeBASIC/simple-windowed-application.freebasic b/Task/Simple-windowed-application/FreeBASIC/simple-windowed-application.freebasic new file mode 100644 index 0000000000..05558f37bc --- /dev/null +++ b/Task/Simple-windowed-application/FreeBASIC/simple-windowed-application.freebasic @@ -0,0 +1,34 @@ +#Include "windows.bi" + +Dim As HWND Window_Main, Static_Text, Button_Click +Dim As MSG msg +Dim As Integer Num_Click +Dim As String Text + +'Create a window with a static text control and a button: +Window_Main = CreateWindow("#32770", "Simple Windowed Application", WS_OVERLAPPEDWINDOW Or WS_VISIBLE, 100, 100, 350, 200, 0, 0, 0, 0) +Static_Text = CreateWindow("STATIC", "There have been no clicks yet", WS_VISIBLE Or WS_CHILD Or WS_BORDER, 10, 30, 300, 20, Window_Main, 0, 0, 0) +Button_Click = CreateWindow("BUTTON", "Click me", WS_VISIBLE Or WS_CHILD, 100, 70, 100, 20, Window_Main, 0, 0, 0) + +'Windows message loop: +Num_Click = 0 +While GetMessage(@msg, Window_Main, 0, 0) + TranslateMessage(@msg) + DispatchMessage(@msg) + Select Case msg.hwnd + Case Button_Click + If msg.message = WM_LBUTTONDOWN Then + Num_Click = Num_Click + 1 + If Num_Click = 1 Then + Text = "Button has been clicked once" + Else + Text = "Button has been clicked " + Str(Num_Click) + " times" + End If + SetWindowText(Static_Text, Text) + End If + Case Window_Main + If msg.message = WM_COMMAND Then End + End Select +Wend + +End diff --git a/Task/Simple-windowed-application/Lingo/simple-windowed-application.lingo b/Task/Simple-windowed-application/Lingo/simple-windowed-application.lingo new file mode 100644 index 0000000000..9c495500c9 --- /dev/null +++ b/Task/Simple-windowed-application/Lingo/simple-windowed-application.lingo @@ -0,0 +1,47 @@ +on startMovie + + -- window settings + _movie.stage.title = "Hello World!" + _movie.stage.titlebarOptions.visible = TRUE + _movie.stage.rect = rect(0,0,320, 240) + _movie.centerStage = 1 + + -- create a label (called "field" in Director) + m = new(#field) + m.name = "label" + m.rect = rect(0,0,320,0) + m.text = "There have been no clicks yet" + m.alignment = "center" + + -- create sprite, assign field + _movie.puppetSprite(1, TRUE) + sprite(1).member = m + sprite(1).loc = point(0,80) + + -- create a button + m = new(#button) + m.rect = rect(0,0,220,0) + m.text = "click me" + m.alignment = "center" + + -- create sprite, assign button + _movie.puppetSprite(2, TRUE) + sprite(2).member = m + sprite(2).loc = point(50,105) + + -- create new script at runtime, assign it to button sprite + m = new(#script) + m.scriptType = #score + m.scriptText = "on mouseDown"&RETURN&\ + " m=member(""E&"label""E&")"&RETURN&\ + " m.text=string(integer(m.text)+1)"&RETURN&\ + "end" + sprite(2).scriptInstanceList.add(m.script.new()) + + -- force immediate update + _movie.updateStage() + + -- show the window + _movie.stage.visible = 1 + +end diff --git a/Task/Simple-windowed-application/Nim/simple-windowed-application.nim b/Task/Simple-windowed-application/Nim/simple-windowed-application.nim new file mode 100644 index 0000000000..4f34654d2e --- /dev/null +++ b/Task/Simple-windowed-application/Nim/simple-windowed-application.nim @@ -0,0 +1,22 @@ +import gtk2 + +var + win = windowNew WINDOW_TOPLEVEL + button = buttonNew "Click me" + label = labelNew "There have been no clicks yet" + vbox = vboxNew(true, 1) + counter = 0 + +proc clickedMe(o: var PButton, l: PLabel) = + inc counter + l.setText "You clicked me " & $counter & " times" + +nim_init() +win.setTitle "Click me" +vbox.add label +vbox.add button +win.add vbox +discard win.signal_connect("delete-event", SignalFunc mainQuit, nil) +discard button.signal_connect("clicked", SignalFunc clickedMe, label) +win.showAll() +main() diff --git a/Task/Simple-windowed-application/Phix/simple-windowed-application.phix b/Task/Simple-windowed-application/Phix/simple-windowed-application.phix new file mode 100644 index 0000000000..37b157ad44 --- /dev/null +++ b/Task/Simple-windowed-application/Phix/simple-windowed-application.phix @@ -0,0 +1,18 @@ +include arwen.ew + +constant main = create(Window,"myApp",0,0,100,100,300,200, 0) +constant label = create(Label, "There have been no clicks yet",0,main,10,10,250,30,0) +constant btn = create(Button,"Click me",0,main,100,50,100,30,0) +integer count = 0 + +function mainHandler(integer id, integer msg, atom wParam, object lParam) +without warning + if id=btn and msg=WM_COMMAND then + count += 1 + setText(label,sprintf("clicked %d times",count)) + end if + return 0 +end function +setHandler(btn,routine_id("mainHandler")) + +WinMain(main,SW_NORMAL) diff --git a/Task/Simple-windowed-application/Ring/simple-windowed-application.ring b/Task/Simple-windowed-application/Ring/simple-windowed-application.ring new file mode 100644 index 0000000000..a63b7f70b9 --- /dev/null +++ b/Task/Simple-windowed-application/Ring/simple-windowed-application.ring @@ -0,0 +1,21 @@ +Load "guilib.ring" + +MyApp = New qApp { + num = 0 + win1 = new qWidget() { + setwindowtitle("Hello World") + setGeometry(100,100,370,250) + + btn1 = new qpushbutton(win1) { + setGeometry(150,200,100,30) + settext("click me") + setclickevent("clickme()")} + + Lineedit1 = new qlineedit(win1) { + setGeometry(10,100,350,30)} + show()} + Exec()} + +func clickme + num += 1 + lineedit1.settext( "you clicked me " + num + " times") diff --git a/Task/Simple-windowed-application/Sidef/simple-windowed-application.sidef b/Task/Simple-windowed-application/Sidef/simple-windowed-application.sidef new file mode 100644 index 0000000000..612174698d --- /dev/null +++ b/Task/Simple-windowed-application/Sidef/simple-windowed-application.sidef @@ -0,0 +1,27 @@ +require('Gtk2') -> init + +# Window. +var window = %s.new +window.signal_connect('destroy' => { %s.main_quit }) + +# VBox. +var vbox = %s.new(0, 0) +window.add(vbox) + +# Label. +var label = %s.new('There have been no clicks yet.') +vbox.add(label) + +# Button. +var count = 0 +var button = %s.new(' Click Me ') +vbox.add(button) +button.signal_connect('clicked' => { + label.set_text(++count) +}) + +# Show. +window.show_all + +# Main loop. +%s.main diff --git a/Task/Singleton/Lasso/singleton-1.lasso b/Task/Singleton/Lasso/singleton-1.lasso new file mode 100644 index 0000000000..fb84c7c172 --- /dev/null +++ b/Task/Singleton/Lasso/singleton-1.lasso @@ -0,0 +1,17 @@ +// Define the thread if it doesn't exist +// New definition supersede any current threads. + +not ::serverwide_singleton->istype +? define serverwide_singleton => thread { + data public switch = 'x' +} + +local( + a = serverwide_singleton, + b = serverwide_singleton, +) + +#a->switch = 'a' +#b->switch = 'b' + +#a->switch // b diff --git a/Task/Singleton/Lasso/singleton-2.lasso b/Task/Singleton/Lasso/singleton-2.lasso new file mode 100644 index 0000000000..c0aa672f7f --- /dev/null +++ b/Task/Singleton/Lasso/singleton-2.lasso @@ -0,0 +1,16 @@ +// Define thread level singleton + +define singleton => type { + data public switch = 'x' + public oncreate => var(.type)->isa(.type) ? var(.type) | var(.type) := self +} + +local( + a = singleton, + b = singleton, +) + +#a->switch = 'a' +#b->switch = 'b' + +#a->switch // b diff --git a/Task/Singleton/Lingo/singleton.lingo b/Task/Singleton/Lingo/singleton.lingo new file mode 100644 index 0000000000..b2c4ba8218 --- /dev/null +++ b/Task/Singleton/Lingo/singleton.lingo @@ -0,0 +1,22 @@ +-- parent script "SingletonDemo" + +property _instance +property _someProperty + +---------------------------------------- +-- @constructor +---------------------------------------- +on new (me) + if not voidP(me.script._instance) then return me.script._instance + me.script._instance = me + me._someProperty = 0 + return me +end + +---------------------------------------- +-- sample method +---------------------------------------- +on someMethod (me, x) + me._someProperty = me._someProperty + x + return me._someProperty +end diff --git a/Task/Singleton/Nim/singleton-1.nim b/Task/Singleton/Nim/singleton-1.nim new file mode 100644 index 0000000000..16aec6e1a3 --- /dev/null +++ b/Task/Singleton/Nim/singleton-1.nim @@ -0,0 +1,4 @@ +type Singleton = object # Singleton* would export + foo*: int + +var single* = Singleton(foo: 0) diff --git a/Task/Singleton/Nim/singleton-2.nim b/Task/Singleton/Nim/singleton-2.nim new file mode 100644 index 0000000000..0e86c424ec --- /dev/null +++ b/Task/Singleton/Nim/singleton-2.nim @@ -0,0 +1,4 @@ +import singleton + +single.foo = 12 +echo single.foo diff --git a/Task/Singleton/Oforth/singleton-1.oforth b/Task/Singleton/Oforth/singleton-1.oforth new file mode 100644 index 0000000000..9e780091d6 --- /dev/null +++ b/Task/Singleton/Oforth/singleton-1.oforth @@ -0,0 +1,6 @@ +Object Class new: Sequence(channel) +Sequence method: initialize(initialValue) + Channel newSize(1) := channel + @channel send(initialValue) drop ; + +Sequence method: nextValue @channel receive dup 1 + @channel send drop ; diff --git a/Task/Singleton/Oforth/singleton-2.oforth b/Task/Singleton/Oforth/singleton-2.oforth new file mode 100644 index 0000000000..b6811a5ef1 --- /dev/null +++ b/Task/Singleton/Oforth/singleton-2.oforth @@ -0,0 +1,6 @@ +import: parallel + +: testSequence +| s i | + Sequence new(0) ->s + 100 loop: i [ #[ s nextValue println ] & ] ; diff --git a/Task/Singleton/Sidef/singleton.sidef b/Task/Singleton/Sidef/singleton.sidef new file mode 100644 index 0000000000..433f625bca --- /dev/null +++ b/Task/Singleton/Sidef/singleton.sidef @@ -0,0 +1,21 @@ +class Singleton(name) { + static instance; + + method new(name) { + instance := Singleton.bless(Hash(:name => name)); + } + method new { + Singleton.new(nil); + } +} + +var s1 = Singleton('foo'); +say s1.name; #=> 'foo' +say s1.object_id; #=> '30424504' + +var s2 = Singleton(); +say s2.name; #=> 'foo' +say s2.object_id; #=> '30424504' + +s2.name = 'bar'; # change name in s2 +say s1.name; #=> 'bar' diff --git a/Task/Singly-linked-list-Element-definition/Axe/singly-linked-list-element-definition.axe b/Task/Singly-linked-list-Element-definition/Axe/singly-linked-list-element-definition.axe new file mode 100644 index 0000000000..b4bf9fb6fa --- /dev/null +++ b/Task/Singly-linked-list-Element-definition/Axe/singly-linked-list-element-definition.axe @@ -0,0 +1,13 @@ +Lbl LINK +r₂→{r₁}ʳ +0→{r₁+2}ʳ +r₁ +Return + +Lbl NEXT +{r₁+2}ʳ +Return + +Lbl VALUE +{r₁}ʳ +Return diff --git a/Task/Singly-linked-list-Element-definition/Nim/singly-linked-list-element-definition.nim b/Task/Singly-linked-list-Element-definition/Nim/singly-linked-list-element-definition.nim new file mode 100644 index 0000000000..d0a2e56b44 --- /dev/null +++ b/Task/Singly-linked-list-Element-definition/Nim/singly-linked-list-element-definition.nim @@ -0,0 +1,10 @@ +type Node[T] = ref object + next: Node[T] + data: T + +proc newNode[T](data: T): Node[T] = + Node[T](data: data) + +var a = newNode 12 +var b = newNode 13 +var c = newNode 14 diff --git a/Task/Singly-linked-list-Element-definition/Oforth/singly-linked-list-element-definition.oforth b/Task/Singly-linked-list-Element-definition/Oforth/singly-linked-list-element-definition.oforth new file mode 100644 index 0000000000..1ad5527e0b --- /dev/null +++ b/Task/Singly-linked-list-Element-definition/Oforth/singly-linked-list-element-definition.oforth @@ -0,0 +1 @@ +Collection Class new: LinkedList(data, mutable next) diff --git a/Task/Singly-linked-list-Element-definition/SSEM/singly-linked-list-element-definition.ssem b/Task/Singly-linked-list-Element-definition/SSEM/singly-linked-list-element-definition.ssem new file mode 100644 index 0000000000..75a4defada --- /dev/null +++ b/Task/Singly-linked-list-Element-definition/SSEM/singly-linked-list-element-definition.ssem @@ -0,0 +1,6 @@ +01000000000000000000000000000000 26. 2 +01111000000000000000000000000000 27. 30 +10000000000000000000000000000000 28. 1 +01011000000000000000000000000000 29. 26 +11000000000000000000000000000000 30. 3 +00000000000000000000000000000000 31. 0 diff --git a/Task/Singly-linked-list-Element-definition/Sidef/singly-linked-list-element-definition.sidef b/Task/Singly-linked-list-Element-definition/Sidef/singly-linked-list-element-definition.sidef new file mode 100644 index 0000000000..e8b568b27d --- /dev/null +++ b/Task/Singly-linked-list-Element-definition/Sidef/singly-linked-list-element-definition.sidef @@ -0,0 +1,6 @@ +var node = Hash.new( + data => 'say what', + next => foo_node, +); + +node{:next} = bar_node; # mutable diff --git a/Task/Singly-linked-list-Element-insertion/Axe/singly-linked-list-element-insertion.axe b/Task/Singly-linked-list-Element-insertion/Axe/singly-linked-list-element-insertion.axe new file mode 100644 index 0000000000..7ce359e4be --- /dev/null +++ b/Task/Singly-linked-list-Element-insertion/Axe/singly-linked-list-element-insertion.axe @@ -0,0 +1,5 @@ +Lbl INSERT +{r₁+2}ʳ→{r₂+2}ʳ +r₂→{r₁+2}ʳ +r₁ +Return diff --git a/Task/Singly-linked-list-Element-insertion/EchoLisp/singly-linked-list-element-insertion.echolisp b/Task/Singly-linked-list-Element-insertion/EchoLisp/singly-linked-list-element-insertion.echolisp new file mode 100644 index 0000000000..7ed3cd5d6f --- /dev/null +++ b/Task/Singly-linked-list-Element-insertion/EchoLisp/singly-linked-list-element-insertion.echolisp @@ -0,0 +1,11 @@ +(define (insert-after lst target item) + (when (null? lst) (error "cannot insert in" null)) + (let [(sub-list (member target lst))] + (if sub-list (set-cdr! sub-list (cons item (cdr sub-list))) ; make chirurgy if found + (nconc lst item)))) ; else append item + +(define L '(a b)) +(insert-after L 'a 'c) + L → (a c b) +(insert-after L 'x 'y) + L → (a c b y) diff --git a/Task/Singly-linked-list-Element-insertion/Nim/singly-linked-list-element-insertion.nim b/Task/Singly-linked-list-Element-insertion/Nim/singly-linked-list-element-insertion.nim new file mode 100644 index 0000000000..fd356d6489 --- /dev/null +++ b/Task/Singly-linked-list-Element-insertion/Nim/singly-linked-list-element-insertion.nim @@ -0,0 +1,17 @@ +type Node[T] = ref object + next: Node[T] + data: T + +proc newNode[T](data: T): Node[T] = + Node[T](data: data) + +var a = newNode 12 +var b = newNode 13 +var c = newNode 14 + +proc insertAppend(a, n: var Node) = + n.next = a.next + a.next = n + +a.insertAppend(b) +b.insertAppend(c) diff --git a/Task/Singly-linked-list-Element-insertion/Oforth/singly-linked-list-element-insertion.oforth b/Task/Singly-linked-list-Element-insertion/Oforth/singly-linked-list-element-insertion.oforth new file mode 100644 index 0000000000..9808a9ae81 --- /dev/null +++ b/Task/Singly-linked-list-Element-insertion/Oforth/singly-linked-list-element-insertion.oforth @@ -0,0 +1,16 @@ +Collection Class new: LinkedList(data, mutable next) + +LinkedList method: initialize := next := data ; +LinkedList method: data @data ; +LinkedList method: next @next ; +LinkedList method: add(e) e @next LinkedList new := next ; + +LinkedList method: forEachNext + dup ifNull: [ drop self ] + dup 1 ifEq: [ drop false return ] + dup next dup ifNull: [ drop 1 ] + swap data true ; + +: testLink LinkedList new($A, null) dup add($B) dup add($C) ; + +testLink println diff --git a/Task/Singly-linked-list-Element-insertion/Sidef/singly-linked-list-element-insertion.sidef b/Task/Singly-linked-list-Element-insertion/Sidef/singly-linked-list-element-insertion.sidef new file mode 100644 index 0000000000..e9e39c7666 --- /dev/null +++ b/Task/Singly-linked-list-Element-insertion/Sidef/singly-linked-list-element-insertion.sidef @@ -0,0 +1,18 @@ +func insert_after(a,b) { + b{:next} = a{:next}; + a{:next} = b; +} + +var B = Hash.new( + data => 3, + next => nil, # not a circular list +); +var A = Hash.new( + data => 1, + next => B, +); +var C = Hash.new( + data => 2, +); + +insert_after(A, C); diff --git a/Task/Singly-linked-list-Traversal/Axe/singly-linked-list-traversal.axe b/Task/Singly-linked-list-Traversal/Axe/singly-linked-list-traversal.axe new file mode 100644 index 0000000000..b2d54c0d72 --- /dev/null +++ b/Task/Singly-linked-list-Traversal/Axe/singly-linked-list-traversal.axe @@ -0,0 +1,12 @@ +LINK(L₁,1)→A +LINK(L₁+10,2)→B +LINK(L₁+50,3)→C + +INSERT(A,B) +INSERT(A,C) + +A→I +While I≠0 + Disp VALUE(I)▶Dec,i + NEXT(I)→I +End diff --git a/Task/Singly-linked-list-Traversal/Computer-zero-Assembly/singly-linked-list-traversal.computer b/Task/Singly-linked-list-Traversal/Computer-zero-Assembly/singly-linked-list-traversal.computer new file mode 100644 index 0000000000..7f6b5f3282 --- /dev/null +++ b/Task/Singly-linked-list-Traversal/Computer-zero-Assembly/singly-linked-list-traversal.computer @@ -0,0 +1,30 @@ +start: LDA load + ADD car ; head of list + STA ldcar + + ADD one + STA ldcdr + +ldcar: NOP + STA value + +ldcdr: NOP + BRZ done ; 0 == NIL + STA car + + JMP start + +done: LDA value + STP + +load: LDA 0 +value: 0 +car: 28 ; head of list +one: 1 + +20,21: 6, 0 +22,23: 2, 26 +24,25: 5, 20 +26,27: 3, 30 +28,29: 1, 22 +30,31: 4, 24 diff --git a/Task/Singly-linked-list-Traversal/EchoLisp/singly-linked-list-traversal.echolisp b/Task/Singly-linked-list-Traversal/EchoLisp/singly-linked-list-traversal.echolisp new file mode 100644 index 0000000000..8b5c26f89a --- /dev/null +++ b/Task/Singly-linked-list-Traversal/EchoLisp/singly-linked-list-traversal.echolisp @@ -0,0 +1,24 @@ +(define friends '( albert ludwig elvis 🌀)) + +(for-each write friends)→ albert ludwig elvis 🌀 + +; for loop +(for ((friend friends)) (write friend)) → albert ludwig elvis 🌀 + +; map a function +(map string-upcase friends) → ("ALBERT" "LUDWIG" "ELVIS" "🌀") +(map string-randcase friends) → ("ALBerT" "LudWIG" "elVis" "🌀") + +; recursive way +(define (rscan L) + (unless (null? L) + (write (first L)) + (rscan (rest L)))) + +(rscan friends) → albert ludwig elvis 🌀 + +; folding a list +; check that ∑ 1..n = n (n+1)/2 + +(define L (iota 1001)) +(foldl + 0 L) → 500500 ; 1000 * 1001 / 2 diff --git a/Task/Singly-linked-list-Traversal/Nim/singly-linked-list-traversal.nim b/Task/Singly-linked-list-Traversal/Nim/singly-linked-list-traversal.nim new file mode 100644 index 0000000000..f3b1e7f6b8 --- /dev/null +++ b/Task/Singly-linked-list-Traversal/Nim/singly-linked-list-traversal.nim @@ -0,0 +1,26 @@ +type Node[T] = ref object + next: Node[T] + data: T + +proc newNode[T](data: T): Node[T] = + Node[T](data: data) + +var a = newNode 12 +var b = newNode 13 +var c = newNode 14 + +proc insertAppend(a, n: var Node) = + n.next = a.next + a.next = n + +a.insertAppend(b) +b.insertAppend(c) + +iterator items(a: Node) = + var x = a + while x != nil: + yield x + x = x.next + +for item in a: + echo item.data diff --git a/Task/Singly-linked-list-Traversal/Oforth/singly-linked-list-traversal.oforth b/Task/Singly-linked-list-Traversal/Oforth/singly-linked-list-traversal.oforth new file mode 100644 index 0000000000..47c935f2a3 --- /dev/null +++ b/Task/Singly-linked-list-Traversal/Oforth/singly-linked-list-traversal.oforth @@ -0,0 +1,2 @@ +: testLink LinkedList new($A, null) dup add($B) dup add($C) ; +testLink apply(#println) diff --git a/Task/Singly-linked-list-Traversal/Peloton/singly-linked-list-traversal-1.peloton b/Task/Singly-linked-list-Traversal/Peloton/singly-linked-list-traversal-1.peloton new file mode 100644 index 0000000000..b003100f7f --- /dev/null +++ b/Task/Singly-linked-list-Traversal/Peloton/singly-linked-list-traversal-1.peloton @@ -0,0 +1,9 @@ +<@ LETCNSLSTLIT>public holidays|開國紀念日^和平紀念日^婦女節、兒童節合併假期^清明節^國慶日^春節^端午節^中秋節^農曆除夕 +<@ OMT>From First to Last +<@ ITEFORSZELSTLIT>public holidays| +<@ SAYLST>...<@ ACTMOVFWDLST>... + +<@ OMT>From Last to First (pointer is still at end of list) +<@ ITEFORSZELSTLIT>public holidays| +<@ SAYLST>...<@ ACTMOVBKWLST>... + diff --git a/Task/Singly-linked-list-Traversal/Peloton/singly-linked-list-traversal-2.peloton b/Task/Singly-linked-list-Traversal/Peloton/singly-linked-list-traversal-2.peloton new file mode 100644 index 0000000000..ca6946a25b --- /dev/null +++ b/Task/Singly-linked-list-Traversal/Peloton/singly-linked-list-traversal-2.peloton @@ -0,0 +1,9 @@ +<# 指定构造列表字串>public holidays|開國紀念日^和平紀念日^婦女節、兒童節合併假期^清明節^國慶日^春節^端午節^中秋節^農曆除夕 +<# 忽略>From First to Last +<# 迭代迭代次数结构大小列表字串>public holidays| +<# 显示列表>...<# 运行移位指针向前列表>... + +<# 忽略>From Last to First (pointer is still at end of list) +<# 迭代迭代次数结构大小列表字串>public holidays| +<# 显示列表>...<# 运行移位指针向后列表>... + diff --git a/Task/Singly-linked-list-Traversal/SSEM/singly-linked-list-traversal.ssem b/Task/Singly-linked-list-Traversal/SSEM/singly-linked-list-traversal.ssem new file mode 100644 index 0000000000..548552bec1 --- /dev/null +++ b/Task/Singly-linked-list-Traversal/SSEM/singly-linked-list-traversal.ssem @@ -0,0 +1,32 @@ +11101000000000100000000000000000 0. -23 to c +10011000000000010000000000000000 1. Sub. 25 +10010000000001100000000000000000 2. c to 9 +10101000000000010000000000000000 3. Sub. 21 +11010000000001100000000000000000 4. c to 11 +10010000000000100000000000000000 5. -9 to c +10010000000001100000000000000000 6. c to 9 +11010000000000100000000000000000 7. -11 to c +11010000000001100000000000000000 8. c to 11 +00000000000000000000000000000000 9. to be generated at run time +00101000000001100000000000000000 10. c to 20 +00000000000000000000000000000000 11. to be generated at run time +00000000000000110000000000000000 12. Test +00011000000000000000000000000000 13. 24 to CI +10011000000001100000000000000000 14. c to 25 +10011000000000100000000000000000 15. -25 to c +10011000000001100000000000000000 16. c to 25 +01101000000000000000000000000000 17. 22 to CI +00101000000000100000000000000000 18. -20 to c +00000000000001110000000000000000 19. Stop +00000000000000000000000000000000 20. variable: negation of car +10000000000000000000000000000000 21. constant 1 +11111111111111111111111111111111 22. constant -1 +00000000000000100000000000000000 23. -0 to c +10001000000000000000000000000000 24. constant 17 (jump target) +00111000000000000000000000000000 25. 28 (pointer variable) +01000000000000000000000000000000 26. 2 +01111000000000000000000000000000 27. pointer: 30 +10000000000000000000000000000000 28. 1 +01011000000000000000000000000000 29. pointer: 26 +11000000000000000000000000000000 30. 3 +00000000000000000000000000000000 31. 0 (nil) diff --git a/Task/Singly-linked-list-Traversal/Sidef/singly-linked-list-traversal.sidef b/Task/Singly-linked-list-Traversal/Sidef/singly-linked-list-traversal.sidef new file mode 100644 index 0000000000..dc2bc319cf --- /dev/null +++ b/Task/Singly-linked-list-Traversal/Sidef/singly-linked-list-traversal.sidef @@ -0,0 +1,7 @@ +var list = 'a':'b':'c':nil; +#var list = ['a', ['b', ['c']]]; +#var list = Pair.new('a', Pair.new('b', Pair.new('c', nil))); + +for (var l = list; l != nil; l = l[1]) { + say l[0]; +} diff --git a/Task/Singly-linked-list-Traversal/Wart/singly-linked-list-traversal.wart b/Task/Singly-linked-list-Traversal/Wart/singly-linked-list-traversal.wart new file mode 100644 index 0000000000..6d226338ee --- /dev/null +++ b/Task/Singly-linked-list-Traversal/Wart/singly-linked-list-traversal.wart @@ -0,0 +1,2 @@ +each x '(1 2 3) + prn x diff --git a/Task/Singly-linked-list-Traversal/jq/singly-linked-list-traversal.jq b/Task/Singly-linked-list-Traversal/jq/singly-linked-list-traversal.jq new file mode 100644 index 0000000000..129cc7bf4a --- /dev/null +++ b/Task/Singly-linked-list-Traversal/jq/singly-linked-list-traversal.jq @@ -0,0 +1,2 @@ +def test_list: + { "car": 1, "cdr": { "car": 2, "cdr": { "car": 3, "cdr": null }}}; diff --git a/Task/Sleep/8051-Assembly/sleep.8051 b/Task/Sleep/8051-Assembly/sleep.8051 new file mode 100644 index 0000000000..a85a1366ef --- /dev/null +++ b/Task/Sleep/8051-Assembly/sleep.8051 @@ -0,0 +1,23 @@ +ORG RESET + jmp main +ORG TIMER0 + ; timer interrupt only used to wake the processor + clr tr0 + reti + +main: + setb ea ; enable interrupts + setb et0 ; enable timer0 interrupt + mov tl0, #0 ; start timer counter at zero + mov th0, #0 ; these two values dictate the length of sleep + + mov a, pcon ; copy power control register + setb a.0 ; set idl bit + setb tr0 ; start timer + ; sleeping... + mov pcon, a ; move a back into pcon (processor sleeps after this instruction finishes) + + ; when the timer overflows and the timer interrupt returns, execution will resume at this spot + + ; Awake! + jmp $ diff --git a/Task/Sleep/8th/sleep.8th b/Task/Sleep/8th/sleep.8th new file mode 100644 index 0000000000..6f008ae06d --- /dev/null +++ b/Task/Sleep/8th/sleep.8th @@ -0,0 +1,4 @@ +f:stdin f:getline +"Sleeping..." . cr +eval sleep +"Awake!" . cr bye diff --git a/Task/Sleep/AntLang/sleep.antlang b/Task/Sleep/AntLang/sleep.antlang new file mode 100644 index 0000000000..287d989467 --- /dev/null +++ b/Task/Sleep/AntLang/sleep.antlang @@ -0,0 +1,4 @@ +milliseconds: eval[input["How long should I sleep? "]] / eval = evil, but this is just a simple demo +echo["Sleeping..."] +sleep[milliseconds] +echo["Awake!"] diff --git a/Task/Sleep/Axe/sleep.axe b/Task/Sleep/Axe/sleep.axe new file mode 100644 index 0000000000..83b054854f --- /dev/null +++ b/Task/Sleep/Axe/sleep.axe @@ -0,0 +1,15 @@ +Disp "TIME:" +input→A +0→T +length(A)→L +For(I,1,L) + If {A}<'0' or {A}>'9' + Disp "NOT A NUMBER",i + Return + End + T*10+{A}-'0'→T + A++ +End +Disp "SLEEPING...",i +Pause T +Disp "AWAKE",i diff --git a/Task/Sleep/ERRE/sleep.erre b/Task/Sleep/ERRE/sleep.erre new file mode 100644 index 0000000000..eab499e0a6 --- /dev/null +++ b/Task/Sleep/ERRE/sleep.erre @@ -0,0 +1,6 @@ + .............. + INPUT("Enter the time to sleep in seconds: ";sleep) + PRINT("Sleeping...") + PAUSE(sleep) + PRINT("Awake!") + .............. diff --git a/Task/Sleep/FreeBASIC/sleep.freebasic b/Task/Sleep/FreeBASIC/sleep.freebasic new file mode 100644 index 0000000000..2d024875d0 --- /dev/null +++ b/Task/Sleep/FreeBASIC/sleep.freebasic @@ -0,0 +1,8 @@ +' FB 1.05.0 Win64 + +Dim ms As UInteger +Input "Enter number of milliseconds to sleep" ; ms +Print "Sleeping..." +Sleep ms, 1 '' the "1" means Sleep can't be interrupted with a keystroke +Print "Awake!" +End diff --git a/Task/Sleep/Lasso/sleep.lasso b/Task/Sleep/Lasso/sleep.lasso new file mode 100644 index 0000000000..9ab3847262 --- /dev/null +++ b/Task/Sleep/Lasso/sleep.lasso @@ -0,0 +1,3 @@ +stdoutnl('Sleeping...') +sleep(5000) // Sleep 5 seconds +stdoutnl('Awake!') diff --git a/Task/Sleep/Lingo/sleep.lingo b/Task/Sleep/Lingo/sleep.lingo new file mode 100644 index 0000000000..200cebf313 --- /dev/null +++ b/Task/Sleep/Lingo/sleep.lingo @@ -0,0 +1,5 @@ +on doSleep (ms) + put "Sleeping..." + sleep(ms) + put "Awake!" +end diff --git a/Task/Sleep/Nim/sleep.nim b/Task/Sleep/Nim/sleep.nim new file mode 100644 index 0000000000..0d8ac6ff22 --- /dev/null +++ b/Task/Sleep/Nim/sleep.nim @@ -0,0 +1,7 @@ +import os, strutils + +echo("Enter how long I should sleep (in milliseconds):") +var timed = parseInt(readLine(stdin).string) +echo("Sleeping...") +sleep(timed) +echo("Awake!") diff --git a/Task/Sleep/Oforth/sleep.oforth b/Task/Sleep/Oforth/sleep.oforth new file mode 100644 index 0000000000..4f263ada04 --- /dev/null +++ b/Task/Sleep/Oforth/sleep.oforth @@ -0,0 +1 @@ + : sleepMilli(n) "Sleeping..." . n sleep "Awake!" println ; diff --git a/Task/Sleep/Peloton/sleep-1.peloton b/Task/Sleep/Peloton/sleep-1.peloton new file mode 100644 index 0000000000..dfad53e3de --- /dev/null +++ b/Task/Sleep/Peloton/sleep-1.peloton @@ -0,0 +1,4 @@ +<@ SAYLIT>Number of seconds: <@ GETVAR>secs +<@ SAYLIT>Sleeping +<@ ACTPAUVAR>secs +<@ SAYLIT>Awake diff --git a/Task/Sleep/Peloton/sleep-2.peloton b/Task/Sleep/Peloton/sleep-2.peloton new file mode 100644 index 0000000000..230d2650cd --- /dev/null +++ b/Task/Sleep/Peloton/sleep-2.peloton @@ -0,0 +1,4 @@ +<# MontrezLittéralement>Number of seconds: <# PrenezUneValeurVariable>secs +<# MontrezLittéralement>Sleeping +<# AgissezFaireUnePauseVariable>secs +<# MontrezLittéralement>Awake diff --git a/Task/Sleep/Peloton/sleep-3.peloton b/Task/Sleep/Peloton/sleep-3.peloton new file mode 100644 index 0000000000..e4c71629d0 --- /dev/null +++ b/Task/Sleep/Peloton/sleep-3.peloton @@ -0,0 +1,4 @@ +<@ 显示_字串_>Number of seconds: <@ 获取_变量_>secs +<@ 显示_字串_>Sleeping +<@ 运行_暂停动变量_>secs +<@ 显示_字串_>Awake diff --git a/Task/Sleep/Phix/sleep.phix b/Task/Sleep/Phix/sleep.phix new file mode 100644 index 0000000000..901c797daf --- /dev/null +++ b/Task/Sleep/Phix/sleep.phix @@ -0,0 +1,4 @@ +atom a = prompt_number("wait for duration (in seconds, 0..20):", {0,20}) +puts(1,"Sleeping...\n") +sleep(a) +puts(1,"Awake!\n") diff --git a/Task/Sleep/Ring/sleep.ring b/Task/Sleep/Ring/sleep.ring new file mode 100644 index 0000000000..58bec22b9d --- /dev/null +++ b/Task/Sleep/Ring/sleep.ring @@ -0,0 +1,12 @@ +load "guilib.ring" + +for n = 1 to 10 + Sleep(3) + see "" + n + " " +next +see nl + +func Sleep x + nTime = x * 1000 + oTest = new qTest + oTest.qsleep(nTime) diff --git a/Task/Sleep/Sidef/sleep.sidef b/Task/Sleep/Sidef/sleep.sidef new file mode 100644 index 0000000000..d6d6209f93 --- /dev/null +++ b/Task/Sleep/Sidef/sleep.sidef @@ -0,0 +1,6 @@ +var sec = read(Number); # any positive number (it may be fractional) +say "Sleeping..."; +Sys.sleep(sec); # in seconds +#Sys.usleep(sec); # in microseconds +#Sys.nanosleep(sec); # in nanoseconds +say "Awake!"; diff --git a/Task/Sleep/Swift/sleep.swift b/Task/Sleep/Swift/sleep.swift new file mode 100644 index 0000000000..fa5460f1f8 --- /dev/null +++ b/Task/Sleep/Swift/sleep.swift @@ -0,0 +1,10 @@ +import Foundation + +println("Enter number of seconds to sleep") +let input = NSFileHandle.fileHandleWithStandardInput() +var amount = NSString(data:input.availableData, encoding: NSUTF8StringEncoding)?.intValue +var interval = NSTimeInterval(amount!) +println("Sleeping...") +NSThread.sleepForTimeInterval(interval) + +println("Awake!") diff --git a/Task/Sleep/Ursa/sleep.ursa b/Task/Sleep/Ursa/sleep.ursa new file mode 100644 index 0000000000..12521a2aa7 --- /dev/null +++ b/Task/Sleep/Ursa/sleep.ursa @@ -0,0 +1,4 @@ +out "Sleeping..." endl console +# sleep for 5 seconds (5000 milliseconds) +sleep 5000 +out "Awake!" endl console diff --git a/Task/Sockets/Lasso/sockets.lasso b/Task/Sockets/Lasso/sockets.lasso new file mode 100644 index 0000000000..96deeb1b74 --- /dev/null +++ b/Task/Sockets/Lasso/sockets.lasso @@ -0,0 +1,5 @@ +local(net) = net_tcp +#net->connect('127.0.0.1',256) +#net->dowithclose => { + #net->writestring('Hello World') +} diff --git a/Task/Sockets/Nim/sockets.nim b/Task/Sockets/Nim/sockets.nim new file mode 100644 index 0000000000..e9d28b74aa --- /dev/null +++ b/Task/Sockets/Nim/sockets.nim @@ -0,0 +1,6 @@ +import net + +var s = newSocket() +s.connect("localhost", Port(256)) +s.send("Hello Socket World") +s.close() diff --git a/Task/Sockets/Ring/sockets.ring b/Task/Sockets/Ring/sockets.ring new file mode 100644 index 0000000000..6f35c6a2cd --- /dev/null +++ b/Task/Sockets/Ring/sockets.ring @@ -0,0 +1,40 @@ +Load "guilib.ring" + +new qApp { + oClient = new Client { client() } + exec() +} + +Class Client + + win1 oTcpSocket + + func client + + win1 = new qwidget() + + new qpushbutton(win1) { + setgeometry(50,50,100,30) + settext("connect") + setclickevent("oClient.Connect()") + } + + win1 { + setwindowtitle("client") + setgeometry(10,100,400,400) + show() + } + + func connect + oTcpSocket = new qTcpSocket(win1) { + setconnectedevent("oClient.pConnected()") + connecttohost("127.0.0.1",256,3,0) + waitforconnected(5000) + } + + func pConnected + cStr = "hello socket world" + write(cStr,len(cStr)) + flush() + waitforbyteswritten(300000) + close() diff --git a/Task/Sockets/Sidef/sockets.sidef b/Task/Sockets/Sidef/sockets.sidef new file mode 100644 index 0000000000..495d731c21 --- /dev/null +++ b/Task/Sockets/Sidef/sockets.sidef @@ -0,0 +1,8 @@ +var host = Socket.gethostbyname('localhost'); +var in = Socket.sockaddr_in(256, host); +var proto = Socket.getprotobyname('tcp'); + +var sock = Socket.open(Socket.AF_INET, Socket.SOCK_STREAM, proto); +sock.connect(in); +sock.send('hello socket world', 0, in); +sock.close; diff --git a/Task/Sockets/Symsyn/sockets.symsyn b/Task/Sockets/Symsyn/sockets.symsyn new file mode 100644 index 0000000000..2777cc5584 --- /dev/null +++ b/Task/Sockets/Symsyn/sockets.symsyn @@ -0,0 +1,4 @@ + '127.0.0.1' $addr + connect $addr 256 sok + 'hello socket world' [sok] + close sok diff --git a/Task/Solve-a-Hidato-puzzle/Nim/solve-a-hidato-puzzle.nim b/Task/Solve-a-Hidato-puzzle/Nim/solve-a-hidato-puzzle.nim new file mode 100644 index 0000000000..2fe05b5207 --- /dev/null +++ b/Task/Solve-a-Hidato-puzzle/Nim/solve-a-hidato-puzzle.nim @@ -0,0 +1,80 @@ +import strutils, algorithm + +var board: array[0..19, array[0..19, int]] +var given, start: seq[int] = @[] +var rows, cols: int = 0 + +proc setup(s: string) = + var lines = s.splitLines() + cols = lines[0].split().len() + rows = lines.len() + + for i in 0 .. rows + 1: + for j in 0 .. cols + 1: + board[i][j] = -1 + + for r, row in pairs(lines): + for c, cell in pairs(row.split()): + case cell + of "__" : + board[r + 1][c + 1] = 0 + continue + of "." : continue + else : + var val = parseInt(cell) + board[r + 1][c + 1] = val + given.add(val) + if (val == 1): + start.add(r + 1) + start.add(c + 1) + given.sort(cmp[int], Ascending) + +proc solve(r, c, n: int, next: int = 0): bool = + if n > given[high(given)]: + return true + if board[r][c] < 0: + return false + if (board[r][c] > 0 and board[r][c] != n): + return false + if (board[r][c] == 0 and given[next] == n): + return false + + var back = board[r][c] + board[r][c] = n + for i in -1 .. 1: + for j in -1 .. 1: + if back == n: + if (solve(r + i, c + j, n + 1, next + 1)): return true + else: + if (solve(r + i, c + j, n + 1, next)): return true + board[r][c] = back + result = false + + +proc printBoard() = + for r in 0 .. rows + 1: + for cellid,c in pairs(board[r]): + if cellid > cols + 1: break + if c == -1: + write(stdout, " . ") + elif c == 0: + write(stdout, "__ ") + else: + write(stdout, "$# " % align($c,2)) + writeLine(stdout, "") + +var hi: string = """__ 33 35 __ __ . . . +__ __ 24 22 __ . . . +__ __ __ 21 __ __ . . +__ 26 __ 13 40 11 . . +27 __ __ __ 9 __ 1 . +. . __ __ 18 __ __ . +. . . . __ 7 __ __ +. . . . . . 5 __""" + +setup(hi) +printBoard() +echo("") +echo("Found:") +discard solve(start[0], start[1], 1) +printBoard() diff --git a/Task/Solve-a-Hidato-puzzle/Phix/solve-a-hidato-puzzle.phix b/Task/Solve-a-Hidato-puzzle/Phix/solve-a-hidato-puzzle.phix new file mode 100644 index 0000000000..a82de5eba7 --- /dev/null +++ b/Task/Solve-a-Hidato-puzzle/Phix/solve-a-hidato-puzzle.phix @@ -0,0 +1,174 @@ +sequence board, warnsdorffs, knownx, knowny + +integer width, height, limit, nchars, tries +string fmt, blank + +constant ROW = 1, COL = 2 +constant moves = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}} + +function onboard(integer row, integer col) + return row>=1 and row<=height and col>=nchars and col<=nchars*width +end function + +procedure init_warnsdorffs() +integer nrow,ncol + for row=1 to height do + for col=nchars to nchars*width by nchars do + for move=1 to length(moves) do + nrow = row+moves[move][ROW] + ncol = col+moves[move][COL]*nchars + if onboard(nrow,ncol) + and board[nrow][ncol]='_' then + warnsdorffs[nrow][ncol] += 1 + end if + end for + end for + end for +end procedure + +function solve(integer row, integer col, integer n) +integer nrow, ncol + tries+= 1 + if n>limit then return 1 end if + if knownx[n] then + for move=1 to length(moves) do + nrow = row+moves[move][ROW] + ncol = col+moves[move][COL]*nchars + if nrow = knownx[n] + and ncol = knowny[n] then + if solve(nrow,ncol,n+1) then return 1 end if + exit + end if + end for + return 0 + end if + sequence wmoves = {} + for move=1 to length(moves) do + nrow = row+moves[move][ROW] + ncol = col+moves[move][COL]*nchars + if onboard(nrow,ncol) + and board[nrow][ncol]='_' then + wmoves = append(wmoves,{warnsdorffs[nrow][ncol],nrow,ncol}) + end if + end for + wmoves = sort(wmoves) + -- avoid creating orphans + if length(wmoves)<2 or wmoves[2][1]>1 then + for m=1 to length(wmoves) do + {?,nrow,ncol} = wmoves[m] + warnsdorffs[nrow][ncol] -= 1 + end for + for m=1 to length(wmoves) do + {?,nrow,ncol} = wmoves[m] + board[nrow][ncol-nchars+1..ncol] = sprintf(fmt,n) + if solve(nrow,ncol,n+1) then return 1 end if + board[nrow][ncol-nchars+1..ncol] = blank + end for + for m=1 to length(wmoves) do + {?,nrow,ncol} = wmoves[m] + warnsdorffs[nrow][ncol] += 1 + end for + end if + return 0 +end function + +procedure Hidato(sequence s, integer w, integer h, integer lim) +integer y, ch, ch2, k +atom t0 = time() + s = split(s,'\n') + width = w + height = h + nchars = length(sprintf(" %d",lim)) + fmt = sprintf(" %%%dd",nchars-1) + blank = repeat('_',nchars) + board = repeat(repeat(' ',width*nchars),height) + knownx = repeat(0,lim) + knowny = repeat(0,lim) + limit = 0 + for x=1 to height do + for y=nchars to width*nchars by nchars do + if y>length(s[x]) then + ch = '.' + else + ch = s[x][y] + end if + if ch='_' then + limit += 1 + elsif ch!='.' then + k = ch-'0' + ch2 = s[x][y-1] + if ch2!=' ' then + k += (ch2-'0')*10 + board[x][y-1] = ch2 + end if + knownx[k] = x + knowny[k] = y + limit += 1 + end if + board[x][y] = ch + end for + end for + warnsdorffs = repeat(repeat(0,width*nchars),height) + init_warnsdorffs() + tries = 0 + if solve(knownx[1],knowny[1],2) then + puts(1,join(board,"\n")) + printf(1,"\nsolution found in %d tries (%3.2fs)\n",{tries,time()-t0}) + else + puts(1,"no solutions found\n") + end if +end procedure + +constant board1 = """ + __ 33 35 __ __ .. .. .. + __ __ 24 22 __ .. .. .. + __ __ __ 21 __ __ .. .. + __ 26 __ 13 40 11 .. .. + 27 __ __ __ 9 __ 1 .. + .. .. __ __ 18 __ __ .. + .. .. .. .. __ 7 __ __ + .. .. .. .. .. .. 5 __""" +Hidato(board1,8,8,40) + +constant board2 = """ + . 4 . + _ 7 _ + 1 _ _""" +Hidato(board2,3,3,7) + +constant board3 = """ + 1 _ _ . . _ _ . . _ _ . . _ _ . . _ _ . . _ _ . . _ _ . . _ _ . . _ _ . . _ _ . . _ _ . . _ _ . . 74 + . . _ . _ . _ . _ . _ . _ . _ . _ . _ . _ . _ . _ . _ . _ . _ . _ . _ . _ . _ . _ . _ . _ . _ . _ . + . . . _ _ . . _ _ . . _ _ . . _ _ . . _ _ . . _ _ . . _ _ . . _ _ . . _ _ . . _ _ . . _ _ . . _ _ .""" +Hidato(board3,50,3,74) + +constant board4 = """ + 54 __ 60 59 __ 67 __ 69 __ + __ 55 __ __ 63 65 __ 72 71 + 51 50 56 62 __ .. .. .. .. + __ __ __ 14 .. .. 17 __ .. + 48 10 11 .. 15 __ 18 __ 22 + __ 46 __ .. 3 __ 19 23 __ + __ 44 __ 5 __ 1 33 32 __ + __ 43 7 __ 36 __ 27 __ 31 + 42 __ __ 38 __ 35 28 __ 30""" +Hidato(board4,9,9,72) + +constant board5 = """ + __ 58 __ 60 __ __ 63 66 __ + 57 55 59 53 49 __ 65 __ 68 + __ 8 __ __ 50 __ 46 45 __ + 10 6 __ .. .. .. __ 43 70 + __ 11 12 .. .. .. 72 71 __ + __ 14 __ .. .. .. 30 39 __ + 15 3 17 __ 28 29 __ __ 40 + __ __ 19 22 __ __ 37 36 __ + 1 20 __ 24 __ 26 __ 34 33""" +Hidato(board5,9,9,72) + +constant board6 = """ + 1 __ .. .. .. __ __ .. .. .. __ __ .. .. .. __ __ .. .. .. __ __ .. .. .. __ __ .. .. .. __ __ .. .. .. __ __ .. .. .. __ __ .. .. .. 82 + .. .. __ .. __ .. .. __ .. __ .. .. __ .. __ .. .. __ .. __ .. .. __ .. __ .. .. __ .. __ .. .. __ .. __ .. .. __ .. __ .. .. __ .. __ .. + .. __ .. __ .. .. __ .. __ .. .. __ .. __ .. .. __ .. __ .. .. __ .. __ .. .. __ .. __ .. .. __ .. __ .. .. __ .. __ .. .. __ .. __ .. .. + __ __ __ .. .. __ __ __ .. .. __ __ __ .. .. __ __ __ .. .. __ __ __ .. .. __ __ __ .. .. __ __ __ .. .. __ __ __ .. .. __ __ __ .. .. ..""" +Hidato(board6,46,4,82) diff --git a/Task/Solve-a-Holy-Knights-tour/Phix/solve-a-holy-knights-tour.phix b/Task/Solve-a-Holy-Knights-tour/Phix/solve-a-holy-knights-tour.phix new file mode 100644 index 0000000000..97c9ebd572 --- /dev/null +++ b/Task/Solve-a-Holy-Knights-tour/Phix/solve-a-holy-knights-tour.phix @@ -0,0 +1,147 @@ +sequence board, warnsdorffs + +integer size, limit, nchars +string fmt, blank + +constant ROW = 1, COL = 2 +constant moves = {{-1,-2},{-2,-1},{-2,1},{-1,2},{1,2},{2,1},{2,-1},{1,-2}} + +function onboard(integer row, integer col) + return row>=1 and row<=size and col>=nchars and col<=nchars*size +end function + +procedure init_warnsdorffs() +integer nrow,ncol + for row=1 to size do + for col=nchars to nchars*size by nchars do + for move=1 to length(moves) do + nrow = row+moves[move][ROW] + ncol = col+moves[move][COL]*nchars + if onboard(nrow,ncol) then + -- (either of these would work) + warnsdorffs[row][col] += 1 +-- warnsdorffs[nrow][ncol] += 1 + end if + end for + end for + end for +end procedure + +atom t0 = time() +integer tries = 0, backtracks = 0 +atom t1 = time()+1 +function solve(integer row, integer col, integer n) +integer nrow, ncol + if time()>t1 then + ?{row,floor(col/nchars),n,tries} + puts(1,join(board,"\n")) + t1 = time()+1 +-- if wait_key()='!' then ?9/0 end if + end if + tries+= 1 + if n>limit then return 1 end if + sequence wmoves = {} + for move=1 to length(moves) do + nrow = row+moves[move][ROW] + ncol = col+moves[move][COL]*nchars + if onboard(nrow,ncol) + and board[nrow][ncol]=' ' then + wmoves = append(wmoves,{warnsdorffs[nrow][ncol],nrow,ncol}) + end if + end for + wmoves = sort(wmoves) + -- avoid creating orphans + if length(wmoves)<2 or wmoves[2][1]>1 then + for m=1 to length(wmoves) do + {?,nrow,ncol} = wmoves[m] + warnsdorffs[nrow][ncol] -= 1 + end for + for m=1 to length(wmoves) do + {?,nrow,ncol} = wmoves[m] + board[nrow][ncol-nchars+1..ncol] = sprintf(fmt,n) + if solve(nrow,ncol,n+1) then return 1 end if + backtracks += 1 + board[nrow][ncol-nchars+1..ncol] = blank + end for + for m=1 to length(wmoves) do + {?,nrow,ncol} = wmoves[m] + warnsdorffs[nrow][ncol] += 1 + end for + end if + return 0 +end function + +procedure holyknight(sequence s) +integer y, ch, sx, sy + s = split(s,'\n') + size = length(s) + nchars = length(sprintf(" %d",size*size)) + fmt = sprintf(" %%%dd",nchars-1) + blank = repeat(' ',nchars) + board = repeat(repeat(' ',size*nchars),size) + limit = 1 + for x=1 to size do + y = nchars + for j=1 to size do + if j>length(s[x]) then + ch = '-' + else + ch = s[x][j] + end if + if ch=' ' then + ch = '-' + elsif ch='0' then + ch = ' ' + limit += 1 + elsif ch='1' then + sx = x + sy = y + end if + board[x][y] = ch + y += nchars + end for + end for + warnsdorffs = repeat(repeat(0,size*nchars),size) + init_warnsdorffs() + t0 = time() + tries = 0 + backtracks = 0 + t1 = time()+1 + if solve(sx,sy,2) then + puts(1,join(board,"\n")) + printf(1,"\nsolution found in %d tries, %d backtracks (%3.2fs)\n",{tries,backtracks,time()-t0}) + else + puts(1,"no solutions found\n") + end if +end procedure + +constant board1 = """ + 000 + 0 00 + 0000000 +000 0 0 +0 0 000 +1000000 + 00 0 + 000""" + +holyknight(board1) + +constant board2 = """ +-----1-0----- +-----0-0----- +----00000---- +-----000----- +--0--0-0--0-- +00000---00000 +--00-----00-- +00000---00000 +--0--0-0--0-- +-----000----- +----00000---- +-----0-0----- +-----0-0-----""" + +holyknight(board2) + +{} = wait_key() diff --git a/Task/Solve-a-Hopido-puzzle/Phix/solve-a-hopido-puzzle.phix b/Task/Solve-a-Hopido-puzzle/Phix/solve-a-hopido-puzzle.phix new file mode 100644 index 0000000000..d34629cd72 --- /dev/null +++ b/Task/Solve-a-Hopido-puzzle/Phix/solve-a-hopido-puzzle.phix @@ -0,0 +1,61 @@ +sequence board + +integer limit, tries + +constant ROW = 1, COL = 2 +constant moves = {{-2,-2},{-2,2},{2,-2},{2,2},{-3,0},{3,0},{0,-3},{0,3}} + +function solve(integer row, integer col, integer n) +integer nrow, ncol + tries+= 1 + if n>limit then return 1 end if + for move=1 to length(moves) do + nrow = row+moves[move][ROW] + ncol = col+moves[move][COL]*3 + if nrow>=1 and nrow<=length(board) + and ncol>=1 and ncol<=length(board[row]) + and board[nrow][ncol]=' ' then + board[nrow][ncol-1..ncol] = sprintf("%2d",n) + if solve(nrow,ncol,n+1) then return 1 end if + board[nrow][ncol-1..ncol] = " " + end if + end for + return 0 +end function + +procedure Hopido(sequence s, integer w, integer h) +integer x, y +atom t0 = time() + board = split(s,'\n') + limit = 0 + for x=1 to h do + for y=3 to w*3 by 3 do + if board[x][y]='0' then + board[x][y] = ' ' + limit += 1 + end if + end for + end for + while 1 do + x = rand(h) + y = rand(w)*3 + if board[x][y]=' ' then exit end if + end while + board[x][y] = '1' + tries = 0 + if solve(x,y,2) then + puts(1,join(board,"\n")) + printf(1,"\nsolution found in %d tries (%3.2fs)\n",{tries,time()-t0}) + else + puts(1,"no solutions found\n") + end if +end procedure + +constant board1 = """ + . 0 0 . 0 0 . + 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 + . 0 0 0 0 0 . + . . 0 0 0 . . + . . . 0 . . .""" +Hopido(board1,7,6) diff --git a/Task/Solve-a-Numbrix-puzzle/Phix/solve-a-numbrix-puzzle.phix b/Task/Solve-a-Numbrix-puzzle/Phix/solve-a-numbrix-puzzle.phix new file mode 100644 index 0000000000..631d14b99b --- /dev/null +++ b/Task/Solve-a-Numbrix-puzzle/Phix/solve-a-numbrix-puzzle.phix @@ -0,0 +1,102 @@ +sequence board, knownx, knowny + +integer size, limit, nchars, tries +string fmt, blank + +constant ROW = 1, COL = 2 +constant moves = {{-1,0},{0,-1},{0,1},{1,0}} + +function onboard(integer row, integer col) + return row>=1 and row<=size and col>=nchars and col<=nchars*size +end function + +function solve(integer row, integer col, integer n) +integer nrow, ncol + tries+= 1 + if n>limit then return 1 end if + if knownx[n] then + for move=1 to length(moves) do + nrow = row+moves[move][ROW] + ncol = col+moves[move][COL]*nchars + if nrow = knownx[n] + and ncol = knowny[n] then + if solve(nrow,ncol,n+1) then return 1 end if + exit + end if + end for + return 0 + end if + sequence wmoves = {} + for move=1 to length(moves) do + nrow = row+moves[move][ROW] + ncol = col+moves[move][COL]*nchars + if onboard(nrow,ncol) + and board[nrow][ncol]='.' then + board[nrow][ncol-nchars+1..ncol] = sprintf(fmt,n) + if solve(nrow,ncol,n+1) then return 1 end if + board[nrow][ncol-nchars+1..ncol] = blank + end if + end for + return 0 +end function + +procedure Numbrix(sequence s) +integer y, ch, ch2, k +atom t0 = time() + s = split(s,'\n') + size = length(s) + limit = size*size + nchars = length(sprintf(" %d",limit)) + fmt = sprintf(" %%%dd",nchars-1) + blank = repeat('.',nchars) + board = repeat(repeat(' ',size*nchars),size) + knownx = repeat(0,limit) + knowny = repeat(0,limit) + for x=1 to size do + for y=nchars to size*nchars by nchars do + ch = s[x][y] + if ch!='.' then + k = ch-'0' + ch2 = s[x][y-1] + if ch2!=' ' then + k += (ch2-'0')*10 + board[x][y-1] = ch2 + end if + knownx[k] = x + knowny[k] = y + end if + board[x][y] = ch + end for + end for + tries = 0 + if solve(knownx[1],knowny[1],2) then + puts(1,join(board,"\n")) + printf(1,"\nsolution found in %d tries (%3.2fs)\n",{tries,time()-t0}) + else + puts(1,"no solutions found\n") + end if +end procedure + +constant board1 = """ + . . . . . . . . . + . . 46 45 . 55 74 . . + . 38 . . 43 . . 78 . + . 35 . . . . . 71 . + . . 33 . . . 59 . . + . 17 . . . . . 67 . + . 18 . . 11 . . 64 . + . . 24 21 . 1 2 . . + . . . . . . . . .""" +Numbrix(board1) + +constant board2 = """ + . . . . . . . . . + . 11 12 15 18 21 62 61 . + . 6 . . . . . 60 . + . 33 . . . . . 57 . + . 32 . . . . . 56 . + . 37 . 1 . . . 73 . + . 38 . . . . . 72 . + . 43 44 47 48 51 76 77 . + . . . . . . . . .""" +Numbrix(board2) diff --git a/Task/Solve-the-no-connection-puzzle/Phix/solve-the-no-connection-puzzle.phix b/Task/Solve-the-no-connection-puzzle/Phix/solve-the-no-connection-puzzle.phix new file mode 100644 index 0000000000..de69c9461d --- /dev/null +++ b/Task/Solve-the-no-connection-puzzle/Phix/solve-the-no-connection-puzzle.phix @@ -0,0 +1,32 @@ +constant txt = """ + A B + /|\ /|\ + / | X | \ + / |/ \| \ + C - D - E - F + \ |\ /| / + \ | X | / + \|/ \|/ + G H""" +--constant links = "CA DA DB DC EA EB ED FB FE GC GD GE HD HE HF" +constant links = {"","","A","ABC","ABD","BE","CDE","DEF"} + +function solve(sequence s, integer idx, sequence part) +object res +integer v, p + for i=1 to length(s) do + v = s[i] + for j=1 to length(links[idx]) do + p = links[idx][j]-'@' + if abs(v-part[p])<2 then v=0 exit end if + end for + if v then + if length(s)=1 then return part&v end if + res = solve(s[1..i-1]&s[i+1..$],idx+1,part&v) + if sequence(res) then return res end if + end if + end for + return 0 +end function + +printf(1,substitute_all(txt,"ABCDEFGH",solve("12345678",1,""))) diff --git a/Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-1.jq b/Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-1.jq new file mode 100644 index 0000000000..181c4f687d --- /dev/null +++ b/Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-1.jq @@ -0,0 +1,24 @@ +# Short-circuit determination of whether (a|condition) +# is true for all a in array: +def forall(array; condition): + def check: + . as $ix + | if $ix == (array|length) then true + elif (array[$ix] | condition) then ($ix + 1) | check + else false + end; + 0 | check; + +# permutations of 0 .. (n-1) +def permutations(n): + # Given a single array, generate a stream by inserting n at different positions: + def insert(m;n): + if m >= 0 then (.[0:m] + [n] + .[m:]), insert(m-1;n) else empty end; + if n==0 then [] + elif n == 1 then [1] + else + permutations(n-1) | insert(n-1; n) + end; + +# Count the number of items in a stream +def count(f): reduce f as $_ (0; .+1); diff --git a/Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-2.jq b/Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-2.jq new file mode 100644 index 0000000000..e7e1e7770d --- /dev/null +++ b/Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-2.jq @@ -0,0 +1,13 @@ +# Generate a stream of solutions. +# Input should be the connections array, i.e. an array of [i,j] pairs; +# N is the number of pegs and holds. +def solutions(N): + def abs: if . < 0 then -. else . end; + + # Is the proposed permutation (the input) ok? + def ok(connections): + . as $p + | forall( connections; + (($p[.[0]] - $p[.[1]])|abs) != 1 ); + + . as $connections | permutations(N) | select(ok($connections); diff --git a/Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-3.jq b/Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-3.jq new file mode 100644 index 0000000000..67e0db17e2 --- /dev/null +++ b/Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-3.jq @@ -0,0 +1,33 @@ +# The connectedness matrix: +# In this table, 0 represents "A", etc, and an entry [i,j] +# signifies that the holes with indices i and j are connected. +def connections: + [[0, 2], [0, 3], [0, 4], + [1, 3], [1, 4], [1, 5], + [6, 2], [6, 3], [6, 4], + [7, 3], [7, 4], [7, 5], + [2, 3], [3, 4], [4, 5]] +; + +def solve: + connections | solutions(8); + +# pretty-print a solution for the 8-peg puzzle +def pp: + def pegs: ["A", "B", "C", "D", "E", "F", "G", "H"]; + . as $in + | (" + A B + /|\\ /|\\ + / | X | \\ + / |/ \\| \\ + C - D - E - F + \\ |\\ /| / + \\ | X | / + \\|/ \\|/ + G H +" | explode) as $board + | (pegs | map(explode)) as $letters + | $letters + | reduce range(0;length) as $i ($board; index($letters[$i]) as $ix | .[$ix] = $in[$i] + 48) + | implode; diff --git a/Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-4.jq b/Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-4.jq new file mode 100644 index 0000000000..fdea0730d1 --- /dev/null +++ b/Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-4.jq @@ -0,0 +1,12 @@ +# To print all the solutions: +# solve | pp + +# To count the number of solutions: +# count(solve) + +# jq 1.4 lacks facilities for harnessing generators, +# but the following will suffice here: +def one(f): reduce f as $s + (null; if . == null then $s else . end); + +one(solve) | pp diff --git a/Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-5.jq b/Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-5.jq new file mode 100644 index 0000000000..2ff0405faf --- /dev/null +++ b/Task/Solve-the-no-connection-puzzle/jq/solve-the-no-connection-puzzle-5.jq @@ -0,0 +1,11 @@ +$ jq -n -r -f no_connection.jq + + 5 6 + /|\ /|\ + / | X | \ + / |/ \| \ + 7 - 1 - 8 - 2 + \ |\ /| / + \ | X | / + \|/ \|/ + 3 4 diff --git a/Task/Sort-an-array-of-composite-structures/EchoLisp/sort-an-array-of-composite-structures.echolisp b/Task/Sort-an-array-of-composite-structures/EchoLisp/sort-an-array-of-composite-structures.echolisp new file mode 100644 index 0000000000..4d59c62794 --- /dev/null +++ b/Task/Sort-an-array-of-composite-structures/EchoLisp/sort-an-array-of-composite-structures.echolisp @@ -0,0 +1,10 @@ +;; sorting (name value) by name - Ignoring case +(define (name a) (first a)) +(define( sort-proc a b) + (string-ci cmp(x[0], y[0])) +echo people diff --git a/Task/Sort-an-array-of-composite-structures/Oforth/sort-an-array-of-composite-structures.oforth b/Task/Sort-an-array-of-composite-structures/Oforth/sort-an-array-of-composite-structures.oforth new file mode 100644 index 0000000000..a2e143589a --- /dev/null +++ b/Task/Sort-an-array-of-composite-structures/Oforth/sort-an-array-of-composite-structures.oforth @@ -0,0 +1 @@ +[["Joe",5531], ["Adam",2341], ["Bernie",122], ["David",19]] sortBy(#first) println diff --git a/Task/Sort-an-array-of-composite-structures/Phix/sort-an-array-of-composite-structures.phix b/Task/Sort-an-array-of-composite-structures/Phix/sort-an-array-of-composite-structures.phix new file mode 100644 index 0000000000..2c62869115 --- /dev/null +++ b/Task/Sort-an-array-of-composite-structures/Phix/sort-an-array-of-composite-structures.phix @@ -0,0 +1,16 @@ +constant NAME = 1, COLOUR = 2 +function compare_names(sequence a, sequence b) + return compare(a[NAME],b[NAME]) +end function +function compare_colour(sequence a, sequence b) + return compare(a[COLOUR],b[COLOUR]) +end function + +sequence s +s = { { "grass", "green" }, + { "snow", "white" }, + { "sky", "blue" }, + { "cherry", "red" } } + +?custom_sort(routine_id("compare_names"),s) +?custom_sort(routine_id("compare_colour"),s) diff --git a/Task/Sort-an-array-of-composite-structures/Sidef/sort-an-array-of-composite-structures.sidef b/Task/Sort-an-array-of-composite-structures/Sidef/sort-an-array-of-composite-structures.sidef new file mode 100644 index 0000000000..67eb3faa1e --- /dev/null +++ b/Task/Sort-an-array-of-composite-structures/Sidef/sort-an-array-of-composite-structures.sidef @@ -0,0 +1,11 @@ +# Declare an array of pairs +var people = [['joe', 120], ['foo', 31], ['bar', 51]]; + +# Sort the array in-place by name +people.sort! {|a,b| a[0] <=> b[0] }; + +# Alternatively, we can use the `.sort_by{}` method +var sorted = people.sort_by { |item| item[0] }; + +# Display the sorted array +say people; diff --git a/Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-1.jq b/Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-1.jq new file mode 100644 index 0000000000..5b55737f2c --- /dev/null +++ b/Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-1.jq @@ -0,0 +1,7 @@ +def example: + [ + {"name": "Joe", "value": 3}, + {"name": "Bill", "value": 4}, + {"name": "Alice", "value": 20}, + {"name": "Harry", "value": 3} + ]; diff --git a/Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-2.jq b/Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-2.jq new file mode 100644 index 0000000000..3a20aa7da3 --- /dev/null +++ b/Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-2.jq @@ -0,0 +1,6 @@ +# To sort the array: +# example | sort_by(.name) + +# To abbreviate the results, we will just show the names after sorting: + +example | sort_by(.name) | map( .name ) diff --git a/Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-3.jq b/Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-3.jq new file mode 100644 index 0000000000..999a07f0d1 --- /dev/null +++ b/Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-3.jq @@ -0,0 +1 @@ +def quicksort_by(f): quicksort( (.[0]|f) <= (.[1]|f) ); diff --git a/Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-4.jq b/Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-4.jq new file mode 100644 index 0000000000..ba953e7831 --- /dev/null +++ b/Task/Sort-an-array-of-composite-structures/jq/sort-an-array-of-composite-structures-4.jq @@ -0,0 +1 @@ +example | quicksort_by(.name) | map( .name ) diff --git a/Task/Sort-an-integer-array/8th/sort-an-integer-array.8th b/Task/Sort-an-integer-array/8th/sort-an-integer-array.8th new file mode 100644 index 0000000000..d27ddac9cd --- /dev/null +++ b/Task/Sort-an-integer-array/8th/sort-an-integer-array.8th @@ -0,0 +1 @@ +[ 10,2,100 ] ' n:cmp a:sort . cr diff --git a/Task/Sort-an-integer-array/Axe/sort-an-integer-array.axe b/Task/Sort-an-integer-array/Axe/sort-an-integer-array.axe new file mode 100644 index 0000000000..195023e7a7 --- /dev/null +++ b/Task/Sort-an-integer-array/Axe/sort-an-integer-array.axe @@ -0,0 +1,7 @@ +2→{L₁} +4→{L₁+1} +3→{L₁+2} +1→{L₁+3} +2→{L₁+4} + +SortD(L₁,5) diff --git a/Task/Sort-an-integer-array/FreeBASIC/sort-an-integer-array.freebasic b/Task/Sort-an-integer-array/FreeBASIC/sort-an-integer-array.freebasic new file mode 100644 index 0000000000..3ae65e6b23 --- /dev/null +++ b/Task/Sort-an-integer-array/FreeBASIC/sort-an-integer-array.freebasic @@ -0,0 +1,58 @@ +' version 11-03-2016 +' compile with: fbc -s console + +#Include Once "crt/stdlib.bi" ' needed for qsort subroutine + +' Declare Sub qsort (ByVal As Any Ptr, <== point to start of array +' ByVal As size_t, <== size of array +' ByVal As size_t, <== size of array element +' ByVal As Function(ByVal As Any Ptr, ByVal As Any Ptr) As Long) <== callback function +' declare callback function with Cdecl to ensures that the parameters are passed in the correct order +' +' size of long: 4 bytes on 32bit OS, 8 bytes on 64bit OS + +' ascending + Function callback Cdecl (ByVal element1 As Any Ptr, ByVal element2 As Any Ptr) As Long + Function = *Cast(Long Ptr, element1) - *Cast(Long Ptr, element2) +End Function + +' Function callback Cdecl (ByVal element1 As Any Ptr, ByVal element2 As Any Ptr) As Long +' Dim As Long e1 = *Cast(Long Ptr, element1) +' Dim As Long e2 = *Cast(Long Ptr, element2) +' Dim As Long result = Sgn(e1 - e2) +' If Sgn(e1) = -1 And Sgn(e2) = -1 Then result = -result +' Function = result +' End Function + +' ------=< MAIN >=------ + +Dim As Long i, array(20) + +Dim As Long lb = LBound(array) +Dim As Long ub = UBound(array) + +For i = lb To ub ' fill array + array(i) = 10 - i +Next + +Print +Print "unsorted array" +For i = lb To ub ' display array + Print Using "###";array(i); +Next +Print : Print + +' sort array +qsort(@array(lb), ub - lb +1, SizeOf(array), @callback) + +Print "sorted array" +For i = lb To ub ' show sorted array + Print Using "###";array(i); +Next +Print + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Sort-an-integer-array/FunL/sort-an-integer-array.funl b/Task/Sort-an-integer-array/FunL/sort-an-integer-array.funl new file mode 100644 index 0000000000..218adc998a --- /dev/null +++ b/Task/Sort-an-integer-array/FunL/sort-an-integer-array.funl @@ -0,0 +1,3 @@ +nums = [5, 2, 78, 2, 578, -42] +println( sort(nums) ) // sort in ascending order +println( nums.sortWith((>)) ) // sort in descending order diff --git a/Task/Sort-an-integer-array/Lasso/sort-an-integer-array.lasso b/Task/Sort-an-integer-array/Lasso/sort-an-integer-array.lasso new file mode 100644 index 0000000000..5703d3793e --- /dev/null +++ b/Task/Sort-an-integer-array/Lasso/sort-an-integer-array.lasso @@ -0,0 +1,7 @@ +local(array) = array(5,20,3,2,6,1,4) +#array->sort +#array // 1, 2, 3, 4, 5, 6, 20 + +// Reverse the sort order +#array->sort(false) +#array // 20, 6, 5, 4, 3, 2, 1 diff --git a/Task/Sort-an-integer-array/Lingo/sort-an-integer-array.lingo b/Task/Sort-an-integer-array/Lingo/sort-an-integer-array.lingo new file mode 100644 index 0000000000..a620ff361e --- /dev/null +++ b/Task/Sort-an-integer-array/Lingo/sort-an-integer-array.lingo @@ -0,0 +1,4 @@ +l = [7, 4, 23] +l.sort() +put l +-- [4, 7, 23] diff --git a/Task/Sort-an-integer-array/LiveCode/sort-an-integer-array.livecode b/Task/Sort-an-integer-array/LiveCode/sort-an-integer-array.livecode new file mode 100644 index 0000000000..6fd30bc21e --- /dev/null +++ b/Task/Sort-an-integer-array/LiveCode/sort-an-integer-array.livecode @@ -0,0 +1,4 @@ +put "3,2,5,4,1" into X +sort items of X numeric +put X +-- outputs "1,2,3,4,5" diff --git a/Task/Sort-an-integer-array/Nim/sort-an-integer-array.nim b/Task/Sort-an-integer-array/Nim/sort-an-integer-array.nim new file mode 100644 index 0000000000..e02f5e0991 --- /dev/null +++ b/Task/Sort-an-integer-array/Nim/sort-an-integer-array.nim @@ -0,0 +1,6 @@ +import algorithm + +var a: array[0..8,int] = [2,3,5,8,4,1,6,9,7] +a.sort(system.cmp[int], Ascending) +for x in a: + echo(x) diff --git a/Task/Sort-an-integer-array/Oforth/sort-an-integer-array.oforth b/Task/Sort-an-integer-array/Oforth/sort-an-integer-array.oforth new file mode 100644 index 0000000000..44dd75d04d --- /dev/null +++ b/Task/Sort-an-integer-array/Oforth/sort-an-integer-array.oforth @@ -0,0 +1 @@ +[ 8, 2, 5, 9, 1, 3, 6, 7, 4 ] sort diff --git a/Task/Sort-an-integer-array/Peloton/sort-an-integer-array-1.peloton b/Task/Sort-an-integer-array/Peloton/sort-an-integer-array-1.peloton new file mode 100644 index 0000000000..ac9f23823e --- /dev/null +++ b/Task/Sort-an-integer-array/Peloton/sort-an-integer-array-1.peloton @@ -0,0 +1,15 @@ +Construct a list of numbers +<@ LETCNSLSTLIT>L|65^84^1^25^77^4^47^2^42^44^41^25^69^3^51^45^4^39^ +Numbers sort as strings +<@ ACTSRTENTLST>L +<@ SAYDMPLST>L +<@ ACTSRTENTLSTLIT>L|__StringDescending +<@ SAYDMPLST>L + +Construct another list of numbers +<@ LETCNSLSTLIT>list|65^84^1^25^77^4^47^2^42^44^41^25^69^3^51^45^4^39^ +Numbers sorted as numbers +<@ ACTSRTENTLSTLIT>list|__Numeric +<@ SAYDMPLST>list +<@ ACTSRTENTLSTLIT>list|__NumericDescending +<@ SAYDMPLST>list diff --git a/Task/Sort-an-integer-array/Peloton/sort-an-integer-array-2.peloton b/Task/Sort-an-integer-array/Peloton/sort-an-integer-array-2.peloton new file mode 100644 index 0000000000..84d8078bc9 --- /dev/null +++ b/Task/Sort-an-integer-array/Peloton/sort-an-integer-array-2.peloton @@ -0,0 +1,15 @@ +Construct a list of numbers + +Numbers sort as strings + +1^2^25^25^3^39^4^4^41^42^44^45^47^51^65^69^77^84^ + +84^77^69^65^51^47^45^44^42^41^4^4^39^3^25^25^2^1^ + +Construct another list of numbers + +Numbers sorted as numbers + +1^2^3^4^4^25^25^39^41^42^44^45^47^51^65^69^77^84^ + +84^77^69^65^51^47^45^44^42^41^39^25^25^4^4^3^2^1^ diff --git a/Task/Sort-an-integer-array/Phix/sort-an-integer-array.phix b/Task/Sort-an-integer-array/Phix/sort-an-integer-array.phix new file mode 100644 index 0000000000..7f873fb100 --- /dev/null +++ b/Task/Sort-an-integer-array/Phix/sort-an-integer-array.phix @@ -0,0 +1 @@ +?sort({9, 10, 3, 1, 4, 5, 8, 7, 6, 2}) diff --git a/Task/Sort-an-integer-array/Potion/sort-an-integer-array.potion b/Task/Sort-an-integer-array/Potion/sort-an-integer-array.potion new file mode 100644 index 0000000000..8cd35c7596 --- /dev/null +++ b/Task/Sort-an-integer-array/Potion/sort-an-integer-array.potion @@ -0,0 +1 @@ +(7, 5, 1, 2, 3, 8, 9) sort join(", ") print diff --git a/Task/Sort-an-integer-array/Ring/sort-an-integer-array.ring b/Task/Sort-an-integer-array/Ring/sort-an-integer-array.ring new file mode 100644 index 0000000000..95d1e5054d --- /dev/null +++ b/Task/Sort-an-integer-array/Ring/sort-an-integer-array.ring @@ -0,0 +1,2 @@ +aArray = [2,4,3,1,2] +see sort(aArray) diff --git a/Task/Sort-an-integer-array/Sidef/sort-an-integer-array.sidef b/Task/Sort-an-integer-array/Sidef/sort-an-integer-array.sidef new file mode 100644 index 0000000000..4d575b7ffb --- /dev/null +++ b/Task/Sort-an-integer-array/Sidef/sort-an-integer-array.sidef @@ -0,0 +1,3 @@ +var nums = [2,4,3,1,2]; +var sorted = nums.sort; # returns a new sorted array. +nums.sort!; # sort 'nums' "in-place" diff --git a/Task/Sort-an-integer-array/Sparkling/sort-an-integer-array.sparkling b/Task/Sort-an-integer-array/Sparkling/sort-an-integer-array.sparkling new file mode 100644 index 0000000000..0752a5293b --- /dev/null +++ b/Task/Sort-an-integer-array/Sparkling/sort-an-integer-array.sparkling @@ -0,0 +1,2 @@ +var arr = { 2, 8, 1, 4, 6, 5, 3, 7, 0, 9 }; +sort(arr); diff --git a/Task/Sort-an-integer-array/Swift/sort-an-integer-array-1.swift b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-1.swift new file mode 100644 index 0000000000..c442cd5c2c --- /dev/null +++ b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-1.swift @@ -0,0 +1,3 @@ +var nums = [2, 4, 3, 1, 2] +nums.sortInPlace() +print(nums) diff --git a/Task/Sort-an-integer-array/Swift/sort-an-integer-array-2.swift b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-2.swift new file mode 100644 index 0000000000..3a562573e0 --- /dev/null +++ b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-2.swift @@ -0,0 +1,3 @@ +var nums = [2, 4, 3, 1, 2] +nums.sortInPlace(<) +print(nums) diff --git a/Task/Sort-an-integer-array/Swift/sort-an-integer-array-3.swift b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-3.swift new file mode 100644 index 0000000000..dc2fa6f928 --- /dev/null +++ b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-3.swift @@ -0,0 +1,3 @@ +var nums = [2, 4, 3, 1, 2] +nums.sort(<) +println(nums) diff --git a/Task/Sort-an-integer-array/Swift/sort-an-integer-array-4.swift b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-4.swift new file mode 100644 index 0000000000..c8ec7057a6 --- /dev/null +++ b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-4.swift @@ -0,0 +1,3 @@ +var nums = [2, 4, 3, 1, 2] +sort(&nums) +println(nums) diff --git a/Task/Sort-an-integer-array/Swift/sort-an-integer-array-5.swift b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-5.swift new file mode 100644 index 0000000000..b9625d7815 --- /dev/null +++ b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-5.swift @@ -0,0 +1,3 @@ +var nums = [2, 4, 3, 1, 2] +sort(&nums, <) +println(nums) diff --git a/Task/Sort-an-integer-array/Swift/sort-an-integer-array-6.swift b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-6.swift new file mode 100644 index 0000000000..0e1753d16b --- /dev/null +++ b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-6.swift @@ -0,0 +1,2 @@ +let nums = [2,4,3,1,2].sort() +print(nums) diff --git a/Task/Sort-an-integer-array/Swift/sort-an-integer-array-7.swift b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-7.swift new file mode 100644 index 0000000000..25d80652de --- /dev/null +++ b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-7.swift @@ -0,0 +1,2 @@ +let nums = [2,4,3,1,2].sort(<) +print(nums) diff --git a/Task/Sort-an-integer-array/Swift/sort-an-integer-array-8.swift b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-8.swift new file mode 100644 index 0000000000..14655c3982 --- /dev/null +++ b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-8.swift @@ -0,0 +1,2 @@ +let nums = sorted([2,4,3,1,2]) +println(nums) diff --git a/Task/Sort-an-integer-array/Swift/sort-an-integer-array-9.swift b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-9.swift new file mode 100644 index 0000000000..cbf652a0cf --- /dev/null +++ b/Task/Sort-an-integer-array/Swift/sort-an-integer-array-9.swift @@ -0,0 +1,2 @@ +let nums = [2,4,3,1,2].sorted(<) +println(nums) diff --git a/Task/Sort-an-integer-array/Ursa/sort-an-integer-array.ursa b/Task/Sort-an-integer-array/Ursa/sort-an-integer-array.ursa new file mode 100644 index 0000000000..709bb6641a --- /dev/null +++ b/Task/Sort-an-integer-array/Ursa/sort-an-integer-array.ursa @@ -0,0 +1,3 @@ +decl int<> nums +append 2 4 3 1 2 nums +sort nums diff --git a/Task/Sort-an-integer-array/Wortel/sort-an-integer-array.wortel b/Task/Sort-an-integer-array/Wortel/sort-an-integer-array.wortel new file mode 100644 index 0000000000..518b9d937c --- /dev/null +++ b/Task/Sort-an-integer-array/Wortel/sort-an-integer-array.wortel @@ -0,0 +1 @@ +@sort [39 47 40 53 14 23 88 52 78 62 41 92 88 66 5 40] diff --git a/Task/Sort-an-integer-array/jq/sort-an-integer-array.jq b/Task/Sort-an-integer-array/jq/sort-an-integer-array.jq new file mode 100644 index 0000000000..cd5b236d6d --- /dev/null +++ b/Task/Sort-an-integer-array/jq/sort-an-integer-array.jq @@ -0,0 +1 @@ +[2,1,3] | sort # => [1,2,3] diff --git a/Task/Sort-disjoint-sublist/ERRE/sort-disjoint-sublist.erre b/Task/Sort-disjoint-sublist/ERRE/sort-disjoint-sublist.erre new file mode 100644 index 0000000000..c18ccf84b4 --- /dev/null +++ b/Task/Sort-disjoint-sublist/ERRE/sort-disjoint-sublist.erre @@ -0,0 +1,48 @@ +PROGRAM DISJOINT + +DIM LST%[7],INDICES%[2] + +DIM L%[7],I%[2],Z%[2] +PROCEDURE SHOWLIST(L%[]->O$) + LOCAL I% + O$="[" + FOR I%=0 TO UBOUND(L%,1) DO + O$=O$+STR$(L%[I%])+", " + END FOR + O$=LEFT$(O$,LEN(O$)-2)+"]" +END PROCEDURE + +PROCEDURE SORT(Z%[]->Z%[]) + LOCAL N%,P%,FLIPS% + P%=UBOUND(Z%,1) + FLIPS%=TRUE + WHILE FLIPS% DO + FLIPS%=FALSE + FOR N%=0 TO P%-1 DO + IF Z%[N%]>Z%[N%+1] THEN SWAP(Z%[N%],Z%[N%+1]) FLIPS%=TRUE + END FOR + END WHILE +END PROCEDURE + +PROCEDURE SortDisJoint(L%[],I%[]->L%[]) + LOCAL J%,N% + LOCAL DIM T%[2] + + N%=UBOUND(I%,1) + FOR J%=0 TO N% DO + T%[J%]=L%[I%[J%]] + END FOR + SORT(I%[]->I%[]) + SORT(T%[]->T%[]) + FOR J%=0 TO N% DO + L%[I%[J%]]=T%[J%] + END FOR +END PROCEDURE + +BEGIN + LST%[]=(7,6,5,4,3,2,1,0) + INDICES%[]=(6,1,7) + SortDisJoint(LST%[],INDICES%[]->LST%[]) + ShowList(LST%[]->O$) + PRINT(O$) +END PROGRAM diff --git a/Task/Sort-disjoint-sublist/EchoLisp/sort-disjoint-sublist.echolisp b/Task/Sort-disjoint-sublist/EchoLisp/sort-disjoint-sublist.echolisp new file mode 100644 index 0000000000..0b8f8cab5a --- /dev/null +++ b/Task/Sort-disjoint-sublist/EchoLisp/sort-disjoint-sublist.echolisp @@ -0,0 +1,16 @@ +(define (sort-disjoint values indices) + (define sorted (list-sort < + (for/list [(v values) (i (in-naturals))] + #:when (member i indices) v))) + + (for/list [(v values) (i (in-naturals))] + (if (not (member i indices)) v + (begin0 + (first sorted) + (set! sorted (rest sorted)))))) + +(define (task) + (sort-disjoint '[7 6 5 4 3 2 1 0] {6 1 7})) + +(task) + → (7 0 5 4 3 2 1 6) diff --git a/Task/Sort-disjoint-sublist/Nim/sort-disjoint-sublist.nim b/Task/Sort-disjoint-sublist/Nim/sort-disjoint-sublist.nim new file mode 100644 index 0000000000..e37fc29ffc --- /dev/null +++ b/Task/Sort-disjoint-sublist/Nim/sort-disjoint-sublist.nim @@ -0,0 +1,15 @@ +import algorithm + +proc sortDisjoinSublist[T](data: var seq[T], indices: seq[int]) = + var indices = indices + sort indices, cmp[T] + + var values: seq[T] = @[] + for i in indices: values.add data[i] + sort values, cmp[T] + + for j, i in indices: data[i] = values[j] + +var d = @[7, 6, 5, 4, 3, 2, 1, 0] +sortDisjoinSublist(d, @[6, 1, 7]) +echo d diff --git a/Task/Sort-disjoint-sublist/Phix/sort-disjoint-sublist.phix b/Task/Sort-disjoint-sublist/Phix/sort-disjoint-sublist.phix new file mode 100644 index 0000000000..bc7428a314 --- /dev/null +++ b/Task/Sort-disjoint-sublist/Phix/sort-disjoint-sublist.phix @@ -0,0 +1,33 @@ +function uniq(sequence s) +integer last=s[1], this, ndx = 1 + for i=2 to length(s) do + this = s[i] + if this!=last then + ndx += 1 + s[ndx] = this + last = this + end if + end for + return s[1..ndx] +end function + +function disjoint_sort(sequence s, sequence idx) +sequence copies + if length(idx)>1 then + -- must ensure there are no duplicates, + -- otherwise eg {7,2,8,8} -> {2,7,8,8}, + -- but {1,6,0,0} -> {0,0,1,6} + idx = uniq(sort(idx)) + copies = repeat(0, length(idx)) + for i=1 to length(idx) do + copies[i] = s[idx[i]] + end for + copies = sort(copies) + for i=1 to length(idx) do + s[idx[i]] = copies[i] + end for + end if + return s +end function + +?disjoint_sort({7,6,5,4,3,2,1,0},{7,2,8}) diff --git a/Task/Sort-disjoint-sublist/Sidef/sort-disjoint-sublist.sidef b/Task/Sort-disjoint-sublist/Sidef/sort-disjoint-sublist.sidef new file mode 100644 index 0000000000..1a2ecefccc --- /dev/null +++ b/Task/Sort-disjoint-sublist/Sidef/sort-disjoint-sublist.sidef @@ -0,0 +1,9 @@ +func disjointSort(values, indices) { + values[indices.sort] = [values[indices]].sort... +} + +var values = [7, 6, 5, 4, 3, 2, 1, 0]; +var indices = [6, 1, 7]; + +disjointSort(values, indices); +say values; diff --git a/Task/Sort-disjoint-sublist/Swift/sort-disjoint-sublist.swift b/Task/Sort-disjoint-sublist/Swift/sort-disjoint-sublist.swift new file mode 100644 index 0000000000..022c7d1457 --- /dev/null +++ b/Task/Sort-disjoint-sublist/Swift/sort-disjoint-sublist.swift @@ -0,0 +1,26 @@ +struct DisjointSublistView : MutableCollectionType { + let array : UnsafeMutablePointer + let indexes : [Int] + + subscript (position: Int) -> T { + get { + return array[indexes[position]] + } + set { + array[indexes[position]] = newValue + } + } + var startIndex : Int { return 0 } + var endIndex : Int { return indexes.count } + func generate() -> IndexingGenerator> { return IndexingGenerator(self) } +} + +func sortDisjointSublist(inout array: [T], indexes: [Int]) { + var d = DisjointSublistView(array: &array, indexes: sorted(indexes)) + sort(&d) +} + +var a = [7, 6, 5, 4, 3, 2, 1, 0] +let ind = [6, 1, 7] +sortDisjointSublist(&a, ind) +println(a) diff --git a/Task/Sort-disjoint-sublist/jq/sort-disjoint-sublist-1.jq b/Task/Sort-disjoint-sublist/jq/sort-disjoint-sublist-1.jq new file mode 100644 index 0000000000..d64b744228 --- /dev/null +++ b/Task/Sort-disjoint-sublist/jq/sort-disjoint-sublist-1.jq @@ -0,0 +1,9 @@ +def setpaths(indices; values): + reduce range(0; indices|length) as $i + (.; .[indices[$i]] = values[$i]); + +def disjointSort(indices): + (indices|unique) as $ix # "unique" sorts + # Set $sorted to the sorted array of values at $ix: + | ([ .[ $ix[] ] ] | sort) as $sorted + | setpaths( $ix; $sorted) ; diff --git a/Task/Sort-disjoint-sublist/jq/sort-disjoint-sublist-2.jq b/Task/Sort-disjoint-sublist/jq/sort-disjoint-sublist-2.jq new file mode 100644 index 0000000000..70689dbd1d --- /dev/null +++ b/Task/Sort-disjoint-sublist/jq/sort-disjoint-sublist-2.jq @@ -0,0 +1 @@ +[7, 6, 5, 4, 3, 2, 1, 0] | disjointSort( [6, 1, 7] ) diff --git a/Task/Sort-stability/Lasso/sort-stability-1.lasso b/Task/Sort-stability/Lasso/sort-stability-1.lasso new file mode 100644 index 0000000000..bd5eeb6806 --- /dev/null +++ b/Task/Sort-stability/Lasso/sort-stability-1.lasso @@ -0,0 +1,8 @@ +//Single param array: +array->sort + +//An array of pairs, order by the right hand element of the pair: +with i in array order by #i->second do => { … } + +//The array can also be ordered by multiple values: +with i in array order by #i->second, #i->first do => { … } diff --git a/Task/Sort-stability/Lasso/sort-stability-2.lasso b/Task/Sort-stability/Lasso/sort-stability-2.lasso new file mode 100644 index 0000000000..75d4f34226 --- /dev/null +++ b/Task/Sort-stability/Lasso/sort-stability-2.lasso @@ -0,0 +1,2 @@ +local(a = array('UK'='London','US'='New York','US'='Birmingham','UK'='Birmingham')) +with i in #a order by #i->second do => {^ #i->first+' - '+#i->second+'\r' ^} diff --git a/Task/Sort-stability/Lasso/sort-stability-3.lasso b/Task/Sort-stability/Lasso/sort-stability-3.lasso new file mode 100644 index 0000000000..effca47b1d --- /dev/null +++ b/Task/Sort-stability/Lasso/sort-stability-3.lasso @@ -0,0 +1,2 @@ +local(a = array('UK'='London','US'='New York','US'='Birmingham','UK'='Birmingham')) +with i in #a order by #i->second, #i->first do => {^ #i->first+' - '+#i->second+'\r' ^} diff --git a/Task/Sort-stability/Ring/sort-stability.ring b/Task/Sort-stability/Ring/sort-stability.ring new file mode 100644 index 0000000000..a90822a779 --- /dev/null +++ b/Task/Sort-stability/Ring/sort-stability.ring @@ -0,0 +1,5 @@ +aList = [["UK", "London"], + ["US", "New York"], + ["US", "Birmingham"], + ["UK", "Birmingham"]] +see sort(aList,2) diff --git a/Task/Sort-stability/Sidef/sort-stability.sidef b/Task/Sort-stability/Sidef/sort-stability.sidef new file mode 100644 index 0000000000..efae12d669 --- /dev/null +++ b/Task/Sort-stability/Sidef/sort-stability.sidef @@ -0,0 +1,10 @@ +var table = [ + , + , + , + , +]; + +table.sort {|a,b| a[0] <=> b[0]}.each { |col| + say "#{col[0]} #{col[1]}" +} diff --git a/Task/Sort-using-a-custom-comparator/Ceylon/sort-using-a-custom-comparator.ceylon b/Task/Sort-using-a-custom-comparator/Ceylon/sort-using-a-custom-comparator.ceylon new file mode 100644 index 0000000000..c369cdf5ec --- /dev/null +++ b/Task/Sort-using-a-custom-comparator/Ceylon/sort-using-a-custom-comparator.ceylon @@ -0,0 +1,14 @@ +shared void run() { + + value strings = [ + "Cat", "apple", "Adam", "zero", "Xmas", "quit", + "Level", "add", "Actor", "base", "butter" + ]; + + value sorted = strings.sort((String x, String y) => + if(x.size == y.size) + then increasing(x.lowercased, y.lowercased) + else decreasing(x.size, y.size)); + + sorted.each(print); +} diff --git a/Task/Sort-using-a-custom-comparator/FreeBASIC/sort-using-a-custom-comparator.freebasic b/Task/Sort-using-a-custom-comparator/FreeBASIC/sort-using-a-custom-comparator.freebasic new file mode 100644 index 0000000000..04cb1a599b --- /dev/null +++ b/Task/Sort-using-a-custom-comparator/FreeBASIC/sort-using-a-custom-comparator.freebasic @@ -0,0 +1,48 @@ +' version 23-10-2016 +' compile with: fbc -s console + +#Include Once "crt/stdlib.bi" ' for qsort + +Function mycmp Cdecl (s1 As Any Pointer, s2 As Any Pointer) As Long + + ' -1 no swap first element before second element + ' 0 no swap needed, don't care + ' 1 swap first element after second element + + Dim As String str1 = *Cast(String Ptr, s1) + Dim As String str2 = *Cast(String Ptr, s2) + + Dim As Long l1 = Len(str1), l2 = Len(str2) + If (l1 > l2) Then Return -1 ' descending + If (l1 < l2) Then Return 1 ' + + ' there equal length, sort ascending + If UCase(str1) = UCase(str2) Then + If str1 > str2 Then Return 1 + Else + If UCase(str1) > UCase(str2) Then Return 1 + End If + + Return 0 + +End Function + +' ------=< MAIN >=------ + +Dim As String words(0 To ...) = {"Here", "are", "some", "sample", _ + "strings", "to", "be", "sorted" } + +Dim As ULong array_size = UBound(words) - LBound(words) + 1 + +qsort(@words(0), array_size, SizeOf(String), @mycmp) + +For i As Integer = 0 To UBound(words) + Print words(i) +Next +Print + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Sort-using-a-custom-comparator/FunL/sort-using-a-custom-comparator.funl b/Task/Sort-using-a-custom-comparator/FunL/sort-using-a-custom-comparator.funl new file mode 100644 index 0000000000..e75e9c44b3 --- /dev/null +++ b/Task/Sort-using-a-custom-comparator/FunL/sort-using-a-custom-comparator.funl @@ -0,0 +1,3 @@ +def preceeds( a, b ) = b.length() < a.length() or b.length() == a.length() and a.compareToIgnoreCase( b ) < 0 + +println( ["here", "are", "Some", "sample", "strings", "to", "be", "sorted"].sortWith(preceeds) ) diff --git a/Task/Sort-using-a-custom-comparator/Nim/sort-using-a-custom-comparator.nim b/Task/Sort-using-a-custom-comparator/Nim/sort-using-a-custom-comparator.nim new file mode 100644 index 0000000000..86bc9acbf0 --- /dev/null +++ b/Task/Sort-using-a-custom-comparator/Nim/sort-using-a-custom-comparator.nim @@ -0,0 +1,8 @@ +import strutils, algorithm + +var strings = "here are Some sample strings to be sorted".split(' ') + +strings.sort(proc (x,y: string): int = + cmp(y.len, x.len)) + +echo strings diff --git a/Task/Sort-using-a-custom-comparator/Oforth/sort-using-a-custom-comparator.oforth b/Task/Sort-using-a-custom-comparator/Oforth/sort-using-a-custom-comparator.oforth new file mode 100644 index 0000000000..dda461ee6a --- /dev/null +++ b/Task/Sort-using-a-custom-comparator/Oforth/sort-using-a-custom-comparator.oforth @@ -0,0 +1,7 @@ +String method: customCmp(s) + s size self size > ifTrue: [ true return ] + s size self size < ifTrue: [ false return ] + s toUpper self toUpper <= ; + +["this", "is", "a", "set", "of", "strings", "to", "sort", "This", "Is", "A", "Set", "Of", "Strings", "To", "Sort"] +sortWith(#customCmp) println diff --git a/Task/Sort-using-a-custom-comparator/Phix/sort-using-a-custom-comparator.phix b/Task/Sort-using-a-custom-comparator/Phix/sort-using-a-custom-comparator.phix new file mode 100644 index 0000000000..6190460a12 --- /dev/null +++ b/Task/Sort-using-a-custom-comparator/Phix/sort-using-a-custom-comparator.phix @@ -0,0 +1,8 @@ +function my_compare(sequence a, sequence b) + if length(a)!=length(b) then + return -compare(length(a),length(b)) + else + return compare(lower(a),lower(b)) + end if +end function +?custom_sort(routine_id("my_compare"),{"Here", "are", "some", "sample", "strings", "to", "be", "sorted"}) diff --git a/Task/Sort-using-a-custom-comparator/Sidef/sort-using-a-custom-comparator.sidef b/Task/Sort-using-a-custom-comparator/Sidef/sort-using-a-custom-comparator.sidef new file mode 100644 index 0000000000..bca5b32c33 --- /dev/null +++ b/Task/Sort-using-a-custom-comparator/Sidef/sort-using-a-custom-comparator.sidef @@ -0,0 +1,3 @@ +func mycmp(a, b) { (b.len <=> a.len) || (a.lc <=> b.lc) }; +var strings = %w(Here are some sample strings to be sorted); +var sorted = strings.sort(mycmp); diff --git a/Task/Sort-using-a-custom-comparator/Swift/sort-using-a-custom-comparator-1.swift b/Task/Sort-using-a-custom-comparator/Swift/sort-using-a-custom-comparator-1.swift new file mode 100644 index 0000000000..6c6e67d882 --- /dev/null +++ b/Task/Sort-using-a-custom-comparator/Swift/sort-using-a-custom-comparator-1.swift @@ -0,0 +1,30 @@ +import Foundation + +var list = ["this", + "is", + "a", + "set", + "of", + "strings", + "to", + "sort", + "This", + "Is", + "A", + "Set", + "Of", + "Strings", + "To", + "Sort"] + +list.sortInPlace {lhs, rhs in + let lhsCount = lhs.characters.count + let rhsCount = rhs.characters.count + let result = rhsCount - lhsCount + + if result == 0 { + return lhs.lowercaseString > rhs.lowercaseString + } + + return lhsCount > rhsCount +} diff --git a/Task/Sort-using-a-custom-comparator/Swift/sort-using-a-custom-comparator-2.swift b/Task/Sort-using-a-custom-comparator/Swift/sort-using-a-custom-comparator-2.swift new file mode 100644 index 0000000000..541cbbb8e4 --- /dev/null +++ b/Task/Sort-using-a-custom-comparator/Swift/sort-using-a-custom-comparator-2.swift @@ -0,0 +1,30 @@ +import Foundation + +var list = ["this", + "is", + "a", + "set", + "of", + "strings", + "to", + "sort", + "This", + "Is", + "A", + "Set", + "Of", + "Strings", + "To", + "Sort"] + +sort(&list) {lhs, rhs in + let lhsCount = count(lhs) + let rhsCount = count(rhs) + let result = rhsCount - lhsCount + + if result == 0 { + return lhs.lowercaseString > rhs.lowercaseString + } + + return lhsCount > rhsCount +} diff --git a/Task/Sort-using-a-custom-comparator/jq/sort-using-a-custom-comparator-1.jq b/Task/Sort-using-a-custom-comparator/jq/sort-using-a-custom-comparator-1.jq new file mode 100644 index 0000000000..da7aeb5913 --- /dev/null +++ b/Task/Sort-using-a-custom-comparator/jq/sort-using-a-custom-comparator-1.jq @@ -0,0 +1,22 @@ +def quicksort(cmp): + if length < 2 then . # it is already sorted + else .[0] as $pivot + | reduce .[] as $x + # state: [less, equal, greater] + ( [ [], [], [] ]; # three empty arrays: + if $x == $pivot then .[1] += [$x] # add x to equal + else ([$x,$pivot]|cmp) as $order + | if $order == 0 then .[1] += [$x] # ditto + elif ($order|type) == "number" then + if $order < 0 then .[0] += [$x] # add x to less + else .[2] += [$x] # add x to greater + end + else ([$pivot,$x]|cmp) as $order2 + | if $order and $order2 then .[1] += [$x] # add x to equal + elif $order then .[0] += [$x] # add x to less + else .[2] += [$x] # add x to greater + end + end + end ) + | (.[0] | quicksort(cmp) ) + .[1] + (.[2] | quicksort(cmp) ) + end ; diff --git a/Task/Sort-using-a-custom-comparator/jq/sort-using-a-custom-comparator-2.jq b/Task/Sort-using-a-custom-comparator/jq/sort-using-a-custom-comparator-2.jq new file mode 100644 index 0000000000..b31094c59c --- /dev/null +++ b/Task/Sort-using-a-custom-comparator/jq/sort-using-a-custom-comparator-2.jq @@ -0,0 +1,3 @@ +# Sort by string length, breaking ties using ordinary string comparison. +["z", "yz", "ab", "c"] + | quicksort( (.[0]|length) > (.[1]|length) or ( (.[0]|length) == (.[1]|length) and .[0] < .[1] ) ) diff --git a/Task/Sort-using-a-custom-comparator/jq/sort-using-a-custom-comparator-3.jq b/Task/Sort-using-a-custom-comparator/jq/sort-using-a-custom-comparator-3.jq new file mode 100644 index 0000000000..75b2103c01 --- /dev/null +++ b/Task/Sort-using-a-custom-comparator/jq/sort-using-a-custom-comparator-3.jq @@ -0,0 +1,6 @@ +[ + "ab", + "yz", + "c", + "z" +] diff --git a/Task/Sorting-algorithms-Bead-sort/Nim/sorting-algorithms-bead-sort.nim b/Task/Sorting-algorithms-Bead-sort/Nim/sorting-algorithms-bead-sort.nim new file mode 100644 index 0000000000..03a026de0f --- /dev/null +++ b/Task/Sorting-algorithms-Bead-sort/Nim/sorting-algorithms-bead-sort.nim @@ -0,0 +1,30 @@ +proc beadSort[T](a: var openarray[T]) = + var max = low(T) + var sum = 0 + + for x in a: + if x > max: max = x + + var beads = newSeq[int](max * a.len) + + for i in 0 .. < a.len: + for j in 0 .. < a[i]: + beads[i * max + j] = 1 + + for j in 0 .. < max: + sum = 0 + for i in 0 .. < a.len: + sum += beads[i * max + j] + beads[i * max + j] = 0 + + for i in a.len - sum .. < a.len: + beads[i * max + j] = 1 + + for i in 0 .. < a.len: + var j = 0 + while j < max and beads[i * max + j] > 0: inc j + a[i] = j + +var a = @[5, 3, 1, 7, 4, 1, 1, 20] +beadSort a +echo a diff --git a/Task/Sorting-algorithms-Bead-sort/Phix/sorting-algorithms-bead-sort.phix b/Task/Sorting-algorithms-Bead-sort/Phix/sorting-algorithms-bead-sort.phix new file mode 100644 index 0000000000..cdaccac081 --- /dev/null +++ b/Task/Sorting-algorithms-Bead-sort/Phix/sorting-algorithms-bead-sort.phix @@ -0,0 +1,13 @@ +function beadsort(sequence a) + sequence poles = repeat(0,max(a)) + for i=1 to length(a) do + poles[1..a[i]] = sq_add(poles[1..a[i]],1) + end for + a[1..$] = 0 + for i=1 to length(poles) do + a[1..poles[i]] = sq_add(a[1..poles[i]],1) + end for + return a +end function + +?beadsort({5, 3, 1, 7, 4, 1, 1, 20}) diff --git a/Task/Sorting-algorithms-Bead-sort/Sidef/sorting-algorithms-bead-sort.sidef b/Task/Sorting-algorithms-Bead-sort/Sidef/sorting-algorithms-bead-sort.sidef new file mode 100644 index 0000000000..8531795ffc --- /dev/null +++ b/Task/Sorting-algorithms-Bead-sort/Sidef/sorting-algorithms-bead-sort.sidef @@ -0,0 +1,16 @@ +func beadsort(arr) { + + var rows = [] + var columns = [] + + for datum in arr { + for column in ^datum { + ++(columns[column] := 0) + ++(rows[columns[column] - 1] := 0) + } + } + + rows.reverse +} + +say beadsort([5,3,1,7,4,1,1]) diff --git a/Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-1.jq b/Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-1.jq new file mode 100644 index 0000000000..8799149f3b --- /dev/null +++ b/Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-1.jq @@ -0,0 +1,7 @@ +# ncols is the number of columns (i.e. vertical poles) +def column_sums(ncols): + . as $abacus + | reduce range(0; ncols) as $col + ([]; + . + [reduce $abacus[] as $row + (0; if $row > $col then .+1 else . end)]) ; diff --git a/Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-2.jq b/Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-2.jq new file mode 100644 index 0000000000..d5605fbfb3 --- /dev/null +++ b/Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-2.jq @@ -0,0 +1,8 @@ +# Generic function to count the number of items in a stream: +def count(stream): reduce stream as $i (0; .+1); + +def readout: + . as $sums + | .[0] as $n + | reduce range(0;$n) as $i + ([]; . + [count( $sums[] | select( . > $i) )]); diff --git a/Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-3.jq b/Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-3.jq new file mode 100644 index 0000000000..155d78c4ad --- /dev/null +++ b/Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-3.jq @@ -0,0 +1 @@ +def bead_sort: column_sums(max) | readout; diff --git a/Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-4.jq b/Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-4.jq new file mode 100644 index 0000000000..46d694e8a4 --- /dev/null +++ b/Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-4.jq @@ -0,0 +1 @@ +[734,3,1,24,324,324,32,432,42,3,4,1,1] | bead_sort diff --git a/Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-5.jq b/Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-5.jq new file mode 100644 index 0000000000..06ee7e5d1e --- /dev/null +++ b/Task/Sorting-algorithms-Bead-sort/jq/sorting-algorithms-bead-sort-5.jq @@ -0,0 +1,2 @@ +$ jq -n -c -f bead_sort.jq +[734,432,324,324,42,32,24,4,3,3,1,1,1] diff --git a/Task/Sorting-algorithms-Bogosort/Nim/sorting-algorithms-bogosort.nim b/Task/Sorting-algorithms-Bogosort/Nim/sorting-algorithms-bogosort.nim new file mode 100644 index 0000000000..2f8ee009f8 --- /dev/null +++ b/Task/Sorting-algorithms-Bogosort/Nim/sorting-algorithms-bogosort.nim @@ -0,0 +1,22 @@ +import math +randomize() + +proc shuffle[T](x: var openarray[T]) = + for i in countdown(x.high, 0): + let j = random(i + 1) + swap(x[i], x[j]) + +proc isSorted[T](s: openarray[T]): bool = + var last = low(T) + for c in s: + if c < last: + return false + last = c + return true + +proc bogoSort[T](a: var openarray[T]) = + while not isSorted a: shuffle a + +var a = @[4, 65, 2, -31, 0, 99, 2, 83, 782] +bogoSort a +echo a diff --git a/Task/Sorting-algorithms-Bogosort/Phix/sorting-algorithms-bogosort.phix b/Task/Sorting-algorithms-Bogosort/Phix/sorting-algorithms-bogosort.phix new file mode 100644 index 0000000000..aeb99875a1 --- /dev/null +++ b/Task/Sorting-algorithms-Bogosort/Phix/sorting-algorithms-bogosort.phix @@ -0,0 +1,13 @@ +function inOrder(sequence s) + return s==sort(s) -- +end function + +function bogosort(sequence s) + while not inOrder(s) do + ? s + s = shuffle(s) + end while + return s +end function + +? bogosort(shuffle({1,2,3,4,5,6})) diff --git a/Task/Sorting-algorithms-Bogosort/Sidef/sorting-algorithms-bogosort.sidef b/Task/Sorting-algorithms-Bogosort/Sidef/sorting-algorithms-bogosort.sidef new file mode 100644 index 0000000000..cb79f37ff7 --- /dev/null +++ b/Task/Sorting-algorithms-Bogosort/Sidef/sorting-algorithms-bogosort.sidef @@ -0,0 +1,14 @@ +func in_order(a) { + return true if (a.len <= 1); + var first = a[0]; + a.ft(1).all { |elem| first <= elem ? do { first = elem; true } : false } +} + +func bogosort(a) { + a.shuffle! while !in_order(a); + return a; +} + +var arr = 5.of{ 100.rand.int }; +say "Before: #{arr}"; +say "After: #{bogosort(arr)}"; diff --git a/Task/Sorting-algorithms-Bogosort/Swift/sorting-algorithms-bogosort.swift b/Task/Sorting-algorithms-Bogosort/Swift/sorting-algorithms-bogosort.swift new file mode 100644 index 0000000000..3586fb8616 --- /dev/null +++ b/Task/Sorting-algorithms-Bogosort/Swift/sorting-algorithms-bogosort.swift @@ -0,0 +1,23 @@ +import Darwin + +func shuffle(inout array: [T]) { + for i in 1..(ary: [T]) -> Bool { + for i in 0..<(ary.count-1) { + if ary[i] > ary[i+1] { + return false + } + } + return true +} + +func bogosort(inout ary: [T]) { + while !issorted(ary) { + shuffle(&ary) + } +} diff --git a/Task/Sorting-algorithms-Bubble-sort/ERRE/sorting-algorithms-bubble-sort.erre b/Task/Sorting-algorithms-Bubble-sort/ERRE/sorting-algorithms-bubble-sort.erre new file mode 100644 index 0000000000..add6d208d7 --- /dev/null +++ b/Task/Sorting-algorithms-Bubble-sort/ERRE/sorting-algorithms-bubble-sort.erre @@ -0,0 +1,31 @@ +PROGRAM BUBBLE_SORT + +DIM FLIPS%,N,J + +DIM A%[100] + +BEGIN + +! init random number generator + RANDOMIZE(TIMER) +! fills array A% with random data + FOR N=1 TO UBOUND(A%,1) DO + A%[N]=RND(1)*256 + END FOR +! sort array + FLIPS%=TRUE + WHILE FLIPS% DO + FLIPS%=FALSE + FOR N=1 TO UBOUND(A%,1)-1 DO + IF A%[N]>A%[N+1] THEN + SWAP(A%[N],A%[N+1]) + FLIPS%=TRUE + END IF + END FOR + END WHILE +! print sorted array + FOR N=1 TO UBOUND(A%,1) DO + PRINT(A%[N];) + END FOR + PRINT +END PROGRAM diff --git a/Task/Sorting-algorithms-Bubble-sort/EchoLisp/sorting-algorithms-bubble-sort.echolisp b/Task/Sorting-algorithms-Bubble-sort/EchoLisp/sorting-algorithms-bubble-sort.echolisp new file mode 100644 index 0000000000..fdd2a5b2db --- /dev/null +++ b/Task/Sorting-algorithms-Bubble-sort/EchoLisp/sorting-algorithms-bubble-sort.echolisp @@ -0,0 +1,16 @@ +;; sorts a vector of objects in place +;; proc is an user defined comparison procedure + +(define (bubble-sort V proc) +(define length (vector-length V)) + (for* ((i (in-range 0 (1- length))) (j (in-range (1+ i) length))) + (unless (proc (vector-ref V i) (vector-ref V j)) (vector-swap! V i j))) + V) + + +(define V #( albert antoinette elvis zen simon)) +(define (sort/length a b) ;; sort by string length + (< (string-length a) (string-length b))) + +(bubble-sort V sort/length) + → #(zen simon elvis albert antoinette) diff --git a/Task/Sorting-algorithms-Bubble-sort/Ezhil/sorting-algorithms-bubble-sort.ezhil b/Task/Sorting-algorithms-Bubble-sort/Ezhil/sorting-algorithms-bubble-sort.ezhil new file mode 100644 index 0000000000..5d8ee4ca46 --- /dev/null +++ b/Task/Sorting-algorithms-Bubble-sort/Ezhil/sorting-algorithms-bubble-sort.ezhil @@ -0,0 +1,65 @@ +## இந்த நிரல் ஒரு பட்டியலில் உள்ள எண்களை Bubble Sort என்ற முறைப்படி ஏறுவரிசையிலும் பின்னர் அதையே இறங்குவரிசையிலும் அடுக்கித் தரும் + +## மாதிரிக்கு நாம் ஏழு எண்களை எடுத்துக்கொள்வோம் + +எண்கள் = [5, 1, 10, 8, 1, 21, 4, 2] +எண்கள்பிரதி = எண்கள் + +பதிப்பி "ஆரம்பப் பட்டியல்:" +பதிப்பி எண்கள் + +நீளம் = len(எண்கள்) +குறைநீளம் = நீளம் - 1 + +@(குறைநீளம் != -1) வரை + மாற்றம் = -1 + @(எண் = 0, எண் < குறைநீளம், எண் = எண் + 1) ஆக + முதலெண் = எடு(எண்கள், எண்) + இரண்டாமெண் = எடு(எண்கள், எண் + 1) + @(முதலெண் > இரண்டாமெண்) ஆனால் + + ## பெரிய எண்களை ஒவ்வொன்றாகப் பின்னே நகர்த்துகிறோம் + + வெளியேஎடு(எண்கள், எண்) + நுழைக்க(எண்கள், எண், இரண்டாமெண்) + வெளியேஎடு(எண்கள், எண் + 1) + நுழைக்க(எண்கள், எண் + 1, முதலெண்) + மாற்றம் = எண் + முடி + முடி + குறைநீளம் = மாற்றம் +முடி + +பதிப்பி "ஏறு வரிசையில் அமைக்கப்பட்ட பட்டியல்:" +பதிப்பி எண்கள் + +## இதனை இறங்குவரிசைக்கு மாற்றுவதற்கு எளிய வழி + +தலைகீழ்(எண்கள்) + +## இப்போது, நாம் ஏற்கெனவே எடுத்துவைத்த எண்களின் பிரதியை Bubble Sort முறைப்படி இறங்குவரிசைக்கு மாற்றுவோம் + +நீளம் = len(எண்கள்பிரதி) +குறைநீளம் = நீளம் - 1 + +@(குறைநீளம் != -1) வரை + மாற்றம் = -1 + @(எண் = 0, எண் < குறைநீளம், எண் = எண் + 1) ஆக + முதலெண் = எடு(எண்கள்பிரதி, எண்) + இரண்டாமெண் = எடு(எண்கள்பிரதி, எண் + 1) + @(முதலெண் < இரண்டாமெண்) ஆனால் + + ## சிறிய எண்களை ஒவ்வொன்றாகப் பின்னே நகர்த்துகிறோம் + + வெளியேஎடு(எண்கள்பிரதி, எண்) + நுழைக்க(எண்கள்பிரதி, எண், இரண்டாமெண்) + வெளியேஎடு(எண்கள்பிரதி, எண் + 1) + நுழைக்க(எண்கள்பிரதி, எண் + 1, முதலெண்) + மாற்றம் = எண் + முடி + முடி + குறைநீளம் = மாற்றம் +முடி + +பதிப்பி "இறங்கு வரிசையில் அமைக்கப்பட்ட பட்டியல்:" +பதிப்பி எண்கள்பிரதி diff --git a/Task/Sorting-algorithms-Bubble-sort/FreeBASIC/sorting-algorithms-bubble-sort.freebasic b/Task/Sorting-algorithms-Bubble-sort/FreeBASIC/sorting-algorithms-bubble-sort.freebasic new file mode 100644 index 0000000000..01b978d8a7 --- /dev/null +++ b/Task/Sorting-algorithms-Bubble-sort/FreeBASIC/sorting-algorithms-bubble-sort.freebasic @@ -0,0 +1,47 @@ +' version 21-10-2016 +' compile with: fbc -s console +' for boundry checks on array's compile with: fbc -s console -exx + +Sub bubblesort(bs() As Long) + ' sort from lower bound to the highter bound + ' array's can have subscript range from -2147483648 to +2147483647 + Dim As Long lb = LBound(bs) + Dim As Long ub = UBound(bs) + Dim As Long done, i + + Do + done = 0 + For i = lb To ub -1 + ' replace "<" with ">" for downwards sort + If bs(i) > bs(i +1) Then + Swap bs(i), bs(i +1) + done = 1 + End If + Next + Loop Until done = 0 + +End Sub + +' ------=< MAIN >=------ + +Dim As Long i, array(-7 To 7) + +Dim As Long a = LBound(array), b = UBound(array) + +Randomize Timer +For i = a To b : array(i) = i : Next +For i = a To b ' little shuffle + Swap array(i), array(Int(Rnd * (b - a +1)) + a) +Next + +Print "unsort "; +For i = a To b : Print Using "####"; array(i); : Next : Print +bubblesort(array()) ' sort the array +Print " sort "; +For i = a To b : Print Using "####"; array(i); : Next : Print + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Sorting-algorithms-Bubble-sort/Nim/sorting-algorithms-bubble-sort.nim b/Task/Sorting-algorithms-Bubble-sort/Nim/sorting-algorithms-bubble-sort.nim new file mode 100644 index 0000000000..285e507306 --- /dev/null +++ b/Task/Sorting-algorithms-Bubble-sort/Nim/sorting-algorithms-bubble-sort.nim @@ -0,0 +1,13 @@ +proc bubbleSort[T](a: var openarray[T]) = + var t = true + for n in countdown(a.len-2, 0): + if not t: break + t = false + for j in 0..n: + if a[j] <= a[j+1]: continue + swap a[j], a[j+1] + t = true + +var a = @[4, 65, 2, -31, 0, 99, 2, 83, 782] +bubbleSort a +echo a diff --git a/Task/Sorting-algorithms-Bubble-sort/Phix/sorting-algorithms-bubble-sort.phix b/Task/Sorting-algorithms-Bubble-sort/Phix/sorting-algorithms-bubble-sort.phix new file mode 100644 index 0000000000..2b5819d258 --- /dev/null +++ b/Task/Sorting-algorithms-Bubble-sort/Phix/sorting-algorithms-bubble-sort.phix @@ -0,0 +1,21 @@ +function bubble_sort(sequence s) +object tmp +integer changed + for j=length(s) to 1 by -1 do + changed = 0 + for i=1 to j-1 do + if s[i]>s[i+1] then + {s[i],s[i+1],changed} = {s[i+1],s[i],1} + end if + end for + if changed=0 then exit end if + end for + return s +end function + +constant s = {4, 15, "delta", 2, -31, 0, "alfa", 19, "gamma", 2, 13, "beta", 782, 1} + +puts(1,"Before: ") +?s +puts(1,"After: ") +?bubble_sort(s) diff --git a/Task/Sorting-algorithms-Bubble-sort/Ra/sorting-algorithms-bubble-sort.ra b/Task/Sorting-algorithms-Bubble-sort/Ra/sorting-algorithms-bubble-sort.ra new file mode 100644 index 0000000000..2b003cf166 --- /dev/null +++ b/Task/Sorting-algorithms-Bubble-sort/Ra/sorting-algorithms-bubble-sort.ra @@ -0,0 +1,31 @@ +class BubbleSort + **Sort a list with the Bubble Sort algorithm** + + on start + + args := program arguments + .sort(args) + print args + + define sort(list) is shared + **Sort the list** + + test + list := [4, 2, 7, 3] + .sort(list) + assert list = [2, 3, 4, 7] + + body + last := list.count - 1 + + post while changed + + changed := false + + for i in last + + if list[i] > list[i + 1] + temp := list[i] + list[i] := list[i + 1] + list[i + 1] := temp + changed := true diff --git a/Task/Sorting-algorithms-Bubble-sort/Ring/sorting-algorithms-bubble-sort.ring b/Task/Sorting-algorithms-Bubble-sort/Ring/sorting-algorithms-bubble-sort.ring new file mode 100644 index 0000000000..46960a239e --- /dev/null +++ b/Task/Sorting-algorithms-Bubble-sort/Ring/sorting-algorithms-bubble-sort.ring @@ -0,0 +1,18 @@ +bubbleList = [4,2,1,3] +flag = 0 +bubbleSort(bubbleList) +see bubbleList + +func bubbleSort A + n = len(A) + while flag = 0 + flag = 1 + for i = 1 to n-1 + if A[i] > A[i+1] + temp = A[i] + A[i] = A[i+1] + A[i+1] = temp + flag = 0 + ok + next + end diff --git a/Task/Sorting-algorithms-Bubble-sort/Sidef/sorting-algorithms-bubble-sort.sidef b/Task/Sorting-algorithms-Bubble-sort/Sidef/sorting-algorithms-bubble-sort.sidef new file mode 100644 index 0000000000..f8f81a0f21 --- /dev/null +++ b/Task/Sorting-algorithms-Bubble-sort/Sidef/sorting-algorithms-bubble-sort.sidef @@ -0,0 +1,13 @@ +func bubble_sort(arr) { + loop { + var swapped = false + { |i| + if (arr[i-1] > arr[i]) { + arr[i-1, i] = arr[i, i-1] + swapped = true + } + } * arr.end + swapped || break + } + return arr +} diff --git a/Task/Sorting-algorithms-Bubble-sort/Swift/sorting-algorithms-bubble-sort.swift b/Task/Sorting-algorithms-Bubble-sort/Swift/sorting-algorithms-bubble-sort.swift new file mode 100644 index 0000000000..34575acc0b --- /dev/null +++ b/Task/Sorting-algorithms-Bubble-sort/Swift/sorting-algorithms-bubble-sort.swift @@ -0,0 +1,12 @@ +func bubbleSort(inout list:[T]) { + var done = false + while !done { + done = true + for i in 1.. list[i] { + (list[i], list[i - 1]) = (list[i - 1], list[i]) + done = false + } + } + } +} diff --git a/Task/Sorting-algorithms-Bubble-sort/jq/sorting-algorithms-bubble-sort-1.jq b/Task/Sorting-algorithms-Bubble-sort/jq/sorting-algorithms-bubble-sort-1.jq new file mode 100644 index 0000000000..451feb3b7a --- /dev/null +++ b/Task/Sorting-algorithms-Bubble-sort/jq/sorting-algorithms-bubble-sort-1.jq @@ -0,0 +1,14 @@ +def bubble_sort: + def swap(i;j): .[i] as $x | .[i]=.[j] | .[j]=$x; + + # input/output: [changed, list] + reduce range(0; length) as $i + ( [false, .]; + if $i > 0 and (.[0]|not) then . + else reduce range(0; (.[1]|length) - $i - 1) as $j + (.[0] = false; + .[1] as $list + | if $list[$j] > $list[$j + 1] then [true, ($list|swap($j; $j+1))] + else . + end ) + end ) | .[1] ; diff --git a/Task/Sorting-algorithms-Bubble-sort/jq/sorting-algorithms-bubble-sort-2.jq b/Task/Sorting-algorithms-Bubble-sort/jq/sorting-algorithms-bubble-sort-2.jq new file mode 100644 index 0000000000..124524a86b --- /dev/null +++ b/Task/Sorting-algorithms-Bubble-sort/jq/sorting-algorithms-bubble-sort-2.jq @@ -0,0 +1,5 @@ +( + [3,2,1], + [1,2,3], + ["G", "F", "C", "A", "B", "E", "D"] +) | bubble_sort diff --git a/Task/Sorting-algorithms-Bubble-sort/jq/sorting-algorithms-bubble-sort-3.jq b/Task/Sorting-algorithms-Bubble-sort/jq/sorting-algorithms-bubble-sort-3.jq new file mode 100644 index 0000000000..b686e53be5 --- /dev/null +++ b/Task/Sorting-algorithms-Bubble-sort/jq/sorting-algorithms-bubble-sort-3.jq @@ -0,0 +1,4 @@ +$ jq -c -n -f Bubble_sort.jq +[1,2,3] +[1,2,3] +["A","B","C","D","E","F","G"] diff --git a/Task/Sorting-algorithms-Cocktail-sort/FreeBASIC/sorting-algorithms-cocktail-sort.freebasic b/Task/Sorting-algorithms-Cocktail-sort/FreeBASIC/sorting-algorithms-cocktail-sort.freebasic new file mode 100644 index 0000000000..1a8e9ee04d --- /dev/null +++ b/Task/Sorting-algorithms-Cocktail-sort/FreeBASIC/sorting-algorithms-cocktail-sort.freebasic @@ -0,0 +1,58 @@ +' version 21-10-2016 +' compile with: fbc -s console +' for boundry checks on array's compile with: fbc -s console -exx + +Sub cocktailsort(bs() As Long) + ' sort from lower bound to the highter bound + ' array's can have subscript range from -2147483648 to +2147483647 + Dim As Long lb = LBound(bs) + Dim As Long ub = UBound(bs) -1 + Dim As Long done, i + + Do + done = 0 ' going up + For i = lb To ub + If bs(i) > bs(i +1) Then + Swap bs(i), bs(i +1) + done = 1 + End If + Next + ub = ub -1 + If done = 0 Then Exit Do ' 0 means the array is sorted + done = 0 ' going down + For i = ub To lb Step -1 + If bs(i) > bs(i +1) Then + Swap bs(i), bs(i +1) + done = 1 + End If + Next + lb = lb +1 + Loop Until done = 0 ' 0 means the array is sorted + +End Sub + +' ------=< MAIN >=------ + +Dim As Long i, array(-7 To 7) + +Dim As Long a = LBound(array), b = UBound(array) + +Randomize Timer +For i = a To b : array(i) = i : Next +For i = a To b ' little shuffle + Swap array(i), array(Int(Rnd * (b - a +1)) + a) +Next + + +Print "unsorted "; +For i = a To b : Print Using "####"; array(i); : Next : Print +cocktailsort(array()) ' sort the array +Print " sorted "; +For i = a To b : Print Using "####"; array(i); : Next : Print + + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Sorting-algorithms-Cocktail-sort/Nim/sorting-algorithms-cocktail-sort.nim b/Task/Sorting-algorithms-Cocktail-sort/Nim/sorting-algorithms-cocktail-sort.nim new file mode 100644 index 0000000000..355cae850a --- /dev/null +++ b/Task/Sorting-algorithms-Cocktail-sort/Nim/sorting-algorithms-cocktail-sort.nim @@ -0,0 +1,17 @@ +template trySwap(): stmt {.immediate.} = + if a[i] < a[i-1]: + swap a[i], a[i-1] + t = false + +proc cocktailSort[T](a: var openarray[T]) = + var t = false + var l = a.len + while not t: + t = true + for i in 1 .. s[i+1] then + {s[i],s[i+1],swapped} = {s[i+1],s[i],1} + end if + end for + -- swap to and from, and flip direction. + -- additionally, we can reduce one element to be + -- examined, depending on which way we just went. + {f,t,d} = {t-(d=1),f-(d=-1),-d} + end while + return s +end function + +constant s = sq_rand(repeat(1000,10)) +? s +? cocktail_sort(s) diff --git a/Task/Sorting-algorithms-Cocktail-sort/Ring/sorting-algorithms-cocktail-sort.ring b/Task/Sorting-algorithms-Cocktail-sort/Ring/sorting-algorithms-cocktail-sort.ring new file mode 100644 index 0000000000..d6dc44c812 --- /dev/null +++ b/Task/Sorting-algorithms-Cocktail-sort/Ring/sorting-algorithms-cocktail-sort.ring @@ -0,0 +1,20 @@ +aList = [ 5, 6, 1, 2, 9, 14, 2, 15, 6, 7, 8, 97] +flag = 0 +cocktailSort(aList) +for i=1 to len(aList) + see "" + aList[i] + " " +next + +func cocktailSort A + n = len(A) + while flag = 0 + flag = 1 + for i = 1 to n-1 + if A[i] > A[i+1] + temp = A[i] + A[i] = A[i+1] + A [i+1] = temp + flag = 0 + ok + next + end diff --git a/Task/Sorting-algorithms-Cocktail-sort/Sidef/sorting-algorithms-cocktail-sort-1.sidef b/Task/Sorting-algorithms-Cocktail-sort/Sidef/sorting-algorithms-cocktail-sort-1.sidef new file mode 100644 index 0000000000..7f433c121e --- /dev/null +++ b/Task/Sorting-algorithms-Cocktail-sort/Sidef/sorting-algorithms-cocktail-sort-1.sidef @@ -0,0 +1,16 @@ +func cocktailsort(a) { + var swapped = false; + func cmpsw(i) { + if (a[i] > a[i+1]) { + a[i, i+1] = a[i+1, i]; + swapped = true; + } + } + var max = a.end; + do { + { |i| cmpsw(i-1) } * max; + swapped.not! && break; + { |i| cmpsw(max-i) } * max; + } while (swapped); + return a; +} diff --git a/Task/Sorting-algorithms-Cocktail-sort/Sidef/sorting-algorithms-cocktail-sort-2.sidef b/Task/Sorting-algorithms-Cocktail-sort/Sidef/sorting-algorithms-cocktail-sort-2.sidef new file mode 100644 index 0000000000..c9b44ee617 --- /dev/null +++ b/Task/Sorting-algorithms-Cocktail-sort/Sidef/sorting-algorithms-cocktail-sort-2.sidef @@ -0,0 +1,5 @@ +var numbers = [7,6,5,9,8,4,3,1,2,0]; +say cocktailsort(numbers).dump; + +var strs = ["John", "Kate", "Zerg", "Alice", "Joe", "Jane"]; +say cocktailsort(strs).dump; diff --git a/Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-1.jq b/Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-1.jq new file mode 100644 index 0000000000..2eed54d657 --- /dev/null +++ b/Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-1.jq @@ -0,0 +1,5 @@ +# In case your jq does not have "until" defined: +def until(cond; next): + def _until: + if cond then . else (next|_until) end; + _until; diff --git a/Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-2.jq b/Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-2.jq new file mode 100644 index 0000000000..423a12e03a --- /dev/null +++ b/Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-2.jq @@ -0,0 +1,23 @@ +def cocktailSort: + def swap(i;j): .[i] as $t | .[i] = .[j] | .[j] = $t; + + def shake(stream): + reduce stream as $i + (.[0]=false; + .[1] as $A + | if $A[ $i ] > $A[ $i+1 ] then + [true, ($A|swap( $i; $i+1 ))] + else . + end); + + (length - 2) as $lm2 + # state: [swapped, A] + | [true, .] + | until( .[0]|not; + shake(range(0; $lm2 + 1)) + | if .[0] then + # for each i in length( A ) - 2 down to 0 + shake( $lm2 - range(0; $lm2 + 1)) + else . + end ) + | .[1]; diff --git a/Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-3.jq b/Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-3.jq new file mode 100644 index 0000000000..b7f3addaf7 --- /dev/null +++ b/Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-3.jq @@ -0,0 +1,13 @@ +def verify: if cocktailSort == sort then empty else . end; + +([], + [1], + [1,1], + [3, 14], + [33, 14], + [3, 14, 1, 5, 9, 2, 6, 3], + [23,76,99,58,97,57,35,89,51,38,95,92,24,46,31,24,14,12,57,78,4], + [88,18,31,44,4,0,8,81,14,78,20,76,84,33,73,75,82,5,62,70,12,7,1], + [1.5, -1.5], + ["cocktail", ["sort"], null, {}] +) | verify diff --git a/Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-4.jq b/Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-4.jq new file mode 100644 index 0000000000..83af692234 --- /dev/null +++ b/Task/Sorting-algorithms-Cocktail-sort/jq/sorting-algorithms-cocktail-sort-4.jq @@ -0,0 +1,2 @@ +$ jq -n -c -f cocktail_sort.jq +$ diff --git a/Task/Sorting-algorithms-Comb-sort/FreeBASIC/sorting-algorithms-comb-sort.freebasic b/Task/Sorting-algorithms-Comb-sort/FreeBASIC/sorting-algorithms-comb-sort.freebasic new file mode 100644 index 0000000000..53ec6548d3 --- /dev/null +++ b/Task/Sorting-algorithms-Comb-sort/FreeBASIC/sorting-algorithms-comb-sort.freebasic @@ -0,0 +1,87 @@ +' version 21-10-2016 +' compile with: fbc -s console +' for boundary checks on array's compile with: fbc -s console -exx + +Sub compsort(bs() As Long) + ' sort from lower bound to the highter bound + ' array's can have subscript range from -2147483648 to +2147483647 + Dim As Long lb = LBound(bs) + Dim As Long ub = UBound(bs) + Dim As Long gap = ub - lb + Dim As Long done, i + + Do + gap = Int (gap / 1.3) + If gap < 1 Then gap = 1 + done = 0 + For i = lb To ub - gap + If bs(i) > bs(i + gap) Then + Swap bs(i), bs(i + gap) + done = 1 + End If + Next + Loop Until ((gap = 1) And (done = 0)) + +End Sub + +Sub comp11sort(bs() As Long) + ' sort from lower bound to the higher bound + ' array's can have subscript range from -2147483648 to +2147483647 + Dim As Long lb = LBound(bs) + Dim As Long ub = UBound(bs) + Dim As Long gap = ub - lb + Dim As Long done, i + + Do + gap = Int(gap / 1.24733) + If gap = 9 Or gap = 10 Then + gap = 11 + ElseIf gap < 1 Then + gap = 1 + End If + done = 0 + For i = lb To ub - gap + If bs(i) > bs(i + gap) Then + Swap bs(i), bs(i + gap) + done = 1 + End If + Next + Loop Until ((gap = 1) And (done = 0)) + +End Sub + +' ------=< MAIN >=------ + +Dim As Long i, array(-7 To 7) + +Dim As Long a = LBound(array), b = UBound(array) + +Randomize Timer +For i = a To b : array(i) = i : Next +For i = a To b ' little shuffle + Swap array(i), array(Int(Rnd * (b - a +1)) + a) +Next + +Print "normal comb sort" +Print "unsorted "; +For i = a To b : Print Using "####"; array(i); : Next : Print +compsort(array()) ' sort the array +Print " sorted "; +For i = a To b : Print Using "####"; array(i); : Next : Print + +Print +Print "comb11 sort" +For i = a To b ' little shuffle + Swap array(i), array(Int(Rnd * (b - a +1)) + a) +Next +Print "unsorted "; +For i = a To b : Print Using "####"; array(i); : Next : Print +comp11sort(array()) ' sort the array +Print " sorted "; +For i = a To b : Print Using "####"; array(i); : Next : Print + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Sorting-algorithms-Comb-sort/Nim/sorting-algorithms-comb-sort.nim b/Task/Sorting-algorithms-Comb-sort/Nim/sorting-algorithms-comb-sort.nim new file mode 100644 index 0000000000..e513537893 --- /dev/null +++ b/Task/Sorting-algorithms-Comb-sort/Nim/sorting-algorithms-comb-sort.nim @@ -0,0 +1,18 @@ +proc combSort[T](a: var openarray[T]) = + var gap = a.len + var swapped = true + while gap > 1 or swapped: + gap = gap * 10 div 13 + if gap == 9 or gap == 10: gap = 11 + if gap < 1: gap = 1 + swapped = false + var i = 0 + for j in gap .. a[j]: + swap a[i], a[j] + swapped = true + inc i + +var a = @[4, 65, 2, -31, 0, 99, 2, 83, 782] +combSort a +echo a diff --git a/Task/Sorting-algorithms-Comb-sort/Phix/sorting-algorithms-comb-sort.phix b/Task/Sorting-algorithms-Comb-sort/Phix/sorting-algorithms-comb-sort.phix new file mode 100644 index 0000000000..8e91c7d2d1 --- /dev/null +++ b/Task/Sorting-algorithms-Comb-sort/Phix/sorting-algorithms-comb-sort.phix @@ -0,0 +1,17 @@ +function comb_sort(sequence s) +integer gap = length(s)-1 + while 1 do + gap = max(floor(gap/1.3),1) + integer swapped = 0 + for i=1 to length(s)-gap do + object si = s[i] + if si>s[i+gap] then + s[i] = s[i+gap] + s[i+gap] = si + swapped = 1 + end if + end for + if gap=1 and swapped=0 then exit end if + end while + return s +end function diff --git a/Task/Sorting-algorithms-Comb-sort/Ring/sorting-algorithms-comb-sort.ring b/Task/Sorting-algorithms-Comb-sort/Ring/sorting-algorithms-comb-sort.ring new file mode 100644 index 0000000000..d807df524d --- /dev/null +++ b/Task/Sorting-algorithms-Comb-sort/Ring/sorting-algorithms-comb-sort.ring @@ -0,0 +1,20 @@ +aList = [3,5,1,2,7,4,8,3,6,4,1] +see combsort(aList) + +func combsort t + gapd = 1.2473 + gap = len(t) + swaps = 0 + while gap + swaps > 1 + k = 0 + swaps = 0 + if gap > 1 gap = floor(gap / gapd) ok + for k = 1 to len(t) - gap + if t[k] > t[k + gap] + temp = t[k] + t[k] = t[k + gap] + t[k + gap] = temp + swaps = swaps + 1 ok + next + end + return t diff --git a/Task/Sorting-algorithms-Comb-sort/Sidef/sorting-algorithms-comb-sort.sidef b/Task/Sorting-algorithms-Comb-sort/Sidef/sorting-algorithms-comb-sort.sidef new file mode 100644 index 0000000000..5bdfbf4363 --- /dev/null +++ b/Task/Sorting-algorithms-Comb-sort/Sidef/sorting-algorithms-comb-sort.sidef @@ -0,0 +1,15 @@ +func comb_sort(arr) { + var gap = arr.len; + var swaps = true; + while (gap > 1 || swaps) { + gap.div!(1.25).int! if (gap > 1); + swaps = false; + for i in ^(arr.len - gap) { + if (arr[i] > arr[i+gap]) { + arr[i, i+gap] = arr[i+gap, i]; + swaps = true; + } + } + } + return arr; +} diff --git a/Task/Sorting-algorithms-Comb-sort/Swift/sorting-algorithms-comb-sort.swift b/Task/Sorting-algorithms-Comb-sort/Swift/sorting-algorithms-comb-sort.swift new file mode 100644 index 0000000000..c6317b22a7 --- /dev/null +++ b/Task/Sorting-algorithms-Comb-sort/Swift/sorting-algorithms-comb-sort.swift @@ -0,0 +1,23 @@ +func combSort(inout list:[Int]) { + var swapped = true + var gap = list.count + + while gap > 1 || swapped { + gap = gap * 10 / 13 + + if gap == 9 || gap == 10 { + gap = 11 + } else if gap < 1 { + gap = 1 + } + + swapped = false + + for var i = 0, j = gap; j < list.count; i++, j++ { + if list[i] > list[j] { + (list[i], list[j]) = (list[j], list[i]) + swapped = true + } + } + } +} diff --git a/Task/Sorting-algorithms-Comb-sort/jq/sorting-algorithms-comb-sort.jq b/Task/Sorting-algorithms-Comb-sort/jq/sorting-algorithms-comb-sort.jq new file mode 100644 index 0000000000..e0f1540892 --- /dev/null +++ b/Task/Sorting-algorithms-Comb-sort/jq/sorting-algorithms-comb-sort.jq @@ -0,0 +1,34 @@ +# Input should be the array to be sorted. +def combsort: + + # As soon as "condition" is true, emit . and stop: + def do_until(condition; next): + def u: if condition then . else (next|u) end; + u; + + def swap(i;j): + if i==j then . else .[i] as $tmp | .[i] = .[j] | .[j] = $tmp end; + + . as $in + | length as $length + # state: [gap, swaps, array] where: + # gap is the gap size; + # swaps is a boolean flag indicating a swap has occurred, + # implying that the array might not be sorted; + # array is the current state of the array being sorted + | [ $length, false, $in ] + | do_until( .[0] == 1 and .[1] == false; + # update the gap value for the next "comb": + ([1, ((.[0] / 1.25) | floor)] | max) as $gap # minimum gap is 1 + + # state: [i, swaps, array] + | [0, false, .[2]] + # a single "comb" over the input list: + | do_until( (.[0] + $gap) >= $length; + .[0] as $i + | if .[2][$i] > .[2][$i+$gap] then + [$i+1, true, (.[2]|swap($i; $i+$gap))] + else .[0] += 1 + end) + | .[0] = $gap ) + | .[2] ; diff --git a/Task/Sorting-algorithms-Counting-sort/FreeBASIC/sorting-algorithms-counting-sort.freebasic b/Task/Sorting-algorithms-Counting-sort/FreeBASIC/sorting-algorithms-counting-sort.freebasic new file mode 100644 index 0000000000..2a9aa7902d --- /dev/null +++ b/Task/Sorting-algorithms-Counting-sort/FreeBASIC/sorting-algorithms-counting-sort.freebasic @@ -0,0 +1,59 @@ +' FB 1.05.0 Win64 + +Function findMax(array() As Integer) As Integer + Dim length As Integer = UBound(array) - LBound(array) + 1 + If length = 0 Then Return 0 '' say + If length = 1 Then Return array(LBound(array)) + Dim max As Integer = LBound(array) + For i As Integer = LBound(array) + 1 To UBound(array) + If array(i) > max Then max = array(i) + Next + Return max +End Function + +Function findMin(array() As Integer) As Integer + Dim length As Integer = UBound(array) - LBound(array) + 1 + If length = 0 Then Return 0 '' say + If length = 1 Then Return array(LBound(array)) + Dim min As Integer = LBound(array) + For i As Integer = LBound(array) + 1 To UBound(array) + If array(i) < min Then min = array(i) + Next + Return min +End Function + +Sub countingSort(array() As Integer, min As Integer, max As Integer) + Dim count(0 To max - min) As Integer '' all zero by default + Dim As Integer number, z + For i As Integer = LBound(array) To UBound(array) + number = array(i) + count(number - min) += 1 + Next + z = LBound(array) + For i As Integer = min To max + While count(i - min) > 0 + array(z) = i + z += 1 + count(i - min) -= 1 + Wend + Next +End Sub + +Sub printArray(array() As Integer) + For i As Integer = LBound(array) To UBound(array) + Print Using "####"; array(i); + Next + Print +End Sub + +Dim array(1 To 10) As Integer = {4, 65, 2, -31, 0, 99, 2, 83, 782, 1} '' using BBC BASIC example array +Print "Unsorted : "; +printArray(array()) +Dim max As Integer = findMax(array()) +Dim min As Integer = findMin(array()) +countingSort array(), min, max +Print "Sorted : "; +printArray(array()) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Sorting-algorithms-Counting-sort/Nim/sorting-algorithms-counting-sort.nim b/Task/Sorting-algorithms-Counting-sort/Nim/sorting-algorithms-counting-sort.nim new file mode 100644 index 0000000000..20444498d3 --- /dev/null +++ b/Task/Sorting-algorithms-Counting-sort/Nim/sorting-algorithms-counting-sort.nim @@ -0,0 +1,15 @@ +proc countingSort[T](a: var openarray[T]; min, max: int) = + let range = max - min + 1 + var count = newSeq[T](range) + var z = 0 + + for i in 0 .. < a.len: inc count[a[i] - min] + + for i in min .. max: + for j in 0 .. 0 + f[z] = i + z = z + 1 + count[i] = count[i] - 1 + end + next + return f diff --git a/Task/Sorting-algorithms-Counting-sort/Sidef/sorting-algorithms-counting-sort.sidef b/Task/Sorting-algorithms-Counting-sort/Sidef/sorting-algorithms-counting-sort.sidef new file mode 100644 index 0000000000..711daeb2ae --- /dev/null +++ b/Task/Sorting-algorithms-Counting-sort/Sidef/sorting-algorithms-counting-sort.sidef @@ -0,0 +1,8 @@ +func counting_sort(a, min, max) { + var cnt = ([0] * (max - min + 1)); + a.each { |i| cnt[i-min]++ }; + return cnt.map {|i| min++; [min-1] * i}.sum; +} + +var a = 100.of {100.rand.int}; +say counting_sort(a, 0, 100).dump; diff --git a/Task/Sorting-algorithms-Counting-sort/jq/sorting-algorithms-counting-sort-1.jq b/Task/Sorting-algorithms-Counting-sort/jq/sorting-algorithms-counting-sort-1.jq new file mode 100644 index 0000000000..f31bd632fe --- /dev/null +++ b/Task/Sorting-algorithms-Counting-sort/jq/sorting-algorithms-counting-sort-1.jq @@ -0,0 +1,15 @@ +def countingSort(min; max): + . as $in + | reduce range(0;length) as $i + ( {}; + ($in[$i]|tostring) as $s | .[$s] += 1 # courtesy of the fact that in jq, (null+1) is 1 + ) + | . as $hash + # now construct the answer: + | reduce range(min; max+1) as $i + ( []; + ($i|tostring) as $s + | if $hash[$s] == null then . + else reduce range(0; $hash[$s]) as $j (.; . + [$i]) + end + ); diff --git a/Task/Sorting-algorithms-Counting-sort/jq/sorting-algorithms-counting-sort-2.jq b/Task/Sorting-algorithms-Counting-sort/jq/sorting-algorithms-counting-sort-2.jq new file mode 100644 index 0000000000..97aa15f499 --- /dev/null +++ b/Task/Sorting-algorithms-Counting-sort/jq/sorting-algorithms-counting-sort-2.jq @@ -0,0 +1 @@ + [1,2,1,4,0,10] | countingSort(0;10) diff --git a/Task/Sorting-algorithms-Counting-sort/jq/sorting-algorithms-counting-sort-3.jq b/Task/Sorting-algorithms-Counting-sort/jq/sorting-algorithms-counting-sort-3.jq new file mode 100644 index 0000000000..6a5cc8ea65 --- /dev/null +++ b/Task/Sorting-algorithms-Counting-sort/jq/sorting-algorithms-counting-sort-3.jq @@ -0,0 +1,2 @@ +$ jq -M -c -n -f counting_sort.jq +[0,1,1,2,4,10] diff --git a/Task/Sorting-algorithms-Gnome-sort/FreeBASIC/sorting-algorithms-gnome-sort.freebasic b/Task/Sorting-algorithms-Gnome-sort/FreeBASIC/sorting-algorithms-gnome-sort.freebasic new file mode 100644 index 0000000000..2b91406d35 --- /dev/null +++ b/Task/Sorting-algorithms-Gnome-sort/FreeBASIC/sorting-algorithms-gnome-sort.freebasic @@ -0,0 +1,51 @@ +' version 21-10-2016 +' compile with: fbc -s console +' for boundry checks on array's compile with: fbc -s console -exx + +Sub gnomesort(gnome() As Long) + ' sort from lower bound to the highter bound + ' array's can have subscript range from -2147483648 to +2147483647 + Dim As Long lb = LBound(gnome) + Dim As Long ub = UBound(gnome) + Dim As Long i = lb +1, j = lb +2 + + While i < (ub +1) + ' replace "<=" with ">=" for downwards sort + If gnome(i -1) <= gnome(i) Then + i = j + j += 1 + Else + Swap gnome(i -1), gnome(i) + i -= 1 + If i = lb Then + i = j + j += 1 + End If + End If + Wend + +End Sub + +' ------=< MAIN >=------ + +Dim As Long i, array(-7 To 7) + +Dim As Long a = LBound(array), b = UBound(array) + +Randomize Timer +For i = a To b : array(i) = i : Next +For i = a To b ' little shuffle + Swap array(i), array(Int(Rnd * (b - a +1)) + a) +Next + +Print "unsort "; +For i = a To b : Print Using "####"; array(i); : Next : Print +gnomesort(array()) ' sort the array +Print " sort "; +For i = a To b : Print Using "####"; array(i); : Next : Print + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Sorting-algorithms-Gnome-sort/Nim/sorting-algorithms-gnome-sort.nim b/Task/Sorting-algorithms-Gnome-sort/Nim/sorting-algorithms-gnome-sort.nim new file mode 100644 index 0000000000..2a24af9a42 --- /dev/null +++ b/Task/Sorting-algorithms-Gnome-sort/Nim/sorting-algorithms-gnome-sort.nim @@ -0,0 +1,16 @@ +proc gnomeSort[T](a: var openarray[T]) = + var + n = a.len + i = 1 + j = 2 + while i < n: + if a[i-1] > a[i]: + swap a[i-1], a[i] + dec i + if i > 0: continue + i = j + inc j + +var a = @[4, 65, 2, -31, 0, 99, 2, 83, 782] +gnomeSort a +echo a diff --git a/Task/Sorting-algorithms-Gnome-sort/Phix/sorting-algorithms-gnome-sort.phix b/Task/Sorting-algorithms-Gnome-sort/Phix/sorting-algorithms-gnome-sort.phix new file mode 100644 index 0000000000..eef63cd97c --- /dev/null +++ b/Task/Sorting-algorithms-Gnome-sort/Phix/sorting-algorithms-gnome-sort.phix @@ -0,0 +1,19 @@ +function gnomeSort(sequence s) +integer i = 1, j = 2 + while i= $length; + .[0] as $i | .[1] as $j + | .[2] + # for descending sort, use >= for comparison + | if .[$i-1] <= .[$i] then [$j, $j + 1, .] + else swap( $i-1; $i) + | ($i - 1) as $i + | if $i == 0 then [$j, $j + 1, .] + else [$i, $j, .] + end + end ) + | .[2]; diff --git a/Task/Sorting-algorithms-Gnome-sort/jq/sorting-algorithms-gnome-sort-2.jq b/Task/Sorting-algorithms-Gnome-sort/jq/sorting-algorithms-gnome-sort-2.jq new file mode 100644 index 0000000000..dbf3fed3d3 --- /dev/null +++ b/Task/Sorting-algorithms-Gnome-sort/jq/sorting-algorithms-gnome-sort-2.jq @@ -0,0 +1 @@ +[(2|sqrt), [1], null, 1, 0.5, 2, 1, -3, {"a": "A"}] | gnomeSort diff --git a/Task/Sorting-algorithms-Gnome-sort/jq/sorting-algorithms-gnome-sort-3.jq b/Task/Sorting-algorithms-Gnome-sort/jq/sorting-algorithms-gnome-sort-3.jq new file mode 100644 index 0000000000..7412000904 --- /dev/null +++ b/Task/Sorting-algorithms-Gnome-sort/jq/sorting-algorithms-gnome-sort-3.jq @@ -0,0 +1,16 @@ +$ jq -M -n -f Gnome_sort.jq +[ + null, + -3, + 0.5, + 1, + 1, + 1.4142135623730951, + 2, + [ + 1 + ], + { + "a": "A" + } +] diff --git a/Task/Sorting-algorithms-Heapsort/EchoLisp/sorting-algorithms-heapsort.echolisp b/Task/Sorting-algorithms-Heapsort/EchoLisp/sorting-algorithms-heapsort.echolisp new file mode 100644 index 0000000000..af4abcda21 --- /dev/null +++ b/Task/Sorting-algorithms-Heapsort/EchoLisp/sorting-algorithms-heapsort.echolisp @@ -0,0 +1,13 @@ +(lib 'heap) + +(define (heap-sort list) + (define heap (make-heap < )) ;; make a min heap + (list->heap list heap) + (while (not (heap-empty? heap)) + (push 'stack (heap-pop heap))) + (stack->list 'stack)) + +(define L (shuffle (iota 15))) + → (9 4 0 12 8 3 10 7 11 2 5 6 14 13 1) +(heap-sort L) + → (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14) diff --git a/Task/Sorting-algorithms-Heapsort/FreeBASIC/sorting-algorithms-heapsort.freebasic b/Task/Sorting-algorithms-Heapsort/FreeBASIC/sorting-algorithms-heapsort.freebasic new file mode 100644 index 0000000000..d7e5265222 --- /dev/null +++ b/Task/Sorting-algorithms-Heapsort/FreeBASIC/sorting-algorithms-heapsort.freebasic @@ -0,0 +1,75 @@ +' version 22-10-2016 +' compile with: fbc -s console +' for boundary checks on array's compile with: fbc -s console -exx + +' sort from lower bound to the highter bound +' array's can have subscript range from -2147483648 to +2147483647 + +Sub siftdown(hs() As Long, start As ULong , end_ As ULong) + + Dim As ULong root = start + Dim As Long lb = LBound(hs) + + While root * 2 +1 < end_ + Dim As ULong child = root * 2 +1 + If (child +1 < end_) And (hs(lb + child) < hs(lb + child +1)) Then + child = child +1 + End If + If hs(lb + root) < hs(lb + child) Then + Swap hs(lb + root), hs(lb + child) + root = child + Else + Return + End If + Wend + +End Sub + +Sub heapsort(hs() As Long) + + Dim As Long lb = LBound(hs) + Dim As ULong count = UBound(hs) - lb + Dim As Long start = (count -2) \ 2 + + While start >= 0 + siftdown(hs(), start, count) + start = start -1 + Wend + + Dim As ULong end_ = count + While end_ > 0 + Swap hs(lb + end_), hs(lb) + siftdown(hs(), 0, end_) + end_ = end_ -1 + Wend + +End Sub + +' ------=< MAIN >=------ + +Dim As Long array(-7 To 7) +Dim As Long i, lb = LBound(array), ub = UBound(array) + +Randomize Timer +For i = lb To ub : array(i) = i : Next +For i = lb To ub + Swap array(i), array(Int(Rnd * (ub - lb +1)) + lb) +Next + +Print "Unsorted" +For i = lb To ub + Print Using " ###"; array(i); +Next : Print : Print + +heapsort(array()) + +Print "After heapsort" +For i = lb To ub + Print Using " ###"; array(i); +Next : Print + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Sorting-algorithms-Heapsort/FunL/sorting-algorithms-heapsort.funl b/Task/Sorting-algorithms-Heapsort/FunL/sorting-algorithms-heapsort.funl new file mode 100644 index 0000000000..af59e50de1 --- /dev/null +++ b/Task/Sorting-algorithms-Heapsort/FunL/sorting-algorithms-heapsort.funl @@ -0,0 +1,30 @@ +def heapSort( a ) = + heapify( a ) + end = a.length() - 1 + + while end > 0 + a(end), a(0) = a(0), a(end) + siftDown( a, 0, --end ) + +def heapify( a ) = + for i <- (a.length() - 2)\2..0 by -1 + siftDown( a, i, a.length() - 1 ) + +def siftDown( a, start, end ) = + root = start + + while root*2 + 1 <= end + child = root*2 + 1 + + if child + 1 <= end and a(child) < a(child + 1) + child++ + + if a(root) < a(child) + a(root), a(child) = a(child), a(root) + root = child + else + break + +a = array( [7, 2, 6, 1, 9, 5, 0, 3, 8, 4] ) +heapSort( a ) +println( a ) diff --git a/Task/Sorting-algorithms-Heapsort/Nim/sorting-algorithms-heapsort.nim b/Task/Sorting-algorithms-Heapsort/Nim/sorting-algorithms-heapsort.nim new file mode 100644 index 0000000000..a79062ed5b --- /dev/null +++ b/Task/Sorting-algorithms-Heapsort/Nim/sorting-algorithms-heapsort.nim @@ -0,0 +1,23 @@ +proc siftDown[T](a: var openarray[T]; start, ending: int) = + var root = start + while root * 2 + 1 < ending: + var child = 2 * root + 1 + if child + 1 < ending and a[child] < a[child+1]: + inc child + if a[root] < a[child]: + swap a[child], a[root] + root = child + else: + return + +proc heapSort[T](a: var openarray[T]) = + let count = a.len + for start in countdown((count - 2) div 2, 0): + siftDown(a, start, count) + for ending in countdown(count - 1, 1): + swap a[ending], a[0] + siftDown(a, 0, ending) + +var a = @[4, 65, 2, -31, 0, 99, 2, 83, 782] +heapSort a +echo a diff --git a/Task/Sorting-algorithms-Heapsort/Phix/sorting-algorithms-heapsort.phix b/Task/Sorting-algorithms-Heapsort/Phix/sorting-algorithms-heapsort.phix new file mode 100644 index 0000000000..e2654e127d --- /dev/null +++ b/Task/Sorting-algorithms-Heapsort/Phix/sorting-algorithms-heapsort.phix @@ -0,0 +1,39 @@ +function siftDown(sequence arr, integer s, integer last) +integer root = s + while root*2<=last do + integer child = root*2 + if child=arr[child] then exit end if + object tmp = arr[root] + arr[root] = arr[child] + arr[child] = tmp + root = child + end while + return arr +end function + +function heapify(sequence arr, integer count) +integer s = floor(count/2) + while s>0 do + arr = siftDown(arr,s,count) + s -= 1 + end while + return arr +end function + +function heap_sort(sequence arr) +integer last = length(arr) + arr = heapify(arr,last) + while last>1 do + object tmp = arr[1] + arr[1] = arr[last] + arr[last] = tmp + last -= 1 + arr = siftDown(arr,1,last) + end while + return arr +end function + +?heap_sort({5,"oranges","and",3,"apples"}) diff --git a/Task/Sorting-algorithms-Heapsort/Sidef/sorting-algorithms-heapsort.sidef b/Task/Sorting-algorithms-Heapsort/Sidef/sorting-algorithms-heapsort.sidef new file mode 100644 index 0000000000..b10a9affd3 --- /dev/null +++ b/Task/Sorting-algorithms-Heapsort/Sidef/sorting-algorithms-heapsort.sidef @@ -0,0 +1,39 @@ +func sift_down(a, start, end) { + var root = start; + while ((2*root + 1) <= end) { + var child = (2*root + 1); + if ((child+1 <= end) && (a[child] < a[child + 1])) { + child += 1; + } + if (a[root] < a[child]) { + a[child, root] = a[root, child]; + root = child; + } else { + return; + } + } +} + +func heapify(a, count) { + var start = ((count - 2) / 2); + while (start >= 0) { + sift_down(a, start, count-1); + start -= 1; + } +} + +func heap_sort(a, count) { + heapify(a, count); + var end = (count - 1); + while (end > 0) { + a[0, end] = a[end, 0]; + end -= 1; + sift_down(a, 0, end) + } + return a +} + +var arr = (1..10 -> shuffle); # creates a shuffled array +say arr; # prints the unsorted array +heap_sort(arr, arr.len); # sorts the array in-place +say arr; # prints the sorted array diff --git a/Task/Sorting-algorithms-Heapsort/Swift/sorting-algorithms-heapsort.swift b/Task/Sorting-algorithms-Heapsort/Swift/sorting-algorithms-heapsort.swift new file mode 100644 index 0000000000..99c4616ab2 --- /dev/null +++ b/Task/Sorting-algorithms-Heapsort/Swift/sorting-algorithms-heapsort.swift @@ -0,0 +1,49 @@ +func heapsort(inout list:[T]) { + var count = list.count + + func shiftDown(inout list:[T], start:Int, end:Int) { + var root = start + + while root * 2 + 1 <= end { + var child = root * 2 + 1 + var swap = root + + if list[swap] < list[child] { + swap = child + } + + if child + 1 <= end && list[swap] < list[child + 1] { + swap = child + 1 + } + + if swap == root { + return + } else { + (list[root], list[swap]) = (list[swap], list[root]) + root = swap + } + } + } + + func heapify(inout list:[T], count:Int) { + var start = (count - 2) / 2 + + while start >= 0 { + shiftDown(&list, start, count - 1) + + start-- + } + } + + heapify(&list, count) + + var end = count - 1 + + while end > 0 { + (list[end], list[0]) = (list[0], list[end]) + + end-- + + shiftDown(&list, 0, end) + } +} diff --git a/Task/Sorting-algorithms-Insertion-sort/Commodore-BASIC/sorting-algorithms-insertion-sort.commodore b/Task/Sorting-algorithms-Insertion-sort/Commodore-BASIC/sorting-algorithms-insertion-sort.commodore new file mode 100644 index 0000000000..c45fc07406 --- /dev/null +++ b/Task/Sorting-algorithms-Insertion-sort/Commodore-BASIC/sorting-algorithms-insertion-sort.commodore @@ -0,0 +1,8 @@ +10 DIM A(10): N=9 +11 REM GENERATE SOME RANDOM NUMBERS AND PRINT THEM +12 FOR I=0 TO N: A(I)=INT(RND(1)*10)+1: NEXT: GOSUB 50 +20 FOR J=1 TO N:KEY=A(J): I=J-1: GOSUB 30: A(I+1)=KEY: NEXT: GOSUB 50: END +30 IFI=-1 THEN RETURN +31 IFA(I)>KEY THEN A(I+1)=A(I):I=I-1: GOTO 30 +32 RETURN +50 PRINT: FOR I=0 TO N: PRINTA(I): NEXT: RETURN diff --git a/Task/Sorting-algorithms-Insertion-sort/ERRE/sorting-algorithms-insertion-sort.erre b/Task/Sorting-algorithms-Insertion-sort/ERRE/sorting-algorithms-insertion-sort.erre new file mode 100644 index 0000000000..cc50cbe6f9 --- /dev/null +++ b/Task/Sorting-algorithms-Insertion-sort/ERRE/sorting-algorithms-insertion-sort.erre @@ -0,0 +1,33 @@ +PROGRAM INSERTION_SORT + +DIM A[9] + +PROCEDURE INSERTION_SORT(A[]) + LOCAL I,J + FOR I=0 TO UBOUND(A,1) DO + V=A[I] + J=I-1 + WHILE J>=0 DO + IF A[J]>V THEN + A[J+1]=A[J] + J=J-1 + ELSE + EXIT + END IF + END WHILE + A[J+1]=V + END FOR +END PROCEDURE + +BEGIN + A[]=(4,65,2,-31,0,99,2,83,782,1) + FOR I%=0 TO UBOUND(A,1) DO + PRINT(A[I%];) + END FOR + PRINT + INSERTION_SORT(A[]) + FOR I%=0 TO UBOUND(A,1) DO + PRINT(A[I%];) + END FOR + PRINT +END PROGRAM diff --git a/Task/Sorting-algorithms-Insertion-sort/FreeBASIC/sorting-algorithms-insertion-sort.freebasic b/Task/Sorting-algorithms-Insertion-sort/FreeBASIC/sorting-algorithms-insertion-sort.freebasic new file mode 100644 index 0000000000..84d2898a8a --- /dev/null +++ b/Task/Sorting-algorithms-Insertion-sort/FreeBASIC/sorting-algorithms-insertion-sort.freebasic @@ -0,0 +1,50 @@ +' version 20-10-2016 +' compile with: fbc -s console +' for boundry checks on array's compile with: fbc -s console -exx + +Sub insertionSort( arr() As Long ) + + ' sort from lower bound to the highter bound + ' array's can have subscript range from -2147483648 to +2147483647 + + Dim As Long lb = LBound(arr) + Dim As Long i, j, value + + For i = lb +1 To UBound(arr) + + value = arr(i) + j = i -1 + While j >= lb And arr(j) > value + arr(j +1) = arr(j) + j = j -1 + Wend + + arr(j +1) = value + + Next + +End Sub + +' ------=< MAIN >=------ + +Dim As Long i, array(-7 To 7) +Dim As Long a = LBound(array), b = UBound(array) + +Randomize Timer +For i = a To b : array(i) = i : Next +For i = a To b ' little shuffle + Swap array(i), array(Int(Rnd * (b - a +1)) + a) +Next + +Print "unsort "; +For i = a To b : Print Using "####"; array(i); : Next : Print +insertionSort(array()) ' sort the array +Print " sort "; +For i = a To b : Print Using "####"; array(i); : Next : Print + + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Sorting-algorithms-Insertion-sort/Nim/sorting-algorithms-insertion-sort.nim b/Task/Sorting-algorithms-Insertion-sort/Nim/sorting-algorithms-insertion-sort.nim new file mode 100644 index 0000000000..0c07a5b1cb --- /dev/null +++ b/Task/Sorting-algorithms-Insertion-sort/Nim/sorting-algorithms-insertion-sort.nim @@ -0,0 +1,12 @@ +proc insertSort[T](a: var openarray[T]) = + for i in 1 .. 0 and value < a[j-1]: + a[j] = a[j-1] + dec j + a[j] = value + +var a = @[4, 65, 2, -31, 0, 99, 2, 83, 782] +insertSort a +echo a diff --git a/Task/Sorting-algorithms-Insertion-sort/Oforth/sorting-algorithms-insertion-sort.oforth b/Task/Sorting-algorithms-Insertion-sort/Oforth/sorting-algorithms-insertion-sort.oforth new file mode 100644 index 0000000000..598c367aef --- /dev/null +++ b/Task/Sorting-algorithms-Insertion-sort/Oforth/sorting-algorithms-insertion-sort.oforth @@ -0,0 +1,14 @@ +: insertionSort(a) +| l i j v | + a asListBuffer ->l + 2 l size for: i [ + l at(i) ->v + i 1- ->j + while(j) [ + l at(j) dup v <= ifTrue: [ drop break ] + j 1+ swap l put + j 1- ->j + ] + l put(j 1 +, v) + ] + l ; diff --git a/Task/Sorting-algorithms-Insertion-sort/Phix/sorting-algorithms-insertion-sort.phix b/Task/Sorting-algorithms-Insertion-sort/Phix/sorting-algorithms-insertion-sort.phix new file mode 100644 index 0000000000..5dc1294871 --- /dev/null +++ b/Task/Sorting-algorithms-Insertion-sort/Phix/sorting-algorithms-insertion-sort.phix @@ -0,0 +1,19 @@ +function insertion_sort(sequence s) +object temp +integer j + for i=2 to length(s) do + temp = s[i] + j = i-1 + while j>=1 and s[j]>temp do + s[j+1] = s[j] + j -= 1 + end while + s[j+1] = temp + end for + return s +end function + +constant s = {4, 15, "delta", 2, -31, 0, "alpha", 19, "gamma", 2, 13, "beta", 782, 1} + +puts(1,"Before: ") ?s +puts(1,"After: ") ?insertion_sort(s) diff --git a/Task/Sorting-algorithms-Insertion-sort/Ring/sorting-algorithms-insertion-sort.ring b/Task/Sorting-algorithms-Insertion-sort/Ring/sorting-algorithms-insertion-sort.ring new file mode 100644 index 0000000000..af6d2e01d7 --- /dev/null +++ b/Task/Sorting-algorithms-Insertion-sort/Ring/sorting-algorithms-insertion-sort.ring @@ -0,0 +1,14 @@ +alist = [7,6,5,9,8,4,3,1,2,0] +see insertionsort(alist) + +func insertionsort blist + for i = 1 to len(blist) + value = blist[i] + j = i - 1 + while j >= 1 and blist[j] > value + blist[j+1] = blist[j] + j = j - 1 + end + blist[j+1] = value + next + return blist diff --git a/Task/Sorting-algorithms-Insertion-sort/Sidef/sorting-algorithms-insertion-sort.sidef b/Task/Sorting-algorithms-Insertion-sort/Sidef/sorting-algorithms-insertion-sort.sidef new file mode 100644 index 0000000000..370ad4007a --- /dev/null +++ b/Task/Sorting-algorithms-Insertion-sort/Sidef/sorting-algorithms-insertion-sort.sidef @@ -0,0 +1,17 @@ +class Array { + method insertion_sort { + { |i| + var j = i; + var k = self[i]; + while ((j > 0) && (k < self[j - 1])) { + self[j] = self[j - 1]; + j--; + }; + self[j] = k; + } * self.end; + return self; + } +} + +var a = 10.of {100.rand.int}; +say a.insertion_sort; diff --git a/Task/Sorting-algorithms-Insertion-sort/Swift/sorting-algorithms-insertion-sort.swift b/Task/Sorting-algorithms-Insertion-sort/Swift/sorting-algorithms-insertion-sort.swift new file mode 100644 index 0000000000..00dab5d748 --- /dev/null +++ b/Task/Sorting-algorithms-Insertion-sort/Swift/sorting-algorithms-insertion-sort.swift @@ -0,0 +1,10 @@ +func insertionSort(inout list:[T]) { + for i in 1.. 0 && list[j - 1] > list[j] { + swap(&list[j], &list[j - 1]) + j-- + } + } +} diff --git a/Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-1.jq b/Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-1.jq new file mode 100644 index 0000000000..a3b1e4f467 --- /dev/null +++ b/Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-1.jq @@ -0,0 +1,2 @@ +def insertion_sort: + reduce .[] as $x ([]; insert($x)); diff --git a/Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-2.jq b/Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-2.jq new file mode 100644 index 0000000000..320488b5d0 --- /dev/null +++ b/Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-2.jq @@ -0,0 +1,4 @@ +# As soon as "condition" is true, then emit . and stop: +def do_until(condition; next): + def u: if condition then . else (next|u) end; + u; diff --git a/Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-3.jq b/Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-3.jq new file mode 100644 index 0000000000..b32b608039 --- /dev/null +++ b/Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-3.jq @@ -0,0 +1,38 @@ +def bsearch(target): + if length == 0 then -1 + elif length == 1 then + if target == .[0] then 0 elif target < .[0] then -1 else -2 end + else . as $in + # state variable: [start, end, answer] + # where start and end are the upper and lower offsets to use. + | [0, length-1, null] + | do_until( .[0] > .[1] ; + (if .[2] != null then (.[1] = -1) # i.e. break + else + ( ( (.[1] + .[0]) / 2 ) | floor ) as $mid + | $in[$mid] as $monkey + | if $monkey == target then (.[2] = $mid) # success + elif .[0] == .[1] then (.[1] = -1) # failure + elif $monkey < target then (.[0] = ($mid + 1)) + else (.[1] = ($mid - 1)) + end + end )) + | if .[2] == null then # compute the insertion point + if $in[ .[0] ] < target then (-2 -.[0]) + else (-1 -.[0]) + end + else .[2] + end + end; + +# insert x assuming input is sorted +def insert(x): + if length == 0 then [x] + else + bsearch(x) as $i + | ( if $i < 0 then -(1+$i) else $i end ) as $i + | .[0:$i] + [x] + .[$i:] + end ; + +def insertion_sort: + reduce .[] as $x ([]; insert($x)); diff --git a/Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-4.jq b/Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-4.jq new file mode 100644 index 0000000000..30931a758e --- /dev/null +++ b/Task/Sorting-algorithms-Insertion-sort/jq/sorting-algorithms-insertion-sort-4.jq @@ -0,0 +1 @@ +[1, 2, 1, 1.1, -1.1, null, [null], {"null":null}] | insertion_sort diff --git a/Task/Sorting-algorithms-Merge-sort/Crystal/sorting-algorithms-merge-sort.crystal b/Task/Sorting-algorithms-Merge-sort/Crystal/sorting-algorithms-merge-sort.crystal new file mode 100644 index 0000000000..7e31b63963 --- /dev/null +++ b/Task/Sorting-algorithms-Merge-sort/Crystal/sorting-algorithms-merge-sort.crystal @@ -0,0 +1,18 @@ +def merge_sort(a : Array(Int32)) : Array(Int32) + return a if a.size <= 1 + m = a.size / 2 + lt = merge_sort(a[0 ... m]) + rt = merge_sort(a[m .. -1]) + return merge(lt, rt) +end + +def merge(lt : Array(Int32), rt : Array(Int32)) : Array(Int32) + result = Array(Int32).new + until lt.empty? || rt.empty? + result << (lt.first < rt.first ? lt.shift : rt.shift) + end + return result + lt + rt +end + +a = [7, 6, 5, 9, 8, 4, 3, 1, 2, 0] +puts merge_sort(a) # => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] diff --git a/Task/Sorting-algorithms-Merge-sort/ERRE/sorting-algorithms-merge-sort.erre b/Task/Sorting-algorithms-Merge-sort/ERRE/sorting-algorithms-merge-sort.erre new file mode 100644 index 0000000000..1f276de939 --- /dev/null +++ b/Task/Sorting-algorithms-Merge-sort/ERRE/sorting-algorithms-merge-sort.erre @@ -0,0 +1,92 @@ +PROGRAM MERGESORT_DEMO + +! Example of merge sort usage. + +CONST SIZE%=100,S1%=50 + +DIM DTA%[SIZE%],FH%[S1%],STACK%[20,2] + + +PROCEDURE MERGE(START%,MIDDLE%,ENDS%) + +LOCAL FHSIZE% + + FHSIZE%=MIDDLE%-START%+1 + + FOR I%=0 TO FHSIZE%-1 DO + FH%[I%]=DTA%[START%+I%] + END FOR + + I%=0 + J%=MIDDLE%+1 + K%=START% + + REPEAT + IF FH%[I%]<=DTA%[J%] THEN + DTA%[K%]=FH%[I%] + I%=I%+1 + K%=K%+1 + ELSE + DTA%[K%]=DTA%[J%] + J%=J%+1 + K%=K%+1 + END IF + UNTIL I%=FHSIZE% OR J%>ENDS% + + WHILE I%LEV) + +! ***************************************************************** +! This procedure Merge Sorts the chunk of DTA% bounded by +! Start% & Ends%. +! ***************************************************************** + + LOCAL MIDDLE% + + IF ENDS%=START% THEN LEV=LEV-1 EXIT PROCEDURE END IF + + IF ENDS%-START%=1 THEN + IF DTA%[ENDS%]LEV) + START%=STACK%[LEV,0] ENDS%=STACK%[LEV,1] MIDDLE%=STACK%[LEV,2] + + STACK%[LEV,0]=START% STACK%[LEV,1]=ENDS% STACK%[LEV,2]=MIDDLE% + START%=MIDDLE%+1 ENDS%=ENDS% + MERGE_SORT(LEV+1->LEV) + START%=STACK%[LEV,0] ENDS%=STACK%[LEV,1] MIDDLE%=STACK%[LEV,2] + + MERGE(START%,MIDDLE%,ENDS%) + + LEV=LEV-1 +END PROCEDURE + +BEGIN + FOR I%=1 TO SIZE% DO + DTA%[I%]=RND(1)*10000 + END FOR + + START%=1 ENDS%=SIZE% + MERGE_SORT(0->LEV) + + FOR I%=1 TO SIZE% DO + WRITE("#####";DTA%[I%];) + END FOR + PRINT +END PROGRAM diff --git a/Task/Sorting-algorithms-Merge-sort/FunL/sorting-algorithms-merge-sort.funl b/Task/Sorting-algorithms-Merge-sort/FunL/sorting-algorithms-merge-sort.funl new file mode 100644 index 0000000000..4d481c2b0a --- /dev/null +++ b/Task/Sorting-algorithms-Merge-sort/FunL/sorting-algorithms-merge-sort.funl @@ -0,0 +1,15 @@ +def + sort( [] ) = [] + sort( [x] ) = [x] + sort( xs ) = + val (l, r) = xs.splitAt( xs.length()\2 ) + merge( sort(l), sort(r) ) + + merge( [], xs ) = xs + merge( xs, [] ) = xs + merge( x:xs, y:ys ) + | x <= y = x : merge( xs, y:ys ) + | otherwise = y : merge( x:xs, ys ) + +println( sort([94, 37, 16, 56, 72, 48, 17, 27, 58, 67]) ) +println( sort(['Sofía', 'Alysha', 'Sophia', 'Maya', 'Emma', 'Olivia', 'Emily']) ) diff --git a/Task/Sorting-algorithms-Merge-sort/Nim/sorting-algorithms-merge-sort.nim b/Task/Sorting-algorithms-Merge-sort/Nim/sorting-algorithms-merge-sort.nim new file mode 100644 index 0000000000..8f2bad8fed --- /dev/null +++ b/Task/Sorting-algorithms-Merge-sort/Nim/sorting-algorithms-merge-sort.nim @@ -0,0 +1,52 @@ +proc merge[T](a, b: var openarray[T], left, middle, right) = + let + leftLen = middle - left + rightLen = right - middle + var + l = 0 + r = leftLen + + for i in left .. 0 and length(right)>0 do + if left[1]<=right[1] then + result = append(result, left[1]) + left = left[2..$] + else + result = append(result, right[1]) + right = right[2..$] + end if + end while + return result & left & right +end function + +function mergesort(sequence m) +sequence left, right +integer middle + if length(m)<=1 then + return m + end if + middle = floor(length(m)/2) + left = mergesort(m[1..middle]) + right = mergesort(m[middle+1..$]) + if left[$]<=right[1] then + return left & right + elsif right[$]<=left[1] then + return right & left + end if + return merge(left, right) +end function + +constant s = shuffle(tagset(10)) +? s +? mergesort(s) diff --git a/Task/Sorting-algorithms-Merge-sort/Sidef/sorting-algorithms-merge-sort.sidef b/Task/Sorting-algorithms-Merge-sort/Sidef/sorting-algorithms-merge-sort.sidef new file mode 100644 index 0000000000..eb114abd37 --- /dev/null +++ b/Task/Sorting-algorithms-Merge-sort/Sidef/sorting-algorithms-merge-sort.sidef @@ -0,0 +1,29 @@ +func merge(left, right) { + var result = []; + while (!left.is_empty && !right.is_empty) { + result.append([right,left][left.first <= right.first].shift); + }; + result + left + right; +} +  +func mergesort(array) { + var len = array.len; + len < 2 && return array; +  + var mid = (len/2 -> int); + var left = array.ft(0, mid-1); + var right = array.ft(mid); +  + left = __FUNC__(left); + right = __FUNC__(right); +  + merge(left, right); +} +  +# Numeric sort +var nums = (0..7 -> shuffle); +say mergesort(nums); +  +# String sort +var strings = ('a'..'e' -> shuffle); +say mergesort(strings); diff --git a/Task/Sorting-algorithms-Merge-sort/Swift/sorting-algorithms-merge-sort.swift b/Task/Sorting-algorithms-Merge-sort/Swift/sorting-algorithms-merge-sort.swift new file mode 100644 index 0000000000..2e6e3eaa3c --- /dev/null +++ b/Task/Sorting-algorithms-Merge-sort/Swift/sorting-algorithms-merge-sort.swift @@ -0,0 +1,45 @@ +func mergeSort(inout list:[T]) { + if list.count <= 1 { + return + } + + func merge(var left:[T], var right:[T]) -> [T] { + var result = [T]() + + while left.count != 0 && right.count != 0 { + if left[0] <= right[0] { + result.append(left.removeAtIndex(0)) + } else { + result.append(right.removeAtIndex(0)) + } + } + + while left.count != 0 { + result.append(left.removeAtIndex(0)) + } + + while right.count != 0 { + result.append(right.removeAtIndex(0)) + } + + return result + } + + var left = [T]() + var right = [T]() + + let mid = list.count / 2 + + for i in 0.. list[maxNumPos]: + maxNumPos = a + + if maxNumPos == i - 1: continue + + if maxNumPos > 0: + inc moves + reverse(list, 0, maxNumPos) + + inc moves + reverse(list, 0, i - 1) + +var a = @[4, 65, 2, -31, 0, 99, 2, 83, 782] +pancakeSort a +echo a diff --git a/Task/Sorting-algorithms-Pancake-sort/Phix/sorting-algorithms-pancake-sort.phix b/Task/Sorting-algorithms-Pancake-sort/Phix/sorting-algorithms-pancake-sort.phix new file mode 100644 index 0000000000..574fa97fee --- /dev/null +++ b/Task/Sorting-algorithms-Pancake-sort/Phix/sorting-algorithms-pancake-sort.phix @@ -0,0 +1,29 @@ +function flip(sequence s, integer n) + for i=1 to floor(n/2) do + {s[i],s[n-i+1]} = {s[n-i+1],s[i]} + end for + return s +end function + +function pancake_sort(sequence s) +integer m + for i=length(s) to 2 by -1 do + m = 1 + for j=2 to i do + if s[j]>s[m] then + m = j + end if + end for + if m1 then + s = flip(s,m) + end if + s = flip(s,i) + end if + end for + return s +end function + +constant s = shuffle(tagset(10)) +? s +? pancake_sort(s) diff --git a/Task/Sorting-algorithms-Pancake-sort/Ring/sorting-algorithms-pancake-sort.ring b/Task/Sorting-algorithms-Pancake-sort/Ring/sorting-algorithms-pancake-sort.ring new file mode 100644 index 0000000000..efc341481b --- /dev/null +++ b/Task/Sorting-algorithms-Pancake-sort/Ring/sorting-algorithms-pancake-sort.ring @@ -0,0 +1,29 @@ +pancakeList = [6, 7, 8, 9, 2, 5, 3, 4, 1] +flag = 0 +see "Before :" + nl +for n = 1 to len(pancakeList) + see pancakeList[n] + " " +next +see nl + +pancakeSort(pancakeList) + +see "After :" + nl +for n = 1 to len(pancakeList) + see pancakeList[n] + " " +next +see nl + +func pancakeSort A + n = len(A) + while flag = 0 + flag = 1 + for i = 1 to n-1 + if A[i] < A[i+1] + temp = A[i] + A[i] = A[i+1] + A [i+1] = temp + flag = 0 ok + next + end + return A diff --git a/Task/Sorting-algorithms-Pancake-sort/Sidef/sorting-algorithms-pancake-sort.sidef b/Task/Sorting-algorithms-Pancake-sort/Sidef/sorting-algorithms-pancake-sort.sidef new file mode 100644 index 0000000000..8067b7d7d3 --- /dev/null +++ b/Task/Sorting-algorithms-Pancake-sort/Sidef/sorting-algorithms-pancake-sort.sidef @@ -0,0 +1,14 @@ +func pancake(a) { + for idx in ^(a.end) { + var min = idx + for i in (idx+1 .. a.end) { min = i if (a[min] > a[i]) } + next if (a[min] == a[idx]) + a[min..a.end] = [a[min..a.end]].reverse... + a[idx..a.end] = [a[idx..a.end]].reverse... + } + return a +} + +var arr = 10.of{ 100.irand } +say "Before: #{arr}" +say "After: #{pancake(arr)}" diff --git a/Task/Sorting-algorithms-Pancake-sort/Swift/sorting-algorithms-pancake-sort.swift b/Task/Sorting-algorithms-Pancake-sort/Swift/sorting-algorithms-pancake-sort.swift new file mode 100644 index 0000000000..5b36de5a6c --- /dev/null +++ b/Task/Sorting-algorithms-Pancake-sort/Swift/sorting-algorithms-pancake-sort.swift @@ -0,0 +1,66 @@ +import Foundation + +struct PancakeSort { + var arr:[Int] + + mutating func flip(n:Int) { + for i in 0 ..< (n + 1) / 2 { + swap(&arr[n - i], &arr[i]) + } + println("flip(0.. \(n)): \(arr)") + } + + func minmax(n:Int) -> [Int] { + var xm = arr[0] + var xM = arr[0] + var posm = 0 + var posM = 0 + + for i in 1.. xM) { + xM = arr[i] + posM = i + } + } + + return [posm, posM] + } + + mutating func sort(var n:Int, var dir:Int) { + if n == 0 { + return + } + + let mM = minmax(n) + let bestXPos = mM[dir] + let altXPos = mM[1 - dir] + var flipped = false + + if bestXPos == n - 1 { + n-- + } else if bestXPos == 0 { + flip(n - 1) + n-- + } else if altXPos == n - 1 { + dir = 1 - dir + n-- + flipped = true + } else { + flip(bestXPos) + } + + sort(n, dir: dir) + + if flipped { + flip(n) + } + } +} + +let arr = [2, 3, 6, 1, 4, 5, 10, 8, 7, 9] +var a = PancakeSort(arr: arr) +a.sort(arr.count, dir: 1) +println(a.arr) diff --git a/Task/Sorting-algorithms-Pancake-sort/jq/sorting-algorithms-pancake-sort-1.jq b/Task/Sorting-algorithms-Pancake-sort/jq/sorting-algorithms-pancake-sort-1.jq new file mode 100644 index 0000000000..8e863efed4 --- /dev/null +++ b/Task/Sorting-algorithms-Pancake-sort/jq/sorting-algorithms-pancake-sort-1.jq @@ -0,0 +1,22 @@ +def pancakeSort: + + def flip(i): + . as $in | ($in[0:i+1]|reverse) + $in[i+1:] ; + + # If input is [] then return null + def index_of_max: + . as $in + | reduce range(1; length) as $i + # state: [ix, max] + ( [ 0, $in[0] ]; + if $in[$i] > .[1] then [ $i, $in[$i] ] else . end ) + | .[0] ; + + reduce range(0; length) as $iup + (.; + (length - $iup - 1) as $i + | (.[0:$i+1] | index_of_max) as $max + # flip about $max and then about $i unless $i == $max + | if ($i == $max) then . + else flip($max) | flip($i) + end ) ; diff --git a/Task/Sorting-algorithms-Pancake-sort/jq/sorting-algorithms-pancake-sort-2.jq b/Task/Sorting-algorithms-Pancake-sort/jq/sorting-algorithms-pancake-sort-2.jq new file mode 100644 index 0000000000..e46e4c5a44 --- /dev/null +++ b/Task/Sorting-algorithms-Pancake-sort/jq/sorting-algorithms-pancake-sort-2.jq @@ -0,0 +1,2 @@ +[range(0;2), null, 1.0, 0.5, [1], [2], {"b":1}, {"a":2}, range(2;4)] + | pancakeSort diff --git a/Task/Sorting-algorithms-Pancake-sort/jq/sorting-algorithms-pancake-sort-3.jq b/Task/Sorting-algorithms-Pancake-sort/jq/sorting-algorithms-pancake-sort-3.jq new file mode 100644 index 0000000000..b9954d2dec --- /dev/null +++ b/Task/Sorting-algorithms-Pancake-sort/jq/sorting-algorithms-pancake-sort-3.jq @@ -0,0 +1,2 @@ +$ jq -M -c -n -f pancake_sort.jq +[null,0,0.5,1,1,2,3,[1],[2],{"a":2},{"b":1}] diff --git a/Task/Sorting-algorithms-Permutation-sort/EchoLisp/sorting-algorithms-permutation-sort.echolisp b/Task/Sorting-algorithms-Permutation-sort/EchoLisp/sorting-algorithms-permutation-sort.echolisp new file mode 100644 index 0000000000..ab438e3770 --- /dev/null +++ b/Task/Sorting-algorithms-Permutation-sort/EchoLisp/sorting-algorithms-permutation-sort.echolisp @@ -0,0 +1,17 @@ +;; This efficient sort method uses the list library for permutations + +(lib 'list) +(define (in-order L) +(cond + ((empty? L) #t) + ((empty? (rest L)) #t) + (else (and ( < (first L) (second L)) (in-order (rest L)))))) + +(define L (shuffle (iota 6))) + → (1 5 4 2 0 3) + +(for ((p (in-permutations (length L )))) + #:when (in-order (list-permute L p)) + (writeln (list-permute L p)) #:break #t) + + → (0 1 2 3 4 5) diff --git a/Task/Sorting-algorithms-Permutation-sort/Nim/sorting-algorithms-permutation-sort.nim b/Task/Sorting-algorithms-Permutation-sort/Nim/sorting-algorithms-permutation-sort.nim new file mode 100644 index 0000000000..e1a837096e --- /dev/null +++ b/Task/Sorting-algorithms-Permutation-sort/Nim/sorting-algorithms-permutation-sort.nim @@ -0,0 +1,38 @@ +iterator permutations[T](ys: openarray[T]): seq[T] = + var + d = 1 + c = newSeq[int](ys.len) + xs = newSeq[T](ys.len) + + for i, y in ys: xs[i] = y + yield xs + + block outter: + while true: + while d > 1: + dec d + c[d] = 0 + while c[d] >= d: + inc d + if d >= ys.len: break outter + + let i = if (d and 1) == 1: c[d] else: 0 + swap xs[i], xs[d] + yield xs + inc c[d] + +proc isSorted[T](s: openarray[T]): bool = + var last = low(T) + for c in s: + if c < last: + return false + last = c + return true + +proc permSort[T](a: openarray[T]): seq[T] = + for p in a.permutations: + if p.isSorted: + return p + +var a = @[4, 65, 2, -31, 0, 99, 2, 83, 782] +echo a.permSort diff --git a/Task/Sorting-algorithms-Permutation-sort/Phix/sorting-algorithms-permutation-sort.phix b/Task/Sorting-algorithms-Permutation-sort/Phix/sorting-algorithms-permutation-sort.phix new file mode 100644 index 0000000000..9f05e1608b --- /dev/null +++ b/Task/Sorting-algorithms-Permutation-sort/Phix/sorting-algorithms-permutation-sort.phix @@ -0,0 +1,16 @@ +function inOrder(sequence s) + for i=2 to length(s) do + if s[i] $in[.] ; .+1) == $length + end; diff --git a/Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-3.jq b/Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-3.jq new file mode 100644 index 0000000000..5846c88a67 --- /dev/null +++ b/Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-3.jq @@ -0,0 +1,2 @@ +def permutation_sort_slow: + reduce permutations as $p (null; if . then . elif ($p | sorted) then $p else . end); diff --git a/Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-4.jq b/Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-4.jq new file mode 100644 index 0000000000..e5d68c8eb0 --- /dev/null +++ b/Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-4.jq @@ -0,0 +1,9 @@ +def permutation_sort: + # emit the first item in stream that satisfies the condition + def first(stream; cond): + label $out + | foreach stream as $item + ( [false, null]; + if .[0] then break $out else [($item | cond), $item] end; + if .[0] then .[1] else empty end ); + first(permutations; sorted); diff --git a/Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-5.jq b/Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-5.jq new file mode 100644 index 0000000000..78eee6604e --- /dev/null +++ b/Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-5.jq @@ -0,0 +1 @@ +["too", true, 1, 0, {"a":1}, {"a":0} ] | permutation_sort diff --git a/Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-6.jq b/Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-6.jq new file mode 100644 index 0000000000..e5876f2040 --- /dev/null +++ b/Task/Sorting-algorithms-Permutation-sort/jq/sorting-algorithms-permutation-sort-6.jq @@ -0,0 +1,2 @@ +$ jq -c -n -f Permutation_sort.jq +[true,0,1,"too",{"a":0},{"a":1}] diff --git a/Task/Sorting-algorithms-Quicksort/Crystal/sorting-algorithms-quicksort.crystal b/Task/Sorting-algorithms-Quicksort/Crystal/sorting-algorithms-quicksort.crystal new file mode 100644 index 0000000000..49b615be5f --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/Crystal/sorting-algorithms-quicksort.crystal @@ -0,0 +1,9 @@ +def quick_sort(a : Array(Int32)) : Array(Int32) + return a if a.size <= 1 + p = a[0] + lt, rt = a[1 .. -1].partition { |x| x < p } + return quick_sort(lt) + [p] + quick_sort(rt) +end + +a = [7, 6, 5, 9, 8, 4, 3, 1, 2, 0] +puts quick_sort(a) # => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] diff --git a/Task/Sorting-algorithms-Quicksort/ERRE/sorting-algorithms-quicksort.erre b/Task/Sorting-algorithms-Quicksort/ERRE/sorting-algorithms-quicksort.erre new file mode 100644 index 0000000000..7cf958036b --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/ERRE/sorting-algorithms-quicksort.erre @@ -0,0 +1,79 @@ +PROGRAM QUICKSORT_DEMO + +DIM ARRAY[21] + +!$DYNAMIC +DIM QSTACK[0] + +!$INCLUDE="PC.LIB" + +PROCEDURE QSORT(ARRAY[],START,NUM) + FIRST=START ! initialize work variables + LAST=START+NUM-1 + LOOP + REPEAT + TEMP=ARRAY[(LAST+FIRST) DIV 2] ! seek midpoint + I=FIRST + J=LAST + REPEAT ! reverse both < and > below to sort descending + WHILE ARRAY[I]TEMP DO + J=J-1 + END WHILE + EXIT IF I>J + IF I=PRIMO AND X<=PRIMO+NUM-1 THEN + PRINT("==>";) + END IF + PRINT(TAB(5);) + WRITE("###.##";ARRAY[X]) + END FOR + +! create a stack +!$DIM QSTACK[INT(NUM/5)+10] + QSORT(ARRAY[],PRIMO,NUM) +!$ERASE QSTACK + + LOCATE(2,1) + FOR X=1 TO 21 DO ! print them after sorting + LOCATE(2+X,30) + IF X>=PRIMO AND X<=PRIMO+NUM-1 THEN + PRINT("==>";) ! point to sorted items + END IF + LOCATE(2+X,35) + WRITE("###.##";ARRAY[X]) + END FOR +END PROGRAM diff --git a/Task/Sorting-algorithms-Quicksort/EchoLisp/sorting-algorithms-quicksort-1.echolisp b/Task/Sorting-algorithms-Quicksort/EchoLisp/sorting-algorithms-quicksort-1.echolisp new file mode 100644 index 0000000000..e3cc9c8669 --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/EchoLisp/sorting-algorithms-quicksort-1.echolisp @@ -0,0 +1,14 @@ +(lib 'list) ;; list-partition + +(define compare 0) ;; counter + +(define (quicksort L compare-predicate: proc aux: (part null)) +(if (<= (length L) 1) L + (begin + ;; counting the number of comparisons + (set! compare (+ compare (length (rest L)))) + ;; pivot = first element of list + (set! part (list-partition (rest L) proc (first L))) + (append (quicksort (first part) proc ) + (list (first L)) + (quicksort (second part) proc))))) diff --git a/Task/Sorting-algorithms-Quicksort/EchoLisp/sorting-algorithms-quicksort-2.echolisp b/Task/Sorting-algorithms-Quicksort/EchoLisp/sorting-algorithms-quicksort-2.echolisp new file mode 100644 index 0000000000..6701e6ea2c --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/EchoLisp/sorting-algorithms-quicksort-2.echolisp @@ -0,0 +1,18 @@ +(shuffle (iota 15)) + → (10 0 14 11 13 9 2 5 4 8 1 7 12 3 6) +(quicksort (shuffle (iota 15)) <) + → (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14) + +;; random list of numbers in [0 .. n[ +;; count number of comparisons +(define (qtest (n 10000)) + (set! compare 0) + (quicksort (shuffle (iota n)) >) + (writeln 'n n 'compare# compare )) + +(qtest 1000) + n 1000 compare# 12764 +(qtest 10000) + n 10000 compare# 277868 +(qtest 100000) + n 100000 compare# 6198601 diff --git a/Task/Sorting-algorithms-Quicksort/Eero/sorting-algorithms-quicksort-1.eero b/Task/Sorting-algorithms-Quicksort/Eero/sorting-algorithms-quicksort-1.eero new file mode 100644 index 0000000000..de9a24113f --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/Eero/sorting-algorithms-quicksort-1.eero @@ -0,0 +1,36 @@ +#import + +void quicksortInPlace(MutableArray array, const long first, const long last) + if first >= last + return + Value pivot = array[(first + last) / 2] + left := first + right := last + while left <= right + while array[left] < pivot + left++ + while array[right] > pivot + right-- + if left <= right + array.exchangeObjectAtIndex: left++, withObjectAtIndex: right-- + + quicksortInPlace(array, first, right) + quicksortInPlace(array, left, last) + +Array quicksort(Array unsorted) + a := [] + a.addObjectsFromArray: unsorted + quicksortInPlace(a, 0, a.count - 1) + return a + + +int main(int argc, const char * argv[]) + autoreleasepool + a := [1, 3, 5, 7, 9, 8, 6, 4, 2] + Log( 'Unsorted: %@', a) + Log( 'Sorted: %@', quicksort(a) ) + b := ['Emil', 'Peg', 'Helen', 'Juergen', 'David', 'Rick', 'Barb', 'Mike', 'Tom'] + Log( 'Unsorted: %@', b) + Log( 'Sorted: %@', quicksort(b) ) + + return 0 diff --git a/Task/Sorting-algorithms-Quicksort/Eero/sorting-algorithms-quicksort-2.eero b/Task/Sorting-algorithms-Quicksort/Eero/sorting-algorithms-quicksort-2.eero new file mode 100644 index 0000000000..5a995930d4 --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/Eero/sorting-algorithms-quicksort-2.eero @@ -0,0 +1,33 @@ +#import + +implementation Array (Quicksort) + + plus: Array array, return Array = + self.arrayByAddingObjectsFromArray: array + + filter: BOOL (^)(id) predicate, return Array + array := [] + for id item in self + if predicate(item) + array.addObject: item + return array.copy + + quicksort, return Array = self + if self.count > 1 + id x = self[self.count / 2] + lesser := self.filter: (id y | return y < x) + greater := self.filter: (id y | return y > x) + return lesser.quicksort + [x] + greater.quicksort + +end + +int main() + autoreleasepool + a := [1, 3, 5, 7, 9, 8, 6, 4, 2] + Log( 'Unsorted: %@', a) + Log( 'Sorted: %@', a.quicksort ) + b := ['Emil', 'Peg', 'Helen', 'Juergen', 'David', 'Rick', 'Barb', 'Mike', 'Tom'] + Log( 'Unsorted: %@', b) + Log( 'Sorted: %@', b.quicksort ) + + return 0 diff --git a/Task/Sorting-algorithms-Quicksort/FreeBASIC/sorting-algorithms-quicksort.freebasic b/Task/Sorting-algorithms-Quicksort/FreeBASIC/sorting-algorithms-quicksort.freebasic new file mode 100644 index 0000000000..920f31d84f --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/FreeBASIC/sorting-algorithms-quicksort.freebasic @@ -0,0 +1,57 @@ +' version 23-10-2016 +' compile with: fbc -s console + +' sort from lower bound to the highter bound +' array's can have subscript range from -2147483648 to +2147483647 + +Sub quicksort(qs() As Long, l As Long, r As Long) + + Dim As ULong size = r - l +1 + If size < 2 Then Exit Sub + + Dim As Long i = l, j = r + Dim As Long pivot = qs(l + size \ 2) + + Do + While qs(i) < pivot + i += 1 + Wend + While pivot < qs(j) + j -= 1 + Wend + If i <= j Then + Swap qs(i), qs(j) + i += 1 + j -= 1 + End If + Loop Until i > j + + If l < j Then quicksort(qs(), l, j) + If i < r Then quicksort(qs(), i, r) + +End Sub + +' ------=< MAIN >=------ + +Dim As Long i, array(-7 To 7) +Dim As Long a = LBound(array), b = UBound(array) + +Randomize Timer +For i = a To b : array(i) = i : Next +For i = a To b ' little shuffle + Swap array(i), array(Int(Rnd * (b - a +1)) + a) +Next + +Print "unsorted "; +For i = a To b : Print Using "####"; array(i); : Next : Print + +quicksort(array(), LBound(array), UBound(array)) + +Print " sorted "; +For i = a To b : Print Using "####"; array(i); : Next : Print + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Sorting-algorithms-Quicksort/FunL/sorting-algorithms-quicksort-1.funl b/Task/Sorting-algorithms-Quicksort/FunL/sorting-algorithms-quicksort-1.funl new file mode 100644 index 0000000000..af966d0a5d --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/FunL/sorting-algorithms-quicksort-1.funl @@ -0,0 +1,3 @@ +def + qsort( [] ) = [] + qsort( p:xs ) = qsort( xs.filter((< p)) ) + [p] + qsort( xs.filter((>= p)) ) diff --git a/Task/Sorting-algorithms-Quicksort/FunL/sorting-algorithms-quicksort-2.funl b/Task/Sorting-algorithms-Quicksort/FunL/sorting-algorithms-quicksort-2.funl new file mode 100644 index 0000000000..2d77282c0d --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/FunL/sorting-algorithms-quicksort-2.funl @@ -0,0 +1,8 @@ +def + qsort( [] ) = [] + qsort( x:xs ) = + val (ys, zs) = xs.partition( (< x) ) + qsort( ys ) + (x : qsort( zs )) + +println( qsort([4, 2, 1, 3, 0, 2]) ) +println( qsort(["Juan", "Daniel", "Miguel", "William", "Liam", "Ethan", "Jacob"]) ) diff --git a/Task/Sorting-algorithms-Quicksort/Lobster/sorting-algorithms-quicksort.lobster b/Task/Sorting-algorithms-Quicksort/Lobster/sorting-algorithms-quicksort.lobster new file mode 100644 index 0000000000..af19f0bff5 --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/Lobster/sorting-algorithms-quicksort.lobster @@ -0,0 +1,15 @@ +include "std.lobster" + +def quicksort(xs, lt): + if xs.length <= 1: + xs + else: + pivot := xs[0] + tail := xs.slice(1, -1) + f1 := filter tail: lt(_, pivot) + f2 := filter tail: !lt(_, pivot) + append(append(quicksort(f1, lt), [ pivot ]), + quicksort(f2, lt)) + +sorted := [ 3, 9, 5, 4, 1, 3, 9, 5, 4, 1 ].quicksort(): _a < _b +print sorted diff --git a/Task/Sorting-algorithms-Quicksort/Mond/sorting-algorithms-quicksort-1.mond b/Task/Sorting-algorithms-Quicksort/Mond/sorting-algorithms-quicksort-1.mond new file mode 100644 index 0000000000..0e24102f59 --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/Mond/sorting-algorithms-quicksort-1.mond @@ -0,0 +1,32 @@ +fun quicksort( arr, cmp ) +{ + if( arr.length() < 2 ) + return arr; + + if( !cmp ) + cmp = ( a, b ) -> a - b; + + var a = [ ], b = [ ]; + var pivot = arr[0]; + var len = arr.length(); + + for( var i = 1; i < len; ++i ) + { + var item = arr[i]; + + if( cmp( item, pivot ) < cmp( pivot, item ) ) + a.add( item ); + else + b.add( item ); + } + + a = quicksort( a, cmp ); + b = quicksort( b, cmp ); + + a.add( pivot ); + + foreach( var item in b ) + a.add( item ); + + return a; +} diff --git a/Task/Sorting-algorithms-Quicksort/Mond/sorting-algorithms-quicksort-2.mond b/Task/Sorting-algorithms-Quicksort/Mond/sorting-algorithms-quicksort-2.mond new file mode 100644 index 0000000000..2a16f9b3db --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/Mond/sorting-algorithms-quicksort-2.mond @@ -0,0 +1,4 @@ +var array = [ 532, 16, 153, 3, 63.60, 925, 0.214 ]; +var sorted = quicksort( array ); + +printLn( sorted ); diff --git a/Task/Sorting-algorithms-Quicksort/Nim/sorting-algorithms-quicksort.nim b/Task/Sorting-algorithms-Quicksort/Nim/sorting-algorithms-quicksort.nim new file mode 100644 index 0000000000..d9c864d8dc --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/Nim/sorting-algorithms-quicksort.nim @@ -0,0 +1,23 @@ +proc quickSort[T](a: var openarray[T], inl = 0, inr = -1) = + var r = if inr >= 0: inr else: a.high + var l = inl + let n = r - l + 1 + if n < 2: return + let p = a[l + 3 * n div 4] + while l <= r: + if a[l] < p: + inc l + continue + if a[r] > p: + dec r + continue + if l <= r: + swap a[l], a[r] + inc l + dec r + quickSort(a, inl, r) + quickSort(a, l, inr) + +var a = @[4, 65, 2, -31, 0, 99, 2, 83, 782] +quickSort a +echo a diff --git a/Task/Sorting-algorithms-Quicksort/Nix/sorting-algorithms-quicksort.nix b/Task/Sorting-algorithms-Quicksort/Nix/sorting-algorithms-quicksort.nix new file mode 100644 index 0000000000..c40baed2b8 --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/Nix/sorting-algorithms-quicksort.nix @@ -0,0 +1,12 @@ +let + qs = l: + if l == [] then [] + else + with builtins; + let x = head l; + xs = tail l; + low = filter (a: a < x) xs; + high = filter (a: a >= x) xs; + in qs low ++ [x] ++ qs high; +in + qs [4 65 2 (-31) 0 99 83 782] diff --git a/Task/Sorting-algorithms-Quicksort/Oforth/sorting-algorithms-quicksort.oforth b/Task/Sorting-algorithms-Quicksort/Oforth/sorting-algorithms-quicksort.oforth new file mode 100644 index 0000000000..d917c7507c --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/Oforth/sorting-algorithms-quicksort.oforth @@ -0,0 +1 @@ +[ 5, 8, 2, 3, 4, 1 ] sort diff --git a/Task/Sorting-algorithms-Quicksort/Phix/sorting-algorithms-quicksort.phix b/Task/Sorting-algorithms-Quicksort/Phix/sorting-algorithms-quicksort.phix new file mode 100644 index 0000000000..6d2ff94451 --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/Phix/sorting-algorithms-quicksort.phix @@ -0,0 +1,30 @@ +function quick_sort(sequence x) +-- +-- put x into ascending order using recursive quick sort +-- +integer n, last, mid +object xi, midval + + n = length(x) + if n<2 then + return x -- already sorted (trivial case) + end if + + mid = floor((n+1)/2) + midval = x[mid] + x[mid] = x[1] + + last = 1 + for i=2 to n do + xi = x[i] + if xi= p}); +} diff --git a/Task/Sorting-algorithms-Quicksort/Swift/sorting-algorithms-quicksort.swift b/Task/Sorting-algorithms-Quicksort/Swift/sorting-algorithms-quicksort.swift new file mode 100644 index 0000000000..c2059cd00d --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/Swift/sorting-algorithms-quicksort.swift @@ -0,0 +1,11 @@ +func quicksort(inout elements: [T], range: Range) { + if (range.endIndex - range.startIndex > 1) { + let pivotIndex = partition(&elements, range) + quicksort(&elements, range.startIndex ..< pivotIndex) + quicksort(&elements, pivotIndex+1 ..< range.endIndex) + } +} + +func quicksort(inout elements: [T]) { + quicksort(&elements, indices(elements)) +} diff --git a/Task/Sorting-algorithms-Quicksort/Wart/sorting-algorithms-quicksort.wart b/Task/Sorting-algorithms-Quicksort/Wart/sorting-algorithms-quicksort.wart new file mode 100644 index 0000000000..c928498985 --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/Wart/sorting-algorithms-quicksort.wart @@ -0,0 +1,7 @@ +def (qsort (pivot ... ns)) + (+ (qsort+keep (fn(_) (_ < pivot)) ns) + list.pivot + (qsort+keep (fn(_) (_ > pivot)) ns)) + +def (qsort x) :case x=nil + nil diff --git a/Task/Sorting-algorithms-Quicksort/jq/sorting-algorithms-quicksort-1.jq b/Task/Sorting-algorithms-Quicksort/jq/sorting-algorithms-quicksort-1.jq new file mode 100644 index 0000000000..2052e9f240 --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/jq/sorting-algorithms-quicksort-1.jq @@ -0,0 +1 @@ +[1, 1.1, [1,2], true, false, null, {"a":1}, null] | sort diff --git a/Task/Sorting-algorithms-Quicksort/jq/sorting-algorithms-quicksort-2.jq b/Task/Sorting-algorithms-Quicksort/jq/sorting-algorithms-quicksort-2.jq new file mode 100644 index 0000000000..14d42a6289 --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/jq/sorting-algorithms-quicksort-2.jq @@ -0,0 +1 @@ +[null,null,false,true,1,1.1,[1,2],{"a":1}] diff --git a/Task/Sorting-algorithms-Quicksort/jq/sorting-algorithms-quicksort-3.jq b/Task/Sorting-algorithms-Quicksort/jq/sorting-algorithms-quicksort-3.jq new file mode 100644 index 0000000000..5149fba528 --- /dev/null +++ b/Task/Sorting-algorithms-Quicksort/jq/sorting-algorithms-quicksort-3.jq @@ -0,0 +1,13 @@ +def quicksort: + if length < 2 then . # it is already sorted + else .[0] as $pivot + | reduce .[] as $x + # state: [less, equal, greater] + ( [ [], [], [] ]; # three empty arrays: + if $x < $pivot then .[0] += [$x] # add x to less + elif $x == $pivot then .[1] += [$x] # add x to equal + else .[2] += [$x] # add x to greater + end + ) + | (.[0] | quicksort ) + .[1] + (.[2] | quicksort ) + end ; diff --git a/Task/Sorting-algorithms-Radix-sort/Phix/sorting-algorithms-radix-sort.phix b/Task/Sorting-algorithms-Radix-sort/Phix/sorting-algorithms-radix-sort.phix new file mode 100644 index 0000000000..82025d2063 --- /dev/null +++ b/Task/Sorting-algorithms-Radix-sort/Phix/sorting-algorithms-radix-sort.phix @@ -0,0 +1,52 @@ +function radixSortn(sequence s, integer n) +sequence buckets = repeat({},10) +sequence res = {} + for i=1 to length(s) do + integer digit = remainder(floor(s[i]/power(10,n-1)),10)+1 + buckets[digit] = append(buckets[digit],s[i]) + end for + for i=1 to length(buckets) do + integer len = length(buckets[i]) + if len!=0 then + if len=1 or n=1 then + res &= buckets[i] + else + res &= radixSortn(buckets[i],n-1) + end if + end if + end for + return res +end function + +function split_by_sign(sequence s) +sequence buckets = {{},{}} + for i=1 to length(s) do + integer si = s[i] + if si<0 then + buckets[1] = append(buckets[1],-si) + else + buckets[2] = append(buckets[2],si) + end if + end for + return buckets +end function + +function radixSort(sequence s) +integer mins = min(s) +integer passes = max(max(s),abs(mins)) + passes = floor(log10(passes))+1 + if mins<0 then + sequence buckets = split_by_sign(s) + buckets[1] = reverse(sq_uminus(radixSortn(buckets[1],passes))) + buckets[2] = radixSortn(buckets[2],passes) + s = buckets[1]&buckets[2] + else + s = radixSortn(s,passes) + end if + return s +end function + +?radixSort({1, 3, 8, 9, 0, 0, 8, 7, 1, 6}) +?radixSort({170, 45, 75, 90, 2, 24, 802, 66}) +?radixSort({170, 45, 75, 90, 2, 24, -802, -66}) +?radixSort({100000, -10000, 400, 23, 10000}) diff --git a/Task/Sorting-algorithms-Radix-sort/Sidef/sorting-algorithms-radix-sort.sidef b/Task/Sorting-algorithms-Radix-sort/Sidef/sorting-algorithms-radix-sort.sidef new file mode 100644 index 0000000000..e200823fa4 --- /dev/null +++ b/Task/Sorting-algorithms-Radix-sort/Sidef/sorting-algorithms-radix-sort.sidef @@ -0,0 +1,26 @@ +class Array { + method radix_sort(base=10) { + var arr = self.clone; + var rounds = ([arr.minmax].map{.abs}.max -> log(base).floor + 1); + for i in ^rounds { + var buckets = (2*base -> of {[]}); + var base_i = base**i; + for n in arr { + var digit = (n/base_i % base); + digit += base if (0 <= n); + buckets[digit].append(n); + } + arr = buckets.flatten; + } + return arr; + } +} + +for arr in [ + [1, 3, 8, 9, 0, 0, 8, 7, 1, 6], + [170, 45, 75, 90, 2, 24, 802, 66], + [170, 45, 75, 90, 2, 24, -802, -66], + [100000, -10000, 400, 23, 10000], +] { + say arr.radix_sort; +} diff --git a/Task/Sorting-algorithms-Radix-sort/jq/sorting-algorithms-radix-sort-1.jq b/Task/Sorting-algorithms-Radix-sort/jq/sorting-algorithms-radix-sort-1.jq new file mode 100644 index 0000000000..b22fa5b69b --- /dev/null +++ b/Task/Sorting-algorithms-Radix-sort/jq/sorting-algorithms-radix-sort-1.jq @@ -0,0 +1,23 @@ +# Sort the input array; +# "base" must be an integer greater than 1 +def radix_sort(base): + # We only need the ceiling of non-negatives: + def ceil: if . == floor then . else (. + 1 | floor) end; + + min as $min + | map(. - $min) + | ((( max|log) / (base|log)) | ceil) as $rounds + | reduce range(0; $rounds) as $i + # state: [ base^i, buckets ] + ( [1, .]; + .[0] as $base_i + | reduce .[1][] as $n + ([]; + (($n/$base_i) % base) as $digit + | .[$digit] += [$n] ) + | [($base_i * base), (map(select(. != null)) | flatten)] ) + | .[1] + | map(. + $min) ; + +def radix_sort: + radix_sort(10); diff --git a/Task/Sorting-algorithms-Radix-sort/jq/sorting-algorithms-radix-sort-2.jq b/Task/Sorting-algorithms-Radix-sort/jq/sorting-algorithms-radix-sort-2.jq new file mode 100644 index 0000000000..6252af20e5 --- /dev/null +++ b/Task/Sorting-algorithms-Radix-sort/jq/sorting-algorithms-radix-sort-2.jq @@ -0,0 +1,5 @@ +# Verify that radix_sort agrees with sort +( [1, 3, 8, 9, 0, 0, 8, 7, 1, 6], + [170, 45, 75, 90, 2, 24, 802, 66], + [170, 45, 75, 90, 2, 24, -802, -66] ) +| (radix_sort == sort) diff --git a/Task/Sorting-algorithms-Selection-sort/EchoLisp/sorting-algorithms-selection-sort-1.echolisp b/Task/Sorting-algorithms-Selection-sort/EchoLisp/sorting-algorithms-selection-sort-1.echolisp new file mode 100644 index 0000000000..577cc50693 --- /dev/null +++ b/Task/Sorting-algorithms-Selection-sort/EchoLisp/sorting-algorithms-selection-sort-1.echolisp @@ -0,0 +1,18 @@ +;; recursive version (adapted from Racket) +(lib 'list) ;; list-delete +(define (sel-sort xs (x0)) + (cond + [(null? xs) null] + [else (set! x0 (apply min xs)) + (cons x0 (sel-sort (list-delete xs x0)))])) + +(sel-sort (shuffle (iota 13))) + → (0 1 2 3 4 5 6 7 8 9 10 11 12) + +;; straightforward and more efficient implementation using list-swap! +(define (sel-sort list) + (maplist (lambda( L) + (first (list-swap! L (first L) (apply min L )))) list)) + +(sel-sort (shuffle (iota 13))) + → (0 1 2 3 4 5 6 7 8 9 10 11 12) diff --git a/Task/Sorting-algorithms-Selection-sort/EchoLisp/sorting-algorithms-selection-sort-2.echolisp b/Task/Sorting-algorithms-Selection-sort/EchoLisp/sorting-algorithms-selection-sort-2.echolisp new file mode 100644 index 0000000000..b0cf28c2d7 --- /dev/null +++ b/Task/Sorting-algorithms-Selection-sort/EchoLisp/sorting-algorithms-selection-sort-2.echolisp @@ -0,0 +1,13 @@ +;; sort an array in place +(define (sel-sort a (amin) (imin)) + (define ilast (1- (vector-length a))) + (for [(i ilast)] + (set! amin [a (setv! imin i)]) ;; imin := i , amin := a[imin] + (for [(j (in-range (1+ i) (1+ ilast)))] + (when (< [a j] amin) (set! amin [a (setv! imin j)]))) + (vector-swap! a i imin)) + a ) + +(define a #(9 8 2 6 3 5 4)) +(sel-sort a) + → #( 2 3 4 5 6 8 9) diff --git a/Task/Sorting-algorithms-Selection-sort/FreeBASIC/sorting-algorithms-selection-sort.freebasic b/Task/Sorting-algorithms-Selection-sort/FreeBASIC/sorting-algorithms-selection-sort.freebasic new file mode 100644 index 0000000000..c106ebe6a6 --- /dev/null +++ b/Task/Sorting-algorithms-Selection-sort/FreeBASIC/sorting-algorithms-selection-sort.freebasic @@ -0,0 +1,47 @@ +' version 03-12-2016 +' compile with: fbc -s console +' for boundry checks on array's compile with: fbc -s console -exx + +Sub selectionsort(arr() As Long) + + ' sort from lower bound to the highter bound + ' array's can have subscript range from -2147483648 to +2147483647 + + Dim As Long i, j, x + Dim As Long lb = LBound(arr) + Dim As Long ub = UBound(arr) + + For i = lb To ub -1 + x = i + For j = i +1 To ub + If arr(j) < arr(x) Then x = j + Next + If x <> i Then + Swap arr(i), arr(x) + End If + Next + +End Sub + +' ------=< MAIN >=------ + +Dim As Long i, array(-7 To 7) +Dim As Long a = LBound(array), b = UBound(array) + +Randomize Timer +For i = a To b : array(i) = i : Next +For i = a To b ' little shuffle + Swap array(i), array(Int(Rnd * (b - a +1)) + a) +Next + +Print "unsort "; +For i = a To b : Print Using "####"; array(i); : Next : Print +selectionsort(array()) ' sort the array +Print " sort "; +For i = a To b : Print Using "####"; array(i); : Next : Print + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Sorting-algorithms-Selection-sort/Nim/sorting-algorithms-selection-sort.nim b/Task/Sorting-algorithms-Selection-sort/Nim/sorting-algorithms-selection-sort.nim new file mode 100644 index 0000000000..8478e58db9 --- /dev/null +++ b/Task/Sorting-algorithms-Selection-sort/Nim/sorting-algorithms-selection-sort.nim @@ -0,0 +1,12 @@ +proc selectionSort[T](a: var openarray[T]) = + let n = a.len + for i in 0 .. s + l asListBuffer ->b + + s loop: i [ + i dup ->k b at + i 1 + s for: j [ b at(j) 2dup <= ifTrue: [ drop ] else: [ nip j ->k ] ] + k i b at b put i swap b put + ] + b dup freeze ; diff --git a/Task/Sorting-algorithms-Selection-sort/Phix/sorting-algorithms-selection-sort.phix b/Task/Sorting-algorithms-Selection-sort/Phix/sorting-algorithms-selection-sort.phix new file mode 100644 index 0000000000..2ad3850cdd --- /dev/null +++ b/Task/Sorting-algorithms-Selection-sort/Phix/sorting-algorithms-selection-sort.phix @@ -0,0 +1,13 @@ +function selection_sort(sequence s) +integer m + for i=1 to length(s) do + m = i + for j=i+1 to length(s) do + if s[j]" for downwards sort + If s(i) > s(i + inc) Then + Swap s(i), s(i + inc) + done = 1 + End If + Next + Loop Until done = 0 + + Loop Until inc = 1 + +End Sub + +' ------=< MAIN >=------ + +Dim As Long i, array(-7 To 7) + +Dim As Long a = LBound(array), b = UBound(array) + +Randomize Timer +For i = a To b : array(i) = i : Next +For i = a To b ' little shuffle + Swap array(i), array(Int(Rnd * (b - a +1)) + a) +Next + +Print "unsorted "; +For i = a To b : Print Using "####"; array(i); : Next : Print +shellsort(array()) ' sort the array +Print " sorted "; +For i = a To b : Print Using "####"; array(i); : Next : Print + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Sorting-algorithms-Shell-sort/Nim/sorting-algorithms-shell-sort.nim b/Task/Sorting-algorithms-Shell-sort/Nim/sorting-algorithms-shell-sort.nim new file mode 100644 index 0000000000..3b796acbd3 --- /dev/null +++ b/Task/Sorting-algorithms-Shell-sort/Nim/sorting-algorithms-shell-sort.nim @@ -0,0 +1,15 @@ +proc shellSort[T](a: var openarray[T]) = + var h = a.len + while h > 0: + h = h div 2 + for i in h .. < a.len: + let k = a[i] + var j = i + while j >= h and k < a[j-h]: + a[j] = a[j-h] + j -= h + a[j] = k + +var a = @[4, 65, 2, -31, 0, 99, 2, 83, 782] +shellSort a +echo a diff --git a/Task/Sorting-algorithms-Shell-sort/Phix/sorting-algorithms-shell-sort.phix b/Task/Sorting-algorithms-Shell-sort/Phix/sorting-algorithms-shell-sort.phix new file mode 100644 index 0000000000..7458510d5c --- /dev/null +++ b/Task/Sorting-algorithms-Shell-sort/Phix/sorting-algorithms-shell-sort.phix @@ -0,0 +1,17 @@ +function shell_sort(sequence s) +integer gap = floor(length(s)/2), j +object temp + while gap>0 do + for i=gap to length(s) do + temp = s[i] + j = i-gap + while j>=1 and temp<=s[j] do + s[j+gap] = s[j] + j -= gap + end while + s[j+gap] = temp + end for + gap = floor(gap/2) + end while + return s +end function diff --git a/Task/Sorting-algorithms-Shell-sort/Ring/sorting-algorithms-shell-sort.ring b/Task/Sorting-algorithms-Shell-sort/Ring/sorting-algorithms-shell-sort.ring new file mode 100644 index 0000000000..96cbfdaade --- /dev/null +++ b/Task/Sorting-algorithms-Shell-sort/Ring/sorting-algorithms-shell-sort.ring @@ -0,0 +1,21 @@ +aList = [-12, 3, 0, 4, 7, 4, 8, -5, 9] +shellSort(aList) +for i=1 to len(aList) + see "" + aList[i] + " " +next + +func shellSort a + inc = ceil( len(a) / 2 ) + while inc > 0 + for i = inc to len(a) + tmp = a[i] + j = i + while j > inc and a[j-inc] > tmp + a[j] = a[j-inc] + j = j - inc + end + a[j] = tmp + next + inc = floor( 0.5 + inc / 2.2 ) + end + return a diff --git a/Task/Sorting-algorithms-Shell-sort/Sidef/sorting-algorithms-shell-sort.sidef b/Task/Sorting-algorithms-Shell-sort/Sidef/sorting-algorithms-shell-sort.sidef new file mode 100644 index 0000000000..e5958f6c0b --- /dev/null +++ b/Task/Sorting-algorithms-Shell-sort/Sidef/sorting-algorithms-shell-sort.sidef @@ -0,0 +1,18 @@ +func shell_sort(a) { + var h = a.len; + while (h >>= 1) { + for i in (h .. a.end) { + var k = a[i]; + for (var j = i; (j >= h) && (k < a[j - h]); j -= h) { + a[j] = a[j - h]; + } + a[j] = k; + } + } + return a; +} + +var a = 10.of {100.irand}; +say a; +shell_sort(a); +say a; diff --git a/Task/Sorting-algorithms-Shell-sort/Swift/sorting-algorithms-shell-sort.swift b/Task/Sorting-algorithms-Shell-sort/Swift/sorting-algorithms-shell-sort.swift new file mode 100644 index 0000000000..144e6d4917 --- /dev/null +++ b/Task/Sorting-algorithms-Shell-sort/Swift/sorting-algorithms-shell-sort.swift @@ -0,0 +1,17 @@ +func shellsort(inout seq: [T]) { + var inc = seq.count / 2 + while inc > 0 { + for (var i, el) in EnumerateSequence(seq) { + while i >= inc && seq[i - inc] > el { + seq[i] = seq[i - inc] + i -= inc + } + seq[i] = el + } + if inc == 2 { + inc = 1 + } else { + inc = inc * 5 / 11 + } + } +} diff --git a/Task/Sorting-algorithms-Shell-sort/jq/sorting-algorithms-shell-sort-1.jq b/Task/Sorting-algorithms-Shell-sort/jq/sorting-algorithms-shell-sort-1.jq new file mode 100644 index 0000000000..1f036f3975 --- /dev/null +++ b/Task/Sorting-algorithms-Shell-sort/jq/sorting-algorithms-shell-sort-1.jq @@ -0,0 +1,24 @@ +# The "while" loops are implemented using the following jq function: + +# As soon as "condition" is true, then emit . and stop: +def do_until(condition; next): + def u: if condition then . else (next|u) end; + u; + +# sort the input array +def shellSort: + length as $length + | [ ($length/2|floor), .] # L1: state: [h, array] + | do_until( .[0] == 0; + .[0] as $h + | reduce range($h; $length) as $i # L2: state: array + ( .[1]; + .[$i] as $k + | [ $i, . ] # L3: state: [j, array] + | do_until( .[0] < $h or ($k >= .[1][.[0] - $h]); + .[0] as $j + | [ ($j - $h), (.[1]|setpath([$j]; .[$j - $h])) ] ) + | .[0] as $j | (.[1]|setpath([$j]; $k)) # i.e. a[j] = $k + ) + | [(($h+1)*5/11 | floor), .] ) + | .[1] ; diff --git a/Task/Sorting-algorithms-Shell-sort/jq/sorting-algorithms-shell-sort-2.jq b/Task/Sorting-algorithms-Shell-sort/jq/sorting-algorithms-shell-sort-2.jq new file mode 100644 index 0000000000..e75dbdfca9 --- /dev/null +++ b/Task/Sorting-algorithms-Shell-sort/jq/sorting-algorithms-shell-sort-2.jq @@ -0,0 +1,3 @@ +([], + [5,null,3,1,2,0,4.4,5] +) | shellSort diff --git a/Task/Sorting-algorithms-Shell-sort/jq/sorting-algorithms-shell-sort-3.jq b/Task/Sorting-algorithms-Shell-sort/jq/sorting-algorithms-shell-sort-3.jq new file mode 100644 index 0000000000..ba3796d923 --- /dev/null +++ b/Task/Sorting-algorithms-Shell-sort/jq/sorting-algorithms-shell-sort-3.jq @@ -0,0 +1,3 @@ +$ jq -M -c -n -f Shell_sort.jq +[] +[null,0,1,2,3,4.4,5,5] diff --git a/Task/Sorting-algorithms-Sleep-sort/FreeBASIC/sorting-algorithms-sleep-sort.freebasic b/Task/Sorting-algorithms-Sleep-sort/FreeBASIC/sorting-algorithms-sleep-sort.freebasic new file mode 100644 index 0000000000..d800b0f8b6 --- /dev/null +++ b/Task/Sorting-algorithms-Sleep-sort/FreeBASIC/sorting-algorithms-sleep-sort.freebasic @@ -0,0 +1,58 @@ +' version 21-10-2016 +' compile with: fbc -s console +' compile with: fbc -s console -exx (for bondry check on the array's) +' not very well suited for large numbers and large array's +' positive numbers only + +Sub sandman(sleepy() As ULong) + Dim As Long lb = LBound(sleepy) + Dim As Long ub = UBound(sleepy) + Dim As Long i, count = ub + Dim As Double wakeup(lb To ub) + Dim As Double t = Timer + + For i = lb To ub + wakeup(i) = sleepy(i) +1 + t + Next + + Do + t = Timer + For i = lb To ub + If wakeup(i) <= t Then + Print Using "####";sleepy(i); + wakeup(i) = 1e9 ' mark it as used + count = count -1 + End If + Next + Sleep (1 - (Timer - t)) * 300, 1 ' reduce CPU load + Loop Until count < lb + +End Sub + +' ------=< MAIN >=------ + +Dim As ULong i, arr(10) +Dim As ULong lb = LBound(arr) +Dim As ULong ub = UBound(arr) + +Randomize Timer +For i = lb To ub -1 ' leave last one zero + arr(i) = Int(Rnd * 10) +1 +Next + +Print "unsorted "; +For i = lb To ub + Print Using "####";arr(i); +Next +Print : Print + +Print " sorted "; +sandman(arr()) + +Print : Print + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Sorting-algorithms-Sleep-sort/Nim/sorting-algorithms-sleep-sort.nim b/Task/Sorting-algorithms-Sleep-sort/Nim/sorting-algorithms-sleep-sort.nim new file mode 100644 index 0000000000..5ae8eab930 --- /dev/null +++ b/Task/Sorting-algorithms-Sleep-sort/Nim/sorting-algorithms-sleep-sort.nim @@ -0,0 +1,13 @@ +import os, strutils + +proc single(n: int) = + sleep n + echo n + +proc main = + var thr = newSeq[TThread[int]](paramCount()) + for i,c in commandLineParams(): + thr[i].createThread(single, c.parseInt) + thr.joinThreads + +main() diff --git a/Task/Sorting-algorithms-Sleep-sort/Oforth/sorting-algorithms-sleep-sort.oforth b/Task/Sorting-algorithms-Sleep-sort/Oforth/sorting-algorithms-sleep-sort.oforth new file mode 100644 index 0000000000..ca60ac3891 --- /dev/null +++ b/Task/Sorting-algorithms-Sleep-sort/Oforth/sorting-algorithms-sleep-sort.oforth @@ -0,0 +1,7 @@ +import: parallel + +: sleepSort(l) +| ch n | + Channel new ->ch + l forEach: n [ #[ n dup 20 * sleep ch send drop ] & ] + ListBuffer newSize(l size) #[ ch receive over add ] times(l size) ; diff --git a/Task/Sorting-algorithms-Sleep-sort/Phix/sorting-algorithms-sleep-sort.phix b/Task/Sorting-algorithms-Sleep-sort/Phix/sorting-algorithms-sleep-sort.phix new file mode 100644 index 0000000000..0e84198155 --- /dev/null +++ b/Task/Sorting-algorithms-Sleep-sort/Phix/sorting-algorithms-sleep-sort.phix @@ -0,0 +1,29 @@ +integer count + +procedure sleeper(integer key) + ? key + count -= 1 +end procedure + +sequence s, val +atom task + +s = command_line() +s = s[3..$] +if length(s)=0 then + puts(1,"Nothing to sort.\n") +else + count = 0 + for i = 1 to length(s) do + val = value(s[i]) + if val[1] = GET_SUCCESS then + task = task_create(routine_id("sleeper"),{val[2]}) + task_schedule(task,{val[2],val[2]}/10) + count += 1 + end if + end for + + while count do + task_yield() + end while +end if diff --git a/Task/Sorting-algorithms-Sleep-sort/Sidef/sorting-algorithms-sleep-sort.sidef b/Task/Sorting-algorithms-Sleep-sort/Sidef/sorting-algorithms-sleep-sort.sidef new file mode 100644 index 0000000000..cd5b1da251 --- /dev/null +++ b/Task/Sorting-algorithms-Sleep-sort/Sidef/sorting-algorithms-sleep-sort.sidef @@ -0,0 +1,3 @@ +ARGV.map{.to_i}.map{ |i| + {Sys.sleep(i); say i}.fork; +}.each{.wait}; diff --git a/Task/Sorting-algorithms-Sleep-sort/Swift/sorting-algorithms-sleep-sort.swift b/Task/Sorting-algorithms-Sleep-sort/Swift/sorting-algorithms-sleep-sort.swift new file mode 100644 index 0000000000..089fea69a1 --- /dev/null +++ b/Task/Sorting-algorithms-Sleep-sort/Swift/sorting-algorithms-sleep-sort.swift @@ -0,0 +1,12 @@ +import Foundation + +for i in [5, 2, 4, 6, 1, 7, 20, 14] { + let time = dispatch_time(DISPATCH_TIME_NOW, + Int64(i * Int(NSEC_PER_SEC))) + + dispatch_after(time, dispatch_get_main_queue()) { + print(i) + } +} + +CFRunLoopRun() diff --git a/Task/Sorting-algorithms-Sleep-sort/jq/sorting-algorithms-sleep-sort.jq b/Task/Sorting-algorithms-Sleep-sort/jq/sorting-algorithms-sleep-sort.jq new file mode 100644 index 0000000000..61eaf0771d --- /dev/null +++ b/Task/Sorting-algorithms-Sleep-sort/jq/sorting-algorithms-sleep-sort.jq @@ -0,0 +1,11 @@ +echo '[5, 1, 3, 2, 11, 6, 4]' | jq ' +def f: + if .unsorted == [] then + .sorted + else + { unsorted: [.unsorted[] | .t = .t - 1 | select(.t != 0)] + , sorted: (.sorted + [.unsorted[] | .t = .t - 1 | select(.t == 0) | .v]) } + | f + end; +{unsorted: [.[] | {v: ., t: .}], sorted: []} | f | .[] +' diff --git a/Task/Sorting-algorithms-Stooge-sort/FreeBASIC/sorting-algorithms-stooge-sort.freebasic b/Task/Sorting-algorithms-Stooge-sort/FreeBASIC/sorting-algorithms-stooge-sort.freebasic new file mode 100644 index 0000000000..4fbf391b31 --- /dev/null +++ b/Task/Sorting-algorithms-Stooge-sort/FreeBASIC/sorting-algorithms-stooge-sort.freebasic @@ -0,0 +1,41 @@ +' version 23-10-2016 +' compile with: fbc -s console + +Sub stoogesort(s() As Long, l As Long, r As Long) + + If s(r) < s(l) Then + Swap s(r), s(l) + End If + + If r - l > 1 Then + Var t = (r - l +1) \ 3 + stoogesort(s(), l , r - t) + stoogesort(s(), l + t, r ) + stoogesort(s(), l , r - t) + End If +End Sub + +' ------=< MAIN >=------ + +Dim As Long i, array(-7 To 7) +Dim As Long a = LBound(array), b = UBound(array) + +Randomize Timer +For i = a To b : array(i) = i : Next +For i = a To b ' little shuffle + Swap array(i), array(Int(Rnd * (b - a +1)) + a) +Next + +Print "unsorted "; +For i = a To b : Print Using "####"; array(i); : Next : Print + +stoogesort(array(), LBound(array), UBound(array)) + +Print " sorted "; +For i = a To b : Print Using "####"; array(i); : Next : Print + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Sorting-algorithms-Stooge-sort/Nim/sorting-algorithms-stooge-sort.nim b/Task/Sorting-algorithms-Stooge-sort/Nim/sorting-algorithms-stooge-sort.nim new file mode 100644 index 0000000000..4b720dc220 --- /dev/null +++ b/Task/Sorting-algorithms-Stooge-sort/Nim/sorting-algorithms-stooge-sort.nim @@ -0,0 +1,11 @@ +proc stoogeSort[T](a: var openarray[T], i, j: int) = + if a[j] < a[i]: swap a[i], a[j] + if j - i > 1: + let t = (j - i + 1) div 3 + stoogeSort(a, i, j - t) + stoogeSort(a, i + t, j) + stoogeSort(a, i, j - t) + +var a = @[4, 65, 2, -31, 0, 99, 2, 83, 782] +stoogeSort a, 0, a.high +echo a diff --git a/Task/Sorting-algorithms-Stooge-sort/Phix/sorting-algorithms-stooge-sort.phix b/Task/Sorting-algorithms-Stooge-sort/Phix/sorting-algorithms-stooge-sort.phix new file mode 100644 index 0000000000..0bb204283c --- /dev/null +++ b/Task/Sorting-algorithms-Stooge-sort/Phix/sorting-algorithms-stooge-sort.phix @@ -0,0 +1,13 @@ +function stoogesort(sequence s, integer i=1, integer j=length(s)) +integer t + if s[j]1 then + t = floor((j-i+1)/3) + s = stoogesort(s,i, j-t) + s = stoogesort(s,i+t,j ) + s = stoogesort(s,i, j-t) + end if + return s +end function diff --git a/Task/Sorting-algorithms-Stooge-sort/Ring/sorting-algorithms-stooge-sort.ring b/Task/Sorting-algorithms-Stooge-sort/Ring/sorting-algorithms-stooge-sort.ring new file mode 100644 index 0000000000..78452c7648 --- /dev/null +++ b/Task/Sorting-algorithms-Stooge-sort/Ring/sorting-algorithms-stooge-sort.ring @@ -0,0 +1,18 @@ +test = [4, 65, 2, -31, 0, 99, 2, 83, 782, 1] +stoogeSort(test, 1, len(test)) +for i = 1 to 10 + see "" + test[i] + " " +next +see nl + +func stoogeSort list, i, j + if list[j] < list[i] + temp = list[i] + list[i] = list[j] + list[j] = temp ok + if j - i > 1 + t = (j - i + 1)/3 + stoogeSort(list, i, j-t) + stoogeSort(list, i+t, j) + stoogeSort(list, i, j-t) ok + return list diff --git a/Task/Sorting-algorithms-Stooge-sort/Sidef/sorting-algorithms-stooge-sort.sidef b/Task/Sorting-algorithms-Stooge-sort/Sidef/sorting-algorithms-stooge-sort.sidef new file mode 100644 index 0000000000..8558cec177 --- /dev/null +++ b/Task/Sorting-algorithms-Stooge-sort/Sidef/sorting-algorithms-stooge-sort.sidef @@ -0,0 +1,18 @@ +func stooge(x, i, j) { + if (x[j] < x[i]) { + x.swap(i, j) + } + + if (j-i > 1) { + var t = ((j - i + 1) / 3) + stooge(x, i, j - t) + stooge(x, i + t, j ) + stooge(x, i, j - t) + } +} + +var a = 10.of { 100.irand } + +say "Before #{a}" +stooge(a, 0, a.end) +say "After #{a}" diff --git a/Task/Sorting-algorithms-Stooge-sort/Swift/sorting-algorithms-stooge-sort.swift b/Task/Sorting-algorithms-Stooge-sort/Swift/sorting-algorithms-stooge-sort.swift new file mode 100644 index 0000000000..64dbb5baab --- /dev/null +++ b/Task/Sorting-algorithms-Stooge-sort/Swift/sorting-algorithms-stooge-sort.swift @@ -0,0 +1,22 @@ +func stoogeSort(inout arr:[Int], _ i:Int = 0, var _ j:Int = -1) { + if j == -1 { + j = arr.count - 1 + } + + if arr[i] > arr[j] { + swap(&arr[i], &arr[j]) + } + + if j - i > 1 { + let t = (j - i + 1) / 3 + stoogeSort(&arr, i, j - t) + stoogeSort(&arr, i + t, j) + stoogeSort(&arr, i, j - t) + } +} + +var a = [-4, 2, 5, 2, 3, -2, 1, 100, 20] + +stoogeSort(&a) + +println(a) diff --git a/Task/Sorting-algorithms-Stooge-sort/jq/sorting-algorithms-stooge-sort-1.jq b/Task/Sorting-algorithms-Stooge-sort/jq/sorting-algorithms-stooge-sort-1.jq new file mode 100644 index 0000000000..285004b04c --- /dev/null +++ b/Task/Sorting-algorithms-Stooge-sort/jq/sorting-algorithms-stooge-sort-1.jq @@ -0,0 +1,17 @@ +def stoogesort: + def swap(i;j): .[i] as $t | .[i] = .[j] | .[j] = $t; + + # for efficiency, define an auxiliary function + # that takes as input [L, i, j] + def ss: .[1] as $i | .[2] as $j + | .[0] + | if .[$j] < .[$i] then swap($i;$j) else . end + | if $j - $i > 1 then + (($j - $i + 1) / 3 | floor) as $t + | [., $i, $j-$t] | ss + | [., $i+$t, $j] | ss + | [., $i, $j-$t] | ss + else . + end; + + [., 0, length-1] | ss; diff --git a/Task/Sorting-algorithms-Stooge-sort/jq/sorting-algorithms-stooge-sort-2.jq b/Task/Sorting-algorithms-Stooge-sort/jq/sorting-algorithms-stooge-sort-2.jq new file mode 100644 index 0000000000..ab596437c0 --- /dev/null +++ b/Task/Sorting-algorithms-Stooge-sort/jq/sorting-algorithms-stooge-sort-2.jq @@ -0,0 +1,6 @@ +([], + [1], + [1,2], + [1,3,2,4], + [1,4,5,3,-6,3,7,10,-2,-5] +) | stoogesort diff --git a/Task/Sorting-algorithms-Stooge-sort/jq/sorting-algorithms-stooge-sort-3.jq b/Task/Sorting-algorithms-Stooge-sort/jq/sorting-algorithms-stooge-sort-3.jq new file mode 100644 index 0000000000..f8036f029c --- /dev/null +++ b/Task/Sorting-algorithms-Stooge-sort/jq/sorting-algorithms-stooge-sort-3.jq @@ -0,0 +1,6 @@ +$ jq -c -n -f stooge_sort.jq +[] +[1] +[1,2] +[1,2,3,4] +[-6,-5,-2,1,3,3,4,5,7,10] diff --git a/Task/Sorting-algorithms-Strand-sort/Nim/sorting-algorithms-strand-sort.nim b/Task/Sorting-algorithms-Strand-sort/Nim/sorting-algorithms-strand-sort.nim new file mode 100644 index 0000000000..84782d75db --- /dev/null +++ b/Task/Sorting-algorithms-Strand-sort/Nim/sorting-algorithms-strand-sort.nim @@ -0,0 +1,32 @@ +proc mergeList[T](a, b: var seq[T]): seq[T] = + result = @[] + while a.len > 0 and b.len > 0: + if a[0] < b[0]: + result.add a[0] + a.delete 0 + else: + result.add b[0] + b.delete 0 + result.add a + result.add b + +proc strand[T](a: var seq[T]): seq[T] = + var i = 0 + result = @[a[0]] + a.delete 0 + while i < a.len: + if a[i] > result[result.high]: + result.add a[i] + a.delete i + else: + inc i + +proc strandSort[T](a: seq[T]): seq[T] = + var a = a + result = a.strand + while a.len > 0: + var s = a.strand + result = mergeList(result, s) + +var a = @[1, 6, 3, 2, 1, 7, 5, 3] +echo a.strandSort diff --git a/Task/Sorting-algorithms-Strand-sort/Phix/sorting-algorithms-strand-sort.phix b/Task/Sorting-algorithms-Strand-sort/Phix/sorting-algorithms-strand-sort.phix new file mode 100644 index 0000000000..deaacc7d6d --- /dev/null +++ b/Task/Sorting-algorithms-Strand-sort/Phix/sorting-algorithms-strand-sort.phix @@ -0,0 +1,34 @@ +function merge(sequence left, sequence right) +sequence result = {} + while length(left)>0 and length(right)>0 do + if left[$]<=right[1] then + exit + elsif right[$]<=left[1] then + return result & right & left + elsif left[1]0 do + j = length(s) + for i=1 to length(s)-1 do + if s[i]>s[i+1] then + j = i + exit + end if + end for + result = merge(result,s[1..j]) + s = s[j+1..$] + end while + return result +end function diff --git a/Task/Sorting-algorithms-Strand-sort/Sidef/sorting-algorithms-strand-sort.sidef b/Task/Sorting-algorithms-Strand-sort/Sidef/sorting-algorithms-strand-sort.sidef new file mode 100644 index 0000000000..ae408166c9 --- /dev/null +++ b/Task/Sorting-algorithms-Strand-sort/Sidef/sorting-algorithms-strand-sort.sidef @@ -0,0 +1,36 @@ +func merge(x, y) { + var out = []; + while (x && y) { + given (x[-1] <=> y[-1]) { + when ( 1) { out.prepend(x.pop) } + when (-1) { out.prepend(y.pop) } + default { out.prepend(x.pop, y.pop) } + } + } + x + y + out; +} + +func strand(x) { + x || return []; + var out = [x.shift]; + if (x.len) { + for i in (-x.len .. -1) { + if (x[i] >= out[-1]) { + out.append(x.pop_at(i)); + } + } + } + return out; +} + +func strand_sort(x) { + var out = []; + while (var strd = strand(x)) { + out = merge(out, strd); + } + return out; +} + +var a = 10.of { 100.irand }; +say "Before: #{a}"; +say "After: #{strand_sort(a)}"; diff --git a/Task/Sorting-algorithms-Strand-sort/jq/sorting-algorithms-strand-sort.jq b/Task/Sorting-algorithms-Strand-sort/jq/sorting-algorithms-strand-sort.jq new file mode 100644 index 0000000000..26fa0c52ec --- /dev/null +++ b/Task/Sorting-algorithms-Strand-sort/jq/sorting-algorithms-strand-sort.jq @@ -0,0 +1,38 @@ +# merge input array with array x by comparing the heads of the arrays +# in turn; # if both arrays are sorted, the result will be sorted: +def merge(x): + length as $length + | (x|length) as $xl + | if $length == 0 then x + elif $xl == 0 then . + else + . as $in + | reduce range(0; $xl + $length) as $z + # state [ix, xix, ans] + ( [0, 0, []]; + if .[0] < $length and + ((.[1] < $xl and $in[.[0]] <= x[.[1]]) or .[1] == $xl) + then [(.[0] + 1), .[1], (.[2] + [$in[.[0]]]) ] + else [.[0], (.[1] + 1), (.[2] + [x[.[1]]]) ] + end + ) | .[2] + end ; + +def strand_sort: + # The inner function emits [strand, remainder] + def strand: + if length <= 1 then . + else + reduce .[] as $x + # state: [strand, remainder] + ([ [], [] ]; + if ((.[0]|length) == 0) or .[0][-1] <= $x + then [ (.[0] + [$x]), .[1] ] + else [ .[0], (.[1] + [$x]) ] + end ) + end ; + + if length <= 1 then . + else strand as $s + | ($s[0] | merge( $s[1] | strand_sort)) + end ; diff --git a/Task/Soundex/FutureBasic/soundex.futurebasic b/Task/Soundex/FutureBasic/soundex.futurebasic new file mode 100644 index 0000000000..60eb177390 --- /dev/null +++ b/Task/Soundex/FutureBasic/soundex.futurebasic @@ -0,0 +1,171 @@ +include "ConsoleWindow" + +def tab 12 +_soundexNil$ = "0000" + +local mode +local fn Soundex( codeWord as Str255 ) as Str255 +dim as long i,u +dim as unsigned char charCode,lastCode +dim as Str31 outputStr + +outputStr = _soundexNil$ + +if codeWord[0] = _nil then exit fn + +UppercaseStripDiacritics( @codeWord[1], codeWord[0], _smCurrentScript ) + +outputStr[1] = codeWord[1] +charCode = outputStr[1] : gosub "getSoundexCode" +lastCode = charCode +i = 1 : u = 1 + +while i <= codeWord[0] + i++ : charCode = codeWord[i] : gosub "getSoundexCode" + if charCode > 0 and lastCode <> charCode + u++ : outputStr[u] = charCode + if u = 4 then exit while + end if +lastCode = charCode +wend + +exit fn + +"getSoundexCode" + +select charCode +case _"B", _"F", _"P", _"V" +charCode = _"1" +case _"C", _"G", _"J", _"K", _"Q", _"S", _"X", _"Z" +charCode = _"2" +case _"D", _"T" +charCode = _"3" +case _"L" +charCode = _"4" +case _"M", _"N" +charCode = _"5" +case _"R" +charCode = _"6" +case else +charCode = 0 +end select +return +end fn = outputStr + +dim as Str255 nameStr, testName(100) +dim as long i + +testName(0) = "Smith " +testName(1) = "Johnson " +testName(2) = "Williams " +testName(3) = "Jones " +testName(4) = "Brown " +testName(5) = "Davis " +testName(6) = "Miller " +testName(7) = "Wilson " +testName(8) = "Moore " +testName(9) = "Taylor " +testName(10) = "Anderson " +testName(11) = "Thomas " +testName(12) = "Jackson " +testName(13) = "White " +testName(14) = "Harris " +testName(15) = "Martin " +testName(16) = "Thompson " +testName(17) = "Garcia " +testName(18) = "Martinez " +testName(19) = "Robinson " +testName(20) = "Clark " +testName(21) = "Rodriguez " +testName(22) = "Lewis " +testName(23) = "Lee " +testName(24) = "Walker " +testName(25) = "Hall " +testName(26) = "Allen " +testName(27) = "Young " +testName(28) = "Hernandez " +testName(29) = "King " +testName(30) = "Wright " +testName(31) = "Lopez " +testName(32) = "Hill " +testName(33) = "Scott " +testName(34) = "Green " +testName(35) = "Adams " +testName(36) = "Baker " +testName(37) = "Gonzalez " +testName(38) = "Nelson " +testName(39) = "Carter " +testName(40) = "Mitchell " +testName(41) = "Perez " +testName(42) = "Roberts " +testName(43) = "Turner " +testName(44) = "Phillips " +testName(45) = "Campbell " +testName(46) = "Parker " +testName(47) = "Evans " +testName(48) = "Edwards " +testName(49) = "Collins " +testName(50) = "Stewart " +testName(51) = "Sanchez " +testName(52) = "Morris " +testName(53) = "Rogers " +testName(54) = "Reed " +testName(55) = "Cook " +testName(56) = "Morgan " +testName(57) = "Bell " +testName(58) = "Murphy " +testName(59) = "Bailey " +testName(60) = "Rivera " +testName(61) = "Cooper " +testName(62) = "Richardson " +testName(63) = "Cox " +testName(64) = "Howard " +testName(65) = "Ward " +testName(66) = "Torres " +testName(67) = "Peterson " +testName(68) = "Gray " +testName(69) = "Ramirez " +testName(70) = "James " +testName(71) = "Watson " +testName(72) = "Brooks " +testName(73) = "Kelly " +testName(74) = "Sanders " +testName(75) = "Price " +testName(76) = "Bennett " +testName(77) = "Wood " +testName(78) = "Barnes " +testName(79) = "Ross " +testName(80) = "Henderson " +testName(81) = "Coleman " +testName(82) = "Jenkins " +testName(83) = "Perry " +testName(84) = "Powell " +testName(85) = "Long " +testName(86) = "Patterson " +testName(87) = "Hughes " +testName(88) = "Flores " +testName(89) = "Washington " +testName(90) = "Butler " +testName(91) = "Simmons " +testName(92) = "Foster " +testName(93) = "Gonzales " +testName(94) = "Bryant " +testName(95) = "Alexander " +testName(96) = "Russell " +testName(97) = "Griffin " +testName(98) = "Diaz " +testName(99) = "Hayes " + +print "Soundex codes for 100 popular American surnames:" +for i = 0 to 99 + nameStr = testName(i) + print nameStr, "= "; fn Soundex( nameStr ) +next + +print +print "Soundex codes for similar sounding names:" + +print " Stuart = "; fn Soundex( "Stuart" ) +print "Stewart = "; fn Soundex( "Stewart" ) +print "Steward = "; fn Soundex( "Steward" ) +print " Seward = "; fn Soundex( "Seward" ) diff --git a/Task/Soundex/Sidef/soundex.sidef b/Task/Soundex/Sidef/soundex.sidef new file mode 100644 index 0000000000..3d5fadd252 --- /dev/null +++ b/Task/Soundex/Sidef/soundex.sidef @@ -0,0 +1,55 @@ +func soundex(word, length=3) { + + # Uppercase the argument passed in to normalize it + # and drop any non-alphabetic characters + word.uc!.tr!('A-Z', '', 'cd') + + # Return if word does not contain 'A-Z' + return(nil) if (word.is_empty) + + var firstLetter = word.char(0) + + # Replace letters with corresponding number values + word.tr!('BFPV', '1', 's') + word.tr!('CGJKQSXZ', '2', 's') + word.tr!('DT', '3', 's') + word.tr!('L', '4', 's') + word.tr!('MN', '5', 's') + word.tr!('R', '6', 's') + + # Discard the first letter + word.ft!(1) + + # Remove A, E, H, I, O, U, W, and Y + word.tr!('AEHIOUWY', '', 'd') + + # Return the soundex code + firstLetter + (word.chars + length.of('0') -> first(length).join) +} + +func testSoundex { + + # Key-value pairs of names and corresponding Soundex codes + var sndx = Hash( + "Euler" => "E4600", + "Gauss" => "G2000", + "Hilbert" => "H4163", + "Knuth" => "K5300", + "Lloyd" => "L3000", + "Lukasieicz" => "L2220", + 'fulkerson' => 'F4262', + 'faulkersuhn' => 'F4262', + 'fpfffffauhlkkersssin' => 'F4262', + 'Aaeh' => 'A0000', + ) + + sndx.keys.sort.each { |name| + var findSdx = soundex(name, 4) + say "The soundex for #{name} should be #{sndx{name}} and is #{findSdx}" + if (findSdx != sndx{name}) { + say "\tHowever, that is incorrect!\n" + } + } +} + +testSoundex() diff --git a/Task/Sparkline-in-unicode/LiveCode/sparkline-in-unicode.livecode b/Task/Sparkline-in-unicode/LiveCode/sparkline-in-unicode.livecode new file mode 100644 index 0000000000..91b1a2d2ad --- /dev/null +++ b/Task/Sparkline-in-unicode/LiveCode/sparkline-in-unicode.livecode @@ -0,0 +1,22 @@ +command sparklines listOfNums + local utfbase=0x2581 + local tStats, utfp, tmin,tmax,trange + put listOfNums into tStats + replace ", " with space in tStats + replace space with comma in tStats + put min(tStats) into tmin + put max(tStats) into tmax + put tmax - tmin into trange + put "Min:" && tmin && tab into plot + put "Max:" && tmax && tab after plot + put "Range:" && trange && tab after plot + put "Mean" && average(tStats) && tab after plot + put "Stdev:" && standardDeviation(tStats) && tab after plot + put "Variance:" && variance(tStats) && return after plot + + repeat for each item i in tStats + put (round(i - tmin/trange * 7)) + utfbase into utfp + put numToCodepoint(utfp) after plot + end repeat + put plot +end sparklines diff --git a/Task/Sparkline-in-unicode/Nim/sparkline-in-unicode.nim b/Task/Sparkline-in-unicode/Nim/sparkline-in-unicode.nim new file mode 100644 index 0000000000..dcc3eb7246 --- /dev/null +++ b/Task/Sparkline-in-unicode/Nim/sparkline-in-unicode.nim @@ -0,0 +1,18 @@ +import rdstdin, strutils, unicode + +const bar = [9601, 9602, 9603, 9604, 9605, 9606, 9607, 9608] +const barcount = float(bar.high) + +while True: + let + line = readLineFromStdin "Numbers please separated by space/commas: " + numbers = line.split({' ',','}).map(parseFloat) + mn = min(numbers) + mx = max(numbers) + extent = mx - mn + var sparkline = "" + for n in numbers: + let i = int((n-mn) / extent * barcount) + sparkline.add($TRune(bar[i])) + echo "min: ", mn.formatFloat(precision = 0), "; max: ", mx.formatFloat(precision = 0) + echo sparkline diff --git a/Task/Sparkline-in-unicode/Sidef/sparkline-in-unicode.sidef b/Task/Sparkline-in-unicode/Sidef/sparkline-in-unicode.sidef new file mode 100644 index 0000000000..ab0dbf75c7 --- /dev/null +++ b/Task/Sparkline-in-unicode/Sidef/sparkline-in-unicode.sidef @@ -0,0 +1,9 @@ +var bar = @('▁'..'█'); +loop { + print 'Numbers, please, separated by space/commas: '; + var numbers = read(String).trim.split(/[\s,]+/).map{.to_n}; + var (min, max) = numbers.minmax; + say "min: %5f; max: %5f"%(min, max); + var div = ((max - min) / bar.end); + say (min == max ? bar.last*numbers.len : numbers.map{|num| bar[(num - min) / div]}.join); +} diff --git a/Task/Sparkline-in-unicode/jq/sparkline-in-unicode.jq b/Task/Sparkline-in-unicode/jq/sparkline-in-unicode.jq new file mode 100644 index 0000000000..0dc4101f4d --- /dev/null +++ b/Task/Sparkline-in-unicode/jq/sparkline-in-unicode.jq @@ -0,0 +1,9 @@ +def sparkline: + min as $min + | ( (max - $min) / 7 ) as $div + | map( 9601 + (. - $min) * $div ) + | implode ; + +def string2array: + def tidy: select( length > 0 ); + [split(" ") | .[] | split(",") | .[] | tidy | tonumber]; diff --git a/Task/Special-characters/Lasso/special-characters.lasso b/Task/Special-characters/Lasso/special-characters.lasso new file mode 100644 index 0000000000..aa7188854c --- /dev/null +++ b/Task/Special-characters/Lasso/special-characters.lasso @@ -0,0 +1,21 @@ +# defined local ie. #mylocal will fail if not defined +$ defined variable ie. $myvar will fail if not defined += assignment +:= assign as return assigned value +? ternary conditional true ? this +| ternary else false ? this | that +|| or +&& and +! negative operator +{ open capture +} close capture +=> specify givenblock / capture +-> invoke method: mytype->mymethod +& retarget: mytype->mymethod& // returns mytype +^ autocollect from capture: {^ 'this will be outputted' ^} +:: tag prefix, ie. ::mytype->gettype // returns myype +:: type constraint, ie. define mymethod(p::integer) => #i * 2 +\ escape method: ie. \mymethod->invoke(2) +// comment +/* open comment +*/ close comment diff --git a/Task/Special-characters/Lingo/special-characters.lingo b/Task/Special-characters/Lingo/special-characters.lingo new file mode 100644 index 0000000000..32c823d879 --- /dev/null +++ b/Task/Special-characters/Lingo/special-characters.lingo @@ -0,0 +1,3 @@ +str = "Hello " & QUOTE & "world!" & QUOTE +put str +-- "Hello "world!"" diff --git a/Task/Special-characters/Nim/special-characters-1.nim b/Task/Special-characters/Nim/special-characters-1.nim new file mode 100644 index 0000000000..b94547af31 --- /dev/null +++ b/Task/Special-characters/Nim/special-characters-1.nim @@ -0,0 +1 @@ +var f = openFile(r"C:\texts\text.txt") # a raw string, so ``\t`` is no tab diff --git a/Task/Special-characters/Nim/special-characters-2.nim b/Task/Special-characters/Nim/special-characters-2.nim new file mode 100644 index 0000000000..600f288d69 --- /dev/null +++ b/Task/Special-characters/Nim/special-characters-2.nim @@ -0,0 +1 @@ +r"a""b" diff --git a/Task/Special-characters/Nim/special-characters-3.nim b/Task/Special-characters/Nim/special-characters-3.nim new file mode 100644 index 0000000000..1bbe89514a --- /dev/null +++ b/Task/Special-characters/Nim/special-characters-3.nim @@ -0,0 +1 @@ +a"b diff --git a/Task/Special-characters/jq/special-characters.jq b/Task/Special-characters/jq/special-characters.jq new file mode 100644 index 0000000000..a3726d22ec --- /dev/null +++ b/Task/Special-characters/jq/special-characters.jq @@ -0,0 +1 @@ +^[a-zA-Z_][a-zA-Z_0-9]*$ diff --git a/Task/Special-variables/Lasso/special-variables-1.lasso b/Task/Special-variables/Lasso/special-variables-1.lasso new file mode 100644 index 0000000000..e85b34e022 --- /dev/null +++ b/Task/Special-variables/Lasso/special-variables-1.lasso @@ -0,0 +1 @@ +{return #1 + ':'+#2}('a','b') // a:b diff --git a/Task/Special-variables/Lasso/special-variables-2.lasso b/Task/Special-variables/Lasso/special-variables-2.lasso new file mode 100644 index 0000000000..a4d6ae3d6f --- /dev/null +++ b/Task/Special-variables/Lasso/special-variables-2.lasso @@ -0,0 +1,2 @@ +define test(a,b) => #1+':'+#2 +test('y','z') // y:z diff --git a/Task/Special-variables/LiveCode/special-variables-1.livecode b/Task/Special-variables/LiveCode/special-variables-1.livecode new file mode 100644 index 0000000000..15a74694a1 --- /dev/null +++ b/Task/Special-variables/LiveCode/special-variables-1.livecode @@ -0,0 +1 @@ +put the constantNames diff --git a/Task/Special-variables/LiveCode/special-variables-2.livecode b/Task/Special-variables/LiveCode/special-variables-2.livecode new file mode 100644 index 0000000000..bd2fcc4c4f --- /dev/null +++ b/Task/Special-variables/LiveCode/special-variables-2.livecode @@ -0,0 +1 @@ +the colornames diff --git a/Task/Special-variables/Ursa/special-variables.ursa b/Task/Special-variables/Ursa/special-variables.ursa new file mode 100644 index 0000000000..c2ce0f0088 --- /dev/null +++ b/Task/Special-variables/Ursa/special-variables.ursa @@ -0,0 +1,15 @@ +# contains arguments passed to the ursa +# interpreter on the command line +string<> args + +# iodevice that points to the console by default +iodevice console + +# contains "\n" +string endl + +# represents false +boolean false + +# represents true +boolean true diff --git a/Task/Special-variables/XLISP/special-variables-1.xlisp b/Task/Special-variables/XLISP/special-variables-1.xlisp new file mode 100644 index 0000000000..39128cce71 --- /dev/null +++ b/Task/Special-variables/XLISP/special-variables-1.xlisp @@ -0,0 +1 @@ +__DATE__, __DEBUG__, __FILE__, __LINE__, __NAME__, __TIME__ diff --git a/Task/Special-variables/XLISP/special-variables-2.xlisp b/Task/Special-variables/XLISP/special-variables-2.xlisp new file mode 100644 index 0000000000..10cbaccf17 --- /dev/null +++ b/Task/Special-variables/XLISP/special-variables-2.xlisp @@ -0,0 +1,3 @@ +10 PRINT "The border colour is "; PEEK (23624): REM bordcr +20 PRINT "The ramtop address is "; PEEK (23730) + 256 * PEEK (23731): REM ramtop +30 POKE 23609,50: REM set keyboard pip to 50 diff --git a/Task/Special-variables/jq/special-variables.jq b/Task/Special-variables/jq/special-variables.jq new file mode 100644 index 0000000000..5f3528584a --- /dev/null +++ b/Task/Special-variables/jq/special-variables.jq @@ -0,0 +1,2 @@ +$ jq -n -M --arg x 1 '$x|type' # (*) +"string" diff --git a/Task/Speech-synthesis/Sidef/speech-synthesis.sidef b/Task/Speech-synthesis/Sidef/speech-synthesis.sidef new file mode 100644 index 0000000000..4fde98e05c --- /dev/null +++ b/Task/Speech-synthesis/Sidef/speech-synthesis.sidef @@ -0,0 +1,4 @@ +func text2speech(text, lang='en') { + Sys.run("espeak -v #{lang} -w /dev/stdout #{text.escape} | aplay"); +} +text2speech("This is an example of speech synthesis."); diff --git a/Task/Speech-synthesis/Swift/speech-synthesis.swift b/Task/Speech-synthesis/Swift/speech-synthesis.swift new file mode 100644 index 0000000000..7497f91c4c --- /dev/null +++ b/Task/Speech-synthesis/Swift/speech-synthesis.swift @@ -0,0 +1,6 @@ +import Foundation + +let task = NSTask() +task.launchPath = "/usr/bin/say" +task.arguments = ["This is an example of speech synthesis."] +task.launch() diff --git a/Task/Spiral-matrix/FreeBASIC/spiral-matrix.freebasic b/Task/Spiral-matrix/FreeBASIC/spiral-matrix.freebasic new file mode 100644 index 0000000000..e457a05b71 --- /dev/null +++ b/Task/Spiral-matrix/FreeBASIC/spiral-matrix.freebasic @@ -0,0 +1,76 @@ +' FB 1.05.0 Win64 + +Enum Direction + across + down + back + up +End Enum + +Dim As Integer n + +Do + Input "Enter size of matrix "; n +Loop Until n > 0 + +Dim spiral(1 To n, 1 To n) As Integer '' all zero by default + +' enter the numbers 0 to (n^2 - 1) spirally in the matrix + +Dim As Integer row = 1, col = 1, lowRow = 1, highRow = n, lowCol = 1, highCol = n +Dim d As Direction = across + +For i As Integer = 0 To (n * n - 1) + spiral(row, col) = i + Select Case d + Case across + col += 1 + If col > highCol Then + col = highCol + row += 1 + d = down + End if + Case down + row += 1 + If row > highRow Then + row = highRow + col -= 1 + d = back + End if + Case back + col -= 1 + If col < lowCol Then + col = lowCol + row -= 1 + d = up + lowRow += 1 + End If + Case up + row -= 1 + If row < lowRow Then + row = lowRow + col += 1 + d = across + highRow -= 1 + lowCol += 1 + highCol -= 1 + End If + End Select +Next + +' print spiral matrix if n < 20 +Print +If n < 20 Then + For i As Integer = 1 To n + For j As Integer = 1 To n + Print Using "####"; spiral(i, j); + Next j + Print + Next i +Else + Print "Matrix is too big to display on 80 column console" +End If + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Spiral-matrix/Nim/spiral-matrix.nim b/Task/Spiral-matrix/Nim/spiral-matrix.nim new file mode 100644 index 0000000000..fa4a330cfb --- /dev/null +++ b/Task/Spiral-matrix/Nim/spiral-matrix.nim @@ -0,0 +1,43 @@ +import strutils + +type Pos = tuple[x, y: int] + +proc newSeqWith[T](len: int, init: T): seq[T] = + result = newSeq[T] len + for i in 0 .. 0 then + matrix(1;n;init) as $row + | [range(0;m)] | map( $row ) + else error("matrix\(m);_;_) invalid") + end ; + +# Print a matrix neatly, each cell occupying n spaces +def neatly(n): + def right: tostring | ( " " * (n-length) + .); + . as $in + | length as $length + | reduce range (0;$length) as $i + (""; . + reduce range(0;$length) as $j + (""; "\(.)\($in[$i][$j] | right )" ) + "\n" ) ; + +def right: + if . == [1, 0] then [ 0, -1] + elif . == [0, -1] then [-1, 0] + elif . == [-1, 0] then [ 0, 1] + elif . == [0, 1] then [ 1, 0] + else error("invalid direction: \(.)") + end; diff --git a/Task/Spiral-matrix/jq/spiral-matrix-2.jq b/Task/Spiral-matrix/jq/spiral-matrix-2.jq new file mode 100644 index 0000000000..3ebb8e15f0 --- /dev/null +++ b/Task/Spiral-matrix/jq/spiral-matrix-2.jq @@ -0,0 +1,14 @@ +def spiral(n): + # we just placed m at i,j, and we are moving in the direction d + def _next(i; j; m; d): + if m == (n*n) - 1 then . + elif .[i+d[0]][j+d[1]] == false + then .[i+d[0]][j+d[1]] = m+1 | _next(i+d[0]; j+d[1]; m+1; d) + else (d|right) as $d + | .[i+$d[0]][j+$d[1]] = m+1 | _next(i+$d[0]; j+$d[1]; m+1; $d) + end; + + matrix(n;n;false) | .[0][0] = 0 | _next(0;0;0; [0,1]) ; + +# Example +spiral(5) | neatly(3) diff --git a/Task/Stable-marriage-problem/EchoLisp/stable-marriage-problem.echolisp b/Task/Stable-marriage-problem/EchoLisp/stable-marriage-problem.echolisp new file mode 100644 index 0000000000..ecf78b4d8f --- /dev/null +++ b/Task/Stable-marriage-problem/EchoLisp/stable-marriage-problem.echolisp @@ -0,0 +1,74 @@ +(lib 'hash) +;; input data +(define M-RANKS +'(( abe abi eve cath ivy jan dee fay bea hope gay) +( bob cath hope abi dee eve fay bea jan ivy gay) +( col hope eve abi dee bea fay ivy gay cath jan) +( dan ivy fay dee gay hope eve jan bea cath abi) +( ed jan dee bea cath fay eve abi ivy hope gay) +( fred bea abi dee gay eve ivy cath jan hope fay) +( gav gay eve ivy bea cath abi dee hope jan fay) +( hal abi eve hope fay ivy cath jan bea gay dee) +( ian hope cath dee gay bea abi fay ivy jan eve) +( jon abi fay jan gay eve bea dee cath ivy hope))) + +(define W-RANKS +'(( abi bob fred jon gav ian abe dan ed col hal) +( bea bob abe col fred gav dan ian ed jon hal) +( cath fred bob ed gav hal col ian abe dan jon) +( dee fred jon col abe ian hal gav dan bob ed) +( eve jon hal fred dan abe gav col ed ian bob) +( fay bob abe ed ian jon dan fred gav col hal) +( gay jon gav hal fred bob abe col ed dan ian) +( hope gav jon bob abe ian dan hal ed col fred) +( ivy ian col hal gav fred bob abe ed jon dan) +( jan ed hal gav abe bob jon col ian fred dan))) + +;; build preferences hash +(define (set-prefs ranks prefs) + (for/list ((r ranks)) + (hash-set prefs (first r) (rest r)) + (first r))) + +(define (engage m w) (hash-set ENGAGED m w) (hash-set ENGAGED w m) (writeln m w '👫 )) +(define (disengage m w) (hash-remove! ENGAGED m ) (hash-remove! ENGAGED w) (writeln '💔 m w)) +(define (engaged x) (hash-ref ENGAGED x)) +(define (free? x) (not (engaged x))) +(define (free-man men) (for ((man men)) #:break (free? man) => man #f)) + + +(define (prefers? prefs x a b) (member b (member a (hash-ref prefs x)))) +;; get first choice and remove it from prefs list +(define (first-choice prefs m) + (define w (first (hash-ref prefs m))) + (hash-set prefs m (rest (hash-ref prefs m))) + w) + +;; sets ENGAGED couples +;; https//en.wikipedia.org/wiki/Stable_marriage_problem + +(define (stableMatching (prefs (make-hash)) (m) (w)) +(define-global 'ENGAGED (make-hash)) + (define men (set-prefs M-RANKS prefs)) + (define women (set-prefs W-RANKS prefs)) + (while (setv! m (free-man men)) + (set! w (first-choice prefs m)) + (if (free? w) + (engage m w) + (let [(dumped (engaged w))] + (when (prefers? prefs w m dumped) + (disengage w dumped) + (engage w m))))) + (hash->list ENGAGED)) + +;; input : ENGAGED couples +(define (checkStable (prefs (make-hash))) + (define men (set-prefs M-RANKS prefs)) + (define women (set-prefs W-RANKS prefs)) + (for* [(man men) (woman women)] + #:continue (equal? woman (engaged man)) + (when (and + (prefers? prefs man woman (engaged man)) + (prefers? prefs woman man (engaged woman))) + (error 'not-stable (list man woman))))) + diff --git a/Task/Stable-marriage-problem/Sidef/stable-marriage-problem.sidef b/Task/Stable-marriage-problem/Sidef/stable-marriage-problem.sidef new file mode 100644 index 0000000000..9f54824816 --- /dev/null +++ b/Task/Stable-marriage-problem/Sidef/stable-marriage-problem.sidef @@ -0,0 +1,89 @@ +var he_likes = Hash( + abe => < abi eve cath ivy jan dee fay bea hope gay >, + bob => < cath hope abi dee eve fay bea jan ivy gay >, + col => < hope eve abi dee bea fay ivy gay cath jan >, + dan => < ivy fay dee gay hope eve jan bea cath abi >, + ed => < jan dee bea cath fay eve abi ivy hope gay >, + fred => < bea abi dee gay eve ivy cath jan hope fay >, + gav => < gay eve ivy bea cath abi dee hope jan fay >, + hal => < abi eve hope fay ivy cath jan bea gay dee >, + ian => < hope cath dee gay bea abi fay ivy jan eve >, + jon => < abi fay jan gay eve bea dee cath ivy hope >, +); + +var she_likes = Hash( + abi => < bob fred jon gav ian abe dan ed col hal >, + bea => < bob abe col fred gav dan ian ed jon hal >, + cath => < fred bob ed gav hal col ian abe dan jon >, + dee => < fred jon col abe ian hal gav dan bob ed >, + eve => < jon hal fred dan abe gav col ed ian bob >, + fay => < bob abe ed ian jon dan fred gav col hal >, + gay => < jon gav hal fred bob abe col ed dan ian >, + hope => < gav jon bob abe ian dan hal ed col fred >, + ivy => < ian col hal gav fred bob abe ed jon dan >, + jan => < ed hal gav abe bob jon col ian fred dan >, +); + +var guys = he_likes.keys; +var gals = she_likes.keys; + +var (:fiancé, :fiancée, :proposed); + +func she_prefers (her, hottie) { var a = she_likes{her}; a.index(hottie) < a.index(fiancé{her}) } +func he_prefers (him, hottie) { var a = he_likes{him}; a.index(hottie) < a.index(fiancée{him}) } + +func unmatched_guy { guys.first {|k| !defined fiancée{k} } } +func preferred_choice(guy) { he_likes{guy}.first {|k| !defined proposed{guy}{k} } } + +func engage(guy, gal) { + fiancé{gal} = guy; + fiancée{guy} = gal; +} + +func match_em { + say 'Matchmaking:'; + while (defined(var guy = unmatched_guy())) { + var gal = preferred_choice(guy); + proposed{guy}{gal} = '❤'; + if (!defined fiancé{gal}) { + engage(guy, gal); + say "\t#{gal} and #{guy}"; + } + elsif (she_prefers(gal, guy)) { + var engaged_guy = fiancé{gal}; + engage(guy, gal); + fiancée{engaged_guy} = nil; + say "\t#{gal} dumped #{engaged_guy} for #{guy}"; + } + } +} + +func check_stability { + var instabilities = gather { + guys.each { |m| + gals.each { |w| + if (he_prefers(m, w) && she_prefers(w, m)) { + take "\t#{w} prefers #{m} to #{fiancé{w}} and #{m} prefers #{w} to #{fiancée{m}}"; + } + } + } + } + + say 'Stablility:'; + instabilities.is_empty + ? say "\t(all marriages stable)" + : instabilities.each { |i| say i }; +} + +func perturb_em { + say 'Perturb:'; + say "\tengage abi with fred and bea with jon"; + engage('fred', 'abi'); + engage('jon', 'bea'); +} + +match_em(); +check_stability(); + +perturb_em(); +check_stability(); diff --git a/Task/Stable-marriage-problem/Swift/stable-marriage-problem.swift b/Task/Stable-marriage-problem/Swift/stable-marriage-problem.swift new file mode 100644 index 0000000000..49c5fdb231 --- /dev/null +++ b/Task/Stable-marriage-problem/Swift/stable-marriage-problem.swift @@ -0,0 +1,138 @@ +class Person { + let name:String + var candidateIndex = 0 + var fiance:Person? + var candidates = [Person]() + + init(name:String) { + self.name = name + } + + func rank(p:Person) -> Int { + for (i, candidate) in enumerate(self.candidates) { + if candidate === p { + return i + } + } + return self.candidates.count + 1 + } + + func prefers(p:Person) -> Bool { + if let fiance = self.fiance { + return self.rank(p) < self.rank(fiance) + } + return false + } + + func nextCandidate() -> Person? { + if self.candidateIndex >= self.candidates.count { + return nil + } + return self.candidates[candidateIndex++] + } + + func engageTo(p:Person) { + p.fiance?.fiance = nil + p.fiance = self + self.fiance?.fiance = nil + self.fiance = p + } + + func swapWith(p:Person) { + let thisFiance = self.fiance + let pFiance = p.fiance + println("\(self.name) swapped partners with \(p.name)") + if pFiance != nil && thisFiance != nil { + self.engageTo(pFiance!) + p.engageTo(thisFiance!) + } + } +} + +func isStable(guys:[Person], gals:[Person]) -> Bool { + for guy in guys { + for gal in gals { + if guy.prefers(gal) && gal.prefers(guy) { + return false + } + } + } + return true +} + +func engageEveryone(guys:[Person]) { + var done = false + while !done { + done = true + for guy in guys { + if guy.fiance == nil { + done = false + if let gal = guy.nextCandidate() { + if gal.fiance == nil || gal.prefers(guy) { + guy.engageTo(gal) + } + } + } + } + } +} + +func doMarriage() { + let abe = Person(name: "Abe") + let bob = Person(name: "Bob") + let col = Person(name: "Col") + let dan = Person(name: "Dan") + let ed = Person(name: "Ed") + let fred = Person(name: "Fred") + let gav = Person(name: "Gav") + let hal = Person(name: "Hal") + let ian = Person(name: "Ian") + let jon = Person(name: "Jon") + let abi = Person(name: "Abi") + let bea = Person(name: "Bea") + let cath = Person(name: "Cath") + let dee = Person(name: "Dee") + let eve = Person(name: "Eve") + let fay = Person(name: "Fay") + let gay = Person(name: "Gay") + let hope = Person(name: "Hope") + let ivy = Person(name: "Ivy") + let jan = Person(name: "Jan") + + abe.candidates = [abi, eve, cath, ivy, jan, dee, fay, bea, hope, gay] + bob.candidates = [cath, hope, abi, dee, eve, fay, bea, jan, ivy, gay] + col.candidates = [hope, eve, abi, dee, bea, fay, ivy, gay, cath, jan] + dan.candidates = [ivy, fay, dee, gay, hope, eve, jan, bea, cath, abi] + ed.candidates = [jan, dee, bea, cath, fay, eve, abi, ivy, hope, gay] + fred.candidates = [bea, abi, dee, gay, eve, ivy, cath, jan, hope, fay] + gav.candidates = [gay, eve, ivy, bea, cath, abi, dee, hope, jan, fay] + hal.candidates = [abi, eve, hope, fay, ivy, cath, jan, bea, gay, dee] + ian.candidates = [hope, cath, dee, gay, bea, abi, fay, ivy, jan, eve] + jon.candidates = [abi, fay, jan, gay, eve, bea, dee, cath, ivy, hope] + abi.candidates = [bob, fred, jon, gav, ian, abe, dan, ed, col, hal] + bea.candidates = [bob, abe, col, fred, gav, dan, ian, ed, jon, hal] + cath.candidates = [fred, bob, ed, gav, hal, col, ian, abe, dan, jon] + dee.candidates = [fred, jon, col, abe, ian, hal, gav, dan, bob, ed] + eve.candidates = [jon, hal, fred, dan, abe, gav, col, ed, ian, bob] + fay.candidates = [bob, abe, ed, ian, jon, dan, fred, gav, col, hal] + gay.candidates = [jon, gav, hal, fred, bob, abe, col, ed, dan, ian] + hope.candidates = [gav, jon, bob, abe, ian, dan, hal, ed, col, fred] + ivy.candidates = [ian, col, hal, gav, fred, bob, abe, ed, jon, dan] + jan.candidates = [ed, hal, gav, abe, bob, jon, col, ian, fred, dan] + + let guys = [abe, bob, col, dan, ed, fred, gav, hal, ian, jon] + let gals = [abi, bea, cath, dee, eve, fay, gay, hope, ivy, jan] + + engageEveryone(guys) + + for guy in guys { + println("\(guy.name) is engaged to \(guy.fiance!.name)") + } + + println("Stable = \(isStable(guys, gals))") + jon.swapWith(fred) + println("Stable = \(isStable(guys, gals))") + +} + +doMarriage() diff --git a/Task/Stack-traces/Lasso/stack-traces-1.lasso b/Task/Stack-traces/Lasso/stack-traces-1.lasso new file mode 100644 index 0000000000..602c147873 --- /dev/null +++ b/Task/Stack-traces/Lasso/stack-traces-1.lasso @@ -0,0 +1,24 @@ +// Define our own trace method +define trace => { + local(gb) = givenblock + + // Set a depth counter + var(::_tracedepth)->isnota(::integer) ? $_tracedepth = 0 + handle => {$_tracedepth--} + + // Only output when supplied a capture + #gb ? stdoutnl( + // Indent + ('\t' * $_tracedepth++) + + + // Type + Method + #gb->self->type + '.' + #gb->calledname + + + // Call site file + ': ' + #gb->home->callsite_file + + + // Line number and column number + ' (line '+#gb->home->callsite_line + ', col ' + #gb->home->callsite_col +')' + ) + return #gb() +} diff --git a/Task/Stack-traces/Lasso/stack-traces-2.lasso b/Task/Stack-traces/Lasso/stack-traces-2.lasso new file mode 100644 index 0000000000..84933a9a57 --- /dev/null +++ b/Task/Stack-traces/Lasso/stack-traces-2.lasso @@ -0,0 +1,8 @@ +define stackexample => type { + public oncreate => trace => { return self } + public inner => trace => { } + public middle => trace => { .inner } + public outer => trace => { .middle } +} + +stackexample->outer diff --git a/Task/Stack-traces/Nim/stack-traces.nim b/Task/Stack-traces/Nim/stack-traces.nim new file mode 100644 index 0000000000..75e55edc8d --- /dev/null +++ b/Task/Stack-traces/Nim/stack-traces.nim @@ -0,0 +1,6 @@ +proc g() = + writeStackTrace() +proc f() = + g() + +f() diff --git a/Task/Stack-traces/Oforth/stack-traces.oforth b/Task/Stack-traces/Oforth/stack-traces.oforth new file mode 100644 index 0000000000..0a7134de24 --- /dev/null +++ b/Task/Stack-traces/Oforth/stack-traces.oforth @@ -0,0 +1,6 @@ +: f1 Exception throw("An exception") ; +Integer method: f2 self f1 ; +: f3 f2 ; +: f4 f3 ; + +10 f4 diff --git a/Task/Stack/Axe/stack.axe b/Task/Stack/Axe/stack.axe new file mode 100644 index 0000000000..5065553545 --- /dev/null +++ b/Task/Stack/Axe/stack.axe @@ -0,0 +1,14 @@ +0→S +Lbl PUSH +r₁→{L₁+S}ʳ +S+2→S +Return + +Lbl POP +S-2→S +{L₁+S}ʳ +Return + +Lbl EMPTY +S≤≤0 +Return diff --git a/Task/Stack/EchoLisp/stack.echolisp b/Task/Stack/EchoLisp/stack.echolisp new file mode 100644 index 0000000000..44e19966af --- /dev/null +++ b/Task/Stack/EchoLisp/stack.echolisp @@ -0,0 +1,20 @@ +; build stack [0 1 ... 9 (top)] from a list +(list->stack (iota 10) 'my-stack) +(stack-top 'my-stack) → 9 +(pop 'my-stack) → 9 +(stack-top 'my-stack) → 8 +(push 'my-stack '🐸) ; any kind of lisp object in the stack +(stack-empty? 'my-stack) → #f +(stack->list 'my-stack) ; convert stack to list + → (0 1 2 3 4 5 6 7 8 🐸) +(stack-swap 'my-stack) ; swaps two last items + → 8 ; new top +(stack->list 'my-stack) + → (0 1 2 3 4 5 6 7 🐸 8) ; swapped +(while (not (stack-empty? 'my-stack)) (pop 'my-stack)) ; pop until empty +(stack-empty? 'my-stack) → #t ; true + +(push 'my-stack 7) +my-stack ; a stack is not a variable, nor a symbol - cannot be evaluated + ⛔ error: #|user| : unbound variable : my-stack +(stack-top 'my-stack) → 7 diff --git a/Task/Stack/Lasso/stack.lasso b/Task/Stack/Lasso/stack.lasso new file mode 100644 index 0000000000..1493bf83da --- /dev/null +++ b/Task/Stack/Lasso/stack.lasso @@ -0,0 +1,10 @@ +local(a) = array + +#a->push('a') +#a->push('b') +#a->push('c') + +#a->pop // c +#a->pop // b +#a->pop // a +#a->pop // null diff --git a/Task/Stack/Lingo/stack.lingo b/Task/Stack/Lingo/stack.lingo new file mode 100644 index 0000000000..aaef03410b --- /dev/null +++ b/Task/Stack/Lingo/stack.lingo @@ -0,0 +1,23 @@ +-- parent script "Stack" + +property _tos + +on push (me, data) + me._tos = [#data:data, #next:me._tos] +end + +on pop (me) + if voidP(me._tos) then return VOID + data = me._tos.data + me._tos = me._tos.next + return data +end + +on peek (me) + if voidP(me._tos) then return VOID + return me._tos.data +end + +on empty (me) + return voidP(me.peek()) +end diff --git a/Task/Stack/Nim/stack.nim b/Task/Stack/Nim/stack.nim new file mode 100644 index 0000000000..372b4abd7d --- /dev/null +++ b/Task/Stack/Nim/stack.nim @@ -0,0 +1,73 @@ +import math + +type + EStackEmpty = object of E_Base + + TStack* [A] = object + data: seq[A] + count: int + +proc initStack*[A](initialSize = 32): TStack[A] = + assert isPowerOfTwo(initialSize) + result.count = 0 + newSeq(result.data,initialSize) + +proc cap*[A] (s: TStack[A]): int = + result = s.data.len + +proc len*[A](stack: TStack[A]): int = + result = stack.count + +proc push*[A](s: var TStack[A], item: A) = + if s.count == s.data.len: + # not enough room, make container bigger + var d: Seq[A] + newSeq(d,s.len * 2) + for i in 0 .. s.data.len - 1: + shallowCopy(d[i],s.data[i]) + shallowCopy(s.data,d) + s.data[s.count] = item + inc(s.count) + +proc pop*[A](s: var TStack[A]): A {.raises: [EStackEmpty].}= + if s.count == 0: + raise newException(EStackEmpty,"the stack is empty") + dec(s.count) + result = s.data[s.count] + +proc top*[A](s: TStack[A]): A = + result = s.data[s.count - 1] + +proc isEmpty*[A](s: var TStack[A]): bool = + return s.count == 0 + +#Tests +when isMainModule: + var stk: TStack[char] = initStack[char](4) + stk.push('a') + stk.push('b') + stk.push('c') + stk.push('d') + + assert(stk.count == 4) + assert(stk.data.len == 4) + stk.push('e') + assert(stk.cap == 8) + assert(stk.top == 'e') + + + discard stk.pop + discard stk.pop + discard stk.pop + discard stk.pop + assert(stk.isEmpty == false) + discard stk.pop + assert(stk.isEmpty == true) + + try: + discard stk.pop + except: + let + e = getCurrentException() + msg = getCurrentExceptionMsg() + echo "Exception: [[", repr(e), "]] msg: ", msg diff --git a/Task/Stack/Oforth/stack-1.oforth b/Task/Stack/Oforth/stack-1.oforth new file mode 100644 index 0000000000..db7a30812c --- /dev/null +++ b/Task/Stack/Oforth/stack-1.oforth @@ -0,0 +1,4 @@ +ListBuffer Class new: Stack +Stack method: push self add ; +Stack method: pop self removeLast ; +Stack method: top self last ; diff --git a/Task/Stack/Oforth/stack-2.oforth b/Task/Stack/Oforth/stack-2.oforth new file mode 100644 index 0000000000..1b38aa4fd0 --- /dev/null +++ b/Task/Stack/Oforth/stack-2.oforth @@ -0,0 +1,11 @@ +: testStack +| s | + Stack new ->s + s push(10) + s push(11) + s push(12) + s top println + s pop println + s pop println + s pop println + s isEmpty ifTrue: [ "Stack is empty" println ] ; diff --git a/Task/Stack/Phix/stack-1.phix b/Task/Stack/Phix/stack-1.phix new file mode 100644 index 0000000000..c2a5113e67 --- /dev/null +++ b/Task/Stack/Phix/stack-1.phix @@ -0,0 +1,23 @@ +sequence stack = {} + +procedure push(object what) + stack = append(stack,what) +end procedure + +function pop() + object what = stack[$] + stack = stack[1..$-1] + return what +end function + +function empty() + return length(stack)=0 +end function + +?empty() -- 1 +push(5) +?empty() -- 0 +push(6) +?pop() -- 6 +?pop() -- 5 +?empty() -- 1 diff --git a/Task/Stack/Phix/stack-2.phix b/Task/Stack/Phix/stack-2.phix new file mode 100644 index 0000000000..c5d0f9a47b --- /dev/null +++ b/Task/Stack/Phix/stack-2.phix @@ -0,0 +1,26 @@ +function push(sequence stack, object what) + stack = append(stack,what) + return stack +end function + +function pop(sequence stack) + object what = stack[$] + stack = stack[1..$-1] + return {stack,what} +end function + +function empty(sequence stack) + return length(stack)=0 +end function + +sequence stack = {} +?empty(stack) -- 1 +stack = push(stack,5) +?empty(stack) -- 0 +stack = push(stack,6) +integer top +{stack,top} = pop(stack) +?top -- 6 +{stack,top} = pop(stack) +?top -- 5 +?empty(stack) -- 1 diff --git a/Task/Stack/Phix/stack-3.phix b/Task/Stack/Phix/stack-3.phix new file mode 100644 index 0000000000..fca54f9a15 --- /dev/null +++ b/Task/Stack/Phix/stack-3.phix @@ -0,0 +1,43 @@ +sequence stacks = {} +integer freelist = 0 + +function new_stack() +integer res = freelist + if res!=0 then + freelist = stacks[freelist] + stacks[res] = {} + else + stacks = append(stacks,{}) + res = length(stacks) + end if + return res +end function + +procedure free_stack(integer sid) + stacks[sid] = freelist + freelist = sid +end procedure + +procedure push(integer sid, object what) + stacks[sid] = append(stacks[sid],what) +end procedure + +function pop(integer sid) + object res = stacks[sid][$] + stacks[sid] = stacks[sid][1..$-1] + return res +end function + +function empty(integer sid) + return length(stacks[sid])=0 +end function + +integer sid = new_stack() +?empty(sid) -- 1 +push(sid,5) +?empty(sid) -- 0 +push(sid,6) +?pop(sid) -- 6 +?pop(sid) -- 5 +?empty(sid) -- 1 +free_stack(sid) diff --git a/Task/Stack/Sidef/stack-1.sidef b/Task/Stack/Sidef/stack-1.sidef new file mode 100644 index 0000000000..65a8d85f6a --- /dev/null +++ b/Task/Stack/Sidef/stack-1.sidef @@ -0,0 +1,4 @@ +var stack = []; +stack.push(42); # pushing +say stack.pop; # popping +say stack.is_empty; # is_emtpy? diff --git a/Task/Stack/Sidef/stack-2.sidef b/Task/Stack/Sidef/stack-2.sidef new file mode 100644 index 0000000000..848251ede4 --- /dev/null +++ b/Task/Stack/Sidef/stack-2.sidef @@ -0,0 +1,10 @@ +class Stack(stack=[]) { + method pop { stack.pop }; + method push(item) { stack.push(item) }; + method empty { stack.is_empty }; +} + +var stack = Stack(); +stack.push(42); +say stack.pop; # => 42 +say stack.empty; # => true diff --git a/Task/Stack/Swift/stack.swift b/Task/Stack/Swift/stack.swift new file mode 100644 index 0000000000..8cd4d9c1d0 --- /dev/null +++ b/Task/Stack/Swift/stack.swift @@ -0,0 +1,26 @@ +struct Stack { + var items = [T]() + var empty:Bool { + return items.count == 0 + } + + func peek() -> T { + return items[items.count - 1] + } + + mutating func pop() -> T { + return items.removeLast() + } + + mutating func push(obj:T) { + items.append(obj) + } +} + +var stack = Stack() +stack.push(1) +stack.push(2) +println(stack.pop()) +println(stack.peek()) +stack.pop() +println(stack.empty) diff --git a/Task/Stack/Wart/stack.wart b/Task/Stack/Wart/stack.wart new file mode 100644 index 0000000000..7060f8015d --- /dev/null +++ b/Task/Stack/Wart/stack.wart @@ -0,0 +1,11 @@ +def (stack) + (tag 'stack nil) + +mac (push! x s) :qcase `(isa stack ,s) + `(push! ,x (rep ,s)) + +mac (pop! s) :qcase `(isa stack ,s) + `(pop! (rep ,s)) + +def (empty? s) :case (isa stack s) + (empty? rep.s) diff --git a/Task/Stack/XLISP/stack-1.xlisp b/Task/Stack/XLISP/stack-1.xlisp new file mode 100644 index 0000000000..801a8f9d7c --- /dev/null +++ b/Task/Stack/XLISP/stack-1.xlisp @@ -0,0 +1,17 @@ +(define-class stack + (instance-variables vals)) + +(define-method (stack 'initialize) + (setq vals '()) + self) + +(define-method (stack 'push x) + (setq vals (cons x vals))) + +(define-method (stack 'pop) + (define tos (car vals)) + (setq vals (cdr vals)) + tos) + +(define-method (stack 'emptyp) + (null vals)) diff --git a/Task/Stack/XLISP/stack-2.xlisp b/Task/Stack/XLISP/stack-2.xlisp new file mode 100644 index 0000000000..e9b4d58d5c --- /dev/null +++ b/Task/Stack/XLISP/stack-2.xlisp @@ -0,0 +1,23 @@ +; Loading 'stack.lsp' +[1] (define st (stack 'new)) + +ST +[2] (st 'push 1) + +(1) +[3] (st 'push 2) + +(2 1) +[4] (st 'emptyp) + +() +[5] (st 'pop) + +2 +[6] (st 'pop) + +1 +[7] (st 'emptyp) + +#T +[8] diff --git a/Task/Stair-climbing-puzzle/EchoLisp/stair-climbing-puzzle.echolisp b/Task/Stair-climbing-puzzle/EchoLisp/stair-climbing-puzzle.echolisp new file mode 100644 index 0000000000..2e1faa25e5 --- /dev/null +++ b/Task/Stair-climbing-puzzle/EchoLisp/stair-climbing-puzzle.echolisp @@ -0,0 +1,21 @@ +(define (step-up) (while (not (step)) (step-up))) +;; checking this is tail-recusive : +step-up + → (#λ null (#while (#not (step)) (#lambda-tail-call))) + +;; Experimentation (not part of the task) +;; How much step calls to climb 1000 stairs ? +;; success is the robot success probability +(define (step) + (set! STEPS (1+ STEPS)) ;; count + (< (random) SUCCESS)) ;; ->#t or #f + +(define (climb stairs) + (when (> stairs 0) (step-up) (climb (1- stairs)))) + +(define (task (stairs 1000)) + (for ((success (in-range 1 0 -5/100))) + (set! SUCCESS success) + (set! STEPS 0) + (climb stairs) + (writeln 'stairs stairs 'probability success 'steps STEPS))) diff --git a/Task/Stair-climbing-puzzle/Nim/stair-climbing-puzzle.nim b/Task/Stair-climbing-puzzle/Nim/stair-climbing-puzzle.nim new file mode 100644 index 0000000000..8c6b3b02d8 --- /dev/null +++ b/Task/Stair-climbing-puzzle/Nim/stair-climbing-puzzle.nim @@ -0,0 +1,11 @@ +proc stepUp1 = + var deficit = 1 + while deficit > 0: + if step(): + dec deficit + else: + inc deficit + +proc stepUp2 = + while not step(): + stepUp2() diff --git a/Task/Stair-climbing-puzzle/Phix/stair-climbing-puzzle.phix b/Task/Stair-climbing-puzzle/Phix/stair-climbing-puzzle.phix new file mode 100644 index 0000000000..aa01b15e3f --- /dev/null +++ b/Task/Stair-climbing-puzzle/Phix/stair-climbing-puzzle.phix @@ -0,0 +1,3 @@ +procedure step_up() + while not step() do step_up() end while +end procedure diff --git a/Task/Stair-climbing-puzzle/Ring/stair-climbing-puzzle.ring b/Task/Stair-climbing-puzzle/Ring/stair-climbing-puzzle.ring new file mode 100644 index 0000000000..d94a69c375 --- /dev/null +++ b/Task/Stair-climbing-puzzle/Ring/stair-climbing-puzzle.ring @@ -0,0 +1,11 @@ +stepup() + +func stepup + n = 0 + while n < 1 + if stp() n=n+1 else n= n-1 ok + see n + nl + end + +func stp + return 0 diff --git a/Task/Stair-climbing-puzzle/Sidef/stair-climbing-puzzle.sidef b/Task/Stair-climbing-puzzle/Sidef/stair-climbing-puzzle.sidef new file mode 100644 index 0000000000..87e3b5bafa --- /dev/null +++ b/Task/Stair-climbing-puzzle/Sidef/stair-climbing-puzzle.sidef @@ -0,0 +1,5 @@ +func step_up() { + while (!step()) { + step_up(); + } +} diff --git a/Task/Stair-climbing-puzzle/Swift/stair-climbing-puzzle-1.swift b/Task/Stair-climbing-puzzle/Swift/stair-climbing-puzzle-1.swift new file mode 100644 index 0000000000..c683f4c5fd --- /dev/null +++ b/Task/Stair-climbing-puzzle/Swift/stair-climbing-puzzle-1.swift @@ -0,0 +1,5 @@ +func step_up() { + while !step() { + step_up() + } +} diff --git a/Task/Stair-climbing-puzzle/Swift/stair-climbing-puzzle-2.swift b/Task/Stair-climbing-puzzle/Swift/stair-climbing-puzzle-2.swift new file mode 100644 index 0000000000..0539b8b295 --- /dev/null +++ b/Task/Stair-climbing-puzzle/Swift/stair-climbing-puzzle-2.swift @@ -0,0 +1,3 @@ +func step_up() { + for var i = 0; i < 1; step()? ++i : --i { } +} diff --git a/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-1.jq b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-1.jq new file mode 100644 index 0000000000..8447647e52 --- /dev/null +++ b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-1.jq @@ -0,0 +1 @@ +def tick: .+1; diff --git a/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-2.jq b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-2.jq new file mode 100644 index 0000000000..c8d95de424 --- /dev/null +++ b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-2.jq @@ -0,0 +1 @@ +def random: [0, 0, 0, 1, 0, 1, 1, 0]; diff --git a/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-3.jq b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-3.jq new file mode 100644 index 0000000000..b1bb41252b --- /dev/null +++ b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-3.jq @@ -0,0 +1,3 @@ +def step: + random as $r + | if . >= ($r|length) then true else ($r[.] == 1) end ; diff --git a/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-4.jq b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-4.jq new file mode 100644 index 0000000000..c513931d00 --- /dev/null +++ b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-4.jq @@ -0,0 +1,4 @@ +def step_up: + if step then tick + else tick | step_up | step_up + end; diff --git a/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-5.jq b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-5.jq new file mode 100644 index 0000000000..9f0717c813 --- /dev/null +++ b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-5.jq @@ -0,0 +1 @@ +0 | step_up diff --git a/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-6.jq b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-6.jq new file mode 100644 index 0000000000..e2e1b946fd --- /dev/null +++ b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-6.jq @@ -0,0 +1,2 @@ +$ jq -n -f stair-climbing_puzzle.jq +11 diff --git a/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-7.jq b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-7.jq new file mode 100644 index 0000000000..da2e76cfa9 --- /dev/null +++ b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-7.jq @@ -0,0 +1,7 @@ +def tco_step_up: + .[0] as $time | .[1] as $goal + | if $goal == 0 then $time + else + if $time|step then $goal - 1 else $goal + 1 end + | [ ($time|tick), .] | tco_step_up + end ; diff --git a/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-8.jq b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-8.jq new file mode 100644 index 0000000000..2b93c761bf --- /dev/null +++ b/Task/Stair-climbing-puzzle/jq/stair-climbing-puzzle-8.jq @@ -0,0 +1 @@ +[0,1] | tco_step_up diff --git a/Task/Start-from-a-main-routine/FreeBASIC/start-from-a-main-routine.freebasic b/Task/Start-from-a-main-routine/FreeBASIC/start-from-a-main-routine.freebasic new file mode 100644 index 0000000000..b41738cbb6 --- /dev/null +++ b/Task/Start-from-a-main-routine/FreeBASIC/start-from-a-main-routine.freebasic @@ -0,0 +1,8 @@ +' FB 1.05.0 Win64 + +Sub main() + Print "Hello from main!" +End Sub + +main +Sleep diff --git a/Task/Start-from-a-main-routine/Oforth/start-from-a-main-routine-1.oforth b/Task/Start-from-a-main-routine/Oforth/start-from-a-main-routine-1.oforth new file mode 100644 index 0000000000..eb4615bee7 --- /dev/null +++ b/Task/Start-from-a-main-routine/Oforth/start-from-a-main-routine-1.oforth @@ -0,0 +1,4 @@ +: main(n) + "Sleeping..." println + n sleep + "Awake and leaving." println ; diff --git a/Task/Start-from-a-main-routine/Oforth/start-from-a-main-routine-2.oforth b/Task/Start-from-a-main-routine/Oforth/start-from-a-main-routine-2.oforth new file mode 100644 index 0000000000..bccb16c339 --- /dev/null +++ b/Task/Start-from-a-main-routine/Oforth/start-from-a-main-routine-2.oforth @@ -0,0 +1,6 @@ +: main(n) + "Sleeping..." println + n sleep + "Awake and leaving." println ; + +10000 main diff --git a/Task/Start-from-a-main-routine/Phix/start-from-a-main-routine.phix b/Task/Start-from-a-main-routine/Phix/start-from-a-main-routine.phix new file mode 100644 index 0000000000..c215911a2b --- /dev/null +++ b/Task/Start-from-a-main-routine/Phix/start-from-a-main-routine.phix @@ -0,0 +1,4 @@ +procedure main() + ... +end procedure +main() diff --git a/Task/State-name-puzzle/LiveCode/state-name-puzzle.livecode b/Task/State-name-puzzle/LiveCode/state-name-puzzle.livecode new file mode 100644 index 0000000000..c0b73489a7 --- /dev/null +++ b/Task/State-name-puzzle/LiveCode/state-name-puzzle.livecode @@ -0,0 +1,45 @@ +function pairwiseAnagrams X + if the optionkey is down then breakpoint + put the long seconds into T + put empty into itemsSoFar + repeat for each item W in X + put word 1 to -1 of W into W + if D[W] = 1 then next repeat + put 1 into D[W] + repeat for each item W2 in itemsSoFar + put W,W2 & cr after WPairs[sortChars(W & W2,true)] + end repeat + put W & comma after itemsSoFar + end repeat + repeat for each key K in WPairs + put empty into pairsSoFar + repeat for each line L in WPairs[K] + repeat for each line L2 in pairsSoFar + if item 1 of L is among the items of L2 or item 2 of L is among the items of L2 then next repeat + put L && "and" && L2 & cr after R + end repeat + put L & cr after pairsSoFar + end repeat + end repeat + put the long seconds - T + return char 1 to -2 of R +end pairwiseAnagrams + +function sortChars X,lettersOnly + get charsToItems(X,lettersOnly) + sort items of it + return itemsToChars(it) +end sortChars +  +function charsToItems X,lettersOnly + repeat for each char C in X + if lettersOnly and C is not in "abcdefghijklmnopqrstuvwxyz" then next repeat + put C & comma after R + end repeat + return char 1 to -2 of R +end charsToItems +  +function itemsToChars X + replace comma with empty in X + return X +end itemsToChars diff --git a/Task/State-name-puzzle/jq/state-name-puzzle-1.jq b/Task/State-name-puzzle/jq/state-name-puzzle-1.jq new file mode 100644 index 0000000000..453025460b --- /dev/null +++ b/Task/State-name-puzzle/jq/state-name-puzzle-1.jq @@ -0,0 +1,40 @@ +# Input: a string +# Output: an array, being the exploded form of the normalized input +def normalize: + explode + | map(if . >= 97 then (. - 97) elif . >= 65 then (. - 65) else empty end); + +# Input: an array of strings +# Output: a dictionary with key:value pairs: normalizedString:string +def dictionary: + reduce .[] as $s ( {}; . + { ($s|normalize|implode): $s }); + +# Input: an array of strings (e.g. state names) +# Output: a stream of solutions +def solve: + + # Given a pair of normalized state names as lists of integers: + def nletters: map(length) | add; + + # input [[s1,s2], [t2,t2]] + def solved: + ( .[0] | add | sort) == (.[1] | add | sort); + + unique + | length as $l + | dictionary as $dictionary + | ($dictionary | keys | map(explode)) as $states + | reduce ( range(0; $l) as $s1 + | range($s1+1; $l) as $s2 + | range($s1+1; $l) as $t1 + | select($s2 != $t1) + | range($t1+1; $l) as $t2 + | select($s2 != $t2) + | [[$states[$s1], $states[$s2]], [$states[$t1], $states[$t2]]] ) as $quad + ([]; + if ($quad[0] | nletters) == ($quad[1] | nletters) + and ($quad | solved) + then . + [$quad | map( map( $dictionary[ implode ] ))] + else . + end) + | .[]; diff --git a/Task/State-name-puzzle/jq/state-name-puzzle-2.jq b/Task/State-name-puzzle/jq/state-name-puzzle-2.jq new file mode 100644 index 0000000000..79c83a2f3f --- /dev/null +++ b/Task/State-name-puzzle/jq/state-name-puzzle-2.jq @@ -0,0 +1,20 @@ +def States: [ + "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", + "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", + "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", + "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", + "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", + "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", + "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", + "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", + "Washington", "West Virginia", "Wisconsin", "Wyoming" +]; + +def task: + "Real state names:", + (States | solve), + "", + "States together with fictional state names:", + (States + ["New Kory", "Wen Kory", "York New", "Kory New", "New Kory"] | solve) ; + +task diff --git a/Task/State-name-puzzle/jq/state-name-puzzle-3.jq b/Task/State-name-puzzle/jq/state-name-puzzle-3.jq new file mode 100644 index 0000000000..cb222cbff4 --- /dev/null +++ b/Task/State-name-puzzle/jq/state-name-puzzle-3.jq @@ -0,0 +1,21 @@ +$ jq -c -n -r -f State_name_puzzle.jq +Real state names: +[["North Carolina","South Dakota"],["North Dakota","South Carolina"]] + +States together with fictional state names: +[["Kory New","New Kory"],["New York","Wen Kory"]] +[["Kory New","New Kory"],["New York","York New"]] +[["Kory New","New Kory"],["Wen Kory","York New"]] +[["Kory New","New York"],["New Kory","Wen Kory"]] +[["Kory New","New York"],["New Kory","York New"]] +[["Kory New","New York"],["Wen Kory","York New"]] +[["Kory New","Wen Kory"],["New Kory","New York"]] +[["Kory New","Wen Kory"],["New Kory","York New"]] +[["Kory New","Wen Kory"],["New York","York New"]] +[["Kory New","York New"],["New Kory","New York"]] +[["Kory New","York New"],["New Kory","Wen Kory"]] +[["Kory New","York New"],["New York","Wen Kory"]] +[["New Kory","New York"],["Wen Kory","York New"]] +[["New Kory","Wen Kory"],["New York","York New"]] +[["New Kory","York New"],["New York","Wen Kory"]] +[["North Carolina","South Dakota"],["North Dakota","South Carolina"]] diff --git a/Task/Statistics-Basic/FreeBASIC/statistics-basic.freebasic b/Task/Statistics-Basic/FreeBASIC/statistics-basic.freebasic new file mode 100644 index 0000000000..85d1285145 --- /dev/null +++ b/Task/Statistics-Basic/FreeBASIC/statistics-basic.freebasic @@ -0,0 +1,69 @@ +' FB 1.05.0 Win64 + +Randomize + +Sub basicStats(sampleSize As Integer) + If sampleSize < 1 Then Return + Dim r(1 To sampleSize) As Double + Dim h(0 To 9) As Integer '' all zero by default + Dim sum As Double = 0.0 + Dim hSum As Integer = 0 + + ' Generate 'sampleSize' random numbers in the interval [0, 1) + ' calculate their sum + ' and in which box they will fall when drawing the histogram + For i As Integer = 1 To sampleSize + r(i) = Rnd + sum += r(i) + h(Int(r(i) * 10)) += 1 + Next + + For i As Integer = 0 To 9 : hSum += h(i) : Next + ' adjust one of the h() values if necessary to ensure hSum = sampleSize + Dim adj As Integer = sampleSize - hSum + If adj <> 0 Then + For i As Integer = 0 To 9 + h(i) += adj + If h(i) >= 0 Then Exit For + h(i) -= adj + Next + End If + + Dim mean As Double = sum / sampleSize + + Dim sd As Double + sum = 0.0 + ' Now calculate their standard deviation + For i As Integer = 1 To sampleSize + sum += (r(i) - mean) ^ 2.0 + Next + sd = Sqr(sum/sampleSize) + + ' Draw a histogram of the data with interval 0.1 + Dim numStars As Integer + ' If sample size > 500 then normalize histogram to 500 + Dim scale As Double = 1.0 + If sampleSize > 500 Then scale = 500.0 / sampleSize + Print "Sample size "; sampleSize + Print + Print Using " Mean #.######"; mean; + Print Using " SD #.######"; sd + Print + For i As Integer = 0 To 9 + Print Using " #.## : "; i/10.0; + Print Using "##### " ; h(i); + numStars = Int(h(i) * scale + 0.5) + Print String(numStars, "*") + Next +End Sub + +basicStats 100 +Print +basicStats 1000 +Print +basicStats 10000 +Print +basicStats 100000 +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Statistics-Basic/Hy/statistics-basic.hy b/Task/Statistics-Basic/Hy/statistics-basic.hy new file mode 100644 index 0000000000..972562252e --- /dev/null +++ b/Task/Statistics-Basic/Hy/statistics-basic.hy @@ -0,0 +1,11 @@ +(import + [numpy.random [random]] + [numpy [mean std]] + [matplotlib.pyplot :as plt]) + +(for [n [100 1000 10000]] + (setv v (random n)) + (print "Mean:" (mean v) "SD:" (std v))) + +(plt.hist (random 1000)) +(plt.show) diff --git a/Task/Statistics-Basic/Lasso/statistics-basic.lasso b/Task/Statistics-Basic/Lasso/statistics-basic.lasso new file mode 100644 index 0000000000..4c80860322 --- /dev/null +++ b/Task/Statistics-Basic/Lasso/statistics-basic.lasso @@ -0,0 +1,51 @@ +define stat1(a) => { + if(#a->size) => { + local(mean = (with n in #a sum #n) / #a->size) + local(sdev = math_pow(((with n in #a sum Math_Pow((#n - #mean),2)) / #a->size),0.5)) + return (:#sdev, #mean) + else + return (:0,0) + } +} +define stat2(a) => { + if(#a->size) => { + local(sx = 0, sxx = 0) + with x in #a do => { + #sx += #x + #sxx += #x*#x + } + local(sdev = math_pow((#a->size * #sxx - #sx * #sx),0.5) / #a->size) + return (:#sdev, #sx / #a->size) + else + return (:0,0) + } +} +define histogram(a) => { + local( + out = '\r', + h = array(0,0,0,0,0,0,0,0,0,0,0), + maxwidth = 50, + sc = 0 + ) + with n in #a do => { + #h->get(integer(#n*10)+1) += 1 + } + local(mx = decimal(with n in #h max #n)) + with i in #h do => { + #out->append((#sc/10.0)->asString(-precision=1)+': '+('+' * integer(#i / #mx * #maxwidth))+'\r') + #sc++ + } + return #out +} + +with scale in array(100,1000,10000,100000) do => {^ + local(n = array) + loop(#scale) => { #n->insert(decimal_random) } + local(sdev1,mean1) = stat1(#n) + local(sdev2,mean2) = stat2(#n) + #scale' numbers:\r' + 'Naive method: sd: '+#sdev1+', mean: '+#mean1+'\r' + 'Second method: sd: '+#sdev2+', mean: '+#mean2+'\r' + histogram(#n) + '\r\r' +^} diff --git a/Task/Statistics-Basic/Nim/statistics-basic.nim b/Task/Statistics-Basic/Nim/statistics-basic.nim new file mode 100644 index 0000000000..c229c2ef15 --- /dev/null +++ b/Task/Statistics-Basic/Nim/statistics-basic.nim @@ -0,0 +1,32 @@ +import math, strutils +randomize() + +proc sd(ns): auto = + var sx, sxx = 0.0 + for x in ns: + sx += x + sxx += x * x + let sd = if ns.len > 0: sqrt(float(ns.len) * sxx - sx * sx) / float(ns.len) + else: 0 + (sd, sx / float(ns.len)) + +proc histogram(ns) = + var h = newSeq[int](10) + for n in ns: + let pos = int(n * 10) + inc h[pos] + + const maxWidth = 50 + let mx = max(h) + echo "" + for n, i in h: + echo n/10,": ",repeatChar(int(i / mx * maxWidth), '+') + echo "" + +for i in [10, 100, 1_000, 10_000, 100_000]: + var n = newSeq[float](i) + for x in 0..n.high: n[x] = random(1.0) + echo "\n##\n## ",i," numbers\n##" + let (sd, mean) = sd(n) + echo "sd: ",sd,", mean: ",mean + histogram(n) diff --git a/Task/Statistics-Basic/Oforth/statistics-basic.oforth b/Task/Statistics-Basic/Oforth/statistics-basic.oforth new file mode 100644 index 0000000000..be27eb0202 --- /dev/null +++ b/Task/Statistics-Basic/Oforth/statistics-basic.oforth @@ -0,0 +1,15 @@ +: main(n) +| l m std i nb | + + // Create list and calculate avg and stddev + ListBuffer init(n, #[ Float rand ]) dup ->l avg ->m + 0 l apply(#[ sq +]) n / m sq - sqrt ->std + System.Out "n = " << n << ", avg = " << m << ", std = " << std << cr + + // Histo + 0.0 0.9 0.1 step: i [ + l count(#[ between(i, i 0.1 +) ]) 400 * n / asInteger ->nb + System.Out i < element / 10) + .mapItems((Integer key, [Integer+] item) => item.map((Integer element) => element % 10)) + .mapItems((Integer key, {Integer+} item) => sort(item)); + + value lastStem = stemsToLeaves.keys.last else 0; + for(i in 0..lastStem) { + print("``formatInteger(i).padLeading(2)``| ``" ".join(stemsToLeaves[i] else [])``"); + } +} diff --git a/Task/Stem-and-leaf-plot/FreeBASIC/stem-and-leaf-plot.freebasic b/Task/Stem-and-leaf-plot/FreeBASIC/stem-and-leaf-plot.freebasic new file mode 100644 index 0000000000..9800c1e230 --- /dev/null +++ b/Task/Stem-and-leaf-plot/FreeBASIC/stem-and-leaf-plot.freebasic @@ -0,0 +1,79 @@ +' version 22-06-2015 +' compile with: fbc -s console +' for boundry checks on array's compile with: fbc -s console -exx +' from the rosetta code FreeBASIC entry +#Define out_of_data 99999999 ' any number that is not in the set will do + +Sub shellsort(s() As Integer) + ' from the FreeBASIC entry at rosetta code + ' sort from lower bound to the highter bound + Dim As Integer lb = LBound(s) + Dim As Integer ub = UBound(s) + Dim As Integer done, i, inc = ub - lb + + Do + inc = inc / 2.2 + If inc < 1 Then inc = 1 + Do + done = 0 + For i = lb To ub - inc + If s(i) > s(i + inc) Then + Swap s(i), s(i + inc) + done = 1 + End If + Next + Loop Until done = 0 + Loop Until inc = 1 + +End Sub + +' ------=< TASK DATA >=------ + +Data 12, 127, 28, 42, 39, 113, 42, 18, 44, 118, 44, 37, 113, 124 +Data 37, 48, 127, 36, 29, 31, 125, 139, 131, 115, 105, 132, 104, 123 +Data 35, 113, 122, 42, 117, 119, 58, 109, 23, 105, 63, 27, 44, 105 +Data 99, 41, 128, 121, 116, 125, 32, 61, 37, 127, 29, 113, 121, 58 +Data 114, 126, 53, 114, 96, 25, 109, 7, 31, 141, 46, 13, 27, 43 +Data 117, 116, 27, 7, 68, 40, 31, 115, 124, 42, 128, 52, 71, 118 +Data 117, 38, 27, 106, 33, 117, 116, 111, 40, 119, 47, 105, 57, 122 +Data 109, 124, 115, 43, 120, 43, 27, 27, 18, 28, 48, 125, 107, 114 +Data 34, 133, 45, 120, 30, 127, 31, 116, 146 +Data out_of_data + +' ------=< MAIN >=------ + +Dim As String read_in +Dim As Integer i, x, y, count = -1 ' to let the index start on 0 +Dim As Integer d() +ReDim d(300) ' big enough to hold data index start at 0 + +Do + Read i + If i = out_of_data Then Exit Do + count = count + 1 + d(count) = i +Loop + +ReDim Preserve d(count) ' trim the data array +shellsort(d()) ' sort data array + +i = 0 +For y = d(0) \ 10 To d(UBound(d)) \ 10 + Print Using "#### |"; y; + Do + x = d(i) \ 10 ' \ = integer division + If y = x Then + Print Using "##"; d(i) Mod 10; + i = i + 1 + Else + Exit Do + End If + Loop While i <= UBound(d) + Print ' force linefeed +Next + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Stem-and-leaf-plot/Phix/stem-and-leaf-plot.phix b/Task/Stem-and-leaf-plot/Phix/stem-and-leaf-plot.phix new file mode 100644 index 0000000000..a3d6acc89a --- /dev/null +++ b/Task/Stem-and-leaf-plot/Phix/stem-and-leaf-plot.phix @@ -0,0 +1,26 @@ +procedure leaf_plot(sequence s) +sequence stem + s = sort(s) + stem = repeat({},floor(s[$]/10)+1) + for i=1 to length(s) do + stem[floor(s[i]/10)+1] &= remainder(s[i],10) + end for + for i=1 to length(stem) do + printf(1, "%3d | ", i-1) + for j=1 to length(stem[i]) do + printf(1, "%d ", stem[i][j]) + end for + puts(1,'\n') + end for +end procedure + +constant data = { 12, 127, 28, 42, 39, 113, 42, 18, 44, 118, 44, 37, 113, 124, + 37, 48, 127, 36, 29, 31, 125, 139, 131, 115, 105, 132, 104, 123, 35, 113, + 122, 42, 117, 119, 58, 109, 23, 105, 63, 27, 44, 105, 99, 41, 128, 121, + 116, 125, 32, 61, 37, 127, 29, 113, 121, 58, 114, 126, 53, 114, 96, 25, + 109, 7, 31, 141, 46, 13, 27, 43, 117, 116, 27, 7, 68, 40, 31, 115, 124, + 42, 128, 52, 71, 118, 117, 38, 27, 106, 33, 117, 116, 111, 40, 119, 47, + 105, 57, 122, 109, 124, 115, 43, 120, 43, 27, 27, 18, 28, 48, 125, 107, + 114, 34, 133, 45, 120, 30, 127, 31, 116, 146 } + +leaf_plot(data) diff --git a/Task/Stem-and-leaf-plot/Sidef/stem-and-leaf-plot.sidef b/Task/Stem-and-leaf-plot/Sidef/stem-and-leaf-plot.sidef new file mode 100644 index 0000000000..d1fa4afbef --- /dev/null +++ b/Task/Stem-and-leaf-plot/Sidef/stem-and-leaf-plot.sidef @@ -0,0 +1,24 @@ +var data = %i( + 12 127 28 42 39 113 42 18 44 118 44 + 37 113 124 37 48 127 36 29 31 125 139 + 131 115 105 132 104 123 35 113 122 42 117 + 119 58 109 23 105 63 27 44 105 99 41 + 128 121 116 125 32 61 37 127 29 113 121 + 58 114 126 53 114 96 25 109 7 31 141 + 46 13 27 43 117 116 27 7 68 40 31 + 115 124 42 128 52 71 118 117 38 27 106 + 33 117 116 111 40 119 47 105 57 122 109 + 124 115 43 120 43 27 27 18 28 48 125 + 107 114 34 133 45 120 30 127 31 116 146 +).sort; + +var stem_unit = 10; +var h = data.group_by { |i| i / stem_unit -> int } + +var rng = RangeNum(h.keys.map{.to_i}.minmax); +var stem_format = "%#{rng.min.len.max(rng.max.len)}d"; + +rng.each { |stem| + var leafs = (h{stem} \\ []) + say(stem_format % stem, ' | ', leafs.map { _ % stem_unit }.join(' ')) +} diff --git a/Task/Stem-and-leaf-plot/jq/stem-and-leaf-plot-1.jq b/Task/Stem-and-leaf-plot/jq/stem-and-leaf-plot-1.jq new file mode 100644 index 0000000000..dc74b2eed7 --- /dev/null +++ b/Task/Stem-and-leaf-plot/jq/stem-and-leaf-plot-1.jq @@ -0,0 +1,18 @@ +def stem_and_leaf: + + # align-right: + def right: tostring | (4-length) * " " + .; + + sort + | .[0] as $min + | .[length-1] as $max + | "\($min/10|floor|right) | " as $stem + | reduce .[] as $d + # state: [ stem, string ] + ( [ 0, $stem ]; + .[0] as $stem + | if ($d/10) | floor == $stem + then [ $stem, (.[1] + "\($d % 10)" )] + else [ $stem + 1, (.[1] + "\n\($stem+1|right) | \($d % 10)" )] + end ) + | .[1] ; diff --git a/Task/Stem-and-leaf-plot/jq/stem-and-leaf-plot-2.jq b/Task/Stem-and-leaf-plot/jq/stem-and-leaf-plot-2.jq new file mode 100644 index 0000000000..367a8df6bb --- /dev/null +++ b/Task/Stem-and-leaf-plot/jq/stem-and-leaf-plot-2.jq @@ -0,0 +1,11 @@ +def data: + [ 12,127,28,42,39,113, 42,18,44,118,44,37,113,124,37,48,127,36,29,31, + 125,139,131,115,105,132,104,123,35,113,122,42,117,119,58,109,23,105, + 63,27,44,105,99,41,128,121,116,125,32,61,37,127,29,113,121,58,114,126, + 53,114,96,25,109,7,31,141,46,13,27,43,117,116,27,7,68,40,31,115,124,42, + 128,52,71,118,117,38,27,106,33,117,116,111,40,119,47,105,57,122,109, + 124,115,43,120,43,27,27,18,28,48,125,107,114,34,133,45,120, 30,127, + 31,116,146 + ]; + +data | stem_and_leaf diff --git a/Task/Stem-and-leaf-plot/jq/stem-and-leaf-plot-3.jq b/Task/Stem-and-leaf-plot/jq/stem-and-leaf-plot-3.jq new file mode 100644 index 0000000000..1a3d8077c3 --- /dev/null +++ b/Task/Stem-and-leaf-plot/jq/stem-and-leaf-plot-3.jq @@ -0,0 +1,16 @@ + $ jq -n -r -f stem-and-leaf_plot.jq + 0 | 77 + 1 | 2388 + 2 | 357777778899 + 3 | 011112345677789 + 4 | 001222233344456788 + 5 | 23788 + 6 | 138 + 7 | 1 + 8 | 6 + 9 | 9 + 10 | 4555567999 + 11 | 13333444555666677778899 + 12 | 00112234445556777788 + 13 | 1239 + 14 | 16 diff --git a/Task/Stern-Brocot-sequence/EchoLisp/stern-brocot-sequence-1.echolisp b/Task/Stern-Brocot-sequence/EchoLisp/stern-brocot-sequence-1.echolisp new file mode 100644 index 0000000000..7b7b0071ba --- /dev/null +++ b/Task/Stern-Brocot-sequence/EchoLisp/stern-brocot-sequence-1.echolisp @@ -0,0 +1,9 @@ +;; stern (2n ) = stern (n) +;; stern(2n+1) = stern(n) + stern(n+1) + +(define (stern n) + (cond + (( < n 3) 1) + ((even? n) (stern (/ n 2))) + (else (let ((m (/ (1- n) 2))) (+ (stern m) (stern (1+ m))))))) +(remember 'stern) diff --git a/Task/Stern-Brocot-sequence/EchoLisp/stern-brocot-sequence-2.echolisp b/Task/Stern-Brocot-sequence/EchoLisp/stern-brocot-sequence-2.echolisp new file mode 100644 index 0000000000..4a4cb33cb0 --- /dev/null +++ b/Task/Stern-Brocot-sequence/EchoLisp/stern-brocot-sequence-2.echolisp @@ -0,0 +1,20 @@ +; generate the sequence and check GCD +(for ((n 10000)) + (unless (= (gcd (stern n) (stern (1+ n))) 1) (error "BAD GCD" n))) + → #t + +;; first items +(define sterns (cache 'stern)) +(subvector sterns 1 16) + → #( 1 1 2 1 3 2 3 1 4 3 5 2 5 3 4) + +;; first occurences index +(for ((i (in-range 1 11))) (write (vector-index i sterns))) +→ 0 3 5 9 11 33 19 21 35 39 + +;; 100 +(writeln (vector-index 100 sterns)) +→ 1179 + +(stern 900000) → 446 +(stern 900001) → 2479 diff --git a/Task/Stern-Brocot-sequence/EchoLisp/stern-brocot-sequence-3.echolisp b/Task/Stern-Brocot-sequence/EchoLisp/stern-brocot-sequence-3.echolisp new file mode 100644 index 0000000000..6e4b3a9dc8 --- /dev/null +++ b/Task/Stern-Brocot-sequence/EchoLisp/stern-brocot-sequence-3.echolisp @@ -0,0 +1,13 @@ +;; grouping +(for ((i (in-range 2 40 2))) (write (/ (stern i)(stern (1+ i))))) +→ 1/2 1/3 2/3 1/4 3/5 2/5 3/4 1/5 4/7 3/8 5/7 2/7 5/8 3/7 4/5 1/6 5/9 4/11 7/10 + +;; computing f(1), f(f(1)), etc. +(define (f x) + (let [(a (/ (- (floor x) -1 (fract x))))] + (if (> a 1) (f a) (cons a a)))) + +(define T (make-stream f 1)) +(for((i 19)) (write (stream-iterate T))) + +→ 1/2 1/3 2/3 1/4 3/5 2/5 3/4 1/5 4/7 3/8 5/7 2/7 5/8 3/7 4/5 1/6 5/9 4/11 7/10 diff --git a/Task/Stern-Brocot-sequence/Oforth/stern-brocot-sequence.oforth b/Task/Stern-Brocot-sequence/Oforth/stern-brocot-sequence.oforth new file mode 100644 index 0000000000..f90753d3de --- /dev/null +++ b/Task/Stern-Brocot-sequence/Oforth/stern-brocot-sequence.oforth @@ -0,0 +1,7 @@ +: stern(n) +| l i | + ListBuffer new dup add(1) dup add(1) dup ->l + n 1- 2 / loop: i [ l at(i) l at(i 1+) tuck + l add l add ] + n 2 mod ifFalse: [ dup removeLast drop ] dup freeze ; + +stern(10000) Constant new: Sterns diff --git a/Task/Stern-Brocot-sequence/Sidef/stern-brocot-sequence.sidef b/Task/Stern-Brocot-sequence/Sidef/stern-brocot-sequence.sidef new file mode 100644 index 0000000000..81503f1047 --- /dev/null +++ b/Task/Stern-Brocot-sequence/Sidef/stern-brocot-sequence.sidef @@ -0,0 +1,34 @@ +# Declare a function to generate the Stern-Brocot sequence +func stern_brocot { + var list = [1, 1]; + func { + list.append(list[0]+list[1], list[1]); + list.shift; + } +} + +# Show the first fifteen members of the sequence. +1..15 -> map(stern_brocot()).join(' ').say; + +# Show the (1-based) index of where the numbers 1-to-10 first appears +# in the sequence, and where the number 100 first appears in the sequence. +[(1..10)..., 100].each { |i| + var index = 1; + var generator = stern_brocot(); + while (generator() != i) { + ++index; + } + say "First occurrence of #{i} is at index #{index}"; +} + +# Check that the greatest common divisor of all the two consecutive +# members of the series up to the 1000th member, is always one. +var generator = stern_brocot(); +var (a, b) = (generator(), generator()); +{ + assert_eq(Math.gcd(a, b), 1); + a = b; + b = generator(); +} * 1000; + +say "All GCD's are 1"; diff --git a/Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-1.jq b/Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-1.jq new file mode 100644 index 0000000000..47ff7f3ff6 --- /dev/null +++ b/Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-1.jq @@ -0,0 +1,12 @@ +def until(cond; update): + def _until: + if cond then . else (update | _until) end; + try _until catch if .== "break" then empty else . end ; + +def gcd(a; b): + # subfunction expects [a,b] as input + # i.e. a ~ .[0] and b ~ .[1] + def rgcd: if .[1] == 0 then .[0] + else [.[1], .[0] % .[1]] | rgcd + end; + [a,b] | rgcd ; diff --git a/Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-2.jq b/Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-2.jq new file mode 100644 index 0000000000..9a8afdc6dd --- /dev/null +++ b/Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-2.jq @@ -0,0 +1,18 @@ +# If n is non-negative, then A002487(n) +# generates an array with at least n elements of +# the A002487 sequence; +# if n is negative, elements are added until (-n) +# is found. +def A002487(n): + [0,1] + | until( + length as $l + | if n >= 0 then $l >= n + else .[$l-1] == -n + end; + length as $l + | ($l / 2) as $n + | .[$l] = .[$n] + | if (.[$l-2] == -n) then . + else .[$l + 1] = .[$n] + .[$n+1] + end ) ; diff --git a/Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-3.jq b/Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-3.jq new file mode 100644 index 0000000000..5e19eec305 --- /dev/null +++ b/Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-3.jq @@ -0,0 +1,31 @@ +# Generate a stream of n integers beginning with 1,1... +def stern_brocot(n): A002487(n+1) | .[1:n+1][]; + +# Return the index (counting from 1) of n in the +# sequence starting with 1,1,... +def stern_brocot_index(n): + A002487(-n) | length -1 ; + +def index_task: + (range(1;11), 100) as $i + | "index of \($i) is \(stern_brocot_index($i))" ; + +def gcd_task: + A002487(1000) + | . as $A + | reduce range(0; length-1) as $i + ( []; + gcd( $A[$i]; $A[$i+1] ) as $gcd + | if $gcd == 1 then . else . + [$gcd] end) + | if length == 0 then "GCDs are all 1" + else "GCDs include \(.)" end ; + + +"First 15 integers of the Stern-Brocot sequence", +"as defined in the task description are:", +stern_brocot(15), +"", +"Using an index origin of 1:", +index_task, +"", +gcd_task diff --git a/Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-4.jq b/Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-4.jq new file mode 100644 index 0000000000..aa0589a6b2 --- /dev/null +++ b/Task/Stern-Brocot-sequence/jq/stern-brocot-sequence-4.jq @@ -0,0 +1,33 @@ +$ jq -r -n -f stern_brocot.jq +First 15 integers of the Stern-Brocot sequence +as defined in the task description are: +1 +1 +2 +1 +3 +2 +3 +1 +4 +3 +5 +2 +5 +3 +4 + +Using an index origin of 1: +index of 1 is 1 +index of 2 is 3 +index of 3 is 5 +index of 4 is 9 +index of 5 is 11 +index of 6 is 33 +index of 7 is 19 +index of 8 is 21 +index of 9 is 35 +index of 10 is 39 +index of 100 is 1179 + +GCDs are all 1 diff --git a/Task/String-append/Axe/string-append.axe b/Task/String-append/Axe/string-append.axe new file mode 100644 index 0000000000..5fa996b0f1 --- /dev/null +++ b/Task/String-append/Axe/string-append.axe @@ -0,0 +1,4 @@ +Lbl STRCAT +Copy(r₂,r₁+length(r₁),length(r₂)+1) +r₁ +Return diff --git a/Task/String-append/EchoLisp/string-append.echolisp b/Task/String-append/EchoLisp/string-append.echolisp new file mode 100644 index 0000000000..b431b42130 --- /dev/null +++ b/Task/String-append/EchoLisp/string-append.echolisp @@ -0,0 +1,9 @@ +;; Solution from Common Lisp and Racket +(define-syntax-rule (set-append! str tail) + (set! str (string-append str tail))) + +(define name "Albert") → name + +(set-append! name " de Jeumont-Schneidre") +name + → "Albert de Jeumont-Schneidre" diff --git a/Task/String-append/FreeBASIC/string-append.freebasic b/Task/String-append/FreeBASIC/string-append.freebasic new file mode 100644 index 0000000000..2e15506a95 --- /dev/null +++ b/Task/String-append/FreeBASIC/string-append.freebasic @@ -0,0 +1,6 @@ +' FB 1.05.0 Win64 + +Var s = "String" +s += " append" +Print s +Sleep diff --git a/Task/String-append/Lasso/string-append.lasso b/Task/String-append/Lasso/string-append.lasso new file mode 100644 index 0000000000..6bd71ed653 --- /dev/null +++ b/Task/String-append/Lasso/string-append.lasso @@ -0,0 +1,3 @@ +local(x = 'Hello') +#x->append(', World!') +#x diff --git a/Task/String-append/Lingo/string-append.lingo b/Task/String-append/Lingo/string-append.lingo new file mode 100644 index 0000000000..0de508f2c1 --- /dev/null +++ b/Task/String-append/Lingo/string-append.lingo @@ -0,0 +1,4 @@ +str = "Hello" +put " world!" after str +put str +-- "Hello world!" diff --git a/Task/String-append/LiveCode/string-append.livecode b/Task/String-append/LiveCode/string-append.livecode new file mode 100644 index 0000000000..232ef6e75a --- /dev/null +++ b/Task/String-append/LiveCode/string-append.livecode @@ -0,0 +1,2 @@ +local str="live" +put "code" after str diff --git a/Task/String-append/Nim/string-append.nim b/Task/String-append/Nim/string-append.nim new file mode 100644 index 0000000000..a980de728a --- /dev/null +++ b/Task/String-append/Nim/string-append.nim @@ -0,0 +1,3 @@ +var str = "123456" +str.add("78") # two ways +str &= "9!" # to append diff --git a/Task/String-append/Oforth/string-append.oforth b/Task/String-append/Oforth/string-append.oforth new file mode 100644 index 0000000000..1ca97c4a25 --- /dev/null +++ b/Task/String-append/Oforth/string-append.oforth @@ -0,0 +1 @@ +StringBuffer new "Hello, " << "World!" << println diff --git a/Task/String-append/Phix/string-append.phix b/Task/String-append/Phix/string-append.phix new file mode 100644 index 0000000000..95bb626edc --- /dev/null +++ b/Task/String-append/Phix/string-append.phix @@ -0,0 +1,2 @@ +string s = "this string" ?s +s &= " is now longer" ?s diff --git a/Task/String-append/Ring/string-append.ring b/Task/String-append/Ring/string-append.ring new file mode 100644 index 0000000000..618a40cf2b --- /dev/null +++ b/Task/String-append/Ring/string-append.ring @@ -0,0 +1,4 @@ +aString1 = "Welcome to the " +aString2 = "Ring Programming Language" +aString3 = aString1 + aString2 +see aString3 diff --git a/Task/String-append/Sidef/string-append.sidef b/Task/String-append/Sidef/string-append.sidef new file mode 100644 index 0000000000..ae4fc3541c --- /dev/null +++ b/Task/String-append/Sidef/string-append.sidef @@ -0,0 +1,3 @@ +var str = 'Foo'; +str += 'bar'; +say str; diff --git a/Task/String-append/Swift/string-append.swift b/Task/String-append/Swift/string-append.swift new file mode 100644 index 0000000000..c2fc7608c8 --- /dev/null +++ b/Task/String-append/Swift/string-append.swift @@ -0,0 +1,5 @@ +var s = "foo" // "foo" +s += "bar" // "foobar" +print(s) // "foobar" +s.appendContentsOf("baz") // "foobarbaz" +print(s) // "foobarbaz" diff --git a/Task/String-append/Ursa/string-append.ursa b/Task/String-append/Ursa/string-append.ursa new file mode 100644 index 0000000000..8d115664b1 --- /dev/null +++ b/Task/String-append/Ursa/string-append.ursa @@ -0,0 +1,8 @@ +decl string str +set str "hello " + +# append "world" to str +set str (+ str "world") + +# outputs "hello world" +out str endl console diff --git a/Task/String-append/Wart/string-append.wart b/Task/String-append/Wart/string-append.wart new file mode 100644 index 0000000000..b7c6cb3c43 --- /dev/null +++ b/Task/String-append/Wart/string-append.wart @@ -0,0 +1,2 @@ +s <- "12345678" +s <- (s + "9!") diff --git a/Task/String-append/jq/string-append-1.jq b/Task/String-append/jq/string-append-1.jq new file mode 100644 index 0000000000..afbae4ed1c --- /dev/null +++ b/Task/String-append/jq/string-append-1.jq @@ -0,0 +1,5 @@ +"Hello" | . += ", world!" + +["Hello"] | .[0] += ", world!" | .[0] + +{ "greeting": "Hello"} | .greeting += ", world!" | .greeting diff --git a/Task/String-append/jq/string-append-2.jq b/Task/String-append/jq/string-append-2.jq new file mode 100644 index 0000000000..56992d4851 --- /dev/null +++ b/Task/String-append/jq/string-append-2.jq @@ -0,0 +1 @@ +"Hello" as $a | $a | . += ", world!" as $a | $a diff --git a/Task/String-case/ECL/string-case.ecl b/Task/String-case/ECL/string-case.ecl new file mode 100644 index 0000000000..a0dc102311 --- /dev/null +++ b/Task/String-case/ECL/string-case.ecl @@ -0,0 +1,11 @@ +IMPORT STD; //Imports the Standard Library + +STRING MyBaseString := 'alphaBETA'; + +UpperCased := STD.str.toUpperCase(MyBaseString); +LowerCased := STD.str.ToLowerCase(MyBaseString); +TitleCased := STD.str.ToTitleCase(MyBaseString); + +OUTPUT (UpperCased); +OUTPUT (LowerCased); +OUTPUT (TitleCased); diff --git a/Task/String-case/EchoLisp/string-case.echolisp b/Task/String-case/EchoLisp/string-case.echolisp new file mode 100644 index 0000000000..ddae76de50 --- /dev/null +++ b/Task/String-case/EchoLisp/string-case.echolisp @@ -0,0 +1,10 @@ +(string-downcase "alphaBETA") + → "alphabeta" +(string-upcase "alphaBETA") + → "ALPHABETA" +(string-titlecase "alphaBETA") + → "Alphabeta" +(string-randcase "alphaBETA") + → "alphaBEtA" +(string-randcase "alphaBETA") + → "AlPHaBeTA" diff --git a/Task/String-case/Elm/string-case.elm b/Task/String-case/Elm/string-case.elm new file mode 100644 index 0000000000..b881531165 --- /dev/null +++ b/Task/String-case/Elm/string-case.elm @@ -0,0 +1,6 @@ +import String exposing (toLower, toUpper) + +s = "alphaBETA" + +lower = toLower s +upper = toUpper s diff --git a/Task/String-case/FreeBASIC/string-case.freebasic b/Task/String-case/FreeBASIC/string-case.freebasic new file mode 100644 index 0000000000..699f23109e --- /dev/null +++ b/Task/String-case/FreeBASIC/string-case.freebasic @@ -0,0 +1,6 @@ +' FB 1.05.0 Win64 + +Dim s As String = "alphaBETA" +Print UCase(s) +Print LCase(s) +Sleep diff --git a/Task/String-case/FutureBasic/string-case.futurebasic b/Task/String-case/FutureBasic/string-case.futurebasic new file mode 100644 index 0000000000..862027e30e --- /dev/null +++ b/Task/String-case/FutureBasic/string-case.futurebasic @@ -0,0 +1,10 @@ +include "ConsoleWindow" + +dim as Str255 a + +a = "alphaBETA" + +print a +print ucase$(a) +fn lcase(a) +print a diff --git a/Task/String-case/Lasso/string-case.lasso b/Task/String-case/Lasso/string-case.lasso new file mode 100644 index 0000000000..a24c7f9456 --- /dev/null +++ b/Task/String-case/Lasso/string-case.lasso @@ -0,0 +1,12 @@ +// Direct string return +'alphaBETA'->uppercase& +'alphaBETA'->lowercase& + +// Assignment and manipulation of variables +local(toupper = 'alphaBETA') +#toupper->uppercase +#toupper + +local(tolower = 'alphaBETA') +#tolower->lowercase +#tolower diff --git a/Task/String-case/Lingo/string-case-1.lingo b/Task/String-case/Lingo/string-case-1.lingo new file mode 100644 index 0000000000..2a3572353d --- /dev/null +++ b/Task/String-case/Lingo/string-case-1.lingo @@ -0,0 +1,29 @@ +---------------------------------------- +-- Lower to upper case (ASCII only) +-- @param {string} str +-- @return {string} +---------------------------------------- +on toUpper (str) + alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + len = str.length + repeat with i = 1 to len + pos = offset(str.char[i], alphabet) + if pos > 0 then put alphabet.char[pos] into char i of str + end repeat + return str +end + +---------------------------------------- +-- Upper to lower case (ASCII only) +-- @param {string} str +-- @return {string} +---------------------------------------- +on toLower (str) + alphabet = "abcdefghijklmnopqrstuvwxyz" + len = str.length + repeat with i = 1 to len + pos = offset(str.char[i], alphabet) + if pos > 0 then put alphabet.char[pos] into char i of str + end repeat + return str +end diff --git a/Task/String-case/Lingo/string-case-2.lingo b/Task/String-case/Lingo/string-case-2.lingo new file mode 100644 index 0000000000..5ca67ed6ff --- /dev/null +++ b/Task/String-case/Lingo/string-case-2.lingo @@ -0,0 +1,5 @@ +put toUpper("alphaBETA") +-- "ALPHABETA" + +put toLower("alphaBETA") +-- "alphabeta" diff --git a/Task/String-case/LiveCode/string-case.livecode b/Task/String-case/LiveCode/string-case.livecode new file mode 100644 index 0000000000..524442be74 --- /dev/null +++ b/Task/String-case/LiveCode/string-case.livecode @@ -0,0 +1,2 @@ +put upper("alphaBETA") && lower("alphaBETA") +ALPHABETA alphabeta diff --git a/Task/String-case/Nim/string-case.nim b/Task/String-case/Nim/string-case.nim new file mode 100644 index 0000000000..b0344519aa --- /dev/null +++ b/Task/String-case/Nim/string-case.nim @@ -0,0 +1,7 @@ +import strutils + +var s: string = "alphaBETA_123" +echo s," as upper case: ", toUpper(s) +echo s," as lower case: ", toLower(s) +echo s," as Capitalized: ", capitalize(s) +echo s," as normal case: ", normalize(s) # remove underscores, toLower diff --git a/Task/String-case/Oforth/string-case.oforth b/Task/String-case/Oforth/string-case.oforth new file mode 100644 index 0000000000..0de3af121d --- /dev/null +++ b/Task/String-case/Oforth/string-case.oforth @@ -0,0 +1,2 @@ +"alphaBETA" toUpper +"alphaBETA" toLower diff --git a/Task/String-case/Peloton/string-case-1.peloton b/Task/String-case/Peloton/string-case-1.peloton new file mode 100644 index 0000000000..0acddb029d --- /dev/null +++ b/Task/String-case/Peloton/string-case-1.peloton @@ -0,0 +1,5 @@ +<@ ENU$$$LSTPSTLITLIT>UPP| +[<@ SAYELTLST>...] <@ SAYHLPELTLST>...<@ DEFKEYELTLST>__SuperMacro|... +<@ SAY&&&LIT>alphaBETA + + diff --git a/Task/String-case/Peloton/string-case-2.peloton b/Task/String-case/Peloton/string-case-2.peloton new file mode 100644 index 0000000000..6f326a75d5 --- /dev/null +++ b/Task/String-case/Peloton/string-case-2.peloton @@ -0,0 +1,5 @@ +<# ENUMERATION LAMBDA LIST PEERSET LITERAL LITERAL>UPP| +[<# SAY ELEMENT LIST>...] <# SAY HELP ELEMENT LIST>...<# DEFINE KEYWORD ELEMENT LIST>__SuperMacro|... +<# SAY SUPERMACRO LITERAL>alphaBETA + + diff --git a/Task/String-case/Phix/string-case.phix b/Task/String-case/Phix/string-case.phix new file mode 100644 index 0000000000..998667423d --- /dev/null +++ b/Task/String-case/Phix/string-case.phix @@ -0,0 +1,3 @@ +constant s = "alphaBETA" +?upper(s) +?lower(s) diff --git a/Task/String-case/Potion/string-case.potion b/Task/String-case/Potion/string-case.potion new file mode 100644 index 0000000000..c9b6282b17 --- /dev/null +++ b/Task/String-case/Potion/string-case.potion @@ -0,0 +1,25 @@ +lowercase = (str) : + low = ("") + str length times (i) : + low append(if (65 <= str(i) ord and str(i) ord <= 90) : + "abcdefghijklmnopqrstuvwxyz"(str(i) ord - 65) + . else : + str(i) + .) + . + low join("") +. +uppercase = (str) : + upp = ("") + str length times (i) : + upp append(if (97 <= str(i) ord and str(i) ord <= 122) : + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"(str(i) ord - 97) + . else : + str(i) + .) + . + upp join("") +. + +lowercase("alphaBETA") print +uppercase("alphaBETA") print diff --git a/Task/String-case/Powerbuilder/string-case.powerbuilder b/Task/String-case/Powerbuilder/string-case.powerbuilder new file mode 100644 index 0000000000..8a63cec46b --- /dev/null +++ b/Task/String-case/Powerbuilder/string-case.powerbuilder @@ -0,0 +1,4 @@ +string ls_string +ls_string = 'alphaBETA' +ls_string = Upper(ls_string) +ls_string = Lower(ls_string) diff --git a/Task/String-case/Ring/string-case.ring b/Task/String-case/Ring/string-case.ring new file mode 100644 index 0000000000..835de5ad59 --- /dev/null +++ b/Task/String-case/Ring/string-case.ring @@ -0,0 +1,3 @@ +aString = "WELCOME TO THE ring programming language" +see lower(aString) + nl +see upper(aString) + nl diff --git a/Task/String-case/Sidef/string-case.sidef b/Task/String-case/Sidef/string-case.sidef new file mode 100644 index 0000000000..0984231ab5 --- /dev/null +++ b/Task/String-case/Sidef/string-case.sidef @@ -0,0 +1,6 @@ +say "alphaBETA".lc; #=> alphabeta +say "alphaBETA".uc; #=> ALPHABETA +say "alphaBETA".tc; #=> AlphaBETA +say "alpha BETA".wc; #=> Alpha Beta +say "alpha BETA".tc; #=> Alpha BETA +say "alpha BETA".tclc; #=> Alpha beta diff --git a/Task/String-case/Swift/string-case.swift b/Task/String-case/Swift/string-case.swift new file mode 100644 index 0000000000..9201814c2c --- /dev/null +++ b/Task/String-case/Swift/string-case.swift @@ -0,0 +1,5 @@ +import Foundation + +println("alphaBETA".uppercaseString) +println("alphaBETA".lowercaseString) +println("foO BAr".capitalizedString) diff --git a/Task/String-case/Ursa/string-case.ursa b/Task/String-case/Ursa/string-case.ursa new file mode 100644 index 0000000000..268c22c8f3 --- /dev/null +++ b/Task/String-case/Ursa/string-case.ursa @@ -0,0 +1,2 @@ +out (lower "alphaBETA") endl console +out (upper "alphaBETA") endl console diff --git a/Task/String-case/jq/string-case-1.jq b/Task/String-case/jq/string-case-1.jq new file mode 100644 index 0000000000..f848be0c25 --- /dev/null +++ b/Task/String-case/jq/string-case-1.jq @@ -0,0 +1,7 @@ +# like ruby's downcase - only characters A to Z are affected +def ascii_downcase: + explode | map( if 65 <= . and . <= 90 then . + 32 else . end) | implode; + +# like ruby's upcase - only characters a to z are affected +def ascii_upcase: + explode | map( if 97 <= . and . <= 122 then . - 32 else . end) | implode; diff --git a/Task/String-case/jq/string-case-2.jq b/Task/String-case/jq/string-case-2.jq new file mode 100644 index 0000000000..d1c69cbae1 --- /dev/null +++ b/Task/String-case/jq/string-case-2.jq @@ -0,0 +1,5 @@ +"alphaBETA" | ascii_upcase +#=> "ALPHABETA" + +"alphaBETA" | ascii_downcase +#=> "alphabeta" diff --git a/Task/String-comparison/Apex/string-comparison.apex b/Task/String-comparison/Apex/string-comparison.apex new file mode 100644 index 0000000000..879ed4fe90 --- /dev/null +++ b/Task/String-comparison/Apex/string-comparison.apex @@ -0,0 +1,35 @@ +public class Compare +{ + /** + * Test in the developer console: + * Compare.compare('Hello', 'Hello'); + * Compare.compare('5', '5.0'); + * Compare.compare('java', 'Java'); + * Compare.compare('ĴÃVÁ', 'ĴÃVÁ'); + */ + + public static void compare (String A, String B) + { + if (A.equals(B)) + System.debug(A + ' and ' + B + ' are lexically equal.'); + else + System.debug(A + ' and ' + B + ' are not lexically equal.'); + + if (A.equalsIgnoreCase(B)) + System.debug(A + ' and ' + B + ' are case-insensitive lexically equal.'); + else + System.debug(A + ' and ' + B + ' are not case-insensitive lexically equal.'); + + if (A.compareTo(B) < 0) + System.debug(A + ' is lexically before ' + B); + else if (A.compareTo(B) > 0) + System.debug(A + ' is lexically after ' + B); + + if (A.compareTo(B) >= 0) + System.debug(A + ' is not lexically before ' + B); + if (A.compareTo(B) <= 0) + System.debug(A + ' is not lexically after ' + B); + + System.debug('The lexical relationship is: ' + A.compareTo(B)); + } +} diff --git a/Task/String-comparison/FreeBASIC/string-comparison.freebasic b/Task/String-comparison/FreeBASIC/string-comparison.freebasic new file mode 100644 index 0000000000..e6c9a1f1fb --- /dev/null +++ b/Task/String-comparison/FreeBASIC/string-comparison.freebasic @@ -0,0 +1,40 @@ +' FB 1.05.0 + +' Strings in FB natively support the relational operators which compare lexically on a case-sensitive basis. +' There are no special provisions for numerical strings. +' There are no other types of string comparison for the built-in types though 'user defined types' +' can specify their own comparisons by over-loading the relational operators. + +Function StringCompare(s1 As Const String, s2 As Const String, ignoreCase As Boolean = false) As String + Dim As String s, t ' need new string variables as the strings passed in can't be changed + If ignoreCase Then + s = LCase(s1) + t = LCase(s2) + Else + s = s1 + t = s2 + End If + If s < t Then Return " comes before " + If s = t Then Return " is equal to " + Return " comes after " +End Function + +Dim As Integer result +Dim As String s1, s2, s3 +s1 = "Dog" : s2 = "Dog" +Print s1; StringCompare(s1, s2); s2 +s2 = "Cat" +Print s1; StringCompare(s1, s2); s2 +s2 = "Rat" +Print s1; StringCompare(s1, s2); s2 +s2 = "dog" +Print s1; StringCompare(s1, s2); s2 +Print s1; StringCompare(s1, s2, True); s2; " if case is ignored" +s1 = "Dog" : s2 = "Pig" +s3 = StringCompare(s1, s2) +If s3 <> " is equal to " Then + Print s1; " is not equal to "; s2 +End If +Print +Print "Press any key to quit" +Sleep diff --git a/Task/String-comparison/Harbour/string-comparison-1.harbour b/Task/String-comparison/Harbour/string-comparison-1.harbour new file mode 100644 index 0000000000..eba57a366f --- /dev/null +++ b/Task/String-comparison/Harbour/string-comparison-1.harbour @@ -0,0 +1,12 @@ +IF s1 == s2 + ? "The strings are equal" +ENDIF +IF !( s1 == s2 ) + ? "The strings are not equal" +ENDIF +IF s1 > s2 + ? "s2 is lexically ordered before than s1" +ENDIF +IF s1 < s2 + ? "s2 is lexically ordered after than s1" +ENDIF diff --git a/Task/String-comparison/Harbour/string-comparison-2.harbour b/Task/String-comparison/Harbour/string-comparison-2.harbour new file mode 100644 index 0000000000..79bc238f81 --- /dev/null +++ b/Task/String-comparison/Harbour/string-comparison-2.harbour @@ -0,0 +1,3 @@ +IF Upper( s1 ) == Upper( s2 ) + ? "The strings are equal" +ENDIF diff --git a/Task/String-comparison/Lasso/string-comparison.lasso b/Task/String-comparison/Lasso/string-comparison.lasso new file mode 100644 index 0000000000..c003458324 --- /dev/null +++ b/Task/String-comparison/Lasso/string-comparison.lasso @@ -0,0 +1,35 @@ +// Comparing two strings for exact equality +"'this' == 'this': " + ('this' == 'this') // true +"'this' == 'This': " + ('this' == 'This') // true, as it's case insensitive + +// Comparing two strings for inequality (i.e., the inverse of exact equality) +"'this' != 'this': " + ('this' != 'this')// false +"'this' != 'that': " + ('this' != 'that') // true + +// Comparing two strings to see if one is lexically ordered before than the other +"'alpha' < 'beta': " + ('alpha' < 'beta') // true +"'beta' < 'alpha': " + ('beta' < 'alpha') // false + +// Comparing two strings to see if one is lexically ordered after than the other +"'alpha' > 'beta': " + ('alpha' > 'beta') // false +"'beta' > 'alpha': " + ('beta' > 'alpha') // true + +// How to achieve both case sensitive comparisons and case insensitive comparisons within the language +"case sensitive - 'this'->equals('This',-case=true): " + ('this'->equals('This',-case=true)) // false +"case insensitive - 'this'->equals('This',-case=true): " + ('this'->equals('This')) // true + +// How the language handles comparison of numeric strings if these are not treated lexically +"'01234' == '01234': "+ ('01234' == '01234') // true +"'01234' == '0123': " + ('01234' == '0123') // false +"'01234' > '0123': " + ('01234' > '0123') // true +"'01234' < '0123': " + ('01234' < '0123') //false + +// Additional string comparisons +"'The quick brown fox jumps over the rhino' >> 'fox' (contains): " + + ('The quick brown fox jumps over the rhino' >> 'fox') // true +"'The quick brown fox jumps over the rhino' >> 'cat' (contains): " + + ('The quick brown fox jumps over the rhino' >> 'cat') // false +"'The quick brown fox jumps over the rhino'->beginswith('rhino'): " + + ('The quick brown fox jumps over the rhino'->beginswith('rhino')) // false +"'The quick brown fox jumps over the rhino'->endswith('rhino'): " + + ('The quick brown fox jumps over the rhino'->endswith('rhino')) // true diff --git a/Task/String-comparison/Lingo/string-comparison-1.lingo b/Task/String-comparison/Lingo/string-comparison-1.lingo new file mode 100644 index 0000000000..e2af531d18 --- /dev/null +++ b/Task/String-comparison/Lingo/string-comparison-1.lingo @@ -0,0 +1,11 @@ +put "abc"="ABC" +-- 1 + +put "abc"<>"def" +-- 1 + +put "abc"<"def" +-- 1 + +put "abc">"def" +-- 0 diff --git a/Task/String-comparison/Lingo/string-comparison-2.lingo b/Task/String-comparison/Lingo/string-comparison-2.lingo new file mode 100644 index 0000000000..fed1cc93d4 --- /dev/null +++ b/Task/String-comparison/Lingo/string-comparison-2.lingo @@ -0,0 +1,10 @@ +-- Returns -1 if str1 is less than str2 +-- Returns 1 if str1 is greater than str2 +-- Returns 0 if str1 and str2 are equal +on strcmp (str1, str2) + h1 = bytearray(str1).toHexString(1, str1.length) + h2 = bytearray(str2).toHexString(1, str2.length) + if h1

h2 then return 1 + return 0 +end diff --git a/Task/String-comparison/Nim/string-comparison.nim b/Task/String-comparison/Nim/string-comparison.nim new file mode 100644 index 0000000000..2ed2dcb4b7 --- /dev/null +++ b/Task/String-comparison/Nim/string-comparison.nim @@ -0,0 +1,10 @@ +import strutils + +var s1: string = "The quick brown" +var s2: string = "The Quick Brown" +echo("== : ", s1 == s2) +echo("!= : ", s1 != s2) +echo("< : ", s1 < s2) +echo("<= : ", s1 <= s2) +echo("> : ", s1 > s2) +echo(">= : ", s1 >= s2) diff --git a/Task/String-comparison/Oforth/string-comparison.oforth b/Task/String-comparison/Oforth/string-comparison.oforth new file mode 100644 index 0000000000..73664224b9 --- /dev/null +++ b/Task/String-comparison/Oforth/string-comparison.oforth @@ -0,0 +1,5 @@ +"abcd" "abcd" == +"abcd" "abce" <> +"abcd" "abceed" <= +"abce" "abcd" > +"abcEEE" toUpper "ABCeee" toUpper == diff --git a/Task/String-comparison/Phix/string-comparison.phix b/Task/String-comparison/Phix/string-comparison.phix new file mode 100644 index 0000000000..c4d86fd6ac --- /dev/null +++ b/Task/String-comparison/Phix/string-comparison.phix @@ -0,0 +1,6 @@ +if name=="pete" then ?"The strings are equal" end if +if name!="pete" then ?"The strings are not equal" end if +if name<"pete" then ?"name is lexically first" end if +if name>"pete" then ?"name is lexically last" end if +if upper(name)=upper("pete") then ?"case insensitive match" end if +if match("pete",lower(name)) then ?"petes in there somewhere" end if diff --git a/Task/String-comparison/Ring/string-comparison.ring b/Task/String-comparison/Ring/string-comparison.ring new file mode 100644 index 0000000000..b824ec5cf5 --- /dev/null +++ b/Task/String-comparison/Ring/string-comparison.ring @@ -0,0 +1,18 @@ + if s1 = s2 + See "The strings are equal" + ok + if not (s1 = s2) + See "The strings are not equal" + ok + if strcmp(s1,s2) > 0 + see "s2 is lexically ordered before than s1" + ok + if strcmp(s1,s2) < 0 + see "s2 is lexically ordered after than s1" + ok + +To achieve case insensitive comparisons, we should use Upper() or Lower() functions: + + if Upper(s1) = Upper(s2) + see "The strings are equal" + ok diff --git a/Task/String-comparison/Sidef/string-comparison.sidef b/Task/String-comparison/Sidef/string-comparison.sidef new file mode 100644 index 0000000000..e3534556bc --- /dev/null +++ b/Task/String-comparison/Sidef/string-comparison.sidef @@ -0,0 +1,5 @@ +var methods = %w(== != > >= < <= <=>) +for s1, s2 in [,,,] { + methods.each{|m| "%s %s %s\t%s\n".printf(s1, m, s2, s1.(m)(s2))} + print "\n" +} diff --git a/Task/String-comparison/Swift/string-comparison.swift b/Task/String-comparison/Swift/string-comparison.swift new file mode 100644 index 0000000000..5359cc06e4 --- /dev/null +++ b/Task/String-comparison/Swift/string-comparison.swift @@ -0,0 +1,23 @@ +func compare (a: String, b: String) { + if a == b { + println("'\(a)' and '\(b)' are lexically equal.") + } + if a != b { + println("'\(a)' and '\(b)' are not lexically equal.") + } + + if a < b { + println("'\(a)' is lexically before '\(b)'.") + } + if a > b { + println("'\(a)' is lexically after '\(b)'.") + } + + if a >= b { + println("'\(a)' is not lexically before '\(b)'.") + } + if a <= b { + println("'\(a)' is not lexically after '\(b)'.") + } +} +compare("cat", "dog") diff --git a/Task/String-comparison/jq/string-comparison-1.jq b/Task/String-comparison/jq/string-comparison-1.jq new file mode 100644 index 0000000000..375d901c9b --- /dev/null +++ b/Task/String-comparison/jq/string-comparison-1.jq @@ -0,0 +1,11 @@ +# Comparing two strings for exact equality: +"this" == "this" # true +"this" == "This" # false + +# != is the inverse of == + +# Comparing two strings to see if one is lexically ordered before the other: +"alpha" < "beta" # true +"beta" < "alpha" # false + +# > is the inverse of < diff --git a/Task/String-comparison/jq/string-comparison-2.jq b/Task/String-comparison/jq/string-comparison-2.jq new file mode 100644 index 0000000000..c72dfaaf7d --- /dev/null +++ b/Task/String-comparison/jq/string-comparison-2.jq @@ -0,0 +1,7 @@ +# Only characters A to Z are affected +def downcase: + explode | map( if 65 <= . and . <= 90 then . + 32 else . end) | implode; + +# Only characters a to z are affected +def upcase: + explode | map( if 97 <= . and . <= 122 then . - 32 else . end) | implode; diff --git a/Task/String-comparison/jq/string-comparison-3.jq b/Task/String-comparison/jq/string-comparison-3.jq new file mode 100644 index 0000000000..e4d8dbfae3 --- /dev/null +++ b/Task/String-comparison/jq/string-comparison-3.jq @@ -0,0 +1 @@ +("AtoZ" | upcase) == ("atoz" | upcase) # true diff --git a/Task/String-concatenation/Apex/string-concatenation.apex b/Task/String-concatenation/Apex/string-concatenation.apex new file mode 100644 index 0000000000..05a0b8b9cb --- /dev/null +++ b/Task/String-concatenation/Apex/string-concatenation.apex @@ -0,0 +1,7 @@ +String s1 = 'Hello '; +String s2 = 'Salesforce Developer!'; + +String s3 = s1+s2; + +// Print output +System.debug(s3); diff --git a/Task/String-concatenation/Axe/string-concatenation.axe b/Task/String-concatenation/Axe/string-concatenation.axe new file mode 100644 index 0000000000..8acb1ffe90 --- /dev/null +++ b/Task/String-concatenation/Axe/string-concatenation.axe @@ -0,0 +1,5 @@ +Lbl CONCAT +Copy(r₁,L₁,length(r₁)) +Copy(r₂,L₁+length(r₁),length(r₂)+1) +L₁ +Return diff --git a/Task/String-concatenation/ChucK/string-concatenation.chuck b/Task/String-concatenation/ChucK/string-concatenation.chuck new file mode 100644 index 0000000000..fa84846d08 --- /dev/null +++ b/Task/String-concatenation/ChucK/string-concatenation.chuck @@ -0,0 +1,3 @@ +"Hello" => string A; +A + " World!" => string B; +<<< B >>>; diff --git a/Task/String-concatenation/ERRE/string-concatenation.erre b/Task/String-concatenation/ERRE/string-concatenation.erre new file mode 100644 index 0000000000..048f605a08 --- /dev/null +++ b/Task/String-concatenation/ERRE/string-concatenation.erre @@ -0,0 +1,6 @@ + .......... + S$="HELLO" + PRINT(S$;" LITERAL") ! or S$+" LITERAL" + S2$=S$+" LITERAL" + PRINT(S2$) + .......... diff --git a/Task/String-concatenation/FreeBASIC/string-concatenation.freebasic b/Task/String-concatenation/FreeBASIC/string-concatenation.freebasic new file mode 100644 index 0000000000..fc0b55cd2a --- /dev/null +++ b/Task/String-concatenation/FreeBASIC/string-concatenation.freebasic @@ -0,0 +1,7 @@ +' FB 1.05.0 Win64 + +Var s1 = "String" +Var s2 = s1 + " concatenation" +Print s1 +Print s2 +Sleep diff --git a/Task/String-concatenation/Lasso/string-concatenation.lasso b/Task/String-concatenation/Lasso/string-concatenation.lasso new file mode 100644 index 0000000000..a7765aae5a --- /dev/null +++ b/Task/String-concatenation/Lasso/string-concatenation.lasso @@ -0,0 +1,4 @@ +local(x = 'Hello') +local(y = #x + ', World!') +#x // Hello +#y // Hello, World! diff --git a/Task/String-concatenation/Lingo/string-concatenation.lingo b/Task/String-concatenation/Lingo/string-concatenation.lingo new file mode 100644 index 0000000000..306c0edb8f --- /dev/null +++ b/Task/String-concatenation/Lingo/string-concatenation.lingo @@ -0,0 +1,4 @@ +a = "Hello" +b = a & " world!" +put b +-- "Hello world!" diff --git a/Task/String-concatenation/LiveCode/string-concatenation.livecode b/Task/String-concatenation/LiveCode/string-concatenation.livecode new file mode 100644 index 0000000000..6bf565e4cb --- /dev/null +++ b/Task/String-concatenation/LiveCode/string-concatenation.livecode @@ -0,0 +1,3 @@ +local str="live" +put str & "code" into str2 +put str && str2 diff --git a/Task/String-concatenation/Nim/string-concatenation-1.nim b/Task/String-concatenation/Nim/string-concatenation-1.nim new file mode 100644 index 0000000000..dc76b28a5f --- /dev/null +++ b/Task/String-concatenation/Nim/string-concatenation-1.nim @@ -0,0 +1,6 @@ +var str, str1 = "String" +echo(str & " literal.") +str1 = str1 & " literal." +echo(str1) + +# -> String literal. diff --git a/Task/String-concatenation/Nim/string-concatenation-2.nim b/Task/String-concatenation/Nim/string-concatenation-2.nim new file mode 100644 index 0000000000..713fd2eb69 --- /dev/null +++ b/Task/String-concatenation/Nim/string-concatenation-2.nim @@ -0,0 +1,4 @@ +var str1 = "String" +echo(join([str1, " literal.", "HelloWorld!"], "~~")) + +# -> String~~ literal.~~HelloWorld! diff --git a/Task/String-concatenation/Nim/string-concatenation-3.nim b/Task/String-concatenation/Nim/string-concatenation-3.nim new file mode 100644 index 0000000000..d051a2c150 --- /dev/null +++ b/Task/String-concatenation/Nim/string-concatenation-3.nim @@ -0,0 +1,4 @@ +var str1 = "String" +echo "$# $# $#" % [str1, "literal.", "HelloWorld!"] + +# -> String literal. HelloWorld! diff --git a/Task/String-concatenation/Oforth/string-concatenation.oforth b/Task/String-concatenation/Oforth/string-concatenation.oforth new file mode 100644 index 0000000000..85adb9a0d7 --- /dev/null +++ b/Task/String-concatenation/Oforth/string-concatenation.oforth @@ -0,0 +1 @@ +"Hello" dup " World!" + .s diff --git a/Task/String-concatenation/PHL/string-concatenation.phl b/Task/String-concatenation/PHL/string-concatenation.phl new file mode 100644 index 0000000000..b6840111e4 --- /dev/null +++ b/Task/String-concatenation/PHL/string-concatenation.phl @@ -0,0 +1,11 @@ +module stringcat; + +extern printf; + +@Integer main [ + var a = "hello"; + var b = a + " literal"; + printf("%s\n", b); + + return 0; +] diff --git a/Task/String-concatenation/Phix/string-concatenation.phix b/Task/String-concatenation/Phix/string-concatenation.phix new file mode 100644 index 0000000000..5436bd5f12 --- /dev/null +++ b/Task/String-concatenation/Phix/string-concatenation.phix @@ -0,0 +1,5 @@ +string s1 = "at" ?s1 +string s2 = "c"&s1 ?s2 +string s3 = "s"&s1 ?s3 +string s4 = "m"&s1 ?s4 +string s5 = "The "&s2&" "&s3&" on the "&s4&"." ?s5 diff --git a/Task/String-concatenation/Ring/string-concatenation.ring b/Task/String-concatenation/Ring/string-concatenation.ring new file mode 100644 index 0000000000..18885dcef8 --- /dev/null +++ b/Task/String-concatenation/Ring/string-concatenation.ring @@ -0,0 +1,4 @@ +aString = "Welcome to the " +bString = "Ring Programming Language" + +see astring + bString + nl diff --git a/Task/String-concatenation/Sidef/string-concatenation-1.sidef b/Task/String-concatenation/Sidef/string-concatenation-1.sidef new file mode 100644 index 0000000000..e0d5527c9a --- /dev/null +++ b/Task/String-concatenation/Sidef/string-concatenation-1.sidef @@ -0,0 +1,4 @@ +var s = 'hello'; +say s+' literal'; +var s1 = s+' literal'; +say s1; diff --git a/Task/String-concatenation/Sidef/string-concatenation-2.sidef b/Task/String-concatenation/Sidef/string-concatenation-2.sidef new file mode 100644 index 0000000000..ecd0c5eac6 --- /dev/null +++ b/Task/String-concatenation/Sidef/string-concatenation-2.sidef @@ -0,0 +1,2 @@ +s += ' literal'; +say s; diff --git a/Task/String-concatenation/Sparkling/string-concatenation.sparkling b/Task/String-concatenation/Sparkling/string-concatenation.sparkling new file mode 100644 index 0000000000..bebba277c3 --- /dev/null +++ b/Task/String-concatenation/Sparkling/string-concatenation.sparkling @@ -0,0 +1,3 @@ +let s1 = "Hello"; +let s2 = " world!"; +print(s1 .. s2); // prints "Hello world!" diff --git a/Task/String-concatenation/Swift/string-concatenation.swift b/Task/String-concatenation/Swift/string-concatenation.swift new file mode 100644 index 0000000000..fd9c3aaf38 --- /dev/null +++ b/Task/String-concatenation/Swift/string-concatenation.swift @@ -0,0 +1,4 @@ +let s = "hello" +println(s + " literal") +let s1 = s + " literal" +println(s1) diff --git a/Task/String-concatenation/Ursa/string-concatenation.ursa b/Task/String-concatenation/Ursa/string-concatenation.ursa new file mode 100644 index 0000000000..7dc68ba11a --- /dev/null +++ b/Task/String-concatenation/Ursa/string-concatenation.ursa @@ -0,0 +1,9 @@ +decl string s1 s2 +# make s1 contain "hello " +set s1 "hello " + +# set s2 to contain s1 and "world" +set s2 (+ s1 "world") + +# outputs "hello world" +out s2 endl console diff --git a/Task/String-concatenation/jq/string-concatenation.jq b/Task/String-concatenation/jq/string-concatenation.jq new file mode 100644 index 0000000000..349a384b11 --- /dev/null +++ b/Task/String-concatenation/jq/string-concatenation.jq @@ -0,0 +1 @@ +"hello" as $s | $s + " there!" diff --git a/Task/String-interpolation--included-/Coco/string-interpolation--included-.coco b/Task/String-interpolation--included-/Coco/string-interpolation--included-.coco new file mode 100644 index 0000000000..f2b9fd4fd8 --- /dev/null +++ b/Task/String-interpolation--included-/Coco/string-interpolation--included-.coco @@ -0,0 +1,2 @@ +size = 'little' +console.log "Mary had a #size lamb." diff --git a/Task/String-interpolation--included-/ECL/string-interpolation--included-.ecl b/Task/String-interpolation--included-/ECL/string-interpolation--included-.ecl new file mode 100644 index 0000000000..ed94eaba31 --- /dev/null +++ b/Task/String-interpolation--included-/ECL/string-interpolation--included-.ecl @@ -0,0 +1,2 @@ +IMPORT STD; +STD.Str.FindReplace('Mary had a X Lamb', 'X','little'); diff --git a/Task/String-interpolation--included-/EchoLisp/string-interpolation--included-.echolisp b/Task/String-interpolation--included-/EchoLisp/string-interpolation--included-.echolisp new file mode 100644 index 0000000000..0ed82e1658 --- /dev/null +++ b/Task/String-interpolation--included-/EchoLisp/string-interpolation--included-.echolisp @@ -0,0 +1,5 @@ +;; format uses %a or ~a as replacement directive +(format "Mary had a ~a lamb" "little") + → "Mary had a little lamb" +(format "Mary had a %a lamb" "little") + → "Mary had a little lamb" diff --git a/Task/String-interpolation--included-/FreeBASIC/string-interpolation--included-.freebasic b/Task/String-interpolation--included-/FreeBASIC/string-interpolation--included-.freebasic new file mode 100644 index 0000000000..ddf94202cf --- /dev/null +++ b/Task/String-interpolation--included-/FreeBASIC/string-interpolation--included-.freebasic @@ -0,0 +1,9 @@ +' FB 1.05.0 Win64 + +#Include "crt/stdio.bi" '' header needed for printf + +Dim x As String = "big" +Print "Mary had a "; x; " lamb" '' FB's native Print statement +x = "little" +printf("Mary also had a %s lamb", x) +Sleep diff --git a/Task/String-interpolation--included-/FunL/string-interpolation--included-.funl b/Task/String-interpolation--included-/FunL/string-interpolation--included-.funl new file mode 100644 index 0000000000..290e115608 --- /dev/null +++ b/Task/String-interpolation--included-/FunL/string-interpolation--included-.funl @@ -0,0 +1,2 @@ +X = 'little' +println( "Mary had a $X lamb." ) diff --git a/Task/String-interpolation--included-/Lasso/string-interpolation--included-.lasso b/Task/String-interpolation--included-/Lasso/string-interpolation--included-.lasso new file mode 100644 index 0000000000..fc9b135412 --- /dev/null +++ b/Task/String-interpolation--included-/Lasso/string-interpolation--included-.lasso @@ -0,0 +1 @@ +email_merge("Mary had a #adjective# lamb", map("token"="little", "adjective"=""), null, 'plain') diff --git a/Task/String-interpolation--included-/LiveCode/string-interpolation--included-.livecode b/Task/String-interpolation--included-/LiveCode/string-interpolation--included-.livecode new file mode 100644 index 0000000000..01baff0a11 --- /dev/null +++ b/Task/String-interpolation--included-/LiveCode/string-interpolation--included-.livecode @@ -0,0 +1,4 @@ +local str="little" +put merge("Mary had a [[str]] lamb.") + +-- Mary had a little lamb. diff --git a/Task/String-interpolation--included-/Nim/string-interpolation--included-.nim b/Task/String-interpolation--included-/Nim/string-interpolation--included-.nim new file mode 100644 index 0000000000..dcfbe59f1a --- /dev/null +++ b/Task/String-interpolation--included-/Nim/string-interpolation--included-.nim @@ -0,0 +1,5 @@ +import strutils + +var str = "little" +echo "Mary had a $# lamb" % [str] +# doesn't need an array for one substitution, but use an array for multiple substitutions diff --git a/Task/String-interpolation--included-/Phix/string-interpolation--included-.phix b/Task/String-interpolation--included-/Phix/string-interpolation--included-.phix new file mode 100644 index 0000000000..e72b0542e4 --- /dev/null +++ b/Task/String-interpolation--included-/Phix/string-interpolation--included-.phix @@ -0,0 +1,3 @@ +string size = "little" +string s = sprintf("Mary had a %s lamb.",{size}) +?s diff --git a/Task/String-interpolation--included-/Ring/string-interpolation--included-.ring b/Task/String-interpolation--included-/Ring/string-interpolation--included-.ring new file mode 100644 index 0000000000..21eb688038 --- /dev/null +++ b/Task/String-interpolation--included-/Ring/string-interpolation--included-.ring @@ -0,0 +1,2 @@ +aString =substr("Mary had a X lamb.", "X", "little") +see aString + nl diff --git a/Task/String-interpolation--included-/Sidef/string-interpolation--included--1.sidef b/Task/String-interpolation--included-/Sidef/string-interpolation--included--1.sidef new file mode 100644 index 0000000000..8c00ad92ab --- /dev/null +++ b/Task/String-interpolation--included-/Sidef/string-interpolation--included--1.sidef @@ -0,0 +1,2 @@ +var extra = 'little'; +say "Mary had a #{extra} lamb"; diff --git a/Task/String-interpolation--included-/Sidef/string-interpolation--included--2.sidef b/Task/String-interpolation--included-/Sidef/string-interpolation--included--2.sidef new file mode 100644 index 0000000000..76aecabe7a --- /dev/null +++ b/Task/String-interpolation--included-/Sidef/string-interpolation--included--2.sidef @@ -0,0 +1 @@ +say ("Mary had a %s lamb" % 'little'); diff --git a/Task/String-interpolation--included-/Swift/string-interpolation--included-.swift b/Task/String-interpolation--included-/Swift/string-interpolation--included-.swift new file mode 100644 index 0000000000..be41d543a3 --- /dev/null +++ b/Task/String-interpolation--included-/Swift/string-interpolation--included-.swift @@ -0,0 +1,2 @@ +let extra = "little" +println("Mary had a \(extra) lamb.") diff --git a/Task/String-interpolation--included-/jq/string-interpolation--included--1.jq b/Task/String-interpolation--included-/jq/string-interpolation--included--1.jq new file mode 100644 index 0000000000..7f1e2bfaca --- /dev/null +++ b/Task/String-interpolation--included-/jq/string-interpolation--included--1.jq @@ -0,0 +1,2 @@ +"little" as $x + | "Mary had a \($x) lamb" diff --git a/Task/String-interpolation--included-/jq/string-interpolation--included--2.jq b/Task/String-interpolation--included-/jq/string-interpolation--included--2.jq new file mode 100644 index 0000000000..f54ba2d651 --- /dev/null +++ b/Task/String-interpolation--included-/jq/string-interpolation--included--2.jq @@ -0,0 +1,2 @@ +$ jq -M -n -r '"Jürgen" as $x | "The string \"\($x)\" has \($x|length) codepoints."' +The string "Jürgen" has 6 codepoints. diff --git a/Task/String-length/Apex/string-length.apex b/Task/String-length/Apex/string-length.apex new file mode 100644 index 0000000000..ea6b54ebdb --- /dev/null +++ b/Task/String-length/Apex/string-length.apex @@ -0,0 +1,2 @@ +String myString = 'abcd'; +System.debug('Size of String', myString.length()); diff --git a/Task/String-length/Axe/string-length.axe b/Task/String-length/Axe/string-length.axe new file mode 100644 index 0000000000..45924e316c --- /dev/null +++ b/Task/String-length/Axe/string-length.axe @@ -0,0 +1,2 @@ +"HELLO, WORLD"→Str1 +Disp length(Str1)▶Dec,i diff --git a/Task/String-length/FreeBASIC/string-length.freebasic b/Task/String-length/FreeBASIC/string-length.freebasic new file mode 100644 index 0000000000..e92e477374 --- /dev/null +++ b/Task/String-length/FreeBASIC/string-length.freebasic @@ -0,0 +1,23 @@ +' FB 1.05.0 Win64 + +Dim s As String = "moose" '' variable length ascii string +Dim f As String * 5 = "moose" '' fixed length ascii string (in practice a zero byte is appended) +Dim z As ZString * 6 = "moose" '' fixed length zero terminated ascii string +Dim w As WString * 6 = "møøse" '' fixed length zero terminated unicode string + +' Variable length strings have a descriptor consisting of 3 Integers (12 bytes on 32 bit, 24 bytes on 64 bit systems) +' In order, the descriptor contains the address of the data, the memory currently used and the memory allocated + +' In Windows, WString uses UCS-2 encoding (i.e. 2 bytes per character, surrogates are not supported) +' In Linux, WString uses UCS-4 encoding (i.e. 4 bytes per character) + +' The Len function always returns the length of the string in characters +' The SizeOf function returns the bytes used (by the descriptor in the case of variable length strings) + +Print "s : " ; s, "Character Length : "; Len(s), "Byte Length : "; Len(s); " (data)" +Print "s : " ; s, "Character Length : "; Len(s), "Byte Length : "; SizeOf(s); " (descriptor)" +Print "f : " ; f, "Character Length : "; Len(s), "Byte Length : "; SizeOf(f) +Print "z : " ; z, "Character Length : "; Len(s), "Byte Length : "; SizeOf(z) +Print "w : " ; w, "Character Length : "; Len(s), "Byte Length : "; SizeOf(w) +Print +Sleep diff --git a/Task/String-length/LFE/string-length-1.lfe b/Task/String-length/LFE/string-length-1.lfe new file mode 100644 index 0000000000..a41633b3d5 --- /dev/null +++ b/Task/String-length/LFE/string-length-1.lfe @@ -0,0 +1,8 @@ +(length "ASCII text") +10 +(length "𝔘𝔫𝔦𝔠𝔬𝔡𝔢 𝔗𝔢𝒙𝔱") +12 +> (set encoded (binary ("𝔘𝔫𝔦𝔠𝔬𝔡𝔢 𝔗𝔢𝒙𝔱" utf8))) +#B(240 157 148 152 240 157 148 171 240 157 ...) +> (length (unicode:characters_to_list encoded 'utf8)) +12 diff --git a/Task/String-length/LFE/string-length-2.lfe b/Task/String-length/LFE/string-length-2.lfe new file mode 100644 index 0000000000..b72f8c526d --- /dev/null +++ b/Task/String-length/LFE/string-length-2.lfe @@ -0,0 +1,12 @@ +> (set encoded (binary ("𝔘𝔫𝔦𝔠𝔬𝔡𝔢 𝔗𝔢𝒙𝔱" utf8))) +#B(240 157 148 152 240 157 148 171 240 157 ...) +> (byte_size encoded) +45 +> (set bytes (binary ("𝔘𝔫𝔦𝔠𝔬𝔡𝔢 𝔗𝔢𝒙𝔱"))) +#B(24 43 38 32 44 33 34 32 23 34 153 49) +> (byte_size bytes) +12 +> (set encoded (binary ("ASCII text" utf8))) +#B(65 83 67 73 73 32 116 101 120 116) +> (byte_size encoded) +10 diff --git a/Task/String-length/Lasso/string-length-1.lasso b/Task/String-length/Lasso/string-length-1.lasso new file mode 100644 index 0000000000..1b4791c10c --- /dev/null +++ b/Task/String-length/Lasso/string-length-1.lasso @@ -0,0 +1,3 @@ +'Hello, world!'->size // 13 +'møøse'->size // 5 +'𝔘𝔫𝔦𝔠𝔬𝔡𝔢'->size // 7 diff --git a/Task/String-length/Lasso/string-length-2.lasso b/Task/String-length/Lasso/string-length-2.lasso new file mode 100644 index 0000000000..e7b7d012cf --- /dev/null +++ b/Task/String-length/Lasso/string-length-2.lasso @@ -0,0 +1,3 @@ +'Hello, world!'->asBytes->size // 13 +'møøse'->asBytes->size // 7 +'𝔘𝔫𝔦𝔠𝔬𝔡𝔢'->asBytes->size // 28 diff --git a/Task/String-length/Lingo/string-length-1.lingo b/Task/String-length/Lingo/string-length-1.lingo new file mode 100644 index 0000000000..08edbe2919 --- /dev/null +++ b/Task/String-length/Lingo/string-length-1.lingo @@ -0,0 +1,3 @@ +utf8Str = "Hello world äöü" +put utf8Str.length +-- 15 diff --git a/Task/String-length/Lingo/string-length-2.lingo b/Task/String-length/Lingo/string-length-2.lingo new file mode 100644 index 0000000000..a7b5256ffd --- /dev/null +++ b/Task/String-length/Lingo/string-length-2.lingo @@ -0,0 +1,3 @@ +utf8Str = "Hello world äöü" +put bytearray(utf8Str).length +-- 18 diff --git a/Task/String-length/Nim/string-length-1.nim b/Task/String-length/Nim/string-length-1.nim new file mode 100644 index 0000000000..3864d831b7 --- /dev/null +++ b/Task/String-length/Nim/string-length-1.nim @@ -0,0 +1,4 @@ +var s: string = "Hello, world! ☺" +echo '"',s, '"'," has byte length: ", len(s) + +# -> "Hello, world! ☺" has unicode char length: 17 diff --git a/Task/String-length/Nim/string-length-2.nim b/Task/String-length/Nim/string-length-2.nim new file mode 100644 index 0000000000..389fdf4490 --- /dev/null +++ b/Task/String-length/Nim/string-length-2.nim @@ -0,0 +1,6 @@ +import unicode + +var s: string = "Hello, world! ☺" +echo '"',s, '"'," has unicode char length: ", runeLen(s) + +# -> "Hello, world! ☺" has unicode char length: 15 diff --git a/Task/String-length/Phix/string-length.phix b/Task/String-length/Phix/string-length.phix new file mode 100644 index 0000000000..3e554dc5ef --- /dev/null +++ b/Task/String-length/Phix/string-length.phix @@ -0,0 +1,2 @@ +constant s = "𝔘𝔫𝔦𝔠𝔬𝔡𝔢" +?length(s) diff --git a/Task/String-length/Potion/string-length.potion b/Task/String-length/Potion/string-length.potion new file mode 100644 index 0000000000..ed22cbdf75 --- /dev/null +++ b/Task/String-length/Potion/string-length.potion @@ -0,0 +1,3 @@ +"møøse" length print +"𝔘𝔫𝔦𝔠𝔬𝔡𝔢" length print +"J̲o̲s̲é̲" length print diff --git a/Task/String-length/Ring/string-length.ring b/Task/String-length/Ring/string-length.ring new file mode 100644 index 0000000000..1bd39c3324 --- /dev/null +++ b/Task/String-length/Ring/string-length.ring @@ -0,0 +1,3 @@ +aString = "Welcome to the Ring Programming Language" +aStringSize = len(aString) +see "Character lenghts : " + aStringSize diff --git a/Task/String-length/Sidef/string-length-1.sidef b/Task/String-length/Sidef/string-length-1.sidef new file mode 100644 index 0000000000..7f494fc016 --- /dev/null +++ b/Task/String-length/Sidef/string-length-1.sidef @@ -0,0 +1 @@ +var str = "J\x{332}o\x{332}s\x{332}e\x{301}\x{332}"; diff --git a/Task/String-length/Sidef/string-length-2.sidef b/Task/String-length/Sidef/string-length-2.sidef new file mode 100644 index 0000000000..bc8da8902b --- /dev/null +++ b/Task/String-length/Sidef/string-length-2.sidef @@ -0,0 +1 @@ +say str.bytes.len; #=> 14 diff --git a/Task/String-length/Sidef/string-length-3.sidef b/Task/String-length/Sidef/string-length-3.sidef new file mode 100644 index 0000000000..c8b18ff338 --- /dev/null +++ b/Task/String-length/Sidef/string-length-3.sidef @@ -0,0 +1 @@ +say str.encode('UTF-16').bytes.len; #=> 20 diff --git a/Task/String-length/Sidef/string-length-4.sidef b/Task/String-length/Sidef/string-length-4.sidef new file mode 100644 index 0000000000..10bfbb72c9 --- /dev/null +++ b/Task/String-length/Sidef/string-length-4.sidef @@ -0,0 +1 @@ +say str.chars.len; #=> 9 diff --git a/Task/String-length/Sidef/string-length-5.sidef b/Task/String-length/Sidef/string-length-5.sidef new file mode 100644 index 0000000000..b6b05b3842 --- /dev/null +++ b/Task/String-length/Sidef/string-length-5.sidef @@ -0,0 +1 @@ +say str.graphs.len; #=> 4 diff --git a/Task/String-length/Sparkling/string-length.sparkling b/Task/String-length/Sparkling/string-length.sparkling new file mode 100644 index 0000000000..17bc54cdd5 --- /dev/null +++ b/Task/String-length/Sparkling/string-length.sparkling @@ -0,0 +1,2 @@ +spn:1> sizeof "Hello, wørld!" += 14 diff --git a/Task/String-length/Swift/string-length-1.swift b/Task/String-length/Swift/string-length-1.swift new file mode 100644 index 0000000000..81701e6458 --- /dev/null +++ b/Task/String-length/Swift/string-length-1.swift @@ -0,0 +1 @@ +let numberOfCharacters = "møøse".characters.count // 5 diff --git a/Task/String-length/Swift/string-length-10.swift b/Task/String-length/Swift/string-length-10.swift new file mode 100644 index 0000000000..c8cd3b7f44 --- /dev/null +++ b/Task/String-length/Swift/string-length-10.swift @@ -0,0 +1 @@ +let numberOfBytesUTF16 = "møøse".utf16.count * 2 // 10 diff --git a/Task/String-length/Swift/string-length-11.swift b/Task/String-length/Swift/string-length-11.swift new file mode 100644 index 0000000000..660918b64e --- /dev/null +++ b/Task/String-length/Swift/string-length-11.swift @@ -0,0 +1 @@ +let numberOfBytesUTF16 = count("møøse".utf16) * 2 // 10 diff --git a/Task/String-length/Swift/string-length-12.swift b/Task/String-length/Swift/string-length-12.swift new file mode 100644 index 0000000000..3af5bdc0aa --- /dev/null +++ b/Task/String-length/Swift/string-length-12.swift @@ -0,0 +1 @@ +let numberOfBytesUTF16 = countElements("møøse".utf16) * 2 // 10 diff --git a/Task/String-length/Swift/string-length-2.swift b/Task/String-length/Swift/string-length-2.swift new file mode 100644 index 0000000000..954b1ff4a8 --- /dev/null +++ b/Task/String-length/Swift/string-length-2.swift @@ -0,0 +1 @@ +let numberOfCharacters = count("møøse") // 5 diff --git a/Task/String-length/Swift/string-length-3.swift b/Task/String-length/Swift/string-length-3.swift new file mode 100644 index 0000000000..4722a10e80 --- /dev/null +++ b/Task/String-length/Swift/string-length-3.swift @@ -0,0 +1 @@ +let numberOfCharacters = countElements("møøse") // 5 diff --git a/Task/String-length/Swift/string-length-4.swift b/Task/String-length/Swift/string-length-4.swift new file mode 100644 index 0000000000..9d1a85223c --- /dev/null +++ b/Task/String-length/Swift/string-length-4.swift @@ -0,0 +1 @@ +let numberOfCodePoints = "møøse".unicodeScalars.count // 5 diff --git a/Task/String-length/Swift/string-length-5.swift b/Task/String-length/Swift/string-length-5.swift new file mode 100644 index 0000000000..eefff24aa8 --- /dev/null +++ b/Task/String-length/Swift/string-length-5.swift @@ -0,0 +1 @@ +let numberOfCodePoints = count("møøse".unicodeScalars) // 5 diff --git a/Task/String-length/Swift/string-length-6.swift b/Task/String-length/Swift/string-length-6.swift new file mode 100644 index 0000000000..16d1106541 --- /dev/null +++ b/Task/String-length/Swift/string-length-6.swift @@ -0,0 +1 @@ +let numberOfCodePoints = countElements("møøse".unicodeScalars) // 5 diff --git a/Task/String-length/Swift/string-length-7.swift b/Task/String-length/Swift/string-length-7.swift new file mode 100644 index 0000000000..e8b13d55e8 --- /dev/null +++ b/Task/String-length/Swift/string-length-7.swift @@ -0,0 +1 @@ +let numberOfBytesUTF8 = "møøse".utf8.count // 7 diff --git a/Task/String-length/Swift/string-length-8.swift b/Task/String-length/Swift/string-length-8.swift new file mode 100644 index 0000000000..4bb9f2d805 --- /dev/null +++ b/Task/String-length/Swift/string-length-8.swift @@ -0,0 +1 @@ +let numberOfBytesUTF8 = count("møøse".utf8) // 7 diff --git a/Task/String-length/Swift/string-length-9.swift b/Task/String-length/Swift/string-length-9.swift new file mode 100644 index 0000000000..c3d7901924 --- /dev/null +++ b/Task/String-length/Swift/string-length-9.swift @@ -0,0 +1 @@ +let numberOfBytesUTF8 = countElements("møøse".utf8) // 7 diff --git a/Task/String-length/Wren/string-length-1.wren b/Task/String-length/Wren/string-length-1.wren new file mode 100644 index 0000000000..303227ac8f --- /dev/null +++ b/Task/String-length/Wren/string-length-1.wren @@ -0,0 +1,3 @@ +System.print("møøse".bytes.count) +System.print("𝔘𝔫𝔦𝔠𝔬𝔡𝔢".bytes.count) +System.print("J̲o̲s̲é̲".bytes.count) diff --git a/Task/String-length/Wren/string-length-2.wren b/Task/String-length/Wren/string-length-2.wren new file mode 100644 index 0000000000..5daeb0b24c --- /dev/null +++ b/Task/String-length/Wren/string-length-2.wren @@ -0,0 +1,3 @@ +System.print("møøse".count) +System.print("𝔘𝔫𝔦𝔠𝔬𝔡𝔢".count) +System.print("J̲o̲s̲é̲".count) diff --git a/Task/String-length/jq/string-length-1.jq b/Task/String-length/jq/string-length-1.jq new file mode 100644 index 0000000000..06bd2fa64f --- /dev/null +++ b/Task/String-length/jq/string-length-1.jq @@ -0,0 +1,5 @@ +$ cat String_length.jq +def describe: + "length of \(.) is \(length)"; + +("J̲o̲s̲é̲", "𝔘𝔫𝔦𝔠𝔬𝔡𝔢") | describe diff --git a/Task/String-length/jq/string-length-2.jq b/Task/String-length/jq/string-length-2.jq new file mode 100644 index 0000000000..cce016ca03 --- /dev/null +++ b/Task/String-length/jq/string-length-2.jq @@ -0,0 +1,3 @@ +$ jq -n -f String_length.jq +"length of J̲o̲s̲é̲ is 8" +"length of 𝔘𝔫𝔦𝔠𝔬𝔡𝔢 is 7" diff --git a/Task/String-matching/EchoLisp/string-matching.echolisp b/Task/String-matching/EchoLisp/string-matching.echolisp new file mode 100644 index 0000000000..1cb37cdbdc --- /dev/null +++ b/Task/String-matching/EchoLisp/string-matching.echolisp @@ -0,0 +1,5 @@ +(string-suffix? "nette" "Antoinette") → #t +(string-prefix? "Simon" "Simon & Garfunkel") → #t + +(string-match "Antoinette" "net") → #t ;; contains +(string-index "net" "Antoinette") → 5 ;; substring location diff --git a/Task/String-matching/FreeBASIC/string-matching.freebasic b/Task/String-matching/FreeBASIC/string-matching.freebasic new file mode 100644 index 0000000000..bf19a27707 --- /dev/null +++ b/Task/String-matching/FreeBASIC/string-matching.freebasic @@ -0,0 +1,26 @@ +' FB 1.05.0 Win64 + +Dim As String s1 = "abracadabra" +Dim As String s2 = "abra" +Print "First string : "; s1 +Print "Second string : "; s2 +Print +Print "First string begins with second string : "; CBool(s2 = Left(s1, Len(s2))) +Dim As Integer i1 = Instr(s1, s2) +Dim As Integer i2 +Print "First string contains second string : "; +If i1 Then + Print "at index"; i1; + i2 = Instr(i1 + Len(s2), s1, s2) + If i2 Then + Print " and at index"; i2 + Else + Print + End If +Else + Print "false"; +End If +Print "First string ends with second string : "; CBool(s2 = Right(s1, Len(s2))) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/String-matching/Lasso/string-matching.lasso b/Task/String-matching/Lasso/string-matching.lasso new file mode 100644 index 0000000000..cf20785ed2 --- /dev/null +++ b/Task/String-matching/Lasso/string-matching.lasso @@ -0,0 +1,14 @@ +local( + a = 'a quick brown peanut jumped over a quick brown fox', + b = 'a quick brown' +) + +//Determining if the first string starts with second string +#a->beginswith(#b) // true + +//Determining if the first string contains the second string at any location +#a >> #b // true +#a->contains(#b) // true + +//Determining if the first string ends with the second string +#a->endswith(#b) // false diff --git a/Task/String-matching/Lingo/string-matching.lingo b/Task/String-matching/Lingo/string-matching.lingo new file mode 100644 index 0000000000..de6ffa5fb9 --- /dev/null +++ b/Task/String-matching/Lingo/string-matching.lingo @@ -0,0 +1,22 @@ +a = "Hello world!" +b = "Hello" + +-- Determining if the first string starts with second string +put a starts b +-- 1 + +-- Determining if the first string contains the second string at any location +put a contains b +-- 1 + +-- Determining if the first string ends with the second string +put a.char[a.length-b.length+1..a.length] = b +-- 0 + +b = "world!" +put a.char[a.length-b.length+1..a.length] = b +-- 1 + +-- Print the location of the match for part 2 +put offset(b, a) +-- 7 diff --git a/Task/String-matching/Nim/string-matching.nim b/Task/String-matching/Nim/string-matching.nim new file mode 100644 index 0000000000..639dffa431 --- /dev/null +++ b/Task/String-matching/Nim/string-matching.nim @@ -0,0 +1,10 @@ +import strutils + +var s: string = "The quick brown fox" +if startsWith(s, "The quick"): + echo("Starts with: The quick") +if endsWith(s, "brown Fox"): + echo("Ends with: brown fox") +var pos = find(s, " brown ") # -1 if not found +if contains(s, " brown "): # showing the contains() proc, but could use if pos!=-1: + echo('"' & " brown " & '"' & " is located at position: " & $pos) diff --git a/Task/String-matching/Oforth/string-matching.oforth b/Task/String-matching/Oforth/string-matching.oforth new file mode 100644 index 0000000000..645007a979 --- /dev/null +++ b/Task/String-matching/Oforth/string-matching.oforth @@ -0,0 +1,14 @@ +: stringMatching(s1, s2) +| i | + s2 isAllAt(s1, 1) ifTrue: [ System.Out s1 << " begins with " << s2 << cr ] + s2 isAllAt(s1, s1 size s2 size - 1 + ) ifTrue: [ System.Out s1 << " ends with " << s2 << cr ] + + s1 indexOfAll(s2) ->i + i ifNotNull: [ System.Out s1 << " includes " << s2 << " at position : " << i << cr ] + + "\nAll positions : " println + 1 ->i + while (s1 indexOfAllFrom(s2, i) dup ->i notNull) [ + System.Out s1 << " includes " << s2 << " at position : " << i << cr + i s2 size + ->i + ] ; diff --git a/Task/String-matching/Phix/string-matching.phix b/Task/String-matching/Phix/string-matching.phix new file mode 100644 index 0000000000..d96936281f --- /dev/null +++ b/Task/String-matching/Phix/string-matching.phix @@ -0,0 +1,29 @@ +constant word = "the", -- (also try this with "th"/"he") + sentence = "the last thing the man said was the" +-- sentence = "thelastthingthemansaidwasthe" -- (practically the same results) + +-- A common, but potentially inefficient idiom for checking for a substring at the start is: +if match(word,sentence)=1 then + ?"yes(1)" +end if +-- A more efficient method is to test the appropriate slice +if length(sentence)>=length(word) +and sentence[1..length(word)]=word then + ?"yes(2)" +end if +-- Which is almost identical to checking for a word at the end +if length(sentence)>=length(word) +and sentence[-length(word)..-1]=word then + ?"yes(3)" +end if +-- Or sometimes you will see this, a tiny bit more efficient: +if length(sentence)>=length(word) +and match(word,sentence,length(sentence)-length(word)+1) then + ?"yes(4)" +end if +-- Finding all occurences is a snap: +integer r = match(word,sentence) +while r!=0 do + ?r + r = match(word,sentence,r+1) +end while diff --git a/Task/String-matching/Ring/string-matching.ring b/Task/String-matching/Ring/string-matching.ring new file mode 100644 index 0000000000..ed16a3dc3f --- /dev/null +++ b/Task/String-matching/Ring/string-matching.ring @@ -0,0 +1,4 @@ +aString = "Welcome to the Ring Programming Language" +bString = "Ring" +bStringIndex = substr(aString,bString) +if bStringIndex > 0 see "" + bStringIndex + " : " + bString ok diff --git a/Task/String-matching/Sidef/string-matching.sidef b/Task/String-matching/Sidef/string-matching.sidef new file mode 100644 index 0000000000..bd7d9bad87 --- /dev/null +++ b/Task/String-matching/Sidef/string-matching.sidef @@ -0,0 +1,15 @@ +var first = "abc-abcdef-abcd"; +var second = "abc"; + +say first.begins_with(second); #=> true +say first.contains(second); #=> true +say first.ends_with(second); #=> false + +# Get and print the location of the match +say first.index(second); #=> 0 + +# Find multiple occurrences of a string +var pos = -1; +while (pos = first.index(second, pos+1) != -1) { + say "Match at pos: #{pos}"; +} diff --git a/Task/String-matching/Swift/string-matching.swift b/Task/String-matching/Swift/string-matching.swift new file mode 100644 index 0000000000..979217edc8 --- /dev/null +++ b/Task/String-matching/Swift/string-matching.swift @@ -0,0 +1,9 @@ +var str = "Hello, playground" +str.hasPrefix("Hell") //True +str.hasPrefix("hell") //False + +str.containsString("llo") //True +str.containsString("xxoo") //False + +str.hasSuffix("playground") //True +str.hasSuffix("world") //False diff --git a/Task/String-matching/jq/string-matching-1.jq b/Task/String-matching/jq/string-matching-1.jq new file mode 100644 index 0000000000..34c919c738 --- /dev/null +++ b/Task/String-matching/jq/string-matching-1.jq @@ -0,0 +1,3 @@ +# startswith/1 is boolean: +"abc" | startswith("ab") +#=> true diff --git a/Task/String-matching/jq/string-matching-2.jq b/Task/String-matching/jq/string-matching-2.jq new file mode 100644 index 0000000000..8930ee0266 --- /dev/null +++ b/Task/String-matching/jq/string-matching-2.jq @@ -0,0 +1,6 @@ +# index/1 returns the index or null, +# so the jq test "if index(_) then ...." can be used +# without any type conversion. + +"abcd" | index( "bc") +#=> 1 diff --git a/Task/String-matching/jq/string-matching-3.jq b/Task/String-matching/jq/string-matching-3.jq new file mode 100644 index 0000000000..86bcee2ed6 --- /dev/null +++ b/Task/String-matching/jq/string-matching-3.jq @@ -0,0 +1,3 @@ +# endswith/1 is also boolean: +"abc" | endswith("bc") +#=> true diff --git a/Task/String-matching/jq/string-matching-4.jq b/Task/String-matching/jq/string-matching-4.jq new file mode 100644 index 0000000000..ff89e58fd1 --- /dev/null +++ b/Task/String-matching/jq/string-matching-4.jq @@ -0,0 +1,5 @@ +"abc" | test( "^ab") + +"abcd" | test("bc") + +"abcd" | test("cd$") diff --git a/Task/String-matching/jq/string-matching-5.jq b/Task/String-matching/jq/string-matching-5.jq new file mode 100644 index 0000000000..f7dd9d3506 --- /dev/null +++ b/Task/String-matching/jq/string-matching-5.jq @@ -0,0 +1,6 @@ +# In jq 1.4 or later: +jq -n '"abcdabcd" | indices("bc")' +[ + 1, + 5 +] diff --git a/Task/String-matching/jq/string-matching-6.jq b/Task/String-matching/jq/string-matching-6.jq new file mode 100644 index 0000000000..9000e4da49 --- /dev/null +++ b/Task/String-matching/jq/string-matching-6.jq @@ -0,0 +1,3 @@ +$ jq -n '"abcdabcd" | match("bc"; "g") | .offset' +1 +5 diff --git a/Task/String-prepend/ERRE/string-prepend.erre b/Task/String-prepend/ERRE/string-prepend.erre new file mode 100644 index 0000000000..33c6ae23a3 --- /dev/null +++ b/Task/String-prepend/ERRE/string-prepend.erre @@ -0,0 +1,5 @@ +...... +S$=" World!" +S$="Hello"+S$ +PRINT(S$) +...... diff --git a/Task/String-prepend/EchoLisp/string-prepend.echolisp b/Task/String-prepend/EchoLisp/string-prepend.echolisp new file mode 100644 index 0000000000..debbb00aa4 --- /dev/null +++ b/Task/String-prepend/EchoLisp/string-prepend.echolisp @@ -0,0 +1,10 @@ +define-syntax-rule + (set!-string-prepend a before) + (set! a (string-append before a))) + → #syntax:set!-string-prepend + +(define name "Presley") + → name +(set!-string-prepend name "Elvis ") +name + → "Elvis Presley" diff --git a/Task/String-prepend/FreeBASIC/string-prepend.freebasic b/Task/String-prepend/FreeBASIC/string-prepend.freebasic new file mode 100644 index 0000000000..19e8c31ebb --- /dev/null +++ b/Task/String-prepend/FreeBASIC/string-prepend.freebasic @@ -0,0 +1,6 @@ +' FB 1.05.0 Win64 + +Var s = "prepend" +s = "String " + s +Print s +Sleep diff --git a/Task/String-prepend/LFE/string-prepend-1.lfe b/Task/String-prepend/LFE/string-prepend-1.lfe new file mode 100644 index 0000000000..222604fa8d --- /dev/null +++ b/Task/String-prepend/LFE/string-prepend-1.lfe @@ -0,0 +1,4 @@ +> (set s "world") +"world" +> (++ "hello " s) +"hello world" diff --git a/Task/String-prepend/LFE/string-prepend-2.lfe b/Task/String-prepend/LFE/string-prepend-2.lfe new file mode 100644 index 0000000000..70a7a3d842 --- /dev/null +++ b/Task/String-prepend/LFE/string-prepend-2.lfe @@ -0,0 +1,4 @@ +> (set s "world") +"world" +> (string:concat "hello " s) +"hello world" diff --git a/Task/String-prepend/Lasso/string-prepend.lasso b/Task/String-prepend/Lasso/string-prepend.lasso new file mode 100644 index 0000000000..7b9cb60c60 --- /dev/null +++ b/Task/String-prepend/Lasso/string-prepend.lasso @@ -0,0 +1,3 @@ +local(x = ', World!') +#x->merge(1,'Hello') +#x // Hello, World! diff --git a/Task/String-prepend/Lingo/string-prepend.lingo b/Task/String-prepend/Lingo/string-prepend.lingo new file mode 100644 index 0000000000..511990641e --- /dev/null +++ b/Task/String-prepend/Lingo/string-prepend.lingo @@ -0,0 +1,4 @@ +str = "world!" +put "Hello " before str +put str +-- "Hello world!" diff --git a/Task/String-prepend/LiveCode/string-prepend.livecode b/Task/String-prepend/LiveCode/string-prepend.livecode new file mode 100644 index 0000000000..d9fded2a91 --- /dev/null +++ b/Task/String-prepend/LiveCode/string-prepend.livecode @@ -0,0 +1,3 @@ +put "world" into x +put "hello" before x +put x // hello world diff --git a/Task/String-prepend/Nim/string-prepend.nim b/Task/String-prepend/Nim/string-prepend.nim new file mode 100644 index 0000000000..4aebbd1f24 --- /dev/null +++ b/Task/String-prepend/Nim/string-prepend.nim @@ -0,0 +1,3 @@ +var str = "12345678" +str = "0" & str +echo str diff --git a/Task/String-prepend/Oforth/string-prepend.oforth b/Task/String-prepend/Oforth/string-prepend.oforth new file mode 100644 index 0000000000..646d6acd86 --- /dev/null +++ b/Task/String-prepend/Oforth/string-prepend.oforth @@ -0,0 +1 @@ +" World" "Hello" swap + println diff --git a/Task/String-prepend/Phix/string-prepend.phix b/Task/String-prepend/Phix/string-prepend.phix new file mode 100644 index 0000000000..36408bc6b1 --- /dev/null +++ b/Task/String-prepend/Phix/string-prepend.phix @@ -0,0 +1,2 @@ +string s = "World" +s = "Hello "&s diff --git a/Task/String-prepend/Ring/string-prepend.ring b/Task/String-prepend/Ring/string-prepend.ring new file mode 100644 index 0000000000..7b4b78b1b4 --- /dev/null +++ b/Task/String-prepend/Ring/string-prepend.ring @@ -0,0 +1,3 @@ +aString = "World!" +bString = "Hello, " + aString +see bString + nl diff --git a/Task/String-prepend/Sidef/string-prepend-1.sidef b/Task/String-prepend/Sidef/string-prepend-1.sidef new file mode 100644 index 0000000000..9061b32b62 --- /dev/null +++ b/Task/String-prepend/Sidef/string-prepend-1.sidef @@ -0,0 +1,3 @@ +var str = 'llo!'; +str.sub!(/^/, 'He'); +say str; diff --git a/Task/String-prepend/Sidef/string-prepend-2.sidef b/Task/String-prepend/Sidef/string-prepend-2.sidef new file mode 100644 index 0000000000..6edb8f2404 --- /dev/null +++ b/Task/String-prepend/Sidef/string-prepend-2.sidef @@ -0,0 +1,3 @@ +var str = 'llo!'; +str.prepend!('He'); +say str; diff --git a/Task/String-prepend/Swift/string-prepend.swift b/Task/String-prepend/Swift/string-prepend.swift new file mode 100644 index 0000000000..689c3bc9d8 --- /dev/null +++ b/Task/String-prepend/Swift/string-prepend.swift @@ -0,0 +1,3 @@ +var str = ", World" +str = "Hello \(str)" +println(str) diff --git a/Task/String-prepend/Ursa/string-prepend.ursa b/Task/String-prepend/Ursa/string-prepend.ursa new file mode 100644 index 0000000000..71f1a136ec --- /dev/null +++ b/Task/String-prepend/Ursa/string-prepend.ursa @@ -0,0 +1,10 @@ +decl string s + +# set s to "world" +set s "world" + +# prepend "hello " +set s (+ "hello " s) + +# outputs "hello world" +out s endl console diff --git a/Task/String-prepend/Wart/string-prepend.wart b/Task/String-prepend/Wart/string-prepend.wart new file mode 100644 index 0000000000..2b9fcb1fba --- /dev/null +++ b/Task/String-prepend/Wart/string-prepend.wart @@ -0,0 +1,2 @@ +s <- "12345678" +s <- ("0" + s) diff --git a/Task/String-prepend/jq/string-prepend.jq b/Task/String-prepend/jq/string-prepend.jq new file mode 100644 index 0000000000..fe109e994c --- /dev/null +++ b/Task/String-prepend/jq/string-prepend.jq @@ -0,0 +1,2 @@ +"world!" as $s +| "Hello " + $s diff --git a/Task/Strip-a-set-of-characters-from-a-string/EchoLisp/strip-a-set-of-characters-from-a-string.echolisp b/Task/Strip-a-set-of-characters-from-a-string/EchoLisp/strip-a-set-of-characters-from-a-string.echolisp new file mode 100644 index 0000000000..37f81b927c --- /dev/null +++ b/Task/Strip-a-set-of-characters-from-a-string/EchoLisp/strip-a-set-of-characters-from-a-string.echolisp @@ -0,0 +1,7 @@ +;; using regexp /[chars]/g + +(define (strip-chars string chars) + (string-replace string (string-append "/[" chars "]/g") "")) + +(strip-chars "She was a soul stripper. She took my heart!" "aei") + → "Sh ws soul strppr. Sh took my hrt!" diff --git a/Task/Strip-a-set-of-characters-from-a-string/FreeBASIC/strip-a-set-of-characters-from-a-string.freebasic b/Task/Strip-a-set-of-characters-from-a-string/FreeBASIC/strip-a-set-of-characters-from-a-string.freebasic new file mode 100644 index 0000000000..05cb583c78 --- /dev/null +++ b/Task/Strip-a-set-of-characters-from-a-string/FreeBASIC/strip-a-set-of-characters-from-a-string.freebasic @@ -0,0 +1,33 @@ +' FB 1.05.0 Win64 + +Function stripChars(s As Const String, chars As Const String) As String + If s = "" Then Return "" + Dim count As Integer = 0 + Dim strip(0 To Len(s) - 1) As Boolean + For i As Integer = 0 To Len(s) - 1 + For j As Integer = 0 To Len(chars) - 1 + If s[i] = chars[j] Then + count += 1 + strip(i) = True + Exit For + End If + Next j + Next i + + Dim buffer As String = Space(Len(s) - count) + count = 0 + For i As Integer = 0 To Len(s) - 1 + If Not Strip(i) Then + buffer[count] = s[i] + count += 1 + End If + Next + Return buffer +End Function + +Dim s As String = "She was a soul stripper. She took my heart!" +Dim chars As String = "aei" +Print stripChars(s, chars) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Strip-a-set-of-characters-from-a-string/Lasso/strip-a-set-of-characters-from-a-string.lasso b/Task/Strip-a-set-of-characters-from-a-string/Lasso/strip-a-set-of-characters-from-a-string.lasso new file mode 100644 index 0000000000..9674b02004 --- /dev/null +++ b/Task/Strip-a-set-of-characters-from-a-string/Lasso/strip-a-set-of-characters-from-a-string.lasso @@ -0,0 +1,7 @@ +define stripper(in::string,destroy::string) => { + with toremove in #destroy->values do => { + #in->replace(#toremove,'') + } + return #in +} +stripper('She was a soul stripper. She took my heart!','aei') diff --git a/Task/Strip-a-set-of-characters-from-a-string/LiveCode/strip-a-set-of-characters-from-a-string-1.livecode b/Task/Strip-a-set-of-characters-from-a-string/LiveCode/strip-a-set-of-characters-from-a-string-1.livecode new file mode 100644 index 0000000000..d1a35f4bd1 --- /dev/null +++ b/Task/Strip-a-set-of-characters-from-a-string/LiveCode/strip-a-set-of-characters-from-a-string-1.livecode @@ -0,0 +1,8 @@ +function stripChars str charlist + local strstripped + put str into strstripped + repeat for each char c in charlist + replace c with empty in strstripped + end repeat + return strstripped +end stripChars diff --git a/Task/Strip-a-set-of-characters-from-a-string/LiveCode/strip-a-set-of-characters-from-a-string-2.livecode b/Task/Strip-a-set-of-characters-from-a-string/LiveCode/strip-a-set-of-characters-from-a-string-2.livecode new file mode 100644 index 0000000000..cb3ffa1df0 --- /dev/null +++ b/Task/Strip-a-set-of-characters-from-a-string/LiveCode/strip-a-set-of-characters-from-a-string-2.livecode @@ -0,0 +1,3 @@ +command teststripchars + put stripchars("She was a soul stripper. She took my heart!","aei") +end teststripchars diff --git a/Task/Strip-a-set-of-characters-from-a-string/Nim/strip-a-set-of-characters-from-a-string.nim b/Task/Strip-a-set-of-characters-from-a-string/Nim/strip-a-set-of-characters-from-a-string.nim new file mode 100644 index 0000000000..cc4c11aca0 --- /dev/null +++ b/Task/Strip-a-set-of-characters-from-a-string/Nim/strip-a-set-of-characters-from-a-string.nim @@ -0,0 +1,9 @@ +import strutils + +proc `$` (x: seq[string]): string = + result = x.join("") + +echo(split("She was a soul stripper. She took my heart!", {'a','e','i'}).join("")) + +# using the above proc to overload the toString operator `$` as an alternative to using join() +echo($split("She was a soul stripper. She took my heart!", {'a','e','i'})) diff --git a/Task/Strip-a-set-of-characters-from-a-string/Oforth/strip-a-set-of-characters-from-a-string.oforth b/Task/Strip-a-set-of-characters-from-a-string/Oforth/strip-a-set-of-characters-from-a-string.oforth new file mode 100644 index 0000000000..bd783ae356 --- /dev/null +++ b/Task/Strip-a-set-of-characters-from-a-string/Oforth/strip-a-set-of-characters-from-a-string.oforth @@ -0,0 +1,3 @@ +String method: stripChars(str) #[ str include not ] self filter ; + +"She was a soul stripper. She took my heart!" stripChars("aei") println diff --git a/Task/Strip-a-set-of-characters-from-a-string/Phix/strip-a-set-of-characters-from-a-string.phix b/Task/Strip-a-set-of-characters-from-a-string/Phix/strip-a-set-of-characters-from-a-string.phix new file mode 100644 index 0000000000..dda9f3511e --- /dev/null +++ b/Task/Strip-a-set-of-characters-from-a-string/Phix/strip-a-set-of-characters-from-a-string.phix @@ -0,0 +1,8 @@ +function stripchars(string s, string chars) + for i=1 to length(chars) do + s = substitute(s,chars[i..i],"") + end for + return s +end function + +?stripchars("She was a soul stripper. She took my heart!","aei") diff --git a/Task/Strip-a-set-of-characters-from-a-string/Ring/strip-a-set-of-characters-from-a-string.ring b/Task/Strip-a-set-of-characters-from-a-string/Ring/strip-a-set-of-characters-from-a-string.ring new file mode 100644 index 0000000000..2fc2d74485 --- /dev/null +++ b/Task/Strip-a-set-of-characters-from-a-string/Ring/strip-a-set-of-characters-from-a-string.ring @@ -0,0 +1,10 @@ +aList = "She was a soul stripper. She took my heart!" +bList = "aei" +see aList + nl +see stripChars(aList,bList) + +func stripChars cList, dList + for n = 1 to len(dList) + cList = substr(cList,dList[n],"") + nl + next + return cList diff --git a/Task/Strip-a-set-of-characters-from-a-string/Sidef/strip-a-set-of-characters-from-a-string-1.sidef b/Task/Strip-a-set-of-characters-from-a-string/Sidef/strip-a-set-of-characters-from-a-string-1.sidef new file mode 100644 index 0000000000..07a4923eb4 --- /dev/null +++ b/Task/Strip-a-set-of-characters-from-a-string/Sidef/strip-a-set-of-characters-from-a-string-1.sidef @@ -0,0 +1,3 @@ +func stripchars(str, char_list) { + str.tr(char_list, "", "d"); +} diff --git a/Task/Strip-a-set-of-characters-from-a-string/Sidef/strip-a-set-of-characters-from-a-string-2.sidef b/Task/Strip-a-set-of-characters-from-a-string/Sidef/strip-a-set-of-characters-from-a-string-2.sidef new file mode 100644 index 0000000000..32c8b96835 --- /dev/null +++ b/Task/Strip-a-set-of-characters-from-a-string/Sidef/strip-a-set-of-characters-from-a-string-2.sidef @@ -0,0 +1,3 @@ +func stripchars(str, char_list) { + str.chars.grep {|c| !char_list.contains(c)}.join; +} diff --git a/Task/Strip-a-set-of-characters-from-a-string/Sidef/strip-a-set-of-characters-from-a-string-3.sidef b/Task/Strip-a-set-of-characters-from-a-string/Sidef/strip-a-set-of-characters-from-a-string-3.sidef new file mode 100644 index 0000000000..effda8e25b --- /dev/null +++ b/Task/Strip-a-set-of-characters-from-a-string/Sidef/strip-a-set-of-characters-from-a-string-3.sidef @@ -0,0 +1 @@ +say stripchars("She was a soul stripper. She took my heart!", "aei"); diff --git a/Task/Strip-a-set-of-characters-from-a-string/Swift/strip-a-set-of-characters-from-a-string.swift b/Task/Strip-a-set-of-characters-from-a-string/Swift/strip-a-set-of-characters-from-a-string.swift new file mode 100644 index 0000000000..ee673b4449 --- /dev/null +++ b/Task/Strip-a-set-of-characters-from-a-string/Swift/strip-a-set-of-characters-from-a-string.swift @@ -0,0 +1,10 @@ +extension String { + func stripCharactersInSet(chars: [Character]) -> String { + return String(seq: filter(self) {find(chars, $0) == nil}) + } +} + +let aString = "She was a soul stripper. She took my heart!" +let chars: [Character] = ["a", "e", "i"] + +println(aString.stripCharactersInSet(chars)) diff --git a/Task/Strip-a-set-of-characters-from-a-string/jq/strip-a-set-of-characters-from-a-string-1.jq b/Task/Strip-a-set-of-characters-from-a-string/jq/strip-a-set-of-characters-from-a-string-1.jq new file mode 100644 index 0000000000..014286cd27 --- /dev/null +++ b/Task/Strip-a-set-of-characters-from-a-string/jq/strip-a-set-of-characters-from-a-string-1.jq @@ -0,0 +1,2 @@ +def stripchars(string; banish): + (string | explode) - (banish | explode) | implode; diff --git a/Task/Strip-a-set-of-characters-from-a-string/jq/strip-a-set-of-characters-from-a-string-2.jq b/Task/Strip-a-set-of-characters-from-a-string/jq/strip-a-set-of-characters-from-a-string-2.jq new file mode 100644 index 0000000000..99cb2053db --- /dev/null +++ b/Task/Strip-a-set-of-characters-from-a-string/jq/strip-a-set-of-characters-from-a-string-2.jq @@ -0,0 +1,2 @@ +def stripchars(banish): + explode - (banish | explode) | implode; diff --git a/Task/Strip-block-comments/Nim/strip-block-comments.nim b/Task/Strip-block-comments/Nim/strip-block-comments.nim new file mode 100644 index 0000000000..b08c3f8554 --- /dev/null +++ b/Task/Strip-block-comments/Nim/strip-block-comments.nim @@ -0,0 +1,48 @@ +import strutils + +proc commentStripper(txt; delim: tuple[l,r: string] = ("/*", "*/")): string = + let i = txt.find(delim.l) + if i < 0: + return txt + + result = if i > 0: txt[0 .. = 0 + result &= tmp[j+delim.r.len .. tmp.high] + +echo "NON-NESTED BLOCK COMMENT EXAMPLE:" +echo commentStripper("""/** + * Some comments + * longer comments here that we can parse. + * + * Rahoo + */ + function subroutine() { + a = /* inline comment */ b + c ; + } + /*/ <-- tricky comments */ + + /** + * Another comment. + */ + function something() { + }""") + +echo "\nNESTED BLOCK COMMENT EXAMPLE:" +echo commentStripper(""" /** + * Some comments + * longer comments here that we can parse. + * + * Rahoo + *//* + function subroutine() { + a = /* inline comment */ b + c ; + } + /*/ <-- tricky comments */ + */ + /** + * Another comment. + */ + function something() { + }""") diff --git a/Task/Strip-block-comments/Phix/strip-block-comments.phix b/Task/Strip-block-comments/Phix/strip-block-comments.phix new file mode 100644 index 0000000000..2477667ec9 --- /dev/null +++ b/Task/Strip-block-comments/Phix/strip-block-comments.phix @@ -0,0 +1,34 @@ +constant test = """ + /** + * Some comments + * longer comments here that we can parse. + * + * Rahoo + */ + function subroutine() { + a = /* inline comment */ b + c ; + } + /*/ <-- tricky comments */ + + /** + * Another comment. + */ + function something() { + } +""" + +function strip_comments(string text, startc="/*", endc="*/") + while 1 do + integer startp = match(startc,text) + if startp=0 then exit end if + integer endp = match(endc,text,startp+length(startc)) + if endp=0 then + puts(1,"error, aborting...") + abort(0) + end if + text[startp..endp+length(endc)-1] = "" + end while + return text +end function + +puts(1,strip_comments(test)) diff --git a/Task/Strip-block-comments/Ring/strip-block-comments.ring b/Task/Strip-block-comments/Ring/strip-block-comments.ring new file mode 100644 index 0000000000..56ee2da17f --- /dev/null +++ b/Task/Strip-block-comments/Ring/strip-block-comments.ring @@ -0,0 +1,13 @@ +example = "123/*456*/abc/*def*/789" + +example2 = example +nr = 1 +while nr = 1 + n1 = substr(example2,"/*") + n2 = substr(example2,"*/") + if n1 > 0 and n2 > 0 + example3 = substr(example2,n1,n2-n1+2) + example2 = substr(example2,example3,"") + else nr = 0 ok +end +see example2 + nl diff --git a/Task/Strip-block-comments/Sidef/strip-block-comments.sidef b/Task/Strip-block-comments/Sidef/strip-block-comments.sidef new file mode 100644 index 0000000000..d9a2404160 --- /dev/null +++ b/Task/Strip-block-comments/Sidef/strip-block-comments.sidef @@ -0,0 +1,6 @@ +func strip_block_comments(code, beg='/*', end='*/') { + var re = Regex.new(beg.escape + '.*?' + end.escape, 's'); + code.gsub(re, ''); +} + +say strip_block_comments(ARGF.slurp); diff --git a/Task/Strip-block-comments/jq/strip-block-comments.jq b/Task/Strip-block-comments/jq/strip-block-comments.jq new file mode 100644 index 0000000000..e2b4e6c669 --- /dev/null +++ b/Task/Strip-block-comments/jq/strip-block-comments.jq @@ -0,0 +1,9 @@ +def strip_block_comments(open; close): + def deregex: + reduce ("\\\\", "\\*", "\\^", "\\?", "\\+", "\\.", + "\\!", "\\{", "\\}", "\\[", "\\]", "\\$", "\\|" ) as $c + (.; gsub($c; $c)); + # "?" => reluctant, "m" => multiline + gsub( (open|deregex) + ".*?" + (close|deregex); ""; "m") ; + +strip_block_comments("/*"; "*/") diff --git a/Task/Strip-comments-from-a-string/FreeBASIC/strip-comments-from-a-string.freebasic b/Task/Strip-comments-from-a-string/FreeBASIC/strip-comments-from-a-string.freebasic new file mode 100644 index 0000000000..7ce916581d --- /dev/null +++ b/Task/Strip-comments-from-a-string/FreeBASIC/strip-comments-from-a-string.freebasic @@ -0,0 +1,27 @@ +' FB 1.05.0 Win64 + +Sub stripComment(s As String, commentMarkers As String) + If s = "" Then Return + Dim i As Integer = Instr(s, Any commentMarkers) + If i > 0 Then + s = Left(s, i - 1) + s = Trim(s) '' removes both leading and trailing whitespace + End If +End Sub + +Dim s(1 To 4) As String = _ +{ _ + "apples, pears # and bananas", _ + "apples, pears ; and bananas", _ + "# this is a comment", _ + " # this is a comment with leading whitespace" _ +} + +For i As Integer = 1 To 4 + stripComment(s(i), "#;") + Print s(i), " => Length ="; Len(s(i)) +Next + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Strip-comments-from-a-string/Nim/strip-comments-from-a-string.nim b/Task/Strip-comments-from-a-string/Nim/strip-comments-from-a-string.nim new file mode 100644 index 0000000000..95a1ba8a95 --- /dev/null +++ b/Task/Strip-comments-from-a-string/Nim/strip-comments-from-a-string.nim @@ -0,0 +1,7 @@ +import strutils + +proc removeComments(line, sep): string = + line.split(sep)[0].strip(leading = false) + +echo removeComments("apples, pears # and bananas", '#') +echo removeComments("apples, pears ; and bananas", ';') diff --git a/Task/Strip-comments-from-a-string/Oforth/strip-comments-from-a-string.oforth b/Task/Strip-comments-from-a-string/Oforth/strip-comments-from-a-string.oforth new file mode 100644 index 0000000000..116544661a --- /dev/null +++ b/Task/Strip-comments-from-a-string/Oforth/strip-comments-from-a-string.oforth @@ -0,0 +1,4 @@ +: stripComments(s, markers) +| firstMarker | + markers map(#[ s indexOf ]) reduce(#min) ->firstMarker + s firstMarker ifNotNull: [ left(firstMarker 1 - ) ] strip ; diff --git a/Task/Strip-comments-from-a-string/Phix/strip-comments-from-a-string.phix b/Task/Strip-comments-from-a-string/Phix/strip-comments-from-a-string.phix new file mode 100644 index 0000000000..6d5509e8a0 --- /dev/null +++ b/Task/Strip-comments-from-a-string/Phix/strip-comments-from-a-string.phix @@ -0,0 +1,17 @@ +function strip_comments(string s, sequence comments={"#",";"}) + for i=1 to length(comments) do + integer k = match(comments[i],s) + if k then + s = s[1..k-1] + s = trim_tail(s) + end if + end for + return s +end function + +?strip_comments("apples, pears # and bananas") +?strip_comments("apples, pears ; and bananas") +?strip_comments("apples, pears and bananas ") +?strip_comments(" WS_CAPTION = #00C00000, -- = WS_BORDER+WS_DLGFRAME") +?strip_comments(" WS_CAPTION = #00C00000, -- = WS_BORDER+WS_DLGFRAME",{"--"}) +?strip_comments(" title = \"--Title--\"",{"--"}) diff --git a/Task/Strip-comments-from-a-string/Ring/strip-comments-from-a-string.ring b/Task/Strip-comments-from-a-string/Ring/strip-comments-from-a-string.ring new file mode 100644 index 0000000000..6e779ac02c --- /dev/null +++ b/Task/Strip-comments-from-a-string/Ring/strip-comments-from-a-string.ring @@ -0,0 +1,13 @@ +aList = 'apples, pears # and bananas' +see aList + nl +see stripComment(aList) + nl +aList = 'apples, pears // and bananas' +see aList + nl +see stripComment(aList) + nl + +func stripComment bList + nr = substr(bList,"#") + if nr > 0 cList = substr(bList,1,nr-1) ok + nr = substr(bList,"//") + if nr > 0 cList = substr(bList,1,nr-1) ok + return cList diff --git a/Task/Strip-comments-from-a-string/Sidef/strip-comments-from-a-string.sidef b/Task/Strip-comments-from-a-string/Sidef/strip-comments-from-a-string.sidef new file mode 100644 index 0000000000..17966663d9 --- /dev/null +++ b/Task/Strip-comments-from-a-string/Sidef/strip-comments-from-a-string.sidef @@ -0,0 +1,9 @@ +func strip_comment(s) { + (s - %r'[#;].*').strip; +} + +[" apples, pears # and bananas", + " apples, pears ; and bananas", + " apples, pears "].each { |s| + say strip_comment(s).dump; +}; diff --git a/Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-1.jq b/Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-1.jq new file mode 100644 index 0000000000..6be576f1ce --- /dev/null +++ b/Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-1.jq @@ -0,0 +1 @@ +sub("[#;].*";"") | sub("^\\s+";"") | sub("\\s+$";"") diff --git a/Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-2.jq b/Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-2.jq new file mode 100644 index 0000000000..7d8bbcacbc --- /dev/null +++ b/Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-2.jq @@ -0,0 +1,20 @@ +# define whitespace here as a tab, space, newline, return or form-feed character: +def is_whitespace: . as $in | " \n\r\f\t" | index($in); + +def ltrim: + if .[0:1] | is_whitespace then (.[1:]|ltrim) else . end; + +def rtrim: + if .[length-1:] | is_whitespace then .[0:length-1]|rtrim else . end; + +def trim: ltrim | rtrim; + +def strip_comment: + index("#") as $i1 | index(";") as $i2 + | (if $i1 then if $i2 then [$i1, $i2] | min + else $i1 + end + else $i2 + end ) as $ix + | if $ix then .[0:$ix] else . end + | trim; diff --git a/Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-3.jq b/Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-3.jq new file mode 100644 index 0000000000..bfa75f8e47 --- /dev/null +++ b/Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-3.jq @@ -0,0 +1 @@ +" abc ; def # ghi" | strip_comment diff --git a/Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-4.jq b/Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-4.jq new file mode 100644 index 0000000000..d1cc1b4e52 --- /dev/null +++ b/Task/Strip-comments-from-a-string/jq/strip-comments-from-a-string-4.jq @@ -0,0 +1 @@ +"abc" diff --git a/Task/Strip-control-codes-and-extended-characters-from-a-string/FreeBASIC/strip-control-codes-and-extended-characters-from-a-string.freebasic b/Task/Strip-control-codes-and-extended-characters-from-a-string/FreeBASIC/strip-control-codes-and-extended-characters-from-a-string.freebasic new file mode 100644 index 0000000000..d067b0c726 --- /dev/null +++ b/Task/Strip-control-codes-and-extended-characters-from-a-string/FreeBASIC/strip-control-codes-and-extended-characters-from-a-string.freebasic @@ -0,0 +1,78 @@ +' FB 1.05.0 Win64 + +Function stripControlChars(s As Const String) As String + If s = "" Then Return "" + Dim count As Integer = 0 + Dim strip(0 To Len(s) - 1) As Boolean + For i As Integer = 0 To Len(s) - 1 + For j As Integer = 0 To 31 + If s[i] = j OrElse s[i] = 127 Then + count += 1 + strip(i) = True + Exit For + End If + Next j + Next i + + Dim buffer As String = Space(Len(s) - count) + count = 0 + For i As Integer = 0 To Len(s) - 1 + If Not Strip(i) Then + buffer[count] = s[i] + count += 1 + End If + Next + Return buffer +End Function + +Function stripExtendedChars(s As Const String) As String + If s = "" Then Return "" + Dim count As Integer = 0 + Dim strip(0 To Len(s) - 1) As Boolean + For i As Integer = 0 To Len(s) - 1 + For j As Integer = 128 To 255 + If s[i] = j Then + count += 1 + strip(i) = True + Exit For + End If + Next j + Next i + + Dim buffer As String = Space(Len(s) - count) + count = 0 + For i As Integer = 0 To Len(s) - 1 + If Not Strip(i) Then + buffer[count] = s[i] + count += 1 + End If + Next + Return buffer +End Function + +Dim s As String = !"\v\001The\t quick\255 \vbrown\127\f fox\156" +Dim s1 As String = stripControlChars(s) +Dim s2 As String = stripExtendedChars(s) +Dim s3 As String = stripExtendedChars(s1) + +' Under Windows console, code page 850 : +' "vertical tab" displays as ♂ +' "form feed" displays as ♀ +' Chr(1) displays as ☺ +' Chr(127) displays as ⌂ +' the other control characters do what it says on the tin +' Chr(156) displays as £ +' Chr(255) displays as space + +Print "Before stripping :" , s +Print "Ctl chars stripped :" , s1 +Print "Ext chars stripped :" , s2 +Print "Both sets stripped :" , s3 +Print +Print "Before stripping" , "Length => " ; Len(s) +Print "Ctl chars stripped" , "Length => " ; Len(s1) +Print "Ext chars stripped" , "Length => " ; Len(s2) +Print "Both sets stripped" , "Length => " ; Len(s3) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Strip-control-codes-and-extended-characters-from-a-string/Nim/strip-control-codes-and-extended-characters-from-a-string.nim b/Task/Strip-control-codes-and-extended-characters-from-a-string/Nim/strip-control-codes-and-extended-characters-from-a-string.nim new file mode 100644 index 0000000000..0d090a6288 --- /dev/null +++ b/Task/Strip-control-codes-and-extended-characters-from-a-string/Nim/strip-control-codes-and-extended-characters-from-a-string.nim @@ -0,0 +1,7 @@ +proc stripped(str): string = + result = "" + for c in str: + if ord(c) in 32..126: + result.add c + +echo stripped "\ba\x00b\n\rc\fd\xc3" diff --git a/Task/Strip-control-codes-and-extended-characters-from-a-string/Peloton/strip-control-codes-and-extended-characters-from-a-string-1.peloton b/Task/Strip-control-codes-and-extended-characters-from-a-string/Peloton/strip-control-codes-and-extended-characters-from-a-string-1.peloton new file mode 100644 index 0000000000..bcdad30b2f --- /dev/null +++ b/Task/Strip-control-codes-and-extended-characters-from-a-string/Peloton/strip-control-codes-and-extended-characters-from-a-string-1.peloton @@ -0,0 +1,8 @@ +Create variable with control characters: <@ SAYLETVARLIT>i|This string has control characters + - - - - - - + +in it +Strip control characters <@ SAYSALVAR>i +Assign infix <@ LETVARSALVAR>j|i <@ SAYVAR>j +Assign prepend <@ LETSALVARVAR>k|i <@ SAYVAR>k +Reflexive assign <@ ACTSALVAR>i <@ SAYVAR>i diff --git a/Task/Strip-control-codes-and-extended-characters-from-a-string/Peloton/strip-control-codes-and-extended-characters-from-a-string-2.peloton b/Task/Strip-control-codes-and-extended-characters-from-a-string/Peloton/strip-control-codes-and-extended-characters-from-a-string-2.peloton new file mode 100644 index 0000000000..d2b71f8c11 --- /dev/null +++ b/Task/Strip-control-codes-and-extended-characters-from-a-string/Peloton/strip-control-codes-and-extended-characters-from-a-string-2.peloton @@ -0,0 +1,5 @@ +Create variable with high and low ANSI: <@ SAYLETVARLIT>i|This string has both low ansi and high ansi characters - il doit d'être prévenu +Strip high ANSI <@ SAYSAHVAR>i +Assign infix <@ LETVARSAHVAR>j|i <@ SAYVAR>j +Assign prepend <@ LETSAHVARVAR>k|i <@ SAYVAR>k +Reflexive assign <@ ACTSAHVAR>i <@ SAYVAR>i diff --git a/Task/Strip-control-codes-and-extended-characters-from-a-string/Ring/strip-control-codes-and-extended-characters-from-a-string.ring b/Task/Strip-control-codes-and-extended-characters-from-a-string/Ring/strip-control-codes-and-extended-characters-from-a-string.ring new file mode 100644 index 0000000000..70987b25aa --- /dev/null +++ b/Task/Strip-control-codes-and-extended-characters-from-a-string/Ring/strip-control-codes-and-extended-characters-from-a-string.ring @@ -0,0 +1,12 @@ +s = char(31) + "abc" + char(13) + "def" + char(11) + "ghi" + char(10) +see strip(s) + nl + +func strip str +strip = "" +for i = 1 to len(str) + nr = substr(str,i,1) + a = ascii(nr) + if a > 31 and a < 123 and nr != "'" and nr != """" + strip = strip + nr ok +next +return strip diff --git a/Task/Strip-control-codes-and-extended-characters-from-a-string/Sidef/strip-control-codes-and-extended-characters-from-a-string.sidef b/Task/Strip-control-codes-and-extended-characters-from-a-string/Sidef/strip-control-codes-and-extended-characters-from-a-string.sidef new file mode 100644 index 0000000000..9fba4dd0f0 --- /dev/null +++ b/Task/Strip-control-codes-and-extended-characters-from-a-string/Sidef/strip-control-codes-and-extended-characters-from-a-string.sidef @@ -0,0 +1,10 @@ +var str = "\ba\x00b\n\rc\fd\xc3\x7ffoo"; + +var letters = str.chars»ord»(); +say letters»chr»().join.dump; + +var nocontrols = letters.grep{ (_ > 32) && (_ != 127) }; +say nocontrols»chr»().join.dump; + +var noextended = nocontrols.grep{ _ < 127 }; +say noextended»chr»().join.dump; diff --git a/Task/Strip-control-codes-and-extended-characters-from-a-string/jq/strip-control-codes-and-extended-characters-from-a-string-1.jq b/Task/Strip-control-codes-and-extended-characters-from-a-string/jq/strip-control-codes-and-extended-characters-from-a-string-1.jq new file mode 100644 index 0000000000..e55eaf1545 --- /dev/null +++ b/Task/Strip-control-codes-and-extended-characters-from-a-string/jq/strip-control-codes-and-extended-characters-from-a-string-1.jq @@ -0,0 +1,5 @@ +def strip_control_codes: + explode | map(select(. > 31 and . != 127)) | implode; + +def strip_extended_characters: + explode | map(select(31 < . and . < 127)) | implode; diff --git a/Task/Strip-control-codes-and-extended-characters-from-a-string/jq/strip-control-codes-and-extended-characters-from-a-string-2.jq b/Task/Strip-control-codes-and-extended-characters-from-a-string/jq/strip-control-codes-and-extended-characters-from-a-string-2.jq new file mode 100644 index 0000000000..ed27f39878 --- /dev/null +++ b/Task/Strip-control-codes-and-extended-characters-from-a-string/jq/strip-control-codes-and-extended-characters-from-a-string-2.jq @@ -0,0 +1,4 @@ +def string: "string of ☺☻♥♦⌂, may include control characters such as null(\u0000) and other ilk.\n§►↔◄\nRødgrød med fløde"; + +"string | strip_control_codes\n => \(string | strip_control_codes)", +"string | strip_extended_characters\n => \(string | strip_extended_characters)" diff --git a/Task/Strip-control-codes-and-extended-characters-from-a-string/jq/strip-control-codes-and-extended-characters-from-a-string-3.jq b/Task/Strip-control-codes-and-extended-characters-from-a-string/jq/strip-control-codes-and-extended-characters-from-a-string-3.jq new file mode 100644 index 0000000000..ca97aec840 --- /dev/null +++ b/Task/Strip-control-codes-and-extended-characters-from-a-string/jq/strip-control-codes-and-extended-characters-from-a-string-3.jq @@ -0,0 +1,5 @@ +$ jq -n -r -f Strip_control_codes_and_extended_characters.jq +string | strip_control_codes + => string of ☺☻♥♦⌂, may include control characters such as null() and other ilk.§►↔◄Rødgrød med fløde +string | strip_extended_characters + => string of , may include control characters such as null() and other ilk.Rdgrd med flde diff --git a/Task/Strip-whitespace-from-a-string-Top-and-tail/EchoLisp/strip-whitespace-from-a-string-top-and-tail.echolisp b/Task/Strip-whitespace-from-a-string-Top-and-tail/EchoLisp/strip-whitespace-from-a-string-top-and-tail.echolisp new file mode 100644 index 0000000000..43f94dcb9b --- /dev/null +++ b/Task/Strip-whitespace-from-a-string-Top-and-tail/EchoLisp/strip-whitespace-from-a-string-top-and-tail.echolisp @@ -0,0 +1,8 @@ +(define witt + " The limits of my world are the limits of my langage. ") +(string->html (string-trim witt)) + → "The limits of my world are the limits of my langage." +(string->html (string-trim-left witt)) + → "The limits of my world are the limits of my langage. " +(string->html (string-trim-right witt)) + → " The limits of my world are the limits of my langage." diff --git a/Task/Strip-whitespace-from-a-string-Top-and-tail/FreeBASIC/strip-whitespace-from-a-string-top-and-tail.freebasic b/Task/Strip-whitespace-from-a-string-Top-and-tail/FreeBASIC/strip-whitespace-from-a-string-top-and-tail.freebasic new file mode 100644 index 0000000000..372cd1b995 --- /dev/null +++ b/Task/Strip-whitespace-from-a-string-Top-and-tail/FreeBASIC/strip-whitespace-from-a-string-top-and-tail.freebasic @@ -0,0 +1,24 @@ +' FB 1.05.0 Win64 + +Const whitespace = !" \t\n\v\f\r" + +Dim s As String = !" \tRosetta Code \v\f\r\n" +Dim s1 As String = LTrim (s, Any whitespace) +Dim s2 As String = RTrim (s, Any whitespace) +Dim s3 As String = Trim (s, Any whitespace) + +' Under Windows console : +' "vertical tab" displays as ♂ +' "form feed" displays as ♀ +' the other whitespace characters do what it says on the tin + +Print "Untrimmed" , "=> "; s +Print "Left Trimmed" , "=> "; s1 +Print "Right Trimmed" , "=> "; s2 +Print "Fully Trimmed" , "=> "; s3 +Print +Print "Untrimmed" , "=> Length = "; Len(s) +Print "Left trimmed" , "=> Length = "; Len(s1) +Print "Right trimmed" , "=> Length = "; Len(s2) +Print "Fully trimmed" , "=> Length = "; Len(s3) +Sleep diff --git a/Task/Strip-whitespace-from-a-string-Top-and-tail/Lasso/strip-whitespace-from-a-string-top-and-tail.lasso b/Task/Strip-whitespace-from-a-string-Top-and-tail/Lasso/strip-whitespace-from-a-string-top-and-tail.lasso new file mode 100644 index 0000000000..60623bb234 --- /dev/null +++ b/Task/Strip-whitespace-from-a-string-Top-and-tail/Lasso/strip-whitespace-from-a-string-top-and-tail.lasso @@ -0,0 +1,8 @@ +// String with leading whitespace removed +'>' + (' \t Hello')->trim& + '<' + +// String with trailing whitespace removed +'>' + ('Hello \t ')->trim& + '<' + +// String with both leading and trailing whitespace removed +'>' + (' \t Hello \t ')->trim& + '<' diff --git a/Task/Strip-whitespace-from-a-string-Top-and-tail/Nim/strip-whitespace-from-a-string-top-and-tail.nim b/Task/Strip-whitespace-from-a-string-Top-and-tail/Nim/strip-whitespace-from-a-string-top-and-tail.nim new file mode 100644 index 0000000000..95c8aeed31 --- /dev/null +++ b/Task/Strip-whitespace-from-a-string-Top-and-tail/Nim/strip-whitespace-from-a-string-top-and-tail.nim @@ -0,0 +1,7 @@ +import strutils + +let s = " \t \n String with spaces \t \n " +echo "'", s, "'" +echo "'", s.strip(trailing = false), "'" +echo "'", s.strip(leading = false), "'" +echo "'", s.strip(), "'" diff --git a/Task/Strip-whitespace-from-a-string-Top-and-tail/Phix/strip-whitespace-from-a-string-top-and-tail.phix b/Task/Strip-whitespace-from-a-string-Top-and-tail/Phix/strip-whitespace-from-a-string-top-and-tail.phix new file mode 100644 index 0000000000..1443109cb4 --- /dev/null +++ b/Task/Strip-whitespace-from-a-string-Top-and-tail/Phix/strip-whitespace-from-a-string-top-and-tail.phix @@ -0,0 +1,5 @@ +constant s = "\ttest\n" +?s +?trim_head(s) +?trim_tail(s) +?trim(s) diff --git a/Task/Strip-whitespace-from-a-string-Top-and-tail/Ring/strip-whitespace-from-a-string-top-and-tail.ring b/Task/Strip-whitespace-from-a-string-Top-and-tail/Ring/strip-whitespace-from-a-string-top-and-tail.ring new file mode 100644 index 0000000000..a390849485 --- /dev/null +++ b/Task/Strip-whitespace-from-a-string-Top-and-tail/Ring/strip-whitespace-from-a-string-top-and-tail.ring @@ -0,0 +1,3 @@ +aList = " Welcome to the Ring Programming Language " +see aList + nl +see trim(aList) + nl diff --git a/Task/Strip-whitespace-from-a-string-Top-and-tail/Sidef/strip-whitespace-from-a-string-top-and-tail.sidef b/Task/Strip-whitespace-from-a-string-Top-and-tail/Sidef/strip-whitespace-from-a-string-top-and-tail.sidef new file mode 100644 index 0000000000..65ca2a7810 --- /dev/null +++ b/Task/Strip-whitespace-from-a-string-Top-and-tail/Sidef/strip-whitespace-from-a-string-top-and-tail.sidef @@ -0,0 +1,4 @@ +var s = " \t\v\r\n\ffoo bar \t\v\r\n\f"; +say s.strip_beg.dump; # remove leading whitespaces +say s.strip_end.dump; # remove trailing whitespaces +say s.strip.dump; # remove both leading and trailing whitespace diff --git a/Task/Strip-whitespace-from-a-string-Top-and-tail/jq/strip-whitespace-from-a-string-top-and-tail-1.jq b/Task/Strip-whitespace-from-a-string-Top-and-tail/jq/strip-whitespace-from-a-string-top-and-tail-1.jq new file mode 100644 index 0000000000..29d2ff2681 --- /dev/null +++ b/Task/Strip-whitespace-from-a-string-Top-and-tail/jq/strip-whitespace-from-a-string-top-and-tail-1.jq @@ -0,0 +1,5 @@ +def lstrip: sub( "^[\\s\\p{Cc}]+"; "" ); + +def rstrip: sub( "[\\s\\p{Cc}]+$"; "" ); + +def strip: lstrip | rstrip; diff --git a/Task/Strip-whitespace-from-a-string-Top-and-tail/jq/strip-whitespace-from-a-string-top-and-tail-2.jq b/Task/Strip-whitespace-from-a-string-Top-and-tail/jq/strip-whitespace-from-a-string-top-and-tail-2.jq new file mode 100644 index 0000000000..ff4bc279b7 --- /dev/null +++ b/Task/Strip-whitespace-from-a-string-Top-and-tail/jq/strip-whitespace-from-a-string-top-and-tail-2.jq @@ -0,0 +1,9 @@ +def demo: + "lstrip: \(lstrip)", + "rstrip: \(rstrip)", + "strip: \(strip)" ; + +(" \t \r \n String with spaces \t \r \n ", + "� <- control A", + "\u0001 \u0002 <- ^A ^B" +) | demo diff --git a/Task/Strip-whitespace-from-a-string-Top-and-tail/jq/strip-whitespace-from-a-string-top-and-tail-3.jq b/Task/Strip-whitespace-from-a-string-Top-and-tail/jq/strip-whitespace-from-a-string-top-and-tail-3.jq new file mode 100644 index 0000000000..06244cda8b --- /dev/null +++ b/Task/Strip-whitespace-from-a-string-Top-and-tail/jq/strip-whitespace-from-a-string-top-and-tail-3.jq @@ -0,0 +1,9 @@ +$ jq -n -f Strip_whitespace_top_tail.jq +"lstrip: String with spaces \t \r \n " +"rstrip: \t \r \n String with spaces" +"strip: String with spaces" +"rstrip: \u0001 <- control A" +"strip: <- control A" +"lstrip: <- ^A ^B" +"rstrip: \u0001 \u0002 <- ^A ^B" +"strip: <- ^A ^B" diff --git a/Task/Substring-Top-and-tail/Apex/substring-top-and-tail.apex b/Task/Substring-Top-and-tail/Apex/substring-top-and-tail.apex new file mode 100644 index 0000000000..59e9b420ba --- /dev/null +++ b/Task/Substring-Top-and-tail/Apex/substring-top-and-tail.apex @@ -0,0 +1,16 @@ +String strOrig = 'brooms'; +String str1 = strOrig.substring(1, strOrig.length()); +system.debug(str1); +String str2 = strOrig.substring(0, strOrig.length()-1); +system.debug(str2); +String str3 = strOrig.substring(1, strOrig.length()-1); +system.debug(str3); + +// Regular Expressions approach +String strOrig = 'brooms'; +String str1 = strOrig.replaceAll( '^.', '' ); +system.debug(str1); +String str2 = strOrig.replaceAll( '.$', '' ) ; +system.debug(str2); +String str3 = strOrig.replaceAll( '^.|.$', '' ); +system.debug(str3); diff --git a/Task/Substring-Top-and-tail/Eero/substring-top-and-tail.eero b/Task/Substring-Top-and-tail/Eero/substring-top-and-tail.eero new file mode 100644 index 0000000000..a4a403ce4f --- /dev/null +++ b/Task/Substring-Top-and-tail/Eero/substring-top-and-tail.eero @@ -0,0 +1,18 @@ +#import + +int main() + autoreleasepool + + s := 'knight' + Log( '%@', s[1 .. s.length-1] ) // strip first character + + s = 'socks' + Log( '%@', s[0 .. s.length-2] ) // strip last character + + s = 'brooms' + Log( '%@', s[1 .. s.length-2] ) // strip both first and last characters + + s = 'Δημοτική' + Log( '%@', s[1 .. s.length-2] ) // strip both first and last characters + + return 0 diff --git a/Task/Substring-Top-and-tail/FreeBASIC/substring-top-and-tail.freebasic b/Task/Substring-Top-and-tail/FreeBASIC/substring-top-and-tail.freebasic new file mode 100644 index 0000000000..b4a18839a7 --- /dev/null +++ b/Task/Substring-Top-and-tail/FreeBASIC/substring-top-and-tail.freebasic @@ -0,0 +1,11 @@ +' FB 1.05.0 Win64 + +Dim s As String = "panda" +Dim s1 As String = Mid(s, 2) +Dim s2 As String = Left(s, Len(s) - 1) +Dim s3 As String = Mid(s, 2, Len(s) - 2) +Print s +Print s1 +Print s2 +Print s3 +Sleep diff --git a/Task/Substring-Top-and-tail/Lasso/substring-top-and-tail-1.lasso b/Task/Substring-Top-and-tail/Lasso/substring-top-and-tail-1.lasso new file mode 100644 index 0000000000..ae9cec9766 --- /dev/null +++ b/Task/Substring-Top-and-tail/Lasso/substring-top-and-tail-1.lasso @@ -0,0 +1,10 @@ +local(str = 'The quick grey rhino jumped over the lazy green fox.') + +// String with first character removed +string_remove(#str,-startposition=1,-endposition=1) + +// String with last character removed +string_remove(#str,-startposition=#str->size,-endposition=#str->size) + +// String with both the first and last characters removed +string_remove(string_remove(#str,-startposition=#str->size,-endposition=#str->size),-startposition=1,-endposition=1) diff --git a/Task/Substring-Top-and-tail/Lasso/substring-top-and-tail-2.lasso b/Task/Substring-Top-and-tail/Lasso/substring-top-and-tail-2.lasso new file mode 100644 index 0000000000..77850601dc --- /dev/null +++ b/Task/Substring-Top-and-tail/Lasso/substring-top-and-tail-2.lasso @@ -0,0 +1,10 @@ +local(mystring = 'ÅÜÄÖカ') + +#mystring -> remove(1,1) +#mystring +'
' +#mystring -> remove(#mystring -> size,1) +#mystring +'
' +#mystring -> remove(1,1)& -> remove(#mystring -> size,1) +#mystring diff --git a/Task/Substring-Top-and-tail/Lasso/substring-top-and-tail.lasso b/Task/Substring-Top-and-tail/Lasso/substring-top-and-tail.lasso new file mode 100644 index 0000000000..14fb1abb7e --- /dev/null +++ b/Task/Substring-Top-and-tail/Lasso/substring-top-and-tail.lasso @@ -0,0 +1,13 @@ +local(str = 'The quick grey rhino jumped over the lazy green fox.') + +// String with first character removed +string_remove(#str,-startposition=1,-endposition=1) +// > he quick grey rhino jumped over the lazy green fox. + +// String with last character removed +string_remove(#str,-startposition=#str->size,-endposition=#str->size) +// > The quick grey rhino jumped over the lazy green fox + +// String with both the first and last characters removed +string_remove(string_remove(#str,-startposition=#str->size,-endposition=#str->size),-startposition=1,-endposition=1) +// > he quick grey rhino jumped over the lazy green fox diff --git a/Task/Substring-Top-and-tail/LiveCode/substring-top-and-tail.livecode b/Task/Substring-Top-and-tail/LiveCode/substring-top-and-tail.livecode new file mode 100644 index 0000000000..332f36d7b9 --- /dev/null +++ b/Task/Substring-Top-and-tail/LiveCode/substring-top-and-tail.livecode @@ -0,0 +1,4 @@ +put "pple" into x +answer char 2 to len(x) of x // pple +answer char 1 to -2 of x // ppl +answer char 2 to -2 of x // ppl diff --git a/Task/Substring-Top-and-tail/Nim/substring-top-and-tail.nim b/Task/Substring-Top-and-tail/Nim/substring-top-and-tail.nim new file mode 100644 index 0000000000..a4673a35d3 --- /dev/null +++ b/Task/Substring-Top-and-tail/Nim/substring-top-and-tail.nim @@ -0,0 +1,6 @@ +var s = "The quick μ brown fox" +echo(s.substr(1)) +echo(s.substr(0,s.len-2)) +echo(s.substr(1,s.len-2)) +# using slices +echo(s[1 .. -2]) diff --git a/Task/Substring-Top-and-tail/Oforth/substring-top-and-tail.oforth b/Task/Substring-Top-and-tail/Oforth/substring-top-and-tail.oforth new file mode 100644 index 0000000000..233dd32d9a --- /dev/null +++ b/Task/Substring-Top-and-tail/Oforth/substring-top-and-tail.oforth @@ -0,0 +1,4 @@ +: topAndTail(s) + s right(s size 1-) println + s left(s size 1-) println + s extract(2, s size 1- ) println ; diff --git a/Task/Substring-Top-and-tail/Phix/substring-top-and-tail.phix b/Task/Substring-Top-and-tail/Phix/substring-top-and-tail.phix new file mode 100644 index 0000000000..d60411a8b2 --- /dev/null +++ b/Task/Substring-Top-and-tail/Phix/substring-top-and-tail.phix @@ -0,0 +1,4 @@ +constant s = "(test)" +?s[2..-1] +?s[1..-2] +?s[2..-2] diff --git a/Task/Substring-Top-and-tail/Ring/substring-top-and-tail.ring b/Task/Substring-Top-and-tail/Ring/substring-top-and-tail.ring new file mode 100644 index 0000000000..d2f4dc8b5b --- /dev/null +++ b/Task/Substring-Top-and-tail/Ring/substring-top-and-tail.ring @@ -0,0 +1,4 @@ +aString = "1Welcome to the Ring Programming Language2" +see substr(aString,2,len(aString)-1) + nl + +substr(aString,1,len(aString)-1) + nl + +substr(aString,2,len(aString)-2) + nl diff --git a/Task/Substring-Top-and-tail/Sidef/substring-top-and-tail-1.sidef b/Task/Substring-Top-and-tail/Sidef/substring-top-and-tail-1.sidef new file mode 100644 index 0000000000..57d988c094 --- /dev/null +++ b/Task/Substring-Top-and-tail/Sidef/substring-top-and-tail-1.sidef @@ -0,0 +1,4 @@ +say "knight".substr(1); # strip first character +say "socks".substr(0, -1); # strip last character +say "brooms".substr(1, -1); # strip both first and last characters +say "与今令".substr(1, -1); # => 今 diff --git a/Task/Substring-Top-and-tail/Sidef/substring-top-and-tail-2.sidef b/Task/Substring-Top-and-tail/Sidef/substring-top-and-tail-2.sidef new file mode 100644 index 0000000000..166a97c0e5 --- /dev/null +++ b/Task/Substring-Top-and-tail/Sidef/substring-top-and-tail-2.sidef @@ -0,0 +1,4 @@ +var gstr = "J\x{332}o\x{332}s\x{332}e\x{301}\x{332}"; +say gstr-/^\X/; # strip first grapheme +say gstr-/\X\z/; # strip last grapheme +say gstr.sub(/^\X/).sub(/\X\z/); # strip both first and last graphemes diff --git a/Task/Substring-Top-and-tail/Swift/substring-top-and-tail-1.swift b/Task/Substring-Top-and-tail/Swift/substring-top-and-tail-1.swift new file mode 100644 index 0000000000..17b53ddd96 --- /dev/null +++ b/Task/Substring-Top-and-tail/Swift/substring-top-and-tail-1.swift @@ -0,0 +1,4 @@ +let txt = "0123456789" +println(dropFirst(txt)) +println(dropLast(txt)) +println(dropFirst(dropLast(txt))) diff --git a/Task/Substring-Top-and-tail/Swift/substring-top-and-tail-2.swift b/Task/Substring-Top-and-tail/Swift/substring-top-and-tail-2.swift new file mode 100644 index 0000000000..8f9482a6df --- /dev/null +++ b/Task/Substring-Top-and-tail/Swift/substring-top-and-tail-2.swift @@ -0,0 +1,4 @@ +let txt = "0123456789" +println(txt[txt.startIndex.successor() ..< txt.endIndex]) +println(txt[txt.startIndex ..< txt.endIndex.predecessor()]) +println(txt[txt.startIndex.successor() ..< txt.endIndex.predecessor()]) diff --git a/Task/Substring-Top-and-tail/Swift/substring-top-and-tail-3.swift b/Task/Substring-Top-and-tail/Swift/substring-top-and-tail-3.swift new file mode 100644 index 0000000000..abd2f87e6e --- /dev/null +++ b/Task/Substring-Top-and-tail/Swift/substring-top-and-tail-3.swift @@ -0,0 +1,3 @@ +var txt = "0123456789" +txt.removeAtIndex(txt.startIndex) +txt.removeAtIndex(txt.endIndex.predecessor()) diff --git a/Task/Substring-Top-and-tail/Swift/substring-top-and-tail-4.swift b/Task/Substring-Top-and-tail/Swift/substring-top-and-tail-4.swift new file mode 100644 index 0000000000..55fe02abd4 --- /dev/null +++ b/Task/Substring-Top-and-tail/Swift/substring-top-and-tail-4.swift @@ -0,0 +1,55 @@ +extension String { + + /// Ensure positive indexes + + private func positive(index: Int) -> Int { + + if index >= 0 { return index } + + return count(self) + index + } + + /// Unicode character by zero-based integer (character) `index` + /// Supports negative character index to count from end. (-1 returns character before last) + + subscript(index: Int) -> Character { + + return self[advance(startIndex, positive(index))] + } + + /// String slice by character index + + subscript(range: Range) -> String { + + return self[advance(startIndex, range.startIndex) ..< + advance(startIndex, range.endIndex, endIndex)] + } + + /// Left portion of text to `index` + + func left(index : Int) -> String { + + return self[0 ..< positive(index)] + } + + /// Right portion of text from `index` + + func right(index : Int) -> String{ + + return self[positive(index) ..< count(self)] + } + + /// From `start` index until `end` index + + func mid(start: Int, _ end: Int) -> String { + + return self[positive(start) ..< positive(end)] + } + +} + +let txt = "0123456789" + +txt.right(1) // Right part without first character +txt.left(-1) // Left part without last character +txt.mid(1,-1) // Middle part without first and last character diff --git a/Task/Substring-Top-and-tail/jq/substring-top-and-tail-1.jq b/Task/Substring-Top-and-tail/jq/substring-top-and-tail-1.jq new file mode 100644 index 0000000000..a0fdfd783f --- /dev/null +++ b/Task/Substring-Top-and-tail/jq/substring-top-and-tail-1.jq @@ -0,0 +1,7 @@ +"一二三四五六七八九十"[1:]' => "二三四五六七八九十" + +"一二三四五六七八九十"[:-1]' => "一二三四五六七八九" + +"一二三四五六七八九十"[1:-1]' => "二三四五六七八九" + +"a"[1:-1] # => "" diff --git a/Task/Substring-Top-and-tail/jq/substring-top-and-tail-2.jq b/Task/Substring-Top-and-tail/jq/substring-top-and-tail-2.jq new file mode 100644 index 0000000000..ee7314a4fb --- /dev/null +++ b/Task/Substring-Top-and-tail/jq/substring-top-and-tail-2.jq @@ -0,0 +1 @@ +"abc" | capture( ".(?.*)." ).monkey => "b" diff --git a/Task/Substring/Apex/substring.apex b/Task/Substring/Apex/substring.apex new file mode 100644 index 0000000000..afd0b2da25 --- /dev/null +++ b/Task/Substring/Apex/substring.apex @@ -0,0 +1,15 @@ +String x = 'testing123'; +//Test1: testing123 +System.debug('Test1: ' + x.substring(0,x.length())); +//Test2: esting123 +System.debug('Test2: ' + x.substring(1,x.length())); +//Test3: testing123 +System.debug('Test3: ' + x.substring(0)); +//Test4: 3 +System.debug('Test4: ' + x.substring(x.length()-1)); +//Test5: +System.debug('Test5: ' + x.substring(1,1)); +//Test 6: testing123 +System.debug('Test6: ' + x.substring(x.indexOf('testing'))); +//Test7: e +System.debug('Test7: ' + x.substring(1,2)); diff --git a/Task/Substring/Axe/substring.axe b/Task/Substring/Axe/substring.axe new file mode 100644 index 0000000000..8f66d8d0ac --- /dev/null +++ b/Task/Substring/Axe/substring.axe @@ -0,0 +1,19 @@ +Lbl SUB1 +0→{r₁+r₂+r₃} +r₁+r₂ +Return + +Lbl SUB2 +r₁+r₂ +Return + +Lbl SUB3 +0→{r₁+length(r₁)-1} +r₁ +Return + +Lbl SUB4 +inData(r₂,r₁)-1→I +0→{r₁+I+r₃} +r₁+I +Return diff --git a/Task/Substring/ECL/substring.ecl b/Task/Substring/ECL/substring.ecl new file mode 100644 index 0000000000..23c5fbb0d8 --- /dev/null +++ b/Task/Substring/ECL/substring.ecl @@ -0,0 +1,32 @@ +/* In this task display a substring: + +1. starting from n characters in and of m length; +2. starting from n characters in, up to the end of the string; +3. whole string minus last character; +4. starting from a known character within the string and of m length; +5. starting from a known substring within the string and of m length. +*/ + +IMPORT STD; //imports a standard string library + +TheString := 'abcdefghij'; +CharIn := 3; //n +StrLength := 4; //m +KnownChar := 'f'; +KnownSub := 'def'; +FindKnownChar := STD.Str.Find(TheString, KnownChar,1); +FindKnownSub := STD.Str.Find(TheString, KnownSub,1); + +OUTPUT(TheString[Charin..CharIn+StrLength-1]); //task1 +OUTPUT(TheString[Charin..]); //task2 +OUTPUT(TheString[1..LENGTH(TheString)-1]); //task3 +OUTPUT(TheString[FindKnownChar..FindKnownChar+StrLength-1]);//task4 +OUTPUT(TheString[FindKnownSub..FindKnownSub+StrLength-1]); //task5 + +/* OUTPUTS: + defg + cdefghij + abcdefghi + fghi + defg +*/ diff --git a/Task/Substring/Eero/substring.eero b/Task/Substring/Eero/substring.eero new file mode 100644 index 0000000000..bf0b5bdf4f --- /dev/null +++ b/Task/Substring/Eero/substring.eero @@ -0,0 +1,13 @@ +#import + +int main() + autoreleasepool + str := 'abcdefgh' + n := 2 + m := 3 + Log( '%@', str[0 .. str.length-1] ) // abcdefgh + Log( '%@', str[n .. m] ) // cd + Log( '%@', str[n .. str.length-1] ) // cdefgh + Log( '%@', str.substringFromIndex: n ) // cdefgh + Log( '%@', str[(str.rangeOfString:'b').location .. m] ) // bcd + return 0 diff --git a/Task/Substring/FreeBASIC/substring.freebasic b/Task/Substring/FreeBASIC/substring.freebasic new file mode 100644 index 0000000000..4b6ce60145 --- /dev/null +++ b/Task/Substring/FreeBASIC/substring.freebasic @@ -0,0 +1,12 @@ +' FB 1.05.0 Win64 + +Dim s As String = "123456789" +Dim As Integer n = 3, m = 4 +Print Mid(s, n, m) +Print Mid(s, n) +Print Left(s, Len(s) - 1) +'start from "5" say +Print Mid(s, Instr(s, "5"), m) +' start from "12" say +Print Mid(s, Instr(s, "12"), m) +Sleep diff --git a/Task/Substring/LFE/substring.lfe b/Task/Substring/LFE/substring.lfe new file mode 100644 index 0000000000..03719096a7 --- /dev/null +++ b/Task/Substring/LFE/substring.lfe @@ -0,0 +1,18 @@ +> (set n 3) +3 +> (set m 5) +5 +> (string:sub_string "abcdefghijklm" n) +"cdefghijklm" +> (string:sub_string "abcdefghijklm" n (+ n m -1)) +"cdefg" +> (string:sub_string "abcdefghijklm" 1 (- (length "abcdefghijklm") 1)) +"abcdefghijkl" +> (set char-index (string:chr "abcdefghijklm" #\e)) +5 +> (string:sub_string "abcdefghijklm" char-index (+ char-index m -1)) +"efghi" +> (set start-str (string:str "abcdefghijklm" "efg")) +5 +> (string:sub_string "abcdefghijklm" start-str (+ start-str m -1)) +"efghi" diff --git a/Task/Substring/Lasso/substring.lasso b/Task/Substring/Lasso/substring.lasso new file mode 100644 index 0000000000..03295a4173 --- /dev/null +++ b/Task/Substring/Lasso/substring.lasso @@ -0,0 +1,16 @@ +local(str = 'The quick grey rhino jumped over the lazy green fox.') + +//starting from n characters in and of m length; +#str->substring(16,5) //rhino + +//starting from n characters in, up to the end of the string +#str->substring(16) //rhino jumped over the lazy green fox. + +//whole string minus last character +#str->substring(1,#str->size - 1) //The quick grey rhino jumped over the lazy green fox + +//starting from a known character within the string and of m length; +#str->substring(#str->find('g'),10) //grey rhino + +//starting from a known substring within the string and of m length +#str->substring(#str->find('rhino'),12) //rhino jumped diff --git a/Task/Substring/Lingo/substring.lingo b/Task/Substring/Lingo/substring.lingo new file mode 100644 index 0000000000..228f0474bc --- /dev/null +++ b/Task/Substring/Lingo/substring.lingo @@ -0,0 +1,30 @@ +str = "The quick brown fox jumps over the lazy dog" + +-- starting from n characters in and of m length +n = 5 +m = 11 +put str.char[n..n+m-1] +-- "quick brown" + +-- starting from n characters in, up to the end of the string +n = 11 +put str.char[n..str.length] +-- "brown fox jumps over the lazy dog" + +-- whole string minus last character +put str.char[1..str.length-1] +-- "The quick brown fox jumps over the lazy do" + +-- starting from a known character within the string and of m length +c = "x" +m = 7 +pos = offset(c, str) +put str.char[pos..pos+m-1] +-- "x jumps" + +-- starting from a known substring within the string and of m length +sub = "fox" +m = 9 +pos = offset(sub, str) +put str.char[pos..pos+m-1] +-- "fox jumps" diff --git a/Task/Substring/LiveCode/substring.livecode b/Task/Substring/LiveCode/substring.livecode new file mode 100644 index 0000000000..3ea7d11d99 --- /dev/null +++ b/Task/Substring/LiveCode/substring.livecode @@ -0,0 +1,6 @@ +put "pple" into x +answer char 2 to char 5 of x // n = 2, m=5 +answer char 2 to len(x) of x // n = 2, m = len(x), can also use -1 +answer char 1 to -2 of x // n = 1, m = 1 less than length of string +answer char offset("p",x) to -1 of x // known char "p" to end of string +answer char offset("pl",x) to -1 of x // known "pl" to end of string diff --git a/Task/Substring/Nim/substring.nim b/Task/Substring/Nim/substring.nim new file mode 100644 index 0000000000..0ce656e1db --- /dev/null +++ b/Task/Substring/Nim/substring.nim @@ -0,0 +1,26 @@ +import strutils + +let + s = "abcdefgh" + n = 2 + m = 3 + c = 'd' + cs = "cd" +var i = 0 + +# starting from n=2 characters in and m=3 in length +echo s[n-1 .. n+m-2] + +# starting from n characters in, up to the end of the string +echo s[n-1 .. s.high] + +# whole string minus last character: +echo s[0 .. 0 then + ?sentence[1..-2] -- (3) or [1..$-1] +end if +k = find('m',sentence) +l = k+m-1 +if l<=length(sentence) then + ?sentence[k..l] -- (4) +end if +k = match("aid",sentence) +l = k+m-1 +if l<=length(sentence) then + ?sentence[k..l] -- (5) +end if diff --git a/Task/Substring/Phix/substring-2.phix b/Task/Substring/Phix/substring-2.phix new file mode 100644 index 0000000000..d5d4e8c44d --- /dev/null +++ b/Task/Substring/Phix/substring-2.phix @@ -0,0 +1,5 @@ +?sentence[n..n+m-1] +?sentence[n..-1] +?sentence[1..-2] +?(sentence[find('m',sentence)..$])[1..m] +?(sentence[match("aid",sentence)..$])[1..m] diff --git a/Task/Substring/Ring/substring.ring b/Task/Substring/Ring/substring.ring new file mode 100644 index 0000000000..3415c52da8 --- /dev/null +++ b/Task/Substring/Ring/substring.ring @@ -0,0 +1,12 @@ +cStr = "a":"h" # 'abcdefgh' +n = 3 m = 3 +# starting from n characters in and of m length +See substr(cStr,n, m) + nl #=> cde +# starting from n characters in, up to the end of the string +See substr(cStr,n) + nl #=> cdefgh +# whole string minus last character +See substr(cstr,1,len(cStr)-1) + nl #=> abcdefg +# starting from a known character within the string and of m length +See substr(cStr,substr(cStr,"e"),m) +nl #=> efg +# starting from a known substring within the string and of m length +See substr(cStr,substr(cStr,"de"),m) +nl #=> def diff --git a/Task/Substring/Sidef/substring.sidef b/Task/Substring/Sidef/substring.sidef new file mode 100644 index 0000000000..710e4ee11f --- /dev/null +++ b/Task/Substring/Sidef/substring.sidef @@ -0,0 +1,8 @@ +var str = 'abcdefgh'; +var n = 2; +var m = 3; +say str.substr(n, m); #=> cde +say str.substr(n); #=> cdefgh +say str.substr(0, -1); #=> abcdefg +say str.substr(str.index('d'), m); #=> def +say str.substr(str.index('de'), m); #=> def diff --git a/Task/Substring/Swift/substring.swift b/Task/Substring/Swift/substring.swift new file mode 100644 index 0000000000..beddc6206b --- /dev/null +++ b/Task/Substring/Swift/substring.swift @@ -0,0 +1,57 @@ +let string = "Hello, Swift language" +let (n, m) = (5, 4) + +// Starting from `n` characters in and of `m` length. +do { + let start = string.startIndex.advancedBy(n) + let end = start.advancedBy(m) + // Pure-Swift (standard library only): + _ = string[start.. "a" + +# starting from n characters in and of m length; +def (substr s start len) + (s start start+len) +(substr s 3 2) +=> "de" + +# starting from n characters in, up to the end of the string +(s 3 nil) +=> "defgh" + +# whole string minus last character; +(s 3 -1) +=> "defg" + +# starting from a known character within the string and of m length; +# starting from a known substring within the string and of m length. +let start (pos s pat) + (s start start+m) diff --git a/Task/Substring/jq/substring-1.jq b/Task/Substring/jq/substring-1.jq new file mode 100644 index 0000000000..d46efa8293 --- /dev/null +++ b/Task/Substring/jq/substring-1.jq @@ -0,0 +1 @@ +def s: "一二三四五六七八九十"; diff --git a/Task/Substring/jq/substring-2.jq b/Task/Substring/jq/substring-2.jq new file mode 100644 index 0000000000..ee79dc2d63 --- /dev/null +++ b/Task/Substring/jq/substring-2.jq @@ -0,0 +1 @@ +def ix(s): explode | index(s|explode); diff --git a/Task/Substring/jq/substring-3.jq b/Task/Substring/jq/substring-3.jq new file mode 100644 index 0000000000..ca624dad2b --- /dev/null +++ b/Task/Substring/jq/substring-3.jq @@ -0,0 +1,20 @@ +# starting from n characters in and of m length: .[n+1: n+m+1] +"s[1:2] => \( s[1:2] )", + +# starting from n characters in, up to the end of the string: .[n+1:] +"s[9:] => \( s[9:] )", + +# whole string minus last character: .[0:length-1] +"s|.[0:length-1] => \(s | .[0:length-1] )", + +# starting from a known character within the string and of m length: + # jq 1.4: ix(c) as $i | .[ $i: $i + m] + # jq>1.4: match(c).offset as $i | .[ $i: $i + m] +"s | ix(\"五\") as $i | .[$i: $i + 1] => \(s | ix("五") as $i | .[$i: $i + 1] )", + + +# starting from a known substring within the string and of m length: + # jq 1.4: ix(sub) as $i | .[ $i: $i + m] + # jq>1.4: match(sub).offset as $i | .[ $i: $i + m] +"s | ix(\"五六\") as $i | .[$i: $i + 2] => " + + "\( s | ix("五六") as $i | .[$i: $i + 2] )" diff --git a/Task/Substring/jq/substring-4.jq b/Task/Substring/jq/substring-4.jq new file mode 100644 index 0000000000..7fa8437b0c --- /dev/null +++ b/Task/Substring/jq/substring-4.jq @@ -0,0 +1,6 @@ +$ jq -M -n -r -f Substring.jq +s[1:2] => 二 +s[9:] => 十 +s|.[0:length-1] => 一二三四五六七八九 +s | ix("五") as $i | .[$i: $i + 1] => 五 +s | ix("五六") as $i | .[$i: $i + 2] => 五六 diff --git a/Task/Subtractive-generator/Sidef/subtractive-generator.sidef b/Task/Subtractive-generator/Sidef/subtractive-generator.sidef new file mode 100644 index 0000000000..a90d1b6dba --- /dev/null +++ b/Task/Subtractive-generator/Sidef/subtractive-generator.sidef @@ -0,0 +1,22 @@ +class SubRandom(seed, state=[]) { + + const mod = 1_000_000_000; + + method init { + var s = [seed % mod, 1]; + 53.times { + s.append((s[-2] - s[-1]) % mod); + } + state = s.range.map {|i| s[(34 + 34*i) % 55] }; + range(55, 219).each { self.subrand }; + } + + method subrand { + var x = ((state.shift - state[-24]) % mod); + state.append(x); + return x; + } +} + +var r = SubRandom(292929); +10.times { say r.subrand }; diff --git a/Task/Sudoku/ERRE/sudoku.erre b/Task/Sudoku/ERRE/sudoku.erre new file mode 100644 index 0000000000..fba15c5e4b --- /dev/null +++ b/Task/Sudoku/ERRE/sudoku.erre @@ -0,0 +1,404 @@ +!-------------------------------------------------------------------- +! risolve Sudoku: in input il file SUDOKU.TXT +! Metodo seguito : cancellazioni successive e quando non possibile +! ricerca combinatoria sulle celle con due valori +! possibili - max. 30 livelli di ricorsione +! Non risolve se,dopo l'analisi per la cancellazione, +! restano solo celle a 4 valori +!-------------------------------------------------------------------- + +PROGRAM SUDOKU + +LABEL 76,77,88,91,97,99 + +DIM TAV$[9,9] ! 81 caselle in nove quadranti + ! cella non definita --> 0/. nel file SUDOKU.TXT + ! diventa 123456789 dopo LEGGI_SCHEMA + +!--------------------------------------------------------------------------- +! tabelle per gestire la ricerca combinatoria +! (primo indice--> livelli ricorsione) +!--------------------------------------------------------------------------- +DIM TAV2$[30,9,9],INFO[30,4] + +!$INCLUDE="PC.LIB" + +PROCEDURE MESSAGGI(MEX%) + CASE MEX% OF + 1-> LOCATE(21,1) PRINT("Cancellazione successiva - liv. 1") END -> + 2-> LOCATE(21,1) PRINT("Cancellazione successiva - liv. 2") END -> + 3-> LOCATE(22,1) PRINT("Ricerca combinatoria - liv.";LIVELLO;" ") END -> + END CASE +END PROCEDURE + +PROCEDURE VISUALIZZA_SCHEMA + LOCATE(1,1) + PRINT("+---+---+---+---+---+---+---+---+----+") + FOR I=1 TO 9 DO + FOR J=1 TO 9 DO + PRINT("|";) + IF LEN(TAV$[I,J])=1 THEN + PRINT(" ";TAV$[I,J];" ";) + ELSE + PRINT(" ";) + END IF + END FOR + PRINT("³") + IF I<>9 THEN PRINT("+---+---+---+---+---+---+---+---+----+") END IF + END FOR + PRINT("+---+---+---+---+---+---+---+---+----+") +END PROCEDURE + +!------------------------------------------------------------------------ +! in input la cella (riga,colonna) +! in output se ha un valore definito +!------------------------------------------------------------------------ +PROCEDURE VALORE_DEFINITO + FLAG%=FALSE + IF LEN(TAV$[RIGA,COLONNA])=1 THEN FLAG%=TRUE END IF +END PROCEDURE + + +PROCEDURE SALVA_CONFIG + LIVELLO=LIVELLO+1 + FOR R=1 TO 9 DO + FOR S=1 TO 9 DO + TAV2$[LIVELLO,R,S]=TAV$[R,S] + END FOR + END FOR + INFO[LIVELLO,0]=1 INFO[LIVELLO,1]=RIGA INFO[LIVELLO,2]=COLONNA + INFO[LIVELLO,3]=SECOND INFO[LIVELLO,4]=THIRD +END PROCEDURE + +PROCEDURE RIPRISTINA_CONFIG +91: + LIVELLO=LIVELLO-1 + IF INFO[LIVELLO,0]=3 THEN GOTO 91 END IF + FOR R=1 TO 9 DO + FOR S=1 TO 9 DO + TAV$[R,S]=TAV2$[LIVELLO,R,S] + END FOR + END FOR + RIGA=INFO[LIVELLO,1] COLONNA=INFO[LIVELLO,2] + SECOND=INFO[LIVELLO,3] THIRD=INFO[LIVELLO,4] + IF INFO[LIVELLO,0]=1 THEN + TAV$[RIGA,COLONNA]=MID$(STR$(SECOND),2) + END IF + IF INFO[LIVELLO,0]=2 THEN + IF THIRD<>0 THEN + TAV$[RIGA,COLONNA]=MID$(STR$(THIRD),2) + ELSE + GOTO 91 + END IF + END IF + INFO[LIVELLO,0]=INFO[LIVELLO,0]+1 + VISUALIZZA_SCHEMA +END PROCEDURE + +PROCEDURE VERIFICA_SE_FINITO + COMPLETO%=TRUE + FOR RIGA=1 TO 9 DO + PRD#=1 + FOR COLONNA=1 TO 9 DO + PRD#=PRD#*VAL(TAV$[RIGA,COLONNA]) + END FOR + IF PRD#<>362880 THEN COMPLETO%=FALSE EXIT END IF + END FOR + IF NOT COMPLETO% THEN EXIT PROCEDURE END IF + FOR COLONNA=1 TO 9 DO + PRD#=1 + FOR RIGA=1 TO 9 DO + PRD#=PRD#*VAL(TAV$[RIGA,COLONNA]) + END FOR + IF PRD#<>362880 THEN COMPLETO%=FALSE EXIT END IF + END FOR +END PROCEDURE + +!------------------------------------------------------------------- +! toglie i valore certi dalle celle sulla +! stessa riga-stessa colonna-stesso quadrante +!------------------------------------------------------------------- +PROCEDURE TOGLI_VALORE + +!iniziamo a togliere il valore dalla stessa riga .... + FOR J=1 TO 9 DO + CH$=TAV$[RIGA,J] CH=VAL(Z$) + IF LEN(CH$)<>1 THEN + CHANGE(CH$,CH,"-"->CH$) + TAV$[RIGA,J]=CH$ + END IF + END FOR +!... iniziamo a togliere il valore dalla stessa colonna ... + FOR I=1 TO 9 DO + CH$=TAV$[I,COLONNA] CH=VAL(Z$) + IF LEN(CH$)<>1 THEN + CHANGE(CH$,CH,"-"->CH$) + TAV$[I,COLONNA]=CH$ + END IF + END FOR +!... iniziamo a togliere il valore dallo stesso quadrante + R=INT(RIGA/3.1)*3+1 + S=INT(COLONNA/3.1)*3+1 + FOR I=R TO R+2 DO + FOR J=S TO S+2 DO + CH$=TAV$[I,J] CH=VAL(Z$) + IF LEN(CH$)<>1 THEN + CHANGE(CH$,CH,"-"->CH$) + TAV$[I,J]=CH$ + END IF + END FOR + END FOR + MESSAGGI(1) +END PROCEDURE + +PROCEDURE ESAMINA_SCHEMA + FOR RIGA=1 TO 9 DO + FOR COLONNA=1 TO 9 DO + VALORE_DEFINITO + IF FLAG% THEN + Z$=TAV$[RIGA,COLONNA] + TOGLI_VALORE + END IF + END FOR + END FOR +END PROCEDURE + +PROCEDURE IDENTIFICA_UNICO + FOR KL=1 TO 9 DO + KL$=MID$(STR$(KL),2) + NN=0 + FOR H=1 TO LEN(ZZ$) DO + IF MID$(ZZ$,H,1)=KL$ THEN NN=NN+1 END IF + END FOR + IF NN=1 THEN Q=INSTR(ZZ$,KL$) KL=9 END IF + END FOR +END PROCEDURE + +!---------------------------------------------------------------------------- +! intercetta i valori unici per le celle ancora non definite +!---------------------------------------------------------------------------- +PROCEDURE TOGLI_VALORE2 + + MESSAGGI(2) +! iniziamo dalle righe .... + OK%=FALSE + FOR RIGA=1 TO 9 DO + ZZ$="" + FOR COLONNA=1 TO 9 DO + IF LEN(TAV$[RIGA,COLONNA])<>1 THEN + ZZ$=ZZ$+TAV$[RIGA,COLONNA] + ELSE + ZZ$=ZZ$+STRING$(9," ") + END IF + END FOR + Q=0 IDENTIFICA_UNICO + IF Q<>0 THEN + COLONNA=INT(Q/9.1)+1 + TAV$[RIGA,COLONNA]=KL$ + OK%=TRUE EXIT + END IF + END FOR + IF OK% THEN GOTO 76 END IF + +! .... poi dalle colonne .... + FOR COLONNA=1 TO 9 DO + ZZ$="" + FOR RIGA=1 TO 9 DO + IF LEN(TAV$[RIGA,COLONNA])<>1 THEN + ZZ$=ZZ$+TAV$[RIGA,COLONNA] + ELSE + ZZ$=ZZ$+STRING$(9," ") + END IF + END FOR + Q=0 IDENTIFICA_UNICO + IF Q<>0 THEN + RIGA=INT(Q/9.1)+1 + TAV$[RIGA,COLONNA]=KL$ OK%=TRUE EXIT + END IF + END FOR + IF OK% THEN GOTO 76 END IF + +!.... e infine i quadranti + FOR QUADRANTE=1 TO 9 DO + ZZ$="" + CASE QUADRANTE OF + 1-> R=1 S=1 END -> + 2-> R=1 S=4 END -> + 3-> R=1 S=7 END -> + 4-> R=4 S=1 END -> + 5-> R=4 S=4 END -> + 6-> R=4 S=7 END -> + 7-> R=7 S=1 END -> + 8-> R=7 S=4 END -> + 9-> R=7 S=7 END -> + END CASE + FOR RIGA=R TO R+2 DO + FOR COLONNA=S TO S+2 DO + IF LEN(TAV$[RIGA,COLONNA])<>1 THEN + ZZ$=ZZ$+TAV$[RIGA,COLONNA] + ELSE + ZZ$=ZZ$+STRING$(9," ") + END IF + END FOR + END FOR + Q=0 IDENTIFICA_UNICO + IF Q<>0 THEN + CASE Q OF + 1..9-> ALFA=R BETA=S END -> + 10..18-> ALFA=R BETA=S+1 END -> + 19..27-> ALFA=R BETA=S+2 END -> + 28..36-> ALFA=R+1 BETA=S END -> + 37..45-> ALFA=R+1 BETA=S+1 END -> + 46..54-> ALFA=R+1 BETA=S+2 END -> + 55..63-> ALFA=R+2 BETA=S END -> + 64..72-> ALFA=R+2 BETA=S+1 END -> + OTHERWISE + ALFA=R+2 BETA=S+2 + END CASE +77: + TAV$[ALFA,BETA]=KL$ EXIT + END IF + END FOR +76: + MESSAGGI(2) +END PROCEDURE + +PROCEDURE CONVERTI_VALORE + FINE%=TRUE NESSUNO%=TRUE + FOR RIGA=1 TO 9 DO + FOR COLONNA=1 TO 9 DO + CH$=TAV$[RIGA,COLONNA] + IF LEN(CH$)<>1 THEN + FINE%=FALSE ! flag per fine partita -- trovati tutti + Q=0 ! conta i '-' nella stringa se ce ne sono 8, + ! trovato valore + FOR Z=1 TO LEN(CH$) DO + IF MID$(CH$,Z,1)="-" THEN Q=Q+1 ELSE LAST=Z END IF + END FOR + IF Q=8 THEN + CH$=MID$(STR$(LAST),2) + TAV$[RIGA,COLONNA]=CH$ + NESSUNO%=FALSE + END IF + END IF + END FOR + END FOR +END PROCEDURE + +PROCEDURE LEGGI_SCHEMA + OPEN("I",1,"sudoku.txt") + FOR I=1 TO 9 DO + INPUT(LINE,#1,RIGA$) + FOR J=1 TO 9 DO + CH$=MID$(RIGA$,J,1) + IF CH$="0" OR CH$="." THEN + TAV$[I,J]="123456789" + ELSE + TAV$[I,J]=CH$ + END IF + END FOR + END FOR +CLOSE(1) +END PROCEDURE + +!--------------------------------------------------------------------------- +! Praticamente - visita di un albero binario (caso con cella a 2 valori +! possibili) +!--------------------------------------------------------------------------- +PROCEDURE RICERCA_COMBINATORIA + TRE%=TRUE + FOR RIGA=1 TO 9 DO + FOR COLONNA=1 TO 9 DO + CH$=TAV$[RIGA,COLONNA] + IF LEN(CH$)<>1 THEN + Q=0 FIRST=0 SECOND=0 THIRD=0 + FOR Z=1 TO LEN(CH$) DO + IF MID$(CH$,Z,1)="-" THEN + Q=Q+1 + ELSE + IF FIRST=0 THEN + FIRST=Z + ELSE + SECOND=Z + END IF + END IF + END FOR + IF Q=7 THEN + SALVA_CONFIG + TAV$[RIGA,COLONNA]=MID$(STR$(FIRST),2) + TRE%=FALSE + GOTO 97 + END IF + END IF + END FOR + END FOR + IF TRE% THEN GOTO 88 END IF +97: + MESSAGGI(3) + EXIT PROCEDURE +88: + QUATTRO%=TRUE + FOR RIGA=1 TO 9 DO + FOR COLONNA=1 TO 9 DO + CH$=TAV$[RIGA,COLONNA] + IF LEN(CH$)<>1 THEN + Q=0 FIRST=0 SECOND=0 THIRD=0 + FOR Z=1 TO LEN(CH$) DO + IF MID$(CH$,Z,1)="-" THEN + Q=Q+1 + ELSE + IF FIRST=0 THEN + FIRST=Z + ELSE + IF SECOND=0 THEN + SECOND=Z + ELSE + THIRD=Z + END IF + END IF + END IF + END FOR + IF Q=6 THEN + SALVA_CONFIG + TAV$[RIGA,COLONNA]=MID$(STR$(FIRST),2) + QUATTRO%=FALSE + GOTO 97 + END IF + END IF + END FOR + END FOR + IF QUATTRO% THEN + LIVELLO=LIVELLO+1 + RIPRISTINA_CONFIG + GOTO 97 + END IF + ! se restano solo celle con 4 valori,forza la chiusura del ramo dell'albero + !$RCODE="STOP" +END PROCEDURE + +BEGIN + CLS + LIVELLO=1 NZ%=0 + LEGGI_SCHEMA + WHILE TRUE DO + VISUALIZZA_SCHEMA +99: + NZ%=NZ%+1 + ESAMINA_SCHEMA + CONVERTI_VALORE + EXIT IF FINE% + IF NESSUNO% THEN + TOGLI_VALORE2 + IF OK%=0 THEN + RICERCA_COMBINATORIA ! cerca altri celle da assegnare + END IF + END IF + END WHILE + VISUALIZZA_SCHEMA + VERIFICA_SE_FINITO + IF NOT COMPLETO% THEN + LIVELLO=LIVELLO+1 + RIPRISTINA_CONFIG + GOTO 99 + END IF +END PROGRAM diff --git a/Task/Sudoku/FutureBasic/sudoku.futurebasic b/Task/Sudoku/FutureBasic/sudoku.futurebasic new file mode 100644 index 0000000000..10a258c158 --- /dev/null +++ b/Task/Sudoku/FutureBasic/sudoku.futurebasic @@ -0,0 +1,108 @@ +include "ConsoleWindow" +include "NSLog.incl" +include "Util_Containers.incl" + +begin globals +dim as container gC +end globals + +BeginCDeclaration +short solve_sudoku(short i); +short check_sudoku(short r, short c); +CFMutableStringRef print_sudoku(); +EndC + +BeginCFunction +short sudoku[9][9] = { + {3,0,0,0,0,1,4,0,9}, + {7,0,0,0,0,4,2,0,0}, + {0,5,0,2,0,0,0,1,0}, + {5,7,0,0,4,3,0,6,0}, + {0,9,0,0,0,0,0,3,0}, + {0,6,0,7,9,0,0,8,5}, + {0,8,0,0,0,5,0,4,0}, + {0,0,6,4,0,0,0,0,7}, + {9,0,5,6,0,0,0,0,3}, + }; + + +short check_sudoku( short r, short c ) +{ + short i; + short rr, cc; + + for (i = 0; i < 9; i++) + { + if (i != c && sudoku[r][i] == sudoku[r][c]) return 0; + if (i != r && sudoku[i][c] == sudoku[r][c]) return 0; + rr = r/3 * 3 + i/3; + cc = c/3 * 3 + i%3; + if ((rr != r || cc != c) && sudoku[rr][cc] == sudoku[r][c]) return 0; + } + return -1; +} + + +short solve_sudoku( short i ) +{ + short r, c; + + if (i < 0) return 0; + else if (i >= 81) return -1; + + r = i / 9; + c = i % 9; + + if (sudoku[r][c]) + return check_sudoku(r, c) && solve_sudoku(i + 1); + else + for (sudoku[r][c] = 9; sudoku[r][c] > 0; sudoku[r][c]--) + { + if ( solve_sudoku(i) ) return -1; + } + return 0; +} + + +CFMutableStringRef print_sudoku() +{ + short i, j; + CFMutableStringRef mutStr; + + mutStr = CFStringCreateMutable( kCFAllocatorDefault, 0 ); + + for (i = 0; i < 9; i++) + { + for (j = 0; j < 9; j++) + { + CFStringAppendFormat( mutStr, NULL, (CFStringRef)@" %d", sudoku[i][j] ); + } + CFStringAppendFormat( mutStr, NULL, (CFStringRef)@"\r" ); + } + return( mutStr ); +} +EndC + +toolbox fn solve_sudoku( short i ) = short +toolbox fn check_sudoku( short r, short c ) = short +toolbox fn print_sudoku() = CFMutableStringRef + +dim as short solution +dim as CFMutableStringRef cfRef + +gC = " " +cfRef = fn print_sudoku() +fn ContainerCreateWithCFString( cfRef, gC ) +print : print "Sudoku challenge:" : print : print gC + +solution = fn solve_sudoku(0) + +print : print "Sudoku solved:" : print +if ( solution ) +gC = " " +cfRef = fn print_sudoku() +fn ContainerCreateWithCFString( cfRef, gC ) +print gC +else +print "No solution found" +end if diff --git a/Task/Sudoku/Phix/sudoku-1.phix b/Task/Sudoku/Phix/sudoku-1.phix new file mode 100644 index 0000000000..f5a4a72ae1 --- /dev/null +++ b/Task/Sudoku/Phix/sudoku-1.phix @@ -0,0 +1,50 @@ +sequence board = split(""" +.......39 +.....1..5 +..3.5.8.. +..8.9...6 +.7...2... +1..4..... +..9.8..5. +.2....6.. +4..7.....""",'\n') + +function valid_move(integer y, integer x, integer ch) + for i=1 to 9 do + if ch=board[i][x] then return 0 end if + if ch=board[y][i] then return 0 end if + end for + y -= mod(y-1,3) + x -= mod(x-1,3) + for ys=y to y+2 do + for xs=x to x+2 do + if ch=board[ys][xs] then return 0 end if + end for + end for + return 1 +end function + +sequence solution = {} + +procedure brute_solve() + for y=1 to 9 do + for x=1 to 9 do + if board[y][x]<='0' then + for ch='1' to '9' do + if valid_move(y,x,ch) then + board[y][x] = ch + brute_solve() + board[y][x] = ' ' + if length(solution) then return end if + end if + end for + return + end if + end for + end for + solution = board -- (already solved case) +end procedure + +atom t0 = time() +brute_solve() +printf(1,"%s\n(solved in %3.2fs)\n",{join(solution,"\n"),time()-t0}) diff --git a/Task/Sudoku/Phix/sudoku-2.phix b/Task/Sudoku/Phix/sudoku-2.phix new file mode 100644 index 0000000000..3c7dcbdcf2 --- /dev/null +++ b/Task/Sudoku/Phix/sudoku-2.phix @@ -0,0 +1,658 @@ +-- Working directly on 81-character strings ultimately proves easier: Originally I +-- just wanted to simplify the final display, but later I realised that a 9x9 grid +-- encourages laborious indexing/looping everwhere whereas using a flat 81-element +-- approach encourages precomputation of index sets, and once you commit to that, +-- the rest of the code starts to get a whole lot cleaner. Below we create 27+18 +-- sets and 5 tables of lookup indexes to locate them quickly. + +sequence nines = {}, -- will be 27 in total + cols = repeat(0,9*9), -- remainder(i-1,9)+1 + rows = repeat(0,9*9), -- floor((i-1)/9)+10 + squares = repeat(0,9*9), + sixes = {}, -- will be 18 in total + dotcol = repeat(0,9*9), -- same col, diff square + dotrow = repeat(0,9*9) -- same row, diff square + +procedure set_nines() +sequence nine, six +integer idx, ndx + for x=0 to 8 do -- columns + nine = {} + ndx = length(nines)+1 + for y=1 to 81 by 9 do + idx = y+x + nine = append(nine,idx) + cols[idx] = ndx + end for + nines = append(nines,nine) + end for + for y=1 to 81 by 9 do -- rows + nine = {} + ndx = length(nines)+1 + for x=0 to 8 do + idx = y+x + nine = append(nine,idx) + rows[idx] = ndx + end for + nines = append(nines,nine) + end for + if length(nines)!=18 then ?9/0 end if + for y=0 to 8 by 3 do -- small squares [19..27] + for x=0 to 8 by 3 do + nine = {} + ndx = length(nines)+1 + for sy=y*9 to y*9+18 by 9 do + for sx=x to x+2 do + idx = sy+sx+1 + nine = append(nine,idx) + squares[idx] = ndx + end for + end for + nines = append(nines,nine) + end for + end for + if length(nines)!=27 then ?9/0 end if + for i=1 to 9*9 do + six = {} + nine = nines[cols[i]] -- dotcol + for j=1 to length(nine) do + if squares[i]!=squares[nine[j]] then + six = append(six,nine[j]) + end if + end for + ndx = find(six,sixes) + if ndx=0 then + sixes = append(sixes,six) + ndx = length(sixes) + end if + dotcol[i] = ndx + six = {} + nine = nines[rows[i]] -- dotrow + for j=1 to length(nine) do + if squares[i]!=squares[nine[j]] then + six = append(six,nine[j]) + end if + end for + ndx = find(six,sixes) + if ndx=0 then + sixes = append(sixes,six) + ndx = length(sixes) + end if + dotrow[i] = ndx + end for +end procedure +set_nines() + +integer improved = 0 + +function eliminate_in(sequence valid, sequence set, integer ch) + for i=1 to length(set) do + integer idx = set[i] + if string(valid[idx]) then + integer k = find(ch,valid[idx]) + if k!=0 then + valid[idx][k..k] = "" + improved = 1 + end if + end if + end for + return valid +end function + +function test_comb(sequence chosen, sequence pool, sequence valid) +-- +-- (see deep_logic()/set elimination) +-- chosen is a sequence of length 2..4 of integers 1..9: ordered elements of pool. +-- pool is a set of elements of the sequence valid, each of which is a sequence. +-- (note that elements of valid in pool not in chosen are not necessarily sequences) +-- +sequence contains = repeat(0,9) +integer ccount = 0, ch +object set + + for i=1 to length(chosen) do + set = valid[pool[chosen[i]]] + for j=1 to length(set) do + ch = set[j]-'0' + if contains[ch]=0 then + contains[ch] = 1 + ccount += 1 + end if + end for + end for + if ccount=length(chosen) then + for i=1 to length(pool) do + if find(i,chosen)=0 then + set = valid[pool[i]] + if sequence(set) then + -- (reverse order so deletions don't foul indexes) + for j=length(set) to 1 by -1 do + ch = set[j]-'0' + if contains[ch] then + valid[pool[i]][j..j] = "" + improved = 1 + end if + end for + end if + end if + end for + end if + return valid +end function + +-- from [[Combinations#Phix|Combinations]] +-- from http://rosettacode.org/wiki/Combinations#Phix +function comb(sequence pool, valid, integer needed, done=0, sequence chosen={}) +-- (used by deep_logic()/set elimination) + if needed=0 then -- got a full set + return test_comb(chosen,pool,valid) + end if + if done+needed>length(pool) then return valid end if -- cannot fulfil + -- get all combinations with and without the next item: + done += 1 + if sequence(valid[pool[done]]) then + valid = comb(pool,valid,needed-1,done,append(chosen,done)) + end if + return comb(pool,valid,needed,done,chosen) +end function + +function deep_logic(string board, sequence valid) +-- +-- Create a grid of valid moves. Note this does not modify board, but instead creates +-- sets of permitted values for each cell, which can also be and are used for hints. +-- Apply standard eliminations of known cells, then try some more advanced tactics: +-- +-- 1) row/col elimination +-- If in any of the 9 small squares a number can only occur in one row or column, +-- then that number cannot occur in that row or column in two other corresponding +-- small squares. Example (this one with significant practical benefit): +-- 000|000|036 +-- 840|000|000 +-- 000|000|020 +-- ---+---+--- +-- 000|203|000 +-- 010|000|700 +-- 000|600|400 +-- ---+---+--- +-- 000|410|050 +-- 003|000|200 +-- 600|000|000 <-- 3 +-- ^-- 3 +-- Naively, the br can contain a 3 in the four corners, but looking at mid-right and +-- mid-bottom leads us to eliminating 3s in column 9 and row 9, leaving 7,7 as the +-- only square in the br that can be a 3. Uses dotcol and dotrow. +-- Without this, brute force on the above takes ~8s, but with it ~0s +-- +-- 2) set elimination +-- If in any 9-set there is a set of n blank squares that can only contain n digits, +-- then no other squares can contain those digits. Example (with some benefit): +-- 75.|.9.|.46 +-- 961|...|352 +-- 4..|...|79. +-- ---+---+--- +-- 2..|6.1|..7 +-- .8.|...|.2. +-- 1..|328|.65 +-- ---+---+--- +-- ...|...|... <-- [7,8] is {1,3,8}, [7,9] is {1,3,8} +-- 3.9|...|2.4 <-- [8,8] is {1,8} +-- 84.|.3.|.79 +-- The three cells above the br 479 can only contain {1,3,8}, so the .. of the .2. +-- in column 7 of that square are {5,6} (not 1) and hence [9,4] must be a 1. +-- (Relies on plain_logic to spot that "must be a 1", and serves as a clear example +-- of why this routine should not bother to attempt updating the board itself - as +-- it spends almost all of its time looking in a completely different place.) +-- (One could argue that [7,7] and [9,7] are the only places that can hold {5,6} and +-- therefore we should eliminate all non-{5,6} from those squares, as an alternative +-- strategy. However I think that would be harder to code and cannot imagine a case +-- said complementary logic covers, that the above does not, cmiiw.) +-- +-- 3) x-wings +-- If a pair of rows or columns can only contain a given number in two matching places, +-- then once filled they will occupy opposite diagonal corners, hence that said number +-- cannot occur elsewhere in those two columns/rows. Example (with a benefit): +-- .43|98.|25. <-- 6 in [1,{6,9}] +-- 6..|425|... +-- 2..|..1|.94 +-- ---+---+--- +-- 9..|..4|.7. <-- hence 6 not in [4,9] +-- 3..|6.8|... +-- 41.|2.9|..3 +-- ---+---+--- +-- 82.|5..|... <-- hence 6 not in [7,6],[7,9] +-- ...|.4.|..5 <-- hence 6 not in [8,6] +-- 534|89.|71. <-- 6 in [9,{6,9}] +-- A 6 must be in [1,6] or [1,9] and [9,6] or [9,9], hence [7,9] is not 6 and must be 9. +-- (we also eliminate 6 from [4,9], [7,6] and [8,6] to no great use) +-- In practice this offers little benefit over a single trial-and-error step, as +-- obviously trying either 6 in row 1 or 9 immediately pinpoints that 9 anyway. +-- +-- 4) swordfish (not attempted) +-- There is an extension to x-wings known as swordfish: three (or more) pairs form +-- a staggered pair (or more) of rectangles that exhibit similar properties, eg: +-- 8-1|-5-|-3- +-- 953|-68|--- +-- -4-|-*3|5*8 +-- ---+---+--- +-- 6--|9-2|--- +-- -8-|-3-|-4- +-- 3*-|5-1|-*7 <-- hence [6,3] is not 9, must be 4 +-- ---+---+--- +-- 5*2|-*-|-8- +-- --8|37-|--9 +-- -3-|82-|1-- +-- ^---^---^-- 3 pairs of 9s (marked with *) on 3 rows (only) +-- It is not a swordfish if the 3 pairs are on >3 rows, I trust that is obvious. +-- Logically you can extend this to N pairs on N rows, however I cannot imagine a +-- case where this is not immediately solved by a single trial-step being invalid. +-- (eg above if you try [3,5]:=9 it is quickly proved to be invalid, and the same +-- goes for [6,8]:=9 and [7,2]:=9, since they are all entirely inter-dependent.) +-- Obviously where I have said rows, the same concept can be applied to columns. +-- Likewise there are "Alternate Pairs" and "Hook or X-Y wing" strategies, which +-- are easily solved with a single trial-and-error step, and of course the brute +-- force algorithm is going to select pairs first anyway. [Erm, no it doesn't, +-- it selects shortest - I've noted the possible improvement below.] +-- +integer col, row +sequence c, r +sequence nine, prevsets, set +object vj +integer ch, k, idx, sx, sy, count + + if length(valid)=0 then + -- initialise/start again from scratch + valid = repeat("123456789",9*9) + end if + -- + -- First perform standard eliminations of any known cells: + -- (repeated every time so plain_logic() does not have to worry about it) + -- + for i=1 to 9*9 do + ch = board[i] + if ch>'0' + and string(valid[i]) then + valid[i] = ch + valid = eliminate_in(valid,nines[cols[i]],ch) + valid = eliminate_in(valid,nines[rows[i]],ch) + valid = eliminate_in(valid,nines[squares[i]],ch) + end if + end for + -- + -- 1) row/col elimination + -- + for s=19 to 27 do + c = repeat(0,9) -- 0 = none seen, 1..9 this col only, -1: >1 col + r = repeat(0,9) -- "" row row + nine = nines[s] + for n=1 to 9 do + k = nine[n] + vj = valid[k] + if string(vj) then + for i=1 to length(vj) do + ch = vj[i]-'0' + col = dotcol[k] + row = dotrow[k] + c[ch] = iff(find(c[ch],{0,col})!=0?col:-1) + r[ch] = iff(find(r[ch],{0,row})!=0?row:-1) + end for + end if + end for + for i=1 to 9 do + ch = i+'0' + col = c[i] + if col>0 then + valid = eliminate_in(valid,sixes[col],ch) + end if + row = r[i] + if row>0 then + valid = eliminate_in(valid,sixes[row],ch) + end if + end for + end for + -- + -- 2) set elimination + -- + for i=1 to length(nines) do + -- + -- Practical note: Meticulously counting empties to eliminate larger set sizes + -- would at best reduce 6642 tests to 972, not deemed worth it. + -- + for set_size=2 to 4 do + --if floor(count_empties(nines[i])/2)>=set_size then -- (untested) + valid = comb(nines[i],valid,set_size) + --end if + end for + end for + -- + -- 3) x-wings + -- + for ch='1' to '9' do + prevsets = repeat(0,9) + for x=1 to 9 do + count = 0 + set = repeat(0,9) + for y=0 to 8 do + idx = y*9+x + if sequence(valid[idx]) and find(ch,valid[idx]) then + set[y+1] = 1 + count += 1 + end if + end for + if count=2 then + k = find(set,prevsets) + if k!=0 then + for y=0 to 8 do + if set[y+1]=1 then + for sx=1 to 9 do + if sx!=k and sx!=x then + valid = eliminate_in(valid,{y*9+sx},ch) + end if + end for + end if + end for + else + prevsets[x] = set + end if + end if + end for + prevsets = repeat(0,9) + for y=0 to 8 do + count = 0 + set = repeat(0,9) + for x=1 to 9 do + idx = y*9+x + if sequence(valid[idx]) and find(ch,valid[idx]) then + set[x] = 1 + count += 1 + end if + end for + if count=2 then + k = find(set,prevsets) + if k!=0 then + for x=1 to 9 do + if set[x]=1 then + for sy=0 to 8 do + if sy+1!=k and sy!=y then + valid = eliminate_in(valid,{sy*9+x},ch) + end if + end for + end if + end for + else + prevsets[y+1] = set + end if + end if + end for + end for + return valid +end function + +function permitted_in(string board, sequence sets, sequence valid, integer ch) +sequence set +integer pos, idx, bch + for i=1 to 9 do + set = nines[sets[i]] + pos = 0 + for j=1 to 9 do + idx = set[j] + bch = board[idx] + if bch>'0' then + if bch=ch then pos = -1 exit end if + elsif find(ch,valid[idx]) then + if pos!=0 then pos = -1 exit end if + pos = idx + end if + end for + if pos>0 then + board[pos] = ch + improved = 1 + end if + end for + return board +end function + +enum INVALID = -1, INCOMPLETE = 0, SOLVED = 1, MULTIPLE = 2, BRUTE = 3 + +function plain_logic(string board) +-- +-- Responsible for: +-- 1) cells with only one option +-- 2) numbers with only one home +-- +integer solved +sequence valid = {} +object vi + + while 1 do + solved = SOLVED + improved = 0 + valid = deep_logic(board,valid) + + -- 1) cells with only one option: + for i=1 to length(valid) do + vi = valid[i] + if string(vi) then + if length(vi)=0 then return {board,{},INVALID} end if + if length(vi)=1 then + board[i] = vi[1] + improved = 1 + end if + end if + if board[i]<='0' then + solved = INCOMPLETE + end if + end for + if solved=SOLVED then return {board,{},SOLVED} end if + + -- 2) numbers with only one home + for ch='1' to '9' do + board = permitted_in(board,cols,valid,ch) + board = permitted_in(board,rows,valid,ch) + board = permitted_in(board,squares,valid,ch) + end for + if not improved then exit end if + end while + return {board,valid,solved} +end function + +function validate(string board) +-- (sum9 should be sufficient - if you want, get rid of nine/nines) +integer ch, sum9 +sequence nine, nines = tagset(9) + + for x=0 to 8 do -- columns + sum9 = 0 + nine = repeat(0,9) + for y=1 to 81 by 9 do + ch = board[y+x]-'0' + if ch<1 or ch>9 then return 0 end if + sum9 += ch + nine[ch] = ch + end for + if sum9!=45 then return 0 end if + if nine!=nines then return 0 end if + end for + for y=1 to 81 by 9 do -- rows + sum9 = 0 + nine = repeat(0,9) + for x=0 to 8 do + ch = board[y+x]-'0' + sum9 += ch + nine[ch] = ch + end for + if sum9!=45 then return 0 end if + if nine!=nines then return 0 end if + end for + for y=0 to 8 by 3 do -- small squares + for x=0 to 8 by 3 do + sum9 = 0 + nine = repeat(0,9) + for sy=y*9 to y*9+18 by 9 do + for sx=x to x+2 do + ch = board[sy+sx+1]-'0' + sum9 += ch + nine[ch] = ch + end for + end for + if sum9!=45 then return 0 end if + if nine!=nines then return 0 end if + end for + end for + return 1 +end function + +function solve(string board, sequence valid={}) +sequence solution, solutions +integer solved +integer minopt, mindx +object vi + {solution,valid,solved} = plain_logic(board) + if solved=INVALID then return {{},INVALID} end if + if solved=SOLVED then return {{solution},SOLVED} end if + if solved=BRUTE then return {{solution},BRUTE} end if + if solved!=INCOMPLETE then ?9/0 end if + -- find the cell with the fewest options: + -- (a possible improvement here would be to select the shortest + -- with the "most pairs" set, see swordfish etc above.) + minopt = 10 + for i=1 to 9*9 do + vi = valid[i] + if string(vi) then + if length(vi)<=1 then ?9/0 end if -- should be caught above + if length(vi)1 then + return {solutions,MULTIPLE} + elsif length(solutions) then + return {solutions,BRUTE} + end if + end if + end for + if length(solutions)=1 then + return {solutions,BRUTE} + end if + return {{},INVALID} +end function + +function test_one(string board) +sequence solutions +string solution, desc +integer solved + {solutions,solved} = solve(board) + if solved=SOLVED then + desc = "(logic)" + elsif solved=BRUTE then + desc = "(brute force)" + else + desc = "???" -- INVALID/INCOMPLETE/MULTIPLE + end if + if length(solutions)=0 then + solution = board + desc = "*** NO SOLUTIONS ***" + elsif length(solutions)=1 then + solution = solutions[1] + if not validate(solution) then + desc = "*** ERROR ***" -- (should never happen) + end if + else + solution = board + desc = "*** MULTIPLE SOLUTIONS ***" + end if + return {solution,desc} +end function + +--NB Blank cells can be represented by any character <'1'. Spaces are not recommended since +-- they can all too easily be converted to tabs by copy/paste/save. In particular, ? and +-- _ are NOT valid characters for representing a blank square. Use any of .0-* instead. + +constant tests = { + "..............3.85..1.2.......5.7.....4...1...9.......5......73..2.1........4...9", -- (0.01s, (logic)) + -- row/col elimination (was 8s w/o logic first) + "000000036840000000000000020000203000010000700000600400000410050003000200600000000", -- (0.04s, (brute force)) + ".......39.....1..5..3.5.8....8.9...6.7...2...1..4.......9.8..5..2....6..4..7.....", -- (1.12s, (brute force)) + "000037600000600090008000004090000001600000009300000040700000800010009000002540000", -- (0.00s, (logic)) + "....839..1......3...4....7..42.3....6.......4....7..1..2........8...92.....25...6", -- (0.04s, (brute force)) + "..1..5.7.92.6.......8...6...9..2.4.1.........3.4.8..9...7...3.......7.69.1.8..7..", -- (0.00s, (logic)) + -- (the following takes ~8s when checking for multiple solutions) + "--3------4---8--36--8---1---4--6--73---9----------2--5--4-7--686--------7--6--5--", -- (0.01s, (brute force)) + "..3.2.6..9..3.5..1..18.64....81.29..7.......8..67.82....26.95..8..2.3..9..5.1.3..", -- (0.00s, (logic)) + "--4-5--6--6-1--8-93----7----8----5-----4-3-----6----7----2----61-5--4-3--2--7-1--", -- (0.00s, (logic)) + -- x-wings + ".4398.25.6..425...2....1.949....4.7.3..6.8...41.2.9..382.5.........4...553489.71.", -- (0.00s, (logic)) + ".9...4..7.....79..8........4.58.....3.......2.....97.6........4..35.....2..6...8.", -- (0.00s, (logic)) + -- "AL Escargot", so-called "hardest sudoku" + "1....7.9..3..2...8..96..5....53..9...1..8...26....4...3......1..4......7..7...3..", -- (0.26s, (brute force)) + "12.3....435....1....4........54..2..6...7.........8.9...31..5.......9.7.....6...8", -- (0.48s, (brute force)) + "12.4..3..3...1..5...6...1..7...9.....4.6.3.....3..2...5...8.7....7.....5.......98", -- (1.07s, (brute force)) + "394..267....3..4..5..69..2..45...9..6.......7..7...58..1..67..8..9..8....264..735", -- (0.00s, (logic)) + "4......6.5...8.9..3....1....2.7....1.9.....4.8....3.5....2....7..6.5...8.1......6", -- (0.01s, (brute force)) + "5...7....6..195....98....6.8...6...34..8.3..17...2...6.6....28....419..5....8..79", -- (0.00s, (logic)) + "503600009010002600900000080000700005006804100200003000030000008004300050800006702", -- (0.00s, (logic)) + "53..247....2...8..1..7.39.2..8.72.49.2.98..7.79.....8.....3.5.696..1.3...5.69..1.", -- (0.00s, (logic)) + "530070000600195000098000060800060003400803001700020006060000280000419005000080079", -- (0.00s, (logic)) + -- set exclusion + "75..9..46961...3524.....79.2..6.1..7.8.....2.1..328.65.........3.9...2.484..3..79", -- (0.00s, (logic)) + -- Worlds hardest sudoku: + "800000000003600000070090200050007000000045700000100030001000068008500010090000400", -- (0.21s, (brute force)) + "819--5-----2---75--371-4-6-4--59-1--7--3-8--2--3-62--7-5-7-921--64---9-----2--438", -- (0.00s, (logic)) + "85...24..72......9..4.........1.7..23.5...9...4...........8..7..17..........36.4.", -- (0.01s, (logic)) + "9..2..5...4..6..3...3.....6...9..2......5..8...7..4..37.....1...5..2..4...1..6..9", -- (0.17s, (brute force)) + "97.3...6..6.75.........8.5.......67.....3.....539..2..7...25.....2.1...8.4...73..", -- (0.00s, (logic)) + -- "the beast" (an earlier algorithm took 318s (5min 18s) on this): + "000060080020000000001000000070000102500030000000000400004201000300700600000000050", -- (0.03s, (brute force)) + $}, + + lt = length(tests), + run_one_test = 0 + +constant l = " x x x | x x x | x x x ", + s = "-------+-------+-------", + l3 = join({l,l,l},"\n"), + fmt = substitute(join({l3,s,l3,s,l3},"\n"),"x","%c")&"\n" + +procedure print_board(string board) + printf(1,fmt,board) +end procedure + +procedure test() +string board -- (81 characters) +string solution, desc +atom t0 = time() + if run_one_test then + board = tests[run_one_test] + print_board(board) + {solution,desc} = test_one(board) + if length(solution)!=0 then + printf(1,"solution:\n") + print_board(solution) + end if + printf(1,"%s, %3.2fs\n",{desc,time()-t0}) + else + for i=1 to lt do + atom t1 = time() + board = tests[i] + {solution,desc} = test_one(board) + printf(1," \"%s\", -- (%3.2fs, %s)\n",{board,time()-t1,desc}) +-- printf(1," \"%s\", -- (%3.2fs, %s)\n",{solution,time()-t1,desc}) + end for + t0 = time()-t0 + printf(1,"%d puzzles solved in %3.2fs (av %3.2fs)\n",{lt,t0,t0/lt}) + end if +end procedure +test() diff --git a/Task/Sudoku/Sidef/sudoku.sidef b/Task/Sudoku/Sidef/sudoku.sidef new file mode 100644 index 0000000000..1c8893432e --- /dev/null +++ b/Task/Sudoku/Sidef/sudoku.sidef @@ -0,0 +1,53 @@ +func check(i, j) is cached { + var (id, im) = i.divmod(9) + var (jd, jm) = j.divmod(9) + + jd == id && return true + jm == im && return true + + var id2 = id//3 + var jd2 = jd//3 + + jd2 == id2 || return false + + jm//3 == im//3 +} + +func solve(board) { + for i in ^board { + board[i] && next + var *t = board[^board -> grep {|j| check(i, j) }] + + { |k| + t.contains(k) && next + board[i] = k + solve(board) + } * 9 + + board[i] = 0 + return nil + } + + for i in ^board { + print "#{board[i]} "; + print " " if (3 -> divides(i+1)) + print "\n" if (9 -> divides(i+1)) + print "\n" if (27 -> divides(i+1)) + } +} + +var board = %i( + 5 3 0 0 2 4 7 0 0 + 0 0 2 0 0 0 8 0 0 + 1 0 0 7 0 3 9 0 2 + + 0 0 8 0 7 2 0 4 9 + 0 2 0 9 8 0 0 7 0 + 7 9 0 0 0 0 0 8 0 + + 0 0 0 0 3 0 5 0 6 + 9 6 0 0 1 0 3 0 0 + 0 5 0 6 9 0 0 1 0 +) + +solve(board) diff --git a/Task/Sudoku/Swift/sudoku.swift b/Task/Sudoku/Swift/sudoku.swift new file mode 100644 index 0000000000..543b6e8b3e --- /dev/null +++ b/Task/Sudoku/Swift/sudoku.swift @@ -0,0 +1,125 @@ +import Foundation + +typealias SodukuPuzzle = [[Int]] + +class Soduku { + let mBoardSize:Int! + let mBoxSize:Int! + var mBoard:SodukuPuzzle! + var mRowSubset:[[Bool]]! + var mColSubset:[[Bool]]! + var mBoxSubset:[[Bool]]! + + init(board:SodukuPuzzle) { + mBoard = board + mBoardSize = board.count + mBoxSize = Int(sqrt(Double(mBoardSize))) + mRowSubset = [[Bool]](count: mBoardSize, repeatedValue: [Bool](count: mBoardSize, repeatedValue: false)) + mColSubset = [[Bool]](count: mBoardSize, repeatedValue: [Bool](count: mBoardSize, repeatedValue: false)) + mBoxSubset = [[Bool]](count: mBoardSize, repeatedValue: [Bool](count: mBoardSize, repeatedValue: false)) + initSubsets() + } + + func computeBoxNo(i:Int, _ j:Int) -> Int { + let boxRow = i / mBoxSize + let boxCol = j / mBoxSize + + return boxRow * mBoxSize + boxCol + } + + func initSubsets() { + for i in 0.. Bool { + val-- + let isPresent = mRowSubset[i][val] || mColSubset[j][val] || mBoxSubset[computeBoxNo(i, j)][val] + return !isPresent + } + + func printBoard() { + for i in 0.. Bool { + if i == mBoardSize { + i = 0 + j++ + if j == mBoardSize { + return true + } + } + + if mBoard[i][j] != 0 { + return solve(i + 1, j) + } + + for value in 1...mBoardSize { + if isValid(i, j, value) { + mBoard[i][j] = value + setSubsetValue(i, j, value, true) + + if solve(i + 1, j) { + return true + } + + setSubsetValue(i, j, value, false) + } + } + + mBoard[i][j] = 0 + return false + } +} + +let board = [ + [4, 0, 0, 0, 0, 0, 0, 6, 0], + [5, 0, 0, 0, 8, 0, 9, 0, 0], + [3, 0, 0, 0, 0, 1, 0, 0, 0], + + [0, 2, 0, 7, 0, 0, 0, 0, 1], + [0, 9, 0, 0, 0, 0, 0, 4, 0], + [8, 0, 0, 0, 0, 3, 0, 5, 0], + [0, 0, 0, 2, 0, 0, 0, 0, 7], + [0, 0, 6, 0, 5, 0, 0, 0, 8], + [0, 1, 0, 0, 0, 0, 0, 0, 6] +] + +let puzzle = Soduku(board: board) +puzzle.solve() +puzzle.printBoard() diff --git a/Task/Sum-and-product-of-an-array/FreeBASIC/sum-and-product-of-an-array.freebasic b/Task/Sum-and-product-of-an-array/FreeBASIC/sum-and-product-of-an-array.freebasic new file mode 100644 index 0000000000..f3f069fedb --- /dev/null +++ b/Task/Sum-and-product-of-an-array/FreeBASIC/sum-and-product-of-an-array.freebasic @@ -0,0 +1,13 @@ +' FB 1.05.0 Win64 + +Dim a(1 To 4) As Integer = {1, 4, 6, 3} +Dim As Integer i, sum = 0, prod = 1 +For i = 1 To 4 + sum += a(i) + prod *= a(i) +Next +Print "Sum ="; sum +Print "Product ="; prod +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Sum-and-product-of-an-array/GFA-Basic/sum-and-product-of-an-array.gfa b/Task/Sum-and-product-of-an-array/GFA-Basic/sum-and-product-of-an-array.gfa new file mode 100644 index 0000000000..6f3068bf23 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/GFA-Basic/sum-and-product-of-an-array.gfa @@ -0,0 +1,15 @@ +DIM a%(10) +' put some values into the array +FOR i%=1 TO 10 + a%(i%)=i% +NEXT i% +' +sum%=0 +product%=1 +FOR i%=1 TO 10 + sum%=sum%+a%(i%) + product%=product%*a%(i%) +NEXT i% +' +PRINT "Sum is ";sum% +PRINT "Product is ";product% diff --git a/Task/Sum-and-product-of-an-array/Lasso/sum-and-product-of-an-array.lasso b/Task/Sum-and-product-of-an-array/Lasso/sum-and-product-of-an-array.lasso new file mode 100644 index 0000000000..5c691fa8c2 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/Lasso/sum-and-product-of-an-array.lasso @@ -0,0 +1,11 @@ +local(x = array(1,2,3,4,5,6,7,8,9,10)) +// sum of array elements +'Sum: ' +with n in #x +sum #n +'\r' +// product of arrray elements +'Product: ' +local(product = 1) +with n in #x do => { #product *= #n } +#product diff --git a/Task/Sum-and-product-of-an-array/Lingo/sum-and-product-of-an-array.lingo b/Task/Sum-and-product-of-an-array/Lingo/sum-and-product-of-an-array.lingo new file mode 100644 index 0000000000..a36d638cc1 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/Lingo/sum-and-product-of-an-array.lingo @@ -0,0 +1,15 @@ +on sum (intList) + res = 0 + repeat with v in intList + res = res + v + end repeat + return res +end + +on product (intList) + res = 1 + repeat with v in intList + res = res * v + end repeat + return res +end diff --git a/Task/Sum-and-product-of-an-array/LiveCode/sum-and-product-of-an-array.livecode b/Task/Sum-and-product-of-an-array/LiveCode/sum-and-product-of-an-array.livecode new file mode 100644 index 0000000000..3e3ddccee9 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/LiveCode/sum-and-product-of-an-array.livecode @@ -0,0 +1,15 @@ +//sum +put "1,2,3,4" into nums +split nums using comma +answer sum(nums) + +// product +local prodNums +repeat for each element n in nums + if prodNums is empty then + put n into prodNums + else + multiply prodnums by n + end if +end repeat +answer prodnums diff --git a/Task/Sum-and-product-of-an-array/Nim/sum-and-product-of-an-array-1.nim b/Task/Sum-and-product-of-an-array/Nim/sum-and-product-of-an-array-1.nim new file mode 100644 index 0000000000..5f667757f1 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/Nim/sum-and-product-of-an-array-1.nim @@ -0,0 +1,9 @@ +var xs = @[1,2,3,4,5,6] + +var sum, product: int + +product = 1 + +for x in xs: + sum += x + product *= x diff --git a/Task/Sum-and-product-of-an-array/Nim/sum-and-product-of-an-array-2.nim b/Task/Sum-and-product-of-an-array/Nim/sum-and-product-of-an-array-2.nim new file mode 100644 index 0000000000..c3136a183d --- /dev/null +++ b/Task/Sum-and-product-of-an-array/Nim/sum-and-product-of-an-array-2.nim @@ -0,0 +1,6 @@ +import sequtils + +let + xs = @[1,2,3,4,5,6] + sum = xs.foldl(a + b) + product = xs.foldl(a * b) diff --git a/Task/Sum-and-product-of-an-array/Oforth/sum-and-product-of-an-array.oforth b/Task/Sum-and-product-of-an-array/Oforth/sum-and-product-of-an-array.oforth new file mode 100644 index 0000000000..a44a4cc357 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/Oforth/sum-and-product-of-an-array.oforth @@ -0,0 +1,2 @@ +[1, 2, 3, 4, 5 ] sum println +[1, 3, 5, 7, 9 ] prod println diff --git a/Task/Sum-and-product-of-an-array/Phix/sum-and-product-of-an-array.phix b/Task/Sum-and-product-of-an-array/Phix/sum-and-product-of-an-array.phix new file mode 100644 index 0000000000..11687fad60 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/Phix/sum-and-product-of-an-array.phix @@ -0,0 +1,8 @@ +sequence s = {1,2,3,4,5} +integer asum = 0, aprod = 1 +for i=1 to length(s) do + asum += s[i] + aprod *= s[i] +end for +printf(1,"sum is %d\n",asum) -- or sum(s) +printf(1,"prod is %d\n",aprod) diff --git a/Task/Sum-and-product-of-an-array/Ring/sum-and-product-of-an-array.ring b/Task/Sum-and-product-of-an-array/Ring/sum-and-product-of-an-array.ring new file mode 100644 index 0000000000..c75976746b --- /dev/null +++ b/Task/Sum-and-product-of-an-array/Ring/sum-and-product-of-an-array.ring @@ -0,0 +1,4 @@ +aList = 1:10 nSum=0 nProduct=0 +for x in aList nSum += x nProduct *= x next +See "Sum = " + nSum + nl +See "Product = " + nProduct + nl diff --git a/Task/Sum-and-product-of-an-array/Sidef/sum-and-product-of-an-array-1.sidef b/Task/Sum-and-product-of-an-array/Sidef/sum-and-product-of-an-array-1.sidef new file mode 100644 index 0000000000..b3c586d98f --- /dev/null +++ b/Task/Sum-and-product-of-an-array/Sidef/sum-and-product-of-an-array-1.sidef @@ -0,0 +1,3 @@ +var ary = [1, 2, 3, 4, 5]; +say ary.sum; # => 15 +say ary.prod; # => 120 diff --git a/Task/Sum-and-product-of-an-array/Sidef/sum-and-product-of-an-array-2.sidef b/Task/Sum-and-product-of-an-array/Sidef/sum-and-product-of-an-array-2.sidef new file mode 100644 index 0000000000..4b13c21472 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/Sidef/sum-and-product-of-an-array-2.sidef @@ -0,0 +1,3 @@ +var ary = [1, 2, 3, 4, 5]; +say ary«+»; # => 15 +say ary«*»; # => 120 diff --git a/Task/Sum-and-product-of-an-array/Sparkling/sum-and-product-of-an-array.sparkling b/Task/Sum-and-product-of-an-array/Sparkling/sum-and-product-of-an-array.sparkling new file mode 100644 index 0000000000..1fb522d181 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/Sparkling/sum-and-product-of-an-array.sparkling @@ -0,0 +1,4 @@ +spn:1> reduce({ 1, 2, 3, 4, 5 }, 0, function(x, y) { return x + y; }) += 15 +spn:2> reduce({ 1, 2, 3, 4, 5 }, 1, function(x, y) { return x * y; }) += 120 diff --git a/Task/Sum-and-product-of-an-array/Swift/sum-and-product-of-an-array.swift b/Task/Sum-and-product-of-an-array/Swift/sum-and-product-of-an-array.swift new file mode 100644 index 0000000000..10aca1de37 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/Swift/sum-and-product-of-an-array.swift @@ -0,0 +1,6 @@ +let a = [1, 2, 3, 4, 5] +println(a.reduce(0, +)) // prints 15 +println(a.reduce(1, *)) // prints 120 + +println(reduce(a, 0, +)) // prints 15 +println(reduce(a, 1, *)) // prints 120 diff --git a/Task/Sum-and-product-of-an-array/Ursa/sum-and-product-of-an-array.ursa b/Task/Sum-and-product-of-an-array/Ursa/sum-and-product-of-an-array.ursa new file mode 100644 index 0000000000..10124198ec --- /dev/null +++ b/Task/Sum-and-product-of-an-array/Ursa/sum-and-product-of-an-array.ursa @@ -0,0 +1,8 @@ +declare int<> stream +append 34 76 233 8 2 734 56 stream + +# outputs 1143 +out (+ stream) endl console + +# outputs 3.95961079808E11 +out (* stream) endl console diff --git a/Task/Sum-and-product-of-an-array/Wart/sum-and-product-of-an-array.wart b/Task/Sum-and-product-of-an-array/Wart/sum-and-product-of-an-array.wart new file mode 100644 index 0000000000..c1501d6002 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/Wart/sum-and-product-of-an-array.wart @@ -0,0 +1,2 @@ +def (sum_prod nums) + (list (+ @nums) (* @nums)) diff --git a/Task/Sum-and-product-of-an-array/Wortel/sum-and-product-of-an-array.wortel b/Task/Sum-and-product-of-an-array/Wortel/sum-and-product-of-an-array.wortel new file mode 100644 index 0000000000..7307687c61 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/Wortel/sum-and-product-of-an-array.wortel @@ -0,0 +1,2 @@ +@sum [1 2 3 4] ; returns 10 +@prod [1 2 3 4] ; returns 24 diff --git a/Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-1.jq b/Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-1.jq new file mode 100644 index 0000000000..682d9ae81c --- /dev/null +++ b/Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-1.jq @@ -0,0 +1,2 @@ +[4,6,8] | add +# => 18 diff --git a/Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-2.jq b/Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-2.jq new file mode 100644 index 0000000000..faa51c37a0 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-2.jq @@ -0,0 +1,2 @@ +[range(2;5) * 2] | add +# => 18 diff --git a/Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-3.jq b/Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-3.jq new file mode 100644 index 0000000000..d11e89aac9 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-3.jq @@ -0,0 +1 @@ +def prod: reduce .[] as $i (1; . * $i); diff --git a/Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-4.jq b/Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-4.jq new file mode 100644 index 0000000000..e91a2acd15 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-4.jq @@ -0,0 +1,2 @@ +[4,6,8] | prod + # => 192 diff --git a/Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-5.jq b/Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-5.jq new file mode 100644 index 0000000000..5ac87dbfc1 --- /dev/null +++ b/Task/Sum-and-product-of-an-array/jq/sum-and-product-of-an-array-5.jq @@ -0,0 +1,2 @@ +[range(1;11)] | prod +# =>3628800 diff --git a/Task/Sum-digits-of-an-integer/Ezhil/sum-digits-of-an-integer.ezhil b/Task/Sum-digits-of-an-integer/Ezhil/sum-digits-of-an-integer.ezhil new file mode 100644 index 0000000000..62f45eb6ce --- /dev/null +++ b/Task/Sum-digits-of-an-integer/Ezhil/sum-digits-of-an-integer.ezhil @@ -0,0 +1,19 @@ +# இது ஒரு எழில் தமிழ் நிரலாக்க மொழி உதாரணம் + +# sum of digits of a number +# எண்ணிக்கையிலான இலக்கங்களின் தொகை + +நிரல்பாகம் எண்_கூட்டல்( எண் ) + தொகை = 0 + @( எண் > 0 ) வரை + d = எண்%10; + பதிப்பி "digit = ",d + எண் = (எண்-d)/10; + தொகை = தொகை + d + முடி + பின்கொடு தொகை +முடி + + +பதிப்பி எண்_கூட்டல்( 1289)#20 +பதிப்பி எண்_கூட்டல்( 123456789)# 45 diff --git a/Task/Sum-digits-of-an-integer/FreeBASIC/sum-digits-of-an-integer.freebasic b/Task/Sum-digits-of-an-integer/FreeBASIC/sum-digits-of-an-integer.freebasic new file mode 100644 index 0000000000..dee5ff7618 --- /dev/null +++ b/Task/Sum-digits-of-an-integer/FreeBASIC/sum-digits-of-an-integer.freebasic @@ -0,0 +1,22 @@ +' FB 1.05.0 Win64 + +Function SumDigits(number As Integer, nBase As Integer) As Integer + If number < 0 Then number = -number ' convert negative numbers to positive + If nBase < 2 Then nBase = 2 ' nBase can't be less than 2 + Dim As Integer sum = 0 + While number > 0 + sum += number Mod nBase + number \= nBase + Wend + Return sum +End Function + +Print "The sums of the digits are:" +Print +Print "1 base 10 :"; SumDigits(1, 10) +Print "1234 base 10 :"; SumDigits(1234, 10) +Print "fe base 16 :"; SumDigits(&Hfe, 16) +Print "f0e base 16 :"; SumDigits(&Hf0e, 16) +Print +Print "Press any key to quit the program" +Sleep diff --git a/Task/Sum-digits-of-an-integer/Lasso/sum-digits-of-an-integer.lasso b/Task/Sum-digits-of-an-integer/Lasso/sum-digits-of-an-integer.lasso new file mode 100644 index 0000000000..046cfb4121 --- /dev/null +++ b/Task/Sum-digits-of-an-integer/Lasso/sum-digits-of-an-integer.lasso @@ -0,0 +1,25 @@ +define br => '
\n' + +define sumdigits(int, base = 10) => { + fail_if(#base < 2, -1, 'Base need to be at least 2') + local( + out = integer, + divmod + ) + while(#int) => { + #divmod = #int -> div(#base) + #int = #divmod -> first + #out += #divmod -> second + } + return #out +} + +sumdigits(1) +br +sumdigits(12345) +br +sumdigits(123045) +br +sumdigits(0xfe, 16) +br +sumdigits(0xf0e, 16) diff --git a/Task/Sum-digits-of-an-integer/Lingo/sum-digits-of-an-integer-1.lingo b/Task/Sum-digits-of-an-integer/Lingo/sum-digits-of-an-integer-1.lingo new file mode 100644 index 0000000000..8698f34b23 --- /dev/null +++ b/Task/Sum-digits-of-an-integer/Lingo/sum-digits-of-an-integer-1.lingo @@ -0,0 +1,9 @@ +on sum_digits (n, base) + sum = 0 + repeat while n + m = n / base + sum = sum + n - m * base + n = m + end repeat + return sum +end diff --git a/Task/Sum-digits-of-an-integer/Lingo/sum-digits-of-an-integer-2.lingo b/Task/Sum-digits-of-an-integer/Lingo/sum-digits-of-an-integer-2.lingo new file mode 100644 index 0000000000..55e79b24a2 --- /dev/null +++ b/Task/Sum-digits-of-an-integer/Lingo/sum-digits-of-an-integer-2.lingo @@ -0,0 +1,8 @@ +put sum_digits(1, 10) +-- 1 +put sum_digits(1234, 10) +-- 10 +put sum_digits(254, 16) -- 0xfe +-- 29 +put sum_digits(3854, 16) -- 0xf0e +-- 29 diff --git a/Task/Sum-digits-of-an-integer/LiveCode/sum-digits-of-an-integer-1.livecode b/Task/Sum-digits-of-an-integer/LiveCode/sum-digits-of-an-integer-1.livecode new file mode 100644 index 0000000000..5f6d9d252b --- /dev/null +++ b/Task/Sum-digits-of-an-integer/LiveCode/sum-digits-of-an-integer-1.livecode @@ -0,0 +1,8 @@ +function sumDigits n, base + local numb + if base is empty then put 10 into base + repeat for each char d in n + add baseConvert(d,base,10) to numb + end repeat + return numb +end sumDigits diff --git a/Task/Sum-digits-of-an-integer/LiveCode/sum-digits-of-an-integer-2.livecode b/Task/Sum-digits-of-an-integer/LiveCode/sum-digits-of-an-integer-2.livecode new file mode 100644 index 0000000000..a1df5763a1 --- /dev/null +++ b/Task/Sum-digits-of-an-integer/LiveCode/sum-digits-of-an-integer-2.livecode @@ -0,0 +1,4 @@ +put sumdigits(1,10) & comma & \ + sumdigits(1234,10) & comma & \ + sumdigits(fe,16) & comma & \ + sumdigits(f0e,16) diff --git a/Task/Sum-digits-of-an-integer/LiveCode/sum-digits-of-an-integer-3.livecode b/Task/Sum-digits-of-an-integer/LiveCode/sum-digits-of-an-integer-3.livecode new file mode 100644 index 0000000000..f24080eedb --- /dev/null +++ b/Task/Sum-digits-of-an-integer/LiveCode/sum-digits-of-an-integer-3.livecode @@ -0,0 +1 @@ +1,10,29,29 diff --git a/Task/Sum-digits-of-an-integer/Nim/sum-digits-of-an-integer.nim b/Task/Sum-digits-of-an-integer/Nim/sum-digits-of-an-integer.nim new file mode 100644 index 0000000000..931dfa5b5c --- /dev/null +++ b/Task/Sum-digits-of-an-integer/Nim/sum-digits-of-an-integer.nim @@ -0,0 +1,11 @@ +proc sumdigits(n, base: Natural): Natural = + var n = n + while n > 0: + result += n mod base + n = n div base + +echo sumDigits(1, 10) +echo sumDigits(12345, 10) +echo sumDigits(123045, 10) +echo sumDigits(0xfe, 16) +echo sumDigits(0xf0e, 16) diff --git a/Task/Sum-digits-of-an-integer/Oforth/sum-digits-of-an-integer-1.oforth b/Task/Sum-digits-of-an-integer/Oforth/sum-digits-of-an-integer-1.oforth new file mode 100644 index 0000000000..626eba989f --- /dev/null +++ b/Task/Sum-digits-of-an-integer/Oforth/sum-digits-of-an-integer-1.oforth @@ -0,0 +1 @@ +: sumDigits(n, base) 0 while( n ) [ n base /mod ->n + ] ; diff --git a/Task/Sum-digits-of-an-integer/Oforth/sum-digits-of-an-integer-2.oforth b/Task/Sum-digits-of-an-integer/Oforth/sum-digits-of-an-integer-2.oforth new file mode 100644 index 0000000000..408acca49a --- /dev/null +++ b/Task/Sum-digits-of-an-integer/Oforth/sum-digits-of-an-integer-2.oforth @@ -0,0 +1,4 @@ +sumDigits(1, 10) println +sumDigits(1234, 10) println +sumDigits(0xfe, 16) println +sumDigits(0xf0e, 16) println diff --git a/Task/Sum-digits-of-an-integer/Phix/sum-digits-of-an-integer.phix b/Task/Sum-digits-of-an-integer/Phix/sum-digits-of-an-integer.phix new file mode 100644 index 0000000000..af1cd7f2bb --- /dev/null +++ b/Task/Sum-digits-of-an-integer/Phix/sum-digits-of-an-integer.phix @@ -0,0 +1,13 @@ +function sum_digits(integer n, integer base) +integer res = 0 + while n do + res += remainder(n,base) + n = floor(n/base) + end while + return res +end function + +?sum_digits(1,10) +?sum_digits(1234,10) +?sum_digits(#FE,16) +?sum_digits(#F0E,16) diff --git a/Task/Sum-digits-of-an-integer/Ring/sum-digits-of-an-integer.ring b/Task/Sum-digits-of-an-integer/Ring/sum-digits-of-an-integer.ring new file mode 100644 index 0000000000..c81d7f35fb --- /dev/null +++ b/Task/Sum-digits-of-an-integer/Ring/sum-digits-of-an-integer.ring @@ -0,0 +1,12 @@ +see "sum digits of 1 = " + sumDigits(1) + nl +see "sum digits of 1234 = " + sumDigits(1234) + nl + +func sumDigits n + sum = 0 + while n > 0.5 + m = floor(n / 10) + digit = n - m * 10 + sum = sum + digit + n = m + end + return sum diff --git a/Task/Sum-digits-of-an-integer/Sidef/sum-digits-of-an-integer.sidef b/Task/Sum-digits-of-an-integer/Sidef/sum-digits-of-an-integer.sidef new file mode 100644 index 0000000000..bf4f5af3c2 --- /dev/null +++ b/Task/Sum-digits-of-an-integer/Sidef/sum-digits-of-an-integer.sidef @@ -0,0 +1,7 @@ +func Σ(String str, base=36) { + str.chars.map{ Num(_, base) }.sum +} + +<1 1234 1020304 fe f0e DEADBEEF>.each { |n| + say "Σ(#{n}) = #{Σ(n)}" +} diff --git a/Task/Sum-digits-of-an-integer/Swift/sum-digits-of-an-integer-1.swift b/Task/Sum-digits-of-an-integer/Swift/sum-digits-of-an-integer-1.swift new file mode 100644 index 0000000000..2251af7e11 --- /dev/null +++ b/Task/Sum-digits-of-an-integer/Swift/sum-digits-of-an-integer-1.swift @@ -0,0 +1,6 @@ +let number = 1234 +let base = 10 + +println(number.toString(base: base).characters + .map { char in String(char).toInt(base: 10) } + .reduce(0, combine: +)) diff --git a/Task/Sum-digits-of-an-integer/Swift/sum-digits-of-an-integer-2.swift b/Task/Sum-digits-of-an-integer/Swift/sum-digits-of-an-integer-2.swift new file mode 100644 index 0000000000..325d18df55 --- /dev/null +++ b/Task/Sum-digits-of-an-integer/Swift/sum-digits-of-an-integer-2.swift @@ -0,0 +1,8 @@ +let number = 0xfe +let base = 16 + +// Except toString which is from ContestKit everything +// else used here is defined in Swift Standard Library +print(number.toString(base: base).characters + .map { char in Int(String(char), radix: base)! } + .reduce(0, combine: +)) diff --git a/Task/Sum-digits-of-an-integer/Ursa/sum-digits-of-an-integer-1.ursa b/Task/Sum-digits-of-an-integer/Ursa/sum-digits-of-an-integer-1.ursa new file mode 100644 index 0000000000..737d12d5af --- /dev/null +++ b/Task/Sum-digits-of-an-integer/Ursa/sum-digits-of-an-integer-1.ursa @@ -0,0 +1,7 @@ +def sumDigits (string val, int base) + decl int ret + for (decl int i) (< i (size val)) (inc i) + set ret (+ ret (int val base)) + end for + return ret +end sumDigits diff --git a/Task/Sum-digits-of-an-integer/Ursa/sum-digits-of-an-integer-2.ursa b/Task/Sum-digits-of-an-integer/Ursa/sum-digits-of-an-integer-2.ursa new file mode 100644 index 0000000000..916e59c288 --- /dev/null +++ b/Task/Sum-digits-of-an-integer/Ursa/sum-digits-of-an-integer-2.ursa @@ -0,0 +1,4 @@ +out (sumDigits "1" 10) endl console +out (sumDigits "1234" 10) endl console +out (sumDigits "fe" 16) endl console +out (sumDigits "f0e" 16) endl console diff --git a/Task/Sum-digits-of-an-integer/jq/sum-digits-of-an-integer-1.jq b/Task/Sum-digits-of-an-integer/jq/sum-digits-of-an-integer-1.jq new file mode 100644 index 0000000000..82aad12900 --- /dev/null +++ b/Task/Sum-digits-of-an-integer/jq/sum-digits-of-an-integer-1.jq @@ -0,0 +1 @@ +tostring | explode | map(tonumber - 48) | add diff --git a/Task/Sum-digits-of-an-integer/jq/sum-digits-of-an-integer-2.jq b/Task/Sum-digits-of-an-integer/jq/sum-digits-of-an-integer-2.jq new file mode 100644 index 0000000000..69c6d62964 --- /dev/null +++ b/Task/Sum-digits-of-an-integer/jq/sum-digits-of-an-integer-2.jq @@ -0,0 +1,5 @@ +$ jq -M 'tostring | explode | map(tonumber - 48) | add' +123 +6 +"123" +6 diff --git a/Task/Sum-multiples-of-3-and-5/EchoLisp/sum-multiples-of-3-and-5.echolisp b/Task/Sum-multiples-of-3-and-5/EchoLisp/sum-multiples-of-3-and-5.echolisp new file mode 100644 index 0000000000..98cb32dfe9 --- /dev/null +++ b/Task/Sum-multiples-of-3-and-5/EchoLisp/sum-multiples-of-3-and-5.echolisp @@ -0,0 +1,33 @@ +(lib 'math) ;; divides? +(lib 'sequences) ;; sum/when + +(define (task n (k 3) (p 5 )) + (when (!= (gcd k p) 1) (error "expected coprimes" (list k p))) + (- + (+ (sum/mults n k) (sum/mults n p)) ;; add multiples of k , multiples of p + (sum/mults n (* k p)))) ;; remove multiples of k * p + +;; using sequences +;; sum of multiples of k < n + +(define (sum/mults n k) + (sum/when (rcurry divides? k) [1 .. n])) + +(task 1000 3 5) + → 233168 + +;; using simple arithmetic - 🎩 young Gauss formula +;; sum of multiples of k < n = +;; k*m*(m+1)/2 where m = floor(n/k) +(lib 'bigint) + +(define (sum/mults n k) + (set! n (quotient (1- n) k)) + (/ (* k n (1+ n )) 2)) + +(task 1e20 3 5) + → 2333333333333333333316666666666666666668 + +(task 1000 42 666) + ❌ error: expected coprimes (42 666) + diff --git a/Task/Sum-multiples-of-3-and-5/FreeBASIC/sum-multiples-of-3-and-5.freebasic b/Task/Sum-multiples-of-3-and-5/FreeBASIC/sum-multiples-of-3-and-5.freebasic new file mode 100644 index 0000000000..6cce2b6b2d --- /dev/null +++ b/Task/Sum-multiples-of-3-and-5/FreeBASIC/sum-multiples-of-3-and-5.freebasic @@ -0,0 +1,15 @@ +' FB 1.05.0 Win64 + +Function sum35 (n As UInteger) As UInteger + If n = 0 Then Return 0 + Dim As UInteger i, sum = 0 + For i = 1 To n + If (i Mod 3 = 0) OrElse (i Mod 5 = 0) Then sum += i + Next + Return sum +End Function + +Print "Sum of positive integers below 1000 divisible by 3 or 5 is : "; sum35(999) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Sum-multiples-of-3-and-5/Lasso/sum-multiples-of-3-and-5.lasso b/Task/Sum-multiples-of-3-and-5/Lasso/sum-multiples-of-3-and-5.lasso new file mode 100644 index 0000000000..aa0e5dc48b --- /dev/null +++ b/Task/Sum-multiples-of-3-and-5/Lasso/sum-multiples-of-3-and-5.lasso @@ -0,0 +1,9 @@ +local(limit = 1) +while(#limit <= 100000) => {^ + local(s = 0) + loop(-from=3,-to=#limit-1) => { + not (loop_count % 3) || not (loop_count % 5) ? #s += loop_count + } + 'The sum of multiples of 3 or 5 between 1 and '+(#limit-1)+' is: '+#s+'\r' + #limit = integer(#limit->asString + '0') +^} diff --git a/Task/Sum-multiples-of-3-and-5/Lingo/sum-multiples-of-3-and-5-1.lingo b/Task/Sum-multiples-of-3-and-5/Lingo/sum-multiples-of-3-and-5-1.lingo new file mode 100644 index 0000000000..46311e7cbe --- /dev/null +++ b/Task/Sum-multiples-of-3-and-5/Lingo/sum-multiples-of-3-and-5-1.lingo @@ -0,0 +1,9 @@ +on sum35 (n) + res = 0 + repeat with i = 0 to (n-1) + if i mod 3=0 OR i mod 5=0 then + res = res + i + end if + end repeat + return res +end diff --git a/Task/Sum-multiples-of-3-and-5/Lingo/sum-multiples-of-3-and-5-2.lingo b/Task/Sum-multiples-of-3-and-5/Lingo/sum-multiples-of-3-and-5-2.lingo new file mode 100644 index 0000000000..7fefe6a909 --- /dev/null +++ b/Task/Sum-multiples-of-3-and-5/Lingo/sum-multiples-of-3-and-5-2.lingo @@ -0,0 +1,2 @@ +put sum35(1000) +-- 233168 diff --git a/Task/Sum-multiples-of-3-and-5/LiveCode/sum-multiples-of-3-and-5.livecode b/Task/Sum-multiples-of-3-and-5/LiveCode/sum-multiples-of-3-and-5.livecode new file mode 100644 index 0000000000..6e907d01a2 --- /dev/null +++ b/Task/Sum-multiples-of-3-and-5/LiveCode/sum-multiples-of-3-and-5.livecode @@ -0,0 +1,10 @@ +function sumUntil n + repeat with i = 0 to (n-1) + if i mod 3 = 0 or i mod 5 = 0 then + add i to m + end if + end repeat + return m +end sumUntil + +put sumUntil(1000) // 233168 diff --git a/Task/Sum-multiples-of-3-and-5/Nim/sum-multiples-of-3-and-5-1.nim b/Task/Sum-multiples-of-3-and-5/Nim/sum-multiples-of-3-and-5-1.nim new file mode 100644 index 0000000000..509597547c --- /dev/null +++ b/Task/Sum-multiples-of-3-and-5/Nim/sum-multiples-of-3-and-5-1.nim @@ -0,0 +1,6 @@ +proc sum35(n: int): int = + for x in 0 .. 233168 + +10e20 | task(3;5) # => 2.333333333333333e+41 diff --git a/Task/Sum-of-a-series/EchoLisp/sum-of-a-series.echolisp b/Task/Sum-of-a-series/EchoLisp/sum-of-a-series.echolisp new file mode 100644 index 0000000000..5441fb23df --- /dev/null +++ b/Task/Sum-of-a-series/EchoLisp/sum-of-a-series.echolisp @@ -0,0 +1,8 @@ +(lib 'math) ;; for (sigma f(n) nfrom nto) function +(Σ (λ(n) (// (* n n))) 1 1000) +;; or +(sigma (lambda(n) (// (* n n))) 1 1000) + → 1.6439345666815615 + +(// (* PI PI) 6) + → 1.6449340668482264 diff --git a/Task/Sum-of-a-series/Ezhil/sum-of-a-series.ezhil b/Task/Sum-of-a-series/Ezhil/sum-of-a-series.ezhil new file mode 100644 index 0000000000..4144431981 --- /dev/null +++ b/Task/Sum-of-a-series/Ezhil/sum-of-a-series.ezhil @@ -0,0 +1,24 @@ +## இந்த நிரல் தொடர் கூட்டல் (Sum Of Series) என்ற வகையைச் சேர்ந்தது + +## இந்த நிரல் ஒன்று முதல் தரப்பட்ட எண் வரை 1/(எண் * எண்) எனக் கணக்கிட்டுக் கூட்டி விடை தரும் + +நிரல்பாகம் தொடர்க்கூட்டல்(எண்1) + + எண்2 = 0 + + @(எண்3 = 1, எண்3 <= எண்1, எண்3 = எண்3 + 1) ஆக + + ## ஒவ்வோர் எண்ணின் வர்க்கத்தைக் கணக்கிட்டு, ஒன்றை அதனால் வகுத்துக் கூட்டுகிறோம் + + எண்2 = எண்2 + (1 / (எண்3 * எண்3)) + + முடி + + பின்கொடு (எண்2) + +முடி + +அ = int(உள்ளீடு("ஓர் எண்ணைச் சொல்லுங்கள்: ")) + +பதிப்பி "நீங்கள் தந்த எண் " அ +பதிப்பி "அதன் தொடர்க் கூட்டல் " தொடர்க்கூட்டல்(அ) diff --git a/Task/Sum-of-a-series/FreeBASIC/sum-of-a-series.freebasic b/Task/Sum-of-a-series/FreeBASIC/sum-of-a-series.freebasic new file mode 100644 index 0000000000..281c671155 --- /dev/null +++ b/Task/Sum-of-a-series/FreeBASIC/sum-of-a-series.freebasic @@ -0,0 +1,18 @@ +' FB 1.05.0 Win64 + +Const pi As Double = 3.141592653589793 + +Function sumSeries (n As UInteger) As Double + If n = 0 Then Return 0 + Dim sum As Double = 0 + For k As Integer = 1 To n + sum += 1.0/(k * k) + Next + Return sum +End Function + +Print "s(1000) = "; sumSeries(1000) +Print "zeta(2) = "; Pi * pi / 6 +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Sum-of-a-series/GEORGE/sum-of-a-series.george b/Task/Sum-of-a-series/GEORGE/sum-of-a-series.george new file mode 100644 index 0000000000..314a9b431e --- /dev/null +++ b/Task/Sum-of-a-series/GEORGE/sum-of-a-series.george @@ -0,0 +1,5 @@ +0 (s) +1, 1000 rep (i) + s 1 i dup × / + (s) ; +] +P diff --git a/Task/Sum-of-a-series/LFE/sum-of-a-series-1.lfe b/Task/Sum-of-a-series/LFE/sum-of-a-series-1.lfe new file mode 100644 index 0000000000..f8b51ccc25 --- /dev/null +++ b/Task/Sum-of-a-series/LFE/sum-of-a-series-1.lfe @@ -0,0 +1,7 @@ +(defun sum-series (nums) + (lists:foldl + #'+/2 + 0 + (lists:map + (lambda (x) (/ 1 x x)) + nums))) diff --git a/Task/Sum-of-a-series/LFE/sum-of-a-series-2.lfe b/Task/Sum-of-a-series/LFE/sum-of-a-series-2.lfe new file mode 100644 index 0000000000..e204801ba1 --- /dev/null +++ b/Task/Sum-of-a-series/LFE/sum-of-a-series-2.lfe @@ -0,0 +1,5 @@ +(defun sum-series (nums) + (lists:sum + (lists:map + (lambda (x) (/ 1 x x)) + nums))) diff --git a/Task/Sum-of-a-series/LFE/sum-of-a-series-3.lfe b/Task/Sum-of-a-series/LFE/sum-of-a-series-3.lfe new file mode 100644 index 0000000000..ab7f14b438 --- /dev/null +++ b/Task/Sum-of-a-series/LFE/sum-of-a-series-3.lfe @@ -0,0 +1,2 @@ +> (sum-series (lists:seq 1 100000)) +1.6449240668982423 diff --git a/Task/Sum-of-a-series/Lasso/sum-of-a-series.lasso b/Task/Sum-of-a-series/Lasso/sum-of-a-series.lasso new file mode 100644 index 0000000000..ffb7df622d --- /dev/null +++ b/Task/Sum-of-a-series/Lasso/sum-of-a-series.lasso @@ -0,0 +1,8 @@ +define sum_of_a_series(n::integer,k::integer) => { + local(sum = 0) + loop(-from=#k,-to=#n) => { + #sum += 1.00/(math_pow(loop_count,2)) + } + return #sum +} +sum_of_a_series(1000,1) diff --git a/Task/Sum-of-a-series/Lingo/sum-of-a-series.lingo b/Task/Sum-of-a-series/Lingo/sum-of-a-series.lingo new file mode 100644 index 0000000000..910782ab41 --- /dev/null +++ b/Task/Sum-of-a-series/Lingo/sum-of-a-series.lingo @@ -0,0 +1,7 @@ +the floatprecision = 8 +sum = 0 +repeat with i = 1 to 1000 + sum = sum + 1/power(i, 2) +end repeat +put sum +-- 1.64393457 diff --git a/Task/Sum-of-a-series/LiveCode/sum-of-a-series.livecode b/Task/Sum-of-a-series/LiveCode/sum-of-a-series.livecode new file mode 100644 index 0000000000..142d9ac051 --- /dev/null +++ b/Task/Sum-of-a-series/LiveCode/sum-of-a-series.livecode @@ -0,0 +1,4 @@ +repeat with i = 1 to 1000 + add 1/(i^2) to summ +end repeat +put summ //1.643935 diff --git a/Task/Sum-of-a-series/Nim/sum-of-a-series.nim b/Task/Sum-of-a-series/Nim/sum-of-a-series.nim new file mode 100644 index 0000000000..81fdbe7778 --- /dev/null +++ b/Task/Sum-of-a-series/Nim/sum-of-a-series.nim @@ -0,0 +1,6 @@ +import math + +var ls: seq[float] = @[] +for x in 1..1000: + ls.add(1.0 / float(x * x)) +echo sum(ls) diff --git a/Task/Sum-of-a-series/Oforth/sum-of-a-series-1.oforth b/Task/Sum-of-a-series/Oforth/sum-of-a-series-1.oforth new file mode 100644 index 0000000000..7298bcbf65 --- /dev/null +++ b/Task/Sum-of-a-series/Oforth/sum-of-a-series-1.oforth @@ -0,0 +1 @@ +: sumSerie(s, n) 0 n seq apply(#[ s perform + ]) ; diff --git a/Task/Sum-of-a-series/Oforth/sum-of-a-series-2.oforth b/Task/Sum-of-a-series/Oforth/sum-of-a-series-2.oforth new file mode 100644 index 0000000000..df7ba7e19a --- /dev/null +++ b/Task/Sum-of-a-series/Oforth/sum-of-a-series-2.oforth @@ -0,0 +1 @@ + #[ sq inv ] 1000 sumSerie println diff --git a/Task/Sum-of-a-series/Panda/sum-of-a-series.panda b/Task/Sum-of-a-series/Panda/sum-of-a-series.panda new file mode 100644 index 0000000000..116e7a62d2 --- /dev/null +++ b/Task/Sum-of-a-series/Panda/sum-of-a-series.panda @@ -0,0 +1 @@ +sum{{1.0.divide(1..1000.sqr)}} diff --git a/Task/Sum-of-a-series/Phix/sum-of-a-series.phix b/Task/Sum-of-a-series/Phix/sum-of-a-series.phix new file mode 100644 index 0000000000..dca386a4ca --- /dev/null +++ b/Task/Sum-of-a-series/Phix/sum-of-a-series.phix @@ -0,0 +1,8 @@ +function sumto(atom n) +atom res = 0 + for i=1 to n do + res += 1/(i*i) + end for + return res +end function +?sumto(1000) diff --git a/Task/Sum-of-a-series/Potion/sum-of-a-series.potion b/Task/Sum-of-a-series/Potion/sum-of-a-series.potion new file mode 100644 index 0000000000..4e9609f833 --- /dev/null +++ b/Task/Sum-of-a-series/Potion/sum-of-a-series.potion @@ -0,0 +1,3 @@ +sum = 0.0 +1 to 1000 (i): sum = sum + 1.0 / (i * i). +sum print diff --git a/Task/Sum-of-a-series/Ring/sum-of-a-series.ring b/Task/Sum-of-a-series/Ring/sum-of-a-series.ring new file mode 100644 index 0000000000..ae8b881e1d --- /dev/null +++ b/Task/Sum-of-a-series/Ring/sum-of-a-series.ring @@ -0,0 +1,6 @@ +sum = 0 +for i =1 to 1000 + sum = sum + 1 /(pow(i,2)) +next +decimals(8) +see sum diff --git a/Task/Sum-of-a-series/Sidef/sum-of-a-series-1.sidef b/Task/Sum-of-a-series/Sidef/sum-of-a-series-1.sidef new file mode 100644 index 0000000000..0d799cc4b3 --- /dev/null +++ b/Task/Sum-of-a-series/Sidef/sum-of-a-series-1.sidef @@ -0,0 +1 @@ +say sum(1..1000, {|n| 1 / n**2 }) diff --git a/Task/Sum-of-a-series/Sidef/sum-of-a-series-2.sidef b/Task/Sum-of-a-series/Sidef/sum-of-a-series-2.sidef new file mode 100644 index 0000000000..1b6cd079fa --- /dev/null +++ b/Task/Sum-of-a-series/Sidef/sum-of-a-series-2.sidef @@ -0,0 +1 @@ +say (1..1000 -> reduce { |a,b| a + (1 / b**2) }) diff --git a/Task/Sum-of-a-series/Swift/sum-of-a-series-1.swift b/Task/Sum-of-a-series/Swift/sum-of-a-series-1.swift new file mode 100644 index 0000000000..d59d3b3ce1 --- /dev/null +++ b/Task/Sum-of-a-series/Swift/sum-of-a-series-1.swift @@ -0,0 +1,11 @@ +func sumSeries(var n: Int) -> Double { + var ret: Double = 0 + + for i in 1...n { + ret += (1 / pow(Double(i), 2)) + } + + return ret +} + +output: 1.64393456668156 diff --git a/Task/Sum-of-a-series/Swift/sum-of-a-series-2.swift b/Task/Sum-of-a-series/Swift/sum-of-a-series-2.swift new file mode 100644 index 0000000000..8f528c1f14 --- /dev/null +++ b/Task/Sum-of-a-series/Swift/sum-of-a-series-2.swift @@ -0,0 +1,22 @@ +Swift also allows extension to datatypes. Here's similar code using an extension to Int. + +extension Int { + func SumSeries() -> Double { + var ret: Double = 0 + + for i in 1...self { + ret += (1 / pow(Double(i), 2)) + } + + return ret + } +} + +var x: Int = 1000 +var y: Double + +y = x.sumSeries() /* y = 1.64393456668156 */ + +Swift also allows you to do this: + +y = 1000.sumSeries() diff --git a/Task/Sum-of-a-series/Wortel/sum-of-a-series-1.wortel b/Task/Sum-of-a-series/Wortel/sum-of-a-series-1.wortel new file mode 100644 index 0000000000..2355104123 --- /dev/null +++ b/Task/Sum-of-a-series/Wortel/sum-of-a-series-1.wortel @@ -0,0 +1 @@ +@sum !*#~V1Sn @to 1000 ; returns 1.6439345666815615 diff --git a/Task/Sum-of-a-series/Wortel/sum-of-a-series-2.wortel b/Task/Sum-of-a-series/Wortel/sum-of-a-series-2.wortel new file mode 100644 index 0000000000..64bfb55571 --- /dev/null +++ b/Task/Sum-of-a-series/Wortel/sum-of-a-series-2.wortel @@ -0,0 +1,4 @@ +@to 1000 ; generates a list of 1 to 1000 (inclusive) +#~V1Sn ; number expression which stands for: square push(1) swap divide +!* ; maps the number expression over the list +@sum ; sums the list diff --git a/Task/Sum-of-a-series/jq/sum-of-a-series-1.jq b/Task/Sum-of-a-series/jq/sum-of-a-series-1.jq new file mode 100644 index 0000000000..400323dd61 --- /dev/null +++ b/Task/Sum-of-a-series/jq/sum-of-a-series-1.jq @@ -0,0 +1,3 @@ +def s(n): reduce range(1; n+1) as $k (0; . + 1/($k * $k) ); + +s(1000) diff --git a/Task/Sum-of-a-series/jq/sum-of-a-series-2.jq b/Task/Sum-of-a-series/jq/sum-of-a-series-2.jq new file mode 100644 index 0000000000..2812580144 --- /dev/null +++ b/Task/Sum-of-a-series/jq/sum-of-a-series-2.jq @@ -0,0 +1,3 @@ +def summation(s): reduce s as $k (0; . + $k); + +summation( range(1; 1001) | (1/(. * .) ) ) diff --git a/Task/Sum-of-squares/FreeBASIC/sum-of-squares.freebasic b/Task/Sum-of-squares/FreeBASIC/sum-of-squares.freebasic new file mode 100644 index 0000000000..f0b6493437 --- /dev/null +++ b/Task/Sum-of-squares/FreeBASIC/sum-of-squares.freebasic @@ -0,0 +1,18 @@ +' FB 1.05.0 Win64 + +Function SumSquares(a() As Double) As Double + Dim As Integer length = UBound(a) - LBound(a) + 1 + If length = 0 Then Return 0.0 + Dim As Double sum = 0.0 + For i As Integer = LBound(a) To UBound(a) + sum += a(i) * a(i) + Next + Return sum +End Function + +Dim a(5) As Double = {1.0, 2.0, 3.0, -1.0, -2.0, -3.0} +Dim sum As Double = SumSquares(a()) +Print "The sum of the squares is"; sum +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Sum-of-squares/GEORGE/sum-of-squares.george b/Task/Sum-of-squares/GEORGE/sum-of-squares.george new file mode 100644 index 0000000000..2691505d4b --- /dev/null +++ b/Task/Sum-of-squares/GEORGE/sum-of-squares.george @@ -0,0 +1,6 @@ +read (n) print ; +0 +1, n rep (i) + read print dup mult + + ] +print diff --git a/Task/Sum-of-squares/LFE/sum-of-squares-1.lfe b/Task/Sum-of-squares/LFE/sum-of-squares-1.lfe new file mode 100644 index 0000000000..4f63e6b193 --- /dev/null +++ b/Task/Sum-of-squares/LFE/sum-of-squares-1.lfe @@ -0,0 +1,5 @@ +(defun sum-sq (nums) + (lists:foldl + (lambda (x acc) + (+ acc (* x x))) + 0 nums)) diff --git a/Task/Sum-of-squares/LFE/sum-of-squares-2.lfe b/Task/Sum-of-squares/LFE/sum-of-squares-2.lfe new file mode 100644 index 0000000000..5d1c43ead3 --- /dev/null +++ b/Task/Sum-of-squares/LFE/sum-of-squares-2.lfe @@ -0,0 +1,2 @@ +> (sum-sq '(3 1 4 1 5 9)) +133 diff --git a/Task/Sum-of-squares/Lasso/sum-of-squares.lasso b/Task/Sum-of-squares/Lasso/sum-of-squares.lasso new file mode 100644 index 0000000000..169dadcf09 --- /dev/null +++ b/Task/Sum-of-squares/Lasso/sum-of-squares.lasso @@ -0,0 +1,12 @@ +define sumofsquares(values::array) => { + + local(sum = 0) + + with value in #values do { + #sum += #value * #value + } + + return #sum +} + +sumofsquares(array(1,2,3,4,5)) diff --git a/Task/Sum-of-squares/LiveCode/sum-of-squares.livecode b/Task/Sum-of-squares/LiveCode/sum-of-squares.livecode new file mode 100644 index 0000000000..2098393ae2 --- /dev/null +++ b/Task/Sum-of-squares/LiveCode/sum-of-squares.livecode @@ -0,0 +1,5 @@ +put "1,2,3,4,5" into nums +repeat for each item n in nums + add (n * n) to m +end repeat +put m // 55 diff --git a/Task/Sum-of-squares/Nim/sum-of-squares.nim b/Task/Sum-of-squares/Nim/sum-of-squares.nim new file mode 100644 index 0000000000..b891c365b3 --- /dev/null +++ b/Task/Sum-of-squares/Nim/sum-of-squares.nim @@ -0,0 +1,3 @@ +import math, sequtils + +echo sum(map(@[1,2,3,4,5], proc (x: int): int = x*x)) diff --git a/Task/Sum-of-squares/Oforth/sum-of-squares.oforth b/Task/Sum-of-squares/Oforth/sum-of-squares.oforth new file mode 100644 index 0000000000..024afcd0f7 --- /dev/null +++ b/Task/Sum-of-squares/Oforth/sum-of-squares.oforth @@ -0,0 +1 @@ +#sq [1, 1.2, 3, 4.5 ] map sum diff --git a/Task/Sum-of-squares/Phix/sum-of-squares.phix b/Task/Sum-of-squares/Phix/sum-of-squares.phix new file mode 100644 index 0000000000..f0d7e76e40 --- /dev/null +++ b/Task/Sum-of-squares/Phix/sum-of-squares.phix @@ -0,0 +1 @@ +?sum(sq_power(tagset(10),2)) -- prints 385 diff --git a/Task/Sum-of-squares/Ring/sum-of-squares.ring b/Task/Sum-of-squares/Ring/sum-of-squares.ring new file mode 100644 index 0000000000..18c958d13f --- /dev/null +++ b/Task/Sum-of-squares/Ring/sum-of-squares.ring @@ -0,0 +1,9 @@ +aList = [1,2,3,4,5] +see sumOfSquares(aList) + +func sumOfSquares sos +sumOfSquares = 0 +for i=1 to len(sos) + sumOfSquares = sumOfSquares + pow(sos[i],2) +next +return sumOfSquares diff --git a/Task/Sum-of-squares/Sidef/sum-of-squares.sidef b/Task/Sum-of-squares/Sidef/sum-of-squares.sidef new file mode 100644 index 0000000000..721391adf4 --- /dev/null +++ b/Task/Sum-of-squares/Sidef/sum-of-squares.sidef @@ -0,0 +1,8 @@ +func sum_of_squares(vector) { + var sum = 0; + vector.each { |n| sum += n**2 }; + return sum; +} + +say sum_of_squares([]); # 0 +say sum_of_squares([1,2,3]); # 14 diff --git a/Task/Sum-of-squares/Swift/sum-of-squares.swift b/Task/Sum-of-squares/Swift/sum-of-squares.swift new file mode 100644 index 0000000000..4f94226b71 --- /dev/null +++ b/Task/Sum-of-squares/Swift/sum-of-squares.swift @@ -0,0 +1,3 @@ +func sumSq(s: [Int]) -> Int { + return s.map{$0 * $0}.reduce(0, +) +} diff --git a/Task/Sum-of-squares/Wortel/sum-of-squares-1.wortel b/Task/Sum-of-squares/Wortel/sum-of-squares-1.wortel new file mode 100644 index 0000000000..aaa06fc3c5 --- /dev/null +++ b/Task/Sum-of-squares/Wortel/sum-of-squares-1.wortel @@ -0,0 +1 @@ +@sum !*^@sq [3 1 4 1 5 9] ; returns 133 diff --git a/Task/Sum-of-squares/Wortel/sum-of-squares-2.wortel b/Task/Sum-of-squares/Wortel/sum-of-squares-2.wortel new file mode 100644 index 0000000000..63dc31f9e4 --- /dev/null +++ b/Task/Sum-of-squares/Wortel/sum-of-squares-2.wortel @@ -0,0 +1 @@ +@sum !*^@sq [] ; returns 0 diff --git a/Task/Sum-of-squares/Wortel/sum-of-squares-3.wortel b/Task/Sum-of-squares/Wortel/sum-of-squares-3.wortel new file mode 100644 index 0000000000..07e9ee492d --- /dev/null +++ b/Task/Sum-of-squares/Wortel/sum-of-squares-3.wortel @@ -0,0 +1 @@ +^(@sum *^@sq) diff --git a/Task/Sum-of-squares/Wortel/sum-of-squares-4.wortel b/Task/Sum-of-squares/Wortel/sum-of-squares-4.wortel new file mode 100644 index 0000000000..442d795332 --- /dev/null +++ b/Task/Sum-of-squares/Wortel/sum-of-squares-4.wortel @@ -0,0 +1 @@ +&a [@var sum 0 @for x of a :!+sum *x x sum] diff --git a/Task/Sum-of-squares/XLISP/sum-of-squares.xlisp b/Task/Sum-of-squares/XLISP/sum-of-squares.xlisp new file mode 100644 index 0000000000..91cfed8df9 --- /dev/null +++ b/Task/Sum-of-squares/XLISP/sum-of-squares.xlisp @@ -0,0 +1,14 @@ +(defun sum-of-squares (vec) + (defun sumsq (xs) + (if (null xs) + 0 + (+ (expt (car xs) 2) (sumsq (cdr xs))))) + (sumsq (vector->list vec))) + +(define first-seven-primes #(2 3 5 7 11 13 17)) + +(define zero-length-vector #()) + +(print `(the sum of the squares of the first seven prime numbers is ,(sum-of-squares first-seven-primes))) + +(print `(the sum of the squares of no numbers at all is ,(sum-of-squares zero-length-vector))) diff --git a/Task/Sum-of-squares/jq/sum-of-squares-1.jq b/Task/Sum-of-squares/jq/sum-of-squares-1.jq new file mode 100644 index 0000000000..c094c676c5 --- /dev/null +++ b/Task/Sum-of-squares/jq/sum-of-squares-1.jq @@ -0,0 +1,5 @@ +# ss for an input array: +def ss: map(.*.) | add; + +# ss for a stream, S, without creating an intermediate array: +def ss(S): reduce S as $x (0; . + ($x * $x) ); diff --git a/Task/Sum-of-squares/jq/sum-of-squares-2.jq b/Task/Sum-of-squares/jq/sum-of-squares-2.jq new file mode 100644 index 0000000000..ac5a1d20e6 --- /dev/null +++ b/Task/Sum-of-squares/jq/sum-of-squares-2.jq @@ -0,0 +1,6 @@ +# SIGMA(exp) computes the sum of exp over the input array: +def SIGMA(exp): map(exp) | add; + +# SIGMA(exp; S) computes the sum of exp over elements of the stream, S, +# without creating an intermediate array: +def SIGMA(exp; S): reduce (S|exp) as $x (0; . + $x); diff --git a/Task/Sum-of-squares/jq/sum-of-squares-3.jq b/Task/Sum-of-squares/jq/sum-of-squares-3.jq new file mode 100644 index 0000000000..60f4b2e7a9 --- /dev/null +++ b/Task/Sum-of-squares/jq/sum-of-squares-3.jq @@ -0,0 +1,4 @@ +def mapreduce(mapper; reducer; zero): + if length == 0 then zero + else map(mapper) | reducer + end; diff --git a/Task/Sum-of-squares/jq/sum-of-squares-4.jq b/Task/Sum-of-squares/jq/sum-of-squares-4.jq new file mode 100644 index 0000000000..1995890878 --- /dev/null +++ b/Task/Sum-of-squares/jq/sum-of-squares-4.jq @@ -0,0 +1,9 @@ +def demo(n): + "ss: \( [range(0;n)] | ss )", + "ss(S): \( ss( range(0;n) ) )", + "SIGMA(.*.): \( [range(0;n)] | SIGMA(.*.) )", + "SIGMA(.*.;S): \( SIGMA( .*.; range(0;n) ) )", + "mapreduce(.*.; add; 0): \( [range(0;n)] | mapreduce(.*.; add; 0) )" +; + +demo(3) # 0^2 + 1^2 + 2^2 diff --git a/Task/Sum-of-squares/jq/sum-of-squares-5.jq b/Task/Sum-of-squares/jq/sum-of-squares-5.jq new file mode 100644 index 0000000000..a445f236f2 --- /dev/null +++ b/Task/Sum-of-squares/jq/sum-of-squares-5.jq @@ -0,0 +1,5 @@ +"ss: 5" +"ss(S): 5" +"SIGMA(.*.): 5" +"SIGMA(.*.;S): 5" +"mapreduce(.*.; add; 0): 5" diff --git a/Task/Sutherland-Hodgman-polygon-clipping/Sidef/sutherland-hodgman-polygon-clipping.sidef b/Task/Sutherland-Hodgman-polygon-clipping/Sidef/sutherland-hodgman-polygon-clipping.sidef new file mode 100644 index 0000000000..bdee8220cd --- /dev/null +++ b/Task/Sutherland-Hodgman-polygon-clipping/Sidef/sutherland-hodgman-polygon-clipping.sidef @@ -0,0 +1,53 @@ +class Point(x, y) { + method to_s { + "(#{'%.2f' % x}, #{'%.2f' % y})" + } +} + +func sutherland_hodgman(subjectPolygon, clipPolygon) { + var inside = { |cp1, cp2, p| + ((cp2.x-cp1.x)*(p.y-cp1.y)) > ((cp2.y-cp1.y)*(p.x-cp1.x)) + } + + var intersection = { |cp1, cp2, s, e| + var (dcx, dcy) = (cp1.x-cp2.x, cp1.y-cp2.y) + var (dpx, dpy) = (s.x-e.x, s.y-e.y) + var n1 = (cp1.x*cp2.y - cp1.y*cp2.x) + var n2 = (s.x*e.y - s.y*e.x) + var n3 = (1 / (dcx*dpy - dcy*dpx)) + Point((n1*dpx - n2*dcx) * n3, (n1*dpy - n2*dcy) * n3) + } + + var outputList = subjectPolygon + var cp1 = clipPolygon.last + for cp2 in clipPolygon { + var inputList = outputList + outputList = [] + var s = inputList.last + for e in inputList { + if (inside(cp1, cp2, e)) { + outputList << intersection(cp1, cp2, s, e) if !inside(cp1, cp2, s) + outputList << e + } + elsif(inside(cp1, cp2, s)) { + outputList << intersection(cp1, cp2, s, e) + } + s = e + } + cp1 = cp2 + } + outputList +} + +var subjectPolygon = [ + [50, 150], [200, 50], [350, 150], [350, 300], + [250, 300], [200, 250], [150, 350], [100, 250], + [100, 200] +].map{|pnt| Point(pnt...) } + +var clipPolygon = [ + [100, 100], [300, 100], + [300, 300], [100, 300] +].map{|pnt| Point(pnt...) } + +sutherland_hodgman(subjectPolygon, clipPolygon).each { .say } diff --git a/Task/Symmetric-difference/Apex/symmetric-difference.apex b/Task/Symmetric-difference/Apex/symmetric-difference.apex new file mode 100644 index 0000000000..61ebd19994 --- /dev/null +++ b/Task/Symmetric-difference/Apex/symmetric-difference.apex @@ -0,0 +1,28 @@ +Set setA = new Set{'John', 'Bob', 'Mary', 'Serena'}; +Set setB = new Set{'Jim', 'Mary', 'John', 'Bob'}; + +// Option 1 +Set notInSetA = setB.clone(); +notInSetA.removeAll(setA); + +Set notInSetB = setA.clone(); +notInSetB.removeAll(setB); + +Set symmetricDifference = new Set(); +symmetricDifference.addAll(notInSetA); +symmetricDifference.addAll(notInSetB); + +// Option 2 +Set union = setA.clone(); +union.addAll(setB); + +Set intersection = setA.clone(); +intersection.retainAll(setB); + +Set symmetricDifference2 = union.clone(); +symmetricDifference2.removeAll(intersection); + +System.debug('Not in set A: ' + notInSetA); +System.debug('Not in set B: ' + notInSetB); +System.debug('Symmetric Difference: ' + symmetricDifference); +System.debug('Symmetric Difference 2: ' + symmetricDifference2); diff --git a/Task/Symmetric-difference/Lasso/symmetric-difference.lasso b/Task/Symmetric-difference/Lasso/symmetric-difference.lasso new file mode 100644 index 0000000000..2e17710b1e --- /dev/null +++ b/Task/Symmetric-difference/Lasso/symmetric-difference.lasso @@ -0,0 +1,24 @@ +[ +var( + 'a' = array( + 'John' + ,'Bob' + ,'Mary' + ,'Serena' + ) + + ,'b' = array + +); + +$b->insert( 'Jim' ); // Alternate method of populating array +$b->insert( 'Mary' ); +$b->insert( 'John' ); +$b->insert( 'Bob' ); + +$a->sort( true ); // arrays must be sorted (true = ascending) for difference to work +$b->sort( true ); + +$a->difference( $b )->union( $b->difference( $a ) ); + +] diff --git a/Task/Symmetric-difference/Nim/symmetric-difference.nim b/Task/Symmetric-difference/Nim/symmetric-difference.nim new file mode 100644 index 0000000000..cabf5c71a2 --- /dev/null +++ b/Task/Symmetric-difference/Nim/symmetric-difference.nim @@ -0,0 +1,7 @@ +import sets + +var setA = ["John", "Bob", "Mary", "Serena"].toSet +var setB = ["Jim", "Mary", "John", "Bob"].toSet +echo setA -+- setB # Symmetric difference +echo setA - setB # Difference +echo setB - setA # Difference diff --git a/Task/Symmetric-difference/Ring/symmetric-difference.ring b/Task/Symmetric-difference/Ring/symmetric-difference.ring new file mode 100644 index 0000000000..a3031a1bd0 --- /dev/null +++ b/Task/Symmetric-difference/Ring/symmetric-difference.ring @@ -0,0 +1,29 @@ +alist = [] +blist = [] +alist = ["john", "bob", "mary", "serena"] +blist = ["jim", "mary", "john", "bob"] + +alist2 = [] +for i = 1 to len(alist) + flag = 0 + for j = 1 to len(blist) + if alist[i] = blist[j] flag = 1 ok + next + if (flag = 0) add(alist2, alist[i]) ok +next + +blist2 = [] +for j = 1 to len(alist) + flag = 0 + for i = 1 to len(blist) + if alist[i] = blist[j] flag = 1 ok + next + if (flag = 0) add(blist2, blist[j]) ok +next +see "a xor b :" see nl +see alist2 +see blist2 see nl +see "a-b :" see nl +see alist2 see nl +see "b-a :" see nl +see blist2 see nl diff --git a/Task/Symmetric-difference/Sidef/symmetric-difference.sidef b/Task/Symmetric-difference/Sidef/symmetric-difference.sidef new file mode 100644 index 0000000000..0342ac822b --- /dev/null +++ b/Task/Symmetric-difference/Sidef/symmetric-difference.sidef @@ -0,0 +1,3 @@ +var a = ["John", "Serena", "Bob", "Mary", "Serena"]; +var b = ["Jim", "Mary", "John", "Jim", "Bob"]; +a ^ b -> unique.dump.say; diff --git a/Task/Symmetric-difference/Swift/symmetric-difference.swift b/Task/Symmetric-difference/Swift/symmetric-difference.swift new file mode 100644 index 0000000000..01aef19919 --- /dev/null +++ b/Task/Symmetric-difference/Swift/symmetric-difference.swift @@ -0,0 +1,4 @@ +let setA : Set = ["John", "Bob", "Mary", "Serena"] +let setB : Set = ["Jim", "Mary", "John", "Bob"] +println(setA.exclusiveOr(setB)) // symmetric difference of A and B +println(setA.subtract(setB)) // elements in A that are not in B diff --git a/Task/Symmetric-difference/jq/symmetric-difference-1.jq b/Task/Symmetric-difference/jq/symmetric-difference-1.jq new file mode 100644 index 0000000000..0299d6bca8 --- /dev/null +++ b/Task/Symmetric-difference/jq/symmetric-difference-1.jq @@ -0,0 +1,10 @@ +# The following implementation of intersection (but not symmetric_difference) assumes that the +# elements of a (and of b) are unique and do not include null: +def intersection(a; b): + reduce ((a + b) | sort)[] as $i + ([null, []]; if .[0] == $i then [null, .[1] + [$i]] else [$i, .[1]] end) + | .[1] ; + +def symmetric_difference(a;b): + (a|unique) as $a | (b|unique) as $b + | (($a + $b) | unique) - (intersection($a;$b)); diff --git a/Task/Symmetric-difference/jq/symmetric-difference-2.jq b/Task/Symmetric-difference/jq/symmetric-difference-2.jq new file mode 100644 index 0000000000..5f7d5fc5b7 --- /dev/null +++ b/Task/Symmetric-difference/jq/symmetric-difference-2.jq @@ -0,0 +1,2 @@ +symmetric_difference( [1,2,1,2]; [2,3] ) +[1,3] diff --git a/Task/Synchronous-concurrency/EchoLisp/synchronous-concurrency.echolisp b/Task/Synchronous-concurrency/EchoLisp/synchronous-concurrency.echolisp new file mode 100644 index 0000000000..2a0b0b1779 --- /dev/null +++ b/Task/Synchronous-concurrency/EchoLisp/synchronous-concurrency.echolisp @@ -0,0 +1,34 @@ +(require 'sequences) +(require 'tasks) + +;; inter-tasks message : (op-code . data) +(define (is-message? op message) + (and message (equal? op (first message)))) + +;; reader task +(define (reader infile ) + (wait S) + (define message (semaphore-pop S)) + (when (is-message? 'count message ) (writeln 'reader-> message) (task-stop-all)) + + (if (first infile) ;; not EOF + (set! message (cons 'write (next infile))) + (set! message (list 'reader-count-please))) + + (semaphore-push S message) + (signal S) + infile) + +(define (writer count) + (wait S) + (define message (semaphore-pop S)) + (when (is-message? 'write message ) + (writeln (rest message)) + (set! count (1+ count)) + (set! message (cons 'ack count))) + + (when (is-message? 'reader-count-please message ) + (set! message (cons 'count count))) + (semaphore-push S message) + (signal S) + count) diff --git a/Task/Synchronous-concurrency/Oforth/synchronous-concurrency.oforth b/Task/Synchronous-concurrency/Oforth/synchronous-concurrency.oforth new file mode 100644 index 0000000000..78234ca1f7 --- /dev/null +++ b/Task/Synchronous-concurrency/Oforth/synchronous-concurrency.oforth @@ -0,0 +1,16 @@ +import: parallel + +: printing(chPrint, chCount) + 0 while( chPrint receive dup notNull ) [ println 1+ ] drop + chCount send drop ; + +: concurrentPrint(aFileName) +| chPrint chCount line | + Channel new ->chPrint + Channel new ->chCount + + #[ printing(chPrint, chCount) ] & + + aFileName File new forEach: line [ chPrint send(line) drop ] + chPrint close + chCount receive "Number of lines printed : " print println ; diff --git a/Task/Synchronous-concurrency/Phix/synchronous-concurrency.phix b/Task/Synchronous-concurrency/Phix/synchronous-concurrency.phix new file mode 100644 index 0000000000..487f82cab9 --- /dev/null +++ b/Task/Synchronous-concurrency/Phix/synchronous-concurrency.phix @@ -0,0 +1,51 @@ +atom frThread, -- file reader thread + lcThread -- line counter thread + +sequence queue = {} +integer qlock = init_cs() + +integer linecount = 1 + +procedure readfile() +object line +integer fn = open("input.txt","r") + while 1 do + line = gets(fn) + enter_cs(qlock) + queue = append(queue,line) + line = atom(line) -- kill refcount! + leave_cs(qlock) + if line then exit end if + end while + close(fn) + wait_thread(lcThread) + printf(1,"Lines read: %d\n",linecount) + exit_thread(0) +end procedure + +procedure countlines() +object line + linecount = 0 + while 1 do + enter_cs(qlock) + if length(queue)=0 then + leave_cs(qlock) +-- sleep(0.1) + else + line = queue[1] + queue = queue[2..$] + leave_cs(qlock) + if atom(line) then exit end if +-- ?line + linecount += 1 + end if + end while + exit_thread(0) +end procedure + +frThread = create_thread(routine_id("readfile"),{}) +lcThread = create_thread(routine_id("countlines"),{}) + +wait_thread(frThread) +puts(1,"done") +{} = wait_key() diff --git a/Task/Synchronous-concurrency/Swift/synchronous-concurrency-1.swift b/Task/Synchronous-concurrency/Swift/synchronous-concurrency-1.swift new file mode 100644 index 0000000000..0c1e1f680c --- /dev/null +++ b/Task/Synchronous-concurrency/Swift/synchronous-concurrency-1.swift @@ -0,0 +1,44 @@ +// +// Reader.swift +// + +import Foundation + +class Reader: NSObject { + let inputPath = "~/Desktop/input.txt".stringByExpandingTildeInPath + var gotNumberOfLines = false + + override init() { + super.init() + NSNotificationCenter.defaultCenter().addObserver(self, selector: "linesPrinted:", + name: "LinesPrinted", object: nil) + } + + deinit { + NSNotificationCenter.defaultCenter().removeObserver(self) + } + + // Selector for the number of lines printed + func linesPrinted(not:NSNotification) { + println(not.object!) + self.gotNumberOfLines = true + exit(0) + } + + func readFile() { + var err:NSError? + let fileString = NSString(contentsOfFile: self.inputPath, + encoding: NSUTF8StringEncoding, error: &err) + + if let lines = fileString?.componentsSeparatedByString("\n") { + for line in lines { + NSNotificationCenter.defaultCenter().postNotificationName("Line", object: line) + } + NSNotificationCenter.defaultCenter().postNotificationName("LineNumberRequest", object: nil) + + while !self.gotNumberOfLines { + sleep(1 as UInt32) + } + } + } +} diff --git a/Task/Synchronous-concurrency/Swift/synchronous-concurrency-2.swift b/Task/Synchronous-concurrency/Swift/synchronous-concurrency-2.swift new file mode 100644 index 0000000000..8800af4de8 --- /dev/null +++ b/Task/Synchronous-concurrency/Swift/synchronous-concurrency-2.swift @@ -0,0 +1,38 @@ +// +// Printer.swift +// + +import Foundation + +class Printer: NSObject { + var numberOfLines = 0 + var gotRequestLineNumber = false + + override init() { + super.init() + NSNotificationCenter.defaultCenter().addObserver(self, selector: "gotLine:", + name: "Line", object: nil) + NSNotificationCenter.defaultCenter().addObserver(self, selector: "lineNumberRequest:", + name: "LineNumberRequest", object: nil) + } + + deinit { + NSNotificationCenter.defaultCenter().removeObserver(self) + } + + func gotLine(not:NSNotification) { + println(not.object!) + self.numberOfLines++ + } + + func lineNumberRequest(not:NSNotification) { + self.gotRequestLineNumber = true + NSNotificationCenter.defaultCenter().postNotificationName("LinesPrinted", object: self.numberOfLines) + } + + func waitForLines() { + while !self.gotRequestLineNumber { + sleep(1 as UInt32) + } + } +} diff --git a/Task/Synchronous-concurrency/Swift/synchronous-concurrency-3.swift b/Task/Synchronous-concurrency/Swift/synchronous-concurrency-3.swift new file mode 100644 index 0000000000..09bcf8606a --- /dev/null +++ b/Task/Synchronous-concurrency/Swift/synchronous-concurrency-3.swift @@ -0,0 +1,17 @@ +// +// main.swift +// + +import Foundation + +dispatch_async(dispatch_get_global_queue(0, 0)) { + let printer = Printer() + printer.waitForLines() +} + +dispatch_async(dispatch_get_global_queue(0, 0)) { + let reader = Reader() + reader.readFile() +} + +CFRunLoopRun() diff --git a/Task/System-time/FreeBASIC/system-time.freebasic b/Task/System-time/FreeBASIC/system-time.freebasic new file mode 100644 index 0000000000..ac9dcf6b47 --- /dev/null +++ b/Task/System-time/FreeBASIC/system-time.freebasic @@ -0,0 +1,4 @@ +' FB 1.05.0 Win64 + +Print Date + " " + Time '' returns system date/time in format : mm-dd-yyyy hh:mm:ss +Sleep diff --git a/Task/System-time/Hoon/system-time.hoon b/Task/System-time/Hoon/system-time.hoon new file mode 100644 index 0000000000..b6ed15e81e --- /dev/null +++ b/Task/System-time/Hoon/system-time.hoon @@ -0,0 +1 @@ +now diff --git a/Task/System-time/LFE/system-time-1.lfe b/Task/System-time/LFE/system-time-1.lfe new file mode 100644 index 0000000000..8c0d32ba04 --- /dev/null +++ b/Task/System-time/LFE/system-time-1.lfe @@ -0,0 +1,2 @@ +> (os:timestamp) +#(1423 786308 145798) diff --git a/Task/System-time/LFE/system-time-2.lfe b/Task/System-time/LFE/system-time-2.lfe new file mode 100644 index 0000000000..6d834f55bd --- /dev/null +++ b/Task/System-time/LFE/system-time-2.lfe @@ -0,0 +1,2 @@ +> (calendar:now_to_datetime (os:timestamp)) +#(#(2015 2 13) #(0 12 18)) diff --git a/Task/System-time/LFE/system-time-3.lfe b/Task/System-time/LFE/system-time-3.lfe new file mode 100644 index 0000000000..f21455c1db --- /dev/null +++ b/Task/System-time/LFE/system-time-3.lfe @@ -0,0 +1,4 @@ +> (calendar:now_to_universal_time (os:timestamp)) +#(#(2015 2 13) #(0 13 51)) +> (calendar:now_to_local_time (os:timestamp)) +#(#(2015 2 12) #(16 14 26)) diff --git a/Task/System-time/Lasso/system-time.lasso b/Task/System-time/Lasso/system-time.lasso new file mode 100644 index 0000000000..cb4f29d218 --- /dev/null +++ b/Task/System-time/Lasso/system-time.lasso @@ -0,0 +1,2 @@ +date->format('%Q %T') +date->asInteger diff --git a/Task/System-time/Lingo/system-time.lingo b/Task/System-time/Lingo/system-time.lingo new file mode 100644 index 0000000000..170738361e --- /dev/null +++ b/Task/System-time/Lingo/system-time.lingo @@ -0,0 +1,15 @@ +put time() +-- "03:45" + +put date() +-- "01.10.2016" + +put the systemdate +-- date( 2016, 10, 1 ) + +put the systemdate.seconds +-- 13950 + +-- milliseconds since last boot, due to higher resolution better suited for random number seeding +put _system.milliseconds +-- 41746442 diff --git a/Task/System-time/LiveCode/system-time.livecode b/Task/System-time/LiveCode/system-time.livecode new file mode 100644 index 0000000000..37e7c08c5d --- /dev/null +++ b/Task/System-time/LiveCode/system-time.livecode @@ -0,0 +1 @@ +put the system time diff --git a/Task/System-time/Nim/system-time.nim b/Task/System-time/Nim/system-time.nim new file mode 100644 index 0000000000..d2f8fc09f3 --- /dev/null +++ b/Task/System-time/Nim/system-time.nim @@ -0,0 +1,5 @@ +import times + +echo(getDateStr()) +echo(getClockStr()) +echo(getTime()) diff --git a/Task/System-time/Oforth/system-time-1.oforth b/Task/System-time/Oforth/system-time-1.oforth new file mode 100644 index 0000000000..2ab0c0c041 --- /dev/null +++ b/Task/System-time/Oforth/system-time-1.oforth @@ -0,0 +1,2 @@ +System.tick println +#[ #sqrt 1000000 seq map sum println ] bench diff --git a/Task/System-time/Oforth/system-time-2.oforth b/Task/System-time/Oforth/system-time-2.oforth new file mode 100644 index 0000000000..e0f452fc64 --- /dev/null +++ b/Task/System-time/Oforth/system-time-2.oforth @@ -0,0 +1,3 @@ +import: date + +System.localTime dup println asDate println drop drop diff --git a/Task/System-time/Phix/system-time.phix b/Task/System-time/Phix/system-time.phix new file mode 100644 index 0000000000..32bf27e118 --- /dev/null +++ b/Task/System-time/Phix/system-time.phix @@ -0,0 +1,6 @@ +include timedate.e +?format_timedate(date(),"Dddd, Mmmm dth, YYYY, h:mm:ss pm") + +atom t0 = time() +sleep(0.9) +?time()-t0 diff --git a/Task/System-time/Ring/system-time.ring b/Task/System-time/Ring/system-time.ring new file mode 100644 index 0000000000..9f659a0900 --- /dev/null +++ b/Task/System-time/Ring/system-time.ring @@ -0,0 +1,25 @@ +/* Output: +** Sun abbreviated weekday name +** Sunday full weekday name +** May abbreviated month name +** May full month name +** 05/24/15 09:58:38 Date & Time +** 24 Day of the month +** 09 Hour (24) +** 09 Hour (12) +** 144 Day of the year +** 05 Month of the year +** 58 Minutes after hour +** AM AM or PM +** 38 Seconds after the hour +** 21 Week of the year (sun-sat) +** 0 day of the week +** 05/24/15 date +** 09:58:38 time +** 15 year of the century +** 2015 year +** Arab Standard Time time zone +** % percent sign +*/ + +See TimeList() diff --git a/Task/System-time/Sidef/system-time.sidef b/Task/System-time/Sidef/system-time.sidef new file mode 100644 index 0000000000..79998a62ec --- /dev/null +++ b/Task/System-time/Sidef/system-time.sidef @@ -0,0 +1,8 @@ +# textual +say Time.local.ctime; # => Thu Mar 19 15:10:41 2015 + +# epoch time +say Time.sec; # => 1426770641 + +# epoch time with fractional seconds +say Time.micro_sec; # => 1426770641.68409 diff --git a/Task/System-time/Swift/system-time.swift b/Task/System-time/Swift/system-time.swift new file mode 100644 index 0000000000..13a3cf69f4 --- /dev/null +++ b/Task/System-time/Swift/system-time.swift @@ -0,0 +1,4 @@ +import Foundation + +var ⌚️ = NSDate() +println(⌚️) diff --git a/Task/System-time/Ursa/system-time.ursa b/Task/System-time/Ursa/system-time.ursa new file mode 100644 index 0000000000..9996dbf65f --- /dev/null +++ b/Task/System-time/Ursa/system-time.ursa @@ -0,0 +1,3 @@ +# outputs time in milliseconds +import "time" +out (time.getcurrent) endl console diff --git a/Task/System-time/jq/system-time.jq b/Task/System-time/jq/system-time.jq new file mode 100644 index 0000000000..49763cf962 --- /dev/null +++ b/Task/System-time/jq/system-time.jq @@ -0,0 +1,5 @@ +$ jq -n 'now | [., todate]' +[ + 1437619000.970498, + "2015-07-23T02:36:40Z" +] diff --git a/Task/Table-creation-Postal-addresses/EchoLisp/table-creation-postal-addresses.echolisp b/Task/Table-creation-Postal-addresses/EchoLisp/table-creation-postal-addresses.echolisp new file mode 100644 index 0000000000..9dec87ee3f --- /dev/null +++ b/Task/Table-creation-Postal-addresses/EchoLisp/table-creation-postal-addresses.echolisp @@ -0,0 +1,16 @@ +(lib 'struct) +(lib 'sql) + +(define Postal (make-table + (struct postal (auto: id name street city state zip)))) + +Postal + → #table:#struct:postal [id name street city state zip]:[0] + +(table-insert Postal '(0 Gallubert "29 rue de l'Ermitage" Paris Seine 75020)) +(table-insert Postal '(0 Brougnard "666 rue des Cascades " Paris Seine 75042)) +(table-make-index Postal 'postal.id) +(table-print Postal) + +[0] 15 Gallubert 29 rue de l'Ermitage Paris Seine 75020 +[1] 16 Brougnard 666 rue des Cascades Paris Seine 75042 diff --git a/Task/Table-creation-Postal-addresses/FunL/table-creation-postal-addresses.funl b/Task/Table-creation-Postal-addresses/FunL/table-creation-postal-addresses.funl new file mode 100644 index 0000000000..c4c020b8bb --- /dev/null +++ b/Task/Table-creation-Postal-addresses/FunL/table-creation-postal-addresses.funl @@ -0,0 +1,37 @@ +import db.* +import util.* + +Class.forName( 'org.h2.Driver' ) +conn = DriverManager.getConnection( 'jdbc:h2:mem:test', 'sa', '' ) +statement = conn.createStatement() + +statement.execute( ''' + CREATE TABLE `user_data` ( + `id` identity, + `name` varchar(255) NOT NULL, + `street` varchar(255) NOT NULL, + `city` varchar(255) NOT NULL, + `region` char(2) NOT NULL, + `country` char(2) NOT NULL, + `code` varchar(20) NOT NULL, + `phone` varchar(20) NOT NULL, + PRIMARY KEY (`id`) + )''' ) + +statement.execute( ''' + INSERT INTO `user_data` (`name`, `street`, `city`, `region`, `code`, `country`, `phone`) VALUES + ('Jacinthe Steinert', '8540 Fallen Pony Villas', 'Searights', 'IA', '51584-4315', 'US', '(641) 883-4342'), + ('Keeley Pinkham', '1363 Easy Downs', 'Mileta', 'TX', '77667-7376', 'US', '(469) 527-4784'), + ('Rimon Cleveland', '8052 Blue Pond Dale', 'The Willows', 'UT', '84630-2674', 'US', '(385) 305-7261'), + ('Berenice Benda', '2688 Merry Pines', 'Dacono', 'HI', '96766-7398', 'US', '(808) 451-2732'), + ('Mehetabel Marcano', '109 Sleepy Goose Crescent', 'Plains', 'UT', '84727-7254', 'US', '(385) 733-8404'), + ('Ambria Schiller', '7100 Tawny Robin Highway', 'Barlowes', 'ID', '83792-2043', 'US', '(208) 227-8887'), + ('Carne Cancino', '3842 Broad Pioneer Cape', 'Bardstown', 'IA', '51571-6473', 'US', '(563) 060-8352'), + ('Ince Leite', '7876 Stony Fawn Boulevard', 'Easton', 'ID', '83651-9235', 'US', '(208) 951-3024'), + ('Britney Odell', '3386 Lazy Shadow Thicket', 'Kimberly', 'OK', '73539-6632', 'US', '(539) 848-4448'), + ('Suprabha Penton', '9311 Dusty Leaf Alley', 'Niumalu', 'GA', '39927-8332', 'US', '(404) 589-0183')''' ) + +result = statement.executeQuery( '''SELECT * FROM user_data WHERE region = 'ID' ORDER BY code''' ) +print( TextTable.apply(result) ) + +conn.close() diff --git a/Task/Table-creation-Postal-addresses/Lasso/table-creation-postal-addresses.lasso b/Task/Table-creation-Postal-addresses/Lasso/table-creation-postal-addresses.lasso new file mode 100644 index 0000000000..c38c082eca --- /dev/null +++ b/Task/Table-creation-Postal-addresses/Lasso/table-creation-postal-addresses.lasso @@ -0,0 +1,12 @@ +// connect to a Mysql database +inline(-database = 'rosettatest', -sql = "CREATE TABLE `address` ( + `id` int(11) NOT NULL auto_increment, + `street` varchar(50) NOT NULL default '', + `city` varchar(25) NOT NULL default '', + `state` char(2) NOT NULL default '', + `zip` char(10) NOT NULL default '', + PRIMARY KEY (`id`) +); +") => {^ + error_msg +^} diff --git a/Task/Table-creation-Postal-addresses/Nim/table-creation-postal-addresses.nim b/Task/Table-creation-Postal-addresses/Nim/table-creation-postal-addresses.nim new file mode 100644 index 0000000000..b3c5c23098 --- /dev/null +++ b/Task/Table-creation-Postal-addresses/Nim/table-creation-postal-addresses.nim @@ -0,0 +1,18 @@ +import db_sqlite as db +#import db_mysql as db +#import db_postgres as db + +const + connection = ":memory:" + user = "foo" + pass = "bar" + database = "db" + +var c = open(connection, user, pass, database) +c.exec sql"""CREATE TABLE address ( + addrID INTEGER PRIMARY KEY AUTOINCREMENT, + addrStreet TEXT NOT NULL, + addrCity TEXT NOT NULL, + addrState TEXT NOT NULL, + addrZIP TEXT NOT NULL)""" +c.close() diff --git a/Task/Table-creation-Postal-addresses/Sidef/table-creation-postal-addresses.sidef b/Task/Table-creation-Postal-addresses/Sidef/table-creation-postal-addresses.sidef new file mode 100644 index 0000000000..a117633558 --- /dev/null +++ b/Task/Table-creation-Postal-addresses/Sidef/table-creation-postal-addresses.sidef @@ -0,0 +1,17 @@ +require('DBI'); + +var db = %s'DBI'.connect('DBI:mysql:database:server','login','password'); + +var statment = <<'EOF'; +CREATE TABLE `Address` ( + `addrID` int(11) NOT NULL auto_increment, + `addrStreet` varchar(50) NOT NULL default '', + `addrCity` varchar(25) NOT NULL default '', + `addrState` char(2) NOT NULL default '', + `addrZIP` char(10) NOT NULL default '', + PRIMARY KEY (`addrID`) +); +EOF + +var exec = db.prepare(statment); +exec.execute; diff --git a/Task/Table-creation-Postal-addresses/Visual-FoxPro/table-creation-postal-addresses.visual b/Task/Table-creation-Postal-addresses/Visual-FoxPro/table-creation-postal-addresses.visual new file mode 100644 index 0000000000..3062ab3d45 --- /dev/null +++ b/Task/Table-creation-Postal-addresses/Visual-FoxPro/table-creation-postal-addresses.visual @@ -0,0 +1,11 @@ +CLOSE DATABASES ALL +CREATE DATABASE usdata.dbc +SET NULL OFF +CREATE TABLE address.dbf ; +(id I AUTOINC NEXTVALUE 1 STEP 1 PRIMARY KEY COLLATE "Machine", ; + street V(50), city V(25), state C(2), zipcode C(10)) +CLOSE DATABASES ALL +*!* To use +CLOSE DATABASES ALL +OPEN DATABASE usdata.dbc +USE address.dbf SHARED diff --git a/Task/Take-notes-on-the-command-line/Lasso/take-notes-on-the-command-line.lasso b/Task/Take-notes-on-the-command-line/Lasso/take-notes-on-the-command-line.lasso new file mode 100644 index 0000000000..d51f4ac49f --- /dev/null +++ b/Task/Take-notes-on-the-command-line/Lasso/take-notes-on-the-command-line.lasso @@ -0,0 +1,27 @@ +#!/usr/bin/lasso9 + +local( + arguments = $argv -> asarray, + notesfile = file('notes.txt') +) + +#arguments -> removefirst + +if(#arguments -> size) => { + + #notesfile -> openappend + #notesfile -> dowithclose => { + #notesfile -> writestring(date -> format(`YYYY-MM-dd HH:mm:SS`) + '\n') + #notesfile -> writestring('\t' + #arguments -> join(', ') + '\n') + } + + + +else + #notesfile -> exists ? stdout(#notesfile -> readstring) +} + +Called with: +./notes "Rosetta was here" Räksmörgås +./notes First Second Last +./notes diff --git a/Task/Take-notes-on-the-command-line/Nim/take-notes-on-the-command-line.nim b/Task/Take-notes-on-the-command-line/Nim/take-notes-on-the-command-line.nim new file mode 100644 index 0000000000..4f19808b49 --- /dev/null +++ b/Task/Take-notes-on-the-command-line/Nim/take-notes-on-the-command-line.nim @@ -0,0 +1,10 @@ +import os, times, strutils + +if paramCount() == 0: + try: stdout.write readFile("notes.txt") + except IOError: discard +else: + var f = open("notes.txt", fmAppend) + f.writeln getTime() + f.writeln "\t", commandLineParams().join(" ") + f.close() diff --git a/Task/Take-notes-on-the-command-line/Phix/take-notes-on-the-command-line.phix b/Task/Take-notes-on-the-command-line/Phix/take-notes-on-the-command-line.phix new file mode 100644 index 0000000000..8e85336830 --- /dev/null +++ b/Task/Take-notes-on-the-command-line/Phix/take-notes-on-the-command-line.phix @@ -0,0 +1,20 @@ +constant cmd = command_line() +constant filename = "notes.txt" +integer fn +object line +if length(cmd)<3 then + fn = open(filename,"r") + if fn!=-1 then + while 1 do + line = gets(fn) + if atom(line) then exit end if + puts(1,line) + end while + close(fn) + end if +else + fn = open(filename,"a") -- if such file doesn't exist it will be created + printf(fn,"%d-%02d-%02d %d:%02d:%02d\n",date()) + printf(fn,"\t%s\n",join(cmd[3..$])) + close(fn) +end if diff --git a/Task/Take-notes-on-the-command-line/Sidef/take-notes-on-the-command-line.sidef b/Task/Take-notes-on-the-command-line/Sidef/take-notes-on-the-command-line.sidef new file mode 100644 index 0000000000..806f131f01 --- /dev/null +++ b/Task/Take-notes-on-the-command-line/Sidef/take-notes-on-the-command-line.sidef @@ -0,0 +1,9 @@ +var file = %f'notes.txt'; + +if (ARGV.len > 0) { + var fh = file.open_a; + fh.say(Time.local.ctime + "\n\t" + ARGV.join(" ")); + fh.close; +} else { + file.open_r.each { .print }; +} diff --git a/Task/Take-notes-on-the-command-line/Swift/take-notes-on-the-command-line.swift b/Task/Take-notes-on-the-command-line/Swift/take-notes-on-the-command-line.swift new file mode 100644 index 0000000000..54d69145ad --- /dev/null +++ b/Task/Take-notes-on-the-command-line/Swift/take-notes-on-the-command-line.swift @@ -0,0 +1,41 @@ +import Foundation + +let args = Process.arguments +let manager = NSFileManager() +let currentPath = manager.currentDirectoryPath +var err:NSError? + +// Create file if it doesn't exist +if !manager.fileExistsAtPath(currentPath + "/notes.txt") { + println("notes.txt doesn't exist") + manager.createFileAtPath(currentPath + "/notes.txt", contents: nil, attributes: nil) +} + +// handler is what is used to write to the file +let handler = NSFileHandle(forUpdatingAtPath: currentPath + "/notes.txt") + +// Print the file if there are no args +if args.count == 1 { + let str = NSString(contentsOfFile: currentPath + "/notes.txt", encoding: NSUTF8StringEncoding, error: &err) + println(str!) + exit(0) +} + +let time = NSDate() +let format = NSDateFormatter() +let timeData = (format.stringFromDate(time) + "\n").dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false) +format.dateFormat = "yyyy.MM.dd 'at' HH:mm:ss zzz" + +// We're writing to the end of the file +handler?.seekToEndOfFile() +handler?.writeData(timeData!) + +var str = "\t" +for i in 1..n KtoCFR + then + bye +; diff --git a/Task/Temperature-conversion/Ceylon/temperature-conversion.ceylon b/Task/Temperature-conversion/Ceylon/temperature-conversion.ceylon new file mode 100644 index 0000000000..b0fb73f3a1 --- /dev/null +++ b/Task/Temperature-conversion/Ceylon/temperature-conversion.ceylon @@ -0,0 +1,16 @@ +shared void run() { + + void printKelvinConversions(Float kelvin) { + value celsius = kelvin - 273.15; + value rankine = kelvin * 9.0 / 5.0; + value fahrenheit = rankine - 459.67; + + print("Kelvin: ``formatFloat(kelvin, 2, 2)`` + Celsius: ``formatFloat(celsius, 2, 2)`` + Fahrenheit: ``formatFloat(fahrenheit, 2, 2)`` + Rankine: ``formatFloat(rankine, 2, 2)``"); + } + + printKelvinConversions(21.0); + +} diff --git a/Task/Temperature-conversion/Ezhil/temperature-conversion.ezhil b/Task/Temperature-conversion/Ezhil/temperature-conversion.ezhil new file mode 100644 index 0000000000..b9dd0bc090 --- /dev/null +++ b/Task/Temperature-conversion/Ezhil/temperature-conversion.ezhil @@ -0,0 +1,8 @@ +# convert from Kelvin +நிரல்பாகம் கெல்வின்_இருந்து_மாற்று( k ) + பதிப்பி "Kelvin: ",k,"Celsius: ",round(k-273.15)," Fahrenheit: ",(round(k*1.8 - 459.67))," Rankine: ",(round(k*1.8)) +முடி + +கெல்வின்_இருந்து_மாற்று( 0 ) #absolute zero +கெல்வின்_இருந்து_மாற்று( 273 ) #freezing pt of water +கெல்வின்_இருந்து_மாற்று( 30 + 273 ) #room temperature in Summer diff --git a/Task/Temperature-conversion/FOCAL/temperature-conversion.focal b/Task/Temperature-conversion/FOCAL/temperature-conversion.focal new file mode 100644 index 0000000000..1a98cc7069 --- /dev/null +++ b/Task/Temperature-conversion/FOCAL/temperature-conversion.focal @@ -0,0 +1,5 @@ +01.10 ASK "TEMPERATURE IN KELVIN", K +01.20 TYPE "K ", %6.02, K, ! +01.30 TYPE "C ", %6.02, K - 273.15, ! +01.40 TYPE "F ", %6.02, K * 1.8 - 459.67, ! +01.50 TYPE "R ", %6.02, K * 1.8, ! diff --git a/Task/Temperature-conversion/FreeBASIC/temperature-conversion.freebasic b/Task/Temperature-conversion/FreeBASIC/temperature-conversion.freebasic new file mode 100644 index 0000000000..5fa015733e --- /dev/null +++ b/Task/Temperature-conversion/FreeBASIC/temperature-conversion.freebasic @@ -0,0 +1,20 @@ +' FB 1.05.0 Win64 + +Sub convKelvin(temp As Double) + Dim f As String = "####.##" + Print Using f; temp; + Print " degrees Kelvin" + Print Using f; temp - 273.15; + Print " degrees Celsius" + Print Using f; (temp - 273.15) * 1.8 + 32.0; + Print " degrees Fahreneit" + Print Using f; (temp - 273.15) * 1.8 + 32.0 + 459.67; + Print " degrees Rankine" +End Sub + +convKelvin(0.0) +Print +convKelvin(21.0) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Temperature-conversion/Lasso/temperature-conversion.lasso b/Task/Temperature-conversion/Lasso/temperature-conversion.lasso new file mode 100644 index 0000000000..fa60c57c9d --- /dev/null +++ b/Task/Temperature-conversion/Lasso/temperature-conversion.lasso @@ -0,0 +1,51 @@ +define tempconverter(temp, kind) => { + + local( + _temp = decimal(#temp), + convertratio = 1.8, + k_c = 273.15, + r_f = 459.67, + k,c,r,f + ) + + match(#kind) => { + case('k') + #k = #_temp + #c = -#k_c + #k + #r = #k * #convertratio + #f = -#r_f + #r + case('c') + #c = #_temp + #k = #k_c + #c + #r = #k * #convertratio + #f = -#r_f + #r + case('r') + #r = #_temp + #f = -#r_f + #r + #k = #r / #convertratio + #c = -#k_c + #k + case('f') + #f = #_temp + #r = #r_f + #f + #k = #r / #convertratio + #c = -#k_c + #k + case + return 'Something wrong' + } + + return ('K = ' + #k -> asstring(-precision = 2) + + ' C = ' + #c -> asstring(-precision = 2) + + ' R = ' + #r -> asstring(-precision = 2) + + ' F = ' + #f -> asstring(-precision = 2) + ) +} + +tempconverter(21, 'k') +'
' +tempconverter(21, 'c') +'
' +tempconverter(-41, 'c') +'
' +tempconverter(37.80, 'r') +'
' +tempconverter(69.80, 'f') diff --git a/Task/Temperature-conversion/LiveCode/temperature-conversion-1.livecode b/Task/Temperature-conversion/LiveCode/temperature-conversion-1.livecode new file mode 100644 index 0000000000..12ca5018f8 --- /dev/null +++ b/Task/Temperature-conversion/LiveCode/temperature-conversion-1.livecode @@ -0,0 +1,6 @@ +function convertDegrees k + put k/5 * 9 into r + put k - 273.15 into c + put r - 459.67 into f + return k,r,c,f +end convertDegrees diff --git a/Task/Temperature-conversion/LiveCode/temperature-conversion-2.livecode b/Task/Temperature-conversion/LiveCode/temperature-conversion-2.livecode new file mode 100644 index 0000000000..dd90e8768d --- /dev/null +++ b/Task/Temperature-conversion/LiveCode/temperature-conversion-2.livecode @@ -0,0 +1,9 @@ +put convertDegrees(21.00) into tTemp +put item 1 of tTemp into temperature["Kelvin"] +put item 2 of tTemp into temperature["Rankine"] +put item 3 of tTemp into temperature["Celsius"] +put item 4 of tTemp into temperature["Fahrenheit"] +combine temperature using comma and colon +put temperature + +-- Celsius:-252.15,Fahrenheit:-421.87,Kelvin:21.00,Rankine:37.8 diff --git a/Task/Temperature-conversion/Nim/temperature-conversion.nim b/Task/Temperature-conversion/Nim/temperature-conversion.nim new file mode 100644 index 0000000000..40bb1ccdc1 --- /dev/null +++ b/Task/Temperature-conversion/Nim/temperature-conversion.nim @@ -0,0 +1,6 @@ +import rdstdin, strutils, strfmt + +while true: + let k = parseFloat readLineFromStdin "K ? " + echo "{:g} Kelvin = {:g} Celsius = {:g} Fahrenheit = {:g} Rankine degrees".fmt( + k, k - 273.15, k * 1.8 - 459.67, k * 1.8) diff --git a/Task/Temperature-conversion/Oforth/temperature-conversion.oforth b/Task/Temperature-conversion/Oforth/temperature-conversion.oforth new file mode 100644 index 0000000000..db2693cec9 --- /dev/null +++ b/Task/Temperature-conversion/Oforth/temperature-conversion.oforth @@ -0,0 +1,8 @@ +: kelvinToCelsius 273.15 - ; +: kelvinToFahrenheit 1.8 * 459.67 - ; +: kelvinToRankine 1.8 * ; + +: testTemp(n) + n kelvinToCelsius println + n kelvinToFahrenheit println + n kelvinToRankine println ; diff --git a/Task/Temperature-conversion/Phix/temperature-conversion.phix b/Task/Temperature-conversion/Phix/temperature-conversion.phix new file mode 100644 index 0000000000..01343e4d9b --- /dev/null +++ b/Task/Temperature-conversion/Phix/temperature-conversion.phix @@ -0,0 +1,3 @@ +atom K = prompt_number("Enter temperature in Kelvin >=0: ",{0,1e307}) +printf(1," Kelvin: %5.2f\n Celsius: %5.2f\nFahrenheit: %5.2f\n Rankine: %5.2f\n\n", + {K, K-273.15, K*1.8-459.67, K*1.8}) diff --git a/Task/Temperature-conversion/Ring/temperature-conversion.ring b/Task/Temperature-conversion/Ring/temperature-conversion.ring new file mode 100644 index 0000000000..8c26e4ac54 --- /dev/null +++ b/Task/Temperature-conversion/Ring/temperature-conversion.ring @@ -0,0 +1,11 @@ +k = 21.0 c = 0 r = 0 f = 0 +convertTemp(k) +see "Kelvin : " + k + nl + +"Celcius : " + c + nl + +"Rankine : " + r + nl + +"Fahrenheit : " + f + nl + +func convertTemp k + c = k - 273.15 + r = k * 1.8 + f = r - 459.67 diff --git a/Task/Temperature-conversion/Sidef/temperature-conversion.sidef b/Task/Temperature-conversion/Sidef/temperature-conversion.sidef new file mode 100644 index 0000000000..6751e9908a --- /dev/null +++ b/Task/Temperature-conversion/Sidef/temperature-conversion.sidef @@ -0,0 +1,12 @@ +var scale = Hash( + Celcius => Hash.new(factor => 1 , offset => -273.15 ), + Rankine => Hash.new(factor => 1.8, offset => 0 ), + Fahrenheit => Hash.new(factor => 1.8, offset => -459.67 ), +); + +var kelvin = Sys.readln("Enter a temperature in Kelvin: ").to_n; +kelvin >= 0 || die "No such temperature!"; + +scale.keys.sort.each { |key| + printf("%12s:%8.2f\n", key, kelvin*scale{key}{:factor} + scale{key}{:offset}); +} diff --git a/Task/Temperature-conversion/Ursa/temperature-conversion.ursa b/Task/Temperature-conversion/Ursa/temperature-conversion.ursa new file mode 100644 index 0000000000..64beee8dc9 --- /dev/null +++ b/Task/Temperature-conversion/Ursa/temperature-conversion.ursa @@ -0,0 +1,7 @@ +decl double k +while true + out "Temp. in Kelvin? " console + set k (in double console) + out "K\t" k endl "C\t" (- k 273.15) endl console + out "F\t" (- (* k 1.8) 459.67) endl "R\t" (* k 1.8) endl endl console +end while diff --git a/Task/Temperature-conversion/Visual-FoxPro/temperature-conversion.visual b/Task/Temperature-conversion/Visual-FoxPro/temperature-conversion.visual new file mode 100644 index 0000000000..af89f704ab --- /dev/null +++ b/Task/Temperature-conversion/Visual-FoxPro/temperature-conversion.visual @@ -0,0 +1,25 @@ +#DEFINE ABSZC 273.16 +#DEFINE ABSZF 459.67 +LOCAL k As Double, c As Double, f As Double, r As Double, n As Integer, ; +cf As String +n = SET("Decimals") +cf = SET("Fixed") +SET DECIMALS TO 2 +SET FIXED ON +CLEAR +DO WHILE .T. + k = VAL(INPUTBOX("Degrees Kelvin:", "Temperature")) + IF k <= 0 + EXIT + ENDIF + ? "K:", k + c = k - ABSZC + ? "C:", c + f = 1.8*c + 32 + ? "F:", f + r = f + ABSZF + ? "R:", r + ? +ENDDO +SET FIXED &cf +SET DECIMALS TO n diff --git a/Task/Temperature-conversion/XLISP/temperature-conversion.xlisp b/Task/Temperature-conversion/XLISP/temperature-conversion.xlisp new file mode 100644 index 0000000000..178dd1d09e --- /dev/null +++ b/Task/Temperature-conversion/XLISP/temperature-conversion.xlisp @@ -0,0 +1,13 @@ +(DEFUN CONVERT-TEMPERATURE () + (SETQ *FLONUM-FORMAT* "%.2f") + (DISPLAY "Enter a temperature in Kelvin.") + (NEWLINE) + (DISPLAY "> ") + (DEFINE K (READ)) + (DISPLAY `(K = ,K)) + (NEWLINE) + (DISPLAY `(C = ,(- K 273.15))) + (NEWLINE) + (DISPLAY `(F = ,(- (* K 1.8) 459.67))) + (NEWLINE) + (DISPLAY `(R = ,(* K 1.8)))) diff --git a/Task/Temperature-conversion/jq/temperature-conversion-1.jq b/Task/Temperature-conversion/jq/temperature-conversion-1.jq new file mode 100644 index 0000000000..7e66618f7a --- /dev/null +++ b/Task/Temperature-conversion/jq/temperature-conversion-1.jq @@ -0,0 +1,37 @@ +# round(keep) takes as input any jq (i.e. JSON) number and emits a string. +# "keep" is the desired maximum number of numerals after the decimal point, +# e.g. 9.999|round(2) => 10.00 +def round(keep): + tostring + | (index("e") | if . then . else index("E") end) as $e + | if $e then (.[0:$e] | round(keep)) + .[$e+1:] + else index(".") as $ix + | if $ix == null then . + else .[0:$ix + 1] as $head + | .[$ix+1:$ix+keep+2] as $tail + | if ($tail|length) <= keep then $head + $tail + else ($tail | .[length-1:] | tonumber) as $last + | if $last < 5 then $head + $tail[0:$tail|length - 1] + else (($head + $tail) | length) as $length + | ($head[0:-1] + $tail) + | (tonumber + (if $head[0:1]=="-" then -5 else 5 end)) + | tostring + | .[0: ($ix+1+length-$length)] + "." + .[length-keep-1:-1] + end + end + end + end; + +def k2c: . - 273.15; +def k2f: . * 1.8 - 459.67; +def k2r: . * 1.8; + +# produce a stream +def cfr: + if . >= 0 + then "Kelvin: \(.)", "Celsius: \(k2c|round(2))", + "Fahrenheit: \(k2f|round(2))", "Rankine: \(k2r|round(2))" + else error("cfr: \(.) is an invalid temperature in degrees Kelvin") + end; + +cfr diff --git a/Task/Temperature-conversion/jq/temperature-conversion-2.jq b/Task/Temperature-conversion/jq/temperature-conversion-2.jq new file mode 100644 index 0000000000..d80cb4a94b --- /dev/null +++ b/Task/Temperature-conversion/jq/temperature-conversion-2.jq @@ -0,0 +1,9 @@ + $ jq -M -r -f Temperature_conversion.jq + 21 + Kelvin: 21 + Celsius: -252.15 + Fahrenheit: -421.87 + Rankine: 37.80 + + -1 + jq: error: cfr: -1 is an invalid temperature in degrees Kelvin diff --git a/Task/Terminal-control-Clear-the-screen/Axe/terminal-control-clear-the-screen.axe b/Task/Terminal-control-Clear-the-screen/Axe/terminal-control-clear-the-screen.axe new file mode 100644 index 0000000000..39d9eda33f --- /dev/null +++ b/Task/Terminal-control-Clear-the-screen/Axe/terminal-control-clear-the-screen.axe @@ -0,0 +1 @@ +ClrHome diff --git a/Task/Terminal-control-Clear-the-screen/Comal/terminal-control-clear-the-screen.comal b/Task/Terminal-control-Clear-the-screen/Comal/terminal-control-clear-the-screen.comal new file mode 100644 index 0000000000..d45a3bc1f5 --- /dev/null +++ b/Task/Terminal-control-Clear-the-screen/Comal/terminal-control-clear-the-screen.comal @@ -0,0 +1 @@ +PAGE diff --git a/Task/Terminal-control-Clear-the-screen/FreeBASIC/terminal-control-clear-the-screen.freebasic b/Task/Terminal-control-Clear-the-screen/FreeBASIC/terminal-control-clear-the-screen.freebasic new file mode 100644 index 0000000000..89f1041316 --- /dev/null +++ b/Task/Terminal-control-Clear-the-screen/FreeBASIC/terminal-control-clear-the-screen.freebasic @@ -0,0 +1,8 @@ +' FB 1.05.0 Win64 + +' FreeBASIC has a built in Cls command which clears the console on Windows +' but it may still be possible to scroll the console to view its +' previous contents. The following command prevents this. + +Shell("Cls") +Sleep diff --git a/Task/Terminal-control-Clear-the-screen/Lasso/terminal-control-clear-the-screen.lasso b/Task/Terminal-control-Clear-the-screen/Lasso/terminal-control-clear-the-screen.lasso new file mode 100644 index 0000000000..630294e866 --- /dev/null +++ b/Task/Terminal-control-Clear-the-screen/Lasso/terminal-control-clear-the-screen.lasso @@ -0,0 +1,5 @@ +local( + esc = decode_base64('Gw==') +) + +stdout(#esc + '[2J') diff --git a/Task/Terminal-control-Clear-the-screen/Nim/terminal-control-clear-the-screen.nim b/Task/Terminal-control-Clear-the-screen/Nim/terminal-control-clear-the-screen.nim new file mode 100644 index 0000000000..458207466e --- /dev/null +++ b/Task/Terminal-control-Clear-the-screen/Nim/terminal-control-clear-the-screen.nim @@ -0,0 +1,2 @@ +import osproc +discard execCmd "clear" diff --git a/Task/Terminal-control-Clear-the-screen/Phix/terminal-control-clear-the-screen.phix b/Task/Terminal-control-Clear-the-screen/Phix/terminal-control-clear-the-screen.phix new file mode 100644 index 0000000000..72aa8458b1 --- /dev/null +++ b/Task/Terminal-control-Clear-the-screen/Phix/terminal-control-clear-the-screen.phix @@ -0,0 +1 @@ +clear_screen() diff --git a/Task/Terminal-control-Clear-the-screen/Ring/terminal-control-clear-the-screen.ring b/Task/Terminal-control-Clear-the-screen/Ring/terminal-control-clear-the-screen.ring new file mode 100644 index 0000000000..5f811a4b81 --- /dev/null +++ b/Task/Terminal-control-Clear-the-screen/Ring/terminal-control-clear-the-screen.ring @@ -0,0 +1 @@ +system('clear') diff --git a/Task/Terminal-control-Clear-the-screen/Sidef/terminal-control-clear-the-screen-1.sidef b/Task/Terminal-control-Clear-the-screen/Sidef/terminal-control-clear-the-screen-1.sidef new file mode 100644 index 0000000000..8b13abed97 --- /dev/null +++ b/Task/Terminal-control-Clear-the-screen/Sidef/terminal-control-clear-the-screen-1.sidef @@ -0,0 +1,2 @@ +func clear { print(static x = `clear`) }; +clear(); diff --git a/Task/Terminal-control-Clear-the-screen/Sidef/terminal-control-clear-the-screen-2.sidef b/Task/Terminal-control-Clear-the-screen/Sidef/terminal-control-clear-the-screen-2.sidef new file mode 100644 index 0000000000..28719f6263 --- /dev/null +++ b/Task/Terminal-control-Clear-the-screen/Sidef/terminal-control-clear-the-screen-2.sidef @@ -0,0 +1 @@ +Sys.run('clear'); diff --git a/Task/Terminal-control-Clear-the-screen/Sidef/terminal-control-clear-the-screen-3.sidef b/Task/Terminal-control-Clear-the-screen/Sidef/terminal-control-clear-the-screen-3.sidef new file mode 100644 index 0000000000..567b4dd927 --- /dev/null +++ b/Task/Terminal-control-Clear-the-screen/Sidef/terminal-control-clear-the-screen-3.sidef @@ -0,0 +1 @@ +print "\e[3J\e[H\e[2J"; diff --git a/Task/Terminal-control-Clear-the-screen/jq/terminal-control-clear-the-screen-1.jq b/Task/Terminal-control-Clear-the-screen/jq/terminal-control-clear-the-screen-1.jq new file mode 100644 index 0000000000..3352e5aa9c --- /dev/null +++ b/Task/Terminal-control-Clear-the-screen/jq/terminal-control-clear-the-screen-1.jq @@ -0,0 +1 @@ +"\u001B[2J" diff --git a/Task/Terminal-control-Clear-the-screen/jq/terminal-control-clear-the-screen-2.jq b/Task/Terminal-control-Clear-the-screen/jq/terminal-control-clear-the-screen-2.jq new file mode 100644 index 0000000000..4c0a9e6a39 --- /dev/null +++ b/Task/Terminal-control-Clear-the-screen/jq/terminal-control-clear-the-screen-2.jq @@ -0,0 +1 @@ +$ jq -n '"\u001B[2J"' diff --git a/Task/Terminal-control-Coloured-text/FunL/terminal-control-coloured-text.funl b/Task/Terminal-control-Coloured-text/FunL/terminal-control-coloured-text.funl new file mode 100644 index 0000000000..bde4344b69 --- /dev/null +++ b/Task/Terminal-control-Coloured-text/FunL/terminal-control-coloured-text.funl @@ -0,0 +1,13 @@ +import console.* + +bold() +blink() + +if $os.toLowerCase().startsWith( 'win' ) + println( 'not supported' ) +else + println( 'good to go' ) + +reset() + +println( RED + 'Red', GREEN + 'Green', BLUE + 'Blue', MAGENTA + 'Magenta', CYAN + 'Cyan', YELLOW + 'Yellow' + RESET ) diff --git a/Task/Terminal-control-Coloured-text/Lasso/terminal-control-coloured-text.lasso b/Task/Terminal-control-Coloured-text/Lasso/terminal-control-coloured-text.lasso new file mode 100644 index 0000000000..d241a173a1 --- /dev/null +++ b/Task/Terminal-control-Coloured-text/Lasso/terminal-control-coloured-text.lasso @@ -0,0 +1,31 @@ +#!/usr/bin/lasso9 + +define ec(code::string) => { + + local(esc = decode_base64('Gw==')) + local(codes = map('esc' = #esc, + 'normal' = #esc + '[0m', + 'blink' = #esc + '[5;31;49m', + 'red' = #esc + '[31;49m', + 'blue' = #esc + '[34;49m', + 'green' = #esc + '[32;49m', + 'magenta' = #esc + '[35;49m', + 'yellowred' = #esc + '[33;41m' + )) + + return #codes -> find(#code) +} + +stdout( ec('red')) +stdoutnl('So this is the Rosetta Code!') +stdout( ec('blue')) +stdoutnl('So this is the Rosetta Code!') +stdout( ec('green')) +stdoutnl('So this is the Rosetta Code!') +stdout( ec('magenta')) +stdoutnl('So this is the Rosetta Code!') +stdout( ec('yellowred')) +stdout('So this is the Rosetta Code!') +stdoutnl( ec('blink')) +stdoutnl('So this is the Rosetta Code!') +stdout( ec('normal')) diff --git a/Task/Terminal-control-Coloured-text/Nim/terminal-control-coloured-text.nim b/Task/Terminal-control-Coloured-text/Nim/terminal-control-coloured-text.nim new file mode 100644 index 0000000000..d87f286f56 --- /dev/null +++ b/Task/Terminal-control-Coloured-text/Nim/terminal-control-coloured-text.nim @@ -0,0 +1,23 @@ +import Terminal +setForegroundColor(fgRed) +echo "FATAL ERROR! Cannot write to /boot/vmlinuz-3.2.0-33-generic" + +setBackgroundColor(bgBlue) +setForegroundColor(fgYellow) +stdout.write "This is an " +writeStyled "important" +stdout.write " word" +resetAttributes() +stdout.write "\n" + +setForegroundColor(fgYellow) +echo "RosettaCode!" + +setForegroundColor(fgCyan) +echo "RosettaCode!" + +setForegroundColor(fgGreen) +echo "RosettaCode!" + +setForegroundColor(fgMagenta) +echo "RosettaCode!" diff --git a/Task/Terminal-control-Coloured-text/Sidef/terminal-control-coloured-text.sidef b/Task/Terminal-control-Coloured-text/Sidef/terminal-control-coloured-text.sidef new file mode 100644 index 0000000000..2fdaae5df2 --- /dev/null +++ b/Task/Terminal-control-Coloured-text/Sidef/terminal-control-coloured-text.sidef @@ -0,0 +1,8 @@ +var a = frequire('Term::ANSIColor'); + +say a.colored('RED ON WHITE', 'bold red on_white'); +say a.colored('GREEN', 'bold green'); +say a.colored('BLUE ON YELLOW', 'bold blue on_yellow'); +say a.colored('MAGENTA', 'bold magenta'); +say a.colored('CYAN ON RED', 'bold cyan on_red'); +say a.colored('YELLOW', 'bold yellow'); diff --git a/Task/Terminal-control-Cursor-movement/Axe/terminal-control-cursor-movement.axe b/Task/Terminal-control-Cursor-movement/Axe/terminal-control-cursor-movement.axe new file mode 100644 index 0000000000..76bfed70cf --- /dev/null +++ b/Task/Terminal-control-Cursor-movement/Axe/terminal-control-cursor-movement.axe @@ -0,0 +1,8 @@ +Output(X-1,Y) +Output(X+1,Y) +Output(X,Y-1) +Output(X,Y+1) +Output(0,Y) +Output(15,Y) +Output(0,0) +Output(15,7) diff --git a/Task/Terminal-control-Cursor-movement/Lasso/terminal-control-cursor-movement.lasso b/Task/Terminal-control-Cursor-movement/Lasso/terminal-control-cursor-movement.lasso new file mode 100644 index 0000000000..5228251bf7 --- /dev/null +++ b/Task/Terminal-control-Cursor-movement/Lasso/terminal-control-cursor-movement.lasso @@ -0,0 +1,46 @@ +#!/usr/bin/lasso9 + +local(esc = decode_base64('Gw==')) + +stdoutnl('Demonstrate how to move the cursor one position to the left +Demonstrate how to move the cursor one position to the right +Demonstrate how to move the cursor up one line (without affecting its horizontal position) +Demonstrate how to move the cursor down one line (without affecting its horizontal position) +Demonstrate how to move the cursor to the beginning of the line +Demonstrate how to move the cursor to the end of the line +Demonstrate how to move the cursor to the top left corner of the screen +Demonstrate how to move the cursor to the bottom right corner of the screen +') + +// place cursor in a suitable place before exercise +stdout(#esc + '[5;10H') +sleep(2000) + + +// move the cursor one position to the left +stdout(#esc + '[1D') +sleep(2000) + +// move the cursor one position to the right +stdout(#esc + '[1C') +sleep(2000) + +// move the cursor up one line +stdout(#esc + '[1A') +sleep(2000) + +// move the cursor down one line +stdout(#esc + '[1B') +sleep(2000) + +// move the cursor to the beginning of the line +stdout(#esc + '[100D') +sleep(2000) + +// move the cursor to the top left corner of the screen +stdout(#esc + '[H') +sleep(2000) + +// move the cursor to the bottom right corner of the screen +stdout(#esc + '[500;500H') +sleep(2000) diff --git a/Task/Terminal-control-Cursor-positioning/Axe/terminal-control-cursor-positioning.axe b/Task/Terminal-control-Cursor-positioning/Axe/terminal-control-cursor-positioning.axe new file mode 100644 index 0000000000..96c3d8e0be --- /dev/null +++ b/Task/Terminal-control-Cursor-positioning/Axe/terminal-control-cursor-positioning.axe @@ -0,0 +1 @@ +Output(2,5,"HELLO") diff --git a/Task/Terminal-control-Cursor-positioning/Lasso/terminal-control-cursor-positioning.lasso b/Task/Terminal-control-Cursor-positioning/Lasso/terminal-control-cursor-positioning.lasso new file mode 100644 index 0000000000..efeff5f970 --- /dev/null +++ b/Task/Terminal-control-Cursor-positioning/Lasso/terminal-control-cursor-positioning.lasso @@ -0,0 +1,3 @@ +local(esc = decode_base64('Gw==')) + +stdout( #esc + '[6;3HHello') diff --git a/Task/Terminal-control-Cursor-positioning/Nim/terminal-control-cursor-positioning.nim b/Task/Terminal-control-Cursor-positioning/Nim/terminal-control-cursor-positioning.nim new file mode 100644 index 0000000000..576e97be4f --- /dev/null +++ b/Task/Terminal-control-Cursor-positioning/Nim/terminal-control-cursor-positioning.nim @@ -0,0 +1,3 @@ +import terminal +setCursorPos(3, 6) +echo "Hello" diff --git a/Task/Terminal-control-Cursor-positioning/Phix/terminal-control-cursor-positioning.phix b/Task/Terminal-control-Cursor-positioning/Phix/terminal-control-cursor-positioning.phix new file mode 100644 index 0000000000..63f97d9a9e --- /dev/null +++ b/Task/Terminal-control-Cursor-positioning/Phix/terminal-control-cursor-positioning.phix @@ -0,0 +1,2 @@ +position(6,3) +puts(1,"Hello") diff --git a/Task/Terminal-control-Dimensions/Phix/terminal-control-dimensions.phix b/Task/Terminal-control-Dimensions/Phix/terminal-control-dimensions.phix new file mode 100644 index 0000000000..22c24558fb --- /dev/null +++ b/Task/Terminal-control-Dimensions/Phix/terminal-control-dimensions.phix @@ -0,0 +1,5 @@ +sequence vc = video_config() +printf(1,"Terminal buffer height is %d\n",vc[VC_LINES]) +printf(1,"Terminal buffer width is %d\n",vc[VC_COLUMNS]) +printf(1,"Terminal screen height is %d\n",vc[VC_SCRNLINES]) +printf(1,"Terminal screen width is %d\n",vc[VC_SCRNCOLS]) diff --git a/Task/Terminal-control-Dimensions/Ring/terminal-control-dimensions.ring b/Task/Terminal-control-Dimensions/Ring/terminal-control-dimensions.ring new file mode 100644 index 0000000000..a5b5ac96c4 --- /dev/null +++ b/Task/Terminal-control-Dimensions/Ring/terminal-control-dimensions.ring @@ -0,0 +1 @@ +system("mode 50,20") diff --git a/Task/Terminal-control-Dimensions/Sidef/terminal-control-dimensions.sidef b/Task/Terminal-control-Dimensions/Sidef/terminal-control-dimensions.sidef new file mode 100644 index 0000000000..2f271b28e9 --- /dev/null +++ b/Task/Terminal-control-Dimensions/Sidef/terminal-control-dimensions.sidef @@ -0,0 +1,4 @@ +var stty = `stty -a`; +var lines = stty.match(/\brows\h+(\d+)/); +var cols = stty.match(/\bcolumns\h+(\d+)/); +say "#{lines} #{cols}"; diff --git a/Task/Terminal-control-Display-an-extended-character/EchoLisp/terminal-control-display-an-extended-character.echolisp b/Task/Terminal-control-Display-an-extended-character/EchoLisp/terminal-control-display-an-extended-character.echolisp new file mode 100644 index 0000000000..28fe9776d5 --- /dev/null +++ b/Task/Terminal-control-Display-an-extended-character/EchoLisp/terminal-control-display-an-extended-character.echolisp @@ -0,0 +1,8 @@ +;; simplest +(display "£") +;; unicode character +(display "\u00a3") +;; HTML special character +(display "£") +;; CSS enhancement +(display "£" "color:blue;font-size:2em") diff --git a/Task/Terminal-control-Display-an-extended-character/Lasso/terminal-control-display-an-extended-character.lasso b/Task/Terminal-control-Display-an-extended-character/Lasso/terminal-control-display-an-extended-character.lasso new file mode 100644 index 0000000000..bd212ce009 --- /dev/null +++ b/Task/Terminal-control-Display-an-extended-character/Lasso/terminal-control-display-an-extended-character.lasso @@ -0,0 +1 @@ +stdout(' £ ') diff --git a/Task/Terminal-control-Display-an-extended-character/Nim/terminal-control-display-an-extended-character.nim b/Task/Terminal-control-Display-an-extended-character/Nim/terminal-control-display-an-extended-character.nim new file mode 100644 index 0000000000..cf698a7254 --- /dev/null +++ b/Task/Terminal-control-Display-an-extended-character/Nim/terminal-control-display-an-extended-character.nim @@ -0,0 +1,5 @@ +echo "£" +echo "札幌" + +import unicode +echo Rune(0xa3) diff --git a/Task/Terminal-control-Display-an-extended-character/Phix/terminal-control-display-an-extended-character.phix b/Task/Terminal-control-Display-an-extended-character/Phix/terminal-control-display-an-extended-character.phix new file mode 100644 index 0000000000..d0f5ffe82c --- /dev/null +++ b/Task/Terminal-control-Display-an-extended-character/Phix/terminal-control-display-an-extended-character.phix @@ -0,0 +1 @@ +puts(1,"£") diff --git a/Task/Terminal-control-Display-an-extended-character/Sidef/terminal-control-display-an-extended-character.sidef b/Task/Terminal-control-Display-an-extended-character/Sidef/terminal-control-display-an-extended-character.sidef new file mode 100644 index 0000000000..8fef1436bc --- /dev/null +++ b/Task/Terminal-control-Display-an-extended-character/Sidef/terminal-control-display-an-extended-character.sidef @@ -0,0 +1,4 @@ +say '£'; +say "\x{FFE1}"; +say "\N{FULLWIDTH POUND SIGN}"; +say 0xffe1.chr; diff --git a/Task/Terminal-control-Hiding-the-cursor/FunL/terminal-control-hiding-the-cursor.funl b/Task/Terminal-control-Hiding-the-cursor/FunL/terminal-control-hiding-the-cursor.funl new file mode 100644 index 0000000000..6ef48ac434 --- /dev/null +++ b/Task/Terminal-control-Hiding-the-cursor/FunL/terminal-control-hiding-the-cursor.funl @@ -0,0 +1,6 @@ +import time.* +import console.* + +hide() +sleep( 2 Second ) +show() diff --git a/Task/Terminal-control-Hiding-the-cursor/Lasso/terminal-control-hiding-the-cursor.lasso b/Task/Terminal-control-Hiding-the-cursor/Lasso/terminal-control-hiding-the-cursor.lasso new file mode 100644 index 0000000000..b769b5e8eb --- /dev/null +++ b/Task/Terminal-control-Hiding-the-cursor/Lasso/terminal-control-hiding-the-cursor.lasso @@ -0,0 +1,17 @@ +#!/usr/bin/lasso9 + +local( + esc = decode_base64('Gw==') +) + +// hide the cursor +stdout(#esc + '[?25l') + +// wait for 4 seconds to give time discover the cursor is gone +sleep(4000) + +// show the cursor +stdout(#esc + '[?25h') + +// wait for 4 seconds to give time discover the cursor is back +sleep(4000) diff --git a/Task/Terminal-control-Hiding-the-cursor/Phix/terminal-control-hiding-the-cursor.phix b/Task/Terminal-control-Hiding-the-cursor/Phix/terminal-control-hiding-the-cursor.phix new file mode 100644 index 0000000000..78dc1d7a92 --- /dev/null +++ b/Task/Terminal-control-Hiding-the-cursor/Phix/terminal-control-hiding-the-cursor.phix @@ -0,0 +1,3 @@ +cursor(NO_CURSOR) +sleep(1) +cursor(UNDERLINE_CURSOR) diff --git a/Task/Terminal-control-Inverse-video/Axe/terminal-control-inverse-video.axe b/Task/Terminal-control-Inverse-video/Axe/terminal-control-inverse-video.axe new file mode 100644 index 0000000000..c628b097a2 --- /dev/null +++ b/Task/Terminal-control-Inverse-video/Axe/terminal-control-inverse-video.axe @@ -0,0 +1,5 @@ +Fix 3 +Disp "INVERTED" +Fix 2 +Disp "REGULAR",i +Pause 4500 diff --git a/Task/Terminal-control-Inverse-video/FunL/terminal-control-inverse-video.funl b/Task/Terminal-control-Inverse-video/FunL/terminal-control-inverse-video.funl new file mode 100644 index 0000000000..6b6ad42f5c --- /dev/null +++ b/Task/Terminal-control-Inverse-video/FunL/terminal-control-inverse-video.funl @@ -0,0 +1,3 @@ +import console.* + +println( "${REVERSED}This is reversed.$RESET This is normal." ) diff --git a/Task/Terminal-control-Inverse-video/Lasso/terminal-control-inverse-video.lasso b/Task/Terminal-control-Inverse-video/Lasso/terminal-control-inverse-video.lasso new file mode 100644 index 0000000000..5eb2c6c4fd --- /dev/null +++ b/Task/Terminal-control-Inverse-video/Lasso/terminal-control-inverse-video.lasso @@ -0,0 +1,3 @@ +local(esc = decode_base64('Gw==')) + +stdout( #esc + '[7m Reversed Video ' + #esc + '[0m Normal Video ') diff --git a/Task/Terminal-control-Inverse-video/Nim/terminal-control-inverse-video.nim b/Task/Terminal-control-Inverse-video/Nim/terminal-control-inverse-video.nim new file mode 100644 index 0000000000..47189d0a61 --- /dev/null +++ b/Task/Terminal-control-Inverse-video/Nim/terminal-control-inverse-video.nim @@ -0,0 +1 @@ +echo "\e[7mReversed\e[m Normal" diff --git a/Task/Terminal-control-Inverse-video/Ring/terminal-control-inverse-video.ring b/Task/Terminal-control-Inverse-video/Ring/terminal-control-inverse-video.ring new file mode 100644 index 0000000000..00312267ab --- /dev/null +++ b/Task/Terminal-control-Inverse-video/Ring/terminal-control-inverse-video.ring @@ -0,0 +1,3 @@ +nverse = char(17)+char(128)+char(17)+char(15) +normal = char(17)+char(128+15)+char(17)+char(0) +see inverse + " inverse " + normal + " video" diff --git a/Task/Terminal-control-Preserve-screen/Nim/terminal-control-preserve-screen.nim b/Task/Terminal-control-Preserve-screen/Nim/terminal-control-preserve-screen.nim new file mode 100644 index 0000000000..2993b0cf31 --- /dev/null +++ b/Task/Terminal-control-Preserve-screen/Nim/terminal-control-preserve-screen.nim @@ -0,0 +1,10 @@ +import os + +echo "\e[?1049h\e[H" +echo "Alternate buffer!" + +for i in countdown(5, 1): + echo "Going back in: ", i + sleep 1000 + +echo "\e[?1049l" diff --git a/Task/Terminal-control-Preserve-screen/Sidef/terminal-control-preserve-screen.sidef b/Task/Terminal-control-Preserve-screen/Sidef/terminal-control-preserve-screen.sidef new file mode 100644 index 0000000000..02a8be5a08 --- /dev/null +++ b/Task/Terminal-control-Preserve-screen/Sidef/terminal-control-preserve-screen.sidef @@ -0,0 +1,9 @@ +print "\e[?1049h\e[H"; +say "Alternate buffer!"; + +3.downto(1).each { |i| + say "Going back in: #{i}"; + Sys.sleep(1); +} + +print "\e[?1049l"; diff --git a/Task/Terminal-control-Ringing-the-terminal-bell/FreeBASIC/terminal-control-ringing-the-terminal-bell.freebasic b/Task/Terminal-control-Ringing-the-terminal-bell/FreeBASIC/terminal-control-ringing-the-terminal-bell.freebasic new file mode 100644 index 0000000000..ab74de3ce0 --- /dev/null +++ b/Task/Terminal-control-Ringing-the-terminal-bell/FreeBASIC/terminal-control-ringing-the-terminal-bell.freebasic @@ -0,0 +1,4 @@ +' FB 1.05.0 Win64 + +Print !"\a" +Sleep diff --git a/Task/Terminal-control-Ringing-the-terminal-bell/Lasso/terminal-control-ringing-the-terminal-bell.lasso b/Task/Terminal-control-Ringing-the-terminal-bell/Lasso/terminal-control-ringing-the-terminal-bell.lasso new file mode 100644 index 0000000000..f5447e8dd3 --- /dev/null +++ b/Task/Terminal-control-Ringing-the-terminal-bell/Lasso/terminal-control-ringing-the-terminal-bell.lasso @@ -0,0 +1 @@ +stdoutnl('\a') diff --git a/Task/Terminal-control-Ringing-the-terminal-bell/Nim/terminal-control-ringing-the-terminal-bell.nim b/Task/Terminal-control-Ringing-the-terminal-bell/Nim/terminal-control-ringing-the-terminal-bell.nim new file mode 100644 index 0000000000..59db1389dc --- /dev/null +++ b/Task/Terminal-control-Ringing-the-terminal-bell/Nim/terminal-control-ringing-the-terminal-bell.nim @@ -0,0 +1 @@ +echo "\a" diff --git a/Task/Terminal-control-Ringing-the-terminal-bell/Ring/terminal-control-ringing-the-terminal-bell.ring b/Task/Terminal-control-Ringing-the-terminal-bell/Ring/terminal-control-ringing-the-terminal-bell.ring new file mode 100644 index 0000000000..d513e31a53 --- /dev/null +++ b/Task/Terminal-control-Ringing-the-terminal-bell/Ring/terminal-control-ringing-the-terminal-bell.ring @@ -0,0 +1 @@ +see char(7) diff --git a/Task/Terminal-control-Ringing-the-terminal-bell/Sidef/terminal-control-ringing-the-terminal-bell.sidef b/Task/Terminal-control-Ringing-the-terminal-bell/Sidef/terminal-control-ringing-the-terminal-bell.sidef new file mode 100644 index 0000000000..410dbeaf23 --- /dev/null +++ b/Task/Terminal-control-Ringing-the-terminal-bell/Sidef/terminal-control-ringing-the-terminal-bell.sidef @@ -0,0 +1 @@ +print "\a"; diff --git a/Task/Terminal-control-Unicode-output/FunL/terminal-control-unicode-output.funl b/Task/Terminal-control-Unicode-output/FunL/terminal-control-unicode-output.funl new file mode 100644 index 0000000000..88eae9e630 --- /dev/null +++ b/Task/Terminal-control-Unicode-output/FunL/terminal-control-unicode-output.funl @@ -0,0 +1,4 @@ +if map( v -> System.getenv(v), ["LC_ALL", "LC_CTYPE", "LANG"]).filter( (!= null) ).exists( ('UTF' in) ) + println( '\u25b3' ) +else + println( 'Unicode not supported' ) diff --git a/Task/Terminal-control-Unicode-output/Lasso/terminal-control-unicode-output.lasso b/Task/Terminal-control-Unicode-output/Lasso/terminal-control-unicode-output.lasso new file mode 100644 index 0000000000..8e57769d3d --- /dev/null +++ b/Task/Terminal-control-Unicode-output/Lasso/terminal-control-unicode-output.lasso @@ -0,0 +1,6 @@ +local(env_vars = sys_environ -> join('###')) +if(#env_vars >> regexp(`(LANG|LC_ALL|LC_CTYPE).*?UTF.*?###`)) => { + stdout('UTF supported \u25b3') +else + stdout('This terminal does not support UTF') +} diff --git a/Task/Terminal-control-Unicode-output/Nim/terminal-control-unicode-output.nim b/Task/Terminal-control-Unicode-output/Nim/terminal-control-unicode-output.nim new file mode 100644 index 0000000000..03db6cc86a --- /dev/null +++ b/Task/Terminal-control-Unicode-output/Nim/terminal-control-unicode-output.nim @@ -0,0 +1,6 @@ +import os, strutils + +if "utf" in getEnv("LANG").toLower: + echo "Unicode is supported on this terminal and U+25B3 is: △" +else: + echo "Unicode is not supported on this terminal." diff --git a/Task/Terminal-control-Unicode-output/Sidef/terminal-control-unicode-output.sidef b/Task/Terminal-control-Unicode-output/Sidef/terminal-control-unicode-output.sidef new file mode 100644 index 0000000000..9d68ae21a8 --- /dev/null +++ b/Task/Terminal-control-Unicode-output/Sidef/terminal-control-unicode-output.sidef @@ -0,0 +1,5 @@ +if (/\bUTF-?8/i ~~ [ENV{"LC_ALL","LC_CTYPE","LANG"}]) { + say "△" +} else { + die "Terminal can't handle UTF-8.\n"; +} diff --git a/Task/Terminal-control-Unicode-output/jq/terminal-control-unicode-output.jq b/Task/Terminal-control-Unicode-output/jq/terminal-control-unicode-output.jq new file mode 100644 index 0000000000..092013e1c7 --- /dev/null +++ b/Task/Terminal-control-Unicode-output/jq/terminal-control-unicode-output.jq @@ -0,0 +1,15 @@ +def has_unicode_support: + def utf: if . == null then false else contains("UTF") or contains("utf") end; + env.LC_ALL + | if utf then true + elif . != null and . != "" then false + elif env.LC_CTYPE | utf then true + else env.LANG | utf + end ; + +def task: + if has_unicode_support then "\u25b3" + else error("HW65001 This program requires a Unicode-compatible terminal") + end ; + +task diff --git a/Task/Ternary-logic/Nim/ternary-logic.nim b/Task/Ternary-logic/Nim/ternary-logic.nim new file mode 100644 index 0000000000..686d4c975e --- /dev/null +++ b/Task/Ternary-logic/Nim/ternary-logic.nim @@ -0,0 +1,57 @@ +type Trit* = enum ttrue, tmaybe, tfalse + +proc `$`*(a: Trit): string = + case a + of ttrue: "T" + of tmaybe: "?" + of tfalse: "F" + +proc `not`*(a: Trit): Trit = + case a + of ttrue: tfalse + of tmaybe: tmaybe + of tfalse: ttrue + +proc `and`*(a, b: Trit): Trit = + const t: array[Trit, array[Trit, Trit]] = + [ [ttrue, tmaybe, tfalse] + , [tmaybe, tmaybe, tfalse] + , [tfalse, tfalse, tfalse] ] + t[a][b] + +proc `or`*(a, b: Trit): Trit = + const t: array[Trit, array[Trit, Trit]] = + [ [ttrue, ttrue, ttrue] + , [ttrue, tmaybe, tmaybe] + , [ttrue, tmaybe, tfalse] ] + t[a][b] + +proc then*(a, b: Trit): Trit = + const t: array[Trit, array[Trit, Trit]] = + [ [ttrue, tmaybe, tfalse] + , [ttrue, tmaybe, tmaybe] + , [ttrue, ttrue, ttrue] ] + t[a][b] + +proc equiv*(a, b: Trit): Trit = + const t: array[Trit, array[Trit, Trit]] = + [ [ttrue, tmaybe, tfalse] + , [tmaybe, tmaybe, tmaybe] + , [tfalse, tmaybe, ttrue] ] + t[a][b] + +import strutils + +var + op1 = ttrue + op2 = ttrue + +for t in Trit: + echo "Not ", t , ": ", not t + +for op1 in Trit: + for op2 in Trit: + echo "$# and $#: $#".format(op1, op2, op1 and op2) + echo "$# or $#: $#".format(op1, op2, op1 or op2) + echo "$# then $#: $#".format(op1, op2, op1.then op2) + echo "$# equiv $#: $#".format(op1, op2, op1.equiv op2) diff --git a/Task/Ternary-logic/Phix/ternary-logic.phix b/Task/Ternary-logic/Phix/ternary-logic.phix new file mode 100644 index 0000000000..447a3b1545 --- /dev/null +++ b/Task/Ternary-logic/Phix/ternary-logic.phix @@ -0,0 +1,53 @@ +enum type ternary T, M, F end type + +function t_not(ternary a) + return F+1-a +end function + +function t_and(ternary a, ternary b) + return iff(a=T and b=T?T:iff(a=F or b=F?F:M)) +end function + +function t_or(ternary a, ternary b) + return iff(a=T or b=T?T:iff(a=F and b=F?F:M)) +end function + +function t_xor(ternary a, ternary b) + return iff(a=M or b=M?M:iff(a=b?F:T)) +end function + +function t_implies(ternary a, ternary b) + return iff(a=F or b=T?T:iff(a=T and b=F?F:M)) +end function + +function t_equal(ternary a, ternary b) + return iff(a=M or b=M?M:iff(a=b?T:F)) +end function + +function t_string(ternary a) + return iff(a=T?"T":iff(a=M?"?":"F")) +end function + +procedure show_truth_table(integer rid, integer unary, string name) + printf(1,"%-3s |%s\n",{name,iff(unary?"":" T | ? | F")}) + printf(1,"----+---%s\n",{iff(unary?"":"+---+---")}) + for x=T to F do + printf(1," %s ",{t_string(x)}) + if unary then + printf(1," | %s",{t_string(call_func(rid,{x}))}) + else + for y=T to F do + printf(1," | %s",{t_string(call_func(rid,{x,y}))}) + end for + end if + printf(1,"\n") + end for + printf(1,"\n") +end procedure + +show_truth_table(routine_id("t_not"),1,"not") +show_truth_table(routine_id("t_and"),0,"and") +show_truth_table(routine_id("t_or"),0,"or") +show_truth_table(routine_id("t_xor"),0,"xor") +show_truth_table(routine_id("t_implies"),0,"imp") +show_truth_table(routine_id("t_equal"),0,"eq") diff --git a/Task/Ternary-logic/jq/ternary-logic.jq b/Task/Ternary-logic/jq/ternary-logic.jq new file mode 100644 index 0000000000..7641984ca1 --- /dev/null +++ b/Task/Ternary-logic/jq/ternary-logic.jq @@ -0,0 +1,32 @@ +def ternary_nand(a; b): + if a == false or b == false then true + elif a == "maybe" or b == "maybe" then "maybe" + else false + end ; + +def ternary_not(a): ternary_nand(a; a); + +def ternary_or(a; b): ternary_nand( ternary_not(a); ternary_not(b) ); + +def ternary_nor(a; b): ternary_not( ternary_or(a;b) ); + +def ternary_and(a; b): ternary_not( ternary_nand(a; b) ); + +def ternary_imply(this; that): + ternary_nand(this, ternary_not(that)); + +def ternary_equiv(this; that): + ternary_or( ternary_and(this; that); ternary_nor(this; that) ); + +def display_and(a; b): + a as $a | b as $b + | "\($a) and \($b) is \( ternary_and($a; $b) )"; +def display_equiv(a; b): + a as $a | b as $b + | "\($a) equiv \($b) is \( ternary_equiv($a; $b) )"; +# etc etc + +# Invoke the display functions: +display_and( (false, "maybe", true ); (false, "maybe", true) ), +display_equiv( (false, "maybe", true ); (false, "maybe", true) ), +"etc etc" diff --git a/Task/Test-a-function/EchoLisp/test-a-function.echolisp b/Task/Test-a-function/EchoLisp/test-a-function.echolisp new file mode 100644 index 0000000000..7005d7259d --- /dev/null +++ b/Task/Test-a-function/EchoLisp/test-a-function.echolisp @@ -0,0 +1,9 @@ +(assert (palindrome? "aba")) → #t +(assert (palindrome? "abbbca") "palindrome fail") +💥 error: palindrome fail : assertion failed : (palindrome? abbbca) + +(check-expect (palindrome? "aba") #t) → #t +(check-expect (palindrome? "abcda") #f) → #t +(check-expect (palindrome? "abcda") #t) +😐 warning: #t : check failed : (palindrome? abcda) → #f +(assert (palindrome? "un roc lamina l animal cornu")) → #t diff --git a/Task/Test-a-function/Lasso/test-a-function.lasso b/Task/Test-a-function/Lasso/test-a-function.lasso new file mode 100644 index 0000000000..1fd0b04fb1 --- /dev/null +++ b/Task/Test-a-function/Lasso/test-a-function.lasso @@ -0,0 +1,37 @@ +// Taken from the Lasso entry in Palindrome page +define isPalindrome(text::string) => { + + local(_text = string(#text)) // need to make copy to get rid of reference issues + + #_text -> replace(regexp(`(?:$|\W)+`), -ignorecase) + + local(reversed = string(#_text)) + #reversed -> reverse + + return #_text == #reversed +} + +// The tests +describe(::isPalindrome) => { + it(`throws an error when not passed a string`) => { + expect->error =>{ + isPalindrome(43) + } + } + + it(`returns true if the string is the same forward and backwords`) => { + expect(isPalindrome('abba')) + } + + it(`returns false if the string is different forward and backwords`) => { + expect(not isPalindrome('aab')) + } + + it(`ignores spaces and punctuation`) => { + expect(isPalindrome(`Madam, I'm Adam`)) + } +} + +// Run the tests and get the summary +// (This normally isn't in the code as the test suite is run via command-line.) +lspec->stop diff --git a/Task/Test-a-function/Nim/test-a-function-1.nim b/Task/Test-a-function/Nim/test-a-function-1.nim new file mode 100644 index 0000000000..ec4312cc33 --- /dev/null +++ b/Task/Test-a-function/Nim/test-a-function-1.nim @@ -0,0 +1,18 @@ +proc reverse(s): string = + result = newString(s.len) + for i,c in s: + result[s.high - i] = c + +proc isPalindrome(s): bool = + s == reverse(s) + +when isMainModule: + assert(isPalindrome("")) + assert(isPalindrome("a")) + assert(isPalindrome("aa")) + assert(not isPalindrome("baa")) + assert(isPalindrome("baab")) + assert(isPalindrome("ba_ab")) + assert(not isPalindrome("ba_ ab")) + assert(isPalindrome("ba _ ab")) + assert(not isPalindrome("abab")) diff --git a/Task/Test-a-function/Nim/test-a-function-2.nim b/Task/Test-a-function/Nim/test-a-function-2.nim new file mode 100644 index 0000000000..ffbe2e21c9 --- /dev/null +++ b/Task/Test-a-function/Nim/test-a-function-2.nim @@ -0,0 +1,26 @@ +import unittest + +proc reverse(s): string = + result = newString(s.len) + for i,c in s: + result[s.high - i] = c + +proc isPalindrome(s): bool = + s == reverse(s) + +when isMainModule: + suite "palindrome": + test "empty string": + check isPalindrome "" + + test "string of length 1": + check isPalindrome "a" + + test "string of length 2": + check isPalindrome "aa" + + test "string of length 3": + check isPalindrome "aaa" + + test "no palindrome": + check isPalindrome("foo") == false diff --git a/Task/Test-a-function/Oforth/test-a-function.oforth b/Task/Test-a-function/Oforth/test-a-function.oforth new file mode 100644 index 0000000000..1acdd97ef0 --- /dev/null +++ b/Task/Test-a-function/Oforth/test-a-function.oforth @@ -0,0 +1,3 @@ +test: [ "abcd" isPalindrome ] +test: ["abba" isPalindrome ] +test: [ "abcba" isPalindrome ] diff --git a/Task/Test-a-function/Ring/test-a-function.ring b/Task/Test-a-function/Ring/test-a-function.ring new file mode 100644 index 0000000000..e4778868fb --- /dev/null +++ b/Task/Test-a-function/Ring/test-a-function.ring @@ -0,0 +1,2 @@ + assert(IsPalindrome("racecar")) + assert(IsPalindrome("alice")) diff --git a/Task/Test-a-function/Swift/test-a-function.swift b/Task/Test-a-function/Swift/test-a-function.swift new file mode 100644 index 0000000000..eec1fdaaf3 --- /dev/null +++ b/Task/Test-a-function/Swift/test-a-function.swift @@ -0,0 +1,32 @@ +import Cocoa +import XCTest + +class PalindromTests: XCTestCase { + + override func setUp() { + super.setUp() + + } + + override func tearDown() { + super.tearDown() + } + + func testPalindrome() { + // This is an example of a functional test case. + XCTAssert(isPalindrome("abcba"), "Pass") + XCTAssert(isPalindrome("aa"), "Pass") + XCTAssert(isPalindrome("a"), "Pass") + XCTAssert(isPalindrome(""), "Pass") + XCTAssert(isPalindrome("ab"), "Pass") // Fail + XCTAssert(isPalindrome("aa"), "Pass") + XCTAssert(isPalindrome("abcdba"), "Pass") // Fail + } + + func testPalindromePerformance() { + // This is an example of a performance test case. + self.measureBlock() { + var _is = isPalindrome("abcba") + } + } +} diff --git a/Task/Test-a-function/jq/test-a-function-1.jq b/Task/Test-a-function/jq/test-a-function-1.jq new file mode 100644 index 0000000000..09a42cde46 --- /dev/null +++ b/Task/Test-a-function/jq/test-a-function-1.jq @@ -0,0 +1,19 @@ +# Test case 1: +. +1 +1 + +# Test case 2: +1+1 +null +2 + +# Test case 3 (with the wrong result): +1+1 +null +0 + +# A test case with a function definition: +def factorial: if . <= 0 then 1 else . * ((. - 1) | factorial) end; factorial +3 +6 diff --git a/Task/Test-a-function/jq/test-a-function-2.jq b/Task/Test-a-function/jq/test-a-function-2.jq new file mode 100644 index 0000000000..88cc085ecf --- /dev/null +++ b/Task/Test-a-function/jq/test-a-function-2.jq @@ -0,0 +1,8 @@ +$ jq --run-tests < jq.tests + +Testing '.' at line number 3 +Testing '1+1' at line number 8 +Testing '1+1' at line number 13 +*** Expected 0, but got 2 for test at line number 15: 1+1 +Testing 'def factorial: if . <= 0 then 1 else . * ((. - 1) | factorial) end; factorial' at line number 18 +3 of 4 tests passed (0 malformed) diff --git a/Task/Test-a-function/jq/test-a-function-3.jq b/Task/Test-a-function/jq/test-a-function-3.jq new file mode 100644 index 0000000000..dbaac19ce3 --- /dev/null +++ b/Task/Test-a-function/jq/test-a-function-3.jq @@ -0,0 +1,3 @@ +def factorial: if . <= 0 then 1 else . * ((. - 1) | factorial) end; + +def palindrome: explode as $in | ($in|reverse) == $in; diff --git a/Task/Test-a-function/jq/test-a-function-4.jq b/Task/Test-a-function/jq/test-a-function-4.jq new file mode 100644 index 0000000000..63f7abe9bc --- /dev/null +++ b/Task/Test-a-function/jq/test-a-function-4.jq @@ -0,0 +1,7 @@ +import "library" as lib; lib::factorial +3 +6 + +import "library" as lib; lib::palindrome +"salàlas" +true diff --git a/Task/Test-a-function/jq/test-a-function-5.jq b/Task/Test-a-function/jq/test-a-function-5.jq new file mode 100644 index 0000000000..f5ff00134d --- /dev/null +++ b/Task/Test-a-function/jq/test-a-function-5.jq @@ -0,0 +1 @@ +jq --run-tests < test-library.txt diff --git a/Task/Text-processing-1/Nim/text-processing-1.nim b/Task/Text-processing-1/Nim/text-processing-1.nim new file mode 100644 index 0000000000..579ce45850 --- /dev/null +++ b/Task/Text-processing-1/Nim/text-processing-1.nim @@ -0,0 +1,53 @@ +import os, strutils, sequtils + +var + nodata = 0 + nodataMax = -1 + nodataMaxLine:seq[string] = @[] + + totFile = 0.0 + numFile = 0 + +for filename in commandLineParams(): + var f = open(filename) + for line in f.lines: + var + totLine = 0.0 + numLine = 0 + field = line.split() + date = field[0] + data: seq[float] = @[] + flags: seq[int] = @[] + + for i, f in field[1 .. -1]: + if i mod 2 == 0: data.add parseFloat(f) + else: flags.add parseInt(f) + + for datum, flag in items(zip(data, flags)): + if flag < 1: + inc nodata + else: + if nodataMax == nodata and nodata > 0: + nodataMaxLine.add date + if nodataMax < nodata and nodata > 0: + nodataMax = nodata + nodataMaxLine = @[date] + nodata = 0 + totLine += datum + inc numLine + + totFile += totLine + numFile += numLine + + echo "Line: $# Reject: $# Accept: $# LineTot: $# LineAvg: $#" + .format(date, data.len - numLine, numLine, + formatFloat(totLine, precision = 0), formatFloat( + (if numLine > 0: totLine / float(numLine) else: 0.0), precision = 0)) + +echo "" +echo "File(s) = ", commandLineParams().join(" ") +echo "Total = ", formatFloat(totFile, precision = 0) +echo "Readings = ", numFile +echo "Average = ", formatFloat(totFile / float(numFile), precision = 0) +echo "" +echo "Maximum run(s) of ", nodataMax, " consecutive false readings ends at line starting with date(s): ", nodataMaxLine.join(" ") diff --git a/Task/Text-processing-1/Sidef/text-processing-1.sidef b/Task/Text-processing-1/Sidef/text-processing-1.sidef new file mode 100644 index 0000000000..bc15040269 --- /dev/null +++ b/Task/Text-processing-1/Sidef/text-processing-1.sidef @@ -0,0 +1,33 @@ +var gaps = []; +var previous = :valid; + +ARGF.each { |line| + var (date, *readings) = line.words...; + var valid = []; + var hour = 0; + readings.map{.to_n}.each_slice(2, { |slice| + var(reading, flag) = slice...; + if (flag > 0) { + valid << reading; + if (previous == :invalid) { + gaps[-1]{:end} = "#{date} #{hour}:00"; + previous = :valid; + } + } + else { + if (previous == :valid) { + gaps << Hash(start => "#{date} #{hour}:00"); + } + gaps[-1]{:count} := 0 ++; + previous = :invalid; + } + ++hour; + }) + say ("#{date}: #{ '%8s' % (valid ? ('%.3f' % Math.avg(valid...)) : 0) }", + " mean from #{ '%2s' % valid.len } valid."); +} + +var longest = gaps.sort_by{|a| -a{:count} }.first; + +say ("Longest period of invalid readings was #{longest{:count}} hours,\n", + "from #{longest{:start}} till #{longest{:end}}."); diff --git a/Task/Text-processing-1/jq/text-processing-1-1.jq b/Task/Text-processing-1/jq/text-processing-1-1.jq new file mode 100644 index 0000000000..c33a0dcc02 --- /dev/null +++ b/Task/Text-processing-1/jq/text-processing-1-1.jq @@ -0,0 +1 @@ +foreach STREAM as $row ( INITIAL; EXPRESSION; VALUE ). diff --git a/Task/Text-processing-1/jq/text-processing-1-2.jq b/Task/Text-processing-1/jq/text-processing-1-2.jq new file mode 100644 index 0000000000..3a37ce49cf --- /dev/null +++ b/Task/Text-processing-1/jq/text-processing-1-2.jq @@ -0,0 +1 @@ +foreach (inputs | split("\t")) as $line (INITIAL; EXPRESSION; VALUE) diff --git a/Task/Text-processing-1/jq/text-processing-1-3.jq b/Task/Text-processing-1/jq/text-processing-1-3.jq new file mode 100644 index 0000000000..8d1310ec14 --- /dev/null +++ b/Task/Text-processing-1/jq/text-processing-1-3.jq @@ -0,0 +1 @@ +foreach ((inputs | split("\t")), null) as $line (INITIAL; EXPRESSION; VALUE) diff --git a/Task/Text-processing-1/jq/text-processing-1-4.jq b/Task/Text-processing-1/jq/text-processing-1-4.jq new file mode 100644 index 0000000000..4f420e745a --- /dev/null +++ b/Task/Text-processing-1/jq/text-processing-1-4.jq @@ -0,0 +1,71 @@ +# Input: { "max": max_run_length, +# "starts": array_of_start_line_values, # of all the maximal runs +# "start_dates": array_of_start_dates # of all the maximal runs +# } +def report: + (.starts | length) as $l + | if $l == 1 then + "There is one maximal run of lines with flag<=0.", + "The maximal run has length \(.max) and starts at line \(.starts[0]) and has start date \(.start_dates[0])." + elif $l == 0 then + "There is no lines with flag<=0." + else + "There are \($l) maximal runs of lines with flag<=0.", + "These runs have length \(.max) and start at the following line numbers:", + "\(.starts)", + "The corresponding dates are:", + "\(.start_dates)" + end; + +# "process" processes "tab-separated string values" on stdin +def process: + + # Given a line in the form of an array [date, datum1, flag2, ...], + # "synopsis" returns [ number of data items on the line with flag>0, sum, number of data items on the line with flag<=0 ] + def synopsis: # of a line + . as $row + | reduce range(0; (length - 1) / 2) as $i + ( [0,0,0]; + ($row[1+ (2*$i)] | tonumber) as $datum + | ($row[2+(2*$i)] | tonumber) as $flag + | if ($flag>0) then .[0] += 1 | .[1] += $datum else .[2] += 1 end ); + + # state: {"line": line_number # (first line is line 0) + # "synopis": _, # value returned by "synopsis" + # "start": line_number_of_start_of_current_run, + # "start_date": date_of_start_of_current_run, + # "length": length_of_current_run # so far + # "max": max_run_length # so far + # "starts": array_of_start_values # of all the maximal runs + # "start_dates": array_of_start_dates # of all the maximal runs + # } + foreach ((inputs | split("\t")), null) as $line # null signals END + # Slots are effectively initialized by default to null + ( { "line": -1, "length": 0, "max": 0, "starts": [], "start_dates": [] }; + if $line == null then .line = null + else + .line += 1 + # | debug + # synopsis returns [number with flag>0, sum, number with flag<=0 ] + | .synopsis = ($line | synopsis) + | if .synopsis[2] > 0 then + if .start then . else .start = .line | .start_date = $line[0] end + | .length += 1 + | if .max < .length then + (.max = .length) + | .starts = [ .start ] + | .start_dates = [ .start_date ] + elif .max == .length then + .starts += [ .start ] + | .start_dates += [ .start_date ] + else . + end + else .start = null | .length = 0 + end + end; + .) + | if .line == null then {max, starts, start_dates} | report + else .synopsis + end; + +process diff --git a/Task/Text-processing-1/jq/text-processing-1-5.jq b/Task/Text-processing-1/jq/text-processing-1-5.jq new file mode 100644 index 0000000000..4cb740bfea --- /dev/null +++ b/Task/Text-processing-1/jq/text-processing-1-5.jq @@ -0,0 +1,7 @@ +$ jq -c -n -R -r -f Text_processing_1.jq readings.txt +[22,590,2] +[24,410,0] +... +[23,47.3,1] +There is one maximal run of lines with flag<=0. +The maximal run has length 93 and starts at line 5378 and has start date 2004-09-30. diff --git a/Task/Text-processing-2/Nim/text-processing-2.nim b/Task/Text-processing-2/Nim/text-processing-2.nim new file mode 100644 index 0000000000..04b674fe8e --- /dev/null +++ b/Task/Text-processing-2/Nim/text-processing-2.nim @@ -0,0 +1,66 @@ +import strutils, tables + +const NumFields = 49 +const DateField = 0 +const FlagGoodValue = 1 + +var badRecords: int # the number of records that have invalid formatted values +var totalRecords: int # the total number of records in the file +var badInstruments: int # the total number of records that have at least one instrument showing error +var seenDates = newTable[string,bool]() # table that keeps track of what dates we have seen + +# ensure we can parse all records as floats (except the date stamp) +proc checkFloats(floats:seq[string]): bool = + for index in 1..NumFields-1: + try: + # we're assuming all instrument flags are floats not integers + discard parseFloat(floats[index]) + except ValueError: + return false + true + +# ensure that all sensor flags are ok +proc areAllFlagsOk(instruments: seq[string]): bool = + #flags start at index 2, and occur every 2 fields + for index in countup(2,NumFields,2): + # we're assuming all instrument flags are floats not integers + var flag = parseFloat(instruments[index]) + if flag < FlagGoodValue: return false + true + + +# Note: we're not checking the format of the date stamp + +# main +var lines = readFile("readings.txt") +var currentLine: int + +for line in lines.splitLines: + currentLine.inc + #empty lines don't count as records + if line.len == 0: continue + + var tokens = line.split({' ','\t'}) + + totalRecords.inc + + if tokens.len != NumFields: + badRecords.inc + continue + + if not checkFloats(tokens): + badRecords.inc + continue + + if not areAllFlagsOk(tokens): + badInstruments.inc + + if seenDates.hasKeyOrPut(tokens[DateField], true): + echo tokens[DateField], " duplicated on line ", currentLine + +var goodRecords = totalRecords - badRecords +var goodInstruments = goodRecords - badInstruments + +echo "Total Records:", totalRecords +echo "Good Records:", goodRecords +echo "Records where all instuments were OK:", goodInstruments diff --git a/Task/Text-processing-2/Sidef/text-processing-2.sidef b/Task/Text-processing-2/Sidef/text-processing-2.sidef new file mode 100644 index 0000000000..3b56a28b38 --- /dev/null +++ b/Task/Text-processing-2/Sidef/text-processing-2.sidef @@ -0,0 +1,14 @@ +var good_records = 0; +var dates = Hash(); + +ARGF.each { |line| + var m = /^(\d\d\d\d-\d\d-\d\d)((?:\h+\d+\.\d+\h+-?\d+){24})\s*$/.match(line); + m || (warn "Bad format at line #{$.}"; next); + dates{m[0]} := 0 ++; + var i = 0; + m[1].words.all{|n| i++.is_even || (n.to_num >= 1) } && ++good_records; +} + +say "#{good_records} good records out of #{$.} total"; +say 'Repeated timestamps:'; +say dates.to_a.grep{ .value > 1 }.map { .key }.sort.join("\n"); diff --git a/Task/Text-processing-2/jq/text-processing-2-1.jq b/Task/Text-processing-2/jq/text-processing-2-1.jq new file mode 100644 index 0000000000..eaaaa7d6f1 --- /dev/null +++ b/Task/Text-processing-2/jq/text-processing-2-1.jq @@ -0,0 +1 @@ +$ jq -R '[splits("[ \t]+")]' Text_processing_2.txt diff --git a/Task/Text-processing-2/jq/text-processing-2-2.jq b/Task/Text-processing-2/jq/text-processing-2-2.jq new file mode 100644 index 0000000000..4cf62e48b3 --- /dev/null +++ b/Task/Text-processing-2/jq/text-processing-2-2.jq @@ -0,0 +1,16 @@ +# Given any array, produce an array of [item, count] pairs for each run. +def runs: + reduce .[] as $item + ( []; + if . == [] then [ [ $item, 1] ] + else .[length-1] as $last + | if $last[0] == $item then (.[0:length-1] + [ [$item, $last[1] + 1] ] ) + else . + [[$item, 1]] + end + end ) ; + +def is_float: test("^[-+]?[0-9]*[.][0-9]*([eE][-+]?[0-9]+)?$"); + +def is_integral: test("^[-+]?[0-9]+$"); + +def is_date: test("[12][0-9]{3}-[0-9][0-9]-[0-9][0-9]"); diff --git a/Task/Text-processing-2/jq/text-processing-2-3.jq b/Task/Text-processing-2/jq/text-processing-2-3.jq new file mode 100644 index 0000000000..a4c66d13b4 --- /dev/null +++ b/Task/Text-processing-2/jq/text-processing-2-3.jq @@ -0,0 +1,19 @@ +# Report line and column numbers using conventional numbering (IO=1). +def validate_line(nr): + def validate_date: + if is_date then empty else "field 1 in line \(nr) has an invalid date: \(.)" end; + def validate_length(n): + if length == n then empty else "line \(nr) has \(length) fields" end; + def validate_pair(i): + ( .[2*i + 1] as $n + | if ($n | is_float) then empty else "field \(2*i + 2) in line \(nr) is not a float: \($n)" end), + ( .[2*i + 2] as $n + | if ($n | is_integral) then empty else "field \(2*i + 3) in line \(nr) is not an integer: \($n)" end); + + (.[0] | validate_date), + (validate_length(49)), + (range(0; (length-1) / 2) as $i | validate_pair($i)) ; + +def validate_lines: + . as $in + | range(0; length) as $i | ($in[$i] | validate_line($i + 1)); diff --git a/Task/Text-processing-2/jq/text-processing-2-4.jq b/Task/Text-processing-2/jq/text-processing-2-4.jq new file mode 100644 index 0000000000..0e85c9825d --- /dev/null +++ b/Task/Text-processing-2/jq/text-processing-2-4.jq @@ -0,0 +1,2 @@ +def duplicate_timestamps: + [.[][0]] | sort | runs | map( select(.[1]>1) ); diff --git a/Task/Text-processing-2/jq/text-processing-2-5.jq b/Task/Text-processing-2/jq/text-processing-2-5.jq new file mode 100644 index 0000000000..5c2e5e70a4 --- /dev/null +++ b/Task/Text-processing-2/jq/text-processing-2-5.jq @@ -0,0 +1,11 @@ +# The following ignores any issues with respect to duplicate dates, +# but does check the validity of the record, including the date format: +def number_of_valid_readings: + def check: + . as $in + | (.[0] | is_date) + and length == 49 + and all(range(0; 24) | $in[2*. + 1] | is_float) + and all(range(0; 24) | $in[2*. + 2] | (is_integral and tonumber >= 1) ); + + map(select(check)) | length ; diff --git a/Task/Text-processing-2/jq/text-processing-2-6.jq b/Task/Text-processing-2/jq/text-processing-2-6.jq new file mode 100644 index 0000000000..5317d86f94 --- /dev/null +++ b/Task/Text-processing-2/jq/text-processing-2-6.jq @@ -0,0 +1,4 @@ +validate_lines, +"\nChecking for duplicate timestamps:", +duplicate_timestamps, +"\nThere are \(number_of_valid_readings) valid rows altogether." diff --git a/Task/Text-processing-2/jq/text-processing-2-7.jq b/Task/Text-processing-2/jq/text-processing-2-7.jq new file mode 100644 index 0000000000..ef1fae6e49 --- /dev/null +++ b/Task/Text-processing-2/jq/text-processing-2-7.jq @@ -0,0 +1,16 @@ +$ jq -R '[splits("[ \t]+")]' Text_processing_2.txt | jq -s -r -f Text_processing_2.jq +field 1 in line 6 has an invalid date: 991-04-03 +line 6 has 47 fields +field 2 in line 6 is not a float: 10000 +field 3 in line 6 is not an integer: 1.0 +field 47 in line 6 is not an integer: x + +Checking for duplicate timestamps: +[ + [ + "1991-03-31", + 2 + ] +] + +There are 5 valid rows altogether. diff --git a/Task/Text-processing-2/jq/text-processing-2-8.jq b/Task/Text-processing-2/jq/text-processing-2-8.jq new file mode 100644 index 0000000000..dd5bad697f --- /dev/null +++ b/Task/Text-processing-2/jq/text-processing-2-8.jq @@ -0,0 +1,26 @@ +$ jq -R '[splits("[ \t]+")]' readings.txt | jq -s -r -f Text_processing_2.jq +Checking for duplicate timestamps: +[ + [ + "1990-03-25", + 2 + ], + [ + "1991-03-31", + 2 + ], + [ + "1992-03-29", + 2 + ], + [ + "1993-03-28", + 2 + ], + [ + "1995-03-26", + 2 + ] +] + +There are 5017 valid rows altogether. diff --git a/Task/Text-processing-Max-licenses-in-use/Nim/text-processing-max-licenses-in-use.nim b/Task/Text-processing-Max-licenses-in-use/Nim/text-processing-max-licenses-in-use.nim new file mode 100644 index 0000000000..2ea1be8bc8 --- /dev/null +++ b/Task/Text-processing-Max-licenses-in-use/Nim/text-processing-max-licenses-in-use.nim @@ -0,0 +1,17 @@ +import strutils + +var + curOut = 0 + maxOut = -1 + maxTimes = newSeq[string]() + +for job in lines "mlijobs.txt": + if "OUT" in job: inc curOut else: dec curOut + if curOut > maxOut: + maxOut = curOut + maxTimes = @[] + if curOut == maxOut: + maxTimes.add job.split[3] + +echo "Maximum simultaneous license use is ",maxOut," at the following times:" +for i in maxTimes: echo " ",i diff --git a/Task/Text-processing-Max-licenses-in-use/Phix/text-processing-max-licenses-in-use.phix b/Task/Text-processing-Max-licenses-in-use/Phix/text-processing-max-licenses-in-use.phix new file mode 100644 index 0000000000..699a876d96 --- /dev/null +++ b/Task/Text-processing-Max-licenses-in-use/Phix/text-processing-max-licenses-in-use.phix @@ -0,0 +1,34 @@ +constant fn = open("mlijobs.txt", "r") +integer maxout = 0, jobnumber +sequence jobs = {}, maxtime, scanres +string inout, jobtime +object line +while 1 do + line = gets(fn) + if atom(line) then exit end if + scanres = scanf(line,"License %s @ %s for job %d\n") + if length(scanres)!=1 then + printf(1,"error scanning line: %s\n",{line}) + {} = wait_key() + abort(0) + end if + {{inout,jobtime,jobnumber}} = scanres + if inout="OUT" then + jobs &= jobnumber + if length(jobs)>maxout then + maxout = length(jobs) + maxtime = {jobtime} + elsif length(jobs)=maxout then + maxtime = append(maxtime, jobtime) + end if + else + jobs[find(jobnumber,jobs)] = jobs[$] + jobs = jobs[1..$-1] + end if +end while +close(fn) + +printf(1, "Maximum simultaneous license use is %d at the following times:\n", maxout) +for i = 1 to length(maxtime) do + printf(1, "%s\n", {maxtime[i]}) +end for diff --git a/Task/Text-processing-Max-licenses-in-use/Sidef/text-processing-max-licenses-in-use.sidef b/Task/Text-processing-Max-licenses-in-use/Sidef/text-processing-max-licenses-in-use.sidef new file mode 100644 index 0000000000..6bcea08d90 --- /dev/null +++ b/Task/Text-processing-Max-licenses-in-use/Sidef/text-processing-max-licenses-in-use.sidef @@ -0,0 +1,17 @@ +var out = 0; +var max_out = -1; +var max_times = []; + +ARGF.each { |line| + out += (line ~~ /OUT/ ? 1 : -1); + out > max_out && ( + max_out = out; + max_times = []; + ); + out == max_out && ( + max_times << line.split(' ')[3]; + ); +} + +say "Maximum simultaneous license use is #{max_out} at the following times:"; +max_times.each {|t| " #{t}".say }; diff --git a/Task/Text-processing-Max-licenses-in-use/jq/text-processing-max-licenses-in-use.jq b/Task/Text-processing-Max-licenses-in-use/jq/text-processing-max-licenses-in-use.jq new file mode 100644 index 0000000000..67a84ed26a --- /dev/null +++ b/Task/Text-processing-Max-licenses-in-use/jq/text-processing-max-licenses-in-use.jq @@ -0,0 +1,22 @@ +# Input: an array of strings +def max_licenses_in_use: + # state: [in_use = 0, max_in_use = -1, max_in_use_at = [] ] + reduce .[] as $line + ([0, -1, [] ]; + ($line|split(" ")) as $line + | if $line[1] == "OUT" then + .[0] += 1 # in_use++; + | if .[0] > .[1] # (in_use > max_in_use) + then .[1] = .[0] # max_in_use = in_use + | .[2] = [$line[3]] # max_in_use_at = [$line[3]] + elif .[0] == .[1] # (in_use == max_in_use) + then .[2] += [$line[3]] # max_in_use_at << $line[3] + else . + end + elif $line[1] == "IN" then .[0] -= 1 # in_use-- + else . + end ) + | "Max licenses out: \(.[1]) at:\n \(.[2]|join("\n "))" ; + +# The file is read in as a single string and so must be split at newlines: +split("\n") | max_licenses_in_use diff --git a/Task/Textonyms/Sidef/textonyms.sidef b/Task/Textonyms/Sidef/textonyms.sidef new file mode 100644 index 0000000000..0671cd85cf --- /dev/null +++ b/Task/Textonyms/Sidef/textonyms.sidef @@ -0,0 +1,20 @@ +var words = ARGF.grep(/^[[:alpha:]]+\z/); + +var dials = words.group_by { + .tr('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', + '2223334445556667777888999922233344455566677778889999'); +} + +var textonyms = dials.grep_v { .len > 1 }; + +say <<-END; + There are #{words.len} words which can be represented by the digit key mapping. + They require #{dials.len} digit combinations to represent them. + #{textonyms.len} digit combinations represent Textonyms. + END + +say "Top 5 in ambiguity:"; +say textonyms.sort_by { |_,v| -v.len }.first(5).join("\n"); + +say "\nTop 5 in length:"; +say textonyms.sort_by { |k,_| -k.len }.first(5).join("\n"); diff --git a/Task/Textonyms/jq/textonyms-1.jq b/Task/Textonyms/jq/textonyms-1.jq new file mode 100644 index 0000000000..22ac28b56e --- /dev/null +++ b/Task/Textonyms/jq/textonyms-1.jq @@ -0,0 +1,40 @@ +def textonym_value: + gsub("a|b|c|A|B|C"; "2") + | gsub("d|e|f|D|E|F"; "3") + | gsub("g|h|i|G|H|I"; "4") + | gsub("j|k|l|J|K|L"; "5") + | gsub("m|n|o|M|N|O"; "6") + | gsub("p|q|r|s|P|Q|R|S"; "7") + | gsub("t|u|v|T|U|V"; "8") + | gsub("w|x|y|z|W|X|Y|Z"; "9"); + +def explore: + # given an array (or hash), find the maximum length of the items (or values): + def max_length: [.[] | length] | max; + + # The length of the longest textonym in the dictionary of numericString => array: + def longest: + [to_entries[] | select(.value|length > 1) | .key | length] | max; + + # pretty-print a key-value pair: + def pp: "\(.key) maps to: \(.value|tostring)"; + + split("\n") + | map(select(test("^[a-zA-Z]+$"))) # select the strictly alphabetic strings + | length as $nwords + | reduce .[] as $line + ( {}; + ($line | textonym_value) as $key + | .[$key] += [$line] ) + | max_length as $max_length + | longest as $longest + | "There are \($nwords) words in the Textonyms/wordlist word list that can be represented by the digit-key mapping.", + "They require \(length) digit combinations to represent them.", + "\( [.[] | select(length>1) ] | length ) digit combinations represent Textonyms.", + "The numbers mapping to the most words map to \($max_length) words:", + (to_entries[] | select((.value|length) == $max_length) | pp ), + "The longest Textonyms in the word list have length \($longest):", + (to_entries[] | select((.key|length) == $longest and (.value|length > 1)) | pp) +; + +explore diff --git a/Task/Textonyms/jq/textonyms-2.jq b/Task/Textonyms/jq/textonyms-2.jq new file mode 100644 index 0000000000..15708eceec --- /dev/null +++ b/Task/Textonyms/jq/textonyms-2.jq @@ -0,0 +1,9 @@ +$ jq -R -r -c -s -f textonyms.jq textonyms.txt +There are 13085 words in the Textonyms/wordlist word list that can be represented by the digit-key mapping. +They require 11932 digit combinations to represent them. +661 digit combinations represent Textonyms. +The numbers mapping to the most words map to 15 words: +27 maps to: ["AP","AQ","AR","AS","Ar","As","BP","BR","BS","Br","CP","CQ","CR","Cr","Cs"] +The longest Textonyms in the word list have length 11: +26456746242 maps to: ["Anglophobia","Anglophobic"] +24636272673 maps to: ["CinemaScope","Cinemascope"] diff --git a/Task/The-ISAAC-Cipher/FreeBASIC/the-isaac-cipher.freebasic b/Task/The-ISAAC-Cipher/FreeBASIC/the-isaac-cipher.freebasic new file mode 100644 index 0000000000..632941a9f7 --- /dev/null +++ b/Task/The-ISAAC-Cipher/FreeBASIC/the-isaac-cipher.freebasic @@ -0,0 +1,239 @@ +' version 03-11-2016 +' compile with: fbc -s console + +Dim Shared As UInteger<32> randrsl(256), randcnt +Static Shared As UInteger<32> mm(256) +Static Shared As UInteger<32> aa, bb ,cc + +Sub ISAAC() + + Dim As UInteger<32> i, x, y + + cc = cc + 1 + bb = bb + cc + + For i = 0 To 256 -1 + x = mm(i) + Select Case (i Mod 4) + Case 0 : aa = aa Xor (aa Shl 13) + Case 1 : aa = aa Xor (aa Shr 6) + Case 2 : aa = aa Xor (aa Shl 2) + Case 3 : aa = aa Xor (aa Shr 16) + End Select + aa = mm((i+128) Mod 256) + aa + y = mm((x Shr 2) Mod 256) + aa + bb : mm(i) = y + bb = mm((y Shr 10) Mod 256) + x : randrsl(i) = bb + Next + + randcnt = 0 + +End Sub + + +#Macro mix(a, b, c, d, e, f, g, h) + + a Xor= b Shl 11 : d += a : b += c + b Xor= c Shr 2 : e += b : c += d + c Xor= d Shl 8 : f += c : d += e + d Xor= e Shr 16 : g += d : e += f + e Xor= f Shl 10 : h += e : f += g + f Xor= g Shr 4 : a += f : g += h + g Xor= h Shl 8 : b += g : h += a + h Xor= a Shr 9 : c += h : a += b + +#EndMacro + +Sub randinit(flag As Long) + + Dim As Long i + Dim As UInteger<32> a = &H9e3779b9 '/* the golden ratio * + Dim As UInteger<32> b = &H9e3779b9 + Dim As UInteger<32> c = &H9e3779b9 + Dim As UInteger<32> d = &H9e3779b9 + Dim As UInteger<32> e = &H9e3779b9 + Dim As UInteger<32> f = &H9e3779b9 + Dim As UInteger<32> g = &H9e3779b9 + Dim As UInteger<32> h = &H9e3779b9 + aa = 0 : bb = 0 : cc = 0 + + For i = 0 To 3 + mix(a, b, c, d, e, f, g, h) + Next + + For i = 0 To 255 Step 8 + If flag = 1 Then + a += randrsl(i ) : b += randrsl(i +1) + c += randrsl(i +2) : d += randrsl(i +3) + e += randrsl(i +4) : f += randrsl(i +5) + g += randrsl(i +6) : h += randrsl(i +7) + + mix(a, b, c, d, e, f, g, h) + mm(i ) = a : mm(i +1) = b : mm(i +2) = c : mm(i +3) = d + mm(i +4) = e : mm(i +5) = f : mm(i +6) = g : mm(i +7) = h + End If + Next + + If flag = 1 Then + For i = 0 To 255 Step 8 + a += mm(i ) : b += mm(i +1) + c += mm(i +2) : d += mm(i +3) + e += mm(i +4) : f += mm(i +5) + g += mm(i +6) : h += mm(i +7) + + mix(a, b, c, d, e, f, g, h) + mm(i )= a : mm(i +1) = b : mm(i +2) = c : mm(i +3) = d + mm(i +4)= e : mm(i +5) = f : mm(i +6) = g : mm(i +7) = h + Next + End If + + ISAAC() + randcnt = 0 + +End Sub + +' // Get a random 32-bit value 0..MAXINT +Function iRandom() As UInteger<32> + +Dim As UInteger<32> r = randrsl(randcnt) +randcnt += 1 +If randcnt > 255 Then + ISAAC() + randcnt = 0 +End If + +Return r + +End Function + +' // Get a random character in printable ASCII range +Function iRandA() As UByte + +Return iRandom() Mod 95 +32 + +End Function + +' // Seed ISAAC with a string +Sub iSeed(seed As String, flag As Long) + +Dim As ULong i, m = Len(seed) -1 + +For i = 0 To 255 + mm(i) = 0 +Next + +For i = 0 To 255 + + If i > m Then + randrsl(i) = 0 + Else + randrsl(i) = seed[i] + End If + +Next + +randinit(flag) + +End Sub + +' // maximum length of message +'#define MAXMSG 4096 +#Define _MOD_ 95 ' mod is FreeBASIC keyword +#Define _START_ 32 ' start is used as variable name + +' // cipher modes for Caesar +Enum ciphermode + mEncipher + mDecipher + mNone +End Enum + +' // XOR cipher on random stream. Output: ASCII string +' no maximum lenght for input and output string +Function Vernam(msg As String) As String + +Dim As ULong i +Dim As String v + +For i = 0 To Len(msg) -1 + v += Chr(iRandA() Xor msg[i]) +Next + +Return v + +End Function + +' // Caesar-shift a printable character +Function Ceasar(m As ciphermode, ch As UByte, shift As UByte, modulo As UByte, _ + start As UByte) As UByte + +' FreeBASIC Mod does not handle negative numbers correctly +' also there is litte problem with shift (declared UByte) +' the IIF() statement helps with shift +' to avoid a negative n a 8 times modulo is added +' modulo * 8 get translateted by FreeBASIC to modulo shl 3 +Dim As Long n = (ch - start) + IIf(m = mDecipher, -shift, shift) + modulo * 8 +n = n Mod modulo +Return start + n + +End Function + +' // Caesar-shift a string on a pseudo-random stream +Function CeasarStr(m As ciphermode, msg As String, modulo As UByte, _ + start As UByte) As String + +Dim As Long i +Dim As String v + +For i = 0 To Len(msg) -1 + v += Chr(Ceasar(m, msg[i], iRandA(), modulo, start)) +Next + +Return v + +End Function + +' ------=< MAIN >=------ + +Dim As Long n, l +Dim As String msg = "a Top Secret secret" +Dim As String key = "this is my secret key" + +Dim As String vctx, vptx +Dim As String cctx, cptx + +l = Len(msg) +' // Encrypt: Vernam XOR +iSeed(key, 1) +vctx = Vernam(msg) +' // Encrypt: Caesar +cctx = CeasarStr(mEncipher, msg, _mod_, _start_) +' // Decrypt: Vernam XOR +iSeed(key, 1) +vptx = Vernam(vctx) +' // Decrypt: Caesar +cptx = CeasarStr(mDecipher, cctx, _mod_, _start_) +Print "message: "; msg +Print " key: "; key +Print " XOR: "; +' // Output Vernam ciphertext as a string of hex digits +For n = 0 To l -1 + Print Hex(vctx[n], 2); +Next +Print +' // Output Vernam decrypted plaintext +Print "XOR dcr: "; vptx +' // Caesar +Print " MOD: "; +' // Output Caesar ciphertext as a string of hex digits +For n= 0 To l -1 + Print Hex(cctx[n], 2); +Next +Print +' // Output Caesar decrypted plaintext +Print "MOD dcr: " ; cptx + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/The-ISAAC-Cipher/Sidef/the-isaac-cipher.sidef b/Task/The-ISAAC-Cipher/Sidef/the-isaac-cipher.sidef new file mode 100644 index 0000000000..51ce1f0ce3 --- /dev/null +++ b/Task/The-ISAAC-Cipher/Sidef/the-isaac-cipher.sidef @@ -0,0 +1,20 @@ +require('Math::Random::ISAAC'); + +func xor_isaac(key, msg) { + var rng = %s.new(unpack('C*', key)); + + msg.chars»ord»() \ + -> »^« 256.of{ rng.irand % 95 + 32 }.last(msg.len).reverse \ + -> «%« '%02X' -> join; +} + +var msg = 'a Top Secret secret'; +var key = 'this is my secret key'; + +var enc = xor_isaac(key, msg); +var dec = xor_isaac(key, pack('H*', enc)); + +say "Message: #{msg}"; +say "Key : #{key}"; +say "XOR : #{enc}"; +say "XOR dcr: #{pack('H*', dec)}"; diff --git a/Task/The-Twelve-Days-of-Christmas/FreeBASIC/the-twelve-days-of-christmas.freebasic b/Task/The-Twelve-Days-of-Christmas/FreeBASIC/the-twelve-days-of-christmas.freebasic new file mode 100644 index 0000000000..83fb910de8 --- /dev/null +++ b/Task/The-Twelve-Days-of-Christmas/FreeBASIC/the-twelve-days-of-christmas.freebasic @@ -0,0 +1,32 @@ +' version 26-10-2016 +' compile with: fbc -s console + +Dim As ULong d, r + +Dim As String days(1 To ...) = { "first", "second", "third", "fourth", _ + "fifth", "sixth", "seventh", "eighth", _ + "ninth", "tenth", "eleventh", "twelfth" } + +Dim As String gifts(1 To ...) = { "", " Two turtle doves", _ + " Three french hens", " Four calling birds", _ + " Five golden rings", " Six geese a-laying", _ + " Seven swans a-swimming", " Eight maids a-milking", _ + " Nine ladies dancing", " Ten lords a-leaping", _ + " Eleven pipers piping", " Twelve drummers drumming" } + +For d = 1 To 12 + Print " On the " + days(d) + " day of Christmas" + Print " My true love gave to me:" + For r = d To 2 Step -1 + Print gifts(r) + Next + ' print "A partridge...", on the twelfth day print "And a partrige..." + Print " A" & IIf(d = 12, "nd a", "" ) & " partridge in a pear tree" + Print +Next + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : 'Print "hit any key to end program" +Sleep +End diff --git a/Task/The-Twelve-Days-of-Christmas/Nim/the-twelve-days-of-christmas.nim b/Task/The-Twelve-Days-of-Christmas/Nim/the-twelve-days-of-christmas.nim new file mode 100644 index 0000000000..021b95c8cf --- /dev/null +++ b/Task/The-Twelve-Days-of-Christmas/Nim/the-twelve-days-of-christmas.nim @@ -0,0 +1,24 @@ +import strutils, algorithm + +const + gifts = """A partridge in a pear tree. +Two turtle doves +Three french hens +Four calling birds +Five golden rings +Six geese a-laying +Seven swans a-swimming +Eight maids a-milking +Nine ladies dancing +Ten lords a-leaping +Eleven pipers piping +Twelve drummers drumming""".splitLines() + + days = "first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth".split(' ') + +for n, day in days: + var g = (gifts[0..n]) + reverse(g) + echo "\nOn the ", day, " day of Christmas\nMy true love gave to me:\n" & + g[0 .. -2].join("\n") & + (if n > 0: " and\n" & g[g.high] else: capitalize(g[g.high])) diff --git a/Task/The-Twelve-Days-of-Christmas/Sidef/the-twelve-days-of-christmas.sidef b/Task/The-Twelve-Days-of-Christmas/Sidef/the-twelve-days-of-christmas.sidef new file mode 100644 index 0000000000..65da6a668a --- /dev/null +++ b/Task/The-Twelve-Days-of-Christmas/Sidef/the-twelve-days-of-christmas.sidef @@ -0,0 +1,29 @@ +var days = ; + +var gifts = <<'EOT'.lines; + And a partridge in a pear tree. + Two turtle doves, + Three french hens, + Four calling birds, + Five golden rings, + Six geese a-laying, + Seven swans a-swimming, + Eight maids a-milking, + Nine ladies dancing, + Ten lords a-leaping, + Eleven pipers piping, + Twelve drummers drumming, +EOT + +func nth(n) { say "On the #{days[n]} day of Christmas, my true love gave to me:" }; + +nth(0); +say gifts[0].sub('And a', 'A'); + +range(1, 11).each { |d| + say ''; + nth(d); + d.downto(0).each { |i| + say gifts[i]; + } +} diff --git a/Task/The-Twelve-Days-of-Christmas/Swift/the-twelve-days-of-christmas.swift b/Task/The-Twelve-Days-of-Christmas/Swift/the-twelve-days-of-christmas.swift new file mode 100644 index 0000000000..e283f9108c --- /dev/null +++ b/Task/The-Twelve-Days-of-Christmas/Swift/the-twelve-days-of-christmas.swift @@ -0,0 +1,29 @@ +let gifts = [ "partridge in a pear tree", "Two turtle doves", + "Three French hens", "Four calling birds", + "Five gold rings", "Six geese a-laying", + "Seven swans a-swimming", "Eight maids a-milking", + "Nine ladies dancing", "Ten lords a-leaping", + "Eleven pipers piping", "Twelve drummers drumming" ] + +let nth = [ "first", "second", "third", "fourth", "fifth", "sixth", + "seventh", "eighth", "ninth", "tenth", "eleventh", "twelfth" ] + +func giftsForDay(day: Int) -> String { + var result = "On the \(nth[day-1]) day of Christmas, my true love sent to me:\n" + if day > 1 { + for again in 1...day-1 { + let n = day - again + result += gifts[n] + if n > 1 { result += "," } + result += "\n" + } + result += "And a " + } else { + result += "A " + } + return result + gifts[0] + ".\n"; +} + +for day in 1...12 { + print(giftsForDay(day)) +} diff --git a/Task/Thieles-interpolation-formula/Sidef/thieles-interpolation-formula.sidef b/Task/Thieles-interpolation-formula/Sidef/thieles-interpolation-formula.sidef new file mode 100644 index 0000000000..f722a8c764 --- /dev/null +++ b/Task/Thieles-interpolation-formula/Sidef/thieles-interpolation-formula.sidef @@ -0,0 +1,39 @@ +func thiele(x, y) { + var ρ = y.range.map {|i| [y[i]]*(y.len-i) } + + for i in ^(ρ.end) { + ρ[i][1] = ((x[i] - x[i+1]) / (ρ[i][0] - ρ[i+1][0])) + } + for i in range(2, ρ.end) { + for j in range(0, ρ.end - i) { + ρ[j][i] = (((x[j]-x[j+i]) / (ρ[j][i-1]-ρ[j+1][i-1])) + ρ[j+1][i-2]) + } + } + + var ρ0 = ρ[0] + + func t(xin) { + var a = 0 + for i in range(ρ0.end, 2, -1) { + a = ((xin - x[i-1]) / (ρ0[i] - ρ0[i-2] + a)) + } + y[0] + ((xin-x[0]) / (ρ0[1]+a)) + } + return t +} + +# task 1: build 32 row trig table +var xVal = range(32).map { |k| k * 0.05 } +var tSin = xVal.map { .sin } +var tCos = xVal.map { .cos } +var tTan = xVal.map { .tan } + +# task 2: define inverses +var iSin = thiele(tSin, xVal) +var iCos = thiele(tCos, xVal) +var iTan = thiele(tTan, xVal) + +# task 3: demonstrate identities +say 6*iSin(0.5) +say 3*iCos(0.5) +say 4*iTan(1) diff --git a/Task/Tic-tac-toe/Lasso/tic-tac-toe.lasso b/Task/Tic-tac-toe/Lasso/tic-tac-toe.lasso new file mode 100644 index 0000000000..64c13abdda --- /dev/null +++ b/Task/Tic-tac-toe/Lasso/tic-tac-toe.lasso @@ -0,0 +1,95 @@ +[ +session_start('user') +session_addvar('user', 'matrix') +session_addvar('user', 'winrecord') +session_addvar('user', 'turn') +var(matrix)->isNotA(::array) ? var(matrix = array('-','-','-','-','-','-','-','-','-')) +var(winrecord)->isNotA(::array) ? var(winrecord = array) +var(turn)->isNotA(::string) ? var(turn = 'x') + +if(web_request->params->asStaticArray >> 'reset') => { + $matrix = array('-','-','-','-','-','-','-','-','-') + $turn = 'x' +} + +with i in web_request->params->asStaticArray do => { + if(#i->name->beginswith('p')) => { + local(num = #i->name->asCopy) + #num->removeLeading('p') + #num = integer(#num) + #num > 0 && $matrix->get(#num) == '-' ? $matrix->get(#num) = #i->value + $turn == 'o' ? $turn = 'x' | $turn = 'o' + } +} + +local( + istie = false, + winner = 'noone', + clear = false +) + +// determine if we have a winner +if($matrix->find('-')->size < 9) => { + local(winners = array('123','456','789','147','258','369','159','357')) + loop(8) => { + local(xscore = 0,oscore = 0,use = #winners->get(loop_count)) + with v in #use->values do => { + $matrix->findposition('x') >> integer(#v) ? #xscore++ + $matrix->findposition('o') >> integer(#v) ? #oscore++ + } + if(#xscore == 3) => { + #winner = 'x' + $winrecord->insert('x') + #clear = true + loop_abort + } + if(#oscore == 3) => { + #winner = 'o' + $winrecord->insert('o') + #clear = true + loop_abort + } + + } + +} +// determine if tie +if(not $matrix->find('-')->size && #winner == 'noone') => { + #istie = true + #winner = 'tie' + $winrecord->insert('tie') + #clear = true +} +] +
+ + + [loop(3) => {^][^}] + + + [loop(-from=4,-to=6) => {^][^}] + + + [loop(-from=7,-to=9) => {^][^}] + +
+
+[if(#istie && #winner == 'tie')] +

It's a tie!

+[else(#winner != 'noone')] +

[#winner->uppercase&] won! Congratulations.

+[else]Insert formula here +

It is now [$turn]'s turn!

+[/if] +

Reset

+[if($winrecord->size)]

Win record: [$winrecord->join(', ')]

[/if] +[if(#clear == true) => { + $matrix = array('-','-','-','-','-','-','-','-','-') + $turn = 'x' +}] diff --git a/Task/Tic-tac-toe/Phix/tic-tac-toe.phix b/Task/Tic-tac-toe/Phix/tic-tac-toe.phix new file mode 100644 index 0000000000..b02ca13cfc --- /dev/null +++ b/Task/Tic-tac-toe/Phix/tic-tac-toe.phix @@ -0,0 +1,85 @@ +sequence board = repeat(' ',9) -- {' '/'X'/'O'} + +constant wins = {{1,2,3},{4,5,6},{7,8,9},{1,4,7},{2,5,8},{3,6,9},{1,5,9},{3,5,7}} + +function check_winner() + for w=1 to length(wins) do + integer {i,j,k} = wins[w], + boardi = board[i] + if boardi!=' ' and boardi=board[j] and boardi=board[k] then + return boardi + end if + end for + return 0 +end function + +procedure showboard() + printf(1," %c | %c | %c\n---+---+---\n %c | %c | %c\n---+---+---\n %c | %c | %c\n",board) +end procedure + +integer best_i +function test_move(integer val, integer depth) +integer score = check_winner() +integer best = -1, changed = 0 + if score!=0 then return iff(score=val?1:-1) end if + for i=1 to 9 do + if board[i]=' ' then + {changed,board[i]} @= val + score = -test_move('O'+'X'-val, depth + 1) + board[i] = ' ' + if score>best then + if depth=0 then + best_i = i; + end if + best = score; + end if + end if + end for + return iff(changed!=0?best:0) +end function + +integer user = 1 + +function game() +integer key, k, win + board = repeat(' ',9) + + printf(1,"Board postions are numbered so:\n1 2 3\n4 5 6\n7 8 9\n"); + printf(1,"You have O, I have X.\n\n"); + for n=1 to 9 do + if(user) then + printf(1,"your move: "); + while 1 do + key = wait_key() + if find(key,{#1B,'q','Q'}) then return "Quit" end if + k = key-'0' + if k>=1 and k<=9 and board[k]=' ' then + board[k] = 'O' + printf(1,"%c\n",key) + exit + end if + end while + else + if n=1 then --/* randomize if computer opens, less boring */ + best_i = rand(9) + else + {} = test_move('X', 0); + end if + board[best_i] = 'X' + printf(1," my move: %d\n", best_i); + end if + showboard(); + user = 1-user + win = check_winner() + if win!=0 then + return iff(win=='O' ? "You win.\n\n" : "I win.\n\n"); + end if + end for + return "A draw.\n\n"; +end function + +while 1 do + string res = game() + puts(1,res) + if res="Quit" then exit end if +end while diff --git a/Task/Tic-tac-toe/Ring/tic-tac-toe.ring b/Task/Tic-tac-toe/Ring/tic-tac-toe.ring new file mode 100644 index 0000000000..d15ab5ec5a --- /dev/null +++ b/Task/Tic-tac-toe/Ring/tic-tac-toe.ring @@ -0,0 +1,129 @@ +Load "guilib.ring" + +#Provide a list to save each button status in numeric readable format +#0=nothing 1=X 2=O +lst=[] + +#Provide onScreen button status and style +btns=[] + +#Define who has the turn +isXTurn=true + + + app=new qApp + { + + frmMain=new qMainWindow() + { + setWindowTitle("TicTacToe!") + resize(300,320) + move(200,200) + //buttons + pos=0 + for y=0 to 2 + for x=0 to 2 + //Creating Buttons on the screen + pos++ + Add(lst,0) + Add(btns,new qPushButton(frmMain) + { + setGeometry(x*100,y*100,100,100) + setText("-") + setclickevent("Disp(" + pos +")") + setstylesheet("font-size:24pt ; font: bold ; color:yellow ; background-color: green") + }) + next + next + //StatusBar + status=new qStatusBar(frmMain) + { + showMessage("Ready",0) + } + setwindowflags(Qt_dialog) + setStatusbar(status) + show() + } + exec() + } + +//Restart the game by re init buttons status +func reStart + for i=1 to 9 + lst[i]=0 + btns[i].setText("-") + next +isXTurn=true + +func Disp x + if isXTurn=true and lst[x]=0 + btns[x].setText("X") + lst[x]=1 + isXTurn=false + but isXTurn=false and lst[x]=0 + btns[x].setText("O") + lst[x]=2 + isXTurn=true + ok + + winner = CheckWinner() + #if there is no Winner and still there is ability to winner + #continue playing. + if winner<1 return ok + + //Who is the winner! + switch winner + on 1 + new qMessagebox(frmMain) + { + SetWindowTitle("We have a winner!") + SetText("Good job X you won!") + show() + } + on 2 + new qMessagebox(frmMain) + { + SetWindowTitle("We have a winner!") + SetText("Good job O you won!") + show() + } + on 3 + new qMessagebox(frmMain) + { + SetWindowTitle("Oh no it's a tie") + SetText("Oh no it's a tie!") + show() + } + off + reStart() + +func CheckWinner + //vertical check + for v=1 to 9 step 3 + if lst[v]!=0 and lst[v+1]!=0 and lst[v+2]!=0 + if lst[v]=lst[v+1] and lst[v+1]=lst[v+2] + return lst[v] + ok + ok + next + //horzintal + for h=1 to 3 + if lst[h]!=0 and lst[h+3]!=0 and lst[h+6]!=0 + if lst[h]=lst[h+3] and lst[h+3]=lst[h+6] + return lst[h] + ok + ok + next + //Cross + if lst[1]!=0 and lst[5]!=0 and lst[9]!=0 + if lst[1]=lst[5] and lst[5]=lst[9] return lst[1] ok + ok + if lst[3]!=0 and lst[5]!=0 and lst[7]!=0 + if lst[3]=lst[5] and lst[5]=lst[7] return lst[3] ok + ok + //tie + tie=true + for i=1 to 9 + if lst[i]=0 tie=false exit ok + next + if tie=true return 3 ok return 0 diff --git a/Task/Time-a-function/8051-Assembly/time-a-function.8051 b/Task/Time-a-function/8051-Assembly/time-a-function.8051 new file mode 100644 index 0000000000..46cc34b47f --- /dev/null +++ b/Task/Time-a-function/8051-Assembly/time-a-function.8051 @@ -0,0 +1,105 @@ +TC EQU 8 ; number of counter registers +TSTART EQU 08h ; first register of timer counter +TEND EQU TSTART + TC - 1 ; end register of timer counter +; Note: The multi-byte value is stored in Big-endian + +; Some timer reloads +_6H EQU 085h ; 6MHz +_6L EQU 0edh +_12H EQU 00bh ; 12MHz +_12L EQU 0dbh +_110592H EQU 01eh ; 11.0592MHz +_110592L EQU 0ffh + +; How to calculate timer reload (e.g. for 11.0592MHz): +; Note: 1 machine cycle takes 12 oscillator periods +; 11.0592MHz / 12 * 0.0625 seconds = 57,600 cycles = e100h +; ffffh - e100h = NOT e100h = 1effh + +; assuming a 11.0592MHz crystal +TIMERH EQU _110592H +TIMERL EQU _110592L + +;; some timer macros (using timer0) +start_timer macro + setb tr0 +endm +stop_timer macro + clr tr0 +endm +reset_timer macro + mov tl0, #TIMERL + mov th0, #TIMERH +endm + +increment_counter macro ;; increment counter (multi-byte increment) + push psw + push acc + push 0 ; r0 + mov r0, #TEND+1 + setb c +inc_reg: + dec r0 + clr a + addc a, @r0 + mov @r0, a + jnc inc_reg_ ; end prematurally if the higher bytes are unchanged + cjne r0, #TSTART, inc_reg +inc_reg_: + ; if the carry is set here then the multi byte value has overflowed + pop 0 + pop acc + pop psw +endm + +ORG RESET + jmp init +ORG TIMER0 + jmp timer_0 + +timer_0: ; interrupt every 6.25ms + stop_timer ; we only want to time the function + reset_timer + increment_counter + start_timer + reti + +init: + mov sp, #TEND + setb ea ; enable interrupts + setb et0 ; enable timer0 interrupt + mov tmod, #01h ; timer0 16-bit mode + reset_timer + + ; reset timer counter registers + clr a + mov r0, #TSTART +clear: + mov @r0, a + inc r0 + cjne r0, #TEND, clear + + start_timer + call function ; the function to time + stop_timer + + ; at this point the registers from TSTART + ; through TEND indicate the current time + ; multiplying the 8/16/24/etc length value by 0.0625 (2^-4) gives + ; the elapsed number of seconds + ; e.g. if the three registers were 02a0f2h then the elapsed time is: + ; 02a0f2h = 172,274 and 172,274 * 0.0625 = 10,767.125 seconds + ; + ; Or alternatively: + ; (high byte) 02h = 2 and 2 * 2^(16-4) = 8192 + ; (mid byte) a0h = 160 and 160 * 2^(8-4) = 2560 + ; (low byte) f2h = 242 and 242 * 2^(0-4) = 15.125 + ; 8192 + 2560 + 15.125 = 10,767.125 seconds + + jmp $ + +function: + ; do whatever here + ret + +END diff --git a/Task/Time-a-function/FreeBASIC/time-a-function.freebasic b/Task/Time-a-function/FreeBASIC/time-a-function.freebasic new file mode 100644 index 0000000000..3c5fbcf292 --- /dev/null +++ b/Task/Time-a-function/FreeBASIC/time-a-function.freebasic @@ -0,0 +1,19 @@ +' FB 1.05.0 Win64 + +Function sumToLimit(limit As UInteger) As UInteger + Dim sum As UInteger = 0 + For i As UInteger = 1 To limit + sum += i + Next + Return sum +End Function + +Dim As Double start = timer +Dim limit As UInteger = 100000000 +Dim result As UInteger = sumToLimit(limit) +Dim ms As UInteger = Int(1000 * (timer - start) + 0.5) +Print "sumToLimit("; Str(limit); ") = "; result +Print "took "; ms; " milliseconds to calculate" +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Time-a-function/Lasso/time-a-function.lasso b/Task/Time-a-function/Lasso/time-a-function.lasso new file mode 100644 index 0000000000..e464a068bb --- /dev/null +++ b/Task/Time-a-function/Lasso/time-a-function.lasso @@ -0,0 +1,5 @@ +local(start = micros) +loop(100000) => { + 'nothing is outout because no autocollect' +} +'time for 100,000 loop repititions: '+(micros - #start)+' microseconds' diff --git a/Task/Time-a-function/Lingo/time-a-function-1.lingo b/Task/Time-a-function/Lingo/time-a-function-1.lingo new file mode 100644 index 0000000000..9f3d511ebf --- /dev/null +++ b/Task/Time-a-function/Lingo/time-a-function-1.lingo @@ -0,0 +1,5 @@ +on testFunc () + repeat with i = 1 to 1000000 + x = sqrt(log(i)) + end repeat +end diff --git a/Task/Time-a-function/Lingo/time-a-function-2.lingo b/Task/Time-a-function/Lingo/time-a-function-2.lingo new file mode 100644 index 0000000000..f7067491da --- /dev/null +++ b/Task/Time-a-function/Lingo/time-a-function-2.lingo @@ -0,0 +1,5 @@ +ms = _system.milliseconds +testFunc() +ms = _system.milliseconds - ms +put "Execution time in ms:" && ms +-- "Execution time in ms: 983" diff --git a/Task/Time-a-function/Nim/time-a-function.nim b/Task/Time-a-function/Nim/time-a-function.nim new file mode 100644 index 0000000000..f0fbaea070 --- /dev/null +++ b/Task/Time-a-function/Nim/time-a-function.nim @@ -0,0 +1,14 @@ +import times, os + +proc doWork(x) = + var n = x + for i in 0..10000000: + n += i + echo n + +template time(s: stmt): expr = + let t0 = cpuTime() + s + cpuTime() - t0 + +echo time(doWork(100)) diff --git a/Task/Time-a-function/Phix/time-a-function.phix b/Task/Time-a-function/Phix/time-a-function.phix new file mode 100644 index 0000000000..6572f618d7 --- /dev/null +++ b/Task/Time-a-function/Phix/time-a-function.phix @@ -0,0 +1,3 @@ +atom t0 = time() +some_procedure() +printf(1,"%3.2fs.\n",time()-t0) diff --git a/Task/Time-a-function/Ring/time-a-function.ring b/Task/Time-a-function/Ring/time-a-function.ring new file mode 100644 index 0000000000..a9ba3f9080 --- /dev/null +++ b/Task/Time-a-function/Ring/time-a-function.ring @@ -0,0 +1,7 @@ +beginTime = TimeList()[13] +for n = 1 to 10000000 + n = n + 1 +next +endTime = TimeList()[13] +elapsedTime = endTime - beginTime +see "Elapsed time = " + elapsedTime + nl diff --git a/Task/Time-a-function/Sidef/time-a-function.sidef b/Task/Time-a-function/Sidef/time-a-function.sidef new file mode 100644 index 0000000000..613a831f01 --- /dev/null +++ b/Task/Time-a-function/Sidef/time-a-function.sidef @@ -0,0 +1,20 @@ +var benchmark = frequire('Benchmark') + +func fac_rec(n) { + n == 0 ? 1 : (n * __FUNC__(n - 1)) +} + +func fac_iter(n) { + var prod = 1 + n.times { |i| + prod *= i + } + prod +} + +var result = benchmark.timethese(-3, Hash( + 'fac_rec' => { fac_rec(20) }, + 'fac_iter' => { fac_iter(20) }, +)) + +benchmark.cmpthese(result) diff --git a/Task/Time-a-function/Wart/time-a-function.wart b/Task/Time-a-function/Wart/time-a-function.wart new file mode 100644 index 0000000000..4afc67f185 --- /dev/null +++ b/Task/Time-a-function/Wart/time-a-function.wart @@ -0,0 +1,3 @@ +time 1+1 +30000/1000000 # in microseconds +=> 2 diff --git a/Task/Tokenize-a-string/Ceylon/tokenize-a-string.ceylon b/Task/Tokenize-a-string/Ceylon/tokenize-a-string.ceylon new file mode 100644 index 0000000000..a9341837a1 --- /dev/null +++ b/Task/Tokenize-a-string/Ceylon/tokenize-a-string.ceylon @@ -0,0 +1,5 @@ +shared void tokenizeAString() { + value input = "Hello,How,Are,You,Today"; + value tokens = input.split(','.equals); + print(".".join(tokens)); +} diff --git a/Task/Tokenize-a-string/LFE/tokenize-a-string.lfe b/Task/Tokenize-a-string/LFE/tokenize-a-string.lfe new file mode 100644 index 0000000000..08c88ff7ec --- /dev/null +++ b/Task/Tokenize-a-string/LFE/tokenize-a-string.lfe @@ -0,0 +1,4 @@ +> (set split (string:tokens "Hello,How,Are,You,Today" ",")) +("Hello" "How" "Are" "You" "Today") +> (string:join split ".") +"Hello.How.Are.You.Today" diff --git a/Task/Tokenize-a-string/Lingo/tokenize-a-string.lingo b/Task/Tokenize-a-string/Lingo/tokenize-a-string.lingo new file mode 100644 index 0000000000..a2b7abc57f --- /dev/null +++ b/Task/Tokenize-a-string/Lingo/tokenize-a-string.lingo @@ -0,0 +1,9 @@ +input = "Hello,How,Are,You,Today" +_player.itemDelimiter = "," +output = "" +repeat with i = 1 to input.item.count + put input.item[i]&"." after output +end repeat +delete the last char of output +put output +-- "Hello.How.Are.You.Today" diff --git a/Task/Tokenize-a-string/Nim/tokenize-a-string.nim b/Task/Tokenize-a-string/Nim/tokenize-a-string.nim new file mode 100644 index 0000000000..7b6567a50f --- /dev/null +++ b/Task/Tokenize-a-string/Nim/tokenize-a-string.nim @@ -0,0 +1,5 @@ +import strutils + +let text = "Hello,How,Are,You,Today" +let tokens = text.split(',') +echo tokens.join(" ") diff --git a/Task/Tokenize-a-string/Oforth/tokenize-a-string.oforth b/Task/Tokenize-a-string/Oforth/tokenize-a-string.oforth new file mode 100644 index 0000000000..b6b535516e --- /dev/null +++ b/Task/Tokenize-a-string/Oforth/tokenize-a-string.oforth @@ -0,0 +1 @@ +"Hello,How,Are,You,Today" wordsWith(',') println diff --git a/Task/Tokenize-a-string/Phix/tokenize-a-string.phix b/Task/Tokenize-a-string/Phix/tokenize-a-string.phix new file mode 100644 index 0000000000..1b5ba8a526 --- /dev/null +++ b/Task/Tokenize-a-string/Phix/tokenize-a-string.phix @@ -0,0 +1 @@ +?split("Hello,How,Are,You,Today",',') diff --git a/Task/Tokenize-a-string/Ring/tokenize-a-string.ring b/Task/Tokenize-a-string/Ring/tokenize-a-string.ring new file mode 100644 index 0000000000..d99ddd90fe --- /dev/null +++ b/Task/Tokenize-a-string/Ring/tokenize-a-string.ring @@ -0,0 +1 @@ +see substr("Hello,How,Are,You,Today", ",", ".") diff --git a/Task/Tokenize-a-string/Sidef/tokenize-a-string.sidef b/Task/Tokenize-a-string/Sidef/tokenize-a-string.sidef new file mode 100644 index 0000000000..92481405f3 --- /dev/null +++ b/Task/Tokenize-a-string/Sidef/tokenize-a-string.sidef @@ -0,0 +1 @@ +'Hello,How,Are,You,Today'.split(',').join('.').say; diff --git a/Task/Tokenize-a-string/Swift/tokenize-a-string-1.swift b/Task/Tokenize-a-string/Swift/tokenize-a-string-1.swift new file mode 100644 index 0000000000..5905e2e184 --- /dev/null +++ b/Task/Tokenize-a-string/Swift/tokenize-a-string-1.swift @@ -0,0 +1,5 @@ +let text = "Hello,How,Are,You,Today" +let tokens = text.characters.split(",").map{String($0)} // for single-character separator +print(tokens) +let result = tokens.joinWithSeparator(".") +print(result) diff --git a/Task/Tokenize-a-string/Swift/tokenize-a-string-2.swift b/Task/Tokenize-a-string/Swift/tokenize-a-string-2.swift new file mode 100644 index 0000000000..be3201a174 --- /dev/null +++ b/Task/Tokenize-a-string/Swift/tokenize-a-string-2.swift @@ -0,0 +1,5 @@ +let text = "Hello,How,Are,You,Today" +let tokens = split(text, { $0 == "," }) // for single-character separator +println(tokens) +let result = ".".join(tokens) +println(result) diff --git a/Task/Tokenize-a-string/Swift/tokenize-a-string-3.swift b/Task/Tokenize-a-string/Swift/tokenize-a-string-3.swift new file mode 100644 index 0000000000..633cfeae98 --- /dev/null +++ b/Task/Tokenize-a-string/Swift/tokenize-a-string-3.swift @@ -0,0 +1,5 @@ +import Foundation + +let text = "Hello,How,Are,You,Today" +let tokens = text.componentsSeparatedByString(",") +print(tokens) diff --git a/Task/Tokenize-a-string/Ursa/tokenize-a-string.ursa b/Task/Tokenize-a-string/Ursa/tokenize-a-string.ursa new file mode 100644 index 0000000000..0053724ac3 --- /dev/null +++ b/Task/Tokenize-a-string/Ursa/tokenize-a-string.ursa @@ -0,0 +1,8 @@ +decl string text +set text "Hello,How,Are,You,Today" +decl string<> tokens +set tokens (split text ",") +for (decl int i) (< i (size tokens)) (inc i) + out tokens "." console +end for +out endl console diff --git a/Task/Tokenize-a-string/Wortel/tokenize-a-string.wortel b/Task/Tokenize-a-string/Wortel/tokenize-a-string.wortel new file mode 100644 index 0000000000..8c4a8d0b6d --- /dev/null +++ b/Task/Tokenize-a-string/Wortel/tokenize-a-string.wortel @@ -0,0 +1 @@ +@join "." @split "," "Hello,How,Are,You,Today" diff --git a/Task/Tokenize-a-string/jq/tokenize-a-string-1.jq b/Task/Tokenize-a-string/jq/tokenize-a-string-1.jq new file mode 100644 index 0000000000..782a732565 --- /dev/null +++ b/Task/Tokenize-a-string/jq/tokenize-a-string-1.jq @@ -0,0 +1 @@ +split(",") | join(".") diff --git a/Task/Tokenize-a-string/jq/tokenize-a-string-2.jq b/Task/Tokenize-a-string/jq/tokenize-a-string-2.jq new file mode 100644 index 0000000000..fb5625702a --- /dev/null +++ b/Task/Tokenize-a-string/jq/tokenize-a-string-2.jq @@ -0,0 +1,3 @@ +$ jq -r 'split(",") | join(".")' +"Hello,How,Are,You,Today" +Hello.How.Are.You.Today diff --git a/Task/Top-rank-per-group/EchoLisp/top-rank-per-group-1.echolisp b/Task/Top-rank-per-group/EchoLisp/top-rank-per-group-1.echolisp new file mode 100644 index 0000000000..f70d48fe97 --- /dev/null +++ b/Task/Top-rank-per-group/EchoLisp/top-rank-per-group-1.echolisp @@ -0,0 +1,14 @@ +(lib 'struct) ;; tables are based upon structures +(lib 'sql) ;; sql-select function + +;; input table +(define emps (make-table (struct emp (name id salary dept)))) +;; output table +(define high (make-table (struct out (dept name salary)))) + +;; sort/group procedure +(define (get-high num-records: N into: high) +(sql-select emp.dept emp.name emp.salary + from emps + group-by emp.dept + order-by emp.salary desc limit N into high)) diff --git a/Task/Top-rank-per-group/EchoLisp/top-rank-per-group-2.echolisp b/Task/Top-rank-per-group/EchoLisp/top-rank-per-group-2.echolisp new file mode 100644 index 0000000000..319c71b09b --- /dev/null +++ b/Task/Top-rank-per-group/EchoLisp/top-rank-per-group-2.echolisp @@ -0,0 +1,39 @@ +(define emps_file +'(("Tyler Bennett" E10297 32000 D101) +("John Rappl" E21437 47000 D050) +("George Woltman" E00127 53500 D101) +("Adam Smith" E63535 18000 D202) +("Claire Buckman" E39876 27800 D202) +("David McClellan" E04242 41500 D101) +("Rich Holcomb" E01234 49500 D202) +("Simon Gallubert" E00000 42 D666) +("Nathan Adams" E41298 21900 D050) +("Richard Potter" E43128 15900 D101) +("David Motsinger" E27002 19250 D202) +("Tim Sampair" E03033 27000 D101) +("Kim Arlich" E10001 57000 D190) +("Timothy Grove" E16398 29900 D190))) + +(list->table emps_file emps ) ;; load the table + +(get-high 2 high) +(table-print high) + +[0] D050 John Rappl 47000 +[1] D050 Nathan Adams 21900 +[2] D101 George Woltman 53500 +[3] D101 David McClellan 41500 +[4] D190 Kim Arlich 57000 +[5] D190 Timothy Grove 29900 +[6] D202 Rich Holcomb 49500 +[7] D202 Claire Buckman 27800 +[8] D666 Simon Gallubert 42 + +(sql-delete from high) +(get-high 1 high) +(table-print high) +[0] D050 John Rappl 47000 +[1] D101 George Woltman 53500 +[2] D190 Kim Arlich 57000 +[3] D202 Rich Holcomb 49500 +[4] D666 Simon Gallubert 42 diff --git a/Task/Top-rank-per-group/FunL/top-rank-per-group.funl b/Task/Top-rank-per-group/FunL/top-rank-per-group.funl new file mode 100644 index 0000000000..e265383e29 --- /dev/null +++ b/Task/Top-rank-per-group/FunL/top-rank-per-group.funl @@ -0,0 +1,27 @@ +data Employee( name, id, salary, dept ) + +employees = [ + Employee( 'Tyler Bennett', 'E10297', 32000, 'D101' ), + Employee( 'John Rappl', 'E21437', 47000, 'D050' ), + Employee( 'George Woltman', 'E00127', 53500, 'D101' ), + Employee( 'Adam Smith', 'E63535', 18000, 'D202' ), + Employee( 'Claire Buckman', 'E39876', 27800, 'D202' ), + Employee( 'David McClellan', 'E04242', 41500, 'D101' ), + Employee( 'Rich Holcomb', 'E01234', 49500, 'D202' ), + Employee( 'Nathan Adams', 'E41298', 21900, 'D050' ), + Employee( 'Richard Potter', 'E43128', 15900, 'D101' ), + Employee( 'David Motsinger', 'E27002', 19250, 'D202' ), + Employee( 'Tim Sampair', 'E03033', 27000, 'D101' ), + Employee( 'Kim Arlich', 'E10001', 57000, 'D190' ), + Employee( 'Timothy Grove', 'E16398', 29900, 'D190' ) + ] + +N = 2 + +for (dept, empl) <- employees.groupBy( e -> e.dept ).>toList().sortWith( (<) ) + println( dept ) + + for e <- empl.sortWith( \a, b -> a.salary > b.salary ).take( N ) + printf( " %-16s %6s %7d\n", e.name, e.id, e.salary ) + + println() diff --git a/Task/Top-rank-per-group/Nim/top-rank-per-group.nim b/Task/Top-rank-per-group/Nim/top-rank-per-group.nim new file mode 100644 index 0000000000..43c8ac4359 --- /dev/null +++ b/Task/Top-rank-per-group/Nim/top-rank-per-group.nim @@ -0,0 +1,39 @@ +import algorithm + +type Record = tuple[name, id: string, salary: int, department: string] + +var people: seq[Record] = + @[("Tyler Bennett", "E10297", 32000, "D101"), + ("John Rappl", "E21437", 47000, "D050"), + ("George Woltman", "E00127", 53500, "D101"), + ("Adam Smith", "E63535", 18000, "D202"), + ("Claire Buckman", "E39876", 27800, "D202"), + ("David McClellan", "E04242", 41500, "D101"), + ("Rich Holcomb", "E01234", 49500, "D202"), + ("Nathan Adams", "E41298", 21900, "D050"), + ("Richard Potter", "E43128", 15900, "D101"), + ("David Motsinger", "E27002", 19250, "D202"), + ("Tim Sampair", "E03033", 27000, "D101"), + ("Kim Arlich", "E10001", 57000, "D190"), + ("Timothy Grove", "E16398", 29900, "D190")] + +proc pcmp(a, b): int = + result = cmp(a.department, b.department) + if result != 0: return + result = cmp(b.salary, a.salary) + +proc top(n) = + sort(people, pcmp) + + var rank = 0 + for i, p in people: + if i > 0 and p.department != people[i-1].department: + rank = 0 + echo "" + + if rank < n: + echo p.department," ",p.salary," ",p.name + + inc rank + +top(2) diff --git a/Task/Top-rank-per-group/Oforth/top-rank-per-group.oforth b/Task/Top-rank-per-group/Oforth/top-rank-per-group.oforth new file mode 100644 index 0000000000..33e0671631 --- /dev/null +++ b/Task/Top-rank-per-group/Oforth/top-rank-per-group.oforth @@ -0,0 +1,27 @@ +Object Class new: Employee(name, id, salary, dep) + +Employee method: initialize := dep := salary := id := name ; +Employee method: salary @salary ; +Employee method: dep @dep ; +Employee method: << "[" << @dep << "," << @name << "," << @salary << "]" << ; + +: topRank(n) +| employees | + ListBuffer new ->employees + + Employee new("Tyler Bennett", "E10297", 32000, "D101") employees add + Employee new("John Rappl", "E21437", 47000, "D050") employees add + Employee new("George Woltman", "E00127", 53500, "D101") employees add + Employee new("Adam Smith", "E63535", 18000, "D202") employees add + Employee new("Claire Buckman", "E39876", 27800, "D202") employees add + Employee new("David McClellan", "E04242", 41500, "D101") employees add + Employee new("Rich Holcomb", "E01234", 49500, "D202") employees add + Employee new("Nathan Adams", "E41298", 21900, "D050") employees add + Employee new("Richard Potter", "E43128", 15900, "D101") employees add + Employee new("David Motsinger", "E27002", 19250, "D202") employees add + Employee new("Tim Sampair", "E03033", 27000, "D101") employees add + Employee new("Kim Arlich", "E10001", 57000, "D190") employees add + Employee new("Timothy Grove", "E16398", 29900, "D190") employees add + + #dep employees sortBy groupWith( #dep ) + map(#[ sortBy(#[ salary neg ]) left(n) ]) apply(#println) ; diff --git a/Task/Top-rank-per-group/Sidef/top-rank-per-group.sidef b/Task/Top-rank-per-group/Sidef/top-rank-per-group.sidef new file mode 100644 index 0000000000..0cee623b93 --- /dev/null +++ b/Task/Top-rank-per-group/Sidef/top-rank-per-group.sidef @@ -0,0 +1,28 @@ +var data = <<'EOF'.lines.map{ (var h = Hash()){} = .split(',')...; h } +Tyler Bennett,E10297,32000,D101 +John Rappl,E21437,47000,D050 +George Woltman,E00127,53500,D101 +Adam Smith,E63535,18000,D202 +Claire Buckman,E39876,27800,D202 +David McClellan,E04242,41500,D101 +Rich Holcomb,E01234,49500,D202 +Nathan Adams,E41298,21900,D050 +Richard Potter,E43128,15900,D101 +David Motsinger,E27002,19250,D202 +Tim Sampair,E03033,27000,D101 +Kim Arlich,E10001,57000,D190 +Timothy Grove,E16398,29900,D190 +EOF + +var n = (ARGV ? ARGV[0].to_i : "usage: #{__MAIN__} [n]\n".die); + +data.map {|h| h{:dept} }.uniq.sort.each { |d| + var es = data.grep { _{:dept} == d }.sort_by{ _{:salary}.to_num }.reverse; + say d; + n.times { + es || break; + var e = es.shift; + printf("%-15s | %-6s | %5d\n", e{%w(name id salary)}); + } + print "\n"; +} diff --git a/Task/Top-rank-per-group/jq/top-rank-per-group-1.jq b/Task/Top-rank-per-group/jq/top-rank-per-group-1.jq new file mode 100644 index 0000000000..317d186be1 --- /dev/null +++ b/Task/Top-rank-per-group/jq/top-rank-per-group-1.jq @@ -0,0 +1,6 @@ + { + "Employee Name": "Tyler Bennett", + "Employee ID": "E10297", + "Salary": "32000", + "Department": "D101" + } diff --git a/Task/Top-rank-per-group/jq/top-rank-per-group-2.jq b/Task/Top-rank-per-group/jq/top-rank-per-group-2.jq new file mode 100644 index 0000000000..9acb61efb3 --- /dev/null +++ b/Task/Top-rank-per-group/jq/top-rank-per-group-2.jq @@ -0,0 +1,10 @@ +def top_rank_per_department(n): + group_by(.Department) + | reduce .[] as $dept + ([]; ($dept + | map(.Salary) + | sort # from least to most + | .[length - n:] # top n salaries + | reverse) as $max + | ($dept[0] | .Department) as $dept + | . + [ { "Department": $dept, "top_salaries": $max } ] ); diff --git a/Task/Top-rank-per-group/jq/top-rank-per-group-3.jq b/Task/Top-rank-per-group/jq/top-rank-per-group-3.jq new file mode 100644 index 0000000000..91bdfa0eb7 --- /dev/null +++ b/Task/Top-rank-per-group/jq/top-rank-per-group-3.jq @@ -0,0 +1,31 @@ +$ jq 'top_rank_per_department(2) data.json +[ + { + "Department": "D050", + "top_salaries": [ + "47000", + "21900" + ] + }, + { + "Department": "D101", + "top_salaries": [ + "53500", + "41500" + ] + }, + { + "Department": "D190", + "top_salaries": [ + "57000", + "29900" + ] + }, + { + "Department": "D202", + "top_salaries": [ + "49500", + "27800" + ] + } +] diff --git a/Task/Topic-variable/Axe/topic-variable.axe b/Task/Topic-variable/Axe/topic-variable.axe new file mode 100644 index 0000000000..b0845043c8 --- /dev/null +++ b/Task/Topic-variable/Axe/topic-variable.axe @@ -0,0 +1,2 @@ +3 +Disp *3▶Dec,i diff --git a/Task/Topic-variable/FreeBASIC/topic-variable.freebasic b/Task/Topic-variable/FreeBASIC/topic-variable.freebasic new file mode 100644 index 0000000000..ded9db4f8e --- /dev/null +++ b/Task/Topic-variable/FreeBASIC/topic-variable.freebasic @@ -0,0 +1,20 @@ +' FB 1.05.0 Win64 + +' Three different ways of returning a value from a function + +Function Sum (x As Integer, y As Integer) As Integer + Sum = x + y '' using name of function +End Function + +Function Sum2 (x As Integer, y As Integer) As Integer + Function = x + y '' using Function keyword +End Function + +Function Sum3 (x As Integer, y As Integer) As Integer + Return x + y '' using Return keyword which always returns immediately +End Function + +Print Sum (1, 2) +Print Sum2(2, 3) +Print Sum3(3, 4) +Sleep diff --git a/Task/Topic-variable/Oforth/topic-variable.oforth b/Task/Topic-variable/Oforth/topic-variable.oforth new file mode 100644 index 0000000000..33adfe4c66 --- /dev/null +++ b/Task/Topic-variable/Oforth/topic-variable.oforth @@ -0,0 +1 @@ +3 dup sq swap sqrt diff --git a/Task/Topic-variable/Sidef/topic-variable.sidef b/Task/Topic-variable/Sidef/topic-variable.sidef new file mode 100644 index 0000000000..9fc26b980a --- /dev/null +++ b/Task/Topic-variable/Sidef/topic-variable.sidef @@ -0,0 +1 @@ +say [9,16,25].map {.sqrt}; # prints: [3, 4, 5] diff --git a/Task/Topological-sort/EchoLisp/topological-sort-1.echolisp b/Task/Topological-sort/EchoLisp/topological-sort-1.echolisp new file mode 100644 index 0000000000..739ec2275b --- /dev/null +++ b/Task/Topological-sort/EchoLisp/topological-sort-1.echolisp @@ -0,0 +1,26 @@ +(define dependencies +'((des_system_lib std synopsys std_cell_lib des_system_lib dw02 dw01 ramlib ieee) +(dw01 ieee dw01 dware gtech) ;; bad graph add dw04 +(dw02 ieee dw02 dware ) +(dw03 std synopsys dware dw03 dw02 dw01 ieee gtech) +(dw04 dw04 ieee dw01 dware gtech) +(dw05 dw05 ieee dware) +(dw06 dw06 ieee dware) +(dw07 ieee dware) +(dware ieee dware) +(gtech ieee gtech) +(ramlib std ieee ) +(std_cell_lib ieee std_cell_lib) +(synopsys ))) + + +;; build dependency graph +;; a depends on b +;; add arc (arrow) a --> b +(lib 'graph.lib) +(define (a->b g a b) + (unless (equal? a b) + (graph-make-arc g (graph-make-vertex g a) (graph-make-vertex g b)))) + +(define (add-dependencies g dep-list) +(for* ((dep dep-list) (b (rest dep))) (a->b g b (first dep)))) diff --git a/Task/Topological-sort/EchoLisp/topological-sort-2.echolisp b/Task/Topological-sort/EchoLisp/topological-sort-2.echolisp new file mode 100644 index 0000000000..ddfe4957ba --- /dev/null +++ b/Task/Topological-sort/EchoLisp/topological-sort-2.echolisp @@ -0,0 +1,31 @@ +;; topological sort +;; +;; Complexity O (# of vertices + # of edges) + +(define (t-sort g) + (stack 'Z) ; vertices of d°(0) + (stack 'S) ; ordered result + +;; mark all vertices with their in-degree = # of incoming arcs +;; push all vertices u such as d°(u) = 0 + (for ((u g)) (mark u (graph-vertex-indegree g u)) + (when (zero? (mark? u)) (push 'Z u))) + +;pop a d°(0) vertex u - add it to result +;decrement in-degree of all v vertices u->v +; if d°(v) = 0, push it + +(while (not (stack-empty? 'Z)) + (let (( u (pop 'Z))) + (push 'S u) + (for ((v (graph-vertex-out g u))) + (mark v (1- (mark? v))) + (when (zero? (mark? v)) (push 'Z v))))) + +;; finish + (writeln 't-sort (map vertex-label (stack->list 'S))) + +;; check no one remaining + (for ((u g)) + (unless (zero? (mark? u)) + (error " ♻️ t-sort:cyclic" (map vertex-label (graph-cycle g)))))) diff --git a/Task/Topological-sort/EchoLisp/topological-sort-3.echolisp b/Task/Topological-sort/EchoLisp/topological-sort-3.echolisp new file mode 100644 index 0000000000..e34f3b2c7e --- /dev/null +++ b/Task/Topological-sort/EchoLisp/topological-sort-3.echolisp @@ -0,0 +1,13 @@ +(define g (make-graph "VHDL")) +(add-dependencies g dependencies) +(graph-print g) + +(t-sort g) +→ t-sort (std synopsys ieee dware dw02 dw05 dw06 dw07 gtech dw01 dw03 dw04 ramlib + std_cell_lib des_system_lib) + +;; Error case +;; add dw01 -> dw04 +(t-sort g) +t-sort (std synopsys ieee dware dw02 dw05 dw06 dw07 gtech ramlib std_cell_lib) +⛔️ error: ♻️ t-sort:cyclic (dw04 dw01) diff --git a/Task/Topological-sort/FunL/topological-sort.funl b/Task/Topological-sort/FunL/topological-sort.funl new file mode 100644 index 0000000000..5816554efb --- /dev/null +++ b/Task/Topological-sort/FunL/topological-sort.funl @@ -0,0 +1,61 @@ +def topsort( graph ) = + val L = seq() + val S = seq() + val g = dict( graph ) + + for (v, es) <- g + g(v) = seq( es ) + + for (v, es) <- g if es.isEmpty() + S.append( v ) + + while not S.isEmpty() + val n = S.remove( 0 ) + L.append( n ) + + for (m, es) <- g if n in es + if (es -= n).isEmpty() + S.append( m ) + + for (v, es) <- g + if not es.isEmpty() + return None + + Some( L.toList() ) + +dependencies = ''' + des_system_lib std synopsys std_cell_lib des_system_lib dw02 dw01 ramlib ieee + dw01 ieee dw01 dware gtech + dw02 ieee dw02 dware + dw03 std synopsys dware dw03 dw02 dw01 ieee gtech + dw04 dw04 ieee dw01 dware gtech + dw05 dw05 ieee dware + dw06 dw06 ieee dware + dw07 ieee dware + dware ieee dware + gtech ieee gtech + ramlib std ieee + std_cell_lib ieee std_cell_lib + synopsys + ''' + +// convert dependencies data into a directed graph +graph = dict() +deps = set() + +for l <- WrappedString( dependencies ).lines() if l.trim() != '' + case list(l.trim().split('\\s+')) of + [a] -> graph(a) = [] + h:t -> + d = set( t ) + d -= h // remove self dependencies + graph(h) = d + deps ++= t + +// add graph vertices for dependencies not appearing in left column +for e <- deps if e not in graph + graph(e) = [] + +case topsort( graph ) of + None -> println( 'un-orderable' ) + Some( ordering ) -> println( ordering ) diff --git a/Task/Topological-sort/Sidef/topological-sort.sidef b/Task/Topological-sort/Sidef/topological-sort.sidef new file mode 100644 index 0000000000..416fe20497 --- /dev/null +++ b/Task/Topological-sort/Sidef/topological-sort.sidef @@ -0,0 +1,42 @@ +func print_topo_sort (deps) { + var ba = Hash.new; + deps.each { |before, afters| + afters.each { |after| + if (before != after) { + ba{before}{after} = 1; + }; + ba{after} \\= Hash.new; + } + }; + + loop { + var afters = ba.keys.grep {|k| ba{k}.values.len == 0 }.sort; + afters.len || break; + say afters.join(" "); + ba.delete(afters...); + ba.values.each { |v| v.delete(afters...) }; + }; + + say (ba.len ? "Cicle found! #{ba.keys.sort}" : "---"); +} + +var deps = Hash.new( + des_system_lib => < std synopsys std_cell_lib des_system_lib dw02 + dw01 ramlib ieee >, + dw01 => < ieee dw01 dware gtech >, + dw02 => < ieee dw02 dware >, + dw03 => < std synopsys dware dw03 dw02 dw01 ieee gtech >, + dw04 => < dw04 ieee dw01 dware gtech >, + dw05 => < dw05 ieee dware >, + dw06 => < dw06 ieee dware >, + dw07 => < ieee dware >, + dware => < ieee dware >, + gtech => < ieee gtech >, + ramlib => < std ieee >, + std_cell_lib => < ieee std_cell_lib >, + synopsys => < > +); + +print_topo_sort(deps); +deps{:dw01}.append('dw04'); # Add unresolvable dependency +print_topo_sort(deps); diff --git a/Task/Topological-sort/jq/topological-sort-1.jq b/Task/Topological-sort/jq/topological-sort-1.jq new file mode 100644 index 0000000000..9a969173c7 --- /dev/null +++ b/Task/Topological-sort/jq/topological-sort-1.jq @@ -0,0 +1,51 @@ +# independent/0 emits an array of the dependencies that have no dependencies +# Input: an object representing a normalized dependency graph +def independent: + . as $G + | reduce keys[] as $key + ([]; + . + ((reduce $G[$key][] as $node + ([]; + if ($G[$node] == null or ($G[$node]|length)==0) then . + [$node] + else . + end )))) + | unique; + +# normalize/0 eliminates self-dependencies in the input dependency graph. +# Input: an object representing a dependency graph. +def normalize: + . as $G + | reduce keys[] as $key + ($G; + .[$key] as $nodes + | if $nodes and ($nodes|index($key)) then .[$key] = $nodes - [$key] else . end); + + +# minus/1 removes all the items in ary from each of the values in the input object +# Input: an object representing a dependency graph +def minus(ary): + . as $G | reduce keys[] as $key ($G; $G[$key] -= ary); + +# tsort/0 emits the topologically sorted nodes of the input, +# in ">" order. +# Input is assumed to be an object representing a dependency +# graph and need not be normalized. +def tsort: + # _sort: input: [L, Graph], where L is the tsort so far + def _tsort: + + def done: [.[]] | all( length==0 ); + + .[0] as $L | .[1] as $G + | if ($G|done) then $L + (($G|keys) - $L) + else + ($G|independent) as $I + | if (($I|length) == 0) + then error("the dependency graph is cyclic: \($G)") + else [ ($L + $I), ($G|minus($I))] | _tsort + end + end; + + normalize | [[], .] | _tsort ; + +tsort diff --git a/Task/Topological-sort/jq/topological-sort-2.jq b/Task/Topological-sort/jq/topological-sort-2.jq new file mode 100644 index 0000000000..ff1dd04333 --- /dev/null +++ b/Task/Topological-sort/jq/topological-sort-2.jq @@ -0,0 +1,14 @@ +{"des_system_lib": [ "std", "synopsys", "std_cell_lib", "des_system_lib", "dw02", "dw01", "ramlib", "ieee"], + "dw01": [ "ieee", "dw01", "dware", "gtech"], + "dw02": [ "ieee", "dw02", "dware"], + "dw03": [ "std", "synopsys", "dware", "dw03", "dw02", "dw01", "ieee", "gtech"], + "dw04": [ "dw04", "ieee", "dw01", "dware", "gtech"], + "dw05": [ "dw05", "ieee", "dware"], + "dw06": [ "dw06", "ieee", "dware"], + "dw07": [ "ieee", "dware"], + "dware": [ "ieee", "dware"], + "gtech": [ "ieee", "gtech"], + "ramlib": [ "std", "ieee"], + "std_cell_lib": [ "ieee", "std_cell_lib"], + "synopsys": [] +} diff --git a/Task/Topological-sort/jq/topological-sort-3.jq b/Task/Topological-sort/jq/topological-sort-3.jq new file mode 100644 index 0000000000..4f268a62a0 --- /dev/null +++ b/Task/Topological-sort/jq/topological-sort-3.jq @@ -0,0 +1,2 @@ +$ jq -c -f tsort.jq tsort.json +["ieee","std","synopsys","dware","gtech","ramlib","std_cell_lib","dw01","dw02","des_system_lib","dw03","dw04","dw05","dw06","dw07"] diff --git a/Task/Topswops/Phix/topswops.phix b/Task/Topswops/Phix/topswops.phix new file mode 100644 index 0000000000..bef5afaeee --- /dev/null +++ b/Task/Topswops/Phix/topswops.phix @@ -0,0 +1,44 @@ +function fannkuch(integer n) +sequence start = tagset(n), + perm, + perm1 = start, + count = start +integer maxFlipsCount = 0, r = n+1 +integer perm0, flipsCount, k, k2, j, j2 + + while 1 do + while r!=1 do count[r-1] = r r -= 1 end while + if not (perm1[1]=1 or perm1[n]=n) then + perm = perm1 + flipsCount = 0 + k = perm[1] + while k!=1 do + k2 = floor((k+1)/2) + perm = reverse(perm[1..k]) & perm[k+1..n] + flipsCount += 1 + k = perm[1] + end while + if flipsCount>maxFlipsCount then + maxFlipsCount = flipsCount + end if + end if + -- Use incremental change to generate another permutation + while 1 do + if r>n then return maxFlipsCount end if + perm0 = perm1[1] + j2 = 1 + while j21 then exit else r += 1 end if + end while + end while +end function -- fannkuch + +for i=1 to 10 do + ? fannkuch(i) +end for diff --git a/Task/Topswops/Potion/topswops.potion b/Task/Topswops/Potion/topswops.potion new file mode 100644 index 0000000000..e0825d90e9 --- /dev/null +++ b/Task/Topswops/Potion/topswops.potion @@ -0,0 +1,54 @@ +range = (a, b): + i = 0, l = list(b-a+1) + while (a + i <= b): + l (i) = a + i++. + l. + +fannkuch = (n): + flips = 0, maxf = 0, k = 0, m = n - 1, r = n + perml = range(0, n), count = list(n), perm = list(n) + + loop: + while (r != 1): + count (r-1) = r + r--. + + if (perml (0) != 0 and perml (m) != m): + flips = 0, i = 1 + while (i < n): + perm (i) = perml (i) + i++. + k = perml (0) + loop: + i = 1, j = k - 1 + while (i < j): + t = perm (i), perm (i) = perm (j), perm (j) = t + i++, j--. + flips++ + j = perm (k), perm (k) = k, k = j + if (k == 0): break. + . + if (flips > maxf): maxf = flips. + . + + loop: + if (r == n): + (n, maxf) say + return (maxf). + + i = 0, j = perml (0) + while (i < r): + k = i + 1 + perml (i) = perml (k) + i = k. + perml (r) = j + + j = count (r) - 1 + count (r) = j + if (j > 0): break. + r++ +_ n + +n = argv(1) number +if (n<1): n=10. +fannkuch(n) diff --git a/Task/Topswops/jq/topswops-1.jq b/Task/Topswops/jq/topswops-1.jq new file mode 100644 index 0000000000..d9f06310aa --- /dev/null +++ b/Task/Topswops/jq/topswops-1.jq @@ -0,0 +1,20 @@ +# "while" as defined here is included in recent versions (>1.4) of jq: +def until(cond; next): + def _until: + if cond then . else (next|_until) end; + _until; + +# Generate a stream of permutations of [1, ... n]. +# This implementation uses arity-0 filters for speed. +def permutations: + # Given a single array, insert generates a stream by inserting (length+1) at different positions + def insert: # state: [m, array] + .[0] as $m | (1+(.[1]|length)) as $n + | .[1] + | if $m >= 0 then (.[0:$m] + [$n] + .[$m:]), ([$m-1, .] | insert) else empty end; + + if .==0 then [] + elif . == 1 then [1] + else + . as $n | ($n-1) | permutations | [$n-1, .] | insert + end; diff --git a/Task/Topswops/jq/topswops-2.jq b/Task/Topswops/jq/topswops-2.jq new file mode 100644 index 0000000000..0abea79194 --- /dev/null +++ b/Task/Topswops/jq/topswops-2.jq @@ -0,0 +1,13 @@ +# Input: a permutation; output: an integer +def flips: + # state: [i, array] + [0, .] + | until( .[1][0] == 1; + .[1] as $p | $p[0] as $p0 + | [.[0] + 1, ($p[:$p0] | reverse) + $p[$p0:] ] ) + | .[0]; + +# input: n, the number of items +def fannkuch: + reduce permutations as $p + (0; [., ($p|flips) ] | max); diff --git a/Task/Topswops/jq/topswops-3.jq b/Task/Topswops/jq/topswops-3.jq new file mode 100644 index 0000000000..6864a7d75f --- /dev/null +++ b/Task/Topswops/jq/topswops-3.jq @@ -0,0 +1 @@ +range(1; 11) | [., fannkuch ] diff --git a/Task/Topswops/jq/topswops-4.jq b/Task/Topswops/jq/topswops-4.jq new file mode 100644 index 0000000000..7c1b3c0f1c --- /dev/null +++ b/Task/Topswops/jq/topswops-4.jq @@ -0,0 +1,11 @@ +$ jq -n -c -f topswops.jq +[1,0] +[2,1] +[3,2] +[4,4] +[5,7] +[6,10] +[7,16] +[8,22] +[9,30] +[10,38] diff --git a/Task/Total-circles-area/EchoLisp/total-circles-area.echolisp b/Task/Total-circles-area/EchoLisp/total-circles-area.echolisp new file mode 100644 index 0000000000..b5fcf7d60c --- /dev/null +++ b/Task/Total-circles-area/EchoLisp/total-circles-area.echolisp @@ -0,0 +1,120 @@ +(lib 'math) +(define (make-circle x0 y0 r) + (vector x0 y0 r )) + +(define-syntax-id _.radius (_ 2)) +(define-syntax-id _.x0 (_ 0)) +(define-syntax-id _.y0 (_ 1)) + +;; to sort circles +(define (cmp-circles a b) (> a.radius b.radius)) + +(define (included? circle: a circles) + (for/or ((b circles)) + #:continue (equal? a b) + (disk-in-disk? a b))) + +;; eliminates, and sort +(define (sort-circles circles) + (list-sort cmp-circles + (filter (lambda(c) (not (included? c circles))) circles))) + +(define circles (sort-circles + (list (make-circle 1.6417233788 1.6121789534 0.0848270516) + (make-circle -1.4944608174 1.2077959613 1.1039549836) + (make-circle 0.6110294452 -0.6907087527 0.9089162485) + (make-circle 0.3844862411 0.2923344616 0.2375743054) + (make-circle -0.2495892950 -0.3832854473 1.0845181219) + (make-circle 1.7813504266 1.6178237031 0.8162655711) + (make-circle -0.1985249206 -0.8343333301 0.0538864941) + (make-circle -1.7011985145 -0.1263820964 0.4776976918) + (make-circle -0.4319462812 1.4104420482 0.7886291537) + (make-circle 0.2178372997 -0.9499557344 0.0357871187) + (make-circle -0.6294854565 -1.3078893852 0.7653357688) + (make-circle 1.7952608455 0.6281269104 0.2727652452) + (make-circle 1.4168575317 1.0683357171 1.1016025378) + (make-circle 1.4637371396 0.9463877418 1.1846214562) + (make-circle -0.5263668798 1.7315156631 1.4428514068) + (make-circle -1.2197352481 0.9144146579 1.0727263474) + (make-circle -0.1389358881 0.1092805780 0.7350208828) + (make-circle 1.5293954595 0.0030278255 1.2472867347) + (make-circle -0.5258728625 1.3782633069 1.3495508831) + (make-circle -0.1403562064 0.2437382535 1.3804956588) + (make-circle 0.8055826339 -0.0482092025 0.3327165165) + (make-circle -0.6311979224 0.7184578971 0.2491045282) + (make-circle 1.4685857879 -0.8347049536 1.3670667538) + (make-circle -0.6855727502 1.6465021616 1.0593087096) + (make-circle 0.0152957411 0.0638919221 0.9771215985)))) + +;; bounding box +(define (enclosing-rect circles) + (define xmin (for/min ((c circles)) (- c.x0 c.radius))) + (define xmax (for/max ((c circles)) (+ c.x0 c.radius))) + (define ymin (for/min ((c circles)) (- c.y0 c.radius))) + (define ymax (for/max ((c circles)) (+ c.y0 c.radius))) + (vector xmin ymin (- xmax xmin) (- ymax ymin))) + +;; Compute surface of entirely overlapped tiles +;; and assign candidates circles to other tiles. +;; cands is a vector nsteps x nsteps of circles lists indexed by (i,j) + +(define (S0 circles rect steps into: cands) + (define dx (// (rect 2) steps)) ;; width / steps + (define dy (// (rect 3) steps)) ;; height / steps + (define ds (* dx dy)) ;; tile surface + (define dr (vector (- rect.x0 dx) (- rect.y0 dy) dx dy)) + (define ijdx 0) + + (for/sum ((i steps)) + (vector+= dr 0 dx) + (vector-set! dr 1 (- rect.y0 dy)) + + (for/sum ((j steps)) + (vector+= dr 1 dy) + (set! ijdx (+ i (* j steps))) + + (for/sum ((c circles)) + #:break (rect-in-disk? dr c) ;; enclosed ? add ds + => (begin (vector-set! cands ijdx null) ds) + #:continue (not (rect-disk-intersect? dr c)) + ;; intersects ? add circle to candidates for this tile + (vector-set! cands ijdx (cons c (cands ijdx ))) + 0) + ))) + +(define ct 0) +;; return sum of surfaces of tiles which are not entirely overlapped +(define (S circles rect steps cands) +(++ ct) + (define dx (// (rect 2) steps)) + (define dy (// (rect 3) steps)) + (define ds (* dx dy)) + (define dr (vector (- rect.x0 dx) (- rect.y0 dy) dx dy)) + (define ijdx 0) + + (for/sum ((i steps)) + (vector+= dr 0 dx) + (vector-set! dr 1 (- (rect 1) dy)) + + (for/sum ((j steps)) + (vector+= dr 1 dy) + + (when (!null? cands) (set! circles (cands (+ i (* j steps))))) + #:continue (null? circles) + + ;; add surface + (or + (for/or ((c circles)) ;; enclosed ? add ds + #:break (rect-in-disk? dr c) => ds + #f ) + + (if ;; not intersecting? add 0 + (for/or ((c circles)) + (rect-disk-intersect? dr c)) #f 0) + + ;; intersecting ? recurse until precision + (when (> dx s-precision) (S circles dr 2 null)) + + ;; no hope - add ds/2 + (// ds 2)) + ))) diff --git a/Task/Total-circles-area/Nim/total-circles-area.nim b/Task/Total-circles-area/Nim/total-circles-area.nim new file mode 100644 index 0000000000..f34cd37fee --- /dev/null +++ b/Task/Total-circles-area/Nim/total-circles-area.nim @@ -0,0 +1,53 @@ +import future + +type Circle = tuple[x, y, r: float] + +const circles: seq[Circle] = @[ + ( 1.6417233788, 1.6121789534, 0.0848270516), + (-1.4944608174, 1.2077959613, 1.1039549836), + ( 0.6110294452, -0.6907087527, 0.9089162485), + ( 0.3844862411, 0.2923344616, 0.2375743054), + (-0.2495892950, -0.3832854473, 1.0845181219), + ( 1.7813504266, 1.6178237031, 0.8162655711), + (-0.1985249206, -0.8343333301, 0.0538864941), + (-1.7011985145, -0.1263820964, 0.4776976918), + (-0.4319462812, 1.4104420482, 0.7886291537), + ( 0.2178372997, -0.9499557344, 0.0357871187), + (-0.6294854565, -1.3078893852, 0.7653357688), + ( 1.7952608455, 0.6281269104, 0.2727652452), + ( 1.4168575317, 1.0683357171, 1.1016025378), + ( 1.4637371396, 0.9463877418, 1.1846214562), + (-0.5263668798, 1.7315156631, 1.4428514068), + (-1.2197352481, 0.9144146579, 1.0727263474), + (-0.1389358881, 0.1092805780, 0.7350208828), + ( 1.5293954595, 0.0030278255, 1.2472867347), + (-0.5258728625, 1.3782633069, 1.3495508831), + (-0.1403562064, 0.2437382535, 1.3804956588), + ( 0.8055826339, -0.0482092025, 0.3327165165), + (-0.6311979224, 0.7184578971, 0.2491045282), + ( 1.4685857879, -0.8347049536, 1.3670667538), + (-0.6855727502, 1.6465021616, 1.0593087096), + ( 0.0152957411, 0.0638919221, 0.9771215985)] + +let xMin = min circles.map((c: Circle) => c.x - c.r) +let xMax = max circles.map((c: Circle) => c.x + c.r) +let yMin = min circles.map((c: Circle) => c.y - c.r) +let yMax = max circles.map((c: Circle) => c.y + c.r) + +const boxSide = 500 + +let dx = (xMax - xMin) / boxSide +let dy = (yMax - yMin) / boxSide + +var count = 0 + +for r in 0 .. SOURCE$="Left" END -> + 2-> SOURCE$="Center" END -> + 3-> SOURCE$="Right" END -> + END CASE + CASE J OF + 1-> DEST$="Left" END -> + 2-> DEST$="Center" END -> + 3-> DEST$="Right" END -> + END CASE + PRINT("I move a disk from ";SOURCE$;" to ";DEST$) +END PROCEDURE + +PROCEDURE MOVE + IF NUMBER<>0 THEN + NUMBER=NUMBER-1 + J=6-I-J + MOVE + J=6-I-J + PRINTMOVE + I=6-I-J + MOVE + I=6-I-J + NUMBER=NUMBER+1 + END IF +END PROCEDURE + +BEGIN + MAXNUM=12 + MOSSE=0 + PRINT(CHR$(12);TAB(25);"--- TOWERS OF HANOI ---") + REPEAT + PRINT("Number of disks ";) + INPUT(NUMBER) + UNTIL NUMBER>1 AND NUMBER<=MAXNUM + PRINT + PRINT("For ";NUMBER;"disks the total number of moves is";2^NUMBER-1) + I=1 ! number of source pole + J=3 ! number of destination pole + MOVE +END PROGRAM diff --git a/Task/Towers-of-Hanoi/Ezhil/towers-of-hanoi.ezhil b/Task/Towers-of-Hanoi/Ezhil/towers-of-hanoi.ezhil new file mode 100644 index 0000000000..f3da53a20e --- /dev/null +++ b/Task/Towers-of-Hanoi/Ezhil/towers-of-hanoi.ezhil @@ -0,0 +1,27 @@ +# (C) 2013 Ezhil Language Project +# Tower of Hanoi – recursive solution + +நிரல்பாகம் ஹோனாய்(வட்டுகள், முதல்அச்சு, இறுதிஅச்சு,வட்டு) + + @(வட்டுகள் == 1 ) ஆனால் + பதிப்பி “வட்டு ” + str(வட்டு) + “ஐ \t (” + str(முதல்அச்சு) + “ —> ” + str(இறுதிஅச்சு)+ “) அச்சிற்கு நகர்த்துக.” + இல்லை + + @( ["இ", "அ", "ஆ"] இல் அச்சு ) ஒவ்வொன்றாக + @( (முதல்அச்சு != அச்சு) && (இறுதிஅச்சு != அச்சு) ) ஆனால் + நடு = அச்சு + முடி + முடி + + # solve problem for n-1 again between src and temp pegs + ஹோனாய்(வட்டுகள்-1, முதல்அச்சு,நடு,வட்டுகள்-1) + + # move largest disk from src to destination + ஹோனாய்(1, முதல்அச்சு, இறுதிஅச்சு,வட்டுகள்) + + # solve problem for n-1 again between different pegs + ஹோனாய்(வட்டுகள்-1, நடு, இறுதிஅச்சு,வட்டுகள்-1) + முடி +முடி + +ஹோனாய்(4,”அ”,”ஆ”,0) diff --git a/Task/Towers-of-Hanoi/FreeBASIC/towers-of-hanoi.freebasic b/Task/Towers-of-Hanoi/FreeBASIC/towers-of-hanoi.freebasic new file mode 100644 index 0000000000..a1d59c443d --- /dev/null +++ b/Task/Towers-of-Hanoi/FreeBASIC/towers-of-hanoi.freebasic @@ -0,0 +1,17 @@ +' FB 1.05.0 Win64 + +Sub move(n As Integer, from As Integer, to_ As Integer, via As Integer) + If n > 0 Then + move(n - 1, from, via, to_) + Print "Move disk"; n; " from pole"; from; " to pole"; to_ + move(n - 1, via, to_, from) + End If +End Sub + +Print "Three disks" : Print +move 3, 1, 2, 3 +Print +Print "Four disks" : Print +move 4, 1, 2, 3 +Print "Press any key to quit" +Sleep diff --git a/Task/Towers-of-Hanoi/FutureBasic/towers-of-hanoi.futurebasic b/Task/Towers-of-Hanoi/FutureBasic/towers-of-hanoi.futurebasic new file mode 100644 index 0000000000..5c217d9fd4 --- /dev/null +++ b/Task/Towers-of-Hanoi/FutureBasic/towers-of-hanoi.futurebasic @@ -0,0 +1,14 @@ +include "ConsoleWindow" + +void local fn move( n as long, fromPeg as long, toPeg as long, viaPeg as long ) +if n > 0 + fn move( n-1, fromPeg, viaPeg, toPeg ) + print "Move disk from "; fromPeg; " to "; toPeg + fn move( n-1, viaPeg, toPeg, fromPeg ) +end if +end fn + +fn move( 4, 1, 2, 3 ) +print +print "Towers of Hanoi puzzle solved." +end diff --git a/Task/Towers-of-Hanoi/Lasso/towers-of-hanoi-1.lasso b/Task/Towers-of-Hanoi/Lasso/towers-of-hanoi-1.lasso new file mode 100644 index 0000000000..57913ea28d --- /dev/null +++ b/Task/Towers-of-Hanoi/Lasso/towers-of-hanoi-1.lasso @@ -0,0 +1,14 @@ +#!/usr/bin/lasso9 + +define towermove( + disks::integer, + a,b,c +) => { + if(#disks > 0) => { + towermove(#disks - 1, #a, #c, #b ) + stdoutnl("Move disk from " + #a + " to " + #c) + towermove(#disks - 1, #b, #a, #c ) + } +} + +towermove((integer($argv -> second || 3)), "A", "B", "C") diff --git a/Task/Towers-of-Hanoi/Lasso/towers-of-hanoi-2.lasso b/Task/Towers-of-Hanoi/Lasso/towers-of-hanoi-2.lasso new file mode 100644 index 0000000000..2335691dca --- /dev/null +++ b/Task/Towers-of-Hanoi/Lasso/towers-of-hanoi-2.lasso @@ -0,0 +1 @@ +./towers diff --git a/Task/Towers-of-Hanoi/Lasso/towers-of-hanoi-3.lasso b/Task/Towers-of-Hanoi/Lasso/towers-of-hanoi-3.lasso new file mode 100644 index 0000000000..e941fbdaea --- /dev/null +++ b/Task/Towers-of-Hanoi/Lasso/towers-of-hanoi-3.lasso @@ -0,0 +1 @@ +./towers 4 diff --git a/Task/Towers-of-Hanoi/Lingo/towers-of-hanoi-1.lingo b/Task/Towers-of-Hanoi/Lingo/towers-of-hanoi-1.lingo new file mode 100644 index 0000000000..c2f5e7fd55 --- /dev/null +++ b/Task/Towers-of-Hanoi/Lingo/towers-of-hanoi-1.lingo @@ -0,0 +1,7 @@ +on hanoi (n, a, b, c) + if n > 0 then + hanoi(n-1, a, c, b) + put "Move disk from" && a && "to" && c + hanoi(n-1, b, a, c) + end if +end diff --git a/Task/Towers-of-Hanoi/Lingo/towers-of-hanoi-2.lingo b/Task/Towers-of-Hanoi/Lingo/towers-of-hanoi-2.lingo new file mode 100644 index 0000000000..9ec1d3f018 --- /dev/null +++ b/Task/Towers-of-Hanoi/Lingo/towers-of-hanoi-2.lingo @@ -0,0 +1,8 @@ +hanoi(3, "A", "B", "C") +-- "Move disk from A to C" +-- "Move disk from A to B" +-- "Move disk from C to B" +-- "Move disk from A to C" +-- "Move disk from B to A" +-- "Move disk from B to C" +-- "Move disk from A to C" diff --git a/Task/Towers-of-Hanoi/Monte/towers-of-hanoi.monte b/Task/Towers-of-Hanoi/Monte/towers-of-hanoi.monte new file mode 100644 index 0000000000..8444400f2c --- /dev/null +++ b/Task/Towers-of-Hanoi/Monte/towers-of-hanoi.monte @@ -0,0 +1,7 @@ +def move(n, fromPeg, toPeg, viaPeg): + if (n > 0): + move(n.previous(), fromPeg, viaPeg, toPeg) + traceln(`Move disk $n from $fromPeg to $toPeg`) + move(n.previous(), viaPeg, toPeg, fromPeg) + +move(3, "left", "right", "middle") diff --git a/Task/Towers-of-Hanoi/Nim/towers-of-hanoi.nim b/Task/Towers-of-Hanoi/Nim/towers-of-hanoi.nim new file mode 100644 index 0000000000..d80d015f79 --- /dev/null +++ b/Task/Towers-of-Hanoi/Nim/towers-of-hanoi.nim @@ -0,0 +1,7 @@ +proc hanoi(disks: int, fromTower: string, toTower: string, viaTower: string) = + if disks != 0: + hanoi(disks - 1, fromTower, viaTower, toTower) + echo("Move disk ", disks, " from ", fromTower, " to ", toTower) + hanoi(disks - 1, viaTower, toTower, fromTower) + +hanoi(4, "1", "2", "3") diff --git a/Task/Towers-of-Hanoi/Oforth/towers-of-hanoi.oforth b/Task/Towers-of-Hanoi/Oforth/towers-of-hanoi.oforth new file mode 100644 index 0000000000..c2cbb4fc9f --- /dev/null +++ b/Task/Towers-of-Hanoi/Oforth/towers-of-hanoi.oforth @@ -0,0 +1,8 @@ +: move(n, from, to, via) + n 0 > ifTrue: [ + move(n 1-, from, via, to) + System.Out "Move disk from " << from << " to " << to << cr + move(n 1-, via, to, from) + ] ; + +5 $left $middle $right) move diff --git a/Task/Towers-of-Hanoi/PHL/towers-of-hanoi.phl b/Task/Towers-of-Hanoi/PHL/towers-of-hanoi.phl new file mode 100644 index 0000000000..ee4227bb1b --- /dev/null +++ b/Task/Towers-of-Hanoi/PHL/towers-of-hanoi.phl @@ -0,0 +1,16 @@ +module hanoi; + +extern printf; + +@Void move(@Integer n, @Integer from, @Integer to, @Integer via) [ + if (n > 0) { + move(n - 1, from, via, to); + printf("Move disk from pole %d to pole %d\n", from, to); + move(n - 1, via, to, from); + } +] + +@Integer main [ + move(4, 1,2,3); + return 0; +] diff --git a/Task/Towers-of-Hanoi/Ring/towers-of-hanoi.ring b/Task/Towers-of-Hanoi/Ring/towers-of-hanoi.ring new file mode 100644 index 0000000000..eb66ce990b --- /dev/null +++ b/Task/Towers-of-Hanoi/Ring/towers-of-hanoi.ring @@ -0,0 +1,6 @@ +move(4, 1, 2, 3) + +func move n, src, dst, via + if n > 0 move(n - 1, src, via, dst) + see "" + src + " to " + dst + nl + move(n - 1, via, dst, src) ok diff --git a/Task/Towers-of-Hanoi/Sidef/towers-of-hanoi.sidef b/Task/Towers-of-Hanoi/Sidef/towers-of-hanoi.sidef new file mode 100644 index 0000000000..6b65a44db1 --- /dev/null +++ b/Task/Towers-of-Hanoi/Sidef/towers-of-hanoi.sidef @@ -0,0 +1,11 @@ +func hanoi(n, from=1, to=2, via=3) { + if (n == 1) { + say "Move disk from pole #{from} to pole #{to}."; + } else { + hanoi(n-1, from, via, to); + hanoi( 1, from, to, via); + hanoi(n-1, via, to, from); + } +} + +hanoi(4); diff --git a/Task/Towers-of-Hanoi/Swift/towers-of-hanoi-1.swift b/Task/Towers-of-Hanoi/Swift/towers-of-hanoi-1.swift new file mode 100644 index 0000000000..24b5284b35 --- /dev/null +++ b/Task/Towers-of-Hanoi/Swift/towers-of-hanoi-1.swift @@ -0,0 +1,9 @@ +func hanoi(n:Int, a:String, b:String, c:String) { + if (n > 0) { + hanoi(n - 1, a, c, b) + println("Move disk from \(a) to \(c)") + hanoi(n - 1, b, a, c) + } +} + +hanoi(4, "A", "B", "C") diff --git a/Task/Towers-of-Hanoi/Swift/towers-of-hanoi-2.swift b/Task/Towers-of-Hanoi/Swift/towers-of-hanoi-2.swift new file mode 100644 index 0000000000..0c2a27d1da --- /dev/null +++ b/Task/Towers-of-Hanoi/Swift/towers-of-hanoi-2.swift @@ -0,0 +1,9 @@ +func hanoi(n:Int, a:String, b:String, c:String) { + if (n > 0) { + hanoi(n - 1, a: a, b: c, c: b) + print("Move disk from \(a) to \(c)") + hanoi(n - 1, a: b, b: a, c: c) + } +} + +hanoi(4, a:"A", b:"B", c:"C") diff --git a/Task/Towers-of-Hanoi/jq/towers-of-hanoi.jq b/Task/Towers-of-Hanoi/jq/towers-of-hanoi.jq new file mode 100644 index 0000000000..c4346f763a --- /dev/null +++ b/Task/Towers-of-Hanoi/jq/towers-of-hanoi.jq @@ -0,0 +1,11 @@ +# n is the number of disks to move from From to To +def move(n; From; To; Via): + if n > 0 then + # move all but the largest at From to Via (according to the rules): + move(n-1; From; Via; To), + # ... so the largest disk at From is now free to move to its final destination: + "Move disk from \(From) to \(To)", + # Move the remaining disks at Via to To: + move(n-1; Via; To; From) + else empty + end; diff --git a/Task/Trabb-Pardo-Knuth-algorithm/ERRE/trabb-pardo-knuth-algorithm.erre b/Task/Trabb-Pardo-Knuth-algorithm/ERRE/trabb-pardo-knuth-algorithm.erre new file mode 100644 index 0000000000..b3dd979b90 --- /dev/null +++ b/Task/Trabb-Pardo-Knuth-algorithm/ERRE/trabb-pardo-knuth-algorithm.erre @@ -0,0 +1,22 @@ +!Trabb Pardo-Knuth algorithm +PROGRAM TPK +!VAR I%,Y +DIM A[10] + +FUNCTION F(T) + F=SQR(ABS(T))+5*T^3 +END FUNCTION + +BEGIN + DATA(10,-1,1,2,3,4,4.3,4.305,4.303,4.302,4.301) + FOR I%=0 TO 10 DO + READ(A[I%]) + END FOR + FOR I%=10 TO 0 STEP -1 DO + Y=F(A[I%]) + PRINT("F(";A[I%];")=";) + IF Y>400 THEN PRINT("--->too large<---") + ELSE PRINT(Y) + END IF + END FOR +END PROGRAM diff --git a/Task/Trabb-Pardo-Knuth-algorithm/EchoLisp/trabb-pardo-knuth-algorithm-1.echolisp b/Task/Trabb-Pardo-Knuth-algorithm/EchoLisp/trabb-pardo-knuth-algorithm-1.echolisp new file mode 100644 index 0000000000..b4a56ea3c7 --- /dev/null +++ b/Task/Trabb-Pardo-Knuth-algorithm/EchoLisp/trabb-pardo-knuth-algorithm-1.echolisp @@ -0,0 +1,18 @@ +(define (trabb-fun n) + (+ (* 5 n n n) (sqrt(abs n)))) + +(define (check-trabb n) + (if (number? n) + (if (<= (trabb-fun n) 400) + (printf "🌱 f(%d) = %d" n (trabb-fun n)) + (printf "❌ f(%d) = %d" n (trabb-fun n))) + (error "not a number" n))) + +(define (trabb (numlist null)) + (while (< (length numlist) 11) + (set! numlist (append numlist + (or + (read default: (shuffle (iota 11)) + prompt: (format "Please enter %d more numbers" (- 11 (length numlist)))) + (error 'incomplete-list numlist))))) ;; users cancel + (for-each check-trabb (reverse (take numlist 11)))) diff --git a/Task/Trabb-Pardo-Knuth-algorithm/EchoLisp/trabb-pardo-knuth-algorithm-2.echolisp b/Task/Trabb-Pardo-Knuth-algorithm/EchoLisp/trabb-pardo-knuth-algorithm-2.echolisp new file mode 100644 index 0000000000..ccf00a92f2 --- /dev/null +++ b/Task/Trabb-Pardo-Knuth-algorithm/EchoLisp/trabb-pardo-knuth-algorithm-2.echolisp @@ -0,0 +1,20 @@ +(trabb) +;; input : (0 4 1 8 5 9 10 3 6 7 2) + +🌱 f(2) = 41.41421356237309 +❌ f(7) = 1717.6457513110645 +❌ f(6) = 1082.4494897427833 +🌱 f(3) = 136.73205080756887 +❌ f(10) = 5003.162277660168 +❌ f(9) = 3648 +❌ f(5) = 627.2360679774998 +❌ f(8) = 2562.828427124746 +🌱 f(1) = 6 +🌱 f(4) = 322 +🌱 f(0) = 0 + +;; extra credit : let's find the threshold +(lib 'math) +(define (g x) (- (trabb-fun x) 400)) +(root g 0 10) + → 4.301409367213084 diff --git a/Task/Trabb-Pardo-Knuth-algorithm/FreeBASIC/trabb-pardo-knuth-algorithm.freebasic b/Task/Trabb-Pardo-Knuth-algorithm/FreeBASIC/trabb-pardo-knuth-algorithm.freebasic new file mode 100644 index 0000000000..f2e4aad455 --- /dev/null +++ b/Task/Trabb-Pardo-Knuth-algorithm/FreeBASIC/trabb-pardo-knuth-algorithm.freebasic @@ -0,0 +1,35 @@ +' version 22-10-2016 +' compile with: fbc -s console + +Function f(n As Double) As Double + return Sqr(Abs(n)) + 5 * n ^ 5 +End Function + +' ------=< MAIN >=------ + +Dim As Double x, s(0 To 10) +Dim As Long i + +For i = 0 To 10 + Print Str(i); + Input " => ", s(i) +Next + +Print +Print String(20,"-") + +For i = 10 To 0 Step -1 + Print "f(" + Str(s(i)) + ") = "; + x = f(s(i)) + If x > 400 Then + Print "-=< to large >=-" + Else + Print x + End If +Next + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Trabb-Pardo-Knuth-algorithm/Nim/trabb-pardo-knuth-algorithm.nim b/Task/Trabb-Pardo-Knuth-algorithm/Nim/trabb-pardo-knuth-algorithm.nim new file mode 100644 index 0000000000..b548b60cac --- /dev/null +++ b/Task/Trabb-Pardo-Knuth-algorithm/Nim/trabb-pardo-knuth-algorithm.nim @@ -0,0 +1,13 @@ +import math, rdstdin, strutils, algorithm + +proc f(x): float = x.abs.pow(0.5) + 5 * x.pow(3) + +proc ask: seq[float] = + readLineFromStdin("\n11 numbers: ").strip.split[0..10].map(parseFloat) + +var s = ask() +reverse s +for x in s: + let result = f x + stdout.write " ",x,":", if result > 400: "TOO LARGE!" else: $result +echo "" diff --git a/Task/Trabb-Pardo-Knuth-algorithm/Ring/trabb-pardo-knuth-algorithm.ring b/Task/Trabb-Pardo-Knuth-algorithm/Ring/trabb-pardo-knuth-algorithm.ring new file mode 100644 index 0000000000..e607bb9d49 --- /dev/null +++ b/Task/Trabb-Pardo-Knuth-algorithm/Ring/trabb-pardo-knuth-algorithm.ring @@ -0,0 +1,12 @@ +decimals(7) +s = [4,3,4,2,1,1,2,3,4,5] + +for i = 10 to 1 step -1 + see "f(" + s[i] + ")="; + x = f(s[i]) + if x > 400 see "--- too large ---" + nl + else see x + nl ok +next + +func f n + return sqrt(fabs(n))+5*pow(n,3) diff --git a/Task/Trabb-Pardo-Knuth-algorithm/Sidef/trabb-pardo-knuth-algorithm.sidef b/Task/Trabb-Pardo-Knuth-algorithm/Sidef/trabb-pardo-knuth-algorithm.sidef new file mode 100644 index 0000000000..7204b2c258 --- /dev/null +++ b/Task/Trabb-Pardo-Knuth-algorithm/Sidef/trabb-pardo-knuth-algorithm.sidef @@ -0,0 +1,8 @@ +var nums; do { + nums = Sys.readln("Please type 11 space-separated numbers: ").nums +} while(nums.len != 11) + +nums.reverse.each { |n| + var r = (n.abs.sqrt + (5 * n**3)); + say "#{n}\t#{ r > 400 ? 'Urk!' : r }"; +} diff --git a/Task/Trabb-Pardo-Knuth-algorithm/Swift/trabb-pardo-knuth-algorithm.swift b/Task/Trabb-Pardo-Knuth-algorithm/Swift/trabb-pardo-knuth-algorithm.swift new file mode 100644 index 0000000000..ab3431e6dd --- /dev/null +++ b/Task/Trabb-Pardo-Knuth-algorithm/Swift/trabb-pardo-knuth-algorithm.swift @@ -0,0 +1,18 @@ +import Foundation + +print("Enter 11 numbers for the Trabb─Pardo─Knuth algorithm:") + +let f: (Double) -> Double = { sqrt(fabs($0)) + 5 * pow($0, 3) } + +(1...11) + .generate() + .map { i -> Double in + print("\(i): ", terminator: "") + guard let s = readLine(), let n = Double(s) else { return 0 } + return n + } + .reverse() + .forEach { + let result = f($0) + print("f(\($0))", result > 400.0 ? "OVERFLOW" : result, separator: "\t") + } diff --git a/Task/Trabb-Pardo-Knuth-algorithm/Symsyn/trabb-pardo-knuth-algorithm.symsyn b/Task/Trabb-Pardo-Knuth-algorithm/Symsyn/trabb-pardo-knuth-algorithm.symsyn new file mode 100644 index 0000000000..dd54dee5a1 --- /dev/null +++ b/Task/Trabb-Pardo-Knuth-algorithm/Symsyn/trabb-pardo-knuth-algorithm.symsyn @@ -0,0 +1,37 @@ +|Trabb Pardo–Knuth algorithm + +a : 11 0 + + i + if i LE 10 + [] $s + ~ $s w + w a.i + + i + goif + endif + 10 i + if i GE 0 + call f + if x GT 400 + 'too large' $s + else + ~ x $s + endif + ~ i $r + + ' ' $r + + $r $s.1 + $s [] + - i + goif + endif + stop + +f a.i t + * t t x + * x t x + * 5 x + abs t + sqrt t y + + y x + return diff --git a/Task/Trabb-Pardo-Knuth-algorithm/jq/trabb-pardo-knuth-algorithm-1.jq b/Task/Trabb-Pardo-Knuth-algorithm/jq/trabb-pardo-knuth-algorithm-1.jq new file mode 100644 index 0000000000..f6bb3d4482 --- /dev/null +++ b/Task/Trabb-Pardo-Knuth-algorithm/jq/trabb-pardo-knuth-algorithm-1.jq @@ -0,0 +1,11 @@ +def f: + def abs: if . < 0 then -. else . end; + def power(x): (x * log) | exp; + . as $x | abs | power(0.5) + (5 * (.*.*. )); + +. as $in | split(" ") | map(tonumber) +| if length == 11 then + reverse | map(f | if . > 400 then "TOO LARGE" else . end) + else error("The number of numbers was not 11.") + end +| .[] # print one result per line diff --git a/Task/Trabb-Pardo-Knuth-algorithm/jq/trabb-pardo-knuth-algorithm-2.jq b/Task/Trabb-Pardo-Knuth-algorithm/jq/trabb-pardo-knuth-algorithm-2.jq new file mode 100644 index 0000000000..ed79634bcc --- /dev/null +++ b/Task/Trabb-Pardo-Knuth-algorithm/jq/trabb-pardo-knuth-algorithm-2.jq @@ -0,0 +1,15 @@ +$ echo "Enter 11 numbers on one line; when done, enter the end-of-file character:" ;\ +jq -M -s -R -f Trabb_Pardo-Knuth_algorithm.jq +> Enter 11 numbers on one line; when done, enter the end-of-file character: +1 2 3 4 5 6 7 8 9 10 11 +"TOO LARGE" +"TOO LARGE" +"TOO LARGE" +"TOO LARGE" +"TOO LARGE" +"TOO LARGE" +"TOO LARGE" +322 +136.73205080756887 +41.41421356237309 +6 diff --git a/Task/Tree-traversal/Ceylon/tree-traversal.ceylon b/Task/Tree-traversal/Ceylon/tree-traversal.ceylon new file mode 100644 index 0000000000..9048c6b1ce --- /dev/null +++ b/Task/Tree-traversal/Ceylon/tree-traversal.ceylon @@ -0,0 +1,97 @@ +import ceylon.collection { + ArrayList +} + +shared void run() { + + class Node(label, left = null, right = null) { + shared Integer label; + shared Node? left; + shared Node? right; + string => label.string; + } + + void preorder(Node node) { + process.write(node.string + " "); + if(exists left = node.left) { + preorder(left); + } + if(exists right = node.right) { + preorder(right); + } + } + + void inorder(Node node) { + if(exists left = node.left) { + inorder(left); + } + process.write(node.string + " "); + if(exists right = node.right) { + inorder(right); + } + } + + void postorder(Node node) { + if(exists left = node.left) { + postorder(left); + } + if(exists right = node.right) { + postorder(right); + } + process.write(node.string + " "); + } + + void levelOrder(Node node) { + value nodes = ArrayList {node}; + while(exists current = nodes.accept()) { + process.write(current.string + " "); + if(exists left = current.left) { + nodes.offer(left); + } + if(exists right = current.right) { + nodes.offer(right); + } + } + } + + value tree = Node { + label = 1; + left = Node { + label = 2; + left = Node { + label = 4; + left = Node { + label = 7; + }; + }; + right = Node { + label = 5; + }; + }; + right = Node { + label = 3; + left = Node { + label = 6; + left = Node { + label = 8; + }; + right = Node { + label = 9; + }; + }; + }; + }; + + process.write("preorder: "); + preorder(tree); + print(""); + process.write("inorder: "); + inorder(tree); + print(""); + process.write("postorder: "); + postorder(tree); + print(""); + process.write("levelorder: "); + levelOrder(tree); + print(""); +} diff --git a/Task/Tree-traversal/FunL/tree-traversal.funl b/Task/Tree-traversal/FunL/tree-traversal.funl new file mode 100644 index 0000000000..8fe7b1ff5e --- /dev/null +++ b/Task/Tree-traversal/FunL/tree-traversal.funl @@ -0,0 +1,36 @@ +data Tree = Empty | Node( value, left, right ) + +def + preorder( Empty ) = [] + preorder( Node(v, l, r) ) = [v] + preorder( l ) + preorder( r ) + + inorder( Empty ) = [] + inorder( Node(v, l, r) ) = inorder( l ) + [v] + inorder( r ) + + postorder( Empty ) = [] + postorder( Node(v, l, r) ) = postorder( l ) + postorder( r ) + [v] + + levelorder( x ) = + def + order( [] ) = [] + order( Empty : xs ) = order( xs ) + order( Node(v, l, r) : xs ) = v : order( xs + [l, r] ) + + order( [x] ) + +tree = Node( 1, + Node( 2, + Node( 4, + Node( 7, Empty, Empty ), + Empty ), + Node( 5, Empty, Empty ) ), + Node( 3, + Node( 6, + Node( 8, Empty, Empty ), + Node( 9, Empty, Empty ) ), + Empty ) ) + +println( preorder(tree) ) +println( inorder(tree) ) +println( postorder(tree) ) +println( levelorder(tree) ) diff --git a/Task/Tree-traversal/GFA-Basic/tree-traversal.gfa b/Task/Tree-traversal/GFA-Basic/tree-traversal.gfa new file mode 100644 index 0000000000..e8c40713b7 --- /dev/null +++ b/Task/Tree-traversal/GFA-Basic/tree-traversal.gfa @@ -0,0 +1,116 @@ +maxnodes%=100 ! set a limit to size of tree +content%=0 ! index of content field +left%=1 ! index of left tree +right%=2 ! index of right tree +DIM tree%(maxnodes%,3) ! create space for tree +' +OPENW 1 +CLEARW 1 +' +@create_tree +PRINT "Preorder: "; +@preorder_traversal(1) +PRINT "" +PRINT "Inorder: "; +@inorder_traversal(1) +PRINT "" +PRINT "Postorder: "; +@postorder_traversal(1) +PRINT "" +PRINT "Levelorder: "; +@levelorder_traversal(1) +PRINT "" +' +~INP(2) +CLOSEW 1 +' +' Define the example tree +' +PROCEDURE create_tree + tree%(1,content%)=1 + tree%(1,left%)=2 + tree%(1,right%)=3 + tree%(2,content%)=2 + tree%(2,left%)=4 + tree%(2,right%)=5 + tree%(3,content%)=3 + tree%(3,left%)=6 + tree%(3,right%)=0 ! 0 is used for no subtree + tree%(4,content%)=4 + tree%(4,left%)=7 + tree%(4,right%)=0 + tree%(5,content%)=5 + tree%(5,left%)=0 + tree%(5,right%)=0 + tree%(6,content%)=6 + tree%(6,left%)=8 + tree%(6,right%)=9 + tree%(7,content%)=7 + tree%(7,left%)=0 + tree%(7,right%)=0 + tree%(8,content%)=8 + tree%(8,left%)=0 + tree%(8,right%)=0 + tree%(9,content%)=9 + tree%(9,left%)=0 + tree%(9,right%)=0 +RETURN +' +' Preorder traversal from given node +' +PROCEDURE preorder_traversal(node%) + IF node%<>0 ! 0 means there is no node + PRINT tree%(node%,content%); + preorder_traversal(tree%(node%,left%)) + preorder_traversal(tree%(node%,right%)) + ENDIF +RETURN +' +' Postorder traversal from given node +' +PROCEDURE postorder_traversal(node%) + IF node%<>0 ! 0 means there is no node + postorder_traversal(tree%(node%,left%)) + postorder_traversal(tree%(node%,right%)) + PRINT tree%(node%,content%); + ENDIF +RETURN +' +' Inorder traversal from given node +' +PROCEDURE inorder_traversal(node%) + IF node%<>0 ! 0 means there is no node + inorder_traversal(tree%(node%,left%)) + PRINT tree%(node%,content%); + inorder_traversal(tree%(node%,right%)) + ENDIF +RETURN +' +' Level order traversal from given node +' +PROCEDURE levelorder_traversal(node%) + LOCAL nodes%,first_free%,current% + ' + ' Set up initial queue of nodes + ' + DIM nodes%(maxnodes%) ! some working space to store queue of nodes + current%=1 + nodes%(current%)=node% + first_free%=current%+1 + ' + WHILE nodes%(current%)<>0 + ' add the children of current node onto queue + IF tree%(nodes%(current%),left%)<>0 + nodes%(first_free%)=tree%(nodes%(current%),left%) + first_free%=first_free%+1 + ENDIF + IF tree%(nodes%(current%),right%)<>0 + nodes%(first_free%)=tree%(nodes%(current%),right%) + first_free%=first_free%+1 + ENDIF + ' print the current node content + PRINT tree%(nodes%(current%),content%); + ' advance to next node + current%=current%+1 + WEND +RETURN diff --git a/Task/Tree-traversal/Lingo/tree-traversal-1.lingo b/Task/Tree-traversal/Lingo/tree-traversal-1.lingo new file mode 100644 index 0000000000..88bfe944de --- /dev/null +++ b/Task/Tree-traversal/Lingo/tree-traversal-1.lingo @@ -0,0 +1,28 @@ +-- parent script "BinaryTreeNode" + +property _val, _left, _right + +on new (me, val) + me._val = val + return me +end + +on getValue (me) + return me._val +end + +on setLeft (me, node) + me._left = node +end + +on setRight (me, node) + me._right = node +end + +on getLeft (me) + return me._left +end + +on getRight (me) + return me._right +end diff --git a/Task/Tree-traversal/Lingo/tree-traversal-2.lingo b/Task/Tree-traversal/Lingo/tree-traversal-2.lingo new file mode 100644 index 0000000000..4523578a99 --- /dev/null +++ b/Task/Tree-traversal/Lingo/tree-traversal-2.lingo @@ -0,0 +1,51 @@ +-- parent script "BinaryTreeTraversal" + +on inOrder (me, node, l) + if voidP(l) then l = [] + if voidP(node) then return l + if not voidP(node.getLeft()) then l = me.inOrder(node.getLeft(), l) + l.add(node) + if not voidP(node.getRight()) then l = me.inOrder(node.getRight(), l) + return l +end + +on preOrder (me, node, l) + if voidP(l) then l = [] + if voidP(node) then return l + l.add(node) + if not voidP(node.getLeft()) then l = me.preOrder(node.getLeft(), l) + if not voidP(node.getRight()) then l = me.preOrder(node.getRight(), l) + return l +end + +on postOrder (me, node, l) + if voidP(l) then l = [] + if voidP(node) then return l + if not voidP(node.getLeft()) then l = me.postOrder(node.getLeft(), l) + if not voidP(node.getRight()) then l = me.postOrder(node.getRight(), l) + l.add(node) + return l +end + +on levelOrder (me, node) + l = [] + queue = [node] + repeat while queue.count + node = queue[1] + queue.deleteAt(1) + l.add(node) + if not voidP(node.getLeft()) then queue.add(node.getLeft()) + if not voidP(node.getRight()) then queue.add(node.getRight()) + end repeat + return l +end + +-- print utility function +on serialize (me, l) + str = "" + repeat with node in l + put node.getValue()&" " after str + end repeat + delete the last char of str + return str +end diff --git a/Task/Tree-traversal/Lingo/tree-traversal-3.lingo b/Task/Tree-traversal/Lingo/tree-traversal-3.lingo new file mode 100644 index 0000000000..1d56a6f4f5 --- /dev/null +++ b/Task/Tree-traversal/Lingo/tree-traversal-3.lingo @@ -0,0 +1,20 @@ +-- create the tree +l = [] +repeat with i = 1 to 10 + l[i] = script("BinaryTreeNode").new(i) +end repeat +l[6].setLeft (l[8]) +l[6].setRight(l[9]) +l[3].setLeft (l[6]) +l[4].setLeft (l[7]) +l[2].setLeft (l[4]) +l[2].setRight(l[5]) +l[1].setLeft (l[2]) +l[1].setRight(l[3]) + +-- print traversal results +trav = script("BinaryTreeTraversal") +put "preorder: " & trav.serialize(trav.preOrder(l[1])) +put "inorder: " & trav.serialize(trav.inOrder(l[1])) +put "postorder: " & trav.serialize(trav.postOrder(l[1])) +put "level-order: " & trav.serialize(trav.levelOrder(l[1])) diff --git a/Task/Tree-traversal/Nim/tree-traversal.nim b/Task/Tree-traversal/Nim/tree-traversal.nim new file mode 100644 index 0000000000..263604fa9f --- /dev/null +++ b/Task/Tree-traversal/Nim/tree-traversal.nim @@ -0,0 +1,47 @@ +import queues, sequtils + +type + Node[T] = ref TNode[T] + TNode[T] = object + data: T + left, right: Node[T] + +proc newNode[T](data: T; left, right: Node[T] = nil): Node[T] = + Node[T](data: data, left: left, right: right) + +proc preorder[T](n: Node[T]): seq[T] = + if n == nil: @[] + else: @[n.data] & preorder(n.left) & preorder(n.right) + +proc inorder[T](n: Node[T]): seq[T] = + if n == nil: @[] + else: inorder(n.left) & @[n.data] & inorder(n.right) + +proc postorder[T](n: Node[T]): seq[T] = + if n == nil: @[] + else: postorder(n.left) & postorder(n.right) & @[n.data] + +proc levelorder[T](n: Node[T]): seq[T] = + result = @[] + var queue = initQueue[Node[T]]() + queue.enqueue(n) + while queue.len > 0: + let next = queue.dequeue() + result.add next.data + if next.left != nil: queue.enqueue(next.left) + if next.right != nil: queue.enqueue(next.right) + +let tree = 1.newNode( + 2.newNode( + 4.newNode( + 7.newNode), + 5.newNode), + 3.newNode( + 6.newNode( + 8.newNode, + 9.newNode))) + +echo preorder tree +echo inorder tree +echo postorder tree +echo levelorder tree diff --git a/Task/Tree-traversal/Oforth/tree-traversal.oforth b/Task/Tree-traversal/Oforth/tree-traversal.oforth new file mode 100644 index 0000000000..f707d82732 --- /dev/null +++ b/Task/Tree-traversal/Oforth/tree-traversal.oforth @@ -0,0 +1,31 @@ +Object Class new: Tree(v, l, r) + +Tree method: initialize(v, l, r) v := v l := l r := r ; +Tree method: v @v ; +Tree method: l @l ; +Tree method: r @r ; + +Tree method: preOrder(f) + @v f perform + @l ifNotNull: [ @l preOrder(f) ] + @r ifNotNull: [ @r preOrder(f) ] ; + +Tree method: inOrder(f) + @l ifNotNull: [ @l inOrder(f) ] + @v f perform + @r ifNotNull: [ @r inOrder(f) ] ; + +Tree method: postOrder(f) + @l ifNotNull: [ @l postOrder(f) ] + @r ifNotNull: [ @r postOrder(f) ] + @v f perform ; + +Tree method: levelOrder(f) +| c n | + Channel new self over send drop ->c + while(c notEmpty) [ + c receive ->n + n v f perform + n l dup ifNotNull: [ c send ] drop + n r dup ifNotNull: [ c send ] drop + ] ; diff --git a/Task/Tree-traversal/Phix/tree-traversal.phix b/Task/Tree-traversal/Phix/tree-traversal.phix new file mode 100644 index 0000000000..f1bf2410e2 --- /dev/null +++ b/Task/Tree-traversal/Phix/tree-traversal.phix @@ -0,0 +1,46 @@ +constant VALUE = 1, LEFT = 2, RIGHT = 3 + +constant tree = {1, {2, {4, {7, 0, 0}, 0}, + {5, 0, 0}}, + {3, {6, {8, 0, 0}, + {9, 0, 0}}, + 0}} + +procedure preorder(object tree) + if sequence(tree) then + printf(1,"%d ",{tree[VALUE]}) + preorder(tree[LEFT]) + preorder(tree[RIGHT]) + end if +end procedure + +procedure inorder(object tree) + if sequence(tree) then + inorder(tree[LEFT]) + printf(1,"%d ",{tree[VALUE]}) + inorder(tree[RIGHT]) + end if +end procedure + +procedure postorder(object tree) + if sequence(tree) then + postorder(tree[LEFT]) + postorder(tree[RIGHT]) + printf(1,"%d ",{tree[VALUE]}) + end if +end procedure + +procedure level_order(object tree, sequence more = {}) + if sequence(tree) then + more &= {tree[LEFT],tree[RIGHT]} + printf(1,"%d ",{tree[VALUE]}) + end if + if length(more) > 0 then + level_order(more[1],more[2..$]) + end if +end procedure + +puts(1,"\n preorder: ") preorder(tree) +puts(1,"\n inorder: ") inorder(tree) +puts(1,"\n postorder: ") postorder(tree) +puts(1,"\n level-order: ") level_order(tree) diff --git a/Task/Tree-traversal/Sidef/tree-traversal.sidef b/Task/Tree-traversal/Sidef/tree-traversal.sidef new file mode 100644 index 0000000000..e2ba549189 --- /dev/null +++ b/Task/Tree-traversal/Sidef/tree-traversal.sidef @@ -0,0 +1,28 @@ +func preorder(t) { + t ? [t[0], __FUNC__(t[1])..., __FUNC__(t[2])...] : []; +} + +func inorder(t) { + t ? [__FUNC__(t[1])..., t[0], __FUNC__(t[2])...] : []; +} + +func postorder(t) { + t ? [__FUNC__(t[1])..., __FUNC__(t[2])..., t[0]] : []; +} + +func depth(t) { + var a = [t]; + var ret = []; + while (a.len > 0) { + var v = (a.shift \\ next); + ret « v[0]; + a += [v[1,2]]; + }; + return ret; +} + +var x = [1,[2,[4,[7]],[5]],[3,[6,[8],[9]]]]; +say "pre: #{preorder(x)}"; +say "in: #{inorder(x)}"; +say "post: #{postorder(x)}"; +say "depth: #{depth(x)}"; diff --git a/Task/Tree-traversal/jq/tree-traversal-1.jq b/Task/Tree-traversal/jq/tree-traversal-1.jq new file mode 100644 index 0000000000..d077868cf4 --- /dev/null +++ b/Task/Tree-traversal/jq/tree-traversal-1.jq @@ -0,0 +1,26 @@ +def preorder: + if length == 0 then empty + else .[0], (.[1]|preorder), (.[2]|preorder) + end; + +def inorder: + if length == 0 then empty + else (.[1]|inorder), .[0] , (.[2]|inorder) + end; + +def postorder: + if length == 0 then empty + else (.[1] | postorder), (.[2]|postorder), .[0] + end; + +# Helper functions for levelorder: + # Produce a stream of the first elements + def heads: map( .[0] | select(. != null)) | .[]; + +# Produce a stream of the left/right branches: + def tails: + if length == 0 then empty + else [map ( .[1], .[2] ) | .[] | select( . != null)] + end; + +def levelorder: [.] | recurse( tails ) | heads; diff --git a/Task/Tree-traversal/jq/tree-traversal-2.jq b/Task/Tree-traversal/jq/tree-traversal-2.jq new file mode 100644 index 0000000000..27493b4833 --- /dev/null +++ b/Task/Tree-traversal/jq/tree-traversal-2.jq @@ -0,0 +1,17 @@ +def task: + # [node, left, right] + def atree: [1, [2, [4, [7,[],[]], + []], + [5, [],[]]], + + [3, [6, [8,[],[]], + [9,[],[]]], + []]] ; + + "preorder: \( [atree|preorder ])", + "inorder: \( [atree|inorder ])", + "postorder: \( [atree|postorder ])", + "levelorder: \( [atree|levelorder])" +; + +task diff --git a/Task/Trigonometric-functions/Axe/trigonometric-functions.axe b/Task/Trigonometric-functions/Axe/trigonometric-functions.axe new file mode 100644 index 0000000000..985ada0358 --- /dev/null +++ b/Task/Trigonometric-functions/Axe/trigonometric-functions.axe @@ -0,0 +1,3 @@ +Disp sin(43)▶Dec,i +Disp cos(43)▶Dec,i +Disp tan⁻¹(10,10)▶Dec,i diff --git a/Task/Trigonometric-functions/FreeBASIC/trigonometric-functions.freebasic b/Task/Trigonometric-functions/FreeBASIC/trigonometric-functions.freebasic new file mode 100644 index 0000000000..c31d9de365 --- /dev/null +++ b/Task/Trigonometric-functions/FreeBASIC/trigonometric-functions.freebasic @@ -0,0 +1,21 @@ +' FB 1.05.0 Win64 + +Const pi As Double = 4 * Atn(1) +Dim As Double radians = pi / 4 +Dim As Double degrees = 45.0 '' equivalent in degrees +Dim As Double temp + +Print "Radians : "; radians, " "; +Print "Degrees : "; degrees +Print +Print "Sine : "; Sin(radians), Sin(degrees * pi / 180) +Print "Cosine : "; Cos(radians), Cos(degrees * pi / 180) +Print "Tangent : "; Tan(radians), Tan(degrees * pi / 180) +Print +temp = ASin(Sin(radians)) +Print "Arc Sine : "; temp, temp * 180 / pi +temp = ACos(Cos(radians)) +Print "Arc Cosine : "; temp, temp * 180 / pi +temp = Atn(Tan(radians)) +Print "Arc Tangent : "; temp, temp * 180 / pi +Sleep diff --git a/Task/Trigonometric-functions/Nim/trigonometric-functions.nim b/Task/Trigonometric-functions/Nim/trigonometric-functions.nim new file mode 100644 index 0000000000..5396a73fc9 --- /dev/null +++ b/Task/Trigonometric-functions/Nim/trigonometric-functions.nim @@ -0,0 +1,14 @@ +import math + +proc radians(x): float = x * Pi / 180 +proc degrees(x): float = x * 180 / Pi + +let rad = Pi/4 +let deg = 45.0 + +echo "Sine: ", sin(rad), " ", sin(radians(deg)) +echo "Cosine : ", cos(rad), " ", cos(radians(deg)) +echo "Tangent: ", tan(rad), " ", tan(radians(deg)) +echo "Arcsine: ", arcsin(sin(rad)), " ", degrees(arcsin(sin(radians(deg)))) +echo "Arccocose: ", arccos(cos(rad)), " ", degrees(arccos(cos(radians(deg)))) +echo "Arctangent: ", arctan(tan(rad)), " ", degrees(arctan(tan(radians(deg)))) diff --git a/Task/Trigonometric-functions/Oforth/trigonometric-functions.oforth b/Task/Trigonometric-functions/Oforth/trigonometric-functions.oforth new file mode 100644 index 0000000000..a5aa99e91b --- /dev/null +++ b/Task/Trigonometric-functions/Oforth/trigonometric-functions.oforth @@ -0,0 +1,28 @@ +import: math + +: testTrigo +| rad deg hyp z | + Pi 4 / ->rad + 45.0 ->deg + 0.5 ->hyp + + System.Out rad sin << " - " << deg asRadian sin << cr + System.Out rad cos << " - " << deg asRadian cos << cr + System.Out rad tan << " - " << deg asRadian tan << cr + + printcr + + rad sin asin ->z + System.Out z << " - " << z asDegree << cr + + rad cos acos ->z + System.Out z << " - " << z asDegree << cr + + rad tan atan ->z + System.Out z << " - " << z asDegree << cr + + printcr + + System.Out hyp sinh << " - " << hyp sinh asinh << cr + System.Out hyp cosh << " - " << hyp cosh acosh << cr + System.Out hyp tanh << " - " << hyp tanh atanh << cr ; diff --git a/Task/Trigonometric-functions/Phix/trigonometric-functions.phix b/Task/Trigonometric-functions/Phix/trigonometric-functions.phix new file mode 100644 index 0000000000..53a8b5bfa5 --- /dev/null +++ b/Task/Trigonometric-functions/Phix/trigonometric-functions.phix @@ -0,0 +1,12 @@ +?sin(PI/2) +?sin(90*PI/180) +?cos(0) +?cos(0*PI/180) +?tan(PI/4) +?tan(45*PI/180) +?arcsin(1)*2 +?arcsin(1)*180/PI +?arccos(0)*2 +?arccos(0)*180/PI +?arctan(1)*4 +?arctan(1)*180/PI diff --git a/Task/Trigonometric-functions/Ring/trigonometric-functions.ring b/Task/Trigonometric-functions/Ring/trigonometric-functions.ring new file mode 100644 index 0000000000..cb44e6adbe --- /dev/null +++ b/Task/Trigonometric-functions/Ring/trigonometric-functions.ring @@ -0,0 +1,9 @@ +pi = 3.14 +decimals(8) +see "sin(pi/4.0) = " + sin(pi/4.0) + nl +see "cos(pi/4.0) = " + cos(pi/4.0) + nl +see "tan(pi/4.0) = " + tan(pi/4.0)+ nl +see "asin(sin(pi/4.0)) = " + asin(sin(pi/4.0)) + nl +see "acos(cos(pi/4.0)) = " + acos(cos(pi/4.0)) + nl +see "atan(tan(pi/4.0)) = " + atan(tan(pi/4.0)) + nl +see "atan2(3,4) = " + atan2(3,4) + nl diff --git a/Task/Trigonometric-functions/Sidef/trigonometric-functions.sidef b/Task/Trigonometric-functions/Sidef/trigonometric-functions.sidef new file mode 100644 index 0000000000..3a9c30d70c --- /dev/null +++ b/Task/Trigonometric-functions/Sidef/trigonometric-functions.sidef @@ -0,0 +1,20 @@ +var angle_deg = 45; +var angle_rad = Num.pi/4; + +for arr in [ + [sin(angle_rad), sin(deg2rad(angle_deg))], + [cos(angle_rad), cos(deg2rad(angle_deg))], + [tan(angle_rad), tan(deg2rad(angle_deg))], + [cot(angle_rad), cot(deg2rad(angle_deg))], +] { + say arr.join(" "); +} + +for n in [ + asin(sin(angle_rad)), + acos(cos(angle_rad)), + atan(tan(angle_rad)), + acot(cot(angle_rad)), +] { + say [n, rad2deg(n)].join(' '); +} diff --git a/Task/Trigonometric-functions/jq/trigonometric-functions-1.jq b/Task/Trigonometric-functions/jq/trigonometric-functions-1.jq new file mode 100644 index 0000000000..1eb2883ecc --- /dev/null +++ b/Task/Trigonometric-functions/jq/trigonometric-functions-1.jq @@ -0,0 +1,25 @@ +# degrees to radians +def radians: + (-1|acos) as $pi | (. * $pi / 180); + +def task: + (-1|acos) as $pi + | ($pi / 180) as $degrees + | "Using radians:", + " sin(-pi / 6) = \( (-$pi / 6) | sin )", + " cos(3 * pi / 4) = \( (3 * $pi / 4) | cos)", + " tan(pi / 3) = \( ($pi / 3) | tan)", + " asin(-1 / 2) = \((-1 / 2) | asin)", + " acos(-sqrt(2)/2) = \((-(2|sqrt)/2) | acos )", + " atan(sqrt(3)) = \( 3 | sqrt | atan )", + + "Using degrees:", + " sin(-30) = \((-30 * $degrees) | sin)", + " cos(135) = \((135 * $degrees) | cos)", + " tan(60) = \(( 60 * $degrees) | tan)", + " asin(-1 / 2) = \( (-1 / 2) | asin / $degrees)", + " acos(-sqrt(2)/2) = \( (-(2|sqrt) / 2) | acos / $degrees)", + " atan(sqrt(3)) = \( (3 | sqrt) | atan / $degrees)" +; + +task diff --git a/Task/Trigonometric-functions/jq/trigonometric-functions-2.jq b/Task/Trigonometric-functions/jq/trigonometric-functions-2.jq new file mode 100644 index 0000000000..2d8b4c011b --- /dev/null +++ b/Task/Trigonometric-functions/jq/trigonometric-functions-2.jq @@ -0,0 +1,14 @@ +Using radians: + sin(-pi / 6) = -0.49999999999999994 + cos(3 * pi / 4) = -0.7071067811865475 + tan(pi / 3) = 1.7320508075688767 + asin(-1 / 2) = -0.5235987755982988 + acos(-sqrt(2)/2) = 2.356194490192345 + atan(sqrt(3)) = 1.0471975511965979 +Using degrees: + sin(-30) = -0.49999999999999994 + cos(135) = -0.7071067811865475 + tan(60) = 1.7320508075688767 + asin(-1 / 2) = -29.999999999999996 + acos(-sqrt(2)/2) = 135 + atan(sqrt(3)) = 60.00000000000001 diff --git a/Task/Truncatable-primes/EchoLisp/truncatable-primes-1.echolisp b/Task/Truncatable-primes/EchoLisp/truncatable-primes-1.echolisp new file mode 100644 index 0000000000..2a3db2b82b --- /dev/null +++ b/Task/Truncatable-primes/EchoLisp/truncatable-primes-1.echolisp @@ -0,0 +1,16 @@ +;; does p include a 0 in its decimal representation ? +(define (nozero? n) (= -1 (string-index (number->string n) "0"))) + +;; right truncate : p and successive quotients by 10 (integer division) must be primes +(define (right-trunc p) (unless (zero? p) + (and (prime? p) (right-trunc (quotient p 10))))) +(remember 'right-trunc) + +;; left truncate : p and successive modulo by 10, 100, .. must be prime +(define (left-trunc p (mod 1000000)) + (unless (< mod 1) + (and (prime? p) (nozero? p) (left-trunc (modulo p mod) (/ mod 10))))) + +;; start from 999999. stop on first found +(define (fact-trunc trunc) +(for ((p (in-range 999999 100000 -1))) #:break (when (trunc p) (writeln p) #t))) diff --git a/Task/Truncatable-primes/EchoLisp/truncatable-primes-2.echolisp b/Task/Truncatable-primes/EchoLisp/truncatable-primes-2.echolisp new file mode 100644 index 0000000000..f6970cf90a --- /dev/null +++ b/Task/Truncatable-primes/EchoLisp/truncatable-primes-2.echolisp @@ -0,0 +1,4 @@ +(fact-trunc left-trunc) +998443 +(fact-trunc right-trunc) +739399 diff --git a/Task/Truncatable-primes/Nim/truncatable-primes.nim b/Task/Truncatable-primes/Nim/truncatable-primes.nim new file mode 100644 index 0000000000..d64ccc4a48 --- /dev/null +++ b/Task/Truncatable-primes/Nim/truncatable-primes.nim @@ -0,0 +1,34 @@ +import sets, strutils, algorithm + +proc primes(n): seq[int64] = + result = @[] + var multiples = initSet[int64]() + for i in 2..n: + if i notin multiples: + result.add i + for j in countup(i*i, n, i.int): + multiples.incl j + +proc truncatablePrime(n): tuple[left: int64, right: int64] = + var + primelist: seq[string] = @[] + for x in primes(n): + primelist.add($x) + reverse primelist + var primeset = toSet primelist + for n in primelist: + var alltruncs = initSet[string]() + for i in 0..n.len: + alltruncs.incl n[1..n.high] + if alltruncs <= primeset: + result.left = parseInt(n) + break + for n in primelist: + var alltruncs = initSet[string]() + for i in 0..n.len: + alltruncs.incl n[0..i] + if alltruncs <= primeset: + result.right = parseInt(n) + break + +echo truncatablePrime(1000000'i64) diff --git a/Task/Truncatable-primes/Sidef/truncatable-primes.sidef b/Task/Truncatable-primes/Sidef/truncatable-primes.sidef new file mode 100644 index 0000000000..a660cc25d8 --- /dev/null +++ b/Task/Truncatable-primes/Sidef/truncatable-primes.sidef @@ -0,0 +1,14 @@ +func t_prime(n, left=true) { + var p = %w(2 3 5 7); + var f = ( + left ? { '1'..'9' ~X+ p } + : { p ~X+ '1'..'9' } + ) + n.times { + p = f().grep{ .to_i.is_prime } + } + p.map{.to_i}.max +} + +say t_prime(5, left: true) +say t_prime(5, left: false) diff --git a/Task/Truncate-a-file/Lasso/truncate-a-file.lasso b/Task/Truncate-a-file/Lasso/truncate-a-file.lasso new file mode 100644 index 0000000000..c24b672617 --- /dev/null +++ b/Task/Truncate-a-file/Lasso/truncate-a-file.lasso @@ -0,0 +1,19 @@ +define file_truncate(path::string, size::integer) => { + + local(file = file(#path)) + + fail_if(not(#file -> exists), -1, 'There is no file at the given path') + fail_if(#file -> size < #size, -1, 'No point in truncating a file to a larger size than it already is') + + #file -> setSize(#size) + +} +local(filepath = '//Library/WebServer/Documents/Lasso9cli/trunk/testing/lorem_ipsum_long.txt') + +stdoutnl(file(#filepath) -> readbytes) +stdoutnl('Original size: ' + file(#filepath) -> size) + +file_truncate(#filepath, 300) + +stdoutnl(file(#filepath) -> readbytes) +stdout(file('Truncated size: ' + #filepath) -> size) diff --git a/Task/Truncate-a-file/Lingo/truncate-a-file-1.lingo b/Task/Truncate-a-file/Lingo/truncate-a-file-1.lingo new file mode 100644 index 0000000000..ea8966349b --- /dev/null +++ b/Task/Truncate-a-file/Lingo/truncate-a-file-1.lingo @@ -0,0 +1,28 @@ +---------------------------------------- +-- Truncates file +-- @param {string} filename +-- @param {integer} length +-- @return {bool} success +---------------------------------------- +on truncate (filename, length) + fp = xtra("fileIO").new() + fp.openFile(filename, 0) + if fp.status() then return false + if fp.getLength()=length then + -- nothing to do + fp.closeFile() + return true + end if + data = fp.readByteArray(length) + if data.length<>length then + fp.closeFile() + return false + end if + fp.delete() + fp.createFile(filename) + fp.openFile(filename, 2) + fp.writeByteArray(data) + ok = fp.status()=0 + fp.closeFile() + return ok +end diff --git a/Task/Truncate-a-file/Lingo/truncate-a-file-2.lingo b/Task/Truncate-a-file/Lingo/truncate-a-file-2.lingo new file mode 100644 index 0000000000..d2cd8905ff --- /dev/null +++ b/Task/Truncate-a-file/Lingo/truncate-a-file-2.lingo @@ -0,0 +1,2 @@ +-- truncates file to 10 KB length +bx_file_truncate(_movie.path&"foo.dat", 10240) diff --git a/Task/Truncate-a-file/Nim/truncate-a-file.nim b/Task/Truncate-a-file/Nim/truncate-a-file.nim new file mode 100644 index 0000000000..0af28d10b6 --- /dev/null +++ b/Task/Truncate-a-file/Nim/truncate-a-file.nim @@ -0,0 +1,3 @@ +import posix + +discard truncate("filename", 1024) diff --git a/Task/Truncate-a-file/Ring/truncate-a-file.ring b/Task/Truncate-a-file/Ring/truncate-a-file.ring new file mode 100644 index 0000000000..239e9d7a98 --- /dev/null +++ b/Task/Truncate-a-file/Ring/truncate-a-file.ring @@ -0,0 +1,5 @@ +file = "C:\Ring\ReadMe.txt" +fp = read(file) +fpstr = left(fp, 100) +see fpstr + nl +write(file, fpstr) diff --git a/Task/Truncate-a-file/Sidef/truncate-a-file.sidef b/Task/Truncate-a-file/Sidef/truncate-a-file.sidef new file mode 100644 index 0000000000..c6869c1493 --- /dev/null +++ b/Task/Truncate-a-file/Sidef/truncate-a-file.sidef @@ -0,0 +1,9 @@ +func truncate(filename, len) { + var file = File(filename); + len > file.size -> + && die "The provided length is greater than the length of the file"; + file.truncate(len); +} + +# truncate "file.ext" to 1234 bytes +truncate("file.ext", 1234); diff --git a/Task/Twelve-statements/ERRE/twelve-statements.erre b/Task/Twelve-statements/ERRE/twelve-statements.erre new file mode 100644 index 0000000000..657ad40a86 --- /dev/null +++ b/Task/Twelve-statements/ERRE/twelve-statements.erre @@ -0,0 +1,59 @@ +PROGRAM TWELVE_STMS + +!$DYNAMIC +DIM PASS%[0],T%[0] + +FUNCTION EOR(X,Y) + EOR=(X AND NOT(Y)) OR (NOT(X) AND Y) +END FUNCTION + +BEGIN + NSTATEMENTS%=12 + !$DIM PASS%[NSTATEMENTS%],T%[NSTATEMENTS%] + + FOR TRY%=0 TO 2^NSTATEMENTS%-1 DO + + ! Postulate answer: + FOR STMT%=1 TO 12 DO + T%[STMT%]=(TRY% AND 2^(STMT%-1))<>0 + END FOR + + ! Test consistency: + PASS%[1]=T%[1]=(NSTATEMENTS%=12) + PASS%[2]=T%[2]=((T%[7]+T%[8]+T%[9]+T%[10]+T%[11]+T%[12])=-3) + PASS%[3]=T%[3]=((T%[2]+T%[4]+T%[6]+T%[8]+T%[10]+T%[12])=-2) + PASS%[4]=T%[4]=((NOT T%[5] OR (T%[6] AND T%[7]))) + PASS%[5]=T%[5]=(NOT T%[2] AND NOT T%[3] AND NOT T%[4]) + PASS%[6]=T%[6]=((T%[1]+T%[3]+T%[5]+T%[7]+T%[9]+T%[11])=-4) + PASS%[7]=T%[7]=(EOR(T%[2],T%[3])) + PASS%[8]=T%[8]=((NOT T%[7] OR (T%[5] AND T%[6]))) + PASS%[9]=T%[9]=((T%[1]+T%[2]+T%[3]+T%[4]+T%[5]+T%[6])=-3) + PASS%[10]=T%[10]=(T%[11] AND T%[12]) + PASS%[11]=T%[11]=((T%[7]+T%[8]+T%[9])=-1) + PASS%[12]=T%[12]=((T%[1]+T%[2]+T%[3]+T%[4]+T%[5]+T%[6]+T%[7]+T%[8]+T%[9]+T%[10]+T%[11])=-4) + + SUM=0 + FOR I%=1 TO 12 DO + SUM=SUM+PASS%[I%] + END FOR + + CASE SUM OF + -11-> + PRINT("Near miss with statements ";) + FOR STMT%=1 TO 12 DO + IF T%[STMT%] THEN PRINT(STMT%;) END IF + IF NOT PASS%[STMT%] THEN MISS%=STMT% END IF + END FOR + PRINT("true (failed ";MISS%;").") + END -> + -12-> + PRINT("Solution! with statements ";) + FOR STMT%=1 TO 12 DO + IF T%[STMT%] THEN PRINT(STMT%;) END IF + END FOR + PRINT("true.") + END -> + END CASE + + END FOR ! TRY% +END PROGRAM diff --git a/Task/Twelve-statements/Phix/twelve-statements.phix b/Task/Twelve-statements/Phix/twelve-statements.phix new file mode 100644 index 0000000000..dad5932bf6 --- /dev/null +++ b/Task/Twelve-statements/Phix/twelve-statements.phix @@ -0,0 +1,27 @@ +string s -- (eg "101101100010") +integer t -- scratch + +function s1() return length(s)=12 end function +function s2() t=0 for i=7 to 12 do t+=s[i]='1' end for return t=3 end function +function s3() t=0 for i=2 to 12 by 2 do t+=s[i]='1' end for return t=2 end function +function s4() return s[5]='0' or (s[6]='1' and s[7]='1') end function +function s5() return s[2]='0' and s[3]='0' and s[4]='0' end function +function s6() t=0 for i=1 to 12 by 2 do t+=s[i]='1' end for return t=4 end function +function s7() return s[2]!=s[3] end function +function s8() return s[7]='0' or (s[5]='1' and s[6]='1') end function +function s9() t=0 for i=1 to 6 do t+=s[i]='1' end for return t=3 end function +function s10() return s[11]='1' and s[12]='1' end function +function s11() t=0 for i=7 to 9 do t+=s[i]='1' end for return t=1 end function +function s12() t=0 for i=1 to 11 do t+=s[i]='1' end for return t=4 end function + +sequence r = repeat(0,12) +for b=1 to 12 do + r[b] = routine_id(sprintf("s%d",b)) +end for +for i=0 to power(2,12)-1 do + s = sprintf("%012b",i) + for b=1 to 12 do + if call_func(r[b],{})!=(s[b]='1') then exit end if + if b=12 then ?s end if + end for +end for diff --git a/Task/Twelve-statements/Swift/twelve-statements-1.swift b/Task/Twelve-statements/Swift/twelve-statements-1.swift new file mode 100644 index 0000000000..b5ba485e1a --- /dev/null +++ b/Task/Twelve-statements/Swift/twelve-statements-1.swift @@ -0,0 +1,113 @@ +var statements = Array(count: 13, repeatedValue: false) +statements[1] = true +var count = 0 + +func check2() -> Bool { + var count = 0 + for (var k = 7; k <= 12; k++) { + if (statements[k]) { + count++ + } + } + return statements[2] == (count == 3) +} + +func check3() -> Bool { + var count = 0 + for (var k = 2; k <= 12; k += 2) { + if (statements[k]) { + count++ + } + } + return statements[3] == (count == 2) +} + +func check4() -> Bool { + return statements[4] == (!statements[5] || statements[6] && statements[7]) +} + +func check5() -> Bool { + return statements[5] == (!statements[2] && !statements[3] && !statements[4]) +} + +func check6() -> Bool { + var count = 0 + for (var k = 1; k <= 11; k += 2) { + if (statements[k]) { + count++ + } + } + return statements[6] == (count == 4) +} + +func check7() -> Bool { + return statements[7] == ((statements[2] || statements[3]) && !(statements[2] && statements[3])) +} + +func check8() -> Bool { + return statements[8] == ( !statements[7] || statements[5] && statements[6]) +} + +func check9() -> Bool { + var count = 0 + for (var k = 1; k <= 6; k++) { + if (statements[k]) { + count++ + } + } + return statements[9] == (count == 3) +} + +func check10() -> Bool { + return statements[10] == (statements[11] && statements[12]) +} + +func check11() -> Bool { + var count = 0 + for (var k = 7; k <= 9; k++) { + if (statements[k]) { + count++ + } + } + + return statements[11] == (count == 1) +} + +func check12() -> Bool { + var count = 0 + for (var k = 1; k <= 11; k++) { + if (statements[k]) { + count++ + } + } + return statements[12] == (count == 4) +} + +func check() { + if (check2() && check3() && check4() && check5() && check6() + && check7() && check8() && check9() && check10() && check11() + && check12()) { + for (var k = 1; k <= 12; k++) { + if (statements[k]) { + print("\(k) ") + } + } + println() + count++ + } +} + +func checkAll(k:Int) { + if (k == 13) { + check() + } else { + statements[k] = false + checkAll(k + 1) + statements[k] = true + checkAll(k + 1) + } +} + +checkAll(2) +println() +println("\(count) solutions found") diff --git a/Task/Twelve-statements/Swift/twelve-statements-2.swift b/Task/Twelve-statements/Swift/twelve-statements-2.swift new file mode 100644 index 0000000000..551ab0670e --- /dev/null +++ b/Task/Twelve-statements/Swift/twelve-statements-2.swift @@ -0,0 +1,98 @@ +import Foundation + +internal enum PaddingOption { + case Left + case Right +} + +extension Array { + func pad(element: Element, times: Int, toThe: PaddingOption) -> Array { + let padded = [Element](count: times, repeatedValue: element) + switch(toThe) { + case .Left: + return padded + self + case .Right: + return self + padded + } + } + + func take(n: Int) -> Array { + if n <= 0 { + return [] + } + + return Array(self[0.. Array { + if n <= 0 { + return self + } else if n >= self.count { + return [] + } + + return Array(self[n.. Array { + var result:[Element] = [] + for i in Swift.stride(from: 0, to: self.count, by: n) { + result.append(self[i]) + } + return result + } + + func zipWithIndex() -> Array<(Element, Int)> { + return [(Element, Int)](zip(self, indices(self))) + } +} + +extension Int { + func binaryRepresentationOfLength(length: Int) -> [Int] { + var binaryRepresentation:[Int] = [] + var value = self + while (value != 0) { + binaryRepresentation.append(value & 1) + value /= 2 + } + return binaryRepresentation.pad(0, times: length-binaryRepresentation.count, toThe: .Right).reverse() + } +} + +let problem = [ + "1. This is a numbered list of twelve statements.", + "2. Exactly 3 of the last 6 statements are true.", + "3. Exactly 2 of the even-numbered statements are true.", + "4. If statement 5 is true, then statements 6 and 7 are both true.", + "5. The 3 preceding statements are all false.", + "6. Exactly 4 of the odd-numbered statements are true.", + "7. Either statement 2 or 3 is true, but not both.", + "8. If statement 7 is true, then 5 and 6 are both true.", + "9. Exactly 3 of the first 6 statements are true.", + "10. The next two statements are both true.", + "11. Exactly 1 of statements 7, 8 and 9 are true.", + "12. Exactly 4 of the preceding statements are true."] + +let statements:[([Bool] -> Bool)] = [ + { s in s.count == 12 }, + { s in s.drop(6).filter({ $0 }).count == 3 }, + { s in s.drop(1).stride(2).filter({ $0 }).count == 2 }, + { s in s[4] ? (s[5] && s[6]) : true }, + { s in s.drop(1).take(3).filter({ $0 }).count == 0 }, + { s in s.stride(2).filter({ $0 }).count == 4 }, + { s in [s[1], s[2]].filter({ $0 }).count == 1 }, + { s in s[6] ? (s[4] && s[5]) : true }, + { s in s.take(6).filter({ $0 }).count == 3 }, + { s in [s[10], s[11]].filter({ $0 }).count == 2 }, + { s in [s[6], s[7], s[8]].filter({ $0 }).count == 1 }, + { s in s.take(11).filter({ $0 }).count == 4 } +] + +for variant in 0..<(1< decodeurl diff --git a/Task/URL-decoding/LiveCode/url-decoding-1.livecode b/Task/URL-decoding/LiveCode/url-decoding-1.livecode new file mode 100644 index 0000000000..ad40dbf45b --- /dev/null +++ b/Task/URL-decoding/LiveCode/url-decoding-1.livecode @@ -0,0 +1,2 @@ +put urlDecode("http%3A%2F%2Ffoo%20bar%2F") & cr & \ + urlDecode("google.com/search?q=%60Abdu%27l-Bah%C3%A1") diff --git a/Task/URL-decoding/LiveCode/url-decoding-2.livecode b/Task/URL-decoding/LiveCode/url-decoding-2.livecode new file mode 100644 index 0000000000..285f3f8a9c --- /dev/null +++ b/Task/URL-decoding/LiveCode/url-decoding-2.livecode @@ -0,0 +1,2 @@ +http://foo bar/ +google.com/search?q=`Abdu'l-Bah√° diff --git a/Task/URL-decoding/Nim/url-decoding.nim b/Task/URL-decoding/Nim/url-decoding.nim new file mode 100644 index 0000000000..07dc573422 --- /dev/null +++ b/Task/URL-decoding/Nim/url-decoding.nim @@ -0,0 +1,3 @@ +import cgi + +echo decodeUrl("http%3A%2F%2Ffoo%20bar%2F") diff --git a/Task/URL-decoding/Sidef/url-decoding.sidef b/Task/URL-decoding/Sidef/url-decoding.sidef new file mode 100644 index 0000000000..eb00abe568 --- /dev/null +++ b/Task/URL-decoding/Sidef/url-decoding.sidef @@ -0,0 +1,7 @@ +func urldecode(str) { + str.gsub!('+', ' '); + str.gsub!(/\%([A-Fa-f0-9]{2})/, {|a| 'C'.pack(a.hex)}); + return str; +} + +say urldecode('http%3A%2F%2Ffoo+bar%2F'); # => "http://foo bar/" diff --git a/Task/URL-decoding/Swift/url-decoding.swift b/Task/URL-decoding/Swift/url-decoding.swift new file mode 100644 index 0000000000..c95b0a9dee --- /dev/null +++ b/Task/URL-decoding/Swift/url-decoding.swift @@ -0,0 +1,6 @@ +import Foundation + +let encoded = "http%3A%2F%2Ffoo%20bar%2F" +if let normal = encoded.stringByReplacingPercentEscapesUsingEncoding(NSUTF8StringEncoding) { + println(normal) +} diff --git a/Task/URL-decoding/jq/url-decoding-1.jq b/Task/URL-decoding/jq/url-decoding-1.jq new file mode 100644 index 0000000000..8ded88a764 --- /dev/null +++ b/Task/URL-decoding/jq/url-decoding-1.jq @@ -0,0 +1,27 @@ +# Emit . and stop as soon as "condition" is true. +def until(condition; next): + def u: if condition then . else (next|u) end; + u; + +def url_decode: + # The helper function converts the input string written in the given + # "base" to an integer + def to_i(base): + explode + | reverse + | map(if 65 <= . and . <= 90 then . + 32 else . end) # downcase + | map(if . > 96 then . - 87 else . - 48 end) # "a" ~ 97 => 10 ~ 87 + | reduce .[] as $c + # base: [power, ans] + ([1,0]; (.[0] * base) as $b | [$b, .[1] + (.[0] * $c)]) | .[1]; + + . as $in + | length as $length + | [0, ""] # i, answer + | until ( .[0] >= $length; + .[0] as $i + | if $in[$i:$i+1] == "%" + then [ $i + 3, .[1] + ([$in[$i+1:$i+3] | to_i(16)] | implode) ] + else [ $i + 1, .[1] + $in[$i:$i+1] ] + end) + | .[1]; # answer diff --git a/Task/URL-decoding/jq/url-decoding-2.jq b/Task/URL-decoding/jq/url-decoding-2.jq new file mode 100644 index 0000000000..3504adb9a0 --- /dev/null +++ b/Task/URL-decoding/jq/url-decoding-2.jq @@ -0,0 +1 @@ +"http%3A%2F%2Ffoo%20bar%2F" | url_decode diff --git a/Task/URL-decoding/jq/url-decoding-3.jq b/Task/URL-decoding/jq/url-decoding-3.jq new file mode 100644 index 0000000000..95f37982f9 --- /dev/null +++ b/Task/URL-decoding/jq/url-decoding-3.jq @@ -0,0 +1 @@ +"http://foo bar/" diff --git a/Task/URL-encoding/Apex/url-encoding.apex b/Task/URL-encoding/Apex/url-encoding.apex new file mode 100644 index 0000000000..19631424b2 --- /dev/null +++ b/Task/URL-encoding/Apex/url-encoding.apex @@ -0,0 +1 @@ +EncodingUtil.urlEncode('http://foo bar/', 'UTF-8') diff --git a/Task/URL-encoding/Lasso/url-encoding.lasso b/Task/URL-encoding/Lasso/url-encoding.lasso new file mode 100644 index 0000000000..6197e2d520 --- /dev/null +++ b/Task/URL-encoding/Lasso/url-encoding.lasso @@ -0,0 +1 @@ +bytes('http://foo bar/') -> encodeurl diff --git a/Task/URL-encoding/Lingo/url-encoding.lingo b/Task/URL-encoding/Lingo/url-encoding.lingo new file mode 100644 index 0000000000..2707bbd9a2 --- /dev/null +++ b/Task/URL-encoding/Lingo/url-encoding.lingo @@ -0,0 +1,2 @@ +put urlencode("http://foo bar/") +-- "http%3a%2f%2ffoo+bar%2f" diff --git a/Task/URL-encoding/LiveCode/url-encoding.livecode b/Task/URL-encoding/LiveCode/url-encoding.livecode new file mode 100644 index 0000000000..107538c33b --- /dev/null +++ b/Task/URL-encoding/LiveCode/url-encoding.livecode @@ -0,0 +1,2 @@ +urlEncode("http://foo bar/") +-- http%3A%2F%2Ffoo+bar%2F diff --git a/Task/URL-encoding/Nim/url-encoding.nim b/Task/URL-encoding/Nim/url-encoding.nim new file mode 100644 index 0000000000..2eee05361d --- /dev/null +++ b/Task/URL-encoding/Nim/url-encoding.nim @@ -0,0 +1,3 @@ +import cgi + +echo encodeUrl("http://foo/bar/") diff --git a/Task/URL-encoding/Sidef/url-encoding.sidef b/Task/URL-encoding/Sidef/url-encoding.sidef new file mode 100644 index 0000000000..35af64d802 --- /dev/null +++ b/Task/URL-encoding/Sidef/url-encoding.sidef @@ -0,0 +1,7 @@ +func urlencode(str) { + str.gsub!(%r"([^-A-Za-z0-9_.!~*'() ])", {|a| "%%%02X" % a.ord}); + str.gsub!(' ', '+'); + return str; +} + +say urlencode('http://foo bar/'); diff --git a/Task/URL-encoding/jq/url-encoding-1.jq b/Task/URL-encoding/jq/url-encoding-1.jq new file mode 100644 index 0000000000..daa2639602 --- /dev/null +++ b/Task/URL-encoding/jq/url-encoding-1.jq @@ -0,0 +1 @@ +"á" | @uri diff --git a/Task/URL-encoding/jq/url-encoding-2.jq b/Task/URL-encoding/jq/url-encoding-2.jq new file mode 100644 index 0000000000..9196eaa8fa --- /dev/null +++ b/Task/URL-encoding/jq/url-encoding-2.jq @@ -0,0 +1,9 @@ +def url_encode: + # The helper function checks whether the input corresponds to one of the characters: !'()* + def recode: . as $c | [33,39,40,41,42] | index($c); + def hex: if . < 10 then 48 + . else 55 + . end; + @uri + | explode + # 37 ==> "%", 50 ==> "2" + | map( if recode then (37, 50, ((. - 32) | hex)) else . end ) + | implode; diff --git a/Task/URL-encoding/jq/url-encoding-3.jq b/Task/URL-encoding/jq/url-encoding-3.jq new file mode 100644 index 0000000000..186e026563 --- /dev/null +++ b/Task/URL-encoding/jq/url-encoding-3.jq @@ -0,0 +1 @@ +"http://foo bar/" | @uri diff --git a/Task/URL-encoding/jq/url-encoding-4.jq b/Task/URL-encoding/jq/url-encoding-4.jq new file mode 100644 index 0000000000..c9f207c6b1 --- /dev/null +++ b/Task/URL-encoding/jq/url-encoding-4.jq @@ -0,0 +1 @@ +"http://foo bar/" | @uri == url_encode diff --git a/Task/URL-encoding/jq/url-encoding-5.jq b/Task/URL-encoding/jq/url-encoding-5.jq new file mode 100644 index 0000000000..2f15dd25d4 --- /dev/null +++ b/Task/URL-encoding/jq/url-encoding-5.jq @@ -0,0 +1 @@ +[range(0;1024) | [.] | implode | if @uri == . then . else empty end] | join(null) diff --git a/Task/URL-encoding/jq/url-encoding-6.jq b/Task/URL-encoding/jq/url-encoding-6.jq new file mode 100644 index 0000000000..638514f124 --- /dev/null +++ b/Task/URL-encoding/jq/url-encoding-6.jq @@ -0,0 +1 @@ +[range(0;1024) | [.] | implode | if url_encode == . then . else empty end] | join(null) diff --git a/Task/Ulam-spiral--for-primes-/ERRE/ulam-spiral--for-primes-.erre b/Task/Ulam-spiral--for-primes-/ERRE/ulam-spiral--for-primes-.erre new file mode 100644 index 0000000000..f636c447d2 --- /dev/null +++ b/Task/Ulam-spiral--for-primes-/ERRE/ulam-spiral--for-primes-.erre @@ -0,0 +1,78 @@ +PROGRAM SPIRAL + +!$INTEGER + +CONST RIGHT=1,UP=2,LEFT=3,DOWN=4 + +!$DYNAMIC +DIM SPIRAL$[0,0] + +PROCEDURE PRT_ULAM(N) + FOR ROW=0 TO N DO + FOR COL=0 TO N DO + PRINT(SPIRAL$[ROW,COL];) + END FOR + PRINT + END FOR + PRINT + GET(K$) + FOR ROW=0 TO N DO + FOR COL=0 TO N DO + IF VAL(SPIRAL$[ROW,COL])<>0 THEN PRINT(" * ";) ELSE PRINT(SPIRAL$[ROW,COL];) END IF + END FOR + PRINT + END FOR +END PROCEDURE + +PROCEDURE IS_PRIME(A->RES%) + LOCAL N + IF A=2 THEN RES%=TRUE EXIT PROCEDURE END IF + IF A<=1 OR (A MOD 2=0) THEN RES%=FALSE EXIT PROCEDURE END IF + MAX=SQR(A) + FOR N=3 TO MAX STEP 2 DO + IF (A MOD N=0) THEN RES%=FALSE EXIT PROCEDURE END IF + END FOR + RES%=TRUE +END PROCEDURE + +PROCEDURE GEN_ULAM(N,I) + DIR=RIGHT + J=I + Y=INT(N/2) + IF (N MOD 2=0) THEN X=Y-1 ELSE X=Y END IF ! shift left for even n's + WHILE J<=(N*N)-1+I DO + + IS_PRIME(J->RES%) + IF RES% THEN SPIRAL$[Y,X]=RIGHT$(" "+STR$(J),4) ELSE SPIRAL$[Y,X]=" ---" END IF + + CASE DIR OF + RIGHT-> + IF (X<=(N-1) AND SPIRAL$[Y-1,X]="" AND J>I) THEN DIR=UP END IF + END -> + UP-> + IF SPIRAL$[Y,X-1]="" THEN DIR=LEFT END IF + END -> + LEFT-> + IF (X=0) OR SPIRAL$[Y+1,X]="" THEN DIR=DOWN END IF + END -> + DOWN-> + IF SPIRAL$[Y,X+1]="" THEN DIR=RIGHT END IF + END -> + END CASE + + CASE DIR OF + RIGHT-> X=X+1 END -> + UP-> Y=Y-1 END -> + LEFT-> X=X-1 END -> + DOWN-> Y=Y+1 END -> + END CASE + J=J+1 + END WHILE + PRT_ULAM(N) +END PROCEDURE + +BEGIN + N=9 + !$DIM SPIRAL$[N,N] + GEN_ULAM(N,1) +END PROGRAM diff --git a/Task/Ulam-spiral--for-primes-/EchoLisp/ulam-spiral--for-primes-.echolisp b/Task/Ulam-spiral--for-primes-/EchoLisp/ulam-spiral--for-primes-.echolisp new file mode 100644 index 0000000000..08246c82ff --- /dev/null +++ b/Task/Ulam-spiral--for-primes-/EchoLisp/ulam-spiral--for-primes-.echolisp @@ -0,0 +1,5 @@ +(lib 'plot) + +(define *red* (rgb 1 0 0)) +(define (ulam n nmax) (if ( prime? n) *red* (gray (// n nmax)))) +(plot-spiral ulam 1000) ;; range [0...1000] diff --git a/Task/Ulam-spiral--for-primes-/Sidef/ulam-spiral--for-primes-.sidef b/Task/Ulam-spiral--for-primes-/Sidef/ulam-spiral--for-primes-.sidef new file mode 100644 index 0000000000..fe121a8f6a --- /dev/null +++ b/Task/Ulam-spiral--for-primes-/Sidef/ulam-spiral--for-primes-.sidef @@ -0,0 +1,27 @@ +require('Imager'); +  +var (n=512, start=1, file='ulam.png') = ARGV»to_i»()...; +  +func cell(n, x, y, start) { + y -= (n >> 1); + x -= (n-1 >> 1); + var l = 2*(x.abs > y.abs ? x.abs : y.abs); + var d = (y > x  ? (l*3 + x + y) : (l - x - y)); + (l-1)**2 + d + start - 1; +} +  +var black = %s'Imager::Color'.new('#000000'); +var white = %s'Imager::Color'.new('#FFFFFF'); +  +var img = %s'Imager'.new(xsize => n, ysize => n, channels => 1); +img.box(filled => 1, color => white); +  +for y in ^n { + for x in ^n { + var v = cell(n, x, y, start); + v.is_prime && + img.setpixel(x => x, y => y, color => black); + } +} +  +img.write(file => file); diff --git a/Task/Unbias-a-random-generator/ERRE/unbias-a-random-generator.erre b/Task/Unbias-a-random-generator/ERRE/unbias-a-random-generator.erre new file mode 100644 index 0000000000..77e37e518b --- /dev/null +++ b/Task/Unbias-a-random-generator/ERRE/unbias-a-random-generator.erre @@ -0,0 +1,30 @@ +PROGRAM UNBIAS + +FUNCTION RANDN(N) + RANDN=INT(1+N*RND(1))=1 +END FUNCTION + +PROCEDURE UNBIASED(N->RIS) + LOCAL A,B + REPEAT + A=RANDN(N) + B=RANDN(N) + UNTIL A<>B + RIS=A +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) ! CLS + RANDOMIZE(TIMER) + + FOR N=3 TO 6 DO + BIASED=0 + UNBIASED=0 + FOR I=1 TO 10000 DO + IF RANDN(N) THEN biased+=1 + UNBIASED(N->RIS) + IF RIS THEN unbiased+=+1 + END FOR + PRINT("N =";N;" : biased =";biased/100;", unbiased =";unbiased/100) + END FOR +END PROGRAM diff --git a/Task/Unbias-a-random-generator/Nim/unbias-a-random-generator.nim b/Task/Unbias-a-random-generator/Nim/unbias-a-random-generator.nim new file mode 100644 index 0000000000..e964bbef99 --- /dev/null +++ b/Task/Unbias-a-random-generator/Nim/unbias-a-random-generator.nim @@ -0,0 +1,38 @@ +import math, strutils +randomize() + +template newSeqWith(len: int, init: expr): expr = + var result {.gensym.} = newSeq[type(init)](len) + for i in 0 .. int +} + +func unbiased(n) { + var n1 = nil + do { n1 = randN(n) } while (n1 == randN(n)) + return n1 +} + +var iterations = 1000 + +for n in (3..6) { + var raw = [] + var fixed = [] + iterations.times { + raw[ randN(n) ] := 0 ++ + fixed[ unbiased(n) ] := 0 ++ + } + printf("N=%d randN: %s, %4.1f%% unbiased: %s, %4.1f%%\n", + n, [raw, fixed].map {|a| (a.dump, a[1] * 100 / iterations) }...) +} diff --git a/Task/Undefined-values/FreeBASIC/undefined-values.freebasic b/Task/Undefined-values/FreeBASIC/undefined-values.freebasic new file mode 100644 index 0000000000..830801b9ef --- /dev/null +++ b/Task/Undefined-values/FreeBASIC/undefined-values.freebasic @@ -0,0 +1,8 @@ +' FB 1.05.0 Win64 + +Dim i As Integer '' initialized to 0 by default +Dim j As Integer = 3 '' initialized to 3 +Dim k As Integer = Any '' left uninitialized (compiler warning but can be ignored) + +Print i, j, k +Sleep diff --git a/Task/Undefined-values/Lingo/undefined-values.lingo b/Task/Undefined-values/Lingo/undefined-values.lingo new file mode 100644 index 0000000000..1a42a4952e --- /dev/null +++ b/Task/Undefined-values/Lingo/undefined-values.lingo @@ -0,0 +1,9 @@ +put var +-- +put var=VOID +-- 1 +put voidP(var) +-- 1 +var = 23 +put voidP(var) +-- 0 diff --git a/Task/Undefined-values/Phix/undefined-values.phix b/Task/Undefined-values/Phix/undefined-values.phix new file mode 100644 index 0000000000..e63b2d3673 --- /dev/null +++ b/Task/Undefined-values/Phix/undefined-values.phix @@ -0,0 +1,13 @@ +object x + +procedure test() + if object(x) then + puts(1,"x is an object\n") + else + puts(1,"x is unassigned\n") + end if +end procedure + +test() +x = 1 +test() diff --git a/Task/Undefined-values/Sidef/undefined-values.sidef b/Task/Undefined-values/Sidef/undefined-values.sidef new file mode 100644 index 0000000000..9a09138ed9 --- /dev/null +++ b/Task/Undefined-values/Sidef/undefined-values.sidef @@ -0,0 +1,13 @@ +var x; # declared, but not defined +x == nil && say "nil value"; +defined(x) || say "undefined"; + +# Give "x" some value +x = 42; + +defined(x) && say "defined"; + +# Change "x" back to `nil` +x = nil; + +defined(x) || say "undefined"; diff --git a/Task/Undefined-values/jq/undefined-values-1.jq b/Task/Undefined-values/jq/undefined-values-1.jq new file mode 100644 index 0000000000..57056a87d2 --- /dev/null +++ b/Task/Undefined-values/jq/undefined-values-1.jq @@ -0,0 +1 @@ +{}["key"] #=> null diff --git a/Task/Undefined-values/jq/undefined-values-2.jq b/Task/Undefined-values/jq/undefined-values-2.jq new file mode 100644 index 0000000000..92db042c0c --- /dev/null +++ b/Task/Undefined-values/jq/undefined-values-2.jq @@ -0,0 +1 @@ +1/0 == null #=>false diff --git a/Task/Undefined-values/jq/undefined-values-3.jq b/Task/Undefined-values/jq/undefined-values-3.jq new file mode 100644 index 0000000000..02653bd320 --- /dev/null +++ b/Task/Undefined-values/jq/undefined-values-3.jq @@ -0,0 +1 @@ +def sum: reduce .[] as $x (null; . + $x); diff --git a/Task/Unicode-strings/LFE/unicode-strings-1.lfe b/Task/Unicode-strings/LFE/unicode-strings-1.lfe new file mode 100644 index 0000000000..9e1c3347e7 --- /dev/null +++ b/Task/Unicode-strings/LFE/unicode-strings-1.lfe @@ -0,0 +1,2 @@ +> (set encoded (binary ("åäö ð" utf8))) +#B(195 165 195 164 195 182 32 195 176) diff --git a/Task/Unicode-strings/LFE/unicode-strings-2.lfe b/Task/Unicode-strings/LFE/unicode-strings-2.lfe new file mode 100644 index 0000000000..6155874fd3 --- /dev/null +++ b/Task/Unicode-strings/LFE/unicode-strings-2.lfe @@ -0,0 +1,2 @@ +> (io:format "~tp~n" (list encoded)) +<<"åäö ð"/utf8>> diff --git a/Task/Unicode-strings/LFE/unicode-strings-3.lfe b/Task/Unicode-strings/LFE/unicode-strings-3.lfe new file mode 100644 index 0000000000..b3f439e094 --- /dev/null +++ b/Task/Unicode-strings/LFE/unicode-strings-3.lfe @@ -0,0 +1,2 @@ +> (unicode:characters_to_list encoded 'utf8) +"åäö ð" diff --git a/Task/Unicode-strings/Lasso/unicode-strings.lasso b/Task/Unicode-strings/Lasso/unicode-strings.lasso new file mode 100644 index 0000000000..95f56f81b2 --- /dev/null +++ b/Task/Unicode-strings/Lasso/unicode-strings.lasso @@ -0,0 +1,7 @@ +local(unicode = '♥♦♣♠') +#unicode -> append('\u9830') +#unicode +'
' +#unicode -> get (2) +'
' +#unicode -> get (4) -> integer diff --git a/Task/Unicode-strings/Lingo/unicode-strings.lingo b/Task/Unicode-strings/Lingo/unicode-strings.lingo new file mode 100644 index 0000000000..16870cceea --- /dev/null +++ b/Task/Unicode-strings/Lingo/unicode-strings.lingo @@ -0,0 +1,10 @@ +put _system.getInstalledCharSets() +-- ["big5", "cp1026", "cp866", "ebcdic-cp-us", "gb2312", "ibm437", "ibm737", +"ibm775", "ibm850", "ibm852", "ibm857", "ibm861", "ibm869", "iso-8859-1", +"iso-8859-15", "iso-8859-2", "iso-8859-4", "iso-8859-5", "iso-8859-7", +"iso-8859-9", "johab", "koi8-r", "koi8-u", "ks_c_5601-1987", "macintosh", +"shift_jis", "us-ascii", "utf-16", "utf-16be", "utf-7", "utf-8", "windows-1250", +"windows-1251", "windows-1252", "windows-1253", "windows-1254", "windows-1255", +"windows-1256", "windows-1257", "windows-1258", "windows-874", +"x-ebcdic-greekmodern", "x-mac-ce", "x-mac-cyrillic", "x-mac-greek", +"x-mac-icelandic", "x-mac-turkish"] diff --git a/Task/Unicode-strings/Nim/unicode-strings.nim b/Task/Unicode-strings/Nim/unicode-strings.nim new file mode 100644 index 0000000000..f90c81086d --- /dev/null +++ b/Task/Unicode-strings/Nim/unicode-strings.nim @@ -0,0 +1,4 @@ +let c = "abcdé" +let Δ = 12 +let e = "$abcde¢£¤¥©ÇßçIJijŁłʒλπ•₠₡₢₣₤₥₦₧₨₩₪₫€₭₮₯₰₱₲₳₴₵₵←→⇒∙⌘☺☻ア字文𪚥" +echo e diff --git a/Task/Unicode-strings/Sidef/unicode-strings.sidef b/Task/Unicode-strings/Sidef/unicode-strings.sidef new file mode 100644 index 0000000000..0e1bc35bf7 --- /dev/null +++ b/Task/Unicode-strings/Sidef/unicode-strings.sidef @@ -0,0 +1,19 @@ +# International class; name and street + class 国際( なまえ, Straße ) { + + # Say who am I! + method 言え { + say "I am #{self.なまえ} from #{self.Straße}"; + } +} + + # all the people of the world! + var 民族 = [ + 国際( "高田 Friederich", "台湾" ), + 国際( "Smith Σωκράτης", "Cantù" ), + 国際( "Stanisław Lec", "południow" ), + ]; + +民族.each { |garçon| + garçon.言え; +} diff --git a/Task/Unicode-variable-names/8th/unicode-variable-names.8th b/Task/Unicode-variable-names/8th/unicode-variable-names.8th new file mode 100644 index 0000000000..237a130bce --- /dev/null +++ b/Task/Unicode-variable-names/8th/unicode-variable-names.8th @@ -0,0 +1,19 @@ +1 var, Δ + +Δ @ n:1+ Δ ! + +Δ @ . cr + +\ unicode silliness + +: 念 ' G:@ w:exec ; +: 店 ' G:! w:exec ; +: ਵਾਧਾ ' n:1+ w:exec ; +: الوداع ' G:bye w:exec ; +: キャリッジリターン ' G:cr w:exec ; +: प्रिंट ' G:. w:exec ; + +Δ 念 ਵਾਧਾ Δ 店 + +Δ 念 प्रिंट キャリッジリターン +الوداع diff --git a/Task/Unicode-variable-names/EchoLisp/unicode-variable-names.echolisp b/Task/Unicode-variable-names/EchoLisp/unicode-variable-names.echolisp new file mode 100644 index 0000000000..0bb01c1329 --- /dev/null +++ b/Task/Unicode-variable-names/EchoLisp/unicode-variable-names.echolisp @@ -0,0 +1,4 @@ +(define ∆-🍒 1) → ∆-🍒 +(set! ∆-🍒 (1+ ∆-🍒)) → 2 +(printf "🔦 Look at ∆-🍒 : %d" ∆-🍒) +🔦 Look at ∆-🍒 : 2 diff --git a/Task/Unicode-variable-names/FreeBASIC/unicode-variable-names.freebasic b/Task/Unicode-variable-names/FreeBASIC/unicode-variable-names.freebasic new file mode 100644 index 0000000000..90eb5af07c --- /dev/null +++ b/Task/Unicode-variable-names/FreeBASIC/unicode-variable-names.freebasic @@ -0,0 +1,6 @@ +'FB 1.05.0 Win64 + +Var delta = 1 +delta += 1 +Print delta '' 2 +Sleep diff --git a/Task/Unicode-variable-names/Lily/unicode-variable-names.lily b/Task/Unicode-variable-names/Lily/unicode-variable-names.lily new file mode 100644 index 0000000000..8187e90798 --- /dev/null +++ b/Task/Unicode-variable-names/Lily/unicode-variable-names.lily @@ -0,0 +1,3 @@ +var Δ = 1 +Δ += 1 +print(Δ.to_s()) diff --git a/Task/Unicode-variable-names/Lingo/unicode-variable-names.lingo b/Task/Unicode-variable-names/Lingo/unicode-variable-names.lingo new file mode 100644 index 0000000000..594f645945 --- /dev/null +++ b/Task/Unicode-variable-names/Lingo/unicode-variable-names.lingo @@ -0,0 +1,4 @@ +Δ = 1 +Δ = Δ + 1 +put Δ +-- 2 diff --git a/Task/Unicode-variable-names/LiveCode/unicode-variable-names.livecode b/Task/Unicode-variable-names/LiveCode/unicode-variable-names.livecode new file mode 100644 index 0000000000..4e73ef4185 --- /dev/null +++ b/Task/Unicode-variable-names/LiveCode/unicode-variable-names.livecode @@ -0,0 +1,4 @@ +put 1 into Δ +add 1 to Δ +put Δ +-- result is 2 diff --git a/Task/Unicode-variable-names/Nim/unicode-variable-names.nim b/Task/Unicode-variable-names/Nim/unicode-variable-names.nim new file mode 100644 index 0000000000..90f18dc334 --- /dev/null +++ b/Task/Unicode-variable-names/Nim/unicode-variable-names.nim @@ -0,0 +1,3 @@ +var Δ = 1 +Δ.inc() +echo(Δ) diff --git a/Task/Unicode-variable-names/Peloton/unicode-variable-names-1.peloton b/Task/Unicode-variable-names/Peloton/unicode-variable-names-1.peloton new file mode 100644 index 0000000000..20b99e6665 --- /dev/null +++ b/Task/Unicode-variable-names/Peloton/unicode-variable-names-1.peloton @@ -0,0 +1,3 @@ +<@ LETVARLIT>Δ|1 +<@ ACTICRVAR>Δ +<@ SAYVAR>Δ diff --git a/Task/Unicode-variable-names/Peloton/unicode-variable-names-2.peloton b/Task/Unicode-variable-names/Peloton/unicode-variable-names-2.peloton new file mode 100644 index 0000000000..504503f553 --- /dev/null +++ b/Task/Unicode-variable-names/Peloton/unicode-variable-names-2.peloton @@ -0,0 +1,3 @@ +<@ LETVARLIT>三角洲|1 +<@ ACTICRVAR>三角洲 +<@ SAYVAR>三角洲 diff --git a/Task/Unicode-variable-names/Phix/unicode-variable-names.phix b/Task/Unicode-variable-names/Phix/unicode-variable-names.phix new file mode 100644 index 0000000000..aefa5128af --- /dev/null +++ b/Task/Unicode-variable-names/Phix/unicode-variable-names.phix @@ -0,0 +1,3 @@ +integer Δ = 1 + Δ += 1 + ?Δ diff --git a/Task/Unicode-variable-names/Sidef/unicode-variable-names.sidef b/Task/Unicode-variable-names/Sidef/unicode-variable-names.sidef new file mode 100644 index 0000000000..37e98d659c --- /dev/null +++ b/Task/Unicode-variable-names/Sidef/unicode-variable-names.sidef @@ -0,0 +1,3 @@ +var Δ = 1; +Δ += 1; +say Δ; diff --git a/Task/Unicode-variable-names/Swift/unicode-variable-names.swift b/Task/Unicode-variable-names/Swift/unicode-variable-names.swift new file mode 100644 index 0000000000..62d1e034e8 --- /dev/null +++ b/Task/Unicode-variable-names/Swift/unicode-variable-names.swift @@ -0,0 +1,5 @@ +var Δ = 1 +let π = 3.141592 +let 你好 = "hello" +Δ++ +println(Δ) diff --git a/Task/Universal-Turing-machine/EchoLisp/universal-turing-machine-1.echolisp b/Task/Universal-Turing-machine/EchoLisp/universal-turing-machine-1.echolisp new file mode 100644 index 0000000000..39232965e0 --- /dev/null +++ b/Task/Universal-Turing-machine/EchoLisp/universal-turing-machine-1.echolisp @@ -0,0 +1,101 @@ +(require 'struct) + +(struct TM (read-only: name states symbs final rules mem state-values: tape pos state)) + +(define-syntax-rule (rule-idx state symb numstates) + (+ state (* symb numstates))) + +(define-syntax-rule (make-TM name states symbs rules) + (_make-TM name 'states 'symbs 'rules)) + +;; a rule is (state symbol --> write move new-state) +;; index for rule = state-num + (number of states) * symbol-num +;; convert states/symbol into vector indices +(define (compile-rule T rule into: rules) + (define numstates (vector-length (TM-states T))) + (define state (vector-index [rule 0](TM-states T) )) ; index + (define symb (vector-index [rule 1](TM-symbs T) )) + (define write-symb (vector-index [rule 2] (TM-symbs T) )) + (define move (1- (vector-index [rule 3] #(left stay right) ))) + (define new-state (vector-index [rule 4](TM-states T))) + (define rulenum (rule-idx state symb numstates)) + (vector-set! rules rulenum (vector write-symb move new-state)) + ; (writeln 'rule rulenum [rules rulenum]) + ) + +(define (_make-TM name states symbs rules) + (define T (TM name (list->vector states) (list->vector symbs) null null)) + (set-TM-final! T (1- (length states))) ;; assume one final state + (set-TM-rules! T (make-vector (* (length states) (length symbs)))) + (for ((rule rules)) (compile-rule T (list->vector rule) into: (TM-rules T))) + T ) ; returns a TM + +;;------------------ +;; TM-trace +;;------------------- +(string-delimiter "") + +(define (TM-print T symb-index: symb (hilite #f)) + (cond + ((= 0 symb) (if hilite "🔲" "◽️" )) + ((= 1 symb) (if hilite "🔳 " "◾️" )) + (else "X"))) + +(define (TM-trace T tape pos state step) + (if (= (TM-final T) state) + (write "🔴") + (write "🔵")) + + (for [(p (in-range (- (TM-mem T) 7) (+ (TM-mem T) 8)))] + (write (TM-print T [tape p] (= p pos)))) + (write step) + (writeln)) + +;;--------------- +;; TM-init : alloc and init tape +;;--------------- +(define (TM-init T input-symbs (mem 20)) + ;; init state variables + (set-TM-tape! T (make-vector (* 2 mem))) + (set-TM-pos! T mem) + (set-TM-state! T 0) + (set-TM-mem! T mem) + + (for [(symb input-symbs) (i (in-naturals))] + (vector-set! (TM-tape T) [+ i (TM-pos T)] (vector-index symb (TM-symbs T)))) + (TM-trace T (TM-tape T) mem 0 0) + mem ) + +;;--------------- +;; TM-run : run at most maxsteps +;;--------------- +(define (TM-run T (verbose #f) (maxsteps 1_000_000)) +(define count 0) + (define final (TM-final T)) + (define rules (TM-rules T)) + (define rule 0) + (define numstates (vector-length (TM-states T))) + ;; set current state vars + (define pos (TM-pos T)) + (define state (TM-state T)) + (define tape (TM-tape T)) + + (when (and (zero? state) (= pos (TM-mem T))) + (writeln 'Starting (TM-name T)) + (TM-trace T tape pos 0 count)) + + (while (and (!= state final) (< count maxsteps)) + (++ count) +;; The machine + (set! rule [rules (rule-idx state [tape pos] numstates)]) + (when (= rule 0) (error "missing rule" (list state [tape pos]))) + (vector-set! tape pos [rule 0]) + (set! state [rule 2]) + (+= pos [rule 1]) +;; end machine + (when verbose (TM-trace T tape pos state count ))) +;; save TM state + (set-TM-pos! T pos) + (set-TM-state! T state) + (when (= final state) (writeln 'Stopping (TM-name T) 'at-pos (- pos (TM-mem T)))) + count) diff --git a/Task/Universal-Turing-machine/EchoLisp/universal-turing-machine-2.echolisp b/Task/Universal-Turing-machine/EchoLisp/universal-turing-machine-2.echolisp new file mode 100644 index 0000000000..c8fab52680 --- /dev/null +++ b/Task/Universal-Turing-machine/EchoLisp/universal-turing-machine-2.echolisp @@ -0,0 +1,8 @@ +(define steps 0) +(define (TM-task T) + (define count (TM-run T #f 1000000)) + (when (zero? steps) (writeln 'START (date))) + (+= steps count) + (writeln 'TM-steps steps (date)) + (when (zero? count) (writeln 'END steps (date))) + (if (zero? count) #f T)) ;; return #f to signal end of task diff --git a/Task/Universal-Turing-machine/Nim/universal-turing-machine.nim b/Task/Universal-Turing-machine/Nim/universal-turing-machine.nim new file mode 100644 index 0000000000..4ebad2a3cf --- /dev/null +++ b/Task/Universal-Turing-machine/Nim/universal-turing-machine.nim @@ -0,0 +1,76 @@ +import strutils, tables + +proc runUTM(state, halt, blank: string, tape: seq[string] = @[], + rules: seq[seq[string]]) = + var + st = state + pos = 0 + tape = tape + rulesTable = initTable[tuple[s0, v0: string], tuple[v1, dr, s1: string]]() + + if tape.len == 0: tape = @[blank] + if pos < 0: pos += tape.len + assert pos in 0..tape.high + + for r in rules: + assert r.len == 5 + rulesTable[(r[0], r[1])] = (r[2], r[3], r[4]) + + while true: + stdout.write st,'\t' + for i, v in tape: + if i == pos: stdout.write '[',v,']' + else: stdout.write ' ',v,' ' + echo "" + + if st == halt: break + if not rulesTable.hasKey((st, tape[pos])): break + + let (v1, dr, s1) = rulesTable[(st, tape[pos])] + tape[pos] = v1 + if dr == "left": + if pos > 0: dec pos + else: tape.insert blank + if dr == "right": + inc pos + if pos >= tape.len: tape.add blank + st = s1 + +echo "incr machine\n" +runUTM(halt = "qf", + state = "q0", + tape = "1 1 1".split, + blank = "B", + rules = @["q0 1 1 right q0".split, + "q0 B 1 stay qf".split]) + +echo "\nbusy beaver\n" +runUTM(halt = "halt", + state = "a", + blank = "0", + rules = @["a 0 1 right b".split, + "a 1 1 left c".split, + "b 0 1 left a".split, + "b 1 1 right b".split, + "c 0 1 left b".split, + "c 1 1 stay halt".split]) + +echo "\nsorting test\n" +runUTM(halt = "STOP", + state = "A", + blank = "0", + tape = "2 2 2 1 2 2 1 2 1 2 1 2 1 2".split, + rules = @["A 1 1 right A".split, + "A 2 3 right B".split, + "A 0 0 left E".split, + "B 1 1 right B".split, + "B 2 2 right B".split, + "B 0 0 left C".split, + "C 1 2 left D".split, + "C 2 2 left C".split, + "C 3 2 left E".split, + "D 1 1 left D".split, + "D 2 2 left D".split, + "D 3 1 right A".split, + "E 1 1 left E".split, + "E 0 0 right STOP".split]) diff --git a/Task/Universal-Turing-machine/PHL/universal-turing-machine.phl b/Task/Universal-Turing-machine/PHL/universal-turing-machine.phl new file mode 100644 index 0000000000..d1ebf137a5 --- /dev/null +++ b/Task/Universal-Turing-machine/PHL/universal-turing-machine.phl @@ -0,0 +1,152 @@ +module turing; + +extern printf; + +struct @Command { + field @Integer tape {get:tape,set:stape}; + field @Integer move {get:move,set:smove}; + field @Integer next {get:next,set:snext}; + + @Command init(@Integer tape, @Integer move, @Integer next) [ + this.stape(tape); + this.smove(move); + this.snext(next); + return this; + ] +}; + +doc 2 dimansional array structure; + +struct @Rules { + + field @Integer maxstates { get: maxstates, set: smaxstates }; + field @Integer maxvalue { get: maxvalue, set: smaxvalue }; + + field @Array<@Array<@Command> > table {get: t, set: st}; + + @Rules init(@Integer states, @Integer values) + [ + this.smaxstates(states); + this.smaxvalue(values); + this.st(new @Array<@Array<@Command> >.init(states)); + return this; + ] + + @Void setRule(@Integer state, @Integer tape, @Command command) + [ + if (null == this::t.get(state)) { + this::t.set(state, new @Array<@Command>.init(this::maxvalue)); + } + this::t.get(state).set(tape, command); + ] + + @Command getRule(@Integer state, @Integer tape) + [ + return this::t.get(state).get(tape); + ] + +}; + +@Void emulateTuring(@Rules rules, @Integer start, @Integer stop, @Array<@Integer> tape, @Integer blank) [ + var tapepointer = 0; + var state = start; + + doc output; + printf("Tape\tState\n"); + + while (state != stop) { + doc add more cells to the tape; + if (tapepointer == tape::size) tape.add(blank); + if (tapepointer == 0-1) { tape = (new @Array<@Integer>..blank).addAll(tape); tapepointer = 0; } + + doc output; + for (var i = 0; i < tape::size; i=i+1) { + printf("%i", tape.get(i)); + } + printf("\t%i\n", state); + for (var i = 0; i < tapepointer; i=i+1) { + printf(" "); + } + printf("^\n"); + + doc the value of the current cell; + var tapeval = tape.get(tapepointer); + + doc the current state; + var command = rules.getRule(state, tapeval); + + tape.set(tapepointer, command::tape); + tapepointer = tapepointer + command::move; + state = command::next; + } + + doc output; + for (var i = 0; i < tape::size; i=i+1) { + printf("%i", tape.get(i)); + } + printf("\t%i\n", state); + for (var i = 0; i < tapepointer; i=i+1) { + printf(" "); + } + printf("^\n"); +] + +@Integer main [ + + doc incrementer; + + doc 2 states, 2 symbols; + + var rules = new @Rules.init(2, 2); + + doc q0, 1 -> 1, right, q0; + doc q0, B -> 1, stay, qf; + + rules.setRule(0, 1, new @Command.init(1, 1, 0)); + rules.setRule(0, 0, new @Command.init(1, 0, 1)); + + doc tape = [1, 1, 1]; + + var tape = new @Array<@Integer>..1..1..1; + + doc start turing machine; + + emulateTuring(rules, 0, 1, tape, 0); + + doc ---------------------------------------------------; + + doc three state busy beaver; + + doc 4 states, 2 symbols; + + rules = new @Rules.init(4, 2); + + doc a, 0 -> 1, right, b + a, 1 -> 1, left, c + b, 0 -> 1, left, a + b, 1 -> 1, right, b + c, 0 -> 1, left, b + c, 1 -> 1, stay, halt + ; + + doc a = 0, + b = 1, + c = 2, + halt = 3; + + rules.setRule(0, 0, new @Command.init(1, 1, 1)); + rules.setRule(0, 1, new @Command.init(1, 0-1, 2)); + rules.setRule(1, 0, new @Command.init(1, 0-1, 0)); + rules.setRule(1, 1, new @Command.init(1, 1, 1)); + rules.setRule(2, 0, new @Command.init(1, 0-1, 1)); + rules.setRule(2, 1, new @Command.init(1, 0, 3)); + + doc tape = []; + + tape = new @Array<@Integer>; + + doc start turing machine; + + emulateTuring(rules, 0, 3, tape, 0); + return 0; +] diff --git a/Task/Universal-Turing-machine/SequenceL/universal-turing-machine-1.sequencel b/Task/Universal-Turing-machine/SequenceL/universal-turing-machine-1.sequencel new file mode 100644 index 0000000000..5b5643da31 --- /dev/null +++ b/Task/Universal-Turing-machine/SequenceL/universal-turing-machine-1.sequencel @@ -0,0 +1,218 @@ +//region Imports + +import ; +import ; + +//endregion + +//region Types + +MCONFIG ::= (Label: char(1), Symbols: char(2), Operations: char(2), FinalConfig: char(1)); +STATE ::= (CurrentConfig: char(1), CurrentPosition: int(0), Tape: char(1)); +INPUT_DATA ::= (Iterations: int(0), InitialTape: char(1), StartingPosition: int(0), InitialConfig: char(1), MConfigs: MCONFIG(1)); + +//endregion + +//region Constants + +SPACE_CHAR := '_'; +DELIMITTER := '|'; + +NULL_CONFIG := (Label: "", Symbols: [], Operations: [], FinalConfig: ""); + +TRACE_HEADER := ["Config:\t| Place:\t| Tape:"]; + +//endregion + +//region Helpers + +StateToString(state(0)) := + state.CurrentConfig ++ + " \t\t| " ++ intToString(state.CurrentPosition) ++ + " \t| " ++ state.Tape; + +StateToArrowString(state(0)) := + state.Tape ++ "\n" ++ + duplicate(' ', state.CurrentPosition - 1) ++ "|\n" ++ + duplicate(' ', state.CurrentPosition - 1) ++ state.CurrentConfig ++ "\n"; + +HeadOfEach(strings(2))[i] := + head(strings[i]); + +RemoveCharacter(character(0), string(1))[i] := + string[i] when not(string[i] = character); + +GetFSquares(Tape(1))[i] := + Tape[i] when (i mod 2) = 1; + +//endregion + +//region Parsing + +ParseConfig(Line(1)) := + let + entries := split(Line, DELIMITTER); + label := entries[1]; + symbols := split(entries[2], ','); + operations := split(entries[3], ','); + finalConfig := entries[4]; + in + ((Label: label, Symbols: symbols, Operations: operations, FinalConfig: finalConfig) when not((Line[1] = '/') and (Line[2] = '/'))) + when size(Line) > 0; + +ParseTextFile(Text(1)) := + let + noSpaces := RemoveCharacter('\t', RemoveCharacter('\r', RemoveCharacter(' ', Text))); + lines := split(noSpaces, '\n'); + iterations := stringToInt(lines[1]); + initialTape := lines[2]; + initialPosition := stringToInt(lines[3]); + initialConfig := lines[4]; + mConfigs := ParseConfig(lines[5 ... size(lines)]); + in + (Iterations: iterations, InitialTape: initialTape, StartingPosition: initialPosition, InitialConfig: initialConfig, MConfigs: mConfigs); + +//endregion + +//region Config Finding + +Matches: char(0) * char(2) -> bool; +Matches(currentSymbol(0), symbols(2)) := + true when size(symbols) = 0 //some(equalListNT("", symbols)) + else + true when currentSymbol = SPACE_CHAR and some(equalListNT("none", symbols)) + else + true when not(currentSymbol = SPACE_CHAR) and some(equalListNT("any", symbols)) + else + true when some(currentSymbol = HeadOfEach(symbols)) + else + false; + +GetCurrentSymbol(State(0)) := + State.Tape[State.CurrentPosition] when size(State.Tape) >= State.CurrentPosition and State.CurrentPosition > 0 + else + SPACE_CHAR; + +GetConfigHelper(label(1), symbol(0), mConfigs(1))[i] := + mConfigs[i] when equalList(mConfigs[i].Label, label) and Matches(symbol, mConfigs[i].Symbols); + +GetConfig(label(1), symbol(0), mConfigs(1)) := + let + searchResults := GetConfigHelper(label, symbol, mConfigs); + in + NULL_CONFIG when size(searchResults) = 0 + else + searchResults[1]; + +//endregion + +//region Operations + +TrimTapeEnd(tape(1), position(0)) := + tape when position = size(tape) + else + tape when not(last(tape) = SPACE_CHAR) + else + TrimTapeEnd(allButLast(tape), position); + +ApplyOperations(State(0), Operations(2)) := + let + newState := ApplyOperation(State, head(Operations)); + in + State when size(Operations) = 0 + else + ApplyOperations(newState, tail(Operations)); + +ApplyOperation(State(0), Operation(1)) := + let + newTape := + PrintOperation(head(tail(Operation)), State.CurrentPosition, State.Tape) when head(Operation) = 'P' + else + EraseOperation(State.CurrentPosition, State.Tape) when head(Operation) = 'E' + else + [SPACE_CHAR] ++ State.Tape when head(Operation) = 'L' and State.CurrentPosition = 1 + else + State.Tape ++ [SPACE_CHAR] when head(Operation) = 'R' and State.CurrentPosition = size(State.Tape) + else + State.Tape; + + newPosition := + 1 when head(Operation) = 'L' and State.CurrentPosition = 1 + else + State.CurrentPosition + 1 when head(Operation) = 'R' + else + State.CurrentPosition - 1 when head(Operation) = 'L' + else + State.CurrentPosition; + + trimmedTape := TrimTapeEnd(newTape, newPosition); + in + State when size(Operation) = 0 + else + (CurrentPosition: newPosition, Tape: trimmedTape); + +PrintOperation(Symbol(0), Position(0), Tape(1)) := + let + diff := Position - size(Tape) when Position > size(Tape) else 0; + expandedTape := Tape ++ duplicate(SPACE_CHAR, diff); + finalTape := setElementAt(expandedTape, Position, Symbol); + in + finalTape; + +EraseOperation(Position(0), Tape(1)) := + PrintOperation(SPACE_CHAR, Position, Tape); + +//endregion + +//region Execution + +RunMachine(Text(1), Flag(1)) := + let + input := ParseTextFile(Text); + initialState := (CurrentConfig: input.InitialConfig, CurrentPosition: input.StartingPosition, Tape: input.InitialTape); + + processed := Process(initialState, input.MConfigs, input.Iterations); + processedWithTrace := ProcessWithTrace(initialState, input.MConfigs, input.Iterations); + in + "\n" ++ delimit(TRACE_HEADER ++ StateToString(processedWithTrace), '\n') when equalList(Flag, "trace") + else + "\n" ++ delimit(StateToArrowString(processedWithTrace), '\n') when equalList(Flag, "arrow-trace") + else + processed.Tape when equalList(Flag, "tape") + else + TrimTapeEnd(GetFSquares(processed.Tape), 1) when equalList(Flag, "f-squares") + else + boolToString(DoesMachineHalt(initialState, input.MConfigs, input.Iterations)) when equalList(Flag, "halts") + else + StateToString(processed); + +DoesMachineHalt(InitialState(0), mConfigs(1), Iterations(0)) := + let + resultState := Process(InitialState, mConfigs, Iterations); + in + equalList(resultState.CurrentConfig, "halt"); + +ProcessWithTrace(InitialState(0), mConfigs(1), Iterations(0)) := + [InitialState] when Iterations <= 0 or size(InitialState.CurrentConfig) = 0 or equalList(InitialState.CurrentConfig, "halt") + else + [InitialState] ++ ProcessWithTrace(Iterate(InitialState, mConfigs), mConfigs, Iterations - 1); + +Process(InitialState(0), mConfigs(1), Iterations(0)) := + InitialState when Iterations = 0 or size(InitialState.CurrentConfig) = 0 or equalList(InitialState.CurrentConfig, "halt") + else + Process(Iterate(InitialState, mConfigs), mConfigs, Iterations - 1); + +Iterate(State(0), mConfigs(1)) := + let + currentConfig := GetConfig(State.CurrentConfig, GetCurrentSymbol(State), mConfigs); + newState := Execute(State, currentConfig); + in + newState; + +Execute(State(0), mConfig(0)) := + let + newState := ApplyOperations(State, mConfig.Operations); + in + (CurrentConfig: mConfig.FinalConfig, CurrentPosition: newState.CurrentPosition, Tape: newState.Tape); + +//endregion diff --git a/Task/Universal-Turing-machine/SequenceL/universal-turing-machine-2.sequencel b/Task/Universal-Turing-machine/SequenceL/universal-turing-machine-2.sequencel new file mode 100644 index 0000000000..2b8fc92af3 --- /dev/null +++ b/Task/Universal-Turing-machine/SequenceL/universal-turing-machine-2.sequencel @@ -0,0 +1,67 @@ +#include +#include +#include +#include +#include "SL_Generated.h" + +int cores = 0; +string fileName = "../../INPUT/irrational.tm"; +string flag = "tape"; +string fileContents = ""; + +using namespace std; + +std::string get_file_contents(const char *filename); + +int main( int argc, char** argv ) +{ + if(argc >= 2) + { + fileName = argv[1]; + } + + if(argc >= 3) + { + flag = argv[2]; + } + + if(argc >= 4) + { + cores = atoi(argv[3]); + } + + int flagDims[] = { flag.length(), 0}; + Sequence flagSeq((void*)(flag.c_str()), flagDims); + + fileContents = get_file_contents(fileName.c_str()); + int inputDims[] = { fileContents.length(), 0}; + Sequence input((void*)(fileContents.c_str()), inputDims); + + Sequence result; + + sl_init(cores); + + sl_RunMachine(input, flagSeq, cores, result); + + cout<= tape.len) { + tape.append(blank) + } + } + } + + state = s1; + goto :NEXT; + } + + die 'No matching rules'; + @:NEXT; + } +} + +print "incr machine\n"; +run_utm( + halt: 'qf', + state: 'q0', + tape: %w(1 1 1), + blank: 'B', + rules: [ + %w(q0 1 1 right q0), + %w(q0 B 1 stay qf), + ]); + +say "\nbusy beaver"; +run_utm( + halt: 'halt', + state: 'a', + blank: '0', + rules: [ + %w(a 0 1 right b), + %w(a 1 1 left c), + %w(b 0 1 left a), + %w(b 1 1 right b), + %w(c 0 1 left b), + %w(c 1 1 stay halt), + ]); + +say "\nsorting test"; +run_utm( + halt: 'STOP', + state: 'A', + blank: '0', + tape: %w(2 2 2 1 2 2 1 2 1 2 1 2 1 2), + rules: [ + %w(A 1 1 right A), + %w(A 2 3 right B), + %w(A 0 0 left E), + %w(B 1 1 right B), + %w(B 2 2 right B), + %w(B 0 0 left C), + %w(C 1 2 left D), + %w(C 2 2 left C), + %w(C 3 2 left E), + %w(D 1 1 left D), + %w(D 2 2 left D), + %w(D 3 1 right A), + %w(E 1 1 left E), + %w(E 0 0 right STOP), + ]); diff --git a/Task/Unix-ls/8th/unix-ls.8th b/Task/Unix-ls/8th/unix-ls.8th new file mode 100644 index 0000000000..12def86897 --- /dev/null +++ b/Task/Unix-ls/8th/unix-ls.8th @@ -0,0 +1,3 @@ +"*" f:glob +' s:cmp a:sort +"\n" a:join . diff --git a/Task/Unix-ls/EchoLisp/unix-ls.echolisp b/Task/Unix-ls/EchoLisp/unix-ls.echolisp new file mode 100644 index 0000000000..bf45c7dee8 --- /dev/null +++ b/Task/Unix-ls/EchoLisp/unix-ls.echolisp @@ -0,0 +1,16 @@ +;; ls of stores (kind of folders) +(for-each writeln (list-sort < (local-stores))) → + AGES + NEMESIS + info + objects.dat + reader + system + user + words + +;; ls of "NEMESIS" store +(for-each writeln (local-keys "NEMESIS")) → + Alan + Glory + Jonah diff --git a/Task/Unix-ls/FunL/unix-ls.funl b/Task/Unix-ls/FunL/unix-ls.funl new file mode 100644 index 0000000000..b7a87dc4fa --- /dev/null +++ b/Task/Unix-ls/FunL/unix-ls.funl @@ -0,0 +1,4 @@ +import io.File + +for f <- sort( list(File( "." ).list()).filterNot(s -> s.startsWith(".")) ) + println( f ) diff --git a/Task/Unix-ls/LiveCode/unix-ls.livecode b/Task/Unix-ls/LiveCode/unix-ls.livecode new file mode 100644 index 0000000000..04d85fde4c --- /dev/null +++ b/Task/Unix-ls/LiveCode/unix-ls.livecode @@ -0,0 +1,4 @@ +set the defaultFolder to "/foo" +put the folders & the files +set the defaultFolder to "/foo/bar" +put the folders & the files diff --git a/Task/Unix-ls/Nim/unix-ls.nim b/Task/Unix-ls/Nim/unix-ls.nim new file mode 100644 index 0000000000..a2c1ab85de --- /dev/null +++ b/Task/Unix-ls/Nim/unix-ls.nim @@ -0,0 +1,4 @@ +import os + +for kind, path in walkDir(getCurrentDir(), true): + echo path diff --git a/Task/Unix-ls/Sidef/unix-ls-1.sidef b/Task/Unix-ls/Sidef/unix-ls-1.sidef new file mode 100644 index 0000000000..4eed8d3884 --- /dev/null +++ b/Task/Unix-ls/Sidef/unix-ls-1.sidef @@ -0,0 +1,9 @@ +var content = []; +Dir.cwd.open.each { |file| + file ~~ < . .. > && next; + content.append(file); +} + +content.sort.each { |file| + say file; +} diff --git a/Task/Unix-ls/Sidef/unix-ls-2.sidef b/Task/Unix-ls/Sidef/unix-ls-2.sidef new file mode 100644 index 0000000000..45a2c389ae --- /dev/null +++ b/Task/Unix-ls/Sidef/unix-ls-2.sidef @@ -0,0 +1,3 @@ +'*'.glob.each { |file| + say file; +} diff --git a/Task/Unix-ls/Ursa/unix-ls.ursa b/Task/Unix-ls/Ursa/unix-ls.ursa new file mode 100644 index 0000000000..b2e64dfcab --- /dev/null +++ b/Task/Unix-ls/Ursa/unix-ls.ursa @@ -0,0 +1,7 @@ +decl file f +decl string<> fnames +set fnames (sort (f.listdir ".")) + +for (decl int i) (< i (size fnames)) (inc i) + out fnames endl console +end for diff --git a/Task/Update-a-configuration-file/FreeBASIC/update-a-configuration-file.freebasic b/Task/Update-a-configuration-file/FreeBASIC/update-a-configuration-file.freebasic new file mode 100644 index 0000000000..97e8aafeb5 --- /dev/null +++ b/Task/Update-a-configuration-file/FreeBASIC/update-a-configuration-file.freebasic @@ -0,0 +1,105 @@ +' FB 1.05.0 Win64 + +Type ConfigData + favouriteFruit As String + needsPeeling As Boolean + seedsRemoved As Boolean + numberOfBananas As UInteger + numberOfStrawberries As UInteger +End Type + +Sub updateConfigData(fileName As String, cData As ConfigData) + Dim fileNum As Integer = FreeFile + Open fileName For Input As #fileNum + If err > 0 Then + Print "File could not be opened" + Sleep + End + End If + Dim tempFileName As String = "temp_" + fileName + Dim fileNum2 As Integer = FreeFile + Open tempFileName For Output As #fileNum2 + Dim As Boolean hadFruit, hadPeeling, hadSeeds, hadBananas, hadStrawberries '' all false by default + Dim As String ln + While Not Eof(fileNum) + Line Input #fileNum, ln + If ln = "" OrElse Left(ln, 1) = "#" Then + Print #fileNum2, ln + Continue While + End If + ln = Trim(LTrim(ln, ";"), Any !" \t") + If ln = "" Then Continue While + If UCase(Left(ln, 14)) = "FAVOURITEFRUIT" Then + If hadFruit Then Continue While + hadFruit = True + Print #fileNum2, "FAVOURITEFRUIT " + cData.favouriteFruit + ElseIf UCase(Left(ln, 12)) = "NEEDSPEELING" Then + If hadPeeling Then Continue While + hadPeeling = True + If cData.needsPeeling Then + Print #fileNum2, "NEEDSPEELING" + Else + Print #fileNum2, "; NEEDSPEELING" + End If + ElseIf UCase(Left(ln, 12)) = "SEEDSREMOVED" Then + If hadSeeds Then Continue While + hadSeeds = True + If cData.seedsRemoved Then + Print #fileNum2, "SEEDSREMOVED" + Else + Print #fileNum2, "; SEEDSREMOVED" + End If + ElseIf UCase(Left(ln, 15)) = "NUMBEROFBANANAS" Then + If hadBananas Then Continue While + hadBananas = True + Print #fileNum2, "NUMBEROFBANANAS " + Str(cData.numberOfBananas) + ElseIf UCase(Left(ln, 20)) = "NUMBEROFSTRAWBERRIES" Then + If hadStrawberries Then Continue While + hadStrawberries = True + Print #fileNum2, "NUMBEROFSTRAWBERRIES " + Str(cData.numberOfStrawBerries) + End If + Wend + + If Not hadFruit Then + Print #fileNum2, "FAVOURITEFRUIT " + cData.favouriteFruit + End If + If Not hadPeeling Then + If cData.needsPeeling Then + Print #fileNum2, "NEEDSPEELING" + Else + Print #fileNum2, "; NEEDSPEELING" + End If + End If + If Not hadSeeds Then + If cData.seedsRemoved Then + Print #fileNum2, "SEEDSREMOVED" + Else + Print #fileNum2, "; SEEDSREMOVED" + End If + End If + If Not hadBananas Then + Print #fileNum2, "NUMBEROFBANANAS " + Str(cData.numberOfBananas) + End If + If Not hadStrawberries Then + Print #fileNum2, "NUMBEROFSTRAWBERRIES " + Str(cData.numberOfStrawBerries) + End If + + Close #fileNum : Close #fileNum2 + Kill(fileName) + Name (tempFileName fileName) +End Sub + +Dim fileName As String = "config2.txt" +Dim cData As ConfigData +With cData + .favouriteFruit = "banana" + .needsPeeling = False + .seedsRemoved = True + .numberOfBananas = 1024 + .numberOfStrawberries = 62000 +End With + +updateConfigData fileName, cData +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Update-a-configuration-file/Lasso/update-a-configuration-file-1.lasso b/Task/Update-a-configuration-file/Lasso/update-a-configuration-file-1.lasso new file mode 100644 index 0000000000..860f36ea1a --- /dev/null +++ b/Task/Update-a-configuration-file/Lasso/update-a-configuration-file-1.lasso @@ -0,0 +1,99 @@ +#!/usr/bin/lasso9 + +define config => type { + + data public configtxt, public path + + public oncreate( + path::string = 'testing/configuration.txt' + ) => { + .configtxt = file(#path) -> readstring + .path = #path + } + + public get(term::string) => { + .clean + local( + regexp = regexp(-find = `(?m)^` + #term + `($|\s*=\s*|\s+)(.*)$`, -input = .configtxt, -ignorecase), + result + ) + + while(#regexp -> find) => { + #result = (#regexp -> groupcount > 1 ? (#regexp -> matchString(2) -> trim& || true)) + if(#result -> asstring >> ',') => { + #result = #result -> split(',') + #result -> foreach => {#1 -> trim} + } + return #result + } + return false + } + + public set(term::string, value) => { + if(#value === false) => { + .disable(#term) + return + } + .enable(#term) + if(#value -> isanyof(::string, ::integer, ::decimal)) => { + .configtxt = regexp(-find = `(?m)^(` + #term + `) ?(.*?)$`, -replace = `$1 ` + #value, -input = .configtxt, -ignorecase) -> replaceall + } + } + + public disable(term::string) => { + .clean + local(regexp = regexp(-find = `(?m)^(` + #term + `)`, -replace = `; $1`, -input = .configtxt, -ignorecase)) + .configtxt = #regexp -> replaceall + } + + public enable(term::string, -comment::string = '# Added ' + date) => { + .clean + local(regexp = regexp(-find = `(?m)^(; )?(` + #term + `)`, -replace = `$2`, -input = .configtxt, -ignorecase)) + if(#regexp -> find) => { + .configtxt = #regexp -> replaceall + else + .configtxt -> append('\n' + (not #comment -> beginswith('#') ? '# ') + + #comment + '\n' + + string_uppercase(#term) + '\n' + ) + } + } + + public write => { + local(config = file(.path)) + #config -> opentruncate + #config -> dowithclose => { + #config -> writestring(.configtxt) + } + + } + + public clean => { + + local( + cleaned = array, + regexp = regexp(-find = `^(;+)\W*$`) + ) + + with line in .configtxt -> split('\n') do { + #line -> trim + #regexp -> input = #line + + if(#line -> beginswith('#') or #line == '') => { + #cleaned -> insert(#line) + else(not (#regexp -> find)) + if(#line -> beginswith(';')) => { + #line -> replace(regexp(`^;+ *`), `; `) + else + #line -> replace(regexp(`^(.*?) +(.*?)`), `$1 $2`) + } + #line -> replace(regexp(`\t`)) + #cleaned -> insert(#line) + } + } + + .configtxt = #cleaned -> join('\n') + + } + +} diff --git a/Task/Update-a-configuration-file/Lasso/update-a-configuration-file-2.lasso b/Task/Update-a-configuration-file/Lasso/update-a-configuration-file-2.lasso new file mode 100644 index 0000000000..e31f8c44bb --- /dev/null +++ b/Task/Update-a-configuration-file/Lasso/update-a-configuration-file-2.lasso @@ -0,0 +1,15 @@ +local( + config = config, +) + +stdoutnl(#config -> get('FAVOURITEFRUIT')) +stdoutnl(#config -> get('SEEDSREMOVED')) +stdoutnl(#config -> get('NUMBEROFBANANAS')) + +#config -> enable('seedsremoved') +#config -> enable('PARAMWITHCOMMENT', -comment = 'This param was added to demonstrate the possibility to also have comments associated with it') +#config -> disable('needspeeling') +#config -> set('numberofstrawberries', 62000) +#config -> set('numberofbananas', 1024) + +#config -> write diff --git a/Task/Use-another-language-to-call-a-function/Nim/use-another-language-to-call-a-function-1.nim b/Task/Use-another-language-to-call-a-function/Nim/use-another-language-to-call-a-function-1.nim new file mode 100644 index 0000000000..c6b9b9a877 --- /dev/null +++ b/Task/Use-another-language-to-call-a-function/Nim/use-another-language-to-call-a-function-1.nim @@ -0,0 +1,9 @@ +proc Query*(data: var array[1024, char], length: var cint): cint {.exportc.} = + const text = "Here am I" + if length < text.len: + return 0 + + for i in 0 .. + +extern int Query (char * Data, size_t * Length); + +int main (int argc, char * argv []) +{ + char Buffer [1024]; + size_t Size = sizeof (Buffer); + + if (0 == Query (Buffer, &Size)) + { + printf ("failed to call Query\n"); + } + else + { + char * Ptr = Buffer; + while (Size-- > 0) putchar (*Ptr++); + putchar ('\n'); + } +} diff --git a/Task/Use-another-language-to-call-a-function/Phix/use-another-language-to-call-a-function.phix b/Task/Use-another-language-to-call-a-function/Phix/use-another-language-to-call-a-function.phix new file mode 100644 index 0000000000..ef7c3d0c4e --- /dev/null +++ b/Task/Use-another-language-to-call-a-function/Phix/use-another-language-to-call-a-function.phix @@ -0,0 +1,10 @@ +constant Here_am_I = "Here am I" +function Query(atom pData, atom pLength) +integer len = peekNS(pLength,machine_word(),0) + if poke_string(pData,len,Here_am_I) then + return 0 + end if + pokeN(pLength,length(Here_am_I)+1,machine_word()) + return 1 +end function +constant Query_cb = call_back(routine_id("Query")) diff --git a/Task/User-input-Graphical/Phix/user-input-graphical.phix b/Task/User-input-Graphical/Phix/user-input-graphical.phix new file mode 100644 index 0000000000..ea78a2c136 --- /dev/null +++ b/Task/User-input-Graphical/Phix/user-input-graphical.phix @@ -0,0 +1,37 @@ +include pGUI.e + +Ihandle dlg, label1, input1, label2, input2, OK, Cancel + +function ok_cb(Ihandle self) + if self=OK then + string in1 = IupGetAttribute(input1,"VALUE") + integer in2 = IupGetInt(input2,"VALUE") + string msg = sprintf("\"%s\" and %d",{in1,in2}) + IupMessage("You entered",msg) + -- (return IUP_CONTINUE if unhappy with input) + end if + return IUP_CLOSE +end function + +function esc_close(Ihandle /*ih*/, atom c) + return iff(c=K_ESC?IUP_CLOSE:IUP_CONTINUE) +end function + +IupOpen("demo/pGUI/") +label1 = IupLabel("Please enter a string") +input1 = IupText("VALUE=\"a string\", EXPAND=HORIZONTAL") +label2 = IupLabel("and the number 75000") +input2 = IupText("VALUE=75000, EXPAND=HORIZONTAL") +IupSetAttribute(input2,"MASK",IUP_MASK_INT) +OK = IupButton("OK", "ACTION", Icallback("ok_cb")) +Cancel = IupButton("Cancel", "ACTION", Icallback("ok_cb")) +dlg = IupDialog(IupVbox({IupHbox({label1,input1},"ALIGNMENT=ACENTER, PADDING=5"), + IupHbox({label2,input2},"ALIGNMENT=ACENTER, PADDING=5"), + IupHbox({IupFill(),OK,Cancel,IupFill()},"PADDING=15")}, + "GAP=5,MARGIN=5x5")) +IupSetAttribute(dlg,"TITLE","User Input/Graphical") +IupSetCallback(dlg, "K_ANY", Icallback("esc_close")) +IupDestroy(IupNormalizer({OK,Cancel},"NORMALIZE=BOTH")) +IupShow(dlg) +IupMainLoop() +IupClose() diff --git a/Task/User-input-Graphical/Ring/user-input-graphical.ring b/Task/User-input-Graphical/Ring/user-input-graphical.ring new file mode 100644 index 0000000000..9ac71a1895 --- /dev/null +++ b/Task/User-input-Graphical/Ring/user-input-graphical.ring @@ -0,0 +1,43 @@ +Load "guilib.ring" + +MyApp = New qApp { + num = 0 + win1 = new qWidget() { + setwindowtitle("Hello World") + setGeometry(100,100,370,250) + + btn1 = new qpushbutton(win1) { + setGeometry(130,200,100,30) + settext("Validate") + setclickevent("Validate()")} + + lineedit1 = new qlineedit(win1) { + setGeometry(10,100,250,30) + settext("")} + + lineedit2 = new qlineedit(win1) { + setGeometry(10,150,50,30) + settext("0")} + + label1 = new qLabel(win1) { + setGeometry(270,100,50,30) + setText("")} + + label2 = new qLabel(win1) { + setGeometry(70,150,50,30) + setText("")} + + label3 = new qLabel(win1) { + setGeometry(10,50,250,30) + setText("Please enter a string, and the number 75000 :")} + show()} + exec()} + +func Validate + lineedit1{temp1 = text()} + num1 = isdigit(temp1) + if num1 = 0 label1{settext("OK")} else label1{settext("NOT OK")} ok + + lineedit2{temp2 = text()} + num2 = number(temp2) + if num2 = 75000 label2{settext("OK")} else label2{settext("NOT OK")} ok diff --git a/Task/User-input-Graphical/Sidef/user-input-graphical.sidef b/Task/User-input-Graphical/Sidef/user-input-graphical.sidef new file mode 100644 index 0000000000..a16456bdd9 --- /dev/null +++ b/Task/User-input-Graphical/Sidef/user-input-graphical.sidef @@ -0,0 +1,182 @@ +var gtk2 = require('Gtk2') -> init; + +var gui = %s'Gtk2::Builder'.new; +gui.add_from_string(DATA.slurp); + +func clicked_ok(*_) { + var entry = gui.get_object('entry1'); + var text = entry.get_text; + + var spinner = gui.get_object('spinbutton1'); + var number = spinner.get_text; + + say "string: #{text}"; + say "number: #{number}"; + + number == 75000 ? gtk2.main_quit : warn "Invalid number!"; +} + +func clicked_cancel(*_) { + gtk2.main_quit; +} + +gui.get_object('button1').signal_connect('clicked', clicked_ok); +gui.get_object('button2').signal_connect('clicked', clicked_cancel); + +gtk2.main; + +__DATA__ + + + + + + 100000 + 75000 + 1 + 10 + + + True + False + + + True + False + + + True + False + Please insert a string and a number: + + + True + True + 0 + + + + + True + False + + + True + False + string: + + + True + True + 55 + 0 + + + + + True + True + + False + False + True + True + + + True + True + 1 + + + + + True + True + 1 + + + + + True + False + + + True + False + number: + + + True + True + 0 + + + + + True + True + + False + False + True + True + adjustment1 + True + + + True + True + 1 + + + + + True + True + 2 + + + + + True + False + spread + + + gtk-ok + True + True + True + True + + + False + False + 0 + + + + + gtk-cancel + True + True + True + True + + + False + False + 1 + + + + + True + True + 3 + + + + + + diff --git a/Task/User-input-Text/Axe/user-input-text.axe b/Task/User-input-Text/Axe/user-input-text.axe new file mode 100644 index 0000000000..ffdf4eabfb --- /dev/null +++ b/Task/User-input-Text/Axe/user-input-text.axe @@ -0,0 +1,35 @@ +Disp "String:" +input→A +length(A)→L + +.Copy the string to a safe location +Copy(A,L₁,L) + +.Display the string +Disp "You entered:",i +For(I,0,L-1) + Disp {L₁+I}►Char +End +Disp i + +Disp "Integer:",i +input→B +length(B)→L + +.Parse the string and convert to an integer +0→C +For(I,0,L-1) + {B+I}-'0'→N + If N>10 + .Error checking + Disp "Not a number",i + Return + End + C*10+N→C +End + +.Display and check the integer +Disp "You entered:",i,C►Dec,i +If C≠7500 +Disp "That isn't 7500" +End diff --git a/Task/User-input-Text/Ceylon/user-input-text.ceylon b/Task/User-input-Text/Ceylon/user-input-text.ceylon new file mode 100644 index 0000000000..c18f48f1c0 --- /dev/null +++ b/Task/User-input-Text/Ceylon/user-input-text.ceylon @@ -0,0 +1,8 @@ +shared void run() { + print("enter any text here"); + value text = process.readLine(); + print(text); + print("enter the number 7500 here"); + value number = parseInteger(process.readLine() else "") else -1; + print("``number == 7500 then number else "close enough"``"); +} diff --git a/Task/User-input-Text/FreeBASIC/user-input-text.freebasic b/Task/User-input-Text/FreeBASIC/user-input-text.freebasic new file mode 100644 index 0000000000..6741023279 --- /dev/null +++ b/Task/User-input-Text/FreeBASIC/user-input-text.freebasic @@ -0,0 +1,11 @@ +' FB 1.05.0 Win64 + +Dim s As String +Dim i AS Integer +Input "Please enter a string : "; s +Do + Input "Please enter 75000 : "; i +Loop Until i = 75000 +Print +Print s, i +Sleep diff --git a/Task/User-input-Text/Lasso/user-input-text.lasso b/Task/User-input-Text/Lasso/user-input-text.lasso new file mode 100644 index 0000000000..f88a564a4b --- /dev/null +++ b/Task/User-input-Text/Lasso/user-input-text.lasso @@ -0,0 +1,31 @@ +#!/usr/bin/lasso9 + +define read_input(prompt::string) => { + + local(string) + + // display prompt + stdout(#prompt) + // the following bits wait until the terminal gives you back a line of input + while(not #string or #string -> size == 0) => { + #string = file_stdin -> readsomebytes(1024, 1000) + } + #string -> replace(bytes('\n'), bytes('')) + + return #string -> asstring + +} + +local( + string, + number +) + +// get string +#string = read_input('Enter the string: ') + +// get number +#number = integer(read_input('Enter the number: ')) + +// deliver the result +stdoutnl(#string + ' (' + #string -> type + ') | ' + #number + ' (' + #number -> type + ')') diff --git a/Task/User-input-Text/Nim/user-input-text.nim b/Task/User-input-Text/Nim/user-input-text.nim new file mode 100644 index 0000000000..cdb49572c1 --- /dev/null +++ b/Task/User-input-Text/Nim/user-input-text.nim @@ -0,0 +1,4 @@ +import rdstdin, strutils + +let str = readLineFromStdin "Input a string: " +let num = parseInt(readLineFromStdin "Input a string: ") diff --git a/Task/User-input-Text/Oforth/user-input-text.oforth b/Task/User-input-Text/Oforth/user-input-text.oforth new file mode 100644 index 0000000000..c3de8f467c --- /dev/null +++ b/Task/User-input-Text/Oforth/user-input-text.oforth @@ -0,0 +1,8 @@ +import: console + +: testInput{ +| s n | + System.Console askln ->s + while (System.Console askln asInteger dup ->n isNull) [ "Not an integer" println ] + + System.Out "Received : " << s << " and " << n << cr ; diff --git a/Task/User-input-Text/Phix/user-input-text.phix b/Task/User-input-Text/Phix/user-input-text.phix new file mode 100644 index 0000000000..6121cfa499 --- /dev/null +++ b/Task/User-input-Text/Phix/user-input-text.phix @@ -0,0 +1,2 @@ +?prompt_string("Enter any string:") +?prompt_number("Enter the number 75000:",{75000,75000}) diff --git a/Task/User-input-Text/Ring/user-input-text.ring b/Task/User-input-Text/Ring/user-input-text.ring new file mode 100644 index 0000000000..b2aa80dc76 --- /dev/null +++ b/Task/User-input-Text/Ring/user-input-text.ring @@ -0,0 +1,4 @@ +see "Enter a string : " give s +see "Enter an integer : " give i +see "String = " + s + nl +see "Integer = " + i + nl diff --git a/Task/User-input-Text/Sidef/user-input-text-1.sidef b/Task/User-input-Text/Sidef/user-input-text-1.sidef new file mode 100644 index 0000000000..79421ecebe --- /dev/null +++ b/Task/User-input-Text/Sidef/user-input-text-1.sidef @@ -0,0 +1,2 @@ +var s = read(String); +var i = read(Number); # auto-conversion to a number diff --git a/Task/User-input-Text/Sidef/user-input-text-2.sidef b/Task/User-input-Text/Sidef/user-input-text-2.sidef new file mode 100644 index 0000000000..1e5220a69d --- /dev/null +++ b/Task/User-input-Text/Sidef/user-input-text-2.sidef @@ -0,0 +1,2 @@ +var s = Sys.readln("Enter a string: "); +var i = Sys.readln("Enter a number: ").to_i; diff --git a/Task/User-input-Text/Swift/user-input-text.swift b/Task/User-input-Text/Swift/user-input-text.swift new file mode 100644 index 0000000000..c9ae427369 --- /dev/null +++ b/Task/User-input-Text/Swift/user-input-text.swift @@ -0,0 +1,4 @@ +print("Enter a string: ", terminator: "") +if let str = readLine() { + print(str) +} diff --git a/Task/User-input-Text/Ursa/user-input-text.ursa b/Task/User-input-Text/Ursa/user-input-text.ursa new file mode 100644 index 0000000000..7cd318246f --- /dev/null +++ b/Task/User-input-Text/Ursa/user-input-text.ursa @@ -0,0 +1,14 @@ +# +# user input +# + +# in ursa, the type of data expected must be specified +decl string str +decl int i + +out "input a string: " console +set str (in string console) +out "input an int: " console +set i (in int console) + +out "you entered " str " and " i endl console diff --git a/Task/User-input-Text/jq/user-input-text-1.jq b/Task/User-input-Text/jq/user-input-text-1.jq new file mode 100644 index 0000000000..54a18f9b41 --- /dev/null +++ b/Task/User-input-Text/jq/user-input-text-1.jq @@ -0,0 +1,8 @@ +def read(int): + null | until( . == int; "Expecting \(int)" | stderr | input); + +def read_string: + null | until( type == "string"; "Please enter a string" | stderr | input); + +(read_string | "I see the string: \(.)"), +(read(75000) | "I see the expected integer: \(.)") diff --git a/Task/User-input-Text/jq/user-input-text-2.jq b/Task/User-input-Text/jq/user-input-text-2.jq new file mode 100644 index 0000000000..5484456cd3 --- /dev/null +++ b/Task/User-input-Text/jq/user-input-text-2.jq @@ -0,0 +1,13 @@ +$ jq -n -r -f User_input.jq +"Please enter a string" +1 +"Please enter a string" +"ok" +I see the string: ok +"Expecting 75000" +1 +"Expecting 75000" +"ok" +"Expecting 75000" +75000 +I see the expected integer: 75000 diff --git a/Task/Vampire-number/FreeBASIC/vampire-number.freebasic b/Task/Vampire-number/FreeBASIC/vampire-number.freebasic new file mode 100644 index 0000000000..d376f6f664 --- /dev/null +++ b/Task/Vampire-number/FreeBASIC/vampire-number.freebasic @@ -0,0 +1,106 @@ +'Vampire numbers. +'FreeBASIC version 24. Windows +'Vampire.bas +Function WithinString(n As Ulongint,f As Ulongint) As Integer + var m=Str(n),p=Str(f) + For z As Integer=0 To Len(p)-1 + var i=Instr(m,Chr(p[z])) + If i Then + m=Mid(m,1,i-1)+Mid(m,i+1) + Else + Return 0 + End If + Next z + Return -1 +End Function + +Sub AllFactors(N As Ulongint,factors() As Ulongint) + Dim As String Sn=Str(n) + Dim As Integer half=Len(sn)\2 + Redim factors(1 To 1) + #macro bsort(array) + For p1 As Integer = 1 To Ubound(array) - 1 + For p2 As Integer = p1 + 1 To Ubound(array) + If array(p1)>array(p2) Then Swap array(p1),array(p2) + Next p2 + Next p1 + #endmacro + + Dim As Ulongint c + For i As Ulongint = 1 To Sqr(N) + If N Mod i=0 Then + If Len(Str(i))=half Then + If WithinString(N,i) Then + c=c+1 + Redim Preserve factors(1 To c) + factors(c)=i + End If + End If + If N <> i*i Then + If Len(Str(n\i))=half Then + If WithinString(N,n\i) Then + c=c+1 + Redim Preserve factors(1 To c) + factors(c)=n\i + End If + End If + End If + End If + Next i + bsort(factors) +End Sub + +Function VampireNumbers(N As Ulongint) As Integer + Dim As Integer flag + Dim As Ulongint LastFactor + Redim As Ulongint Factor() + AllFactors(N,Factor()) + For p1 As Integer = 1 To Ubound(Factor) + For p2 As Integer=1 To Ubound(Factor) + If Factor(p1)*Factor(p2)=n Then + If Factor(p1) Mod 10<>0 Or Factor(p2) Mod 10 <>0 Then + If WithinString(n,valulng(Str(Factor(p1))+Str(Factor(p2)))) Then + If LastFactor=Factor(p2) Then Exit For,For + flag=1 + Print n;": [";Factor(p1);",";Factor(p2);"]" + LastFactor=Factor(p1) + End If + End If + End If + Next p2 + Next p1 + If flag Then Return -1 +End Function + +'============== IMPLEMENT ============================== +print "First 28 Vampire numbers" +print +Print "Number: [fangs]" +Print +Dim As Ulongint n=1000 +Dim As Integer count +Dim As Double t1,t2 +t1=Timer +Do + n=n+1 + Var s=Str(n) + If Len(s) Mod 2<>0 Then n=n*10 + If vampireNumbers(n) Then count=count+1 +Loop Until count=27 +Print +print "Individual tests:" +print +'individual tests +n=16758243290880ull +If Not vampirenumbers(n) Then Print n;": [returns no fangs]" +Print +n=24959017348650ull +If Not vampirenumbers(n) Then Print n;": [returns no fangs]" +print +n=14593825548650ull +If Not vampirenumbers(n) then print n;": [returns no fangs]" +t2=Timer +print +Print "Completed in "; +Print t2-t1;" Seconds" +Sleep diff --git a/Task/Van-der-Corput-sequence/ERRE/van-der-corput-sequence.erre b/Task/Van-der-Corput-sequence/ERRE/van-der-corput-sequence.erre new file mode 100644 index 0000000000..a4dd7070cd --- /dev/null +++ b/Task/Van-der-Corput-sequence/ERRE/van-der-corput-sequence.erre @@ -0,0 +1,27 @@ +PROGRAM VAN_DER_CORPUT + +! +! for rosettacode.org +! + +PROCEDURE VDC(N%,B%->RES) + LOCAL V,S% + S%=1 + WHILE N%>0 DO + S%*=B% + V+=(N% MOD B%)/S% + N%=N% DIV B% + END WHILE + RES=V +END PROCEDURE + +BEGIN + FOR BASE%=2 TO 5 DO + PRINT("Base";STR$(BASE%);":") + FOR NUMBER%=0 TO 9 DO + VDC(NUMBER%,BASE%->RES) + WRITE("#.##### ";RES;) + END FOR + PRINT + END FOR +END PROGRAM diff --git a/Task/Van-der-Corput-sequence/FreeBASIC/van-der-corput-sequence.freebasic b/Task/Van-der-Corput-sequence/FreeBASIC/van-der-corput-sequence.freebasic new file mode 100644 index 0000000000..98ba187424 --- /dev/null +++ b/Task/Van-der-Corput-sequence/FreeBASIC/van-der-corput-sequence.freebasic @@ -0,0 +1,42 @@ +' version 03-12-2016 +' compile with: fbc -s console + +Function num_base(number As ULongInt, _base_ As UInteger) As String + + If _base_ > 9 Then + Print "base not handled by function" + Sleep 5000 + Return "" + End If + + Dim As ULongInt n + Dim As String ans + + While number <> 0 + n = number Mod _base_ + ans = Str(n) + ans + number = number \ _base_ + Wend + + If ans = "" Then ans = "0" + + Return "." + ans + +End Function + +' ------=< MAIN >=------ + +Dim As ULong k, l +For k = 2 To 5 + Print "Base = "; k + For l = 0 To 12 + Print left(num_base(l, k) + " ",6); + Next + Print : print +Next + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Van-der-Corput-sequence/Phix/van-der-corput-sequence.phix b/Task/Van-der-Corput-sequence/Phix/van-der-corput-sequence.phix new file mode 100644 index 0000000000..5532cc795a --- /dev/null +++ b/Task/Van-der-Corput-sequence/Phix/van-der-corput-sequence.phix @@ -0,0 +1,44 @@ +enum BASE, FRAC, DECIMAL +constant DESC = {"Base","Fraction","Decimal"} + +function vdc(integer n, atom base, integer flag) +object res = "" +atom num = 0, denom = 1, digit, g + while n do + denom *= base + digit = remainder(n,base) + n = floor(n/base) + if flag=BASE then + res &= digit+'0' + else + num = num*base+digit + end if + end while + if flag=FRAC then + g = gcd(num,denom) + return {num/g,denom/g} + elsif flag=DECIMAL then + return num/denom + end if + return {iff(length(res)=0?"0":"0."&res)} +end function + +procedure show_vdc(integer flag, string fmt) +object v + for i=2 to 5 do + printf(1,"%s %d: ",{DESC[flag],i}) + for j=0 to 9 do + v = vdc(j,i,flag) + if flag=FRAC and v[1]=0 then + printf(1,"0 ") + else + printf(1,fmt,v) + end if + end for + puts(1,"\n") + end for +end procedure + +show_vdc(BASE,"%s ") +show_vdc(FRAC,"%d/%d ") +show_vdc(DECIMAL,"%g ") diff --git a/Task/Van-der-Corput-sequence/Ring/van-der-corput-sequence.ring b/Task/Van-der-Corput-sequence/Ring/van-der-corput-sequence.ring new file mode 100644 index 0000000000..c24d8dc471 --- /dev/null +++ b/Task/Van-der-Corput-sequence/Ring/van-der-corput-sequence.ring @@ -0,0 +1,19 @@ +decimals(4) +for base = 2 to 5 + see "base " + string(base) + " : " + for number = 0 to 9 + see "" + corput(number, base) + " " + next + see nl +next + +func corput n, b + vdc = 0 + denom = 1 + while n + denom *= b + rem = n % b + n = floor(n/b) + vdc += rem / denom + end + return vdc diff --git a/Task/Van-der-Corput-sequence/Sidef/van-der-corput-sequence.sidef b/Task/Van-der-Corput-sequence/Sidef/van-der-corput-sequence.sidef new file mode 100644 index 0000000000..a331362b7e --- /dev/null +++ b/Task/Van-der-Corput-sequence/Sidef/van-der-corput-sequence.sidef @@ -0,0 +1,15 @@ +func vdc(value, base=2) { + while (value[-1] > 0) { + value.append(value[-1] / base -> int); + } + var (x, sum) = (1, 0); + value.each { |i| + sum += ((i % base) / (x *= base)); + } + return sum; +} + +2.to(5).each { |base| + var seq = (10.range.map {|i| vdc([i], base) }); + "base %d: %s\n".printf(base, seq.map{|n| "%.4f" % n}.join(', ')); +} diff --git a/Task/Van-der-Corput-sequence/jq/van-der-corput-sequence-1.jq b/Task/Van-der-Corput-sequence/jq/van-der-corput-sequence-1.jq new file mode 100644 index 0000000000..4d423385e4 --- /dev/null +++ b/Task/Van-der-Corput-sequence/jq/van-der-corput-sequence-1.jq @@ -0,0 +1,16 @@ +# vdc(base) converts an input decimal integer to a decimal number based on the van der +# Corput sequence using base 'base', e.g. (4 | vdc(2)) is 0.125. +# +def vdc(base): + + # The helper function converts a stream of residuals to a decimal, + # e.g. if base is 2, then decimalize( (0,0,1) ) yields 0.125 + def decimalize(stream): + reduce stream as $d # state: [accumulator, power] + ( [0, 1/base]; + .[1] as $power | [ .[0] + ($d * $power), $power / base] ) + | .[0]; + + if . == 0 then 0 + else decimalize(recurse( if . == 0 then empty else ./base | floor end ) % base) + end ; diff --git a/Task/Van-der-Corput-sequence/jq/van-der-corput-sequence-2.jq b/Task/Van-der-Corput-sequence/jq/van-der-corput-sequence-2.jq new file mode 100644 index 0000000000..691c792524 --- /dev/null +++ b/Task/Van-der-Corput-sequence/jq/van-der-corput-sequence-2.jq @@ -0,0 +1,5 @@ +def round(n): + (if . < 0 then -1 else 1 end) as $s + | $s*10*.*n | if (floor%10)>4 then (.+5) else . end | ./10 | floor/n | .*$s; + +range(2;6) | . as $base | "Base \(.): \( [ range(0;11) | vdc($base)|round(1000) ] )" diff --git a/Task/Van-der-Corput-sequence/jq/van-der-corput-sequence-3.jq b/Task/Van-der-Corput-sequence/jq/van-der-corput-sequence-3.jq new file mode 100644 index 0000000000..8171f5d16e --- /dev/null +++ b/Task/Van-der-Corput-sequence/jq/van-der-corput-sequence-3.jq @@ -0,0 +1,5 @@ +$ jq -n -f -c -r van_der_corput_sequence.jq +Base 2: [0,0.5,0.25,0.75,0.125,0.625,0.375,0.875,0.063,0.563,0.313] +Base 3: [0,0.333,0.667,0.111,0.444,0.778,0.222,0.556,0.889,0.037,0.37] +Base 4: [0,0.25,0.5,0.75,0.063,0.313,0.563,0.813,0.125,0.375,0.625] +Base 5: [0,0.2,0.4,0.6,0.8,0.04,0.24,0.44,0.64,0.84,0.08] diff --git a/Task/Variable-length-quantity/LiveCode/variable-length-quantity-1.livecode b/Task/Variable-length-quantity/LiveCode/variable-length-quantity-1.livecode new file mode 100644 index 0000000000..6268fb9b34 --- /dev/null +++ b/Task/Variable-length-quantity/LiveCode/variable-length-quantity-1.livecode @@ -0,0 +1,86 @@ +on DecToVLQ + Ask "Enter base 10 value:" -- input dialog box + if it is not empty then + if it is a number then + put it into theString + if isWholeNumString(theString) is false then -- I think there is built in equivalent for this but I rolled my own! + answer "Only Whole Decimal Numbers Are Allowed!" + exit DecToVLQ + end if + if theString>4294967295 then + answer "This function fails with whole numbers over 4294967295!"&cr\ + & "4294967295 is the maximum allowed value for 32bits (4 bytes)" + exit DecToVLQ + end if + if theString>268435455 then + answer "This function is not accurate with whole numbers over 268435455!"&cr\ + & "268435455 is the maximum allowed value for 28bit (7bits per byte) MIDI delta-time VLQ" + end if + put "Original Whole Number="& theString & cr & \ + "Original Whole Number in Hex="& baseConvert(theString,10,16) & cr & \ --- LC's built in baseConvert function + "Variable Length Quantity in Hex=" & wholeNumToVLQ(theString) into fld "Output" + else + answer "Only Whole Decimal Numbers Are Allowed!" + end if + end if +end DecToVLQ + +function wholeNumToVLQ theWholeNum + -- baseConvert(number,originalBase,destinationBase) -- there is also bitwise operations in LC but I took the long road + if theWholeNum < 127 then -- if it fits into a single 7bit byte value and theres no need to process it + put baseConvert(theWholeNum,10,16) into VQLinHex + if the number of chars in VQLinHex=1 then put "0" before VQLinHex + return VQLinHex + exit wholeNumToVLQ + end if + put baseConvert(theWholeNum,10,2) into theBits + put number of chars in theBits into x + put 0 into bitCounter + put empty into the7bitBytes + repeat + if char x of theBits is not empty then + put char x theBits before the7bitBytes + delete char x of theBits + if theBits is empty then exit repeat + put number of chars in theBits into x + add 1 to bitCounter + if bitCounter=7 then + put "," before the7bitBytes + put 0 into bitCounter + next repeat + end if + else + exit repeat + end if + end repeat + get the number of chars in item 1 of the7bitBytes + if it<7 then + put 7 - it into x + repeat x + put "0" before item 1 of the7bitBytes + end repeat + end if + put the number of items in the7bitBytes into y + repeat with x = 1 to y + if x is not y then + put "1" before item x of the7bitBytes + else + put "0" before item x of the7bitBytes + end if + put baseConvert(item x of the7bitBytes,2,16) into item x of the7bitBytes + if the number of chars in item x of the7bitBytes<2 then put "0" before item x of the7bitBytes + put item x of the7bitBytes after VQLinHex + end repeat + return VQLinHex +end wholeNumToVLQ + +function isWholeNumString theString + put the number of chars in theString into y + repeat with x = 1 to y + if char x of theString is not in "0123456789" then + return false + exit isWholeNumString + end if + end repeat + return true +end isWholeNumString diff --git a/Task/Variable-length-quantity/LiveCode/variable-length-quantity-2.livecode b/Task/Variable-length-quantity/LiveCode/variable-length-quantity-2.livecode new file mode 100644 index 0000000000..90d4d1be62 --- /dev/null +++ b/Task/Variable-length-quantity/LiveCode/variable-length-quantity-2.livecode @@ -0,0 +1,67 @@ +function VLQtoWholeNum theHexVLQ + -- The number must be an integer between zero and 4,294,967,295 + put baseConvert(theHexVLQ,16,2) into theBits + put 0 into bitCounter + put empty into the8bitBytes + repeat + if char 1 of theBits is not empty then + put char 1 theBits after the8bitBytes + delete char 1 of theBits + if theBits is empty then exit repeat + add 1 to bitCounter + if bitCounter=8 then + put "," after the8bitBytes + put 0 into bitCounter + next repeat + end if + else + exit repeat + end if + end repeat + put the number of items in the8bitBytes into y + repeat with x = 1 to y + put char 1 of item x of the8bitBytes into lengthCntrlBit + delete char 1 of item x of the8bitBytes + if the number of chars in item x of the8bitBytes < 7 then + repeat 7 - (the number of chars in item x of the8bitBytes) + put "0" before item x of the8bitBytes + end repeat + end if + put item x of the8bitBytes after WholeNumInBinary + switch lengthCntrlBit + case "1" + next repeat + break + case "0" + exit repeat + break + end switch + end repeat + return baseConvert(WholeNumInBinary,2,10) +end VLQtoWholeNum + +function isHexString theString + ---again there is probably an easier way to do this: + if char 1 to 2 of theString is "0x" then delete char 1 to 2 of theString + put the number of chars in theString into y + repeat with x = 1 to y + if char x of theString is not in "abcdefABCDEF0123456789" then + return false + end if + end repeat +end isHexString + +on VLQHexToWholeNum + Ask "Enter Variable Length Quantity Hex Value:" -- input dialog + if it is not empty then + if char 1 to 2 of it is "0x" then delete char 1 to 2 of it + put it into hexString + if isHexString(hexString) is false then + answer "Only Valid Hex Digits Are Allowed!" + exit VLQHexToWholeNum + else + put "Original Variable Length Quantity in Hex="& hexString & cr & \ + "Whole Number=" & VLQtoWholeNum(hexString) into fld "Output" + end if + end if +end VLQHexToWholeNum diff --git a/Task/Variable-length-quantity/Nim/variable-length-quantity.nim b/Task/Variable-length-quantity/Nim/variable-length-quantity.nim new file mode 100644 index 0000000000..198e8fc83c --- /dev/null +++ b/Task/Variable-length-quantity/Nim/variable-length-quantity.nim @@ -0,0 +1,24 @@ +import unsigned, strutils + +proc toSeq(x: uint64): seq[uint8] = + var x = x + result = @[] + var f = 0 + for i in countdown(9, 1): + if (x and (127'u64 shl uint((i * 7)))) > 0'u64: + f = i + break + for j in 0..f: + result.add(uint8((x shr uint64((f - j) * 7)) and 127) or 128) + + result[f] = result[f] xor 128'u8 + +proc fromSeq(xs): uint64 = + result = 0 + for x in xs: + result = (result shl 7) or (x and 127) + +for x in [0x7f'u64, 0x4000'u64, 0'u64, 0x3ffffe'u64, 0x1fffff'u64, + 0x200000'u64, 0x3311a1234df31413'u64]: + let c = toSeq(x) + echo "seq from $#: $# back: $#".format(x, c, fromSeq(c)) diff --git a/Task/Variable-length-quantity/Phix/variable-length-quantity.phix b/Task/Variable-length-quantity/Phix/variable-length-quantity.phix new file mode 100644 index 0000000000..9046ad3c4a --- /dev/null +++ b/Task/Variable-length-quantity/Phix/variable-length-quantity.phix @@ -0,0 +1,44 @@ +function vlq_encode(sequence s) +sequence res = {} +integer n, msb + for i=length(s) to 1 by -1 do + n = s[i] + if n<0 then crash("unsigned integers only!") end if + msb = 0 + while 1 do + res = prepend(res,msb+and_bits(n,#7F)) + n = floor(n/#80) + if n=0 then exit end if + msb = #80 + end while + end for + return res +end function + +function vlq_decode(sequence s) +sequence res = {} +integer n = 0, byte + for i=1 to length(s) do + byte = s[i] + n = n*#80+and_bits(byte,#7F) + if not and_bits(byte,#80) then + res = append(res,n) + n = 0 + end if + end for + return res +end function + +function svlg(sequence s) +string res = "" + for i=1 to length(s) do + res &= sprintf("#%02x:",{s[i]}) + end for + return res[1..$-1] +end function + +constant testNumbers = { #200000, #1FFFFF, 1, 127, 128 } +sequence s = vlq_encode(testNumbers) +sequence decoded = vlq_decode(s) +printf(1,"%s -> %s -> %s\n",{svlg(testNumbers),svlg(s),svlg(decoded)}) +if decoded!=testNumbers then crash("something wrong") end if diff --git a/Task/Variable-size-Get/FreeBASIC/variable-size-get.freebasic b/Task/Variable-size-Get/FreeBASIC/variable-size-get.freebasic new file mode 100644 index 0000000000..925f9500b1 --- /dev/null +++ b/Task/Variable-size-Get/FreeBASIC/variable-size-get.freebasic @@ -0,0 +1,20 @@ +' FB 1.05.0 Win64 + +Dim i As Integer +Dim l As Long +Dim s As Short +Dim b As Byte +Print "An integer occupies "; SizeOf(i); " bytes" +Print "A long occupies "; SizeOf(l); " bytes" +Print "A short occupies "; SizeOf(s); " bytes" +Print "A byte occupies "; SizeOf(b); " byte" + +' or use type directly rather than a variable + +Print "A boolean occupies "; SizeOf(Boolean); " byte" +Print "A single occupies "; SizeOf(Single); " bytes" +Print "A double occupies "; SizeOf(Double); " bytes" + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Variable-size-Get/Lasso/variable-size-get.lasso b/Task/Variable-size-Get/Lasso/variable-size-get.lasso new file mode 100644 index 0000000000..e744d1146c --- /dev/null +++ b/Task/Variable-size-Get/Lasso/variable-size-get.lasso @@ -0,0 +1,22 @@ +local( + mystring = 'Hello World', + myarray = array('one', 'two', 3), + myinteger = 1234 +) + +// size of a string will be a character count +#mystring -> size +'
' + +// size of an array or map will be a count of elements +#myarray -> size +'
' + +// elements within an array can report size +#myarray -> get(2) -> size +'
' + +// integers or decimals does not have sizes +//#myinteger -> size // will fail +// an integer can however be converted to a string first +string(#myinteger) -> size diff --git a/Task/Variable-size-Get/Nim/variable-size-get.nim b/Task/Variable-size-Get/Nim/variable-size-get.nim new file mode 100644 index 0000000000..91ddaa8a7f --- /dev/null +++ b/Task/Variable-size-Get/Nim/variable-size-get.nim @@ -0,0 +1 @@ +echo "An int contains ", sizeof(int), " bytes." diff --git a/Task/Variable-size-Get/Ring/variable-size-get.ring b/Task/Variable-size-Get/Ring/variable-size-get.ring new file mode 100644 index 0000000000..62c7f1bfc6 --- /dev/null +++ b/Task/Variable-size-Get/Ring/variable-size-get.ring @@ -0,0 +1,11 @@ +list1 = list(2) +list2 = list(4) +list3 = list(6) +list4 = list(7) +list5 = list(5) + +see "Size of list1 is : " + len(list1) + nl +see "Size of list2 is : " + len(list2) + nl +see "Size of list3 is : " + len(list3) + nl +see "Size of list4 is : " + len(list4) + nl +see "Size of list5 is : " + len(list5) + nl diff --git a/Task/Variable-size-Get/Swift/variable-size-get-1.swift b/Task/Variable-size-Get/Swift/variable-size-get-1.swift new file mode 100644 index 0000000000..aa0e8b0b5a --- /dev/null +++ b/Task/Variable-size-Get/Swift/variable-size-get-1.swift @@ -0,0 +1 @@ +sizeofValue(x) diff --git a/Task/Variable-size-Get/Swift/variable-size-get-2.swift b/Task/Variable-size-Get/Swift/variable-size-get-2.swift new file mode 100644 index 0000000000..2a1182303b --- /dev/null +++ b/Task/Variable-size-Get/Swift/variable-size-get-2.swift @@ -0,0 +1,9 @@ +// sizeof and sizeofValue return the size in bytes. +println(sizeof(Int)) +var i: Int = 42 +println(sizeofValue(i)) +// The size returned is that of the top level value and does not +// include any referenced data. A type like String always returns +// the same number, the size of the String struct. +println(sizeofValue("Rosetta")) +println(sizeofValue("Code"))} diff --git a/Task/Variable-size-Set/Nim/variable-size-set.nim b/Task/Variable-size-Set/Nim/variable-size-set.nim new file mode 100644 index 0000000000..6368f348a7 --- /dev/null +++ b/Task/Variable-size-Set/Nim/variable-size-set.nim @@ -0,0 +1,4 @@ +var a: int8 = 0 +var b: int16 = 1 +var c: int32 = 10 +var d: int64 = 100 diff --git a/Task/Variables/8th/variables.8th b/Task/Variables/8th/variables.8th new file mode 100644 index 0000000000..bc8ffd1ace --- /dev/null +++ b/Task/Variables/8th/variables.8th @@ -0,0 +1,11 @@ +\ declare a variable which is initialized to the number '0' +var x + +\ declare a variable which is initialized to a string "cat" +"cat" var, y + +\ Get the value in x, add 20 and store it: +x @ 20 n:+ x ! + +\ Change the cat to a dog: +"dog" y ! diff --git a/Task/Variables/Apex/variables.apex b/Task/Variables/Apex/variables.apex new file mode 100644 index 0000000000..075eddc87b --- /dev/null +++ b/Task/Variables/Apex/variables.apex @@ -0,0 +1,15 @@ +// If not initialized at class/member level, it will be set to null +Integer x = 0; +Integer y; // y is null here +Integer p,q,r; // declare multiple variables +Integer i=1,j=2,k=3; // declare and initialize + +/* + * Similar to Integer, below variables can be initialized together separated by ','. +*/ +String s = 'a string'; +Decimal d = 0.0; +Double dbl = 0.0; +Blob blb = Blob.valueOf('Any String'); +Boolean b = true; +AClassName cls = new AClassName(); diff --git a/Task/Variables/Axe/variables-1.axe b/Task/Variables/Axe/variables-1.axe new file mode 100644 index 0000000000..3282a29c5c --- /dev/null +++ b/Task/Variables/Axe/variables-1.axe @@ -0,0 +1 @@ +1→A diff --git a/Task/Variables/Axe/variables-2.axe b/Task/Variables/Axe/variables-2.axe new file mode 100644 index 0000000000..f4be0d5406 --- /dev/null +++ b/Task/Variables/Axe/variables-2.axe @@ -0,0 +1 @@ +#Realloc(L₂) diff --git a/Task/Variables/ChucK/variables-1.chuck b/Task/Variables/ChucK/variables-1.chuck new file mode 100644 index 0000000000..0af7d9b895 --- /dev/null +++ b/Task/Variables/ChucK/variables-1.chuck @@ -0,0 +1 @@ + int a; diff --git a/Task/Variables/ChucK/variables-2.chuck b/Task/Variables/ChucK/variables-2.chuck new file mode 100644 index 0000000000..d597ea6f18 --- /dev/null +++ b/Task/Variables/ChucK/variables-2.chuck @@ -0,0 +1 @@ +int b,c,d; diff --git a/Task/Variables/ChucK/variables-3.chuck b/Task/Variables/ChucK/variables-3.chuck new file mode 100644 index 0000000000..9edfb23765 --- /dev/null +++ b/Task/Variables/ChucK/variables-3.chuck @@ -0,0 +1 @@ +0 => int e; diff --git a/Task/Variables/Lasso/variables.lasso b/Task/Variables/Lasso/variables.lasso new file mode 100644 index 0000000000..0fa0fa1e06 --- /dev/null +++ b/Task/Variables/Lasso/variables.lasso @@ -0,0 +1,41 @@ +// declare thread variable, default type null +var(x) +$x->type // null + +// declare local variable, default type null +local(x) +#x->type // null + +// declare thread variable, initialize with a type, in this case integer +var(x = integer) + +// declare local variable, initialize with a type, in this case integer +local(x = integer) + +// assign a value to the thread var x +$x = 12 + +// assign a value to the local var x +$x = 177 + +// a var always has a data type, even if not declared - then it's null +// a var can either be assigned a type using the name of the type, or a value that is by itself the type +local(y = string) +local(y = 'hello') + +'\r' +// demonstrating asCopyDeep and relationship between variables: +local(original) = array('radish', 'carrot', 'cucumber', 'olive') +local(originalaswell) = #original +local(copy) = #original->asCopyDeep +iterate(#original) => { + loop_value->uppercase +} +#original // modified +//array(RADISH, CARROT, CUCUMBER, OLIVE) +'\r' +#originalaswell // modified as well as it was not a deep copy +//array(RADISH, CARROT, CUCUMBER, OLIVE) +'\r' +#copy // unmodified as it used ascopydeep +//array(RADISH, CARROT, CUCUMBER, OLIVE) diff --git a/Task/Variables/Lingo/variables-1.lingo b/Task/Variables/Lingo/variables-1.lingo new file mode 100644 index 0000000000..1225d8411d --- /dev/null +++ b/Task/Variables/Lingo/variables-1.lingo @@ -0,0 +1,3 @@ +x = 23 +y = "Hello world!" +z = TRUE -- same effect as z = 1 diff --git a/Task/Variables/Lingo/variables-2.lingo b/Task/Variables/Lingo/variables-2.lingo new file mode 100644 index 0000000000..0aca95b749 --- /dev/null +++ b/Task/Variables/Lingo/variables-2.lingo @@ -0,0 +1,3 @@ +on foo + put x +end diff --git a/Task/Variables/Lingo/variables-3.lingo b/Task/Variables/Lingo/variables-3.lingo new file mode 100644 index 0000000000..25387f96bc --- /dev/null +++ b/Task/Variables/Lingo/variables-3.lingo @@ -0,0 +1,2 @@ +put value("x") +-- -- means: undefined diff --git a/Task/Variables/Lingo/variables-4.lingo b/Task/Variables/Lingo/variables-4.lingo new file mode 100644 index 0000000000..9c4daf6a6c --- /dev/null +++ b/Task/Variables/Lingo/variables-4.lingo @@ -0,0 +1,4 @@ +on foo + x = VOID + put x +end diff --git a/Task/Variables/Lingo/variables-5.lingo b/Task/Variables/Lingo/variables-5.lingo new file mode 100644 index 0000000000..a8efe6860c --- /dev/null +++ b/Task/Variables/Lingo/variables-5.lingo @@ -0,0 +1,4 @@ +global x +on foo + put x +end diff --git a/Task/Variables/Lingo/variables-6.lingo b/Task/Variables/Lingo/variables-6.lingo new file mode 100644 index 0000000000..536f95acd9 --- /dev/null +++ b/Task/Variables/Lingo/variables-6.lingo @@ -0,0 +1,4 @@ +on foo + global x + put x +end diff --git a/Task/Variables/Lingo/variables-7.lingo b/Task/Variables/Lingo/variables-7.lingo new file mode 100644 index 0000000000..5bc486850c --- /dev/null +++ b/Task/Variables/Lingo/variables-7.lingo @@ -0,0 +1 @@ +_global.x = 23 diff --git a/Task/Variables/Lingo/variables-8.lingo b/Task/Variables/Lingo/variables-8.lingo new file mode 100644 index 0000000000..3f42114318 --- /dev/null +++ b/Task/Variables/Lingo/variables-8.lingo @@ -0,0 +1 @@ +put _global.x diff --git a/Task/Variables/Nim/variables.nim b/Task/Variables/Nim/variables.nim new file mode 100644 index 0000000000..cb18043d38 --- /dev/null +++ b/Task/Variables/Nim/variables.nim @@ -0,0 +1,11 @@ +var x: int = 3 + +var y = 3 # type inferred to int + +var z: int # initialized to 0 + +let a = 13 # immutable variable + +var + b, c: int = 10 + s = "foobar" diff --git a/Task/Variables/Oforth/variables.oforth b/Task/Variables/Oforth/variables.oforth new file mode 100644 index 0000000000..a281f8be19 --- /dev/null +++ b/Task/Variables/Oforth/variables.oforth @@ -0,0 +1,6 @@ +import: date + +: testVariable +| a b c | + Date now ->a + a println ; diff --git a/Task/Variables/Phix/variables-1.phix b/Task/Variables/Phix/variables-1.phix new file mode 100644 index 0000000000..4fc7e794d8 --- /dev/null +++ b/Task/Variables/Phix/variables-1.phix @@ -0,0 +1,2 @@ +integer x = 25, y = 25, z +object {a, b, c} = {{}, 5, "string"} diff --git a/Task/Variables/Phix/variables-2.phix b/Task/Variables/Phix/variables-2.phix new file mode 100644 index 0000000000..42681c4d7e --- /dev/null +++ b/Task/Variables/Phix/variables-2.phix @@ -0,0 +1,6 @@ +type hour(integer x) + return x >= 0 and x <= 23 +end type +hour h1, h2 +h1 = 10 -- ok +h2 = 25 -- error! program aborts with a message diff --git a/Task/Variables/Pony/variables-1.pony b/Task/Variables/Pony/variables-1.pony new file mode 100644 index 0000000000..442871bba0 --- /dev/null +++ b/Task/Variables/Pony/variables-1.pony @@ -0,0 +1,8 @@ +var counter: I32 = 10 // mutable variable 'counter' with value 10 +let temp: F64 = 36.6 // immutable variable 'temp' +let str: String // immutable variable 'str' with no initial value +str = "i am a string" // variables must be initialized before use +let another_str = "i am another string" // type of variable 'another_str' infered from assigned value + +let b = true +let b' = false // variable names can contain ' to make a distinct variable with almost the same name diff --git a/Task/Variables/Pony/variables-2.pony b/Task/Variables/Pony/variables-2.pony new file mode 100644 index 0000000000..7fa0c94806 --- /dev/null +++ b/Task/Variables/Pony/variables-2.pony @@ -0,0 +1,6 @@ +var x: I32 = 10 +var y: I32 = x = 20 +try + Fact(x == 20) // x gets the new value of 20 + Fact(y == 10) // y gets the old value of x which is 10 +end diff --git a/Task/Variables/Ring/variables-1.ring b/Task/Variables/Ring/variables-1.ring new file mode 100644 index 0000000000..925b22b404 --- /dev/null +++ b/Task/Variables/Ring/variables-1.ring @@ -0,0 +1 @@ + = diff --git a/Task/Variables/Ring/variables-2.ring b/Task/Variables/Ring/variables-2.ring new file mode 100644 index 0000000000..b77c0963a4 --- /dev/null +++ b/Task/Variables/Ring/variables-2.ring @@ -0,0 +1,16 @@ +x = "Hello" # x is a string +see x + nl +x = 5 # x is a number (int) +see x + nl +x = 1.2 # x is a number (double) +see x + nl +x = [1,2,3,4] # x is a list +see x # print list items +x = date() # x is a string contains date +see x + nl +x = time() # x is a string contains time +see x + nl +x = true # x is a number (logical value = 1) +see x + nl +x = false # x is a number (logical value = 0) +see x + nl diff --git a/Task/Variables/Ring/variables-3.ring b/Task/Variables/Ring/variables-3.ring new file mode 100644 index 0000000000..b13046a205 --- /dev/null +++ b/Task/Variables/Ring/variables-3.ring @@ -0,0 +1,6 @@ +list = [1,2,3,"four","five"] +list2 = list +list = [] +See list # print the first list - no items to print +See "********" + nl +See list2 # print the second list - contains 5 items diff --git a/Task/Variables/Ring/variables-4.ring b/Task/Variables/Ring/variables-4.ring new file mode 100644 index 0000000000..c88a0701ad --- /dev/null +++ b/Task/Variables/Ring/variables-4.ring @@ -0,0 +1,2 @@ + + --> + + --> diff --git a/Task/Variables/Ring/variables-5.ring b/Task/Variables/Ring/variables-5.ring new file mode 100644 index 0000000000..f244808f0e --- /dev/null +++ b/Task/Variables/Ring/variables-5.ring @@ -0,0 +1,5 @@ +x = 10 # x is a number +y = "20" # y is a string +sum = x + y # sum is a number (y will be converted to a number) +Msg = "Sum = " + sum # Msg is a string (sum will be converted to a string) +see Msg + nl diff --git a/Task/Variables/Set-lang/variables.set b/Task/Variables/Set-lang/variables.set new file mode 100644 index 0000000000..3b1c556be1 --- /dev/null +++ b/Task/Variables/Set-lang/variables.set @@ -0,0 +1,11 @@ +set a 0 > Useless intialization - All lowercase variables have an initial value of 0 +set b 66 > Simple variable assignment - ''b'' is now the ASCII value of 66, or the character 'B' +[c=0] set c 5 > Conditional variable assignment - If ''c'' is 0, then set ''c'' to 5 +set ? 6 > A "goto" command; Setting the ''?'' variable defines the line of code to be executed next +set z 1 > This line of code will never be executed, because the previous skipped it +set c 10 > Line #5 skipped to here +set d A > Assigning a variable to another variable - ''d'' is now ASCII 65, or the character 'A' +set b ! > The ''!'' deals with I/O. Setting a variable to it receives an input character and assigns it to the variable +set ! a > Setting the exclamation point to a variable outputs that variable +set e (d+1) > Combiners are defined inside round brackets - () - and have an addition and a subtraction function +set f (e-1) > Variable ''e'' was assigned to ''d'' + 1 (65 + 1 = 66, character B), and ''f'' was assigned to ''e'' - 1 (66 - 1 = 65, character A) diff --git a/Task/Variables/Swift/variables.swift b/Task/Variables/Swift/variables.swift new file mode 100644 index 0000000000..7f33ce05ea --- /dev/null +++ b/Task/Variables/Swift/variables.swift @@ -0,0 +1,71 @@ +import Foundation + +// All variables declared outside of a struct/class/etc are global + +// Swift is a typed language +// Swift can infer the type of variables +var str = "Hello, playground" // String +let letStr:String = "This is a constant" + +// However, all variables must be initialized +// Intialize variable of type String to nil +var str1:String! // str1 is nil + +// Assign value to str1 +str1 = "foo bar" // str1 is foo bar + +// Swift also has optional types +// Declare optional with type of String +var optionalString = Optional("foo bar") // (Some "foo bar") + +println(optionalString) // Optional("foo bar") + +// Optionals can also be declared with the shorthand ? +var optionalString1:String? = "foo bar" + +// ! can be used to force unwrap but will throw a runtime error if trying to unwrap a nil value +println(optionalString1!) + +optionalString1 = nil // Is now nil +// println(optionalString1!) would now throw a runtime error + +// Optional chaining can be used to gracefully fail if there is a nil value +if let value = optionalString1?.lowercaseString { + // Is never executed +} else { + println("optionalString1 is nil") +} + +// Swift also has type aliasing +typealias MyNewType = String // MyNewType is an alias of String +var myNewTypeString = MyNewType("foo bar") + +// Swift also has special types Any and AnyObject +// Any can hold any type +// AnyObject can hold any object type +let myAnyObjectString:AnyObject = "foo bar" + +// Downcast myAnyObjectString to String +if let myString = myAnyObjectString as? String { + println(myString) // foo bar +} else { + println("myString is not a string") +} + +// Swift treats functions as first-class +// Declare a variable with a type of a function that takes no args +// and returns Void +var myFunc:(() -> Void) +func showScopes() { + // Variable is scoped to function + let myFunctionVariable = "foo bar function" + + // Nested functions inherit variables declared in enclosing scope + func nestFunc() { + println(myFunctionVariable) + } + nestFunc() +} + +myFunc = showScopes // myFunc is now showScopes +myFunc() // foo bar function diff --git a/Task/Variables/Ursa/variables.ursa b/Task/Variables/Ursa/variables.ursa new file mode 100644 index 0000000000..96c4fa4107 --- /dev/null +++ b/Task/Variables/Ursa/variables.ursa @@ -0,0 +1,43 @@ +# variable declaration +# +# declare [type] [name] +# -or- +# decl [type] [name] +decl int test + +# initialization / assignment +# +# the set statement can be used to init variables and +# assign values to them +set test 10 + +# datatypes +# +# ursa currently has 10 built-in types, but +# more may be added in the future. +# boolean +# double +# file +# function +# int +# iodevice +# port +# serverport +# string +# task +# +# also, java classes may be used as data types +# cygnus/x ursa + +# scope +# +# there is a global variable space, and functions +# have their own scope. control statements (for, +# if, try, while) don't have their own scope yet, +# but this will be implemented in the near future + +# referencing +# +# variables are referenced by their name +decl port p +out p endl console diff --git a/Task/Variables/jq/variables-1.jq b/Task/Variables/jq/variables-1.jq new file mode 100644 index 0000000000..dbacf9905e --- /dev/null +++ b/Task/Variables/jq/variables-1.jq @@ -0,0 +1 @@ +jq -n '1 as $x | (2 as $x | $x) | $x' diff --git a/Task/Variables/jq/variables-2.jq b/Task/Variables/jq/variables-2.jq new file mode 100644 index 0000000000..8b544fa4b9 --- /dev/null +++ b/Task/Variables/jq/variables-2.jq @@ -0,0 +1 @@ +EXPRESSION as $NAME diff --git a/Task/Variables/jq/variables-3.jq b/Task/Variables/jq/variables-3.jq new file mode 100644 index 0000000000..a14741d118 --- /dev/null +++ b/Task/Variables/jq/variables-3.jq @@ -0,0 +1,2 @@ +def test: $x; +test diff --git a/Task/Variables/jq/variables-4.jq b/Task/Variables/jq/variables-4.jq new file mode 100644 index 0000000000..4a71bec411 --- /dev/null +++ b/Task/Variables/jq/variables-4.jq @@ -0,0 +1 @@ +jq --arg x 123 -n -f test.jq diff --git a/Task/Variadic-function/Lasso/variadic-function-1.lasso b/Task/Variadic-function/Lasso/variadic-function-1.lasso new file mode 100644 index 0000000000..62d2e0f6bb --- /dev/null +++ b/Task/Variadic-function/Lasso/variadic-function-1.lasso @@ -0,0 +1,5 @@ +define printArgs(...items) => stdoutnl(#items) +define printEachArg(...) => with i in #rest do stdoutnl(#i) + +printArgs('a', 2, (:3)) +printEachArg('a', 2, (:3)) diff --git a/Task/Variadic-function/Lasso/variadic-function-2.lasso b/Task/Variadic-function/Lasso/variadic-function-2.lasso new file mode 100644 index 0000000000..1de51d0956 --- /dev/null +++ b/Task/Variadic-function/Lasso/variadic-function-2.lasso @@ -0,0 +1,2 @@ +local(args = (:"Rosetta", "Code", "Is", "Awesome!")) +printEachArg(:#args) diff --git a/Task/Variadic-function/Lasso/variadic-function-3.lasso b/Task/Variadic-function/Lasso/variadic-function-3.lasso new file mode 100644 index 0000000000..546819f769 --- /dev/null +++ b/Task/Variadic-function/Lasso/variadic-function-3.lasso @@ -0,0 +1,8 @@ +staticarray(a, 2, staticarray(3)) +a +2 +staticarray(3) +Rosetta +Code +Is +Awesome! diff --git a/Task/Variadic-function/Nim/variadic-function-1.nim b/Task/Variadic-function/Nim/variadic-function-1.nim new file mode 100644 index 0000000000..3a20cde1e3 --- /dev/null +++ b/Task/Variadic-function/Nim/variadic-function-1.nim @@ -0,0 +1,3 @@ +proc print(xs: varargs[string, `$`]) = + for x in xs: + echo x diff --git a/Task/Variadic-function/Nim/variadic-function-2.nim b/Task/Variadic-function/Nim/variadic-function-2.nim new file mode 100644 index 0000000000..eb516b1db7 --- /dev/null +++ b/Task/Variadic-function/Nim/variadic-function-2.nim @@ -0,0 +1,6 @@ +print(12, "Rosetta", "Code", 15.54321) + +print 12, "Rosetta", "Code", 15.54321, "is", "awesome!" + +let args = @["12", "Rosetta", "Code", "15.54321"] +print(args) diff --git a/Task/Variadic-function/Oforth/variadic-function.oforth b/Task/Variadic-function/Oforth/variadic-function.oforth new file mode 100644 index 0000000000..68c4b0943b --- /dev/null +++ b/Task/Variadic-function/Oforth/variadic-function.oforth @@ -0,0 +1 @@ +: sumNum(n) | i | 0 n loop: i [ + ] ; diff --git a/Task/Variadic-function/Phix/variadic-function.phix b/Task/Variadic-function/Phix/variadic-function.phix new file mode 100644 index 0000000000..8e36691b73 --- /dev/null +++ b/Task/Variadic-function/Phix/variadic-function.phix @@ -0,0 +1,6 @@ +procedure print_args(sequence args) + for i=1 to length(args) do + ?args[i] + end for +end procedure +print_args({"Mary", "had", "a", "little", "lamb"}) diff --git a/Task/Variadic-function/Sidef/variadic-function-1.sidef b/Task/Variadic-function/Sidef/variadic-function-1.sidef new file mode 100644 index 0000000000..28c53bc3dc --- /dev/null +++ b/Task/Variadic-function/Sidef/variadic-function-1.sidef @@ -0,0 +1,3 @@ +func print_all(*things) { + things.each { |x| say x }; +} diff --git a/Task/Variadic-function/Sidef/variadic-function-2.sidef b/Task/Variadic-function/Sidef/variadic-function-2.sidef new file mode 100644 index 0000000000..15edc90e44 --- /dev/null +++ b/Task/Variadic-function/Sidef/variadic-function-2.sidef @@ -0,0 +1,3 @@ +print_all(4, 3, 5, 6, 4, 3); +print_all(4, 3, 5); +print_all("Rosetta", "Code", "Is", "Awesome!"); diff --git a/Task/Variadic-function/Sidef/variadic-function-3.sidef b/Task/Variadic-function/Sidef/variadic-function-3.sidef new file mode 100644 index 0000000000..880089dcf0 --- /dev/null +++ b/Task/Variadic-function/Sidef/variadic-function-3.sidef @@ -0,0 +1,2 @@ +var args = ["Rosetta", "Code", "Is", "Awesome!"]; +print_all(args...); diff --git a/Task/Variadic-function/Swift/variadic-function-1.swift b/Task/Variadic-function/Swift/variadic-function-1.swift new file mode 100644 index 0000000000..a421efe996 --- /dev/null +++ b/Task/Variadic-function/Swift/variadic-function-1.swift @@ -0,0 +1,6 @@ +func printAll(things: T...) { + // "things" is a [T] + for i in things { + print(i) + } +} diff --git a/Task/Variadic-function/Swift/variadic-function-2.swift b/Task/Variadic-function/Swift/variadic-function-2.swift new file mode 100644 index 0000000000..b74f49779f --- /dev/null +++ b/Task/Variadic-function/Swift/variadic-function-2.swift @@ -0,0 +1,3 @@ +printAll(4, 3, 5, 6, 4, 3) +printAll(4, 3, 5) +printAll("Rosetta", "Code", "Is", "Awesome!") diff --git a/Task/Variadic-function/XLISP/variadic-function.xlisp b/Task/Variadic-function/XLISP/variadic-function.xlisp new file mode 100644 index 0000000000..c3776842f9 --- /dev/null +++ b/Task/Variadic-function/XLISP/variadic-function.xlisp @@ -0,0 +1,14 @@ +(defun print-on-separate-lines (&rest xs) + (for-each print xs)) + +; test the function: + +(print-on-separate-lines 'i 'am 'doing 'a 'great 'work 'so 'that 'i 'cannot 'come 'down) + +; to use it on a list of arguments assembled at run time, first create your list + +(define test '(why should the work cease whilst i leave it and come down to you)) + +; and then call APPLY: + +(apply print-on-separate-lines test) diff --git a/Task/Variadic-function/jq/variadic-function-1.jq b/Task/Variadic-function/jq/variadic-function-1.jq new file mode 100644 index 0000000000..ca6d946221 --- /dev/null +++ b/Task/Variadic-function/jq/variadic-function-1.jq @@ -0,0 +1 @@ +def demo: .[]; diff --git a/Task/Variadic-function/jq/variadic-function-2.jq b/Task/Variadic-function/jq/variadic-function-2.jq new file mode 100644 index 0000000000..fb8a08f0e8 --- /dev/null +++ b/Task/Variadic-function/jq/variadic-function-2.jq @@ -0,0 +1 @@ +args | demo diff --git a/Task/Variadic-function/jq/variadic-function-3.jq b/Task/Variadic-function/jq/variadic-function-3.jq new file mode 100644 index 0000000000..14ddb4e3c9 --- /dev/null +++ b/Task/Variadic-function/jq/variadic-function-3.jq @@ -0,0 +1 @@ +["cheese"] + [3.14] + [[range(0;3)]] | demo diff --git a/Task/Variadic-function/jq/variadic-function-4.jq b/Task/Variadic-function/jq/variadic-function-4.jq new file mode 100644 index 0000000000..5ab99d341b --- /dev/null +++ b/Task/Variadic-function/jq/variadic-function-4.jq @@ -0,0 +1,3 @@ +"cheese" +3.14 +[0,1,2] diff --git a/Task/Variadic-function/jq/variadic-function-5.jq b/Task/Variadic-function/jq/variadic-function-5.jq new file mode 100644 index 0000000000..fdd0332b5a --- /dev/null +++ b/Task/Variadic-function/jq/variadic-function-5.jq @@ -0,0 +1,13 @@ +# arity-0: +def f: "I have no arguments"; + +# arity-1: +def f(a1): a1; + +# arity-1: +def f(a1;a2): a1,a2; + +def f(a1;a2;a3): a1,a2,a3; + +# Example: +f, f(1), f(2;3), f(4;5;6) diff --git a/Task/Variadic-function/jq/variadic-function-6.jq b/Task/Variadic-function/jq/variadic-function-6.jq new file mode 100644 index 0000000000..b414108e81 --- /dev/null +++ b/Task/Variadic-function/jq/variadic-function-6.jq @@ -0,0 +1,6 @@ +1 +2 +3 +4 +5 +6 diff --git a/Task/Vector-products/ERRE/vector-products.erre b/Task/Vector-products/ERRE/vector-products.erre new file mode 100644 index 0000000000..80a7f0e653 --- /dev/null +++ b/Task/Vector-products/ERRE/vector-products.erre @@ -0,0 +1,57 @@ +PROGRAM VECTORPRODUCT + +!$DOUBLE + +TYPE TVECTOR=(X,Y,Z) + +DIM A:TVECTOR,B:TVECTOR,C:TVECTOR + +DIM AA:TVECTOR,BB:TVECTOR,CC:TVECTOR +DIM DD:TVECTOR,EE:TVECTOR,FF:TVECTOR + +PROCEDURE DOTPRODUCT(DD.,EE.->DOTP) + DOTP=DD.X*EE.X+DD.Y*EE.Y+DD.Z*EE.Z +END PROCEDURE + +PROCEDURE CROSSPRODUCT(DD.,EE.->FF.) + FF.X=DD.Y*EE.Z-DD.Z*EE.Y + FF.Y=DD.Z*EE.X-DD.X*EE.Z + FF.Z=DD.X*EE.Y-DD.Y*EE.X +END PROCEDURE + +PROCEDURE SCALARTRIPLEPRODUCT(AA.,BB.,CC.->SCALARTP) + CROSSPRODUCT(BB.,CC.->FF.) + DOTPRODUCT(AA.,FF.->SCALARTP) +END PROCEDURE + +PROCEDURE VECTORTRIPLEPRODUCT(AA.,BB.,CC.->FF.) + CROSSPRODUCT(BB.,CC.->FF.) + CROSSPRODUCT(AA.,FF.->FF.) +END PROCEDURE + +PROCEDURE PRINTVECTOR(AA.) + PRINT("(";AA.X;",";AA.Y;",";AA.Z;")") +END PROCEDURE + +BEGIN + A.X=3 A.Y=4 A.Z=5 + B.X=4 B.Y=3 B.Z=5 + C.X=-5 C.Y=-12 C.Z=-13 + + PRINT("A: ";) PRINTVECTOR(A.) + PRINT("B: ";) PRINTVECTOR(B.) + PRINT("C: ";) PRINTVECTOR(C.) + + PRINT + DOTPRODUCT(A.,B.->DOTP) + PRINT("A.B =";DOTP) + + CROSSPRODUCT(A.,B.->FF.) + PRINT("AxB =";) PRINTVECTOR(FF.) + + SCALARTRIPLEPRODUCT(A.,B.,C.->SCALARTP) + PRINT("A.(BxC)=";SCALARTP) + + VECTORTRIPLEPRODUCT(A.,B.,C.->FF.) + PRINT("Ax(BxC)=";) PRINTVECTOR(FF.) +END PROGRAM diff --git a/Task/Vector-products/EchoLisp/vector-products.echolisp b/Task/Vector-products/EchoLisp/vector-products.echolisp new file mode 100644 index 0000000000..05fc95cb17 --- /dev/null +++ b/Task/Vector-products/EchoLisp/vector-products.echolisp @@ -0,0 +1,20 @@ +(lib 'math) + +(define (scalar-triple-product a b c) + (dot-product a (cross-product b c))) + +(define (vector-triple-product a b c) + (cross-product a (cross-product b c))) + +(define a #(3 4 5)) +(define b #(4 3 5)) +(define c #(-5 -12 -13)) + +(cross-product a b) + → #( 5 5 -7) +(dot-product a b) + → 49 +(scalar-triple-product a b c) + → 6 +(vector-triple-product a b c) + → #( -267 204 -3) diff --git a/Task/Vector-products/FreeBASIC/vector-products.freebasic b/Task/Vector-products/FreeBASIC/vector-products.freebasic new file mode 100644 index 0000000000..aea1511a47 --- /dev/null +++ b/Task/Vector-products/FreeBASIC/vector-products.freebasic @@ -0,0 +1,32 @@ + 'Construct only required operators for this. +Type V3 + As double x,y,z + declare operator cast() as string +End Type +#define dot * +#define cross ^ +#define Show(t1,t) ? #t1;tab(22);t + +operator V3.cast() as string +return "("+str(x)+","+str(y)+","+str(z)+")" +end operator + +Operator dot(v1 As v3,v2 As v3) As double +Return v1.x*v2.x+v1.y*v2.y+v1.z*v2.z +End Operator + +Operator cross(v1 As v3,v2 As v3) As v3 +Return type(v1.y*v2.z-v2.y*v1.z,-(v1.x*v2.z-v2.x*v1.z),v1.x*v2.y-v2.x*v1.y) +End Operator + +dim as V3 a = (3, 4, 5), b = (4, 3, 5), c = (-5, -12, -13) + +Show(a,a) +Show(b,b) +Show(c,c) +? +Show(a . b,a dot b) +Show(a X b,a cross b) +Show(a . b X c,a dot b cross c) +Show(a X (b X c),a cross (b cross c)) +sleep diff --git a/Task/Vector-products/FunL/vector-products.funl b/Task/Vector-products/FunL/vector-products.funl new file mode 100644 index 0000000000..4168a103a1 --- /dev/null +++ b/Task/Vector-products/FunL/vector-products.funl @@ -0,0 +1,13 @@ +A = (3, 4, 5) +B = (4, 3, 5) +C = (-5, -12, -13) + +def dot( u, v ) = sum( u(i)v(i) | i <- 0:u.>length() ) +def cross( u, v ) = (u(1)v(2) - u(2)v(1), u(2)v(0) - u(0)v(2), u(0)v(1) - u(1)v(0) ) +def scalarTriple( u, v, w ) = dot( u, cross(v, w) ) +def vectorTriple( u, v, w ) = cross( u, cross(v, w) ) + +println( "A\u00b7B = ${dot(A, B)}" ) +println( "A\u00d7B = ${cross(A, B)}" ) +println( "A\u00b7(B\u00d7C) = ${scalarTriple(A, B, C)}" ) +println( "A\u00d7(B\u00d7C) = ${vectorTriple(A, B, C)}" ) diff --git a/Task/Vector-products/Lingo/vector-products.lingo b/Task/Vector-products/Lingo/vector-products.lingo new file mode 100644 index 0000000000..221d7bcd4d --- /dev/null +++ b/Task/Vector-products/Lingo/vector-products.lingo @@ -0,0 +1,11 @@ +a = vector(1,2,3) +b = vector(4,5,6) + +put a * b +-- 32.0000 + +put a.dot(b) +-- 32.0000 + +put a.cross(b) +-- vector( -3.0000, 6.0000, -3.0000 ) diff --git a/Task/Vector-products/Nim/vector-products.nim b/Task/Vector-products/Nim/vector-products.nim new file mode 100644 index 0000000000..ee6015b7f5 --- /dev/null +++ b/Task/Vector-products/Nim/vector-products.nim @@ -0,0 +1,33 @@ +import strutils + +type Vector3 = array[1..3, float] + +proc `$`(a: Vector3): string = + result = "[" + + for i, x in a: + if i > a.low: + result.add ", " + result.add formatFloat(x, precision = 0) + + result.add "]" + +proc `~⨯`(a, b: Vector3): Vector3 = + result = [a[2]*b[3] - a[3]*b[2], a[3]*b[1] - a[1]*b[3], a[1]*b[2] - a[2]*b[1]] + +proc `~•`[T](a, b: T): float = + for i in a.low..a.high: + result += a[i] * b[i] + +proc scalartrip(a, b, c: Vector3): float = a ~• (b ~⨯ c) + +proc vectortrip(a, b, c: Vector3): Vector3 = a ~⨯ (b ~⨯ c) + +let + a = [3.0, 4.0, 5.0] + b = [4.0, 3.0, 5.0] + c = [-5.0, -12.0, -13.0] +echo "a ⨯ b = ", a ~⨯ b +echo "a • b = ", (a ~• b).formatFloat(precision = 0) +echo "a . (b ⨯ c) = ", (scalartrip(a, b, c)).formatFloat(precision = 0) +echo "a ⨯ (b ⨯ c) = ", vectortrip(a, b, c) diff --git a/Task/Vector-products/Phix/vector-products.phix b/Task/Vector-products/Phix/vector-products.phix new file mode 100644 index 0000000000..46b851ed38 --- /dev/null +++ b/Task/Vector-products/Phix/vector-products.phix @@ -0,0 +1,23 @@ +function dot_product(sequence a, b) + return sum(sq_mul(a,b)) +end function + +function cross_product(sequence a, b) +integer {a1,a2,a3} = a, {b1,b2,b3} = b + return {a2*b3-a3*b2, a3*b1-a1*b3, a1*b2-a2*b1} +end function + +function scalar_triple_product(sequence a, b, c) + return dot_product(a,cross_product(b,c)) +end function + +function vector_triple_product(sequence a, b, c) + return cross_product(a,cross_product(b,c)) +end function + +constant a = {3, 4, 5}, b = {4, 3, 5}, c = {-5, -12, -13} + +puts(1," a . b = ") ?dot_product(a,b) +puts(1," a x b = ") ?cross_product(a,b) +puts(1,"a . (b x c) = ") ?scalar_triple_product(a,b,c) +puts(1,"a x (b x c) = ") ?vector_triple_product(a,b,c) diff --git a/Task/Vector-products/Sidef/vector-products.sidef b/Task/Vector-products/Sidef/vector-products.sidef new file mode 100644 index 0000000000..f56c5f0305 --- /dev/null +++ b/Task/Vector-products/Sidef/vector-products.sidef @@ -0,0 +1,25 @@ +class Vector(x, y, z) { + method ∙(vec) { + [self{:x,:y,:z}] »*« [vec{:x,:y,:z}] «+»; + } + + method ⨉(vec) { + Vector(self.y*vec.z - self.z*vec.y, + self.z*vec.x - self.x*vec.z, + self.x*vec.y - self.y*vec.x); + } + + method to_s { + "(#{x}, #{y}, #{z})"; + } +} + +var a = Vector(3, 4, 5); +var b = Vector(4, 3, 5); +var c = Vector(-5, -12, -13); + +say "a=#{a}; b=#{b}; c=#{c};"; +say "a ∙ b = #{a ∙ b}"; +say "a ⨉ b = #{a ⨉ b}"; +say "a ∙ (b ⨉ c) = #{a ∙ (b ⨉ c)}"; +say "a ⨉ (b ⨉ c) = #{a ⨉ (b ⨉ c)}"; diff --git a/Task/Vector-products/Wortel/vector-products.wortel b/Task/Vector-products/Wortel/vector-products.wortel new file mode 100644 index 0000000000..9397daf710 --- /dev/null +++ b/Task/Vector-products/Wortel/vector-products.wortel @@ -0,0 +1,21 @@ +@let { + dot &[a b] @sum @mapm ^* [a b] + cross &[a b] [[ + -*a.1 b.2 *a.2 b.1 + -*a.2 b.0 *a.0 b.2 + -*a.0 b.1 *a.1 b.0 + ]] + scalarTripleProduct &[a b c] !!dot a !!cross b c + vectorTripleProduct &[a b c] !!cross a !!cross b c + + a [3 4 5] + b [4 3 5] + c [5N 12N 13N] + + [[ + !!dot a b + !!cross a b + @!scalarTripleProduct [a b c] + @!vectorTripleProduct [a b c] + ]] +} diff --git a/Task/Vector-products/jq/vector-products-1.jq b/Task/Vector-products/jq/vector-products-1.jq new file mode 100644 index 0000000000..3c2194663c --- /dev/null +++ b/Task/Vector-products/jq/vector-products-1.jq @@ -0,0 +1,21 @@ +def dot_product(a; b): + reduce range(0;a|length) as $i (0; . + (a[$i] * b[$i]) ); + +# for 3d vectors +def cross_product(a;b): + [ a[1]*b[2] - a[2]*b[1], a[2]*b[0] - a[0]*b[2], a[0]*b[1]-a[1]*b[0] ]; + +def scalar_triple_product(a;b;c): + dot_product(a; cross_product(b; c)); + +def vector_triple_product(a;b;c): + cross_product(a; cross_product(b; c)); + +def main: + [3, 4, 5] as $a + | [4, 3, 5] as $b + | [-5, -12, -13] as $c + | "a . b = \(dot_product($a; $b))", + "a x b = [\( cross_product($a; $b) | map(tostring) | join (", ") )]" , + "a . (b x c) = \( scalar_triple_product ($a; $b; $c)) )", + "a x (b x c) = [\( vector_triple_product($a; $b; $c)|map(tostring)|join (", ") )]" ; diff --git a/Task/Vector-products/jq/vector-products-2.jq b/Task/Vector-products/jq/vector-products-2.jq new file mode 100644 index 0000000000..ba1fd7f965 --- /dev/null +++ b/Task/Vector-products/jq/vector-products-2.jq @@ -0,0 +1,4 @@ +"a . b = 49" +"a x b = [5, 5, -7]" +"a . (b x c) = 6 )" +"a x (b x c) = [-267, 204, -3]" diff --git a/Task/Verify-distribution-uniformity-Chi-squared-test/Hy/verify-distribution-uniformity-chi-squared-test-1.hy b/Task/Verify-distribution-uniformity-Chi-squared-test/Hy/verify-distribution-uniformity-chi-squared-test-1.hy new file mode 100644 index 0000000000..3db1732787 --- /dev/null +++ b/Task/Verify-distribution-uniformity-Chi-squared-test/Hy/verify-distribution-uniformity-chi-squared-test-1.hy @@ -0,0 +1,11 @@ +(import + [scipy.stats [chisquare]] + [collections [Counter]]) + +(defn uniform? [f repeats &optional [alpha .05]] + "Call 'f' 'repeats' times and do a chi-squared test for uniformity + of the resulting discrete distribution. Return false iff the + null hypothesis of uniformity is rejected for the test with + size 'alpha'." + (<= alpha (second (chisquare + (.values (Counter (take repeats (repeatedly f)))))))) diff --git a/Task/Verify-distribution-uniformity-Chi-squared-test/Hy/verify-distribution-uniformity-chi-squared-test-2.hy b/Task/Verify-distribution-uniformity-Chi-squared-test/Hy/verify-distribution-uniformity-chi-squared-test-2.hy new file mode 100644 index 0000000000..d57edccf8c --- /dev/null +++ b/Task/Verify-distribution-uniformity-Chi-squared-test/Hy/verify-distribution-uniformity-chi-squared-test-2.hy @@ -0,0 +1,6 @@ +(import [random [randint]]) + +(for [f [ + (fn [] (randint 1 10)) + (fn [] (if (randint 0 1) (randint 1 9) (randint 1 10)))]] + (print (uniform? f 5000))) diff --git a/Task/Verify-distribution-uniformity-Naive/Hy/verify-distribution-uniformity-naive-1.hy b/Task/Verify-distribution-uniformity-Naive/Hy/verify-distribution-uniformity-naive-1.hy new file mode 100644 index 0000000000..cff6f65ee3 --- /dev/null +++ b/Task/Verify-distribution-uniformity-Naive/Hy/verify-distribution-uniformity-naive-1.hy @@ -0,0 +1,12 @@ +(import [collections [Counter]]) +(import [random [randint]]) + +(defn uniform? [f repeats delta] +; Call 'f' 'repeats' times, then check if the proportion of each +; value seen is within 'delta' of the reciprocal of the count +; of distinct values. + (setv bins (Counter (list-comp (f) [i (range repeats)]))) + (setv target (/ 1 (len bins))) + (all (list-comp + (<= (- target delta) (/ n repeats) (+ target delta)) + [n (.values bins)]))) diff --git a/Task/Verify-distribution-uniformity-Naive/Hy/verify-distribution-uniformity-naive-2.hy b/Task/Verify-distribution-uniformity-Naive/Hy/verify-distribution-uniformity-naive-2.hy new file mode 100644 index 0000000000..d8a4f11bbd --- /dev/null +++ b/Task/Verify-distribution-uniformity-Naive/Hy/verify-distribution-uniformity-naive-2.hy @@ -0,0 +1,4 @@ +(for [f [ + (fn [] (randint 1 10)) + (fn [] (if (randint 0 1) (randint 1 9) (randint 1 10)))]] + (print (uniform? f 5000 .02))) diff --git a/Task/Vigen-re-cipher/Nim/vigen-re-cipher.nim b/Task/Vigen-re-cipher/Nim/vigen-re-cipher.nim new file mode 100644 index 0000000000..4d86154caf --- /dev/null +++ b/Task/Vigen-re-cipher/Nim/vigen-re-cipher.nim @@ -0,0 +1,28 @@ +import strutils + +proc isAlpha(c): bool = c in 'a'..'z' or c in 'A'..'Z' + +proc encrypt(msg, key): string = + result = "" + var pos = 0 + for c in msg: + if isAlpha c: + result.add chr(((ord(key[pos]) + ord(toUpper c)) mod 26) + ord('A')) + pos = (pos + 1) mod key.len + +proc decrypt(msg, key): string = + result = "" + var pos = 0 + for c in msg: + result.add chr(((26 + ord(c) - ord(key[pos])) mod 26) + ord('A')) + pos = (pos + 1) mod key.len + +const text = "Beware the Jabberwock, my son! The jaws that bite, the claws that catch!" +const key = "VIGENERECIPHER" + +let encr = encrypt(text, key) +let decr = decrypt(encr, key) + +echo text +echo encr +echo decr diff --git a/Task/Vigen-re-cipher/Sidef/vigen-re-cipher.sidef b/Task/Vigen-re-cipher/Sidef/vigen-re-cipher.sidef new file mode 100644 index 0000000000..c3428624ed --- /dev/null +++ b/Task/Vigen-re-cipher/Sidef/vigen-re-cipher.sidef @@ -0,0 +1,12 @@ +func s2v(s) { s.uc.scan(/[A-Z]/)»ord»() »-» 65 }; +func v2s(v) { (v »%» 26 »+» 65)»chr»().join }; + +func blacken (red, key) { v2s(s2v(red) »+« s2v(key)) }; +func redden (blk, key) { v2s(s2v(blk) »-« s2v(key)) }; + +var red = "Beware the Jabberwock, my son! The jaws that bite, the claws that catch!"; +var key = "Vigenere Cipher!!!"; + +say red; +say (var black = blacken(red, key)); +say redden(black, key); diff --git a/Task/Vigen-re-cipher/TypeScript/vigen-re-cipher.type b/Task/Vigen-re-cipher/TypeScript/vigen-re-cipher.type new file mode 100644 index 0000000000..557626faf0 --- /dev/null +++ b/Task/Vigen-re-cipher/TypeScript/vigen-re-cipher.type @@ -0,0 +1,47 @@ +class Vigenere { + + key: string + + /** Create new cipher based on key */ + constructor(key: string) { + this.key = Vigenere.formatText(key) + } + + /** Enrypt a given text using key */ + encrypt(plainText: string): string { + return Array.prototype.map.call(Vigenere.formatText(plainText), (letter: string, index: number): string => { + return String.fromCharCode((letter.charCodeAt(0) + this.key.charCodeAt(index % this.key.length) - 130) % 26 + 65) + }).join('') + } + + /** Decrypt ciphertext based on key */ + decrypt(cipherText: string): string { + return Array.prototype.map.call(Vigenere.formatText(cipherText), (letter: string, index: number): string => { + return String.fromCharCode((letter.charCodeAt(0) - this.key.charCodeAt(index % this.key.length) + 26) % 26 + 65) + }).join('') + } + + /** Converts to uppercase and removes non characters */ + private static formatText(text: string): string { + return text.toUpperCase().replace(/[^A-Z]/g, "") + } + +} + +/** Example usage */ +(() => { + let original: string = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book." + + console.log(`Original: ${original}`) + + let vig: Vigenere = new Vigenere("vigenere") + + let encoded: string = vig.encrypt(original) + + console.log(`After encryption: ${encoded}`) + + let back: string = vig.decrypt(encoded) + + console.log(`After decryption: ${back}`) + +})() diff --git a/Task/Visualize-a-tree/Lingo/visualize-a-tree-1.lingo b/Task/Visualize-a-tree/Lingo/visualize-a-tree-1.lingo new file mode 100644 index 0000000000..4faa69aecd --- /dev/null +++ b/Task/Visualize-a-tree/Lingo/visualize-a-tree-1.lingo @@ -0,0 +1,25 @@ +-- parent script "TreeItem" +-- (minimal implementation with direct property access) + +property name +property children + +on new (me, itemName) + me.name = itemName + me.children = [] + return me +end + +on addChild (me, child) + me.children.add(child) +end + +-- print a tree +on printTree (me, treeItem, indent) + if voidP(treeItem) then treeItem = me + if voidP(indent) then indent = "" + put indent&treeItem.name + repeat with c in treeItem.children + me.printTree(c, indent&" ") + end repeat +end diff --git a/Task/Visualize-a-tree/Lingo/visualize-a-tree-2.lingo b/Task/Visualize-a-tree/Lingo/visualize-a-tree-2.lingo new file mode 100644 index 0000000000..609b505cb9 --- /dev/null +++ b/Task/Visualize-a-tree/Lingo/visualize-a-tree-2.lingo @@ -0,0 +1,17 @@ +-- create a tree +root = script("TreeItem").new("root") +a = script("TreeItem").new("a") +root.addChild(a) +b = script("TreeItem").new("b") +root.addChild(b) +a1 = script("TreeItem").new("a1") +a.addChild(a1) +a11 = script("TreeItem").new("a11") +a1.addChild(a11) +a12 = script("TreeItem").new("a12") +a1.addChild(a12) +b1 = script("TreeItem").new("b1") +b.addChild(b1) + +-- print the tree +root.printTree() diff --git a/Task/Visualize-a-tree/Nim/visualize-a-tree.nim b/Task/Visualize-a-tree/Nim/visualize-a-tree.nim new file mode 100644 index 0000000000..c7423e528a --- /dev/null +++ b/Task/Visualize-a-tree/Nim/visualize-a-tree.nim @@ -0,0 +1,25 @@ +import strutils + +type + Node[T] = ref TNode[T] + TNode[T] = object + data: T + left, right: Node[T] + +proc n[T](data: T; left, right: Node[T] = nil): Node[T] = + Node[T](data: data, left: left, right: right) + +proc indent[T](n: Node[T]): seq[string] = + if n == nil: return @["-- (null)"] + + result = @["--" & $n.data] + + for a in indent n.left: result.add " |" & a + + let r = indent n.right + result.add " `" & r[0] + for a in r[1..r.high]: result.add " " & a + +let tree = 1.n(2.n(4.n(7.n),5.n),3.n(6.n(8.n,9.n))) + +echo tree.indent.join("\n") diff --git a/Task/Visualize-a-tree/Phix/visualize-a-tree-1.phix b/Task/Visualize-a-tree/Phix/visualize-a-tree-1.phix new file mode 100644 index 0000000000..bac4728bbe --- /dev/null +++ b/Task/Visualize-a-tree/Phix/visualize-a-tree-1.phix @@ -0,0 +1,40 @@ +function rand_tree(integer low, integer high) + for i=1 to 2 do + integer v = rand(high-low+1)-1+low + if v!=low + and v!=high then + return {v,rand_tree(low,v),rand_tree(v,high)} + end if + end for + return 0 +end function + +object tree = rand_tree(0,20) -- (can be 0, ~1% chance) + +constant Horizontal = #C4, + Horizontals = "\#C4", + TopLeft = #DA, + Vertical = #B3, + BtmLeft = #C0 + +procedure visualise_tree(object tree, string root=Horizontals) + if atom(tree) then + puts(1,"\n") + else + object {v,l,r} = tree + integer g = root[$] + if sequence(l) then + root[$] = iff(g=TopLeft or g=Horizontal?' ':Vertical) + visualise_tree(l,root&TopLeft) + end if + root[$] = g + puts(1,root) + ?v + if sequence(r) then + root[$] = iff(g=TopLeft?Vertical:' ') + visualise_tree(r,root&BtmLeft) + end if + end if +end procedure + +visualise_tree(tree) diff --git a/Task/Visualize-a-tree/Phix/visualize-a-tree-2.phix b/Task/Visualize-a-tree/Phix/visualize-a-tree-2.phix new file mode 100644 index 0000000000..623a597154 --- /dev/null +++ b/Task/Visualize-a-tree/Phix/visualize-a-tree-2.phix @@ -0,0 +1 @@ +pp(tree,{pp_Nest,10}) diff --git a/Task/Visualize-a-tree/Sidef/visualize-a-tree.sidef b/Task/Visualize-a-tree/Sidef/visualize-a-tree.sidef new file mode 100644 index 0000000000..e772701ecb --- /dev/null +++ b/Task/Visualize-a-tree/Sidef/visualize-a-tree.sidef @@ -0,0 +1,21 @@ +func visualize_tree(tree, label, children, + indent = '', + mids = ['├─', '│ '], + ends = ['└─', ' '], +) { + func visit(node, pre) { + gather { + take(pre[0] + label(node)) + var chldn = children(node) + var end = chldn.end + chldn.each_kv { |i, child| + if (i == end) { take(visit(child, [pre[1]] ~X+ ends)) } + else { take(visit(child, [pre[1]] ~X+ mids)) } + } + } + } + visit(tree, [indent] * 2) +} + +var tree = 'root':['a':['a1':['a11':[]]],'b':['b1':['b11':[]],'b2':[],'b3':[]]] +say visualize_tree(tree, { .first }, { .second }).flatten.join("\n") diff --git a/Task/Voronoi-diagram/Sidef/voronoi-diagram.sidef b/Task/Voronoi-diagram/Sidef/voronoi-diagram.sidef new file mode 100644 index 0000000000..11941d6d51 --- /dev/null +++ b/Task/Voronoi-diagram/Sidef/voronoi-diagram.sidef @@ -0,0 +1,30 @@ +require('Imager') + +func generate_voronoi_diagram(width, height, num_cells) { + var img = %s.new(xsize => width, ysize => height) + var (nx,ny,nr,ng,nb) = 5.of { [] }... + + for i in ^num_cells { + nx << rand(^width) + ny << rand(^height) + nr << rand(^256) + ng << rand(^256) + nb << rand(^256) + } + + for y in ^height { + for x in ^width { + var dmin = hypot(width-1, height-1) + var j = -1 + for i in ^num_cells { + var d = hypot(nx[i]-x, ny[i]-y) + if (d < dmin) { (dmin, j) = (d, i) } + } + img.setpixel(x => x, y => y, color => [nr[j], ng[j], nb[j]]) + } + } + return img +} + +var img = generate_voronoi_diagram(500, 500, 25) +img.write(file => 'VoronoiDiagram.png') diff --git a/Task/Walk-a-directory-Non-recursively/68000-Assembly/walk-a-directory-non-recursively.68000 b/Task/Walk-a-directory-Non-recursively/68000-Assembly/walk-a-directory-non-recursively.68000 new file mode 100644 index 0000000000..b6df25496f --- /dev/null +++ b/Task/Walk-a-directory-Non-recursively/68000-Assembly/walk-a-directory-non-recursively.68000 @@ -0,0 +1,179 @@ +; +; Non-recursive directory walk for Motorola 68000 under AmigaOs 2.04+ by Thorham +; + +execBase equ 4 + +; +; from exec includes +; +_LVOOpenLibrary equ -552 +_LVOCloseLibrary equ -414 +_LVOAllocVec equ -684 +_LVOFreeVec equ -690 + +MEMF_ANY equ 0 + +; +; from dos includes +; +_LVOVPrintf equ -954 +_LVOExamine equ -102 +_LVOExNext equ -108 +_LVOLock equ -84 +_LVOUnLock equ -90 +_LVOParsePatternNoCase equ -966 +_LVOMatchPatternNoCase equ -972 + +ACCESS_READ equ -2 + rsset 0 +fib_DiskKey rs.l 1 +fib_DirEntryType rs.l 1 +fib_FileName rs.b 108 +fib_Protection rs.l 1 +fib_EntryType rs.l 1 +fib_Size rs.l 1 +fib_NumBlocks rs.l 1 +fib_DateStamp rs.b 12 +fib_Comment rs.b 80 +fib_OwnerUID rs.w 1 +fib_OwnerGID rs.w 1 +fib_Reserved rs.b 32 +fib_SIZEOF rs.b 0 + +; +; main +; + +start + move.l execBase,a6 + +; open dos.library + + lea dosName,a1 + moveq #37,d0 + jsr _LVOOpenLibrary(a6) + move.l d0,dosBase + beq exit + +; allocate memory for file info block + + move.l #fib_SIZEOF,d0 + move.l #MEMF_ANY,d1 + jsr _LVOAllocVec(a6) + move.l d0,fib + beq exit + +; get directory lock + + move.l dosBase,a6 + + move.l #pathString,d1 + move.l #ACCESS_READ,d2 + jsr _LVOLock(a6) + move.l d0,lock + beq exit + +; examine directory for ExNext + + move.l lock,d1 + move.l fib,d2 + jsr _LVOExamine(a6) + tst.w d0 + beq exit + +; parse pattern string + + move.l #patternString,d1 + move.l #patternParsed,d2 + move.l #sizeof_patternString*2+2,d3 + jsr _LVOParsePatternNoCase(a6) + tst.l d0 + blt exit + +; get some pointers for use in the loop + + lea printfArgs,a2 + move.l fib,a3 + lea fib_FileName(a3),a3 + +.loop + +; get next directory entry + + move.l lock,d1 + move.l fib,d2 + jsr _LVOExNext(a6) + tst.w d0 + beq exit + +; match pattern + + move.l #patternParsed,d1 + move.l a3,d2 + jsr _LVOMatchPatternNoCase(a6) + +; if match then print file name + + tst.l d0 + beq .nomatch + + move.l a3,(a2) + move.l #formatString,d1 + move.l #printfArgs,d2 + jsr _LVOVPrintf(a6) + +.nomatch + bra .loop + +; cleanup and exit + +exit + move.l dosBase,a6 + move.l lock,d1 + jsr _LVOUnLock(a6) + + move.l execBase,a6 + move.l fib,a1 + tst.l a1 + beq .l1 + jsr _LVOFreeVec(a6) +.l1 + move.l dosBase,a1 + jsr _LVOCloseLibrary(a6) + rts + + section data,data_p +; +; variables +; +dosBase + dc.l 0 + +lock + dc.l 0 + +fib + dc.l 0 + +printfArgs + dc.l 0 +; +; strings +; +dosName + dc.b "dos.library",0 + +pathString + dc.b "ram:",0 + +formatString + dc.b "%s",10,0 + +patternString + dc.b "#?",0 +patternString_end +sizeof_patternString=patternString_end-patternString + +patternParsed + dcb.b sizeof_patternString*2+2 diff --git a/Task/Walk-a-directory-Non-recursively/8th/walk-a-directory-non-recursively.8th b/Task/Walk-a-directory-Non-recursively/8th/walk-a-directory-non-recursively.8th new file mode 100644 index 0000000000..f72618eca0 --- /dev/null +++ b/Task/Walk-a-directory-Non-recursively/8th/walk-a-directory-non-recursively.8th @@ -0,0 +1 @@ +"*.c" f:glob \ puts an array of strings with the file names on the top of the stack diff --git a/Task/Walk-a-directory-Non-recursively/Lasso/walk-a-directory-non-recursively.lasso b/Task/Walk-a-directory-Non-recursively/Lasso/walk-a-directory-non-recursively.lasso new file mode 100644 index 0000000000..0a1b6cc375 --- /dev/null +++ b/Task/Walk-a-directory-Non-recursively/Lasso/walk-a-directory-non-recursively.lasso @@ -0,0 +1,5 @@ +local(matchingfilenames = array) + +dir('.') -> foreach => {#1 >> 'string' ? #matchingfilenames -> insert(#1)} + +#matchingfilenames diff --git a/Task/Walk-a-directory-Non-recursively/Lingo/walk-a-directory-non-recursively.lingo b/Task/Walk-a-directory-Non-recursively/Lingo/walk-a-directory-non-recursively.lingo new file mode 100644 index 0000000000..b29040f7f9 --- /dev/null +++ b/Task/Walk-a-directory-Non-recursively/Lingo/walk-a-directory-non-recursively.lingo @@ -0,0 +1,12 @@ +-- Usage: printFiles("C:\scripts", ".ls") +on printFiles (dir, fileType) + i = 1 + sub = fileType.length -1 + repeat while TRUE + fn = getNthFileNameInFolder(dir, i) + if fn = EMPTY then exit repeat + i = i+1 + if fn.length eachVisibleFilePath() => { + return with name in self -> eachEntry where #name -> second != io_dir_dt_dir where not(#name -> first -> beginswith('.')) select .makeFullPath(#name -> first) +} + +// care only about visible directories and filter out any files +define dir -> eachVisibleDir() => { + return with name in self -> eachEntry where #name -> second == io_dir_dt_dir where not(#name -> first -> beginswith('.')) select dir(.makeFullPath(#name -> first + '/')) +} + +// Recursively walk the directory tree and find all files and directories +// return only paths to files +define dir -> eachVisibleFilePathRecursive(-dirFilter = void) => { + local(files = .eachVisibleFilePath) + with dir in .eachVisibleDir + where !#dirFilter || #dirFilter(#dir -> realPath) + do { + #files = tie(#files, #dir -> eachVisibleFilePathRecursive(-dirFilter = #dirFilter)) + } + return #files +} + +local(matchingfilenames = array) + +with filepath in dir('/') -> eachVisibleFilePathRecursive +where #filepath -> endswith('.lasso') +let filename = #filepath -> split('/') -> last +do #matchingfilenames -> insert(#filename) + +#matchingfilenames diff --git a/Task/Walk-a-directory-Recursively/LiveCode/walk-a-directory-recursively-1.livecode b/Task/Walk-a-directory-Recursively/LiveCode/walk-a-directory-recursively-1.livecode new file mode 100644 index 0000000000..36bb185410 --- /dev/null +++ b/Task/Walk-a-directory-Recursively/LiveCode/walk-a-directory-recursively-1.livecode @@ -0,0 +1,20 @@ +function recurDir dir, ext + set the defaultFolder to dir + repeat for each line fi in the files + if fileExt(fi) = ext then + put the longfilepath of fi & cr after fileList + end if + end repeat + repeat for each line di in the folders + if di is not "." and di is not ".." then + put recurDir((dir & slash & di), ext) & cr after fileList + end if + end repeat + filter fileList without empty + return fileList +end recurDir + +function fileExt f + set the itemdel to "." + return the last item of f +end fileExt diff --git a/Task/Walk-a-directory-Recursively/LiveCode/walk-a-directory-recursively-2.livecode b/Task/Walk-a-directory-Recursively/LiveCode/walk-a-directory-recursively-2.livecode new file mode 100644 index 0000000000..0c90fe7d1f --- /dev/null +++ b/Task/Walk-a-directory-Recursively/LiveCode/walk-a-directory-recursively-2.livecode @@ -0,0 +1 @@ +put recurDir(the home folder & slash & "music", "mp3") diff --git a/Task/Walk-a-directory-Recursively/Nim/walk-a-directory-recursively.nim b/Task/Walk-a-directory-Recursively/Nim/walk-a-directory-recursively.nim new file mode 100644 index 0000000000..d73a3a0cc3 --- /dev/null +++ b/Task/Walk-a-directory-Recursively/Nim/walk-a-directory-recursively.nim @@ -0,0 +1,5 @@ +import os, re + +for file in walkDirRec "/": + if file.match re".*\.mp3": + echo file diff --git a/Task/Walk-a-directory-Recursively/Phix/walk-a-directory-recursively.phix b/Task/Walk-a-directory-Recursively/Phix/walk-a-directory-recursively.phix new file mode 100644 index 0000000000..b181eeebcb --- /dev/null +++ b/Task/Walk-a-directory-Recursively/Phix/walk-a-directory-recursively.phix @@ -0,0 +1,9 @@ +function find_pfile(string pathname, sequence dirent) + if match("pfile.e",dirent[D_NAME]) then +-- return pathname&dirent[D_NAME] -- to terminate scan + ?pathname&"\\"&dirent[D_NAME] + end if + return 0 +end function + +?walk_dir("C:\\Program Files (x86)\\Phix",routine_id("find_pfile"),1) diff --git a/Task/Walk-a-directory-Recursively/Ring/walk-a-directory-recursively.ring b/Task/Walk-a-directory-Recursively/Ring/walk-a-directory-recursively.ring new file mode 100644 index 0000000000..cdfc23cd95 --- /dev/null +++ b/Task/Walk-a-directory-Recursively/Ring/walk-a-directory-recursively.ring @@ -0,0 +1,10 @@ +see "Testing DIR() " + nl +mylist = dir("C:\Ring") +for x in mylist + if x[2] + see "Directory : " + x[1] + nl + else + see "File : " + x[1] + nl + ok +next +see "Files count : " + len(mylist) diff --git a/Task/Walk-a-directory-Recursively/Sidef/walk-a-directory-recursively.sidef b/Task/Walk-a-directory-Recursively/Sidef/walk-a-directory-recursively.sidef new file mode 100644 index 0000000000..5e7f7f9e04 --- /dev/null +++ b/Task/Walk-a-directory-Recursively/Sidef/walk-a-directory-recursively.sidef @@ -0,0 +1,22 @@ +func traverse(Block callback, Dir dir) { + dir.open(\var dir_h) || return; + + dir_h.entries.each { |entry| + if (entry.is_a(Dir)) { + traverse(callback, entry); + } else { + callback(entry); + } + } +} + +var dir = Dir.cwd; +var pattern = /foo/; # display files that contain 'foo' + +traverse( + { |file| + if (file.basename ~~ pattern) { + say file; + } + } => dir +); diff --git a/Task/Walk-a-directory-Recursively/Swift/walk-a-directory-recursively.swift b/Task/Walk-a-directory-Recursively/Swift/walk-a-directory-recursively.swift new file mode 100644 index 0000000000..33b7813f06 --- /dev/null +++ b/Task/Walk-a-directory-Recursively/Swift/walk-a-directory-recursively.swift @@ -0,0 +1,21 @@ +import Foundation + +let fileSystem = FileManager.default +let rootPath = "/" + +// Enumerate the directory tree (which likely recurses internally)... + +if let fsTree = fileSystem.enumerator(atPath: rootPath) { + + while let fsNodeName = fsTree.nextObject() as? NSString { + + let fullPath = "\(rootPath)/\(fsNodeName)" + + var isDir: ObjCBool = false + fileSystem.fileExists(atPath: fullPath, isDirectory: &isDir) + + if !isDir.boolValue && fsNodeName.pathExtension == "txt" { + print(fsNodeName) + } + } +} diff --git a/Task/Web-scraping/8th/web-scraping.8th b/Task/Web-scraping/8th/web-scraping.8th new file mode 100644 index 0000000000..a2a5b2bd8d --- /dev/null +++ b/Task/Web-scraping/8th/web-scraping.8th @@ -0,0 +1,14 @@ +\ Web-scrape sample: get UTC time from the US Naval Observatory: +: read-url \ -- s + "http://tycho.usno.navy.mil/cgi-bin/timer.pl" net:get + not if "Could not connect" throw then + >s ; + +: get-time + read-url + /
.*?(\d{2}:\d{2}:\d{2})\sUTC/ + tuck r:match if + 1 r:@ . cr + then ; + +get-time bye diff --git a/Task/Web-scraping/App-Inventor/web-scraping.app b/Task/Web-scraping/App-Inventor/web-scraping.app new file mode 100644 index 0000000000..f476bf29b1 --- /dev/null +++ b/Task/Web-scraping/App-Inventor/web-scraping.app @@ -0,0 +1,9 @@ +when ScrapeButton.Click do + set ScrapeWeb.Url to SourceTextBox.Text + call ScrapeWeb.Get + +when ScrapeWeb.GotText url,responseCode,responseType,responseContent do + initialize local Left to split at first text (text: get responseContent, at: PreTextBox.Text) + initialize local Right to "" in + set Right to select list item (list: get Left, index: 2) + set ResultLabel.Text to select list item (list: split at first (text:get Right, at: PostTextBox.Text), index: 1) diff --git a/Task/Web-scraping/FunL/web-scraping.funl b/Task/Web-scraping/FunL/web-scraping.funl new file mode 100644 index 0000000000..7e3e58c3f2 --- /dev/null +++ b/Task/Web-scraping/FunL/web-scraping.funl @@ -0,0 +1,5 @@ +import io.Source + +case Source.fromURL( 'http://tycho.usno.navy.mil/cgi-bin/timer.pl', 'UTF-8' ).getLines().find( ('Eastern' in) ) of + Some( time ) -> println( time.substring(4) ) + None -> error( 'Easter time not found' ) diff --git a/Task/Web-scraping/Lasso/web-scraping.lasso b/Task/Web-scraping/Lasso/web-scraping.lasso new file mode 100644 index 0000000000..e401188ab2 --- /dev/null +++ b/Task/Web-scraping/Lasso/web-scraping.lasso @@ -0,0 +1,27 @@ +/* have to be used +local(raw_htmlstring = 'What time is it? +

US Naval Observatory Master Clock Time

+
Jul. 27, 22:57:22 UTC Universal Time +
Jul. 27, 06:57:22 PM EDT Eastern Time +
Jul. 27, 05:57:22 PM CDT Central Time +
Jul. 27, 04:57:22 PM MDT Mountain Time +
Jul. 27, 03:57:22 PM PDT Pacific Time +
Jul. 27, 02:57:22 PM AKDT Alaska Time +
Jul. 27, 12:57:22 PM HAST Hawaii-Aleutian Time +

+') +*/ + +// should be used +local(raw_htmlstring = string(include_url('http://tycho.usno.navy.mil/cgi-bin/timer.pl'))) + +local( + reg_exp = regexp(-find = `
(.*?) UTC`, -input = #raw_htmlstring, -ignorecase), + datepart_txt = #reg_exp -> find ? #reg_exp -> matchstring(1) | string +) + +#datepart_txt +'
' +// added bonus showing how parsed string can be converted to date object +local(mydate = date(#datepart_txt, -format = `MMM'.' dd',' HH:mm:ss`)) +#mydate -> format(`YYYY-MM-dd HH:mm:ss`) diff --git a/Task/Web-scraping/Nim/web-scraping.nim b/Task/Web-scraping/Nim/web-scraping.nim new file mode 100644 index 0000000000..aacbc37ccc --- /dev/null +++ b/Task/Web-scraping/Nim/web-scraping.nim @@ -0,0 +1,5 @@ +import httpclient, strutils + +for line in getContent("http://tycho.usno.navy.mil/cgi-bin/timer.pl").splitLines: + if " UTC" in line: + echo line[4..line.high] diff --git a/Task/Web-scraping/Peloton/web-scraping-1.peloton b/Task/Web-scraping/Peloton/web-scraping-1.peloton new file mode 100644 index 0000000000..c30bf0931c --- /dev/null +++ b/Task/Web-scraping/Peloton/web-scraping-1.peloton @@ -0,0 +1,5 @@ +<@ DEFAREPRS>Rexx Parse +<@ DEFPRSLIT>Rexx Parse|'
' UTCtime 'UTC' +<@ LETVARURL>timer|http://tycho.usno.navy.mil/cgi-bin/timer.pl +<@ ACTRPNPRSVAR>Rexx Parse|timer +<@ SAYVAR>UTCtime diff --git a/Task/Web-scraping/Peloton/web-scraping-2.peloton b/Task/Web-scraping/Peloton/web-scraping-2.peloton new file mode 100644 index 0000000000..c92515ee74 --- /dev/null +++ b/Task/Web-scraping/Peloton/web-scraping-2.peloton @@ -0,0 +1,5 @@ +<# DEFINE WORKAREA PARSEVALUES>Rexx Parse +<# DEFINE PARSEVALUES LITERAL>Rexx Parse|'
' UTCtime 'UTC' +<# LET VARIABLE URLSOURCE>timer|http://tycho.usno.navy.mil/cgi-bin/timer.pl +<# ACT REPLACEBYPATTERN PARSEVALUES VARIABLE>Rexx Parse|timer +<# SAY VARIABLE>UTCtime diff --git a/Task/Web-scraping/Peloton/web-scraping-3.peloton b/Task/Web-scraping/Peloton/web-scraping-3.peloton new file mode 100644 index 0000000000..cb8fdb898f --- /dev/null +++ b/Task/Web-scraping/Peloton/web-scraping-3.peloton @@ -0,0 +1 @@ +<@ SAY AFT BEF URL LIT LIT LIT >http://tycho.usno.navy.mil/cgi-bin/timer.pl| UTC|
diff --git a/Task/Web-scraping/Sidef/web-scraping.sidef b/Task/Web-scraping/Sidef/web-scraping.sidef new file mode 100644 index 0000000000..bcc19e1e7e --- /dev/null +++ b/Task/Web-scraping/Sidef/web-scraping.sidef @@ -0,0 +1,4 @@ +var ua = frequire('LWP::Simple'); +var url = 'http://tycho.usno.navy.mil/cgi-bin/timer.pl'; +var match = /
(.+? UTC)/.match(ua.get(url)); +say match[0] if match; diff --git a/Task/Web-scraping/ToffeeScript/web-scraping.toffee b/Task/Web-scraping/ToffeeScript/web-scraping.toffee new file mode 100644 index 0000000000..976bb3c4b0 --- /dev/null +++ b/Task/Web-scraping/ToffeeScript/web-scraping.toffee @@ -0,0 +1,3 @@ +e, page = require('request').get! 'http://tycho.usno.navy.mil/cgi-bin/timer.pl' +l = line for line in page.body.split('\n') when line.indexOf('UTC')>0 +console.log l.substr(4,l.length-20) diff --git a/Task/Web-scraping/jq/web-scraping-1.jq b/Task/Web-scraping/jq/web-scraping-1.jq new file mode 100644 index 0000000000..91ea424e27 --- /dev/null +++ b/Task/Web-scraping/jq/web-scraping-1.jq @@ -0,0 +1,3 @@ +#!/bin/bash + curl -Ss 'http://tycho.usno.navy.mil/cgi-bin/timer.pl' |\ + jq -R -r 'if index(" UTC") then .[4:] else empty end' diff --git a/Task/Web-scraping/jq/web-scraping-2.jq b/Task/Web-scraping/jq/web-scraping-2.jq new file mode 100644 index 0000000000..32d513c9ff --- /dev/null +++ b/Task/Web-scraping/jq/web-scraping-2.jq @@ -0,0 +1,2 @@ +$ ./Web_scraping.jq +Apr. 21, 05:19:32 UTC Universal Time diff --git a/Task/Window-creation/FreeBASIC/window-creation.freebasic b/Task/Window-creation/FreeBASIC/window-creation.freebasic new file mode 100644 index 0000000000..50452e6119 --- /dev/null +++ b/Task/Window-creation/FreeBASIC/window-creation.freebasic @@ -0,0 +1,16 @@ +#Include "windows.bi" + +Dim As HWND Window_Main +Dim As MSG msg + +'Create the window: +Window_Main = CreateWindow("#32770", "I am a window - close me!", WS_OVERLAPPEDWINDOW Or WS_VISIBLE, 100, 100, 350, 200, 0, 0, 0, 0) + +'Windows message loop: +While GetMessage(@msg, Window_Main, 0, 0) + TranslateMessage(@msg) + DispatchMessage(@msg) + If msg.hwnd = Window_Main And msg.message = WM_COMMAND Then End +Wend + +End diff --git a/Task/Window-creation/Lingo/window-creation.lingo b/Task/Window-creation/Lingo/window-creation.lingo new file mode 100644 index 0000000000..69c99de776 --- /dev/null +++ b/Task/Window-creation/Lingo/window-creation.lingo @@ -0,0 +1,12 @@ +win = window().new("New Window") +w = 320 +h = 240 +firstScreen = _system.deskTopRectList[1] +x = firstScreen.width/2 - w/2 +y = firstScreen.height/2- h/2 +win.rect = rect(x,y,x+w,y+h) +-- Director needs a binary movie file (*.dir) for opening new windows. But this +-- movie file can be totally empty, and if it's write protected in the filesystem, +-- it can be re-used for multiple windows. +win.filename = _movie.path & "empty.dir" +win.open() diff --git a/Task/Window-creation/Nim/window-creation-1.nim b/Task/Window-creation/Nim/window-creation-1.nim new file mode 100644 index 0000000000..4e3b203651 --- /dev/null +++ b/Task/Window-creation/Nim/window-creation-1.nim @@ -0,0 +1,52 @@ +import + gdk2, glib2, gtk2 + +proc thisDestroy(widget: pWidget, data: pgpointer){.cdecl.} = + main_quit() + +const + Inside: cstring = "Mouse is over label" + OutSide: cstring = "Mouse is not over label" + +var + OverButton: bool + +nim_init() +var window = window_new(gtk2.WINDOW_TOPLEVEL) +var stackbox = vbox_new(TRUE, 10) +var button1 = button_new("Move mouse over button") +var buttonstyle = copy(get_style(Button1)) +ButtonStyle.bg[STATE_PRELIGHT].pixel = 0 +ButtonStyle.bg[STATE_PRELIGHT].red = -1'i16 +ButtonStyle.bg[STATE_PRELIGHT].blue = 0'i16 +ButtonStyle.bg[STATE_PRELIGHT].green = 0'i16 +set_style(button1, buttonstyle) +var button2 = button_new() +var ALabel = label_new(Outside) +var button3 = button_new("Quit") + + +proc ChangeLabel(P: PWidget, Event: gdk2.PEventCrossing, + Data: var bool){.cdecl.} = + if Not Data: set_text(ALabel, Inside) + else: set_text(ALabel, Outside) + Data = Not Data + + +add(button2, ALAbel) +pack_start(stackbox, button1, TRUE, TRUE, 0) +pack_start(stackbox, button2, TRUE, TRUE, 0) +pack_start(stackbox, button3, TRUE, TRUE, 0) +set_border_width(Window, 5) +add(window, stackbox) +discard signal_connect(window, "destroy", + SIGNAL_FUNC(thisDestroy), nil) +overbutton = False +discard signal_connect(button1, "enter_notify_event", + SIGNAL_FUNC(ChangeLabel), addr(OverButton)) +discard signal_connect(button1, "leave_notify_event", + SIGNAL_FUNC(ChangeLabel), addr(OverButton)) +discard signal_connect(button3, "clicked", + SIGNAL_FUNC(thisDestroy), nil) +show_all(window) +main() diff --git a/Task/Window-creation/Nim/window-creation-2.nim b/Task/Window-creation/Nim/window-creation-2.nim new file mode 100644 index 0000000000..4a9da4c7cd --- /dev/null +++ b/Task/Window-creation/Nim/window-creation-2.nim @@ -0,0 +1,48 @@ +import + sdl, sdl_image, colors + +var + screen, greeting: PSurface + r: TRect + event: TEvent + bgColor = colChocolate.int32 + +if init(INIT_VIDEO) != 0: + quit "SDL failed to initialize!" + +screen = SetVideoMode(640, 480, 16, SWSURFACE or ANYFORMAT) +if screen.isNil: + quit($sdl.getError()) + +greeting = IMG_load("tux.png") +if greeting.isNil: + echo "Failed to load tux.png" +else: + ## convert the image to alpha and free the old one + var s = greeting.displayFormatAlpha() + swap(greeting, s) + s.freeSurface() + +r.x = 0 +r.y = 0 + +block game_loop: + while true: + + while pollEvent(addr event) > 0: + case event.kind + of QUITEV: + break game_loop + of KEYDOWN: + if EvKeyboard(addr event).keysym.sym == K_ESCAPE: + break game_loop + else: + discard + + discard fillRect(screen, nil, bgColor) + discard blitSurface(greeting, nil, screen, addr r) + discard flip(screen) + +greeting.freeSurface() +screen.freeSurface() +sdl.Quit() diff --git a/Task/Window-creation/Nim/window-creation-3.nim b/Task/Window-creation/Nim/window-creation-3.nim new file mode 100644 index 0000000000..05cc09c7cd --- /dev/null +++ b/Task/Window-creation/Nim/window-creation-3.nim @@ -0,0 +1,73 @@ +import xlib, xutil, x, keysym + +const + WINDOW_WIDTH = 400 + WINDOW_HEIGHT = 300 + +var + width, height: cuint + display: PDisplay + screen: cint + depth: int + win: TWindow + sizeHints: TXSizeHints + +proc create_window = + width = WINDOW_WIDTH + height = WINDOW_HEIGHT + + display = XOpenDisplay(nil) + if display == nil: + echo("Verbindung zum X-Server fehlgeschlagen") + quit(1) + + screen = XDefaultScreen(display) + depth = XDefaultDepth(display, screen) + var rootwin = XRootWindow(display, screen) + win = XCreateSimpleWindow(display, rootwin, 100, 10, + width, height, 5, + XBlackPixel(display, screen), + XWhitePixel(display, screen)) + size_hints.flags = PSize or PMinSize or PMaxSize + size_hints.min_width = width.cint + size_hints.max_width = width.cint + size_hints.min_height = height.cint + size_hints.max_height = height.cint + discard XSetStandardProperties(display, win, "Simple Window", "window", + 0, nil, 0, addr(size_hints)) + discard XSelectInput(display, win, ButtonPressMask or KeyPressMask or + PointerMotionMask) + discard XMapWindow(display, win) + +proc close_window = + discard XDestroyWindow(display, win) + discard XCloseDisplay(display) + +var + xev: TXEvent + +proc process_event = + var key: TKeySym + case int(xev.theType) + of KeyPress: + key = XLookupKeysym(cast[ptr TXKeyEvent](addr(xev)), 0) + if key.int != 0: + echo("keyboard event",$key.int) + if key.int == 65307: # + quit(1) + of ButtonPressMask, PointerMotionMask: + Echo("Mouse event") + else: nil + +proc eventloop = + discard XFlush(display) + var num_events = int(XPending(display)) + while num_events != 0: + dec(num_events) + discard XNextEvent(display, addr(xev)) + process_event() + +create_window() +while true: + eventloop() +close_window() diff --git a/Task/Window-creation/Nim/window-creation-4.nim b/Task/Window-creation/Nim/window-creation-4.nim new file mode 100644 index 0000000000..1ce702e918 --- /dev/null +++ b/Task/Window-creation/Nim/window-creation-4.nim @@ -0,0 +1,13 @@ +import glut + +var win: int = 0 + +proc myOnKeyPress(c: int8, v1, v2: cint) {.cdecl.} = + echo(c) + if c == 27: + glutDestroyWindow(win) + +glutInit() +win = glutCreateWindow("Goodbye, World!") +glutKeyboardFunc(TGlut1Char2IntCallback(myOnKeyPress)) +glutMainLoop() diff --git a/Task/Window-creation/Nim/window-creation-5.nim b/Task/Window-creation/Nim/window-creation-5.nim new file mode 100644 index 0000000000..53e6d3ca46 --- /dev/null +++ b/Task/Window-creation/Nim/window-creation-5.nim @@ -0,0 +1,9 @@ +# test a Windows GUI application + +import + windows, shellapi, nb30, mmsystem, shfolder + +#proc MessageBox(hWnd: int, lpText, lpCaption: CString, uType: uint): int +# {stdcall, import: "MessageBox", header: ""} + +discard MessageBox(0, "Hello World!", "Nim GUI Application", 0) diff --git a/Task/Window-creation/Nim/window-creation-6.nim b/Task/Window-creation/Nim/window-creation-6.nim new file mode 100644 index 0000000000..7d81aecfe7 --- /dev/null +++ b/Task/Window-creation/Nim/window-creation-6.nim @@ -0,0 +1,24 @@ +import iup + +# assumes you have the iup .dll or .so installed + +discard iup.open(nil,nil) + + +# now use a Dialog box to show a message +var lbl = label("Hello World") +setAttribute(lbl,"PADDING","10x10") + +var contents = hbox(lbl, nil) +#SetAttribute(contents, "MARGIN", "5x5") + +var dlg = dialog(contents) +#SetAttribute(dlg, "SIZE", "100x50") + +discard dlg.show() + +# a window via a quick message box, sitting on top of the main dialog window +discard Alarm("MyTitle","Hello World","Ok", "Not Ok", nil) + +discard mainloop() +iup.close() diff --git a/Task/Window-creation/Phix/window-creation.phix b/Task/Window-creation/Phix/window-creation.phix new file mode 100644 index 0000000000..321277d7a9 --- /dev/null +++ b/Task/Window-creation/Phix/window-creation.phix @@ -0,0 +1,13 @@ +include pGUI.e + +function esc_close(Ihandle /*ih*/, atom c) + return iff(c=K_ESC?IUP_CLOSE:IUP_CONTINUE) +end function + + IupOpen("../pGUI/") + Ihandle dlg = IupDialog(IupVbox({IupLabel("hello")},"MARGIN=200x200")) + IupSetAttribute(dlg,"TITLE","Hello") + IupSetCallback(dlg, "K_ANY", Icallback("esc_close")) + IupShow(dlg) + IupMainLoop() + IupClose() diff --git a/Task/Window-creation/Ring/window-creation.ring b/Task/Window-creation/Ring/window-creation.ring new file mode 100644 index 0000000000..740fe76ac2 --- /dev/null +++ b/Task/Window-creation/Ring/window-creation.ring @@ -0,0 +1,8 @@ +Load "guilib.ring" + +MyApp = New qApp { + win1 = new qWidget() { + setwindowtitle("Hello World") + setGeometry(100,100,370,250) + show()} + exec()} diff --git a/Task/Window-creation/Sidef/window-creation-1.sidef b/Task/Window-creation/Sidef/window-creation-1.sidef new file mode 100644 index 0000000000..630c332c47 --- /dev/null +++ b/Task/Window-creation/Sidef/window-creation-1.sidef @@ -0,0 +1,3 @@ +var tk = require('Tk'); +%s'MainWindow'.new; +tk.MainLoop; diff --git a/Task/Window-creation/Sidef/window-creation-2.sidef b/Task/Window-creation/Sidef/window-creation-2.sidef new file mode 100644 index 0000000000..eb608846c1 --- /dev/null +++ b/Task/Window-creation/Sidef/window-creation-2.sidef @@ -0,0 +1,5 @@ +var gtk2 = require('Gtk2') -> init; +var window = %s'Gtk2::Window'.new; +window.signal_connect(destroy => func(*_) { gtk2.main_quit }); +window.show_all; +gtk2.main; diff --git a/Task/Window-management/Nim/window-management-1.nim b/Task/Window-management/Nim/window-management-1.nim new file mode 100644 index 0000000000..53b022e387 --- /dev/null +++ b/Task/Window-management/Nim/window-management-1.nim @@ -0,0 +1,79 @@ +import + gdk2, glib2, gtk2, + os + +proc thisDestroy(widget: pWidget, data: pgpointer){.cdecl.} = + main_quit() +proc thisMax(widget: pWidget, data: pgpointer){.cdecl.} = + maximize(get_parent_window(widget)) +proc thisUnmax(widget: pWidget, data: pgpointer){.cdecl.} = + unmaximize(get_parent_window(widget)) +proc thisIcon(widget: pWidget, data: pgpointer){.cdecl.} = + iconify(get_parent_window(widget)) +proc thisDeicon(widget: pWidget, data: pgpointer){.cdecl.} = + deiconify(get_parent_window(widget)) +proc thisHide(widget: pWidget, data: pgpointer){.cdecl.} = + hide(get_parent_window(widget)) + sleep(5) + show(get_parent_window(widget)) + +proc thisShow(widget: pWidget, data: pgpointer){.cdecl.} = + show(get_parent_window(widget)) + +var isshifted: bool = false + +proc thisMove(widget: pWidget, data: pgpointer){.cdecl.} = + var w, h: gint + get_size(get_parent_window(widget), Addr(w), Addr(h)) + if isshifted: + move(get_parent_window(widget), w-10, h-10) + else: + move(get_parent_window(widget), w+10, h+10) + isshifted = not isshifted + + +nim_init() +var window = window_new(gtk2.WINDOW_TOPLEVEL) +discard allow_grow(window) +set_title(window,"Window management") +var stackbox = vbox_new(TRUE, 10) +var bmax = button_new("maximize") +var bunmax = button_new("unmaximize") +var bicon = button_new("iconize") +var bdeicon = button_new("deiconize") +var bhide = button_new("hide") +var bshow = button_new("show") +var bmove = button_new("move") +var bquit = button_new("Quit") + +pack_start(stackbox, bmax, TRUE, TRUE, 0) +pack_start(stackbox, bunmax, TRUE, TRUE, 0) +pack_start(stackbox, bicon, TRUE, TRUE, 0) +pack_start(stackbox, bdeicon, TRUE, TRUE, 0) +pack_start(stackbox, bhide, TRUE, TRUE, 0) +pack_start(stackbox, bshow, TRUE, TRUE, 0) +pack_start(stackbox, bmove, TRUE, TRUE, 0) +pack_start(stackbox, bquit, TRUE, TRUE, 0) +set_border_width(Window, 5) +add(window, stackbox) +discard signal_connect(window, "destroy", + SIGNAL_FUNC(thisDestroy), nil) + +discard signal_connect(bicon, "clicked", + SIGNAL_FUNC(thisIcon), nil) +discard signal_connect(bdeicon, "clicked", + SIGNAL_FUNC(thisDeicon), nil) +discard signal_connect(bmax, "clicked", + SIGNAL_FUNC(thisMax), nil) +discard signal_connect(bunmax, "clicked", + SIGNAL_FUNC(thisUnmax), nil) +discard signal_connect(bhide, "clicked", + SIGNAL_FUNC(thisHide), nil) +discard signal_connect(bshow, "clicked", + SIGNAL_FUNC(thisShow), nil) +discard signal_connect(bmove, "clicked", + SIGNAL_FUNC(thismove), nil) +discard signal_connect(bquit, "clicked", + SIGNAL_FUNC(thisDestroy), nil) +show_all(window) +main() diff --git a/Task/Window-management/Nim/window-management-2.nim b/Task/Window-management/Nim/window-management-2.nim new file mode 100644 index 0000000000..1d78641191 --- /dev/null +++ b/Task/Window-management/Nim/window-management-2.nim @@ -0,0 +1,68 @@ +import iup + +# assumes you have the iup .dll or .so installed + +proc toCB(fp: proc): ICallback = + return cast[ICallback](fp) + +discard iup.open(nil,nil) + +var btnRestore = button("restore","") +var btnFull = button("Full screen","") +var btnMin = button("minimize","") +var btnMax = button("maximize","") +var btnHide = button("Transparent","") +#var btnHide = button("Hide (close)","") +var btnShow = button("Show","") + +var hbox = Hbox(btnRestore, btnFull, btnMax, btnMin, btnShow, btnHide, nil) +setAttribute(hbox,"MARGIN", "10x10") +setAttribute(hbox,"PADDING", "5x5") + +var dlg = Dialog(hbox) +#SetAttribute(dlg, "SIZE", "100x50") + +proc doFull(ih:PIhandle): cint {.cdecl.} = + setAttribute(dlg,"FULLSCREEN","YES") + return IUP_DEFAULT + +proc doMax(ih:PIhandle): cint {.cdecl.} = + #setAttribute(dlg,"FULLSCREEN","YES") + setAttribute(dlg,"PLACEMENT","MAXIMIZED") + # this is a work-around to get the dialog minimised (on win platform) + setAttribute(dlg,"VISIBLE","YES") + return IUP_DEFAULT + +proc doMin(ih:PIhandle): cint {.cdecl.} = + setAttribute(dlg,"PLACEMENT","MINIMIZED") + # this is a work-around to get the dialog minimised (on win platform) + setAttribute(dlg,"VISIBLE","YES") + return IUP_DEFAULT + +proc doRestore(ih:PIhandle): cint {.cdecl.} = + setAttribute(dlg,"OPACITY","255") + setAttribute(dlg,"FULLSCREEN","NO") + setAttribute(dlg,"PLACEMENT","NORMAL") + setAttribute(dlg,"VISIBLE","YES") + return IUP_DEFAULT + +proc doHide(ih:PIhandle): cint {.cdecl.} = + #setAttribute(dlg,"VISIBLE","NO") + setAttribute(dlg,"OPACITY","60") + return IUP_DEFAULT + +proc doShow(ih:PIhandle): cint {.cdecl.} = + setAttribute(dlg,"OPACITY","255") + setAttribute(dlg,"VISIBLE","YES") + return IUP_DEFAULT + +discard setCallback(btnRestore,"ACTION", toCB(doRestore)) +discard setCallback(btnFull,"ACTION", toCB(doFull)) +discard setCallback(btnMax,"ACTION", toCB(doMax)) +discard setCallback(btnMin,"ACTION", toCB(doMin)) +discard setCallback(btnShow,"ACTION", toCB(doShow)) +discard setCallback(btnHide,"ACTION", toCB(doHide)) + +discard dlg.show() +discard mainloop() +iup.Close() diff --git a/Task/Window-management/Phix/window-management.phix b/Task/Window-management/Phix/window-management.phix new file mode 100644 index 0000000000..b5338f1bae --- /dev/null +++ b/Task/Window-management/Phix/window-management.phix @@ -0,0 +1,69 @@ +include pGUI.e + +Ihandle dlg + +function doFull(Ihandle /*ih*/) + IupSetAttribute(dlg,"FULLSCREEN","YES") + return IUP_DEFAULT +end function + +function doMax(Ihandle /*ih*/) + IupSetAttribute(dlg,"PLACEMENT","MAXIMIZED") + -- this is a work-around to get the dialog minimised (on win platform) + IupSetAttribute(dlg,"VISIBLE","YES") + return IUP_DEFAULT +end function + +function doMin(Ihandle /*ih*/) + IupSetAttribute(dlg,"PLACEMENT","MINIMIZED") + -- this is a work-around to get the dialog minimised (on win platform) + IupSetAttribute(dlg,"VISIBLE","YES") + return IUP_DEFAULT +end function + +function doRestore(Ihandle /*ih*/) + IupSetAttribute(dlg,"OPACITY","255") + IupSetAttribute(dlg,"FULLSCREEN","NO") + IupSetAttribute(dlg,"PLACEMENT","NORMAL") + IupSetAttribute(dlg,"VISIBLE","YES") + return IUP_DEFAULT +end function + +function doDim(Ihandle /*ih*/) + IupSetAttribute(dlg,"OPACITY","60") + return IUP_DEFAULT +end function + +function doShow(Ihandle /*ih*/) + IupSetAttribute(dlg,"OPACITY","255") + return IUP_DEFAULT +end function + +function doMove(Ihandle /*ih*/) + integer {x,y} = IupGetIntInt(dlg,"SCREENPOSITION") + integer shift = iff(IupGetInt(NULL,"SHIFTKEY")?-10,+10) + IupShowXY(dlg,x+shift,y+shift) + return IUP_DEFAULT +end function + +procedure main() + IupOpen("../pGUI/") + + Ihandle hbox = IupHbox({IupButton("restore", Icallback("doRestore")), + IupButton("full screen",Icallback("doFull")), + IupButton("maximize", Icallback("doMax")), + IupButton("minimize", Icallback("doMin")), + IupButton("dim", Icallback("doDim")), + IupButton("show", Icallback("doShow")), + IupButton("move", Icallback("doMove"))}) + IupSetAttribute(hbox,"MARGIN", "10x10") + IupSetAttribute(hbox,"PADDING", "5x5") + + dlg = IupDialog(hbox) + IupSetAttribute(dlg,"OPACITY","255") + + IupShowXY(dlg,IUP_CENTER,IUP_CENTER) + IupMainLoop() + IupClose() +end procedure +main() diff --git a/Task/Window-management/Ring/window-management.ring b/Task/Window-management/Ring/window-management.ring new file mode 100644 index 0000000000..2743720241 --- /dev/null +++ b/Task/Window-management/Ring/window-management.ring @@ -0,0 +1,152 @@ +Load "guilib.ring" + +/* + +-------------------------------------------------------------------------- + + Program Name : ScreenDrawOnReSize.ring + + Date : 2016.06.16 + + Author : Bert Mariani + + Purpose : Re-Draw Chart after ReSize or move + +-------------------------------------------------------------------------- +*/ + + +###------------------------------- +### DRAW CHART size 1000 x 1000 +### + +###------------------------------ + +### Window Size + WinLeft = 80 ### 80 Window position on screen + WinTop = 80 ### 80 Window position on screen + WinWidth = 1000 ### 1000 Window Size - Horizontal-X WinWidth + WinHeight = 750 ### 750 Window Size - Vertical-Y WinHeight + WinRight = WinLeft + WinWidth ### 1080 + WinBottom = WinTop + WinHeight ### 830 + +### Label Box Size + BoxLeft = 40 ### Start corner Label1 Box Start Position inside WIN1 + BoxTop = 40 ### Start corner + BoxWidth = WinWidth -80 ### End corner Label1 Box Size + BoxHeight = WinHeight -80 ### End corner + +###---------------------------- + + +New qapp { + win1 = new qwidget() { + + ### Position and Size of WINDOW on the Screen + setwindowtitle("DrawChart using QPainter") + setgeometry( WinLeft, WinTop, WinWidth, WinHeight) + + win1{ setwindowtitle("Initial Window Position: " +" L " + WinLeft +" T " + WinTop +" Width" + width() +" Height " + height() ) } + + ### ReSizeEvent ... Call WhereAreWe function + myfilter = new qallevents(win1) + myfilter.setResizeEvent("WhereAreWe()") + installeventfilter(myfilter) + + ### Draw within this BOX + label1 = new qlabel(win1) { + setgeometry(BoxLeft, BoxTop, BoxWidth, BoxHeight) + settext("We are Here") + } + + + ### Button Position and Size ... Call DRAW function + new qpushbutton(win1) { + setgeometry( 30, 30, 80, 20) + settext("Draw") + setclickevent("Draw()") + } + + ###--------------- + + show() + } + + exec() +} + + +###----------------- +### FUNCTION Draw +###----------------- + +Func WhereAreWe + Rec = win1.framegeometry() + + WinWidth = win1.width() ### 1000 Current Values + WinHeight = win1.height() ### 750 + + WinLeft = Rec.left() +8 ### <<< QT FIX because of Win Title + WinTop = Rec.top() +30 ### <<< QT FIX because of Win Title + WinRight = Rec.right() + WinBottom = Rec.bottom() + + BoxWidth = WinWidth -80 ### 950 + BoxHeight = WinHeight -80 ### 700 + + win1{ setwindowtitle("Window ReSize: Win " + WinWidth + "x" + WinHeight + " --- Box " + BoxWidth + "x" + BoxHeight + + " --- LT " + WinLeft + "-" + WinTop + " --- RB " + WinRight + "-" + WinBottom ) } + + See "We Are Here - setResizeEvent - " + See " Win " + WinWidth + "x" + WinHeight + " --- Box " + BoxWidth + "x" + BoxHeight + See " --- LT " + Winleft + "-" + WinTop + " --- RB " + WinRight + "-" + WinBottom +nl + + win1.setgeometry( WinLeft, WinTop, WinWidth, WinHeight ) + label1.setgeometry( BoxLeft, BoxTop, BoxWidth, BoxHeight ) + + +return + +Func Draw + + win1{ setwindowtitle("Draw Position: Win " + WinWidth + "x" + WinHeight + " --- Box " + BoxWidth + "x" + BoxHeight + + " --- LT " + WinLeft + "-" + WinTop + " --- RB " + WinRight + "-" + WinBottom ) } + + See "Draw Position: " + WinWidth + "x" + WinHeight + " --- Box " + BoxWidth + "x" + BoxHeight + + " --- LT " + WinLeft + "-" + WinTop + " --- RB " + WinRight + "-" + WinBottom + nl + + + # ##----------------------------- + ### PEN Colors + + p1 = new qpicture() + + colorBlue = new qcolor() { setrgb(0, 0,255,255) } + penBlue = new qpen() { setcolor(colorBlue) setwidth(1) } + + + ###----------------------- + ### PAINT the Chart + + new qpainter() { + begin(p1) + setpen(penBlue) + + ###--------------------- + ### Draw Line Chart + + drawline( 1 , 1 , BoxWidth , 1 ) ### WinTop line horizonal + drawline( 1 , 1 , 1 , BoxHeight ) ### WinLeft Line vetical + + drawline( 1 , BoxHeight , BoxWidth , BoxHeight ) ### Bottom Line horizontal + drawline( BoxWidth , 1 , BoxWidth , BoxHeight ) ### WinRight Line vertical + + drawline( BoxWidth / 2 , 1 , BoxWidth / 2 , BoxHeight ) ### Central vertical + drawline( 1 , BoxHeight / 2 , BoxWidth , BoxHeight / 2 ) ### Central horizontal + + + ###-------------------------------------------------- + + + endpaint() + } + + + label1 { setpicture(p1) show() } + +return +###-------------------------------------------- diff --git a/Task/Wireworld/Nim/wireworld.nim b/Task/Wireworld/Nim/wireworld.nim new file mode 100644 index 0000000000..950d6e9978 --- /dev/null +++ b/Task/Wireworld/Nim/wireworld.nim @@ -0,0 +1,36 @@ +import strutils, os + +var world, world2 = """ ++-----------+ +|tH.........| +|. . | +| ... | +|. . | +|Ht.. ......| ++-----------+""" +let h = world.splitLines.len +let w = world.splitLines[0].len + +template isH(x, y): int = int(s[i+ w*y + x] == 'H') + +proc next(o: var string, s: string, w: int) = + for i, c in s: + o[i] = case c + of ' ': ' ' + of 't': '.' + of 'H': 't' + of '.': + if (isH(-1, -1) + isH(0, -1) + isH(1, -1) + + isH(-1, 0) + isH(1, 0) + + isH(-1, 1) + isH(0, 1) + isH(1, 1) + ) in 1..2: 'H' else: '.' + else: c + +while true: + echo world + stdout.write "\x1b[",h,"A" + stdout.write "\x1b[",w,"D" + sleep 100 + + world2.next(world, w) + swap world, world2 diff --git a/Task/Wireworld/Sidef/wireworld.sidef b/Task/Wireworld/Sidef/wireworld.sidef new file mode 100644 index 0000000000..0fde9dcce4 --- /dev/null +++ b/Task/Wireworld/Sidef/wireworld.sidef @@ -0,0 +1,31 @@ +var f = [[], DATA.lines.map {['', .chars..., '']}..., []]; + +10.times { + say f.map { .join(" ") + "\n" }.join; + var a = [[]]; + for y in (1 .. f.end-1) { + var r = f[y]; + var rr = ['']; + for x in (1 .. r.end-1) { + var c = r[x]; + rr << ( + given(c) { + when('H') { 't' } + when('t') { '.' } + when('.') { <. H>[f.ft(y-1, y+1).map{.ft(x-1, x+1)...}.count('H') ~~ [1,2]] } + default { c } + } + ) + } + rr << ''; + a << rr; + } + f = [a..., []]; +} + +__DATA__ +tH......... +. . + ... +. . +Ht.. ...... diff --git a/Task/Wireworld/jq/wireworld-1.jq b/Task/Wireworld/jq/wireworld-1.jq new file mode 100644 index 0000000000..e44a90c792 --- /dev/null +++ b/Task/Wireworld/jq/wireworld-1.jq @@ -0,0 +1,37 @@ +def lines: split("\n")|length; + +def cols: split("\n")[0]|length + 1; # allow for the newline + +# Is there an "H" at [x,y] relative to position i, assuming the width is w? +# Input is an array; 72 is "H" +def isH(x; y; i; w): if .[i+ w*y + x] == 72 then 1 else 0 end; + +def neighborhood(i;w): + isH(-1; -1; i; w) + isH(0; -1; i; w) + isH(1; -1; i; w) + + isH(-1; 0; i; w) + isH(1; 0; i; w) + + isH(-1; 1; i; w) + isH(0; 1; i; w) + isH(1; 1; i; w) ; + +# The basic rules: +# Input: a world +# Output: the next state of .[i] +def evolve(i; width) : + # "Ht. " | explode => [ 72, 116, 46, 32 ] + .[i] as $c + | if $c == 32 then $c # " " => " " + elif $c == 116 then 46 # "t" => "." + elif $c == 72 then 116 # "H" => "t" + elif $c == 46 then # "." + # updates are "simultaneous" i.e. relative to $world + neighborhood(i; width) as $sum + | (if [1,2]|index($sum) then 72 else . end) # "H" + else $c + end ; + +# [world, lines, cols] | next(w) => [world, lines, cols] +def next: + .[0] as $world | .[1] as $lines | .[2] as $w + | reduce range(0; $world|length) as $i + ($world; + $world | evolve($i; $w) as $next + | if .[$i] == $next then . else .[$i] = $next end ) + | [., $lines, $w] ; # diff --git a/Task/Wireworld/jq/wireworld-2.jq b/Task/Wireworld/jq/wireworld-2.jq new file mode 100644 index 0000000000..10ec0686d6 --- /dev/null +++ b/Task/Wireworld/jq/wireworld-2.jq @@ -0,0 +1,26 @@ +# "clear screen": +def cls: "\u001b[2J"; + +# Input: an integer; 1000 ~ 1 sec +def spin: + reduce range(1; 500 * .) as $i + (0; . + ($i|cos)*($i|cos) + ($i|sin)*($i|sin) ) + | "" ; + +# Animate n steps; +# if "sleep" is non-negative then cls and +# sleep about "sleep" ms between frames. +def animate(n; sleep): + if n == 0 then empty + else (if sleep >= 0 then cls else "" end), + (.[0]|implode), n, "\n", + (sleep|spin), + ( next|animate(n-1; sleep) ) + end ; + +# Input: a string representing the initial state +def animation(n; sleep): + [ explode, lines, cols] | animate(n; sleep) ; + +# Input: a string representing the initial state +def frames(n): animation(n; -1);# diff --git a/Task/Wireworld/jq/wireworld-3.jq b/Task/Wireworld/jq/wireworld-3.jq new file mode 100644 index 0000000000..649ae4cea2 --- /dev/null +++ b/Task/Wireworld/jq/wireworld-3.jq @@ -0,0 +1,15 @@ +def world11: +"+-----------+\n" + +"|tH.........|\n" + +"|. . |\n" + +"| ... |\n" + +"|. . |\n" + +"|Ht.. ......|\n" + +"+-----------+\n" ; + +def world9: +" \n" + +" tH \n" + +" . .... \n" + +" .. \n" + +" \n" ; diff --git a/Task/Wireworld/jq/wireworld-4.jq b/Task/Wireworld/jq/wireworld-4.jq new file mode 100644 index 0000000000..18a4b7ab90 --- /dev/null +++ b/Task/Wireworld/jq/wireworld-4.jq @@ -0,0 +1,2 @@ +# Ten-step animation with about 1 sec between frames +world9 | animation(10; 1000) diff --git a/Task/Wireworld/jq/wireworld-5.jq b/Task/Wireworld/jq/wireworld-5.jq new file mode 100644 index 0000000000..ad7780edab --- /dev/null +++ b/Task/Wireworld/jq/wireworld-5.jq @@ -0,0 +1,2 @@ +# Ten frames in sequence: +world11 | frames(10) diff --git a/Task/Word-wrap/LFE/word-wrap-1.lfe b/Task/Word-wrap/LFE/word-wrap-1.lfe new file mode 100644 index 0000000000..d23ba2c4aa --- /dev/null +++ b/Task/Word-wrap/LFE/word-wrap-1.lfe @@ -0,0 +1,25 @@ +(defun wrap-text (text) + (wrap-text text 78)) + +(defun wrap-text (text max-len) + (string:join + (make-wrapped-lines + (string:tokens text " ") max-len) + "\n")) + +(defun make-wrapped-lines + (((cons word rest) max-len) + (let ((`#(,_ ,_ ,last-line ,lines) (assemble-lines max-len word rest))) + (lists:reverse (cons last-line lines))))) + +(defun assemble-lines (max-len word rest) + (lists:foldl + #'assemble-line/2 + `#(,max-len ,(length word) ,word ()) + rest)) + +(defun assemble-line + ((word `#(,max ,line-len ,line ,acc)) (when (> (+ (length word) line-len) max)) + `#(,max ,(length word) ,word ,(cons line acc))) + ((word `#(,max ,line-len ,line ,acc)) + `#(,max ,(+ line-len 1 (length word)) ,(++ line " " word) ,acc))) diff --git a/Task/Word-wrap/LFE/word-wrap-2.lfe b/Task/Word-wrap/LFE/word-wrap-2.lfe new file mode 100644 index 0000000000..b29d2a6b2c --- /dev/null +++ b/Task/Word-wrap/LFE/word-wrap-2.lfe @@ -0,0 +1,9 @@ +(defun make-regex-str (max-len) + (++ "(.{1," (integer_to_list max-len) "}|\\S{" + (integer_to_list (+ max-len 1)) ",})(?:\\s[^\\S\\r\\n]*|\\Z)")) + +(defun wrap-text (text max-len) + (let ((find-patt (make-regex-str max-len)) + (replace-patt "\\1\\\n")) + (re:replace text find-patt replace-patt + '(global #(return list))))) diff --git a/Task/Word-wrap/LFE/word-wrap-3.lfe b/Task/Word-wrap/LFE/word-wrap-3.lfe new file mode 100644 index 0000000000..6b1a1695b7 --- /dev/null +++ b/Task/Word-wrap/LFE/word-wrap-3.lfe @@ -0,0 +1,4 @@ +> (set test-text (++ "Even today, with proportional fonts and complex layouts, there are still cases where you need to wrap text at a specified column. " + "The basic task is to wrap a paragraph of text in a simple way in your language. If there is a way to do this that is built-in, trivial, or " + "provided in a standard library, show that. Otherwise implement the minimum length greedy algorithm from Wikipedia.") +> (io:format (wrap-text text 80)) diff --git a/Task/Word-wrap/LFE/word-wrap-4.lfe b/Task/Word-wrap/LFE/word-wrap-4.lfe new file mode 100644 index 0000000000..bb397fc8c1 --- /dev/null +++ b/Task/Word-wrap/LFE/word-wrap-4.lfe @@ -0,0 +1 @@ +> (io:format (wrap-text text 50)) diff --git a/Task/Word-wrap/Lasso/word-wrap.lasso b/Task/Word-wrap/Lasso/word-wrap.lasso new file mode 100644 index 0000000000..e602d1372b --- /dev/null +++ b/Task/Word-wrap/Lasso/word-wrap.lasso @@ -0,0 +1,14 @@ +define wordwrap( + text::string, + row_length::integer = 75 +) => { + return regexp(`(?is)(.{1,` + #row_length + `})(?:$|\W)+`, '$1
\n', #text, true) -> replaceall +} + +local(text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris consequat ornare lectus, dignissim iaculis libero consequat sed. Proin quis magna in arcu sagittis consequat sed ac risus. Ut a pharetra dui. Phasellus molestie, mauris eget scelerisque laoreet, diam dolor vulputate nulla, in porta sem sem sit amet lacus.') + +wordwrap(#text, 40) +'
' +wordwrap(#text) +'
' +wordwrap(#text, 90) diff --git a/Task/Word-wrap/Lingo/word-wrap-1.lingo b/Task/Word-wrap/Lingo/word-wrap-1.lingo new file mode 100644 index 0000000000..ab242fdf2b --- /dev/null +++ b/Task/Word-wrap/Lingo/word-wrap-1.lingo @@ -0,0 +1,42 @@ +-- in some movie script + +---------------------------------------- +-- Wraps specified text into lines of specified width (in px), returns lines as list of strings +-- @param {string} str +-- @param {integer} pixelWidth +-- @param {propList} [style] +-- @return {list} +---------------------------------------- +on hardWrapText (str, pixelWidth, style) + if voidP(style) then style = [:] + lines = [] + + -- create a new field member + m = new(#field) + m.text = str + m.rect = rect(0,0,pixelWidth,0) + + -- assign style props (if not specified, defaults are used) + repeat with i = 1 to style.count + m.setProp(style.getPropAt(i), style[i]) + end repeat + + -- create an invisible temporary sprite + s = channel(1).makeScriptedSprite(m) + s.loc = point(0,0) + s.visible = false + _movie.updateStage() + + -- get the wrapped lines + charPos = 0 + repeat with y = 0 to s.height-1 + n = s.pointToChar(point(pixelWidth-1, y)) + if n<>charPos then + lines.add(str.char[charPos+1..n]) + charPos = n + end if + end repeat + + channel(1).removeScriptedSprite() + return lines +end diff --git a/Task/Word-wrap/Lingo/word-wrap-2.lingo b/Task/Word-wrap/Lingo/word-wrap-2.lingo new file mode 100644 index 0000000000..501fcf3454 --- /dev/null +++ b/Task/Word-wrap/Lingo/word-wrap-2.lingo @@ -0,0 +1,12 @@ +str = "Lorem ipsum dolor sit amet, consectetur adipisici elit, sed "&\ +"eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim "&\ +"veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi "&\ +"consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu "&\ +"fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in "&\ +"culpa qui officia deserunt mollit anim id est laborum." + +lines = hardWrapText(str, 320, [#font: "Arial", #fontSize:24]) + +repeat with l in lines + put l +end repeat diff --git a/Task/Word-wrap/Nim/word-wrap.nim b/Task/Word-wrap/Nim/word-wrap.nim new file mode 100644 index 0000000000..5e5ca1fe56 --- /dev/null +++ b/Task/Word-wrap/Nim/word-wrap.nim @@ -0,0 +1,6 @@ +import strutils + +let txt = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur." +echo wordWrap(txt) +echo "" +echo wordWrap(txt, 45) diff --git a/Task/Word-wrap/Sidef/word-wrap-1.sidef b/Task/Word-wrap/Sidef/word-wrap-1.sidef new file mode 100644 index 0000000000..ba9339ffdf --- /dev/null +++ b/Task/Word-wrap/Sidef/word-wrap-1.sidef @@ -0,0 +1,18 @@ +class String { + method wrap(width) { + var txt = self.gsub(/\s+/, " "); + var len = txt.len; + var para = []; + var i = 0; + while (i < len) { + var j = (i + width); + while ((j < len) && (txt.char_at(j) != ' ')) { --j }; + para.append(txt.substr(i, j-i)); + i = j+1; + }; + return para.join("\n"); + } +} + +var text = 'aaa bb cc ddddd'; +say text.wrap(6); diff --git a/Task/Word-wrap/Sidef/word-wrap-2.sidef b/Task/Word-wrap/Sidef/word-wrap-2.sidef new file mode 100644 index 0000000000..9e6a48ac21 --- /dev/null +++ b/Task/Word-wrap/Sidef/word-wrap-2.sidef @@ -0,0 +1,90 @@ +class SmartWordWrap { + + has width = 80 + + method prepare_words(array, depth=0, callback) { + + var root = [] + var len = 0 + var i = -1 + + var limit = array.end + while (++i <= limit) { + len += (var word_len = array[i].len) + + if (len > width) { + if (word_len > width) { + len -= word_len + array.splice(i, 1, array[i].split(width)...) + limit = array.end + --i; next + } + break + } + + root << [ + array.first(i+1).join(' '), + self.prepare_words(array.ft(i+1), depth+1, callback) + ] + + if (depth.is_zero) { + callback(root[0]) + root = [] + } + + break if (++len >= width) + } + + root + } + + method combine(root, path, callback) { + var key = path.shift + path.each { |value| + root << key + if (value.is_empty) { + callback(root) + } + else { + value.each { |item| + self.combine(root, item, callback) + } + } + root.pop + } + } + + method wrap(text, width) { + + self.width = width + var words = (text.kind_of(Array) ? text : text.words) + + var best = Hash( + score => Inf, + value => [], + ) + + self.prepare_words(words, callback: { |path| + self.combine([], path, { |combination| + var score = 0 + combination.ft(0, -2).each { |line| + score += (width - line.len -> sqr) + } + + if (score < best{:score}) { + best{:score} = score + best{:value} = []+combination + } + }) + }) + + best{:value}.join("\n") + } +} +  +var sww = SmartWordWrap(); +  +var words = %w(aaa bb cc ddddd); +var wrapped = sww.wrap(words, 6); +  +say wrapped; diff --git a/Task/Word-wrap/jq/word-wrap-1.jq b/Task/Word-wrap/jq/word-wrap-1.jq new file mode 100644 index 0000000000..447f378b6d --- /dev/null +++ b/Task/Word-wrap/jq/word-wrap-1.jq @@ -0,0 +1,14 @@ +# Simple greedy algorithm. +# Note: very long words are not truncated. +# input: a string +# output: an array of strings +def wrap_text(width): + reduce splits("\\s+") as $word + ([""]; + .[length-1] as $current + | ($word|length) as $wl + | (if $current == "" then 0 else 1 end) as $pad + | if $wl + $pad + ($current|length) <= width + then .[-1] += ($pad * " ") + $word + else . + [ $word] + end ); diff --git a/Task/Word-wrap/jq/word-wrap-2.jq b/Task/Word-wrap/jq/word-wrap-2.jq new file mode 100644 index 0000000000..42d0367ad7 --- /dev/null +++ b/Task/Word-wrap/jq/word-wrap-2.jq @@ -0,0 +1 @@ +"aaa bb cc ddddd" | wrap_text(6)[] # wikipedia example diff --git a/Task/Word-wrap/jq/word-wrap-3.jq b/Task/Word-wrap/jq/word-wrap-3.jq new file mode 100644 index 0000000000..d58c7bbf3c --- /dev/null +++ b/Task/Word-wrap/jq/word-wrap-3.jq @@ -0,0 +1 @@ +"aaa bb cc ddddd" | wrap_text(5)[] diff --git a/Task/Word-wrap/jq/word-wrap-4.jq b/Task/Word-wrap/jq/word-wrap-4.jq new file mode 100644 index 0000000000..0c10165aa4 --- /dev/null +++ b/Task/Word-wrap/jq/word-wrap-4.jq @@ -0,0 +1,3 @@ +советских военных судов и самолетов была отмечена в Японском море после появления там двух американских авианосцев. Не +менее 100 советских самолетов поднялись в воздух, когдаамериканские +авианосцы "Уинсон" и "Мидуэй" приблизились на 50 миль к Владивостоку. diff --git a/Task/Word-wrap/jq/word-wrap-5.jq b/Task/Word-wrap/jq/word-wrap-5.jq new file mode 100644 index 0000000000..e2272fa22e --- /dev/null +++ b/Task/Word-wrap/jq/word-wrap-5.jq @@ -0,0 +1,8 @@ +$ jq -M -R -s -r -f Word_wrap.jq Russian.txt +советских военных судов и самолетов была +отмечена в Японском море после появления +там двух американских авианосцев. Не +менее 100 советских самолетов поднялись +в воздух, когдаамериканские авианосцы +"Уинсон" и "Мидуэй" приблизились на 50 +миль к Владивостоку. diff --git a/Task/Write-float-arrays-to-a-text-file/FreeBASIC/write-float-arrays-to-a-text-file.freebasic b/Task/Write-float-arrays-to-a-text-file/FreeBASIC/write-float-arrays-to-a-text-file.freebasic new file mode 100644 index 0000000000..2400b34787 --- /dev/null +++ b/Task/Write-float-arrays-to-a-text-file/FreeBASIC/write-float-arrays-to-a-text-file.freebasic @@ -0,0 +1,13 @@ +' FB 1.05.0 Win64 + +Dim x(0 To 3) As Double = {1, 2, 3, 1e11} +Dim y(0 To 3) As Double = {1, 1.4142135623730951, 1.7320508075688772, 316227.76601683791} + +Open "output.txt" For Output As #1 +For i As Integer = 0 To 2 + Print #1, Using "#"; x(i); + Print #1, Spc(7); Using "#.####"; y(i) +Next +Print #1, Using "#^^^^"; x(3); +Print #1, Spc(2); Using "##.####^^^^"; y(3) +Close #1 diff --git a/Task/Write-float-arrays-to-a-text-file/Lingo/write-float-arrays-to-a-text-file-1.lingo b/Task/Write-float-arrays-to-a-text-file/Lingo/write-float-arrays-to-a-text-file-1.lingo new file mode 100644 index 0000000000..7c5b89060a --- /dev/null +++ b/Task/Write-float-arrays-to-a-text-file/Lingo/write-float-arrays-to-a-text-file-1.lingo @@ -0,0 +1,15 @@ +on saveFloatLists (filename, x, y, xprecision, yprecision) + eol = numtochar(10) -- LF + fp = xtra("fileIO").new() + fp.openFile(tFile, 2) + cnt = x.count + repeat with i = 1 to cnt + the floatPrecision = xprecision + fp.writeString(string(x[i]) + fp.writeString(TAB) + the floatPrecision = yprecision + fp.writeString(string(y[i]) + fp.writeString(eol) + end repeat + fp.closeFile() +end diff --git a/Task/Write-float-arrays-to-a-text-file/Lingo/write-float-arrays-to-a-text-file-2.lingo b/Task/Write-float-arrays-to-a-text-file/Lingo/write-float-arrays-to-a-text-file-2.lingo new file mode 100644 index 0000000000..b137d92b5a --- /dev/null +++ b/Task/Write-float-arrays-to-a-text-file/Lingo/write-float-arrays-to-a-text-file-2.lingo @@ -0,0 +1,3 @@ +x = [1.0, PI, sqrt(2)] +y = [2.0, log(10), sqrt(3)] +saveFloatLists("floats.txt", x, y, 3, 5) diff --git a/Task/Write-float-arrays-to-a-text-file/Nim/write-float-arrays-to-a-text-file.nim b/Task/Write-float-arrays-to-a-text-file/Nim/write-float-arrays-to-a-text-file.nim new file mode 100644 index 0000000000..34e7d96351 --- /dev/null +++ b/Task/Write-float-arrays-to-a-text-file/Nim/write-float-arrays-to-a-text-file.nim @@ -0,0 +1,21 @@ +import strutils, math, sequtils + +const + outFileName = "floatarr2file.txt" + +proc sqrt*(x: int64): float {.importc: "sqrt", header: "".} + +const + xprecision = 3 + yprecision = 5 + +var a: seq[int64] = @[int64(1), 2, 3, 100_000_000_000] +var b: seq[float] = @[sqrt(a[0]), sqrt(a[1]), sqrt(a[2]), sqrt(a[3])] +var c = zip(a,b) +var res: string = "" +for t in c: + res.add($formatFloat(float(t.a),ffDefault,xprecision) & "\t" & $formatFloat(t.b,ffDefault,yprecision) & "\n") + +writeFile(outFileName,res) +var res2 = readFile(outFileName) +echo(res2) diff --git a/Task/Write-float-arrays-to-a-text-file/Phix/write-float-arrays-to-a-text-file.phix b/Task/Write-float-arrays-to-a-text-file/Phix/write-float-arrays-to-a-text-file.phix new file mode 100644 index 0000000000..760139fbc0 --- /dev/null +++ b/Task/Write-float-arrays-to-a-text-file/Phix/write-float-arrays-to-a-text-file.phix @@ -0,0 +1,8 @@ +constant x = {1, 2, 3, 1e11}, + y = {1, 1.4142135623730951, 1.7320508075688772, 316227.76601683791} + +integer fn = open("filename","w") +for i=1 to length(x) do + printf(fn,"%.3g\t%.5g\n",{x[i],y[i]}) +end for +close(fn) diff --git a/Task/Write-float-arrays-to-a-text-file/Sidef/write-float-arrays-to-a-text-file.sidef b/Task/Write-float-arrays-to-a-text-file/Sidef/write-float-arrays-to-a-text-file.sidef new file mode 100644 index 0000000000..6b1d6c9ff4 --- /dev/null +++ b/Task/Write-float-arrays-to-a-text-file/Sidef/write-float-arrays-to-a-text-file.sidef @@ -0,0 +1,14 @@ +func writedat(filename, x, y, x_precision=3, y_precision=5) { + var fh = File.new(filename).open_w; + + MultiArray.new(x, y).each { |x, y| + fh.printf("%.*g\t%.*g\n", x_precision, x, y_precision, y); + } + + fh.close; +} + +var x = [1, 2, 3, 1e11]; +var y = x»sqrt»(); + +writedat('sqrt.dat', x, y); diff --git a/Task/Write-float-arrays-to-a-text-file/jq/write-float-arrays-to-a-text-file-1.jq b/Task/Write-float-arrays-to-a-text-file/jq/write-float-arrays-to-a-text-file-1.jq new file mode 100644 index 0000000000..d6b84f08d2 --- /dev/null +++ b/Task/Write-float-arrays-to-a-text-file/jq/write-float-arrays-to-a-text-file-1.jq @@ -0,0 +1,4 @@ +[1, 2, 3, 1e11] as $x +| $x | map(sqrt) as $y +| range(0; $x|length) as $i +| "\($x[$i]) \($y[$i])" diff --git a/Task/Write-float-arrays-to-a-text-file/jq/write-float-arrays-to-a-text-file-2.jq b/Task/Write-float-arrays-to-a-text-file/jq/write-float-arrays-to-a-text-file-2.jq new file mode 100644 index 0000000000..e3a2428ba1 --- /dev/null +++ b/Task/Write-float-arrays-to-a-text-file/jq/write-float-arrays-to-a-text-file-2.jq @@ -0,0 +1 @@ +$ jq -n -r -f Write_float_arrays_to_a_text_file.jq > filename diff --git a/Task/Write-language-name-in-3D-ASCII/ERRE/write-language-name-in-3d-ascii.erre b/Task/Write-language-name-in-3D-ASCII/ERRE/write-language-name-in-3d-ascii.erre new file mode 100644 index 0000000000..33a64980a9 --- /dev/null +++ b/Task/Write-language-name-in-3D-ASCII/ERRE/write-language-name-in-3d-ascii.erre @@ -0,0 +1,36 @@ +PROGRAM 3D_NAME + +DIM TBL$[17,1] + +BEGIN + +FOR I=0 TO 17 DO + READ(TBL$[I,0],TBL$[I,1]) +END FOR + +PRINT(CHR$(12);) ! CLS + +FOR I=0 TO 17 DO + PRINT(TBL$[I,1];TBL$[I,0];TBL$[I,0];TBL$[I,1]) +END FOR + +DATA("_________________ ","_____________ ") +DATA("|\ \ ","|\ \ ") +DATA("|\\_______________\ ","|\\___________\ ") +DATA("|\\| \ ","|\\| | ") +DATA("|\\| ________ | ","|\\| ________| ") +DATA("|\\| | |\| | ","|\\| | ") +DATA("|\\| |______|\| | ","|\\| |____ ") +DATA("|\\| | \| | ","|\\| | \ ") +DATA("|\\| |________| | ","|\\| |_____\ ") +DATA("|\\| | ","|\\| | ") +DATA("|\\| ___ ____/ ","|\\| _____| ") +DATA("|\\| | \\\ \ ","|\\| | ") +DATA("|\\| | \\\ \ ","|\\| | ") +DATA("|\\| | \\\ \ ","|\\| |______ ") +DATA("|\\| | \\\ \ ","|\\| | \ ") +DATA("|\\| | \\\ \ ","|\\| |_______\ ") +DATA(" \\| | \\\ \ "," \\| | ") +DATA(" \|___| \\\___\"," \|___________| ") + +END PROGRAM diff --git a/Task/Write-language-name-in-3D-ASCII/Lasso/write-language-name-in-3d-ascii.lasso b/Task/Write-language-name-in-3D-ASCII/Lasso/write-language-name-in-3d-ascii.lasso new file mode 100644 index 0000000000..49d283139b --- /dev/null +++ b/Task/Write-language-name-in-3D-ASCII/Lasso/write-language-name-in-3d-ascii.lasso @@ -0,0 +1,20 @@ +local(lasso = " +--------------------------------------------------------------- +| ,--, | +| ,---.'| ,----.. | +| | | : ,---, .--.--. .--.--. / / \\ | +| : : | ' .' \\ / / '. / / '. / . : | +| | ' : / ; '. | : /`. /| : /`. / . / ;. \\ | +| ; ; ' : : \\ ; | |--` ; | |--` . ; / ` ; | +| ' | |__ : | /\\ \\| : ;_ | : ;_ ; | ; \\ ; | | +| | | :.'|| : ' ;. :\\ \\ `. \\ \\ `. | : | ; | ' | +| ' : ;| | ;/ \\ \\`----. \\ `----. \\. | ' ' ' : | +| | | ./ ' : | \\ \\ ,'__ \\ \\ | __ \\ \\ |' ; \\; / | | +| ; : ; | | ' '--' / /`--' // /`--' / \\ \\ ', / | +| | ,/ | : : '--'. /'--'. / ; : / | +| '---' | | ,' `--'---' `--'---' \\ \\ .' | +| `--'' `---` | +---------------------------------------------------------------- +") + +stdoutnl(#lasso) diff --git a/Task/Write-language-name-in-3D-ASCII/Nim/write-language-name-in-3d-ascii.nim b/Task/Write-language-name-in-3D-ASCII/Nim/write-language-name-in-3d-ascii.nim new file mode 100644 index 0000000000..c7774b4d9b --- /dev/null +++ b/Task/Write-language-name-in-3D-ASCII/Nim/write-language-name-in-3d-ascii.nim @@ -0,0 +1,13 @@ +import strutils + +const nim = """ + # # ##### # # #### #### #### + ## # # ## ## # # # # # # + # # # # # ## # # # # # # # + # # # # # # #### # # # # + # ## # # # # # # # # # + # # ##### # # # # #### ####""" + +let lines = nim.replace("#", "<<<").replace(" ", "X").replace("X", " ").replace("\n", " Y").replace("< ", "<>").split('Y') +for i, l in lines: + echo repeatChar((lines.len - i) * 3), l diff --git a/Task/Write-language-name-in-3D-ASCII/Phix/write-language-name-in-3d-ascii.phix b/Task/Write-language-name-in-3D-ASCII/Phix/write-language-name-in-3d-ascii.phix new file mode 100644 index 0000000000..b7803c58e8 --- /dev/null +++ b/Task/Write-language-name-in-3D-ASCII/Phix/write-language-name-in-3d-ascii.phix @@ -0,0 +1,9 @@ +constant s = + "------*** * \n"& + "-----* * * \n"& + "----* * * * \n"& + "---*** * \n"& + "--* *** * * * \n"& + "-* * * * * \n"& + "* * * * * * \n" + puts(1,substitute(substitute(s,"*","_/")," "," ")) diff --git a/Task/Write-language-name-in-3D-ASCII/Sidef/write-language-name-in-3d-ascii.sidef b/Task/Write-language-name-in-3D-ASCII/Sidef/write-language-name-in-3d-ascii.sidef new file mode 100644 index 0000000000..c9e63addfe --- /dev/null +++ b/Task/Write-language-name-in-3D-ASCII/Sidef/write-language-name-in-3d-ascii.sidef @@ -0,0 +1,21 @@ +var text = <<'EOT'; + + *** + * * * ** + * * * + * * * *** ** + *** * **** * * * + * * * * ***** * + * * * * * * + * * * * * * + *** * **** *** * +EOT + +func banner3D(text, shift=-1) { + var txt = text.lines.map{|line| line.gsub('*','__/').gsub(' ',' ')}; + var offset = txt.len.of {|i| " " * (shift.abs * i)}; + shift < 0 && offset.reverse!; + (offset »+« txt).join("\n"); +}; + +say banner3D(text); diff --git a/Task/XML-DOM-serialization/Lasso/xml-dom-serialization.lasso b/Task/XML-DOM-serialization/Lasso/xml-dom-serialization.lasso new file mode 100644 index 0000000000..ecf46321d3 --- /dev/null +++ b/Task/XML-DOM-serialization/Lasso/xml-dom-serialization.lasso @@ -0,0 +1,3 @@ +content_type( 'text/xml' );// set MIME type if serving + +xml( 'Some text here' ); diff --git a/Task/XML-DOM-serialization/Lingo/xml-dom-serialization.lingo b/Task/XML-DOM-serialization/Lingo/xml-dom-serialization.lingo new file mode 100644 index 0000000000..41a2fdd801 --- /dev/null +++ b/Task/XML-DOM-serialization/Lingo/xml-dom-serialization.lingo @@ -0,0 +1,14 @@ +-- create an XML document +doc = newObject("XML", "") + +root = doc.createElement("root") +doc.appendChild(root) + +element = doc.createElement("element") +root.appendChild(element) + +textNode = doc.createTextNode("Some text here") +element.appendChild(textNode) + +put doc.toString() +-- "Some text here" diff --git a/Task/XML-DOM-serialization/Nim/xml-dom-serialization.nim b/Task/XML-DOM-serialization/Nim/xml-dom-serialization.nim new file mode 100644 index 0000000000..e8ffad4200 --- /dev/null +++ b/Task/XML-DOM-serialization/Nim/xml-dom-serialization.nim @@ -0,0 +1,13 @@ +import xmldom + +var + dom = getDOM() + document = dom.createDocument("", "root") + topElement = document.documentElement + firstElement = document.createElement "element" + textNode = document.createTextNode "Some text here" + +topElement.appendChild firstElement +firstElement.appendChild textNode + +echo document diff --git a/Task/XML-DOM-serialization/Sidef/xml-dom-serialization.sidef b/Task/XML-DOM-serialization/Sidef/xml-dom-serialization.sidef new file mode 100644 index 0000000000..e6c4c3945d --- /dev/null +++ b/Task/XML-DOM-serialization/Sidef/xml-dom-serialization.sidef @@ -0,0 +1,5 @@ +require('XML::Simple'); +print %S'XML::Simple'.XMLout( + :(root => :( element => 'Some text here' )), + NoAttr => 1, RootName => '', +); diff --git a/Task/XML-Input/8th/xml-input.8th b/Task/XML-Input/8th/xml-input.8th new file mode 100644 index 0000000000..28ce374901 --- /dev/null +++ b/Task/XML-Input/8th/xml-input.8th @@ -0,0 +1,22 @@ +\ Load the XML text into the var 'x': +quote * + + + + + + + + + +* xml:parse var, x + +\ print only xml nodes which have a tag of 'Student' and whose attributes are not empty +: .xml \ xml -- + xml:tag@ "Student" s:cmp if drop ;; then + xml:attrs null? if drop ;; then + + "Name" m:@ . cr drop ; + +\ Iterate over the XML document in the var 'x' +x @ ' .xml xml:each bye diff --git a/Task/XML-Input/Lasso/xml-input-1.lasso b/Task/XML-Input/Lasso/xml-input-1.lasso new file mode 100644 index 0000000000..53e6366153 --- /dev/null +++ b/Task/XML-Input/Lasso/xml-input-1.lasso @@ -0,0 +1,30 @@ +// makes extracting attribute values easier +define xml_attrmap(in::xml_namedNodeMap_attr) => { + local(out = map) + with attr in #in + do #out->insert(#attr->name = #attr->value) + return #out +} + +local( + text = ' + + + + + + + + +', +xml = xml(#text) +) + +local( + students = #xml -> extract('//Student'), + names = array +) +with student in #students do { + #names -> insert(xml_attrmap(#student -> attributes) -> find('Name')) +} +#names -> join('
') diff --git a/Task/XML-Input/Lasso/xml-input-2.lasso b/Task/XML-Input/Lasso/xml-input-2.lasso new file mode 100644 index 0000000000..6504278951 --- /dev/null +++ b/Task/XML-Input/Lasso/xml-input-2.lasso @@ -0,0 +1,11 @@ +// not using XML or Xpath +'
' +local( + regexp = regexp(-find = ` find) => { + #names -> insert(#regexp -> matchstring(1)) +} +#names -> join('
') diff --git a/Task/XML-Input/Lingo/xml-input.lingo b/Task/XML-Input/Lingo/xml-input.lingo new file mode 100644 index 0000000000..086c53f27d --- /dev/null +++ b/Task/XML-Input/Lingo/xml-input.lingo @@ -0,0 +1,18 @@ +q = QUOTE +r = RETURN +xml = ""&r&\ +" "&r&\ +" "&r&\ +" "&r&\ +" "&r&\ +" "&r&\ +" "&r&\ +" "&r&\ +"" + +parser = xtra("xmlparser").new() +parser.parseString(xml) +res = parser.makePropList() +repeat with c in res.child + put c.attributes.name +end repeat diff --git a/Task/XML-Input/LiveCode/xml-input.livecode b/Task/XML-Input/LiveCode/xml-input.livecode new file mode 100644 index 0000000000..67aa69a3fd --- /dev/null +++ b/Task/XML-Input/LiveCode/xml-input.livecode @@ -0,0 +1,2 @@ +put revXMLCreateTree(fld "FieldXML",true,true,false) into currTree +put revXMLAttributeValues(currTree,"Students","Student","Name",return,-1) diff --git a/Task/XML-Input/Nim/xml-input.nim b/Task/XML-Input/Nim/xml-input.nim new file mode 100644 index 0000000000..3b9c45f1a1 --- /dev/null +++ b/Task/XML-Input/Nim/xml-input.nim @@ -0,0 +1,14 @@ +import xmlparser, xmltree, streams + +let doc = newStringStream """ + + + + + + + +""" + +for i in doc.parseXml.findAll "Student": + echo i.attr "Name" diff --git a/Task/XML-Input/Sidef/xml-input.sidef b/Task/XML-Input/Sidef/xml-input.sidef new file mode 100644 index 0000000000..79a662438c --- /dev/null +++ b/Task/XML-Input/Sidef/xml-input.sidef @@ -0,0 +1,13 @@ +require('XML::Simple'); + +var ref = %S'XML::Simple'.XMLin(' + + + + + + + +'); + +ref{:Student}.each { say _{:Name} }; diff --git a/Task/XML-Output/Lasso/xml-output-1.lasso b/Task/XML-Output/Lasso/xml-output-1.lasso new file mode 100644 index 0000000000..4f33f5d584 --- /dev/null +++ b/Task/XML-Output/Lasso/xml-output-1.lasso @@ -0,0 +1,36 @@ +define character2xml(names::array, remarks::array) => { + + fail_if(#names -> size != #remarks -> size, -1, 'Input arrays not of same size') + + local( + domimpl = xml_domimplementation, + doctype = #domimpl -> createdocumenttype( + 'svg:svg', + '-//W3C//DTD SVG 1.1//EN', + 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' + ), + character_xml = #domimpl -> createdocument( + 'http://www.w3.org/2000/svg', + 'svg:svg', + #docType + ), + csnode = #character_xml -> createelement('CharacterRemarks'), + charnode + ) + + #character_xml -> appendChild(#csnode) + + loop(#names -> size) => { + #charnode = #character_xml -> createelement('Character') + #charnode -> setAttribute('name', #names -> get(loop_count)) + #charnode -> nodeValue = encode_xml(#remarks -> get(loop_count)) + #csnode -> appendChild(#charnode) + } + return #character_xml + +} + +character2xml( + array(`April`, `Tam O'Shanter`, `Emily`), + array(`Bubbly: I'm > Tam and <= Emily`, `Burns: "When chapman billies leave the street ..."`, `Short & shrift`) +) diff --git a/Task/XML-Output/Lasso/xml-output-2.lasso b/Task/XML-Output/Lasso/xml-output-2.lasso new file mode 100644 index 0000000000..db95e5910c --- /dev/null +++ b/Task/XML-Output/Lasso/xml-output-2.lasso @@ -0,0 +1,8 @@ + + + + + Bubbly: I'm > Tam and <= Emily + Burns: "When chapman billies leave the street ..." + Short & shrift + diff --git a/Task/XML-Output/Nim/xml-output.nim b/Task/XML-Output/Nim/xml-output.nim new file mode 100644 index 0000000000..ac77c9b7aa --- /dev/null +++ b/Task/XML-Output/Nim/xml-output.nim @@ -0,0 +1,11 @@ +import xmltree, strtabs, sequtils + +proc charsToXML(names, remarks): XmlNode = + result = <>CharacterRemarks() + for name, remark in items zip(names, remarks): + result.add(<>Character(name=name, remark.newText)) + +echo charsToXML(@["April", "Tam O'Shanter", "Emily"], + @["Bubbly: I'm > Tam and <= Emily", + "Burns: \"When chapman billies leave the street ...\"", + "Short & shrift"]) diff --git a/Task/XML-Output/Phix/xml-output.phix b/Task/XML-Output/Phix/xml-output.phix new file mode 100644 index 0000000000..c70b9a5276 --- /dev/null +++ b/Task/XML-Output/Phix/xml-output.phix @@ -0,0 +1,33 @@ +constant {hchars,hsubs} = columnize({{"<","<"}, + {">",">"}, + {"&","&"}, + {"\"","""}, + {"\'","'"}}) +function xmlquote_all(sequence s) + for i=1 to length(s) do + s[i] = substitute_all(s[i],hchars,hsubs) + end for + return s +end function + +function xml_CharacterRemarks(sequence data) +string res = "\n" + for i=1 to length(data) do + res &= sprintf(" %s\n",xmlquote_all(data[i])) + end for + return res & "\n" +end function + +constant testset = { + {"April", "Bubbly: I'm > Tam and <= Emily"}, + {"Tam O'Shanter", "Burns: \"When chapman billies leave the street ...\""}, + {"Emily", "Short & shrift"} +} +printf(1,xml_CharacterRemarks(testset)) + +-- Sample output: +-- +-- Bubbly: I'm &gt; Tam and &lt;= Emily +-- Burns: "When chapman billies leave the street ..." +-- Short & shrift +-- diff --git a/Task/XML-Output/Sidef/xml-output.sidef b/Task/XML-Output/Sidef/xml-output.sidef new file mode 100644 index 0000000000..30705e5925 --- /dev/null +++ b/Task/XML-Output/Sidef/xml-output.sidef @@ -0,0 +1,19 @@ +require('XML::Mini::Document'); + +var students = [ + ["April", "Bubbly: I'm > Tam and <= Emily"], + ["Tam O'Shanter", "Burns: \"When chapman billies leave the street ...\""], + ["Emily", "Short & shrift"] + ]; + +var doc = %s'XML::Mini::Document'.new; +var root = doc.getRoot; +var studs = root.createChild("CharacterRemarks"); + +students.each { |s| + var stud = studs.createChild("Character"); + stud.attribute("name", s[0]); + stud.text(s[1]); +}; + +print doc.toString; diff --git a/Task/XML-XPath/Lasso/xml-xpath.lasso b/Task/XML-XPath/Lasso/xml-xpath.lasso new file mode 100644 index 0000000000..d4607c9d63 --- /dev/null +++ b/Task/XML-XPath/Lasso/xml-xpath.lasso @@ -0,0 +1,70 @@ +// makes extracting attribute values easier +define xml_attrmap(in::xml_namedNodeMap_attr) => { + local(out = map) + with attr in #in + do #out->insert(#attr->name = #attr->value) + return #out +} + +local( + text = ' +
+ + Invisibility Cream + 14.50 + Makes you invisible + + + Levitation Salve + 23.99 + Levitate yourself for up to 3 hours per application + +
+
+ + Blork and Freen Instameal + 4.95 + A tasty meal in a tablet; just add water + + + Grob winglets + 3.56 + Tender winglets of Grob. Just add water + +
+
+', +xml = xml(#text) +) + +local( + items = #xml -> extract('//item'), + firstitem = #items -> first, + itemattr = xml_attrmap(#firstitem -> attributes), + newprices = array +) + +'First item:
+UPC: ' +#itemattr -> find('upc') +' (stock: ' +#itemattr -> find('stock') +')
' +#firstitem -> extractone('name') -> nodevalue +' [' +#firstitem -> extractone('price') -> nodevalue +'] (' +#firstitem -> extractone('description') -> nodevalue +')

' + +with item in #items +let name = #item -> extractone('name') -> nodevalue +let price = #item -> extractone('price') -> nodevalue +do { + #newprices -> insert(#name + ': ' + (decimal(#price) * 1.10) -> asstring(-precision = 2) + ' (' + #price + ')') +} +'Adjusted prices:
' +#newprices -> join('
') +'

' +'Array with all names:
' +#xml -> extract('//name') -> asstaticarray diff --git a/Task/XML-XPath/LiveCode/xml-xpath.livecode b/Task/XML-XPath/LiveCode/xml-xpath.livecode new file mode 100644 index 0000000000..029fab08e8 --- /dev/null +++ b/Task/XML-XPath/LiveCode/xml-xpath.livecode @@ -0,0 +1,14 @@ +put revXMLCreateTree(fld "FieldXML",true,true,false) into xmltree + +// task 1 +put revXMLEvaluateXPath(xmltree,"//item[1]") into nodepath +put revXMLText(xmltree,nodepath,true) + +// task 2 +put revXMLDataFromXPathQuery(xmltree,"//item/price",,comma) + +// task 3 +put revXMLDataFromXPathQuery(xmltree,"//name") into namenodes +filter namenodes without empty +split namenodes using cr +put namenodes is an array diff --git a/Task/XML-XPath/Nim/xml-xpath.nim b/Task/XML-XPath/Nim/xml-xpath.nim new file mode 100644 index 0000000000..1c1fdbdc70 --- /dev/null +++ b/Task/XML-XPath/Nim/xml-xpath.nim @@ -0,0 +1,13 @@ +import xmldom, xmldomparser + +let doc = "test3.xml".loadXMLFile.documentElement + +# 1st task: retrieve the first "item" element +let i = doc.getElementsByTagName("item")[0] + +# 2nd task: perform an action on each "price" element (print it out) +for j in doc.getElementsByTagName "price": + echo j.firstChild.PText.data + +# 3rd task: get an array of all the "name" elements +let namesArray = doc.getElementsByTagName "name" diff --git a/Task/XML-XPath/Sidef/xml-xpath.sidef b/Task/XML-XPath/Sidef/xml-xpath.sidef new file mode 100644 index 0000000000..180e8629b7 --- /dev/null +++ b/Task/XML-XPath/Sidef/xml-xpath.sidef @@ -0,0 +1,7 @@ +require('XML::XPath'); + +var x = %s'XML::XPath'.new(ARGF.slurp); + +[x.findnodes('//item[1]')][0]; +say [x.findnodes('//price')].map{x.getNodeText(_)}; +[x.findnodes('//name')]; diff --git a/Task/Xiaolin-Wus-line-algorithm/FreeBASIC/xiaolin-wus-line-algorithm.freebasic b/Task/Xiaolin-Wus-line-algorithm/FreeBASIC/xiaolin-wus-line-algorithm.freebasic new file mode 100644 index 0000000000..e617b32cc4 --- /dev/null +++ b/Task/Xiaolin-Wus-line-algorithm/FreeBASIC/xiaolin-wus-line-algorithm.freebasic @@ -0,0 +1,127 @@ +' version 21-06-2015 +' compile with: fbc -s console or fbc -s gui +' Xiaolin Wu’s line-drawing algorithm +'shared var and macro's + +Dim Shared As UInteger wu_color + +#Macro ipart(x) +Int(x) ' integer part +#EndMacro + +#Macro round(x) +Int((x) + .5) ' round off +#EndMacro + +#Macro fpart(x) +Frac(x) ' fractional part +#EndMacro + +#Macro rfpart(x) +' 1 - Frac(x) ' seems to give problems for very small x +IIf(1 - Frac(x) >= 1, 1, 1 - Frac(x)) +#EndMacro + +#Macro plot(x, y , c) +' use the alpha channel to set the amount of color +PSet(x,y), wu_color Or (Int(c * 255)) Shl 24 +#EndMacro + +Sub drawline(x0 As Single, y0 As Single, x1 As Single, y1 As Single,_ + col As UInteger = RGB(255,255,255)) + + wu_color = col And &HFFFFFF ' strip off the alpha channel information + + Dim As Single gradient + Dim As Single xend, yend, xgap, intery + Dim As UInteger xpxl1, ypxl1, xpxl2, ypxl2, x + Dim As Integer steep = Abs(y1 - y0) > Abs(x1 - x0) ' boolean + + If steep Then + Swap x0, y0 + Swap x1, y1 + End If + + If x0 > x1 Then + Swap x0, x1 + Swap y0, y1 + End If + + gradient = (y1 - y0) / (x1 - x0) + + ' first endpoint + ' xend = round(x0) + xend = ipart(x0) + yend = y0 + gradient * (xend - x0) + xgap = rfpart(x0 + .5) + xpxl1 = xend ' this will be used in the main loop + ypxl1 = ipart(yend) + If steep Then + plot(ypxl1, xpxl1, rfpart(yend) * xgap) + plot(ypxl1+1, xpxl1, fpart(yend) * xgap) + Else + plot(xpxl1, ypxl1, rfpart(yend) * xgap) + plot(xpxl1, ypxl1+1, fpart(yend) * xgap) + End If + intery = yend + gradient ' first y-intersecction for the main loop + + ' handle second endpoint + ' xend = round(x1) + xend = ipart(x1) + yend = y1 + gradient * (xend - x1) + xgap = fpart(x1 + .5) + xpxl2 = xend ' this will be used in the main loop + ypxl2 = ipart(yend) + If steep Then + plot(ypxl2, xpxl2, rfpart(yend) * xgap) + plot(ypxl2+1, xpxl2, fpart(yend) * xgap) + Else + plot(xpxl2, ypxl2, rfpart(yend) * xgap) + plot(xpxl2, ypxl2+1, fpart(yend) * xgap) + End If + + ' main loop + If steep Then + For x = xpxl1 + 1 To xpxl2 - 1 + plot(ipart(intery), x, rfpart(intery)) + plot(ipart(intery)+1, x, fpart(intery)) + intery = intery + gradient + Next + Else + For x = xpxl1 + 1 To xpxl2 - 1 + plot(x, ipart(intery), rfpart(intery)) + plot(x, ipart(intery)+1, fpart(intery)) + intery = intery + gradient + Next + End If + +End Sub + +' ------=< MAIN >=------ + +#Define W_ 600 +#Define H_ 600 + +#Include Once "fbgfx.bi" ' needed setting the screen attributes +Dim As Integer i +Dim As String fname = __FILE__ + +ScreenRes W_, H_, 32,, FB.GFX_ALPHA_PRIMITIVES + +Randomize Timer + +For i = 0 To H_ Step H_\30 + drawline(0, 0, W_, i, Int(Rnd * &HFFFFFF)) +Next + +For i = 0 To W_ Step W_\30 + drawline(0, 0, i, H_, Int(Rnd * &HFFFFFF)) +Next + +i = InStr(fname,".bas") +fname = Left(fname, Len(fname)-i+1) +WindowTitle fname + " hit any key to end program" + +While Inkey <> "" : Wend +Sleep +End diff --git a/Task/Xiaolin-Wus-line-algorithm/Sidef/xiaolin-wus-line-algorithm.sidef b/Task/Xiaolin-Wus-line-algorithm/Sidef/xiaolin-wus-line-algorithm.sidef new file mode 100644 index 0000000000..d9144130e1 --- /dev/null +++ b/Task/Xiaolin-Wus-line-algorithm/Sidef/xiaolin-wus-line-algorithm.sidef @@ -0,0 +1,58 @@ +func plot(x, y, c) { + c && printf("plot %d %d %.1f\n", x, y, c); +} + +func fpart(x) { + x - int(x); +} + +func rfpart(x) { + 1 - fpart(x); +} + +func drawLine(x0, y0, x1, y1) { + + var p = plot; + if (abs(y1 - y0) > abs(x1 - x0)) { + p = {|arg| plot(arg[1, 0, 2]) }; + (x0, y0, x1, y1) = (y0, x0, y1, x1); + } + + if (x0 > x1) { + (x0, x1, y0, y1) = (x1, x0, y1, y0); + } + + var dx = (x1 - x0); + var dy = (y1 - y0); + var gradient = (dy / dx); + + var xends = []; + var intery; + + # handle the endpoints + for x,y in [[x0, y0], [x1, y1]] { + var xend = int(x + 0.5); + var yend = (y + gradient*(xend-x)); + var xgap = rfpart(x + 0.5); + + var x_pixel = xend; + var y_pixel = yend.int; + xends << x_pixel; + + p.call(x_pixel, y_pixel , rfpart(yend) * xgap); + p.call(x_pixel, y_pixel+1, fpart(yend) * xgap); + defined(intery) && next; + + # first y-intersection for the main loop + intery = (yend + gradient); + } + + # main loop + range(xends[0]+1, xends[1]-1).each { |x| + p.call(x, intery.int, rfpart(intery)); + p.call(x, intery.int+1, fpart(intery)); + intery += gradient; + } +} + +drawLine(0, 1, 10, 2); diff --git a/Task/Y-combinator/Ceylon/y-combinator-1.ceylon b/Task/Y-combinator/Ceylon/y-combinator-1.ceylon new file mode 100644 index 0000000000..c94d06d925 --- /dev/null +++ b/Task/Y-combinator/Ceylon/y-combinator-1.ceylon @@ -0,0 +1,22 @@ +Result(*Args) y1( + Result(*Args)(Result(*Args)) f) + given Args satisfies Anything[] { + + class RecursiveFunction(o) { + shared Result(*Args)(RecursiveFunction) o; + } + + value r = RecursiveFunction((RecursiveFunction w) + => f(flatten((Args args) => w.o(w)(*args)))); + + return r.o(r); +} + +value factorialY1 = y1((Integer(Integer) fact)(Integer x) + => if (x > 1) then x * fact(x - 1) else 1); + +value fibY1 = y1((Integer(Integer) fib)(Integer x) + => if (x > 2) then fib(x - 1) + fib(x - 2) else 2); + +print(factorialY1(10)); // 3628800 +print(fibY1(10)); // 110 diff --git a/Task/Y-combinator/Ceylon/y-combinator-2.ceylon b/Task/Y-combinator/Ceylon/y-combinator-2.ceylon new file mode 100644 index 0000000000..f5a9a9f302 --- /dev/null +++ b/Task/Y-combinator/Ceylon/y-combinator-2.ceylon @@ -0,0 +1,11 @@ +Result(*Args) y2( + Result(*Args)(Result(*Args)) f) + given Args satisfies Anything[] { + + function r(Anything w) { + assert (is Result(*Args)(Anything) w); + return f(flatten((Args args) => w(w)(*args))); + } + + return r(r); +} diff --git a/Task/Y-combinator/Ceylon/y-combinator-3.ceylon b/Task/Y-combinator/Ceylon/y-combinator-3.ceylon new file mode 100644 index 0000000000..aae9c8a19b --- /dev/null +++ b/Task/Y-combinator/Ceylon/y-combinator-3.ceylon @@ -0,0 +1,4 @@ +Result(*Args) y3( + Result(*Args)(Result(*Args)) f) + given Args satisfies Anything[] + => flatten((Args args) => f(y3(f))(*args)); diff --git a/Task/Y-combinator/EchoLisp/y-combinator.echolisp b/Task/Y-combinator/EchoLisp/y-combinator.echolisp new file mode 100644 index 0000000000..74cf33ba05 --- /dev/null +++ b/Task/Y-combinator/EchoLisp/y-combinator.echolisp @@ -0,0 +1,23 @@ +;; Ref : http://www.ece.uc.edu/~franco/C511/html/Scheme/ycomb.html + + (define Y + (lambda (X) + ((lambda (procedure) + (X (lambda (arg) ((procedure procedure) arg)))) + (lambda (procedure) + (X (lambda (arg) ((procedure procedure) arg))))))) + +; Fib +(define Fib* (lambda (func-arg) + (lambda (n) (if (< n 2) n (+ (func-arg (- n 1)) (func-arg (- n 2))))))) +(define fib (Y Fib*)) +(fib 6) + → 8 + +; Fact +(define F* + (lambda (func-arg) (lambda (n) (if (zero? n) 1 (* n (func-arg (- n 1))))))) +(define fact (Y F*)) + +(fact 10) + → 3628800 diff --git a/Task/Y-combinator/Eero/y-combinator.eero b/Task/Y-combinator/Eero/y-combinator.eero new file mode 100644 index 0000000000..887964b7de --- /dev/null +++ b/Task/Y-combinator/Eero/y-combinator.eero @@ -0,0 +1,29 @@ +#import + +typedef int (^Func)(int) +typedef Func (^FuncFunc)(Func) +typedef Func (^RecursiveFunc)(id) // hide recursive typing behind dynamic typing + +Func fix(FuncFunc f) + Func r(RecursiveFunc g) + int s(int x) + return g(g)(x) + return f(s) + return r(r) + +int main(int argc, const char *argv[]) + autoreleasepool + + Func almost_fac(Func f) + return (int n | return n <= 1 ? 1 : n * f(n - 1)) + + Func almost_fib(Func f) + return (int n | return n <= 2 ? 1 : f(n - 1) + f(n - 2)) + + fib := fix(almost_fib) + fac := fix(almost_fac) + + Log('fib(10) = %d', fib(10)) + Log('fac(10) = %d', fac(10)) + + return 0 diff --git a/Task/Y-combinator/Oforth/y-combinator-1.oforth b/Task/Y-combinator/Oforth/y-combinator-1.oforth new file mode 100644 index 0000000000..0070aed0ad --- /dev/null +++ b/Task/Y-combinator/Oforth/y-combinator-1.oforth @@ -0,0 +1 @@ +: Y(f) #[ f Y f perform ] ; diff --git a/Task/Y-combinator/Oforth/y-combinator-2.oforth b/Task/Y-combinator/Oforth/y-combinator-2.oforth new file mode 100644 index 0000000000..bc69fc01a7 --- /dev/null +++ b/Task/Y-combinator/Oforth/y-combinator-2.oforth @@ -0,0 +1,2 @@ +: X(me, f) #[ me f me perform f perform ] ; +: Y(f) #X f X ; diff --git a/Task/Y-combinator/Oforth/y-combinator-3.oforth b/Task/Y-combinator/Oforth/y-combinator-3.oforth new file mode 100644 index 0000000000..9645f1c11f --- /dev/null +++ b/Task/Y-combinator/Oforth/y-combinator-3.oforth @@ -0,0 +1,11 @@ +: almost-fact(n, f) n ifZero: [ 1 ] else: [ n n 1 - f perform * ] ; +#almost-fact Y => fact + +: almost-fib(n, f) n 1 <= ifTrue: [ n ] else: [ n 1 - f perform n 2 - f perform + ] ; +#almost-fib Y => fib + +: almost-Ackermann(m, n, f) + m 0 == ifTrue: [ n 1 + return ] + n 0 == ifTrue: [ 1 m 1 - f perform return ] + n 1 - m f perform m 1 - f perform ; +#almost-Ackermann Y => Ackermann diff --git a/Task/Y-combinator/Sidef/y-combinator.sidef b/Task/Y-combinator/Sidef/y-combinator.sidef new file mode 100644 index 0000000000..c88e2050fc --- /dev/null +++ b/Task/Y-combinator/Sidef/y-combinator.sidef @@ -0,0 +1,7 @@ +var y = ->(f) {->(g) {g(g)}(->(g) { f(->(*args) {g(g)(args...)})})}; + +var fac = ->(f) { ->(n) { n < 2 ? 1 : (n * f(n-1)) } }; +say 10.of { |i| y(fac)(i) }; + +var fib = ->(f) { ->(n) { n < 2 ? n : (f(n-2) + f(n-1)) } }; +say 10.of { |i| y(fib)(i) }; diff --git a/Task/Y-combinator/Swift/y-combinator-1.swift b/Task/Y-combinator/Swift/y-combinator-1.swift new file mode 100644 index 0000000000..2e1db59e7e --- /dev/null +++ b/Task/Y-combinator/Swift/y-combinator-1.swift @@ -0,0 +1,17 @@ +struct RecursiveFunc { + let o : RecursiveFunc -> F +} + +func Y(f: (A -> B) -> A -> B) -> A -> B { + let r = RecursiveFunc B> { w in f { w.o(w)($0) } } + return r.o(r) +} + +let fac = Y { (f: Int -> Int) in + { $0 <= 1 ? 1 : $0 * f($0-1) } +} +let fib = Y { (f: Int -> Int) in + { $0 <= 2 ? 1 : f($0-1)+f($0-2) } +} +println("fac(5) = \(fac(5))") +println("fib(9) = \(fib(9))") diff --git a/Task/Y-combinator/Swift/y-combinator-2.swift b/Task/Y-combinator/Swift/y-combinator-2.swift new file mode 100644 index 0000000000..278be8c004 --- /dev/null +++ b/Task/Y-combinator/Swift/y-combinator-2.swift @@ -0,0 +1,5 @@ +func Y(f: (A -> B) -> A -> B) -> A -> B { + typealias RecursiveFunc = Any -> A -> B + let r : RecursiveFunc = { (z: Any) in let w = z as! RecursiveFunc; return f { w(w)($0) } } + return r(r) +} diff --git a/Task/Y-combinator/Swift/y-combinator-3.swift b/Task/Y-combinator/Swift/y-combinator-3.swift new file mode 100644 index 0000000000..9897679474 --- /dev/null +++ b/Task/Y-combinator/Swift/y-combinator-3.swift @@ -0,0 +1,3 @@ +func Y( f: (In->Out) -> (In->Out) ) -> (In->Out) { + return { x in f(Y(f))(x) } +} diff --git a/Task/Y-combinator/Wart/y-combinator.wart b/Task/Y-combinator/Wart/y-combinator.wart new file mode 100644 index 0000000000..2146e9601e --- /dev/null +++ b/Task/Y-combinator/Wart/y-combinator.wart @@ -0,0 +1,13 @@ +def (Y improver) + ((fn(gen) gen.gen) + (fn(gen) + (fn(n) + ((improver gen.gen) n)))) + +factorial <- (Y (fn(f) + (fn(n) + (if zero?.n + 1 + (n * (f n-1)))))) + +prn factorial.5 diff --git a/Task/Yin-and-yang/Commodore-BASIC/yin-and-yang.commodore b/Task/Yin-and-yang/Commodore-BASIC/yin-and-yang.commodore new file mode 100644 index 0000000000..dcaf6507f4 --- /dev/null +++ b/Task/Yin-and-yang/Commodore-BASIC/yin-and-yang.commodore @@ -0,0 +1,9 @@ +10 COLOR 0,1:COLOR 1,2:COLOR 4,1:GRAPHIC 1,1 +20 X=160:Y=100:R=80 +30 CIRCLE 1,X,Y,R +40 CIRCLE 1,X,Y-R/2,R/2,R/2,0,180 +50 CIRCLE 1,X,Y+R/2,R/2,R/2,180,360 +60 CIRCLE 1,X,Y-R/2,R/8 +70 CIRCLE 1,X,Y+R/2,R/8 +80 PAINT 1,X,Y+R/2 +90 PAINT 1,X-R/2,Y diff --git a/Task/Yin-and-yang/PHL/yin-and-yang.phl b/Task/Yin-and-yang/PHL/yin-and-yang.phl new file mode 100644 index 0000000000..947b2e7762 --- /dev/null +++ b/Task/Yin-and-yang/PHL/yin-and-yang.phl @@ -0,0 +1,66 @@ +module circles; + +extern printf; + +@Boolean in_circle(@Integer centre_x, @Integer centre_y, @Integer radius, @Integer x, @Integer y) [ + return (x-centre_x)*(x-centre_x)+(y-centre_y)*(y-centre_y) <= radius*radius; +] + +@Boolean in_big_circle (@Integer radius, @Integer x, @Integer y) [ + return in_circle(0, 0, radius, x, y); +] + +@Boolean in_while_semi_circle (@Integer radius, @Integer x, @Integer y) [ + return in_circle(0, radius/2, radius/2, x, y); +] + +@Boolean in_small_white_circle (@Integer radius, @Integer x, @Integer y) [ + return in_circle(0, 0-radius/2, radius/6, x, y); +] + +@Boolean in_black_semi_circle (@Integer radius, @Integer x, @Integer y) [ + return in_circle(0, 0-radius/2, radius/2, x, y); +] + +@Boolean in_small_black_circle (@Integer radius, @Integer x, @Integer y) [ + return in_circle(0, radius/2, radius/6, x, y); +] + +@Void print_yin_yang(@Integer radius) [ + var white = '.'; + var black = '#'; + var clear = ' '; + + var scale_y = 1; + var scale_x = 2; + for (var sy = radius*scale_y; sy >= -(radius*scale_y); sy=sy-1) { + for (var sx = -(radius*scale_x); sx <= radius*scale_x; sx=sx+1) { + var x = sx/(scale_x); + var y = sy/(scale_y); + + if (in_big_circle(radius, x, y)) { + if (in_while_semi_circle(radius, x, y)) + if (in_small_black_circle(radius, x, y)) + printf("%c", black); + else + printf("%c", white); + else if (in_black_semi_circle(radius, x, y)) + if (in_small_white_circle(radius, x, y)) + printf("%c", white); + else + printf("%c", black); + else if (x < 0) + printf("%c", white); + else + printf("%c", black); + } else printf("%c", clear); + } + printf("\n"); + } +] + +@Integer main [ + print_yin_yang(17); + print_yin_yang(8); + return 0; +] diff --git a/Task/Yin-and-yang/Sidef/yin-and-yang.sidef b/Task/Yin-and-yang/Sidef/yin-and-yang.sidef new file mode 100644 index 0000000000..2b4d170a51 --- /dev/null +++ b/Task/Yin-and-yang/Sidef/yin-and-yang.sidef @@ -0,0 +1,24 @@ +func circle (rad, cx, cy, fill='white', stroke='black') { + say ""; +} + +func yin_yang (rad, cx, cy, fill='white', stroke='black', angle=90) { + var (c, w) = (1, 0); + angle != 0 && say ""; + circle(rad, cx, cy, fill, stroke); + say(""); + circle(rad/5, cx, cy + rad/2, fill, stroke); + circle(rad/5, cx, cy - rad/2, stroke, fill); + angle != 0 && say ""; +} + +say ' + +'; + +yin_yang(40, 50, 50); +yin_yang(20, 120, 120); + +say ''; diff --git a/Task/Yin-and-yang/jq/yin-and-yang-1.jq b/Task/Yin-and-yang/jq/yin-and-yang-1.jq new file mode 100644 index 0000000000..0b6d952d51 --- /dev/null +++ b/Task/Yin-and-yang/jq/yin-and-yang-1.jq @@ -0,0 +1,29 @@ +def svg: + "" ; + +def draw_yinyang(x; scale): + ""; + +def define_yinyang: + " + + + + + + + " ; + +def draw: + svg, + define_yinyang, + draw_yinyang(20; .05), + draw_yinyang(8 ; .02), + "" ; + +draw diff --git a/Task/Yin-and-yang/jq/yin-and-yang-2.jq b/Task/Yin-and-yang/jq/yin-and-yang-2.jq new file mode 100644 index 0000000000..ab99b89df5 --- /dev/null +++ b/Task/Yin-and-yang/jq/yin-and-yang-2.jq @@ -0,0 +1 @@ +$ jq -M -r -n -f yin_and_yang.jq > yin_and_yang.svg diff --git a/Task/Zebra-puzzle/ERRE/zebra-puzzle.erre b/Task/Zebra-puzzle/ERRE/zebra-puzzle.erre new file mode 100644 index 0000000000..9f7cc1dd0f --- /dev/null +++ b/Task/Zebra-puzzle/ERRE/zebra-puzzle.erre @@ -0,0 +1,106 @@ +PROGRAM ZEBRA_PUZZLE + +DIM DRINK$[4],NATION$[4],COLR$[4],SMOKE$[4],ANIMAL$[4] +DIM PERM$[120],X$[4] + +PROCEDURE PERMUTATION(X$[]->X$[],OK) + LOCAL I%,J% + FOR I%=UBOUND(X$,1)-1 TO 0 STEP -1 DO + EXIT IF X$[I%]X$[],OK) + UNTIL NOT OK + +! Solve: + SOLUTIONS%=0 + T1=TIMER + FOR NATION%=1 TO 120 DO + NATION$=PERM$[NATION%] + IF LEFT$(NATION$,1)=Norway$ THEN + FOR COLR%=1 TO 120 DO + COLR$=PERM$[COLR%] + IF INSTR(COLR$,Green$+White$)<>0 AND INSTR(NATION$,England$)=INSTR(COLR$,Red$) AND ABS(INSTR(NATION$,Norway$)-INSTR(COLR$,Blue$))=1 THEN + FOR DRINK%=1 TO 120 DO + DRINK$=PERM$[DRINK%] + IF MID$(DRINK$,3,1)=Milk$ AND INSTR(NATION$,Denmark$)=INSTR(DRINK$,TeA$) AND INSTR(DRINK$,Coffee$)=INSTR(COLR$,Green$) THEN + FOR SmOKe%=1 TO 120 DO + SmOKe$=PERM$[SMOKE%] + IF INSTR(NATION$,Germany$)=INSTR(SmOKe$,Prince$) AND INSTR(SmOKe$,BlueMaster$)=INSTR(DRINK$,Beer$) AND ABS(INSTR(SmOKe$,Blend$)-INSTR(DRINK$,Water$))=1 AND INSTR(SmOKe$,Dunhill$)=INSTR(COLR$,Yellow$) THEN + FOR ANIMAL%=1 TO 120 DO + ANIMAL$=PERM$[ANIMAL%] + IF INSTR(NATION$,Sweden$)=INSTR(ANIMAL$,Dog$) AND INSTR(SmOKe$,PallMall$)=INSTR(ANIMAL$,Birds$) AND ABS(INSTR(SmOKe$,Blend$)-INSTR(ANIMAL$,Cats$))=1 AND ABS(INSTR(SmOKe$,Dunhill$)-INSTR(ANIMAL$,Horse$))=1 THEN + PRINT("House Drink Nation Colour Smoke Animal") + PRINT("---------------------------------------------------------------------------") + FOR house%=1 TO 5 DO + PRINT(house%;) + PRINT(TAB(10);DRINK$[ASC(MID$(DRINK$,house%))-65];) + PRINT(TAB(25);NATION$[ASC(MID$(NATION$,house%))-65];) + PRINT(TAB(40);COLR$[ASC(MID$(COLR$,house%))-65];) + PRINT(TAB(55);SMOKE$[ASC(MID$(SmOKe$,house%))-65];) + PRINT(TAB(70);ANIMAL$[ASC(MID$(ANIMAL$,house%))-65]) + END FOR + SOLUTIONS%=SOLUTIONS%+1 + END IF + END FOR ! ANIMAL% + END IF + END FOR ! SmOKe% + END IF + END FOR ! DRINK% + END IF + END FOR ! COLR% + END IF + END FOR ! NATION% + PRINT("Number of solutions=";SOLUTIONS%) + PRINT("Solved in ";TIMER-T1;" seconds") +END PROGRAM diff --git a/Task/Zebra-puzzle/EchoLisp/zebra-puzzle-1.echolisp b/Task/Zebra-puzzle/EchoLisp/zebra-puzzle-1.echolisp new file mode 100644 index 0000000000..55252265a4 --- /dev/null +++ b/Task/Zebra-puzzle/EchoLisp/zebra-puzzle-1.echolisp @@ -0,0 +1,72 @@ +(lib 'hash) +(lib 'amb) + +;; return #f or house# for thing/category +;; houses := (0 1 2 3 4) +(define (house-get H category thing houses) + (for/or ((i houses)) #:continue (!equal? (hash-ref (vector-ref H i) category) thing) + i)) + + ;; return house # for thing (eg cat) in category (eq animals) + ;; add thing if not already here +(define-syntax-rule (house-set thing category) + (or + (house-get H 'category 'thing houses) + (dispatch H 'category 'thing context houses ))) + +;; we know that thing/category is in a given house +(define-syntax-rule (house-force thing category house) + (dispatch H 'category 'thing context houses house)) + +;; return house# or fail if impossible +(define (dispatch H category thing context houses (forced #f)) + (define house (or forced (amb context houses))) ;; get a house number + (when (hash-ref (vector-ref H house) category) (amb-fail)) ;; fail if occupied + (hash-set (vector-ref H house) category thing) ;; else remember house contents + house) + +(define (house-next h1 h2) + (amb-require (or (= h1 (1+ h2)) (= h1 (1- h2))))) + +(define (zebra-puzzle context houses ) + (define H (build-vector 5 make-hash)) ;; house[i] := hash(category) -> thing +; In the middle house they drink milk. + (house-force milk drinks 2) +;The Norwegian lives in the first house. + (house-force norvegian people 0) +; The English man lives in the red house. + (house-force red colors(house-set english people)) +; The Swede has a dog. + (house-force dog animals (house-set swede people)) +; The Dane drinks tea. + (house-force tea drinks (house-set dane people)) +; The green house is immediately to the left of the white house. + (amb-require (= (house-set green colors) (1- (house-set white colors)))) +; They drink coffee in the green house. + (house-force coffee drinks (house-set green colors)) +; The man who smokes Pall Mall has birds. + (house-force birds animals (house-set pallmall smoke)) +; In the yellow house they smoke Dunhill. + (house-force dunhill smoke (house-set yellow colors)) +; The Norwegian lives next to the blue house. + (house-next (house-set norvegian people) (house-set blue colors)) +; The man who smokes Blend lives in the house next to the house with cats. + (house-next (house-set blend smoke) (house-set cats animals)) +; In a house next to the house where they have a horse, they smoke Dunhill. + (house-next (house-set horse animals) (house-set dunhill smoke)) +; The man who smokes Blue Master drinks beer. + (house-force beer drinks (house-set bluemaster smoke)) +; The German smokes Prince. + (house-force prince smoke (house-set german people)) +; They drink water in a house next to the house where they smoke Blend. + (house-next (house-set water drinks) (house-set blend smoke)) + +;; Finally .... the zebra 🐴 + (house-set 🐴 animals) + + (for ((i houses)) + (writeln i (hash-values (vector-ref H i)))) + (writeln '----------) + + (amb-fail) ;; will ensure ALL solutions are printed +) diff --git a/Task/Zebra-puzzle/EchoLisp/zebra-puzzle-2.echolisp b/Task/Zebra-puzzle/EchoLisp/zebra-puzzle-2.echolisp new file mode 100644 index 0000000000..5ca2483744 --- /dev/null +++ b/Task/Zebra-puzzle/EchoLisp/zebra-puzzle-2.echolisp @@ -0,0 +1,12 @@ +(define (task) + (amb-run zebra-puzzle (amb-make-context) (iota 5))) + +(task) + → +0 (norvegian yellow dunhill cats water) +1 (dane tea blue blend horse) +2 (milk english red pallmall birds) +3 (green coffee german prince 🐴) +4 (swede dog white bluemaster beer) +---------- + → #f diff --git a/Task/Zebra-puzzle/FormulaOne/zebra-puzzle.formulaone b/Task/Zebra-puzzle/FormulaOne/zebra-puzzle.formulaone new file mode 100644 index 0000000000..4dcce11669 --- /dev/null +++ b/Task/Zebra-puzzle/FormulaOne/zebra-puzzle.formulaone @@ -0,0 +1,175 @@ +// First, let's give some variables some values: +Nationality = Englishman | Swede | Dane | Norwegian | German +Colour = Red | Green | Yellow | Blue | White +Cigarette = PallMall | Dunhill | BlueMaster | Blend | Prince +Domestic = Dog | Bird | Cat | Zebra | Horse +Beverage = Tea | Coffee | Milk | Beer | Water +HouseOrder = First | Second | Third | Fourth | Fifth + +{ +We use injections to make the array-elements unique. +Example: 'Pet' is an array of unique elements of type 'Domestic', indexed by 'Nationality'. +In the predicate 'Zebra', we use this injection 'Pet' to define the array-variable 'pet'. +The symbol used is the '->>'. 'Nationality->>Domestic' can be read as 'Domestic(Nationality)' in "plain array-speak"; +the difference being that the elements are by definition unique. + +So, in FormulaOne we use a formula like: 'pet(Swede) = Dog', which simply means that the 'Swede' (type 'Nationality') +has a 'pet' (type 'Pet', which is of type 'Domestic', indexed by 'Nationality'), which appears to be a 'Dog' (type 'Domestic'). +Or, one could say that the 'Swede' has been mapped to the 'Dog' (Oh, well...). +} + +Pet = Nationality->>Domestic +Drink = Nationality->>Beverage +HouseColour = Nationality->>Colour +Smoke = Nationality->>Cigarette +Order = HouseOrder->>Nationality + +pred Zebra(houseColour::HouseColour, pet::Pet, smoke::Smoke, drink::Drink, order::Order) iff + +// For convenience sake, some temporary place_holder variables are used. +// An underscore distinguishes them: + + houseColour(green_house) = Green & + houseColour(white_house) = White & + houseColour(yellow_house) = Yellow & + smoke(pallmall_smoker) = PallMall & + smoke(blend_smoker) = Blend & + smoke(dunhill_smoker) = Dunhill & + smoke(bluemaster_smoker) = BlueMaster & + pet(cat_keeper) = Cat & + pet(neighbour_dunhill_smoker) = Horse & + +{ 2. The English man lives in the red house: } + houseColour(Englishman) = Red & + +{ 3. The Swede has a dog: } + pet(Swede) = Dog & + +{ 4. The Dane drinks tea: } + drink(Dane) = Tea & + + { 'smoke' and 'drink' are both nouns, like the other variables. + One could read the formulas like: 'the colour of the Englishman's house is Red' -> + 'the Swede's pet is a dog' -> 'the Dane's drink is tea'. + } + +{ 5. The green house is immediately to the left of the white house: } + { The local predicate 'LeftOf' determines the order: } + LeftOf(green_house, white_house, order) & + +{ 6. They drink coffee in the green house: } + drink(green_house) = Coffee & + +{ 7. The man who smokes Pall Mall has birds: } + pet(pallmall_smoker) = Bird & + +{ 8. In the yellow house they smoke Dunhill: } + smoke(yellow_house) = Dunhill & + +{ 9. In the middle house they drink milk: } + drink(order(Third)) = Milk & + +{10. The Norwegian lives in the first house: } + order(First) = Norwegian & + +{11. The man who smokes Blend lives in the house next to the house with cats: } + { Another local predicate 'Neighbour' makes them neighbours:} + Neighbour(blend_smoker, cat_keeper, order) & + +{12. In a house next to the house where they have a horse, they smoke Dunhill: } + Neighbour(dunhill_smoker, neighbour_dunhill_smoker, order) & + +{13. The man who smokes Blue Master drinks beer: } + drink(bluemaster_smoker) = Beer & + +{14. The German smokes Prince: } + smoke(German) = Prince & + +{15. The Norwegian lives next to the blue house: } + {10. The Norwegian lives in the first house, + so the blue house is the second house } + houseColour(order(Second)) = Blue & + +{16. They drink water in a house next to the house where they smoke Blend: } + drink(neighbour_blend_smoker) = Water & + Neighbour(blend_smoker, neighbour_blend_smoker, order) + +{ A simplified solution would number the houses 1, 2, 3, 4, 5 + which makes it easier to order the houses. + 'right in the center' would become 3; 'in the first house', 1 + But we stick to the original puzzle and use some local predicates. +} + +local pred Neighbour(neighbour1::Nationality, neighbour2::Nationality, order::Order)iff + neighbour1 <> neighbour2 & + order(house1) = neighbour1 & + order(house2) = neighbour2 & + ( house1 = house2 + 1 | + house1 = house2 - 1 ) + +local pred LeftOf(neighbour1::Nationality, neighbour2::Nationality, order::Order) iff + neighbour1 <> neighbour2 & + order(house1) = neighbour1 & + order(house2) = neighbour2 & + house1 = house2 - 1 + +{ +The 'all'-query in FormulaOne: + all Zebra(houseColour, pet, smokes, drinks, order) +gives, of course, only one solution, so it can be replaced by: + one Zebra(houseColour, pet, smokes, drinks, order) +} + +// The compacted version: + +Nationality = Englishman | Swede | Dane | Norwegian | German +Colour = Red | Green | Yellow | Blue | White +Cigarette = PallMall | Dunhill | BlueMaster | Blend | Prince +Domestic = Dog | Bird | Cat | Zebra | Horse +Beverage = Tea | Coffee | Milk | Beer | Water +HouseOrder = First | Second | Third | Fourth | Fifth + +Pet = Nationality->>Domestic +Drink = Nationality->>Beverage +HouseColour = Nationality->>Colour +Smoke = Nationality->>Cigarette +Order = HouseOrder->>Nationality + +pred Zebra(houseColour::HouseColour, pet::Pet, smoke::Smoke, drink::Drink, order::Order) iff + + houseColour(green_house) = Green & + houseColour(white_house) = White & + houseColour(yellow_house) = Yellow & + smoke(pallmall_smoker) = PallMall & + smoke(blend_smoker) = Blend & + smoke(dunhill_smoker) = Dunhill & + smoke(bluemaster_smoker) = BlueMaster & + pet(cat_keeper) = Cat & + pet(neighbour_dunhill_smoker) = Horse & + + houseColour(Englishman) = Red & + pet(Swede) = Dog & + drink(Dane) = Tea & + LeftOf(green_house, white_house, order) & + drink(green_house) = Coffee & + pet(pallmall_smoker) = Bird & + smoke(yellow_house) = Dunhill & + drink(order(Third)) = Milk & + order(First) = Norwegian & + Neighbour(blend_smoker, cat_keeper, order) & + Neighbour(dunhill_smoker, neighbour_dunhill_smoker, order) & + drink(bluemaster_smoker) = Beer & + smoke(German) = Prince & + houseColour(order(Second)) = Blue & + drink(neighbour_blend_smoker) = Water & + Neighbour(blend_smoker, neighbour_blend_smoker, order) + +local pred Neighbour(neighbour1::Nationality, neighbour2::Nationality, order::Order)iff + neighbour1 <> neighbour2 & + order(house1) = neighbour1 & order(house2) = neighbour2 & + ( house1 = house2 + 1 | house1 = house2 - 1 ) + +local pred LeftOf(neighbour1::Nationality, neighbour2::Nationality, order::Order) iff + neighbour1 <> neighbour2 & + order(house1) = neighbour1 & order(house2) = neighbour2 & + house1 = house2 - 1 diff --git a/Task/Zebra-puzzle/Phix/zebra-puzzle.phix b/Task/Zebra-puzzle/Phix/zebra-puzzle.phix new file mode 100644 index 0000000000..c6a276c06c --- /dev/null +++ b/Task/Zebra-puzzle/Phix/zebra-puzzle.phix @@ -0,0 +1,81 @@ +enum Colour, Nationality, Drink, Smoke, Pet +constant Colours = {"red","white","green","yellow","blue"}, + Nationalities = {"English","Swede","Dane","Norwegian","German"}, + Drinks = {"tea","coffee","milk","beer","water"}, + Smokes = {"Pall Mall","Dunhill","Blend","Blue Master","Prince"}, + Pets = {"dog","birds","cats","horse","zebra"}, + Sets = {Colours,Nationalities,Drinks,Smokes,Pets} + +constant tagset5 = tagset(5) -- {1,2,3,4,5}, oft-permuted +sequence perm = repeat(tagset5,5) -- perm[1] is Colour of each house, etc + +function house(integer i, string name) + return find(find(name,Sets[i]),perm[i]) +end function + +function left_of(integer h1, integer h2) + return (h1-h2)==1 +end function + +function next_to(integer h1, integer h2) + return abs(h1-h2)==1 +end function + +procedure print_house(integer i) + printf(1,"%d:%s,%s,%s,%s,%s\n",{i, + Colours[perm[Colour][i]], + Nationalities[perm[Nationality][i]], + Drinks[perm[Drink][i]], + Smokes[perm[Smoke][i]], + Pets[perm[Pet][i]]}) +end procedure + +integer solutions = 0 +sequence solperms = {} +atom t0 = time() +constant factorial5 = factorial(5) +for C=1 to factorial5 do + perm[Colour] = permute(C,tagset5) + if left_of(house(Colour,"green"),house(Colour,"white")) then + for N=1 to factorial5 do + perm[Nationality] = permute(N,tagset5) + if house(Nationality,"Norwegian")==1 + and house(Nationality,"English")==house(Colour,"red") + and next_to(house(Nationality,"Norwegian"),house(Colour,"blue")) then + for D=1 to factorial5 do + perm[Drink] = permute(D,tagset5) + if house(Nationality,"Dane")==house(Drink,"tea") + and house(Drink,"coffee")==house(Colour,"green") + and house(Drink,"milk")==3 then + for S=1 to factorial5 do + perm[Smoke] = permute(S,tagset5) + if house(Colour,"yellow")==house(Smoke,"Dunhill") + and house(Nationality,"German")==house(Smoke,"Prince") + and house(Smoke,"Blue Master")==house(Drink,"beer") + and next_to(house(Drink,"water"),house(Smoke,"Blend")) then + for P=1 to factorial5 do + perm[Pet] = permute(P,tagset5) + if house(Nationality,"Swede")==house(Pet,"dog") + and house(Smoke,"Pall Mall")==house(Pet,"birds") + and next_to(house(Smoke,"Blend"),house(Pet,"cats")) + and next_to(house(Pet,"horse"),house(Smoke,"Dunhill")) then + for i=1 to 5 do + print_house(i) + end for + solutions += 1 + solperms = append(solperms,perm) + end if + end for + end if + end for + end if + end for + end if + end for + end if +end for +printf(1,"%d solution%s found (%3.3fs).\n",{solutions,iff(solutions>1,"s",""),time()-t0}) +for i=1 to length(solperms) do + perm = solperms[i] + printf(1,"The %s owns the Zebra\n",{Nationalities[house(Pet,"zebra")]}) +end for diff --git a/Task/Zebra-puzzle/Sidef/zebra-puzzle.sidef b/Task/Zebra-puzzle/Sidef/zebra-puzzle.sidef new file mode 100644 index 0000000000..adf87ef48f --- /dev/null +++ b/Task/Zebra-puzzle/Sidef/zebra-puzzle.sidef @@ -0,0 +1,52 @@ +var CONTENT = Hash( + :House => nil, + :Nationality => [:English, :Swedish, :Danish, :Norwegian, :German], + :Colour => [:Red, :Green, :White, :Blue, :Yellow], + :Pet => [:Dog, :Birds, :Cats, :Horse, :Zebra], + :Drink => [:Tea, :Coffee, :Milk, :Beer, :Water], + :Smoke => [:PallMall, :Dunhill, :BlueMaster, :Prince, :Blend] +) + +func adjacent(n,i,g,e) { + (0..3).any {|x| (n[x]==i && g[x+1]==e) || (n[x+1]==i && g[x]==e) } +} + +func leftof(n,i,g,e) { + (0..3).any {|x| n[x]==i && g[x+1]==e } +} + +func coincident(n,i,g,e) { + n.indices.any {|x| n[x]==i && g[x]==e } +} + +func solve { + CONTENT{:Nationality}.permutations{|nation| + nation.first == :Norwegian -> + && CONTENT{:Colour}.permutations {|colour| + leftof(colour,:Green,colour,:White) -> + && coincident(nation,:English,colour,:Red) -> + && adjacent(nation,:Norwegian,colour,:Blue) -> + && CONTENT{:Pet}.permutations {|pet| + coincident(nation,:Swedish,pet,:Dog) -> + && CONTENT{:Drink}.permutations {|drink| + drink[2] == :Milk -> + && coincident(nation,:Danish,drink,:Tea) -> + && coincident(colour,:Green,drink,:Coffee) -> + && CONTENT{:Smoke}.permutations {|smoke| + coincident(smoke,:PallMall,pet,:Birds) -> + && coincident(smoke,:Dunhill,colour,:Yellow) -> + && coincident(smoke,:BlueMaster,drink,:Beer) -> + && coincident(smoke,:Prince,nation,:German) -> + && adjacent(smoke,:Blend,pet,:Cats) -> + && adjacent(smoke,:Blend,drink,:Water) -> + && adjacent(smoke,:Dunhill,pet,:Horse) -> + && return [nation,colour,pet,drink,smoke] +} } } } } } + +var res = solve(); +var keys = [:House, :Nationality, :Colour, :Pet, :Drink, :Smoke] +var width = keys.map{ .len } +var fmt = width.map{|w| "%-#{w+2}s" }.join(" ") +say "The Zebra is owned by the man who is #{res[0][res[2].first_index(:Zebra)]}\n" +say (fmt % keys..., "\n", fmt % width.map{|w| "-"*w }...) +res[0].indices.map{|i| res.map{|a| a[i] }}.each_kv {|k,v| say fmt%(k,v...) } diff --git a/Task/Zebra-puzzle/jq/zebra-puzzle-1.jq b/Task/Zebra-puzzle/jq/zebra-puzzle-1.jq new file mode 100644 index 0000000000..1e53a67952 --- /dev/null +++ b/Task/Zebra-puzzle/jq/zebra-puzzle-1.jq @@ -0,0 +1,22 @@ +# Attempt to unify the input object with the specified object +def unify( object ): + # Attempt to unify the input object with the specified tag:value + def unify2(tag; value): + if . == null then null + elif .[tag] == value then . + elif .[tag] == null then .[tag] = value + else null + end; + reduce (object|keys[]) as $key + (.; unify2($key; object[$key]) ); + +# Input: an array +# Output: if the i-th element can be made to satisfy the condition, +# then the updated array, otherwise empty. +def enforce(i; cond): + if 0 <= i and i < length + then + (.[i] | cond) as $ans + | if $ans then .[i] = $ans else empty end + else empty + end ; diff --git a/Task/Zebra-puzzle/jq/zebra-puzzle-2.jq b/Task/Zebra-puzzle/jq/zebra-puzzle-2.jq new file mode 100644 index 0000000000..f5788e0acd --- /dev/null +++ b/Task/Zebra-puzzle/jq/zebra-puzzle-2.jq @@ -0,0 +1,60 @@ +# Each house is a JSON object of the form: +# { "number": _, "nation": _, "owns": _, "color": _, "drinks": _, "smokes": _} + +# The list of houses is represented by an array of five such objects. + +# Input: an array of objects representing houses. +# Output: [i, solution] where i is the entity unified with obj +# and solution is the updated array +def solve_with_index( obj ): + . as $Houses + | range(0; length) as $i + | ($Houses[$i] | unify(obj)) as $H + | if $H then $Houses[$i] = $H else empty end + | [ $i, .] ; + +def solve( object ): + solve_with_index( object )[1]; + +def adjacent( obj1; obj2 ): + solve_with_index(obj1) as $H + | $H[1] + | (enforce( $H[0] - 1; unify(obj2) ), + enforce( $H[0] + 1; unify(obj2) )) ; + +def left_right( obj1; obj2 ): + solve_with_index(obj1) as $H + | $H[1] + | enforce( $H[0] + 1; unify(obj2) ) ; + + +# All solutions by generate-and-test +def zebra: + [range(0;5)] | map({"number": .}) # Five houses + + | enforce( 0; unify( {"nation": "norwegian"} ) ) + | enforce( 2; unify( {"drinks": "milk"} ) ) + + | solve( {"nation": "englishman", "color": "red"} ) + | solve( {"nation": "swede", "owns": "dog"} ) + | solve( {"nation": "dane", "drinks": "tea"} ) + + | left_right( {"color": "green"}; {"color": "white"}) + + | solve( {"drinks": "coffee", "color": "green"} ) + | solve( {"smokes": "Pall Mall", "owns": "birds"} ) + | solve( {"color": "yellow", "smokes": "Dunhill"} ) + + | adjacent( {"smokes": "Blend" }; {"owns": "cats"} ) + | adjacent( {"owns": "horse"}; {"smokes": "Dunhill"}) + + | solve( {"drinks": "beer", "smokes": "Blue Master"} ) + | solve( {"nation": "german", "smokes": "Prince"}) + + | adjacent( {"nation": "norwegian"}; {"color": "blue"}) + | adjacent( {"drinks": "water"}; {"smokes": "Blend"}) + + | solve( {"owns": "zebra"} ) +; + +zebra diff --git a/Task/Zebra-puzzle/jq/zebra-puzzle-3.jq b/Task/Zebra-puzzle/jq/zebra-puzzle-3.jq new file mode 100644 index 0000000000..670a86c46b --- /dev/null +++ b/Task/Zebra-puzzle/jq/zebra-puzzle-3.jq @@ -0,0 +1,48 @@ +$ time jq -n -f zebra.jq +[ + { + "number": 0, + "nation": "norwegian", + "color": "yellow", + "smokes": "Dunhill", + "owns": "cats", + "drinks": "water" + }, + { + "number": 1, + "drinks": "tea", + "nation": "dane", + "smokes": "Blend", + "owns": "horse", + "color": "blue" + }, + { + "number": 2, + "drinks": "milk", + "color": "red", + "nation": "englishman", + "owns": "birds", + "smokes": "Pall Mall" + }, + { + "number": 3, + "color": "green", + "drinks": "coffee", + "nation": "german", + "smokes": "Prince", + "owns": "zebra" + }, + { + "number": 4, + "nation": "swede", + "owns": "dog", + "color": "white", + "drinks": "beer", + "smokes": "Blue Master" + } +] + +# Times include compilation: +real 0m0.284s +user 0m0.260s +sys 0m0.005s diff --git a/Task/Zeckendorf-number-representation/EchoLisp/zeckendorf-number-representation.echolisp b/Task/Zeckendorf-number-representation/EchoLisp/zeckendorf-number-representation.echolisp new file mode 100644 index 0000000000..a1a51ef843 --- /dev/null +++ b/Task/Zeckendorf-number-representation/EchoLisp/zeckendorf-number-representation.echolisp @@ -0,0 +1,27 @@ +;; special fib's starting with 1 2 3 5 ... +(define (fibonacci n) + (+ (fibonacci (1- n)) (fibonacci (- n 2)))) +(remember 'fibonacci #(1 2)) + +(define-constant Φ (// (1+ (sqrt 5)) 2)) +(define-constant logΦ (log Φ)) +;; find i : fib(i) >= n +(define (iFib n) + (floor (// (log (+ (* n Φ) 0.5)) logΦ))) + +;; left trim zeroes +(string-delimiter "") +(define (zeck->string digits) + (if (!= 0 (first digits)) + (string-join digits "") + (zeck->string (rest digits)))) + +(define (Zeck n) + (cond + (( < n 0) "no negative zeck") + ((inexact? n) "no floating zeck") + ((zero? n) "0") + (else (zeck->string + (for/list ((s (reverse (take fibonacci (iFib n))))) + (if ( > s n) 0 + (begin (-= n s) 1 ))))))) diff --git a/Task/Zeckendorf-number-representation/FreeBASIC/zeckendorf-number-representation.freebasic b/Task/Zeckendorf-number-representation/FreeBASIC/zeckendorf-number-representation.freebasic new file mode 100644 index 0000000000..58942fa6af --- /dev/null +++ b/Task/Zeckendorf-number-representation/FreeBASIC/zeckendorf-number-representation.freebasic @@ -0,0 +1,68 @@ +' version 17-10-2016 +' compile with: fbc -s console + +#Define max 92 ' max for Fibonacci number + +Dim Shared As ULongInt fib(max) + +fib(0) = 1 +fib(1) = 1 + +For x As Integer = 2 To max + fib(x) = fib(x-1) + fib(x-2) +Next + +Function num2zeck(n As Integer) As String + +If n < 0 Then + Print "Error: no negative numbers allowed" + Beep : Sleep 5000,1 : End +End If + +If n < 2 Then Return Str(n) + + Dim As String zeckendorf + + For x As Integer = max To 1 Step -1 + If fib(x) <= n Then + zeckendorf = zeckendorf + "1" + n = n - fib(x) + Else + zeckendorf = zeckendorf + "0" + End If + Next + + return LTrim(zeckendorf, "0") ' get rid of leading zeroes +End Function + +' ------=< MAIN >=------ + +Dim As Integer x, e +Dim As String zeckendorf +Print "number zeckendorf" + +For x = 0 To 200000 + + zeckendorf = num2zeck(x) + If x <= 20 Then Print x, zeckendorf + + ' check for two consecutive Fibonacci numbers + If InStr(zeckendorf, "11") <> 0 Then + Print " Error: two consecutive Fibonacci numbers "; x, zeckendorf + e = e +1 + End If +Next + +Print +If e = 0 Then + Print " No Zeckendorf numbers with two consecutive Fibonacci numbers found" +Else + Print e; " error(s) found" +End If + + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Zeckendorf-number-representation/Nim/zeckendorf-number-representation.nim b/Task/Zeckendorf-number-representation/Nim/zeckendorf-number-representation.nim new file mode 100644 index 0000000000..04d555bf9c --- /dev/null +++ b/Task/Zeckendorf-number-representation/Nim/zeckendorf-number-representation.nim @@ -0,0 +1,19 @@ +import strutils + +proc z(n): string = + if n == 0: return "0" + var fib = @[2,1] + var n = n + while fib[0] < n: fib.insert(fib[0] + fib[1]) + result = "" + for f in fib: + if f <= n: + result.add '1' + n -= f + else: + result.add '0' + if result[0] == '0': + result = result[1..result.high] + +for i in 0 .. 20: + echo align($i, 3)," ",align(z(i), 8) diff --git a/Task/Zeckendorf-number-representation/Sidef/zeckendorf-number-representation.sidef b/Task/Zeckendorf-number-representation/Sidef/zeckendorf-number-representation.sidef new file mode 100644 index 0000000000..1b7d32ec2f --- /dev/null +++ b/Task/Zeckendorf-number-representation/Sidef/zeckendorf-number-representation.sidef @@ -0,0 +1,21 @@ +func fib(n) is cached { + n < 2 ? 1 + : (fib(n-1) + fib(n-2)); +} + +func zeckendorf(n) { + n == 0 && return '0'; + var i = 1; + ++i while (fib(i) <= n); + gather { + while (--i > 0) { + var f = fib(i); + f > n ? (take '0') + : (take '1'; n -= f); + } + }.join(''); +} + +range(0, 20).each { |n| + printf("%4d: %8s\n", n, zeckendorf(n)) +} diff --git a/Task/Zeckendorf-number-representation/jq/zeckendorf-number-representation-1.jq b/Task/Zeckendorf-number-representation/jq/zeckendorf-number-representation-1.jq new file mode 100644 index 0000000000..d8b8771040 --- /dev/null +++ b/Task/Zeckendorf-number-representation/jq/zeckendorf-number-representation-1.jq @@ -0,0 +1,23 @@ +def zeckendorf: + # rfibs(n) returns an array of fibonnaci numbers up to n, + # beginning with 1, 2, ..., in reverse order + def rfibs(n): + # input: [f(i-2), f(i-1)] + [1,1] | [recurse( if .[1] >= n then empty + else [.[1], add] + end ) | .[1]] | reverse; + + . as $n + # [n, rfibs, digit ] + | [$n, rfibs($n), "" ] + | [ recurse( .[0] as $n | .[1] as $f + | if ($f|length) == 0 then empty + else + $f[0] as $next + | if $n >= $next then [ ( $n - $next), $f[1:], "1"] + else [ $n, $f[1:], "0"] + end + end ) + | .[2] ] + | if .[1] == "0" then .[2:] else . end # remove leading 0 if any + | join("") ; diff --git a/Task/Zeckendorf-number-representation/jq/zeckendorf-number-representation-2.jq b/Task/Zeckendorf-number-representation/jq/zeckendorf-number-representation-2.jq new file mode 100644 index 0000000000..62dcd38d90 --- /dev/null +++ b/Task/Zeckendorf-number-representation/jq/zeckendorf-number-representation-2.jq @@ -0,0 +1 @@ +range(0;21) | "\(.): \(zeckendorf)" diff --git a/Task/Zeckendorf-number-representation/jq/zeckendorf-number-representation-3.jq b/Task/Zeckendorf-number-representation/jq/zeckendorf-number-representation-3.jq new file mode 100644 index 0000000000..5a8fe38e04 --- /dev/null +++ b/Task/Zeckendorf-number-representation/jq/zeckendorf-number-representation-3.jq @@ -0,0 +1,22 @@ +$ jq -n -r -f zeckendorf.jq +0: +1: 1 +2: 10 +3: 100 +4: 101 +5: 1000 +6: 1001 +7: 1010 +8: 10000 +9: 10001 +10: 10010 +11: 10100 +12: 10101 +13: 100000 +14: 100001 +15: 100010 +16: 100100 +17: 100101 +18: 101000 +19: 101001 +20: 101010 diff --git a/Task/Zero-to-the-zero-power/8th/zero-to-the-zero-power.8th b/Task/Zero-to-the-zero-power/8th/zero-to-the-zero-power.8th new file mode 100644 index 0000000000..7f06db040d --- /dev/null +++ b/Task/Zero-to-the-zero-power/8th/zero-to-the-zero-power.8th @@ -0,0 +1 @@ +0 0 ^ . diff --git a/Task/Zero-to-the-zero-power/ERRE/zero-to-the-zero-power.erre b/Task/Zero-to-the-zero-power/ERRE/zero-to-the-zero-power.erre new file mode 100644 index 0000000000..97b4d7e92f --- /dev/null +++ b/Task/Zero-to-the-zero-power/ERRE/zero-to-the-zero-power.erre @@ -0,0 +1,3 @@ +..... +PRINT(0^0) +..... diff --git a/Task/Zero-to-the-zero-power/EchoLisp/zero-to-the-zero-power.echolisp b/Task/Zero-to-the-zero-power/EchoLisp/zero-to-the-zero-power.echolisp new file mode 100644 index 0000000000..d5bcdcf8fe --- /dev/null +++ b/Task/Zero-to-the-zero-power/EchoLisp/zero-to-the-zero-power.echolisp @@ -0,0 +1,7 @@ +;; trying the 16 combinations +;; all return the integer 1 + +(lib 'bigint) +(define zeroes '(integer: 0 inexact=float: 0.000 complex: 0+0i bignum: #0)) +(for* ((z1 zeroes) (z2 zeroes)) (write (expt z1 z2))) + → 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 diff --git a/Task/Zero-to-the-zero-power/FreeBASIC/zero-to-the-zero-power.freebasic b/Task/Zero-to-the-zero-power/FreeBASIC/zero-to-the-zero-power.freebasic new file mode 100644 index 0000000000..86fb67b75a --- /dev/null +++ b/Task/Zero-to-the-zero-power/FreeBASIC/zero-to-the-zero-power.freebasic @@ -0,0 +1,4 @@ +' FB 1.05.0 Win64 + +Print "0 ^ 0 ="; 0 ^ 0 +Sleep diff --git a/Task/Zero-to-the-zero-power/FutureBasic/zero-to-the-zero-power.futurebasic b/Task/Zero-to-the-zero-power/FutureBasic/zero-to-the-zero-power.futurebasic new file mode 100644 index 0000000000..c956bb63e4 --- /dev/null +++ b/Task/Zero-to-the-zero-power/FutureBasic/zero-to-the-zero-power.futurebasic @@ -0,0 +1,3 @@ +include "ConsoleWindow" + +print 0^0 diff --git a/Task/Zero-to-the-zero-power/Nim/zero-to-the-zero-power.nim b/Task/Zero-to-the-zero-power/Nim/zero-to-the-zero-power.nim new file mode 100644 index 0000000000..22386e077e --- /dev/null +++ b/Task/Zero-to-the-zero-power/Nim/zero-to-the-zero-power.nim @@ -0,0 +1,3 @@ +import math + +echo pow(0, 0) diff --git a/Task/Zero-to-the-zero-power/Oforth/zero-to-the-zero-power.oforth b/Task/Zero-to-the-zero-power/Oforth/zero-to-the-zero-power.oforth new file mode 100644 index 0000000000..288cb8739f --- /dev/null +++ b/Task/Zero-to-the-zero-power/Oforth/zero-to-the-zero-power.oforth @@ -0,0 +1 @@ +0 0 pow println diff --git a/Task/Zero-to-the-zero-power/Phix/zero-to-the-zero-power.phix b/Task/Zero-to-the-zero-power/Phix/zero-to-the-zero-power.phix new file mode 100644 index 0000000000..e560784295 --- /dev/null +++ b/Task/Zero-to-the-zero-power/Phix/zero-to-the-zero-power.phix @@ -0,0 +1 @@ +?power(0,0) diff --git a/Task/Zero-to-the-zero-power/Ring/zero-to-the-zero-power.ring b/Task/Zero-to-the-zero-power/Ring/zero-to-the-zero-power.ring new file mode 100644 index 0000000000..8157de8cb7 --- /dev/null +++ b/Task/Zero-to-the-zero-power/Ring/zero-to-the-zero-power.ring @@ -0,0 +1,4 @@ +x = 0 +y = 0 +z = pow(x,y) +see "z=" + z + nl # z=1 diff --git a/Task/Zero-to-the-zero-power/Sidef/zero-to-the-zero-power-1.sidef b/Task/Zero-to-the-zero-power/Sidef/zero-to-the-zero-power-1.sidef new file mode 100644 index 0000000000..25295b1c59 --- /dev/null +++ b/Task/Zero-to-the-zero-power/Sidef/zero-to-the-zero-power-1.sidef @@ -0,0 +1,6 @@ +[0, Complex(0, 0)].each {|n| + say n**n; + say n.pow(n); + say pow(n, n); + say Math.pow(n, n); +} diff --git a/Task/Zero-to-the-zero-power/Sidef/zero-to-the-zero-power-2.sidef b/Task/Zero-to-the-zero-power/Sidef/zero-to-the-zero-power-2.sidef new file mode 100644 index 0000000000..d6c347c223 --- /dev/null +++ b/Task/Zero-to-the-zero-power/Sidef/zero-to-the-zero-power-2.sidef @@ -0,0 +1,2 @@ +say 0.root(0).pow(0); # => 1 +say ((0**(1/0))**0); # => 1 diff --git a/Task/Zero-to-the-zero-power/Swift/zero-to-the-zero-power.swift b/Task/Zero-to-the-zero-power/Swift/zero-to-the-zero-power.swift new file mode 100644 index 0000000000..2b2c9b2e28 --- /dev/null +++ b/Task/Zero-to-the-zero-power/Swift/zero-to-the-zero-power.swift @@ -0,0 +1,2 @@ +import Darwin +print(pow(0.0,0.0)) diff --git a/Task/Zero-to-the-zero-power/Ursa/zero-to-the-zero-power.ursa b/Task/Zero-to-the-zero-power/Ursa/zero-to-the-zero-power.ursa new file mode 100644 index 0000000000..c0fa27e91b --- /dev/null +++ b/Task/Zero-to-the-zero-power/Ursa/zero-to-the-zero-power.ursa @@ -0,0 +1,2 @@ +> out (pow 0 0) endl console +1.0 diff --git a/Task/Zero-to-the-zero-power/XLISP/zero-to-the-zero-power.xlisp b/Task/Zero-to-the-zero-power/XLISP/zero-to-the-zero-power.xlisp new file mode 100644 index 0000000000..18e985e054 --- /dev/null +++ b/Task/Zero-to-the-zero-power/XLISP/zero-to-the-zero-power.xlisp @@ -0,0 +1,5 @@ +XLISP 3.3, September 6, 2002 Copyright (c) 1984-2002, by David Betz +[1] (expt 0 0) + +1 +[2] diff --git a/Task/Zero-to-the-zero-power/jq/zero-to-the-zero-power.jq b/Task/Zero-to-the-zero-power/jq/zero-to-the-zero-power.jq new file mode 100644 index 0000000000..ef4db71e23 --- /dev/null +++ b/Task/Zero-to-the-zero-power/jq/zero-to-the-zero-power.jq @@ -0,0 +1 @@ +def power(y): y as $y | if $y == 0 then 1 elif . == 0 then 0 else log * $y | exp end; diff --git a/Task/Zhang-Suen-thinning-algorithm/FreeBASIC/zhang-suen-thinning-algorithm.freebasic b/Task/Zhang-Suen-thinning-algorithm/FreeBASIC/zhang-suen-thinning-algorithm.freebasic new file mode 100644 index 0000000000..8a2a28cb24 --- /dev/null +++ b/Task/Zhang-Suen-thinning-algorithm/FreeBASIC/zhang-suen-thinning-algorithm.freebasic @@ -0,0 +1,135 @@ +' version 08-10-2016 +' compile with: fbc -s console + +Data "00000000000000000000000000000000" +Data "01111111110000000111111110000000" +Data "01110001111000001111001111000000" +Data "01110000111000001110000111000000" +Data "01110001111000001110000000000000" +Data "01111111110000001110000000000000" +Data "01110111100000001110000111000000" +Data "01110011110011101111001111011100" +Data "01110001111011100111111110011100" +Data "00000000000000000000000000000000" +Data "END" + +' ------=< MAIN >=------ + +Dim As UInteger x, y, m, n +Dim As String input_str + +Do ' find out how big it is + Read input_str + If input_str = "END" Then Exit Do + If x < Len(input_str) Then x = Len(input_str) + y = y + 1 +Loop + +m = x -1 : n = y -1 +ReDim As UByte old(m, n), new_(m, n) + +y = 0 +Restore ' restore data pointer +Do ' put data in array + Read input_str + If input_str="END" Then Exit Do + For x = 0 To Len(input_str) -1 + old(x,y) = input_str[x] - Asc("0") + ' print image + If old(x, y) = 0 Then Print "."; Else Print "#"; + Next + Print + y = y + 1 +Loop + +'corners and sides do not change +For x = 0 To m + new_(x, 0) = old(x, 0) + new_(x, n) = old(x, n) +Next + +For y = 0 To n + new_(0, y) = old(0, y) + new_(m, y) = old(m, y) +Next + +Dim As UInteger tmp, change, stage = 1 +Do + change = 0 + For y = 1 To n -1 + For x = 1 To m -1 + ' -1- + If old(x,y) = 0 Then ' first condition, p1 must be black + new_(x,y) = 0 + Continue For + End If + ' -2- + tmp = old(x, y -1) + old(x +1, y -1) + tmp = tmp + old(x +1, y) + old(x +1, y +1) + old(x, y +1) + tmp = tmp + old(x -1, y +1) + old(x -1, y) + old(x -1, y -1) + If tmp < 2 OrElse tmp > 6 Then ' 2 <= B(p1) <= 6 + new_(x, y) = 1 + Continue For + End If + ' -3- + tmp = 0 + If old(x , y ) = 0 And old(x , y -1) = 1 Then tmp += 1 ' p1 > p2 + If old(x , y -1) = 0 And old(x +1, y -1) = 1 Then tmp += 1 ' p2 > p3 + If old(x +1, y -1) = 0 And old(x +1, y ) = 1 Then tmp += 1 ' p3 > p4 + If old(x +1, y ) = 0 And old(x +1, y +1) = 1 Then tmp += 1 ' p4 > p5 + If old(x +1, y +1) = 0 And old(x , y +1) = 1 Then tmp += 1 ' p5 > p6 + If old(x , y +1) = 0 And old(x -1, y +1) = 1 Then tmp += 1 ' p6 > p7 + If old(x -1, y +1) = 0 And old(x -1, y ) = 1 Then tmp += 1 ' p7 > p8 + If old(x -1, y ) = 0 And old(x -1, y -1) = 1 Then tmp += 1 ' p8 > p9 + If old(x -1, y -1) = 0 And old(x , y -1) = 1 Then tmp += 1 ' p9 > p2 + ' tmp = 1 ==> A(P1) = 1 + If tmp <> 1 Then + new_(x, y) = 1 + Continue For + End If + If (stage And 1) = 1 Then + ' step 1 -4- -5- + If (old(x, y -1) + old(x +1, y) + old(x, y +1)) = 3 OrElse _ + (old(x +1, y) + old(x, y +1) + old(x -1, y)) = 3 Then + new_(x, y) = 1 + Continue For + End If + Else + ' step 2 -4- -5- + If (old(x, y -1) + old(x +1, y) + old(x -1, y)) = 3 OrElse _ + (old(x, y -1) + old(x, y +1) + old(x -1, y)) = 3 Then + new_(x, y) = 1 + Continue For + End If + End If + ' all condition are met, make p1 white (0) + new_(x, y) = 0 + change = 1 ' flag change + Next + Next + + ' copy new_() into old() + For y = 0 To n + For x = 0 To m + old(x, y) = new_(x, y) + Next + Next + + stage += 1 +Loop Until change = 0 ' stop when there are no changes made + +Print ' print result +Print "End result" +For y = 0 To n + For x = 0 To m + If old(x, y) = 0 Then Print "."; Else Print "#"; + Next + Print +Next + + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Zhang-Suen-thinning-algorithm/Phix/zhang-suen-thinning-algorithm.phix b/Task/Zhang-Suen-thinning-algorithm/Phix/zhang-suen-thinning-algorithm.phix new file mode 100644 index 0000000000..2f512b8afd --- /dev/null +++ b/Task/Zhang-Suen-thinning-algorithm/Phix/zhang-suen-thinning-algorithm.phix @@ -0,0 +1,65 @@ +constant n = {{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1},{-1,0}}; + +function AB(sequence text, integer y, x, step) +integer wtb = 0, bn = 0 +integer prev = '#', next +string p2468 = "" + for i=1 to length(n) do + next = text[y+n[i][1]][x+n[i][2]] + wtb += (prev='.' and next<='#') + bn += (i>1 and next<='#') + if and_bits(i,1)=0 then p2468 = append(p2468,prev) end if + prev = next + end for + if step=2 then -- make it p6842 + p2468 = p2468[3..4]&p2468[1..2] + end if + return {wtb,bn,p2468} +end function + +procedure Zhang_Suen(sequence text) +integer wtb, bn, changed, changes +string p2468 -- (p6842 for step 2) + text = split(text,'\n') + while 1 do + changed = 0 + for step=1 to 2 do + changes = 0 + for y=2 to length(text)-1 do + for x=2 to length(text[y])-1 do + if text[y][x]='#' then + {wtb,bn,p2468} = AB(text,y,x,step) + if wtb=1 + and bn>=2 and bn<=6 + and find('.',p2468[1..3]) + and find('.',p2468[2..4])then + changes = 1 + text[y][x] = '!' -- (logically still black) + end if + end if + end for + end for + if changes then + for y=2 to length(text)-1 do + text[y] = substitute(text[y],"!",".") + end for + changed = 1 + end if + end for + if not changed then exit end if + end while + puts(1,join(text,"\n")) +end procedure + +string small_rc = """ +................................ +.#########.......########....... +.###...####.....####..####...... +.###....###.....###....###...... +.###...####.....###............. +.#########......###............. +.###.####.......###....###...... +.###..####..###.####..####.###.. +.###...####.###..########..###.. +................................""" +Zhang_Suen(small_rc) diff --git a/Task/Zhang-Suen-thinning-algorithm/Sidef/zhang-suen-thinning-algorithm.sidef b/Task/Zhang-Suen-thinning-algorithm/Sidef/zhang-suen-thinning-algorithm.sidef new file mode 100644 index 0000000000..fa543dfebf --- /dev/null +++ b/Task/Zhang-Suen-thinning-algorithm/Sidef/zhang-suen-thinning-algorithm.sidef @@ -0,0 +1,57 @@ +class ZhangSuen(str, black="1") { + const NEIGHBOURS = [[-1,0],[-1,1],[0,1],[1,1],[1,0],[1,-1],[0,-1],[-1,-1]] # 8 neighbors + const CIRCULARS = (NEIGHBOURS + [NEIGHBOURS.first]) # P2, ... P9, P2 + + has r = 0; + has image = [[]]; + + method init { + var s1 = str.lines.map{|line| line.chars.map{|c| c==black ? 1 : 0 }} + var s2 = s1.len.of { s1[0].len.of(0) } + var xr = RangeNum(1, s1.end-1) + var yr = RangeNum(1, s1[0].end-1) + do { + r = 0; + xr.each{|x| yr.each{|y| s2[x][y] = (s1[x][y] - self.zs(s1,x,y,1)) }} # Step 1 + xr.each{|x| yr.each{|y| s1[x][y] = (s2[x][y] - self.zs(s2,x,y,0)) }} # Step 2 + } while !r.is_zero; + image = s1; + } + + method zs(ng,x,y,g) { + (ng[x][y] == 0) -> + || (ng[x-1][y] + ng[x][y+1] + ng[x+g][y+g - 1] == 3) -> + || (ng[x+g - 1][y+g] + ng[x+1][y] + ng[x][y-1] == 3) -> + && return 0; + + var bp1 = NEIGHBOURS.map {|p| ng[x+p[0]][y+p[1]] }.sum(0); # B(P1) + return 0 if ((bp1 < 2) || (6 < bp1)); + + var ap1 = 0; + CIRCULARS.map {|p| ng[x+p[0]][y+p[1]] }.each_cons(2, {|p| + ++ap1 if (p[0] < p[1]) # A(P1) + }) + + return 0 if (ap1 != 1); + r = 1 + } + + method display { + image.each{|row| say row.map{|col| col ? '#' : ' ' }.join } + } +} + +var text = <1 THEN I%-=1 END IF + ELSE + IF I%1 THEN J%-=1 END IF + END IF + END FOR + + FOR ROW%=0 TO SIZE%-1 DO + FOR COL%=0 TO SIZE%-1 DO + WRITE("###";ARRAY%[ROW%,COL%];) + END FOR + PRINT + END FOR +END PROGRAM diff --git a/Task/Zig-zag-matrix/FreeBASIC/zig-zag-matrix.freebasic b/Task/Zig-zag-matrix/FreeBASIC/zig-zag-matrix.freebasic new file mode 100644 index 0000000000..52c4c6ee81 --- /dev/null +++ b/Task/Zig-zag-matrix/FreeBASIC/zig-zag-matrix.freebasic @@ -0,0 +1,74 @@ +' FB 1.05.0 Win64 + +Dim As Integer n + +Do + Input "Enter size of matrix "; n +Loop Until n > 0 + +Dim zigzag(1 To n, 1 To n) As Integer '' all zero by default + +' enter the numbers 0 to (n^2 - 1) in the matrix's anti-diagonals +zigzag(1, 1) = 0 +If n > 1 Then + Dim As Integer row = 0, col = 3 + Dim As Boolean down = true, increment = true + Dim As Integer i = 0, j = 2, k + Do + If down Then + For k = 1 To j + i += 1 + row += 1 + col -= 1 + zigzag(row, col) = i + Next + down = false + Else + For k = 1 To j + i += 1 + row -= 1 + col += 1 + zigzag(row, col) = i + Next + down = true + End If + If increment Then + j += 1 + If j > n Then + j = n - 1 + increment = false + End If + Else + j -= 1 + If j = 0 Then Exit Do + End If + If down AndAlso increment Then + col += 2 + row -= 1 + ElseIf Not Down AndAlso increment Then + row += 2 + col -= 1 + ElseIf down AndAlso Not increment Then + col += 1 + Else '' Not down AndAlso NotIncrement + row += 1 + End If + Loop +End If + +' print zigzag matrix if n < 20 +Print +If n < 20 Then + For i As Integer = 1 To n + For j As Integer = 1 To n + Print Using "####"; zigzag(i, j); + Next j + Print + Next i +Else + Print "Matrix is too big to display on 80 column console" +End If + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Zig-zag-matrix/Lasso/zig-zag-matrix.lasso b/Task/Zig-zag-matrix/Lasso/zig-zag-matrix.lasso new file mode 100644 index 0000000000..af5a5d2abf --- /dev/null +++ b/Task/Zig-zag-matrix/Lasso/zig-zag-matrix.lasso @@ -0,0 +1,75 @@ +var( + 'square' = array + ,'size' = integer( 5 )// for a 5 X 5 square + ,'row' = array + ,'x' = integer( 1 ) + ,'y' = integer( 1 ) + ,'counter' = integer( 1 ) +); + +// create place-holder matrix +loop( $size ); + $row = array; + + loop( $size ); + $row->insert( 0 ); + + /loop; + + $square->insert( $row ); + +/loop; + +while( $counter < $size * $size ); + // check downward diagonal + if( + $x > 1 + && + $y < $square->size + && + $square->get( $y + 1 )->get( $x - 1 ) == 0 + ); + + $x -= 1; + $y += 1; + + // check upward diagonal + else( + $x < $square->size + && + $y > 1 + && + $square->get( $y - 1 )->get( $x + 1 ) == 0 + ); + + $x += 1; + $y -= 1; + + // check right + else( + ( + $y == 1 + || + $y == $square->size + ) + && + $x < $square->size + && + $square->get( $y )->get( $x + 1 ) == 0 + ); + + $x += 1; + + // down + else; + $y += 1; + + /if; + + $square->get( $y )->get( $x ) = loop_count; + + $counter += 1; + +/while; + +$square; diff --git a/Task/Zig-zag-matrix/Nim/zig-zag-matrix.nim b/Task/Zig-zag-matrix/Nim/zig-zag-matrix.nim new file mode 100644 index 0000000000..acdf9992b4 --- /dev/null +++ b/Task/Zig-zag-matrix/Nim/zig-zag-matrix.nim @@ -0,0 +1,36 @@ +import algorithm, strutils + +type Pos = tuple[x, y: int] + +template newSeqWith(len: int, init: expr): expr = + var result {.gensym.} = newSeq[type(init)](len) + for i in 0 .. 1),y+1}:{x+1,y}) + else + {x,y} = iff(x1)}:{x,y+1}) + end if +end for + +for i=1 to n do + m[i] = join(m[i]) +end for +puts(1,join(m,"\n")) diff --git a/Task/Zig-zag-matrix/Sidef/zig-zag-matrix.sidef b/Task/Zig-zag-matrix/Sidef/zig-zag-matrix.sidef new file mode 100644 index 0000000000..d7eca2a07f --- /dev/null +++ b/Task/Zig-zag-matrix/Sidef/zig-zag-matrix.sidef @@ -0,0 +1,24 @@ +func zig_zag(w, h) { + + var r = []; + var n = 0; + + h.of { |e| + w.of { |f| + [e-1, f-1] + } + } \ + -> reduce('+') \ + -> sort { |a, b| + (a[0]+a[1] <=> b[0]+b[1]) || + (a[0]+a[1] -> is_even ? a[0]<=>b[0] + : a[1]<=>b[1]) + } \ + -> each { |a| + r[a[1]][a[0]] = n++; + } + + return r; +} + +zig_zag(5, 5).each {say .join('', {|i| "%4i" % i})}; diff --git a/Task/Zig-zag-matrix/jq/zig-zag-matrix-1.jq b/Task/Zig-zag-matrix/jq/zig-zag-matrix-1.jq new file mode 100644 index 0000000000..c6c1730b59 --- /dev/null +++ b/Task/Zig-zag-matrix/jq/zig-zag-matrix-1.jq @@ -0,0 +1,18 @@ +# Create an m x n matrix + def matrix(m; n; init): + if m == 0 then [] + elif m == 1 then [range(0;n)] | map(init) + elif m > 0 then + matrix(1;n;init) as $row + | [range(0;m)] | map( $row ) + else error("matrix\(m);_;_) invalid") + end ; + +# Print a matrix neatly, each cell occupying n spaces +def neatly(n): + def right: tostring | ( " " * (n-length) + .); + . as $in + | length as $length + | reduce range (0;$length) as $i + (""; . + reduce range(0;$length) as $j + (""; "\(.) \($in[$i][$j] | right )" ) + "\n" ) ; diff --git a/Task/Zig-zag-matrix/jq/zig-zag-matrix-2.jq b/Task/Zig-zag-matrix/jq/zig-zag-matrix-2.jq new file mode 100644 index 0000000000..348b52c3d2 --- /dev/null +++ b/Task/Zig-zag-matrix/jq/zig-zag-matrix-2.jq @@ -0,0 +1,19 @@ +def zigzag(n): + + # unless m == n*n, place m at (i,j), pointing + # in the direction d, where d = [drow, dcolumn]: + def _next(i; j; m; d): + if m == (n*n) then . else .[i][j] = m end + | if m == (n*n) - 1 then . + elif i == n-1 then if j+1 < n then .[i][j+1] = m+1 | _next(i-1; j+2; m+2; [-1, 1]) else . end + elif i == 0 then if j+1 < n then .[i][j+1] = m+1 | _next(i+1; j ; m+2; [ 1,-1]) + else .[i+1][j] = m+1 | _next(i+2; j-1; m+2; [ 1,-1]) end + elif j == n-1 then if i+1 < n then .[i+1][j] = m+1 | _next(i+2; j-1; m+2; [ 1,-1]) else . end + elif j == 0 then if i+1 < n then .[i+1][j] = m+1 | _next(i; j+1; m+2; [-1, 1]) + else .[i][j+1] = m+1 | _next(i-1; j+1; m+2; [-1, 1]) end + else _next(i+ d[0]; j+ d[1]; m+1; d) + end ; + matrix(n;n;-1) | _next(0;0; 0; [0,1]) ; + +# Example +zigzag(5) | neatly(4)

1/5, + beth => 1/6, + gimel => 1/7, + daleth => 1/8, + he => 1/9, + waw => 1/10, + zayin => 1/11 +) +  +ps{:heth} = (1 - ps.values.sum) +  +var picker = prob_choice_picker(ps) +var results = Hash() +  +TRIALS.times { + results{picker()} := 0 ++; +} +  +say "Event Occurred Expected Difference"; +for k,v in (results.sort_by {|k| results{k} }.reverse) { + printf("%-6s  %f  %f  %f\n", + k, v/TRIALS, ps{k}, + abs(v/TRIALS - ps{k}) + ); +} diff --git a/Task/Problem-of-Apollonius/Lasso/problem-of-apollonius.lasso b/Task/Problem-of-Apollonius/Lasso/problem-of-apollonius.lasso new file mode 100644 index 0000000000..5cbeaba8fc --- /dev/null +++ b/Task/Problem-of-Apollonius/Lasso/problem-of-apollonius.lasso @@ -0,0 +1,59 @@ +define solveApollonius(c1, c2, c3, s1, s2, s3) => { + local( + x1 = decimal(#c1->get(1)), + y1 = decimal(#c1->get(2)), + r1 = decimal(#c1->get(3)) + ) + local( + x2 = decimal(#c2->get(1)), + y2 = decimal(#c2->get(2)), + r2 = decimal(#c2->get(3)) + ) + local( + x3 = decimal(#c3->get(1)), + y3 = decimal(#c3->get(2)), + r3 = decimal(#c3->get(3)) + ) + local( + v11 = 2*#x2 - 2*#x1, + v12 = 2*#y2 - 2*#y1, + v13 = #x1*#x1 - #x2*#x2 + #y1*#y1 - #y2*#y2 - #r1*#r1 + #r2*#r2, + v14 = 2*#s2*#r2 - 2*#s1*#r1, + + v21 = 2*#x3 - 2*#x2, + v22 = 2*#y3 - 2*#y2, + v23 = #x2*#x2 - #x3*#x3 + #y2*#y2 - #y3*#y3 - #r2*#r2 + #r3*#r3, + v24 = 2*#s3*#r3 - 2*#s2*#r2, + + w12 = #v12/#v11, + w13 = #v13/#v11, + w14 = #v14/#v11, + + w22 = #v22/#v21-#w12, + w23 = #v23/#v21-#w13, + w24 = #v24/#v21-#w14, + + P = -#w23/#w22, + Q = #w24/#w22, + M = -#w12*#P-#w13, + N = #w14 - #w12*#Q, + + a = #N*#N + #Q*#Q - 1, + b = 2*#M*#N - 2*#N*#x1 + 2*#P*#Q - 2*#Q*#y1 + 2*#s1*#r1, + c = #x1*#x1 + #M*#M - 2*#M*#x1 + #P*#P + #y1*#y1 - 2*#P*#y1 - #r1*#r1 + + ) + + // Find a root of a quadratic equation. This requires the circle centers not to be e.g. colinear + local( + D = #b*#b-4*#a*#c, + rs = (-#b - #D->sqrt)/(2*#a), + + xs = #M+#N*#rs, + ys = #P+#Q*#rs + ) + return (:#xs, #ys, #rs) +} +// Tests: +solveApollonius((:0, 0, 1), (:4, 0, 1), (:2, 4, 2), 1,1,1) +solveApollonius((:0, 0, 1), (:4, 0, 1), (:2, 4, 2), -1,-1,-1) diff --git a/Task/Problem-of-Apollonius/Nim/problem-of-apollonius.nim b/Task/Problem-of-Apollonius/Nim/problem-of-apollonius.nim new file mode 100644 index 0000000000..a0b995e65a --- /dev/null +++ b/Task/Problem-of-Apollonius/Nim/problem-of-apollonius.nim @@ -0,0 +1,48 @@ +import math + +type Circle = tuple[x, y, r: float] + +proc solveApollonius(c1, c2, c3: Circle; s1, s2, s3: float): Circle = + let + v11 = 2*c2.x - 2*c1.x + v12 = 2*c2.y - 2*c1.y + v13 = c1.x*c1.x - c2.x*c2.x + c1.y*c1.y - c2.y*c2.y - c1.r*c1.r + c2.r*c2.r + v14 = 2*s2*c2.r - 2*s1*c1.r + + v21 = 2*c3.x - 2*c2.x + v22 = 2*c3.y - 2*c2.y + v23 = c2.x*c2.x - c3.x*c3.x + c2.y*c2.y - c3.y*c3.y - c2.r*c2.r + c3.r*c3.r + v24 = 2*s3*c3.r - 2*s2*c2.r + + w12 = v12/v11 + w13 = v13/v11 + w14 = v14/v11 + + w22 = v22/v21-w12 + w23 = v23/v21-w13 + w24 = v24/v21-w14 + + p = -w23/w22 + q = w24/w22 + m = -w12*p-w13 + n = w14 - w12*q + + a = n*n + q*q - 1 + b = 2*m*n - 2*n*c1.x + 2*p*q - 2*q*c1.y + 2*s1*c1.r + c = c1.x*c1.x + m*m - 2*m*c1.x + p*p + c1.y*c1.y - 2*p*c1.y - c1.r*c1.r + + d = b*b-4*a*c + rs = (-b-sqrt(d))/(2*a) + + xs = m+n*rs + ys = p+q*rs + + return (xs, ys, rs) + +let + c1: Circle = (0.0, 0.0, 1.0) + c2: Circle = (4.0, 0.0, 1.0) + c3: Circle = (2.0, 4.0, 2.0) + +echo solveApollonius(c1, c2, c3, 1.0, 1.0, 1.0) +echo solveApollonius(c1, c2, c3, -1.0, -1.0, -1.0) diff --git a/Task/Problem-of-Apollonius/Sidef/problem-of-apollonius.sidef b/Task/Problem-of-Apollonius/Sidef/problem-of-apollonius.sidef new file mode 100644 index 0000000000..8435132047 --- /dev/null +++ b/Task/Problem-of-Apollonius/Sidef/problem-of-apollonius.sidef @@ -0,0 +1,48 @@ +class Circle(x,y,r) { + method to_s { "Circle(#{x}, #{y}, #{r})" } +} + +func solve_apollonius(c, s) { + + var(c1, c2, c3) = c...; + var(s1, s2, s3) = s...; + + var 𝑣11 = (2*c2.x - 2*c1.x); + var 𝑣12 = (2*c2.y - 2*c1.y); + var 𝑣13 = (c1.x**2 - c2.x**2 + c1.y**2 - c2.y**2 - c1.r**2 + c2.r**2); + var 𝑣14 = (2*s2*c2.r - 2*s1*c1.r); + + var 𝑣21 = (2*c3.x - 2*c2.x); + var 𝑣22 = (2*c3.y - 2*c2.y); + var 𝑣23 = (c2.x**2 - c3.x**2 + c2.y**2 - c3.y**2 - c2.r**2 + c3.r**2); + var 𝑣24 = (2*s3*c3.r - 2*s2*c2.r); + + var 𝑤12 = (𝑣12 / 𝑣11); + var 𝑤13 = (𝑣13 / 𝑣11); + var 𝑤14 = (𝑣14 / 𝑣11); + + var 𝑤22 = (𝑣22/𝑣21 - 𝑤12); + var 𝑤23 = (𝑣23/𝑣21 - 𝑤13); + var 𝑤24 = (𝑣24/𝑣21 - 𝑤14); + + var 𝑃 = (-𝑤23 / 𝑤22); + var 𝑄 = (𝑤24 / 𝑤22); + var 𝑀 = (-𝑤12*𝑃 - 𝑤13); + var 𝑁 = (𝑤14 - 𝑤12*𝑄); + + var 𝑎 = (𝑁**2 + 𝑄**2 - 1); + var 𝑏 = (2*𝑀*𝑁 - 2*𝑁*c1.x + 2*𝑃*𝑄 - 2*𝑄*c1.y + 2*s1*c1.r); + var 𝑐 = (c1.x**2 + 𝑀**2 - 2*𝑀*c1.x + 𝑃**2 + c1.y**2 - 2*𝑃*c1.y - c1.r**2); + + var 𝐷 = (𝑏**2 - 4*𝑎*𝑐); + var rs = ((-𝑏 - 𝐷.sqrt) / 2*𝑎); + + var xs = (𝑀 + 𝑁*rs); + var ys = (𝑃 + 𝑄*rs); + + Circle(xs, ys, rs); +} + +var c = [Circle(0, 0, 1), Circle(4, 0, 1), Circle(2, 4, 2)]; +say solve_apollonius(c, %n<1 1 1>); +say solve_apollonius(c, %n<-1 -1 -1>); diff --git a/Task/Problem-of-Apollonius/Swift/problem-of-apollonius.swift b/Task/Problem-of-Apollonius/Swift/problem-of-apollonius.swift new file mode 100644 index 0000000000..6e04f9c65e --- /dev/null +++ b/Task/Problem-of-Apollonius/Swift/problem-of-apollonius.swift @@ -0,0 +1,72 @@ +import Foundation + +struct Circle { + let center:[Double]! + let radius:Double! + + init(center:[Double], radius:Double) { + self.center = center + self.radius = radius + } + + func toString() -> String { + return "Circle[x=\(center[0]),y=\(center[1]),r=\(radius)]" + } +} + +func solveApollonius(c1:Circle, c2:Circle, c3:Circle, + s1:Double, s2:Double, s3:Double) -> Circle { + + let x1 = c1.center[0] + let y1 = c1.center[1] + let r1 = c1.radius + let x2 = c2.center[0] + let y2 = c2.center[1] + let r2 = c2.radius + let x3 = c3.center[0] + let y3 = c3.center[1] + let r3 = c3.radius + + let v11 = 2*x2 - 2*x1 + let v12 = 2*y2 - 2*y1 + let v13 = x1*x1 - x2*x2 + y1*y1 - y2*y2 - r1*r1 + r2*r2 + let v14 = 2*s2*r2 - 2*s1*r1 + + let v21 = 2*x3 - 2*x2 + let v22 = 2*y3 - 2*y2 + let v23 = x2*x2 - x3*x3 + y2*y2 - y3*y3 - r2*r2 + r3*r3 + let v24 = 2*s3*r3 - 2*s2*r2 + + let w12 = v12/v11 + let w13 = v13/v11 + let w14 = v14/v11 + + let w22 = v22/v21-w12 + let w23 = v23/v21-w13 + let w24 = v24/v21-w14 + + let P = -w23/w22 + let Q = w24/w22 + let M = -w12*P-w13 + let N = w14 - w12*Q + + let a = N*N + Q*Q - 1 + let b = 2*M*N - 2*N*x1 + 2*P*Q - 2*Q*y1 + 2*s1*r1 + let c = x1*x1 + M*M - 2*M*x1 + P*P + y1*y1 - 2*P*y1 - r1*r1 + + let D = b*b-4*a*c + + let rs = (-b - sqrt(D)) / (2*a) + let xs = M + N * rs + let ys = P + Q * rs + + return Circle(center: [xs,ys], radius: rs) + +} + +let c1 = Circle(center: [0,0], radius: 1) +let c2 = Circle(center: [4,0], radius: 1) +let c3 = Circle(center: [2,4], radius: 2) + +println(solveApollonius(c1,c2,c3,1,1,1).toString()) +println(solveApollonius(c1,c2,c3,-1,-1,-1).toString()) diff --git a/Task/Problem-of-Apollonius/jq/problem-of-apollonius-1.jq b/Task/Problem-of-Apollonius/jq/problem-of-apollonius-1.jq new file mode 100644 index 0000000000..73a5e0e307 --- /dev/null +++ b/Task/Problem-of-Apollonius/jq/problem-of-apollonius-1.jq @@ -0,0 +1,51 @@ +def circle: + {"x": .[0], "y": .[1], "r": .[2]}; + +# Find the interior or exterior Apollonius circle of three circles: +# ap(circle, circle, circle, boolean) +# Specify s as true for interior; false for exterior +def ap(c1; c2; c3; s): + def sign: if s then -. else . end; + (c1.x * c1.x) as $x1sq + | (c1.y * c1.y) as $y1sq + | (c1.r * c1.r) as $r1sq + | (c2.x * c2.x) as $x2sq + | (c2.y * c2.y) as $y2sq + | (c2.r * c2.r) as $r2sq + | (c3.x * c3.x) as $x3sq + | (c3.y * c3.y) as $y3sq + | (c3.r * c3.r) as $r3sq + + | (2 * (c2.x - c1.x)) as $v11 + | (2 * (c2.y - c1.y)) as $v12 + | ($x1sq - $x2sq + $y1sq - $y2sq - $r1sq + $r2sq) as $v13 + + | (2 * (c2.r - c1.r) | sign) as $v14 + | (2 * (c3.x - c2.x)) as $v21 + | (2 * (c3.y - c2.y)) as $v22 + + | ($x2sq - $x3sq + $y2sq - $y3sq - $r2sq + $r3sq) as $v23 + | ( 2 * c3.r - c2.r | sign) as $v24 + | ($v12 / $v11) as $w12 + | ($v13 / $v11) as $w13 + | ($v14 / $v11) as $w14 + + | (($v22 / $v21) - $w12) as $w22 + | (($v23 / $v21) - $w13) as $w23 + | (($v24 / $v21) - $w14) as $w24 + + | (-$w23 / $w22) as $p + | ( $w24 / $w22) as $q + | ((-$w12*$p) - $w13) as $m + | ( $w14 - ($w12*$q)) as $n + + | ( $n*$n + $q*$q - 1 ) as $a + | (2 * (($m*$n - $n*c1.x + $p*$q - $q*c1.y) + (c1.r|sign))) as $b + | ($x1sq + $m*$m - 2*$m*c1.x + $p*$p + $y1sq - 2*$p*c1.y - $r1sq) as $c + + | ( $b*$b - 4*$a*$c ) as $d # discriminant + | (( -$b - (($d|sqrt))) / (2 * $a)) as $rs # root + + | [$m + ($n*$rs), $p + ($q*$rs), $rs] + | circle +; diff --git a/Task/Problem-of-Apollonius/jq/problem-of-apollonius-2.jq b/Task/Problem-of-Apollonius/jq/problem-of-apollonius-2.jq new file mode 100644 index 0000000000..ef73156e73 --- /dev/null +++ b/Task/Problem-of-Apollonius/jq/problem-of-apollonius-2.jq @@ -0,0 +1,7 @@ +def task: + ([0, 0, 1] | circle) as $c1 + | ([4, 0, 1] | circle) as $c2 + | ([2, 4, 2] | circle) as $c3 + | ( ap($c1; $c2; $c3; true), # interior + ap($c1; $c2; $c3; false) ) # exterior +; diff --git a/Task/Problem-of-Apollonius/jq/problem-of-apollonius-3.jq b/Task/Problem-of-Apollonius/jq/problem-of-apollonius-3.jq new file mode 100644 index 0000000000..d7c0b54dd1 --- /dev/null +++ b/Task/Problem-of-Apollonius/jq/problem-of-apollonius-3.jq @@ -0,0 +1,3 @@ +$ jq -n -c -f apollonius.jq +{"x":2,"y":0.8333333333333333,"r":1.1666666666666667} +{"x":2,"y":2.1,"r":3.9} diff --git a/Task/Program-name/EchoLisp/program-name.echolisp b/Task/Program-name/EchoLisp/program-name.echolisp new file mode 100644 index 0000000000..096e643712 --- /dev/null +++ b/Task/Program-name/EchoLisp/program-name.echolisp @@ -0,0 +1,2 @@ +(js-eval "window.location.href") + → "http://www.echolalie.org/echolisp/" diff --git a/Task/Program-name/FreeBASIC/program-name.freebasic b/Task/Program-name/FreeBASIC/program-name.freebasic new file mode 100644 index 0000000000..a0a83d9fd6 --- /dev/null +++ b/Task/Program-name/FreeBASIC/program-name.freebasic @@ -0,0 +1,5 @@ +' FB 1.05.0 Win64 + +Print "The program was invoked like this => "; Command(0) + " " + Command(-1) +Print "Press any key to quit" +Sleep diff --git a/Task/Program-name/Lasso/program-name-1.lasso b/Task/Program-name/Lasso/program-name-1.lasso new file mode 100644 index 0000000000..676e86a5ef --- /dev/null +++ b/Task/Program-name/Lasso/program-name-1.lasso @@ -0,0 +1,3 @@ +#!/usr/bin/lasso9 + +stdoutnl("Program: " + $argv->first) diff --git a/Task/Program-name/Lasso/program-name-2.lasso b/Task/Program-name/Lasso/program-name-2.lasso new file mode 100644 index 0000000000..696417cce5 --- /dev/null +++ b/Task/Program-name/Lasso/program-name-2.lasso @@ -0,0 +1,2 @@ +$ lasso9 script_name.lasso +Program: script_name.lasso diff --git a/Task/Program-name/Lingo/program-name.lingo b/Task/Program-name/Lingo/program-name.lingo new file mode 100644 index 0000000000..0d0cafcb62 --- /dev/null +++ b/Task/Program-name/Lingo/program-name.lingo @@ -0,0 +1,4 @@ +put _player.applicationName +-- "lsw.exe" +put _movie.name +-- "lsw_win_d11.dir" diff --git a/Task/Program-name/Nim/program-name.nim b/Task/Program-name/Nim/program-name.nim new file mode 100644 index 0000000000..fd8d47fb5c --- /dev/null +++ b/Task/Program-name/Nim/program-name.nim @@ -0,0 +1,3 @@ +import os +echo getAppFilename() # Prints the full path of the executed file +echo paramStr(0) # Prints argv[0] diff --git a/Task/Program-name/Phix/program-name.phix b/Task/Program-name/Phix/program-name.phix new file mode 100644 index 0000000000..3d0ab27bc7 --- /dev/null +++ b/Task/Program-name/Phix/program-name.phix @@ -0,0 +1 @@ +puts(1,command_line()[2]) diff --git a/Task/Program-name/Ring/program-name-1.ring b/Task/Program-name/Ring/program-name-1.ring new file mode 100644 index 0000000000..454e9d5719 --- /dev/null +++ b/Task/Program-name/Ring/program-name-1.ring @@ -0,0 +1 @@ +see "Active Source File Name : " + filename() + nl diff --git a/Task/Program-name/Ring/program-name-2.ring b/Task/Program-name/Ring/program-name-2.ring new file mode 100644 index 0000000000..0ca2476f9b --- /dev/null +++ b/Task/Program-name/Ring/program-name-2.ring @@ -0,0 +1 @@ +Active Source File Name : tests\filename.ring diff --git a/Task/Program-name/Ring/program-name-3.ring b/Task/Program-name/Ring/program-name-3.ring new file mode 100644 index 0000000000..4ab5679067 --- /dev/null +++ b/Task/Program-name/Ring/program-name-3.ring @@ -0,0 +1,6 @@ +if sysargv[2] = filename() + see "I'm the main program file!" + nl + # we can run tests here! +else + see "I'm a sub file in a program" + nl +ok diff --git a/Task/Program-name/Sidef/program-name.sidef b/Task/Program-name/Sidef/program-name.sidef new file mode 100644 index 0000000000..0eeba61bc9 --- /dev/null +++ b/Task/Program-name/Sidef/program-name.sidef @@ -0,0 +1,4 @@ +say __MAIN__; +if (__MAIN__ != __FILE__) { + say "This file has been included!"; +} diff --git a/Task/Program-termination/Axe/program-termination.axe b/Task/Program-termination/Axe/program-termination.axe new file mode 100644 index 0000000000..c1dd7da86e --- /dev/null +++ b/Task/Program-termination/Axe/program-termination.axe @@ -0,0 +1 @@ +Returnʳ diff --git a/Task/Program-termination/FreeBASIC/program-termination.freebasic b/Task/Program-termination/FreeBASIC/program-termination.freebasic new file mode 100644 index 0000000000..df7bda0883 --- /dev/null +++ b/Task/Program-termination/FreeBASIC/program-termination.freebasic @@ -0,0 +1,11 @@ +'FB 1.05.0 Win64 'endprog.bas' + +Dim isError As Boolean = True +If isError Then + End 1 +End If + +' The following code won't be executed +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Program-termination/Lasso/program-termination-1.lasso b/Task/Program-termination/Lasso/program-termination-1.lasso new file mode 100644 index 0000000000..4be9b23d4c --- /dev/null +++ b/Task/Program-termination/Lasso/program-termination-1.lasso @@ -0,0 +1,12 @@ +#!/usr/bin/lasso9 +//[ + +handle => { + stdoutnl('The end is here') +} + +stdoutnl('Starting execution') + +abort + +stdoutnl('Ending execution') diff --git a/Task/Program-termination/Lasso/program-termination-2.lasso b/Task/Program-termination/Lasso/program-termination-2.lasso new file mode 100644 index 0000000000..dc1cfa4390 --- /dev/null +++ b/Task/Program-termination/Lasso/program-termination-2.lasso @@ -0,0 +1,12 @@ +#!/usr/bin/lasso9 + +handle_error => { + stdoutnl('There was an error ' + error_msg) + abort +} + +stdoutnl('Starting execution') + +0/0 + +stdoutnl('Ending execution') diff --git a/Task/Program-termination/Nim/program-termination.nim b/Task/Program-termination/Nim/program-termination.nim new file mode 100644 index 0000000000..5cf9eed599 --- /dev/null +++ b/Task/Program-termination/Nim/program-termination.nim @@ -0,0 +1,2 @@ +if problem: + quit(QuitFailure) diff --git a/Task/Program-termination/Oforth/program-termination.oforth b/Task/Program-termination/Oforth/program-termination.oforth new file mode 100644 index 0000000000..1a6a25c8ef --- /dev/null +++ b/Task/Program-termination/Oforth/program-termination.oforth @@ -0,0 +1,3 @@ +import: os + +some_condition ifTrue: [ 0 OS.exit ] diff --git a/Task/Program-termination/Phix/program-termination-1.phix b/Task/Program-termination/Phix/program-termination-1.phix new file mode 100644 index 0000000000..e07e0e359c --- /dev/null +++ b/Task/Program-termination/Phix/program-termination-1.phix @@ -0,0 +1,3 @@ +if error_code!=NO_ERROR then + abort(0) +end if diff --git a/Task/Program-termination/Phix/program-termination-2.phix b/Task/Program-termination/Phix/program-termination-2.phix new file mode 100644 index 0000000000..1854cff8a4 --- /dev/null +++ b/Task/Program-termination/Phix/program-termination-2.phix @@ -0,0 +1,3 @@ +if error_code!=NO_ERROR then + exit_thread(0) +end if diff --git a/Task/Program-termination/Ring/program-termination.ring b/Task/Program-termination/Ring/program-termination.ring new file mode 100644 index 0000000000..82e16b50b2 --- /dev/null +++ b/Task/Program-termination/Ring/program-termination.ring @@ -0,0 +1,4 @@ +for n = 1 to 10 + see n + nl + if n = 5 exit ok +next diff --git a/Task/Program-termination/SSEM/program-termination.ssem b/Task/Program-termination/SSEM/program-termination.ssem new file mode 100644 index 0000000000..ecf2889502 --- /dev/null +++ b/Task/Program-termination/SSEM/program-termination.ssem @@ -0,0 +1,2 @@ +00000000000000110000000000000000 Test +00000000000001110000000000000000 Stop diff --git a/Task/Program-termination/Sidef/program-termination.sidef b/Task/Program-termination/Sidef/program-termination.sidef new file mode 100644 index 0000000000..2ddcc321b1 --- /dev/null +++ b/Task/Program-termination/Sidef/program-termination.sidef @@ -0,0 +1,3 @@ +if (problem) { + Sys.exit(code); +} diff --git a/Task/Program-termination/Ursa/program-termination.ursa b/Task/Program-termination/Ursa/program-termination.ursa new file mode 100644 index 0000000000..1e13d54dc1 --- /dev/null +++ b/Task/Program-termination/Ursa/program-termination.ursa @@ -0,0 +1 @@ +stop diff --git a/Task/Program-termination/jq/program-termination-1.jq b/Task/Program-termination/jq/program-termination-1.jq new file mode 100644 index 0000000000..31a525f052 --- /dev/null +++ b/Task/Program-termination/jq/program-termination-1.jq @@ -0,0 +1,2 @@ +$ jq -n '"Hello", if 1 then error else 2 end' +"Hello" diff --git a/Task/Program-termination/jq/program-termination-2.jq b/Task/Program-termination/jq/program-termination-2.jq new file mode 100644 index 0000000000..bbc2615f26 --- /dev/null +++ b/Task/Program-termination/jq/program-termination-2.jq @@ -0,0 +1,2 @@ +$ jq -n '"Hello" | if 1 then error else 2 end' +jq: error: Hello diff --git a/Task/Pythagorean-triples/ERRE/pythagorean-triples.erre b/Task/Pythagorean-triples/ERRE/pythagorean-triples.erre new file mode 100644 index 0000000000..b0676be48b --- /dev/null +++ b/Task/Pythagorean-triples/ERRE/pythagorean-triples.erre @@ -0,0 +1,59 @@ +PROGRAM PIT + +BEGIN + + PRINT(CHR$(12);) !CLS + PRINT(TIME$) + + FOR POWER=1 TO 7 DO + PLIMIT=10#^POWER + UPPERBOUND=INT(1+PLIMIT^0.5) + PRIMITIVES=0 + TRIPLES=0 + EXTRAS=0 ! will count the in-range multiples of any primitive + + FOR M=2 TO UPPERBOUND DO + FOR N=1+(M MOD 2=1) TO M-1 STEP 2 DO + TERM1=2*M*N + TERM2=M*M-N*N + TERM3=M*M+N*N + PERIMETER=TERM1+TERM2+TERM3 + + IF PERIMETER<=PLIMIT THEN TRIPLES=TRIPLES+1 + + A=TERM1 + B=TERM2 + + REPEAT + R=A-B*INT(A/B) + A=B + B=R + UNTIL R<=0 + + ! we've found a primitive triple if a = 1, since hcf =1. + ! and it is inside perimeter range. Save it in an array + IF (A=1) AND (PERIMETER<=PLIMIT) THEN + PRIMITIVES=PRIMITIVES+1 + + !----------------------------------------------- + !swap so in increasing order of side length + !----------------------------------------------- + IF TERM1>TERM2 THEN SWAP(TERM1,TERM2) + !----------------------------------------------- + !we have the primitive & removed any multiples. + !Now calculate ALL the multiples in range. + !----------------------------------------------- + NEX=INT(PLIMIT/PERIMETER) + EXTRAS=EXTRAS+NEX + END IF + + !scan + END FOR + END FOR + + PRINT("Primit. with perimeter <=";10#^power;"is";primitives;"&";extras;"non-prim.triples.") + PRINT(TIME$) + END FOR + + PRINT PRINT("** End **") +END PROGRAM diff --git a/Task/Pythagorean-triples/FreeBASIC/pythagorean-triples-1.freebasic b/Task/Pythagorean-triples/FreeBASIC/pythagorean-triples-1.freebasic new file mode 100644 index 0000000000..6a0a42cc87 --- /dev/null +++ b/Task/Pythagorean-triples/FreeBASIC/pythagorean-triples-1.freebasic @@ -0,0 +1,90 @@ +' version 30-05-2016 +' compile with: fbc -s console + +' primitive pythagoras triples +' a = m^2 - n^2, b = 2mn, c = m^2 + n^2 +' m, n are positive integers and m > n +' m - n = odd and GCD(m, n) = 1 +' p = a + b + c + +' max m for give perimeter +' p = m^2 - n^2 + 2mn + m^2 + n^2 +' p = 2mn + m^2 + m^2 + n^2 - n^2 = 2mn + 2m^2 +' m >> n and n = 1 ==> p = 2m + 2m^2 = 2m(1 + m) +' m >> 1 ==> p = 2m(m) = 2m^2 +' max m for given perimeter = sqr(p / 2) + +Function gcd(x As UInteger, y As UInteger) As UInteger + + Dim As UInteger t + + While y + t = y + y = x Mod y + x = t + Wend + Return x + +End Function + + +Sub pyth_trip(limit As ULongInt, ByRef trip As ULongInt, ByRef prim As ULongInt) + + Dim As ULongInt perimeter, lby2 = limit Shr 1 + Dim As UInteger m, n + Dim As ULongInt a, b, c + + For m = 2 To Sqr(limit / 2) + For n = 1 + (m And 1) To (m - 1) Step 2 + ' common divisor, try next n + If (gcd(m, n) > 1) Then Continue For + a = CULngInt(m) * m - n * n + b = CULngInt(m) * n * 2 + c = CULngInt(m) * m + n * n + perimeter = a + b + c + ' perimeter > limit, since n goes up try next m + If perimeter >= limit Then Continue For, For + prim += 1 + If perimeter < lby2 Then + trip += limit \ perimeter + Else + trip += 1 + End If + Next n + Next m + +End Sub + + +' ------=< MAIN >=------ + +Dim As String str1, buffer = Space(14) +Dim As ULongInt limit, trip, prim +Dim As Double t, t1 = Timer + +Print "below triples primitive time" +Print + +For x As UInteger = 1 To 12 + t = Timer + limit = 10 ^ x : trip = 0 : prim = 0 + pyth_trip(limit, trip, prim) + LSet buffer, Str(prim) : str1 = buffer + Print Using "10^## ################ "; x; trip; + If x > 7 Then + Print str1; + Print Using " ######.## sec."; Timer - t + Else + Print str1 + End If +Next x + +Print : Print +Print Using "Total time needed #######.## sec."; Timer - t1 + + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Pythagorean-triples/FreeBASIC/pythagorean-triples-2.freebasic b/Task/Pythagorean-triples/FreeBASIC/pythagorean-triples-2.freebasic new file mode 100644 index 0000000000..6d93fbd25e --- /dev/null +++ b/Task/Pythagorean-triples/FreeBASIC/pythagorean-triples-2.freebasic @@ -0,0 +1,82 @@ +' version 30-05-2016 +' compile with: fbc -s console + +' max m for give perimeter +' p = m^2 - n^2 + 2mn + m^2 + n^2 +' p = 2mn + m^2 + m^2 + n^2 - n^2 = 2mn + 2m^2 +' m >> n and n = 1 ==> p = 2m + 2m^2 = 2m(1 + m) +' m >> 1 ==> p = 2m(m) = 2m^2 +' max m for given perimeter = sqr(p / 2) + +Function gcd(x As UInteger, y As UInteger) As UInteger + + Dim As UInteger t + + While y + t = y + y = x Mod y + x = t + Wend + Return x + +End Function + +Sub pyth_trip_fast(limit As ULongInt, ByRef trip As ULongInt, ByRef prim As ULongInt) + + + Dim As ULongInt perimeter, lby2 = limit Shr 1 + Dim As UInteger mx2 = 4 + + For m As UInteger = 2 To Sqr(limit / 2) + perimeter = (CULngInt(m) * m * 2) - IIf(m And 1, 0, m * 2) + mx2 = mx2 + 4 + For n As UInteger = 1 + (m And 1) To (m - 1) Step 2 + perimeter += mx2 + ' common divisor, try next n + If (gcd(m, n) > 1) Then Continue For + ' perimeter > limit, since n goes up try next m + If perimeter >= limit Then Continue For, For + prim += 1 + If perimeter < lby2 Then + trip += limit \ perimeter + Else + trip += 1 + End If + Next n + Next m + +End Sub + + +' ------=< MAIN >=------ + +Dim As String str1, buffer = Space(14) +Dim As ULongInt limit, trip, prim +Dim As Double t, t1 = Timer + +Print "below triples primitive time" +Print + +For x As UInteger = 1 To 12 + t = Timer + limit = 10 ^ x : trip = 0 : prim = 0 + pyth_trip_fast(limit, trip, prim) + LSet buffer, Str(prim) : str1 = buffer + Print Using "10^## ################ "; x; trip; + If x > 7 Then + Print str1; + Print Using " ######.## sec."; Timer - t + Else + Print str1 + End If +Next x + +Print : Print +Print Using "Total time needed #######.## sec."; Timer - t1 + + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Pythagorean-triples/Lasso/pythagorean-triples.lasso b/Task/Pythagorean-triples/Lasso/pythagorean-triples.lasso new file mode 100644 index 0000000000..a226d7a558 --- /dev/null +++ b/Task/Pythagorean-triples/Lasso/pythagorean-triples.lasso @@ -0,0 +1,18 @@ +// Brute Force: Too slow for large numbers +define num_pythagorean_triples(max_perimeter::integer) => { + local(max_b) = (#max_perimeter / 3)*2 + + return ( + with a in 1 to (#max_b - 1) + sum integer( + with b in (#a + 1) to #max_b + let c = math_sqrt(#a*#a + #b*#b) + where #c == integer(#c) + where #c > #b + where (#a+#b+#c) <= #max_perimeter + sum 1 + ) + ) +} +stdout(`Number of Pythagorean Triples in a Perimeter of 100: `) +stdoutnl(num_pythagorean_triples(100)) diff --git a/Task/Pythagorean-triples/Nim/pythagorean-triples.nim b/Task/Pythagorean-triples/Nim/pythagorean-triples.nim new file mode 100644 index 0000000000..ffcd30cebc --- /dev/null +++ b/Task/Pythagorean-triples/Nim/pythagorean-triples.nim @@ -0,0 +1,25 @@ +const u = [[ 1, -2, 2, 2, -1, 2, 2, -2, 3], + [ 1, 2, 2, 2, 1, 2, 2, 2, 3], + [-1, 2, 2, -2, 1, 2, -2, 2, 3]] + +var + total, prim = 0 + maxPeri = 10 + +proc newTri(ins) = + var p = ins[0] + ins[1] + ins[2] + if p > maxPeri: return + inc(prim) + total += maxPeri div p + + for i in 0..2: + newTri([u[i][0] * ins[0] + u[i][1] * ins[1] + u[i][2] * ins[2], + u[i][3] * ins[0] + u[i][4] * ins[1] + u[i][5] * ins[2], + u[i][6] * ins[0] + u[i][7] * ins[1] + u[i][8] * ins[2]]) + +while maxPeri <= 100_000_000: + total = 0 + prim = 0 + newTri([3, 4, 5]) + echo "Up to ", maxPeri, ": ", total, " triples, ", prim, " primitives" + maxPeri *= 10 diff --git a/Task/Pythagorean-triples/Phix/pythagorean-triples.phix b/Task/Pythagorean-triples/Phix/pythagorean-triples.phix new file mode 100644 index 0000000000..44c03d9af3 --- /dev/null +++ b/Task/Pythagorean-triples/Phix/pythagorean-triples.phix @@ -0,0 +1,20 @@ +atom total, prim, maxPeri = 10 + +procedure tri(atom s0, s1, s2) +atom p = s0 + s1 + s2 + if p<=maxPeri then + prim += 1 + total += floor(maxPeri/p) + tri( s0+2*(-s1+s2), 2*( s0+s2)-s1, 2*( s0-s1+s2)+s2); + tri( s0+2*( s1+s2), 2*( s0+s2)+s1, 2*( s0+s1+s2)+s2); + tri(-s0+2*( s1+s2), 2*(-s0+s2)+s1, 2*(-s0+s1+s2)+s2); + end if +end procedure + +while maxPeri<=1e8 do + prim := 0; + total := 0; + tri(3, 4, 5); + printf(1,"Up to %d: %d triples, %d primitives.\n", {maxPeri,total,prim}) + maxPeri *= 10; +end while diff --git a/Task/Pythagorean-triples/Ring/pythagorean-triples.ring b/Task/Pythagorean-triples/Ring/pythagorean-triples.ring new file mode 100644 index 0000000000..0f9e1ef266 --- /dev/null +++ b/Task/Pythagorean-triples/Ring/pythagorean-triples.ring @@ -0,0 +1,23 @@ +size = 100 +sum = 0 +prime = 0 +for i = 1 to size + for j = i + 1 to size + for k = 1 to size + if pow(i,2) + pow(j,2) = pow(k,2) and (i+j+k) < 101 + if gcd(i,j) = 1 prime += 1 ok + sum += 1 + see "" + i + " " + j + " " + k + nl ok + next + next +next +see "Total : " + sum + nl +see "Primitives : " + prime + nl + +func gcd gcd, b + while b + c = gcd + gcd = b + b = c % b + end + return gcd diff --git a/Task/Pythagorean-triples/Sidef/pythagorean-triples.sidef b/Task/Pythagorean-triples/Sidef/pythagorean-triples.sidef new file mode 100644 index 0000000000..b40bbfe08f --- /dev/null +++ b/Task/Pythagorean-triples/Sidef/pythagorean-triples.sidef @@ -0,0 +1,21 @@ +func triples(limit) { + var primitive = 0; + var civilized = 0; + + func oyako(a, b, c) { + (var perim = a+b+c) > limit || ( + primitive++; + civilized += int(limit / perim); + oyako( a - 2*b + 2*c, 2*a - b + 2*c, 2*a - 2*b + 3*c); + oyako( a + 2*b + 2*c, 2*a + b + 2*c, 2*a + 2*b + 3*c); + oyako(-a + 2*b + 2*c, -2*a + b + 2*c, -2*a + 2*b + 3*c); + ); + } + + oyako(3,4,5); + "#{limit} => (#{primitive} #{civilized})"; +} + +Inf.times { |n| + say triples(10**n); +} diff --git a/Task/Pythagorean-triples/Swift/pythagorean-triples.swift b/Task/Pythagorean-triples/Swift/pythagorean-triples.swift new file mode 100644 index 0000000000..adfd8f98a6 --- /dev/null +++ b/Task/Pythagorean-triples/Swift/pythagorean-triples.swift @@ -0,0 +1,23 @@ +var total = 0 +var prim = 0 +var maxPeri = 100 + +func newTri(s0:Int, _ s1:Int, _ s2: Int) -> () { + + let p = s0 + s1 + s2 + if p <= maxPeri { + prim += 1 + total += maxPeri / p + newTri( s0 + 2*(-s1+s2), 2*( s0+s2) - s1, 2*( s0-s1+s2) + s2) + newTri( s0 + 2*( s1+s2), 2*( s0+s2) + s1, 2*( s0+s1+s2) + s2) + newTri(-s0 + 2*( s1+s2), 2*(-s0+s2) + s1, 2*(-s0+s1+s2) + s2) + } +} + +while maxPeri <= 100_000_000 { + prim = 0 + total = 0 + newTri(3, 4, 5) + print("Up to \(maxPeri) : \(total) triples \( prim) primitives.") + maxPeri *= 10 +} diff --git a/Task/Pythagorean-triples/jq/pythagorean-triples-1.jq b/Task/Pythagorean-triples/jq/pythagorean-triples-1.jq new file mode 100644 index 0000000000..f4e28db0d3 --- /dev/null +++ b/Task/Pythagorean-triples/jq/pythagorean-triples-1.jq @@ -0,0 +1,37 @@ +def gcd(a; b): + def _gcd: + if .[1] == 0 then .[0] + else [.[1], .[0] % .[1]] | _gcd + end; + [a,b] | _gcd ; + +# Return: [total, primitives] for pythagorean triangles having +# perimeter no larger than peri. +# The following uses Euclid's formula with the convention: m > n. +def count(peri): + + # The inner function can be used to count for a given value of m: + def _count: + # state [n,m,p, [total, primitives]] + .[0] as $n | .[1] as $m | .[2] as $p + | if $n < $m and $p <= peri then + if (gcd($m;$n) == 1) + then .[3] | [ (.[0] + ((peri/$p)|floor) ), (.[1] + 1)] + else .[3] + end + | [$n+2, $m, $p+4*$m, .] | _count + else . + end; + + # m^2 < m*(m+1) <= m*(m+n) = perimeter/2 + reduce range(2; (peri/2) | sqrt + 1) as $m + ( [1, 2, 12, [0,0]]; + (($m % 2) + 1) as $n + | (2 * $m * ($m + $n) ) as $p # a+b+c for this (m,n) + | [$n, $m, $p, .[3]] | _count + ) | .[3] ; + +# '''Example''': +def pow(i): . as $in | reduce range(0; i) as $j (1; . * $in); + +range(1; 9) | . as $i | 10|pow($i) as $i | "\($i): \(count($i) )" diff --git a/Task/Pythagorean-triples/jq/pythagorean-triples-2.jq b/Task/Pythagorean-triples/jq/pythagorean-triples-2.jq new file mode 100644 index 0000000000..1fc3445195 --- /dev/null +++ b/Task/Pythagorean-triples/jq/pythagorean-triples-2.jq @@ -0,0 +1,9 @@ +$ jq -M -c -r -n -f Pythagorean_triples.jq +10: [0,0] +100: [17,7] +1000: [325,70] +10000: [4858,703] +100000: [64741,7026] +1000000: [808950,70229] +10000000: [9706567,702309] +100000000: [113236940,7023027] diff --git a/Task/Quaternion-type/ERRE/quaternion-type.erre b/Task/Quaternion-type/ERRE/quaternion-type.erre new file mode 100644 index 0000000000..2388a60ad1 --- /dev/null +++ b/Task/Quaternion-type/ERRE/quaternion-type.erre @@ -0,0 +1,104 @@ +PROGRAM QUATERNION + +!$DOUBLE + +TYPE QUATERNION=(A,B,C,D) + +DIM Q:QUATERNION,Q1:QUATERNION,Q2:QUATERNION + + +DIM R:QUATERNION,S:QUATERNION,T:QUATERNION + +PROCEDURE NORM(T.->NORM) + NORM=SQR(T.A*T.A+T.B*T.B+T.C*T.C+T.D*T.D) +END PROCEDURE + +PROCEDURE NEGATIVE(T.->T.) + T.A=-T.A + T.B=-T.B + T.C=-T.C + T.D=-T.D +END PROCEDURE + +PROCEDURE CONJUGATE(T.->T.) + T.A=T.A + T.B=-T.B + T.C=-T.C + T.D=-T.D +END PROCEDURE + +PROCEDURE ADD_REAL(T.,REAL->T.) + T.A=T.A+REAL + T.B=T.B + T.C=T.C + T.D=T.D +END PROCEDURE + +PROCEDURE ADD(T.,S.->T.) + T.A=T.A+S.A + T.B=T.B+S.B + T.C=T.C+S.C + T.D=T.D+S.D +END PROCEDURE + +PROCEDURE MULT_REAL(T.,REAL->T.) + T.A=T.A*REAL + T.B=T.B*REAL + T.C=T.C*REAL + T.D=T.D*REAL +END PROCEDURE + +PROCEDURE MULT(T.,S.->R.) + R.A=T.A*S.A-T.B*S.B-T.C*S.C-T.D*S.D + R.B=T.A*S.B+T.B*S.A+T.C*S.D-T.D*S.C + R.C=T.A*S.C-T.B*S.D+T.C*S.A+T.D*S.B + R.D=T.A*S.D+T.B*S.C-T.C*S.B+T.D*S.A +END PROCEDURE + +PROCEDURE PRINTQ(T.) + PRINT("(";T.A;",";T.B;",";T.C;",";T.D;")") +END PROCEDURE + +BEGIN + Q.A=1 Q.B=2 Q.C=3 Q.D=4 + Q1.A=2 Q1.B=3 Q1.C=4 Q1.D=5 + Q2.A=3 Q2.B=4 Q2.C=5 Q2.D=6 + REAL=7 + + NORM(Q.->NORM) + PRINT("Norm(q)=";NORM) + + NEGATIVE(Q.->T.) + PRINT("Negative(q) =";) + PRINTQ(T.) + + CONJUGATE(Q.->T.) + PRINT("Conjugate(q) =";) + PRINTQ(T.) + + ADD_REAL(Q.,REAL->T.) + PRINT("q + real =";) + PRINTQ(T.) + +! addition is commutative + ADD(Q1.,Q2.->T.) + PRINT("q1 + q2 =";) + PRINTQ(T.) + + ADD(Q2.,Q1.->T.) + PRINT("q2 + q1 = ";) + PRINTQ(T.) + + MULT_REAL(Q.,REAL->T.) + PRINT("q * real =";) + PRINTQ(T.) + +! multiplication is not commutative + MULT(Q1.,Q2.->R.) + PRINT("q1 * q2=";) + PRINTQ(R.) + + MULT(Q2.,Q1.->R.) + PRINT("q2 * q1=";) + PRINTQ(R.) +END PROGRAM diff --git a/Task/Quaternion-type/Eero/quaternion-type.eero b/Task/Quaternion-type/Eero/quaternion-type.eero new file mode 100644 index 0000000000..0a0a082df3 --- /dev/null +++ b/Task/Quaternion-type/Eero/quaternion-type.eero @@ -0,0 +1,102 @@ +#import + +interface Quaternion : Number + // Properties -- note that this is an immutable class. + double real, i, j, k {readonly} +end + +implementation Quaternion + + initWithReal: double, i: double, j: double, k: double, return instancetype + self = super.init + if self + _real = real; _i = i; _j = j; _k = k + return self + + +new: double real, ..., return instancetype + va_list args + va_start(args, real) + object := Quaternion.alloc.initWithReal: real, + i: va_arg(args, double), + j: va_arg(args, double), + k: va_arg(args, double) + va_end(args) + return object + + descriptionWithLocale: id, return String = String.stringWithFormat: + '(%.1f, %.1f, %.1f, %.1f)', self.real, self.i, self.j, self.k + + norm, return double = + sqrt(self.real * self.real + + self.i * self.i + self.j * self.j + self.k * self.k) + + negative, return Quaternion = + Quaternion.new: -self.real, -self.i, -self.j, -self.k + + conjugate, return Quaternion = + Quaternion.new: self.real, -self.i, -self.j, -self.k + + // Overload "+" operator (left operand is Quaternion) + plus: Number operand, return Quaternion + real := self.real, i = self.i, j = self.j, k = self.k + if operand.isKindOfClass: Quaternion.class + q := (Quaternion)operand + real += q.real; i += q.i; j += q.j; k += q.k + else + real += (double)operand + return Quaternion.new: real, i, j, k + + // Overload "*" operator (left operand is Quaternion) + multipliedBy: Number operand, return Quaternion + real := self.real, i = self.i, j = self.j, k = self.k + if operand.isKindOfClass: Quaternion.class + q := (Quaternion)operand + real = self.real * q.real - self.i* q.i - self.j * q.j - self.k * q.k + i = self.real * q.i + self.i * q.real + self.j * q.k - self.k * q.j + j = self.real * q.j - self.i * q.k + self.j * q.real + self.k * q.i + k = self.real * q.k + self.i * q.j - self.j * q.i + self.k * q.real + else + real *= (double)operand + i *= (double)operand; j *= (double)operand; k *= (double)operand + return Quaternion.new: real, i, j, k + +end + +implementation Number (QuaternionOperators) + + // Overload "+" operator (left operand is Number) + plus: Quaternion operand, return Quaternion + real := (double)self + operand.real + return Quaternion.new: real, operand.i, operand.j, operand.k + + // Overload "*" operator (left operand is Number) + multipliedBy: Quaternion operand, return Quaternion + r := (double)self + return Quaternion.new: r * operand.real, r * operand.i, + r * operand.j, r * operand.k + +end + +int main() + autoreleasepool + + q := Quaternion.new: 1.0, 2.0, 3.0, 4.0 + q1 := Quaternion.new: 2.0, 3.0, 4.0, 5.0 + q2 := Quaternion.new: 3.0, 4.0, 5.0, 6.0 + + Log( 'q = %@', q ) + Log( 'q1 = %@', q1 ) + Log( 'q2 = %@\n\n', q2 ) + + Log( 'q norm = %.3f', q.norm ) + Log( 'q negative = %@', q.negative ) + Log( 'q conjugate = %@', q.conjugate ) + Log( '7 + q = %@', 7.0 + q ) + Log( 'q + 7 = %@', q + 7.0 ) + Log( 'q1 + q2 = %@', q1 + q2 ) + Log( '7 * q = %@', 7 * q) + Log( 'q * 7 = %@', q * 7.0 ) + Log( 'q1 * q2 = %@', q1 * q2 ) + Log( 'q2 * q1 = %@', q2 * q1 ) + + return 0 diff --git a/Task/Quaternion-type/Oforth/quaternion-type-1.oforth b/Task/Quaternion-type/Oforth/quaternion-type-1.oforth new file mode 100644 index 0000000000..6f0413554d --- /dev/null +++ b/Task/Quaternion-type/Oforth/quaternion-type-1.oforth @@ -0,0 +1,24 @@ +160 Number Class newPriority: Quaternion(a, b, c, d) + +Quaternion method: _a @a ; +Quaternion method: _b @b ; +Quaternion method: _c @c ; +Quaternion method: _d @d ; + +Quaternion method: initialize := d := c := b := a ; +Quaternion method: << '(' <q + Quaternion new(2, 3, 4, 5) ->q1 + Quaternion new(3, 4, 5, 6) ->q2 + 7.0 -> r + + System.Out "q = " << q << cr + System.Out "q1 = " << q1 << cr + System.Out "q2 = " << q2 << cr + + System.Out "norm q = " << q norm << cr + System.Out "neg q = " << q neg << cr + System.Out "conj q = " << q conj << cr + System.Out "q +r = " << q r + << cr + System.Out "q1 + q2 = " << q1 q2 + << cr + System.Out "q * r = " << q r * << cr + System.Out "q1 * q2 = " << q1 q2 * << cr + q1 q2 * q2 q1 * == ifFalse: [ "q1q2 and q2q1 are different quaternions" println ] ; diff --git a/Task/Quaternion-type/Phix/quaternion-type.phix b/Task/Quaternion-type/Phix/quaternion-type.phix new file mode 100644 index 0000000000..5189e779ae --- /dev/null +++ b/Task/Quaternion-type/Phix/quaternion-type.phix @@ -0,0 +1,54 @@ +function norm(sequence q) + return sqrt(sum(sq_power(q,2))) +end function + +function conj(sequence q) + q[2..4] = sq_uminus(q[2..4]) + return q +end function + +function add(object q1, object q2) + if atom(q1)!=atom(q2) then + if atom(q1) then + q1 = {q1,0,0,0} + else + q2 = {q2,0,0,0} + end if + end if + return sq_add(q1,q2) +end function + +function mul(object q1, object q2) + if sequence(q1) and sequence(q2) then + return { q1[1]*q2[1] - q1[2]*q2[2] - q1[3]*q2[3] - q1[4]*q2[4], + q1[1]*q2[2] + q1[2]*q2[1] + q1[3]*q2[4] - q1[4]*q2[3], + q1[1]*q2[3] - q1[2]*q2[4] + q1[3]*q2[1] + q1[4]*q2[2], + q1[1]*q2[4] + q1[2]*q2[3] - q1[3]*q2[2] + q1[4]*q2[1] } + else + return sq_mul(q1,q2) + end if +end function + +function quats(sequence q) + return sprintf("%g + %gi + %gj + %gk",q) +end function + +constant + q = {1, 2, 3, 4}, + q1 = {2, 3, 4, 5}, + q2 = {3, 4, 5, 6}, + r = 7 + +printf(1, "q = %s\n", {quats(q)}) +printf(1, "r = %g\n", r) +printf(1, "norm(q) = %g\n", norm(q)) +printf(1, "-q = %s\n", {quats(-q)}) +printf(1, "conj(q) = %s\n", {quats(conj(q))}) +printf(1, "q + r = %s\n", {quats(add(q,r))}) +printf(1, "q * r = %s\n", {quats(mul(q,r))}) +printf(1, "q1 = %s\n", {quats(q1)}) +printf(1, "q2 = %s\n", {quats(q2)}) +printf(1, "q1 + q2 = %s\n", {quats(add(q1,q2))}) +printf(1, "q2 + q1 = %s\n", {quats(add(q2,q1))}) +printf(1, "q1 * q2 = %s\n", {quats(mul(q1,q2))}) +printf(1, "q2 * q1 = %s\n", {quats(mul(q2,q1))}) diff --git a/Task/Quaternion-type/Sidef/quaternion-type.sidef b/Task/Quaternion-type/Sidef/quaternion-type.sidef new file mode 100644 index 0000000000..7c7222e5b0 --- /dev/null +++ b/Task/Quaternion-type/Sidef/quaternion-type.sidef @@ -0,0 +1,39 @@ +class Quaternion(r, i, j, k) { + + func qu(*r) { Quaternion(r...) } + + method to_s { "#{r} + #{i}i + #{j}j + #{k}k" } + method reals { [r, i, j, k] } + method conj { qu(r, -i, -j, -k) } + method norm { self.reals.map { _*_ }.sum.sqrt } + + method ==(Quaternion b) { self.reals == b.reals } + + method +(Number b) { qu(b+r, i, j, k) } + method +(Quaternion b) { qu((self.reals ~Z+ b.reals)...) } + + method neg { qu(self.reals.map{ .neg }...) } + + method *(Number b) { qu((self.reals»*»b)...) } + method *(Quaternion b) { + var (r,i,j,k) = b.reals... + qu(sum(self.reals ~Z* [r, -i, -j, -k]), + sum(self.reals ~Z* [i, r, k, -j]), + sum(self.reals ~Z* [j, -k, r, i]), + sum(self.reals ~Z* [k, j, -i, r])) + } +} + +var q = Quaternion(1, 2, 3, 4) +var q1 = Quaternion(2, 3, 4, 5) +var q2 = Quaternion(3, 4, 5, 6) +var r = 7 + +say "1) q norm = #{q.norm}" +say "2) -q = #{-q}" +say "3) q conj = #{q.conj}" +say "4) q + r = #{q + r}" +say "5) q1 + q2 = #{q1 + q2}" +say "6) q * r = #{q * r}" +say "7) q1 * q2 = #{q1 * q2}" +say "8) q1q2 #{ q1*q2 == q2*q1 ? '==' : '!=' } q2q1" diff --git a/Task/Quaternion-type/jq/quaternion-type-1.jq b/Task/Quaternion-type/jq/quaternion-type-1.jq new file mode 100644 index 0000000000..f13bd50e67 --- /dev/null +++ b/Task/Quaternion-type/jq/quaternion-type-1.jq @@ -0,0 +1,92 @@ +def Quaternion(q0;q1;q2;q3): { "q0": q0, "q1": q1, "q2": q2, "q3": q3, "type": "Quaternion" }; + +# promotion of a real number to a quaternion +def Quaternion(r): if (r|type) == "number" then Quaternion(r;0;0;0) else r end; + +# thoroughly recursive pretty-print +def pp: + + def signage: if . >= 0 then "+ \(.)" else "- \(-.)" end; + + if type == "object" then + if .type == "Quaternion" then + "\(.q0) \(.q1|signage)i \(.q2|signage)j \(.q3|signage)k" + else with_entries( {key, "value" : (.value|pp)} ) + end + elif type == "array" then map(pp) + else . + end ; + +def real(z): Quaternion(z).q0; + +# Note: imag(z) returns the "i" component only, +# reflecting the embedding of the complex numbers within the quaternions: +def imag(z): Quaternion(z).q1; + +def conj(z): Quaternion(z) | Quaternion(.q0; -(.q1); -(.q2); -(.q3)); + +def abs2(z): Quaternion(z) | .q0 * .q0 + .q1*.q1 + .q2*.q2 + .q3*.q3; + +def abs(z): abs2(z) | sqrt; + +def negate(z): Quaternion(z) | Quaternion(-.q0; -.q1; -.q2; -.q3); + +# z + w +def plus(z; w): + def plusq(z;w): Quaternion(z.q0 + w.q0; z.q1 + w.q1; + z.q2 + w.q2; z.q3 + w.q3); + plusq( Quaternion(z); Quaternion(w) ); + +# z - w +def minus(z; w): + def minusq(z;w): Quaternion(z.q0 - w.q0; z.q1 - w.q1; + z.q2 - w.q2; z.q3 - w.q3); + minusq( Quaternion(z); Quaternion(w) ); + +# * +def times(z; w): + def timesq(z; w): + Quaternion(z.q0*w.q0 - z.q1*w.q1 - z.q2*w.q2 - z.q3*w.q3; + z.q0*w.q1 + z.q1*w.q0 + z.q2*w.q3 - z.q3*w.q2; + z.q0*w.q2 - z.q1*w.q3 + z.q2*w.q0 + z.q3*w.q1; + z.q0*w.q3 + z.q1*w.q2 - z.q2*w.q1 + z.q3*w.q0); + timesq( Quaternion(z); Quaternion(w) ); + +# (z/w) +def div(z; w): + if (w|type) == "number" then Quaternion(z.q0/w; z.q1/w; z.q2/w; z.q3/w) + else times(z; inv(w)) + end; + +def inv(z): div(conj(z); abs2(z)); + + +# Example usage and output: + +def say(msg; e): "\(msg) => \(e|pp)"; + +def demo: + say( "Quaternion(1;0;0;0)"; Quaternion(1;0;0;0)), + (Quaternion (1; 2; 3; 4) as $q + | Quaternion(2; 3; 4; 5) as $q1 + | Quaternion(3; 4; 5; 6) as $q2 + | 7 as $r + | say( "abs($q)"; abs($q) ), # norm + say( "negate($q)"; negate($q) ), + say( "conj($q)"; conj($q) ), + "", + say( "plus($r; $q)"; plus($r; $q)), + say( "plus($q; $r)"; plus($q; $r)), + "", + say( "plus($q1; $q2 )"; plus($q1; $q2)), + "", + say( "times($r;$q)"; times($r;$q)), + say( "times($q;$r)"; times($q;$r)), + "", + say( "times($q1;$q2)"; times($q1;$q2)), + say( "times($q2; $q1)"; times($q2; $q1)), + say( "times($q1; $q2) != times($q2; $q1)"; + times($q1; $q2) != times($q2; $q1) ) + ) ; + +demo diff --git a/Task/Quaternion-type/jq/quaternion-type-2.jq b/Task/Quaternion-type/jq/quaternion-type-2.jq new file mode 100644 index 0000000000..ab74384f2d --- /dev/null +++ b/Task/Quaternion-type/jq/quaternion-type-2.jq @@ -0,0 +1,17 @@ +# jq -c -n -R -f quaternion.jq +Quaternion(1;0;0;0) => 1 + 0i + 0j + 0k +abs($q) => 5.477225575051661 +negate($q) => -1 - 2i - 3j + -4k +conj($q) => 1 - 2i - 3j - 4k + +plus($r; $q) => 8 + 2i + 3j + 4k +plus($q; $r) => 8 + 2i + 3j + 4k + +plus($q1; $q2 ) => 5 + 7i + 9j + 11k + +times($r;$q) => 7 + 14i + 21j + 28k +times($q;$r) => 7 + 14i + 21j + 28k + +times($q1;$q2) => -56 + 16i + 24j + 26k +times($q2; $q1) => -56 + 18i + 20j + 28k +times($q1; $q2) != times($q2; $q1) => true diff --git a/Task/Queue-Definition/ERRE/queue-definition.erre b/Task/Queue-Definition/ERRE/queue-definition.erre new file mode 100644 index 0000000000..2966be7334 --- /dev/null +++ b/Task/Queue-Definition/ERRE/queue-definition.erre @@ -0,0 +1,45 @@ +PROGRAM CLASS_DEMO + +CLASS QUEUE + + LOCAL SP + LOCAL DIM STACK[100] + + FUNCTION ISEMPTY() + ISEMPTY=(SP=0) + END FUNCTION + + PROCEDURE INIT + SP=0 + END PROCEDURE + + PROCEDURE POP(->XX) + XX=STACK[SP] + SP=SP-1 + END PROCEDURE + + PROCEDURE PUSH(XX) + SP=SP+1 + STACK[SP]=XX + END PROCEDURE + +END CLASS + +NEW PILA:QUEUE + +BEGIN + PILA_INIT ! constructor + FOR N=1 TO 4 DO ! push 4 numbers + PRINT("Push";N) + PILA_PUSH(N) + END FOR + FOR I=1 TO 5 DO ! pop 5 numbers + IF NOT PILA_ISEMPTY() THEN + PILA_POP(->N) + PRINT("Pop";N) + ELSE + PRINT("Queue is empty!") + END IF + END FOR + PRINT("* End *") +END PROGRAM diff --git a/Task/Queue-Definition/EchoLisp/queue-definition.echolisp b/Task/Queue-Definition/EchoLisp/queue-definition.echolisp new file mode 100644 index 0000000000..8a96077384 --- /dev/null +++ b/Task/Queue-Definition/EchoLisp/queue-definition.echolisp @@ -0,0 +1,35 @@ +;; put info string in permanent storage for later use +(info 'make-Q +"usage: (define q (make-Q)) ; (q '[top | empty? | pop | push value | to-list | from-list list])") + +;; make-Q +(define (make-Q) + (let ((q (make-vector 0))) + (lambda (message . args) + (case message + ((empty?) (vector-empty? q)) + ((top) (if (vector-empty? q) (error 'Q:top:empty q) (vector-ref q 0))) + ((push) (vector-push q (car args))) + ((pop) (if (vector-empty? q) (error 'Q:pop:empty q) (vector-shift q))) + ((to-list) (vector->list q)) + ((from-list) (set! q (list->vector (car args))) q ) + (else (info 'make-Q) (error "Q:bad message:" message )))))) ; display info if unknown message + +;; +(define q (make-Q)) +(q 'empty?) → #t +(q 'push 'first) → first +(q 'push 'second) → second +(q 'pop) → first +(q 'pop) → second +(q 'top) +"💬 error: Q:top:empty #()" +(q 'from-list '( 6 7 8)) → #( 6 7 8) +(q 'top) → 6 +(q 'pop) → 6 +(q 'to-list)→ (7 8) +(q 'delete) +"💭 error: Q:bad message: delete" + +;; save make-Q +(local-put 'make-Q) diff --git a/Task/Queue-Definition/Lasso/queue-definition-1.lasso b/Task/Queue-Definition/Lasso/queue-definition-1.lasso new file mode 100644 index 0000000000..e8b1d252d0 --- /dev/null +++ b/Task/Queue-Definition/Lasso/queue-definition-1.lasso @@ -0,0 +1,21 @@ +define myqueue => type { + data store = list + + public onCreate(...) => { + if(void != #rest) => { + with item in #rest do .`store`->insert(#item) + } + } + + public push(value) => .`store`->insertLast(#value) + + public pop => { + handle => { + .`store`->removefirst + } + + return .`store`->first + } + + public isEmpty => (.`store`->size == 0) +} diff --git a/Task/Queue-Definition/Lasso/queue-definition-2.lasso b/Task/Queue-Definition/Lasso/queue-definition-2.lasso new file mode 100644 index 0000000000..5268d708ed --- /dev/null +++ b/Task/Queue-Definition/Lasso/queue-definition-2.lasso @@ -0,0 +1,14 @@ +local(q) = myqueue('a') +#q->isEmpty +// => false + +#q->push('b') +#q->pop +// => a +#q->pop +// => b + +#q->isEmpty +// => true +#q->pop +// => void diff --git a/Task/Queue-Definition/Nim/queue-definition.nim b/Task/Queue-Definition/Nim/queue-definition.nim new file mode 100644 index 0000000000..62ca733a77 --- /dev/null +++ b/Task/Queue-Definition/Nim/queue-definition.nim @@ -0,0 +1,18 @@ +import queues + +# defining push & pop (obviously optional) +proc push*[T](q: var TQueue[T]; item: T) = + add(q,item) +proc pop*[T](q: var TQueue[T]): T = + result = dequeue(q) + +var fifo: TQueue[int] = initQueue[int]() + +fifo.push(26) +fifo.push(99) +fifo.push(2) +echo("Fifo size: ", fifo.len()) +echo("Popping: ", fifo.pop()) +echo("Popping: ", fifo.pop()) +echo("Popping: ", fifo.pop()) +#echo("Popping: ", fifo.pop()) # popping an empty stack raises [EAssertionFailed] diff --git a/Task/Queue-Definition/Oforth/queue-definition.oforth b/Task/Queue-Definition/Oforth/queue-definition.oforth new file mode 100644 index 0000000000..1c5698c974 --- /dev/null +++ b/Task/Queue-Definition/Oforth/queue-definition.oforth @@ -0,0 +1,6 @@ +Object Class new: Queue(mutable l) + +Queue method: initialize ListBuffer new := l ; +Queue method: empty @l isEmpty ; +Queue method: push @l add ; +Queue method: pop @l removeFirst ; diff --git a/Task/Queue-Definition/Phix/queue-definition.phix b/Task/Queue-Definition/Phix/queue-definition.phix new file mode 100644 index 0000000000..20ceb6d15a --- /dev/null +++ b/Task/Queue-Definition/Phix/queue-definition.phix @@ -0,0 +1,15 @@ +sequence queue = {} + +procedure push(object what) + queue = append(queue,what) +end procedure + +function pop() + object what = queue[1] + queue = queue[2..$] + return what +end function + +function empty() + return length(queue)=0 +end function diff --git a/Task/Queue-Definition/Sidef/queue-definition.sidef b/Task/Queue-Definition/Sidef/queue-definition.sidef new file mode 100644 index 0000000000..d527bc6350 --- /dev/null +++ b/Task/Queue-Definition/Sidef/queue-definition.sidef @@ -0,0 +1,13 @@ +class FIFO(*array) { + method pop { + array.is_empty && die "underflow"; + array.shift; + } + method push(*items) { + array += items; + self; + } + method empty { + array.len == 0; + } +} diff --git a/Task/Queue-Definition/Wart/queue-definition.wart b/Task/Queue-Definition/Wart/queue-definition.wart new file mode 100644 index 0000000000..4f77003995 --- /dev/null +++ b/Task/Queue-Definition/Wart/queue-definition.wart @@ -0,0 +1,20 @@ +def (queue seq) + (tag queue (list seq lastcons.seq len.seq)) + +def (enq x q) + do1 x + let (l last len) rep.q + rep.q.2 <- (len + 1) + if no.l + rep.q.1 <- (rep.q.0 <- list.x) + rep.q.1 <- (cdr.last <- list.x) + +def (deq q) + let (l last len) rep.q + ret ans car.l + unless zero?.len + rep.q.2 <- (len - 1) + rep.q.0 <- cdr.l + +def (len q) :case (isa queue q) + rep.q.2 diff --git a/Task/Queue-Definition/XLISP/queue-definition-1.xlisp b/Task/Queue-Definition/XLISP/queue-definition-1.xlisp new file mode 100644 index 0000000000..d56066a534 --- /dev/null +++ b/Task/Queue-Definition/XLISP/queue-definition-1.xlisp @@ -0,0 +1,17 @@ +(define-class queue + (instance-variables vals)) + +(define-method (queue 'initialize) + (setq vals '()) + self) + +(define-method (queue 'push x) + (setq vals (nconc vals (cons x nil)))) + +(define-method (queue 'pop) + (define val (car vals)) + (setq vals (cdr vals)) + val) + +(define-method (queue 'emptyp) + (null vals)) diff --git a/Task/Queue-Definition/XLISP/queue-definition-2.xlisp b/Task/Queue-Definition/XLISP/queue-definition-2.xlisp new file mode 100644 index 0000000000..a1a2c320f4 --- /dev/null +++ b/Task/Queue-Definition/XLISP/queue-definition-2.xlisp @@ -0,0 +1,24 @@ +[1] (define my-queue (queue 'new)) + +MY-QUEUE +[2] (my-queue 'push 1) + +(1) +[3] (my-queue 'push 2) + +(1 2) +[4] (my-queue 'emptyp) + +() +[5] (my-queue 'pop) + +1 +[6] (my-queue 'pop) + +2 +[7] (my-queue 'emptyp) + +#T +[8] (my-queue 'pop) + +() diff --git a/Task/Queue-Definition/jq/queue-definition-1.jq b/Task/Queue-Definition/jq/queue-definition-1.jq new file mode 100644 index 0000000000..e355563e18 --- /dev/null +++ b/Task/Queue-Definition/jq/queue-definition-1.jq @@ -0,0 +1,10 @@ +# An empty queue: +def fifo: []; + +def push(e): [e] + .; + +def pop: [.[0], .[1:]]; + +def pop_or_error: if length == 0 then error("pop_or_error") else pop end; + +def empty: length == 0; diff --git a/Task/Queue-Definition/jq/queue-definition-2.jq b/Task/Queue-Definition/jq/queue-definition-2.jq new file mode 100644 index 0000000000..548ce4eb5f --- /dev/null +++ b/Task/Queue-Definition/jq/queue-definition-2.jq @@ -0,0 +1,13 @@ +fifo | pop # produces [null,[]] + +fifo + | push(42) # enqueue + | push(43) # enqueue + | pop # dequeue + | .[0] # the value +# produces 43 + +fifo|push(1) as $q1 +| fifo|push(2) as $q2 +| [($q1|pop|.[0]), ($q2|pop|.[0])] +# produces: [1, 2] diff --git a/Task/Queue-Usage/8th/queue-usage.8th b/Task/Queue-Usage/8th/queue-usage.8th new file mode 100644 index 0000000000..a62dae8d5f --- /dev/null +++ b/Task/Queue-Usage/8th/queue-usage.8th @@ -0,0 +1,7 @@ +10 q:new \ create a new queue 10 deep +123 q:push +341 q:push \ push 123, 341 onto the queue +q:pop . cr \ displays 123 +q:len . cr \ displays 1 +q:pop . cr \ displays 341 +q:len . cr \ displays 0 diff --git a/Task/Queue-Usage/Lasso/queue-usage.lasso b/Task/Queue-Usage/Lasso/queue-usage.lasso new file mode 100644 index 0000000000..d2c7567574 --- /dev/null +++ b/Task/Queue-Usage/Lasso/queue-usage.lasso @@ -0,0 +1,20 @@ +local(queue) = queue +#queue->size +// => 0 + +#queue->insert('a') +#queue->insert('b') +#queue->insert('c') +#queue->size +// => 3 + +loop(#queue->size) => { + stdoutnl(#queue->get) +} +// => +// a +// b +// c + +#queue->size == 0 +// => true diff --git a/Task/Queue-Usage/Nim/queue-usage.nim b/Task/Queue-Usage/Nim/queue-usage.nim new file mode 100644 index 0000000000..3933cebb86 --- /dev/null +++ b/Task/Queue-Usage/Nim/queue-usage.nim @@ -0,0 +1,12 @@ +import queues + +var deq: TQueue[int] = initQueue[int]() + +deq.enqueue(26) +deq.add(99) # same as enqueue() +deq.enqueue(2) +echo("Dequeue size: ", deq.len()) +echo("De-queue: ", deq.dequeue()) +echo("De-queue: ", deq.dequeue()) +echo("De-queue: ", deq.dequeue()) +#echo("De-queue: ", deq.dequeue()) # dequeue an empty dequeue raises [EAssertionFailed] diff --git a/Task/Queue-Usage/Oforth/queue-usage.oforth b/Task/Queue-Usage/Oforth/queue-usage.oforth new file mode 100644 index 0000000000..92b2c366a3 --- /dev/null +++ b/Task/Queue-Usage/Oforth/queue-usage.oforth @@ -0,0 +1,5 @@ +: testQueue +| q i | + Queue new ->q + 20 loop: i [ i q push ] + while ( q empty not ) [ q pop . ] ; diff --git a/Task/Queue-Usage/Phix/queue-usage.phix b/Task/Queue-Usage/Phix/queue-usage.phix new file mode 100644 index 0000000000..fd0d3dce61 --- /dev/null +++ b/Task/Queue-Usage/Phix/queue-usage.phix @@ -0,0 +1,7 @@ +?empty() -- 1 +push(5) +?empty() -- 0 +push(6) +?pop() -- 5 +?pop() -- 6 +?empty() -- 1 diff --git a/Task/Queue-Usage/Sidef/queue-usage.sidef b/Task/Queue-Usage/Sidef/queue-usage.sidef new file mode 100644 index 0000000000..8771f925c6 --- /dev/null +++ b/Task/Queue-Usage/Sidef/queue-usage.sidef @@ -0,0 +1,10 @@ +var f = FIFO(); +say f.empty; # true +f.push('foo'); +f.push('bar', 'baz'); +say f.pop; # foo +say f.empty; # false + +var g = FIFO('xxx', 'yyy'); +say g.pop; # xxx +say f.pop; # bar diff --git a/Task/Quickselect-algorithm/Nim/quickselect-algorithm.nim b/Task/Quickselect-algorithm/Nim/quickselect-algorithm.nim new file mode 100644 index 0000000000..126b91ddeb --- /dev/null +++ b/Task/Quickselect-algorithm/Nim/quickselect-algorithm.nim @@ -0,0 +1,19 @@ +proc qselect[T](a: var openarray[T]; k: int, inl = 0, inr = -1): T = + var r = if inr >= 0: inr else: a.high + var st = 0 + for i in 0 .. < r: + if a[i] > a[r]: continue + swap a[i], a[st] + inc st + + swap a[r], a[st] + + if k == st: a[st] + elif st > k: qselect(a, k, 0, st - 1) + else: qselect(a, k, st, inr) + +let x = [9, 8, 7, 6, 5, 0, 1, 2, 3, 4] + +for i in 0..9: + var y = x + echo i, ": ", qselect(y, i) diff --git a/Task/Quickselect-algorithm/Phix/quickselect-algorithm.phix b/Task/Quickselect-algorithm/Phix/quickselect-algorithm.phix new file mode 100644 index 0000000000..29a661f3d2 --- /dev/null +++ b/Task/Quickselect-algorithm/Phix/quickselect-algorithm.phix @@ -0,0 +1,41 @@ +global function quick_select(sequence s, integer k) +integer left = 1, right = length(s), pos +object pivotv, tmp + + while left pivot}; + + given(var l = left.len) { + when (k) { pivot } + case (k < l) { __FUNC__(left, k) } + default { __FUNC__(right, k - l - 1) } + } +} + +var v = [9, 8, 7, 6, 5, 0, 1, 2, 3, 4]; +say v.range.map{|i| quickselect(v, i)}; diff --git a/Task/Quickselect-algorithm/Swift/quickselect-algorithm.swift b/Task/Quickselect-algorithm/Swift/quickselect-algorithm.swift new file mode 100644 index 0000000000..3e1ff66646 --- /dev/null +++ b/Task/Quickselect-algorithm/Swift/quickselect-algorithm.swift @@ -0,0 +1,20 @@ +func select(var elements: [T], n: Int) -> T { + var r = indices(elements) + while true { + let pivotIndex = partition(&elements, r) + if n == pivotIndex { + return elements[pivotIndex] + } else if n < pivotIndex { + r.endIndex = pivotIndex + } else { + r.startIndex = pivotIndex+1 + } + } +} + +for i in 0 ..< 10 { + let a = [9, 8, 7, 6, 5, 0, 1, 2, 3, 4] + print(select(a, i)) + if i < 9 { print(", ") } +} +println() diff --git a/Task/Quickselect-algorithm/jq/quickselect-algorithm-1.jq b/Task/Quickselect-algorithm/jq/quickselect-algorithm-1.jq new file mode 100644 index 0000000000..ddd81563be --- /dev/null +++ b/Task/Quickselect-algorithm/jq/quickselect-algorithm-1.jq @@ -0,0 +1,30 @@ +# Emit the k-th smallest item in the input array, +# or nothing if k is too small or too large. +# The smallest corresponds to k==1. +# The input array may hold arbitrary JSON entities, including null. +def quickselect(k): + + def partition(pivot): + reduce .[] as $x + # state: [less, other] + ( [ [], [] ]; # two empty arrays: + if $x < pivot + then .[0] += [$x] # add x to less + else .[1] += [$x] # add x to other + end + ); + + # recursive inner function has arity 0 for efficiency + def qs: # state: [kn, array] where kn counts from 0 + .[0] as $kn + | .[1] as $a + | $a[0] as $pivot + | ($a[1:] | partition($pivot)) as $p + | $p[0] as $left + | ($left|length) as $ll + | if $kn == $ll then $pivot + elif $kn < $ll then [$kn, $left] | qs + else [$kn - $ll - 1, $p[1] ] | qs + end; + + if length < k or k <= 0 then empty else [k-1, .] | qs end; diff --git a/Task/Quickselect-algorithm/jq/quickselect-algorithm-2.jq b/Task/Quickselect-algorithm/jq/quickselect-algorithm-2.jq new file mode 100644 index 0000000000..1d5a5a82b1 --- /dev/null +++ b/Task/Quickselect-algorithm/jq/quickselect-algorithm-2.jq @@ -0,0 +1,3 @@ +(0, 12, range(1;11)) as $k + | [9, 8, 7, 6, 5, 0, 1, 2, 3, 4] | quickselect($k) + | "k=\($k) => \(.)" diff --git a/Task/Quickselect-algorithm/jq/quickselect-algorithm-3.jq b/Task/Quickselect-algorithm/jq/quickselect-algorithm-3.jq new file mode 100644 index 0000000000..4e999203ce --- /dev/null +++ b/Task/Quickselect-algorithm/jq/quickselect-algorithm-3.jq @@ -0,0 +1,12 @@ +$ jq -n -r -f quickselect.jq +k=1 => 0 +k=2 => 1 +k=3 => 2 +k=4 => 3 +k=5 => 4 +k=6 => 5 +k=7 => 6 +k=8 => 7 +k=9 => 8 +k=10 => 9 +$ diff --git a/Task/Quine/Ceylon/quine.ceylon b/Task/Quine/Ceylon/quine.ceylon new file mode 100644 index 0000000000..64069b2003 --- /dev/null +++ b/Task/Quine/Ceylon/quine.ceylon @@ -0,0 +1 @@ +shared void run() {print(let (x = """shared void run() {print(let (x = $) x.replaceFirst("$", "\"\"\"" + x + "\"\"\""));}""") x.replaceFirst("$", "\"\"\"" + x + "\"\"\""));} diff --git a/Task/Quine/Commodore-BASIC/quine.commodore b/Task/Quine/Commodore-BASIC/quine.commodore new file mode 100644 index 0000000000..e93161ceb7 --- /dev/null +++ b/Task/Quine/Commodore-BASIC/quine.commodore @@ -0,0 +1,31 @@ +10 DATA 49,54,48,32,78,61,51,51,48,13,49,55,48,32,68,73,77,32,65,40,78,41,13 +20 DATA 49,56,48,32,70,79,82,32,73,61,48,32,84,79,32,78,13,49,57,48,32,58,32 +30 DATA 82,69,65,68,32,65,40,73,41,13,50,48,48,32,78,69,88,84,32,73,13,50,49 +40 DATA 48,32,70,79,82,32,73,61,48,32,84,79,32,49,52,32,13,50,50,48,32,58,32 +50 DATA 80,82,73,78,84,32,77,73,68,36,40,83,84,82,36,40,40,73,43,49,41,42,49 +60 DATA 48,41,44,50,41,59,34,32,68,65,84,65,32,34,59,77,73,68,36,40,83,84,82 +70 DATA 36,40,65,40,73,42,50,51,41,41,44,50,41,59,13,50,51,48,32,58,32,70,79 +80 DATA 82,32,74,61,49,32,84,79,32,50,50,13,50,52,48,32,58,32,32,32,75,61,73 +90 DATA 42,50,51,43,74,13,50,53,48,32,58,32,32,32,73,70,32,75,32,60,61,32,78 +100 DATA 32,84,72,69,78,32,80,82,73,78,84,32,34,44,34,59,77,73,68,36,40,83,84 +110 DATA 82,36,40,65,40,75,41,41,44,50,41,59,13,50,54,48,32,58,32,78,69,88,84 +120 DATA 32,74,13,50,55,48,32,58,32,80,82,73,78,84,13,50,56,48,32,78,69,88,84 +130 DATA 32,73,13,50,57,48,32,70,79,82,32,73,61,48,32,84,79,32,78,13,51,48,48 +140 DATA 32,58,32,80,82,73,78,84,32,67,72,82,36,40,65,40,73,41,41,59,13,51,49 +150 DATA 48,32,78,69,88,84,32,73,13 +160 N=330 +170 DIM A(N) +180 FOR I=0 TO N +190 : READ A(I) +200 NEXT I +210 FOR I=0 TO 14 +220 : PRINT MID$(STR$((I+1)*10),2);" DATA ";MID$(STR$(A(I*23)),2); +230 : FOR J=1 TO 22 +240 : K=I*23+J +250 : IF K <= N THEN PRINT ",";MID$(STR$(A(K)),2); +260 : NEXT J +270 : PRINT +280 NEXT I +290 FOR I=0 TO N +300 : PRINT CHR$(A(I)); +310 NEXT I diff --git a/Task/Quine/ERRE/quine.erre b/Task/Quine/ERRE/quine.erre new file mode 100644 index 0000000000..ebc4a62a45 --- /dev/null +++ b/Task/Quine/ERRE/quine.erre @@ -0,0 +1,36 @@ +PROGRAM QUINE +BEGIN +READ(D$,Y$) +LOOP + READ(X$) + EXIT IF LEN(X$)<1 + PRINT(X$) +END LOOP +RESTORE +LOOP + READ(X$) + EXIT IF LEN(X$)<1 + PRINT(D$;CHR$(34);X$;CHR$(34);CHR$(41)) +END LOOP +PRINT(D$;CHR$(34);CHR$(34);CHR$(41)) +PRINT(Y$) +DATA("DATA(") +DATA("END PROGRAM") +DATA("PROGRAM QUINE") +DATA("BEGIN") +DATA("READ(D$,Y$)") +DATA("LOOP") +DATA(" READ(X$)") +DATA(" EXIT IF LEN(X$)<1") +DATA(" PRINT(X$)") +DATA("END LOOP") +DATA("RESTORE") +DATA("LOOP") +DATA(" READ(X$)") +DATA(" EXIT IF LEN(X$)<1") +DATA(" PRINT(D$;CHR$(34);X$;CHR$(34);CHR$(41))") +DATA("END LOOP") +DATA("PRINT(D$;CHR$(34);CHR$(34);CHR$(41))") +DATA("PRINT(Y$)") +DATA("") +END PROGRAM diff --git a/Task/Quine/Free-Pascal/quine.free b/Task/Quine/Free-Pascal/quine.free new file mode 100644 index 0000000000..ae14f06695 --- /dev/null +++ b/Task/Quine/Free-Pascal/quine.free @@ -0,0 +1 @@ +const s=';begin writeln(#99#111#110#115#116#32#115#61#39,s,#39,s);readln;end.';begin writeln(#99#111#110#115#116#32#115#61#39,s,#39,s);readln;end. diff --git a/Task/Quine/Hoon/quine-1.hoon b/Task/Quine/Hoon/quine-1.hoon new file mode 100644 index 0000000000..18839b17cb --- /dev/null +++ b/Task/Quine/Hoon/quine-1.hoon @@ -0,0 +1 @@ +!: :- %say |= [^ [~ ~]] =+ ^= s ((list ,@tas) ~['!: :- %say |= [^ [~ ~]] =+ ^= s ((list ,@tas) ~[' 'x' ']) :- %noun (,tape (turn s |=(a=@tas ?:(=(a %x) (crip `(list ,@tas)`(turn s |=(b=@tas =+([s=?:(=(b %x) " " "") m=(trip ~~~27.)] (crip :(welp s m (trip b) m s)))))) a))))']) :- %noun (,tape (turn s |=(a=@tas ?:(=(a %x) (crip `(list ,@tas)`(turn s |=(b=@tas =+([s=?:(=(b %x) " " "") m=(trip ~~~27.)] (crip :(welp s m (trip b) m s)))))) a)))) diff --git a/Task/Quine/Hoon/quine-2.hoon b/Task/Quine/Hoon/quine-2.hoon new file mode 100644 index 0000000000..b6ee66672f --- /dev/null +++ b/Task/Quine/Hoon/quine-2.hoon @@ -0,0 +1 @@ +=-(`@t`(rap 3 - (scot %uw -) ")") 0wwai8F.8y0Fb.i1Tti.kwt6Z.zsOww.bi0P8.71xsy.xwt41.wa2QZ) diff --git a/Task/Quine/Hoon/quine-3.hoon b/Task/Quine/Hoon/quine-3.hoon new file mode 100644 index 0000000000..492c144a32 --- /dev/null +++ b/Task/Quine/Hoon/quine-3.hoon @@ -0,0 +1 @@ +=<(`_""`~[. `@`39 . `@`10.535] '=<(`_""`~[. `@`39 . `@`10.535] ') diff --git a/Task/Quine/Lasso/quine.lasso b/Task/Quine/Lasso/quine.lasso new file mode 100644 index 0000000000..2f1ecea2f0 --- /dev/null +++ b/Task/Quine/Lasso/quine.lasso @@ -0,0 +1,7 @@ +var(a=(:10,39,118,97,114,40,97,61,40,58,39,10,36,97,45,62,106,111,105,110,40,39,44,39,41,10,39,41,41,39,10,118,97,114,40,98,61,98,121,116,101,115,41,10,36,97,45,62,102,111,114,101,97,99,104,32,61,62,32,123,32,36,98,45,62,105,109,112,111,114,116,56,98,105,116,115,40,35,49,41,32,125,10,36,98,45,62,97,115,83,116,114,105,110,103)) +'var(a=(:' +$a->join(',') +'))' +var(b=bytes) +$a->foreach => { $b->import8bits(#1) } +$b->asString diff --git a/Task/Quine/Nim/quine-1.nim b/Task/Quine/Nim/quine-1.nim new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Task/Quine/Nim/quine-2.nim b/Task/Quine/Nim/quine-2.nim new file mode 100644 index 0000000000..1e6464f902 --- /dev/null +++ b/Task/Quine/Nim/quine-2.nim @@ -0,0 +1,2 @@ +const x = "var x = echo x[0..7],chr(34),x,chr(34),chr(10),x[8 .. -1]" +echo x[0..7],chr(34),x,chr(34),chr(10),x[8 .. -1] diff --git a/Task/Quine/Nim/quine-3.nim b/Task/Quine/Nim/quine-3.nim new file mode 100644 index 0000000000..a84a5df4f6 --- /dev/null +++ b/Task/Quine/Nim/quine-3.nim @@ -0,0 +1,4 @@ +const x = "const x = |const y = x[0..9]&34.chr&x&34.chr&10.chr&x[11..100]&10.chr&x[102..115]&10.chr&x[117 .. -1]|static: echo y|echo y" +const y = x[0..9]&34.chr&x&34.chr&10.chr&x[11..100]&10.chr&x[102..115]&10.chr&x[117 .. -1] +static: echo y +echo y diff --git a/Task/Quine/Oforth/quine.oforth b/Task/Quine/Oforth/quine.oforth new file mode 100644 index 0000000000..f36cf595aa --- /dev/null +++ b/Task/Quine/Oforth/quine.oforth @@ -0,0 +1 @@ +"dup 34 emit print 34 emit BL emit print" dup 34 emit print 34 emit BL emit print diff --git a/Task/Quine/Phix/quine.phix b/Task/Quine/Phix/quine.phix new file mode 100644 index 0000000000..a6b2772dbb --- /dev/null +++ b/Task/Quine/Phix/quine.phix @@ -0,0 +1 @@ +constant c="constant c=%sprintf(1,c,{34&c&34})"printf(1,c,{34&c&34}) diff --git a/Task/Quine/Ring/quine.ring b/Task/Quine/Ring/quine.ring new file mode 100644 index 0000000000..83c3562cae --- /dev/null +++ b/Task/Quine/Ring/quine.ring @@ -0,0 +1,2 @@ +v = "see substr(`v = ` + char(34) + `@` + char(34) + nl + `@` ,`@`,v)" +see substr(`v = ` + char(34) + `@` + char(34) + nl + `@` ,`@`,v) diff --git a/Task/Quine/Sidef/quine-1.sidef b/Task/Quine/Sidef/quine-1.sidef new file mode 100644 index 0000000000..c0012906a5 --- /dev/null +++ b/Task/Quine/Sidef/quine-1.sidef @@ -0,0 +1,2 @@ +s = %(s = %%(%s); printf(s, s); +); printf(s, s); diff --git a/Task/Quine/Sidef/quine-2.sidef b/Task/Quine/Sidef/quine-2.sidef new file mode 100644 index 0000000000..e3e0141512 --- /dev/null +++ b/Task/Quine/Sidef/quine-2.sidef @@ -0,0 +1,3 @@ +say(< K(1 To 5), K1(1 To 5) + + K(1) = &H00000000 ' (0 <= j <= 15) + K(2) = &H5A827999 ' (16 <= j <= 31) + K(3) = &H6ED9EBA1 ' (32 <= j <= 47) + K(4) = &H8F1BBCDC ' (48 <= j <= 63) + K(5) = &HA953FD4E ' (64 <= j <= 79) + K1(1) = &H50A28BE6 ' (0 <= j <= 15) + K1(2) = &H5C4DD124 ' (16 <= j <= 31) + K1(3) = &H6D703EF3 ' (32 <= j <= 47) + K1(4) = &H7A6D76E9 ' (48 <= j <= 63) + K1(5) = &H00000000 ' (64 <= j <= 79) + + Dim As UByte r(16 To ...) = _ + { 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, _ + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, _ + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, _ + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 } + + Dim As UByte r1(0 To ...) = _ + { 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, _ + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, _ + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, _ + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, _ + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 } + + Dim As UByte s(0 To ...) = _ + { 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, _ + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, _ + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, _ + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, _ + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 } + + Dim As UByte s1(0 To ...) = _ + { 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, _ + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, _ + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, _ + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, _ + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 } + + Dim As UInteger<32> h0 = &H67452301 + Dim As UInteger<32> h1 = &HEFCDAB89 + Dim As UInteger<32> h2 = &H98BADCFE + Dim As UInteger<32> h3 = &H10325476 + Dim As UInteger<32> h4 = &HC3D2E1F0 + + Dim As Long i, j + + Dim As ULongInt l = Len(message) + ' set the first bit after the message to 1 + message = message + Chr(1 Shl 7) + ' add one char to the length + Dim As ULong padding = 64 - ((l +1) Mod (512 \ 8)) ' 512 \ 8 = 64 char. + + ' check if we have enough room for inserting the length + If padding < 8 Then padding = padding + 64 + + message = message + String(padding, Chr(0)) ' adjust length + Dim As ULong l1 = Len(message) ' new length + + l = l * 8 ' orignal length in bits + ' create ubyte ptr to point to l ( = length in bits) + Dim As UByte Ptr ub_ptr = Cast(UByte Ptr, @l) + + For i = 0 To 7 'copy length of message to the last 8 bytes + message[l1 -8 + i] = ub_ptr[i] + Next + + Dim As UInteger<32> A, B, C, D, E, A1, B1, C1, D1, E1, T, T1 + + For i = 0 To (l1 -1) \ 64 ' split into 64 byte block + + ' x point to 16 * 4byte block inside the string message + Dim As UInteger<32> Ptr X = Cast(UInteger<32> Ptr, @message[i*64]) + + A = h0 : B = h1 : C = h2 : D = h3 : E = h4 + A1 = h0 : B1 = h1 : C1 = h2 : D1 = h3 : E1 = h4 + + For j = 0 To 79 + Select Case As Const j + Case 0 To 15 + T = A + f1(B, C, D) + X[j] '+ K(1) + T = ROtate_Left(T, s(j)) + E + T1 = A1 + f5(B1, C1, D1) + X[r1(j)] + K1(1) + T1 = ROtate_Left(T1, s1(j)) + E1 + Case 16 To 31 + T = A + f2(B, C, D) + X[r(j)] + K(2) + T = ROtate_Left(T, s(j)) + E + T1 = A1 + f4(B1, C1, D1) + X[r1(j)] + K1(2) + T1 = ROtate_Left(T1, s1(j)) + E1 + Case 32 To 47 + T = A + f3(B, C, D) + X[r(j)] + K(3) + T = ROtate_Left(T, s(j)) + E + T1 = A1 + f3(B1, C1, D1) + X[r1(j)] + K1(3) + T1 = ROtate_Left(T1, s1(j)) + E1 + Case 48 To 63 + T = A + f4(B, C, D) + X[r(j)] + K(4) + T = ROtate_Left(T, s(j)) + E + T1 = A1 + f2(B1, C1, D1) + X[r1(j)] + K1(4) + T1 = ROtate_Left(T1, s1(j)) + E1 + Case 64 To 79 + T = A + f5(B, C, D) + X[r(j)] + K(5) + T = ROtate_Left(T, s(j)) + E + T1 = A1 + f1(B1, C1, D1) + X[r1(j)] '+ K1(5) + T1 = ROtate_Left(T1, s1(j)) + E1 + End Select + + A = E : E = D : D = ROtate_Left(C, 10) : C = B : B = T + A1 = E1 : E1 = D1 : D1 = ROtate_left(C1, 10) : C1 = B1 : B1 = T1 + + Next + + T = h1 + C + D1 + h1 = h2 + D + E1 + h2 = h3 + E + A1 + h3 = h4 + A + B1 + h4 = h0 + B + C1 + h0 = T + + Next + + Dim As String answer + ' convert h0, h1, h2, h3 and h4 in hex, then add, low order first + Dim As String hs1 = Hex(h0, 8) + For i = 7 To 1 Step -2 : answer += Mid(hs1, i, 2) : Next + hs1 = Hex(h1, 8) + For i = 7 To 1 Step -2 : answer += Mid(hs1, i, 2) : Next + hs1 = Hex(h2, 8) + For i = 7 To 1 Step -2 : answer += Mid(hs1, i, 2) : Next + hs1 = Hex(h3, 8) + For i = 7 To 1 Step -2 : answer += Mid(hs1, i, 2) : Next + hs1 = Hex(h4, 8) + For i = 7 To 1 Step -2 : answer += Mid(hs1, i, 2) : Next + +Return LCase(answer) + +End Function + +' ------=< MAIN >=------ + +Dim As String test = "Rosetta Code" + +Print +Print test; " => "; RIPEMD_160(test) + + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/RIPEMD-160/Lasso/ripemd-160.lasso b/Task/RIPEMD-160/Lasso/ripemd-160.lasso new file mode 100644 index 0000000000..6b12a9f4a9 --- /dev/null +++ b/Task/RIPEMD-160/Lasso/ripemd-160.lasso @@ -0,0 +1 @@ +cipher_digest("Rosetta Code", -digest='RIPEMD160', -hex) diff --git a/Task/RIPEMD-160/Swift/ripemd-160-1.swift b/Task/RIPEMD-160/Swift/ripemd-160-1.swift new file mode 100644 index 0000000000..5b2bda3a35 --- /dev/null +++ b/Task/RIPEMD-160/Swift/ripemd-160-1.swift @@ -0,0 +1,197 @@ +// Circular left shift: http://en.wikipedia.org/wiki/Circular_shift +// Precendence should be the same as << +infix operator ~<< { precedence 160 associativity none } + +public func ~<< (lhs: UInt32, rhs: Int) -> UInt32 { + return (lhs << UInt32(rhs)) | (lhs >> UInt32(32 - rhs)); +} + + public struct Block { + public init() {} + + var message: [UInt32] = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + + // Initial values + var h₀: UInt32 = 0x67452301 + var h₁: UInt32 = 0xEFCDAB89 + var h₂: UInt32 = 0x98BADCFE + var h₃: UInt32 = 0x10325476 + var h₄: UInt32 = 0xC3D2E1F0 + + public var hash: [UInt32] { + return [h₀, h₁, h₂, h₃, h₄] + } + + // FIXME: Make private as soon as tests support that + public mutating func compress (message: [UInt32]) -> () { + assert(count(message) == 16, "Wrong message size") + + var Aᴸ = h₀ + var Bᴸ = h₁ + var Cᴸ = h₂ + var Dᴸ = h₃ + var Eᴸ = h₄ + + var Aᴿ = h₀ + var Bᴿ = h₁ + var Cᴿ = h₂ + var Dᴿ = h₃ + var Eᴿ = h₄ + + for j in 0...79 { + // Left side + let wordᴸ = message[r.Left[j]] + let functionᴸ = f(j) + + let Tᴸ: UInt32 = ((Aᴸ &+ functionᴸ(Bᴸ,Cᴸ,Dᴸ) &+ wordᴸ &+ K.Left[j]) ~<< s.Left[j]) &+ Eᴸ + + Aᴸ = Eᴸ + Eᴸ = Dᴸ + Dᴸ = Cᴸ ~<< 10 + Cᴸ = Bᴸ + Bᴸ = Tᴸ + + // Right side + let wordᴿ = message[r.Right[j]] + let functionᴿ = f(79 - j) + + let Tᴿ: UInt32 = ((Aᴿ &+ functionᴿ(Bᴿ,Cᴿ,Dᴿ) &+ wordᴿ &+ K.Right[j]) ~<< s.Right[j]) &+ Eᴿ + + Aᴿ = Eᴿ + Eᴿ = Dᴿ + Dᴿ = Cᴿ ~<< 10 + Cᴿ = Bᴿ + Bᴿ = Tᴿ + } + + let T = h₁ &+ Cᴸ &+ Dᴿ + h₁ = h₂ &+ Dᴸ &+ Eᴿ + h₂ = h₃ &+ Eᴸ &+ Aᴿ + h₃ = h₄ &+ Aᴸ &+ Bᴿ + h₄ = h₀ &+ Bᴸ &+ Cᴿ + h₀ = T + } + + public func f (j: Int) -> ((UInt32, UInt32, UInt32) -> UInt32) { + switch j { + case let index where j < 0: + assert(false, "Invalid j") + return {(_, _, _) in 0 } + case let index where j <= 15: + return {(x, y, z) in x ^ y ^ z } + case let index where j <= 31: + return {(x, y, z) in (x & y) | (~x & z) } + case let index where j <= 47: + return {(x, y, z) in (x | ~y) ^ z } + case let index where j <= 63: + return {(x, y, z) in (x & z) | (y & ~z) } + case let index where j <= 79: + return {(x, y, z) in x ^ (y | ~z) } + default: + assert(false, "Invalid j") + return {(_, _, _) in 0 } + } + } + + public enum K { + case Left, Right + + public subscript(j: Int) -> UInt32 { + switch j { + case let index where j < 0: + assert(false, "Invalid j") + return 0 + case let index where j <= 15: + return self == .Left ? 0x00000000 : 0x50A28BE6 + case let index where j <= 31: + return self == .Left ? 0x5A827999 : 0x5C4DD124 + case let index where j <= 47: + return self == .Left ? 0x6ED9EBA1 : 0x6D703EF3 + case let index where j <= 63: + return self == .Left ? 0x8F1BBCDC : 0x7A6D76E9 + case let index where j <= 79: + return self == .Left ? 0xA953FD4E : 0x00000000 + default: + assert(false, "Invalid j") + return 0 + } + } + } + + public enum r { + case Left, Right + + public subscript (j: Int) -> Int { + switch j { + case let index where j < 0: + assert(false, "Invalid j") + return 0 + case let index where j <= 15: + if self == .Left { + return index + } else { + return [5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12][index] + } + case let index where j <= 31: + if self == .Left { + return [ 7, 4,13, 1,10, 6,15, 3,12, 0, 9, 5, 2,14,11, 8][index - 16] + } else { + return [ 6,11, 3, 7, 0,13, 5,10,14,15, 8,12, 4, 9, 1, 2][index - 16] + } + case let index where j <= 47: + if self == .Left { + return [3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12][index - 32] + } else { + return [15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13][index - 32] + } + case let index where j <= 63: + if self == .Left { + return [1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2][index - 48] + } else { + return [8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14][index - 48] + } + case let index where j <= 79: + if self == .Left { + return [ 4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13][index - 64] + } else { + return [12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11][index - 64] + } + + default: + assert(false, "Invalid j") + return 0 + } + } + + + } + + public enum s { + case Left, Right + + public subscript(j: Int) -> Int { + switch j { + case let index where j < 0: + assert(false, "Invalid j") + return 0 + case let index where j <= 15: + return (self == .Left ? [11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8] : [8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6])[j] + case let index where j <= 31: + return (self == .Left ? [7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12] : [9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11])[j - 16] + case let index where j <= 47: + return (self == .Left ? [11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5] : [9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5])[j - 32] + case let index where j <= 63: + return (self == .Left ? [11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12] : [15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8])[j - 48] + case let index where j <= 79: + return (self == .Left ? [9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6] : [8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11])[j - 64] + default: + assert(false, "Invalid j") + return 0 + } + } + + } + + + + } diff --git a/Task/RIPEMD-160/Swift/ripemd-160-2.swift b/Task/RIPEMD-160/Swift/ripemd-160-2.swift new file mode 100644 index 0000000000..8045cb1d49 --- /dev/null +++ b/Task/RIPEMD-160/Swift/ripemd-160-2.swift @@ -0,0 +1,5 @@ +var block = Block() +let message:[UInt32] = [ 0x65_73_6f_52, 0x20_61_74_74, 0x65_64_6f_43, 0x00_00_00_80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0 ] +block.compress(message) +let digest = NSString(format: "%2x%2x%2x%2x%2x", UInt32(bigEndian: block.hash[0]), UInt32(bigEndian: block.hash[1]),UInt32(bigEndian: block.hash[2]), UInt32(bigEndian: block.hash[3]), UInt32(bigEndian: block.hash[4])) +println(digest) diff --git a/Task/RSA-code/Sidef/rsa-code.sidef b/Task/RSA-code/Sidef/rsa-code.sidef new file mode 100644 index 0000000000..96ef1c854b --- /dev/null +++ b/Task/RSA-code/Sidef/rsa-code.sidef @@ -0,0 +1,45 @@ +const n = 9516311845790656153499716760847001433441357 +const e = 65537 +const d = 5617843187844953170308463622230283376298685 + +module Message { + var alphabet = [('A' .. 'Z')..., ' '] + var rad = alphabet.len + var code = Hash(^rad -> map {|i| (alphabet[i], i) }...) + func encode(String t) { + [code{t.reverse.chars...}] ~Z* t.len.range.map { |i| rad**i } -> sum(0) + } + func decode(Number n) { + ''.join(alphabet[ + gather { + loop { + var (d, m) = n.divmod(rad) + take(m) + break if (n < rad) + n = d + } + }...] + ).reverse + } +} + +var secret_message = "ROSETTA CODE" +say "Secret message is #{secret_message}" + +var numeric_message = Message::encode(secret_message) +say "Secret message in integer form is #{numeric_message}" + +var numeric_cipher = expmod(numeric_message, e, n) +say "After exponentiation with public exponent we get: #{numeric_cipher}" + +var text_cipher = Message::decode(numeric_cipher) +say "This turns into the string #{text_cipher}" + +var numeric_cipher2 = Message::encode(text_cipher) +say "If we re-encode it in integer form we get #{numeric_cipher2}" + +var numeric_message2 = expmod(numeric_cipher2, d, n) +say "After exponentiation with SECRET exponent we get: #{numeric_message2}" + +var secret_message2 = Message::decode(numeric_message2) +say "This turns into the string #{secret_message2}" diff --git a/Task/Random-number-generator--device-/EchoLisp/random-number-generator--device-.echolisp b/Task/Random-number-generator--device-/EchoLisp/random-number-generator--device-.echolisp new file mode 100644 index 0000000000..cfa69f0386 --- /dev/null +++ b/Task/Random-number-generator--device-/EchoLisp/random-number-generator--device-.echolisp @@ -0,0 +1,10 @@ +(random-seed "simon") +(random (expt 2 32)) → 2275215386 +(random-seed "simon") +(random (expt 2 32)) → 2275215386 ;; the same + + +(random-seed (current-time-milliseconds )) +(random (expt 2 32)) → 4061857345 +(random-seed (current-time-milliseconds )) +(random (expt 2 32)) → 1322611152 diff --git a/Task/Random-number-generator--device-/FreeBASIC/random-number-generator--device-.freebasic b/Task/Random-number-generator--device-/FreeBASIC/random-number-generator--device-.freebasic new file mode 100644 index 0000000000..98b1efdc3f --- /dev/null +++ b/Task/Random-number-generator--device-/FreeBASIC/random-number-generator--device-.freebasic @@ -0,0 +1,10 @@ +' FB 1.05.0 Win64 + +Randomize , 5 + +'generate 10 cryptographic random integers in the range 1 To 100 +For i As Integer = 1 To 10 + Print Int(Rnd * 100) + 1 +Next + +Sleep diff --git a/Task/Random-number-generator--device-/Lasso/random-number-generator--device-.lasso b/Task/Random-number-generator--device-/Lasso/random-number-generator--device-.lasso new file mode 100644 index 0000000000..cacc2d9687 --- /dev/null +++ b/Task/Random-number-generator--device-/Lasso/random-number-generator--device-.lasso @@ -0,0 +1 @@ +file(`/dev/urandom`)->readSomeBytes(4)->export32bits diff --git a/Task/Random-number-generator--device-/Nim/random-number-generator--device-.nim b/Task/Random-number-generator--device-/Nim/random-number-generator--device-.nim new file mode 100644 index 0000000000..aba51dee02 --- /dev/null +++ b/Task/Random-number-generator--device-/Nim/random-number-generator--device-.nim @@ -0,0 +1,5 @@ +var f = open("/dev/urandom") +var r: int32 +discard f.readBuffer(addr r, 4) +close(f) +echo r diff --git a/Task/Random-number-generator--device-/Ring/random-number-generator--device-.ring b/Task/Random-number-generator--device-/Ring/random-number-generator--device-.ring new file mode 100644 index 0000000000..268de69f6a --- /dev/null +++ b/Task/Random-number-generator--device-/Ring/random-number-generator--device-.ring @@ -0,0 +1,4 @@ +nr = 10 +for i = 1 to nr + see random(i) + nl +next diff --git a/Task/Random-number-generator--device-/Sidef/random-number-generator--device-.sidef b/Task/Random-number-generator--device-/Sidef/random-number-generator--device-.sidef new file mode 100644 index 0000000000..7a34f4e80f --- /dev/null +++ b/Task/Random-number-generator--device-/Sidef/random-number-generator--device-.sidef @@ -0,0 +1,11 @@ +func urandom() { + const device = %f'/dev/urandom'; + + device.open('<:raw', \var fh, \var err) -> + || die "Can't open `#{device}': #{err}"; + + fh.sysread(\var noise, 4); + 'L'.unpack(noise); +} + +say urandom(); # sample: 3517432564 diff --git a/Task/Random-number-generator--included-/EchoLisp/random-number-generator--included-.echolisp b/Task/Random-number-generator--included-/EchoLisp/random-number-generator--included-.echolisp new file mode 100644 index 0000000000..29edeec64b --- /dev/null +++ b/Task/Random-number-generator--included-/EchoLisp/random-number-generator--included-.echolisp @@ -0,0 +1,7 @@ +(random-seed "albert") +(random) → 0.9672510261922906 ; random float in [0 ... 1[ +(random 1000) → 726 ; random integer in [0 ... 1000 [ +(random -1000) → -936 ; random integer in ]-1000 1000[ + +(lib 'bigint) +(random 1e200) → 48635656441292641677...3917639734865662239925...9490799697903133046309616766848265781368 diff --git a/Task/Random-number-generator--included-/Ring/random-number-generator--included-.ring b/Task/Random-number-generator--included-/Ring/random-number-generator--included-.ring new file mode 100644 index 0000000000..b70d17b441 --- /dev/null +++ b/Task/Random-number-generator--included-/Ring/random-number-generator--included-.ring @@ -0,0 +1,4 @@ +nr = 10 +for i = 1 to nr + see random(i) + nl +next diff --git a/Task/Random-number-generator--included-/Sidef/random-number-generator--included-.sidef b/Task/Random-number-generator--included-/Sidef/random-number-generator--included-.sidef new file mode 100644 index 0000000000..2fa11ffafd --- /dev/null +++ b/Task/Random-number-generator--included-/Sidef/random-number-generator--included-.sidef @@ -0,0 +1,2 @@ +say 1.rand # random float in the interval [0,1) +say 100.irand # random integer in the interval [0,100) diff --git a/Task/Random-numbers/ERRE/random-numbers.erre b/Task/Random-numbers/ERRE/random-numbers.erre new file mode 100644 index 0000000000..444ec576d4 --- /dev/null +++ b/Task/Random-numbers/ERRE/random-numbers.erre @@ -0,0 +1,35 @@ +PROGRAM DISTRIBUTION + +! +! for rosettacode.org +! + +! formulas taken from TI-59 Master Library manual + +CONST NUM_ITEM=1000 + +!VAR SUMX#,SUMX2#,R1#,R2#,Z#,I% + +DIM A#[1000] + +BEGIN +! seeds random number generator with system time + RANDOMIZE(TIMER) + + PRINT(CHR$(12);) !CLS + SUMX#=0 SUMX2#=0 + + FOR I%=1 TO NUM_ITEM DO + R1#=RND(1) R2#=RND(1) + Z#=SQR(-2*LOG(R1#))*COS(2*π*R2#) + A#[I%]=Z#/2+1 ! I want a normal distribution with + ! mean=1 and std.dev=0.5 + SUMX#+=A#[I%] SUMX2#+=A#[I%]*A#[I%] + END FOR + + Z#=SUMX#/NUM_ITEM + + PRINT("Average is";Z#) + PRINT("Standard dev. is";SQR(SUMX2#/NUM_ITEM-Z#*Z#)) + +END PROGRAM diff --git a/Task/Random-numbers/Free-Pascal/random-numbers.free b/Task/Random-numbers/Free-Pascal/random-numbers.free new file mode 100644 index 0000000000..8324f6280f --- /dev/null +++ b/Task/Random-numbers/Free-Pascal/random-numbers.free @@ -0,0 +1 @@ +function randg(mean,stddev: float): float; diff --git a/Task/Random-numbers/FreeBASIC/random-numbers.freebasic b/Task/Random-numbers/FreeBASIC/random-numbers.freebasic new file mode 100644 index 0000000000..c8987358b6 --- /dev/null +++ b/Task/Random-numbers/FreeBASIC/random-numbers.freebasic @@ -0,0 +1,36 @@ +' FB 1.05.0 Win64 + +Const pi As Double = 3.141592653589793 +Randomize + +' Generates normally distributed random numbers with mean 0 and standard deviation 1 +Function randomNormal() As Double + Return Cos(2.0 * pi * Rnd) * Sqr(-2.0 * Log(Rnd)) +End Function + +Dim r(0 To 999) As Double +Dim sum As Double = 0.0 + +' Generate 1000 normally distributed random numbers +' with mean 1 and standard deviation 0.5 +' and calculate their sum +For i As Integer = 0 To 999 + r(i) = 1.0 + randomNormal/2.0 + sum += r(i) +Next + +Dim mean As Double = sum / 1000.0 + +Dim sd As Double +sum = 0.0 +' Now calculate their standard deviation +For i As Integer = 0 To 999 + sum += (r(i) - mean) ^ 2.0 +Next +sd = Sqr(sum/1000.0) + +Print "Mean is "; mean +Print "Standard Deviation is"; sd +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Random-numbers/FutureBasic/random-numbers.futurebasic b/Task/Random-numbers/FutureBasic/random-numbers.futurebasic new file mode 100644 index 0000000000..203971886f --- /dev/null +++ b/Task/Random-numbers/FutureBasic/random-numbers.futurebasic @@ -0,0 +1,31 @@ +include "ConsoleWindow" + +local fn RandomZeroToOne as double +dim as double result +BeginCCode + result = (double)( (rand() % 100000 ) * 0.00001 ); +EndC +end fn = result + +local fn RandomGaussian as double +dim as double r + +r = fn RandomZeroToOne +end fn = 1 + .5 * ( sqr( -2 * log(r) ) * cos( 2 * pi * r ) ) + +dim as long i +dim as double mean, std, a(1000) + +for i = 1 to 1000 + a(i) = fn RandomGaussian + mean += a(i) +next +mean = mean / 1000 + +for i = 1 to 1000 + std += ( a(i) - mean )^2 +next +std = std / 1000 + +print " Average:"; mean +print "Standard Deviation:"; std diff --git a/Task/Random-numbers/Nim/random-numbers.nim b/Task/Random-numbers/Nim/random-numbers.nim new file mode 100644 index 0000000000..31ab2134f7 --- /dev/null +++ b/Task/Random-numbers/Nim/random-numbers.nim @@ -0,0 +1,14 @@ +import math, strutils + +const precisn = 5 +var rs: TRunningStat + +proc normGauss: float {.inline.} = 1 + 0.76 * cos(2*PI*random(1.0)) * sqrt(-2*log10(random(1.0))) + +randomize() + +for j in 0..5: + for i in 0..1000: + rs.push(normGauss()) + echo("mean: ", $formatFloat(rs.mean,ffDecimal,precisn), + " stdDev: ", $formatFloat(rs.standardDeviation(),ffDecimal,precisn)) diff --git a/Task/Random-numbers/Phix/random-numbers.phix b/Task/Random-numbers/Phix/random-numbers.phix new file mode 100644 index 0000000000..580d61164e --- /dev/null +++ b/Task/Random-numbers/Phix/random-numbers.phix @@ -0,0 +1,8 @@ +function RandomNormal() + return sqrt(-2*log(rnd())) * cos(2*PI*rnd()) +end function + +sequence s = repeat(0,1000) +for i=1 to length(s) do + s[i] = 1 + 0.5 * RandomNormal() +end for diff --git a/Task/Random-numbers/Ring/random-numbers.ring b/Task/Random-numbers/Ring/random-numbers.ring new file mode 100644 index 0000000000..ad4e3dc4b3 --- /dev/null +++ b/Task/Random-numbers/Ring/random-numbers.ring @@ -0,0 +1,3 @@ +for i = 1 to 10 + see random(i) + nl +next i diff --git a/Task/Random-numbers/Sidef/random-numbers.sidef b/Task/Random-numbers/Sidef/random-numbers.sidef new file mode 100644 index 0000000000..cef25f9621 --- /dev/null +++ b/Task/Random-numbers/Sidef/random-numbers.sidef @@ -0,0 +1,2 @@ +var arr = 1000.of { 1 + (0.5 * (-2 * 1.rand.log -> sqrt) * (Number.tau * 1.rand -> cos)) } +arr.each { .say } diff --git a/Task/Random-numbers/Visual-FoxPro/random-numbers.visual b/Task/Random-numbers/Visual-FoxPro/random-numbers.visual new file mode 100644 index 0000000000..fe135d5ec3 --- /dev/null +++ b/Task/Random-numbers/Visual-FoxPro/random-numbers.visual @@ -0,0 +1,26 @@ +LOCAL i As Integer, m As Double, n As Integer, sd As Double +py = PI() +SET TALK OFF +SET DECIMALS TO 6 +CREATE CURSOR gdev (deviate B(6)) +RAND(-1) +n = 1000 +m = 1 +sd = 0.5 +CLEAR +FOR i = 1 TO n + INSERT INTO gdev VALUES (GaussDev(m, 1/sd)) +ENDFOR +CALCULATE AVG(deviate), STD(deviate) TO m, sd +? "Mean", m, "Std Dev", sd +SET TALK ON +SET DECIMALS TO + +FUNCTION GaussDev(mean As Double, sdev As Double) As Double +LOCAL z As Double +z = SQRT(-2*LOG(RAND()))*COS(py*RAND()) +IF sdev # 0 + z = mean + z/sdev +ENDIF +RETURN z +ENDFUNC diff --git a/Task/Random-numbers/jq/random-numbers-1.jq b/Task/Random-numbers/jq/random-numbers-1.jq new file mode 100644 index 0000000000..ee8d750b10 --- /dev/null +++ b/Task/Random-numbers/jq/random-numbers-1.jq @@ -0,0 +1,8 @@ +# 15-bit integers generated using the same formula as rand() from the Microsoft C Runtime. +# The random numbers are in [0 -- 32767] inclusive. +# Input: an array of length at least 2 interpreted as [count, state, ...] +# Output: [count+1, newstate, r] where r is the next pseudo-random number. +def next_rand_Microsoft: + .[0] as $count | .[1] as $state + | ( (214013 * $state) + 2531011) % 2147483648 # mod 2^31 + | [$count+1 , ., (. / 65536 | floor) ] ; diff --git a/Task/Random-numbers/jq/random-numbers-2.jq b/Task/Random-numbers/jq/random-numbers-2.jq new file mode 100644 index 0000000000..3e353db1d3 --- /dev/null +++ b/Task/Random-numbers/jq/random-numbers-2.jq @@ -0,0 +1,20 @@ +# Generate a single number following the normal distribution with mean 0, variance 1, +# using the Box-Muller method: X = sqrt(-2 ln U) * cos(2 pi V) where U and V are uniform on [0,1]. +# Input: [n, state] +# Output [n+1, nextstate, r] +def next_rand_normal: + def u: next_rand_Microsoft | .[2] /= 32767; + u as $u1 + | ($u1 | u) as $u2 + | ((( (8*(1|atan)) * $u1[2]) | cos) + * ((-2 * (($u2[2]) | log)) | sqrt)) as $r + | [ (.[0]+1), $u2[1], $r] ; + +# Generate "count" arrays, each containing a random normal variate with the given mean and standard deviation. +# Input: [count, state] +# Output: [updatedcount, updatedstate, rnv] +# where "state" is a seed and "updatedstate" can be used as a seed. +def random_normal_variate(mean; sd; count): + next_rand_normal + | recurse( if .[0] < count then next_rand_normal else empty end) + | .[2] = (.[2] * sd) + mean; diff --git a/Task/Random-numbers/jq/random-numbers-3.jq b/Task/Random-numbers/jq/random-numbers-3.jq new file mode 100644 index 0000000000..b5b3c42196 --- /dev/null +++ b/Task/Random-numbers/jq/random-numbers-3.jq @@ -0,0 +1,6 @@ +def summary: + length as $l | add as $sum | ($sum/$l) as $a + | reduce .[] as $x (0; . + ( ($x - $a) | .*. )) + | [ $a, (./$l | sqrt)] ; + +[ [0,1] | random_normal_variate(1; 0.5; 1000) | .[2] ] | summary diff --git a/Task/Range-expansion/8th/range-expansion.8th b/Task/Range-expansion/8th/range-expansion.8th new file mode 100644 index 0000000000..aa652b36a8 --- /dev/null +++ b/Task/Range-expansion/8th/range-expansion.8th @@ -0,0 +1,61 @@ +\ Given a low and high limit, create an array containing the numbers in the +\ range, inclusive: +: n:gen-range \ low hi -- a + \ make sure they are in order: + 2dup n:> if swap then + \ fill the array with the values: + [] ' a:push + 2swap loop ; + +\ Take a string, either "X" or "X-Y", and correctly return either a number (if +\ "X") or an array of numbers (if "X-Y"): +: n:expand-one \ s -- n | a[n,..m] + \ First see if we can parse a number. This works in the "X" case: + dup >n null? if + \ Failed >n because it's (possibly) "X-Y" + drop + \ not a valid number, might be a range + \ We'll use a capturing regex to handle the different cases correctly: + /(-?[0-9]+)-(-?[0-9]+)/ tuck r:match + + \ If the regex matches three (the whole string, plus the two captured + \ expressions) then it's a valid "X-Y": + 3 n:= if + 1 r:@ >n swap 2 r:@ >n nip + \ generate the range: + n:gen-range + else + \ The regex didn't match, so we got garbage. Therefore, return a 'null': + drop null + then + else + \ It was a "X", just drop the original string: + nip + then + ; + +\ Take an array (possibly) containing other arrays, and flatten any contained +\ arrays so the result is a simple array: +: a:flatten \ a1 -- a2 + [] >r + ( + nip + array? if + a:flatten r> swap a:+ >r + else + r> swap a:push >r + then + ) a:each drop r> ; + +\ Take a comma-delimited string of ranges, and expand it into an array of +\ numbers: +: n:range-expand \ str -- a + "," s:/ + ' n:expand-one a:map + a:flatten ; + +\ Process a list: +"-6,-3--1,3-5,7-11,14,15,17-20" +n:range-expand +\ print the expanded list: +. cr bye diff --git a/Task/Range-expansion/EchoLisp/range-expansion.echolisp b/Task/Range-expansion/EchoLisp/range-expansion.echolisp new file mode 100644 index 0000000000..80fcc9f255 --- /dev/null +++ b/Task/Range-expansion/EchoLisp/range-expansion.echolisp @@ -0,0 +1,25 @@ +;; parsing [spaces][-]digit(s)-[-]digit(s)[spaces] +(define R (make-regexp "^ *(\-?\\d+)\-(\-?\\d+) *$" )) + +;; the native (range a b) is [a ... b[ +;; (range+ a b) is [a ... b] +(define (range+ a b) + (if (< a b) (range a (1+ b)) + (if (> a b) (range a (1- b) -1) + (list a)))) + +;; in : string : "number" or "number-number" +;; out : a range = list of integer(s) +(define (do-range str) +(define from-to (regexp-exec R str)) ;; "1-3" --> ("1" "3") +(if from-to + (range+ (string->number (first from-to)) (string->number (second from-to))) + (list (string->number str)))) + +(define (ranges str) + (apply append (map do-range (string-split str ",")))) + + +(define task "-6,-3--1,3-5,7-11,14,15,17-20") +(ranges task) + → (-6 -3 -2 -1 3 4 5 7 8 9 10 11 14 15 17 18 19 20) diff --git a/Task/Range-expansion/FreeBASIC/range-expansion.freebasic b/Task/Range-expansion/FreeBASIC/range-expansion.freebasic new file mode 100644 index 0000000000..ff109d8f9f --- /dev/null +++ b/Task/Range-expansion/FreeBASIC/range-expansion.freebasic @@ -0,0 +1,75 @@ +' FB 1.05.0 Win64 + +Sub split (s As Const String, sepList As Const String, result() As String) + If s = "" OrElse sepList = "" Then + Redim result(0) + result(0) = s + Return + End If + Dim As Integer i, j, count = 0, empty = 0, length + Dim As Integer position(Len(s) + 1) + position(0) = 0 + + For i = 0 To len(s) - 1 + For j = 0 to Len(sepList) - 1 + If s[i] = sepList[j] Then + count += 1 + position(count) = i + 1 + End If + Next j + Next i + + Redim result(count) + If count = 0 Then + result(0) = s + Return + End If + + position(count + 1) = len(s) + 1 + + For i = 1 To count + 1 + length = position(i) - position(i - 1) - 1 + result(i - 1) = Mid(s, position(i - 1) + 1, length) + Next +End Sub + +Function expandRange(s As Const String) As String + If s = "" Then Return "" + Dim b() As String + Dim c() As String + Dim result As String = "" + Dim As Integer start = 0, finish = 0, length + split s, ",", b() + For i As Integer = LBound(b) To UBound(b) + split b(i), "-", c() + length = UBound(c) - LBound(c) + 1 + If length = 1 Then + start = ValLng(c(LBound(c))) + finish = start + ElseIf length = 2 Then + If Left(b(i), 1) = "-" Then + start = -ValLng(c(UBound(c))) + finish = start + Else + start = ValLng(c(LBound(c))) + finish = ValLng(c(UBound(c))) + End If + ElseIf length = 3 Then + start = -ValLng(c(LBound(c) + 1)) + finish = ValLng(c(UBound(c))) + Else + start = -ValLng(c(LBound(c) + 1)) + finish = -ValLng(c(UBound(c))) + End If + For j As Integer = start To finish + result += Str(j) + ", " + Next j + Next i + Return Left(result, Len(result) - 2) '' get rid of final ", " +End Function + +Dim s As String = "-6,-3--1,3-5,7-11,14,15,17-20" +Print expandRange(s) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Range-expansion/Lasso/range-expansion.lasso b/Task/Range-expansion/Lasso/range-expansion.lasso new file mode 100644 index 0000000000..db574d08f0 --- /dev/null +++ b/Task/Range-expansion/Lasso/range-expansion.lasso @@ -0,0 +1,13 @@ +define range_expand(expression::string) => { + local(parts) = regexp(`^(-?\d+)-(-?\d+)$`) + + return ( + with elm in #expression->split(`,`) + let isRange = #parts->setInput(#elm)&matches + select #isRange + ? (integer(#parts->matchString(1)) to integer(#parts->matchString(2)))->asString + | integer(#elm)->asString + )->join(', ') +} + +range_expand(`-6,-3--1,3-5,7-11,14,15,17-20`) diff --git a/Task/Range-expansion/Lingo/range-expansion-1.lingo b/Task/Range-expansion/Lingo/range-expansion-1.lingo new file mode 100644 index 0000000000..6ca258888b --- /dev/null +++ b/Task/Range-expansion/Lingo/range-expansion-1.lingo @@ -0,0 +1,21 @@ +-- Note: currently does not support extra white space in input string +on expandRange (str) + res = "" + _player.itemDelimiter = "," + cnt = str.item.count + repeat with i = 1 to cnt + part = str.item[i] + pos = offset("-", part.char[2..part.length]) + if pos>0 then + a = integer(part.char[1..pos]) + b = integer(part.char[pos+2..part.length]) + repeat with j = a to b + put j&"," after res + end repeat + else + put part&"," after res + end if + end repeat + delete the last char of res + return res +end diff --git a/Task/Range-expansion/Lingo/range-expansion-2.lingo b/Task/Range-expansion/Lingo/range-expansion-2.lingo new file mode 100644 index 0000000000..f439d4f744 --- /dev/null +++ b/Task/Range-expansion/Lingo/range-expansion-2.lingo @@ -0,0 +1,2 @@ +put expandRange("-6,-3--1,3-5,7-11,14,15,17-20") +-- "-6,-3,-2,-1,3,4,5,7,8,9,10,11,14,15,17,18,19,20" diff --git a/Task/Range-expansion/LiveCode/range-expansion-1.livecode b/Task/Range-expansion/LiveCode/range-expansion-1.livecode new file mode 100644 index 0000000000..7d75963457 --- /dev/null +++ b/Task/Range-expansion/LiveCode/range-expansion-1.livecode @@ -0,0 +1,38 @@ +function range beginning ending stepping + local tRange, tBegin, tEnd, tstep + if stepping is empty or stepping is 0 then + put 1 into tstep + else + put abs(stepping) into tstep + end if + + if ending is empty or isNumber(ending) is not true then + put 0 into tEnd + else + put ending into tEnd + end if + + if beginning is empty or isNumber(beginning) is not true then + put 0 into tBegin + else + put beginning into tBegin + end if + + repeat with r = tBegin to tEnd step tstep + put space & r after tRange + end repeat + return word 1 to -1 of tRange +end range + +function expandRange rangeExpr + put rangeExpr into tRange + split tRange by comma + repeat with n = 1 to the number of elements of tRange + if matchText(tRange[n],"^(\-*\d+)\-(\-*\d+)",beginning, ending) then + put range(beginning, ending, 1) & space after z + else + put tRange[n] & space after z + end if + end repeat + return z +end expandRange diff --git a/Task/Range-expansion/LiveCode/range-expansion-2.livecode b/Task/Range-expansion/LiveCode/range-expansion-2.livecode new file mode 100644 index 0000000000..779832d9a2 --- /dev/null +++ b/Task/Range-expansion/LiveCode/range-expansion-2.livecode @@ -0,0 +1,2 @@ +expandRange("-6,-3--1,3-5,7-11,14,15,17-20") +-6 -3 -2 -1 3 4 5 7 8 9 10 11 14 15 17 18 19 20 diff --git a/Task/Range-expansion/Nim/range-expansion.nim b/Task/Range-expansion/Nim/range-expansion.nim new file mode 100644 index 0000000000..848195129c --- /dev/null +++ b/Task/Range-expansion/Nim/range-expansion.nim @@ -0,0 +1,24 @@ +import parseutils, re, strutils + +proc expandRange(input: string): string = + var output: seq[string] = @[] + for range in input.split(','): + var sep = range.find('-', 1) + if sep > 0: # parse range + var first = -1 + if range.substr(0, sep-1).parseInt(first) == 0: + break + var last = -1 + if range.substr(sep+1).parseInt(last) == 0: + break + for i in first..last: + output.add($i) + else: # parse single number + var n = -1 + if range.parseInt(n) > 0: + output.add($n) + else: + break + return output.join(",") + +echo("-6,-3--1,3-5,7-11,14,15,17-20".expandRange) diff --git a/Task/Range-expansion/Oforth/range-expansion.oforth b/Task/Range-expansion/Oforth/range-expansion.oforth new file mode 100644 index 0000000000..5050037da6 --- /dev/null +++ b/Task/Range-expansion/Oforth/range-expansion.oforth @@ -0,0 +1,10 @@ +: addRange( s res -- ) +| i n | + s asInteger dup ifNotNull: [ res add return ] drop + s indexOfFrom('-', 2) ->i + s left( i 1- ) asInteger s right( s size i - ) asInteger + for: n [ n res add ] +; + +: rangeExpand ( s -- [ n ] ) + ArrayBuffer new s wordsWith( ',' ) apply( #[ over addRange ] ) ; diff --git a/Task/Range-expansion/Sidef/range-expansion.sidef b/Task/Range-expansion/Sidef/range-expansion.sidef new file mode 100644 index 0000000000..d75c9c211a --- /dev/null +++ b/Task/Range-expansion/Sidef/range-expansion.sidef @@ -0,0 +1,12 @@ +func rangex(str) { + str.split(',').map { |r| + var m = r.match(/^ + (?(DEFINE) (?[+-]?[0-9]+) ) + (?(?&int))-(?(?&int)) + $/x) + m ? do {var c = m.ncap; (Num(c{:from}) .. Num(c{:to}))...} + : Num(r) + } +} + +say rangex('-6,-3--1,3-5,7-11,14,15,17-20').join(',') diff --git a/Task/Range-expansion/jq/range-expansion-1.jq b/Task/Range-expansion/jq/range-expansion-1.jq new file mode 100644 index 0000000000..a8d66ab307 --- /dev/null +++ b/Task/Range-expansion/jq/range-expansion-1.jq @@ -0,0 +1,11 @@ +def expand_range: + def number: "-?[0-9]+"; + def expand: [range(.[0]; .[1] + 1)]; + + split(",") + | reduce .[] as $r + ( []; . + + ($r | if test("^\(number)$") then [tonumber] + else sub( "(?\(number))-(?\(number))"; "\(.x):\(.y)") + | split(":") | map(tonumber) | expand + end)); diff --git a/Task/Range-expansion/jq/range-expansion-2.jq b/Task/Range-expansion/jq/range-expansion-2.jq new file mode 100644 index 0000000000..3ddd89d367 --- /dev/null +++ b/Task/Range-expansion/jq/range-expansion-2.jq @@ -0,0 +1 @@ +"-6,-3--1,3-5,7-11,14,15,17-20" | expand_range diff --git a/Task/Range-extraction/Ceylon/range-extraction.ceylon b/Task/Range-extraction/Ceylon/range-extraction.ceylon new file mode 100644 index 0000000000..86ed721c83 --- /dev/null +++ b/Task/Range-extraction/Ceylon/range-extraction.ceylon @@ -0,0 +1,44 @@ +shared void run() { + + value numbers = [ + 0, 1, 2, 4, 6, 7, 8, 11, 12, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 27, 28, 29, 30, 31, 32, 33, 35, 36, + 37, 38, 39 + ]; + + function asRangeFormattedString([Value*] values) + given Value satisfies Enumerable { + + value builder = StringBuilder(); + + void append(Range range) { + if(!builder.empty) { + builder.append(","); + } + if(1 <= range.size < 3) { + builder.append(",".join(range)); + } else { + builder.append("``range.first``-``range.last``"); + } + } + + if(nonempty values) { + variable value currentRange = values.first..values.first; + for(val in values.rest) { + if(currentRange.last.successor == val) { + currentRange = currentRange.first..val; + } else { + append(currentRange); + currentRange = val..val; + } + } + append(currentRange); + } + return builder.string; + } + + value rangeString = asRangeFormattedString(numbers); + assert(rangeString == "0-2,4,6-8,11,12,14-25,27-33,35-39"); + print(rangeString); +} diff --git a/Task/Range-extraction/EchoLisp/range-extraction.echolisp b/Task/Range-extraction/EchoLisp/range-extraction.echolisp new file mode 100644 index 0000000000..e44c1dbf8d --- /dev/null +++ b/Task/Range-extraction/EchoLisp/range-extraction.echolisp @@ -0,0 +1,24 @@ +(define task '(0 1 2 4 6 7 8 11 12 14 15 16 17 18 19 20 21 22 23 24 25 27 28 29 30 31 32 33 35 36 37 38 39)) + +;; 1- GROUPING +(define (group-range item acc) +(if + (or (empty? acc) (!= (caar acc) (1- item))) + (cons (cons item item) acc) + (begin (set-car! (car acc) item) acc))) + +;; intermediate result +;; (foldl group-range () task) +;; → ((39 . 35) (33 . 27) (25 . 14) (12 . 11) (8 . 6) (4 . 4) (2 . 0)) + +;; 2- FORMATTING +(define (range->string range) +(let ((from (rest range)) (to (first range))) + (cond + ((= from to) (format "%d " from)) + ((= to (1+ from)) (format "%d, %d " from to)) + (else (format "%d-%d " from to))))) + +;; 3 - FINAL +(string-join (map range->string (reverse (foldl group-range () task))) ",") + → "0-2 ,4 ,6-8 ,11, 12 ,14-25 ,27-33 ,35-39 " diff --git a/Task/Range-extraction/FreeBASIC/range-extraction.freebasic b/Task/Range-extraction/FreeBASIC/range-extraction.freebasic new file mode 100644 index 0000000000..ebac87201d --- /dev/null +++ b/Task/Range-extraction/FreeBASIC/range-extraction.freebasic @@ -0,0 +1,46 @@ +' FB 1.05.0 Win64 + +Function formatRange (a() As Integer) As String + Dim lb As Integer = LBound(a) + Dim ub As Integer = UBound(a) + If ub = - 1 Then Return "" + If lb = ub Then Return Str(a(lb)) + Dim rangeCount As Integer = 1 + Dim range As String = Str(a(lb)) + For i As Integer = lb + 1 To ub + If a(i) = a(i - 1) + 1 Then + rangeCount += 1 + ElseIf rangeCount = 1 Then + range += "," + Str(a(i)) + ElseIf rangeCount = 2 Then + rangeCount = 1 + range += "," + Str(a(i-1)) + "," + Str(a(i)) + Else + rangeCount = 1 + range += "-" + Str(a(i-1)) + "," + Str(a(i)) + End If + Next + If rangeCount = 2 Then + range += "," + Str(a(ub)) + ElseIf rangeCount > 2 Then + range += "-" + Str(a(ub)) + End If + Return range +End Function + +Dim a(1 To 20) As Integer = {-6, -3, -2, -1, 0, 1, 3, 4, 5, 7, 8, 9, 10, 11, 14, 15, 17, 18, 19, 20} +Print formatRange(a()) +Print + +Dim b(1 To 33) As Integer => _ +{ _ + 0, 1, 2, 4, 6, 7, 8, 11, 12, 14, _ + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, _ + 25, 27, 28, 29, 30, 31, 32, 33, 35, 36, _ + 37, 38, 39 _ +} + +Print formatRange(b()) +Print +Print "Press any key to continue" +Sleep diff --git a/Task/Range-extraction/LiveCode/range-extraction-1.livecode b/Task/Range-extraction/LiveCode/range-extraction-1.livecode new file mode 100644 index 0000000000..8a852842c3 --- /dev/null +++ b/Task/Range-extraction/LiveCode/range-extraction-1.livecode @@ -0,0 +1,29 @@ +function rangeExtract nums + local prevNum, znums, rangedNums + set itemDelimiter to ", " + put the first item of nums into prevNum + repeat for each item n in nums + if n is (prevNum + 1) then + put n into prevNum + put "#" & n after znums + else + put n into prevNum + put return & n after znums + end if + end repeat + set itemDelimiter to "#" + repeat for each line z in znums + if z is empty then next repeat + switch the number of items of z + case 1 + put z & "," after rangedNums + break + case 2 + put item 1 of z & "," & item -1 of z & "," after rangedNums + break + default + put item 1 of z & "-" & item -1 of z & "," after rangedNums + end switch + end repeat + return char 1 to -2 of rangedNums --strip off trailing comma +end rangeExtract diff --git a/Task/Range-extraction/LiveCode/range-extraction-2.livecode b/Task/Range-extraction/LiveCode/range-extraction-2.livecode new file mode 100644 index 0000000000..52d9125adb --- /dev/null +++ b/Task/Range-extraction/LiveCode/range-extraction-2.livecode @@ -0,0 +1,8 @@ +command testRangeExtract + local numbers + put "0, 1, 2, 4, 6, 7, 8, 11, 12, 14," \ + && "15, 16, 17, 18, 19, 20, 21, 22, 23, 24," \ + && "25, 27, 28, 29, 30, 31, 32, 33, 35, 36," \ + && "37, 38, 39" into numbers + put rangeExtract(numbers) +end testRangeExtract diff --git a/Task/Range-extraction/LiveCode/range-extraction-3.livecode b/Task/Range-extraction/LiveCode/range-extraction-3.livecode new file mode 100644 index 0000000000..b8bbe64039 --- /dev/null +++ b/Task/Range-extraction/LiveCode/range-extraction-3.livecode @@ -0,0 +1 @@ +0-2,4,6-8,11,12,14-25,27-33,35-39 diff --git a/Task/Range-extraction/Nim/range-extraction.nim b/Task/Range-extraction/Nim/range-extraction.nim new file mode 100644 index 0000000000..8f300ed0ea --- /dev/null +++ b/Task/Range-extraction/Nim/range-extraction.nim @@ -0,0 +1,30 @@ +import parseutils, re, strutils + +proc extractRange(input: string): string = + var list = input.replace(re"\s+").split(',').map(parseInt) + var ranges: seq[string] = @[] + var i = 0 + while i < list.len: + var first = list[i] # first element in the current range + var offset = i + while True: # skip ahead to the end of the current range + if i + 1 >= list.len: + # reached end of the list + break + if list[i + 1] - (i + 1) != first - offset: + # next element isn't in the current range + break + i.inc + var last = list[i] # last element in the current range + case last - first + of 0: ranges.add($first) + of 1: ranges.add("$1,$2".format([$first, $last])) + else: ranges.add("$1-$2".format([$first, $last])) + i.inc + return ranges.join(",") + +echo(""" + 0, 1, 2, 4, 6, 7, 8, 11, 12, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 27, 28, 29, 30, 31, 32, 33, 35, 36, + 37, 38, 39""".extractRange) diff --git a/Task/Range-extraction/Phix/range-extraction.phix b/Task/Range-extraction/Phix/range-extraction.phix new file mode 100644 index 0000000000..c893ae7e1d --- /dev/null +++ b/Task/Range-extraction/Phix/range-extraction.phix @@ -0,0 +1,26 @@ +function spout(integer first, integer this, sequence s) +string res + if first=this-1 then + res = sprintf("%d",s[first]) + else + res = sprintf("%d%s%d",{s[first],iff(first=this-2?',':'-'),s[this-1]}) + end if + return res +end function + +function extract_ranges(sequence s) +integer first = 1 +string out = "" + if length(s)!=0 then + for i=2 to length(s) do + if s[i]!=s[i-1]+1 then + out &= spout(first,i,s)&',' + first = i + end if + end for + out &= spout(first,length(s)+1,s) + end if + return out +end function + +puts(1,extract_ranges({0,1,2,4,6,7,8,11,12,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39})) diff --git a/Task/Range-extraction/Swift/range-extraction-1.swift b/Task/Range-extraction/Swift/range-extraction-1.swift new file mode 100644 index 0000000000..ba97fa52f2 --- /dev/null +++ b/Task/Range-extraction/Swift/range-extraction-1.swift @@ -0,0 +1,47 @@ +func rangesFromInts(ints:[Int]) -> [(Int, Int)] { + + var range : (Int, Int)? + var ranges = [(Int, Int)]() + for this in ints { + if let (start, end) = range { + if this == end + 1 { + range = (start, this) + } + else { + ranges.append(range!) + range = (this, this) + } + } + else { range = (this, this) } + } + ranges.append(range!) + + return ranges +} + +func descriptionFromRanges(ranges:[(Int, Int)]) -> String { + var desc = "" + for (start, end) in ranges { + desc += desc.isEmpty ? "" : "," + if start == end { + desc += "\(start)" + } + else if end == start + 1 { + desc += "\(start),\(end)" + } + else { + desc += "\(start)-\(end)" + } + } + return desc +} + + +let ex = [-6, -3, -2, -1, 0, 1, 3, 4, 5, 7, 8, 9, 10, 11, 14, 15, 17, 18, 19, 20] +let longer = [0, 1, 2, 4, 6, 7, 8, 11, 12, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 27, 28, 29, 30, 31, 32, 33, 35, 36, + 37, 38, 39] + +descriptionFromRanges(rangesFromInts(ex)) +descriptionFromRanges(rangesFromInts(longer)) diff --git a/Task/Range-extraction/Swift/range-extraction-2.swift b/Task/Range-extraction/Swift/range-extraction-2.swift new file mode 100644 index 0000000000..b4f287ffb0 --- /dev/null +++ b/Task/Range-extraction/Swift/range-extraction-2.swift @@ -0,0 +1,35 @@ +extension NSIndexSet { + + var rangesDescription : String { + var out = "" + indexSet.enumerateRangesUsingBlock { range, _ in + let start = range.location + let end = range.location+range.length-1 + out += out.isEmpty ? "" : "," + if start == end { + out += "\(start)" + } + else if end == start + 1 { + out += "\(start),\(end)" + } + else { + out += "\(start)-\(end)" + } + } + return out + } +} + +let ex = [-6, -3, -2, -1, 0, 1, 3, 4, 5, 7, 8, 9, 10, 11, 14, 15, 17, 18, 19, 20] +let longer = [0, 1, 2, 4, 6, 7, 8, 11, 12, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 27, 28, 29, 30, 31, 32, 33, 35, 36, + 37, 38, 39] + +var indexSet = NSMutableIndexSet() +ex.map { indexSet.addIndex($0) } +indexSet.rangesDescription + +var indexSet2 = NSMutableIndexSet() +longer.map { indexSet2.addIndex($0) } +indexSet2.rangesDescription diff --git a/Task/Range-extraction/jq/range-extraction.jq b/Task/Range-extraction/jq/range-extraction.jq new file mode 100644 index 0000000000..3b11a18235 --- /dev/null +++ b/Task/Range-extraction/jq/range-extraction.jq @@ -0,0 +1,20 @@ +# Input should be an array +def extract: + reduce .[] as $i + # state is an array with integers or [start, end] ranges + ([]; + if length == 0 then [ $i ] + else ( .[-1]) as $last + | if ($last|type) == "array" then + if ($last[1] + 1) == $i then setpath([-1,1]; $i) + else . + [ $i ] + end + elif ($last + 1) == $i then setpath([-1]; [$last, $i]) + else . + [ $i ] + end + end) + | map( if type == "number" then tostring + elif .[0] == .[1] -1 + then "\(.[0]),\(.[1])" # satisfy special requirement + else "\(.[0])-\(.[1])" end ) + | join(",") ; diff --git a/Task/Ranking-methods/Sidef/ranking-methods.sidef b/Task/Ranking-methods/Sidef/ranking-methods.sidef new file mode 100644 index 0000000000..1748176ce3 --- /dev/null +++ b/Task/Ranking-methods/Sidef/ranking-methods.sidef @@ -0,0 +1,62 @@ +var scores = [ + Pair(Solomon => 44), + Pair(Jason => 42), + Pair(Errol => 42), + Pair(Garry => 41), + Pair(Bernard => 41), + Pair(Barry => 41), + Pair(Stephen => 39), +] + +func tiers(s) { + s.group_by { .value }.kv.sort.flip.map { .value.map{.key} } +} + +func standard(s) { + var rank = 1 + gather { + for players in tiers(s) { + take(Pair(rank, players)) + rank += players.len + } + } +} + +func modified(s) { + var rank = 0 + gather { + for players in tiers(s) { + rank += players.len + take(Pair(rank, players)) + } + } +} + +func dense(s) { + tiers(s).map_kv { |k,v| Pair(k+1, v) } +} + +func ordinal(s) { + s.map_kv { |k,v| Pair(k+1, v.key) } +} + +func fractional(s) { + var rank = 1 + gather { + for players in tiers(s) { + var beg = rank + var end = (rank += players.len) + take(Pair(sum(beg ..^ end) / players.len, players)) + } + } +} + +func display(r) { + say r.map {|a| '%3s : %s' % a... }.join("\n") +} + +say "Standard:"; display( standard(scores)) +say "\nModified:"; display( modified(scores)) +say "\nDense:"; display( dense(scores)) +say "\nOrdinal:"; display( ordinal(scores)) +say "\nFractional:"; display(fractional(scores)) diff --git a/Task/Ranking-methods/Visual-FoxPro/ranking-methods.visual b/Task/Ranking-methods/Visual-FoxPro/ranking-methods.visual new file mode 100644 index 0000000000..8fb9caf52c --- /dev/null +++ b/Task/Ranking-methods/Visual-FoxPro/ranking-methods.visual @@ -0,0 +1,102 @@ +#DEFINE CTAB CHR(9) +#DEFINE CRLF CHR(13) + CHR(10) +LOCAL lcTxt As String, i As Integer +CLOSE DATABASES ALL +SET SAFETY OFF +CLEAR +CREATE CURSOR scores (score I, name V(8), rownum I AUTOINC) +INDEX ON score TAG score COLLATE "Machine" +SET ORDER TO 0 +INSERT INTO scores (score, name) VALUES (44, "Solomon") +INSERT INTO scores (score, name) VALUES (42, "Jason") +INSERT INTO scores (score, name) VALUES (42, "Errol") +INSERT INTO scores (score, name) VALUES (41, "Garry") +INSERT INTO scores (score, name) VALUES (41, "Bernard") +INSERT INTO scores (score, name) VALUES (41, "Barry") +INSERT INTO scores (score, name) VALUES (39, "Stephen") + +CREATE CURSOR ranks (sc_rank I, mod_rank I, dense I, ordinal I, fractional B(1), score I, name V(8)) +INDEX ON score TAG score COLLATE "Machine" +SET ORDER TO 0 +APPEND FROM DBF("scores") FIELDS score, name +Std_Comp() +Modified() +Dense() +Ordinal() +Fractional() +COPY TO ranks.txt TYPE DELIMITED WITH TAB +lcTxt = "" +FOR i = 1 TO FCOUNT() + lcTxt = lcTxt + FIELD(i) + CTAB +ENDFOR +lcTxt = LEFT(lcTxt, LEN(lcTxt) - 1) + CRLF + FILETOSTR("ranks.txt") +STRTOFILE(lcTxt, "ranks.txt") +MODIFY FILE ranks.txt +SET SAFETY ON + +FUNCTION ScoreGroup(aa) +LOCAL n As Integer +SELECT score, COUNT(*) As num FROM scores ; +GROUP BY score ORDER BY score DESC INTO ARRAY aa +n = _TALLY +RETURN n +ENDFUNC + +PROCEDURE Std_Comp +LOCAL n, i, nn +LOCAL ARRAY a[1] +SELECT ranks +BLANK FIELDS sc_rank ALL +nn = ScoreGroup(@a) +n = 1 +FOR i = 1 TO nn + REPLACE sc_rank WITH n FOR score = a[i,1] + n = n + a[i,2] +ENDFOR +ENDPROC + +PROCEDURE Modified +LOCAL n, i, nn +LOCAL ARRAY a[1] +SELECT ranks +BLANK FIELDS mod_rank ALL +nn = ScoreGroup(@a) +n = 0 +FOR i = 1 TO nn + n = n + a[i,2] + REPLACE mod_rank WITH n FOR score = a[i,1] +ENDFOR +ENDPROC + +PROCEDURE Dense +LOCAL n, i, nn +LOCAL ARRAY a[1] +SELECT ranks +BLANK FIELDS dense ALL +nn = ScoreGroup(@a) +SELECT ranks +n = 0 +FOR i = 1 TO nn + n = n + a[i,2] + REPLACE dense WITH i FOR score = a[i,1] +ENDFOR +ENDPROC + +PROCEDURE Ordinal +SELECT ranks +BLANK FIELDS ordinal ALL +REPLACE ordinal WITH RECNO() ALL +ENDPROC + +PROCEDURE Fractional +LOCAL i As Integer, nn As Integer +LOCAL ARRAY a[1] +SELECT ranks +BLANK FIELDS fractional ALL +SELECT CAST(AVG(rownum) As B(1)), score FROM scores ; +GROUP BY score ORDER BY score DESC INTO ARRAY a +nn = _TALLY +FOR i = 1 TO nn + REPLACE fractional WITH a[i,1] FOR score = a[i,2] +ENDFOR +ENDPROC diff --git a/Task/Ranking-methods/jq/ranking-methods-1.jq b/Task/Ranking-methods/jq/ranking-methods-1.jq new file mode 100644 index 0000000000..442e7c8f4c --- /dev/null +++ b/Task/Ranking-methods/jq/ranking-methods-1.jq @@ -0,0 +1,57 @@ +# Ties share what would have been their first ordinal number +def standard_ranking: + . as $raw + | ([range(1;length;2) | $raw[.]]) as $scores + | reduce range(1; $scores|length) as $i + ([1]; if $scores[$i - 1] == $scores[$i] then . + [.[-1]] + else . + [$i + 1] + end) ; + +def modified_ranking: + # The helper function resolves [ranks, tentative] + # by appending the ranks of the ties to "ranks" + def resolve: + (.[1] | length) as $length + | if $length == 0 then .[0] + else .[1][-1] as $max + | .[0] + ( .[1] | map( $max) ) + end ; + . as $raw + | ([range(1;length;2) | $raw[.]]) as $scores + | reduce range(1; $scores|length) as $i + # state: [ranks, tentative] + ([ [], [1] ]; + if $scores[$i - 1] == $scores[$i] then [.[0], .[1] + [ $i + 1 ]] + else [ resolve, [ $i + 1 ] ] + end ) + | resolve ; + +def dense_ranking: # next available + . as $raw + | ([range(1;length;2) | $raw[.]]) as $scores + | reduce range(1; $scores|length) as $i + ([1]; if $scores[$i - 1] == $scores[$i] then . + [.[-1]] + else . + [ .[-1] + 1] + end ); + +def ordinal_ranking: # unfair to some! + [ range(1; 1 + length/2) ] ; + +def fractional_ranking: + # The helper function resolves [ranks, tentative] + # by appending the averages of the tentative ranks to "ranks" + def resolve: + (.[1] | length) as $length + | if $length == 0 then .[0] + else (.[1] | add / $length) as $avg + | .[0] + ( .[1] | map( $avg) ) + end ; + . as $raw + | ([range(1;length;2) | $raw[.]]) as $scores + | reduce range(1; $scores|length) as $i + # state: [ranks, tentative] + ([ [], [1] ]; + if $scores[$i - 1] == $scores[$i] then [.[0], .[1] + [ $i + 1 ]] + else [ resolve, [ $i + 1 ] ] + end ) + | resolve ; diff --git a/Task/Ranking-methods/jq/ranking-methods-2.jq b/Task/Ranking-methods/jq/ranking-methods-2.jq new file mode 100644 index 0000000000..909fe8299f --- /dev/null +++ b/Task/Ranking-methods/jq/ranking-methods-2.jq @@ -0,0 +1,19 @@ +def raw: + [ + "Solomon", 44, + "Jason" , 42, + "Errol" , 42, + "Garry" , 41, + "Bernard", 41, + "Barry" , 41, + "Stephen", 39 +] ; + +def task: + "standard: \( raw | standard_ranking)", + "modified: \( raw | modified_ranking)", + "dense: \( raw | dense_ranking)", + "ordinal: \( raw | ordinal_ranking)", + "fractional: \( raw | fractional_ranking)" ; + +task diff --git a/Task/Rate-counter/ERRE/rate-counter.erre b/Task/Rate-counter/ERRE/rate-counter.erre new file mode 100644 index 0000000000..7f83932657 --- /dev/null +++ b/Task/Rate-counter/ERRE/rate-counter.erre @@ -0,0 +1,35 @@ +PROGRAM RATE_COUNTER + +! +! for rosettacode.org +! + +! +! This is an example, replace with the task you want to measure +! +PROCEDURE TASK_TO_MEASURE + LOCAL I + FOR I=1 TO 1000000 DO + END FOR +END PROCEDURE + +BEGIN + PRINT("Method 1: Calculate reciprocal of elapsed time:") + FOR TRIAL%=1 TO 3 DO + START=TIMER + TASK_TO_MEASURE + FINISH=TIMER + PRINT("Rate =";100/(FINISH-START);"per second") + END FOR + + PRINT("Method 2: Count completed tasks in one minute:") + FOR TRIAL%=1 TO 3 DO + RUNS%=0 + FINISH=TIMER+60 + REPEAT + TASK_TO_MEASURE + IF TIMER=FINISH + PRINT("Rate =";RUNS%;"per minute") + END FOR +END PROGRAM diff --git a/Task/Rate-counter/Sidef/rate-counter.sidef b/Task/Rate-counter/Sidef/rate-counter.sidef new file mode 100644 index 0000000000..27ac2a816b --- /dev/null +++ b/Task/Rate-counter/Sidef/rate-counter.sidef @@ -0,0 +1,11 @@ +var benchmark = frequire('Benchmark'); + +func job1 { + #...job1 code... +} +func job2 { + #...job2 code... +} + +const COUNT = -1; # run for one CPU second +benchmark.timethese(COUNT, Hash.new('Job1' => job1, 'Job2' => job2)); diff --git a/Task/Ray-casting-algorithm/FreeBASIC/ray-casting-algorithm.freebasic b/Task/Ray-casting-algorithm/FreeBASIC/ray-casting-algorithm.freebasic new file mode 100644 index 0000000000..8134e44539 --- /dev/null +++ b/Task/Ray-casting-algorithm/FreeBASIC/ray-casting-algorithm.freebasic @@ -0,0 +1,114 @@ +Type Point + As Single x,y +End Type + +Function inpolygon(p1() As Point,p2 As Point) As Integer + #Macro isleft2(L,p) + -Sgn( (L(1).x-L(2).x)*(p.y-L(2).y) - (p.x-L(2).x)*(L(1).y-L(2).y)) + #EndMacro + Dim As Integer index,nextindex + Dim k As Integer=UBound(p1)+1 + Dim send (1 To 2) As Point + Dim wn As Integer=0 + For n As Integer=1 To UBound(p1) + index=n Mod k:nextindex=(n+1) Mod k + If nextindex=0 Then nextindex=1 + send(1).x=p1(index).x:send(2).x=p1(nextindex).x + send(1).y=p1(index).y:send(2).y=p1(nextindex).y + If p1(index).y<=p2.y Then + If p1(nextindex).y>p2.y Then + If isleft2(send,p2)>=0 Then '= + wn=wn+1 + End If + End If + Else + If p1(nextindex).y<=p2.y Then + If isleft2(send,p2)<=0 Then'= + wn=wn-1 + End If + End If + End If + Next n + Return wn +End Function + + +Dim As Point square(1 To 4) ={(0,0),(10,0),(10,10),(0,10)} + +Dim As Point hole(1 To 4) ={(2.5,2.5),(7.5,2.5),(7.5,7.5),(2.5,7.5)} + +Dim As Point strange(1 To 8) ={(0,0),(2.5,2.5),(0,10),(2.5,7.5),_ + (7.5,7.5),(10,10),(10,0),(2.5,2.5)} + +Dim As Point exagon(1 To 6) ={(3,0),(7,0),(10,5),(7,10),(3,10),(0,5)} + +'printouts +For z As Integer=1 To 4 + Select Case z + Case 1: Print "squared" + Print "(5,5) " ;Tab(12); + If inpolygon(square(),Type(5,5)) Then Print "in" Else Print "out" + Print "(5,8) " ;Tab(12); + If inpolygon(square(),Type(5,8)) Then Print "in" Else Print "out" + Print "(-10,5) " ;Tab(12); + If inpolygon(square(),Type(-10,5)) Then Print "in" Else Print "out" + Print "(0,5) " ;Tab(12); + If inpolygon(square(),Type(0,5)) Then Print "in" Else Print "out" + Print "(10,5) " ;Tab(12); + If inpolygon(square(),Type(10,5)) Then Print "in" Else Print "out" + Print "(8,5) " ;Tab(12); + If inpolygon(square(),Type(8,5)) Then Print "in" Else Print "out" + Print "(10,10) " ;Tab(12); + If inpolygon(square(),Type(10,10)) Then Print "in" Else Print "out" + Print + Case 2:Print "squared hole" + Print "(5,5) " ;Tab(12); + If Not inpolygon(hole(),Type(5,5)) And inpolygon(square(),Type(5,5)) Then Print "in" Else Print "out" + Print "(5,8) " ;Tab(12); + If Not inpolygon(hole(),Type(5,8)) And inpolygon(square(),Type(5,8))Then Print "in" Else Print "out" + Print "(-10,5) " ;Tab(12); + If Not inpolygon(hole(),Type(-10,5))And inpolygon(square(),Type(-10,5)) Then Print "in" Else Print "out" + Print "(0,5) " ;Tab(12); + If Not inpolygon(hole(),Type(0,5))And inpolygon(square(),Type(0,5)) Then Print "in" Else Print "out" + Print "(10,5) " ;Tab(12); + If Not inpolygon(hole(),Type(10,5))And inpolygon(square(),Type(10,5)) Then Print "in" Else Print "out" + Print "(8,5) " ;Tab(12); + If Not inpolygon(hole(),Type(8,5))And inpolygon(square(),Type(8,5)) Then Print "in" Else Print "out" + Print "(10,10) " ;Tab(12); + If Not inpolygon(hole(),Type(10,10))And inpolygon(square(),Type(10,10)) Then Print "in" Else Print "out" + Print + Case 3:Print "strange" + Print "(5,5) " ;Tab(12); + If inpolygon(strange(),Type(5,5)) Then Print "in" Else Print "out" + Print "(5,8) " ;Tab(12); + If inpolygon(strange(),Type(5,8)) Then Print "in" Else Print "out" + Print "(-10,5) " ;Tab(12); + If inpolygon(strange(),Type(-10,5)) Then Print "in" Else Print "out" + Print "(0,5) " ;Tab(12); + If inpolygon(strange(),Type(0,5)) Then Print "in" Else Print "out" + Print "(10,5) " ;Tab(12); + If inpolygon(strange(),Type(10,5)) Then Print "in" Else Print "out" + Print "(8,5) " ;Tab(12); + If inpolygon(strange(),Type(8,5)) Then Print "in" Else Print "out" + Print "(10,10) " ;Tab(12); + If inpolygon(strange(),Type(10,10)) Then Print "in" Else Print "out" + Print + Case 4:Print "exagon" + Print "(5,5) " ;Tab(12); + If inpolygon(exagon(),Type(5,5)) Then Print "in" Else Print "out" + Print "(5,8) " ;Tab(12); + If inpolygon(exagon(),Type(5,8)) Then Print "in" Else Print "out" + Print "(-10,5) " ;Tab(12); + If inpolygon(exagon(),Type(-10,5)) Then Print "in" Else Print "out" + Print "(0,5) " ;Tab(12); + If inpolygon(exagon(),Type(0,5)) Then Print "in" Else Print "out" + Print "(10,5) " ;Tab(12); + If inpolygon(exagon(),Type(10,5)) Then Print "in" Else Print "out" + Print "(8,5) " ;Tab(12); + If inpolygon(exagon(),Type(8,5)) Then Print "in" Else Print "out" + Print "(10,10) " ;Tab(12); + If inpolygon(exagon(),Type(10,10)) Then Print "in" Else Print "out" + Print + End Select +Next z +Sleep diff --git a/Task/Ray-casting-algorithm/Phix/ray-casting-algorithm.phix b/Task/Ray-casting-algorithm/Phix/ray-casting-algorithm.phix new file mode 100644 index 0000000000..1264e05765 --- /dev/null +++ b/Task/Ray-casting-algorithm/Phix/ray-casting-algorithm.phix @@ -0,0 +1,103 @@ +constant true = (1=1), false = not true +constant inf = 1e300*1e300 + +function rayIntersectsSegment(sequence point, sequence segment) +atom {pX,pY} = point +atom {{aX,aY},{bX,bY}} = segment +atom m_red,m_blue + -- ensure {aX,aY} is the segment end-point with the smallest y coordinate + if aY>bY then + {{bX,bY},{aX,aY}} = segment + end if + if pY=aY or pY=bY then + -- + -- Consider a ray passing through the top or left corner of a diamond: + -- / + -- --- or - + -- ^ \ + -- In both cases it touches both edges, but ends up outside in the + -- top case, whereas it ends up inside in the left case. Just move + -- the y co-ordinate down a smidge and it'll work properly, by + -- missing one line in the left/right cases and hitting both/none + -- in the top/bottom cases. + -- + pY += 0.000001 + end if + if pYbY then return false end if + if pX>max(aX,bX) then return false end if + if pX= m_red +end function + +function inside(sequence point, sequence poly) +integer in = 0 + for i=1 to length(poly) do + if rayIntersectsSegment(point,poly[i]) then + in = not in + end if + end for + return in +end function + +constant INOUT = {"in", "out"} +function in(integer flag, integer expected) + if flag=expected then + return INOUT[2-flag] + end if + return INOUT[2-flag] & "*** ERROR ***" +end function + +constant INSTAR = "* " +function instar(integer flag) + return INSTAR[2-flag] +end function + +constant test_points = {{5,5},{5,8},{-10,5},{0,5},{10,5},{8,5},{10,10}} + +--constant NAME = 1, POLY = 2, EXPECTED = 3 +constant test_polygons = { + {"square", {{{0,0},{10,0}},{{10,0},{10,10}},{{10,10},{0,10}},{{0,10},{0,0}}}, + {true,true,false,false,true,true,false}}, + {"square hole", {{{0,0},{10,0}},{{10,0},{10,10}},{{10,10},{0,10}},{{0,10},{0,0}}, + {{2.5,2.5},{7.5,2.5}},{{7.5,2.5},{7.5,7.5}},{{7.5,7.5},{2.5,7.5}},{{2.5,7.5},{2.5,2.5}}}, + {false,true,false,false,true,true,false}}, + {"strange", {{{0,5},{2.5,2.5}},{{2.5,2.5},{0,10}},{{0,10},{2.5,7.5}},{{2.5,7.5},{7.5,7.5}}, + {{7.5,7.5},{10,10}},{{10,10},{10,0}},{{10,0},{2.5,2.5}}}, + {true,false,false,false,true,true,false}}, + {"exagon", {{{3,0},{7,0}},{{7,0},{10,5}},{{10,5},{7,10}},{{7,10},{3,10}},{{3,10},{0,5}},{{0,5},{3,0}}}, + {true,true,false,false,true,true,false}} +} + +sequence name, poly, expected, tp + + for i=1 to length(test_polygons) do + {name,poly,expected} = test_polygons[i] + printf(1,"\n%12s:",{name}) + for j=1 to length(test_points) do + tp = test_points[j] + printf(1," %s, %-4s",{sprint(tp),in(inside(tp,poly),expected[j])}) + end for + end for + + puts(1,"\n\n\n") + + for i=0 to 10 do + for j=1 to length(test_polygons) do + puts(1," ") + poly = test_polygons[j][2] + for k=0 to 10 do + puts(1,instar(inside({k+0.5,10.5-i},poly))) + end for + end for + puts(1,"\n") + end for diff --git a/Task/Read-a-configuration-file/EchoLisp/read-a-configuration-file-1.echolisp b/Task/Read-a-configuration-file/EchoLisp/read-a-configuration-file-1.echolisp new file mode 100644 index 0000000000..97c3d46808 --- /dev/null +++ b/Task/Read-a-configuration-file/EchoLisp/read-a-configuration-file-1.echolisp @@ -0,0 +1,15 @@ +(edit 'preferences) +;; current contents to edit is displayed in the input box +(define (preferences) +(define-syntax-rule (++ n) (begin (set! n (1+ n)) n)) +(define-syntax-rule (% a b) (modulo a b)) +;; (lib 'gloops) +(lib 'timer)) + +;; enter new preferences +(define (preferences) + (define FULLNAME "Foo Barber") + (define FAVOURITEFRUIT 'banana) + (define NEEDSPELLING #t) +; SEEDSREMOVED + (define OTHERFAMILY '("Rhu Barber" "Harry Barber"))) diff --git a/Task/Read-a-configuration-file/EchoLisp/read-a-configuration-file-2.echolisp b/Task/Read-a-configuration-file/EchoLisp/read-a-configuration-file-2.echolisp new file mode 100644 index 0000000000..9108d06f16 --- /dev/null +++ b/Task/Read-a-configuration-file/EchoLisp/read-a-configuration-file-2.echolisp @@ -0,0 +1,9 @@ +;; press F5 or COMMAND-R to reload +EchoLisp - 2.13.12 +📗 local-db: db.version: 13 + +;; enter parameters names : +NEEDSPELLING → #t +FAVOURITEFRUIT → banana +SEEDSREMOVED +😡 error: #|user| : unbound variable : SEEDSREMOVED diff --git a/Task/Read-a-configuration-file/FreeBASIC/read-a-configuration-file.freebasic b/Task/Read-a-configuration-file/FreeBASIC/read-a-configuration-file.freebasic new file mode 100644 index 0000000000..958e8aa957 --- /dev/null +++ b/Task/Read-a-configuration-file/FreeBASIC/read-a-configuration-file.freebasic @@ -0,0 +1,96 @@ +' FB 1.05.0 Win64 + +Sub split (s As Const String, sepList As Const String, result() As String) + If s = "" OrElse sepList = "" Then + Redim result(0) + result(0) = s + Return + End If + Dim As Integer i, j, count = 0, empty = 0, length + Dim As Integer position(Len(s) + 1) + position(0) = 0 + + For i = 0 To len(s) - 1 + For j = 0 to Len(sepList) - 1 + If s[i] = sepList[j] Then + count += 1 + position(count) = i + 1 + End If + Next j + Next i + + Redim result(count) + If count = 0 Then + result(0) = s + Return + End If + + position(count + 1) = len(s) + 1 + + For i = 1 To count + 1 + length = position(i) - position(i - 1) - 1 + result(i - 1) = Mid(s, position(i - 1) + 1, length) + Next +End Sub + +Type ConfigData + fullName As String + favouriteFruit As String + needsPeeling As Boolean + seedsRemoved As Boolean + otherFamily(Any) As String +End Type + +Sub readConfigData(fileName As String, cData As ConfigData) + Dim fileNum As Integer = FreeFile + Open fileName For Input As #fileNum + If err > 0 Then + Print "File could not be opened" + Sleep + End + End If + Dim ln As String + While Not Eof(fileNum) + Line Input #fileNum, ln + If ln = "" OrElse Left(ln, 1) = "#" OrElse Left(ln, 1) = ";" Then Continue While + If UCase(Left(ln, 8)) = "FULLNAME" Then + cData.fullName = Trim(Mid(ln, 9), Any " =") + ElseIf UCase(Left(ln, 14)) = "FAVOURITEFRUIT" Then + cData.favouriteFruit = Trim(Mid(ln, 15), Any " =") + ElseIf UCase(Left(ln, 12)) = "NEEDSPEELING" Then + Dim s As String = Trim(Mid(ln, 13), Any " =") + If s = "" OrElse UCase(s) = "TRUE" Then + cData.needsPeeling = True + Else + cData.needsPeeling = False + End If + ElseIf UCase(Left(ln, 12)) = "SEEDSREMOVED" Then + Dim s As String = Trim(Mid(ln, 13), Any " =") + If s = "" OrElse UCase(s) = "TRUE" Then + cData.seedsRemoved = True + Else + cData.seedsRemoved = False + End If + ElseIf UCase(Left(ln, 11)) = "OTHERFAMILY" Then + split Mid(ln, 12), ",", cData.otherFamily() + For i As Integer = LBound(cData.otherFamily) To UBound(cData.otherFamily) + cData.otherFamily(i) = Trim(cData.otherFamily(i), Any " =") + Next + End If + Wend + Close #fileNum +End Sub + +Dim fileName As String = "config.txt" +Dim cData As ConfigData +readConfigData fileName, cData +Print "Full name = "; cData.fullName +Print "Favourite fruit = "; cData.favouriteFruit +Print "Needs peeling = "; cData.needsPeeling +Print "Seeds removed = "; cData.seedsRemoved +For i As Integer = LBound(cData.otherFamily) To UBound(cData.otherFamily) + Print "Other family("; Str(i); ") = "; cData.otherFamily(i) +Next +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Read-a-configuration-file/Lasso/read-a-configuration-file.lasso b/Task/Read-a-configuration-file/Lasso/read-a-configuration-file.lasso new file mode 100644 index 0000000000..24bac3dcea --- /dev/null +++ b/Task/Read-a-configuration-file/Lasso/read-a-configuration-file.lasso @@ -0,0 +1,70 @@ +local(config = '# This is a configuration file in standard configuration file format +# +# Lines beginning with a hash or a semicolon are ignored by the application +# program. Blank lines are also ignored by the application program. + +# This is the fullname parameter + +FULLNAME Foo Barber + +# This is a favourite fruit +FAVOURITEFRUIT = banana + +# This is a boolean that should be set +NEEDSPEELING + +# This boolean is commented out +; SEEDSREMOVED + +# Configuration option names are not case sensitive, but configuration parameter +# data is case sensitive and may be preserved by the application program. + +# An optional equals sign can be used to separate configuration parameter data +# from the option name. This is dropped by the parser. + +# A configuration option may take multiple parameters separated by commas. +# Leading and trailing whitespace around parameter names and parameter data fields +# are ignored by the application program. + +OTHERFAMILY Rhu Barber, Harry Barber +') +// if config is in a file collect it like this +//local(config = file('path/and/file.name') -> readstring) + +define getconfig(term::string, config::string) => { + + local( + regexp = regexp(-find = `(?m)^` + #term + `($|\s*=\s*|\s+)(.*)$`, -input = #config, -ignorecase), + result + ) + + while(#regexp -> find) => { + #result = (#regexp -> groupcount > 1 ? (#regexp -> matchString(2) -> trim& || true)) + if(#result -> asstring >> ',') => { + #result = #result -> split(',') + #result -> foreach => {#1 -> trim} + } + return #result + } + return false + +} + +local( + fullname = getconfig('FULLNAME', #config), + favorite = getconfig('FAVOURITEFRUIT', #config), + sedsremoved = getconfig('SEEDSREMOVED', #config), + needspeel = getconfig('NEEDSPEELING', #config), + otherfamily = getconfig('OTHERFAMILY', #config) +) + +#fullname +'
' +#favorite +'
' +#sedsremoved +'
' +#needspeel +'
' +#otherfamily +'
' diff --git a/Task/Read-a-configuration-file/Peloton/read-a-configuration-file.peloton b/Task/Read-a-configuration-file/Peloton/read-a-configuration-file.peloton new file mode 100644 index 0000000000..c249509410 --- /dev/null +++ b/Task/Read-a-configuration-file/Peloton/read-a-configuration-file.peloton @@ -0,0 +1,27 @@ +<@ DEFUDRLIT>__ReadConfigurationFile| + <@ LETSCPPNTPARSRC>Data|1<@ OMT> read file into locally scope variable + <@ LETCGDLSTLLOSCP>List|Data<@ OMT> split Data into a list of lines + <@ OMT> Remove comment lines, and blank lines + <@ ACTOVRBEFLSTLIT>List|; + <@ ACTOVRBEFLSTLIT>List|# + <@ ACTRMELST>List + <@ OMT> Iterate over the lines of the list + <@ ITEENULSTLit>List| + <@ LETVARUPTVALLSTLIT>key|...| + <@ LETVARAFTVALLSTLIT>val|...| + <@ OMT> test for an empty key (in the case of a boolean) + <@ TSTVARLIT>key| + <@ IFE><@ LETPNTVARVARLIT>val|__True + <@ ELS> + <@ TSTGT0ATBVARLIT>val|, + <@ IFE><@ ACTEXEEMMCAP><&prot; LETCNDLSTLITLIT>&key;&pipe;&val;&pipe;, + <@ ELS><@ LETPNTVARVARVAR>key|val + + + + +<@ ACTUDRLIT>__ReadConfigurationFile|c:\rosetta.config +<@ SAYVAR>FAVOURITEFRUIT +<@ SAYVAR>FULLNAME +<@ SAYVAR>NEEDSPEELING +<@ SAYDMPLST>OTHERFAMILY diff --git a/Task/Read-a-configuration-file/Sidef/read-a-configuration-file.sidef b/Task/Read-a-configuration-file/Sidef/read-a-configuration-file.sidef new file mode 100644 index 0000000000..5afea23243 --- /dev/null +++ b/Task/Read-a-configuration-file/Sidef/read-a-configuration-file.sidef @@ -0,0 +1,27 @@ +var fullname = (var favouritefruit = ""); +var needspeeling = (var seedsremoved = false); +var otherfamily = []; + +ARGF.each { |line| + var(key, value) = line.strip.split(/\h+/, 2)...; + + given(key) { + when (nil) { } + when (/^([#;]|\h*$)/) { } + when ("FULLNAME") { fullname = value } + when ("FAVOURITEFRUIT") { favouritefruit = value } + when ("NEEDSPEELING") { needspeeling = true } + when ("SEEDSREMOVED") { seedsremoved = true } + when ("OTHERFAMILY") { otherfamily = value.split(',')»strip»() } + default { say "#{key}: unknown key" } + } +} + +say "fullname = #{fullname}"; +say "favouritefruit = #{favouritefruit}"; +say "needspeeling = #{needspeeling}"; +say "seedsremoved = #{seedsremoved}"; + +otherfamily.each_kv {|i, name| + say "otherfamily(#{i+1}) = #{name}"; +} diff --git a/Task/Read-a-file-line-by-line/8th/read-a-file-line-by-line.8th b/Task/Read-a-file-line-by-line/8th/read-a-file-line-by-line.8th new file mode 100644 index 0000000000..2959a847bb --- /dev/null +++ b/Task/Read-a-file-line-by-line/8th/read-a-file-line-by-line.8th @@ -0,0 +1 @@ +"path/to/file" f:open ( . cr ) f:eachline f:close diff --git a/Task/Read-a-file-line-by-line/ERRE/read-a-file-line-by-line.erre b/Task/Read-a-file-line-by-line/ERRE/read-a-file-line-by-line.erre new file mode 100644 index 0000000000..18fad9ac8f --- /dev/null +++ b/Task/Read-a-file-line-by-line/ERRE/read-a-file-line-by-line.erre @@ -0,0 +1,21 @@ +PROGRAM LETTURA + +EXCEPTION + FERROR%=TRUE ! si e' verificata l'eccezione ! + PRINT("Il file richiesto non esiste .....") +END EXCEPTION + +BEGIN + FERROR%=FALSE + PRINT("Nome del file";) + INPUT(FILE$) ! chiede il nome del file + OPEN("I",1,FILE$) ! apre un file sequenziale in lettura + IF NOT FERROR% THEN + REPEAT + INPUT(LINE,#1,CH$) ! legge una riga .... + PRINT(CH$) ! ... la stampa ... + UNTIL EOF(1) ! ... fine a fine file + END IF + PRINT + CLOSE(1) ! chiude il file +END PROGRAM diff --git a/Task/Read-a-file-line-by-line/FreeBASIC/read-a-file-line-by-line.freebasic b/Task/Read-a-file-line-by-line/FreeBASIC/read-a-file-line-by-line.freebasic new file mode 100644 index 0000000000..a693d7aad5 --- /dev/null +++ b/Task/Read-a-file-line-by-line/FreeBASIC/read-a-file-line-by-line.freebasic @@ -0,0 +1,12 @@ +' FB 1.05.0 Win64 + +Open "input.txt" For Input As #1 +Dim line_ As String +While Not Eof(1) + Line Input #1, line_ '' read each line + Print line_ '' echo it to the console +Wend +Close #1 +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Read-a-file-line-by-line/Lasso/read-a-file-line-by-line.lasso b/Task/Read-a-file-line-by-line/Lasso/read-a-file-line-by-line.lasso new file mode 100644 index 0000000000..5b19b3204e --- /dev/null +++ b/Task/Read-a-file-line-by-line/Lasso/read-a-file-line-by-line.lasso @@ -0,0 +1,6 @@ +local(f) = file('foo.txt') +handle => {#f->close} +#f->forEachLine => {^ + #1 + '
' // note this simply inserts an HTML line break between each line. +^} diff --git a/Task/Read-a-file-line-by-line/Lingo/read-a-file-line-by-line.lingo b/Task/Read-a-file-line-by-line/Lingo/read-a-file-line-by-line.lingo new file mode 100644 index 0000000000..9ecd256bec --- /dev/null +++ b/Task/Read-a-file-line-by-line/Lingo/read-a-file-line-by-line.lingo @@ -0,0 +1,11 @@ +fp = xtra("fileIO").new() +fp.openFile(_movie.path & "input.txt", 1) +fileSize = fp.getLength() +repeat while TRUE + str = fp.readLine() + if str.char[1] = numtochar(10) then delete char 1 of str + if the last char of str = numtochar(13) then delete the last char of str + put str + if fp.getPosition()>=fileSize then exit repeat +end repeat +fp.closeFile() diff --git a/Task/Read-a-file-line-by-line/LiveCode/read-a-file-line-by-line.livecode b/Task/Read-a-file-line-by-line/LiveCode/read-a-file-line-by-line.livecode new file mode 100644 index 0000000000..916db08bfb --- /dev/null +++ b/Task/Read-a-file-line-by-line/LiveCode/read-a-file-line-by-line.livecode @@ -0,0 +1,13 @@ +command readFileLineByLine + local tFile, tLines, startRead + put "/usr/share/dict/words" into tFile + open file tFile for text read + put true into startRead + repeat until it is empty and startRead is false + put false into startRead + read from file tFile for 1 line + add 1 to tLines + end repeat + close file tFile + put tLines +end readFileLineByLine diff --git a/Task/Read-a-file-line-by-line/Nim/read-a-file-line-by-line.nim b/Task/Read-a-file-line-by-line/Nim/read-a-file-line-by-line.nim new file mode 100644 index 0000000000..ac576bcdb9 --- /dev/null +++ b/Task/Read-a-file-line-by-line/Nim/read-a-file-line-by-line.nim @@ -0,0 +1,2 @@ +for line in lines "input.txt": + echo line diff --git a/Task/Read-a-file-line-by-line/Oforth/read-a-file-line-by-line.oforth b/Task/Read-a-file-line-by-line/Oforth/read-a-file-line-by-line.oforth new file mode 100644 index 0000000000..2024557e09 --- /dev/null +++ b/Task/Read-a-file-line-by-line/Oforth/read-a-file-line-by-line.oforth @@ -0,0 +1,2 @@ +: readFile(fileName) + | line | File new(fileName) forEach: line [ line println ] ; diff --git a/Task/Read-a-file-line-by-line/Phix/read-a-file-line-by-line.phix b/Task/Read-a-file-line-by-line/Phix/read-a-file-line-by-line.phix new file mode 100644 index 0000000000..c17578f5ac --- /dev/null +++ b/Task/Read-a-file-line-by-line/Phix/read-a-file-line-by-line.phix @@ -0,0 +1,11 @@ +constant fn = open(command_line()[2],"r") +integer lno = 1 +object line +while 1 do + line = gets(fn) + if atom(line) then exit end if + printf(1,"%2d: %s",{lno,line}) + lno += 1 +end while +close(fn) +{} = wait_key() diff --git a/Task/Read-a-file-line-by-line/Ring/read-a-file-line-by-line.ring b/Task/Read-a-file-line-by-line/Ring/read-a-file-line-by-line.ring new file mode 100644 index 0000000000..31e94bfbad --- /dev/null +++ b/Task/Read-a-file-line-by-line/Ring/read-a-file-line-by-line.ring @@ -0,0 +1,8 @@ +fp = fopen("C:\Ring\ReadMe.txt","r") +r = "" +while isstring(r) + r = fgetc(fp) + if r = char(10) see nl + else see r ok +end +fclose(fp) diff --git a/Task/Read-a-file-line-by-line/Sidef/read-a-file-line-by-line-1.sidef b/Task/Read-a-file-line-by-line/Sidef/read-a-file-line-by-line-1.sidef new file mode 100644 index 0000000000..2c8bac2d11 --- /dev/null +++ b/Task/Read-a-file-line-by-line/Sidef/read-a-file-line-by-line-1.sidef @@ -0,0 +1,3 @@ +File(__FILE__).open_r.each { |line| + print line +} diff --git a/Task/Read-a-file-line-by-line/Sidef/read-a-file-line-by-line-2.sidef b/Task/Read-a-file-line-by-line/Sidef/read-a-file-line-by-line-2.sidef new file mode 100644 index 0000000000..28ead55346 --- /dev/null +++ b/Task/Read-a-file-line-by-line/Sidef/read-a-file-line-by-line-2.sidef @@ -0,0 +1,4 @@ +var fh = File(__FILE__).open_r +while (fh.readline(\var line)) { + print line +} diff --git a/Task/Read-a-file-line-by-line/Sparkling/read-a-file-line-by-line.sparkling b/Task/Read-a-file-line-by-line/Sparkling/read-a-file-line-by-line.sparkling new file mode 100644 index 0000000000..7f785ca92a --- /dev/null +++ b/Task/Read-a-file-line-by-line/Sparkling/read-a-file-line-by-line.sparkling @@ -0,0 +1,9 @@ +let f = fopen("foo.txt", "r"); +if f != nil { + var line; + while (line = fgetline(f)) != nil { + print(line); + } + + fclose(f); +} diff --git a/Task/Read-a-file-line-by-line/Ursa/read-a-file-line-by-line.ursa b/Task/Read-a-file-line-by-line/Ursa/read-a-file-line-by-line.ursa new file mode 100644 index 0000000000..0403160eb4 --- /dev/null +++ b/Task/Read-a-file-line-by-line/Ursa/read-a-file-line-by-line.ursa @@ -0,0 +1,5 @@ +decl file f +f.open "filename.txt" +while (f.hasline) + out (in string f) endl console +end while diff --git a/Task/Read-a-file-line-by-line/Wart/read-a-file-line-by-line.wart b/Task/Read-a-file-line-by-line/Wart/read-a-file-line-by-line.wart new file mode 100644 index 0000000000..7c848c94c2 --- /dev/null +++ b/Task/Read-a-file-line-by-line/Wart/read-a-file-line-by-line.wart @@ -0,0 +1,2 @@ +with infile "x" + drain (read_line) diff --git a/Task/Read-a-file-line-by-line/jq/read-a-file-line-by-line-1.jq b/Task/Read-a-file-line-by-line/jq/read-a-file-line-by-line-1.jq new file mode 100644 index 0000000000..3fe430456f --- /dev/null +++ b/Task/Read-a-file-line-by-line/jq/read-a-file-line-by-line-1.jq @@ -0,0 +1,7 @@ +$ seq 0 5 | jq -R 'tonumber|sin' +0 +0.8414709848078965 +0.9092974268256817 +0.1411200080598672 +-0.7568024953079282 +-0.9589242746631385 diff --git a/Task/Read-a-file-line-by-line/jq/read-a-file-line-by-line-2.jq b/Task/Read-a-file-line-by-line/jq/read-a-file-line-by-line-2.jq new file mode 100644 index 0000000000..43818fe526 --- /dev/null +++ b/Task/Read-a-file-line-by-line/jq/read-a-file-line-by-line-2.jq @@ -0,0 +1,2 @@ +$ seq 0 5 | jq -R 'tonumber|sin' | jq -s max +0.9092974268256817 diff --git a/Task/Read-a-specific-line-from-a-file/FreeBASIC/read-a-specific-line-from-a-file.freebasic b/Task/Read-a-specific-line-from-a-file/FreeBASIC/read-a-specific-line-from-a-file.freebasic new file mode 100644 index 0000000000..5e62404cb4 --- /dev/null +++ b/Task/Read-a-specific-line-from-a-file/FreeBASIC/read-a-specific-line-from-a-file.freebasic @@ -0,0 +1,25 @@ +' FB 1.05.0 Win64 + +Open "input.txt" For Input As #1 +Dim line_ As String +Dim count As Integer = 0 +While Not Eof(1) + Line Input #1, line_ '' read each line + count += 1 + If count = 7 Then + line_ = Trim(line_, Any !" \t") '' remove any leading or trailing spaces or tabs + If line_ = "" Then + Print "The 7th line is empty" + Else + Print "The 7th line is : "; line_ + End If + Exit While + End If +Wend +If count < 7 Then + Print "There are only"; count; " lines in the file" +End If +Close #1 +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Read-a-specific-line-from-a-file/FutureBasic/read-a-specific-line-from-a-file.futurebasic b/Task/Read-a-specific-line-from-a-file/FutureBasic/read-a-specific-line-from-a-file.futurebasic new file mode 100644 index 0000000000..66040107e6 --- /dev/null +++ b/Task/Read-a-specific-line-from-a-file/FutureBasic/read-a-specific-line-from-a-file.futurebasic @@ -0,0 +1,23 @@ +include "ConsoleWindow" + +dim as long i : i = 1 +dim as Str255 s, lineSeven +dim as CFURLRef url + +if ( files$( _CFURLRefOpen, "TEXT", "Select text file", @url ) ) + open "I", 2, @url + while ( not eof(2) ) + line input #2, s + if ( i == 7 ) + lineSeven = s + end if + i++ + wend + close 2 +end if + +if ( lineSeven[0] ) + print lineSeven +else + print "File did not contain seven lines, or line was empty." +end if diff --git a/Task/Read-a-specific-line-from-a-file/Lasso/read-a-specific-line-from-a-file.lasso b/Task/Read-a-specific-line-from-a-file/Lasso/read-a-specific-line-from-a-file.lasso new file mode 100644 index 0000000000..7029039766 --- /dev/null +++ b/Task/Read-a-specific-line-from-a-file/Lasso/read-a-specific-line-from-a-file.lasso @@ -0,0 +1,9 @@ +local(f) = file('unixdict.txt') +handle => { #f->close } +local(this_line = string,line = 0) +#f->forEachLine => { + #line++ + #line == 7 ? #this_line = #1 + #line == 7 ? loop_abort +} +#this_line // 6th, which is the 7th line in the file diff --git a/Task/Read-a-specific-line-from-a-file/MoonScript/read-a-specific-line-from-a-file.moon b/Task/Read-a-specific-line-from-a-file/MoonScript/read-a-specific-line-from-a-file.moon new file mode 100644 index 0000000000..3bbdf205a2 --- /dev/null +++ b/Task/Read-a-specific-line-from-a-file/MoonScript/read-a-specific-line-from-a-file.moon @@ -0,0 +1,5 @@ +iter = io.lines 'test.txt' +for i=0, 5 + error 'Not 7 lines in file' if not iter! + +print iter! diff --git a/Task/Read-a-specific-line-from-a-file/Nim/read-a-specific-line-from-a-file.nim b/Task/Read-a-specific-line-from-a-file/Nim/read-a-specific-line-from-a-file.nim new file mode 100644 index 0000000000..2988d94fe5 --- /dev/null +++ b/Task/Read-a-specific-line-from-a-file/Nim/read-a-specific-line-from-a-file.nim @@ -0,0 +1,9 @@ +var + line: TaintedString + f = open("test.txt", fmRead) + +for x in 0 .. 6: + try: + line = readLine f + except EIO: + echo "Not 7 lines in file" diff --git a/Task/Read-a-specific-line-from-a-file/Ring/read-a-specific-line-from-a-file.ring b/Task/Read-a-specific-line-from-a-file/Ring/read-a-specific-line-from-a-file.ring new file mode 100644 index 0000000000..61bd723dcd --- /dev/null +++ b/Task/Read-a-specific-line-from-a-file/Ring/read-a-specific-line-from-a-file.ring @@ -0,0 +1,12 @@ +fp = fopen("C:\Ring\ReadMe.txt","r") +n = 0 + +r = "" +while isstring(r) + while n < 8 + r = fgetc(fp) + if r = char(10) n++ see nl + else see r ok + end +end +fclose(fp) diff --git a/Task/Read-a-specific-line-from-a-file/Sidef/read-a-specific-line-from-a-file.sidef b/Task/Read-a-specific-line-from-a-file/Sidef/read-a-specific-line-from-a-file.sidef new file mode 100644 index 0000000000..829ea053c1 --- /dev/null +++ b/Task/Read-a-specific-line-from-a-file/Sidef/read-a-specific-line-from-a-file.sidef @@ -0,0 +1,11 @@ +func getNthLine(filename, n) { + var file = File.new(filename); + file.open_r.each { |line| + Num($.) == n && return line; + } + warn "file #{file} does not have #{n} lines, only #{$.}\n"; + return nil; +} + +var line = getNthLine("/etc/passwd", 7); +print line if defined line; diff --git a/Task/Read-a-specific-line-from-a-file/Ursa/read-a-specific-line-from-a-file.ursa b/Task/Read-a-specific-line-from-a-file/Ursa/read-a-specific-line-from-a-file.ursa new file mode 100644 index 0000000000..2090a95f23 --- /dev/null +++ b/Task/Read-a-specific-line-from-a-file/Ursa/read-a-specific-line-from-a-file.ursa @@ -0,0 +1,13 @@ +decl string<> lines +decl file f +f.open "filename.txt" +set lines (f.readlines) +f.close + +if (< (size lines) 7) + out "the file has less than seven lines" endl console + stop +end if + +out "the seventh line in the file is:" endl endl console +out lines<6> endl console diff --git a/Task/Read-a-specific-line-from-a-file/jq/read-a-specific-line-from-a-file-1.jq b/Task/Read-a-specific-line-from-a-file/jq/read-a-specific-line-from-a-file-1.jq new file mode 100644 index 0000000000..993c5551a2 --- /dev/null +++ b/Task/Read-a-specific-line-from-a-file/jq/read-a-specific-line-from-a-file-1.jq @@ -0,0 +1,7 @@ +# Input - a line number to read, counting from 1 +# Output - a stream with 0 or 1 items +def read_line: + . as $in + | label $top + | foreach inputs as $line + (0; .+1; if . == $in then $line, break $top else empty end) ; diff --git a/Task/Read-a-specific-line-from-a-file/jq/read-a-specific-line-from-a-file-2.jq b/Task/Read-a-specific-line-from-a-file/jq/read-a-specific-line-from-a-file-2.jq new file mode 100644 index 0000000000..3c48101d02 --- /dev/null +++ b/Task/Read-a-specific-line-from-a-file/jq/read-a-specific-line-from-a-file-2.jq @@ -0,0 +1,4 @@ +$line | tonumber +| if . > 0 then read_line + else "$line (\(.)) should be a non-negative integer" + end diff --git a/Task/Read-a-specific-line-from-a-file/jq/read-a-specific-line-from-a-file-3.jq b/Task/Read-a-specific-line-from-a-file/jq/read-a-specific-line-from-a-file-3.jq new file mode 100644 index 0000000000..5abb4324d9 --- /dev/null +++ b/Task/Read-a-specific-line-from-a-file/jq/read-a-specific-line-from-a-file-3.jq @@ -0,0 +1,2 @@ +$ jq -n -r 'range(0;20) | tostring' | jq --arg line 10 -n -R -r -f Read_a_specific_line_from_a_file.jq +9 diff --git a/Task/Read-entire-file/8th/read-entire-file.8th b/Task/Read-entire-file/8th/read-entire-file.8th new file mode 100644 index 0000000000..00597a0b4f --- /dev/null +++ b/Task/Read-entire-file/8th/read-entire-file.8th @@ -0,0 +1 @@ +"somefile.txt" f:slurp >s diff --git a/Task/Read-entire-file/FreeBASIC/read-entire-file.freebasic b/Task/Read-entire-file/FreeBASIC/read-entire-file.freebasic new file mode 100644 index 0000000000..ad04f45ec8 --- /dev/null +++ b/Task/Read-entire-file/FreeBASIC/read-entire-file.freebasic @@ -0,0 +1,10 @@ +' FB 1.05.0 Win64 + +Open "input.txt" For Input Encoding "ascii" As #1 +Dim fileLen As LongInt = Lof(1) '' get file length in bytes +Dim buffer As String = Space(fileLen) '' allocate a string of size 'fileLen' bytes +Get #1, 1, buffer '' read all data from start of file into the buffer +Print buffer '' print to console +buffer = "" '' release memory used by setting buffer to empty +Close #1 +Sleep diff --git a/Task/Read-entire-file/FutureBasic/read-entire-file.futurebasic b/Task/Read-entire-file/FutureBasic/read-entire-file.futurebasic new file mode 100644 index 0000000000..7358f2e902 --- /dev/null +++ b/Task/Read-entire-file/FutureBasic/read-entire-file.futurebasic @@ -0,0 +1,27 @@ +include "ConsoleWindow" + +local fn ReadTextFile +dim as CFURLRef fileRef +dim as Handle h +dim as CFStringRef cfStr : cfStr = NULL +dim as long fileLen + +if ( files$( _CFURLRefOpen, "TEXT", "Select text file...", @fileRef ) ) + open "i", 2, fileRef + fileLen = lof( 2, 1 ) + h = fn NewHandleClear( fileLen ) + if ( h ) + read file 2, [h], fileLen + close #2 + cfStr = fn CFStringCreateWithBytes( _kCFAllocatorDefault, #[h], fn GetHandleSize(h), _kCFStringEncodingMacRoman, _false ) + fn DisposeH( h ) + end if +else +// User canceled +end if + +fn HIViewSetText( sConsoleHITextView, cfStr ) +CFRelease( cfStr ) +end fn + +fn ReadTextFile diff --git a/Task/Read-entire-file/LFE/read-entire-file.lfe b/Task/Read-entire-file/LFE/read-entire-file.lfe new file mode 100644 index 0000000000..c88dc1789a --- /dev/null +++ b/Task/Read-entire-file/LFE/read-entire-file.lfe @@ -0,0 +1 @@ +(set `#(ok ,data) (file:read_file "myfile.txt")) diff --git a/Task/Read-entire-file/Lasso/read-entire-file.lasso b/Task/Read-entire-file/Lasso/read-entire-file.lasso new file mode 100644 index 0000000000..46512633e4 --- /dev/null +++ b/Task/Read-entire-file/Lasso/read-entire-file.lasso @@ -0,0 +1,2 @@ +local(f) = file('foo.txt') +#f->readString diff --git a/Task/Read-entire-file/Lingo/read-entire-file.lingo b/Task/Read-entire-file/Lingo/read-entire-file.lingo new file mode 100644 index 0000000000..c4243d8447 --- /dev/null +++ b/Task/Read-entire-file/Lingo/read-entire-file.lingo @@ -0,0 +1,13 @@ +---------------------------------------- +-- Reads whole file, returns string +-- @param {string} tFile +-- @return {string|false} +---------------------------------------- +on readFile (tFile) + fp = xtra("fileIO").new() + fp.openFile(tFile, 1) + if fp.status() then return false + res = fp.readFile() + fp.closeFile() + return res +end diff --git a/Task/Read-entire-file/LiveCode/read-entire-file-1.livecode b/Task/Read-entire-file/LiveCode/read-entire-file-1.livecode new file mode 100644 index 0000000000..be38c15b1b --- /dev/null +++ b/Task/Read-entire-file/LiveCode/read-entire-file-1.livecode @@ -0,0 +1,2 @@ +put URL "file:///usr/share/dict/words" into tVar +put the number of lines of tVar diff --git a/Task/Read-entire-file/LiveCode/read-entire-file-2.livecode b/Task/Read-entire-file/LiveCode/read-entire-file-2.livecode new file mode 100644 index 0000000000..03239db7d2 --- /dev/null +++ b/Task/Read-entire-file/LiveCode/read-entire-file-2.livecode @@ -0,0 +1,6 @@ +local tFile,tLinecount +put "/usr/share/dict/words" into tFile +open file tFile for text read +read from file tFile until EOF +put the number of lines of it -- file contents held in "it" variable +close file tFile diff --git a/Task/Read-entire-file/Nim/read-entire-file.nim b/Task/Read-entire-file/Nim/read-entire-file.nim new file mode 100644 index 0000000000..459831b1a0 --- /dev/null +++ b/Task/Read-entire-file/Nim/read-entire-file.nim @@ -0,0 +1 @@ +readFile(filename) diff --git a/Task/Read-entire-file/Panda/read-entire-file.panda b/Task/Read-entire-file/Panda/read-entire-file.panda new file mode 100644 index 0000000000..9e20471a08 --- /dev/null +++ b/Task/Read-entire-file/Panda/read-entire-file.panda @@ -0,0 +1 @@ +file:readme.txt .text diff --git a/Task/Read-entire-file/Phix/read-entire-file.phix b/Task/Read-entire-file/Phix/read-entire-file.phix new file mode 100644 index 0000000000..be8b687c5f --- /dev/null +++ b/Task/Read-entire-file/Phix/read-entire-file.phix @@ -0,0 +1,4 @@ +constant fn = open(command_line()[2],"rb") +?get_text(fn) +close(fn) +{} = wait_key() diff --git a/Task/Read-entire-file/Ring/read-entire-file-1.ring b/Task/Read-entire-file/Ring/read-entire-file-1.ring new file mode 100644 index 0000000000..31c996be30 --- /dev/null +++ b/Task/Read-entire-file/Ring/read-entire-file-1.ring @@ -0,0 +1,4 @@ +# Read the file +cStr = read("myfile.txt") +# print the file content +See cStr diff --git a/Task/Read-entire-file/Ring/read-entire-file-2.ring b/Task/Read-entire-file/Ring/read-entire-file-2.ring new file mode 100644 index 0000000000..806dd6e8b6 --- /dev/null +++ b/Task/Read-entire-file/Ring/read-entire-file-2.ring @@ -0,0 +1 @@ +cStr = read("myfile.txt") See cStr diff --git a/Task/Read-entire-file/Ring/read-entire-file-3.ring b/Task/Read-entire-file/Ring/read-entire-file-3.ring new file mode 100644 index 0000000000..de83229d0e --- /dev/null +++ b/Task/Read-entire-file/Ring/read-entire-file-3.ring @@ -0,0 +1 @@ +See read("myfile.txt") diff --git a/Task/Read-entire-file/Sidef/read-entire-file-1.sidef b/Task/Read-entire-file/Sidef/read-entire-file-1.sidef new file mode 100644 index 0000000000..5ffcb8b170 --- /dev/null +++ b/Task/Read-entire-file/Sidef/read-entire-file-1.sidef @@ -0,0 +1,3 @@ +var file = File.new(__FILE__); +var content = file.open_r.slurp; +print content; diff --git a/Task/Read-entire-file/Sidef/read-entire-file-2.sidef b/Task/Read-entire-file/Sidef/read-entire-file-2.sidef new file mode 100644 index 0000000000..b1f472c062 --- /dev/null +++ b/Task/Read-entire-file/Sidef/read-entire-file-2.sidef @@ -0,0 +1,3 @@ +var file = File(__FILE__) +var content = file.read(:utf8) +print content diff --git a/Task/Read-entire-file/Sparkling/read-entire-file.sparkling b/Task/Read-entire-file/Sparkling/read-entire-file.sparkling new file mode 100644 index 0000000000..821befa3ad --- /dev/null +++ b/Task/Read-entire-file/Sparkling/read-entire-file.sparkling @@ -0,0 +1 @@ +let contents = readfile("foo.txt"); diff --git a/Task/Read-entire-file/Swift/read-entire-file.swift b/Task/Read-entire-file/Swift/read-entire-file.swift new file mode 100644 index 0000000000..066239f5ac --- /dev/null +++ b/Task/Read-entire-file/Swift/read-entire-file.swift @@ -0,0 +1,6 @@ +import Foundation + +let path = "~/input.txt".stringByExpandingTildeInPath +if let string = String(contentsOfFile: path, encoding: NSUTF8StringEncoding) { + println(string) // print contents of file +} diff --git a/Task/Read-entire-file/Ursa/read-entire-file.ursa b/Task/Read-entire-file/Ursa/read-entire-file.ursa new file mode 100644 index 0000000000..36d20a4d5c --- /dev/null +++ b/Task/Read-entire-file/Ursa/read-entire-file.ursa @@ -0,0 +1,4 @@ +decl string contents +decl file f +f.open "filename.txt" +set contents (f.readall) diff --git a/Task/Read-entire-file/Wart/read-entire-file.wart b/Task/Read-entire-file/Wart/read-entire-file.wart new file mode 100644 index 0000000000..ae97560ef6 --- /dev/null +++ b/Task/Read-entire-file/Wart/read-entire-file.wart @@ -0,0 +1,4 @@ +with infile "x" + with outstring + whilet line (read_line) + prn line diff --git a/Task/Read-entire-file/jq/read-entire-file-1.jq b/Task/Read-entire-file/jq/read-entire-file-1.jq new file mode 100644 index 0000000000..ea8b289471 --- /dev/null +++ b/Task/Read-entire-file/jq/read-entire-file-1.jq @@ -0,0 +1 @@ +jq -R -s . input.txt diff --git a/Task/Read-entire-file/jq/read-entire-file-2.jq b/Task/Read-entire-file/jq/read-entire-file-2.jq new file mode 100644 index 0000000000..18a4f10ad4 --- /dev/null +++ b/Task/Read-entire-file/jq/read-entire-file-2.jq @@ -0,0 +1 @@ +jq -R . input.txt | jq -s . diff --git a/Task/Read-entire-file/jq/read-entire-file-3.jq b/Task/Read-entire-file/jq/read-entire-file-3.jq new file mode 100644 index 0000000000..36203ae85e --- /dev/null +++ b/Task/Read-entire-file/jq/read-entire-file-3.jq @@ -0,0 +1 @@ +jq -R -s 'split("\n")' input.txt diff --git a/Task/Real-constants-and-functions/Axe/real-constants-and-functions-1.axe b/Task/Real-constants-and-functions/Axe/real-constants-and-functions-1.axe new file mode 100644 index 0000000000..712bf6edf8 --- /dev/null +++ b/Task/Real-constants-and-functions/Axe/real-constants-and-functions-1.axe @@ -0,0 +1 @@ +√(X) diff --git a/Task/Real-constants-and-functions/Axe/real-constants-and-functions-2.axe b/Task/Real-constants-and-functions/Axe/real-constants-and-functions-2.axe new file mode 100644 index 0000000000..1c9e42268f --- /dev/null +++ b/Task/Real-constants-and-functions/Axe/real-constants-and-functions-2.axe @@ -0,0 +1 @@ +√(Y)ʳ diff --git a/Task/Real-constants-and-functions/Axe/real-constants-and-functions-3.axe b/Task/Real-constants-and-functions/Axe/real-constants-and-functions-3.axe new file mode 100644 index 0000000000..3f736ce35a --- /dev/null +++ b/Task/Real-constants-and-functions/Axe/real-constants-and-functions-3.axe @@ -0,0 +1 @@ +ln(X) diff --git a/Task/Real-constants-and-functions/Axe/real-constants-and-functions-4.axe b/Task/Real-constants-and-functions/Axe/real-constants-and-functions-4.axe new file mode 100644 index 0000000000..20f6ef29ae --- /dev/null +++ b/Task/Real-constants-and-functions/Axe/real-constants-and-functions-4.axe @@ -0,0 +1 @@ +e^(X) diff --git a/Task/Real-constants-and-functions/Axe/real-constants-and-functions-5.axe b/Task/Real-constants-and-functions/Axe/real-constants-and-functions-5.axe new file mode 100644 index 0000000000..12bbbda151 --- /dev/null +++ b/Task/Real-constants-and-functions/Axe/real-constants-and-functions-5.axe @@ -0,0 +1 @@ +abs(X) diff --git a/Task/Real-constants-and-functions/ERRE/real-constants-and-functions.erre b/Task/Real-constants-and-functions/ERRE/real-constants-and-functions.erre new file mode 100644 index 0000000000..12c036b81f --- /dev/null +++ b/Task/Real-constants-and-functions/ERRE/real-constants-and-functions.erre @@ -0,0 +1,28 @@ +PROGRAM R_C_F + +FUNCTION CEILING(X) + CEILING=INT(X)-(X-INT(X)>0) +END FUNCTION + +FUNCTION FLOOR(X) + FLOOR=INT(X) +END FUNCTION + +BEGIN + PRINT(EXP(1)) ! e not available + PRINT(π) ! pi is available or .... + PRINT(4*ATN(1)) ! .... equal to + + X=12.345 + Y=1.23 + + PRINT(SQR(X),X^0.5) ! square root + PRINT(LOG(X)) ! natural logarithm base e + PRINT(LOG(X)/LOG(10)) ! base 10 logarithm + PRINT(LOG(X)/LOG(Y)) ! arbitrary base logarithm (y>0) + PRINT(EXP(X)) ! exponential + PRINT(ABS(X)) ! absolute value + PRINT(FLOOR(X)) ! floor + PRINT(CEILING(X)) ! ceiling + PRINT(X^Y) ! power +END PROGRAM diff --git a/Task/Real-constants-and-functions/Elm/real-constants-and-functions.elm b/Task/Real-constants-and-functions/Elm/real-constants-and-functions.elm new file mode 100644 index 0000000000..60db1ba090 --- /dev/null +++ b/Task/Real-constants-and-functions/Elm/real-constants-and-functions.elm @@ -0,0 +1,9 @@ +e -- e +pi -- pi +sqrt x -- square root +logBase 3 9 -- logarithm (any base) +e^x -- exponential +abs x -- absolute value +floor x -- floor +ceiling x -- ceiling +2 ^ 3 -- power diff --git a/Task/Real-constants-and-functions/FreeBASIC/real-constants-and-functions.freebasic b/Task/Real-constants-and-functions/FreeBASIC/real-constants-and-functions.freebasic new file mode 100644 index 0000000000..da4193a84d --- /dev/null +++ b/Task/Real-constants-and-functions/FreeBASIC/real-constants-and-functions.freebasic @@ -0,0 +1,15 @@ +' FB 1.05.0 Win64 + +#Include "crt/math.bi" + +Print M_E '' constant "e" from C runtime library +Print M_PI '' constant "pi" from C runtime library +Print Sqr(2) '' square root function built into FB +Print Log(M_E) '' log to base "e" built into FB +Print log10(10) '' log to base 10 from C runtime library +Print Exp(1) '' exponential function built into FB +Print Abs(-1) '' absolute value function (integers or floats) built into FB +Print Int(-2.5) '' floor function built into FB +Print ceil(-2.5) '' ceiling function from C runtime library +Print 2.5 ^ 3.5 '' exponentiation operator built into FB +Sleep diff --git a/Task/Real-constants-and-functions/FutureBasic/real-constants-and-functions.futurebasic b/Task/Real-constants-and-functions/FutureBasic/real-constants-and-functions.futurebasic new file mode 100644 index 0000000000..0804a807bb --- /dev/null +++ b/Task/Real-constants-and-functions/FutureBasic/real-constants-and-functions.futurebasic @@ -0,0 +1,15 @@ +include "ConsoleWindow" + +// Set width of tab +def tab 8 + +print "exp:", exp(1) +print "pi:", pi +print "sqr:", sqr(2) +print "log:", log(2) +print "log2:", log2(2) +print "log10", log10(2) +print "abs:", abs(-2) +print "floor:", int(1.534) +print "ceil:", val( using"###"; 1.534 ) +print "power:", 1.23 ^ 4 diff --git a/Task/Real-constants-and-functions/Lasso/real-constants-and-functions.lasso b/Task/Real-constants-and-functions/Lasso/real-constants-and-functions.lasso new file mode 100644 index 0000000000..b93011f6c9 --- /dev/null +++ b/Task/Real-constants-and-functions/Lasso/real-constants-and-functions.lasso @@ -0,0 +1,16 @@ +//e +define e => 2.7182818284590452 + +//π +define pi => 3.141592653589793 + +e +pi +9.0->sqrt +1.64->log +1.64->log10 +1.64->exp +1.64->abs +1.64->floor +1.64->ceil +1.64->pow(10.0) diff --git a/Task/Real-constants-and-functions/Lingo/real-constants-and-functions.lingo b/Task/Real-constants-and-functions/Lingo/real-constants-and-functions.lingo new file mode 100644 index 0000000000..8c6ab9a8e6 --- /dev/null +++ b/Task/Real-constants-and-functions/Lingo/real-constants-and-functions.lingo @@ -0,0 +1,47 @@ +the floatPrecision = 8 + +-- e (base of the natural logarithm) +put exp(1) +-- 2.71828183 + +-- pi +put PI +-- 3.14159265 + +-- square root +put sqrt(2.0) +-- 1.41421356 + +-- logarithm (any base allowed) +x = 100 + +put log(x) -- calculate log for base e +-- 4.60517019 + +put log(x)/log(10) -- calculate log for base 10 +-- 2.00000000 + +-- exponential (ex) +put exp(3) +-- 20.08553692 + +-- absolute value (a.k.a. "magnitude") +put abs(-1) +-- 1 + +-- floor (largest integer less than or equal to this number--not the same as truncate or int) +n = 23.536 +put bitOr(n, 0) -- calculates floor +-- 23 + +-- ceiling (smallest integer not less than this number--not the same as round up) +n = 23.536 +-- calculates ceil +floor = bitOr(n, 0) +if (floor >= n) then put floor +else put floor+1 +-- 24 + +-- power +put power(2, 8) +-- 256.00000000 diff --git a/Task/Real-constants-and-functions/LiveCode/real-constants-and-functions.livecode b/Task/Real-constants-and-functions/LiveCode/real-constants-and-functions.livecode new file mode 100644 index 0000000000..49ccc1d630 --- /dev/null +++ b/Task/Real-constants-and-functions/LiveCode/real-constants-and-functions.livecode @@ -0,0 +1,9 @@ +e‬: exp(1) +pi: pi +square root: sqrt(x) +logarithm: log(x) +exponential (‪ex‬): exp(x) +absolute value: abs(x) +floor: floor(x) +ceiling: ceil(x) +power: x^y diff --git a/Task/Real-constants-and-functions/Nim/real-constants-and-functions.nim b/Task/Real-constants-and-functions/Nim/real-constants-and-functions.nim new file mode 100644 index 0000000000..9cefc4b5e3 --- /dev/null +++ b/Task/Real-constants-and-functions/Nim/real-constants-and-functions.nim @@ -0,0 +1,14 @@ +import math + +var x, y = 12.5 + +echo E +echo Pii +echo sqrt(x) +echo ln(x) +echo log10(x) +echo exp(x) +echo abs(x) +echo floor(x) +echo ceil(x) +echo pow(x, y) diff --git a/Task/Real-constants-and-functions/Oforth/real-constants-and-functions.oforth b/Task/Real-constants-and-functions/Oforth/real-constants-and-functions.oforth new file mode 100644 index 0000000000..a2f7e59597 --- /dev/null +++ b/Task/Real-constants-and-functions/Oforth/real-constants-and-functions.oforth @@ -0,0 +1,24 @@ +import: math + +: testReal + E println + Pi println + 9 sqrt println + 2 ln println + 2 exp println + -3.4 abs println + 3.4 exp println + + 2.4 floor println + 3.9 floor println + 5.5 floor println + -2.4 floor println + -3.9 floor println + -5.5 floor println + + 2.4 ceil println + 3.9 ceil println + 5.5 ceil println + -2.4 ceil println + -3.9 ceil println + -5.5 ceil println ; diff --git a/Task/Real-constants-and-functions/Phix/real-constants-and-functions.phix b/Task/Real-constants-and-functions/Phix/real-constants-and-functions.phix new file mode 100644 index 0000000000..070d3c303d --- /dev/null +++ b/Task/Real-constants-and-functions/Phix/real-constants-and-functions.phix @@ -0,0 +1,15 @@ +?E -- Euler number +?PI -- pi +?log(E) -- natural logarithm +?log10(10) -- base 10 logarithm +?exp(log(5)) -- exponential +?sqrt(5) -- square root +?abs(-1.2) -- absolute value +?floor(-1.2) -- floor, -2 +?ceil(-1.2) -- ceiling, -1 +?round(-1.8) -- rounded, -2 +?trunc(-1.8) -- truncate, -1 +?power(E,log(5)) -- displays 5.0 +?power(10,log10(5)) -- displays 5.0 +?INVLN10 -- displays 0.434.. +?exp(1/INVLN10) -- displays 10.0 diff --git a/Task/Real-constants-and-functions/Ring/real-constants-and-functions.ring b/Task/Real-constants-and-functions/Ring/real-constants-and-functions.ring new file mode 100644 index 0000000000..f29af6d204 --- /dev/null +++ b/Task/Real-constants-and-functions/Ring/real-constants-and-functions.ring @@ -0,0 +1,45 @@ +See "Mathematical Functions" + nl +See "Sin(0) = " + sin(0) + nl +See "Sin(90) radians = " + sin(90) + nl +See "Sin(90) degree = " + sin(90*3.14/180) + nl + +See "Cos(0) = " + cos(0) + nl +See "Cos(90) radians = " + cos(90) + nl +See "Cos(90) degree = " + cos(90*3.14/180) + nl + +See "Tan(0) = " + tan(0) + nl +See "Tan(90) radians = " + tan(90) + nl +See "Tan(90) degree = " + tan(90*3.14/180) + nl + +See "asin(0) = " + asin(0) + nl +See "acos(0) = " + acos(0) + nl +See "atan(0) = " + atan(0) + nl +See "atan2(1,1) = " + atan2(1,1) + nl + +See "sinh(0) = " + sinh(0) + nl +See "sinh(1) = " + sinh(1) + nl +See "cosh(0) = " + cosh(0) + nl +See "cosh(1) = " + cosh(1) + nl +See "tanh(0) = " + tanh(0) + nl +See "tanh(1) = " + tanh(1) + nl + +See "exp(0) = " + exp(0) + nl +See "exp(1) = " + exp(1) + nl +See "log(1) = " + log(1) + nl +See "log(2) = " + log(2) + nl +See "log10(1) = " + log10(1) + nl +See "log10(2) = " + log10(2) + nl +See "log10(10) = " + log10(10) + nl + +See "Ceil(1.12) = " + Ceil(1.12) + nl +See "Ceil(1.72) = " + Ceil(1.72) + nl + +See "Floor(1.12) = " + floor(1.12) + nl +See "Floor(1.72) = " + floor(1.72) + nl + +See "fabs(1.12) = " + fabs(1.12) + nl +See "fabs(1.72) = " + fabs(1.72) + nl + +See "pow(2,3) = " + pow(2,3) + nl + +see "sqrt(16) = " + sqrt(16) + nl diff --git a/Task/Real-constants-and-functions/Sidef/real-constants-and-functions.sidef b/Task/Real-constants-and-functions/Sidef/real-constants-and-functions.sidef new file mode 100644 index 0000000000..e134ea527f --- /dev/null +++ b/Task/Real-constants-and-functions/Sidef/real-constants-and-functions.sidef @@ -0,0 +1,10 @@ +Math.e; # e +Math.pi; # pi +x.sqrt; # square root +x.log; # natural logarithm +x.log10; # base 10 logarithm +x.exp; # e raised to the power of x +x.abs; # absolute value +x.floor; # floor +x.ceil; # ceiling +x**y; # exponentiation diff --git a/Task/Real-constants-and-functions/Sparkling/real-constants-and-functions.sparkling b/Task/Real-constants-and-functions/Sparkling/real-constants-and-functions.sparkling new file mode 100644 index 0000000000..2f5ace663c --- /dev/null +++ b/Task/Real-constants-and-functions/Sparkling/real-constants-and-functions.sparkling @@ -0,0 +1,31 @@ +// e: +print(M_E); + +// π: +print(M_PI); + +// square root: +let five = sqrt(25); + +// logarithm +// natural: +let one = log(M_E); +// base-2: +let six = log2(64); +// base-10 +let three = log10(1000); + +// exponential +let e_cubed = exp(3); + +// absolute value +let ten = abs(-10); + +// floor +let seven = floor(7.8); + +// ceiling +let four = ceil(3.2); + +// power +let eighty_one = pow(3, 4); diff --git a/Task/Real-constants-and-functions/Swift/real-constants-and-functions.swift b/Task/Real-constants-and-functions/Swift/real-constants-and-functions.swift new file mode 100644 index 0000000000..d588e9f77d --- /dev/null +++ b/Task/Real-constants-and-functions/Swift/real-constants-and-functions.swift @@ -0,0 +1,11 @@ +import Darwin + +M_E // e +M_PI // pi +sqrt(x) // square root--cube root also available (cbrt) +log(x) // natural logarithm--log base 10 also available (log10) +exp(x) // exponential +abs(x) // absolute value +floor(x) // floor +ceil(x) // ceiling +pow(x,y) // power diff --git a/Task/Real-constants-and-functions/jq/real-constants-and-functions.jq b/Task/Real-constants-and-functions/jq/real-constants-and-functions.jq new file mode 100644 index 0000000000..52590de189 --- /dev/null +++ b/Task/Real-constants-and-functions/jq/real-constants-and-functions.jq @@ -0,0 +1,9 @@ +1 | exp # i.e. e +1 | atan * 4 # i.e. π +sqrt +log # Naperian log +exp +if . < 0 then -. else . end # absolute value +floor +# jq does not currently have a ceiling function +# jq does not currently have a function to compute x^y diff --git a/Task/Record-sound/ChucK/record-sound.chuck b/Task/Record-sound/ChucK/record-sound.chuck new file mode 100644 index 0000000000..43a62bda3b --- /dev/null +++ b/Task/Record-sound/ChucK/record-sound.chuck @@ -0,0 +1,23 @@ +// chuck this with other shreds to record to file +// example> chuck foo.ck bar.ck rec + +// arguments: rec: + +// get name +me.arg(0) => string filename; +if( filename.length() == 0 ) "foo.wav" => filename; + +// pull samples from the dac +dac => Gain g => WvOut w => blackhole; +// this is the output file name +filename => w.wavFilename; +<<<"writing to file:", "'" + w.filename() + "'">>>; +// any gain you want for the output +.5 => g.gain; + +// temporary workaround to automatically close file on remove-shred +null @=> w; + +// infinite time loop... +// ctrl-c will stop it, or modify to desired duration +while( true ) 1::second => now; diff --git a/Task/Record-sound/LiveCode/record-sound.livecode b/Task/Record-sound/LiveCode/record-sound.livecode new file mode 100644 index 0000000000..3d01b7e048 --- /dev/null +++ b/Task/Record-sound/LiveCode/record-sound.livecode @@ -0,0 +1,13 @@ +command makeRecording + set the dontUseQT to false -- on windows use true + set the recordFormat to "wave" -- can be wav,aiff, au + set the recordRate to 44.1 -- sample at 44100 Hz + set the recordSampleSize to 16 --default is 8 bit + ask file "Save recording as" + if it is not empty then + answer record --show sound input dialog with presets above + record sound file it -- actual record command + wait 10 seconds + stop recording + end if +end makeRecording diff --git a/Task/Record-sound/Nim/record-sound.nim b/Task/Record-sound/Nim/record-sound.nim new file mode 100644 index 0000000000..61ab560c24 --- /dev/null +++ b/Task/Record-sound/Nim/record-sound.nim @@ -0,0 +1,12 @@ +proc record(bytes): auto = + var f = open("/dev/dsp") + result = newSeq[int8](bytes) + discard f.readBytes(result, 0, bytes) + +proc play(buf) = + var f = open("/dev/dsp", fmWrite) + f.write(buf) + f.close + +var p = record(65536) +play(p) diff --git a/Task/Reduced-row-echelon-form/Phix/reduced-row-echelon-form.phix b/Task/Reduced-row-echelon-form/Phix/reduced-row-echelon-form.phix new file mode 100644 index 0000000000..de41b2644e --- /dev/null +++ b/Task/Reduced-row-echelon-form/Phix/reduced-row-echelon-form.phix @@ -0,0 +1,32 @@ +function ToReducedRowEchelonForm(sequence M) +integer lead = 1, + rowCount = length(M), + columnCount = length(M[1]), + i + for r=1 to rowCount do + if lead>=columnCount then exit end if + i = r + while M[i][lead]=0 do + i += 1 + if i=rowCount then + i = r + lead += 1 + if lead=columnCount then exit end if + end if + end while + -- nb M[i] is assigned before M[r], which matters when i=r: + {M[r],M[i]} = {sq_div(M[i],M[i][lead]),M[r]} + for j=1 to rowCount do + if j!=r then + M[j] = sq_sub(M[j],sq_mul(M[j][lead],M[r])) + end if + end for + lead += 1 + end for + return M +end function + +? ToReducedRowEchelonForm( + { { 1, 2, -1, -4 }, + { 2, 3, -1, -11 }, + { -2, 0, -3, 22 } }) diff --git a/Task/Reduced-row-echelon-form/Sidef/reduced-row-echelon-form.sidef b/Task/Reduced-row-echelon-form/Sidef/reduced-row-echelon-form.sidef new file mode 100644 index 0000000000..2ad4fc7041 --- /dev/null +++ b/Task/Reduced-row-echelon-form/Sidef/reduced-row-echelon-form.sidef @@ -0,0 +1,59 @@ +func rref (Array m) { + m.is_empty && return; + var (lead, rows, cols) = (0, m.len, m[0].len); + + rows.range.each { |r| + lead >= cols && return m; + var i = r; + + while (!m[i][lead]) { + ++i == rows || next; + i = r; + ++lead == cols && return m; + } + + m[i, r] = m[r, i]; + var lv = m[r][lead]; + m[r] = (m[r] »/» lv); + + rows.range.each { |n| + n == r && next; + m[n] = (m[n] »-« (m[r] «*« m[n][lead])) + } + ++lead; + } + return m +} + +func say_it (message, array) { + say "\n#{message}"; + array.each { |row| + say row.map { |n| " %5s" % n.as_rat }.join + } +} + +var M = [ + [ # base test case + [ 1, 2, -1, -4 ], + [ 2, 3, -1, -11 ], + [ -2, 0, -3, 22 ], + ], + [ # mix of number styles + [ 3, 0, -3, 1 ], + [ .5, 3/2, -3, -2 ], + [ .2, 4/5, -1.6, .3 ], + ], + [ # degenerate case + [ 1, 2, 3, 4, 3, 1], + [ 2, 4, 6, 2, 6, 2], + [ 3, 6, 18, 9, 9, -6], + [ 4, 8, 12, 10, 12, 4], + [ 5, 10, 24, 11, 15, -4], + ], +]; + +M.each { |matrix| + say_it('Original Matrix', matrix); + say_it('Reduced Row Echelon Form Matrix', rref(matrix)); + say ''; +} diff --git a/Task/Reduced-row-echelon-form/Swift/reduced-row-echelon-form.swift b/Task/Reduced-row-echelon-form/Swift/reduced-row-echelon-form.swift new file mode 100644 index 0000000000..529d9e74b2 --- /dev/null +++ b/Task/Reduced-row-echelon-form/Swift/reduced-row-echelon-form.swift @@ -0,0 +1,40 @@ +var lead = 0 +var rowCount = eCount +var columnCount = mCount +for (var r = 0; r < rowCount; ++r) { + if (columnCount <= lead) { + break + } + var i = r + while (matrix[i][lead] == 0) { + ++i + if (i == rowCount) { + i = r + ++lead + if (columnCount == lead) { + --lead + break + } + } + } + for (var j = 0; j < columnCount; ++j) { + var temp = matrix[r][j] + matrix[r][j] = matrix[i][j] + matrix[i][j] = temp + } + var div = matrix[r][lead] + if (div != 0) { + for (var j = 0; j < columnCount; ++j) { + matrix[r][j] /= div + } + } + for (var j = 0; j < rowCount; ++j) { + if (j != r) { + var sub = matrix[j][lead] + for (var k = 0; k < columnCount; ++k) { + matrix[j][k] -= (sub * matrix[r][k]) + } + } + } + ++lead +} diff --git a/Task/Reduced-row-echelon-form/Visual-FoxPro/reduced-row-echelon-form.visual b/Task/Reduced-row-echelon-form/Visual-FoxPro/reduced-row-echelon-form.visual new file mode 100644 index 0000000000..1cd6502a7a --- /dev/null +++ b/Task/Reduced-row-echelon-form/Visual-FoxPro/reduced-row-echelon-form.visual @@ -0,0 +1,90 @@ +CLOSE DATABASES ALL +LOCAL lnRows As Integer, lnCols As Integer, lcSafety As String +LOCAL ARRAY matrix[1] +lcSafety = SET("Safety") +SET SAFETY OFF +CLEAR +CREATE CURSOR results (c1 B(6), c2 B(6), c3 B(6), c4 B(6)) +CREATE CURSOR curs1(c1 I, c2 I, c3 I, c4 I) +INSERT INTO curs1 VALUES (1,2,-1,-4) +INSERT INTO curs1 VALUES (2,3,-1,-11) +INSERT INTO curs1 VALUES (-2,0,-3,22) +lnRows = RECCOUNT() && 3 +lnCols = FCOUNT() && 4 +SELECT * FROM curs1 INTO ARRAY matrix +IF RREF(@matrix, lnRows, lnCols) + SELECT results + APPEND FROM ARRAY matrix + BROWSE NORMAL IN SCREEN +ENDIF +SET SAFETY &lcSafety + +FUNCTION RREF(mat, tnRows As Integer, tnCols As Integer) As Boolean +LOCAL lnPivot As Integer, i As Integer, r As Integer, j As Integer, ; +p As Double. llResult As Boolean, llExit As Boolean +llResult = .T. +llExit = .F. +lnPivot = 1 +FOR r = 1 TO tnRows + IF lnPivot > tnCols + EXIT + ENDIF + i = r + DO WHILE mat[i,lnPivot] = 0 + i = i + 1 + IF i = tnRows + i = r + lnPivot = lnPivot + 1 + IF lnPivot > tnCols + llExit = .T. + EXIT + ENDIF + ENDIF + ENDDO + IF llExit + EXIT + ENDIF + ASwapRows(@mat, i, r) + p = mat[r,lnPivot] + IF p # 0 + FOR j = 1 TO tnCols + mat[r,j] = mat[r,j]/p + ENDFOR + ELSE + ? "Divison by zero." + llResult = .F. + EXIT + ENDIF + FOR i = 1 TO tnRows + IF i # r + p = mat[i,lnPivot] + FOR j = 1 TO tnCols + mat[i,j] = mat[i,j] - mat[r,j]*p + ENDFOR + ENDIF + ENDFOR + lnPivot = lnPivot + 1 +ENDFOR +RETURN llResult +ENDFUNC + +PROCEDURE ASwapRows(arr, tnRow1 As Integer, tnRow2 As Integer) +*!* Interchange rows tnRow1 and tnRow2 of array arr. +LOCAL n As Integer +n = ALEN(arr,2) +LOCAL ARRAY tmp[1,n] +STORE 0 TO tmp +ACPY2(@arr, @tmp, tnRow1, 1) +ACPY2(@arr, @arr, tnRow2, tnRow1) +ACPY2(@tmp, @arr, 1, tnRow2) +ENDPROC + +PROCEDURE ACPY2(m1, m2, tnSrcRow As Integer, tnDestRow As Integer) +*!* Copy m1[tnSrcRow,*] to m2[tnDestRow,*] +*!* m1 and m2 must have the same number of columns. +LOCAL n As Integer, e1 As Integer, e2 As Integer +n = ALEN(m1,2) +e1 = AELEMENT(m1,tnSrcRow,1) +e2 = AELEMENT(m2,tnDestRow,1) +ACOPY(m1, m2, e1, n, e2) +ENDPROC diff --git a/Task/Regular-expressions/8th/regular-expressions.8th b/Task/Regular-expressions/8th/regular-expressions.8th new file mode 100644 index 0000000000..080e48b380 --- /dev/null +++ b/Task/Regular-expressions/8th/regular-expressions.8th @@ -0,0 +1,2 @@ +"haystack" /a./ r:match . cr +"haystack" /a./ "blah" s:replace! . cr diff --git a/Task/Regular-expressions/Lasso/regular-expressions.lasso b/Task/Regular-expressions/Lasso/regular-expressions.lasso new file mode 100644 index 0000000000..57fafba9f0 --- /dev/null +++ b/Task/Regular-expressions/Lasso/regular-expressions.lasso @@ -0,0 +1,22 @@ +local(mytext = 'My name is: Stone, Rosetta +My name is: Hippo, Campus +') + +local(regexp = regexp( + -find = `(?m)^My name is: (.*?), (.*?)$`, + -input = #mytext, + -replace = `Hello! I am $2 $1`, + -ignorecase +)) + + +while(#regexp -> find) => {^ + #regexp -> groupcount > 1 ? (#regexp -> matchString(2) -> trim&) + '
' +^} + +#regexp -> reset(-input = #mytext) +#regexp -> findall + +#regexp -> reset(-input = #mytext) +'
' +#regexp -> replaceall diff --git a/Task/Regular-expressions/Nim/regular-expressions.nim b/Task/Regular-expressions/Nim/regular-expressions.nim new file mode 100644 index 0000000000..58c6edc987 --- /dev/null +++ b/Task/Regular-expressions/Nim/regular-expressions.nim @@ -0,0 +1,9 @@ +import re + +var s = "This is a string" + +if s.find(re"string$") > -1: + echo "Ends with string." + +s = s.replace(re"\ a\ ", " another ") +echo s diff --git a/Task/Regular-expressions/Sidef/regular-expressions-1.sidef b/Task/Regular-expressions/Sidef/regular-expressions-1.sidef new file mode 100644 index 0000000000..1d0ac027c0 --- /dev/null +++ b/Task/Regular-expressions/Sidef/regular-expressions-1.sidef @@ -0,0 +1,4 @@ +var str = "I am a string"; +if (str =~ /string$/) { + print "Ends with 'string'\n"; +} diff --git a/Task/Regular-expressions/Sidef/regular-expressions-2.sidef b/Task/Regular-expressions/Sidef/regular-expressions-2.sidef new file mode 100644 index 0000000000..820672ee55 --- /dev/null +++ b/Task/Regular-expressions/Sidef/regular-expressions-2.sidef @@ -0,0 +1,8 @@ +var str = <<'EOF'; + x:Foo + y:Bar +EOF + +while (var m = str=~/(\w+):(\S+)/g) { + say "#{m[0]} -> #{m[1]}"; +} diff --git a/Task/Regular-expressions/Sidef/regular-expressions-3.sidef b/Task/Regular-expressions/Sidef/regular-expressions-3.sidef new file mode 100644 index 0000000000..b02a109619 --- /dev/null +++ b/Task/Regular-expressions/Sidef/regular-expressions-3.sidef @@ -0,0 +1,12 @@ +var str = "I am a string"; + +# Substitute something mached by a regex +str.sub!(/ a /, ' another '); # "I am a string" => "I am another string" + +# Remove something matched by a regex +str -= / \Kanother /i; # "I am another string" => "I am string" + +# Global subtitution with a block +str = str.gsub(/(\w+)/, {|s1| 'x' * s1.len}); # globaly replace any word with 'xxx' + +say str; # prints: 'x xx xxxxxx' diff --git a/Task/Regular-expressions/Swift/regular-expressions-1.swift b/Task/Regular-expressions/Swift/regular-expressions-1.swift new file mode 100644 index 0000000000..0e99675e49 --- /dev/null +++ b/Task/Regular-expressions/Swift/regular-expressions-1.swift @@ -0,0 +1,6 @@ +import Foundation + +let str = "I am a string" +if let range = str.rangeOfString("string$", options: .RegularExpressionSearch) { + println("Ends with 'string'") +} diff --git a/Task/Regular-expressions/Swift/regular-expressions-2.swift b/Task/Regular-expressions/Swift/regular-expressions-2.swift new file mode 100644 index 0000000000..3fc9a9b8cc --- /dev/null +++ b/Task/Regular-expressions/Swift/regular-expressions-2.swift @@ -0,0 +1,5 @@ +import Foundation + +let orig = "I am the original string" +let result = orig.stringByReplacingOccurrencesOfString("original", withString: "modified", options: .RegularExpressionSearch) +println(result) diff --git a/Task/Regular-expressions/Swift/regular-expressions-3.swift b/Task/Regular-expressions/Swift/regular-expressions-3.swift new file mode 100644 index 0000000000..bf79e06ce3 --- /dev/null +++ b/Task/Regular-expressions/Swift/regular-expressions-3.swift @@ -0,0 +1,8 @@ +import Foundation + +if let regex = NSRegularExpression(pattern: "string$", options: nil, error: nil) { + let str = "I am a string" + if let result = regex.firstMatchInString(str, options: nil, range: NSRange(location: 0, length: count(str.utf16))) { + println("Ends with 'string'") + } +} diff --git a/Task/Regular-expressions/Swift/regular-expressions-4.swift b/Task/Regular-expressions/Swift/regular-expressions-4.swift new file mode 100644 index 0000000000..600fafe532 --- /dev/null +++ b/Task/Regular-expressions/Swift/regular-expressions-4.swift @@ -0,0 +1,5 @@ + for x in regex.matchesInString(str, options: nil, range: NSRange(location: 0, length: count(str.utf16))) { + let match = x as! NSTextCheckingResult + // match.range gives the range of the whole match + // match.rangeAtIndex(i) gives the range of the i'th capture group (starting from 1) + } diff --git a/Task/Regular-expressions/Swift/regular-expressions-5.swift b/Task/Regular-expressions/Swift/regular-expressions-5.swift new file mode 100644 index 0000000000..e298b4bcb0 --- /dev/null +++ b/Task/Regular-expressions/Swift/regular-expressions-5.swift @@ -0,0 +1,7 @@ +import Foundation + +let orig = "I am the original string" +if let regex = NSRegularExpression(pattern: "original", options: nil, error: nil) { +let result = regex.stringByReplacingMatchesInString(orig, options: nil, range: NSRange(location: 0, length: count(orig.utf16)), withTemplate: "modified") + println(result) +} diff --git a/Task/Regular-expressions/jq/regular-expressions-1.jq b/Task/Regular-expressions/jq/regular-expressions-1.jq new file mode 100644 index 0000000000..13d52de84a --- /dev/null +++ b/Task/Regular-expressions/jq/regular-expressions-1.jq @@ -0,0 +1 @@ +"I am a string" | test("string$") diff --git a/Task/Regular-expressions/jq/regular-expressions-2.jq b/Task/Regular-expressions/jq/regular-expressions-2.jq new file mode 100644 index 0000000000..277a6ea7d1 --- /dev/null +++ b/Task/Regular-expressions/jq/regular-expressions-2.jq @@ -0,0 +1 @@ +"I am a string" | sub(" a "; " another ") diff --git a/Task/Regular-expressions/jq/regular-expressions-3.jq b/Task/Regular-expressions/jq/regular-expressions-3.jq new file mode 100644 index 0000000000..10af188bb2 --- /dev/null +++ b/Task/Regular-expressions/jq/regular-expressions-3.jq @@ -0,0 +1 @@ +"abc" | sub( "(?^.)(?.*)"; "\(.head)-\(.tail)") diff --git a/Task/Remove-duplicate-elements/CafeOBJ/remove-duplicate-elements.cafeobj b/Task/Remove-duplicate-elements/CafeOBJ/remove-duplicate-elements.cafeobj new file mode 100644 index 0000000000..f2514875f1 --- /dev/null +++ b/Task/Remove-duplicate-elements/CafeOBJ/remove-duplicate-elements.cafeobj @@ -0,0 +1,21 @@ +-- The parametrized module NO-DUP-LIST(ELEMENTS :: TRIV) defines the signature of simple Haskell like list structure. +-- The removal of duplicates is handled by the equational properties listed after the signature in brackets {} +-- The binary operation _,_ is associative, commutative, and idempotent. +-- This list structure does not permit duplicates, they are removed during evaluation (called reduction in CafeOBJ) +-- Actual code is contained in module called NO-DUP-LIST. +-- The tests are performed after opening instantiated NO-DUP-LIST with various concrete types. +-- For further details see: http://www.ldl.jaist.ac.jp/cafeobj/ +mod! NO-DUP-LIST(ELEMENTS :: TRIV) { + [ List < Elem < Elt] -- Sorts in Ordered Sorted Algebra + op [] : -> List { prec: 0 } -- Empty List + op _,_ : Elt Elt -> Elt { comm assoc idem prec: 80 l-assoc } + op [_] : Elt -> List { prec: 0 } +} + +-- Test on lists of INT, CHARACTER, and STRING +open NO-DUP-LIST(INT) +reduce [ 1 , 2 , 1 , 1 ] . -- Gives [ 1 , 2 ] +open NO-DUP-LIST(CHARACTER) +reduce [ 'a' , 'b' , 'a' , 'a' ] . -- Gives [ 'a' , 'b' ] +open NO-DUP-LIST(STRING) +reduce [ "abc" , "def" , "abc" ] . -- Gives [ "def" , "abc" ] diff --git a/Task/Remove-duplicate-elements/Ceylon/remove-duplicate-elements.ceylon b/Task/Remove-duplicate-elements/Ceylon/remove-duplicate-elements.ceylon new file mode 100644 index 0000000000..6154b757bf --- /dev/null +++ b/Task/Remove-duplicate-elements/Ceylon/remove-duplicate-elements.ceylon @@ -0,0 +1,2 @@ +[] data = [1, 2, 3, "a", "b", "c", 2, 3, 4, "b", "c", "d"]; +[] unique = HashSet { *data }.sequence(); diff --git a/Task/Remove-duplicate-elements/ECL/remove-duplicate-elements.ecl b/Task/Remove-duplicate-elements/ECL/remove-duplicate-elements.ecl new file mode 100644 index 0000000000..da4460a969 --- /dev/null +++ b/Task/Remove-duplicate-elements/ECL/remove-duplicate-elements.ecl @@ -0,0 +1,2 @@ +inNumbers := DATASET([{1},{2},{3},{4},{1},{1},{7},{8},{9},{9},{0},{0},{3},{3},{3},{3},{3}], {INTEGER Field1}); +DEDUP(SORT(inNumbers,Field1)); diff --git a/Task/Remove-duplicate-elements/FreeBASIC/remove-duplicate-elements.freebasic b/Task/Remove-duplicate-elements/FreeBASIC/remove-duplicate-elements.freebasic new file mode 100644 index 0000000000..145f1709f7 --- /dev/null +++ b/Task/Remove-duplicate-elements/FreeBASIC/remove-duplicate-elements.freebasic @@ -0,0 +1,39 @@ +' FB 1.05.0 Win64 + +Sub removeDuplicates(a() As Integer, b() As Integer) + Dim lb As Integer = LBound(a) + Dim ub As Integer = UBound(a) + If ub = -1 Then Return '' empty array + Redim b(lb To ub) + b(lb) = a(lb) + Dim count As Integer = 1 + Dim unique As Boolean + + For i As Integer = lb + 1 To ub + unique = True + For j As Integer = lb to i - 1 + If a(i) = a(j) Then + unique = False + Exit For + End If + Next j + If unique Then + b(lb + count) = a(i) + count += 1 + End If + Next i + + If count > 0 Then Redim Preserve b(lb To lb + count - 1) +End Sub + +Dim a(1 To 10) As Integer = {1, 2, 1, 4, 5, 2, 15, 1, 3, 4} +Dim b() As Integer +removeDuplicates a(), b() + +For i As Integer = LBound(b) To UBound(b) + Print b(i); " "; +Next + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Remove-duplicate-elements/Lasso/remove-duplicate-elements.lasso b/Task/Remove-duplicate-elements/Lasso/remove-duplicate-elements.lasso new file mode 100644 index 0000000000..6dd9a4c942 --- /dev/null +++ b/Task/Remove-duplicate-elements/Lasso/remove-duplicate-elements.lasso @@ -0,0 +1,6 @@ +local( + x = array(3,4,8,1,8,1,4,5,6,8,9,6), + y = array +) +with n in #x where #y !>> #n do => { #y->insert(#n) } +// result: array(3, 4, 8, 1, 5, 6, 9) diff --git a/Task/Remove-duplicate-elements/Nim/remove-duplicate-elements.nim b/Task/Remove-duplicate-elements/Nim/remove-duplicate-elements.nim new file mode 100644 index 0000000000..5eb0286388 --- /dev/null +++ b/Task/Remove-duplicate-elements/Nim/remove-duplicate-elements.nim @@ -0,0 +1,24 @@ +import sequtils, algorithm, intsets + +# Go through the list, and for each element, check the rest of the list to see +# if it appears again, +var items = @[1, 2, 3, 2, 3, 4, 5, 6, 7] +echo deduplicate(items) # O(n^2) + +proc filterDup(xs): seq[int] = + result = @[xs[0]] + var last = xs[0] + for x in xs[1..xs.high]: + if x != last: + result.add(x) + last = x + +# Put the elements into a hash table which does not allow duplicates. +var s = initIntSet() +for x in items: + s.incl(x) +echo s + +# Sort the elements and remove consecutive duplicate elements. +sort(items, system.cmp[int]) # O(n log n) +echo filterDup(items) # O(n) diff --git a/Task/Remove-duplicate-elements/Phix/remove-duplicate-elements.phix b/Task/Remove-duplicate-elements/Phix/remove-duplicate-elements.phix new file mode 100644 index 0000000000..42addfc8e1 --- /dev/null +++ b/Task/Remove-duplicate-elements/Phix/remove-duplicate-elements.phix @@ -0,0 +1,44 @@ +sequence test + +function alpha(integer i, integer j) +integer res + res = compare(test[i],test[j]) + if res=0 then + res = compare(i,j) + end if + return res +end function + +function unique(sequence s) +sequence at, valid = repeat(1,length(s)) +object last, this +integer ai, nxt + + test = s + at = custom_sort(routine_id("alpha"),tagset(length(test))) + last = test[at[1]] + for i=2 to length(at) do + ai = at[i] + this = test[ai] + valid[ai] = last!=this + last = this + end for + + nxt = find(0,valid) + if nxt then + for i=nxt+1 to length(test) do + if valid[i] then + test[nxt] = test[i] + nxt += 1 + end if + end for + test = test[1..nxt-1] + end if + return test +end function + +?join(unique(split("Now is the time for all good men to come to the aid of the party."))) +?unique({1, 2, 1, 4, 5, 2, 15, 1, 3, 4}) +?unique({1, 2, 3, "a", "b", "c", 2, 3, 4, "b", "c", "d"}) +?unique({1,3,2,9,1,2,3,8,8,1,0,2}) +?unique("chthonic eleemosynary paronomasiac") diff --git a/Task/Remove-duplicate-elements/Ring/remove-duplicate-elements.ring b/Task/Remove-duplicate-elements/Ring/remove-duplicate-elements.ring new file mode 100644 index 0000000000..2a4dafa74e --- /dev/null +++ b/Task/Remove-duplicate-elements/Ring/remove-duplicate-elements.ring @@ -0,0 +1,11 @@ +list = ["Now", "is", "the", "time", "for", "all", "good", "men", "to", "come", "to", "the", "aid", "of", "the", "party."] +for i = 1 to len(list) + for j = i + 1 to len(list) + if list[i] = list[j] del(list, j) j-- ok + next +next + +for n = 1 to len(list) + see list[n] + " " +next +see nl diff --git a/Task/Remove-duplicate-elements/Sidef/remove-duplicate-elements.sidef b/Task/Remove-duplicate-elements/Sidef/remove-duplicate-elements.sidef new file mode 100644 index 0000000000..1e1556f192 --- /dev/null +++ b/Task/Remove-duplicate-elements/Sidef/remove-duplicate-elements.sidef @@ -0,0 +1,3 @@ +var ary = [1,1,2,1,'redundant',[1,2,3],[1,2,3],'redundant']; +say ary.uniq.dump; +say ary.last_uniq.dump; diff --git a/Task/Remove-duplicate-elements/Sparkling/remove-duplicate-elements.sparkling b/Task/Remove-duplicate-elements/Sparkling/remove-duplicate-elements.sparkling new file mode 100644 index 0000000000..528cf01f6d --- /dev/null +++ b/Task/Remove-duplicate-elements/Sparkling/remove-duplicate-elements.sparkling @@ -0,0 +1,13 @@ +function undupe(arr) { + var t = {}; + foreach(arr, function(key, val) { + t[val] = true; + }); + + var r = {}; + foreach(t, function(key) { + r[sizeof r] = key; + }); + + return r; +} diff --git a/Task/Remove-duplicate-elements/Swift/remove-duplicate-elements-1.swift b/Task/Remove-duplicate-elements/Swift/remove-duplicate-elements-1.swift new file mode 100644 index 0000000000..3cba62223a --- /dev/null +++ b/Task/Remove-duplicate-elements/Swift/remove-duplicate-elements-1.swift @@ -0,0 +1 @@ +println(Array(Set([3,2,1,2,3,4]))) diff --git a/Task/Remove-duplicate-elements/Swift/remove-duplicate-elements-2.swift b/Task/Remove-duplicate-elements/Swift/remove-duplicate-elements-2.swift new file mode 100644 index 0000000000..2f96558f5c --- /dev/null +++ b/Task/Remove-duplicate-elements/Swift/remove-duplicate-elements-2.swift @@ -0,0 +1,10 @@ +func uniq(lst: [T]) -> [T] { + var seen = Set(minimumCapacity: lst.count) + return lst.filter { x in + let unseen = !seen.contains(x) + seen.insert(x) + return unseen + } +} + +println(uniq([3,2,1,2,3,4])) diff --git a/Task/Remove-duplicate-elements/Swift/remove-duplicate-elements-3.swift b/Task/Remove-duplicate-elements/Swift/remove-duplicate-elements-3.swift new file mode 100644 index 0000000000..1f54c0ed0d --- /dev/null +++ b/Task/Remove-duplicate-elements/Swift/remove-duplicate-elements-3.swift @@ -0,0 +1,12 @@ +func uniq(lst: [T]) -> [T] { + var seen = [T]() + return lst.filter { x in + let unseen = find(seen, x) == nil + if (unseen) { + seen.append(x) + } + return unseen + } +} + +println(uniq([3,2,1,2,3,4])) diff --git a/Task/Remove-duplicate-elements/Visual-FoxPro/remove-duplicate-elements.visual b/Task/Remove-duplicate-elements/Visual-FoxPro/remove-duplicate-elements.visual new file mode 100644 index 0000000000..3250adcd83 --- /dev/null +++ b/Task/Remove-duplicate-elements/Visual-FoxPro/remove-duplicate-elements.visual @@ -0,0 +1,24 @@ +LOCAL i As Integer, n As Integer, lcOut As String +CLOSE DATABASES ALL +CLEAR +CREATE CURSOR nums (num I) +INDEX ON num TAG num COLLATE "Machine" +SET ORDER TO 0 +n = 50 +RAND(-1) +FOR i = 1 TO n + INSERT INTO nums VALUES (RanInt(1, 10)) +ENDFOR +SELECT num, COUNT(num) As cnt FROM nums ; +GROUP BY num INTO CURSOR grouped +LIST OFF TO FILE grouped.txt NOCONSOLE +lcOut = "" +SCAN + lcOut = lcOut + TRANSFORM(num) + "," +ENDSCAN +lcOut = LEFT(lcOut, LEN(lcOut)-1) +? lcOut + +FUNCTION RanInt(tnLow As Integer, tnHigh As Integer) As Integer +RETURN INT((tnHigh - tnLow + 1)*RAND() + tnLow) +ENDFUNC diff --git a/Task/Remove-duplicate-elements/Wart/remove-duplicate-elements.wart b/Task/Remove-duplicate-elements/Wart/remove-duplicate-elements.wart new file mode 100644 index 0000000000..5e790b6fae --- /dev/null +++ b/Task/Remove-duplicate-elements/Wart/remove-duplicate-elements.wart @@ -0,0 +1,6 @@ +def (dedup l) + let exists (table) + collect+each x l + unless exists.x + yield x + exists.x <- 1 diff --git a/Task/Remove-duplicate-elements/Wortel/remove-duplicate-elements.wortel b/Task/Remove-duplicate-elements/Wortel/remove-duplicate-elements.wortel new file mode 100644 index 0000000000..42d918dd7a --- /dev/null +++ b/Task/Remove-duplicate-elements/Wortel/remove-duplicate-elements.wortel @@ -0,0 +1 @@ +@uniq [1 2 3 2 1 2 3] ; returns [1 2 3] diff --git a/Task/Remove-duplicate-elements/jq/remove-duplicate-elements-1.jq b/Task/Remove-duplicate-elements/jq/remove-duplicate-elements-1.jq new file mode 100644 index 0000000000..f0ecdcdb8a --- /dev/null +++ b/Task/Remove-duplicate-elements/jq/remove-duplicate-elements-1.jq @@ -0,0 +1 @@ +[4,3,2,1,1,2,3,4] | unique diff --git a/Task/Remove-duplicate-elements/jq/remove-duplicate-elements-2.jq b/Task/Remove-duplicate-elements/jq/remove-duplicate-elements-2.jq new file mode 100644 index 0000000000..1903e30b4e --- /dev/null +++ b/Task/Remove-duplicate-elements/jq/remove-duplicate-elements-2.jq @@ -0,0 +1,24 @@ +def removeAllButFirst: + + # The hash table functions all expect the hash table to be the input. + + # Is x in the hash table? + def hashed(x): + (x|tostring) as $value + | .[$value] as $bucket + | $bucket and (.[$value] | index([x])); + + # Add x to the hash table: + def add_hash(x): + (x|tostring) as $value + | .[$value] as $bucket + | if $bucket and ($bucket | index([x])) then . + else .[$value] += [x] + end; + + reduce .[] as $item + ( [[], {}]; # [array, hash] + if .[1] | hashed($item) then . + else [ (.[0] + [$item]), (.[1] | add_hash($item)) ] + end) + | .[0]; diff --git a/Task/Remove-lines-from-a-file/ECL/remove-lines-from-a-file-1.ecl b/Task/Remove-lines-from-a-file/ECL/remove-lines-from-a-file-1.ecl new file mode 100644 index 0000000000..b516e43ea5 --- /dev/null +++ b/Task/Remove-lines-from-a-file/ECL/remove-lines-from-a-file-1.ecl @@ -0,0 +1,8 @@ +IMPORT STD; +RemoveLines(logicalfile, startline, numlines) := FUNCTIONMACRO + EndLine := startline + numlines - 1; + RecCnt := COUNT(logicalfile); + Res := logicalfile[1..startline-1] + logicalfile[endline+1..]; + RETURN WHEN(IF(RecCnt < EndLine,logicalfile,Res), + IF(RecCnt < EndLine,STD.System.Log.addWorkunitWarning('Attempted removal past end of file-removal ignored'))); +ENDMACRO; diff --git a/Task/Remove-lines-from-a-file/ECL/remove-lines-from-a-file-2.ecl b/Task/Remove-lines-from-a-file/ECL/remove-lines-from-a-file-2.ecl new file mode 100644 index 0000000000..2525c19823 --- /dev/null +++ b/Task/Remove-lines-from-a-file/ECL/remove-lines-from-a-file-2.ecl @@ -0,0 +1,2 @@ +MyFile := DATASET(100,TRANSFORM({UNSIGNED1 RecID},SELF.RecID := COUNTER)); +RemoveLines(MyFile,3,10); diff --git a/Task/Remove-lines-from-a-file/FreeBASIC/remove-lines-from-a-file.freebasic b/Task/Remove-lines-from-a-file/FreeBASIC/remove-lines-from-a-file.freebasic new file mode 100644 index 0000000000..84ff091e22 --- /dev/null +++ b/Task/Remove-lines-from-a-file/FreeBASIC/remove-lines-from-a-file.freebasic @@ -0,0 +1,51 @@ +' FB 1.05.0 Win64 + +Sub removeLines(fileName As String, startLine As UInteger, numLines As UInteger) + If startLine = 0 Then + Print "Starting line must be more than zero" + Return + End If + If numLines = 0 Then + Print "No lines to remove" + Return + End If + Dim fileNum As Integer = FreeFile + Open fileName For Input As #fileNum + If err > 0 Then + Print "File could not be opened" + Return + End If + Dim tempFileName As String = "temp_" + fileName + Dim fileNum2 As Integer = FreeFile + Open tempFileName For Output As #fileNum2 + Dim count As Integer = 0 + Dim ln As String + Dim endLine As UInteger = startLine + numLines - 1 + While Not Eof(fileNum) + Input #fileNum, ln + count += 1 + If count >= startLine AndAlso count <= endLine Then Continue While + Print #fileNum2, ln + Wend + + If count < startLine Then + Print "No lines were removed as starting line was beyond end of file" + Print + ElseIf count < endLine Then + Print "Only "; count - startLine + 1; " line(s) were removed as not enough lines to remove more" + Print + Else + Print Str(numLines); " line(s) were removed" + Print + End If + Close #fileNum : Close #fileNum2 + Kill(fileName) + Name (tempFileName, fileName) +End Sub + +removeLines("foobar.txt", 2, 2) +removeLines("foobar.txt", 5, 2) +removeLines("foobar.txt", 3, 4) +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Remove-lines-from-a-file/Lasso/remove-lines-from-a-file-1.lasso b/Task/Remove-lines-from-a-file/Lasso/remove-lines-from-a-file-1.lasso new file mode 100644 index 0000000000..9842c6623d --- /dev/null +++ b/Task/Remove-lines-from-a-file/Lasso/remove-lines-from-a-file-1.lasso @@ -0,0 +1,22 @@ +#!/usr/bin/lasso9 + +local( + orgfilename = $argv -> second, + file = file(#orgfilename), + regexp = regexp(-find = `(?m)$`), + content = #regexp -> split(-input = #file -> readstring) -> asarray, + start = integer($argv -> get(3) || 1), + range = integer($argv -> get(4) || 1) +) +stdout(#content) +#file -> copyto(#orgfilename + '.org') + +fail_if(#content -> size < (#start + #range), -1, 'Not that many rows in the file') + +#content -> remove(#start, #range) + +#file = file(#orgfilename) +#file -> opentruncate +#file -> dowithclose => { + #file -> writestring(#content -> join('')) +} diff --git a/Task/Remove-lines-from-a-file/Lasso/remove-lines-from-a-file-2.lasso b/Task/Remove-lines-from-a-file/Lasso/remove-lines-from-a-file-2.lasso new file mode 100644 index 0000000000..8f5d8e0d80 --- /dev/null +++ b/Task/Remove-lines-from-a-file/Lasso/remove-lines-from-a-file-2.lasso @@ -0,0 +1 @@ +./removelines textfile.txt 2 2 diff --git a/Task/Remove-lines-from-a-file/Oforth/remove-lines-from-a-file.oforth b/Task/Remove-lines-from-a-file/Oforth/remove-lines-from-a-file.oforth new file mode 100644 index 0000000000..82ab564936 --- /dev/null +++ b/Task/Remove-lines-from-a-file/Oforth/remove-lines-from-a-file.oforth @@ -0,0 +1,12 @@ +: removeLines(filename, startLine, numLines) +| line b endLine | + ListBuffer new ->b + startLine numLines + 1 - ->endLine + + 0 File new(filename) forEach: line [ + 1+ dup between(startLine, endLine) ifFalse: [ b add(line) continue ] + numLines 1- ->numLines + ] + drop numLines 0 == ifFalse: [ "Error : Removing lines beyond end of file" println return ] + + File new(filename) dup open(File.WRITE) b apply(#[ << dup cr ]) close ; diff --git a/Task/Remove-lines-from-a-file/Ring/remove-lines-from-a-file.ring b/Task/Remove-lines-from-a-file/Ring/remove-lines-from-a-file.ring new file mode 100644 index 0000000000..7e0bcfe04a --- /dev/null +++ b/Task/Remove-lines-from-a-file/Ring/remove-lines-from-a-file.ring @@ -0,0 +1,13 @@ +cStr = read("C:\Ring\bin\filename.txt") +aList = str2list(cStr) +see aList + nl +lineStart = 3 +lineCount = 5 +num = -1 +for n = lineStart to lineStart+lineCount-1 + num += 1 + del(aList,n-num) +next +cStr = list2str(aList) +see cStr + nl +write("C:\Ring\bin\filename.txt",cStr) diff --git a/Task/Remove-lines-from-a-file/Sidef/remove-lines-from-a-file.sidef b/Task/Remove-lines-from-a-file/Sidef/remove-lines-from-a-file.sidef new file mode 100644 index 0000000000..0f5ed39ffc --- /dev/null +++ b/Task/Remove-lines-from-a-file/Sidef/remove-lines-from-a-file.sidef @@ -0,0 +1,7 @@ +func remove_lines(file, beg, len) { + var lines = file.open_r.lines; + lines.splice(beg, len).len == len || warn "Too few lines"; + file.open_w.print(lines.join) +} + +remove_lines(File(__FILE__), 2, 3); diff --git a/Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-1.jq b/Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-1.jq new file mode 100644 index 0000000000..c98065ca8b --- /dev/null +++ b/Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-1.jq @@ -0,0 +1 @@ +jq -s -R -r --arg start START --arg number NUMBER -f remove.jq INFILE diff --git a/Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-2.jq b/Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-2.jq new file mode 100644 index 0000000000..26922e2f6c --- /dev/null +++ b/Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-2.jq @@ -0,0 +1,15 @@ +# Counting the first line in the file as line 1, +# attempt to remove "number" lines from line number "start" onwards: +def remove_lines(start; number): + (start+number - 1) as $max + | reduce split("\n")[] as $line + ( [0, []]; + .[0] += 1 + | .[0] as $i + | if start <= $i and $i <= $max then . else .[1] += [$line] end) + | .[0] as $count + | .[1] + | join("\n") + | (if $count < $max then "WARNING: there are only \($count) lines" else empty end), .; + +remove_lines($start|tonumber; $number|tonumber) diff --git a/Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-3.jq b/Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-3.jq new file mode 100644 index 0000000000..d5c23fa4f6 --- /dev/null +++ b/Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-3.jq @@ -0,0 +1 @@ +jq -n -R -r --arg start 1 --arg number 2 -f Remove_lines_from_a_file.jq input.txt diff --git a/Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-4.jq b/Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-4.jq new file mode 100644 index 0000000000..09b7bd4467 --- /dev/null +++ b/Task/Remove-lines-from-a-file/jq/remove-lines-from-a-file-4.jq @@ -0,0 +1,15 @@ +# Counting the first line in the file as line 1, attempt to remove "number" lines from line +# number "start" onwards: +def remove_lines_streaming(start; number): + (start+number - 1) as $max + # In the following line, null will serve to signal EOF so that the warning can be emitted. + | foreach (inputs,null) as $line + ( 0; + . += 1; + if $line == null then # EOF + if . <= $max then "WARNING: there were only \(.) lines" else empty end + elif start <= . and . <= $max then empty + else $line + end) ; + +remove_lines_streaming($start|tonumber; $number|tonumber) diff --git a/Task/Rename-a-file/FreeBASIC/rename-a-file.freebasic b/Task/Rename-a-file/FreeBASIC/rename-a-file.freebasic new file mode 100644 index 0000000000..2562e4830a --- /dev/null +++ b/Task/Rename-a-file/FreeBASIC/rename-a-file.freebasic @@ -0,0 +1,14 @@ +' FB 1.05.0 Win64 + +Dim result As Long +result = Name("input.txt", "output.txt") +If result <> 0 Then + Print "Renaming file failed" +End If + +result = Name("docs", "mydocs") +If result <> 0 Then + Print "Renaming directory failed" +End If + +Sleep diff --git a/Task/Rename-a-file/Harbour/rename-a-file.harbour b/Task/Rename-a-file/Harbour/rename-a-file.harbour new file mode 100644 index 0000000000..a0a8207a3d --- /dev/null +++ b/Task/Rename-a-file/Harbour/rename-a-file.harbour @@ -0,0 +1,5 @@ +FRename( "input.txt","output.txt") +// or +RENAME input.txt TO output.txt + +FRename( hb_ps() + "input.txt", hb_ps() + "output.txt") diff --git a/Task/Rename-a-file/LFE/rename-a-file.lfe b/Task/Rename-a-file/LFE/rename-a-file.lfe new file mode 100644 index 0000000000..1c8de810a0 --- /dev/null +++ b/Task/Rename-a-file/LFE/rename-a-file.lfe @@ -0,0 +1,4 @@ +(file:rename "input.txt" "output.txt") +(file:rename "docs" "mydocs") +(file:rename "/input.txt" "/output.txt") +(file:rename "/docs" "/mydocs") diff --git a/Task/Rename-a-file/Lasso/rename-a-file.lasso b/Task/Rename-a-file/Lasso/rename-a-file.lasso new file mode 100644 index 0000000000..8a29cb611a --- /dev/null +++ b/Task/Rename-a-file/Lasso/rename-a-file.lasso @@ -0,0 +1,17 @@ +// move file +local(f = file('input.txt')) +#f->moveTo('output.txt') +#f->close + +// move directory, just like a file +local(d = dir('docs')) +#d->moveTo('mydocs') + +// move file in root file system (requires permissions at user OS level) +local(f = file('//input.txt')) +#f->moveTo('//output.txt') +#f->close + +// move directory in root file system (requires permissions at user OS level) +local(d = file('//docs')) +#d->moveTo('//mydocs') diff --git a/Task/Rename-a-file/LiveCode/rename-a-file.livecode b/Task/Rename-a-file/LiveCode/rename-a-file.livecode new file mode 100644 index 0000000000..58cbe2b4a8 --- /dev/null +++ b/Task/Rename-a-file/LiveCode/rename-a-file.livecode @@ -0,0 +1,4 @@ +rename file "input.txt" to "output.txt" +rename folder "docs" to "mydocs" +rename file "/input.txt" to "/output.txt" +rename folder "/docs" to "/mydocs" diff --git a/Task/Rename-a-file/Nim/rename-a-file.nim b/Task/Rename-a-file/Nim/rename-a-file.nim new file mode 100644 index 0000000000..6709a43f20 --- /dev/null +++ b/Task/Rename-a-file/Nim/rename-a-file.nim @@ -0,0 +1,7 @@ +import os + +moveFile("input.txt", "output.txt") +moveFile("docs", "mydocs") + +moveFile(DirSep & "input.txt", DirSep & "output.txt") +moveFile(DirSep & "docs", DirSep & "mydocs") diff --git a/Task/Rename-a-file/Ring/rename-a-file.ring b/Task/Rename-a-file/Ring/rename-a-file.ring new file mode 100644 index 0000000000..eff33e764a --- /dev/null +++ b/Task/Rename-a-file/Ring/rename-a-file.ring @@ -0,0 +1,4 @@ + rename("input.txt", "output.txt") + rename("docs", "mydocs") + rename("/input.txt", "/output.txt") + rename("/docs", "/mydocs") diff --git a/Task/Rename-a-file/Sidef/rename-a-file.sidef b/Task/Rename-a-file/Sidef/rename-a-file.sidef new file mode 100644 index 0000000000..686014a964 --- /dev/null +++ b/Task/Rename-a-file/Sidef/rename-a-file.sidef @@ -0,0 +1,7 @@ +# Here +File.rename('input.txt', 'output.txt'); +File.rename('docs', 'mydocs'); + +# Root dir +File.rename(Dir.root + %f'input.txt', Dir.root + %f'output.txt'); +File.rename(Dir.root + %f'docs', Dir.root + %f'mydocs'); diff --git a/Task/Rep-string/EchoLisp/rep-string-1.echolisp b/Task/Rep-string/EchoLisp/rep-string-1.echolisp new file mode 100644 index 0000000000..8387424b66 --- /dev/null +++ b/Task/Rep-string/EchoLisp/rep-string-1.echolisp @@ -0,0 +1,17 @@ +(lib 'list) ;; list-rotate + +;; a list is a rep-list if equal? to itself after a rotation of lam units +;; lam <= list length / 2 +;; truncate to a multiple of lam before rotating +;; try cycles in decreasing lam order (longest wins) + +(define (cyclic? cyclic) + (define len (length cyclic)) + (define trunc null) + + (if (> len 1) + (for ((lam (in-range (quotient len 2) 0 -1))) + (set! trunc (take cyclic (- len (modulo len lam)))) + #:break (equal? trunc (list-rotate trunc lam)) => (list->string (take cyclic lam)) + 'no-rep ) + 'too-short-no-rep)) diff --git a/Task/Rep-string/EchoLisp/rep-string-2.echolisp b/Task/Rep-string/EchoLisp/rep-string-2.echolisp new file mode 100644 index 0000000000..d23c8bd87e --- /dev/null +++ b/Task/Rep-string/EchoLisp/rep-string-2.echolisp @@ -0,0 +1,20 @@ +(define strings '["1001110011" "1110111011" "0010010010" "1010101010" + "1111111111" "0100101101" "0100100" "101" "11" "00" "1"]) + +(define (task strings) + (for-each (lambda (s) + (writeln s (cyclic? (string->list s)))) strings)) + +(task strings) + +"1001110011" "10011" +"1110111011" "1110" +"0010010010" "001" +"1010101010" "1010" +"1111111111" "11111" +"0100101101" no-rep +"0100100" "010" +"101" no-rep +"11" "1" +"00" "0" +"1" too-short-no-rep diff --git a/Task/Rep-string/LFE/rep-string-1.lfe b/Task/Rep-string/LFE/rep-string-1.lfe new file mode 100644 index 0000000000..3e7a57c29f --- /dev/null +++ b/Task/Rep-string/LFE/rep-string-1.lfe @@ -0,0 +1,13 @@ +(defun get-reps (text) + (lists:filtermap + (lambda (x) + (case (get-rep text (lists:split x text)) + ('() 'false) + (x `#(true ,x)))) + (lists:seq 1 (div (length text) 2)))) + +(defun get-rep + ((text `#(,head ,tail)) + (case (string:str text tail) + (1 head) + (_ '())))) diff --git a/Task/Rep-string/LFE/rep-string-2.lfe b/Task/Rep-string/LFE/rep-string-2.lfe new file mode 100644 index 0000000000..837b102b9f --- /dev/null +++ b/Task/Rep-string/LFE/rep-string-2.lfe @@ -0,0 +1,10 @@ +(defun report + ((`#(,text ())) + (io:format "~p has no repeating characters.~n" `(,text))) + ((`#(,text (,head . ,_))) + (io:format "~p repeats ~p every ~p character(s).~n" `(,text ,head ,(length head)))) + ((data) + (lists:map + #'report/1 + (lists:zip data (lists:map #'get-reps/1 data))) + 'ok)) diff --git a/Task/Rep-string/NGS/rep-string.ngs b/Task/Rep-string/NGS/rep-string.ngs new file mode 100644 index 0000000000..4d362190d9 --- /dev/null +++ b/Task/Rep-string/NGS/rep-string.ngs @@ -0,0 +1,22 @@ +tests = [ + '1001110011' + '1110111011' + '0010010010' + '1010101010' + '1111111111' + '0100101101' + '0100100' + '101' + '11' + '00' + '1' +] + +F is_repeated(s:Str) (s.len()/2..0).first(F(x) s.starts_with(s[x..null])) + +{ + tests.each(F(test) { + local r = is_repeated(test) + echo("${test} ${if r "has repetition of length ${r} (i.e. ${test[0..r]})" "is not a rep-string"}") + }) +} diff --git a/Task/Rep-string/Nim/rep-string.nim b/Task/Rep-string/Nim/rep-string.nim new file mode 100644 index 0000000000..f4c5d30128 --- /dev/null +++ b/Task/Rep-string/Nim/rep-string.nim @@ -0,0 +1,22 @@ +import strutils + +proc isRepeated(text): int = + for x in countdown(text.len div 2, 0): + if text.startsWith(text[x..text.high]): return x + +const matchstr = """1001110011 +1110111011 +0010010010 +1010101010 +1111111111 +0100101101 +0100100 +101 +11 +00 +1""" + +for line in matchstr.split(): + let ln = isRepeated(line) + echo "'", line, "' has a repetition length of ", ln, " i.e ", + (if ln > 0: "'" & line[0 .. sz 2 / 1 -1 step: i [ + s left(sz i - ) s right(sz i -) == ifTrue: [ s left(i) return ] + ] + null ; diff --git a/Task/Rep-string/Sidef/rep-string.sidef b/Task/Rep-string/Sidef/rep-string.sidef new file mode 100644 index 0000000000..ef1d316b6e --- /dev/null +++ b/Task/Rep-string/Sidef/rep-string.sidef @@ -0,0 +1,15 @@ +var arr = <1001110011 1110111011 + 0010010010 1010101010 + 1111111111 0100101101 + 0100100 101 11 00 1>; +  + arr.each { |n| + if (var m = /^(.+)\1+(.*$)(?(?{ substr($1, 0, length $2) eq $2 })|(?!))/.match(n)) { + var i = m[0].len; + say (n.substr(0, i), + n.substr(i, i).tr('01', '𝟘𝟙'), + n.substr(i*2)); + } else { + say "#{n} (no repeat)"; + } +} diff --git a/Task/Rep-string/jq/rep-string-1.jq b/Task/Rep-string/jq/rep-string-1.jq new file mode 100644 index 0000000000..1b0e954ec6 --- /dev/null +++ b/Task/Rep-string/jq/rep-string-1.jq @@ -0,0 +1,20 @@ +def is_rep_string: + # if self is a rep-string then return [n, prefix] + # where n is the number of full occurrences of prefix + def _check(prefix; n; sofar): + length as $length + | if length <= (sofar|length) then [n, prefix] + else (sofar+prefix) as $sofar + | if startswith($sofar) then _check(prefix; n+1; $sofar) + elif ($sofar|length) > $length and + startswith($sofar[0:$length]) then [n, prefix] + else [0, prefix] + end + end + ; + + [range (1; length/2 + 1) as $i + | .[0:$i] as $prefix + | _check($prefix; 1; $prefix) + | select( .[0] > 1 ) ] + ; diff --git a/Task/Rep-string/jq/rep-string-2.jq b/Task/Rep-string/jq/rep-string-2.jq new file mode 100644 index 0000000000..c82347b94a --- /dev/null +++ b/Task/Rep-string/jq/rep-string-2.jq @@ -0,0 +1,17 @@ +def test: + ( + "1001110011", + "1110111011", + "0010010010", + "1010101010", + "1111111111", + "0100101101", + "0100100", + "101", + "11", + "00", + "1" + ) | { (.) : is_rep_string } +; + +test diff --git a/Task/Rep-string/jq/rep-string-3.jq b/Task/Rep-string/jq/rep-string-3.jq new file mode 100644 index 0000000000..44103723de --- /dev/null +++ b/Task/Rep-string/jq/rep-string-3.jq @@ -0,0 +1,12 @@ + $ jq -n -c -f rep-string.jq + {"1001110011":[[2,"10011"]]} + {"1110111011":[[2,"1110"]]} + {"0010010010":[[3,"001"]]} + {"1010101010":[[5,"10"],[2,"1010"]]} + {"1111111111":[[10,"1"],[5,"11"],[3,"111"],[2,"1111"],[2,"11111"]]} + {"0100101101":[]} + {"0100100":[[2,"010"]]} + {"101":[]} + {"11":[[2,"1"]]} + {"00":[[2,"0"]]} + {"1":[]} diff --git a/Task/Repeat-a-string/8th/repeat-a-string.8th b/Task/Repeat-a-string/8th/repeat-a-string.8th new file mode 100644 index 0000000000..39faaf1bb2 --- /dev/null +++ b/Task/Repeat-a-string/8th/repeat-a-string.8th @@ -0,0 +1,2 @@ +"ha" 5 s:* +. cr diff --git a/Task/Repeat-a-string/Ceylon/repeat-a-string.ceylon b/Task/Repeat-a-string/Ceylon/repeat-a-string.ceylon new file mode 100644 index 0000000000..1201a45d42 --- /dev/null +++ b/Task/Repeat-a-string/Ceylon/repeat-a-string.ceylon @@ -0,0 +1,3 @@ +shared void repeatAString() { + print("ha".repeat(5)); +} diff --git a/Task/Repeat-a-string/ECL/repeat-a-string-1.ecl b/Task/Repeat-a-string/ECL/repeat-a-string-1.ecl new file mode 100644 index 0000000000..8a2b0f8139 --- /dev/null +++ b/Task/Repeat-a-string/ECL/repeat-a-string-1.ecl @@ -0,0 +1,5 @@ +IMPORT STD; //Imports the Standard Library + +STRING MyBaseString := 'abc'; +RepeatedString := STD.Str.Repeat(MyBaseString,3); +RepeatedString; //returns 'abcabcabc' diff --git a/Task/Repeat-a-string/ECL/repeat-a-string-2.ecl b/Task/Repeat-a-string/ECL/repeat-a-string-2.ecl new file mode 100644 index 0000000000..da98251646 --- /dev/null +++ b/Task/Repeat-a-string/ECL/repeat-a-string-2.ecl @@ -0,0 +1,9 @@ +RepeatString(STRING InStr, INTEGER Cnt) := FUNCTION + rec := {STRING Str}; + ds := DATASET(Cnt,TRANSFORM(rec,SELF.Str := InStr)); + res := ITERATE(ds,TRANSFORM(rec,SELF.Str := LEFT.Str + RIGHT.Str)); + RETURN Res[Cnt].Str; +END; + +RepeatString('ha',3); +RepeatString('Who',2); diff --git a/Task/Repeat-a-string/ERRE/repeat-a-string.erre b/Task/Repeat-a-string/ERRE/repeat-a-string.erre new file mode 100644 index 0000000000..777f790ba7 --- /dev/null +++ b/Task/Repeat-a-string/ERRE/repeat-a-string.erre @@ -0,0 +1,7 @@ +PROCEDURE REPEAT_STRING(S$,N%->REP$) + LOCAL I% + REP$="" + FOR I%=1 TO N% DO + REP$=REP$+S$ + END FOR +END PROCEDURE diff --git a/Task/Repeat-a-string/Egison/repeat-a-string.egison b/Task/Repeat-a-string/Egison/repeat-a-string.egison new file mode 100644 index 0000000000..faf6ae2a34 --- /dev/null +++ b/Task/Repeat-a-string/Egison/repeat-a-string.egison @@ -0,0 +1 @@ +(S.concat (take 5 (repeat1 "ha"))) diff --git a/Task/Repeat-a-string/FreeBASIC/repeat-a-string.freebasic b/Task/Repeat-a-string/FreeBASIC/repeat-a-string.freebasic new file mode 100644 index 0000000000..2b43d1d233 --- /dev/null +++ b/Task/Repeat-a-string/FreeBASIC/repeat-a-string.freebasic @@ -0,0 +1,29 @@ +' FB 1.05.0 Win64 + +' A character is essentially a string of length 1 in FB though there is a built-in function, String, +' which creates a string by repeating a character a given number of times. + +' To avoid repeated concatenation (a slow operation) when the string to be repeated has a length +' greater than one, we instead create a buffer of the required size and then fill that. + +Function repeat(s As String, n As Integer) As String + If n < 1 Then Return "" + If n = 1 Then Return s + Var size = Len(s) + If size = 0 Then Return s ' empty string + If size = 1 Then Return String(n, s[0]) ' repeated single character + Var buffer = Space(size * n) 'create buffer for size > 1 + For i As Integer = 0 To n - 1 + For j As Integer = 0 To size - 1 + buffer[i * size + j] = s[j] + Next j + Next i + Return buffer +End Function + +Print repeat("rosetta", 1) +Print repeat("ha", 5) +Print repeat("*", 5) +Print +Print "Press any key to quit program" +Sleep diff --git a/Task/Repeat-a-string/Harbour/repeat-a-string.harbour b/Task/Repeat-a-string/Harbour/repeat-a-string.harbour new file mode 100644 index 0000000000..8d96d9a498 --- /dev/null +++ b/Task/Repeat-a-string/Harbour/repeat-a-string.harbour @@ -0,0 +1 @@ +? Replicate( "Ha", 5 ) diff --git a/Task/Repeat-a-string/Idris/repeat-a-string.idris b/Task/Repeat-a-string/Idris/repeat-a-string.idris new file mode 100644 index 0000000000..7737be39f0 --- /dev/null +++ b/Task/Repeat-a-string/Idris/repeat-a-string.idris @@ -0,0 +1,7 @@ +strRepeat : Nat -> String -> String +strRepeat Z s = "" +strRepeat (S n) s = s ++ strRepeat n s + +chrRepeat : Nat -> Char -> String +chrRepeat Z c = "" +chrRepeat (S n) c = strCons c $ chrRepeat n c diff --git a/Task/Repeat-a-string/LFE/repeat-a-string.lfe b/Task/Repeat-a-string/LFE/repeat-a-string.lfe new file mode 100644 index 0000000000..65d5eb9d2e --- /dev/null +++ b/Task/Repeat-a-string/LFE/repeat-a-string.lfe @@ -0,0 +1 @@ +(string:copies '"ha" 5) diff --git a/Task/Repeat-a-string/Lasso/repeat-a-string-1.lasso b/Task/Repeat-a-string/Lasso/repeat-a-string-1.lasso new file mode 100644 index 0000000000..139aea3ad5 --- /dev/null +++ b/Task/Repeat-a-string/Lasso/repeat-a-string-1.lasso @@ -0,0 +1 @@ +'ha'*5 // hahahahaha diff --git a/Task/Repeat-a-string/Lasso/repeat-a-string-2.lasso b/Task/Repeat-a-string/Lasso/repeat-a-string-2.lasso new file mode 100644 index 0000000000..dca1190ae4 --- /dev/null +++ b/Task/Repeat-a-string/Lasso/repeat-a-string-2.lasso @@ -0,0 +1 @@ +loop(5) => {^ 'ha' ^} // hahahahaha diff --git a/Task/Repeat-a-string/Lingo/repeat-a-string-1.lingo b/Task/Repeat-a-string/Lingo/repeat-a-string-1.lingo new file mode 100644 index 0000000000..a85b57e901 --- /dev/null +++ b/Task/Repeat-a-string/Lingo/repeat-a-string-1.lingo @@ -0,0 +1,7 @@ +on rep (str, n) + res = "" + repeat with i = 1 to n + put str after res + end repeat + return res +end diff --git a/Task/Repeat-a-string/Lingo/repeat-a-string-2.lingo b/Task/Repeat-a-string/Lingo/repeat-a-string-2.lingo new file mode 100644 index 0000000000..4e0cd04888 --- /dev/null +++ b/Task/Repeat-a-string/Lingo/repeat-a-string-2.lingo @@ -0,0 +1,2 @@ +put rep("ha", 5) +-- "hahahahaha" diff --git a/Task/Repeat-a-string/Lingo/repeat-a-string-3.lingo b/Task/Repeat-a-string/Lingo/repeat-a-string-3.lingo new file mode 100644 index 0000000000..84b15520cd --- /dev/null +++ b/Task/Repeat-a-string/Lingo/repeat-a-string-3.lingo @@ -0,0 +1,2 @@ +put bytearray(5, chartonum("*")).readRawString(5) +-- "*****" diff --git a/Task/Repeat-a-string/LiveCode/repeat-a-string.livecode b/Task/Repeat-a-string/LiveCode/repeat-a-string.livecode new file mode 100644 index 0000000000..1a4e08d0bb --- /dev/null +++ b/Task/Repeat-a-string/LiveCode/repeat-a-string.livecode @@ -0,0 +1,10 @@ +on mouseUp + put repeatString("ha", 5) +end mouseUp + +function repeatString str n + repeat n times + put str after t + end repeat + return t +end repeatString diff --git a/Task/Repeat-a-string/Monte/repeat-a-string.monte b/Task/Repeat-a-string/Monte/repeat-a-string.monte new file mode 100644 index 0000000000..68976f7641 --- /dev/null +++ b/Task/Repeat-a-string/Monte/repeat-a-string.monte @@ -0,0 +1,2 @@ +var s := "ha " * 5 +traceln(s) diff --git a/Task/Repeat-a-string/Nim/repeat-a-string.nim b/Task/Repeat-a-string/Nim/repeat-a-string.nim new file mode 100644 index 0000000000..5e600de07c --- /dev/null +++ b/Task/Repeat-a-string/Nim/repeat-a-string.nim @@ -0,0 +1,2 @@ +import strutils +repeatStr(5, "ha") diff --git a/Task/Repeat-a-string/Oforth/repeat-a-string.oforth b/Task/Repeat-a-string/Oforth/repeat-a-string.oforth new file mode 100644 index 0000000000..496b59eaed --- /dev/null +++ b/Task/Repeat-a-string/Oforth/repeat-a-string.oforth @@ -0,0 +1 @@ +StringBuffer new "abcd" < "hahahahaha" diff --git a/Task/Repeat-a-string/Sidef/repeat-a-string.sidef b/Task/Repeat-a-string/Sidef/repeat-a-string.sidef new file mode 100644 index 0000000000..827c92d806 --- /dev/null +++ b/Task/Repeat-a-string/Sidef/repeat-a-string.sidef @@ -0,0 +1 @@ +'ha' * 5; # ==> 'hahahahaha' diff --git a/Task/Repeat-a-string/Sparkling/repeat-a-string.sparkling b/Task/Repeat-a-string/Sparkling/repeat-a-string.sparkling new file mode 100644 index 0000000000..4ea3b3ad76 --- /dev/null +++ b/Task/Repeat-a-string/Sparkling/repeat-a-string.sparkling @@ -0,0 +1,2 @@ +spn:3> repeat("na", 8) .. " Batman!" += nananananananana Batman! diff --git a/Task/Repeat-a-string/Swift/repeat-a-string-1.swift b/Task/Repeat-a-string/Swift/repeat-a-string-1.swift new file mode 100644 index 0000000000..050794ad0c --- /dev/null +++ b/Task/Repeat-a-string/Swift/repeat-a-string-1.swift @@ -0,0 +1,19 @@ +extension String { + // Slower version + func repeatString(n: Int) -> String { + return Array(count: n, repeatedValue: self).joinWithSeparator("") + } + + // Faster version + // benchmarked with a 1000 characters and 100 repeats the fast version is approx 500 000 times faster :-) + func repeatString2(n:Int) -> String { + var result = self + for _ in 1 ..< n { + result.appendContentsOf(self) // Note that String.appendContentsOf is up to 10 times faster than "result += self" + } + return result + } +} + +print( "ha".repeatString(5) ) +print( "he".repeatString2(5) ) diff --git a/Task/Repeat-a-string/Swift/repeat-a-string-2.swift b/Task/Repeat-a-string/Swift/repeat-a-string-2.swift new file mode 100644 index 0000000000..f8c00e5309 --- /dev/null +++ b/Task/Repeat-a-string/Swift/repeat-a-string-2.swift @@ -0,0 +1 @@ +String(count:5, repeatedValue:"*" as Character) diff --git a/Task/Repeat-a-string/Swift/repeat-a-string-3.swift b/Task/Repeat-a-string/Swift/repeat-a-string-3.swift new file mode 100644 index 0000000000..80af58a66c --- /dev/null +++ b/Task/Repeat-a-string/Swift/repeat-a-string-3.swift @@ -0,0 +1,19 @@ +extension String { + func repeatBiterative(count: Int) -> String { + var reduceCount = count + var result = "" + var doubled = self + while reduceCount != 0 { + if reduceCount & 1 == 1 { + result.appendContentsOf(doubled) + } + reduceCount >>= 1 + if reduceCount != 0 { + doubled.appendContentsOf(doubled) + } + } + return result + } +} + +"He".repeatBiterative(5) diff --git a/Task/Repeat-a-string/Visual-FoxPro/repeat-a-string.visual b/Task/Repeat-a-string/Visual-FoxPro/repeat-a-string.visual new file mode 100644 index 0000000000..84d4edf2f0 --- /dev/null +++ b/Task/Repeat-a-string/Visual-FoxPro/repeat-a-string.visual @@ -0,0 +1 @@ +? REPLICATE("HO", 3) diff --git a/Task/Repeat-a-string/Wart/repeat-a-string.wart b/Task/Repeat-a-string/Wart/repeat-a-string.wart new file mode 100644 index 0000000000..cf411e7f85 --- /dev/null +++ b/Task/Repeat-a-string/Wart/repeat-a-string.wart @@ -0,0 +1,7 @@ +def (s * n) :case (string? s) + with outstring + repeat n + pr s + +("ha" * 5) +=> "hahahahaha" diff --git a/Task/Repeat-a-string/Wortel/repeat-a-string-1.wortel b/Task/Repeat-a-string/Wortel/repeat-a-string-1.wortel new file mode 100644 index 0000000000..57b22f1e9f --- /dev/null +++ b/Task/Repeat-a-string/Wortel/repeat-a-string-1.wortel @@ -0,0 +1 @@ +@join "" @rep 5 "ha" ; returns "hahahahaha" diff --git a/Task/Repeat-a-string/Wortel/repeat-a-string-2.wortel b/Task/Repeat-a-string/Wortel/repeat-a-string-2.wortel new file mode 100644 index 0000000000..438333a92f --- /dev/null +++ b/Task/Repeat-a-string/Wortel/repeat-a-string-2.wortel @@ -0,0 +1 @@ +^(\@join "" @rep) diff --git a/Task/Repeat-a-string/jq/repeat-a-string.jq b/Task/Repeat-a-string/jq/repeat-a-string.jq new file mode 100644 index 0000000000..b837f7d5cc --- /dev/null +++ b/Task/Repeat-a-string/jq/repeat-a-string.jq @@ -0,0 +1 @@ +"a " * 3' # => "a a a " diff --git a/Task/Resistor-mesh/ERRE/resistor-mesh.erre b/Task/Resistor-mesh/ERRE/resistor-mesh.erre new file mode 100644 index 0000000000..e80d3bba10 --- /dev/null +++ b/Task/Resistor-mesh/ERRE/resistor-mesh.erre @@ -0,0 +1,76 @@ + PROGRAM RESISTENCE_MESH + + !$BASE=1 + + !$DYNAMIC + DIM A[0,0] + + BEGIN + + N=10 + NN=N*N + !$DIM A[NN,NN+1] + + PRINT(CHR$(12);) !CLS + ! generate matrix data + NODE=0 + FOR ROW=1 TO N DO + FOR COL=1 TO N DO + NODE=NODE+1 + IF ROW>1 THEN + A[NODE,NODE]=A[NODE,NODE]+1 + A[NODE,NODE-N]=-1 + END IF + IF ROW1 THEN + A[NODE,NODE]=A[NODE,NODE]+1 + A[NODE,NODE-1]=-1 + END IF + IF COL0 + END FOR + IF I=R+1 THEN + PRINT("No solution!") + !$STOP + END IF + FOR K=1 TO R+1 DO + SWAP(A[J,K],A[I,K]) + END FOR + Y=1/A[J,J] + FOR K=1 TO R+1 DO + A[J,K]=Y*A[J,K] + END FOR + FOR I=1 TO R DO + IF I<>J THEN + Y=-A[I,J] + FOR K=1 TO R+1 DO + A[I,K]=A[I,K]+Y*A[J,K] + END FOR + END IF + END FOR + END FOR + PRINT("Resistence=";ABS(A[A,NN+1]-A[B,NN+1])) + END PROGRAM diff --git a/Task/Resistor-mesh/Sidef/resistor-mesh.sidef b/Task/Resistor-mesh/Sidef/resistor-mesh.sidef new file mode 100644 index 0000000000..7b5f3b3f73 --- /dev/null +++ b/Task/Resistor-mesh/Sidef/resistor-mesh.sidef @@ -0,0 +1,52 @@ +var (w, h) = (10, 10) + +var v = h.of { w.of(0) } # voltage +var f = h.of { w.of(0) } # fixed condition +var d = h.of { w.of(0) } # diff +var n = [] # neighbors + +for i in ^h { + for j in (1 ..^ w ) { n[i][j] := [] << [i, j-1] } + for j in (0 ..^ w-1) { n[i][j] := [] << [i, j+1] } +} + +for j in ^w { + for i in (1 ..^ h ) { n[i][j] := [] << [i-1, j] } + for i in (0 ..^ h-1) { n[i][j] := [] << [i+1, j] } +} + +func set_boundary { + f[1][1] = 1; f[6][7] = -1; + v[1][1] = 1; v[6][7] = -1; +} + +func calc_diff { + var total_diff = 0 + for i,j in (^h ~X ^w) { + var p = n[i][j] + var w = 0 + p.each { |a| w += v.dig(a...) } + d[i][j] = (w = (v[i][j] - w/p.len)) + f[i][j] || (total_diff += w*w) + } + total_diff +} + +func iter { + var diff = 1 + while (diff > 1e-24) { + set_boundary() + diff = calc_diff() + for i,j in (^h ~X ^w) { + v[i][j] -= d[i][j] + } + } + + var current = 3.of(0) + for i,j in (^h ~X ^w) { + current[ f[i][j] ] += (d[i][j] * n[i][j].len) + } + (current[1] - current[-1]) / 2 +} + +say "R = #{2 / iter()}" diff --git a/Task/Respond-to-an-unknown-method-call/Lasso/respond-to-an-unknown-method-call.lasso b/Task/Respond-to-an-unknown-method-call/Lasso/respond-to-an-unknown-method-call.lasso new file mode 100644 index 0000000000..95f18bf086 --- /dev/null +++ b/Task/Respond-to-an-unknown-method-call/Lasso/respond-to-an-unknown-method-call.lasso @@ -0,0 +1,27 @@ +define exampletype => type { + public foo() => { + return 'this is foo\r' + } + public bar() => { + return 'this is bar\r' + } + public _unknownTag(...) => { + local(n = method_name->asString) + return 'tried to handle unknown method called "'+#n+'"'+ + (#rest->size ? ' with args: "'+#rest->join(',')+'"')+'\r' + } +} + +local(e = exampletype) + +#e->foo() +// outputs 'this is foo' + +#e->bar() +// outputs 'this is bar' + +#e->stuff() +// outputs 'tried to handle unknown method called "stuff"' + +#e->dothis('here',12,'there','nowhere') +// outputs 'tried to handle unknown method called "dothis" with args: "here,12,there,nowhere"' diff --git a/Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-1.oforth b/Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-1.oforth new file mode 100644 index 0000000000..224ee6b186 --- /dev/null +++ b/Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-1.oforth @@ -0,0 +1,2 @@ +1 first +[1:interpreter] ExRuntime : 1 does not understand method <#first> diff --git a/Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-2.oforth b/Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-2.oforth new file mode 100644 index 0000000000..19eef92863 --- /dev/null +++ b/Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-2.oforth @@ -0,0 +1,2 @@ +1 "first" asMethod perform +[1:interpreter] ExRuntime : 1 does not understand method <#first> diff --git a/Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-3.oforth b/Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-3.oforth new file mode 100644 index 0000000000..735f5d60fc --- /dev/null +++ b/Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-3.oforth @@ -0,0 +1,2 @@ +1 "unknow_method" asMethod perform +[1:interpreter] ExRuntime : null does not understand method <#perform> diff --git a/Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-4.oforth b/Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-4.oforth new file mode 100644 index 0000000000..4a6b2f6155 --- /dev/null +++ b/Task/Respond-to-an-unknown-method-call/Oforth/respond-to-an-unknown-method-call-4.oforth @@ -0,0 +1,6 @@ +Object Class new: MyClass +MyClass method: doesNotUnderstand(m) + "Well, sorry, I don't understand " print m println ; + +MyClass new first +Well, sorry, I don't understand #first diff --git a/Task/Respond-to-an-unknown-method-call/Sidef/respond-to-an-unknown-method-call.sidef b/Task/Respond-to-an-unknown-method-call/Sidef/respond-to-an-unknown-method-call.sidef new file mode 100644 index 0000000000..9426f417ba --- /dev/null +++ b/Task/Respond-to-an-unknown-method-call/Sidef/respond-to-an-unknown-method-call.sidef @@ -0,0 +1,22 @@ +class Example { + method foo { + say "this is foo" + } + method bar { + say "this is bar" + } + method AUTOLOAD(_, name, *args) { + say ("tried to handle unknown method %s" % name); + if (args.len > 0) { + say ("it had arguments: %s" % args.join(', ')); + } + } +} + +var example = Example.new; + +example.foo; # prints “this is foo” +example.bar; # prints “this is bar” +example.grill; # prints “tried to handle unknown method grill” +example.ding("dong"); # prints “tried to handle unknown method ding” + # prints “it had arguments: dong” diff --git a/Task/Return-multiple-values/ECL/return-multiple-values.ecl b/Task/Return-multiple-values/ECL/return-multiple-values.ecl new file mode 100644 index 0000000000..d23fe79bd9 --- /dev/null +++ b/Task/Return-multiple-values/ECL/return-multiple-values.ecl @@ -0,0 +1,11 @@ +MyFunc(INTEGER i1,INTEGER i2) := FUNCTION + RetMod := MODULE + EXPORT INTEGER Add := i1 + i2; + EXPORT INTEGER Prod := i1 * i2; + END; + RETURN RetMod; +END; + +//Reference each return value separately: +MyFunc(3,4).Add; +MyFunc(3,4).Prod; diff --git a/Task/Return-multiple-values/ERRE/return-multiple-values.erre b/Task/Return-multiple-values/ERRE/return-multiple-values.erre new file mode 100644 index 0000000000..18f83d09d8 --- /dev/null +++ b/Task/Return-multiple-values/ERRE/return-multiple-values.erre @@ -0,0 +1,12 @@ +PROGRAM RETURN_VALUES + +PROCEDURE SUM_DIFF(A,B->C,D) + C=A+B + D=A-B +END PROCEDURE + +BEGIN + SUM_DIFF(5,3->SUM,DIFF) + PRINT("Sum is";SUM) + PRINT("Difference is";DIFF) +END PROGRAM diff --git a/Task/Return-multiple-values/EchoLisp/return-multiple-values.echolisp b/Task/Return-multiple-values/EchoLisp/return-multiple-values.echolisp new file mode 100644 index 0000000000..39d59ab064 --- /dev/null +++ b/Task/Return-multiple-values/EchoLisp/return-multiple-values.echolisp @@ -0,0 +1,10 @@ +(define (plus-minus x y) + (values (+ x y) (- x y))) +(plus-minus 3 4) + → 7 + -1 + +(define (plus-minus x y) + (list (+ x y) (- x y))) +(plus-minus 3 4) + → (7 -1) diff --git a/Task/Return-multiple-values/FreeBASIC/return-multiple-values.freebasic b/Task/Return-multiple-values/FreeBASIC/return-multiple-values.freebasic new file mode 100644 index 0000000000..9cd8a7f901 --- /dev/null +++ b/Task/Return-multiple-values/FreeBASIC/return-multiple-values.freebasic @@ -0,0 +1,53 @@ +' FB 1.05.0 Win64 + +' One way to return multiple values is to use ByRef parameters for the additional one(s) +Function tryOpenFile (fileName As String, ByRef fileNumber As Integer) As Boolean + Dim result As Integer + fileNumber = FreeFile + result = Open(fileName For Input As # fileNumber) + If result <> 0 Then + fileNumber = 0 + Return False + Else + Return True + End If +End Function + +Dim fn As Integer +Var b = tryOpenFile("xxx.zyz", fn) '' this file doesn't exist +Print b, fn +b = tryOpenFile("input.txt", fn) '' this file does exist +Print b, fn +Close # fn + +' Another way is to use a user defined type + +Type FileOpenInfo + opened As Boolean + fn As Integer +End Type + +Function tryOpenFile2(fileName As String) As FileOpenInfo + Dim foi As FileOpenInfo + foi.fn = FreeFile + Dim result As Integer + result = Open(fileName For Input As # foi.fn) + If result <> 0 Then + foi.fn = 0 + foi.opened = False + Else + foi.Opened = True + End If + Return foi +End Function + +Print +Var foi = tryOpenFile2("xxx.zyz") +Print foi.opened, foi.fn +foi = tryOpenFile2("input.txt") +Print foi.opened, foi.fn +Close # foi.fn + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Return-multiple-values/FunL/return-multiple-values.funl b/Task/Return-multiple-values/FunL/return-multiple-values.funl new file mode 100644 index 0000000000..cff962182f --- /dev/null +++ b/Task/Return-multiple-values/FunL/return-multiple-values.funl @@ -0,0 +1,5 @@ +def addsub( x, y ) = (x + y, x - y) + +val (sum, difference) = addsub( 33, 12 ) + +println( sum, difference, addsub(33, 12) ) diff --git a/Task/Return-multiple-values/FutureBasic/return-multiple-values-1.futurebasic b/Task/Return-multiple-values/FutureBasic/return-multiple-values-1.futurebasic new file mode 100644 index 0000000000..f6c6067d65 --- /dev/null +++ b/Task/Return-multiple-values/FutureBasic/return-multiple-values-1.futurebasic @@ -0,0 +1,22 @@ +include "ConsoleWindow" + +local fn ReturnMultipleValues( strIn as Str255, strOut as ^Str255, letterCount as ^long ) +dim as Str255 s + +// Test if incoming string is empty, and exit function if it is +if strIn[0] == 0 then exit fn + +// Prepend this string to incoming string and return it +s = "Here is your original string: " +strOut.nil$ = s + strIn + +// Get length of combined string and return it +// Note: In FutureBasic string[0] is interchangeable with Len(string) +letterCount.nil& = strIn[0] + s[0] +end fn + +dim as Str255 outStr +dim as long outCount + +fn ReturnMultipleValues( "Hello, World!", @outStr, @outCount ) +print outStr; ". The combined strings have"; outCount; " letters in them." diff --git a/Task/Return-multiple-values/FutureBasic/return-multiple-values-2.futurebasic b/Task/Return-multiple-values/FutureBasic/return-multiple-values-2.futurebasic new file mode 100644 index 0000000000..949783d248 --- /dev/null +++ b/Task/Return-multiple-values/FutureBasic/return-multiple-values-2.futurebasic @@ -0,0 +1,39 @@ +include "ConsoleWindow" + +// Elements in global array +_maxDim = 3 + +begin record Addresses +dim as Str63 name +dim as Str15 phone +dim as long zip +end record + +begin globals +dim as Addresses gAddressData(_maxDim) +end globals + +local fn FillRecord( array(_maxDim) as Addresses ) +array.name(0) = "John Doe" +array.name(1) = "Mary Jones" +array.name(2) = "Bill Smith + +array.phone(0) = "555-359-4411" +array.phone(1) = "555-111-2211" +array.phone(2) = "555-769-8071" + +array.zip(0) = 12543 +array.zip(1) = 67891 +array.zip(2) = 54321 +end fn + +// Pass address of global array to fill it +fn FillRecord( gAddressData(0) ) + +dim as short i + +for i = 0 to 2 + print gAddressData.name(i); ", "; + print gAddressData.phone(i); ", Zip:"; + print gAddressData.zip(i) +next diff --git a/Task/Return-multiple-values/FutureBasic/return-multiple-values-3.futurebasic b/Task/Return-multiple-values/FutureBasic/return-multiple-values-3.futurebasic new file mode 100644 index 0000000000..b18210d61b --- /dev/null +++ b/Task/Return-multiple-values/FutureBasic/return-multiple-values-3.futurebasic @@ -0,0 +1,34 @@ +include "ConsoleWindow" + +// Elements in global array +_maxDim = 3 + +begin globals +dim as Str31 gAddressArray(_maxDim, _maxDim) +end globals + +local fn FillRecord( array(_maxDim, _maxDim) as Str31 ) +array( 0, 0 ) = "John Doe" +array( 1, 0 ) = "Mary Jones" +array( 2, 0 ) = "Bill Smith + +array( 0, 1 ) = "555-359-4411" +array( 1, 1 ) = "555-111-2211" +array( 2, 1 ) = "555-769-8071" + +array( 0, 2 ) = "12543" +array( 1, 2 ) = "67891" +array( 2, 2 ) = "54321" +end fn + +// Pass address of global array to fill it +fn FillRecord( gAddressArray( 0, 0 ) ) + +dim as short i, j + +for i = 0 to 2 + j = 0 + print gAddressArray(i, j ); ", "; + print gAddressArray(i, j + 1); ", Zip: "; + print gAddressArray(i, j + 1) +next diff --git a/Task/Return-multiple-values/FutureBasic/return-multiple-values-4.futurebasic b/Task/Return-multiple-values/FutureBasic/return-multiple-values-4.futurebasic new file mode 100644 index 0000000000..cd7411ce5e --- /dev/null +++ b/Task/Return-multiple-values/FutureBasic/return-multiple-values-4.futurebasic @@ -0,0 +1,46 @@ +include "ConsoleWindow" + +begin globals +// An FB container can hold up to 2GB of data, contigent on system memory +dim as container gC1, gC2 +end globals + +local fn ReturnMultipleValuesInContainers +// Fill container with strings from inside function +gC1 = "Twas brillig, and the slithy toves" + chr$(13) +gC1 += "Did gyre and gimble in the wabe;" + chr$(13) +gC1 += "All mimsy were the borogoves," + chr$(13) +gC1 += "And the mome raths outgrabe." + chr$(13) +gC1 += "'Beware the Jabberwock, my son!" + chr$(13) +gC1 += "The jaws that bite, the claws that catch!" + chr$(13) +gC1 += "Beware the Jubjub bird, and shun" + chr$(13) +gC1 += "The frumious Bandersnatch!'" + chr$(13) + +// Fill another container with numbers +gC2 = "10254"+ chr$(13) +gC2 += "37" + chr$(13) +gC2 += "64" + chr$(13) +end fn + +local fn ReturnNewMultipleValuesInContainers +gC1 = "Jabberwocky is gone, but here is some new text." + chr$(13) +gC2 = "1000000" +end fn + +// Test to see containers are empty: +print gC1 : print gC2 + +// Fill the containers using a function +fn ReturnMultipleValuesInContainers + +// Check results +print gC1 : print : print gC2 + +// Empty the containers +gC1 = "" : gC2 = "" + +// Fill with another function +fn ReturnNewMultipleValuesInContainers + +// Check the new results +print gC1 : print gC2 diff --git a/Task/Return-multiple-values/Harbour/return-multiple-values.harbour b/Task/Return-multiple-values/Harbour/return-multiple-values.harbour new file mode 100644 index 0000000000..22d42a3a1c --- /dev/null +++ b/Task/Return-multiple-values/Harbour/return-multiple-values.harbour @@ -0,0 +1,2 @@ +FUNCTION Addsub( x, y ) + RETURN { x + y, x - y } diff --git a/Task/Return-multiple-values/Lasso/return-multiple-values.lasso b/Task/Return-multiple-values/Lasso/return-multiple-values.lasso new file mode 100644 index 0000000000..57f873f761 --- /dev/null +++ b/Task/Return-multiple-values/Lasso/return-multiple-values.lasso @@ -0,0 +1,9 @@ +define multi_value() => { + return (:'hello word',date) +} +// shows that single method call will return multiple values +// the two values returned are assigned in order to the vars x and y +local(x,y) = multi_value + +'x: '+#x +'\ry: '+#y diff --git a/Task/Return-multiple-values/Lily/return-multiple-values.lily b/Task/Return-multiple-values/Lily/return-multiple-values.lily new file mode 100644 index 0000000000..80f6e44102 --- /dev/null +++ b/Task/Return-multiple-values/Lily/return-multiple-values.lily @@ -0,0 +1,4 @@ +define combine(a: Integer, b: String): Tuple[Integer, String] +{ + return <[a, b]> +} diff --git a/Task/Return-multiple-values/Nim/return-multiple-values-1.nim b/Task/Return-multiple-values/Nim/return-multiple-values-1.nim new file mode 100644 index 0000000000..8796caba4b --- /dev/null +++ b/Task/Return-multiple-values/Nim/return-multiple-values-1.nim @@ -0,0 +1,4 @@ +proc addsub(x, y): auto = + (x + y, x - y) + +var (a,b) = addsub(12, 15) diff --git a/Task/Return-multiple-values/Nim/return-multiple-values-2.nim b/Task/Return-multiple-values/Nim/return-multiple-values-2.nim new file mode 100644 index 0000000000..29364376d1 --- /dev/null +++ b/Task/Return-multiple-values/Nim/return-multiple-values-2.nim @@ -0,0 +1,6 @@ +proc addsub(x, y: int, a, b: var int) = + a = x + y + b = x - y + +var a, b: int +addsub(12, 15, a, b) diff --git a/Task/Return-multiple-values/Oforth/return-multiple-values.oforth b/Task/Return-multiple-values/Oforth/return-multiple-values.oforth new file mode 100644 index 0000000000..6a4e477852 --- /dev/null +++ b/Task/Return-multiple-values/Oforth/return-multiple-values.oforth @@ -0,0 +1,10 @@ +import: date + +: returnFourValues 12 13 14 15 ; +: returnOneObject [ 12, 13, 14, 15, [16, 17 ], Date now, 1.2, "abcd" ] ; + +"Showing four values returned on the parameter stack:" println +returnFourValues .s clr + +"\nShowing one object containing four values returned on the parameter stack:" println +returnOneObject .s clr diff --git a/Task/Return-multiple-values/Phix/return-multiple-values.phix b/Task/Return-multiple-values/Phix/return-multiple-values.phix new file mode 100644 index 0000000000..7a15328d9a --- /dev/null +++ b/Task/Return-multiple-values/Phix/return-multiple-values.phix @@ -0,0 +1,7 @@ +function stuff() + return {"PI",'=',3.1415926535} +end function +string what +integer op +object val + {what,op,val} = stuff() diff --git a/Task/Return-multiple-values/Ring/return-multiple-values.ring b/Task/Return-multiple-values/Ring/return-multiple-values.ring new file mode 100644 index 0000000000..6a0ab6bc85 --- /dev/null +++ b/Task/Return-multiple-values/Ring/return-multiple-values.ring @@ -0,0 +1,2 @@ +Func AddSub x,y + Return [ x+y, x-y ] diff --git a/Task/Return-multiple-values/Sidef/return-multiple-values-1.sidef b/Task/Return-multiple-values/Sidef/return-multiple-values-1.sidef new file mode 100644 index 0000000000..5717362fef --- /dev/null +++ b/Task/Return-multiple-values/Sidef/return-multiple-values-1.sidef @@ -0,0 +1,3 @@ +func foo(a,b) { + return (a+b, a*b); +} diff --git a/Task/Return-multiple-values/Sidef/return-multiple-values-2.sidef b/Task/Return-multiple-values/Sidef/return-multiple-values-2.sidef new file mode 100644 index 0000000000..03b9ee9a43 --- /dev/null +++ b/Task/Return-multiple-values/Sidef/return-multiple-values-2.sidef @@ -0,0 +1,3 @@ +var (x, y) = foo(4, 5); +say x; #=> 9 +say y; #=> 20 diff --git a/Task/Return-multiple-values/Swift/return-multiple-values-1.swift b/Task/Return-multiple-values/Swift/return-multiple-values-1.swift new file mode 100644 index 0000000000..875fc59e00 --- /dev/null +++ b/Task/Return-multiple-values/Swift/return-multiple-values-1.swift @@ -0,0 +1,3 @@ +func addsub(x: Int, y: Int) -> (Int, Int) { + return (x + y, x - y) +} diff --git a/Task/Return-multiple-values/Swift/return-multiple-values-2.swift b/Task/Return-multiple-values/Swift/return-multiple-values-2.swift new file mode 100644 index 0000000000..a28cbfde27 --- /dev/null +++ b/Task/Return-multiple-values/Swift/return-multiple-values-2.swift @@ -0,0 +1,3 @@ +let (sum, difference) = addsub(33, 12) +println("33 + 12 = \(sum)") +println("33 - 12 = \(difference)") diff --git a/Task/Return-multiple-values/Ursa/return-multiple-values.ursa b/Task/Return-multiple-values/Ursa/return-multiple-values.ursa new file mode 100644 index 0000000000..a4337c4af2 --- /dev/null +++ b/Task/Return-multiple-values/Ursa/return-multiple-values.ursa @@ -0,0 +1,20 @@ +def getstrs (int n) + decl string<> input + + while (> n 0) + out ": " console + append (in string console) input + dec n + end while + + return input +end getstrs + +decl int amount +out "how many strings do you want to enter? " console +set amount (in int console) + +decl string<> ret +set ret (getstrs amount) + +out endl ret endl console diff --git a/Task/Return-multiple-values/Visual-FoxPro/return-multiple-values.visual b/Task/Return-multiple-values/Visual-FoxPro/return-multiple-values.visual new file mode 100644 index 0000000000..4f7b46568c --- /dev/null +++ b/Task/Return-multiple-values/Visual-FoxPro/return-multiple-values.visual @@ -0,0 +1,17 @@ +*!* Return multiple values from a function +*!* The simplest way is to pass the parameters by reference +*!* either by SET UDFPARMS TO REFERENCE, or prefix the variables with @. +LOCAL a, b +a = 5 +b = 6 +? "Sum =", AddUp(@a, @b) && Displays 11 +? "a =", a, "b =", b && Displays 4, 5 +? "Sum =", AddUp(@a, @b) && Displays 9 + +FUNCTION AddUp(n1, n2) +LOCAL n +n = n1 + n2 +n1 = n1 - 1 +n2 = n2 - 1 +RETURN n +ENDFUNC diff --git a/Task/Return-multiple-values/jq/return-multiple-values-1.jq b/Task/Return-multiple-values/jq/return-multiple-values-1.jq new file mode 100644 index 0000000000..3f6f3f2efd --- /dev/null +++ b/Task/Return-multiple-values/jq/return-multiple-values-1.jq @@ -0,0 +1,5 @@ +# To produce a stream: +def addsub(x; y): (x + y), (x - y); + +# To produce an array: +def add_subtract(x; y): [ x+y, x-y ]; diff --git a/Task/Return-multiple-values/jq/return-multiple-values-2.jq b/Task/Return-multiple-values/jq/return-multiple-values-2.jq new file mode 100644 index 0000000000..1191247b6d --- /dev/null +++ b/Task/Return-multiple-values/jq/return-multiple-values-2.jq @@ -0,0 +1,2 @@ +1 +2 diff --git a/Task/Reverse-a-string/8th/reverse-a-string.8th b/Task/Reverse-a-string/8th/reverse-a-string.8th new file mode 100644 index 0000000000..cdaa76bc8f --- /dev/null +++ b/Task/Reverse-a-string/8th/reverse-a-string.8th @@ -0,0 +1 @@ +"abc" s:rev diff --git a/Task/Reverse-a-string/Apex/reverse-a-string-1.apex b/Task/Reverse-a-string/Apex/reverse-a-string-1.apex new file mode 100644 index 0000000000..1b84826bc4 --- /dev/null +++ b/Task/Reverse-a-string/Apex/reverse-a-string-1.apex @@ -0,0 +1,3 @@ +String str = 'Hello World!'; +str = str.reverse(); +system.debug(str); diff --git a/Task/Reverse-a-string/Apex/reverse-a-string-2.apex b/Task/Reverse-a-string/Apex/reverse-a-string-2.apex new file mode 100644 index 0000000000..fb792368e4 --- /dev/null +++ b/Task/Reverse-a-string/Apex/reverse-a-string-2.apex @@ -0,0 +1,2 @@ + ⌽'asdf' +fdsa diff --git a/Task/Reverse-a-string/ERRE/reverse-a-string.erre b/Task/Reverse-a-string/ERRE/reverse-a-string.erre new file mode 100644 index 0000000000..f8f1879fab --- /dev/null +++ b/Task/Reverse-a-string/ERRE/reverse-a-string.erre @@ -0,0 +1,15 @@ +PROGRAM REVERSE_STRING + +PROCEDURE REVERSE(A$->R$) + LOCAL I% + R$="" + FOR I=1 TO LEN(A$) DO + R$=MID$(A$,I,1)+R$ + END FOR +END PROCEDURE + +BEGIN + A$="THE FIVE BOXING WIZARDS JUMP QUICKLY" + REVERSE(A$->R$) + PRINT(R$) +END PROGRAM diff --git a/Task/Reverse-a-string/EchoLisp/reverse-a-string.echolisp b/Task/Reverse-a-string/EchoLisp/reverse-a-string.echolisp new file mode 100644 index 0000000000..8e9f36af45 --- /dev/null +++ b/Task/Reverse-a-string/EchoLisp/reverse-a-string.echolisp @@ -0,0 +1,7 @@ +(define (string-reverse string) + (list->string (reverse (string->list string)))) + +(string-reverse "ghij") + → jihg +(string-reverse "un roc lamina l animal cornu") + → unroc lamina l animal cor nu diff --git a/Task/Reverse-a-string/Elm/reverse-a-string.elm b/Task/Reverse-a-string/Elm/reverse-a-string.elm new file mode 100644 index 0000000000..d069d2a121 --- /dev/null +++ b/Task/Reverse-a-string/Elm/reverse-a-string.elm @@ -0,0 +1,39 @@ +-- The import on the next line provides the reverse string +-- functionality satisfying the rosettacode.org task description. +import String exposing (reverse) + +-- The rest is fairly boilerplate code demonstrating +-- interactively that the reverse function works. +import Html exposing (Html, Attribute, text, div, input) +import Html.Attributes exposing (placeholder, value, style) +import Html.Events exposing (on, targetValue) +import Html.App exposing (beginnerProgram) + +main = beginnerProgram { model = "", view = view, update = update } + +update newStr oldStr = newStr + +view : String -> Html String +view forward = + div [] + ([ input + [ placeholder "Enter a string to be reversed." + , value forward + , on "input" targetValue + , myStyle + ] + [] + ] ++ + [ let backward = reverse forward + in div [ myStyle] [text backward] + ]) + +myStyle : Attribute msg +myStyle = + style + [ ("width", "100%") + , ("height", "20px") + , ("padding", "5px 0 0 5px") + , ("font-size", "1em") + , ("text-align", "left") + ] diff --git a/Task/Reverse-a-string/Ezhil/reverse-a-string.ezhil b/Task/Reverse-a-string/Ezhil/reverse-a-string.ezhil new file mode 100644 index 0000000000..95165ef441 --- /dev/null +++ b/Task/Reverse-a-string/Ezhil/reverse-a-string.ezhil @@ -0,0 +1,44 @@ +## இந்த நிரல் தரப்படும் சரம் ஒன்றைத் தலைகீழாகத் திருப்பி அச்சிடும் +## உதாரணமாக "abc" என்ற சரம் தரப்பட்டால் அதனைத் திருப்பி "cba" என அச்சிடும் +## "எழில்" மொழியின்மூலம் இரண்டு வகைகளில் இதனைச் செய்யலாம். இரண்டு உதாரணங்களும் இங்கே தரப்பட்டுள்ளன + +நிரல்பாகம் திருப்புக (சரம்1) + + ## முதல் வகை + + சரம்2 = "" + + @( சரம்1 இல் இ) ஒவ்வொன்றாக + சரம்2 = இ + சரம்2 + முடி + + பின்கொடு சரம்2 + +முடி + +நிரல்பாகம் மீண்டும்திருப்புக (சரம்1) + + ## இரண்டாம் வகை + + சரநீளம் = len(சரம்1) + + சரம்2 = "" + + @(எண் = 0, எண் < சரநீளம், எண் = எண் + 1) ஆக + + சரம்2 = எடு(சரம்1, எண்) + சரம்2 + + முடி + + பின்கொடு சரம்2 + +முடி + + +அ = உள்ளீடு("ஓர் எழுத்துச் சரத்தைத் தாருங்கள் ") + +பதிப்பி "நீங்கள் தந்த எழுத்துச் சரம்" அ + +பதிப்பி "அதனை முதல் வகையில் திருப்பியுள்ளோம்: " திருப்புக(அ) + +பதிப்பி "வேறொரு வகையில் திருப்பியுள்ளோம்: " மீண்டும்திருப்புக(அ) diff --git a/Task/Reverse-a-string/FreeBASIC/reverse-a-string.freebasic b/Task/Reverse-a-string/FreeBASIC/reverse-a-string.freebasic new file mode 100644 index 0000000000..1630e61857 --- /dev/null +++ b/Task/Reverse-a-string/FreeBASIC/reverse-a-string.freebasic @@ -0,0 +1,14 @@ +' FB 1.05.0 Win64 + +Function ReverseString(s As Const String) As String + If s = "" Then Return s + Dim length As Integer = Len(s) + Dim r As String = Space(length) + For i As Integer = 0 To length - 1 + r[i] = s[length - 1 - i] + Next + Return r +End Function + +Dim s As String = "asdf" +Print "'"; s; "' reversed is '"; ReverseString(s); "'" diff --git a/Task/Reverse-a-string/FutureBasic/reverse-a-string.futurebasic b/Task/Reverse-a-string/FutureBasic/reverse-a-string.futurebasic new file mode 100644 index 0000000000..522761e0cd --- /dev/null +++ b/Task/Reverse-a-string/FutureBasic/reverse-a-string.futurebasic @@ -0,0 +1,13 @@ +include "ConsoleWindow" + +dim as Str31 str +dim as long i + +str = "123456789abcdefghijk" + +print str +print + +for i = str[0] to 1 step -1 +print mid$( str, i, 1 ); +next i diff --git a/Task/Reverse-a-string/GFA-Basic/reverse-a-string.gfa b/Task/Reverse-a-string/GFA-Basic/reverse-a-string.gfa new file mode 100644 index 0000000000..8d98d0d100 --- /dev/null +++ b/Task/Reverse-a-string/GFA-Basic/reverse-a-string.gfa @@ -0,0 +1,10 @@ +PRINT @reverse$("asdf") +' +FUNCTION reverse$(string$) + LOCAL result$,i% + result$="" + FOR i%=1 TO LEN(string$) + result$=MID$(string$,i%,1)+result$ + NEXT i% + RETURN result$ +ENDFUNC diff --git a/Task/Reverse-a-string/Harbour/reverse-a-string.harbour b/Task/Reverse-a-string/Harbour/reverse-a-string.harbour new file mode 100644 index 0000000000..8d1f9eecf9 --- /dev/null +++ b/Task/Reverse-a-string/Harbour/reverse-a-string.harbour @@ -0,0 +1,9 @@ +FUNCTION Reverse( sIn ) + + LOCAL cOut := "", i + + FOR i := Len( sIn ) TO 1 STEP -1 + cOut += Substr( sIn, i, 1 ) + NEXT + + RETURN cOut diff --git a/Task/Reverse-a-string/L++/reverse-a-string.lpp b/Task/Reverse-a-string/L++/reverse-a-string.lpp new file mode 100644 index 0000000000..d98faef37e --- /dev/null +++ b/Task/Reverse-a-string/L++/reverse-a-string.lpp @@ -0,0 +1,6 @@ +(include "string" "algorithm") +(main + (decl std::string s) + (std::getline std::cin s) + (std::reverse (s.begin) (s.end)) + (prn s)) diff --git a/Task/Reverse-a-string/LC3-Assembly/reverse-a-string.lc3 b/Task/Reverse-a-string/LC3-Assembly/reverse-a-string.lc3 new file mode 100644 index 0000000000..69c3b79e41 --- /dev/null +++ b/Task/Reverse-a-string/LC3-Assembly/reverse-a-string.lc3 @@ -0,0 +1,35 @@ + .ORIG 0x3000 + + LEA R1,STRING + LEA R2,GNIRTS + LD R3,MINUS1 + NOT R5,R1 + ADD R5,R5,1 + +SCAN LDR R4,R1,0 + BRZ COPY + ADD R1,R1,1 + BRNZP SCAN + +COPY ADD R1,R1,R3 + ADD R4,R1,R5 + BRN COPIED + LDR R4,R1,0 + STR R4,R2,0 + ADD R2,R2,1 + BRNZP COPY + +COPIED AND R4,R4,0 + STR R4,R2,0 + + LEA R0,GNIRTS + PUTS + + HALT + +MINUS1 .FILL 0xFFFF + +STRING .STRINGZ "If thou beest he -- but O how fall'n! how chang'd" +GNIRTS .BLKW 128 + + .END diff --git a/Task/Reverse-a-string/LFE/reverse-a-string-1.lfe b/Task/Reverse-a-string/LFE/reverse-a-string-1.lfe new file mode 100644 index 0000000000..d4a4797b6d --- /dev/null +++ b/Task/Reverse-a-string/LFE/reverse-a-string-1.lfe @@ -0,0 +1,2 @@ +> (lists:reverse "asdf") +"fdsa" diff --git a/Task/Reverse-a-string/LFE/reverse-a-string-2.lfe b/Task/Reverse-a-string/LFE/reverse-a-string-2.lfe new file mode 100644 index 0000000000..9e1c3347e7 --- /dev/null +++ b/Task/Reverse-a-string/LFE/reverse-a-string-2.lfe @@ -0,0 +1,2 @@ +> (set encoded (binary ("åäö ð" utf8))) +#B(195 165 195 164 195 182 32 195 176) diff --git a/Task/Reverse-a-string/LFE/reverse-a-string-3.lfe b/Task/Reverse-a-string/LFE/reverse-a-string-3.lfe new file mode 100644 index 0000000000..6155874fd3 --- /dev/null +++ b/Task/Reverse-a-string/LFE/reverse-a-string-3.lfe @@ -0,0 +1,2 @@ +> (io:format "~tp~n" (list encoded)) +<<"åäö ð"/utf8>> diff --git a/Task/Reverse-a-string/LFE/reverse-a-string-4.lfe b/Task/Reverse-a-string/LFE/reverse-a-string-4.lfe new file mode 100644 index 0000000000..31d716a82d --- /dev/null +++ b/Task/Reverse-a-string/LFE/reverse-a-string-4.lfe @@ -0,0 +1,2 @@ +> (lists:reverse (unicode:characters_to_list encoded)) +"ð öäå" diff --git a/Task/Reverse-a-string/Lasso/reverse-a-string-1.lasso b/Task/Reverse-a-string/Lasso/reverse-a-string-1.lasso new file mode 100644 index 0000000000..69e3377d6e --- /dev/null +++ b/Task/Reverse-a-string/Lasso/reverse-a-string-1.lasso @@ -0,0 +1,2 @@ +local(input) = 'asdf' +#input->reverse diff --git a/Task/Reverse-a-string/Lasso/reverse-a-string-2.lasso b/Task/Reverse-a-string/Lasso/reverse-a-string-2.lasso new file mode 100644 index 0000000000..8d4f2249e2 --- /dev/null +++ b/Task/Reverse-a-string/Lasso/reverse-a-string-2.lasso @@ -0,0 +1,4 @@ +local(input = 'asdf', output = array) +with i in #input->values +do #output->insertFirst(#i) +#output->join diff --git a/Task/Reverse-a-string/Lingo/reverse-a-string-1.lingo b/Task/Reverse-a-string/Lingo/reverse-a-string-1.lingo new file mode 100644 index 0000000000..ff59614513 --- /dev/null +++ b/Task/Reverse-a-string/Lingo/reverse-a-string-1.lingo @@ -0,0 +1,7 @@ +on reverse (str) + res = "" + repeat with i = str.length down to 1 + put str.char[i] after res + end repeat + return res +end diff --git a/Task/Reverse-a-string/Lingo/reverse-a-string-2.lingo b/Task/Reverse-a-string/Lingo/reverse-a-string-2.lingo new file mode 100644 index 0000000000..6f911e2065 --- /dev/null +++ b/Task/Reverse-a-string/Lingo/reverse-a-string-2.lingo @@ -0,0 +1,8 @@ +on reverseBytes (str) + ba = byteArray(str) + res = byteArray() + repeat with i = ba.length down to 1 + res[res.length+1] = ba[i] + end repeat + return res +end diff --git a/Task/Reverse-a-string/LiveCode/reverse-a-string.livecode b/Task/Reverse-a-string/LiveCode/reverse-a-string.livecode new file mode 100644 index 0000000000..e763d3f8d6 --- /dev/null +++ b/Task/Reverse-a-string/LiveCode/reverse-a-string.livecode @@ -0,0 +1,6 @@ +function reverseString S + repeat with i = length(S) down to 1 + put char i of S after R + end repeat + return R +end reverseString diff --git a/Task/Reverse-a-string/Nim/reverse-a-string.nim b/Task/Reverse-a-string/Nim/reverse-a-string.nim new file mode 100644 index 0000000000..7e3d2d5e52 --- /dev/null +++ b/Task/Reverse-a-string/Nim/reverse-a-string.nim @@ -0,0 +1,39 @@ +import unicode + +proc reverse(s: var string) = + for i in 0 .. s.high div 2: + swap(s[i], s[s.high - i]) + +proc reversed(s: string): string = + result = newString(s.len) + for i,c in s: + result[s.high - i] = c + +proc uniReversed(s: string): string = + result = newStringOfCap(s.len) + var tmp: seq[Rune] = @[] + for r in runes(s): + tmp.add(r) + for i in countdown(tmp.high, 0): + result.add(toUtf8(tmp[i])) + +proc isComb(r: Rune): bool = + (r >=% Rune(0x300) and r <=% Rune(0x36f)) or + (r >=% Rune(0x1dc0) and r <=% Rune(0x1dff)) or + (r >=% Rune(0x20d0) and r <=% Rune(0x20ff)) or + (r >=% Rune(0xfe20) and r <=% Rune(0xfe2f)) + +proc uniReversedPreserving(s: string): string = + result = newStringOfCap(s.len) + var tmp: seq[Rune] = @[] + for r in runes(s): + if isComb(r): tmp.insert(r, tmp.high) + else: tmp.add(r) + for i in countdown(tmp.high, 0): + result.add(toUtf8(tmp[i])) + +for str in ["Reverse This!", "as⃝df̅"]: + echo "Original string: ", str + echo "Reversed: ", reversed(str) + echo "UniReversed: ", uniReversed(str) + echo "UniReversedPreserving: ", uniReversedPreserving(str) diff --git a/Task/Reverse-a-string/Oforth/reverse-a-string.oforth b/Task/Reverse-a-string/Oforth/reverse-a-string.oforth new file mode 100644 index 0000000000..3ddc7c0f63 --- /dev/null +++ b/Task/Reverse-a-string/Oforth/reverse-a-string.oforth @@ -0,0 +1 @@ +reverse diff --git a/Task/Reverse-a-string/Peloton/reverse-a-string-1.peloton b/Task/Reverse-a-string/Peloton/reverse-a-string-1.peloton new file mode 100644 index 0000000000..d267f6da1d --- /dev/null +++ b/Task/Reverse-a-string/Peloton/reverse-a-string-1.peloton @@ -0,0 +1 @@ +<# 显示 指定 变量 反转顺序 字串>集装箱|猫坐在垫子 diff --git a/Task/Reverse-a-string/Peloton/reverse-a-string-2.peloton b/Task/Reverse-a-string/Peloton/reverse-a-string-2.peloton new file mode 100644 index 0000000000..3933f09397 --- /dev/null +++ b/Task/Reverse-a-string/Peloton/reverse-a-string-2.peloton @@ -0,0 +1 @@ +<# 보이십 할당하 변물건 열거꾸 문자그>컨테이너|고양이가 매트 위에 앉아 diff --git a/Task/Reverse-a-string/Peloton/reverse-a-string-3.peloton b/Task/Reverse-a-string/Peloton/reverse-a-string-3.peloton new file mode 100644 index 0000000000..b7e8cf08b7 --- /dev/null +++ b/Task/Reverse-a-string/Peloton/reverse-a-string-3.peloton @@ -0,0 +1 @@ +<@ SAYLETVARREVLIT>集装箱|猫坐在垫子 diff --git a/Task/Reverse-a-string/Phix/reverse-a-string-1.phix b/Task/Reverse-a-string/Phix/reverse-a-string-1.phix new file mode 100644 index 0000000000..4f94623b1f --- /dev/null +++ b/Task/Reverse-a-string/Phix/reverse-a-string-1.phix @@ -0,0 +1 @@ +?reverse("asdf") diff --git a/Task/Reverse-a-string/Phix/reverse-a-string-2.phix b/Task/Reverse-a-string/Phix/reverse-a-string-2.phix new file mode 100644 index 0000000000..5c51baa37c --- /dev/null +++ b/Task/Reverse-a-string/Phix/reverse-a-string-2.phix @@ -0,0 +1,19 @@ +function unicode_reverse(string utf8) +sequence utf32 = utf8_to_utf32(utf8) +integer ch + -- the assumption is made that + -- and etc would work the same. + for i=1 to length(utf32) do + ch = utf32[i] + if (ch>=0x300 and ch<=0x36f) + or (ch>=0x1dc0 and ch<=0x1dff) + or (ch>=0x20d0 and ch<=0x20ff) + or (ch>=0xfe20 and ch<=0xfe2f) then + utf32[i] = utf32[i-1] + utf32[i-1] = ch + end if + end for + utf32 = reverse(utf32) + utf8 = utf32_to_utf8(utf32) + return utf8 +end function diff --git a/Task/Reverse-a-string/Ring/reverse-a-string.ring b/Task/Reverse-a-string/Ring/reverse-a-string.ring new file mode 100644 index 0000000000..c66ff0f5ec --- /dev/null +++ b/Task/Reverse-a-string/Ring/reverse-a-string.ring @@ -0,0 +1,3 @@ +cStr = "asdf" cStr2 = "" +for x = len(cStr) to 1 step -1 cStr2 += cStr[x] next +See cStr2 # fdsa diff --git a/Task/Reverse-a-string/SequenceL/reverse-a-string-1.sequencel b/Task/Reverse-a-string/SequenceL/reverse-a-string-1.sequencel new file mode 100644 index 0000000000..3d9aa95048 --- /dev/null +++ b/Task/Reverse-a-string/SequenceL/reverse-a-string-1.sequencel @@ -0,0 +1,3 @@ +import ; + +main(args(2)) := Sequence::reverse(args[1]); diff --git a/Task/Reverse-a-string/SequenceL/reverse-a-string-2.sequencel b/Task/Reverse-a-string/SequenceL/reverse-a-string-2.sequencel new file mode 100644 index 0000000000..7fe9eeeb75 --- /dev/null +++ b/Task/Reverse-a-string/SequenceL/reverse-a-string-2.sequencel @@ -0,0 +1,6 @@ +reverse : T(1) -> T(1); +reverse(list(1))[i] := + let + range := - ((1 ... size(list)) - (size(list) + 1)); + in + list[i] foreach i within range; diff --git a/Task/Reverse-a-string/Sidef/reverse-a-string.sidef b/Task/Reverse-a-string/Sidef/reverse-a-string.sidef new file mode 100644 index 0000000000..158499b166 --- /dev/null +++ b/Task/Reverse-a-string/Sidef/reverse-a-string.sidef @@ -0,0 +1,2 @@ +"asdf".reverse; # fdsa +"résumé niño".reverse; # oñin émusér diff --git a/Task/Reverse-a-string/Swift/reverse-a-string-1.swift b/Task/Reverse-a-string/Swift/reverse-a-string-1.swift new file mode 100644 index 0000000000..b814ed1d5c --- /dev/null +++ b/Task/Reverse-a-string/Swift/reverse-a-string-1.swift @@ -0,0 +1,5 @@ +func reverseString(s: String) -> String { + return String(s.characters.reverse()) +} +print(reverseString("asdf")) +print(reverseString("as⃝df̅")) diff --git a/Task/Reverse-a-string/Swift/reverse-a-string-2.swift b/Task/Reverse-a-string/Swift/reverse-a-string-2.swift new file mode 100644 index 0000000000..09ec5a00e7 --- /dev/null +++ b/Task/Reverse-a-string/Swift/reverse-a-string-2.swift @@ -0,0 +1,5 @@ +func reverseString(s: String) -> String { + return String(reverse(s)) +} +println(reverseString("asdf")) +println(reverseString("as⃝df̅")) diff --git a/Task/Reverse-a-string/Wart/reverse-a-string.wart b/Task/Reverse-a-string/Wart/reverse-a-string.wart new file mode 100644 index 0000000000..ef7da41453 --- /dev/null +++ b/Task/Reverse-a-string/Wart/reverse-a-string.wart @@ -0,0 +1 @@ +(rev "asdf") diff --git a/Task/Reverse-a-string/Wortel/reverse-a-string.wortel b/Task/Reverse-a-string/Wortel/reverse-a-string.wortel new file mode 100644 index 0000000000..8d98c91f15 --- /dev/null +++ b/Task/Reverse-a-string/Wortel/reverse-a-string.wortel @@ -0,0 +1,4 @@ +; the @rev operator reverses strings and arrays +@rev "abc" ; returns "cba" +; or the same thing using a pointer expression +!~r "abc" diff --git a/Task/Reverse-a-string/jq/reverse-a-string.jq b/Task/Reverse-a-string/jq/reverse-a-string.jq new file mode 100644 index 0000000000..118f94d9b6 --- /dev/null +++ b/Task/Reverse-a-string/jq/reverse-a-string.jq @@ -0,0 +1 @@ +def reverse_string: explode | reverse | implode; diff --git a/Task/Reverse-words-in-a-string/EchoLisp/reverse-words-in-a-string.echolisp b/Task/Reverse-words-in-a-string/EchoLisp/reverse-words-in-a-string.echolisp new file mode 100644 index 0000000000..ac2c956098 --- /dev/null +++ b/Task/Reverse-words-in-a-string/EchoLisp/reverse-words-in-a-string.echolisp @@ -0,0 +1,16 @@ +(define S #<< +---------- Ice and Fire ------------ + +fire, in end will world the say Some +ice. in say Some +desire of tasted I've what From +fire. favor who those with hold I + +... elided paragraph last ... + +Frost Robert ----------------------- +>>#) + +(for-each writeln + (for/list ((line (string-split S "\n"))) + (string-join (reverse (string-split line " ")) " "))) diff --git a/Task/Reverse-words-in-a-string/Elm/reverse-words-in-a-string.elm b/Task/Reverse-words-in-a-string/Elm/reverse-words-in-a-string.elm new file mode 100644 index 0000000000..c1526260ed --- /dev/null +++ b/Task/Reverse-words-in-a-string/Elm/reverse-words-in-a-string.elm @@ -0,0 +1,22 @@ +reversedPoem = + String.trim """ + ---------- Ice and Fire ------------ + + fire, in end will world the say Some + ice. in say Some + desire of tasted I've what From + fire. favor who those with hold I + + ... elided paragraph last ... + + Frost Robert ----------------------- + """ + +reverseWords string = + string |> String.words |> List.reverse |> String.join " " + +reverseLinesWords string = + string |> String.lines |> List.map reverseWords |> String.join "\n" + +poem = + reverseLinesWords reversedPoem diff --git a/Task/Reverse-words-in-a-string/FreeBASIC/reverse-words-in-a-string.freebasic b/Task/Reverse-words-in-a-string/FreeBASIC/reverse-words-in-a-string.freebasic new file mode 100644 index 0000000000..0c6bcb52cd --- /dev/null +++ b/Task/Reverse-words-in-a-string/FreeBASIC/reverse-words-in-a-string.freebasic @@ -0,0 +1,52 @@ +' FB 1.05.0 Win64 + +Sub split (s As String, sepList As String, result() As String, removeEmpty As Boolean = False) + If s = "" OrElse sepList = "" Then + Redim result(0) + result(0) = s + Return + End If + Dim As Integer i, j, count = 0, empty = 0, length + Dim As Integer position(Len(s) + 1) + position(0) = 0 + + For i = 0 To len(s) - 1 + For j = 0 to Len(sepList) - 1 + If s[i] = sepList[j] Then + count += 1 + position(count) = i + 1 + End If + Next j + Next i + + Redim result(count) + If count = 0 Then + result(0) = s + Return + End If + + position(count + 1) = len(s) + 1 + + For i = 1 To count + 1 + length = position(i) - position(i - 1) - 1 + result(i - 1 - empty) = Mid(s, position(i - 1) + 1, length) + If removeEmpty Andalso CBool(length = 0) Then empty += 1 + Next + + If empty > 0 Then Redim Preserve result(count - empty) +End Sub + +Dim s As String = "Hey you, Bub!" +Dim a() As String +split(s, " ", a(), true) +Dim reversed As String = "" +For i As Integer = UBound(a) To LBound(a) Step -1 + reversed += a(i) + If i > LBound(a) Then reversed += " " +Next + +Print "Original String = "; s +Print "Reversed String = "; reversed +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Reverse-words-in-a-string/LiveCode/reverse-words-in-a-string.livecode b/Task/Reverse-words-in-a-string/LiveCode/reverse-words-in-a-string.livecode new file mode 100644 index 0000000000..fc5896dac6 --- /dev/null +++ b/Task/Reverse-words-in-a-string/LiveCode/reverse-words-in-a-string.livecode @@ -0,0 +1,7 @@ +repeat for each line txtln in fld "Fieldtxt" + repeat with i = the number of words of txtln down to 1 + put word i of txtln & space after txtrev + end repeat + put cr after txtrev -- preserve line +end repeat +put txtrev diff --git a/Task/Reverse-words-in-a-string/LiveScript/reverse-words-in-a-string.live b/Task/Reverse-words-in-a-string/LiveScript/reverse-words-in-a-string.live new file mode 100644 index 0000000000..789edcd1ee --- /dev/null +++ b/Task/Reverse-words-in-a-string/LiveScript/reverse-words-in-a-string.live @@ -0,0 +1,17 @@ +poem = + """ + ---------- Ice and Fire ------------ + + fire, in end will world the say Some + ice. in say Some + desire of tasted I've what From + fire. favor who those with hold I + + ... elided paragraph last ... + + Frost Robert ----------------------- + """ + +reverse-words = (.split ' ') >> (.reverse!) >> (.join ' ') +reverse-string = (.split '\n') >> (.map reverse-words) >> (.join '\n') +reverse-string poem diff --git a/Task/Reverse-words-in-a-string/Nim/reverse-words-in-a-string.nim b/Task/Reverse-words-in-a-string/Nim/reverse-words-in-a-string.nim new file mode 100644 index 0000000000..d371a9f75a --- /dev/null +++ b/Task/Reverse-words-in-a-string/Nim/reverse-words-in-a-string.nim @@ -0,0 +1,27 @@ +import strutils + +let text = """---------- Ice and Fire ------------ + +fire, in end will world the say Some +ice. in say Some +desire of tasted I've what From +fire. favor who those with hold I + +... elided paragraph last ... + +Frost Robert -----------------------""" + +proc reversed*[T](a: openArray[T], first, last: int): seq[T] = + result = newSeq[T](last - first + 1) + var x = first + var y = last + while x <= last: + result[x] = a[y] + dec(y) + inc(x) + +proc reversed*[T](a: openArray[T]): seq[T] = + reversed(a, 0, a.high) + +for line in text.splitLines(): + echo line.split(' ').reversed().join(" ") diff --git a/Task/Reverse-words-in-a-string/Oforth/reverse-words-in-a-string.oforth b/Task/Reverse-words-in-a-string/Oforth/reverse-words-in-a-string.oforth new file mode 100644 index 0000000000..8328f64e83 --- /dev/null +++ b/Task/Reverse-words-in-a-string/Oforth/reverse-words-in-a-string.oforth @@ -0,0 +1,14 @@ +: revWords(s) + s words reverse unwords ; + +: reverseWords + "---------- Ice and Fire ------------" revWords println + " " revWords println + "fire, in end will world the say Some" revWords println + "ice. in say Some " revWords println + "desire of tasted I've what From " revWords println + "fire. favor who those with hold I " revWords println + " " revWords println + "... elided paragraph last ... " revWords println + " " revWords println + "Frost Robert -----------------------" revWords println ; diff --git a/Task/Reverse-words-in-a-string/Phix/reverse-words-in-a-string.phix b/Task/Reverse-words-in-a-string/Phix/reverse-words-in-a-string.phix new file mode 100644 index 0000000000..f25952455a --- /dev/null +++ b/Task/Reverse-words-in-a-string/Phix/reverse-words-in-a-string.phix @@ -0,0 +1,17 @@ +constant test=""" +---------- Ice and Fire ------------ + +fire, in end will world the say Some +ice. in say Some +desire of tasted I've what From +fire. favor who those with hold I + +... elided paragraph last ... + +Frost Robert ----------------------- +""" +sequence lines = split(test,'\n') +for i=1 to length(lines) do + lines[i] = join(reverse(split(lines[i]))) +end for +puts(1,join(lines,"\n")) diff --git a/Task/Reverse-words-in-a-string/Ring/reverse-words-in-a-string-1.ring b/Task/Reverse-words-in-a-string/Ring/reverse-words-in-a-string-1.ring new file mode 100644 index 0000000000..64226e6632 --- /dev/null +++ b/Task/Reverse-words-in-a-string/Ring/reverse-words-in-a-string-1.ring @@ -0,0 +1,17 @@ +aList = str2list(" +---------- Ice and Fire ------------ + +fire, in end will world the say Some +ice. in say Some +desire of tasted I've what From +fire. favor who those with hold I + +... elided paragraph last ... + +Frost Robert ----------------------- +") +aList = str2list(cStr) +for x in aList + x2 = substr(x," ",nl) alist2 = str2list(x2) aList2 = reverse(aList2) + for y in aList2 see y + " " next see nl +next diff --git a/Task/Reverse-words-in-a-string/Ring/reverse-words-in-a-string-2.ring b/Task/Reverse-words-in-a-string/Ring/reverse-words-in-a-string-2.ring new file mode 100644 index 0000000000..473d336b79 --- /dev/null +++ b/Task/Reverse-words-in-a-string/Ring/reverse-words-in-a-string-2.ring @@ -0,0 +1,9 @@ +------------ Fire and Ice ---------- + +Some say the world will end in fire, +Some say in ice. +From what I've tasted of desire +I hold with those who favor fire. + +... last paragraph elided ... +----------------------- Robert Frost diff --git a/Task/Reverse-words-in-a-string/Sidef/reverse-words-in-a-string.sidef b/Task/Reverse-words-in-a-string/Sidef/reverse-words-in-a-string.sidef new file mode 100644 index 0000000000..4c498819bb --- /dev/null +++ b/Task/Reverse-words-in-a-string/Sidef/reverse-words-in-a-string.sidef @@ -0,0 +1,13 @@ +DATA.each{|line| line.words.reverse.join(" ").say}; + +__DATA__ +---------- Ice and Fire ------------ + +fire, in end will world the say Some +ice. in say Some +desire of tasted I've what From +fire. favor who those with hold I + +... elided paragraph last ... + +Frost Robert ----------------------- diff --git a/Task/Reverse-words-in-a-string/Sparkling/reverse-words-in-a-string.sparkling b/Task/Reverse-words-in-a-string/Sparkling/reverse-words-in-a-string.sparkling new file mode 100644 index 0000000000..73d635c341 --- /dev/null +++ b/Task/Reverse-words-in-a-string/Sparkling/reverse-words-in-a-string.sparkling @@ -0,0 +1,20 @@ +let lines = split("---------- Ice and Fire ------------ + +fire, in end will world the say Some +ice. in say Some +desire of tasted I've what From +fire. favor who those with hold I + +... elided paragraph last ... + +Frost Robert -----------------------", "\n"); + +foreach(lines, function(idx, line) { + let words = split(line, " "); + let reverseWords = map(words, function(idx) { return words[sizeof words - idx - 1]; }); + foreach(reverseWords, function(idx, word) { + printf("%s ", word); + }); + + print(); +}); diff --git a/Task/Reverse-words-in-a-string/Swift/reverse-words-in-a-string.swift b/Task/Reverse-words-in-a-string/Swift/reverse-words-in-a-string.swift new file mode 100644 index 0000000000..d0b2beffff --- /dev/null +++ b/Task/Reverse-words-in-a-string/Swift/reverse-words-in-a-string.swift @@ -0,0 +1,21 @@ +import Foundation + +// convenience extension for better clarity +extension String { + var lines: [String] { + get { + return self.componentsSeparatedByCharactersInSet(NSCharacterSet.newlineCharacterSet()) + } + } + var words: [String] { + get { + return self.componentsSeparatedByCharactersInSet(NSCharacterSet.whitespaceCharacterSet()) + } + } +} + +let input = "---------- Ice and Fire ------------\n\nfire, in end will world the say Some\nice. in say Some\ndesire of tasted I've what From\nfire. favor who those with hold I\n\n... elided paragraph last ...\n\nFrost Robert -----------------------\n" + +let output = input.lines.map { $0.words.reverse().joinWithSeparator(" ") }.joinWithSeparator("\n") + +print(output) diff --git a/Task/Reverse-words-in-a-string/jq/reverse-words-in-a-string-1.jq b/Task/Reverse-words-in-a-string/jq/reverse-words-in-a-string-1.jq new file mode 100644 index 0000000000..61e383c912 --- /dev/null +++ b/Task/Reverse-words-in-a-string/jq/reverse-words-in-a-string-1.jq @@ -0,0 +1 @@ +split("[ \t\n\r]+") | reverse | join(" ") diff --git a/Task/Reverse-words-in-a-string/jq/reverse-words-in-a-string-2.jq b/Task/Reverse-words-in-a-string/jq/reverse-words-in-a-string-2.jq new file mode 100644 index 0000000000..e42d29b56a --- /dev/null +++ b/Task/Reverse-words-in-a-string/jq/reverse-words-in-a-string-2.jq @@ -0,0 +1,11 @@ +$ jq -R -r -M -f reverse_words.jq IceAndFire.txt +------------ Fire and Ice ---------- + +Some say the world will end in fire, +Some say in ice. +From what I've tasted of desire +I hold with those who favor fire. + +... last paragraph elided ... + +----------------------- Robert Frost diff --git a/Task/Rock-paper-scissors/Lasso/rock-paper-scissors.lasso b/Task/Rock-paper-scissors/Lasso/rock-paper-scissors.lasso new file mode 100644 index 0000000000..732d33dd9f --- /dev/null +++ b/Task/Rock-paper-scissors/Lasso/rock-paper-scissors.lasso @@ -0,0 +1,69 @@ +session_start('user') +session_addvar('user', 'historic_choices') +session_addvar('user', 'win_record') +session_addvar('user', 'plays') +var(historic_choices)->isNotA(::map) ? var(historic_choices = map('rock'=0, 'paper'=0, 'scissors'=0)) +var(plays)->isNotA(::integer) ? var(plays = 0) +var(win_record)->isNotA(::array) ? var(win_record = array) + +define br => '
' +define winner(c::string,p::string) => { + if(#c == $superior->find(#p)) => { + $win_record->insert('lasso') + return 'Lasso' + else(#p == $superior->find(#c)) + $win_record->insert('user') + return 'User' + else + $win_record->insert('tie') + return 'Nobody' + } + } + + var( + choice = web_request->param('choice')->asString, + lookup = array('rock', 'paper', 'scissors'), + computer_choice = $lookup->get(math_random(3,1)), + superior = map('rock'='paper', 'paper'='scissors', 'scissors'='rock'), + controls = '
Rock Paper Scissors Quit
' +) +if($choice == 'quit') => {^ + 'See ya. Start over' + session_end('user') + $historic_choices = map('rock'=0, 'paper'=0, 'scissors'=0) + $plays = 0 + $win_record = array + +else(array('rock','paper','scissors') >> $choice) + $controls + + if($plays != 0) => { + local('possibilities') = array + with i in $lookup do => { + loop($historic_choices->find(#i)) => { #possibilities->insert(#i) } + } + + $computer_choice = $superior->find(#possibilities->get(math_random($plays,1))) + } + + 'User chose ' + $choice + br + 'Lasso chose ' + $computer_choice + br + winner($computer_choice->asString, $choice) + ' wins!' + + $historic_choices->find($choice) = $historic_choices->find($choice)+1 + $plays += 1 + + else($choice->size == 0) + $controls + + else + 'Invalid Choice.'+ br + $controls +^} +if($win_record->size) => {^ + br + br + 'Win record: '+br + 'Lasso: '+($win_record->find('lasso')->size)+br + 'User: '+($win_record->find('user')->size)+br + 'Tie: '+($win_record->find('tie')->size)+br +^} diff --git a/Task/Rock-paper-scissors/Phix/rock-paper-scissors.phix b/Task/Rock-paper-scissors/Phix/rock-paper-scissors.phix new file mode 100644 index 0000000000..f40427894e --- /dev/null +++ b/Task/Rock-paper-scissors/Phix/rock-paper-scissors.phix @@ -0,0 +1,102 @@ +--standard game +constant rule3 = {"rock blunts scissors", + "paper wraps rock", + "scissors cut paper"} +--extended version +constant rule5 = {"rock blunts scissors", + "rock crushes lizard", + "paper wraps rock", + "paper disproves spock", + "scissors cut paper", + "scissors decapitate lizard", + "lizard eats paper", + "lizard poisons spock", + "spock smashes scissors", + "spock vaporizes rock"} + +constant rules = iff(rand(2)=1?rule3:rule5) + +sequence what = {} +sequence beats = {} +string wkeys = "" +string question = "What is your move " +integer choices, hsum +sequence history, cplays, pplays + +object x, verb, y + + for i=1 to length(rules) do + {x} = split(rules[i]) + if not find(x,what) then + what = append(what,x) + if find(x[1],wkeys) then + wkeys = append(wkeys,x[$]) + question &= x[1..-2]&"("&x[$]&"), " + else + wkeys = append(wkeys,x[1]) + question &= "("&x[1]&")"&x[2..$]&", " + end if + end if + end for + choices = length(wkeys) + history = repeat(1,choices) + hsum = 3 + cplays = repeat(0,choices) + pplays = repeat(0,choices) + beats = repeat(repeat(0,choices),choices) + question[-2] = '?' + for i=1 to length(rules) do + {x,verb,y} = split(rules[i]) + beats[find(x,what)][find(y,what)] = verb + end for + +integer cmove, pmove, draws = 0, pwins = 0, cwins = 0 + while 1 do + cmove = rand(hsum) + for i=1 to choices do + cmove -= history[i] + if cmove<=0 then + -- predicted user choice of i, find whatever beats it + for j=1 to choices do + if string(beats[j][i]) then + cmove = j + exit + end if + end for + exit + end if + end for + puts(1,question) + while 1 do + pmove = lower(wait_key()) + if pmove='q' then exit end if + pmove = find(pmove,wkeys) + if pmove!=0 then exit end if + end while + if pmove='q' then exit end if + + printf(1,"you: %s, me: %s, ",{what[pmove],what[cmove]}) + cplays[cmove] += 1 + pplays[pmove] += 1 + if cmove=pmove then + printf(1,"a draw.\n") + draws += 1 + else + if string(beats[cmove][pmove]) then + printf(1,"%s %s %s. I win.\n",{what[cmove],beats[cmove][pmove],what[pmove]}) + cwins += 1 + elsif string(beats[pmove][cmove]) then + printf(1,"%s %s %s. You win.\n",{what[pmove],beats[pmove][cmove],what[cmove]}) + pwins += 1 + else + ?9/0 -- sanity check + end if + end if + history[pmove] += 1 + hsum += 1 + end while + printf(1,"\n\nYour wins:%d, My wins:%d, Draws:%d\n",{pwins,cwins,draws}) + printf(1,"\n\nYour wins:%d, My wins:%d, Draws:%d\n",{pwins,cwins,draws}) + printf(1," ") for i=1 to choices do printf(1,"%9s",what[i]) end for + printf(1,"\nyou: ") for i=1 to choices do printf(1,"%9d",pplays[i]) end for + printf(1,"\n me: ") for i=1 to choices do printf(1,"%9d",cplays[i]) end for diff --git a/Task/Rock-paper-scissors/Sidef/rock-paper-scissors.sidef b/Task/Rock-paper-scissors/Sidef/rock-paper-scissors.sidef new file mode 100644 index 0000000000..46282796f1 --- /dev/null +++ b/Task/Rock-paper-scissors/Sidef/rock-paper-scissors.sidef @@ -0,0 +1,54 @@ +const rps = %w(r p s) + +const msg = [ + "Rock breaks scissors", + "Paper covers rock", + "Scissors cut paper", +] + +say <<"EOT"; +\n>> Rock Paper Scissors <<\n +** Enter 'r', 'p', or 's' as your play. +** Enter 'q' to exit the game. +** Running score shown as : +EOT + +var plays = 0 +var aScore = 0 +var pScore = 0 +var pcf = [0,0,0] # pcf = player choice frequency +var aChoice = 3.irand # ai choice for first play is completely random + +loop { + var pi = Sys.scanln("Play: ") + pi == 'q' && break + + var pChoice = rps.index(pi) + + if (pChoice == -1) { + STDERR.print("Invalid input!\n") + next + } + + ++pcf[pChoice] + ++plays + + # show result of play + ">> My play: %-8s".printf(rps[aChoice]) + + given ((aChoice - pChoice + 3) % 3) { + when (0) { say "Tie." } + when (1) { "%-*s %s".printlnf(30, msg[aChoice], 'My point'); aScore++ } + when (2) { "%-*s %s".printlnf(30, msg[pChoice], 'Your point'); pScore++ } + } + + # show score + "%-6s".printf("%d:%d" % (pScore, aScore)) + + # compute ai choice for next play + given (plays.irand) { |rn| + case (rn < pcf[0]) { aChoice = 1 } + case (pcf[0]+pcf[1] > rn) { aChoice = 2 } + default { aChoice = 0 } + } +} diff --git a/Task/Roman-numerals-Decode/Ceylon/roman-numerals-decode.ceylon b/Task/Roman-numerals-Decode/Ceylon/roman-numerals-decode.ceylon new file mode 100644 index 0000000000..9c73eda59b --- /dev/null +++ b/Task/Roman-numerals-Decode/Ceylon/roman-numerals-decode.ceylon @@ -0,0 +1,37 @@ +shared void run() { + + value numerals = map { + 'I' -> 1, + 'V' -> 5, + 'X' -> 10, + 'L' -> 50, + 'C' -> 100, + 'D' -> 500, + 'M' -> 1000 + }; + + function toHindu(String roman) { + variable value total = 0; + for(i->c in roman.indexed) { + assert(exists currentValue = numerals[c]); + /* Look at the next letter to see if we're looking + at a IV or CM or whatever. If so subtract the + current number from the total. */ + if(exists next = roman[i + 1], + exists nextValue = numerals[next], + currentValue < nextValue) { + total -= currentValue; + } else { + total += currentValue; + } + } + return total; + } + + assert(toHindu("I") == 1); + assert(toHindu("II") == 2); + assert(toHindu("IV") == 4); + assert(toHindu("MDCLXVI") == 1666); + assert(toHindu("MCMXC") == 1990); + assert(toHindu("MMVIII") == 2008); +} diff --git a/Task/Roman-numerals-Decode/ECL/roman-numerals-decode-1.ecl b/Task/Roman-numerals-Decode/ECL/roman-numerals-decode-1.ecl new file mode 100644 index 0000000000..ec873465af --- /dev/null +++ b/Task/Roman-numerals-Decode/ECL/roman-numerals-decode-1.ecl @@ -0,0 +1,18 @@ +MapChar(STRING1 c) := CASE(c,'M'=>1000,'D'=>500,'C'=>100,'L'=>50,'X'=>10,'V'=>5,'I'=>1,0); + +RomanDecode(STRING s) := FUNCTION + dsS := DATASET([{s}],{STRING Inp}); + R := { INTEGER2 i; }; + + R Trans1(dsS le,INTEGER pos) := TRANSFORM + SELF.i := MapChar(le.Inp[pos]) * IF ( MapChar(le.Inp[pos]) < MapChar(le.Inp[pos+1]), -1, 1 ); + END; + + RETURN SUM(NORMALIZE(dsS,LENGTH(TRIM(s)),Trans1(LEFT,COUNTER)),i); +END; + +RomanDecode('MCMLIV'); //1954 +RomanDecode('MCMXC'); //1990 +RomanDecode('MMVIII'); //2008 +RomanDecode('MDCLXVI'); //1666 +RomanDecode('MDLXVI'); //1566 diff --git a/Task/Roman-numerals-Decode/ECL/roman-numerals-decode-2.ecl b/Task/Roman-numerals-Decode/ECL/roman-numerals-decode-2.ecl new file mode 100644 index 0000000000..5c6c5da7fe --- /dev/null +++ b/Task/Roman-numerals-Decode/ECL/roman-numerals-decode-2.ecl @@ -0,0 +1,41 @@ +IMPORT STD; +RomanDecode(STRING s) := FUNCTION + SetWeights := [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]; + SetSymbols := ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']; + ProcessRec := RECORD + UNSIGNED val; + STRING Roman; + END; + dsSymbols := DATASET(13,TRANSFORM(ProcessRec,SELF.Roman := s, SELF := [])); + + RECORDOF(dsSymbols) XF(dsSymbols L, dsSymbols R, INTEGER C) := TRANSFORM + ThisRoman := IF(C=1,R.Roman,L.Roman); + IsDone := ThisRoman = ''; + Repeatable := C IN [1,5,9,13]; + SymSize := IF(C % 2 = 0, 2, 1); + IsNext := STD.Str.StartsWith(ThisRoman,SetSymbols[C]); + SymLen := IF(IsNext, + IF(NOT Repeatable, + SymSize, + MAP(NOT IsDone AND ThisRoman[1] = ThisRoman[2] AND ThisRoman[1] = ThisRoman[3] => 3, + NOT IsDone AND ThisRoman[1] = ThisRoman[2] => 2, + NOT IsDone => 1, + 0)), + 0); + + SymbolWeight(STRING s) := IF(NOT Repeatable, + SetWeights[C], + CHOOSE(LENGTH(s),SetWeights[C],SetWeights[C]*2,SetWeights[C]*3,0)); + + SELF.Roman := IF(IsDone,ThisRoman,ThisRoman[SymLen+1..]); + SELF.val := IF(IsDone,L.val,L.Val + IF(IsNext,SymbolWeight(ThisRoman[1..SymLen]),0)); + END; + i := ITERATE(dsSymbols,XF(LEFT,RIGHT,COUNTER)); + RETURN i[13].val; +END; + +RomanDecode('MCMLIV'); //1954 +RomanDecode('MCMXC'); //1990 +RomanDecode('MMVIII'); //2008 +RomanDecode('MDCLXVI'); //1666 +RomanDecode('MDLXVI'); //1566 diff --git a/Task/Roman-numerals-Decode/ERRE/roman-numerals-decode.erre b/Task/Roman-numerals-Decode/ERRE/roman-numerals-decode.erre new file mode 100644 index 0000000000..3e467f46bc --- /dev/null +++ b/Task/Roman-numerals-Decode/ERRE/roman-numerals-decode.erre @@ -0,0 +1,29 @@ +PROGRAM ROMAN2ARAB + +DIM R%[7] + +PROCEDURE TOARAB(ROMAN$->ANS%) + LOCAL I%,J%,P%,N% + FOR I%=LEN(ROMAN$) TO 1 STEP -1 DO + J%=INSTR("IVXLCDM",MID$(ROMAN$,I%,1)) + IF J%=0 THEN + ANS%=-9999 ! illegal character + EXIT PROCEDURE + END IF + IF J%>=P% THEN + N%+=R%[J%] + ELSE + N%-=R%[J%] + END IF + P%=J% + END FOR + ANS%=N% +END PROCEDURE + +BEGIN + R%[]=(0,1,5,10,50,100,500,1000) + TOARAB("MCMXCIX"->ANS%) PRINT(ANS%) + TOARAB("MMXII"->ANS%) PRINT(ANS%) + TOARAB("MDCLXVI"->ANS%) PRINT(ANS%) + TOARAB("MMMDCCCLXXXVIII"->ANS%) PRINT(ANS%) +END PROGRAM diff --git a/Task/Roman-numerals-Decode/FreeBASIC/roman-numerals-decode.freebasic b/Task/Roman-numerals-Decode/FreeBASIC/roman-numerals-decode.freebasic new file mode 100644 index 0000000000..8b6e429940 --- /dev/null +++ b/Task/Roman-numerals-Decode/FreeBASIC/roman-numerals-decode.freebasic @@ -0,0 +1,62 @@ +' FB 1.05.0 Win64 + +Function romanDecode(roman As Const String) As Integer + If roman = "" Then Return 0 '' zero denotes invalid roman number + Dim roman1(0 To 2) As String = {"MMM", "MM", "M"} + Dim roman2(0 To 8) As String = {"CM", "DCCC", "DCC", "DC", "D", "CD", "CCC", "CC", "C"} + Dim roman3(0 To 8) As String = {"XC", "LXXX", "LXX", "LX", "L", "XL", "XXX", "XX", "X"} + Dim roman4(0 To 8) As String = {"IX", "VIII", "VII", "VI", "V", "IV", "III", "II", "I"} + Dim As Integer i, value = 0, length = 0 + Dim r As String = UCase(roman) + + For i = 0 To 2 + If Left(r, Len(roman1(i))) = roman1(i) Then + value += 1000 * (3 - i) + length = Len(roman1(i)) + r = Mid(r, length + 1) + length = 0 + Exit For + End If + Next + + For i = 0 To 8 + If Left(r, Len(roman2(i))) = roman2(i) Then + value += 100 * (9 - i) + length = Len(roman2(i)) + r = Mid(r, length + 1) + length = 0 + Exit For + End If + Next + + For i = 0 To 8 + If Left(r, Len(roman3(i))) = roman3(i) Then + value += 10 * (9 - i) + length = Len(roman3(i)) + r = Mid(r, length + 1) + length = 0 + Exit For + End If + Next + + For i = 0 To 8 + If Left(r, Len(roman4(i))) = roman4(i) Then + value += 9 - i + length = Len(roman4(i)) + Exit For + End If + Next + + ' Can't be a valid roman number if there are any characters left + If Len(r) > length Then Return 0 + Return value +End Function + +Dim a(2) As String = {"MCMXC", "MMVIII" , "MDCLXVI"} +For i As Integer = 0 To 2 + Print a(i); Tab(8); " =>"; romanDecode(a(i)) +Next + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Roman-numerals-Decode/FutureBasic/roman-numerals-decode.futurebasic b/Task/Roman-numerals-Decode/FutureBasic/roman-numerals-decode.futurebasic new file mode 100644 index 0000000000..f1282dc057 --- /dev/null +++ b/Task/Roman-numerals-Decode/FutureBasic/roman-numerals-decode.futurebasic @@ -0,0 +1,28 @@ +local fn RomantoDecimal( roman as Str15 ) as short +dim as short i, n, preNum, num + +preNum = 0 : num = 0 + +for i = roman[0] to 1 step -1 + n = 0 + if roman[i] = _"M" then n = 1000 + if roman[i] = _"D" then n = 500 + if roman[i] = _"C" then n = 100 + if roman[i] = _"L" then n = 50 + if roman[i] = _"X" then n = 10 + if roman[i] = _"V" then n = 5 + if roman[i] = _"I" then n = 1 + if n < preNum then num = num - n else num = num + n + preNum = n +next +end fn = num + +print " MCMXC ="; fn RomantoDecimal( "MCMXC" ) +print " MMVIII ="; fn RomantoDecimal( "MMVIII" ) +print " MMXVI ="; fn RomantoDecimal( "MMXVI" ) +print "MDCLXVI ="; fn RomantoDecimal( "MDCLXVI" ) +print " MCMXIV ="; fn RomantoDecimal( "MCMXIV" ) +print " DXIII ="; fn RomantoDecimal( "DXIII" ) +print " M ="; fn RomantoDecimal( "M" ) +print " DXIII ="; fn RomantoDecimal( "DXIII" ) +print " XXXIII ="; fn RomantoDecimal( "XXXIII" ) diff --git a/Task/Roman-numerals-Decode/Lasso/roman-numerals-decode.lasso b/Task/Roman-numerals-Decode/Lasso/roman-numerals-decode.lasso new file mode 100644 index 0000000000..e032398bc1 --- /dev/null +++ b/Task/Roman-numerals-Decode/Lasso/roman-numerals-decode.lasso @@ -0,0 +1,23 @@ +define br => '\r' +//decode roman +define decodeRoman(roman::string)::integer => { + local(ref = array('M'=1000, 'CM'=900, 'D'=500, 'CD'=400, 'C'=100, 'XC'=90, 'L'=50, 'XL'=40, 'X'=10, 'IX'=9, 'V'=5, 'IV'=4, 'I'=1)) + local(out = integer) + while(#roman->size) => { + // need to use neset while instead of query expr to utilize loop_abort + while(loop_count <= #ref->size) => { + if(#roman->beginswith(#ref->get(loop_count)->first)) => { + #out += #ref->get(loop_count)->second + #roman->remove(1,#ref->get(loop_count)->first->size) + loop_abort + } + } + } + return #out +} + +'MCMXC as integer is '+decodeRoman('MCMXC') +br +'MMVIII as integer is '+decodeRoman('MMVIII') +br +'MDCLXVI as integer is '+decodeRoman('MDCLXVI') diff --git a/Task/Roman-numerals-Decode/LiveScript/roman-numerals-decode.live b/Task/Roman-numerals-Decode/LiveScript/roman-numerals-decode.live new file mode 100644 index 0000000000..7e8485c494 --- /dev/null +++ b/Task/Roman-numerals-Decode/LiveScript/roman-numerals-decode.live @@ -0,0 +1,13 @@ +require! 'prelude-ls': {fold, sum} + +# String → Number +decimal_of_roman = do + # [Number, Number] → String → [Number, Number] + _convert = ([acc, last_value], ch) -> + current_value = { M:1000 D:500 C:100 L:50 X:10 V:5 I:1 }[ch] ? 0 + op = if last_value < current_value then (-) else (+) + [op(acc, last_value), current_value] + # fold the string and sum the resulting tuple (array) + fold(_convert, [0, 0]) >> sum + +{[rom, decimal_of_roman rom] for rom in <[ MCMXC MMVII MDCLXVII MMMCLIX MCMLXXVII MMX ]>} diff --git a/Task/Roman-numerals-Decode/Nim/roman-numerals-decode.nim b/Task/Roman-numerals-Decode/Nim/roman-numerals-decode.nim new file mode 100644 index 0000000000..57f413c4a2 --- /dev/null +++ b/Task/Roman-numerals-Decode/Nim/roman-numerals-decode.nim @@ -0,0 +1,12 @@ +import tables + +let rdecode = {'M': 1000, 'D': 500, 'C': 100, 'L': 50, 'X': 10, 'V': 5, 'I': 1}.toTable + +proc decode(roman): int = + for i in 0 .. Roman numbers converter" + Author: "Didier Cadieu" + Date: "07-Oct-2016" +] + +table-r2a: reverse [1000 "M" 900 "CM" 500 "D" 400 "CD" 100 "C" 90 "XC" 50 "L" 40 "XL" 10 "X" 9 "IX" 5 "V" 4 "IV" 1 "I"] + +roman-to-arabic: func [r [string!] /local a b e] [ + a: 0 + parse r [any [b: ["I" ["V" | "X" | none] | "X" ["L" | "C" | none] | "C" ["D" | "M" | none] | "V" | "L" | "D" | "M"] e: (a: a + select table-r2a copy/part b e)]] + a +] + +; Example usage: +print roman-to-arabic "XXXIII" +print roman-to-arabic "MDCCCLXXXVIII" +print roman-to-arabic "MMXVI" diff --git a/Task/Roman-numerals-Decode/Ring/roman-numerals-decode.ring b/Task/Roman-numerals-Decode/Ring/roman-numerals-decode.ring new file mode 100644 index 0000000000..1c194f009f --- /dev/null +++ b/Task/Roman-numerals-Decode/Ring/roman-numerals-decode.ring @@ -0,0 +1,21 @@ +symbols = "MDCLXVI" +weights = [1000,500,100,50,10,5,1] + +see "MCMXCIX = " + romanDec("MCMXCIX") + nl +see "MDCLXVI =" + romanDec("MDCLXVI") + nl +see "XXV = " + romanDec("XXV") + nl +see "CMLIV = " + romanDec("CMLIV") + nl +see "MMXI = " + romanDec("MMXI") + nl + +func romanDec roman + n = 0 + lastval = 0 + arabic = 0 + for i = len(roman) to 1 step -1 + n = substr(symbols,roman[i]) + if n > 0 n = weights[n] ok + if n < lastval arabic = arabic - n + else arabic = arabic + n ok + lastval = n + next + return arabic diff --git a/Task/Roman-numerals-Decode/Sidef/roman-numerals-decode-1.sidef b/Task/Roman-numerals-Decode/Sidef/roman-numerals-decode-1.sidef new file mode 100644 index 0000000000..c7f679c17a --- /dev/null +++ b/Task/Roman-numerals-Decode/Sidef/roman-numerals-decode-1.sidef @@ -0,0 +1,28 @@ +func roman2arabic(roman) { + + var arabic = 0; + var last_digit = 1000; + + static m = Hash.new( + I => 1, + V => 5, + X => 10, + L => 50, + C => 100, + D => 500, + M => 1000, + ); + + roman.uc.split('').map{m{_} \\ 0}.each { |digit| + last_digit < digit && ( + arabic -= (2 * last_digit); + ); + arabic += (last_digit = digit); + } + + return arabic; +} + +%w(MCMXC MMVIII MDCLXVI).each { |roman_digit| + "%-10s == %d\n".printf(roman_digit, roman2arabic(roman_digit)); +} diff --git a/Task/Roman-numerals-Decode/Sidef/roman-numerals-decode-2.sidef b/Task/Roman-numerals-Decode/Sidef/roman-numerals-decode-2.sidef new file mode 100644 index 0000000000..da9b32d38f --- /dev/null +++ b/Task/Roman-numerals-Decode/Sidef/roman-numerals-decode-2.sidef @@ -0,0 +1,21 @@ +func roman2arabic(digit) { + digit.uc.trans([ + :M: '1000+', + :CM: '900+', + :D: '500+', + :CD: '400+', + :C: '100+', + :XC: '90+', + :L: '50+', + :XL: '40+', + :X: '10+', + :IX: '9+', + :V: '5+', + :IV: '4+', + :I: '1+', + ]).split('+').map{.to_i}.sum; +} + +%w(MCMXC MMVIII MDCLXVI).each { |roman_num| + say "#{roman_num}\t-> #{roman2arabic(roman_num)}"; +} diff --git a/Task/Roman-numerals-Decode/Swift/roman-numerals-decode-1.swift b/Task/Roman-numerals-Decode/Swift/roman-numerals-decode-1.swift new file mode 100644 index 0000000000..1df17cbf30 --- /dev/null +++ b/Task/Roman-numerals-Decode/Swift/roman-numerals-decode-1.swift @@ -0,0 +1,28 @@ +func rtoa(var str: String) -> Int { + + var result = 0 + + for (value, letter) in + [( 1000, "M"), + ( 900, "CM"), + ( 500, "D"), + ( 400, "CD"), + ( 100, "C"), + ( 90, "XC"), + ( 50, "L"), + ( 40, "XL"), + ( 10, "X"), + ( 9, "IX"), + ( 5, "V"), + ( 4, "IV"), + ( 1, "I")] + { + while str.hasPrefix(letter) { + result += value + str = str[advance(str.startIndex, count(letter)) ..< str.endIndex] + } + } + return result +} + +println(rtoa("MDCLXVI")) // 1666 diff --git a/Task/Roman-numerals-Decode/Swift/roman-numerals-decode-2.swift b/Task/Roman-numerals-Decode/Swift/roman-numerals-decode-2.swift new file mode 100644 index 0000000000..34acacda66 --- /dev/null +++ b/Task/Roman-numerals-Decode/Swift/roman-numerals-decode-2.swift @@ -0,0 +1,33 @@ +func rtoa(var str: String) -> Int { + + var result = 0 + + for (value, letter) in + + [ ( 1000, "M"), + ( 900, "CM"), + ( 500, "D"), + ( 400, "CD"), + ( 100, "C"), + ( 90, "XC"), + ( 50, "L"), + ( 40, "XL"), + ( 10, "X"), + ( 9, "IX"), + ( 5, "V"), + ( 4, "IV"), + ( 1, "I")] + { + while str.hasPrefix(letter) { + + let first = str.startIndex + let count = letter.characters.count + str.removeRange(first ..< first.advancedBy(count)) + + result += value + } + } + return result +} + +print(rtoa("MDCLXVI")) // 1666 diff --git a/Task/Roman-numerals-Decode/XLISP/roman-numerals-decode-1.xlisp b/Task/Roman-numerals-Decode/XLISP/roman-numerals-decode-1.xlisp new file mode 100644 index 0000000000..f1edafa08b --- /dev/null +++ b/Task/Roman-numerals-Decode/XLISP/roman-numerals-decode-1.xlisp @@ -0,0 +1,10 @@ +(defun decode (r) + (define roman '((#\m 1000) (#\d 500) (#\c 100) (#\l 50) (#\x 10) (#\v 5) (#\i 1))) + (defun to-arabic (rn rs a) + (cond + ((null rn) a) + ((eqv? (car rn) (caar rs)) (to-arabic (cdr rn) roman (if (and (not (eqv? (car rn) (cadr rn))) (< (cadar rs) (to-arabic (cdr rn) roman 0))) + (- a (cadar rs)) + (+ a (cadar rs)) ) ) ) + (t (to-arabic rn (cdr rs) a)) ) ) + (to-arabic (string->list r) roman 0) ) diff --git a/Task/Roman-numerals-Decode/XLISP/roman-numerals-decode-2.xlisp b/Task/Roman-numerals-Decode/XLISP/roman-numerals-decode-2.xlisp new file mode 100644 index 0000000000..cabfcadfe4 --- /dev/null +++ b/Task/Roman-numerals-Decode/XLISP/roman-numerals-decode-2.xlisp @@ -0,0 +1,3 @@ +[1] (mapcar decode '("mcmxc" "mmviii" "mdclxvi")) + +(1990 2008 1666) diff --git a/Task/Roman-numerals-Decode/jq/roman-numerals-decode-1.jq b/Task/Roman-numerals-Decode/jq/roman-numerals-decode-1.jq new file mode 100644 index 0000000000..3268b2abe8 --- /dev/null +++ b/Task/Roman-numerals-Decode/jq/roman-numerals-decode-1.jq @@ -0,0 +1,20 @@ +def fromRoman: + def addRoman(n): + if length == 0 then n + elif startswith("M") then .[1:] | addRoman(1000 + n) + elif startswith("CM") then .[2:] | addRoman(900 + n) + elif startswith("D") then .[1:] | addRoman(500 + n) + elif startswith("CD") then .[2:] | addRoman(400 + n) + elif startswith("C") then .[1:] | addRoman(100 + n) + elif startswith("XC") then .[2:] | addRoman(90 + n) + elif startswith("L") then .[1:] | addRoman(50 + n) + elif startswith("XL") then .[2:] | addRoman(40 + n) + elif startswith("X") then .[1:] | addRoman(10 + n) + elif startswith("IX") then .[2:] | addRoman(9 + n) + elif startswith("V") then .[1:] | addRoman(5 + n) + elif startswith("IV") then .[2:] | addRoman(4 + n) + elif startswith("I") then .[1:] | addRoman(1 + n) + else + error("invalid Roman numeral: " + tostring) + end; + addRoman(0); diff --git a/Task/Roman-numerals-Decode/jq/roman-numerals-decode-2.jq b/Task/Roman-numerals-Decode/jq/roman-numerals-decode-2.jq new file mode 100644 index 0000000000..b5d0fc60d4 --- /dev/null +++ b/Task/Roman-numerals-Decode/jq/roman-numerals-decode-2.jq @@ -0,0 +1 @@ +[ "MCMXC", "MMVIII", "MDCLXVI" ] | map("\(.) => \(fromRoman)") | .[] diff --git a/Task/Roman-numerals-Decode/jq/roman-numerals-decode-3.jq b/Task/Roman-numerals-Decode/jq/roman-numerals-decode-3.jq new file mode 100644 index 0000000000..3cee48a1e8 --- /dev/null +++ b/Task/Roman-numerals-Decode/jq/roman-numerals-decode-3.jq @@ -0,0 +1,4 @@ +$ jq -n -f -r fromRoman.jq +MCMXC => 1990 +MMVIII => 2008 +MDCLXVI => 1666 diff --git a/Task/Roman-numerals-Encode/Ceylon/roman-numerals-encode.ceylon b/Task/Roman-numerals-Encode/Ceylon/roman-numerals-encode.ceylon new file mode 100644 index 0000000000..2acdeb9750 --- /dev/null +++ b/Task/Roman-numerals-Encode/Ceylon/roman-numerals-encode.ceylon @@ -0,0 +1,31 @@ +shared void run() { + + class Numeral(shared Character char, shared Integer int) {} + + value tiers = [ + [Numeral('I', 1), Numeral('V', 5), Numeral('X', 10)], + [Numeral('X', 10), Numeral('L', 50), Numeral('C', 100)], + [Numeral('C', 100), Numeral('D', 500), Numeral('M', 1k)] + ]; + + + String toRoman(Integer hindu, Integer power = 2) { + assert(exists tier = tiers[power]); + if(hindu <= 0) { + return ""; + } else if(exists num = tier.rest.find((Numeral elem) => elem.int - tier.first.int <= hindu < elem.int)) { + return "``tier.first.char````num.char````toRoman(hindu - (num.int - tier.first.int), power)``"; + } else if(exists num = tier.reversed.find((Numeral elem) => hindu >= elem.int)) { + return "``num.char````toRoman(hindu - num.int, power)``"; + } else { + return toRoman(hindu, power - 1); + } + } + + assert(toRoman(1) == "I"); + assert(toRoman(2) == "II"); + assert(toRoman(4) == "IV"); + assert(toRoman(1666) == "MDCLXVI"); + assert(toRoman(1990) == "MCMXC"); + assert(toRoman(2008) == "MMVIII"); +} diff --git a/Task/Roman-numerals-Encode/ECL/roman-numerals-encode.ecl b/Task/Roman-numerals-Encode/ECL/roman-numerals-encode.ecl new file mode 100644 index 0000000000..b5abaf2e64 --- /dev/null +++ b/Task/Roman-numerals-Encode/ECL/roman-numerals-encode.ecl @@ -0,0 +1,25 @@ +RomanEncode(UNSIGNED Int) := FUNCTION + SetWeights := [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]; + SetSymbols := ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']; + ProcessRec := RECORD + UNSIGNED val; + STRING Roman; + END; + dsWeights := DATASET(13,TRANSFORM(ProcessRec,SELF.val := Int, SELF := [])); + + SymbolStr(i,n,STRING s) := CHOOSE(n+1,'',SetSymbols[i],SetSymbols[i]+SetSymbols[i],SetSymbols[i]+SetSymbols[i]+SetSymbols[i],s); + + RECORDOF(dsWeights) XF(dsWeights L, dsWeights R, INTEGER C) := TRANSFORM + ThisVal := IF(C=1,R.Val,L.Val); + IsDone := ThisVal = 0; + SELF.Roman := IF(IsDone,L.Roman,L.Roman + SymbolStr(C,ThisVal DIV SetWeights[C],L.Roman)); + SELF.val := IF(IsDone,0,ThisVal - ((ThisVal DIV SetWeights[C])*SetWeights[C])); + END; + i := ITERATE(dsWeights,XF(LEFT,RIGHT,COUNTER)); + RETURN i[13].Roman; +END; + +RomanEncode(1954); //MCMLIV +RomanEncode(1990 ); //MCMXC +RomanEncode(2008 ); //MMVIII +RomanEncode(1666); //MDCLXVI diff --git a/Task/Roman-numerals-Encode/ERRE/roman-numerals-encode.erre b/Task/Roman-numerals-Encode/ERRE/roman-numerals-encode.erre new file mode 100644 index 0000000000..9f0d002819 --- /dev/null +++ b/Task/Roman-numerals-Encode/ERRE/roman-numerals-encode.erre @@ -0,0 +1,25 @@ +PROGRAM ARAB2ROMAN + +DIM ARABIC%[12],ROMAN$[12] + +PROCEDURE TOROMAN(VALUE->ANS$) +LOCAL RESULT$ + FOR I%=0 TO 12 DO + WHILE VALUE>=ARABIC%[I%] DO + RESULT$+=ROMAN$[I%] + VALUE-=ARABIC%[I%] + END WHILE + END FOR + ANS$=RESULT$ +END PROCEDURE + +BEGIN +! +!Testing +! + ARABIC%[]=(1000,900,500,400,100,90,50,40,10,9,5,4,1) + ROMAN$[]=("M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I") + TOROMAN(2009->ANS$) PRINT("2009 = ";ANS$) + TOROMAN(1666->ANS$) PRINT("1666 = ";ANS$) + TOROMAN(3888->ANS$) PRINT("3888 = ";ANS$) +END PROGRAM diff --git a/Task/Roman-numerals-Encode/FreeBASIC/roman-numerals-encode.freebasic b/Task/Roman-numerals-Encode/FreeBASIC/roman-numerals-encode.freebasic new file mode 100644 index 0000000000..91e46daa77 --- /dev/null +++ b/Task/Roman-numerals-Encode/FreeBASIC/roman-numerals-encode.freebasic @@ -0,0 +1,31 @@ +' FB 1.05.0 Win64 + +Function romanEncode(n As Integer) As String + If n < 1 OrElse n > 3999 Then Return "" '' can only encode numbers in range 1 to 3999 + Dim roman1(0 To 2) As String = {"MMM", "MM", "M"} + Dim roman2(0 To 8) As String = {"CM", "DCCC", "DCC", "DC", "D", "CD", "CCC", "CC", "C"} + Dim roman3(0 To 8) As String = {"XC", "LXXX", "LXX", "LX", "L", "XL", "XXX", "XX", "X"} + Dim roman4(0 To 8) As String = {"IX", "VIII", "VII", "VI", "V", "IV", "III", "II", "I"} + Dim As Integer thousands, hundreds, tens, units + thousands = n \ 1000 + n Mod= 1000 + hundreds = n \ 100 + n Mod= 100 + tens = n \ 10 + units = n Mod 10 + Dim roman As String = "" + If thousands > 0 Then roman += roman1(3 - thousands) + If hundreds > 0 Then roman += roman2(9 - hundreds) + If tens > 0 Then roman += roman3(9 - tens) + If units > 0 Then roman += roman4(9 - units) + Return roman +End Function + +Dim a(2) As Integer = {1990, 2008, 1666} +For i As Integer = 0 To 2 + Print a(i); " => "; romanEncode(a(i)) +Next + +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Roman-numerals-Encode/FutureBasic/roman-numerals-encode.futurebasic b/Task/Roman-numerals-Encode/FutureBasic/roman-numerals-encode.futurebasic new file mode 100644 index 0000000000..89b1516d8e --- /dev/null +++ b/Task/Roman-numerals-Encode/FutureBasic/roman-numerals-encode.futurebasic @@ -0,0 +1,34 @@ +include "ConsoleWindow" + +local fn DecimaltoRoman( decimal as short ) as Str15 +dim as short arabic(12) +dim as Str15 roman(12) +dim as long i +dim as Str15 result : result = "" + +arabic(0) = 1000 : arabic(1) = 900 : arabic(2) = 500 : arabic(3) = 400 +arabic(4) = 100 : arabic(5) = 90 : arabic(6) = 50 : arabic(7) = 40 +arabic(8) = 10 : arabic(9) = 9 : arabic(10) = 5 : arabic(11) = 4: arabic(12) = 1 + +roman(0) = "M" : roman(1) = "CM" : roman(2) = "D" : roman(3) = "CD" +roman(4) = "C" : roman(5) = "XC" : roman(6) = "L" : roman(7) = "XL" +roman(8) = "X" : roman(9) = "IX" : roman(10) = "V" : roman(11) = "IV" : roman(12) = "I" + +for i = 0 to 12 + while ( decimal >= arabic(i) ) + result = result + roman(i) + decimal = decimal - arabic(i) + wend +next i +if result == "" then result = "Zepherium" +end fn = result + +print "1990 = "; fn DecimaltoRoman( 1990 ) +print "2008 = "; fn DecimaltoRoman( 2008 ) +print "2016 = "; fn DecimaltoRoman( 2016 ) +print "1666 = "; fn DecimaltoRoman( 1666 ) +print "3888 = "; fn DecimaltoRoman( 3888 ) +print "1914 = "; fn DecimaltoRoman( 1914 ) +print "1000 = "; fn DecimaltoRoman( 1000 ) +print " 513 = "; fn DecimaltoRoman( 513 ) +print " 33 = "; fn DecimaltoRoman( 33 ) diff --git a/Task/Roman-numerals-Encode/Lasso/roman-numerals-encode.lasso b/Task/Roman-numerals-Encode/Lasso/roman-numerals-encode.lasso new file mode 100644 index 0000000000..a7afe6b78d --- /dev/null +++ b/Task/Roman-numerals-Encode/Lasso/roman-numerals-encode.lasso @@ -0,0 +1,19 @@ +define br => '\r' +// encode roman +define encodeRoman(num::integer)::string => { + local(ref = array('M'=1000, 'CM'=900, 'D'=500, 'CD'=400, 'C'=100, 'XC'=90, 'L'=50, 'XL'=40, 'X'=10, 'IX'=9, 'V'=5, 'IV'=4, 'I'=1)) + local(out = string) + with i in #ref do => { + while(#num >= #i->second) => { + #out->append(#i->first) + #num -= #i->second + } + } + return #out +} + +'1990 in roman is '+encodeRoman(1990) +br +'2008 in roman is '+encodeRoman(2008) +br +'1666 in roman is '+encodeRoman(1666) diff --git a/Task/Roman-numerals-Encode/LiveCode/roman-numerals-encode.livecode b/Task/Roman-numerals-Encode/LiveCode/roman-numerals-encode.livecode new file mode 100644 index 0000000000..78e7b2d4b1 --- /dev/null +++ b/Task/Roman-numerals-Encode/LiveCode/roman-numerals-encode.livecode @@ -0,0 +1,22 @@ +function toRoman intNum + local roman,numArabic + put "M,CM,D,CD,C,XC,L,XL,X,IX,V,IV,I" into romans + put "1000,900,500,400,100,90,50,40,10,9,5,4,1" into arabics + put intNum into numArabic + repeat with n = 1 to the number of items of romans + put numArabic div item n of arabics into nums + if nums > 0 then + put repeatChar(item n of romans,nums) after roman + add -(nums * item n of arabics) to numArabic + end if + end repeat +return roman +end toRoman + +function repeatChar c n + local cc + repeat n times + put c after cc + end repeat + return cc +end repeatChar diff --git a/Task/Roman-numerals-Encode/Nim/roman-numerals-encode.nim b/Task/Roman-numerals-Encode/Nim/roman-numerals-encode.nim new file mode 100644 index 0000000000..be19348867 --- /dev/null +++ b/Task/Roman-numerals-Encode/Nim/roman-numerals-encode.nim @@ -0,0 +1,17 @@ +import strutils + +const nums = [(1000, "M"), (900, "CM"), (500, "D"), (400, "CD"), (100, "C"), (90, "XC"), + (50, "L"), (40, "XL"), (10, "X"), (9, "IX"), (5, "V"), (4, "IV"), (1, "I")] + +proc toRoman(x): string = + var x = x + result = "" + for a,r in items(nums): + result.add(repeatStr(x div a, r)) + x = x mod a + +for i in [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,25,30,40, + 50,60,69,70,80,90,99,100,200,300,400,500,600,666,700,800,900, + 1000,1009,1444,1666,1945,1997,1999,2000,2008,2010,2011,2500, + 3000,3999]: + echo toRoman(i) diff --git a/Task/Roman-numerals-Encode/Oforth/roman-numerals-encode.oforth b/Task/Roman-numerals-Encode/Oforth/roman-numerals-encode.oforth new file mode 100644 index 0000000000..a714727c5e --- /dev/null +++ b/Task/Roman-numerals-Encode/Oforth/roman-numerals-encode.oforth @@ -0,0 +1,6 @@ +[ [1000,"M"], [900,"CM"], [500,"D"], [400,"CD"], [100,"C"], [90,"XC"], [50,"L"], [40,"XL"], [10,"X"], [9,"IX"], [5,"V"], [4,"IV"], [1,"I"] ] const: Romans + +: roman(n) +| r | + StringBuffer new + Romans forEach: r [ while(r first n <=) [ r second << n r first - ->n ] ] ; diff --git a/Task/Roman-numerals-Encode/Peloton/roman-numerals-encode-1.peloton b/Task/Roman-numerals-Encode/Peloton/roman-numerals-encode-1.peloton new file mode 100644 index 0000000000..fe4922fcc7 --- /dev/null +++ b/Task/Roman-numerals-Encode/Peloton/roman-numerals-encode-1.peloton @@ -0,0 +1,5 @@ +<@ DEFUDOLITLIT>_RO|__Transformer|<@ DEFKEYPAR>__NationalNumericID|2<@ LETRESCS%NNMPAR>...|1 + +<@ ENU$$DLSTLITLIT>1990,2008,1,2,64,124,1666,10001|,| +<@ SAYELTLST>... is <@ SAY_ROELTLSTLIT>...|RomanLowerUnicode <@ SAY_ROELTLSTLIT>...|RomanUpperUnicode <@ SAY_ROELTLSTLIT>...|RomanASCII + diff --git a/Task/Roman-numerals-Encode/Peloton/roman-numerals-encode-2.peloton b/Task/Roman-numerals-Encode/Peloton/roman-numerals-encode-2.peloton new file mode 100644 index 0000000000..4fb8483617 --- /dev/null +++ b/Task/Roman-numerals-Encode/Peloton/roman-numerals-encode-2.peloton @@ -0,0 +1,5 @@ +<# DEFINE USERDEFINEDOPCODE LITERAL LITERAL>_RO|__Transformer|<# DEFINE KEYWORD PARAMETER>__NationalNumericID|2<# LET RESULT CAST NATIONALNUMBER PARAMETER>...|1 + +<# ENUMERATION LAMBDASPECIFIEDDELMITER LIST LITERAL LITERAL>1990,2008,1,2,64,124,1666,10001|,| +<# SAY ELEMENT LIST>... is <# SAY _RO ELEMENT LIST LITERAL>...|RomanLowerUnicode <# SAY _RO ELEMENT LIST LITERAL>...|RomanUpperUnicode <# SAY _RO ELEMENT LIST LITERAL>...|RomanASCII + diff --git a/Task/Roman-numerals-Encode/Phix/roman-numerals-encode.phix b/Task/Roman-numerals-Encode/Phix/roman-numerals-encode.phix new file mode 100644 index 0000000000..c98380e9b5 --- /dev/null +++ b/Task/Roman-numerals-Encode/Phix/roman-numerals-encode.phix @@ -0,0 +1,13 @@ +constant roman = {"M", "CM", "D","CD", "C","XC","L","XL","X","IX","V","IV","I"} +constant decml = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 } + +function toRoman(integer val) +string res = "" + for i=1 to length(roman) do + while val>=decml[i] do + res &= roman[i] + val -= decml[i] + end while + end for + return res +end function diff --git a/Task/Roman-numerals-Encode/Red/roman-numerals-encode-1.red b/Task/Roman-numerals-Encode/Red/roman-numerals-encode-1.red new file mode 100644 index 0000000000..f9af9bf81e --- /dev/null +++ b/Task/Roman-numerals-Encode/Red/roman-numerals-encode-1.red @@ -0,0 +1,9 @@ +table: [1000 M 900 CM 500 D 400 CD 100 C 90 XC 50 L 40 XL 10 X 5 V 4 IV 1 I] + +to-Roman: function [n [integer!] return: [string!]][ + out: copy "" + foreach [a r] table [while [n >= a][append out r n: n - a]] + out +] + +foreach number [40 33 1888 2016][print [number ":" to-Roman number]] diff --git a/Task/Roman-numerals-Encode/Red/roman-numerals-encode-2.red b/Task/Roman-numerals-Encode/Red/roman-numerals-encode-2.red new file mode 100644 index 0000000000..86eb578579 --- /dev/null +++ b/Task/Roman-numerals-Encode/Red/roman-numerals-encode-2.red @@ -0,0 +1,11 @@ +table: [1000 M 900 CM 500 D 400 CD 100 C 90 XC 50 L 40 XL 10 X 5 V 4 IV 1 I] + +to-Roman: func [n [integer!] return: [string!]][ + case [ + tail? table [table: head table copy ""] + table/1 > n [table: skip table 2 to-Roman n] + 'else [append copy form table/2 to-Roman n - table/1] + ] +] + +foreach number [40 33 1888 2016][print [number ":" to-Roman number]] diff --git a/Task/Roman-numerals-Encode/Red/roman-numerals-encode-3.red b/Task/Roman-numerals-Encode/Red/roman-numerals-encode-3.red new file mode 100644 index 0000000000..6afbba30ff --- /dev/null +++ b/Task/Roman-numerals-Encode/Red/roman-numerals-encode-3.red @@ -0,0 +1,9 @@ +to-Roman: function [n [integer!]] reduce [ + 'case collect [ + foreach [a r] [1000 M 900 CM 500 D 400 CD 100 C 90 XC 50 L 40 XL 10 X 9 IX 5 V 4 IV 1 I][ + keep compose/deep [n >= (a) [append copy (form r) any [to-Roman n - (a) copy ""]]] + ] + ] +] + +foreach number [40 33 1888 2016][print [number ":" to-Roman number]] diff --git a/Task/Roman-numerals-Encode/Ring/roman-numerals-encode.ring b/Task/Roman-numerals-Encode/Ring/roman-numerals-encode.ring new file mode 100644 index 0000000000..67b480550f --- /dev/null +++ b/Task/Roman-numerals-Encode/Ring/roman-numerals-encode.ring @@ -0,0 +1,16 @@ +arabic = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] +roman = ["M", "CM", "D", "CD", "C" ,"XC", "L", "XL" ,"X", "IX", "V", "IV", "I"] + +see "2009 = " + toRoman(2009) + nl +see "1666 = " + toRoman(1666) + nl +see "3888 = " + toRoman(3888) + nl + +func toRoman val + result = "" + for i = 1 to 13 + while val >= arabic[i] + result = result + roman[i] + val = val - arabic[i] + end + next + return result diff --git a/Task/Roman-numerals-Encode/Sidef/roman-numerals-encode.sidef b/Task/Roman-numerals-Encode/Sidef/roman-numerals-encode.sidef new file mode 100644 index 0000000000..d5d651dee7 --- /dev/null +++ b/Task/Roman-numerals-Encode/Sidef/roman-numerals-encode.sidef @@ -0,0 +1,19 @@ +func arabic2roman(num, roman='') { + static lookup = [ + :M:1000, :CM:900, :D:500, + :CD:400, :C:100, :XC:90, + :L:50, :XL:40, :X:10, + :IX:9, :V:5, :IV:4, + :I:1 + ]; + lookup.each { |pair| + while (num >= pair.second) { + roman += pair.first; + num -= pair.second; + } + } + return roman; +} +say("1990 in roman is " + arabic2roman(1990)); +say("2008 in roman is " + arabic2roman(2008)); +say("1666 in roman is " + arabic2roman(1666)); diff --git a/Task/Roman-numerals-Encode/Swift/roman-numerals-encode-1.swift b/Task/Roman-numerals-Encode/Swift/roman-numerals-encode-1.swift new file mode 100644 index 0000000000..a094859ff4 --- /dev/null +++ b/Task/Roman-numerals-Encode/Swift/roman-numerals-encode-1.swift @@ -0,0 +1,26 @@ +func ator(var n: Int) -> String { + + var result = "" + + for (value, letter) in + [( 1000, "M"), + ( 900, "CM"), + ( 500, "D"), + ( 400, "CD"), + ( 100, "C"), + ( 90, "XC"), + ( 50, "L"), + ( 40, "XL"), + ( 10, "X"), + ( 9, "IX"), + ( 5, "V"), + ( 4, "IV"), + ( 1, "I")] + { + while n >= value { + result += letter + n -= value + } + } + return result +} diff --git a/Task/Roman-numerals-Encode/Swift/roman-numerals-encode-2.swift b/Task/Roman-numerals-Encode/Swift/roman-numerals-encode-2.swift new file mode 100644 index 0000000000..93333fb229 --- /dev/null +++ b/Task/Roman-numerals-Encode/Swift/roman-numerals-encode-2.swift @@ -0,0 +1 @@ +println(ator(1666)) // MDCLXVI diff --git a/Task/Roman-numerals-Encode/Swift/roman-numerals-encode-3.swift b/Task/Roman-numerals-Encode/Swift/roman-numerals-encode-3.swift new file mode 100644 index 0000000000..6150d042c6 --- /dev/null +++ b/Task/Roman-numerals-Encode/Swift/roman-numerals-encode-3.swift @@ -0,0 +1 @@ +print(ator(1666)) // MDCLXVI diff --git a/Task/Roman-numerals-Encode/XLISP/roman-numerals-encode.xlisp b/Task/Roman-numerals-Encode/XLISP/roman-numerals-encode.xlisp new file mode 100644 index 0000000000..8c5392ca75 --- /dev/null +++ b/Task/Roman-numerals-Encode/XLISP/roman-numerals-encode.xlisp @@ -0,0 +1,12 @@ +(defun roman (n) + (define roman-numerals '((1000 "m") (900 "cm") (500 "d") (400 "cd") (100 "c") (90 "xc") (50 "l") (40 "xl") (10 "x") (9 "ix") (5 "v") (4 "iv") (1 "i"))) + (defun romanize (arabic-numeral numerals roman-numeral) + (if (= arabic-numeral 0) + roman-numeral + (if (>= arabic-numeral (caar numerals)) + (romanize (- arabic-numeral (caar numerals)) numerals (string-append roman-numeral (cadar numerals))) + (romanize arabic-numeral (cdr numerals) roman-numeral)))) + (romanize n roman-numerals "")) + +; test the function: +(display (mapcar roman '(10 2016 800 2769 1666 476 1453))) diff --git a/Task/Roots-of-a-function/ERRE/roots-of-a-function.erre b/Task/Roots-of-a-function/ERRE/roots-of-a-function.erre new file mode 100644 index 0000000000..1163ffc995 --- /dev/null +++ b/Task/Roots-of-a-function/ERRE/roots-of-a-function.erre @@ -0,0 +1,56 @@ +PROGRAM ROOTS_FUNCTION + +!VAR E,X,STP,VALUE,S%,I%,LIMIT%,X1,X2,D + +FUNCTION F(X) + F=X*X*X-3*X*X+2*X +END FUNCTION + +BEGIN + X=-1 + STP=1.0E-6 + E=1.0E-9 + S%=(F(X)>0) + + PRINT("VERSION 1: SIMPLY STEPPING X") + WHILE X<3.0 DO + VALUE=F(X) + IF ABS(VALUE)LIMIT% THEN + PRINT("ERROR: FUNCTION NOT CONVERGING") + EXIT + END IF + D=(X2-X1)/(F(X2)-F(X1))*F(X2) + IF ABS(D)lasty + ] ; + +: f(x) x 3 pow x sq 3 * - x 2 * + ; diff --git a/Task/Roots-of-a-function/Ring/roots-of-a-function.ring b/Task/Roots-of-a-function/Ring/roots-of-a-function.ring new file mode 100644 index 0000000000..0d706c215d --- /dev/null +++ b/Task/Roots-of-a-function/Ring/roots-of-a-function.ring @@ -0,0 +1,21 @@ +load "stdlib.ring" +function = "return pow(x,3)-3*pow(x,2)+2*x" +rangemin = -1 +rangemax = 3 +stepsize = 0.001 +accuracy = 0.1 +roots(function, rangemin, rangemax, stepsize, accuracy) + +func roots funct, min, max, inc, eps + oldsign = 0 + for x = min to max step inc + num = sign(eval(funct)) + if num = 0 + see "root found at x = " + x + nl + num = -oldsign + else if num != oldsign and oldsign != 0 + if inc < eps + see "root found near x = " + x + nl + else roots(funct, x-inc, x+inc/8, inc/8, eps) ok ok ok + oldsign = num + next diff --git a/Task/Roots-of-a-function/Sidef/roots-of-a-function.sidef b/Task/Roots-of-a-function/Sidef/roots-of-a-function.sidef new file mode 100644 index 0000000000..cec1000cca --- /dev/null +++ b/Task/Roots-of-a-function/Sidef/roots-of-a-function.sidef @@ -0,0 +1,20 @@ +func f(x) { + x*x*x - 3*x*x + 2*x; +} + +var step = 0.001; +var start = -1; +var stop = 3; + +range(start+step, stop, step).each { |x| + static sign = false; + given (var value = f(x)) { + when (0) { + say "Root found at #{x}"; + } + case (sign && ((value > 0) != sign)) { + say "Root found near #{x}"; + } + } + sign = value>0; +} diff --git a/Task/Roots-of-a-function/jq/roots-of-a-function-1.jq b/Task/Roots-of-a-function/jq/roots-of-a-function-1.jq new file mode 100644 index 0000000000..7928f80cdb --- /dev/null +++ b/Task/Roots-of-a-function/jq/roots-of-a-function-1.jq @@ -0,0 +1,22 @@ +def sign: + if . < 0 then -1 elif . > 0 then 1 else 0 end; + +def printRoots(f; lowerBound; upperBound; step): + lowerBound as $x + | ($x|f) as $y + | ($y|sign) as $s + | reduce range($x; upperBound+step; step) as $x + # state: [ox, oy, os, roots] + ( [$x, $y, $s, [] ]; + .[0] as $ox | .[1] as $oy | .[2] as $os + | ($x|f) as $y + | ($y | sign) as $s + | if $s == 0 then [$x, $y, $s, (.[3] + [$x] )] + elif $s != $os and $os != 0 then + ($x - $ox) as $dx + | ($y - $oy) as $dy + | ($x - ($dx * $y / $dy)) as $cx # by geometry + | [$x, $y, $s, (.[3] + [ "~\($cx)" ])] # an approximation + else [$x, $y, $s, .[3] ] + end ) + | .[3] ; diff --git a/Task/Roots-of-a-function/jq/roots-of-a-function-2.jq b/Task/Roots-of-a-function/jq/roots-of-a-function-2.jq new file mode 100644 index 0000000000..e5be520cd7 --- /dev/null +++ b/Task/Roots-of-a-function/jq/roots-of-a-function-2.jq @@ -0,0 +1,14 @@ +printRoots( .*.*. - 3*.*. + 2*.; -1.0; 4; 1/256) + +[ + 0, + 1, + 2 +] + +printRoots( .*.*. - 3*.*. + 2*.; -1.0; 4; .001) +[ + "~1.320318770141425e-18", + "~1.0000000000000002", + "~1.9999999999999993" +] diff --git a/Task/Roots-of-a-quadratic-function/ERRE/roots-of-a-quadratic-function.erre b/Task/Roots-of-a-quadratic-function/ERRE/roots-of-a-quadratic-function.erre new file mode 100644 index 0000000000..9785bec2f1 --- /dev/null +++ b/Task/Roots-of-a-quadratic-function/ERRE/roots-of-a-quadratic-function.erre @@ -0,0 +1,34 @@ +PROGRAM QUADRATIC + +PROCEDURE SOLVE_QUADRATIC + D=B*B-4*A*C + IF ABS(D)<1D-6 THEN D=0 END IF + CASE SGN(D) OF + 0-> + PRINT("the single root is ";-B/2/A) + END -> + 1-> + F=(1+SQR(1-4*A*C/(B*B)))/2 + PRINT("the real roots are ";-F*B/A;"and ";-C/B/F) + END -> + -1-> + PRINT("the complex roots are ";-B/2/A;"+/-";SQR(-D)/2/A;"*i") + END -> + END CASE +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) ! CLS + FOR TEST%=1 TO 7 DO + READ(A,B,C) + PRINT("For a=";A;",b=";B;",c=";C;TAB(32);) + SOLVE_QUADRATIC + END FOR + DATA(1,-1E9,1) + DATA(1,0,1) + DATA(2,-1,-6) + DATA(1,2,-2) + DATA(0.5,1.4142135,1) + DATA(1,3,2) + DATA(3,4,5) +END PROGRAM diff --git a/Task/Roots-of-a-quadratic-function/Ring/roots-of-a-quadratic-function.ring b/Task/Roots-of-a-quadratic-function/Ring/roots-of-a-quadratic-function.ring new file mode 100644 index 0000000000..952062ebd8 --- /dev/null +++ b/Task/Roots-of-a-quadratic-function/Ring/roots-of-a-quadratic-function.ring @@ -0,0 +1,16 @@ +x1 = 0 +x2 = 0 +quadratic(3, 4, 4/3.0) # [-2/3] +see "x1 = " + x1 + " x2 = " + x2 + nl +quadratic(3, 2, -1) # [1/3, -1] +see "x1 = " + x1 + " x2 = " + x2 + nl +quadratic(-2, 7, 15) # [-3/2, 5] +see "x1 = " + x1 + " x2 = " + x2 + nl +quadratic(1, -2, 1) # [1] +see "x1 = " + x1 + " x2 = " + x2 + nl + +func quadratic a, b, c + sqrtDiscriminant = sqrt(pow(b,2) - 4*a*c) + x1 = (-b + sqrtDiscriminant) / (2.0*a) + x2 = (-b - sqrtDiscriminant) / (2.0*a) + return [x1, x2] diff --git a/Task/Roots-of-a-quadratic-function/Sidef/roots-of-a-quadratic-function.sidef b/Task/Roots-of-a-quadratic-function/Sidef/roots-of-a-quadratic-function.sidef new file mode 100644 index 0000000000..560f83c8ba --- /dev/null +++ b/Task/Roots-of-a-quadratic-function/Sidef/roots-of-a-quadratic-function.sidef @@ -0,0 +1,19 @@ +var sets = [ + [1, 2, 1], + [1, 2, 3], + [1, -2, 1], + [1, 0, -4], + [1, -1e6, 1], + ]; + +func quadroots(a, b, c) { + var root = sqrt(b**2 - 4*a*c) + + [(-b + root) / (2 * a), + (-b - root) / (2 * a)] +} + +sets.each { |coefficients| + say ("Roots for #{coefficients}", + "=> (#{quadroots(coefficients...).join(', ')})"); +} diff --git a/Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-1.jq b/Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-1.jq new file mode 100644 index 0000000000..e453b2b249 --- /dev/null +++ b/Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-1.jq @@ -0,0 +1,66 @@ +# Complex numbers as points [x,y] in the Cartesian plane +def real(z): if (z|type) == "number" then z else z[0] end; + +def imag(z): if (z|type) == "number" then 0 else z[1] end; + +def plus(x; y): + if (x|type) == "number" then + if (y|type) == "number" then [ x+y, 0 ] + else [ x + y[0], y[1]] + end + elif (y|type) == "number" then plus(y;x) + else [ x[0] + y[0], x[1] + y[1] ] + end; + +def multiply(x; y): + if (x|type) == "number" then + if (y|type) == "number" then [ x*y, 0 ] + else [x * y[0], x * y[1]] + end + elif (y|type) == "number" then multiply(y;x) + else [ x[0] * y[0] - x[1] * y[1], x[0] * y[1] + x[1] * y[0]] + end; + +def negate(x): multiply(-1; x); + +def minus(x; y): plus(x; multiply(-1; y)); + +def conjugate(z): + if (z|type) == "number" then [z, 0] + else [z[0], -(z[1]) ] + end; + +def invert(z): + if (z|type) == "number" then [1/z, 0] + else + ( (z[0] * z[0]) + (z[1] * z[1]) ) as $d + # use "0 + ." to convert -0 back to 0 + | [ z[0]/$d, (0 + -(z[1]) / $d)] + end; + +def divide(x;y): multiply(x; invert(y)); + +def magnitude(z): + real( multiply(z; conjugate(z))) | sqrt; + +# exp^z +def complex_exp(z): + def expi(x): [ (x|cos), (x|sin) ]; + if (z|type) == "number" then z|exp + elif z[0] == 0 then expi(z[1]) # for efficiency + else multiply( (z[0]|exp); expi(z[1]) ) + end ; + +def complex_sqrt(z): + if imag(z) == 0 and real(z) >= 0 then [(real(z)|sqrt), 0] + else + magnitude(z) as $r + | if $r == 0 then [0,0] + else + (real(z)/$r) as $a + | (imag(z)/$r) as $b + | $r | sqrt as $r + | (($a | acos) / 2) + | [ ($r * cos), ($r * sin)] + end + end ; diff --git a/Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-2.jq b/Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-2.jq new file mode 100644 index 0000000000..6e0af68cbb --- /dev/null +++ b/Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-2.jq @@ -0,0 +1,17 @@ +# If there are infinitely many solutions, emit true; +# if none, emit empty; +# otherwise always emit two. +# For numerical accuracy, Middlebrook's approach is adopted: +def quadratic_roots(a; b; c): + if a == 0 and b == 0 then + if c == 0 then true # infinitely many + else empty # none + end + elif a == 0 then [-c/b, 0] + elif b == 0 then (complex_sqrt(1/a) | (., negate(.))) + else + divide( plus(1.0; complex_sqrt( minus(1.0; (4 * a * c / (b*b))))); 2) as $f + | negate(divide(multiply(b; $f); a)), + negate(divide(c; multiply(b; $f))) + end +; diff --git a/Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-3.jq b/Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-3.jq new file mode 100644 index 0000000000..ec5964809f --- /dev/null +++ b/Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-3.jq @@ -0,0 +1,19 @@ +def example: + def pow(i): . as $in | reduce range(0;i) as $i (1; . * $in); + def poly(a;b;c): plus( plus( multiply(a; multiply(.;.)); multiply(b;.)); c); + def abs: if . < 0 then -. else . end; + def zero(z): + if z == 0 then 0 + else (magnitude(z)|abs) as $zero + | if $zero < 1e-10 then "+0" else $zero end + end; + def lpad(n): tostring | (n - length) * " " + .; + + range(0; 13) as $i + | (- (10|pow($i))) as $b + | quadratic_roots(1; $b; 1) as $x + | $x | poly(1; $b; 1) as $zero + | "\($i|lpad(4)): error = \(zero($zero)|lpad(18)) x=\($x)" +; + +example diff --git a/Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-4.jq b/Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-4.jq new file mode 100644 index 0000000000..6f99ca0dd4 --- /dev/null +++ b/Task/Roots-of-a-quadratic-function/jq/roots-of-a-quadratic-function-4.jq @@ -0,0 +1,27 @@ +$ jq -M -r -n -f Roots_of_a_quadratic_function.jq + 0: error = +0 x=[0.5,0.8660254037844386] + 0: error = +0 x=[0.5000000000000001,-0.8660254037844387] + 1: error = +0 x=[9.898979485566356,0] + 1: error = +0 x=[0.10102051443364382,-0] + 2: error = +0 x=[99.98999899979995,0] + 2: error = +0 x=[0.010001000200050014,-0] + 3: error = 1.1641532182693481e-10 x=[999.998999999,0] + 3: error = +0 x=[0.0010000010000019998,-0] + 4: error = +0 x=[9999.999899999999,0] + 4: error = +0 x=[0.00010000000100000003,-0] + 5: error = +0 x=[99999.99999,0] + 5: error = +0 x=[1.0000000001e-05,-0] + 6: error = 0.0001220703125 x=[999999.9999989999,0] + 6: error = +0 x=[1.000000000001e-06,-0] + 7: error = 0.015625 x=[9999999.9999999,0] + 7: error = +0 x=[1.0000000000000101e-07,-0] + 8: error = 1 x=[99999999.99999999,0] + 8: error = +0 x=[1e-08,-0] + 9: error = 1 x=[1000000000,0] + 9: error = +0 x=[1e-09,-0] + 10: error = 1 x=[10000000000,0] + 10: error = +0 x=[1e-10,-0] + 11: error = 1 x=[100000000000,0] + 11: error = +0 x=[1e-11,-0] + 12: error = 1 x=[1000000000000,0] + 12: error = +0 x=[1e-12,-0] diff --git a/Task/Roots-of-unity/ERRE/roots-of-unity.erre b/Task/Roots-of-unity/ERRE/roots-of-unity.erre new file mode 100644 index 0000000000..b4425bfccb --- /dev/null +++ b/Task/Roots-of-unity/ERRE/roots-of-unity.erre @@ -0,0 +1,20 @@ +PROGRAM UNITY_ROOTS + +! +! for rosettacode.org +! + +BEGIN + PRINT(CHR$(12);) !CLS + N=5 ! this can be changed for any desired n + ANGLE=0 ! start at ANGLE 0 + REPEAT + REAL=COS(ANGLE) ! real axis is the x axis + IF (ABS(REAL)<10^-5) THEN REAL=0 END IF ! get rid of annoying sci notation + IMAG=SIN(ANGLE) ! imaginary axis is the y axis + IF (ABS(IMAG)<10^-5) THEN IMAG=0 END IF ! get rid of annoying sci notation + PRINT(REAL;"+";IMAG;"i") ! answer on every line + ANGLE+=(2*π)/N + ! all the way around the circle at even intervals + UNTIL ANGLE>=2*π +END PROGRAM diff --git a/Task/Roots-of-unity/EchoLisp/roots-of-unity.echolisp b/Task/Roots-of-unity/EchoLisp/roots-of-unity.echolisp new file mode 100644 index 0000000000..364aac1f3a --- /dev/null +++ b/Task/Roots-of-unity/EchoLisp/roots-of-unity.echolisp @@ -0,0 +1,11 @@ +(define (roots-1 n) + (define theta (// (* 2 PI) n)) + (for/list ((i n)) + (polar 1. (* theta i)))) + +(roots-1 2) + → (1+0i -1+0i) +(roots-1 3) + → (1+0i -0.4999999999999998+0.8660254037844388i -0.5000000000000004-0.8660254037844384i) +(roots-1 4) + → (1+0i 0+i -1+0i 0-i) diff --git a/Task/Roots-of-unity/FunL/roots-of-unity.funl b/Task/Roots-of-unity/FunL/roots-of-unity.funl new file mode 100644 index 0000000000..57cba6d568 --- /dev/null +++ b/Task/Roots-of-unity/FunL/roots-of-unity.funl @@ -0,0 +1,5 @@ +import math.{exp, Pi} + +def rootsOfUnity( n ) = {exp( 2Pi i k/n ) | k <- 0:n} + +println( rootsOfUnity(3) ) diff --git a/Task/Roots-of-unity/FutureBasic/roots-of-unity.futurebasic b/Task/Roots-of-unity/FutureBasic/roots-of-unity.futurebasic new file mode 100644 index 0000000000..13a4bb5b5f --- /dev/null +++ b/Task/Roots-of-unity/FutureBasic/roots-of-unity.futurebasic @@ -0,0 +1,15 @@ +include "ConsoleWindow" + +dim as long n, root +dim as double real, imag + +for n = 2 to 7 +print n;":" ; +for root = 0 to n-1 +real = cos( 2 * pi * root / n) +imag = sin( 2 * pi * root / n) +print using "-##.#####"; real;using "-##.#####"; imag; "i"; +if root <> n-1 then print ","; +next +print +next diff --git a/Task/Roots-of-unity/Nim/roots-of-unity.nim b/Task/Roots-of-unity/Nim/roots-of-unity.nim new file mode 100644 index 0000000000..ad0e20bd4d --- /dev/null +++ b/Task/Roots-of-unity/Nim/roots-of-unity.nim @@ -0,0 +1,12 @@ +import complex, math + +proc rect(r, phi: float): Complex = (r * cos(phi), sin(phi)) + +proc croots(n): seq[Complex] = + result = @[] + if n <= 0: return + for k in 0 .. < n: + result.add rect(1, 2 * k.float * Pi / n.float) + +for nr in 2..10: + echo nr, " ", croots(nr) diff --git a/Task/Roots-of-unity/Ring/roots-of-unity.ring b/Task/Roots-of-unity/Ring/roots-of-unity.ring new file mode 100644 index 0000000000..b80eb34bdc --- /dev/null +++ b/Task/Roots-of-unity/Ring/roots-of-unity.ring @@ -0,0 +1,11 @@ +decimals(4) +for n = 2 to 5 + see string(n) + " : " + for root = 0 to n-1 + real = cos(2*3.14 * root / n) + imag = sin(2*3.14 * root / n) + see "" + real + " " + imag + "i" + if root != n-1 see ", " ok + next + see nl +next diff --git a/Task/Roots-of-unity/Sidef/roots-of-unity-1.sidef b/Task/Roots-of-unity/Sidef/roots-of-unity-1.sidef new file mode 100644 index 0000000000..617739ac2c --- /dev/null +++ b/Task/Roots-of-unity/Sidef/roots-of-unity-1.sidef @@ -0,0 +1,9 @@ +func roots_of_unity (n) { + n.of { |j| + exp(2.i * Complex.pi / n * (j-1)) + } +} + +roots_of_unity(5).each { |c| + printf("%+.5f%+.5fi\n", c.reals); +} diff --git a/Task/Roots-of-unity/Sidef/roots-of-unity-2.sidef b/Task/Roots-of-unity/Sidef/roots-of-unity-2.sidef new file mode 100644 index 0000000000..32be4c0dba --- /dev/null +++ b/Task/Roots-of-unity/Sidef/roots-of-unity-2.sidef @@ -0,0 +1,5 @@ +5.times { |n| + var roots = Complex(1).roots(n); + printf ("%2d. ", n); + say roots.map{ "%+.5f%+.5fi" % .reals }.join(' '); +} diff --git a/Task/Roots-of-unity/Sparkling/roots-of-unity.sparkling b/Task/Roots-of-unity/Sparkling/roots-of-unity.sparkling new file mode 100644 index 0000000000..13843c728b --- /dev/null +++ b/Task/Roots-of-unity/Sparkling/roots-of-unity.sparkling @@ -0,0 +1,14 @@ +function unity_roots(n) { + // nth-root(1) = cos(2 * k * pi / n) + i * sin(2 * k * pi / n) + return map(range(n), function(idx, k) { + return { + "re": cos(2 * k * M_PI / n), + "im": sin(2 * k * M_PI / n) + }; + }); +} + +// pirnt 6th roots of unity +foreach(unity_roots(6), function(k, v) { + printf("%.3f%+.3fi\n", v.re, v.im); +}); diff --git a/Task/Roots-of-unity/jq/roots-of-unity-1.jq b/Task/Roots-of-unity/jq/roots-of-unity-1.jq new file mode 100644 index 0000000000..7c30bad107 --- /dev/null +++ b/Task/Roots-of-unity/jq/roots-of-unity-1.jq @@ -0,0 +1,5 @@ +def nthroots(n): + (8 * (1|atan)) as $twopi + | range(0;n) | (($twopi * .) / n) as $angle | [ ($angle | cos), ($angle | sin) ]; + +nthroots(10) diff --git a/Task/Roots-of-unity/jq/roots-of-unity-2.jq b/Task/Roots-of-unity/jq/roots-of-unity-2.jq new file mode 100644 index 0000000000..c13c65d81d --- /dev/null +++ b/Task/Roots-of-unity/jq/roots-of-unity-2.jq @@ -0,0 +1,18 @@ +$ uname -a +Darwin Mac-mini 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64 + +$ time jq -c -n -f Roots_of_unity.jq +[1,0] +[0.8090169943749475,0.5877852522924731] +[0.30901699437494745,0.9510565162951535] +[-0.30901699437494734,0.9510565162951536] +[-0.8090169943749473,0.5877852522924732] +[-1,1.2246467991473532e-16] +[-0.8090169943749475,-0.587785252292473] +[-0.30901699437494756,-0.9510565162951535] +[0.30901699437494723,-0.9510565162951536] +[0.8090169943749473,-0.5877852522924732] + +real 0m0.015s +user 0m0.004s +sys 0m0.004s diff --git a/Task/Rot-13/ERRE/rot-13.erre b/Task/Rot-13/ERRE/rot-13.erre new file mode 100644 index 0000000000..d08ce26cc9 --- /dev/null +++ b/Task/Rot-13/ERRE/rot-13.erre @@ -0,0 +1,17 @@ +PROGRAM ROT13 + +BEGIN +INPUT("Enter a string ",TEXT$) +FOR C%=1 TO LEN(TEXT$) DO + A%=ASC(MID$(TEXT$,C%,1)) + CASE A% OF + 65..90-> + MID$(TEXT$,C%,1)=CHR$(65+(A%-65+13) MOD 26) + END -> + 97..122-> + MID$(TEXT$,C%,1)=CHR$(97+(A%-97+13) MOD 26) + END -> + END CASE +END FOR +PRINT("Converted: ";TEXT$) +END PROGRAM diff --git a/Task/Rot-13/FreeBASIC/rot-13.freebasic b/Task/Rot-13/FreeBASIC/rot-13.freebasic new file mode 100644 index 0000000000..5a109b41b9 --- /dev/null +++ b/Task/Rot-13/FreeBASIC/rot-13.freebasic @@ -0,0 +1,29 @@ +' FB 1.05.0 Win64 + +' uses in place encoding/decoding +Sub rot13(ByRef s As String) + If s = "" Then Exit Sub + Dim code As Integer + For i As Integer = 0 To Len(s) - 1 + Select Case As Const s[i] + Case 65 To 90 '' A to Z + code = s[i] + 13 + If code > 90 Then code -= 26 + s[i] = code + Case 97 To 122 '' a to z + code = s[i] + 13 + If code > 122 Then code -= 26 + s[i] = code + End Select + Next +End Sub + +Dim s As String = "nowhere ABJURER" +Print "Before encoding : "; s +rot13(s) +Print "After encoding : "; s +rot13(s) +Print "After decoding : "; s +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Rot-13/FunL/rot-13.funl b/Task/Rot-13/FunL/rot-13.funl new file mode 100644 index 0000000000..0e93ec4ab2 --- /dev/null +++ b/Task/Rot-13/FunL/rot-13.funl @@ -0,0 +1,25 @@ +import io.{lines, stdin} + +def rot13( s ) = + buf = StringBuilder() + + for c <- s + if isalpha( c ) + n = ((ord(c) and 0x1F) - 1 + 13)%26 + 1 + + buf.append( chr(n or (if isupper(c) then 64 else 96)) ) + else + buf.append( c ) + + buf.toString() + +def rot13lines( ls ) = + for l <- ls + println( rot13(l) ) + +if _name_ == '-main-' + if args.isEmpty() + rot13lines( stdin() ) + else + for f <- args + rot13lines( lines(f) ) diff --git a/Task/Rot-13/Lasso/rot-13-1.lasso b/Task/Rot-13/Lasso/rot-13-1.lasso new file mode 100644 index 0000000000..a029628c5a --- /dev/null +++ b/Task/Rot-13/Lasso/rot-13-1.lasso @@ -0,0 +1,26 @@ +// Extend the string type + +define string->rot13 => { + local( + rot13 = bytes, + i, a, b + ) + + with char in .eachCharacter + let int = #char->integer + do { + // We only modify these ranges, set range if we should modify + #int >= 65 and #int < 91 ? local(a=65,b=91) | + #int >= 97 and #int < 123 ? local(a=97,b=123) | local(a=0,b=0) + + if(#a && #b) => { + #i = (#int+13) % #b // loop back if past ceiling (#b) + #i += #a * (1 - #i / #a) // offset if below floor (#a) + #rot13->import8bits(#i) // import the new character + else + #rot13->append(#char) // just append the character + } + } + + return #rot13->asstring +} diff --git a/Task/Rot-13/Lasso/rot-13-2.lasso b/Task/Rot-13/Lasso/rot-13-2.lasso new file mode 100644 index 0000000000..a074d46e47 --- /dev/null +++ b/Task/Rot-13/Lasso/rot-13-2.lasso @@ -0,0 +1,18 @@ +define rot13(p::string) => { + local( + rot13 = bytes, + a = bytes('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'), + b = bytes('NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'), + i + ) + + with char in #p->eachCharacter + let c = bytes(#char) do { + #i = #a->find(#b) + #i ? #rot13->import8bits(#b->get(#i)) | #rot13->append(#c) + } + + return #rot13->asString +} + +rot13('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz') diff --git a/Task/Rot-13/LiveCode/rot-13.livecode b/Task/Rot-13/LiveCode/rot-13.livecode new file mode 100644 index 0000000000..a91227bf20 --- /dev/null +++ b/Task/Rot-13/LiveCode/rot-13.livecode @@ -0,0 +1,8 @@ +function rot13 S + repeat with i = 1 to length(S) + get chartonum(char i of S) + if it < 65 or it > 122 or (it > 90 and it < 97) then next repeat + put char it - 64 of "NOPQRSTUVWXYZABCDEFGHIJKLM nopqrstuvwxyzabcdefghijklm" into char i of S + end repeat + return S +end rot13 diff --git a/Task/Rot-13/Nim/rot-13.nim b/Task/Rot-13/Nim/rot-13.nim new file mode 100644 index 0000000000..8f4935fc34 --- /dev/null +++ b/Task/Rot-13/Nim/rot-13.nim @@ -0,0 +1,12 @@ +import strutils + +proc rot13(c): char = + case toLower(c) + of 'a'..'m': chr(ord(c) + 13) + of 'n'..'z': chr(ord(c) - 13) + else: c + +for line in stdin.lines: + for c in line: + stdout.write rot13(c) + stdout.write "\n" diff --git a/Task/Rot-13/Oforth/rot-13.oforth b/Task/Rot-13/Oforth/rot-13.oforth new file mode 100644 index 0000000000..78654910cb --- /dev/null +++ b/Task/Rot-13/Oforth/rot-13.oforth @@ -0,0 +1,5 @@ +: encryptRot13(c) + c dup isLetter ifFalse: [ return ] + isUpper ifTrue: [ 'A' ] else: [ 'a' ] c 13 + over - 26 mod + ; + +: rot13 map(#encryptRot13) charsAsString ; diff --git a/Task/Rot-13/Phix/rot-13.phix b/Task/Rot-13/Phix/rot-13.phix new file mode 100644 index 0000000000..6462897eb1 --- /dev/null +++ b/Task/Rot-13/Phix/rot-13.phix @@ -0,0 +1,11 @@ +function rot13(string s) +integer ch + for i=1 to length(s) do + ch = upper(s[i]) + if ch>='A' and ch<='Z' then + s[i] += iff(ch<='M',+13,-13) + end if + end for + return s +end function +?rot13("abjurer NOWHERE.") diff --git a/Task/Rot-13/Ring/rot-13.ring b/Task/Rot-13/Ring/rot-13.ring new file mode 100644 index 0000000000..726d56fab7 --- /dev/null +++ b/Task/Rot-13/Ring/rot-13.ring @@ -0,0 +1,14 @@ +see "enter a string : " give s +ans = "" +for a = 1 to len(s) + letter = substr(s, a, 1) + if letter >= "a" and letter <= "z" + char = char(ascii(letter) + 13) + if char > "z" char = chr(asc(char) - 26) ok + else + if letter >= "a" and letter <= "z" char = char(ascii(letter) + 13) ok + if char > "z" char = char(ascii(char) - 26) else char = letter ok + ok + ans = ans + char +nex +see ans + nl diff --git a/Task/Rot-13/Sidef/rot-13.sidef b/Task/Rot-13/Sidef/rot-13.sidef new file mode 100644 index 0000000000..da31854747 --- /dev/null +++ b/Task/Rot-13/Sidef/rot-13.sidef @@ -0,0 +1,7 @@ +# Returns a copy of 's' with rot13 encoding. +func rot13(s) { + s.tr('A-Za-z', 'N-ZA-Mn-za-m'); +} + +# Perform rot13 on standard input. +STDIN.each { |line| print rot13(line) } diff --git a/Task/Rot-13/Swift/rot-13.swift b/Task/Rot-13/Swift/rot-13.swift new file mode 100644 index 0000000000..5cf6836f7e --- /dev/null +++ b/Task/Rot-13/Swift/rot-13.swift @@ -0,0 +1,16 @@ +func rot13char(c: UnicodeScalar) -> UnicodeScalar { + switch c { + case "A"..."M", "a"..."m": + return UnicodeScalar(UInt32(c) + 13) + case "N"..."Z", "n"..."z": + return UnicodeScalar(UInt32(c) - 13) + default: + return c + } +} + +func rot13(str: String) -> String { + return String(map(str.unicodeScalars){ c in Character(rot13char(c)) }) +} + +println(rot13("The quick brown fox jumps over the lazy dog")) diff --git a/Task/Rot-13/Wart/rot-13-1.wart b/Task/Rot-13/Wart/rot-13-1.wart new file mode 100644 index 0000000000..9c9be316b7 --- /dev/null +++ b/Task/Rot-13/Wart/rot-13-1.wart @@ -0,0 +1,14 @@ +def (rot13 s) + (as string + (map rot13 + (as list s))) + +Alphabet <- "abcdefghijklmnopqrstuvwxyz" +def (rot13 c) :case (and string?.c len.c=1) + if ("a" <= c <= "z") + let idx (pos c Alphabet) + Alphabet (idx+13 % 26) + ("A" <= c <= "Z") + (downcase.c -> rot13 -> upcase) + :else + c diff --git a/Task/Rot-13/Wart/rot-13-2.wart b/Task/Rot-13/Wart/rot-13-2.wart new file mode 100644 index 0000000000..6d3689251c --- /dev/null +++ b/Task/Rot-13/Wart/rot-13-2.wart @@ -0,0 +1,2 @@ +(rot13 "Moron") +=> "Zbeba" diff --git a/Task/Rot-13/jq/rot-13-1.jq b/Task/Rot-13/jq/rot-13-1.jq new file mode 100644 index 0000000000..682cc752f0 --- /dev/null +++ b/Task/Rot-13/jq/rot-13-1.jq @@ -0,0 +1,19 @@ +#!/usr/bin/env jq -M -R -r -f +# or perhaps: +#!/usr/local/bin/jq -M -R -r -f + +# If your operating system does not allow more than one option +# to be specified on the command line, +# then consider using a version of jq that allows +# command-line options to be squished together (-MRrf), +# or see the following subsection. + +def rot13: + explode + | map( if 65 <= . and . <= 90 then ((. - 52) % 26) + 65 + elif 97 <= . and . <= 122 then (. - 84) % 26 + 97 + else . + end) + | implode; + +rot13 diff --git a/Task/Rot-13/jq/rot-13-2.jq b/Task/Rot-13/jq/rot-13-2.jq new file mode 100644 index 0000000000..127cb2e1d1 --- /dev/null +++ b/Task/Rot-13/jq/rot-13-2.jq @@ -0,0 +1,13 @@ +#!/bin/bash + +jq -M -R -r ' + +def rot13: + explode + | map( if 65 <= . and . <= 90 then ((. - 52) % 26) + 65 + elif 97 <= . and . <= 122 then (. - 84) % 26 + 97 + else . + end) + | implode; + +rot13' diff --git a/Task/Run-length-encoding/Lasso/run-length-encoding.lasso b/Task/Run-length-encoding/Lasso/run-length-encoding.lasso new file mode 100644 index 0000000000..e58371ece3 --- /dev/null +++ b/Task/Run-length-encoding/Lasso/run-length-encoding.lasso @@ -0,0 +1,47 @@ +define rle(str::string)::string => { + local(orig = #str->values->asCopy,newi=array, newc=array, compiled=string) + while(#orig->size) => { + if(not #newi->size) => { + #newi->insert(1) + #newc->insert(#orig->first) + #orig->remove(1) + else + if(#orig->first == #newc->last) => { + #newi->get(#newi->size) += 1 + else + #newi->insert(1) + #newc->insert(#orig->first) + } + #orig->remove(1) + } + } + loop(#newi->size) => { + #compiled->append(#newi->get(loop_count)+#newc->get(loop_count)) + } + return #compiled +} +define rlde(str::string)::string => { + local(o = string) + while(#str->size) => { + loop(#str->size) => { + if(#str->isualphabetic(loop_count)) => { + if(loop_count == 1) => { + #o->append(#str->get(loop_count)) + #str->removeLeading(#str->get(loop_count)) + loop_abort + } + local(num = integer(#str->substring(1,loop_count))) + #o->append(#str->get(loop_count)*#num) + #str->removeLeading(#num+#str->get(loop_count)) + loop_abort + } + } + } + return #o +} +//Tests: +rle('WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW') +rle('dsfkjhhkdsjfhdskhshdjjfhhdlsllw') + +rlde('12W1B12W3B24W1B14W') +rlde('1d1s1f1k1j2h1k1d1s1j1f1h1d1s1k1h1s1h1d2j1f2h1d1l1s2l1w') diff --git a/Task/Run-length-encoding/LiveCode/run-length-encoding.livecode b/Task/Run-length-encoding/LiveCode/run-length-encoding.livecode new file mode 100644 index 0000000000..8af4b42db6 --- /dev/null +++ b/Task/Run-length-encoding/LiveCode/run-length-encoding.livecode @@ -0,0 +1,43 @@ +function rlEncode str + local charCount + put 1 into charCount + repeat with i = 1 to the length of str + if char i of str = char (i + 1) of str then + add 1 to charCount + else + put char i of str & charCount after rle + put 1 into charCount + end if + end repeat + return rle +end rlEncode + +function rlDecode str + repeat with i = 1 to the length of str + if char i of str is not a number then + put char i of str into curChar + put 0 into curNum + else + repeat with n = i to len(str) + if isnumber(char n of str) then + put char n of str after curNum + else + put repeatString(curChar,curNum) after rldec + put n - 1 into i + exit repeat + end if + end repeat + end if + if i = len(str) then --dump last char + put repeatString(curChar,curNum) after rldec + end if + end repeat + return rldec +end rlDecode + +function repeatString str,rep + repeat rep times + put str after repStr + end repeat + return repStr +end repeatString diff --git a/Task/Run-length-encoding/Nim/run-length-encoding.nim b/Task/Run-length-encoding/Nim/run-length-encoding.nim new file mode 100644 index 0000000000..a217b7fdcb --- /dev/null +++ b/Task/Run-length-encoding/Nim/run-length-encoding.nim @@ -0,0 +1,26 @@ +import strutils + +type RunLength = tuple[c: char, n: int] + +proc encode(inp): seq[RunLength] = + result = @[] + var count = 1 + var prev: char + + for c in inp: + if c != prev: + if prev != chr(0): + result.add((prev,count)) + count = 1 + prev = c + else: + inc(count) + result.add((prev,count)) + +proc decode(lst: openarray[RunLength]): string = + result = "" + for x in lst: + result.add(repeatChar(x.n, x.c)) + +echo encode("aaaaahhhhhhmmmmmmmuiiiiiiiaaaaaa") +echo decode([('a', 5), ('h', 6), ('m', 7), ('u', 1), ('i', 7), ('a', 6)]) diff --git a/Task/Run-length-encoding/Oforth/run-length-encoding.oforth b/Task/Run-length-encoding/Oforth/run-length-encoding.oforth new file mode 100644 index 0000000000..edc56e3e6b --- /dev/null +++ b/Task/Run-length-encoding/Oforth/run-length-encoding.oforth @@ -0,0 +1,12 @@ +: encode(s) + StringBuffer new + s group apply(#[ tuck size asString << swap first < chr + a}); +} + +func decode(str) { + var chars = str.chars; + var r = ''; + (chars.len/2 -> int).range.each { |i| + r += (chars[2*i + 1] * chars[2*i].ord); + } + return r; +} diff --git a/Task/Run-length-encoding/Swift/run-length-encoding-1.swift b/Task/Run-length-encoding/Swift/run-length-encoding-1.swift new file mode 100644 index 0000000000..54706f2043 --- /dev/null +++ b/Task/Run-length-encoding/Swift/run-length-encoding-1.swift @@ -0,0 +1,14 @@ +import Foundation + +// "WWWBWW" -> [(3, W), (1, B), (2, W)] +func encode(input: String) -> [(Int, Character)] { + return input.characters.reduce([(Int, Character)]()) { + if $0.last?.1 == $1 { var r = $0; r[r.count - 1].0++; return r } + return $0 + [(1, $1)] + } +} + +// [(3, W), (1, B), (2, W)] -> "WWWBWW" +func decode(encoded: [(Int, Character)]) -> String { + return encoded.reduce("") { $0 + String(count: $1.0, repeatedValue: $1.1) } +} diff --git a/Task/Run-length-encoding/Swift/run-length-encoding-2.swift b/Task/Run-length-encoding/Swift/run-length-encoding-2.swift new file mode 100644 index 0000000000..a85613a622 --- /dev/null +++ b/Task/Run-length-encoding/Swift/run-length-encoding-2.swift @@ -0,0 +1,3 @@ +let input = "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW" +let output = decode(encode(input)) +print(output == input) diff --git a/Task/Run-length-encoding/Swift/run-length-encoding-3.swift b/Task/Run-length-encoding/Swift/run-length-encoding-3.swift new file mode 100644 index 0000000000..3bc8c56e85 --- /dev/null +++ b/Task/Run-length-encoding/Swift/run-length-encoding-3.swift @@ -0,0 +1,15 @@ +// "3W1B2W" -> "WWWBWW" +func decode(encoded: String) -> String { + let scanner = NSScanner(string: encoded) + var char: NSString? = nil + var count: Int = 0 + var out = "" + + while scanner.scanInteger(&count) { + while scanner.scanCharactersFromSet(NSCharacterSet.letterCharacterSet(), intoString: &char) { + out += String(count: count, repeatedValue: Character(char as! String)) + } + } + + return out +} diff --git a/Task/Run-length-encoding/Swift/run-length-encoding-4.swift b/Task/Run-length-encoding/Swift/run-length-encoding-4.swift new file mode 100644 index 0000000000..65483c418a --- /dev/null +++ b/Task/Run-length-encoding/Swift/run-length-encoding-4.swift @@ -0,0 +1,4 @@ +let encodedString = encode(input).reduce("") { $0 + "\($1.0)\($1.1)" } +print(encodedString) +let outputString = decode(encodedString) +print(outputString == input) diff --git a/Task/Run-length-encoding/jq/run-length-encoding-1.jq b/Task/Run-length-encoding/jq/run-length-encoding-1.jq new file mode 100644 index 0000000000..c70ae9f0f7 --- /dev/null +++ b/Task/Run-length-encoding/jq/run-length-encoding-1.jq @@ -0,0 +1,9 @@ +def runs: + reduce .[] as $item + ( []; + if . == [] then [ [ $item, 1] ] + else .[length-1] as $last + | if $last[0] == $item then .[length-1] = [$item, $last[1] + 1] + else . + [[$item, 1]] + end + end ) ; diff --git a/Task/Run-length-encoding/jq/run-length-encoding-2.jq b/Task/Run-length-encoding/jq/run-length-encoding-2.jq new file mode 100644 index 0000000000..464b1a8026 --- /dev/null +++ b/Task/Run-length-encoding/jq/run-length-encoding-2.jq @@ -0,0 +1,9 @@ +def run_length_encode: + explode | runs | reduce .[] as $x (""; . + "\($x[1])\([$x[0]]|implode)"); + +def run_length_decode: + reduce (scan( "[0-9]+[A-Z]" )) as $pair + ( ""; + ($pair[0:-1] | tonumber) as $n + | $pair[-1:] as $letter + | . + ($n * $letter)) ; diff --git a/Task/Run-length-encoding/jq/run-length-encoding-3.jq b/Task/Run-length-encoding/jq/run-length-encoding-3.jq new file mode 100644 index 0000000000..0bf6b26aa1 --- /dev/null +++ b/Task/Run-length-encoding/jq/run-length-encoding-3.jq @@ -0,0 +1 @@ +"ABBCCC" | run_length_encode | run_length_decode diff --git a/Task/Run-length-encoding/jq/run-length-encoding-4.jq b/Task/Run-length-encoding/jq/run-length-encoding-4.jq new file mode 100644 index 0000000000..19e7e5306c --- /dev/null +++ b/Task/Run-length-encoding/jq/run-length-encoding-4.jq @@ -0,0 +1,2 @@ +$ jq -n -f Run_length_encoding.jq +"ABBCCC" diff --git a/Task/Runge-Kutta-method/ERRE/runge-kutta-method.erre b/Task/Runge-Kutta-method/ERRE/runge-kutta-method.erre new file mode 100644 index 0000000000..16cf7a2c63 --- /dev/null +++ b/Task/Runge-Kutta-method/ERRE/runge-kutta-method.erre @@ -0,0 +1,25 @@ +PROGRAM RUNGE_KUTTA + +CONST DELTA_T=0.1 + +FUNCTION Y1(T,Y) + Y1=T*SQR(Y) +END FUNCTION + +BEGIN + Y=1.0 + FOR I%=0 TO 100 DO + T=I%*DELTA_T + + IF T=INT(T) THEN ! print every tenth + ACTUAL=((T^2+4)^2)/16 ! exact solution + PRINT("Y(";T;")=";Y;TAB(20);"Error=";ACTUAL-Y) + END IF + + K1=Y1(T,Y) + K2=Y1(T+DELTA_T/2,Y+DELTA_T/2*K1) + K3=Y1(T+DELTA_T/2,Y+DELTA_T/2*K2) + K4=Y1(T+DELTA_T,Y+DELTA_T*K3) + Y+=DELTA_T*(K1+2*(K2+K3)+K4)/6 + END FOR +END PROGRAM diff --git a/Task/Runge-Kutta-method/FreeBASIC/runge-kutta-method.freebasic b/Task/Runge-Kutta-method/FreeBASIC/runge-kutta-method.freebasic new file mode 100644 index 0000000000..28c751d23a --- /dev/null +++ b/Task/Runge-Kutta-method/FreeBASIC/runge-kutta-method.freebasic @@ -0,0 +1,31 @@ +' version 03-10-2015 +' compile with: fbc -s console +' translation of BBC BASIC + +Dim As Double y = 1, t, actual, k1, k2, k3, k4 + +Print + +For i As Integer = 0 To 100 + + t = i / 10 + + If t = Int(t) Then + actual = ((t ^ 2 + 4) ^ 2) / 16 + Print "y("; Str(t); ") ="; y ; Tab(27); "Error = "; actual - y + End If + + k1 = t * Sqr(y) + k2 = (t + 0.05) * Sqr(y + 0.05 * k1) + k3 = (t + 0.05) * Sqr(y + 0.05 * k2) + k4 = (t + 0.10) * Sqr(y + 0.10 * k3) + y += 0.1 * (k1 + 2 * (k2 + k3) + k4) / 6 + +Next i + + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/Runge-Kutta-method/FutureBasic/runge-kutta-method.futurebasic b/Task/Runge-Kutta-method/FutureBasic/runge-kutta-method.futurebasic new file mode 100644 index 0000000000..b48026937f --- /dev/null +++ b/Task/Runge-Kutta-method/FutureBasic/runge-kutta-method.futurebasic @@ -0,0 +1,29 @@ +include "ConsoleWindow" + +def tab 9 + +local fn dydx( x as double, y as double ) as double +end fn = x * sqr(y) + +local fn exactY( x as long ) as double +end fn = ( x ^2 + 4 ) ^2 / 16 + +dim as long i +dim as double h, k1, k2, k3, k4, x, y, result + +h = 0.1 +y = 1 +for i = 0 to 100 +x = i * h +if x == int(x) +result = fn exactY( x ) +print "y("; mid$( str$(x), 2, len(str$(x) )); ") = "; y, "Error = "; result - y +end if + +k1 = h * fn dydx( x, y ) +k2 = h * fn dydx( x + h / 2, y + k1 / 2 ) +k3 = h * fn dydx( x + h / 2, y + k2 / 2 ) +k4 = h * fn dydx( x + h, y + k3 ) + +y = y + 1 / 6 * ( k1 + 2 * k2 + 2 * k3 + k4 ) +next diff --git a/Task/Runge-Kutta-method/Ring/runge-kutta-method.ring b/Task/Runge-Kutta-method/Ring/runge-kutta-method.ring new file mode 100644 index 0000000000..bc601e9996 --- /dev/null +++ b/Task/Runge-Kutta-method/Ring/runge-kutta-method.ring @@ -0,0 +1,13 @@ +decimals(8) +y = 1.0 +for i = 0 to 100 + t = i / 10 + if t = floor(t) + actual = (pow((pow(t,2) + 4),2)) / 16 + see "y(" + t + ") = " + y + " error = " + (actual - y) + nl ok + k1 = t * sqrt(y) + k2 = (t + 0.05) * sqrt(y + 0.05 * k1) + k3 = (t + 0.05) * sqrt(y + 0.05 * k2) + k4 = (t + 0.10) * sqrt(y + 0.10 * k3) + y += 0.1 * (k1 + 2 * (k2 + k3) + k4) / 6 +next diff --git a/Task/Runge-Kutta-method/Sidef/runge-kutta-method.sidef b/Task/Runge-Kutta-method/Sidef/runge-kutta-method.sidef new file mode 100644 index 0000000000..9af1d677da --- /dev/null +++ b/Task/Runge-Kutta-method/Sidef/runge-kutta-method.sidef @@ -0,0 +1,21 @@ +func runge_kutta(yp) { + func (t, y, δt) { + var a = (δt * yp(t, y)); + var b = (δt * yp(t + δt/2, y + a/2)); + var c = (δt * yp(t + δt/2, y + b/2)); + var d = (δt * yp(t + δt, y + c)); + (a + 2*(b + c) + d) / 6; + } +} + +define δt = 0.1; +var δy = runge_kutta(func(t, y) { t * y.sqrt }); + +var(t, y) = (0, 1); +loop { + t.is_int && + printf("y(%2d) = %12f ± %e\n", t, y, abs(y - ((t**2 + 4)**2 / 16))); + t <= 10 || break; + y += δy(t, y, δt); + t += δt; +} diff --git a/Task/Runge-Kutta-method/Swift/runge-kutta-method.swift b/Task/Runge-Kutta-method/Swift/runge-kutta-method.swift new file mode 100644 index 0000000000..b87e1896a9 --- /dev/null +++ b/Task/Runge-Kutta-method/Swift/runge-kutta-method.swift @@ -0,0 +1,38 @@ +import Foundation + +func rk4(dx: Double, x: Double, y: Double, f: (Double, Double) -> Double) -> Double { + let k1 = dx * f(x, y) + let k2 = dx * f(x + dx / 2, y + k1 / 2) + let k3 = dx * f(x + dx / 2, y + k2 / 2) + let k4 = dx * f(x + dx, y + k3) + + return y + (k1 + 2 * k2 + 2 * k3 + k4) / 6 +} + +var y = [Double]() +var x: Double = 0.0 +var y2: Double = 0.0 + +var x0: Double = 0.0 +var x1: Double = 10.0 +var dx: Double = 0.1 + +var i = 0 +var n = Int(1 + (x1 - x0) / dx) + +y.append(1) +for i in 1.. Double in + return x * sqrt(y) + }) +} + +print(" x y rel. err.") +print("------------------------------") + +for (var i = 0; i < n; i += 10) { + x = x0 + dx * Double(i) + y2 = pow(x * x / 4 + 1, 2) + + print(String(format: "%2g %11.6g %11.5g", x, y[i], y[i]/y2 - 1)) +} diff --git a/Task/Runge-Kutta-method/jq/runge-kutta-method-1.jq b/Task/Runge-Kutta-method/jq/runge-kutta-method-1.jq new file mode 100644 index 0000000000..6f0e0a13b8 --- /dev/null +++ b/Task/Runge-Kutta-method/jq/runge-kutta-method-1.jq @@ -0,0 +1,7 @@ +def until(cond; next): + def _until: if cond then . else (next|_until) end; + _until; + +def while(cond; update): + def _while: if cond then ., (update | _while) else empty end; + _while; diff --git a/Task/Runge-Kutta-method/jq/runge-kutta-method-2.jq b/Task/Runge-Kutta-method/jq/runge-kutta-method-2.jq new file mode 100644 index 0000000000..517dfeebd8 --- /dev/null +++ b/Task/Runge-Kutta-method/jq/runge-kutta-method-2.jq @@ -0,0 +1,8 @@ +# yprime maps [t,y] to a number, i.e. t * sqrt(y) +def yprime: .[0] * (.[1] | sqrt); + +# The exact solution of yprime: +def actual: + . as $t + | (( $t*$t) + 4 ) + | . * . / 16; diff --git a/Task/Runge-Kutta-method/jq/runge-kutta-method-3.jq b/Task/Runge-Kutta-method/jq/runge-kutta-method-3.jq new file mode 100644 index 0000000000..38ce7c1e1e --- /dev/null +++ b/Task/Runge-Kutta-method/jq/runge-kutta-method-3.jq @@ -0,0 +1,9 @@ +# n is the number of decimal places of precision +def round(n): + (if . < 0 then -1 else 1 end) as $s + | $s*10*.*n | if (floor % 10) > 4 then (.+5) else . end | ./10 | floor/n | .*$s; + +def abs: if . < 0 then -. else . end; + +# Is the input an integer? +def integerq: ((. - ((.+.01) | floor)) | abs) < 0.01; diff --git a/Task/Runge-Kutta-method/jq/runge-kutta-method-4.jq b/Task/Runge-Kutta-method/jq/runge-kutta-method-4.jq new file mode 100644 index 0000000000..2721cb0b77 --- /dev/null +++ b/Task/Runge-Kutta-method/jq/runge-kutta-method-4.jq @@ -0,0 +1,14 @@ +def dt: 0.1; + +# Input: [t, y]; yp is a filter that accepts [t,y] as input +def runge_kutta(yp): + .[0] as $t | .[1] as $y + | (dt * yp) as $a + | (dt * ([ ($t + (dt/2)), $y + ($a/2) ] | yp)) as $b + | (dt * ([ ($t + (dt/2)), $y + ($b/2) ] | yp)) as $c + | (dt * ([ ($t + dt) , $y + $c ] | yp)) as $d + | ($a + (2*($b + $c)) + $d) / 6 +; + +# Input: [t,y] +def dy(f): runge_kutta(f); diff --git a/Task/Runge-Kutta-method/jq/runge-kutta-method-5.jq b/Task/Runge-Kutta-method/jq/runge-kutta-method-5.jq new file mode 100644 index 0000000000..94e35c9894 --- /dev/null +++ b/Task/Runge-Kutta-method/jq/runge-kutta-method-5.jq @@ -0,0 +1,10 @@ +# state: [t,y] +[0,1] +| while( .[0] <= 10; + .[0] as $t | .[1] as $y + | [$t + dt, $y + dy(yprime) ] ) +| .[0] as $t | .[1] as $y +| if $t | integerq then + "y(\($t|round(1))) = \($y|round(10000)) ± \( ($t|actual) - $y | abs)" + else empty + end diff --git a/Task/Runge-Kutta-method/jq/runge-kutta-method-6.jq b/Task/Runge-Kutta-method/jq/runge-kutta-method-6.jq new file mode 100644 index 0000000000..f78e153d91 --- /dev/null +++ b/Task/Runge-Kutta-method/jq/runge-kutta-method-6.jq @@ -0,0 +1,16 @@ +$ time jq -r -n -f rk4.pl.jq +y(0) = 1 ± 0 +y(1) = 1.5625 ± 1.4572189210859676e-07 +y(2) = 4 ± 9.194792029987298e-07 +y(3) = 10.5625 ± 2.9095624576314094e-06 +y(4) = 25 ± 6.234909392333066e-06 +y(5) = 52.5625 ± 1.081969734428867e-05 +y(6) = 100 ± 1.659459609015812e-05 +y(7) = 175.5625 ± 2.3517728038768837e-05 +y(8) = 289 ± 3.156520000402452e-05 +y(9) = 451.5625 ± 4.072315812209126e-05 +y(10) = 675.9999 ± 5.0983286655537086e-05 + +real 0m0.048s +user 0m0.013s +sys 0m0.006s diff --git a/Task/Runge-Kutta-method/jq/runge-kutta-method-7.jq b/Task/Runge-Kutta-method/jq/runge-kutta-method-7.jq new file mode 100644 index 0000000000..033a73b4db --- /dev/null +++ b/Task/Runge-Kutta-method/jq/runge-kutta-method-7.jq @@ -0,0 +1,43 @@ +# Input: [t, y, dt] +def newRK4Step(yp): + .[0] as $t | .[1] as $y | .[2] as $dt + | ($dt * ([$t, $y]|yp)) as $dy1 + | ($dt * ([$t+$dt/2, $y+$dy1/2]|yp)) as $dy2 + | ($dt * ([$t+$dt/2, $y+$dy2/2]|yp)) as $dy3 + | ($dt * ([$t+$dt, $y+$dy3] |yp)) as $dy4 + | $y + ($dy1+2*($dy2+$dy3)+$dy4)/6 +; + + +def printErr: # input: [t, y] + def abs: if . < 0 then -. else . end; + .[0] as $t | .[1] as $y + | "y(\($t)) = \($y) with error: \( (($t|actual) - $y) | abs )" +; + +def main(t0; y0; tFinal; dtPrint): + + def ypStep: newRK4Step(yprime) ; + + 0.1 as $dtStep # step value + # [ t, y] is the state vector + | [ t0, y0 ] + | while( .[0] <= tFinal; + .[0] as $t | .[1] as $y + | ($t + dtPrint) as $t1 + | (((dtPrint/$dtStep) + 0.5) | floor) as $steps + | [$steps, $t, $y] # state vector + | until( .[0] <= 1; + .[0] as $steps + | .[1] as $t + | .[2] as $y + | [ ($steps - 1), ($t + $dtStep), ([$t, $y, $dtStep]|ypStep) ] + ) + | .[1] as $t | .[2] as $y + | [$t1, ([ $t, $y, ($t1-$t)] | ypStep)] # adjust step to integer time + ) + | printErr # print results +; + +# main(t0; y0; tFinal; dtPrint) +main(0; 1; 10; 1) diff --git a/Task/Runge-Kutta-method/jq/runge-kutta-method-8.jq b/Task/Runge-Kutta-method/jq/runge-kutta-method-8.jq new file mode 100644 index 0000000000..cf23012229 --- /dev/null +++ b/Task/Runge-Kutta-method/jq/runge-kutta-method-8.jq @@ -0,0 +1,16 @@ +$ time jq -n -r -f runge-kutta.jq +y(0) = 1 with error: 0 +y(1) = 1.562499854278108 with error: 1.4572189210859676e-07 +y(2) = 3.9999990805207974 with error: 9.194792025546406e-07 +y(3) = 10.562497090437544 with error: 2.9095624558550526e-06 +y(4) = 24.999993765090615 with error: 6.234909385227638e-06 +y(5) = 52.562489180302656 with error: 1.081969734428867e-05 +y(6) = 99.99998340540387 with error: 1.6594596132790684e-05 +y(7) = 175.56247648227188 with error: 2.3517728124033965e-05 +y(8) = 288.9999684347997 with error: 3.156520028824161e-05 +y(9) = 451.56245927684154 with error: 4.0723158463151776e-05 +y(10) = 675.9999490167129 with error: 5.0983287110284436e-05 + +real 0m0.023s +user 0m0.014s +sys 0m0.006s diff --git a/Task/Runtime-evaluation-In-an-environment/EchoLisp/runtime-evaluation-in-an-environment.echolisp b/Task/Runtime-evaluation-In-an-environment/EchoLisp/runtime-evaluation-in-an-environment.echolisp new file mode 100644 index 0000000000..f91dbb88c2 --- /dev/null +++ b/Task/Runtime-evaluation-In-an-environment/EchoLisp/runtime-evaluation-in-an-environment.echolisp @@ -0,0 +1,12 @@ +(define (eval-with-x prog x) + (eval prog (environment-new (list (list 'x x))))) + +(define prog '( + 1 (* x x))) + +(eval-with-x prog 10) → 101 +(eval-with-x prog 1000) → 1000001 +(- (eval-with-x prog 1000) (eval-with-x prog 10)) → 999900 + +;; check x is unbound (no global) +x +😖️ error: #|user| : unbound variable : x diff --git a/Task/Runtime-evaluation-In-an-environment/Ring/runtime-evaluation-in-an-environment.ring b/Task/Runtime-evaluation-In-an-environment/Ring/runtime-evaluation-in-an-environment.ring new file mode 100644 index 0000000000..0fab5f1ac6 --- /dev/null +++ b/Task/Runtime-evaluation-In-an-environment/Ring/runtime-evaluation-in-an-environment.ring @@ -0,0 +1,7 @@ +expression = "return pow(x,2) - 7" +one = evalwithx(expression, 1.2) +two = evalwithx(expression, 3.4) +see "one = " + one + nl + "two = " + two + nl + +func evalwithx expr, x + return eval(expr) diff --git a/Task/Runtime-evaluation-In-an-environment/Sidef/runtime-evaluation-in-an-environment.sidef b/Task/Runtime-evaluation-In-an-environment/Sidef/runtime-evaluation-in-an-environment.sidef new file mode 100644 index 0000000000..586a01e12b --- /dev/null +++ b/Task/Runtime-evaluation-In-an-environment/Sidef/runtime-evaluation-in-an-environment.sidef @@ -0,0 +1,7 @@ +func eval_with_x(code, x, y) { + var f = eval(code); + x = y; + eval(code) - f; +} + +say eval_with_x(x: 3, y: 5, code: '2 ** x'); # => 24 diff --git a/Task/Runtime-evaluation/EchoLisp/runtime-evaluation.echolisp b/Task/Runtime-evaluation/EchoLisp/runtime-evaluation.echolisp new file mode 100644 index 0000000000..e216b484b5 --- /dev/null +++ b/Task/Runtime-evaluation/EchoLisp/runtime-evaluation.echolisp @@ -0,0 +1,6 @@ +(eval (list * 6 7)) + → 42 +(eval '(* 6 7)) ;; quoted argument + → 42 +(eval (read-from-string "(* 6 7)")) + → 42 diff --git a/Task/Runtime-evaluation/Harbour/runtime-evaluation.harbour b/Task/Runtime-evaluation/Harbour/runtime-evaluation.harbour new file mode 100644 index 0000000000..c6e45219ee --- /dev/null +++ b/Task/Runtime-evaluation/Harbour/runtime-evaluation.harbour @@ -0,0 +1,9 @@ +Procedure Main() + local bAdd := {|Label,n1,n2| Qout( Label ), QQout( n1 + n2 )} + Eval( bAdd, "5+5 = ", 5, 5 ) + Eval( bAdd, "5-5 = ", 5, -5 ) + return + +Upon execution you see: +5+5 = 10 +5-5 = 0 diff --git a/Task/Runtime-evaluation/Lasso/runtime-evaluation.lasso b/Task/Runtime-evaluation/Lasso/runtime-evaluation.lasso new file mode 100644 index 0000000000..d43ae8187c --- /dev/null +++ b/Task/Runtime-evaluation/Lasso/runtime-evaluation.lasso @@ -0,0 +1,30 @@ +//code, fragment name, autocollect, inplaintext +local(mycode = "'Hello world, it is '+date") +sourcefile('['+#mycode+']','arbritraty_name', true, true)->invoke + +'\r' + + +var(x = 100) +local(mycode = "Outside Lasso\r['Hello world, var x is '+var(x)]") +// autocollect (3rd param): return any output generated +// inplaintext (4th param): if true, assumes this is mixed Lasso and plain text, +// requires Lasso code to be in square brackets or other supported code block demarkation. +sourcefile(#mycode,'arbritraty_name', true, true)->invoke + +'\r' + +var(y = 2) +local(mycode = "'Hello world, is there output?\r' +var(x) *= var(y)") +// autocollect (3rd param): as false, no output returned +// inplaintext (4th param): as false, assumes this is Lasso code, no mixed-mode Lasso and text. +sourcefile(#mycode,'arbritraty_name', false, false)->invoke +'var x is now: '+$x + +'\r' + +var(z = 3) +local(mycode = "var(x) *= var(z)") +sourcefile(#mycode,'arbritraty_name', false, false)->invoke +'var x is now: '+$x diff --git a/Task/Runtime-evaluation/Oforth/runtime-evaluation-1.oforth b/Task/Runtime-evaluation/Oforth/runtime-evaluation-1.oforth new file mode 100644 index 0000000000..447ec32dbe --- /dev/null +++ b/Task/Runtime-evaluation/Oforth/runtime-evaluation-1.oforth @@ -0,0 +1,5 @@ +"[ [ $a, 12], [$b, 1.2], [ $c, [ $aaa, $bbb, $ccc ] ], [ $torun, #first ] ]" perform .s +[1] (List) [[a, 12], [b, 1.2], [c, [aaa, bbb, ccc]], [torun, #first]] + +"12 13 +" perform +[1:interpreter] ExCompiler : Can't evaluate <+> diff --git a/Task/Runtime-evaluation/Oforth/runtime-evaluation-2.oforth b/Task/Runtime-evaluation/Oforth/runtime-evaluation-2.oforth new file mode 100644 index 0000000000..5625919e78 --- /dev/null +++ b/Task/Runtime-evaluation/Oforth/runtime-evaluation-2.oforth @@ -0,0 +1,4 @@ +"12 13 + println" eval +25 +": newFunction(a) a + ; 12 10 newFunction println" eval +22 diff --git a/Task/Runtime-evaluation/Ring/runtime-evaluation-1.ring b/Task/Runtime-evaluation/Ring/runtime-evaluation-1.ring new file mode 100644 index 0000000000..dbf3ddb3f0 --- /dev/null +++ b/Task/Runtime-evaluation/Ring/runtime-evaluation-1.ring @@ -0,0 +1,5 @@ +Eval("nOutput = 5+2*5 " ) +See "5+2*5 = " + nOutput + nl +Eval("for x = 1 to 10 see x + nl next") +Eval("func test see 'message from test!' ") +test() diff --git a/Task/Runtime-evaluation/Ring/runtime-evaluation-2.ring b/Task/Runtime-evaluation/Ring/runtime-evaluation-2.ring new file mode 100644 index 0000000000..8485ea047a --- /dev/null +++ b/Task/Runtime-evaluation/Ring/runtime-evaluation-2.ring @@ -0,0 +1,12 @@ +5+2*5 = 15 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +message from test! diff --git a/Task/Runtime-evaluation/Ring/runtime-evaluation-3.ring b/Task/Runtime-evaluation/Ring/runtime-evaluation-3.ring new file mode 100644 index 0000000000..d423f8b63a --- /dev/null +++ b/Task/Runtime-evaluation/Ring/runtime-evaluation-3.ring @@ -0,0 +1,9 @@ +while true + see nl + "code:> " + give cCode + try + eval(cCode) + catch + see cCatchError + done +end diff --git a/Task/Runtime-evaluation/Ring/runtime-evaluation-4.ring b/Task/Runtime-evaluation/Ring/runtime-evaluation-4.ring new file mode 100644 index 0000000000..19bca771cf --- /dev/null +++ b/Task/Runtime-evaluation/Ring/runtime-evaluation-4.ring @@ -0,0 +1,20 @@ +code:> see "hello world" +hello world +code:> for x = 1 to 10 see x + nl next +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 + +code:> func test see "Hello from test" + nl + +code:> test() +Hello from test + +code:> bye diff --git a/Task/Runtime-evaluation/Sidef/runtime-evaluation.sidef b/Task/Runtime-evaluation/Sidef/runtime-evaluation.sidef new file mode 100644 index 0000000000..6eba98a586 --- /dev/null +++ b/Task/Runtime-evaluation/Sidef/runtime-evaluation.sidef @@ -0,0 +1,3 @@ +var (a, b) = (-5, 7); +say eval '(a * b).abs'; # => 35 +say (a * b -> abs); # => 35 diff --git a/Task/Runtime-evaluation/Sparkling/runtime-evaluation-1.sparkling b/Task/Runtime-evaluation/Sparkling/runtime-evaluation-1.sparkling new file mode 100644 index 0000000000..4de64a1f35 --- /dev/null +++ b/Task/Runtime-evaluation/Sparkling/runtime-evaluation-1.sparkling @@ -0,0 +1,2 @@ +let fn = exprtofn("13 + 37"); +fn() // -> 50 diff --git a/Task/Runtime-evaluation/Sparkling/runtime-evaluation-2.sparkling b/Task/Runtime-evaluation/Sparkling/runtime-evaluation-2.sparkling new file mode 100644 index 0000000000..8da3c371ff --- /dev/null +++ b/Task/Runtime-evaluation/Sparkling/runtime-evaluation-2.sparkling @@ -0,0 +1,2 @@ +let fn = exprtofn("#0 * #1"); +fn(3, 4) // -> 12 diff --git a/Task/Runtime-evaluation/Sparkling/runtime-evaluation-3.sparkling b/Task/Runtime-evaluation/Sparkling/runtime-evaluation-3.sparkling new file mode 100644 index 0000000000..ab5c2a00b9 --- /dev/null +++ b/Task/Runtime-evaluation/Sparkling/runtime-evaluation-3.sparkling @@ -0,0 +1,2 @@ +let fn = compile("for (var i = 0; i < 10; i++) { print(i); }"); +fn(); // result: 0 1 2 3 4 5 6 7 8 9 diff --git a/Task/Runtime-evaluation/Ursa/runtime-evaluation.ursa b/Task/Runtime-evaluation/Ursa/runtime-evaluation.ursa new file mode 100644 index 0000000000..70f15f39ed --- /dev/null +++ b/Task/Runtime-evaluation/Ursa/runtime-evaluation.ursa @@ -0,0 +1,2 @@ +# writes hello world to the console +eval "out \"hello world\" endl console" console diff --git a/Task/S-Expressions/Ceylon/s-expressions-1.ceylon b/Task/S-Expressions/Ceylon/s-expressions-1.ceylon new file mode 100644 index 0000000000..6790d69227 --- /dev/null +++ b/Task/S-Expressions/Ceylon/s-expressions-1.ceylon @@ -0,0 +1,3 @@ +module rosetta "1.0.0" { + import ceylon.collection "1.2.1"; +} diff --git a/Task/S-Expressions/Ceylon/s-expressions-2.ceylon b/Task/S-Expressions/Ceylon/s-expressions-2.ceylon new file mode 100644 index 0000000000..30b7e84f0d --- /dev/null +++ b/Task/S-Expressions/Ceylon/s-expressions-2.ceylon @@ -0,0 +1,156 @@ +import ceylon.collection { + + ArrayList +} + +class Symbol(shared String text) { + string => text; +} + +abstract class Node() of Leaf | Branch {} +class Leaf(shared String|Integer|Float|Symbol data) extends Node() { + string => data.string; +} +class Branch() extends Node() { + shared ArrayList nodes = ArrayList(); + string => nodes.string; +} + +shared void run() { + + alias Token => String|Character|Integer|Float|Symbol; + + {Token*} tokenize(String input) { + + class Mode { + shared new neutral {} + shared new symbol {} + shared new quoted {} + shared new integer {} + shared new float {} + shared new escape {} + } + + value tokens = ArrayList(); + variable value mode = Mode.neutral; + value currentToken = StringBuilder(); + + void completeToken() { + value string = currentToken.string; + if(mode == Mode.symbol) { + tokens.add(Symbol(string)); + } + if(mode == Mode.quoted) { + tokens.add(string); + } + if(mode == Mode.integer) { + assert(exists int = parseInteger(string)); + tokens.add(int); + } + if(mode == Mode.float) { + assert(exists float = parseFloat(string)); + tokens.add(float); + } + mode = Mode.neutral; + currentToken.clear(); + } + + for(char in input) { + switch(char) + case('(' | ')') { + if(mode != Mode.quoted) { + completeToken(); + tokens.add(char); + } else { + currentToken.appendCharacter(char); + } + } + case('\"') { + if(mode == Mode.escape) { + currentToken.appendCharacter(char); + mode = Mode.quoted; + } else if(mode != Mode.quoted) { + mode = Mode.quoted; + } else if(mode == Mode.quoted) { + completeToken(); + } + } + case('\\') { + if(mode == Mode.quoted) { + mode = Mode.escape; + } else { + currentToken.appendCharacter(char); + } + } + case(' ' | '\n' | '\r') { + if(mode != Mode.quoted) { + completeToken(); + } else { + currentToken.append(" "); + } + } + else { + if(mode == Mode.neutral) { + if(char.digit) { + mode = Mode.integer; + } else { + mode = Mode.symbol; + } + } + if(mode == Mode.integer && (char == '.' || char == ',')) { + mode = Mode.float; + } + currentToken.appendCharacter(char); + } + } + completeToken(); + return tokens; + } + + Node readFromTokens(ArrayList tokens) { + if(exists first = tokens.accept()) { + if(first == '(') { + value branch = Branch(); + while(!tokens.empty) { + if(exists token = tokens.first) { + if(token == ')') { + tokens.accept(); + break; + } else { + branch.nodes.add(readFromTokens(tokens)); + } + } + } + return branch; + } else { + if(is String|Integer|Float|Symbol first) { + return Leaf(first); + } else { + throw Exception("unexpected token ``first``"); + } + } + } else { + return Branch(); + } + } + + void prettyPrint(Node node, Integer indentation = 0) { + + void paddedPrint(String s) => print(" ".repeat(indentation) + s); + + if(is Leaf node) { + paddedPrint(node.string); + } else { + paddedPrint("("); + for(n in node.nodes) { + prettyPrint(n, indentation + 2); + } + paddedPrint(")"); + } + } + + value tokens = tokenize("""((data "quoted data" 123 4.5) + (data (!@# (4.5) "(more" "data)")))"""); + value tree = readFromTokens(ArrayList {*tokens}); + prettyPrint(tree); +} diff --git a/Task/S-Expressions/EchoLisp/s-expressions.echolisp b/Task/S-Expressions/EchoLisp/s-expressions.echolisp new file mode 100644 index 0000000000..76c81f1673 --- /dev/null +++ b/Task/S-Expressions/EchoLisp/s-expressions.echolisp @@ -0,0 +1,16 @@ +(define input-string #'((data "quoted data" 123 4.5)\n(data (!@# (4.5) "(more" "data)")))'#) + +input-string + → "((data "quoted data" 123 4.5) + (data (!@# (4.5) "(more" "data)")))" + +(define s-expr (read-from-string input-string)) +s-expr + → ((data "quoted data" 123 4.5) (data (!@# (4.5) "(more" "data)"))) + +(first s-expr) + → (data "quoted data" 123 4.5) +(first(first s-expr)) + → data +(first(rest s-expr)) + → (data (!@# (4.5) "(more" "data)")) diff --git a/Task/S-Expressions/Phix/s-expressions.phix b/Task/S-Expressions/Phix/s-expressions.phix new file mode 100644 index 0000000000..d0d70acd39 --- /dev/null +++ b/Task/S-Expressions/Phix/s-expressions.phix @@ -0,0 +1,84 @@ +constant s_expr_str = """ +((data "quoted data" 123 4.5) + (data (!@# (4.5) "(more" "data)")))""" + +function skip_spaces(string s, integer sidx) + while sidx<=length(s) and find(s[sidx]," \t\r\n") do sidx += 1 end while + return sidx +end function + +function get_term(string s, integer sidx) +-- get a single quoted string, symbol, or number. +integer ch = s[sidx] +string res = "" + if ch='\"' then + res &= ch + while 1 do + sidx += 1 + ch = s[sidx] + res &= ch + if ch='\\' then + sidx += 1 + ch = s[sidx] + res &= ch + elsif ch='\"' then + sidx += 1 + exit + end if + end while + else + integer asnumber = (ch>='0' and ch<='9') + while not find(ch,") \t\r\n") do + res &= ch + sidx += 1 + if sidx>length(s) then exit end if + ch = s[sidx] + end while + if asnumber then + sequence scanres = scanf(res,"%f") + if length(scanres)=1 then return {scanres[1][1],sidx} end if + -- error? (failed to parse number) + end if + end if + return {res,sidx} +end function + +function parse_s_expr(string s, integer sidx) +integer ch = s[sidx] +sequence res = {} +object element + if ch!='(' then ?9/0 end if + sidx += 1 + while 1 do + sidx = skip_spaces(s,sidx) + -- error? (if past end of string/missing ')') + ch = s[sidx] + if ch=')' then exit end if + if ch='(' then + {element,sidx} = parse_s_expr(s,sidx) + else + {element,sidx} = get_term(s,sidx) + end if + res = append(res,element) + end while + sidx = skip_spaces(s,sidx+1) + return {res,sidx} +end function + +sequence s_expr +integer sidx +{s_expr,sidx} = parse_s_expr(s_expr_str,1) +if sidx<=length(s_expr_str) then + printf(1,"incomplete parse(\"%s\")\n",{s_expr_str[sidx..$]}) +end if + +puts(1,"\nThe string:\n") +?s_expr_str + +puts(1,"\nDefault pretty printing:\n") +--?s_expr +pp(s_expr) + +puts(1,"\nBespoke pretty printing:\n") +--ppEx(s_expr,{pp_Nest,1,pp_StrFmt,-3,pp_Brkt,"()"}) +ppEx(s_expr,{pp_Nest,4,pp_StrFmt,-3,pp_Brkt,"()"}) diff --git a/Task/S-Expressions/Potion/s-expressions.potion b/Task/S-Expressions/Potion/s-expressions.potion new file mode 100644 index 0000000000..e0a4adc44f --- /dev/null +++ b/Task/S-Expressions/Potion/s-expressions.potion @@ -0,0 +1,72 @@ +isdigit = (c): 47 < c ord and c ord < 58. +iswhitespace = (c): c ord == 10 or c ord == 13 or c == " ". + +# str: a string of the form "...[{}]..." +# i: index to start at (must be the index of ) +# => returns (, ) +parsesymbol = (str, i) : + datum = () + while (str(i) != "(" and str(i) != ")" and not iswhitespace(str(i)) and str(i) != "\"") : + datum append(str(i++)) + . + (datum join, i) +. + +# str: a string of the form "...[]{}[{}]..." +# i: index to start at (must be the index of the first token) +# => returns (, ) +parsenumber = (str, i) : + datum = () + dot = false + while (str(i) != "(" and str(i) != ")" and not iswhitespace(str(i)) and str(i) != "\"") : + if (str(i) == "."): dot = true. + datum append(str(i++)) + . + if (dot): (datum join number, i). + else: (datum join number integer, i). +. + +# str: a string of the form "...\"....\"..." +# i: index to start at (must be the index of the first quote) +# => returns (, ) +parsestring = (str, i) : + datum = ("\"") + while (str(++i) != "\"") : + datum append(str(i)) + . + datum append("\"") + (datum join, ++i) +. + +# str: a string of the form "...(...)..." +# i: index to start at +# => returns (, ) +parselist = (str, i) : + lst = () + data = () + while (str(i) != "("): i++. + i++ + while (str(i) != ")") : + if (not iswhitespace(str(i))) : + if (isdigit(str(i)) or (str(i) == "-" and isdigit(str(i + 1)))): data = parsenumber(str, i). + elsif (str(i) == "\""): data = parsestring(str, i). + elsif (str(i) == "("): data = parselist(str, i). + else: data = parsesymbol(str, i). + lst append(data(0)) + i = data(1) + . else : + ++i + . + . + (lst, ++i) +. + +parsesexpr = (str) : + parselist(str, 0)(0) +. + +parsesexpr("(define (factorial x) \"compute factorial\" (version 2.0) (apply * (range 1 x)))") string print +"\n" print +parsesexpr("((data \"quoted data\" 123 4.5) + (data (!@# (4.5) \"(more\" \"data)\")))") string print +"\n" print diff --git a/Task/S-Expressions/Sidef/s-expressions.sidef b/Task/S-Expressions/Sidef/s-expressions.sidef new file mode 100644 index 0000000000..a034d93987 --- /dev/null +++ b/Task/S-Expressions/Sidef/s-expressions.sidef @@ -0,0 +1,47 @@ +var t = frequire('Text::Balanced'); + +func sexpr(txt) { + txt.trim!; + + var m = txt.match(/^\((.*)\)$/s) || die "Invalid: <<#{txt}>>"; + txt = m[0]; + + var w; + var ret = []; + while (!txt.is_empty) { + given (txt.first) { + when('(') { + (w, txt) = t.extract_bracketed(txt, '()'); + w = sexpr(w); + } + when ('"') { + (w, txt) = t.extract_delimited(txt, '"') + w.sub!(/^"(.*)"/, {|s1| s1 }); + } + default { + txt.sub!(/^(\S+)/, {|s1| w = s1; '' }); + } + } + ret << w; + txt.trim_beg!; + } + return ret; +} + +func sexpr2txt(String e) { + e ~~ /[\s"\(\)]/ ? do { e.gsub!('"', '\\"'); %Q("#{e}") } : e; +} + +func sexpr2txt(expr) { + '(' + expr.map {|e| sexpr2txt(e) }.join(' ') + ')'; +} + +var s = sexpr(%q{ + +((data "quoted data" 123 4.5) + (data (!@# (4.5) "(more" "data)"))) + +}); + +say s; # dump structure +say sexpr2txt(s); # convert back diff --git a/Task/SEDOLs/FreeBASIC/sedols.freebasic b/Task/SEDOLs/FreeBASIC/sedols.freebasic new file mode 100644 index 0000000000..564e49eb1f --- /dev/null +++ b/Task/SEDOLs/FreeBASIC/sedols.freebasic @@ -0,0 +1,93 @@ +' version 05-07-2015 +' compile with: fbc -s console + +Function check_sedol(input_nr As String) As Integer + input_nr = Trim(input_nr) + Dim As Integer i, j, x, nr_begin, sum + Dim As String ch, legal = "AEIOU0123456789BCDFGHJKLMNPQRSTVWXYZ" + Dim As Integer weight(0 To ...) = { 1, 3, 1, 7, 3, 9, 1} + + x = Len(input_nr) + If x < 6 Or x > 7 Then + Return -99 ' to long or to short + End If + + For i = 0 To 5 + ch = Chr(input_nr[i]) + j = InStr(legal,ch) + If j < 6 Then + Return -90+j ' not a legal char. or a vowel + End If + j = ch[0] - Asc("0") + If j > 9 Then j = j + (Asc("0") + 10- Asc("A")) + If i = 0 AndAlso j < 10 Then nr_begin = 1 + If nr_begin = 1 AndAlso i > 0 Then + If j > 9 Then Return -97 ' first is number then all be numbers + End If + sum = sum + j * weight(i) + Next + sum= ((10 - (sum Mod 10)) Mod 10) + If x = 7 Then + j=input_nr[6] - Asc("0") ' checksum digit is only number + If j = sum Then + Return 100+sum ' correct + Else + Return -98 ' wrong + End If + End If + + Return sum ' checksum digit + +End Function + +Sub sedol(in As String) + + Dim As Integer checksum = check_sedol(in) + Print(in); + + Select Case checksum + Case -99 + Print " Illegal SEDOL: wrong length" + Case -98 + Print " Illegal SEDOL: checksum digits do not match" + Case -97 + Print " Illegal SEDOL: starts with number, may only contain numbers" + Case -90 + Print " Illegal SEDOL: illegal character" + Case -89 To -85 + Print " Illegal SEDOL: No vowels allowed" + Case Is > 99 + Print " Valid SEDOL: checksums match" + Case Else + Print " checksum calculated : ";in;Str(checksum) + End Select + +End Sub +' ------=< MAIN >=------ + +Dim As Integer k,checksum +Dim As String in(1 To ...) = {"710889", "B0YBKJ", "406566", "B0YBLH",_ + "228276", "B0YBKL", "557910", "B0YBKR",_ + "585284", "B0YBKT", "B00030"} + +Print "Calculated checksum" +For k = 1 To UBound(in) : sedol(in(k)) : Next + +Print : Print "Check checksum" +Dim As String in1(1 To ...) = {"7108899", "B0YBKJ7", "4065663", "B0YBLH2",_ + "2282765", "B0YBKL9","5579107", "B0YBKR5",_ + "5852842", "B0YBKT7", "B000300"} + +For k = 1 To UBound(in1) : sedol(in1(k)) : Next + +Print : Print "Error test" +Dim As String errors(1 To ...) = {"12", "1234567890", "1B0000", "123 45",_ + "A00000", "B000301"} + +For k = 1 To UBound(errors) : sedol(errors(k)) : Next + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/SEDOLs/Nim/sedols.nim b/Task/SEDOLs/Nim/sedols.nim new file mode 100644 index 0000000000..db592a36a6 --- /dev/null +++ b/Task/SEDOLs/Nim/sedols.nim @@ -0,0 +1,28 @@ +import strutils + +proc c2v(c): int = + assert c notin "AEIOU" + let a = ord(c) + if a < 65: a - 48 + else: a - 55 + +const weight = [1,3,1,7,3,9] + +proc checksum(sedol): string = + var tmp = 0 + for i,s in sedol: + tmp += c2v(s) * weight[i] + result = $((10 - (tmp mod 10)) mod 10) + +for sedol in """710889 +B0YBKJ +406566 +B0YBLH +228276 +B0YBKL +557910 +B0YBKR +585284 +B0YBKT +B00030""".splitLines(): + echo sedol, checksum(sedol) diff --git a/Task/SEDOLs/Oforth/sedols.oforth b/Task/SEDOLs/Oforth/sedols.oforth new file mode 100644 index 0000000000..cf32fa4b27 --- /dev/null +++ b/Task/SEDOLs/Oforth/sedols.oforth @@ -0,0 +1,5 @@ +func: sedol(s) + [ 1, 3, 1, 7, 3, 9 ] s + zipWith(#[ dup isDigit ifTrue: [ '0' - ] else: [ 'A' - 10 + ] * ]) sum + 10 mod 10 swap - 10 mod + StringBuffer new s << swap '0' + <='0' and ch<='Z' and (ch<='9' or ch>='A') and not find(ch,"AEIOU") +end type + +function sedol(string6 t) +sedolch c +integer s = 0 + for i=1 to 6 do + c = t[i] + s += iff(c>='A'?c-'A'+10:c-'0')*{1,3,1,7,3,9}[i] + end for + return t & mod(10-mod(s,10),10)+'0' +end function + +constant tests = {"710889", + "B0YBKJ", + "406566", + "B0YBLH", + "228276", + "B0YBKL", + "557910", + "B0YBKR", + "585284", + "B0YBKT", + "B00030"} +for i=1 to length(tests) do + ?sedol(tests[i]) +end for diff --git a/Task/SEDOLs/Potion/sedols.potion b/Task/SEDOLs/Potion/sedols.potion new file mode 100644 index 0000000000..c0e18cb953 --- /dev/null +++ b/Task/SEDOLs/Potion/sedols.potion @@ -0,0 +1,13 @@ +sedolnum = (c) : + if ("0" ord <= c ord and c ord <= "9" ord): c number integer. + else: 10 + c ord - "A" ord. +. + +sedol = (str) : + weight = (1, 3, 1, 7, 3, 9) + sum = 0 + 6 times (i) : + sum = sum + sedolnum(str(i)) * weight(i) + . + (str, (10 - (sum % 10)) % 10) join +. diff --git a/Task/SEDOLs/Ring/sedols.ring b/Task/SEDOLs/Ring/sedols.ring new file mode 100644 index 0000000000..a5e3db8aaa --- /dev/null +++ b/Task/SEDOLs/Ring/sedols.ring @@ -0,0 +1,24 @@ +see sedol("710889") + nl +see sedol("B0YBKJ") + nl +see sedol("406566") + nl +see sedol("B0YBLH") + nl +see sedol("228276") + nl +see sedol("B0YBKL") + nl +see sedol("557910") + nl +see sedol("B0YBKR") + nl +see sedol("585284") + nl +see sedol("B0YBKT") + nl +see sedol("B00030") + nl + +func sedol d + d = upper(d) + s = 0 + weights = [1, 3, 1, 7, 3, 9] + for i = 1 to 6 + a = substr(d,i,1) + if ascii(a) >= 48 and ascii(a) <= 57 + s += number(a) * weights[i] + else + s += (ascii(a) - 55) * weights[i] ok + next + return d + (10 - (s % 10)) % 10 diff --git a/Task/SEDOLs/Sidef/sedols.sidef b/Task/SEDOLs/Sidef/sedols.sidef new file mode 100644 index 0000000000..6692487a9f --- /dev/null +++ b/Task/SEDOLs/Sidef/sedols.sidef @@ -0,0 +1,29 @@ +func sedol(s) { + + die 'No vowels allowed' if (s ~~ /[AEIOU]/); + die 'Invalid format' if (s !~ /^[0-9B-DF-HJ-NP-TV-Z]{6}$/); + + const base36 = ((@(0..9) + @('A'..'Z')) ~Z @(0..35) -> flatten.to_h); + const weights = [1, 3, 1, 7, 3, 9]; + + var vs = [base36{ s.chars... }]; + var checksum = (vs ~Z* weights -> sum); + var check_digit = ((10 - checksum%10) % 10); + return (s + check_digit); +} + +%w( + 710889 + B0YBKJ + 406566 + B0YBLH + 228276 + B0YBKL + 557910 + B0YBKR + 585284 + B0YBKT + B00030 +).each { |s| + say sedol(s); +} diff --git a/Task/SEDOLs/Visual-FoxPro/sedols.visual b/Task/SEDOLs/Visual-FoxPro/sedols.visual new file mode 100644 index 0000000000..b84b78c3b9 --- /dev/null +++ b/Task/SEDOLs/Visual-FoxPro/sedols.visual @@ -0,0 +1,73 @@ +#DEFINE ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#DEFINE VOWELS "AEIOU" +#DEFINE VALIDCHARS "0123456789" + ALPHABET +LOCAL cMsg As String, cCode As String +LOCAL ARRAY codes[12] +codes[1] = "710889" +codes[2] = "B0YBKJ" +codes[3] = "406566" +codes[4] = "B0YBLH" +codes[5] = "228276" +codes[6] = "B0YBKL" +codes[7] = "557910" +codes[8] = "B0YBKR" +codes[9] = "585284" +codes[10] = "B0YBKT" +codes[11] = "B00030" +codes[12] = "B0030A" +DIMENSION w[6] +w[1] = 1 +w[2] = 3 +w[3] = 1 +w[4] = 7 +w[5] = 3 +w[6] = 9 +CLEAR +FOR EACH cCode IN codes + cMsg = "" + IF IsValidCode(@cCode, @cMsg) && Parameters passed by reference + cCode = cCode + GetCheckDigit(cCode) + ? cCode + ELSE + ? cCode, cMsg + ENDIF +ENDFOR + +FUNCTION GetCheckDigit(tcCode As String) As String +LOCAL i As Integer, c As String, s As Integer, k As Integer +s = 0 +FOR i = 1 TO 6 + c = SUBSTR(tcCode, i, 1) + IF ISDIGIT(c) + k = VAL(c) + ELSE + k = 9 + AT(c, ALPHABET) + ENDIF + s = s + k*w[i] +ENDFOR +RETURN TRANSFORM((10 - s%10)%10) +ENDFUNC + +FUNCTION IsValidCode(tcCode As String, tcMsg As String) As Boolean +LOCAL n As Integer, c As String, i As Integer +*!* Get rid of any spaces and convert to upper case +tcCode = UPPER(STRTRAN(tcCode, " ")) +n = LEN(tcCode) +IF LEN(tcCode) # 6 + tcMsg = "Code must be 6 characters." +ELSE + FOR i = 1 TO n + c = SUBSTR(tcCode, i, 1) + IF NOT c $ VALIDCHAR + tcMsg = c + " is not a valid character." + EXIT + ELSE + IF c $ VOWELS + tcMsg = "Vowels are not allowed." + EXIT + ENDIF + ENDIF + ENDFOR +ENDIF +RETURN EMPTY(tcMsg) +ENDFUNC diff --git a/Task/SEDOLs/jq/sedols.jq b/Task/SEDOLs/jq/sedols.jq new file mode 100644 index 0000000000..29cbb1b37d --- /dev/null +++ b/Task/SEDOLs/jq/sedols.jq @@ -0,0 +1,43 @@ +def ascii_upcase: + explode | map( if 97 <= . and . <= 122 then . - 32 else . end) | implode; + +def sedol_checksum: + def encode(a): 10 + (a|explode[0]) - ("A"|explode[0]); + . as $sed + | [1,3,1,7,3,9] as $sw + | reduce range(0;6) as $i + (0; + $sed[$i:$i+1] as $c + | if ( "0123456789" | index($c) ) + then . + ($c|tonumber) * $sw[$i] + else . + encode($c) * $sw[$i] + end ) + | (10 - (. % 10)) % 10 ; + +# error on error, else pass input to output +def check_valid_sedol: + def has_vowel: + ("AEIOU"|explode) as $vowels + | reduce explode[] as $c + (false; if . then . else $vowels|index($c) end); + + if has_vowel then error( "\(.) is not a valid SEDOL code" ) + else . + end + | if length > 7 or length < 6 then + error( "\(.) is too long or too short to be valid SEDOL") + else . + end; + +def sedolize: + ascii_upcase as $in + | $in + | check_valid_sedol + | .[0:6] as $sedol + | ($sedol | sedol_checksum | tostring) as $sedolcheck + | ($sedol + $sedolcheck) as $ans + | if length == 7 and $ans != $in then + $ans + " (original \($in) has wrong checksum digit" + else $ans + end ; +sedolize diff --git a/Task/SHA-1/FreeBASIC/sha-1.freebasic b/Task/SHA-1/FreeBASIC/sha-1.freebasic new file mode 100644 index 0000000000..adc512e533 --- /dev/null +++ b/Task/SHA-1/FreeBASIC/sha-1.freebasic @@ -0,0 +1,106 @@ +' version 18-10-2016 +' started with SHA-1/FIPS-180-1 +' but used the BBC BASIC native version to finish. +' compile with: fbc -s console + +Function SHA_1(test_str As String) As String + + Dim As String message = test_str ' strings are passed as ByRef's + + Dim As Long i, j + Dim As UByte Ptr ww1 + Dim As UInteger<32> Ptr ww4 + + Dim As ULongInt l = Len(message) + ' set the first bit after the message to 1 + message = message + Chr(1 Shl 7) + ' add one char to the length + Dim As ULong padding = 64 - ((l +1) Mod (512 \ 8)) ' 512 \ 8 = 64 char. + + ' check if we have enough room for inserting the length + If padding < 8 Then padding = padding + 64 + + message = message + String(padding, Chr(0)) ' adjust length + Dim As ULong l1 = Len(message) ' new length + + l = l * 8 ' orignal length in bits + ' create ubyte ptr to point to l ( = length in bits) + Dim As UByte Ptr ub_ptr = Cast(UByte Ptr, @l) + + For i = 0 To 7 'copy length of message to the last 8 bytes + message[l1 -1 - i] = ub_ptr[i] + Next + + Dim As UInteger<32> A, B, C, D, E, k, temp, W(0 To 79) + Dim As UInteger<32> H0 = &H67452301 + Dim As UInteger<32> H1 = &HEFCDAB89 + Dim As UInteger<32> H2 = &H98BADCFE + Dim As UInteger<32> H3 = &H10325476 + Dim As UInteger<32> H4 = &HC3D2E1F0 + + + For j = 0 To (l1 -1) \ 64 ' split into block of 64 bytes + ww1 = Cast(Ubyte Ptr, @message[j * 64]) + ww4 = Cast(UInteger<32> Ptr, @message[j * 64]) + + For i = 0 To 60 Step 4 'little endian -> big endian + Swap ww1[i ], ww1[i +3] + Swap ww1[i +1], ww1[i +2] + Next + + For i = 0 To 15 ' copy the 16 32bit block into the array + W(i) = ww4[i] + Next + + For i = 16 To 79 ' fill the rest of the array + temp = W(i -3) Xor W(i -8) Xor W(i -14) Xor W(i -16) + temp = temp Shl 1 + temp Shr 31 + W(i) = temp + Next + + A = h0 : B = h1 : C = h2 : D = h3 : E = h4 + + For i = 0 To 79 + Select Case As Const i + Case 0 To 19 + temp = (B And C) or ((Not B) And D) + k = &H5A827999 + Case 20 To 39 + temp = B Xor C Xor D + k = &H6ED9EBA1 + Case 40 To 59 + temp = (B And C) Or (B And D) Or (C And D) + k = &H8F1BBCDC + Case 60 To 79 + temp = B Xor C Xor D + k = &hCA62C1D6 + End Select + + temp = A Shl 5 + A Shr 27 + temp + E + k + W(i) + E = D + D = C + C = (B Shl 30) or (B Shr 2) + B = A + A = temp + + Next + + h0 += A : h1 += B : h2 += C : h3 += D : h4 += E + + Next + + Return Hex(h0, 8) + Hex(h1, 8) + Hex(h2, 8) + Hex(h3, 8) + Hex(h4, 8) + +End Function + +' ------=< MAIN >=------ + +Dim As String test = "Rosetta Code" +Print test; " => "; SHA_1(test) + + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/SHA-1/Lasso/sha-1.lasso b/Task/SHA-1/Lasso/sha-1.lasso new file mode 100644 index 0000000000..23a1b83b49 --- /dev/null +++ b/Task/SHA-1/Lasso/sha-1.lasso @@ -0,0 +1 @@ +cipher_digest('Rosetta Code', -digest='SHA1',-hex=true) diff --git a/Task/SHA-1/LiveCode/sha-1.livecode b/Task/SHA-1/LiveCode/sha-1.livecode new file mode 100644 index 0000000000..9eb037b298 --- /dev/null +++ b/Task/SHA-1/LiveCode/sha-1.livecode @@ -0,0 +1,6 @@ +command shaRosettaCode + local shex, sha1 + put sha1Digest("Rosetta Code") into sha1 + get binaryDecode("H*",sha1,shex) + put shex +end shaRosettaCode diff --git a/Task/SHA-1/Nim/sha-1.nim b/Task/SHA-1/Nim/sha-1.nim new file mode 100644 index 0000000000..0e0203a37e --- /dev/null +++ b/Task/SHA-1/Nim/sha-1.nim @@ -0,0 +1,13 @@ +import strutils + +const SHA1Len = 20 + +proc SHA1(d: cstring, n: culong, md: cstring = nil): cstring {.cdecl, dynlib: "libssl.so", importc.} + +proc SHA1(s: string): string = + result = "" + var s = SHA1(s.cstring, s.len.culong) + for i in 0 .. < SHA1Len: + result.add s[i].BiggestInt.toHex(2).toLower + +echo SHA1("Rosetta Code") diff --git a/Task/SHA-1/Sidef/sha-1.sidef b/Task/SHA-1/Sidef/sha-1.sidef new file mode 100644 index 0000000000..48bde2fa74 --- /dev/null +++ b/Task/SHA-1/Sidef/sha-1.sidef @@ -0,0 +1,2 @@ +var sha = frequire('Digest::SHA'); +say sha.sha1_hex('Rosetta Code'); diff --git a/Task/SHA-256/FreeBASIC/sha-256.freebasic b/Task/SHA-256/FreeBASIC/sha-256.freebasic new file mode 100644 index 0000000000..da9a0a220a --- /dev/null +++ b/Task/SHA-256/FreeBASIC/sha-256.freebasic @@ -0,0 +1,133 @@ +' version 20-10-2016 +' FIPS PUB 180-4 +' compile with: fbc -s console + +Function SHA_256(test_str As String) As String + + #Macro Ch (x, y, z) + (((x) And (y)) Xor ((Not (x)) And z)) + #EndMacro + + #Macro Maj (x, y, z) + (((x) And (y)) Xor ((x) And (z)) Xor ((y) And (z))) + #EndMacro + + #Macro sigma0 (x) + (((x) Shr 2 Or (x) Shl 30) Xor ((x) Shr 13 Or (x) Shl 19) Xor ((x) Shr 22 Or (x) Shl 10)) + #EndMacro + + #Macro sigma1 (x) + (((x) Shr 6 Or (x) Shl 26) Xor ((x) Shr 11 Or (x) Shl 21) Xor ((x) Shr 25 Or (x) Shl 7)) + #EndMacro + + #Macro sigma2 (x) + (((x) Shr 7 Or (x) Shl 25) Xor ((x) Shr 18 Or (x) Shl 14) Xor ((x) Shr 3)) + #EndMacro + + #Macro sigma3 (x) + (((x) Shr 17 Or (x) Shl 15) Xor ((x) Shr 19 Or (x) Shl 13) Xor ((x) Shr 10)) + #EndMacro + + Dim As String message = test_str ' strings are passed as ByRef's + + Dim As Long i, j + Dim As UByte Ptr ww1 + Dim As UInteger<32> Ptr ww4 + + Dim As ULongInt l = Len(message) + ' set the first bit after the message to 1 + message = message + Chr(1 Shl 7) + ' add one char to the length + Dim As ULong padding = 64 - ((l +1) Mod (512 \ 8)) ' 512 \ 8 = 64 char. + + ' check if we have enough room for inserting the length + If padding < 8 Then padding = padding + 64 + + message = message + String(padding, Chr(0)) ' adjust length + Dim As ULong l1 = Len(message) ' new length + + l = l * 8 ' orignal length in bits + ' create ubyte ptr to point to l ( = length in bits) + Dim As UByte Ptr ub_ptr = Cast(UByte Ptr, @l) + + For i = 0 To 7 'copy length of message to the last 8 bytes + message[l1 -1 - i] = ub_ptr[i] + Next + + 'table of constants + Dim As UInteger<32> K(0 To ...) = _ + { &H428a2f98, &H71374491, &Hb5c0fbcf, &He9b5dba5, &H3956c25b, &H59f111f1, _ + &H923f82a4, &Hab1c5ed5, &Hd807aa98, &H12835b01, &H243185be, &H550c7dc3, _ + &H72be5d74, &H80deb1fe, &H9bdc06a7, &Hc19bf174, &He49b69c1, &Hefbe4786, _ + &H0fc19dc6, &H240ca1cc, &H2de92c6f, &H4a7484aa, &H5cb0a9dc, &H76f988da, _ + &H983e5152, &Ha831c66d, &Hb00327c8, &Hbf597fc7, &Hc6e00bf3, &Hd5a79147, _ + &H06ca6351, &H14292967, &H27b70a85, &H2e1b2138, &H4d2c6dfc, &H53380d13, _ + &H650a7354, &H766a0abb, &H81c2c92e, &H92722c85, &Ha2bfe8a1, &Ha81a664b, _ + &Hc24b8b70, &Hc76c51a3, &Hd192e819, &Hd6990624, &Hf40e3585, &H106aa070, _ + &H19a4c116, &H1e376c08, &H2748774c, &H34b0bcb5, &H391c0cb3, &H4ed8aa4a, _ + &H5b9cca4f, &H682e6ff3, &H748f82ee, &H78a5636f, &H84c87814, &H8cc70208, _ + &H90befffa, &Ha4506ceb, &Hbef9a3f7, &Hc67178f2 } + + Dim As UInteger<32> h0 = &H6a09e667 + Dim As UInteger<32> h1 = &Hbb67ae85 + Dim As UInteger<32> h2 = &H3c6ef372 + Dim As UInteger<32> h3 = &Ha54ff53a + Dim As UInteger<32> h4 = &H510e527f + Dim As UInteger<32> h5 = &H9b05688c + Dim As UInteger<32> h6 = &H1f83d9ab + Dim As UInteger<32> h7 = &H5be0cd19 + Dim As UInteger<32> a, b, c, d, e, f, g, h + Dim As UInteger<32> t1, t2, w(0 To 63) + + + For j = 0 To (l1 -1) \ 64 ' split into block of 64 bytes + ww1 = Cast(UByte Ptr, @message[j * 64]) + ww4 = Cast(UInteger<32> Ptr, @message[j * 64]) + + For i = 0 To 60 Step 4 'little endian -> big endian + Swap ww1[i ], ww1[i +3] + Swap ww1[i +1], ww1[i +2] + Next + + For i = 0 To 15 ' copy the 16 32bit block into the array + W(i) = ww4[i] + Next + + For i = 16 To 63 ' fill the rest of the array + w(i) = sigma3(W(i -2)) + W(i -7) + sigma2(W(i -15)) + W(i -16) + Next + + a = h0 : b = h1 : c = h2 : d = h3 : e = h4 : f = h5 : g = h6 : h = h7 + + For i = 0 To 63 + t1 = h + sigma1(e) + Ch(e, f, g) + K(i) + W(i) + t2 = sigma0(a) + Maj(a, b, c) + h = g : g = f : f = e + e = d + t1 + d = c : c = b : b = a + a = t1 + t2 + Next + + h0 += a : h1 += b : h2 += c : h3 += d + h4 += e : h5 += f : h6 += g : h7 += h + + Next j + + Dim As String answer = Hex(h0, 8) + Hex(h1, 8) + Hex(h2, 8) + Hex(h3, 8) + answer += Hex(h4, 8) + Hex(h5, 8) + Hex(h6, 8) + Hex(h7, 8) + + Return LCase(answer) + +End Function + +' ------=< MAIN >=------ + +Dim As String test = "Rosetta code" +Print test; " => "; SHA_256(test) + + +' empty keyboard buffer +While Inkey <> "" : Wend +Print : Print "hit any key to end program" +Sleep +End diff --git a/Task/SHA-256/FunL/sha-256-1.funl b/Task/SHA-256/FunL/sha-256-1.funl new file mode 100644 index 0000000000..0f10eff059 --- /dev/null +++ b/Task/SHA-256/FunL/sha-256-1.funl @@ -0,0 +1,3 @@ +native java.security.MessageDigest + +def sha256Java( message ) = map( a -> format('%02x', a), list(MessageDigest.getInstance('SHA-256').digest(message.getBytes('UTF-8'))) ).mkString() diff --git a/Task/SHA-256/FunL/sha-256-2.funl b/Task/SHA-256/FunL/sha-256-2.funl new file mode 100644 index 0000000000..5bca73ea1e --- /dev/null +++ b/Task/SHA-256/FunL/sha-256-2.funl @@ -0,0 +1,83 @@ +def sha256( message ) = + //Initialize hash values + h0 = 0x6a09e667 + h1 = 0xbb67ae85 + h2 = 0x3c6ef372 + h3 = 0xa54ff53a + h4 = 0x510e527f + h5 = 0x9b05688c + h6 = 0x1f83d9ab + h7 = 0x5be0cd19 + + // Initialize array of round constants + k(0..63) = [ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2] + + // Pre-processing + bits = BitArray( message.getBytes('UTF-8') ) + len = bits.length() + bits.append( 1 ) + r = bits.length()%512 + bits.appendAll( 0 | _ <- 1..(if r > 448 then 512 - r + 448 else 448 - r) ) + bits.appendInt( 0 ) + bits.appendInt( len ) + + words = bits.toIntVector() + + // Process the message in successive 512-bit chunks + for chunk <- 0:words.length():16 + w(0..15) = words(chunk..chunk+15) + + // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array + for i <- 16..63 + s0 = (w(i-15) rotateright 7) xor (w(i-15) rotateright 18) xor (w(i-15) >>> 3) + s1 = (w(i-2) rotateright 17) xor (w(i-2) rotateright 19) xor (w(i-2) >>> 10) + w(i) = w(i-16) + s0 + w(i-7) + s1 + + // Initialize working variables to current hash value + a = h0 + b = h1 + c = h2 + d = h3 + e = h4 + f = h5 + g = h6 + h = h7 + + // Compression function main loop + for i <- 0..63 + S1 = (e rotateright 6) xor (e rotateright 11) xor (e rotateright 25) + ch = (e and f) xor ((not e) and g) + temp1 = h + S1 + ch + k(i) + w(i) + S0 = (a rotateright 2) xor (a rotateright 13) xor (a rotateright 22) + maj = (a and b) xor (a and c) xor (b and c) + temp2 = S0 + maj + + h = g + g = f + f = e + e = d + temp1 + d = c + c = b + b = a + a = temp1 + temp2 + + // Add the compressed chunk to the current hash value + h0 = h0 + a + h1 = h1 + b + h2 = h2 + c + h3 = h3 + d + h4 = h4 + e + h5 = h5 + f + h6 = h6 + g + h7 = h7 + h + + // Produce the final hash value (big-endian) + map( a -> format('%08x', a.intValue()), [h0, h1, h2, h3, h4, h5, h6, h7] ).mkString() diff --git a/Task/SHA-256/FunL/sha-256-3.funl b/Task/SHA-256/FunL/sha-256-3.funl new file mode 100644 index 0000000000..68f12f4ef6 --- /dev/null +++ b/Task/SHA-256/FunL/sha-256-3.funl @@ -0,0 +1,9 @@ +message = 'Rosetta code' + +println( 'FunL: "' + message + '" ~> ' + sha256(message) ) +println( 'Java: "' + message + '" ~> ' + sha256Java(message) ) + +message = '' + +println( 'FunL: "' + message + '" ~> ' + sha256(message) ) +println( 'Java: "' + message + '" ~> ' + sha256Java(message) ) diff --git a/Task/SHA-256/Lasso/sha-256.lasso b/Task/SHA-256/Lasso/sha-256.lasso new file mode 100644 index 0000000000..04465f028b --- /dev/null +++ b/Task/SHA-256/Lasso/sha-256.lasso @@ -0,0 +1,10 @@ +// The following will return a list of all the cipher +// algorithms supported by the installation of Lasso +cipher_list + +// With a -digest parameter the method will limit the returned list +// to all of the digest algorithms supported by the installation of Lasso +cipher_list(-digest) + +// return the SHA-256 digest. Dependant on SHA-256 being an available digest method +cipher_digest('Rosetta Code', -digest='SHA-256',-hex=true) diff --git a/Task/SHA-256/Nim/sha-256.nim b/Task/SHA-256/Nim/sha-256.nim new file mode 100644 index 0000000000..e4b4c12d7a --- /dev/null +++ b/Task/SHA-256/Nim/sha-256.nim @@ -0,0 +1,13 @@ +import strutils + +const SHA256Len = 32 + +proc SHA256(d: cstring, n: culong, md: cstring = nil): cstring {.cdecl, dynlib: "libssl.so", importc.} + +proc SHA256(s: string): string = + result = "" + let s = SHA256(s.cstring, s.len.culong) + for i in 0 .. < SHA256Len: + result.add s[i].BiggestInt.toHex(2).toLower + +echo SHA256("Rosetta code") diff --git a/Task/SHA-256/Phix/sha-256-1.phix b/Task/SHA-256/Phix/sha-256-1.phix new file mode 100644 index 0000000000..ee130d5a29 --- /dev/null +++ b/Task/SHA-256/Phix/sha-256-1.phix @@ -0,0 +1,16 @@ +constant lib = open_dll("SHA.DLL") +constant SHA_HashBlock = define_c_proc(lib,"SHA_HashBlock",{C_PTR,C_PTR,C_INT}) + +function sha256(string s) +atom mem = allocate(32) +sequence res + c_proc(SHA_HashBlock,{s,mem,length(s)}) + res = peek4u({mem,8}) + free(mem) + for i=1 to length(res) do + res[i] = sprintf("%08x",res[i]) + end for + return join(res) +end function + +?sha256("Rosetta code") diff --git a/Task/SHA-256/Phix/sha-256-2.phix b/Task/SHA-256/Phix/sha-256-2.phix new file mode 100644 index 0000000000..8af95e313f --- /dev/null +++ b/Task/SHA-256/Phix/sha-256-2.phix @@ -0,0 +1,126 @@ +-- +-- demo\rosetta\sha-256.exw +-- ======================== +-- +-- fairly faithful rendition of https://en.wikipedia.org/wiki/SHA-2 +-- with slightly improved names (eg s0 -> sigma0) from elsewhere. +-- See also sha-256asm.exw for a faster inline asm version, and +-- sha-256dll.exw is much shorter as it uses a pre-built dll. + +--Initial array of round constants +--(first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311): +constant k = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2} + +function pad64(integer v) +-- round v up to multiple of 64 + return floor((v+63)/64)*64 +end function + +constant m4 = allocate(4) -- scratch area, for uint32 + +function uint32(atom v) +-- +-- (note: I have experimented to call this as few times as possible. +-- It wouldn't hurt to perform this on every maths op, but a +-- few leading bits in a few work fields don't matter much.) +-- + poke4(m4,v) + return peek4u(m4) +end function + +function sq_uint32(sequence s) +-- apply unit32 to all elements of s + for i=1 to length(s) do + s[i] = uint32(s[i]) + end for + return s +end function + +function dword(string msg, integer i) +-- get dword as big-endian + return msg[i]*#1000000+msg[i+1]*#10000+msg[i+2]*#100+msg[i+3] +end function + +function shr(atom v, integer bits) + return floor(v/power(2,bits)) +end function + +function ror(atom v, integer bits) + return or_bits(shr(v,bits),v*power(2,32-bits)) +end function + +function sha256(string msg) +-- main function +atom s0,s1,a,b,c,d,e,f,g,h,ch,temp1,maj,temp2,x +sequence w = repeat(0,64) +sequence res +integer len = length(msg)+1 +--Initial hash values +--(first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19) +atom h0 = 0x6a09e667, + h1 = 0xbb67ae85, + h2 = 0x3c6ef372, + h3 = 0xa54ff53a, + h4 = 0x510e527f, + h5 = 0x9b05688c, + h6 = 0x1f83d9ab, + h7 = 0x5be0cd19 + + -- add the '1' bit and space for size in bits, padded to multiple of 64 + msg &= #80&repeat('\0',pad64(len+8)-len) + len = (len-1)*8 + for i=length(msg) to 1 by -1 do + msg[i] = and_bits(len,#FF) + len = floor(len/#100) + if len=0 then exit end if + end for + + -- Process the message in successive 512-bit (64 byte) chunks + for chunk=1 to length(msg) by 64 do + for i=1 to 16 do + w[i] = dword(msg,chunk+(i-1)*4) + end for + -- Extend the first 16 words into the remaining 48 words w[17..64] of the message schedule array + for i=17 to 64 do + x = w[i-15]; s0 = xor_bits(xor_bits(ror(x, 7),ror(x,18)),shr(x, 3)) + x = w[i-2]; s1 = xor_bits(xor_bits(ror(x,17),ror(x,19)),shr(x,10)) + w[i] = uint32(w[i-16]+s0+w[i-7]+s1) + end for + -- Initialize working variables to current hash value + {a,b,c,d,e,f,g,h} = {h0,h1,h2,h3,h4,h5,h6,h7} + + -- Compression function main loop + for i=1 to 64 do + s1 = xor_bits(xor_bits(ror(e,6),ror(e,11)),ror(e,25)) + ch = xor_bits(and_bits(e,f),and_bits(not_bits(e),g)) + temp1 = h+s1+ch+k[i]+w[i] + s0 = xor_bits(xor_bits(ror(a,2),ror(a,13)),ror(a,22)) + maj = xor_bits(xor_bits(and_bits(a,b),and_bits(a,c)),and_bits(b,c)) + temp2 = s0+maj + + {h,g,f,e,d,c,b,a} = sq_uint32({g,f,e,d+temp1,c,b,a,temp1+temp2}) + + end for + + -- Add the compressed chunk to the current hash value + {h0,h1,h2,h3,h4,h5,h6,h7} = sq_add({h0,h1,h2,h3,h4,h5,h6,h7},{a,b,c,d,e,f,g,h}) + end for + + -- Produce the final hash value (big-endian) + res = sq_uint32({h0, h1, h2, h3, h4, h5, h6, h7}) -- (or do sq_unit32 on the sq_add above) + for i=1 to length(res) do + res[i] = sprintf("%08x",res[i]) + end for + return join(res) +end function + +string res = sha256("Rosetta code") +?res diff --git a/Task/SHA-256/Sidef/sha-256.sidef b/Task/SHA-256/Sidef/sha-256.sidef new file mode 100644 index 0000000000..8062ef2ef6 --- /dev/null +++ b/Task/SHA-256/Sidef/sha-256.sidef @@ -0,0 +1,2 @@ +var sha = frequire('Digest::SHA'); +say sha.sha256_hex('Rosetta code'); diff --git a/Task/SOAP/Uniface/soap.uniface b/Task/SOAP/Uniface/soap.uniface new file mode 100644 index 0000000000..af7ace27d1 --- /dev/null +++ b/Task/SOAP/Uniface/soap.uniface @@ -0,0 +1,6 @@ +variables + string result1, result2 +endvariables + +activate "webservice".soapFunc("hello", result1) +activate "webservice".anotherSoapFunc(34234, result2) diff --git a/Task/SQL-based-authentication/Sidef/sql-based-authentication.sidef b/Task/SQL-based-authentication/Sidef/sql-based-authentication.sidef new file mode 100644 index 0000000000..3e00374b9e --- /dev/null +++ b/Task/SQL-based-authentication/Sidef/sql-based-authentication.sidef @@ -0,0 +1,27 @@ +require('DBI') + + # returns a database handle configured to throw an exception on query errors +func connect_db(dbname, host, user, pass) { + var db = %s.connect("dbi:mysql:#{dbname}:#{host}", user, pass) + db || die (global DBI::errstr) + db{:RaiseError} = 1 + db +} + + # if the user was successfully created, returns its user id. + # if the name was already in use, returns nil. +func create_user(db, user, pass) { + var salt = "C*".pack(16.of { 256.irand }...) + db.do( + "INSERT IGNORE INTO users (username, pass_salt, pass_md5) + VALUES (?, ?, unhex(md5(concat(pass_salt, ?))))", nil, user, salt, pass + ) ? db{:mysql_insertid} : nil +} + + # if the user is authentic, returns its user id. otherwise returns nil. +func authenticate_user(db, user, pass) { + db.selectrow_array("SELECT userid FROM users WHERE + username=? AND pass_md5=unhex(md5(concat(pass_salt, ?)))", + nil, user, pass + ) +} diff --git a/Task/Safe-addition/Nim/safe-addition.nim b/Task/Safe-addition/Nim/safe-addition.nim new file mode 100644 index 0000000000..45c2f01a43 --- /dev/null +++ b/Task/Safe-addition/Nim/safe-addition.nim @@ -0,0 +1,20 @@ +import posix, strutils + +proc `++`(a, b: float): tuple[lower, upper: float] = + let + a {.volatile.} = a + b {.volatile.} = b + orig = fegetround() + discard fesetround FE_DOWNWARD + result.lower = a + b + discard fesetround FE_UPWARD + result.upper = a + b + discard fesetround orig + +proc ff(a: float): string = a.formatFloat(ffDefault, 17) + +for x, y in [(1.0, 2.0), (0.1, 0.2), (1e100, 1e-100), (1e308, 1e308)].items: + let (d,u) = x ++ y + echo x.ff, " + ", y.ff, " =" + echo " [", d.ff, ", ", u.ff, "]" + echo " size ", (u - d).ff, "\n" diff --git a/Task/Safe-addition/Phix/safe-addition.phix b/Task/Safe-addition/Phix/safe-addition.phix new file mode 100644 index 0000000000..4a58c13ac2 --- /dev/null +++ b/Task/Safe-addition/Phix/safe-addition.phix @@ -0,0 +1,53 @@ +include builtins\VM\pFPU.e -- :%down53 etc + +function safe_add(atom a, atom b) +atom low,high + -- NB: be sure to restore the usual/default rounding! + #ilASM{ + [32] + lea esi,[a] + call :%pLoadFlt + lea esi,[b] + call :%pLoadFlt + fld st0 + call :%down53 + fadd st0,st2 + lea edi,[low] + call :%pStoreFlt + call :%up53 + faddp + lea edi,[high] + call :%pStoreFlt + call :%near53 -- usual/default + [64] + lea rsi,[a] + call :%pLoadFlt + lea rsi,[b] + call :%pLoadFlt + fld st0 + call :%down64 + fadd st0,st2 + lea rdi,[low] + call :%pStoreFlt + call :%up64 + faddp + lea rdi,[high] + call :%pStoreFlt + call :%near64 -- usual/default + [] + } + return {low,high} +end function + +constant nums = {{1, 2}, + {0.1, 0.2}, + {1e100, 1e-100}, + {1e308, 1e308}} + + for i=1 to length(nums) do + atom {a,b} = nums[i] + atom {low,high} = safe_add(a,b) + printf(1,"%.16g + %.16g =\n", {a, b}); + printf(1," [%.16g, %.16g]\n", {low, high}); + printf(1," size %.16g\n\n", high - low); + end for diff --git a/Task/Same-Fringe/Sidef/same-fringe.sidef b/Task/Same-Fringe/Sidef/same-fringe.sidef new file mode 100644 index 0000000000..60168d9d78 --- /dev/null +++ b/Task/Same-Fringe/Sidef/same-fringe.sidef @@ -0,0 +1,36 @@ +var trees = [ + # 0..2 are same + [ 'd', [ 'c', [ 'a', 'b', ], ], ], + [ [ 'd', 'c' ], [ 'a', 'b' ] ], + [ [ [ 'd', 'c', ], 'a', ], 'b', ], + # and this one's different! + [ [ [ [ [ [ 'a' ], 'b' ], 'c', ], 'd', ], 'e', ], 'f' ], +]; + +func get_tree_iterator(*rtrees) { + var tree; + func { + tree = rtrees.pop; + while (defined(tree) && tree.is_an(Array)) { + rtrees.append(tree[1]); + tree = tree[0]; + } + return tree; + } +} + +func cmp_fringe(a, b) { + var ti1 = get_tree_iterator(a); + var ti2 = get_tree_iterator(b); + loop { + var (L, R) = (ti1(), ti2()); + defined(L) && defined(R) && (L == R) && next; + !defined(L) && !defined(R) && return "Same"; + return "Different"; + } +} + +range(1, trees.end).each { |tree_idx| + say ("tree[#{tree_idx-1}] vs tree[#{tree_idx}]: ", + cmp_fringe(trees[tree_idx-1], trees[tree_idx])); +} diff --git a/Task/Same-Fringe/jq/same-fringe-1.jq b/Task/Same-Fringe/jq/same-fringe-1.jq new file mode 100644 index 0000000000..087c270f51 --- /dev/null +++ b/Task/Same-Fringe/jq/same-fringe-1.jq @@ -0,0 +1 @@ +(t|flatten) == (s|flatten) diff --git a/Task/Same-Fringe/jq/same-fringe-2.jq b/Task/Same-Fringe/jq/same-fringe-2.jq new file mode 100644 index 0000000000..2f7a3df85f --- /dev/null +++ b/Task/Same-Fringe/jq/same-fringe-2.jq @@ -0,0 +1,33 @@ +# "next" allows one to generate successive leaves, one at a time. This is accomplished +# by ensuring that the non-null output of a call to "next" can also serve as input. +# +# "next" returns null if there are no more leaves, otherwise it returns [leaf, nodes] +# where "leaf" is the next leaf, and nodes is an array of nodes still to be traversed. +# Input has the same form, but on input, "leaf" is ignored unless it is an array. +def next: + def _next: + .[0] as $node | .[1] as $nodes + | if ($node|type) == "array" then + if $node|length != 2 then + error("improper node: \($node) should have 2 items") else . end + | [ $node[0], [$node[1]] + $nodes] + elif $nodes|length > 0 then [$nodes[0], $nodes[1:]] + else null + end; + _next as $n + | if $n == null then null + elif ($n[0]|type) == "array" then $n|next + else $n + end; + +# t and u must be binary trees +def same_fringe(t;u): + # x and y must be suitable for input to "next" + def eq(x;y): + if x == null then y == null + elif y == null then false + elif x[0] != y[0] then false + else eq( x|next; y|next) + end; + + eq([t,[]]|next; [u,[]]|next) ; diff --git a/Task/Same-Fringe/jq/same-fringe-3.jq b/Task/Same-Fringe/jq/same-fringe-3.jq new file mode 100644 index 0000000000..66eb394518 --- /dev/null +++ b/Task/Same-Fringe/jq/same-fringe-3.jq @@ -0,0 +1,10 @@ + [1,[2,[3,[4,[5,[6,7]]]]]] as $a + | [[[[[[1,2],3],4],5],6],7] as $b + | [[[1,2],3],[4,[5,[6,7]]]] as $c + | [[[1,2],2],4] as $d + | same_fringe($a;$a), same_fringe($b;$b), same_fringe($c;$c), + same_fringe($a;$b), same_fringe($a;$c), same_fringe($b;$c), + same_fringe($a;$d), same_fringe($d;$c), same_fringe($b;$d), + + same_fringe( ["a",["b",["c",[["x","y"],"z"]]]]; + [[["a","b"],"c"],["x",["y","z"]]] ) diff --git a/Task/Same-Fringe/jq/same-fringe-4.jq b/Task/Same-Fringe/jq/same-fringe-4.jq new file mode 100644 index 0000000000..5db3dbd40c --- /dev/null +++ b/Task/Same-Fringe/jq/same-fringe-4.jq @@ -0,0 +1,11 @@ +$ jq -n -f Same_Fringe.jq +true +true +true +true +true +true +false +false +false +true diff --git a/Task/Scope-Function-names-and-labels/Sidef/scope-function-names-and-labels.sidef b/Task/Scope-Function-names-and-labels/Sidef/scope-function-names-and-labels.sidef new file mode 100644 index 0000000000..8c91c2874b --- /dev/null +++ b/Task/Scope-Function-names-and-labels/Sidef/scope-function-names-and-labels.sidef @@ -0,0 +1,9 @@ +# Nested functions +func outer { + func inner {}; # not visible outside +} + +# Nested classes +class Outer { + class Inner {}; # not visisble outside +} diff --git a/Task/Scope-Function-names-and-labels/jq/scope-function-names-and-labels-1.jq b/Task/Scope-Function-names-and-labels/jq/scope-function-names-and-labels-1.jq new file mode 100644 index 0000000000..f6eb4ea77f --- /dev/null +++ b/Task/Scope-Function-names-and-labels/jq/scope-function-names-and-labels-1.jq @@ -0,0 +1,5 @@ +def NAME: + def NAME: 2; + 1, NAME; # this calls the inner function, not the outer function + +NAME # => 1, 2 diff --git a/Task/Scope-Function-names-and-labels/jq/scope-function-names-and-labels-2.jq b/Task/Scope-Function-names-and-labels/jq/scope-function-names-and-labels-2.jq new file mode 100644 index 0000000000..cfbae951c5 --- /dev/null +++ b/Task/Scope-Function-names-and-labels/jq/scope-function-names-and-labels-2.jq @@ -0,0 +1,2 @@ +def F(x): if x == 0 then M(x) else 1 end; # NOT POSSIBLE +def M(x): if x == 1 then F(x) else 2 end; diff --git a/Task/Scope-Function-names-and-labels/jq/scope-function-names-and-labels-3.jq b/Task/Scope-Function-names-and-labels/jq/scope-function-names-and-labels-3.jq new file mode 100644 index 0000000000..09edab729d --- /dev/null +++ b/Task/Scope-Function-names-and-labels/jq/scope-function-names-and-labels-3.jq @@ -0,0 +1,5 @@ +def F(x): + def M(x): if x == 1 then F(x) else 2 end; + if x == 0 then M(x) else 1 end; + +def M(x): if x == 1 then F(x) else 2 end; diff --git a/Task/Scope-modifiers/Nim/scope-modifiers.nim b/Task/Scope-modifiers/Nim/scope-modifiers.nim new file mode 100644 index 0000000000..8e9404b977 --- /dev/null +++ b/Task/Scope-modifiers/Nim/scope-modifiers.nim @@ -0,0 +1,6 @@ +proc foo = echo "foo" # hidden +proc bar* = echo "bar" # acessible + +type MyObject = object + name*: string # accessible + secretAge: int # hidden diff --git a/Task/Search-a-list/Ceylon/search-a-list.ceylon b/Task/Search-a-list/Ceylon/search-a-list.ceylon new file mode 100644 index 0000000000..84b6f76a16 --- /dev/null +++ b/Task/Search-a-list/Ceylon/search-a-list.ceylon @@ -0,0 +1,11 @@ +shared test void searchAListTask() { + value haystack = [ + "Zig", "Zag", "Wally", "Ronald", "Bush", + "Krusty", "Charlie", "Bush", "Bozo"]; + + assert(exists firstIdx = haystack.firstOccurrence("Bush")); + assert(exists lastIdx = haystack.lastOccurrence("Bush")); + + assertEquals(firstIdx, 4); + assertEquals(lastIdx, 7); +} diff --git a/Task/Search-a-list/Lasso/search-a-list.lasso b/Task/Search-a-list/Lasso/search-a-list.lasso new file mode 100644 index 0000000000..0e220c4ec2 --- /dev/null +++ b/Task/Search-a-list/Lasso/search-a-list.lasso @@ -0,0 +1,9 @@ +local(haystack) = array('Zig', 'Zag', 'Wally', 'Ronald', 'Bush', 'Krusty', 'Charlie', 'Bush', 'Bozo') + +#haystack->findindex('Bush')->first // 5 +#haystack->findindex('Bush')->last // 8 + +protect => {^ + handle_error => {^ error_msg ^} + fail_if(not #haystack->findindex('Washington')->first,'Washington is not in haystack.') +^} diff --git a/Task/Search-a-list/Lingo/search-a-list.lingo b/Task/Search-a-list/Lingo/search-a-list.lingo new file mode 100644 index 0000000000..c649abd310 --- /dev/null +++ b/Task/Search-a-list/Lingo/search-a-list.lingo @@ -0,0 +1,11 @@ +haystack = ["apples", "oranges", "bananas", "oranges"] +needle = "oranges" + +pos = haystack.getPos(needle) +if pos then + put "needle found at index "&pos +else + put "needle not found in haystack" +end if + +-- "needle found at index 2" diff --git a/Task/Search-a-list/Nim/search-a-list.nim b/Task/Search-a-list/Nim/search-a-list.nim new file mode 100644 index 0000000000..fd0b50b203 --- /dev/null +++ b/Task/Search-a-list/Nim/search-a-list.nim @@ -0,0 +1,8 @@ +let haystack = ["Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo"] + +for needle in ["Bush", "Washington"]: + let f = haystack.find(needle) + if f >= 0: + echo f, " ", needle + else: + raise newException(ValueError, needle & " not in haystack") diff --git a/Task/Search-a-list/Oforth/search-a-list.oforth b/Task/Search-a-list/Oforth/search-a-list.oforth new file mode 100644 index 0000000000..01efa5d39c --- /dev/null +++ b/Task/Search-a-list/Oforth/search-a-list.oforth @@ -0,0 +1,8 @@ +: needleIndex(needle, haystack) + haystack indexOf(needle) dup ifNull: [ drop ExRuntime throw("Not found", needle) ] ; + +[ "Zig", "Zag", "Wally", "Ronald", "Bush", "Krusty", "Charlie", "Bush", "Boz" ] const: Haystack + +needleIndex("Bush", Haystack) println +Haystack lastIndexOf("Bush") println +needleIndex("Washington", Haystack) println diff --git a/Task/Search-a-list/Phix/search-a-list.phix b/Task/Search-a-list/Phix/search-a-list.phix new file mode 100644 index 0000000000..08f08a7853 --- /dev/null +++ b/Task/Search-a-list/Phix/search-a-list.phix @@ -0,0 +1,7 @@ +constant s = {"Zig", "Zag", "Wally", "Ronald", "Bush", "Krusty", "Charlie", "Bush", "Boz", "Zag"} + +integer r = find("Zag",s) ?r -- 2 (first) +r = find("Zag",s,r+1) ?r -- 10 (next) +r = find("Zag",s,r+1) ?r -- 0 (no more) +r = rfind("Zag",s) ?r -- 10 (last) +r = find("Zog",s) ?r -- 0 (none) diff --git a/Task/Search-a-list/Ring/search-a-list.ring b/Task/Search-a-list/Ring/search-a-list.ring new file mode 100644 index 0000000000..7ebef80ed3 --- /dev/null +++ b/Task/Search-a-list/Ring/search-a-list.ring @@ -0,0 +1,18 @@ +haystack = ["alpha","bravo","charlie","delta","echo","foxtrot","golf", +"hotel","india","juliet","kilo","lima","mike","needle", +"november","oscar","papa","quebec","romeo","sierra","tango", +"needle","uniform","victor","whisky","x-ray","yankee","zulu"] + +needle = "needle" +maxindex = len(haystack) + +for index = 1 to maxindex + if needle = haystack[index] exit ok +next +if index <= maxindex + see "first found at index " + index + nl ok +for last = maxindex to 0 step -1 + if needle = haystack[last] exit ok +next +if !=index see " last found at index " + last + nl +else see "not found" + nl ok diff --git a/Task/Search-a-list/Sidef/search-a-list-1.sidef b/Task/Search-a-list/Sidef/search-a-list-1.sidef new file mode 100644 index 0000000000..f51d56b0ed --- /dev/null +++ b/Task/Search-a-list/Sidef/search-a-list-1.sidef @@ -0,0 +1,10 @@ +var haystack = %w(Zig Zag Wally Ronald Bush Krusty Charlie Bush Bozo); + +%w(Bush Washington).each { |needle| + var i = haystack.first_index{|item| item == needle}; + if (i >= 0) { + say "#{i} #{needle}"; + } else { + die "#{needle} is not in haystack"; + } +} diff --git a/Task/Search-a-list/Sidef/search-a-list-2.sidef b/Task/Search-a-list/Sidef/search-a-list-2.sidef new file mode 100644 index 0000000000..99b137cec3 --- /dev/null +++ b/Task/Search-a-list/Sidef/search-a-list-2.sidef @@ -0,0 +1,2 @@ +var haystack = %w(Zig Zag Wally Ronald Bush Krusty Charlie Bush Bozo); +say haystack.last_index{|item| item == "Bush"}; diff --git a/Task/Search-a-list/Swift/search-a-list-1.swift b/Task/Search-a-list/Swift/search-a-list-1.swift new file mode 100644 index 0000000000..8cc9f5a353 --- /dev/null +++ b/Task/Search-a-list/Swift/search-a-list-1.swift @@ -0,0 +1,8 @@ +let haystack = ["Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo"] +for needle in ["Washington","Bush"] { + if let index = haystack.indexOf(needle) { + print("\(index) \(needle)") + } else { + print("\(needle) is not in haystack") + } +} diff --git a/Task/Search-a-list/Swift/search-a-list-2.swift b/Task/Search-a-list/Swift/search-a-list-2.swift new file mode 100644 index 0000000000..cbe8af7d72 --- /dev/null +++ b/Task/Search-a-list/Swift/search-a-list-2.swift @@ -0,0 +1,8 @@ +let haystack = ["Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo"] +for needle in ["Washington","Bush"] { + if let index = find(haystack, needle) { + println("\(index) \(needle)") + } else { + println("\(needle) is not in haystack") + } +} diff --git a/Task/Search-a-list/Swift/search-a-list-3.swift b/Task/Search-a-list/Swift/search-a-list-3.swift new file mode 100644 index 0000000000..e1f8a03548 --- /dev/null +++ b/Task/Search-a-list/Swift/search-a-list-3.swift @@ -0,0 +1,20 @@ +// the second part can be done several ways, but extending any Array of Comparable objects is the most generic approach +extension Array where Element : Comparable { + func lastIndexMatching(needle:Element) -> Int? { + + for i in stride(from: count-1, through: 0, by: -1) { + if self[i] == needle { + return i + } + } + return nil + } +} + +for needle in ["Washington","Bush"] { + if let index = haystack.lastIndexMatching(needle) { + print("\(index) \(needle)") + } else { + print("\(needle) is not in haystack") + } +} diff --git a/Task/Search-a-list/Wart/search-a-list.wart b/Task/Search-a-list/Wart/search-a-list.wart new file mode 100644 index 0000000000..4400a6c756 --- /dev/null +++ b/Task/Search-a-list/Wart/search-a-list.wart @@ -0,0 +1,6 @@ +def (pos x (seq | (head ... tail)) n) + default n :to 0 + if seq + if (head = x) + n + (pos x tail n+1) diff --git a/Task/Search-a-list/jq/search-a-list.jq b/Task/Search-a-list/jq/search-a-list.jq new file mode 100644 index 0000000000..99496deb7f --- /dev/null +++ b/Task/Search-a-list/jq/search-a-list.jq @@ -0,0 +1,15 @@ +["a","b","c"] | index("b") +# => 1 + +["a","b","c","b"] | index("b") +# => 1 + +["a","b","c","b"] + | index("x") as $ix + | if $ix then $ix else error("element not found") end +# => jq: error: element not found + +# Extra task - the last element of an array can be retrieved +# using -1 as an index: +["a","b","c","b","d"] | indices("b")[-1] +# => 3 diff --git a/Task/Secure-temporary-file/Sidef/secure-temporary-file.sidef b/Task/Secure-temporary-file/Sidef/secure-temporary-file.sidef new file mode 100644 index 0000000000..aeafac4402 --- /dev/null +++ b/Task/Secure-temporary-file/Sidef/secure-temporary-file.sidef @@ -0,0 +1,5 @@ +var tmpfile = require('File::Temp'); +var fh = tmpfile.new(UNLINK => 0); +say fh.filename; +fh.print("Hello, World!\n"); +fh.close; diff --git a/Task/Self-describing-numbers/FreeBASIC/self-describing-numbers.freebasic b/Task/Self-describing-numbers/FreeBASIC/self-describing-numbers.freebasic new file mode 100644 index 0000000000..6388fea52b --- /dev/null +++ b/Task/Self-describing-numbers/FreeBASIC/self-describing-numbers.freebasic @@ -0,0 +1,23 @@ +' FB 1.05.0 Win64 + +Function selfDescribing (n As UInteger) As Boolean + If n = 0 Then Return False + Dim ns As String = Str(n) + Dim count(0 To 9) As Integer '' all elements zero by default + While n > 0 + count(n Mod 10) += 1 + n \= 10 + Wend + For i As Integer = 0 To Len(ns) - 1 + If ns[i] - 48 <> count(i) Then Return False '' numerals have ascii values from 48 to 57 + Next + Return True +End Function + +Print "The self-describing numbers less than 100 million are:" +For i As Integer = 0 To 99999999 + If selfDescribing(i) Then Print i; " "; +Next +Print +Print "Press any key to quit" +Sleep diff --git a/Task/Self-describing-numbers/LiveCode/self-describing-numbers-1.livecode b/Task/Self-describing-numbers/LiveCode/self-describing-numbers-1.livecode new file mode 100644 index 0000000000..fbc04e7878 --- /dev/null +++ b/Task/Self-describing-numbers/LiveCode/self-describing-numbers-1.livecode @@ -0,0 +1,11 @@ +function selfDescNumber n + local tSelfD, tLen + put len(n) into tLen + repeat with x = 0 to (tLen - 1) + put n into nCopy + replace x with empty in nCopy + put char (x + 1) of n = (tLen - len(nCopy)) into tSelfD + if not tSelfD then exit repeat + end repeat + return tSelfD +end selfDescNumber diff --git a/Task/Self-describing-numbers/LiveCode/self-describing-numbers-2.livecode b/Task/Self-describing-numbers/LiveCode/self-describing-numbers-2.livecode new file mode 100644 index 0000000000..3b3e82e80b --- /dev/null +++ b/Task/Self-describing-numbers/LiveCode/self-describing-numbers-2.livecode @@ -0,0 +1,9 @@ +on mouseUp + repeat with n = 0 to 10000000 + if selfDescNumber(n) then + put n into selfNum[n] + end if + end repeat + combine selfNum using comma + put selfNum +end mouseUp diff --git a/Task/Self-describing-numbers/LiveCode/self-describing-numbers-3.livecode b/Task/Self-describing-numbers/LiveCode/self-describing-numbers-3.livecode new file mode 100644 index 0000000000..07f9a39c08 --- /dev/null +++ b/Task/Self-describing-numbers/LiveCode/self-describing-numbers-3.livecode @@ -0,0 +1 @@ +1210,2020,21200,3211000 diff --git a/Task/Self-describing-numbers/Nim/self-describing-numbers.nim b/Task/Self-describing-numbers/Nim/self-describing-numbers.nim new file mode 100644 index 0000000000..aa23a0cdf2 --- /dev/null +++ b/Task/Self-describing-numbers/Nim/self-describing-numbers.nim @@ -0,0 +1,20 @@ +import strutils + +proc count(s, sub): int = + var i = 0 + while true: + i = s.find(sub, i) + if i < 0: + break + inc i + inc result + +proc isSelfDescribing(n): bool = + let s = $n + for i, ch in s: + if s.count($i) != parseInt("" & ch): + return false + return true + +for x in 0 .. 4_000_000: + if isSelfDescribing(x): echo x diff --git a/Task/Self-describing-numbers/Phix/self-describing-numbers.phix b/Task/Self-describing-numbers/Phix/self-describing-numbers.phix new file mode 100644 index 0000000000..57b16d67be --- /dev/null +++ b/Task/Self-describing-numbers/Phix/self-describing-numbers.phix @@ -0,0 +1,19 @@ +function self_desc(integer i) +sequence digits = repeat(0,10), counts = repeat(0,10) +integer n = 0, digit + while 1 do + digit := mod(i,10) + digits[10-n] := digit + counts[digit+1] += 1 + i = floor(i/10) + if i=0 then exit end if + n += 1 + end while + return digits[10-n..10] = counts[1..n+1] +end function + +atom t0 = time() +for i=10 to 100_000_000 by 10 do + if self_desc(i) then ?i end if +end for +printf(1,"done (%3.2fs)",time()-t0) diff --git a/Task/Self-describing-numbers/Sidef/self-describing-numbers-1.sidef b/Task/Self-describing-numbers/Sidef/self-describing-numbers-1.sidef new file mode 100644 index 0000000000..b84ab2115c --- /dev/null +++ b/Task/Self-describing-numbers/Sidef/self-describing-numbers-1.sidef @@ -0,0 +1,16 @@ +func sdn(n) { + var b = [0]*n.len; + var a = n.chars; + a.each { |i| b[i] := 0 ++ } + a.join == b.join; +} + +var values = <1210 2020 21200 3211000 +42101000 521001000 6210001000 27 115508>; + +values.each { |test| + say "#{test} is #{sdn(test) ? '' : 'NOT ' }a self describing number."; +} + +say "\nSelf-descriptive numbers less than 1e5 (in base 10):" +0.to(1e5).each { |i| say i if sdn(i.to_s) } diff --git a/Task/Self-describing-numbers/Sidef/self-describing-numbers-2.sidef b/Task/Self-describing-numbers/Sidef/self-describing-numbers-2.sidef new file mode 100644 index 0000000000..61e0993033 --- /dev/null +++ b/Task/Self-describing-numbers/Sidef/self-describing-numbers-2.sidef @@ -0,0 +1,4 @@ +7.to(36).each { |b| + var n = ((b-4) * b**(b-1) + 2*(b**(b-2)) + b**(b-3) + b**3 -> base(b)); + say "base #{'%2d' % b}: #{n}"; +} diff --git a/Task/Self-describing-numbers/jq/self-describing-numbers-1.jq b/Task/Self-describing-numbers/jq/self-describing-numbers-1.jq new file mode 100644 index 0000000000..8aaa30854a --- /dev/null +++ b/Task/Self-describing-numbers/jq/self-describing-numbers-1.jq @@ -0,0 +1,4 @@ +# If your jq includes all/2 then comment out the following definition, +# which is slightly less efficient: +def all(generator; condition): + reduce generator as $i (true; if . then $i | condition else . end); diff --git a/Task/Self-describing-numbers/jq/self-describing-numbers-2.jq b/Task/Self-describing-numbers/jq/self-describing-numbers-2.jq new file mode 100644 index 0000000000..249bd1a2b1 --- /dev/null +++ b/Task/Self-describing-numbers/jq/self-describing-numbers-2.jq @@ -0,0 +1,9 @@ +def selfie: + def count(value): reduce .[] as $i (0; if $i == value then . + 1 else . end); + def digits: tostring | explode | map(. - 48); + + digits + | if add != length then false + else . as $digits + | all ( range(0; length); . as $i | $digits | (.[$i] == count($i)) ) + end; diff --git a/Task/Self-describing-numbers/jq/self-describing-numbers-3.jq b/Task/Self-describing-numbers/jq/self-describing-numbers-3.jq new file mode 100644 index 0000000000..66b39126d2 --- /dev/null +++ b/Task/Self-describing-numbers/jq/self-describing-numbers-3.jq @@ -0,0 +1 @@ +range(0; 100000001) | select(selfie) diff --git a/Task/Self-describing-numbers/jq/self-describing-numbers-4.jq b/Task/Self-describing-numbers/jq/self-describing-numbers-4.jq new file mode 100644 index 0000000000..8b7c977d21 --- /dev/null +++ b/Task/Self-describing-numbers/jq/self-describing-numbers-4.jq @@ -0,0 +1,6 @@ +$ jq -n -f Self-describing_numbers.jq +1210 +2020 +21200 +3211000 +42101000 diff --git a/Task/Self-referential-sequence/EchoLisp/self-referential-sequence-1.echolisp b/Task/Self-referential-sequence/EchoLisp/self-referential-sequence-1.echolisp new file mode 100644 index 0000000000..099c742125 --- /dev/null +++ b/Task/Self-referential-sequence/EchoLisp/self-referential-sequence-1.echolisp @@ -0,0 +1,112 @@ +(lib 'hash) +(lib 'list) ;; permutations + +(define H (make-hash)) + +;; G R A P H +;; generate 'normalized' starter vectors D[i] = number of digits 'i' (0 <=i < 10) +;; reduce graph size : 9009, 9900 .. will be generated once : vector #(2 0 0 0 0 0 0 0 0 2) + +(define (generate D dstart ndigits (sd 0)) +(when (> ndigits 0) + (set! sd (vector-ref D dstart)) ;; save before recurse + (for ((i (in-range 0 (1+ ndigits)))) + #:continue (and ( = i 0) (> dstart 0)) + (vector-set! D dstart i) + (sequence D) ;; sequence length from D + (for ((j (in-range (1+ dstart) 10))) + (generate D j (- ndigits i)))) + (vector-set! D dstart sd))) ;; restore + + +;; compute follower of D (at most 99 same digits) +(define (dnext D (dd 0)) + (define N (make-vector 10)) + (for ((d D) (i 10)) + #:continue (zero? d) + (vector-set! N i (1+ (vector-ref N i))) + (if (< d 10) + (vector-set! N d (1+ (vector-ref N d))) ;; d < 9 + (begin + (set! dd (modulo d 10)) + (vector-set! N dd (1+ (vector-ref N dd))) + (set! dd (quotient d 10)) + (vector-set! N dd (1+ (vector-ref N dd)))))) + N) + + +;; update all nodes in same sequence +;; seq-length (next D) = 1 - seq-length(D) +(define (sequence D) +(define (dists D d) + (unless (hash-ref H D) + (hash-set H D d) + (dists (dnext D ) (1- d)))) + + (unless (hash-ref H D) + (dists D (sequence-length D)))) + +;; sequence length from D +;; stops on loop found (node N) +(define (sequence-length D ) +(define (looper N looplg depth) ;; looper 2 : a b a + (when ( > depth 0) + (hash-set H N looplg) + (looper (dnext N) looplg (1- depth)))) + + (define followers (make-hash)) + (define N (dnext D)) + (define seqlg 0) + (define looplg 0) + + (hash-set followers D 0) + + (set! seqlg + (for ((lg (in-naturals 1 ))) + #:break (hash-ref H N) => (+ lg (hash-ref H N)) ;; already known + #:break (hash-ref followers N) => lg ;; loop found + (hash-set followers N lg) + (set! N (dnext N)))) + +;; update nodes in loop : same seq-length + (when (hash-ref followers N) ;; loop found + (set! looplg ( - seqlg (hash-ref followers N))) + (looper N looplg looplg)) + + seqlg ) + +;; O U T P U T +;; backwards from D - normalized vector - to numbers (as strings) +(define (starters D) +(define (not-leading-zero list) (!zero? (first list))) + (map list->string + (filter not-leading-zero (make-set (permutations (for/fold (acc null) ((d D) (i 10)) + #:continue (zero? d) + (append acc (for/list ((j d)) i)))))))) + + +;; printing one node +(define (D-print D) + (set! D (reverse (vector->list D))) + (for/string ( (d D) (i (in-range 9 -1 -1))) + #:continue (zero? d) + (string-append d i))) + +;; print graph contents +(define (print-sequence D) + (writeln 1 (starters D)) + (writeln 2 (D-print D )) + (for ((i (in-range 1 (hash-ref H D)))) + (writeln (+ i 2) (D-print (setv! D (dnext D)))))) + + +;; TA S K +(define (task (n 6) (verbose #t)) + (generate (make-vector 10) 0 n) + (define seqmax (apply max (hash-values H))) + (when verbose (for ((kv H)) + #:continue (!= (rest kv ) seqmax) + (print-sequence (first kv)))) + + (writeln (expt 10 n) '--> 'max-sequence= (1+ seqmax) 'nodes= (length (hash-values H)))) + diff --git a/Task/Self-referential-sequence/EchoLisp/self-referential-sequence-2.echolisp b/Task/Self-referential-sequence/EchoLisp/self-referential-sequence-2.echolisp new file mode 100644 index 0000000000..0302c27a76 --- /dev/null +++ b/Task/Self-referential-sequence/EchoLisp/self-referential-sequence-2.echolisp @@ -0,0 +1,32 @@ +(task 6) +1 (9009 9090 9900) +2 2920 +3 192210 +4 19222110 +5 19323110 +6 1923123110 +7 1923224110 +8 191413323110 +9 191433125110 +10 19151423125110 +11 19251413226110 +12 1916151413325110 +13 1916251423127110 +14 191716151413326110 +15 191726151423128110 +16 19181716151413327110 +17 19182716151423129110 +18 29181716151413328110 +19 19281716151423228110 +20 19281716151413427110 +21 19182716152413228110 +1000000 --> max-sequence= 21 nodes= 10926 + +(task 7 #f) +10000000 --> max-sequence= 21 nodes= 23432 +(task 8 #f) +100000000 --> max-sequence= 21 nodes= 47359 +(task 9 #f) +1000000000 --> max-sequence= 21 nodes= 97455 +(task 10 #f) +10000000000 --> max-sequence= 21 nodes= 188493 diff --git a/Task/Self-referential-sequence/jq/self-referential-sequence-1.jq b/Task/Self-referential-sequence/jq/self-referential-sequence-1.jq new file mode 100644 index 0000000000..46ad3ec4a7 --- /dev/null +++ b/Task/Self-referential-sequence/jq/self-referential-sequence-1.jq @@ -0,0 +1,61 @@ +# Given any array, produce an array of [item, count] pairs for each run. +def runs: + reduce .[] as $item + ( []; + if . == [] then [ [ $item, 1] ] + else .[length-1] as $last + | if $last[0] == $item + then (.[0:length-1] + [ [$item, $last[1] + 1] ] ) + else . + [[$item, 1]] + end + end ) ; + +# string to string +def next_self_referential: + def runs2integer: # input is an array as produced by runs, + # i.e. an array of [count, n] pairs, where count is an int, + # and n is an "exploded" digit + reduce .[] as $pair + (""; . + ($pair[1] | tostring) + ([$pair[0]]|implode) ) ; + + explode | sort | reverse | runs | runs2integer; + +# Given an integer as a string, +# compute the entire sequence (of strings) to convergence: +def sequence_of_self_referentials: + def seq: + . as $ary + | (.[length-1] | next_self_referential) as $next + | if ($ary|index($next)) then $ary + else $ary + [$next] | seq + end; + [.] | seq; + +def maximals(n): + def interesting: + tostring | (. == (explode | sort | reverse | implode)); + + reduce range(0;n) as $i + ([[], 0]; # maximalseeds, length + if ($i | interesting) then + ($i|tostring|sequence_of_self_referentials|length) as $length + | if .[1] == $length then [ .[0] + [$i], $length] + elif .[1] < $length then [ [$i], $length] + else . + end + else . + end ); + +def task(n): + maximals(n) as $answer + | "The maximal length to convergence for seeds up to \(n) is \($answer[1]).", + "The corresponding seeds are the allowed permutations", + "of the representative number(s): \($answer[0][])", + "For each representative seed, the self-referential sequence is as follows:", + ($answer[0][] | tostring + | ("Representative: \(.)", + "Self-referential sequence:", + (sequence_of_self_referentials | map(tonumber)))) + ; + +task(1000000) diff --git a/Task/Self-referential-sequence/jq/self-referential-sequence-2.jq b/Task/Self-referential-sequence/jq/self-referential-sequence-2.jq new file mode 100644 index 0000000000..143dd4a144 --- /dev/null +++ b/Task/Self-referential-sequence/jq/self-referential-sequence-2.jq @@ -0,0 +1,30 @@ +$ jq -n -r -f Self_referential_sequence.jq +The maximal length to convergence for seeds up to 1000000 is 21. +The corresponding seeds are the allowed permutations +of the representative number(s): 9900 +For each representative seed, the self-referential sequence is as follows: +Representative: 9900 +Self-referential sequence: +[ + 9900, + 2920, + 192210, + 19222110, + 19323110, + 1923123110, + 1923224110, + 191413323110, + 191433125110, + 19151423125110, + 19251413226110, + 1916151413325110, + 1916251423127110, + 191716151413326100, + 191726151423128100, + 19181716151413326000, + 19182716151423128000, + 29181716151413330000, + 19281716151423230000, + 19281716151413430000, + 19182716152413230000 +] diff --git a/Task/Semiprime/ERRE/semiprime.erre b/Task/Semiprime/ERRE/semiprime.erre new file mode 100644 index 0000000000..930a408731 --- /dev/null +++ b/Task/Semiprime/ERRE/semiprime.erre @@ -0,0 +1,26 @@ +PROGRAM SEMIPRIME_NUMBER + +!VAR I% + +PROCEDURE SEMIPRIME(N%->RESULT%) + LOCAL F%,P% + P%=2 + LOOP + EXIT IF NOT(F%<2 AND P%*P%<=N%) + WHILE (N% MOD P%)=0 DO + N%=N% DIV P% + F%+=1 + END WHILE + P%+=1 + END LOOP + RESULT%=F%-(N%>1)=2 +END PROCEDURE + +BEGIN + PRINT(CHR$(12);) !CLS + FOR I%=2 TO 100 DO + SEMIPRIME(I%->RESULT%) + IF RESULT% THEN PRINT(I%;) END IF + END FOR + PRINT +END PROGRAM diff --git a/Task/Semiprime/EchoLisp/semiprime.echolisp b/Task/Semiprime/EchoLisp/semiprime.echolisp new file mode 100644 index 0000000000..d32fa90ba7 --- /dev/null +++ b/Task/Semiprime/EchoLisp/semiprime.echolisp @@ -0,0 +1,20 @@ +(lib 'math) +(define (semi-prime? n) + (= (length (prime-factors n)) 2)) + +(for ((i 100)) + (when (semi-prime? i) (write i))) + +4 6 9 10 14 15 21 22 25 26 33 34 35 38 39 46 49 51 55 57 58 62 65 69 74 77 82 85 86 87 91 93 94 95 + +(lib 'bigint) +(define N (* (random-prime 10000000) (random-prime 10000000))) + → 6764578882969 +(semi-prime? N) + → #t + +;; a pair n,n+1 of semi-primes +(prime-factors 100000000041) + → (3 33333333347) +(prime-factors 100000000042) + → (2 50000000021) diff --git a/Task/Semiprime/Oforth/semiprime.oforth b/Task/Semiprime/Oforth/semiprime.oforth new file mode 100644 index 0000000000..5cb966c24e --- /dev/null +++ b/Task/Semiprime/Oforth/semiprime.oforth @@ -0,0 +1,4 @@ +func: semiprime(n) +| i | + 0 2 n sqrt asInteger for: i [ while(n i /mod swap 0 &=) [ ->n 1+ ] drop ] + n 1 > ifTrue: [ 1+ ] 2 == ; diff --git a/Task/Semiprime/Ring/semiprime.ring b/Task/Semiprime/Ring/semiprime.ring new file mode 100644 index 0000000000..642d8f75b2 --- /dev/null +++ b/Task/Semiprime/Ring/semiprime.ring @@ -0,0 +1,24 @@ +prime = 1679 +decomp(prime) + +func decomp nr +x = "" +sum = 0 +for i = 1 to nr + if isPrime(i) and nr % i = 0 + sum = sum + 1 + x = x + string(i) + " * " ok + if i = nr and sum = 2 + x2 = substr(x,1,(len(x)-2)) + see string(nr) + " = " + x2 + "is semiprime" + nl + but i = nr and sum != 2 see string(nr) + " is not semiprime" + nl ok +next + +func isPrime n + if n < 2 return false ok + if n < 4 return true ok + if n % 2 = 0 return false ok + for d = 3 to sqrt(n) step 2 + if n % d = 0 return false ok + next + return true diff --git a/Task/Semiprime/Sidef/semiprime.sidef b/Task/Semiprime/Sidef/semiprime.sidef new file mode 100644 index 0000000000..b6e27739f7 --- /dev/null +++ b/Task/Semiprime/Sidef/semiprime.sidef @@ -0,0 +1,12 @@ +require('ntheory'); + +func is_semiprime(n) { + static nt = %S'ntheory'; + if (var p = [nt.trial_factor(n, 500)]) { + return false if (p.len > 2); + return !!nt.is_prime(p[1]) if (p.len == 2); + } + [nt.factor(n)].len == 2; +} + +say [2,4,99,100,1679,32768,1234567,9876543,900660121].grep{ is_semiprime(_) } diff --git a/Task/Semiprime/Swift/semiprime.swift b/Task/Semiprime/Swift/semiprime.swift new file mode 100644 index 0000000000..3a7997adcc --- /dev/null +++ b/Task/Semiprime/Swift/semiprime.swift @@ -0,0 +1,37 @@ +import Foundation + +func primes(n: Int) -> AnyGenerator { + + var (seive, i) = ([Int](0.. Bool { + let g = primes(n) + while let first = g.next() { + if n % first == 0 { + if first * first == n { + return true + } else { + while let second = g.next() { + if first * second == n { return true } + } + } + } + } + return false +} diff --git a/Task/Semordnilap/8th/semordnilap.8th b/Task/Semordnilap/8th/semordnilap.8th new file mode 100644 index 0000000000..ebfeb75101 --- /dev/null +++ b/Task/Semordnilap/8th/semordnilap.8th @@ -0,0 +1,17 @@ +[] var, results + +: processline \ m s -- + clone nip + tuck s:rev + m:exists? if + results @ rot a:push drop + else + swap true m:! + then ; + +{} "unixdict.txt" app:asset >s +' processline s:eachline + +results @ dup a:len . " pairs" . cr +a:shuffle +( a:shift dup . " is the reverse of " . s:rev . cr ) 5 times bye diff --git a/Task/Semordnilap/EchoLisp/semordnilap.echolisp b/Task/Semordnilap/EchoLisp/semordnilap.echolisp new file mode 100644 index 0000000000..ed42bda984 --- /dev/null +++ b/Task/Semordnilap/EchoLisp/semordnilap.echolisp @@ -0,0 +1,30 @@ +(lib 'struct) +(lib 'sql) +(lib 'words) + +(lib 'dico.fr.no-accent) ;; load dictionary +(string-delimiter "") + +;; check reverse r of w is a word +;; take only one pair : r < w +(define (semordnilap? w) + (define r (list->string (reverse (string->list w)))) + (and (word? r) (string (string-length a) (string-length b))) + +(define (task) +;; select unique words into the list 'mots' + (define mots (make-set (words-select #:any null 999999))) + (define semordnilap + (list-sort string-sort (for/list ((w mots)) + #:when (semordnilap? w) + w ))) + (writeln 'pairs '→ (length semordnilap)) + (writeln 'longest '→ (take semordnilap 5))) + +{{out}} +(task) + pairs → 345 + longest → (rengager tresser strasse reveler retrace) diff --git a/Task/Semordnilap/FreeBASIC/semordnilap.freebasic b/Task/Semordnilap/FreeBASIC/semordnilap.freebasic new file mode 100644 index 0000000000..9b50e3869a --- /dev/null +++ b/Task/Semordnilap/FreeBASIC/semordnilap.freebasic @@ -0,0 +1,80 @@ +' version 20-06-2015 +' compile with: fbc -s console + +Function reverse(norm As String) As String + + Dim As String rev + Dim As Integer i, l = Len(norm) -1 + + rev = norm + For i = 0 To l + rev[l-i] = norm[i] + Next + + Return rev + +End Function + +' ------=< MAIN >=------ + +Dim As Integer i, j, count, amount, ff = FreeFile +Dim As String in_str, rev, big = " " ' big needs to start with a space +Dim As String norm(27000), result(270, 2) + +Print +Print "Start reading unixdict.txt"; + +Open "unixdict.txt" For Input As #ff + +While Not Eof(ff) ' read to end of file + + Line Input #ff, in_str ' get line = word + in_str = Trim(in_str) ' we don't want spaces + If Len(in_str) > 1 Then ' if length > 1 then reverse + rev = reverse(in_str) + If in_str <> rev Then ' if in_str is not a palingdrome + count = count + 1 ' increase counter + norm(count) = in_str ' store in the array + big = big + rev + " " ' create big string with reversed words + End If + End If + +Wend + +Close #ff + +Print " ... Done" +Print : Print "Start looking for semordnilap" + +For i = 1 To count + For j = 1 To amount ' check to avoid the double + If result(j, 2) = norm(i) Then Continue For, For + Next + j = InStr(big, " " + norm(i) + " ") + If j <> 0 Then ' found one + amount = amount + 1 ' increase counter + result(amount,1) = norm(i) ' store normal word + result(amount,2) = reverse(norm(i)) ' store reverse word + End If +Next + +Print : Print "Found"; amount; " unique semordnilap pairs" +Print : Print "Display 5 semordnilap pairs" +Print + +count = 0 +For i = 1 To amount + If Len(result(i,1)) >= 5 Then + count = count + 1 + Print result(i, 1), result(i, 2) + If count >= 5 Then Exit For + EndIf +Next + +Print + +' empty keyboard buffer +While InKey <> "" : Wend +Print : Print "Hit any key to end program" +Sleep +End diff --git a/Task/Semordnilap/Lasso/semordnilap.lasso b/Task/Semordnilap/Lasso/semordnilap.lasso new file mode 100644 index 0000000000..2cd9770010 --- /dev/null +++ b/Task/Semordnilap/Lasso/semordnilap.lasso @@ -0,0 +1,29 @@ +local( + words = string(include_url('http://www.puzzlers.org/pub/wordlists/unixdict.txt')) -> split('\n'), + semordnilaps = array, + found_size, + example, + haveexamples = false, + examples = array +) + +#words -> removeall('') + +with word in #words do { + local(reversed = string(#word) -> reverse&) + if(not(#word == #reversed) and not(#semordnilaps >> #word) and not(#semordnilaps >> #reversed) and #words >> #reversed) => { + #semordnilaps -> insert(#word = #reversed) + } +} + +#found_size = #semordnilaps -> size + +while(not(#haveexamples)) => { + #example = #semordnilaps -> get(integer_random(#found_size, 1)) + not(#examples >> #example -> name) ? #examples -> insert(#example) + #examples -> size >= 5 ? #haveexamples = true +} +'Total found: ' +#found_size +'
' +#examples diff --git a/Task/Semordnilap/Nim/semordnilap.nim b/Task/Semordnilap/Nim/semordnilap.nim new file mode 100644 index 0000000000..c1678f797c --- /dev/null +++ b/Task/Semordnilap/Nim/semordnilap.nim @@ -0,0 +1,16 @@ +import strutils, sequtils, sets, algorithm + +proc reverse(s): string = + result = newString(s.len) + for i,c in s: + result[s.high - i] = c + +let + words = readFile("unixdict.txt").strip.splitLines + wordset = words.toSet + revs = words.map(reverse) +var pairs = zip(words, revs).filterIt(it[0] < it[1] and it[1] in wordset) + +echo "Total number of semordnilaps: ", pairs.len +pairs.sort(proc (x,y): auto = cmp(x[0].len,y[0].len)) +echo pairs[pairs.high-4..pairs.high] diff --git a/Task/Semordnilap/Oforth/semordnilap.oforth b/Task/Semordnilap/Oforth/semordnilap.oforth new file mode 100644 index 0000000000..daaea4102b --- /dev/null +++ b/Task/Semordnilap/Oforth/semordnilap.oforth @@ -0,0 +1,8 @@ +: semordnilap +| w wr wrds | + ListBuffer new ->wrds + ListBuffer new + File new("unixdict.txt") forEach: w [ + wrds include(w reverse dup ->wr) ifTrue: [ [wr, w] over add ] + w wr < ifTrue: [ wrds add(w) ] + ] ; diff --git a/Task/Semordnilap/Phix/semordnilap.phix b/Task/Semordnilap/Phix/semordnilap.phix new file mode 100644 index 0000000000..9a43f735c3 --- /dev/null +++ b/Task/Semordnilap/Phix/semordnilap.phix @@ -0,0 +1,20 @@ +sequence words={}, semilordnaps={} +object word +constant fn = open("demo\\unixdict.txt","r") + +while 1 do + word = trim(gets(fn)) + if atom(word) then exit end if + if find(reverse(word),words) then + semilordnaps = append(semilordnaps,word) + end if + words = append(words,word) +end while + +close(fn) + +?length(semilordnaps) +for i=1 to 5 do + word = semilordnaps[i] + printf(1,"%s - %s\n",{word,reverse(word)}) +end for diff --git a/Task/Semordnilap/Ring/semordnilap.ring b/Task/Semordnilap/Ring/semordnilap.ring new file mode 100644 index 0000000000..37069484a0 --- /dev/null +++ b/Task/Semordnilap/Ring/semordnilap.ring @@ -0,0 +1,17 @@ +load "stdlib.ring" +aList = file2list("C:\Ring\unixdict.txt") +for m = 1 to 10 + nr = random(len(aList)-1) + 1 + bool = semordnilap(aList[nr]) + see aList[nr] + nl + if bool = 0 see "is palindrome" + nl + nl + else see "is semordnilap" + nl + nl ok +next + +func semordnilap aString + bString = "" + for i=len(aString) to 1 step -1 + bString = bString + aString[i] + next + see aString + if aString = bString return 0 else return 1 ok diff --git a/Task/Semordnilap/Sidef/semordnilap.sidef b/Task/Semordnilap/Sidef/semordnilap.sidef new file mode 100644 index 0000000000..27ba6f702c --- /dev/null +++ b/Task/Semordnilap/Sidef/semordnilap.sidef @@ -0,0 +1,11 @@ +var c = 0 +var seen = Hash() + +ARGF.each { |line| + line.chomp! + var r = line.reverse + ((seen{r} := 0 ++) && (c++ < 5) && say "#{line} #{r}") -> + || (seen{line} := 0 ++) +} + +say c diff --git a/Task/Semordnilap/jq/semordnilap.jq b/Task/Semordnilap/jq/semordnilap.jq new file mode 100644 index 0000000000..6989ec8f9e --- /dev/null +++ b/Task/Semordnilap/jq/semordnilap.jq @@ -0,0 +1,11 @@ +# Produce a stream +def report: + split("\n") as $list + # construct the dictionary: + | (reduce $list[] as $entry ({}; . + {($entry): 1})) as $dict + # construct the list of semordnilaps: + | $list[] + | select( (explode|reverse|implode) as $rev + | (. < $rev and $dict[$rev]) ); + +[report] | (.[0:5][], "length = \(length)") diff --git a/Task/Send-an-unknown-method-call/Lasso/send-an-unknown-method-call.lasso b/Task/Send-an-unknown-method-call/Lasso/send-an-unknown-method-call.lasso new file mode 100644 index 0000000000..c3af5bee8f --- /dev/null +++ b/Task/Send-an-unknown-method-call/Lasso/send-an-unknown-method-call.lasso @@ -0,0 +1,11 @@ +define mytype => type { + public foo() => { + return 'foo was called' + } + public bar() => { + return 'this time is was bar' + } +} +local(obj = mytype, methodname = tag('foo'), methodname2 = tag('bar')) +#obj->\#methodname->invoke +#obj->\#methodname2->invoke diff --git a/Task/Send-an-unknown-method-call/Lingo/send-an-unknown-method-call.lingo b/Task/Send-an-unknown-method-call/Lingo/send-an-unknown-method-call.lingo new file mode 100644 index 0000000000..3f150a0138 --- /dev/null +++ b/Task/Send-an-unknown-method-call/Lingo/send-an-unknown-method-call.lingo @@ -0,0 +1,5 @@ +obj = script("MyClass").new() +-- ... +method = #foo +arg1 = 23 +res = call(method, obj, arg1) diff --git a/Task/Send-an-unknown-method-call/Oforth/send-an-unknown-method-call-1.oforth b/Task/Send-an-unknown-method-call/Oforth/send-an-unknown-method-call-1.oforth new file mode 100644 index 0000000000..2ec5b70a66 --- /dev/null +++ b/Task/Send-an-unknown-method-call/Oforth/send-an-unknown-method-call-1.oforth @@ -0,0 +1 @@ +16 "sqrt" asMethod perform diff --git a/Task/Send-an-unknown-method-call/Oforth/send-an-unknown-method-call-2.oforth b/Task/Send-an-unknown-method-call/Oforth/send-an-unknown-method-call-2.oforth new file mode 100644 index 0000000000..ef15417f77 --- /dev/null +++ b/Task/Send-an-unknown-method-call/Oforth/send-an-unknown-method-call-2.oforth @@ -0,0 +1 @@ +16 "sqrt" Word find perform diff --git a/Task/Send-an-unknown-method-call/Sidef/send-an-unknown-method-call.sidef b/Task/Send-an-unknown-method-call/Sidef/send-an-unknown-method-call.sidef new file mode 100644 index 0000000000..9660283fe3 --- /dev/null +++ b/Task/Send-an-unknown-method-call/Sidef/send-an-unknown-method-call.sidef @@ -0,0 +1,11 @@ +class Example { + method foo(x) { + 42 + x + } +} + +var name = 'foo' +var obj = Example() + +say obj.(name)(5) # prints: 47 +say obj.method(name)(5) # =//= diff --git a/Task/Send-email/Lasso/send-email.lasso b/Task/Send-email/Lasso/send-email.lasso new file mode 100644 index 0000000000..206c0588e6 --- /dev/null +++ b/Task/Send-email/Lasso/send-email.lasso @@ -0,0 +1,33 @@ +// with a lot of unneeded params. +// sends plain text and html in same email +// simple usage is below +email_send( + -host = 'mail.example.com', + -port = 25, + -timeout = 100, + -username = 'user.name', + -password = 'secure_password', + -priority = 'immediate', + -to = 'joe@average.com', + -cc = 'jane@average.com', + -bcc = 'me@too.com', + -from = 'lasso@example.com', + -replyto = 'lassorocks@example.com', + -sender = 'lasso@example.com', + -subject = 'Lasso is awesome', + -body = 'Lasso is awesome, you should try it!', + -html = '

[#numbers->join(', ')] (Reload)